fixed conflict while merging with master branch
diff --git a/.gitignore b/.gitignore
index 28fcc88..95255be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,11 +1,10 @@
 *.pyc
 *.comp.js
 .DS_Store
-server_tools
-services
 user_files
 patch.log
 lib
-versions-local.db
+conf.py
+version.num
 user_files
 *.sql*
diff --git a/build.json b/build.json
index 499d594..79813e3 100644
--- a/build.json
+++ b/build.json
@@ -1,182 +1,19 @@
-[
-	{
-		"lib/js/core.min.js": [
-			"lib/js/wn/class.js",
-			"lib/js/wn/provide.js",
-			"lib/js/wn/xmlhttp.js",
-			"lib/js/wn/versions.js",
-			"lib/js/wn/assets.js",
-			"lib/js/wn/require.js",
-			"lib/js/wn/dom.js",
-			"lib/js/wn/page.js",
-			"lib/js/wn/misc/user.js",
-			"lib/js/lib/json2.js",
-			"lib/js/core.js"
-		]
-	},
-
-	{
-		"lib/js/wn/ui/toolbar.min.js": [
-			"lib/js/wn/ui/toolbar/selector_dialog.js",
-			"lib/js/wn/ui/toolbar/new.js",
-			"lib/js/wn/ui/toolbar/search.js",
-			"lib/js/wn/ui/toolbar/report.js",
-			"lib/js/wn/ui/toolbar/recent.js",
-			"lib/js/wn/ui/toolbar/toolbar.js"
-		]	
-	},
-	
-	{
-		"lib/js/legacy/report.compressed.js": [
-			"lib/js/legacy/widgets/report_builder/report_builder.js",
-			"lib/js/legacy/widgets/report_builder/datatable.js",
-			"lib/js/legacy/widgets/report_builder/calculator.js"
-		]
-	},
-
-	{
-		"css/all-web.css": [
-			"lib/css/legacy/body.css",
-			"lib/css/legacy/messages.css",
-			"lib/css/legacy/dialog.css",
-			"lib/css/bootstrap/headings.css",
-			"lib/css/bootstrap/buttons.css",
-			"lib/css/bootstrap/navbar.css",
-			"lib/css/bootstrap/dropdown.css",
-			"lib/css/bootstrap/tooltip.css",
-			"erpnext/startup/startup.css",
-			"erpnext/website/css/website.css"	
-		]
-	},
-	
-	{
-		"css/all-app.css": [
-			"lib/css/legacy/body.css",
-			"lib/css/legacy/messages.css",
-			"lib/css/legacy/forms.css",
-			"lib/css/legacy/grid.css",
-			"lib/css/legacy/listing.css",
-			"lib/css/legacy/report.css",
-			"lib/css/legacy/autosuggest.css",
-			"lib/css/legacy/dialog.css",
-			"lib/css/legacy/tabs.css",
-			"lib/css/legacy/sidebar.css",
-			"lib/css/bootstrap/headings.css",
-			"lib/css/bootstrap/buttons.css",
-			"lib/css/bootstrap/navbar.css",
-			"lib/css/bootstrap/dropdown.css",
-			"lib/css/bootstrap/tooltip.css",
-			"lib/css/bootstrap/label.css",
-			"lib/css/bootstrap/icons.css",
-			"erpnext/startup/startup.css"							
-		]
-	},
-
-	{
-		"js/all-web.js": [
-			"lib/js/lib/history/history.min.js:concat",
-			"lib/js/lib/bootstrap.min.js:concat",
-			"lib/js/lib/sprintf.js",
-			"lib/js/core.min.js:concat",
-			"lib/js/legacy/globals.js",
-			"lib/js/legacy/utils/datatype.js",
-			"lib/js/legacy/utils/datetime.js",
-			"lib/js/legacy/utils/dom.js",
-			"lib/js/legacy/utils/handler.js",
-			"lib/js/legacy/utils/msgprint.js",
-			"lib/js/legacy/utils/shortcut.js",
-			"lib/js/legacy/widgets/form/fields.js",
-			"lib/js/wn/ui/dialog.js",
-			"lib/js/legacy/widgets/dialog.js",
-			"lib/js/wn/ui/listing.js",
-			"lib/js/legacy/widgets/layout.js",
-			"lib/js/legacy/webpage/page_header.js",
-			"lib/js/legacy/widgets/select.js",
-			"lib/js/legacy/webpage/history.js",
-			"lib/js/legacy/webpage/search.js",
-			"lib/js/legacy/webpage/spinner.js",
-			"lib/js/legacy/webpage/freeze_page.js",
-			"lib/js/legacy/webpage/error_console.js",
-			"lib/js/legacy/webpage/loaders.js",
-			"lib/js/legacy/webpage/uploader.js",
-			"lib/js/legacy/webpage/page.js",
-			"lib/js/legacy/wn/page_layout.js",
-			"lib/js/legacy/wn/widgets/footer.js",
-			"lib/js/legacy/model/local_data.js",
-			"lib/js/legacy/model/doclist.js",
-			"lib/js/legacy/webpage/body.js",
-			"lib/js/legacy/app.js",
-			"js/app.js",
-			"erpnext/startup/startup.js",
-			"erpnext/website/js/topbar.js"
-		]
-	},
-	
-	{
-		"js/all-app.js": [
-			"lib/js/lib/history/history.min.js:concat",
-			"lib/js/legacy/jquery/jquery-ui.min.js:concat",
-			"lib/js/legacy/tiny_mce_33/jquery.tinymce.js:concat",
-			"lib/js/lib/bootstrap.min.js:concat",
-			"lib/js/lib/sprintf.js",
-			"lib/js/core.min.js:concat",
-			"lib/js/legacy/globals.js",
-			"lib/js/legacy/utils/datatype.js",
-			"lib/js/legacy/utils/datetime.js",
-			"lib/js/legacy/utils/dom.js",
-			"lib/js/legacy/utils/handler.js",
-			"lib/js/legacy/utils/msgprint.js",
-			"lib/js/legacy/utils/shortcut.js",
-			"lib/js/legacy/utils/printElement.js",
-			"lib/js/legacy/widgets/form/fields.js",
-			"lib/js/wn/ui/dialog.js",
-			"lib/js/legacy/widgets/dialog.js",
-			"lib/js/legacy/widgets/listing.js",
-			"lib/js/wn/ui/listing.js",
-			"lib/js/legacy/widgets/layout.js",
-			"lib/js/legacy/widgets/tabbedpage.js",
-			"lib/js/legacy/webpage/page_header.js",
-			"lib/js/legacy/widgets/select.js",
-			"lib/js/legacy/widgets/tags.js",
-			"lib/js/legacy/widgets/export_query.js",
-			"lib/js/legacy/webpage/history.js",
-			"lib/js/legacy/webpage/search.js",
-			"lib/js/legacy/webpage/spinner.js",
-			"lib/js/legacy/webpage/freeze_page.js",
-			"lib/js/legacy/webpage/error_console.js",
-			"lib/js/legacy/webpage/loaders.js",
-			"lib/js/legacy/webpage/uploader.js",
-			"lib/js/legacy/webpage/page.js",
-			"lib/js/legacy/wn/page_layout.js",
-			"lib/js/legacy/wn/widgets/page_sidebar.js",
-			"lib/js/legacy/wn/widgets/footer.js",
-			"lib/js/legacy/model/local_data.js",
-			"lib/js/legacy/model/doclist.js",
-			"lib/js/wn/ui/toolbar.min.js:concat",
-			"lib/js/legacy/webpage/body.js",
-			"lib/js/legacy/widgets/form/fields.js",
-			"lib/js/legacy/widgets/form/form_container.js",
-			"lib/js/legacy/widgets/form/form_header.js",
-			"lib/js/legacy/widgets/form/form.js",
-			"lib/js/legacy/widgets/form/form_fields.js",
-			"lib/js/legacy/widgets/form/grid.js",
-			"lib/js/legacy/widgets/form/form_grid.js",
-			"lib/js/legacy/widgets/form/print_format.js",
-			"lib/js/legacy/widgets/form/email.js",
-			"lib/js/legacy/widgets/form/clientscriptAPI.js",
-			"lib/js/legacy/widgets/form/form_comments.js",
-			"lib/js/legacy/wn/widgets/form/sidebar.js",
-			"lib/js/legacy/wn/widgets/form/comments.js",
-			"lib/js/legacy/wn/widgets/form/attachments.js",
-			"lib/js/legacy/wn/widgets/form/assign_to.js",
-			"lib/js/legacy/app.js",
-			"js/app.js",
-			"erpnext/startup/startup.js",
-			"erpnext/startup/js/modules.js",
-			"erpnext/startup/js/toolbar.js",
-			"erpnext/startup/js/feature_setup.js"
-		]
-	}
-	
-]
-
+{
+	"css/all-web.css": [
+		"erpnext/startup/startup.css",
+		"erpnext/website/css/website.css"	
+	],
+	"css/all-app.css": [
+		"erpnext/startup/startup.css"
+	],
+	"js/all-web.js": [
+		"erpnext/startup/startup.js",
+		"erpnext/website/js/topbar.js"
+	],
+	"js/all-app.js": [
+		"erpnext/startup/startup.js",
+		"erpnext/startup/js/modules.js",
+		"erpnext/startup/js/toolbar.js",
+		"erpnext/startup/js/feature_setup.js"
+	]
+}
\ No newline at end of file
diff --git a/css/all-app.css b/css/all-app.css
index 0dea8b7..ff022b7 100644
--- a/css/all-app.css
+++ b/css/all-app.css
@@ -1,1151 +1,8 @@
 
 /*
- *	lib/css/legacy/body.css
- */html { 
-	margin: 0px;
-	padding: 0px;
-}
-
-body {	
-	margin: 0px;
-	padding: 0px;
-	font-family: Arial, Helvetica, Sans;
-	font-size: 12px;
-	color: #000;
-	background-color: #e2e2e2;
-}
-
-pre { margin: 0px; padding: 0px; }
-
-button { margin: 2px; margin-left: 0px; }
-
-label {
-	padding-top: 15px;
-	color: #404040;
-}
-
-select, input, textarea { 
-	border: 1px solid #AAA; 
-	-moz-border-radius: 4px;
-	-webkit-border-radius: 4px;
-	font-size: 13px;
-	padding: 4px;
-	color: #222;
-}
-
-textarea { 
-	font-family: inherit; 
-	height: 120px; 
-	width: 90%; 
-	font-size: 12px; 
-	white-space: normal;
-}
-
-table { padding: 0px; border-collapse: 'collapse'}
-
-td { 
-	padding:0px; 
-	margin: 0px; 
-	vertical-align: top; 
-}
-
-p {
-	margin: 0px 0px 9px 0px;
-	line-height: 1.5em;
-}
-
-li {
-	line-height: 1.5em;
-}
-
-hr {
-  margin: 18px 0;
-  border: 0;
-  border-top: 1px solid #e5e5e5;
-  border-bottom: 1px solid #ffffff;
-}
-
-/* links */
-
-a:active { outline:none; }
-
-a {
-  color: #0088cc;
-  text-decoration: none;
-}
-a:hover {
-  color: #005580;
-  text-decoration: underline;
-}
-
-.link_type {
-	padding:2px;
-	color: #0088cc;
-	cursor: pointer;
-}
-
-.link_type:hover {
-	color: #005580;
-	text-decoration: underline;
-}
-
-:focus { -moz-outline-style:none; }
-
-table.simpletable { border-collapse: collapse; margin-bottom: 10px;}
-table.simpletable td {border: 1pt solid #000; vertical-align: top; padding: 2px; }
-
-div.fix_ff_cursor { overflow: auto; }
-
-/* --- Layout --- */
-
-div.comment { color: #444; }
-
-div#body_div {
-	position: relative;
-	display: none;
-	padding-right: 7px;
-	width: 900px;
-	margin: auto;
-	margin-top: 56px;
-}
-
-footer {
-	width: 900px;
-	margin: auto;
-}
-header .container {
-	width: 900px;
-	margin: auto;
-}
-
-div.no_script {
-	display: none;
-}
-
-div.loading_div {
-	position: absolute;
-	background-color: #FFFFCC;
-	z-index: 1999;
-	right: 5px;
-	width: 90px;
-	display: none;
-	text-align: center;
-	padding: 2px;
-	font-size: 12px;
-	border: 1px solid #FF4;
-}
-
-div.std-footer {
-	margin: 13px 0px;
-	border-top: 1px solid #AAA;
-	padding: 13px;
-}
-
-div.std-footer-item {
-	margin: 0px 13px 13px 0px;
-}
-
-.shadow {
-	-moz-box-shadow: 0px 2px 2px #888;
-	-webkit-box-shadow: 0px 2px 2px #888;
- 	box-shadow: 0px 2px 2px #888;
-}
-
-.round {
-	-webkit-border-radius: 5px;
-	-moz-border-radius: 5px;
-	border-radius: 5px;	
-}
-.gradient {
-	background: #ededed; /* Old browsers */
-	background: -moz-linear-gradient(top, #ededed 0%, #d1d1d1 47%, #b7b7b7 100%); /* FF3.6+ */
-	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ededed), color-stop(47%,#d1d1d1), color-stop(100%,#b7b7b7)); /* Chrome,Safari4+ */
-	background: -webkit-linear-gradient(top, #ededed 0%,#d1d1d1 47%,#b7b7b7 100%); /* Chrome10+,Safari5.1+ */
-	background: -o-linear-gradient(top, #ededed 0%,#d1d1d1 47%,#b7b7b7 100%); /* Opera11.10+ */
-	background: -ms-linear-gradient(top, #ededed 0%,#d1d1d1 47%,#b7b7b7 100%); /* IE10+ */
-	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ededed', endColorstr='#b7b7b7',GradientType=0 ); /* IE6-9 */
-	background: linear-gradient(top, #ededed 0%,#d1d1d1 47%,#b7b7b7 100%); /* W3C */	
-}
-
-.layout_wrapper, .layout-wrapper {
-	-moz-box-shadow: 1px 1px 8px #555;
-	-webkit-box-shadow: 1px 1px 8px #555;
-	box-shadow: 1px 1px 8px #555;
-	background-color: #fff;
-	padding: 15px;
-}
-
-.layout-wrapper-background {
-	background-color: #f2f2f2 !important;
-	padding: 0px;
-}
-
-.layout-main-section {
-	width: 71%;
-	float: left;
-	padding: 15px;
-	background-color: #FFF;
-	min-height: 450px;
-	-moz-box-shadow:    7px 0px 6px -2px #ddd;
-	-webkit-box-shadow: 7px 0px 6px -2px #ddd;
-	box-shadow:         7px 0px 6px -2px #ddd;
-}
-
-.layout-side-section {
-	width: 22%;
-	/*float: right;*/
-	color: #606060;
-	overflow-x: hidden;
-	padding: 15px;
-	min-height: 450px;
-}
-
-/* from bootstrap */
-.container {
-  margin-left: auto;
-  margin-right: auto;
-  zoom: 1;
-}
-.container:before, .container:after {
-  display: table;
-  content: "";
-  zoom: 1;
-}
-.container:after {
-  clear: both;
-}
-
-.well {
-  min-height: 20px;
-  padding: 19px;
-  margin-bottom: 20px;
-  background-color: #f5f5f5;
-  border: 1px solid #eee;
-  border: 1px solid rgba(0, 0, 0, 0.05);
-  -webkit-border-radius: 4px;
-  -moz-border-radius: 4px;
-  border-radius: 4px;
-  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
-  -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
-  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
-}
-
-.avatar-small {
-	display: inline-block; 
-	min-width: 29px;
-}
-.avatar-small img {
-	height: 24px; 
-	margin-bottom: -7px;
-	max-width: 24px;
-}
-
-/*
- *	lib/css/legacy/messages.css
- */
-/* FLOATING MESSAGE */
-
-.btn-img { cursor: pointer; }
-
-div.fetching { color: #888; text-align:right; }
-
-div.notice {
-	postion: absolute;
-	background-color: #000;
-	-moz-border-radius: 5px; -webkit-border-radius: 5px;
-	opacity: 0.6;
-	right: 0;
-	top: 0;
-	margin-top: 8px;
-	z-index: -1;
-	padding: 8px;
-}
-
-/** help **/
-
-.info-box {
-    background-color: #F8F8F8;
-    border: 1px solid #CCCCCC;
-    border-radius: 3px 3px 3px 3px;
-    line-height: 1.6em;
-    overflow: auto;
-    padding: 6px 10px;
-	margin-bottom: 9px;
-}
-
-.help_box, .help-box {
-	background-color:#FFC;
-	font-size: 13px;
-	color: #864;
-	padding: 7px;
-	margin: 11px 0px;
-	border: 1px solid #EEB;
-}
-
-.help_box_big {
-	background-color:#FFC;
-	color: #864;
-	padding: 7px;
-	margin: 7px 0px;
-	border: 1px solid #EEB;
-	text-align: center;
-	font-size: 14px;
-}
-/*
- *	lib/css/legacy/forms.css
- *//* FORMS */
-
-
-div.frm_print_wrapper {
-	background-color:#FFF;
-	border:1px solid #444;
-	padding: 40px;
-
-	box-shadow:1px 1px 8px #229;
-	-moz-box-shadow: 1px 1px 8px #229;
-	-webkit-box-shadow: 1px 1px 8px #229;
-}
-
-div.page_break {
-	margin: 24px 0px;
-	border-top: 1px dashed #888;
-}
-
-div.grid_tbarlinks {
-	border-bottom: 0px;
-	background-color: #CCC;
-	padding: 4px 4px 2px 4px;
-	width: 190px;
-	float: right;
-
-	-moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px;
-	-webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px;
-}
-
-
-div.frm_tip_box {
-	margin: 0px;
-	padding: 8px;
-	background-color: #FFC;
-	display: none;
-	font-size: 11px;
-	border: 1px solid #FFB;
-}
-
-div.frm_tip_box table {
-	border-collapse: collapse;
-	vertical-align: top;
-}
-
-td.frm_tray_area {
-	width: 122px;
-}
-
-div.dialog_frm {
-	position: relative;
-	margin: 10px;
-}
-
-
-
-/*------------------*/
-
-.top_cell {
-	height: 50px;
-}
-
-div.attach_area {
-	padding: 8px;
-	margin: 8px;
-	background-color: #EEE;
-}
-
-div.attach_area table {
-	width: 100%;
-}
-
-.tablabel_normal {
-	margin: 0 4px 0 0;
-	padding: 3px 5px;
-	line-height: 1.3em;
-	display: inline;
-	cursor: pointer;
-}
-
-.tablabel_selected {
-	margin: 0 4px 0 0;
-	padding: 3px 5px;
-	line-height: 1.3em;
-	font-weight: bold;
-	display: inline;
-	cursor: pointer;
-	color: #000;
-}
-
-.scrollhead_wrapper {
-	position: absolute;
-	z-index: 1;
-	height: 30px;
-}
-
-.treeimg {
-	cursor: pointer;
-	margin-right: 3px;
-}
-
-
-.sectionCell {
-	padding: 5px;
-	vertical-align: top;
-}
-
-.code_area {
-	width: 80%;
-	margin: 8px;
-	padding: 4px;
-	background-color: #F8F8F8;
-	border: 1px solid #CCC;
-	overflow-x: auto;
-}
-
-.code_text {
-	width: 100%;
-	height: 360px;
-	margin-top: 3px;
-	font-family: Courier, Fixed;
-	font-size: 12px;
-}
-
-div.time_field select{
-	display: inline;
-	margin: 2px;
-	width: 45px;
-}
-
-/* Documents */
-
-.frm_field_table {
-        width: 100%;
-        border-collapse: collapse;
-}
-
-.datalabelcell { 
-        padding: 2px 0px; 
-        width: 160px; 
-        vertical-align: top; 
-}
-.datainputcell { padding: 2px 0px; }
-
-
-.field_description, .help {
-	margin: 3px 0px 11px 0px;
-	color: #888;
-	font-style: italic;
-}
-
-.field_description_top {
-	margin-bottom: 3px;
-}
-
-.field_label {
-	font-size:11px;
-}
-.input_area input, select, textarea { 
-	font-size: 14px;
-	padding: 2px;
-}
-
-.input_area input { 
-	width: 80%; 
-	margin: 0px; 
-}
-.input_area select { 
-	width: 80%; 
-}
-.input_area textarea { 
-	width: 90%; 
-}
-
-.disp_area { 
-	width: 80%; 
-	padding: 2px 0px; 
-	font-size: 12px; 
-}
-.disp_area_no_val { 
-	height: 14px; 
-}
-
-.no_img {
-	padding: 40px;
-	width: 100px;
-	height: 20px;
-	color: #888;
-	text-align: center;
-	border: 1px solid #AAA;
-}
-
-.input-mandatory {
-	font-size: 14px !important;
-	font-weight: bold;
-}
-
-.field-to-update {
-	background-color:#FEE;
-}
-
-/* sidebar */
-
-div.sidebar-comment-wrapper input {
-	width: 50%;
-}
-div.sidebar-comment-message {
-	margin-top: 8px;
-	font-size: 11px;
-	color: #777;
-}
-
-div.sidebar-comment-text {
-	font-size: 12px;
-	font-weight: bold;
-	margin-top: 8px;
-	color: #444;
-}
-div.sidebar-comment-info {
-	font-size: 10px;
-	color: #777;
-}
-/*
- *	lib/css/legacy/grid.css
- */
-
-/* Grid */
-
-
-/* --- Simple --- */
-.grid_wrapper_simple {
-	width: 100%;
-	margin-bottom: 8px;
-	border: 1px solid #AA9;
-}
-
-.grid_head_wrapper_simple {
-	padding: 0px;
-	border-bottom: 2px solid #AAA;
-}
-
-.grid_head_wrapper_simple td {
-	border-right: 1px solid #AA9;
-}
-
-.grid_head_wrapper_simple td div {
-	padding: 2px;
-}
-
-.grid_tab_wrapper_simple {
-}
-
-.grid_cell_simple {
-	padding: 2px;
-	background-color: #fff;
-	border-right: 1px solid #AA9;
-}
-
-
-/* --- Normal --- */
-.grid_wrapper {
-	position: relative;
-	overflow: auto;
-	border: 1px solid #AAA;
-	width: 100%;
-	margin-bottom: 8px;
-	background-color: #fff;	
-}
-
-.grid_tab_wrapper {
-	position: absolute;
-	top: 40px;
-	border-bottom: 1px solid #DDD;
-}
-
-.grid_table, .grid_head_table  {
-	table-layout: fixed;
-	border-collapse: collapse;
-	/*width: 100%;*/
-}
-
-.grid_cell {
-	border-right: 1px solid #ddd;
-	padding: 0px;
-	background-color: #fff;
-}
-
-.grid_head_wrapper {
-	position: absolute;
-	z-index: 1;
-	height: 40px;
-	padding: 0px;
-	overflow: hidden;
-	/*background-color: #fff;*/
-}
-
-.grid_head_table td {
-	background-color: #EEE;
-	border-right: 1px solid #AAA;
-	border-bottom: 1px solid #AAA;
-	height: 40px;
-	padding: 0px;
-}
-
-.grid_head_table td div {
-	color: #222;
-	font-weight: bold;
-	overflow: hidden;
-	padding: 2px 0px;
-	text-align: center;	
-}
-
-.grid_selector {
-	padding: 1px;
-	border-right: 1px solid #DDD;
-	width: 20px;
-	background-color: #fff;
-}
-
-.grid_cell_div {
-	padding: 2px;
-	cursor: pointer;
-	overflow: hidden;
-	border: 2px solid #FFF;
-}
-
-.grid_cell_div_selected {
-	border: 2px solid #88f;
-}
-
-.grid_cell_div input, .grid_cell_div select, .grid_cell_div div input {
-	margin: 0px;
-	border: 0px;
-	width: 100%;
- 	margin: 0px;
- }
-
-.grid_cell_div textarea {
-	border: 3px solid #abf;
-	height:200px;
-	width: 300px;
-	z-index: 10;
-	position:absolute;
-}
-
-.gridDivSelected option { border: 0px; }
-/*
- *	lib/css/legacy/listing.css
- *//* listing 2.0 */
-
-div.listing-more {
-	margin: 7px 0px 17px 0px;
-	text-align: center;
-	display: none;
-}
-
-div.listing-toolbar {
-	margin: 7px 0px;
-}
-
-/* SRS */
-
-table.srs_result_tab {
-	border: 2px solid #AAA;
-	border-collapse: collapse;
-}
-
-/* firefox bug fix for disappering borders */
-table.srs_result_tab td, table.srs_result_tab tr, table.srs_result_tab tbody, table.srs_result_tab div {
-	position: static;
-}
-
-table.srs_result_tab td {
-	padding: 3px 2px;
-	position: static;
-}
-
-div.srs_body_area {
-}
-
-div.srs_results_area {
-}
-
-div.srs_filter_wrapper {
-	border: 1px solid #CCF;
-	
-	background-color: #EEF;
-	margin:0px 0px 8px 0px;
-
-	-moz-border-radius: 5px;
-	-webkit-border-radius: 5px;
-	border-radius: 5px;
-}
-
-div.srs_filter_area {
-	padding: 8px;
-}
-
-div.srs_filter_area td {
-	vertical-align: middle;
-}
-
-
-
-
-/*
- *	lib/css/legacy/report.css
- */
-/* Reports */
-
-div.report_grid_area {
-	position: relative;
-	padding: 8px;
-}
-
-
-div.report_tab { 
-	border: 1px solid #AAA; 
-	position: relative; 
-	overflow: auto; 
-}
-
-div.report_no_data {
-	padding: 8px;
-	background-color: #EEE;
-	border: 1px solid #DDD;
-	position: absolute;
-	margin-left: 40%;
-	margin-top: 50px;
-	display: none;	
-}
-
-div.report_htitle {
-	float: left;
-	padding: 2px;
-	font-size: 14px;
-	font-weight: bold;
-	margin-left: 4px;
-	color: #665;
-	/*font-weight: bold;*/
-}
-
-div.report_tbar {
-	background-color: #EEF;
-	border: 1px solid #CCF;
-	border-bottom: 0px;
-	height: 28px;
-}
-
-div.report_tbar table{
-	width: 100%;
-}
-div.report_tbar table td {
-	
-}
-div.report_tbar table td div {
-	position: relative;
-}
-div.report_tbar button, div.report_tbar select, div.report_tbar img {
-	font-size: 11px;
-	margin: 0px;
-}
-
-div.report_head_wrapper {
-	position: absolute;
-	height: 24px;
-	top: 0px;
-	z-index: 1;
-}
-
-div.report_tab_wrapper {
-	position: absolute;
-	border-bottom: 1px solid #AAA;
-	border-top: 1px solid #AAA;
-}
-
-div.report_tab_wrapper table, div.report_head_wrapper table {
-	table-layout: fixed;
-	border-collapse: collapse;
-	/*width: 100%;*/
-}
-
-div.report_tab_wrapper table td, div.report_head_wrapper table td {
-	border-left: 1px solid #AAA;
-	border-right: 1px solid #AAA;
-	border-bottom: 1px solid #AAA;
-	overflow: hidden;
-	padding: 0px;
-}
-
-div.report_tab_wrapper table td div, div.report_head_wrapper table td div {
-	padding: 3px;
-	overflow: hidden;
-}
-
-.report_head_cell {
-	background-color: #EEE;
-	border-bottom: 1px solid #AA9;
-	text-align: center;
-	font-weight: bold;
-}
-.report_head_cell div {
-	color:#222; 
-	height: 18px;
-}
-
-
-/* FINDER */
-
-div.finder_wrapper {
-}
-
-div.finder_body_area {
-	margin: 16px;
-}
-
-div.finder_body {
-	display: none;
-}
-
-div.finder_advanced_area table {
-	width: 80%;
-}
-
-div.finder_advanced_area textarea {
-	width: 80%;
-}
-
-div.finder_filter_area {
-	position: relative;
-}
-
-div.filter_head {
-	font-size: 14px;
-	margin-bottom: 2px;
-}
-div.filter_dt_head {
-	font-size: 14px;
-	font-weight: bold;
-	margin-bottom: 2px;
-}
-table.filter_tab {
-	width: 96%;
-	border-collapse: collapse;
-}
-
-table.filter_tab td {
-	width: 50%;
-}
-
-div.finder_picker_area {
-	
-}
-div.builder_field {
-	margin: 0px;
-}
-div.builder_dt_head {
-	font-size: 14px;
-	font-weight: bold;
-	margin-bottom: 2px;
-}
-
-div.builder_field table {
-	width: 90%;
-	border-collapse: collapse;
-}
-
-div.builder_label {
-	height: 20px;
-}
-
-div.builder_head {
-	font-size: 16px;
-	font-weight: bold;
-	color: #AB6;
-}
-
-table.builder_tab {
-	width: 96%;
-	border-collapse: collapse;
-}
-
-table.builder_tab td {
-	width: 33%;
-	padding: 2px;
-}
-/*
- *	lib/css/legacy/autosuggest.css
- *//* 
-================================================
-autosuggest, inquisitor style
-================================================
-*/
-
-div.autosuggest
-{
-	position: absolute; 
-	margin-top: 3px; 
-	border: 1px solid #222;
-}
-
-div.autosuggest ul
-{
-	list-style: none;
-	margin: 0px;
-	padding: 2px;
-	overflow: hidden;
-	background-color: #FFF;
-}
-
-div.autosuggest ul li
-{
-	color: #444;
-	padding: 0;
-	margin: 0;
-	text-align: left;
-}
-
-div.autosuggest ul li a
-{
-	color: #444;
-	display: block;
-	text-decoration: none;
-	position: relative;
-	padding: 0;
-	width: 100%;
-}
-div.autosuggest ul li a:hover
-{
-
-}
-div.autosuggest ul li.as_highlight a:hover
-{
-	background-color: #45A;
-	color: #FFF;
-}
-
-div.autosuggest ul li a span
-{
-	display: block;
-	padding: 3px 6px;
-	color: #444;
-	border-bottom:1px solid #DDD;
-}
-
-div.autosuggest ul li a span small
-{
-	display: block;
-	font-weight: normal;
-	color: #444;
-}
-
-div.autosuggest ul li.as_highlight a span small
-{
-	color: #FFF;
-}
-
-div.autosuggest ul li.as_highlight a span {
-	color: #FFF;	
-}
-
-div.autosuggest ul li.as_highlight a
-{
-	color: #FFF;
-	background-color: #45A;
-	cursor: pointer;
-}
-
-div.autosuggest ul li.as_warning
-{
-	font-weight: bold;
-	text-align: center;
-}
-
-div.autosuggest ul em
-{
-	font-style: normal;
-	font-weight: bold;
-}
-
-/*
- *	lib/css/legacy/dialog.css
- *//***** Dialogs *******/
-
-div.dialog_wrapper {
-	position: absolute;
-	width: 440px;
-	display: none;
-	z-index: 90;
-	background-color: #FFF;
-	border: 3px solid #222;
-	box-shadow:1px 1px 5px #777;
-	-moz-box-shadow: 1px 1px 5px #777;
-	-webkit-box-shadow: 1px 1px 5px #777;
-	
-	border-radius: 5px;
-	-moz-border-radius: 5px;
-	-webkit-border-radius: 5px;	
-}
-
-div.dialog_head {
-	height: 22px;
-	padding: 4px;
-	background-color: #222;
-	color: #FFF;
-}
-
-div.dialog_body {
-	padding: 8px 8px 16px;
-	border-radius: 5px;
-	-moz-border-radius: 5px;
-	-webkit-border-radius: 5px;	
-}
-
-div.dialog_back {
-	position: fixed;
-	display: none;
-	top: 0px;
-	left: 0px;
-	bottom: 0px;
-	right: 0px;
-	background-color: #EEE;
-	opacity: 0.6;
-	z-index: 50;
-	text-align: center;
-}
-
-div.dialog_message {
-	display: none;
-	position: absolute;
-	width: 250px;
-	font-size: 12px;
-	z-index: 91;
-	background-color:#FFF;
-	padding: 12px;
-	border: 1px solid #444;
-}
-
-div.dialog_row {
-	padding: 8px 8px 0px 8px;
-}
-
-div.dialog_row table {
-	width: 100%;
-}
-
-div.dialog_row table td {
-}
-
-div.dialog_row input[type="text"], div.dialog_row input[type="password"], div.dialog_row textarea, div.dialog_row select {
-	width: 80%;
-	font-size: 14px;
-}
-
-div.dialog_row table td textarea {
-	width: 80%;
-	height: 200px;
-	font-size: 12px;
-}
-
-/*
- *	lib/css/legacy/tabs.css
- */
-/******* TABS ********/
-
-div.box_label_wrapper {
-	border-bottom: 6px solid #777;
-}
-
-div.box_label_body {
-	height: 22px;
-}
-
-ul.box_tabs {
-	margin: 0px;
-	padding: 0px;
-	list-style: none;
-}
-
-ul.box_tabs li {
-	height: 22px;
-	float:left;
-	font-size: 12px;
-	text-decoration: underline;
-	
-	background-color: #DDD;
-	
-	margin:0;
-	margin-left: 4px;
-	padding:0 0 0 9px;
-	cursor: pointer;
-}
-
-ul.box_tabs li a {
-	display:block;
-	padding:3px 15px 3px 6px;
-	text-decoration: none;
-}
-
-ul.box_tabs li.box_tab_mouseover {
-	background-color: #BBB;
-}
-
-ul.box_tabs li.box_tab_selected {	
-	background-color: #777;
-	
-	background: -webkit-gradient(linear, left top, left bottom, from(#999), to(#777));
-	background: -moz-linear-gradient(top, #999, #777);
-		
-	color: #FFF;
-	font-weight:bold;
-	
-}
-ul.box_tabs li.box_tab_selected a {
-	color: #fff;
-}
-/*
- *	lib/css/legacy/sidebar.css
- */div.psidebar {
-}
-
-div.psidebar div.head {
-	font-size: 14px;
-	font-weight: bold;
-	color: #555;
-	margin-bottom: 12px;
-}
-
-div.psidebar div.section {
-	margin-bottom: 11px;
-	overflow: hidden;
-}
-
-div.psidebar div.section-head {
-	font-size: 12px;
-	padding: 5px 11px;
-	border-bottom: 2px solid #444;
-}
-
-div.psidebar div.section-body {
-	margin: 7px 11px 11px 11px;
-}
-
-div.psidebar div.section-item {
-	margin-bottom: 7px;
-}
-
-div.psidebar div.section-item, div.psidebar .section-link {
-	font-size: 11px;
-	color: #666;
-}
-/*
  *	lib/css/bootstrap/headings.css
- *//* heading from bootstrap */
+ */
+/* heading from bootstrap */
 
 h1,
 h2,
@@ -1157,7 +14,6 @@
   font-weight: bold;
   color: #333333;
   text-rendering: optimizelegibility;
-  margin-bottom: 0.3em;
 }
 h1 small,
 h2 small,
@@ -1169,46 +25,49 @@
   color: #999999;
 }
 h1 {
-  font-size: 30px;
-  line-height: 36px;
+  font-size: 280%;
+  line-height: 120%;
 }
 h1 small {
-  font-size: 18px;
+  font-size: 150%;
 }
 h2 {
-  font-size: 24px;
-  line-height: 36px;
+  font-size: 200%;
+  line-height: 120%;
 }
 h2 small {
-  font-size: 18px;
+  font-size: 150%;
 }
 h3 {
-  line-height: 27px;
-  font-size: 18px;
+  font-size: 210%;
+  font-size: 150%;
 }
 h3 small {
-  font-size: 14px;
+  font-size: 130%;
 }
 h4, h5, h6 {
-  line-height: 18px;
+  font-size: 150%;
 }
 h4 {
-  font-size: 14px;
+  font-size: 113%;
 }
 h4 small {
-  font-size: 12px;
+  font-size: 100%;
 }
 h5 {
-  font-size: 12px;
+  font-size: 100%;
 }
 h6 {
   font-size: 11px;
   color: #999999;
   text-transform: uppercase;
 }
+
 /*
  *	lib/css/bootstrap/buttons.css
- */.close {
+ */
+.close {
+  font-family: Helvetica, Sans;
   float: right;
   font-size: 20px;
   font-weight: bold;
@@ -1591,9 +450,11 @@
 .btn-small .caret {
   margin-top: 4px;
 }
+
 /*
  *	lib/css/bootstrap/navbar.css
- */.nav {
+ */
+.nav {
   margin-left: 0;
   margin-bottom: 18px;
   list-style: none;
@@ -2059,9 +920,11 @@
 	padding: 0px 20px;
 }
 
+
 /*
  *	lib/css/bootstrap/dropdown.css
- */.dropdown {
+ */
+.dropdown {
   position: relative;
 }
 .dropdown-toggle {
@@ -2161,9 +1024,11 @@
 .dropdown.open .dropdown-menu {
   display: block;
 }
+
 /*
  *	lib/css/bootstrap/tooltip.css
- */.tooltip {
+ */
+.tooltip {
   position: absolute;
   z-index: 1020;
   display: block;
@@ -2329,9 +1194,11 @@
 .popover-content p, .popover-content ul, .popover-content ol {
   margin-bottom: 0;
 }
+
 /*
  *	lib/css/bootstrap/label.css
- */.label {
+ */
+.label {
   padding: 2px 4px 3px;
   font-size: 11.049999999999999px;
   font-weight: bold;
@@ -2370,9 +1237,11 @@
 .label-info:hover {
   background-color: #2d6987;
 }
+
 /*
  *	lib/css/bootstrap/icons.css
- */[class^="icon-"], [class*=" icon-"] {
+ */
+[class^="icon-"], [class*=" icon-"] {
   display: inline-block;
   width: 14px;
   height: 14px;
@@ -2749,24 +1618,1974 @@
 .icon-resize-horizontal {
   background-position: -456px -118px;
 }
+
 /*
- *	erpnext/startup/startup.css
- */h1, h2, h3, h4, h5 {
-	font-family: Tahoma, Arial, Verdana, sans-serif;
-	font-weight: bold;
+ *	lib/css/bootstrap/popover.css
+ */
+.popover {
+  position: absolute;
+  top: 0;
+  left: 0;
+  z-index: 1010;
+  display: none;
+  padding: 5px;
+}
+.popover.top {
+  margin-top: -5px;
+}
+.popover.right {
+  margin-left: 5px;
+}
+.popover.bottom {
+  margin-top: 5px;
+}
+.popover.left {
+  margin-left: -5px;
+}
+.popover.top .arrow {
+  bottom: 0;
+  left: 50%;
+  margin-left: -5px;
+  border-left: 5px solid transparent;
+  border-right: 5px solid transparent;
+  border-top: 5px solid #000000;
+}
+.popover.right .arrow {
+  top: 50%;
+  left: 0;
+  margin-top: -5px;
+  border-top: 5px solid transparent;
+  border-bottom: 5px solid transparent;
+  border-right: 5px solid #000000;
+}
+.popover.bottom .arrow {
+  top: 0;
+  left: 50%;
+  margin-left: -5px;
+  border-left: 5px solid transparent;
+  border-right: 5px solid transparent;
+  border-bottom: 5px solid #000000;
+}
+.popover.left .arrow {
+  top: 50%;
+  right: 0;
+  margin-top: -5px;
+  border-top: 5px solid transparent;
+  border-bottom: 5px solid transparent;
+  border-left: 5px solid #000000;
+}
+.popover .arrow {
+  position: absolute;
+  width: 0;
+  height: 0;
+}
+.popover-inner {
+  padding: 3px;
+  width: 280px;
+  overflow: hidden;
+  background: #000000;
+  background: rgba(0, 0, 0, 0.8);
+  -webkit-border-radius: 6px;
+  -moz-border-radius: 6px;
+  border-radius: 6px;
+  -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
+  -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
+  box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
+}
+.popover-title {
+  padding: 9px 15px;
+  line-height: 1;
+  background-color: #f5f5f5;
+  border-bottom: 1px solid #eee;
+  -webkit-border-radius: 3px 3px 0 0;
+  -moz-border-radius: 3px 3px 0 0;
+  border-radius: 3px 3px 0 0;
+}
+.popover-content {
+  padding: 14px;
+  background-color: #ffffff;
+  -webkit-border-radius: 0 0 3px 3px;
+  -moz-border-radius: 0 0 3px 3px;
+  border-radius: 0 0 3px 3px;
+  -webkit-background-clip: padding-box;
+  -moz-background-clip: padding-box;
+  background-clip: padding-box;
+}
+.popover-content p, .popover-content ul, .popover-content ol {
+  margin-bottom: 0;
+}
+
+/*
+ *	lib/css/legacy/body.css
+ */
+html { 
+	margin: 0px;
+	padding: 0px;
+}
+
+body {	
+	margin: 0px;
+	padding: 0px;
+	font-size: 14px;
+	color: #000;
+	background-color: #e2e2e2;
+}
+
+/* font settings */
+
+h1, h2, h3, h4, h5 {
+	font-family: "Helvetica Neue", Helvetica, "Helvetica Neue", sans-serif;
+	margin-top: 0.2em;
 }
 
 body {
-	font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
+	font-family: "Helvetica Neue", Helvetica, "Helvetica Neue", sans-serif;
+	font-size: 13px;
+}
+
+span, div, td, input, textarea, button, select {
+	font-family: inherit;
+}
+
+
+pre { margin: 0px; padding: 0px; }
+
+button { margin: 2px; margin-left: 0px; }
+
+label {
+	padding-top: 15px;
+	color: #404040;
+}
+
+select, input, textarea { 
+	border: 1px solid #ccc; 
+	-moz-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	font-size: inherit;
+	padding: 4px;
+	color: #444;
+	-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+	-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+	box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+}
+
+textarea { 
+	font-family: inherit; 
+	height: 120px; 
+	width: 90%; 
+	font-size: inherit; 
+	white-space: normal;
+}
+
+table { padding: 0px; border-collapse: 'collapse'}
+
+td { 
+	padding:0px; 
+	margin: 0px; 
+	vertical-align: top; 
+}
+
+p {
+	margin: 0px 0px 9px 0px;
+	line-height: 1.5em;
+}
+
+li {
+	line-height: 1.5em;
+}
+
+hr {
+  margin: 18px 0;
+  border: 0;
+  border-top: 1px solid #e5e5e5;
+  border-bottom: 1px solid #ffffff;
+}
+
+/* links */
+
+a:active { outline:none; }
+
+a {
+  color: #0088cc;
+  text-decoration: none;
+}
+a:hover {
+  color: #005580;
+  text-decoration: underline;
+}
+
+.link_type {
+	padding:2px;
+	color: #0088cc;
+	cursor: pointer;
+}
+
+.link_type:hover {
+	color: #005580;
+	text-decoration: underline;
+}
+
+:focus { -moz-outline-style:none; }
+
+table.simpletable { border-collapse: collapse; margin-bottom: 10px;}
+table.simpletable td {border: 1pt solid #000; vertical-align: top; padding: 2px; }
+
+div.fix_ff_cursor { overflow: auto; }
+
+/* --- Layout --- */
+
+div.comment { color: #444; }
+
+.small {
+	font-size: 11px;
+}
+
+.help {
+	margin-bottom: 3px;
+	color: #888;
+}
+
+div#body_div {
+	display: none;
+	padding-right: 7px;
+	width: 900px;
+	margin: auto;
+	margin-top: 56px;
+}
+
+.content {
+	width: 900px;
+}
+
+.background-fade-in {
+	-webkit-transition: background 1s ease-in; /* property duration timing-function delay */
+    -moz-transition: background 1s ease-in;
+    -o-transition: background 1s ease-in;
+    transition: background 1s ease-in;
+}
+
+footer {
+	width: 900px;
+	margin: auto;
+}
+header .container {
+	width: 900px;
+	margin: auto;
+}
+
+@media (max-width: 1200px) {
+	div#body_div, header .container, .content, #opened-page-selector, footer {
+		width: 900px;
+	}
+}
+
+@media (min-width: 1200px) {
+	div#body_div, header .container, .content, #opened-page-selector, footer {
+		width: 1100px;
+	}
+}
+
+div.no_script {
+	display: none;
+}
+
+div.loading_div {
+	background-color: #FFFFCC;
+	z-index: 1999;
+	right: 5px;
+	width: 90px;
+	display: none;
+	text-align: center;
+	padding: 2px;
+	border: 1px solid #FF4;
+}
+
+div.std-footer {
+	margin: 13px -15px;
+	border-top: 1px solid #AAA;
+	padding: 13px;
+}
+
+div.std-footer-item {
+	margin: 0px 13px 13px 0px;
+}
+
+.shadow {
+	-moz-box-shadow: 0px 2px 2px #888;
+	-webkit-box-shadow: 0px 2px 2px #888;
+ 	box-shadow: 0px 2px 2px #888;
+}
+
+.round {
+	-webkit-border-radius: 5px;
+	-moz-border-radius: 5px;
+	border-radius: 5px;	
+}
+
+.layout_wrapper, .layout-wrapper {
+	-moz-box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
+	-webkit-box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
+	box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
+	background-color: #fff;
+	padding: 15px;
+	-webkit-border-radius: 5px;
+	-moz-border-radius: 5px;
+	border-radius: 5px;	
+	margin-bottom: 30px;
+	overflow: hidden;
+}
+
+.layout-wrapper-appframe {
+	padding: 0px;
+}
+
+.layout-wrapper-background {
+	background-color: #fafafa !important;
+	padding: 0px;
+}
+
+.layout-main {
+	padding: 15px;	
+}
+
+.layout-main-section {
+	width: 71%;
+	float: left;
+	padding: 15px;
+	background-color: #FFF;
+	min-height: 600px;
+	-moz-box-shadow:    2px 0px 1px #ddd;
+	-webkit-box-shadow: 2px 0px 1px #ddd;
+	box-shadow:         2px 0px 1px #ddd;
+}
+
+.layout-side-section {
+	width: 22%;
+	/*float: right;*/
+	color: #606060; 
+	overflow-x: hidden;
+	padding: 15px;
+	min-height: 600px;
+}
+
+/* from bootstrap */
+.container {
+  margin-left: auto;
+  margin-right: auto;
+  zoom: 1;
+}
+.container:before, .container:after {
+  display: table;
+  content: "";
+  zoom: 1;
+}
+.container:after {
+  clear: both;
+}
+
+.well {
+  min-height: 20px;
+  padding: 19px;
+  margin-bottom: 20px;
+  background-color: #f5f5f5;
+  border: 1px solid #eee;
+  border: 1px solid rgba(0, 0, 0, 0.05);
+  -webkit-border-radius: 4px;
+  -moz-border-radius: 4px;
+  border-radius: 4px;
+  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
+  -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
+  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
+}
+
+.avatar-small {
+	display: inline-block; 
+	width: 24px;
+	height: 20px;
+	vertical-align: middle;
+	overflow: hidden;
+	margin: 0px 3px;
+}
+.avatar-small img {
+	width: 24px; 
+}
+
+/*
+ *	lib/css/legacy/messages.css
+ */
+
+/* FLOATING MESSAGE */
+
+.btn-img { cursor: pointer; }
+
+div.fetching { color: #888; text-align:right; }
+
+div.notice {
+	postion: absolute;
+	background-color: #000;
+	-moz-border-radius: 5px; -webkit-border-radius: 5px;
+	opacity: 0.6;
+	right: 0;
+	top: 0;
+	margin-top: 8px;
+	z-index: -1;
+	padding: 8px;
+}
+
+/** help **/
+
+.info-box {
+    background-color: #F8F8F8;
+    border: 1px solid #CCCCCC;
+    border-radius: 3px 3px 3px 3px;
+    line-height: 1.6em;
+    overflow: auto;
+    padding: 6px 10px;
+	margin-bottom: 9px;
+}
+
+.help_box, .help-box {
+	background-color:#FFC;
+	font-size: 13px;
+	color: #864;
+	padding: 7px;
+	margin: 11px 0px;
+	border: 1px solid #EEB;
+}
+
+.help_box_big {
+	background-color:#FFC;
+	color: #864;
+	padding: 7px;
+	margin: 7px 0px;
+	border: 1px solid #EEB;
+	text-align: center;
+	font-size: 14px;
+}
+
+/*
+ *	lib/css/legacy/forms.css
+ */
+/* FORMS */
+
+div.form-title {
+	/*background-color: #e0eeff;*/
+	padding: 5px 19px 15px 19px;
+	margin: -15px -15px 0px -15px;
+	border-bottom: 1px solid #eee;
+}
+
+div.form-section-head {
+	margin: 11px -15px 3px -15px;
+	border-top: 1px solid #ccc;
+	padding: 11px 23px 0px 23px;
+}
+
+div.form-layout-row:first-child .form-section-head {
+	border-top: 0px solid #ccc !important;
+	margin-top: 0px;
+	padding-top: 15px;
+}
+
+div.form-section-head h3 {
+	line-height: 20px;
+}
+
+div.form-section-head hr {
+	margin: 9px 0px;
+}
+
+
+div.frm_print_wrapper {
+	background-color:#FFF;
+	border:1px solid #444;
+	padding: 40px;
+
+	box-shadow:1px 1px 8px #229;
+	-moz-box-shadow: 1px 1px 8px #229;
+	-webkit-box-shadow: 1px 1px 8px #229;
+}
+
+div.page_break {
+	margin: 24px 0px;
+	border-top: 1px dashed #888;
+}
+
+div.grid_tbarlinks {
+	border-bottom: 0px;
+	background-color: #CCC;
+	padding: 4px 4px 2px 4px;
+	width: 190px;
+	float: right;
+
+	-moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px;
+	-webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px;
+}
+
+
+div.dialog_frm {
+	position: relative;
+	margin: 10px;
+}
+
+
+
+/*------------------*/
+
+.top_cell {
+	height: 50px;
+}
+
+div.attach_area {
+	padding: 8px;
+	margin: 8px;
+	background-color: #EEE;
+}
+
+div.attach_area table {
+	width: 100%;
+}
+
+.tablabel_normal {
+	margin: 0 4px 0 0;
+	padding: 3px 5px;
+	line-height: 1.3em;
+	display: inline;
+	cursor: pointer;
+}
+
+.tablabel_selected {
+	margin: 0 4px 0 0;
+	padding: 3px 5px;
+	line-height: 1.3em;
+	font-weight: bold;
+	display: inline;
+	cursor: pointer;
+	color: #000;
+}
+
+.scrollhead_wrapper {
+	position: absolute;
+	z-index: 1;
+	height: 30px;
+}
+
+.treeimg {
+	cursor: pointer;
+	margin-right: 3px;
+}
+
+
+.sectionCell {
+	padding: 5px;
+	vertical-align: top;
+}
+
+.code_area {
+	width: 80%;
+	margin: 8px;
+	padding: 4px;
+	background-color: #F8F8F8;
+	border: 1px solid #CCC;
+	overflow-x: auto;
+}
+
+.code_text {
+	width: 100%;
+	height: 360px;
+	margin-top: 3px;
+	font-family: Courier, Fixed;
 	font-size: 12px;
 }
 
+div.time_field select{
+	display: inline;
+	margin: 2px;
+	width: 45px;
+}
+
+/* sidebar */
+
+div.sidebar-comment-wrapper input {
+	width: 50%;
+}
+div.sidebar-comment-message {
+	margin-top: 8px;
+	color: #777;
+}
+
+div.sidebar-comment-text {
+	font-size: 12px;
+	font-weight: bold;
+	margin-top: 8px;
+	color: #444;
+}
+div.sidebar-comment-info {
+	color: #777;
+}
+
+/*
+ *	lib/css/legacy/fields.css
+ */
+/* Documents */
+
+.frm_field_table {
+        width: 100%;
+        border-collapse: collapse;
+}
+
+.datalabelcell { 
+        padding: 2px 0px; 
+        width: 160px; 
+        vertical-align: top; 
+}
+.datainputcell { padding: 2px 0px; }
+
+
+.help ol {
+	padding-left: 19px;
+}
+
+.field_description_top {
+	margin-bottom: 3px;
+}
+
+.input_area input, select, textarea { 
+	font-size: 14px;
+	padding: 2px;
+}
+
+.input_area input { 
+	width: 80%; 
+	margin: 0px; 
+}
+.input_area select { 
+	width: 80%; 
+}
+.input_area textarea { 
+	width: 90%; 
+}
+
+.disp_area { 
+	width: 80%; 
+	padding: 2px 0px; 
+	font-size: 12px; 
+}
+.disp_area_no_val { 
+	height: 14px; 
+}
+
+.no_img {
+	padding: 40px;
+	width: 100px;
+	height: 20px;
+	color: #888;
+	text-align: center;
+	border: 1px solid #AAA;
+}
+
+.input-mandatory {
+	font-size: 14px !important;
+	font-weight: bold;
+}
+
+.field-to-update {
+	background-color:#FEE;
+}
+
+/*
+ *	lib/css/legacy/grid.css
+ */
+
+
+/* Grid */
+
+
+/* --- Simple --- */
+.grid_wrapper_simple {
+	width: 100%;
+	margin-bottom: 8px;
+	border: 1px solid #AA9;
+}
+
+.grid_head_wrapper_simple {
+	padding: 0px;
+	border-bottom: 2px solid #AAA;
+}
+
+.grid_head_wrapper_simple td {
+	border-right: 1px solid #AA9;
+}
+
+.grid_head_wrapper_simple td div {
+	padding: 2px;
+}
+
+.grid_tab_wrapper_simple {
+}
+
+.grid_cell_simple {
+	padding: 2px;
+	background-color: #fff;
+	border-right: 1px solid #AA9;
+}
+
+
+/* --- Normal --- */
+.grid_wrapper {
+	position: relative;
+	overflow: auto;
+	border: 1px solid #AAA;
+	width: 100%;
+	margin-bottom: 8px;
+	background-color: #fff;	
+}
+
+.grid_tab_wrapper {
+	position: absolute;
+	top: 40px;
+	border-bottom: 1px solid #DDD;
+}
+
+.grid_table, .grid_head_table  {
+	table-layout: fixed;
+	border-collapse: collapse;
+	/*width: 100%;*/
+}
+
+.grid_cell {
+	border-right: 1px solid #ddd;
+	padding: 0px;
+	background-color: #fff;
+}
+
+.grid_head_wrapper {
+	position: absolute;
+	z-index: 1;
+	height: 40px;
+	padding: 0px;
+	overflow: hidden;
+	/*background-color: #fff;*/
+}
+
+.grid_head_table td {
+	background-color: #EEE;
+	border-right: 1px solid #AAA;
+	border-bottom: 1px solid #AAA;
+	height: 40px;
+	padding: 0px;
+}
+
+.grid_head_table td div {
+	color: #222;
+	font-weight: bold;
+	overflow: hidden;
+	padding: 2px 0px;
+	text-align: center;	
+}
+
+.grid_selector {
+	padding: 1px;
+	border-right: 1px solid #DDD;
+	width: 20px;
+	background-color: #fff;
+}
+
+.grid_cell_div {
+	padding: 2px;
+	cursor: pointer;
+	overflow: hidden;
+	border: 2px solid #FFF;
+}
+
+.grid_cell_div_selected {
+	border: 2px solid #88f;
+}
+
+.grid_cell_div input, .grid_cell_div select, .grid_cell_div div input {
+	margin: 0px;
+	border: 0px;
+	width: 100%;
+ 	margin: 0px;
+ }
+
+.grid_cell_div textarea {
+	border: 3px solid #abf;
+	height:200px;
+	width: 300px;
+	z-index: 10;
+	position:absolute;
+}
+
+.gridDivSelected option { border: 0px; }
+
+/*
+ *	lib/css/legacy/listing.css
+ */
+
+
+/* SRS */
+
+table.srs_result_tab {
+	border: 2px solid #AAA;
+	border-collapse: collapse;
+}
+
+/* firefox bug fix for disappering borders */
+table.srs_result_tab td, table.srs_result_tab tr, table.srs_result_tab tbody, table.srs_result_tab div {
+	position: static;
+}
+
+table.srs_result_tab td {
+	padding: 3px 2px;
+	position: static;
+}
+
+div.srs_body_area {
+}
+
+div.srs_results_area {
+}
+
+div.srs_filter_wrapper {
+	border: 1px solid #CCF;
+	
+	background-color: #EEF;
+	margin:0px 0px 8px 0px;
+
+	-moz-border-radius: 5px;
+	-webkit-border-radius: 5px;
+	border-radius: 5px;
+}
+
+div.srs_filter_area {
+	padding: 8px;
+}
+
+div.srs_filter_area td {
+	vertical-align: middle;
+}
+
+/*
+ *	lib/css/legacy/report.css
+ */
+
+/* Reports */
+
+div.report_grid_area {
+	position: relative;
+	padding: 8px;
+}
+
+
+div.report_tab { 
+	border: 1px solid #AAA; 
+	position: relative; 
+	overflow: auto; 
+}
+
+div.report_no_data {
+	padding: 8px;
+	background-color: #EEE;
+	border: 1px solid #DDD;
+	position: absolute;
+	margin-left: 40%;
+	margin-top: 50px;
+	display: none;	
+}
+
+div.report_htitle {
+	float: left;
+	padding: 2px;
+	font-size: 14px;
+	font-weight: bold;
+	margin-left: 4px;
+	color: #665;
+	/*font-weight: bold;*/
+}
+
+div.report_tbar {
+	background-color: #EEF;
+	border: 1px solid #CCF;
+	border-bottom: 0px;
+	height: 28px;
+}
+
+div.report_tbar table{
+	width: 100%;
+}
+div.report_tbar table td {
+	
+}
+div.report_tbar table td div {
+	position: relative;
+}
+div.report_tbar button, div.report_tbar select, div.report_tbar img {
+	font-size: 11px;
+	margin: 0px;
+}
+
+div.report_head_wrapper {
+	position: absolute;
+	height: 24px;
+	top: 0px;
+	z-index: 1;
+}
+
+div.report_tab_wrapper {
+	position: absolute;
+	border-bottom: 1px solid #AAA;
+	border-top: 1px solid #AAA;
+}
+
+div.report_tab_wrapper table, div.report_head_wrapper table {
+	table-layout: fixed;
+	border-collapse: collapse;
+	/*width: 100%;*/
+}
+
+div.report_tab_wrapper table td, div.report_head_wrapper table td {
+	border-left: 1px solid #AAA;
+	border-right: 1px solid #AAA;
+	border-bottom: 1px solid #AAA;
+	overflow: hidden;
+	padding: 0px;
+}
+
+div.report_tab_wrapper table td div, div.report_head_wrapper table td div {
+	padding: 3px;
+	overflow: hidden;
+}
+
+.report_head_cell {
+	background-color: #EEE;
+	border-bottom: 1px solid #AA9;
+	text-align: center;
+	font-weight: bold;
+}
+.report_head_cell div {
+	color:#222; 
+	height: 18px;
+}
+
+
+/* FINDER */
+
+div.finder_wrapper {
+}
+
+div.finder_body_area {
+	margin: 16px;
+}
+
+div.finder_body {
+	display: none;
+}
+
+div.finder_advanced_area table {
+	width: 80%;
+}
+
+div.finder_advanced_area textarea {
+	width: 80%;
+}
+
+div.finder_filter_area {
+	position: relative;
+}
+
+div.filter_head {
+	font-size: 14px;
+	margin-bottom: 2px;
+}
+div.filter_dt_head {
+	font-size: 14px;
+	font-weight: bold;
+	margin-bottom: 2px;
+}
+table.filter_tab {
+	width: 96%;
+	border-collapse: collapse;
+}
+
+table.filter_tab td {
+	width: 50%;
+}
+
+div.finder_picker_area {
+	
+}
+div.builder_field {
+	margin: 0px;
+}
+div.builder_dt_head {
+	font-size: 14px;
+	font-weight: bold;
+	margin-bottom: 2px;
+}
+
+div.builder_field table {
+	width: 90%;
+	border-collapse: collapse;
+}
+
+div.builder_label {
+	height: 20px;
+}
+
+div.builder_head {
+	font-size: 16px;
+	font-weight: bold;
+	color: #AB6;
+}
+
+table.builder_tab {
+	width: 96%;
+	border-collapse: collapse;
+}
+
+table.builder_tab td {
+	width: 33%;
+	padding: 2px;
+}
+
+/*
+ *	lib/css/legacy/dialog.css
+ */
+/***** Dialogs *******/
+
+div.dialog_wrapper {
+	position: absolute;
+	width: 440px;
+	display: none;
+	z-index: 90;
+	background-color: #FFF;
+	box-shadow:1px 1px 8px #444;
+	-moz-box-shadow: 1px 1px 8px #444;
+	-webkit-box-shadow: 1px 1px 8px #444;
+	
+	border-radius: 5px;
+	-moz-border-radius: 5px;
+	-webkit-border-radius: 5px;
+	
+	overflow: hidden;
+}
+
+div.dialog_head {
+	height: 22px;
+	padding: 4px;
+	background-color: #222;
+	color: #FFF;
+}
+
+div.dialog_body {
+	padding: 8px 8px 16px;
+	border-radius: 5px;
+	-moz-border-radius: 5px;
+	-webkit-border-radius: 5px;	
+}
+
+div.dialog_back {
+	position: fixed;
+	display: none;
+	top: 0px;
+	left: 0px;
+	bottom: 0px;
+	right: 0px;
+	background-color: #aaa;
+	opacity: 0.6;
+	z-index: 50;
+	text-align: center;
+}
+
+div.dialog_message {
+	display: none;
+	position: absolute;
+	width: 250px;
+	font-size: 12px;
+	z-index: 91;
+	background-color:#FFF;
+	padding: 12px;
+	border: 1px solid #444;
+}
+
+div.dialog_row {
+	padding: 8px 8px 0px 8px;
+}
+
+div.dialog_row table {
+	width: 100%;
+}
+
+div.dialog_row table td {
+}
+
+div.dialog_row input[type="text"], div.dialog_row input[type="password"], div.dialog_row textarea, div.dialog_row select {
+	width: 80%;
+	font-size: 14px;
+}
+
+div.dialog_row table td textarea {
+	width: 80%;
+	height: 200px;
+	font-size: 12px;
+}
+
+
+/*
+ *	lib/css/legacy/tabs.css
+ */
+
+/******* TABS ********/
+
+div.box_label_wrapper {
+	border-bottom: 6px solid #777;
+}
+
+div.box_label_body {
+	height: 22px;
+}
+
+ul.box_tabs {
+	margin: 0px;
+	padding: 0px;
+	list-style: none;
+}
+
+ul.box_tabs li {
+	height: 22px;
+	float:left;
+	font-size: 12px;
+	text-decoration: underline;
+	
+	background-color: #DDD;
+	
+	margin:0;
+	margin-left: 4px;
+	padding:0 0 0 9px;
+	cursor: pointer;
+}
+
+ul.box_tabs li a {
+	display:block;
+	padding:3px 15px 3px 6px;
+	text-decoration: none;
+}
+
+ul.box_tabs li.box_tab_mouseover {
+	background-color: #BBB;
+}
+
+ul.box_tabs li.box_tab_selected {	
+	background-color: #777;
+	
+	background: -webkit-gradient(linear, left top, left bottom, from(#999), to(#777));
+	background: -moz-linear-gradient(top, #999, #777);
+		
+	color: #FFF;
+	font-weight:bold;
+	
+}
+ul.box_tabs li.box_tab_selected a {
+	color: #fff;
+}
+
+/*
+ *	lib/css/legacy/sidebar.css
+ */
+div.psidebar {
+}
+
+div.psidebar div.head {
+	font-size: 14px;
+	font-weight: bold;
+	color: #555;
+	margin-bottom: 12px;
+}
+
+div.psidebar div.section {
+	margin-bottom: 11px;
+	overflow: hidden;
+}
+
+div.psidebar div.section-head {
+	padding: 5px 11px;
+	border-bottom: 1px solid #aaa;
+}
+
+div.psidebar div.section-body {
+	margin: 7px 11px 11px 11px;
+}
+
+div.psidebar div.section-item {
+	margin-bottom: 7px;
+}
+
+div.psidebar div.section-item, div.psidebar .section-link {
+	color: #666;
+}
+
+/*
+ *	lib/css/Aristo/aristo.selected.css
+ */
+/*
+ * jQuery UI CSS Framework 1.8.7
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ */
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+
+
+/*
+ * jQuery UI CSS Framework 1.8.7
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ *
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ctl=themeroller
+ */
+
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-family: Arial,sans-serif; font-size: 1.1em; }
+.ui-widget .ui-widget { font-size: 1em; }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Arial,sans-serif; font-size: 1em; }
+.ui-widget-content { border: 1px solid #B6B6B6; background: #ffffff; color: #4F4F4F; }
+.ui-widget-content a { color: #4F4F4F; }
+.ui-widget-header { border: 1px solid #B6B6B6; color: #4F4F4F; font-weight: bold; }
+.ui-widget-header {
+	background: #ededed url(../lib/css/Aristo/images/bg_fallback.png) 0 0 repeat-x; /* Old browsers */
+		background: -moz-linear-gradient(top, #ededed 0%, #c4c4c4 100%); /* FF3.6+ */
+		background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ededed), color-stop(100%,#c4c4c4)); /* Chrome,Safari4+ */
+		background: -webkit-linear-gradient(top, #ededed 0%,#c4c4c4 100%); /* Chrome10+,Safari5.1+ */
+		background: -o-linear-gradient(top, #ededed 0%,#c4c4c4 100%); /* Opera11.10+ */
+		background: -ms-linear-gradient(top, #ededed 0%,#c4c4c4 100%); /* IE10+ */
+		background: linear-gradient(top, #ededed 0%,#c4c4c4 100%); /* W3C */
+}
+.ui-widget-header a { color: #4F4F4F; }
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #B6B6B6; font-weight: normal; color: #4F4F4F; }
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { 
+	background: #ededed url(../lib/css/Aristo/images/bg_fallback.png) 0 0 repeat-x; /* Old browsers */
+		background: -moz-linear-gradient(top, #ededed 0%, #c4c4c4 100%); /* FF3.6+ */
+		background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ededed), color-stop(100%,#c4c4c4)); /* Chrome,Safari4+ */
+		background: -webkit-linear-gradient(top, #ededed 0%,#c4c4c4 100%); /* Chrome10+,Safari5.1+ */
+		background: -o-linear-gradient(top, #ededed 0%,#c4c4c4 100%); /* Opera11.10+ */
+		background: -ms-linear-gradient(top, #ededed 0%,#c4c4c4 100%); /* IE10+ */
+		background: linear-gradient(top, #ededed 0%,#c4c4c4 100%); /* W3C */
+	-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset;
+	-moz-box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset;
+	box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset;
+}
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #4F4F4F; text-decoration: none; }
+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #9D9D9D; font-weight: normal; color: #313131; }
+.ui-state-hover a, .ui-state-hover a:hover { color: #313131; text-decoration: none; }
+.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { 
+	outline: none;
+	color: #1c4257; border: 1px solid #7096ab;
+	background: #ededed url(../lib/css/Aristo/images/bg_fallback.png) 0 -50px repeat-x; /* Old browsers */
+		background: -moz-linear-gradient(top, #b9e0f5 0%, #92bdd6 100%); /* FF3.6+ */
+		background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b9e0f5), color-stop(100%,#92bdd6)); /* Chrome,Safari4+ */
+		background: -webkit-linear-gradient(top, #b9e0f5 0%,#92bdd6 100%); /* Chrome10+,Safari5.1+ */
+		background: -o-linear-gradient(top, #b9e0f5 0%,#92bdd6 100%); /* Opera11.10+ */
+		background: -ms-linear-gradient(top, #b9e0f5 0%,#92bdd6 100%); /* IE10+ */
+		background: linear-gradient(top, #b9e0f5 0%,#92bdd6 100%); /* W3C */
+	-webkit-box-shadow: none;
+	-moz-box-shadow: none;
+	box-shadow: none;
+}
+.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #313131; text-decoration: none; }
+.ui-widget :active { outline: none; }
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight  { border: 1px solid #d2dbf4; background: #f4f8fd; color: #0d2054; -moz-border-radius: 0 !important; -webkit-border-radius: 0 !important; border-radius: 0 !important; }
+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
+.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error { border: 1px solid #e2d0d0; background: #fcf0f0; color: #280b0b; -moz-border-radius: 0 !important; -webkit-border-radius: 0 !important; border-radius: 0 !important; }
+.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
+.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
+.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary,  .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { width: 16px; height: 16px; background-image: url(../lib/css/Aristo/images/ui-icons_222222_256x240.png); }
+.ui-widget-content .ui-icon {background-image: url(../lib/css/Aristo/images/ui-icons_222222_256x240.png); }
+.ui-widget-header .ui-icon {background-image: url(../lib/css/Aristo/images/ui-icons_222222_256x240.png); }
+.ui-state-default .ui-icon { background-image: url(../lib/css/Aristo/images/ui-icons_454545_256x240.png); }
+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(../lib/css/Aristo/images/ui-icons_454545_256x240.png); }
+.ui-state-active .ui-icon {background-image: url(../lib/css/Aristo/images/ui-icons_454545_256x240.png); }
+.ui-state-highlight .ui-icon {background-image: url(../lib/css/Aristo/images/ui-icons_454545_256x240.png); }
+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon { background: url(../lib/css/Aristo/images/icon_sprite.png) -16px 0 no-repeat !important; }
+.ui-state-highlight .ui-icon, .ui-state-error .ui-icon { margin-top: -1px; }
+
+/* positioning */
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background: url(../lib/css/Aristo/images/icon_sprite.png) 0 0 no-repeat !important; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-off { background-position: -96px -144px; }
+.ui-icon-radio-on { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-tl { -moz-border-radius-topleft: 3px; -webkit-border-top-left-radius: 3px; border-top-left-radius: 3px; }
+.ui-corner-tr { -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 3px; border-top-right-radius: 3px; }
+.ui-corner-bl { -moz-border-radius-bottomleft: 3px; -webkit-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; }
+.ui-corner-br { -moz-border-radius-bottomright: 3px; -webkit-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; }
+.ui-corner-top { -moz-border-radius-topleft: 3px; -webkit-border-top-left-radius: 3px; border-top-left-radius: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 3px; border-top-right-radius: 3px; }
+.ui-corner-bottom { -moz-border-radius-bottomleft: 3px; -webkit-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; -moz-border-radius-bottomright: 3px; -webkit-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; }
+.ui-corner-right {  -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 3px; border-top-right-radius: 3px; -moz-border-radius-bottomright: 3px; -webkit-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; }
+.ui-corner-left { -moz-border-radius-topleft: 3px; -webkit-border-top-left-radius: 3px; border-top-left-radius: 3px; -moz-border-radius-bottomleft: 3px; -webkit-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; }
+.ui-corner-all { -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; }
+
+/* Overlays */
+.ui-widget-overlay { background: #262b33; opacity: .70;filter:Alpha(Opacity=70); }
+.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #000000; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }
+
+/*
+ * jQuery UI Autocomplete 1.8.7
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Autocomplete#theming
+ */
+.ui-autocomplete {
+	position: absolute; cursor: default; z-index: 3;
+		-moz-border-radius: 0; 
+		-webkit-border-radius: 0;
+		border-radius: 0;
+			-moz-box-shadow: 0 1px 5px rgba(0,0,0,0.3);
+			-webkit-box-shadow: 0 1px 5px rgba(0,0,0,0.3);
+			box-shadow: 0 1px 5px rgba(0,0,0,0.3);
+}	
+
+/* workarounds */
+* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
+
+/*
+ * jQuery UI Menu 1.8.7
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Menu#theming
+ */
+.ui-menu {
+	list-style:none;
+	padding: 2px;
+	margin: 0;
+	display:block;
+	float: left;
+}
+.ui-menu .ui-menu {
+	margin-top: -3px;
+}
+.ui-menu .ui-menu-item {
+	margin:0;
+	padding: 0;
+	zoom: 1;
+	float: left;
+	clear: left;
+	width: 100%;
+}
+.ui-menu .ui-menu-item a {
+	text-decoration:none;
+	display:block;
+	padding:.2em .4em;
+	line-height:1.5;
+	zoom:1;
+}
+.ui-menu .ui-menu-item a.ui-state-hover,
+.ui-menu .ui-menu-item a.ui-state-active {
+	font-weight: normal;
+	margin: -1px;
+	background: #5f83b9;
+	color: #FFFFFF;
+	border-color: #466086;
+		-moz-border-radius: 0; 
+		-webkit-border-radius: 0;
+		border-radius: 0;
+}
+
+/*
+ * jQuery UI Datepicker 1.8.7
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Datepicker#theming
+ */
+.ui-datepicker { width: 17em; padding: 0; display: none; border-color: #DDDDDD; }
+.ui-datepicker {
+	-moz-box-shadow: 0 4px 8px rgba(0,0,0,0.5);
+	-webkit-box-shadow: 0 4px 8px rgba(0,0,0,0.5);
+	box-shadow: 0 4px 8px rgba(0,0,0,0.5);
+}
+.ui-datepicker .ui-datepicker-header { position:relative; padding:.35em 0; border: none; border-bottom: 1px solid #B6B6B6; -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; }
+.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 6px; width: 1.8em; height: 1.8em; }
+.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { border: 1px none; }
+.ui-datepicker .ui-datepicker-prev { left:2px; }
+.ui-datepicker .ui-datepicker-next { right:2px; }
+.ui-datepicker .ui-datepicker-prev span { background-position: 0px -32px !important; }
+.ui-datepicker .ui-datepicker-next span { background-position: -16px -32px !important; }
+.ui-datepicker .ui-datepicker-prev-hover span { background-position: 0px -48px !important; }
+.ui-datepicker .ui-datepicker-next-hover span { background-position: -16px -48px !important; }
+.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; background: url(../lib/css/Aristo/images/icon_sprite.png) no-repeat; }
+.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; font-size: 12px; text-shadow: 0 1px 0 rgba(255,255,255,0.6); }
+.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
+.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
+.ui-datepicker select.ui-datepicker-month, 
+.ui-datepicker select.ui-datepicker-year { width: 49%;}
+.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
+.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0;  }
+.ui-datepicker td { border: 0; padding: 1px; }
+.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
+.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
+.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
+.ui-datepicker table .ui-state-highlight { border-color: #5F83B9; }
+.ui-datepicker table .ui-state-hover { background: #5F83B9; color: #FFF; font-weight: bold; text-shadow: 0 1px 1px #234386; -webkit-box-shadow: 0 0px 0 rgba(255,255,255,0.6) inset; -moz-box-shadow: 0 0px 0 rgba(255,255,255,0.6) inset; box-shadow: 0 0px 0 rgba(255,255,255,0.6) inset; border-color: #5F83B9; }
+.ui-datepicker-calendar .ui-state-default { background: transparent; border-color: #FFF; }
+.ui-datepicker-calendar .ui-state-active { background: #5F83B9; border-color: #5F83B9; color: #FFF; font-weight: bold; text-shadow: 0 1px 1px #234386; }
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi { width:auto; }
+.ui-datepicker-multi .ui-datepicker-group { float:left; }
+.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
+.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
+.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
+.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
+.ui-datepicker-row-break { clear:both; width:100%; }
+
+/* RTL support */
+.ui-datepicker-rtl { direction: rtl; }
+.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+
+/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
+.ui-datepicker-cover {
+    display: none; /*sorry for IE5*/
+    display/**/: block; /*sorry for IE5*/
+    position: absolute; /*must have*/
+    z-index: -1; /*must have*/
+    filter: mask(); /*must have*/
+    top: -4px; /*must have*/
+    left: -4px; /*must have*/
+    width: 200px; /*must have*/
+    height: 200px; /*must have*/
+}
+
+
+
+/*
+ *	lib/css/ui/common.css
+ */
+.navbar-icon-home {
+	vertical-align: middle;
+	opacity: 0.4;
+	Filter:alpha(opacity=40); /* For IE8 and earlier */
+}
+
+.navbar-icon-home:hover,
+.navbar-icon-home:focus,
+.navbar-icon-home:active,
+.navbar-icon-home-hover{
+	opacity:1;
+	Filter:alpha(opacity=100); /* For IE8 and earlier */
+}
+
+
+/*
+ *	lib/css/ui/list.css
+ */
+.hide {
+	display: none;
+}
+
+.list-filters {
+	margin: 7px 0px;
+}
+
+.wnlist .img-load {
+	display: none;
+	float: left;
+	margin-bottom: 8px;
+}
+
+/* list-row */
+div.list-row {
+	border-bottom: 1px solid #eee;
+	padding: 5px 0px;
+}
+
+div.list-row .label {
+	margin-right: 4px;
+}
+
+div.list-row table {
+	table-layout: fixed;
+	border-collapse: collapse;
+	width: 100%;
+}
+
+div.list-row table td {
+	overflow: hidden;
+	/*padding-right: 3px;*/
+	padding: 0px 3px;
+	vertical-align: middle;
+	height: 24px;
+	max-height: 24px;
+	word-wrap: break-word;
+}
+
+div.paging-button {
+	text-align: center;
+	padding: 11px 0px;
+}
+
+div.show_filters {
+	display: none;
+}
+
+div.filter_list {
+	padding: 13px;
+}
+
+div.show_filters.well {
+	margin-top: 11px;
+	margin-bottom: 11px;
+}
+
+div.filter_list .run_btn {
+	text-align: right;
+}
+
+div.filter_list .add_filter {
+	margin: 3px 0px;
+}
+
+div.list_filter {
+	margin: 7px 0px;
+}
+
+div.list_filter input, div.list_filter select {
+	width: 130px;
+	margin-right: 7px;
+}
+
+/* bar */
+
+span.bar-outer {
+	display: inline-block;
+	margin: 0px 7px;
+	margin-top: 3px;
+	background-color: #fff;
+	border: 1px solid #aaa;
+	height: 10px;
+}
+
+span.bar-inner {
+	display: inline-block;
+	background-color: #bdf;
+	height: 100%;
+	margin-bottom: 2px;
+	float: left;
+}
+span.bar-complete {
+	background-color: #009900;
+}
+span.bar-empty {
+	background-color: #990000;
+}
+
+
+/* stats */
+
+div.stat-wrapper {
+	margin-bottom: 19px;	
+}
+
+div.stat-grid {
+	border: 2px solid #bbb;
+	background-color: white;
+	border-radius: 5px;
+	-moz-border-radius: 5px;
+	-webkit-border-radius: 5px;
+	overflow: hidden;
+}
+
+div.stat-label {
+	position: relative;
+	padding: 3px;
+	text-align: center;
+}
+div.stat-label, div.stat-label a {
+	z-index: 5;
+}
+
+div.stat-item {
+	position: relative;
+	border-bottom: 1px solid #ddd;
+}
+div.stat-item:last-child {
+	border-bottom: 0px solid #ddd;	
+}
+
+div.stat-bar {
+	position: absolute;
+	left: 0px;
+	background-color: #def;
+	height: 100%;
+	z-index: 0;
+}
+
+
+
+
+
+/*
+ *	lib/css/ui/views.css
+ */
+
+.breadcrumbs {
+	color: #000000;
+}
+
+.breadcrumbs a {
+	color: #000000;
+}
+
+div.appframe-titlebar {
+	padding: 6px;
+	background: #eeeeee; /* Old browsers */
+	background: -moz-linear-gradient(top,  #eeeeee 0%, #cccccc 100%); /* FF3.6+ */
+	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */
+	background: -webkit-linear-gradient(top,  #eeeeee 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */
+	background: -o-linear-gradient(top,  #eeeeee 0%,#cccccc 100%); /* Opera 11.10+ */
+	background: -ms-linear-gradient(top,  #eeeeee 0%,#cccccc 100%); /* IE10+ */
+	background: linear-gradient(top,  #eeeeee 0%,#cccccc 100%); /* W3C */
+	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */
+	border-bottom: 1px solid #aaa;
+	min-height: 1.2em;
+}
+
+div.appframe-toolbar {
+	padding: 4px;
+	background: #eeeeee;
+	border-top: 1px solid #f8f8f8;
+	border-bottom: 1px solid #ccc;
+}
+
+/*
+ *	lib/css/ui/fonts.css
+ */
+@font-face {
+  font-family: 'Pontano Sans';
+  font-style: normal;
+  font-weight: 800;
+  src: url('../lib/css/fonts/pontanosans.woff') format('woff');
+}
+
+@font-face {
+  font-family: 'Droid Sans';
+  font-style: normal;
+  font-weight: normal;
+  src: local('Droid Sans'), local('DroidSans'), url('../lib/css/fonts/droidsans.woff') format('woff');
+}
+
+@font-face {
+  font-family: 'PT Sans';
+  font-style: normal;
+  font-weight: normal;
+  src: local('PT Sans'), local('PTSans-Regular'), url('../lib/css/fonts/ptsans.woff') format('woff');
+}
+
+@font-face {
+  font-family: 'Open Sans';
+  font-style: normal;
+  font-weight: 400;
+  src: local('Open Sans'), local('OpenSans'), url('../lib/css/fonts/opensans.woff') format('woff');
+}
+
+@font-face {
+  font-family: 'Lato';
+  font-style: normal;
+  font-weight: 400;
+  src: local('Lato Regular'), local('Lato-Regular'), url('../lib/css/fonts/lato.woff') format('woff');
+}
+
+@font-face {
+  font-family: 'Cabin';
+  font-style: normal;
+  font-weight: 400;
+  src: local('Cabin Regular'), local('Cabin-Regular'), url('../lib/css/fonts/cabin.woff') format('woff');
+}
+
+@font-face {
+  font-family: 'Pacifico';
+  font-style: normal;
+  font-weight: normal;
+  src: local('Pacifico Regular'), local('Pacifico-Regular'), url('../lib/css/fonts/pacifico.woff') format('woff');
+}
+
+
+
+/*
+ *	erpnext/startup/startup.css
+ */
+h1, h2, h3, h4, h5 {
+	font-family: "Helvetica Neue", "Open Sans", Helvetica, sans-serif;
+	margin-top: 0.2em;
+}
+
+body {
+	font-family: "Helvetica Neue", "Open Sans", Helvetica, sans-serif;
+	font-size: 13px;
+}
+
 span, div, td, input, textarea, button, select {
 	font-family: inherit;
 }
 
 body {
-	background: url(../images/stripedbg.png) repeat;
+	background: url(../images/redbeech.jpg) repeat;
+	color: #616161;
+}
+
+.small {
+	font-size: 11.5px;
 }
 
 .erpnext-footer {
@@ -2774,25 +3593,6 @@
 	text-align: center;
 }
 
-.module-icons {
-   background: url(../images/module-icons.png) no-repeat top left;
-   width:16px;
-   height:16px;
-}
-
-.module-icons-accounts{ background-position: 0 0;  } 
-.module-icons-analysis{ background-position: 0 -66px;  } 
-.module-icons-buying{ background-position: 0 -132px;  } 
-.module-icons-home{ background-position: 0 -198px;  } 
-.module-icons-hr{ background-position: 0 -264px;  } 
-.module-icons-people{ background-position: 0 -330px;  } 
-.module-icons-production{ background-position: 0 -396px;  } 
-.module-icons-projects{ background-position: 0 -462px;  } 
-.module-icons-selling{ background-position: 0 -528px;  } 
-.module-icons-setup{ background-position: 0 -594px;  } 
-.module-icons-stock{ background-position: 0 -660px;  } 
-.module-icons-support{ background-position: 0 -726px;  } 
-
 .navbar-new-comments {
 	margin: -3px 0px;
 	padding: 2px;
@@ -2810,28 +3610,14 @@
 	color: #fff;
 }
 
-
 .navbar-new-comments-true {
 	color: #fff;
 	background-color: #B00D07;
 }
 
-.navbar-icon-home {
-	vertical-align: middle;
-	opacity:0.4;
-	Filter:alpha(opacity=40); /* For IE8 and earlier */
-}
-
-.navbar-icon-home:hover,
-.navbar-icon-home:focus,
-.navbar-icon-home:active,
-.navbar-icon-home-hover{
-	opacity:1;
-	Filter:alpha(opacity=100); /* For IE8 and earlier */
-}
-
 /*extra size menus for recent*/
 .dropdown-menu#toolbar-recent, .dropdown-menu#toolbar-options, .dropdown-menu#toolbar-help{
 	min-width: 160px !important;
 	max-width: 260px !important;
 }
+
diff --git a/css/all-web.css b/css/all-web.css
index 36d9cda..146d478 100644
--- a/css/all-web.css
+++ b/css/all-web.css
@@ -1,379 +1,8 @@
 
 /*
- *	lib/css/legacy/body.css
- */html { 
-	margin: 0px;
-	padding: 0px;
-}
-
-body {	
-	margin: 0px;
-	padding: 0px;
-	font-family: Arial, Helvetica, Sans;
-	font-size: 12px;
-	color: #000;
-	background-color: #e2e2e2;
-}
-
-pre { margin: 0px; padding: 0px; }
-
-button { margin: 2px; margin-left: 0px; }
-
-label {
-	padding-top: 15px;
-	color: #404040;
-}
-
-select, input, textarea { 
-	border: 1px solid #AAA; 
-	-moz-border-radius: 4px;
-	-webkit-border-radius: 4px;
-	font-size: 13px;
-	padding: 4px;
-	color: #222;
-}
-
-textarea { 
-	font-family: inherit; 
-	height: 120px; 
-	width: 90%; 
-	font-size: 12px; 
-	white-space: normal;
-}
-
-table { padding: 0px; border-collapse: 'collapse'}
-
-td { 
-	padding:0px; 
-	margin: 0px; 
-	vertical-align: top; 
-}
-
-p {
-	margin: 0px 0px 9px 0px;
-	line-height: 1.5em;
-}
-
-li {
-	line-height: 1.5em;
-}
-
-hr {
-  margin: 18px 0;
-  border: 0;
-  border-top: 1px solid #e5e5e5;
-  border-bottom: 1px solid #ffffff;
-}
-
-/* links */
-
-a:active { outline:none; }
-
-a {
-  color: #0088cc;
-  text-decoration: none;
-}
-a:hover {
-  color: #005580;
-  text-decoration: underline;
-}
-
-.link_type {
-	padding:2px;
-	color: #0088cc;
-	cursor: pointer;
-}
-
-.link_type:hover {
-	color: #005580;
-	text-decoration: underline;
-}
-
-:focus { -moz-outline-style:none; }
-
-table.simpletable { border-collapse: collapse; margin-bottom: 10px;}
-table.simpletable td {border: 1pt solid #000; vertical-align: top; padding: 2px; }
-
-div.fix_ff_cursor { overflow: auto; }
-
-/* --- Layout --- */
-
-div.comment { color: #444; }
-
-div#body_div {
-	position: relative;
-	display: none;
-	padding-right: 7px;
-	width: 900px;
-	margin: auto;
-	margin-top: 56px;
-}
-
-footer {
-	width: 900px;
-	margin: auto;
-}
-header .container {
-	width: 900px;
-	margin: auto;
-}
-
-div.no_script {
-	display: none;
-}
-
-div.loading_div {
-	position: absolute;
-	background-color: #FFFFCC;
-	z-index: 1999;
-	right: 5px;
-	width: 90px;
-	display: none;
-	text-align: center;
-	padding: 2px;
-	font-size: 12px;
-	border: 1px solid #FF4;
-}
-
-div.std-footer {
-	margin: 13px 0px;
-	border-top: 1px solid #AAA;
-	padding: 13px;
-}
-
-div.std-footer-item {
-	margin: 0px 13px 13px 0px;
-}
-
-.shadow {
-	-moz-box-shadow: 0px 2px 2px #888;
-	-webkit-box-shadow: 0px 2px 2px #888;
- 	box-shadow: 0px 2px 2px #888;
-}
-
-.round {
-	-webkit-border-radius: 5px;
-	-moz-border-radius: 5px;
-	border-radius: 5px;	
-}
-.gradient {
-	background: #ededed; /* Old browsers */
-	background: -moz-linear-gradient(top, #ededed 0%, #d1d1d1 47%, #b7b7b7 100%); /* FF3.6+ */
-	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ededed), color-stop(47%,#d1d1d1), color-stop(100%,#b7b7b7)); /* Chrome,Safari4+ */
-	background: -webkit-linear-gradient(top, #ededed 0%,#d1d1d1 47%,#b7b7b7 100%); /* Chrome10+,Safari5.1+ */
-	background: -o-linear-gradient(top, #ededed 0%,#d1d1d1 47%,#b7b7b7 100%); /* Opera11.10+ */
-	background: -ms-linear-gradient(top, #ededed 0%,#d1d1d1 47%,#b7b7b7 100%); /* IE10+ */
-	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ededed', endColorstr='#b7b7b7',GradientType=0 ); /* IE6-9 */
-	background: linear-gradient(top, #ededed 0%,#d1d1d1 47%,#b7b7b7 100%); /* W3C */	
-}
-
-.layout_wrapper, .layout-wrapper {
-	-moz-box-shadow: 1px 1px 8px #555;
-	-webkit-box-shadow: 1px 1px 8px #555;
-	box-shadow: 1px 1px 8px #555;
-	background-color: #fff;
-	padding: 15px;
-}
-
-.layout-wrapper-background {
-	background-color: #f2f2f2 !important;
-	padding: 0px;
-}
-
-.layout-main-section {
-	width: 71%;
-	float: left;
-	padding: 15px;
-	background-color: #FFF;
-	min-height: 450px;
-	-moz-box-shadow:    7px 0px 6px -2px #ddd;
-	-webkit-box-shadow: 7px 0px 6px -2px #ddd;
-	box-shadow:         7px 0px 6px -2px #ddd;
-}
-
-.layout-side-section {
-	width: 22%;
-	/*float: right;*/
-	color: #606060;
-	overflow-x: hidden;
-	padding: 15px;
-	min-height: 450px;
-}
-
-/* from bootstrap */
-.container {
-  margin-left: auto;
-  margin-right: auto;
-  zoom: 1;
-}
-.container:before, .container:after {
-  display: table;
-  content: "";
-  zoom: 1;
-}
-.container:after {
-  clear: both;
-}
-
-.well {
-  min-height: 20px;
-  padding: 19px;
-  margin-bottom: 20px;
-  background-color: #f5f5f5;
-  border: 1px solid #eee;
-  border: 1px solid rgba(0, 0, 0, 0.05);
-  -webkit-border-radius: 4px;
-  -moz-border-radius: 4px;
-  border-radius: 4px;
-  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
-  -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
-  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
-}
-
-.avatar-small {
-	display: inline-block; 
-	min-width: 29px;
-}
-.avatar-small img {
-	height: 24px; 
-	margin-bottom: -7px;
-	max-width: 24px;
-}
-
-/*
- *	lib/css/legacy/messages.css
- */
-/* FLOATING MESSAGE */
-
-.btn-img { cursor: pointer; }
-
-div.fetching { color: #888; text-align:right; }
-
-div.notice {
-	postion: absolute;
-	background-color: #000;
-	-moz-border-radius: 5px; -webkit-border-radius: 5px;
-	opacity: 0.6;
-	right: 0;
-	top: 0;
-	margin-top: 8px;
-	z-index: -1;
-	padding: 8px;
-}
-
-/** help **/
-
-.info-box {
-    background-color: #F8F8F8;
-    border: 1px solid #CCCCCC;
-    border-radius: 3px 3px 3px 3px;
-    line-height: 1.6em;
-    overflow: auto;
-    padding: 6px 10px;
-	margin-bottom: 9px;
-}
-
-.help_box, .help-box {
-	background-color:#FFC;
-	font-size: 13px;
-	color: #864;
-	padding: 7px;
-	margin: 11px 0px;
-	border: 1px solid #EEB;
-}
-
-.help_box_big {
-	background-color:#FFC;
-	color: #864;
-	padding: 7px;
-	margin: 7px 0px;
-	border: 1px solid #EEB;
-	text-align: center;
-	font-size: 14px;
-}
-/*
- *	lib/css/legacy/dialog.css
- *//***** Dialogs *******/
-
-div.dialog_wrapper {
-	position: absolute;
-	width: 440px;
-	display: none;
-	z-index: 90;
-	background-color: #FFF;
-	border: 3px solid #222;
-	box-shadow:1px 1px 5px #777;
-	-moz-box-shadow: 1px 1px 5px #777;
-	-webkit-box-shadow: 1px 1px 5px #777;
-	
-	border-radius: 5px;
-	-moz-border-radius: 5px;
-	-webkit-border-radius: 5px;	
-}
-
-div.dialog_head {
-	height: 22px;
-	padding: 4px;
-	background-color: #222;
-	color: #FFF;
-}
-
-div.dialog_body {
-	padding: 8px 8px 16px;
-	border-radius: 5px;
-	-moz-border-radius: 5px;
-	-webkit-border-radius: 5px;	
-}
-
-div.dialog_back {
-	position: fixed;
-	display: none;
-	top: 0px;
-	left: 0px;
-	bottom: 0px;
-	right: 0px;
-	background-color: #EEE;
-	opacity: 0.6;
-	z-index: 50;
-	text-align: center;
-}
-
-div.dialog_message {
-	display: none;
-	position: absolute;
-	width: 250px;
-	font-size: 12px;
-	z-index: 91;
-	background-color:#FFF;
-	padding: 12px;
-	border: 1px solid #444;
-}
-
-div.dialog_row {
-	padding: 8px 8px 0px 8px;
-}
-
-div.dialog_row table {
-	width: 100%;
-}
-
-div.dialog_row table td {
-}
-
-div.dialog_row input[type="text"], div.dialog_row input[type="password"], div.dialog_row textarea, div.dialog_row select {
-	width: 80%;
-	font-size: 14px;
-}
-
-div.dialog_row table td textarea {
-	width: 80%;
-	height: 200px;
-	font-size: 12px;
-}
-
-/*
  *	lib/css/bootstrap/headings.css
- *//* heading from bootstrap */
+ */
+/* heading from bootstrap */
 
 h1,
 h2,
@@ -385,7 +14,6 @@
   font-weight: bold;
   color: #333333;
   text-rendering: optimizelegibility;
-  margin-bottom: 0.3em;
 }
 h1 small,
 h2 small,
@@ -397,46 +25,49 @@
   color: #999999;
 }
 h1 {
-  font-size: 30px;
-  line-height: 36px;
+  font-size: 280%;
+  line-height: 120%;
 }
 h1 small {
-  font-size: 18px;
+  font-size: 150%;
 }
 h2 {
-  font-size: 24px;
-  line-height: 36px;
+  font-size: 200%;
+  line-height: 120%;
 }
 h2 small {
-  font-size: 18px;
+  font-size: 150%;
 }
 h3 {
-  line-height: 27px;
-  font-size: 18px;
+  font-size: 210%;
+  font-size: 150%;
 }
 h3 small {
-  font-size: 14px;
+  font-size: 130%;
 }
 h4, h5, h6 {
-  line-height: 18px;
+  font-size: 150%;
 }
 h4 {
-  font-size: 14px;
+  font-size: 113%;
 }
 h4 small {
-  font-size: 12px;
+  font-size: 100%;
 }
 h5 {
-  font-size: 12px;
+  font-size: 100%;
 }
 h6 {
   font-size: 11px;
   color: #999999;
   text-transform: uppercase;
 }
+
 /*
  *	lib/css/bootstrap/buttons.css
- */.close {
+ */
+.close {
+  font-family: Helvetica, Sans;
   float: right;
   font-size: 20px;
   font-weight: bold;
@@ -819,9 +450,11 @@
 .btn-small .caret {
   margin-top: 4px;
 }
+
 /*
  *	lib/css/bootstrap/navbar.css
- */.nav {
+ */
+.nav {
   margin-left: 0;
   margin-bottom: 18px;
   list-style: none;
@@ -1287,9 +920,11 @@
 	padding: 0px 20px;
 }
 
+
 /*
  *	lib/css/bootstrap/dropdown.css
- */.dropdown {
+ */
+.dropdown {
   position: relative;
 }
 .dropdown-toggle {
@@ -1389,9 +1024,11 @@
 .dropdown.open .dropdown-menu {
   display: block;
 }
+
 /*
  *	lib/css/bootstrap/tooltip.css
- */.tooltip {
+ */
+.tooltip {
   position: absolute;
   z-index: 1020;
   display: block;
@@ -1557,16 +1194,702 @@
 .popover-content p, .popover-content ul, .popover-content ol {
   margin-bottom: 0;
 }
+
 /*
- *	erpnext/startup/startup.css
- */h1, h2, h3, h4, h5 {
-	font-family: Tahoma, Arial, Verdana, sans-serif;
-	font-weight: bold;
+ *	lib/css/legacy/body.css
+ */
+html { 
+	margin: 0px;
+	padding: 0px;
+}
+
+body {	
+	margin: 0px;
+	padding: 0px;
+	font-size: 14px;
+	color: #000;
+	background-color: #e2e2e2;
+}
+
+/* font settings */
+
+h1, h2, h3, h4, h5 {
+	font-family: "Helvetica Neue", Helvetica, "Helvetica Neue", sans-serif;
+	margin-top: 0.2em;
 }
 
 body {
-	font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
+	font-family: "Helvetica Neue", Helvetica, "Helvetica Neue", sans-serif;
+	font-size: 13px;
+}
+
+span, div, td, input, textarea, button, select {
+	font-family: inherit;
+}
+
+
+pre { margin: 0px; padding: 0px; }
+
+button { margin: 2px; margin-left: 0px; }
+
+label {
+	padding-top: 15px;
+	color: #404040;
+}
+
+select, input, textarea { 
+	border: 1px solid #ccc; 
+	-moz-border-radius: 4px;
+	-webkit-border-radius: 4px;
+	font-size: inherit;
+	padding: 4px;
+	color: #444;
+	-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+	-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+	box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+}
+
+textarea { 
+	font-family: inherit; 
+	height: 120px; 
+	width: 90%; 
+	font-size: inherit; 
+	white-space: normal;
+}
+
+table { padding: 0px; border-collapse: 'collapse'}
+
+td { 
+	padding:0px; 
+	margin: 0px; 
+	vertical-align: top; 
+}
+
+p {
+	margin: 0px 0px 9px 0px;
+	line-height: 1.5em;
+}
+
+li {
+	line-height: 1.5em;
+}
+
+hr {
+  margin: 18px 0;
+  border: 0;
+  border-top: 1px solid #e5e5e5;
+  border-bottom: 1px solid #ffffff;
+}
+
+/* links */
+
+a:active { outline:none; }
+
+a {
+  color: #0088cc;
+  text-decoration: none;
+}
+a:hover {
+  color: #005580;
+  text-decoration: underline;
+}
+
+.link_type {
+	padding:2px;
+	color: #0088cc;
+	cursor: pointer;
+}
+
+.link_type:hover {
+	color: #005580;
+	text-decoration: underline;
+}
+
+:focus { -moz-outline-style:none; }
+
+table.simpletable { border-collapse: collapse; margin-bottom: 10px;}
+table.simpletable td {border: 1pt solid #000; vertical-align: top; padding: 2px; }
+
+div.fix_ff_cursor { overflow: auto; }
+
+/* --- Layout --- */
+
+div.comment { color: #444; }
+
+.small {
+	font-size: 11px;
+}
+
+.help {
+	margin-bottom: 3px;
+	color: #888;
+}
+
+div#body_div {
+	display: none;
+	padding-right: 7px;
+	width: 900px;
+	margin: auto;
+	margin-top: 56px;
+}
+
+.content {
+	width: 900px;
+}
+
+.background-fade-in {
+	-webkit-transition: background 1s ease-in; /* property duration timing-function delay */
+    -moz-transition: background 1s ease-in;
+    -o-transition: background 1s ease-in;
+    transition: background 1s ease-in;
+}
+
+footer {
+	width: 900px;
+	margin: auto;
+}
+header .container {
+	width: 900px;
+	margin: auto;
+}
+
+@media (max-width: 1200px) {
+	div#body_div, header .container, .content, #opened-page-selector, footer {
+		width: 900px;
+	}
+}
+
+@media (min-width: 1200px) {
+	div#body_div, header .container, .content, #opened-page-selector, footer {
+		width: 1100px;
+	}
+}
+
+div.no_script {
+	display: none;
+}
+
+div.loading_div {
+	background-color: #FFFFCC;
+	z-index: 1999;
+	right: 5px;
+	width: 90px;
+	display: none;
+	text-align: center;
+	padding: 2px;
+	border: 1px solid #FF4;
+}
+
+div.std-footer {
+	margin: 13px -15px;
+	border-top: 1px solid #AAA;
+	padding: 13px;
+}
+
+div.std-footer-item {
+	margin: 0px 13px 13px 0px;
+}
+
+.shadow {
+	-moz-box-shadow: 0px 2px 2px #888;
+	-webkit-box-shadow: 0px 2px 2px #888;
+ 	box-shadow: 0px 2px 2px #888;
+}
+
+.round {
+	-webkit-border-radius: 5px;
+	-moz-border-radius: 5px;
+	border-radius: 5px;	
+}
+
+.layout_wrapper, .layout-wrapper {
+	-moz-box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
+	-webkit-box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
+	box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
+	background-color: #fff;
+	padding: 15px;
+	-webkit-border-radius: 5px;
+	-moz-border-radius: 5px;
+	border-radius: 5px;	
+	margin-bottom: 30px;
+	overflow: hidden;
+}
+
+.layout-wrapper-appframe {
+	padding: 0px;
+}
+
+.layout-wrapper-background {
+	background-color: #fafafa !important;
+	padding: 0px;
+}
+
+.layout-main {
+	padding: 15px;	
+}
+
+.layout-main-section {
+	width: 71%;
+	float: left;
+	padding: 15px;
+	background-color: #FFF;
+	min-height: 600px;
+	-moz-box-shadow:    2px 0px 1px #ddd;
+	-webkit-box-shadow: 2px 0px 1px #ddd;
+	box-shadow:         2px 0px 1px #ddd;
+}
+
+.layout-side-section {
+	width: 22%;
+	/*float: right;*/
+	color: #606060; 
+	overflow-x: hidden;
+	padding: 15px;
+	min-height: 600px;
+}
+
+/* from bootstrap */
+.container {
+  margin-left: auto;
+  margin-right: auto;
+  zoom: 1;
+}
+.container:before, .container:after {
+  display: table;
+  content: "";
+  zoom: 1;
+}
+.container:after {
+  clear: both;
+}
+
+.well {
+  min-height: 20px;
+  padding: 19px;
+  margin-bottom: 20px;
+  background-color: #f5f5f5;
+  border: 1px solid #eee;
+  border: 1px solid rgba(0, 0, 0, 0.05);
+  -webkit-border-radius: 4px;
+  -moz-border-radius: 4px;
+  border-radius: 4px;
+  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
+  -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
+  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
+}
+
+.avatar-small {
+	display: inline-block; 
+	width: 24px;
+	height: 20px;
+	vertical-align: middle;
+	overflow: hidden;
+	margin: 0px 3px;
+}
+.avatar-small img {
+	width: 24px; 
+}
+
+/*
+ *	lib/css/legacy/messages.css
+ */
+
+/* FLOATING MESSAGE */
+
+.btn-img { cursor: pointer; }
+
+div.fetching { color: #888; text-align:right; }
+
+div.notice {
+	postion: absolute;
+	background-color: #000;
+	-moz-border-radius: 5px; -webkit-border-radius: 5px;
+	opacity: 0.6;
+	right: 0;
+	top: 0;
+	margin-top: 8px;
+	z-index: -1;
+	padding: 8px;
+}
+
+/** help **/
+
+.info-box {
+    background-color: #F8F8F8;
+    border: 1px solid #CCCCCC;
+    border-radius: 3px 3px 3px 3px;
+    line-height: 1.6em;
+    overflow: auto;
+    padding: 6px 10px;
+	margin-bottom: 9px;
+}
+
+.help_box, .help-box {
+	background-color:#FFC;
+	font-size: 13px;
+	color: #864;
+	padding: 7px;
+	margin: 11px 0px;
+	border: 1px solid #EEB;
+}
+
+.help_box_big {
+	background-color:#FFC;
+	color: #864;
+	padding: 7px;
+	margin: 7px 0px;
+	border: 1px solid #EEB;
+	text-align: center;
+	font-size: 14px;
+}
+
+/*
+ *	lib/css/legacy/dialog.css
+ */
+/***** Dialogs *******/
+
+div.dialog_wrapper {
+	position: absolute;
+	width: 440px;
+	display: none;
+	z-index: 90;
+	background-color: #FFF;
+	box-shadow:1px 1px 8px #444;
+	-moz-box-shadow: 1px 1px 8px #444;
+	-webkit-box-shadow: 1px 1px 8px #444;
+	
+	border-radius: 5px;
+	-moz-border-radius: 5px;
+	-webkit-border-radius: 5px;
+	
+	overflow: hidden;
+}
+
+div.dialog_head {
+	height: 22px;
+	padding: 4px;
+	background-color: #222;
+	color: #FFF;
+}
+
+div.dialog_body {
+	padding: 8px 8px 16px;
+	border-radius: 5px;
+	-moz-border-radius: 5px;
+	-webkit-border-radius: 5px;	
+}
+
+div.dialog_back {
+	position: fixed;
+	display: none;
+	top: 0px;
+	left: 0px;
+	bottom: 0px;
+	right: 0px;
+	background-color: #aaa;
+	opacity: 0.6;
+	z-index: 50;
+	text-align: center;
+}
+
+div.dialog_message {
+	display: none;
+	position: absolute;
+	width: 250px;
 	font-size: 12px;
+	z-index: 91;
+	background-color:#FFF;
+	padding: 12px;
+	border: 1px solid #444;
+}
+
+div.dialog_row {
+	padding: 8px 8px 0px 8px;
+}
+
+div.dialog_row table {
+	width: 100%;
+}
+
+div.dialog_row table td {
+}
+
+div.dialog_row input[type="text"], div.dialog_row input[type="password"], div.dialog_row textarea, div.dialog_row select {
+	width: 80%;
+	font-size: 14px;
+}
+
+div.dialog_row table td textarea {
+	width: 80%;
+	height: 200px;
+	font-size: 12px;
+}
+
+
+/*
+ *	lib/css/ui/common.css
+ */
+.navbar-icon-home {
+	vertical-align: middle;
+	opacity: 0.4;
+	Filter:alpha(opacity=40); /* For IE8 and earlier */
+}
+
+.navbar-icon-home:hover,
+.navbar-icon-home:focus,
+.navbar-icon-home:active,
+.navbar-icon-home-hover{
+	opacity:1;
+	Filter:alpha(opacity=100); /* For IE8 and earlier */
+}
+
+
+/*
+ *	lib/css/ui/fonts.css
+ */
+@font-face {
+  font-family: 'Pontano Sans';
+  font-style: normal;
+  font-weight: 800;
+  src: url('../lib/css/fonts/pontanosans.woff') format('woff');
+}
+
+@font-face {
+  font-family: 'Droid Sans';
+  font-style: normal;
+  font-weight: normal;
+  src: local('Droid Sans'), local('DroidSans'), url('../lib/css/fonts/droidsans.woff') format('woff');
+}
+
+@font-face {
+  font-family: 'PT Sans';
+  font-style: normal;
+  font-weight: normal;
+  src: local('PT Sans'), local('PTSans-Regular'), url('../lib/css/fonts/ptsans.woff') format('woff');
+}
+
+@font-face {
+  font-family: 'Open Sans';
+  font-style: normal;
+  font-weight: 400;
+  src: local('Open Sans'), local('OpenSans'), url('../lib/css/fonts/opensans.woff') format('woff');
+}
+
+@font-face {
+  font-family: 'Lato';
+  font-style: normal;
+  font-weight: 400;
+  src: local('Lato Regular'), local('Lato-Regular'), url('../lib/css/fonts/lato.woff') format('woff');
+}
+
+@font-face {
+  font-family: 'Cabin';
+  font-style: normal;
+  font-weight: 400;
+  src: local('Cabin Regular'), local('Cabin-Regular'), url('../lib/css/fonts/cabin.woff') format('woff');
+}
+
+@font-face {
+  font-family: 'Pacifico';
+  font-style: normal;
+  font-weight: normal;
+  src: local('Pacifico Regular'), local('Pacifico-Regular'), url('../lib/css/fonts/pacifico.woff') format('woff');
+}
+
+
+
+/*
+ *	lib/css/ui/list.css
+ */
+.hide {
+	display: none;
+}
+
+.list-filters {
+	margin: 7px 0px;
+}
+
+.wnlist .img-load {
+	display: none;
+	float: left;
+	margin-bottom: 8px;
+}
+
+/* list-row */
+div.list-row {
+	border-bottom: 1px solid #eee;
+	padding: 5px 0px;
+}
+
+div.list-row .label {
+	margin-right: 4px;
+}
+
+div.list-row table {
+	table-layout: fixed;
+	border-collapse: collapse;
+	width: 100%;
+}
+
+div.list-row table td {
+	overflow: hidden;
+	/*padding-right: 3px;*/
+	padding: 0px 3px;
+	vertical-align: middle;
+	height: 24px;
+	max-height: 24px;
+	word-wrap: break-word;
+}
+
+div.paging-button {
+	text-align: center;
+	padding: 11px 0px;
+}
+
+div.show_filters {
+	display: none;
+}
+
+div.filter_list {
+	padding: 13px;
+}
+
+div.show_filters.well {
+	margin-top: 11px;
+	margin-bottom: 11px;
+}
+
+div.filter_list .run_btn {
+	text-align: right;
+}
+
+div.filter_list .add_filter {
+	margin: 3px 0px;
+}
+
+div.list_filter {
+	margin: 7px 0px;
+}
+
+div.list_filter input, div.list_filter select {
+	width: 130px;
+	margin-right: 7px;
+}
+
+/* bar */
+
+span.bar-outer {
+	display: inline-block;
+	margin: 0px 7px;
+	margin-top: 3px;
+	background-color: #fff;
+	border: 1px solid #aaa;
+	height: 10px;
+}
+
+span.bar-inner {
+	display: inline-block;
+	background-color: #bdf;
+	height: 100%;
+	margin-bottom: 2px;
+	float: left;
+}
+span.bar-complete {
+	background-color: #009900;
+}
+span.bar-empty {
+	background-color: #990000;
+}
+
+
+/* stats */
+
+div.stat-wrapper {
+	margin-bottom: 19px;	
+}
+
+div.stat-grid {
+	border: 2px solid #bbb;
+	background-color: white;
+	border-radius: 5px;
+	-moz-border-radius: 5px;
+	-webkit-border-radius: 5px;
+	overflow: hidden;
+}
+
+div.stat-label {
+	position: relative;
+	padding: 3px;
+	text-align: center;
+}
+div.stat-label, div.stat-label a {
+	z-index: 5;
+}
+
+div.stat-item {
+	position: relative;
+	border-bottom: 1px solid #ddd;
+}
+div.stat-item:last-child {
+	border-bottom: 0px solid #ddd;	
+}
+
+div.stat-bar {
+	position: absolute;
+	left: 0px;
+	background-color: #def;
+	height: 100%;
+	z-index: 0;
+}
+
+
+
+
+
+/*
+ *	lib/css/ui/views.css
+ */
+
+.breadcrumbs {
+	color: #000000;
+}
+
+.breadcrumbs a {
+	color: #000000;
+}
+
+div.appframe-titlebar {
+	padding: 6px;
+	background: #eeeeee; /* Old browsers */
+	background: -moz-linear-gradient(top,  #eeeeee 0%, #cccccc 100%); /* FF3.6+ */
+	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */
+	background: -webkit-linear-gradient(top,  #eeeeee 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */
+	background: -o-linear-gradient(top,  #eeeeee 0%,#cccccc 100%); /* Opera 11.10+ */
+	background: -ms-linear-gradient(top,  #eeeeee 0%,#cccccc 100%); /* IE10+ */
+	background: linear-gradient(top,  #eeeeee 0%,#cccccc 100%); /* W3C */
+	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */
+	border-bottom: 1px solid #aaa;
+	min-height: 1.2em;
+}
+
+div.appframe-toolbar {
+	padding: 4px;
+	background: #eeeeee;
+	border-top: 1px solid #f8f8f8;
+	border-bottom: 1px solid #ccc;
+}
+
+/*
+ *	erpnext/startup/startup.css
+ */
+h1, h2, h3, h4, h5 {
+	font-family: "Helvetica Neue", "Open Sans", Helvetica, sans-serif;
+	margin-top: 0.2em;
+}
+
+body {
+	font-family: "Helvetica Neue", "Open Sans", Helvetica, sans-serif;
+	font-size: 13px;
 }
 
 span, div, td, input, textarea, button, select {
@@ -1574,7 +1897,12 @@
 }
 
 body {
-	background: url(../images/stripedbg.png) repeat;
+	background: url(../images/redbeech.jpg) repeat;
+	color: #616161;
+}
+
+.small {
+	font-size: 11.5px;
 }
 
 .erpnext-footer {
@@ -1582,25 +1910,6 @@
 	text-align: center;
 }
 
-.module-icons {
-   background: url(../images/module-icons.png) no-repeat top left;
-   width:16px;
-   height:16px;
-}
-
-.module-icons-accounts{ background-position: 0 0;  } 
-.module-icons-analysis{ background-position: 0 -66px;  } 
-.module-icons-buying{ background-position: 0 -132px;  } 
-.module-icons-home{ background-position: 0 -198px;  } 
-.module-icons-hr{ background-position: 0 -264px;  } 
-.module-icons-people{ background-position: 0 -330px;  } 
-.module-icons-production{ background-position: 0 -396px;  } 
-.module-icons-projects{ background-position: 0 -462px;  } 
-.module-icons-selling{ background-position: 0 -528px;  } 
-.module-icons-setup{ background-position: 0 -594px;  } 
-.module-icons-stock{ background-position: 0 -660px;  } 
-.module-icons-support{ background-position: 0 -726px;  } 
-
 .navbar-new-comments {
 	margin: -3px 0px;
 	padding: 2px;
@@ -1618,48 +1927,31 @@
 	color: #fff;
 }
 
-
 .navbar-new-comments-true {
 	color: #fff;
 	background-color: #B00D07;
 }
 
-.navbar-icon-home {
-	vertical-align: middle;
-	opacity:0.4;
-	Filter:alpha(opacity=40); /* For IE8 and earlier */
-}
-
-.navbar-icon-home:hover,
-.navbar-icon-home:focus,
-.navbar-icon-home:active,
-.navbar-icon-home-hover{
-	opacity:1;
-	Filter:alpha(opacity=100); /* For IE8 and earlier */
-}
-
 /*extra size menus for recent*/
 .dropdown-menu#toolbar-recent, .dropdown-menu#toolbar-options, .dropdown-menu#toolbar-help{
 	min-width: 160px !important;
 	max-width: 260px !important;
 }
 
+
 /*
  *	erpnext/website/css/website.css
- */.layout_wrapper {
-	padding: 20px;
+ */
+div#body_div, header .container, .content, #opened-page-selector, footer {
+	width: 900px;
 }
 
-h1 {
-	margin-bottom: 15px;
+.layout_wrapper {
+	padding: 27px;
 }
 
-h2 {
-	margin-bottom: 11px;
-}
-
-h3 {
-	margin-bottom: 7px;
+p, li {
+	line-height: 1.6em;
 }
 
 pre {
@@ -1694,6 +1986,7 @@
 	margin-right: 15px;
 	color: #606060;
 	overflow-x: hidden;
+	font-size: 90%;
 }
 
 .web-page-status {
@@ -1757,4 +2050,43 @@
 
 .web-footer-menu ul li:last-child {
 	border-right: 0px solid #777 !important;
-}
\ No newline at end of file
+}
+
+/* slide view */
+
+.next-slide {
+	margin: 0px -27px 100px -27px;
+	background: #ffffff; /* Old browsers */
+	background: -moz-linear-gradient(top,  #eeeeee 0%, #fff 100%); /* FF3.6+ */
+	background: -webkit-linear-gradient(top,  #eeeeee 0%, #fff 100%); /* Chrome10+,Safari5.1+ */
+	background: -o-linear-gradient(top,  #eeeeee 0%, #fff 100%); /* Opera 11.10+ */
+	background: -ms-linear-gradient(top,  #eeeeee 0%, #fff 100%); /* IE10+ */
+	background: linear-gradient(top,  #eeeeee 0%, #fff 100%); /* W3C */
+	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#fff',GradientType=0 ); /* IE6-9 */
+	height: 36px;
+}
+
+.slide-shadow {
+	background: #eeeeee; /* Old browsers */
+	background: -moz-linear-gradient(top,  #bababa 0%,#eeeeee 100%); /* FF3.6+ */
+	background: -webkit-linear-gradient(top,  #bababa 0%,#eeeeee 100%); /* Chrome10+,Safari5.1+ */
+	background: -o-linear-gradient(top,  #bababa 0%,#eeeeee 100%); /* Opera 11.10+ */
+	background: -ms-linear-gradient(top,  #bababa 0%,#eeeeee 100%); /* IE10+ */
+	background: linear-gradient(top,  #bababa 0%,#eeeeee 100%); /* W3C */
+	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#bababa', endColorstr='#eeeeee',GradientType=0 ); /* IE6-9 */	
+	height: 3px;
+	margin: 100px -27px 0px -27px;
+	border-top: 1px solid #bababa;
+}
+
+.two-column {
+	width: 40%;
+	float: left;
+	padding: 5%;
+}
+
+.clear {
+	clear: both;
+}
+
+/* */
diff --git a/css/style-app.css b/css/style-app.css
deleted file mode 100644
index f5447cf..0000000
--- a/css/style-app.css
+++ /dev/null
@@ -1,1850 +0,0 @@
-
-/*
- *	lib/css/legacy/body.css
- */html { 
-	margin: 0px;
-	padding: 0px;
-}
-
-body {	
-	margin: 0px;
-	padding: 0px;
-	font-family: Arial, Helvetica, Sans;
-	font-size: 12px;
-	color: #000;
-}
-
-/* heading from bootstrap */
-
-h1,
-h2,
-h3,
-h4,
-h5,
-h6 {
-  margin: 0;
-  font-weight: bold;
-  color: #333333;
-  text-rendering: optimizelegibility;
-  margin-bottom: 0.3em;
-}
-h1 small,
-h2 small,
-h3 small,
-h4 small,
-h5 small,
-h6 small {
-  font-weight: normal;
-  color: #999999;
-}
-h1 {
-  font-size: 30px;
-  line-height: 36px;
-}
-h1 small {
-  font-size: 18px;
-}
-h2 {
-  font-size: 24px;
-  line-height: 36px;
-}
-h2 small {
-  font-size: 18px;
-}
-h3 {
-  line-height: 27px;
-  font-size: 18px;
-}
-h3 small {
-  font-size: 14px;
-}
-h4, h5, h6 {
-  line-height: 18px;
-}
-h4 {
-  font-size: 14px;
-}
-h4 small {
-  font-size: 12px;
-}
-h5 {
-  font-size: 12px;
-}
-h6 {
-  font-size: 11px;
-  color: #999999;
-  text-transform: uppercase;
-}
-
-pre { margin: 0px; padding: 0px; }
-
-button { margin: 2px; margin-left: 0px; }
-
-label {
-	padding-top: 15px;
-	color: #404040;
-}
-
-select, input, textarea { 
-	border: 1px solid #AAA; 
-	-moz-border-radius: 4px;
-	-webkit-border-radius: 4px;
-	font-size: 13px;
-	padding: 4px;
-	color: #222;
-}
-
-textarea { 
-	font-family: inherit; 
-	height: 120px; 
-	width: 90%; 
-	font-size: 12px; 
-	white-space: normal;
-}
-
-table { padding: 0px; border-collapse: 'collapse'}
-
-td { 
-	padding:0px; 
-	margin: 0px; 
-	vertical-align: top; 
-}
-
-p {
-	margin: 0px 0px 9px 0px;
-	line-height: 1.5em;
-}
-
-li {
-	line-height: 1.5em;
-}
-
-a:active { outline:none; }
-
-:focus { -moz-outline-style:none; }
-
-table.simpletable { border-collapse: collapse; margin-bottom: 10px;}
-table.simpletable td {border: 1pt solid #000; vertical-align: top; padding: 2px; }
-
-div.fix_ff_cursor { overflow: auto; }
-
-/* --- Layout --- */
-
-div.comment { color: #444; }
-
-div#body_div {
-	position: relative;
-	display: none;
-	margin-top: 56px;
-	padding-right: 7px;
-}
-
-div.no_script {
-	display: none;
-}
-
-div.loading_div {
-	position: absolute;
-	background-color: #FFFFCC;
-	z-index: 1999;
-	right: 5px;
-	width: 90px;
-	display: none;
-	text-align: center;
-	padding: 2px;
-	font-size: 12px;
-	border: 1px solid #FF4;
-}
-
-
-div#head_div { background-color: #FFF; }
-
-#head_banner { background-color: #FFF; }
-
-.link_type {
-	padding:2px;
-	color: #00b;
-	text-decoration: underline;
-	cursor: pointer;
-}
-
-.link_type:hover {
-	color: #fff !important; 
-	background-color: #07b;
-	text-decoration: none;
-}
-
-div.std-footer {
-	margin: 13px 0px;
-	border-top: 1px solid #AAA;
-	padding: 13px;
-}
-
-div.std-footer-item {
-	margin: 0px 13px 13px 0px;
-}
-
-.shadow {
-	-moz-box-shadow: 0px 2px 2px #888;
-	-webkit-box-shadow: 0px 2px 2px #888;
- 	box-shadow: 0px 2px 2px #888;
-}
-
-.round {
-	-webkit-border-radius: 5px;
-	-moz-border-radius: 5px;
-	border-radius: 5px;	
-}
-.gradient {
-	background: #ededed; /* Old browsers */
-	background: -moz-linear-gradient(top, #ededed 0%, #d1d1d1 47%, #b7b7b7 100%); /* FF3.6+ */
-	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ededed), color-stop(47%,#d1d1d1), color-stop(100%,#b7b7b7)); /* Chrome,Safari4+ */
-	background: -webkit-linear-gradient(top, #ededed 0%,#d1d1d1 47%,#b7b7b7 100%); /* Chrome10+,Safari5.1+ */
-	background: -o-linear-gradient(top, #ededed 0%,#d1d1d1 47%,#b7b7b7 100%); /* Opera11.10+ */
-	background: -ms-linear-gradient(top, #ededed 0%,#d1d1d1 47%,#b7b7b7 100%); /* IE10+ */
-	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ededed', endColorstr='#b7b7b7',GradientType=0 ); /* IE6-9 */
-	background: linear-gradient(top, #ededed 0%,#d1d1d1 47%,#b7b7b7 100%); /* W3C */	
-}
-
-.header-gradient {
-	background: #84827c; /* Old browsers */
-	background: -moz-linear-gradient(top, #84827c 0%, #27211c 100%); /* FF3.6+ */
-	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#84827c), color-stop(100%,#27211c)); /* Chrome,Safari4+ */
-	background: -webkit-linear-gradient(top, #84827c 0%,#27211c 100%); /* Chrome10+,Safari5.1+ */
-	background: -o-linear-gradient(top, #84827c 0%,#27211c 100%); /* Opera11.10+ */
-	background: -ms-linear-gradient(top, #84827c 0%,#27211c 100%); /* IE10+ */
-	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#84827c', endColorstr='#27211c',GradientType=0 ); /* IE6-9 */
-	background: linear-gradient(top, #84827c 0%,#27211c 100%); /* W3C */
-	color: #FFF;
-}
-
-.layout_wrapper {
-	padding: 15px;
-	-moz-box-shadow: 1px 1px 6px #AAA;
-	-webkit-box-shadow: 1px 1px 6px #AAA;
-	box-shadow: 1px 1px 6px #AAA;
-	background-color: #FFF;
-}
-
-/* from bootstrap */
-.container {
-  margin-left: auto;
-  margin-right: auto;
-  zoom: 1;
-}
-.container:before, .container:after {
-  display: table;
-  content: "";
-  zoom: 1;
-}
-.container:after {
-  clear: both;
-}
-
-/*
- *	lib/css/legacy/menus.css
- */
-/******** Menus - menu.js ************/
-
-ul.menu_toolbar {
-	z-index: 30;
-	padding: 0px;
-	margin: 0px;
-	margin-top: 1px;
-}
-
-ul.menu_toolbar li {
-	list-style: none;
-	margin: 0px;
-	float: left;
-}
-
-.top_menu {
-	margin: 0px;
-	padding: 4px;
-	cursor: pointer;
-	color: #FFF;
-	margin-right: 8px;
-}
-
-.top_menu_mo {
-	background-color: #000;
-
-	-moz-border-radius: 5px;
-	-webkit-border-radius: 5px;
-}
-
-div.menu_toolbar_dropdown {
-	position: absolute;
-	margin-top: 4px;
-	margin-left: 8px;
-	width: 140px;
-	background-color: #FFF;
-	color: #000;
-	display: none;
-	border: 2px solid #333;
-	z-index: 31;
-	overflow-y: auto;
-	overflow-x: hidden;
-}
-
-div.dd_item {
-	cursor: pointer;
-	padding: 4px;
-	background-color: #FFF;
-}
-div.dd_item_mo { background-color: #FE8; }
-/*
- *	lib/css/legacy/messages.css
- */
-/* FLOATING MESSAGE */
-
-.btn-img { cursor: pointer; }
-
-div.fetching { color: #888; text-align:right; }
-
-div.notice {
-	postion: absolute;
-	background-color: #000;
-	-moz-border-radius: 5px; -webkit-border-radius: 5px;
-	opacity: 0.6;
-	right: 0;
-	top: 0;
-	margin-top: 8px;
-	z-index: -1;
-	padding: 8px;
-}
-
-/** help **/
-
-.info-box {
-    background-color: #F8F8F8;
-    border: 1px solid #CCCCCC;
-    border-radius: 3px 3px 3px 3px;
-    line-height: 1.6em;
-    overflow: auto;
-    padding: 6px 10px;
-	margin-bottom: 9px;
-}
-
-.help_box, .help-box {
-	background-color:#FFC;
-	font-size: 13px;
-	color: #864;
-	padding: 7px;
-	margin: 11px 0px;
-	border: 1px solid #EEB;
-}
-
-.help_box_big {
-	background-color:#FFC;
-	color: #864;
-	padding: 7px;
-	margin: 7px 0px;
-	border: 1px solid #EEB;
-	text-align: center;
-	font-size: 14px;
-}
-/*
- *	lib/css/legacy/forms.css
- *//* FORMS */
-
-
-div.frm_print_wrapper {
-	background-color:#FFF;
-	border:1px solid #444;
-	padding: 40px;
-
-	box-shadow:1px 1px 8px #229;
-	-moz-box-shadow: 1px 1px 8px #229;
-	-webkit-box-shadow: 1px 1px 8px #229;
-}
-
-div.page_break {
-	margin: 24px 0px;
-	border-top: 1px dashed #888;
-}
-
-div.grid_tbarlinks {
-	border-bottom: 0px;
-	background-color: #CCC;
-	padding: 4px 4px 2px 4px;
-	width: 180px;
-	float: right;
-
-	-moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px;
-	-webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px;
-}
-
-
-div.frm_tip_box {
-	margin: 0px;
-	padding: 8px;
-	background-color: #FFC;
-	display: none;
-	font-size: 11px;
-	border: 1px solid #FFB;
-}
-
-div.frm_tip_box table {
-	border-collapse: collapse;
-	vertical-align: top;
-}
-
-td.frm_tray_area {
-	width: 122px;
-}
-
-div.dialog_frm {
-	position: relative;
-	margin: 10px;
-}
-
-
-
-/*------------------*/
-
-.top_cell {
-	height: 50px;
-}
-
-div.attach_area {
-	padding: 8px;
-	margin: 8px;
-	background-color: #EEE;
-}
-
-div.attach_area table {
-	width: 100%;
-}
-
-.tablabel_normal {
-	margin: 0 4px 0 0;
-	padding: 3px 5px;
-	line-height: 1.3em;
-	display: inline;
-	cursor: pointer;
-}
-
-.tablabel_selected {
-	margin: 0 4px 0 0;
-	padding: 3px 5px;
-	line-height: 1.3em;
-	font-weight: bold;
-	display: inline;
-	cursor: pointer;
-	color: #000;
-}
-
-.scrollhead_wrapper {
-	position: absolute;
-	z-index: 1;
-	height: 30px;
-}
-
-.treeimg {
-	cursor: pointer;
-	margin-right: 3px;
-}
-
-
-.sectionCell {
-	padding: 5px;
-	vertical-align: top;
-}
-
-.code_area {
-	width: 80%;
-	margin: 8px;
-	padding: 4px;
-	background-color: #F8F8F8;
-	border: 1px solid #CCC;
-	overflow-x: auto;
-}
-
-.code_text {
-	width: 100%;
-	height: 360px;
-	margin-top: 3px;
-	font-family: Courier, Fixed;
-	font-size: 12px;
-}
-
-div.time_field select{
-	display: inline;
-	margin: 2px;
-	width: 45px;
-}
-
-/* Documents */
-
-.frm_field_table {
-        width: 100%;
-        border-collapse: collapse;
-}
-
-.datalabelcell { 
-        padding: 2px 0px; 
-        width: 160px; 
-        vertical-align: top; 
-}
-.datainputcell { padding: 2px 0px; }
-
-
-.field_description, .help {
-	margin: 3px 0px 11px 0px;
-	color: #888;
-	font-style: italic;
-}
-
-.field_description_top {
-	margin-bottom: 3px;
-}
-
-.field_label {
-	font-size:11px;
-}
-.input_area input, select, textarea { 
-	font-size: 14px;
-	padding: 2px;
-}
-
-.input_area input { 
-	width: 80%; 
-	margin: 0px; 
-}
-.input_area select { 
-	width: 80%; 
-}
-.input_area textarea { 
-	width: 90%; 
-}
-
-.disp_area { 
-	width: 80%; 
-	padding: 2px 0px; 
-	font-size: 12px; 
-}
-.disp_area_no_val { 
-	height: 14px; 
-}
-
-.no_img {
-	padding: 40px;
-	width: 100px;
-	height: 20px;
-	color: #888;
-	text-align: center;
-	border: 1px solid #AAA;
-}
-
-.input-mandatory {
-	font-size: 14px !important;
-	font-weight: bold;
-}
-
-.field-to-update {
-	background-color:#FEE;
-}
-
-/* sidebar */
-
-div.sidebar-comment-wrapper input {
-	width: 50%;
-}
-div.sidebar-comment-message {
-	margin-top: 8px;
-	font-size: 11px;
-	color: #777;
-}
-
-div.sidebar-comment-text {
-	font-size: 12px;
-	font-weight: bold;
-	margin-top: 8px;
-	color: #444;
-}
-div.sidebar-comment-info {
-	font-size: 10px;
-	color: #777;
-}
-/*
- *	lib/css/legacy/grid.css
- */
-
-/* Grid */
-
-
-/* --- Simple --- */
-.grid_wrapper_simple {
-	width: 100%;
-	margin-bottom: 8px;
-	border: 1px solid #AA9;
-}
-
-.grid_head_wrapper_simple {
-	padding: 0px;
-	border-bottom: 2px solid #AAA;
-}
-
-.grid_head_wrapper_simple td {
-	border-right: 1px solid #AA9;
-}
-
-.grid_head_wrapper_simple td div {
-	padding: 2px;
-}
-
-.grid_tab_wrapper_simple {
-}
-
-.grid_cell_simple {
-	padding: 2px;
-	background-color: #fff;
-	border-right: 1px solid #AA9;
-}
-
-
-/* --- Normal --- */
-.grid_wrapper {
-	position: relative;
-	overflow: auto;
-	border: 1px solid #AAA;
-	width: 100%;
-	margin-bottom: 8px;
-	background-color: #fff;	
-}
-
-.grid_tab_wrapper {
-	position: absolute;
-	top: 40px;
-	border-bottom: 1px solid #DDD;
-}
-
-.grid_table, .grid_head_table  {
-	table-layout: fixed;
-	border-collapse: collapse;
-	/*width: 100%;*/
-}
-
-.grid_cell {
-	border-right: 1px solid #ddd;
-	padding: 0px;
-	background-color: #fff;
-}
-
-.grid_head_wrapper {
-	position: absolute;
-	z-index: 1;
-	height: 40px;
-	padding: 0px;
-	overflow: hidden;
-	/*background-color: #fff;*/
-}
-
-.grid_head_table td {
-	background-color: #EEE;
-	border-right: 1px solid #AAA;
-	border-bottom: 1px solid #AAA;
-	height: 40px;
-	padding: 0px;
-}
-
-.grid_head_table td div {
-	color: #222;
-	font-weight: bold;
-	overflow: hidden;
-	padding: 2px 0px;
-	text-align: center;	
-}
-
-.grid_selector {
-	padding: 1px;
-	border-right: 1px solid #DDD;
-	width: 20px;
-	background-color: #fff;
-}
-
-.grid_cell_div {
-	padding: 2px;
-	cursor: pointer;
-	overflow: hidden;
-	border: 2px solid #FFF;
-}
-
-.grid_cell_div_selected {
-	border: 2px solid #88f;
-}
-
-.grid_cell_div input, .grid_cell_div select, .grid_cell_div div input {
-	margin: 0px;
-	border: 0px;
-	width: 100%;
- 	margin: 0px;
- }
-
-.grid_cell_div textarea {
-	border: 3px solid #abf;
-	height:200px;
-	width: 300px;
-	z-index: 10;
-	position:absolute;
-}
-
-.gridDivSelected option { border: 0px; }
-/*
- *	lib/css/legacy/listing.css
- *//* listing 2.0 */
-
-div.listing-more {
-	margin: 7px 0px 17px 0px;
-	text-align: center;
-	display: none;
-}
-
-div.listing-toolbar {
-	margin: 7px 0px;
-}
-
-/* SRS */
-
-table.srs_result_tab {
-	border: 2px solid #AAA;
-	border-collapse: collapse;
-}
-
-/* firefox bug fix for disappering borders */
-table.srs_result_tab td, table.srs_result_tab tr, table.srs_result_tab tbody, table.srs_result_tab div {
-	position: static;
-}
-
-table.srs_result_tab td {
-	padding: 3px 2px;
-	position: static;
-}
-
-div.srs_body_area {
-}
-
-div.srs_results_area {
-}
-
-div.srs_filter_wrapper {
-	border: 1px solid #CCF;
-	
-	background-color: #EEF;
-	margin:0px 0px 8px 0px;
-
-	-moz-border-radius: 5px;
-	-webkit-border-radius: 5px;
-	border-radius: 5px;
-}
-
-div.srs_filter_area {
-	padding: 8px;
-}
-
-div.srs_filter_area td {
-	vertical-align: middle;
-}
-
-
-
-
-/*
- *	lib/css/legacy/report.css
- */
-/* Reports */
-
-div.report_grid_area {
-	position: relative;
-	padding: 8px;
-}
-
-
-div.report_tab { 
-	border: 1px solid #AAA; 
-	position: relative; 
-	overflow: auto; 
-}
-
-div.report_no_data {
-	padding: 8px;
-	background-color: #EEE;
-	border: 1px solid #DDD;
-	position: absolute;
-	margin-left: 40%;
-	margin-top: 50px;
-	display: none;	
-}
-
-div.report_htitle {
-	float: left;
-	padding: 2px;
-	font-size: 14px;
-	font-weight: bold;
-	margin-left: 4px;
-	color: #665;
-	/*font-weight: bold;*/
-}
-
-div.report_tbar {
-	/*background: url('../images/ui/blue-back.gif') repeat-x;	*/
-	background-color: #EEF;
-	border: 1px solid #CCF;
-	border-bottom: 0px;
-	height: 28px;
-}
-
-div.report_tbar table{
-	width: 100%;
-}
-div.report_tbar table td {
-	
-}
-div.report_tbar table td div {
-	position: relative;
-}
-div.report_tbar button, div.report_tbar select, div.report_tbar img {
-	font-size: 11px;
-	margin: 0px;
-}
-
-div.report_head_wrapper {
-	position: absolute;
-	height: 24px;
-	top: 0px;
-	z-index: 1;
-}
-
-div.report_tab_wrapper {
-	position: absolute;
-	border-bottom: 1px solid #AAA;
-	border-top: 1px solid #AAA;
-}
-
-div.report_tab_wrapper table, div.report_head_wrapper table {
-	table-layout: fixed;
-	border-collapse: collapse;
-	/*width: 100%;*/
-}
-
-div.report_tab_wrapper table td, div.report_head_wrapper table td {
-	border-left: 1px solid #AAA;
-	border-right: 1px solid #AAA;
-	border-bottom: 1px solid #AAA;
-	overflow: hidden;
-	padding: 0px;
-}
-
-div.report_tab_wrapper table td div, div.report_head_wrapper table td div {
-	padding: 3px;
-	overflow: hidden;
-}
-
-.report_head_cell {
-	background-color: #EEE;
-	border-bottom: 1px solid #AA9;
-	text-align: center;
-	font-weight: bold;
-}
-.report_head_cell div {
-	color:#222; 
-	height: 18px;
-}
-
-
-/* FINDER */
-
-div.finder_wrapper {
-}
-
-div.finder_body_area {
-	margin: 16px;
-}
-
-div.finder_body {
-	display: none;
-}
-
-div.finder_advanced_area table {
-	width: 80%;
-}
-
-div.finder_advanced_area textarea {
-	width: 80%;
-}
-
-div.finder_filter_area {
-	position: relative;
-}
-
-div.filter_head {
-	font-size: 14px;
-	margin-bottom: 2px;
-}
-div.filter_dt_head {
-	font-size: 14px;
-	font-weight: bold;
-	margin-bottom: 2px;
-}
-table.filter_tab {
-	width: 96%;
-	border-collapse: collapse;
-}
-
-table.filter_tab td {
-	width: 50%;
-}
-
-div.finder_picker_area {
-	
-}
-div.builder_field {
-	margin: 0px;
-}
-div.builder_dt_head {
-	font-size: 14px;
-	font-weight: bold;
-	margin-bottom: 2px;
-}
-
-div.builder_field table {
-	width: 90%;
-	border-collapse: collapse;
-}
-
-div.builder_label {
-	height: 20px;
-}
-
-div.builder_head {
-	font-size: 16px;
-	font-weight: bold;
-	color: #AB6;
-}
-
-table.builder_tab {
-	width: 96%;
-	border-collapse: collapse;
-}
-
-table.builder_tab td {
-	width: 33%;
-	padding: 2px;
-}
-/*
- *	lib/css/legacy/calendar.css
- *//**** CALENDAR ****/
-
-.caldiv {
-	position:absolute;
-	visibility:hidden;
-	background-color:white;
-	width: 144px;
-	z-index: 301; /* always on top(?) */
-}
-
-
-	
-div.cal_wrapper { }
-div.cal_body {
-	margin: 16px;
-	background-color: #DDD;
-	position: relative;
-	border-radius: 5px;
-	-moz-border-radius: 5px;
-	-webkit-border-radius: 5px;	
-}
-
-div.cal_head {
-	margin: 16px;
-	margin-bottom: 0px;
-}
-div.cal_head div {
-	font-size: 18px;
-	color: #666;
-	padding-top: 8px;
-}
-
-div.cal_view_body {
-	margin: 16px;
-}
-
-div.cal_view_body_plain {
-	margin: 16px;
-}
-
-div.cal_month_head {
-}
-
-div.cal_month_body {
-	border-top: 1px solid #888;
-}
-
-.cal_month_headtable {
-	/*table-layout:fixed;*/
-	width: 100%;
-}
-
-.cal_month_name {
-	width: 100%;
-	color: #888;
-	font-size: 14px;
-	font-weight: bold;
-	text-align: center;
-	padding: 4px;
-}
-
-.cal_month_headtable tr td{
-	font-size: 12px;
-	font-weight: bold;
-	text-align: center;
-	padding: 4px;
-}
-
-table.cal_month_table {
-	border-collapse: collapse;
-	/*table-layout:fixed;*/
-	height: 100%;
-	width: 100%;
-}
-
-table.cal_month_table td {
-	width: 14.29%;
-	height: 20%;
-	/*overflow:hidden;*/
-	padding:0px;
-}
-
-div.cal_month_date {
-	width:100%;
-	height:25%;
-	font-size: 10px;
-	overflow:hidden;
-	/*background-color: #EEF;*/
-}
-
-div.cal_month_date_holiday {
-	/*background-color: #FFF;*/
-}
-
-div.cal_month_unit {
-	width:100%;
-	height:75%;
-	overflow:hidden;
-	cursor:pointer;
-	/*background-color:#FFF;*/
-}
-	
-div.cal_vu_disabled {
-	background-color:#FFF;
-	cursor:default;
-}
-
-table.cal_day_table {
-	border-collapse: collapse;
-	width: 100%;
-}
-
-table.cal_day_table td {
-}
-
-div.cal_day_body {
-	width: 100%;
-	height: 80%;
-	overflow-y: auto;
-	overflow-x: hidden;
-	border-top: 1px solid #AAA;
-}
-
-div.cal_day_unit{
-	width:100%;
-	cursor:pointer;
-}
-
-table.cal_week_table {
-	border-collapse: collapse;
-	width: 100%;
-}
-
-table.cal_week_table td {
-	width: 12.5%;
-}
-
-div.cal_week_body {
-	width: 100%;
-	height: 80%;
-	overflow-y: auto;
-	overflow-x: hidden;
-	border-top: 1px solid #888;
-}
-
-div.cal_week_unit{
-	width: 100%;
-	cursor:pointer;
-}
-
-div.cal_event {
-	width: 100%;
-	height: 12px;
-	overflow: hidden;
-	font-size: 11px;
-	color: #00B;
-	margin-bottom: 2px;
-	text-decoration: underline;
-}
-
-div.cal_event_Public {
-	color: GREEN;
-}
-
-div.cal_event_Private {
-	color: BLUE;
-}
-
-div.cal_event_hover {
-	text-decoration: underline;
-}
-
-/*
- *	lib/css/legacy/autosuggest.css
- *//* 
-================================================
-autosuggest, inquisitor style
-================================================
-*/
-
-div.autosuggest
-{
-	position: absolute; 
-	margin-top: 3px; 
-	border: 1px solid #222;
-}
-
-div.autosuggest ul
-{
-	list-style: none;
-	margin: 0px;
-	padding: 2px;
-	overflow: hidden;
-	background-color: #FFF;
-}
-
-div.autosuggest ul li
-{
-	color: #444;
-	padding: 0;
-	margin: 0;
-	text-align: left;
-}
-
-div.autosuggest ul li a
-{
-	color: #444;
-	display: block;
-	text-decoration: none;
-	position: relative;
-	padding: 0;
-	width: 100%;
-}
-div.autosuggest ul li a:hover
-{
-
-}
-div.autosuggest ul li.as_highlight a:hover
-{
-	background-color: #45A;
-	color: #FFF;
-}
-
-div.autosuggest ul li a span
-{
-	display: block;
-	padding: 3px 6px;
-	color: #444;
-	border-bottom:1px solid #DDD;
-}
-
-div.autosuggest ul li a span small
-{
-	display: block;
-	font-weight: normal;
-	color: #444;
-}
-
-div.autosuggest ul li.as_highlight a span small
-{
-	color: #FFF;
-}
-
-div.autosuggest ul li.as_highlight a span {
-	color: #FFF;	
-}
-
-div.autosuggest ul li.as_highlight a
-{
-	color: #FFF;
-	background-color: #45A;
-	cursor: pointer;
-}
-
-div.autosuggest ul li.as_warning
-{
-	font-weight: bold;
-	text-align: center;
-}
-
-div.autosuggest ul em
-{
-	font-style: normal;
-	font-weight: bold;
-}
-
-/*
- *	lib/css/legacy/dialog.css
- *//***** Dialogs *******/
-
-div.dialog_wrapper {
-	position: absolute;
-	width: 440px;
-	display: none;
-	z-index: 90;
-	background-color: #FFF;
-	border: 3px solid #222;
-	box-shadow:1px 1px 5px #777;
-	-moz-box-shadow: 1px 1px 5px #777;
-	-webkit-box-shadow: 1px 1px 5px #777;
-	
-	border-radius: 5px;
-	-moz-border-radius: 5px;
-	-webkit-border-radius: 5px;	
-}
-
-div.dialog_head {
-	height: 22px;
-	padding: 4px;
-	background-color: #222;
-	color: #FFF;
-}
-
-div.dialog_body {
-	padding: 8px 4px 16px 4px;
-	border-radius: 5px;
-	-moz-border-radius: 5px;
-	-webkit-border-radius: 5px;	
-}
-
-div.dialog_back {
-	position: fixed;
-	display: none;
-	top: 0px;
-	left: 0px;
-	bottom: 0px;
-	right: 0px;
-	background-color: #EEE;
-	opacity: 0.6;
-	z-index: 50;
-	text-align: center;
-}
-
-div.dialog_message {
-	display: none;
-	position: absolute;
-	width: 250px;
-	font-size: 12px;
-	z-index: 91;
-	background-color:#FFF;
-	padding: 12px;
-	border: 1px solid #444;
-}
-
-div.dialog_row {
-	padding: 8px 8px 0px 8px;
-}
-
-div.dialog_row table {
-	width: 100%;
-}
-
-div.dialog_row table td {
-}
-
-div.dialog_row input[type="text"], div.dialog_row input[type="password"], div.dialog_row textarea, div.dialog_row select {
-	width: 80%;
-	font-size: 14px;
-}
-
-div.dialog_row table td textarea {
-	width: 80%;
-	height: 200px;
-	font-size: 12px;
-}
-
-/*
- *	lib/css/legacy/tabs.css
- */
-/******* TABS ********/
-
-div.box_label_wrapper {
-	border-bottom: 6px solid #777;
-}
-
-div.box_label_body {
-	height: 22px;
-}
-
-ul.box_tabs {
-	margin: 0px;
-	padding: 0px;
-	list-style: none;
-}
-
-ul.box_tabs li {
-	height: 22px;
-	float:left;
-	font-size: 12px;
-	text-decoration: underline;
-	
-	background-color: #DDD;
-	
-	margin:0;
-	margin-left: 4px;
-	padding:0 0 0 9px;
-	cursor: pointer;
-}
-
-ul.box_tabs a {
-	display:block;
-	padding:3px 15px 3px 6px;
-	text-decoration:none;
-}
-
-ul.box_tabs li.box_tab_mouseover {
-	background-color: #BBB;
-}
-
-
-ul.box_tabs li.box_tab_selected {
-/*	background:url("../images/ui/rc/tab-left-CCC.gif") no-repeat left top;
-	background-color: #ABABAB; */
-	
-	background-color: #777;
-	
-	background: -webkit-gradient(linear, left top, left bottom, from(#999), to(#777));
-	background: -moz-linear-gradient(top, #999, #777);
-		
-	color: #FFF;
-	font-weight:bold;
-	
-}
-ul.box_tabs li.box_tab_selected a {
-/*	background:url("../images/ui/rc/tab-right-CCC.gif") no-repeat right top; */
-}
-
-/*
- *	lib/css/legacy/bw-icons.css
- */
-/** general icons **/
-
-.wn-icon { background: url('lib/images/icons/icons.png'); width: 16px; height: 16px; cursor: pointer; }
-.ic-2x2_grid { background-position: 0 0;  } 
-.ic-3x3_grid { background-position: 0 -36px;  } 
-.ic-3x3_grid_2 { background-position: 0 -72px;  } 
-.ic-air_signal { background-position: 0 -108px;  } 
-.ic-align_center { background-position: 0 -144px;  } 
-.ic-align_just { background-position: 0 -180px;  } 
-.ic-align_left { background-position: 0 -216px;  } 
-.ic-align_right { background-position: 0 -252px;  } 
-.ic-app_window { background-position: 0 -288px;  } 
-.ic-arrow_bottom { background-position: 0 -324px;  } 
-.ic-arrow_bottom_left { background-position: 0 -360px;  } 
-.ic-arrow_bottom_right { background-position: 0 -396px;  } 
-.ic-arrow_l { background-position: 0 -432px;  } 
-.ic-arrow_left { background-position: 0 -468px;  } 
-.ic-arrow_r { background-position: 0 -504px;  } 
-.ic-arrow_right { background-position: 0 -540px;  } 
-.ic-arrow_top { background-position: 0 -576px;  } 
-.ic-arrow_top_left { background-position: 0 -612px;  } 
-.ic-arrow_top_right { background-position: 0 -648px;  } 
-.ic-arrow_two_head { background-position: 0 -684px;  } 
-.ic-arrow_two_head_2 { background-position: 0 -720px;  } 
-.ic-attention { background-position: 0 -756px;  } 
-.ic-battery { background-position: 0 -792px;  } 
-.ic-bell { background-position: 0 -828px;  } 
-.ic-book { background-position: 0 -864px;  } 
-.ic-bookmark_1 { background-position: 0 -900px;  } 
-.ic-bookmark_2 { background-position: 0 -936px;  } 
-.ic-box { background-position: 0 -972px;  } 
-.ic-br_down { background-position: 0 -1008px;  } 
-.ic-br_next { background-position: 0 -1044px;  } 
-.ic-br_prev { background-position: 0 -1080px;  } 
-.ic-br_up { background-position: 0 -1116px;  } 
-.ic-brackets { background-position: 0 -1152px;  } 
-.ic-browser { background-position: 0 -1188px;  } 
-.ic-brush { background-position: 0 -1224px;  } 
-.ic-bug { background-position: 0 -1260px;  } 
-.ic-burst { background-position: 0 -1296px;  } 
-.ic-calc { background-position: 0 -1332px;  } 
-.ic-calendar_1 { background-position: 0 -1368px;  } 
-.ic-calendar_2 { background-position: 0 -1404px;  } 
-.ic-cancel { background-position: 0 -1440px;  } 
-.ic-case { background-position: 0 -1476px;  } 
-.ic-cc { background-position: 0 -1512px;  } 
-.ic-cert { background-position: 0 -1548px;  } 
-.ic-chart_bar { background-position: 0 -1584px;  } 
-.ic-chart_line { background-position: 0 -1620px;  } 
-.ic-chart_line_2 { background-position: 0 -1656px;  } 
-.ic-chart_pie { background-position: 0 -1692px;  } 
-.ic-checkbox_checked { background-position: 0 -1728px;  } 
-.ic-checkbox_unchecked { background-position: 0 -1764px;  } 
-.ic-checkmark { background-position: 0 -1800px;  } 
-.ic-clip { background-position: 0 -1836px;  } 
-.ic-clipboard_copy { background-position: 0 -1872px;  } 
-.ic-clipboard_cut { background-position: 0 -1908px;  } 
-.ic-clipboard_past { background-position: 0 -1944px;  } 
-.ic-clock { background-position: -36px 0;  } 
-.ic-cloud { background-position: -36px -36px;  } 
-.ic-cloud_rain { background-position: -36px -72px;  } 
-.ic-cog { background-position: -36px -108px;  } 
-.ic-comp { background-position: -36px -144px;  } 
-.ic-compass { background-position: -36px -180px;  } 
-.ic-contact_card { background-position: -36px -216px;  } 
-.ic-cube { background-position: -36px -252px;  } 
-.ic-cur_bp { background-position: -36px -288px;  } 
-.ic-cur_dollar { background-position: -36px -324px;  } 
-.ic-cur_euro { background-position: -36px -360px;  } 
-.ic-cur_yen { background-position: -36px -396px;  } 
-.ic-cursor_H_split { background-position: -36px -432px;  } 
-.ic-cursor_V_split { background-position: -36px -468px;  } 
-.ic-cursor_arrow { background-position: -36px -504px;  } 
-.ic-cursor_drag_arrow { background-position: -36px -540px;  } 
-.ic-cursor_drag_arrow_2 { background-position: -36px -576px;  } 
-.ic-cursor_drag_hand { background-position: -36px -612px;  } 
-.ic-cursor_hand { background-position: -36px -648px;  } 
-.ic-db { background-position: -36px -684px;  } 
-.ic-delete { background-position: -36px -720px;  } 
-.ic-doc_delete { background-position: -36px -756px;  } 
-.ic-doc_edit { background-position: -36px -792px;  } 
-.ic-doc_empty { background-position: -36px -828px;  } 
-.ic-doc_export { background-position: -36px -864px;  } 
-.ic-doc_import { background-position: -36px -900px;  } 
-.ic-doc_lines { background-position: -36px -936px;  } 
-.ic-doc_lines_stright { background-position: -36px -972px;  } 
-.ic-doc_minus { background-position: -36px -1008px;  } 
-.ic-doc_new { background-position: -36px -1044px;  } 
-.ic-doc_plus { background-position: -36px -1080px;  } 
-.ic-document { background-position: -36px -1116px;  } 
-.ic-download { background-position: -36px -1152px;  } 
-.ic-emotion_sad { background-position: -36px -1188px;  } 
-.ic-emotion_smile { background-position: -36px -1224px;  } 
-.ic-expand { background-position: -36px -1260px;  } 
-.ic-eye { background-position: -36px -1296px;  } 
-.ic-eye_inv { background-position: -36px -1332px;  } 
-.ic-facebook { background-position: -36px -1368px;  } 
-.ic-filter { background-position: -36px -1404px;  } 
-.ic-fire { background-position: -36px -1440px;  } 
-.ic-flag { background-position: -36px -1476px;  } 
-.ic-folder { background-position: -36px -1512px;  } 
-.ic-folder_arrow { background-position: -36px -1548px;  } 
-.ic-folder_delete { background-position: -36px -1584px;  } 
-.ic-folder_minus { background-position: -36px -1620px;  } 
-.ic-folder_open { background-position: -36px -1656px;  } 
-.ic-folder_plus { background-position: -36px -1692px;  } 
-.ic-font_bold { background-position: -36px -1728px;  } 
-.ic-font_italic { background-position: -36px -1764px;  } 
-.ic-font_size { background-position: -36px -1800px;  } 
-.ic-font_strokethrough { background-position: -36px -1836px;  } 
-.ic-font_underline { background-position: -36px -1872px;  } 
-.ic-game_pad { background-position: -36px -1908px;  } 
-.ic-globe_1 { background-position: -36px -1944px;  } 
-.ic-globe_2 { background-position: -72px 0;  } 
-.ic-globe_3 { background-position: -72px -36px;  } 
-.ic-google { background-position: -72px -72px;  } 
-.ic-hand_1 { background-position: -72px -108px;  } 
-.ic-hand_2 { background-position: -72px -144px;  } 
-.ic-hand_contra { background-position: -72px -180px;  } 
-.ic-hand_pro { background-position: -72px -216px;  } 
-.ic-headphones { background-position: -72px -252px;  } 
-.ic-heart { background-position: -72px -288px;  } 
-.ic-heart_empty { background-position: -72px -324px;  } 
-.ic-home { background-position: -72px -360px;  } 
-.ic-image_text { background-position: -72px -396px;  } 
-.ic-inbox { background-position: -72px -432px;  } 
-.ic-indent_decrease { background-position: -72px -468px;  } 
-.ic-indent_increase { background-position: -72px -504px;  } 
-.ic-info { background-position: -72px -540px;  } 
-.ic-iphone { background-position: -72px -576px;  } 
-.ic-key { background-position: -72px -612px;  } 
-.ic-layers_1 { background-position: -72px -648px;  } 
-.ic-layers_2 { background-position: -72px -684px;  } 
-.ic-lightbulb { background-position: -72px -720px;  } 
-.ic-lighting { background-position: -72px -756px;  } 
-.ic-link { background-position: -72px -792px;  } 
-.ic-list_bullets { background-position: -72px -828px;  } 
-.ic-list_num { background-position: -72px -864px;  } 
-.ic-magic_wand { background-position: -72px -900px;  } 
-.ic-mail { background-position: -72px -936px;  } 
-.ic-mail_2 { background-position: -72px -972px;  } 
-.ic-mic { background-position: -72px -1008px;  } 
-.ic-monitor { background-position: -72px -1044px;  } 
-.ic-movie { background-position: -72px -1080px;  } 
-.ic-music { background-position: -72px -1116px;  } 
-.ic-net_comp { background-position: -72px -1152px;  } 
-.ic-network { background-position: -72px -1188px;  } 
-.ic-notepad { background-position: -72px -1224px;  } 
-.ic-notepad_2 { background-position: -72px -1260px;  } 
-.ic-on-off { background-position: -72px -1296px;  } 
-.ic-openid { background-position: -72px -1332px;  } 
-.ic-padlock_closed { background-position: -72px -1368px;  } 
-.ic-padlock_open { background-position: -72px -1404px;  } 
-.ic-page_layout { background-position: -72px -1440px;  } 
-.ic-paragraph { background-position: -72px -1476px;  } 
-.ic-pencil { background-position: -72px -1512px;  } 
-.ic-phone { background-position: -72px -1548px;  } 
-.ic-phone_1 { background-position: -72px -1584px;  } 
-.ic-phone_2 { background-position: -72px -1620px;  } 
-.ic-phone_touch { background-position: -72px -1656px;  } 
-.ic-photo { background-position: -72px -1692px;  } 
-.ic-picture { background-position: -72px -1728px;  } 
-.ic-pin { background-position: -72px -1764px;  } 
-.ic-pin_2 { background-position: -72px -1800px;  } 
-.ic-pin_map { background-position: -72px -1836px;  } 
-.ic-pin_map_down { background-position: -72px -1872px;  } 
-.ic-pin_map_left { background-position: -72px -1908px;  } 
-.ic-pin_map_right { background-position: -72px -1944px;  } 
-.ic-pin_map_top { background-position: -108px 0;  } 
-.ic-pin_sq_down { background-position: -108px -36px;  } 
-.ic-pin_sq_left { background-position: -108px -72px;  } 
-.ic-pin_sq_right { background-position: -108px -108px;  } 
-.ic-pin_sq_top { background-position: -108px -144px;  } 
-.ic-playback_ff { background-position: -108px -180px;  } 
-.ic-playback_next { background-position: -108px -216px;  } 
-.ic-playback_pause { background-position: -108px -252px;  } 
-.ic-playback_play { background-position: -108px -288px;  } 
-.ic-playback_prev { background-position: -108px -324px;  } 
-.ic-playback_rec { background-position: -108px -360px;  } 
-.ic-playback_reload { background-position: -108px -396px;  } 
-.ic-playback_rew { background-position: -108px -432px;  } 
-.ic-playback_stop { background-position: -108px -468px;  } 
-.ic-preso { background-position: -108px -504px;  } 
-.ic-print { background-position: -108px -540px;  } 
-.ic-question { background-position: -108px -576px;  } 
-.ic-redo { background-position: -108px -612px;  } 
-.ic-rnd_br_down { background-position: -108px -648px;  } 
-.ic-rnd_br_first { background-position: -108px -684px;  } 
-.ic-rnd_br_last { background-position: -108px -720px;  } 
-.ic-rnd_br_next { background-position: -108px -756px;  } 
-.ic-rnd_br_prev { background-position: -108px -792px;  } 
-.ic-rnd_br_up { background-position: -108px -828px;  } 
-.ic-round { background-position: -108px -864px;  } 
-.ic-round_and_up { background-position: -108px -900px;  } 
-.ic-round_arrow_left { background-position: -108px -936px;  } 
-.ic-round_arrow_right { background-position: -108px -972px;  } 
-.ic-round_checkmark { background-position: -108px -1008px;  } 
-.ic-round_delete { background-position: -108px -1044px;  } 
-.ic-round_minus { background-position: -108px -1080px;  } 
-.ic-round_plus { background-position: -108px -1116px;  } 
-.ic-rss { background-position: -108px -1152px;  } 
-.ic-rss_sq { background-position: -108px -1188px;  } 
-.ic-sand { background-position: -108px -1224px;  } 
-.ic-sat_dish { background-position: -108px -1260px;  } 
-.ic-save { background-position: -108px -1296px;  } 
-.ic-server { background-position: -108px -1332px;  } 
-.ic-share { background-position: -108px -1368px;  } 
-.ic-shop_cart { background-position: -108px -1404px;  } 
-.ic-sound_high { background-position: -108px -1440px;  } 
-.ic-sound_low { background-position: -108px -1476px;  } 
-.ic-sound_mute { background-position: -108px -1512px;  } 
-.ic-spechbubble { background-position: -108px -1548px;  } 
-.ic-spechbubble_2 { background-position: -108px -1584px;  } 
-.ic-spechbubble_sq { background-position: -108px -1620px;  } 
-.ic-spechbubble_sq_line { background-position: -108px -1656px;  } 
-.ic-sq_br_down { background-position: -108px -1692px;  } 
-.ic-sq_br_first { background-position: -108px -1728px;  } 
-.ic-sq_br_last { background-position: -108px -1764px;  } 
-.ic-sq_br_next { background-position: -108px -1800px;  } 
-.ic-sq_br_prev { background-position: -108px -1836px;  } 
-.ic-sq_br_up { background-position: -108px -1872px;  } 
-.ic-sq_down { background-position: -108px -1908px;  } 
-.ic-sq_minus { background-position: -108px -1944px;  } 
-.ic-sq_next { background-position: -144px 0;  } 
-.ic-sq_plus { background-position: -144px -36px;  } 
-.ic-sq_prev { background-position: -144px -72px;  } 
-.ic-sq_up { background-position: -144px -108px;  } 
-.ic-square_shape { background-position: -144px -144px;  } 
-.ic-star { background-position: -144px -180px;  } 
-.ic-star_fav { background-position: -144px -216px;  } 
-.ic-star_fav_empty { background-position: -144px -252px;  } 
-.ic-sun { background-position: -144px -288px;  } 
-.ic-tag { background-position: -144px -324px;  } 
-.ic-tape { background-position: -144px -360px;  } 
-.ic-target { background-position: -144px -396px;  } 
-.ic-text_curstor { background-position: -144px -432px;  } 
-.ic-text_letter_t { background-position: -144px -468px;  } 
-.ic-top_right_expand { background-position: -144px -504px;  } 
-.ic-trash { background-position: -144px -540px;  } 
-.ic-twitter { background-position: -144px -576px;  } 
-.ic-twitter_2 { background-position: -144px -612px;  } 
-.ic-undo { background-position: -144px -648px;  } 
-.ic-user { background-position: -144px -684px;  } 
-.ic-users { background-position: -144px -720px;  } 
-.ic-wrench { background-position: -144px -756px;  } 
-.ic-wrench_plus { background-position: -144px -792px;  } 
-.ic-wrench_plus_2 { background-position: -144px -828px;  } 
-.ic-zoom { background-position: -144px -864px;  } 
-
-
-/*
- *	lib/css/legacy/sidebar.css
- */div.psidebar-wrapper {
-	margin: 0px 8px;
-}
-
-div.psidebar-head {
-	font-size: 14px;
-	font-weight: bold;
-	color: #555;
-	margin-bottom: 12px;
-}
-
-div.psidebar-section {
-	background-color: #fff;
-	border: 1px solid #b2b2b7;
-	margin-bottom: 11px;
-	overflow: hidden;
-}
-
-div.psidebar-section-head {
-	font-size: 12px;
-	padding: 5px 11px;
-	background: #eeeeee; /* Old browsers */
-	background: -moz-linear-gradient(top,  #eeeeee 0%, #cccccc 100%); /* FF3.6+ */
-	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */
-	background: -webkit-linear-gradient(top,  #eeeeee 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */
-	background: -o-linear-gradient(top,  #eeeeee 0%,#cccccc 100%); /* Opera 11.10+ */
-	background: -ms-linear-gradient(top,  #eeeeee 0%,#cccccc 100%); /* IE10+ */
-	background: linear-gradient(top,  #eeeeee 0%,#cccccc 100%); /* W3C */
-	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */
-}
-
-div.psidebar-section-body {
-	margin: 7px 11px 11px 11px;
-}
-
-div.psidebar-section-item {
-	margin-bottom: 7px;
-}
-
-.psidebar-section-link {
-	font-size: 11px;
-	color: #666;
-}
-
-div.follower-list {
-	color: #666;
-	margin-top: 7px;
-	font-size: 11px;
-}
-/*
- *	lib/css/legacy/bootstrap-buttons.css
- */.btn.danger,
-.alert-message.danger,
-.btn.danger:hover,
-.alert-message.danger:hover,
-.btn.error,
-.alert-message.error,
-.btn.error:hover,
-.alert-message.error:hover,
-.btn.success,
-.alert-message.success,
-.btn.success:hover,
-.alert-message.success:hover,
-.btn.info,
-.alert-message.info,
-.btn.info:hover,
-.alert-message.info:hover {
-  color: #ffffff;
-}
-.btn .close, .alert-message .close {
-  font-family: Arial, sans-serif;
-  line-height: 18px;
-}
-.btn.danger,
-.alert-message.danger,
-.btn.error,
-.alert-message.error {
-  background-color: #c43c35;
-  background-repeat: repeat-x;
-  background-image: -khtml-gradient(linear, left top, left bottom, from(#ee5f5b), to(#c43c35));
-  background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35);
-  background-image: -ms-linear-gradient(top, #ee5f5b, #c43c35);
-  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ee5f5b), color-stop(100%, #c43c35));
-  background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35);
-  background-image: -o-linear-gradient(top, #ee5f5b, #c43c35);
-  background-image: linear-gradient(top, #ee5f5b, #c43c35);
-  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#c43c35', GradientType=0);
-  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
-  border-color: #c43c35 #c43c35 #882a25;
-  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
-}
-.btn.success, .alert-message.success {
-  background-color: #57a957;
-  background-repeat: repeat-x;
-  background-image: -khtml-gradient(linear, left top, left bottom, from(#62c462), to(#57a957));
-  background-image: -moz-linear-gradient(top, #62c462, #57a957);
-  background-image: -ms-linear-gradient(top, #62c462, #57a957);
-  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #62c462), color-stop(100%, #57a957));
-  background-image: -webkit-linear-gradient(top, #62c462, #57a957);
-  background-image: -o-linear-gradient(top, #62c462, #57a957);
-  background-image: linear-gradient(top, #62c462, #57a957);
-  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#57a957', GradientType=0);
-  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
-  border-color: #57a957 #57a957 #3d773d;
-  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
-}
-.btn.info, .alert-message.info {
-  background-color: #339bb9;
-  background-repeat: repeat-x;
-  background-image: -khtml-gradient(linear, left top, left bottom, from(#5bc0de), to(#339bb9));
-  background-image: -moz-linear-gradient(top, #5bc0de, #339bb9);
-  background-image: -ms-linear-gradient(top, #5bc0de, #339bb9);
-  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #5bc0de), color-stop(100%, #339bb9));
-  background-image: -webkit-linear-gradient(top, #5bc0de, #339bb9);
-  background-image: -o-linear-gradient(top, #5bc0de, #339bb9);
-  background-image: linear-gradient(top, #5bc0de, #339bb9);
-  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de', endColorstr='#339bb9', GradientType=0);
-  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
-  border-color: #339bb9 #339bb9 #22697d;
-  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
-}
-.btn {
-  cursor: pointer;
-  display: inline-block;
-  background-color: #e6e6e6;
-  background-repeat: no-repeat;
-  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), color-stop(25%, #ffffff), to(#e6e6e6));
-  background-image: -webkit-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);
-  background-image: -moz-linear-gradient(top, #ffffff, #ffffff 25%, #e6e6e6);
-  background-image: -ms-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);
-  background-image: -o-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);
-  background-image: linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);
-  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0);
-  padding: 5px 14px 6px;
-  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
-  color: #333;
-  font-size: 11px;
-  line-height: normal;
-  border: 1px solid #ccc;
-  border-bottom-color: #bbb;
-  -webkit-border-radius: 4px;
-  -moz-border-radius: 4px;
-  border-radius: 4px;
-  -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
-  -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
-  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
-  -webkit-transition: 0.1s linear all;
-  -moz-transition: 0.1s linear all;
-  -ms-transition: 0.1s linear all;
-  -o-transition: 0.1s linear all;
-  transition: 0.1s linear all;
-}
-.btn:hover {
-  background-position: 0 -15px;
-  color: #333;
-  text-decoration: none;
-}
-.btn:focus {
-  outline: 1px dotted #666;
-}
-.btn.primary {
-  color: #ffffff;
-  background-color: #0064cd;
-  background-repeat: repeat-x;
-  background-image: -khtml-gradient(linear, left top, left bottom, from(#049cdb), to(#0064cd));
-  background-image: -moz-linear-gradient(top, #049cdb, #0064cd);
-  background-image: -ms-linear-gradient(top, #049cdb, #0064cd);
-  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #049cdb), color-stop(100%, #0064cd));
-  background-image: -webkit-linear-gradient(top, #049cdb, #0064cd);
-  background-image: -o-linear-gradient(top, #049cdb, #0064cd);
-  background-image: linear-gradient(top, #049cdb, #0064cd);
-  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#049cdb', endColorstr='#0064cd', GradientType=0);
-  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
-  border-color: #0064cd #0064cd #003f81;
-  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
-}
-.btn.active, .btn :active {
-  -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
-  -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
-  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
-}
-.btn.disabled {
-  cursor: default;
-  background-image: none;
-  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
-  filter: alpha(opacity=65);
-  -khtml-opacity: 0.65;
-  -moz-opacity: 0.65;
-  opacity: 0.65;
-  -webkit-box-shadow: none;
-  -moz-box-shadow: none;
-  box-shadow: none;
-}
-.btn[disabled] {
-  cursor: default;
-  background-image: none;
-  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
-  filter: alpha(opacity=65);
-  -khtml-opacity: 0.65;
-  -moz-opacity: 0.65;
-  opacity: 0.65;
-  -webkit-box-shadow: none;
-  -moz-box-shadow: none;
-  box-shadow: none;
-}
-.btn.large {
-  font-size: 15px;
-  line-height: normal;
-  padding: 9px 14px 9px;
-  -webkit-border-radius: 6px;
-  -moz-border-radius: 6px;
-  border-radius: 6px;
-}
-.btn.small {
-  padding: 5px 7px 5px;
-  font-size: 11px;
-}
-:root .alert-message, :root .btn {
-  border-radius: 0 \0;
-}
-button.btn::-moz-focus-inner, input[type=submit].btn::-moz-focus-inner {
-  padding: 0;
-  border: 0;
-}
-
-/* CLose */
-
-.close {
-  float: right;
-  color: #000000;
-  font-size: 15px;
-  font-weight: bold;
-  line-height: 13.5px;
-  margin-bottom: -2px;
-  text-shadow: 0 1px 0 #ffffff;
-  filter: alpha(opacity=25);
-  -khtml-opacity: 0.25;
-  -moz-opacity: 0.25;
-  opacity: 0.25;
-  text-decoration: none;
-}
-.close:hover {
-  color: #000000;
-  text-decoration: none;
-  filter: alpha(opacity=40);
-  -khtml-opacity: 0.4;
-  -moz-opacity: 0.4;
-  opacity: 0.4;
-  cursor: pointer;
-  font-weight: bold;
-}
\ No newline at end of file
diff --git a/css/style-web.css b/css/style-web.css
deleted file mode 100644
index a80fa2d..0000000
--- a/css/style-web.css
+++ /dev/null
@@ -1,629 +0,0 @@
-
-/*
- *	lib/css/legacy/body.css
- */html { 
-	margin: 0px;
-	padding: 0px;
-}
-
-body {	
-	margin: 0px;
-	padding: 0px;
-	font-family: Arial, Helvetica, Sans;
-	font-size: 12px;
-	color: #000;
-}
-
-/* heading from bootstrap */
-
-h1,
-h2,
-h3,
-h4,
-h5,
-h6 {
-  margin: 0;
-  font-weight: bold;
-  color: #333333;
-  text-rendering: optimizelegibility;
-  margin-bottom: 0.3em;
-}
-h1 small,
-h2 small,
-h3 small,
-h4 small,
-h5 small,
-h6 small {
-  font-weight: normal;
-  color: #999999;
-}
-h1 {
-  font-size: 30px;
-  line-height: 36px;
-}
-h1 small {
-  font-size: 18px;
-}
-h2 {
-  font-size: 24px;
-  line-height: 36px;
-}
-h2 small {
-  font-size: 18px;
-}
-h3 {
-  line-height: 27px;
-  font-size: 18px;
-}
-h3 small {
-  font-size: 14px;
-}
-h4, h5, h6 {
-  line-height: 18px;
-}
-h4 {
-  font-size: 14px;
-}
-h4 small {
-  font-size: 12px;
-}
-h5 {
-  font-size: 12px;
-}
-h6 {
-  font-size: 11px;
-  color: #999999;
-  text-transform: uppercase;
-}
-
-pre { margin: 0px; padding: 0px; }
-
-button { margin: 2px; margin-left: 0px; }
-
-label {
-	padding-top: 15px;
-	color: #404040;
-}
-
-select, input, textarea { 
-	border: 1px solid #AAA; 
-	-moz-border-radius: 4px;
-	-webkit-border-radius: 4px;
-	font-size: 13px;
-	padding: 4px;
-	color: #222;
-}
-
-textarea { 
-	font-family: inherit; 
-	height: 120px; 
-	width: 90%; 
-	font-size: 12px; 
-	white-space: normal;
-}
-
-table { padding: 0px; border-collapse: 'collapse'}
-
-td { 
-	padding:0px; 
-	margin: 0px; 
-	vertical-align: top; 
-}
-
-p {
-	margin: 0px 0px 9px 0px;
-	line-height: 1.5em;
-}
-
-li {
-	line-height: 1.5em;
-}
-
-a:active { outline:none; }
-
-:focus { -moz-outline-style:none; }
-
-table.simpletable { border-collapse: collapse; margin-bottom: 10px;}
-table.simpletable td {border: 1pt solid #000; vertical-align: top; padding: 2px; }
-
-div.fix_ff_cursor { overflow: auto; }
-
-/* --- Layout --- */
-
-div.comment { color: #444; }
-
-div#body_div {
-	position: relative;
-	display: none;
-	margin-top: 56px;
-	padding-right: 7px;
-}
-
-div.no_script {
-	display: none;
-}
-
-div.loading_div {
-	position: absolute;
-	background-color: #FFFFCC;
-	z-index: 1999;
-	right: 5px;
-	width: 90px;
-	display: none;
-	text-align: center;
-	padding: 2px;
-	font-size: 12px;
-	border: 1px solid #FF4;
-}
-
-
-div#head_div { background-color: #FFF; }
-
-#head_banner { background-color: #FFF; }
-
-.link_type {
-	padding:2px;
-	color: #00b;
-	text-decoration: underline;
-	cursor: pointer;
-}
-
-.link_type:hover {
-	color: #fff !important; 
-	background-color: #07b;
-	text-decoration: none;
-}
-
-div.std-footer {
-	margin: 13px 0px;
-	border-top: 1px solid #AAA;
-	padding: 13px;
-}
-
-div.std-footer-item {
-	margin: 0px 13px 13px 0px;
-}
-
-.shadow {
-	-moz-box-shadow: 0px 2px 2px #888;
-	-webkit-box-shadow: 0px 2px 2px #888;
- 	box-shadow: 0px 2px 2px #888;
-}
-
-.round {
-	-webkit-border-radius: 5px;
-	-moz-border-radius: 5px;
-	border-radius: 5px;	
-}
-.gradient {
-	background: #ededed; /* Old browsers */
-	background: -moz-linear-gradient(top, #ededed 0%, #d1d1d1 47%, #b7b7b7 100%); /* FF3.6+ */
-	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ededed), color-stop(47%,#d1d1d1), color-stop(100%,#b7b7b7)); /* Chrome,Safari4+ */
-	background: -webkit-linear-gradient(top, #ededed 0%,#d1d1d1 47%,#b7b7b7 100%); /* Chrome10+,Safari5.1+ */
-	background: -o-linear-gradient(top, #ededed 0%,#d1d1d1 47%,#b7b7b7 100%); /* Opera11.10+ */
-	background: -ms-linear-gradient(top, #ededed 0%,#d1d1d1 47%,#b7b7b7 100%); /* IE10+ */
-	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ededed', endColorstr='#b7b7b7',GradientType=0 ); /* IE6-9 */
-	background: linear-gradient(top, #ededed 0%,#d1d1d1 47%,#b7b7b7 100%); /* W3C */	
-}
-
-.header-gradient {
-	background: #84827c; /* Old browsers */
-	background: -moz-linear-gradient(top, #84827c 0%, #27211c 100%); /* FF3.6+ */
-	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#84827c), color-stop(100%,#27211c)); /* Chrome,Safari4+ */
-	background: -webkit-linear-gradient(top, #84827c 0%,#27211c 100%); /* Chrome10+,Safari5.1+ */
-	background: -o-linear-gradient(top, #84827c 0%,#27211c 100%); /* Opera11.10+ */
-	background: -ms-linear-gradient(top, #84827c 0%,#27211c 100%); /* IE10+ */
-	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#84827c', endColorstr='#27211c',GradientType=0 ); /* IE6-9 */
-	background: linear-gradient(top, #84827c 0%,#27211c 100%); /* W3C */
-	color: #FFF;
-}
-
-.layout_wrapper {
-	padding: 15px;
-	-moz-box-shadow: 1px 1px 6px #AAA;
-	-webkit-box-shadow: 1px 1px 6px #AAA;
-	box-shadow: 1px 1px 6px #AAA;
-	background-color: #FFF;
-}
-
-/* from bootstrap */
-.container {
-  margin-left: auto;
-  margin-right: auto;
-  zoom: 1;
-}
-.container:before, .container:after {
-  display: table;
-  content: "";
-  zoom: 1;
-}
-.container:after {
-  clear: both;
-}
-
-/*
- *	lib/css/legacy/menus.css
- */
-/******** Menus - menu.js ************/
-
-ul.menu_toolbar {
-	z-index: 30;
-	padding: 0px;
-	margin: 0px;
-	margin-top: 1px;
-}
-
-ul.menu_toolbar li {
-	list-style: none;
-	margin: 0px;
-	float: left;
-}
-
-.top_menu {
-	margin: 0px;
-	padding: 4px;
-	cursor: pointer;
-	color: #FFF;
-	margin-right: 8px;
-}
-
-.top_menu_mo {
-	background-color: #000;
-
-	-moz-border-radius: 5px;
-	-webkit-border-radius: 5px;
-}
-
-div.menu_toolbar_dropdown {
-	position: absolute;
-	margin-top: 4px;
-	margin-left: 8px;
-	width: 140px;
-	background-color: #FFF;
-	color: #000;
-	display: none;
-	border: 2px solid #333;
-	z-index: 31;
-	overflow-y: auto;
-	overflow-x: hidden;
-}
-
-div.dd_item {
-	cursor: pointer;
-	padding: 4px;
-	background-color: #FFF;
-}
-div.dd_item_mo { background-color: #FE8; }
-/*
- *	lib/css/legacy/messages.css
- */
-/* FLOATING MESSAGE */
-
-.btn-img { cursor: pointer; }
-
-div.fetching { color: #888; text-align:right; }
-
-div.notice {
-	postion: absolute;
-	background-color: #000;
-	-moz-border-radius: 5px; -webkit-border-radius: 5px;
-	opacity: 0.6;
-	right: 0;
-	top: 0;
-	margin-top: 8px;
-	z-index: -1;
-	padding: 8px;
-}
-
-/** help **/
-
-.info-box {
-    background-color: #F8F8F8;
-    border: 1px solid #CCCCCC;
-    border-radius: 3px 3px 3px 3px;
-    line-height: 1.6em;
-    overflow: auto;
-    padding: 6px 10px;
-	margin-bottom: 9px;
-}
-
-.help_box, .help-box {
-	background-color:#FFC;
-	font-size: 13px;
-	color: #864;
-	padding: 7px;
-	margin: 11px 0px;
-	border: 1px solid #EEB;
-}
-
-.help_box_big {
-	background-color:#FFC;
-	color: #864;
-	padding: 7px;
-	margin: 7px 0px;
-	border: 1px solid #EEB;
-	text-align: center;
-	font-size: 14px;
-}
-/*
- *	lib/css/legacy/dialog.css
- *//***** Dialogs *******/
-
-div.dialog_wrapper {
-	position: absolute;
-	width: 440px;
-	display: none;
-	z-index: 90;
-	background-color: #FFF;
-	border: 3px solid #222;
-	box-shadow:1px 1px 5px #777;
-	-moz-box-shadow: 1px 1px 5px #777;
-	-webkit-box-shadow: 1px 1px 5px #777;
-	
-	border-radius: 5px;
-	-moz-border-radius: 5px;
-	-webkit-border-radius: 5px;	
-}
-
-div.dialog_head {
-	height: 22px;
-	padding: 4px;
-	background-color: #222;
-	color: #FFF;
-}
-
-div.dialog_body {
-	padding: 8px 4px 16px 4px;
-	border-radius: 5px;
-	-moz-border-radius: 5px;
-	-webkit-border-radius: 5px;	
-}
-
-div.dialog_back {
-	position: fixed;
-	display: none;
-	top: 0px;
-	left: 0px;
-	bottom: 0px;
-	right: 0px;
-	background-color: #EEE;
-	opacity: 0.6;
-	z-index: 50;
-	text-align: center;
-}
-
-div.dialog_message {
-	display: none;
-	position: absolute;
-	width: 250px;
-	font-size: 12px;
-	z-index: 91;
-	background-color:#FFF;
-	padding: 12px;
-	border: 1px solid #444;
-}
-
-div.dialog_row {
-	padding: 8px 8px 0px 8px;
-}
-
-div.dialog_row table {
-	width: 100%;
-}
-
-div.dialog_row table td {
-}
-
-div.dialog_row input[type="text"], div.dialog_row input[type="password"], div.dialog_row textarea, div.dialog_row select {
-	width: 80%;
-	font-size: 14px;
-}
-
-div.dialog_row table td textarea {
-	width: 80%;
-	height: 200px;
-	font-size: 12px;
-}
-
-/*
- *	lib/css/legacy/bootstrap-buttons.css
- */.btn.danger,
-.alert-message.danger,
-.btn.danger:hover,
-.alert-message.danger:hover,
-.btn.error,
-.alert-message.error,
-.btn.error:hover,
-.alert-message.error:hover,
-.btn.success,
-.alert-message.success,
-.btn.success:hover,
-.alert-message.success:hover,
-.btn.info,
-.alert-message.info,
-.btn.info:hover,
-.alert-message.info:hover {
-  color: #ffffff;
-}
-.btn .close, .alert-message .close {
-  font-family: Arial, sans-serif;
-  line-height: 18px;
-}
-.btn.danger,
-.alert-message.danger,
-.btn.error,
-.alert-message.error {
-  background-color: #c43c35;
-  background-repeat: repeat-x;
-  background-image: -khtml-gradient(linear, left top, left bottom, from(#ee5f5b), to(#c43c35));
-  background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35);
-  background-image: -ms-linear-gradient(top, #ee5f5b, #c43c35);
-  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ee5f5b), color-stop(100%, #c43c35));
-  background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35);
-  background-image: -o-linear-gradient(top, #ee5f5b, #c43c35);
-  background-image: linear-gradient(top, #ee5f5b, #c43c35);
-  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#c43c35', GradientType=0);
-  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
-  border-color: #c43c35 #c43c35 #882a25;
-  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
-}
-.btn.success, .alert-message.success {
-  background-color: #57a957;
-  background-repeat: repeat-x;
-  background-image: -khtml-gradient(linear, left top, left bottom, from(#62c462), to(#57a957));
-  background-image: -moz-linear-gradient(top, #62c462, #57a957);
-  background-image: -ms-linear-gradient(top, #62c462, #57a957);
-  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #62c462), color-stop(100%, #57a957));
-  background-image: -webkit-linear-gradient(top, #62c462, #57a957);
-  background-image: -o-linear-gradient(top, #62c462, #57a957);
-  background-image: linear-gradient(top, #62c462, #57a957);
-  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#57a957', GradientType=0);
-  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
-  border-color: #57a957 #57a957 #3d773d;
-  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
-}
-.btn.info, .alert-message.info {
-  background-color: #339bb9;
-  background-repeat: repeat-x;
-  background-image: -khtml-gradient(linear, left top, left bottom, from(#5bc0de), to(#339bb9));
-  background-image: -moz-linear-gradient(top, #5bc0de, #339bb9);
-  background-image: -ms-linear-gradient(top, #5bc0de, #339bb9);
-  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #5bc0de), color-stop(100%, #339bb9));
-  background-image: -webkit-linear-gradient(top, #5bc0de, #339bb9);
-  background-image: -o-linear-gradient(top, #5bc0de, #339bb9);
-  background-image: linear-gradient(top, #5bc0de, #339bb9);
-  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de', endColorstr='#339bb9', GradientType=0);
-  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
-  border-color: #339bb9 #339bb9 #22697d;
-  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
-}
-.btn {
-  cursor: pointer;
-  display: inline-block;
-  background-color: #e6e6e6;
-  background-repeat: no-repeat;
-  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), color-stop(25%, #ffffff), to(#e6e6e6));
-  background-image: -webkit-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);
-  background-image: -moz-linear-gradient(top, #ffffff, #ffffff 25%, #e6e6e6);
-  background-image: -ms-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);
-  background-image: -o-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);
-  background-image: linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);
-  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0);
-  padding: 5px 14px 6px;
-  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
-  color: #333;
-  font-size: 11px;
-  line-height: normal;
-  border: 1px solid #ccc;
-  border-bottom-color: #bbb;
-  -webkit-border-radius: 4px;
-  -moz-border-radius: 4px;
-  border-radius: 4px;
-  -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
-  -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
-  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
-  -webkit-transition: 0.1s linear all;
-  -moz-transition: 0.1s linear all;
-  -ms-transition: 0.1s linear all;
-  -o-transition: 0.1s linear all;
-  transition: 0.1s linear all;
-}
-.btn:hover {
-  background-position: 0 -15px;
-  color: #333;
-  text-decoration: none;
-}
-.btn:focus {
-  outline: 1px dotted #666;
-}
-.btn.primary {
-  color: #ffffff;
-  background-color: #0064cd;
-  background-repeat: repeat-x;
-  background-image: -khtml-gradient(linear, left top, left bottom, from(#049cdb), to(#0064cd));
-  background-image: -moz-linear-gradient(top, #049cdb, #0064cd);
-  background-image: -ms-linear-gradient(top, #049cdb, #0064cd);
-  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #049cdb), color-stop(100%, #0064cd));
-  background-image: -webkit-linear-gradient(top, #049cdb, #0064cd);
-  background-image: -o-linear-gradient(top, #049cdb, #0064cd);
-  background-image: linear-gradient(top, #049cdb, #0064cd);
-  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#049cdb', endColorstr='#0064cd', GradientType=0);
-  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
-  border-color: #0064cd #0064cd #003f81;
-  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
-}
-.btn.active, .btn :active {
-  -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
-  -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
-  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
-}
-.btn.disabled {
-  cursor: default;
-  background-image: none;
-  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
-  filter: alpha(opacity=65);
-  -khtml-opacity: 0.65;
-  -moz-opacity: 0.65;
-  opacity: 0.65;
-  -webkit-box-shadow: none;
-  -moz-box-shadow: none;
-  box-shadow: none;
-}
-.btn[disabled] {
-  cursor: default;
-  background-image: none;
-  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
-  filter: alpha(opacity=65);
-  -khtml-opacity: 0.65;
-  -moz-opacity: 0.65;
-  opacity: 0.65;
-  -webkit-box-shadow: none;
-  -moz-box-shadow: none;
-  box-shadow: none;
-}
-.btn.large {
-  font-size: 15px;
-  line-height: normal;
-  padding: 9px 14px 9px;
-  -webkit-border-radius: 6px;
-  -moz-border-radius: 6px;
-  border-radius: 6px;
-}
-.btn.small {
-  padding: 5px 7px 5px;
-  font-size: 11px;
-}
-:root .alert-message, :root .btn {
-  border-radius: 0 \0;
-}
-button.btn::-moz-focus-inner, input[type=submit].btn::-moz-focus-inner {
-  padding: 0;
-  border: 0;
-}
-
-/* CLose */
-
-.close {
-  float: right;
-  color: #000000;
-  font-size: 15px;
-  font-weight: bold;
-  line-height: 13.5px;
-  margin-bottom: -2px;
-  text-shadow: 0 1px 0 #ffffff;
-  filter: alpha(opacity=25);
-  -khtml-opacity: 0.25;
-  -moz-opacity: 0.25;
-  opacity: 0.25;
-  text-decoration: none;
-}
-.close:hover {
-  color: #000000;
-  text-decoration: none;
-  filter: alpha(opacity=40);
-  -khtml-opacity: 0.4;
-  -moz-opacity: 0.4;
-  opacity: 0.4;
-  cursor: pointer;
-  font-weight: bold;
-}
\ No newline at end of file
diff --git a/erpnext/accounts/DocType Label/Payable Voucher/Payable Voucher.txt b/erpnext/accounts/DocType Label/Payable Voucher/Payable Voucher.txt
deleted file mode 100644
index d12b2d2..0000000
--- a/erpnext/accounts/DocType Label/Payable Voucher/Payable Voucher.txt
+++ /dev/null
@@ -1 +0,0 @@
-[{'modified_by': 'Administrator', 'name': 'Payable Voucher', 'parent': None, 'dt_label': 'Purchase Invoice', 'creation': '2010-06-10 10:44:55', 'modified': '2010-06-10 10:44:55', 'module': 'Accounts', 'doctype': 'DocType Label', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'dt': 'Payable Voucher', 'parentfield': None}]
\ No newline at end of file
diff --git a/erpnext/accounts/DocType Label/Receivable Voucher/Receivable Voucher.txt b/erpnext/accounts/DocType Label/Receivable Voucher/Receivable Voucher.txt
deleted file mode 100644
index 459e4b8..0000000
--- a/erpnext/accounts/DocType Label/Receivable Voucher/Receivable Voucher.txt
+++ /dev/null
@@ -1 +0,0 @@
-[{'modified_by': 'Administrator', 'name': 'Receivable Voucher', 'parent': None, 'dt_label': 'Sales Invoice', 'creation': '2010-06-10 10:44:40', 'modified': '2010-06-10 10:44:40', 'module': 'Accounts', 'doctype': 'DocType Label', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'dt': 'Receivable Voucher', 'parentfield': None}]
\ No newline at end of file
diff --git a/erpnext/accounts/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt b/erpnext/accounts/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt
deleted file mode 100644
index 7a4544f..0000000
--- a/erpnext/accounts/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt
+++ /dev/null
@@ -1,188 +0,0 @@
-# DocType Mapper, Delivery Note-Receivable Voucher
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:34',
-		'docstatus': 0,
-		'modified': '2011-09-15 15:04:42',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'name': '__common__',
-		'parent': 'Delivery Note-Receivable Voucher',
-		'parentfield': 'table_mapper_details',
-		'parenttype': 'DocType Mapper'
-	},
-
-	# These values are common for all Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'name': '__common__',
-		'parent': 'Delivery Note-Receivable Voucher',
-		'parentfield': 'field_mapper_details',
-		'parenttype': 'DocType Mapper'
-	},
-
-	# These values are common for all DocType Mapper
-	{
-		'doctype': u'DocType Mapper',
-		'from_doctype': 'Delivery Note',
-		'module': 'Accounts',
-		'name': '__common__',
-		'ref_doc_submitted': 1,
-		'to_doctype': 'Receivable Voucher'
-	},
-
-	# DocType Mapper, Delivery Note-Receivable Voucher
-	{
-		'doctype': u'DocType Mapper',
-		'name': 'Delivery Note-Receivable Voucher'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'eval: obj.basic_rate and (flt(obj.amount) - flt(obj.billed_amt)) / flt(obj.basic_rate) or obj.qty',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'qty'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'parent',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'delivery_note'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'name',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'dn_detail'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'prevdoc_docname',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'sales_order'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'prevdoc_detail_docname',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'so_detail'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'eval: flt(obj.amount) - flt(obj.billed_amt)',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'amount'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'eval: (flt(obj.amount) - flt(obj.billed_amt)) * flt(obj.export_rate)/flt(obj.basic_rate)',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'export_amount'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'naming_series',
-		'map': 'No',
-		'match_id': 0,
-		'to_field': 'naming_series'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'incentives',
-		'map': 'No',
-		'match_id': 3,
-		'to_field': 'incentives'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'serial_no',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'serial_no'
-	},
-
-	# Field Mapper Detail
-	{
-		'checking_operator': u'=',
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'export_rate',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'export_rate'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_table': 'Delivery Note',
-		'match_id': 0,
-		'to_table': 'Receivable Voucher',
-		'validation_logic': 'docstatus=1'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_field': 'delivery_note_details',
-		'from_table': 'Delivery Note Detail',
-		'match_id': 1,
-		'to_field': 'entries',
-		'to_table': 'RV Detail',
-		'validation_logic': '(ifnull(amount, 0) = 0 or amount > ifnull(billed_amt, 0)) and docstatus = 1'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_field': 'other_charges',
-		'from_table': 'RV Tax Detail',
-		'match_id': 2,
-		'to_field': 'other_charges',
-		'to_table': 'RV Tax Detail',
-		'validation_logic': 'name is not null'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_field': 'sales_team',
-		'from_table': 'Sales Team',
-		'match_id': 3,
-		'to_field': 'sales_team',
-		'to_table': 'Sales Team',
-		'validation_logic': 'name is not null'
-	}
-]
diff --git a/erpnext/accounts/DocType Mapper/Delivery Note-Sales Invoice/Delivery Note-Sales Invoice.txt b/erpnext/accounts/DocType Mapper/Delivery Note-Sales Invoice/Delivery Note-Sales Invoice.txt
new file mode 100644
index 0000000..72f326b
--- /dev/null
+++ b/erpnext/accounts/DocType Mapper/Delivery Note-Sales Invoice/Delivery Note-Sales Invoice.txt
@@ -0,0 +1,188 @@
+# DocType Mapper, Delivery Note-Sales Invoice
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-04-03 12:49:42',
+		'docstatus': 0,
+		'modified': '2012-04-03 12:49:43',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'name': '__common__',
+		'parent': u'Delivery Note-Sales Invoice',
+		'parentfield': u'table_mapper_details',
+		'parenttype': u'DocType Mapper'
+	},
+
+	# These values are common for all Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'name': '__common__',
+		'parent': u'Delivery Note-Sales Invoice',
+		'parentfield': u'field_mapper_details',
+		'parenttype': u'DocType Mapper'
+	},
+
+	# These values are common for all DocType Mapper
+	{
+		'doctype': u'DocType Mapper',
+		'from_doctype': u'Delivery Note',
+		'module': u'Accounts',
+		'name': '__common__',
+		'ref_doc_submitted': 1,
+		'to_doctype': u'Sales Invoice'
+	},
+
+	# DocType Mapper, Delivery Note-Sales Invoice
+	{
+		'doctype': u'DocType Mapper',
+		'name': u'Delivery Note-Sales Invoice'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'eval: obj.basic_rate and (flt(obj.amount) - flt(obj.billed_amt)) / flt(obj.basic_rate) or obj.qty',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'qty'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'parent',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'delivery_note'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'name',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'dn_detail'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'prevdoc_docname',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'sales_order'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'prevdoc_detail_docname',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'so_detail'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'eval: flt(obj.amount) - flt(obj.billed_amt)',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'amount'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'eval: (flt(obj.amount) - flt(obj.billed_amt)) * flt(obj.export_rate)/flt(obj.basic_rate)',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'export_amount'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'naming_series',
+		'map': u'No',
+		'match_id': 0,
+		'to_field': u'naming_series'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'incentives',
+		'map': u'No',
+		'match_id': 3,
+		'to_field': u'incentives'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'serial_no',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'serial_no'
+	},
+
+	# Field Mapper Detail
+	{
+		'checking_operator': u'=',
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'export_rate',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'export_rate'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_table': u'Delivery Note',
+		'match_id': 0,
+		'to_table': u'Sales Invoice',
+		'validation_logic': u'docstatus=1'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'delivery_note_details',
+		'from_table': u'Delivery Note Item',
+		'match_id': 1,
+		'to_field': u'entries',
+		'to_table': u'Sales Invoice Item',
+		'validation_logic': u'(ifnull(amount, 0) = 0 or amount > ifnull(billed_amt, 0)) and docstatus = 1'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'other_charges',
+		'from_table': u'Sales Taxes and Charges',
+		'match_id': 2,
+		'to_field': u'other_charges',
+		'to_table': u'Sales Taxes and Charges',
+		'validation_logic': u'name is not null'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'sales_team',
+		'from_table': u'Sales Team',
+		'match_id': 3,
+		'to_field': u'sales_team',
+		'to_table': u'Sales Team',
+		'validation_logic': u'name is not null'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/accounts/DocType Mapper/Project-Receivable Voucher/Project-Receivable Voucher.txt b/erpnext/accounts/DocType Mapper/Project-Receivable Voucher/Project-Receivable Voucher.txt
deleted file mode 100644
index e88f452..0000000
--- a/erpnext/accounts/DocType Mapper/Project-Receivable Voucher/Project-Receivable Voucher.txt
+++ /dev/null
@@ -1,64 +0,0 @@
-# DocType Mapper, Project-Receivable Voucher
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-09-01 15:47:59',
-		'docstatus': 0,
-		'modified': '2011-09-15 15:04:43',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
-	},
-
-	# These values are common for all Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_table': 'Project',
-		'match_id': 0,
-		'name': '__common__',
-		'parent': 'Project-Receivable Voucher',
-		'parentfield': 'table_mapper_details',
-		'parenttype': 'DocType Mapper',
-		'to_table': 'Receivable Voucher',
-		'validation_logic': 'name is not null'
-	},
-
-	# These values are common for all Field Mapper Detail
-	{
-		'checking_operator': '=',
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'customer',
-		'map': 'Yes',
-		'match_id': 0,
-		'name': '__common__',
-		'parent': 'Project-Receivable Voucher',
-		'parentfield': 'field_mapper_details',
-		'parenttype': 'DocType Mapper',
-		'to_field': 'customer'
-	},
-
-	# These values are common for all DocType Mapper
-	{
-		'doctype': 'DocType Mapper',
-		'from_doctype': 'Project',
-		'module': 'Accounts',
-		'name': '__common__',
-		'to_doctype': 'Receivable Voucher'
-	},
-
-	# DocType Mapper, Project-Receivable Voucher
-	{
-		'doctype': 'DocType Mapper',
-		'name': 'Project-Receivable Voucher'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/DocType Mapper/Project-Sales Invoice/Project-Sales Invoice.txt b/erpnext/accounts/DocType Mapper/Project-Sales Invoice/Project-Sales Invoice.txt
new file mode 100644
index 0000000..8d87fda
--- /dev/null
+++ b/erpnext/accounts/DocType Mapper/Project-Sales Invoice/Project-Sales Invoice.txt
@@ -0,0 +1,64 @@
+# DocType Mapper, Project-Sales Invoice
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2010-09-01 15:47:59',
+		'docstatus': 0,
+		'modified': '2012-04-03 12:49:50',
+		'modified_by': u'Administrator',
+		'owner': u'ashwini@webnotestech.com'
+	},
+
+	# These values are common for all Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_table': u'Project',
+		'match_id': 0,
+		'name': '__common__',
+		'parent': u'Project-Sales Invoice',
+		'parentfield': u'table_mapper_details',
+		'parenttype': u'DocType Mapper',
+		'to_table': u'Sales Invoice',
+		'validation_logic': u'name is not null'
+	},
+
+	# These values are common for all Field Mapper Detail
+	{
+		'checking_operator': u'=',
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'customer',
+		'map': u'Yes',
+		'match_id': 0,
+		'name': '__common__',
+		'parent': u'Project-Sales Invoice',
+		'parentfield': u'field_mapper_details',
+		'parenttype': u'DocType Mapper',
+		'to_field': u'customer'
+	},
+
+	# These values are common for all DocType Mapper
+	{
+		'doctype': 'DocType Mapper',
+		'from_doctype': u'Project',
+		'module': u'Accounts',
+		'name': '__common__',
+		'to_doctype': u'Sales Invoice'
+	},
+
+	# DocType Mapper, Project-Sales Invoice
+	{
+		'doctype': 'DocType Mapper',
+		'name': u'Project-Sales Invoice'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/accounts/DocType Mapper/Purchase Order-Payable Voucher/Purchase Order-Payable Voucher.txt b/erpnext/accounts/DocType Mapper/Purchase Order-Payable Voucher/Purchase Order-Payable Voucher.txt
deleted file mode 100644
index 159b5bb..0000000
--- a/erpnext/accounts/DocType Mapper/Purchase Order-Payable Voucher/Purchase Order-Payable Voucher.txt
+++ /dev/null
@@ -1,158 +0,0 @@
-# DocType Mapper, Purchase Order-Payable Voucher
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:35',
-		'docstatus': 0,
-		'modified': '2012-02-07 13:28:31',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all Table Mapper Detail
-	{
-		'doctype': u'Table Mapper Detail',
-		'name': '__common__',
-		'parent': u'Purchase Order-Payable Voucher',
-		'parentfield': u'table_mapper_details',
-		'parenttype': u'DocType Mapper'
-	},
-
-	# These values are common for all Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'name': '__common__',
-		'parent': u'Purchase Order-Payable Voucher',
-		'parentfield': u'field_mapper_details',
-		'parenttype': u'DocType Mapper'
-	},
-
-	# These values are common for all DocType Mapper
-	{
-		'doctype': u'DocType Mapper',
-		'from_doctype': u'Purchase Order',
-		'module': u'Accounts',
-		'name': '__common__',
-		'ref_doc_submitted': 1,
-		'to_doctype': u'Payable Voucher'
-	},
-
-	# DocType Mapper, Purchase Order-Payable Voucher
-	{
-		'doctype': u'DocType Mapper',
-		'name': u'Purchase Order-Payable Voucher'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'eval: flt(obj.qty) - flt(obj.billed_qty)',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'qty'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'purchase_rate',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'rate'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.purchase_rate)',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'amount'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.import_rate)',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'import_amount'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'parent',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'purchase_order'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'name',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'po_detail'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'naming_series',
-		'map': u'No',
-		'match_id': 0,
-		'to_field': u'naming_series'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'total_tax',
-		'map': u'Yes',
-		'match_id': 0,
-		'to_field': u'total_tax'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'conversion_rate',
-		'map': u'Yes',
-		'match_id': 0,
-		'to_field': u'conversion_rate'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': u'Table Mapper Detail',
-		'from_table': u'Purchase Order',
-		'match_id': 0,
-		'to_table': u'Payable Voucher',
-		'validation_logic': u'docstatus =1'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': u'Table Mapper Detail',
-		'from_field': u'po_details',
-		'from_table': u'PO Detail',
-		'match_id': 1,
-		'to_field': u'entries',
-		'to_table': u'PV Detail',
-		'validation_logic': u'ifnull(billed_qty,0)  < qty and docstatus = 1'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': u'Table Mapper Detail',
-		'from_field': u'purchase_tax_details',
-		'from_table': u'Purchase Tax Detail',
-		'match_id': 2,
-		'to_field': u'purchase_tax_details',
-		'to_table': u'Purchase Tax Detail',
-		'validation_logic': u'docstatus =1'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/DocType Mapper/Purchase Order-Purchase Invoice/Purchase Order-Purchase Invoice.txt b/erpnext/accounts/DocType Mapper/Purchase Order-Purchase Invoice/Purchase Order-Purchase Invoice.txt
new file mode 100644
index 0000000..0e54457
--- /dev/null
+++ b/erpnext/accounts/DocType Mapper/Purchase Order-Purchase Invoice/Purchase Order-Purchase Invoice.txt
@@ -0,0 +1,158 @@
+# DocType Mapper, Purchase Order-Purchase Invoice
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'modified': '2012-04-03 12:49:50',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'name': '__common__',
+		'parent': u'Purchase Order-Purchase Invoice',
+		'parentfield': u'table_mapper_details',
+		'parenttype': u'DocType Mapper'
+	},
+
+	# These values are common for all Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'name': '__common__',
+		'parent': u'Purchase Order-Purchase Invoice',
+		'parentfield': u'field_mapper_details',
+		'parenttype': u'DocType Mapper'
+	},
+
+	# These values are common for all DocType Mapper
+	{
+		'doctype': u'DocType Mapper',
+		'from_doctype': u'Purchase Order',
+		'module': u'Accounts',
+		'name': '__common__',
+		'ref_doc_submitted': 1,
+		'to_doctype': u'Purchase Invoice'
+	},
+
+	# DocType Mapper, Purchase Order-Purchase Invoice
+	{
+		'doctype': u'DocType Mapper',
+		'name': u'Purchase Order-Purchase Invoice'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'eval: flt(obj.qty) - flt(obj.billed_qty)',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'qty'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'purchase_rate',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'rate'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.purchase_rate)',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'amount'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.import_rate)',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'import_amount'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'parent',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'purchase_order'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'name',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'po_detail'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'naming_series',
+		'map': u'No',
+		'match_id': 0,
+		'to_field': u'naming_series'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'total_tax',
+		'map': u'Yes',
+		'match_id': 0,
+		'to_field': u'total_tax'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'conversion_rate',
+		'map': u'Yes',
+		'match_id': 0,
+		'to_field': u'conversion_rate'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_table': u'Purchase Order',
+		'match_id': 0,
+		'to_table': u'Purchase Invoice',
+		'validation_logic': u'docstatus =1'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'po_details',
+		'from_table': u'Purchase Order Item',
+		'match_id': 1,
+		'to_field': u'entries',
+		'to_table': u'Purchase Invoice Item',
+		'validation_logic': u'ifnull(billed_qty,0)  < qty and docstatus = 1'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'purchase_tax_details',
+		'from_table': u'Purchase Taxes and Charges',
+		'match_id': 2,
+		'to_field': u'purchase_tax_details',
+		'to_table': u'Purchase Taxes and Charges',
+		'validation_logic': u'docstatus =1'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/accounts/DocType Mapper/Purchase Receipt-Payable Voucher/Purchase Receipt-Payable Voucher.txt b/erpnext/accounts/DocType Mapper/Purchase Receipt-Payable Voucher/Purchase Receipt-Payable Voucher.txt
deleted file mode 100644
index ffc748b..0000000
--- a/erpnext/accounts/DocType Mapper/Purchase Receipt-Payable Voucher/Purchase Receipt-Payable Voucher.txt
+++ /dev/null
@@ -1,185 +0,0 @@
-# DocType Mapper, Purchase Receipt-Payable Voucher
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:35',
-		'docstatus': 0,
-		'modified': '2012-02-06 15:26:25',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all Table Mapper Detail
-	{
-		'doctype': u'Table Mapper Detail',
-		'name': '__common__',
-		'parent': u'Purchase Receipt-Payable Voucher',
-		'parentfield': u'table_mapper_details',
-		'parenttype': u'DocType Mapper'
-	},
-
-	# These values are common for all Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'name': '__common__',
-		'parent': u'Purchase Receipt-Payable Voucher',
-		'parentfield': u'field_mapper_details',
-		'parenttype': u'DocType Mapper'
-	},
-
-	# These values are common for all DocType Mapper
-	{
-		'doctype': u'DocType Mapper',
-		'from_doctype': u'Purchase Receipt',
-		'module': u'Accounts',
-		'name': '__common__',
-		'ref_doc_submitted': 1,
-		'to_doctype': u'Payable Voucher'
-	},
-
-	# DocType Mapper, Purchase Receipt-Payable Voucher
-	{
-		'doctype': u'DocType Mapper',
-		'name': u'Purchase Receipt-Payable Voucher'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'eval: flt(obj.qty) - flt(obj.billed_qty)',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'qty'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'purchase_rate',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'rate'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.purchase_rate)',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'amount'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.import_rate)',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'import_amount'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'parent',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'purchase_receipt'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'prevdoc_docname',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'purchase_order'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'name',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'pr_detail'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'prevdoc_detail_docname',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'po_detail'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'naming_series',
-		'map': u'No',
-		'match_id': 0,
-		'to_field': u'naming_series'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'net_total',
-		'map': u'Yes',
-		'match_id': 0,
-		'to_field': u'net_total'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'grand_total',
-		'map': u'Yes',
-		'match_id': 0,
-		'to_field': u'grand_total'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'total_tax',
-		'map': u'Yes',
-		'match_id': 0,
-		'to_field': u'total_tax'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': u'Table Mapper Detail',
-		'from_field': u'purchase_receipt_details',
-		'from_table': u'Purchase Receipt Detail',
-		'match_id': 1,
-		'to_field': u'entries',
-		'to_table': u'PV Detail',
-		'validation_logic': u'ifnull(billed_qty,0)  < qty'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': u'Table Mapper Detail',
-		'from_table': u'Purchase Receipt',
-		'match_id': 0,
-		'to_table': u'Payable Voucher',
-		'validation_logic': u'docstatus=1'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': u'Table Mapper Detail',
-		'from_field': u'purchase_tax_details',
-		'from_table': u'Purchase Tax Detail',
-		'match_id': 2,
-		'to_field': u'purchase_tax_details',
-		'to_table': u'Purchase Tax Detail',
-		'validation_logic': u'docstatus=1'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/DocType Mapper/Purchase Receipt-Purchase Invoice/Purchase Receipt-Purchase Invoice.txt b/erpnext/accounts/DocType Mapper/Purchase Receipt-Purchase Invoice/Purchase Receipt-Purchase Invoice.txt
new file mode 100644
index 0000000..75b188b
--- /dev/null
+++ b/erpnext/accounts/DocType Mapper/Purchase Receipt-Purchase Invoice/Purchase Receipt-Purchase Invoice.txt
@@ -0,0 +1,185 @@
+# DocType Mapper, Purchase Receipt-Purchase Invoice
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2010-08-08 17:09:35',
+		'docstatus': 0,
+		'modified': '2012-04-03 12:49:50',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'name': '__common__',
+		'parent': u'Purchase Receipt-Purchase Invoice',
+		'parentfield': u'table_mapper_details',
+		'parenttype': u'DocType Mapper'
+	},
+
+	# These values are common for all Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'name': '__common__',
+		'parent': u'Purchase Receipt-Purchase Invoice',
+		'parentfield': u'field_mapper_details',
+		'parenttype': u'DocType Mapper'
+	},
+
+	# These values are common for all DocType Mapper
+	{
+		'doctype': u'DocType Mapper',
+		'from_doctype': u'Purchase Receipt',
+		'module': u'Accounts',
+		'name': '__common__',
+		'ref_doc_submitted': 1,
+		'to_doctype': u'Purchase Invoice'
+	},
+
+	# DocType Mapper, Purchase Receipt-Purchase Invoice
+	{
+		'doctype': u'DocType Mapper',
+		'name': u'Purchase Receipt-Purchase Invoice'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'eval: flt(obj.qty) - flt(obj.billed_qty)',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'qty'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'purchase_rate',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'rate'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.purchase_rate)',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'amount'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.import_rate)',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'import_amount'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'parent',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'purchase_receipt'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'prevdoc_docname',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'purchase_order'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'name',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'pr_detail'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'prevdoc_detail_docname',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'po_detail'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'naming_series',
+		'map': u'No',
+		'match_id': 0,
+		'to_field': u'naming_series'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'net_total',
+		'map': u'Yes',
+		'match_id': 0,
+		'to_field': u'net_total'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'grand_total',
+		'map': u'Yes',
+		'match_id': 0,
+		'to_field': u'grand_total'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'total_tax',
+		'map': u'Yes',
+		'match_id': 0,
+		'to_field': u'total_tax'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'purchase_receipt_details',
+		'from_table': u'Purchase Receipt Item',
+		'match_id': 1,
+		'to_field': u'entries',
+		'to_table': u'Purchase Invoice Item',
+		'validation_logic': u'ifnull(billed_qty,0)  < qty'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_table': u'Purchase Receipt',
+		'match_id': 0,
+		'to_table': u'Purchase Invoice',
+		'validation_logic': u'docstatus=1'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'purchase_tax_details',
+		'from_table': u'Purchase Taxes and Charges',
+		'match_id': 2,
+		'to_field': u'purchase_tax_details',
+		'to_table': u'Purchase Taxes and Charges',
+		'validation_logic': u'docstatus=1'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/accounts/DocType Mapper/Sales Order-Receivable Voucher/Sales Order-Receivable Voucher.txt b/erpnext/accounts/DocType Mapper/Sales Order-Receivable Voucher/Sales Order-Receivable Voucher.txt
deleted file mode 100644
index d076d9f..0000000
--- a/erpnext/accounts/DocType Mapper/Sales Order-Receivable Voucher/Sales Order-Receivable Voucher.txt
+++ /dev/null
@@ -1,190 +0,0 @@
-# DocType Mapper, Sales Order-Receivable Voucher
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-09-20 12:33:35',
-		'docstatus': 0,
-		'modified': '2012-03-28 19:19:38',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all Table Mapper Detail
-	{
-		'doctype': u'Table Mapper Detail',
-		'name': '__common__',
-		'parent': u'Sales Order-Receivable Voucher',
-		'parentfield': u'table_mapper_details',
-		'parenttype': u'DocType Mapper'
-	},
-
-	# These values are common for all Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'name': '__common__',
-		'parent': u'Sales Order-Receivable Voucher',
-		'parentfield': u'field_mapper_details',
-		'parenttype': u'DocType Mapper'
-	},
-
-	# These values are common for all DocType Mapper
-	{
-		'doctype': u'DocType Mapper',
-		'from_doctype': u'Sales Order',
-		'module': u'Accounts',
-		'name': '__common__',
-		'ref_doc_submitted': 1,
-		'to_doctype': u'Receivable Voucher'
-	},
-
-	# DocType Mapper, Sales Order-Receivable Voucher
-	{
-		'doctype': u'DocType Mapper',
-		'name': u'Sales Order-Receivable Voucher'
-	},
-
-	# Field Mapper Detail
-	{
-		'checking_operator': u'=',
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'customer',
-		'map': u'Yes',
-		'match_id': 0,
-		'to_field': u'customer'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'eval: obj.basic_rate and (flt(obj.amount) - flt(obj.billed_amt))/flt(obj.basic_rate) or obj.qty',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'qty'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'parent',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'sales_order'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'name',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'so_detail'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'eval:flt(obj.amount) - flt(obj.billed_amt)',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'amount'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'eval: (flt(obj.amount) - flt(obj.billed_amt))* flt(obj.export_rate)/flt(obj.basic_rate)',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'export_amount'
-	},
-
-	# Field Mapper Detail
-	{
-		'checking_operator': u'=',
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'project_name',
-		'map': u'Yes',
-		'match_id': 0,
-		'to_field': u'project_name'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'reserved_warehouse',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'warehouse'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'naming_series',
-		'map': u'No',
-		'match_id': 0,
-		'to_field': u'naming_series'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'incentives',
-		'map': u'No',
-		'match_id': 3,
-		'to_field': u'incentives'
-	},
-
-	# Field Mapper Detail
-	{
-		'checking_operator': u'=',
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'export_rate',
-		'map': u'Yes',
-		'match_id': 1,
-		'to_field': u'export_rate'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': u'Table Mapper Detail',
-		'from_table': u'Sales Order',
-		'match_id': 0,
-		'to_table': u'Receivable Voucher',
-		'validation_logic': u'docstatus=1'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': u'Table Mapper Detail',
-		'from_field': u'sales_order_detail',
-		'from_table': u'Sales Order Detail',
-		'match_id': 1,
-		'to_field': u'entries',
-		'to_table': u'RV Detail',
-		'validation_logic': u'(ifnull(amount, 0) = 0 or amount > ifnull(billed_amt, 0)) and docstatus = 1'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': u'Table Mapper Detail',
-		'from_field': u'other_charges',
-		'from_table': u'RV Tax Detail',
-		'match_id': 2,
-		'to_field': u'other_charges',
-		'to_table': u'RV Tax Detail',
-		'validation_logic': u'name is not null'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': u'Table Mapper Detail',
-		'from_field': u'sales_team',
-		'from_table': u'Sales Team',
-		'match_id': 3,
-		'to_field': u'sales_team',
-		'to_table': u'Sales Team',
-		'validation_logic': u'name is not null'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/DocType Mapper/Sales Order-Sales Invoice/Sales Order-Sales Invoice.txt b/erpnext/accounts/DocType Mapper/Sales Order-Sales Invoice/Sales Order-Sales Invoice.txt
new file mode 100644
index 0000000..aa1cc3c
--- /dev/null
+++ b/erpnext/accounts/DocType Mapper/Sales Order-Sales Invoice/Sales Order-Sales Invoice.txt
@@ -0,0 +1,190 @@
+# DocType Mapper, Sales Order-Sales Invoice
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-04-03 12:49:42',
+		'docstatus': 0,
+		'modified': '2012-04-03 12:49:42',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'name': '__common__',
+		'parent': u'Sales Order-Sales Invoice',
+		'parentfield': u'table_mapper_details',
+		'parenttype': u'DocType Mapper'
+	},
+
+	# These values are common for all Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'name': '__common__',
+		'parent': u'Sales Order-Sales Invoice',
+		'parentfield': u'field_mapper_details',
+		'parenttype': u'DocType Mapper'
+	},
+
+	# These values are common for all DocType Mapper
+	{
+		'doctype': u'DocType Mapper',
+		'from_doctype': u'Sales Order',
+		'module': u'Accounts',
+		'name': '__common__',
+		'ref_doc_submitted': 1,
+		'to_doctype': u'Sales Invoice'
+	},
+
+	# DocType Mapper, Sales Order-Sales Invoice
+	{
+		'doctype': u'DocType Mapper',
+		'name': u'Sales Order-Sales Invoice'
+	},
+
+	# Field Mapper Detail
+	{
+		'checking_operator': u'=',
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'customer',
+		'map': u'Yes',
+		'match_id': 0,
+		'to_field': u'customer'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'eval: obj.basic_rate and (flt(obj.amount) - flt(obj.billed_amt))/flt(obj.basic_rate) or obj.qty',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'qty'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'parent',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'sales_order'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'name',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'so_detail'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'eval:flt(obj.amount) - flt(obj.billed_amt)',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'amount'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'eval: (flt(obj.amount) - flt(obj.billed_amt))* flt(obj.export_rate)/flt(obj.basic_rate)',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'export_amount'
+	},
+
+	# Field Mapper Detail
+	{
+		'checking_operator': u'=',
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'project_name',
+		'map': u'Yes',
+		'match_id': 0,
+		'to_field': u'project_name'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'reserved_warehouse',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'warehouse'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'naming_series',
+		'map': u'No',
+		'match_id': 0,
+		'to_field': u'naming_series'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'incentives',
+		'map': u'No',
+		'match_id': 3,
+		'to_field': u'incentives'
+	},
+
+	# Field Mapper Detail
+	{
+		'checking_operator': u'=',
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'export_rate',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'export_rate'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_table': u'Sales Order',
+		'match_id': 0,
+		'to_table': u'Sales Invoice',
+		'validation_logic': u'docstatus=1'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'sales_order_detail',
+		'from_table': u'Sales Order Item',
+		'match_id': 1,
+		'to_field': u'entries',
+		'to_table': u'Sales Invoice Item',
+		'validation_logic': u'(ifnull(amount, 0) = 0 or amount > ifnull(billed_amt, 0)) and docstatus = 1'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'other_charges',
+		'from_table': u'Sales Taxes and Charges',
+		'match_id': 2,
+		'to_field': u'other_charges',
+		'to_table': u'Sales Taxes and Charges',
+		'validation_logic': u'name is not null'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'sales_team',
+		'from_table': u'Sales Team',
+		'match_id': 3,
+		'to_field': u'sales_team',
+		'to_table': u'Sales Team',
+		'validation_logic': u'name is not null'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/accounts/GL Mapper/Journal Voucher/Journal Voucher.txt b/erpnext/accounts/GL Mapper/Journal Voucher/Journal Voucher.txt
index fac3831..1909477 100644
--- a/erpnext/accounts/GL Mapper/Journal Voucher/Journal Voucher.txt
+++ b/erpnext/accounts/GL Mapper/Journal Voucher/Journal Voucher.txt
@@ -1 +1 @@
-[{'doc_type': 'Journal Voucher', 'modified_by': 'nabin@webnotestech.com', 'name': 'Journal Voucher', 'parent': None, 'creation': '2009-03-12 12:09:24', 'modified': '2010-04-30 17:56:41', 'module': 'Accounts', 'doctype': 'GL Mapper', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'parent:doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': 'cost_center', 'voucher_no': 'parent:name', 'modified_by': 'nabin@webnotestech.com', 'against_voucher': "value:d.against_voucher or d.against_invoice or d.against_jv or ''", 'table_field': 'entries', 'transaction_date': 'parent:voucher_date', 'debit': 'debit', 'docstatus': 0, 'parent': 'Journal Voucher', 'company': 'parent:company', 'aging_date': 'parent:aging_date', 'fiscal_year': 'parent:fiscal_year', 'is_advance': 'is_advance', 'remarks': 'parent:remark', 'account': 'account', 'name': 'GLMDetail00001', 'idx': 1, 'against_voucher_type': "value:(d.against_voucher and 'Payable Voucher') or (d.against_invoice and 'Receivable Voucher') or (d.against_jv and 'Journal Voucher') or ''", 'modified': '2010-04-30 17:56:41', 'against': 'against_account', 'credit': 'credit', 'parenttype': 'GL Mapper', 'is_opening': 'parent:is_opening', 'posting_date': 'parent:posting_date', 'parentfield': 'fields'}, {'creation': '2009-06-11 11:09:11', 'voucher_type': 'doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': '', 'voucher_no': 'name', 'modified_by': 'nabin@webnotestech.com', 'against_voucher': '', 'table_field': '', 'transaction_date': 'voucher_date', 'debit': 'value:0', 'docstatus': 0, 'parent': 'Journal Voucher', 'company': 'company', 'aging_date': 'aging_date', 'fiscal_year': 'fiscal_year', 'is_advance': '', 'remarks': 'remark', 'account': 'tax_code', 'name': 'GLMDetail00009', 'idx': 2, 'against_voucher_type': None, 'modified': '2010-04-30 17:56:41', 'against': 'supplier_account', 'credit': 'ded_amount', 'parenttype': 'GL Mapper', 'is_opening': 'is_opening', 'posting_date': 'posting_date', 'parentfield': 'fields'}]
+[{'doc_type': 'Journal Voucher', 'modified_by': 'nabin@webnotestech.com', 'name': 'Journal Voucher', 'parent': None, 'creation': '2009-03-12 12:09:24', 'modified': '2010-04-30 17:56:41', 'module': 'Accounts', 'doctype': 'GL Mapper', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'parent:doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': 'cost_center', 'voucher_no': 'parent:name', 'modified_by': 'nabin@webnotestech.com', 'against_voucher': "value:d.against_voucher or d.against_invoice or d.against_jv or ''", 'table_field': 'entries', 'transaction_date': 'parent:voucher_date', 'debit': 'debit', 'docstatus': 0, 'parent': 'Journal Voucher', 'company': 'parent:company', 'aging_date': 'parent:aging_date', 'fiscal_year': 'parent:fiscal_year', 'is_advance': 'is_advance', 'remarks': 'parent:remark', 'account': 'account', 'name': 'GLMDetail00001', 'idx': 1, 'against_voucher_type': "value:(d.against_voucher and 'Purchase Invoice') or (d.against_invoice and 'Sales Invoice') or (d.against_jv and 'Journal Voucher') or ''", 'modified': '2010-04-30 17:56:41', 'against': 'against_account', 'credit': 'credit', 'parenttype': 'GL Mapper', 'is_opening': 'parent:is_opening', 'posting_date': 'parent:posting_date', 'parentfield': 'fields'}, {'creation': '2009-06-11 11:09:11', 'voucher_type': 'doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': '', 'voucher_no': 'name', 'modified_by': 'nabin@webnotestech.com', 'against_voucher': '', 'table_field': '', 'transaction_date': 'voucher_date', 'debit': 'value:0', 'docstatus': 0, 'parent': 'Journal Voucher', 'company': 'company', 'aging_date': 'aging_date', 'fiscal_year': 'fiscal_year', 'is_advance': '', 'remarks': 'remark', 'account': 'tax_code', 'name': 'GLMDetail00009', 'idx': 2, 'against_voucher_type': None, 'modified': '2010-04-30 17:56:41', 'against': 'supplier_account', 'credit': 'ded_amount', 'parenttype': 'GL Mapper', 'is_opening': 'is_opening', 'posting_date': 'posting_date', 'parentfield': 'fields'}]
diff --git a/erpnext/accounts/GL Mapper/Payable Voucher/Payable Voucher.txt b/erpnext/accounts/GL Mapper/Payable Voucher/Payable Voucher.txt
deleted file mode 100644
index eeeea70..0000000
--- a/erpnext/accounts/GL Mapper/Payable Voucher/Payable Voucher.txt
+++ /dev/null
@@ -1 +0,0 @@
-[{'doc_type': 'Payable Voucher', 'modified_by': 'nabin@webnotestech.com', 'name': 'Payable Voucher', 'parent': None, 'creation': '2009-03-12 12:09:24', 'modified': '2010-05-26 16:48:58', 'module': 'Accounts', 'doctype': 'GL Mapper', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'parent:doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': 'cost_center', 'voucher_no': 'parent:name', 'modified_by': 'nabin@webnotestech.com', 'against_voucher': None, 'table_field': 'entries', 'transaction_date': 'parent:voucher_date', 'debit': 'amount', 'docstatus': 0, 'parent': 'Payable Voucher', 'company': 'parent:company', 'aging_date': 'parent:aging_date', 'fiscal_year': 'parent:fiscal_year', 'is_advance': None, 'remarks': 'parent:remarks', 'account': 'expense_head', 'name': 'GLMDetail00002', 'idx': 1, 'against_voucher_type': None, 'modified': '2010-05-26 16:48:58', 'against': 'parent:credit_to', 'credit': 'value:0', 'parenttype': 'GL Mapper', 'is_opening': 'parent:is_opening', 'posting_date': 'parent:posting_date', 'parentfield': 'fields'}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'parent:doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': 'cost_center', 'voucher_no': 'parent:name', 'modified_by': 'nabin@webnotestech.com', 'against_voucher': None, 'table_field': 'purchase_tax_details', 'transaction_date': 'parent:voucher_date', 'debit': "value:d.fields.get('category') != 'For Valuation' and d.fields.get('add_deduct_tax') == 'Add' and d.fields.get('tax_amount') or 0", 'docstatus': 0, 'parent': 'Payable Voucher', 'company': 'parent:company', 'aging_date': 'parent:aging_date', 'fiscal_year': 'parent:fiscal_year', 'is_advance': None, 'remarks': 'parent:remarks', 'account': 'account_head', 'name': 'GLMDetail00003', 'idx': 2, 'against_voucher_type': None, 'modified': '2010-05-26 16:48:58', 'against': 'parent:credit_to', 'credit': "value:d.fields.get('category') != 'For Valuation' and d.fields.get('add_deduct_tax') == 'Deduct' and d.fields.get('tax_amount') or 0", 'parenttype': 'GL Mapper', 'is_opening': 'parent:is_opening', 'posting_date': 'parent:posting_date', 'parentfield': 'fields'}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': '', 'voucher_no': 'name', 'modified_by': 'nabin@webnotestech.com', 'against_voucher': None, 'table_field': '', 'transaction_date': 'voucher_date', 'debit': 'value:0', 'docstatus': 0, 'parent': 'Payable Voucher', 'company': 'company', 'aging_date': 'aging_date', 'fiscal_year': 'fiscal_year', 'is_advance': None, 'remarks': 'remarks', 'account': 'tax_code', 'name': 'GLMDetail00004', 'idx': 3, 'against_voucher_type': None, 'modified': '2010-05-26 16:48:58', 'against': 'credit_to', 'credit': 'ded_amount', 'parenttype': 'GL Mapper', 'is_opening': 'is_opening', 'posting_date': 'posting_date', 'parentfield': 'fields'}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': '', 'voucher_no': 'name', 'modified_by': 'nabin@webnotestech.com', 'against_voucher': 'name', 'table_field': '', 'transaction_date': 'voucher_date', 'debit': 'value:0', 'docstatus': 0, 'parent': 'Payable Voucher', 'company': 'company', 'aging_date': 'aging_date', 'fiscal_year': 'fiscal_year', 'is_advance': None, 'remarks': 'remarks', 'account': 'credit_to', 'name': 'GLMDetail00005', 'idx': 4, 'against_voucher_type': "value:'Payable Voucher'", 'modified': '2010-05-26 16:48:58', 'against': 'against_expense_account', 'credit': 'total_amount_to_pay', 'parenttype': 'GL Mapper', 'is_opening': 'is_opening', 'posting_date': 'posting_date', 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/erpnext/accounts/GL Mapper/Purchase Invoice/Purchase Invoice.txt b/erpnext/accounts/GL Mapper/Purchase Invoice/Purchase Invoice.txt
new file mode 100644
index 0000000..7fcf199
--- /dev/null
+++ b/erpnext/accounts/GL Mapper/Purchase Invoice/Purchase Invoice.txt
@@ -0,0 +1 @@
+[{'doc_type': 'Purchase Invoice', 'modified_by': 'nabin@webnotestech.com', 'name': 'Purchase Invoice', 'parent': None, 'creation': '2009-03-12 12:09:24', 'modified': '2010-05-26 16:48:58', 'module': 'Accounts', 'doctype': 'GL Mapper', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'parent:doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': 'cost_center', 'voucher_no': 'parent:name', 'modified_by': 'nabin@webnotestech.com', 'against_voucher': None, 'table_field': 'entries', 'transaction_date': 'parent:voucher_date', 'debit': 'amount', 'docstatus': 0, 'parent': 'Purchase Invoice', 'company': 'parent:company', 'aging_date': 'parent:aging_date', 'fiscal_year': 'parent:fiscal_year', 'is_advance': None, 'remarks': 'parent:remarks', 'account': 'expense_head', 'name': 'GLMDetail00002', 'idx': 1, 'against_voucher_type': None, 'modified': '2010-05-26 16:48:58', 'against': 'parent:credit_to', 'credit': 'value:0', 'parenttype': 'GL Mapper', 'is_opening': 'parent:is_opening', 'posting_date': 'parent:posting_date', 'parentfield': 'fields'}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'parent:doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': 'cost_center', 'voucher_no': 'parent:name', 'modified_by': 'nabin@webnotestech.com', 'against_voucher': None, 'table_field': 'purchase_tax_details', 'transaction_date': 'parent:voucher_date', 'debit': "value:d.fields.get('category') != 'For Valuation' and d.fields.get('add_deduct_tax') == 'Add' and d.fields.get('tax_amount') or 0", 'docstatus': 0, 'parent': 'Purchase Invoice', 'company': 'parent:company', 'aging_date': 'parent:aging_date', 'fiscal_year': 'parent:fiscal_year', 'is_advance': None, 'remarks': 'parent:remarks', 'account': 'account_head', 'name': 'GLMDetail00003', 'idx': 2, 'against_voucher_type': None, 'modified': '2010-05-26 16:48:58', 'against': 'parent:credit_to', 'credit': "value:d.fields.get('category') != 'For Valuation' and d.fields.get('add_deduct_tax') == 'Deduct' and d.fields.get('tax_amount') or 0", 'parenttype': 'GL Mapper', 'is_opening': 'parent:is_opening', 'posting_date': 'parent:posting_date', 'parentfield': 'fields'}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': '', 'voucher_no': 'name', 'modified_by': 'nabin@webnotestech.com', 'against_voucher': None, 'table_field': '', 'transaction_date': 'voucher_date', 'debit': 'value:0', 'docstatus': 0, 'parent': 'Purchase Invoice', 'company': 'company', 'aging_date': 'aging_date', 'fiscal_year': 'fiscal_year', 'is_advance': None, 'remarks': 'remarks', 'account': 'tax_code', 'name': 'GLMDetail00004', 'idx': 3, 'against_voucher_type': None, 'modified': '2010-05-26 16:48:58', 'against': 'credit_to', 'credit': 'ded_amount', 'parenttype': 'GL Mapper', 'is_opening': 'is_opening', 'posting_date': 'posting_date', 'parentfield': 'fields'}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': '', 'voucher_no': 'name', 'modified_by': 'nabin@webnotestech.com', 'against_voucher': 'name', 'table_field': '', 'transaction_date': 'voucher_date', 'debit': 'value:0', 'docstatus': 0, 'parent': 'Purchase Invoice', 'company': 'company', 'aging_date': 'aging_date', 'fiscal_year': 'fiscal_year', 'is_advance': None, 'remarks': 'remarks', 'account': 'credit_to', 'name': 'GLMDetail00005', 'idx': 4, 'against_voucher_type': "value:'Purchase Invoice'", 'modified': '2010-05-26 16:48:58', 'against': 'against_expense_account', 'credit': 'total_amount_to_pay', 'parenttype': 'GL Mapper', 'is_opening': 'is_opening', 'posting_date': 'posting_date', 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/erpnext/accounts/GL Mapper/Receivable Voucher/Receivable Voucher.txt b/erpnext/accounts/GL Mapper/Receivable Voucher/Receivable Voucher.txt
deleted file mode 100644
index 72d0175..0000000
--- a/erpnext/accounts/GL Mapper/Receivable Voucher/Receivable Voucher.txt
+++ /dev/null
@@ -1 +0,0 @@
-[{'doc_type': 'Receivable Voucher', 'modified_by': 'Administrator', 'name': 'Receivable Voucher', 'parent': None, 'creation': '2009-03-12 12:09:24', 'modified': '2010-05-17 08:59:14', 'module': 'Accounts', 'doctype': 'GL Mapper', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'parent:doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': 'cost_center', 'voucher_no': 'parent:name', 'modified_by': 'Administrator', 'against_voucher': None, 'table_field': 'entries', 'transaction_date': 'parent:voucher_date', 'debit': 'value:0', 'docstatus': 0, 'parent': 'Receivable Voucher', 'company': 'parent:company', 'aging_date': 'parent:aging_date', 'fiscal_year': 'parent:fiscal_year', 'is_advance': None, 'remarks': 'parent:remarks', 'account': 'income_account', 'name': 'GLMDetail00006', 'idx': 1, 'against_voucher_type': None, 'modified': '2010-05-17 08:59:14', 'against': 'parent:debit_to', 'credit': 'amount', 'parenttype': 'GL Mapper', 'is_opening': 'parent:is_opening', 'posting_date': 'parent:posting_date', 'parentfield': 'fields'}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'parent:doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': 'cost_center_other_charges', 'voucher_no': 'parent:name', 'modified_by': 'Administrator', 'against_voucher': None, 'table_field': 'other_charges', 'transaction_date': 'parent:voucher_date', 'debit': 'value:0', 'docstatus': 0, 'parent': 'Receivable Voucher', 'company': 'parent:company', 'aging_date': 'parent:aging_date', 'fiscal_year': 'parent:fiscal_year', 'is_advance': None, 'remarks': 'parent:remarks', 'account': 'account_head', 'name': 'GLMDetail00007', 'idx': 2, 'against_voucher_type': None, 'modified': '2010-05-17 08:59:14', 'against': 'parent:debit_to', 'credit': 'tax_amount', 'parenttype': 'GL Mapper', 'is_opening': 'parent:is_opening', 'posting_date': 'parent:posting_date', 'parentfield': 'fields'}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': '', 'voucher_no': 'name', 'modified_by': 'Administrator', 'against_voucher': 'name', 'table_field': '', 'transaction_date': 'voucher_date', 'debit': 'grand_total', 'docstatus': 0, 'parent': 'Receivable Voucher', 'company': 'company', 'aging_date': 'aging_date', 'fiscal_year': 'fiscal_year', 'is_advance': None, 'remarks': 'remarks', 'account': 'debit_to', 'name': 'GLMDetail00008', 'idx': 3, 'against_voucher_type': "value:'Receivable Voucher'", 'modified': '2010-05-17 08:59:14', 'against': 'against_income_account', 'credit': 'value:0', 'parenttype': 'GL Mapper', 'is_opening': 'is_opening', 'posting_date': 'posting_date', 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/erpnext/accounts/GL Mapper/Sales Invoice/Sales Invoice.txt b/erpnext/accounts/GL Mapper/Sales Invoice/Sales Invoice.txt
new file mode 100644
index 0000000..4a4df3c
--- /dev/null
+++ b/erpnext/accounts/GL Mapper/Sales Invoice/Sales Invoice.txt
@@ -0,0 +1 @@
+[{'doc_type': 'Sales Invoice', 'modified_by': 'Administrator', 'name': 'Sales Invoice', 'parent': None, 'creation': '2009-03-12 12:09:24', 'modified': '2010-05-17 08:59:14', 'module': 'Accounts', 'doctype': 'GL Mapper', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'parent:doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': 'cost_center', 'voucher_no': 'parent:name', 'modified_by': 'Administrator', 'against_voucher': None, 'table_field': 'entries', 'transaction_date': 'parent:voucher_date', 'debit': 'value:0', 'docstatus': 0, 'parent': 'Sales Invoice', 'company': 'parent:company', 'aging_date': 'parent:aging_date', 'fiscal_year': 'parent:fiscal_year', 'is_advance': None, 'remarks': 'parent:remarks', 'account': 'income_account', 'name': 'GLMDetail00006', 'idx': 1, 'against_voucher_type': None, 'modified': '2010-05-17 08:59:14', 'against': 'parent:debit_to', 'credit': 'amount', 'parenttype': 'GL Mapper', 'is_opening': 'parent:is_opening', 'posting_date': 'parent:posting_date', 'parentfield': 'fields'}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'parent:doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': 'cost_center_other_charges', 'voucher_no': 'parent:name', 'modified_by': 'Administrator', 'against_voucher': None, 'table_field': 'other_charges', 'transaction_date': 'parent:voucher_date', 'debit': 'value:0', 'docstatus': 0, 'parent': 'Sales Invoice', 'company': 'parent:company', 'aging_date': 'parent:aging_date', 'fiscal_year': 'parent:fiscal_year', 'is_advance': None, 'remarks': 'parent:remarks', 'account': 'account_head', 'name': 'GLMDetail00007', 'idx': 2, 'against_voucher_type': None, 'modified': '2010-05-17 08:59:14', 'against': 'parent:debit_to', 'credit': 'tax_amount', 'parenttype': 'GL Mapper', 'is_opening': 'parent:is_opening', 'posting_date': 'parent:posting_date', 'parentfield': 'fields'}, {'creation': '2009-03-12 12:09:24', 'voucher_type': 'doctype', 'doctype': 'GL Mapper Detail', 'owner': 'Administrator', 'cost_center': '', 'voucher_no': 'name', 'modified_by': 'Administrator', 'against_voucher': 'name', 'table_field': '', 'transaction_date': 'voucher_date', 'debit': 'grand_total', 'docstatus': 0, 'parent': 'Sales Invoice', 'company': 'company', 'aging_date': 'aging_date', 'fiscal_year': 'fiscal_year', 'is_advance': None, 'remarks': 'remarks', 'account': 'debit_to', 'name': 'GLMDetail00008', 'idx': 3, 'against_voucher_type': "value:'Sales Invoice'", 'modified': '2010-05-17 08:59:14', 'against': 'against_income_account', 'credit': 'value:0', 'parenttype': 'GL Mapper', 'is_opening': 'is_opening', 'posting_date': 'posting_date', 'parentfield': 'fields'}]
\ No newline at end of file
diff --git a/erpnext/accounts/Module Def/Accounts/Accounts.txt b/erpnext/accounts/Module Def/Accounts/Accounts.txt
deleted file mode 100644
index f9c36c8..0000000
--- a/erpnext/accounts/Module Def/Accounts/Accounts.txt
+++ /dev/null
@@ -1,411 +0,0 @@
-# Module Def, Accounts
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-09-25 10:50:37',
-		'docstatus': 0,
-		'modified': '2011-12-07 16:18:28',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'name': '__common__',
-		'parent': 'Accounts',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def'
-	},
-
-	# These values are common for all Module Def Item
-	{
-		'doctype': 'Module Def Item',
-		'name': '__common__',
-		'parent': 'Accounts',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-
-	# These values are common for all Module Def
-	{
-		'disabled': 'No',
-		'doctype': u'Module Def',
-		'doctype_list': 'GL Mapper, Journal Voucher\nGL Mapper, Payable Voucher\nGL Mapper, Receivable Voucher\nDocType Label, Receivable Voucher\nDocType Label, Payable Voucher',
-		'file_list': 'finance.gif,FileData/00210',
-		'is_hidden': 'No',
-		'last_updated_date': '2010-12-08 10:13:30',
-		'module_desc': 'Data about your payables, receivables and books of accounts',
-		'module_icon': 'Accounts.gif',
-		'module_label': 'Accounts',
-		'module_name': 'Accounts',
-		'module_seq': 5,
-		'name': '__common__'
-	},
-
-	# Module Def, Accounts
-	{
-		'doctype': u'Module Def',
-		'name': 'Accounts'
-	},
-
-	# Module Def Item
-	{
-		'click_function': "show_chart_browser('Accounts Browser','Account')",
-		'description': 'Manage your accounts',
-		'display_name': 'Chart of Accounts',
-		'doc_name': 'Accounts Browser',
-		'doc_type': 'Pages',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'click_function': "show_chart_browser('Accounts Browser','Cost Center')",
-		'description': 'Manage your cost centers',
-		'display_name': 'Chart of Cost Centers',
-		'doc_name': 'Accounts Browser',
-		'doc_type': 'Pages',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Regular journal entry',
-		'display_name': 'Journal Voucher',
-		'doc_name': 'Journal Voucher',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'voucher_type\nvoucher_date\nfiscal_year\ntotal_debit\ntotal_credit'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Outgoing Invoice to your customers',
-		'display_name': 'Sales Invoice',
-		'doc_name': 'Receivable Voucher',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'voucher_date\ndue_date\ndebit_to\ngrand_total\noutstanding_amount'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Incoming invoice from your service providers',
-		'display_name': 'Purchase Invoice',
-		'doc_name': 'Payable Voucher',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'voucher_date\ncredit_to\nbill_no\ngrand_total\noutstanding_amount'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Lease Agreement for Vehicles',
-		'display_name': 'Lease Agreement',
-		'doc_name': 'Lease Agreement',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Profit & Loss and Balance Sheet builder',
-		'display_name': 'Financial Statements',
-		'doc_name': 'Financial Statements',
-		'doc_type': 'Pages',
-		'doctype': 'Module Def Item',
-		'icon': 'table.gif'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Update your actual clearance dates and find out if bank ledger tallies with your bank statement.',
-		'display_name': 'Bank Reconciliation',
-		'doc_name': 'Bank Reconciliation',
-		'doc_type': 'Single DocType',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Link your invoices and payment vouchers to clear/update outstanding amount',
-		'display_name': 'Internal Reconciliation',
-		'doc_name': 'Internal Reconciliation',
-		'doc_type': 'Single DocType',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'TDS Payment',
-		'doc_name': 'TDS Payment',
-		'doc_type': 'Setup Forms',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'TDS Return Acknowledgement',
-		'doc_name': 'TDS Return Acknowledgement',
-		'doc_type': 'Setup Forms',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Form 16A',
-		'doc_name': 'Form 16A',
-		'doc_type': 'Setup Forms',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Account closing entry (Profit Booking) on any date',
-		'display_name': 'Period Closing Voucher',
-		'doc_name': 'Period Closing Voucher',
-		'doc_type': 'Setup Forms',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'description': 'You can export balance of selected ledgers within a specific period',
-		'display_name': 'Ledger Balance Export',
-		'doc_name': 'Ledger Balance Export',
-		'doc_type': 'Single DocType',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Track C-Form received from customers',
-		'display_name': 'C-Form',
-		'doc_name': 'C-Form',
-		'doc_type': 'Setup Forms',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'General Ledger',
-		'doc_name': 'GL Entry',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Accounts Receivable',
-		'doc_name': 'GL Entry',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Accounts Payable',
-		'doc_name': 'GL Entry',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Bank Reconciliation Statement',
-		'doc_name': 'Journal Voucher Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Trial Balance',
-		'doc_name': 'Account',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Sales Register',
-		'doc_name': 'Receivable Voucher',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Purchase Register',
-		'doc_name': 'Payable Voucher',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Bank Clearance report',
-		'doc_name': 'Journal Voucher Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Monthly Ledger Summary Report',
-		'doc_name': 'GL Entry',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Collection Report',
-		'doc_name': 'Journal Voucher Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Total amout collection for a period - Customerwise',
-		'doc_name': 'Account',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Payment Report',
-		'doc_name': 'Journal Voucher Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Itemwise Sales Register',
-		'doc_name': 'RV Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Itemwise Purchase Register',
-		'doc_name': 'PV Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Cost Center wise Expense',
-		'doc_name': 'GL Entry',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'TDS Return',
-		'doc_name': 'TDS Payment Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Budget Variance Report',
-		'doc_name': 'Budget Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Payment Receipt Report',
-		'doc_name': 'GL Entry',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Track total commission given to your Business Associate',
-		'display_name': 'Business Associate Commission Report',
-		'doc_name': 'Receivable Voucher',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Lease Agreement List',
-		'doc_name': 'GL Entry',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Lease Monthly Future Installment Inflows',
-		'doc_name': 'GL Entry',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Lease Overdue Age Wise',
-		'doc_name': 'GL Entry',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Lease Overdue List',
-		'doc_name': 'GL Entry',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Lease Receipts Client Wise',
-		'doc_name': 'GL Entry',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Lease Yearly Future Installment Inflows',
-		'doc_name': 'GL Entry',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Voucher wise tax details',
-		'doc_name': 'RV Tax Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Accounts Manager'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Accounts User'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/Print Format/Cheque Printing Format/Cheque Printing Format.txt b/erpnext/accounts/Print Format/Cheque Printing Format/Cheque Printing Format.txt
index aa90311..e3355ec 100755
--- a/erpnext/accounts/Print Format/Cheque Printing Format/Cheque Printing Format.txt
+++ b/erpnext/accounts/Print Format/Cheque Printing Format/Cheque Printing Format.txt
@@ -3,25 +3,26 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-03-28 15:17:25',
+		'creation': '2012-04-11 13:16:56',
 		'docstatus': 0,
-		'modified': '2011-03-28 12:33:24',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
+		'modified': '2012-04-13 12:24:20',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Print Format
 	{
+		'doc_type': u'Journal Voucher',
 		'doctype': 'Print Format',
-		'html': '<!--  p.big {line-height: 200%}  .noborder td { border: 0px solid #fff; }   -->\n<div style="position: relative;">\n<h3><script>doc.company</script><br /> <br /> \n<hr />\nPAYMENT ADVICE</h3>\n<table class="noborder" style="width: 100%;">\n<tbody>\n<tr>\n<td style="vertical-align: top;" width="50%">To :<br />\n<script type="text/javascript">// <![CDATA[\ndoc.pay_to_recd_from\n// ]]></script>\n</td>\n<td width="50%">\n<table class="noborder" width="100%">\n<tbody>\n<tr>\n<td width="30%">Voucher No :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndoc.name\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td width="30%">Voucher Date :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.voucher_date)\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td width="30%">Cheque No :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.cheque_no)\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td width="30%">Cheque Date :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.cheque_date)\n// ]]></script>\n</td>\n</tr>\n</tbody>\n</table>\n</td>\n</tr>\n</tbody>\n</table>\n<br /> <strong>We are pleased to enclose our cheque in full/part Settlement of your under noted bills</strong> <br /> \n<hr />\n<table class="noborder" width="100%">\n<tbody>\n<tr>\n<td width="70%">&nbsp;</td>\n<td width="15%">Total :</td>\n<td class="pos_left" width="15%">\n<script type="text/javascript">// <![CDATA[\ndoc.total_amount\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td colspan="3">Narration :\n<script type="text/javascript">// <![CDATA[\nreplace_newlines(doc.remark)\n// ]]></script>\n<br /><br /><br /></td>\n</tr>\n</tbody>\n</table>\n<div style="position: absolute; top: 14cm; left: 0cm;">Prepared By</div>\n<div style="position: absolute; top: 14cm; left: 5.5cm;">Authorised Signatory</div>\n<div style="position: absolute; top: 14cm; left: 11cm;">Received Payment as Above</div>\n<div style="position: absolute; top: 16.4cm; left: 5.9cm;"><strong>_____________</strong></div>\n<div style="position: absolute; top: 16.7cm; left: 6cm;"><strong>A/c Payee</strong></div>\n<div style="position: absolute; top: 16.7cm; left: 5.9cm;"><strong>_____________</strong></div>\n<div style="position: absolute; top: 16.9cm; left: 12cm;">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.cheque_date)\n// ]]></script>\n</div>\n<div style="position: absolute; top: 17.9cm; left: 1cm;">\n<script type="text/javascript">// <![CDATA[\ndoc.pay_to_recd_from\n// ]]></script>\n</div>\n<div style="position: absolute; top: 18.6cm; left: 1cm; width: 7cm;">\n<script type="text/javascript">// <![CDATA[\ndoc.total_amount_in_words\n// ]]></script>\n</div>\n<div style="position: absolute; top: 19.7cm; left: 12cm;">\n<script type="text/javascript">// <![CDATA[\ndoc.total_amount\n// ]]></script>\n</div>\n</div>',
-		'module': 'Accounts',
+		'html': u'<!--  p.big {line-height: 200%}  .noborder td { border: 0px solid #fff; }   -->\n<div style="position: relative;">\n<h3><script>doc.company</script><br /> <br /> \n<hr />\nPAYMENT ADVICE</h3>\n<table class="noborder" style="width: 100%;">\n<tbody>\n<tr>\n<td style="vertical-align: top;" width="50%">To :<br />\n<script type="text/javascript">// <![CDATA[\ndoc.pay_to_recd_from\n// ]]></script>\n</td>\n<td width="50%">\n<table class="noborder" width="100%">\n<tbody>\n<tr>\n<td width="30%">Voucher No :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndoc.name\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td width="30%">Voucher Date :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.voucher_date)\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td width="30%">Cheque No :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.cheque_no)\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td width="30%">Cheque Date :</td>\n<td width="70%">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.cheque_date)\n// ]]></script>\n</td>\n</tr>\n</tbody>\n</table>\n</td>\n</tr>\n</tbody>\n</table>\n<br /> <strong>We are pleased to enclose our cheque in full/part Settlement of your under noted bills</strong> <br /> \n<hr />\n<table class="noborder" width="100%">\n<tbody>\n<tr>\n<td width="70%">&nbsp;</td>\n<td width="15%">Total :</td>\n<td class="pos_left" width="15%">\n<script type="text/javascript">// <![CDATA[\ndoc.total_amount\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td colspan="3">Narration :\n<script type="text/javascript">// <![CDATA[\nreplace_newlines(doc.remark)\n// ]]></script>\n<br /><br /><br /></td>\n</tr>\n</tbody>\n</table>\n<div style="position: absolute; top: 14cm; left: 0cm;">Prepared By</div>\n<div style="position: absolute; top: 14cm; left: 5.5cm;">Authorised Signatory</div>\n<div style="position: absolute; top: 14cm; left: 11cm;">Received Payment as Above</div>\n<div style="position: absolute; top: 16.4cm; left: 5.9cm;"><strong>_____________</strong></div>\n<div style="position: absolute; top: 16.7cm; left: 6cm;"><strong>A/c Payee</strong></div>\n<div style="position: absolute; top: 16.7cm; left: 5.9cm;"><strong>_____________</strong></div>\n<div style="position: absolute; top: 16.9cm; left: 12cm;">\n<script type="text/javascript">// <![CDATA[\ndate.str_to_user(doc.cheque_date)\n// ]]></script>\n</div>\n<div style="position: absolute; top: 17.9cm; left: 1cm;">\n<script type="text/javascript">// <![CDATA[\ndoc.pay_to_recd_from\n// ]]></script>\n</div>\n<div style="position: absolute; top: 18.6cm; left: 1cm; width: 7cm;">\n<script type="text/javascript">// <![CDATA[\ndoc.total_amount_in_words\n// ]]></script>\n</div>\n<div style="position: absolute; top: 19.7cm; left: 12cm;">\n<script type="text/javascript">// <![CDATA[\ndoc.total_amount\n// ]]></script>\n</div>\n</div>',
+		'module': u'Accounts',
 		'name': '__common__',
-		'standard': 'Yes'
+		'standard': u'Yes'
 	},
 
 	# Print Format, Cheque Printing Format
 	{
 		'doctype': 'Print Format',
-		'name': 'Cheque Printing Format'
+		'name': u'Cheque Printing Format'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt b/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt
index 8664b38..82eeaf0 100644
--- a/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt
+++ b/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt
@@ -12,9 +12,9 @@
 
 	# These values are common for all Print Format
 	{
-		'doc_type': u'Receivable Voucher',
+		'doc_type': u'Sales Invoice',
 		'doctype': 'Print Format',
-		'html': u'<html>\n<head>\n<!--Other charges function-->\n<script>\nvar make_row = function(title,val,bold){\nvar bstart = \'<b>\'; var bend = \'</b>\';\nreturn \'<tr><td style="width:50%">\'+(bold?bstart:\'\')+title+(bold?bend:\'\')+\'</td>\'\n        +\'<td style="width:20%">\'+doc.currency+\'</td>\'\n        +\'<td style="width:30%;text-align:right">\'+(val?val:\'0.00\')+\'</td>\'\n        +\'</tr>\'\n}\nvar make_row1 = function(title,val,bold){\n    var bstart = \'<b>\'; var bend = \'</b>\';\n    \n    return \'<tr style="font-family:courier new; line-height:150%"><td style="width:50%">\'+(bold?bstart:\'\')+title+(bold?bend:\'\')+\'</td>\'\n            +\'<td style="width:50%;text-align:right">\'+(bold?bstart:\'\')+(val?val:\'0.00\')+(bold?bend:\'\')+\'</td>\'\n            +\'</tr>\'\n}\n\nfunction get_letter_head() {\n    // add letter head\n    var cp = wn.boot.control_panel;\n    if(doc.letter_head)\n        var lh= cstr(_p.letter_heads[doc.letter_head]);\n    else if(cp.letter_head)\n        var lh= cp.letter_head;\n    else \n        var lh= \'\';\n        \n    return lh;\n}\n\nfunction get_tax_details(){\n    var cl = getchildren(\'RV Tax Detail\',doc.name,\'other_charges\');\n    var out = \'\';\n\n    out += \'<div><table style="float: right;">\';\n    for(var i=0;i<cl.length;i++){\n        if(cl[i].tax_amount) {\n            out += make_row1(cl[i].description,fmt_money(convert_rate(cl[i].tax_amount)),0);\n        }\n    }\n    out += make_row1(\'TOTAL\',doc.currency + " " + fmt_money(convert_rate(doc.grand_total)),1);\n    out +=\'</table></div>\';\n    return out;\n}\n\nfunction convert_rate(val){    \n    var new_val = flt(val)/flt(doc.conversion_rate);\n    return new_val;\n}\n</script>\n<style>\n    table, td, tr, div, span {\n        font-family: courier new;\n        line-height: 200%;\n    }\n</style>\n</head>\n\n<body>\n<table width="100%" style="font-family: courier new; line-height:200%">\n<tr>\n    <td align="left">NO: <script>doc.name</script></td>\n    <td align="right">DATE: <script>date.str_to_user(doc.posting_date)</script></td>\n</tr>\n<tr>\n    <td>M/s <script>doc.contact_display</script></td>\n</tr>\n</table>\n<!--Item Table-->\n<div>\n<script>\nvar t = print_table(\'Receivable Voucher\', doc.name, \'entries\', \'RV Detail\',\n        [\'description\',\'qty\',\'export_rate\',\'export_amount\'], [\'ITEM\', \'QTY\',\'RATE\',\'AMOUNT\'],\n        [\'35%\',\'20%\',\'20%\',\'25%\']);\nif(t.appendChild) { // single\n    out = t.innerHTML.replace(/style="/gi,\'style="font-family:courier new;line-height:150%;\');\n} else { //multiple\n    out = \'<table class="None" border="0px" width="100%" style="border:0px; font-family:courier-new">\';\n\n    for(var i=0;i<t.length;i++) {\n        if(i==0) {\n            out += \'<tr>\' + t[i].childNodes[0].childNodes[0].childNodes[0].innerHTML\n                .replace(/style="border: 1px solid rgb\\(0, 0, 0\\);/gi,\'style="font-family:courier new;\')\n                + \'</tr>\';\n        }\n        out += \'<tr>\' + t[i].childNodes[0].childNodes[0].childNodes[1].innerHTML\n                .replace(/style="border: 1px solid rgb\\(0, 0, 0\\);/gi,\'style="font-family:courier new;\')\n                + \'</tr>\';\n    }\n    out += \'</table>\';\n}\nout;\n</script>\n</div>\n<!--Tax table-->\n<div><script>get_tax_details();</script></div><br />\n<table style="font-family:courier new;">\n    <tr><td><b><script>doc.terms</script></b></td></tr>\n    <tr><td nowrap><b>For <script>doc.company</script></b></td></tr>\n    <tr><td>&nbsp;</td></tr>\n    <tr><td nowrap><b>Signatory</b></td></tr>\n</table>\n</body>\n</html>\n',
+		'html': u'<html>\n<head>\n<!--Other charges function-->\n<script>\nvar make_row = function(title,val,bold){\nvar bstart = \'<b>\'; var bend = \'</b>\';\nreturn \'<tr><td style="width:50%">\'+(bold?bstart:\'\')+title+(bold?bend:\'\')+\'</td>\'\n        +\'<td style="width:20%">\'+doc.currency+\'</td>\'\n        +\'<td style="width:30%;text-align:right">\'+(val?val:\'0.00\')+\'</td>\'\n        +\'</tr>\'\n}\nvar make_row1 = function(title,val,bold){\n    var bstart = \'<b>\'; var bend = \'</b>\';\n    \n    return \'<tr style="font-family:courier new; line-height:150%"><td style="width:50%">\'+(bold?bstart:\'\')+title+(bold?bend:\'\')+\'</td>\'\n            +\'<td style="width:50%;text-align:right">\'+(bold?bstart:\'\')+(val?val:\'0.00\')+(bold?bend:\'\')+\'</td>\'\n            +\'</tr>\'\n}\n\nfunction get_letter_head() {\n    // add letter head\n    var cp = wn.boot.control_panel;\n    if(doc.letter_head)\n        var lh= cstr(_p.letter_heads[doc.letter_head]);\n    else if(cp.letter_head)\n        var lh= cp.letter_head;\n    else \n        var lh= \'\';\n        \n    return lh;\n}\n\nfunction get_tax_details(){\n    var cl = getchildren(\'Sales Taxes and Charges\',doc.name,\'other_charges\');\n    var out = \'\';\n\n    out += \'<div><table style="float: right;">\';\n    for(var i=0;i<cl.length;i++){\n        if(cl[i].tax_amount) {\n            out += make_row1(cl[i].description,fmt_money(convert_rate(cl[i].tax_amount)),0);\n        }\n    }\n    out += make_row1(\'TOTAL\',doc.currency + " " + fmt_money(convert_rate(doc.grand_total)),1);\n    out +=\'</table></div>\';\n    return out;\n}\n\nfunction convert_rate(val){    \n    var new_val = flt(val)/flt(doc.conversion_rate);\n    return new_val;\n}\n</script>\n<style>\n    table, td, tr, div, span {\n        font-family: courier new;\n        line-height: 200%;\n    }\n</style>\n</head>\n\n<body>\n<table width="100%" style="font-family: courier new; line-height:200%">\n<tr>\n    <td align="left">NO: <script>doc.name</script></td>\n    <td align="right">DATE: <script>date.str_to_user(doc.posting_date)</script></td>\n</tr>\n<tr>\n    <td>M/s <script>doc.contact_display</script></td>\n</tr>\n</table>\n<!--Item Table-->\n<div>\n<script>\nvar t = print_table(\'Sales Invoice\', doc.name, \'entries\', \'Sales Invoice Item\',\n        [\'description\',\'qty\',\'export_rate\',\'export_amount\'], [\'ITEM\', \'QTY\',\'RATE\',\'AMOUNT\'],\n        [\'35%\',\'20%\',\'20%\',\'25%\']);\nif(t.appendChild) { // single\n    out = t.innerHTML.replace(/style="/gi,\'style="font-family:courier new;line-height:150%;\');\n} else { //multiple\n    out = \'<table class="None" border="0px" width="100%" style="border:0px; font-family:courier-new">\';\n\n    for(var i=0;i<t.length;i++) {\n        if(i==0) {\n            out += \'<tr>\' + t[i].childNodes[0].childNodes[0].childNodes[0].innerHTML\n                .replace(/style="border: 1px solid rgb\\(0, 0, 0\\);/gi,\'style="font-family:courier new;\')\n                + \'</tr>\';\n        }\n        out += \'<tr>\' + t[i].childNodes[0].childNodes[0].childNodes[1].innerHTML\n                .replace(/style="border: 1px solid rgb\\(0, 0, 0\\);/gi,\'style="font-family:courier new;\')\n                + \'</tr>\';\n    }\n    out += \'</table>\';\n}\nout;\n</script>\n</div>\n<!--Tax table-->\n<div><script>get_tax_details();</script></div><br />\n<table style="font-family:courier new;">\n    <tr><td><b><script>doc.terms</script></b></td></tr>\n    <tr><td nowrap><b>For <script>doc.company</script></b></td></tr>\n    <tr><td>&nbsp;</td></tr>\n    <tr><td nowrap><b>Signatory</b></td></tr>\n</table>\n</body>\n</html>\n',
 		'module': u'Accounts',
 		'name': '__common__',
 		'standard': u'Yes'
diff --git a/erpnext/accounts/Print Format/Payment Receipt Voucher/Payment Receipt Voucher.txt b/erpnext/accounts/Print Format/Payment Receipt Voucher/Payment Receipt Voucher.txt
index 932df2e..4b56d72 100755
--- a/erpnext/accounts/Print Format/Payment Receipt Voucher/Payment Receipt Voucher.txt
+++ b/erpnext/accounts/Print Format/Payment Receipt Voucher/Payment Receipt Voucher.txt
@@ -3,25 +3,26 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-03-28 15:17:25',
+		'creation': '2012-04-11 13:16:56',
 		'docstatus': 0,
-		'modified': '2011-03-28 12:31:40',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
+		'modified': '2012-04-13 12:24:59',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Print Format
 	{
+		'doc_type': u'Journal Voucher',
 		'doctype': 'Print Format',
-		'html': '<div style="position: relative;">\n<h3 align="center"><script>doc.company</script>\n</div>\n\n<font size="4">\n<table class=\'simpletable\'>\n<tr>\n<td><b> Receipt No.: </b></td>\n<td><script>doc.name</script></td>\n</tr>\n<tr>\n<td><b> Date : </b></td>\n<td><script>date.str_to_user(doc.voucher_date)</script></td>\n</tr>      \n<tr>\n<td><b> Remark: </b></td>\n<td><script> doc.remark </script></td>\n</tr>\n<tr>\n<td><b> Received From: </b></td>\n<td><b><script> doc.pay_to_rec_from </script></b></td>\n</tr>\n</table>\n<br>\n\n<div><b><script>doc.total_amount</script></b> </td></div><br>\n<div style="text-align:left"><b><script>doc.total_amount_in_words</script></b></div><br>\n<div>This receipt is issued subject to realization of the Cheque</div>\n</font>\n<br>\n<table class="noborder">\n<tr>\n<td style = "text-align = right;"><h3>For <script>doc.company</script>,</h3><br><div>(Authorised Signatory)</div></td>\n</tr>\n</table>',
-		'module': 'Accounts',
+		'html': u'<div style="position: relative;">\n<h3 align="center"><script>doc.company</script>\n</div>\n\n<font size="4">\n<table class=\'simpletable\'>\n<tr>\n<td><b> Receipt No.: </b></td>\n<td><script>doc.name</script></td>\n</tr>\n<tr>\n<td><b> Date : </b></td>\n<td><script>date.str_to_user(doc.voucher_date)</script></td>\n</tr>      \n<tr>\n<td><b> Remark: </b></td>\n<td><script> doc.remark </script></td>\n</tr>\n<tr>\n<td><b> Received From: </b></td>\n<td><b><script> doc.pay_to_rec_from </script></b></td>\n</tr>\n</table>\n<br>\n\n<div><b><script>doc.total_amount</script></b> </td></div><br>\n<div style="text-align:left"><b><script>doc.total_amount_in_words</script></b></div><br>\n<div>This receipt is issued subject to realization of the Cheque</div>\n</font>\n<br>\n<table class="noborder">\n<tr>\n<td style = "text-align = right;"><h3>For <script>doc.company</script>,</h3><br><div>(Authorised Signatory)</div></td>\n</tr>\n</table>',
+		'module': u'Accounts',
 		'name': '__common__',
-		'standard': 'Yes'
+		'standard': u'Yes'
 	},
 
 	# Print Format, Payment Receipt Voucher
 	{
 		'doctype': 'Print Format',
-		'name': 'Payment Receipt Voucher'
+		'name': u'Payment Receipt Voucher'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt b/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt
index 510e922..8238600 100644
--- a/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt
+++ b/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt
@@ -12,9 +12,9 @@
 
 	# These values are common for all Print Format
 	{
-		'doc_type': u'Receivable Voucher',
+		'doc_type': u'Sales Invoice',
 		'doctype': 'Print Format',
-		'html': u'<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Georgia", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Georgia", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Receivable Voucher\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'entries\',\n\t\t\t\t\'RV Detail\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'export_rate\', \'export_amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'20%\', \'37%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'RV Tax Detail\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>\'<h1>\' + (doc.select_print_heading || \'Invoice\') + \'</h1>\'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=40%><b>Invoice Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.posting_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Due Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.due_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total/doc.conversion_rate)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
+		'html': u'<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Georgia", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Georgia", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Sales Invoice\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'entries\',\n\t\t\t\t\'Sales Invoice Item\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'export_rate\', \'export_amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'20%\', \'37%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'Sales Taxes and Charges\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>\'<h1>\' + (doc.select_print_heading || \'Invoice\') + \'</h1>\'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=40%><b>Invoice Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.posting_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Due Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.due_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total/doc.conversion_rate)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
 		'module': u'Accounts',
 		'name': '__common__',
 		'standard': u'Yes'
diff --git a/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt b/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt
index 3c44fc7..7d58d65 100644
--- a/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt
+++ b/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt
@@ -12,9 +12,9 @@
 
 	# These values are common for all Print Format
 	{
-		'doc_type': u'Receivable Voucher',
+		'doc_type': u'Sales Invoice',
 		'doctype': 'Print Format',
-		'html': u'<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Helvetica", "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Helvetica", "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Receivable Voucher\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'entries\',\n\t\t\t\t\'RV Detail\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'export_rate\', \'export_amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'20%\', \'37%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'RV Tax Detail\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>\'<h1>\' + (doc.select_print_heading || \'Invoice\') + \'</h1>\'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style="height:15px"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class=\'imp-details\'>\n\t\t\t\t\t\t<td><b>Invoice No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=40%><b>Invoice Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.posting_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Due Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.due_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total/doc.conversion_rate)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\' class=\'imp-details\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>\n',
+		'html': u'<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Helvetica", "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Helvetica", "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Sales Invoice\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'entries\',\n\t\t\t\t\'Sales Invoice Item\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'export_rate\', \'export_amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'20%\', \'37%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'Sales Taxes and Charges\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>\'<h1>\' + (doc.select_print_heading || \'Invoice\') + \'</h1>\'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style="height:15px"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class=\'imp-details\'>\n\t\t\t\t\t\t<td><b>Invoice No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=40%><b>Invoice Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.posting_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Due Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.due_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total/doc.conversion_rate)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\' class=\'imp-details\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>\n',
 		'module': u'Accounts',
 		'name': '__common__',
 		'standard': u'Yes'
diff --git a/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt b/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt
index b91f5cd..354e65f 100644
--- a/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt
+++ b/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt
@@ -12,9 +12,9 @@
 
 	# These values are common for all Print Format
 	{
-		'doc_type': u'Receivable Voucher',
+		'doc_type': u'Sales Invoice',
 		'doctype': 'Print Format',
-		'html': u'<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Receivable Voucher\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'entries\',\n\t\t\t\t\'RV Detail\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'export_rate\', \'export_amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'20%\', \'37%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'RV Tax Detail\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>\'<h1>\' + (doc.select_print_heading || \'Invoice\') + \'</h1>\'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=40%><b>Invoice Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.posting_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Due Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.due_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total/doc.conversion_rate)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
+		'html': u'<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Sales Invoice\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'entries\',\n\t\t\t\t\'Sales Invoice Item\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'export_rate\', \'export_amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'20%\', \'37%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'Sales Taxes and Charges\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>\'<h1>\' + (doc.select_print_heading || \'Invoice\') + \'</h1>\'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=40%><b>Invoice Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.posting_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Due Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.due_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total/doc.conversion_rate)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
 		'module': u'Accounts',
 		'name': '__common__',
 		'standard': u'Yes'
diff --git a/erpnext/accounts/Role/Accounts Manager/Accounts Manager.txt b/erpnext/accounts/Role/Accounts Manager/Accounts Manager.txt
deleted file mode 100644
index 6f6759c..0000000
--- a/erpnext/accounts/Role/Accounts Manager/Accounts Manager.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Accounts Manager
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2009-03-19 14:57:46',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Accounts',
-		'name': '__common__',
-		'role_name': 'Accounts Manager'
-	},
-
-	# Role, Accounts Manager
-	{
-		'doctype': 'Role',
-		'name': 'Accounts Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/Role/Accounts User/Accounts User.txt b/erpnext/accounts/Role/Accounts User/Accounts User.txt
deleted file mode 100644
index 519924e..0000000
--- a/erpnext/accounts/Role/Accounts User/Accounts User.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Accounts User
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2010-04-08 12:05:21',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Accounts',
-		'name': '__common__',
-		'role_name': 'Accounts User'
-	},
-
-	# Role, Accounts User
-	{
-		'doctype': 'Role',
-		'name': 'Accounts User'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/__init__.py b/erpnext/accounts/__init__.py
index 44d6aec..c750d25 100644
--- a/erpnext/accounts/__init__.py
+++ b/erpnext/accounts/__init__.py
@@ -18,6 +18,11 @@
 from webnotes.utils import flt
 from webnotes.model.code import get_obj
 
+install_docs = [
+	{"doctype":"Role", "role_name":"Accounts Manager", "name":"Accounts Manager"},
+	{"doctype":"Role", "role_name":"Accounts User", "name":"Accounts User"}
+]
+
 @webnotes.whitelist()
 def get_default_bank_account():
 	"""
@@ -67,9 +72,9 @@
 		}, { ... }, ...]
 	"""
 	if doc.get('return_type')=='Sales Return':
-		obj = get_obj('Receivable Voucher', doc.get('sales_invoice_no'), with_children=1)
+		obj = get_obj('Sales Invoice', doc.get('sales_invoice_no'), with_children=1)
 	else:
-		obj = get_obj('Payable Voucher', doc.get('purchase_invoice_no'), with_children=1)
+		obj = get_obj('Purchase Invoice', doc.get('purchase_invoice_no'), with_children=1)
 	if not obj.doc.docstatus==1: return
 
 	# Build invoice account jv detail record
@@ -200,14 +205,14 @@
 	
 	dn_obj = get_obj('Delivery Note', doc['delivery_note_no'], with_children=1)
 	
-	inv_list = get_inv_list('tabRV Detail', 'delivery_note', doc['delivery_note_no'])
+	inv_list = get_inv_list('tabSales Invoice Item', 'delivery_note', doc['delivery_note_no'])
 
 	if inv_list:
 		jv_details_list = get_jv_details_from_inv_list(doc, children, fiscal_year, inv_list, jv_details_list)
 	
 	if not (inv_list and jv_details_list):
 		so_list = get_prev_doc_list(dn_obj, 'Sales Order')
-		inv_list = get_inv_list('tabRV Detail', 'sales_order', so_list)
+		inv_list = get_inv_list('tabSales Invoice Item', 'sales_order', so_list)
 		if inv_list:
 			jv_details_list = get_jv_details_from_inv_list(doc, children, fiscal_year, inv_list, jv_details_list)
 
@@ -223,14 +228,14 @@
 	
 	pr_obj = get_obj('Purchase Receipt', doc['purchase_receipt_no'], with_children=1)
 	
-	inv_list = get_inv_list('tabPV Detail', 'purchase_receipt', doc['purchase_receipt_no'])
+	inv_list = get_inv_list('tabPurchase Invoice Item', 'purchase_receipt', doc['purchase_receipt_no'])
 
 	if inv_list:
 		jv_details_list = get_jv_details_from_inv_list(doc, children, fiscal_year, inv_list, jv_details_list)
 	
 	if not (inv_list and jv_details_list):
 		po_list = get_prev_doc_list(pr_obj, 'Purchase Order')
-		inv_list = get_inv_list('tabPV Detail', 'purchase_order', po_list)
+		inv_list = get_inv_list('tabPurchase Invoice Item', 'purchase_order', po_list)
 		if inv_list:
 			jv_details_list = get_jv_details_from_inv_list(doc, children, fiscal_year, inv_list, jv_details_list)
 
diff --git a/erpnext/accounts/doctype/account/account.js b/erpnext/accounts/doctype/account/account.js
index 32f60c7..501ae40 100644
--- a/erpnext/accounts/doctype/account/account.js
+++ b/erpnext/accounts/doctype/account/account.js
@@ -33,9 +33,9 @@
   // hide India specific fields
   var cp = wn.control_panel;
   if(cp.country == 'India')
-    unhide_field(['pan_number', 'tds_applicable', 'tds_details', 'TDS']);
+    unhide_field(['pan_number', 'tds_applicable', 'tds_details', 'tds']);
   else
-    hide_field(['pan_number', 'tds_applicable', 'tds_details', 'TDS']);
+    hide_field(['pan_number', 'tds_applicable', 'tds_details', 'tds']);
 }
 
 // Refresh
@@ -50,14 +50,14 @@
 // Hide/unhide group or ledger
 // -----------------------------------------
 cur_frm.cscript.hide_unhide_group_ledger = function(doc) {
-  hide_field(['Convert to Group', 'Convert to Ledger']);
-  if (cstr(doc.group_or_ledger) == 'Group') unhide_field('Convert to Ledger');
-  else if (cstr(doc.group_or_ledger) == 'Ledger') unhide_field('Convert to Group');
+  hide_field(['convert_to_group', 'convert_to_ledger']);
+  if (cstr(doc.group_or_ledger) == 'Group') unhide_field('convert_to_ledger');
+  else if (cstr(doc.group_or_ledger) == 'Ledger') unhide_field('convert_to_ledger');
 }
 
 // Convert group to ledger
 // -----------------------------------------
-cur_frm.cscript['Convert to Ledger'] = function(doc, cdt, cdn) {
+cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) {
   $c_obj(make_doclist(cdt,cdn),'convert_group_to_ledger','',function(r,rt) {
     if(r.message == 1) {
       doc.group_or_ledger = 'Ledger';
@@ -69,7 +69,7 @@
 
 // Convert ledger to group
 // -----------------------------------------
-cur_frm.cscript['Convert to Group'] = function(doc, cdt, cdn) {
+cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) {
   $c_obj(make_doclist(cdt,cdn),'convert_ledger_to_group','',function(r,rt) {
     if(r.message == 1) {
       doc.group_or_ledger = 'Group';
diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py
index e3c1977..f11ec0c 100644
--- a/erpnext/accounts/doctype/account/account.py
+++ b/erpnext/accounts/doctype/account/account.py
@@ -223,7 +223,7 @@
 	# ==================================================================
 	def get_authorized_user(self):
 		# Check logged-in user is authorized
-		if get_value('Manage Account', None, 'credit_controller') in webnotes.user.get_roles():
+		if get_value('Global Defaults', None, 'credit_controller') in webnotes.user.get_roles():
 			return 1
 			
 	# Check Credit limit for customer
diff --git a/erpnext/accounts/doctype/account/account.txt b/erpnext/accounts/doctype/account/account.txt
index c06aeba..ec0ade9 100644
--- a/erpnext/accounts/doctype/account/account.txt
+++ b/erpnext/accounts/doctype/account/account.txt
@@ -3,170 +3,168 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:51',
+		'creation': '2012-03-27 14:35:39',
 		'docstatus': 0,
-		'modified': '2012-02-02 15:34:41',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:39',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1325570645',
+		'_last_update': u'1325570645',
 		'allow_copy': 1,
 		'allow_trash': 1,
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
-		'document_type': 'Master',
+		'document_type': u'Master',
 		'in_create': 1,
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
-		'search_fields': 'debit_or_credit, group_or_ledger',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
+		'search_fields': u'debit_or_credit, group_or_ledger',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 138
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Account',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Account',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'amend': 0,
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Account',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1
+		'parent': u'Account',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1,
+		'submit': 0
 	},
 
 	# DocType, Account
 	{
 		'doctype': 'DocType',
-		'name': 'Account'
+		'name': u'Account'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'Sales User'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'Purchase User'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Accounts User',
-		'submit': 0,
+		'role': u'Accounts User',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'amend': 0,
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'Accounts Manager',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
-		'permlevel': 1,
-		'role': 'Accounts User',
-		'submit': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales User',
 		'write': 0
 	},
 
 	# DocPerm
 	{
-		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
-		'permlevel': 1,
-		'role': 'Accounts Manager',
-		'submit': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Purchase User',
 		'write': 0
 	},
 
 	# DocPerm
 	{
-		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
-		'permlevel': 2,
-		'role': 'Accounts Manager',
-		'submit': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Accounts User',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Accounts Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Accounts Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 2,
-		'role': 'Accounts User',
-		'submit': 0,
+		'role': u'Accounts Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 2,
+		'role': u'Accounts User',
 		'write': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Properties',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'properties',
+		'fieldtype': u'Section Break',
+		'label': u'Properties',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'account_name',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'account_name',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Account Name',
+		'label': u'Account Name',
 		'no_copy': 1,
-		'oldfieldname': 'account_name',
-		'oldfieldtype': 'Data',
+		'oldfieldname': u'account_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 1,
 		'reqd': 1,
 		'search_index': 1
@@ -174,42 +172,42 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'parent_account',
-		'fieldtype': 'Link',
-		'label': 'Parent Account',
-		'oldfieldname': 'parent_account',
-		'oldfieldtype': 'Link',
-		'options': 'Account',
+		'doctype': u'DocField',
+		'fieldname': u'parent_account',
+		'fieldtype': u'Link',
+		'label': u'Parent Account',
+		'oldfieldname': u'parent_account',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
 		'permlevel': 0,
 		'search_index': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'level',
-		'fieldtype': 'Int',
+		'doctype': u'DocField',
+		'fieldname': u'level',
+		'fieldtype': u'Int',
 		'hidden': 1,
-		'label': 'Level',
-		'oldfieldname': 'level',
-		'oldfieldtype': 'Int',
+		'label': u'Level',
+		'oldfieldname': u'level',
+		'oldfieldtype': u'Int',
 		'permlevel': 1,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'default': 'Ledger',
-		'doctype': 'DocField',
-		'fieldname': 'group_or_ledger',
-		'fieldtype': 'Select',
+		'default': u'Ledger',
+		'doctype': u'DocField',
+		'fieldname': u'group_or_ledger',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Group or Ledger',
-		'oldfieldname': 'group_or_ledger',
-		'oldfieldtype': 'Select',
-		'options': '\nLedger\nGroup',
+		'label': u'Group or Ledger',
+		'oldfieldname': u'group_or_ledger',
+		'oldfieldtype': u'Select',
+		'options': u'\nLedger\nGroup',
 		'permlevel': 1,
 		'reqd': 1,
 		'search_index': 1
@@ -217,109 +215,112 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Convert to Group',
+		'doctype': u'DocField',
+		'fieldname': u'convert_to_group',
+		'fieldtype': u'Button',
+		'label': u'Convert to Group',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Convert to Ledger',
+		'doctype': u'DocField',
+		'fieldname': u'convert_to_ledger',
+		'fieldtype': u'Button',
+		'label': u'Convert to Ledger',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'debit_or_credit',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'debit_or_credit',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Debit or Credit',
-		'oldfieldname': 'debit_or_credit',
-		'oldfieldtype': 'Data',
+		'label': u'Debit or Credit',
+		'oldfieldname': u'debit_or_credit',
+		'oldfieldtype': u'Data',
 		'permlevel': 1,
 		'search_index': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'is_pl_account',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'is_pl_account',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Is PL Account',
-		'oldfieldname': 'is_pl_account',
-		'oldfieldtype': 'Select',
-		'options': 'Yes\nNo',
+		'label': u'Is PL Account',
+		'oldfieldname': u'is_pl_account',
+		'oldfieldtype': u'Select',
+		'options': u'Yes\nNo',
 		'permlevel': 1,
 		'search_index': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'account_type',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'account_type',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Account Type',
-		'oldfieldname': 'account_type',
-		'oldfieldtype': 'Select',
-		'options': '\nFixed Asset Account\nBank or Cash\nExpense Account\nTax\nIncome Account\nChargeable',
+		'label': u'Account Type',
+		'oldfieldname': u'account_type',
+		'oldfieldtype': u'Select',
+		'options': u'\nFixed Asset Account\nBank or Cash\nExpense Account\nTax\nIncome Account\nChargeable',
 		'permlevel': 0,
 		'search_index': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'If Account Type is "Tax" then the default rate is required.',
-		'doctype': 'DocField',
-		'fieldname': 'tax_rate',
-		'fieldtype': 'Currency',
+		'colour': u'White:FFF',
+		'description': u'If Account Type is "Tax" then the default rate is required.',
+		'doctype': u'DocField',
+		'fieldname': u'tax_rate',
+		'fieldtype': u'Currency',
 		'hidden': 0,
-		'label': 'Rate',
-		'oldfieldname': 'tax_rate',
-		'oldfieldtype': 'Currency',
+		'label': u'Rate',
+		'oldfieldname': u'tax_rate',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'freeze_account',
-		'fieldtype': 'Select',
-		'label': 'Freeze Account',
-		'oldfieldname': 'freeze_account',
-		'oldfieldtype': 'Select',
-		'options': 'No\nYes',
+		'doctype': u'DocField',
+		'fieldname': u'freeze_account',
+		'fieldtype': u'Select',
+		'label': u'Freeze Account',
+		'oldfieldname': u'freeze_account',
+		'oldfieldtype': u'Select',
+		'options': u'No\nYes',
 		'permlevel': 2
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Company',
-		'oldfieldname': 'company',
-		'oldfieldtype': 'Link',
-		'options': 'Company',
+		'label': u'Company',
+		'oldfieldname': u'company',
+		'oldfieldtype': u'Link',
+		'options': u'Company',
 		'permlevel': 1,
 		'reqd': 1,
 		'search_index': 1
@@ -327,128 +328,129 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'credit_days',
-		'fieldtype': 'Int',
+		'doctype': u'DocField',
+		'fieldname': u'credit_days',
+		'fieldtype': u'Int',
 		'hidden': 1,
-		'label': 'Credit Days',
-		'oldfieldname': 'credit_days',
-		'oldfieldtype': 'Int',
+		'label': u'Credit Days',
+		'oldfieldname': u'credit_days',
+		'oldfieldtype': u'Int',
 		'permlevel': 0,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'credit_limit',
-		'fieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'credit_limit',
+		'fieldtype': u'Currency',
 		'hidden': 1,
-		'label': 'Credit Limit',
-		'oldfieldname': 'credit_limit',
-		'oldfieldtype': 'Currency',
+		'label': u'Credit Limit',
+		'oldfieldname': u'credit_limit',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'master_type',
-		'fieldtype': 'Select',
-		'label': 'Master Type',
-		'oldfieldname': 'master_type',
-		'oldfieldtype': 'Select',
-		'options': '\nNA\nSupplier\nCustomer\nEmployee',
+		'doctype': u'DocField',
+		'fieldname': u'master_type',
+		'fieldtype': u'Select',
+		'label': u'Master Type',
+		'oldfieldname': u'master_type',
+		'oldfieldtype': u'Select',
+		'options': u'\nNA\nSupplier\nCustomer\nEmployee',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'master_name',
-		'fieldtype': 'Link',
-		'label': 'Master Name',
-		'oldfieldname': 'master_name',
-		'oldfieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'master_name',
+		'fieldtype': u'Link',
+		'label': u'Master Name',
+		'oldfieldname': u'master_name',
+		'oldfieldtype': u'Link',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'TDS',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'tds',
+		'fieldtype': u'Section Break',
+		'label': u'TDS',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'pan_number',
-		'fieldtype': 'Data',
-		'label': 'PAN Number',
-		'oldfieldname': 'pan_number',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'pan_number',
+		'fieldtype': u'Data',
+		'label': u'PAN Number',
+		'oldfieldname': u'pan_number',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'default': 'No',
-		'doctype': 'DocField',
-		'fieldname': 'tds_applicable',
-		'fieldtype': 'Select',
-		'label': 'TDS Applicable',
-		'oldfieldname': 'tds_applicable',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'default': u'No',
+		'doctype': u'DocField',
+		'fieldname': u'tds_applicable',
+		'fieldtype': u'Select',
+		'label': u'TDS Applicable',
+		'oldfieldname': u'tds_applicable',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'tds_details',
-		'fieldtype': 'Table',
-		'label': 'TDS Details',
-		'oldfieldname': 'tds_details',
-		'oldfieldtype': 'Table',
-		'options': 'TDS Detail',
+		'doctype': u'DocField',
+		'fieldname': u'tds_details',
+		'fieldtype': u'Table',
+		'label': u'TDS Details',
+		'oldfieldname': u'tds_details',
+		'oldfieldtype': u'Table',
+		'options': u'TDS Detail',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'description': "Don't delete this field at any cost",
-		'doctype': 'DocField',
-		'fieldname': 'old_parent',
-		'fieldtype': 'Link',
+		'description': u"Don't delete this field at any cost",
+		'doctype': u'DocField',
+		'fieldname': u'old_parent',
+		'fieldtype': u'Link',
 		'hidden': 1,
-		'label': 'Old Parent',
+		'label': u'Old Parent',
 		'no_copy': 1,
-		'oldfieldname': 'old_parent',
-		'oldfieldtype': 'Data',
-		'options': 'Account',
+		'oldfieldname': u'old_parent',
+		'oldfieldtype': u'Data',
+		'options': u'Account',
 		'permlevel': 0,
 		'report_hide': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': "Don't delete this field at any cost",
-		'doctype': 'DocField',
-		'fieldname': 'lft',
-		'fieldtype': 'Int',
+		'colour': u'White:FFF',
+		'description': u"Don't delete this field at any cost",
+		'doctype': u'DocField',
+		'fieldname': u'lft',
+		'fieldtype': u'Int',
 		'hidden': 1,
 		'in_filter': 1,
-		'label': 'Lft',
+		'label': u'Lft',
 		'no_copy': 1,
-		'oldfieldname': 'lft',
-		'oldfieldtype': 'Int',
+		'oldfieldname': u'lft',
+		'oldfieldtype': u'Int',
 		'permlevel': 3,
 		'print_hide': 1,
 		'report_hide': 1,
@@ -457,17 +459,17 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': "Don't delete this field at any cost",
-		'doctype': 'DocField',
-		'fieldname': 'rgt',
-		'fieldtype': 'Int',
+		'colour': u'White:FFF',
+		'description': u"Don't delete this field at any cost",
+		'doctype': u'DocField',
+		'fieldname': u'rgt',
+		'fieldtype': u'Int',
 		'hidden': 1,
 		'in_filter': 1,
-		'label': 'Rgt',
+		'label': u'Rgt',
 		'no_copy': 1,
-		'oldfieldname': 'rgt',
-		'oldfieldtype': 'Int',
+		'oldfieldname': u'rgt',
+		'oldfieldtype': u'Int',
 		'permlevel': 3,
 		'print_hide': 1,
 		'report_hide': 1,
@@ -476,12 +478,12 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	}
-]
+]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/account_balance/account_balance.txt b/erpnext/accounts/doctype/account_balance/account_balance.txt
index 7f3c12e..903d270 100644
--- a/erpnext/accounts/doctype/account_balance/account_balance.txt
+++ b/erpnext/accounts/doctype/account_balance/account_balance.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:51',
+		'creation': '2012-03-27 14:35:40',
 		'docstatus': 0,
-		'modified': '2012-03-21 12:55:11',
+		'modified': '2012-03-27 14:35:40',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
diff --git a/erpnext/accounts/doctype/advance_adjustment_detail/advance_adjustment_detail.txt b/erpnext/accounts/doctype/advance_adjustment_detail/advance_adjustment_detail.txt
deleted file mode 100644
index a3a63c9..0000000
--- a/erpnext/accounts/doctype/advance_adjustment_detail/advance_adjustment_detail.txt
+++ /dev/null
@@ -1,110 +0,0 @@
-# DocType, Advance Adjustment Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Accounts',
-		'name': '__common__',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 24
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'no_copy': 1,
-		'parent': 'Advance Adjustment Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# DocType, Advance Adjustment Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Advance Adjustment Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'journal_voucher',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Journal Voucher',
-		'oldfieldname': 'journal_voucher',
-		'oldfieldtype': 'Link',
-		'options': 'Journal Voucher',
-		'permlevel': 1,
-		'width': '250px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'jv_detail_no',
-		'fieldtype': 'Data',
-		'hidden': 1,
-		'idx': 2,
-		'label': 'Journal Voucher Detail No',
-		'oldfieldname': 'jv_detail_no',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': '120px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'advance_amount',
-		'fieldtype': 'Currency',
-		'idx': 3,
-		'label': 'Advance amount',
-		'oldfieldname': 'advance_amount',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1,
-		'width': '120px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'allocated_amount',
-		'fieldtype': 'Currency',
-		'idx': 4,
-		'label': 'Allocated amount',
-		'oldfieldname': 'allocated_amount',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'trigger': 'Client',
-		'width': '120px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'remarks',
-		'fieldtype': 'Small Text',
-		'idx': 5,
-		'label': 'Remarks',
-		'oldfieldname': 'remarks',
-		'oldfieldtype': 'Small Text',
-		'permlevel': 1,
-		'width': '150px'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/advance_allocation_detail/__init__.py b/erpnext/accounts/doctype/advance_allocation_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/doctype/advance_allocation_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/doctype/advance_allocation_detail/advance_allocation_detail.txt b/erpnext/accounts/doctype/advance_allocation_detail/advance_allocation_detail.txt
deleted file mode 100644
index 5bb5d38..0000000
--- a/erpnext/accounts/doctype/advance_allocation_detail/advance_allocation_detail.txt
+++ /dev/null
@@ -1,141 +0,0 @@
-# DocType, Advance Allocation Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Accounts',
-		'name': '__common__',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 20
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Advance Allocation Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# DocType, Advance Allocation Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Advance Allocation Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'journal_voucher',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Journal Voucher',
-		'no_copy': 1,
-		'oldfieldname': 'journal_voucher',
-		'oldfieldtype': 'Link',
-		'options': 'Journal Voucher',
-		'permlevel': 1,
-		'width': '180px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'jv_detail_no',
-		'fieldtype': 'Date',
-		'hidden': 1,
-		'idx': 2,
-		'label': 'Journal Voucher Detail No',
-		'no_copy': 1,
-		'oldfieldname': 'jv_detail_no',
-		'oldfieldtype': 'Date',
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': '80px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'advance_amount',
-		'fieldtype': 'Currency',
-		'idx': 3,
-		'label': 'Advance Amount',
-		'no_copy': 1,
-		'oldfieldname': 'advance_amount',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'allocated_amount',
-		'fieldtype': 'Currency',
-		'idx': 4,
-		'label': 'Allocated Amount',
-		'no_copy': 1,
-		'oldfieldname': 'allocated_amount',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'trigger': 'Client',
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'tds_amount',
-		'fieldtype': 'Currency',
-		'idx': 5,
-		'label': 'TDS Amount',
-		'oldfieldname': 'tds_amount',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1,
-		'width': '80px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'tds_allocated',
-		'fieldtype': 'Currency',
-		'idx': 6,
-		'label': 'TDS Allocated',
-		'oldfieldname': 'tds_allocated',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1,
-		'width': '80px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'remarks',
-		'fieldtype': 'Small Text',
-		'idx': 7,
-		'label': 'Remarks',
-		'no_copy': 1,
-		'oldfieldname': 'remarks',
-		'oldfieldtype': 'Small Text',
-		'permlevel': 1,
-		'width': '150px'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js
index 73e767b..4ca9218 100644
--- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js
+++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js
@@ -16,5 +16,5 @@
 
 cur_frm.cscript.onload = function(doc, cdt, cdn){
   // add page head
-  var ph = new PageHeader(cur_frm.fields_dict['Head HTML'].wrapper, 'Bank Reconciliation', '');
-}
\ No newline at end of file
+  var ph = new PageHeader(cur_frm.fields_dict['head_html'].wrapper, 'Bank Reconciliation', '');
+}
diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.txt b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.txt
index 7dc5e5a..f1d0b9f 100644
--- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.txt
+++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.txt
@@ -3,56 +3,56 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:52',
+		'creation': '2012-03-27 14:35:40',
 		'docstatus': 0,
-		'modified': '2010-12-29 18:11:06',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:40',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1294312169',
+		'_last_update': u'1294312169',
 		'allow_copy': 1,
 		'allow_email': 1,
 		'allow_print': 1,
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'hide_heading': 1,
 		'hide_toolbar': 1,
 		'issingle': 1,
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
 		'read_only': 1,
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 12
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Bank Reconciliation',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Bank Reconciliation',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Bank Reconciliation',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Bank Reconciliation',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Bank Reconciliation
 	{
 		'doctype': 'DocType',
-		'name': 'Bank Reconciliation'
+		'name': u'Bank Reconciliation'
 	},
 
 	# DocPerm
@@ -60,106 +60,108 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Accounts User',
+		'role': u'Accounts User',
 		'submit': 0,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'All'
+		'role': u'All'
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Accounts Manager',
+		'write': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 1,
-		'label': 'Head HTML',
+		'doctype': u'DocField',
+		'fieldname': u'head_html',
+		'fieldtype': u'HTML',
+		'label': u'Head HTML',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'description': 'Select account head of the bank where cheque was deposited.',
-		'doctype': 'DocField',
-		'fieldname': 'bank_account',
-		'fieldtype': 'Link',
-		'idx': 2,
-		'label': 'Bank Account',
-		'options': 'Account',
+		'description': u'Select account head of the bank where cheque was deposited.',
+		'doctype': u'DocField',
+		'fieldname': u'bank_account',
+		'fieldtype': u'Link',
+		'label': u'Bank Account',
+		'options': u'Account',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'from_date',
-		'fieldtype': 'Date',
-		'idx': 3,
-		'label': 'From Date',
+		'doctype': u'DocField',
+		'fieldname': u'from_date',
+		'fieldtype': u'Date',
+		'label': u'From Date',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'to_date',
-		'fieldtype': 'Date',
-		'idx': 4,
-		'label': 'To Date',
+		'doctype': u'DocField',
+		'fieldname': u'to_date',
+		'fieldtype': u'Date',
+		'label': u'To Date',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 5,
-		'label': 'Get Non Reconciled Entries',
-		'options': 'get_details',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'get_non_reconciled_entries',
+		'fieldtype': u'Button',
+		'label': u'Get Non Reconciled Entries',
+		'options': u'get_details',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'entries',
-		'fieldtype': 'Table',
-		'idx': 6,
-		'label': 'Entries',
-		'options': 'Bank Reconciliation Detail',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'entries',
+		'fieldtype': u'Table',
+		'label': u'Entries',
+		'options': u'Bank Reconciliation Detail',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 7,
-		'label': 'Update Clearance Date',
-		'options': 'update_details',
+		'doctype': u'DocField',
+		'fieldname': u'update_clearance_date',
+		'fieldtype': u'Button',
+		'label': u'Update Clearance Date',
+		'options': u'update_details',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'total_amount',
-		'fieldtype': 'Currency',
-		'idx': 8,
-		'label': 'Total Amount',
+		'doctype': u'DocField',
+		'fieldname': u'total_amount',
+		'fieldtype': u'Currency',
+		'label': u'Total Amount',
 		'permlevel': 1
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.txt b/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.txt
index 7dad3f6..3924980 100644
--- a/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.txt
+++ b/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:52',
+		'creation': '2012-03-27 14:35:41',
 		'docstatus': 0,
-		'modified': '2012-03-22 14:53:24',
+		'modified': '2012-03-27 14:35:41',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
diff --git a/erpnext/accounts/doctype/budget_control/budget_control.txt b/erpnext/accounts/doctype/budget_control/budget_control.txt
index 4f84bd4..a08762f 100644
--- a/erpnext/accounts/doctype/budget_control/budget_control.txt
+++ b/erpnext/accounts/doctype/budget_control/budget_control.txt
@@ -3,22 +3,22 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:54',
+		'creation': '2012-03-27 14:35:41',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'nabin@webnotestech.com'
+		'modified': '2012-03-27 14:35:41',
+		'modified_by': u'Administrator',
+		'owner': u'nabin@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'issingle': 1,
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 23
 	},
@@ -26,6 +26,6 @@
 	# DocType, Budget Control
 	{
 		'doctype': 'DocType',
-		'name': 'Budget Control'
+		'name': u'Budget Control'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/budget_detail/budget_detail.txt b/erpnext/accounts/doctype/budget_detail/budget_detail.txt
index dafa391..f9f287a 100644
--- a/erpnext/accounts/doctype/budget_detail/budget_detail.txt
+++ b/erpnext/accounts/doctype/budget_detail/budget_detail.txt
@@ -3,94 +3,90 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:54',
+		'creation': '2012-03-27 14:35:41',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:41',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'autoname': 'CBD/.######',
-		'colour': 'White:FFF',
+		'autoname': u'CBD/.######',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
-		'section_style': 'Tray',
+		'section_style': u'Tray',
 		'show_in_menu': 0,
 		'version': 6
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Budget Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Budget Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# DocType, Budget Detail
 	{
 		'doctype': 'DocType',
-		'name': 'Budget Detail'
+		'name': u'Budget Detail'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'account',
-		'fieldtype': 'Link',
-		'idx': 1,
+		'doctype': u'DocField',
+		'fieldname': u'account',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Account',
-		'oldfieldname': 'account',
-		'oldfieldtype': 'Link',
-		'options': 'Account',
+		'label': u'Account',
+		'oldfieldname': u'account',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'budget_allocated',
-		'fieldtype': 'Currency',
-		'idx': 2,
-		'label': 'Budget Allocated',
-		'oldfieldname': 'budget_allocated',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'budget_allocated',
+		'fieldtype': u'Currency',
+		'label': u'Budget Allocated',
+		'oldfieldname': u'budget_allocated',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'actual',
-		'fieldtype': 'Currency',
-		'idx': 3,
-		'label': 'Actual',
-		'oldfieldname': 'actual',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'actual',
+		'fieldtype': u'Currency',
+		'label': u'Actual',
+		'oldfieldname': u'actual',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Select',
-		'idx': 4,
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Fiscal Year',
-		'oldfieldname': 'fiscal_year',
-		'oldfieldtype': 'Select',
-		'options': 'link:Fiscal Year',
+		'label': u'Fiscal Year',
+		'oldfieldname': u'fiscal_year',
+		'oldfieldtype': u'Select',
+		'options': u'link:Fiscal Year',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1
diff --git a/erpnext/accounts/doctype/budget_distribution/budget_distribution.txt b/erpnext/accounts/doctype/budget_distribution/budget_distribution.txt
index 5e224ee..ca9b869 100644
--- a/erpnext/accounts/doctype/budget_distribution/budget_distribution.txt
+++ b/erpnext/accounts/doctype/budget_distribution/budget_distribution.txt
@@ -3,79 +3,76 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:54',
+		'creation': '2012-03-27 14:35:41',
 		'docstatus': 0,
-		'modified': '2010-12-29 18:20:37',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:41',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
 		'allow_trash': 1,
-		'autoname': 'field:distribution_id',
-		'colour': 'White:FFF',
+		'autoname': u'field:distribution_id',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
-		'name_case': 'Title Case',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'name_case': u'Title Case',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 24
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Budget Distribution',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Budget Distribution',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Budget Distribution',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Budget Distribution',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Budget Distribution
 	{
 		'doctype': 'DocType',
-		'name': 'Budget Distribution'
+		'name': u'Budget Distribution'
 	},
 
 	# DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 3,
+		'doctype': u'DocPerm',
 		'permlevel': 2,
-		'role': 'System Manager'
+		'role': u'System Manager'
 	},
 
 	# DocPerm
@@ -83,10 +80,9 @@
 		'amend': 0,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 4,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Accounts Manager',
+		'role': u'Accounts Manager',
 		'submit': 0,
 		'write': 1
 	},
@@ -96,71 +92,65 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 5,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Accounts Manager',
+		'role': u'Accounts Manager',
 		'submit': 0,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 6,
+		'doctype': u'DocPerm',
 		'permlevel': 2,
-		'role': 'Accounts Manager'
+		'role': u'Accounts Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'distribution_id',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'label': 'Distribution ID',
-		'oldfieldname': 'distribution_id',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'distribution_id',
+		'fieldtype': u'Data',
+		'label': u'Distribution ID',
+		'oldfieldname': u'distribution_id',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Select',
-		'idx': 2,
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Fiscal Year',
-		'oldfieldname': 'fiscal_year',
-		'oldfieldtype': 'Select',
-		'options': 'link:Fiscal Year',
+		'label': u'Fiscal Year',
+		'oldfieldname': u'fiscal_year',
+		'oldfieldtype': u'Select',
+		'options': u'link:Fiscal Year',
 		'permlevel': 0,
 		'search_index': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'budget_distribution_details',
-		'fieldtype': 'Table',
-		'idx': 3,
-		'label': 'Budget Distribution Details',
-		'oldfieldname': 'budget_distribution_details',
-		'oldfieldtype': 'Table',
-		'options': 'Budget Distribution Detail',
+		'doctype': u'DocField',
+		'fieldname': u'budget_distribution_details',
+		'fieldtype': u'Table',
+		'label': u'Budget Distribution Details',
+		'oldfieldname': u'budget_distribution_details',
+		'oldfieldtype': u'Table',
+		'options': u'Budget Distribution Detail',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 4,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.txt b/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.txt
index cc872a9..d0912be 100644
--- a/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.txt
+++ b/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.txt
@@ -3,76 +3,73 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:54',
+		'creation': '2012-03-27 14:35:41',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:41',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'autoname': 'BDD/.#####',
-		'colour': 'White:FFF',
+		'autoname': u'BDD/.#####',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 6
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Budget Distribution Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Budget Distribution Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# DocType, Budget Distribution Detail
 	{
 		'doctype': 'DocType',
-		'name': 'Budget Distribution Detail'
+		'name': u'Budget Distribution Detail'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'month',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'label': 'Month',
-		'oldfieldname': 'month',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'month',
+		'fieldtype': u'Data',
+		'label': u'Month',
+		'oldfieldname': u'month',
+		'oldfieldtype': u'Data',
 		'permlevel': 2,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'percentage_allocation',
-		'fieldtype': 'Currency',
-		'idx': 2,
-		'label': 'Percentage Allocation',
-		'oldfieldname': 'percentage_allocation',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'percentage_allocation',
+		'fieldtype': u'Currency',
+		'label': u'Percentage Allocation',
+		'oldfieldname': u'percentage_allocation',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'aggregate_percentage',
-		'fieldtype': 'Currency',
-		'idx': 3,
-		'label': 'Aggregate Percentage',
-		'oldfieldname': 'aggregate_percentage',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'aggregate_percentage',
+		'fieldtype': u'Currency',
+		'label': u'Aggregate Percentage',
+		'oldfieldname': u'aggregate_percentage',
+		'oldfieldtype': u'Currency',
 		'permlevel': 2
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/c_form/c_form.js b/erpnext/accounts/doctype/c_form/c_form.js
index 82adf29..4fb3227 100644
--- a/erpnext/accounts/doctype/c_form/c_form.js
+++ b/erpnext/accounts/doctype/c_form/c_form.js
@@ -17,7 +17,7 @@
 //c-form js file
 // -----------------------------
 cur_frm.fields_dict.invoice_details.grid.get_field("invoice_no").get_query = function(doc) {
-	return 'SELECT `tabReceivable Voucher`.`name` FROM `tabReceivable Voucher` WHERE `tabReceivable Voucher`.`company` = "' +doc.company+'" AND `tabReceivable Voucher`.%(key)s LIKE "%s" AND `tabReceivable Voucher`.`customer` = "' + doc.customer + '" AND `tabReceivable Voucher`.`docstatus` = 1 and `tabReceivable Voucher`.`c_form_applicable` = "Yes" and ifnull(`tabReceivable Voucher`.c_form_no, "") = "" ORDER BY `tabReceivable Voucher`.`name` ASC LIMIT 50';
+	return 'SELECT `tabSales Invoice`.`name` FROM `tabSales Invoice` WHERE `tabSales Invoice`.`company` = "' +doc.company+'" AND `tabSales Invoice`.%(key)s LIKE "%s" AND `tabSales Invoice`.`customer` = "' + doc.customer + '" AND `tabSales Invoice`.`docstatus` = 1 and `tabSales Invoice`.`c_form_applicable` = "Yes" and ifnull(`tabSales Invoice`.c_form_no, "") = "" ORDER BY `tabSales Invoice`.`name` ASC LIMIT 50';
 }
 
 cur_frm.cscript.invoice_no = function(doc, cdt, cdn) {
diff --git a/erpnext/accounts/doctype/c_form/c_form.py b/erpnext/accounts/doctype/c_form/c_form.py
index bc5ed7b..416657b 100644
--- a/erpnext/accounts/doctype/c_form/c_form.py
+++ b/erpnext/accounts/doctype/c_form/c_form.py
@@ -39,9 +39,9 @@
 		
 		if len(getlist(self.doclist, 'invoice_details')):
 			inv = "'" + "', '".join([d.invoice_no for d in getlist(self.doclist, 'invoice_details')]) + "'"
-			sql("""update `tabReceivable Voucher` set c_form_no = '%s', modified ='%s'
+			sql("""update `tabSales Invoice` set c_form_no = '%s', modified ='%s'
 				where name in (%s)"""%(self.doc.name, self.doc.modified, inv))
-			sql("""update `tabReceivable Voucher` set c_form_no = '', modified = %s where name not
+			sql("""update `tabSales Invoice` set c_form_no = '', modified = %s where name not
 				in (%s) and ifnull(c_form_no, '') = %s""", (self.doc.modified, self.doc.name, inv))
 		else:
 			msgprint("Please enter atleast 1 invoice in the table below", raise_exception=1)
@@ -59,7 +59,7 @@
 		"""	Pull details from invoices for referrence """
 
 		inv = sql("""select posting_date, territory, net_total, grand_total from
-			`tabReceivable Voucher` where name = %s""", invoice_no)	
+			`tabSales Invoice` where name = %s""", invoice_no)	
 		ret = {
 			'invoice_date' : inv and getdate(inv[0][0]).strftime('%Y-%m-%d') or '',
 			'territory'    : inv and inv[0][1] or '',
@@ -75,7 +75,7 @@
 
 		for d in getlist(self.doclist, 'invoice_details'):
 			inv = sql("""select c_form_applicable, c_form_no from
-				`tabReceivable Voucher` where name = %s""", invoice_no)
+				`tabSales Invoice` where name = %s""", invoice_no)
 			if not inv:
 				msgprint("Invoice: %s is not exists in the system, please check." % d.invoice_no, raise_exception=1)
 			elif inv[0][0] != 'Yes':
diff --git a/erpnext/accounts/doctype/c_form/c_form.txt b/erpnext/accounts/doctype/c_form/c_form.txt
index 2cead89..b404204 100644
--- a/erpnext/accounts/doctype/c_form/c_form.txt
+++ b/erpnext/accounts/doctype/c_form/c_form.txt
@@ -30,7 +30,8 @@
 		'name': '__common__',
 		'parent': u'C-Form',
 		'parentfield': u'fields',
-		'parenttype': u'DocType'
+		'parenttype': u'DocType',
+		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
@@ -78,6 +79,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'width': u'50%'
@@ -128,6 +130,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break1',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'width': u'50%'
@@ -188,6 +191,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'section_break0',
 		'fieldtype': u'Section Break',
 		'permlevel': 0
 	},
@@ -222,4 +226,4 @@
 		'permlevel': 0,
 		'print_hide': 1
 	}
-]
\ No newline at end of file
+]
diff --git a/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.txt b/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.txt
index d6be6c0d..367d8c1 100644
--- a/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.txt
+++ b/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.txt
@@ -3,89 +3,89 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-12-07 16:15:39',
+		'creation': '2012-03-27 14:35:41',
 		'docstatus': 0,
-		'modified': '2011-12-07 16:21:55',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:41',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
 		'version': 5
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'C-Form Invoice Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'C-Form Invoice Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# DocType, C-Form Invoice Detail
 	{
 		'doctype': 'DocType',
-		'name': 'C-Form Invoice Detail'
+		'name': u'C-Form Invoice Detail'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'invoice_no',
-		'fieldtype': 'Link',
-		'label': 'Invoice No',
-		'options': 'Receivable Voucher',
+		'doctype': u'DocField',
+		'fieldname': u'invoice_no',
+		'fieldtype': u'Link',
+		'label': u'Invoice No',
+		'options': u'Sales Invoice',
 		'permlevel': 0,
-		'width': '160px'
+		'width': u'160px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'invoice_date',
-		'fieldtype': 'Date',
-		'label': 'Invoice Date',
+		'doctype': u'DocField',
+		'fieldname': u'invoice_date',
+		'fieldtype': u'Date',
+		'label': u'Invoice Date',
 		'permlevel': 1,
-		'width': '120px'
+		'width': u'120px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'territory',
-		'fieldtype': 'Link',
-		'label': 'Territory',
-		'options': 'Territory',
+		'doctype': u'DocField',
+		'fieldname': u'territory',
+		'fieldtype': u'Link',
+		'label': u'Territory',
+		'options': u'Territory',
 		'permlevel': 1,
-		'width': '120px'
+		'width': u'120px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'net_total',
-		'fieldtype': 'Currency',
-		'label': 'Net Total',
+		'doctype': u'DocField',
+		'fieldname': u'net_total',
+		'fieldtype': u'Currency',
+		'label': u'Net Total',
 		'permlevel': 1,
-		'width': '120px'
+		'width': u'120px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'grand_total',
-		'fieldtype': 'Currency',
-		'label': 'Grand Total',
+		'doctype': u'DocField',
+		'fieldname': u'grand_total',
+		'fieldtype': u'Currency',
+		'label': u'Grand Total',
 		'permlevel': 1,
-		'width': '120px'
+		'width': u'120px'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.js b/erpnext/accounts/doctype/cost_center/cost_center.js
index 180836a..ade4ee8 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.js
+++ b/erpnext/accounts/doctype/cost_center/cost_center.js
@@ -58,14 +58,14 @@
 // Hide/unhide group or ledger
 // -----------------------------------------
 cur_frm.cscript.hide_unhide_group_ledger = function(doc) {
-	hide_field(['Convert to Group', 'Convert to Ledger']);
-	if (cstr(doc.group_or_ledger) == 'Group') unhide_field('Convert to Ledger');
-	else if (cstr(doc.group_or_ledger) == 'Ledger') unhide_field('Convert to Group');
+	hide_field(['convert_to_group', 'convert_to_ledger']);
+	if (cstr(doc.group_or_ledger) == 'Group') unhide_field('convert_to_ledger');
+	else if (cstr(doc.group_or_ledger) == 'Ledger') unhide_field('convert_to_group');
 }
 
 // Convert group to ledger
 // -----------------------------------------
-cur_frm.cscript['Convert to Ledger'] = function(doc, cdt, cdn) {
+cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) {
 	$c_obj(make_doclist(cdt,cdn),'convert_group_to_ledger','',function(r,rt) {
 		if(r.message == 1) {
 			doc.group_or_ledger = 'Ledger';
@@ -77,7 +77,7 @@
 
 // Convert ledger to group
 // -----------------------------------------
-cur_frm.cscript['Convert to Group'] = function(doc, cdt, cdn) {
+cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) {
 	$c_obj(make_doclist(cdt,cdn),'convert_ledger_to_group','',function(r,rt) {
 		if(r.message == 1) {
 			doc.group_or_ledger = 'Group';
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.txt b/erpnext/accounts/doctype/cost_center/cost_center.txt
index 94fb02b..b02d909 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.txt
+++ b/erpnext/accounts/doctype/cost_center/cost_center.txt
@@ -3,56 +3,56 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:56',
+		'creation': '2012-03-27 14:35:41',
 		'docstatus': 0,
-		'modified': '2011-10-10 12:05:07',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:41',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1317365120',
+		'_last_update': u'1317365120',
 		'allow_copy': 1,
 		'allow_trash': 1,
-		'autoname': 'field:cost_center_name',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'autoname': u'field:cost_center_name',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
-		'document_type': 'Master',
+		'document_type': u'Master',
 		'in_create': 1,
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
-		'search_fields': 'name,parent_cost_center',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'search_fields': u'name,parent_cost_center',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 109
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Cost Center',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Cost Center',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Cost Center',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Cost Center',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Cost Center
 	{
 		'doctype': 'DocType',
-		'name': 'Cost Center'
+		'name': u'Cost Center'
 	},
 
 	# DocPerm
@@ -60,9 +60,38 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Accounts User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'System Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Accounts Manager',
+		'role': u'All'
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Accounts Manager',
 		'submit': 0,
 		'write': 0
 	},
@@ -72,9 +101,9 @@
 		'amend': 0,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Accounts Manager',
+		'role': u'Accounts Manager',
 		'submit': 0,
 		'write': 1
 	},
@@ -84,63 +113,34 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Accounts User',
+		'role': u'Accounts User',
 		'submit': 0,
 		'write': 0
 	},
 
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'Accounts User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'System Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'permlevel': 1,
-		'role': 'All'
-	},
-
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'cost_center_name',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'cost_center_name',
+		'fieldtype': u'Data',
 		'in_filter': 0,
-		'label': 'Cost Center Name',
+		'label': u'Cost Center Name',
 		'no_copy': 1,
-		'oldfieldname': 'cost_center_name',
-		'oldfieldtype': 'Data',
+		'oldfieldname': u'cost_center_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 0
@@ -148,119 +148,121 @@
 
 	# DocField
 	{
-		'description': 'Select company name first.',
-		'doctype': 'DocField',
-		'fieldname': 'parent_cost_center',
-		'fieldtype': 'Link',
-		'label': 'Parent Cost Center',
-		'oldfieldname': 'parent_cost_center',
-		'oldfieldtype': 'Link',
-		'options': 'Cost Center',
+		'description': u'Select company name first.',
+		'doctype': u'DocField',
+		'fieldname': u'parent_cost_center',
+		'fieldtype': u'Link',
+		'label': u'Parent Cost Center',
+		'oldfieldname': u'parent_cost_center',
+		'oldfieldtype': u'Link',
+		'options': u'Cost Center',
 		'permlevel': 0,
 		'reqd': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'company_name',
-		'fieldtype': 'Link',
-		'label': 'Company',
-		'oldfieldname': 'company_name',
-		'oldfieldtype': 'Link',
-		'options': 'Company',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'company_name',
+		'fieldtype': u'Link',
+		'label': u'Company',
+		'oldfieldname': u'company_name',
+		'oldfieldtype': u'Link',
+		'options': u'Company',
 		'permlevel': 0,
 		'reqd': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'company_abbr',
-		'fieldtype': 'Data',
-		'label': 'Company Abbr',
-		'oldfieldname': 'company_abbr',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'company_abbr',
+		'fieldtype': u'Data',
+		'label': u'Company Abbr',
+		'oldfieldname': u'company_abbr',
+		'oldfieldtype': u'Data',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'group_or_ledger',
-		'fieldtype': 'Select',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'group_or_ledger',
+		'fieldtype': u'Select',
 		'hidden': 0,
-		'label': 'Group or Ledger',
+		'label': u'Group or Ledger',
 		'no_copy': 1,
-		'oldfieldname': 'group_or_ledger',
-		'oldfieldtype': 'Select',
-		'options': '\nGroup\nLedger',
+		'oldfieldname': u'group_or_ledger',
+		'oldfieldtype': u'Select',
+		'options': u'\nGroup\nLedger',
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 1,
 		'reqd': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Convert to Group',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'convert_to_group',
+		'fieldtype': u'Button',
+		'label': u'Convert to Group',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Convert to Ledger',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'convert_to_ledger',
+		'fieldtype': u'Button',
+		'label': u'Convert to Ledger',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'distribution_id',
-		'fieldtype': 'Link',
-		'label': 'Distribution Id',
-		'oldfieldname': 'distribution_id',
-		'oldfieldtype': 'Link',
-		'options': 'Budget Distribution',
+		'doctype': u'DocField',
+		'fieldname': u'distribution_id',
+		'fieldtype': u'Link',
+		'label': u'Distribution Id',
+		'oldfieldname': u'distribution_id',
+		'oldfieldtype': u'Link',
+		'options': u'Budget Distribution',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'budget_details',
-		'fieldtype': 'Table',
-		'label': 'Budget Details',
-		'oldfieldname': 'budget_details',
-		'oldfieldtype': 'Table',
-		'options': 'Budget Detail',
+		'doctype': u'DocField',
+		'fieldname': u'budget_details',
+		'fieldtype': u'Table',
+		'label': u'Budget Details',
+		'oldfieldname': u'budget_details',
+		'oldfieldtype': u'Table',
+		'options': u'Budget Detail',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'lft',
-		'fieldtype': 'Int',
+		'doctype': u'DocField',
+		'fieldname': u'lft',
+		'fieldtype': u'Int',
 		'hidden': 1,
 		'in_filter': 1,
-		'label': 'lft',
+		'label': u'lft',
 		'no_copy': 1,
-		'oldfieldname': 'lft',
-		'oldfieldtype': 'Int',
+		'oldfieldname': u'lft',
+		'oldfieldtype': u'Int',
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 1,
@@ -269,15 +271,15 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'rgt',
-		'fieldtype': 'Int',
+		'doctype': u'DocField',
+		'fieldname': u'rgt',
+		'fieldtype': u'Int',
 		'hidden': 1,
 		'in_filter': 1,
-		'label': 'rgt',
+		'label': u'rgt',
 		'no_copy': 1,
-		'oldfieldname': 'rgt',
-		'oldfieldtype': 'Int',
+		'oldfieldname': u'rgt',
+		'oldfieldtype': u'Int',
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 1,
@@ -287,15 +289,15 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'old_parent',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'old_parent',
+		'fieldtype': u'Link',
 		'hidden': 1,
-		'label': 'old_parent',
+		'label': u'old_parent',
 		'no_copy': 1,
-		'oldfieldname': 'old_parent',
-		'oldfieldtype': 'Data',
-		'options': 'Cost Center',
+		'oldfieldname': u'old_parent',
+		'oldfieldtype': u'Data',
+		'options': u'Cost Center',
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 1
diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.js b/erpnext/accounts/doctype/fiscal_year/fiscal_year.js
index fdc25fe..6a03bf7 100644
--- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.js
+++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.js
@@ -1,7 +1,7 @@
 cur_frm.cscript.refresh = function(doc, dt, dn) {
 	if (doc.__islocal) {
-		hide_field(['Repost Account Balances', 'Repost Voucher Outstanding']);
+		hide_field(['repost_account_balances', 'repost_voucher_outstanding']);
 		set_multiple(dt, dn, {'is_fiscal_year_closed': 'No'});
 	}
-	else unhide_field(['Repost Account Balances', 'Repost Voucher Outstanding']);
+	else unhide_field(['repost_account_balances', 'repost_voucher_outstanding']);
 }
diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
index 84a1c05..f894fae 100644
--- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
+++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
@@ -178,8 +178,8 @@
 	# ====================================================================================
 	def clear_outstanding(self):
 		# clear o/s of current year
-		sql("update `tabPayable Voucher` set outstanding_amount = 0 where fiscal_year=%s and company=%s", (self.doc.name, self.doc.company))
-		sql("update `tabReceivable Voucher` set outstanding_amount = 0 where fiscal_year=%s and company=%s", (self.doc.name, self.doc.company))
+		sql("update `tabPurchase Invoice` set outstanding_amount = 0 where fiscal_year=%s and company=%s", (self.doc.name, self.doc.company))
+		sql("update `tabSales Invoice` set outstanding_amount = 0 where fiscal_year=%s and company=%s", (self.doc.name, self.doc.company))
 
 	# Update Voucher Outstanding
 	def update_voucher_outstanding(self):
@@ -190,7 +190,7 @@
 			# get voucher balance
 			bal = sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s and ifnull(is_cancelled, 'No') = 'No'", (d[0], d[1]))
 			bal = bal and flt(bal[0][0]) or 0.0
-			if d[1] == 'Payable Voucher':
+			if d[1] == 'Purchase Invoice':
 				bal = -bal
 			# set voucher balance
 			sql("update `tab%s` set outstanding_amount=%s where name='%s'"% (d[1], bal, d[0]))
diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.txt b/erpnext/accounts/doctype/fiscal_year/fiscal_year.txt
index 2834878..ae4c5a0 100644
--- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.txt
+++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:02',
+		'creation': '2012-03-27 14:35:41',
 		'docstatus': 0,
-		'modified': '2012-03-21 12:54:40',
+		'modified': '2012-03-27 14:35:41',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -59,19 +59,20 @@
 
 	# DocPerm
 	{
+		'doctype': u'DocPerm'
+	},
+
+	# DocPerm
+	{
 		'amend': 0,
 		'doctype': u'DocPerm',
 		'submit': 0
 	},
 
-	# DocPerm
-	{
-		'doctype': u'DocPerm'
-	},
-
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'year_details',
 		'fieldtype': u'Section Break',
 		'label': u'Year Details',
 		'oldfieldtype': u'Section Break',
@@ -143,6 +144,7 @@
 		'colour': u'White:FFF',
 		'description': u"Click on the button below to reset balances from your previous year's closing and repost your balances. You can use this if your previous year balance sheet has been changed and you wish to update your current accounts.",
 		'doctype': u'DocField',
+		'fieldname': u'repost_accounts',
 		'fieldtype': u'Section Break',
 		'label': u'Repost Accounts',
 		'oldfieldtype': u'Section Break',
@@ -178,6 +180,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'repost_account_balances',
 		'fieldtype': u'Button',
 		'label': u'Repost Account Balances',
 		'oldfieldtype': u'Button',
@@ -188,6 +191,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'repost_voucher_outstanding',
 		'fieldtype': u'Button',
 		'label': u'Repost Voucher Outstanding',
 		'oldfieldtype': u'Button',
diff --git a/erpnext/accounts/doctype/form_16a/form_16a.txt b/erpnext/accounts/doctype/form_16a/form_16a.txt
index 530d410..96ebb19 100644
--- a/erpnext/accounts/doctype/form_16a/form_16a.txt
+++ b/erpnext/accounts/doctype/form_16a/form_16a.txt
@@ -3,61 +3,50 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-09-27 15:56:52',
+		'creation': '2012-03-27 14:35:41',
 		'docstatus': 0,
-		'modified': '2011-06-15 13:07:17',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Form 16A',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'modified': '2012-03-27 14:35:41',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1308123438',
-		'colour': 'White:FFF',
+		'_last_update': u'1308123438',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'in_create': 0,
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 75
 	},
 
-	# These values are common for all DocFormat
+	# These values are common for all DocField
 	{
-		'doctype': 'DocFormat',
-		'format': 'Form 16A Print Format',
-		'idx': 1,
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Form 16A',
-		'parentfield': 'formats',
-		'parenttype': 'DocType'
+		'parent': u'Form 16A',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Form 16A',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Form 16A',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Form 16A
 	{
 		'doctype': 'DocType',
-		'name': 'Form 16A'
+		'name': u'Form 16A'
 	},
 
 	# DocPerm
@@ -65,10 +54,9 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Accounts Manager',
+		'role': u'Accounts Manager',
 		'submit': 0,
 		'write': 0
 	},
@@ -78,10 +66,9 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 2,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Accounts Manager',
+		'role': u'Accounts Manager',
 		'submit': 0,
 		'write': 1
 	},
@@ -91,10 +78,9 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 3,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Accounts User',
+		'role': u'Accounts User',
 		'submit': 0,
 		'write': 0
 	},
@@ -104,10 +90,9 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 4,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Accounts User',
+		'role': u'Accounts User',
 		'submit': 0,
 		'write': 1
 	},
@@ -115,168 +100,153 @@
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 5,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 6,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'System Manager'
-	},
-
-	# DocFormat
-	{
-		'doctype': 'DocFormat'
+		'role': u'System Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 1,
-		'label': 'Basic Info',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'basic_info',
+		'fieldtype': u'Section Break',
+		'label': u'Basic Info',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 2,
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'from_date',
-		'fieldtype': 'Date',
-		'idx': 3,
-		'label': 'From Date',
-		'oldfieldname': 'from_date',
-		'oldfieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'from_date',
+		'fieldtype': u'Date',
+		'label': u'From Date',
+		'oldfieldname': u'from_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'to_date',
-		'fieldtype': 'Date',
-		'idx': 4,
-		'label': 'To Date',
-		'oldfieldname': 'to_date',
-		'oldfieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'to_date',
+		'fieldtype': u'Date',
+		'label': u'To Date',
+		'oldfieldname': u'to_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'reqd': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'tds_category',
-		'fieldtype': 'Link',
-		'idx': 5,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'tds_category',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'TDS Category',
-		'oldfieldname': 'tds_category',
-		'oldfieldtype': 'Link',
-		'options': 'TDS Category',
+		'label': u'TDS Category',
+		'oldfieldname': u'tds_category',
+		'oldfieldtype': u'Link',
+		'options': u'TDS Category',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'party_name',
-		'fieldtype': 'Link',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'party_name',
+		'fieldtype': u'Link',
 		'hidden': 0,
-		'idx': 6,
 		'in_filter': 1,
-		'label': 'Party Name',
-		'oldfieldname': 'party_name',
-		'oldfieldtype': 'Link',
-		'options': 'Account',
+		'label': u'Party Name',
+		'oldfieldname': u'party_name',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
 		'permlevel': 0,
 		'reqd': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'party_address',
-		'fieldtype': 'Small Text',
-		'idx': 7,
-		'label': 'Address',
-		'oldfieldname': 'party_address',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'party_address',
+		'fieldtype': u'Small Text',
+		'label': u'Address',
+		'oldfieldname': u'party_address',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'pan_number',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'pan_number',
+		'fieldtype': u'Data',
 		'hidden': 0,
-		'idx': 8,
-		'label': 'PAN No',
-		'oldfieldname': 'pan_number',
-		'oldfieldtype': 'Data',
+		'label': u'PAN No',
+		'oldfieldname': u'pan_number',
+		'oldfieldtype': u'Data',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 9,
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Select',
-		'idx': 10,
-		'label': 'Fiscal Year',
-		'oldfieldname': 'fiscal_year',
-		'oldfieldtype': 'Select',
-		'options': 'link:Fiscal Year',
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
+		'label': u'Fiscal Year',
+		'oldfieldname': u'fiscal_year',
+		'oldfieldtype': u'Select',
+		'options': u'link:Fiscal Year',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Link',
-		'idx': 11,
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Company ',
-		'oldfieldname': 'company',
-		'oldfieldtype': 'Link',
-		'options': 'Company',
+		'label': u'Company ',
+		'oldfieldname': u'company',
+		'oldfieldtype': u'Link',
+		'options': u'Company',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1
@@ -284,194 +254,184 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'company_address',
-		'fieldtype': 'Small Text',
-		'idx': 12,
-		'label': 'Company Address',
-		'oldfieldname': 'company_address',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'company_address',
+		'fieldtype': u'Small Text',
+		'label': u'Company Address',
+		'oldfieldname': u'company_address',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'registration_details',
-		'fieldtype': 'Small Text',
-		'idx': 13,
-		'label': 'Registration Details',
-		'oldfieldname': 'registration_details',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'registration_details',
+		'fieldtype': u'Small Text',
+		'label': u'Registration Details',
+		'oldfieldname': u'registration_details',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 14,
-		'label': 'Return Details',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'return_details',
+		'fieldtype': u'Section Break',
+		'label': u'Return Details',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 15,
-		'label': 'Get Return Details',
-		'oldfieldtype': 'Button',
-		'options': 'get_return_ack_details',
+		'doctype': u'DocField',
+		'fieldname': u'get_return_details',
+		'fieldtype': u'Button',
+		'label': u'Get Return Details',
+		'oldfieldtype': u'Button',
+		'options': u'get_return_ack_details',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'form_16A_ack_details',
-		'fieldtype': 'Table',
-		'idx': 16,
-		'label': 'Form 16A Ack Details',
-		'oldfieldname': 'form_16A_ack_details',
-		'oldfieldtype': 'Table',
-		'options': 'Form 16A Ack Detail',
+		'doctype': u'DocField',
+		'fieldname': u'form_16A_ack_details',
+		'fieldtype': u'Table',
+		'label': u'Form 16A Ack Details',
+		'oldfieldname': u'form_16A_ack_details',
+		'oldfieldtype': u'Table',
+		'options': u'Form 16A Ack Detail',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 17,
-		'label': 'Payment Details',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'payment_details',
+		'fieldtype': u'Section Break',
+		'label': u'Payment Details',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 18,
-		'label': 'Get TDS',
-		'oldfieldtype': 'Button',
-		'options': 'get_tds',
+		'doctype': u'DocField',
+		'fieldname': u'get_tds',
+		'fieldtype': u'Button',
+		'label': u'Get TDS',
+		'oldfieldtype': u'Button',
+		'options': u'get_tds',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'form_16A_tax_details',
-		'fieldtype': 'Table',
-		'idx': 19,
-		'label': 'Tax Details',
-		'oldfieldname': 'form_16A_tax_details',
-		'oldfieldtype': 'Table',
-		'options': 'Form 16A Tax Detail',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'form_16A_tax_details',
+		'fieldtype': u'Table',
+		'label': u'Tax Details',
+		'oldfieldname': u'form_16A_tax_details',
+		'oldfieldtype': u'Table',
+		'options': u'Form 16A Tax Detail',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'total_amount',
-		'fieldtype': 'Currency',
-		'idx': 20,
-		'label': 'Total Amount',
-		'oldfieldname': 'total_amount',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'total_amount',
+		'fieldtype': u'Currency',
+		'label': u'Total Amount',
+		'oldfieldname': u'total_amount',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'in_words',
-		'fieldtype': 'Data',
-		'idx': 21,
-		'label': 'In Words',
+		'doctype': u'DocField',
+		'fieldname': u'in_words',
+		'fieldtype': u'Data',
+		'label': u'In Words',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 22,
-		'oldfieldtype': 'Section Break',
-		'options': 'Simple',
+		'doctype': u'DocField',
+		'fieldname': u'section_break0',
+		'fieldtype': u'Section Break',
+		'oldfieldtype': u'Section Break',
+		'options': u'Simple',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 23,
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break2',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'place',
-		'fieldtype': 'Data',
-		'idx': 24,
-		'label': 'Place',
-		'oldfieldname': 'place',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'place',
+		'fieldtype': u'Data',
+		'label': u'Place',
+		'oldfieldname': u'place',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'dt',
-		'fieldtype': 'Date',
-		'idx': 25,
-		'label': 'Date',
-		'oldfieldname': 'dt',
-		'oldfieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'dt',
+		'fieldtype': u'Date',
+		'label': u'Date',
+		'oldfieldname': u'dt',
+		'oldfieldtype': u'Date',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 26,
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break3',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'full_name',
-		'fieldtype': 'Data',
-		'idx': 27,
-		'label': 'Full Name',
-		'oldfieldname': 'full_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'full_name',
+		'fieldtype': u'Data',
+		'label': u'Full Name',
+		'oldfieldname': u'full_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'designation',
-		'fieldtype': 'Data',
-		'idx': 28,
-		'label': 'Designation',
-		'oldfieldname': 'designation',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'designation',
+		'fieldtype': u'Data',
+		'label': u'Designation',
+		'oldfieldname': u'designation',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	}
-]
\ No newline at end of file
+]
diff --git a/erpnext/accounts/doctype/form_16a_ack_detail/form_16a_ack_detail.txt b/erpnext/accounts/doctype/form_16a_ack_detail/form_16a_ack_detail.txt
index 0f2c188..b3d1546 100644
--- a/erpnext/accounts/doctype/form_16a_ack_detail/form_16a_ack_detail.txt
+++ b/erpnext/accounts/doctype/form_16a_ack_detail/form_16a_ack_detail.txt
@@ -3,61 +3,59 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:02',
+		'creation': '2012-03-27 14:35:42',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:42',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
-		'section_style': 'Tray',
+		'section_style': u'Tray',
 		'show_in_menu': 0,
 		'version': 1
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Form 16A Ack Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Form 16A Ack Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# DocType, Form 16A Ack Detail
 	{
 		'doctype': 'DocType',
-		'name': 'Form 16A Ack Detail'
+		'name': u'Form 16A Ack Detail'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'quarter',
-		'fieldtype': 'Select',
-		'idx': 1,
-		'label': 'Quarter',
-		'oldfieldname': 'quarter',
-		'oldfieldtype': 'Select',
-		'options': '\nApr-Jun\nJul-Sept\nOct-Dec\nJan-Mar'
+		'doctype': u'DocField',
+		'fieldname': u'quarter',
+		'fieldtype': u'Select',
+		'label': u'Quarter',
+		'oldfieldname': u'quarter',
+		'oldfieldtype': u'Select',
+		'options': u'\nApr-Jun\nJul-Sept\nOct-Dec\nJan-Mar'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'ack_no',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Acknowledgement No.',
-		'oldfieldname': 'ack_no',
-		'oldfieldtype': 'Data'
+		'doctype': u'DocField',
+		'fieldname': u'ack_no',
+		'fieldtype': u'Data',
+		'label': u'Acknowledgement No.',
+		'oldfieldname': u'ack_no',
+		'oldfieldtype': u'Data'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/form_16a_tax_detail/form_16a_tax_detail.txt b/erpnext/accounts/doctype/form_16a_tax_detail/form_16a_tax_detail.txt
index 86a25da..c0a0c73 100644
--- a/erpnext/accounts/doctype/form_16a_tax_detail/form_16a_tax_detail.txt
+++ b/erpnext/accounts/doctype/form_16a_tax_detail/form_16a_tax_detail.txt
@@ -3,148 +3,138 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:02',
+		'creation': '2012-03-27 14:35:42',
 		'docstatus': 0,
-		'modified': '2010-09-27 16:53:54',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:42',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
-		'section_style': 'Tray',
+		'section_style': u'Tray',
 		'show_in_menu': 0,
 		'version': 1
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Form 16A Tax Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Form 16A Tax Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# DocType, Form 16A Tax Detail
 	{
 		'doctype': 'DocType',
-		'name': 'Form 16A Tax Detail'
+		'name': u'Form 16A Tax Detail'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amount_paid',
-		'fieldtype': 'Currency',
-		'idx': 1,
-		'label': 'Amount paid / credited',
-		'oldfieldname': 'amount_paid',
-		'oldfieldtype': 'Currency'
+		'doctype': u'DocField',
+		'fieldname': u'amount_paid',
+		'fieldtype': u'Currency',
+		'label': u'Amount paid / credited',
+		'oldfieldname': u'amount_paid',
+		'oldfieldtype': u'Currency'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'date_of_payment',
-		'fieldtype': 'Date',
-		'idx': 2,
-		'label': 'Date of payment / credit',
-		'oldfieldname': 'date_of_payment',
-		'oldfieldtype': 'Date'
+		'doctype': u'DocField',
+		'fieldname': u'date_of_payment',
+		'fieldtype': u'Date',
+		'label': u'Date of payment / credit',
+		'oldfieldname': u'date_of_payment',
+		'oldfieldtype': u'Date'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'tds_main',
-		'fieldtype': 'Currency',
-		'idx': 3,
-		'label': 'TDS(Main)',
-		'oldfieldname': 'tds_main',
-		'oldfieldtype': 'Currency'
+		'doctype': u'DocField',
+		'fieldname': u'tds_main',
+		'fieldtype': u'Currency',
+		'label': u'TDS(Main)',
+		'oldfieldname': u'tds_main',
+		'oldfieldtype': u'Currency'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'surcharge',
-		'fieldtype': 'Currency',
-		'idx': 4,
-		'label': 'Surcharge',
-		'oldfieldname': 'surcharge',
-		'oldfieldtype': 'Currency'
+		'doctype': u'DocField',
+		'fieldname': u'surcharge',
+		'fieldtype': u'Currency',
+		'label': u'Surcharge',
+		'oldfieldname': u'surcharge',
+		'oldfieldtype': u'Currency'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'cess_on_tds',
-		'fieldtype': 'Currency',
-		'idx': 5,
-		'label': 'Cess on TDS',
-		'oldfieldname': 'cess_on_tds',
-		'oldfieldtype': 'Currency'
+		'doctype': u'DocField',
+		'fieldname': u'cess_on_tds',
+		'fieldtype': u'Currency',
+		'label': u'Cess on TDS',
+		'oldfieldname': u'cess_on_tds',
+		'oldfieldtype': u'Currency'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'total_tax_deposited',
-		'fieldtype': 'Currency',
-		'idx': 8,
-		'label': 'Total Tax Deposited',
-		'oldfieldname': 'total_tax_deposited',
-		'oldfieldtype': 'Currency'
+		'doctype': u'DocField',
+		'fieldname': u'total_tax_deposited',
+		'fieldtype': u'Currency',
+		'label': u'Total Tax Deposited',
+		'oldfieldname': u'total_tax_deposited',
+		'oldfieldtype': u'Currency'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'cheque_no',
-		'fieldtype': 'Data',
-		'idx': 9,
-		'label': 'Cheque / DD No.',
-		'oldfieldname': 'cheque_no',
-		'oldfieldtype': 'Data'
+		'doctype': u'DocField',
+		'fieldname': u'cheque_no',
+		'fieldtype': u'Data',
+		'label': u'Cheque / DD No.',
+		'oldfieldname': u'cheque_no',
+		'oldfieldtype': u'Data'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'bsr_code',
-		'fieldtype': 'Data',
-		'idx': 10,
-		'label': 'BSR Code',
-		'oldfieldname': 'bsr_code',
-		'oldfieldtype': 'Data'
+		'doctype': u'DocField',
+		'fieldname': u'bsr_code',
+		'fieldtype': u'Data',
+		'label': u'BSR Code',
+		'oldfieldname': u'bsr_code',
+		'oldfieldtype': u'Data'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'tax_deposited_date',
-		'fieldtype': 'Date',
-		'idx': 11,
-		'label': 'Tax Deposited Date',
-		'oldfieldname': 'tax_deposited_date',
-		'oldfieldtype': 'Date'
+		'doctype': u'DocField',
+		'fieldname': u'tax_deposited_date',
+		'fieldtype': u'Date',
+		'label': u'Tax Deposited Date',
+		'oldfieldname': u'tax_deposited_date',
+		'oldfieldtype': u'Date'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'challan_no',
-		'fieldtype': 'Data',
-		'idx': 12,
-		'label': 'Challan No.',
-		'oldfieldname': 'challan_no',
-		'oldfieldtype': 'Data'
+		'doctype': u'DocField',
+		'fieldname': u'challan_no',
+		'fieldtype': u'Data',
+		'label': u'Challan No.',
+		'oldfieldname': u'challan_no',
+		'oldfieldtype': u'Data'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/gl_control/gl_control.py b/erpnext/accounts/doctype/gl_control/gl_control.py
index fa98441..84fea75 100644
--- a/erpnext/accounts/doctype/gl_control/gl_control.py
+++ b/erpnext/accounts/doctype/gl_control/gl_control.py
@@ -35,12 +35,6 @@
 		self.doc, self.doclist = d, dl
 		self.entries = []
 
-	# Get Company List
-	# ----------------
-	def get_companies(self,arg=''):
-		ret = webnotes.conn.sql("select name, abbr from tabCompany where docstatus != 2")
-		return {'cl':[r[0] for r in ret]}
-
 	def get_company_currency(self,arg=''):
 		dcc = TransactionBase().get_company_currency(arg)
 		return dcc
@@ -297,7 +291,7 @@
 			add.remarks = d[1]
 			add.advance_amount = flt(d[2])
 			add.allocate_amount = 0
-			if table_name == 'Advance Allocation Detail':
+			if table_name == 'Purchase Invoice Advance':
 				add.tds_amount = flt(d[4])
 
 	# Clear rows which is not adjusted
@@ -319,7 +313,7 @@
 				get_obj(dt='GL Control').make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel =1, adv_adj =1)
 
 				# update ref in JV Detail
-				webnotes.conn.sql("update `tabJournal Voucher Detail` set %s = '%s' where name = '%s'" % (doctype=='Payable Voucher' and 'against_voucher' or 'against_invoice', cstr(against_document_no), d.jv_detail_no))
+				webnotes.conn.sql("update `tabJournal Voucher Detail` set %s = '%s' where name = '%s'" % (doctype=='Purchase Invoice' and 'against_voucher' or 'against_invoice', cstr(against_document_no), d.jv_detail_no))
 
 				# re-submit JV
 				jv_obj = get_obj('Journal Voucher', d.journal_voucher, with_children =1)
@@ -351,7 +345,7 @@
 		balance = flt(advance) - flt(allocate)
 
 		# update old entry
-		webnotes.conn.sql("update `tabJournal Voucher Detail` set %s = '%s', %s = '%s' where name = '%s'" % (dr_or_cr, flt(allocate), doctype == "Payable Voucher" and 'against_voucher' or 'against_invoice',cstr(against_document_no), jv_detail_no))
+		webnotes.conn.sql("update `tabJournal Voucher Detail` set %s = '%s', %s = '%s' where name = '%s'" % (dr_or_cr, flt(allocate), doctype == "Purchase Invoice" and 'against_voucher' or 'against_invoice',cstr(against_document_no), jv_detail_no))
 
 		# new entry with balance amount
 		add = addchild(jv_obj.doc, 'entries', 'Journal Voucher Detail', 1, jv_obj.doclist)
@@ -390,8 +384,8 @@
 
 			against_fld = {
 				'Journal Voucher' : 'against_jv',
-				'Receivable Voucher' : 'against_invoice',
-				'Payable Voucher' : 'against_voucher'
+				'Sales Invoice' : 'against_invoice',
+				'Purchase Invoice' : 'against_voucher'
 			}
 			
 			d['against_fld'] = against_fld[d['against_voucher_type']]
@@ -450,43 +444,6 @@
 		if not ret:
 			msgprint("Payment Entry has been modified after you pulled it. Please pull it again.", raise_exception=1)
 		
-######################################################################################################################
-		
-
-
-	# Repair Outstanding Amount
-	#---------------------------------
-	def repair_voucher_outstanding(self, voucher_obj):
-		msg = []
-
-		# Get Balance from GL Entries
-		bal = webnotes.conn.sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s", (voucher_obj.doc.name , voucher_obj.doc.doctype))
-		bal = bal and flt(bal[0][0]) or 0.0
-		if cstr(voucher_obj.doc.doctype) == 'Payable Voucher':
-			bal = -bal
-
-		# Check outstanding Amount
-		if flt(voucher_obj.doc.outstanding_amount) != flt(bal):
-			msgprint('<div style="color: RED"> Difference found in Outstanding Amount of %s : %s (Before : %s; After : %s) </div>' % (voucher_obj.doc.doctype, voucher_obj.doc.name, voucher_obj.doc.outstanding_amount, bal))
-			msg.append('<div style="color: RED"> Difference found in Outstanding Amount of %s : %s (Before : %s; After : %s) </div>' % (voucher_obj.doc.doctype, voucher_obj.doc.name, voucher_obj.doc.outstanding_amount, bal))
-
-			# set voucher balance
-			#webnotes.conn.sql("update `tab%s` set outstanding_amount=%s where name='%s'" % (voucher_obj.doc.doctype, bal, voucher_obj.doc.name))
-			webnotes.conn.set(voucher_obj.doc, 'outstanding_amount', flt(bal))
-
-		# Send Mail
-		if msg:
-			email_msg = """ Dear Administrator,
-
-In Account := %s User := %s has Repaired Outstanding Amount For %s : %s and following was found:-
-
-%s
-
-""" % (webnotes.conn.get_value('Control Panel', None,'account_id'), session['user'], voucher_obj.doc.doctype, voucher_obj.doc.name, '\n'.join(msg))
-
-			sendmail(['support@iwebnotes.com'], subject='Repair Outstanding Amount', parts = [('text/plain', email_msg)])
-		# Acknowledge User
-		msgprint(cstr(voucher_obj.doc.doctype) + " : " + cstr(voucher_obj.doc.name) + " has been checked" + cstr(msg and " and repaired successfully." or ". No changes Found."))
 
 	def repost_illegal_cancelled(self, after_date='2011-01-01'):
 		"""
@@ -520,11 +477,11 @@
 		Create recurring invoices on specific date by copying the original one
 		and notify the concerned people
 	"""	
-	rv = webnotes.conn.sql("""select name, recurring_id from `tabReceivable Voucher` where ifnull(convert_into_recurring_invoice, 0) = 1 
+	rv = webnotes.conn.sql("""select name, recurring_id from `tabSales Invoice` where ifnull(convert_into_recurring_invoice, 0) = 1 
 			and next_date = %s and next_date <= end_date and docstatus=1 order by next_date	desc""", nowdate())
 	for d in rv:
-		if not webnotes.conn.sql("""select name from `tabReceivable Voucher` where posting_date = %s and recurring_id = %s and docstatus=1""", (nowdate(), d[1])):
-			prev_rv = get_obj('Receivable Voucher', d[0], with_children=1)
+		if not webnotes.conn.sql("""select name from `tabSales Invoice` where posting_date = %s and recurring_id = %s and docstatus=1""", (nowdate(), d[1])):
+			prev_rv = get_obj('Sales Invoice', d[0], with_children=1)
 			new_rv = create_new_invoice(prev_rv)
 
 			send_notification(new_rv)
diff --git a/erpnext/accounts/doctype/gl_control/gl_control.txt b/erpnext/accounts/doctype/gl_control/gl_control.txt
index f31b64d..d75ff16 100644
--- a/erpnext/accounts/doctype/gl_control/gl_control.txt
+++ b/erpnext/accounts/doctype/gl_control/gl_control.txt
@@ -3,22 +3,22 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:03',
+		'creation': '2012-03-27 14:35:42',
 		'docstatus': 0,
-		'modified': '2010-12-29 12:57:24',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:42',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'issingle': 1,
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 288
 	},
@@ -26,6 +26,6 @@
 	# DocType, GL Control
 	{
 		'doctype': 'DocType',
-		'name': 'GL Control'
+		'name': u'GL Control'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.py b/erpnext/accounts/doctype/gl_entry/gl_entry.py
index 49b0593..11ab2c2 100644
--- a/erpnext/accounts/doctype/gl_entry/gl_entry.py
+++ b/erpnext/accounts/doctype/gl_entry/gl_entry.py
@@ -114,9 +114,9 @@
 	#----------------------------------------------------------------------------------------------
 	def check_freezing_date(self, adv_adj):
 		if not adv_adj:
-			acc_frozen_upto = get_value('Manage Account', None, 'acc_frozen_upto')
+			acc_frozen_upto = get_value('Global Defaults', None, 'acc_frozen_upto')
 			if acc_frozen_upto:
-				bde_auth_role = get_value( 'Manage Account', None,'bde_auth_role')
+				bde_auth_role = get_value( 'Global Defaults', None,'bde_auth_role')
 				if getdate(self.doc.posting_date) <= getdate(acc_frozen_upto) and not bde_auth_role in webnotes.user.get_roles():
 					msgprint("You are not authorized to do/modify back dated accounting entries before %s." % getdate(acc_frozen_upto).strftime('%d-%m-%Y'), raise_exception=1)
 
@@ -234,12 +234,12 @@
 		bal = flt(sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s and ifnull(is_cancelled,'No') = 'No'", (self.doc.against_voucher, self.doc.against_voucher_type))[0][0] or 0.0)
 		tds = 0
 		
-		if self.doc.against_voucher_type=='Payable Voucher':
+		if self.doc.against_voucher_type=='Purchase Invoice':
 			# amount to debit
 			bal = -bal
 			
 			# Check if tds applicable
-			tds = sql("select total_tds_on_voucher from `tabPayable Voucher` where name = '%s'" % self.doc.against_voucher)
+			tds = sql("select total_tds_on_voucher from `tabPurchase Invoice` where name = '%s'" % self.doc.against_voucher)
 			tds = tds and flt(tds[0][0]) or 0
 		
 		# Validation : Outstanding can not be negative
@@ -257,7 +257,7 @@
 		#check for user role Freezed
 		master_type=sql("select master_type, master_name from `tabAccount` where name='%s' " %self.doc.account)
 		tot_outstanding = 0	#needed when there is no GL Entry in the system for that acc head
-		if (self.doc.voucher_type=='Journal Voucher' or self.doc.voucher_type=='Receivable Voucher') and (master_type and master_type[0][0]=='Customer' and master_type[0][1]):
+		if (self.doc.voucher_type=='Journal Voucher' or self.doc.voucher_type=='Sales Invoice') and (master_type and master_type[0][0]=='Customer' and master_type[0][1]):
 			dbcr = sql("select sum(debit),sum(credit) from `tabGL Entry` where account = '%s' and is_cancelled='No'" % self.doc.account)
 			if dbcr:
 				tot_outstanding = flt(dbcr[0][0])-flt(dbcr[0][1])+flt(self.doc.debit)-flt(self.doc.credit)
diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.txt b/erpnext/accounts/doctype/gl_entry/gl_entry.txt
index 1d84e1d..0888a95 100644
--- a/erpnext/accounts/doctype/gl_entry/gl_entry.txt
+++ b/erpnext/accounts/doctype/gl_entry/gl_entry.txt
@@ -3,303 +3,301 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:03',
+		'creation': '2012-03-27 14:35:42',
 		'docstatus': 0,
-		'modified': '2011-11-24 15:03:45',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:42',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1319016431',
-		'autoname': 'GL.#######',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'_last_update': u'1319016431',
+		'autoname': u'GL.#######',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
 		'in_create': 1,
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
-		'search_fields': 'voucher_no,account,posting_date,against_voucher',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'search_fields': u'voucher_no,account,posting_date,against_voucher',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 103
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'GL Entry',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'GL Entry',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'create': 0,
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'GL Entry',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1
+		'parent': u'GL Entry',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1,
+		'write': 0
 	},
 
 	# DocType, GL Entry
 	{
 		'doctype': 'DocType',
-		'name': 'GL Entry'
+		'name': u'GL Entry'
 	},
 
 	# DocPerm
 	{
 		'amend': 0,
 		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'role': 'Accounts User',
-		'submit': 0,
-		'write': 0
+		'doctype': u'DocPerm',
+		'role': u'Accounts User',
+		'submit': 0
 	},
 
 	# DocPerm
 	{
 		'amend': 0,
 		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Accounts Manager',
-		'submit': 0,
-		'write': 0
+		'role': u'Accounts Manager',
+		'submit': 0
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager'
+		'role': u'System Manager'
 	},
 
 	# DocField
 	{
-		'description': 'The date at which current entry will get or has actually executed.',
-		'doctype': 'DocField',
-		'fieldname': 'posting_date',
-		'fieldtype': 'Date',
+		'description': u'The date at which current entry will get or has actually executed.',
+		'doctype': u'DocField',
+		'fieldname': u'posting_date',
+		'fieldtype': u'Date',
 		'in_filter': 1,
-		'label': 'Posting Date',
-		'oldfieldname': 'posting_date',
-		'oldfieldtype': 'Date',
+		'label': u'Posting Date',
+		'oldfieldname': u'posting_date',
+		'oldfieldtype': u'Date',
 		'search_index': 1
 	},
 
 	# DocField
 	{
-		'description': 'The date at which current entry is made in system.',
-		'doctype': 'DocField',
-		'fieldname': 'transaction_date',
-		'fieldtype': 'Date',
-		'label': 'Transaction Date',
-		'oldfieldname': 'transaction_date',
-		'oldfieldtype': 'Date'
+		'description': u'The date at which current entry is made in system.',
+		'doctype': u'DocField',
+		'fieldname': u'transaction_date',
+		'fieldtype': u'Date',
+		'label': u'Transaction Date',
+		'oldfieldname': u'transaction_date',
+		'oldfieldtype': u'Date'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'aging_date',
-		'fieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'aging_date',
+		'fieldtype': u'Date',
 		'in_filter': 1,
-		'label': 'Aging Date',
-		'oldfieldname': 'aging_date',
-		'oldfieldtype': 'Date',
+		'label': u'Aging Date',
+		'oldfieldname': u'aging_date',
+		'oldfieldtype': u'Date',
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'account',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'account',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Account',
-		'oldfieldname': 'account',
-		'oldfieldtype': 'Link',
-		'options': 'Account',
+		'label': u'Account',
+		'oldfieldname': u'account',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
 		'search_index': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'cost_center',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'cost_center',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Cost Center',
-		'oldfieldname': 'cost_center',
-		'oldfieldtype': 'Link',
-		'options': 'Cost Center',
+		'label': u'Cost Center',
+		'oldfieldname': u'cost_center',
+		'oldfieldtype': u'Link',
+		'options': u'Cost Center',
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'debit',
-		'fieldtype': 'Currency',
-		'label': 'Debit Amt',
-		'oldfieldname': 'debit',
-		'oldfieldtype': 'Currency'
+		'doctype': u'DocField',
+		'fieldname': u'debit',
+		'fieldtype': u'Currency',
+		'label': u'Debit Amt',
+		'oldfieldname': u'debit',
+		'oldfieldtype': u'Currency'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'credit',
-		'fieldtype': 'Currency',
-		'label': 'Credit Amt',
-		'oldfieldname': 'credit',
-		'oldfieldtype': 'Currency'
+		'doctype': u'DocField',
+		'fieldname': u'credit',
+		'fieldtype': u'Currency',
+		'label': u'Credit Amt',
+		'oldfieldname': u'credit',
+		'oldfieldtype': u'Currency'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'against',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'against',
+		'fieldtype': u'Text',
 		'in_filter': 1,
-		'label': 'Against',
-		'oldfieldname': 'against',
-		'oldfieldtype': 'Text'
+		'label': u'Against',
+		'oldfieldname': u'against',
+		'oldfieldtype': u'Text'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'against_voucher',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'against_voucher',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Against Voucher',
-		'oldfieldname': 'against_voucher',
-		'oldfieldtype': 'Data',
+		'label': u'Against Voucher',
+		'oldfieldname': u'against_voucher',
+		'oldfieldtype': u'Data',
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'against_voucher_type',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'against_voucher_type',
+		'fieldtype': u'Data',
 		'in_filter': 0,
-		'label': 'Against Voucher Type',
-		'oldfieldname': 'against_voucher_type',
-		'oldfieldtype': 'Data',
+		'label': u'Against Voucher Type',
+		'oldfieldname': u'against_voucher_type',
+		'oldfieldtype': u'Data',
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'voucher_type',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'voucher_type',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Voucher Type',
-		'oldfieldname': 'voucher_type',
-		'oldfieldtype': 'Select',
-		'options': 'Journal Voucher\nReceivable Voucher\nPayable Voucher',
+		'label': u'Voucher Type',
+		'oldfieldname': u'voucher_type',
+		'oldfieldtype': u'Select',
+		'options': u'Journal Voucher\nSales Invoice\nPurchase Invoice',
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'voucher_no',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'voucher_no',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Voucher No',
-		'oldfieldname': 'voucher_no',
-		'oldfieldtype': 'Data',
+		'label': u'Voucher No',
+		'oldfieldname': u'voucher_no',
+		'oldfieldtype': u'Data',
 		'search_index': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'remarks',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'remarks',
+		'fieldtype': u'Text',
 		'in_filter': 1,
-		'label': 'Remarks',
+		'label': u'Remarks',
 		'no_copy': 1,
-		'oldfieldname': 'remarks',
-		'oldfieldtype': 'Text',
+		'oldfieldname': u'remarks',
+		'oldfieldtype': u'Text',
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'is_cancelled',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'is_cancelled',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Is Cancelled',
-		'oldfieldname': 'is_cancelled',
-		'oldfieldtype': 'Select',
-		'options': 'No\nYes',
+		'label': u'Is Cancelled',
+		'oldfieldname': u'is_cancelled',
+		'oldfieldtype': u'Select',
+		'options': u'No\nYes',
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'is_opening',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'is_opening',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Is Opening',
-		'oldfieldname': 'is_opening',
-		'oldfieldtype': 'Select',
-		'options': 'No\nYes',
+		'label': u'Is Opening',
+		'oldfieldname': u'is_opening',
+		'oldfieldtype': u'Select',
+		'options': u'No\nYes',
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'is_advance',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'is_advance',
+		'fieldtype': u'Select',
 		'in_filter': 0,
-		'label': 'Is Advance',
-		'oldfieldname': 'is_advance',
-		'oldfieldtype': 'Select',
-		'options': 'No\nYes',
+		'label': u'Is Advance',
+		'oldfieldname': u'is_advance',
+		'oldfieldtype': u'Select',
+		'options': u'No\nYes',
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Fiscal Year',
-		'oldfieldname': 'fiscal_year',
-		'oldfieldtype': 'Select',
-		'options': 'link:Fiscal Year',
+		'label': u'Fiscal Year',
+		'oldfieldname': u'fiscal_year',
+		'oldfieldtype': u'Select',
+		'options': u'link:Fiscal Year',
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Company',
-		'oldfieldname': 'company',
-		'oldfieldtype': 'Link',
-		'options': 'Company',
+		'label': u'Company',
+		'oldfieldname': u'company',
+		'oldfieldtype': u'Link',
+		'options': u'Company',
 		'search_index': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/internal_reconciliation/internal_reconciliation.py b/erpnext/accounts/doctype/internal_reconciliation/internal_reconciliation.py
deleted file mode 100644
index 0ab0e05..0000000
--- a/erpnext/accounts/doctype/internal_reconciliation/internal_reconciliation.py
+++ /dev/null
@@ -1,156 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-	
-# -----------------------------------------------------------------------------------------
-
-
-class DocType:
-	def __init__(self, doc, doclist):
-		self.doc = doc
-		self.doclist = doclist
-		self.acc_type = self.doc.account and sql("select debit_or_credit from `tabAccount` where name = %s", self.doc.account)[0][0].lower() or ''
-		self.dt = {
-			'Sales Invoice': 'Receivable Voucher',
-			'Purchase Invoice': 'Payable Voucher',
-			'Journal Voucher': 'Journal Voucher'
-		}
-		
-	#--------------------------------------------------
-	def get_voucher_details(self):
-		tot_amt = sql("""
-			select sum(%s) from `tabGL Entry` where 
-			voucher_type = %s and voucher_no = %s 
-			and account = %s and ifnull(is_cancelled, 'No') = 'No'
-		"""% (self.acc_type, '%s', '%s', '%s'), (self.dt[self.doc.voucher_type], self.doc.voucher_no, self.doc.account))
-		
-		outstanding = sql("""
-			select sum(%s) - sum(%s) from `tabGL Entry` where 
-			against_voucher = %s and voucher_no != %s
-			and account = %s and ifnull(is_cancelled, 'No') = 'No'
-		""" % ((self.acc_type == 'debit' and 'credit' or 'debit'), self.acc_type, '%s', '%s', '%s'), (self.doc.voucher_no, self.doc.voucher_no, self.doc.account))
-		
-		ret = {
-			'total_amount': flt(tot_amt[0][0]) or 0,	
-			'pending_amt_to_reconcile': flt(tot_amt[0][0]) - flt(outstanding[0][0]) or 0
-		}
-		
-		return ret
-
-		
-	#--------------------------------------------------
-	def get_payment_entries(self):
-		"""
-			Get payment entries for the account and period
-			Payment entry will be decided based on account type (Dr/Cr)
-		"""
-
-		self.doc.clear_table(self.doclist, 'ir_payment_details')		
-		gle = self.get_gl_entries()
-		self.create_payment_table(gle)
-
-	#--------------------------------------------------
-	def get_gl_entries(self):
-		self.validate_mandatory()
-		dc = self.acc_type == 'debit' and 'credit' or 'debit'
-		
-		cond = self.doc.from_date and " and t1.posting_date >= '" + self.doc.from_date + "'" or ""
-		cond += self.doc.to_date and " and t1.posting_date <= '" + self.doc.to_date + "'"or ""
-		
-		cond += self.doc.amt_greater_than and ' and t2.' + dc+' >= ' + self.doc.amt_greater_than or ''
-		cond += self.doc.amt_less_than and ' and t2.' + dc+' <= ' + self.doc.amt_less_than or ''
-
-		gle = sql("""
-			select t1.name as voucher_no, t1.posting_date, t1.total_debit as total_amt,  sum(ifnull(t2.credit, 0)) - sum(ifnull(t2.debit, 0)) as amt_due, t1.remark, t2.against_account, t2.name as voucher_detail_no
-			from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
-			where t1.name = t2.parent  
-			and t1.docstatus = 1 
-			and t2.account = %s
-			and ifnull(t2.against_voucher, '')='' and ifnull(t2.against_invoice, '')='' and ifnull(t2.against_jv, '')=''
-			and t2.%s > 0
-			%s
-			group by t1.name, t2.name
-		"""% ('%s', dc, cond), self.doc.account, as_dict=1)
-
-		return gle
-
-	#--------------------------------------------------
-	def create_payment_table(self, gle):
-		for d in gle:
-			ch = addchild(self.doc, 'ir_payment_details', 'IR Payment Detail', 1, self.doclist)
-			ch.voucher_no = d.get('voucher_no')
-			ch.posting_date = d.get('posting_date')
-			ch.amt_due =  self.acc_type == 'debit' and flt(d.get('amt_due')) or -1*flt(d.get('amt_due'))
-			ch.total_amt = flt(d.get('total_amt'))
-			ch.against_account = d.get('against_account')
-			ch.remarks = d.get('remark')
-			ch.amt_to_be_reconciled = flt(ch.amt_due)
-			ch.voucher_detail_no = d.get('voucher_detail_no')
-			
-	#--------------------------------------------------
-	def validate_mandatory(self):
-		if not self.doc.account:
-			msgprint("Please select Account first", raise_exception=1)
-	
-	#--------------------------------------------------	
-	def reconcile(self):
-		"""
-			Links booking and payment voucher
-			1. cancel payment voucher
-			2. split into multiple rows if partially adjusted, assign against voucher
-			3. submit payment voucher
-		"""
-		if not self.doc.voucher_no or not sql("select name from `tab%s` where name = %s" %(self.dt[self.doc.voucher_type], '%s'),  self.doc.voucher_no):
-			msgprint("Please select valid Voucher No to proceed", raise_exception=1)
-		
-		lst = []
-		for d in getlist(self.doclist, 'ir_payment_details'):
-			if d.selected and flt(d.amt_to_be_reconciled) > 0:
-				args = {
-					'voucher_no' : d.voucher_no,
-					'voucher_detail_no' : d.voucher_detail_no, 
-					'against_voucher_type' : self.dt[self.doc.voucher_type], 
-					'against_voucher'  : self.doc.voucher_no,
-					'account' : self.doc.account, 
-					'is_advance' : 'No', 
-					'dr_or_cr' :  self.acc_type=='debit' and 'credit' or 'debit', 
-					'unadjusted_amt' : flt(d.amt_due),
-					'allocated_amt' : flt(d.amt_to_be_reconciled)
-				}
-			
-				lst.append(args)
-		
-
-		if lst:
-			get_obj('GL Control').reconcile_against_document(lst)
-			msgprint("Successfully reconciled.")
-		else:
-			msgprint("No payment entries selected.", raise_exception=1)
diff --git a/erpnext/accounts/doctype/internal_reconciliation/internal_reconciliation.txt b/erpnext/accounts/doctype/internal_reconciliation/internal_reconciliation.txt
deleted file mode 100644
index 7114987..0000000
--- a/erpnext/accounts/doctype/internal_reconciliation/internal_reconciliation.txt
+++ /dev/null
@@ -1,266 +0,0 @@
-# DocType, Internal Reconciliation
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-08-30 11:45:50',
-		'docstatus': 0,
-		'modified': '2012-03-21 12:55:31',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': u'1316509358',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'document_type': u'Other',
-		'issingle': 1,
-		'module': u'Accounts',
-		'name': '__common__',
-		'section_style': u'Simple',
-		'show_in_menu': 1,
-		'version': 37
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Internal Reconciliation',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': u'DocPerm',
-		'name': '__common__',
-		'parent': u'Internal Reconciliation',
-		'parentfield': u'permissions',
-		'parenttype': u'DocType',
-		'read': 1
-	},
-
-	# DocType, Internal Reconciliation
-	{
-		'doctype': 'DocType',
-		'name': u'Internal Reconciliation'
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'System Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Accounts Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Accounts User',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'All'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'permlevel': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'account',
-		'fieldtype': u'Link',
-		'label': u'Account',
-		'options': u'Account',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'voucher_type',
-		'fieldtype': u'Select',
-		'label': u'Voucher Type',
-		'options': u'Sales Invoice\nPurchase Invoice\nJournal Voucher',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'voucher_no',
-		'fieldtype': u'Link',
-		'label': u'Voucher No',
-		'permlevel': 0,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'permlevel': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'total_amount',
-		'fieldtype': u'Currency',
-		'label': u'Total Amount',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'pending_amt_to_reconcile',
-		'fieldtype': u'Currency',
-		'label': u'Pending Amt To Reconcile',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Payment Entries',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'label': u"<div class = 'field_description'>Filter payment entries based on date:</div>",
-		'permlevel': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'from_date',
-		'fieldtype': u'Date',
-		'label': u'From Date',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'to_date',
-		'fieldtype': u'Date',
-		'label': u'To Date',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'label': u"<div class = 'field_description'>Filter payment entries based on amount:</div>",
-		'permlevel': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'amt_greater_than',
-		'fieldtype': u'Data',
-		'label': u'Amount >=',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'amt_less_than',
-		'fieldtype': u'Data',
-		'label': u'Amount <=',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'options': u'Simple',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Pull Payment Entries',
-		'options': u'get_payment_entries',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'ir_payment_details',
-		'fieldtype': u'Table',
-		'label': u'Payment Entries',
-		'options': u'IR Payment Detail',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'HTML',
-		'label': u'Reconcile HTML',
-		'options': u"<div class='field_description'>Select Payment Voucher and Amount to Reconcile in the above table and then click Reconcile button</div>",
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Reconcile',
-		'options': u'reconcile',
-		'permlevel': 0,
-		'trigger': u'Client'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/internal_reconciliation/test_ir.py b/erpnext/accounts/doctype/internal_reconciliation/test_ir.py
deleted file mode 100644
index c5aa935..0000000
--- a/erpnext/accounts/doctype/internal_reconciliation/test_ir.py
+++ /dev/null
@@ -1,185 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import unittest
-import webnotes
-
-from webnotes.model.doc import Document
-from webnotes.model.code import get_obj
-from webnotes.utils import cstr, flt
-sql = webnotes.conn.sql
-
-class TestInternalReco(unittest.TestCase):
-	def setUp(self):
-		webnotes.conn.begin()
-		
-		comp1.save(1)
-		cust1.save(1)
-		bank1.save(1)
-		rv1.save(1)
-		rv_gle.save(1)
-
-
-		for t in jv1: t.save(1)
-		for t in jv1[1:]:
-			sql("update `tabJournal Voucher Detail` set parent = '%s' where name = '%s'" % (jv1[0].name, t.name))
-			
-		ir[0].save()
-		for t in ir[1:]:
-			t.save(1)
-			sql("update `tabIR Payment Detail` set voucher_no = '%s', voucher_detail_no = '%s' where parent = 'Internal Reconciliation'" % (jv1[0].name, jv1[1].name))
-		
-		
-		sql("update `tabGL Entry` set voucher_no = %s, against_voucher = %s where voucher_no = 'rv1'", (rv1.name, rv1.name))
-		sql("update `tabSingles` set value = %s where doctype = 'Internal Reconciliation' and field = 'voucher_no'", rv1.name)
-		
-		
-		self.ir = get_obj('Internal Reconciliation', with_children=1)		
-		self.ir.reconcile()
-		
-	#===========================
-	def test_jv(self):
-		"""
-			Test whether JV has benn properly splitted and against doc has been updated
-		"""
-		amt_against_doc = [[cstr(d[0]), flt(d[1]), flt(d[2])]for d in sql("select against_invoice, debit, credit from `tabJournal Voucher Detail` where parent = %s and account = 'cust1 - c1'", jv1[0].name)]
-		self.assertTrue(amt_against_doc == [[rv1.name, 0, 100.0], ['', 0, 400.0]])
-
-	#============================		
-	def test_gl_entry(self):
-		"""
-			Check proper gl entry has been made
-		"""
-		gle = [[cstr(d[0]), flt(d[1])] for d in sql("select against_voucher, sum(credit) - sum(debit) from `tabGL Entry` where voucher_no = %s and account = 'cust1 - c1' and ifnull(is_cancelled, 'No') = 'No' group by against_voucher", jv1[0].name)]
-
-		self.assertTrue([rv1.name, 100.0] in gle)
-		self.assertTrue(['', 400.0] in gle)
-		
-	#============================
-	def test_outstanding(self):
-		"""
-			Check whether Outstanding amount has been properly updated in RV
-		"""
-		amt = sql("select outstanding_amount from `tabReceivable Voucher` where name = '%s'" % rv1.name)[0][0]
-		self.assertTrue(amt == 0)
-		
-	#============================
-	def tearDown(self):
-		webnotes.conn.rollback()
-	
-
-
-
-# test data
-#---------------
-rv1 = Document(fielddata={
-		'doctype':'Receivable Voucher',
-		'docstatus':1,
-		'debit_to':'cust1 - c1',
-		'grand_total': 100,
-		'outstanding_amount': 100,
-		'name': 'rv1'
-	})
-	
-jv1 = [Document(fielddata={
-		'doctype':'Journal Voucher',
-		'docstatus':1,
-		'cheque_no': '163567',
-		'docstatus':1,
-		'company': 'comp1',
-		'posting_date' : '2011-05-02',
-		'remark': 'test data',
-		'fiscal_year': '2011-2012',
-		'total_debit': 500,
-		'total_credit': 500
-	}),
-	Document(fielddata = {
-		'parenttype':'Journal Voucher',
-		'parentfield':'entries',
-		'doctype':'Journal Voucher Detail',
-		'account' : 'cust1 - c1',
-		'credit':500,
-		'debit' : 0,
-		'docstatus':1
-	}),
-	Document(fielddata = {
-		'parenttype':'Journal Voucher',
-		'parentfield':'entries',
-		'doctype':'Journal Voucher Detail',
-		'account' : 'bank1 - c1',
-		'credit':0,
-		'debit' : 500,
-		'docstatus':1
-	})]
-	
-ir = [Document(fielddata = {
-		'doctype':'Internal Reconciliation',
-		'name' : 'Internal Reconciliation',
-		'account':'cust1 - c1',
-		'voucher_type' : 'Sales Invoice',
-		'voucher_no': 'rv1'
-	}),
-	Document(fielddata = {
-		'parenttype':'Internal Reconciliation',
-		'parentfield':'ir_payment_details',
-		'doctype':'IR Payment Detail',
-		'parent': 'Internal Reconciliation',
-		'voucher_no': 'jv1',
-		'name' : '123112',
-		'voucher_detail_no' : 'jvd1',
-		'selected' : 1,
-		'amt_due' : 500,
-		'amt_to_be_reconciled':100
-	})]
-	
-cust1 = Document(fielddata={
-		'doctype':'Account',
-		'docstatus':0,
-		'account_name' : 'cust1',
-		'debit_or_credit': 'Debit',
-		'company' : 'comp1',
-		'lft': 1,
-		'rgt': 2
-	})
-	
-bank1 = Document(fielddata={
-		'doctype':'Account',
-		'docstatus':0,
-		'account_name' : 'bank1',
-		'debit_or_credit': 'Debit',
-		'company' : 'comp1',
-		'lft': 3,
-		'rgt': 4
-	})	
-	
-comp1 = Document(fielddata={
-		'doctype':'Company',
-		'abbr': 'c1',
-		'company_name' : 'comp1',
-		'name': 'comp1'
-	})
-	
-rv_gle = Document(fielddata={
-		'doctype':'GL Entry',
-		'account': 'cust1 - c1',
-		'company' : 'comp1',
-		'voucher_no': 'rv1',
-		'against_voucher': 'rv1',
-		'against_voucher_type': 'Receivable Voucher',
-		'voucher_type' : 'Receivable Voucher',
-		'debit': 100,
-		'credit': 0
-	})
diff --git a/erpnext/accounts/doctype/ir_payment_detail/ir_payment_detail.txt b/erpnext/accounts/doctype/ir_payment_detail/ir_payment_detail.txt
deleted file mode 100644
index b35c497..0000000
--- a/erpnext/accounts/doctype/ir_payment_detail/ir_payment_detail.txt
+++ /dev/null
@@ -1,132 +0,0 @@
-# DocType, IR Payment Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-08-30 11:57:48',
-		'docstatus': 0,
-		'modified': '2011-09-20 15:18:02',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Accounts',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'show_in_menu': 0,
-		'version': 14
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'IR Payment Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# DocType, IR Payment Detail
-	{
-		'doctype': 'DocType',
-		'name': 'IR Payment Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'selected',
-		'fieldtype': 'Check',
-		'label': 'Select',
-		'permlevel': 0,
-		'reqd': 1,
-		'width': '60px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'voucher_no',
-		'fieldtype': 'Link',
-		'label': 'Voucher No',
-		'options': 'Journal Voucher',
-		'permlevel': 1,
-		'reqd': 0,
-		'width': '140px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'amt_due',
-		'fieldtype': 'Currency',
-		'label': 'Amt Due',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'amt_to_be_reconciled',
-		'fieldtype': 'Currency',
-		'label': 'Amt to be reconciled',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'posting_date',
-		'fieldtype': 'Date',
-		'label': 'Posting Date',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'total_amt',
-		'fieldtype': 'Currency',
-		'label': 'Total Amt',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'against_account',
-		'fieldtype': 'Data',
-		'label': 'Against Account',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'remarks',
-		'fieldtype': 'Small Text',
-		'label': 'Remarks',
-		'permlevel': 1,
-		'width': '200px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'voucher_detail_no',
-		'fieldtype': 'Data',
-		'hidden': 1,
-		'label': 'Voucher Detail No',
-		'no_column': 0,
-		'permlevel': 1,
-		'print_hide': 1,
-		'reqd': 0
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js
index 771f026..772532e 100644
--- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js
+++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js
@@ -20,10 +20,10 @@
 	if (!doc.voucher_date) doc.voucher_date = dateutil.obj_to_str(new Date());
 
 	if(cp.country == 'India') {
-		unhide_field(['tds_applicable','tds_category','Get TDS','tax_code','rate','ded_amount','supplier_account']);
+		unhide_field(['tds_applicable','tds_category','get_tds','tax_code','rate','ded_amount','supplier_account']);
 	}
 	else {
-		hide_field(['tds_applicable','tds_category','Get TDS','tax_code','rate','ded_amount','supplier_account']);
+		hide_field(['tds_applicable','tds_category','get_tds','tax_code','rate','ded_amount','supplier_account']);
 	}
 
 	cur_frm.cscript.load_defaults(doc, cdt, cdn);
@@ -51,8 +51,8 @@
 	hide_field('aging_date');
 	if (doc.is_opening == 'Yes') unhide_field('aging_date');
 	
-	if(doc.docstatus==1) { unhide_field('View Ledger Entry'); }
-	else hide_field('View Ledger Entry');
+	if(doc.docstatus==1) { unhide_field('view_ledger_entry'); }
+	else hide_field('view_ledger_entry');
 }
 
 cur_frm.cscript.refresh = cur_frm.cscript.is_opening;
@@ -69,12 +69,12 @@
 // ---------------------------------
 cur_frm.fields_dict['entries'].grid.get_field('against_voucher').get_query = function(doc) {
 	var d = locals[this.doctype][this.docname];
-	return "SELECT `tabPayable Voucher`.name, `tabPayable Voucher`.credit_to, `tabPayable Voucher`.outstanding_amount,`tabPayable Voucher`.bill_no, `tabPayable Voucher`.bill_date FROM `tabPayable Voucher` WHERE `tabPayable Voucher`.credit_to='"+d.account+"' AND `tabPayable Voucher`.outstanding_amount > 0 AND `tabPayable Voucher`.docstatus = 1 AND `tabPayable Voucher`.%(key)s LIKE '%s' ORDER BY `tabPayable Voucher`.name DESC LIMIT 200";
+	return "SELECT `tabPurchase Invoice`.name, `tabPurchase Invoice`.credit_to, `tabPurchase Invoice`.outstanding_amount,`tabPurchase Invoice`.bill_no, `tabPurchase Invoice`.bill_date FROM `tabPurchase Invoice` WHERE `tabPurchase Invoice`.credit_to='"+d.account+"' AND `tabPurchase Invoice`.outstanding_amount > 0 AND `tabPurchase Invoice`.docstatus = 1 AND `tabPurchase Invoice`.%(key)s LIKE '%s' ORDER BY `tabPurchase Invoice`.name DESC LIMIT 200";
 }
 
 cur_frm.fields_dict['entries'].grid.get_field('against_invoice').get_query = function(doc) {
 	var d = locals[this.doctype][this.docname];
-	return "SELECT `tabReceivable Voucher`.name, `tabReceivable Voucher`.debit_to, `tabReceivable Voucher`.outstanding_amount FROM `tabReceivable Voucher` WHERE `tabReceivable Voucher`.debit_to='"+d.account+"' AND `tabReceivable Voucher`.outstanding_amount > 0 AND `tabReceivable Voucher`.docstatus = 1 AND `tabReceivable Voucher`.%(key)s LIKE '%s' ORDER BY `tabReceivable Voucher`.name DESC LIMIT 200";
+	return "SELECT `tabSales Invoice`.name, `tabSales Invoice`.debit_to, `tabSales Invoice`.outstanding_amount FROM `tabSales Invoice` WHERE `tabSales Invoice`.debit_to='"+d.account+"' AND `tabSales Invoice`.outstanding_amount > 0 AND `tabSales Invoice`.docstatus = 1 AND `tabSales Invoice`.%(key)s LIKE '%s' ORDER BY `tabSales Invoice`.name DESC LIMIT 200";
 }
 
 // TDS Account Head
@@ -92,13 +92,13 @@
 	}
 }
 
-// Get Outstanding of Payable & Receivable Voucher
+// Get Outstanding of Payable & Sales Invoice
 // -----------------------------------------------
 
 cur_frm.cscript.against_voucher = function(doc,cdt,cdn) {
 	var d = locals[cdt][cdn];
 	if (d.against_voucher && !flt(d.debit)) {
-		args = {'doctype': 'Payable Voucher', 'docname': d.against_voucher }
+		args = {'doctype': 'Purchase Invoice', 'docname': d.against_voucher }
 		get_server_fields('get_outstanding',docstring(args),'entries',doc,cdt,cdn,1,function(r,rt) { cur_frm.cscript.update_totals(doc); });
 	}
 }
@@ -106,7 +106,7 @@
 cur_frm.cscript.against_invoice = function(doc,cdt,cdn) {
 	var d = locals[cdt][cdn];
 	if (d.against_invoice && !flt(d.credit)) {
-		args = {'doctype': 'Receivable Voucher', 'docname': d.against_invoice }
+		args = {'doctype': 'Sales Invoice', 'docname': d.against_invoice }
 		get_server_fields('get_outstanding',docstring(args),'entries',doc,cdt,cdn,1,function(r,rt) { cur_frm.cscript.update_totals(doc); });
 	}
 }
@@ -137,7 +137,7 @@
 	refresh_field('ded_amount');
 	cur_frm.cscript.update_totals(doc); 
 }
-cur_frm.cscript['Get Balance'] = function(doc,dt,dn) {
+cur_frm.cscript.get_balance = function(doc,dt,dn) {
 	cur_frm.cscript.update_totals(doc); 
 	$c_obj(make_doclist(dt,dn), 'get_balance', '', function(r, rt){
 	cur_frm.refresh();
@@ -157,14 +157,14 @@
 
 // TDS
 // --------
-cur_frm.cscript['Get TDS'] = function(doc, dt, dn) {
+cur_frm.cscript.get_tds = function(doc, dt, dn) {
 	$c_obj(make_doclist(dt,dn), 'get_tds', '', function(r, rt){
 		cur_frm.refresh();
 		cur_frm.cscript.update_totals(doc);
 	});
 }
 
-// ***************** Get Print Heading based on Receivable Voucher *****************
+// ***************** Get Print Heading based on Sales Invoice *****************
 cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
 	return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
 }
@@ -181,7 +181,7 @@
 }
 
 /****************** Get Accounting Entry *****************/
-cur_frm.cscript['View Ledger Entry'] = function(doc,cdt,cdn){
+cur_frm.cscript.view_ledger_entry = function(doc,cdt,cdn){
 	var callback = function(report){
 		report.set_filter('GL Entry', 'Voucher No',doc.name);
 		report.dt.run();
diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py
index a5b2abf..02f4841 100644
--- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py
+++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py
@@ -53,9 +53,9 @@
   def get_outstanding(self, args):
     args = eval(args)
     o_s = sql("select outstanding_amount from `tab%s` where name = '%s'" % (args['doctype'],args['docname']))
-    if args['doctype'] == 'Payable Voucher':
+    if args['doctype'] == 'Purchase Invoice':
       return {'debit': o_s and flt(o_s[0][0]) or 0}
-    if args['doctype'] == 'Receivable Voucher':
+    if args['doctype'] == 'Sales Invoice':
       return {'credit': o_s and flt(o_s[0][0]) or 0}
 
   #--------------------------------------------------------------------------------------------------------
@@ -72,11 +72,11 @@
     
     for d in getlist(self.doclist, 'entries'):
       if d.against_invoice and d.credit:
-        currency = sql("select currency from `tabReceivable Voucher` where name = '%s'" % d.against_invoice)
+        currency = sql("select currency from `tabSales Invoice` where name = '%s'" % d.against_invoice)
         currency = currency and currency[0][0] or ''
         r.append('%s %s against Invoice: %s' % (cstr(currency), fmt_money(flt(d.credit)), d.against_invoice))
       if d.against_voucher and d.debit:
-        bill_no = sql("select bill_no, bill_date, currency from `tabPayable Voucher` where name=%s", d.against_voucher)
+        bill_no = sql("select bill_no, bill_date, currency from `tabPurchase Invoice` where name=%s", d.against_voucher)
         if bill_no and bill_no[0][0] and bill_no[0][0].lower().strip() not in ['na', 'not applicable', 'none']:
           bill_no = bill_no and bill_no[0]
           r.append('%s %s against Bill %s dated %s' % (bill_no[2] and cstr(bill_no[2]) or '', fmt_money(flt(d.debit)), bill_no[0], bill_no[1] and formatdate(bill_no[1].strftime('%Y-%m-%d')) or ''))
@@ -97,7 +97,7 @@
       self.is_approving_authority = 0
 
       # Fetch credit controller role
-      approving_authority = sql("select value from `tabSingles` where field='credit_controller' and doctype='Manage Account'")
+      approving_authority = sql("select value from `tabSingles` where field='credit_controller' and doctype='Global Defaults'")
       approving_authority = approving_authority and approving_authority[0][0] or ''
 	    
       # Check logged-in user is authorized
@@ -155,13 +155,13 @@
   def check_account_against_entries(self):
     for d in getlist(self.doclist,'entries'):
       if d.against_invoice:
-        acc=sql("select debit_to from `tabReceivable Voucher` where name='%s'"%d.against_invoice)
+        acc=sql("select debit_to from `tabSales Invoice` where name='%s'"%d.against_invoice)
         if acc and acc[0][0] != d.account:
           msgprint("Debit account is not matching with receivable voucher")
           raise Exception
       
       if d.against_voucher:
-        acc=sql("select credit_to from `tabPayable Voucher` where name='%s'"%d.against_voucher)
+        acc=sql("select credit_to from `tabPurchase Invoice` where name='%s'"%d.against_voucher)
         if acc and acc[0][0] != d.account:
           msgprint("Credit account is not matching with payable voucher")
           raise Exception
@@ -369,9 +369,9 @@
   def get_values(self):
     cond = (flt(self.doc.write_off_amount) > 0) and ' and outstanding_amount <= '+self.doc.write_off_amount or ''
     if self.doc.write_off_based_on == 'Accounts Receivable':
-      return sql("select name, debit_to, outstanding_amount from `tabReceivable Voucher` where docstatus = 1 and company = '%s' and outstanding_amount > 0 %s" % (self.doc.company, cond))
+      return sql("select name, debit_to, outstanding_amount from `tabSales Invoice` where docstatus = 1 and company = '%s' and outstanding_amount > 0 %s" % (self.doc.company, cond))
     elif self.doc.write_off_based_on == 'Accounts Payable':
-      return sql("select name, credit_to, outstanding_amount from `tabPayable Voucher` where docstatus = 1 and company = '%s' and outstanding_amount > 0 %s" % (self.doc.company, cond))
+      return sql("select name, credit_to, outstanding_amount from `tabPurchase Invoice` where docstatus = 1 and company = '%s' and outstanding_amount > 0 %s" % (self.doc.company, cond))
 
 
   # -------------------------
diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.txt b/erpnext/accounts/doctype/journal_voucher/journal_voucher.txt
index 0d67374..97055f3 100644
--- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.txt
+++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.txt
@@ -3,62 +3,54 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:06',
+		'creation': '2012-04-13 11:55:50',
 		'docstatus': 0,
-		'modified': '2012-01-19 14:15:53',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Journal Voucher',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'modified': '2012-04-13 12:28:24',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1311251040',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'_last_update': u'1311251040',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
-		'module': 'Accounts',
+		'is_submittable': 1,
+		'module': u'Accounts',
 		'name': '__common__',
-		'search_fields': 'voucher_type,posting_date, due_date, cheque_no',
-		'section_style': 'Tabbed',
-		'server_code_error': ' ',
+		'search_fields': u'voucher_type,posting_date, due_date, cheque_no',
+		'section_style': u'Tabbed',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'subject': ' ',
-		'tag_fields': 'voucher_type',
-		'version': 311
+		'subject': u' ',
+		'tag_fields': u'voucher_type',
+		'version': 312
 	},
 
-	# These values are common for all DocFormat
+	# These values are common for all DocField
 	{
-		'doctype': 'DocFormat',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Journal Voucher',
-		'parentfield': 'formats',
-		'parenttype': 'DocType'
+		'parent': u'Journal Voucher',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Journal Voucher',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Journal Voucher',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Journal Voucher
 	{
 		'doctype': 'DocType',
-		'name': 'Journal Voucher'
+		'name': u'Journal Voucher'
 	},
 
 	# DocPerm
@@ -66,9 +58,9 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Accounts Manager',
+		'role': u'Accounts Manager',
 		'submit': 0,
 		'write': 0
 	},
@@ -78,9 +70,9 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Accounts Manager',
+		'role': u'Accounts Manager',
 		'submit': 1,
 		'write': 1
 	},
@@ -90,9 +82,9 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Accounts User',
+		'role': u'Accounts User',
 		'submit': 1,
 		'write': 1
 	},
@@ -102,63 +94,54 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Accounts User',
+		'role': u'Accounts User',
 		'submit': 0,
 		'write': 0
 	},
 
-	# DocFormat
-	{
-		'doctype': 'DocFormat',
-		'format': 'Payment Receipt Voucher'
-	},
-
-	# DocFormat
-	{
-		'doctype': 'DocFormat',
-		'format': 'Cheque Printing Format'
-	},
-
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Basic Info',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'basic_info',
+		'fieldtype': u'Section Break',
+		'label': u'Basic Info',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': '1. Select Series and Dates',
-		'oldfieldtype': 'Section Break',
-		'options': 'Simple',
+		'doctype': u'DocField',
+		'fieldname': u'1_select_series_and_dates',
+		'fieldtype': u'Section Break',
+		'label': u'1. Select Series and Dates',
+		'oldfieldtype': u'Section Break',
+		'options': u'Simple',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'voucher_type',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'voucher_type',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Voucher Type',
-		'oldfieldname': 'voucher_type',
-		'oldfieldtype': 'Select',
-		'options': '\nJournal Entry\nBank Voucher\nCash Voucher\nCredit Card Voucher\nDebit Note\nCredit Note\nContra Voucher\nExcise Voucher\nWrite Off Voucher',
+		'label': u'Voucher Type',
+		'oldfieldname': u'voucher_type',
+		'oldfieldtype': u'Select',
+		'options': u'\nJournal Entry\nBank Voucher\nCash Voucher\nCredit Card Voucher\nDebit Note\nCredit Note\nContra Voucher\nExcise Voucher\nWrite Off Voucher',
 		'permlevel': 0,
 		'print_hide': 0,
 		'search_index': 1
@@ -166,12 +149,12 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': "eval:doc.voucher_type == 'Write Off Voucher'",
-		'doctype': 'DocField',
-		'fieldname': 'write_off_amount',
-		'fieldtype': 'Currency',
-		'label': 'Write Off Amount <=',
+		'colour': u'White:FFF',
+		'depends_on': u"eval:doc.voucher_type == 'Write Off Voucher'",
+		'doctype': u'DocField',
+		'fieldname': u'write_off_amount',
+		'fieldtype': u'Currency',
+		'label': u'Write Off Amount <=',
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 1
@@ -179,14 +162,14 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'Accounts Receivable',
-		'depends_on': "eval:doc.voucher_type == 'Write Off Voucher'",
-		'doctype': 'DocField',
-		'fieldname': 'write_off_based_on',
-		'fieldtype': 'Select',
-		'label': 'Write Off Based On',
-		'options': 'Accounts Receivable\nAccounts Payable',
+		'colour': u'White:FFF',
+		'default': u'Accounts Receivable',
+		'depends_on': u"eval:doc.voucher_type == 'Write Off Voucher'",
+		'doctype': u'DocField',
+		'fieldname': u'write_off_based_on',
+		'fieldtype': u'Select',
+		'label': u'Write Off Based On',
+		'options': u'Accounts Receivable\nAccounts Payable',
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 1
@@ -194,16 +177,16 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'To manage multiple series please go to Setup > Manage Series',
-		'doctype': 'DocField',
-		'fieldname': 'naming_series',
-		'fieldtype': 'Select',
-		'label': 'Series',
+		'colour': u'White:FFF',
+		'description': u'To manage multiple series please go to Setup > Manage Series',
+		'doctype': u'DocField',
+		'fieldname': u'naming_series',
+		'fieldtype': u'Select',
+		'label': u'Series',
 		'no_copy': 1,
-		'oldfieldname': 'naming_series',
-		'oldfieldtype': 'Select',
-		'options': 'JV',
+		'oldfieldname': u'naming_series',
+		'oldfieldtype': u'Select',
+		'options': u'JV',
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1
@@ -211,16 +194,16 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'Today',
-		'doctype': 'DocField',
-		'fieldname': 'voucher_date',
-		'fieldtype': 'Date',
+		'colour': u'White:FFF',
+		'default': u'Today',
+		'doctype': u'DocField',
+		'fieldname': u'voucher_date',
+		'fieldtype': u'Date',
 		'in_filter': 1,
-		'label': 'Voucher Date',
+		'label': u'Voucher Date',
 		'no_copy': 1,
-		'oldfieldname': 'voucher_date',
-		'oldfieldtype': 'Date',
+		'oldfieldname': u'voucher_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'print_hide': 0,
 		'reqd': 1,
@@ -229,15 +212,15 @@
 
 	# DocField
 	{
-		'description': 'The date at which current entry will get or has actually executed.',
-		'doctype': 'DocField',
-		'fieldname': 'posting_date',
-		'fieldtype': 'Date',
+		'description': u'The date at which current entry will get or has actually executed.',
+		'doctype': u'DocField',
+		'fieldname': u'posting_date',
+		'fieldtype': u'Date',
 		'in_filter': 1,
-		'label': 'Posting Date',
+		'label': u'Posting Date',
 		'no_copy': 1,
-		'oldfieldname': 'posting_date',
-		'oldfieldtype': 'Date',
+		'oldfieldname': u'posting_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1
@@ -245,102 +228,104 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'due_date',
-		'fieldtype': 'Date',
-		'label': 'Due Date',
-		'oldfieldname': 'due_date',
-		'oldfieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'due_date',
+		'fieldtype': u'Date',
+		'label': u'Due Date',
+		'oldfieldname': u'due_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'print_hide': 0
 	},
 
 	# DocField
 	{
-		'description': 'The date at which current entry is corrected in the system.',
-		'doctype': 'DocField',
-		'fieldname': 'amendment_date',
-		'fieldtype': 'Date',
-		'label': 'Amendment Date',
+		'description': u'The date at which current entry is corrected in the system.',
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
+		'label': u'Amendment Date',
 		'no_copy': 1,
-		'oldfieldname': 'amendment_date',
-		'oldfieldtype': 'Date',
+		'oldfieldname': u'amendment_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amended_from',
-		'fieldtype': 'Link',
-		'label': 'Amended From',
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Link',
+		'label': u'Amended From',
 		'no_copy': 1,
-		'oldfieldname': 'amended_from',
-		'oldfieldtype': 'Link',
-		'options': 'Journal Voucher',
+		'oldfieldname': u'amended_from',
+		'oldfieldtype': u'Link',
+		'options': u'Journal Voucher',
 		'permlevel': 1,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': "eval:doc.voucher_type == 'Write Off Voucher'",
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Get Outstanding Invoices',
-		'options': 'get_outstanding_invoices',
+		'colour': u'White:FFF',
+		'depends_on': u"eval:doc.voucher_type == 'Write Off Voucher'",
+		'doctype': u'DocField',
+		'fieldname': u'get_outstanding_invoices',
+		'fieldtype': u'Button',
+		'label': u'Get Outstanding Invoices',
+		'options': u'get_outstanding_invoices',
 		'permlevel': 0,
 		'print_hide': 1,
-		'trigger': 'Server'
+		'trigger': u'Server'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'cheque_no',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'cheque_no',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Cheque No',
+		'label': u'Cheque No',
 		'no_copy': 1,
-		'oldfieldname': 'cheque_no',
-		'oldfieldtype': 'Data',
+		'oldfieldname': u'cheque_no',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'search_index': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'cheque_date',
-		'fieldtype': 'Date',
-		'label': 'Cheque Date',
+		'doctype': u'DocField',
+		'fieldname': u'cheque_date',
+		'fieldtype': u'Date',
+		'label': u'Cheque Date',
 		'no_copy': 1,
-		'oldfieldname': 'cheque_date',
-		'oldfieldtype': 'Date',
+		'oldfieldname': u'cheque_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'clearance_date',
-		'fieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'clearance_date',
+		'fieldtype': u'Date',
 		'in_filter': 1,
-		'label': 'Clearance Date',
+		'label': u'Clearance Date',
 		'no_copy': 1,
-		'oldfieldname': 'clearance_date',
-		'oldfieldtype': 'Date',
+		'oldfieldname': u'clearance_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 1,
 		'print_hide': 0,
 		'search_index': 1
@@ -348,197 +333,201 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'user_remark',
-		'fieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'user_remark',
+		'fieldtype': u'Small Text',
 		'in_filter': 1,
-		'label': 'User Remark',
+		'label': u'User Remark',
 		'no_copy': 1,
-		'oldfieldname': 'user_remark',
-		'oldfieldtype': 'Small Text',
+		'oldfieldname': u'user_remark',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'description': 'User Remark will be added to Auto Remark',
-		'doctype': 'DocField',
-		'fieldname': 'remark',
-		'fieldtype': 'Small Text',
-		'label': 'Remark',
+		'description': u'User Remark will be added to Auto Remark',
+		'doctype': u'DocField',
+		'fieldname': u'remark',
+		'fieldtype': u'Small Text',
+		'label': u'Remark',
 		'no_copy': 1,
-		'oldfieldname': 'remark',
-		'oldfieldtype': 'Small Text',
+		'oldfieldname': u'remark',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': '2. Add / Edit GL Entries',
-		'oldfieldtype': 'Section Break',
-		'options': 'Simple',
+		'doctype': u'DocField',
+		'fieldname': u'2_add_edit_gl_entries',
+		'fieldtype': u'Section Break',
+		'label': u'2. Add / Edit GL Entries',
+		'oldfieldtype': u'Section Break',
+		'options': u'Simple',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
 		'allow_on_submit': 1,
-		'doctype': 'DocField',
-		'fieldname': 'entries',
-		'fieldtype': 'Table',
-		'label': 'Entries',
-		'oldfieldname': 'entries',
-		'oldfieldtype': 'Table',
-		'options': 'Journal Voucher Detail',
+		'doctype': u'DocField',
+		'fieldname': u'entries',
+		'fieldtype': u'Table',
+		'label': u'Entries',
+		'oldfieldname': u'entries',
+		'oldfieldtype': u'Table',
+		'options': u'Journal Voucher Detail',
 		'permlevel': 0,
 		'print_hide': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Get Balance',
-		'oldfieldtype': 'Button',
+		'doctype': u'DocField',
+		'fieldname': u'get_balance',
+		'fieldtype': u'Button',
+		'label': u'Get Balance',
+		'oldfieldtype': u'Button',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'total_debit',
-		'fieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'total_debit',
+		'fieldtype': u'Currency',
 		'in_filter': 1,
-		'label': 'Total Debit',
+		'label': u'Total Debit',
 		'no_copy': 1,
-		'oldfieldname': 'total_debit',
-		'oldfieldtype': 'Currency',
+		'oldfieldname': u'total_debit',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'total_credit',
-		'fieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'total_credit',
+		'fieldtype': u'Currency',
 		'in_filter': 1,
-		'label': 'Total Credit',
+		'label': u'Total Credit',
 		'no_copy': 1,
-		'oldfieldname': 'total_credit',
-		'oldfieldtype': 'Currency',
+		'oldfieldname': u'total_credit',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'difference',
-		'fieldtype': 'Currency',
-		'label': 'Difference',
+		'doctype': u'DocField',
+		'fieldname': u'difference',
+		'fieldtype': u'Currency',
+		'label': u'Difference',
 		'no_copy': 1,
-		'oldfieldname': 'difference',
-		'oldfieldtype': 'Currency',
+		'oldfieldname': u'difference',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Addtional Info',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'addtional_info',
+		'fieldtype': u'Section Break',
+		'label': u'Addtional Info',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break2',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'bill_no',
-		'fieldtype': 'Data',
-		'label': 'Bill No',
-		'oldfieldname': 'bill_no',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'bill_no',
+		'fieldtype': u'Data',
+		'label': u'Bill No',
+		'oldfieldname': u'bill_no',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'bill_date',
-		'fieldtype': 'Date',
-		'label': 'Bill Date',
-		'oldfieldname': 'bill_date',
-		'oldfieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'bill_date',
+		'fieldtype': u'Date',
+		'label': u'Bill Date',
+		'oldfieldname': u'bill_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'No',
-		'doctype': 'DocField',
-		'fieldname': 'is_opening',
-		'fieldtype': 'Select',
+		'colour': u'White:FFF',
+		'default': u'No',
+		'doctype': u'DocField',
+		'fieldname': u'is_opening',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Is Opening',
-		'oldfieldname': 'is_opening',
-		'oldfieldtype': 'Select',
-		'options': 'No\nYes',
+		'label': u'Is Opening',
+		'oldfieldname': u'is_opening',
+		'oldfieldtype': u'Select',
+		'options': u'No\nYes',
 		'permlevel': 0,
 		'print_hide': 1,
 		'search_index': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'aging_date',
-		'fieldtype': 'Date',
-		'label': 'Aging Date',
+		'doctype': u'DocField',
+		'fieldname': u'aging_date',
+		'fieldtype': u'Date',
+		'label': u'Aging Date',
 		'no_copy': 0,
-		'oldfieldname': 'aging_date',
-		'oldfieldtype': 'Date',
+		'oldfieldname': u'aging_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'cancel_reason',
-		'fieldtype': 'Data',
-		'label': 'Cancel Reason',
+		'doctype': u'DocField',
+		'fieldname': u'cancel_reason',
+		'fieldtype': u'Data',
+		'label': u'Cancel Reason',
 		'no_copy': 1,
-		'oldfieldname': 'cancel_reason',
-		'oldfieldtype': 'Data',
+		'oldfieldname': u'cancel_reason',
+		'oldfieldtype': u'Data',
 		'permlevel': 1,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'pay_to_recd_from',
-		'fieldtype': 'Data',
-		'hidden': 0,
-		'label': 'Pay To / Recd From',
+		'doctype': u'DocField',
+		'fieldname': u'pay_to_recd_from',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Pay To / Recd From',
 		'no_copy': 1,
 		'permlevel': 0,
 		'print_hide': 1,
@@ -547,11 +536,11 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'total_amount',
-		'fieldtype': 'Data',
-		'hidden': 0,
-		'label': 'Total Amount',
+		'doctype': u'DocField',
+		'fieldname': u'total_amount',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Total Amount',
 		'no_copy': 1,
 		'permlevel': 1,
 		'print_hide': 1,
@@ -560,11 +549,11 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'total_amount_in_words',
-		'fieldtype': 'Data',
-		'hidden': 0,
-		'label': 'Total Amount in Words',
+		'doctype': u'DocField',
+		'fieldname': u'total_amount_in_words',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Total Amount in Words',
 		'no_copy': 1,
 		'permlevel': 1,
 		'print_hide': 1,
@@ -573,23 +562,24 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break3',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Fiscal Year',
-		'oldfieldname': 'fiscal_year',
-		'oldfieldtype': 'Select',
-		'options': 'link:Fiscal Year',
+		'label': u'Fiscal Year',
+		'oldfieldname': u'fiscal_year',
+		'oldfieldtype': u'Select',
+		'options': u'link:Fiscal Year',
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
@@ -598,14 +588,14 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Company',
-		'oldfieldname': 'company',
-		'oldfieldtype': 'Link',
-		'options': 'Company',
+		'label': u'Company',
+		'oldfieldname': u'company',
+		'oldfieldtype': u'Link',
+		'options': u'Company',
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
@@ -615,64 +605,67 @@
 	# DocField
 	{
 		'allow_on_submit': 1,
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'select_print_heading',
-		'fieldtype': 'Link',
-		'label': 'Select Print Heading',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'select_print_heading',
+		'fieldtype': u'Link',
+		'label': u'Select Print Heading',
 		'no_copy': 1,
-		'oldfieldname': 'select_print_heading',
-		'oldfieldtype': 'Link',
-		'options': 'Print Heading',
+		'oldfieldname': u'select_print_heading',
+		'oldfieldtype': u'Link',
+		'options': u'Print Heading',
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'oldfieldtype': 'Section Break',
-		'options': 'Simple',
+		'doctype': u'DocField',
+		'fieldname': u'section_break0',
+		'fieldtype': u'Section Break',
+		'oldfieldtype': u'Section Break',
+		'options': u'Simple',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
 		'allow_on_submit': 1,
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'View Ledger Entry',
-		'oldfieldtype': 'Button',
+		'doctype': u'DocField',
+		'fieldname': u'view_ledger_entry',
+		'fieldtype': u'Button',
+		'label': u'View Ledger Entry',
+		'oldfieldtype': u'Button',
 		'permlevel': 0,
 		'print_hide': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'TDS',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'tds',
+		'fieldtype': u'Section Break',
+		'label': u'TDS',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0,
 		'print_hide': 0
 	},
 
 	# DocField
 	{
-		'default': 'No',
-		'doctype': 'DocField',
-		'fieldname': 'tds_applicable',
-		'fieldtype': 'Select',
+		'default': u'No',
+		'doctype': u'DocField',
+		'fieldname': u'tds_applicable',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'TDS Applicable',
+		'label': u'TDS Applicable',
 		'no_copy': 1,
-		'oldfieldname': 'tds_applicable',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'oldfieldname': u'tds_applicable',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 0,
 		'print_hide': 1,
 		'search_index': 1
@@ -680,93 +673,94 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'tds_category',
-		'fieldtype': 'Select',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'tds_category',
+		'fieldtype': u'Select',
 		'hidden': 0,
 		'in_filter': 1,
-		'label': 'TDS Category',
+		'label': u'TDS Category',
 		'no_copy': 1,
-		'oldfieldname': 'tds_category',
-		'oldfieldtype': 'Select',
-		'options': 'link:TDS Category',
+		'oldfieldname': u'tds_category',
+		'oldfieldtype': u'Select',
+		'options': u'link:TDS Category',
 		'permlevel': 0,
 		'print_hide': 1,
 		'search_index': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'supplier_account',
-		'fieldtype': 'Link',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'supplier_account',
+		'fieldtype': u'Link',
 		'hidden': 0,
-		'label': 'Supplier Account',
+		'label': u'Supplier Account',
 		'no_copy': 1,
-		'oldfieldname': 'supplier_account',
-		'oldfieldtype': 'Link',
-		'options': 'Account',
+		'oldfieldname': u'supplier_account',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
 		'permlevel': 0,
 		'print_hide': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Get TDS',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'get_tds',
+		'fieldtype': u'Button',
+		'label': u'Get TDS',
 		'no_copy': 0,
-		'oldfieldtype': 'Button',
+		'oldfieldtype': u'Button',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Tax Code will be populated based on account head mentioned in TDS Category master',
-		'doctype': 'DocField',
-		'fieldname': 'tax_code',
-		'fieldtype': 'Link',
-		'label': 'TDS Account Head',
+		'colour': u'White:FFF',
+		'description': u'Tax Code will be populated based on account head mentioned in TDS Category master',
+		'doctype': u'DocField',
+		'fieldname': u'tax_code',
+		'fieldtype': u'Link',
+		'label': u'TDS Account Head',
 		'no_copy': 1,
-		'oldfieldname': 'tax_code',
-		'oldfieldtype': 'Link',
-		'options': 'Account',
+		'oldfieldname': u'tax_code',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
 		'permlevel': 0,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'rate',
-		'fieldtype': 'Currency',
-		'label': 'Rate',
+		'doctype': u'DocField',
+		'fieldname': u'rate',
+		'fieldtype': u'Currency',
+		'label': u'Rate',
 		'no_copy': 1,
-		'oldfieldname': 'rate',
-		'oldfieldtype': 'Currency',
+		'oldfieldname': u'rate',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0,
 		'print_hide': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'ded_amount',
-		'fieldtype': 'Currency',
-		'label': 'Amount',
+		'doctype': u'DocField',
+		'fieldname': u'ded_amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount',
 		'no_copy': 1,
-		'oldfieldname': 'ded_amount',
-		'oldfieldtype': 'Currency',
+		'oldfieldname': u'ded_amount',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0,
 		'print_hide': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/journal_voucher/listview.js b/erpnext/accounts/doctype/journal_voucher/listview.js
new file mode 100644
index 0000000..5d7f85a
--- /dev/null
+++ b/erpnext/accounts/doctype/journal_voucher/listview.js
@@ -0,0 +1,34 @@
+wn.doclistviews['Journal Voucher'] = wn.views.ListView.extend({
+	init: function(d) {
+		this._super(d);
+		this.fields = this.fields.concat([
+			'`tabJournal Voucher`.voucher_type',
+			'`tabJournal Voucher`.remark',
+			'`tabJournal Voucher`.total_debit'
+		]);
+		this.stats = this.stats.concat(['voucher_type']);
+	},
+	prepare_data: function(data) {
+		this._super(data);
+		if(!data.remark) data.remark = '';
+		if(data.remark.length> 30) {
+			data.remark = '<span title="'+data.remark+'">' + data.remark.substr(0,30) 
+				+ '...</span>';
+		}
+	},
+	columns: [
+		{width: '5%', content:'avatar'},
+		{width: '3%', content:'docstatus'},
+		{width: '12%', content:'name'},
+		{width: '15%', content:'voucher_type'},
+		{width: '38%', content:'tags+remark', css: {'color':'#aaa'}},
+		{
+			width: '18%', 
+			content: function(parent, data) { 
+				$(parent).html(sys_defaults.currency + ' ' + fmt_money(data.total_debit)) 
+			},
+			css: {'text-align':'right'}
+		},
+		{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}		
+	],
+});
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/journal_voucher_detail/journal_voucher_detail.txt b/erpnext/accounts/doctype/journal_voucher_detail/journal_voucher_detail.txt
index 3b1e932..c7b6d1a 100644
--- a/erpnext/accounts/doctype/journal_voucher_detail/journal_voucher_detail.txt
+++ b/erpnext/accounts/doctype/journal_voucher_detail/journal_voucher_detail.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:06',
+		'creation': '2012-03-27 14:35:43',
 		'docstatus': 0,
-		'modified': '2012-03-21 12:26:17',
+		'modified': '2012-03-27 14:35:43',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -118,7 +118,7 @@
 		'no_copy': 1,
 		'oldfieldname': u'against_voucher',
 		'oldfieldtype': u'Link',
-		'options': u'Payable Voucher',
+		'options': u'Purchase Invoice',
 		'permlevel': 0,
 		'search_index': 1,
 		'trigger': u'Client'
@@ -134,7 +134,7 @@
 		'no_copy': 1,
 		'oldfieldname': u'against_invoice',
 		'oldfieldtype': u'Link',
-		'options': u'Receivable Voucher',
+		'options': u'Sales Invoice',
 		'permlevel': 0,
 		'search_index': 1,
 		'trigger': u'Client'
diff --git a/erpnext/accounts/doctype/lease_agreement/lease_agreement.js b/erpnext/accounts/doctype/lease_agreement/lease_agreement.js
index 1453528..bf0495c 100644
--- a/erpnext/accounts/doctype/lease_agreement/lease_agreement.js
+++ b/erpnext/accounts/doctype/lease_agreement/lease_agreement.js
@@ -44,9 +44,9 @@
 	},
 	hide_show_buttons: function(doc) {
 		if(doc.docstatus==0) {
-			hide_field('Installment Reciept'); show_field('Generate');
+			hide_field('installment_reciept'); show_field('generate');
 		} else if (doc.docstatus==1) {
-			show_field('Installment Reciept');hide_field('Generate');
+			show_field('installment_reciept');hide_field('generate');
 		}
 	},
 	clear_installments: function(doc) {
@@ -90,5 +90,5 @@
 
 cur_frm.fields_dict.invoice.get_query=function(doc){
 
-	return "SELECT tv.name FROM `tabReceivable Voucher` tv WHERE debit_to='"+doc.account+"' and  tv.%(key)s like '%s' ORDER BY tv.name LIMIT 50"
+	return "SELECT tv.name FROM `tabSales Invoice` tv WHERE debit_to='"+doc.account+"' and  tv.%(key)s like '%s' ORDER BY tv.name LIMIT 50"
 }
diff --git a/erpnext/accounts/doctype/lease_agreement/lease_agreement.txt b/erpnext/accounts/doctype/lease_agreement/lease_agreement.txt
index a221a6c..c4f3e12 100644
--- a/erpnext/accounts/doctype/lease_agreement/lease_agreement.txt
+++ b/erpnext/accounts/doctype/lease_agreement/lease_agreement.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-07-27 13:14:28',
+		'creation': '2012-03-27 14:35:44',
 		'docstatus': 0,
-		'modified': '2012-03-21 12:43:53',
+		'modified': '2012-03-27 14:35:44',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -34,12 +34,14 @@
 
 	# These values are common for all DocPerm
 	{
+		'create': 1,
 		'doctype': u'DocPerm',
 		'name': '__common__',
 		'parent': u'Lease Agreement',
 		'parentfield': u'permissions',
 		'parenttype': u'DocType',
-		'read': 1
+		'read': 1,
+		'role': u'Accounts Manager'
 	},
 
 	# DocType, Lease Agreement
@@ -50,30 +52,9 @@
 
 	# DocPerm
 	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Accounts User',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Accounts User'
-	},
-
-	# DocPerm
-	{
 		'amend': 1,
 		'cancel': 1,
-		'create': 0,
 		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Accounts Manager',
 		'submit': 1,
 		'write': 1
 	},
@@ -82,10 +63,7 @@
 	{
 		'amend': 0,
 		'cancel': 0,
-		'create': 0,
 		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Accounts Manager',
 		'submit': 0,
 		'write': 0
 	},
@@ -105,6 +83,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'lessee_info',
 		'fieldtype': u'Section Break',
 		'label': u'Lessee Info.',
 		'permlevel': 0
@@ -160,6 +139,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'vehicle_info',
 		'fieldtype': u'Section Break',
 		'label': u'Vehicle Info.',
 		'permlevel': 0
@@ -195,6 +175,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'invoice_and_payment_info',
 		'fieldtype': u'Section Break',
 		'label': u'Invoice and Payment Info.',
 		'permlevel': 0
@@ -207,7 +188,7 @@
 		'fieldname': u'invoice',
 		'fieldtype': u'Link',
 		'label': u'Invoice',
-		'options': u'Receivable Voucher',
+		'options': u'Sales Invoice',
 		'permlevel': 0,
 		'reqd': 1,
 		'trigger': u'Client'
@@ -265,6 +246,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'generate',
 		'fieldtype': u'Button',
 		'label': u'Generate',
 		'permlevel': 0,
@@ -286,6 +268,7 @@
 		'allow_on_submit': 1,
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'installment_reciept',
 		'fieldtype': u'Button',
 		'label': u'Installment Reciept',
 		'permlevel': 0
diff --git a/erpnext/accounts/doctype/lease_installment/lease_installment.txt b/erpnext/accounts/doctype/lease_installment/lease_installment.txt
index 2434a78..475d226 100644
--- a/erpnext/accounts/doctype/lease_installment/lease_installment.txt
+++ b/erpnext/accounts/doctype/lease_installment/lease_installment.txt
@@ -3,89 +3,84 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-07-22 17:49:33',
+		'creation': '2012-03-27 14:35:44',
 		'docstatus': 0,
-		'modified': '2011-07-22 17:49:33',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:44',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
 		'version': 5
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Lease Installment',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Lease Installment',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# DocType, Lease Installment
 	{
 		'doctype': 'DocType',
-		'name': 'Lease Installment'
+		'name': u'Lease Installment'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amount',
-		'fieldtype': 'Currency',
-		'idx': 1,
-		'label': 'Amount',
+		'doctype': u'DocField',
+		'fieldname': u'amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'due_date',
-		'fieldtype': 'Date',
-		'idx': 2,
-		'label': 'Due Date',
+		'doctype': u'DocField',
+		'fieldname': u'due_date',
+		'fieldtype': u'Date',
+		'label': u'Due Date',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'cheque_number',
-		'fieldtype': 'Data',
-		'idx': 3,
-		'label': 'Cheque Number',
+		'doctype': u'DocField',
+		'fieldname': u'cheque_number',
+		'fieldtype': u'Data',
+		'label': u'Cheque Number',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'cheque_date',
-		'fieldtype': 'Date',
-		'idx': 4,
-		'label': 'Cheque Date',
+		'doctype': u'DocField',
+		'fieldname': u'cheque_date',
+		'fieldtype': u'Date',
+		'label': u'Cheque Date',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'jv_number',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'jv_number',
+		'fieldtype': u'Link',
 		'hidden': 0,
-		'idx': 5,
-		'label': 'JV Number',
-		'options': 'Journal Voucher',
+		'label': u'JV Number',
+		'options': u'Journal Voucher',
 		'permlevel': 1
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/ledger_balance_export/ledger_balance_export.js b/erpnext/accounts/doctype/ledger_balance_export/ledger_balance_export.js
deleted file mode 100755
index 10b1bc1..0000000
--- a/erpnext/accounts/doctype/ledger_balance_export/ledger_balance_export.js
+++ /dev/null
@@ -1,19 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-cur_frm.cscript['Export Report'] = function(doc, cdt, cdn) {
-	$c_obj_csv(make_doclist(cdt, cdn), 'get_report_data', '');
-}
diff --git a/erpnext/accounts/doctype/ledger_balance_export/ledger_balance_export.txt b/erpnext/accounts/doctype/ledger_balance_export/ledger_balance_export.txt
deleted file mode 100755
index 251588c..0000000
--- a/erpnext/accounts/doctype/ledger_balance_export/ledger_balance_export.txt
+++ /dev/null
@@ -1,129 +0,0 @@
-# DocType, Ledger Balance Export
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-05-24 14:41:08',
-		'docstatus': 0,
-		'modified': '2011-05-24 15:22:43',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': '1306229235',
-		'allow_copy': 1,
-		'allow_email': 1,
-		'allow_print': 1,
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'document_type': 'Other',
-		'hide_heading': 0,
-		'issingle': 1,
-		'module': 'Accounts',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'show_in_menu': 0,
-		'version': 9
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Ledger Balance Export',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# These values are common for all DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'Ledger Balance Export',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'permlevel': 0,
-		'read': 1,
-		'write': 1
-	},
-
-	# DocType, Ledger Balance Export
-	{
-		'doctype': 'DocType',
-		'name': 'Ledger Balance Export'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'Accounts Manager'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'Accounts User'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 1,
-		'label': 'Select Date Range'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'from_date',
-		'fieldtype': 'Date',
-		'idx': 2,
-		'label': 'From Date',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'to_date',
-		'fieldtype': 'Date',
-		'idx': 3,
-		'label': 'To Date',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 4,
-		'label': 'Select ledgers'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'ledger_details',
-		'fieldtype': 'Table',
-		'idx': 5,
-		'label': 'Ledger Details',
-		'options': 'Ledger Detail'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 6,
-		'label': 'Export Report',
-		'trigger': 'Client'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/ledger_detail/ledger_detail.txt b/erpnext/accounts/doctype/ledger_detail/ledger_detail.txt
deleted file mode 100755
index f4d1084..0000000
--- a/erpnext/accounts/doctype/ledger_detail/ledger_detail.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-# DocType, Ledger Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-05-24 14:50:42',
-		'docstatus': 0,
-		'modified': '2011-05-24 15:24:03',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Accounts',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'show_in_menu': 0,
-		'version': 3
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'account',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Account',
-		'name': '__common__',
-		'options': 'Account',
-		'parent': 'Ledger Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0,
-		'reqd': 1,
-		'width': '300px'
-	},
-
-	# DocType, Ledger Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Ledger Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/analysis/doctype/mis_control/__init__.py b/erpnext/accounts/doctype/mis_control/__init__.py
similarity index 100%
rename from erpnext/analysis/doctype/mis_control/__init__.py
rename to erpnext/accounts/doctype/mis_control/__init__.py
diff --git a/erpnext/accounts/doctype/mis_control/mis_control.py b/erpnext/accounts/doctype/mis_control/mis_control.py
new file mode 100644
index 0000000..9f8dfa4
--- /dev/null
+++ b/erpnext/accounts/doctype/mis_control/mis_control.py
@@ -0,0 +1,418 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist):
+    self.doc = doc
+    self.doclist = doclist
+    self.account_list = []
+    self.ac_details = {} # key: account id, values: debit_or_credit, lft, rgt
+    
+    self.roles = webnotes.user.get_roles()
+
+    self.period_list = []
+    self.period_start_date = {}
+    self.period_end_date = {}
+
+    self.fs_list = []
+    self.root_bal = []
+    self.flag = 0
+
+  # Get defaults on load of MIS, MIS - Comparison Report and Financial statements
+  # ----------------------------------------------------
+  def get_comp(self):
+    ret = {}
+    type = []
+    comp = []
+    # ------ get period -----------
+    ret['period'] = ['Annual','Half Yearly','Quarterly','Monthly']
+    
+    # ---- get companies ---------
+    res = sql("select name from `tabCompany`")
+    for r in res:
+      comp.append(r[0])
+    #comp.append(r[0] for r in res)
+    ret['company'] = comp
+
+    #--- to get fiscal year and start_date of that fiscal year -----
+    res = sql("select name, year_start_date from `tabFiscal Year`")
+    ret['fiscal_year'] = [r[0] for r in res]
+    ret['start_dates'] = {}
+    for r in res:
+      ret['start_dates'][r[0]] = str(r[1])
+      
+    #--- from month and to month (for MIS - Comparison Report) -------
+    month_list = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
+    fiscal_start_month = sql("select MONTH(year_start_date) from `tabFiscal Year` where name = %s",(get_defaults()['fiscal_year']))
+    fiscal_start_month = fiscal_start_month and fiscal_start_month[0][0] or 1
+    mon = ['']
+    for i in range(fiscal_start_month,13): mon.append(month_list[i-1])
+    for i in range(0,fiscal_start_month-1): mon.append(month_list[i])
+    ret['month'] = mon
+
+    # ------------------------ get MIS Type on basis of roles of session user ------------------------------------------
+    if has_common(self.roles, ['Sales Manager']):
+      type.append('Sales')
+    if has_common(self.roles, ['Purchase Manager']):
+      type.append('Purchase')
+    ret['type'] = type
+    return ret
+    
+  # Gets Transactions type and Group By options based on module
+  #------------------------------------------------------------------
+  def get_trans_group(self,module):
+    ret = {}
+    st,group = [],[]
+    if module == 'Sales':
+      st = ['Quotation','Sales Order','Delivery Note','Sales Invoice']
+      group = ['Item','Item Group','Customer','Customer Group','Cost Center']
+    elif module == 'Purchase':
+      st = ['Purchase Order','Purchase Receipt','Purchase Invoice']
+      group = ['Item','Item Group','Supplier','Supplier Type']
+    
+    ret['stmt_type'] = st
+    ret['group_by'] = group
+    
+    return ret
+
+  # Get Days based on month (for MIS Comparison Report)
+  # --------------------------------------------------------
+  def get_days(self,month):
+    days = []
+    ret = {}
+    if month == 'Jan' or month == 'Mar' or month == 'May' or month == 'Jul' or month == 'Aug' or month == 'Oct' or month == 'Dec':
+      for i in range(1,32):
+        days.append(i)
+    elif month == 'Apr' or month == 'Jun' or month == 'Sep' or month == 'Nov':
+      for i in range(1,31):
+        days.append(i)
+    elif month == 'Feb':
+      for i in range(1,29):
+        days.append(i)
+    ret['days'] = days
+    return ret
+	
+  # Get from date and to date based on fiscal year (for in summary - comparison report)
+  # -----------------------------------------------------------------------------------------------------
+  def dates(self,fiscal_year,from_date,to_date):
+    import datetime
+    ret = ''
+    start_date = cstr(sql("select year_start_date from `tabFiscal Year` where name = %s",fiscal_year)[0][0])
+    st_mon = cint(from_date.split('-')[1])
+    ed_mon = cint(to_date.split('-')[1])
+    st_day = cint(from_date.split('-')[2])
+    ed_day = cint(to_date.split('-')[2])
+    fiscal_start_month = cint(start_date.split('-')[1])
+    next_fiscal_year = cint(start_date.split('-')[0]) + 1
+    current_year = ''
+    next_year = ''
+    
+    #CASE - 1 : Jan - Mar (Valid)
+    if st_mon < fiscal_start_month and ed_mon < fiscal_start_month:
+      current_year = cint(start_date.split('-')[0]) + 1
+      next_year  = cint(start_date.split('-')[0]) + 1
+    
+    # Case - 2 : Apr - Dec (Valid)
+    elif st_mon >= fiscal_start_month and ed_mon <= 12 and ed_mon >= fiscal_start_month:
+      current_year = cint(start_date.split('-')[0])
+      next_year  = cint(start_date.split('-')[0])
+
+    # Case 3 : Jan - May (Invalid)
+    elif st_mon < fiscal_start_month and ed_mon >= fiscal_start_month:
+      current_year = cint(start_date.split('-')[0]) + 1
+      next_year  = cint(start_date.split('-')[0]) + 2
+	
+    # check whether from date is within fiscal year
+    if datetime.date(current_year, st_mon, st_day) >= datetime.date(cint(start_date.split('-')[0]), cint(start_date.split('-')[1]), cint(start_date.split('-')[2])) and datetime.date(cint(current_year), cint(st_mon), cint(st_day)) < datetime.date((cint(start_date.split('-')[0])+1), cint(start_date.split('-')[1]), cint(start_date.split('-')[2])):
+      begin_date = cstr(current_year)+"-"+cstr(st_mon)+"-"+cstr(st_day)
+    else:
+      msgprint("Please enter appropriate from date.")
+      raise Exception
+    # check whether to date is within fiscal year
+    if datetime.date(next_year, ed_mon, ed_day) >= datetime.date(cint(start_date.split('-')[0]), cint(start_date.split('-')[1]), cint(start_date.split('-')[2])) and datetime.date(cint(next_year), cint(ed_mon), cint(ed_day)) < datetime.date(cint(start_date.split('-')[0])+1, cint(start_date.split('-')[1]), cint(start_date.split('-')[2])):
+      end_date = cstr(next_year)+"-"+cstr(ed_mon)+"-"+cstr(ed_day)
+    else:
+      msgprint("Please enter appropriate to date.")
+      raise Exception
+    ret = begin_date+'~~~'+end_date
+    return ret
+
+  # Get MIS Totals
+  # ---------------
+  def get_totals(self, args):
+    args = eval(args)
+    #msgprint(args)
+    totals = sql("SELECT %s FROM %s WHERE %s %s %s %s" %(cstr(args['query_val']), cstr(args['tables']), cstr(args['company']), cstr(args['cond']), cstr(args['add_cond']), cstr(args['fil_cond'])), as_dict = 1)[0]
+    #msgprint(totals)
+    tot_keys = totals.keys()
+    # return in flt because JSON doesn't accept Decimal
+    for d in tot_keys:
+      totals[d] = flt(totals[d])
+    return totals
+
+  # Get Statement
+  # -------------
+  
+  def get_statement(self, arg): 
+    self.return_data = []    
+
+    # define periods
+    arg = eval(arg)
+    pl = ''
+    
+    self.define_periods(arg['year'], arg['period'])    # declares 1.period_list i.e. (['Jan','Feb','Mar'...] or ['Q1','Q2'...] or ['FY2009-2010']) based on period
+                                                       #          2.period_start_date dict {'Jan':'01-01-2009'...}
+                                                       #          3.period_start_date dict {'Jan':'31-01-2009'...}
+    self.return_data.append([4,'']+self.period_list)
+
+        
+    if arg['statement'] == 'Balance Sheet': pl = 'No'
+    if arg['statement'] == 'Profit & Loss': pl = 'Yes'
+    
+    self.get_children('',0,pl,arg['company'], arg['year'])
+        
+    #self.balance_pl_statement(acct, arg['statement'])
+    #msgprint(self.return_data)
+    return self.return_data
+    
+  # Get Children
+  # ------------
+  def get_children(self, parent_account, level, pl, company, fy):
+    cl = sql("select distinct account_name, name, debit_or_credit, lft, rgt from `tabAccount` where ifnull(parent_account, '') = %s and ifnull(is_pl_account, 'No')=%s and company=%s and docstatus != 2 order by name asc", (parent_account, pl, company))
+    level0_diff = [0 for p in self.period_list]
+    if pl=='Yes' and level==0: # switch for income & expenses
+      cl = [c for c in cl]
+      cl.reverse()
+    if cl:
+      for c in cl:
+        self.ac_details[c[1]] = [c[2], c[3], c[4]]
+        bal_list = self.get_period_balance(c[1], level, pl, company, fy)
+        if level==0: # top level - put balances as totals
+          self.return_data.append([level, c[0]] + ['' for b in bal_list])
+          totals = bal_list
+          for i in range(len(totals)): # make totals
+            if c[2]=='Credit':
+              level0_diff[i] += flt(totals[i])
+            else:
+              level0_diff[i] -= flt(totals[i])
+        else:
+          self.return_data.append([level, c[0]]+bal_list)
+          
+        if level < 2:
+          self.get_children(c[1], level+1, pl, company, fy)
+          
+        # make totals - for top level
+        # ---------------------------
+        if level==0:
+          # add rows for profit / loss in B/S
+          if pl=='No':
+            if c[2]=='Credit':
+              self.return_data.append([1, 'Total Liabilities'] + totals)
+              level0_diff = [-i for i in level0_diff] # convert to debit
+              self.return_data.append([5, 'Profit/Loss (Provisional)'] + level0_diff)
+              for i in range(len(totals)): # make totals
+                level0_diff[i] = flt(totals[i]) + level0_diff[i]
+              self.return_data.append([4, 'Total '+c[0]] + level0_diff)
+            else:
+              self.return_data.append([4, 'Total '+c[0]] + totals)
+
+          # add rows for profit / loss in P/L
+          else:
+            if c[2]=='Debit':
+              self.return_data.append([1, 'Total Expenses (before Profit)'] + totals)
+              self.return_data.append([5, 'Profit/Loss (Provisional)'] + level0_diff)
+              for i in range(len(totals)): # make totals
+                level0_diff[i] = flt(totals[i]) + level0_diff[i]
+              self.return_data.append([4, 'Total '+c[0]] + level0_diff)
+            else:
+              self.return_data.append([4, 'Total '+c[0]] + totals)
+  
+  # Define Periods
+  # --------------
+  
+  def define_periods(self, year, period):
+    
+    # get year start date    
+    ysd = sql("select year_start_date from `tabFiscal Year` where name=%s", year)
+    ysd = ysd and ysd[0][0] or ''
+
+    self.ysd = ysd
+
+    # year
+    if period == 'Annual':
+      pn = 'FY'+year
+      self.period_list.append(pn)
+      self.period_start_date[pn] = ysd
+      self.period_end_date[pn] = get_last_day(get_first_day(ysd,0,11))
+
+    # quarter
+    if period == 'Quarterly':
+      for i in range(4):
+        pn = 'Q'+str(i+1)
+        self.period_list.append(pn)
+      
+        self.period_start_date[pn] = get_first_day(ysd,0,i*3)
+        self.period_end_date[pn] = get_last_day(get_first_day(ysd,0,((i+1)*3)-1))  
+
+    # month
+    if period == 'Monthly':
+      mlist = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
+      for i in range(12):
+        fd = get_first_day(ysd,0,i)
+        pn = mlist[fd.month-1]
+        self.period_list.append(pn)
+      
+        self.period_start_date[pn] = fd
+        self.period_end_date[pn] = get_last_day(fd)
+      
+  # Get Balance For A Period
+  # ------------------------
+  
+  def get_period_balance(self, acc, level, pl, company, fy):
+    debit_or_credit, lft, rgt = self.ac_details[acc]
+    ret = []
+    for p in self.period_list:
+      sd, ed = self.period_start_date[p].strftime('%Y-%m-%d'), self.period_end_date[p].strftime('%Y-%m-%d')
+      cond = "and t1.voucher_type != 'Period Closing Voucher'"
+      if pl=='No':
+        sd = self.ysd.strftime('%Y-%m-%d')
+        cond = ""
+
+      bal = sql("select SUM(t1.debit), SUM(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= '%s' AND t1.posting_date <= '%s' AND t1.company = '%s' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s and ifnull(t1.is_opening,'No') = 'No' and ifnull(t1.is_cancelled, 'No') = 'No' %s" % (sd,ed,company,lft,rgt, cond))
+      
+      
+      bal = bal and (flt(bal[0][0]) - flt(bal[0][1])) or 0
+      if debit_or_credit == 'Credit' and bal:
+        bal = -bal
+      if pl=='No':
+        op = sql("select opening from `tabAccount Balance` where account=%s and period=%s", (acc, fy))
+        op = op and op[0][0] or 0
+        bal += flt(op)
+      
+      ret.append(bal)
+    return ret
+    
+  # Get Dashboard Amounts
+  # ---------------------
+  
+  def get_balance(self, acc, sd, ed, company, fy):
+    a = sql("select account_name, name, debit_or_credit, lft, rgt, is_pl_account from `tabAccount` where account_name=%s and company=%s", (acc, company), as_dict=1)
+    if a:
+      a = a[0]
+      bal = sql("select SUM(IFNULL(t1.debit,0)), SUM(IFNULL(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= %s AND t1.posting_date <= %s AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s and ifnull(is_opening, 'No') = 'No' and ifnull(t1.is_cancelled, 'No') = 'No'", (sd,ed,a['lft'],a['rgt']))
+      if a['debit_or_credit']=='Debit':
+        bal = flt(flt(bal[0][0]) - flt(bal[0][1]))
+      else:
+        bal = flt(flt(bal[0][1]) - flt(bal[0][0]))
+
+      if a['is_pl_account']=='No':
+        op = sql("select opening from `tabAccount Balance` where account=%s and period=%s", (acc, fy))
+        op = op and op[0][0] or 0
+        bal += flt(op)
+
+      return flt(bal)
+
+    else:
+      msgprint("Did not find %s for %s" % (acc, company))
+      return 0
+
+  def get_cur_balance(self, acc, company):
+    bal = sql("select IFNULL(t1.balance,0) from `tabAccount Balance` t1, `tabAccount` t2 where t1.account = %s and t1.period=%s and t1.account = t2.name and t2.company=%s", (acc, self.fiscal_year, company))
+    return bal and flt(bal[0][0]) or 0
+  
+  def get_top_5_cust(self, company):
+    rec_grp = sql("select receivables_group from tabCompany where name=%s", company)
+    if rec_grp:
+      pa_lft_rgt = sql("select lft, rgt from tabAccount where name=%s and company=%s", (rec_grp[0][0], company))[0]
+      return sql("select t1.account_name, SUM(t2.debit) from tabAccount t1, `tabGL Entry` t2 where t1.lft > %s and t1.rgt < %s and t2.account = t1.name  and ifnull(t2.is_cancelled, 'No') = 'No' GROUP BY t1.name ORDER BY SUM(t2.debit) desc limit 5", (pa_lft_rgt[0], pa_lft_rgt[1]))
+    else:
+      return []
+
+  def get_top_5_exp(self, company):
+    a = sql("select distinct account_name, name, debit_or_credit, lft, rgt from `tabAccount` where account_name=%s and company=%s", ('Expenses', company), as_dict=1)[0]
+    return sql("select t1.account_name, SUM(t2.debit) from tabAccount t1, `tabGL Entry` t2 where t1.lft>%s and t1.rgt<%s and t1.group_or_ledger = 'Ledger' and t2.account = t1.name  and ifnull(t2.is_cancelled, 'No') = 'No' and t2.voucher_type != 'Period Closing Voucher' GROUP BY t1.name ORDER BY SUM(t2.debit) desc limit 5", (a['lft'],a['rgt']))
+  
+  def bl(self, acc, company):
+    dt = getdate(nowdate())
+
+    r = []
+    # cur
+    r.append(self.get_cur_balance(acc, company))
+    # this month
+    r.append(self.get_balance(acc, get_first_day(dt), get_last_day(dt), company, self.fiscal_year))
+    # last month
+    r.append(self.get_balance(acc, get_first_day(dt,0,-1), get_last_day(get_first_day(dt,0,-1)), company, self.fiscal_year))
+    return r
+
+  def bl_bs(self, acc, company, sd):
+    dt = getdate(nowdate())
+    r = []
+    # cur
+    r.append(self.get_cur_balance(acc, company))
+    # last month
+    r.append(self.get_balance(acc, sd, get_last_day(get_first_day(dt,0,-1)), company, self.fiscal_year))
+    # opening
+    r.append(self.get_balance(acc, sd, sd, company, self.fiscal_year))
+    return r
+
+  def get_dashboard_values(self, arg=''):
+    d = get_defaults()
+    self.fiscal_year = d['fiscal_year']
+    if arg:
+      company = arg
+    else:
+      company = d['company']
+
+    r = {}
+    r['Income'] = self.bl('Income', company)
+    r['Expenses'] = self.bl('Expenses', company)
+
+    r['Profit'] = []
+    for i in range(3):
+      r['Profit'].append(r['Income'][i] - r['Expenses'][i])
+    
+    r['Current Assets'] = self.bl_bs('Current Assets', company, getdate(d['year_start_date']))
+    r['Current Liabilities'] = self.bl_bs('Current Liabilities', company, getdate(d['year_start_date']))
+    
+    r['Working Capital'] = []
+    for i in range(3):
+      r['Working Capital'].append(r['Current Assets'][i] - r['Current Liabilities'][i])
+
+    r['Bank Accounts'] = self.bl_bs('Bank Accounts', company, getdate(d['year_start_date']))
+    
+    r['Top Customers'] = convert_to_lists(self.get_top_5_cust(company))
+    r['Top Expenses'] = convert_to_lists(self.get_top_5_exp(company))
+    
+    return r
diff --git a/erpnext/accounts/doctype/mis_control/mis_control.txt b/erpnext/accounts/doctype/mis_control/mis_control.txt
new file mode 100644
index 0000000..ebfca08
--- /dev/null
+++ b/erpnext/accounts/doctype/mis_control/mis_control.txt
@@ -0,0 +1,31 @@
+# DocType, MIS Control
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:49',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:49',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'issingle': 1,
+		'module': u'Accounts',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 120
+	},
+
+	# DocType, MIS Control
+	{
+		'doctype': 'DocType',
+		'name': u'MIS Control'
+	}
+]
diff --git a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.txt b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.txt
index ac11016..cf7d740 100644
--- a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.txt
+++ b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.txt
@@ -3,39 +3,38 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:10',
+		'creation': '2012-03-27 14:35:44',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'harshada@webnotestech.com'
+		'modified': '2012-03-27 14:35:44',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'autoname': 'field:mode_of_payment',
-		'colour': 'White:FFF',
+		'autoname': u'field:mode_of_payment',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'Accounts',
+		'document_type': u'Master',
+		'module': u'Accounts',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 3
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'mode_of_payment',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'label': 'Mode of Payment',
+		'doctype': u'DocField',
+		'fieldname': u'mode_of_payment',
+		'fieldtype': u'Data',
+		'label': u'Mode of Payment',
 		'name': '__common__',
-		'oldfieldname': 'mode_of_payment',
-		'oldfieldtype': 'Data',
-		'parent': 'Mode of Payment',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'oldfieldname': u'mode_of_payment',
+		'oldfieldtype': u'Data',
+		'parent': u'Mode of Payment',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'reqd': 1
 	},
@@ -43,31 +42,30 @@
 	# These values are common for all DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Mode of Payment',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Mode of Payment',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
-		'role': 'Accounts Manager',
+		'role': u'Accounts Manager',
 		'write': 1
 	},
 
 	# DocType, Mode of Payment
 	{
 		'doctype': 'DocType',
-		'name': 'Mode of Payment'
+		'name': u'Mode of Payment'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm'
+		'doctype': u'DocPerm'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField'
+		'doctype': u'DocField'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/ledger_balance_export/__init__.py b/erpnext/accounts/doctype/multi_ledger_report/__init__.py
similarity index 100%
rename from erpnext/accounts/doctype/ledger_balance_export/__init__.py
rename to erpnext/accounts/doctype/multi_ledger_report/__init__.py
diff --git a/erpnext/accounts/doctype/multi_ledger_report/multi_ledger_report.js b/erpnext/accounts/doctype/multi_ledger_report/multi_ledger_report.js
new file mode 100755
index 0000000..2dabb66
--- /dev/null
+++ b/erpnext/accounts/doctype/multi_ledger_report/multi_ledger_report.js
@@ -0,0 +1,19 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+cur_frm.cscript.export_report = function(doc, cdt, cdn) {
+	$c_obj_csv(make_doclist(cdt, cdn), 'get_report_data', '');
+}
diff --git a/erpnext/accounts/doctype/ledger_balance_export/ledger_balance_export.py b/erpnext/accounts/doctype/multi_ledger_report/multi_ledger_report.py
similarity index 100%
rename from erpnext/accounts/doctype/ledger_balance_export/ledger_balance_export.py
rename to erpnext/accounts/doctype/multi_ledger_report/multi_ledger_report.py
diff --git a/erpnext/accounts/doctype/multi_ledger_report/multi_ledger_report.txt b/erpnext/accounts/doctype/multi_ledger_report/multi_ledger_report.txt
new file mode 100755
index 0000000..0ef7a5d
--- /dev/null
+++ b/erpnext/accounts/doctype/multi_ledger_report/multi_ledger_report.txt
@@ -0,0 +1,124 @@
+# DocType, Multi Ledger Report
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:44',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:44',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': u'1306229235',
+		'allow_copy': 1,
+		'allow_email': 1,
+		'allow_print': 1,
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'document_type': u'Other',
+		'hide_heading': 0,
+		'issingle': 1,
+		'module': u'Accounts',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'show_in_menu': 0,
+		'version': 9
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Multi Ledger Report',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# These values are common for all DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Multi Ledger Report',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'write': 1
+	},
+
+	# DocType, Multi Ledger Report
+	{
+		'doctype': 'DocType',
+		'name': u'Multi Ledger Report'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'role': u'Accounts Manager'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'role': u'Accounts User'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'select_date_range',
+		'fieldtype': u'Column Break',
+		'label': u'Select Date Range'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'from_date',
+		'fieldtype': u'Date',
+		'label': u'From Date',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'to_date',
+		'fieldtype': u'Date',
+		'label': u'To Date',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'select_ledgers',
+		'fieldtype': u'Column Break',
+		'label': u'Select ledgers'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'ledger_details',
+		'fieldtype': u'Table',
+		'label': u'Multi Ledger Report Details',
+		'options': u'Multi Ledger Report Detail'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'export_report',
+		'fieldtype': u'Button',
+		'label': u'Export Report',
+		'trigger': u'Client'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/advance_adjustment_detail/__init__.py b/erpnext/accounts/doctype/multi_ledger_report_detail/__init__.py
old mode 100644
new mode 100755
similarity index 100%
rename from erpnext/accounts/doctype/advance_adjustment_detail/__init__.py
rename to erpnext/accounts/doctype/multi_ledger_report_detail/__init__.py
diff --git a/erpnext/accounts/doctype/multi_ledger_report_detail/multi_ledger_report_detail.txt b/erpnext/accounts/doctype/multi_ledger_report_detail/multi_ledger_report_detail.txt
new file mode 100755
index 0000000..20d618b
--- /dev/null
+++ b/erpnext/accounts/doctype/multi_ledger_report_detail/multi_ledger_report_detail.txt
@@ -0,0 +1,51 @@
+# DocType, Multi Ledger Report Detail
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:44',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:44',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Accounts',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'show_in_menu': 0,
+		'version': 3
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'account',
+		'fieldtype': u'Link',
+		'label': u'Account',
+		'name': '__common__',
+		'options': u'Account',
+		'parent': u'Multi Ledger Report Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0,
+		'reqd': 1,
+		'width': u'300px'
+	},
+
+	# DocType, Multi Ledger Report Detail
+	{
+		'doctype': 'DocType',
+		'name': u'Multi Ledger Report Detail'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/payable_voucher/payable_voucher.js b/erpnext/accounts/doctype/payable_voucher/payable_voucher.js
deleted file mode 100644
index 0bba213..0000000
--- a/erpnext/accounts/doctype/payable_voucher/payable_voucher.js
+++ /dev/null
@@ -1,408 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-cur_frm.cscript.tname = "PV Detail";
-cur_frm.cscript.fname = "entries";
-cur_frm.cscript.other_fname = "purchase_tax_details";
-$import(Purchase Other Charges)
-$import(Purchase Common)
-
-// On Load
-// --------
-cur_frm.cscript.onload = function(doc,dt,dn) {
-	var cp = wn.control_panel;
-
-	if(!doc.voucher_date) set_multiple(dt,dn,{voucher_date:get_today()});
-	if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});  
-
-	if(cp.country == 'India') {
-		unhide_field(['TDS','tds_applicable','tds_category','Get TDS','tax_code','rate','ded_amount','total_tds_on_voucher','tds_amount_on_advance']);
-	}
-	else {
-		hide_field(['TDS','tds_applicable','tds_category','Get TDS','tax_code','rate','ded_amount','total_tds_on_voucher','tds_amount_on_advance']);
-	}	
-	
-	if(doc.__islocal){
-		hide_field(['supplier_address', 'contact_person', 'supplier_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email']);
-	}
-}
-
-
-//Onload post render
-//------------------------
-cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
-	var callback = function(doc, dt, dn) {
-		var callback1 = function(doc, dt, dn) {
-			if(doc.__islocal && doc.supplier) cur_frm.cscript.supplier(doc,dt,dn);
-		}
-	
-		// defined in purchase_common.js
-		cur_frm.cscript.update_item_details(doc, dt, dn, callback1);
-	}
-	cur_frm.cscript.dynamic_label(doc, dt, dn, callback);
-}
-
-// Refresh
-// --------
-cur_frm.cscript.refresh = function(doc, dt, dn) {
-	
-	cur_frm.clear_custom_buttons();
-
-	if (!cur_frm.cscript.is_onload) cur_frm.cscript.dynamic_label(doc, dt, dn);
-
-
-	// Show / Hide button
-	if(doc.docstatus==1 && doc.outstanding_amount > 0)
-		cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript['Make Bank Voucher']);
-	
-	if(doc.docstatus==1) { 
-		unhide_field(['Repair Outstanding Amt']); 
-		cur_frm.add_custom_button('View Ledger', cur_frm.cscript['View Ledger Entry']);
-	} else hide_field(['Repair Outstanding Amt']);
-	
-	cur_frm.cscript.is_opening(doc, dt, dn);
-}
-
-
-//Supplier
-cur_frm.cscript.supplier = function(doc,dt,dn) {
-	var callback = function(r,rt) {
-			var doc = locals[cur_frm.doctype][cur_frm.docname];		
-			get_server_fields('get_credit_to','','',doc, dt, dn, 0, callback2);
-	}
-	
-	var callback2 = function(r,rt){
-		var doc = locals[cur_frm.doctype][cur_frm.docname];
-		var el = getchildren('PV Detail',doc.name,'entries');
-		for(var i in el){
-			if(el[i].item_code && (!el[i].expense_head || !el[i].cost_center)){
-				args = {
-					item_code: el[i].item_code,
-					expense_head: el[i].expense_head,
-					cost_center: el[i].cost_center
-				};
-				get_server_fields('get_default_values', JSON.stringify(args), 'entries', doc, el[i].doctype, el[i].name, 1);
-			}
-		}
-		cur_frm.cscript.calc_amount(doc, 1);
-	}
-
-	if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1,callback);
-	if(doc.supplier) unhide_field(['supplier_address','contact_person','supplier_name','address_display','contact_display','contact_mobile','contact_email']);
-}
-
-cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
-	if(doc.supplier) get_server_fields('get_supplier_address', JSON.stringify({supplier: doc.supplier, address: doc.supplier_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
-}
-
-
-
-cur_frm.fields_dict.supplier_address.on_new = function(dn) {
-	locals['Address'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
-	locals['Address'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
-}
-
-cur_frm.fields_dict.contact_person.on_new = function(dn) {
-	locals['Contact'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
-	locals['Contact'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
-}
-
-
-cur_frm.cscript.credit_to = function(doc,dt,dn) {
-
-	var callback = function(r,rt) {
-			var doc = locals[cur_frm.doctype][cur_frm.docname];		
-			if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1);
-			if(doc.supplier) unhide_field(['supplier_address','contact_person','supplier_name','address_display','contact_display','contact_mobile','contact_email']);
-			cur_frm.refresh();
-	}
-
-	get_server_fields('get_cust','','',doc,dt,dn,1,callback);	
-}
-
-
-
-//Set expense_head and cost center on adding new row
-//----------------------------------------------
-cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
-	
-	cl = getchildren('PV Detail', doc.name, cur_frm.cscript.fname, doc.doctype);
-	acc = '';
-	cc = '';
-
-	for(var i = 0; i<cl.length; i++) {
-		if (cl[i].idx == 1){
-			acc = cl[i].expense_head;
-			cc = cl[i].cost_center;
-		}
-		else{
-			if (! cl[i].expense_head) { cl[i].expense_head = acc; refresh_field('expense_head', cl[i].name, 'entries');}
-			if (! cl[i].cost_center)	{cl[i].cost_center = cc; refresh_field('cost_center', cl[i].name, 'entries');}
-		}
-	}
-}
-
-cur_frm.cscript.is_opening = function(doc, dt, dn) {
-	hide_field('aging_date');
-	if (doc.is_opening == 'Yes') unhide_field('aging_date');
-}
-
-// Recalculate Button
-// -------------------
-cur_frm.cscript['Recalculate'] = function(doc, cdt, cdn) {
-	cur_frm.cscript['Calculate Tax'](doc,cdt,cdn);
-	calc_total_advance(doc,cdt,cdn);
-}
-
-// Get Items Button
-// -----------------
-cur_frm.cscript['Get Items'] = function(doc, dt, dn) {
-	var callback = function(r,rt) { 
-		unhide_field(['supplier_address', 'contact_person', 'supplier_name', 'address_display', 'contact_display', 'contact_mobile','contact_email']);				
-		refresh_many(['credit_to','supplier','supplier_address','contact_person','supplier_name', 'address_display', 'contact_display','contact_mobile', 'contact_email','entries', 'purchase_receipt_main', 'purchase_order_main', 'purchase_tax_details']);
-	}
-	$c_obj(make_doclist(dt,dn),'pull_details','',callback);
-}
-
-// ========== PV Details Table ============
-
-// Item Code
-// ----------
-cur_frm.cscript.item_code = function(doc,cdt,cdn){
-	var d = locals[cdt][cdn];
-	if(d.item_code){
-		get_server_fields('get_item_details',d.item_code,'entries',doc,cdt,cdn,1);
-	}
-}
-
-// Rate in Deduct Taxes (TDS)
-// --------------------------
-cur_frm.cscript.rate = function(doc,dt,dn) {
-	//This is done as Purchase tax detail and PV detail both contain the same fieldname 'rate'
-	if(dt != 'Purchase Tax Detail')	 cur_frm.cscript.calc_amount(doc, 2);
-}
-
-// Amount
-// -------
-cur_frm.cscript.ded_amount = function(doc,dt,dn) {calculate_outstanding(doc);}
-
-// Get TDS Button
-// ---------------
-cur_frm.cscript['Get TDS'] = function(doc, dt, dn) {
-	var callback = function(r,rt) {
-		cur_frm.refresh();
-		refresh_field('ded_amount');
-		//cur_frm.cscript.calc_total(locals[dt][dn]);
-	}
-	$c_obj(make_doclist(dt,dn), 'get_tds', '', callback);
-}
-
-// ===================== Advance Allocation ==================
-cur_frm.cscript.allocated_amount = function(doc,cdt,cdn){
-	var d = locals[cdt][cdn];
-	if (d.allocated_amount && d.tds_amount){
-		d.tds_allocated=flt(d.tds_amount*(d.allocated_amount/d.advance_amount))
-		refresh_field('tds_allocated', d.name, 'advance_allocation_details');
-	}
-	tot_tds=0
-	el = getchildren('Advance Allocation Detail',doc.name,'advance_allocation_details')
-	for(var i in el){
-		tot_tds += el[i].tds_allocated
-	}
-	doc.tds_amount_on_advance = tot_tds
-	refresh_field('tds_amount_on_advance');
-	
-	calc_total_advance(doc, cdt, cdn);
-}
-
-
-// Make Journal Voucher
-// --------------------
-cur_frm.cscript['Make Bank Voucher'] = function() {
-	$c('accounts.get_default_bank_account', { company: cur_frm.doc.company }, function(r, rt) {
-		if(!r.exc) {
-			cur_frm.cscript.make_jv(cur_frm.doc, null, null, r.message);
-	}
-	});
-}
-
-
-/* ***************************** GET QUERY Functions *************************** */
-
-
-cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
-	return 'SELECT name,address_line1,city FROM tabAddress WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
-}
-
-cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
-	return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
-}
-
-// Item Code
-// ----------
-cur_frm.fields_dict['entries'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
-	return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE tabItem.is_purchase_item="Yes" AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50'
-}
-
-// Credit To
-// ----------
-cur_frm.fields_dict['credit_to'].get_query = function(doc) {
-	return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.is_pl_account="No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
-}
-
-
-// Purchase Order
-// ---------------
-cur_frm.fields_dict['purchase_order_main'].get_query = function(doc) {
-	if (doc.supplier){
-		return 'SELECT `tabPurchase Order`.`name` FROM `tabPurchase Order` WHERE `tabPurchase Order`.`docstatus` = 1 AND `tabPurchase Order`.supplier = "'+ doc.supplier +'" AND `tabPurchase Order`.`status` != "Stopped" AND ifnull(`tabPurchase Order`.`per_billed`,0) < 100 AND `tabPurchase Order`.`company` = "' + doc.company + '" AND `tabPurchase Order`.%(key)s LIKE "%s" ORDER BY `tabPurchase Order`.`name` DESC LIMIT 50'
-	} else {
-		return 'SELECT `tabPurchase Order`.`name` FROM `tabPurchase Order` WHERE `tabPurchase Order`.`docstatus` = 1 AND `tabPurchase Order`.`status` != "Stopped" AND ifnull(`tabPurchase Order`.`per_billed`, 0) < 100 AND `tabPurchase Order`.`company` = "' + doc.company + '" AND `tabPurchase Order`.%(key)s LIKE "%s" ORDER BY `tabPurchase Order`.`name` DESC LIMIT 50'
-	}
-}
-
-// Purchase Receipt
-// -----------------
-cur_frm.fields_dict['purchase_receipt_main'].get_query = function(doc) {
-	if (doc.supplier){
-		return 'SELECT `tabPurchase Receipt`.`name` FROM `tabPurchase Receipt` WHERE `tabPurchase Receipt`.`docstatus` = 1 AND `tabPurchase Receipt`.supplier = "'+ doc.supplier +'" AND `tabPurchase Receipt`.`status` != "Stopped" AND ifnull(`tabPurchase Receipt`.`per_billed`, 0) < 100 AND `tabPurchase Receipt`.`company` = "' + doc.company + '" AND `tabPurchase Receipt`.%(key)s LIKE "%s" ORDER BY `tabPurchase Receipt`.`name` DESC LIMIT 50'
-	} else {
-		return 'SELECT `tabPurchase Receipt`.`name` FROM `tabPurchase Receipt` WHERE `tabPurchase Receipt`.`docstatus` = 1 AND `tabPurchase Receipt`.`status` != "Stopped" AND ifnull(`tabPurchase Receipt`.`per_billed`, 0) < 100 AND `tabPurchase Receipt`.`company` = "' + doc.company + '" AND `tabPurchase Receipt`.%(key)s LIKE "%s" ORDER BY `tabPurchase Receipt`.`name` DESC LIMIT 50'
-	}
-}
-
-// Get Print Heading
-cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
-	return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
-}
-
-
-// ================== PV Details Table ===================
-// Expense Head
-// -------------
-cur_frm.fields_dict['entries'].grid.get_field("expense_head").get_query = function(doc) {
-	return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"';
-}
-cur_frm.cscript.expense_head = function(doc, cdt, cdn){
-	var d = locals[cdt][cdn];
-	if(d.idx == 1 && d.expense_head){
-		var cl = getchildren('PV Detail', doc.name, 'entries', doc.doctype);
-		for(var i = 0; i < cl.length; i++){
-			if(!cl[i].expense_head) cl[i].expense_head = d.expense_head;
-		}
-	}
-	refresh_field('entries');
-}
-
-
-// Cost Center
-//-------------
-cur_frm.fields_dict['entries'].grid.get_field("cost_center").get_query = function(doc) {
-	return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.docstatus != 2 ORDER BY	`tabCost Center`.`name` ASC LIMIT 50';
-}
-
-cur_frm.cscript.cost_center = function(doc, cdt, cdn){
-	var d = locals[cdt][cdn];
-	if(d.idx == 1 && d.cost_center){
-		var cl = getchildren('PV Detail', doc.name, 'entries', doc.doctype);
-		for(var i = 0; i < cl.length; i++){
-			if(!cl[i].cost_center) cl[i].cost_center = d.cost_center;
-		}
-	}
-	refresh_field('entries');
-}
-
-
-// TDS Account Head
-cur_frm.fields_dict['tax_code'].get_query = function(doc) {
-	return "SELECT `tabTDS Category Account`.account_head FROM `tabTDS Category Account` WHERE `tabTDS Category Account`.parent = '"+doc.tds_category+"' AND `tabTDS Category Account`.company='"+doc.company+"' AND `tabTDS Category Account`.account_head LIKE '%s' ORDER BY `tabTDS Category Account`.account_head DESC LIMIT 50";
-}
-
-cur_frm.cscript.tax_code = function(doc, dt, dn) {
-	get_server_fields('get_tds_rate','','',doc, dt, dn, 0);
-}
-
-/* ***************************** UTILITY FUNCTIONS ************************ */
-
-// Calculate Advance
-// ------------------
-var calc_total_advance = function(doc,cdt,cdn) {
-	var doc = locals[doc.doctype][doc.name];
-	var el = getchildren('Advance Allocation Detail',doc.name,'advance_allocation_details')
-	var tot_tds=0;
-	var total_advance = 0;
-	for(var i in el) {
-		if (! el[i].allocated_amount == 0) {
-			total_advance += flt(el[i].allocated_amount);
-			tot_tds += flt(el[i].tds_allocated)
-		}
-	}
-	doc.total_amount_to_pay = flt(doc.grand_total) - flt(doc.ded_amount);
-	doc.tds_amount_on_advance = flt(tot_tds);
-	doc.total_advance = flt(total_advance);
-	doc.outstanding_amount = flt(doc.total_amount_to_pay) - flt(total_advance);
-	refresh_many(['total_advance','outstanding_amount','tds_amount_on_advance', 'total_amount_to_pay']);
-}
-
-// Make JV
-// --------
-cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
-	var jv = LocalDB.create('Journal Voucher');
-	jv = locals['Journal Voucher'][jv];
-	jv.voucher_type = 'Bank Voucher';
-	jv.remark = repl('Payment against voucher %(vn)s for %(rem)s', {vn:doc.name, rem:doc.remarks});
-	jv.total_debit = doc.outstanding_amount;
-	jv.total_credit = doc.outstanding_amount;
-	jv.fiscal_year = doc.fiscal_year;
-	jv.company = doc.company;
-	
-	// debit to creditor
-	var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
-	d1.account = doc.credit_to;
-	d1.debit = doc.outstanding_amount;
-	d1.against_voucher = doc.name;
-	
-	// credit to bank
-	var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
-	d1.account = bank_account;
-	d1.credit = doc.outstanding_amount;
-	
-	loaddoc('Journal Voucher', jv.name);
-}
-
-// ***************** Get project name *****************
-cur_frm.fields_dict['entries'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
-	return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
-}
-
-
-cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
-	if(doc.select_print_heading){
-		// print heading
-		cur_frm.pformat.print_heading = doc.select_print_heading;
-	}
-	else
-		cur_frm.pformat.print_heading = "Purchase Invoice";
-}
-
-/****************** Get Accounting Entry *****************/
-cur_frm.cscript['View Ledger Entry'] = function(){
-	var callback = function(report){
-		report.set_filter('GL Entry', 'Voucher No',cur_frm.doc.name);
-		report.dt.run();
-	}
-	loadreport('GL Entry','General Ledger', callback);
-}
diff --git a/erpnext/accounts/doctype/payable_voucher/payable_voucher.py b/erpnext/accounts/doctype/payable_voucher/payable_voucher.py
deleted file mode 100644
index d930583..0000000
--- a/erpnext/accounts/doctype/payable_voucher/payable_voucher.py
+++ /dev/null
@@ -1,565 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-	
-# -----------------------------------------------------------------------------------------
-
-from utilities.transaction_base import TransactionBase
-
-class DocType(TransactionBase):
-	def __init__(self,d,dl):
-		self.doc, self.doclist = d, dl 
-		self.tname = 'PV Detail'
-		self.fname = 'entries'
-
-	# Autoname
-	# ---------
-	def autoname(self):
-		self.doc.name = make_autoname(self.doc.naming_series+'.####')
-
-
-# ************************** Trigger Functions ****************************
-
-	# Credit To
-	# ----------
-	def get_credit_to(self):
-		acc_head = sql("select name, credit_days from `tabAccount` where (name = %s or (master_name = %s and master_type = 'supplier')) and docstatus != 2", (cstr(self.doc.supplier) + " - " + self.get_company_abbr(),self.doc.supplier))		
-		#supp_detail = sql("select supplier_name,address from `tabSupplier` where name = %s", self.doc.supplier, as_dict =1)
-		#ret = {
-		#	'supplier_name' : supp_detail and supp_detail[0]['supplier_name'] or '',
-		#	'supplier_address': supp_detail and supp_detail[0]['address'] or ''
-		#}
-		ret = {}
-		if acc_head and acc_head[0][0]:
-			ret['credit_to'] = acc_head[0][0]
-			if not self.doc.due_date:
-				ret['due_date'] = add_days(cstr(self.doc.posting_date), acc_head and cint(acc_head[0][1]) or 0)
-		elif not acc_head:
-			msgprint("%s does not have an Account Head in %s. You must first create it from the Supplier Master" % (self.doc.supplier, self.doc.company))
-		return ret
-		
-	def get_cust(self):
-		ret = {}
-		if self.doc.credit_to:			
-			ret['supplier'] = get_value('Account',self.doc.credit_to,'master_name')
-			
-		return ret
-
-
-	# Get Default Cost Center and Expense Head from Item Master
-	# ----------------------------------------------------------
-	def get_default_values(self,args):
-		import json
-		args = json.loads(args)
-		ret = {}
-		if sql("select name from `tabItem` where name = '%s'" % args['item_code']):
-			if not args['expense_head'] or args['expense_head'] == 'undefined':
-				expense_head = sql("select name from `tabAccount` where account_name in (select purchase_account from `tabItem` where name = '%s')" % args['item_code'])
-				ret['expense_head'] = expense_head and expense_head[0][0] or ''
-			if not args['cost_center'] or args['cost_center'] == 'undefined':
-				cost_center = sql("select cost_center from `tabItem` where name = '%s'" % args['item_code'])
-				ret['cost_center'] = cost_center and cost_center[0][0] or ''
-		return ret
-		 
-		
-	# Get Items based on PO or PR
-	# ----------------------------
-	def pull_details(self):
-		if self.doc.purchase_receipt_main:
-			self.validate_duplicate_docname('purchase_receipt')
-			self.doclist = get_obj('DocType Mapper', 'Purchase Receipt-Payable Voucher').dt_map('Purchase Receipt', 'Payable Voucher', self.doc.purchase_receipt_main, self.doc, self.doclist, "[['Purchase Receipt', 'Payable Voucher'], ['Purchase Receipt Detail', 'PV Detail'], ['Purchase Tax Detail','Purchase Tax Detail']]")
-
-		elif self.doc.purchase_order_main:
-			self.validate_duplicate_docname('purchase_order')
-			self.doclist = get_obj('DocType Mapper', 'Purchase Order-Payable Voucher').dt_map('Purchase Order', 'Payable Voucher', self.doc.purchase_order_main, self.doc, self.doclist, "[['Purchase Order', 'Payable Voucher'],['PO Detail', 'PV Detail'], ['Purchase Tax Detail','Purchase Tax Detail']]")
-		
-		ret = self.get_credit_to()
-
-		if ret.has_key('credit_to'):
-			self.doc.credit_to = ret['credit_to']
-			
-
-	# Get Item Details
-	# -----------------		
-	def get_item_details(self, arg=None):
-		if arg:
-			return self.get_pv_details(arg)
-		else:
-			for doc in self.doclist:
-				if doc.fields.get('item_code'):
-					ret = self.get_pv_details(doc.item_code)
-					for r in ret:
-						if not doc.fields.get(r):
-							doc.fields[r] = ret[r]
-
-
-	def get_pv_details(self, arg):
-		import json
-		item_det = sql("select item_name, brand, description, item_group,purchase_account,cost_center, last_purchase_rate from tabItem where name=%s",arg,as_dict=1)
-		lpr = item_det and flt(item_det[0]['last_purchase_rate']) or 0
-		import_lpr = lpr / flt(self.doc.conversion_rate) or 1
-
-		tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , arg)
-		t = {}
-		for x in tax: t[x[0]] = flt(x[1])
-		ret = {
-			'item_name' : item_det and item_det[0]['item_name'] or '',
-			'brand' : item_det and item_det[0]['brand'] or '',
-			'description' : item_det and item_det[0]['description'] or '',
-			'item_group'	: item_det and item_det[0]['item_group'] or '',
-			'rate' : lpr,
-			'purchase_ref_rate' : lpr,
-			'import_ref_rate' : import_lpr,
-			'import_rate' : import_lpr,
-			'qty' : 0.00,
-			'amount' : 0.00,
-			'expense_head' : item_det and item_det[0]['purchase_account'] or '',
-			'cost_center' : item_det and item_det[0]['cost_center'] or '',
-			'item_tax_rate'			: json.dumps(t)
-		}
-
-		return ret
-
-
-		
-	# Advance Allocation
-	# -------------------
-	def get_advances(self):
-		get_obj('GL Control').get_advances( self, self.doc.credit_to, 'Advance Allocation Detail','advance_allocation_details','debit')
-		
-		
-	# ============= OTHER CHARGES ====================
-	
-	# Get Tax rate if account type is TAX
-	# ------------------------------------
-	def get_rate(self,arg):
-		return get_obj('Purchase Common').get_rate(arg,self)
-
-	# Pull details from other charges master (Get Other Charges)
-	# -----------------------------------------------------------
-	def get_purchase_tax_details(self):
-		return get_obj('Purchase Common').get_purchase_tax_details(self)
-
-
-	def get_rate1(self,acc):
-		rate = sql("select tax_rate from `tabAccount` where name='%s'"%(acc))
-		ret={'add_tax_rate' :rate and flt(rate[0][0]) or 0 }
-		return ret
-
-
-
-# *************************** Server Utility Functions *****************************
-	# Get Company abbr
-	# -----------------
-	def get_company_abbr(self):
-		return sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
-
-	# Check whether PO or PR is already fetched
-	# ------------------------------------------
-	def validate_duplicate_docname(self,doctype):
-		for d in getlist(self.doclist, 'entries'): 
-			if doctype == 'purchase_receipt' and cstr(self.doc.purchase_receipt_main) == cstr(d.purchase_receipt):
-				msgprint(cstr(self.doc.purchase_receipt_main) + " purchase receipt details have already been pulled.")
-				raise Exception , " Validation Error. "
-
-			if doctype == 'purchase_order' and cstr(self.doc.purchase_order_main) == cstr(d.purchase_order) and not d.purchase_receipt:
-				msgprint(cstr(self.doc.purchase_order_main) + " purchase order details have already been pulled.")
-				raise Exception , " Validation Error. "
-
-		
-# **************************** VALIDATE ********************************
-
-	# Check for Item.is_Purchase_item = 'Yes' and Item is active
-	# ------------------------------------------------------------------
-	def check_active_purchase_items(self):
-		for d in getlist(self.doclist, 'entries'):
-			if d.item_code:		# extra condn coz item_code is not mandatory in PV
-				valid_item = sql("select docstatus,is_purchase_item from tabItem where name = %s",d.item_code)
-				if valid_item[0][0] == 2:
-					msgprint("Item : '%s' is Inactive, you can restore it from Trash" %(d.item_code))
-					raise Exception
-				if not valid_item[0][1] == 'Yes':
-					msgprint("Item : '%s' is not Purchase Item"%(d.item_code))
-					raise Exception
-						
-	# Check Conversion Rate
-	# ----------------------
-	def check_conversion_rate(self):
-		default_currency = TransactionBase().get_company_currency(self.doc.company)		
-		if not default_currency:
-			msgprint('Message: Please enter default currency in Company Master')
-			raise Exception
-		if (self.doc.currency == default_currency and flt(self.doc.conversion_rate) != 1.00) or not self.doc.conversion_rate or (self.doc.currency != default_currency and flt(self.doc.conversion_rate) == 1.00):
-			msgprint("Message: Please Enter Appropriate Conversion Rate.")
-			raise Exception				
-
-	# 1. Check whether bill is already booked against this bill no. or not
-	# 2. Add Remarks
-	# ---------------------------------------------------------------------
-	def validate_bill_no(self):
-		if self.doc.bill_no and self.doc.bill_no.lower().strip()	not in ['na', 'not applicable', 'none']:
-			b_no = sql("select bill_no, name, ifnull(is_opening,'') from `tabPayable Voucher` where bill_no = '%s' and credit_to = '%s' and docstatus = 1 and name != '%s' " % (self.doc.bill_no, self.doc.credit_to, self.doc.name))
-			if b_no and cstr(b_no[0][2]) == cstr(self.doc.is_opening):
-				msgprint("Please check you have already booked expense against Bill No. %s in Purchase Invoice %s" % (cstr(b_no[0][0]), cstr(b_no[0][1])))
-				raise Exception , "Validation Error"
-			if not self.doc.remarks:
-				self.doc.remarks = (self.doc.remarks or '') + "\n" + ("Against Bill %s dated %s" % (self.doc.bill_no, formatdate(self.doc.bill_date)))
-				if self.doc.ded_amount:
-					self.doc.remarks = (self.doc.remarks or '') + "\n" + ("Grand Total: %s, Tax Deduction Amount: %s" %(self.doc.grand_total, self.doc.ded_amount))
-		else:
-			if not self.doc.remarks:
-				self.doc.remarks = "No Remarks"
-					
-	# Validate Bill No Date
-	# ---------------------
-	def validate_bill_no_date(self):
-		if self.doc.bill_no and not self.doc.bill_date and self.doc.bill_no.lower().strip() not in ['na', 'not applicable', 'none']:
-			msgprint("Please enter Bill Date")
-			raise Exception					
-
-
- 
-	# Clear Advances
-	# ---------------
-	def clear_advances(self):
-		get_obj('GL Control').clear_advances( self, 'Advance Allocation Detail','advance_allocation_details')
-
-
-	# 1. Credit To Account Exists
-	# 2. Is a Credit Account
-	# 3. Is not a PL Account
-	# ----------------------------
-	def validate_credit_acc(self):
-		acc = sql("select debit_or_credit, is_pl_account from tabAccount where name = '%s'" % self.doc.credit_to)
-		if not acc:
-			msgprint("Account: "+ self.doc.credit_to + "does not exist")
-			raise Exception
-		elif acc[0][0] and acc[0][0] != 'Credit':
-			msgprint("Account: "+ self.doc.credit_to + "is not a credit account")
-			raise Exception
-		elif acc[0][1] and acc[0][1] != 'No':
-			msgprint("Account: "+ self.doc.credit_to + "is a pl account")
-			raise Exception
-	
-	# Validate Acc Head of Supplier and Credit To Account entered
-	# ------------------------------------------------------------
-	def check_for_acc_head_of_supplier(self): 
-		if self.doc.supplier and self.doc.credit_to:
-			acc_head = sql("select master_name from `tabAccount` where name = %s", self.doc.credit_to)
-			
-			if (acc_head and cstr(acc_head[0][0]) != cstr(self.doc.supplier)) or (not acc_head and (self.doc.credit_to != cstr(self.doc.supplier) + " - " + self.get_company_abbr())):
-				msgprint("Credit To: %s do not match with Supplier: %s for Company: %s.\n If both correctly entered, please select Master Type and Master Name in account master." %(self.doc.credit_to,self.doc.supplier,self.doc.company), raise_exception=1)
-				
-	# Check for Stopped PO
-	# ---------------------
-	def check_for_stopped_status(self):
-		check_list = []
-		for d in getlist(self.doclist,'entries'):
-			if d.purchase_order and not d.purchase_order in check_list and not d.purchase_receipt:
-				check_list.append(d.purhcase_order)
-				stopped = sql("select name from `tabPurchase Order` where status = 'Stopped' and name = '%s'" % d.purchase_order)
-				if stopped:
-					msgprint("One cannot do any transaction against 'Purchase Order' : %s, it's status is 'Stopped'" % (d.purhcase_order))
-					raise Exception
-					
-	# Validate Supplier
-	# -----------------
-	def validate_supplier(self, d):
-		supplier = ''
-		if d.purchase_order and not d.purchase_order in self.po_list:
-			supplier = sql("select supplier from `tabPurchase Order` where name = '%s'" % d.purchase_order)[0][0]
-			doctype = 'purchase order'
-			doctype_no = cstr(d.purchase_order)
-			if supplier and not cstr(self.doc.supplier) == cstr(supplier):
-				msgprint("Supplier name %s do not match with supplier name	of %s %s." %(self.doc.supplier,doctype,doctype_no))
-				raise Exception , " Validation Error "
-
-		if d.purchase_receipt and not d.purchase_receipt in self.pr_list:
-			supplier = sql("select supplier from `tabPurchase Receipt` where name = '%s'" % d.purchase_receipt)[0][0]
-			doctype = 'purchase receipt'
-			doctype_no = cstr(d.purchase_receipt)
-			if supplier and not cstr(self.doc.supplier) == cstr(supplier):
-				msgprint("Supplier name %s do not match with supplier name	of %s %s." %(self.doc.supplier,doctype,doctype_no))
-				raise Exception , " Validation Error "
-
-	# Validate values with reference document
-	#----------------------------------------
-	def validate_reference_value(self):
-		get_obj('DocType Mapper', 'Purchase Order-Payable Voucher', with_children = 1).validate_reference_value(self, self.doc.name)
-
-				
-	# Validate PO and PR
-	# -------------------
-	def validate_po_pr(self, d):
-		# check po / pr for qty and rates and currency and conversion rate
-
-		# always import_rate must be equal to import_rate of purchase order
-		if d.purchase_order and not d.purchase_order in self.po_list:
-			# currency
-			currency = cstr(sql("select currency from `tabPurchase Order` where name = '%s'" % d.purchase_order)[0][0])
-			if not cstr(currency) == cstr(self.doc.currency):
-				msgprint("Purchase Order: " + cstr(d.purchase_order) + " currency : " + cstr(currency) + " does not match with currency of current document.")
-				raise Exception
-			# import_rate
-			rate = flt(sql('select import_rate from `tabPO Detail` where item_code=%s and parent=%s and name = %s', (d.item_code, d.purchase_order, d.po_detail))[0][0])
-			if abs(rate - flt(d.import_rate)) > 1:
-				msgprint("Import Rate for %s in the Purchase Order is %s. Rate must be same as Purchase Order Rate" % (d.item_code,rate))
-				raise Exception
-									
-		if d.purchase_receipt and not d.purchase_receipt in self.pr_list:
-			# currency , conversion_rate
-			data = sql("select currency, conversion_rate from `tabPurchase Receipt` where name = '%s'" % d.purchase_receipt, as_dict = 1)
-			if not cstr(data[0]['currency']) == cstr(self.doc.currency):
-				msgprint("Purchase Receipt: " + cstr(d.purchase_receipt) + " currency : " + cstr(data[0]['currency']) + " does not match with currency of current document.")
-				raise Exception
-			if not flt(data[0]['conversion_rate']) == flt(self.doc.conversion_rate):
-				msgprint("Purchase Receipt: " + cstr(d.purchase_receipt) + " conversion_rate : " + cstr(data[0]['conversion_rate']) + " does not match with conversion_rate of current document.")
-				raise Exception
-					
-	# Build tds table if applicable
-	#------------------------------
-	def get_tds(self):
-		if cstr(self.doc.is_opening) != 'Yes':
-			if not self.doc.credit_to:
-				msgprint("Please Enter Credit To account first")
-				raise Exception
-			else:
-				tds_applicable = sql("select tds_applicable from tabAccount where name = '%s'" % self.doc.credit_to)
-				if tds_applicable and cstr(tds_applicable[0][0]) == 'Yes':
-					if not self.doc.tds_applicable:
-						msgprint("Please enter whether TDS Applicable or not")
-						raise Exception
-					if self.doc.tds_applicable == 'Yes':
-						if not self.doc.tds_category:
-							msgprint("Please select TDS Category")
-							raise Exception
-						else:
-							get_obj('TDS Control').get_tds_amount(self)
-							self.doc.total_tds_on_voucher = self.doc.ded_amount
-							self.doc.total_amount_to_pay=flt(self.doc.grand_total)-flt(self.doc.ded_amount)-flt(self.doc.other_tax_deducted)
-					elif self.doc.tds_applicable == 'No':
-						self.doc.tds_category = ''
-						self.doc.tax_code = ''
-						self.doc.rate = 0
-						self.doc.ded_amount = 0
-						self.doc.total_tds_on_voucher = 0
-
-	# get tds rate
-	# -------------
-	def get_tds_rate(self):
-		return {'rate' : flt(get_value('Account', self.doc.tax_code, 'tax_rate'))}
-
-	# set aging date
-	#-------------------
-	def set_aging_date(self):
-		if self.doc.is_opening != 'Yes':
-			self.doc.aging_date = self.doc.posting_date
-		elif not self.doc.aging_date:
-			msgprint("Aging Date is mandatory for opening entry")
-			raise Exception
-			
-
-	# Set against account for debit to account
-	#------------------------------------------
-	def set_against_expense_account(self):
-		against_acc = []
-		for d in getlist(self.doclist, 'entries'):
-			if d.expense_account not in against_acc:
-				against_acc.append(d.expense_account)
-		self.doc.against_expense_account = ','.join(against_acc)
-
-	#check in manage account if purchase order required or not.
-	# ====================================================================================
-	def po_required(self):
-		res = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = 'po_required'")
-		if res and res[0][0] == 'Yes':
-			 for d in getlist(self.doclist,'entries'):
-				 if not d.purchase_order:
-					 msgprint("Purchse Order No. required against item %s"%d.item_code)
-					 raise Exception
-
-	#check in manage account if purchase receipt required or not.
-	# ====================================================================================
-	def pr_required(self):
-		res = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = 'pr_required'")
-		if res and res[0][0] == 'Yes':
-			 for d in getlist(self.doclist,'entries'):
-				 if not d.purchase_receipt:
-					 msgprint("Purchase Receipt No. required against item %s"%d.item_code)
-					 raise Exception
-
-	# VALIDATE
-	# ====================================================================================
-	def validate(self):
-		self.po_required()
-		self.pr_required()
-		self.check_active_purchase_items()
-		self.check_conversion_rate()
-		self.validate_bill_no_date()
-		self.validate_bill_no()
-		self.validate_reference_value()
-		self.clear_advances()
-		self.validate_credit_acc()
-		self.check_for_acc_head_of_supplier()
-		self.check_for_stopped_status()
-
-		self.po_list, self.pr_list = [], []
-		for d in getlist(self.doclist, 'entries'):
-			self.validate_supplier(d)
-			self.validate_po_pr(d)
-			if not d.purchase_order in self.po_list:
-				self.po_list.append(d.purchase_order)
-			if not d.purhcase_receipt in self.pr_list:
-				self.pr_list.append(d.purchase_receipt)
-		# tds
-		get_obj('TDS Control').validate_first_entry(self)
-		if not flt(self.doc.ded_amount):
-			self.get_tds()
-			self.doc.save()
-
-		if not self.doc.is_opening:
-			self.doc.is_opening = 'No'
-
-		self.set_aging_date()
-
-		#set against account for credit to
-		self.set_against_expense_account()
-
-		#FY validation
-		get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
-		
-		#get Purchase Common Obj
-		pc_obj = get_obj(dt='Purchase Common')
-		
-		 # get total in words
-		self.doc.in_words = pc_obj.get_total_in_words('Rs', self.doc.grand_total)
-		self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
-# ***************************** SUBMIT *****************************
-	# Check Ref Document docstatus
-	# -----------------------------
-	def check_prev_docstatus(self):
-		for d in getlist(self.doclist,'entries'):
-			if d.purchase_order:
-				submitted = sql("select name from `tabPurchase Order` where docstatus = 1 and name = '%s'" % d.purchase_order)
-				if not submitted:
-					msgprint("Purchase Order : "+ cstr(d.purchase_order) +" is not submitted")
-					raise Exception , "Validation Error."
-			if d.purchase_receipt:
-				submitted = sql("select name from `tabPurchase Receipt` where docstatus = 1 and name = '%s'" % d.purchase_receipt)
-				if not submitted:
-					msgprint("Purchase Receipt : "+ cstr(d.purchase_receipt) +" is not submitted")
-					raise Exception , "Validation Error."
-					
-					
-	#--------------------------------------------------------------------
-	def update_against_document_in_jv(self):
-		"""
-			Links invoice and advance voucher:
-				1. cancel advance voucher
-				2. split into multiple rows if partially adjusted, assign against voucher
-				3. submit advance voucher
-		"""
-		
-		lst = []
-		for d in getlist(self.doclist, 'advance_allocation_details'):
-			if flt(d.allocated_amount) > 0:
-				args = {
-					'voucher_no' : d.journal_voucher, 
-					'voucher_detail_no' : d.jv_detail_no, 
-					'against_voucher_type' : 'Payable Voucher', 
-					'against_voucher'  : self.doc.name,
-					'account' : self.doc.credit_to, 
-					'is_advance' : 'Yes', 
-					'dr_or_cr' : 'debit', 
-					'unadjusted_amt' : flt(d.advance_amount),
-					'allocated_amt' : flt(d.allocated_amount)
-				}
-				lst.append(args)
-		
-		if lst:
-			get_obj('GL Control').reconcile_against_document(lst)
-
-	# On Submit
-	#--------------------------------------------------------------------
-	def on_submit(self):
-		self.check_prev_docstatus()
-		
-		# Check for Approving Authority
-		get_obj('Authorization Control').validate_approving_authority(self.doc.doctype,self.doc.company, self.doc.grand_total)
-		
-		
-		# this sequence because outstanding may get -negative
-		get_obj(dt='GL Control').make_gl_entries(self.doc, self.doclist)
-		
-		self.update_against_document_in_jv()
-		
-		get_obj(dt = 'Purchase Common').update_prevdoc_detail(self, is_submit = 1)
-
-
-
-# ********************************* CANCEL *********************************
-	# Check Next Document's docstatus
-	# --------------------------------
-	def check_next_docstatus(self):
-		submit_jv = sql("select t1.name from `tabJournal Voucher` t1,`tabJournal Voucher Detail` t2 where t1.name = t2.parent and t2.against_voucher = '%s' and t1.docstatus = 1" % (self.doc.name))
-		if submit_jv:
-			msgprint("Journal Voucher : " + cstr(submit_jv[0][0]) + " has been created against " + cstr(self.doc.doctype) + ". So " + cstr(self.doc.doctype) + " cannot be Cancelled.")
-			raise Exception, "Validation Error."
-		
-	# On Cancel
-	# ----------
-	def on_cancel(self):
-		self.check_next_docstatus()
-
-		# Check whether tds payment voucher has been created against this voucher
-		self.check_tds_payment_voucher()
-		
-		get_obj(dt='GL Control').make_gl_entries(self.doc, self.doclist, cancel=1)
-		get_obj(dt = 'Purchase Common').update_prevdoc_detail(self, is_submit = 0)
-
-
-	# Check whether tds payment voucher has been created against this voucher
-	#---------------------------------------------------------------------------
-	def check_tds_payment_voucher(self):
-		tdsp =	sql("select parent from `tabTDS Payment Detail` where voucher_no = '%s' and docstatus = 1 and parent not like 'old%'")
-		if tdsp:
-			msgprint("TDS Payment voucher '%s' has been made against this voucher. Please cancel the payment voucher to proceed." % (tdsp and tdsp[0][0] or ''))
-			raise Exception
-
-	# on update
-	def on_update(self):
-		pass
-		
-########################################################################
-# Repair Outstanding
-#######################################################################
-	def repair_pv_outstanding(self):
-		get_obj(dt = 'GL Control').repair_voucher_outstanding(self)
diff --git a/erpnext/accounts/doctype/payable_voucher/payable_voucher.txt b/erpnext/accounts/doctype/payable_voucher/payable_voucher.txt
deleted file mode 100755
index f7d66ea..0000000
--- a/erpnext/accounts/doctype/payable_voucher/payable_voucher.txt
+++ /dev/null
@@ -1,1117 +0,0 @@
-# DocType, Payable Voucher
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:11',
-		'docstatus': 0,
-		'modified': '2012-03-02 12:28:23',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': u'1330345793',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'module': u'Accounts',
-		'name': '__common__',
-		'read_only_onload': 1,
-		'search_fields': u'posting_date, credit_to, fiscal_year, bill_no, grand_total, outstanding_amount',
-		'section_style': u'Tabbed',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'subject': u'From %(supplier_name)s worth %(grand_total)s due on %(due_date)s | %(outstanding_amount)s outstanding',
-		'version': 521
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Payable Voucher',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': u'DocPerm',
-		'name': '__common__',
-		'parent': u'Payable Voucher',
-		'parentfield': u'permissions',
-		'parenttype': u'DocType',
-		'read': 1
-	},
-
-	# DocType, Payable Voucher
-	{
-		'doctype': 'DocType',
-		'name': u'Payable Voucher'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Accounts Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Accounts Manager',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Accounts User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Purchase User'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Purchase User',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Accounts User',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': u'DocPerm',
-		'match': u'supplier',
-		'permlevel': 0,
-		'role': u'Supplier'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 0,
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Basic Info',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'To manage multiple series please go to Setup > Manage Series',
-		'doctype': u'DocField',
-		'fieldname': u'naming_series',
-		'fieldtype': u'Select',
-		'label': u'Series',
-		'no_copy': 1,
-		'oldfieldname': u'naming_series',
-		'oldfieldtype': u'Select',
-		'options': u'BILL\nBILLJ',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'description': u'The account to which you will pay (have paid) the money to.',
-		'doctype': u'DocField',
-		'fieldname': u'credit_to',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Credit To',
-		'oldfieldname': u'credit_to',
-		'oldfieldtype': u'Link',
-		'options': u'Account',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'amended_from',
-		'fieldtype': u'Link',
-		'label': u'Amended From',
-		'no_copy': 1,
-		'oldfieldname': u'amended_from',
-		'oldfieldtype': u'Link',
-		'options': u'Payable Voucher',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'supplier',
-		'fieldtype': u'Link',
-		'hidden': 0,
-		'label': u'Supplier',
-		'oldfieldname': u'supplier',
-		'oldfieldtype': u'Link',
-		'options': u'Supplier',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'supplier_address',
-		'fieldtype': u'Link',
-		'label': u'Supplier Address',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'contact_person',
-		'fieldtype': u'Link',
-		'label': u'Contact Person',
-		'options': u'Contact',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'supplier_name',
-		'fieldtype': u'Text',
-		'label': u'Name',
-		'oldfieldname': u'supplier_name',
-		'oldfieldtype': u'Data',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'address_display',
-		'fieldtype': u'Small Text',
-		'label': u'Address',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'contact_display',
-		'fieldtype': u'Small Text',
-		'label': u'Contact',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'contact_mobile',
-		'fieldtype': u'Text',
-		'label': u'Mobile No',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'contact_email',
-		'fieldtype': u'Text',
-		'label': u'Contact Email',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'reqd': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'default': u'Today',
-		'description': u'The date at which current entry will get or has actually executed.',
-		'doctype': u'DocField',
-		'fieldname': u'posting_date',
-		'fieldtype': u'Date',
-		'in_filter': 1,
-		'label': u'Posting Date',
-		'no_copy': 0,
-		'oldfieldname': u'posting_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'due_date',
-		'fieldtype': u'Date',
-		'in_filter': 1,
-		'label': u'Due Date',
-		'no_copy': 0,
-		'oldfieldname': u'due_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0,
-		'print_hide': 0,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'description': u'If not applicable please enter: NA',
-		'doctype': u'DocField',
-		'fieldname': u'bill_no',
-		'fieldtype': u'Data',
-		'in_filter': 1,
-		'label': u'Bill No',
-		'oldfieldname': u'bill_no',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'bill_date',
-		'fieldtype': u'Date',
-		'in_filter': 1,
-		'label': u'Bill Date',
-		'oldfieldname': u'bill_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 0,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'description': u'The date at which current entry is corrected in the system.',
-		'doctype': u'DocField',
-		'fieldname': u'amendment_date',
-		'fieldtype': u'Date',
-		'label': u'Amendment Date',
-		'no_copy': 1,
-		'oldfieldname': u'amendment_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'mode_of_payment',
-		'fieldtype': u'Select',
-		'label': u'Mode of Payment',
-		'oldfieldname': u'mode_of_payment',
-		'oldfieldtype': u'Select',
-		'options': u'link:Mode of Payment',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Items',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'currency',
-		'fieldtype': u'Select',
-		'label': u'Bill Currency',
-		'oldfieldname': u'currency',
-		'oldfieldtype': u'Select',
-		'options': u'link:Currency',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'1',
-		'description': u"The rate at which Bill Currency is converted into company's base currency",
-		'doctype': u'DocField',
-		'fieldname': u'conversion_rate',
-		'fieldtype': u'Currency',
-		'label': u'Bill Conversion Rate',
-		'oldfieldname': u'conversion_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Select Items from Purchase Order',
-		'doctype': u'DocField',
-		'fieldname': u'purchase_order_main',
-		'fieldtype': u'Link',
-		'label': u'Purchase Order',
-		'oldfieldname': u'purchase_order_main',
-		'oldfieldtype': u'Link',
-		'options': u'Purchase Order',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Select Items from Purchase Receipt',
-		'doctype': u'DocField',
-		'fieldname': u'purchase_receipt_main',
-		'fieldtype': u'Link',
-		'label': u'Purchase Receipt',
-		'oldfieldname': u'purchase_receipt_main',
-		'oldfieldtype': u'Link',
-		'options': u'Purchase Receipt',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Get Items',
-		'oldfieldtype': u'Button',
-		'options': u'pull_details',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'entries',
-		'fieldtype': u'Table',
-		'label': u'Entries',
-		'oldfieldname': u'entries',
-		'oldfieldtype': u'Table',
-		'options': u'PV Detail',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Recalculate',
-		'oldfieldtype': u'Button',
-		'permlevel': 0,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'description': u'Will be calculated automatically when you enter the details',
-		'doctype': u'DocField',
-		'fieldname': u'net_total',
-		'fieldtype': u'Currency',
-		'label': u'Net Total',
-		'oldfieldname': u'net_total',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Add / Edit taxes and other charges',
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Taxes',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'purchase_other_charges',
-		'fieldtype': u'Link',
-		'label': u'Purchase Other Charges',
-		'oldfieldname': u'purchase_other_charges',
-		'oldfieldtype': u'Link',
-		'options': u'Purchase Other Charges',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Get Tax Detail',
-		'oldfieldtype': u'Button',
-		'options': u'get_purchase_tax_details',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'purchase_tax_details',
-		'fieldtype': u'Table',
-		'label': u'Purchase Tax Details',
-		'oldfieldname': u'purchase_tax_details',
-		'oldfieldtype': u'Table',
-		'options': u'Purchase Tax Detail',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Calculate Tax',
-		'oldfieldtype': u'Button',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'HTML',
-		'label': u'Tax Calculation',
-		'oldfieldtype': u'HTML',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'total_tax',
-		'fieldtype': u'Currency',
-		'label': u'Total Tax',
-		'oldfieldname': u'total_tax',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'More Info',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'print_hide': 1,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'No',
-		'doctype': u'DocField',
-		'fieldname': u'is_opening',
-		'fieldtype': u'Select',
-		'in_filter': 1,
-		'label': u'Is Opening',
-		'oldfieldname': u'is_opening',
-		'oldfieldtype': u'Select',
-		'options': u'No\nYes',
-		'permlevel': 0,
-		'print_hide': 1,
-		'search_index': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'aging_date',
-		'fieldtype': u'Date',
-		'label': u'Aging Date',
-		'oldfieldname': u'aging_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0,
-		'print_hide': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'select_print_heading',
-		'fieldtype': u'Link',
-		'label': u'Select Print Heading',
-		'no_copy': 1,
-		'oldfieldname': u'select_print_heading',
-		'oldfieldtype': u'Link',
-		'options': u'Print Heading',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'print_hide': 1,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'company',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Company',
-		'oldfieldname': u'company',
-		'oldfieldtype': u'Link',
-		'options': u'Company',
-		'permlevel': 0,
-		'print_hide': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'fiscal_year',
-		'fieldtype': u'Select',
-		'in_filter': 1,
-		'label': u'Fiscal Year',
-		'oldfieldname': u'fiscal_year',
-		'oldfieldtype': u'Select',
-		'options': u'link:Fiscal Year',
-		'permlevel': 0,
-		'print_hide': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'depends_on': u'eval:!doc.__islocal',
-		'doctype': u'DocField',
-		'fieldname': u'cancel_reason',
-		'fieldtype': u'Data',
-		'label': u'Cancel Reason',
-		'no_copy': 1,
-		'oldfieldname': u'cancel_reason',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'remarks',
-		'fieldtype': u'Small Text',
-		'label': u'Remarks',
-		'no_copy': 1,
-		'oldfieldname': u'remarks',
-		'oldfieldtype': u'Text',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Advances',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Get Advances Paid',
-		'oldfieldtype': u'Button',
-		'options': u'get_advances',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'advance_allocation_details',
-		'fieldtype': u'Table',
-		'label': u'Advance Allocation Details',
-		'no_copy': 1,
-		'oldfieldname': u'advance_allocation_details',
-		'oldfieldtype': u'Table',
-		'options': u'Advance Allocation Detail',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'TDS',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'permlevel': 0,
-		'print_hide': 1,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'tds_applicable',
-		'fieldtype': u'Select',
-		'label': u'TDS Applicable',
-		'oldfieldname': u'tds_applicable',
-		'oldfieldtype': u'Select',
-		'options': u'\nYes\nNo',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'tds_category',
-		'fieldtype': u'Select',
-		'label': u'TDS Category',
-		'oldfieldname': u'tds_category',
-		'oldfieldtype': u'Select',
-		'options': u'link:TDS Category',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Get TDS',
-		'oldfieldtype': u'Button',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'permlevel': 0,
-		'print_hide': 1,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'tax_code',
-		'fieldtype': u'Link',
-		'label': u'TDS Account Head',
-		'oldfieldname': u'tax_code',
-		'oldfieldtype': u'Link',
-		'options': u'Account',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'rate',
-		'fieldtype': u'Currency',
-		'label': u'Rate',
-		'oldfieldname': u'rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'ded_amount',
-		'fieldtype': u'Currency',
-		'label': u'TDS Amount',
-		'oldfieldname': u'ded_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Totals',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'print_hide': 1,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'other_charges_added',
-		'fieldtype': u'Currency',
-		'label': u'Other Charges Added',
-		'oldfieldname': u'other_charges_added',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'other_charges_deducted',
-		'fieldtype': u'Currency',
-		'label': u'Other Charges Deducted',
-		'oldfieldname': u'other_charges_deducted',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'total_tds_on_voucher',
-		'fieldtype': u'Currency',
-		'label': u'Total TDS On Voucher',
-		'no_copy': 1,
-		'oldfieldname': u'total_tds_on_voucher',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'tds_amount_on_advance',
-		'fieldtype': u'Currency',
-		'label': u'TDS Amount On Advance',
-		'no_copy': 1,
-		'oldfieldname': u'tds_amount_on_advance',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'total_advance',
-		'fieldtype': u'Currency',
-		'label': u'Total Advance (Incl. TDS)',
-		'no_copy': 1,
-		'oldfieldname': u'total_advance',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'total_amount_to_pay',
-		'fieldtype': u'Currency',
-		'hidden': 0,
-		'label': u'Total Amount To Pay',
-		'no_copy': 1,
-		'oldfieldname': u'total_amount_to_pay',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'outstanding_amount',
-		'fieldtype': u'Currency',
-		'in_filter': 1,
-		'label': u'Outstanding Amount',
-		'no_copy': 1,
-		'oldfieldname': u'outstanding_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'print_hide': 1,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'grand_total',
-		'fieldtype': u'Currency',
-		'label': u'Grand Total',
-		'oldfieldname': u'grand_total',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'In Words will be visible once you save the Purchase Invoice.',
-		'doctype': u'DocField',
-		'fieldname': u'in_words',
-		'fieldtype': u'Data',
-		'label': u'In Words',
-		'oldfieldname': u'in_words',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'net_total_import',
-		'fieldtype': u'Currency',
-		'label': u'Net Total (Import)',
-		'oldfieldname': u'net_total_import',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'other_charges_added_import',
-		'fieldtype': u'Currency',
-		'label': u'Other Charges Added (Import)',
-		'oldfieldname': u'other_charges_added_import',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'other_charges_deducted_import',
-		'fieldtype': u'Currency',
-		'label': u'Other Charges Deducted (Import)',
-		'oldfieldname': u'other_charges_deducted_import',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'grand_total_import',
-		'fieldtype': u'Currency',
-		'label': u'Grand Total (Import)',
-		'oldfieldname': u'grand_total_import',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'in_words_import',
-		'fieldtype': u'Data',
-		'label': u'In Words (Import)',
-		'oldfieldname': u'in_words_import',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'depends_on': u'eval:!doc.__islocal',
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Actions',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Repair Outstanding Amt',
-		'oldfieldtype': u'Button',
-		'options': u'repair_pv_outstanding',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'against_expense_account',
-		'fieldtype': u'Small Text',
-		'hidden': 1,
-		'label': u'Against Expense Account',
-		'no_copy': 1,
-		'oldfieldname': u'against_expense_account',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 0
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/payable_voucher/__init__.py b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/__init__.py
similarity index 100%
rename from erpnext/accounts/doctype/payable_voucher/__init__.py
rename to erpnext/accounts/doctype/payment_to_invoice_matching_tool/__init__.py
diff --git a/erpnext/accounts/doctype/internal_reconciliation/internal_reconciliation.js b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js
similarity index 100%
rename from erpnext/accounts/doctype/internal_reconciliation/internal_reconciliation.js
rename to erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js
diff --git a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py
new file mode 100644
index 0000000..848cc76
--- /dev/null
+++ b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py
@@ -0,0 +1,156 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self, doc, doclist):
+		self.doc = doc
+		self.doclist = doclist
+		self.acc_type = self.doc.account and sql("select debit_or_credit from `tabAccount` where name = %s", self.doc.account)[0][0].lower() or ''
+		self.dt = {
+			'Sales Invoice': 'Sales Invoice',
+			'Purchase Invoice': 'Purchase Invoice',
+			'Journal Voucher': 'Journal Voucher'
+		}
+		
+	#--------------------------------------------------
+	def get_voucher_details(self):
+		tot_amt = sql("""
+			select sum(%s) from `tabGL Entry` where 
+			voucher_type = %s and voucher_no = %s 
+			and account = %s and ifnull(is_cancelled, 'No') = 'No'
+		"""% (self.acc_type, '%s', '%s', '%s'), (self.dt[self.doc.voucher_type], self.doc.voucher_no, self.doc.account))
+		
+		outstanding = sql("""
+			select sum(%s) - sum(%s) from `tabGL Entry` where 
+			against_voucher = %s and voucher_no != %s
+			and account = %s and ifnull(is_cancelled, 'No') = 'No'
+		""" % ((self.acc_type == 'debit' and 'credit' or 'debit'), self.acc_type, '%s', '%s', '%s'), (self.doc.voucher_no, self.doc.voucher_no, self.doc.account))
+		
+		ret = {
+			'total_amount': flt(tot_amt[0][0]) or 0,	
+			'pending_amt_to_reconcile': flt(tot_amt[0][0]) - flt(outstanding[0][0]) or 0
+		}
+		
+		return ret
+
+		
+	#--------------------------------------------------
+	def get_payment_entries(self):
+		"""
+			Get payment entries for the account and period
+			Payment entry will be decided based on account type (Dr/Cr)
+		"""
+
+		self.doc.clear_table(self.doclist, 'ir_payment_details')		
+		gle = self.get_gl_entries()
+		self.create_payment_table(gle)
+
+	#--------------------------------------------------
+	def get_gl_entries(self):
+		self.validate_mandatory()
+		dc = self.acc_type == 'debit' and 'credit' or 'debit'
+		
+		cond = self.doc.from_date and " and t1.posting_date >= '" + self.doc.from_date + "'" or ""
+		cond += self.doc.to_date and " and t1.posting_date <= '" + self.doc.to_date + "'"or ""
+		
+		cond += self.doc.amt_greater_than and ' and t2.' + dc+' >= ' + self.doc.amt_greater_than or ''
+		cond += self.doc.amt_less_than and ' and t2.' + dc+' <= ' + self.doc.amt_less_than or ''
+
+		gle = sql("""
+			select t1.name as voucher_no, t1.posting_date, t1.total_debit as total_amt,  sum(ifnull(t2.credit, 0)) - sum(ifnull(t2.debit, 0)) as amt_due, t1.remark, t2.against_account, t2.name as voucher_detail_no
+			from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
+			where t1.name = t2.parent  
+			and t1.docstatus = 1 
+			and t2.account = %s
+			and ifnull(t2.against_voucher, '')='' and ifnull(t2.against_invoice, '')='' and ifnull(t2.against_jv, '')=''
+			and t2.%s > 0
+			%s
+			group by t1.name, t2.name
+		"""% ('%s', dc, cond), self.doc.account, as_dict=1)
+
+		return gle
+
+	#--------------------------------------------------
+	def create_payment_table(self, gle):
+		for d in gle:
+			ch = addchild(self.doc, 'ir_payment_details', 'Payment to Invoice Matching Tool Detail', 1, self.doclist)
+			ch.voucher_no = d.get('voucher_no')
+			ch.posting_date = d.get('posting_date')
+			ch.amt_due =  self.acc_type == 'debit' and flt(d.get('amt_due')) or -1*flt(d.get('amt_due'))
+			ch.total_amt = flt(d.get('total_amt'))
+			ch.against_account = d.get('against_account')
+			ch.remarks = d.get('remark')
+			ch.amt_to_be_reconciled = flt(ch.amt_due)
+			ch.voucher_detail_no = d.get('voucher_detail_no')
+			
+	#--------------------------------------------------
+	def validate_mandatory(self):
+		if not self.doc.account:
+			msgprint("Please select Account first", raise_exception=1)
+	
+	#--------------------------------------------------	
+	def reconcile(self):
+		"""
+			Links booking and payment voucher
+			1. cancel payment voucher
+			2. split into multiple rows if partially adjusted, assign against voucher
+			3. submit payment voucher
+		"""
+		if not self.doc.voucher_no or not sql("select name from `tab%s` where name = %s" %(self.dt[self.doc.voucher_type], '%s'),  self.doc.voucher_no):
+			msgprint("Please select valid Voucher No to proceed", raise_exception=1)
+		
+		lst = []
+		for d in getlist(self.doclist, 'ir_payment_details'):
+			if d.selected and flt(d.amt_to_be_reconciled) > 0:
+				args = {
+					'voucher_no' : d.voucher_no,
+					'voucher_detail_no' : d.voucher_detail_no, 
+					'against_voucher_type' : self.dt[self.doc.voucher_type], 
+					'against_voucher'  : self.doc.voucher_no,
+					'account' : self.doc.account, 
+					'is_advance' : 'No', 
+					'dr_or_cr' :  self.acc_type=='debit' and 'credit' or 'debit', 
+					'unadjusted_amt' : flt(d.amt_due),
+					'allocated_amt' : flt(d.amt_to_be_reconciled)
+				}
+			
+				lst.append(args)
+		
+
+		if lst:
+			get_obj('GL Control').reconcile_against_document(lst)
+			msgprint("Successfully reconciled.")
+		else:
+			msgprint("No payment entries selected.", raise_exception=1)
diff --git a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.txt b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.txt
new file mode 100644
index 0000000..5a95ba8
--- /dev/null
+++ b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.txt
@@ -0,0 +1,275 @@
+# DocType, Payment to Invoice Matching Tool
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:42',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:42',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': u'1316509358',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'document_type': u'Other',
+		'issingle': 1,
+		'module': u'Accounts',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'show_in_menu': 1,
+		'version': 37
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Payment to Invoice Matching Tool',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Payment to Invoice Matching Tool',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1
+	},
+
+	# DocType, Payment to Invoice Matching Tool
+	{
+		'doctype': 'DocType',
+		'name': u'Payment to Invoice Matching Tool'
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'System Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Accounts Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Accounts User',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'All'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'account',
+		'fieldtype': u'Link',
+		'label': u'Account',
+		'options': u'Account',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'voucher_type',
+		'fieldtype': u'Select',
+		'label': u'Voucher Type',
+		'options': u'Sales Invoice\nPurchase Invoice\nJournal Voucher',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'voucher_no',
+		'fieldtype': u'Link',
+		'label': u'Voucher No',
+		'permlevel': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'total_amount',
+		'fieldtype': u'Currency',
+		'label': u'Total Amount',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'pending_amt_to_reconcile',
+		'fieldtype': u'Currency',
+		'label': u'Pending Amt To Reconcile',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'payment_entries',
+		'fieldtype': u'Section Break',
+		'label': u'Payment Entries',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'column_break2',
+		'fieldtype': u'Column Break',
+		'label': u"<div class = 'field_description'>Filter payment entries based on date:</div>",
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'from_date',
+		'fieldtype': u'Date',
+		'label': u'From Date',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'to_date',
+		'fieldtype': u'Date',
+		'label': u'To Date',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'column_break3',
+		'fieldtype': u'Column Break',
+		'label': u"<div class = 'field_description'>Filter payment entries based on amount:</div>",
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'amt_greater_than',
+		'fieldtype': u'Data',
+		'label': u'Amount >=',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amt_less_than',
+		'fieldtype': u'Data',
+		'label': u'Amount <=',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'section_break0',
+		'fieldtype': u'Section Break',
+		'options': u'Simple',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'pull_payment_entries',
+		'fieldtype': u'Button',
+		'label': u'Pull Payment Entries',
+		'options': u'get_payment_entries',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'ir_payment_details',
+		'fieldtype': u'Table',
+		'label': u'Payment Entries',
+		'options': u'Payment to Invoice Matching Tool Detail',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'reconcile_html',
+		'fieldtype': u'HTML',
+		'label': u'Reconcile HTML',
+		'options': u"<div class='field_description'>Select Payment Voucher and Amount to Reconcile in the above table and then click Reconcile button</div>",
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'reconcile',
+		'fieldtype': u'Button',
+		'label': u'Reconcile',
+		'options': u'reconcile',
+		'permlevel': 0,
+		'trigger': u'Client'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/test_ir.py b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/test_ir.py
new file mode 100644
index 0000000..d990b18
--- /dev/null
+++ b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/test_ir.py
@@ -0,0 +1,185 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+import unittest
+import webnotes
+
+from webnotes.model.doc import Document
+from webnotes.model.code import get_obj
+from webnotes.utils import cstr, flt
+sql = webnotes.conn.sql
+
+class TestInternalReco(unittest.TestCase):
+	def setUp(self):
+		webnotes.conn.begin()
+		
+		comp1.save(1)
+		cust1.save(1)
+		bank1.save(1)
+		rv1.save(1)
+		rv_gle.save(1)
+
+
+		for t in jv1: t.save(1)
+		for t in jv1[1:]:
+			sql("update `tabJournal Voucher Detail` set parent = '%s' where name = '%s'" % (jv1[0].name, t.name))
+			
+		ir[0].save()
+		for t in ir[1:]:
+			t.save(1)
+			sql("update `tabPayment to Invoice Matching Tool Detail` set voucher_no = '%s', voucher_detail_no = '%s' where parent = 'Payment to Invoice Matching Tool'" % (jv1[0].name, jv1[1].name))
+		
+		
+		sql("update `tabGL Entry` set voucher_no = %s, against_voucher = %s where voucher_no = 'rv1'", (rv1.name, rv1.name))
+		sql("update `tabSingles` set value = %s where doctype = 'Payment to Invoice Matching Tool' and field = 'voucher_no'", rv1.name)
+		
+		
+		self.ir = get_obj('Payment to Invoice Matching Tool', with_children=1)		
+		self.ir.reconcile()
+		
+	#===========================
+	def test_jv(self):
+		"""
+			Test whether JV has benn properly splitted and against doc has been updated
+		"""
+		amt_against_doc = [[cstr(d[0]), flt(d[1]), flt(d[2])]for d in sql("select against_invoice, debit, credit from `tabJournal Voucher Detail` where parent = %s and account = 'cust1 - c1'", jv1[0].name)]
+		self.assertTrue(amt_against_doc == [[rv1.name, 0, 100.0], ['', 0, 400.0]])
+
+	#============================		
+	def test_gl_entry(self):
+		"""
+			Check proper gl entry has been made
+		"""
+		gle = [[cstr(d[0]), flt(d[1])] for d in sql("select against_voucher, sum(credit) - sum(debit) from `tabGL Entry` where voucher_no = %s and account = 'cust1 - c1' and ifnull(is_cancelled, 'No') = 'No' group by against_voucher", jv1[0].name)]
+
+		self.assertTrue([rv1.name, 100.0] in gle)
+		self.assertTrue(['', 400.0] in gle)
+		
+	#============================
+	def test_outstanding(self):
+		"""
+			Check whether Outstanding amount has been properly updated in RV
+		"""
+		amt = sql("select outstanding_amount from `tabSales Invoice` where name = '%s'" % rv1.name)[0][0]
+		self.assertTrue(amt == 0)
+		
+	#============================
+	def tearDown(self):
+		webnotes.conn.rollback()
+	
+
+
+
+# test data
+#---------------
+rv1 = Document(fielddata={
+		'doctype':'Sales Invoice',
+		'docstatus':1,
+		'debit_to':'cust1 - c1',
+		'grand_total': 100,
+		'outstanding_amount': 100,
+		'name': 'rv1'
+	})
+	
+jv1 = [Document(fielddata={
+		'doctype':'Journal Voucher',
+		'docstatus':1,
+		'cheque_no': '163567',
+		'docstatus':1,
+		'company': 'comp1',
+		'posting_date' : '2011-05-02',
+		'remark': 'test data',
+		'fiscal_year': '2011-2012',
+		'total_debit': 500,
+		'total_credit': 500
+	}),
+	Document(fielddata = {
+		'parenttype':'Journal Voucher',
+		'parentfield':'entries',
+		'doctype':'Journal Voucher Detail',
+		'account' : 'cust1 - c1',
+		'credit':500,
+		'debit' : 0,
+		'docstatus':1
+	}),
+	Document(fielddata = {
+		'parenttype':'Journal Voucher',
+		'parentfield':'entries',
+		'doctype':'Journal Voucher Detail',
+		'account' : 'bank1 - c1',
+		'credit':0,
+		'debit' : 500,
+		'docstatus':1
+	})]
+	
+ir = [Document(fielddata = {
+		'doctype':'Payment to Invoice Matching Tool',
+		'name' : 'Payment to Invoice Matching Tool',
+		'account':'cust1 - c1',
+		'voucher_type' : 'Sales Invoice',
+		'voucher_no': 'rv1'
+	}),
+	Document(fielddata = {
+		'parenttype':'Payment to Invoice Matching Tool',
+		'parentfield':'ir_payment_details',
+		'doctype':'Payment to Invoice Matching Tool Detail',
+		'parent': 'Payment to Invoice Matching Tool',
+		'voucher_no': 'jv1',
+		'name' : '123112',
+		'voucher_detail_no' : 'jvd1',
+		'selected' : 1,
+		'amt_due' : 500,
+		'amt_to_be_reconciled':100
+	})]
+	
+cust1 = Document(fielddata={
+		'doctype':'Account',
+		'docstatus':0,
+		'account_name' : 'cust1',
+		'debit_or_credit': 'Debit',
+		'company' : 'comp1',
+		'lft': 1,
+		'rgt': 2
+	})
+	
+bank1 = Document(fielddata={
+		'doctype':'Account',
+		'docstatus':0,
+		'account_name' : 'bank1',
+		'debit_or_credit': 'Debit',
+		'company' : 'comp1',
+		'lft': 3,
+		'rgt': 4
+	})	
+	
+comp1 = Document(fielddata={
+		'doctype':'Company',
+		'abbr': 'c1',
+		'company_name' : 'comp1',
+		'name': 'comp1'
+	})
+	
+rv_gle = Document(fielddata={
+		'doctype':'GL Entry',
+		'account': 'cust1 - c1',
+		'company' : 'comp1',
+		'voucher_no': 'rv1',
+		'against_voucher': 'rv1',
+		'against_voucher_type': 'Sales Invoice',
+		'voucher_type' : 'Sales Invoice',
+		'debit': 100,
+		'credit': 0
+	})
diff --git a/erpnext/accounts/doctype/purchase_tax_detail/__init__.py b/erpnext/accounts/doctype/payment_to_invoice_matching_tool_detail/__init__.py
similarity index 100%
copy from erpnext/accounts/doctype/purchase_tax_detail/__init__.py
copy to erpnext/accounts/doctype/payment_to_invoice_matching_tool_detail/__init__.py
diff --git a/erpnext/accounts/doctype/payment_to_invoice_matching_tool_detail/payment_to_invoice_matching_tool_detail.txt b/erpnext/accounts/doctype/payment_to_invoice_matching_tool_detail/payment_to_invoice_matching_tool_detail.txt
new file mode 100644
index 0000000..5291057
--- /dev/null
+++ b/erpnext/accounts/doctype/payment_to_invoice_matching_tool_detail/payment_to_invoice_matching_tool_detail.txt
@@ -0,0 +1,132 @@
+# DocType, Payment to Invoice Matching Tool Detail
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:43',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:43',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Accounts',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'show_in_menu': 0,
+		'version': 14
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Payment to Invoice Matching Tool Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Payment to Invoice Matching Tool Detail
+	{
+		'doctype': 'DocType',
+		'name': u'Payment to Invoice Matching Tool Detail'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'selected',
+		'fieldtype': u'Check',
+		'label': u'Select',
+		'permlevel': 0,
+		'reqd': 1,
+		'width': u'60px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'voucher_no',
+		'fieldtype': u'Link',
+		'label': u'Voucher No',
+		'options': u'Journal Voucher',
+		'permlevel': 1,
+		'reqd': 0,
+		'width': u'140px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amt_due',
+		'fieldtype': u'Currency',
+		'label': u'Amt Due',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amt_to_be_reconciled',
+		'fieldtype': u'Currency',
+		'label': u'Amt to be reconciled',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'posting_date',
+		'fieldtype': u'Date',
+		'label': u'Posting Date',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'total_amt',
+		'fieldtype': u'Currency',
+		'label': u'Total Amt',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'against_account',
+		'fieldtype': u'Data',
+		'label': u'Against Account',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'remarks',
+		'fieldtype': u'Small Text',
+		'label': u'Remarks',
+		'permlevel': 1,
+		'width': u'200px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'voucher_detail_no',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Voucher Detail No',
+		'no_column': 0,
+		'permlevel': 1,
+		'print_hide': 1,
+		'reqd': 0
+	}
+]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js
index 20e9ab1..4179ed0 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js
+++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js
@@ -8,35 +8,35 @@
 // 
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
 // GNU General Public License for more details.
 // 
 // You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+// along with this program.	If not, see <http://www.gnu.org/licenses/>.
 
 
 //========================== On Load =================================================
 cur_frm.cscript.onload = function(doc, cdt, cdn) {
-  if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date());
+	if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date());
 }
 
 cur_frm.cscript.refresh = function(doc, cdt, cdn) {
-hide_field('Repost Account Balances');
-  hide_field('next_fiscal_year');
-  hide_field('Repost');
+	hide_field('repost_account_balances');
+	hide_field('next_fiscal_year');
+	hide_field('repost');
 
-  if (doc.docstatus == 1) { 
-    unhide_field('Repost Account Balances');
-    unhide_field('next_fiscal_year');
-    unhide_field('Repost');
-  }
+	if (doc.docstatus == 1) { 
+		unhide_field('repost_account_balances');
+		unhide_field('next_fiscal_year');
+		unhide_field('repost');
+	}
 }
 
 // ***************** Get Account Head *****************
 cur_frm.fields_dict['closing_account_head'].get_query = function(doc, cdt, cdn) {
-  return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.is_pl_account = "No" AND `tabAccount`.debit_or_credit = "Credit" AND `tabAccount`.company = "'+ cstr(doc.company) +'" AND `tabAccount`.freeze_account = "No" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name ASC LIMIT 50';
+	return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.is_pl_account = "No" AND `tabAccount`.debit_or_credit = "Credit" AND `tabAccount`.company = "'+ cstr(doc.company) +'" AND `tabAccount`.freeze_account = "No" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name ASC LIMIT 50';
 }
 
 cur_frm.cscript.acc_help = function(doc,dt,dn){
-  show_chart_browser('Accounts Browser','Account');
-}
\ No newline at end of file
+	show_chart_browser('Accounts Browser','Account');
+}
diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.txt b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.txt
index e432aac..54e458e 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.txt
+++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-10-25 17:25:22',
+		'creation': '2012-03-27 14:35:46',
 		'docstatus': 0,
-		'modified': '2012-03-21 12:39:36',
+		'modified': '2012-03-27 14:45:49',
 		'modified_by': u'Administrator',
 		'owner': u'jai@webnotestech.com'
 	},
@@ -17,6 +17,7 @@
 		'colour': u'White:FFF',
 		'default_print_format': u'Standard',
 		'doctype': 'DocType',
+		'is_submittable': 1,
 		'module': u'Accounts',
 		'name': '__common__',
 		'search_fields': u'posting_date, fiscal_year',
@@ -81,6 +82,20 @@
 
 	# DocPerm
 	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'System Manager'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Accounts Manager'
+	},
+
+	# DocPerm
+	{
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
@@ -102,9 +117,24 @@
 		'write': 1
 	},
 
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'System Manager'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Accounts Manager'
+	},
+
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -187,6 +217,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break1',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0
@@ -210,6 +241,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'coa_help',
 		'fieldtype': u'HTML',
 		'label': u'CoA Help',
 		'oldfieldtype': u'HTML',
@@ -246,6 +278,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'repost_account_balances',
 		'fieldtype': u'Section Break',
 		'label': u'Repost Account Balances',
 		'oldfieldtype': u'Section Break',
@@ -271,6 +304,7 @@
 		'allow_on_submit': 1,
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'repost',
 		'fieldtype': u'Button',
 		'label': u'Repost',
 		'oldfieldtype': u'Button',
diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.js b/erpnext/accounts/doctype/pos_setting/pos_setting.js
index 82cf389..a6e7247 100755
--- a/erpnext/accounts/doctype/pos_setting/pos_setting.js
+++ b/erpnext/accounts/doctype/pos_setting/pos_setting.js
@@ -8,47 +8,47 @@
 // 
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
 // GNU General Public License for more details.
 // 
 // You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+// along with this program.	If not, see <http://www.gnu.org/licenses/>.
 
 cur_frm.cscript.onload = function(doc,cdt,cdn){
-  $c_obj(make_doclist(cdt,cdn),'get_series','',function(r,rt){
-    if(r.message) set_field_options('naming_series', r.message);
-  });
+	$c_obj(make_doclist(cdt,cdn),'get_series','',function(r,rt){
+		if(r.message) set_field_options('naming_series', r.message);
+	});
  
-  
+	
 }
 
 //cash bank account
 //------------------------------------
 cur_frm.fields_dict['cash_bank_account'].get_query = function(doc,cdt,cdn) {
-  return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
+	return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
 }
 
 // Income Account 
 // --------------------------------
 cur_frm.fields_dict['income_account'].get_query = function(doc,cdt,cdn) {
-  return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.account_type ="Income Account" AND tabAccount.%(key)s LIKE "%s"'
+	return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.account_type ="Income Account" AND tabAccount.%(key)s LIKE "%s"'
 }
 
 
 // Cost Center 
 // -----------------------------
 cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) {
-  return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY  `tabCost Center`.`name` ASC LIMIT 50';
+	return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY	`tabCost Center`.`name` ASC LIMIT 50';
 }
 
 //get query select Territory
 //=================================================================
 cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
-  return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';
+	return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"	ORDER BY	`tabTerritory`.`name` ASC LIMIT 50';
 }
 
 
 // ------------------ Get Print Heading ------------------------------------
 cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
-  return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
+	return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
 }
diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.py b/erpnext/accounts/doctype/pos_setting/pos_setting.py
index 45caca5..43742ac 100755
--- a/erpnext/accounts/doctype/pos_setting/pos_setting.py
+++ b/erpnext/accounts/doctype/pos_setting/pos_setting.py
@@ -39,7 +39,7 @@
 
   #--------------------get naming series from sales invoice-----------------
   def get_series(self):
-    res = sql("select options from `tabDocField` where parent='Receivable Voucher' and fieldname = 'naming_series'")
+    res = sql("select options from `tabDocField` where parent='Sales Invoice' and fieldname = 'naming_series'")
     return res and cstr(res[0][0]) or ''
   
   def validate(self):
diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.txt b/erpnext/accounts/doctype/pos_setting/pos_setting.txt
index fa79a58..b1b90e6 100755
--- a/erpnext/accounts/doctype/pos_setting/pos_setting.txt
+++ b/erpnext/accounts/doctype/pos_setting/pos_setting.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-15 08:39:23',
+		'creation': '2012-03-27 14:35:46',
 		'docstatus': 0,
-		'modified': '2012-03-21 12:39:49',
+		'modified': '2012-03-27 14:35:46',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -170,6 +170,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break'
 	},
@@ -242,7 +243,7 @@
 		'label': u'Charge',
 		'oldfieldname': u'charge',
 		'oldfieldtype': u'Link',
-		'options': u'Other Charges'
+		'options': u'Sales Taxes and Charges Master'
 	},
 
 	# DocField
@@ -262,10 +263,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'tc_name',
 		'fieldtype': u'Link',
-		'label': u'Terms',
+		'label': u'Terms and Conditions',
 		'oldfieldname': u'tc_name',
 		'oldfieldtype': u'Link',
-		'options': u'Term'
+		'options': u'Terms and Conditions'
 	},
 
 	# DocField
diff --git a/erpnext/accounts/doctype/purchase_tax_detail/__init__.py b/erpnext/accounts/doctype/purchase_invoice/__init__.py
similarity index 100%
rename from erpnext/accounts/doctype/purchase_tax_detail/__init__.py
rename to erpnext/accounts/doctype/purchase_invoice/__init__.py
diff --git a/erpnext/accounts/doctype/purchase_invoice/listview.js b/erpnext/accounts/doctype/purchase_invoice/listview.js
new file mode 100644
index 0000000..da8d2ac
--- /dev/null
+++ b/erpnext/accounts/doctype/purchase_invoice/listview.js
@@ -0,0 +1,39 @@
+// render
+wn.doclistviews['Purchase Invoice'] = wn.views.ListView.extend({
+	init: function(d) {
+		this._super(d);
+		this.fields = this.fields.concat([
+			'`tabPurchase Invoice`.supplier_name',
+			'`tabPurchase Invoice`.currency',
+			'IFNULL(`tabPurchase Invoice`.grand_total_import, 0) as grand_total_import',
+			'IFNULL(`tabPurchase Invoice`.grand_total, 0) as grand_total',
+			'IFNULL(`tabPurchase Invoice`.outstanding_amount, 0) as outstanding_amount',
+		]);
+		this.stats = this.stats.concat(['company']);
+	},
+
+	prepare_data: function(data) {
+		this._super(data);
+		data.paid = flt(
+			((data.grand_total - data.outstanding_amount) / data.grand_total) * 100,
+			2);
+	},
+
+	columns: [
+		{width: '5%', content: 'avatar'},
+		{width: '3%', content: 'docstatus'},
+		{width: '15%', content: 'name'},
+		{width: '37%', content: 'tags+supplier_name', css: {color: '#aaa'}},
+		{
+			width: '18%', 
+			content: function(parent, data) { 
+				$(parent).html(data.currency + ' ' + fmt_money(data.grand_total_import)) 
+			},
+			css: {'text-align':'right'}
+		},
+		{width: '10%', content: 'paid', type:'bar-graph', label:'Paid'},
+		{width: '12%', content:'modified', css: {
+			'text-align': 'right', 'color':'#777'
+		}},
+	]
+});
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
new file mode 100644
index 0000000..f880eb7
--- /dev/null
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -0,0 +1,405 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+cur_frm.cscript.tname = "Purchase Invoice Item";
+cur_frm.cscript.fname = "entries";
+cur_frm.cscript.other_fname = "purchase_tax_details";
+wn.require('erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js');
+wn.require('erpnext/buying/doctype/purchase_common/purchase_common.js');
+
+// On Load
+// --------
+cur_frm.cscript.onload = function(doc,dt,dn) {
+	var cp = wn.control_panel;
+
+	if(!doc.voucher_date) set_multiple(dt,dn,{voucher_date:get_today()});
+	if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});  
+
+	if(cp.country == 'India') {
+		unhide_field(['tds','tds_applicable','tds_category','get_tds','tax_code','rate','ded_amount','total_tds_on_voucher','tds_amount_on_advance']);
+	}
+	else {
+		hide_field(['tds','tds_applicable','tds_category','get_tds','tax_code','rate','ded_amount','total_tds_on_voucher','tds_amount_on_advance']);
+	}	
+	
+	if(doc.__islocal){
+		hide_field(['supplier_address', 'contact_person', 'supplier_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email']);
+	}
+}
+
+
+//Onload post render
+//------------------------
+cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
+	var callback = function(doc, dt, dn) {
+		var callback1 = function(doc, dt, dn) {
+			if(doc.__islocal && doc.supplier) cur_frm.cscript.supplier(doc,dt,dn);
+		}
+	
+		// defined in purchase_common.js
+		cur_frm.cscript.update_item_details(doc, dt, dn, callback1);
+	}
+	cur_frm.cscript.dynamic_label(doc, dt, dn, callback);
+}
+
+// Refresh
+// --------
+cur_frm.cscript.refresh = function(doc, dt, dn) {
+	
+	cur_frm.clear_custom_buttons();
+
+	if (!cur_frm.cscript.is_onload) cur_frm.cscript.dynamic_label(doc, dt, dn);
+
+
+	// Show / Hide button
+	if(doc.docstatus==1 && doc.outstanding_amount > 0)
+		cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript.make_bank_voucher);
+	
+	if(doc.docstatus==1) { 
+		cur_frm.add_custom_button('View Ledger', cur_frm.cscript.view_ledger_entry);
+	}	
+	cur_frm.cscript.is_opening(doc, dt, dn);
+}
+
+
+//Supplier
+cur_frm.cscript.supplier = function(doc,dt,dn) {
+	var callback = function(r,rt) {
+			var doc = locals[cur_frm.doctype][cur_frm.docname];		
+			get_server_fields('get_credit_to','','',doc, dt, dn, 0, callback2);
+	}
+	
+	var callback2 = function(r,rt){
+		var doc = locals[cur_frm.doctype][cur_frm.docname];
+		var el = getchildren('Purchase Invoice Item',doc.name,'entries');
+		for(var i in el){
+			if(el[i].item_code && (!el[i].expense_head || !el[i].cost_center)){
+				args = {
+					item_code: el[i].item_code,
+					expense_head: el[i].expense_head,
+					cost_center: el[i].cost_center
+				};
+				get_server_fields('get_default_values', JSON.stringify(args), 'entries', doc, el[i].doctype, el[i].name, 1);
+			}
+		}
+		cur_frm.cscript.calc_amount(doc, 1);
+	}
+
+	if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1,callback);
+	if(doc.supplier) unhide_field(['supplier_address','contact_person','supplier_name','address_display','contact_display','contact_mobile','contact_email']);
+}
+
+cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
+	if(doc.supplier) get_server_fields('get_supplier_address', JSON.stringify({supplier: doc.supplier, address: doc.supplier_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
+}
+
+
+
+cur_frm.fields_dict.supplier_address.on_new = function(dn) {
+	locals['Address'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
+	locals['Address'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
+}
+
+cur_frm.fields_dict.contact_person.on_new = function(dn) {
+	locals['Contact'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
+	locals['Contact'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
+}
+
+
+cur_frm.cscript.credit_to = function(doc,dt,dn) {
+
+	var callback = function(r,rt) {
+			var doc = locals[cur_frm.doctype][cur_frm.docname];		
+			if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1);
+			if(doc.supplier) unhide_field(['supplier_address','contact_person','supplier_name','address_display','contact_display','contact_mobile','contact_email']);
+			cur_frm.refresh();
+	}
+
+	get_server_fields('get_cust','','',doc,dt,dn,1,callback);	
+}
+
+
+
+//Set expense_head and cost center on adding new row
+//----------------------------------------------
+cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
+	
+	cl = getchildren('Purchase Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
+	acc = '';
+	cc = '';
+
+	for(var i = 0; i<cl.length; i++) {
+		if (cl[i].idx == 1){
+			acc = cl[i].expense_head;
+			cc = cl[i].cost_center;
+		}
+		else{
+			if (! cl[i].expense_head) { cl[i].expense_head = acc; refresh_field('expense_head', cl[i].name, 'entries');}
+			if (! cl[i].cost_center)	{cl[i].cost_center = cc; refresh_field('cost_center', cl[i].name, 'entries');}
+		}
+	}
+}
+
+cur_frm.cscript.is_opening = function(doc, dt, dn) {
+	hide_field('aging_date');
+	if (doc.is_opening == 'Yes') unhide_field('aging_date');
+}
+
+// Recalculate Button
+// -------------------
+cur_frm.cscript.recalculate = function(doc, cdt, cdn) {
+	cur_frm.cscript.calculate_tax(doc,cdt,cdn);
+	calc_total_advance(doc,cdt,cdn);
+}
+
+// Get Items Button
+// -----------------
+cur_frm.cscript.get_items = function(doc, dt, dn) {
+	var callback = function(r,rt) { 
+		unhide_field(['supplier_address', 'contact_person', 'supplier_name', 'address_display', 'contact_display', 'contact_mobile','contact_email']);				
+		refresh_many(['credit_to','supplier','supplier_address','contact_person','supplier_name', 'address_display', 'contact_display','contact_mobile', 'contact_email','entries', 'purchase_receipt_main', 'purchase_order_main', 'purchase_tax_details']);
+	}
+	$c_obj(make_doclist(dt,dn),'pull_details','',callback);
+}
+
+// ========== Purchase Invoice Items Table ============
+
+// Item Code
+// ----------
+cur_frm.cscript.item_code = function(doc,cdt,cdn){
+	var d = locals[cdt][cdn];
+	if(d.item_code){
+		get_server_fields('get_item_details',d.item_code,'entries',doc,cdt,cdn,1);
+	}
+}
+
+// Rate in Deduct Taxes (TDS)
+// --------------------------
+cur_frm.cscript.rate = function(doc,dt,dn) {
+	//This is done as Purchase tax detail and PV detail both contain the same fieldname 'rate'
+	if(dt != 'Purchase Taxes and Charges')	 cur_frm.cscript.calc_amount(doc, 2);
+}
+
+// Amount
+// -------
+cur_frm.cscript.ded_amount = function(doc,dt,dn) {calculate_outstanding(doc);}
+
+// Get TDS Button
+// ---------------
+cur_frm.cscript.get_tds = function(doc, dt, dn) {
+	var callback = function(r,rt) {
+		cur_frm.refresh();
+		refresh_field('ded_amount');
+		//cur_frm.cscript.calc_total(locals[dt][dn]);
+	}
+	$c_obj(make_doclist(dt,dn), 'get_tds', '', callback);
+}
+
+// ===================== Advance Allocation ==================
+cur_frm.cscript.allocated_amount = function(doc,cdt,cdn){
+	var d = locals[cdt][cdn];
+	if (d.allocated_amount && d.tds_amount){
+		d.tds_allocated=flt(d.tds_amount*(d.allocated_amount/d.advance_amount))
+		refresh_field('tds_allocated', d.name, 'advance_allocation_details');
+	}
+	tot_tds=0
+	el = getchildren('Purchase Invoice Advance',doc.name,'advance_allocation_details')
+	for(var i in el){
+		tot_tds += el[i].tds_allocated
+	}
+	doc.tds_amount_on_advance = tot_tds
+	refresh_field('tds_amount_on_advance');
+	
+	calc_total_advance(doc, cdt, cdn);
+}
+
+
+// Make Journal Voucher
+// --------------------
+cur_frm.cscript.make_bank_voucher = function() {
+	$c('accounts.get_default_bank_account', { company: cur_frm.doc.company }, function(r, rt) {
+		if(!r.exc) {
+			cur_frm.cscript.make_jv(cur_frm.doc, null, null, r.message);
+	}
+	});
+}
+
+
+/* ***************************** GET QUERY Functions *************************** */
+
+
+cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
+	return 'SELECT name,address_line1,city FROM tabAddress WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+	return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+// Item Code
+// ----------
+cur_frm.fields_dict['entries'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
+	return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE tabItem.is_purchase_item="Yes" AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50'
+}
+
+// Credit To
+// ----------
+cur_frm.fields_dict['credit_to'].get_query = function(doc) {
+	return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.is_pl_account="No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
+}
+
+
+// Purchase Order
+// ---------------
+cur_frm.fields_dict['purchase_order_main'].get_query = function(doc) {
+	if (doc.supplier){
+		return 'SELECT `tabPurchase Order`.`name` FROM `tabPurchase Order` WHERE `tabPurchase Order`.`docstatus` = 1 AND `tabPurchase Order`.supplier = "'+ doc.supplier +'" AND `tabPurchase Order`.`status` != "Stopped" AND ifnull(`tabPurchase Order`.`per_billed`,0) < 100 AND `tabPurchase Order`.`company` = "' + doc.company + '" AND `tabPurchase Order`.%(key)s LIKE "%s" ORDER BY `tabPurchase Order`.`name` DESC LIMIT 50'
+	} else {
+		return 'SELECT `tabPurchase Order`.`name` FROM `tabPurchase Order` WHERE `tabPurchase Order`.`docstatus` = 1 AND `tabPurchase Order`.`status` != "Stopped" AND ifnull(`tabPurchase Order`.`per_billed`, 0) < 100 AND `tabPurchase Order`.`company` = "' + doc.company + '" AND `tabPurchase Order`.%(key)s LIKE "%s" ORDER BY `tabPurchase Order`.`name` DESC LIMIT 50'
+	}
+}
+
+// Purchase Receipt
+// -----------------
+cur_frm.fields_dict['purchase_receipt_main'].get_query = function(doc) {
+	if (doc.supplier){
+		return 'SELECT `tabPurchase Receipt`.`name` FROM `tabPurchase Receipt` WHERE `tabPurchase Receipt`.`docstatus` = 1 AND `tabPurchase Receipt`.supplier = "'+ doc.supplier +'" AND `tabPurchase Receipt`.`status` != "Stopped" AND ifnull(`tabPurchase Receipt`.`per_billed`, 0) < 100 AND `tabPurchase Receipt`.`company` = "' + doc.company + '" AND `tabPurchase Receipt`.%(key)s LIKE "%s" ORDER BY `tabPurchase Receipt`.`name` DESC LIMIT 50'
+	} else {
+		return 'SELECT `tabPurchase Receipt`.`name` FROM `tabPurchase Receipt` WHERE `tabPurchase Receipt`.`docstatus` = 1 AND `tabPurchase Receipt`.`status` != "Stopped" AND ifnull(`tabPurchase Receipt`.`per_billed`, 0) < 100 AND `tabPurchase Receipt`.`company` = "' + doc.company + '" AND `tabPurchase Receipt`.%(key)s LIKE "%s" ORDER BY `tabPurchase Receipt`.`name` DESC LIMIT 50'
+	}
+}
+
+// Get Print Heading
+cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
+	return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
+}
+
+
+// ================== Purchase Invoice Items Table ===================
+// Expense Head
+// -------------
+cur_frm.fields_dict['entries'].grid.get_field("expense_head").get_query = function(doc) {
+	return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"';
+}
+cur_frm.cscript.expense_head = function(doc, cdt, cdn){
+	var d = locals[cdt][cdn];
+	if(d.idx == 1 && d.expense_head){
+		var cl = getchildren('Purchase Invoice Item', doc.name, 'entries', doc.doctype);
+		for(var i = 0; i < cl.length; i++){
+			if(!cl[i].expense_head) cl[i].expense_head = d.expense_head;
+		}
+	}
+	refresh_field('entries');
+}
+
+
+// Cost Center
+//-------------
+cur_frm.fields_dict['entries'].grid.get_field("cost_center").get_query = function(doc) {
+	return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.docstatus != 2 ORDER BY	`tabCost Center`.`name` ASC LIMIT 50';
+}
+
+cur_frm.cscript.cost_center = function(doc, cdt, cdn){
+	var d = locals[cdt][cdn];
+	if(d.idx == 1 && d.cost_center){
+		var cl = getchildren('Purchase Invoice Item', doc.name, 'entries', doc.doctype);
+		for(var i = 0; i < cl.length; i++){
+			if(!cl[i].cost_center) cl[i].cost_center = d.cost_center;
+		}
+	}
+	refresh_field('entries');
+}
+
+
+// TDS Account Head
+cur_frm.fields_dict['tax_code'].get_query = function(doc) {
+	return "SELECT `tabTDS Category Account`.account_head FROM `tabTDS Category Account` WHERE `tabTDS Category Account`.parent = '"+doc.tds_category+"' AND `tabTDS Category Account`.company='"+doc.company+"' AND `tabTDS Category Account`.account_head LIKE '%s' ORDER BY `tabTDS Category Account`.account_head DESC LIMIT 50";
+}
+
+cur_frm.cscript.tax_code = function(doc, dt, dn) {
+	get_server_fields('get_tds_rate','','',doc, dt, dn, 0);
+}
+
+/* ***************************** UTILITY FUNCTIONS ************************ */
+// Calculate Advance
+// ------------------
+calc_total_advance = function(doc,cdt,cdn) {
+	var doc = locals[doc.doctype][doc.name];
+	var el = getchildren('Purchase Invoice Advance',doc.name,'advance_allocation_details')
+	var tot_tds=0;
+	var total_advance = 0;
+	for(var i in el) {
+		if (! el[i].allocated_amount == 0) {
+			total_advance += flt(el[i].allocated_amount);
+			tot_tds += flt(el[i].tds_allocated)
+		}
+	}
+	doc.total_amount_to_pay = flt(doc.grand_total) - flt(doc.ded_amount);
+	doc.tds_amount_on_advance = flt(tot_tds);
+	doc.total_advance = flt(total_advance);
+	doc.outstanding_amount = flt(doc.total_amount_to_pay) - flt(total_advance);
+	refresh_many(['total_advance','outstanding_amount','tds_amount_on_advance', 'total_amount_to_pay']);
+}
+
+// Make JV
+// --------
+cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
+	var jv = LocalDB.create('Journal Voucher');
+	jv = locals['Journal Voucher'][jv];
+	jv.voucher_type = 'Bank Voucher';
+	jv.remark = repl('Payment against voucher %(vn)s for %(rem)s', {vn:doc.name, rem:doc.remarks});
+	jv.total_debit = doc.outstanding_amount;
+	jv.total_credit = doc.outstanding_amount;
+	jv.fiscal_year = doc.fiscal_year;
+	jv.company = doc.company;
+	
+	// debit to creditor
+	var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
+	d1.account = doc.credit_to;
+	d1.debit = doc.outstanding_amount;
+	d1.against_voucher = doc.name;
+	
+	// credit to bank
+	var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
+	d1.account = bank_account;
+	d1.credit = doc.outstanding_amount;
+	
+	loaddoc('Journal Voucher', jv.name);
+}
+
+// ***************** Get project name *****************
+cur_frm.fields_dict['entries'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
+	return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
+}
+
+
+cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
+	if(doc.select_print_heading){
+		// print heading
+		cur_frm.pformat.print_heading = doc.select_print_heading;
+	}
+	else
+		cur_frm.pformat.print_heading = "Purchase Invoice";
+}
+
+/****************** Get Accounting Entry *****************/
+cur_frm.cscript.view_ledger_entry = function(){
+	var callback = function(report){
+		report.set_filter('GL Entry', 'Voucher No',cur_frm.doc.name);
+		report.dt.run();
+	}
+	loadreport('GL Entry','General Ledger', callback);
+}
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
new file mode 100644
index 0000000..be62c93
--- /dev/null
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -0,0 +1,560 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+from utilities.transaction_base import TransactionBase
+
+class DocType(TransactionBase):
+	def __init__(self,d,dl):
+		self.doc, self.doclist = d, dl 
+		self.tname = 'Purchase Invoice Item'
+		self.fname = 'entries'
+
+	# Autoname
+	# ---------
+	def autoname(self):
+		self.doc.name = make_autoname(self.doc.naming_series+'.####')
+
+
+# ************************** Trigger Functions ****************************
+
+	# Credit To
+	# ----------
+	def get_credit_to(self):
+		acc_head = sql("select name, credit_days from `tabAccount` where (name = %s or (master_name = %s and master_type = 'supplier')) and docstatus != 2", (cstr(self.doc.supplier) + " - " + self.get_company_abbr(),self.doc.supplier))		
+		#supp_detail = sql("select supplier_name,address from `tabSupplier` where name = %s", self.doc.supplier, as_dict =1)
+		#ret = {
+		#	'supplier_name' : supp_detail and supp_detail[0]['supplier_name'] or '',
+		#	'supplier_address': supp_detail and supp_detail[0]['address'] or ''
+		#}
+		ret = {}
+		if acc_head and acc_head[0][0]:
+			ret['credit_to'] = acc_head[0][0]
+			if not self.doc.due_date:
+				ret['due_date'] = add_days(cstr(self.doc.posting_date), acc_head and cint(acc_head[0][1]) or 0)
+		elif not acc_head:
+			msgprint("%s does not have an Account Head in %s. You must first create it from the Supplier Master" % (self.doc.supplier, self.doc.company))
+		return ret
+		
+	def get_cust(self):
+		ret = {}
+		if self.doc.credit_to:			
+			ret['supplier'] = get_value('Account',self.doc.credit_to,'master_name')
+			
+		return ret
+
+
+	# Get Default Cost Center and Expense Head from Item Master
+	# ----------------------------------------------------------
+	def get_default_values(self,args):
+		import json
+		args = json.loads(args)
+		ret = {}
+		if sql("select name from `tabItem` where name = '%s'" % args['item_code']):
+			if not args['expense_head'] or args['expense_head'] == 'undefined':
+				expense_head = sql("select name from `tabAccount` where account_name in (select purchase_account from `tabItem` where name = '%s')" % args['item_code'])
+				ret['expense_head'] = expense_head and expense_head[0][0] or ''
+			if not args['cost_center'] or args['cost_center'] == 'undefined':
+				cost_center = sql("select cost_center from `tabItem` where name = '%s'" % args['item_code'])
+				ret['cost_center'] = cost_center and cost_center[0][0] or ''
+		return ret
+		 
+		
+	# Get Items based on PO or PR
+	# ----------------------------
+	def pull_details(self):
+		if self.doc.purchase_receipt_main:
+			self.validate_duplicate_docname('purchase_receipt')
+			self.doclist = get_obj('DocType Mapper', 'Purchase Receipt-Purchase Invoice').dt_map('Purchase Receipt', 'Purchase Invoice', self.doc.purchase_receipt_main, self.doc, self.doclist, "[['Purchase Receipt', 'Purchase Invoice'], ['Purchase Receipt Item', 'Purchase Invoice Item'], ['Purchase Taxes and Charges','Purchase Taxes and Charges']]")
+
+		elif self.doc.purchase_order_main:
+			self.validate_duplicate_docname('purchase_order')
+			self.doclist = get_obj('DocType Mapper', 'Purchase Order-Purchase Invoice').dt_map('Purchase Order', 'Purchase Invoice', self.doc.purchase_order_main, self.doc, self.doclist, "[['Purchase Order', 'Purchase Invoice'],['Purchase Order Item', 'Purchase Invoice Item'], ['Purchase Taxes and Charges','Purchase Taxes and Charges']]")
+		
+		ret = self.get_credit_to()
+
+		if ret.has_key('credit_to'):
+			self.doc.credit_to = ret['credit_to']
+			
+
+	# Get Item Details
+	# -----------------		
+	def get_item_details(self, arg=None):
+		if arg:
+			return self.get_pv_details(arg)
+		else:
+			for doc in self.doclist:
+				if doc.fields.get('item_code'):
+					ret = self.get_pv_details(doc.item_code)
+					for r in ret:
+						if not doc.fields.get(r):
+							doc.fields[r] = ret[r]
+
+
+	def get_pv_details(self, arg):
+		import json
+		item_det = sql("select item_name, brand, description, item_group,purchase_account,cost_center, last_purchase_rate from tabItem where name=%s",arg,as_dict=1)
+		lpr = item_det and flt(item_det[0]['last_purchase_rate']) or 0
+		import_lpr = lpr / flt(self.doc.conversion_rate) or 1
+
+		tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , arg)
+		t = {}
+		for x in tax: t[x[0]] = flt(x[1])
+		ret = {
+			'item_name' : item_det and item_det[0]['item_name'] or '',
+			'brand' : item_det and item_det[0]['brand'] or '',
+			'description' : item_det and item_det[0]['description'] or '',
+			'item_group'	: item_det and item_det[0]['item_group'] or '',
+			'rate' : lpr,
+			'purchase_ref_rate' : lpr,
+			'import_ref_rate' : import_lpr,
+			'import_rate' : import_lpr,
+			'qty' : 0.00,
+			'amount' : 0.00,
+			'expense_head' : item_det and item_det[0]['purchase_account'] or '',
+			'cost_center' : item_det and item_det[0]['cost_center'] or '',
+			'item_tax_rate'			: json.dumps(t)
+		}
+
+		return ret
+
+
+		
+	# Advance Allocation
+	# -------------------
+	def get_advances(self):
+		get_obj('GL Control').get_advances( self, self.doc.credit_to, 'Purchase Invoice Advance','advance_allocation_details','debit')
+		
+		
+	# ============= OTHER CHARGES ====================
+	
+	# Get Tax rate if account type is TAX
+	# ------------------------------------
+	def get_rate(self,arg):
+		return get_obj('Purchase Common').get_rate(arg,self)
+
+	# Get Purchase Taxes and Charges Master
+	# -----------------------------------------------------------
+	def get_purchase_tax_details(self):
+		return get_obj('Purchase Common').get_purchase_tax_details(self)
+
+
+	def get_rate1(self,acc):
+		rate = sql("select tax_rate from `tabAccount` where name='%s'"%(acc))
+		ret={'add_tax_rate' :rate and flt(rate[0][0]) or 0 }
+		return ret
+
+
+
+# *************************** Server Utility Functions *****************************
+	# Get Company abbr
+	# -----------------
+	def get_company_abbr(self):
+		return sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
+
+	# Check whether PO or PR is already fetched
+	# ------------------------------------------
+	def validate_duplicate_docname(self,doctype):
+		for d in getlist(self.doclist, 'entries'): 
+			if doctype == 'purchase_receipt' and cstr(self.doc.purchase_receipt_main) == cstr(d.purchase_receipt):
+				msgprint(cstr(self.doc.purchase_receipt_main) + " purchase receipt details have already been pulled.")
+				raise Exception , " Validation Error. "
+
+			if doctype == 'purchase_order' and cstr(self.doc.purchase_order_main) == cstr(d.purchase_order) and not d.purchase_receipt:
+				msgprint(cstr(self.doc.purchase_order_main) + " purchase order details have already been pulled.")
+				raise Exception , " Validation Error. "
+
+		
+# **************************** VALIDATE ********************************
+
+	# Check for Item.is_Purchase_item = 'Yes' and Item is active
+	# ------------------------------------------------------------------
+	def check_active_purchase_items(self):
+		for d in getlist(self.doclist, 'entries'):
+			if d.item_code:		# extra condn coz item_code is not mandatory in PV
+				valid_item = sql("select docstatus,is_purchase_item from tabItem where name = %s",d.item_code)
+				if valid_item[0][0] == 2:
+					msgprint("Item : '%s' is Inactive, you can restore it from Trash" %(d.item_code))
+					raise Exception
+				if not valid_item[0][1] == 'Yes':
+					msgprint("Item : '%s' is not Purchase Item"%(d.item_code))
+					raise Exception
+						
+	# Check Conversion Rate
+	# ----------------------
+	def check_conversion_rate(self):
+		default_currency = TransactionBase().get_company_currency(self.doc.company)		
+		if not default_currency:
+			msgprint('Message: Please enter default currency in Company Master')
+			raise Exception
+		if (self.doc.currency == default_currency and flt(self.doc.conversion_rate) != 1.00) or not self.doc.conversion_rate or (self.doc.currency != default_currency and flt(self.doc.conversion_rate) == 1.00):
+			msgprint("Message: Please Enter Appropriate Conversion Rate.")
+			raise Exception				
+
+	# 1. Check whether bill is already booked against this bill no. or not
+	# 2. Add Remarks
+	# ---------------------------------------------------------------------
+	def validate_bill_no(self):
+		if self.doc.bill_no and self.doc.bill_no.lower().strip()	not in ['na', 'not applicable', 'none']:
+			b_no = sql("select bill_no, name, ifnull(is_opening,'') from `tabPurchase Invoice` where bill_no = '%s' and credit_to = '%s' and docstatus = 1 and name != '%s' " % (self.doc.bill_no, self.doc.credit_to, self.doc.name))
+			if b_no and cstr(b_no[0][2]) == cstr(self.doc.is_opening):
+				msgprint("Please check you have already booked expense against Bill No. %s in Purchase Invoice %s" % (cstr(b_no[0][0]), cstr(b_no[0][1])))
+				raise Exception , "Validation Error"
+			if not self.doc.remarks:
+				self.doc.remarks = (self.doc.remarks or '') + "\n" + ("Against Bill %s dated %s" % (self.doc.bill_no, formatdate(self.doc.bill_date)))
+				if self.doc.ded_amount:
+					self.doc.remarks = (self.doc.remarks or '') + "\n" + ("Grand Total: %s, Tax Deduction Amount: %s" %(self.doc.grand_total, self.doc.ded_amount))
+		else:
+			if not self.doc.remarks:
+				self.doc.remarks = "No Remarks"
+					
+	# Validate Bill No Date
+	# ---------------------
+	def validate_bill_no_date(self):
+		if self.doc.bill_no and not self.doc.bill_date and self.doc.bill_no.lower().strip() not in ['na', 'not applicable', 'none']:
+			msgprint("Please enter Bill Date")
+			raise Exception					
+
+
+ 
+	# Clear Advances
+	# ---------------
+	def clear_advances(self):
+		get_obj('GL Control').clear_advances( self, 'Purchase Invoice Advance','advance_allocation_details')
+
+
+	# 1. Credit To Account Exists
+	# 2. Is a Credit Account
+	# 3. Is not a PL Account
+	# ----------------------------
+	def validate_credit_acc(self):
+		acc = sql("select debit_or_credit, is_pl_account from tabAccount where name = '%s'" % self.doc.credit_to)
+		if not acc:
+			msgprint("Account: "+ self.doc.credit_to + "does not exist")
+			raise Exception
+		elif acc[0][0] and acc[0][0] != 'Credit':
+			msgprint("Account: "+ self.doc.credit_to + "is not a credit account")
+			raise Exception
+		elif acc[0][1] and acc[0][1] != 'No':
+			msgprint("Account: "+ self.doc.credit_to + "is a pl account")
+			raise Exception
+	
+	# Validate Acc Head of Supplier and Credit To Account entered
+	# ------------------------------------------------------------
+	def check_for_acc_head_of_supplier(self): 
+		if self.doc.supplier and self.doc.credit_to:
+			acc_head = sql("select master_name from `tabAccount` where name = %s", self.doc.credit_to)
+			
+			if (acc_head and cstr(acc_head[0][0]) != cstr(self.doc.supplier)) or (not acc_head and (self.doc.credit_to != cstr(self.doc.supplier) + " - " + self.get_company_abbr())):
+				msgprint("Credit To: %s do not match with Supplier: %s for Company: %s.\n If both correctly entered, please select Master Type and Master Name in account master." %(self.doc.credit_to,self.doc.supplier,self.doc.company), raise_exception=1)
+				
+	# Check for Stopped PO
+	# ---------------------
+	def check_for_stopped_status(self):
+		check_list = []
+		for d in getlist(self.doclist,'entries'):
+			if d.purchase_order and not d.purchase_order in check_list and not d.purchase_receipt:
+				check_list.append(d.purhcase_order)
+				stopped = sql("select name from `tabPurchase Order` where status = 'Stopped' and name = '%s'" % d.purchase_order)
+				if stopped:
+					msgprint("One cannot do any transaction against 'Purchase Order' : %s, it's status is 'Stopped'" % (d.purhcase_order))
+					raise Exception
+					
+	# Validate Supplier
+	# -----------------
+	def validate_supplier(self, d):
+		supplier = ''
+		if d.purchase_order and not d.purchase_order in self.po_list:
+			supplier = sql("select supplier from `tabPurchase Order` where name = '%s'" % d.purchase_order)[0][0]
+			doctype = 'purchase order'
+			doctype_no = cstr(d.purchase_order)
+			if supplier and not cstr(self.doc.supplier) == cstr(supplier):
+				msgprint("Supplier name %s do not match with supplier name	of %s %s." %(self.doc.supplier,doctype,doctype_no))
+				raise Exception , " Validation Error "
+
+		if d.purchase_receipt and not d.purchase_receipt in self.pr_list:
+			supplier = sql("select supplier from `tabPurchase Receipt` where name = '%s'" % d.purchase_receipt)[0][0]
+			doctype = 'purchase receipt'
+			doctype_no = cstr(d.purchase_receipt)
+			if supplier and not cstr(self.doc.supplier) == cstr(supplier):
+				msgprint("Supplier name %s do not match with supplier name	of %s %s." %(self.doc.supplier,doctype,doctype_no))
+				raise Exception , " Validation Error "
+
+	# Validate values with reference document
+	#----------------------------------------
+	def validate_reference_value(self):
+		get_obj('DocType Mapper', 'Purchase Order-Purchase Invoice', with_children = 1).validate_reference_value(self, self.doc.name)
+
+				
+	# Validate PO and PR
+	# -------------------
+	def validate_po_pr(self, d):
+		# check po / pr for qty and rates and currency and conversion rate
+
+		# always import_rate must be equal to import_rate of purchase order
+		if d.purchase_order and not d.purchase_order in self.po_list:
+			# currency
+			currency = cstr(sql("select currency from `tabPurchase Order` where name = '%s'" % d.purchase_order)[0][0])
+			if not cstr(currency) == cstr(self.doc.currency):
+				msgprint("Purchase Order: " + cstr(d.purchase_order) + " currency : " + cstr(currency) + " does not match with currency of current document.")
+				raise Exception
+			# import_rate
+			rate = flt(sql('select import_rate from `tabPurchase Order Item` where item_code=%s and parent=%s and name = %s', (d.item_code, d.purchase_order, d.po_detail))[0][0])
+			if abs(rate - flt(d.import_rate)) > 1:
+				msgprint("Import Rate for %s in the Purchase Order is %s. Rate must be same as Purchase Order Rate" % (d.item_code,rate))
+				raise Exception
+									
+		if d.purchase_receipt and not d.purchase_receipt in self.pr_list:
+			# currency , conversion_rate
+			data = sql("select currency, conversion_rate from `tabPurchase Receipt` where name = '%s'" % d.purchase_receipt, as_dict = 1)
+			if not cstr(data[0]['currency']) == cstr(self.doc.currency):
+				msgprint("Purchase Receipt: " + cstr(d.purchase_receipt) + " currency : " + cstr(data[0]['currency']) + " does not match with currency of current document.")
+				raise Exception
+			if not flt(data[0]['conversion_rate']) == flt(self.doc.conversion_rate):
+				msgprint("Purchase Receipt: " + cstr(d.purchase_receipt) + " conversion_rate : " + cstr(data[0]['conversion_rate']) + " does not match with conversion_rate of current document.")
+				raise Exception
+					
+	# Build tds table if applicable
+	#------------------------------
+	def get_tds(self):
+		if cstr(self.doc.is_opening) != 'Yes':
+			if not self.doc.credit_to:
+				msgprint("Please Enter Credit To account first")
+				raise Exception
+			else:
+				tds_applicable = sql("select tds_applicable from tabAccount where name = '%s'" % self.doc.credit_to)
+				if tds_applicable and cstr(tds_applicable[0][0]) == 'Yes':
+					if not self.doc.tds_applicable:
+						msgprint("Please enter whether TDS Applicable or not")
+						raise Exception
+					if self.doc.tds_applicable == 'Yes':
+						if not self.doc.tds_category:
+							msgprint("Please select TDS Category")
+							raise Exception
+						else:
+							get_obj('TDS Control').get_tds_amount(self)
+							self.doc.total_tds_on_voucher = self.doc.ded_amount
+							self.doc.total_amount_to_pay=flt(self.doc.grand_total)-flt(self.doc.ded_amount)-flt(self.doc.other_tax_deducted)
+					elif self.doc.tds_applicable == 'No':
+						self.doc.tds_category = ''
+						self.doc.tax_code = ''
+						self.doc.rate = 0
+						self.doc.ded_amount = 0
+						self.doc.total_tds_on_voucher = 0
+
+	# get tds rate
+	# -------------
+	def get_tds_rate(self):
+		return {'rate' : flt(get_value('Account', self.doc.tax_code, 'tax_rate'))}
+
+	# set aging date
+	#-------------------
+	def set_aging_date(self):
+		if self.doc.is_opening != 'Yes':
+			self.doc.aging_date = self.doc.posting_date
+		elif not self.doc.aging_date:
+			msgprint("Aging Date is mandatory for opening entry")
+			raise Exception
+			
+
+	# Set against account for debit to account
+	#------------------------------------------
+	def set_against_expense_account(self):
+		against_acc = []
+		for d in getlist(self.doclist, 'entries'):
+			if d.expense_account not in against_acc:
+				against_acc.append(d.expense_account)
+		self.doc.against_expense_account = ','.join(against_acc)
+
+	#check in manage account if purchase order required or not.
+	# ====================================================================================
+	def po_required(self):
+		res = sql("select value from `tabSingles` where doctype = 'Global Defaults' and field = 'po_required'")
+		if res and res[0][0] == 'Yes':
+			 for d in getlist(self.doclist,'entries'):
+				 if not d.purchase_order:
+					 msgprint("Purchse Order No. required against item %s"%d.item_code)
+					 raise Exception
+
+	#check in manage account if purchase receipt required or not.
+	# ====================================================================================
+	def pr_required(self):
+		res = sql("select value from `tabSingles` where doctype = 'Global Defaults' and field = 'pr_required'")
+		if res and res[0][0] == 'Yes':
+			 for d in getlist(self.doclist,'entries'):
+				 if not d.purchase_receipt:
+					 msgprint("Purchase Receipt No. required against item %s"%d.item_code)
+					 raise Exception
+
+	# VALIDATE
+	# ====================================================================================
+	def validate(self):
+		self.po_required()
+		self.pr_required()
+		self.check_active_purchase_items()
+		self.check_conversion_rate()
+		self.validate_bill_no_date()
+		self.validate_bill_no()
+		self.validate_reference_value()
+		self.clear_advances()
+		self.validate_credit_acc()
+		self.check_for_acc_head_of_supplier()
+		self.check_for_stopped_status()
+
+		self.po_list, self.pr_list = [], []
+		for d in getlist(self.doclist, 'entries'):
+			self.validate_supplier(d)
+			self.validate_po_pr(d)
+			if not d.purchase_order in self.po_list:
+				self.po_list.append(d.purchase_order)
+			if not d.purhcase_receipt in self.pr_list:
+				self.pr_list.append(d.purchase_receipt)
+		# tds
+		get_obj('TDS Control').validate_first_entry(self)
+		if not flt(self.doc.ded_amount):
+			self.get_tds()
+			self.doc.save()
+
+		if not self.doc.is_opening:
+			self.doc.is_opening = 'No'
+
+		self.set_aging_date()
+
+		#set against account for credit to
+		self.set_against_expense_account()
+
+		#FY validation
+		get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
+		
+		#get Purchase Common Obj
+		pc_obj = get_obj(dt='Purchase Common')
+		
+		 # get total in words
+		self.doc.in_words = pc_obj.get_total_in_words('Rs', self.doc.grand_total)
+		self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
+# ***************************** SUBMIT *****************************
+	# Check Ref Document docstatus
+	# -----------------------------
+	def check_prev_docstatus(self):
+		for d in getlist(self.doclist,'entries'):
+			if d.purchase_order:
+				submitted = sql("select name from `tabPurchase Order` where docstatus = 1 and name = '%s'" % d.purchase_order)
+				if not submitted:
+					msgprint("Purchase Order : "+ cstr(d.purchase_order) +" is not submitted")
+					raise Exception , "Validation Error."
+			if d.purchase_receipt:
+				submitted = sql("select name from `tabPurchase Receipt` where docstatus = 1 and name = '%s'" % d.purchase_receipt)
+				if not submitted:
+					msgprint("Purchase Receipt : "+ cstr(d.purchase_receipt) +" is not submitted")
+					raise Exception , "Validation Error."
+					
+					
+	#--------------------------------------------------------------------
+	def update_against_document_in_jv(self):
+		"""
+			Links invoice and advance voucher:
+				1. cancel advance voucher
+				2. split into multiple rows if partially adjusted, assign against voucher
+				3. submit advance voucher
+		"""
+		
+		lst = []
+		for d in getlist(self.doclist, 'advance_allocation_details'):
+			if flt(d.allocated_amount) > 0:
+				args = {
+					'voucher_no' : d.journal_voucher, 
+					'voucher_detail_no' : d.jv_detail_no, 
+					'against_voucher_type' : 'Purchase Invoice', 
+					'against_voucher'  : self.doc.name,
+					'account' : self.doc.credit_to, 
+					'is_advance' : 'Yes', 
+					'dr_or_cr' : 'debit', 
+					'unadjusted_amt' : flt(d.advance_amount),
+					'allocated_amt' : flt(d.allocated_amount)
+				}
+				lst.append(args)
+		
+		if lst:
+			get_obj('GL Control').reconcile_against_document(lst)
+
+	# On Submit
+	#--------------------------------------------------------------------
+	def on_submit(self):
+		self.check_prev_docstatus()
+		
+		# Check for Approving Authority
+		get_obj('Authorization Control').validate_approving_authority(self.doc.doctype,self.doc.company, self.doc.grand_total)
+		
+		
+		# this sequence because outstanding may get -negative
+		get_obj(dt='GL Control').make_gl_entries(self.doc, self.doclist)
+		
+		self.update_against_document_in_jv()
+		
+		get_obj(dt = 'Purchase Common').update_prevdoc_detail(self, is_submit = 1)
+
+
+
+# ********************************* CANCEL *********************************
+	# Check Next Document's docstatus
+	# --------------------------------
+	def check_next_docstatus(self):
+		submit_jv = sql("select t1.name from `tabJournal Voucher` t1,`tabJournal Voucher Detail` t2 where t1.name = t2.parent and t2.against_voucher = '%s' and t1.docstatus = 1" % (self.doc.name))
+		if submit_jv:
+			msgprint("Journal Voucher : " + cstr(submit_jv[0][0]) + " has been created against " + cstr(self.doc.doctype) + ". So " + cstr(self.doc.doctype) + " cannot be Cancelled.")
+			raise Exception, "Validation Error."
+		
+	# On Cancel
+	# ----------
+	def on_cancel(self):
+		self.check_next_docstatus()
+
+		# Check whether tds payment voucher has been created against this voucher
+		self.check_tds_payment_voucher()
+		
+		get_obj(dt='GL Control').make_gl_entries(self.doc, self.doclist, cancel=1)
+		get_obj(dt = 'Purchase Common').update_prevdoc_detail(self, is_submit = 0)
+
+
+	# Check whether tds payment voucher has been created against this voucher
+	#---------------------------------------------------------------------------
+	def check_tds_payment_voucher(self):
+		tdsp =	sql("select parent from `tabTDS Payment Detail` where voucher_no = '%s' and docstatus = 1 and parent not like 'old%'")
+		if tdsp:
+			msgprint("TDS Payment voucher '%s' has been made against this voucher. Please cancel the payment voucher to proceed." % (tdsp and tdsp[0][0] or ''))
+			raise Exception
+
+	# on update
+	def on_update(self):
+		pass
+		
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt
new file mode 100755
index 0000000..524fa07
--- /dev/null
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt
@@ -0,0 +1,1131 @@
+# DocType, Purchase Invoice
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-04-11 13:17:19',
+		'docstatus': 0,
+		'modified': '2012-04-12 18:09:05',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': u'1330345793',
+		'allow_attach': 1,
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'is_submittable': 1,
+		'module': u'Accounts',
+		'name': '__common__',
+		'read_only_onload': 1,
+		'search_fields': u'posting_date, credit_to, fiscal_year, bill_no, grand_total, outstanding_amount',
+		'section_style': u'Tabbed',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'subject': u'From %(supplier_name)s worth %(grand_total)s due on %(due_date)s | %(outstanding_amount)s outstanding',
+		'version': 522
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Purchase Invoice',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Purchase Invoice',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1
+	},
+
+	# DocType, Purchase Invoice
+	{
+		'doctype': 'DocType',
+		'name': u'Purchase Invoice'
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Accounts Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Accounts Manager',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Accounts User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Purchase User'
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Purchase User',
+		'submit': 0,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Accounts User',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'match': u'supplier',
+		'permlevel': 0,
+		'role': u'Supplier'
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 0,
+		'doctype': u'DocField',
+		'fieldname': u'basic_info',
+		'fieldtype': u'Section Break',
+		'label': u'Basic Info',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'To manage multiple series please go to Setup > Manage Series',
+		'doctype': u'DocField',
+		'fieldname': u'naming_series',
+		'fieldtype': u'Select',
+		'label': u'Series',
+		'no_copy': 1,
+		'oldfieldname': u'naming_series',
+		'oldfieldtype': u'Select',
+		'options': u'BILL\nBILLJ',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'description': u'The account to which you will pay (have paid) the money to.',
+		'doctype': u'DocField',
+		'fieldname': u'credit_to',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Credit To',
+		'oldfieldname': u'credit_to',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Link',
+		'label': u'Amended From',
+		'no_copy': 1,
+		'oldfieldname': u'amended_from',
+		'oldfieldtype': u'Link',
+		'options': u'Purchase Invoice',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'supplier',
+		'fieldtype': u'Link',
+		'hidden': 0,
+		'label': u'Supplier',
+		'oldfieldname': u'supplier',
+		'oldfieldtype': u'Link',
+		'options': u'Supplier',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'supplier_address',
+		'fieldtype': u'Link',
+		'label': u'Supplier Address',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'contact_person',
+		'fieldtype': u'Link',
+		'label': u'Contact Person',
+		'options': u'Contact',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'supplier_name',
+		'fieldtype': u'Text',
+		'label': u'Name',
+		'oldfieldname': u'supplier_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'address_display',
+		'fieldtype': u'Small Text',
+		'label': u'Address',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'contact_display',
+		'fieldtype': u'Small Text',
+		'label': u'Contact',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'contact_mobile',
+		'fieldtype': u'Text',
+		'label': u'Mobile No',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'contact_email',
+		'fieldtype': u'Text',
+		'label': u'Contact Email',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'reqd': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'default': u'Today',
+		'description': u'The date at which current entry will get or has actually executed.',
+		'doctype': u'DocField',
+		'fieldname': u'posting_date',
+		'fieldtype': u'Date',
+		'in_filter': 1,
+		'label': u'Posting Date',
+		'no_copy': 0,
+		'oldfieldname': u'posting_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'due_date',
+		'fieldtype': u'Date',
+		'in_filter': 1,
+		'label': u'Due Date',
+		'no_copy': 0,
+		'oldfieldname': u'due_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'print_hide': 0,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'description': u'If not applicable please enter: NA',
+		'doctype': u'DocField',
+		'fieldname': u'bill_no',
+		'fieldtype': u'Data',
+		'in_filter': 1,
+		'label': u'Bill No',
+		'oldfieldname': u'bill_no',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'bill_date',
+		'fieldtype': u'Date',
+		'in_filter': 1,
+		'label': u'Bill Date',
+		'oldfieldname': u'bill_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 0,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'description': u'The date at which current entry is corrected in the system.',
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
+		'label': u'Amendment Date',
+		'no_copy': 1,
+		'oldfieldname': u'amendment_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'mode_of_payment',
+		'fieldtype': u'Select',
+		'label': u'Mode of Payment',
+		'oldfieldname': u'mode_of_payment',
+		'oldfieldtype': u'Select',
+		'options': u'link:Mode of Payment',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'items',
+		'fieldtype': u'Section Break',
+		'label': u'Items',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'currency',
+		'fieldtype': u'Select',
+		'label': u'Bill Currency',
+		'oldfieldname': u'currency',
+		'oldfieldtype': u'Select',
+		'options': u'link:Currency',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'1',
+		'description': u"The rate at which Bill Currency is converted into company's base currency",
+		'doctype': u'DocField',
+		'fieldname': u'conversion_rate',
+		'fieldtype': u'Currency',
+		'label': u'Bill Conversion Rate',
+		'oldfieldname': u'conversion_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break2',
+		'fieldtype': u'Column Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Select Items from Purchase Order',
+		'doctype': u'DocField',
+		'fieldname': u'purchase_order_main',
+		'fieldtype': u'Link',
+		'label': u'Purchase Order',
+		'oldfieldname': u'purchase_order_main',
+		'oldfieldtype': u'Link',
+		'options': u'Purchase Order',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Select Items from Purchase Receipt',
+		'doctype': u'DocField',
+		'fieldname': u'purchase_receipt_main',
+		'fieldtype': u'Link',
+		'label': u'Purchase Receipt',
+		'oldfieldname': u'purchase_receipt_main',
+		'oldfieldtype': u'Link',
+		'options': u'Purchase Receipt',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'get_items',
+		'fieldtype': u'Button',
+		'label': u'Get Items',
+		'oldfieldtype': u'Button',
+		'options': u'pull_details',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'section_break0',
+		'fieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'doctype': u'DocField',
+		'fieldname': u'entries',
+		'fieldtype': u'Table',
+		'label': u'Entries',
+		'oldfieldname': u'entries',
+		'oldfieldtype': u'Table',
+		'options': u'Purchase Invoice Item',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'recalculate',
+		'fieldtype': u'Button',
+		'label': u'Recalculate',
+		'oldfieldtype': u'Button',
+		'permlevel': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'description': u'Will be calculated automatically when you enter the details',
+		'doctype': u'DocField',
+		'fieldname': u'net_total',
+		'fieldtype': u'Currency',
+		'label': u'Net Total',
+		'oldfieldname': u'net_total',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Add / Edit Taxes and Charges',
+		'doctype': u'DocField',
+		'fieldname': u'taxes',
+		'fieldtype': u'Section Break',
+		'label': u'Taxes',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'purchase_other_charges',
+		'fieldtype': u'Link',
+		'label': u'Purchase Taxes and Charges',
+		'oldfieldname': u'purchase_other_charges',
+		'oldfieldtype': u'Link',
+		'options': u'Purchase Taxes and Charges Master',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'get_tax_detail',
+		'fieldtype': u'Button',
+		'label': u'Get Tax Detail',
+		'oldfieldtype': u'Button',
+		'options': u'get_purchase_tax_details',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'purchase_tax_details',
+		'fieldtype': u'Table',
+		'label': u'Purchase Taxes and Charges',
+		'oldfieldname': u'purchase_tax_details',
+		'oldfieldtype': u'Table',
+		'options': u'Purchase Taxes and Charges',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'calculate_tax',
+		'fieldtype': u'Button',
+		'label': u'Calculate Tax',
+		'oldfieldtype': u'Button',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'tax_calculation',
+		'fieldtype': u'HTML',
+		'label': u'Tax Calculation',
+		'oldfieldtype': u'HTML',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'total_tax',
+		'fieldtype': u'Currency',
+		'label': u'Total Tax',
+		'oldfieldname': u'total_tax',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'more_info',
+		'fieldtype': u'Section Break',
+		'label': u'More Info',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break3',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'print_hide': 1,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'No',
+		'doctype': u'DocField',
+		'fieldname': u'is_opening',
+		'fieldtype': u'Select',
+		'in_filter': 1,
+		'label': u'Is Opening',
+		'oldfieldname': u'is_opening',
+		'oldfieldtype': u'Select',
+		'options': u'No\nYes',
+		'permlevel': 0,
+		'print_hide': 1,
+		'search_index': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'aging_date',
+		'fieldtype': u'Date',
+		'label': u'Aging Date',
+		'oldfieldname': u'aging_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'print_hide': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'select_print_heading',
+		'fieldtype': u'Link',
+		'label': u'Select Print Heading',
+		'no_copy': 1,
+		'oldfieldname': u'select_print_heading',
+		'oldfieldtype': u'Link',
+		'options': u'Print Heading',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break4',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'print_hide': 1,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Company',
+		'oldfieldname': u'company',
+		'oldfieldtype': u'Link',
+		'options': u'Company',
+		'permlevel': 0,
+		'print_hide': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
+		'in_filter': 1,
+		'label': u'Fiscal Year',
+		'oldfieldname': u'fiscal_year',
+		'oldfieldtype': u'Select',
+		'options': u'link:Fiscal Year',
+		'permlevel': 0,
+		'print_hide': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'cancel_reason',
+		'fieldtype': u'Data',
+		'label': u'Cancel Reason',
+		'no_copy': 1,
+		'oldfieldname': u'cancel_reason',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'remarks',
+		'fieldtype': u'Small Text',
+		'label': u'Remarks',
+		'no_copy': 1,
+		'oldfieldname': u'remarks',
+		'oldfieldtype': u'Text',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'advances',
+		'fieldtype': u'Section Break',
+		'label': u'Advances',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'get_advances_paid',
+		'fieldtype': u'Button',
+		'label': u'Get Advances Paid',
+		'oldfieldtype': u'Button',
+		'options': u'get_advances',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'advance_allocation_details',
+		'fieldtype': u'Table',
+		'label': u'Purchase Invoice Advances',
+		'no_copy': 1,
+		'oldfieldname': u'advance_allocation_details',
+		'oldfieldtype': u'Table',
+		'options': u'Purchase Invoice Advance',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'tds',
+		'fieldtype': u'Section Break',
+		'label': u'TDS',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break5',
+		'fieldtype': u'Column Break',
+		'permlevel': 0,
+		'print_hide': 1,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'tds_applicable',
+		'fieldtype': u'Select',
+		'label': u'TDS Applicable',
+		'oldfieldname': u'tds_applicable',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'tds_category',
+		'fieldtype': u'Select',
+		'label': u'TDS Category',
+		'oldfieldname': u'tds_category',
+		'oldfieldtype': u'Select',
+		'options': u'link:TDS Category',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'get_tds',
+		'fieldtype': u'Button',
+		'label': u'Get TDS',
+		'oldfieldtype': u'Button',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break6',
+		'fieldtype': u'Column Break',
+		'permlevel': 0,
+		'print_hide': 1,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'tax_code',
+		'fieldtype': u'Link',
+		'label': u'TDS Account Head',
+		'oldfieldname': u'tax_code',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'rate',
+		'fieldtype': u'Currency',
+		'label': u'Rate',
+		'oldfieldname': u'rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'ded_amount',
+		'fieldtype': u'Currency',
+		'label': u'TDS Amount',
+		'oldfieldname': u'ded_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'totals',
+		'fieldtype': u'Section Break',
+		'label': u'Totals',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break7',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'print_hide': 1,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'other_charges_added',
+		'fieldtype': u'Currency',
+		'label': u'Taxes and Charges Added',
+		'oldfieldname': u'other_charges_added',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'other_charges_deducted',
+		'fieldtype': u'Currency',
+		'label': u'Taxes and Charges Deducted',
+		'oldfieldname': u'other_charges_deducted',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'total_tds_on_voucher',
+		'fieldtype': u'Currency',
+		'label': u'Total TDS On Voucher',
+		'no_copy': 1,
+		'oldfieldname': u'total_tds_on_voucher',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'tds_amount_on_advance',
+		'fieldtype': u'Currency',
+		'label': u'TDS Amount On Advance',
+		'no_copy': 1,
+		'oldfieldname': u'tds_amount_on_advance',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'total_advance',
+		'fieldtype': u'Currency',
+		'label': u'Total Advance (Incl. TDS)',
+		'no_copy': 1,
+		'oldfieldname': u'total_advance',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'total_amount_to_pay',
+		'fieldtype': u'Currency',
+		'hidden': 0,
+		'label': u'Total Amount To Pay',
+		'no_copy': 1,
+		'oldfieldname': u'total_amount_to_pay',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'outstanding_amount',
+		'fieldtype': u'Currency',
+		'in_filter': 1,
+		'label': u'Outstanding Amount',
+		'no_copy': 1,
+		'oldfieldname': u'outstanding_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break8',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'print_hide': 1,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'grand_total',
+		'fieldtype': u'Currency',
+		'label': u'Grand Total',
+		'oldfieldname': u'grand_total',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'In Words will be visible once you save the Purchase Invoice.',
+		'doctype': u'DocField',
+		'fieldname': u'in_words',
+		'fieldtype': u'Data',
+		'label': u'In Words',
+		'oldfieldname': u'in_words',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'net_total_import',
+		'fieldtype': u'Currency',
+		'label': u'Net Total (Import)',
+		'oldfieldname': u'net_total_import',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'other_charges_added_import',
+		'fieldtype': u'Currency',
+		'label': u'Taxes and Charges Added (Import)',
+		'oldfieldname': u'other_charges_added_import',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'other_charges_deducted_import',
+		'fieldtype': u'Currency',
+		'label': u'Taxes and Charges Deducted (Import)',
+		'oldfieldname': u'other_charges_deducted_import',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'grand_total_import',
+		'fieldtype': u'Currency',
+		'label': u'Grand Total (Import)',
+		'oldfieldname': u'grand_total_import',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'in_words_import',
+		'fieldtype': u'Data',
+		'label': u'In Words (Import)',
+		'oldfieldname': u'in_words_import',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'against_expense_account',
+		'fieldtype': u'Small Text',
+		'hidden': 1,
+		'label': u'Against Expense Account',
+		'no_copy': 1,
+		'oldfieldname': u'against_expense_account',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
+		'hidden': 1,
+		'label': u'File List',
+		'no_copy': 1,
+		'permlevel': 0,
+		'print_hide': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/purchase_tax_detail/__init__.py b/erpnext/accounts/doctype/purchase_invoice_advance/__init__.py
similarity index 100%
copy from erpnext/accounts/doctype/purchase_tax_detail/__init__.py
copy to erpnext/accounts/doctype/purchase_invoice_advance/__init__.py
diff --git a/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.txt b/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.txt
new file mode 100644
index 0000000..586ae1c
--- /dev/null
+++ b/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.txt
@@ -0,0 +1,134 @@
+# DocType, Purchase Invoice Advance
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:40',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:40',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Accounts',
+		'name': '__common__',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 20
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Purchase Invoice Advance',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Purchase Invoice Advance
+	{
+		'doctype': 'DocType',
+		'name': u'Purchase Invoice Advance'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'journal_voucher',
+		'fieldtype': u'Link',
+		'label': u'Journal Voucher',
+		'no_copy': 1,
+		'oldfieldname': u'journal_voucher',
+		'oldfieldtype': u'Link',
+		'options': u'Journal Voucher',
+		'permlevel': 1,
+		'width': u'180px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'jv_detail_no',
+		'fieldtype': u'Date',
+		'hidden': 1,
+		'label': u'Journal Voucher Detail No',
+		'no_copy': 1,
+		'oldfieldname': u'jv_detail_no',
+		'oldfieldtype': u'Date',
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'80px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'advance_amount',
+		'fieldtype': u'Currency',
+		'label': u'Advance Amount',
+		'no_copy': 1,
+		'oldfieldname': u'advance_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'allocated_amount',
+		'fieldtype': u'Currency',
+		'label': u'Allocated Amount',
+		'no_copy': 1,
+		'oldfieldname': u'allocated_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'tds_amount',
+		'fieldtype': u'Currency',
+		'label': u'TDS Amount',
+		'oldfieldname': u'tds_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'width': u'80px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'tds_allocated',
+		'fieldtype': u'Currency',
+		'label': u'TDS Allocated',
+		'oldfieldname': u'tds_allocated',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'width': u'80px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'remarks',
+		'fieldtype': u'Small Text',
+		'label': u'Remarks',
+		'no_copy': 1,
+		'oldfieldname': u'remarks',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 1,
+		'width': u'150px'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/purchase_tax_detail/__init__.py b/erpnext/accounts/doctype/purchase_invoice_item/__init__.py
similarity index 100%
copy from erpnext/accounts/doctype/purchase_tax_detail/__init__.py
copy to erpnext/accounts/doctype/purchase_invoice_item/__init__.py
diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt
new file mode 100755
index 0000000..236b75e
--- /dev/null
+++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt
@@ -0,0 +1,348 @@
+# DocType, Purchase Invoice Item
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:46',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:46',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'EVD.######',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Accounts',
+		'name': '__common__',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 46
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Purchase Invoice Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Purchase Invoice Item
+	{
+		'doctype': 'DocType',
+		'name': u'Purchase Invoice Item'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Item',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_name',
+		'fieldtype': u'Data',
+		'in_filter': 0,
+		'label': u'Item Name',
+		'oldfieldname': u'item_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Text',
+		'permlevel': 0,
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'qty',
+		'fieldtype': u'Currency',
+		'label': u'Qty',
+		'oldfieldname': u'qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 0,
+		'reqd': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'import_ref_rate',
+		'fieldtype': u'Currency',
+		'label': u'Ref Rate ',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'discount_rate',
+		'fieldtype': u'Currency',
+		'label': u'Discount %',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'import_rate',
+		'fieldtype': u'Currency',
+		'label': u'Rate ',
+		'oldfieldname': u'import_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 0,
+		'reqd': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'import_amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount',
+		'oldfieldname': u'import_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'purchase_ref_rate',
+		'fieldtype': u'Currency',
+		'label': u'Ref Rate *',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'rate',
+		'fieldtype': u'Currency',
+		'label': u'Rate *(Default Curr.)',
+		'oldfieldname': u'rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount (Default Curr.)',
+		'oldfieldname': u'amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'expense_head',
+		'fieldtype': u'Link',
+		'label': u'Expense Head',
+		'oldfieldname': u'expense_head',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'trigger': u'Client',
+		'width': u'120px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'cost_center',
+		'fieldtype': u'Link',
+		'label': u'Cost Center',
+		'oldfieldname': u'cost_center',
+		'oldfieldtype': u'Link',
+		'options': u'Cost Center',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client',
+		'width': u'120px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'project_name',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Project Name',
+		'options': u'Project',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'brand',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Brand',
+		'oldfieldname': u'brand',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_group',
+		'fieldtype': u'Link',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Item Group',
+		'oldfieldname': u'item_group',
+		'oldfieldtype': u'Link',
+		'options': u'Item Group',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'purchase_order',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Pur Order',
+		'oldfieldname': u'purchase_order',
+		'oldfieldtype': u'Link',
+		'options': u'Purchase Order',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'po_detail',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Purchase Order Item',
+		'oldfieldname': u'po_detail',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'purchase_receipt',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Pur Receipt',
+		'oldfieldname': u'purchase_receipt',
+		'oldfieldtype': u'Link',
+		'options': u'Purchase Receipt',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'pr_detail',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'PR Detail',
+		'oldfieldname': u'pr_detail',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'description': u'Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges',
+		'doctype': u'DocField',
+		'fieldname': u'item_tax_rate',
+		'fieldtype': u'Small Text',
+		'hidden': 1,
+		'label': u'Item Tax Rate',
+		'oldfieldname': u'item_tax_rate',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'doctype': u'DocField',
+		'fieldname': u'page_break',
+		'fieldtype': u'Check',
+		'label': u'Page Break',
+		'no_copy': 1,
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1
+	}
+]
diff --git a/erpnext/accounts/doctype/purchase_tax_detail/purchase_tax_detail.txt b/erpnext/accounts/doctype/purchase_tax_detail/purchase_tax_detail.txt
deleted file mode 100644
index 2c5dc07..0000000
--- a/erpnext/accounts/doctype/purchase_tax_detail/purchase_tax_detail.txt
+++ /dev/null
@@ -1,237 +0,0 @@
-# DocType, Purchase Tax Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:16',
-		'docstatus': 0,
-		'modified': '2012-02-27 18:28:24',
-		'modified_by': u'Administrator',
-		'owner': u'wasim@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': u'1322549700',
-		'autoname': u'PVTD.######',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'hide_heading': 1,
-		'istable': 1,
-		'module': u'Accounts',
-		'name': '__common__',
-		'section_style': u'Tray',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 13
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Purchase Tax Detail',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# DocType, Purchase Tax Detail
-	{
-		'doctype': 'DocType',
-		'name': u'Purchase Tax Detail'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'category',
-		'fieldtype': u'Select',
-		'label': u'Category',
-		'oldfieldname': u'category',
-		'oldfieldtype': u'Select',
-		'options': u'\nFor Total\nFor Valuation\nFor Both',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'default': u'Add',
-		'doctype': u'DocField',
-		'fieldname': u'add_deduct_tax',
-		'fieldtype': u'Select',
-		'label': u'Add or Deduct',
-		'oldfieldname': u'add_deduct_tax',
-		'oldfieldtype': u'Select',
-		'options': u'\nAdd\nDeduct',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'charge_type',
-		'fieldtype': u'Select',
-		'label': u'Type',
-		'oldfieldname': u'charge_type',
-		'oldfieldtype': u'Select',
-		'options': u'\nActual\nOn Net Total\nOn Previous Row Amount\nOn Previous Row Total',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'row_id',
-		'fieldtype': u'Data',
-		'hidden': 0,
-		'label': u'Enter Row',
-		'oldfieldname': u'row_id',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'item_wise_tax_detail',
-		'fieldtype': u'Small Text',
-		'hidden': 1,
-		'label': u'Item Wise Tax Detail ',
-		'oldfieldname': u'item_wise_tax_detail',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'description',
-		'fieldtype': u'Small Text',
-		'label': u'Description',
-		'oldfieldname': u'description',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 0,
-		'reqd': 1,
-		'width': u'300px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'account_head',
-		'fieldtype': u'Link',
-		'label': u'Account Head',
-		'oldfieldname': u'account_head',
-		'oldfieldtype': u'Link',
-		'options': u'Account',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'cost_center',
-		'fieldtype': u'Link',
-		'label': u'Cost Center',
-		'oldfieldname': u'cost_center',
-		'oldfieldtype': u'Link',
-		'options': u'Cost Center',
-		'permlevel': 0,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'rate',
-		'fieldtype': u'Currency',
-		'label': u'Rate',
-		'oldfieldname': u'rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'reqd': 0,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'tax_amount',
-		'fieldtype': u'Currency',
-		'label': u'Amount',
-		'oldfieldname': u'tax_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'reqd': 0,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'total',
-		'fieldtype': u'Currency',
-		'label': u'Aggregate Total',
-		'oldfieldname': u'total',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'parenttype',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'Parenttype',
-		'oldfieldname': u'parenttype',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'print_hide': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'description': u'Cheating Field\nPlease do not delete ',
-		'doctype': u'DocField',
-		'fieldname': u'total_tax_amount',
-		'fieldtype': u'Currency',
-		'hidden': 1,
-		'label': u'Total +Tax',
-		'no_copy': 1,
-		'oldfieldname': u'total_tax_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1
-	},
-
-	# DocField
-	{
-		'description': u'Cheating Field\nPlease do not delete ',
-		'doctype': u'DocField',
-		'fieldname': u'total_amount',
-		'fieldtype': u'Currency',
-		'hidden': 1,
-		'label': u'Tax Amount',
-		'no_copy': 1,
-		'oldfieldname': u'total_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/purchase_tax_detail/__init__.py b/erpnext/accounts/doctype/purchase_taxes_and_charges/__init__.py
similarity index 100%
copy from erpnext/accounts/doctype/purchase_tax_detail/__init__.py
copy to erpnext/accounts/doctype/purchase_taxes_and_charges/__init__.py
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt b/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt
new file mode 100644
index 0000000..74fd697
--- /dev/null
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt
@@ -0,0 +1,237 @@
+# DocType, Purchase Taxes and Charges
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:46',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:46',
+		'modified_by': u'Administrator',
+		'owner': u'wasim@webnotestech.com'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': u'1322549700',
+		'autoname': u'PVTD.######',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'hide_heading': 1,
+		'istable': 1,
+		'module': u'Accounts',
+		'name': '__common__',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 13
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Purchase Taxes and Charges',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Purchase Taxes and Charges
+	{
+		'doctype': 'DocType',
+		'name': u'Purchase Taxes and Charges'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'category',
+		'fieldtype': u'Select',
+		'label': u'Category',
+		'oldfieldname': u'category',
+		'oldfieldtype': u'Select',
+		'options': u'\nFor Total\nFor Valuation\nFor Both',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'default': u'Add',
+		'doctype': u'DocField',
+		'fieldname': u'add_deduct_tax',
+		'fieldtype': u'Select',
+		'label': u'Add or Deduct',
+		'oldfieldname': u'add_deduct_tax',
+		'oldfieldtype': u'Select',
+		'options': u'\nAdd\nDeduct',
+		'permlevel': 0,
+		'reqd': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'charge_type',
+		'fieldtype': u'Select',
+		'label': u'Type',
+		'oldfieldname': u'charge_type',
+		'oldfieldtype': u'Select',
+		'options': u'\nActual\nOn Net Total\nOn Previous Row Amount\nOn Previous Row Total',
+		'permlevel': 0,
+		'reqd': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'row_id',
+		'fieldtype': u'Data',
+		'hidden': 0,
+		'label': u'Enter Row',
+		'oldfieldname': u'row_id',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'item_wise_tax_detail',
+		'fieldtype': u'Small Text',
+		'hidden': 1,
+		'label': u'Item Wise Tax Detail ',
+		'oldfieldname': u'item_wise_tax_detail',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Small Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0,
+		'reqd': 1,
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'account_head',
+		'fieldtype': u'Link',
+		'label': u'Account Head',
+		'oldfieldname': u'account_head',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
+		'permlevel': 0,
+		'reqd': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'cost_center',
+		'fieldtype': u'Link',
+		'label': u'Cost Center',
+		'oldfieldname': u'cost_center',
+		'oldfieldtype': u'Link',
+		'options': u'Cost Center',
+		'permlevel': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'rate',
+		'fieldtype': u'Currency',
+		'label': u'Rate',
+		'oldfieldname': u'rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'reqd': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'tax_amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount',
+		'oldfieldname': u'tax_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'reqd': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'total',
+		'fieldtype': u'Currency',
+		'label': u'Aggregate Total',
+		'oldfieldname': u'total',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'parenttype',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Parenttype',
+		'oldfieldname': u'parenttype',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'print_hide': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'description': u'Cheating Field\nPlease do not delete ',
+		'doctype': u'DocField',
+		'fieldname': u'total_tax_amount',
+		'fieldtype': u'Currency',
+		'hidden': 1,
+		'label': u'Total +Tax',
+		'no_copy': 1,
+		'oldfieldname': u'total_tax_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1
+	},
+
+	# DocField
+	{
+		'description': u'Cheating Field\nPlease do not delete ',
+		'doctype': u'DocField',
+		'fieldname': u'total_amount',
+		'fieldtype': u'Currency',
+		'hidden': 1,
+		'label': u'Tax Amount',
+		'no_copy': 1,
+		'oldfieldname': u'total_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/purchase_tax_detail/__init__.py b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/__init__.py
similarity index 100%
copy from erpnext/accounts/doctype/purchase_tax_detail/__init__.py
copy to erpnext/accounts/doctype/purchase_taxes_and_charges_master/__init__.py
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js
new file mode 100644
index 0000000..ae4eb43
--- /dev/null
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js
@@ -0,0 +1,175 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+// 
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+   
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+   
+}
+
+cur_frm.pformat.purchase_tax_details= function(doc){
+ 
+  //function to make row of table
+  var make_row = function(title,val,bold){
+    var bstart = '<b>'; var bend = '</b>';
+    return '<tr><td style="width:50%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
+     +'<td style="width:25%;text-align:right;">'+doc.currency+'</td>'
+     +'<td style="width:25%;text-align:right;">'+val+'</td>'
+     +'</tr>'
+  }
+
+  function convert_rate(val){
+    var new_val = flt(val)/flt(doc.conversion_rate);
+    return new_val;
+  }
+
+  var cl = getchildren('Purchase Taxes and Charges',doc.name,'purchase_tax_details');
+
+  // outer table  
+  var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';
+  
+  // main table
+  out +='<table class="noborder" style="width:100%">'+make_row('Net Total',fmt_money(convert_rate(doc.net_total)),1);
+
+  // add rows
+  if(cl.length){
+    for(var i=0;i<cl.length;i++){
+      out += make_row(cl[i].description,fmt_money(convert_rate(cl[i].tax_amount)),0);
+    }
+  }
+  
+  // grand total
+  out +=make_row('Grand Total',fmt_money(doc.grand_total_import),1)
+  if(doc.in_words_import){
+    out +='</table></td></tr>';
+    out += '<tr><td colspan = "2">';
+    out += '<table><tr><td style="width:25%;"><b>In Words</b></td>';
+    out+= '<td style="width:50%;">'+doc.in_words_import+'</td></tr>';
+  }
+  out +='</table></td></tr></table></div>';   
+  return out;
+}
+
+cur_frm.cscript.add_deduct_tax = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.category && d.add_deduct_tax){
+    alert("Please select Category first");
+    d.add_deduct_tax = '';
+  }
+  else if(d.category != 'For Total' && d.add_deduct_tax == 'Deduct'){
+    alert("You cannot Deduct when category is for valuation or for both(i.e total and valuation)");
+    d.add_deduct_tax = '';
+  }
+
+}
+
+cur_frm.cscript.charge_type = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.category && d.charge_type){
+    alert("Please select Category first");
+    d.charge_type = '';
+  }  
+  else if(d.idx == 1 && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){
+    alert("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row");
+    d.charge_type = '';
+  }
+  else if((d.category == 'For Valuation' || d.category == 'For Both') && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){
+    alert("You cannot select charge type as 'On Previous Row Amount' or 'On Previous Row Total' for valuation. You can select only 'For Total' option for previous row amount or previous row total")
+    d.charge_type = '';
+  }
+  validated = false;
+  refresh_field('charge_type',d.name,'purchase_tax_details');
+
+  cur_frm.cscript.row_id(doc, cdt, cdn);
+  cur_frm.cscript.rate(doc, cdt, cdn);
+  cur_frm.cscript.tax_amount(doc, cdt, cdn);
+}
+
+
+cur_frm.cscript.row_id = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.charge_type && d.row_id){
+    alert("Please select Charge Type first");
+    d.row_id = '';
+  }
+  else if((d.charge_type == 'Actual' || d.charge_type == 'On Net Total') && d.row_id) {
+    alert("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'");
+    d.row_id = '';
+  }
+  else if((d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total') && d.row_id){
+    if(d.row_id >= d.idx){
+      alert("You cannot Enter Row no. greater than or equal to current row no. for this Charge type");
+      d.row_id = '';
+    }
+  }
+  validated = false;
+  refresh_field('row_id',d.name,'purchase_tax_details');
+}
+
+/*---------------------- Get rate if account_head has account_type as TAX or CHARGEABLE-------------------------------------*/
+
+cur_frm.fields_dict['purchase_tax_details'].grid.get_field("account_head").get_query = function(doc,cdt,cdn) {
+  return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type = "Tax" OR tabAccount.account_type = "Chargeable" or (tabAccount.is_pl_account = "Yes" and tabAccount.debit_or_credit = "Debit")) AND tabAccount.company = "' + doc.company + '" AND  tabAccount.name LIKE "%s"'
+}
+
+
+cur_frm.fields_dict['purchase_tax_details'].grid.get_field("cost_center").get_query = function(doc) {
+	return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY	`tabCost Center`.`name` ASC LIMIT 50';
+}
+
+
+cur_frm.cscript.account_head = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.charge_type && d.account_head){
+    alert("Please select Charge Type first");
+    validated = false;
+    d.account_head = '';
+  }
+  else if(d.account_head && d.charge_type) {
+    arg = "{'charge_type' : '" + d.charge_type +"', 'account_head' : '" + d.account_head + "'}";
+    get_server_fields('get_rate', arg, 'purchase_tax_details', doc, cdt, cdn, 1);
+  }
+  refresh_field('account_head',d.name,'purchase_tax_details');
+}
+
+cur_frm.cscript.rate = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.charge_type && d.rate) {
+    alert("Please select Charge Type first");
+    d.rate = '';
+  }
+  validated = false;
+  refresh_field('rate',d.name,'purchase_tax_details');
+}
+
+cur_frm.cscript.tax_amount = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.charge_type && d.tax_amount){
+    alert("Please select Charge Type first");
+    d.tax_amount = '';
+  }
+  else if(d.charge_type && d.tax_amount) {
+    alert("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate");
+    d.tax_amount = '';
+  }
+  validated = false;
+  refresh_field('tax_amount',d.name,'purchase_tax_details');
+}
diff --git a/erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.py b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py
similarity index 100%
rename from erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.py
rename to erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt
new file mode 100644
index 0000000..1ecac40
--- /dev/null
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt
@@ -0,0 +1,130 @@
+# DocType, Purchase Taxes and Charges Master
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:51',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:51',
+		'modified_by': u'Administrator',
+		'owner': u'wasim@webnotestech.com'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': u'1325570646',
+		'allow_trash': 1,
+		'autoname': u'field:title',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'document_type': u'Master',
+		'module': u'Accounts',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 18
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Purchase Taxes and Charges Master',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Purchase Taxes and Charges Master',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1
+	},
+
+	# DocType, Purchase Taxes and Charges Master
+	{
+		'doctype': 'DocType',
+		'name': u'Purchase Taxes and Charges Master'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'All'
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Purchase Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'System Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Purchase Master Manager',
+		'submit': 0,
+		'write': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'title',
+		'fieldtype': u'Data',
+		'in_filter': 1,
+		'label': u'Title',
+		'oldfieldname': u'title',
+		'oldfieldtype': u'Data',
+		'reqd': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Company',
+		'options': u'Company',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'purchase_tax_details',
+		'fieldtype': u'Table',
+		'label': u'Purchase Taxes and Charges',
+		'oldfieldname': u'purchase_tax_details',
+		'oldfieldtype': u'Table',
+		'options': u'Purchase Taxes and Charges'
+	}
+]
diff --git a/erpnext/accounts/doctype/pv_detail/__init__.py b/erpnext/accounts/doctype/pv_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/doctype/pv_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/doctype/pv_detail/pv_detail.txt b/erpnext/accounts/doctype/pv_detail/pv_detail.txt
deleted file mode 100755
index 423f667..0000000
--- a/erpnext/accounts/doctype/pv_detail/pv_detail.txt
+++ /dev/null
@@ -1,348 +0,0 @@
-# DocType, PV Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:17',
-		'docstatus': 0,
-		'modified': '2012-03-05 15:02:25',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': u'EVD.######',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': u'Accounts',
-		'name': '__common__',
-		'section_style': u'Tray',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 46
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'PV Detail',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# DocType, PV Detail
-	{
-		'doctype': 'DocType',
-		'name': u'PV Detail'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_code',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Item',
-		'oldfieldname': u'item_code',
-		'oldfieldtype': u'Link',
-		'options': u'Item',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 0,
-		'search_index': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_name',
-		'fieldtype': u'Data',
-		'in_filter': 0,
-		'label': u'Item Name',
-		'oldfieldname': u'item_name',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'description',
-		'fieldtype': u'Text',
-		'label': u'Description',
-		'oldfieldname': u'description',
-		'oldfieldtype': u'Text',
-		'permlevel': 0,
-		'width': u'300px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'qty',
-		'fieldtype': u'Currency',
-		'label': u'Qty',
-		'oldfieldname': u'qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 0,
-		'reqd': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'import_ref_rate',
-		'fieldtype': u'Currency',
-		'label': u'Ref Rate ',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'discount_rate',
-		'fieldtype': u'Currency',
-		'label': u'Discount %',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'import_rate',
-		'fieldtype': u'Currency',
-		'label': u'Rate ',
-		'oldfieldname': u'import_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 0,
-		'reqd': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'import_amount',
-		'fieldtype': u'Currency',
-		'label': u'Amount',
-		'oldfieldname': u'import_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'purchase_ref_rate',
-		'fieldtype': u'Currency',
-		'label': u'Ref Rate *',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'rate',
-		'fieldtype': u'Currency',
-		'label': u'Rate *(Default Curr.)',
-		'oldfieldname': u'rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'amount',
-		'fieldtype': u'Currency',
-		'label': u'Amount (Default Curr.)',
-		'oldfieldname': u'amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'expense_head',
-		'fieldtype': u'Link',
-		'label': u'Expense Head',
-		'oldfieldname': u'expense_head',
-		'oldfieldtype': u'Link',
-		'options': u'Account',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'trigger': u'Client',
-		'width': u'120px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'cost_center',
-		'fieldtype': u'Link',
-		'label': u'Cost Center',
-		'oldfieldname': u'cost_center',
-		'oldfieldtype': u'Link',
-		'options': u'Cost Center',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client',
-		'width': u'120px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'project_name',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Project Name',
-		'options': u'Project',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'brand',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'label': u'Brand',
-		'oldfieldname': u'brand',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_group',
-		'fieldtype': u'Link',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'Item Group',
-		'oldfieldname': u'item_group',
-		'oldfieldtype': u'Link',
-		'options': u'Item Group',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'purchase_order',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Pur Order',
-		'oldfieldname': u'purchase_order',
-		'oldfieldtype': u'Link',
-		'options': u'Purchase Order',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'po_detail',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'PO Detail',
-		'oldfieldname': u'po_detail',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'purchase_receipt',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Pur Receipt',
-		'oldfieldname': u'purchase_receipt',
-		'oldfieldtype': u'Link',
-		'options': u'Purchase Receipt',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'pr_detail',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'PR Detail',
-		'oldfieldname': u'pr_detail',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'description': u'Tax detail table fetched from item master as a string and stored in this field.\nUsed for Purchase Other Charges',
-		'doctype': u'DocField',
-		'fieldname': u'item_tax_rate',
-		'fieldtype': u'Small Text',
-		'hidden': 1,
-		'label': u'Item Tax Rate',
-		'oldfieldname': u'item_tax_rate',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 1,
-		'print_hide': 1,
-		'report_hide': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'page_break',
-		'fieldtype': u'Check',
-		'label': u'Page Break',
-		'no_copy': 1,
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/receivable_voucher/__init__.py b/erpnext/accounts/doctype/receivable_voucher/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/doctype/receivable_voucher/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js
deleted file mode 100644
index 7b3c6ef..0000000
--- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js
+++ /dev/null
@@ -1,496 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-cur_frm.cscript.tname = "RV Detail";
-cur_frm.cscript.fname = "entries";
-cur_frm.cscript.other_fname = "other_charges";
-cur_frm.cscript.sales_team_fname = "sales_team";
-
-// print heading
-cur_frm.pformat.print_heading = 'Invoice';
-
-$import(Sales Common)
-$import(Other Charges)
-$import(SMS Control)
-
-// On Load
-// -------
-cur_frm.cscript.onload = function(doc,dt,dn) {
-	if(!doc.customer && doc.debit_to) get_field(dt, 'debit_to', dn).print_hide = 0;
-	if (doc.__islocal) {
-		if(!doc.voucher_date) set_multiple(dt,dn,{voucher_date:get_today()});
-		if(!doc.due_date) set_multiple(dt,dn,{due_date:get_today()});
-		if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
-		if(!doc.currency && sys_defaults.currency) set_multiple(dt,dn,{currency:sys_defaults.currency});
-		if(!doc.price_list_currency) set_multiple(dt, dn, {price_list_currency: doc.currency, plc_conversion_rate: 1});
-
- 		hide_field(['customer_address', 'contact_person','customer_name','address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory', 'customer_group']);
-	}
-}
-
-cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
-	var callback = function(doc, dt, dn) {
-		// called from mapper, update the account names for items and customer
-		var callback2 = function(doc, dt, dn) {
-			if(doc.customer && doc.__islocal) {
-				$c_obj(make_doclist(doc.doctype,doc.name),
-					'load_default_accounts','',
-					function(r,rt) {
-						refresh_field('entries');
-						cur_frm.cscript.customer(doc,dt,dn,onload=true);
-					}
-				);
-			}
-		}
-		// defined in sales_common.js
-		var callback1 = function(doc, dt, dn) {
-			//for previously created sales invoice, set required field related to pos	
-			cur_frm.cscript.update_item_details(doc, dt, dn, callback2);
-		}
-		
-		if(doc.is_pos ==1) cur_frm.cscript.is_pos(doc, dt, dn,callback1);
-		else cur_frm.cscript.update_item_details(doc, dt, dn, callback2);
-	}
-
-	cur_frm.cscript.hide_price_list_currency(doc, dt, dn, callback); 
-
-}
-
-
-// Hide Fields
-// ------------
-cur_frm.cscript.hide_fields = function(doc, cdt, cdn) {
-	par_flds = ['project_name', 'due_date', 'sales_order_main', 'delivery_note_main', 'Get Items', 'is_opening', 'conversion_rate', 'source', 'cancel_reason', 'total_advance', 'gross_profit', 'gross_profit_percent', 'Get Advances Received', 'advance_adjustment_details', 'sales_partner', 'commission_rate', 'total_commission', 'Repair Outstanding Amt'];
-	
-	item_flds_normal = ['sales_order', 'delivery_note']
-	item_flds_pos = ['warehouse', 'serial_no', 'batch_no', 'actual_qty', 'delivered_qty']
-	
-	if(cint(doc.is_pos) == 1) {
-		hide_field(par_flds);
-		for(f in item_flds_normal) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_normal[f], false);
-		for(f in item_flds_pos) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_pos[f], (doc.update_stock==1?true:false));
-	} else {
-		unhide_field(par_flds);
-		for(f in item_flds_normal) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_normal[f], true);
-		for(f in item_flds_pos) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_pos[f], false);
-	}
-
-	// India related fields
-	var cp = wn.control_panel;
-	if (cp.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']);
-	else hide_field(['c_form_applicable', 'c_form_no']);
-
-}
-
-
-// Refresh
-// -------
-cur_frm.cscript.refresh = function(doc, dt, dn) {
-	cur_frm.cscript.is_opening(doc, dt, dn);
-	cur_frm.cscript.hide_fields(doc, dt, dn);
-	// Show / Hide button
-	cur_frm.clear_custom_buttons();
-
-	if (!cur_frm.cscript.is_onload)	cur_frm.cscript.hide_price_list_currency(doc, dt, dn); 
-
-	if(doc.docstatus==1) {
-		cur_frm.add_custom_button('View Ledger', cur_frm.cscript['View Ledger Entry']);
-		cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
-		unhide_field('Repair Outstanding Amt');
-
-		if(doc.is_pos==1 && doc.update_stock!=1)
-			cur_frm.add_custom_button('Make Delivery', cur_frm.cscript['Make Delivery Note']);
-
-		if(doc.outstanding_amount!=0)
-			cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript['Make Bank Voucher']);
-	}
-	else
-		hide_field('Repair Outstanding Amt');
-}
-
-//fetch retail transaction related fields
-//--------------------------------------------
-cur_frm.cscript.is_pos = function(doc,dt,dn,callback){
-	cur_frm.cscript.hide_fields(doc, dt, dn);
-	if(doc.is_pos == 1){
-		if (!doc.company) {
-			msgprint("Please select company to proceed");
-			doc.is_pos = 0;
-			refresh_field('is_pos');
-		}
-		else {
-			var callback1 = function(r,rt){
-				if(callback) callback(doc, dt, dn);
-				cur_frm.refresh();
-			}
-			$c_obj(make_doclist(dt,dn),'set_pos_fields','',callback1);
-		}
-	}
-}
-
-
-cur_frm.cscript.update_stock = function(doc, dt, dn) {
-	cur_frm.cscript.hide_fields(doc, dt, dn);
-}
-
-
-cur_frm.cscript.warehouse = function(doc, cdt , cdn) {
-	var d = locals[cdt][cdn];
-	if (!d.item_code) {alert("please enter item code first"); return};
-	if (d.warehouse) {
-		arg = "{'item_code':'" + d.item_code + "','warehouse':'" + d.warehouse +"'}";
-		get_server_fields('get_actual_qty',arg,'entries',doc,cdt,cdn,1);
-	}
-}
-
-
-
-//Customer
-cur_frm.cscript.customer = function(doc,dt,dn,onload) {
-
-	var callback = function(r,rt) {
-			var callback2 = function(doc, dt, dn) {
-				doc = locals[dt][dn];
-				if(doc.debit_to && doc.posting_date){
-					get_server_fields('get_cust_and_due_date','','',doc,dt,dn,1,
-					function(doc, dt, dn) {
-						cur_frm.refresh();
-					});
-					
-				}
-			}
-			var doc = locals[cur_frm.doctype][cur_frm.docname];
-			get_server_fields('get_debit_to','','',doc, dt, dn, 0, callback2);
-	}
-	var args = onload ? 'onload':''
-	if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', args, callback);
-
-	if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
-	
-}
-
-
-
-cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
-	if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
-}
-
-cur_frm.fields_dict.customer_address.on_new = function(dn) {
-	locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
-	locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
-}
-
-cur_frm.fields_dict.contact_person.on_new = function(dn) {
-	locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
-	locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
-}
-
-cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
-	return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
-}
-
-cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
-	return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
-}
-
-
-// Set Due Date = posting date + credit days
-cur_frm.cscript.debit_to = function(doc,dt,dn) {
-
-	var callback2 = function(r,rt) {
-			var doc = locals[cur_frm.doctype][cur_frm.docname];
-			cur_frm.refresh();
-	}
-
-	var callback = function(r,rt) {
-			var doc = locals[cur_frm.doctype][cur_frm.docname];
-			if(doc.customer) $c_obj(make_doclist(dt,dn), 'get_default_customer_address', '', callback2);
-			if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
-			cur_frm.refresh();
-	}
-
-	if(doc.debit_to && doc.posting_date){
-		get_server_fields('get_cust_and_due_date','','',doc,dt,dn,1,callback);
-	}
-}
-
-
-
-//refresh advance amount
-//-------------------------------------------------
-
-cur_frm.cscript.paid_amount = function(doc,dt,dn){
-	doc.outstanding_amount = flt(doc.grand_total) - flt(doc.paid_amount) - flt(doc.write_off_amount);
-	refresh_field('outstanding_amount');
-}
-
-
-//---- get customer details ----------------------------
-cur_frm.cscript.project_name = function(doc,cdt,cdn){
-	$c_obj(make_doclist(doc.doctype, doc.name),'pull_project_customer','', function(r,rt){
-		refresh_many(['customer', 'customer_name','customer_address', 'territory']);
-	});
-}
-
-//Set debit and credit to zero on adding new row
-//----------------------------------------------
-cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
-
-	cl = getchildren('RV Detail', doc.name, cur_frm.cscript.fname, doc.doctype);
-	acc = '';
-	cc = '';
-
-	for(var i = 0; i<cl.length; i++) {
-
-		if (cl[i].idx == 1){
-			acc = cl[i].income_account;
-			cc = cl[i].cost_center;
-		}
-		else{
-			if (! cl[i].income_account) { cl[i].income_account = acc; refresh_field('income_account', cl[i].name, 'entries');}
-			if (! cl[i].cost_center)	{cl[i].cost_center = cc;refresh_field('cost_center', cl[i].name, 'entries');}
-		}
-	}
-}
-
-cur_frm.cscript.is_opening = function(doc, dt, dn) {
-	hide_field('aging_date');
-	if (doc.is_opening == 'Yes') unhide_field('aging_date');
-}
-
-/* **************************** TRIGGERS ********************************** */
-
-// Get Items based on SO or DN Selected
-cur_frm.cscript['Get Items'] = function(doc, dt, dn) {
-	var callback = function(r,rt) {
-		unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
-		cur_frm.refresh();
-	}
-	get_server_fields('pull_details','','',doc, dt, dn,1,callback);
-}
-
-
-
-// Allocated Amount in advances table
-// -----------------------------------
-cur_frm.cscript.allocated_amount = function(doc,cdt,cdn){
-	cur_frm.cscript.calc_adjustment_amount(doc,cdt,cdn);
-}
-
-//Make Delivery Note Button
-//-----------------------------
-
-cur_frm.cscript['Make Delivery Note'] = function() {
-
-	var doc = cur_frm.doc
-	n = createLocal('Delivery Note');
-	$c('dt_map', args={
-		'docs':compress_doclist([locals['Delivery Note'][n]]),
-		'from_doctype':doc.doctype,
-		'to_doctype':'Delivery Note',
-		'from_docname':doc.name,
-		'from_to_list':"[['Receivable Voucher','Delivery Note'],['RV Detail','Delivery Note Detail'],['RV Tax Detail','RV Tax Detail'],['Sales Team','Sales Team']]"
-		}, function(r,rt) {
-			 loaddoc('Delivery Note', n);
-		}
-	);
-}
-
-
-
-// Make Bank Voucher Button
-// -------------------------
-cur_frm.cscript['Make Bank Voucher'] = function(doc, dt, dn) {
-	$c('accounts.get_default_bank_account', { company: cur_frm.doc.company }, function(r, rt) {
-		if(!r.exc) {
-		  cur_frm.cscript.make_jv(cur_frm.doc, null, null, r.message);
-		}
-	});
-}
-
-
-/* ***************************** Get Query Functions ************************** */
-
-// Debit To
-// ---------
-cur_frm.fields_dict.debit_to.get_query = function(doc) {
-	return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
-}
-
-// Cash/bank account
-//------------------
-cur_frm.fields_dict.cash_bank_account.get_query = function(doc) {
-	return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
-}
-
-// Write off account
-//------------------
-cur_frm.fields_dict.write_off_account.get_query = function(doc) {
-	return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "Yes" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
-}
-
-// Write off cost center
-//-----------------------
-cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) {
-	return 'SELECT `tabCost Center`.name FROM `tabCost Center` WHERE `tabCost Center`.group_or_ledger="Ledger" AND `tabCost Center`.docstatus!=2 AND `tabCost Center`.company_name="'+doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s"'
-}
-
-//project name
-//--------------------------
-cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
-	var cond = '';
-	if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND';
-	return repl('SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND %(cond)s `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
-}
-
-//Territory
-//-----------------------------
-cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
-	return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"	ORDER BY	`tabTerritory`.`name` ASC LIMIT 50';
-}
-
-// Income Account in Details Table
-// --------------------------------
-cur_frm.fields_dict.entries.grid.get_field("income_account").get_query = function(doc) {
-	return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"';
-}
-
-// warehouse in detail table
-//----------------------------
-cur_frm.fields_dict['entries'].grid.get_field('warehouse').get_query= function(doc, cdt, cdn) {
-	var d = locals[cdt][cdn];
-	return "SELECT `tabBin`.`warehouse`, `tabBin`.`actual_qty` FROM `tabBin` WHERE `tabBin`.`item_code` = '"+ d.item_code +"' AND ifnull(`tabBin`.`actual_qty`,0) > 0 AND `tabBin`.`warehouse` like '%s' ORDER BY `tabBin`.`warehouse` DESC LIMIT 50";
-}
-
-// Cost Center in Details Table
-// -----------------------------
-cur_frm.fields_dict.entries.grid.get_field("cost_center").get_query = function(doc) {
-	return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY	`tabCost Center`.`name` ASC LIMIT 50';
-}
-
-// Sales Order
-// -----------
-cur_frm.fields_dict.sales_order_main.get_query = function(doc) {
-	if (doc.customer)
-		return 'SELECT DISTINCT `tabSales Order`.`name` FROM `tabSales Order` WHERE `tabSales Order`.company = "' + doc.company + '" and `tabSales Order`.`docstatus` = 1 and `tabSales Order`.`status` != "Stopped" and ifnull(`tabSales Order`.per_billed,0) < 100 and `tabSales Order`.`customer` =	"' + doc.customer + '" and `tabSales Order`.%(key)s LIKE "%s" ORDER BY `tabSales Order`.`name` DESC LIMIT 50';
-	else
-		return 'SELECT DISTINCT `tabSales Order`.`name` FROM `tabSales Order` WHERE `tabSales Order`.company = "' + doc.company + '" and `tabSales Order`.`docstatus` = 1 and `tabSales Order`.`status` != "Stopped" and ifnull(`tabSales Order`.per_billed,0) < 100 and `tabSales Order`.%(key)s LIKE "%s" ORDER BY `tabSales Order`.`name` DESC LIMIT 50';
-}
-
-// Delivery Note
-// --------------
-cur_frm.fields_dict.delivery_note_main.get_query = function(doc) {
-	if (doc.customer)
-		return 'SELECT DISTINCT `tabDelivery Note`.`name` FROM `tabDelivery Note` WHERE `tabDelivery Note`.company = "' + doc.company + '" and `tabDelivery Note`.`docstatus` = 1 and ifnull(`tabDelivery Note`.per_billed,0) < 100 and `tabDelivery Note`.`customer` =	"' + doc.customer + '" and `tabDelivery Note`.%(key)s LIKE "%s" ORDER BY `tabDelivery Note`.`name` DESC LIMIT 50';
-	else
-		return 'SELECT DISTINCT `tabDelivery Note`.`name` FROM `tabDelivery Note` WHERE `tabDelivery Note`.company = "' + doc.company + '" and `tabDelivery Note`.`docstatus` = 1 and ifnull(`tabDelivery Note`.per_billed,0) < 100 and `tabDelivery Note`.%(key)s LIKE "%s" ORDER BY `tabDelivery Note`.`name` DESC LIMIT 50';
-}
-
-
-
-cur_frm.cscript.income_account = function(doc, cdt, cdn){
-	var d = locals[cdt][cdn];
-	if(d.income_account){
-		var cl = getchildren('RV Detail', doc.name, cur_frm.cscript.fname, doc.doctype);
-		for(var i = 0; i < cl.length; i++){
-			if(!cl[i].income_account) cl[i].income_account = d.income_account;
-		}
-	}
-	refresh_field(cur_frm.cscript.fname);
-}
-
-
-cur_frm.cscript.cost_center = function(doc, cdt, cdn){
-	var d = locals[cdt][cdn];
-	if(d.cost_center){
-		var cl = getchildren('RV Detail', doc.name, cur_frm.cscript.fname, doc.doctype);
-		for(var i = 0; i < cl.length; i++){
-			if(!cl[i].cost_center) cl[i].cost_center = d.cost_center;
-		}
-	}
-	refresh_field(cur_frm.cscript.fname);
-}
-
-/* **************************************** Utility Functions *************************************** */
-
-// Details Calculation
-// --------------------
-cur_frm.cscript.calc_adjustment_amount = function(doc,cdt,cdn) {
-	var doc = locals[doc.doctype][doc.name];
-	var el = getchildren('Advance Adjustment Detail',doc.name,'advance_adjustment_details');
-	var total_adjustment_amt = 0
-	for(var i in el) {
-			total_adjustment_amt += flt(el[i].allocated_amount)
-	}
-	doc.total_advance = flt(total_adjustment_amt);
-	doc.outstanding_amount = flt(doc.grand_total) - flt(total_adjustment_amt) - flt(doc.paid_amount) - flt(doc.write_off_amount);
-	refresh_many(['total_advance','outstanding_amount']);
-}
-
-
-// Make Journal Voucher
-// --------------------
-cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
-	var jv = LocalDB.create('Journal Voucher');
-	jv = locals['Journal Voucher'][jv];
-	jv.voucher_type = 'Bank Voucher';
-
-	jv.company = doc.company;
-	jv.remark = repl('Payment received against invoice %(vn)s for %(rem)s', {vn:doc.name, rem:doc.remarks});
-	jv.fiscal_year = doc.fiscal_year;
-
-	// debit to creditor
-	var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
-	d1.account = doc.debit_to;
-	d1.credit = doc.outstanding_amount;
-	d1.against_invoice = doc.name;
-
-
-	// credit to bank
-	var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
-	d1.account = bank_account;
-	d1.debit = doc.outstanding_amount;
-
-	loaddoc('Journal Voucher', jv.name);
-}
-
-
-/****************** Get Accounting Entry *****************/
-cur_frm.cscript['View Ledger Entry'] = function(){
-	var callback = function(report){
-		report.set_filter('GL Entry', 'Voucher No',cur_frm.doc.name);
-		report.dt.run();
-	}
-	loadreport('GL Entry','General Ledger', callback);
-}
-
-// Default values for recurring invoices
-cur_frm.cscript.convert_into_recurring_invoice = function(doc) {
-	if (doc.convert_into_recurring_invoice) {
-		doc.repeat_on_day_of_month = doc.posting_date.split('-')[2];
-		doc.notification_email_address = [doc.owner, doc.contact_email].join(', ');
-		refresh_field(['repeat_on_day_of_month', 'notification_email_address']);
-	}		
-}
-
-$import(Notification Control)
-cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
-	var args = {
-		type: 'Sales Invoice',
-		doctype: 'Receivable Voucher'
-	}
-	cur_frm.cscript.notify(doc, args);
-}
diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py
deleted file mode 100644
index 446a116..0000000
--- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py
+++ /dev/null
@@ -1,721 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr,date_diff, default_fields, flt, fmt_money, formatdate, generate_hash,getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common,month_name, now, nowdate, replace_newlines, sendmail, set_default,str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-session = webnotes.session
-
-# -----------------------------------------------------------------------------------------
-
-from utilities.transaction_base import TransactionBase
-
-class DocType(TransactionBase):
-	def __init__(self,d,dl):
-		self.doc, self.doclist = d, dl
-		self.log = []
-		self.tname = 'RV Detail'
-		self.fname = 'entries'
-
-
-	# Autoname
-	# ---------
-	def autoname(self):
-		self.doc.name = make_autoname(self.doc.naming_series+ '.#####')
-
-
-
-# ********************************* Trigger Functions ******************************
-
-	#Set retail related fields from pos settings
-	#-------------------------------------------------------------------------
-	def set_pos_fields(self):
-		pos = webnotes.conn.sql("select * from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1)
-		if not pos:
-			pos = webnotes.conn.sql("select * from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1)
-		if pos:
-			val = webnotes.conn.sql("select name from `tabAccount` where name = %s and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr()))
-			val = val and val[0][0] or ''
-			if not val: val = pos and pos[0]['customer_account'] or ''
-			if not self.doc.debit_to:
-				webnotes.conn.set(self.doc,'debit_to',val)
-			
-			lst = ['territory','naming_series','currency','charge','letter_head','tc_name','price_list_name','company','select_print_heading','cash_bank_account']
-				
-			for i in lst:
-				val = pos and pos[0][i] or ''
-				self.doc.fields[i] = val
-			self.set_pos_item_values()
-			
-			val = pos and flt(pos[0]['conversion_rate']) or 0	
-			self.doc.conversion_rate = val
-
-			#fetch terms	
-			if self.doc.tc_name:	 self.get_tc_details()
-			
-			#fetch charges
-			if self.doc.charge:		self.get_other_charges()
-
-
-	# Set default values related to pos for previously created sales invoice.
-	# -------------------------------------------------------------------------- 
-	def set_pos_item_values(self):
-		if cint(self.doc.is_pos) ==1:
-			dtl = webnotes.conn.sql("select income_account, warehouse, cost_center from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1)
-			if not dtl:
-				dtl = webnotes.conn.sql("select income_account, warehouse, cost_center from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1)
-			for d in getlist(self.doclist,'entries'):
-				# overwrite if mentioned in item
-				item = webnotes.conn.sql("select default_income_account, default_sales_cost_center, default_warehouse from tabItem where name = '%s'" %(d.item_code), as_dict=1)
-				d.income_account = item and item[0]['default_income_account'] or dtl and dtl[0]['income_account'] or d.income_account
-				d.cost_center = item and item[0]['default_sales_cost_center'] or dtl and dtl[0]['cost_center'] or d.cost_center
-				d.warehouse = item and item[0]['default_warehouse'] or dtl and dtl[0]['warehouse'] or d.warehouse
-
-
-			
-	# Get Account Head to which amount needs to be Debited based on Customer
-	# ----------------------------------------------------------------------
-	def get_customer_account(self):
-		acc_head = webnotes.conn.sql("select name from `tabAccount` where (name = %s or (master_name = %s and master_type = 'customer')) and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr(),self.doc.customer))
-		if acc_head and acc_head[0][0]:
-			return acc_head[0][0]
-		else:
-			msgprint("%s does not have an Account Head in %s. You must first create it from the Customer Master" % (self.doc.customer, self.doc.company))
-
-	def get_debit_to(self):
-		acc_head = self.get_customer_account()
-		return acc_head and {'debit_to' : acc_head} or {}
-
-
-
-	# Set Due Date = Posting Date + Credit Days
-	# -----------------------------------------
-	def get_cust_and_due_date(self):
-		credit_days = 0
-		if self.doc.debit_to:
-			credit_days = webnotes.conn.sql("select credit_days from `tabAccount` where name='%s' and docstatus != 2" % self.doc.debit_to)
-			credit_days = credit_days and cint(credit_days[0][0]) or 0
-		if self.doc.company and not credit_days:
-			credit_days = webnotes.conn.sql("select credit_days from `tabCompany` where name='%s'" % self.doc.company)
-			credit_days = credit_days and cint(credit_days[0][0]) or 0
-		# Customer has higher priority than company
-		# i.e.if not entered in customer will take credit days from company
-		self.doc.due_date = add_days(cstr(self.doc.posting_date), credit_days)
-		
-		if self.doc.debit_to:
-			self.doc.customer = webnotes.conn.get_value('Account',self.doc.debit_to,'master_name')
-		#	get_obj('Sales Common').get_customer_details(self, inv_det_reqd = 0)
-
-
-	# Pull Details of Delivery Note or Sales Order Selected
-	# ------------------------------------------------------
-	def pull_details(self):
-		# Delivery Note
-		if self.doc.delivery_note_main:
-			self.validate_prev_docname('delivery note')
-			self.doc.clear_table(self.doclist,'other_charges')			
-			self.doclist = get_obj('DocType Mapper', 'Delivery Note-Receivable Voucher').dt_map('Delivery Note', 'Receivable Voucher', self.doc.delivery_note_main, self.doc, self.doclist, "[['Delivery Note', 'Receivable Voucher'],['Delivery Note Detail', 'RV Detail'],['RV Tax Detail','RV Tax Detail'],['Sales Team','Sales Team']]")			
-			self.get_income_account('entries')
-		# Sales Order
-		elif self.doc.sales_order_main:
-			self.validate_prev_docname('sales order')
-			self.doc.clear_table(self.doclist,'other_charges')
-			get_obj('DocType Mapper', 'Sales Order-Receivable Voucher').dt_map('Sales Order', 'Receivable Voucher', self.doc.sales_order_main, self.doc, self.doclist, "[['Sales Order', 'Receivable Voucher'],['Sales Order Detail', 'RV Detail'],['RV Tax Detail','RV Tax Detail'], ['Sales Team', 'Sales Team']]")
-			self.get_income_account('entries')
-			
-		ret = self.get_debit_to()
-		self.doc.debit_to = ret.get('debit_to')
-					
-	# onload pull income account
-	# --------------------------
-	def load_default_accounts(self):
-		"""
-			Loads default accounts from items, customer when called from mapper
-		"""
-		self.get_income_account('entries')
-		
-	def get_income_account(self,doctype):		
-		for d in getlist(self.doclist, doctype):			
-			if d.item_code:
-				item = webnotes.conn.sql("select default_income_account, default_sales_cost_center from tabItem where name = '%s'" %(d.item_code), as_dict=1)
-				d.income_account = item and item[0]['default_income_account'] or ''
-				d.cost_center = item and item[0]['default_sales_cost_center'] or ''				
-
-	# Item Details
-	# -------------
-	def get_item_details(self, args=None):
-		args = args and eval(args) or {}
-		if args.get('item_code'):
-			ret = get_obj('Sales Common').get_item_details(args, self)
-			return self.get_pos_details(args, ret)
-		else:
-			obj = get_obj('Sales Common')
-			for doc in self.doclist:
-				if doc.fields.get('item_code'):
-					arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'), 
-						'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
-
-					ret = obj.get_item_details(arg, self)
-					ret = self.get_pos_details(arg, ret)
-					for r in ret:
-						if not doc.fields.get(r):
-							doc.fields[r] = ret[r]		
-
-
-	def get_pos_details(self, args, ret):
-		if args['item_code'] and cint(self.doc.is_pos) == 1:
-			dtl = webnotes.conn.sql("select income_account, warehouse, cost_center from `tabPOS Setting` where user = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1)				 
-			if not dtl:
-				dtl = webnotes.conn.sql("select income_account, warehouse, cost_center from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1)
-
-			item = webnotes.conn.sql("select default_income_account, default_sales_cost_center, default_warehouse from tabItem where name = '%s'" %(args['item_code']), as_dict=1)
-
-			ret['income_account'] = item and item[0]['default_income_account'] or dtl and dtl[0]['income_account'] or args['income_account']
-			ret['cost_center'] = item and item[0]['default_sales_cost_center'] or dtl and dtl[0]['cost_center'] or args['cost_center']
-			ret['warehouse'] = item and item[0]['default_warehouse'] or dtl and dtl[0]['warehouse'] or args['warehouse']
-
-			if ret['warehouse']:
-				actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], ret['warehouse']))
-				ret['actual_qty']= actual_qty and flt(actual_qty[0][0]) or 0
-		return ret
-
-
-	# Fetch ref rate from item master as per selected price list
-	def get_adj_percent(self, arg=''):
-		get_obj('Sales Common').get_adj_percent(self)
-
-
-	# Get tax rate if account type is tax
-	# ------------------------------------
-	def get_rate(self,arg):
-		get_obj('Sales Common').get_rate(arg)
-		
-		
-	# Get Commission rate of Sales Partner
-	# -------------------------------------
-	def get_comm_rate(self, sales_partner):
-		return get_obj('Sales Common').get_comm_rate(sales_partner, self)	
-	
- 
-	# GET TERMS & CONDITIONS
-	# -------------------------------------
-	def get_tc_details(self):
-		return get_obj('Sales Common').get_tc_details(self)
-
-	# Load Default Charges
-	# ----------------------------------------------------------
-	def load_default_taxes(self):
-		return get_obj('Sales Common').load_default_taxes(self)
-
-	# Get Other Charges Details
-	# --------------------------
-	def get_other_charges(self):
-		return get_obj('Sales Common').get_other_charges(self)
-		
-
-	# Get Advances
-	# -------------
-	def get_advances(self):
-		get_obj('GL Control').get_advances(self, self.doc.debit_to, 'Advance Adjustment Detail', 'advance_adjustment_details', 'credit')
-
-	#pull project customer
-	#-------------------------
-	def pull_project_customer(self):
-		res = webnotes.conn.sql("select customer from `tabProject` where name = '%s'"%self.doc.project_name)
-		if res:
-			get_obj('DocType Mapper', 'Project-Receivable Voucher').dt_map('Project', 'Receivable Voucher', self.doc.project_name, self.doc, self.doclist, "[['Project', 'Receivable Voucher']]")
-
-# ********************************** Server Utility Functions ******************************
-	
-	# Get Company Abbr.
-	# ------------------
-	def get_company_abbr(self):
-		return webnotes.conn.sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
-		
-	
-	# Check whether sales order / delivery note items already pulled
-	#----------------------------------------------------------------
-	def validate_prev_docname(self,doctype):
-		for d in getlist(self.doclist, 'entries'): 
-			if doctype == 'delivery note' and self.doc.delivery_note_main == d.delivery_note:
-				msgprint(cstr(self.doc.delivery_note_main) + " delivery note details have already been pulled.")
-				raise Exception , "Validation Error. Delivery note details have already been pulled."
-			elif doctype == 'sales order' and self.doc.sales_order_main == d.sales_order and not d.delivery_note:
-				msgprint(cstr(self.doc.sales_order_main) + " sales order details have already been pulled.")
-				raise Exception , "Validation Error. Sales order details have already been pulled."
-
-
-	#-----------------------------------------------------------------
-	def update_against_document_in_jv(self):
-		"""
-			Links invoice and advance voucher:
-				1. cancel advance voucher
-				2. split into multiple rows if partially adjusted, assign against voucher
-				3. submit advance voucher
-		"""
-		
-		lst = []
-		for d in getlist(self.doclist, 'advance_adjustment_details'):
-			if flt(d.allocated_amount) > 0:
-				args = {
-					'voucher_no' : d.journal_voucher, 
-					'voucher_detail_no' : d.jv_detail_no, 
-					'against_voucher_type' : 'Receivable Voucher', 
-					'against_voucher'  : self.doc.name,
-					'account' : self.doc.debit_to, 
-					'is_advance' : 'Yes', 
-					'dr_or_cr' : 'credit', 
-					'unadjusted_amt' : flt(d.advance_amount),
-					'allocated_amt' : flt(d.allocated_amount)
-				}
-				lst.append(args)
-		
-		if lst:
-			get_obj('GL Control').reconcile_against_document(lst)
-	
-	
-	# ------------------------------------------------------------------------
-	def validate_customer(self):
-		"""
-			Validate customer name with SO and DN
-		"""
-		for d in getlist(self.doclist,'entries'):
-			dt = d.delivery_note and 'Delivery Note' or d.sales_order and 'Sales Order' or ''
-			if dt:
-				dt_no = d.delivery_note or d.sales_order
-				cust = webnotes.conn.sql("select customer from `tab%s` where name = %s" % (dt, '%s'), dt_no)
-				if cust and cstr(cust[0][0]) != cstr(self.doc.customer):
-					msgprint("Customer %s does not match with customer of %s: %s." %(self.doc.customer, dt, dt_no), raise_exception=1)
-			
-
-	# Validates Debit To Account and Customer Matches
-	# ------------------------------------------------
-	def validate_debit_to_acc(self):
-		if self.doc.customer and not cint(self.doc.is_pos):
-			acc_head = webnotes.conn.sql("select name from `tabAccount` where name = %s and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr()))
-			if acc_head and acc_head[0][0]:
-				if not cstr(acc_head[0][0]) == cstr(self.doc.debit_to):
-					msgprint("Debit To %s do not match with Customer %s for Company %s i.e. %s" %(self.doc.debit_to,self.doc.customer,self.doc.company,cstr(acc_head[0][0])))
-					raise Exception, "Validation Error "
-			if not acc_head:
-				 msgprint("%s does not have an Account Head in %s. You must first create it from the Customer Master" % (self.doc.customer, self.doc.company))
-				 raise Exception, "Validation Error "
-
-
-	# Validate Debit To Account
-	# 1. Account Exists
-	# 2. Is a Debit Account
-	# 3. Is a PL Account
-	# ---------------------------
-	def validate_debit_acc(self):
-		acc = webnotes.conn.sql("select debit_or_credit, is_pl_account from tabAccount where name = '%s' and docstatus != 2" % self.doc.debit_to)
-		if not acc:
-			msgprint("Account: "+ self.doc.debit_to + " does not exist")
-			raise Exception
-		elif acc[0][0] and acc[0][0] != 'Debit':
-			msgprint("Account: "+ self.doc.debit_to + " is not a debit account")
-			raise Exception
-		elif acc[0][1] and acc[0][1] != 'No':
-			msgprint("Account: "+ self.doc.debit_to + " is a pl account")
-			raise Exception
-
-
-	# Validate Fixed Asset Account and whether Income Account Entered Exists
-	# -----------------------------------------------------------------------
-	def validate_fixed_asset_account(self):
-		for d in getlist(self.doclist,'entries'):
-			item = webnotes.conn.sql("select name,is_asset_item,is_sales_item from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life >	now())"% d.item_code)
-			acc =	webnotes.conn.sql("select account_type from `tabAccount` where name = '%s' and docstatus != 2" % d.income_account)
-			if not acc:
-				msgprint("Account: "+d.income_account+" does not exist in the system")
-				raise Exception
-			elif item and item[0][1] == 'Yes' and not acc[0][0] == 'Fixed Asset Account':
-				msgprint("Please select income head with account type 'Fixed Asset Account' as Item %s is an asset item" % d.item_code)
-				raise Exception
-
-
-
-	# Set totals in words
-	#--------------------
-	def set_in_words(self):
-		dcc = TransactionBase().get_company_currency(self.doc.company)
-		self.doc.in_words = get_obj('Sales Common').get_total_in_words(dcc, self.doc.rounded_total)
-		self.doc.in_words_export = get_obj('Sales Common').get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
-
-	# Clear Advances
-	# --------------
-	def clear_advances(self):
-		get_obj('GL Control').clear_advances(self, 'Advance Adjustment Detail','advance_adjustment_details')
-
-
-	# set aging date
-	#-------------------
-	def set_aging_date(self):
-		if self.doc.is_opening != 'Yes':
-			self.doc.aging_date = self.doc.posting_date
-		elif not self.doc.aging_date:
-			msgprint("Aging Date is mandatory for opening entry")
-			raise Exception
-			
-
-	# Set against account for debit to account
-	#------------------------------------------
-	def set_against_income_account(self):
-		against_acc = []
-		for d in getlist(self.doclist, 'entries'):
-			if d.income_account not in against_acc:
-				against_acc.append(d.income_account)
-		self.doc.against_income_account = ','.join(against_acc)
-
-	def add_remarks(self):
-		if not self.doc.remarks: self.doc.remarks = 'No Remarks'
-
-	#check in manage account if sales order / delivery note required or not.
-	def so_dn_required(self):
-		dict = {'Sales Order':'so_required','Delivery Note':'dn_required'}
-		for i in dict:	
-			res = webnotes.conn.sql("select value from `tabSingles` where doctype = 'Manage Account' and field = '%s'"%dict[i])
-			if res and res[0][0] == 'Yes':
-				for d in getlist(self.doclist,'entries'):
-					if not d.fields[i.lower().replace(' ','_')]:
-						msgprint("%s No. required against item %s"%(i,d.item_code))
-						raise Exception
-
-	#check for does customer belong to same project as entered..
-	#-------------------------------------------------------------------------------------------------
-	def validate_proj_cust(self):
-		if self.doc.project_name and self.doc.customer:
-			res = webnotes.conn.sql("select name from `tabProject` where name = '%s' and (customer = '%s' or ifnull(customer,'')='')"%(self.doc.project_name, self.doc.customer))
-			if not res:
-				msgprint("Customer - %s does not belong to project - %s. \n\nIf you want to use project for multiple customers then please make customer details blank in that project."%(self.doc.customer,self.doc.project_name))
-				raise Exception
-
-	def validate_pos(self):
-		if not self.doc.cash_bank_account:
-			msgprint("Cash/Bank Account is mandatory for POS entry")
-			raise Exception
-		if (flt(self.doc.paid_amount) + flt(self.doc.write_off_amount) - round(flt(self.doc.grand_total), 2))>0.001:
-			msgprint("(Paid amount + Write Off Amount) can not be greater than Grand Total")
-			raise Exception
-
-
-	# ********* UPDATE CURRENT STOCK *****************************
-	def update_current_stock(self):
-		for d in getlist(self.doclist, 'entries'):
-			bin = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
-			d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
-
-	def validate_item_code(self):
-		for d in getlist(self.doclist, 'entries'):
-			if not d.item_code:
-				msgprint("Please enter Item Code at line no : %s to update stock for POS or remove check from Update Stock in Basic Info Tab." % (d.idx))
-				raise Exception
-
-	# Validate Write Off Account
-	# -------------------------------
-	def validate_write_off_account(self):
-		if flt(self.doc.write_off_amount) and not self.doc.write_off_account:
-			msgprint("Please enter Write Off Account", raise_exception=1)
-
-
-	def validate_c_form(self):
-		""" Blank C-form no if C-form applicable marked as 'No'"""
-		if self.doc.amended_from and self.doc.c_form_applicable == 'No' and self.doc.c_form_no:
-			webnotes.conn.sql("""delete from `tabC-Form Invoice Detail` where invoice_no = %s
-					and parent = %s""", (self.doc.amended_from,	self.doc.c_form_no))
-
-			webnotes.conn.set(self.doc, 'c_form_no', '')
-	 
-	# VALIDATE
-	# ====================================================================================
-	def validate(self):
-		self.so_dn_required()
-		#self.dn_required()
-		self.validate_proj_cust()
-		sales_com_obj = get_obj('Sales Common')
-		sales_com_obj.check_stop_sales_order(self)
-		sales_com_obj.check_active_sales_items(self)
-		sales_com_obj.check_conversion_rate(self)
-		sales_com_obj.validate_max_discount(self, 'entries')	 #verify whether rate is not greater than tolerance
-		sales_com_obj.get_allocated_sum(self)	# this is to verify that the allocated % of sales persons is 100%
-		sales_com_obj.validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
-		if not self.doc.customer:
-			get_obj('Sales Common').get_customer_details(self, inv_det_reqd = 0)
-		self.validate_customer()
-		self.validate_debit_to_acc()
-		self.validate_debit_acc()
-		self.validate_fixed_asset_account()
-		self.add_remarks()
-		if cint(self.doc.is_pos):
-			self.validate_pos()
-			self.validate_write_off_account()
-			if cint(self.doc.update_stock):
-				get_obj('Stock Ledger').validate_serial_no(self, 'entries')
-				self.validate_item_code()
-				self.update_current_stock()
-		self.set_in_words()
-		if not self.doc.is_opening:
-			self.doc.is_opening = 'No'
-		self.set_aging_date()
-		self.clear_advances()
-		# Set against account
-		self.set_against_income_account()
-		self.validate_c_form()
-
-		
-# *************************************************** ON SUBMIT **********************************************
-	# Check Ref Document's docstatus
-	# -------------------------------
-	def check_prev_docstatus(self):
-		for d in getlist(self.doclist,'entries'):
-			if d.sales_order:
-				submitted = webnotes.conn.sql("select name from `tabSales Order` where docstatus = 1 and name = '%s'" % d.sales_order)
-				if not submitted:
-					msgprint("Sales Order : "+ cstr(d.sales_order) +" is not submitted")
-					raise Exception , "Validation Error."
-
-			if d.delivery_note:
-				submitted = webnotes.conn.sql("select name from `tabDelivery Note` where docstatus = 1 and name = '%s'" % d.delivery_note)
-				if not submitted:
-					msgprint("Delivery Note : "+ cstr(d.delivery_note) +" is not submitted")
-					raise Exception , "Validation Error."
-
-	#Set Actual Qty based on item code and warehouse
-	#------------------------------------------------------
-	def set_actual_qty(self):
-		for d in getlist(self.doclist, 'delivery_note_details'):
-			if d.item_code and d.warehouse:
-				actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code, d.warehouse))
-				d.actual_qty = actual_qty and flt(actual_qty[0][0]) or 0					
-
-	# Check qty in stock depends on item code and warehouse
-	#-------------------------------------------------------
-	def check_qty_in_stock(self):
-		for d in getlist(self.doclist, 'entries'):
-			is_stock_item = webnotes.conn.sql("select is_stock_item from `tabItem` where name = '%s'" % d.item_code)[0][0]
-			actual_qty = 0
-			if d.item_code and d.warehouse:
-				actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code, d.warehouse))
-				actual_qty = actual_qty and flt(actual_qty[0][0]) or 0
-
-			if is_stock_item == 'Yes' and flt(d.qty) > flt(actual_qty):
-				msgprint("For Item: " + cstr(d.item_code) + " at Warehouse: " + cstr(d.warehouse) + " Quantity: " + cstr(d.qty) +" is not Available. (Must be less than or equal to " + cstr(actual_qty) + " )")
-				raise Exception, "Validation Error"
-
-	
-
-	# ********************** Make Stock Entry ************************************
-	def make_sl_entry(self, d, wh, qty, in_value, update_stock):
-		st_uom = webnotes.conn.sql("select stock_uom from `tabItem` where name = '%s'"%d.item_code)
-		self.values.append({
-			'item_code'					 : d.item_code,
-			'warehouse'					 : wh,
-			'transaction_date'			: getdate(self.doc.modified).strftime('%Y-%m-%d'),
-			'posting_date'				: self.doc.posting_date,
-			'posting_time'				: self.doc.posting_time,
-			'voucher_type'				: 'Receivable Voucher',
-			'voucher_no'					: cstr(self.doc.name),
-			'voucher_detail_no'	 : cstr(d.name), 
-			'actual_qty'					: qty, 
-			'stock_uom'					 : st_uom and st_uom[0][0] or '',
-			'incoming_rate'			 : in_value,
-			'company'						 : self.doc.company,
-			'fiscal_year'				 : self.doc.fiscal_year,
-			'is_cancelled'				: (update_stock==1) and 'No' or 'Yes',
-			'batch_no'						: cstr(d.batch_no),
-			'serial_no'					 : d.serial_no
-		})		
-			
-
-	# UPDATE STOCK LEDGER
-	# ---------------------------------------------------------------------------
-	def update_stock_ledger(self, update_stock, clear = 0):
-		self.values = []
-		for d in getlist(self.doclist, 'entries'):
-			stock_item = webnotes.conn.sql("SELECT is_stock_item, is_sample_item FROM tabItem where name = '%s'"%(d.item_code), as_dict = 1) # stock ledger will be updated only if it is a stock item
-			if stock_item[0]['is_stock_item'] == "Yes":
-				# Reduce actual qty from warehouse
-				self.make_sl_entry( d, d.warehouse, - flt(d.qty) , 0, update_stock)
-		get_obj('Stock Ledger', 'Stock Ledger').update_stock(self.values, self.doc.amended_from and 'Yes' or 'No')
-
-
-	#-------------------POS Stock Updatation Part----------------------------------------------
-	def pos_update_stock(self):
-		self.check_qty_in_stock()	
-		self.update_stock_ledger(update_stock = 1)
-	
-	# ********** Get Actual Qty of item in warehouse selected *************
-	def get_actual_qty(self,args):
-		args = eval(args)
-		actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], args['warehouse']), as_dict=1)
-		ret = {
-			 'actual_qty' : actual_qty and flt(actual_qty[0]['actual_qty']) or 0
-		}
-		return ret
-
-	# Make GL Entries
-	# -------------------------
-	def make_gl_entries(self, is_cancel=0):
-		mapper = self.doc.is_pos and self.doc.write_off_account and 'POS with write off' or self.doc.is_pos and not self.doc.write_off_account and 'POS' or ''
-		update_outstanding = self.doc.is_pos and self.doc.write_off_account and 'No' or 'Yes'
-		get_obj(dt='GL Control').make_gl_entries(self.doc, self.doclist,cancel = is_cancel, use_mapper = mapper, update_outstanding = update_outstanding, merge_entries = cint(self.doc.is_pos) != 1 and 1 or 0)
-		
-
-	# On Submit
-	# ---------
-	def on_submit(self):
-		if cint(self.doc.is_pos) == 1:
-			if cint(self.doc.update_stock) == 1:
-				sl_obj = get_obj("Stock Ledger")
-				sl_obj.validate_serial_no_warehouse(self, 'entries')
-				sl_obj.update_serial_record(self, 'entries', is_submit = 1, is_incoming = 0)
-				self.pos_update_stock()
-		else:
-			self.check_prev_docstatus()
-			get_obj("Sales Common").update_prevdoc_detail(1,self)
-
-			# Check for Approving Authority
-			if not self.doc.recurring_id:
-				get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total, self)
-
-		# this sequence because outstanding may get -ve		
-		self.make_gl_entries()
-
-		if not cint(self.doc.is_pos) == 1:
-			self.update_against_document_in_jv()
-
-		self.update_c_form()
-
-
-	def update_c_form(self):
-		"""Update amended id in C-form"""
-		if self.doc.c_form_no and self.doc.amended_from:
-			webnotes.conn.sql("""update `tabC-Form Invoice Detail` set invoice_no = %s,
-					invoice_date = %s, territory = %s, net_total = %s,
-					grand_total = %s where invoice_no = %s and parent = %s""", (self.doc.name, self.doc.amended_from, self.doc.c_form_no))
-	
-
-			
-# *************************************************** ON CANCEL **********************************************
-	# Check Next Document's docstatus
-	# --------------------------------
-	def check_next_docstatus(self):
-		submit_jv = webnotes.conn.sql("select t1.name from `tabJournal Voucher` t1,`tabJournal Voucher Detail` t2 where t1.name = t2.parent and t2.against_invoice = '%s' and t1.docstatus = 1" % (self.doc.name))
-		if submit_jv:
-			msgprint("Journal Voucher : " + cstr(submit_jv[0][0]) + " has been created against " + cstr(self.doc.doctype) + ". So " + cstr(self.doc.doctype) + " cannot be Cancelled.")
-			raise Exception, "Validation Error."
-
-
-	# On Cancel
-	# ----------
-	def on_cancel(self):
-		if cint(self.doc.is_pos) == 1:
-			if cint(self.doc.update_stock) == 1:
-				get_obj('Stock Ledger').update_serial_record(self, 'entries', is_submit = 0, is_incoming = 0)
-				self.update_stock_ledger(update_stock = -1)
-		else:
-			sales_com_obj = get_obj(dt = 'Sales Common')
-			sales_com_obj.check_stop_sales_order(self)
-			self.check_next_docstatus()
-			sales_com_obj.update_prevdoc_detail(0,self)
-
-		self.make_gl_entries(is_cancel=1)
-
-	# Get Warehouse
-	def get_warehouse(self):
-		w = webnotes.conn.sql("select warehouse from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company))
-		w = w and w[0][0] or ''
-		if not w:
-			ps = webnotes.conn.sql("select name, warehouse from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % self.doc.company)
-			if not ps:
-				msgprint("To make POS entry, please create POS Setting from Setup --> Accounts --> POS Setting and refresh the system.")
-				raise Exception
-			elif not ps[0][1]:
-				msgprint("Please enter warehouse in POS Setting")
-			else:
-				w = ps[0][1]
-		return w
-
-	# on update
-	def on_update(self):
-		# Set default warehouse from pos setting
-		#----------------------------------------
-		if cint(self.doc.is_pos) == 1:
-			self.set_actual_qty()
-			w = self.get_warehouse()
-			if w:
-				for d in getlist(self.doclist, 'entries'):
-					if not d.warehouse:
-						d.warehouse = cstr(w)
-
-			if flt(self.doc.paid_amount) == 0: 
-				webnotes.conn.set(self.doc,'paid_amount',(flt(self.doc.grand_total) - flt(self.doc.write_off_amount)))
-
-		else:
-			webnotes.conn.set(self.doc,'paid_amount',0)
-
-		webnotes.conn.set(self.doc,'outstanding_amount',flt(self.doc.grand_total) - flt(self.doc.total_advance) - flt(self.doc.paid_amount) - flt(self.doc.write_off_amount))
-
-########################################################################
-# Repair Outstanding
-
-	def repair_rv_outstanding(self):
-		get_obj(dt = 'GL Control').repair_voucher_outstanding(self)
-
-
-	#-------------------------------------------------------------------------------------
-	def on_update_after_submit(self):
-		self.convert_into_recurring()
-		
-
-	def convert_into_recurring(self):
-		if self.doc.convert_into_recurring_invoice:
-			self.set_next_date()
-			if not self.doc.recurring_id:
-				webnotes.conn.set(self.doc, 'recurring_id', make_autoname('RECINV/.#####'))
-		elif self.doc.recurring_id:
-			webnotes.conn.sql("""update `tabReceivable Voucher` set convert_into_recurring_invoice = 0 where recurring_id = %s""", self.doc.recurring_id)
-
-	def set_next_date(self):
-		""" Set next date on which auto invoice will be created"""
-
-		if not self.doc.repeat_on_day_of_month:
-			msgprint("""Please enter 'Repeat on Day of Month' field value. \nThe day of the month on which auto invoice 
-						will be generated e.g. 05, 28 etc.""", raise_exception=1)
-
-		import datetime
-		m = getdate(self.doc.posting_date).month + 1
-		y = getdate(self.doc.posting_date).year
-		if m > 12:
-			m, y = 1, y+1
-		try:
-			next_date = datetime.date(y, m, cint(self.doc.repeat_on_day_of_month))
-		except:
-			import calendar
-			last_day = calendar.monthrange(y, m)[1]
-			next_date = datetime.date(y, m, last_day)
-		next_date = next_date.strftime("%Y-%m-%d")
-
-		webnotes.conn.set(self.doc, 'next_date', next_date)
diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt
deleted file mode 100644
index 9d84f21..0000000
--- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt
+++ /dev/null
@@ -1,1521 +0,0 @@
-# DocType, Receivable Voucher
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:18',
-		'docstatus': 0,
-		'modified': '2012-03-06 11:05:53',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Receivable Voucher',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': u'1330671142',
-		'change_log': u'1. Change in pull_details method dt.-26-06-2009',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'module': u'Accounts',
-		'name': '__common__',
-		'read_only_onload': 1,
-		'search_fields': u'posting_date, due_date, debit_to, fiscal_year, grand_total, outstanding_amount',
-		'section_style': u'Tabbed',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'subject': u'To %(customer_name)s worth %(currency)s %(grand_total_export)s due on %(due_date)s | %(outstanding_amount)s outstanding',
-		'version': 416
-	},
-
-	# These values are common for all DocFormat
-	{
-		'doctype': u'DocFormat',
-		'name': '__common__',
-		'parent': u'Receivable Voucher',
-		'parentfield': u'formats',
-		'parenttype': u'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': u'DocPerm',
-		'name': '__common__',
-		'parent': u'Receivable Voucher',
-		'parentfield': u'permissions',
-		'parenttype': u'DocType',
-		'read': 1
-	},
-
-	# DocType, Receivable Voucher
-	{
-		'doctype': 'DocType',
-		'name': u'Receivable Voucher'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Accounts Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Accounts Manager',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Accounts User',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Accounts User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'match': u'customer',
-		'permlevel': 0,
-		'role': u'Customer',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocFormat
-	{
-		'doctype': u'DocFormat',
-		'format': u'POS Invoice'
-	},
-
-	# DocFormat
-	{
-		'doctype': u'DocFormat',
-		'format': u'POS Invoice'
-	},
-
-	# DocFormat
-	{
-		'doctype': u'DocFormat',
-		'format': u'Sales Invoice Classic'
-	},
-
-	# DocFormat
-	{
-		'doctype': u'DocFormat',
-		'format': u'Sales Invoice Modern'
-	},
-
-	# DocFormat
-	{
-		'doctype': u'DocFormat',
-		'format': u'Sales Invoice Spartan'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Basic Info',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'print_hide': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'depends_on': u'eval:doc.retail_transaction!="Yes"',
-		'description': u'To manage multiple series please go to Setup > Manage Series',
-		'doctype': u'DocField',
-		'fieldname': u'naming_series',
-		'fieldtype': u'Select',
-		'label': u'Series',
-		'no_copy': 1,
-		'oldfieldname': u'naming_series',
-		'oldfieldtype': u'Select',
-		'options': u'INV\nINV/10-11/',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'is_pos',
-		'fieldtype': u'Check',
-		'label': u'Is POS',
-		'oldfieldname': u'is_pos',
-		'oldfieldtype': u'Check',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'default': u'1',
-		'depends_on': u'eval:doc.is_pos==1',
-		'doctype': u'DocField',
-		'fieldname': u'update_stock',
-		'fieldtype': u'Check',
-		'label': u'Update Stock',
-		'oldfieldname': u'update_stock',
-		'oldfieldtype': u'Check',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'The account to which you will pay (have paid) the money to.',
-		'doctype': u'DocField',
-		'fieldname': u'debit_to',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Debit To',
-		'oldfieldname': u'debit_to',
-		'oldfieldtype': u'Link',
-		'options': u'Account',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'customer',
-		'fieldtype': u'Link',
-		'hidden': 0,
-		'label': u'Customer',
-		'no_copy': 0,
-		'oldfieldname': u'customer',
-		'oldfieldtype': u'Link',
-		'options': u'Customer',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'customer_address',
-		'fieldtype': u'Link',
-		'label': u'Customer Address',
-		'options': u'Address',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'contact_person',
-		'fieldtype': u'Link',
-		'label': u'Contact Person',
-		'options': u'Contact',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'customer_name',
-		'fieldtype': u'Data',
-		'label': u'Name',
-		'oldfieldname': u'customer_name',
-		'oldfieldtype': u'Data',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'address_display',
-		'fieldtype': u'Small Text',
-		'label': u'Address',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'contact_display',
-		'fieldtype': u'Small Text',
-		'label': u'Contact',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'contact_mobile',
-		'fieldtype': u'Text',
-		'label': u'Mobile No',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'contact_email',
-		'fieldtype': u'Text',
-		'label': u'Contact Email',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'Today',
-		'description': u'The date at which current entry will get or has actually executed.',
-		'doctype': u'DocField',
-		'fieldname': u'posting_date',
-		'fieldtype': u'Date',
-		'in_filter': 1,
-		'label': u'Posting Date',
-		'no_copy': 1,
-		'oldfieldname': u'posting_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0,
-		'print_hide': 0,
-		'reqd': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'posting_time',
-		'fieldtype': u'Time',
-		'label': u'Posting Time',
-		'no_copy': 1,
-		'oldfieldname': u'posting_time',
-		'oldfieldtype': u'Time',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'Today',
-		'description': u'Enter the date by which payments from customer is expected against this invoice.',
-		'doctype': u'DocField',
-		'fieldname': u'due_date',
-		'fieldtype': u'Date',
-		'in_filter': 1,
-		'label': u'Due Date',
-		'no_copy': 1,
-		'oldfieldname': u'due_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'description': u'The date at which current entry is corrected in the system.',
-		'doctype': u'DocField',
-		'fieldname': u'amendment_date',
-		'fieldtype': u'Date',
-		'label': u'Amendment Date',
-		'no_copy': 1,
-		'oldfieldname': u'amendment_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'amended_from',
-		'fieldtype': u'Link',
-		'label': u'Amended From',
-		'no_copy': 1,
-		'oldfieldname': u'amended_from',
-		'oldfieldtype': u'Link',
-		'options': u'Receivable Voucher',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'mode_of_payment',
-		'fieldtype': u'Select',
-		'label': u'Mode of Payment',
-		'oldfieldname': u'mode_of_payment',
-		'oldfieldtype': u'Select',
-		'options': u'link:Mode of Payment',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'territory',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Territory',
-		'options': u'Territory',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'customer_group',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Customer Group',
-		'options': u'Customer Group',
-		'permlevel': 0,
-		'print_hide': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Items',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'price_list_name',
-		'fieldtype': u'Select',
-		'label': u'Price List',
-		'oldfieldname': u'price_list_name',
-		'oldfieldtype': u'Select',
-		'options': u'link:Price List',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Select the currency in which price list is maintained',
-		'doctype': u'DocField',
-		'fieldname': u'price_list_currency',
-		'fieldtype': u'Select',
-		'label': u'Price List Currency',
-		'options': u'link:Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u"Rate at which Price list currency is converted to customer's base currency",
-		'doctype': u'DocField',
-		'fieldname': u'plc_conversion_rate',
-		'fieldtype': u'Currency',
-		'label': u'Price List Currency Conversion Rate',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'permlevel': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'currency',
-		'fieldtype': u'Select',
-		'label': u'Currency',
-		'oldfieldname': u'currency',
-		'oldfieldtype': u'Select',
-		'options': u'link:Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'1.00',
-		'description': u"Rate at which Customer Currency is converted to customer's base currency",
-		'doctype': u'DocField',
-		'fieldname': u'conversion_rate',
-		'fieldtype': u'Currency',
-		'label': u'Conversion Rate',
-		'oldfieldname': u'conversion_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Select Items from Sales Order',
-		'doctype': u'DocField',
-		'fieldname': u'sales_order_main',
-		'fieldtype': u'Link',
-		'label': u'Sales Order',
-		'oldfieldname': u'sales_order_main',
-		'oldfieldtype': u'Link',
-		'options': u'Sales Order',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Select Items from Delivery Note',
-		'doctype': u'DocField',
-		'fieldname': u'delivery_note_main',
-		'fieldtype': u'Link',
-		'label': u'Delivery Note',
-		'oldfieldname': u'delivery_note_main',
-		'oldfieldtype': u'Link',
-		'options': u'Delivery Note',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Get Items',
-		'oldfieldtype': u'Button',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'options': u'Simple',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'entries',
-		'fieldtype': u'Table',
-		'label': u'Entries',
-		'oldfieldname': u'entries',
-		'oldfieldtype': u'Table',
-		'options': u'RV Detail',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Re-Calculate Values',
-		'oldfieldtype': u'Button',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'permlevel': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'description': u'Will be calculated automatically when you enter the details',
-		'doctype': u'DocField',
-		'fieldname': u'net_total',
-		'fieldtype': u'Currency',
-		'label': u'Net Total*',
-		'oldfieldname': u'net_total',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'depends_on': u'eval:doc.is_pos==1',
-		'doctype': u'DocField',
-		'fieldname': u'cash_bank_account',
-		'fieldtype': u'Link',
-		'label': u'Cash/Bank Account',
-		'oldfieldname': u'cash_bank_account',
-		'oldfieldtype': u'Link',
-		'options': u'Account',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'depends_on': u'eval:doc.is_pos==1',
-		'doctype': u'DocField',
-		'fieldname': u'paid_amount',
-		'fieldtype': u'Currency',
-		'label': u'Paid Amount',
-		'oldfieldname': u'paid_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'permlevel': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'depends_on': u'eval:doc.is_pos==1',
-		'doctype': u'DocField',
-		'fieldname': u'write_off_account',
-		'fieldtype': u'Link',
-		'label': u'Write Off Account',
-		'options': u'Account',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'depends_on': u'eval:doc.is_pos==1',
-		'doctype': u'DocField',
-		'fieldname': u'write_off_cost_center',
-		'fieldtype': u'Link',
-		'label': u'Write Off Cost Center',
-		'options': u'Cost Center',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'depends_on': u'eval:doc.is_pos==1',
-		'doctype': u'DocField',
-		'fieldname': u'write_off_amount',
-		'fieldtype': u'Currency',
-		'label': u'Write Off Amount',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Taxes',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'charge',
-		'fieldtype': u'Link',
-		'label': u'Charge',
-		'oldfieldname': u'charge',
-		'oldfieldtype': u'Link',
-		'options': u'Other Charges',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Get Charges',
-		'oldfieldtype': u'Button',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'other_charges',
-		'fieldtype': u'Table',
-		'label': u'Taxes1',
-		'oldfieldname': u'other_charges',
-		'oldfieldtype': u'Table',
-		'options': u'RV Tax Detail',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Calculate Charges',
-		'oldfieldtype': u'Button',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'other_charges_total',
-		'fieldtype': u'Currency',
-		'label': u'Total Charges',
-		'oldfieldname': u'other_charges_total',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'HTML',
-		'label': u'Other Charges Calculation',
-		'oldfieldtype': u'HTML',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Totals',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'print_hide': 1,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'grand_total',
-		'fieldtype': u'Currency',
-		'in_filter': 1,
-		'label': u'Grand Total',
-		'oldfieldname': u'grand_total',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'reqd': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'rounded_total',
-		'fieldtype': u'Currency',
-		'label': u'Rounded Total',
-		'oldfieldname': u'rounded_total',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'In Words will be visible once you save the Sales Invoice.',
-		'doctype': u'DocField',
-		'fieldname': u'in_words',
-		'fieldtype': u'Data',
-		'label': u'In Words',
-		'oldfieldname': u'in_words',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'total_advance',
-		'fieldtype': u'Currency',
-		'label': u'Total Advance',
-		'oldfieldname': u'total_advance',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'outstanding_amount',
-		'fieldtype': u'Currency',
-		'label': u'Outstanding Amount',
-		'no_copy': 1,
-		'oldfieldname': u'outstanding_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'print_hide': 1,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'grand_total_export',
-		'fieldtype': u'Currency',
-		'label': u'Grand Total (Export)',
-		'oldfieldname': u'grand_total_export',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'rounded_total_export',
-		'fieldtype': u'Currency',
-		'label': u'Rounded Total (Export)',
-		'oldfieldname': u'rounded_total_export',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'in_words_export',
-		'fieldtype': u'Data',
-		'label': u'In Words (Export)',
-		'oldfieldname': u'in_words_export',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'gross_profit',
-		'fieldtype': u'Currency',
-		'label': u'Gross Profit',
-		'oldfieldname': u'gross_profit',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'gross_profit_percent',
-		'fieldtype': u'Currency',
-		'label': u'Gross Profit (%)',
-		'oldfieldname': u'gross_profit_percent',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Terms',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'tc_name',
-		'fieldtype': u'Link',
-		'label': u'Select Terms',
-		'oldfieldname': u'tc_name',
-		'oldfieldtype': u'Link',
-		'options': u'Term',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Get Terms',
-		'oldfieldtype': u'Button',
-		'options': u'get_tc_details',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Server'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'HTML',
-		'label': u'Terms HTML',
-		'oldfieldtype': u'HTML',
-		'options': u'You can add Terms and Notes that will be printed in the Transaction',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'terms',
-		'fieldtype': u'Text Editor',
-		'label': u'Term Details',
-		'oldfieldname': u'terms',
-		'oldfieldtype': u'Text Editor',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'More Info',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'print_hide': 1,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'No',
-		'doctype': u'DocField',
-		'fieldname': u'is_opening',
-		'fieldtype': u'Select',
-		'in_filter': 1,
-		'label': u'Is Opening',
-		'oldfieldname': u'is_opening',
-		'oldfieldtype': u'Select',
-		'options': u'No\nYes',
-		'permlevel': 0,
-		'print_hide': 1,
-		'search_index': 0,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'aging_date',
-		'fieldtype': u'Date',
-		'label': u'Aging Date',
-		'oldfieldname': u'aging_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'letter_head',
-		'fieldtype': u'Select',
-		'label': u'Letter Head',
-		'oldfieldname': u'letter_head',
-		'oldfieldtype': u'Select',
-		'options': u'link:Letter Head',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'c_form_applicable',
-		'fieldtype': u'Select',
-		'label': u'C-Form Applicable',
-		'no_copy': 1,
-		'options': u'No\nYes',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'c_form_no',
-		'fieldtype': u'Link',
-		'label': u'C-Form No',
-		'no_copy': 1,
-		'options': u'C-Form',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'depends_on': u"eval:doc.source == 'Campaign'",
-		'doctype': u'DocField',
-		'fieldname': u'campaign',
-		'fieldtype': u'Link',
-		'label': u'Campaign',
-		'oldfieldname': u'campaign',
-		'oldfieldtype': u'Link',
-		'options': u'Campaign',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Track this Sales Invoice against any Project',
-		'doctype': u'DocField',
-		'fieldname': u'project_name',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Project Name',
-		'oldfieldname': u'project_name',
-		'oldfieldtype': u'Link',
-		'options': u'Project',
-		'permlevel': 0,
-		'search_index': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'select_print_heading',
-		'fieldtype': u'Link',
-		'label': u'Select Print Heading',
-		'no_copy': 1,
-		'oldfieldname': u'select_print_heading',
-		'oldfieldtype': u'Link',
-		'options': u'Print Heading',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'source',
-		'fieldtype': u'Select',
-		'label': u'Source',
-		'oldfieldname': u'source',
-		'oldfieldtype': u'Select',
-		'options': u"\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign",
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'company',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Company',
-		'oldfieldname': u'company',
-		'oldfieldtype': u'Link',
-		'options': u'Company',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'fiscal_year',
-		'fieldtype': u'Select',
-		'in_filter': 1,
-		'label': u'Fiscal Year',
-		'no_copy': 0,
-		'oldfieldname': u'fiscal_year',
-		'oldfieldtype': u'Select',
-		'options': u'link:Fiscal Year',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'depends_on': u'eval:!doc.__islocal',
-		'doctype': u'DocField',
-		'fieldname': u'cancel_reason',
-		'fieldtype': u'Data',
-		'label': u'Cancel Reason',
-		'oldfieldname': u'cancel_reason',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'remarks',
-		'fieldtype': u'Small Text',
-		'label': u'Remarks',
-		'no_copy': 1,
-		'oldfieldname': u'remarks',
-		'oldfieldtype': u'Text',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'depends_on': u'eval:!doc.is_pos',
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Advances',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Get Advances Received',
-		'oldfieldtype': u'Button',
-		'options': u'get_advances',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'advance_adjustment_details',
-		'fieldtype': u'Table',
-		'label': u'Advance Adjustment Detail',
-		'oldfieldname': u'advance_adjustment_details',
-		'oldfieldtype': u'Table',
-		'options': u'Advance Adjustment Detail',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Sales Team',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'print_hide': 1,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'sales_partner',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Sales Partner',
-		'oldfieldname': u'sales_partner',
-		'oldfieldtype': u'Link',
-		'options': u'Sales Partner',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'print_hide': 1,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'commission_rate',
-		'fieldtype': u'Currency',
-		'label': u'Commission Rate (%)',
-		'oldfieldname': u'commission_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'total_commission',
-		'fieldtype': u'Currency',
-		'label': u'Total Commission',
-		'oldfieldname': u'total_commission',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'options': u'Simple',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'sales_team',
-		'fieldtype': u'Table',
-		'label': u'Sales Team1',
-		'oldfieldname': u'sales_team',
-		'oldfieldtype': u'Table',
-		'options': u'Sales Team',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'depends_on': u'eval:doc.docstatus==1',
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Recurring Invoice',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'permlevel': 0,
-		'print_hide': 1,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': u'White:FFF',
-		'depends_on': u'eval:doc.docstatus==1',
-		'description': u'Check if recurring invoice, uncheck to stop recurring or put proper End Date',
-		'doctype': u'DocField',
-		'fieldname': u'convert_into_recurring_invoice',
-		'fieldtype': u'Check',
-		'label': u'Convert into Recurring Invoice',
-		'no_copy': 1,
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'depends_on': u'eval:doc.convert_into_recurring_invoice==1',
-		'description': u'The day of the month on which auto invoice will be generated e.g. 05, 28 etc ',
-		'doctype': u'DocField',
-		'fieldname': u'repeat_on_day_of_month',
-		'fieldtype': u'Data',
-		'label': u'Repeat on Day of Month',
-		'no_copy': 1,
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'depends_on': u'eval:doc.convert_into_recurring_invoice==1',
-		'description': u'The date on which recurring invoice will be stop',
-		'doctype': u'DocField',
-		'fieldname': u'end_date',
-		'fieldtype': u'Date',
-		'label': u'End Date',
-		'no_copy': 1,
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'no_copy': 0,
-		'permlevel': 0,
-		'print_hide': 1,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'depends_on': u'eval:doc.convert_into_recurring_invoice==1',
-		'description': u'Enter email id separated by commas, invoice will be mailed automatically on particular date',
-		'doctype': u'DocField',
-		'fieldname': u'notification_email_address',
-		'fieldtype': u'Small Text',
-		'label': u'Notification Email Address',
-		'no_copy': 1,
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'depends_on': u'eval:doc.convert_into_recurring_invoice==1',
-		'description': u'The unique id for tracking all recurring invoices ',
-		'doctype': u'DocField',
-		'fieldname': u'recurring_id',
-		'fieldtype': u'Data',
-		'label': u'Recurring Id',
-		'no_copy': 1,
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'depends_on': u'eval:doc.convert_into_recurring_invoice==1',
-		'description': u'The date on which next invoice will be generated ',
-		'doctype': u'DocField',
-		'fieldname': u'next_date',
-		'fieldtype': u'Date',
-		'label': u'Next Date',
-		'no_copy': 1,
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'against_income_account',
-		'fieldtype': u'Small Text',
-		'hidden': 1,
-		'label': u'Against Income Account',
-		'no_copy': 1,
-		'oldfieldname': u'against_income_account',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Repair Outstanding Amt',
-		'oldfieldtype': u'Button',
-		'options': u'repair_rv_outstanding',
-		'permlevel': 0,
-		'print_hide': 1
-	}
-]
diff --git a/erpnext/accounts/doctype/rv_detail/__init__.py b/erpnext/accounts/doctype/rv_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/doctype/rv_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/doctype/rv_detail/rv_detail.txt b/erpnext/accounts/doctype/rv_detail/rv_detail.txt
deleted file mode 100644
index 314dcd7..0000000
--- a/erpnext/accounts/doctype/rv_detail/rv_detail.txt
+++ /dev/null
@@ -1,435 +0,0 @@
-# DocType, RV Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:20',
-		'docstatus': 0,
-		'modified': '2012-03-05 15:01:04',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': u'INVD.######',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': u'Accounts',
-		'name': '__common__',
-		'section_style': u'Tray',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 29
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'RV Detail',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# DocType, RV Detail
-	{
-		'doctype': 'DocType',
-		'name': u'RV Detail'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_code',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Item',
-		'oldfieldname': u'item_code',
-		'oldfieldtype': u'Link',
-		'options': u'Item',
-		'permlevel': 0,
-		'print_hide': 0,
-		'reqd': 0,
-		'search_index': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_name',
-		'fieldtype': u'Data',
-		'in_filter': 0,
-		'label': u'Item Name',
-		'oldfieldname': u'item_name',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'description',
-		'fieldtype': u'Text',
-		'label': u'Description',
-		'oldfieldname': u'description',
-		'oldfieldtype': u'Text',
-		'permlevel': 0,
-		'reqd': 1,
-		'width': u'200px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'qty',
-		'fieldtype': u'Currency',
-		'label': u'Qty',
-		'oldfieldname': u'qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'reqd': 0,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'stock_uom',
-		'fieldtype': u'Data',
-		'label': u'UOM',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'ref_rate',
-		'fieldtype': u'Currency',
-		'label': u'Price List Rate',
-		'oldfieldname': u'ref_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 0,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'adj_rate',
-		'fieldtype': u'Float',
-		'label': u'Discount (%)',
-		'oldfieldname': u'adj_rate',
-		'oldfieldtype': u'Float',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'export_rate',
-		'fieldtype': u'Currency',
-		'label': u'Basic Rate',
-		'oldfieldname': u'export_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'export_amount',
-		'fieldtype': u'Currency',
-		'label': u'Amount',
-		'oldfieldname': u'export_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'base_ref_rate',
-		'fieldtype': u'Currency',
-		'label': u'Price List Rate*',
-		'oldfieldname': u'base_ref_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'basic_rate',
-		'fieldtype': u'Currency',
-		'in_filter': 0,
-		'label': u'Basic Rate*',
-		'oldfieldname': u'basic_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'search_index': 0,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'amount',
-		'fieldtype': u'Currency',
-		'label': u'Amount*',
-		'oldfieldname': u'amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'warehouse',
-		'fieldtype': u'Link',
-		'hidden': 0,
-		'label': u'Warehouse',
-		'oldfieldname': u'warehouse',
-		'oldfieldtype': u'Link',
-		'options': u'Warehouse',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'income_account',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Income Account',
-		'oldfieldname': u'income_account',
-		'oldfieldtype': u'Link',
-		'options': u'Account',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'trigger': u'Client',
-		'width': u'120px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'Purchase - TC',
-		'doctype': u'DocField',
-		'fieldname': u'cost_center',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Cost Center',
-		'oldfieldname': u'cost_center',
-		'oldfieldtype': u'Link',
-		'options': u'Cost Center',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 0,
-		'trigger': u'Client',
-		'width': u'120px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'serial_no',
-		'fieldtype': u'Small Text',
-		'in_filter': 1,
-		'label': u'Serial No',
-		'oldfieldname': u'serial_no',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 0,
-		'print_hide': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'batch_no',
-		'fieldtype': u'Link',
-		'label': u'Batch No',
-		'options': u'Batch',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_group',
-		'fieldtype': u'Link',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'Item Group',
-		'oldfieldname': u'item_group',
-		'oldfieldtype': u'Link',
-		'options': u'Item Group',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'brand',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'Brand Name',
-		'oldfieldname': u'brand',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'actual_qty',
-		'fieldtype': u'Currency',
-		'label': u'Available Qty at Warehouse',
-		'oldfieldname': u'actual_qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'delivered_qty',
-		'fieldtype': u'Currency',
-		'label': u'Delivered Qty',
-		'oldfieldname': u'delivered_qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'sales_order',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Sales Order',
-		'oldfieldname': u'sales_order',
-		'oldfieldtype': u'Link',
-		'options': u'Sales Order',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'so_detail',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'SO Detail ',
-		'oldfieldname': u'so_detail',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'delivery_note',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Delivery Note',
-		'oldfieldname': u'delivery_note',
-		'oldfieldtype': u'Link',
-		'options': u'Delivery Note',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'dn_detail',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'DN Detail',
-		'oldfieldname': u'dn_detail',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_tax_rate',
-		'fieldtype': u'Small Text',
-		'hidden': 1,
-		'label': u'Item Tax Rate',
-		'oldfieldname': u'item_tax_rate',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'clear_pending',
-		'fieldtype': u'Check',
-		'hidden': 1,
-		'label': u'Clear Pending',
-		'no_copy': 1,
-		'oldfieldname': u'clear_pending',
-		'oldfieldtype': u'Check',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'page_break',
-		'fieldtype': u'Check',
-		'label': u'Page Break',
-		'no_copy': 1,
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/rv_tax_detail/__init__.py b/erpnext/accounts/doctype/rv_tax_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/doctype/rv_tax_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/doctype/rv_tax_detail/rv_tax_detail.txt b/erpnext/accounts/doctype/rv_tax_detail/rv_tax_detail.txt
deleted file mode 100644
index 4a4c68a..0000000
--- a/erpnext/accounts/doctype/rv_tax_detail/rv_tax_detail.txt
+++ /dev/null
@@ -1,223 +0,0 @@
-# DocType, RV Tax Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:20',
-		'docstatus': 0,
-		'modified': '2012-02-23 15:49:43',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': u'INVTD.######',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'hide_heading': 1,
-		'istable': 1,
-		'module': u'Accounts',
-		'name': '__common__',
-		'section_style': u'Tray',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 20
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'RV Tax Detail',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# DocType, RV Tax Detail
-	{
-		'doctype': 'DocType',
-		'name': u'RV Tax Detail'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'charge_type',
-		'fieldtype': u'Select',
-		'label': u'Type',
-		'oldfieldname': u'charge_type',
-		'oldfieldtype': u'Select',
-		'options': u'\nActual\nOn Net Total\nOn Previous Row Amount\nOn Previous Row Total',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'account_head',
-		'fieldtype': u'Link',
-		'label': u'Account Head',
-		'oldfieldname': u'account_head',
-		'oldfieldtype': u'Link',
-		'options': u'Account',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'cost_center_other_charges',
-		'fieldtype': u'Link',
-		'label': u'Cost Center',
-		'oldfieldname': u'cost_center_other_charges',
-		'oldfieldtype': u'Link',
-		'options': u'Cost Center',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'description',
-		'fieldtype': u'Small Text',
-		'label': u'Description',
-		'oldfieldname': u'description',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 0,
-		'reqd': 1,
-		'width': u'300px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'rate',
-		'fieldtype': u'Currency',
-		'label': u'Rate',
-		'oldfieldname': u'rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'reqd': 0,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'tax_amount',
-		'fieldtype': u'Currency',
-		'label': u'Amount*',
-		'oldfieldname': u'tax_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'reqd': 0,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'total',
-		'fieldtype': u'Currency',
-		'label': u'Total*',
-		'oldfieldname': u'total',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'row_id',
-		'fieldtype': u'Data',
-		'hidden': 0,
-		'label': u'Enter Row',
-		'oldfieldname': u'row_id',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'item_wise_tax_detail',
-		'fieldtype': u'Small Text',
-		'hidden': 1,
-		'label': u'Item Wise Tax Detail ',
-		'oldfieldname': u'item_wise_tax_detail',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'parenttype',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'Parenttype',
-		'oldfieldname': u'parenttype',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'print_hide': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Cheating Field\nPlease do not delete ',
-		'doctype': u'DocField',
-		'fieldname': u'total_tax_amount',
-		'fieldtype': u'Currency',
-		'hidden': 1,
-		'label': u'Total Tax Amount',
-		'no_copy': 1,
-		'oldfieldname': u'total_tax_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1
-	},
-
-	# DocField
-	{
-		'description': u'Cheating Field\nPlease do not delete ',
-		'doctype': u'DocField',
-		'fieldname': u'total_amount',
-		'fieldtype': u'Currency',
-		'hidden': 1,
-		'label': u'Total Amount',
-		'no_copy': 1,
-		'oldfieldname': u'total_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 0,
-		'description': u'If checked, the tax amount will be considered as already included in the Print Rate / Print Amount',
-		'doctype': u'DocField',
-		'fieldname': u'included_in_print_rate',
-		'fieldtype': u'Check',
-		'label': u'Included in Print Rate',
-		'no_column': 0,
-		'no_copy': 1,
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/ledger_detail/__init__.py b/erpnext/accounts/doctype/sales_invoice/__init__.py
old mode 100755
new mode 100644
similarity index 100%
rename from erpnext/accounts/doctype/ledger_detail/__init__.py
rename to erpnext/accounts/doctype/sales_invoice/__init__.py
diff --git a/erpnext/accounts/doctype/sales_invoice/listview.js b/erpnext/accounts/doctype/sales_invoice/listview.js
new file mode 100644
index 0000000..c8030ef
--- /dev/null
+++ b/erpnext/accounts/doctype/sales_invoice/listview.js
@@ -0,0 +1,34 @@
+// render
+wn.doclistviews['Sales Invoice'] = wn.views.ListView.extend({
+	init: function(d) {
+		this._super(d);
+		this.fields = this.fields.concat([
+			"`tabSales Invoice`.customer_name", 
+			"ifnull(`tabSales Invoice`.outstanding_amount,0) as outstanding_amount", 
+			"ifnull(`tabSales Invoice`.grand_total,0) as grand_total", 
+			"`tabSales Invoice`.currency", 
+			"ifnull(`tabSales Invoice`.grand_total_export,0) as grand_total_export"
+		]);
+
+		this.stats = this.stats.concat(['company']);		
+	},
+	prepare_data: function(data) {
+		this._super(data);
+		data.paid = flt((data.grand_total - data.outstanding_amount) / data.grand_total * 100, 2);
+	},
+	columns: [
+		{width: '5%', content:'avatar'},
+		{width: '3%', content:'docstatus'},
+		{width: '15%', content:'name'},
+		{width: '37%', content:'tags+customer_name', css: {color:'#aaa'}},
+		{
+			width: '18%', 
+			content: function(parent, data) { 
+				$(parent).html(data.currency + ' ' + fmt_money(data.grand_total_export)) 
+			},
+			css: {'text-align':'right'}
+		},
+		{width: '10%', content: 'paid', type:'bar-graph', label:'Paid'},
+		{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
+	]
+});
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
new file mode 100644
index 0000000..cddb92e
--- /dev/null
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -0,0 +1,517 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+cur_frm.cscript.tname = "Sales Invoice Item";
+cur_frm.cscript.fname = "entries";
+cur_frm.cscript.other_fname = "other_charges";
+cur_frm.cscript.sales_team_fname = "sales_team";
+
+// print heading
+cur_frm.pformat.print_heading = 'Invoice';
+
+wn.require('erpnext/selling/doctype/sales_common/sales_common.js');
+wn.require('erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js');
+wn.require('erpnext/utilities/doctype/sms_control/sms_control.js');
+wn.require('erpnext/setup/doctype/notification_control/notification_control.js');
+
+// On Load
+// -------
+cur_frm.cscript.onload = function(doc,dt,dn) {
+	if(!doc.customer && doc.debit_to) get_field(dt, 'debit_to', dn).print_hide = 0;
+	if (doc.__islocal) {
+		//if(!doc.voucher_date) set_multiple(dt,dn,{voucher_date:get_today()});
+		if(!doc.due_date) set_multiple(dt,dn,{due_date:get_today()});
+		if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
+		if(!doc.currency && sys_defaults.currency) set_multiple(dt,dn,{currency:sys_defaults.currency});
+		if(!doc.price_list_currency) set_multiple(dt, dn, {price_list_currency: doc.currency, plc_conversion_rate: 1});
+
+ 		hide_field(['customer_address', 'contact_person','customer_name','address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory', 'customer_group']);
+	}
+}
+
+cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
+	var callback = function(doc, dt, dn) {
+		// called from mapper, update the account names for items and customer
+		var callback2 = function(doc, dt, dn) {
+			if(doc.customer && doc.__islocal) {
+				$c_obj(make_doclist(doc.doctype,doc.name),
+					'load_default_accounts','',
+					function(r,rt) {
+						refresh_field('entries');
+						cur_frm.cscript.customer(doc,dt,dn,onload=true);
+					}
+				);
+			}
+		}
+		// defined in sales_common.js
+		var callback1 = function(doc, dt, dn) {
+			//for previously created sales invoice, set required field related to pos	
+			cur_frm.cscript.update_item_details(doc, dt, dn, callback2);
+		}
+		
+		if(doc.is_pos ==1) cur_frm.cscript.is_pos(doc, dt, dn,callback1);
+		else cur_frm.cscript.update_item_details(doc, dt, dn, callback2);
+	}
+
+	cur_frm.cscript.hide_price_list_currency(doc, dt, dn, callback); 
+
+}
+
+
+// Hide Fields
+// ------------
+cur_frm.cscript.hide_fields = function(doc, cdt, cdn) {
+	par_flds = ['project_name', 'due_date', 'sales_order_main',
+	'delivery_note_main', 'get_items', 'is_opening', 'conversion_rate',
+	'source', 'cancel_reason', 'total_advance', 'gross_profit',
+	'gross_profit_percent', 'get_advances_received',
+	'advance_adjustment_details', 'sales_partner', 'commission_rate',
+	'total_commission'];
+	
+	item_flds_normal = ['sales_order', 'delivery_note']
+	item_flds_pos = ['warehouse', 'serial_no', 'batch_no', 'actual_qty', 'delivered_qty']
+	
+	if(cint(doc.is_pos) == 1) {
+		hide_field(par_flds);
+		$(cur_frm.fields_dict.payments_section.row.wrapper).toggle(true);
+		$(cur_frm.fields_dict.advances.row.wrapper).toggle(false);
+		for(f in item_flds_normal) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_normal[f], false);
+		for(f in item_flds_pos) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_pos[f], (doc.update_stock==1?true:false));
+	} else {
+		unhide_field(par_flds);
+		$(cur_frm.fields_dict.payments_section.row.wrapper).toggle(false);
+		$(cur_frm.fields_dict.advances.row.wrapper).toggle(true);
+		for(f in item_flds_normal) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_normal[f], true);
+		for(f in item_flds_pos) cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_pos[f], false);
+	}
+	if (doc.docstatus==1) $(cur_frm.fields_dict.recurring_invoice.row.wrapper).toggle(true);
+	else $(cur_frm.fields_dict.recurring_invoice.row.wrapper).toggle(false);
+
+	// India related fields
+	var cp = wn.control_panel;
+	if (cp.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']);
+	else hide_field(['c_form_applicable', 'c_form_no']);
+
+}
+
+
+// Refresh
+// -------
+cur_frm.cscript.refresh = function(doc, dt, dn) {
+	cur_frm.cscript.is_opening(doc, dt, dn);
+	cur_frm.cscript.hide_fields(doc, dt, dn);
+	// Show / Hide button
+	cur_frm.clear_custom_buttons();
+
+	if (!cur_frm.cscript.is_onload)	cur_frm.cscript.hide_price_list_currency(doc, dt, dn); 
+
+	if(doc.docstatus==1) {
+		cur_frm.add_custom_button('View Ledger', cur_frm.cscript.view_ledger_entry);
+		cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
+
+		if(doc.is_pos==1 && doc.update_stock!=1)
+			cur_frm.add_custom_button('Make Delivery', cur_frm.cscript['Make Delivery Note']);
+
+		if(doc.outstanding_amount!=0)
+			cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript.make_bank_voucher);
+	}
+}
+
+//fetch retail transaction related fields
+//--------------------------------------------
+cur_frm.cscript.is_pos = function(doc,dt,dn,callback){
+	cur_frm.cscript.hide_fields(doc, dt, dn);
+	if(doc.is_pos == 1){
+		if (!doc.company) {
+			msgprint("Please select company to proceed");
+			doc.is_pos = 0;
+			refresh_field('is_pos');
+		}
+		else {
+			var callback1 = function(r,rt){
+				if(callback) callback(doc, dt, dn);
+				cur_frm.refresh();
+			}
+			$c_obj(make_doclist(dt,dn),'set_pos_fields','',callback1);
+		}
+	}
+}
+
+
+cur_frm.cscript.update_stock = function(doc, dt, dn) {
+	cur_frm.cscript.hide_fields(doc, dt, dn);
+}
+
+
+cur_frm.cscript.warehouse = function(doc, cdt , cdn) {
+	var d = locals[cdt][cdn];
+	if (!d.item_code) {alert("please enter item code first"); return};
+	if (d.warehouse) {
+		arg = "{'item_code':'" + d.item_code + "','warehouse':'" + d.warehouse +"'}";
+		get_server_fields('get_actual_qty',arg,'entries',doc,cdt,cdn,1);
+	}
+}
+
+
+
+//Customer
+cur_frm.cscript.customer = function(doc,dt,dn,onload) {
+
+	var callback = function(r,rt) {
+			var callback2 = function(doc, dt, dn) {
+				doc = locals[dt][dn];
+				if(doc.debit_to && doc.posting_date){
+					get_server_fields('get_cust_and_due_date','','',doc,dt,dn,1,
+					function(doc, dt, dn) {
+						cur_frm.refresh();
+						cur_frm.cscript.price_list_name(doc, dt, dn);
+					});
+					
+				}
+			}
+			var doc = locals[cur_frm.doctype][cur_frm.docname];
+			get_server_fields('get_debit_to','','',doc, dt, dn, 0, callback2);
+	}
+	var args = onload ? 'onload':''
+	if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', args, callback);
+
+	if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+	
+}
+
+
+
+cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
+	if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
+}
+
+cur_frm.fields_dict.customer_address.on_new = function(dn) {
+	locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+	locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict.contact_person.on_new = function(dn) {
+	locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+	locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
+	return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+	return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+
+// Set Due Date = posting date + credit days
+cur_frm.cscript.debit_to = function(doc,dt,dn) {
+
+	var callback2 = function(r,rt) {
+			var doc = locals[cur_frm.doctype][cur_frm.docname];
+			cur_frm.refresh();
+	}
+
+	var callback = function(r,rt) {
+			var doc = locals[cur_frm.doctype][cur_frm.docname];
+			if(doc.customer) $c_obj(make_doclist(dt,dn), 'get_default_customer_address', '', callback2);
+			if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+			cur_frm.refresh();
+	}
+
+	if(doc.debit_to && doc.posting_date){
+		get_server_fields('get_cust_and_due_date','','',doc,dt,dn,1,callback);
+	}
+}
+
+
+
+//refresh advance amount
+//-------------------------------------------------
+
+
+cur_frm.cscript.write_off_outstanding_amount_automatically = function(doc) {
+	if (doc.write_off_outstanding_amount_automatically == 1) 
+		doc.write_off_amount = flt(doc.grand_total) - flt(doc.paid_amount);
+	
+	doc.outstanding_amount = flt(doc.grand_total) - flt(doc.paid_amount) - flt(doc.write_off_amount);
+	refresh_field(['write_off_amount', 'outstanding_amount']);
+}
+
+cur_frm.cscript.paid_amount = function(doc) {
+	cur_frm.cscript.write_off_outstanding_amount_automatically(doc);
+}
+
+cur_frm.cscript.write_off_amount = function(doc) {
+	cur_frm.cscript.write_off_outstanding_amount_automatically(doc);
+}
+
+
+//---- get customer details ----------------------------
+cur_frm.cscript.project_name = function(doc,cdt,cdn){
+	$c_obj(make_doclist(doc.doctype, doc.name),'pull_project_customer','', function(r,rt){
+		refresh_many(['customer', 'customer_name','customer_address', 'territory']);
+	});
+}
+
+//Set debit and credit to zero on adding new row
+//----------------------------------------------
+cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
+
+	cl = getchildren('Sales Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
+	acc = '';
+	cc = '';
+
+	for(var i = 0; i<cl.length; i++) {
+
+		if (cl[i].idx == 1){
+			acc = cl[i].income_account;
+			cc = cl[i].cost_center;
+		}
+		else{
+			if (! cl[i].income_account) { cl[i].income_account = acc; refresh_field('income_account', cl[i].name, 'entries');}
+			if (! cl[i].cost_center)	{cl[i].cost_center = cc;refresh_field('cost_center', cl[i].name, 'entries');}
+		}
+	}
+}
+
+cur_frm.cscript.is_opening = function(doc, dt, dn) {
+	hide_field('aging_date');
+	if (doc.is_opening == 'Yes') unhide_field('aging_date');
+}
+
+/* **************************** TRIGGERS ********************************** */
+
+// Get Items based on SO or DN Selected
+cur_frm.cscript.get_items = function(doc, dt, dn) {
+	var callback = function(r,rt) {
+		unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+		cur_frm.refresh();
+	}
+	get_server_fields('pull_details','','',doc, dt, dn,1,callback);
+}
+
+
+
+// Allocated Amount in advances table
+// -----------------------------------
+cur_frm.cscript.allocated_amount = function(doc,cdt,cdn){
+	cur_frm.cscript.calc_adjustment_amount(doc,cdt,cdn);
+}
+
+//Make Delivery Note Button
+//-----------------------------
+
+cur_frm.cscript['Make Delivery Note'] = function() {
+
+	var doc = cur_frm.doc
+	n = createLocal('Delivery Note');
+	$c('dt_map', args={
+		'docs':compress_doclist([locals['Delivery Note'][n]]),
+		'from_doctype':doc.doctype,
+		'to_doctype':'Delivery Note',
+		'from_docname':doc.name,
+		'from_to_list':"[['Sales Invoice','Delivery Note'],['Sales Invoice Item','Delivery Note Item'],['Sales Taxes and Charges','Sales Taxes and Charges'],['Sales Team','Sales Team']]"
+		}, function(r,rt) {
+			 loaddoc('Delivery Note', n);
+		}
+	);
+}
+
+
+
+// Make Bank Voucher Button
+// -------------------------
+cur_frm.cscript.make_bank_voucher = function(doc, dt, dn) {
+	$c('accounts.get_default_bank_account', { company: cur_frm.doc.company }, function(r, rt) {
+		if(!r.exc) {
+		  cur_frm.cscript.make_jv(cur_frm.doc, null, null, r.message);
+		}
+	});
+}
+
+
+/* ***************************** Get Query Functions ************************** */
+
+// Debit To
+// ---------
+cur_frm.fields_dict.debit_to.get_query = function(doc) {
+	return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
+}
+
+// Cash/bank account
+//------------------
+cur_frm.fields_dict.cash_bank_account.get_query = function(doc) {
+	return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
+}
+
+// Write off account
+//------------------
+cur_frm.fields_dict.write_off_account.get_query = function(doc) {
+	return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "Yes" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
+}
+
+// Write off cost center
+//-----------------------
+cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) {
+	return 'SELECT `tabCost Center`.name FROM `tabCost Center` WHERE `tabCost Center`.group_or_ledger="Ledger" AND `tabCost Center`.docstatus!=2 AND `tabCost Center`.company_name="'+doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s"'
+}
+
+//project name
+//--------------------------
+cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
+	var cond = '';
+	if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND';
+	return repl('SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND %(cond)s `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
+}
+
+//Territory
+//-----------------------------
+cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
+	return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"	ORDER BY	`tabTerritory`.`name` ASC LIMIT 50';
+}
+
+// Income Account in Details Table
+// --------------------------------
+cur_frm.fields_dict.entries.grid.get_field("income_account").get_query = function(doc) {
+	return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"';
+}
+
+// warehouse in detail table
+//----------------------------
+cur_frm.fields_dict['entries'].grid.get_field('warehouse').get_query= function(doc, cdt, cdn) {
+	var d = locals[cdt][cdn];
+	return "SELECT `tabBin`.`warehouse`, `tabBin`.`actual_qty` FROM `tabBin` WHERE `tabBin`.`item_code` = '"+ d.item_code +"' AND ifnull(`tabBin`.`actual_qty`,0) > 0 AND `tabBin`.`warehouse` like '%s' ORDER BY `tabBin`.`warehouse` DESC LIMIT 50";
+}
+
+// Cost Center in Details Table
+// -----------------------------
+cur_frm.fields_dict.entries.grid.get_field("cost_center").get_query = function(doc) {
+	return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY	`tabCost Center`.`name` ASC LIMIT 50';
+}
+
+// Sales Order
+// -----------
+cur_frm.fields_dict.sales_order_main.get_query = function(doc) {
+	if (doc.customer)
+		return 'SELECT DISTINCT `tabSales Order`.`name` FROM `tabSales Order` WHERE `tabSales Order`.company = "' + doc.company + '" and `tabSales Order`.`docstatus` = 1 and `tabSales Order`.`status` != "Stopped" and ifnull(`tabSales Order`.per_billed,0) < 100 and `tabSales Order`.`customer` =	"' + doc.customer + '" and `tabSales Order`.%(key)s LIKE "%s" ORDER BY `tabSales Order`.`name` DESC LIMIT 50';
+	else
+		return 'SELECT DISTINCT `tabSales Order`.`name` FROM `tabSales Order` WHERE `tabSales Order`.company = "' + doc.company + '" and `tabSales Order`.`docstatus` = 1 and `tabSales Order`.`status` != "Stopped" and ifnull(`tabSales Order`.per_billed,0) < 100 and `tabSales Order`.%(key)s LIKE "%s" ORDER BY `tabSales Order`.`name` DESC LIMIT 50';
+}
+
+// Delivery Note
+// --------------
+cur_frm.fields_dict.delivery_note_main.get_query = function(doc) {
+	if (doc.customer)
+		return 'SELECT DISTINCT `tabDelivery Note`.`name` FROM `tabDelivery Note` WHERE `tabDelivery Note`.company = "' + doc.company + '" and `tabDelivery Note`.`docstatus` = 1 and ifnull(`tabDelivery Note`.per_billed,0) < 100 and `tabDelivery Note`.`customer` =	"' + doc.customer + '" and `tabDelivery Note`.%(key)s LIKE "%s" ORDER BY `tabDelivery Note`.`name` DESC LIMIT 50';
+	else
+		return 'SELECT DISTINCT `tabDelivery Note`.`name` FROM `tabDelivery Note` WHERE `tabDelivery Note`.company = "' + doc.company + '" and `tabDelivery Note`.`docstatus` = 1 and ifnull(`tabDelivery Note`.per_billed,0) < 100 and `tabDelivery Note`.%(key)s LIKE "%s" ORDER BY `tabDelivery Note`.`name` DESC LIMIT 50';
+}
+
+
+
+cur_frm.cscript.income_account = function(doc, cdt, cdn){
+	var d = locals[cdt][cdn];
+	if(d.income_account){
+		var cl = getchildren('Sales Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
+		for(var i = 0; i < cl.length; i++){
+			if(!cl[i].income_account) cl[i].income_account = d.income_account;
+		}
+	}
+	refresh_field(cur_frm.cscript.fname);
+}
+
+
+cur_frm.cscript.cost_center = function(doc, cdt, cdn){
+	var d = locals[cdt][cdn];
+	if(d.cost_center){
+		var cl = getchildren('Sales Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
+		for(var i = 0; i < cl.length; i++){
+			if(!cl[i].cost_center) cl[i].cost_center = d.cost_center;
+		}
+	}
+	refresh_field(cur_frm.cscript.fname);
+}
+
+/* **************************************** Utility Functions *************************************** */
+
+// Details Calculation
+// --------------------
+cur_frm.cscript.calc_adjustment_amount = function(doc,cdt,cdn) {
+	var doc = locals[doc.doctype][doc.name];
+	var el = getchildren('Sales Invoice Advance',doc.name,'advance_adjustment_details');
+	var total_adjustment_amt = 0
+	for(var i in el) {
+			total_adjustment_amt += flt(el[i].allocated_amount)
+	}
+	doc.total_advance = flt(total_adjustment_amt);
+	doc.outstanding_amount = flt(doc.grand_total) - flt(total_adjustment_amt) - flt(doc.paid_amount) - flt(doc.write_off_amount);
+	refresh_many(['total_advance','outstanding_amount']);
+}
+
+
+// Make Journal Voucher
+// --------------------
+cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
+	var jv = LocalDB.create('Journal Voucher');
+	jv = locals['Journal Voucher'][jv];
+	jv.voucher_type = 'Bank Voucher';
+
+	jv.company = doc.company;
+	jv.remark = repl('Payment received against invoice %(vn)s for %(rem)s', {vn:doc.name, rem:doc.remarks});
+	jv.fiscal_year = doc.fiscal_year;
+
+	// debit to creditor
+	var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
+	d1.account = doc.debit_to;
+	d1.credit = doc.outstanding_amount;
+	d1.against_invoice = doc.name;
+
+
+	// credit to bank
+	var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
+	d1.account = bank_account;
+	d1.debit = doc.outstanding_amount;
+
+	loaddoc('Journal Voucher', jv.name);
+}
+
+
+/****************** Get Accounting Entry *****************/
+cur_frm.cscript.view_ledger_entry = function(){
+	var callback = function(report){
+		report.set_filter('GL Entry', 'Voucher No',cur_frm.doc.name);
+		report.dt.run();
+	}
+	loadreport('GL Entry','General Ledger', callback);
+}
+
+// Default values for recurring invoices
+cur_frm.cscript.convert_into_recurring_invoice = function(doc) {
+	if (doc.convert_into_recurring_invoice) {
+		doc.repeat_on_day_of_month = doc.posting_date.split('-')[2];
+		doc.notification_email_address = [doc.owner, doc.contact_email].join(', ');
+		refresh_field(['repeat_on_day_of_month', 'notification_email_address']);
+	}		
+}
+
+cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
+	var args = {
+		type: 'Sales Invoice',
+		doctype: 'Sales Invoice'
+	}
+	cur_frm.cscript.notify(doc, args);
+}
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
new file mode 100644
index 0000000..19a8c74
--- /dev/null
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -0,0 +1,717 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr,date_diff, default_fields, flt, fmt_money, formatdate, generate_hash,getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common,month_name, now, nowdate, replace_newlines, sendmail, set_default,str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+session = webnotes.session
+
+# -----------------------------------------------------------------------------------------
+
+from utilities.transaction_base import TransactionBase
+
+class DocType(TransactionBase):
+	def __init__(self,d,dl):
+		self.doc, self.doclist = d, dl
+		self.log = []
+		self.tname = 'Sales Invoice Item'
+		self.fname = 'entries'
+
+
+	# Autoname
+	# ---------
+	def autoname(self):
+		self.doc.name = make_autoname(self.doc.naming_series+ '.#####')
+
+
+
+# ********************************* Trigger Functions ******************************
+
+	#Set retail related fields from pos settings
+	#-------------------------------------------------------------------------
+	def set_pos_fields(self):
+		pos = webnotes.conn.sql("select * from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1)
+		if not pos:
+			pos = webnotes.conn.sql("select * from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1)
+		if pos:
+			val = webnotes.conn.sql("select name from `tabAccount` where name = %s and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr()))
+			val = val and val[0][0] or ''
+			if not val: val = pos and pos[0]['customer_account'] or ''
+			if not self.doc.debit_to:
+				webnotes.conn.set(self.doc,'debit_to',val)
+			
+			lst = ['territory','naming_series','currency','charge','letter_head','tc_name','price_list_name','company','select_print_heading','cash_bank_account']
+				
+			for i in lst:
+				val = pos and pos[0][i] or ''
+				self.doc.fields[i] = val
+			self.set_pos_item_values()
+			
+			val = pos and flt(pos[0]['conversion_rate']) or 0	
+			self.doc.conversion_rate = val
+
+			#fetch terms	
+			if self.doc.tc_name:	 self.get_tc_details()
+			
+			#fetch charges
+			if self.doc.charge:		self.get_other_charges()
+
+
+	# Set default values related to pos for previously created sales invoice.
+	# -------------------------------------------------------------------------- 
+	def set_pos_item_values(self):
+		if cint(self.doc.is_pos) ==1:
+			dtl = webnotes.conn.sql("select income_account, warehouse, cost_center from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1)
+			if not dtl:
+				dtl = webnotes.conn.sql("select income_account, warehouse, cost_center from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1)
+			for d in getlist(self.doclist,'entries'):
+				# overwrite if mentioned in item
+				item = webnotes.conn.sql("select default_income_account, default_sales_cost_center, default_warehouse from tabItem where name = '%s'" %(d.item_code), as_dict=1)
+				d.income_account = item and item[0]['default_income_account'] or dtl and dtl[0]['income_account'] or d.income_account
+				d.cost_center = item and item[0]['default_sales_cost_center'] or dtl and dtl[0]['cost_center'] or d.cost_center
+				d.warehouse = item and item[0]['default_warehouse'] or dtl and dtl[0]['warehouse'] or d.warehouse
+
+
+			
+	# Get Account Head to which amount needs to be Debited based on Customer
+	# ----------------------------------------------------------------------
+	def get_customer_account(self):
+		acc_head = webnotes.conn.sql("select name from `tabAccount` where (name = %s or (master_name = %s and master_type = 'customer')) and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr(),self.doc.customer))
+		if acc_head and acc_head[0][0]:
+			return acc_head[0][0]
+		else:
+			msgprint("%s does not have an Account Head in %s. You must first create it from the Customer Master" % (self.doc.customer, self.doc.company))
+
+	def get_debit_to(self):
+		acc_head = self.get_customer_account()
+		return acc_head and {'debit_to' : acc_head} or {}
+
+
+
+	# Set Due Date = Posting Date + Credit Days
+	# -----------------------------------------
+	def get_cust_and_due_date(self):
+		credit_days = 0
+		if self.doc.debit_to:
+			credit_days = webnotes.conn.sql("select credit_days from `tabAccount` where name='%s' and docstatus != 2" % self.doc.debit_to)
+			credit_days = credit_days and cint(credit_days[0][0]) or 0
+		if self.doc.company and not credit_days:
+			credit_days = webnotes.conn.sql("select credit_days from `tabCompany` where name='%s'" % self.doc.company)
+			credit_days = credit_days and cint(credit_days[0][0]) or 0
+		# Customer has higher priority than company
+		# i.e.if not entered in customer will take credit days from company
+		self.doc.due_date = add_days(cstr(self.doc.posting_date), credit_days)
+		
+		if self.doc.debit_to:
+			self.doc.customer = webnotes.conn.get_value('Account',self.doc.debit_to,'master_name')
+
+
+	# Pull Details of Delivery Note or Sales Order Selected
+	# ------------------------------------------------------
+	def pull_details(self):
+		# Delivery Note
+		if self.doc.delivery_note_main:
+			self.validate_prev_docname('delivery note')
+			self.doc.clear_table(self.doclist,'other_charges')			
+			self.doclist = get_obj('DocType Mapper', 'Delivery Note-Sales Invoice').dt_map('Delivery Note', 'Sales Invoice', self.doc.delivery_note_main, self.doc, self.doclist, "[['Delivery Note', 'Sales Invoice'],['Delivery Note Item', 'Sales Invoice Item'],['Sales Taxes and Charges','Sales Taxes and Charges'],['Sales Team','Sales Team']]")			
+			self.get_income_account('entries')
+		# Sales Order
+		elif self.doc.sales_order_main:
+			self.validate_prev_docname('sales order')
+			self.doc.clear_table(self.doclist,'other_charges')
+			get_obj('DocType Mapper', 'Sales Order-Sales Invoice').dt_map('Sales Order', 'Sales Invoice', self.doc.sales_order_main, self.doc, self.doclist, "[['Sales Order', 'Sales Invoice'],['Sales Order Item', 'Sales Invoice Item'],['Sales Taxes and Charges','Sales Taxes and Charges'], ['Sales Team', 'Sales Team']]")
+			self.get_income_account('entries')
+			
+		ret = self.get_debit_to()
+		self.doc.debit_to = ret.get('debit_to')
+					
+	# onload pull income account
+	# --------------------------
+	def load_default_accounts(self):
+		"""
+			Loads default accounts from items, customer when called from mapper
+		"""
+		self.get_income_account('entries')
+		
+	def get_income_account(self,doctype):		
+		for d in getlist(self.doclist, doctype):			
+			if d.item_code:
+				item = webnotes.conn.sql("select default_income_account, default_sales_cost_center from tabItem where name = '%s'" %(d.item_code), as_dict=1)
+				d.income_account = item and item[0]['default_income_account'] or ''
+				d.cost_center = item and item[0]['default_sales_cost_center'] or ''				
+
+	# Item Details
+	# -------------
+	def get_item_details(self, args=None):
+		import json
+		args = args and json.loads(args) or {}
+		if args.get('item_code'):
+			ret = get_obj('Sales Common').get_item_details(args, self)
+			return self.get_pos_details(args, ret)
+		else:
+			obj = get_obj('Sales Common')
+			for doc in self.doclist:
+				if doc.fields.get('item_code'):
+					arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'), 
+						'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
+
+					ret = obj.get_item_details(arg, self)
+					ret = self.get_pos_details(arg, ret)
+					for r in ret:
+						if not doc.fields.get(r):
+							doc.fields[r] = ret[r]		
+
+
+	def get_pos_details(self, args, ret):
+		if args['item_code'] and cint(self.doc.is_pos) == 1:
+			dtl = webnotes.conn.sql("select income_account, warehouse, cost_center from `tabPOS Setting` where user = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1)				 
+			if not dtl:
+				dtl = webnotes.conn.sql("select income_account, warehouse, cost_center from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1)
+
+			item = webnotes.conn.sql("select default_income_account, default_sales_cost_center, default_warehouse from tabItem where name = '%s'" %(args['item_code']), as_dict=1)
+
+			ret['income_account'] = item and item[0].get('default_income_account') \
+				or (dtl and dtl[0].get('income_account') or args.get('income_account'))
+
+			ret['cost_center'] = item and item[0].get('default_sales_cost_center') \
+				or (dtl and dtl[0].get('cost_center') or args.get('cost_center'))
+			
+			ret['warehouse'] = item and item[0].get('default_warehouse') \
+				or (dtl and dtl[0].get('warehouse') or args.get('warehouse'))
+
+			if ret['warehouse']:
+				actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], ret['warehouse']))
+				ret['actual_qty']= actual_qty and flt(actual_qty[0][0]) or 0
+		return ret
+
+
+	# Fetch ref rate from item master as per selected price list
+	def get_adj_percent(self, arg=''):
+		get_obj('Sales Common').get_adj_percent(self)
+
+
+	# Get tax rate if account type is tax
+	# ------------------------------------
+	def get_rate(self,arg):
+		get_obj('Sales Common').get_rate(arg)
+		
+		
+	# Get Commission rate of Sales Partner
+	# -------------------------------------
+	def get_comm_rate(self, sales_partner):
+		return get_obj('Sales Common').get_comm_rate(sales_partner, self)	
+	
+ 
+	# GET TERMS & CONDITIONS
+	# -------------------------------------
+	def get_tc_details(self):
+		return get_obj('Sales Common').get_tc_details(self)
+
+	# Load Default Charges
+	# ----------------------------------------------------------
+	def load_default_taxes(self):
+		return get_obj('Sales Common').load_default_taxes(self)
+
+	# Get Sales Taxes and Charges Master Details
+	# --------------------------
+	def get_other_charges(self):
+		return get_obj('Sales Common').get_other_charges(self)
+		
+
+	# Get Advances
+	# -------------
+	def get_advances(self):
+		get_obj('GL Control').get_advances(self, self.doc.debit_to, 'Sales Invoice Advance', 'advance_adjustment_details', 'credit')
+
+	#pull project customer
+	#-------------------------
+	def pull_project_customer(self):
+		res = webnotes.conn.sql("select customer from `tabProject` where name = '%s'"%self.doc.project_name)
+		if res:
+			get_obj('DocType Mapper', 'Project-Sales Invoice').dt_map('Project', 'Sales Invoice', self.doc.project_name, self.doc, self.doclist, "[['Project', 'Sales Invoice']]")
+
+# ********************************** Server Utility Functions ******************************
+	
+	# Get Company Abbr.
+	# ------------------
+	def get_company_abbr(self):
+		return webnotes.conn.sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
+		
+	
+	# Check whether sales order / delivery note items already pulled
+	#----------------------------------------------------------------
+	def validate_prev_docname(self,doctype):
+		for d in getlist(self.doclist, 'entries'): 
+			if doctype == 'delivery note' and self.doc.delivery_note_main == d.delivery_note:
+				msgprint(cstr(self.doc.delivery_note_main) + " delivery note details have already been pulled.")
+				raise Exception , "Validation Error. Delivery note details have already been pulled."
+			elif doctype == 'sales order' and self.doc.sales_order_main == d.sales_order and not d.delivery_note:
+				msgprint(cstr(self.doc.sales_order_main) + " sales order details have already been pulled.")
+				raise Exception , "Validation Error. Sales order details have already been pulled."
+
+
+	#-----------------------------------------------------------------
+	def update_against_document_in_jv(self):
+		"""
+			Links invoice and advance voucher:
+				1. cancel advance voucher
+				2. split into multiple rows if partially adjusted, assign against voucher
+				3. submit advance voucher
+		"""
+		
+		lst = []
+		for d in getlist(self.doclist, 'advance_adjustment_details'):
+			if flt(d.allocated_amount) > 0:
+				args = {
+					'voucher_no' : d.journal_voucher, 
+					'voucher_detail_no' : d.jv_detail_no, 
+					'against_voucher_type' : 'Sales Invoice', 
+					'against_voucher'  : self.doc.name,
+					'account' : self.doc.debit_to, 
+					'is_advance' : 'Yes', 
+					'dr_or_cr' : 'credit', 
+					'unadjusted_amt' : flt(d.advance_amount),
+					'allocated_amt' : flt(d.allocated_amount)
+				}
+				lst.append(args)
+		
+		if lst:
+			get_obj('GL Control').reconcile_against_document(lst)
+	
+	
+	# ------------------------------------------------------------------------
+	def validate_customer(self):
+		"""
+			Validate customer name with SO and DN
+		"""
+		for d in getlist(self.doclist,'entries'):
+			dt = d.delivery_note and 'Delivery Note' or d.sales_order and 'Sales Order' or ''
+			if dt:
+				dt_no = d.delivery_note or d.sales_order
+				cust = webnotes.conn.sql("select customer from `tab%s` where name = %s" % (dt, '%s'), dt_no)
+				if cust and cstr(cust[0][0]) != cstr(self.doc.customer):
+					msgprint("Customer %s does not match with customer of %s: %s." %(self.doc.customer, dt, dt_no), raise_exception=1)
+			
+
+	# Validates Debit To Account and Customer Matches
+	# ------------------------------------------------
+	def validate_debit_to_acc(self):
+		if self.doc.customer and not cint(self.doc.is_pos):
+			acc_head = webnotes.conn.sql("select name from `tabAccount` where name = %s and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr()))
+			if acc_head and acc_head[0][0]:
+				if not cstr(acc_head[0][0]) == cstr(self.doc.debit_to):
+					msgprint("Debit To %s do not match with Customer %s for Company %s i.e. %s" %(self.doc.debit_to,self.doc.customer,self.doc.company,cstr(acc_head[0][0])))
+					raise Exception, "Validation Error "
+			if not acc_head:
+				 msgprint("%s does not have an Account Head in %s. You must first create it from the Customer Master" % (self.doc.customer, self.doc.company))
+				 raise Exception, "Validation Error "
+
+
+	# Validate Debit To Account
+	# 1. Account Exists
+	# 2. Is a Debit Account
+	# 3. Is a PL Account
+	# ---------------------------
+	def validate_debit_acc(self):
+		acc = webnotes.conn.sql("select debit_or_credit, is_pl_account from tabAccount where name = '%s' and docstatus != 2" % self.doc.debit_to)
+		if not acc:
+			msgprint("Account: "+ self.doc.debit_to + " does not exist")
+			raise Exception
+		elif acc[0][0] and acc[0][0] != 'Debit':
+			msgprint("Account: "+ self.doc.debit_to + " is not a debit account")
+			raise Exception
+		elif acc[0][1] and acc[0][1] != 'No':
+			msgprint("Account: "+ self.doc.debit_to + " is a pl account")
+			raise Exception
+
+
+	# Validate Fixed Asset Account and whether Income Account Entered Exists
+	# -----------------------------------------------------------------------
+	def validate_fixed_asset_account(self):
+		for d in getlist(self.doclist,'entries'):
+			item = webnotes.conn.sql("select name,is_asset_item,is_sales_item from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life >	now())"% d.item_code)
+			acc =	webnotes.conn.sql("select account_type from `tabAccount` where name = '%s' and docstatus != 2" % d.income_account)
+			if not acc:
+				msgprint("Account: "+d.income_account+" does not exist in the system")
+				raise Exception
+			elif item and item[0][1] == 'Yes' and not acc[0][0] == 'Fixed Asset Account':
+				msgprint("Please select income head with account type 'Fixed Asset Account' as Item %s is an asset item" % d.item_code)
+				raise Exception
+
+
+
+	# Set totals in words
+	#--------------------
+	def set_in_words(self):
+		dcc = TransactionBase().get_company_currency(self.doc.company)
+		self.doc.in_words = get_obj('Sales Common').get_total_in_words(dcc, self.doc.rounded_total)
+		self.doc.in_words_export = get_obj('Sales Common').get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
+
+	# Clear Advances
+	# --------------
+	def clear_advances(self):
+		get_obj('GL Control').clear_advances(self, 'Sales Invoice Advance','advance_adjustment_details')
+
+
+	# set aging date
+	#-------------------
+	def set_aging_date(self):
+		if self.doc.is_opening != 'Yes':
+			self.doc.aging_date = self.doc.posting_date
+		elif not self.doc.aging_date:
+			msgprint("Aging Date is mandatory for opening entry")
+			raise Exception
+			
+
+	# Set against account for debit to account
+	#------------------------------------------
+	def set_against_income_account(self):
+		against_acc = []
+		for d in getlist(self.doclist, 'entries'):
+			if d.income_account not in against_acc:
+				against_acc.append(d.income_account)
+		self.doc.against_income_account = ','.join(against_acc)
+
+	def add_remarks(self):
+		if not self.doc.remarks: self.doc.remarks = 'No Remarks'
+
+	#check in manage account if sales order / delivery note required or not.
+	def so_dn_required(self):
+		dict = {'Sales Order':'so_required','Delivery Note':'dn_required'}
+		for i in dict:	
+			res = webnotes.conn.sql("select value from `tabSingles` where doctype = 'Global Defaults' and field = '%s'"%dict[i])
+			if res and res[0][0] == 'Yes':
+				for d in getlist(self.doclist,'entries'):
+					if not d.fields[i.lower().replace(' ','_')]:
+						msgprint("%s No. required against item %s"%(i,d.item_code))
+						raise Exception
+
+	#check for does customer belong to same project as entered..
+	#-------------------------------------------------------------------------------------------------
+	def validate_proj_cust(self):
+		if self.doc.project_name and self.doc.customer:
+			res = webnotes.conn.sql("select name from `tabProject` where name = '%s' and (customer = '%s' or ifnull(customer,'')='')"%(self.doc.project_name, self.doc.customer))
+			if not res:
+				msgprint("Customer - %s does not belong to project - %s. \n\nIf you want to use project for multiple customers then please make customer details blank in that project."%(self.doc.customer,self.doc.project_name))
+				raise Exception
+
+	def validate_pos(self):
+		if not self.doc.cash_bank_account:
+			msgprint("Cash/Bank Account is mandatory for POS entry")
+			raise Exception
+		if (flt(self.doc.paid_amount) + flt(self.doc.write_off_amount) - round(flt(self.doc.grand_total), 2))>0.001:
+			msgprint("(Paid amount + Write Off Amount) can not be greater than Grand Total")
+			raise Exception
+
+
+	# ********* UPDATE CURRENT STOCK *****************************
+	def update_current_stock(self):
+		for d in getlist(self.doclist, 'entries'):
+			bin = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
+			d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
+
+	def validate_item_code(self):
+		for d in getlist(self.doclist, 'entries'):
+			if not d.item_code:
+				msgprint("Please enter Item Code at line no : %s to update stock for POS or remove check from Update Stock in Basic Info Tab." % (d.idx))
+				raise Exception
+
+	# Validate Write Off Account
+	# -------------------------------
+	def validate_write_off_account(self):
+		if flt(self.doc.write_off_amount) and not self.doc.write_off_account:
+			msgprint("Please enter Write Off Account", raise_exception=1)
+
+
+	def validate_c_form(self):
+		""" Blank C-form no if C-form applicable marked as 'No'"""
+		if self.doc.amended_from and self.doc.c_form_applicable == 'No' and self.doc.c_form_no:
+			webnotes.conn.sql("""delete from `tabC-Form Invoice Detail` where invoice_no = %s
+					and parent = %s""", (self.doc.amended_from,	self.doc.c_form_no))
+
+			webnotes.conn.set(self.doc, 'c_form_no', '')
+	 
+	# VALIDATE
+	# ====================================================================================
+	def validate(self):
+		self.so_dn_required()
+		#self.dn_required()
+		self.validate_proj_cust()
+		sales_com_obj = get_obj('Sales Common')
+		sales_com_obj.check_stop_sales_order(self)
+		sales_com_obj.check_active_sales_items(self)
+		sales_com_obj.check_conversion_rate(self)
+		sales_com_obj.validate_max_discount(self, 'entries')	 #verify whether rate is not greater than tolerance
+		sales_com_obj.get_allocated_sum(self)	# this is to verify that the allocated % of sales persons is 100%
+		sales_com_obj.validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
+		self.validate_customer()
+		self.validate_debit_to_acc()
+		self.validate_debit_acc()
+		self.validate_fixed_asset_account()
+		self.add_remarks()
+		if cint(self.doc.is_pos):
+			self.validate_pos()
+			self.validate_write_off_account()
+			if cint(self.doc.update_stock):
+				get_obj('Stock Ledger').validate_serial_no(self, 'entries')
+				self.validate_item_code()
+				self.update_current_stock()
+		self.set_in_words()
+		if not self.doc.is_opening:
+			self.doc.is_opening = 'No'
+		self.set_aging_date()
+		self.clear_advances()
+		# Set against account
+		self.set_against_income_account()
+		self.validate_c_form()
+
+		
+# *************************************************** ON SUBMIT **********************************************
+	# Check Ref Document's docstatus
+	# -------------------------------
+	def check_prev_docstatus(self):
+		for d in getlist(self.doclist,'entries'):
+			if d.sales_order:
+				submitted = webnotes.conn.sql("select name from `tabSales Order` where docstatus = 1 and name = '%s'" % d.sales_order)
+				if not submitted:
+					msgprint("Sales Order : "+ cstr(d.sales_order) +" is not submitted")
+					raise Exception , "Validation Error."
+
+			if d.delivery_note:
+				submitted = webnotes.conn.sql("select name from `tabDelivery Note` where docstatus = 1 and name = '%s'" % d.delivery_note)
+				if not submitted:
+					msgprint("Delivery Note : "+ cstr(d.delivery_note) +" is not submitted")
+					raise Exception , "Validation Error."
+
+	#Set Actual Qty based on item code and warehouse
+	#------------------------------------------------------
+	def set_actual_qty(self):
+		for d in getlist(self.doclist, 'delivery_note_details'):
+			if d.item_code and d.warehouse:
+				actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code, d.warehouse))
+				d.actual_qty = actual_qty and flt(actual_qty[0][0]) or 0					
+
+	# Check qty in stock depends on item code and warehouse
+	#-------------------------------------------------------
+	def check_qty_in_stock(self):
+		for d in getlist(self.doclist, 'entries'):
+			is_stock_item = webnotes.conn.sql("select is_stock_item from `tabItem` where name = '%s'" % d.item_code)[0][0]
+			actual_qty = 0
+			if d.item_code and d.warehouse:
+				actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code, d.warehouse))
+				actual_qty = actual_qty and flt(actual_qty[0][0]) or 0
+
+			if is_stock_item == 'Yes' and flt(d.qty) > flt(actual_qty):
+				msgprint("For Item: " + cstr(d.item_code) + " at Warehouse: " + cstr(d.warehouse) + " Quantity: " + cstr(d.qty) +" is not Available. (Must be less than or equal to " + cstr(actual_qty) + " )")
+				raise Exception, "Validation Error"
+
+	
+
+	# ********************** Make Stock Entry ************************************
+	def make_sl_entry(self, d, wh, qty, in_value, update_stock):
+		st_uom = webnotes.conn.sql("select stock_uom from `tabItem` where name = '%s'"%d.item_code)
+		self.values.append({
+			'item_code'					 : d.item_code,
+			'warehouse'					 : wh,
+			'transaction_date'			: getdate(self.doc.modified).strftime('%Y-%m-%d'),
+			'posting_date'				: self.doc.posting_date,
+			'posting_time'				: self.doc.posting_time,
+			'voucher_type'				: 'Sales Invoice',
+			'voucher_no'					: cstr(self.doc.name),
+			'voucher_detail_no'	 : cstr(d.name), 
+			'actual_qty'					: qty, 
+			'stock_uom'					 : st_uom and st_uom[0][0] or '',
+			'incoming_rate'			 : in_value,
+			'company'						 : self.doc.company,
+			'fiscal_year'				 : self.doc.fiscal_year,
+			'is_cancelled'				: (update_stock==1) and 'No' or 'Yes',
+			'batch_no'						: cstr(d.batch_no),
+			'serial_no'					 : d.serial_no
+		})		
+			
+
+	# UPDATE STOCK LEDGER
+	# ---------------------------------------------------------------------------
+	def update_stock_ledger(self, update_stock, clear = 0):
+		self.values = []
+		for d in getlist(self.doclist, 'entries'):
+			stock_item = webnotes.conn.sql("SELECT is_stock_item, is_sample_item FROM tabItem where name = '%s'"%(d.item_code), as_dict = 1) # stock ledger will be updated only if it is a stock item
+			if stock_item[0]['is_stock_item'] == "Yes":
+				# Reduce actual qty from warehouse
+				self.make_sl_entry( d, d.warehouse, - flt(d.qty) , 0, update_stock)
+		get_obj('Stock Ledger', 'Stock Ledger').update_stock(self.values, self.doc.amended_from and 'Yes' or 'No')
+
+
+	#-------------------POS Stock Updatation Part----------------------------------------------
+	def pos_update_stock(self):
+		self.check_qty_in_stock()	
+		self.update_stock_ledger(update_stock = 1)
+	
+	# ********** Get Actual Qty of item in warehouse selected *************
+	def get_actual_qty(self,args):
+		args = eval(args)
+		actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], args['warehouse']), as_dict=1)
+		ret = {
+			 'actual_qty' : actual_qty and flt(actual_qty[0]['actual_qty']) or 0
+		}
+		return ret
+
+	# Make GL Entries
+	# -------------------------
+	def make_gl_entries(self, is_cancel=0):
+		mapper = self.doc.is_pos and self.doc.write_off_account and 'POS with write off' or self.doc.is_pos and not self.doc.write_off_account and 'POS' or ''
+		update_outstanding = self.doc.is_pos and self.doc.write_off_account and 'No' or 'Yes'
+		get_obj(dt='GL Control').make_gl_entries(self.doc, self.doclist,cancel = is_cancel, use_mapper = mapper, update_outstanding = update_outstanding, merge_entries = cint(self.doc.is_pos) != 1 and 1 or 0)
+		
+
+	# On Submit
+	# ---------
+	def on_submit(self):
+		if cint(self.doc.is_pos) == 1:
+			if cint(self.doc.update_stock) == 1:
+				sl_obj = get_obj("Stock Ledger")
+				sl_obj.validate_serial_no_warehouse(self, 'entries')
+				sl_obj.update_serial_record(self, 'entries', is_submit = 1, is_incoming = 0)
+				self.pos_update_stock()
+		else:
+			self.check_prev_docstatus()
+			get_obj("Sales Common").update_prevdoc_detail(1,self)
+
+			# Check for Approving Authority
+			if not self.doc.recurring_id:
+				get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total, self)
+
+		# this sequence because outstanding may get -ve		
+		self.make_gl_entries()
+
+		if not cint(self.doc.is_pos) == 1:
+			self.update_against_document_in_jv()
+
+		self.update_c_form()
+
+
+	def update_c_form(self):
+		"""Update amended id in C-form"""
+		if self.doc.c_form_no and self.doc.amended_from:
+			webnotes.conn.sql("""update `tabC-Form Invoice Detail` set invoice_no = %s,
+					invoice_date = %s, territory = %s, net_total = %s,
+					grand_total = %s where invoice_no = %s and parent = %s""", (self.doc.name, self.doc.amended_from, self.doc.c_form_no))
+	
+
+			
+# *************************************************** ON CANCEL **********************************************
+	# Check Next Document's docstatus
+	# --------------------------------
+	def check_next_docstatus(self):
+		submit_jv = webnotes.conn.sql("select t1.name from `tabJournal Voucher` t1,`tabJournal Voucher Detail` t2 where t1.name = t2.parent and t2.against_invoice = '%s' and t1.docstatus = 1" % (self.doc.name))
+		if submit_jv:
+			msgprint("Journal Voucher : " + cstr(submit_jv[0][0]) + " has been created against " + cstr(self.doc.doctype) + ". So " + cstr(self.doc.doctype) + " cannot be Cancelled.")
+			raise Exception, "Validation Error."
+
+
+	# On Cancel
+	# ----------
+	def on_cancel(self):
+		if cint(self.doc.is_pos) == 1:
+			if cint(self.doc.update_stock) == 1:
+				get_obj('Stock Ledger').update_serial_record(self, 'entries', is_submit = 0, is_incoming = 0)
+				self.update_stock_ledger(update_stock = -1)
+		else:
+			sales_com_obj = get_obj(dt = 'Sales Common')
+			sales_com_obj.check_stop_sales_order(self)
+			self.check_next_docstatus()
+			sales_com_obj.update_prevdoc_detail(0,self)
+
+		self.make_gl_entries(is_cancel=1)
+
+	# Get Warehouse
+	def get_warehouse(self):
+		w = webnotes.conn.sql("select warehouse from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company))
+		w = w and w[0][0] or ''
+		if not w:
+			ps = webnotes.conn.sql("select name, warehouse from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % self.doc.company)
+			if not ps:
+				msgprint("To make POS entry, please create POS Setting from Setup --> Accounts --> POS Setting and refresh the system.")
+				raise Exception
+			elif not ps[0][1]:
+				msgprint("Please enter warehouse in POS Setting")
+			else:
+				w = ps[0][1]
+		return w
+
+	# on update
+	def on_update(self):
+		# Set default warehouse from pos setting
+		#----------------------------------------
+		if cint(self.doc.is_pos) == 1:
+			self.set_actual_qty()
+			w = self.get_warehouse()
+			if w:
+				for d in getlist(self.doclist, 'entries'):
+					if not d.warehouse:
+						d.warehouse = cstr(w)
+
+			if flt(self.doc.paid_amount) == 0: 
+				webnotes.conn.set(self.doc,'paid_amount',(flt(self.doc.grand_total) - flt(self.doc.write_off_amount)))
+
+		else:
+			webnotes.conn.set(self.doc,'paid_amount',0)
+
+		webnotes.conn.set(self.doc,'outstanding_amount',flt(self.doc.grand_total) - flt(self.doc.total_advance) - flt(self.doc.paid_amount) - flt(self.doc.write_off_amount))
+
+	#-------------------------------------------------------------------------------------
+	def on_update_after_submit(self):
+		self.convert_into_recurring()
+		
+
+	def convert_into_recurring(self):
+		if self.doc.convert_into_recurring_invoice:
+			self.set_next_date()
+			if not self.doc.recurring_id:
+				webnotes.conn.set(self.doc, 'recurring_id', make_autoname('RECINV/.#####'))
+		elif self.doc.recurring_id:
+			webnotes.conn.sql("""update `tabSales Invoice` set convert_into_recurring_invoice = 0 where recurring_id = %s""", self.doc.recurring_id)
+
+	def set_next_date(self):
+		""" Set next date on which auto invoice will be created"""
+
+		if not self.doc.repeat_on_day_of_month:
+			msgprint("""Please enter 'Repeat on Day of Month' field value. \nThe day of the month on which auto invoice 
+						will be generated e.g. 05, 28 etc.""", raise_exception=1)
+
+		import datetime
+		m = getdate(self.doc.posting_date).month + 1
+		y = getdate(self.doc.posting_date).year
+		if m > 12:
+			m, y = 1, y+1
+		try:
+			next_date = datetime.date(y, m, cint(self.doc.repeat_on_day_of_month))
+		except:
+			import calendar
+			last_day = calendar.monthrange(y, m)[1]
+			next_date = datetime.date(y, m, last_day)
+		next_date = next_date.strftime("%Y-%m-%d")
+
+		webnotes.conn.set(self.doc, 'next_date', next_date)
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt b/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt
new file mode 100644
index 0000000..6e76145
--- /dev/null
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt
@@ -0,0 +1,1520 @@
+# DocType, Sales Invoice
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-04-13 11:56:18',
+		'docstatus': 0,
+		'modified': '2012-04-20 11:52:36',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': u'1330671142',
+		'allow_attach': 1,
+		'change_log': u'1. Change in pull_details method dt.-26-06-2009',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'is_submittable': 1,
+		'module': u'Accounts',
+		'name': '__common__',
+		'read_only_onload': 1,
+		'search_fields': u'posting_date, due_date, debit_to, fiscal_year, grand_total, outstanding_amount',
+		'section_style': u'Tabbed',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'subject': u'To %(customer_name)s worth %(currency)s %(grand_total_export)s due on %(due_date)s | %(outstanding_amount)s outstanding',
+		'version': 1
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Sales Invoice',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Sales Invoice',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1
+	},
+
+	# DocType, Sales Invoice
+	{
+		'doctype': 'DocType',
+		'name': u'Sales Invoice'
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Accounts Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Accounts Manager',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Accounts User',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Accounts User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'match': u'customer',
+		'permlevel': 0,
+		'role': u'Customer'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'basic_info',
+		'fieldtype': u'Section Break',
+		'label': u'Basic Info',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'print_hide': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'depends_on': u'eval:doc.retail_transaction!="Yes"',
+		'description': u'To manage multiple series please go to Setup > Manage Series',
+		'doctype': u'DocField',
+		'fieldname': u'naming_series',
+		'fieldtype': u'Select',
+		'label': u'Series',
+		'no_copy': 1,
+		'oldfieldname': u'naming_series',
+		'oldfieldtype': u'Select',
+		'options': u'INV\nINV/10-11/',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'is_pos',
+		'fieldtype': u'Check',
+		'label': u'Is POS',
+		'oldfieldname': u'is_pos',
+		'oldfieldtype': u'Check',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'default': u'1',
+		'depends_on': u'eval:doc.is_pos==1',
+		'doctype': u'DocField',
+		'fieldname': u'update_stock',
+		'fieldtype': u'Check',
+		'label': u'Update Stock',
+		'oldfieldname': u'update_stock',
+		'oldfieldtype': u'Check',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'The account to which you will pay (have paid) the money to.',
+		'doctype': u'DocField',
+		'fieldname': u'debit_to',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Debit To',
+		'oldfieldname': u'debit_to',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'customer',
+		'fieldtype': u'Link',
+		'hidden': 0,
+		'label': u'Customer',
+		'no_copy': 0,
+		'oldfieldname': u'customer',
+		'oldfieldtype': u'Link',
+		'options': u'Customer',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'customer_address',
+		'fieldtype': u'Link',
+		'label': u'Customer Address',
+		'options': u'Address',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'contact_person',
+		'fieldtype': u'Link',
+		'label': u'Contact Person',
+		'options': u'Contact',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'customer_name',
+		'fieldtype': u'Data',
+		'label': u'Name',
+		'oldfieldname': u'customer_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'address_display',
+		'fieldtype': u'Small Text',
+		'label': u'Address',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'contact_display',
+		'fieldtype': u'Small Text',
+		'label': u'Contact',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'contact_mobile',
+		'fieldtype': u'Text',
+		'label': u'Mobile No',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'contact_email',
+		'fieldtype': u'Text',
+		'label': u'Contact Email',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'Today',
+		'description': u'The date at which current entry will get or has actually executed.',
+		'doctype': u'DocField',
+		'fieldname': u'posting_date',
+		'fieldtype': u'Date',
+		'in_filter': 1,
+		'label': u'Posting Date',
+		'no_copy': 1,
+		'oldfieldname': u'posting_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'print_hide': 0,
+		'reqd': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'posting_time',
+		'fieldtype': u'Time',
+		'label': u'Posting Time',
+		'no_copy': 1,
+		'oldfieldname': u'posting_time',
+		'oldfieldtype': u'Time',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'Today',
+		'description': u'Enter the date by which payments from customer is expected against this invoice.',
+		'doctype': u'DocField',
+		'fieldname': u'due_date',
+		'fieldtype': u'Date',
+		'in_filter': 1,
+		'label': u'Due Date',
+		'no_copy': 1,
+		'oldfieldname': u'due_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'description': u'The date at which current entry is corrected in the system.',
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
+		'label': u'Amendment Date',
+		'no_copy': 1,
+		'oldfieldname': u'amendment_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Link',
+		'label': u'Amended From',
+		'no_copy': 1,
+		'oldfieldname': u'amended_from',
+		'oldfieldtype': u'Link',
+		'options': u'Sales Invoice',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'mode_of_payment',
+		'fieldtype': u'Select',
+		'label': u'Mode of Payment',
+		'oldfieldname': u'mode_of_payment',
+		'oldfieldtype': u'Select',
+		'options': u'link:Mode of Payment',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'territory',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Territory',
+		'options': u'Territory',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'customer_group',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Customer Group',
+		'options': u'Customer Group',
+		'permlevel': 0,
+		'print_hide': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'items',
+		'fieldtype': u'Section Break',
+		'label': u'Items',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'price_list_name',
+		'fieldtype': u'Select',
+		'label': u'Price List',
+		'oldfieldname': u'price_list_name',
+		'oldfieldtype': u'Select',
+		'options': u'link:Price List',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Select the currency in which price list is maintained',
+		'doctype': u'DocField',
+		'fieldname': u'price_list_currency',
+		'fieldtype': u'Select',
+		'label': u'Price List Currency',
+		'options': u'link:Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u"Rate at which Price list currency is converted to customer's base currency",
+		'doctype': u'DocField',
+		'fieldname': u'plc_conversion_rate',
+		'fieldtype': u'Currency',
+		'label': u'Price List Currency Conversion Rate',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break2',
+		'fieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'currency',
+		'fieldtype': u'Select',
+		'label': u'Currency',
+		'oldfieldname': u'currency',
+		'oldfieldtype': u'Select',
+		'options': u'link:Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'1.00',
+		'description': u"Rate at which Customer Currency is converted to customer's base currency",
+		'doctype': u'DocField',
+		'fieldname': u'conversion_rate',
+		'fieldtype': u'Currency',
+		'label': u'Conversion Rate',
+		'oldfieldname': u'conversion_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Select Items from Sales Order',
+		'doctype': u'DocField',
+		'fieldname': u'sales_order_main',
+		'fieldtype': u'Link',
+		'label': u'Sales Order',
+		'oldfieldname': u'sales_order_main',
+		'oldfieldtype': u'Link',
+		'options': u'Sales Order',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Select Items from Delivery Note',
+		'doctype': u'DocField',
+		'fieldname': u'delivery_note_main',
+		'fieldtype': u'Link',
+		'label': u'Delivery Note',
+		'oldfieldname': u'delivery_note_main',
+		'oldfieldtype': u'Link',
+		'options': u'Delivery Note',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'get_items',
+		'fieldtype': u'Button',
+		'label': u'Get Items',
+		'oldfieldtype': u'Button',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'section_break0',
+		'fieldtype': u'Section Break',
+		'options': u'Simple',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'entries',
+		'fieldtype': u'Table',
+		'label': u'Entries',
+		'oldfieldname': u'entries',
+		'oldfieldtype': u'Table',
+		'options': u'Sales Invoice Item',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'recalculate_values',
+		'fieldtype': u'Button',
+		'label': u'Re-Calculate Values',
+		'oldfieldtype': u'Button',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'description': u'Will be calculated automatically when you enter the details',
+		'doctype': u'DocField',
+		'fieldname': u'net_total',
+		'fieldtype': u'Currency',
+		'label': u'Net Total*',
+		'oldfieldname': u'net_total',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'taxes',
+		'fieldtype': u'Section Break',
+		'label': u'Taxes and Charges',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'charge',
+		'fieldtype': u'Link',
+		'label': u'Taxes and Charges',
+		'oldfieldname': u'charge',
+		'oldfieldtype': u'Link',
+		'options': u'Sales Taxes and Charges Master',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'get_charges',
+		'fieldtype': u'Button',
+		'label': u'Get Taxes and Charges',
+		'oldfieldtype': u'Button',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'other_charges',
+		'fieldtype': u'Table',
+		'label': u'Taxes and Charges1',
+		'oldfieldname': u'other_charges',
+		'oldfieldtype': u'Table',
+		'options': u'Sales Taxes and Charges',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'calculate_charges',
+		'fieldtype': u'Button',
+		'label': u'Calculate Taxes and Charges',
+		'oldfieldtype': u'Button',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'other_charges_total',
+		'fieldtype': u'Currency',
+		'label': u'Total Taxes and Charges',
+		'oldfieldname': u'other_charges_total',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'other_charges_calculation',
+		'fieldtype': u'HTML',
+		'label': u'Taxes and Charges Calculation',
+		'oldfieldtype': u'HTML',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'totals',
+		'fieldtype': u'Section Break',
+		'label': u'Totals',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'column_break5',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'print_hide': 1,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'grand_total',
+		'fieldtype': u'Currency',
+		'in_filter': 1,
+		'label': u'Grand Total',
+		'oldfieldname': u'grand_total',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'reqd': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'rounded_total',
+		'fieldtype': u'Currency',
+		'label': u'Rounded Total',
+		'oldfieldname': u'rounded_total',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'In Words will be visible once you save the Sales Invoice.',
+		'doctype': u'DocField',
+		'fieldname': u'in_words',
+		'fieldtype': u'Data',
+		'label': u'In Words',
+		'oldfieldname': u'in_words',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'total_advance',
+		'fieldtype': u'Currency',
+		'label': u'Total Advance',
+		'oldfieldname': u'total_advance',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'outstanding_amount',
+		'fieldtype': u'Currency',
+		'label': u'Outstanding Amount',
+		'no_copy': 1,
+		'oldfieldname': u'outstanding_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'column_break6',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'print_hide': 1,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'grand_total_export',
+		'fieldtype': u'Currency',
+		'label': u'Grand Total (Export)',
+		'oldfieldname': u'grand_total_export',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'rounded_total_export',
+		'fieldtype': u'Currency',
+		'label': u'Rounded Total (Export)',
+		'oldfieldname': u'rounded_total_export',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'in_words_export',
+		'fieldtype': u'Data',
+		'label': u'In Words (Export)',
+		'oldfieldname': u'in_words_export',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'gross_profit',
+		'fieldtype': u'Currency',
+		'label': u'Gross Profit',
+		'oldfieldname': u'gross_profit',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'gross_profit_percent',
+		'fieldtype': u'Currency',
+		'label': u'Gross Profit (%)',
+		'oldfieldname': u'gross_profit_percent',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'payments_section',
+		'fieldtype': u'Section Break',
+		'label': u'Payments',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'column_break3',
+		'fieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'paid_amount',
+		'fieldtype': u'Currency',
+		'label': u'Paid Amount',
+		'oldfieldname': u'paid_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'cash_bank_account',
+		'fieldtype': u'Link',
+		'label': u'Cash/Bank Account',
+		'oldfieldname': u'cash_bank_account',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'column_break4',
+		'fieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'write_off_outstanding_amount_automatically',
+		'fieldtype': u'Check',
+		'label': u'Write Off Outstanding Amount Automatically',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'write_off_amount',
+		'fieldtype': u'Currency',
+		'label': u'Write Off Amount',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'write_off_account',
+		'fieldtype': u'Link',
+		'label': u'Write Off Account',
+		'options': u'Account',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'write_off_cost_center',
+		'fieldtype': u'Link',
+		'label': u'Write Off Cost Center',
+		'options': u'Cost Center',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'terms_section_break',
+		'fieldtype': u'Section Break',
+		'label': u'Terms and Conditions',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'tc_name',
+		'fieldtype': u'Link',
+		'label': u'Select Terms and Conditions',
+		'oldfieldname': u'tc_name',
+		'oldfieldtype': u'Link',
+		'options': u'Terms and Conditions',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'get_terms',
+		'fieldtype': u'Button',
+		'label': u'Get Terms and Conditions',
+		'oldfieldtype': u'Button',
+		'options': u'get_tc_details',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Server'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'terms_html',
+		'fieldtype': u'HTML',
+		'label': u'Terms and Conditions HTML',
+		'oldfieldtype': u'HTML',
+		'options': u'You can add Terms and Notes that will be printed in the Transaction',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'terms',
+		'fieldtype': u'Text Editor',
+		'label': u'Terms and Conditions Details',
+		'oldfieldname': u'terms',
+		'oldfieldtype': u'Text Editor',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'more_info',
+		'fieldtype': u'Section Break',
+		'label': u'More Info',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'column_break7',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'print_hide': 1,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'No',
+		'doctype': u'DocField',
+		'fieldname': u'is_opening',
+		'fieldtype': u'Select',
+		'in_filter': 1,
+		'label': u'Is Opening',
+		'oldfieldname': u'is_opening',
+		'oldfieldtype': u'Select',
+		'options': u'No\nYes',
+		'permlevel': 0,
+		'print_hide': 1,
+		'search_index': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'aging_date',
+		'fieldtype': u'Date',
+		'label': u'Aging Date',
+		'oldfieldname': u'aging_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'letter_head',
+		'fieldtype': u'Select',
+		'label': u'Letter Head',
+		'oldfieldname': u'letter_head',
+		'oldfieldtype': u'Select',
+		'options': u'link:Letter Head',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'c_form_applicable',
+		'fieldtype': u'Select',
+		'label': u'C-Form Applicable',
+		'no_copy': 1,
+		'options': u'No\nYes',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'c_form_no',
+		'fieldtype': u'Link',
+		'label': u'C-Form No',
+		'no_copy': 1,
+		'options': u'C-Form',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'depends_on': u"eval:doc.source == 'Campaign'",
+		'doctype': u'DocField',
+		'fieldname': u'campaign',
+		'fieldtype': u'Link',
+		'label': u'Campaign',
+		'oldfieldname': u'campaign',
+		'oldfieldtype': u'Link',
+		'options': u'Campaign',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Track this Sales Invoice against any Project',
+		'doctype': u'DocField',
+		'fieldname': u'project_name',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Project Name',
+		'oldfieldname': u'project_name',
+		'oldfieldtype': u'Link',
+		'options': u'Project',
+		'permlevel': 0,
+		'search_index': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'column_break8',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'select_print_heading',
+		'fieldtype': u'Link',
+		'label': u'Select Print Heading',
+		'no_copy': 1,
+		'oldfieldname': u'select_print_heading',
+		'oldfieldtype': u'Link',
+		'options': u'Print Heading',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'source',
+		'fieldtype': u'Select',
+		'label': u'Source',
+		'oldfieldname': u'source',
+		'oldfieldtype': u'Select',
+		'options': u"\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign",
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Company',
+		'oldfieldname': u'company',
+		'oldfieldtype': u'Link',
+		'options': u'Company',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
+		'in_filter': 1,
+		'label': u'Fiscal Year',
+		'no_copy': 0,
+		'oldfieldname': u'fiscal_year',
+		'oldfieldtype': u'Select',
+		'options': u'link:Fiscal Year',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'cancel_reason',
+		'fieldtype': u'Data',
+		'label': u'Cancel Reason',
+		'oldfieldname': u'cancel_reason',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'remarks',
+		'fieldtype': u'Small Text',
+		'label': u'Remarks',
+		'no_copy': 1,
+		'oldfieldname': u'remarks',
+		'oldfieldtype': u'Text',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'advances',
+		'fieldtype': u'Section Break',
+		'label': u'Advances',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'get_advances_received',
+		'fieldtype': u'Button',
+		'label': u'Get Advances Received',
+		'oldfieldtype': u'Button',
+		'options': u'get_advances',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'advance_adjustment_details',
+		'fieldtype': u'Table',
+		'label': u'Sales Invoice Advance',
+		'oldfieldname': u'advance_adjustment_details',
+		'oldfieldtype': u'Table',
+		'options': u'Sales Invoice Advance',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'sales_team_section_break',
+		'fieldtype': u'Section Break',
+		'label': u'Sales Team',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'column_break9',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'print_hide': 1,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'sales_partner',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Sales Partner',
+		'oldfieldname': u'sales_partner',
+		'oldfieldtype': u'Link',
+		'options': u'Sales Partner',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'column_break10',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'print_hide': 1,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'commission_rate',
+		'fieldtype': u'Currency',
+		'label': u'Commission Rate (%)',
+		'oldfieldname': u'commission_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'total_commission',
+		'fieldtype': u'Currency',
+		'label': u'Total Commission',
+		'oldfieldname': u'total_commission',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'section_break2',
+		'fieldtype': u'Section Break',
+		'options': u'Simple',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'sales_team',
+		'fieldtype': u'Table',
+		'label': u'Sales Team1',
+		'oldfieldname': u'sales_team',
+		'oldfieldtype': u'Table',
+		'options': u'Sales Team',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'recurring_invoice',
+		'fieldtype': u'Section Break',
+		'label': u'Recurring Invoice',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break11',
+		'fieldtype': u'Column Break',
+		'permlevel': 0,
+		'print_hide': 1,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'colour': u'White:FFF',
+		'depends_on': u'eval:doc.docstatus==1',
+		'description': u'Check if recurring invoice, uncheck to stop recurring or put proper End Date',
+		'doctype': u'DocField',
+		'fieldname': u'convert_into_recurring_invoice',
+		'fieldtype': u'Check',
+		'label': u'Convert into Recurring Invoice',
+		'no_copy': 1,
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'depends_on': u'eval:doc.convert_into_recurring_invoice==1',
+		'description': u'The day of the month on which auto invoice will be generated e.g. 05, 28 etc ',
+		'doctype': u'DocField',
+		'fieldname': u'repeat_on_day_of_month',
+		'fieldtype': u'Data',
+		'label': u'Repeat on Day of Month',
+		'no_copy': 1,
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'depends_on': u'eval:doc.convert_into_recurring_invoice==1',
+		'description': u'The date on which recurring invoice will be stop',
+		'doctype': u'DocField',
+		'fieldname': u'end_date',
+		'fieldtype': u'Date',
+		'label': u'End Date',
+		'no_copy': 1,
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break12',
+		'fieldtype': u'Column Break',
+		'no_copy': 0,
+		'permlevel': 0,
+		'print_hide': 1,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'depends_on': u'eval:doc.convert_into_recurring_invoice==1',
+		'description': u'Enter email id separated by commas, invoice will be mailed automatically on particular date',
+		'doctype': u'DocField',
+		'fieldname': u'notification_email_address',
+		'fieldtype': u'Small Text',
+		'label': u'Notification Email Address',
+		'no_copy': 1,
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'depends_on': u'eval:doc.convert_into_recurring_invoice==1',
+		'description': u'The unique id for tracking all recurring invoices ',
+		'doctype': u'DocField',
+		'fieldname': u'recurring_id',
+		'fieldtype': u'Data',
+		'label': u'Recurring Id',
+		'no_copy': 1,
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'depends_on': u'eval:doc.convert_into_recurring_invoice==1',
+		'description': u'The date on which next invoice will be generated ',
+		'doctype': u'DocField',
+		'fieldname': u'next_date',
+		'fieldtype': u'Date',
+		'label': u'Next Date',
+		'no_copy': 1,
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'against_income_account',
+		'fieldtype': u'Small Text',
+		'hidden': 1,
+		'label': u'Against Income Account',
+		'no_copy': 1,
+		'oldfieldname': u'against_income_account',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
+		'hidden': 1,
+		'label': u'File List',
+		'no_copy': 1,
+		'permlevel': 0,
+		'print_hide': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/internal_reconciliation/__init__.py b/erpnext/accounts/doctype/sales_invoice_advance/__init__.py
similarity index 100%
rename from erpnext/accounts/doctype/internal_reconciliation/__init__.py
rename to erpnext/accounts/doctype/sales_invoice_advance/__init__.py
diff --git a/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.txt b/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.txt
new file mode 100644
index 0000000..5725246
--- /dev/null
+++ b/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.txt
@@ -0,0 +1,105 @@
+# DocType, Sales Invoice Advance
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:40',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:40',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Accounts',
+		'name': '__common__',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 24
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'no_copy': 1,
+		'parent': u'Sales Invoice Advance',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Sales Invoice Advance
+	{
+		'doctype': 'DocType',
+		'name': u'Sales Invoice Advance'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'journal_voucher',
+		'fieldtype': u'Link',
+		'label': u'Journal Voucher',
+		'oldfieldname': u'journal_voucher',
+		'oldfieldtype': u'Link',
+		'options': u'Journal Voucher',
+		'permlevel': 1,
+		'width': u'250px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'jv_detail_no',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Journal Voucher Detail No',
+		'oldfieldname': u'jv_detail_no',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'120px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'advance_amount',
+		'fieldtype': u'Currency',
+		'label': u'Advance amount',
+		'oldfieldname': u'advance_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'width': u'120px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'allocated_amount',
+		'fieldtype': u'Currency',
+		'label': u'Allocated amount',
+		'oldfieldname': u'allocated_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'trigger': u'Client',
+		'width': u'120px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'remarks',
+		'fieldtype': u'Small Text',
+		'label': u'Remarks',
+		'oldfieldname': u'remarks',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 1,
+		'width': u'150px'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/ir_payment_detail/__init__.py b/erpnext/accounts/doctype/sales_invoice_item/__init__.py
similarity index 100%
rename from erpnext/accounts/doctype/ir_payment_detail/__init__.py
rename to erpnext/accounts/doctype/sales_invoice_item/__init__.py
diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.txt b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.txt
new file mode 100644
index 0000000..acb1d95
--- /dev/null
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.txt
@@ -0,0 +1,435 @@
+# DocType, Sales Invoice Item
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:48',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:48',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'INVD.######',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Accounts',
+		'name': '__common__',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 29
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Sales Invoice Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Sales Invoice Item
+	{
+		'doctype': 'DocType',
+		'name': u'Sales Invoice Item'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Item',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 0,
+		'print_hide': 0,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_name',
+		'fieldtype': u'Data',
+		'in_filter': 0,
+		'label': u'Item Name',
+		'oldfieldname': u'item_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Text',
+		'permlevel': 0,
+		'reqd': 1,
+		'width': u'200px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'qty',
+		'fieldtype': u'Currency',
+		'label': u'Qty',
+		'oldfieldname': u'qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'reqd': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'stock_uom',
+		'fieldtype': u'Data',
+		'label': u'UOM',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'ref_rate',
+		'fieldtype': u'Currency',
+		'label': u'Price List Rate',
+		'oldfieldname': u'ref_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'adj_rate',
+		'fieldtype': u'Float',
+		'label': u'Discount (%)',
+		'oldfieldname': u'adj_rate',
+		'oldfieldtype': u'Float',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'export_rate',
+		'fieldtype': u'Currency',
+		'label': u'Basic Rate',
+		'oldfieldname': u'export_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'reqd': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'export_amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount',
+		'oldfieldname': u'export_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'base_ref_rate',
+		'fieldtype': u'Currency',
+		'label': u'Price List Rate*',
+		'oldfieldname': u'base_ref_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'basic_rate',
+		'fieldtype': u'Currency',
+		'in_filter': 0,
+		'label': u'Basic Rate*',
+		'oldfieldname': u'basic_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount*',
+		'oldfieldname': u'amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'warehouse',
+		'fieldtype': u'Link',
+		'hidden': 0,
+		'label': u'Warehouse',
+		'oldfieldname': u'warehouse',
+		'oldfieldtype': u'Link',
+		'options': u'Warehouse',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'income_account',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Income Account',
+		'oldfieldname': u'income_account',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'trigger': u'Client',
+		'width': u'120px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'Purchase - TC',
+		'doctype': u'DocField',
+		'fieldname': u'cost_center',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Cost Center',
+		'oldfieldname': u'cost_center',
+		'oldfieldtype': u'Link',
+		'options': u'Cost Center',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 0,
+		'trigger': u'Client',
+		'width': u'120px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'serial_no',
+		'fieldtype': u'Small Text',
+		'in_filter': 1,
+		'label': u'Serial No',
+		'oldfieldname': u'serial_no',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0,
+		'print_hide': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'batch_no',
+		'fieldtype': u'Link',
+		'label': u'Batch No',
+		'options': u'Batch',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_group',
+		'fieldtype': u'Link',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Item Group',
+		'oldfieldname': u'item_group',
+		'oldfieldtype': u'Link',
+		'options': u'Item Group',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'brand',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Brand Name',
+		'oldfieldname': u'brand',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'actual_qty',
+		'fieldtype': u'Currency',
+		'label': u'Available Qty at Warehouse',
+		'oldfieldname': u'actual_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'delivered_qty',
+		'fieldtype': u'Currency',
+		'label': u'Delivered Qty',
+		'oldfieldname': u'delivered_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'sales_order',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Sales Order',
+		'oldfieldname': u'sales_order',
+		'oldfieldtype': u'Link',
+		'options': u'Sales Order',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'so_detail',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'SO Detail ',
+		'oldfieldname': u'so_detail',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'delivery_note',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Delivery Note',
+		'oldfieldname': u'delivery_note',
+		'oldfieldtype': u'Link',
+		'options': u'Delivery Note',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'dn_detail',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'DN Detail',
+		'oldfieldname': u'dn_detail',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_tax_rate',
+		'fieldtype': u'Small Text',
+		'hidden': 1,
+		'label': u'Item Tax Rate',
+		'oldfieldname': u'item_tax_rate',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'clear_pending',
+		'fieldtype': u'Check',
+		'hidden': 1,
+		'label': u'Clear Pending',
+		'no_copy': 1,
+		'oldfieldname': u'clear_pending',
+		'oldfieldtype': u'Check',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'doctype': u'DocField',
+		'fieldname': u'page_break',
+		'fieldtype': u'Check',
+		'label': u'Page Break',
+		'no_copy': 1,
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/internal_reconciliation/__init__.py b/erpnext/accounts/doctype/sales_taxes_and_charges/__init__.py
similarity index 100%
copy from erpnext/accounts/doctype/internal_reconciliation/__init__.py
copy to erpnext/accounts/doctype/sales_taxes_and_charges/__init__.py
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt
new file mode 100644
index 0000000..b8c8a5e
--- /dev/null
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt
@@ -0,0 +1,223 @@
+# DocType, Sales Taxes and Charges
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:48',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:48',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'INVTD.######',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'hide_heading': 1,
+		'istable': 1,
+		'module': u'Accounts',
+		'name': '__common__',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 20
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Sales Taxes and Charges',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Sales Taxes and Charges
+	{
+		'doctype': 'DocType',
+		'name': u'Sales Taxes and Charges'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'charge_type',
+		'fieldtype': u'Select',
+		'label': u'Type',
+		'oldfieldname': u'charge_type',
+		'oldfieldtype': u'Select',
+		'options': u'\nActual\nOn Net Total\nOn Previous Row Amount\nOn Previous Row Total',
+		'permlevel': 0,
+		'reqd': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'account_head',
+		'fieldtype': u'Link',
+		'label': u'Account Head',
+		'oldfieldname': u'account_head',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'cost_center_other_charges',
+		'fieldtype': u'Link',
+		'label': u'Cost Center',
+		'oldfieldname': u'cost_center_other_charges',
+		'oldfieldtype': u'Link',
+		'options': u'Cost Center',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Small Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0,
+		'reqd': 1,
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'rate',
+		'fieldtype': u'Currency',
+		'label': u'Rate',
+		'oldfieldname': u'rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'reqd': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'tax_amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount*',
+		'oldfieldname': u'tax_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'reqd': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'total',
+		'fieldtype': u'Currency',
+		'label': u'Total*',
+		'oldfieldname': u'total',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'row_id',
+		'fieldtype': u'Data',
+		'hidden': 0,
+		'label': u'Enter Row',
+		'oldfieldname': u'row_id',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'item_wise_tax_detail',
+		'fieldtype': u'Small Text',
+		'hidden': 1,
+		'label': u'Item Wise Tax Detail ',
+		'oldfieldname': u'item_wise_tax_detail',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'parenttype',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Parenttype',
+		'oldfieldname': u'parenttype',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'print_hide': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Cheating Field\nPlease do not delete ',
+		'doctype': u'DocField',
+		'fieldname': u'total_tax_amount',
+		'fieldtype': u'Currency',
+		'hidden': 1,
+		'label': u'Total Tax Amount',
+		'no_copy': 1,
+		'oldfieldname': u'total_tax_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1
+	},
+
+	# DocField
+	{
+		'description': u'Cheating Field\nPlease do not delete ',
+		'doctype': u'DocField',
+		'fieldname': u'total_amount',
+		'fieldtype': u'Currency',
+		'hidden': 1,
+		'label': u'Total Amount',
+		'no_copy': 1,
+		'oldfieldname': u'total_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 0,
+		'description': u'If checked, the tax amount will be considered as already included in the Print Rate / Print Amount',
+		'doctype': u'DocField',
+		'fieldname': u'included_in_print_rate',
+		'fieldtype': u'Check',
+		'label': u'Included in Print Rate',
+		'no_column': 0,
+		'no_copy': 1,
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/payable_voucher/__init__.py b/erpnext/accounts/doctype/sales_taxes_and_charges_master/__init__.py
similarity index 100%
copy from erpnext/accounts/doctype/payable_voucher/__init__.py
copy to erpnext/accounts/doctype/sales_taxes_and_charges_master/__init__.py
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
new file mode 100644
index 0000000..66bfd61
--- /dev/null
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
@@ -0,0 +1,187 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+//--------- ONLOAD -------------
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+  // 
+}
+
+/*cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+   
+}*/
+
+// For customizing print
+cur_frm.pformat.net_total = function(doc) {
+	return '';
+}
+
+cur_frm.pformat.grand_total_export = function(doc) {
+	return '';
+}
+
+cur_frm.pformat.rounded_total_export = function(doc) {
+	return '';
+}
+
+cur_frm.pformat.in_words_export = function(doc) {
+	return '';
+}
+
+cur_frm.pformat.other_charges= function(doc){
+  //function to make row of table
+	var make_row = function(title,val,bold){
+		var bstart = '<b>'; var bend = '</b>';
+		return '<tr><td style="width:50%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
+		 +'<td style="width:25%;text-align:right;">'+doc.currency+'</td>'
+		 +'<td style="width:25%;text-align:right;">'+val+'</td>'
+		 +'</tr>'
+	}
+
+	function convert_rate(val){
+		var new_val = flt(val)/flt(doc.conversion_rate);
+		return new_val;
+	}
+	out ='';
+	if (!doc.print_without_amount) {
+		print_hide_dict = {};
+		for(var i in locals['DocField']) {
+			var doc_field = locals['DocField'][i];
+			if(doc_field.fieldname) {
+				print_hide_dict[doc_field.fieldname] = doc_field.print_hide;
+			}
+		}
+
+		var cl = getchildren('Sales Taxes and Charges',doc.name,'other_charges');
+
+		// outer table  
+		var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';
+
+		// main table
+
+		out +='<table class="noborder" style="width:100%">';
+		if(!print_hide_dict['net_total']) {
+			out +=make_row('Net Total',fmt_money(convert_rate(doc.net_total)),1);
+		}
+
+		// add rows
+		if(cl.length){
+			for(var i=0;i<cl.length;i++){
+				if(fmt_money(convert_rate(cl[i].tax_amount))!=0 && !cl[i].included_in_print_rate)
+				  out += make_row(cl[i].description,fmt_money(convert_rate(cl[i].tax_amount)),0);
+			}
+		}
+
+		// grand total
+		if(!print_hide_dict['grand_total_export']) {
+			out += make_row('Grand Total',fmt_money(doc.grand_total_export),1);
+		}
+		
+		if(!print_hide_dict['rounded_total_export']) {
+			out += make_row('Rounded Total',fmt_money(doc.rounded_total_export),1);
+		}
+
+		if(doc.in_words_export && !print_hide_dict['in_words_export']){
+			out +='</table></td></tr>';
+			out += '<tr><td colspan = "2">';
+			out += '<table><tr><td style="width:25%;"><b>In Words</b></td>'
+			out+= '<td style="width:50%;">'+doc.in_words_export+'</td></tr>'
+		}
+		out +='</table></td></tr></table></div>';   
+	}
+	return out;
+}
+
+cur_frm.cscript.charge_type = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(d.idx == 1 && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){
+    alert("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row");
+    d.charge_type = '';
+  }
+  validated = false;
+  refresh_field('charge_type',d.name,'other_charges');
+  cur_frm.cscript.row_id(doc, cdt, cdn);
+  cur_frm.cscript.rate(doc, cdt, cdn);
+  cur_frm.cscript.tax_amount(doc, cdt, cdn);
+}
+
+cur_frm.cscript.row_id = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.charge_type && d.row_id){
+    alert("Please select Charge Type first");
+    d.row_id = '';
+  }
+  else if((d.charge_type == 'Actual' || d.charge_type == 'On Net Total') && d.row_id) {
+    alert("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'");
+    d.row_id = '';
+  }
+  else if((d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total') && d.row_id){
+    if(d.row_id >= d.idx){
+      alert("You cannot Enter Row no. greater than or equal to current row no. for this Charge type");
+      d.row_id = '';
+    }
+  }
+  validated = false;
+  refresh_field('row_id',d.name,'other_charges');
+}
+
+/*---------------------- Get rate if account_head has account_type as TAX or CHARGEABLE-------------------------------------*/
+
+cur_frm.fields_dict['other_charges'].grid.get_field("account_head").get_query = function(doc,cdt,cdn) {
+  return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type = "Tax" OR tabAccount.account_type = "Chargeable") AND tabAccount.company = "'+doc.company+'" AND  tabAccount.name LIKE "%s"'
+}
+
+cur_frm.fields_dict['other_charges'].grid.get_field("cost_center_other_charges").get_query = function(doc) {
+	return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY	`tabCost Center`.`name` ASC LIMIT 50';
+}
+
+
+cur_frm.cscript.account_head = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.charge_type && d.account_head){
+    alert("Please select Charge Type first");
+    validated = false;
+    d.account_head = '';
+  }
+  else if(d.account_head && d.charge_type) {
+    arg = "{'charge_type' : '" + d.charge_type +"', 'account_head' : '" + d.account_head + "'}";
+    get_server_fields('get_rate', arg, 'other_charges', doc, cdt, cdn, 1);
+  }
+  refresh_field('account_head',d.name,'other_charges');
+}
+
+cur_frm.cscript.rate = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.charge_type && d.rate) {
+    alert("Please select Charge Type first");
+    d.rate = '';
+  }
+  validated = false;
+  refresh_field('rate',d.name,'other_charges');
+}
+
+cur_frm.cscript.tax_amount = function(doc, cdt, cdn) {
+  var d = locals[cdt][cdn];
+  if(!d.charge_type && d.tax_amount){
+    alert("Please select Charge Type first");
+    d.tax_amount = '';
+  }
+  else if(d.charge_type && d.tax_amount) {
+    alert("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate");
+    d.tax_amount = '';
+  }
+  validated = false;
+  refresh_field('tax_amount',d.name,'other_charges');
+}
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.py b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.py
new file mode 100644
index 0000000..f57de83
--- /dev/null
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.py
@@ -0,0 +1,50 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+
+  # Get Tax Rate if account type is Tax
+  # ===================================================================
+  def get_rate(self, arg):
+    get_obj('Sales Common').get_rate(arg, self)
+
+  def update_other_default_charges(self):
+    sql("update `tabSales Taxes and Charges Master` set is_default = 0 where ifnull(is_default,0) = 1 and name != '%s' and company = '%s'" % (self.doc.name, self.doc.company))
+
+  def on_update(self):
+    self.update_other_default_charges()
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt
new file mode 100644
index 0000000..655269c
--- /dev/null
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt
@@ -0,0 +1,195 @@
+# DocType, Sales Taxes and Charges Master
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:22',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:22',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': u'1322549700',
+		'allow_trash': 1,
+		'autoname': u'field:title',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'document_type': u'Master',
+		'module': u'Accounts',
+		'name': '__common__',
+		'section_style': u'Tabbed',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 57
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Sales Taxes and Charges Master',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Sales Taxes and Charges Master',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1
+	},
+
+	# DocType, Sales Taxes and Charges Master
+	{
+		'doctype': 'DocType',
+		'name': u'Sales Taxes and Charges Master'
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Accounts Manager',
+		'submit': 0,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'System Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales Master Manager',
+		'submit': 0,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales Master Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'other_charges_details',
+		'fieldtype': u'Section Break',
+		'label': u'Other Charges Details',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'title',
+		'fieldtype': u'Data',
+		'in_filter': 1,
+		'label': u'Title',
+		'oldfieldname': u'title',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'is_default',
+		'fieldtype': u'Check',
+		'label': u'Default',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Company',
+		'oldfieldname': u'company',
+		'oldfieldtype': u'Link',
+		'options': u'Company',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'other_charges',
+		'fieldtype': u'Table',
+		'label': u'Sales Taxes and Charges Master',
+		'oldfieldname': u'other_charges',
+		'oldfieldtype': u'Table',
+		'options': u'Sales Taxes and Charges',
+		'permlevel': 0
+	}
+]
diff --git a/erpnext/accounts/doctype/tds_category/tds_category.txt b/erpnext/accounts/doctype/tds_category/tds_category.txt
index 509f177..caac059 100644
--- a/erpnext/accounts/doctype/tds_category/tds_category.txt
+++ b/erpnext/accounts/doctype/tds_category/tds_category.txt
@@ -3,46 +3,46 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:27',
+		'creation': '2012-03-27 14:35:48',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:48',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1302586171',
-		'autoname': 'field:category_name',
-		'colour': 'White:FFF',
+		'_last_update': u'1302586171',
+		'autoname': u'field:category_name',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
+		'document_type': u'Master',
 		'in_create': 0,
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 8
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'TDS Category',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'TDS Category',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'TDS Category',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'TDS Category',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1
 	},
@@ -50,7 +50,26 @@
 	# DocType, TDS Category
 	{
 		'doctype': 'DocType',
-		'name': 'TDS Category'
+		'name': u'TDS Category'
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'role': u'Accounts Manager',
+		'submit': 0,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'role': u'System Manager',
+		'write': 1
 	},
 
 	# DocPerm
@@ -58,47 +77,24 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'Accounts User',
+		'doctype': u'DocPerm',
+		'role': u'Accounts User',
 		'submit': 0,
 		'write': 0
 	},
 
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'Accounts Manager',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'role': 'System Manager',
-		'write': 1
-	},
-
 	# DocField
 	{
-		'default': 'Accounts',
-		'doctype': 'DocField',
-		'fieldname': 'module',
-		'fieldtype': 'Link',
+		'default': u'Accounts',
+		'doctype': u'DocField',
+		'fieldname': u'module',
+		'fieldtype': u'Link',
 		'hidden': 0,
-		'idx': 1,
 		'in_filter': 0,
-		'label': 'Module',
-		'oldfieldname': 'module',
-		'oldfieldtype': 'Link',
-		'options': 'Module Def',
+		'label': u'Module',
+		'oldfieldname': u'module',
+		'oldfieldtype': u'Link',
+		'options': u'Module Def',
 		'print_hide': 0,
 		'report_hide': 0,
 		'search_index': 0
@@ -106,36 +102,34 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 2,
-		'label': 'Note HTML',
-		'oldfieldtype': 'HTML',
-		'options': '<b>Note:</b> You must first create the Accounts from the Chart of Accounts and then link it to this Category.'
+		'doctype': u'DocField',
+		'fieldname': u'note_html',
+		'fieldtype': u'HTML',
+		'label': u'Note HTML',
+		'oldfieldtype': u'HTML',
+		'options': u'<b>Note:</b> You must first create the Accounts from the Chart of Accounts and then link it to this Category.'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'category_name',
-		'fieldtype': 'Data',
-		'idx': 3,
-		'label': 'Category Name',
-		'oldfieldname': 'category_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'category_name',
+		'fieldtype': u'Data',
+		'label': u'Category Name',
+		'oldfieldname': u'category_name',
+		'oldfieldtype': u'Data',
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'tds_sh_edu_cess_account',
-		'fieldtype': 'Table',
-		'idx': 4,
-		'label': 'TDS Account Detail',
-		'oldfieldname': 'tds_sh_edu_cess_account',
-		'oldfieldtype': 'Table',
-		'options': 'TDS Category Account',
+		'doctype': u'DocField',
+		'fieldname': u'tds_sh_edu_cess_account',
+		'fieldtype': u'Table',
+		'label': u'TDS Account Detail',
+		'oldfieldname': u'tds_sh_edu_cess_account',
+		'oldfieldtype': u'Table',
+		'options': u'TDS Category Account',
 		'reqd': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/tds_category_account/tds_category_account.txt b/erpnext/accounts/doctype/tds_category_account/tds_category_account.txt
index 0106a09..522ef35 100644
--- a/erpnext/accounts/doctype/tds_category_account/tds_category_account.txt
+++ b/erpnext/accounts/doctype/tds_category_account/tds_category_account.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:27',
+		'creation': '2012-03-27 14:35:48',
 		'docstatus': 0,
-		'modified': '2012-03-21 12:29:18',
+		'modified': '2012-03-27 14:35:48',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
diff --git a/erpnext/accounts/doctype/tds_control/tds_control.js b/erpnext/accounts/doctype/tds_control/tds_control.js
deleted file mode 100644
index fae4dd9..0000000
--- a/erpnext/accounts/doctype/tds_control/tds_control.js
+++ /dev/null
@@ -1,110 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-class DocType:
-  def __init__(self, doc, doclist=[]):
-    self.doc = doc
-    self.doclist = doclist
-
-
-  # ============TDS==================
-  # Stop payable voucher on which tds is applicable is made before posting date of the
-  # voucher in which tds was applicable for 1st time
-        
-  def validate_first_entry(self,obj):
-    if obj.doc.doctype == 'Payable Voucher':
-      supp_acc = obj.doc.credit_to
-    elif obj.doc.doctype == 'Journal Voucher':
-      supp_acc = obj.doc.supplier_account
-
-    if obj.doc.ded_amount:
-      # first pv
-      first_pv = sql("select posting_date from `tabPayable Voucher` where credit_to = '%s' and docstatus = 1 and tds_category = '%s' and fiscal_year = '%s' and tds_applicable = 'Yes' and (ded_amount != 0 or ded_amount is not null) order by posting_date asc limit 1"%(supp_acc, obj.doc.tds_category, obj.doc.fiscal_year))
-      first_pv_date = first_pv and first_pv[0][0] or ''
-      # first jv
-      first_jv = sql("select posting_date from `tabJournal Voucher` where supplier_account = '%s'and docstatus = 1 and tds_category = '%s' and fiscal_year = '%s' and tds_applicable = 'Yes' and (ded_amount != 0 or ded_amount is not null) order by posting_date asc limit 1"%(supp_acc, obj.doc.tds_category, obj.doc.fiscal_year))
-      first_jv_date = first_jv and first_jv[0][0] or ''
-
-      #first tds voucher date
-      first_tds_date = ''
-      if first_pv_date and first_jv_date:
-        first_tds_date = first_pv_date < first_jv_date and first_pv_date or first_jv_date
-      elif first_pv_date:
-        first_tds_date = first_pv_date
-      elif first_jv_date:
-        first_tds_date = first_jv_date
-
-      if first_tds_date and getdate(obj.doc.posting_date) < first_tds_date:
-        msgprint("First tds voucher for this category has been made already. Hence payable voucher cannot be made before posting date of first tds voucher ")
-        raise Exception
-    
-  # TDS function definition
-  #---------------------------
-  def get_tds_amount(self, obj):    
-    # Validate if posting date b4 first tds entry for this category
-    self.validate_first_entry(obj)
-
-    # get current amount and supplier head
-    if obj.doc.doctype == 'Payable Voucher':
-      supplier_account = obj.doc.credit_to
-      total_amount=flt(obj.doc.grand_total)
-      for d in getlist(obj.doclist,'advance_allocation_details'):
-        if flt(d.tds_amount)!=0:
-          total_amount -= flt(d.allocated_amount)
-    elif obj.doc.doctype == 'Journal Voucher':      
-      supplier_account = obj.doc.supplier_account
-      total_amount = obj.doc.total_debit
-
-    if obj.doc.tds_category:      
-      # get total billed
-      total_billed = 0
-      pv = sql("select sum(ifnull(grand_total,0)), sum(ifnull(ded_amount,0)) from `tabPayable Voucher` where tds_category = %s and credit_to = %s and fiscal_year = %s and docstatus = 1 and name != %s and is_opening != 'Yes'", (obj.doc.tds_category, supplier_account, obj.doc.fiscal_year, obj.doc.name))
-      jv = sql("select sum(ifnull(total_debit,0)), sum(ifnull(ded_amount,0)) from `tabJournal Voucher` where tds_category = %s and supplier_account = %s and fiscal_year = %s and docstatus = 1 and name != %s and is_opening != 'Yes'", (obj.doc.tds_category, supplier_account, obj.doc.fiscal_year, obj.doc.name))
-      tds_in_pv = pv and pv[0][1] or 0
-      tds_in_jv = jv and jv[0][1] or 0
-      total_billed += flt(pv and pv[0][0] or 0)+flt(jv and jv[0][0] or 0)+flt(total_amount)
-      
-      # get slab
-      slab = sql("SELECT * FROM `tabTDS Rate Detail` t1, `tabTDS Rate Chart` t2 WHERE '%s' >= t1.slab_from AND t1.category = '%s' AND t1.parent=t2.name and t2.applicable_from <= '%s' ORDER BY t2.applicable_from DESC LIMIT 1" % (total_billed, obj.doc.tds_category, obj.doc.posting_date), as_dict = 1)
-      
-      if slab:
-        if flt(tds_in_pv) <= 0 and flt(tds_in_jv) <= 0:
-          total_amount = total_billed
-        slab = slab[0]
-        # special tds rate
-        special_tds = sql("select special_tds_rate, special_tds_limit, special_tds_rate_applicable from `tabTDS Detail` where parent = '%s' and tds_category = '%s'"% (supplier_account,obj.doc.tds_category))
-
-        # get_pan_number
-        pan_no = sql("select pan_number from `tabAccount` where name = '%s'" % supplier_account)
-        pan_no = pan_no and cstr(pan_no[0][0]) or ''
-        if not pan_no and flt(slab.get('rate_without_pan')):
-          msgprint("As there is no PAN number mentioned in the account head: %s, TDS amount will be calculated at rate %s%%" % (supplier_account, cstr(slab['rate_without_pan'])))
-          tds_rate = flt(slab.get('rate_without_pan'))
-        elif special_tds and special_tds[0][2]=='Yes' and (flt(special_tds[0][1])==0 or flt(special_tds[0][1]) >= flt(total_amount)):
-          tds_rate =  flt(special_tds[0][0])
-        else: 
-          tds_rate=flt(slab['rate'])
-        # calculate tds amount
-        if flt(slab['rate']):
-          ac = sql("SELECT account_head FROM `tabTDS Category Account` where parent=%s and company=%s", (obj.doc.tds_category,obj.doc.company))
-
-          if ac:
-            obj.doc.tax_code = ac[0][0]
-            obj.doc.rate = tds_rate
-            obj.doc.ded_amount = round(flt(tds_rate) * flt(total_amount) / 100)
-          else:
-            msgprint("TDS Account not selected in TDS Category %s" % (obj.doc.tds_category))
-            raise Exception
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/tds_control/tds_control.py b/erpnext/accounts/doctype/tds_control/tds_control.py
index be1945d..ccbee7c 100644
--- a/erpnext/accounts/doctype/tds_control/tds_control.py
+++ b/erpnext/accounts/doctype/tds_control/tds_control.py
@@ -44,14 +44,14 @@
   # voucher in which tds was applicable for 1st time
         
   def validate_first_entry(self,obj):
-    if obj.doc.doctype == 'Payable Voucher':
+    if obj.doc.doctype == 'Purchase Invoice':
       supp_acc = obj.doc.credit_to
     elif obj.doc.doctype == 'Journal Voucher':
       supp_acc = obj.doc.supplier_account
 
     if obj.doc.ded_amount:
       # first pv
-      first_pv = sql("select posting_date from `tabPayable Voucher` where credit_to = '%s' and docstatus = 1 and tds_category = '%s' and fiscal_year = '%s' and tds_applicable = 'Yes' and (ded_amount != 0 or ded_amount is not null) order by posting_date asc limit 1"%(supp_acc, obj.doc.tds_category, obj.doc.fiscal_year))
+      first_pv = sql("select posting_date from `tabPurchase Invoice` where credit_to = '%s' and docstatus = 1 and tds_category = '%s' and fiscal_year = '%s' and tds_applicable = 'Yes' and (ded_amount != 0 or ded_amount is not null) order by posting_date asc limit 1"%(supp_acc, obj.doc.tds_category, obj.doc.fiscal_year))
       first_pv_date = first_pv and first_pv[0][0] or ''
       # first jv
       first_jv = sql("select posting_date from `tabJournal Voucher` where supplier_account = '%s'and docstatus = 1 and tds_category = '%s' and fiscal_year = '%s' and tds_applicable = 'Yes' and (ded_amount != 0 or ded_amount is not null) order by posting_date asc limit 1"%(supp_acc, obj.doc.tds_category, obj.doc.fiscal_year))
@@ -77,7 +77,7 @@
     self.validate_first_entry(obj)
 
     # get current amount and supplier head
-    if obj.doc.doctype == 'Payable Voucher':
+    if obj.doc.doctype == 'Purchase Invoice':
       supplier_account = obj.doc.credit_to
       total_amount=flt(obj.doc.grand_total)
       for d in getlist(obj.doclist,'advance_allocation_details'):
@@ -90,7 +90,7 @@
     if obj.doc.tds_category:      
       # get total billed
       total_billed = 0
-      pv = sql("select sum(ifnull(grand_total,0)), sum(ifnull(ded_amount,0)) from `tabPayable Voucher` where tds_category = %s and credit_to = %s and fiscal_year = %s and docstatus = 1 and name != %s and is_opening != 'Yes'", (obj.doc.tds_category, supplier_account, obj.doc.fiscal_year, obj.doc.name))
+      pv = sql("select sum(ifnull(grand_total,0)), sum(ifnull(ded_amount,0)) from `tabPurchase Invoice` where tds_category = %s and credit_to = %s and fiscal_year = %s and docstatus = 1 and name != %s and is_opening != 'Yes'", (obj.doc.tds_category, supplier_account, obj.doc.fiscal_year, obj.doc.name))
       jv = sql("select sum(ifnull(total_debit,0)), sum(ifnull(ded_amount,0)) from `tabJournal Voucher` where tds_category = %s and supplier_account = %s and fiscal_year = %s and docstatus = 1 and name != %s and is_opening != 'Yes'", (obj.doc.tds_category, supplier_account, obj.doc.fiscal_year, obj.doc.name))
       tds_in_pv = pv and pv[0][1] or 0
       tds_in_jv = jv and jv[0][1] or 0
diff --git a/erpnext/accounts/doctype/tds_control/tds_control.txt b/erpnext/accounts/doctype/tds_control/tds_control.txt
index 03f17b5..ca002eb 100644
--- a/erpnext/accounts/doctype/tds_control/tds_control.txt
+++ b/erpnext/accounts/doctype/tds_control/tds_control.txt
@@ -3,22 +3,22 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:27',
+		'creation': '2012-03-27 14:35:48',
 		'docstatus': 0,
-		'modified': '2010-12-16 16:31:49',
-		'modified_by': 'Administrator',
-		'owner': 'wasim@webnotestech.com'
+		'modified': '2012-03-27 14:35:48',
+		'modified_by': u'Administrator',
+		'owner': u'wasim@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'issingle': 1,
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 36
 	},
@@ -26,6 +26,6 @@
 	# DocType, TDS Control
 	{
 		'doctype': 'DocType',
-		'name': 'TDS Control'
+		'name': u'TDS Control'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/tds_detail/tds_detail.txt b/erpnext/accounts/doctype/tds_detail/tds_detail.txt
index f24e32a..c248e73 100644
--- a/erpnext/accounts/doctype/tds_detail/tds_detail.txt
+++ b/erpnext/accounts/doctype/tds_detail/tds_detail.txt
@@ -3,131 +3,123 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:27',
+		'creation': '2012-03-27 14:35:48',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'wasim@webnotestech.com'
+		'modified': '2012-03-27 14:35:48',
+		'modified_by': u'Administrator',
+		'owner': u'wasim@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 2
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'TDS Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'TDS Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0,
-		'width': '150px'
+		'width': u'150px'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'TDS Detail',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'TDS Detail',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, TDS Detail
 	{
 		'doctype': 'DocType',
-		'name': 'TDS Detail'
+		'name': u'TDS Detail'
 	},
 
 	# DocPerm
 	{
 		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'All',
+		'role': u'All',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'All'
+		'role': u'All'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 3,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 4,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'System Manager'
+		'role': u'System Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'tds_category',
-		'fieldtype': 'Select',
-		'idx': 1,
-		'label': 'TDS Category',
-		'oldfieldname': 'tds_category',
-		'oldfieldtype': 'Select',
-		'options': 'link:TDS Category'
+		'doctype': u'DocField',
+		'fieldname': u'tds_category',
+		'fieldtype': u'Select',
+		'label': u'TDS Category',
+		'oldfieldname': u'tds_category',
+		'oldfieldtype': u'Select',
+		'options': u'link:TDS Category'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'special_tds_rate_applicable',
-		'fieldtype': 'Select',
-		'idx': 2,
-		'label': 'Special TDS Rate Applicable',
-		'oldfieldname': 'special_tds_rate_applicable',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo'
+		'doctype': u'DocField',
+		'fieldname': u'special_tds_rate_applicable',
+		'fieldtype': u'Select',
+		'label': u'Special TDS Rate Applicable',
+		'oldfieldname': u'special_tds_rate_applicable',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'special_tds_rate',
-		'fieldtype': 'Currency',
-		'idx': 3,
-		'label': 'Special TDS Rate(Section-197)\t',
-		'oldfieldname': 'special_tds_rate',
-		'oldfieldtype': 'Currency'
+		'doctype': u'DocField',
+		'fieldname': u'special_tds_rate',
+		'fieldtype': u'Currency',
+		'label': u'Special TDS Rate(Section-197)\t',
+		'oldfieldname': u'special_tds_rate',
+		'oldfieldtype': u'Currency'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'special_tds_limit',
-		'fieldtype': 'Currency',
-		'idx': 4,
-		'label': 'Special TDS Limit',
-		'oldfieldname': 'special_tds_limit',
-		'oldfieldtype': 'Currency'
+		'doctype': u'DocField',
+		'fieldname': u'special_tds_limit',
+		'fieldtype': u'Currency',
+		'label': u'Special TDS Limit',
+		'oldfieldname': u'special_tds_limit',
+		'oldfieldtype': u'Currency'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/tds_payment/tds_payment.js b/erpnext/accounts/doctype/tds_payment/tds_payment.js
index e15fd13..4b7cb36 100644
--- a/erpnext/accounts/doctype/tds_payment/tds_payment.js
+++ b/erpnext/accounts/doctype/tds_payment/tds_payment.js
@@ -8,84 +8,84 @@
 // 
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
 // GNU General Public License for more details.
 // 
 // You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+// along with this program.	If not, see <http://www.gnu.org/licenses/>.
 
 cur_frm.cscript.onload = function(doc,cdt,cdn){
-  cur_frm.cscript.refresh(doc, cdt, cdn);
+	cur_frm.cscript.refresh(doc, cdt, cdn);
 }
 
 
 // get pan and tan no
 cur_frm.cscript.company = function(doc,cdt,cdn){
-  if(doc.company) get_server_fields('get_registration_details','','',doc,cdt,cdn);
+	if(doc.company) get_server_fields('get_registration_details','','',doc,cdt,cdn);
 }
 
 // check
 cur_frm.cscript.to_date = function(doc,cdt,cdn){
-  if(doc.from_date && doc.to_date && (doc.from_date>doc.to_date)){
-    alert("From date can not be greater than To date");
-    doc.to_date='';
-    refresh_field('to_date');
-  }
+	if(doc.from_date && doc.to_date && (doc.from_date>doc.to_date)){
+		alert("From date can not be greater than To date");
+		doc.to_date='';
+		refresh_field('to_date');
+	}
 }
 
 cur_frm.cscript.from_date = function(doc,cdt,cdn){
-  if(doc.from_date && doc.to_date && (doc.from_date>doc.to_date)){
-    alert("From date can not be greater than To date");
-    doc.from_date='';
-    refresh_field('from_date');
-  }
+	if(doc.from_date && doc.to_date && (doc.from_date>doc.to_date)){
+		alert("From date can not be greater than To date");
+		doc.from_date='';
+		refresh_field('from_date');
+	}
 }
 
 // Make Journal Voucher
 // --------------------
 
-cur_frm.cscript['Make Bank Voucher'] = function(doc, dt, dn) {  
-  var call_back = function(r,rt) {
-    cur_frm.cscript.make_jv(doc,dt,dn,r.message);
-  }
-  // get def bank and tds account
-  $c_obj(make_doclist(dt, dn), 'get_bank_and_tds_account', '', call_back);
+cur_frm.cscript.make_bank_voucher = function(doc, dt, dn) {	
+	var call_back = function(r,rt) {
+		cur_frm.cscript.make_jv(doc,dt,dn,r.message);
+	}
+	// get def bank and tds account
+	$c_obj(make_doclist(dt, dn), 'get_bank_and_tds_account', '', call_back);
 }
 
 cur_frm.cscript.make_jv = function(doc, dt, dn, det) {
-  var jv = LocalDB.create('Journal Voucher');
-  jv = locals['Journal Voucher'][jv];
-  jv.voucher_type = 'Bank Voucher';
-  jv.voucher_date = dateutil.obj_to_str(new Date());
-  jv.posting_date = dateutil.obj_to_str(new Date());
-  jv.aging_date = dateutil.obj_to_str(new Date());
-  jv.remark = repl('Payment against voucher %(vn)s. %(rem)s', {vn:doc.name, rem:doc.remarks});
-  jv.total_debit = doc.total_tds;
-  jv.total_credit = doc.total_tds;
-  jv.fiscal_year = sys_defaults.fiscal_year;
-  jv.company = doc.company;
+	var jv = LocalDB.create('Journal Voucher');
+	jv = locals['Journal Voucher'][jv];
+	jv.voucher_type = 'Bank Voucher';
+	jv.voucher_date = dateutil.obj_to_str(new Date());
+	jv.posting_date = dateutil.obj_to_str(new Date());
+	jv.aging_date = dateutil.obj_to_str(new Date());
+	jv.remark = repl('Payment against voucher %(vn)s. %(rem)s', {vn:doc.name, rem:doc.remarks});
+	jv.total_debit = doc.total_tds;
+	jv.total_credit = doc.total_tds;
+	jv.fiscal_year = sys_defaults.fiscal_year;
+	jv.company = doc.company;
 
-  // debit to tds account  
-  var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
-  d1.account = det.tds_account;
-  d1.debit = doc.total_tds;
+	// debit to tds account	
+	var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
+	d1.account = det.tds_account;
+	d1.debit = doc.total_tds;
 
-  // credit to bank account
-  var d2 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
-  d2.account = det.bank_account;
-  d2.credit = doc.total_tds;
-  
-  loaddoc('Journal Voucher', jv.name);
+	// credit to bank account
+	var d2 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
+	d2.account = det.bank_account;
+	d2.credit = doc.total_tds;
+	
+	loaddoc('Journal Voucher', jv.name);
 }
 
 // Show / Hide button
 cur_frm.cscript.refresh = function(doc, dt, dn) {
-  if(doc.docstatus==1) { 
-    unhide_field('Make Bank Voucher'); 
-    unhide_field('Update');
-  }
-  else {
-    hide_field('Make Bank Voucher');
-    hide_field('Update');
-  } 
+	if(doc.docstatus==1) { 
+		unhide_field('make_bank_voucher'); 
+		unhide_field('update');
+	}
+	else {
+		hide_field('make_bank_voucher');
+		hide_field('update');
+	} 
 }
diff --git a/erpnext/accounts/doctype/tds_payment/tds_payment.py b/erpnext/accounts/doctype/tds_payment/tds_payment.py
index cf97426..0885c3f 100644
--- a/erpnext/accounts/doctype/tds_payment/tds_payment.py
+++ b/erpnext/accounts/doctype/tds_payment/tds_payment.py
@@ -77,7 +77,7 @@
         msgprint("Please enter from date and to date")
       else:
         idx = 1
-        pv_det= sql("Select name,credit_to,grand_total,posting_date, ded_amount from `tabPayable Voucher` where tds_category='%s' And posting_date>= '%s' And posting_date <='%s'  and docstatus=1 and ded_amount > 0 Order By posting_date"%(self.doc.tds_category,self.doc.from_date,self.doc.to_date))
+        pv_det= sql("Select name,credit_to,grand_total,posting_date, ded_amount from `tabPurchase Invoice` where tds_category='%s' And posting_date>= '%s' And posting_date <='%s'  and docstatus=1 and ded_amount > 0 Order By posting_date"%(self.doc.tds_category,self.doc.from_date,self.doc.to_date))
         if pv_det:
           idx = self.make_tds_table(pv_det, idx)
         
diff --git a/erpnext/accounts/doctype/tds_payment/tds_payment.txt b/erpnext/accounts/doctype/tds_payment/tds_payment.txt
index 95d1967..506795e 100644
--- a/erpnext/accounts/doctype/tds_payment/tds_payment.txt
+++ b/erpnext/accounts/doctype/tds_payment/tds_payment.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:27',
+		'creation': '2012-03-27 14:35:48',
 		'docstatus': 0,
-		'modified': '2012-03-21 12:29:51',
+		'modified': '2012-03-27 14:45:52',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -16,6 +16,7 @@
 		'default_print_format': u'Standard',
 		'doctype': 'DocType',
 		'in_create': 0,
+		'is_submittable': 1,
 		'module': u'Accounts',
 		'name': '__common__',
 		'section_style': u'Simple',
@@ -51,18 +52,6 @@
 
 	# DocPerm
 	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Accounts User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
@@ -75,6 +64,13 @@
 
 	# DocPerm
 	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'All'
+	},
+
+	# DocPerm
+	{
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
@@ -99,14 +95,20 @@
 
 	# DocPerm
 	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
 		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': u'All'
+		'role': u'Accounts User',
+		'submit': 0,
+		'write': 0
 	},
 
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -163,6 +165,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break1',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -229,6 +232,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'section_break0',
 		'fieldtype': u'Section Break',
 		'oldfieldtype': u'Section Break',
 		'permlevel': 0
@@ -237,6 +241,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break2',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -285,6 +290,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break3',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -294,6 +300,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'html0',
 		'fieldtype': u'HTML',
 		'oldfieldtype': u'HTML',
 		'options': u'<b>Please Update Cheque No., BSR Code, Challan ID no. after actual payment. Unless you do not get it in Form 16A.</b>',
@@ -352,6 +359,7 @@
 	{
 		'allow_on_submit': 1,
 		'doctype': u'DocField',
+		'fieldname': u'update',
 		'fieldtype': u'Button',
 		'label': u'Update',
 		'oldfieldtype': u'Button',
@@ -363,6 +371,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'section_break1',
 		'fieldtype': u'Section Break',
 		'oldfieldtype': u'Section Break',
 		'permlevel': 0
@@ -371,6 +380,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'get_tds_list',
 		'fieldtype': u'Button',
 		'label': u'Get TDS List',
 		'oldfieldtype': u'Button',
@@ -393,6 +403,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'section_break2',
 		'fieldtype': u'Section Break',
 		'oldfieldtype': u'Section Break',
 		'permlevel': 0
@@ -413,6 +424,7 @@
 	{
 		'allow_on_submit': 1,
 		'doctype': u'DocField',
+		'fieldname': u'make_bank_voucher',
 		'fieldtype': u'Button',
 		'label': u'Make Bank Voucher',
 		'oldfieldtype': u'Button',
diff --git a/erpnext/accounts/doctype/tds_payment_detail/tds_payment_detail.txt b/erpnext/accounts/doctype/tds_payment_detail/tds_payment_detail.txt
index d971509..4443090 100644
--- a/erpnext/accounts/doctype/tds_payment_detail/tds_payment_detail.txt
+++ b/erpnext/accounts/doctype/tds_payment_detail/tds_payment_detail.txt
@@ -3,116 +3,109 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:27',
+		'creation': '2012-03-27 14:35:49',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:49',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 11
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'TDS Payment Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'TDS Payment Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# DocType, TDS Payment Detail
 	{
 		'doctype': 'DocType',
-		'name': 'TDS Payment Detail'
+		'name': u'TDS Payment Detail'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'voucher_no',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'label': 'Voucher No',
-		'oldfieldname': 'voucher_no',
-		'oldfieldtype': 'Data'
+		'doctype': u'DocField',
+		'fieldname': u'voucher_no',
+		'fieldtype': u'Data',
+		'label': u'Voucher No',
+		'oldfieldname': u'voucher_no',
+		'oldfieldtype': u'Data'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'party_name',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Party Name',
-		'oldfieldname': 'party_name',
-		'oldfieldtype': 'Data'
+		'doctype': u'DocField',
+		'fieldname': u'party_name',
+		'fieldtype': u'Data',
+		'label': u'Party Name',
+		'oldfieldname': u'party_name',
+		'oldfieldtype': u'Data'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amount_paid',
-		'fieldtype': 'Currency',
-		'idx': 3,
-		'label': 'Amount paid / credited',
-		'oldfieldname': 'amount_paid',
-		'oldfieldtype': 'Currency'
+		'doctype': u'DocField',
+		'fieldname': u'amount_paid',
+		'fieldtype': u'Currency',
+		'label': u'Amount paid / credited',
+		'oldfieldname': u'amount_paid',
+		'oldfieldtype': u'Currency'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'date_of_payment',
-		'fieldtype': 'Date',
-		'idx': 4,
-		'label': 'Date of payment / credit',
-		'oldfieldname': 'date_of_payment',
-		'oldfieldtype': 'Date'
+		'doctype': u'DocField',
+		'fieldname': u'date_of_payment',
+		'fieldtype': u'Date',
+		'label': u'Date of payment / credit',
+		'oldfieldname': u'date_of_payment',
+		'oldfieldtype': u'Date'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'tds_amount',
-		'fieldtype': 'Currency',
-		'idx': 5,
-		'label': 'TDS',
-		'oldfieldname': 'tds_amount',
-		'oldfieldtype': 'Currency'
+		'doctype': u'DocField',
+		'fieldname': u'tds_amount',
+		'fieldtype': u'Currency',
+		'label': u'TDS',
+		'oldfieldname': u'tds_amount',
+		'oldfieldtype': u'Currency'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'cess_on_tds',
-		'fieldtype': 'Currency',
-		'idx': 6,
-		'label': 'Cess on TDS',
-		'oldfieldname': 'cess_on_tds',
-		'oldfieldtype': 'Currency'
+		'doctype': u'DocField',
+		'fieldname': u'cess_on_tds',
+		'fieldtype': u'Currency',
+		'label': u'Cess on TDS',
+		'oldfieldname': u'cess_on_tds',
+		'oldfieldtype': u'Currency'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'total_tax_amount',
-		'fieldtype': 'Currency',
-		'idx': 7,
-		'label': 'Total Tax Amount',
-		'oldfieldname': 'total_tax_amount',
-		'oldfieldtype': 'Currency'
+		'doctype': u'DocField',
+		'fieldname': u'total_tax_amount',
+		'fieldtype': u'Currency',
+		'label': u'Total Tax Amount',
+		'oldfieldname': u'total_tax_amount',
+		'oldfieldtype': u'Currency'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/tds_rate_chart/tds_rate_chart.txt b/erpnext/accounts/doctype/tds_rate_chart/tds_rate_chart.txt
index 23e7b72..52d475d 100644
--- a/erpnext/accounts/doctype/tds_rate_chart/tds_rate_chart.txt
+++ b/erpnext/accounts/doctype/tds_rate_chart/tds_rate_chart.txt
@@ -3,45 +3,45 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:27',
+		'creation': '2012-03-27 14:35:49',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:49',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'autoname': 'Prompt',
-		'colour': 'White:FFF',
+		'autoname': u'Prompt',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'in_create': 1,
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
 		'read_only': 0,
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 11
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'TDS Rate Chart',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'TDS Rate Chart',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'TDS Rate Chart',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'TDS Rate Chart',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1
 	},
@@ -49,7 +49,7 @@
 	# DocType, TDS Rate Chart
 	{
 		'doctype': 'DocType',
-		'name': 'TDS Rate Chart'
+		'name': u'TDS Rate Chart'
 	},
 
 	# DocPerm
@@ -57,21 +57,8 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'Accounts User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'Accounts Manager',
+		'doctype': u'DocPerm',
+		'role': u'Accounts Manager',
 		'submit': 0,
 		'write': 0
 	},
@@ -79,49 +66,56 @@
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'role': 'System Manager',
+		'doctype': u'DocPerm',
+		'role': u'System Manager',
 		'write': 1
 	},
 
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'role': u'Accounts User',
+		'submit': 0,
+		'write': 0
+	},
+
 	# DocField
 	{
-		'default': 'Accounts',
-		'doctype': 'DocField',
-		'fieldname': 'module',
-		'fieldtype': 'Link',
+		'default': u'Accounts',
+		'doctype': u'DocField',
+		'fieldname': u'module',
+		'fieldtype': u'Link',
 		'hidden': 1,
-		'idx': 1,
-		'label': 'Module',
-		'oldfieldname': 'module',
-		'oldfieldtype': 'Link',
-		'options': 'Module Def',
+		'label': u'Module',
+		'oldfieldname': u'module',
+		'oldfieldtype': u'Link',
+		'options': u'Module Def',
 		'print_hide': 1,
 		'report_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'applicable_from',
-		'fieldtype': 'Date',
-		'idx': 2,
-		'label': 'Applicable From',
-		'oldfieldname': 'applicable_from',
-		'oldfieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'applicable_from',
+		'fieldtype': u'Date',
+		'label': u'Applicable From',
+		'oldfieldname': u'applicable_from',
+		'oldfieldtype': u'Date',
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'rate_chart_detail',
-		'fieldtype': 'Table',
-		'idx': 3,
-		'label': 'Rate Chart Detail',
-		'oldfieldname': 'rate_chart_detail',
-		'oldfieldtype': 'Table',
-		'options': 'TDS Rate Detail'
+		'doctype': u'DocField',
+		'fieldname': u'rate_chart_detail',
+		'fieldtype': u'Table',
+		'label': u'Rate Chart Detail',
+		'oldfieldname': u'rate_chart_detail',
+		'oldfieldtype': u'Table',
+		'options': u'TDS Rate Detail'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/tds_rate_detail/tds_rate_detail.txt b/erpnext/accounts/doctype/tds_rate_detail/tds_rate_detail.txt
index b7e19b1..d343286 100644
--- a/erpnext/accounts/doctype/tds_rate_detail/tds_rate_detail.txt
+++ b/erpnext/accounts/doctype/tds_rate_detail/tds_rate_detail.txt
@@ -3,86 +3,82 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:27',
+		'creation': '2012-03-27 14:35:49',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:49',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 7
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'TDS Rate Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'TDS Rate Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# DocType, TDS Rate Detail
 	{
 		'doctype': 'DocType',
-		'name': 'TDS Rate Detail'
+		'name': u'TDS Rate Detail'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'category',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Category',
-		'oldfieldname': 'category',
-		'oldfieldtype': 'Link',
-		'options': 'TDS Category',
-		'width': '200px'
+		'doctype': u'DocField',
+		'fieldname': u'category',
+		'fieldtype': u'Link',
+		'label': u'Category',
+		'oldfieldname': u'category',
+		'oldfieldtype': u'Link',
+		'options': u'TDS Category',
+		'width': u'200px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'slab_from',
-		'fieldtype': 'Currency',
-		'idx': 2,
-		'label': 'Slab From',
-		'oldfieldname': 'slab_from',
-		'oldfieldtype': 'Currency'
+		'doctype': u'DocField',
+		'fieldname': u'slab_from',
+		'fieldtype': u'Currency',
+		'label': u'Slab From',
+		'oldfieldname': u'slab_from',
+		'oldfieldtype': u'Currency'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'rate',
-		'fieldtype': 'Currency',
-		'idx': 3,
-		'label': 'Rate',
-		'oldfieldname': 'rate',
-		'oldfieldtype': 'Currency',
-		'width': '50px'
+		'doctype': u'DocField',
+		'fieldname': u'rate',
+		'fieldtype': u'Currency',
+		'label': u'Rate',
+		'oldfieldname': u'rate',
+		'oldfieldtype': u'Currency',
+		'width': u'50px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'rate_without_pan',
-		'fieldtype': 'Currency',
-		'idx': 4,
-		'label': 'Rate without PAN',
-		'oldfieldname': 'rate_without_pan',
-		'oldfieldtype': 'Currency'
+		'doctype': u'DocField',
+		'fieldname': u'rate_without_pan',
+		'fieldtype': u'Currency',
+		'label': u'Rate without PAN',
+		'oldfieldname': u'rate_without_pan',
+		'oldfieldtype': u'Currency'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/tds_return_acknowledgement/tds_return_acknowledgement.txt b/erpnext/accounts/doctype/tds_return_acknowledgement/tds_return_acknowledgement.txt
index 769064d..4471ad59 100644
--- a/erpnext/accounts/doctype/tds_return_acknowledgement/tds_return_acknowledgement.txt
+++ b/erpnext/accounts/doctype/tds_return_acknowledgement/tds_return_acknowledgement.txt
@@ -3,32 +3,32 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:27',
+		'creation': '2012-03-27 14:35:49',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'nabin@webnotestech.com'
+		'modified': '2012-03-27 14:35:49',
+		'modified_by': u'Administrator',
+		'owner': u'nabin@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'autoname': 'TDSR/.####',
-		'colour': 'White:FFF',
+		'autoname': u'TDSR/.####',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'module': 'Accounts',
+		'module': u'Accounts',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 13
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'TDS Return Acknowledgement',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'TDS Return Acknowledgement',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'reqd': 1
 	},
@@ -36,11 +36,11 @@
 	# These values are common for all DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'TDS Return Acknowledgement',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'TDS Return Acknowledgement',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
 		'write': 1
@@ -49,80 +49,73 @@
 	# DocType, TDS Return Acknowledgement
 	{
 		'doctype': 'DocType',
-		'name': 'TDS Return Acknowledgement'
+		'name': u'TDS Return Acknowledgement'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'Accounts User'
+		'doctype': u'DocPerm',
+		'role': u'Accounts User'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'Accounts Manager'
+		'doctype': u'DocPerm',
+		'role': u'Accounts Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Select',
-		'idx': 1,
-		'label': 'Fiscal Year',
-		'oldfieldname': 'fiscal_year',
-		'oldfieldtype': 'Select',
-		'options': 'link:Fiscal Year'
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
+		'label': u'Fiscal Year',
+		'oldfieldname': u'fiscal_year',
+		'oldfieldtype': u'Select',
+		'options': u'link:Fiscal Year'
 	},
 
 	# DocField
 	{
 		'allow_on_submit': 0,
-		'doctype': 'DocField',
-		'fieldname': 'quarter',
-		'fieldtype': 'Select',
-		'idx': 2,
-		'label': 'Quarter',
-		'oldfieldname': 'quarter',
-		'oldfieldtype': 'Select',
-		'options': '\nApr-Jun\nJul-Sept\nOct-Dec\nJan-Mar',
-		'trigger': 'Client'
+		'doctype': u'DocField',
+		'fieldname': u'quarter',
+		'fieldtype': u'Select',
+		'label': u'Quarter',
+		'oldfieldname': u'quarter',
+		'oldfieldtype': u'Select',
+		'options': u'\nApr-Jun\nJul-Sept\nOct-Dec\nJan-Mar',
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'tds_category',
-		'fieldtype': 'Select',
-		'idx': 3,
-		'label': 'TDS Category',
-		'oldfieldname': 'tds_category',
-		'oldfieldtype': 'Select',
-		'options': 'link:TDS Category'
+		'doctype': u'DocField',
+		'fieldname': u'tds_category',
+		'fieldtype': u'Select',
+		'label': u'TDS Category',
+		'oldfieldname': u'tds_category',
+		'oldfieldtype': u'Select',
+		'options': u'link:TDS Category'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'acknowledgement_no',
-		'fieldtype': 'Data',
-		'idx': 4,
-		'label': 'Acknowledgement No',
-		'oldfieldname': 'acknowledgement_no',
-		'oldfieldtype': 'Data'
+		'doctype': u'DocField',
+		'fieldname': u'acknowledgement_no',
+		'fieldtype': u'Data',
+		'label': u'Acknowledgement No',
+		'oldfieldname': u'acknowledgement_no',
+		'oldfieldtype': u'Data'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'date_of_receipt',
-		'fieldtype': 'Date',
-		'idx': 5,
-		'label': 'Date of Receipt',
-		'oldfieldname': 'date_of_receipt',
-		'oldfieldtype': 'Date'
+		'doctype': u'DocField',
+		'fieldname': u'date_of_receipt',
+		'fieldtype': u'Date',
+		'label': u'Date of Receipt',
+		'oldfieldname': u'date_of_receipt',
+		'oldfieldtype': u'Date'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/ir_payment_detail/__init__.py b/erpnext/accounts/doctype/trend_analyzer_control/__init__.py
old mode 100644
new mode 100755
similarity index 100%
copy from erpnext/accounts/doctype/ir_payment_detail/__init__.py
copy to erpnext/accounts/doctype/trend_analyzer_control/__init__.py
diff --git a/erpnext/accounts/doctype/trend_analyzer_control/trend_analyzer_control.py b/erpnext/accounts/doctype/trend_analyzer_control/trend_analyzer_control.py
new file mode 100755
index 0000000..25c4492
--- /dev/null
+++ b/erpnext/accounts/doctype/trend_analyzer_control/trend_analyzer_control.py
@@ -0,0 +1,123 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+class DocType:
+        def __init__(self, d, dl):
+                self.doc, self.doclist = d, dl
+
+
+        # Define Globals
+        # ---------------
+        def define_globals(self, trans, fiscal_year):
+                self.month_name = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
+
+                if trans == 'Purchase Receipt' or trans == 'Delivery Note' or trans == 'Purchase Invoice' or trans == 'Sales Invoice':
+                        self.trans_date = 'posting_date'
+                else:
+                        self.trans_date = 'transaction_date'
+                
+                ysd = sql("select year_start_date from `tabFiscal Year` where name = %s",fiscal_year)[0][0]
+                self.year_start_date = ysd.strftime('%Y-%m-%d')
+                self.start_month = cint(self.year_start_date.split('-')[1])
+
+
+        # Get Column Names and Query for Annual Trend
+        # ---------------------------------------------
+        def get_annual_trend_details(self, fiscal_year):
+                col_names = [fiscal_year+' (Qty)', fiscal_year+' (Amt)']
+                query_val = 'SUM(t2.qty) ,SUM(t2.amount),'
+                return col_names, query_val
+
+
+        # Get Column Names and Query for Half Yearly Trend
+        # --------------------------------------------------
+        def get_half_yearly_trend_details(self):
+                first_half_start = self.year_start_date
+                first_half_end = add_days(add_months(first_half_start,6),-1)
+                second_half_start = add_days(first_half_end,1)
+                second_half_end = add_days(add_months(second_half_start,6),-1)
+                
+                col_names = ['First Half (Qty)', 'First Half (Amt)', 'Second Half (Qty)', 'Second Half (Amt)']
+               
+                query_val = 'SUM(CASE WHEN t1.'+self.trans_date+' BETWEEN "'+first_half_start+'" AND "'+first_half_end+'" THEN t2.qty ELSE NULL END), SUM(CASE WHEN t1.'+self.trans_date+' BETWEEN "'+first_half_start+'" AND "'+first_half_end+'" THEN t2.amount ELSE NULL END), SUM(CASE WHEN t1.'+self.trans_date+' BETWEEN "'+second_half_start+'" AND "'+second_half_end+'" THEN t2.qty ELSE NULL END), SUM(CASE WHEN t1.'+self.trans_date+' BETWEEN "'+second_half_start+'" AND "'+second_half_end+'" THEN t2.amount ELSE NULL END),'
+
+                return col_names, query_val
+
+
+        # Get Column Names and Query for Quarterly Trend
+        # ------------------------------------------------
+        def get_quarterly_trend_details(self):
+                first_qsd, second_qsd, third_qsd, fourth_qsd = self.year_start_date, add_months(self.year_start_date,3), add_months(self.year_start_date,6), add_months(self.year_start_date,9)
+
+                first_qed, second_qed, third_qed, fourth_qed = add_days(add_months(first_qsd,3),-1), add_days(add_months(second_qsd,3),-1), add_days(add_months(third_qsd,3),-1), add_days(add_months(fourth_qsd,3),-1)
+
+                col_names = ['Q1 (Qty)','Q1 (Amt)','Q2 (Qty)','Q2 (Amt)','Q3 (Qty)','Q3 (Amt)','Q4 (Qty)','Q4 (Amt)']
+                query_val = ''
+                bet_dates = [[first_qsd,first_qed],[second_qsd,second_qed],[third_qsd,third_qed],[fourth_qsd,fourth_qed]]
+
+                for d in bet_dates:
+                        query_val += 'SUM(CASE WHEN t1.'+self.trans_date+' BETWEEN "'+d[0]+'" AND "'+d[1]+'" THEN t2.qty ELSE NULL END), SUM(CASE WHEN t1.'+self.trans_date+' BETWEEN "'+d[0]+'" AND "'+d[1]+'" THEN t2.amount ELSE NULL END),'
+                
+                return col_names, query_val
+
+
+        # Get Column Names and Query for Monthly Trend
+        # -----------------------------------------------
+        def get_monthly_trend_details(self):
+                col_names, query_val = [], ''
+                for i in range(self.start_month-1, len(self.month_name)):
+                        col_names.append(self.month_name[i]+' (Qty)')
+                        col_names.append(self.month_name[i]+' (Amt)')
+                        query_val += 'SUM(CASE WHEN MONTH(t1.'+self.trans_date+') = '+cstr(i+1)+' THEN t2.qty ELSE NULL END), SUM(CASE WHEN MONTH(t1.'+self.trans_date+') = '+cstr(i+1)+' THEN t2.amount ELSE NULL END),'
+
+                for i in range(0, self.start_month-1):
+                        col_names.append(self.month_name[i]+' (Qty)')
+                        col_names.append(self.month_name[i]+' (Amt)')
+                        query_val += 'SUM(CASE WHEN MONTH(t1.'+self.trans_date+') = '+cstr(i+1)+' THEN t2.qty ELSE NULL END), SUM(CASE WHEN MONTH(t1.'+self.trans_date+') = '+cstr(i+1)+' THEN t2.amount ELSE NULL END),'
+                
+                return col_names, query_val
+
+
+        # Get Single Year Trend's Query and Columns
+        # -------------------------------------------
+        def get_single_year_query_value(self, fiscal_year, period, trans, trans_det):
+                self.define_globals(trans, fiscal_year)
+                if period == 'Annual':
+                        return self.get_annual_trend_details(fiscal_year)
+                elif period == 'Half Yearly':
+                        return self.get_half_yearly_trend_details()
+                elif period == 'Quarterly':
+                        return self.get_quarterly_trend_details()
+                elif period == 'Monthly':
+                        return self.get_monthly_trend_details()
diff --git a/erpnext/accounts/doctype/trend_analyzer_control/trend_analyzer_control.txt b/erpnext/accounts/doctype/trend_analyzer_control/trend_analyzer_control.txt
new file mode 100755
index 0000000..e7dc9b4
--- /dev/null
+++ b/erpnext/accounts/doctype/trend_analyzer_control/trend_analyzer_control.txt
@@ -0,0 +1,32 @@
+# DocType, Trend Analyzer Control
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:49',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:49',
+		'modified_by': u'Administrator',
+		'owner': u'saumil@webnotestech.com'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'in_create': 1,
+		'issingle': 1,
+		'module': u'Accounts',
+		'name': '__common__',
+		'read_only': 1,
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'version': 11
+	},
+
+	# DocType, Trend Analyzer Control
+	{
+		'doctype': 'DocType',
+		'name': u'Trend Analyzer Control'
+	}
+]
diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.css b/erpnext/accounts/page/accounts_browser/accounts_browser.css
index 4a55dd3..bbbbb6b 100644
--- a/erpnext/accounts/page/accounts_browser/accounts_browser.css
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.css
@@ -1,9 +1,20 @@
-h1 { padding: 8px 0px; margin: 0px; }
-#ledger_area { padding: 16px;}
-.ac_head { display: none; }
-.ac_head div { padding: 2px; }
-.ac_ledger { display: none; padding: 8px; margin-top: 8px; border-top: 1px solid #DDD; }
-.ac_balance { margin-left: 4px; font-size: 16px; font-weight: bold; background-color: #FFFAB0; }
+select.accbrowser-company-select {
+	width: 200px;
+	margin-top: 2px;
+	margin-left: 10px;
+}
 
-.ac_page_sel_tab { width:90%; background-color: #EEE; margin-bottom: 8px }
-.ac_page_sel_tab td { vertical-align: middle; padding: 3px; }
\ No newline at end of file
+span.tree-node-toolbar {
+	padding: 2px;
+	margin-left: 15px;
+	border-radius: 3px;
+	-moz-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+	background-color: #ddd;
+}
+
+.tree-area a.selected {
+	font-weight: bold;
+	text-decoration: underline;
+}
diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.html b/erpnext/accounts/page/accounts_browser/accounts_browser.html
index 8614f2c..de55f08 100644
--- a/erpnext/accounts/page/accounts_browser/accounts_browser.html
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.html
@@ -1,4 +1,12 @@
-<div class="layout_wrapper">
-<div id="ab_header"></div>
-<div id="ab_body" style="margin: 16px"></div>
+<div class="layout-wrapper layout-wrapper-background">
+	<div class="appframe-area"></div>
+	<div class="layout-main-section">
+		<div class="tree-area"></div>
+	</div>
+	<div class="layout-side-section">
+		<div class="help">1. To add child nodes, explore tree and click on the node under which you want to add more nodes.<br><br>
+			2. Please do NOT create accounts (ledgers) for Customers and Suppliers. They are created directly from the Customer / Supplier masters.<br>
+		</div>
+	</div>
+	<div class="clear"></div>
 </div>
\ No newline at end of file
diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.js b/erpnext/accounts/page/accounts_browser/accounts_browser.js
index 60c168d..0561bd7 100644
--- a/erpnext/accounts/page/accounts_browser/accounts_browser.js
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.js
@@ -14,45 +14,246 @@
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-pscript['onshow_Accounts Browser'] = function(){
-	wn.require('lib/js/legacy/widgets/tree.js');
+// tree of chart of accounts / cost centers
+// multiple companies
+// add node
+// edit node
+// see ledger
 
-	var route = decodeURIComponent(location.hash);
-	if(route.indexOf('/')!=-1) {
-		var chart_type = route.split('/')[1];
-		pscript.make_chart(chart_type);
-		return;
+pscript['onload_Accounts Browser'] = function(wrapper){
+	wn.require('lib/js/wn/ui/tree.js');
+	wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
+	wrapper.appframe.add_button('New Company', function() { newdoc('Company'); }, 'icon-plus');
+	wrapper.appframe.add_button('Refresh', function() {  
+			wrapper.$company_select.change();
+		}, 'icon-refresh');
+
+	// company-select
+	wrapper.$company_select = $('<select class="accbrowser-company-select"></select>')
+		.change(function() {
+			var ctype = wn.get_route()[1] || 'Account';
+			erpnext.account_chart = new erpnext.AccountsChart(ctype, $(this).val(), wrapper);
+		})
+		.appendTo(wrapper.appframe.$w.find('.appframe-toolbar'));
+		
+	// default company
+	if(sys_defaults.company) {
+		$('<option>')
+			.html(sys_defaults.company)
+			.attr('value', sys_defaults.company)
+			.appendTo(wrapper.$company_select);
+
+		wrapper.$company_select
+			.val(sys_defaults.company).change();
 	}
-	
-	// if the user directly loads the page, ask to select the chart
-	var parent = $i('ab_body');
-	parent.innerHTML = 'Please select your chart: '
-	var sel = $a(parent,'select');
-	add_sel_options(sel, ['Account', 'Cost Center'], 'Account');
-	var btn = $btn(parent, 'Go', function() { pscript.make_chart(sel_val(sel)); }, {marginTop:'8px'});
+
+	// load up companies
+	wn.call({
+		method:'accounts.page.accounts_browser.accounts_browser.get_companies',
+		callback: function(r) {
+			wrapper.$company_select.empty();
+			$.each(r.message, function(i, v) {
+				$('<option>').html(v).attr('value', v).appendTo(wrapper.$company_select);
+			});
+			wrapper.$company_select.val(sys_defaults.company || r[0]);
+		}
+	});
 }
 
-pscript.make_chart = function(b) {
-  pscript.chart_type = b;
-  $i('ab_header').innerHTML ='';
-  $i('ab_body').innerHTML ='';
+pscript['onshow_Accounts Browser'] = function(wrapper){
+	// set route
+	var ctype = wn.get_route()[1] || 'Account';
+	wrapper.appframe.title('Chart of '+ctype+'s');  
 
-  //===============comment area========================================
-  var comment = $a($i('ab_body'),'div','comment',{marginBottom:"8px"});
-  comment.innerHTML = "Note: Explore and click on the tree node to add a new child";
-  
-  var select_area = $a('ab_body', 'div', '', {margin:'8px 0px'});
+	if(erpnext.account_chart && erpnext.account_chart.ctype != ctype) {
+		wrapper.$company_select.change();
+	} 
+
+}
+
+erpnext.AccountsChart = Class.extend({
+	init: function(ctype, company, wrapper) {
+		$(wrapper).find('.tree-area').empty();
+		var me = this;
+		me.ctype = ctype;
+		me.company = company;
+		this.tree = new wn.ui.Tree({
+			parent: $(wrapper).find('.tree-area'), 
+			label: company,
+			args: {ctype: ctype},
+			method: 'accounts.page.accounts_browser.accounts_browser.get_children',
+			click: function(link) {
+				if(me.cur_toolbar) 
+					$(me.cur_toolbar).toggle(false);
+
+				if(!link.toolbar) 
+					me.make_link_toolbar(link);
+
+				if(link.toolbar) {
+					me.cur_toolbar = link.toolbar;
+					$(me.cur_toolbar).toggle(true);					
+				}
+			
+			}
+		});
+		this.tree.rootnode.$a.click();		
+	},
+	make_link_toolbar: function(link) {
+		var data = $(link).data('node-data');
+		if(!data) return;
+
+		link.toolbar = $('<span class="tree-node-toolbar"></span>').insertAfter(link);
+		
+		// edit
+		$('<a href="#!Form/'+encodeURIComponent(this.ctype)+'/'
+			+encodeURIComponent(data.value)+'">Edit</a>').appendTo(link.toolbar);
+
+		if(data.expandable) {
+			link.toolbar.append(' | <a onclick="erpnext.account_chart.new_node();">Add Child</a>');
+		} else if(this.ctype=='Account') {
+			link.toolbar.append(' | <a onclick="erpnext.account_chart.show_ledger();">View Ledger</a>');
+		}
+	},
+	show_ledger: function() {
+		var me = this;
+		var node = me.selected_node();
+		wn.set_route('Report', 'GL Entry', 'General Ledger', 
+			this.ctype + '=' + node.data('label'));
+	},
+	new_node: function() {
+		if(this.ctype=='Account') {
+			this.new_account();
+		} else {
+			this.new_cost_center();
+		}
+	},
+	selected_node: function() {
+		return this.tree.$w.find('.tree-link.selected');
+	},
+	new_account: function() {
+		var me = this;
+		
+		// the dialog
+		var d = new wn.ui.Dialog({
+			title:'New Account',
+			fields: [
+				{fieldtype:'Data', fieldname:'account_name', label:'New Account Name', reqd:true},
+				{fieldtype:'Select', fieldname:'group_or_ledger', label:'Group or Ledger',
+					options:'Group\nLedger'},
+				{fieldtype:'Select', fieldname:'account_type', label:'Account Type',
+					options: ['', 'Fixed Asset Account', 'Bank or Cash', 'Expense Account', 'Tax',
+						'Income Account', 'Chargeable'].join('\n') },
+				{fieldtype:'Float', fieldname:'tax_rate', label:'Tax Rate'},
+				{fieldtype:'Select', fieldname:'master_type', label:'Master Type',
+					options: ['NA', 'Supplier', 'Customer', 'Employee'].join('\n') },
+				{fieldtype:'Button', fieldname:'create_new', label:'Create New' }
+			]
+		})
+
+		var fd = d.fields_dict;
+		
+		// account type if ledger
+		$(fd.group_or_ledger.input).change(function() {
+			if($(this).val()=='Group') {
+				$(fd.account_type.wrapper).toggle(false);
+				$(fd.master_type.wrapper).toggle(false);
+				$(fd.tax_rate.wrapper).toggle(false);
+			} else {
+				$(fd.account_type.wrapper).toggle(true);
+				$(fd.master_type.wrapper).toggle(true);
+				if(fd.account_type.get_value()=='Tax') {
+					$(fd.tax_rate.wrapper).toggle(true);
+				}
+			}
+		});
+		
+		// tax rate if tax
+		$(fd.account_type.input).change(function() {
+			if($(this).val()=='Tax') {
+				$(fd.tax_rate.wrapper).toggle(true);				
+			} else {
+				$(fd.tax_rate.wrapper).toggle(false);				
+			}
+		})
+		
+		// create
+		$(fd.create_new.input).click(function() {
+			var btn = this;
+			$(btn).set_working();
+			var v = d.get_values();
+			if(!v) return;
+					
+			var node = me.selected_node();
+			v.parent_account = node.data('label');
+			v.company = me.company;
+			
+		    $c_obj('GL Control', 'add_ac', v, 
+				function(r,rt) { 
+					$(btn).done_working();
+					d.hide();
+					node.trigger('reload'); 	
+				});
+		});
+		
+		// show
+		d.onshow = function() {
+			$(fd.group_or_ledger.input).change();
+		}
+		d.show();
+	},
+	
+	new_cost_center: function(){
+		var me = this;
+		// the dialog
+		var d = new wn.ui.Dialog({
+			title:'New Cost Center',
+			fields: [
+				{fieldtype:'Data', fieldname:'cost_center_name', label:'New Cost Center Name', reqd:true},
+				{fieldtype:'Select', fieldname:'group_or_ledger', label:'Group or Ledger',
+					options:'Group\nLedger'},
+				{fieldtype:'Button', fieldname:'create_new', label:'Create New' }
+			]
+		})		
+	
+		// create
+		$(d.fields_dict.create_new.input).click(function() {
+			var btn = this;
+			$(btn).set_working();
+			var v = d.get_values();
+			if(!v) return;
+			
+			var node = me.selected_node();
+			
+			v.parent_cost_center = node.data('label');
+			v.company_name = me.company;
+			
+		    $c_obj('GL Control', 'add_cc', v, 
+				function(r,rt) { 
+					$(btn).done_working();
+					d.hide();
+					node.trigger('reload'); 	
+				});
+		});
+		d.show();
+	}
+});
+
+/*
+pscript.make_chart = function(b, wrapper) {
+	pscript.ctype = b;
+	$(wrapper).find('.tree-area').empty()
+	$(wrapper).find('.layout-sidesection').empty()
   
   //================== table body======================================  
   var ac_main_grid = make_table($i('ab_body'),1,2,'100%',['60%','40%'],{border:"0px", padding:"4px",tableLayout: "fixed", borderCollapse: "collapse"});
   $y($td(ac_main_grid,0,0),{border: "1px solid #dddddd", padding: "8px"});
-  pscript.account_tree = $a($td(ac_main_grid,0,0),'div');
+  pscript.account_tree = $a($td(ac_main_grid,0,0),'div', '',{minHeight:'400px'});
   $y($td(ac_main_grid,0,1),{border: "1px solid #DDD"});
   pscript.la = $a($td(ac_main_grid,0,1),'div');
   pscript.acc_period_bal = $a($td(ac_main_grid,0,1),'div');
   
   //=====================footer area ==================================
-  if (pscript.chart_type == 'Account') {
+  if (pscript.ctype == 'Account') {
     var footer = $a($i('ab_body'),'div','',{backgroundColor: "#FFD", padding: "8px", color: "#444", fontSize: "12px", marginTop: "14px"});
     
     var help1 = $a(footer,'span');
@@ -62,12 +263,7 @@
 
   // header and toolbar
   // ------------------
-  
-  var h1 = 'Chart of '+pscript.chart_type+'s';
-  if(pscript.chart_type == 'Account') var d = 'accounting';
-  else var d = 'cost center';
-  var desc = 'Manage multiple companies and the '+d+' structures of each company.';
-  $i('ab_body').page_head = new PageHeader('ab_header',h1,desc);
+  wrapper.appframe.$titlebar.find('.appframe-title').html('Chart of '+pscript.ctype+'s');  
 
   // select company
   // --------------
@@ -107,18 +303,13 @@
   pscript.make_group_area();
   pscript.make_ledger_area();
   pscript.make_new_acc_dialog();
-  pscript.make_new_comp();
   pscript.make_new_cost_center_dialog();
 
 }
-//New company link
-pscript.make_new_comp = function(){
-  $i('ab_body').page_head.add_button('New Company', function() { new_doc('Company'); }, 0, 'ui-icon-plus');
-}
 
 pscript.make_ac_tree = function() {
-  //var type= sel_val($i('chart_type'))
-  var type= pscript.chart_type;
+  //var type= sel_val($i('ctype'))
+  var type= pscript.ctype;
   var tree = new Tree(pscript.account_tree, '90%');
   pscript.ac_tree = tree;
 
@@ -173,9 +364,9 @@
     }
 
     if (type=='Account'){
-      var arg = [node.rec.name, node.rec.account_name, sel_val(pscript.ab_company_sel), pscript.chart_type];
+      var arg = [node.rec.name, node.rec.account_name, sel_val(pscript.ab_company_sel), pscript.ctype];
     } else{
-        var arg = [node.rec.name, node.rec.cost_center_name,sel_val(pscript.ab_company_sel), pscript.chart_type];
+        var arg = [node.rec.name, node.rec.cost_center_name,sel_val(pscript.ab_company_sel), pscript.ctype];
     }
 
     $c_obj('GL Control','get_cl',arg.join(','),callback);
@@ -340,10 +531,6 @@
   pscript.gl_rep.innerHTML = '<img src="lib/images/icons/report.png" style="margin-right: 8px"><span class="link_type">Open Ledger</span>';
   pscript.gl_rep.onclick = function(){ pscript.make_report('gl'); }
 
-  //Budget report link
-  /*pscript.cc_rep = $a(pscript.ledger_area, 'div','', {fontSize: '14px',marginBottom: '8px', fontWeight: 'bold'});
-  pscript.cc_rep.innerHTML = '<img src="images/icons/report.png" style="margin-right: 8px"><span class="link_type">Budget vs Actual Analysis Report</span>';
-  pscript.cc_rep.onclick = function(){ pscript.make_report('budget'); }*/
 }
 
 pscript.make_report = function(flag){
@@ -354,12 +541,6 @@
     }
     loadreport('GL Entry','General Ledger',callback);
   }
-  /*else {
-    loadreport('Budget Detail','Periodical Budget Report',function(f){
-      f.set_filter('Cost Center','ID',pscript.cur_node.rec.name);
-      f.dt.run();
-    });
-  }*/
 }
 
 // New Account
@@ -437,3 +618,4 @@
 
   pscript.new_cost_center_dialog = pscript.cc_dialog;
 }
+*/
\ No newline at end of file
diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.py b/erpnext/accounts/page/accounts_browser/accounts_browser.py
new file mode 100644
index 0000000..ee4ec55
--- /dev/null
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.py
@@ -0,0 +1,31 @@
+import webnotes
+
+@webnotes.whitelist()
+def get_companies():
+	return [r[0] for r in webnotes.conn.sql("""select name from tabCompany where docstatus!=2""")]
+	
+@webnotes.whitelist()
+def get_children():
+	args = webnotes.form_dict
+	ctype = args['ctype']
+	company_field = ctype=='Account' and 'company' or 'company_name'
+	
+	# root
+	if args['parent'] in get_companies():
+		return webnotes.conn.sql("""select 
+			name as value, if(group_or_ledger='Group', 1, 0) as expandable
+			from `tab%s`
+			where ifnull(parent_%s,'') = ''
+			and %s = %s
+			and docstatus<2 
+			order by name""" % (ctype, ctype.lower().replace(' ','_'), company_field, '%s'),
+				args['parent'], as_dict=1)
+	
+	# other
+	return webnotes.conn.sql("""select 
+		name as value, if(group_or_ledger='Group', 1, 0) as expandable
+	 	from `tab%s` 
+		where ifnull(parent_%s,'') = %s
+		and docstatus<2 
+		order by name""" % (ctype, ctype.lower().replace(' ','_'), '%s'),
+			args['parent'], as_dict=1)
\ No newline at end of file
diff --git a/erpnext/accounts/page/accounts_home/accounts_home.html b/erpnext/accounts/page/accounts_home/accounts_home.html
index 8282ae8..398f1e4 100644
--- a/erpnext/accounts/page/accounts_home/accounts_home.html
+++ b/erpnext/accounts/page/accounts_home/accounts_home.html
@@ -1,19 +1,22 @@
 <div class="layout-wrapper layout-wrapper-background">
+	<div class="appframe-area"></div>
 	<div class="layout-main-section">
-		<a class="close" onclick="window.history.back();">&times;</a>
 		<h1>Accounts</h1>
 		<hr>
 		<div style="width: 48%; float: left;">
 			<h4><a href="#!List/Journal Voucher">Journal Voucher</a></h4>
 			<p class="help">General Ledger Entries</p>
+			<br>
 			<h4><a href="#!List/Sales Invoice">Sales Invoice</a></h4>
 			<p class="help">Bills raised to Customers</p>
+			<br>
 			<h4><a href="#!List/Purchase Invoice">Purchase Invoice</a></h4>
 			<p class="help">Bills raised by Suppliers</p>
 		</div>
 		<div style="width: 48%; float: right;">
 			<h4><a href="#!Accounts Browser/Account">Chart of Accounts</a></h4>
 			<p class="help">Structure of books of accounts</p>
+			<br>
 			<h4><a href="#!Accounts Browser/Cost Center">Chart of Cost Centers</a></h4>
 			<p class="help">Structure cost centers</p>
 		</div>
@@ -35,7 +38,7 @@
 					<div class="section-item">
 						<a class="section-link" 
 							title="Cancel off untracked Payments (JV) against Invoices"
-							href="#!Form/Internal Reconciliation/Internal Reconciliation">Payment Reconciliation</a>
+							href="#!Form/Payment to Invoice Matching Tool/Payment to Invoice Matching Tool">Payment Reconciliation</a>
 					</div>
 					<div class="section-item">
 						<a class="section-link" 
@@ -45,7 +48,7 @@
 					<div class="section-item">
 						<a class="section-link" 
 							title="Export multiple Account Ledgers (GL) to spreadsheet (csv)"
-							href="#!Form/Ledger Balance Export/Ledger Balance Export">Export Multiple Ledgers (GL)</a>
+							href="#!Form/Multi Ledger Report/Multi Ledger Report">Export Multiple Ledgers (GL)</a>
 					</div>
 					<div class="section-item">
 						<a class="section-link" 
@@ -55,7 +58,7 @@
 					<div class="section-item">
 						<a class="section-link" 
 							title = "Helper for managing return of goods (sales or purchase)"
-							href="#!Form/Sales and Purchase Return Wizard/Sales and Purchase Return Wizard">Sales or Purchase Returns</a>
+							href="#!Form/Sales and Purchase Return Tool/Sales and Purchase Return Tool">Sales or Purchase Returns</a>
 					</div>
 					<div class="section-item">
 						<a class="section-link" 
@@ -78,12 +81,12 @@
 					<div class="section-item">
 						<a class="section-link" 
 							title = "Tax and charges structure master on sales transactions"
-							href="#!List/Other Charges">Sales Other Charges</a>
+							href="#!List/Sales Taxes and Charges Master">Sales Taxes and Charges Master</a>
 					</div>
 					<div class="section-item">
 						<a class="section-link" 
 							title = "Tax and charges structure master on purchase transactions"
-							href="#!List/Purchase Other Charges">Purchase Other Charges</a>
+							href="#!List/Purchase Taxes and Charges Master">Purchase Taxes and Charges Master</a>
 					</div>
 					<div class="section-item">
 						<a class="section-link" 
@@ -98,7 +101,7 @@
 					<div class="section-item">
 						<a class="section-link" 
 							title = "Terms of contract template"
-							href="#!List/Term">Order Terms Template</a>
+							href="#!List/Terms and Conditions">Terms and Conditions Template</a>
 					</div>
 					<div class="section-item">
 						<a class="section-link" 
diff --git a/erpnext/accounts/page/accounts_home/accounts_home.js b/erpnext/accounts/page/accounts_home/accounts_home.js
index 52738a8..9915226 100644
--- a/erpnext/accounts/page/accounts_home/accounts_home.js
+++ b/erpnext/accounts/page/accounts_home/accounts_home.js
@@ -16,6 +16,8 @@
 
 pscript['onload_accounts-home'] = function(wrapper) {
 	erpnext.module_page.setup_page('Accounts', wrapper);
+	wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
+	
 	if(wn.control_panel.country!='India') {
 		$('.india-specific').toggle(false);
 	}
diff --git a/erpnext/accounts/search_criteria/accounts_payable/accounts_payable.js b/erpnext/accounts/search_criteria/accounts_payable/accounts_payable.js
index f4da7e8..1f19537 100644
--- a/erpnext/accounts/search_criteria/accounts_payable/accounts_payable.js
+++ b/erpnext/accounts/search_criteria/accounts_payable/accounts_payable.js
@@ -22,7 +22,7 @@
   this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
   this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.filter_hide = 0;
   
-  this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Transaction Date'+NEWLINE+'Aging Date'+NEWLINE+'Due Date',ignore : 1, parent:'Payable Voucher', report_default:'Aging Date'});  
+  this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Transaction Date'+NEWLINE+'Aging Date'+NEWLINE+'Due Date',ignore : 1, parent:'Purchase Invoice', report_default:'Aging Date'});  
   this.add_filter({fieldname:'range_1', label:'Range 1', fieldtype:'Data', ignore : 1, parent:'GL Entry', report_default:30});
   this.add_filter({fieldname:'range_2', label:'Range 2', fieldtype:'Data', ignore : 1, parent:'GL Entry', report_default:45});
   this.add_filter({fieldname:'range_3', label:'Range 3', fieldtype:'Data', ignore : 1, parent:'GL Entry', report_default:60});
diff --git a/erpnext/accounts/search_criteria/accounts_payable/accounts_payable.py b/erpnext/accounts/search_criteria/accounts_payable/accounts_payable.py
index cbb622f..2ace21c 100644
--- a/erpnext/accounts/search_criteria/accounts_payable/accounts_payable.py
+++ b/erpnext/accounts/search_criteria/accounts_payable/accounts_payable.py
@@ -89,11 +89,11 @@
 
 # get due_date, bill_no, bill_date from PV
 pv_dict = {}
-for t in sql("select name, due_date, bill_no, bill_date from `tabPayable Voucher` group by name"):
+for t in sql("select name, due_date, bill_no, bill_date from `tabPurchase Invoice` group by name"):
 	pv_dict[t[0]] = [cstr(t[1]), t[2], cstr(t[3])]
 
 # pv outside this period
-pv_outside_period = [d[0] for d in sql("select distinct name from `tabPayable Voucher` where (posting_date < '%s' or posting_date > '%s') and docstatus = 1" % (from_date, to_date))]
+pv_outside_period = [d[0] for d in sql("select distinct name from `tabPurchase Invoice` where (posting_date < '%s' or posting_date > '%s') and docstatus = 1" % (from_date, to_date))]
 
 
 out = []
@@ -106,17 +106,17 @@
 	# supplier type
 	r.append(supp_type_dict.get(r[col_idx['Account']], ''))	
 	
-	if r[col_idx['Voucher Type']] == 'Payable Voucher':
+	if r[col_idx['Voucher Type']] == 'Purchase Invoice':
 		r += pv_dict.get(r[col_idx['Voucher No']], ['', '', ''])
 	else:
 		r += ['', '', '']
 	
-	# if entry against Payable Voucher
-	if r[col_idx['Against Voucher']] and r[col_idx['Voucher Type']] == 'Payable Voucher':
+	# if entry against Purchase Invoice
+	if r[col_idx['Against Voucher']] and r[col_idx['Voucher Type']] == 'Purchase Invoice':
 		cond = " and ifnull(against_voucher, '') = '%s'" % r[col_idx['Against Voucher']]
 
 	# if entry against JV & and not adjusted within period
-	elif r[col_idx['Against Voucher Type']] == 'Payable Voucher' and r[col_idx['Against Voucher']] in pv_outside_period:
+	elif r[col_idx['Against Voucher Type']] == 'Purchase Invoice' and r[col_idx['Against Voucher']] in pv_outside_period:
 		booking_amt = 0
 		cond = " and voucher_no = '%s' and ifnull(against_voucher, '') = '%s'" % (r[col_idx['Voucher No']], r[col_idx['Against Voucher']])
 	
@@ -132,7 +132,7 @@
 		total_outstanding_amt += flt(outstanding_amt)
 
 		# add to total booking amount
-		if outstanding_amt and r[col_idx['Voucher Type']] == 'Payable Voucher' and r[col_idx['Against Voucher']]:
+		if outstanding_amt and r[col_idx['Voucher Type']] == 'Purchase Invoice' and r[col_idx['Against Voucher']]:
 			total_booking_amt += flt(booking_amt)
 
 	r += [booking_amt, outstanding_amt]
diff --git a/erpnext/accounts/search_criteria/accounts_payable/accounts_payable.txt b/erpnext/accounts/search_criteria/accounts_payable/accounts_payable.txt
index 08c8bc3..8cc99b3 100644
--- a/erpnext/accounts/search_criteria/accounts_payable/accounts_payable.txt
+++ b/erpnext/accounts/search_criteria/accounts_payable/accounts_payable.txt
@@ -3,30 +3,30 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-10-22 16:28:49',
+		'creation': '2012-04-03 12:49:50',
 		'docstatus': 0,
-		'modified': '2010-10-22 15:16:03',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:50',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'GL Entry\x01Posting Date,GL Entry\x01Account,GL Entry\x01Against Voucher,GL Entry\x01Voucher No',
-		'criteria_name': 'Accounts Payable',
-		'doc_type': 'GL Entry',
+		'columns': u'GL Entry\x01Posting Date,GL Entry\x01Account,GL Entry\x01Against Voucher,GL Entry\x01Voucher No',
+		'criteria_name': u'Accounts Payable',
+		'doc_type': u'GL Entry',
 		'doctype': 'Search Criteria',
-		'filters': "{'GL Entry\x01Is Cancelled':'','GL Entry\x01Fiscal Year':'','GL Entry\x01Company':'','Payable Voucher\x01Aging Based On':'Posting Date','GL Entry\x01Range 1':'30','GL Entry\x01Range 2':'45','GL Entry\x01Range 3':'60','GL Entry\x01Range 4':'90'}",
-		'module': 'Accounts',
+		'filters': u"{'GL Entry\x01Is Cancelled':'','GL Entry\x01Fiscal Year':'','GL Entry\x01Company':'','Purchase Invoice\x01Aging Based On':'Posting Date','GL Entry\x01Range 1':'30','GL Entry\x01Range 2':'45','GL Entry\x01Range 3':'60','GL Entry\x01Range 4':'90'}",
+		'module': u'Accounts',
 		'name': '__common__',
-		'sort_by': '`tabGL Entry`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabGL Entry`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, accounts_payable
 	{
 		'doctype': 'Search Criteria',
-		'name': 'accounts_payable'
+		'name': u'accounts_payable'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/accounts_receivable/accounts_receivable.js b/erpnext/accounts/search_criteria/accounts_receivable/accounts_receivable.js
index efc2ec3..60df6c8 100644
--- a/erpnext/accounts/search_criteria/accounts_receivable/accounts_receivable.js
+++ b/erpnext/accounts/search_criteria/accounts_receivable/accounts_receivable.js
@@ -22,7 +22,7 @@
   this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
   this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.filter_hide = 0;
 
-  this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Transaction Date'+NEWLINE+'Aging Date'+NEWLINE+'Due Date',ignore : 1, parent:'Receivable Voucher', report_default:'Aging Date'});
+  this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Transaction Date'+NEWLINE+'Aging Date'+NEWLINE+'Due Date',ignore : 1, parent:'Sales Invoice', report_default:'Aging Date'});
   this.add_filter({fieldname:'range_1', label:'Range 1', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
   this.add_filter({fieldname:'range_2', label:'Range 2', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
   this.add_filter({fieldname:'range_3', label:'Range 3', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
diff --git a/erpnext/accounts/search_criteria/accounts_receivable/accounts_receivable.py b/erpnext/accounts/search_criteria/accounts_receivable/accounts_receivable.py
index 5a5f4b4..6cd71fe 100644
--- a/erpnext/accounts/search_criteria/accounts_receivable/accounts_receivable.py
+++ b/erpnext/accounts/search_criteria/accounts_receivable/accounts_receivable.py
@@ -84,10 +84,10 @@
   r.append(terr and terr[0][0] or '')
   
   outstanding_amt, opening_amt, cond, due_date = 0,0, '', ''
-  # if entry against Receivable Voucher
-  if r[col_idx['Against Voucher']] and r[col_idx['Voucher Type']] == 'Receivable Voucher':
+  # if entry against Sales Invoice
+  if r[col_idx['Against Voucher']] and r[col_idx['Voucher Type']] == 'Sales Invoice':
     # get due date
-    due_date = sql("select due_date from `tabReceivable Voucher` where name = '%s'" % r[col_idx['Against Voucher']])
+    due_date = sql("select due_date from `tabSales Invoice` where name = '%s'" % r[col_idx['Against Voucher']])
     due_date = due_date and cstr(due_date[0][0]) or ''
 
     # get booking amt
@@ -97,7 +97,7 @@
     cond =  "and against_voucher = '%s' and against_voucher is not null" % r[col_idx['Against Voucher']]
 
   # if entry against JV & and not adjusted within period
-  elif r[col_idx['Against Voucher Type']] == 'Receivable Voucher' and sql("select name from `tabReceivable Voucher` where name = '%s' and (posting_date < '%s' or posting_date > '%s') and docstatus = 1" % (r[col_idx['Against Voucher']], from_date, to_date)):
+  elif r[col_idx['Against Voucher Type']] == 'Sales Invoice' and sql("select name from `tabSales Invoice` where name = '%s' and (posting_date < '%s' or posting_date > '%s') and docstatus = 1" % (r[col_idx['Against Voucher']], from_date, to_date)):
     cond = " and voucher_no = '%s' and ifnull(against_voucher, '') = '%s'" % (r[col_idx['Voucher No']], r[col_idx['Against Voucher']])
   # if entry against JV and unadjusted
   elif not r[col_idx['Against Voucher']]:
@@ -108,7 +108,7 @@
     # add to total outstanding
     total_outstanding_amt += flt(outstanding_amt)
     # add to total booking amount
-    if outstanding_amt and r[col_idx['Voucher Type']] == 'Receivable Voucher' and r[col_idx['Against Voucher']]:
+    if outstanding_amt and r[col_idx['Voucher Type']] == 'Sales Invoice' and r[col_idx['Against Voucher']]:
       total_opening_amt += flt(opening_amt)
 
   r += [due_date, opening_amt, outstanding_amt]
diff --git a/erpnext/accounts/search_criteria/accounts_receivable/accounts_receivable.txt b/erpnext/accounts/search_criteria/accounts_receivable/accounts_receivable.txt
index 2474eb7..33a5318 100644
--- a/erpnext/accounts/search_criteria/accounts_receivable/accounts_receivable.txt
+++ b/erpnext/accounts/search_criteria/accounts_receivable/accounts_receivable.txt
@@ -3,30 +3,30 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-10-19 10:32:39',
+		'creation': '2012-04-03 12:49:50',
 		'docstatus': 0,
-		'modified': '2010-10-19 10:29:38',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:50',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'GL Entry\x01Posting Date,GL Entry\x01Transaction Date,GL Entry\x01Account,GL Entry\x01Against Voucher,GL Entry\x01Voucher No',
-		'criteria_name': 'Accounts Receivable',
-		'doc_type': 'GL Entry',
+		'columns': u'GL Entry\x01Posting Date,GL Entry\x01Transaction Date,GL Entry\x01Account,GL Entry\x01Against Voucher,GL Entry\x01Voucher No',
+		'criteria_name': u'Accounts Receivable',
+		'doc_type': u'GL Entry',
 		'doctype': 'Search Criteria',
-		'filters': "{'GL Entry\x01Is Cancelled':'No','GL Entry\x01Fiscal Year':'','GL Entry\x01Company':'','GL Entry\x01Range 1':'30','GL Entry\x01Range 2':'45','GL Entry\x01Range 3':'60','GL Entry\x01Range 4':'90'}",
-		'module': 'Accounts',
+		'filters': u"{'GL Entry\x01Is Cancelled':'No','GL Entry\x01Fiscal Year':'','GL Entry\x01Company':'','GL Entry\x01Range 1':'30','GL Entry\x01Range 2':'45','GL Entry\x01Range 3':'60','GL Entry\x01Range 4':'90'}",
+		'module': u'Accounts',
 		'name': '__common__',
-		'sort_by': '`tabGL Entry`.`name`',
-		'sort_order': 'ASC',
-		'standard': 'Yes'
+		'sort_by': u'`tabGL Entry`.`name`',
+		'sort_order': u'ASC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, accounts_receivable
 	{
 		'doctype': 'Search Criteria',
-		'name': 'accounts_receivable'
+		'name': u'accounts_receivable'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/bank_clearance_report/bank_clearance_report.txt b/erpnext/accounts/search_criteria/bank_clearance_report/bank_clearance_report.txt
index 5103fd7..c329d7e 100644
--- a/erpnext/accounts/search_criteria/bank_clearance_report/bank_clearance_report.txt
+++ b/erpnext/accounts/search_criteria/bank_clearance_report/bank_clearance_report.txt
@@ -3,34 +3,34 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:31',
+		'creation': '2012-04-03 12:49:50',
 		'docstatus': 0,
-		'modified': '2010-06-09 16:14:13',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:50',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Journal Voucher\x01ID,Journal Voucher Detail\x01Account,Journal Voucher Detail\x01Debit,Journal Voucher Detail\x01Credit,Journal Voucher\x01Clearance Date,Journal Voucher\x01Cheque No,Journal Voucher\x01Cheque Date,Journal Voucher\x01Voucher Date,Journal Voucher\x01Posting Date,Journal Voucher Detail\x01Against Payable,Journal Voucher Detail\x01Against Receivable',
-		'criteria_name': 'Bank Clearance report',
-		'description': 'Bank Clearance report',
-		'dis_filters': 'fiscal_year',
-		'doc_type': 'Journal Voucher Detail',
+		'columns': u'Journal Voucher\x01ID,Journal Voucher Detail\x01Account,Journal Voucher Detail\x01Debit,Journal Voucher Detail\x01Credit,Journal Voucher\x01Clearance Date,Journal Voucher\x01Cheque No,Journal Voucher\x01Cheque Date,Journal Voucher\x01Voucher Date,Journal Voucher\x01Posting Date,Journal Voucher Detail\x01Against Payable,Journal Voucher Detail\x01Against Receivable',
+		'criteria_name': u'Bank Clearance report',
+		'description': u'Bank Clearance report',
+		'dis_filters': u'fiscal_year',
+		'doc_type': u'Journal Voucher Detail',
 		'doctype': 'Search Criteria',
-		'filters': "{'Journal Voucher\x01Submitted':1,'Journal Voucher\x01Voucher Type':'','Journal Voucher\x01Is Opening':'','Journal Voucher\x01Fiscal Year':'','Journal Voucher\x01Company':'','Journal Voucher\x01TDS Applicable':'','Journal Voucher\x01TDS Category':''}",
-		'module': 'Accounts',
+		'filters': u"{'Journal Voucher\x01Submitted':1,'Journal Voucher\x01Voucher Type':'','Journal Voucher\x01Is Opening':'','Journal Voucher\x01Fiscal Year':'','Journal Voucher\x01Company':'','Journal Voucher\x01TDS Applicable':'','Journal Voucher\x01TDS Category':''}",
+		'module': u'Accounts',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Journal Voucher',
-		'sort_by': 'ID',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Journal Voucher',
+		'sort_by': u'ID',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, bank_clearance_report
 	{
 		'doctype': 'Search Criteria',
-		'name': 'bank_clearance_report'
+		'name': u'bank_clearance_report'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.txt b/erpnext/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.txt
index 26566cc..1518e85 100644
--- a/erpnext/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.txt
+++ b/erpnext/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.txt
@@ -3,34 +3,34 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-11-01 10:56:14',
+		'creation': '2012-04-03 12:49:50',
 		'docstatus': 0,
-		'modified': '2010-10-29 16:36:00',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:50',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_cond': "(`tabJournal Voucher Detail`.credit >= 0 or `tabJournal Voucher Detail`.credit is null)\n(`tabJournal Voucher`.cheque_no is not null or `tabJournal Voucher`.cheque_no != '')\n(ifnull(`tabJournal Voucher`.clearance_date, '0000-00-00') >'%(clearance_date1)s' or `tabJournal Voucher`.clearance_date is null or `tabJournal Voucher`.clearance_date = '0000-00-00')\n(`tabJournal Voucher`.posting_date <= '%(clearance_date1)s')",
-		'columns': 'Journal Voucher\x01ID,Journal Voucher\x01Posting Date,Journal Voucher\x01Cheque No,Journal Voucher\x01Cheque Date,Journal Voucher\x01Clearance Date,Journal Voucher Detail\x01Account,Journal Voucher Detail\x01Debit,Journal Voucher Detail\x01Credit,Journal Voucher Detail\x01Against Account',
-		'criteria_name': 'Bank Reconciliation Statement',
-		'dis_filters': 'clearance_date\nfiscal_year',
-		'doc_type': 'Journal Voucher Detail',
+		'add_cond': u"(`tabJournal Voucher Detail`.credit >= 0 or `tabJournal Voucher Detail`.credit is null)\n(`tabJournal Voucher`.cheque_no is not null or `tabJournal Voucher`.cheque_no != '')\n(ifnull(`tabJournal Voucher`.clearance_date, '0000-00-00') >'%(clearance_date1)s' or `tabJournal Voucher`.clearance_date is null or `tabJournal Voucher`.clearance_date = '0000-00-00')\n(`tabJournal Voucher`.posting_date <= '%(clearance_date1)s')",
+		'columns': u'Journal Voucher\x01ID,Journal Voucher\x01Posting Date,Journal Voucher\x01Cheque No,Journal Voucher\x01Cheque Date,Journal Voucher\x01Clearance Date,Journal Voucher Detail\x01Account,Journal Voucher Detail\x01Debit,Journal Voucher Detail\x01Credit,Journal Voucher Detail\x01Against Account',
+		'criteria_name': u'Bank Reconciliation Statement',
+		'dis_filters': u'clearance_date\nfiscal_year',
+		'doc_type': u'Journal Voucher Detail',
 		'doctype': 'Search Criteria',
-		'filters': "{'Journal Voucher\x01Submitted':1,'Journal Voucher\x01Voucher Type':'','Journal Voucher\x01Is Opening':'','Journal Voucher\x01Company':'','Journal Voucher\x01TDS Applicable':'','Journal Voucher\x01TDS Category':''}",
-		'module': 'Accounts',
+		'filters': u"{'Journal Voucher\x01Submitted':1,'Journal Voucher\x01Voucher Type':'','Journal Voucher\x01Is Opening':'','Journal Voucher\x01Company':'','Journal Voucher\x01TDS Applicable':'','Journal Voucher\x01TDS Category':''}",
+		'module': u'Accounts',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Journal Voucher',
-		'sort_by': '`tabJournal Voucher`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Journal Voucher',
+		'sort_by': u'`tabJournal Voucher`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, bank_reconciliation_statement
 	{
 		'doctype': 'Search Criteria',
-		'name': 'bank_reconciliation_statement'
+		'name': u'bank_reconciliation_statement'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/budget_variance_report/budget_variance_report.txt b/erpnext/accounts/search_criteria/budget_variance_report/budget_variance_report.txt
index 00467ea..f8df9db 100644
--- a/erpnext/accounts/search_criteria/budget_variance_report/budget_variance_report.txt
+++ b/erpnext/accounts/search_criteria/budget_variance_report/budget_variance_report.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-09-01 15:48:09',
+		'creation': '2012-04-03 12:49:50',
 		'docstatus': 0,
-		'modified': '2011-05-23 16:07:41',
-		'modified_by': 'Administrator',
-		'owner': 'harshada@webnotestech.com'
+		'modified': '2012-04-03 12:49:50',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'criteria_name': 'Budget Variance Report',
-		'doc_type': 'Budget Detail',
+		'criteria_name': u'Budget Variance Report',
+		'doc_type': u'Budget Detail',
 		'doctype': 'Search Criteria',
-		'filters': "{'Budget Detail\x01Fiscal Year':''}",
-		'module': 'Accounts',
+		'filters': u"{'Budget Detail\x01Fiscal Year':''}",
+		'module': u'Accounts',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Cost Center',
-		'sort_by': '`tabCost Center`.`lft`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Cost Center',
+		'sort_by': u'`tabCost Center`.`lft`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, budget_variance_report
 	{
 		'doctype': 'Search Criteria',
-		'name': 'budget_variance_report'
+		'name': u'budget_variance_report'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.js b/erpnext/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.js
index eb24630..272327b 100644
--- a/erpnext/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.js
+++ b/erpnext/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.js
@@ -16,8 +16,8 @@
 
 report.customize_filters = function() {
   this.hide_all_filters();
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Sales Partner'].df.filter_hide = 0;
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Sales Partner'].df.in_first_page = 1;
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Sales Partner'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Sales Partner'].df.in_first_page = 1;
 
 }
 
diff --git a/erpnext/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.txt b/erpnext/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.txt
index 34f1f97..aba68a8 100644
--- a/erpnext/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.txt
+++ b/erpnext/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.txt
@@ -3,34 +3,34 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-26 11:52:28',
+		'creation': '2012-04-03 12:49:50',
 		'docstatus': 0,
-		'modified': '2010-08-26 11:49:50',
-		'modified_by': 'Administrator',
-		'owner': 'saumil@webnotestech.com'
+		'modified': '2012-04-03 12:49:50',
+		'modified_by': u'Administrator',
+		'owner': u'saumil@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_col': "SUM(`tabReceivable Voucher`.`total_commission`) AS 'Total Commission'\nSUM(`tabReceivable Voucher`.`net_total`) AS 'Net Total'\n((SUM(`tabReceivable Voucher`.`total_commission`) / SUM(`tabReceivable Voucher`.`net_total`)) * 100) AS 'Average Commission Rate'",
-		'add_cond': '`tabReceivable Voucher`.`net_total` > 0\n`tabReceivable Voucher`.`total_commission` > 0',
-		'columns': 'Receivable Voucher\x01Business Associate',
-		'criteria_name': 'Business Associate Commission Report',
-		'description': 'Track total commission given to your Business Associate',
-		'doc_type': 'Receivable Voucher',
+		'add_col': u"SUM(`tabSales Invoice`.`total_commission`) AS 'Total Commission'\nSUM(`tabSales Invoice`.`net_total`) AS 'Net Total'\n((SUM(`tabSales Invoice`.`total_commission`) / SUM(`tabSales Invoice`.`net_total`)) * 100) AS 'Average Commission Rate'",
+		'add_cond': u'`tabSales Invoice`.`net_total` > 0\n`tabSales Invoice`.`total_commission` > 0',
+		'columns': u'Sales Invoice\x01Business Associate',
+		'criteria_name': u'Business Associate Commission Report',
+		'description': u'Track total commission given to your Business Associate',
+		'doc_type': u'Sales Invoice',
 		'doctype': 'Search Criteria',
-		'filters': "{'Receivable Voucher\x01Submitted':1}",
-		'group_by': '`tabReceivable Voucher`.sales_partner',
-		'module': 'Accounts',
+		'filters': u"{'Sales Invoice\x01Submitted':1}",
+		'group_by': u'`tabSales Invoice`.sales_partner',
+		'module': u'Accounts',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, business_associate_commission_report
 	{
 		'doctype': 'Search Criteria',
-		'name': 'business_associate_commission_report'
+		'name': u'business_associate_commission_report'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.txt b/erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.txt
index dc3d985..a9e748e 100644
--- a/erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.txt
+++ b/erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-11-01 10:56:14',
+		'creation': '2012-04-11 17:36:48',
 		'docstatus': 0,
-		'modified': '2010-10-29 16:39:19',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-18 12:17:52',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Account\x01ID',
-		'criteria_name': 'Cash Flow Statement',
-		'dis_filters': 'fiscal_year\ntransaction_date',
-		'doc_type': 'Account',
+		'columns': u'Account\x01ID',
+		'criteria_name': u'Cash Flow Statement',
+		'dis_filters': u'fiscal_year',
+		'doc_type': u'Account',
 		'doctype': 'Search Criteria',
-		'filters': "{'Account\x01Group or Ledger':'Ledger','Account\x01Is PL Account':'','Account\x01Is Active':'','Account\x01Account Type':'','Account\x01Company':'','Account\x01Fiscal Year':'','Account\x01Show Group Balance':'','Account\x01Level':'2'}",
-		'module': 'Accounts',
+		'filters': u"{'Account\x01Group or Ledger':'Ledger','Account\x01Is PL Account':'','Account\x01Is Active':'','Account\x01Account Type':'','Account\x01Company':'','Account\x01Fiscal Year':'','Account\x01Show Group Balance':'','Account\x01Level':'2'}",
+		'module': u'Accounts',
 		'name': '__common__',
-		'sort_by': '`tabAccount`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabAccount`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, cash_flow_statement
 	{
 		'doctype': 'Search Criteria',
-		'name': 'cash_flow_statement'
+		'name': u'cash_flow_statement'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/cenvat_credit___input_or_capital_goods/__init__.py b/erpnext/accounts/search_criteria/cenvat_credit___input_or_capital_goods/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/search_criteria/cenvat_credit___input_or_capital_goods/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.js b/erpnext/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.js
deleted file mode 100644
index e098cc3..0000000
--- a/erpnext/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.js
+++ /dev/null
@@ -1,36 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-  this.hide_all_filters();
-  this.add_filter({fieldname:'report', label:'Report Type', fieldtype:'Select', options:NEWLINE + 'CENVAT CREDIT ACCOUNT - INPUTS (R.G.23 A - PART II)' + NEWLINE + 'CAPITAL GOODS - INPUTS (R.G. 23 C - PART II)', ignore : 1, parent:'Journal Voucher Detail'})
-  this.add_filter({fieldname:'main_acc_head', label:'Main Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
-  this.add_filter({fieldname:'add_acc_head', label:'Additional Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
-  this.add_filter({fieldname:'cvd_acc_head', label:'CVD Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
-  this.add_filter({fieldname:'edu_cess_acc_head', label:'Edu Cess Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
-  this.add_filter({fieldname:'sh_edu_cess_acc_head', label:'S.H.Edu Cess Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
-    
-
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.filter_hide = 0;
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
-  
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company;
-
-  //this.large_report = 1;
-}
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.py b/erpnext/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.py
deleted file mode 100644
index cfdd45f..0000000
--- a/erpnext/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.py
+++ /dev/null
@@ -1,154 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Add columns
-# -----------
-row_list = [['Date', 'Date', '150px', '']
-           ,['ARI/INVOICE/Other Approved document/Bill of entry No.', 'Date', '150px', '']
-           ,['Date', 'Date', '150px', '']
-           ,['Baisc Excise Duty', 'Currency', '150px', '']
-           ,['Additional Duty', 'Currency', '150px', '']
-           ,['Education Cess', 'Currency', '150px', '']
-           ,['S.H.Education Cess', 'Currency', '150px', '']
-           ,[' Basic Excise Duty', 'Currency', '150px', '']
-           ,[' Education Cess', 'Currency', '150px', '']
-           ,[' S.H.Education Cess', 'Currency', '150px', '']
-           ,['Basic Excise Duty ', 'Currency', '150px', '']
-           ,['Education Cess ', 'Currency', '150px', '']
-           ,['S.H.Education Cess ', 'Currency', '150px', '']
-           ,['Remarks', 'Data', '150px', '']
-]
-
-if not filter_values['report']:
-  msgprint("Please Select Report Type. ")
-  raise Exception
-
-if 'CAPITAL' not in filter_values['report']:
-  row_list.insert(3,['Range/ Divsion/ Custom House from where received', 'Data', '150px', ''])
-  row_list.insert(4,['Folio No. & Entry No. in Part I', 'Data', '150px', ''])
-  row_list.insert(7,['CVD', 'Currency', '150px', ''])
-  row_list.insert(10,['ARI/INVOICE/ Other Approved document/Bill of entry No.', 'Data', '100px', ''])
-  row_list.insert(11,['Date', 'Date', '150px', ''])
-elif 'CAPITAL' in filter_values['report']:
-  row_list.insert(7,[' Basic Excise Duty ', 'Currency', '150px', ''])
-  row_list.insert(8,[' Education Cess ', 'Currency', '150px', ''])
-  row_list.insert(9,[' S.H.Education Cess ', 'Currency', '150px', ''])
-  row_list.insert(10,['ARI/INVOICE/ Other Approved document/Bill of entry No.', 'Data', '100px', ''])
-  row_list.insert(11,['Date', 'Date', '150px', ''])
-
-for r in row_list:
-  colnames.append(r[0])
-  coltypes.append(r[1])
-  colwidths.append(r[2])
-  coloptions.append(r[3])
-  col_idx[r[0]] = len(colnames)-1
-
-
-# get as_on_date for opening
-as_on_date = ''
-if filter_values.get('posting_date'):
-  as_on_date = add_days(filter_values['posting_date'], -1)
-
-ysd, from_date_year = sql("select year_start_date, name from `tabFiscal Year` where %s between year_start_date and date_add(year_start_date,interval 1 year)",as_on_date)[0]
-
-
-# Get Opening Balance
-def get_opening_balance(acc, fy, as_on_date, ysd, get_opening_balance, get_obj):
-  glc = get_obj('GL Control')
-  acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % acc)
-  return glc.get_as_on_balance(acc, fy, as_on_date, acc_det[0][0], acc_det[0][2], acc_det[0][3])[2]
-
-cum_sum_main_acc_head = cum_sum_add_acc_head = cum_sum_cvd_acc_head = cum_sum_edu_cess_acc_head = cum_sum_sh_edu_cess_acc_head = 0
-openg_main_acc_head = openg_add_acc_head = openg_cvd_acc_head = openg_edu_cess_acc_head = openg_sh_edu_cess_acc_head = 0
-
-# Get Opening of Basic Excise Duty
-if not filter_values['main_acc_head']: 
-  msgprint("Please Enter Main Account Head")
-  raise Exception
-cum_sum_main_acc_head = openg_main_acc_head = get_opening_balance(filter_values['main_acc_head'], from_date_year, as_on_date, ysd, get_opening_balance, get_obj)
-
-# Get Opening of add_acc_head
-if filter_values['add_acc_head'] : cum_sum_add_acc_head = openg_add_acc_head = get_opening_balance(filter_values['add_acc_head'], from_date_year, as_on_date, ysd, get_opening_balance, get_obj)
-
-# Get Opening of cvd_acc_head
-if filter_values['cvd_acc_head'] : cum_sum_cvd_acc_head = openg_cvd_acc_head = get_opening_balance(get_opening_balance, filter_values['cvd_acc_head'], from_date_year, as_on_date, ysd, get_opening_balance, get_obj)
-
-# Get Opening of edu_cess_acc_head
-if not filter_values['edu_cess_acc_head'] :
-  msgprint("Please Enter Edu Cess Account Head")
-  raise Exception
-cum_sum_edu_cess_acc_head = openg_edu_cess_acc_head = get_opening_balance(filter_values['edu_cess_acc_head'], from_date_year, as_on_date, ysd, get_opening_balance, get_obj)
-
-# Get Opening of sh_edu_cess_acc_head
-if not filter_values['sh_edu_cess_acc_head'] :
-  msgprint("Please Enter S.H.Edu Cess Account Head")
-  raise Exception
-cum_sum_sh_edu_cess_acc_head = openg_sh_edu_cess_acc_head = get_opening_balance(filter_values['sh_edu_cess_acc_head'], from_date_year, as_on_date, ysd, get_opening_balance, get_obj)
-
-
-for r in res:
-  remarks = r[col_idx['ARI/INVOICE/ Other Approved document/Bill of entry No.']]
-  r[col_idx['ARI/INVOICE/ Other Approved document/Bill of entry No.']] = ''
-  r.append('')
-  if 'CAPITAL' not in filter_values['report']:
-    r.append(0.00)
-    r.append(0.00)
-    r.append(0.00)
-    cum_sum_main_acc_head = flt(cum_sum_main_acc_head) + flt(r[col_idx['Baisc Excise Duty']])
-    cum_sum_add_acc_head = flt(cum_sum_add_acc_head) + flt(r[col_idx['Additional Duty']])
-    cum_sum_cvd_acc_head = flt(cum_sum_cvd_acc_head) + flt(r[col_idx['CVD']])
-    
-    r.append( cum_sum_main_acc_head + cum_sum_add_acc_head + cum_sum_cvd_acc_head)
-    cum_sum_edu_cess_acc_head = flt(cum_sum_edu_cess_acc_head) + flt(r[col_idx['Education Cess']])
-    r.append(cum_sum_edu_cess_acc_head)
-    cum_sum_sh_edu_cess_acc_head = flt(cum_sum_sh_edu_cess_acc_head) + flt(r[col_idx['S.H.Education Cess']])
-    r.append(cum_sum_sh_edu_cess_acc_head)
-  elif 'CAPITAL' in filter_values['report']:
-    # As there is no range and Folio No
-    r[col_idx['Baisc Excise Duty']] = r[col_idx['Education Cess']]
-    r[col_idx['Additional Duty']] = r[col_idx['S.H.Education Cess']]
-    r[col_idx['Education Cess']] = r[col_idx[' Education Cess ']]
-    r[col_idx['S.H.Education Cess']] = r[col_idx[' S.H.Education Cess ']]
-
-    cum_sum_main_acc_head = flt(cum_sum_main_acc_head) + flt(r[col_idx['Baisc Excise Duty']]) 
-    cum_sum_add_acc_head = flt(cum_sum_add_acc_head) + flt(r[col_idx['Additional Duty']]) 
-        
-    r[col_idx[' Basic Excise Duty ']]= flt(cum_sum_main_acc_head) + flt(cum_sum_add_acc_head)
-    cum_sum_edu_cess_acc_head = flt(cum_sum_edu_cess_acc_head) + flt(r[col_idx['Education Cess']])
-    r[col_idx[' Education Cess ']]= flt(cum_sum_edu_cess_acc_head)
-    cum_sum_sh_edu_cess_acc_head = flt(cum_sum_sh_edu_cess_acc_head) + flt(r[col_idx['S.H.Education Cess']])
-    r[col_idx[' S.H.Education Cess ']]= flt(cum_sum_sh_edu_cess_acc_head)
-    
-    r.append(0.00)
-    r.append(0.00)
-    r.append(0.00)
-    
-    r.append( cum_sum_main_acc_head + cum_sum_add_acc_head)
-    r.append(cum_sum_edu_cess_acc_head)
-    r.append(cum_sum_sh_edu_cess_acc_head)
-  r.append(remarks)
-
-
-out = []
-
-if 'CAPITAL' not in cstr(filter_values['report']):
-  out.append(['Opening Balance of Duty in Credit', '', '', '', '', '', '', '', '', '', '', '','','','', flt(openg_main_acc_head) + flt(openg_add_acc_head) + flt(openg_cvd_acc_head), flt(openg_edu_cess_acc_head), flt(openg_sh_edu_cess_acc_head),''])
-elif 'CAPITAL' in filter_values['report']:
-  out.append(['Opening Balance of Duty in Credit', '', '', '', '', '', '', '', '', '', '', '', '', '', '', flt(openg_main_acc_head) + flt(openg_add_acc_head) , flt(openg_edu_cess_acc_head), flt(openg_sh_edu_cess_acc_head)])
-out += res
-#if from_export == 0:
-#  msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please click on 'Export' to open in a spreadsheet")
-#  raise Exception
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.sql b/erpnext/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.sql
deleted file mode 100644
index 6064fe4..0000000
--- a/erpnext/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.sql
+++ /dev/null
@@ -1,31 +0,0 @@
-SELECT t1.posting_date, t1.bill_no, t1.bill_date, t1.range, t1.name, SUM(CASE WHEN t2.account_head like '%(main_acc_head)s%' THEN t2.tax_amount ELSE 0.00 END),  SUM(CASE WHEN t2.account_head like '%(add_acc_head)s%' THEN t2.tax_amount ELSE 0.00 END),  SUM(CASE WHEN t2.account_head like '%(cvd_acc_head)s%' THEN t2.tax_amount ELSE 0.00 END),  SUM(CASE WHEN t2.account_head like '%(edu_cess_acc_head)s' THEN t2.tax_amount ELSE 0.00 END),  SUM(CASE WHEN t2.account_head like '%(sh_edu_cess_acc_head)s' THEN t2.tax_amount ELSE 0.00 END), t1.`remarks`
- FROM `tabPurchase Receipt` t1, `tabPurchase Tax Detail` t2
- WHERE t2.parent = t1.name
- AND t2.parent = 'Purchase Reciept'
- AND (t2.account_head LIKE '%(main_acc_head)s' and '%(main_acc_head)s%%' or '~~~~'
- OR t2.account_head LIKE '%(add_acc_head)s' and '%(add_acc_head)s%%' or '~~~~'
- OR t2.account_head LIKE '%(cvd_acc_head)s' and '%(cvd_acc_head)s%%' or '~~~~'
- OR t2.account_head LIKE '%(edu_cess_acc_head)s' and '%(edu_cess_acc_head)s%%' or '~~~~'
- OR t2.account_head LIKE '%(sh_edu_cess_acc_head)s%' and '%(sh_edu_cess_acc_head)s%%' or '~~~~')
- AND t1.`posting_date` >= '%(posting_date)s'
- AND t1.`posting_date` <= '%(posting_date1)s'
- AND t1.docstatus =1
- GROUP BY t1.`name`
-
-UNION
-
-SELECT t1.posting_date, t1.bill_no, t1.bill_date, '' AS 'Range', t1.name, SUM(CASE WHEN t2.account like '%(main_acc_head)s%' THEN t2.debit ELSE 0.00 END),  SUM(CASE WHEN t2.account like '%(add_acc_head)s%' THEN t2.debit ELSE 0.00 END),  SUM(CASE WHEN t2.account like '%(cvd_acc_head)s%' THEN t2.debit ELSE 0.00 END),  SUM(CASE WHEN t2.account like '%(edu_cess_acc_head)s' THEN t2.debit ELSE 0.00 END),  SUM(CASE WHEN t2.account like '%(sh_edu_cess_acc_head)s' THEN t2.debit ELSE 0.00 END), t1.`remark`
- FROM `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
- WHERE (t2.debit is not NULL OR t2.debit != '')
- AND t2.debit > 0
- AND t2.parent = t1.name
- AND (t2.account LIKE '%(main_acc_head)s' and '%(main_acc_head)s%%' or '~~~~'
- OR t2.account LIKE '%(add_acc_head)s' and '%(add_acc_head)s%%' or '~~~~'
- OR t2.account LIKE '%(cvd_acc_head)s' and '%(cvd_acc_head)s%%' or '~~~~'
- OR t2.account LIKE '%(edu_cess_acc_head)s' and '%(edu_cess_acc_head)s%%' or '~~~~'
- OR t2.account LIKE '%(sh_edu_cess_acc_head)s%' and '%(sh_edu_cess_acc_head)s%%' or '~~~~') AND t1.`posting_date` >= '%(posting_date)s'
- AND t1.`posting_date` <= '%(posting_date1)s'
- AND t1.docstatus =1
- GROUP BY t1.`name`
-
-ORDER BY `posting_date`,`name`
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.txt b/erpnext/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.txt
deleted file mode 100644
index b80e239..0000000
--- a/erpnext/accounts/search_criteria/cenvat_credit___input_or_capital_goods/cenvat_credit___input_or_capital_goods.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, cenvat_credit_-_input_or_capital_goods
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-11-01 10:56:14',
-		'docstatus': 0,
-		'modified': '2010-10-29 16:42:14',
-		'modified_by': 'Administrator',
-		'owner': 'jai@webnotestech.com'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'criteria_name': 'Cenvat Credit - Input or Capital Goods',
-		'dis_filters': 'fiscal_year',
-		'doc_type': 'Journal Voucher Detail',
-		'doctype': 'Search Criteria',
-		'filters': "{'Journal Voucher\x01Submitted':1,'Journal Voucher\x01Voucher Type':'','Journal Voucher\x01Is Opening':'','Journal Voucher\x01Fiscal Year':'','Journal Voucher\x01Company':'','Journal Voucher\x01TDS Applicable':'','Journal Voucher\x01TDS Category':'','Receivable Voucher\x01Aging Based On':'','Payable Voucher\x01Aging Based On':'Transaction Date','Journal Voucher Detail\x01Report Type':'CENVAT CREDIT ACCOUNT - INPUTS (R.G.23 A - PART II)'}",
-		'module': 'Accounts',
-		'name': '__common__',
-		'page_len': 50,
-		'parent_doc_type': 'Journal Voucher',
-		'sort_by': 'ID',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, cenvat_credit_-_input_or_capital_goods
-	{
-		'doctype': 'Search Criteria',
-		'name': 'cenvat_credit_-_input_or_capital_goods'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/collection_report/collection_report.js b/erpnext/accounts/search_criteria/collection_report/collection_report.js
index 411c4aa..dfa58a6 100644
--- a/erpnext/accounts/search_criteria/collection_report/collection_report.js
+++ b/erpnext/accounts/search_criteria/collection_report/collection_report.js
@@ -28,7 +28,7 @@
   this.add_filter({fieldname:'range_3', label:'Range 3', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
   this.add_filter({fieldname:'range_4', label:'Range 4', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
 
-  this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Transaction Date'+NEWLINE+'Aging Date',ignore : 1, parent:'Receivable Voucher', 'report_default': 'Aging Date'});  
+  this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Transaction Date'+NEWLINE+'Aging Date',ignore : 1, parent:'Sales Invoice', 'report_default': 'Aging Date'});  
   this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
   this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
   this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.in_first_page = 1;
diff --git a/erpnext/accounts/search_criteria/collection_report/collection_report.py b/erpnext/accounts/search_criteria/collection_report/collection_report.py
index c0f6e61..f08fe5c 100644
--- a/erpnext/accounts/search_criteria/collection_report/collection_report.py
+++ b/erpnext/accounts/search_criteria/collection_report/collection_report.py
@@ -66,7 +66,7 @@
 
 for r in res:
   if r[col_idx['Against Receivable']]:
-    dt=sql("select date(modified), Aging_date from `tabReceivable Voucher` where name='%s'"%r[col_idx['Against Receivable']])
+    dt=sql("select date(modified), Aging_date from `tabSales Invoice` where name='%s'"%r[col_idx['Against Receivable']])
     r.append('')
     r.append(dt and cstr(dt[0][0]) or '')
     r.append(dt and cstr(dt[0][1]) or '')
diff --git a/erpnext/accounts/search_criteria/collection_report/collection_report.txt b/erpnext/accounts/search_criteria/collection_report/collection_report.txt
index 21c143f..dd78dfc 100644
--- a/erpnext/accounts/search_criteria/collection_report/collection_report.txt
+++ b/erpnext/accounts/search_criteria/collection_report/collection_report.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-10-05 12:51:20',
+		'creation': '2012-04-03 12:49:50',
 		'docstatus': 0,
-		'modified': '2010-10-01 11:29:51',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:50',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Journal Voucher\x01ID,Journal Voucher\x01Posting Date,Journal Voucher\x01Company,Journal Voucher\x01Cheque No,Journal Voucher\x01Cheque Date,Journal Voucher Detail\x01Account,Journal Voucher Detail\x01Credit,Journal Voucher Detail\x01Against Receivable,Journal Voucher Detail\x01Is Advance',
-		'criteria_name': 'Collection Report',
-		'doc_type': 'Journal Voucher Detail',
+		'columns': u'Journal Voucher\x01ID,Journal Voucher\x01Posting Date,Journal Voucher\x01Company,Journal Voucher\x01Cheque No,Journal Voucher\x01Cheque Date,Journal Voucher Detail\x01Account,Journal Voucher Detail\x01Credit,Journal Voucher Detail\x01Against Receivable,Journal Voucher Detail\x01Is Advance',
+		'criteria_name': u'Collection Report',
+		'doc_type': u'Journal Voucher Detail',
 		'doctype': 'Search Criteria',
-		'filters': "{'Journal Voucher\x01Saved':1,'Journal Voucher\x01Submitted':1,'Journal Voucher\x01Voucher Type':'','Journal Voucher\x01Is Opening':'','Journal Voucher\x01Company':'','Journal Voucher\x01TDS Applicable':'','Journal Voucher\x01TDS Category':'','GL Entry\x01Range 1':'30','GL Entry\x01Range 2':'45','GL Entry\x01Range 3':'60','GL Entry\x01Range 4':'90'}",
-		'module': 'Accounts',
+		'filters': u"{'Journal Voucher\x01Saved':1,'Journal Voucher\x01Submitted':1,'Journal Voucher\x01Voucher Type':'','Journal Voucher\x01Is Opening':'','Journal Voucher\x01Company':'','Journal Voucher\x01TDS Applicable':'','Journal Voucher\x01TDS Category':'','GL Entry\x01Range 1':'30','GL Entry\x01Range 2':'45','GL Entry\x01Range 3':'60','GL Entry\x01Range 4':'90'}",
+		'module': u'Accounts',
 		'name': '__common__',
-		'parent_doc_type': 'Journal Voucher',
-		'sort_by': '`tabJournal Voucher`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Journal Voucher',
+		'sort_by': u'`tabJournal Voucher`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, collection_report
 	{
 		'doctype': 'Search Criteria',
-		'name': 'collection_report'
+		'name': u'collection_report'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.txt b/erpnext/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.txt
index 72d173e..2aed507 100644
--- a/erpnext/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.txt
+++ b/erpnext/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:31',
+		'creation': '2012-04-03 12:49:50',
 		'docstatus': 0,
-		'modified': '2010-06-10 13:19:39',
-		'modified_by': 'Administrator',
-		'owner': 'swarnalata@webnotestech.com'
+		'modified': '2012-04-03 12:49:50',
+		'modified_by': u'Administrator',
+		'owner': u'swarnalata@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'criteria_name': 'Cost Center wise Expense',
-		'dis_filters': 'fiscal_year',
-		'doc_type': 'GL Entry',
+		'criteria_name': u'Cost Center wise Expense',
+		'dis_filters': u'fiscal_year',
+		'doc_type': u'GL Entry',
 		'doctype': 'Search Criteria',
-		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Fiscal Year':'','GL Entry\x01Company':''}",
-		'module': 'Accounts',
+		'filters': u"{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Fiscal Year':'','GL Entry\x01Company':''}",
+		'module': u'Accounts',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabGL Entry`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabGL Entry`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, cost_center_wise_expense
 	{
 		'doctype': 'Search Criteria',
-		'name': 'cost_center_wise_expense'
+		'name': u'cost_center_wise_expense'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/creditors_ledger/creditors_ledger.txt b/erpnext/accounts/search_criteria/creditors_ledger/creditors_ledger.txt
index aa7751a..9a7565c 100644
--- a/erpnext/accounts/search_criteria/creditors_ledger/creditors_ledger.txt
+++ b/erpnext/accounts/search_criteria/creditors_ledger/creditors_ledger.txt
@@ -3,29 +3,29 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 10:23:28',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2010-11-22 17:05:46',
-		'modified_by': 'Administrator',
-		'owner': 'nabin@webnotestech.com'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'nabin@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'criteria_name': "Creditor's Ledger",
-		'doc_type': 'GL Entry',
+		'criteria_name': u"Creditor's Ledger",
+		'doc_type': u'GL Entry',
 		'doctype': 'Search Criteria',
-		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
-		'module': 'Accounts',
+		'filters': u"{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
+		'module': u'Accounts',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, creditors_ledger
 	{
 		'doctype': 'Search Criteria',
-		'name': 'creditors_ledger'
+		'name': u'creditors_ledger'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/debtors_ledger/debtors_ledger.txt b/erpnext/accounts/search_criteria/debtors_ledger/debtors_ledger.txt
index 4ba71f0..0991097 100644
--- a/erpnext/accounts/search_criteria/debtors_ledger/debtors_ledger.txt
+++ b/erpnext/accounts/search_criteria/debtors_ledger/debtors_ledger.txt
@@ -3,29 +3,29 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 10:23:28',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2010-11-22 17:02:05',
-		'modified_by': 'Administrator',
-		'owner': 'nabin@webnotestech.com'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'nabin@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'criteria_name': "Debtor's Ledger",
-		'doc_type': 'GL Entry',
+		'criteria_name': u"Debtor's Ledger",
+		'doc_type': u'GL Entry',
 		'doctype': 'Search Criteria',
-		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'No','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
-		'module': 'Accounts',
+		'filters': u"{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'No','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
+		'module': u'Accounts',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, debtors_ledger
 	{
 		'doctype': 'Search Criteria',
-		'name': 'debtors_ledger'
+		'name': u'debtors_ledger'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/general_ledger/general_ledger.txt b/erpnext/accounts/search_criteria/general_ledger/general_ledger.txt
index 6401ff4..5cf15ea 100644
--- a/erpnext/accounts/search_criteria/general_ledger/general_ledger.txt
+++ b/erpnext/accounts/search_criteria/general_ledger/general_ledger.txt
@@ -3,30 +3,30 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 10:23:28',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2010-11-30 16:26:42',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'criteria_name': 'General Ledger',
-		'doc_type': 'GL Entry',
+		'criteria_name': u'General Ledger',
+		'doc_type': u'GL Entry',
 		'doctype': 'Search Criteria',
-		'filters': "{'GL Entry\x01From Posting Date\x01lower':'','GL Entry\x01To Posting Date\x01upper':'','GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'No','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':'','GL Entry\x01Company':''}",
-		'module': 'Accounts',
+		'filters': u"{'GL Entry\x01From Posting Date\x01lower':'','GL Entry\x01To Posting Date\x01upper':'','GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'No','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':'','GL Entry\x01Company':''}",
+		'module': u'Accounts',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabGL Entry`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabGL Entry`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, general_ledger
 	{
 		'doctype': 'Search Criteria',
-		'name': 'general_ledger'
+		'name': u'general_ledger'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/invoices_overdue/__init__.py b/erpnext/accounts/search_criteria/invoices_overdue/__init__.py
similarity index 100%
rename from erpnext/home/search_criteria/invoices_overdue/__init__.py
rename to erpnext/accounts/search_criteria/invoices_overdue/__init__.py
diff --git a/erpnext/accounts/search_criteria/invoices_overdue/invoices_overdue.txt b/erpnext/accounts/search_criteria/invoices_overdue/invoices_overdue.txt
new file mode 100644
index 0000000..a83d490
--- /dev/null
+++ b/erpnext/accounts/search_criteria/invoices_overdue/invoices_overdue.txt
@@ -0,0 +1,34 @@
+# Search Criteria, invoices-overdue
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-04-03 12:49:51',
+		'docstatus': 0,
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all Search Criteria
+	{
+		'add_cond': u'`tabSales Invoice`.due_date<now()\n`tabSales Invoice`.outstanding_amount!=0\n`tabSales Invoice`.docstatus=1',
+		'columns': u'Sales Invoice\x01ID,Sales Invoice\x01Debit To,Sales Invoice\x01Voucher Date,Sales Invoice\x01Due Date,Sales Invoice\x01Outstanding Amount',
+		'criteria_name': u'Invoices-Overdue',
+		'doc_type': u'Sales Invoice',
+		'doctype': 'Search Criteria',
+		'filters': u"{'Sales Invoice\x01Saved':1,'Sales Invoice\x01Submitted':1,'Sales Invoice\x01Is Opening':'','Sales Invoice\x01Fiscal Year':''}",
+		'module': u'Accounts',
+		'name': '__common__',
+		'page_len': 50,
+		'sort_by': u'`tabSales Invoice`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
+	},
+
+	# Search Criteria, invoices-overdue
+	{
+		'doctype': 'Search Criteria',
+		'name': u'invoices-overdue'
+	}
+]
diff --git a/erpnext/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.js b/erpnext/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.js
index ecd5057..0270357 100644
--- a/erpnext/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.js
+++ b/erpnext/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.js
@@ -18,16 +18,16 @@
   this.hide_all_filters();
   filter_list = ['From Voucher Date', 'To Voucher Date', 'Credit To', 'Is Opening', 'From Posting Date', 'To Posting Date']
   for(var i=0;i<filter_list.length;i++)
-    this.filter_fields_dict['Payable Voucher'+FILTER_SEP +filter_list[i]].df.filter_hide = 0;
+    this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +filter_list[i]].df.filter_hide = 0;
 
-  this.filter_fields_dict['PV Detail'+FILTER_SEP +'Item'].df.filter_hide = 0;
+  this.filter_fields_dict['Purchase Invoice Item'+FILTER_SEP +'Item'].df.filter_hide = 0;
 
-  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
-  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
-  this.filter_fields_dict['PV Detail'+FILTER_SEP +'Item'].df.in_first_page = 1;
+  this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Purchase Invoice Item'+FILTER_SEP +'Item'].df.in_first_page = 1;
 
-  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
-  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
-  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company
+  this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company
 
 }
diff --git a/erpnext/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.txt b/erpnext/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.txt
index e6b1983..206985e 100644
--- a/erpnext/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.txt
+++ b/erpnext/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.txt
@@ -3,34 +3,34 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-09-10 16:53:49',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2011-06-20 13:25:29',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Payable Voucher\x01ID,Payable Voucher\x01Credit To,Payable Voucher\x01Company,PV Detail\x01Item,PV Detail\x01Item Name,PV Detail\x01Expense Head,PV Detail\x01Cost Center,PV Detail\x01Qty,PV Detail\x01Rate (Default Curr.),PV Detail\x01Amount (Default Curr.)',
-		'criteria_name': 'Itemwise Purchase Register',
-		'description': 'Itemwise Purchase Register',
-		'dis_filters': 'fiscal_year',
-		'doc_type': 'PV Detail',
+		'columns': u'Purchase Invoice\x01ID,Purchase Invoice\x01Credit To,Purchase Invoice\x01Company,Purchase Invoice Item\x01Item,Purchase Invoice Item\x01Item Name,Purchase Invoice Item\x01Expense Head,Purchase Invoice Item\x01Cost Center,Purchase Invoice Item\x01Qty,Purchase Invoice Item\x01Rate (Default Curr.),Purchase Invoice Item\x01Amount (Default Curr.)',
+		'criteria_name': u'Itemwise Purchase Register',
+		'description': u'Itemwise Purchase Register',
+		'dis_filters': u'fiscal_year',
+		'doc_type': u'Purchase Invoice Item',
 		'doctype': 'Search Criteria',
-		'filters': "{'Payable Voucher\x01Submitted':1,'Payable Voucher\x01Is Opening':'No','Payable Voucher\x01Company':'','Payable Voucher\x01Fiscal Year':''}",
-		'module': 'Accounts',
+		'filters': u"{'Purchase Invoice\x01Submitted':1,'Purchase Invoice\x01Is Opening':'No','Purchase Invoice\x01Company':'','Purchase Invoice\x01Fiscal Year':''}",
+		'module': u'Accounts',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Payable Voucher',
-		'sort_by': '`tabPayable Voucher`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Purchase Invoice',
+		'sort_by': u'`tabPurchase Invoice`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, itemwise_purchase_register
 	{
 		'doctype': 'Search Criteria',
-		'name': 'itemwise_purchase_register'
+		'name': u'itemwise_purchase_register'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.js b/erpnext/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.js
index febc0ee..b6e3dab 100755
--- a/erpnext/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.js
+++ b/erpnext/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.js
@@ -20,16 +20,16 @@
   for(var i=0;i<filter_list.length;i++) 
     this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +filter_list[i]].df.filter_hide = 0;
 
-  this.filter_fields_dict['RV Detail'+FILTER_SEP +'Item'].df.filter_hide = 0;
-  this.filter_fields_dict['RV Detail'+FILTER_SEP +'Item Group'].df.filter_hide = 0;
-  this.filter_fields_dict['RV Detail'+FILTER_SEP +'Brand Name'].df.filter_hide = 0;
-  this.filter_fields_dict['RV Detail'+FILTER_SEP +'Cost Center'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Invoice Item'+FILTER_SEP +'Item'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Invoice Item'+FILTER_SEP +'Item Group'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Invoice Item'+FILTER_SEP +'Brand Name'].df.filter_hide = 0;
+  this.filter_fields_dict['Sales Invoice Item'+FILTER_SEP +'Cost Center'].df.filter_hide = 0;
 
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
-  this.filter_fields_dict['RV Detail'+FILTER_SEP +'Item'].df.in_first_page = 1;
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Sales Invoice Item'+FILTER_SEP +'Item'].df.in_first_page = 1;
 
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company
 }
diff --git a/erpnext/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.txt b/erpnext/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.txt
index 24882e6..5393e00 100644
--- a/erpnext/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.txt
+++ b/erpnext/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.txt
@@ -3,32 +3,32 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-01-19 17:33:33',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2011-06-20 16:30:41',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'RV Detail\x01Item,RV Detail\x01Item Name,RV Detail\x01Item Group,Receivable Voucher\x01ID,Receivable Voucher\x01Voucher Date,Receivable Voucher\x01Posting Date,Receivable Voucher\x01Debit To,RV Detail\x01Cost Center,Receivable Voucher\x01Territory,RV Detail\x01Income Account,RV Detail\x01Qty,RV Detail\x01Basic Rate*,RV Detail\x01Amount*',
-		'criteria_name': 'Itemwise Sales Register',
-		'doc_type': 'RV Detail',
+		'columns': u'Sales Invoice Item\x01Item,Sales Invoice Item\x01Item Name,Sales Invoice Item\x01Item Group,Sales Invoice\x01ID,Sales Invoice\x01Voucher Date,Sales Invoice\x01Posting Date,Sales Invoice\x01Debit To,Sales Invoice Item\x01Cost Center,Sales Invoice\x01Territory,Sales Invoice Item\x01Income Account,Sales Invoice Item\x01Qty,Sales Invoice Item\x01Basic Rate*,Sales Invoice Item\x01Amount*',
+		'criteria_name': u'Itemwise Sales Register',
+		'doc_type': u'Sales Invoice Item',
 		'doctype': 'Search Criteria',
-		'filters': "{'Receivable Voucher\x01Submitted':1,'Receivable Voucher\x01From Posting Date\x01lower':'','Receivable Voucher\x01To Posting Date\x01upper':'','Receivable Voucher\x01Is Opening':'','Receivable Voucher\x01Company':'','Receivable Voucher\x01Fiscal Year':''}",
-		'module': 'Accounts',
+		'filters': u"{'Sales Invoice\x01Submitted':1,'Sales Invoice\x01From Posting Date\x01lower':'','Sales Invoice\x01To Posting Date\x01upper':'','Sales Invoice\x01Is Opening':'','Sales Invoice\x01Company':'','Sales Invoice\x01Fiscal Year':''}",
+		'module': u'Accounts',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Receivable Voucher',
-		'sort_by': '`tabRV Detail`.`income_account`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Sales Invoice',
+		'sort_by': u'`tabSales Invoice Item`.`income_account`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, itemwise_sales_register
 	{
 		'doctype': 'Search Criteria',
-		'name': 'itemwise_sales_register'
+		'name': u'itemwise_sales_register'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/lease_agreement_list/__init__.py b/erpnext/accounts/search_criteria/lease_agreement_list/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/search_criteria/lease_agreement_list/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/search_criteria/lease_agreement_list/lease_agreement_list.js b/erpnext/accounts/search_criteria/lease_agreement_list/lease_agreement_list.js
deleted file mode 100644
index d25139c..0000000
--- a/erpnext/accounts/search_criteria/lease_agreement_list/lease_agreement_list.js
+++ /dev/null
@@ -1,27 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-	this.hide_all_filters();
-
-	this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
-
-	this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=sys_defaults.year_start_date;
-	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
-}
-
-$dh(this.mytabs.tabs['More Filters']);
-$dh(this.mytabs.tabs['Select Columns']);
diff --git a/erpnext/accounts/search_criteria/lease_agreement_list/lease_agreement_list.py b/erpnext/accounts/search_criteria/lease_agreement_list/lease_agreement_list.py
deleted file mode 100644
index 68f0167..0000000
--- a/erpnext/accounts/search_criteria/lease_agreement_list/lease_agreement_list.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-data =[
-		['Agreement No.','Data','100px',''],
-		['Lessee Name','Data','300px',''],
-		['Amount','Currency','120px','']
-	]
-
-for d in data:
-	colnames.append(d[0])
-	coltypes.append(d[1])
-	colwidths.append(d[2])
-	coloptions.append(d[3])
-	col_idx[d[0]] = len(colnames)-1
-
diff --git a/erpnext/accounts/search_criteria/lease_agreement_list/lease_agreement_list.sql b/erpnext/accounts/search_criteria/lease_agreement_list/lease_agreement_list.sql
deleted file mode 100644
index 6097b2f..0000000
--- a/erpnext/accounts/search_criteria/lease_agreement_list/lease_agreement_list.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-select la.name, la.account, la.invoice_amount
-from `tabLease Agreement` la
-where start_date between '%(date)s' and '%(date1)s' order by la.name
diff --git a/erpnext/accounts/search_criteria/lease_agreement_list/lease_agreement_list.txt b/erpnext/accounts/search_criteria/lease_agreement_list/lease_agreement_list.txt
deleted file mode 100644
index 5e84916..0000000
--- a/erpnext/accounts/search_criteria/lease_agreement_list/lease_agreement_list.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Search Criteria, lease_agreement_list
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-07-27 16:17:04',
-		'docstatus': 0,
-		'modified': '2011-07-27 16:17:04',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Aging Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
-		'criteria_name': 'Lease Agreement List',
-		'doc_type': 'GL Entry',
-		'doctype': 'Search Criteria',
-		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
-		'module': 'Accounts',
-		'name': '__common__',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, lease_agreement_list
-	{
-		'doctype': 'Search Criteria',
-		'name': 'lease_agreement_list'
-	}
-]
diff --git a/erpnext/accounts/search_criteria/lease_monthly_future_installment_inflows/__init__.py b/erpnext/accounts/search_criteria/lease_monthly_future_installment_inflows/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/search_criteria/lease_monthly_future_installment_inflows/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.js b/erpnext/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.js
deleted file mode 100644
index 7d8152b..0000000
--- a/erpnext/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.js
+++ /dev/null
@@ -1,30 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-	this.hide_all_filters();
-
-	this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
-
-	this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=dateutil.obj_to_str(new Date());
-//	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
-
-	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df.filter_hide=1;
-
-}
-
-$dh(this.mytabs.tabs['More Filters']);
-$dh(this.mytabs.tabs['Select Columns']);
diff --git a/erpnext/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.py b/erpnext/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.py
deleted file mode 100644
index 692f6f8..0000000
--- a/erpnext/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-data =[
-		['Month','Data','100px',''],
-		['Year','Data','100px',''],
-		['Amount','Currency','120px','']
-	]
-
-for d in data:
-	colnames.append(d[0])
-	coltypes.append(d[1])
-	colwidths.append(d[2])
-	coloptions.append(d[3])
-	col_idx[d[0]] = len(colnames)-1
-
diff --git a/erpnext/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.sql b/erpnext/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.sql
deleted file mode 100644
index 564a3fd..0000000
--- a/erpnext/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-select date_format(due_date,'%M') as mnt,year(due_date),sum(amount)
-
-from `tabLease Agreement` la,`tabLease Installment` lai
-
-where la.name=lai.parent and (lai.cheque_date is null or lai.cheque_date > '%(date)s')
-
-group by date_format(due_date,'%M-%Y')
-
-order by year(due_date),month(due_date)
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.txt b/erpnext/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.txt
deleted file mode 100644
index 05a0f70..0000000
--- a/erpnext/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Search Criteria, lease_monthly_future_installment_inflows
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-08-29 13:45:35',
-		'docstatus': 0,
-		'modified': '2011-08-29 13:45:35',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Aging Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
-		'criteria_name': 'Lease Monthly Future Installment Inflows',
-		'doc_type': 'GL Entry',
-		'doctype': 'Search Criteria',
-		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
-		'module': 'Accounts',
-		'name': '__common__',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, lease_monthly_future_installment_inflows
-	{
-		'doctype': 'Search Criteria',
-		'name': 'lease_monthly_future_installment_inflows'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/lease_over_due_list/__init__.py b/erpnext/accounts/search_criteria/lease_over_due_list/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/search_criteria/lease_over_due_list/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/search_criteria/lease_over_due_list/lease_over_due_list.js b/erpnext/accounts/search_criteria/lease_over_due_list/lease_over_due_list.js
deleted file mode 100644
index 7d8152b..0000000
--- a/erpnext/accounts/search_criteria/lease_over_due_list/lease_over_due_list.js
+++ /dev/null
@@ -1,30 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-	this.hide_all_filters();
-
-	this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
-
-	this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=dateutil.obj_to_str(new Date());
-//	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
-
-	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df.filter_hide=1;
-
-}
-
-$dh(this.mytabs.tabs['More Filters']);
-$dh(this.mytabs.tabs['Select Columns']);
diff --git a/erpnext/accounts/search_criteria/lease_over_due_list/lease_over_due_list.py b/erpnext/accounts/search_criteria/lease_over_due_list/lease_over_due_list.py
deleted file mode 100644
index debb3ca..0000000
--- a/erpnext/accounts/search_criteria/lease_over_due_list/lease_over_due_list.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-data =[
-		['Agreement No.','Data','100px',''],
-		['Lessee Name','Data','300px',''],
-		['Amount','Currency','120px',''],
-		['Age','Data','100px','']
-	]
-
-for d in data:
-	colnames.append(d[0])
-	coltypes.append(d[1])
-	colwidths.append(d[2])
-	coloptions.append(d[3])
-	col_idx[d[0]] = len(colnames)-1
-
diff --git a/erpnext/accounts/search_criteria/lease_over_due_list/lease_over_due_list.sql b/erpnext/accounts/search_criteria/lease_over_due_list/lease_over_due_list.sql
deleted file mode 100644
index 1789f7e..0000000
--- a/erpnext/accounts/search_criteria/lease_over_due_list/lease_over_due_list.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-select la.name,la.account,lai.amount,cast('%(date)s' as date)-due_date as age
-
-from `tabLease Agreement` la,`tabLease Installment` lai
-
-where la.name=lai.parent and lai.due_date<cast('%(date)s' as date) and (lai.cheque_date is null or lai.cheque_date > cast('%(date)s' as date))
-
-order by cast('%(date)s' as date)-due_date desc
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/lease_over_due_list/lease_over_due_list.txt b/erpnext/accounts/search_criteria/lease_over_due_list/lease_over_due_list.txt
deleted file mode 100644
index d145442..0000000
--- a/erpnext/accounts/search_criteria/lease_over_due_list/lease_over_due_list.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Search Criteria, lease_over_due_list
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-08-29 13:45:35',
-		'docstatus': 0,
-		'modified': '2011-08-29 13:45:35',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Aging Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
-		'criteria_name': 'Lease Over Due List',
-		'doc_type': 'GL Entry',
-		'doctype': 'Search Criteria',
-		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
-		'module': 'Accounts',
-		'name': '__common__',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, lease_over_due_list
-	{
-		'doctype': 'Search Criteria',
-		'name': 'lease_over_due_list'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/lease_overdue_age_wise/__init__.py b/erpnext/accounts/search_criteria/lease_overdue_age_wise/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/search_criteria/lease_overdue_age_wise/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.js b/erpnext/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.js
deleted file mode 100644
index 7d8152b..0000000
--- a/erpnext/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.js
+++ /dev/null
@@ -1,30 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-	this.hide_all_filters();
-
-	this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
-
-	this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=dateutil.obj_to_str(new Date());
-//	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
-
-	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df.filter_hide=1;
-
-}
-
-$dh(this.mytabs.tabs['More Filters']);
-$dh(this.mytabs.tabs['Select Columns']);
diff --git a/erpnext/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.py b/erpnext/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.py
deleted file mode 100644
index 0723760..0000000
--- a/erpnext/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-data =[
-		['Lessee Name','Data','300px',''],
-		['Below 30 Days','Currency','120px',''],
-		['Below 90 Days','Currency','120px',''],
-		['Below 180 Days','Currency','120px',''],
-		['Below 360 Days','Currency','120px',''],
-		['Above 360 Days','Currency','120px',''],
-	]
-
-for d in data:
-	colnames.append(d[0])
-	coltypes.append(d[1])
-	colwidths.append(d[2])
-	coloptions.append(d[3])
-	col_idx[d[0]] = len(colnames)-1
-
diff --git a/erpnext/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.sql b/erpnext/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.sql
deleted file mode 100644
index 2e6912e..0000000
--- a/erpnext/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-select account,sum(od_30)as od_30,sum(od_90)as od_90,sum(od_180)as od_180,sum(od_360)as od_360,sum(od_1yr)as od_1yr from
-(
-	select account,case when age<=30 then amount end as od_30,case when age between 31 and 90 then amount end as od_90,case when age between 91 and 180 then amount end as od_180,case when age between 181 and 360 then amount end as od_360,case when age>360 then amount end as od_1yr from
-	(
-		select la.account,lai.amount,cast('%(date)s' as date)-due_date as age
-		from `tabLease Agreement` la,`tabLease Installment` lai
-		where la.name=lai.parent and lai.due_date<'%(date)s' and (lai.cheque_date is null or lai.cheque_date > '%(date)s')
-	)a
-)b group by account order by account
diff --git a/erpnext/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.txt b/erpnext/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.txt
deleted file mode 100644
index 1c734a8..0000000
--- a/erpnext/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Search Criteria, lease_overdue_age_wise
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-08-29 13:45:35',
-		'docstatus': 0,
-		'modified': '2011-08-29 13:45:35',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Aging Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
-		'criteria_name': 'Lease Overdue Age Wise',
-		'doc_type': 'GL Entry',
-		'doctype': 'Search Criteria',
-		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
-		'module': 'Accounts',
-		'name': '__common__',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, lease_overdue_age_wise
-	{
-		'doctype': 'Search Criteria',
-		'name': 'lease_overdue_age_wise'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/lease_receipt_summary_month_wise/__init__.py b/erpnext/accounts/search_criteria/lease_receipt_summary_month_wise/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/search_criteria/lease_receipt_summary_month_wise/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.js b/erpnext/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.js
deleted file mode 100644
index d25139c..0000000
--- a/erpnext/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.js
+++ /dev/null
@@ -1,27 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-	this.hide_all_filters();
-
-	this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
-
-	this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=sys_defaults.year_start_date;
-	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
-}
-
-$dh(this.mytabs.tabs['More Filters']);
-$dh(this.mytabs.tabs['Select Columns']);
diff --git a/erpnext/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.py b/erpnext/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.py
deleted file mode 100644
index 692f6f8..0000000
--- a/erpnext/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-data =[
-		['Month','Data','100px',''],
-		['Year','Data','100px',''],
-		['Amount','Currency','120px','']
-	]
-
-for d in data:
-	colnames.append(d[0])
-	coltypes.append(d[1])
-	colwidths.append(d[2])
-	coloptions.append(d[3])
-	col_idx[d[0]] = len(colnames)-1
-
diff --git a/erpnext/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.sql b/erpnext/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.sql
deleted file mode 100644
index cdd48b8..0000000
--- a/erpnext/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-SELECT date_format(gl.posting_date,'%M'),year(gl.posting_date),sum(gl.credit) as amount
-FROM `tabGL Entry` gl, `tabAccount` a
-WHERE gl.account=a.name and a.master_type='Customer' and gl.credit>0 and gl.posting_date between '%(date)s' and '%(date1)s'
-GROUP BY month(gl.posting_date),year(gl.posting_date)
-ORDER BY year(gl.posting_date),month(gl.posting_date)
diff --git a/erpnext/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.txt b/erpnext/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.txt
deleted file mode 100644
index e6da15c..0000000
--- a/erpnext/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Search Criteria, lease_receipt_summary_month_wise
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-07-27 16:17:04',
-		'docstatus': 0,
-		'modified': '2011-07-27 16:17:04',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Aging Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
-		'criteria_name': 'Lease Receipt Summary Month Wise',
-		'doc_type': 'GL Entry',
-		'doctype': 'Search Criteria',
-		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
-		'module': 'Accounts',
-		'name': '__common__',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, lease_receipt_summary_month_wise
-	{
-		'doctype': 'Search Criteria',
-		'name': 'lease_receipt_summary_month_wise'
-	}
-]
diff --git a/erpnext/accounts/search_criteria/lease_receipts_client_wise/__init__.py b/erpnext/accounts/search_criteria/lease_receipts_client_wise/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/search_criteria/lease_receipts_client_wise/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.js b/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.js
deleted file mode 100644
index d25139c..0000000
--- a/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.js
+++ /dev/null
@@ -1,27 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-	this.hide_all_filters();
-
-	this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
-
-	this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=sys_defaults.year_start_date;
-	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
-}
-
-$dh(this.mytabs.tabs['More Filters']);
-$dh(this.mytabs.tabs['Select Columns']);
diff --git a/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.py b/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.py
deleted file mode 100644
index 2d13808..0000000
--- a/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-data =[
-		['Lessee Name','Data','300px',''],
-		['Amount','Currency','120px','']
-	]
-
-for d in data:
-	colnames.append(d[0])
-	coltypes.append(d[1])
-	colwidths.append(d[2])
-	coloptions.append(d[3])
-	col_idx[d[0]] = len(colnames)-1
-
diff --git a/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.sql b/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.sql
deleted file mode 100644
index af49c81..0000000
--- a/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-SELECT gl.account,sum(gl.credit) as amount
-FROM `tabGL Entry` gl, `tabAccount` a
-WHERE gl.account=a.name and a.master_type='Customer' and gl.posting_date between '%(date)s' and '%(date1)s' and ifnull(gl.is_cancelled, 'No') = 'No'
-GROUP BY gl.account
-ORDER BY posting_date
diff --git a/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.txt b/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.txt
deleted file mode 100644
index 71c9b0e..0000000
--- a/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-# Search Criteria, lease_receipts_client_wise
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-08-29 13:45:36',
-		'docstatus': 0,
-		'modified': '2011-08-29 13:45:36',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Aging Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
-		'criteria_name': 'Lease Receipts Client Wise',
-		'doc_type': 'GL Entry',
-		'doctype': 'Search Criteria',
-		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
-		'module': 'Accounts',
-		'name': '__common__',
-		'page_len': 50,
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, lease_receipts_client_wise
-	{
-		'doctype': 'Search Criteria',
-		'name': 'lease_receipts_client_wise'
-	}
-]
diff --git a/erpnext/accounts/search_criteria/lease_yearly_future_installment_inflows/__init__.py b/erpnext/accounts/search_criteria/lease_yearly_future_installment_inflows/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/search_criteria/lease_yearly_future_installment_inflows/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.js b/erpnext/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.js
deleted file mode 100644
index 7d8152b..0000000
--- a/erpnext/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.js
+++ /dev/null
@@ -1,30 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-	this.hide_all_filters();
-
-	this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'GL Entry', 'in_first_page':1});
-
-	this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Date'].df['report_default']=dateutil.obj_to_str(new Date());
-//	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
-
-	this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Date'].df.filter_hide=1;
-
-}
-
-$dh(this.mytabs.tabs['More Filters']);
-$dh(this.mytabs.tabs['Select Columns']);
diff --git a/erpnext/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.py b/erpnext/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.py
deleted file mode 100644
index 8c1842a..0000000
--- a/erpnext/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-data =[
-		['Year','Data','100px',''],
-		['Amount','Currency','120px','']
-	]
-
-for d in data:
-	colnames.append(d[0])
-	coltypes.append(d[1])
-	colwidths.append(d[2])
-	coloptions.append(d[3])
-	col_idx[d[0]] = len(colnames)-1
-
diff --git a/erpnext/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.sql b/erpnext/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.sql
deleted file mode 100644
index ec6c816..0000000
--- a/erpnext/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-select year(date_sub(due_date,interval 6 MONTH)) as yr,sum(amount)
-
-from `tabLease Agreement` la,`tabLease Installment` lai
-
-where la.name=lai.parent and (lai.cheque_date is null or lai.cheque_date > '%(date)s')
-
-group by year(date_sub(due_date,interval 6 MONTH))
-
-order by yr
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.txt b/erpnext/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.txt
deleted file mode 100644
index 0969796..0000000
--- a/erpnext/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Search Criteria, lease_yearly_future_installment_inflows
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-08-29 13:45:36',
-		'docstatus': 0,
-		'modified': '2011-08-29 13:45:36',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Aging Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
-		'criteria_name': 'Lease Yearly Future Installment Inflows',
-		'doc_type': 'GL Entry',
-		'doctype': 'Search Criteria',
-		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
-		'module': 'Accounts',
-		'name': '__common__',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, lease_yearly_future_installment_inflows
-	{
-		'doctype': 'Search Criteria',
-		'name': 'lease_yearly_future_installment_inflows'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/monthly_ledger_summary_report/__init__.py b/erpnext/accounts/search_criteria/monthly_ledger_summary_report/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/search_criteria/monthly_ledger_summary_report/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/search_criteria/monthly_ledger_summary_report/monthly_ledger_summary_report.js b/erpnext/accounts/search_criteria/monthly_ledger_summary_report/monthly_ledger_summary_report.js
deleted file mode 100644
index 2fc1c9c..0000000
--- a/erpnext/accounts/search_criteria/monthly_ledger_summary_report/monthly_ledger_summary_report.js
+++ /dev/null
@@ -1,27 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-  flds = ['ID','Owner','Cost Center','From Posting Date', 'To Posting Date', 'Against Voucher','Voucher Type','Voucher No','Is Cancelled','Is Opening','Remarks', 'From Aging Date', 'To Aging Date', 'Company']
-  for(i=0;i<flds.length;i++){
-    this.filter_fields_dict['GL Entry'+FILTER_SEP +flds[i]].df.filter_hide = 1;
-  }
-  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Fiscal Year'].df['report_default']=sys_defaults.fiscal_year;
-  this.filter_fields_dict['GL Entry'+FILTER_SEP +'Fiscal Year'].df.in_first_page = 1;
-}
-
-this.mytabs.items['Select Columns'].hide();
-this.mytabs.items['More Filters'].hide();
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/monthly_ledger_summary_report/monthly_ledger_summary_report.py b/erpnext/accounts/search_criteria/monthly_ledger_summary_report/monthly_ledger_summary_report.py
deleted file mode 100644
index d723f70..0000000
--- a/erpnext/accounts/search_criteria/monthly_ledger_summary_report/monthly_ledger_summary_report.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-if not filter_values['account']:
-  msgprint("Please Enter filter value for Account")
-  raise Exception
-
-colwidths[col_idx['Fiscal Month']] = '120px'
-colwidths[col_idx['Debit']] = '120px'
-colwidths[col_idx['Credit']] = '120px'
-
-
-month_lst={'1':'Jan','2':'Feb','3':'Mar','4':'Apr','5':'May','6':'Jun','7':'Jul','8':'Aug','9':'Sept','10':'Oct','11':'Nov','12':'Dec'}
-for r in res:
-  mnt = '%s'%r[col_idx['Fiscal Month']]
-  r[col_idx['Fiscal Month']]=month_lst[mnt]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/monthly_ledger_summary_report/monthly_ledger_summary_report.txt b/erpnext/accounts/search_criteria/monthly_ledger_summary_report/monthly_ledger_summary_report.txt
deleted file mode 100644
index fa527bb..0000000
--- a/erpnext/accounts/search_criteria/monthly_ledger_summary_report/monthly_ledger_summary_report.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-# Search Criteria, monthly_ledger_summary_report
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:31',
-		'docstatus': 0,
-		'modified': '2010-06-09 16:30:43',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_col': "month(`tabGL Entry`.posting_date) AS 'Fiscal Month'\nsum(`tabGL Entry`.debit) AS 'Debit'\nsum(`tabGL Entry`.credit) AS 'Credit'",
-		'add_cond': '(`tabGL Entry`.debit > 0 or `tabGL Entry`.credit > 0)',
-		'criteria_name': 'Monthly Ledger Summary Report',
-		'dis_filters': 'company',
-		'doc_type': 'GL Entry',
-		'doctype': 'Search Criteria',
-		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':''}",
-		'group_by': 'month(`tabGL Entry`.posting_date)',
-		'module': 'Accounts',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`Fiscal Month`',
-		'sort_order': 'ASC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, monthly_ledger_summary_report
-	{
-		'doctype': 'Search Criteria',
-		'name': 'monthly_ledger_summary_report'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/analysis/search_criteria/monthly_transaction_summary/__init__.py b/erpnext/accounts/search_criteria/monthly_transaction_summary/__init__.py
similarity index 100%
rename from erpnext/analysis/search_criteria/monthly_transaction_summary/__init__.py
rename to erpnext/accounts/search_criteria/monthly_transaction_summary/__init__.py
diff --git a/erpnext/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.js b/erpnext/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.js
similarity index 100%
rename from erpnext/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.js
rename to erpnext/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.js
diff --git a/erpnext/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.py b/erpnext/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.py
similarity index 100%
rename from erpnext/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.py
rename to erpnext/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.py
diff --git a/erpnext/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.sql b/erpnext/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.sql
similarity index 100%
rename from erpnext/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.sql
rename to erpnext/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.sql
diff --git a/erpnext/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.txt b/erpnext/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.txt
new file mode 100644
index 0000000..9290041
--- /dev/null
+++ b/erpnext/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.txt
@@ -0,0 +1,32 @@
+# Search Criteria, monthly_transaction_summary
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-04-03 12:49:51',
+		'docstatus': 0,
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all Search Criteria
+	{
+		'columns': u'Profile\x01ID',
+		'criteria_name': u'Monthly Transaction Summary',
+		'doc_type': u'Profile',
+		'doctype': 'Search Criteria',
+		'filters': u"{'DocType\x01Period':'Monthly'}",
+		'module': u'Accounts',
+		'name': '__common__',
+		'sort_by': u'`tabProfile`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
+	},
+
+	# Search Criteria, monthly_transaction_summary
+	{
+		'doctype': 'Search Criteria',
+		'name': u'monthly_transaction_summary'
+	}
+]
diff --git a/erpnext/accounts/search_criteria/payment_receipt_report/payment_receipt_report.txt b/erpnext/accounts/search_criteria/payment_receipt_report/payment_receipt_report.txt
index 4a10aae..d1ef6d1 100644
--- a/erpnext/accounts/search_criteria/payment_receipt_report/payment_receipt_report.txt
+++ b/erpnext/accounts/search_criteria/payment_receipt_report/payment_receipt_report.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:31',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2010-06-11 17:00:54',
-		'modified_by': 'Administrator',
-		'owner': 'jai@webnotestech.com'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'jai@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
-		'criteria_name': 'Payment Receipt Report',
-		'doc_type': 'GL Entry',
+		'columns': u'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
+		'criteria_name': u'Payment Receipt Report',
+		'doc_type': u'GL Entry',
 		'doctype': 'Search Criteria',
-		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
-		'module': 'Accounts',
+		'filters': u"{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
+		'module': u'Accounts',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabGL Entry`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabGL Entry`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, payment_receipt_report
 	{
 		'doctype': 'Search Criteria',
-		'name': 'payment_receipt_report'
+		'name': u'payment_receipt_report'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/payment_report/__init__.py b/erpnext/accounts/search_criteria/payment_report/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/search_criteria/payment_report/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/search_criteria/payment_report/payment_report.js b/erpnext/accounts/search_criteria/payment_report/payment_report.js
deleted file mode 100644
index 6571b69..0000000
--- a/erpnext/accounts/search_criteria/payment_report/payment_report.js
+++ /dev/null
@@ -1,42 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-  this.hide_all_filters();
-
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Voucher Type'].df.filter_hide = 0;
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Is Opening'].df.filter_hide = 0;
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.filter_hide = 0;
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
-  this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.filter_hide = 0;
-
-  this.add_filter({fieldname:'range_1', label:'Range 1', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
-  this.add_filter({fieldname:'range_2', label:'Range 2', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
-  this.add_filter({fieldname:'range_3', label:'Range 3', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
-  this.add_filter({fieldname:'range_4', label:'Range 4', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
-
-  this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Transaction Date'+NEWLINE+'Aging Date',ignore : 1, parent:'Payable Voucher', 'report_default':'Aging Date'});  
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
-  this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.in_first_page = 1;
-
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company;
-
-}
-this.mytabs.items['Select Columns'].hide()
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/payment_report/payment_report.py b/erpnext/accounts/search_criteria/payment_report/payment_report.py
deleted file mode 100644
index cc025ba..0000000
--- a/erpnext/accounts/search_criteria/payment_report/payment_report.py
+++ /dev/null
@@ -1,105 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-#check mendatory
-if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
-  msgprint("Please select From Posting Date and To Posting Date in 'Set Filters' section")
-  raise Exception
-else:
-  from_date = filter_values.get('posting_date')
-  to_date = filter_values.get('posting_date1')
-
-if not filter_values['range_1'] or not filter_values['range_2'] or not filter_values['range_3'] or not filter_values['range_4']:
-  msgprint("Please select aging ranges in no of days in 'Set Filters' section")
-  raise Exception
-  
-# ageing based on
-aging_based_on = 'Aging Date'
-if filter_values.has_key('aging_based_on') and filter_values['aging_based_on']:
-  aging_based_on = filter_values['aging_based_on'].split(NEWLINE)[-1]
-
-
-# Add columns
-# -----------
-row_list = [['ID','Data','150px',''],
-            ['Account','Data','150px',''],
-            ['Credit','Data','150px',''],
-            ['Debit','Data','150px',''],
-            ['Against Payable','Data','150px',''],
-            ['Is Advance','Data','150px',''],
-            ['Transaction Date','Date','150px',''],
-            ['Aging Date','Date','150px',''],
-            ['Cheque No','Data','100px',''],
-            ['Cheque Date','Date','150px',''],        
-            ['Supplier Type','Data','150px',''],
-            ['Remark','Data','250px',''],
-            ['Advance','Data','250px',''],
-            ['PV Transaction Date','Date','150px',''],
-            ['PV Aging Date','Date','150px',''],
-            ['Age (Days)','Data','100px',''],
-            ['0-'+cstr(filter_values['range_1']),'Currency','100px',''],
-            [cstr(cint(filter_values['range_1']) + 1)+ '-' +cstr(filter_values['range_2']),'Currency','100px',''],
-            [cstr(cint(filter_values['range_2']) + 1)+ '-' +cstr(filter_values['range_3']),'Currency','100px',''],
-            [cstr(cint(filter_values['range_3']) + 1)+ '-' +cstr(filter_values['range_4']),'Currency','100px',''],
-            [cstr(filter_values['range_4']) + '-Above','Currency','100px','']]  
-
-for r in row_list:
-  colnames.append(r[0])
-  coltypes.append(r[1])
-  colwidths.append(r[2])
-  coloptions.append(r[3])
-  col_idx[r[0]] = len(colnames)-1
-  
-
-for r in res:
-  if r[col_idx['Against Payable']]:
-    dt=sql("select date(modified), aging_date from `tabPayable Voucher` where name='%s'"%r[col_idx['Against Payable']])
-    r.append('')
-    r.append(dt and cstr(dt[0][0]) or '')
-    r.append(dt and cstr(dt[0][1]) or '')
-  else:
-    r.append(r[col_idx['Debit']])
-    r.append('')
-    r.append('')
-
-  # Aging Credit Amount
-  val_l1 = val_l2 = val_l3 = val_l4 = val_l5_above = diff = 0
-
-  if r[col_idx['Against Payable']]:
-    amt = flt(r[col_idx['Debit']]) or (-1)*flt(r[col_idx['Credit']])
-
-    if aging_based_on == 'Transaction Date' and r[col_idx['PV Transaction Date']]:
-      diff = (getdate(r[col_idx['Transaction Date']]) - getdate(r[col_idx['PV Transaction Date']])).days
-    elif aging_based_on == 'Aging Date' and r[col_idx['PV Aging Date']]:
-      diff = (getdate(r[col_idx['Aging Date']]) - getdate(r[col_idx['PV Aging Date']])).days
-    
-    if diff < cint(filter_values['range_1']):
-      val_l1 = amt
-    if diff >= cint(filter_values['range_1']) and diff < cint(filter_values['range_2']):
-      val_l2 = amt
-    if diff >= cint(filter_values['range_2']) and diff < cint(filter_values['range_3']):
-      val_l3 = amt
-    if diff >= cint(filter_values['range_3']) and diff < cint(filter_values['range_4']):
-      val_l4 = amt
-    if diff >= cint(filter_values['range_4']):
-      val_l5_above = amt
-
-  r.append(diff)
-  r.append(val_l1)
-  r.append(val_l2)
-  r.append(val_l3)
-  r.append(val_l4)
-  r.append(val_l5_above)
diff --git a/erpnext/accounts/search_criteria/payment_report/payment_report.sql b/erpnext/accounts/search_criteria/payment_report/payment_report.sql
deleted file mode 100644
index dec4f4e..0000000
--- a/erpnext/accounts/search_criteria/payment_report/payment_report.sql
+++ /dev/null
@@ -1,12 +0,0 @@
-SELECT `tabJournal Voucher`.`name`,`tabJournal Voucher Detail`.`account`,`tabJournal Voucher Detail`.`credit`,`tabJournal Voucher Detail`.`debit`,`tabJournal Voucher Detail`.`against_voucher`,`tabJournal Voucher Detail`.`is_advance`,`tabJournal Voucher`.`voucher_date`,`tabJournal Voucher`.`aging_date`,`tabJournal Voucher`.`cheque_no`,`tabJournal Voucher`.`cheque_date`,`tabSupplier`.`supplier_type`,`tabJournal Voucher`.`remark`
- FROM `tabJournal Voucher Detail`,`tabJournal Voucher`,`tabAccount`,`tabSupplier`
- WHERE `tabJournal Voucher`.docstatus=1
- AND `tabJournal Voucher`.`posting_date`>='%(posting_date)s'
- AND `tabJournal Voucher`.`posting_date`<='%(posting_date1)s'
- AND `tabJournal Voucher`.`company` LIKE '%(company)s%%'
- AND `tabJournal Voucher Detail`.`account` LIKE '%(account)s%%'
- AND `tabAccount`.`master_type` = 'Supplier'
- AND `tabAccount`.`account_name` = `tabSupplier`.`name`
- AND `tabJournal Voucher Detail`.`account` = `tabAccount`.`name`
- AND `tabJournal Voucher Detail`.`parent` = `tabJournal Voucher`.`name`
- ORDER BY `tabJournal Voucher`.`name`
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/payment_report/payment_report.txt b/erpnext/accounts/search_criteria/payment_report/payment_report.txt
deleted file mode 100644
index 1059e8b..0000000
--- a/erpnext/accounts/search_criteria/payment_report/payment_report.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# Search Criteria, payment_report
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:31',
-		'docstatus': 0,
-		'modified': '2010-06-10 09:48:52',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'Journal Voucher\x01ID,Journal Voucher\x01Posting Date,Journal Voucher\x01Company,Journal Voucher\x01Cheque No,Journal Voucher\x01Cheque Date,Journal Voucher Detail\x01Account,Journal Voucher Detail\x01Debit,Journal Voucher Detail\x01Against Payable,Journal Voucher Detail\x01Is Advance',
-		'criteria_name': 'Payment Report',
-		'doc_type': 'Journal Voucher Detail',
-		'doctype': 'Search Criteria',
-		'filters': "{'Journal Voucher\x01Submitted':1,'Journal Voucher\x01Voucher Type':'','Journal Voucher\x01Is Opening':'','Journal Voucher\x01Company':'','Journal Voucher\x01TDS Applicable':'','Journal Voucher\x01TDS Category':'','GL Entry\x01Range 1':'30','GL Entry\x01Range 2':'45','GL Entry\x01Range 3':'60','GL Entry\x01Range 4':'90','Receivable Voucher\x01Aging Based On':'','Payable Voucher\x01Aging Based On':''}",
-		'module': 'Accounts',
-		'name': '__common__',
-		'parent_doc_type': 'Journal Voucher',
-		'sort_by': '`tabJournal Voucher`.`aging_date`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, payment_report
-	{
-		'doctype': 'Search Criteria',
-		'name': 'payment_report'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/progressive_total_excise_duty/__init__.py b/erpnext/accounts/search_criteria/progressive_total_excise_duty/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/search_criteria/progressive_total_excise_duty/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.js b/erpnext/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.js
deleted file mode 100644
index f96e933..0000000
--- a/erpnext/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.js
+++ /dev/null
@@ -1,44 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-  this.hide_all_filters();
-  
-  this.add_filter({fieldname:'main_acc_head', label:'Main Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
-  this.add_filter({fieldname:'edu_cess_acc_head', label:'Edu Cess Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
-  this.add_filter({fieldname:'sh_edu_cess_acc_head', label:'S.H.Edu Cess Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
-  
-  // un-hide fields 
-  //this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', ignore : 1, parent:'Journal Voucher Detail'});
-  //this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', ignore : 1, parent:'Journal Voucher Detail'});
-  //this.add_filter({fieldname:'posting_date', label:'Posting Date', fieldtype:'Date', ignore : 1, parent:'Journal Voucher Detail'});
-  
-  
-
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.filter_hide = 0;
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
-  
-  // set defaults
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
-
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
-
-  //this.large_report = 1;
-}
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.py b/erpnext/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.py
deleted file mode 100644
index 3cac167..0000000
--- a/erpnext/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.py
+++ /dev/null
@@ -1,86 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Add columns
-# -----------
-row_list = [['Date', 'Date', '150px', '']
-           ,['INVOICE', 'Date', '150px', '']
-           ,['Baisc Excise Duty', 'Currency', '150px', '']
-           ,['Education Cess', 'Currency', '150px', '']
-           ,['S.H.Education Cess', 'Currency', '150px', '']
-           ,['Remarks', 'Data', '150px', '']
-]
-
-for r in row_list:
-  colnames.append(r[0])
-  coltypes.append(r[1])
-  colwidths.append(r[2])
-  coloptions.append(r[3])
-  col_idx[r[0]] = len(colnames)-1
-
-# Get Object Of GL Control
-#import webnotes
-#import webnotes.model.code
-#from webnotes.model.code import get_obj
-#glc = webnotes.model.code.get_obj('GL Control')
-
-# Get Year Start Date
-ysd = sql("select year_start_date from `tabFiscal Year` where name='%s'" % filter_values['fiscal_year'])
-ysd = ysd and ysd[0][0] or ''
-
-# get as_on_date for opening
-as_on_date = ''
-if filter_values.get('posting_date'):
-  as_on_date = add_days(filter_values['posting_date'], -1)
-
-# Get Opening Balance
-def get_opening_balance(acc, fy, as_on_date, ysd, get_opening_balance):
-  #import webnotes
-  #import webnotes.model.code
-  #from webnotes.model.code import get_obj
-  #glc = webnotes.model.code.get_obj('GL Control')
-  glc = get_obj('GL Control')
-  acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % acc)
-  return glc.get_as_on_balance(acc, fy, as_on_date, acc_det[0][0], acc_det[0][2], acc_det[0][3])[2]
-
-cum_sum_main_acc_head = cum_sum_add_acc_head = cum_sum_cvd_acc_head = cum_sum_edu_cess_acc_head = cum_sum_sh_edu_cess_acc_head = 0
-openg_main_acc_head = openg_add_acc_head = openg_cvd_acc_head = openg_edu_cess_acc_head = openg_sh_edu_cess_acc_head = 0
-
-# Get Opening of Basic Excise Duty
-if not filter_values['main_acc_head']: 
-  msgprint("Please Enter Main Account Head")
-  raise Exception
-cum_sum_main_acc_head = openg_main_acc_head = get_opening_balance(filter_values['main_acc_head'], filter_values['fiscal_year'], as_on_date, ysd, get_opening_balance)
-
-# Get Opening of edu_cess_acc_head
-if not filter_values['edu_cess_acc_head'] :
-  msgprint("Please Enter Edu Cess Account Head")
-  raise Exception
-cum_sum_edu_cess_acc_head = openg_edu_cess_acc_head = get_opening_balance(filter_values['edu_cess_acc_head'], filter_values['fiscal_year'], as_on_date, ysd, get_opening_balance)
-
-# Get Opening of sh_edu_cess_acc_head
-if not filter_values['sh_edu_cess_acc_head'] :
-  msgprint("Please Enter S.H.Edu Cess Account Head")
-  raise Exception
-cum_sum_sh_edu_cess_acc_head = openg_sh_edu_cess_acc_head = get_opening_balance(filter_values['sh_edu_cess_acc_head'], filter_values['fiscal_year'], as_on_date, ysd, get_opening_balance)
-
-out = []
-
-out.append(['Opening Balance of Duty in Credit', '', flt(openg_main_acc_head) + flt(openg_add_acc_head) , flt(openg_edu_cess_acc_head), flt(openg_sh_edu_cess_acc_head),''])
-out += res
-#if from_export == 0:
-#  msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please click on 'Export' to open in a spreadsheet")
-#  raise Exception
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.sql b/erpnext/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.sql
deleted file mode 100644
index e43917a..0000000
--- a/erpnext/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.sql
+++ /dev/null
@@ -1,28 +0,0 @@
-SELECT t1.posting_date, t1.name, SUM(CASE WHEN t2.account_head like '%(main_acc_head)s%' THEN t2.tax_amount ELSE 0.00 END), SUM(CASE WHEN t2.account_head like '%(edu_cess_acc_head)s' THEN t2.tax_amount ELSE 0.00 END),  SUM(CASE WHEN t2.account_head like '%(sh_edu_cess_acc_head)s' THEN t2.tax_amount ELSE 0.00 END), '' AS remarks
- FROM `tabDelivery Note` t1, `tabRV Tax Detail` t2
- WHERE t2.parent = t1.name
- AND t2.parenttype = 'Delivery Note'
- AND (t2.account_head LIKE '%(main_acc_head)s%%'
- OR t2.account_head LIKE '%(edu_cess_acc_head)s%%'
- OR t2.account_head LIKE '%(sh_edu_cess_acc_head)s%%')
- AND t1.`posting_date` >= '%(posting_date)s'
- AND t1.`posting_date` <= '%(posting_date1)s'
- AND t1.docstatus =1
- GROUP BY t1.`name`
-
-UNION
-
-SELECT t1.posting_date, t1.name, SUM(CASE WHEN t2.account like '%(main_acc_head)s' THEN t2.credit ELSE 0.00 END), SUM(CASE WHEN t2.account like '%(edu_cess_acc_head)s' THEN t2.credit ELSE 0.00 END),  SUM(CASE WHEN t2.account like '%(sh_edu_cess_acc_head)s' THEN t2.credit ELSE 0.00 END), t1.`remark`
- FROM `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
- WHERE (t2.credit is not NULL OR t2.credit != '')
- AND t2.credit > 0
- AND t2.parent = t1.name
- AND (t2.account LIKE '%(main_acc_head)s%'
- OR t2.account LIKE '%(edu_cess_acc_head)s%'
- OR t2.account LIKE '%(sh_edu_cess_acc_head)s%') 
- AND t1.`posting_date` >= '%(posting_date)s'
- AND t1.`posting_date` <= '%(posting_date1)s'
- AND t1.docstatus =1
- GROUP BY t2.`parent`
-
-ORDER BY `posting_date`,`name`
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.txt b/erpnext/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.txt
deleted file mode 100644
index 0748ba2..0000000
--- a/erpnext/accounts/search_criteria/progressive_total_excise_duty/progressive_total_excise_duty.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, progressive_total_excise_duty
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-11-01 10:56:14',
-		'docstatus': 0,
-		'modified': '2010-10-29 16:44:43',
-		'modified_by': 'Administrator',
-		'owner': 'jai@webnotestech.com'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'Journal Voucher\x01ID,Journal Voucher\x01Owner,Journal Voucher\x01Voucher Type,Journal Voucher\x01Voucher Date,Journal Voucher\x01Posting Date,Journal Voucher\x01Is Opening,Journal Voucher\x01Fiscal Year,Journal Voucher\x01Company,Journal Voucher\x01Cheque No,Journal Voucher\x01Clearance Date,Journal Voucher\x01TDS Applicable,Journal Voucher\x01TDS Category,Journal Voucher Detail\x01Account,Journal Voucher Detail\x01Cost Center,Journal Voucher Detail\x01Against Payable,Journal Voucher Detail\x01Against Receivable',
-		'criteria_name': 'Progressive Total Excise Duty',
-		'doc_type': 'Journal Voucher Detail',
-		'doctype': 'Search Criteria',
-		'filters': "{'Journal Voucher\x01Saved':1,'Journal Voucher\x01Submitted':1,'Journal Voucher\x01Voucher Type':'','Journal Voucher\x01Is Opening':'','Journal Voucher\x01Fiscal Year':'','Journal Voucher\x01Company':'','Journal Voucher\x01TDS Applicable':'','Journal Voucher\x01TDS Category':''}",
-		'module': 'Accounts',
-		'name': '__common__',
-		'page_len': 50,
-		'parent_doc_type': 'Journal Voucher',
-		'sort_by': 'ID',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, progressive_total_excise_duty
-	{
-		'doctype': 'Search Criteria',
-		'name': 'progressive_total_excise_duty'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/purchase_register/purchase_register.py b/erpnext/accounts/search_criteria/purchase_register/purchase_register.py
index eb61af4..0601a62 100644
--- a/erpnext/accounts/search_criteria/purchase_register/purchase_register.py
+++ b/erpnext/accounts/search_criteria/purchase_register/purchase_register.py
@@ -16,8 +16,8 @@
 
 # add expense head columns
 expense_acc = [c[0] for c in sql("""select distinct expense_head 
-									from `tabPV Detail` 
-									where parenttype='Payable Voucher' 
+									from `tabPurchase Invoice Item` 
+									where parenttype='Purchase Invoice' 
 									and docstatus=1 
 									order by expense_head asc""")]
 									
@@ -31,8 +31,8 @@
 
 # Add tax head columns
 tax_acc = [c[0] for c in sql("""select distinct account_head 
-							    from `tabPurchase Tax Detail` 
-							    where parenttype = 'Payable Voucher' 
+							    from `tabPurchase Taxes and Charges` 
+							    where parenttype = 'Purchase Invoice' 
 							    and add_deduct_tax = 'Add' 
 							    and category in ('For Total', 'For Both')
 							    and docstatus=1
@@ -56,8 +56,8 @@
 for r in res:
 	#Get amounts for expense heads
 	exp_head_amount = sql("""select expense_head, sum(amount) 
-							 from `tabPV Detail` 
-							 where parent = %s and parenttype='Payable Voucher'
+							 from `tabPurchase Invoice Item` 
+							 where parent = %s and parenttype='Purchase Invoice'
 							 group by expense_head""", (r[col_idx['ID']],))
   
 	#convert the result to dictionary for easy retrieval  
@@ -84,9 +84,9 @@
 
 	#Get tax for account heads
 	acc_head_tax = sql("""select account_head, tax_amount 
-						  from `tabPurchase Tax Detail` 
+						  from `tabPurchase Taxes and Charges` 
 						  where parent = '%s' 
-						  and parenttype = 'Payable Voucher' 
+						  and parenttype = 'Purchase Invoice' 
 						  and add_deduct_tax = 'Add' 
 						  and category in ('For Total', 'For Both')""" %(r[col_idx['ID']],))
 
diff --git a/erpnext/accounts/search_criteria/purchase_register/purchase_register.txt b/erpnext/accounts/search_criteria/purchase_register/purchase_register.txt
index 4ae2751..cbc5c41 100644
--- a/erpnext/accounts/search_criteria/purchase_register/purchase_register.txt
+++ b/erpnext/accounts/search_criteria/purchase_register/purchase_register.txt
@@ -3,29 +3,29 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-15 08:39:24',
+		'creation': '2012-04-03 12:49:52',
 		'docstatus': 0,
-		'modified': '2011-06-06 14:37:00',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:52',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_cond': "`tabPayable Voucher`.is_opening != 'Yes'\n`tabPayable Voucher`.name not like 'OP/%'",
-		'columns': 'Payable Voucher\x01ID,Payable Voucher\x01Voucher Date,Payable Voucher\x01Posting Date,Payable Voucher\x01Credit To,Payable Voucher\x01Expense Head',
-		'criteria_name': 'Purchase Register',
-		'doc_type': 'Payable Voucher',
+		'add_cond': u"`tabPurchase Invoice`.is_opening != 'Yes'\n`tabPurchase Invoice`.name not like 'OP/%'",
+		'columns': u'Purchase Invoice\x01ID,Purchase Invoice\x01Voucher Date,Purchase Invoice\x01Posting Date,Purchase Invoice\x01Credit To,Purchase Invoice\x01Expense Head',
+		'criteria_name': u'Purchase Register',
+		'doc_type': u'Purchase Invoice',
 		'doctype': 'Search Criteria',
-		'filters': "{'Payable Voucher\x01Submitted':1}",
-		'module': 'Accounts',
+		'filters': u"{'Purchase Invoice\x01Submitted':1}",
+		'module': u'Accounts',
 		'name': '__common__',
-		'standard': 'Yes'
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, purchase_register
 	{
 		'doctype': 'Search Criteria',
-		'name': 'purchase_register'
+		'name': u'purchase_register'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/sales_register/sales_register.js b/erpnext/accounts/search_criteria/sales_register/sales_register.js
index 669d76d..5a09713 100644
--- a/erpnext/accounts/search_criteria/sales_register/sales_register.js
+++ b/erpnext/accounts/search_criteria/sales_register/sales_register.js
@@ -16,17 +16,17 @@
 
 report.customize_filters = function() {
  
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'ID'].df.filter_hide = 1;
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Owner'].df.filter_hide = 1;
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Saved'].df.filter_hide = 1;
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Submitted'].df.filter_hide = 1;
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Cancelled'].df.filter_hide = 1;
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Grand Total >='].df.filter_hide = 1;
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Grand Total <='].df.filter_hide = 1;
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 1;
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Sales Partner'].df.filter_hide = 1;
-  this.filter_fields_dict['Receivable Voucher'+FILTER_SEP +'Is Opening'].df.filter_hide = 1;
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'ID'].df.filter_hide = 1;
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Owner'].df.filter_hide = 1;
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Saved'].df.filter_hide = 1;
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Submitted'].df.filter_hide = 1;
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Cancelled'].df.filter_hide = 1;
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Grand Total >='].df.filter_hide = 1;
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Grand Total <='].df.filter_hide = 1;
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 1;
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Sales Partner'].df.filter_hide = 1;
+  this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Is Opening'].df.filter_hide = 1;
 }
diff --git a/erpnext/accounts/search_criteria/sales_register/sales_register.py b/erpnext/accounts/search_criteria/sales_register/sales_register.py
index 8bb6903..9fdfb00 100644
--- a/erpnext/accounts/search_criteria/sales_register/sales_register.py
+++ b/erpnext/accounts/search_criteria/sales_register/sales_register.py
@@ -17,14 +17,14 @@
 # add additional columns
 
 cl = [c[0] for c in sql("""select distinct account_head 
-						   from `tabRV Tax Detail` 
-						   where parenttype='Receivable Voucher' 
+						   from `tabSales Taxes and Charges` 
+						   where parenttype='Sales Invoice' 
 						   and docstatus=1 
 						   order by account_head asc""")]
 
 income_acc = [c[0] for c in sql("""select distinct income_account 
-								   from `tabRV Detail` 
-								   where parenttype='Receivable Voucher' 
+								   from `tabSales Invoice Item` 
+								   where parenttype='Sales Invoice' 
 								   and docstatus=1 
 								   order by income_account asc""")]
 
@@ -53,9 +53,9 @@
 
 	#Get amounts for income account
 	income_acc_list = sql("""select income_account, sum(amount) 
-						     from `tabRV Detail` 
+						     from `tabSales Invoice Item` 
 						     where parent = %s 
-						     and parenttype='Receivable Voucher'
+						     and parenttype='Sales Invoice'
 						     group by income_account""", (r[col_idx['ID']],))
 
 	#convert the result to dictionary for easy retrieval  
@@ -78,9 +78,9 @@
 
 	#Get tax for account heads
 	acc_head_tax = sql("""select account_head, tax_amount 
-						  from `tabRV Tax Detail` 
+						  from `tabSales Taxes and Charges` 
 						  where parent = '%s' 
-						  and parenttype = 'Receivable Voucher'""" %(r[col_idx['ID']],))
+						  and parenttype = 'Sales Invoice'""" %(r[col_idx['ID']],))
 
 	#Convert the result to dictionary for easy retrieval
 	acc_head_tax_dict = {}
diff --git a/erpnext/accounts/search_criteria/sales_register/sales_register.txt b/erpnext/accounts/search_criteria/sales_register/sales_register.txt
index c780fbd..fe436a0 100644
--- a/erpnext/accounts/search_criteria/sales_register/sales_register.txt
+++ b/erpnext/accounts/search_criteria/sales_register/sales_register.txt
@@ -3,35 +3,35 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-15 08:39:24',
+		'creation': '2012-04-11 17:36:48',
 		'docstatus': 0,
-		'modified': '2010-08-10 10:48:01',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-18 17:41:46',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_col': "`tabAccount`.`parent_account` AS 'Parent Account'\n`tabCustomer`.`territory` AS 'Territory'\n`tabCustomer`.`customer_details` AS 'Customer Details'",
-		'add_cond': "ifnull(`tabReceivable Voucher`.`is_opening`, 'No') = 'No'\n`tabAccount`.name =`tabReceivable Voucher`.debit_to\n`tabCustomer`.`name` = `tabAccount`.`master_name`",
-		'add_tab': '`tabAccount`\n`tabCustomer`',
-		'columns': 'Receivable Voucher\x01ID,Receivable Voucher\x01Posting Date,Receivable Voucher\x01Debit To',
-		'criteria_name': 'Sales Register',
-		'dis_filters': 'fiscal_year',
-		'doc_type': 'Receivable Voucher',
+		'add_col': u"`tabAccount`.`parent_account` AS 'Parent Account'\n`tabCustomer`.`territory` AS 'Territory'\n`tabCustomer`.`customer_details` AS 'Customer Details'",
+		'add_cond': u"ifnull(`tabSales Invoice`.`is_opening`, 'No') = 'No'\n`tabAccount`.name =`tabSales Invoice`.debit_to\n`tabCustomer`.`name` = `tabAccount`.`master_name`",
+		'add_tab': u'`tabAccount`\n`tabCustomer`',
+		'columns': u'Sales Invoice\x01ID,Sales Invoice\x01Posting Date,Sales Invoice\x01Debit To',
+		'criteria_name': u'Sales Register',
+		'dis_filters': u'fiscal_year',
+		'doc_type': u'Sales Invoice',
 		'doctype': 'Search Criteria',
-		'filters': "{'Receivable Voucher\x01Submitted':1,'Receivable Voucher\x01Is Opening':''}",
-		'module': 'Accounts',
+		'filters': u"{'Sales Invoice\x01Submitted':1,'Sales Invoice\x01Is Opening':''}",
+		'module': u'Accounts',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`Parent Account`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`Parent Account`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, sales_register
 	{
 		'doctype': 'Search Criteria',
-		'name': 'sales_register'
+		'name': u'sales_register'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/service_tax_credit_account___inputs/__init__.py b/erpnext/accounts/search_criteria/service_tax_credit_account___inputs/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/search_criteria/service_tax_credit_account___inputs/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.js b/erpnext/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.js
deleted file mode 100644
index 7c4c331..0000000
--- a/erpnext/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.js
+++ /dev/null
@@ -1,43 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-  this.hide_all_filters();
-  this.add_filter({fieldname:'main_acc_head', label:'Main Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
-  this.add_filter({fieldname:'edu_cess_acc_head', label:'Edu Cess Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
-  this.add_filter({fieldname:'sh_edu_cess_acc_head', label:'S.H.Edu Cess Account Head', fieldtype:'Link', options:'Account', ignore : 1, parent:'Journal Voucher Detail'});
-  
-  // un-hide fields 
-  //this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', ignore : 1, parent:'Journal Voucher Detail'});
-  //this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', ignore : 1, parent:'Journal Voucher Detail'});
-  //this.add_filter({fieldname:'posting_date', label:'Posting Date', fieldtype:'Date', ignore : 1, parent:'Journal Voucher Detail'});
-  
-  
-
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.filter_hide = 0;
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
-  
-  // set defaults
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
-
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
-  this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
-
-  //this.large_report = 1;
-}
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.py b/erpnext/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.py
deleted file mode 100644
index 78b992c..0000000
--- a/erpnext/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.py
+++ /dev/null
@@ -1,135 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Add columns
-# -----------
-row_list = [['Date', 'Date', '150px', '']
-           ,['ARI/INVOICE/Other Approved document/Bill of entry No.', 'Date', '150px', '']
-           ,['Date', 'Date', '150px', '']
-           ,['Service Tax', 'Currency', '150px', '']
-           ,['Education Cess', 'Currency', '150px', '']
-           ,['S.H.Education Cess', 'Currency', '150px', '']
-           ,[' Service Tax ', 'Currency', '150px', '']
-           ,[' Education Cess ', 'Currency', '150px', '']
-           ,[' S.H.Education Cess ', 'Currency', '150px', '']
-           ,['ARI/INVOICE/ Other Approved document/Bill of entry No.', 'Data', '100px', '']
-           ,['Date', 'Date', '150px', '']
-           ,[' Service Tax', 'Currency', '150px', '']
-           ,[' Education Cess', 'Currency', '150px', '']
-           ,[' S.H.Education Cess', 'Currency', '150px', '']
-           ,['Service Tax ', 'Currency', '150px', '']
-           ,['Education Cess ', 'Currency', '150px', '']
-           ,['S.H.Education Cess ', 'Currency', '150px', '']
-           ,['Remarks', 'Data', '150px', '']
-]
-
- 
-for r in row_list:
-  colnames.append(r[0])
-  coltypes.append(r[1])
-  colwidths.append(r[2])
-  coloptions.append(r[3])
-  col_idx[r[0]] = len(colnames)-1
-
-# Get Object Of GL Control
-#import webnotes
-#import webnotes.model.code
-#from webnotes.model.code import get_obj
-#glc = webnotes.model.code.get_obj('GL Control')
-
-# Get Year Start Date
-ysd = sql("select year_start_date from `tabFiscal Year` where name='%s'" % filter_values['fiscal_year'])
-ysd = ysd and ysd[0][0] or ''
-
-# get as_on_date for opening
-as_on_date = ''
-if filter_values.get('posting_date'):
-  as_on_date = add_days(filter_values['posting_date'], -1)
-
-# Get Opening Balance
-def get_opening_balance(acc, fy, as_on_date, ysd, get_opening_balance):
-  #import webnotes
-  #import webnotes.model.code
-  #from webnotes.model.code import get_obj
-  #glc = webnotes.model.code.get_obj('GL Control')
-  glc = get_obj('GL Control')
-  acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % acc)
-  return glc.get_as_on_balance(acc, fy, as_on_date, acc_det[0][0], acc_det[0][2], acc_det[0][3])[2]
-
-cum_sum_main_acc_head = cum_sum_edu_cess_acc_head = cum_sum_sh_edu_cess_acc_head = 0
-openg_main_acc_head = openg_edu_cess_acc_head = openg_sh_edu_cess_acc_head = 0
-
-# Get Opening of Basic Excise Duty
-if not filter_values['main_acc_head']: 
-  msgprint("Please Enter Main Account Head")
-  raise Exception
-cum_sum_main_acc_head = openg_main_acc_head = get_opening_balance(filter_values['main_acc_head'], filter_values['fiscal_year'], as_on_date, ysd, get_opening_balance)
-
-# Get Opening of edu_cess_acc_head
-if not filter_values['edu_cess_acc_head'] :
-  msgprint("Please Enter Edu Cess Account Head")
-  raise Exception
-cum_sum_edu_cess_acc_head = openg_edu_cess_acc_head = get_opening_balance(filter_values['edu_cess_acc_head'], filter_values['fiscal_year'], as_on_date, ysd, get_opening_balance)
-
-# Get Opening of sh_edu_cess_acc_head
-if not filter_values['sh_edu_cess_acc_head'] :
-  msgprint("Please Enter S.H.Edu Cess Account Head")
-  raise Exception
-cum_sum_sh_edu_cess_acc_head = openg_sh_edu_cess_acc_head = get_opening_balance(filter_values['sh_edu_cess_acc_head'], filter_values['fiscal_year'], as_on_date, ysd, get_opening_balance)
-
-msgprint("Column No "+ cstr(len(col_idx)))
-msgprint(openg_sh_edu_cess_acc_head)
-msgprint(openg_main_acc_head)
-for r in res:
-  msgprint(r)
-  r[col_idx['Service Tax']] = flt(r[col_idx['Education Cess']])
-  r[col_idx['Education Cess']] = flt(r[col_idx['S.H.Education Cess']])
-  r[col_idx['S.H.Education Cess']] = flt(r[col_idx[' Service Tax ']])
-  
-  remarks = r[col_idx[' Education Cess ']]
- 
-  cum_sum_main_acc_head = flt(cum_sum_main_acc_head) + flt(r[col_idx['Service Tax']])
-  r[col_idx[' Service Tax ']] = cum_sum_main_acc_head
-
-  cum_sum_edu_cess_acc_head = flt(cum_sum_edu_cess_acc_head) + flt(r[col_idx['Education Cess']])
-  r[col_idx[' Education Cess ']] = cum_sum_edu_cess_acc_head
-
-  cum_sum_sh_edu_cess_acc_head = flt(cum_sum_sh_edu_cess_acc_head) + flt(r[col_idx['S.H.Education Cess']])
-  r.append(cum_sum_sh_edu_cess_acc_head)
-
-  r.append('') 
-  r.append('')
-
-  r.append(0) 
-  r.append(0)
-  r.append(0) 
-
-  r.append(cum_sum_main_acc_head)
-  r.append(cum_sum_edu_cess_acc_head) 
-  r.append(cum_sum_sh_edu_cess_acc_head)
-  
-  r.append(remarks)
- 
-#msgprint(len(res))
-#msgprint(query)
-out = []
-
-msgprint(len(['Opening Balance of Duty in Credit', '', '', '', '', '', '', '', '', '', '', '', '', '',  flt(openg_main_acc_head) , flt(openg_edu_cess_acc_head), flt(openg_sh_edu_cess_acc_head)]))
-out.append(['Opening Balance of Duty in Credit', '', '', '', '', '', '', '', '', '', '', '', '', '', flt(openg_main_acc_head) , flt(openg_edu_cess_acc_head), flt(openg_sh_edu_cess_acc_head)])
-out += res
-#if from_export == 0:
-#  msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please click on 'Export' to open in a spreadsheet")
-#  raise Exception
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.sql b/erpnext/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.sql
deleted file mode 100644
index 0ecbcbb..0000000
--- a/erpnext/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.sql
+++ /dev/null
@@ -1,13 +0,0 @@
-SELECT t1.posting_date, t1.bill_no, t1.bill_date, t1.name, SUM(CASE WHEN t2.account like '%(main_acc_head)s%' THEN t2.debit ELSE 0.00 END), SUM(CASE WHEN t2.account like '%(edu_cess_acc_head)s' THEN t2.debit ELSE 0.00 END),  SUM(CASE WHEN t2.account like '%(sh_edu_cess_acc_head)s' THEN t2.debit ELSE 0.00 END), t1.`remark`
- FROM `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
- WHERE (t2.debit is not NULL OR t2.debit != '')
- AND t2.debit > 0
- AND t2.parent = t1.name
- AND (t2.account LIKE '%(main_acc_head)s%%'
- OR t2.account LIKE '%(edu_cess_acc_head)s%%'
- OR t2.account LIKE '%(sh_edu_cess_acc_head)s%%') 
- AND t1.`posting_date` >= '%(posting_date)s'
- AND t1.`posting_date` <= '%(posting_date1)s'
- AND t1.docstatus =1
- GROUP BY t2.`parent`
- ORDER BY t1.`posting_date`,t1.`name`
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.txt b/erpnext/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.txt
deleted file mode 100644
index f4b9fed..0000000
--- a/erpnext/accounts/search_criteria/service_tax_credit_account___inputs/service_tax_credit_account___inputs.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, service_tax_credit_account_-_inputs
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-11-01 10:56:14',
-		'docstatus': 0,
-		'modified': '2010-10-29 16:42:59',
-		'modified_by': 'Administrator',
-		'owner': 'jai@webnotestech.com'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'Journal Voucher\x01ID,Journal Voucher\x01Owner,Journal Voucher\x01Voucher Type,Journal Voucher\x01Voucher Date,Journal Voucher\x01Posting Date,Journal Voucher\x01Is Opening,Journal Voucher\x01Fiscal Year,Journal Voucher\x01Company,Journal Voucher\x01Cheque No,Journal Voucher\x01Clearance Date,Journal Voucher\x01TDS Applicable,Journal Voucher\x01TDS Category,Journal Voucher Detail\x01Account,Journal Voucher Detail\x01Cost Center,Journal Voucher Detail\x01Against Payable,Journal Voucher Detail\x01Against Receivable',
-		'criteria_name': 'Service Tax Credit Account - Inputs',
-		'doc_type': 'Journal Voucher Detail',
-		'doctype': 'Search Criteria',
-		'filters': "{'Journal Voucher\x01Saved':1,'Journal Voucher\x01Submitted':1,'Journal Voucher\x01Voucher Type':'','Journal Voucher\x01Is Opening':'','Journal Voucher\x01Fiscal Year':'','Journal Voucher\x01Company':'','Journal Voucher\x01TDS Applicable':'','Journal Voucher\x01TDS Category':''}",
-		'module': 'Accounts',
-		'name': '__common__',
-		'page_len': 50,
-		'parent_doc_type': 'Journal Voucher',
-		'sort_by': 'ID',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, service_tax_credit_account_-_inputs
-	{
-		'doctype': 'Search Criteria',
-		'name': 'service_tax_credit_account_-_inputs'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/tds_return/tds_return.txt b/erpnext/accounts/search_criteria/tds_return/tds_return.txt
index 5c200e5..743488d 100644
--- a/erpnext/accounts/search_criteria/tds_return/tds_return.txt
+++ b/erpnext/accounts/search_criteria/tds_return/tds_return.txt
@@ -3,29 +3,29 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:31',
+		'creation': '2012-04-03 12:49:53',
 		'docstatus': 0,
-		'modified': '2010-06-30 14:38:18',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:53',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'criteria_name': 'TDS Return',
-		'dis_filters': 'fiscal_year',
-		'doc_type': 'TDS Payment Detail',
+		'criteria_name': u'TDS Return',
+		'dis_filters': u'fiscal_year',
+		'doc_type': u'TDS Payment Detail',
 		'doctype': 'Search Criteria',
-		'filters': "{'TDS Payment\x01Submitted':1}",
-		'module': 'Accounts',
+		'filters': u"{'TDS Payment\x01Submitted':1}",
+		'module': u'Accounts',
 		'name': '__common__',
-		'parent_doc_type': 'TDS Payment',
-		'standard': 'Yes'
+		'parent_doc_type': u'TDS Payment',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, tds_return
 	{
 		'doctype': 'Search Criteria',
-		'name': 'tds_return'
+		'name': u'tds_return'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/__init__.py b/erpnext/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/total_amout_collection_for_a_period___customerwise.js b/erpnext/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/total_amout_collection_for_a_period___customerwise.js
deleted file mode 100644
index 72fd4b5..0000000
--- a/erpnext/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/total_amout_collection_for_a_period___customerwise.js
+++ /dev/null
@@ -1,42 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-  this.hide_all_filters();
-
-  this.add_filter({fieldname:'transaction_date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'Account'});
-
-  this.filter_fields_dict['Account'+FILTER_SEP +'Company'].df.filter_hide = 0;
-  this.filter_fields_dict['Account'+FILTER_SEP +'From Date'].df.filter_hide = 0;
-  this.filter_fields_dict['Account'+FILTER_SEP +'To Date'].df.filter_hide = 0;
-
-  this.filter_fields_dict['Account'+FILTER_SEP +'From Date'].df.in_first_page = 1;
-  this.filter_fields_dict['Account'+FILTER_SEP +'To Date'].df.in_first_page = 1;
-  this.filter_fields_dict['Account'+FILTER_SEP +'Company'].df.in_first_page = 1;
-
-  this.filter_fields_dict['Account'+FILTER_SEP +'From Date'].df['report_default']=sys_defaults.year_start_date;
-  this.filter_fields_dict['Account'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
-  this.filter_fields_dict['Account'+FILTER_SEP+'Company'].df['report_default']=sys_defaults.company;
-
-  this.dt.set_no_limit(1);
-
-  report.aftertableprint = function(t) {
-    $yt(t,'*',1,{whiteSpace:'pre'});
-  }
-}
-
-this.mytabs.items['Select Columns'].hide();
-this.mytabs.items['More Filters'].hide();
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/total_amout_collection_for_a_period___customerwise.py b/erpnext/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/total_amout_collection_for_a_period___customerwise.py
deleted file mode 100644
index c3f819f..0000000
--- a/erpnext/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/total_amout_collection_for_a_period___customerwise.py
+++ /dev/null
@@ -1,60 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# columns
-colnames[0] = 'Account'
-col_idx['Account'] = 0
-coltypes[0] = 'Link'
-coloptions[0] =  'Account'
-colwidths[0] = '200px'
-
-cl = [['Debit', 'Data', '100px'],['Credit', 'Data', '100px']]
-for c in cl:
-  colnames.append(c[0])
-  coltypes.append(c[1])
-  colwidths.append(c[2])
-  coloptions.append('')
-  col_idx[c[0]] = len(colnames)-1
-  
-
-# transaction date
-if not filter_values.get('transaction_date') or not filter_values.get('transaction_date1'):
-  msgprint("Please enter From Date and To Date")
-  raise Exception
-else:
-  from_date = add_days(filter_values['transaction_date'], -1)
-  to_date = filter_values['transaction_date1']
-
-# if output is more than 300 lines then it will ask to export
-if len(res) > 300  and from_export == 0:
-  msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please click on 'Export' to open in a spreadsheet")
-  raise Exception
-
-total_debit, total_credit = 0,0
-
-for r in res:
-  amount = sql("select sum(debit), sum(credit) from `tabGL Entry` WHERE posting_date >= '%s' AND posting_date <= '%s' and ifnull(is_opening,'No') = 'No' AND account = '%s' AND ifnull(is_cancelled, 'No') = 'No'" % (from_date,to_date, r[col_idx['Account']].strip()))
-  total_debit = flt(total_debit) + flt(amount[0][0])
-  total_credit = flt(total_credit) + flt(amount[0][1])
-
-  r.append(flt(amount[0][0]))
-  r.append(flt(amount[0][1]))
-
-t_row = ['' for i in range(len(colnames))]
-t_row[col_idx['Account']] = 'Total'
-t_row[col_idx['Debit']] = total_debit
-t_row[col_idx['Credit']] = total_credit
-res.append(t_row)
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/total_amout_collection_for_a_period___customerwise.txt b/erpnext/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/total_amout_collection_for_a_period___customerwise.txt
deleted file mode 100644
index aa3e2ea..0000000
--- a/erpnext/accounts/search_criteria/total_amout_collection_for_a_period___customerwise/total_amout_collection_for_a_period___customerwise.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-# Search Criteria, total_amout_collection_for_a_period_-_customerwise
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:31',
-		'docstatus': 0,
-		'modified': '2010-06-09 18:09:34',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_cond': '(master_type = "Customer" or parent_account like "Sundry Debtors%" or parent_account like "Accounts Receivable%")',
-		'columns': 'Account\x01ID',
-		'criteria_name': 'Total amout collection for a period - Customerwise',
-		'dis_filters': 'transaction_date',
-		'disabled': 0,
-		'doc_type': 'Account',
-		'doctype': 'Search Criteria',
-		'filters': "{'Account\x01Saved':1,'Account\x01Group or Ledger':'','Account\x01Is PL Account':'','Account\x01Account Type':'','Account\x01From Date\x01lower':'2010-04-01','Account\x01To Date\x01upper':'2010-06-09'}",
-		'module': 'Accounts',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabAccount`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, total_amout_collection_for_a_period_-_customerwise
-	{
-		'doctype': 'Search Criteria',
-		'name': 'total_amout_collection_for_a_period_-_customerwise'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/analysis/search_criteria/trend_analyzer/__init__.py b/erpnext/accounts/search_criteria/trend_analyzer/__init__.py
similarity index 100%
rename from erpnext/analysis/search_criteria/trend_analyzer/__init__.py
rename to erpnext/accounts/search_criteria/trend_analyzer/__init__.py
diff --git a/erpnext/accounts/search_criteria/trend_analyzer/trend_analyzer.js b/erpnext/accounts/search_criteria/trend_analyzer/trend_analyzer.js
new file mode 100644
index 0000000..dd3e750
--- /dev/null
+++ b/erpnext/accounts/search_criteria/trend_analyzer/trend_analyzer.js
@@ -0,0 +1,148 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+report.customize_filters = function() {
+  this.hide_all_filters();
+
+  this.add_filter({fieldname:'transaction', label:'Transaction', fieldtype:'Select', options:'Quotation'+NEWLINE+'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice'+NEWLINE+'Purchase Order'+NEWLINE+'Purchase Receipt'+NEWLINE+'Purchase Invoice',report_default:'Delivery Note',ignore : 1,parent:'Profile',in_first_page : 1,single_select : 1});
+
+  this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Profile',in_first_page:1,single_select:1});
+
+  this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Item'+NEWLINE+'Item Group'+NEWLINE+'Customer'+NEWLINE+'Customer Group'+NEWLINE+'Territory'+NEWLINE+'Supplier'+NEWLINE+'Supplier Type'+NEWLINE+'Project', ignore : 1, parent:'Profile', report_default:'Item', in_first_page : 1,single_select:1});
+
+  this.add_filter({fieldname:'group_by', label:'Group By', fieldtype:'Select', options:NEWLINE+'Item'+NEWLINE+'Customer'+NEWLINE+'Supplier', ignore : 1, parent:'Profile',single_select:1});
+
+  this.add_filter({fieldname:'order_type', label:'Order Type', fieldtype:'Select', options:NEWLINE+'Sales'+NEWLINE+'Maintenance',ignore : 1, parent:'Profile',single_select:1});
+
+  this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', report_default:sys_defaults.company, ignore : 1, parent:'Profile'});
+
+  this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Profile', in_first_page:1});
+
+
+  // Add Filters
+  this.add_filter({fieldname:'item', label:'Item', fieldtype:'Link', options:'Item', ignore : 1, parent:'Profile'});
+  this.add_filter({fieldname:'item_group', label:'Item Group', fieldtype:'Link', options:'Item Group', ignore : 1, parent:'Profile'});
+  this.add_filter({fieldname:'customer', label:'Customer', fieldtype:'Link', options:'Customer', ignore : 1, parent:'Profile'});
+  this.add_filter({fieldname:'customer_group', label:'Customer Group', fieldtype:'Link', options:'Customer Group', ignore : 1, parent:'Profile'});
+  this.add_filter({fieldname:'territory', label:'Territory', fieldtype:'Link', options:'Territory', ignore : 1, parent:'Profile'});
+  this.add_filter({fieldname:'supplier', label:'Supplier', fieldtype:'Link', options:'Supplier', ignore : 1, parent:'Profile'});
+  this.add_filter({fieldname:'supplier_type', label:'Supplier Type', fieldtype:'Link', options:'Supplier Type', ignore : 1, parent:'Profile'});
+  this.add_filter({fieldname:'project', label:'Project', fieldtype:'Link', options:'Project', ignore : 1, parent:'Profile'});
+}
+
+
+this.mytabs.tabs['Select Columns'].hide();
+
+report.aftertableprint = function(t) {
+   $yt(t,'*',1,{whiteSpace:'pre'});
+}
+
+var validate_values = function(trans,based_on,order_type) {
+  if(!fiscal_year){
+    msgprint("Please select Fiscal Year");
+    return 0;
+  }
+  if((in_list(['Quotation','Sales Order','Delivery Note','Sales Invoice'],trans) && in_list(['Supplier','Supplier Type'],based_on)) || (in_list(['Purchase Order','Purchase Receipt','Purchase Invoice'],trans) && in_list(['Customer','Customer Group','Territory'],based_on))){
+    msgprint("Sorry! You cannot fetch "+trans+" trend based on "+based_on);
+    return 0;
+  }
+  if(in_list(['Purchase Order','Purchase Receipt','Purchase Invoice'],trans) && order_type){
+    msgprint("Please deselect Order Type for "+trans);
+    return 0;
+  }
+  return 1;
+}
+
+
+report.get_query = function() {
+  trans = this.get_filter('Profile', 'Transaction').get_value();
+  order_type = this.get_filter('Profile', 'Order Type').get_value();
+  based_on = this.get_filter('Profile', 'Based On').get_value();
+  company = this.get_filter('Profile', 'Company').get_value();
+  fiscal_year = this.get_filter('Profile', 'Fiscal Year').get_value();
+
+  if(validate_values(trans,based_on,order_type)){
+    col = '';
+    add_cond = '';
+    add_col = '';
+    add_tables = '';
+    sp_cond = '';
+    if(trans == 'Sales Invoice') trans = 'Sales Invoice';
+    else if(trans == 'Purchase Invoice') trans = 'Purchase Invoice';
+
+    trans_det = trans+' Detail'
+
+    if(trans == 'Sales Invoice') trans_det = 'Sales Invoice Item';
+    else if(trans == 'Purchase Invoice') trans_det = 'Purchase Invoice Item';
+    else if(trans == 'Purchase Order') trans_det = 'Purchase Order Item';
+
+    if(order_type != '') add_code += ' AND t1.order_type = '+order_type;
+
+    switch(based_on){
+      case 'Item'           :     item = this.get_filter('Profile', 'Item').get_value();
+                                  col = 'DISTINCT t2.item_code, t3.item_name';
+                                  add_tables = ',tabItem t3';
+                                  add_cond += ' AND t2.item_code = t3.name';
+                                  if(item) add_cond += ' AND t2.item_code = "'+item+'"';
+                                  break;
+      case 'Customer'       :     cust = this.get_filter('Profile', 'Customer').get_value();
+                                  col = 'DISTINCT t1.customer, t3.territory';
+                                  add_tables = ',tabCustomer t3';
+                                  add_cond += ' AND t1.customer = t3.name';
+                                  if(cust) add_cond += ' AND t1.customer = "'+cust+'"';
+                                  break;
+      case 'Supplier'      :      supp = this.get_filter('Profile', 'Supplier').get_value();
+                                  col = 'DISTINCT t1.supplier, t3.supplier_type';
+                                  add_tables = ',tabSupplier t3';
+                                  add_cond += ' AND t1.supplier = t3.name';
+                                  if(supp) add_cond += ' AND t1.supplier = "'+supp+'"';
+                                  break;
+      case 'Supplier Type'  :     supp_type = this.get_filter('Profile', 'Supplier Type').get_value();
+                                  col = 'DISTINCT t3.supplier_type';
+                                  add_tables = ',tabSupplier t3';
+                                  add_cond += ' AND t1.supplier = t3.name';
+                                  if(supp_type) add_cond += ' AND t1.supplier_type = "'+supp_type+'"';
+                                  break;
+      case 'Project'        :     pro = this.get_filter('Profile', 'Project').get_value();
+      							  if (inList(['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'], trans)) {
+									  col = 'DISTINCT t2.project_name';
+    	                              if(pro) add_cond += ' AND t2.project_name = "'+pro+'"';
+    	                          } else {
+	    	                          col = 'DISTINCT t1.project_name';
+    	                              if(pro) add_cond += ' AND t1.project_name = "'+pro+'"';
+    	                          }
+                                  break;
+      case 'Item Group'     :     ig = this.get_filter('Profile', 'Item Group').get_value();
+                                  if(ig) sp_cond += ' AND parent.name = "'+ig+'"';
+                                  break;
+      case 'Customer Group' :     cg = this.get_filter('Profile', 'Customer Group').get_value();
+                                  if(cg) sp_cond += ' AND parent.name = "'+cg+'"';
+                                  break;
+      case 'Territory'      :     ter = this.get_filter('Profile', 'Territory').get_value();
+                                  if(ter) sp_cond += ' AND parent.name = "'+ter+'"';
+                                  break;
+
+    }
+
+    
+    if(based_on == 'Item' || based_on == 'Customer' || based_on == 'Supplier' || based_on == 'Supplier Type' || based_on == 'Project')
+      var q ='SELECT '+col+' FROM `tab'+trans+'` t1, `tab'+trans_det+'` t2 '+add_tables+' WHERE t1.fiscal_year = "'+fiscal_year+'" and t1.company = "'+company+'" and t2.parent = t1.name '+add_cond;
+    else
+      var q = 'SELECT CONCAT(REPEAT("     ", COUNT(parent.name) - 1), node.name) AS "Name" FROM `tab'+based_on+'` node,`tab'+based_on+'` parent WHERE node.lft BETWEEN parent.lft and parent.rgt and node.docstatus !=2 '+sp_cond+' GROUP BY node.name ORDER BY node.lft';
+   
+    return q;
+  }
+}
diff --git a/erpnext/accounts/search_criteria/trend_analyzer/trend_analyzer.py b/erpnext/accounts/search_criteria/trend_analyzer/trend_analyzer.py
new file mode 100644
index 0000000..278cfd6
--- /dev/null
+++ b/erpnext/accounts/search_criteria/trend_analyzer/trend_analyzer.py
@@ -0,0 +1,182 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# ********************************************* INITIALIZATION *******************************************
+out = []
+
+# Filter Values
+# =============================================
+based_on = filter_values.get('based_on')
+group_by = filter_values.get('group_by')
+trans = filter_values.get('transaction')
+period = filter_values.get('period')
+order_type = filter_values.get('order_type')
+company = filter_values.get('company')
+fiscal_year = filter_values.get('fiscal_year')
+item = filter_values.get('item')
+item_group = filter_values.get('item_group')
+customer = filter_values.get('customer')
+customer_group = filter_values.get('customer_group')
+territory = filter_values.get('territory')
+supplier = filter_values.get('supplier')
+supplier_type = filter_values.get('supplier_type')
+project = filter_values.get('project')
+
+
+# ********************************************* SET DEFAULTS **************************************************
+# Details Table
+# --------------
+if trans == 'Sales Invoice': trans = 'Sales Invoice'
+elif trans == 'Purchase Invoice': trans = 'Purchase Invoice'
+
+trans_det = trans+' Detail'
+
+if trans == 'Sales Invoice': trans_det = 'Sales Invoice Item'
+elif trans == 'Purchase Invoice': trans_det = 'Purchase Invoice Item'
+elif trans == 'Purchase Order': trans_det = 'Purchase Order Item'
+
+col_names, query_val = get_obj('Trend Analyzer Control').get_single_year_query_value(fiscal_year, period, trans, trans_det)
+query_val += 'SUM(t2.qty), SUM(t2.amount)'
+
+col_names.append('Total (Qty)')
+col_names.append('Total (Amt)')
+
+
+# ********************************************* VALIDATIONS ***************************************************
+if (based_on in ['Customer','Customer Group','Territory'] and group_by == 'Supplier') or (based_on in ['Supplier','Supplier Type'] and group_by == 'Customer'):
+	msgprint("Sorry! You cannot group Trend Analyzer based on %s by %s" % (based_on,group_by))
+	raise Exception
+
+if based_on == group_by:
+	msgprint("Based On and Group By value cannot be same for Trend Analyzer")
+	raise Exception
+
+
+# ********************************************** ADD COLUMNS **********************************************
+cols = [[based_on, 'Data', '300px', '']]
+cr = 1
+if based_on == 'Item':
+	cols.append(['Item Name','Data','200px',''])
+	cr = 2
+elif based_on == 'Customer':
+	cols.append(['Territory','Link','150px','Territory'])
+	cr = 2
+elif based_on == 'Supplier':
+	cols.append(['Supplier Type','Link','150px','Supplier Type'])
+	cr = 2
+if group_by:
+	cr += 1
+
+if group_by:
+	cols.append([group_by,'Data','150px',''])
+
+for c in col_names:
+	cols.append([c,'Currency','150px',''])
+
+for c in cols:
+	colnames.append(c[0])
+	coltypes.append(c[1])
+	colwidths.append(c[2])
+	coloptions.append(c[3])
+	col_idx[c[0]] = len(colnames)-1
+
+
+# ******************************************* ADDITIONAL CONDITION ************************************************
+add_cond = ' t2.parent = t1.name AND t1.company = "%s" AND t1.fiscal_year = "%s" and t1.docstatus = 1' % (company, fiscal_year)
+add_tab = ' `tab'+trans+'` t1, `tab'+trans_det+'` t2'
+if order_type: add_cond += ' AND t1.order_type = "%s"' % order_type
+
+
+# Item
+if item or based_on == 'Item':
+	add_cond += ' AND t2.item_code = "%s"' % (based_on != 'Item' and item or '%(value)s')
+
+# Item Group
+if item_group or based_on == 'Item Group':
+	add_tab += ' ,`tabItem` t3, `tabItem Group` t4 '
+	add_cond += ' AND t3.name = t2.item_code AND t3.item_group = t4.name and (t4.name = "%s" or t4.name IN (SELECT t5.name FROM `tabItem Group` t5,`tabItem Group` t6 WHERE t5.lft BETWEEN t6.lft and t6.rgt and t5.docstatus !=2 and t6.name = "%s"))' % (based_on != 'Item Group' and item_group or '%(value)s', based_on != 'Item Group' and item_group or '%(value)s')
+
+# Customer
+if customer or based_on == 'Customer':
+	add_cond += ' AND t1.customer = "%s"' % (based_on != 'Customer' and customer or '%(value)s')
+
+# Customer Group
+if customer_group or based_on == 'Customer Group':
+	add_tab += ' ,`tabCustomer` t7, `tabCustomer Group` t8 '
+	add_cond += ' AND t7.name = t1.customer AND t7.customer_group = t8.name and (t8.name = "%s" or t8.name IN (SELECT t9.name FROM `tabCustomer Group` t9,`tabCustomer Group` t10 WHERE t9.lft BETWEEN t10.lft and t10.rgt and t9.docstatus !=2 and ifnull(t9.is_group,"No") = "No" and t10.name = "%s"))' % (based_on != 'Customer Group'	and customer_group or '%(value)s', based_on != 'Customer Group'	and customer_group or '%(value)s')
+	
+# Territory
+if territory or based_on == 'Territory':
+	add_tab += ' ,`tabTerritory` t11 '
+	add_cond += ' AND t1.territory = t11.name and (t11.name = "%s" or t11.name IN (SELECT t12.name FROM `tabTerritory` t12,`tabTerritory` t13 WHERE t12.lft BETWEEN t13.lft and t13.rgt and t12.docstatus !=2 and ifnull(t12.is_group,"No") = "No" and t13.name = "%s"))' % (based_on != 'Territory' and territory or '%(value)s', based_on != 'Territory' and territory or '%(value)s')
+
+# Supplier
+if supplier or based_on == 'Supplier':
+	add_cond += ' AND t1.supplier = "%s"' % (based_on != 'Supplier' and supplier or '%(value)s')
+	
+# Supplier Type
+if supplier_type or based_on == 'Supplier Type':
+	add_tab += ' ,`tabSupplier` t14, `tabSupplier Type` t15 '
+	add_cond += ' AND t14.name = t1.supplier AND t14.supplier_type = t15.name and t15.name = "%s"' % (based_on != 'Supplier Type' and supplier_type or '%(value)s')
+
+# Project
+if project or based_on == 'Project':
+	if trans in ['Purchase Order', 'Purchase Receipt', 'Purchase Invoice']:
+		add_cond += ' AND t2.project_name = "%s"' % (based_on != 'Project' and project or '%(value)s')
+	else:
+		add_cond += ' AND t1.project_name = "%s"' % (based_on != 'Project' and project or '%(value)s')
+	
+# Column to be seleted for group by condition
+# ==============================================
+sel_col = ''
+if group_by == 'Item':
+	sel_col = 't2.item_code'
+elif group_by == 'Customer':
+	sel_col = 't1.customer'
+elif group_by == 'Supplier':
+	sel_col = 't1.supplier'
+	
+	
+# ********************************************** Result Set ************************************************
+for r in res:
+	main_det = sql("SELECT %s FROM %s WHERE %s" % (query_val, add_tab, add_cond % {'value':cstr(r[col_idx[based_on]]).strip()}))
+	if group_by:
+		for col in range(cr,cr+1): # this would make all first row blank. just for look
+			r.append('')
+	if main_det[0][len(colnames) - cr - 1]:
+		for d in range(len(colnames) - cr):
+			r.append(flt(main_det[0][d]))
+		out.append(r)
+		
+		if group_by:
+			flag = 1
+			# check for root nodes
+			if based_on in ['Item Group','Customer Group','Territory']:
+				is_grp = sql("select is_group from `tab%s` where name = '%s'" % (based_on, cstr(r[col_idx[based_on]]).strip()))
+				is_grp = is_grp and cstr(is_grp[0][0]) or ''
+				if is_grp != 'No':
+					flag = 0
+
+			if flag == 1:	
+				det = [x[0] for x in sql("SELECT DISTINCT %s FROM %s where %s" % (sel_col, add_tab, add_cond % {'value':cstr(r[col_idx[based_on]]).strip()}))]
+
+				for des in range(len(det)):
+					t_row = ['' for i in range(len(colnames))]
+					t_row[col_idx[group_by]] = cstr(det[des])
+					gr_det = sql("SELECT %s FROM %s WHERE %s = '%s' and %s" % (query_val, add_tab, sel_col, cstr(det[des]), add_cond % {'value':cstr(r[col_idx[based_on]]).strip()}))
+					for d in range(len(col_names)):
+						t_row[col_idx[col_names[d]]] = flt(gr_det[0][d])
+					out.append(t_row)
diff --git a/erpnext/accounts/search_criteria/trend_analyzer/trend_analyzer.txt b/erpnext/accounts/search_criteria/trend_analyzer/trend_analyzer.txt
new file mode 100644
index 0000000..93a60e0
--- /dev/null
+++ b/erpnext/accounts/search_criteria/trend_analyzer/trend_analyzer.txt
@@ -0,0 +1,33 @@
+# Search Criteria, trend_analyzer
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-04-03 12:49:53',
+		'docstatus': 0,
+		'modified': '2012-04-03 12:49:53',
+		'modified_by': u'Administrator',
+		'owner': u'saumil@webnotestech.com'
+	},
+
+	# These values are common for all Search Criteria
+	{
+		'columns': u'Profile\x01ID,Profile\x01Owner',
+		'criteria_name': u'Trend Analyzer',
+		'doc_type': u'Profile',
+		'doctype': 'Search Criteria',
+		'filters': u'{}',
+		'module': u'Accounts',
+		'name': '__common__',
+		'page_len': 50,
+		'sort_by': u'`tabProfile`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
+	},
+
+	# Search Criteria, trend_analyzer
+	{
+		'doctype': 'Search Criteria',
+		'name': u'trend_analyzer'
+	}
+]
diff --git a/erpnext/accounts/search_criteria/trial_balance/trial_balance.txt b/erpnext/accounts/search_criteria/trial_balance/trial_balance.txt
index 16bac7c..63e7b49 100644
--- a/erpnext/accounts/search_criteria/trial_balance/trial_balance.txt
+++ b/erpnext/accounts/search_criteria/trial_balance/trial_balance.txt
@@ -3,33 +3,33 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 10:23:28',
+		'creation': '2012-04-03 12:49:53',
 		'docstatus': 0,
-		'modified': '2011-06-22 12:29:43',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:53',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Account\x01ID',
-		'criteria_name': 'Trial Balance',
-		'description': 'Trial Balance',
-		'dis_filters': 'transaction_date',
-		'doc_type': 'Account',
+		'columns': u'Account\x01ID',
+		'criteria_name': u'Trial Balance',
+		'description': u'Trial Balance',
+		'dis_filters': u'transaction_date',
+		'doc_type': u'Account',
 		'doctype': 'Search Criteria',
-		'filters': "{'Account\x01Group or Ledger':'Ledger','Account\x01Is PL Account':'','Account\x01Account Type':'','Account\x01Show Group Balance':''}",
-		'module': 'Accounts',
+		'filters': u"{'Account\x01Group or Ledger':'Ledger','Account\x01Is PL Account':'','Account\x01Account Type':'','Account\x01Show Group Balance':''}",
+		'module': u'Accounts',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabAccount`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabAccount`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, trial_balance
 	{
 		'doctype': 'Search Criteria',
-		'name': 'trial_balance'
+		'name': u'trial_balance'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.js b/erpnext/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.js
index 41ead1c..9489630 100644
--- a/erpnext/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.js
+++ b/erpnext/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.js
@@ -18,13 +18,13 @@
   this.hide_all_filters();
 
   //Add filter
-  this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice', report_default:'Sales Invoice', ignore : 1,parent:'RV Tax Detail', single_select :1, in_first_page:1});
+  this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice', report_default:'Sales Invoice', ignore : 1,parent:'Sales Taxes and Charges', single_select :1, in_first_page:1});
   
-  this.add_filter({fieldname:'posting_date', label:'Date', fieldtype:'Date', options:'', ignore : 1,parent:'RV Tax Detail', in_first_page:1});
+  this.add_filter({fieldname:'posting_date', label:'Date', fieldtype:'Date', options:'', ignore : 1,parent:'Sales Taxes and Charges', in_first_page:1});
   
-  this.add_filter({fieldname:'voucher_id', label:'Voucher Id', fieldtype:'Data', options:'', ignore : 1,parent:'RV Tax Detail', in_first_page:1});
+  this.add_filter({fieldname:'voucher_id', label:'Voucher Id', fieldtype:'Data', options:'', ignore : 1,parent:'Sales Taxes and Charges', in_first_page:1});
   
-  this.add_filter({fieldname:'tax_account', label:'Tax Account', fieldtype:'Link', options:'Account', ignore : 1,parent:'RV Tax Detail', in_first_page:1});
+  this.add_filter({fieldname:'tax_account', label:'Tax Account', fieldtype:'Link', options:'Account', ignore : 1,parent:'Sales Taxes and Charges', in_first_page:1});
 }
 
 
@@ -36,15 +36,15 @@
 // Get query
 //--------------------------------------
 report.get_query = function() {
-  based_on = this.get_filter('RV Tax Detail', 'Based On').get_value();
-  from_date = this.get_filter('RV Tax Detail', 'From Date').get_value();
-  to_date = this.get_filter('RV Tax Detail', 'To Date').get_value();
-  vid = this.get_filter('RV Tax Detail', 'Voucher Id').get_value();
-  acc = this.get_filter('RV Tax Detail', 'Tax Account').get_value();
+  based_on = this.get_filter('Sales Taxes and Charges', 'Based On').get_value();
+  from_date = this.get_filter('Sales Taxes and Charges', 'From Date').get_value();
+  to_date = this.get_filter('Sales Taxes and Charges', 'To Date').get_value();
+  vid = this.get_filter('Sales Taxes and Charges', 'Voucher Id').get_value();
+  acc = this.get_filter('Sales Taxes and Charges', 'Tax Account').get_value();
 
   date_fld = 'transaction_date';
   if(based_on == 'Sales Invoice') {
-  	based_on = 'Receivable Voucher';
+  	based_on = 'Sales Invoice';
   	date_fld = 'voucher_date';
   }
 
@@ -55,7 +55,7 @@
   if (acc) sp_cond += repl(' AND t2.account_head = "%(acc)s"', {acc:acc});
 
   return repl('SELECT t1.`name`, t1.`%(dt)s`, t1.`customer_name`, t1.net_total, t2.account_head, t2.description, t2.rate, t2.tax_amount \
-  	FROM `tab%(parent)s` t1, `tabRV Tax Detail` t2 \
+  	FROM `tab%(parent)s` t1, `tabSales Taxes and Charges` t2 \
   	WHERE t1.docstatus=1 AND t2.`parenttype` = "%(parent)s" \
   	AND t2.`parent` = t1.`name`  \
   	%(cond)s ORDER BY t1.`name` DESC, t1.%(dt)s DESC', {parent:based_on, cond:sp_cond, dt:date_fld});
diff --git a/erpnext/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.py b/erpnext/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.py
index 4dbfb52..43dd954 100644
--- a/erpnext/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.py
+++ b/erpnext/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.py
@@ -15,7 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 if filter_values.get('based_on') == 'Sales Invoice':
-  based_on_dt = 'Receivable Voucher'
+  based_on_dt = 'Sales Invoice'
 else:
   based_on_dt = filter_values.get('based_on')
 
diff --git a/erpnext/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.txt b/erpnext/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.txt
index c152c79..ac1cd4c 100644
--- a/erpnext/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.txt
+++ b/erpnext/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.txt
@@ -3,32 +3,32 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-09-06 15:36:58',
+		'creation': '2012-04-03 12:49:53',
 		'docstatus': 0,
-		'modified': '2011-09-06 15:50:28',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:53',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'RV Tax Detail\x01Type,RV Tax Detail\x01Account Head,RV Tax Detail\x01Cost Center,RV Tax Detail\x01Description,RV Tax Detail\x01Rate,RV Tax Detail\x01Amount*,RV Tax Detail\x01Total*',
-		'criteria_name': 'Voucher wise tax details',
-		'doc_type': 'RV Tax Detail',
+		'columns': u'Sales Taxes and Charges\x01Type,Sales Taxes and Charges\x01Account Head,Sales Taxes and Charges\x01Cost Center,Sales Taxes and Charges\x01Description,Sales Taxes and Charges\x01Rate,Sales Taxes and Charges\x01Amount*,Sales Taxes and Charges\x01Total*',
+		'criteria_name': u'Voucher wise tax details',
+		'doc_type': u'Sales Taxes and Charges',
 		'doctype': 'Search Criteria',
-		'filters': "{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01Fiscal Year':''}",
-		'module': 'Accounts',
+		'filters': u"{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01Fiscal Year':''}",
+		'module': u'Accounts',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Delivery Note',
-		'sort_by': '`tabRV Tax Detail`.`parent`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Delivery Note',
+		'sort_by': u'`tabSales Taxes and Charges`.`parent`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, voucher_wise_tax_details
 	{
 		'doctype': 'Search Criteria',
-		'name': 'voucher_wise_tax_details'
+		'name': u'voucher_wise_tax_details'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/analysis/search_criteria/yearly_transaction_summary/__init__.py b/erpnext/accounts/search_criteria/yearly_transaction_summary/__init__.py
similarity index 100%
rename from erpnext/analysis/search_criteria/yearly_transaction_summary/__init__.py
rename to erpnext/accounts/search_criteria/yearly_transaction_summary/__init__.py
diff --git a/erpnext/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.js b/erpnext/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.js
similarity index 100%
rename from erpnext/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.js
rename to erpnext/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.js
diff --git a/erpnext/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.py b/erpnext/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.py
similarity index 100%
rename from erpnext/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.py
rename to erpnext/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.py
diff --git a/erpnext/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.sql b/erpnext/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.sql
similarity index 100%
rename from erpnext/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.sql
rename to erpnext/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.sql
diff --git a/erpnext/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.txt b/erpnext/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.txt
new file mode 100644
index 0000000..122d1d1
--- /dev/null
+++ b/erpnext/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.txt
@@ -0,0 +1,32 @@
+# Search Criteria, yearly_transaction_summary
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-04-03 12:49:53',
+		'docstatus': 0,
+		'modified': '2012-04-03 12:49:53',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all Search Criteria
+	{
+		'columns': u'Profile\x01ID',
+		'criteria_name': u'Yearly Transaction Summary',
+		'doc_type': u'Profile',
+		'doctype': 'Search Criteria',
+		'filters': u"{'DocType\x01Fiscal Year':'2009-2010','DocType\x01Company':'Alpha Company','DocType\x01Period':'Monthly'}",
+		'module': u'Accounts',
+		'name': '__common__',
+		'sort_by': u'`tabProfile`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
+	},
+
+	# Search Criteria, yearly_transaction_summary
+	{
+		'doctype': 'Search Criteria',
+		'name': u'yearly_transaction_summary'
+	}
+]
diff --git a/erpnext/analysis/Module Def/Analysis/Analysis.txt b/erpnext/analysis/Module Def/Analysis/Analysis.txt
deleted file mode 100644
index 97bbb43..0000000
--- a/erpnext/analysis/Module Def/Analysis/Analysis.txt
+++ /dev/null
@@ -1,253 +0,0 @@
-[
-	{
-		'_last_update': '1300959286',
-		'creation': '2010-11-30 17:31:05',
-		'disabled': 'No',
-		'docstatus': 0,
-		'doctype': u'Module Def',
-		'doctype_list': None,
-		'file_list': None,
-		'idx': None,
-		'is_hidden': 'No',
-		'last_updated_date': '2010-12-02 09:25:40',
-		'modified': '2011-03-24 15:28:54',
-		'modified_by': 'Administrator',
-		'module_desc': None,
-		'module_icon': 'chart.png',
-		'module_label': 'Analysis',
-		'module_name': 'Analysis',
-		'module_page': None,
-		'module_seq': 10,
-		'name': 'Analysis',
-		'owner': 'Administrator',
-		'parent': None,
-		'parentfield': None,
-		'parenttype': None,
-		'trash_reason': None,
-		'widget_code': None
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 12:00:50',
-		'description': None,
-		'display_name': None,
-		'doc_name': 'Reports',
-		'doc_type': 'Separator',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 1,
-		'modified': '2011-03-24 15:28:54',
-		'modified_by': 'Administrator',
-		'name': '000003012',
-		'owner': 'Administrator',
-		'parent': 'Analysis',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 12:00:50',
-		'description': None,
-		'display_name': 'Yearly Transaction Summary',
-		'doc_name': 'Profile',
-		'doc_type': 'Reports',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 2,
-		'modified': '2011-03-24 15:28:54',
-		'modified_by': 'Administrator',
-		'name': '000003014',
-		'owner': 'Administrator',
-		'parent': 'Analysis',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 17:31:05',
-		'description': 'A quick glance at your work in progress and pipeline',
-		'display_name': 'Work in Progress Monitor',
-		'doc_name': 'WIP Monitor',
-		'doc_type': 'Pages',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': 'magnifier.gif',
-		'idx': 3,
-		'modified': '2011-03-24 15:28:54',
-		'modified_by': 'Administrator',
-		'name': 'MDI00063',
-		'owner': 'Administrator',
-		'parent': 'Analysis',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 12:00:50',
-		'description': 'Analyze trend of sales, purchase and stock over any period',
-		'display_name': 'Monthly Trend Analyzer',
-		'doc_name': 'Profile',
-		'doc_type': 'Reports',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': 'chart_bar.gif',
-		'idx': 4,
-		'modified': '2011-03-24 15:28:54',
-		'modified_by': 'Administrator',
-		'name': '000003013',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Analysis',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 12:00:50',
-		'description': None,
-		'display_name': None,
-		'doc_name': 'Reports',
-		'doc_type': 'Separator',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 1,
-		'modified': '2011-03-24 15:28:54',
-		'modified_by': 'Administrator',
-		'name': '000003012',
-		'owner': 'Administrator',
-		'parent': 'Analysis',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 12:00:50',
-		'description': None,
-		'display_name': 'Yearly Transaction Summary',
-		'doc_name': 'Profile',
-		'doc_type': 'Reports',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 2,
-		'modified': '2011-03-24 15:28:54',
-		'modified_by': 'Administrator',
-		'name': '000003014',
-		'owner': 'Administrator',
-		'parent': 'Analysis',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 17:31:05',
-		'description': 'A quick glance at your work in progress and pipeline',
-		'display_name': 'Work in Progress Monitor',
-		'doc_name': 'WIP Monitor',
-		'doc_type': 'Pages',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': 'magnifier.gif',
-		'idx': 3,
-		'modified': '2011-03-24 15:28:54',
-		'modified_by': 'Administrator',
-		'name': 'MDI00063',
-		'owner': 'Administrator',
-		'parent': 'Analysis',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 12:00:50',
-		'description': 'Analyze trend of sales, purchase and stock over any period',
-		'display_name': 'Monthly Trend Analyzer',
-		'doc_name': 'Profile',
-		'doc_type': 'Reports',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': 'chart_bar.gif',
-		'idx': 4,
-		'modified': '2011-03-24 15:28:54',
-		'modified_by': 'Administrator',
-		'name': '000003013',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Analysis',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'creation': '2010-11-30 17:31:05',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 1,
-		'modified': '2011-03-24 15:28:54',
-		'modified_by': 'Administrator',
-		'name': 'MDR00004',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Analysis',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'Sales Manager'
-	},
-	{
-		'creation': '2010-11-30 17:31:05',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 2,
-		'modified': '2011-03-24 15:28:54',
-		'modified_by': 'Administrator',
-		'name': 'MDR00005',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Analysis',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'Purchase Manager'
-	},
-	{
-		'creation': '2010-11-30 17:31:05',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 3,
-		'modified': '2011-03-24 15:28:54',
-		'modified_by': 'Administrator',
-		'name': 'MDR00006',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Analysis',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'Material Manager'
-	},
-	{
-		'creation': '2010-11-30 17:31:05',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 4,
-		'modified': '2011-03-24 15:28:54',
-		'modified_by': 'Administrator',
-		'name': 'MDR00007',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Analysis',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'Accounts Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/analysis/__init__.py b/erpnext/analysis/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/analysis/__init__.py
+++ /dev/null
diff --git a/erpnext/analysis/doctype/__init__.py b/erpnext/analysis/doctype/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/analysis/doctype/__init__.py
+++ /dev/null
diff --git a/erpnext/analysis/doctype/mis_control/mis_control.py b/erpnext/analysis/doctype/mis_control/mis_control.py
deleted file mode 100644
index b2c85f8..0000000
--- a/erpnext/analysis/doctype/mis_control/mis_control.py
+++ /dev/null
@@ -1,418 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-	
-# -----------------------------------------------------------------------------------------
-
-
-class DocType:
-  def __init__(self, doc, doclist):
-    self.doc = doc
-    self.doclist = doclist
-    self.account_list = []
-    self.ac_details = {} # key: account id, values: debit_or_credit, lft, rgt
-    
-    self.roles = webnotes.user.get_roles()
-
-    self.period_list = []
-    self.period_start_date = {}
-    self.period_end_date = {}
-
-    self.fs_list = []
-    self.root_bal = []
-    self.flag = 0
-
-  # Get defaults on load of MIS, MIS - Comparison Report and Financial statements
-  # ----------------------------------------------------
-  def get_comp(self):
-    ret = {}
-    type = []
-    comp = []
-    # ------ get period -----------
-    ret['period'] = ['Annual','Half Yearly','Quarterly','Monthly']
-    
-    # ---- get companies ---------
-    res = sql("select name from `tabCompany`")
-    for r in res:
-      comp.append(r[0])
-    #comp.append(r[0] for r in res)
-    ret['company'] = comp
-
-    #--- to get fiscal year and start_date of that fiscal year -----
-    res = sql("select name, year_start_date from `tabFiscal Year`")
-    ret['fiscal_year'] = [r[0] for r in res]
-    ret['start_dates'] = {}
-    for r in res:
-      ret['start_dates'][r[0]] = str(r[1])
-      
-    #--- from month and to month (for MIS - Comparison Report) -------
-    month_list = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
-    fiscal_start_month = sql("select MONTH(year_start_date) from `tabFiscal Year` where name = %s",(get_defaults()['fiscal_year']))
-    fiscal_start_month = fiscal_start_month and fiscal_start_month[0][0] or 1
-    mon = ['']
-    for i in range(fiscal_start_month,13): mon.append(month_list[i-1])
-    for i in range(0,fiscal_start_month-1): mon.append(month_list[i])
-    ret['month'] = mon
-
-    # ------------------------ get MIS Type on basis of roles of session user ------------------------------------------
-    if has_common(self.roles, ['Sales Manager']):
-      type.append('Sales')
-    if has_common(self.roles, ['Purchase Manager']):
-      type.append('Purchase')
-    ret['type'] = type
-    return ret
-    
-  # Gets Transactions type and Group By options based on module
-  #------------------------------------------------------------------
-  def get_trans_group(self,module):
-    ret = {}
-    st,group = [],[]
-    if module == 'Sales':
-      st = ['Quotation','Sales Order','Delivery Note','Receivable Voucher']
-      group = ['Item','Item Group','Customer','Customer Group','Cost Center']
-    elif module == 'Purchase':
-      st = ['Purchase Order','Purchase Receipt','Payable Voucher']
-      group = ['Item','Item Group','Supplier','Supplier Type']
-    
-    ret['stmt_type'] = st
-    ret['group_by'] = group
-    
-    return ret
-
-  # Get Days based on month (for MIS Comparison Report)
-  # --------------------------------------------------------
-  def get_days(self,month):
-    days = []
-    ret = {}
-    if month == 'Jan' or month == 'Mar' or month == 'May' or month == 'Jul' or month == 'Aug' or month == 'Oct' or month == 'Dec':
-      for i in range(1,32):
-        days.append(i)
-    elif month == 'Apr' or month == 'Jun' or month == 'Sep' or month == 'Nov':
-      for i in range(1,31):
-        days.append(i)
-    elif month == 'Feb':
-      for i in range(1,29):
-        days.append(i)
-    ret['days'] = days
-    return ret
-	
-  # Get from date and to date based on fiscal year (for in summary - comparison report)
-  # -----------------------------------------------------------------------------------------------------
-  def dates(self,fiscal_year,from_date,to_date):
-    import datetime
-    ret = ''
-    start_date = cstr(sql("select year_start_date from `tabFiscal Year` where name = %s",fiscal_year)[0][0])
-    st_mon = cint(from_date.split('-')[1])
-    ed_mon = cint(to_date.split('-')[1])
-    st_day = cint(from_date.split('-')[2])
-    ed_day = cint(to_date.split('-')[2])
-    fiscal_start_month = cint(start_date.split('-')[1])
-    next_fiscal_year = cint(start_date.split('-')[0]) + 1
-    current_year = ''
-    next_year = ''
-    
-    #CASE - 1 : Jan - Mar (Valid)
-    if st_mon < fiscal_start_month and ed_mon < fiscal_start_month:
-      current_year = cint(start_date.split('-')[0]) + 1
-      next_year  = cint(start_date.split('-')[0]) + 1
-    
-    # Case - 2 : Apr - Dec (Valid)
-    elif st_mon >= fiscal_start_month and ed_mon <= 12 and ed_mon >= fiscal_start_month:
-      current_year = cint(start_date.split('-')[0])
-      next_year  = cint(start_date.split('-')[0])
-
-    # Case 3 : Jan - May (Invalid)
-    elif st_mon < fiscal_start_month and ed_mon >= fiscal_start_month:
-      current_year = cint(start_date.split('-')[0]) + 1
-      next_year  = cint(start_date.split('-')[0]) + 2
-	
-    # check whether from date is within fiscal year
-    if datetime.date(current_year, st_mon, st_day) >= datetime.date(cint(start_date.split('-')[0]), cint(start_date.split('-')[1]), cint(start_date.split('-')[2])) and datetime.date(cint(current_year), cint(st_mon), cint(st_day)) < datetime.date((cint(start_date.split('-')[0])+1), cint(start_date.split('-')[1]), cint(start_date.split('-')[2])):
-      begin_date = cstr(current_year)+"-"+cstr(st_mon)+"-"+cstr(st_day)
-    else:
-      msgprint("Please enter appropriate from date.")
-      raise Exception
-    # check whether to date is within fiscal year
-    if datetime.date(next_year, ed_mon, ed_day) >= datetime.date(cint(start_date.split('-')[0]), cint(start_date.split('-')[1]), cint(start_date.split('-')[2])) and datetime.date(cint(next_year), cint(ed_mon), cint(ed_day)) < datetime.date(cint(start_date.split('-')[0])+1, cint(start_date.split('-')[1]), cint(start_date.split('-')[2])):
-      end_date = cstr(next_year)+"-"+cstr(ed_mon)+"-"+cstr(ed_day)
-    else:
-      msgprint("Please enter appropriate to date.")
-      raise Exception
-    ret = begin_date+'~~~'+end_date
-    return ret
-
-  # Get MIS Totals
-  # ---------------
-  def get_totals(self, args):
-    args = eval(args)
-    #msgprint(args)
-    totals = sql("SELECT %s FROM %s WHERE %s %s %s %s" %(cstr(args['query_val']), cstr(args['tables']), cstr(args['company']), cstr(args['cond']), cstr(args['add_cond']), cstr(args['fil_cond'])), as_dict = 1)[0]
-    #msgprint(totals)
-    tot_keys = totals.keys()
-    # return in flt because JSON doesn't accept Decimal
-    for d in tot_keys:
-      totals[d] = flt(totals[d])
-    return totals
-
-  # Get Statement
-  # -------------
-  
-  def get_statement(self, arg): 
-    self.return_data = []    
-
-    # define periods
-    arg = eval(arg)
-    pl = ''
-    
-    self.define_periods(arg['year'], arg['period'])    # declares 1.period_list i.e. (['Jan','Feb','Mar'...] or ['Q1','Q2'...] or ['FY2009-2010']) based on period
-                                                       #          2.period_start_date dict {'Jan':'01-01-2009'...}
-                                                       #          3.period_start_date dict {'Jan':'31-01-2009'...}
-    self.return_data.append([4,'']+self.period_list)
-
-        
-    if arg['statement'] == 'Balance Sheet': pl = 'No'
-    if arg['statement'] == 'Profit & Loss': pl = 'Yes'
-    
-    self.get_children('',0,pl,arg['company'], arg['year'])
-        
-    #self.balance_pl_statement(acct, arg['statement'])
-    #msgprint(self.return_data)
-    return self.return_data
-    
-  # Get Children
-  # ------------
-  def get_children(self, parent_account, level, pl, company, fy):
-    cl = sql("select distinct account_name, name, debit_or_credit, lft, rgt from `tabAccount` where ifnull(parent_account, '') = %s and ifnull(is_pl_account, 'No')=%s and company=%s and docstatus != 2 order by name asc", (parent_account, pl, company))
-    level0_diff = [0 for p in self.period_list]
-    if pl=='Yes' and level==0: # switch for income & expenses
-      cl = [c for c in cl]
-      cl.reverse()
-    if cl:
-      for c in cl:
-        self.ac_details[c[1]] = [c[2], c[3], c[4]]
-        bal_list = self.get_period_balance(c[1], level, pl, company, fy)
-        if level==0: # top level - put balances as totals
-          self.return_data.append([level, c[0]] + ['' for b in bal_list])
-          totals = bal_list
-          for i in range(len(totals)): # make totals
-            if c[2]=='Credit':
-              level0_diff[i] += flt(totals[i])
-            else:
-              level0_diff[i] -= flt(totals[i])
-        else:
-          self.return_data.append([level, c[0]]+bal_list)
-          
-        if level < 2:
-          self.get_children(c[1], level+1, pl, company, fy)
-          
-        # make totals - for top level
-        # ---------------------------
-        if level==0:
-          # add rows for profit / loss in B/S
-          if pl=='No':
-            if c[2]=='Credit':
-              self.return_data.append([1, 'Total Liabilities'] + totals)
-              level0_diff = [-i for i in level0_diff] # convert to debit
-              self.return_data.append([5, 'Profit/Loss (Provisional)'] + level0_diff)
-              for i in range(len(totals)): # make totals
-                level0_diff[i] = flt(totals[i]) + level0_diff[i]
-              self.return_data.append([4, 'Total '+c[0]] + level0_diff)
-            else:
-              self.return_data.append([4, 'Total '+c[0]] + totals)
-
-          # add rows for profit / loss in P/L
-          else:
-            if c[2]=='Debit':
-              self.return_data.append([1, 'Total Expenses (before Profit)'] + totals)
-              self.return_data.append([5, 'Profit/Loss (Provisional)'] + level0_diff)
-              for i in range(len(totals)): # make totals
-                level0_diff[i] = flt(totals[i]) + level0_diff[i]
-              self.return_data.append([4, 'Total '+c[0]] + level0_diff)
-            else:
-              self.return_data.append([4, 'Total '+c[0]] + totals)
-  
-  # Define Periods
-  # --------------
-  
-  def define_periods(self, year, period):
-    
-    # get year start date    
-    ysd = sql("select year_start_date from `tabFiscal Year` where name=%s", year)
-    ysd = ysd and ysd[0][0] or ''
-
-    self.ysd = ysd
-
-    # year
-    if period == 'Annual':
-      pn = 'FY'+year
-      self.period_list.append(pn)
-      self.period_start_date[pn] = ysd
-      self.period_end_date[pn] = get_last_day(get_first_day(ysd,0,11))
-
-    # quarter
-    if period == 'Quarterly':
-      for i in range(4):
-        pn = 'Q'+str(i+1)
-        self.period_list.append(pn)
-      
-        self.period_start_date[pn] = get_first_day(ysd,0,i*3)
-        self.period_end_date[pn] = get_last_day(get_first_day(ysd,0,((i+1)*3)-1))  
-
-    # month
-    if period == 'Monthly':
-      mlist = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
-      for i in range(12):
-        fd = get_first_day(ysd,0,i)
-        pn = mlist[fd.month-1]
-        self.period_list.append(pn)
-      
-        self.period_start_date[pn] = fd
-        self.period_end_date[pn] = get_last_day(fd)
-      
-  # Get Balance For A Period
-  # ------------------------
-  
-  def get_period_balance(self, acc, level, pl, company, fy):
-    debit_or_credit, lft, rgt = self.ac_details[acc]
-    ret = []
-    for p in self.period_list:
-      sd, ed = self.period_start_date[p].strftime('%Y-%m-%d'), self.period_end_date[p].strftime('%Y-%m-%d')
-      cond = "and t1.voucher_type != 'Period Closing Voucher'"
-      if pl=='No':
-        sd = self.ysd.strftime('%Y-%m-%d')
-        cond = ""
-
-      bal = sql("select SUM(t1.debit), SUM(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= '%s' AND t1.posting_date <= '%s' AND t1.company = '%s' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s and ifnull(t1.is_opening,'No') = 'No' and ifnull(t1.is_cancelled, 'No') = 'No' %s" % (sd,ed,company,lft,rgt, cond))
-      
-      
-      bal = bal and (flt(bal[0][0]) - flt(bal[0][1])) or 0
-      if debit_or_credit == 'Credit' and bal:
-        bal = -bal
-      if pl=='No':
-        op = sql("select opening from `tabAccount Balance` where account=%s and period=%s", (acc, fy))
-        op = op and op[0][0] or 0
-        bal += flt(op)
-      
-      ret.append(bal)
-    return ret
-    
-  # Get Dashboard Amounts
-  # ---------------------
-  
-  def get_balance(self, acc, sd, ed, company, fy):
-    a = sql("select account_name, name, debit_or_credit, lft, rgt, is_pl_account from `tabAccount` where account_name=%s and company=%s", (acc, company), as_dict=1)
-    if a:
-      a = a[0]
-      bal = sql("select SUM(IFNULL(t1.debit,0)), SUM(IFNULL(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= %s AND t1.posting_date <= %s AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s and ifnull(is_opening, 'No') = 'No' and ifnull(t1.is_cancelled, 'No') = 'No'", (sd,ed,a['lft'],a['rgt']))
-      if a['debit_or_credit']=='Debit':
-        bal = flt(flt(bal[0][0]) - flt(bal[0][1]))
-      else:
-        bal = flt(flt(bal[0][1]) - flt(bal[0][0]))
-
-      if a['is_pl_account']=='No':
-        op = sql("select opening from `tabAccount Balance` where account=%s and period=%s", (acc, fy))
-        op = op and op[0][0] or 0
-        bal += flt(op)
-
-      return flt(bal)
-
-    else:
-      msgprint("Did not find %s for %s" % (acc, company))
-      return 0
-
-  def get_cur_balance(self, acc, company):
-    bal = sql("select IFNULL(t1.balance,0) from `tabAccount Balance` t1, `tabAccount` t2 where t1.account = %s and t1.period=%s and t1.account = t2.name and t2.company=%s", (acc, self.fiscal_year, company))
-    return bal and flt(bal[0][0]) or 0
-  
-  def get_top_5_cust(self, company):
-    rec_grp = sql("select receivables_group from tabCompany where name=%s", company)
-    if rec_grp:
-      pa_lft_rgt = sql("select lft, rgt from tabAccount where name=%s and company=%s", (rec_grp[0][0], company))[0]
-      return sql("select t1.account_name, SUM(t2.debit) from tabAccount t1, `tabGL Entry` t2 where t1.lft > %s and t1.rgt < %s and t2.account = t1.name  and ifnull(t2.is_cancelled, 'No') = 'No' GROUP BY t1.name ORDER BY SUM(t2.debit) desc limit 5", (pa_lft_rgt[0], pa_lft_rgt[1]))
-    else:
-      return []
-
-  def get_top_5_exp(self, company):
-    a = sql("select distinct account_name, name, debit_or_credit, lft, rgt from `tabAccount` where account_name=%s and company=%s", ('Expenses', company), as_dict=1)[0]
-    return sql("select t1.account_name, SUM(t2.debit) from tabAccount t1, `tabGL Entry` t2 where t1.lft>%s and t1.rgt<%s and t1.group_or_ledger = 'Ledger' and t2.account = t1.name  and ifnull(t2.is_cancelled, 'No') = 'No' and t2.voucher_type != 'Period Closing Voucher' GROUP BY t1.name ORDER BY SUM(t2.debit) desc limit 5", (a['lft'],a['rgt']))
-  
-  def bl(self, acc, company):
-    dt = getdate(nowdate())
-
-    r = []
-    # cur
-    r.append(self.get_cur_balance(acc, company))
-    # this month
-    r.append(self.get_balance(acc, get_first_day(dt), get_last_day(dt), company, self.fiscal_year))
-    # last month
-    r.append(self.get_balance(acc, get_first_day(dt,0,-1), get_last_day(get_first_day(dt,0,-1)), company, self.fiscal_year))
-    return r
-
-  def bl_bs(self, acc, company, sd):
-    dt = getdate(nowdate())
-    r = []
-    # cur
-    r.append(self.get_cur_balance(acc, company))
-    # last month
-    r.append(self.get_balance(acc, sd, get_last_day(get_first_day(dt,0,-1)), company, self.fiscal_year))
-    # opening
-    r.append(self.get_balance(acc, sd, sd, company, self.fiscal_year))
-    return r
-
-  def get_dashboard_values(self, arg=''):
-    d = get_defaults()
-    self.fiscal_year = d['fiscal_year']
-    if arg:
-      company = arg
-    else:
-      company = d['company']
-
-    r = {}
-    r['Income'] = self.bl('Income', company)
-    r['Expenses'] = self.bl('Expenses', company)
-
-    r['Profit'] = []
-    for i in range(3):
-      r['Profit'].append(r['Income'][i] - r['Expenses'][i])
-    
-    r['Current Assets'] = self.bl_bs('Current Assets', company, getdate(d['year_start_date']))
-    r['Current Liabilities'] = self.bl_bs('Current Liabilities', company, getdate(d['year_start_date']))
-    
-    r['Working Capital'] = []
-    for i in range(3):
-      r['Working Capital'].append(r['Current Assets'][i] - r['Current Liabilities'][i])
-
-    r['Bank Accounts'] = self.bl_bs('Bank Accounts', company, getdate(d['year_start_date']))
-    
-    r['Top Customers'] = convert_to_lists(self.get_top_5_cust(company))
-    r['Top Expenses'] = convert_to_lists(self.get_top_5_exp(company))
-    
-    return r
diff --git a/erpnext/analysis/doctype/mis_control/mis_control.txt b/erpnext/analysis/doctype/mis_control/mis_control.txt
deleted file mode 100644
index 3149cde..0000000
--- a/erpnext/analysis/doctype/mis_control/mis_control.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-# DocType, MIS Control
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:10',
-		'docstatus': 0,
-		'modified': '2011-01-03 17:32:31',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'issingle': 1,
-		'module': 'Analysis',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 120
-	},
-
-	# DocType, MIS Control
-	{
-		'doctype': 'DocType',
-		'name': 'MIS Control'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/analysis/doctype/ta_control/__init__.py b/erpnext/analysis/doctype/ta_control/__init__.py
deleted file mode 100755
index e69de29..0000000
--- a/erpnext/analysis/doctype/ta_control/__init__.py
+++ /dev/null
diff --git a/erpnext/analysis/doctype/ta_control/ta_control.py b/erpnext/analysis/doctype/ta_control/ta_control.py
deleted file mode 100755
index f06394c..0000000
--- a/erpnext/analysis/doctype/ta_control/ta_control.py
+++ /dev/null
@@ -1,123 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-	
-# -----------------------------------------------------------------------------------------
-
-class DocType:
-        def __init__(self, d, dl):
-                self.doc, self.doclist = d, dl
-
-
-        # Define Globals
-        # ---------------
-        def define_globals(self, trans, fiscal_year):
-                self.month_name = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
-
-                if trans == 'Purchase Receipt' or trans == 'Delivery Note' or trans == 'Payable Voucher' or trans == 'Receivable Voucher':
-                        self.trans_date = 'posting_date'
-                else:
-                        self.trans_date = 'transaction_date'
-                
-                ysd = sql("select year_start_date from `tabFiscal Year` where name = %s",fiscal_year)[0][0]
-                self.year_start_date = ysd.strftime('%Y-%m-%d')
-                self.start_month = cint(self.year_start_date.split('-')[1])
-
-
-        # Get Column Names and Query for Annual Trend
-        # ---------------------------------------------
-        def get_annual_trend_details(self, fiscal_year):
-                col_names = [fiscal_year+' (Qty)', fiscal_year+' (Amt)']
-                query_val = 'SUM(t2.qty) ,SUM(t2.amount),'
-                return col_names, query_val
-
-
-        # Get Column Names and Query for Half Yearly Trend
-        # --------------------------------------------------
-        def get_half_yearly_trend_details(self):
-                first_half_start = self.year_start_date
-                first_half_end = add_days(add_months(first_half_start,6),-1)
-                second_half_start = add_days(first_half_end,1)
-                second_half_end = add_days(add_months(second_half_start,6),-1)
-                
-                col_names = ['First Half (Qty)', 'First Half (Amt)', 'Second Half (Qty)', 'Second Half (Amt)']
-               
-                query_val = 'SUM(CASE WHEN t1.'+self.trans_date+' BETWEEN "'+first_half_start+'" AND "'+first_half_end+'" THEN t2.qty ELSE NULL END), SUM(CASE WHEN t1.'+self.trans_date+' BETWEEN "'+first_half_start+'" AND "'+first_half_end+'" THEN t2.amount ELSE NULL END), SUM(CASE WHEN t1.'+self.trans_date+' BETWEEN "'+second_half_start+'" AND "'+second_half_end+'" THEN t2.qty ELSE NULL END), SUM(CASE WHEN t1.'+self.trans_date+' BETWEEN "'+second_half_start+'" AND "'+second_half_end+'" THEN t2.amount ELSE NULL END),'
-
-                return col_names, query_val
-
-
-        # Get Column Names and Query for Quarterly Trend
-        # ------------------------------------------------
-        def get_quarterly_trend_details(self):
-                first_qsd, second_qsd, third_qsd, fourth_qsd = self.year_start_date, add_months(self.year_start_date,3), add_months(self.year_start_date,6), add_months(self.year_start_date,9)
-
-                first_qed, second_qed, third_qed, fourth_qed = add_days(add_months(first_qsd,3),-1), add_days(add_months(second_qsd,3),-1), add_days(add_months(third_qsd,3),-1), add_days(add_months(fourth_qsd,3),-1)
-
-                col_names = ['Q1 (Qty)','Q1 (Amt)','Q2 (Qty)','Q2 (Amt)','Q3 (Qty)','Q3 (Amt)','Q4 (Qty)','Q4 (Amt)']
-                query_val = ''
-                bet_dates = [[first_qsd,first_qed],[second_qsd,second_qed],[third_qsd,third_qed],[fourth_qsd,fourth_qed]]
-
-                for d in bet_dates:
-                        query_val += 'SUM(CASE WHEN t1.'+self.trans_date+' BETWEEN "'+d[0]+'" AND "'+d[1]+'" THEN t2.qty ELSE NULL END), SUM(CASE WHEN t1.'+self.trans_date+' BETWEEN "'+d[0]+'" AND "'+d[1]+'" THEN t2.amount ELSE NULL END),'
-                
-                return col_names, query_val
-
-
-        # Get Column Names and Query for Monthly Trend
-        # -----------------------------------------------
-        def get_monthly_trend_details(self):
-                col_names, query_val = [], ''
-                for i in range(self.start_month-1, len(self.month_name)):
-                        col_names.append(self.month_name[i]+' (Qty)')
-                        col_names.append(self.month_name[i]+' (Amt)')
-                        query_val += 'SUM(CASE WHEN MONTH(t1.'+self.trans_date+') = '+cstr(i+1)+' THEN t2.qty ELSE NULL END), SUM(CASE WHEN MONTH(t1.'+self.trans_date+') = '+cstr(i+1)+' THEN t2.amount ELSE NULL END),'
-
-                for i in range(0, self.start_month-1):
-                        col_names.append(self.month_name[i]+' (Qty)')
-                        col_names.append(self.month_name[i]+' (Amt)')
-                        query_val += 'SUM(CASE WHEN MONTH(t1.'+self.trans_date+') = '+cstr(i+1)+' THEN t2.qty ELSE NULL END), SUM(CASE WHEN MONTH(t1.'+self.trans_date+') = '+cstr(i+1)+' THEN t2.amount ELSE NULL END),'
-                
-                return col_names, query_val
-
-
-        # Get Single Year Trend's Query and Columns
-        # -------------------------------------------
-        def get_single_year_query_value(self, fiscal_year, period, trans, trans_det):
-                self.define_globals(trans, fiscal_year)
-                if period == 'Annual':
-                        return self.get_annual_trend_details(fiscal_year)
-                elif period == 'Half Yearly':
-                        return self.get_half_yearly_trend_details()
-                elif period == 'Quarterly':
-                        return self.get_quarterly_trend_details()
-                elif period == 'Monthly':
-                        return self.get_monthly_trend_details()
diff --git a/erpnext/analysis/doctype/ta_control/ta_control.txt b/erpnext/analysis/doctype/ta_control/ta_control.txt
deleted file mode 100755
index d0b03d4..0000000
--- a/erpnext/analysis/doctype/ta_control/ta_control.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-# DocType, TA Control
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-11-09 09:35:22',
-		'docstatus': 0,
-		'modified': '2010-12-02 18:00:30',
-		'modified_by': 'Administrator',
-		'owner': 'saumil@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'in_create': 1,
-		'issingle': 1,
-		'module': 'Analysis',
-		'name': '__common__',
-		'read_only': 1,
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'version': 11
-	},
-
-	# DocType, TA Control
-	{
-		'doctype': 'DocType',
-		'name': 'TA Control'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/analysis/page/__init__.py b/erpnext/analysis/page/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/analysis/page/__init__.py
+++ /dev/null
diff --git a/erpnext/analysis/search_criteria/__init__.py b/erpnext/analysis/search_criteria/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/analysis/search_criteria/__init__.py
+++ /dev/null
diff --git a/erpnext/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.txt b/erpnext/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.txt
deleted file mode 100644
index 19a5866..0000000
--- a/erpnext/analysis/search_criteria/monthly_transaction_summary/monthly_transaction_summary.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-# Search Criteria, monthly_transaction_summary
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-09-20 13:00:43',
-		'docstatus': 0,
-		'modified': '2010-09-17 16:02:25',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'Profile\x01ID',
-		'criteria_name': 'Monthly Transaction Summary',
-		'doc_type': 'Profile',
-		'doctype': 'Search Criteria',
-		'filters': "{'DocType\x01Period':'Monthly'}",
-		'module': 'Analysis',
-		'name': '__common__',
-		'sort_by': '`tabProfile`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, monthly_transaction_summary
-	{
-		'doctype': 'Search Criteria',
-		'name': 'monthly_transaction_summary'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/analysis/search_criteria/trend_analyzer/trend_analyzer.js b/erpnext/analysis/search_criteria/trend_analyzer/trend_analyzer.js
deleted file mode 100644
index a25215c..0000000
--- a/erpnext/analysis/search_criteria/trend_analyzer/trend_analyzer.js
+++ /dev/null
@@ -1,148 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-  this.hide_all_filters();
-
-  this.add_filter({fieldname:'transaction', label:'Transaction', fieldtype:'Select', options:'Quotation'+NEWLINE+'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice'+NEWLINE+'Purchase Order'+NEWLINE+'Purchase Receipt'+NEWLINE+'Purchase Invoice',report_default:'Delivery Note',ignore : 1,parent:'Profile',in_first_page : 1,single_select : 1});
-
-  this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Profile',in_first_page:1,single_select:1});
-
-  this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Item'+NEWLINE+'Item Group'+NEWLINE+'Customer'+NEWLINE+'Customer Group'+NEWLINE+'Territory'+NEWLINE+'Supplier'+NEWLINE+'Supplier Type'+NEWLINE+'Project', ignore : 1, parent:'Profile', report_default:'Item', in_first_page : 1,single_select:1});
-
-  this.add_filter({fieldname:'group_by', label:'Group By', fieldtype:'Select', options:NEWLINE+'Item'+NEWLINE+'Customer'+NEWLINE+'Supplier', ignore : 1, parent:'Profile',single_select:1});
-
-  this.add_filter({fieldname:'order_type', label:'Order Type', fieldtype:'Select', options:NEWLINE+'Sales'+NEWLINE+'Maintenance',ignore : 1, parent:'Profile',single_select:1});
-
-  this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', report_default:sys_defaults.company, ignore : 1, parent:'Profile'});
-
-  this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Profile', in_first_page:1});
-
-
-  // Add Filters
-  this.add_filter({fieldname:'item', label:'Item', fieldtype:'Link', options:'Item', ignore : 1, parent:'Profile'});
-  this.add_filter({fieldname:'item_group', label:'Item Group', fieldtype:'Link', options:'Item Group', ignore : 1, parent:'Profile'});
-  this.add_filter({fieldname:'customer', label:'Customer', fieldtype:'Link', options:'Customer', ignore : 1, parent:'Profile'});
-  this.add_filter({fieldname:'customer_group', label:'Customer Group', fieldtype:'Link', options:'Customer Group', ignore : 1, parent:'Profile'});
-  this.add_filter({fieldname:'territory', label:'Territory', fieldtype:'Link', options:'Territory', ignore : 1, parent:'Profile'});
-  this.add_filter({fieldname:'supplier', label:'Supplier', fieldtype:'Link', options:'Supplier', ignore : 1, parent:'Profile'});
-  this.add_filter({fieldname:'supplier_type', label:'Supplier Type', fieldtype:'Link', options:'Supplier Type', ignore : 1, parent:'Profile'});
-  this.add_filter({fieldname:'project', label:'Project', fieldtype:'Link', options:'Project', ignore : 1, parent:'Profile'});
-}
-
-
-this.mytabs.tabs['Select Columns'].hide();
-
-report.aftertableprint = function(t) {
-   $yt(t,'*',1,{whiteSpace:'pre'});
-}
-
-var validate_values = function(trans,based_on,order_type) {
-  if(!fiscal_year){
-    msgprint("Please select Fiscal Year");
-    return 0;
-  }
-  if((in_list(['Quotation','Sales Order','Delivery Note','Sales Invoice'],trans) && in_list(['Supplier','Supplier Type'],based_on)) || (in_list(['Purchase Order','Purchase Receipt','Purchase Invoice'],trans) && in_list(['Customer','Customer Group','Territory'],based_on))){
-    msgprint("Sorry! You cannot fetch "+trans+" trend based on "+based_on);
-    return 0;
-  }
-  if(in_list(['Purchase Order','Purchase Receipt','Purchase Invoice'],trans) && order_type){
-    msgprint("Please deselect Order Type for "+trans);
-    return 0;
-  }
-  return 1;
-}
-
-
-report.get_query = function() {
-  trans = this.get_filter('Profile', 'Transaction').get_value();
-  order_type = this.get_filter('Profile', 'Order Type').get_value();
-  based_on = this.get_filter('Profile', 'Based On').get_value();
-  company = this.get_filter('Profile', 'Company').get_value();
-  fiscal_year = this.get_filter('Profile', 'Fiscal Year').get_value();
-
-  if(validate_values(trans,based_on,order_type)){
-    col = '';
-    add_cond = '';
-    add_col = '';
-    add_tables = '';
-    sp_cond = '';
-    if(trans == 'Sales Invoice') trans = 'Receivable Voucher';
-    else if(trans == 'Purchase Invoice') trans = 'Payable Voucher';
-
-    trans_det = trans+' Detail'
-
-    if(trans == 'Receivable Voucher') trans_det = 'RV Detail';
-    else if(trans == 'Payable Voucher') trans_det = 'PV Detail';
-    else if(trans == 'Purchase Order') trans_det = 'PO Detail';
-
-    if(order_type != '') add_code += ' AND t1.order_type = '+order_type;
-
-    switch(based_on){
-      case 'Item'           :     item = this.get_filter('Profile', 'Item').get_value();
-                                  col = 'DISTINCT t2.item_code, t3.item_name';
-                                  add_tables = ',tabItem t3';
-                                  add_cond += ' AND t2.item_code = t3.name';
-                                  if(item) add_cond += ' AND t2.item_code = "'+item+'"';
-                                  break;
-      case 'Customer'       :     cust = this.get_filter('Profile', 'Customer').get_value();
-                                  col = 'DISTINCT t1.customer, t3.territory';
-                                  add_tables = ',tabCustomer t3';
-                                  add_cond += ' AND t1.customer = t3.name';
-                                  if(cust) add_cond += ' AND t1.customer = "'+cust+'"';
-                                  break;
-      case 'Supplier'      :      supp = this.get_filter('Profile', 'Supplier').get_value();
-                                  col = 'DISTINCT t1.supplier, t3.supplier_type';
-                                  add_tables = ',tabSupplier t3';
-                                  add_cond += ' AND t1.supplier = t3.name';
-                                  if(supp) add_cond += ' AND t1.supplier = "'+supp+'"';
-                                  break;
-      case 'Supplier Type'  :     supp_type = this.get_filter('Profile', 'Supplier Type').get_value();
-                                  col = 'DISTINCT t3.supplier_type';
-                                  add_tables = ',tabSupplier t3';
-                                  add_cond += ' AND t1.supplier = t3.name';
-                                  if(supp_type) add_cond += ' AND t1.supplier_type = "'+supp_type+'"';
-                                  break;
-      case 'Project'        :     pro = this.get_filter('Profile', 'Project').get_value();
-      							  if (inList(['Purchase Order', 'Purchase Receipt', 'Payable Voucher'], trans)) {
-									  col = 'DISTINCT t2.project_name';
-    	                              if(pro) add_cond += ' AND t2.project_name = "'+pro+'"';
-    	                          } else {
-	    	                          col = 'DISTINCT t1.project_name';
-    	                              if(pro) add_cond += ' AND t1.project_name = "'+pro+'"';
-    	                          }
-                                  break;
-      case 'Item Group'     :     ig = this.get_filter('Profile', 'Item Group').get_value();
-                                  if(ig) sp_cond += ' AND parent.name = "'+ig+'"';
-                                  break;
-      case 'Customer Group' :     cg = this.get_filter('Profile', 'Customer Group').get_value();
-                                  if(cg) sp_cond += ' AND parent.name = "'+cg+'"';
-                                  break;
-      case 'Territory'      :     ter = this.get_filter('Profile', 'Territory').get_value();
-                                  if(ter) sp_cond += ' AND parent.name = "'+ter+'"';
-                                  break;
-
-    }
-
-    
-    if(based_on == 'Item' || based_on == 'Customer' || based_on == 'Supplier' || based_on == 'Supplier Type' || based_on == 'Project')
-      var q ='SELECT '+col+' FROM `tab'+trans+'` t1, `tab'+trans_det+'` t2 '+add_tables+' WHERE t1.fiscal_year = "'+fiscal_year+'" and t1.company = "'+company+'" and t2.parent = t1.name '+add_cond;
-    else
-      var q = 'SELECT CONCAT(REPEAT("     ", COUNT(parent.name) - 1), node.name) AS "Name" FROM `tab'+based_on+'` node,`tab'+based_on+'` parent WHERE node.lft BETWEEN parent.lft and parent.rgt and node.docstatus !=2 '+sp_cond+' GROUP BY node.name ORDER BY node.lft';
-   
-    return q;
-  }
-}
diff --git a/erpnext/analysis/search_criteria/trend_analyzer/trend_analyzer.py b/erpnext/analysis/search_criteria/trend_analyzer/trend_analyzer.py
deleted file mode 100644
index 2198204..0000000
--- a/erpnext/analysis/search_criteria/trend_analyzer/trend_analyzer.py
+++ /dev/null
@@ -1,182 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# ********************************************* INITIALIZATION *******************************************
-out = []
-
-# Filter Values
-# =============================================
-based_on = filter_values.get('based_on')
-group_by = filter_values.get('group_by')
-trans = filter_values.get('transaction')
-period = filter_values.get('period')
-order_type = filter_values.get('order_type')
-company = filter_values.get('company')
-fiscal_year = filter_values.get('fiscal_year')
-item = filter_values.get('item')
-item_group = filter_values.get('item_group')
-customer = filter_values.get('customer')
-customer_group = filter_values.get('customer_group')
-territory = filter_values.get('territory')
-supplier = filter_values.get('supplier')
-supplier_type = filter_values.get('supplier_type')
-project = filter_values.get('project')
-
-
-# ********************************************* SET DEFAULTS **************************************************
-# Details Table
-# --------------
-if trans == 'Sales Invoice': trans = 'Receivable Voucher'
-elif trans == 'Purchase Invoice': trans = 'Payable Voucher'
-
-trans_det = trans+' Detail'
-
-if trans == 'Receivable Voucher': trans_det = 'RV Detail'
-elif trans == 'Payable Voucher': trans_det = 'PV Detail'
-elif trans == 'Purchase Order': trans_det = 'PO Detail'
-
-col_names, query_val = get_obj('TA Control').get_single_year_query_value(fiscal_year, period, trans, trans_det)
-query_val += 'SUM(t2.qty), SUM(t2.amount)'
-
-col_names.append('Total (Qty)')
-col_names.append('Total (Amt)')
-
-
-# ********************************************* VALIDATIONS ***************************************************
-if (based_on in ['Customer','Customer Group','Territory'] and group_by == 'Supplier') or (based_on in ['Supplier','Supplier Type'] and group_by == 'Customer'):
-	msgprint("Sorry! You cannot group Trend Analyzer based on %s by %s" % (based_on,group_by))
-	raise Exception
-
-if based_on == group_by:
-	msgprint("Based On and Group By value cannot be same for Trend Analyzer")
-	raise Exception
-
-
-# ********************************************** ADD COLUMNS **********************************************
-cols = [[based_on, 'Data', '300px', '']]
-cr = 1
-if based_on == 'Item':
-	cols.append(['Item Name','Data','200px',''])
-	cr = 2
-elif based_on == 'Customer':
-	cols.append(['Territory','Link','150px','Territory'])
-	cr = 2
-elif based_on == 'Supplier':
-	cols.append(['Supplier Type','Link','150px','Supplier Type'])
-	cr = 2
-if group_by:
-	cr += 1
-
-if group_by:
-	cols.append([group_by,'Data','150px',''])
-
-for c in col_names:
-	cols.append([c,'Currency','150px',''])
-
-for c in cols:
-	colnames.append(c[0])
-	coltypes.append(c[1])
-	colwidths.append(c[2])
-	coloptions.append(c[3])
-	col_idx[c[0]] = len(colnames)-1
-
-
-# ******************************************* ADDITIONAL CONDITION ************************************************
-add_cond = ' t2.parent = t1.name AND t1.company = "%s" AND t1.fiscal_year = "%s" and t1.docstatus = 1' % (company, fiscal_year)
-add_tab = ' `tab'+trans+'` t1, `tab'+trans_det+'` t2'
-if order_type: add_cond += ' AND t1.order_type = "%s"' % order_type
-
-
-# Item
-if item or based_on == 'Item':
-	add_cond += ' AND t2.item_code = "%s"' % (based_on != 'Item' and item or '%(value)s')
-
-# Item Group
-if item_group or based_on == 'Item Group':
-	add_tab += ' ,`tabItem` t3, `tabItem Group` t4 '
-	add_cond += ' AND t3.name = t2.item_code AND t3.item_group = t4.name and (t4.name = "%s" or t4.name IN (SELECT t5.name FROM `tabItem Group` t5,`tabItem Group` t6 WHERE t5.lft BETWEEN t6.lft and t6.rgt and t5.docstatus !=2 and t6.name = "%s"))' % (based_on != 'Item Group' and item_group or '%(value)s', based_on != 'Item Group' and item_group or '%(value)s')
-
-# Customer
-if customer or based_on == 'Customer':
-	add_cond += ' AND t1.customer = "%s"' % (based_on != 'Customer' and customer or '%(value)s')
-
-# Customer Group
-if customer_group or based_on == 'Customer Group':
-	add_tab += ' ,`tabCustomer` t7, `tabCustomer Group` t8 '
-	add_cond += ' AND t7.name = t1.customer AND t7.customer_group = t8.name and (t8.name = "%s" or t8.name IN (SELECT t9.name FROM `tabCustomer Group` t9,`tabCustomer Group` t10 WHERE t9.lft BETWEEN t10.lft and t10.rgt and t9.docstatus !=2 and ifnull(t9.is_group,"No") = "No" and t10.name = "%s"))' % (based_on != 'Customer Group'	and customer_group or '%(value)s', based_on != 'Customer Group'	and customer_group or '%(value)s')
-	
-# Territory
-if territory or based_on == 'Territory':
-	add_tab += ' ,`tabTerritory` t11 '
-	add_cond += ' AND t1.territory = t11.name and (t11.name = "%s" or t11.name IN (SELECT t12.name FROM `tabTerritory` t12,`tabTerritory` t13 WHERE t12.lft BETWEEN t13.lft and t13.rgt and t12.docstatus !=2 and ifnull(t12.is_group,"No") = "No" and t13.name = "%s"))' % (based_on != 'Territory' and territory or '%(value)s', based_on != 'Territory' and territory or '%(value)s')
-
-# Supplier
-if supplier or based_on == 'Supplier':
-	add_cond += ' AND t1.supplier = "%s"' % (based_on != 'Supplier' and supplier or '%(value)s')
-	
-# Supplier Type
-if supplier_type or based_on == 'Supplier Type':
-	add_tab += ' ,`tabSupplier` t14, `tabSupplier Type` t15 '
-	add_cond += ' AND t14.name = t1.supplier AND t14.supplier_type = t15.name and t15.name = "%s"' % (based_on != 'Supplier Type' and supplier_type or '%(value)s')
-
-# Project
-if project or based_on == 'Project':
-	if trans in ['Purchase Order', 'Purchase Receipt', 'Payable Voucher']:
-		add_cond += ' AND t2.project_name = "%s"' % (based_on != 'Project' and project or '%(value)s')
-	else:
-		add_cond += ' AND t1.project_name = "%s"' % (based_on != 'Project' and project or '%(value)s')
-	
-# Column to be seleted for group by condition
-# ==============================================
-sel_col = ''
-if group_by == 'Item':
-	sel_col = 't2.item_code'
-elif group_by == 'Customer':
-	sel_col = 't1.customer'
-elif group_by == 'Supplier':
-	sel_col = 't1.supplier'
-	
-	
-# ********************************************** Result Set ************************************************
-for r in res:
-	main_det = sql("SELECT %s FROM %s WHERE %s" % (query_val, add_tab, add_cond % {'value':cstr(r[col_idx[based_on]]).strip()}))
-	if group_by:
-		for col in range(cr,cr+1): # this would make all first row blank. just for look
-			r.append('')
-	if main_det[0][len(colnames) - cr - 1]:
-		for d in range(len(colnames) - cr):
-			r.append(flt(main_det[0][d]))
-		out.append(r)
-		
-		if group_by:
-			flag = 1
-			# check for root nodes
-			if based_on in ['Item Group','Customer Group','Territory']:
-				is_grp = sql("select is_group from `tab%s` where name = '%s'" % (based_on, cstr(r[col_idx[based_on]]).strip()))
-				is_grp = is_grp and cstr(is_grp[0][0]) or ''
-				if is_grp != 'No':
-					flag = 0
-
-			if flag == 1:	
-				det = [x[0] for x in sql("SELECT DISTINCT %s FROM %s where %s" % (sel_col, add_tab, add_cond % {'value':cstr(r[col_idx[based_on]]).strip()}))]
-
-				for des in range(len(det)):
-					t_row = ['' for i in range(len(colnames))]
-					t_row[col_idx[group_by]] = cstr(det[des])
-					gr_det = sql("SELECT %s FROM %s WHERE %s = '%s' and %s" % (query_val, add_tab, sel_col, cstr(det[des]), add_cond % {'value':cstr(r[col_idx[based_on]]).strip()}))
-					for d in range(len(col_names)):
-						t_row[col_idx[col_names[d]]] = flt(gr_det[0][d])
-					out.append(t_row)
diff --git a/erpnext/analysis/search_criteria/trend_analyzer/trend_analyzer.txt b/erpnext/analysis/search_criteria/trend_analyzer/trend_analyzer.txt
deleted file mode 100644
index a099c97..0000000
--- a/erpnext/analysis/search_criteria/trend_analyzer/trend_analyzer.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# Search Criteria, trend_analyzer
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-12-14 10:23:18',
-		'docstatus': 0,
-		'modified': '2010-11-10 11:06:06',
-		'modified_by': 'Administrator',
-		'owner': 'saumil@webnotestech.com'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'Profile\x01ID,Profile\x01Owner',
-		'criteria_name': 'Trend Analyzer',
-		'doc_type': 'Profile',
-		'doctype': 'Search Criteria',
-		'filters': '{}',
-		'module': 'Analysis',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabProfile`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, trend_analyzer
-	{
-		'doctype': 'Search Criteria',
-		'name': 'trend_analyzer'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.txt b/erpnext/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.txt
deleted file mode 100644
index 2f55a1f..0000000
--- a/erpnext/analysis/search_criteria/yearly_transaction_summary/yearly_transaction_summary.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-# Search Criteria, yearly_transaction_summary
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-09-20 13:00:43',
-		'docstatus': 0,
-		'modified': '2010-09-17 16:03:04',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'Profile\x01ID',
-		'criteria_name': 'Yearly Transaction Summary',
-		'doc_type': 'Profile',
-		'doctype': 'Search Criteria',
-		'filters': "{'DocType\x01Fiscal Year':'2009-2010','DocType\x01Company':'Alpha Company','DocType\x01Period':'Monthly'}",
-		'module': 'Analysis',
-		'name': '__common__',
-		'sort_by': '`tabProfile`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, yearly_transaction_summary
-	{
-		'doctype': 'Search Criteria',
-		'name': 'yearly_transaction_summary'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/DocType Label/Indent/Indent.txt b/erpnext/buying/DocType Label/Indent/Indent.txt
deleted file mode 100644
index 4ff4724..0000000
--- a/erpnext/buying/DocType Label/Indent/Indent.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# DocType Label, Indent
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-01-10 15:33:53',
-		'docstatus': 0,
-		'modified': '2012-01-10 15:33:53',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType Label
-	{
-		'doctype': 'DocType Label',
-		'dt': 'Indent',
-		'dt_label': 'Purchase Requisition',
-		'name': '__common__'
-	},
-
-	# DocType Label, Indent
-	{
-		'doctype': 'DocType Label',
-		'name': 'Indent'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/DocType Mapper/Indent-Purchase Order/Indent-Purchase Order.txt b/erpnext/buying/DocType Mapper/Indent-Purchase Order/Indent-Purchase Order.txt
deleted file mode 100644
index fa9ab06..0000000
--- a/erpnext/buying/DocType Mapper/Indent-Purchase Order/Indent-Purchase Order.txt
+++ /dev/null
@@ -1,142 +0,0 @@
-# DocType Mapper, Indent-Purchase Order
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:34',
-		'docstatus': 0,
-		'modified': '2012-02-14 15:21:20',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all Table Mapper Detail
-	{
-		'doctype': u'Table Mapper Detail',
-		'name': '__common__',
-		'parent': u'Indent-Purchase Order',
-		'parentfield': u'table_mapper_details',
-		'parenttype': u'DocType Mapper'
-	},
-
-	# These values are common for all Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'map': u'Yes',
-		'name': '__common__',
-		'parent': u'Indent-Purchase Order',
-		'parentfield': u'field_mapper_details',
-		'parenttype': u'DocType Mapper'
-	},
-
-	# These values are common for all DocType Mapper
-	{
-		'doctype': u'DocType Mapper',
-		'from_doctype': u'Indent',
-		'module': u'Buying',
-		'name': '__common__',
-		'ref_doc_submitted': 1,
-		'to_doctype': u'Purchase Order'
-	},
-
-	# DocType Mapper, Indent-Purchase Order
-	{
-		'doctype': u'DocType Mapper',
-		'name': u'Indent-Purchase Order'
-	},
-
-	# Field Mapper Detail
-	{
-		'checking_operator': u'=',
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'company',
-		'match_id': 0,
-		'to_field': u'company'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'parenttype',
-		'match_id': 1,
-		'to_field': u'prevdoc_doctype'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'parent',
-		'match_id': 1,
-		'to_field': u'prevdoc_docname'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'name',
-		'match_id': 1,
-		'to_field': u'prevdoc_detail_docname'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'uom',
-		'match_id': 1,
-		'to_field': u'stock_uom'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'eval:flt(1)',
-		'match_id': 1,
-		'to_field': u'conversion_factor'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'eval:flt(obj.qty) - flt(obj.ordered_qty)',
-		'match_id': 1,
-		'to_field': u'stock_qty'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'eval:flt(obj.qty) - flt(obj.ordered_qty)',
-		'match_id': 1,
-		'to_field': u'qty'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': u'Field Mapper Detail',
-		'from_field': u'schedule_date',
-		'match_id': 1,
-		'to_field': u'schedule_date'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': u'Table Mapper Detail',
-		'from_table': u'Indent',
-		'match_id': 0,
-		'reference_key': u'prevdoc_docname',
-		'to_table': u'Purchase Order',
-		'validation_logic': u'docstatus = 1'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': u'Table Mapper Detail',
-		'from_field': u'indent_details',
-		'from_table': u'Indent Detail',
-		'match_id': 1,
-		'reference_doctype_key': u'prevdoc_doctype',
-		'to_field': u'po_details',
-		'to_table': u'PO Detail',
-		'validation_logic': u'qty > ifnull(ordered_qty,0) and docstatus =1'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/DocType Mapper/Purchase Request-Purchase Order/Purchase Request-Purchase Order.txt b/erpnext/buying/DocType Mapper/Purchase Request-Purchase Order/Purchase Request-Purchase Order.txt
new file mode 100644
index 0000000..befcb8c
--- /dev/null
+++ b/erpnext/buying/DocType Mapper/Purchase Request-Purchase Order/Purchase Request-Purchase Order.txt
@@ -0,0 +1,142 @@
+# DocType Mapper, Purchase Request-Purchase Order
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'modified': '2012-04-03 12:49:50',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'name': '__common__',
+		'parent': u'Purchase Request-Purchase Order',
+		'parentfield': u'table_mapper_details',
+		'parenttype': u'DocType Mapper'
+	},
+
+	# These values are common for all Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'map': u'Yes',
+		'name': '__common__',
+		'parent': u'Purchase Request-Purchase Order',
+		'parentfield': u'field_mapper_details',
+		'parenttype': u'DocType Mapper'
+	},
+
+	# These values are common for all DocType Mapper
+	{
+		'doctype': u'DocType Mapper',
+		'from_doctype': u'Purchase Request',
+		'module': u'Buying',
+		'name': '__common__',
+		'ref_doc_submitted': 1,
+		'to_doctype': u'Purchase Order'
+	},
+
+	# DocType Mapper, Purchase Request-Purchase Order
+	{
+		'doctype': u'DocType Mapper',
+		'name': u'Purchase Request-Purchase Order'
+	},
+
+	# Field Mapper Detail
+	{
+		'checking_operator': u'=',
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'company',
+		'match_id': 0,
+		'to_field': u'company'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'parenttype',
+		'match_id': 1,
+		'to_field': u'prevdoc_doctype'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'parent',
+		'match_id': 1,
+		'to_field': u'prevdoc_docname'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'name',
+		'match_id': 1,
+		'to_field': u'prevdoc_detail_docname'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'uom',
+		'match_id': 1,
+		'to_field': u'stock_uom'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'eval:flt(1)',
+		'match_id': 1,
+		'to_field': u'conversion_factor'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'eval:flt(obj.qty) - flt(obj.ordered_qty)',
+		'match_id': 1,
+		'to_field': u'stock_qty'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'eval:flt(obj.qty) - flt(obj.ordered_qty)',
+		'match_id': 1,
+		'to_field': u'qty'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'schedule_date',
+		'match_id': 1,
+		'to_field': u'schedule_date'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_table': u'Purchase Request',
+		'match_id': 0,
+		'reference_key': u'prevdoc_docname',
+		'to_table': u'Purchase Order',
+		'validation_logic': u'docstatus = 1'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'indent_details',
+		'from_table': u'Purchase Request Item',
+		'match_id': 1,
+		'reference_doctype_key': u'prevdoc_doctype',
+		'to_field': u'po_details',
+		'to_table': u'Purchase Order Item',
+		'validation_logic': u'qty > ifnull(ordered_qty,0) and docstatus =1'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/buying/DocType Mapper/Sales Order-Indent/Sales Order-Indent.txt b/erpnext/buying/DocType Mapper/Sales Order-Indent/Sales Order-Indent.txt
deleted file mode 100755
index b4dafc9..0000000
--- a/erpnext/buying/DocType Mapper/Sales Order-Indent/Sales Order-Indent.txt
+++ /dev/null
@@ -1,116 +0,0 @@
-# DocType Mapper, Sales Order-Indent
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-05-20 10:07:55',
-		'docstatus': 0,
-		'modified': '2011-09-14 12:36:25',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'name': '__common__',
-		'parent': 'Sales Order-Indent',
-		'parentfield': 'table_mapper_details',
-		'parenttype': 'DocType Mapper'
-	},
-
-	# These values are common for all Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'name': '__common__',
-		'parent': 'Sales Order-Indent',
-		'parentfield': 'field_mapper_details',
-		'parenttype': 'DocType Mapper'
-	},
-
-	# These values are common for all DocType Mapper
-	{
-		'doctype': 'DocType Mapper',
-		'from_doctype': 'Sales Order',
-		'module': 'Buying',
-		'name': '__common__',
-		'ref_doc_submitted': 1,
-		'to_doctype': 'Indent'
-	},
-
-	# DocType Mapper, Sales Order-Indent
-	{
-		'doctype': 'DocType Mapper',
-		'name': 'Sales Order-Indent'
-	},
-
-	# Field Mapper Detail
-	{
-		'checking_operator': '>=',
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'transaction_date',
-		'map': 'No',
-		'match_id': 0,
-		'to_field': 'transaction_date'
-	},
-
-	# Field Mapper Detail
-	{
-		'checking_operator': '=',
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'company',
-		'map': 'Yes',
-		'match_id': 0,
-		'to_field': 'company'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'parent',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'sales_order_no'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'stock_uom',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'uom'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'reserved_warehouse',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'warehouse'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_field': 'sales_order_details',
-		'from_table': 'Sales Order Detail',
-		'match_id': 1,
-		'reference_doctype_key': 'prevdoc_doctype',
-		'reference_key': 'prevdoc_detail_docname',
-		'to_field': 'indent_details',
-		'to_table': 'Indent Detail',
-		'validation_logic': 'docstatus=1'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_table': 'Sales Order',
-		'match_id': 0,
-		'reference_key': 'prevdoc_docname',
-		'to_table': 'Indent',
-		'validation_logic': 'docstatus = 1'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/DocType Mapper/Sales Order-Purchase Request/Sales Order-Purchase Request.txt b/erpnext/buying/DocType Mapper/Sales Order-Purchase Request/Sales Order-Purchase Request.txt
new file mode 100755
index 0000000..6dc79e6
--- /dev/null
+++ b/erpnext/buying/DocType Mapper/Sales Order-Purchase Request/Sales Order-Purchase Request.txt
@@ -0,0 +1,116 @@
+# DocType Mapper, Sales Order-Purchase Request
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2011-05-20 10:07:55',
+		'docstatus': 0,
+		'modified': '2012-04-03 12:49:50',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'name': '__common__',
+		'parent': u'Sales Order-Purchase Request',
+		'parentfield': u'table_mapper_details',
+		'parenttype': u'DocType Mapper'
+	},
+
+	# These values are common for all Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'name': '__common__',
+		'parent': u'Sales Order-Purchase Request',
+		'parentfield': u'field_mapper_details',
+		'parenttype': u'DocType Mapper'
+	},
+
+	# These values are common for all DocType Mapper
+	{
+		'doctype': 'DocType Mapper',
+		'from_doctype': u'Sales Order',
+		'module': u'Buying',
+		'name': '__common__',
+		'ref_doc_submitted': 1,
+		'to_doctype': u'Purchase Request'
+	},
+
+	# DocType Mapper, Sales Order-Purchase Request
+	{
+		'doctype': 'DocType Mapper',
+		'name': u'Sales Order-Purchase Request'
+	},
+
+	# Field Mapper Detail
+	{
+		'checking_operator': u'>=',
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'transaction_date',
+		'map': u'No',
+		'match_id': 0,
+		'to_field': u'transaction_date'
+	},
+
+	# Field Mapper Detail
+	{
+		'checking_operator': u'=',
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'company',
+		'map': u'Yes',
+		'match_id': 0,
+		'to_field': u'company'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'parent',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'sales_order_no'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'stock_uom',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'uom'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'reserved_warehouse',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'warehouse'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'sales_order_details',
+		'from_table': u'Sales Order Item',
+		'match_id': 1,
+		'reference_doctype_key': u'prevdoc_doctype',
+		'reference_key': u'prevdoc_detail_docname',
+		'to_field': u'indent_details',
+		'to_table': u'Purchase Request Item',
+		'validation_logic': u'docstatus=1'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_table': u'Sales Order',
+		'match_id': 0,
+		'reference_key': u'prevdoc_docname',
+		'to_table': u'Purchase Request',
+		'validation_logic': u'docstatus = 1'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/buying/Module Def/Buying/Buying.txt b/erpnext/buying/Module Def/Buying/Buying.txt
deleted file mode 100644
index 16cae81..0000000
--- a/erpnext/buying/Module Def/Buying/Buying.txt
+++ /dev/null
@@ -1,155 +0,0 @@
-# Module Def, Buying
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-07-01 17:40:38',
-		'docstatus': 0,
-		'modified': '2012-01-10 17:52:19',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'name': '__common__',
-		'parent': 'Buying',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def'
-	},
-
-	# These values are common for all Module Def Item
-	{
-		'doctype': 'Module Def Item',
-		'name': '__common__',
-		'parent': 'Buying',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-
-	# These values are common for all Module Def
-	{
-		'disabled': 'No',
-		'doctype': u'Module Def',
-		'doctype_list': 'DocType Mapper, Purchase Receipt-Payable Voucher\nDocType Mapper, Purchase Order-Payable Voucher\nDocType Mapper, Purchase Order-Purchase Receipt\nDocType Mapper, Indent-Purchase Order\nPrint Format, Purchase Order Format\nPrint Format, Purchase Receipt Format\nDocType Label, Indent',
-		'file_list': 'scm.gif,FileData/00209',
-		'is_hidden': 'No',
-		'module_desc': '<p>All details about your Suppliers and past transactions</p>',
-		'module_icon': 'Buying.gif',
-		'module_label': 'Buying',
-		'module_name': 'Buying',
-		'module_seq': 4,
-		'name': '__common__'
-	},
-
-	# Module Def, Buying
-	{
-		'doctype': u'Module Def',
-		'name': 'Buying'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Your Supplier Database',
-		'display_name': 'Supplier',
-		'doc_name': 'Supplier',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'id\nsupplier_type\nsupplier_status\ncompany'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Buy requests from various people in your company',
-		'display_name': 'Indent',
-		'doc_name': 'Indent',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'status\ntransaction_date\nsales_order_no\nremark'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Orders you have placed to your suppliers',
-		'display_name': 'Purchase Order',
-		'doc_name': 'Purchase Order',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'status\nsupplier\ntransaction_date\ngrand_total'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Itemwise Receipt Details',
-		'doc_name': 'Purchase Receipt Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Purchase in Transit',
-		'doc_name': 'PV Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Pending PO Items To Receive',
-		'doc_name': 'PO Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Pending PO Items To Bill',
-		'doc_name': 'PO Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Itemwise Purchase Details',
-		'doc_name': 'PO Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Ledger details of your creditors',
-		'display_name': "Creditor's Ledger",
-		'doc_name': 'GL Entry',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item',
-		'icon': 'accept.gif'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Purchase User'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Purchase Manager'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Administrator'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Purchase Master Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt b/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt
index 604d2d8..fd074e3 100644
--- a/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt
+++ b/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt
@@ -14,7 +14,7 @@
 	{
 		'doc_type': 'Purchase Order',
 		'doctype': 'Print Format',
-		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Georgia", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Georgia", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Purchase Order\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'po_details\',\n\t\t\t\t\'PO Detail\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'import_rate\', \'import_amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'10%\', \'15%\', \'32%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'Purchase Tax Detail\', doc.name, \'purchase_tax_details\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\trows +=\n\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount / (doc.conversion_rate || 1)) + \'</td>\\n\' +\n\t\t\t\t\t\'</tr>\\n\';\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>\'<h1>\' + (doc.select_print_heading || \'Purchase Order\') + \'</h1>\'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.supplier_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Purchase Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total_import)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_import)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_import</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
+		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Georgia", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Georgia", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Purchase Order\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'po_details\',\n\t\t\t\t\'Purchase Order Item\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'import_rate\', \'import_amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'10%\', \'15%\', \'32%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'Purchase Taxes and Charges\', doc.name, \'purchase_tax_details\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\trows +=\n\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount / (doc.conversion_rate || 1)) + \'</td>\\n\' +\n\t\t\t\t\t\'</tr>\\n\';\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>\'<h1>\' + (doc.select_print_heading || \'Purchase Order\') + \'</h1>\'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.supplier_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Purchase Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total_import)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_import)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_import</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
 		'module': 'Buying',
 		'name': '__common__',
 		'standard': 'Yes'
diff --git a/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt b/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt
index f5cafe4..90a135e 100644
--- a/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt
+++ b/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt
@@ -14,7 +14,7 @@
 	{
 		'doc_type': 'Purchase Order',
 		'doctype': 'Print Format',
-		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Helvetica", "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Helvetica", "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Purchase Order\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'po_details\',\n\t\t\t\t\'PO Detail\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'import_rate\', \'import_amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'10%\', \'15%\', \'32%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'Purchase Tax Detail\', doc.name, \'purchase_tax_details\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\trows +=\n\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount / (doc.conversion_rate || 1)) + \'</td>\\n\' +\n\t\t\t\t\t\'</tr>\\n\';\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>\'<h1>\' + (doc.select_print_heading || \'Purchase Order\') + \'</h1>\'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style="height:15px"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.supplier_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class=\'imp-details\'>\n\t\t\t\t\t\t<td><b>Purchase Order No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Purchase Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total_import)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\' class=\'imp-details\'>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_import)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_import</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>\n',
+		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Helvetica", "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Helvetica", "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Purchase Order\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'po_details\',\n\t\t\t\t\'Purchase Order Item\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'import_rate\', \'import_amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'10%\', \'15%\', \'32%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'Purchase Taxes and Charges\', doc.name, \'purchase_tax_details\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\trows +=\n\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount / (doc.conversion_rate || 1)) + \'</td>\\n\' +\n\t\t\t\t\t\'</tr>\\n\';\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>\'<h1>\' + (doc.select_print_heading || \'Purchase Order\') + \'</h1>\'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style="height:15px"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.supplier_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class=\'imp-details\'>\n\t\t\t\t\t\t<td><b>Purchase Order No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Purchase Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total_import)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\' class=\'imp-details\'>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_import)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_import</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>\n',
 		'module': 'Buying',
 		'name': '__common__',
 		'standard': 'Yes'
diff --git a/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt b/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt
index 70d6961..7b0510d 100644
--- a/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt
+++ b/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt
@@ -14,7 +14,7 @@
 	{
 		'doc_type': 'Purchase Order',
 		'doctype': 'Print Format',
-		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Purchase Order\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'po_details\',\n\t\t\t\t\'PO Detail\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'import_rate\', \'import_amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'10%\', \'15%\', \'32%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'Purchase Tax Detail\', doc.name, \'purchase_tax_details\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\trows +=\n\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount / (doc.conversion_rate || 1)) + \'</td>\\n\' +\n\t\t\t\t\t\'</tr>\\n\';\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>\'<h1>\' + (doc.select_print_heading || \'Purchase Order\') + \'</h1>\'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.supplier_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Purchase Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total_import)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_import)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_import</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
+		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Purchase Order\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'po_details\',\n\t\t\t\t\'Purchase Order Item\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'import_rate\', \'import_amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'10%\', \'15%\', \'32%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'Purchase Taxes and Charges\', doc.name, \'purchase_tax_details\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\trows +=\n\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount / (doc.conversion_rate || 1)) + \'</td>\\n\' +\n\t\t\t\t\t\'</tr>\\n\';\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>\'<h1>\' + (doc.select_print_heading || \'Purchase Order\') + \'</h1>\'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.supplier_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Purchase Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total_import)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_import)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_import</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
 		'module': 'Buying',
 		'name': '__common__',
 		'standard': 'Yes'
diff --git a/erpnext/buying/Role/Purchase Manager/Purchase Manager.txt b/erpnext/buying/Role/Purchase Manager/Purchase Manager.txt
deleted file mode 100644
index b02d186..0000000
--- a/erpnext/buying/Role/Purchase Manager/Purchase Manager.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Purchase Manager
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2010-04-08 12:07:53',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Buying',
-		'name': '__common__',
-		'role_name': 'Purchase Manager'
-	},
-
-	# Role, Purchase Manager
-	{
-		'doctype': 'Role',
-		'name': 'Purchase Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/Role/Purchase Master Manager/Purchase Master Manager.txt b/erpnext/buying/Role/Purchase Master Manager/Purchase Master Manager.txt
deleted file mode 100644
index 41d9f23..0000000
--- a/erpnext/buying/Role/Purchase Master Manager/Purchase Master Manager.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Purchase Master Manager
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2010-04-08 13:50:20',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Buying',
-		'name': '__common__',
-		'role_name': 'Purchase Master Manager'
-	},
-
-	# Role, Purchase Master Manager
-	{
-		'doctype': 'Role',
-		'name': 'Purchase Master Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/Role/Purchase User/Purchase User.txt b/erpnext/buying/Role/Purchase User/Purchase User.txt
deleted file mode 100644
index 1495c84..0000000
--- a/erpnext/buying/Role/Purchase User/Purchase User.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Purchase User
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2010-04-08 12:08:01',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Buying',
-		'name': '__common__',
-		'role_name': 'Purchase User'
-	},
-
-	# Role, Purchase User
-	{
-		'doctype': 'Role',
-		'name': 'Purchase User'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/Role/Supplier/Supplier.txt b/erpnext/buying/Role/Supplier/Supplier.txt
deleted file mode 100644
index 97f4d09..0000000
--- a/erpnext/buying/Role/Supplier/Supplier.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Supplier
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2009-06-26 14:42:19',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Buying',
-		'name': '__common__',
-		'role_name': 'Supplier'
-	},
-
-	# Role, Supplier
-	{
-		'doctype': 'Role',
-		'name': 'Supplier'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/__init__.py b/erpnext/buying/__init__.py
index e69de29..1bcab3d 100644
--- a/erpnext/buying/__init__.py
+++ b/erpnext/buying/__init__.py
@@ -0,0 +1,6 @@
+install_docs = [
+	{"doctype":"Role", "role_name":"Purchase Manager", "name":"Purchase Manager"},
+	{"doctype":"Role", "role_name":"Purchase User", "name":"Purchase User"},
+	{"doctype":"Role", "role_name":"Purchase Master Manager", "name":"Purchase Master Manager"},
+	{"doctype":"Role", "role_name":"Supplier", "name":"Supplier"}	
+]
diff --git a/erpnext/buying/doctype/indent/indent.js b/erpnext/buying/doctype/indent/indent.js
deleted file mode 100644
index 570e06c..0000000
--- a/erpnext/buying/doctype/indent/indent.js
+++ /dev/null
@@ -1,140 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-cur_frm.cscript.tname = "Indent Detail";
-cur_frm.cscript.fname = "indent_details";
-
-$import(Purchase Common)
-$import(SMS Control)
-cur_frm.cscript.indent_doctype_label =	get_doctype_label('Indent');
-	
-//========================== On Load =================================================
-cur_frm.cscript.onload = function(doc, cdt, cdn) {
-	if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date())
-	if (!doc.status) doc.status = 'Draft';
-
-	// defined in purchase_common.js
-	//cur_frm.cscript.update_item_details(doc, cdt, cdn);
-}
-
-cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
-	// second call
-	if(doc.__islocal){ 
-		cur_frm.cscript.get_item_defaults(doc);
-	}	
-}
-
-cur_frm.cscript.get_item_defaults = function(doc) {
-		var ch = getchildren( 'Indent Detail', doc.name, 'indent_details');
-		if (flt(ch.length) > 0){
-			$c_obj(make_doclist(doc.doctype, doc.name), 'get_item_defaults', '', function(r, rt) {refresh_field('indent_details'); });
-		}
-}
-
-
-//======================= Refresh =====================================
-cur_frm.cscript.refresh = function(doc, cdt, cdn) { 
-
-	// Unhide Fields in Next Steps
-	// ---------------------------------
-	
-	cur_frm.clear_custom_buttons();
-
-	if(doc.docstatus == 1 && doc.status != 'Stopped'){
-		var ch = getchildren('Indent Detail',doc.name,'indent_details');
-		var is_closed = 1;
-		for(var i in ch){
-			if(flt(ch[i].qty) > flt(ch[i].ordered_qty)) is_closed = 0;
-		}
-		if(!is_closed) {
-			cur_frm.add_custom_button('Make Purchase Order', cur_frm.cscript['Make Purchase Order'])
-			cur_frm.add_custom_button('Stop ' + cur_frm.cscript.indent_doctype_label, cur_frm.cscript['Stop Purchase Requisition'])
-		}
-		cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
-	}
- 
-	if(doc.docstatus == 1 && doc.status == 'Stopped')
-		cur_frm.add_custom_button('Unstop ' + cur_frm.cscript.indent_doctype_label, cur_frm.cscript['Unstop Purchase Requisition'])
-		
-	if(doc.docstatus == 1)
-		unhide_field(['Repair Purchase Requisition']);
-	else
-		hide_field(['Repair Purchase Requisition']);
-}
-
-//======================= validation ===================================
-cur_frm.cscript.validate = function(doc,cdt,cdn){
-	is_item_table(doc,cdt,cdn);
-}
-//======================= transaction date =============================
-cur_frm.cscript.transaction_date = function(doc,cdt,cdn){
-	if(doc.__islocal){ 
-		cur_frm.cscript.get_default_schedule_date(doc);
-	}
-}
-
-//=================== Quantity ===================================================================
-cur_frm.cscript.qty = function(doc, cdt, cdn) {
-	var d = locals[cdt][cdn];
-	if (flt(d.qty) < flt(d.min_order_qty))
-		alert("Warning: " + cur_frm.cscript.indent_doctype_label + " Qty is less than Minimum Order Qty");
-}
-
-// On Button Click Functions
-// ------------------------------------------------------------------------------
-
-// Make Purchase Order
-cur_frm.cscript['Make Purchase Order'] = function() {
-	var doc = cur_frm.doc;
-	n = createLocal('Purchase Order');
-	$c('dt_map', args={
-		'docs':compress_doclist([locals['Purchase Order'][n]]),
-		'from_doctype':doc.doctype,
-		'to_doctype':'Purchase Order',
-		'from_docname':doc.name,
-		'from_to_list':"[['Indent','Purchase Order'],['Indent Detail','PO Detail']]"
-		}, function(r,rt) {
-			 loaddoc('Purchase Order', n);
-		}
-	);
-}
-
-// Stop INDENT
-// ==================================================================================================
-cur_frm.cscript['Stop Purchase Requisition'] = function() {
-	var doc = cur_frm.doc;
-	var check = confirm("Do you really want to STOP this " + cur_frm.cscript.indent_doctype_label + "?");
-
-	if (check) {
-		$c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
-			cur_frm.refresh();
-		});
-	}
-}
-
-// Un Stop INDENT
-//====================================================================================================
-cur_frm.cscript['Unstop Purchase Requisition'] = function(){
-	var doc = cur_frm.doc
-	var check = confirm("Do you really want to UNSTOP this " + cur_frm.cscript.indent_doctype_label + "?");
-	
-	if (check) {
-		$c('runserverobj', args={'method':'update_status', 'arg': 'Submitted','docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
-			cur_frm.refresh();
-			
-		});
-	}
-}
diff --git a/erpnext/buying/doctype/indent/indent.py b/erpnext/buying/doctype/indent/indent.py
deleted file mode 100644
index c601c91..0000000
--- a/erpnext/buying/doctype/indent/indent.py
+++ /dev/null
@@ -1,235 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-	
-# -----------------------------------------------------------------------------------------
-
-
-class DocType:
-	def __init__(self, doc, doclist=[]):
-		self.doc = doc
-		self.doclist = doclist
-		self.defaults = get_defaults()
-		self.tname = 'Indent Detail'
-		self.fname = 'indent_details'
-
-	# Autoname
-	# ---------
-	def autoname(self):
-		self.doc.name = make_autoname(self.doc.naming_series+'.#####')
-
-
-	def get_default_schedule_date(self):
-		get_obj(dt = 'Purchase Common').get_default_schedule_date(self)
-
-	# Pull Sales Order Details
-	# -------------------------
-	def pull_so_details(self):
-		self.check_if_already_pulled()
-		if self.doc.sales_order_no:
-			get_obj('DocType Mapper', 'Sales Order-Indent', with_children=1).dt_map('Sales Order', 'Indent', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Indent'],['Sales Order Detail', 'Indent Detail']]")
-			self.get_item_defaults()
-		else:
-			msgprint("Please select Sales Order whose details need to pull")
-
-	def check_if_already_pulled(self):
-		pass#if self.[d.sales_order_no for d in getlist(self.doclist, 'indent_details')]
-
-
-	# Get item's other details
-	#- ------------------------
-	def get_item_defaults(self):
-		self.get_default_schedule_date()
-		for d in getlist(self.doclist, 'indent_details'):
-			det = sql("select min_order_qty from tabItem where name = '%s'" % d.item_code)
-			d.min_order_qty = det and flt(det[0][0]) or 0
-
-	# Validate so items
-	# ----------------------------
-	def validate_qty_against_so(self):
-		so_items = {} # Format --> {'SO/00001': {'Item/001': 120, 'Item/002': 24}}
-		for d in getlist(self.doclist, 'indent_details'):
-			if d.sales_order_no:
-				if not so_items.has_key(d.sales_order_no):
-					so_items[d.sales_order_no] = {d.item_code: flt(d.qty)}
-				else:
-					if not so_items[d.sales_order_no].has_key(d.item_code):
-						so_items[d.sales_order_no][d.item_code] = flt(d.qty)
-					else:
-						so_items[d.sales_order_no][d.item_code] += flt(d.qty)
-		
-		for so_no in so_items.keys():
-			for item in so_items[so_no].keys():
-				already_indented = sql("select sum(qty) from `tabIndent Detail` where item_code = '%s' and sales_order_no = '%s' and docstatus = 1 and parent != '%s'" % (item, so_no, self.doc.name))
-				already_indented = already_indented and flt(already_indented[0][0]) or 0
-				
-				actual_so_qty = sql("select sum(qty) from `tabSales Order Detail` where parent = '%s' and item_code = '%s' and docstatus = 1 group by parent" % (so_no, item))
-				actual_so_qty = actual_so_qty and flt(actual_so_qty[0][0]) or 0
-
-				if flt(so_items[so_no][item]) + already_indented > actual_so_qty:
-					msgprint("You can raise indent of maximum qty: %s for item: %s against sales order: %s\n Anyway, you can add more qty in new row for the same item." % (actual_so_qty - already_indented, item, so_no), raise_exception=1)
-				
-		
-	# Validate fiscal year
-	# ----------------------------
-	def validate_fiscal_year(self):
-		get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Indent Date')
-
-	# get item details
-	# ---------------------------------
-	def get_item_details(self, arg =''):
-		if arg:
-			return get_obj(dt='Purchase Common').get_item_details(self,arg)
-		else:
-			obj = get_obj('Purchase Common')
-			for doc in self.doclist:
-				if doc.fields.get('item_code'):
-					temp = {
-						'item_code': doc.fields.get('item_code'),
-						'warehouse': doc.fields.get('warehouse')
-					}
-					ret = obj.get_item_details(self, json.dumps(temp))
-					for r in ret:
-						if not doc.fields.get(r):
-							doc.fields[r] = ret[r]
-
-
-	# Get UOM Details
-	# ---------------------------------
-	def get_uom_details(self, arg = ''):
-		return get_obj(dt='Purchase Common').get_uom_details(arg)
-
-	# GET TERMS & CONDITIONS
-	#-----------------------------
-	def get_tc_details(self):
-		return get_obj('Purchase Common').get_tc_details(self)
-		
-	# Validate Schedule Date
-	#--------------------------------
-	def validate_schedule_date(self):
-		 #:::::::: validate schedule date v/s indent date ::::::::::::
-		for d in getlist(self.doclist, 'indent_details'):
-			if d.schedule_date < self.doc.transaction_date:
-				msgprint("Expected Schedule Date cannot be before Indent Date")
-				raise Exception
-				
-	# Validate
-	# ---------------------
-	def validate(self):
-		self.validate_schedule_date()
-		self.validate_fiscal_year()
-		
-		# set status as "Draft"
-		set(self.doc, 'status', 'Draft')
-
-		# Get Purchase Common Obj
-		pc_obj = get_obj(dt='Purchase Common')
-
-		# Validate Mandatory
-		pc_obj.validate_mandatory(self)
-
-		# Validate for items
-		pc_obj.validate_for_items(self)
-		
-		# Validate qty against SO
-		self.validate_qty_against_so()
-
-
-	# On Submit Functions
-	#----------------------------------------------------------------------------
-	
-	# Update Indented Qty in Bin
-	def update_bin(self, is_submit, is_stopped):
-		for d in getlist(self.doclist, 'indent_details'):
-			# Step 1:=> Check if is_stock_item == 'Yes'
-			if cstr(sql("select is_stock_item from `tabItem` where name = '%s'" % cstr(d.item_code))[0][0]) == 'Yes':
-				if not d.warehouse:
-					msgprint('Please Enter Warehouse for Item %s as it is stock item.' % cstr(d.item_code))
-					raise Exception
-				# Step 2:=> Set Qty 
-				qty =flt(d.qty)
-				if is_stopped:
-					qty = (d.qty > d.ordered_qty) and flt(flt(d.qty) - flt(d.ordered_qty)) or 0 
-				# Step 3 :=> Update Bin's Indent Qty by +- qty 
-				get_obj('Warehouse', d.warehouse).update_bin(0, 0, 0, (is_submit and 1 or -1) * flt(qty), 0, d.item_code, self.doc.transaction_date)		
-		
-	# On Submit			
-	#---------------------------------------------------------------------------
-	def on_submit(self):
-		# Step 1:=> Set Status
-		set(self.doc,'status','Submitted')
-
-		# Step 2:=> Update Bin
-		self.update_bin(is_submit = 1, is_stopped = 0)
-	
-	def check_modified_date(self):
-		mod_db = sql("select modified from `tabIndent` where name = '%s'" % self.doc.name)
-		date_diff = sql("select TIMEDIFF('%s', '%s')" % ( mod_db[0][0],cstr(self.doc.modified)))
-		
-		if date_diff and date_diff[0][0]:
-			msgprint(cstr(self.doc.doctype) +" => "+ cstr(self.doc.name) +" has been modified. Please Refresh. ")
-			raise Exception
-	
-	# On Stop / unstop
-	#------------------------------------------------------------------------------
-	def update_status(self, status):
-		self.check_modified_date()
-		# Step 1:=> Update Bin
-		self.update_bin(is_submit = (status == 'Submitted') and 1 or 0, is_stopped = 1)
-
-		# Step 2:=> Set status 
-		set(self.doc,'status',cstr(status))
-		
-		# Step 3:=> Acknowledge User
-		msgprint(self.doc.doctype + ": " + self.doc.name + " has been %s." % ((status == 'Submitted') and 'Unstopped' or cstr(status)) )
- 
-	# On Cancel
-	#-----------------------------------------------------------------------------
-	def on_cancel(self):
-		# Step 1:=> Get Purchase Common Obj
-		pc_obj = get_obj(dt='Purchase Common')
-		
-		# Step 2:=> Check for stopped status
-		pc_obj.check_for_stopped_status( self.doc.doctype, self.doc.name)
-		
-		# Step 3:=> Check if Purchase Order has been submitted against current Indent
-		pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.doc.name, detail_doctype = 'PO Detail')
-		# Step 4:=> Update Bin
-		self.update_bin(is_submit = 0, is_stopped = (cstr(self.doc.status) == 'Stopped') and 1 or 0)
-		
-		# Step 5:=> Set Status
-		set(self.doc,'status','Cancelled')
-
-
-	# Repair Indent
-	# ===========================================
-	def repair_indent(self):
-		get_obj('Purchase Common', 'Purchase Common').repair_curr_doctype_details(self)
diff --git a/erpnext/buying/doctype/indent/indent.txt b/erpnext/buying/doctype/indent/indent.txt
deleted file mode 100644
index d73492b..0000000
--- a/erpnext/buying/doctype/indent/indent.txt
+++ /dev/null
@@ -1,535 +0,0 @@
-# DocType, Indent
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:04',
-		'docstatus': 0,
-		'modified': '2012-01-10 15:39:17',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': '1326190064',
-		'allow_print': 0,
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
-		'doctype': 'DocType',
-		'module': 'Buying',
-		'name': '__common__',
-		'read_only_onload': 1,
-		'search_fields': 'status,transaction_date,sales_order_no',
-		'section_style': 'Tabbed',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'subject': '%(per_ordered)s% ordered',
-		'version': 197
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Indent',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'Indent',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1
-	},
-
-	# DocType, Indent
-	{
-		'doctype': 'DocType',
-		'name': 'Indent'
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'Production Manager',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'permlevel': 1,
-		'role': 'Purchase Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'Purchase Manager',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'permlevel': 1,
-		'role': 'Material Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'Material Manager',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'permlevel': 1,
-		'role': 'Material User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'Material User',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'Purchase User',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'permlevel': 1,
-		'role': 'Purchase User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'default': 'Enter items and their details which are falling short in your warehouse and for which you want your purchase department to raise a purchase order.',
-		'description': 'Enter items and their details for which you want your purchase department to raise a purchase order.',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Basic Info',
-		'oldfieldtype': 'Section Break',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
-		'permlevel': 0,
-		'print_hide': 0,
-		'width': '50%'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'To manage multiple series please go to Setup > Manage Series',
-		'doctype': 'DocField',
-		'fieldname': 'naming_series',
-		'fieldtype': 'Select',
-		'label': 'Series',
-		'no_copy': 1,
-		'oldfieldname': 'naming_series',
-		'oldfieldtype': 'Select',
-		'options': 'IDT',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'status',
-		'fieldtype': 'Select',
-		'in_filter': 1,
-		'label': 'Status',
-		'no_copy': 1,
-		'oldfieldname': 'status',
-		'oldfieldtype': 'Select',
-		'options': '\nDraft\nSubmitted\nStopped\nCancelled',
-		'permlevel': 1,
-		'reqd': 0,
-		'search_index': 1,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
-		'permlevel': 0,
-		'width': '50%'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'The date at which current entry is made in system.',
-		'doctype': 'DocField',
-		'fieldname': 'transaction_date',
-		'fieldtype': 'Date',
-		'in_filter': 1,
-		'label': 'Transaction Date',
-		'no_copy': 1,
-		'oldfieldname': 'transaction_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': 'Client',
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': '% of materials ordered against this Purchase Requisition',
-		'doctype': 'DocField',
-		'fieldname': 'per_ordered',
-		'fieldtype': 'Currency',
-		'label': '% Ordered',
-		'no_copy': 1,
-		'oldfieldname': 'per_ordered',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Items',
-		'oldfieldtype': 'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'One or multiple Sales Order no which generated this Purchase Requisition',
-		'doctype': 'DocField',
-		'fieldname': 'sales_order_no',
-		'fieldtype': 'Link',
-		'label': 'Sales Order No',
-		'no_copy': 1,
-		'oldfieldname': 'sales_order_no',
-		'oldfieldtype': 'Data',
-		'options': 'Sales Order',
-		'permlevel': 0,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Pull Sales Order Details',
-		'options': 'pull_so_details',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'indent_details',
-		'fieldtype': 'Table',
-		'label': 'Purchase Requisition Details',
-		'no_copy': 0,
-		'oldfieldname': 'indent_details',
-		'oldfieldtype': 'Table',
-		'options': 'Indent Detail',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'default': 'Give additional details about the indent.',
-		'description': 'Filing in Additional Information about the Purchase Requisition will help you analyze your data better.',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'More Info',
-		'oldfieldtype': 'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'Select the relevant company name if you have multiple companies',
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Link',
-		'in_filter': 1,
-		'label': 'Company',
-		'oldfieldname': 'company',
-		'oldfieldtype': 'Link',
-		'options': 'Company',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'search_index': 1,
-		'width': '150px'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Select',
-		'in_filter': 1,
-		'label': 'Fiscal Year',
-		'oldfieldname': 'fiscal_year',
-		'oldfieldtype': 'Select',
-		'options': 'link:Fiscal Year',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'search_index': 1,
-		'width': '150px'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'Name of the entity who has requested for the Purchase Requisition',
-		'doctype': 'DocField',
-		'fieldname': 'requested_by',
-		'fieldtype': 'Data',
-		'label': 'Requested By',
-		'no_copy': 1,
-		'oldfieldname': 'requested_by',
-		'oldfieldtype': 'Data',
-		'permlevel': 0,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
-		'permlevel': 0,
-		'width': '50%'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'remark',
-		'fieldtype': 'Small Text',
-		'label': 'Remarks',
-		'no_copy': 1,
-		'oldfieldname': 'remark',
-		'oldfieldtype': 'Small Text',
-		'permlevel': 0,
-		'print_hide': 0,
-		'width': '150px'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'After cancelling the Purchase Requisition, a dialog box will ask you reason for cancellation which will be reflected in this field',
-		'doctype': 'DocField',
-		'fieldname': 'cancel_reason',
-		'fieldtype': 'Data',
-		'label': 'Cancel Reason',
-		'no_copy': 1,
-		'oldfieldname': 'cancel_reason',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'amended_from',
-		'fieldtype': 'Data',
-		'label': 'Amended From',
-		'no_copy': 1,
-		'oldfieldname': 'amended_from',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': '150px'
-	},
-
-	# DocField
-	{
-		'description': 'The date at which current entry is corrected in the system.',
-		'doctype': 'DocField',
-		'fieldname': 'amendment_date',
-		'fieldtype': 'Date',
-		'label': 'Amendment Date',
-		'no_copy': 1,
-		'oldfieldname': 'amendment_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 0,
-		'print_hide': 1,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'description': 'Add Terms and Conditions for the Purchase Requisition. You can also prepare a master Term Sheet and use the Template',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Terms',
-		'oldfieldtype': 'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': 'DocField',
-		'fieldname': 'letter_head',
-		'fieldtype': 'Select',
-		'label': 'Letter Head',
-		'oldfieldname': 'letter_head',
-		'oldfieldtype': 'Select',
-		'options': 'link:Letter Head',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'tc_name',
-		'fieldtype': 'Link',
-		'label': 'Select Terms',
-		'oldfieldname': 'tc_name',
-		'oldfieldtype': 'Link',
-		'options': 'Term',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Get Terms',
-		'oldfieldtype': 'Button',
-		'options': 'get_tc_details',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'label': 'Terms HTML',
-		'oldfieldtype': 'HTML',
-		'options': 'You can add Terms and Notes that will be printed in the Transaction',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'terms',
-		'fieldtype': 'Text Editor',
-		'label': 'Terms Content',
-		'oldfieldname': 'terms',
-		'oldfieldtype': 'Text Editor',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Repair Purchase Requisition',
-		'oldfieldtype': 'Button',
-		'options': 'repair_indent',
-		'permlevel': 0,
-		'print_hide': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/doctype/indent_detail/__init__.py b/erpnext/buying/doctype/indent_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/buying/doctype/indent_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/buying/doctype/indent_detail/indent_detail.txt b/erpnext/buying/doctype/indent_detail/indent_detail.txt
deleted file mode 100644
index 136237a..0000000
--- a/erpnext/buying/doctype/indent_detail/indent_detail.txt
+++ /dev/null
@@ -1,262 +0,0 @@
-# DocType, Indent Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:04',
-		'docstatus': 0,
-		'modified': '2011-10-12 13:02:13',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'IDTD/.#####',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Buying',
-		'name': '__common__',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 34
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Indent Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# DocType, Indent Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Indent Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'schedule_date',
-		'fieldtype': 'Date',
-		'label': 'Required Date',
-		'no_copy': 1,
-		'oldfieldname': 'schedule_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 0,
-		'print_hide': 0,
-		'reqd': 1,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'item_code',
-		'fieldtype': 'Link',
-		'in_filter': 1,
-		'label': 'Item Code',
-		'oldfieldname': 'item_code',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': 'Client',
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'item_name',
-		'fieldtype': 'Data',
-		'in_filter': 1,
-		'label': 'Item Name',
-		'oldfieldname': 'item_name',
-		'oldfieldtype': 'Data',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Text',
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Text',
-		'permlevel': 0,
-		'reqd': 1,
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'warehouse',
-		'fieldtype': 'Link',
-		'label': 'Warehouse',
-		'oldfieldname': 'warehouse',
-		'oldfieldtype': 'Link',
-		'options': 'Warehouse',
-		'permlevel': 0,
-		'print_hide': 0,
-		'reqd': 0,
-		'trigger': 'Client',
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'brand',
-		'fieldtype': 'Link',
-		'label': 'Brand',
-		'oldfieldname': 'brand',
-		'oldfieldtype': 'Link',
-		'options': 'Brand',
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'item_group',
-		'fieldtype': 'Link',
-		'in_filter': 1,
-		'label': 'Item Group',
-		'no_copy': 0,
-		'oldfieldname': 'item_group',
-		'oldfieldtype': 'Link',
-		'options': 'Item Group',
-		'permlevel': 1,
-		'print_hide': 1,
-		'reqd': 0,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'default': '0.00',
-		'doctype': 'DocField',
-		'fieldname': 'qty',
-		'fieldtype': 'Currency',
-		'label': 'Quantity',
-		'no_copy': 0,
-		'oldfieldname': 'qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': 'Client',
-		'width': '50px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'lead_time_date',
-		'fieldtype': 'Date',
-		'label': 'Lead Time Date',
-		'no_copy': 1,
-		'oldfieldname': 'lead_time_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'uom',
-		'fieldtype': 'Link',
-		'label': 'Stock UOM',
-		'no_copy': 0,
-		'oldfieldname': 'uom',
-		'oldfieldtype': 'Link',
-		'options': 'UOM',
-		'permlevel': 1,
-		'reqd': 1,
-		'width': '50px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'min_order_qty',
-		'fieldtype': 'Currency',
-		'label': 'Min Order Qty',
-		'no_copy': 1,
-		'oldfieldname': 'min_order_qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'reqd': 0,
-		'width': '70px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'projected_qty',
-		'fieldtype': 'Currency',
-		'label': 'Projected Qty',
-		'no_copy': 1,
-		'oldfieldname': 'projected_qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': '70px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'ordered_qty',
-		'fieldtype': 'Currency',
-		'label': 'Ordered Qty',
-		'no_copy': 1,
-		'oldfieldname': 'ordered_qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'sales_order_no',
-		'fieldtype': 'Link',
-		'label': 'Sales Order No',
-		'no_copy': 1,
-		'options': 'Sales Order',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': 'DocField',
-		'fieldname': 'page_break',
-		'fieldtype': 'Check',
-		'label': 'Page Break',
-		'no_copy': 1,
-		'oldfieldname': 'page_break',
-		'oldfieldtype': 'Check',
-		'permlevel': 0,
-		'print_hide': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/doctype/po_detail/__init__.py b/erpnext/buying/doctype/po_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/buying/doctype/po_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/buying/doctype/po_detail/po_detail.txt b/erpnext/buying/doctype/po_detail/po_detail.txt
deleted file mode 100755
index b625e4e..0000000
--- a/erpnext/buying/doctype/po_detail/po_detail.txt
+++ /dev/null
@@ -1,456 +0,0 @@
-# DocType, PO Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:12',
-		'docstatus': 0,
-		'modified': '2012-03-05 15:01:31',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': u'POD/.#####',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': u'Buying',
-		'name': '__common__',
-		'section_style': u'Tray',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 65
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'PO Detail',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# DocType, PO Detail
-	{
-		'doctype': 'DocType',
-		'name': u'PO Detail'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'schedule_date',
-		'fieldtype': u'Date',
-		'hidden': 0,
-		'in_filter': 1,
-		'label': u'Reqd By Date',
-		'no_copy': 1,
-		'oldfieldname': u'schedule_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_code',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Item Code',
-		'oldfieldname': u'item_code',
-		'oldfieldtype': u'Link',
-		'options': u'Item',
-		'permlevel': 0,
-		'print_hide': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_name',
-		'fieldtype': u'Data',
-		'hidden': 0,
-		'in_filter': 1,
-		'label': u'Item Name',
-		'oldfieldname': u'item_name',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'description',
-		'fieldtype': u'Small Text',
-		'label': u'Description',
-		'oldfieldname': u'description',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 0,
-		'reqd': 1,
-		'width': u'300px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'qty',
-		'fieldtype': u'Currency',
-		'label': u'Quantity',
-		'oldfieldname': u'qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': u'Client',
-		'width': u'60px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'import_ref_rate',
-		'fieldtype': u'Currency',
-		'label': u'Ref Rate ',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'discount_rate',
-		'fieldtype': u'Currency',
-		'label': u'Discount %',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'import_rate',
-		'fieldtype': u'Currency',
-		'hidden': 0,
-		'label': u'Rate ',
-		'oldfieldname': u'import_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 0,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'import_amount',
-		'fieldtype': u'Currency',
-		'label': u'Amount',
-		'oldfieldname': u'import_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'purchase_ref_rate',
-		'fieldtype': u'Currency',
-		'label': u'Ref Rate *',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'purchase_rate',
-		'fieldtype': u'Currency',
-		'label': u'Rate (Default Curr.) *',
-		'oldfieldname': u'purchase_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'amount',
-		'fieldtype': u'Currency',
-		'label': u'Amount  (Default Curr.)',
-		'oldfieldname': u'amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'warehouse',
-		'fieldtype': u'Link',
-		'hidden': 0,
-		'label': u'Warehouse',
-		'oldfieldname': u'warehouse',
-		'oldfieldtype': u'Link',
-		'options': u'Warehouse',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 0,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'project_name',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Project Name',
-		'options': u'Project',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'uom',
-		'fieldtype': u'Link',
-		'label': u'UOM',
-		'oldfieldname': u'uom',
-		'oldfieldtype': u'Link',
-		'options': u'UOM',
-		'permlevel': 0,
-		'print_hide': 0,
-		'reqd': 1,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'conversion_factor',
-		'fieldtype': u'Currency',
-		'hidden': 0,
-		'label': u'UOM Conversion Factor',
-		'oldfieldname': u'conversion_factor',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'stock_uom',
-		'fieldtype': u'Data',
-		'hidden': 0,
-		'label': u'Stock UOM',
-		'oldfieldname': u'stock_uom',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'reqd': 1,
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_doctype',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'label': u'Prevdoc DocType',
-		'no_copy': 0,
-		'oldfieldname': u'prevdoc_doctype',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_docname',
-		'fieldtype': u'Link',
-		'hidden': 0,
-		'in_filter': 1,
-		'label': u'Purchase Requisition No',
-		'no_copy': 0,
-		'oldfieldname': u'prevdoc_docname',
-		'oldfieldtype': u'Link',
-		'options': u'Indent',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1,
-		'width': u'120px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_date',
-		'fieldtype': u'Date',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'Purchase Requisition Date',
-		'oldfieldname': u'prevdoc_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_detail_docname',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'Purchase Requisition Detail No',
-		'no_copy': 0,
-		'oldfieldname': u'prevdoc_detail_docname',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'brand',
-		'fieldtype': u'Link',
-		'hidden': 1,
-		'label': u'Brand',
-		'oldfieldname': u'brand',
-		'oldfieldtype': u'Link',
-		'options': u'Brand',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_group',
-		'fieldtype': u'Link',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'Item Group',
-		'oldfieldname': u'item_group',
-		'oldfieldtype': u'Link',
-		'options': u'Item Group',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'stock_qty',
-		'fieldtype': u'Currency',
-		'hidden': 0,
-		'label': u'Stock Qty',
-		'no_copy': 1,
-		'oldfieldname': u'stock_qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'received_qty',
-		'fieldtype': u'Currency',
-		'hidden': 0,
-		'label': u'Received Qty',
-		'no_copy': 1,
-		'oldfieldname': u'received_qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'billed_qty',
-		'fieldtype': u'Currency',
-		'hidden': 0,
-		'label': u'Billed Quantity',
-		'no_copy': 1,
-		'oldfieldname': u'billed_qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Tax detail table fetched from item master as a string and stored in this field.\nUsed for Purchase Other Charges',
-		'doctype': u'DocField',
-		'fieldname': u'item_tax_rate',
-		'fieldtype': u'Small Text',
-		'hidden': 1,
-		'label': u'Item Tax Rate',
-		'oldfieldname': u'item_tax_rate',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 1,
-		'print_hide': 1,
-		'report_hide': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'page_break',
-		'fieldtype': u'Check',
-		'hidden': 0,
-		'label': u'Page Break',
-		'no_copy': 1,
-		'oldfieldname': u'page_break',
-		'oldfieldtype': u'Check',
-		'permlevel': 0,
-		'print_hide': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/doctype/po_raw_material_detail/__init__.py b/erpnext/buying/doctype/po_raw_material_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/buying/doctype/po_raw_material_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/buying/doctype/po_raw_material_detail/po_raw_material_detail.txt b/erpnext/buying/doctype/po_raw_material_detail/po_raw_material_detail.txt
deleted file mode 100644
index 64b97fb..0000000
--- a/erpnext/buying/doctype/po_raw_material_detail/po_raw_material_detail.txt
+++ /dev/null
@@ -1,153 +0,0 @@
-# DocType, PO Raw Material Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:12',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'sneha@webnotestech.com',
-		'owner': 'dhanalekshmi@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'hide_toolbar': 1,
-		'istable': 1,
-		'module': 'Buying',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 1
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'PO Raw Material Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# DocType, PO Raw Material Detail
-	{
-		'doctype': 'DocType',
-		'name': 'PO Raw Material Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'reference_name',
-		'fieldtype': 'Data',
-		'hidden': 0,
-		'idx': 1,
-		'in_filter': 0,
-		'label': 'Reference Name',
-		'oldfieldname': 'reference_name',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'bom_detail_no',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'BOM Detail No',
-		'oldfieldname': 'bom_detail_no',
-		'oldfieldtype': 'Data',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'main_item_code',
-		'fieldtype': 'Data',
-		'idx': 3,
-		'label': 'Item Code',
-		'oldfieldname': 'main_item_code',
-		'oldfieldtype': 'Data',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'rm_item_code',
-		'fieldtype': 'Data',
-		'idx': 4,
-		'label': 'Raw Material Item Code',
-		'oldfieldname': 'rm_item_code',
-		'oldfieldtype': 'Data',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'required_qty',
-		'fieldtype': 'Currency',
-		'idx': 6,
-		'label': 'Required Qty',
-		'oldfieldname': 'required_qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'rate',
-		'fieldtype': 'Currency',
-		'idx': 8,
-		'label': 'Rate',
-		'oldfieldname': 'rate',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'amount',
-		'fieldtype': 'Currency',
-		'idx': 9,
-		'label': 'Amount',
-		'oldfieldname': 'amount',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'conversion_factor',
-		'fieldtype': 'Currency',
-		'hidden': 1,
-		'idx': 11,
-		'label': 'Conversion Factor',
-		'oldfieldname': 'conversion_factor',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'stock_uom',
-		'fieldtype': 'Data',
-		'idx': 12,
-		'label': 'Stock Uom',
-		'oldfieldname': 'stock_uom',
-		'oldfieldtype': 'Data',
-		'permlevel': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/doctype/pr_raw_material_detail/__init__.py b/erpnext/buying/doctype/pr_raw_material_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/buying/doctype/pr_raw_material_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/buying/doctype/pr_raw_material_detail/pr_raw_material_detail.txt b/erpnext/buying/doctype/pr_raw_material_detail/pr_raw_material_detail.txt
deleted file mode 100644
index fd28b85..0000000
--- a/erpnext/buying/doctype/pr_raw_material_detail/pr_raw_material_detail.txt
+++ /dev/null
@@ -1,191 +0,0 @@
-# DocType, PR Raw Material Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:13',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'sneha@webnotestech.com',
-		'owner': 'wasim@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'hide_toolbar': 0,
-		'istable': 1,
-		'module': 'Buying',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 17
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'PR Raw Material Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# DocType, PR Raw Material Detail
-	{
-		'doctype': 'DocType',
-		'name': 'PR Raw Material Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'reference_name',
-		'fieldtype': 'Data',
-		'hidden': 0,
-		'idx': 1,
-		'in_filter': 0,
-		'label': 'Reference Name',
-		'oldfieldname': 'reference_name',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'bom_detail_no',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'BOM Detail No',
-		'oldfieldname': 'bom_detail_no',
-		'oldfieldtype': 'Data',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'main_item_code',
-		'fieldtype': 'Data',
-		'idx': 3,
-		'label': 'Item Code',
-		'oldfieldname': 'main_item_code',
-		'oldfieldtype': 'Data',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'rm_item_code',
-		'fieldtype': 'Data',
-		'idx': 4,
-		'label': 'Raw Material Item Code',
-		'oldfieldname': 'rm_item_code',
-		'oldfieldtype': 'Data',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Data',
-		'idx': 5,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'required_qty',
-		'fieldtype': 'Currency',
-		'idx': 7,
-		'label': 'Required Qty',
-		'oldfieldname': 'required_qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'consumed_qty',
-		'fieldtype': 'Currency',
-		'idx': 8,
-		'label': 'Consumed Qty',
-		'oldfieldname': 'consumed_qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'rate',
-		'fieldtype': 'Currency',
-		'idx': 10,
-		'label': 'Rate',
-		'oldfieldname': 'rate',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'conversion_factor',
-		'fieldtype': 'Currency',
-		'hidden': 1,
-		'idx': 11,
-		'label': 'Conversion Factor',
-		'oldfieldname': 'conversion_factor',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'amount',
-		'fieldtype': 'Currency',
-		'idx': 11,
-		'label': 'Amount',
-		'oldfieldname': 'amount',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'stock_uom',
-		'fieldtype': 'Data',
-		'idx': 12,
-		'label': 'Stock Uom',
-		'oldfieldname': 'stock_uom',
-		'oldfieldtype': 'Data',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'current_stock',
-		'fieldtype': 'Currency',
-		'idx': 12,
-		'label': 'Current Stock',
-		'oldfieldname': 'current_stock',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js
index 9afb710..a8948ff 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -71,15 +71,15 @@
 var set_dynamic_label_par = function(doc, cdt, cdn, base_curr) {
 	//parent flds
 	par_cols_base = {'net_total': 'Net Total', 'total_tax': 'Total Tax', 'grand_total':	'Grand Total', /*'rounded_total': 'Rounded Total',*/
-		'in_words': 'In Words', 'other_charges_added': 'Other Charges Added', 'other_charges_deducted': 'Other Charges Deducted'}
+		'in_words': 'In Words', 'other_charges_added': 'Taxes and Charges Added', 'other_charges_deducted': 'Taxes and Charges Deducted'}
 	par_cols_import = {'net_total_import': 'Net Total', 'grand_total_import': 'Grand Total', 'in_words_import':	'In Words', 
-		'other_charges_added_import': 'Other Charges Added', 'other_charges_deducted_import': 'Other Charges Deducted'};
+		'other_charges_added_import': 'Taxes and Charges Added', 'other_charges_deducted_import': 'Taxes and Charges Deducted'};
 
 	for (d in par_cols_base) cur_frm.fields_dict[d].label_area.innerHTML = par_cols_base[d]+' (' + base_curr + ')';
 	for (d in par_cols_import) cur_frm.fields_dict[d].label_area.innerHTML = par_cols_import[d]+' (' + doc.currency + ')';
 	cur_frm.fields_dict['conversion_rate'].label_area.innerHTML = "Conversion Rate (" + doc.currency +' -> '+ base_curr + ')';
 
-	if (doc.doctype == 'Payable Voucher') {
+	if (doc.doctype == 'Purchase Invoice') {
 		cur_frm.fields_dict['total_tds_on_voucher'].label_area.innerHTML = 'Total TDS On Voucher (' + base_curr + ')';
 		cur_frm.fields_dict['outstanding_amount'].label_area.innerHTML = 'Outstanding Amount (' + base_curr + ')';
 		cur_frm.fields_dict['tds_amount_on_advance'].label_area.innerHTML = 'TDS Amount On Advance (' + base_curr + ')';
@@ -103,12 +103,12 @@
 	for (f in item_cols_base) {
 		cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp(f, hide);
 	}
-	if (doc.doctype == 'Payable Voucher') {
+	if (doc.doctype == 'Purchase Invoice') {
 		$('[data-grid-fieldname="'+cur_frm.cscript.tname+'-rate"]').html('Rate ('+base_curr+')');
 		cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp('rate', hide);
 		// advance table flds
 		adv_cols = {'advance_amount': 'Advance Amount', 'allocated_amount': 'Allocated Amount', 'tds_amount': 'TDS Amount', 'tds_allocated': 'TDS Allocated'}
-		for (d in adv_cols) $('[data-grid-fieldname="Advance Allocation Detail-'+d+'"]').html(adv_cols[d]+' ('+base_curr+')');	
+		for (d in adv_cols) $('[data-grid-fieldname="Purchase Invoice Advance-'+d+'"]').html(adv_cols[d]+' ('+base_curr+')');	
 	}
 	else {
 		$('[data-grid-fieldname="'+cur_frm.cscript.tname+'-purchase_rate"]').html('Rate ('+base_curr+')');
@@ -117,7 +117,7 @@
 
 	//tax table flds
 	tax_cols = {'tax_amount': 'Amount', 'total': 'Aggregate Total'};
-	for (d in tax_cols) $('[data-grid-fieldname="Purchase Tax Detail-'+d+'"]').html(tax_cols[d]+' ('+base_curr+')');	
+	for (d in tax_cols) $('[data-grid-fieldname="Purchase Taxes and Charges-'+d+'"]').html(tax_cols[d]+' ('+base_curr+')');	
 }
 
 // Change label dynamically based on currency
@@ -282,19 +282,19 @@
 	cur_frm.cscript.calc_amount(doc, 1);
 
 	// calculate advances if pv
-	if(doc.doctype == 'Payable Voucher') calc_total_advance(doc, cdt, cdn);
+	if(doc.doctype == 'Purchase Invoice') calc_total_advance(doc, cdt, cdn);
 }
 
 // **************** RE-CALCULATE VALUES ***************************
 
-cur_frm.cscript['Re-Calculate Values'] = function(doc, cdt, cdn) {
-	cur_frm.cscript['Calculate Tax'](doc,cdt,cdn);
+cur_frm.cscript.recalculate_values = function(doc, cdt, cdn) {
+	cur_frm.cscript.calculate_tax(doc,cdt,cdn);
 }
 
-cur_frm.cscript['Calculate Tax'] = function(doc, cdt, cdn) {
+cur_frm.cscript.calculate_tax = function(doc, cdt, cdn) {
 	var other_fname	= cur_frm.cscript.other_fname;
 
-	var cl = getchildren('Purchase Tax Detail', doc.name, other_fname, doc.doctype);
+	var cl = getchildren('Purchase Taxes and Charges', doc.name, other_fname, doc.doctype);
 	for(var i = 0; i<cl.length; i++){
 		cl[i].total_tax_amount = 0;
 		cl[i].total_amount = 0;
@@ -336,7 +336,7 @@
 	
 	for(var i=0;i<cl.length;i++) 
 	{
-	var rate_fld = (doc.doctype != 'Payable Voucher') ? 'purchase_rate': 'rate';
+	var rate_fld = (doc.doctype != 'Purchase Invoice') ? 'purchase_rate': 'rate';
 		var tmp = {};
 	if(!cl[i].discount_rate) cl[i].discount_rate = 0;
 
@@ -395,16 +395,16 @@
 	refresh_field('net_total');
 	refresh_field('net_total_import');
 	
-	cur_frm.cscript.val_cal_charges(doc, cdt, cdn, tname, fname, other_fname);
+	cur_frm.cscript.val_cal_charges(doc, tname, fname, other_fname);
 }
 
 
 //======== Function was broken away from cur_frm.cscript.calc_amount as PV has fieldname 'rate' instead of 'purchase_rate'===========
-cur_frm.cscript.val_cal_charges = function(doc, cdt, cdn, tname, fname, other_fname){
+cur_frm.cscript.val_cal_charges = function(doc, tname, fname, other_fname){
 
 	doc = locals[doc.doctype][doc.name]
 	if(flt(doc.net_total) > 0) {
-		var cl = getchildren('Purchase Tax Detail', doc.name, other_fname,doc.doctype);
+		var cl = getchildren('Purchase Taxes and Charges', doc.name, other_fname,doc.doctype);
 		for(var i = 0; i<cl.length; i++){
 			cl[i].total_tax_amount = 0;
 			cl[i].total_amount = 0;
@@ -418,7 +418,7 @@
 		}
 		cur_frm.cscript.calc_other_charges(doc , tname , fname , other_fname); // calculate other charges
 	}
-	cur_frm.cscript.calc_doc_values(doc, cdt, cdn, tname, fname, other_fname); // calculates total amounts
+	cur_frm.cscript.calc_doc_values(doc, tname, fname, other_fname); // calculates total amounts
 
 	refresh_many(['net_total', 'grand_total', 'rounded_total', 'grand_total_import', 'rounded_total_import', 'in_words', 'in_words_import', 'purchase_tax_details', 'total_tax', 'other_charges_added', 'other_charges_deducted', 'net_total_import', 'other_charges_added_import', 'other_charges_deducted_import']);
 
@@ -432,12 +432,12 @@
 	// ------------------
 
 	
-	cur_frm.fields_dict['Tax Calculation'].disp_area.innerHTML = '<b style="padding: 8px 0px;">Calculation Details for Other Charges and Landed cost:</b>';
+	cur_frm.fields_dict['tax_calculation'].disp_area.innerHTML = '<b style="padding: 8px 0px;">Calculation Details for Taxes, Charges and Landed Cost:</b>';
 	var cl = getchildren(tname, doc.name, fname);
-	var tax = getchildren('Purchase Tax Detail', doc.name, other_fname,doc.doctype);
+	var tax = getchildren('Purchase Taxes and Charges', doc.name, other_fname,doc.doctype);
 	// make display table
 	// ------------------
-	var otc = make_table(cur_frm.fields_dict['Tax Calculation'].disp_area, cl.length + 1, tax.length + 1, '90%',[],{border:'1px solid #AAA',padding:'2px'});
+	var otc = make_table(cur_frm.fields_dict['tax_calculation'].disp_area, cl.length + 1, tax.length + 1, '90%',[],{border:'1px solid #AAA',padding:'2px'});
 	$y(otc,{marginTop:'8px'});
 	
 	var tax_desc = {}; var tax_desc_rates = []; var net_total = 0;
@@ -445,8 +445,8 @@
 	
 	for(var i=0;i<cl.length;i++) {
 		var item_tax = 0;
-		if(doc.doctype != 'Payable Voucher') net_total += flt(flt(cl[i].qty) * flt(cl[i].purchase_rate));
-		else if(doc.doctype == 'Payable Voucher') net_total += flt(flt(cl[i].qty) * flt(cl[i].rate));
+		if(doc.doctype != 'Purchase Invoice') net_total += flt(flt(cl[i].qty) * flt(cl[i].purchase_rate));
+		else if(doc.doctype == 'Purchase Invoice') net_total += flt(flt(cl[i].qty) * flt(cl[i].rate));
 
 		var prev_total = flt(cl[i].amount);
 		if(cl[i].item_tax_rate) {
@@ -461,7 +461,7 @@
 		//--------------------------
 		$td(otc,i+1,0).innerHTML = cl[i].item_code;
 		
-		var tax = getchildren('Purchase Tax Detail', doc.name, other_fname,doc.doctype);
+		var tax = getchildren('Purchase Taxes and Charges', doc.name, other_fname,doc.doctype);
 		var total = net_total;
 		for(var t=0;t<tax.length;t++){
  
@@ -489,12 +489,12 @@
 				var total_amount = flt(tax[t].tax_amount);
 				total_tax_amount = flt(tax[t].total_tax_amount) + flt(total_amount);
 				if(tax[t].category != "For Valuation"){
-					set_multiple('Purchase Tax Detail', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'amount':total_amount, 'total':flt(total)+flt(tax[t].tax_amount)/*_tax_amount)*/}, other_fname);
+					set_multiple('Purchase Taxes and Charges', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'amount':total_amount, 'total':flt(total)+flt(tax[t].tax_amount)/*_tax_amount)*/}, other_fname);
 					prev_total += flt(tax[t].total_amount);
 					total += flt(tax[t].tax_amount);	// for adding total to previous amount			 
 				}
 				else{
-					set_multiple('Purchase Tax Detail', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'amount':total_amount, 'total':flt(total)/*_tax_amount)*/}, other_fname);
+					set_multiple('Purchase Taxes and Charges', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'amount':total_amount, 'total':flt(total)/*_tax_amount)*/}, other_fname);
 					prev_total = prev_total;
 				}
 				//prev_total += flt(tax[t].total_amount);	 // for previous row total
@@ -517,12 +517,12 @@
 				var total_amount = flt(tax[t].tax_amount);
 				total_tax_amount = flt(tax[t].total_tax_amount) - flt(total_amount);
 				if(tax[t].category != "For Valuation"){
-					set_multiple('Purchase Tax Detail', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'tax_amount':total_amount, 'total':flt(total)-flt(tax[t].tax_amount)/*_tax_amount)*/}, other_fname);
+					set_multiple('Purchase Taxes and Charges', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'tax_amount':total_amount, 'total':flt(total)-flt(tax[t].tax_amount)/*_tax_amount)*/}, other_fname);
 					prev_total -= flt(tax[t].total_amount); 
 					total -= flt(tax[t].tax_amount);	// for adding total to previous amount			 
 				}
 				else{
-					set_multiple('Purchase Tax Detail', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'tax_amount':total_amount, 'total':flt(total)/*_tax_amount)*/}, other_fname);
+					set_multiple('Purchase Taxes and Charges', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'tax_amount':total_amount, 'total':flt(total)/*_tax_amount)*/}, other_fname);
 					prev_total = prev_total;
 				}
 				//prev_total += flt(tax[t].total_amount);	 // for previous row total
@@ -547,14 +547,15 @@
 
 
 // ******* Calculation of total amounts of document (item amount + other charges)****************
-cur_frm.cscript.calc_doc_values = function(doc, cdt, cdn, tname, fname, other_fname) {
+cur_frm.cscript.calc_doc_values = function(doc, tname, fname, other_fname) {
 	doc = locals[doc.doctype][doc.name];
-	var net_total = 0; var total_tax = 0; var other_charges_added = 0; var other_charges_deducted = 0;
+	var net_total = 0; var total_tax = 0; var other_charges_added = 0; 
+	var other_charges_deducted = 0;
 	var cl = getchildren(tname, doc.name, fname);
 	for(var i = 0; i<cl.length; i++){
 		net_total += flt(cl[i].amount);
 	}
-	var d = getchildren('Purchase Tax Detail', doc.name, other_fname,doc.doctype);
+	var d = getchildren('Purchase Taxes and Charges', doc.name, other_fname,doc.doctype);
 	for(var j = 0; j<d.length; j++){
 		if(d[j].category != 'For Valuation'){
 			
@@ -584,7 +585,7 @@
 	refresh_many(['net_total','total_taxes','grand_total']);
 
 
-	if(doc.doctype == 'Payable Voucher'){
+	if(doc.doctype == 'Purchase Invoice'){
 		calculate_outstanding(doc);
 	}
 }
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.py b/erpnext/buying/doctype/purchase_common/purchase_common.py
index 597eec4..7cbfe04 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.py
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.py
@@ -38,39 +38,27 @@
 		self.doc = doc
 		self.doclist = doclist
 
-		self.chk_tol_for_list = ['Indent - Purchase Order', 'Purchase Order - Purchase Receipt', 'Purchase Order - Payable Voucher']
+		self.chk_tol_for_list = ['Purchase Request - Purchase Order', 'Purchase Order - Purchase Receipt', 'Purchase Order - Purchase Invoice']
 
-		self.update_qty = {'Indent - Purchase Order'						: 'ordered_qty',
+		self.update_qty = {'Purchase Request - Purchase Order'						: 'ordered_qty',
 											 'Purchase Order - Purchase Receipt'	: 'received_qty',
-											 'Purchase Order - Payable Voucher'	 : 'billed_qty',
-											 'Purchase Receipt - Payable Voucher' : 'billed_qty'}
+											 'Purchase Order - Purchase Invoice'	 : 'billed_qty',
+											 'Purchase Receipt - Purchase Invoice' : 'billed_qty'}
 
-		self.update_percent_field = {'Indent - Purchase Order'						: 'per_ordered',
+		self.update_percent_field = {'Purchase Request - Purchase Order'						: 'per_ordered',
 									 'Purchase Order - Purchase Receipt'	: 'per_received',
-									 'Purchase Order - Payable Voucher'	 : 'per_billed',
-									 'Purchase Receipt - Payable Voucher' : 'per_billed'}
+									 'Purchase Order - Purchase Invoice'	 : 'per_billed',
+									 'Purchase Receipt - Purchase Invoice' : 'per_billed'}
 
 		# used in validation for items and update_prevdoc_detail
-		self.doctype_dict = {'Indent'						 : 'Indent Detail',
-							 'Supplier Quotation' : 'Supplier Quotation Detail',
-							 'Purchase Order'		 : 'PO Detail',
-							 'Purchase Receipt'	 : 'Purchase Receipt Detail'}
+		self.doctype_dict = {'Purchase Request'						 : 'Purchase Request Item',
+							 'Purchase Order'		 : 'Purchase Order Item',
+							 'Purchase Receipt'	 : 'Purchase Receipt Item'}
  
-		self.repair_percent_field = {
-												 'ordered_qty' : 'per_ordered',
-												 'received_qty': 'per_received',
-												 'billed_qty'	: 'per_billed'}
-
-		self.repair_fields = {
-									'Indent Detail'			 : ['ordered_qty'],
-									'PO Detail'				 : ['received_qty', 'billed_qty'],
-									'Purchase Receipt Detail': ['billed_qty']
-							 }
-
 		self.next_dt_detail = {
-									'ordered_qty' : 'PO Detail',
-									'billed_qty'	: 'PV Detail',
-									'received_qty': 'Purchase Receipt Detail'
+									'ordered_qty' : 'Purchase Order Item',
+									'billed_qty'	: 'Purchase Invoice Item',
+									'received_qty': 'Purchase Receipt Item'
 								}
 
 		self.msg = []
@@ -81,7 +69,7 @@
 			item = sql("select lead_time_days from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life >	now())" % cstr(d.item_code) , as_dict = 1)
 			ltd = item and cint(item[0]['lead_time_days']) or 0
 			if ltd and obj.doc.transaction_date:
-				if d.fields.has_key('lead_time_date') or obj.doc.doctype == 'Indent':
+				if d.fields.has_key('lead_time_date') or obj.doc.doctype == 'Purchase Request':
 					d.lead_time_date = cstr(add_days( obj.doc.transaction_date, cint(ltd)))
 				if not d.fields.has_key('prevdoc_docname') or (d.fields.has_key('prevdoc_docname') and not d.prevdoc_docname):
 					d.schedule_date =	cstr( add_days( obj.doc.transaction_date, cint(ltd)))
@@ -108,7 +96,7 @@
 	# Get TERMS AND CONDITIONS
 	# =======================================================================================
 	def get_tc_details(self,obj):
-		r = sql("select terms from `tabTerm` where name = %s", obj.doc.tc_name)
+		r = sql("select terms from `tabTerms and Conditions` where name = %s", obj.doc.tc_name)
 		if r: obj.doc.terms = r[0][0]
 
 	# Get Item Details
@@ -141,7 +129,7 @@
 		}
 		
 		# get min_order_qty from item
-		if obj.doc.doctype == 'Indent':
+		if obj.doc.doctype == 'Purchase Request':
 			ret['min_order_qty'] = item and flt(item[0]['min_order_qty']) or 0
 		
 		# get projected qty from bin
@@ -155,7 +143,7 @@
 			ret['lead_time_date'] = cstr(add_days(obj.doc.transaction_date, cint(item[0]['lead_time_days'])))
 		
 		#	get last purchase rate as per stock uom and default currency for following list of doctypes
-		if obj.doc.doctype in ['Supplier Quotation', 'Purchase Order', 'Purchase Receipt']:
+		if obj.doc.doctype in ['Purchase Order', 'Purchase Receipt']:
 			ret['purchase_ref_rate'] = item and flt(item[0]['last_purchase_rate']) or 0
 			ret['import_ref_rate'] = flt(item and flt(item[0]['last_purchase_rate']) or 0) / flt(obj.doc.fields.has_key('conversion_rate') and flt(obj.doc.conversion_rate) or 1)			
 			ret['purchase_rate'] = item and flt(item[0]['last_purchase_rate']) or 0
@@ -221,7 +209,7 @@
 			bin = sql("select projected_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
 			
 			f_lst ={'projected_qty': bin and flt(bin[0]['projected_qty']) or 0, 'ordered_qty': 0, 'received_qty' : 0, 'billed_qty': 0}
-			if d.doctype == 'Purchase Receipt Detail':
+			if d.doctype == 'Purchase Receipt Item':
 				f_lst.pop('received_qty')
 			for x in f_lst :
 				if d.fields.has_key(x):
@@ -262,7 +250,7 @@
 					raise Exception
 				
 				#	Check if UOM has been modified.
-				if not cstr(data[0]['uom']) == cstr(d.uom) and not cstr(d.prevdoc_doctype) == 'Indent':
+				if not cstr(data[0]['uom']) == cstr(d.uom) and not cstr(d.prevdoc_doctype) == 'Purchase Request':
 					msgprint("Please check UOM %s of Item %s which is not present in %s %s ." % (d.uom, d.item_code, d.prevdoc_doctype, d.prevdoc_docname))
 					raise Exception
 			
@@ -319,7 +307,7 @@
 					msgprint(cstr(prevdoc_doctype) + ": " + cstr(prevdoc_docname) + " does not belong to the Company: " + cstr(obj.doc.company))
 					raise Exception
 
-				if prevdoc_doctype in ['Supplier Quotation','Purchase Order', 'Purchase Receipt']:
+				if prevdoc_doctype in ['Purchase Order', 'Purchase Receipt']:
 					dt = sql("select supplier, currency from `tab%s` where name = '%s'" % (prevdoc_doctype, name))
 					supplier = dt and dt[0][0] or ''
 					currency = dt and dt[0][1] or ''
@@ -380,11 +368,11 @@
 	def get_qty(self,curr_doctype,ref_tab_fname,ref_tab_dn,ref_doc_tname, transaction, curr_parent_name):
 		# Get total Quantities of current doctype (eg. PR) except for qty of this transaction
 		#------------------------------
-		# please check as UOM changes from Indent - Purchase Order ,so doing following else uom should be same .
+		# please check as UOM changes from Purchase Request - Purchase Order ,so doing following else uom should be same .
 		# i.e. in PO uom is NOS then in PR uom should be NOS
-		# but if in Indent uom KG it can change in PO
+		# but if in Purchase Request uom KG it can change in PO
 		
-		get_qty = (transaction == 'Indent - Purchase Order') and 'qty * conversion_factor' or 'qty'
+		get_qty = (transaction == 'Purchase Request - Purchase Order') and 'qty * conversion_factor' or 'qty'
 		qty = sql("select sum(%s) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% ( get_qty, curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name))
 		qty = qty and flt(qty[0][0]) or 0 
 		
@@ -404,10 +392,10 @@
 		qty, max_qty, max_qty_plus_tol = flt(curr_ref_qty.split('~~~')[0]), flt(curr_ref_qty.split('~~~')[1]), flt(curr_ref_qty.split('~~~')[1])
 
 		# Qty above Tolerance should be allowed only once.
-		# But there is special case for Transaction 'Indent-Purhcase Order' that there should be no restriction
-		# One can create any no. of PO against same Indent!!!
+		# But there is special case for Transaction 'Purchase Request-Purhcase Order' that there should be no restriction
+		# One can create any no. of PO against same Purchase Request!!!
 		if qty >= max_qty and is_submit and flt(curr_qty) > 0:
-			reason = (curr_parent_doctype == 'Purchase Order') and 'Ordered' or (curr_parent_doctype == 'Purchase Receipt') and 'Received' or (curr_parent_doctype == 'Payable Voucher') and 'Billed'
+			reason = (curr_parent_doctype == 'Purchase Order') and 'Ordered' or (curr_parent_doctype == 'Purchase Receipt') and 'Received' or (curr_parent_doctype == 'Purchase Invoice') and 'Billed'
 			msgprint("Error: Item Code : '%s' of '%s' is already %s." %(item_code,ref_dn,reason))
 			raise Exception
 		
@@ -415,7 +403,7 @@
 		tolerance = flt(get_value('Item',item_code,'tolerance') or 0)
 		
 		if not(tolerance):
-			tolerance = flt(get_value('Manage Account',None,'tolerance') or 0)
+			tolerance = flt(get_value('Global Defaults',None,'tolerance') or 0)
 
 		if is_submit:
 			qty = qty + flt(curr_qty)
@@ -426,7 +414,7 @@
 				max_qty_plus_tol = max_qty * (1 + (flt(tolerance)/ 100))
 
 				if max_qty_plus_tol < qty:
-					reason = (curr_parent_doctype == 'Purchase Order') and 'Ordered' or (curr_parent_doctype == 'Purchase Receipt') and 'Received' or (curr_parent_doctype == 'Payable Voucher') and 'Billed'
+					reason = (curr_parent_doctype == 'Purchase Order') and 'Ordered' or (curr_parent_doctype == 'Purchase Receipt') and 'Received' or (curr_parent_doctype == 'Purchase Invoice') and 'Billed'
 					msgprint("error:Already %s Qty for %s is %s and maximum allowed Qty is %s" % (cstr(reason), item_code, cstr(flt(qty) - flt(curr_qty)) , cstr(max_qty_plus_tol)))
 					raise Exception
 
@@ -452,12 +440,12 @@
 			
 			if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname:
 				transaction = cstr(d.prevdoc_doctype) + ' - ' + cstr(obj.doc.doctype)
-				curr_qty = (transaction == 'Indent - Purchase Order') and flt(d.qty) * flt(d.conversion_factor) or flt(d.qty)
+				curr_qty = (transaction == 'Purchase Request - Purchase Order') and flt(d.qty) * flt(d.conversion_factor) or flt(d.qty)
 				self.update_ref_doctype_dict( flt(curr_qty), d.doctype, d.prevdoc_docname, d.prevdoc_doctype, 'prevdoc_detail_docname', d.prevdoc_detail_docname, transaction, d.item_code, is_submit, obj.doc.doctype, obj.doc.name)
 			
 			# for payable voucher
 			if d.fields.has_key('purchase_order') and d.purchase_order:
-				curr_qty = sql("select sum(qty) from `tabPV Detail` where po_detail = '%s' and parent = '%s'" % (cstr(d.po_detail), cstr(obj.doc.name)))
+				curr_qty = sql("select sum(qty) from `tabPurchase Invoice Item` where po_detail = '%s' and parent = '%s'" % (cstr(d.po_detail), cstr(obj.doc.name)))
 				curr_qty = curr_qty and flt(curr_qty[0][0]) or 0
 				self.update_ref_doctype_dict( curr_qty, d.doctype, d.purchase_order, 'Purchase Order', 'po_detail', d.po_detail, 'Purchase Order - ' + cstr(obj.doc.doctype), d.item_code, is_submit,	obj.doc.doctype, obj.doc.name)
 
@@ -488,9 +476,9 @@
 	def update_last_purchase_rate(self, obj, is_submit):
 		for d in getlist(obj.doclist,obj.fname):
 			# get last purchase rate from Purchase Order
-			po_lpr = sql ("select t2.purchase_rate/t2.conversion_factor as rate, t1.transaction_date as date from `tabPurchase Order` t1, `tabPO Detail` t2	where t1.name = t2.parent and t2.item_code = '%s' and t1.docstatus = 1 and t1.name != '%s' order by t1.transaction_date DESC limit 1"% (d.item_code, obj.doc.name), as_dict = 1 )
+			po_lpr = sql ("select t2.purchase_rate/t2.conversion_factor as rate, t1.transaction_date as date from `tabPurchase Order` t1, `tabPurchase Order Item` t2	where t1.name = t2.parent and t2.item_code = '%s' and t1.docstatus = 1 and t1.name != '%s' order by t1.transaction_date DESC limit 1"% (d.item_code, obj.doc.name), as_dict = 1 )
 			# get last purchase rate from purchase receipt
-			pr_lpr = sql ("select t2.purchase_rate/t2.conversion_factor as rate, t1.posting_date as date, t1.posting_time from `tabPurchase Receipt` t1, `tabPurchase Receipt Detail` t2	where t1.name = t2.parent and t2.item_code = '%s' and t1.docstatus = 1	and t1.name != '%s' order by t1.posting_date DESC, t1.posting_time DESC limit 1"% (d.item_code, obj.doc.name), as_dict = 1 )
+			pr_lpr = sql ("select t2.purchase_rate/t2.conversion_factor as rate, t1.posting_date as date, t1.posting_time from `tabPurchase Receipt` t1, `tabPurchase Receipt Item` t2	where t1.name = t2.parent and t2.item_code = '%s' and t1.docstatus = 1	and t1.name != '%s' order by t1.posting_date DESC, t1.posting_time DESC limit 1"% (d.item_code, obj.doc.name), as_dict = 1 )
 			# compare dates of Po & Pr
 			date_diff1	= sql("select DATEDIFF('%s', '%s')" % ( po_lpr and po_lpr[0]['date'] or '0000-00-00', pr_lpr and pr_lpr[0]['date'] or '0000-00-00'))
 
@@ -521,9 +509,9 @@
 	def get_purchase_tax_details(self,obj):
 		self.doc.clear_table(obj.doclist,'purchase_tax_details')
 		idx = 0
-		other_charge = sql("select category, add_deduct_tax, charge_type,row_id,description,account_head,rate,tax_amount from `tabPurchase Tax Detail` where parent = '%s' order by idx" %(obj.doc.purchase_other_charges), as_dict = 1)
+		other_charge = sql("select category, add_deduct_tax, charge_type,row_id,description,account_head,rate,tax_amount from `tabPurchase Taxes and Charges` where parent = '%s' order by idx" %(obj.doc.purchase_other_charges), as_dict = 1)
 		for other in other_charge:
-			d =	addchild(obj.doc, 'purchase_tax_details', 'Purchase Tax Detail', 1, obj.doclist)
+			d =	addchild(obj.doc, 'purchase_tax_details', 'Purchase Taxes and Charges', 1, obj.doclist)
 			d.category = other['category']
 			d.add_deduct_tax = other['add_deduct_tax']
 			d.charge_type = other['charge_type']
@@ -564,64 +552,3 @@
 			if d.prevdoc_doctype and d.prevdoc_docname:
 				dt = sql("select transaction_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname))
 				d.prevdoc_date = dt and dt[0][0].strftime('%Y-%m-%d') or ''
-
-
-#=================================================================================
-# REPAIR OPTION
-#=================================================================================
-
-	def get_next_dt_detail_qty(self, next_dt_detail, name, curr_dt, f):
-		get_qty = (curr_dt == 'Indent') and 'qty * conversion_factor' or 'qty'
-		qty = sql("select sum(%s) from `tab%s` where %s = '%s' and docstatus = 1"% (get_qty, next_dt_detail, (f == 'billed_qty') and (curr_dt == 'Purchase Order' and 'po_detail' or 'pr_detail') or 'prevdoc_detail_docname', name))
-		return qty and flt(qty[0][0]) or 0
-
-	def repair_curr_qty_details(self, obj):
-		self.repair_fields_list, count, percent =	self.repair_fields[obj.tname], {}, {}
-		# Check and Update Fields in Detail Table 
-		for d in getlist(obj.doclist, obj.fname):
-			for f in self.repair_fields_list:
-				qty, update_qty = d.fields.get(f,0), self.get_next_dt_detail_qty(self.next_dt_detail[f], d.name, obj.doc.doctype, f)
-
-				# Check qty
-				if flt(qty) != flt(update_qty):
-					msgprint('<div style="color: RED"> Difference found in %s (Before : %s; After : %s) in %s of %s : %s in Row No : %s </div>' % (f, qty, update_qty, obj.tname, obj.doc.doctype, obj.doc.name, d.name))
-					self.msg.append('<div style="color: RED"> Difference found in %s (Before : %s; After : %s) in %s of %s : %s in Row No : %s</div>' % (f, qty, update_qty, obj.tname, obj.doc.doctype, obj.doc.name, d.name))
-					# update qty
-					#sql("update `tab%s` set %s = '%s' where name = '%s'"% (obj.tname, f, update_qty, d.name))
-					set(d, f, update_qty)
-
-				# Calculate percentage
-				if flt(d.qty) - flt(update_qty) <= 0:
-					percent[f] = percent.get(f, 0) + 100
-				else:
-					percent[f] = percent.get(f, 0) + (flt(update_qty)/flt(d.qty) * 100)
-				count[f] = count.get(f,0) + 1
-
-		return count, percent
-
-	def repair_curr_percent_detail(self, obj, count, percent):
-		import math
-		for f in self.repair_fields_list:
-			per_complete, update_per_complete = flt(obj.doc.fields.get(self.repair_percent_field[f], 0)), math.floor(flt(percent[f]) / flt(count[f]))
-			if flt(obj.doc.fields.get(self.repair_percent_field[f], 0)) != flt(update_per_complete):
-				msgprint('<div style="color: RED">Difference found in %s (Before : %s; After : %s) in	%s : %s </div>' % (self.repair_percent_field[f], per_complete, update_per_complete, obj.doc.doctype, obj.doc.name))
-				self.msg.append('<div style="color: RED">Difference found in %s (Before : %s; After : %s) in	%s : %s </div>' % (self.repair_percent_field[f], per_complete, update_per_complete, obj.doc.doctype, obj.doc.name))
-				#sql("update `tab%s` set %s = '%s' where name = '%s'" % (obj.doc.doctype, self.repair_percent_field[f], update_per_complete, obj.doc.name))
-				set(obj.doc, self.repair_percent_field[f], update_per_complete)
-
-	def send_mail(self, obj):
-		email_msg = """ Dear Administrator,
-
-In Account := %s User := %s has Reposted %s : %s and following was found:-
-
-%s
-
-""" % (get_value('Control Panel', None,'account_id'), session['user'], obj.doc.doctype, obj.doc.name, '\n'.join(self.msg))
-
-		sendmail(['jai@webnotestech.com'], subject='Repair Option', parts = [('text/plain', email_msg)])
-
-	def repair_curr_doctype_details(self, obj):
-		count, percent = self.repair_curr_qty_details(obj)
-		self.repair_curr_percent_detail(obj, count, percent)
-		if self.msg: self.send_mail(obj)
-		msgprint('<div style="color: GREEN"> ' + cstr(obj.doc.doctype) + ' : ' + cstr(obj.doc.name) + ' has been checked' + cstr(self.msg and ' and repaired successfully.' or '. No changes Found.' + '</div>'))
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.txt b/erpnext/buying/doctype/purchase_common/purchase_common.txt
index 689e42e..dc1e1f1 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.txt
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.txt
@@ -3,22 +3,22 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:15',
+		'creation': '2012-03-27 14:35:51',
 		'docstatus': 0,
-		'modified': '2010-12-23 10:45:17',
-		'modified_by': 'sneha@webnotestech.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:51',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'issingle': 1,
-		'module': 'Buying',
+		'module': u'Buying',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 187
 	},
@@ -26,6 +26,6 @@
 	# DocType, Purchase Common
 	{
 		'doctype': 'DocType',
-		'name': 'Purchase Common'
+		'name': u'Purchase Common'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/buying/doctype/purchase_order/listview.js b/erpnext/buying/doctype/purchase_order/listview.js
new file mode 100644
index 0000000..528fe60
--- /dev/null
+++ b/erpnext/buying/doctype/purchase_order/listview.js
@@ -0,0 +1,33 @@
+// render
+wn.doclistviews['Purchase Order'] = wn.views.ListView.extend({
+	init: function(d) {
+		this._super(d)
+		this.fields = this.fields.concat([
+			"`tabPurchase Order`.supplier_name", 
+			"ifnull(`tabPurchase Order`.per_received,0) as per_received",
+			"ifnull(`tabPurchase Order`.per_billed,0) as per_billed",
+			"`tabPurchase Order`.currency", 
+			"ifnull(`tabPurchase Order`.grand_total_import,0) as grand_total_import"
+		]);
+		this.stats = this.stats.concat(['status', 'company']);
+	},
+	
+	columns: [
+		{width: '5%', content:'avatar'},
+		{width: '3%', content:'docstatus'},
+		{width: '15%', content:'name'},
+		{width: '35%', content:'tags+supplier_name', css: {color:'#aaa'}},
+		{
+			width: '18%', 
+			content: function(parent, data) { 
+				$(parent).html(data.currency + ' ' + fmt_money(data.grand_total_import)) 
+			},
+			css: {'text-align':'right'}
+		},
+		{width: '8%', content: 'per_received', type:'bar-graph', label:'Delivered'},
+		{width: '8%', content: 'per_billed', type:'bar-graph', label:'Billed'},
+		{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
+	]
+
+});
+
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index 7af1204..33dc481 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -14,12 +14,14 @@
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-cur_frm.cscript.tname = "PO Detail";
+cur_frm.cscript.tname = "Purchase Order Item";
 cur_frm.cscript.fname = "po_details";
 cur_frm.cscript.other_fname = "purchase_tax_details";
-$import(Purchase Common)
-$import(Purchase Other Charges)
-$import(SMS Control)
+
+wn.require('erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js');
+wn.require('erpnext/buying/doctype/purchase_common/purchase_common.js');
+wn.require('erpnext/utilities/doctype/sms_control/sms_control.js');
+wn.require('erpnext/setup/doctype/notification_control/notification_control.js');
 
 //========================== On Load =================================================
 cur_frm.cscript.onload = function(doc, cdt, cdn) {
@@ -31,22 +33,22 @@
 	if(!doc.currency) doc.currency = sys_defaults.currency;
 	if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
 	if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
+	if(!doc.is_subcontracted) set_multiple(cdt, cdn, {is_subcontracted:'No'});
 	
 	if(doc.__islocal){
 		hide_field(['supplier_name','supplier_address','contact_person','address_display','contact_display','contact_mobile','contact_email']);
 	}
-
 	// defined in purchase_common.js
 	//cur_frm.cscript.update_item_details(doc, cdt, cdn);		
 }
 
-cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
-	var callback = function(doc, cdt, cdn) {
+cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
+	var callback = function(doc, dt, dn) {
 		if(doc.__islocal){ 
 			cur_frm.cscript.get_default_schedule_date(doc);
 		}	
 	}
-	cur_frm.cscript.dynamic_label(doc, cdt, cdn, callback);
+	cur_frm.cscript.dynamic_label(doc, dt, dn, callback);
 }
 
 // ================================== Refresh ==========================================
@@ -58,9 +60,9 @@
 	if (!cur_frm.cscript.is_onload) cur_frm.cscript.dynamic_label(doc, cdt, cdn);
 
 	if(doc.docstatus == 1 && doc.status != 'Stopped'){
-		var ch = getchildren('PO Detail',doc.name,'po_details');
+		var ch = getchildren('Purchase Order Item',doc.name,'po_details');
 		var allow_billing = 0; var allow_receipt = 0;
-		cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
+		cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
 
 		for(var i in ch){
 			if(ch[i].qty > ch[i].received_qty) allow_receipt = 1; 
@@ -78,9 +80,6 @@
 		
 	if(doc.docstatus == 1 && doc.status == 'Stopped')
 		cur_frm.add_custom_button('Unstop Purchase Order', cur_frm.cscript['Unstop Purchase Order']);
-
-	if(doc.docstatus == 1) unhide_field(['Repair Purchase Order']);
-	else hide_field(['Repair Purchase Order']);
 }
 
 
@@ -139,10 +138,10 @@
 	return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
 }
 
-//==================== Indent No Get Query =======================================================
-//===== Only those Indents status != 'Completed' and docstatus = 1 i.e. submitted=================
+//==================== Purchase Request No Get Query =======================================================
+//===== Only those Purchase Requests status != 'Completed' and docstatus = 1 i.e. submitted=================
 cur_frm.fields_dict['indent_no'].get_query = function(doc) {
-	return 'SELECT DISTINCT `tabIndent`.`name` FROM `tabIndent` WHERE `tabIndent`.company = "' + doc.company + '" and `tabIndent`.`docstatus` = 1 and `tabIndent`.`status` != "Stopped" and ifnull(`tabIndent`.`per_ordered`,0) < 100 and `tabIndent`.%(key)s LIKE "%s" ORDER BY `tabIndent`.`name` DESC LIMIT 50';
+	return 'SELECT DISTINCT `tabPurchase Request`.`name` FROM `tabPurchase Request` WHERE `tabPurchase Request`.company = "' + doc.company + '" and `tabPurchase Request`.`docstatus` = 1 and `tabPurchase Request`.`status` != "Stopped" and ifnull(`tabPurchase Request`.`per_ordered`,0) < 100 and `tabPurchase Request`.%(key)s LIKE "%s" ORDER BY `tabPurchase Request`.`name` DESC LIMIT 50';
 }
 
 /*
@@ -157,7 +156,7 @@
 
 
 //========================= Get Last Purhase Rate =====================================
-cur_frm.cscript['Get Last Purchase Rate'] = function(doc, cdt, cdn){
+cur_frm.cscript.get_last_purchase_rate = function(doc, cdt, cdn){
 	$c_obj(make_doclist(doc.doctype, doc.name), 'get_last_purchase_rate', '', 
 			function(r, rt) { 
 				refresh_field(cur_frm.cscript.fname);
@@ -176,7 +175,7 @@
 		'from_doctype': cur_frm.doc.doctype,
 		'to_doctype':'Purchase Receipt',
 		'from_docname':cur_frm.doc.name,
-		'from_to_list':"[['Purchase Order','Purchase Receipt'],['PO Detail','Purchase Receipt Detail'],['Purchase Tax Detail','Purchase Tax Detail']]"
+		'from_to_list':"[['Purchase Order','Purchase Receipt'],['Purchase Order Item','Purchase Receipt Item'],['Purchase Taxes and Charges','Purchase Taxes and Charges']]"
 		}, function(r,rt) {
 			 loaddoc('Purchase Receipt', n);
 		}
@@ -185,15 +184,15 @@
 
 //========================== Make Purchase Invoice =====================================================
 cur_frm.cscript['Make Purchase Invoice'] = function() {
-	n = createLocal('Payable Voucher');
+	n = createLocal('Purchase Invoice');
 	$c('dt_map', args={
-		'docs':compress_doclist([locals['Payable Voucher'][n]]),
+		'docs':compress_doclist([locals['Purchase Invoice'][n]]),
 		'from_doctype':cur_frm.doc.doctype,
-		'to_doctype':'Payable Voucher',
+		'to_doctype':'Purchase Invoice',
 		'from_docname': cur_frm.doc.name,
-		'from_to_list':"[['Purchase Order','Payable Voucher'],['PO Detail','PV Detail'],['Purchase Tax Detail','Purchase Tax Detail']]"
+		'from_to_list':"[['Purchase Order','Purchase Invoice'],['Purchase Order Item','Purchase Invoice Item'],['Purchase Taxes and Charges','Purchase Taxes and Charges']]"
 		}, function(r,rt) {
-			 loaddoc('Payable Voucher', n);
+			 loaddoc('Purchase Invoice', n);
 		}
 	);
 }
@@ -243,7 +242,7 @@
 
 	out ='';
 	
-	var cl = getchildren('PO Detail',doc.name,'po_details');
+	var cl = getchildren('Purchase Order Item',doc.name,'po_details');
 
 	// outer table	
 	var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 50%"></td><td>';
@@ -255,7 +254,7 @@
 	if(cl.length){
 		prevdoc_list = new Array();
 		for(var i=0;i<cl.length;i++){
-			if(cl[i].prevdoc_doctype == 'Indent' && cl[i].prevdoc_docname && prevdoc_list.indexOf(cl[i].prevdoc_docname) == -1) {
+			if(cl[i].prevdoc_doctype == 'Purchase Request' && cl[i].prevdoc_docname && prevdoc_list.indexOf(cl[i].prevdoc_docname) == -1) {
 				prevdoc_list.push(cl[i].prevdoc_docname);
 				if(prevdoc_list.length ==1)
 					out += make_row(cl[i].prevdoc_doctype, cl[i].prevdoc_docname, cl[i].prevdoc_date,0);
@@ -270,7 +269,6 @@
 	return out;
 }
 
-$import(Notification Control)
 cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
 	var args = {
 		type: 'Purchase Order',
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index 7945807..9466387 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -39,7 +39,7 @@
 		self.doc = doc
 		self.doclist = doclist
 		self.defaults = get_defaults()
-		self.tname = 'PO Detail'
+		self.tname = 'Purchase Order Item'
 		self.fname = 'po_details'
 
 	# Autoname
@@ -81,18 +81,16 @@
 	def get_bin_details(self, arg = ''):
 		return get_obj(dt='Purchase Common').get_bin_details(arg)
 
-	# Pull Indent
+	# Pull Purchase Request
 	def get_indent_details(self):
 		#self.validate_prev_docname() 
 		if self.doc.indent_no:
-			get_obj('DocType Mapper','Indent-Purchase Order').dt_map('Indent','Purchase Order',self.doc.indent_no, self.doc, self.doclist, "[['Indent','Purchase Order'],['Indent Detail', 'PO Detail']]")
+			get_obj('DocType Mapper','Purchase Request-Purchase Order').dt_map('Purchase Request','Purchase Order',self.doc.indent_no, self.doc, self.doclist, "[['Purchase Request','Purchase Order'],['Purchase Request Item', 'Purchase Order Item']]")
 			for d in getlist(self.doclist, 'po_details'):			
 				if d.item_code:
 					item = sql("select last_purchase_rate from tabItem where name = '%s'" %(d.item_code), as_dict=1)
 					d.purchase_rate = item and flt(item[0]['last_purchase_rate']) or 0
 					d.import_rate = flt(item and flt(item[0]['last_purchase_rate']) or 0) / flt(self.doc.fields.has_key('conversion_rate') and flt(self.doc.conversion_rate) or 1)
-		if self.doc.supplier_qtn:
-			get_obj('DocType Mapper','Supplier Quotation-Purchase Order').dt_map('Supplier Quotation','Purchase Order',self.doc.supplier_qtn, self.doc, self.doclist, "[['Supplier Quotation','Purchase Order'],['Supplier Quotation Detail', 'PO Detail']]")
 	
 	# GET TERMS & CONDITIONS
 	# =====================================================================================
@@ -115,12 +113,8 @@
 	# validation
 	#-------------------------------------------------------------------------------------------------------------
 	def validate_doc(self,pc_obj):
-		# Please Check Supplier Quotation - Purchase ORder Transaction , it has to be discussed
-		if self.doc.supp_quo_no:
-			pc_obj.validate_doc(obj = self, prevdoc_doctype = 'Supplier Quotation', prevdoc_docname = cstr(self.doc.supp_quo_no))
-		else:
-			# Validate values with reference document
-			pc_obj.validate_reference_value(obj = self)
+		# Validate values with reference document
+		pc_obj.validate_reference_value(obj = self)
 
 	# Check for Stopped status 
 	def check_for_stopped_status(self, pc_obj):
@@ -176,22 +170,22 @@
 				if is_stopped:
 					po_qty = flt(d.qty) > flt(d.received_qty) and flt( flt(flt(d.qty) - flt(d.received_qty)) * flt(d.conversion_factor))or 0 
 				
-				# No updates in Indent on Stop / Unstop
-				if cstr(d.prevdoc_doctype) == 'Indent' and not is_stopped:
+				# No updates in Purchase Request on Stop / Unstop
+				if cstr(d.prevdoc_doctype) == 'Purchase Request' and not is_stopped:
 					# get qty and pending_qty of prevdoc 
-					curr_ref_qty = pc_obj.get_qty( d.doctype, 'prevdoc_detail_docname', d.prevdoc_detail_docname, 'Indent Detail', 'Indent - Purchase Order', self.doc.name)
+					curr_ref_qty = pc_obj.get_qty( d.doctype, 'prevdoc_detail_docname', d.prevdoc_detail_docname, 'Purchase Request Item', 'Purchase Request - Purchase Order', self.doc.name)
 					max_qty, qty, curr_qty = flt(curr_ref_qty.split('~~~')[1]), flt(curr_ref_qty.split('~~~')[0]), 0
 					
 					if flt(qty) + flt(po_qty) > flt(max_qty):
 						curr_qty = flt(max_qty) - flt(qty)
-						# special case as there is no restriction for Indent - Purchase Order 
+						# special case as there is no restriction for Purchase Request - Purchase Order 
 						curr_qty = (curr_qty > 0) and curr_qty or 0
 					else:
 						curr_qty = flt(po_qty)
 					
 					ind_qty = -flt(curr_qty)
 
-				#==> Update Bin's Indent Qty by +- ind_qty and Ordered Qty by +- qty
+				#==> Update Bin's Purchase Request Qty by +- ind_qty and Ordered Qty by +- qty
 				get_obj('Warehouse', d.warehouse).update_bin(0, 0, (is_submit and 1 or -1) * flt(po_qty), (is_submit and 1 or -1) * flt(ind_qty), 0, d.item_code, self.doc.transaction_date)
 
 	def check_modified_date(self):
@@ -252,12 +246,12 @@
 		self.check_for_stopped_status(pc_obj)
 		
 		# 2.Check if Purchase Receipt has been submitted against current Purchase Order
-		pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Receipt', docname = self.doc.name, detail_doctype = 'Purchase Receipt Detail')
+		pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Receipt', docname = self.doc.name, detail_doctype = 'Purchase Receipt Item')
 
-		# 3.Check if Payable Voucher has been submitted against current Purchase Order
-		#pc_obj.check_docstatus(check = 'Next', doctype = 'Payable Voucher', docname = self.doc.name, detail_doctype = 'PV Detail')
+		# 3.Check if Purchase Invoice has been submitted against current Purchase Order
+		#pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Invoice', docname = self.doc.name, detail_doctype = 'Purchase Invoice Item')
 		
-		submitted = sql("select t1.name from `tabPayable Voucher` t1,`tabPV Detail` t2 where t1.name = t2.parent and t2.purchase_order = '%s' and t1.docstatus = 1" % self.doc.name)
+		submitted = sql("select t1.name from `tabPurchase Invoice` t1,`tabPurchase Invoice Item` t2 where t1.name = t2.parent and t2.purchase_order = '%s' and t1.docstatus = 1" % self.doc.name)
 		if submitted:
 			msgprint("Purchase Invoice : " + cstr(submitted[0][0]) + " has already been submitted !")
 			raise Exception
@@ -265,7 +259,7 @@
 		# 4.Set Status as Cancelled
 		set(self.doc,'status','Cancelled')
 
-		# 5.Update Indents Pending Qty and accordingly it's Status 
+		# 5.Update Purchase Requests Pending Qty and accordingly it's Status 
 		pc_obj.update_prevdoc_detail(self,is_submit = 0)
 		
 		# 6.Update Bin	
@@ -294,12 +288,12 @@
 					self.add_bom(d)
 				
 			self.delete_irrelevant_raw_material()
-			#---------------calculate amt in	PO Raw Material Detail-------------
+			#---------------calculate amt in	Purchase Order Item Supplied-------------
 			self.calculate_amount(d)
 			
 	def add_bom(self, d):
 		#----- fetching default bom from Bill of Materials instead of Item Master --
-		bom_det = sql("select t1.item, t2.item_code, t2.qty_consumed_per_unit, t2.moving_avg_rate, t2.value_as_per_mar, t2.stock_uom, t2.name, t2.parent from `tabBill Of Materials` t1, `tabBOM Material` t2 where t2.parent = t1.name and t1.item = '%s' and ifnull(t1.is_default,0) = 1 and t1.docstatus = 1" % d.item_code)
+		bom_det = sql("select t1.item, t2.item_code, t2.qty_consumed_per_unit, t2.moving_avg_rate, t2.value_as_per_mar, t2.stock_uom, t2.name, t2.parent from `tabBOM` t1, `tabBOM Item` t2 where t2.parent = t1.name and t1.item = '%s' and ifnull(t1.is_default,0) = 1 and t1.docstatus = 1" % d.item_code)
 		
 		if not bom_det:
 			msgprint("No default BOM exists for item: %s" % d.item_code)
@@ -308,9 +302,9 @@
 			#-------------- add child function--------------------
 			chgd_rqd_qty = []
 			for i in bom_det:
-				if i and not sql("select name from `tabPO Raw Material Detail` where reference_name = '%s' and bom_detail_no = '%s' and parent = '%s' " %(d.name, i[6], self.doc.name)):
+				if i and not sql("select name from `tabPurchase Order Item Supplied` where reference_name = '%s' and bom_detail_no = '%s' and parent = '%s' " %(d.name, i[6], self.doc.name)):
 
-					rm_child = addchild(self.doc, 'po_raw_material_details', 'PO Raw Material Detail', 1, self.doclist)
+					rm_child = addchild(self.doc, 'po_raw_material_details', 'Purchase Order Item Supplied', 1, self.doclist)
 
 					rm_child.reference_name = d.name
 					rm_child.bom_detail_no = i and i[6] or ''
@@ -340,7 +334,7 @@
 	#--------------------------------------------------------------	
 	def delete_irrelevant_raw_material(self):
 		for d in getlist(self.doclist,'po_raw_material_details'):
-			if not sql("select name from `tabPO Detail` where name = '%s' and parent = '%s'and item_code = '%s'" % (d.reference_name, self.doc.name, d.main_item_code)):
+			if not sql("select name from `tabPurchase Order Item` where name = '%s' and parent = '%s'and item_code = '%s'" % (d.reference_name, self.doc.name, d.main_item_code)):
 				d.parent = 'old_par:'+self.doc.name
 				d.save()
 		
@@ -369,8 +363,3 @@
 	# **** Pull details from other charges master (Get Other Charges) ****
 	def get_purchase_tax_details(self):
 		return get_obj('Purchase Common').get_purchase_tax_details(self)
-
-	# Repair Purchase Order
-	# ===========================================
-	def repair_purchase_order(self):
-		get_obj('Purchase Common', 'Purchase Common').repair_curr_doctype_details(self)
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.txt b/erpnext/buying/doctype/purchase_order/purchase_order.txt
index 0239370..ec6e776 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.txt
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.txt
@@ -3,29 +3,22 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:15',
+		'creation': '2012-04-11 13:17:34',
 		'docstatus': 0,
-		'modified': '2012-03-02 12:23:50',
+		'modified': '2012-04-12 18:11:33',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
 
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Purchase Order',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
 	# These values are common for all DocType
 	{
 		'_last_update': u'1330339817',
+		'allow_attach': 1,
 		'colour': u'White:FFF',
 		'default_print_format': u'Standard',
 		'doctype': 'DocType',
 		'document_type': u'Transaction',
+		'is_submittable': 1,
 		'is_transaction_doc': 1,
 		'module': u'Buying',
 		'name': '__common__',
@@ -35,15 +28,15 @@
 		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'subject': u'To %(supplier_name)s on %(transaction_date)s | %(per_received)s% delivered',
-		'version': 501
+		'version': 503
 	},
 
-	# These values are common for all DocFormat
+	# These values are common for all DocField
 	{
-		'doctype': u'DocFormat',
+		'doctype': u'DocField',
 		'name': '__common__',
 		'parent': u'Purchase Order',
-		'parentfield': u'formats',
+		'parentfield': u'fields',
 		'parenttype': u'DocType'
 	},
 
@@ -65,18 +58,6 @@
 
 	# DocPerm
 	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Production Manager',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
@@ -126,74 +107,44 @@
 	# DocPerm
 	{
 		'amend': 1,
-		'cancel': 0,
+		'cancel': 1,
 		'create': 1,
 		'doctype': u'DocPerm',
 		'permlevel': 0,
 		'role': u'Purchase User',
-		'submit': 0,
+		'submit': 1,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
 		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': u'All',
-		'submit': 0,
-		'write': 0
+		'role': u'All'
 	},
 
 	# DocPerm
 	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
 		'doctype': u'DocPerm',
+		'match': u'supplier',
 		'permlevel': 0,
-		'role': u'Supplier',
-		'submit': 0,
-		'write': 0
+		'role': u'Supplier'
 	},
 
 	# DocPerm
 	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
 		'doctype': u'DocPerm',
 		'permlevel': 2,
 		'role': u'All',
-		'submit': 0,
 		'write': 1
 	},
 
-	# DocFormat
-	{
-		'doctype': u'DocFormat',
-		'format': u'Purchase Order Classic'
-	},
-
-	# DocFormat
-	{
-		'doctype': u'DocFormat',
-		'format': u'Purchase Order Modern'
-	},
-
-	# DocFormat
-	{
-		'doctype': u'DocFormat',
-		'format': u'Purchase Order Spartan'
-	},
-
 	# DocField
 	{
 		'colour': u'White:FFF',
 		'description': u'Enter rates and quantity of items you want to purchase and send the purchase order to your supplier.',
 		'doctype': u'DocField',
+		'fieldname': u'basic_info',
 		'fieldtype': u'Section Break',
 		'label': u'Basic Info',
 		'oldfieldtype': u'Section Break',
@@ -204,6 +155,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -319,6 +271,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break1',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -426,6 +379,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'items',
 		'fieldtype': u'Section Break',
 		'label': u'Items',
 		'oldfieldtype': u'Section Break',
@@ -435,6 +389,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break2',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'width': u'50%'
@@ -479,6 +434,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break3',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'width': u'50%'
@@ -496,7 +452,7 @@
 		'no_copy': 1,
 		'oldfieldname': u'indent_no',
 		'oldfieldtype': u'Link',
-		'options': u'Indent',
+		'options': u'Purchase Request',
 		'permlevel': 0,
 		'print_hide': 1
 	},
@@ -504,6 +460,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'get_items',
 		'fieldtype': u'Button',
 		'hidden': 0,
 		'label': u'Get Items',
@@ -515,6 +472,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'section_break0',
 		'fieldtype': u'Section Break',
 		'permlevel': 0
 	},
@@ -525,11 +483,11 @@
 		'doctype': u'DocField',
 		'fieldname': u'po_details',
 		'fieldtype': u'Table',
-		'label': u'PO Details',
+		'label': u'Purchase Order Items',
 		'no_copy': 0,
 		'oldfieldname': u'po_details',
 		'oldfieldtype': u'Table',
-		'options': u'PO Detail',
+		'options': u'Purchase Order Item',
 		'permlevel': 0
 	},
 
@@ -537,6 +495,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'get_last_purchase_rate',
 		'fieldtype': u'Button',
 		'label': u'Get Last Purchase Rate',
 		'oldfieldtype': u'Button',
@@ -562,6 +521,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'recalculate_values',
 		'fieldtype': u'Button',
 		'label': u'Re-Calculate Values',
 		'oldfieldtype': u'Button',
@@ -573,6 +533,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'taxes',
 		'fieldtype': u'Section Break',
 		'label': u'Taxes',
 		'oldfieldtype': u'Section Break',
@@ -582,15 +543,15 @@
 	# DocField
 	{
 		'colour': u'White:FFF',
-		'description': u'If you have created a standard template in Other Charges master, select one and click on the button below.',
+		'description': u'If you have created a standard template in Purchase Taxes and Charges Master, select one and click on the button below.',
 		'doctype': u'DocField',
 		'fieldname': u'purchase_other_charges',
 		'fieldtype': u'Link',
-		'label': u'Purchase Other Charges',
+		'label': u'Purchase Taxes and Charges',
 		'no_copy': 1,
 		'oldfieldname': u'purchase_other_charges',
 		'oldfieldtype': u'Link',
-		'options': u'Purchase Other Charges',
+		'options': u'Purchase Taxes and Charges Master',
 		'permlevel': 0,
 		'print_hide': 1
 	},
@@ -598,6 +559,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'get_tax_detail',
 		'fieldtype': u'Button',
 		'label': u'Get Tax Detail',
 		'oldfieldtype': u'Button',
@@ -611,17 +573,18 @@
 		'doctype': u'DocField',
 		'fieldname': u'purchase_tax_details',
 		'fieldtype': u'Table',
-		'label': u'Purchase Tax Details',
+		'label': u'Purchase Taxes and Charges',
 		'no_copy': 0,
 		'oldfieldname': u'purchase_tax_details',
 		'oldfieldtype': u'Table',
-		'options': u'Purchase Tax Detail',
+		'options': u'Purchase Taxes and Charges',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'calculate_tax',
 		'fieldtype': u'Button',
 		'label': u'Calculate Tax',
 		'oldfieldtype': u'Button',
@@ -633,6 +596,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'tax_calculation',
 		'fieldtype': u'HTML',
 		'label': u'Tax Calculation',
 		'no_copy': 1,
@@ -658,6 +622,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'totals',
 		'fieldtype': u'Section Break',
 		'label': u'Totals',
 		'oldfieldtype': u'Section Break',
@@ -708,7 +673,7 @@
 		'doctype': u'DocField',
 		'fieldname': u'other_charges_added',
 		'fieldtype': u'Currency',
-		'label': u'Other Charges Added',
+		'label': u'Taxes and Charges Added',
 		'no_copy': 0,
 		'oldfieldname': u'other_charges_added',
 		'oldfieldtype': u'Currency',
@@ -721,7 +686,7 @@
 		'doctype': u'DocField',
 		'fieldname': u'other_charges_deducted',
 		'fieldtype': u'Currency',
-		'label': u'Other Charges Deducted',
+		'label': u'Taxes and Charges Deducted',
 		'no_copy': 0,
 		'oldfieldname': u'other_charges_deducted',
 		'oldfieldtype': u'Currency',
@@ -732,6 +697,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break4',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -783,7 +749,7 @@
 		'doctype': u'DocField',
 		'fieldname': u'other_charges_added_import',
 		'fieldtype': u'Currency',
-		'label': u'Other Charges Added (Import)',
+		'label': u'Taxes and Charges Added (Import)',
 		'no_copy': 0,
 		'oldfieldname': u'other_charges_added_import',
 		'oldfieldtype': u'Currency',
@@ -797,7 +763,7 @@
 		'doctype': u'DocField',
 		'fieldname': u'other_charges_deducted_import',
 		'fieldtype': u'Currency',
-		'label': u'Other Charges Deducted (Import)',
+		'label': u'Taxes and Charges Deducted (Import)',
 		'no_copy': 0,
 		'oldfieldname': u'other_charges_deducted_import',
 		'oldfieldtype': u'Currency',
@@ -809,8 +775,9 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'terms_section_break',
 		'fieldtype': u'Section Break',
-		'label': u'Terms',
+		'label': u'Terms and Conditions',
 		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
@@ -834,10 +801,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'tc_name',
 		'fieldtype': u'Link',
-		'label': u'Select Terms',
+		'label': u'Select Terms and Conditions',
 		'oldfieldname': u'tc_name',
 		'oldfieldtype': u'Link',
-		'options': u'Term',
+		'options': u'Terms and Conditions',
 		'permlevel': 0,
 		'print_hide': 1
 	},
@@ -845,8 +812,9 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'get_terms',
 		'fieldtype': u'Button',
-		'label': u'Get Terms',
+		'label': u'Get Terms and Conditions',
 		'oldfieldtype': u'Button',
 		'options': u'get_tc_details',
 		'permlevel': 0
@@ -855,8 +823,9 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'terms_html',
 		'fieldtype': u'HTML',
-		'label': u'Terms HTML',
+		'label': u'Terms and Conditions HTML',
 		'oldfieldtype': u'HTML',
 		'options': u'You can add Terms and Notes that will be printed in the Transaction',
 		'permlevel': 0,
@@ -868,7 +837,7 @@
 		'doctype': u'DocField',
 		'fieldname': u'terms',
 		'fieldtype': u'Text Editor',
-		'label': u'Terms1',
+		'label': u'Terms and Conditions1',
 		'oldfieldname': u'terms',
 		'oldfieldtype': u'Text Editor',
 		'permlevel': 0
@@ -877,6 +846,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'more_info',
 		'fieldtype': u'Section Break',
 		'label': u'More Info',
 		'oldfieldtype': u'Section Break',
@@ -994,6 +964,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break5',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -1049,6 +1020,7 @@
 		'colour': u'White:FFF',
 		'description': u'Required raw materials issued to the supplier for producing a sub - contracted item.',
 		'doctype': u'DocField',
+		'fieldname': u'raw_material_details',
 		'fieldtype': u'Section Break',
 		'label': u'Raw Material Details',
 		'oldfieldtype': u'Section Break',
@@ -1062,23 +1034,23 @@
 		'doctype': u'DocField',
 		'fieldname': u'po_raw_material_details',
 		'fieldtype': u'Table',
-		'label': u'PO Raw Material Details',
+		'label': u'Purchase Order Items Supplied',
 		'no_copy': 0,
 		'oldfieldname': u'po_raw_material_details',
 		'oldfieldtype': u'Table',
-		'options': u'PO Raw Material Detail',
+		'options': u'Purchase Order Item Supplied',
 		'permlevel': 1,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'allow_on_submit': 1,
 		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Repair Purchase Order',
-		'oldfieldtype': u'Button',
-		'options': u'repair_purchase_order',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
+		'hidden': 1,
+		'label': u'File List',
+		'no_copy': 1,
 		'permlevel': 0,
 		'print_hide': 1
 	}
diff --git a/erpnext/buying/doctype/purchase_other_charges/__init__.py b/erpnext/buying/doctype/purchase_order_item/__init__.py
similarity index 100%
rename from erpnext/buying/doctype/purchase_other_charges/__init__.py
rename to erpnext/buying/doctype/purchase_order_item/__init__.py
diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.txt b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.txt
new file mode 100755
index 0000000..499cdef
--- /dev/null
+++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.txt
@@ -0,0 +1,456 @@
+# DocType, Purchase Order Item
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:50',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:50',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'POD/.#####',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Buying',
+		'name': '__common__',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 65
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Purchase Order Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Purchase Order Item
+	{
+		'doctype': 'DocType',
+		'name': u'Purchase Order Item'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'schedule_date',
+		'fieldtype': u'Date',
+		'hidden': 0,
+		'in_filter': 1,
+		'label': u'Reqd By Date',
+		'no_copy': 1,
+		'oldfieldname': u'schedule_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 0,
+		'print_hide': 0,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_name',
+		'fieldtype': u'Data',
+		'hidden': 0,
+		'in_filter': 1,
+		'label': u'Item Name',
+		'oldfieldname': u'item_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Small Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0,
+		'reqd': 1,
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'qty',
+		'fieldtype': u'Currency',
+		'label': u'Quantity',
+		'oldfieldname': u'qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'reqd': 1,
+		'trigger': u'Client',
+		'width': u'60px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'import_ref_rate',
+		'fieldtype': u'Currency',
+		'label': u'Ref Rate ',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'discount_rate',
+		'fieldtype': u'Currency',
+		'label': u'Discount %',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'import_rate',
+		'fieldtype': u'Currency',
+		'hidden': 0,
+		'label': u'Rate ',
+		'oldfieldname': u'import_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'import_amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount',
+		'oldfieldname': u'import_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'purchase_ref_rate',
+		'fieldtype': u'Currency',
+		'label': u'Ref Rate *',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'purchase_rate',
+		'fieldtype': u'Currency',
+		'label': u'Rate (Default Curr.) *',
+		'oldfieldname': u'purchase_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount  (Default Curr.)',
+		'oldfieldname': u'amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'warehouse',
+		'fieldtype': u'Link',
+		'hidden': 0,
+		'label': u'Warehouse',
+		'oldfieldname': u'warehouse',
+		'oldfieldtype': u'Link',
+		'options': u'Warehouse',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'project_name',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Project Name',
+		'options': u'Project',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'uom',
+		'fieldtype': u'Link',
+		'label': u'UOM',
+		'oldfieldname': u'uom',
+		'oldfieldtype': u'Link',
+		'options': u'UOM',
+		'permlevel': 0,
+		'print_hide': 0,
+		'reqd': 1,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'conversion_factor',
+		'fieldtype': u'Currency',
+		'hidden': 0,
+		'label': u'UOM Conversion Factor',
+		'oldfieldname': u'conversion_factor',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'stock_uom',
+		'fieldtype': u'Data',
+		'hidden': 0,
+		'label': u'Stock UOM',
+		'oldfieldname': u'stock_uom',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'reqd': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_doctype',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Prevdoc DocType',
+		'no_copy': 0,
+		'oldfieldname': u'prevdoc_doctype',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_docname',
+		'fieldtype': u'Link',
+		'hidden': 0,
+		'in_filter': 1,
+		'label': u'Purchase Requisition No',
+		'no_copy': 0,
+		'oldfieldname': u'prevdoc_docname',
+		'oldfieldtype': u'Link',
+		'options': u'Purchase Request',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1,
+		'width': u'120px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_date',
+		'fieldtype': u'Date',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Purchase Requisition Date',
+		'oldfieldname': u'prevdoc_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_detail_docname',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Purchase Requisition Detail No',
+		'no_copy': 0,
+		'oldfieldname': u'prevdoc_detail_docname',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'brand',
+		'fieldtype': u'Link',
+		'hidden': 1,
+		'label': u'Brand',
+		'oldfieldname': u'brand',
+		'oldfieldtype': u'Link',
+		'options': u'Brand',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_group',
+		'fieldtype': u'Link',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Item Group',
+		'oldfieldname': u'item_group',
+		'oldfieldtype': u'Link',
+		'options': u'Item Group',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'stock_qty',
+		'fieldtype': u'Currency',
+		'hidden': 0,
+		'label': u'Stock Qty',
+		'no_copy': 1,
+		'oldfieldname': u'stock_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'received_qty',
+		'fieldtype': u'Currency',
+		'hidden': 0,
+		'label': u'Received Qty',
+		'no_copy': 1,
+		'oldfieldname': u'received_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'billed_qty',
+		'fieldtype': u'Currency',
+		'hidden': 0,
+		'label': u'Billed Quantity',
+		'no_copy': 1,
+		'oldfieldname': u'billed_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges',
+		'doctype': u'DocField',
+		'fieldname': u'item_tax_rate',
+		'fieldtype': u'Small Text',
+		'hidden': 1,
+		'label': u'Item Tax Rate',
+		'oldfieldname': u'item_tax_rate',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'doctype': u'DocField',
+		'fieldname': u'page_break',
+		'fieldtype': u'Check',
+		'hidden': 0,
+		'label': u'Page Break',
+		'no_copy': 1,
+		'oldfieldname': u'page_break',
+		'oldfieldtype': u'Check',
+		'permlevel': 0,
+		'print_hide': 1
+	}
+]
diff --git a/erpnext/buying/doctype/purchase_other_charges/__init__.py b/erpnext/buying/doctype/purchase_order_item_supplied/__init__.py
similarity index 100%
copy from erpnext/buying/doctype/purchase_other_charges/__init__.py
copy to erpnext/buying/doctype/purchase_order_item_supplied/__init__.py
diff --git a/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.txt b/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.txt
new file mode 100644
index 0000000..eb529c4
--- /dev/null
+++ b/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.txt
@@ -0,0 +1,144 @@
+# DocType, Purchase Order Item Supplied
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:50',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:50',
+		'modified_by': u'Administrator',
+		'owner': u'dhanalekshmi@webnotestech.com'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'hide_toolbar': 1,
+		'istable': 1,
+		'module': u'Buying',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 1
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Purchase Order Item Supplied',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Purchase Order Item Supplied
+	{
+		'doctype': 'DocType',
+		'name': u'Purchase Order Item Supplied'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'reference_name',
+		'fieldtype': u'Data',
+		'hidden': 0,
+		'in_filter': 0,
+		'label': u'Reference Name',
+		'oldfieldname': u'reference_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'bom_detail_no',
+		'fieldtype': u'Data',
+		'label': u'BOM Detail No',
+		'oldfieldname': u'bom_detail_no',
+		'oldfieldtype': u'Data',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'main_item_code',
+		'fieldtype': u'Data',
+		'label': u'Item Code',
+		'oldfieldname': u'main_item_code',
+		'oldfieldtype': u'Data',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'rm_item_code',
+		'fieldtype': u'Data',
+		'label': u'Raw Material Item Code',
+		'oldfieldname': u'rm_item_code',
+		'oldfieldtype': u'Data',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'required_qty',
+		'fieldtype': u'Currency',
+		'label': u'Required Qty',
+		'oldfieldname': u'required_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'rate',
+		'fieldtype': u'Currency',
+		'label': u'Rate',
+		'oldfieldname': u'rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount',
+		'oldfieldname': u'amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'conversion_factor',
+		'fieldtype': u'Currency',
+		'hidden': 1,
+		'label': u'Conversion Factor',
+		'oldfieldname': u'conversion_factor',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'stock_uom',
+		'fieldtype': u'Data',
+		'label': u'Stock Uom',
+		'oldfieldname': u'stock_uom',
+		'oldfieldtype': u'Data',
+		'permlevel': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.js b/erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.js
deleted file mode 100644
index f0b4ae2..0000000
--- a/erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.js
+++ /dev/null
@@ -1,175 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-// 
-
-//--------- ONLOAD -------------
-cur_frm.cscript.onload = function(doc, cdt, cdn) {
-   
-}
-
-cur_frm.cscript.refresh = function(doc, cdt, cdn) {
-   
-}
-
-cur_frm.pformat.purchase_tax_details= function(doc){
- 
-  //function to make row of table
-  var make_row = function(title,val,bold){
-    var bstart = '<b>'; var bend = '</b>';
-    return '<tr><td style="width:50%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
-     +'<td style="width:25%;text-align:right;">'+doc.currency+'</td>'
-     +'<td style="width:25%;text-align:right;">'+val+'</td>'
-     +'</tr>'
-  }
-
-  function convert_rate(val){
-    var new_val = flt(val)/flt(doc.conversion_rate);
-    return new_val;
-  }
-
-  var cl = getchildren('Purchase Tax Detail',doc.name,'purchase_tax_details');
-
-  // outer table  
-  var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';
-  
-  // main table
-  out +='<table class="noborder" style="width:100%">'+make_row('Net Total',fmt_money(convert_rate(doc.net_total)),1);
-
-  // add rows
-  if(cl.length){
-    for(var i=0;i<cl.length;i++){
-      out += make_row(cl[i].description,fmt_money(convert_rate(cl[i].tax_amount)),0);
-    }
-  }
-  
-  // grand total
-  out +=make_row('Grand Total',fmt_money(doc.grand_total_import),1)
-  if(doc.in_words_import){
-    out +='</table></td></tr>';
-    out += '<tr><td colspan = "2">';
-    out += '<table><tr><td style="width:25%;"><b>In Words</b></td>';
-    out+= '<td style="width:50%;">'+doc.in_words_import+'</td></tr>';
-  }
-  out +='</table></td></tr></table></div>';   
-  return out;
-}
-
-cur_frm.cscript.add_deduct_tax = function(doc, cdt, cdn) {
-  var d = locals[cdt][cdn];
-  if(!d.category && d.add_deduct_tax){
-    alert("Please select Category first");
-    d.add_deduct_tax = '';
-  }
-  else if(d.category != 'For Total' && d.add_deduct_tax == 'Deduct'){
-    alert("You cannot Deduct when category is for valuation or for both(i.e total and valuation)");
-    d.add_deduct_tax = '';
-  }
-
-}
-
-cur_frm.cscript.charge_type = function(doc, cdt, cdn) {
-  var d = locals[cdt][cdn];
-  if(!d.category && d.charge_type){
-    alert("Please select Category first");
-    d.charge_type = '';
-  }  
-  else if(d.idx == 1 && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){
-    alert("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row");
-    d.charge_type = '';
-  }
-  else if((d.category == 'For Valuation' || d.category == 'For Both') && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){
-    alert("You cannot select charge type as 'On Previous Row Amount' or 'On Previous Row Total' for valuation. You can select only 'For Total' option for previous row amount or previous row total")
-    d.charge_type = '';
-  }
-  validated = false;
-  refresh_field('charge_type',d.name,'purchase_tax_details');
-
-  cur_frm.cscript.row_id(doc, cdt, cdn);
-  cur_frm.cscript.rate(doc, cdt, cdn);
-  cur_frm.cscript.tax_amount(doc, cdt, cdn);
-}
-
-
-cur_frm.cscript.row_id = function(doc, cdt, cdn) {
-  var d = locals[cdt][cdn];
-  if(!d.charge_type && d.row_id){
-    alert("Please select Charge Type first");
-    d.row_id = '';
-  }
-  else if((d.charge_type == 'Actual' || d.charge_type == 'On Net Total') && d.row_id) {
-    alert("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'");
-    d.row_id = '';
-  }
-  else if((d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total') && d.row_id){
-    if(d.row_id >= d.idx){
-      alert("You cannot Enter Row no. greater than or equal to current row no. for this Charge type");
-      d.row_id = '';
-    }
-  }
-  validated = false;
-  refresh_field('row_id',d.name,'purchase_tax_details');
-}
-
-/*---------------------- Get rate if account_head has account_type as TAX or CHARGEABLE-------------------------------------*/
-
-cur_frm.fields_dict['purchase_tax_details'].grid.get_field("account_head").get_query = function(doc,cdt,cdn) {
-  return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type = "Tax" OR tabAccount.account_type = "Chargeable" or (tabAccount.is_pl_account = "Yes" and tabAccount.debit_or_credit = "Debit")) AND tabAccount.company = "' + doc.company + '" AND  tabAccount.name LIKE "%s"'
-}
-
-
-cur_frm.fields_dict['purchase_tax_details'].grid.get_field("cost_center").get_query = function(doc) {
-	return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY	`tabCost Center`.`name` ASC LIMIT 50';
-}
-
-
-cur_frm.cscript.account_head = function(doc, cdt, cdn) {
-  var d = locals[cdt][cdn];
-  if(!d.charge_type && d.account_head){
-    alert("Please select Charge Type first");
-    validated = false;
-    d.account_head = '';
-  }
-  else if(d.account_head && d.charge_type) {
-    arg = "{'charge_type' : '" + d.charge_type +"', 'account_head' : '" + d.account_head + "'}";
-    get_server_fields('get_rate', arg, 'purchase_tax_details', doc, cdt, cdn, 1);
-  }
-  refresh_field('account_head',d.name,'purchase_tax_details');
-}
-
-cur_frm.cscript.rate = function(doc, cdt, cdn) {
-  var d = locals[cdt][cdn];
-  if(!d.charge_type && d.rate) {
-    alert("Please select Charge Type first");
-    d.rate = '';
-  }
-  validated = false;
-  refresh_field('rate',d.name,'purchase_tax_details');
-}
-
-cur_frm.cscript.tax_amount = function(doc, cdt, cdn) {
-  var d = locals[cdt][cdn];
-  if(!d.charge_type && d.tax_amount){
-    alert("Please select Charge Type first");
-    d.tax_amount = '';
-  }
-  else if(d.charge_type && d.tax_amount) {
-    alert("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate");
-    d.tax_amount = '';
-  }
-  validated = false;
-  refresh_field('tax_amount',d.name,'purchase_tax_details');
-}
diff --git a/erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.txt b/erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.txt
deleted file mode 100644
index 8be1359..0000000
--- a/erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.txt
+++ /dev/null
@@ -1,130 +0,0 @@
-# DocType, Purchase Other Charges
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:15',
-		'docstatus': 0,
-		'modified': '2012-01-24 12:42:18',
-		'modified_by': 'Administrator',
-		'owner': 'wasim@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': '1325570646',
-		'allow_trash': 1,
-		'autoname': 'field:title',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
-		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'Buying',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 18
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Purchase Other Charges',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'Purchase Other Charges',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1
-	},
-
-	# DocType, Purchase Other Charges
-	{
-		'doctype': 'DocType',
-		'name': 'Purchase Other Charges'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'permlevel': 1,
-		'role': 'All'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'Purchase Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'System Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'Purchase Master Manager',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'title',
-		'fieldtype': 'Data',
-		'in_filter': 1,
-		'label': 'Title',
-		'oldfieldname': 'title',
-		'oldfieldtype': 'Data',
-		'reqd': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Link',
-		'in_filter': 1,
-		'label': 'Company',
-		'options': 'Company',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'purchase_tax_details',
-		'fieldtype': 'Table',
-		'label': 'Purchase Tax Details',
-		'oldfieldname': 'purchase_tax_details',
-		'oldfieldtype': 'Table',
-		'options': 'Purchase Tax Detail'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/doctype/purchase_other_charges/__init__.py b/erpnext/buying/doctype/purchase_receipt_item_supplied/__init__.py
similarity index 100%
copy from erpnext/buying/doctype/purchase_other_charges/__init__.py
copy to erpnext/buying/doctype/purchase_receipt_item_supplied/__init__.py
diff --git a/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.txt b/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.txt
new file mode 100644
index 0000000..602bb25
--- /dev/null
+++ b/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.txt
@@ -0,0 +1,179 @@
+# DocType, Purchase Receipt Item Supplied
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:50',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:50',
+		'modified_by': u'Administrator',
+		'owner': u'wasim@webnotestech.com'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'hide_toolbar': 0,
+		'istable': 1,
+		'module': u'Buying',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 17
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Purchase Receipt Item Supplied',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Purchase Receipt Item Supplied
+	{
+		'doctype': 'DocType',
+		'name': u'Purchase Receipt Item Supplied'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'reference_name',
+		'fieldtype': u'Data',
+		'hidden': 0,
+		'in_filter': 0,
+		'label': u'Reference Name',
+		'oldfieldname': u'reference_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'bom_detail_no',
+		'fieldtype': u'Data',
+		'label': u'BOM Detail No',
+		'oldfieldname': u'bom_detail_no',
+		'oldfieldtype': u'Data',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'main_item_code',
+		'fieldtype': u'Data',
+		'label': u'Item Code',
+		'oldfieldname': u'main_item_code',
+		'oldfieldtype': u'Data',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'rm_item_code',
+		'fieldtype': u'Data',
+		'label': u'Raw Material Item Code',
+		'oldfieldname': u'rm_item_code',
+		'oldfieldtype': u'Data',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Data',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'required_qty',
+		'fieldtype': u'Currency',
+		'label': u'Required Qty',
+		'oldfieldname': u'required_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'consumed_qty',
+		'fieldtype': u'Currency',
+		'label': u'Consumed Qty',
+		'oldfieldname': u'consumed_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'rate',
+		'fieldtype': u'Currency',
+		'label': u'Rate',
+		'oldfieldname': u'rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'conversion_factor',
+		'fieldtype': u'Currency',
+		'hidden': 1,
+		'label': u'Conversion Factor',
+		'oldfieldname': u'conversion_factor',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount',
+		'oldfieldname': u'amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'stock_uom',
+		'fieldtype': u'Data',
+		'label': u'Stock Uom',
+		'oldfieldname': u'stock_uom',
+		'oldfieldtype': u'Data',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'current_stock',
+		'fieldtype': u'Currency',
+		'label': u'Current Stock',
+		'oldfieldname': u'current_stock',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/buying/doctype/purchase_other_charges/__init__.py b/erpnext/buying/doctype/purchase_request/__init__.py
similarity index 100%
copy from erpnext/buying/doctype/purchase_other_charges/__init__.py
copy to erpnext/buying/doctype/purchase_request/__init__.py
diff --git a/erpnext/buying/doctype/purchase_request/listview.js b/erpnext/buying/doctype/purchase_request/listview.js
new file mode 100644
index 0000000..5e35bf1
--- /dev/null
+++ b/erpnext/buying/doctype/purchase_request/listview.js
@@ -0,0 +1,33 @@
+// render
+wn.doclistviews['Purchase Request'] = wn.views.ListView.extend({
+	init: function(d) {
+		this._super(d)
+		this.fields = this.fields.concat([
+			"`tabPurchase Request`.status",
+			"IFNULL(`tabPurchase Request`.per_ordered, 0) as per_ordered",
+			"`tabPurchase Request`.remark",
+		]);
+		this.stats = this.stats.concat(['status', 'company']);
+	},
+
+	prepare_data: function(data) {
+		this._super(data);
+		if(['Stopped', 'Cancelled'].indexOf(data.status)!=-1) {
+			data.label_type = 'important';
+		} else if(data.status == 'Submitted') {
+			data.label_type = 'success';
+		}
+
+		data.status_html = repl('<span class="label label-%(label_type)s">%(status)s</span>', data);
+	},
+	
+	columns: [
+		{width: '5%', content:'avatar'},
+		{width: '3%', content:'docstatus'},
+		{width: '17%', content:'name'},
+		{width: '53%', content:'status_html+tags+remark', css: {'color': '#aaa'}},
+		{width: '10%', content: 'per_ordered', type:'bar-graph', label:'Ordered'},
+		{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
+	]
+});
+
diff --git a/erpnext/buying/doctype/purchase_request/purchase_request.js b/erpnext/buying/doctype/purchase_request/purchase_request.js
new file mode 100644
index 0000000..d20d50a
--- /dev/null
+++ b/erpnext/buying/doctype/purchase_request/purchase_request.js
@@ -0,0 +1,134 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+cur_frm.cscript.tname = "Purchase Request Item";
+cur_frm.cscript.fname = "indent_details";
+
+wn.require('erpnext/buying/doctype/purchase_common/purchase_common.js');
+wn.require('erpnext/utilities/doctype/sms_control/sms_control.js');
+	
+//========================== On Load =================================================
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+	if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date())
+	if (!doc.status) doc.status = 'Draft';
+
+	// defined in purchase_common.js
+	//cur_frm.cscript.update_item_details(doc, cdt, cdn);
+}
+
+cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
+	// second call
+	if(doc.__islocal){ 
+		cur_frm.cscript.get_item_defaults(doc);
+	}	
+}
+
+cur_frm.cscript.get_item_defaults = function(doc) {
+		var ch = getchildren( 'Purchase Request Item', doc.name, 'indent_details');
+		if (flt(ch.length) > 0){
+			$c_obj(make_doclist(doc.doctype, doc.name), 'get_item_defaults', '', function(r, rt) {refresh_field('indent_details'); });
+		}
+}
+
+
+//======================= Refresh =====================================
+cur_frm.cscript.refresh = function(doc, cdt, cdn) { 
+
+	// Unhide Fields in Next Steps
+	// ---------------------------------
+	
+	cur_frm.clear_custom_buttons();
+
+	if(doc.docstatus == 1 && doc.status != 'Stopped'){
+		var ch = getchildren('Purchase Request Item',doc.name,'indent_details');
+		var is_closed = 1;
+		for(var i in ch){
+			if(flt(ch[i].qty) > flt(ch[i].ordered_qty)) is_closed = 0;
+		}
+		if(!is_closed) {
+			cur_frm.add_custom_button('Make Purchase Order', cur_frm.cscript['Make Purchase Order'])
+			cur_frm.add_custom_button('Stop Purchase Request', cur_frm.cscript['Stop Purchase Request'])
+		}
+		cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
+	}
+ 
+	if(doc.docstatus == 1 && doc.status == 'Stopped')
+		cur_frm.add_custom_button('Unstop Purchase Request', cur_frm.cscript['Unstop Purchase Request'])
+}
+
+//======================= validation ===================================
+cur_frm.cscript.validate = function(doc,cdt,cdn){
+	is_item_table(doc,cdt,cdn);
+}
+//======================= transaction date =============================
+cur_frm.cscript.transaction_date = function(doc,cdt,cdn){
+	if(doc.__islocal){ 
+		cur_frm.cscript.get_default_schedule_date(doc);
+	}
+}
+
+//=================== Quantity ===================================================================
+cur_frm.cscript.qty = function(doc, cdt, cdn) {
+	var d = locals[cdt][cdn];
+	if (flt(d.qty) < flt(d.min_order_qty))
+		alert("Warning: Purchase Requested Qty is less than Minimum Order Qty");
+}
+
+// On Button Click Functions
+// ------------------------------------------------------------------------------
+
+// Make Purchase Order
+cur_frm.cscript['Make Purchase Order'] = function() {
+	var doc = cur_frm.doc;
+	n = createLocal('Purchase Order');
+	$c('dt_map', args={
+		'docs':compress_doclist([locals['Purchase Order'][n]]),
+		'from_doctype':doc.doctype,
+		'to_doctype':'Purchase Order',
+		'from_docname':doc.name,
+		'from_to_list':"[['Purchase Request','Purchase Order'],['Purchase Request Item','Purchase Order Item']]"
+		}, function(r,rt) {
+			 loaddoc('Purchase Order', n);
+		}
+	);
+}
+
+// Stop INDENT
+// ==================================================================================================
+cur_frm.cscript['Stop Purchase Request'] = function() {
+	var doc = cur_frm.doc;
+	var check = confirm("Do you really want to STOP this Purchase Request?");
+
+	if (check) {
+		$c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+			cur_frm.refresh();
+		});
+	}
+}
+
+// Un Stop INDENT
+//====================================================================================================
+cur_frm.cscript['Unstop Purchase Request'] = function(){
+	var doc = cur_frm.doc
+	var check = confirm("Do you really want to UNSTOP this Purchase Request?");
+	
+	if (check) {
+		$c('runserverobj', args={'method':'update_status', 'arg': 'Submitted','docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+			cur_frm.refresh();
+			
+		});
+	}
+}
diff --git a/erpnext/buying/doctype/purchase_request/purchase_request.py b/erpnext/buying/doctype/purchase_request/purchase_request.py
new file mode 100644
index 0000000..b96ff18
--- /dev/null
+++ b/erpnext/buying/doctype/purchase_request/purchase_request.py
@@ -0,0 +1,233 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self, doc, doclist=[]):
+		self.doc = doc
+		self.doclist = doclist
+		self.defaults = get_defaults()
+		self.tname = 'Purchase Request Item'
+		self.fname = 'indent_details'
+
+	# Autoname
+	# ---------
+	def autoname(self):
+		self.doc.name = make_autoname(self.doc.naming_series+'.#####')
+
+
+	def get_default_schedule_date(self):
+		get_obj(dt = 'Purchase Common').get_default_schedule_date(self)
+	
+	# get available qty at warehouse
+	def get_bin_details(self, arg = ''):
+		return get_obj(dt='Purchase Common').get_bin_details(arg)
+
+	# Pull Sales Order Items
+	# -------------------------
+	def pull_so_details(self):
+		self.check_if_already_pulled()
+		if self.doc.sales_order_no:
+			get_obj('DocType Mapper', 'Sales Order-Purchase Request', with_children=1).dt_map('Sales Order', 'Purchase Request', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Purchase Request'],['Sales Order Item', 'Purchase Request Item']]")
+			self.get_item_defaults()
+		else:
+			msgprint("Please select Sales Order whose details need to pull")
+
+	def check_if_already_pulled(self):
+		pass#if self.[d.sales_order_no for d in getlist(self.doclist, 'indent_details')]
+
+
+	# Get item's other details
+	#- ------------------------
+	def get_item_defaults(self):
+		self.get_default_schedule_date()
+		for d in getlist(self.doclist, 'indent_details'):
+			det = sql("select min_order_qty from tabItem where name = '%s'" % d.item_code)
+			d.min_order_qty = det and flt(det[0][0]) or 0
+
+	# Validate so items
+	# ----------------------------
+	def validate_qty_against_so(self):
+		so_items = {} # Format --> {'SO/00001': {'Item/001': 120, 'Item/002': 24}}
+		for d in getlist(self.doclist, 'indent_details'):
+			if d.sales_order_no:
+				if not so_items.has_key(d.sales_order_no):
+					so_items[d.sales_order_no] = {d.item_code: flt(d.qty)}
+				else:
+					if not so_items[d.sales_order_no].has_key(d.item_code):
+						so_items[d.sales_order_no][d.item_code] = flt(d.qty)
+					else:
+						so_items[d.sales_order_no][d.item_code] += flt(d.qty)
+		
+		for so_no in so_items.keys():
+			for item in so_items[so_no].keys():
+				already_indented = sql("select sum(qty) from `tabPurchase Request Item` where item_code = '%s' and sales_order_no = '%s' and docstatus = 1 and parent != '%s'" % (item, so_no, self.doc.name))
+				already_indented = already_indented and flt(already_indented[0][0]) or 0
+				
+				actual_so_qty = sql("select sum(qty) from `tabSales Order Item` where parent = '%s' and item_code = '%s' and docstatus = 1 group by parent" % (so_no, item))
+				actual_so_qty = actual_so_qty and flt(actual_so_qty[0][0]) or 0
+
+				if flt(so_items[so_no][item]) + already_indented > actual_so_qty:
+					msgprint("You can raise indent of maximum qty: %s for item: %s against sales order: %s\n Anyway, you can add more qty in new row for the same item." % (actual_so_qty - already_indented, item, so_no), raise_exception=1)
+				
+		
+	# Validate fiscal year
+	# ----------------------------
+	def validate_fiscal_year(self):
+		get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Purchase Request Date')
+
+	# get item details
+	# ---------------------------------
+	def get_item_details(self, arg =''):
+		if arg:
+			return get_obj(dt='Purchase Common').get_item_details(self,arg)
+		else:
+			obj = get_obj('Purchase Common')
+			for doc in self.doclist:
+				if doc.fields.get('item_code'):
+					temp = {
+						'item_code': doc.fields.get('item_code'),
+						'warehouse': doc.fields.get('warehouse')
+					}
+					ret = obj.get_item_details(self, json.dumps(temp))
+					for r in ret:
+						if not doc.fields.get(r):
+							doc.fields[r] = ret[r]
+
+
+	# Get UOM Details
+	# ---------------------------------
+	def get_uom_details(self, arg = ''):
+		return get_obj(dt='Purchase Common').get_uom_details(arg)
+
+	# GET TERMS & CONDITIONS
+	#-----------------------------
+	def get_tc_details(self):
+		return get_obj('Purchase Common').get_tc_details(self)
+		
+	# Validate Schedule Date
+	#--------------------------------
+	def validate_schedule_date(self):
+		 #:::::::: validate schedule date v/s indent date ::::::::::::
+		for d in getlist(self.doclist, 'indent_details'):
+			if d.schedule_date < self.doc.transaction_date:
+				msgprint("Expected Schedule Date cannot be before Purchase Request Date")
+				raise Exception
+				
+	# Validate
+	# ---------------------
+	def validate(self):
+		self.validate_schedule_date()
+		self.validate_fiscal_year()
+		
+		# set status as "Draft"
+		set(self.doc, 'status', 'Draft')
+
+		# Get Purchase Common Obj
+		pc_obj = get_obj(dt='Purchase Common')
+
+		# Validate Mandatory
+		pc_obj.validate_mandatory(self)
+
+		# Validate for items
+		pc_obj.validate_for_items(self)
+		
+		# Validate qty against SO
+		self.validate_qty_against_so()
+
+
+	# On Submit Functions
+	#----------------------------------------------------------------------------
+	
+	# Update Quantity Requested for Purchase in Bin
+	def update_bin(self, is_submit, is_stopped):
+		for d in getlist(self.doclist, 'indent_details'):
+			# Step 1:=> Check if is_stock_item == 'Yes'
+			if cstr(sql("select is_stock_item from `tabItem` where name = '%s'" % cstr(d.item_code))[0][0]) == 'Yes':
+				if not d.warehouse:
+					msgprint('Please Enter Warehouse for Item %s as it is stock item.' % cstr(d.item_code))
+					raise Exception
+				# Step 2:=> Set Qty 
+				qty =flt(d.qty)
+				if is_stopped:
+					qty = (d.qty > d.ordered_qty) and flt(flt(d.qty) - flt(d.ordered_qty)) or 0 
+				# Step 3 :=> Update Bin's Purchase Request Qty by +- qty 
+				get_obj('Warehouse', d.warehouse).update_bin(0, 0, 0, (is_submit and 1 or -1) * flt(qty), 0, d.item_code, self.doc.transaction_date)		
+		
+	# On Submit			
+	#---------------------------------------------------------------------------
+	def on_submit(self):
+		# Step 1:=> Set Status
+		set(self.doc,'status','Submitted')
+
+		# Step 2:=> Update Bin
+		self.update_bin(is_submit = 1, is_stopped = 0)
+	
+	def check_modified_date(self):
+		mod_db = sql("select modified from `tabPurchase Request` where name = '%s'" % self.doc.name)
+		date_diff = sql("select TIMEDIFF('%s', '%s')" % ( mod_db[0][0],cstr(self.doc.modified)))
+		
+		if date_diff and date_diff[0][0]:
+			msgprint(cstr(self.doc.doctype) +" => "+ cstr(self.doc.name) +" has been modified. Please Refresh. ")
+			raise Exception
+	
+	# On Stop / unstop
+	#------------------------------------------------------------------------------
+	def update_status(self, status):
+		self.check_modified_date()
+		# Step 1:=> Update Bin
+		self.update_bin(is_submit = (status == 'Submitted') and 1 or 0, is_stopped = 1)
+
+		# Step 2:=> Set status 
+		set(self.doc,'status',cstr(status))
+		
+		# Step 3:=> Acknowledge User
+		msgprint(self.doc.doctype + ": " + self.doc.name + " has been %s." % ((status == 'Submitted') and 'Unstopped' or cstr(status)) )
+ 
+	# On Cancel
+	#-----------------------------------------------------------------------------
+	def on_cancel(self):
+		# Step 1:=> Get Purchase Common Obj
+		pc_obj = get_obj(dt='Purchase Common')
+		
+		# Step 2:=> Check for stopped status
+		pc_obj.check_for_stopped_status( self.doc.doctype, self.doc.name)
+		
+		# Step 3:=> Check if Purchase Order has been submitted against current Purchase Request
+		pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.doc.name, detail_doctype = 'Purchase Order Item')
+		# Step 4:=> Update Bin
+		self.update_bin(is_submit = 0, is_stopped = (cstr(self.doc.status) == 'Stopped') and 1 or 0)
+		
+		# Step 5:=> Set Status
+		set(self.doc,'status','Cancelled')
diff --git a/erpnext/buying/doctype/purchase_request/purchase_request.txt b/erpnext/buying/doctype/purchase_request/purchase_request.txt
new file mode 100644
index 0000000..54e932a
--- /dev/null
+++ b/erpnext/buying/doctype/purchase_request/purchase_request.txt
@@ -0,0 +1,558 @@
+# DocType, Purchase Request
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-04-11 13:17:39',
+		'docstatus': 0,
+		'modified': '2012-04-12 14:36:23',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': u'1326190064',
+		'allow_attach': 1,
+		'allow_print': 0,
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'is_submittable': 1,
+		'module': u'Buying',
+		'name': '__common__',
+		'read_only_onload': 1,
+		'search_fields': u'status,transaction_date,sales_order_no',
+		'section_style': u'Tabbed',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'subject': u'%(per_ordered)s% ordered',
+		'version': 202
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Purchase Request',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Purchase Request',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1
+	},
+
+	# DocType, Purchase Request
+	{
+		'doctype': 'DocType',
+		'name': u'Purchase Request'
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Purchase Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Purchase Manager',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material Manager',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material User',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Purchase User',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Purchase User'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'Enter items and their details which are falling short in your warehouse and for which you want your purchase department to raise a purchase order.',
+		'description': u'Enter items and their details for which you want your purchase department to raise a purchase order.',
+		'doctype': u'DocField',
+		'fieldname': u'basic_info',
+		'fieldtype': u'Section Break',
+		'label': u'Basic Info',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'print_hide': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'To manage multiple series please go to Setup > Manage Series',
+		'doctype': u'DocField',
+		'fieldname': u'naming_series',
+		'fieldtype': u'Select',
+		'label': u'Series',
+		'no_copy': 1,
+		'oldfieldname': u'naming_series',
+		'oldfieldtype': u'Select',
+		'options': u'IDT',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'The date at which current entry is made in system.',
+		'doctype': u'DocField',
+		'fieldname': u'transaction_date',
+		'fieldtype': u'Date',
+		'in_filter': 1,
+		'label': u'Transaction Date',
+		'no_copy': 1,
+		'oldfieldname': u'transaction_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'items',
+		'fieldtype': u'Section Break',
+		'label': u'Items',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break4',
+		'fieldtype': u'Column Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'One or multiple Sales Order no which generated this Purchase Requisition',
+		'doctype': u'DocField',
+		'fieldname': u'sales_order_no',
+		'fieldtype': u'Link',
+		'label': u'Sales Order No',
+		'no_copy': 1,
+		'oldfieldname': u'sales_order_no',
+		'oldfieldtype': u'Data',
+		'options': u'Sales Order',
+		'permlevel': 0,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break5',
+		'fieldtype': u'Column Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'pull_sales_order_details',
+		'fieldtype': u'Button',
+		'label': u'Pull Sales Order Items',
+		'options': u'pull_so_details',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'section_break1',
+		'fieldtype': u'Section Break',
+		'options': u'Simple',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'indent_details',
+		'fieldtype': u'Table',
+		'label': u'Purchase Requisition Details',
+		'no_copy': 0,
+		'oldfieldname': u'indent_details',
+		'oldfieldtype': u'Table',
+		'options': u'Purchase Request Item',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'Give additional details about the indent.',
+		'description': u'Filing in Additional Information about the Purchase Requisition will help you analyze your data better.',
+		'doctype': u'DocField',
+		'fieldname': u'more_info',
+		'fieldtype': u'Section Break',
+		'label': u'More Info',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Select the relevant company name if you have multiple companies',
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Company',
+		'oldfieldname': u'company',
+		'oldfieldtype': u'Link',
+		'options': u'Company',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'search_index': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
+		'in_filter': 1,
+		'label': u'Fiscal Year',
+		'oldfieldname': u'fiscal_year',
+		'oldfieldtype': u'Select',
+		'options': u'link:Fiscal Year',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'search_index': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Name of the entity who has requested for the Purchase Requisition',
+		'doctype': u'DocField',
+		'fieldname': u'requested_by',
+		'fieldtype': u'Data',
+		'label': u'Requested By',
+		'no_copy': 1,
+		'oldfieldname': u'requested_by',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break2',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'status',
+		'fieldtype': u'Select',
+		'in_filter': 1,
+		'label': u'Status',
+		'no_copy': 1,
+		'oldfieldname': u'status',
+		'oldfieldtype': u'Select',
+		'options': u'\nDraft\nSubmitted\nStopped\nCancelled',
+		'permlevel': 1,
+		'print_hide': 1,
+		'reqd': 0,
+		'search_index': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'% of materials ordered against this Purchase Requisition',
+		'doctype': u'DocField',
+		'fieldname': u'per_ordered',
+		'fieldtype': u'Currency',
+		'label': u'% Ordered',
+		'no_copy': 1,
+		'oldfieldname': u'per_ordered',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'remark',
+		'fieldtype': u'Small Text',
+		'label': u'Remarks',
+		'no_copy': 1,
+		'oldfieldname': u'remark',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0,
+		'print_hide': 0,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'After cancelling the Purchase Requisition, a dialog box will ask you reason for cancellation which will be reflected in this field',
+		'doctype': u'DocField',
+		'fieldname': u'cancel_reason',
+		'fieldtype': u'Data',
+		'label': u'Cancel Reason',
+		'no_copy': 1,
+		'oldfieldname': u'cancel_reason',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Data',
+		'label': u'Amended From',
+		'no_copy': 1,
+		'oldfieldname': u'amended_from',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'description': u'The date at which current entry is corrected in the system.',
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
+		'label': u'Amendment Date',
+		'no_copy': 1,
+		'oldfieldname': u'amendment_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'print_hide': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'description': u'Add Terms and Conditions for the Purchase Requisition. You can also prepare a Terms and Conditions Master and use the Template',
+		'doctype': u'DocField',
+		'fieldname': u'terms_section_break',
+		'fieldtype': u'Section Break',
+		'label': u'Terms and Conditions',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'doctype': u'DocField',
+		'fieldname': u'letter_head',
+		'fieldtype': u'Select',
+		'label': u'Letter Head',
+		'oldfieldname': u'letter_head',
+		'oldfieldtype': u'Select',
+		'options': u'link:Letter Head',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'tc_name',
+		'fieldtype': u'Link',
+		'label': u'Select Terms and Conditions',
+		'oldfieldname': u'tc_name',
+		'oldfieldtype': u'Link',
+		'options': u'Terms and Conditions',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'get_terms',
+		'fieldtype': u'Button',
+		'label': u'Get Terms and Conditions',
+		'oldfieldtype': u'Button',
+		'options': u'get_tc_details',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'terms_html',
+		'fieldtype': u'HTML',
+		'label': u'Terms and Conditions HTML',
+		'oldfieldtype': u'HTML',
+		'options': u'You can add Terms and Notes that will be printed in the Transaction',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'terms',
+		'fieldtype': u'Text Editor',
+		'label': u'Terms and Conditions Content',
+		'oldfieldname': u'terms',
+		'oldfieldtype': u'Text Editor',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break3',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
+		'hidden': 1,
+		'label': u'File List',
+		'no_copy': 1,
+		'permlevel': 0,
+		'print_hide': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/buying/doctype/purchase_other_charges/__init__.py b/erpnext/buying/doctype/purchase_request_item/__init__.py
similarity index 100%
copy from erpnext/buying/doctype/purchase_other_charges/__init__.py
copy to erpnext/buying/doctype/purchase_request_item/__init__.py
diff --git a/erpnext/buying/doctype/purchase_request_item/purchase_request_item.txt b/erpnext/buying/doctype/purchase_request_item/purchase_request_item.txt
new file mode 100644
index 0000000..9407894
--- /dev/null
+++ b/erpnext/buying/doctype/purchase_request_item/purchase_request_item.txt
@@ -0,0 +1,262 @@
+# DocType, Purchase Request Item
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-04-11 13:17:40',
+		'docstatus': 0,
+		'modified': '2012-04-12 14:52:49',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'IDTD/.#####',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Buying',
+		'name': '__common__',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 37
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Purchase Request Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Purchase Request Item
+	{
+		'doctype': 'DocType',
+		'name': u'Purchase Request Item'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'schedule_date',
+		'fieldtype': u'Date',
+		'label': u'Required Date',
+		'no_copy': 1,
+		'oldfieldname': u'schedule_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'print_hide': 0,
+		'reqd': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Text',
+		'permlevel': 0,
+		'reqd': 1,
+		'width': u'250px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'warehouse',
+		'fieldtype': u'Link',
+		'label': u'Warehouse',
+		'oldfieldname': u'warehouse',
+		'oldfieldtype': u'Link',
+		'options': u'Warehouse',
+		'permlevel': 0,
+		'print_hide': 0,
+		'reqd': 0,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'qty',
+		'fieldtype': u'Currency',
+		'label': u'Quantity',
+		'no_copy': 0,
+		'oldfieldname': u'qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'reqd': 1,
+		'trigger': u'Client',
+		'width': u'80px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'uom',
+		'fieldtype': u'Link',
+		'label': u'Stock UOM',
+		'no_copy': 0,
+		'oldfieldname': u'uom',
+		'oldfieldtype': u'Link',
+		'options': u'UOM',
+		'permlevel': 1,
+		'reqd': 1,
+		'width': u'70px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'lead_time_date',
+		'fieldtype': u'Date',
+		'label': u'Lead Time Date',
+		'no_copy': 1,
+		'oldfieldname': u'lead_time_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_name',
+		'fieldtype': u'Data',
+		'in_filter': 1,
+		'label': u'Item Name',
+		'oldfieldname': u'item_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'item_group',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Item Group',
+		'no_copy': 0,
+		'oldfieldname': u'item_group',
+		'oldfieldtype': u'Link',
+		'options': u'Item Group',
+		'permlevel': 1,
+		'print_hide': 1,
+		'reqd': 0,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'brand',
+		'fieldtype': u'Link',
+		'label': u'Brand',
+		'oldfieldname': u'brand',
+		'oldfieldtype': u'Link',
+		'options': u'Brand',
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'min_order_qty',
+		'fieldtype': u'Currency',
+		'label': u'Min Order Qty',
+		'no_copy': 1,
+		'oldfieldname': u'min_order_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'reqd': 0,
+		'width': u'70px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'projected_qty',
+		'fieldtype': u'Currency',
+		'label': u'Projected Qty',
+		'no_copy': 1,
+		'oldfieldname': u'projected_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'70px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'ordered_qty',
+		'fieldtype': u'Currency',
+		'label': u'Ordered Qty',
+		'no_copy': 1,
+		'oldfieldname': u'ordered_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'sales_order_no',
+		'fieldtype': u'Link',
+		'label': u'Sales Order No',
+		'no_copy': 1,
+		'options': u'Sales Order',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'doctype': u'DocField',
+		'fieldname': u'page_break',
+		'fieldtype': u'Check',
+		'label': u'Page Break',
+		'no_copy': 1,
+		'oldfieldname': u'page_break',
+		'oldfieldtype': u'Check',
+		'permlevel': 0,
+		'print_hide': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/buying/doctype/qa_inspection_report/__init__.py b/erpnext/buying/doctype/qa_inspection_report/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/buying/doctype/qa_inspection_report/__init__.py
+++ /dev/null
diff --git a/erpnext/buying/doctype/qa_inspection_report/qa_inspection_report.js b/erpnext/buying/doctype/qa_inspection_report/qa_inspection_report.js
deleted file mode 100644
index 6591a70..0000000
--- a/erpnext/buying/doctype/qa_inspection_report/qa_inspection_report.js
+++ /dev/null
@@ -1,60 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-cur_frm.cscript.item_code = function(doc, cdt, cdn) {
-	if (doc.item_code)
-		get_server_fields('get_purchase_receipt_item_details','','',doc,cdt,cdn,1);
-}
-
-cur_frm.cscript.inspection_type = function(doc, cdt, cdn) {
-	if(doc.inspection_type == 'Incoming'){
-		doc.delivery_note_no = '';
-		hide_field('delivery_note_no');		
-		unhide_field('purchase_receipt_no');
-	}
-	else if(doc.inspection_type == 'Outgoing'){
-		doc.purchase_receipt_no = '';
-		unhide_field('delivery_note_no');
-		hide_field('purchase_receipt_no');
-
-	}
-	else {
-		doc.purchase_receipt_no = '';
-		doc.delivery_note_no = '';		
-		hide_field('purchase_receipt_no');
-		hide_field('delivery_note_no');
-	}
-}
-
-cur_frm.cscript.refresh = cur_frm.cscript.inspection_type;
-
-// item code based on GRN/DN
-cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
-	if (doc.purchase_receipt_no)
-		return 'SELECT item_code, item_name, description FROM `tabPurchase Receipt Detail` WHERE parent = "'+ doc.purchase_receipt_no +'" and docstatus != 2 AND item_code LIKE "%s" ORDER BY item_code ASC LIMIT 50';
-	else if (doc.delivery_note_no) 
-		return 'SELECT item_code, item_name, description FROM `tabDelivery Note Detail` WHERE parent = "'+ doc.delivery_note_no +'" and docstatus != 2 AND item_code LIKE "%s" ORDER BY item_code ASC LIMIT 50';
-	else
-		return 'SELECT name, item_name, description FROM tabItem WHERE docstatus != 2 AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
-}
-
-// Serial No based on item_code
-cur_frm.fields_dict['item_serial_no'].get_query = function(doc, cdt, cdn) {
-	if (doc.item_code)
-		return 'SELECT name, item_code, warehouse FROM `tabSerial No` WHERE docstatus != 2 AND item_code = "' + doc.item_code +'" AND status = "In Store" AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
-	else
-		return 'SELECT name, item_code, warehouse FROM `tabSerial No` WHERE docstatus != 2 AND status = "In Store" AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
-}
diff --git a/erpnext/buying/doctype/qa_inspection_report/qa_inspection_report.py b/erpnext/buying/doctype/qa_inspection_report/qa_inspection_report.py
deleted file mode 100644
index d95ab7a..0000000
--- a/erpnext/buying/doctype/qa_inspection_report/qa_inspection_report.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-	
-# -----------------------------------------------------------------------------------------
-
-
-class DocType:
-  def __init__(self, doc, doclist=[]):
-    self.doc = doc
-    self.doclist = doclist
-
-  # Autoname
-  # ---------
-  def autoname(self):
-    self.doc.name = make_autoname(self.doc.naming_series+'.#####')
-
-
-  def get_item_specification_details(self):
-    self.doc.clear_table(self.doclist, 'qa_specification_details')
-    specification = sql("select specification, value from `tabItem Specification Detail` where parent = '%s' order by idx" % (self.doc.item_code))
-    for d in specification:
-      child = addchild(self.doc, 'qa_specification_details', 'QA Specification Detail', 1, self.doclist)
-      child.specification = d[0]
-      child.value = d[1]
-      child.status = 'Accepted'
-
-  def on_submit(self):
-    if self.doc.purchase_receipt_no:
-      sql("update `tabPurchase Receipt Detail` set qa_no = '%s' where parent = '%s' and item_code = '%s'" % (self.doc.name, self.doc.purchase_receipt_no, self.doc.item_code))
-
-
-  def on_cancel(self):
-    if self.doc.purchase_receipt_no:
-      sql("update `tabPurchase Receipt Detail` set qa_no = '' where parent = '%s' and item_code = '%s'" % (self.doc.purchase_receipt_no, self.doc.item_code))
diff --git a/erpnext/buying/doctype/qa_inspection_report/qa_inspection_report.txt b/erpnext/buying/doctype/qa_inspection_report/qa_inspection_report.txt
deleted file mode 100644
index de88e16..0000000
--- a/erpnext/buying/doctype/qa_inspection_report/qa_inspection_report.txt
+++ /dev/null
@@ -1,340 +0,0 @@
-# DocType, QA Inspection Report
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:17',
-		'docstatus': 0,
-		'modified': '2011-10-06 10:22:41',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': '1317365120',
-		'autoname': 'QAI/.######',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
-		'doctype': 'DocType',
-		'module': 'Buying',
-		'name': '__common__',
-		'print_outline': 'Yes',
-		'search_fields': 'item_code, report_date, purchase_receipt_no, delivery_note_no',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 38
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'QA Inspection Report',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'QA Inspection Report',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1,
-		'role': 'Quality Manager'
-	},
-
-	# DocType, QA Inspection Report
-	{
-		'doctype': 'DocType',
-		'name': 'QA Inspection Report'
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'QA Inspection',
-		'no_copy': 0,
-		'oldfieldtype': 'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
-		'permlevel': 0,
-		'width': '50%'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'naming_series',
-		'fieldtype': 'Select',
-		'label': 'Naming Series',
-		'no_copy': 1,
-		'options': '\nQAI/11-12/',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'inspection_type',
-		'fieldtype': 'Select',
-		'in_filter': 1,
-		'label': 'Inspection Type',
-		'oldfieldname': 'inspection_type',
-		'oldfieldtype': 'Select',
-		'options': '\nIncoming\nOutgoing\nIn Process',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'report_date',
-		'fieldtype': 'Date',
-		'in_filter': 1,
-		'label': 'Report Date',
-		'oldfieldname': 'report_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'item_code',
-		'fieldtype': 'Link',
-		'hidden': 0,
-		'in_filter': 1,
-		'label': 'Item Code',
-		'oldfieldname': 'item_code',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'sample_size',
-		'fieldtype': 'Currency',
-		'in_filter': 0,
-		'label': 'Sample Size',
-		'oldfieldname': 'sample_size',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Small Text',
-		'in_filter': 1,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Small Text',
-		'permlevel': 0,
-		'search_index': 0,
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
-		'permlevel': 0,
-		'width': '50%'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'item_serial_no',
-		'fieldtype': 'Link',
-		'hidden': 0,
-		'label': 'Item Serial No',
-		'oldfieldname': 'item_serial_no',
-		'oldfieldtype': 'Link',
-		'options': 'Serial No',
-		'permlevel': 0,
-		'print_hide': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'batch_no',
-		'fieldtype': 'Link',
-		'label': 'Batch No',
-		'oldfieldname': 'batch_no',
-		'oldfieldtype': 'Link',
-		'options': 'Batch',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'purchase_receipt_no',
-		'fieldtype': 'Link',
-		'hidden': 0,
-		'in_filter': 1,
-		'label': 'Purchase Receipt No',
-		'oldfieldname': 'purchase_receipt_no',
-		'oldfieldtype': 'Link',
-		'options': 'Purchase Receipt',
-		'permlevel': 0,
-		'search_index': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'delivery_note_no',
-		'fieldtype': 'Link',
-		'hidden': 0,
-		'in_filter': 1,
-		'label': 'Delivery Note No',
-		'oldfieldname': 'delivery_note_no',
-		'oldfieldtype': 'Link',
-		'options': 'Delivery Note',
-		'permlevel': 0,
-		'print_hide': 0,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'inspected_by',
-		'fieldtype': 'Data',
-		'label': 'Inspected By',
-		'oldfieldname': 'inspected_by',
-		'oldfieldtype': 'Data',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'remarks',
-		'fieldtype': 'Text',
-		'label': 'Remarks',
-		'no_copy': 1,
-		'oldfieldname': 'remarks',
-		'oldfieldtype': 'Text',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'verified_by',
-		'fieldtype': 'Data',
-		'label': 'Verified By',
-		'oldfieldname': 'verified_by',
-		'oldfieldtype': 'Data',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'amended_from',
-		'fieldtype': 'Data',
-		'label': 'Amended From',
-		'no_copy': 1,
-		'oldfieldname': 'amended_from',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'amendment_date',
-		'fieldtype': 'Date',
-		'label': 'Amendment Date',
-		'no_copy': 1,
-		'oldfieldname': 'amendment_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Specification Details',
-		'oldfieldtype': 'Section Break',
-		'options': 'Simple',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Get Specification Details',
-		'options': 'get_item_specification_details',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'qa_specification_details',
-		'fieldtype': 'Table',
-		'label': 'QA Specification Details',
-		'oldfieldname': 'qa_specification_details',
-		'oldfieldtype': 'Table',
-		'options': 'QA Specification Detail',
-		'permlevel': 0
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/doctype/qa_specification_detail/__init__.py b/erpnext/buying/doctype/qa_specification_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/buying/doctype/qa_specification_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/buying/doctype/qa_specification_detail/qa_specification_detail.txt b/erpnext/buying/doctype/qa_specification_detail/qa_specification_detail.txt
deleted file mode 100644
index 07ccb03..0000000
--- a/erpnext/buying/doctype/qa_specification_detail/qa_specification_detail.txt
+++ /dev/null
@@ -1,188 +0,0 @@
-# DocType, QA Specification Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:17',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'QASD/.#####',
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Buying',
-		'name': '__common__',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 2
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'QA Specification Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, QA Specification Detail
-	{
-		'doctype': 'DocType',
-		'name': 'QA Specification Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'specification',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'label': 'Parameter',
-		'oldfieldname': 'specification',
-		'oldfieldtype': 'Data',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'value',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Acceptance Criteria',
-		'oldfieldname': 'value',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'reading_1',
-		'fieldtype': 'Data',
-		'idx': 3,
-		'label': 'Reading 1',
-		'oldfieldname': 'reading_1',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'reading_2',
-		'fieldtype': 'Data',
-		'idx': 4,
-		'label': 'Reading 2',
-		'oldfieldname': 'reading_2',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'reading_3',
-		'fieldtype': 'Data',
-		'idx': 5,
-		'label': 'Reading 3',
-		'oldfieldname': 'reading_3',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'reading_4',
-		'fieldtype': 'Data',
-		'idx': 6,
-		'label': 'Reading 4',
-		'oldfieldname': 'reading_4',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'reading_5',
-		'fieldtype': 'Data',
-		'idx': 7,
-		'label': 'Reading 5',
-		'oldfieldname': 'reading_5',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'reading_6',
-		'fieldtype': 'Data',
-		'idx': 8,
-		'label': 'Reading 6',
-		'oldfieldname': 'reading_6',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'reading_7',
-		'fieldtype': 'Data',
-		'idx': 9,
-		'label': 'Reading 7',
-		'oldfieldname': 'reading_7',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'reading_8',
-		'fieldtype': 'Data',
-		'idx': 10,
-		'label': 'Reading 8',
-		'oldfieldname': 'reading_8',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'reading_9',
-		'fieldtype': 'Data',
-		'idx': 11,
-		'label': 'Reading 9',
-		'oldfieldname': 'reading_9',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'reading_10',
-		'fieldtype': 'Data',
-		'idx': 12,
-		'label': 'Reading 10',
-		'oldfieldname': 'reading_10',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'default': 'Accepted',
-		'doctype': 'DocField',
-		'fieldname': 'status',
-		'fieldtype': 'Select',
-		'idx': 13,
-		'label': 'Status',
-		'oldfieldname': 'status',
-		'oldfieldtype': 'Select',
-		'options': 'Accepted\nRejected'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/doctype/indent/__init__.py b/erpnext/buying/doctype/quality_inspection/__init__.py
similarity index 100%
rename from erpnext/buying/doctype/indent/__init__.py
rename to erpnext/buying/doctype/quality_inspection/__init__.py
diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.js b/erpnext/buying/doctype/quality_inspection/quality_inspection.js
new file mode 100644
index 0000000..2dbb285
--- /dev/null
+++ b/erpnext/buying/doctype/quality_inspection/quality_inspection.js
@@ -0,0 +1,60 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+cur_frm.cscript.item_code = function(doc, cdt, cdn) {
+	if (doc.item_code)
+		get_server_fields('get_purchase_receipt_item_details','','',doc,cdt,cdn,1);
+}
+
+cur_frm.cscript.inspection_type = function(doc, cdt, cdn) {
+	if(doc.inspection_type == 'Incoming'){
+		doc.delivery_note_no = '';
+		hide_field('delivery_note_no');		
+		unhide_field('purchase_receipt_no');
+	}
+	else if(doc.inspection_type == 'Outgoing'){
+		doc.purchase_receipt_no = '';
+		unhide_field('delivery_note_no');
+		hide_field('purchase_receipt_no');
+
+	}
+	else {
+		doc.purchase_receipt_no = '';
+		doc.delivery_note_no = '';		
+		hide_field('purchase_receipt_no');
+		hide_field('delivery_note_no');
+	}
+}
+
+cur_frm.cscript.refresh = cur_frm.cscript.inspection_type;
+
+// item code based on GRN/DN
+cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
+	if (doc.purchase_receipt_no)
+		return 'SELECT item_code, item_name, description FROM `tabPurchase Receipt Item` WHERE parent = "'+ doc.purchase_receipt_no +'" and docstatus != 2 AND item_code LIKE "%s" ORDER BY item_code ASC LIMIT 50';
+	else if (doc.delivery_note_no) 
+		return 'SELECT item_code, item_name, description FROM `tabDelivery Note Item` WHERE parent = "'+ doc.delivery_note_no +'" and docstatus != 2 AND item_code LIKE "%s" ORDER BY item_code ASC LIMIT 50';
+	else
+		return 'SELECT name, item_name, description FROM tabItem WHERE docstatus != 2 AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+// Serial No based on item_code
+cur_frm.fields_dict['item_serial_no'].get_query = function(doc, cdt, cdn) {
+	if (doc.item_code)
+		return 'SELECT name, item_code, warehouse FROM `tabSerial No` WHERE docstatus != 2 AND item_code = "' + doc.item_code +'" AND status = "In Store" AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
+	else
+		return 'SELECT name, item_code, warehouse FROM `tabSerial No` WHERE docstatus != 2 AND status = "In Store" AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.py b/erpnext/buying/doctype/quality_inspection/quality_inspection.py
new file mode 100644
index 0000000..e0eee1c
--- /dev/null
+++ b/erpnext/buying/doctype/quality_inspection/quality_inspection.py
@@ -0,0 +1,63 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+
+  # Autoname
+  # ---------
+  def autoname(self):
+    self.doc.name = make_autoname(self.doc.naming_series+'.#####')
+
+
+  def get_item_specification_details(self):
+    self.doc.clear_table(self.doclist, 'qa_specification_details')
+    specification = sql("select specification, value from `tabItem Quality Inspection Parameter` where parent = '%s' order by idx" % (self.doc.item_code))
+    for d in specification:
+      child = addchild(self.doc, 'qa_specification_details', 'Quality Inspection Reading', 1, self.doclist)
+      child.specification = d[0]
+      child.value = d[1]
+      child.status = 'Accepted'
+
+  def on_submit(self):
+    if self.doc.purchase_receipt_no:
+      sql("update `tabPurchase Receipt Item` set qa_no = '%s' where parent = '%s' and item_code = '%s'" % (self.doc.name, self.doc.purchase_receipt_no, self.doc.item_code))
+
+
+  def on_cancel(self):
+    if self.doc.purchase_receipt_no:
+      sql("update `tabPurchase Receipt Item` set qa_no = '' where parent = '%s' and item_code = '%s'" % (self.doc.purchase_receipt_no, self.doc.item_code))
diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.txt b/erpnext/buying/doctype/quality_inspection/quality_inspection.txt
new file mode 100644
index 0000000..afbd737
--- /dev/null
+++ b/erpnext/buying/doctype/quality_inspection/quality_inspection.txt
@@ -0,0 +1,346 @@
+# DocType, Quality Inspection
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:51',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:45:50',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': u'1317365120',
+		'autoname': u'QAI/.######',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'is_submittable': 1,
+		'module': u'Buying',
+		'name': '__common__',
+		'print_outline': u'Yes',
+		'search_fields': u'item_code, report_date, purchase_receipt_no, delivery_note_no',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 38
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Quality Inspection',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Quality Inspection',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1,
+		'role': u'Quality Manager'
+	},
+
+	# DocType, Quality Inspection
+	{
+		'doctype': 'DocType',
+		'name': u'Quality Inspection'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'qa_inspection',
+		'fieldtype': u'Section Break',
+		'label': u'QA Inspection',
+		'no_copy': 0,
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'naming_series',
+		'fieldtype': u'Select',
+		'label': u'Naming Series',
+		'no_copy': 1,
+		'options': u'\nQAI/11-12/',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'inspection_type',
+		'fieldtype': u'Select',
+		'in_filter': 1,
+		'label': u'Inspection Type',
+		'oldfieldname': u'inspection_type',
+		'oldfieldtype': u'Select',
+		'options': u'\nIncoming\nOutgoing\nIn Process',
+		'permlevel': 0,
+		'reqd': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'report_date',
+		'fieldtype': u'Date',
+		'in_filter': 1,
+		'label': u'Report Date',
+		'oldfieldname': u'report_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'hidden': 0,
+		'in_filter': 1,
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'sample_size',
+		'fieldtype': u'Currency',
+		'in_filter': 0,
+		'label': u'Sample Size',
+		'oldfieldname': u'sample_size',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Small Text',
+		'in_filter': 1,
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0,
+		'search_index': 0,
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_serial_no',
+		'fieldtype': u'Link',
+		'hidden': 0,
+		'label': u'Item Serial No',
+		'oldfieldname': u'item_serial_no',
+		'oldfieldtype': u'Link',
+		'options': u'Serial No',
+		'permlevel': 0,
+		'print_hide': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'batch_no',
+		'fieldtype': u'Link',
+		'label': u'Batch No',
+		'oldfieldname': u'batch_no',
+		'oldfieldtype': u'Link',
+		'options': u'Batch',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'purchase_receipt_no',
+		'fieldtype': u'Link',
+		'hidden': 0,
+		'in_filter': 1,
+		'label': u'Purchase Receipt No',
+		'oldfieldname': u'purchase_receipt_no',
+		'oldfieldtype': u'Link',
+		'options': u'Purchase Receipt',
+		'permlevel': 0,
+		'search_index': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'delivery_note_no',
+		'fieldtype': u'Link',
+		'hidden': 0,
+		'in_filter': 1,
+		'label': u'Delivery Note No',
+		'oldfieldname': u'delivery_note_no',
+		'oldfieldtype': u'Link',
+		'options': u'Delivery Note',
+		'permlevel': 0,
+		'print_hide': 0,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'inspected_by',
+		'fieldtype': u'Data',
+		'label': u'Inspected By',
+		'oldfieldname': u'inspected_by',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'remarks',
+		'fieldtype': u'Text',
+		'label': u'Remarks',
+		'no_copy': 1,
+		'oldfieldname': u'remarks',
+		'oldfieldtype': u'Text',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'verified_by',
+		'fieldtype': u'Data',
+		'label': u'Verified By',
+		'oldfieldname': u'verified_by',
+		'oldfieldtype': u'Data',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Data',
+		'label': u'Amended From',
+		'no_copy': 1,
+		'oldfieldname': u'amended_from',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
+		'label': u'Amendment Date',
+		'no_copy': 1,
+		'oldfieldname': u'amendment_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'specification_details',
+		'fieldtype': u'Section Break',
+		'label': u'Specification Details',
+		'oldfieldtype': u'Section Break',
+		'options': u'Simple',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'get_specification_details',
+		'fieldtype': u'Button',
+		'label': u'Get Specification Details',
+		'options': u'get_item_specification_details',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'qa_specification_details',
+		'fieldtype': u'Table',
+		'label': u'Quality Inspection Readings',
+		'oldfieldname': u'qa_specification_details',
+		'oldfieldtype': u'Table',
+		'options': u'Quality Inspection Reading',
+		'permlevel': 0
+	}
+]
\ No newline at end of file
diff --git a/erpnext/buying/doctype/indent/__init__.py b/erpnext/buying/doctype/quality_inspection_reading/__init__.py
similarity index 100%
copy from erpnext/buying/doctype/indent/__init__.py
copy to erpnext/buying/doctype/quality_inspection_reading/__init__.py
diff --git a/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.txt b/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.txt
new file mode 100644
index 0000000..b356dd9
--- /dev/null
+++ b/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.txt
@@ -0,0 +1,175 @@
+# DocType, Quality Inspection Reading
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:52',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:52',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'QASD/.#####',
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Buying',
+		'name': '__common__',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 2
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Quality Inspection Reading',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# DocType, Quality Inspection Reading
+	{
+		'doctype': 'DocType',
+		'name': u'Quality Inspection Reading'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'specification',
+		'fieldtype': u'Data',
+		'label': u'Parameter',
+		'oldfieldname': u'specification',
+		'oldfieldtype': u'Data',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'value',
+		'fieldtype': u'Data',
+		'label': u'Acceptance Criteria',
+		'oldfieldname': u'value',
+		'oldfieldtype': u'Data'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'reading_1',
+		'fieldtype': u'Data',
+		'label': u'Reading 1',
+		'oldfieldname': u'reading_1',
+		'oldfieldtype': u'Data'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'reading_2',
+		'fieldtype': u'Data',
+		'label': u'Reading 2',
+		'oldfieldname': u'reading_2',
+		'oldfieldtype': u'Data'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'reading_3',
+		'fieldtype': u'Data',
+		'label': u'Reading 3',
+		'oldfieldname': u'reading_3',
+		'oldfieldtype': u'Data'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'reading_4',
+		'fieldtype': u'Data',
+		'label': u'Reading 4',
+		'oldfieldname': u'reading_4',
+		'oldfieldtype': u'Data'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'reading_5',
+		'fieldtype': u'Data',
+		'label': u'Reading 5',
+		'oldfieldname': u'reading_5',
+		'oldfieldtype': u'Data'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'reading_6',
+		'fieldtype': u'Data',
+		'label': u'Reading 6',
+		'oldfieldname': u'reading_6',
+		'oldfieldtype': u'Data'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'reading_7',
+		'fieldtype': u'Data',
+		'label': u'Reading 7',
+		'oldfieldname': u'reading_7',
+		'oldfieldtype': u'Data'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'reading_8',
+		'fieldtype': u'Data',
+		'label': u'Reading 8',
+		'oldfieldname': u'reading_8',
+		'oldfieldtype': u'Data'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'reading_9',
+		'fieldtype': u'Data',
+		'label': u'Reading 9',
+		'oldfieldname': u'reading_9',
+		'oldfieldtype': u'Data'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'reading_10',
+		'fieldtype': u'Data',
+		'label': u'Reading 10',
+		'oldfieldname': u'reading_10',
+		'oldfieldtype': u'Data'
+	},
+
+	# DocField
+	{
+		'default': u'Accepted',
+		'doctype': u'DocField',
+		'fieldname': u'status',
+		'fieldtype': u'Select',
+		'label': u'Status',
+		'oldfieldname': u'status',
+		'oldfieldtype': u'Select',
+		'options': u'Accepted\nRejected'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/buying/doctype/raw_materials_supplied/__init__.py b/erpnext/buying/doctype/raw_materials_supplied/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/buying/doctype/raw_materials_supplied/__init__.py
+++ /dev/null
diff --git a/erpnext/buying/doctype/raw_materials_supplied/raw_materials_supplied.txt b/erpnext/buying/doctype/raw_materials_supplied/raw_materials_supplied.txt
deleted file mode 100644
index 23dd235..0000000
--- a/erpnext/buying/doctype/raw_materials_supplied/raw_materials_supplied.txt
+++ /dev/null
@@ -1,148 +0,0 @@
-# DocType, Raw Materials Supplied
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:18',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'RMS/.######',
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Buying',
-		'name': '__common__',
-		'section_style': 'Tray',
-		'show_in_menu': 0,
-		'version': 8
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Raw Materials Supplied',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# DocType, Raw Materials Supplied
-	{
-		'doctype': 'DocType',
-		'name': 'Raw Materials Supplied'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'po_item',
-		'fieldtype': 'Select',
-		'idx': 1,
-		'label': 'PO Item',
-		'oldfieldname': 'po_item',
-		'oldfieldtype': 'Select',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'raw_material',
-		'fieldtype': 'Link',
-		'idx': 2,
-		'label': 'Raw Material',
-		'oldfieldname': 'raw_material',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Small Text',
-		'idx': 3,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Small Text',
-		'permlevel': 0,
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'source_warehouse',
-		'fieldtype': 'Select',
-		'idx': 5,
-		'label': 'Source Warehouse',
-		'oldfieldname': 'source_warehouse',
-		'oldfieldtype': 'Select',
-		'options': 'link:Warehouse',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'ma_valuation_rate',
-		'fieldtype': 'Currency',
-		'idx': 7,
-		'label': 'Valuation  Rate (MA)',
-		'no_copy': 1,
-		'oldfieldname': 'ma_valuation_rate',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'fifo_valuation_rate',
-		'fieldtype': 'Currency',
-		'idx': 8,
-		'label': 'Valuation Rate (FIFO)',
-		'oldfieldname': 'fifo_valuation_rate',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'qty',
-		'fieldtype': 'Currency',
-		'idx': 9,
-		'label': 'Qty',
-		'oldfieldname': 'qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'stock_uom',
-		'fieldtype': 'Data',
-		'idx': 12,
-		'label': 'Stock UOM',
-		'oldfieldname': 'stock_uom',
-		'oldfieldtype': 'Data',
-		'permlevel': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/doctype/supplier/listview.js b/erpnext/buying/doctype/supplier/listview.js
new file mode 100644
index 0000000..86e22d6
--- /dev/null
+++ b/erpnext/buying/doctype/supplier/listview.js
@@ -0,0 +1,23 @@
+// render
+wn.doclistviews['Supplier'] = wn.views.ListView.extend({
+	init: function(d) {
+		this._super(d)
+		this.fields = this.fields.concat([
+			"`tabSupplier`.supplier_type",
+		]);
+		this.stats = this.stats.concat([]);
+	},
+
+	prepare_data: function(data) {
+		this._super(data);
+	},
+	
+	columns: [
+		{width: '5%', content:'avatar'},
+		{width: '50%', content:'name'},
+		{width: '10%', content:'tags'},
+		{width: '23%', content:'supplier_type', css: {'color': '#aaa'}},
+		{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
+	]
+});
+
diff --git a/erpnext/buying/doctype/supplier/supplier.js b/erpnext/buying/doctype/supplier/supplier.js
index 41889af..615ffc7 100644
--- a/erpnext/buying/doctype/supplier/supplier.js
+++ b/erpnext/buying/doctype/supplier/supplier.js
@@ -14,7 +14,7 @@
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-$import(Contact Control)
+wn.require('erpnext/setup/doctype/contact_control/contact_control.js');
 
 cur_frm.cscript.onload = function(doc,dt,dn){
 
@@ -37,14 +37,10 @@
     unhide_field('naming_series'); 
     
   if(doc.__islocal){
-    	hide_field(['Address HTML','Contact HTML']); 
-  		//if(doc.country) cur_frm.cscript.get_states(doc,dt,dn);  	
-		// set message
-		//cur_frm.cscript.set_cl_msg(doc);
-		//cur_frm.cscript.set_hl_msg(doc);
-  }
+    	hide_field(['address_html','contact_html']); 
+   }
   else{
-	  	unhide_field(['Address HTML','Contact HTML']);
+	  	unhide_field(['address_html','contact_html']);
 		// make lists
 		cur_frm.cscript.make_address(doc,dt,dn);
 		cur_frm.cscript.make_contact(doc,dt,dn);
@@ -54,19 +50,10 @@
 
 cur_frm.cscript.make_address = function() {
 	if(!cur_frm.address_list) {
-		cur_frm.address_list = new wn.widgets.Listing({
-			parent: cur_frm.fields_dict['Address HTML'].wrapper,
+		cur_frm.address_list = new wn.ui.Listing({
+			parent: cur_frm.fields_dict['address_html'].wrapper,
 			page_length: 2,
 			new_doctype: "Address",
-			new_doc_onload: function(dn) {
-				ndoc = locals["Address"][dn];
-				ndoc.supplier = cur_frm.doc.name;
-				ndoc.supplier_name = cur_frm.doc.supplier_name;
-				ndoc.address_type = 'Office';								
-			},		
-			new_doc_onsave: function(dn) {				
-				cur_frm.address_list.run()
-			},	
 			get_query: function() {
 				return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
 			},
@@ -96,18 +83,10 @@
 
 cur_frm.cscript.make_contact = function() {
 	if(!cur_frm.contact_list) {
-		cur_frm.contact_list = new wn.widgets.Listing({
-			parent: cur_frm.fields_dict['Contact HTML'].wrapper,
+		cur_frm.contact_list = new wn.ui.Listing({
+			parent: cur_frm.fields_dict['contact_html'].wrapper,
 			page_length: 2,
 			new_doctype: "Contact",
-			new_doc_onload: function(dn) {
-				ndoc = locals["Contact"][dn];
-				ndoc.supplier = cur_frm.doc.name;
-				ndoc.supplier_name = cur_frm.doc.supplier_name;
-			},
-			new_doc_onsave: function(dn) {				
-				cur_frm.contact_list.run()
-			},
 			get_query: function() {
 				return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
 			},
@@ -128,6 +107,7 @@
 
 // make purchase order list
 cur_frm.cscript.make_po_list = function(parent, doc){
+	wn.require('lib/js/legacy/widgets/listing.js');
 	var lst = new Listing();
 	lst.colwidths = ['5%','25%','20%','25%','25%'];
 	lst.colnames = ['Sr.','Id','Status','PO Date','Grand Total'];
@@ -142,6 +122,7 @@
 
 // make purchase receipt list
 cur_frm.cscript.make_pr_list = function(parent,doc){
+	wn.require('lib/js/legacy/widgets/listing.js');
 	var lst = new Listing();
 	lst.colwidths = ['5%','20%','20%','20%','15%','20%'];
 	lst.colnames = ['Sr.','Id','Status','Receipt Date','% Billed','Grand Total'];
@@ -156,14 +137,15 @@
 
 // make purchase invoice list
 cur_frm.cscript.make_pi_list = function(parent,doc){
+	wn.require('lib/js/legacy/widgets/listing.js');
 	var lst = new Listing();
 	lst.colwidths = ['5%','20%','20%','20%','15%','20%'];
 	lst.colnames = ['Sr.','Id','Posting Date','Credit To','Bill Date','Grand Total'];
 	lst.coltypes = ['Data','Link','Data','Data','Currency','Currency'];
-	lst.coloptions = ['','Payable Voucher','','','',''];
+	lst.coloptions = ['','Purchase Invoice','','','',''];
 
-	var q = repl("select name, posting_date, credit_to, bill_date, grand_total from `tabPayable Voucher` where supplier='%(sup)s' order by posting_date desc", {'sup':doc.name});
-	var q_max = repl("select count(name) from `tabPayable Voucher` where supplier='%(sup)s'", {'sup':doc.name});
+	var q = repl("select name, posting_date, credit_to, bill_date, grand_total from `tabPurchase Invoice` where supplier='%(sup)s' order by posting_date desc", {'sup':doc.name});
+	var q_max = repl("select count(name) from `tabPurchase Invoice` where supplier='%(sup)s'", {'sup':doc.name});
 	
-	cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Purchase Invoice','Payable Voucher');	
+	cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Purchase Invoice','Purchase Invoice');	
 }
diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py
index 4bc04bb..18d167a 100644
--- a/erpnext/buying/doctype/supplier/supplier.py
+++ b/erpnext/buying/doctype/supplier/supplier.py
@@ -171,7 +171,7 @@
 			('Supplier', 'name'),
 			('Address', 'supplier'),
 			('Contact', 'supplier'),
-			('Payable Voucher', 'supplier'),
+			('Purchase Invoice', 'supplier'),
 			('Purchase Order', 'supplier'),
 			('Purchase Receipt', 'supplier'),
 			('Serial No', 'supplier')]
diff --git a/erpnext/buying/doctype/supplier/supplier.txt b/erpnext/buying/doctype/supplier/supplier.txt
index 0834898..10d5591 100644
--- a/erpnext/buying/doctype/supplier/supplier.txt
+++ b/erpnext/buying/doctype/supplier/supplier.txt
@@ -3,88 +3,61 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:26',
+		'creation': '2012-03-27 14:35:52',
 		'docstatus': 0,
-		'modified': '2011-07-19 16:18:58',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:52',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1306471021',
+		'_last_update': u'1306471021',
 		'allow_trash': 1,
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'Buying',
+		'document_type': u'Master',
+		'module': u'Buying',
 		'name': '__common__',
-		'search_fields': 'supplier_name,supplier_type',
-		'section_style': 'Tabbed',
-		'server_code_error': ' ',
+		'search_fields': u'supplier_name,supplier_type',
+		'section_style': u'Tabbed',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'subject': ' ',
-		'tag_fields': 'supplier_type',
+		'subject': u' ',
+		'tag_fields': u'supplier_type',
 		'version': 87
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Supplier',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Supplier',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Supplier',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Supplier',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Supplier
 	{
 		'doctype': 'DocType',
-		'name': 'Supplier'
+		'name': u'Supplier'
 	},
 
 	# DocPerm
 	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Purchase Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'permlevel': 0,
-		'role': 'Purchase Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'permlevel': 1,
-		'role': 'Purchase Master Manager'
+		'role': u'Purchase Master Manager'
 	},
 
 	# DocPerm
@@ -92,162 +65,181 @@
 		'amend': 0,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 4,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Purchase Master Manager',
+		'role': u'Purchase Master Manager',
 		'submit': 0,
 		'write': 1
 	},
 
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Purchase Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Purchase Manager',
+		'submit': 0,
+		'write': 0
+	},
+
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 1,
-		'label': 'Basic Info',
-		'oldfieldtype': 'Section Break',
+		'colour': u'White:FFF',
+		'description': u'Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts',
+		'doctype': u'DocField',
+		'fieldname': u'basic_info',
+		'fieldtype': u'Section Break',
+		'label': u'Basic Info',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'supplier_name',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Supplier Name',
+		'doctype': u'DocField',
+		'fieldname': u'supplier_name',
+		'fieldtype': u'Data',
+		'label': u'Supplier Name',
 		'no_copy': 1,
-		'oldfieldname': 'supplier_name',
-		'oldfieldtype': 'Data',
+		'oldfieldname': u'supplier_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'supplier_type',
-		'fieldtype': 'Link',
-		'idx': 3,
-		'label': 'Supplier Type',
-		'oldfieldname': 'supplier_type',
-		'oldfieldtype': 'Link',
-		'options': 'Supplier Type',
+		'doctype': u'DocField',
+		'fieldname': u'supplier_type',
+		'fieldtype': u'Link',
+		'label': u'Supplier Type',
+		'oldfieldname': u'supplier_type',
+		'oldfieldtype': u'Link',
+		'options': u'Supplier Type',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 4,
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'naming_series',
-		'fieldtype': 'Select',
-		'idx': 5,
-		'label': 'Series',
+		'doctype': u'DocField',
+		'fieldname': u'naming_series',
+		'fieldtype': u'Select',
+		'label': u'Series',
 		'no_copy': 1,
-		'oldfieldname': 'naming_series',
-		'oldfieldtype': 'Select',
-		'options': '\nSUPP\nSUPP/10-11/',
+		'oldfieldname': u'naming_series',
+		'oldfieldtype': u'Select',
+		'options': u'\nSUPP\nSUPP/10-11/',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 6,
-		'label': 'Address & Contacts',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'address_contacts',
+		'fieldtype': u'Section Break',
+		'label': u'Address & Contacts',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:doc.__islocal',
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 7,
-		'label': 'Address Desc',
-		'options': '<em>Addresses will appear only when you save the supplier</em>',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'address_desc',
+		'fieldtype': u'HTML',
+		'label': u'Address Desc',
+		'options': u'<em>Addresses will appear only when you save the supplier</em>',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 8,
-		'label': 'Address HTML',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'address_html',
+		'fieldtype': u'HTML',
+		'label': u'Address HTML',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 9,
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:doc.__islocal',
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 10,
-		'label': 'Contact Desc',
-		'options': '<em>Contact Details will appear only when you save the supplier</em>',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'contact_desc',
+		'fieldtype': u'HTML',
+		'label': u'Contact Desc',
+		'options': u'<em>Contact Details will appear only when you save the supplier</em>',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 11,
-		'label': 'Contact HTML',
+		'doctype': u'DocField',
+		'fieldname': u'contact_html',
+		'fieldtype': u'HTML',
+		'label': u'Contact HTML',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 12,
-		'label': 'More Info',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'more_info',
+		'fieldtype': u'Section Break',
+		'label': u'More Info',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Enter the company name under which Account Head will be created for this Supplier',
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Link',
-		'idx': 13,
+		'colour': u'White:FFF',
+		'description': u'Enter the company name under which Account Head will be created for this Supplier',
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Company',
-		'oldfieldname': 'company',
-		'oldfieldtype': 'Link',
-		'options': 'Company',
+		'label': u'Company',
+		'oldfieldname': u'company',
+		'oldfieldtype': u'Link',
+		'options': u'Company',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 0
@@ -255,82 +247,78 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Statutory info and other general information about your Supplier',
-		'doctype': 'DocField',
-		'fieldname': 'supplier_details',
-		'fieldtype': 'Text',
-		'idx': 14,
-		'label': 'Supplier Details',
-		'oldfieldname': 'supplier_details',
-		'oldfieldtype': 'Code',
+		'colour': u'White:FFF',
+		'description': u'Statutory info and other general information about your Supplier',
+		'doctype': u'DocField',
+		'fieldname': u'supplier_details',
+		'fieldtype': u'Text',
+		'label': u'Supplier Details',
+		'oldfieldname': u'supplier_details',
+		'oldfieldtype': u'Code',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 15,
+		'doctype': u'DocField',
+		'fieldname': u'column_break2',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'credit_days',
-		'fieldtype': 'Int',
-		'idx': 16,
-		'label': 'Credit Days',
+		'doctype': u'DocField',
+		'fieldname': u'credit_days',
+		'fieldtype': u'Int',
+		'label': u'Credit Days',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'website',
-		'fieldtype': 'Data',
-		'idx': 17,
-		'label': 'Website',
-		'oldfieldname': 'website',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'website',
+		'fieldtype': u'Data',
+		'label': u'Website',
+		'oldfieldname': u'website',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 18,
-		'label': 'Transaction History',
-		'oldfieldtype': 'Section Break',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'transaction_history',
+		'fieldtype': u'Section Break',
+		'label': u'Transaction History',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 19,
-		'label': 'History HTML',
-		'oldfieldtype': 'HTML',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'history_html',
+		'fieldtype': u'HTML',
+		'label': u'History HTML',
+		'oldfieldtype': u'HTML',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 20,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	}
-]
+]
\ No newline at end of file
diff --git a/erpnext/buying/page/buying_home/buying_home.html b/erpnext/buying/page/buying_home/buying_home.html
index 7f0e906..ee10d10 100644
--- a/erpnext/buying/page/buying_home/buying_home.html
+++ b/erpnext/buying/page/buying_home/buying_home.html
@@ -1,17 +1,19 @@
 <div class="layout-wrapper layout-wrapper-background">
+	<div class="appframe-area"></div>
 	<div class="layout-main-section">
-		<a class="close" onclick="window.history.back();">&times;</a>
 		<h1>Buying</h1>
 		<hr>
 		<div style="width: 48%; float: left;">
-			<h4><a href="#!List/Purchase Requisition">Purchase Requisition</a></h4>
+			<h4><a href="#!List/Purchase Request">Purchase Request</a></h4>
 			<p class="help">Request for purchase</p>
+			<br>
 			<h4><a href="#!List/Purchase Order">Purchase Order</a></h4>
 			<p class="help">Purchase Orders given to Suppliers</p>
 		</div>
 		<div style="width: 48%; float: right;">
 			<h4><a href="#!List/Supplier">Supplier</a></h4>
 			<p class="help">Supplier Master</p>
+			<br>
 			<h4><a href="#!List/Item">Item</a></h4>
 			<p class="help">Item Master</p>
 		</div>
@@ -28,7 +30,7 @@
 					<div class="section-item">
 						<a class="section-link" 
 							title = "Tax and charges structure master"
-							href="#!List/Purchase Other Charges">Purchase Other Charges</a>
+							href="#!List/Purchase Taxes and Charges Master">Purchase Taxes and Charges Master</a>
 					</div>
 					<div class="section-item">
 						<a class="section-link" 
@@ -38,12 +40,12 @@
 					<div class="section-item">
 						<a class="section-link" 
 							title = "Helper for managing return of goods (sales or purchase)"
-							href="#!Form/Sales and Purchase Return Wizard/Sales and Purchase Return Wizard">Purchase Returns</a>
+							href="#!Form/Sales and Purchase Return Tool/Sales and Purchase Return Tool">Purchase Returns</a>
 					</div>
 					<div class="section-item">
 						<a class="section-link" 
 							title = "Terms of contract template"
-							href="#!List/Term">Order Terms Template</a>
+							href="#!List/Terms and Conditions">Terms and Conditions Template</a>
 					</div>
 				</div>
 			</div>
@@ -61,4 +63,4 @@
 		</div>
 	</div>
 	<div style="clear: both;"></div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/buying/page/buying_home/buying_home.js b/erpnext/buying/page/buying_home/buying_home.js
index 1f47b84..646ed0b 100644
--- a/erpnext/buying/page/buying_home/buying_home.js
+++ b/erpnext/buying/page/buying_home/buying_home.js
@@ -15,5 +15,6 @@
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 pscript['onload_buying-home'] = function(wrapper) {
+	wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
 	erpnext.module_page.setup_page('Buying', wrapper);
 }
\ No newline at end of file
diff --git a/erpnext/buying/search_criteria/itemwise_purchase_details/itemwise_purchase_details.txt b/erpnext/buying/search_criteria/itemwise_purchase_details/itemwise_purchase_details.txt
index 1628060..de0f278 100644
--- a/erpnext/buying/search_criteria/itemwise_purchase_details/itemwise_purchase_details.txt
+++ b/erpnext/buying/search_criteria/itemwise_purchase_details/itemwise_purchase_details.txt
@@ -3,31 +3,32 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:31',
+		'creation': '2012-04-11 13:16:55',
 		'docstatus': 0,
-		'modified': '2010-03-31 12:39:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-13 11:15:06',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Purchase Order\x01ID,Purchase Order\x01PO Date,Purchase Order\x01Grand Total,PO Detail\x01Item Code,PO Detail\x01Item Name,PO Detail\x01Quantity,PO Detail\x01Stock UOM,PO Detail\x01Purchase Rate,PO Detail\x01Amount,PO Detail\x01Warehouse',
-		'criteria_name': 'Itemwise Purchase Details',
-		'doc_type': 'PO Detail',
+		'columns': u'Purchase Order\x01ID,Purchase Order\x01Purchase Order Date,Purchase Order Item\x01Item Code,Purchase Order Item\x01Item Name,Purchase Order Item\x01Quantity,Purchase Order Item\x01Stock UOM,Purchase Order Item\x01Rate ,Purchase Order Item\x01Amount,Purchase Order\x01Net Total*,Purchase Order\x01Grand Total',
+		'criteria_name': u'Itemwise Purchase Details',
+		'doc_type': u'Purchase Order Item',
 		'doctype': 'Search Criteria',
-		'filters': "{'Purchase Order\x01Saved':1,'Purchase Order\x01Submitted':1,'Purchase Order\x01Status':'','Purchase Order\x01Company Name':''}",
-		'module': 'Buying',
+		'filters': u'{"Purchase Order\\u0001Submitted":1,"Purchase Order\\u0001Status":[],"Purchase Order\\u0001Fiscal Year":[]}',
+		'module': u'Buying',
 		'name': '__common__',
-		'parent_doc_type': 'Purchase Order',
-		'sort_by': '`tabPurchase Order`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'page_len': 50,
+		'parent_doc_type': u'Purchase Order',
+		'sort_by': u'`tabPurchase Order`.`transaction_date`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, itemwise_purchase_details
 	{
 		'doctype': 'Search Criteria',
-		'name': 'itemwise_purchase_details'
+		'name': u'itemwise_purchase_details'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/buying/search_criteria/itemwise_receipt_details/itemwise_receipt_details.txt b/erpnext/buying/search_criteria/itemwise_receipt_details/itemwise_receipt_details.txt
deleted file mode 100644
index cacbb78..0000000
--- a/erpnext/buying/search_criteria/itemwise_receipt_details/itemwise_receipt_details.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, itemwise_receipt_details
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-12-14 10:23:19',
-		'docstatus': 0,
-		'modified': '2010-10-22 14:36:11',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'Purchase Receipt\x01ID,Purchase Receipt\x01Posting Date,Purchase Receipt Detail\x01Item Code,Purchase Receipt Detail\x01Item Name,Purchase Receipt Detail\x01Accepted Quantity,Purchase Receipt Detail\x01Rejected Quantity,Purchase Receipt Detail\x01Accepted Warehouse,Purchase Receipt Detail\x01Rejected Warehouse,Purchase Receipt Detail\x01Amount',
-		'criteria_name': 'Itemwise Receipt Details',
-		'doc_type': 'Purchase Receipt Detail',
-		'doctype': 'Search Criteria',
-		'filters': "{'Purchase Receipt\x01Saved':1,'Purchase Receipt\x01Submitted':1,'Purchase Receipt\x01Status':'','Purchase Receipt\x01Fiscal Year':''}",
-		'module': 'Buying',
-		'name': '__common__',
-		'page_len': 50,
-		'parent_doc_type': 'Purchase Receipt',
-		'sort_by': '`tabPurchase Receipt`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, itemwise_receipt_details
-	{
-		'doctype': 'Search Criteria',
-		'name': 'itemwise_receipt_details'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/buying/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.txt b/erpnext/buying/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.txt
index be0beb3..cbdcc5c 100644
--- a/erpnext/buying/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.txt
+++ b/erpnext/buying/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.txt
@@ -3,35 +3,35 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-03-30 11:03:20',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2011-03-29 14:26:49',
-		'modified_by': 'Administrator',
-		'owner': 'dhanalekshmi@webnotestech.com'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'dhanalekshmi@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_col': '(CASE WHEN (`tabPO Detail`.qty- ifnull(`tabPO Detail`.billed_qty, 0) > 0 ) THEN (`tabPO Detail`.qty-ifnull(`tabPO Detail`.billed_qty, 0) ) ELSE 0 END) AS "Pending To Bill"',
-		'add_cond': '(`tabPO Detail`.qty - ifnull(`tabPO Detail`.received_qty, 0) > 0 or `tabPO Detail`.qty - ifnull(`tabPO Detail`.billed_qty, 0) > 0)\n`tabPurchase Order`.status != "Stopped"',
-		'columns': 'Purchase Order\x01ID,Purchase Order\x01Supplier,Purchase Order\x01Supplier Name,Purchase Order\x01Status,Purchase Order\x01PO Date,Purchase Order\x01Fiscal Year,PO Detail\x01Indent No,PO Detail\x01Item Code,PO Detail\x01Item Name,PO Detail\x01Description,PO Detail\x01Quantity,PO Detail\x01UOM,PO Detail\x01Received Qty',
-		'criteria_name': 'Pending PO Items To Bill',
-		'description': 'Pending PO Items To Bill',
-		'doc_type': 'PO Detail',
+		'add_col': u'(CASE WHEN (`tabPurchase Order Item`.qty- ifnull(`tabPurchase Order Item`.billed_qty, 0) > 0 ) THEN (`tabPurchase Order Item`.qty-ifnull(`tabPurchase Order Item`.billed_qty, 0) ) ELSE 0 END) AS "Pending To Bill"',
+		'add_cond': u'(`tabPurchase Order Item`.qty - ifnull(`tabPurchase Order Item`.received_qty, 0) > 0 or `tabPurchase Order Item`.qty - ifnull(`tabPurchase Order Item`.billed_qty, 0) > 0)\n`tabPurchase Order`.status != "Stopped"',
+		'columns': u'Purchase Order\x01ID,Purchase Order\x01Supplier,Purchase Order\x01Supplier Name,Purchase Order\x01Status,Purchase Order\x01PO Date,Purchase Order\x01Fiscal Year,Purchase Order Item\x01Purchase Request No,Purchase Order Item\x01Item Code,Purchase Order Item\x01Item Name,Purchase Order Item\x01Description,Purchase Order Item\x01Quantity,Purchase Order Item\x01UOM,Purchase Order Item\x01Received Qty',
+		'criteria_name': u'Pending PO Items To Bill',
+		'description': u'Pending PO Items To Bill',
+		'doc_type': u'Purchase Order Item',
 		'doctype': 'Search Criteria',
-		'filters': "{'Purchase Order\x01Saved':1,'Purchase Order\x01Submitted':1,'Purchase Order\x01Status':'','Purchase Order\x01Fiscal Year':''}",
-		'module': 'Buying',
+		'filters': u"{'Purchase Order\x01Saved':1,'Purchase Order\x01Submitted':1,'Purchase Order\x01Status':'','Purchase Order\x01Fiscal Year':''}",
+		'module': u'Buying',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Purchase Order',
-		'sort_by': '`tabPurchase Order`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Purchase Order',
+		'sort_by': u'`tabPurchase Order`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, pending_po_items_to_bill
 	{
 		'doctype': 'Search Criteria',
-		'name': 'pending_po_items_to_bill'
+		'name': u'pending_po_items_to_bill'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.txt b/erpnext/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.txt
index b629547..185e155 100644
--- a/erpnext/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.txt
+++ b/erpnext/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.txt
@@ -3,21 +3,21 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-03-29 14:57:52',
+		'creation': '2012-04-03 12:49:52',
 		'docstatus': 0,
-		'modified': '2012-02-14 11:04:22',
+		'modified': '2012-04-03 12:49:52',
 		'modified_by': u'Administrator',
 		'owner': u'dhanalekshmi@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_col': u'`tabPO Detail`.qty - ifnull(`tabPO Detail`.received_qty, 0) AS "Pending Quantity To Receive"\n(`tabPO Detail`.qty - ifnull(`tabPO Detail`.received_qty, 0)) * `tabPO Detail`.purchase_rate AS "Pending Amount To Receive"',
-		'add_cond': u'`tabPO Detail`.qty - ifnull(`tabPO Detail`.received_qty, 0) > 0 \n`tabPurchase Order`.status != "Stopped"',
-		'columns': u'Purchase Order\x01ID,Purchase Order\x01Supplier,Purchase Order\x01Supplier Name,Purchase Order\x01Status,Purchase Order\x01PO Date,Purchase Order\x01Fiscal Year,PO Detail\x01Indent No,PO Detail\x01Item Code,PO Detail\x01Item Name,PO Detail\x01Description,PO Detail\x01Quantity,PO Detail\x01UOM,PO Detail\x01Received Qty',
+		'add_col': u'`tabPurchase Order Item`.qty - ifnull(`tabPurchase Order Item`.received_qty, 0) AS "Pending Quantity To Receive"\n(`tabPurchase Order Item`.qty - ifnull(`tabPurchase Order Item`.received_qty, 0)) * `tabPurchase Order Item`.purchase_rate AS "Pending Amount To Receive"',
+		'add_cond': u'`tabPurchase Order Item`.qty - ifnull(`tabPurchase Order Item`.received_qty, 0) > 0 \n`tabPurchase Order`.status != "Stopped"',
+		'columns': u'Purchase Order\x01ID,Purchase Order\x01Supplier,Purchase Order\x01Supplier Name,Purchase Order\x01Status,Purchase Order\x01PO Date,Purchase Order\x01Fiscal Year,Purchase Order Item\x01Purchase Request No,Purchase Order Item\x01Item Code,Purchase Order Item\x01Item Name,Purchase Order Item\x01Description,Purchase Order Item\x01Quantity,Purchase Order Item\x01UOM,Purchase Order Item\x01Received Qty',
 		'criteria_name': u'Pending PO Items To Receive',
 		'description': u'Pending PO Items To Receive',
-		'doc_type': u'PO Detail',
+		'doc_type': u'Purchase Order Item',
 		'doctype': 'Search Criteria',
 		'filters': u"{'Purchase Order\x01Saved':1,'Purchase Order\x01Submitted':1,'Purchase Order\x01Status':'','Purchase Order\x01Fiscal Year':''}",
 		'module': u'Buying',
diff --git a/erpnext/buying/search_criteria/purchase_in_transit/purchase_in_transit.js b/erpnext/buying/search_criteria/purchase_in_transit/purchase_in_transit.js
index ab469cd..a08b921 100644
--- a/erpnext/buying/search_criteria/purchase_in_transit/purchase_in_transit.js
+++ b/erpnext/buying/search_criteria/purchase_in_transit/purchase_in_transit.js
@@ -19,18 +19,18 @@
   this.hide_all_filters();
 
 
-  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'Company'].df.filter_hide = 0;
-  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
-  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
-  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'Credit To'].df.filter_hide = 0;
+  this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'Company'].df.filter_hide = 0;
+  this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
+  this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'Credit To'].df.filter_hide = 0;
 
 
   this.add_filter({fieldname:'pr_posting_date', label:'PR Posting Date', fieldtype:'Date', ignore : 1, parent:'Purchase Receipt'});
 
 
-  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'Credit To'].df.in_first_page = 0;
-  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
-  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'Credit To'].df.in_first_page = 0;
+  this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
+  this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
 
   
   this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'From PR Posting Date'].df.ignore = 1;
@@ -39,9 +39,9 @@
 
   this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'From PR Posting Date'].df['report_default'] = sys_defaults.year_start_date;
   this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'To PR Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
-  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
-  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
-  this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
+  this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
+  this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+  this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
 
 }
 
diff --git a/erpnext/buying/search_criteria/purchase_in_transit/purchase_in_transit.txt b/erpnext/buying/search_criteria/purchase_in_transit/purchase_in_transit.txt
index 028d9d5..e49ea0b 100644
--- a/erpnext/buying/search_criteria/purchase_in_transit/purchase_in_transit.txt
+++ b/erpnext/buying/search_criteria/purchase_in_transit/purchase_in_transit.txt
@@ -3,37 +3,37 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-09-01 15:48:09',
+		'creation': '2012-04-11 13:16:55',
 		'docstatus': 0,
-		'modified': '2010-08-30 13:04:44',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-13 12:06:15',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_col': "`tabPurchase Receipt`.`posting_date` AS 'PR Posting Date'",
-		'add_cond': "`tabPV Detail`.`purchase_receipt`  = `tabPurchase Receipt`.`name`\n`tabPurchase Receipt`.`posting_date` >= '%(pr_posting_date)s'\n`tabPurchase Receipt`.`posting_date` <= '%(pr_posting_date1)s'\n`tabPurchase Receipt`.`posting_date` > `tabPayable Voucher`.`posting_date`",
-		'add_tab': '`tabPurchase Receipt`',
-		'columns': 'Payable Voucher\x01ID,Payable Voucher\x01Voucher Date,Payable Voucher\x01Posting Date,Payable Voucher\x01Credit To,PV Detail\x01Rate,PV Detail\x01Qty,PV Detail\x01Amount,PV Detail\x01Pur Order,PV Detail\x01Pur Receipt',
-		'criteria_name': 'Purchase in Transit',
-		'description': 'List of PR whose posting date is after PV posting date',
-		'dis_filters': '`tabPurchase Receipt`.`pr_posting_date`',
-		'doc_type': 'PV Detail',
+		'add_col': u"`tabPurchase Receipt`.`posting_date` AS 'PR Posting Date'",
+		'add_cond': u"`tabPurchase Invoice Item`.`purchase_receipt`  = `tabPurchase Receipt`.`name`\n`tabPurchase Receipt`.`posting_date` >= '%(pr_posting_date)s'\n`tabPurchase Receipt`.`posting_date` <= '%(pr_posting_date1)s'\n`tabPurchase Receipt`.`posting_date` > `tabPurchase Invoice`.`posting_date`",
+		'add_tab': u'`tabPurchase Receipt`',
+		'columns': u'Purchase Invoice\x01ID,Purchase Invoice\x01Posting Date,Purchase Invoice\x01Credit To,Purchase Invoice Item\x01Qty,Purchase Invoice Item\x01Amount,Purchase Invoice Item\x01Pur Order,Purchase Invoice Item\x01Pur Receipt',
+		'criteria_name': u'Purchase in Transit',
+		'description': u'List of PR whose posting date is after PV posting date',
+		'dis_filters': u'`tabPurchase Receipt`.`pr_posting_date`',
+		'doc_type': u'Purchase Invoice Item',
 		'doctype': 'Search Criteria',
-		'filters': "{'Payable Voucher\x01Submitted':1,'Payable Voucher\x01From Posting Date\x01lower':'2009-04-01','Payable Voucher\x01To Posting Date\x01upper':'2010-01-11','Payable Voucher\x01Is Opening':'','Payable Voucher\x01Fiscal Year':'','Payable Voucher\x01Company':'','Purchase Receipt\x01From PR Posting Date\x01lower':'2009-04-01','Purchase Receipt\x01To PR Posting Date\x01upper':'2010-01-11'}",
-		'module': 'Buying',
+		'filters': u'{"Purchase Invoice\\u0001Submitted":1,"Purchase Invoice\\u0001Is Opening":[""],"Purchase Invoice\\u0001Fiscal Year":[""]}',
+		'module': u'Buying',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Payable Voucher',
-		'sort_by': '`tabPayable Voucher`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Purchase Invoice',
+		'sort_by': u'`tabPurchase Invoice`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, purchase_in_transit
 	{
 		'doctype': 'Search Criteria',
-		'name': 'purchase_in_transit'
+		'name': u'purchase_in_transit'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/home/Module Def/Home/Home.txt b/erpnext/home/Module Def/Home/Home.txt
deleted file mode 100644
index 7613ee8..0000000
--- a/erpnext/home/Module Def/Home/Home.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-[
-	{
-		'creation': '2011-06-09 16:14:42',
-		'disabled': 'No',
-		'docstatus': 0,
-		'doctype': 'Module Def',
-		'doctype_list': None,
-		'file_list': None,
-		'idx': None,
-		'is_hidden': 'No',
-		'last_updated_date': None,
-		'modified': '2011-06-09 16:57:36',
-		'modified_by': 'Administrator',
-		'module_desc': None,
-		'module_icon': None,
-		'module_label': 'Home',
-		'module_name': 'Home',
-		'module_page': 'Event Updates',
-		'module_seq': -1,
-		'name': 'Home',
-		'owner': 'Administrator',
-		'parent': None,
-		'parentfield': None,
-		'parenttype': None,
-		'trash_reason': None,
-		'widget_code': None
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/__init__.py b/erpnext/home/__init__.py
index 8118ea6..97106bd 100644
--- a/erpnext/home/__init__.py
+++ b/erpnext/home/__init__.py
@@ -36,11 +36,11 @@
 
 	# Accounts
 	'Journal Voucher':      ['[%(voucher_type)s] %(name)s', '#4169E1'],
-	'Payable Voucher':      ['To %(supplier_name)s for %(currency)s %(grand_total_import)s', '#4169E1'],
-	'Receivable Voucher':['To %(customer_name)s for %(currency)s %(grand_total_export)s', '#4169E1'],
+	'Purchase Invoice':      ['To %(supplier_name)s for %(currency)s %(grand_total_import)s', '#4169E1'],
+	'Sales Invoice':['To %(customer_name)s for %(currency)s %(grand_total_export)s', '#4169E1'],
 
 	# HR
-	'Expense Voucher':      ['[%(approval_status)s] %(name)s by %(employee_name)s', '#4169E1'],
+	'Expense Claim':      ['[%(approval_status)s] %(name)s by %(employee_name)s', '#4169E1'],
 	'Salary Slip':	  ['%(employee_name)s for %(month)s %(fiscal_year)s', '#4169E1'],
 	'Leave Transaction':['%(leave_type)s for %(employee)s', '#4169E1'],
 
diff --git a/erpnext/home/doctype/company_control/company_control.py b/erpnext/home/doctype/company_control/company_control.py
index 63f8b71..567d015 100644
--- a/erpnext/home/doctype/company_control/company_control.py
+++ b/erpnext/home/doctype/company_control/company_control.py
@@ -71,12 +71,7 @@
 			pr.save(1)
 		
 		# Update Membership Type at Gateway
-		if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
-			if 'System Manager' in role_list : membership_type = 'Administrator'
-			else : membership_type = 'Member'
-
-			import server_tools.gateway_utils
-			server_tools.gateway_utils.update_membership_type(cstr(arg['usr']), membership_type)
+		from webnotes.utils import cint
 
 		sql("delete from __SessionCache where user=%s", cstr(arg['usr']))
 
diff --git a/erpnext/home/doctype/company_control/company_control.txt b/erpnext/home/doctype/company_control/company_control.txt
index a83f4dd..90952d1 100644
--- a/erpnext/home/doctype/company_control/company_control.txt
+++ b/erpnext/home/doctype/company_control/company_control.txt
@@ -3,28 +3,28 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:55',
+		'creation': '2012-03-27 14:35:52',
 		'docstatus': 0,
-		'modified': '2011-01-13 12:14:36',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:52',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'issingle': 1,
-		'module': 'Home',
+		'module': u'Home',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 13
 	},
 
 	# DocType, Company Control
 	{
 		'doctype': 'DocType',
-		'name': 'Company Control'
+		'name': u'Company Control'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/home/doctype/feed/feed.txt b/erpnext/home/doctype/feed/feed.txt
index 62d6633..2c33fcf 100644
--- a/erpnext/home/doctype/feed/feed.txt
+++ b/erpnext/home/doctype/feed/feed.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-04-06 18:11:38',
+		'creation': '2012-03-27 14:35:52',
 		'docstatus': 0,
-		'modified': '2012-02-08 11:35:40',
+		'modified': '2012-03-27 14:35:52',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
diff --git a/erpnext/home/doctype/home_control/home_control.js b/erpnext/home/doctype/home_control/home_control.js
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/doctype/home_control/home_control.js
+++ /dev/null
diff --git a/erpnext/home/doctype/home_control/home_control.py b/erpnext/home/doctype/home_control/home_control.py
index c88cf9e..59500b4 100644
--- a/erpnext/home/doctype/home_control/home_control.py
+++ b/erpnext/home/doctype/home_control/home_control.py
@@ -38,7 +38,6 @@
 # ------------------------------------- Home page module details -----------------------------------------
 	
 	def delete_cache(self):
-		sql("delete from __DocTypeCache")
 		com = sql("select abbr, name from tabCompany")
 		for d in com:
 			sql("update `tabCompany` set receivables_group = '%s' where (receivables_group = '%s' or receivables_group = '' or receivables_group is null) and name = '%s'" % ('Accounts Receivable - '+cstr(d[0]), 'Accounts Receivables - '+cstr(d[0]), d[1]))
@@ -141,8 +140,8 @@
 	# get dashboard counts
 	# --------------------
 	def get_wip_counts(self):
-		#dtl = ['Lead', 'Enquiries', 'Sales Order', 'Invoices', 'Indent', 'Purchase Order', 'Bills', 'Tasks', 'Delivery Note', 'Maintenance']
-		can_read_dt = ['Lead', 'Enquiry', 'Sales Order', 'Receivable Voucher', 'Indent', 'Purchase Order', 'Payable Voucher', 'Delivery Note', 'Task', 'Serial No']
+		#dtl = ['Lead', 'Enquiries', 'Sales Order', 'Invoices', 'Purchase Request', 'Purchase Order', 'Bills', 'Tasks', 'Delivery Note', 'Maintenance']
+		can_read_dt = ['Lead', 'Opportunity', 'Sales Order', 'Sales Invoice', 'Purchase Request', 'Purchase Order', 'Purchase Invoice', 'Delivery Note', 'Task', 'Serial No']
 		dt = {}
 		for d in can_read_dt:
 			args = {}
@@ -151,10 +150,10 @@
 			if d=='Lead':
 				args = {'To follow up':sql("select count(name) from tabLead where status!='Converted' and status!='Lead Lost' and status!='Not Interested'")}
 
-			# if Enquiry
-			elif d=='Enquiry':
-				args['Quotations to be sent'] = sql("select count(distinct(t2.name)) from `tabQuotation`t1, `tabEnquiry`t2 where t1.enq_no!=t2.name and t2.docstatus=1")
-				args['To follow up'] = sql("select count(distinct(t2.name)) from `tabQuotation`t1, `tabEnquiry`t2 where t1.enq_no=t2.name and t2.docstatus=1 and t1.docstatus=1")
+			# if Opportunity
+			elif d=='Opportunity':
+				args['Quotations to be sent'] = sql("select count(distinct(t2.name)) from `tabQuotation`t1, `tabOpportunity`t2 where t1.enq_no!=t2.name and t2.docstatus=1")
+				args['To follow up'] = sql("select count(distinct(t2.name)) from `tabQuotation`t1, `tabOpportunity`t2 where t1.enq_no=t2.name and t2.docstatus=1 and t1.docstatus=1")
 
 			# if Sales Order
 			elif d=='Sales Order':
@@ -163,16 +162,16 @@
 				args['Overdue'] = sql("select count(name) from `tabSales Order` where ifnull(per_delivered,0)<100 and delivery_date<now() and docstatus=1")
 				args['To be submitted'] = sql("select count(name) from `tabSales Order` where docstatus=0 and status='Draft'")      #Draft
 
-			# if Receivable Voucher
-			elif d=='Receivable Voucher':
-				args['To receive payment'] = sql("select count(name) from `tabReceivable Voucher` where docstatus=1 and due_date>now() and outstanding_amount!=0")
-				args['Overdue'] = sql("select count(name) from `tabReceivable Voucher` where docstatus=1 and due_date<now() and outstanding_amount!=0")  
-				args['To be submitted'] = sql("select count(name) from `tabReceivable Voucher` where docstatus=0")       #Draft
+			# if Sales Invoice
+			elif d=='Sales Invoice':
+				args['To receive payment'] = sql("select count(name) from `tabSales Invoice` where docstatus=1 and due_date>now() and outstanding_amount!=0")
+				args['Overdue'] = sql("select count(name) from `tabSales Invoice` where docstatus=1 and due_date<now() and outstanding_amount!=0")  
+				args['To be submitted'] = sql("select count(name) from `tabSales Invoice` where docstatus=0")       #Draft
 
-			# if Indent 
-			elif d=='Indent':
-				args['Purchase Order to be made'] = sql("select count(name) from `tabIndent` where ifnull(per_ordered,0)<100 and docstatus=1")
-				args['To be submitted'] = sql("select count(name) from `tabIndent` where status='Draft'")      #Draft
+			# if Purchase Request 
+			elif d=='Purchase Request':
+				args['Purchase Order to be made'] = sql("select count(name) from `tabPurchase Request` where ifnull(per_ordered,0)<100 and docstatus=1")
+				args['To be submitted'] = sql("select count(name) from `tabPurchase Request` where status='Draft'")      #Draft
 
 			# if Purchase Order    
 			elif d=='Purchase Order':
@@ -180,10 +179,10 @@
 				args['To be billed'] = sql("select count(name) from `tabPurchase Order` where ifnull(per_billed,0)<100 and docstatus=1")
 				args['To be submitted'] = sql("select count(name) from `tabPurchase Order` where status='Draft'")        #Draft
 
-			# if Payable Voucher
-			elif d=='Payable Voucher':
-				args['To be paid'] = sql("select count(name) from `tabPayable Voucher` where docstatus=1 and outstanding_amount!=0")
-				args['To be submitted'] = sql("select count(name) from `tabPayable Voucher` where docstatus=0")       #Draft
+			# if Purchase Invoice
+			elif d=='Purchase Invoice':
+				args['To be paid'] = sql("select count(name) from `tabPurchase Invoice` where docstatus=1 and outstanding_amount!=0")
+				args['To be submitted'] = sql("select count(name) from `tabPurchase Invoice` where docstatus=0")       #Draft
 
 			# if Delivery Note
 			elif d=='Delivery Note':
@@ -192,7 +191,7 @@
 			
 			# if Tasks
 			elif d=='Task':
-				args = {'Open': sql("select count(name) from `tabTicket` where status='Open'")}
+				args = {'Open': sql("select count(name) from `tabTask` where status='Open'")}
 
 			# if Serial No
 			elif d=='Serial No':
@@ -208,13 +207,13 @@
 	# -------------------------------------------------------------------------------------------------------
 	
 	def get_todo_count(self):
-		count = sql("select count(distinct name) from `tabToDo Item` where owner=%s", session['user'])
+		count = sql("select count(distinct name) from `tabToDo` where owner=%s", session['user'])
 		count = count and count[0][0] or 0
 		return count
 		
 	def get_todo_list(self):
 		res = sql("""select name, description, `date`, 
-			priority, checked, reference_type, reference_name from `tabToDo Item` 
+			priority, checked, reference_type, reference_name from `tabToDo` 
 			where owner=%s order by field(priority,'High','Medium','Low') asc, date asc""", \
 				session['user'], as_dict=1)
 		return res
@@ -222,7 +221,7 @@
 	def add_todo_item(self,args):
 		args = json.loads(args)
 
-		d = Document('ToDo Item', args.get('name') or None)
+		d = Document('ToDo', args.get('name') or None)
 		d.description = args['description']
 		d.date = args['date']
 		d.priority = args['priority']
@@ -236,10 +235,10 @@
 		return d.name
 
 	def remove_todo_item(self,nm):
-		d = Document('ToDo Item', nm or None)
+		d = Document('ToDo', nm or None)
 		if d and d.name:
 			self.notify_assignment(d)
-		sql("delete from `tabToDo Item` where name = %s",nm)
+		sql("delete from `tabToDo` where name = %s",nm)
 
 	def notify_assignment(self, d):
 		doc_type = d.fields.get('reference_type')
@@ -260,7 +259,7 @@
 	# -------------------------------------------------------------------------------------------------------
 
 	def get_todo_reminder(self):
-		return convert_to_lists(sql("select name, description, date, priority,checked from `tabToDo Item` where owner=%s and date=%s and checked=1 order by priority, date", (session['user'], nowdate())))
+		return convert_to_lists(sql("select name, description, date, priority,checked from `tabToDo` where owner=%s and date=%s and checked=1 order by priority, date", (session['user'], nowdate())))
 		
 	# get user details
 	def get_users(self):
diff --git a/erpnext/home/doctype/home_control/home_control.txt b/erpnext/home/doctype/home_control/home_control.txt
index fff9743..1d9098e 100644
--- a/erpnext/home/doctype/home_control/home_control.txt
+++ b/erpnext/home/doctype/home_control/home_control.txt
@@ -3,22 +3,22 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2009-07-09 16:32:49',
+		'creation': '2012-03-27 14:35:53',
 		'docstatus': 0,
-		'modified': '2010-12-24 17:08:55',
-		'modified_by': 'nabin@webnotestech.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:53',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'issingle': 1,
-		'module': 'Home',
+		'module': u'Home',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 6
 	},
@@ -26,30 +26,31 @@
 	# These values are common for all DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Home Control',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Home Control',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
-		'role': 'Guest',
 		'write': 1
 	},
 
 	# DocType, Home Control
 	{
 		'doctype': 'DocType',
-		'name': 'Home Control'
+		'name': u'Home Control'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm'
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm'
+		'doctype': u'DocPerm',
+		'role': u'Guest'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/home/doctype/widget_control/__init__.py b/erpnext/home/doctype/widget_control/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/doctype/widget_control/__init__.py
+++ /dev/null
diff --git a/erpnext/home/doctype/widget_control/widget_control.py b/erpnext/home/doctype/widget_control/widget_control.py
deleted file mode 100644
index 5c2762c..0000000
--- a/erpnext/home/doctype/widget_control/widget_control.py
+++ /dev/null
@@ -1,52 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import webnotes
-
-from webnotes.utils import nowdate
-from webnotes.model.doc import Document
-from webnotes.model.code import get_obj
-from webnotes import session, form, msgprint 
-
-sql = webnotes.conn.sql
-
-try: import json
-except: import simplejson as json
-
-# -----------------------------------------------------------------------------------------
-
-
-class DocType:
-  def __init__(self,d,dl):
-    self.doc, self.doclist = d, dl
-      
-  def add_comment(self,args):
-    import time
-    args = eval(args)
-    if(args['comment']):
-      cmt = Document('Comment Widget Record')
-      for arg in args:
-        cmt.fields[arg] = args[arg]
-      cmt.comment_date = nowdate()
-      cmt.comment_time = time.strftime('%H:%M')
-      cmt.save(1)
-	      
-    else:
-      raise Exception
-        
-  def remove_comment(self, args):
-    args = json.loads(args)
-    sql("delete from `tabComment Widget Record` where name=%s",args['id'])
diff --git a/erpnext/home/doctype/widget_control/widget_control.txt b/erpnext/home/doctype/widget_control/widget_control.txt
deleted file mode 100644
index 1b6e606..0000000
--- a/erpnext/home/doctype/widget_control/widget_control.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-# DocType, Widget Control
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:30',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'issingle': 1,
-		'istable': 0,
-		'module': 'Home',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 27
-	},
-
-	# DocType, Widget Control
-	{
-		'doctype': 'DocType',
-		'name': 'Widget Control'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/page/activity/activity.html b/erpnext/home/page/activity/activity.html
index b348d95..9fb910c 100644
--- a/erpnext/home/page/activity/activity.html
+++ b/erpnext/home/page/activity/activity.html
@@ -1,6 +1,7 @@
-<div class="layout-wrapper">
-	<a class="close" onclick="window.history.back();">&times;</a>
-	<h1>Activity</h1>
-	<div id="activity-list">
+<div class="layout-wrapper layout-wrapper-appframe">
+	<div class="layout-appframe"></div>
+	<div class="layout-main">
+		<div id="activity-list">
+		</div>		
 	</div>
 </div>
\ No newline at end of file
diff --git a/erpnext/home/page/activity/activity.js b/erpnext/home/page/activity/activity.js
index 62604b7..7df834e 100644
--- a/erpnext/home/page/activity/activity.js
+++ b/erpnext/home/page/activity/activity.js
@@ -1,5 +1,8 @@
 wn.pages['activity'].onload = function(wrapper) {
-	var list = new wn.widgets.Listing({
+	wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.layout-appframe'));
+	wrapper.appframe.title('Activity');
+	var list = new wn.ui.Listing({
+		appframe: wrapper.appframe,
 		method: 'home.page.activity.activity.get_feed',
 		parent: $('#activity-list'),
 		render_row: function(row, data) {
diff --git a/erpnext/home/page/dashboard/dashboard.js b/erpnext/home/page/dashboard/dashboard.js
index 1d01ee9..072af25 100644
--- a/erpnext/home/page/dashboard/dashboard.js
+++ b/erpnext/home/page/dashboard/dashboard.js
@@ -16,12 +16,12 @@
 
 pscript.onload_dashboard = function() {
 	// load jqplot
-	wn.require('lib/css/jqplot.css');
-	wn.require('lib/js/legacy/jquery/jquery.jqplot.min.js');
-	wn.require('lib/js/legacy/jquery/jqplot-plugins/jqplot.barRenderer.js'); 
-	wn.require('lib/js/legacy/jquery/jqplot-plugins/jqplot.canvasAxisTickRenderer.min.js');
-	wn.require('lib/js/legacy/jquery/jqplot-plugins/jqplot.canvasTextRenderer.min.js');
-	wn.require('lib/js/legacy/jquery/jqplot-plugins/jqplot.categoryAxisRenderer.min.js');
+	wn.require('lib/css/lib/jqplot.css');
+	wn.require('lib/js/lib/jqplot/jquery.jqplot.min.js');
+	wn.require('lib/js/lib/jqplot/jqplot-plugins/jqplot.barRenderer.js'); 
+	wn.require('lib/js/lib/jqplot/jqplot-plugins/jqplot.canvasAxisTickRenderer.min.js');
+	wn.require('lib/js/lib/jqplot/jqplot-plugins/jqplot.canvasTextRenderer.min.js');
+	wn.require('lib/js/lib/jqplot/jqplot-plugins/jqplot.categoryAxisRenderer.min.js');
 
 
 	pscript.dashboard_settings = {
diff --git a/erpnext/home/page/desktop/desktop.css b/erpnext/home/page/desktop/desktop.css
index cc6126e..59e50eb 100644
--- a/erpnext/home/page/desktop/desktop.css
+++ b/erpnext/home/page/desktop/desktop.css
@@ -46,10 +46,10 @@
 	width: 56px;
 	height: 56px;
 	border: 4px solid white;
-	box-shadow: 0 0 10px 1px black;
-	-moz-box-shadow: 0 0 10px 1px black;
-	-webkit-box-shadow: 0 0 10px 1px black;
-	-o-box-shadow: 0 0 10px 1px black;
+	box-shadow: 0 0 4px 1px black;
+	-moz-box-shadow: 0 0 4px 1px black;
+	-webkit-box-shadow: 0 0 4px 1px black;
+	-o-box-shadow: 0 0 4px 1px black;
 	margin: auto;
 }
 
@@ -62,17 +62,16 @@
 
 .case-label {
 	color: white;
-	/*font-size: 12px;*/
 	padding-top: 10px;
 	text-align: center;
-	text-shadow: 1px 1px 5px #000, 3px 3px 5px #000;
+	text-shadow: 1px 1px 2px #000, 1px 1px 2px #000, 1px 1px 2px #000, 0px 0px 2px #000;
 }
 
 /* Hover and click effects */
 .case-border:hover, .circle:hover, .hover-effect {
-	box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
-	-moz-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
-	-webkit-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
+	box-shadow: 0 0 2px 0px black, 0 0 4px 1px white !important;
+	-moz-box-shadow: 0 0 2px 0px black, 0 0 4px 1px white !important;
+	-webkit-box-shadow: 0 0 2px 0px black, 0 0 4px 1px white !important;
 	-o-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
 }
 
@@ -105,10 +104,10 @@
 	margin-top: -74px;
 	margin-right: 10px;
 	border: 2px solid white;
-	box-shadow: 0 0 10px 1px black;
-	-moz-box-shadow: 0 0 10px 1px black;
-	-webkit-box-shadow: 0 0 10px 1px black;
-	-o-box-shadow: 0 0 10px 1px black;
+	box-shadow: 0 0 4px 1px black;
+	-moz-box-shadow: 0 0 4px 1px black;
+	-webkit-box-shadow: 0 0 4px 1px black;
+	-o-box-shadow: 0 0 4px 1px black;
 }
 
 .circle-text {
diff --git a/erpnext/home/page/desktop/desktop.js b/erpnext/home/page/desktop/desktop.js
index 7852ab2..93acd08 100644
--- a/erpnext/home/page/desktop/desktop.js
+++ b/erpnext/home/page/desktop/desktop.js
@@ -79,7 +79,7 @@
 
 	for(var i in wn.boot.modules_list) {
 		var m = wn.boot.modules_list[i];
-		if(m!='Setup' && wn.boot.profile.allow_modules.indexOf(m)!=-1)
+		if(!in_list(['Setup', 'Dashboard'], m) && wn.boot.profile.allow_modules.indexOf(m)!=-1)
 			add_icon(m);
 	}
 
diff --git a/erpnext/home/page/event_updates/.DS_Store b/erpnext/home/page/event_updates/.DS_Store
deleted file mode 100644
index 5008ddf..0000000
--- a/erpnext/home/page/event_updates/.DS_Store
+++ /dev/null
Binary files differ
diff --git a/erpnext/home/page/event_updates/__init__.py b/erpnext/home/page/event_updates/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/page/event_updates/__init__.py
+++ /dev/null
diff --git a/erpnext/home/page/event_updates/event_updates.css b/erpnext/home/page/event_updates/event_updates.css
deleted file mode 100644
index a88fed4..0000000
--- a/erpnext/home/page/event_updates/event_updates.css
+++ /dev/null
@@ -1,62 +0,0 @@
-div.home-status {
-	margin: 7px;
-	padding: 5px;
-	color: #666;
-}
-
-span.home-status-link {
-	cursor: pointer;
-	text-decoration: underline;
-}
-
-span.home-status-unread {
-	padding: 2px 3px;
-	font-size: 11px;
-	color: #FFF;
-	background-color: RED;
-}
-
-div.setup-wizard {
-	display: none;
-	margin: 13px 0px;
-	background-color: #FED;
-	padding: 13px;
-}
-
-div.setup-wizard .header {
-	font-size: 12px;
-	font-weight: bold;
-	color: #322;
-	margin-bottom: 7px;
-}
-
-
-div.setup-wizard .percent-outer {
-	height: 17px;
-	background-color: #FFF;
-	border: 2px solid #322;
-}
-
-div.setup-wizard .percent-inner {
-	height: 17px;
-	background-color: GREEN;
-}
-
-div.setup-wizard .suggestion {
-	margin: 7px 0px;
-	color: #322;	
-}
-
-div.setup-wizard .prev-next {
-	height: 13px;
-}
-
-div.setup-wizard .prev-next span {
-	display: none;
-	float: right;
-	margin-left: 13px;
-	color: #877;
-	font-size: 11px;
-}
-
-
diff --git a/erpnext/home/page/event_updates/event_updates.html b/erpnext/home/page/event_updates/event_updates.html
deleted file mode 100644
index 41ae9a5..0000000
--- a/erpnext/home/page/event_updates/event_updates.html
+++ /dev/null
@@ -1 +0,0 @@
-<div id="updates_div"></div>
\ No newline at end of file
diff --git a/erpnext/home/page/event_updates/event_updates.js b/erpnext/home/page/event_updates/event_updates.js
deleted file mode 100644
index b2825f3..0000000
--- a/erpnext/home/page/event_updates/event_updates.js
+++ /dev/null
@@ -1,671 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-pscript['onload_Event Updates'] = function() {
-	if(user=='Guest') {
-		loadpage('Login Page');
-		return;
-	}
-			
-	pscript.home_make_body();
-	pscript.home_make_status();
-	pscript.home_set_banner();
-	pscript.home_make_widgets();
-}
-
-// ==================================
-
-pscript.home_make_body = function() {
-	var wrapper = wn.pages['Event Updates'];
-	
-	// body
-	$(wrapper).addClass('layout-wrapper').addClass('layout-wrapper-background')
-	
-	wrapper.body = $a(wrapper, 'div', 'layout-main-section');
-	wrapper.head = $a(wrapper.body, 'div');
-	wrapper.side_section =$a(wrapper, 'div', 'layout-side-section');
-	$a(wrapper, 'div', '', {clear:'both'});
-	
-	wrapper.banner_area = $a(wrapper.head, 'div');
-
-	wrapper.setup_wizard_area = $a(wrapper.body, 'div', 'setup-wizard');	
-}
-
-// ==================================
-
-pscript.home_set_banner = function(wrapper) {
-	var wrapper = wn.pages['Event Updates'];
-	var cp = wn.control_panel;
-
-	// banner
-	if(cp.client_name) {
-		var banner = $a(wrapper.banner_area, 'div', '', {paddingBottom:'4px'})
-		banner.innerHTML = cp.client_name;
-	}
-}
-
-// Widgets
-// ==================================
-
-pscript.home_make_widgets = function() {
-	var wrapper = wn.pages['Event Updates'];
-	var cell = wrapper.side_section;
-
-	// sidebar
-	sidebar = new wn.widgets.PageSidebar(cell, {
-		sections:[
-			{
-				title: 'Calendar',
-				display: function() { return !has_common(user_roles, ['Guest','Customer','Vendor'])},
-				render: function(wrapper) {
-					new HomeCalendar(new HomeWidget(wrapper, 'Calendar', 'Event'), wrapper);
-				}		
-			},
-			
-			{
-				title: 'To Do',
-				display: function() { return !has_common(user_roles, ['Guest','Customer','Vendor'])},
-				render: function(wrapper) {
-					new HomeToDo(new HomeWidget(wrapper, 'To Do', 'Item'));
-				}		
-			},
-
-			{
-				title: 'Online Users',
-				display: function() { return !has_common(user_roles, ['Guest','Customer','Vendor'])},
-				render: function(wrapper) {
-					pscript.online_users_obj = new OnlineUsers(wrapper);
-				}		
-			}
-		]
-	});
-		
-	new FeedList(wrapper.body);
-}
-
-OnlineUsers = function(wrapper) {
-	var me = this;
-	this.wrapper = wrapper;
-	
-	this.my_company_link = function() {
-		$a($a(wrapper, 'div', '', {marginBottom:'7px'}), 'span', 'link_type', 
-			{color:'#777', 'color:hover':'#FFF', fontSize:'11px'}, 
-			'See all users', function() {loadpage('My Company'); });
-	}
-	
-	this.render = function(online_users) {
-		me.my_company_link();
-		
-		if(online_users.length) {
-			var max = online_users.length; max = (max > 10 ? 10 : max)
-			me.wrapper.innerHTML = "";
-			for(var i=0; i<max; i++) {
-				new OneOnlineUser(me.wrapper, online_users[i]);
-			}
-		} else {
-			$a(wrapper, 'div', '', {'color':'#888'}, 'No user online!')
-		}
-	}
-}
-
-OneOnlineUser = function(wrapper, det) {
-	var name = cstr(det[1]) + ' ' + cstr(det[2]);
-	if(det[1]==user) name = 'You'
-	var div = $a(wrapper, 'div', '', {padding:'3px 0px'});
-	$a(div, 'div', '', {width:'7px', height:'7px', cssFloat:'left', margin:'5px', backgroundColor:'green'});
-	$a(div, 'div', '', {marginLeft:'3px'}, name);
-}
-
-HomeWidget = function(parent, heading, item) {
-	var me = this; this.item = item;
-	
-	this.wrapper = $a(parent, 'div');
-	
-	
-	// body
-	this.body = $a(this.wrapper,'div','',{paddingBottom:'16px'});
-	this.footer = $a(this.wrapper,'div');
-	
-	// add button
-	this.add_btn = $btn(this.footer,'+ Add ' + item,function(){me.add()},null,'cupid-blue');
-
-	// refresh
-	this.refresh_btn = $ln(this.footer,'Refresh',function() { me.refresh(); },{fontSize:'11px',marginLeft:'7px',color:'#888'});
-}
-
-HomeWidget.prototype.refresh = function() {
-	var me = this;
-	$di(this.working_img);
-		
-	var callback = function(r,rt) {
-		$dh(me.working_img);
-		me.body.innerHTML = '';
-
-		// prepare (for calendar?)
-		if(me.decorator.setup_body) me.decorator.setup_body();
-
-		for(var i=0;i<r.message.length;i++) {
-			new HomeWidgetItem(me, r.message[i]);
-		}
-		if(!r.message.length) {
-			$a(me.body,'div','',{color:'#777'}, me.no_items_message);
-		}
-	}
-	$c_obj('Home Control',this.get_list_method,'',callback);
-}
-
-HomeWidget.prototype.make_dialog = function() {
-	var me = this;
-	if(!this.dialog) {
-		this.dialog = new wn.widgets.Dialog();
-		this.dialog.make({
-			width: 480,
-			title: 'New ' + this.item, 
-			fields:this.dialog_fields
-		});
-		
-		this.dialog.fields_dict.save.input.onclick = function() {
-			this.set_working();
-			me.decorator.save(this);	
-		}
-	}
-}
-
-HomeWidget.prototype.add = function() {
-	this.make_dialog();
-	this.decorator.clear_dialog();
-	this.dialog.show();
-}
-
-// Item
-// --------
-
-HomeWidgetItem = function(widget, det) {
-	var me = this; this.det = det; this.widget = widget;
-	this.widget = widget; this.det = det;
-	
-	// parent
-	if(widget.decorator.get_item_parent) parent = widget.decorator.get_item_parent(det);
-	else parent = widget.body;
-	
-	if(!parent) return;
-	
-	// wrapper
-	this.wrapper = $a(parent, 'div');
-	this.tab = make_table(this.wrapper, 1, 3, '100%', ['90%', '5%', '5%'],{paddingRight:'4px'});
-
-	// buttons
-	this.edit_btn = $a($td(this.tab,0,1),'div','wn-icon ' + 'ic-doc_edit', {cursor:'pointer'});
-	this.edit_btn.onclick = function() { me.edit(); }
-
-	this.del_btn = $a($td(this.tab,0,2),'div','wn-icon ' + 'ic-trash', {cursor:'pointer'});
-	this.del_btn.onclick = function() { me.delete_item(); }
-
-	widget.decorator.render_item(this, det);
-}
-
-HomeWidgetItem.prototype.edit = function() {
-	this.widget.make_dialog();
-	this.widget.decorator.set_dialog_values(this.det);
-	this.widget.dialog.show();
-}
-
-HomeWidgetItem.prototype.delete_item = function() {
-	var me = this;
-	this.wrapper.innerHTML = '<span style="color:#888">Deleting...</span>';
-	var callback = function(r,rt) {
-		$(me.wrapper).slideUp();
-	}
-	$c_obj('Home Control',this.widget.delete_method, 
-		this.widget.get_item_id(this.det) ,callback);
-		
-}
-
-// Calendar
-// ===========================
-
-HomeCalendar = function(widget, wrapper) {
-	// calendar link
-	$ln(widget.footer,'Full Calendar',function() { loadpage('_calendar'); },{marginLeft:'7px', fontSize:'11px', color:'#888'})
-
-	this.widget = widget;
-
-	// methods
-	this.widget.get_list_method = 'get_events_list'
-	this.widget.delete_method = 'delete_event';
-	this.widget.no_items_message = 'You have no events in the next 7 days';
-	this.widget.get_item_id = function(det) { return det.name; }
-
-	this.widget.decorator = this;
-
-	var hl = [];
-	for(var i=0; i<24; i++) {
-		hl.push(((i+8) % 24) + ':00');
-	}
-
-	this.widget.dialog_fields = [
-		{fieldtype:'Date', fieldname:'event_date', label:'Event Date', reqd:1},
-		{fieldtype:'Time', fieldname:'event_hour', label:'Event Time', reqd:1},
-		{fieldtype:'Text', fieldname:'description', label:'Description', reqd:1},
-		{fieldtype:'Button', fieldname:'save', label:'Save'}
-	];
-
-	this.widget.refresh();
-}
-
-// create calendar grid
-// --------------------
-HomeCalendar.prototype.setup_body = function() {
-	var w = this.widget;
-	w.date_blocks = {};
-	for(var i=0; i<7; i++) {
-		var dt = dateutil.obj_to_str(dateutil.add_days(new Date(),i));
-		var div = $a(w.body, 'div', '', {padding:'4px 0px', borderBottom:'1px solid #AAA',display:'none'});
-		div.head = $a(div, 'div', '', {fontWeight:'bold', paddingBottom:'4px'});
-		div.head.innerHTML  = (i==0 ? 'Today' : (i==1 ? 'Tomorrow' : dateutil.str_to_user(dt)))
-		w.date_blocks[dt] = div;
-	}
-}
-
-HomeCalendar.prototype.get_item_parent = function(det) {
-	var d = this.widget.date_blocks[det.event_date]; $ds(d);
-	return d;
-}
-
-HomeCalendar.prototype.render_item = function(item, det) {	
-	var tab = make_table($td(item.tab, 0, 0), 1, 2, '100%', ['48px', null], {padding:'2px', lineHeight:'1.5em'});
-	$y(tab, {tableLayout:'fixed'});
-
-	$td(tab, 0, 0).innerHTML = '<span style="color:#888">' + det.event_hour + ':</span> ';
-	$a($td(tab, 0, 1), 'span', 'social', {}, replace_newlines(det.description));
-
-	if(det.ref_type && det.ref_name && det.ref_name != 'None') {
-		var span=$a($a($td(tab, 0, 1),'div'),'span','link_type');
-		span.innerHTML = det.ref_name; span.dt = det.ref_type;
-		span.onclick = function() { loaddoc(this.dt, this.innerHTML); }
-	}
-}
-
-HomeCalendar.prototype.clear_dialog = function() {
-	this.set_dialog_values({event_date:get_today(), event_hour:'8:00', description:''});
-}
-
-HomeCalendar.prototype.set_dialog_values = function(det) {
-	var d = this.widget.dialog;
-	d.set_values(det);
-	d.det = det;
-}
-
-HomeCalendar.prototype.save = function(btn) {
-	var d = this.widget.dialog;
-	var me = this;
-	var det = d.get_values();
-	
-	if(!det) {
-		btn.done_working();
-	 	return;
-	}
-	
-	det.name = d.det.name;
-	det.owner = user;
-	if(!det.event_type)
-		det.event_type = 'Private';
-	
-	var callback = function(r,rt) {
-		btn.done_working();
-		me.widget.dialog.hide();
-		me.widget.refresh();
-	}
-	$c_obj('Home Control','edit_event',JSON.stringify(det),callback);	
-}
-
-// Todo
-// ===========================
-
-HomeToDo = function(widget) {
-	this.widget = widget;
-
-	// methods
-	this.widget.get_list_method = 'get_todo_list';
-	this.widget.delete_method = 'remove_todo_item';
-	this.widget.no_items_message = 'Nothing to do?';
-	this.widget.get_item_id = function(det) { return det.name; }
-
-	this.widget.decorator = this;
-
-	this.widget.dialog_fields = [
-		{fieldtype:'Date', fieldname:'date', label:'Event Date', reqd:1},
-		{fieldtype:'Text', fieldname:'description', label:'Description', reqd:1},
-		{fieldtype:'Check', fieldname:'checked', label:'Completed'},
-		{fieldtype:'Select', fieldname:'priority', label:'Priority', reqd:1, 'options':['Medium','High','Low'].join('\n')},
-		{fieldtype:'Button', fieldname:'save', label:'Save'}
-	];
-
-	this.widget.refresh();	
-}
-
-HomeToDo.prototype.render_item = function(item, det) {
-	
-	// priority tag
-	var tab = make_table($td(item.tab, 0, 0), 1, 2, '100%', ['48px', null], {padding:'2px'});
-	$y(tab, {tableLayout:'fixed'});
-
-	var span = $a($td(tab, 0, 0), 'span', '', {padding:'2px',color:'#FFF',fontSize:'10px'
-		, backgroundColor:(det.priority=='Low' ? '#888' : 
-			(det.priority=='High' ? '#EDA857' : '#687FD3'))});
-		
-	$(span).css('-moz-border-radius','3px').css('-webkit-border-radius','3px');
-	span.innerHTML = det.priority;
-
-	// text
-	var span = $a($td(tab, 0, 1), 'div', 'social', {lineHeight:'1.5em'}, 
-		replace_newlines(det.description));
-	if(det.checked) $y(span,{textDecoration:'line-through'});
-	
-	// reference link
-	if(det.reference_name) {
-		$a($td(tab, 0, 1), 'div', 'social', '', 
-			repl('<a href="#!Form/%(reference_type)s/%(reference_name)s">%(reference_name)s</a>',
-				det))
-	}
-	
-	// if expired & open, then in red
-	if(!det.checked && dateutil.str_to_obj(det.date) < new Date()) {
-		$y(span,{color:'RED'}); 
-		$a($td(tab, 0, 1), 'div', '', {fontSize:'10px', color:'#666'},
-		 	dateutil.str_to_user(det.date) + ' (Overdue)');
-	} else {
-		$a($td(tab, 0, 1), 'div', '', {fontSize:'10px', color:'#666'}, 
-			dateutil.str_to_user(det.date));		
-	}
-}
-
-HomeToDo.prototype.clear_dialog = function() {
-	this.set_dialog_values(['','',get_today(),'Medium',0]);
-}
-
-HomeToDo.prototype.set_dialog_values = function(det) {
-	var d = this.widget.dialog;
-	d.set_values({
-		date: det.date,
-		priority: det.priority,
-		description: det.description,
-		checked: det.checked
-	});
-	d.det = det;
-}
-
-HomeToDo.prototype.save = function(btn) {
-	var d = this.widget.dialog;
-	var me = this;
-	
-	var det = d.get_values()
-	if(!det) {
-		btn.done_working();
-	 	return;	
-	}
-
-	det.name = d.det.name;
-	var callback = function(r,rt) {
-		btn.done_working();
-		me.widget.dialog.hide();
-		me.widget.refresh();
-	}
-	$c_obj('Home Control','add_todo_item',JSON.stringify(det),callback);	
-}
-
-// Feed
-// ==================================
-
-
-FeedList = function(parent) {
-	// settings
-	this.auto_feed_off = cint(sys_defaults.auto_feed_off);
-	
-	this.wrapper = $a(parent, 'div');
-	this.make_head();
-	this.make_list();
-	this.list.run();
-}
-
-FeedList.prototype.make_head = function() {
-	var me = this;
-	this.head = $a(this.wrapper, 'div', '', {marginBottom:'8px'});
-	
-	// head
-
-	$a(this.head,'h1','', {display:'inline'}, 'Home'); 
-
-	// refresh
-	$a(this.head,'span','link_type', 
-		{marginLeft:'7px', fontSize:'11px'}, 'refresh',
-		function() { me.run(); }
-	);
-	
-	if(has_common(user_roles, ['System Manager','Accounts Manager'])) {
-		$btn(this.head, 'Dashboard', function() {loadpage('dashboard'); }, {marginLeft:'7px'}, 'cupid-blue')
-		
-	}
-}
-
-FeedList.prototype.run = function() {
-	this.prev_date = null;
-	this.list.run();
-}
-
-FeedList.prototype.make_list = function() {
-	var me = this;
-	this.list_area = $a(this.wrapper,'div')
-	
-	this.list = new wn.widgets.Listing({
-		parent: this.list_area,
-		query: repl('select \
-			distinct t1.name, t1.feed_type, t1.doc_type, t1.doc_name, t1.subject, t1.modified_by, \
-			if(ifnull(t1.full_name,"")="", t1.owner, t1.full_name) as full_name, \
-			t1.modified, t1.color \
-			from tabFeed t1, tabUserRole t3, tabDocPerm t4 \
-			where t1.doc_type = t4.parent \
-			and t3.parent = "%(user)s" \
-			and t4.role = t3.role \
-			and ifnull(t4.`read`,0) = 1 \
-			order by t1.modified desc', {user:user}),
-		no_result_message: 'Nothing to show yet. Your feed will be updated as you start your activities',
-		render_row: function(parent, data) {
-			me.render_feed(parent, data)
-		},
-		onrun: function() {
-			$(me.wrapper).fadeIn(); 
-			if(me.after_run) me.after_run();
-		},
-		hide_refresh: true
-	});
-}
-
-FeedList.prototype.render_feed = function(parent, data) {
-	new FeedItem(parent, data, this);
-}
-
-// Item
-// -------------------------------
-
-FeedItem = function(cell, det, feedlist) {
-	var me = this;
-	
-	this.det = det; this.feedlist = feedlist;
-	this.wrapper = $a(cell,'div','',{paddingBottom:'4px'});
-	this.head = $a(this.wrapper,'div');
-
-	this.tab = make_table(this.wrapper, 1, 2, '100%', [(100/7)+'%', (600/7)+'%']);
-	$y(this.tab,{tableLayout:'fixed'})
-
-	$y($td(this.tab,0,0),{textAlign:'right',paddingRight:'4px'});
-	
-	// text
-	this.text_area = $a($td(this.tab,0,1), 'div');
-	this.render_references(this.text_area, det);	
-	this.render_tag(det);
-	
-	// add day separator
-	this.add_day_sep(det);
-}
-
-// Day separator
-// -------------------------------------------------
-
-FeedItem.prototype.add_day_sep = function(det) {
-	var me = this;
-	var prev_date = det.modified.split(' ')[0];
-	
-	var make_div = function() {
-		var div = $a(me.head, 'div', '', 
-			{borderBottom:'1px solid #888', margin:'8px 0px', padding:'2px 0px', color:'#888', fontSize:'11px'});
-		div.innerHTML = comment_when(det.modified, 1);
-		
-		// today?
-		if(prev_date==get_today()) {
-			div.innerHTML = '';
-			span = $a(div, 'span', '', {padding:'2px', color:'#000', fontWeight:'bold'});
-			span.innerHTML = 'Today';
-		}
-	}
-	
-	if(this.feedlist.prev_date && this.feedlist.prev_date != prev_date) { make_div(); }
-	if(!this.feedlist.prev_date) { make_div(); }
-	this.feedlist.prev_date = prev_date;
-}
-
-// Tag
-// -------------------------------------------------
-
-FeedItem.prototype.render_tag = function(det) {
-	// type is the name
-	tag = $a($td(this.tab,0,0), 'div', '', 
-		{color:'#FFF', padding:'3px', textAlign:'right', fontSize:'11px', 
-			whiteSpace:'nowrap', overflow:'hidden', cursor:'pointer'});
-	$br(tag,'3px');
-	$y(tag, {backgroundColor:(det.color || '#273')});
-	
-	// tag label
-	tag.innerHTML = det.feed_type || get_doctype_label(det.doc_type);
-	
-	// not comment / label
-	if(!det.feed_type) {
-		tag.dt = det.doc_type;
-		tag.onclick = function() { loaddocbrowser(this.dt); }		
-	}
-}
-
-FeedItem.prototype.render_references = function(div, det) {
-	// name
-	div.tab = make_table(div, 1, 2, '100%', [null, '15%'])	
-	var dt = det.doc_type; var dn = det.doc_name
-	
-	// link
-	if(det.feed_type=='Login') {
-		// nothing - no link		
-	} else {
-		var allow = in_list(profile.can_read, dt);
-		var span = $a($td(div.tab,0,0), 'span', (allow ? 'link_type': ''), null, 
-			det.doc_name);
-		span.dt = dt; span.dn = dn;
-		if(allow) span.onclick = function() { loaddoc(this.dt, this.dn); }		
-	}
-	
-	// subject
-	if(det.subject) {
-		$a($td(div.tab,0,0), 'span', '', {marginLeft:'7px', color:'#444'}, det.subject);
-	}
-	
-	// by
-	$y($td(div.tab,0,1), {fontSize:'11px'}).innerHTML = 
-		(strip(det.full_name) ? det.full_name : det.modified_by);
-}
-
-pscript.home_make_status = function() {
-	var wrapper = wn.pages['Event Updates'];
-
-	// get values
-	$c_page('home', 'event_updates', 'get_status_details', user,
-		function(r,rt) { 
-			//page_body.wntoolbar.set_new_comments(r.message.unread_messages);
-										
-			// render online users
-			pscript.online_users_obj.render(r.message.online_users);
-			pscript.online_users = r.message.online_users;
-	
-			// complete registration
-			if(in_list(user_roles,'System Manager')) { 
-				wn.require("erpnext/home/page/event_updates/complete_registration.js");
-				pscript.complete_registration(r.message.registration_complete, r.message.profile); 
-			}
-			
-			// setup wizard
-			if(r.message.setup_status) {
-				new SetupWizard(r.message.setup_status)
-			}
-		}
-	);	
-}
-
-SetupWizard = function(status) { 
-	var me = this;
-	$.extend(this, {
-		make: function(status) {
-			me.status = status;
-			me.wrapper = wn.pages['Event Updates'].setup_wizard_area;
-			$ds(me.wrapper);
-			me.make_percent(status.percent);
-			me.make_suggestion(status.ret);
-		},
-		make_percent: function(percent) {
-			$a(me.wrapper, 'div', 'header', {}, 'Your setup is '+percent+'% complete');
-			var o = $a(me.wrapper, 'div', 'percent-outer');
-			$a(o, 'div', 'percent-inner', {width:percent + '%'});
-		},
-		make_suggestion: function(ret) {
-			me.suggest_area = $a(me.wrapper, 'div', 'suggestion');
-			if(me.status.ret.length>1) {
-				me.prev_next = $a(me.wrapper, 'div', 'prev-next');
-
-				// next
-				me.next = $a(me.prev_next, 'span', 'link_type', null, 'Next Suggestion',
-					function() { me.show_suggestion(me.cur_sugg+1) });
-
-				// prev
-				me.prev = $a(me.prev_next, 'span', 'link_type', null, 'Previous Suggestion',
-					function() { me.show_suggestion(me.cur_sugg-1) });
-
-			}
-			if(me.status.ret.length) {
-				me.show_suggestion(0);
-			} else {
-				me.suggest_area.innerHTML = 'Congratulations: '.bold() + 'You are now on your track... Good luck';
-			}
-		},
-		show_suggestion: function(idx) {
-			me.cur_sugg = idx;
-			me.suggest_area.innerHTML = 'What you can do next: '.bold() + me.status.ret[idx];
-
-			// show hide prev, next
-			if(me.status.ret.length>1) {
-				$dh(me.prev); $dh(me.next);
-				if(idx>0) $ds(me.prev);
-				if(idx<me.status.ret.length-1) $ds(me.next);			
-			}
-		}
-	})
-	this.make(status); 
-}
diff --git a/erpnext/home/page/event_updates/event_updates.py b/erpnext/home/page/event_updates/event_updates.py
deleted file mode 100644
index 32d6756..0000000
--- a/erpnext/home/page/event_updates/event_updates.py
+++ /dev/null
@@ -1,152 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import webnotes
-from webnotes.utils import cint
-
-@webnotes.whitelist()
-def get_online_users(arg=None):
-	# get users
-	return webnotes.conn.sql("""SELECT DISTINCT t1.user, t2.first_name, t2.last_name 
-		from tabSessions t1, tabProfile t2
-		where t1.user = t2.name
-		and t1.user not in ('Guest','Administrator')
-		and TIMESTAMPDIFF(HOUR,t1.lastupdate,NOW()) <= 1""", as_list=1) or []
-
-def get_unread_messages():
-	"returns unread (docstatus-0 messages for a user)"
-	return webnotes.conn.sql("""\
-		SELECT name, comment
-		FROM `tabComment Widget Record`
-		WHERE comment_doctype IN ('My Company', 'Message')
-		AND comment_docname = %s
-		AND ifnull(docstatus,0)=0
-		""", webnotes.user.name, as_list=1)
-
-def get_open_support_tickets():
-	"""
-		Returns a count of open support tickets
-	"""
-	from webnotes.utils import cint
-	open_support_tickets =  webnotes.conn.sql("""\
-		SELECT COUNT(*) FROM `tabSupport Ticket`
-		WHERE status = 'Open'""")
-	return open_support_tickets and cint(open_support_tickets[0][0]) or 0
-
-def get_things_todo():
-	"""
-		Returns a count of incomplete todos
-	"""
-	from webnotes.utils import cint
-	incomplete_todos = webnotes.conn.sql("""\
-		SELECT COUNT(*) FROM `tabToDo Item`
-		WHERE IFNULL(checked, 0) = 0
-		AND owner = %s""", webnotes.session.get('user'))
-	return incomplete_todos and cint(incomplete_todos[0][0]) or 0
-
-def get_todays_events():
-	"""
-		Returns a count of todays events in calendar
-	"""
-	from webnotes.utils import nowdate, cint
-	todays_events = webnotes.conn.sql("""\
-		SELECT COUNT(*) FROM `tabEvent`
-		WHERE owner = %s
-		AND event_type != 'Cancel'
-		AND event_date = %s""", (
-			webnotes.session.get('user'), nowdate()))
-	return todays_events and cint(todays_events[0][0]) or 0
-
-@webnotes.whitelist()
-def get_global_status_messages(arg=None):
-	return {
-		'unread_messages': get_unread_messages(),
-		'open_support_tickets': get_open_support_tickets(),
-		'things_todo': get_things_todo(),
-		'todays_events': get_todays_events(),
-	}
-
-@webnotes.whitelist()
-def get_status_details(arg=None):
-	"""get toolbar items"""
-	from webnotes.utils import cint, date_diff, nowdate, get_defaults
-		
-	online = get_online_users()
-			
-	# system messages			
-	ret = {
-		'user_count': len(online) or 0, 
-		#'unread_messages': get_unread_messages(),
-		#'open_support_tickets': get_open_support_tickets(),
-		'online_users': online or [],
-		'setup_status': get_setup_status(),
-		'registration_complete': cint(get_defaults('registration_complete')) and 'Yes' or 'No',
-		'profile': webnotes.conn.sql("""\
-			SELECT first_name, last_name FROM `tabProfile`
-			WHERE name=%s AND docstatus<2""", webnotes.user.name, as_dict=1)
-	}
-	return ret
-
-def get_setup_status(arg=None):
-	"""
-		Returns the setup status of the current account
-	"""
-	if cint(webnotes.conn.get_global('setup_done')):
-		return ''
-		
-	percent = 20
-	ret = []
-	
-	def is_header_set():
-		header = webnotes.conn.get_value('Control Panel', None, 'client_name') or ''
-
-		if header.startswith('<div style="padding:4px; font-size:20px;">'\
-			+(webnotes.conn.get_value('Control Panel', None, 'company_name') or '')):
-			return False
-			
-		elif 'Banner Comes Here' in header:
-			return False
-			
-		else:
-			return True
-	
-	if not is_header_set():
-		ret.append('<a href="#!Form/Personalize/Personalize">Upload your company banner</a>')
-	else:
-		percent += 20
-	
-	def check_type(doctype, ret, percent):	
-		if not webnotes.conn.sql("select count(*) from tab%s" % doctype)[0][0]:
-			ret.append('''
-				<a href="#!Form/%(dt)s/New">
-				Create a new %(dt)s
-				</a> or 
-				<a href="#!Import Data/%(dt)s">
-				Import from a spreadsheet</a>''' % {'dt':doctype})
-		else:
-			percent += 20
-		return ret, percent
-
-	ret, percent = check_type('Item', ret, percent)
-	ret, percent = check_type('Customer', ret, percent)
-	ret, percent = check_type('Supplier', ret, percent)
-	
-	if percent==100:
-		webnotes.conn.set_global('setup_done', '1')
-		return ''
-		
-	return {'ret': ret, 'percent': percent}
-		
diff --git a/erpnext/home/page/event_updates/event_updates.txt b/erpnext/home/page/event_updates/event_updates.txt
deleted file mode 100644
index 21d9350..0000000
--- a/erpnext/home/page/event_updates/event_updates.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Page, Event Updates
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-12-14 10:23:23',
-		'docstatus': 0,
-		'modified': '2010-12-27 10:58:56',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Page
-	{
-		'doctype': 'Page',
-		'module': 'Home',
-		'name': '__common__',
-		'page_name': 'Event Updates',
-		'standard': 'Yes'
-	},
-
-	# Page, Event Updates
-	{
-		'doctype': 'Page',
-		'name': 'Event Updates'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/page/event_updates/event_updates_static.html b/erpnext/home/page/event_updates/event_updates_static.html
deleted file mode 100644
index 682f1b2..0000000
--- a/erpnext/home/page/event_updates/event_updates_static.html
+++ /dev/null
@@ -1 +0,0 @@
-Event Updates
\ No newline at end of file
diff --git a/erpnext/home/page/my_company/__init__.py b/erpnext/home/page/my_company/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/page/my_company/__init__.py
+++ /dev/null
diff --git a/erpnext/home/page/my_company/my_company.css b/erpnext/home/page/my_company/my_company.css
deleted file mode 100644
index d2d9a66..0000000
--- a/erpnext/home/page/my_company/my_company.css
+++ /dev/null
@@ -1,82 +0,0 @@
-/* item */
-
-div.my-company-member-item-selected {
-	background-color: #BBC;
-}
-
-
-
-/* profile */
-.my-company-name-head {
-	font-size: 14px;
-	font-weight: bold;
-	margin-bottom: 7px;
-}
-
-.my-company-email {
-	margin-bottom: 7px;
-	color: #888;
-}
-
-.my-company-online-status {
-	font-weight: bold;
-	margin-left: 7px;
-}
-
-.my-company-status {
-	margin-bottom: 7px;	
-	color: #888;
-	font-style: italics;
-}
-
-.my-company-bio {
-	margin-bottom: 7px;	
-}
-
-.my-company-toolbar {
-	margin: 7px 0px;	
-}
-
-/* conversation */
-
-.my-company-input-wrapper {
-	color: #555;
-	padding: 13px;
-}
-
-.my-company-input-wrapper td {
-	vertical-align: bottom;
-}
-
-.my-company-input-wrapper textarea {
-	height: 3em;
-	font-size: 14px;
-	width: 100%;
-	margin: 7px 0px 3px 0px;
-}
-
-.my-company-input-wrapper button {
-	margin: 0px;
-}
-
-.my-company-conversation {
-	border-top: 1px solid #DDD;
-}
-.my-company-comment-wrapper {
-	padding: 7px;
-	border-bottom: 1px solid #DDD;
-}
-
-.my-company-timestamp {
-	color: #888;
-	font-size: 11px;
-	margin: 3px;
-}
-
-.my-company-conversation-head {
-	padding: 3px;
-	background-color: #DEDEDE;
-	color: #555;
-	font-size: 14px;
-	text-align: center;
-}
\ No newline at end of file
diff --git a/erpnext/home/page/my_company/my_company.html b/erpnext/home/page/my_company/my_company.html
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/page/my_company/my_company.html
+++ /dev/null
diff --git a/erpnext/home/page/my_company/my_company.js b/erpnext/home/page/my_company/my_company.js
deleted file mode 100644
index 8217cc7..0000000
--- a/erpnext/home/page/my_company/my_company.js
+++ /dev/null
@@ -1,760 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-pscript['onload_My Company'] = function() {
-	var wrapper = wn.pages['My Company'];
-	
-	// body
-	wrapper.className = 'layout_wrapper';
-	wrapper.head = new PageHeader(wrapper, 'People');
-	wrapper.body = $a(wrapper, 'div', '', {marginRight:'11px', marginTop:'11px'});
-	
-	wrapper.message = $a(wrapper.body, 'div');
-	wrapper.tab = make_table(wrapper.body, 1, 2, '100%', ['25%','75%']);
-	
-	$y(wrapper.tab, {tableLayout:'fixed'})
-	
-	pscript.myc_make_toolbar(wrapper);
-	pscript.myc_make_list(wrapper);
-	
-	if(pscript.is_erpnext_saas) {
-		pscript.myc_show_erpnext_message();
-	}
-}
-
-pscript.myc_make_toolbar = function(wrapper) {
-	if(has_common(user_roles, ['System Manager', 'Administrator'])) {
-		wrapper.head.add_button('Add User', pscript.myc_add_user)	
-	}
-}
-
-//
-// Only for erpnext product - show max users allowed
-//
-pscript.myc_show_erpnext_message = function() {
-	var callback = function(r, rt) {
-		if(r.exc) {msgprint(r.exc); return;}
-		$a(wrapper.message, 'div', 'help_box', '', 'You have ' + r.message.enabled 
-		+ ' users enabled out of ' + r.message.max_user 
-		+ '. Go to <a href="javascript:pscript.go_to_account_settings()">Account Settings</a> to increase the number of users');
-	}
-	$c_page('home', 'my_company', 'get_max_users', '', callback)
-}
-
-//
-// Add user dialog and server call
-//
-pscript.myc_add_user = function() {
-	var fields = [{
-			fieldtype: 'Data',
-			fieldname: 'user',
-			reqd: 1,
-			label: 'Email Id of the user to add'
-		},
-		{
-			fieldtype: 'Data',
-			fieldname: 'first_name',
-			reqd: 1,
-			label: 'First Name'
-		},
-		{
-			fieldtype: 'Data',
-			fieldname: 'last_name',
-			label: 'Last Name'
-		},
-		{
-			fieldtype: 'Data',
-			fieldname: 'password',
-			reqd: 1,
-			label: 'Password'
-		},
-		{
-			fieldtype: 'Button',
-			label: 'Add',
-			fieldname: 'add'
-		}];
-
-	fields.push();
-
-	var d = new wn.widgets.Dialog({
-		title: 'Add User',
-		width: 400,
-		fields: fields
-	});
-	d.make();
-	d.fields_dict.add.input.onclick = function() {
-		v = d.get_values();
-		if(v) {
-			d.fields_dict.add.input.set_working();
-			$c_page('home', 'my_company', 'add_user', v, function(r,rt) {
-				if(r.exc) { msgprint(r.exc); return; }
-				else {
-					d.hide();
-					pscript.myc_refresh();
-				}
-			})
-		}
-	}
-	d.show();
-}
-
-pscript.myc_refresh = function() {
-	wn.pages['My Company'].member_list.lst.run();	
-}
-
-pscript.myc_make_list= function(wrapper) {
-	wrapper.member_list = new MemberList(wrapper)
-}
-
-pscript.get_fullname=function(uid) {
-	if(uid=='Administrator') return uid;
-	return wn.pages['My Company'].member_list.member_items[uid].fullname;		
-}
-
-
-
-//=============================================
-
-MemberList = function(parent) {
-	var me = this;
-	this.profiles = {};
-	this.member_items = {};
-	this.role_objects = {};
-	this.cur_profile = null;
-	
-	this.list_wrapper = $a($td(parent.tab,0,0), 'div', '', {marginLeft:'11px'});
-	var cell = $td(parent.tab,0,1);
-	$y(cell, { border: '1px solid #aaa' });
-	cell.className = 'layout_wrapper';
-	this.profile_wrapper = $a(cell, 'div');
-	
-	this.no_user_selected = $a(this.profile_wrapper, 'div', 'help_box', null, 'Please select a user to view profile');
-	
-	this.make_search();
-	if(pscript.online_users) {
-		this.make_list();		
-	} else {
-		$c_page('home', 'event_updates', 'get_online_users', '', function(r,rt) {
-			pscript.online_users = r.message;
-			me.make_list();
-		})
-	}
-}
-
-// ----------------------
-
-MemberList.prototype.make_search = function() {
-	var me = this;
-	this.search_area = $a(this.list_wrapper, 'div', '', {textAlign:'center', padding:'8px'});
-	this.search_inp = $a(this.search_area, 'input', '', {fontSize:'14px', width:'80%'});
-	this.search_inp.set_empty = function() {
-		this.value = 'Search'; $fg(this,'#888');
-	}
-	this.search_inp.onfocus = function() {
-		$fg(this,'#000');
-		if(this.value=='Search')this.value = '';
-	}
-	this.search_inp.onchange = function() {
-		if(!this.value) this.set_empty();
-	}
-	this.search_inp.set_empty();
-}
-
-// ----------------------
-
-MemberList.prototype.make_list = function() {
-	var me = this;
-	this.lst_area = $a(this.list_wrapper, 'div');
-
-	this.lst = new wn.widgets.Listing({
-		parent: this.lst_area,
-		as_dict: 1,
-		get_query: function() {
-			var c1 = '';
-			if(me.search_inp.value && me.search_inp.value != 'Search') {
-				var c1 = repl(' AND (first_name LIKE "%(txt)s" OR last_name LIKE "%(txt)s" OR name LIKE "%(txt)s")', {txt:'%' + me.search_inp.value + '%'});
-			}
-
-			return repl("SELECT name, \
-				ifnull(concat_ws(' ', first_name, last_name),'') as full_name, \
-				gender, file_list, enabled \
-				FROM tabProfile \
-				WHERE docstatus != 2 \
-				AND name not in ('Guest','Administrator') %(cond)s \
-				ORDER BY name asc",{cond:c1});			
-		},
-		render_row: function(parent, data) {
-			me.member_items[data.name] = new MemberItem(parent, data, me);			
-		}
-	});	
-	this.lst.run();
-}
-
-
-/*
-Create / show profile
-*/
-MemberList.prototype.show_profile = function(uid, member_item) {
-	$dh(this.no_user_selected);
-
-	// if not exists, create
-	if(!this.profiles[uid]) {
-		if(!member_item) member_item = this.member_items[uid];
-		this.profiles[uid] = new MemberProfile(this.profile_wrapper, uid, member_item);		
-	}
-
-	// hide current
-	if(this.cur_profile)
-		this.cur_profile.hide();
-	
-	// show this
-	this.profiles[uid].show();
-	this.cur_profile = this.profiles[uid];
-}
-
-
-// Member Item
-// List item of all profiles
-// on the left hand sidebar of the page
-
-MemberItem = function(parent, det, mlist) {
-	var me = this;
-	this.det = det;
-	this.wrapper = $a(parent, 'div');
-	this.enabled = det.enabled;
-	
-	this.tab = make_table(this.wrapper, 1,2,'100%', ['20%', '70%'], {padding:'4px', overflow:'hidden'});
-	$y(this.tab, {tableLayout:'fixed', borderCollapse:'collapse'})
-	
-	this.is_online = function() {
-		for(var i=0;i<pscript.online_users.length;i++) {
-			if(det.name==pscript.online_users[i][0]) return true;
-		}
-	}
-	
-	this.refresh_name_link = function() {
-		// online / offline
-		$fg(this.name_link,'#00B'); 
-		if(!this.is_online())
-			$fg(this.name_link,'#444');
-		if(!this.enabled)
-			$fg(this.name_link,'#777'); 
-
-	}
-	
-	this.set_image = function() {
-		// image
-		this.img = $a($td(this.tab,0,0),'img','',{width:'41px'});
-		set_user_img(this.img, det.name, null, 
-			(det.file_list ? det.file_list.split(NEWLINE)[0].split(',')[1] : 
-				('no_img_' + (det.gender=='Female' ? 'f' : 'm'))));
-	}
-	
-	// set other details like email id, name etc
-	this.set_details = function() {
-		// name
-		this.fullname = det.full_name || det.name;
-		var div = $a($td(this.tab, 0, 1), 'div', '', {fontWeight: 'bold',padding:'2px 0px'});
-		this.name_link = $a(div,'span','link_type');
-		this.name_link.innerHTML = crop(this.fullname, 15);
-		this.name_link.onclick = function() {
-			mlist.show_profile(me.det.name, me);
-		}
-
-		// "you" tag
-		if(user==det.name) {
-			var span = $a(div,'span','',{padding:'2px' ,marginLeft:'3px'});
-			span.innerHTML = '(You)'
-		}
-
-		// email id
-		var div = $a($td(this.tab, 0, 1), 'div', '', {color: '#777', fontSize:'11px'});
-		div.innerHTML = det.name;
-
-		// working img
-		var div = $a($td(this.tab, 0, 1), 'div');
-		this.working_img = $a(div,'img','',{display:'none'}); 
-		this.working_img.src = 'lib/images/ui/button-load.gif';
-		
-		this.refresh_name_link();
-		
-	}
-	
-	this.select = function() {
-		$(this.wrapper).addClass('my-company-member-item-selected');
-	}
-
-	this.deselect = function() {
-		$(this.wrapper).removeClass('my-company-member-item-selected');		
-	}
-	
-	this.set_image();
-	this.set_details();
-	
-	// show initial
-	if(user==det.name) me.name_link.onclick();
-}
-
-
-//
-// Member Profile
-// shows profile with Photo and conversation
-//
-MemberProfile = function(parent, uid, member_item) {
-	this.parent = parent;
-	this.uid = uid;
-	this.member_item = member_item;
-	var me = this;
-
-	// make the UI 
-	this.make = function() {
-		this.wrapper = $a(this.parent, 'div', '', {display:'none'});
-		this.tab = make_table(this.wrapper, 3, 2,'100%',['120px',null],{padding:'3px'});
-		$y(this.tab, {tableLayout: 'fixed'});
-		
-		this.make_image_and_bio();
-		this.make_toolbar();
-		this.make_message_list();
-	}
-	
-	// create elements
-	this.make_image_and_bio = function() {
-		var rh = $td(this.tab, 0, 1);
-		
-		// image
-		this.img = $a($td(this.tab, 0, 0), 'img','',{width:'80px', marginLeft:'10px'});
-		set_user_img(this.img, this.uid);
-
-		// details
-		this.name_area = $a(rh, 'div' , 'my-company-name-head');
-		var div = $a(rh, 'div', 'my-company-email');
-		this.email_area = $a(div, 'span');
-		this.online_status_area = $a(div, 'span', 'my-company-online-status');
-		this.bio_area = $a(rh, 'div', 'my-company-bio');	
-		this.toolbar_area = $a(rh, 'div', 'my-company-toolbar');	
-		this.status_span = $a(this.toolbar_area, 'span', '', {marginRight:'7px'});
-		
-	}
-	
-	// the toolbar
-	this.make_toolbar = function() {
-		if(has_common(['Administrator','System Manager'],user_roles)) {
-			var roles_btn = $btn(this.toolbar_area, 'Set Roles', function() { me.show_roles() },{marginRight:'3px'});
-			var delete_btn = $btn(this.toolbar_area, 'Delete User', function() { me.delete_user(); },{marginRight:'3px'});
-			var ip_btn = $btn(this.toolbar_area, 'Securty Settings', function() { me.set_security(); },{marginRight:'3px'});
-		}
-	}
-	
-	// create the role object
-	this.show_roles = function() {
-		if(!this.role_object)
-			this.role_object = new RoleObj(this.uid);
-		this.role_object.dialog.show();
-	}
-	
-	// show securty settings
-	this.set_security = function() {
-		var sd = new wn.widgets.Dialog({
-			title: 'Set User Security',
-			width: 500,
-			fields: [
-				{
-					label:'IP Address', 
-					description: 'Restrict user login by IP address, partial ips (111.111.111), \
-					multiple addresses (separated by commas) allowed', 
-					fieldname:'restrict_ip', 
-					fieldtype:'Data'
-				},
-				
-				{
-					label:'Login After',
-					description: 'User can only login after this hour (0-24)',
-					fieldtype: 'Int',
-					fieldname: 'login_after'
-				},
-
-				{
-					label:'Login Before',
-					description: 'User can only login before this hour (0-24)',
-					fieldtype: 'Int',
-					fieldname: 'login_before'
-				},
-				
-				{
-					label:'New Password',
-					description: 'Update the current user password',
-					fieldtype: 'Data',
-					fieldname: 'new_password'
-				},
-
-				{
-					label:'Update',
-					fieldtype:'Button',
-					fieldname:'update'
-				}
-			]
-		});
-
-		me.sec_dialog = sd
-
-		sd.onshow = function() {
-			me.sec_dialog.set_values({
-				restrict_ip: me.profile.restrict_ip || '',
-				login_before: me.profile.login_before || '',
-				login_after: me.profile.login_after || '',
-				new_password: ''
-			});
-		};
-		sd.fields_dict.update.input.onclick = function() {
-			var btn = this;
-			this.set_working();
-			var args = me.sec_dialog.get_values();
-			args.user = me.profile.name;
-
-			if (args.new_password) {
-				var pass_d = new wn.widgets.Dialog({
-					title: 'Your Password',
-					width: 300,
-					fields: [
-						{
-							label: 'Please Enter <b style="color: black">Your Password</b>',
-							description: "Your password is required to update the concerned user's password",
-							fieldtype: 'Password',
-							fieldname: 'sys_admin_pwd',
-							reqd: 1		
-						},
-
-						{
-							label: 'Continue',
-							fieldtype: 'Button',
-							fieldname: 'continue'
-						}
-					]
-				});
-
-				pass_d.fields_dict.continue.input.onclick = function() {
-					btn.pwd_dialog.hide();					
-					args.sys_admin_pwd = btn.pwd_dialog.get_values().sys_admin_pwd;					
-					btn.set_working();					
-					me.update_security(args);
-					btn.done_working();
-				}
-
-				pass_d.show();
-				btn.pwd_dialog = pass_d;
-				btn.done_working();
-			} else {
-				btn.done_working();
-				me.update_security(args);
-			}			
-		};
-		sd.show();		
-	}
-
-	this.update_security = function(args) {
-		$c_page('home', 'my_company', 'update_security', JSON.stringify(args), function(r,rt) {
-			if(r.exc) {
-				msgprint(r.exc);				
-				return;
-			}
-			me.sec_dialog.hide();
-			$.extend(me.profile, me.sec_dialog.get_values());
-		});
-	}
-	
-	// delete user
-	// create a confirm dialog and call server method
-	this.delete_user = function() {
-		var cp = wn.control_panel;
-
-		var d = new Dialog(400,200,'Delete User');
-		d.make_body([
-			['HTML','','Do you really want to remove '+this.uid+' from system?'],['Button','Delete']
-		]);
-		d.onshow = function() {
-			this.clear_inputs();
-		}
-
-		d.widgets['Delete'].onclick = function() {
-			this.set_working();
-
-			var callback = function(r,rt) {
-				d.hide();
-				if(r.exc) {
-					msgprint(r.exc);
-					return;
-				}
-				pscript.myc_refresh()
-				msgprint("User Deleted Successfully");
-			}
-			$c_page('home', 'my_company', 'delete_user', {'user': me.uid}, callback);
-		}
-		d.show();
-	}
-
-	// set enabled
-	this.set_enable_button = function() {
-		var me = this;
-		var act = this.profile.enabled ? 'Disable' : 'Enable';
-
-		if(this.status_button) {
-			this.status_button.innerHTML = act;	
-		} else {	
-			// make the button
-			this.status_button = $btn(this.toolbar_area, act, function() {
-				var callback = function(r,rt) {
-					locals['Profile'][me.profile.name].enabled = cint(r.message);
-					me.status_button.done_working();
-					me.refresh_enable_disable();
-				}
-				this.set_working();
-				$c_page('home','my_company', this.innerHTML.toLowerCase()+'_profile',me.profile.name, callback);
-			}, null, null, 1);
-		}
-		if(this.uid==user) $dh(this.status_button); else $di(this.status_button);
-	}
-	
-	// render the details of the user from Profile
-	this.render = function() {
-		this.profile = locals['Profile'][uid];
-		scroll(0, 0);
-
-		// name
-		if(cstr(this.profile.first_name) || cstr(this.profile.last_name)) {
-			this.fullname = cstr(this.profile.first_name) + ' ' + cstr(this.profile.last_name);
-		} else {
-			this.fullname = this.profile.name;
-		}
-		this.name_area.innerHTML = this.fullname;
-		
-		// email
-		this.email_area.innerHTML = this.profile.name;
-
-		// online / offline
-		this.online_status_area.innerHTML = (this.member_item.is_online() ? '(Online)' : '(Offline)')
-		if(this.member_item.is_online()) {
-			$y(this.online_status_area, {color:'green'});
-		}
-
-		// refresh enable / disabled
-		this.refresh_enable_disable();
-
-		// designation
-		this.bio_area.innerHTML = this.profile.designation ? ('Designation: ' + cstr(this.profile.designation) + '<br>') : '';
-		this.bio_area.innerHTML += this.profile.bio ? this.profile.bio : 'No bio';
-		
-		new MemberConversation(this.wrapper, this.profile.name, this.fullname);
-	}
-	
-	// refresh enable / disable
-	this.refresh_enable_disable = function() {
-		this.profile = locals['Profile'][this.uid]
-
-		if(!this.profile.enabled) {
-			$fg(this.name_area,'#999');
-		} else {
-			$fg(this.name_area,'#000');
-		}
-
-		this.member_item.enabled = this.profile.enabled;
-		this.member_item.refresh_name_link();
-		
-		this.status_span.innerHTML = this.profile.enabled ? 'Enabled' : 'Disabled';
-
-		// set styles and buttons
-		if(has_common(['Administrator','System Manager'],user_roles)) {
-			this.set_enable_button();
-		}		
-	}
-	
-	// Load user profile (if not loaded)
-	this.load = function() {
-		if(locals['Profile'] && locals['Profile'][uid]) {
-			this.render();
-			return;
-		}
-		var callback = function(r,rt) {
-			$dh(me.member_item.working_img);
-			$ds(me.wrapper);
-			me.loading = 0;
-			me.render();
-		}
-		$ds(this.member_item.working_img);
-		$dh(this.wrapper);
-		this.loading = 1;
-		$c('webnotes.widgets.form.load.getdoc', {'name':this.uid, 'doctype':'Profile', 'user':user}, callback);	// onload		
-	}
-	
-	// show / hide
-	this.show = function() {
-		if(!this.loading)$ds(this.wrapper);
-
-		// select profile
-		this.member_item.select();
-	}
-	this.hide = function() {
-		$dh(this.wrapper);
-
-		// select profile
-		this.member_item.deselect();
-	}
-	
-	this.make_message_list = function() {
-		
-	}
-	
-	this.make();
-	this.load();
-}
-
-
-
-
-// Member conversation
-// Between the current user and the displayed profile
-// or if same, then the conversation with all other
-// profiles
-MemberConversation = function(parent, uid, fullname) {
-	var me = this;
-	this.wrapper = $a(parent, 'div', 'my-company-conversation');
-	this.fullname = fullname;
-	this.make = function() {
-		if(user!=uid) {
-			this.make_input();			
-		}
-		this.make_list();
-		
-		// set all messages
-		// as "read" (docstatus = 0)
-		if(user==uid) {
-			$c_page('home', 'my_company', 'set_read_all_messages', '', function(r,rt) { });	
-		}
-	}
-	
-	this.make_input = function() {
-		this.input_wrapper = $a(this.wrapper, 'div', 'my-company-input-wrapper');
-		var tab = make_table(this.input_wrapper, 1, 2, '100%', ['64%','36%'], {padding: '3px'})
-		this.input = $a($td(tab,0,0), 'textarea');
-
-		// button
-		var div = $a(this.input_wrapper, 'div');
-		this.post = $btn(div, 'Post'.bold(), function() { me.post_message(); }, {margin:'0px 13px 0px 3px'})
-		this.post.disabled = true;
-		
-		this.input.onkeyup = this.input.onchange = function() {
-			if(this.value) {
-				me.post.disabled = false;
-			} else {
-				me.post.disabled = true;
-			}
-		}
-
-		// notification check
-		this.notify_check = $a_input(div, 'checkbox', null);
-		$a(div, 'span', '', {marginLeft:'3px'}, 'Notify ' + fullname + ' by email')
-	}
-	
-	this.post_message = function() {
-		if(me.input.value==$(me.input).attr('default_text')) {
-			msgprint('Please write a message first!'); return;
-		}
-		this.post.set_working();
-		$c_page('home', 'my_company', 'post_comment', {
-			uid: uid,
-			comment: $(me.input).val(),
-			notify: me.notify_check.checked ? 1 : 0
-		}, function(r,rt) {
-			$(me.input).val("").blur();
-			me.post.done_working();
-			if(r.exc) { msgprint(r.exc); return; }
-			me.notify_check.checked = false;
-			me.refresh();
-		})
-	}
-	
-	this.make_list = function() {
-		this.lst_area = $a(this.wrapper, 'div', 'my-company-conversation', {padding:'7px 13px'});
-
-		if(user==uid) {
-			this.my_messages_box = $a(this.lst_area, 'div', 'my-company-conversation-head', {marginBottom:'7px'}, 'Messages by everyone to me<br>To send a message, click on the user on the left')
-		}
-		
-		this.lst = new wn.widgets.Listing({
-			parent: this.lst_area,
-			as_dict: 1,
-			no_result_message: (user==uid 
-				? 'No messages by anyone yet' 
-				: 'No messages yet. To start a conversation post a new message'),
-
-			get_query: function() {
-				if(uid==user) {
-					return repl("SELECT comment, owner, comment_docname, creation, docstatus " +
-					"FROM `tabComment Widget Record` "+
-					"WHERE comment_doctype='My Company' " +
-					"AND comment_docname='%(user)s' " +
-					"ORDER BY creation DESC ", {user:user});
-
-				} else {
-					return repl("SELECT comment, owner, comment_docname, creation, docstatus " +
-					"FROM `tabComment Widget Record` "+
-					"WHERE comment_doctype='My Company' " +
-					"AND ((owner='%(user)s' AND comment_docname='%(uid)s') " +
-					"OR (owner='%(uid)s' AND comment_docname='%(user)s')) " +
-					"ORDER BY creation DESC ", {uid:uid, user:user});
-
-				}
-			},
-			render_row: function(parent, data) {
-				new MemberCoversationComment(parent, data, me);
-			},
-			
-		})
-		this.refresh();
-	}
-	
-	this.refresh = function() {
-		me.lst.run()
-	}
-	
-	this.make();
-}
-
-MemberCoversationComment = function(cell, det, conv) {
-	var me = this;
-	this.det = det;
-	this.wrapper = $a(cell, 'div', 'my-company-comment-wrapper');
-	this.comment = $a(this.wrapper, 'div', 'my-company-comment');
-
-	this.user = $a(this.comment, 'span', 'link_type', {fontWeight:'bold'}, pscript.get_fullname(det.owner));
-	this.user.onclick = function() {
-		wn.pages['My Company'].member_list.show_profile(me.det.owner);
-	}
-
-	var st = (!det.docstatus ? {fontWeight: 'bold'} : null);
-	this.msg = $a(this.comment, 'span', 'social', st, ': ' + det.comment);
-
-	if(det.full_name==user) {
-		$y(this.wrapper, {backgroundColor: '#D9D9F3'});
-	}
-	this.timestamp = $a(this.wrapper, 'div', 'my-company-timestamp', '', comment_when(det.creation));
-}
-
-
-
-
-
-
-
diff --git a/erpnext/home/page/my_company/my_company.py b/erpnext/home/page/my_company/my_company.py
deleted file mode 100644
index d3a7bc7..0000000
--- a/erpnext/home/page/my_company/my_company.py
+++ /dev/null
@@ -1,209 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import webnotes
-
-from webnotes.utils import cint, load_json, cstr
-from webnotes.model.doc import Document
-
-try: import json
-except: import simplejson as json
-
-@webnotes.whitelist()
-def get_account_settings_url(arg=''):
-	import server_tools.gateway_utils
-	return server_tools.gateway_utils.get_account_settings_url()
-
-@webnotes.whitelist()
-def get_max_users(arg=''):
-	from server_tools.gateway_utils import get_max_users_gateway
-	return {
-		'max_users': get_max_users_gateway(),
-		'enabled': cint(webnotes.conn.sql("select count(*) from tabProfile where ifnull(enabled,0)=1 and name not in ('Administrator', 'Guest')")[0][0])
-	}
-
-@webnotes.whitelist()
-def enable_profile(arg=''):
-	webnotes.conn.sql("update tabProfile set enabled=1 where name=%s", arg)
-	return 1
-		
-@webnotes.whitelist()
-def disable_profile(arg=''):
-	if arg=='Administrator':
-		return 'Cannot disable Administrator'
-
-	webnotes.conn.sql("update tabProfile set enabled=0 where name=%s", arg)
-	webnotes.login_manager.logout(user=arg)
-	return 0
-
-@webnotes.whitelist()
-def delete_user(args):
-	args = json.loads(args)
-	webnotes.conn.sql("update tabProfile set enabled=0, docstatus=2 where name=%s", args['user'])
-	# erpnext-saas
-	if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
-		from server_tools.gateway_utils import remove_user_gateway
-		remove_user_gateway(args['user'])
-	
-	webnotes.login_manager.logout(user=args['user'])
-
-
-@webnotes.whitelist()
-def add_user(args):
-	args = json.loads(args)
-	# erpnext-saas
-	if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
-		from server_tools.gateway_utils import add_user_gateway
-		add_user_gateway(args)
-	
-	add_profile(args)
-	
-@webnotes.whitelist()
-def add_profile(args):
-	from webnotes.utils import validate_email_add, now
-	email = args['user']
-			
-	sql = webnotes.conn.sql
-	
-	if not email:
-		email = webnotes.form_dict.get('user')
-	if not validate_email_add(email):
-		raise Exception
-		return 'Invalid Email Id'
-	
-	if sql("select name from tabProfile where name = %s", email):
-		# exists, enable it
-		sql("update tabProfile set enabled = 1, docstatus=0 where name = %s", email)
-		webnotes.msgprint('Profile exists, enabled it with new password')
-	else:
-		# does not exist, create it!
-		pr = Document('Profile')
-		pr.name = email
-		pr.email = email
-		pr.first_name = args.get('first_name')
-		pr.last_name = args.get('last_name')
-		pr.enabled = 1
-		pr.user_type = 'System User'
-		pr.save(1)
-
-	if args.get('password'):
-		sql("""
-			UPDATE tabProfile 
-			SET password = PASSWORD(%s), modified = %s
-			WHERE name = %s""", (args.get('password'), now, email))
-
-	send_welcome_mail(email, args)
-
-@webnotes.whitelist()
-def send_welcome_mail(email, args):
-	"""send welcome mail to user with password and login url"""
-	pr = Document('Profile', email)
-	from webnotes.utils.email_lib import sendmail_md
-	args.update({
-		'company': webnotes.conn.get_default('company'),
-		'password': args.get('password'),
-		'account_url': webnotes.conn.get_default('account_url')
-	})
-	if not args.get('last_name'): args['last_name'] = ''
-	sendmail_md(pr.email, subject="Welcome to ERPNext", msg=welcome_txt % args, from_defs=1)
-
-#
-# post comment
-#
-@webnotes.whitelist()
-def post_comment(arg):
-	arg = load_json(arg)
-	
-	from webnotes.model.doc import Document
-	d = Document('Comment Widget Record')
-	d.comment_doctype = 'My Company'
-	d.comment_docname = arg['uid'] # to
-	d.owner = webnotes.user.name
-	d.comment = arg['comment']
-	d.save(1)
-	
-	if cint(arg.get('notify')):
-		fn = webnotes.conn.sql('select first_name, last_name from tabProfile where name=%s', webnotes.user.name)[0]
-		if fn[0] or f[1]:
-			fn = cstr(fn[0]) + (fn[0] and ' ' or '') + cstr(fn[1])
-		else:
-			fn = webnotes.user.name
-
-		message = '''A new comment has been posted on your page by %s:
-		
-		<b>Comment:</b> %s
-		
-		To answer, please login to your erpnext account!
-
-		<a href='https://signin.erpnext.com'>https://signin.erpnext.com</a>
-		''' % (fn, arg['comment'])
-		
-		from webnotes.model.code import get_obj
-		note = get_obj('Notification Control')
-		email_msg = note.prepare_message({
-			'type': 'New Comment',
-			'message': message
-		})
-
-		sender = webnotes.user.name!='Administrator' and webnotes.user.name or 'support+admin_post@erpnext.com'
-		
-		from webnotes.utils.email_lib import sendmail
-		sendmail([arg['uid']], sender, email_msg, fn + ' has posted a new comment')
-	
-#
-# update read messages
-#
-@webnotes.whitelist()
-def set_read_all_messages(arg=''):
-	webnotes.conn.sql("""UPDATE `tabComment Widget Record`
-	SET docstatus = 1
-	WHERE comment_doctype = 'My Company'
-	AND comment_docname = %s
-	""", webnotes.user.name)
-
-@webnotes.whitelist()
-def update_security(args=''):
-	import json
-	args = json.loads(args)
-	webnotes.conn.set_value('Profile', args['user'], 'restrict_ip', args.get('restrict_ip'))
-	webnotes.conn.set_value('Profile', args['user'], 'login_after', args.get('login_after'))
-	webnotes.conn.set_value('Profile', args['user'], 'login_before', args.get('login_before'))
-
-	if 'new_password' in args:
-		if cint(webnotes.conn.get_value('Control Panel',None,'sync_with_gateway')):
-			import server_tools.gateway_utils
-			res = server_tools.gateway_utils.change_password('', args['new_password'], args['user'], args['sys_admin_pwd'])
-			if 'Traceback' not in res['message']:
-				webnotes.msgprint(res['message'])
-		webnotes.conn.sql("update tabProfile set password=password(%s) where name=%s", (args['new_password'], args['user']))
-	else: webnotes.msgprint('Settings Updated')
-
-welcome_txt = """
-## %(company)s
-
-Dear %(first_name)s %(last_name)s
-
-Welcome!
-
-A new account has been created for you, here are your details:
-
-login-id: %(user)s
-password: %(password)s
-
-To login to your new ERPNext account, please go to:
-
-%(account_url)s
-"""
diff --git a/erpnext/home/page/my_company/my_company.txt b/erpnext/home/page/my_company/my_company.txt
deleted file mode 100644
index 3183315..0000000
--- a/erpnext/home/page/my_company/my_company.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-# Page, My Company
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-12-14 10:23:19',
-		'docstatus': 0,
-		'modified': '2010-12-27 17:44:15',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Page
-	{
-		'doctype': 'Page',
-		'module': 'Home',
-		'name': '__common__',
-		'page_name': 'My Company',
-		'show_in_menu': 1,
-		'standard': 'Yes'
-	},
-
-	# These values are common for all Page Role
-	{
-		'doctype': 'Page Role',
-		'name': '__common__',
-		'parent': 'My Company',
-		'parentfield': 'roles',
-		'parenttype': 'Page'
-	},
-
-	# Page, My Company
-	{
-		'doctype': 'Page',
-		'name': 'My Company'
-	},
-
-	# Page Role
-	{
-		'doctype': 'Page Role',
-		'idx': 1,
-		'role': 'Administrator'
-	},
-
-	# Page Role
-	{
-		'doctype': 'Page Role',
-		'idx': 2,
-		'role': 'All'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/page/profile_settings/profile_settings.py b/erpnext/home/page/profile_settings/profile_settings.py
index fb633fd..dc82812 100644
--- a/erpnext/home/page/profile_settings/profile_settings.py
+++ b/erpnext/home/page/profile_settings/profile_settings.py
@@ -27,11 +27,7 @@
 	
 	if not webnotes.conn.sql('select name from tabProfile where name=%s and password=password(%s)', (webnotes.session['user'], arg['old_password'])):
 		webnotes.msgprint('Old password is not correct', raise_exception=1)
-			
-	if cint(webnotes.conn.get_value('Control Panel',None,'sync_with_gateway')):
-		import server_tools.gateway_utils
-		webnotes.msgprint(server_tools.gateway_utils.change_password(arg['old_password'], arg['new_password'])['message'])
-
+	
 	from webnotes.utils import nowdate
 	webnotes.conn.sql("update tabProfile set password=password(%s), modified=%s where name=%s",(arg['new_password'], nowdate(), webnotes.session['user']))
 	webnotes.msgprint('Password Updated');
diff --git a/erpnext/home/search_criteria/__init__.py b/erpnext/home/search_criteria/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/search_criteria/__init__.py
+++ /dev/null
diff --git a/erpnext/home/search_criteria/bills_to_be_paid/__init__.py b/erpnext/home/search_criteria/bills_to_be_paid/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/search_criteria/bills_to_be_paid/__init__.py
+++ /dev/null
diff --git a/erpnext/home/search_criteria/bills_to_be_paid/bills_to_be_paid.txt b/erpnext/home/search_criteria/bills_to_be_paid/bills_to_be_paid.txt
deleted file mode 100644
index d3acd84..0000000
--- a/erpnext/home/search_criteria/bills_to_be_paid/bills_to_be_paid.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, bills-to_be_paid
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:32',
-		'docstatus': 0,
-		'modified': '2010-05-13 17:26:48',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_cond': '`tabPayable Voucher`.outstanding_amount!=0\n`tabPayable Voucher`.docstatus=1',
-		'columns': 'Payable Voucher\x01ID,Payable Voucher\x01Voucher Date,Payable Voucher\x01Due Date,Payable Voucher\x01Credit To,Payable Voucher\x01Bill Date,Payable Voucher\x01Outstanding Amount',
-		'criteria_name': 'Bills-To be paid',
-		'doc_type': 'Payable Voucher',
-		'doctype': 'Search Criteria',
-		'filters': "{'Payable Voucher\x01Submitted':1,'Payable Voucher\x01Is Opening':'','Payable Voucher\x01Fiscal Year':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabPayable Voucher`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, bills-to_be_paid
-	{
-		'doctype': 'Search Criteria',
-		'name': 'bills-to_be_paid'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/bills_to_be_submitted/__init__.py b/erpnext/home/search_criteria/bills_to_be_submitted/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/search_criteria/bills_to_be_submitted/__init__.py
+++ /dev/null
diff --git a/erpnext/home/search_criteria/bills_to_be_submitted/bills_to_be_submitted.txt b/erpnext/home/search_criteria/bills_to_be_submitted/bills_to_be_submitted.txt
deleted file mode 100644
index 0849dbe..0000000
--- a/erpnext/home/search_criteria/bills_to_be_submitted/bills_to_be_submitted.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# Search Criteria, bills-to_be_submitted
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:32',
-		'docstatus': 0,
-		'modified': '2010-05-03 12:24:43',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'Payable Voucher\x01ID,Payable Voucher\x01Voucher Date,Payable Voucher\x01Due Date,Payable Voucher\x01Credit To,Payable Voucher\x01Bill No,Payable Voucher\x01Bill Date,Payable Voucher\x01Outstanding Amount',
-		'criteria_name': 'Bills-To be submitted',
-		'doc_type': 'Payable Voucher',
-		'doctype': 'Search Criteria',
-		'filters': "{'Payable Voucher\x01Saved':1,'Payable Voucher\x01Is Opening':'','Payable Voucher\x01Fiscal Year':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabPayable Voucher`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, bills-to_be_submitted
-	{
-		'doctype': 'Search Criteria',
-		'name': 'bills-to_be_submitted'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/delivery_note_to_be_billed/__init__.py b/erpnext/home/search_criteria/delivery_note_to_be_billed/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/search_criteria/delivery_note_to_be_billed/__init__.py
+++ /dev/null
diff --git a/erpnext/home/search_criteria/delivery_note_to_be_billed/delivery_note_to_be_billed.txt b/erpnext/home/search_criteria/delivery_note_to_be_billed/delivery_note_to_be_billed.txt
deleted file mode 100644
index d96981c..0000000
--- a/erpnext/home/search_criteria/delivery_note_to_be_billed/delivery_note_to_be_billed.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, delivery_note-to_be_billed
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:32',
-		'docstatus': 0,
-		'modified': '2010-05-13 17:24:34',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_cond': 'ifnull(`tabDelivery Note`.per_billed, 0) < 100',
-		'columns': 'Delivery Note\x01ID,Delivery Note\x01Owner,Delivery Note\x01Customer Name,Delivery Note\x01% Billed,Delivery Note\x01Company',
-		'criteria_name': 'Delivery Note-To be billed',
-		'doc_type': 'Delivery Note',
-		'doctype': 'Search Criteria',
-		'filters': "{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'Submitted','Delivery Note\x01Fiscal Year':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabDelivery Note`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, delivery_note-to_be_billed
-	{
-		'doctype': 'Search Criteria',
-		'name': 'delivery_note-to_be_billed'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/delivery_note_to_be_submitted/__init__.py b/erpnext/home/search_criteria/delivery_note_to_be_submitted/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/search_criteria/delivery_note_to_be_submitted/__init__.py
+++ /dev/null
diff --git a/erpnext/home/search_criteria/delivery_note_to_be_submitted/delivery_note_to_be_submitted.txt b/erpnext/home/search_criteria/delivery_note_to_be_submitted/delivery_note_to_be_submitted.txt
deleted file mode 100644
index 85fd748..0000000
--- a/erpnext/home/search_criteria/delivery_note_to_be_submitted/delivery_note_to_be_submitted.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# Search Criteria, delivery_note-to_be_submitted
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:32',
-		'docstatus': 0,
-		'modified': '2010-05-13 17:17:58',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'Delivery Note\x01ID,Delivery Note\x01Owner,Delivery Note\x01Customer Name,Delivery Note\x01Posting Date,Delivery Note\x01Company',
-		'criteria_name': 'Delivery Note-To be submitted',
-		'doc_type': 'Delivery Note',
-		'doctype': 'Search Criteria',
-		'filters': "{'Delivery Note\x01Saved':1,'Delivery Note\x01Status':'Draft','Delivery Note\x01Fiscal Year':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabDelivery Note`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, delivery_note-to_be_submitted
-	{
-		'doctype': 'Search Criteria',
-		'name': 'delivery_note-to_be_submitted'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/enquiry_quotations_to_be_sent/__init__.py b/erpnext/home/search_criteria/enquiry_quotations_to_be_sent/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/search_criteria/enquiry_quotations_to_be_sent/__init__.py
+++ /dev/null
diff --git a/erpnext/home/search_criteria/enquiry_quotations_to_be_sent/enquiry_quotations_to_be_sent.txt b/erpnext/home/search_criteria/enquiry_quotations_to_be_sent/enquiry_quotations_to_be_sent.txt
deleted file mode 100644
index 4e62558..0000000
--- a/erpnext/home/search_criteria/enquiry_quotations_to_be_sent/enquiry_quotations_to_be_sent.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Search Criteria, enquiry-quotations_to_be_sent
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:31',
-		'docstatus': 0,
-		'modified': '2010-07-16 13:29:58',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_cond': '`tabQuotation`.enq_no!=`tabEnquiry`.name\n',
-		'add_tab': 'tabQuotation',
-		'columns': 'Enquiry\x01ID,Enquiry\x01Owner',
-		'criteria_name': 'Enquiry-Quotations to be sent',
-		'doc_type': 'Enquiry',
-		'doctype': 'Search Criteria',
-		'filters': '{}',
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabEnquiry`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, enquiry-quotations_to_be_sent
-	{
-		'doctype': 'Search Criteria',
-		'name': 'enquiry-quotations_to_be_sent'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/enquiry_to_follow_up/__init__.py b/erpnext/home/search_criteria/enquiry_to_follow_up/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/search_criteria/enquiry_to_follow_up/__init__.py
+++ /dev/null
diff --git a/erpnext/home/search_criteria/enquiry_to_follow_up/enquiry_to_follow_up.js b/erpnext/home/search_criteria/enquiry_to_follow_up/enquiry_to_follow_up.js
deleted file mode 100644
index 16c3ec7..0000000
--- a/erpnext/home/search_criteria/enquiry_to_follow_up/enquiry_to_follow_up.js
+++ /dev/null
@@ -1,21 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-
-  this.filter_fields_dict['Enquiry'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
-  this.filter_fields_dict['Enquiry'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
-}
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/enquiry_to_follow_up/enquiry_to_follow_up.txt b/erpnext/home/search_criteria/enquiry_to_follow_up/enquiry_to_follow_up.txt
deleted file mode 100644
index 504e7f2..0000000
--- a/erpnext/home/search_criteria/enquiry_to_follow_up/enquiry_to_follow_up.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, enquiry-to_follow_up
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-09-01 15:48:09',
-		'docstatus': 0,
-		'modified': '2010-08-30 12:08:00',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_cond': "`tabEnquiry`.name=`tabQuotation`.enq_no\n`tabEnquiry`.docstatus=1\n`tabQuotation`.status='Submitted'",
-		'columns': 'Enquiry\x01ID,Enquiry\x01Owner,Enquiry\x01Company,Enquiry\x01Fiscal Year',
-		'criteria_name': 'Enquiry-To follow up',
-		'doc_type': 'Enquiry',
-		'doctype': 'Search Criteria',
-		'filters': "{'Enquiry\x01Fiscal Year':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabEnquiry`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, enquiry-to_follow_up
-	{
-		'doctype': 'Search Criteria',
-		'name': 'enquiry-to_follow_up'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/indent_purchase_order_to_be_made/__init__.py b/erpnext/home/search_criteria/indent_purchase_order_to_be_made/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/search_criteria/indent_purchase_order_to_be_made/__init__.py
+++ /dev/null
diff --git a/erpnext/home/search_criteria/indent_purchase_order_to_be_made/indent_purchase_order_to_be_made.txt b/erpnext/home/search_criteria/indent_purchase_order_to_be_made/indent_purchase_order_to_be_made.txt
deleted file mode 100644
index be45e27..0000000
--- a/erpnext/home/search_criteria/indent_purchase_order_to_be_made/indent_purchase_order_to_be_made.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, indent-purchase_order_to_be_made
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:32',
-		'docstatus': 0,
-		'modified': '2010-05-13 17:37:18',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_cond': "`tabIndent`.status='Submitted'\nifnull(`tabIndent`.per_ordered,0)<100",
-		'columns': 'Indent\x01ID,Indent\x01Indent Date,Indent\x01Requested By,Indent\x01Owner,Indent\x01% Ordered',
-		'criteria_name': 'Indent-Purchase Order to be made',
-		'doc_type': 'Indent',
-		'doctype': 'Search Criteria',
-		'filters': "{'Indent\x01Submitted':1,'Indent\x01Status':'Submitted','Indent\x01Fiscal Year':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabIndent`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, indent-purchase_order_to_be_made
-	{
-		'doctype': 'Search Criteria',
-		'name': 'indent-purchase_order_to_be_made'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/indent_to_be_submitted/__init__.py b/erpnext/home/search_criteria/indent_to_be_submitted/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/search_criteria/indent_to_be_submitted/__init__.py
+++ /dev/null
diff --git a/erpnext/home/search_criteria/indent_to_be_submitted/indent_to_be_submitted.txt b/erpnext/home/search_criteria/indent_to_be_submitted/indent_to_be_submitted.txt
deleted file mode 100644
index 7cacf7d..0000000
--- a/erpnext/home/search_criteria/indent_to_be_submitted/indent_to_be_submitted.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, indent-to_be_submitted
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:32',
-		'docstatus': 0,
-		'modified': '2010-05-13 17:38:49',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_cond': "`tabIndent`.status='Draft'",
-		'columns': 'Indent\x01ID,Indent\x01Owner,Indent\x01Indent Date,Indent\x01Remarks',
-		'criteria_name': 'Indent-To be submitted',
-		'doc_type': 'Indent',
-		'doctype': 'Search Criteria',
-		'filters': "{'Indent\x01Saved':1,'Indent\x01Status':'Draft','Indent\x01Fiscal Year':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabIndent`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, indent-to_be_submitted
-	{
-		'doctype': 'Search Criteria',
-		'name': 'indent-to_be_submitted'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/invoices_overdue/invoices_overdue.txt b/erpnext/home/search_criteria/invoices_overdue/invoices_overdue.txt
deleted file mode 100644
index 74716c7..0000000
--- a/erpnext/home/search_criteria/invoices_overdue/invoices_overdue.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, invoices-overdue
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:31',
-		'docstatus': 0,
-		'modified': '2010-04-30 17:08:52',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_cond': '`tabReceivable Voucher`.due_date<now()\n`tabReceivable Voucher`.outstanding_amount!=0\n`tabReceivable Voucher`.docstatus=1',
-		'columns': 'Receivable Voucher\x01ID,Receivable Voucher\x01Debit To,Receivable Voucher\x01Voucher Date,Receivable Voucher\x01Due Date,Receivable Voucher\x01Outstanding Amount',
-		'criteria_name': 'Invoices-Overdue',
-		'doc_type': 'Receivable Voucher',
-		'doctype': 'Search Criteria',
-		'filters': "{'Receivable Voucher\x01Saved':1,'Receivable Voucher\x01Submitted':1,'Receivable Voucher\x01Is Opening':'','Receivable Voucher\x01Fiscal Year':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabReceivable Voucher`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, invoices-overdue
-	{
-		'doctype': 'Search Criteria',
-		'name': 'invoices-overdue'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/invoices_to_be_submitted/__init__.py b/erpnext/home/search_criteria/invoices_to_be_submitted/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/search_criteria/invoices_to_be_submitted/__init__.py
+++ /dev/null
diff --git a/erpnext/home/search_criteria/invoices_to_be_submitted/invoices_to_be_submitted.txt b/erpnext/home/search_criteria/invoices_to_be_submitted/invoices_to_be_submitted.txt
deleted file mode 100644
index dc4f5e5..0000000
--- a/erpnext/home/search_criteria/invoices_to_be_submitted/invoices_to_be_submitted.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# Search Criteria, invoices-to_be_submitted
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:31',
-		'docstatus': 0,
-		'modified': '2010-05-03 10:18:56',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'Receivable Voucher\x01ID,Receivable Voucher\x01Debit To,Receivable Voucher\x01Voucher Date,Receivable Voucher\x01Due Date',
-		'criteria_name': 'Invoices-To be submitted',
-		'doc_type': 'Receivable Voucher',
-		'doctype': 'Search Criteria',
-		'filters': "{'Receivable Voucher\x01Saved':1,'Receivable Voucher\x01Is Opening':'','Receivable Voucher\x01Fiscal Year':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabReceivable Voucher`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, invoices-to_be_submitted
-	{
-		'doctype': 'Search Criteria',
-		'name': 'invoices-to_be_submitted'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/invoices_to_receive_payment/__init__.py b/erpnext/home/search_criteria/invoices_to_receive_payment/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/search_criteria/invoices_to_receive_payment/__init__.py
+++ /dev/null
diff --git a/erpnext/home/search_criteria/invoices_to_receive_payment/invoices_to_receive_payment.txt b/erpnext/home/search_criteria/invoices_to_receive_payment/invoices_to_receive_payment.txt
deleted file mode 100644
index a1ce7ef..0000000
--- a/erpnext/home/search_criteria/invoices_to_receive_payment/invoices_to_receive_payment.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, invoices-to_receive_payment
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:31',
-		'docstatus': 0,
-		'modified': '2010-04-30 16:54:26',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_cond': '`tabReceivable Voucher`.due_date>now() \n`tabReceivable Voucher`.outstanding_amount!=0\n`tabReceivable Voucher`.docstatus=1',
-		'columns': 'Receivable Voucher\x01ID,Receivable Voucher\x01Owner,Receivable Voucher\x01Debit To,Receivable Voucher\x01Voucher Date,Receivable Voucher\x01Due Date,Receivable Voucher\x01Outstanding Amount',
-		'criteria_name': 'Invoices-To receive payment',
-		'doc_type': 'Receivable Voucher',
-		'doctype': 'Search Criteria',
-		'filters': "{'Receivable Voucher\x01Submitted':1,'Receivable Voucher\x01Is Opening':'','Receivable Voucher\x01Fiscal Year':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabReceivable Voucher`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, invoices-to_receive_payment
-	{
-		'doctype': 'Search Criteria',
-		'name': 'invoices-to_receive_payment'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/lead_to_follow_up/lead_to_follow_up.txt b/erpnext/home/search_criteria/lead_to_follow_up/lead_to_follow_up.txt
deleted file mode 100644
index 0754bf7..0000000
--- a/erpnext/home/search_criteria/lead_to_follow_up/lead_to_follow_up.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, lead-to_follow_up
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-09-01 15:48:09',
-		'docstatus': 0,
-		'modified': '2010-08-30 12:01:19',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_cond': "`tabLead`.status!='Converted' \n`tabLead`.status!='Lead Lost' \n`tabLead`.status!='Not Interested'",
-		'columns': 'Lead\x01ID,Lead\x01Status,Lead\x01Lead Name,Lead\x01Lead Date,Lead\x01Lead Owner,Lead\x01Next Contact Date',
-		'criteria_name': 'Lead-To follow up',
-		'doc_type': 'Lead',
-		'doctype': 'Search Criteria',
-		'filters': "{'Lead\x01Status':'','Lead\x01Source':'','Lead\x01Expected Month':'','Lead\x01Industry':'','Lead\x01Market Segment':'','Lead\x01Rating':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabLead`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, lead-to_follow_up
-	{
-		'doctype': 'Search Criteria',
-		'name': 'lead-to_follow_up'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/purchase_order_to_be_billed/__init__.py b/erpnext/home/search_criteria/purchase_order_to_be_billed/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/search_criteria/purchase_order_to_be_billed/__init__.py
+++ /dev/null
diff --git a/erpnext/home/search_criteria/purchase_order_to_be_billed/purchase_order_to_be_billed.txt b/erpnext/home/search_criteria/purchase_order_to_be_billed/purchase_order_to_be_billed.txt
deleted file mode 100644
index 5ed4d3f..0000000
--- a/erpnext/home/search_criteria/purchase_order_to_be_billed/purchase_order_to_be_billed.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, purchase_order-to_be_billed
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:32',
-		'docstatus': 0,
-		'modified': '2010-05-13 17:31:42',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_cond': "ifnull(`tabPurchase Order`.per_billed,0)<100\n`tabPurchase Order`.status='Submitted'",
-		'columns': 'Purchase Order\x01ID,Purchase Order\x01Supplier,Purchase Order\x01PO Date,Purchase Order\x01Company,Purchase Order\x01Grand Total',
-		'criteria_name': 'Purchase Order-To be billed',
-		'doc_type': 'Purchase Order',
-		'doctype': 'Search Criteria',
-		'filters': "{'Purchase Order\x01Submitted':1,'Purchase Order\x01Status':'Submitted','Purchase Order\x01Fiscal Year':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabPurchase Order`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, purchase_order-to_be_billed
-	{
-		'doctype': 'Search Criteria',
-		'name': 'purchase_order-to_be_billed'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/purchase_order_to_be_submitted/__init__.py b/erpnext/home/search_criteria/purchase_order_to_be_submitted/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/search_criteria/purchase_order_to_be_submitted/__init__.py
+++ /dev/null
diff --git a/erpnext/home/search_criteria/purchase_order_to_be_submitted/purchase_order_to_be_submitted.txt b/erpnext/home/search_criteria/purchase_order_to_be_submitted/purchase_order_to_be_submitted.txt
deleted file mode 100644
index 11422b8..0000000
--- a/erpnext/home/search_criteria/purchase_order_to_be_submitted/purchase_order_to_be_submitted.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# Search Criteria, purchase_order-to_be_submitted
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:32',
-		'docstatus': 0,
-		'modified': '2010-05-03 11:19:23',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'Purchase Order\x01ID,Purchase Order\x01Supplier,Purchase Order\x01PO Date,Purchase Order\x01Company,Purchase Order\x01Grand Total',
-		'criteria_name': 'Purchase Order-To be submitted',
-		'doc_type': 'Purchase Order',
-		'doctype': 'Search Criteria',
-		'filters': "{'Purchase Order\x01Saved':1,'Purchase Order\x01Submitted':0,'Purchase Order\x01Status':'Draft','Purchase Order\x01Fiscal Year':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabPurchase Order`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, purchase_order-to_be_submitted
-	{
-		'doctype': 'Search Criteria',
-		'name': 'purchase_order-to_be_submitted'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/purchase_order_to_receive_items/__init__.py b/erpnext/home/search_criteria/purchase_order_to_receive_items/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/search_criteria/purchase_order_to_receive_items/__init__.py
+++ /dev/null
diff --git a/erpnext/home/search_criteria/purchase_order_to_receive_items/purchase_order_to_receive_items.txt b/erpnext/home/search_criteria/purchase_order_to_receive_items/purchase_order_to_receive_items.txt
deleted file mode 100644
index ab747c7..0000000
--- a/erpnext/home/search_criteria/purchase_order_to_receive_items/purchase_order_to_receive_items.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, purchase_order-to_receive_items
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:32',
-		'docstatus': 0,
-		'modified': '2010-05-13 17:34:22',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_cond': "ifnull(`tabPurchase Order`.per_received,0)<100\n`tabPurchase Order`.status='Submitted'",
-		'columns': 'Purchase Order\x01ID,Purchase Order\x01Supplier,Purchase Order\x01PO Date,Purchase Order\x01Company,Purchase Order\x01% Received,Purchase Order\x01Grand Total',
-		'criteria_name': 'Purchase Order-To receive items',
-		'doc_type': 'Purchase Order',
-		'doctype': 'Search Criteria',
-		'filters': "{'Purchase Order\x01Submitted':1,'Purchase Order\x01Status':'Submitted','Purchase Order\x01Fiscal Year':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabPurchase Order`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, purchase_order-to_receive_items
-	{
-		'doctype': 'Search Criteria',
-		'name': 'purchase_order-to_receive_items'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/sales_order_overdue/__init__.py b/erpnext/home/search_criteria/sales_order_overdue/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/search_criteria/sales_order_overdue/__init__.py
+++ /dev/null
diff --git a/erpnext/home/search_criteria/sales_order_overdue/sales_order_overdue.txt b/erpnext/home/search_criteria/sales_order_overdue/sales_order_overdue.txt
deleted file mode 100644
index 416ee67..0000000
--- a/erpnext/home/search_criteria/sales_order_overdue/sales_order_overdue.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, sales_order-overdue
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-26 11:52:28',
-		'docstatus': 0,
-		'modified': '2010-08-26 11:52:09',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_cond': '`tabSales Order`.delivery_date<now()\nifnull(`tabSales Order`.per_delivered,0)<100',
-		'columns': 'Sales Order\x01ID,Sales Order\x01Customer,Sales Order\x01Sales Order Date,Sales Order\x01Expected Delivery Date,Sales Order\x01Quotation No,Sales Order\x01Company,Sales Order\x01%  Delivered',
-		'criteria_name': 'Sales Order-Overdue',
-		'doc_type': 'Sales Order',
-		'doctype': 'Search Criteria',
-		'filters': "{'Sales Order\x01Submitted':1,'Sales Order\x01Status':'Submitted','Sales Order\x01Fiscal Year':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabSales Order`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, sales_order-overdue
-	{
-		'doctype': 'Search Criteria',
-		'name': 'sales_order-overdue'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/sales_order_to_be_billed/__init__.py b/erpnext/home/search_criteria/sales_order_to_be_billed/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/search_criteria/sales_order_to_be_billed/__init__.py
+++ /dev/null
diff --git a/erpnext/home/search_criteria/sales_order_to_be_billed/sales_order_to_be_billed.txt b/erpnext/home/search_criteria/sales_order_to_be_billed/sales_order_to_be_billed.txt
deleted file mode 100644
index 3de9f17..0000000
--- a/erpnext/home/search_criteria/sales_order_to_be_billed/sales_order_to_be_billed.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, sales_order-to_be_billed
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:31',
-		'docstatus': 0,
-		'modified': '2010-05-13 17:45:37',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_cond': "ifnull(`tabSales Order`.per_billed,0)<100\n`tabSales Order`.status='Submitted'",
-		'columns': 'Sales Order\x01ID,Sales Order\x01Status,Sales Order\x01Quotation No,Sales Order\x01Sales Order Date,Sales Order\x01Expected Delivery Date,Sales Order\x01% Billed,Sales Order\x01Customer',
-		'criteria_name': 'Sales Order-To be billed',
-		'doc_type': 'Sales Order',
-		'doctype': 'Search Criteria',
-		'filters': "{'Sales Order\x01Submitted':1,'Sales Order\x01Fiscal Year':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabSales Order`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, sales_order-to_be_billed
-	{
-		'doctype': 'Search Criteria',
-		'name': 'sales_order-to_be_billed'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/sales_order_to_be_delivered/__init__.py b/erpnext/home/search_criteria/sales_order_to_be_delivered/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/search_criteria/sales_order_to_be_delivered/__init__.py
+++ /dev/null
diff --git a/erpnext/home/search_criteria/sales_order_to_be_delivered/sales_order_to_be_delivered.txt b/erpnext/home/search_criteria/sales_order_to_be_delivered/sales_order_to_be_delivered.txt
deleted file mode 100644
index 1018f46..0000000
--- a/erpnext/home/search_criteria/sales_order_to_be_delivered/sales_order_to_be_delivered.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, sales_order-to_be_delivered
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:31',
-		'docstatus': 0,
-		'modified': '2010-05-13 17:53:29',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_cond': "ifnull(`tabSales Order`.per_delivered,0)<100\n`tabSales Order`.status = 'Submitted'\n`tabSales Order`. delivery_date > now()",
-		'columns': 'Sales Order\x01ID,Sales Order\x01Owner,Sales Order\x01Status,Sales Order\x01Customer,Sales Order\x01Sales Order Date,Sales Order\x01Expected Delivery Date,Sales Order\x01Quotation No',
-		'criteria_name': 'Sales Order-To be delivered',
-		'doc_type': 'Sales Order',
-		'doctype': 'Search Criteria',
-		'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Fiscal Year':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 100,
-		'sort_by': '`tabSales Order`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, sales_order-to_be_delivered
-	{
-		'doctype': 'Search Criteria',
-		'name': 'sales_order-to_be_delivered'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/sales_order_to_be_submitted/__init__.py b/erpnext/home/search_criteria/sales_order_to_be_submitted/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/search_criteria/sales_order_to_be_submitted/__init__.py
+++ /dev/null
diff --git a/erpnext/home/search_criteria/sales_order_to_be_submitted/sales_order_to_be_submitted.txt b/erpnext/home/search_criteria/sales_order_to_be_submitted/sales_order_to_be_submitted.txt
deleted file mode 100644
index 9cc5106..0000000
--- a/erpnext/home/search_criteria/sales_order_to_be_submitted/sales_order_to_be_submitted.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, sales_order-to_be_submitted
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:31',
-		'docstatus': 0,
-		'modified': '2010-05-13 17:47:45',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_cond': "`tabSales Order`.status='Draft'",
-		'columns': 'Sales Order\x01ID,Sales Order\x01Customer,Sales Order\x01Sales Order Date,Sales Order\x01Quotation No',
-		'criteria_name': 'Sales Order-To be submitted',
-		'doc_type': 'Sales Order',
-		'doctype': 'Search Criteria',
-		'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Fiscal Year':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 100,
-		'sort_by': '`tabSales Order`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, sales_order-to_be_submitted
-	{
-		'doctype': 'Search Criteria',
-		'name': 'sales_order-to_be_submitted'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/serial_no_amc_expiring_this_month/serial_no_amc_expiring_this_month.txt b/erpnext/home/search_criteria/serial_no_amc_expiring_this_month/serial_no_amc_expiring_this_month.txt
deleted file mode 100644
index e2ed6d1..0000000
--- a/erpnext/home/search_criteria/serial_no_amc_expiring_this_month/serial_no_amc_expiring_this_month.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, serial_no-amc_expiring_this_month
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:32',
-		'docstatus': 0,
-		'modified': '2010-07-29 15:01:33',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_cond': '`tab Serial No`.month(amc_expiry_date)=month(now()) \n`tab Serial No`.year(amc_expiry_date)=year(now())',
-		'columns': 'Serial No\x01ID,Serial No\x01Status,Serial No\x01AMC Expiry Date,Serial No\x01Customer Name',
-		'criteria_name': 'Serial No-AMC expiring this month',
-		'doc_type': 'Serial No',
-		'doctype': 'Search Criteria',
-		'filters': "{'Serial No\x01Saved':1,'Serial No\x01Submitted':1,'Serial No\x01Status':'','Serial No\x01Warranty Status':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabSerial No`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, serial_no-amc_expiring_this_month
-	{
-		'doctype': 'Search Criteria',
-		'name': 'serial_no-amc_expiring_this_month'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/serial_no_warranty_expiring_this_month/serial_no_warranty_expiring_this_month.txt b/erpnext/home/search_criteria/serial_no_warranty_expiring_this_month/serial_no_warranty_expiring_this_month.txt
deleted file mode 100644
index 406d8dd..0000000
--- a/erpnext/home/search_criteria/serial_no_warranty_expiring_this_month/serial_no_warranty_expiring_this_month.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, serial_no-warranty_expiring_this_month
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:32',
-		'docstatus': 0,
-		'modified': '2010-07-23 09:57:51',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_cond': "`tab Serial No`.docstatus!=2\n`tab Serial No`.maintenance_status='Under Warranty'\n`tab Serial No`.status!='Scrapped'\n`tab Serial No`.status!='Not in Use'\n`tab Serial No`.month(ifnull(warranty_expiry_date,0)) = month(now()) \n`tab Serial No`.yearmonth(ifnull(warranty_expiry_date,0)) = year(now())",
-		'columns': 'Serial No\x01ID,Serial No\x01Status,Serial No\x01Warranty Expiry Date,Serial No\x01Customer Name',
-		'criteria_name': 'Serial No-Warranty expiring this month',
-		'doc_type': 'Serial No',
-		'doctype': 'Search Criteria',
-		'filters': "{'Serial No\x01Saved':1,'Serial No\x01Submitted':1,'Serial No\x01Status':'Issued','Serial No\x01Maintenance Status':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabSerial No`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, serial_no-warranty_expiring_this_month
-	{
-		'doctype': 'Search Criteria',
-		'name': 'serial_no-warranty_expiring_this_month'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/task_open/__init__.py b/erpnext/home/search_criteria/task_open/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/search_criteria/task_open/__init__.py
+++ /dev/null
diff --git a/erpnext/home/search_criteria/task_open/task_open.txt b/erpnext/home/search_criteria/task_open/task_open.txt
deleted file mode 100644
index 4d1998c..0000000
--- a/erpnext/home/search_criteria/task_open/task_open.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, task-open
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:32',
-		'docstatus': 0,
-		'modified': '2010-07-16 13:03:49',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_cond': "`tabTicket`.status='Open'",
-		'columns': 'Ticket\x01ID,Ticket\x01Subject,Ticket\x01Priority,Ticket\x01Raised By,Ticket\x01Allocated To',
-		'criteria_name': 'Task-Open',
-		'doc_type': 'Ticket',
-		'doctype': 'Search Criteria',
-		'filters': "{'Ticket\x01Priority':''}",
-		'module': 'Home',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabTicket`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, task-open
-	{
-		'doctype': 'Search Criteria',
-		'name': 'task-open'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/DocType Mapper/Appraisal Template-Appraisal/Appraisal Template-Appraisal.txt b/erpnext/hr/DocType Mapper/Appraisal Template-Appraisal/Appraisal Template-Appraisal.txt
new file mode 100644
index 0000000..ec2bd06
--- /dev/null
+++ b/erpnext/hr/DocType Mapper/Appraisal Template-Appraisal/Appraisal Template-Appraisal.txt
@@ -0,0 +1,47 @@
+# DocType Mapper, Appraisal Template-Appraisal
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2010-09-01 15:47:59',
+		'docstatus': 0,
+		'modified': '2012-04-03 12:49:50',
+		'modified_by': u'Administrator',
+		'owner': u'ashwini@webnotestech.com'
+	},
+
+	# These values are common for all Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'kra_sheet',
+		'from_table': u'Appraisal Template Goal',
+		'match_id': 0,
+		'name': '__common__',
+		'parent': u'Appraisal Template-Appraisal',
+		'parentfield': u'table_mapper_details',
+		'parenttype': u'DocType Mapper',
+		'to_field': u'appraisal_details',
+		'to_table': u'Appraisal Goal',
+		'validation_logic': u'name is not Null'
+	},
+
+	# These values are common for all DocType Mapper
+	{
+		'doctype': 'DocType Mapper',
+		'from_doctype': u'Appraisal Template',
+		'module': u'HR',
+		'name': '__common__',
+		'to_doctype': u'Appraisal'
+	},
+
+	# DocType Mapper, Appraisal Template-Appraisal
+	{
+		'doctype': 'DocType Mapper',
+		'name': u'Appraisal Template-Appraisal'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/hr/DocType Mapper/KRA Template-Appraisal/KRA Template-Appraisal.txt b/erpnext/hr/DocType Mapper/KRA Template-Appraisal/KRA Template-Appraisal.txt
deleted file mode 100644
index aed4002..0000000
--- a/erpnext/hr/DocType Mapper/KRA Template-Appraisal/KRA Template-Appraisal.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-# DocType Mapper, KRA Template-Appraisal
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-09-01 15:47:59',
-		'docstatus': 0,
-		'modified': '2011-09-15 15:04:42',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
-	},
-
-	# These values are common for all Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_field': 'kra_sheet',
-		'from_table': 'KRA Sheet',
-		'match_id': 0,
-		'name': '__common__',
-		'parent': 'KRA Template-Appraisal',
-		'parentfield': 'table_mapper_details',
-		'parenttype': 'DocType Mapper',
-		'to_field': 'appraisal_details',
-		'to_table': 'Appraisal Detail',
-		'validation_logic': 'name is not Null'
-	},
-
-	# These values are common for all DocType Mapper
-	{
-		'doctype': 'DocType Mapper',
-		'from_doctype': 'KRA Template',
-		'module': 'HR',
-		'name': '__common__',
-		'to_doctype': 'Appraisal'
-	},
-
-	# DocType Mapper, KRA Template-Appraisal
-	{
-		'doctype': 'DocType Mapper',
-		'name': 'KRA Template-Appraisal'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/DocType Mapper/Salary Structure-Salary Slip/Salary Structure-Salary Slip.txt b/erpnext/hr/DocType Mapper/Salary Structure-Salary Slip/Salary Structure-Salary Slip.txt
index 0a365d1..855c649 100644
--- a/erpnext/hr/DocType Mapper/Salary Structure-Salary Slip/Salary Structure-Salary Slip.txt
+++ b/erpnext/hr/DocType Mapper/Salary Structure-Salary Slip/Salary Structure-Salary Slip.txt
@@ -113,19 +113,19 @@
 	{
 		'doctype': 'Table Mapper Detail',
 		'from_field': 'earning_details',
-		'from_table': 'Earning Detail',
+		'from_table': 'Salary Structure Earning',
 		'match_id': 1,
 		'to_field': 'earning_details',
-		'to_table': 'SS Earning Detail'
+		'to_table': 'Salary Slip Earning'
 	},
 
 	# Table Mapper Detail
 	{
 		'doctype': 'Table Mapper Detail',
 		'from_field': 'deduction_details',
-		'from_table': 'Deduction Detail',
+		'from_table': 'Salary Structure Deduction',
 		'match_id': 2,
 		'to_field': 'deduction_details',
-		'to_table': 'SS Deduction Detail'
+		'to_table': 'Salary Slip Deduction'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/Expense Type/Calls/Calls.txt b/erpnext/hr/Expense Type/Calls/Calls.txt
index 2cd19e1..5cf53d6 100644
--- a/erpnext/hr/Expense Type/Calls/Calls.txt
+++ b/erpnext/hr/Expense Type/Calls/Calls.txt
@@ -1 +1 @@
-[{'modified_by': 'harshada@webnotestech.com', 'name': 'Calls', 'parent': None, 'description': None, 'creation': '2010-08-23 18:26:38', 'modified': '2010-08-23 18:26:38', 'module': 'Payroll', 'doctype': 'Expense Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Calls', 'parentfield': None}]
\ No newline at end of file
+[{'modified_by': 'harshada@webnotestech.com', 'name': 'Calls', 'parent': None, 'description': None, 'creation': '2010-08-23 18:26:38', 'modified': '2010-08-23 18:26:38', 'module': 'Payroll', 'doctype': 'Expense Claim Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Calls', 'parentfield': None}]
\ No newline at end of file
diff --git a/erpnext/hr/Expense Type/Food/Food.txt b/erpnext/hr/Expense Type/Food/Food.txt
index d0266ad..c09f21f 100644
--- a/erpnext/hr/Expense Type/Food/Food.txt
+++ b/erpnext/hr/Expense Type/Food/Food.txt
@@ -1 +1 @@
-[{'modified_by': 'harshada@webnotestech.com', 'name': 'Food', 'parent': None, 'description': None, 'creation': '2010-08-23 18:26:30', 'modified': '2010-08-23 18:26:30', 'module': 'Payroll', 'doctype': 'Expense Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Food', 'parentfield': None}]
\ No newline at end of file
+[{'modified_by': 'harshada@webnotestech.com', 'name': 'Food', 'parent': None, 'description': None, 'creation': '2010-08-23 18:26:30', 'modified': '2010-08-23 18:26:30', 'module': 'Payroll', 'doctype': 'Expense Claim Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Food', 'parentfield': None}]
\ No newline at end of file
diff --git a/erpnext/hr/Expense Type/Medical/Medical.txt b/erpnext/hr/Expense Type/Medical/Medical.txt
index 4e84862..754af61 100644
--- a/erpnext/hr/Expense Type/Medical/Medical.txt
+++ b/erpnext/hr/Expense Type/Medical/Medical.txt
@@ -1 +1 @@
-[{'modified_by': 'harshada@webnotestech.com', 'name': 'Medical', 'parent': None, 'description': None, 'creation': '2010-08-23 18:26:49', 'modified': '2010-08-23 18:26:49', 'module': 'Payroll', 'doctype': 'Expense Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Medical', 'parentfield': None}]
\ No newline at end of file
+[{'modified_by': 'harshada@webnotestech.com', 'name': 'Medical', 'parent': None, 'description': None, 'creation': '2010-08-23 18:26:49', 'modified': '2010-08-23 18:26:49', 'module': 'Payroll', 'doctype': 'Expense Claim Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Medical', 'parentfield': None}]
\ No newline at end of file
diff --git a/erpnext/hr/Expense Type/Others/Others.txt b/erpnext/hr/Expense Type/Others/Others.txt
index 13a6af3..509d652 100644
--- a/erpnext/hr/Expense Type/Others/Others.txt
+++ b/erpnext/hr/Expense Type/Others/Others.txt
@@ -1 +1 @@
-[{'modified_by': 'harshada@webnotestech.com', 'name': 'Others', 'parent': None, 'description': None, 'creation': '2010-09-20 12:16:45', 'modified': '2010-09-20 12:16:45', 'module': 'Payroll', 'doctype': 'Expense Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Others', 'parentfield': None}]
\ No newline at end of file
+[{'modified_by': 'harshada@webnotestech.com', 'name': 'Others', 'parent': None, 'description': None, 'creation': '2010-09-20 12:16:45', 'modified': '2010-09-20 12:16:45', 'module': 'Payroll', 'doctype': 'Expense Claim Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Others', 'parentfield': None}]
\ No newline at end of file
diff --git a/erpnext/hr/Expense Type/Travel/Travel.txt b/erpnext/hr/Expense Type/Travel/Travel.txt
index 966c2ea..c21e4b6 100644
--- a/erpnext/hr/Expense Type/Travel/Travel.txt
+++ b/erpnext/hr/Expense Type/Travel/Travel.txt
@@ -1 +1 @@
-[{'modified_by': 'harshada@webnotestech.com', 'name': 'Travel', 'parent': None, 'description': None, 'creation': '2010-09-20 12:16:45', 'modified': '2010-09-20 12:16:45', 'module': 'Payroll', 'doctype': 'Expense Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Travel', 'parentfield': None}]
\ No newline at end of file
+[{'modified_by': 'harshada@webnotestech.com', 'name': 'Travel', 'parent': None, 'description': None, 'creation': '2010-09-20 12:16:45', 'modified': '2010-09-20 12:16:45', 'module': 'Payroll', 'doctype': 'Expense Claim Type', 'idx': None, 'parenttype': None, 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'expense_type': 'Travel', 'parentfield': None}]
\ No newline at end of file
diff --git a/erpnext/hr/Module Def/HR/HR.txt b/erpnext/hr/Module Def/HR/HR.txt
deleted file mode 100644
index 212d689..0000000
--- a/erpnext/hr/Module Def/HR/HR.txt
+++ /dev/null
@@ -1,318 +0,0 @@
-# Module Def, HR
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-07-01 17:41:43',
-		'docstatus': 0,
-		'modified': '2011-08-25 13:54:43',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'name': '__common__',
-		'parent': 'HR',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def'
-	},
-
-	# These values are common for all Module Def Item
-	{
-		'doctype': 'Module Def Item',
-		'name': '__common__',
-		'parent': 'HR',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-
-	# These values are common for all Module Def
-	{
-		'disabled': 'No',
-		'doctype': u'Module Def',
-		'is_hidden': 'No',
-		'module_desc': 'Human Resource Management - Employee Database, Salaries etc.',
-		'module_icon': 'HR.gif',
-		'module_label': 'HR',
-		'module_name': 'HR',
-		'module_seq': 9,
-		'name': '__common__'
-	},
-
-	# Module Def, HR
-	{
-		'doctype': u'Module Def',
-		'name': 'HR'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Your Employee Database',
-		'display_name': 'Employee',
-		'doc_name': 'Employee',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'employee_name\nemployment_type\nstatus\nbranch\ndesignation\ndepartment\ngrade\nreports_to',
-		'idx': 1
-	},
-
-	# Module Def Item
-	{
-		'description': 'Employees Daily Attendance Tracking Form',
-		'display_name': 'Attendance',
-		'doc_name': 'Attendance',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'employee\nemployee_name\nstatus\natt_date\nfiscal_year\ncompany',
-		'idx': 2
-	},
-
-	# Module Def Item
-	{
-		'description': 'Upload Attendance data',
-		'display_name': 'Attendance Control Panel',
-		'doc_name': 'Attendance Control Panel',
-		'doc_type': 'Single DocType',
-		'doctype': 'Module Def Item',
-		'idx': 3
-	},
-
-	# Module Def Item
-	{
-		'description': 'Leave allocation for selected employees at a time',
-		'display_name': 'Leave Control Panel',
-		'doc_name': 'Leave Control Panel',
-		'doc_type': 'Single DocType',
-		'doctype': 'Module Def Item',
-		'idx': 4
-	},
-
-	# Module Def Item
-	{
-		'description': 'Allocate leave for fiscal year',
-		'display_name': 'Leave Allocation',
-		'doc_name': 'Leave Allocation',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'employee\nleave_type\nfiscal_year\ntotal_leaves_allocated\nposting_date',
-		'idx': 5
-	},
-
-	# Module Def Item
-	{
-		'description': 'Apply Leave',
-		'display_name': 'Leave Application',
-		'doc_name': 'Leave Application',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'employee\nleave_type\nfiscal_year\nfrom_date\nto_date\ntotal_leave_days',
-		'idx': 6
-	},
-
-	# Module Def Item
-	{
-		'description': 'Submit Employees Expenses',
-		'display_name': 'Expense Voucher',
-		'doc_name': 'Expense Voucher',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'status\nemployee\nemployee_name\nposting_date\ntotal_claimed_amount\ntotal_sanctioned_amount\nexp_approver',
-		'idx': 7
-	},
-
-	# Module Def Item
-	{
-		'description': 'Assign Responsibilities to employee and evaluate',
-		'display_name': 'Appraisal',
-		'doc_name': 'Appraisal',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'status\nemployee\nemployee_name\nstart_date\nend_date\ntotal_score\nkra_approver',
-		'idx': 8
-	},
-
-	# Module Def Item
-	{
-		'description': 'Generate Salary Structure heads for an employee',
-		'display_name': 'Salary Structure',
-		'doc_name': 'Salary Structure',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'employee\nis_active\nfiscal_year\nfrom_date\nctc\ntotal_earning\ntotal_deduction\ntotal',
-		'idx': 9
-	},
-
-	# Module Def Item
-	{
-		'description': 'Generate Salary Slip for an employee',
-		'display_name': 'Salary Slip',
-		'doc_name': 'Salary Slip',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'month\nyear\nemployee\nemployee_name\npayment_days\narrear_amount\nencashment_amount\ngross_pay\ntotal_deduction\nnet_pay',
-		'idx': 10
-	},
-
-	# Module Def Item
-	{
-		'description': 'Generate Salary Slip for multiple employee at a time based on selected criteria',
-		'display_name': 'Salary Manager',
-		'doc_name': 'Salary Manager',
-		'doc_type': 'Single DocType',
-		'doctype': 'Module Def Item',
-		'idx': 11
-	},
-
-	# Module Def Item
-	{
-		'description': 'Job Applications received for various positions',
-		'display_name': 'Job Application',
-		'doc_name': 'Job Application',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'applicant_name\nemail\nposition',
-		'idx': 12
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Employee Information',
-		'doc_name': 'Employee',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item',
-		'idx': 13
-	},
-
-	# Module Def Item
-	{
-		'display_name': "Employee's Birthday",
-		'doc_name': 'Employee',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item',
-		'idx': 14
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'New or left employees for a month',
-		'doc_name': 'Employee',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item',
-		'idx': 15
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Monthly Attendance Details',
-		'doc_name': 'Attendance',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item',
-		'idx': 16
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Leave Application Details',
-		'doc_name': 'Leave Application',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item',
-		'idx': 17
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Leave Allocation Details',
-		'doc_name': 'Leave Allocation',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item',
-		'idx': 18
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Employee Leave Balance Report',
-		'doc_name': 'Employee',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item',
-		'idx': 19
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Salary Structure Details',
-		'doc_name': 'Salary Structure',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item',
-		'idx': 20
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Salary Register',
-		'doc_name': 'Salary Slip',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item',
-		'idx': 21
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Salary Slips',
-		'doc_name': 'Salary Slip',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item',
-		'idx': 22
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Pending Appraisals',
-		'doc_name': 'Appraisal',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item',
-		'idx': 23
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Employee Appraisals',
-		'doc_name': 'Appraisal',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item',
-		'idx': 24
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Pending Expense Vouchers',
-		'doc_name': 'Expense Voucher',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item',
-		'idx': 25
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Expense Vouchers',
-		'doc_name': 'Expense Voucher',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item',
-		'idx': 26
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'idx': 1,
-		'role': 'HR Manager'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'idx': 2,
-		'role': 'HR User'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/Role/Employee/Employee.txt b/erpnext/hr/Role/Employee/Employee.txt
deleted file mode 100644
index 4b73c1a..0000000
--- a/erpnext/hr/Role/Employee/Employee.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-[
-	{
-		'creation': '2011-02-12 15:07:26',
-		'docstatus': 0,
-		'doctype': 'Role',
-		'idx': None,
-		'modified': '2011-02-14 14:05:55',
-		'modified_by': 'Administrator',
-		'module': 'Roles',
-		'name': 'Employee',
-		'owner': 'Administrator',
-		'parent': None,
-		'parentfield': None,
-		'parenttype': None,
-		'role_name': 'Employee'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/Role/HR Manager/HR Manager.txt b/erpnext/hr/Role/HR Manager/HR Manager.txt
deleted file mode 100644
index d07db86..0000000
--- a/erpnext/hr/Role/HR Manager/HR Manager.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, HR Manager
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2010-04-01 10:19:09',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'HR',
-		'name': '__common__',
-		'role_name': 'HR Manager'
-	},
-
-	# Role, HR Manager
-	{
-		'doctype': 'Role',
-		'name': 'HR Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/Role/HR User/HR User.txt b/erpnext/hr/Role/HR User/HR User.txt
deleted file mode 100644
index b0c5b76..0000000
--- a/erpnext/hr/Role/HR User/HR User.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, HR User
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2010-04-01 10:18:55',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'HR',
-		'name': '__common__',
-		'role_name': 'HR User'
-	},
-
-	# Role, HR User
-	{
-		'doctype': 'Role',
-		'name': 'HR User'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/__init__.py b/erpnext/hr/__init__.py
index e69de29..930b9ee 100644
--- a/erpnext/hr/__init__.py
+++ b/erpnext/hr/__init__.py
@@ -0,0 +1,5 @@
+install_docs = [
+	{"doctype":"Role", "role_name":"Employee", "name":"Employee"},
+	{"doctype":"Role", "role_name":"HR Manager", "name":"HR Manager"},
+	{"doctype":"Role", "role_name":"HR User", "name":"HR User"},
+]
diff --git a/erpnext/hr/doctype/absent_days_detail/absent_days_detail.txt b/erpnext/hr/doctype/absent_days_detail/absent_days_detail.txt
deleted file mode 100644
index 2e6f58a..0000000
--- a/erpnext/hr/doctype/absent_days_detail/absent_days_detail.txt
+++ /dev/null
@@ -1,137 +0,0 @@
-# DocType, Absent Days Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'HR',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'show_in_menu': 0,
-		'version': 5
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Absent Days Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# These values are common for all DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'name': '__common__',
-		'parent': 'Absent Days Detail',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'permlevel': 0,
-		'read': 1,
-		'write': 1
-	},
-
-	# DocType, Absent Days Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Absent Days Detail'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'leave_type',
-		'fieldtype': 'Select',
-		'idx': 1,
-		'label': 'Leave Type',
-		'oldfieldname': 'leave_type',
-		'oldfieldtype': 'Select',
-		'options': 'link:Leave Type'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'no_of_leave_days',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'No of leave days',
-		'oldfieldname': 'no_of_leave_days',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'from_date',
-		'fieldtype': 'Date',
-		'idx': 3,
-		'label': 'From Date',
-		'oldfieldname': 'from_date',
-		'oldfieldtype': 'Date'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'to_date',
-		'fieldtype': 'Date',
-		'idx': 4,
-		'label': 'To Date',
-		'oldfieldname': 'to_date',
-		'oldfieldtype': 'Date'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'previous_balance',
-		'fieldtype': 'Data',
-		'idx': 5,
-		'label': 'Previous Balance',
-		'oldfieldname': 'previous_balance',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'current_balance',
-		'fieldtype': 'Data',
-		'idx': 6,
-		'label': 'Current Balance',
-		'oldfieldname': 'current_balance',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'max_allowed',
-		'fieldtype': 'Data',
-		'idx': 7,
-		'label': 'Max. Allowed',
-		'oldfieldname': 'max_allowed',
-		'oldfieldtype': 'Data'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/appraisal/appraisal.js b/erpnext/hr/doctype/appraisal/appraisal.js
index 0483c38..fbd7e02 100644
--- a/erpnext/hr/doctype/appraisal/appraisal.js
+++ b/erpnext/hr/doctype/appraisal/appraisal.js
@@ -30,18 +30,18 @@
 
 cur_frm.cscript.refresh = function(doc,cdt,cdn){
 	if(user == doc.kra_approver && doc.status == 'Submitted') 
-		unhide_field(['Update', 'Declare Completed', 'Calculate Total Score']);
-	else hide_field(['Update', 'Declare Completed', 'Calculate Total Score']);
+		unhide_field(['update', 'declare_completed', 'calculate_total_score']);
+	else hide_field(['update', 'declare_completed', 'calculate_total_score']);
 	
-	if(!doc.docstatus) unhide_field('Fetch Template');
-	else hide_field('Fetch Template');
+	if(!doc.docstatus) unhide_field('fetch_template');
+	else hide_field('fetch_template');
 }
 
 
 cur_frm.cscript.refresh_appraisal_details = function(doc, cdt, cdn){
-	var val = getchildren('Appraisal Detail', doc.name, 'appraisal_details', doc.doctype);
+	var val = getchildren('Appraisal Goal', doc.name, 'appraisal_details', doc.doctype);
 	for(var i = 0; i<val.length; i++){
-		set_multiple('Appraisal Detail', val[i].name, {'target_achieved':'', 'score':'', 'scored_earned':''}, 'appraisal_details');
+		set_multiple('Appraisal Goal', val[i].name, {'target_achieved':'', 'score':'', 'scored_earned':''}, 'appraisal_details');
 	}
 	doc.total_score = '';
 	refresh_field('appraisal_details');
@@ -60,9 +60,9 @@
 	}
 }
 
-cur_frm.cscript['Calculate Total Score'] = function(doc,cdt,cdn){
+cur_frm.cscript.calculate_total_score = function(doc,cdt,cdn){
 	//get_server_fields('calculate_total','','',doc,cdt,cdn,1);
-	var val = getchildren('Appraisal Detail', doc.name, 'appraisal_details', doc.doctype);
+	var val = getchildren('Appraisal Goal', doc.name, 'appraisal_details', doc.doctype);
 	var total =0;
 	for(var i = 0; i<val.length; i++){
 		total = flt(total)+flt(val[i].score_earned)
@@ -71,7 +71,7 @@
 	refresh_field('total_score')
 }
 
-/*cur_frm.cscript['Declare Completed'] = function(doc,cdt,cdn){
+/*cur_frm.cscript.declare_completed = function(doc,cdt,cdn){
 	$c_obj(make_doclist(doc.doctype, doc.name),'declare_completed','', function(r,rt){
 		if(r.message){
 			refresh_field('Status');
@@ -80,7 +80,7 @@
 	});
 }*/
 
-cur_frm.cscript['Declare Completed'] = function(doc,cdt,cdn){
+cur_frm.cscript.declare_completed = function(doc,cdt,cdn){
 	var declare_completed_dialog;
 	
 	set_declare_completed_dialog = function() {
@@ -119,7 +119,7 @@
 					$i('declare_completed_dialog_response').innerHTML = 'Done';
 					refresh_field('status');
 					declare_completed_dialog.refresh_dt();
-					hide_field(['Update', 'Declare Completed', 'Calculate Total Score']);
+					hide_field(['update', 'declare_completed', 'calculate_total_score']);
 					declare_completed_dialog.hide();
 				}
 				else if(r.message.status == 'Incomplete'){
@@ -161,7 +161,7 @@
 }
 
 cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
-	var val = getchildren('Appraisal Detail', doc.name, 'appraisal_details', doc.doctype);
+	var val = getchildren('Appraisal Goal', doc.name, 'appraisal_details', doc.doctype);
 	var total =0;
 	for(var i = 0; i<val.length; i++){
 		total = flt(total)+flt(val[i].score_earned);
diff --git a/erpnext/hr/doctype/appraisal/appraisal.py b/erpnext/hr/doctype/appraisal/appraisal.py
index 67bd1e6..a730657 100644
--- a/erpnext/hr/doctype/appraisal/appraisal.py
+++ b/erpnext/hr/doctype/appraisal/appraisal.py
@@ -46,10 +46,10 @@
 	
 	def fetch_kra(self):
 		if not self.doc.kra_template:
-			msgprint("Please select KRA Template to be be fetched")
+			msgprint("Please select Appraisal Template to be be fetched")
 			raise Exception
 		self.doc.clear_table(self.doclist,'appraisal_details')
-		get_obj('DocType Mapper', 'KRA Template-Appraisal').dt_map('KRA Template', 'Appraisal', self.doc.kra_template, self.doc, self.doclist, "[['KRA Template','Appraisal'],['KRA Sheet', 'Appraisal Detail']]")
+		get_obj('DocType Mapper', 'Appraisal Template-Appraisal').dt_map('Appraisal Template', 'Appraisal', self.doc.kra_template, self.doc, self.doclist, "[['Appraisal Template','Appraisal'],['Appraisal Template Goal', 'Appraisal Goal']]")
 	
 	def validate_dates(self):
 		if getdate(self.doc.start_date) > getdate(self.doc.end_date):
diff --git a/erpnext/hr/doctype/appraisal/appraisal.txt b/erpnext/hr/doctype/appraisal/appraisal.txt
index b10c434..bfba9fc 100644
--- a/erpnext/hr/doctype/appraisal/appraisal.txt
+++ b/erpnext/hr/doctype/appraisal/appraisal.txt
@@ -3,52 +3,53 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-09-01 15:48:05',
+		'creation': '2012-03-27 14:35:53',
 		'docstatus': 0,
-		'modified': '2011-09-22 10:59:43',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
+		'modified': '2012-03-27 14:45:46',
+		'modified_by': u'Administrator',
+		'owner': u'ashwini@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1316075905',
-		'autoname': 'APRSL.#####',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'_last_update': u'1316075905',
+		'autoname': u'APRSL.#####',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
-		'module': 'HR',
+		'is_submittable': 1,
+		'module': u'HR',
 		'name': '__common__',
-		'search_fields': 'status, employee, employee_name',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'search_fields': u'status, employee, employee_name',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 161
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Appraisal',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Appraisal',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Appraisal',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Appraisal',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Appraisal
 	{
 		'doctype': 'DocType',
-		'name': 'Appraisal'
+		'name': u'Appraisal'
 	},
 
 	# DocPerm
@@ -56,47 +57,9 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'permlevel': 1,
-		'role': 'System Manager'
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'System Manager',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'permlevel': 1,
-		'role': 'System Manager'
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'HR Manager',
+		'role': u'System Manager',
 		'submit': 1,
 		'write': 1
 	},
@@ -106,49 +69,75 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'HR User',
+		'role': u'System Manager',
 		'submit': 1,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'permlevel': 1,
-		'role': 'HR Manager'
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'HR Manager',
+		'submit': 1,
+		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'HR User',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'All',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'HR User'
+		'role': u'All'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Employee Details',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'employee_details',
+		'fieldtype': u'Section Break',
+		'label': u'Employee Details',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'Draft',
-		'doctype': 'DocField',
-		'fieldname': 'status',
-		'fieldtype': 'Select',
+		'colour': u'White:FFF',
+		'default': u'Draft',
+		'doctype': u'DocField',
+		'fieldname': u'status',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Status',
+		'label': u'Status',
 		'no_copy': 1,
-		'oldfieldname': 'status',
-		'oldfieldtype': 'Select',
-		'options': '\nDraft\nSubmitted\nCompleted\nCancelled',
+		'oldfieldname': u'status',
+		'oldfieldtype': u'Select',
+		'options': u'\nDraft\nSubmitted\nCompleted\nCancelled',
 		'permlevel': 1,
 		'reqd': 1,
 		'search_index': 1
@@ -156,234 +145,240 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'employee',
-		'fieldtype': 'Link',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'employee',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Employee',
-		'oldfieldname': 'employee',
-		'oldfieldtype': 'Link',
-		'options': 'Employee',
+		'label': u'Employee',
+		'oldfieldname': u'employee',
+		'oldfieldtype': u'Link',
+		'options': u'Employee',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'employee_name',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'employee_name',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Employee Name',
-		'oldfieldname': 'employee_name',
-		'oldfieldtype': 'Data',
+		'label': u'Employee Name',
+		'oldfieldname': u'employee_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Fiscal Year',
-		'oldfieldname': 'fiscal_year',
-		'oldfieldtype': 'Select',
-		'options': 'link:Fiscal Year',
+		'label': u'Fiscal Year',
+		'oldfieldname': u'fiscal_year',
+		'oldfieldtype': u'Select',
+		'options': u'link:Fiscal Year',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Company',
-		'oldfieldname': 'company',
-		'oldfieldtype': 'Link',
-		'options': 'link:Company',
+		'label': u'Company',
+		'oldfieldname': u'company',
+		'oldfieldtype': u'Link',
+		'options': u'link:Company',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'start_date',
-		'fieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'start_date',
+		'fieldtype': u'Date',
 		'in_filter': 1,
-		'label': 'Start Date',
-		'oldfieldname': 'start_date',
-		'oldfieldtype': 'Date',
+		'label': u'Start Date',
+		'oldfieldname': u'start_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'end_date',
-		'fieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'end_date',
+		'fieldtype': u'Date',
 		'in_filter': 1,
-		'label': 'End Date',
-		'oldfieldname': 'end_date',
-		'oldfieldtype': 'Date',
+		'label': u'End Date',
+		'oldfieldname': u'end_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'kra_approver',
-		'fieldtype': 'Select',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'kra_approver',
+		'fieldtype': u'Select',
 		'in_filter': 0,
-		'label': 'Approver',
-		'oldfieldname': 'kra_approver',
-		'oldfieldtype': 'Select',
+		'label': u'Approver',
+		'oldfieldname': u'kra_approver',
+		'oldfieldtype': u'Select',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amended_from',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Data',
 		'hidden': 1,
-		'label': 'Amended From',
+		'label': u'Amended From',
 		'no_copy': 1,
-		'oldfieldname': 'amended_from',
-		'oldfieldtype': 'Data',
+		'oldfieldname': u'amended_from',
+		'oldfieldtype': u'Data',
 		'permlevel': 1,
 		'print_hide': 1,
 		'report_hide': 1,
-		'width': '150px'
+		'width': u'150px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amendment_date',
-		'fieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
 		'hidden': 1,
-		'label': 'Amendment Date',
+		'label': u'Amendment Date',
 		'no_copy': 1,
-		'oldfieldname': 'amendment_date',
-		'oldfieldtype': 'Date',
+		'oldfieldname': u'amendment_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 1,
 		'print_hide': 1,
 		'report_hide': 1,
-		'width': '160px'
+		'width': u'160px'
 	},
 
 	# DocField
 	{
 		'allow_on_submit': 1,
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Declare Completed',
-		'oldfieldtype': 'Button',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'declare_completed',
+		'fieldtype': u'Button',
+		'label': u'Declare Completed',
+		'oldfieldtype': u'Button',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'oldfieldtype': 'Section Break',
-		'options': 'Simple',
+		'doctype': u'DocField',
+		'fieldname': u'section_break0',
+		'fieldtype': u'Section Break',
+		'oldfieldtype': u'Section Break',
+		'options': u'Simple',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Select template from which you want to fetch KRA',
-		'doctype': 'DocField',
-		'fieldname': 'kra_template',
-		'fieldtype': 'Link',
-		'label': 'KRA Template',
-		'oldfieldname': 'kra_template',
-		'oldfieldtype': 'Link',
-		'options': 'KRA Template',
+		'colour': u'White:FFF',
+		'description': u'Select template from which you want to fetch KRA',
+		'doctype': u'DocField',
+		'fieldname': u'kra_template',
+		'fieldtype': u'Link',
+		'label': u'Appraisal Template',
+		'oldfieldname': u'kra_template',
+		'oldfieldtype': u'Link',
+		'options': u'Appraisal Template',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Fetch Template',
-		'oldfieldtype': 'Button',
-		'options': 'fetch_kra',
+		'doctype': u'DocField',
+		'fieldname': u'fetch_template',
+		'fieldtype': u'Button',
+		'label': u'Fetch Template',
+		'oldfieldtype': u'Button',
+		'options': u'fetch_kra',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
 		'allow_on_submit': 1,
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'update',
+		'fieldtype': u'Button',
 		'hidden': 1,
-		'label': 'Update',
-		'oldfieldtype': 'Button',
+		'label': u'Update',
+		'oldfieldtype': u'Button',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
 		'allow_on_submit': 1,
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'appraisal_details',
-		'fieldtype': 'Table',
-		'label': 'Appraisal Details',
-		'oldfieldname': 'appraisal_details',
-		'oldfieldtype': 'Table',
-		'options': 'Appraisal Detail',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'appraisal_details',
+		'fieldtype': u'Table',
+		'label': u'Appraisal Goals',
+		'oldfieldname': u'appraisal_details',
+		'oldfieldtype': u'Table',
+		'options': u'Appraisal Goal',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
 		'allow_on_submit': 1,
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Calculate Total Score',
-		'oldfieldtype': 'Button',
-		'options': 'calculate_total',
+		'doctype': u'DocField',
+		'fieldname': u'calculate_total_score',
+		'fieldtype': u'Button',
+		'label': u'Calculate Total Score',
+		'oldfieldtype': u'Button',
+		'options': u'calculate_total',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'total_score',
-		'fieldtype': 'Currency',
-		'label': 'Total Score (Out of 5)',
+		'doctype': u'DocField',
+		'fieldname': u'total_score',
+		'fieldtype': u'Currency',
+		'label': u'Total Score (Out of 5)',
 		'no_copy': 1,
-		'oldfieldname': 'total_score',
-		'oldfieldtype': 'Currency',
+		'oldfieldname': u'total_score',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1
 	}
-]
+]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/appraisal_detail/appraisal_detail.txt b/erpnext/hr/doctype/appraisal_detail/appraisal_detail.txt
deleted file mode 100644
index 06edc81..0000000
--- a/erpnext/hr/doctype/appraisal_detail/appraisal_detail.txt
+++ /dev/null
@@ -1,109 +0,0 @@
-# DocType, Appraisal Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-09-01 15:48:05',
-		'docstatus': 0,
-		'modified': '2011-09-22 10:45:37',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'APRSLD.#####',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'HR',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'version': 15
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Appraisal Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# DocType, Appraisal Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Appraisal Detail'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'Key Responsibility Area',
-		'doctype': 'DocField',
-		'fieldname': 'kra',
-		'fieldtype': 'Small Text',
-		'label': 'KRA',
-		'oldfieldname': 'kra',
-		'oldfieldtype': 'Small Text',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'per_weightage',
-		'fieldtype': 'Currency',
-		'label': 'Weightage (%)',
-		'oldfieldname': 'per_weightage',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': 'DocField',
-		'fieldname': 'target_achieved',
-		'fieldtype': 'Small Text',
-		'label': 'Target Achieved',
-		'no_copy': 1,
-		'oldfieldname': 'target_achieved',
-		'oldfieldtype': 'Small Text',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'score',
-		'fieldtype': 'Currency',
-		'label': 'Score (0-5)',
-		'no_copy': 1,
-		'oldfieldname': 'score',
-		'oldfieldtype': 'Select',
-		'options': '\n0\n1\n2\n3\n4\n5',
-		'permlevel': 0,
-		'trigger': 'Client',
-		'width': '60px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'score_earned',
-		'fieldtype': 'Currency',
-		'label': 'Score Earned',
-		'no_copy': 1,
-		'oldfieldname': 'score_earned',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	}
-]
diff --git a/erpnext/hr/doctype/appraisal_detail/__init__.py b/erpnext/hr/doctype/appraisal_goal/__init__.py
similarity index 100%
rename from erpnext/hr/doctype/appraisal_detail/__init__.py
rename to erpnext/hr/doctype/appraisal_goal/__init__.py
diff --git a/erpnext/hr/doctype/appraisal_goal/appraisal_goal.txt b/erpnext/hr/doctype/appraisal_goal/appraisal_goal.txt
new file mode 100644
index 0000000..fab4e84
--- /dev/null
+++ b/erpnext/hr/doctype/appraisal_goal/appraisal_goal.txt
@@ -0,0 +1,109 @@
+# DocType, Appraisal Goal
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:53',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:53',
+		'modified_by': u'Administrator',
+		'owner': u'ashwini@webnotestech.com'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'APRSLD.#####',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'HR',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'version': 15
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Appraisal Goal',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Appraisal Goal
+	{
+		'doctype': 'DocType',
+		'name': u'Appraisal Goal'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Key Responsibility Area',
+		'doctype': u'DocField',
+		'fieldname': u'kra',
+		'fieldtype': u'Small Text',
+		'label': u'KRA',
+		'oldfieldname': u'kra',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'per_weightage',
+		'fieldtype': u'Currency',
+		'label': u'Weightage (%)',
+		'oldfieldname': u'per_weightage',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'doctype': u'DocField',
+		'fieldname': u'target_achieved',
+		'fieldtype': u'Small Text',
+		'label': u'Target Achieved',
+		'no_copy': 1,
+		'oldfieldname': u'target_achieved',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'score',
+		'fieldtype': u'Currency',
+		'label': u'Score (0-5)',
+		'no_copy': 1,
+		'oldfieldname': u'score',
+		'oldfieldtype': u'Select',
+		'options': u'\n0\n1\n2\n3\n4\n5',
+		'permlevel': 0,
+		'trigger': u'Client',
+		'width': u'60px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'score_earned',
+		'fieldtype': u'Currency',
+		'label': u'Score Earned',
+		'no_copy': 1,
+		'oldfieldname': u'score_earned',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/appraisal_detail/__init__.py b/erpnext/hr/doctype/appraisal_template/__init__.py
similarity index 100%
copy from erpnext/hr/doctype/appraisal_detail/__init__.py
copy to erpnext/hr/doctype/appraisal_template/__init__.py
diff --git a/erpnext/hr/doctype/appraisal_template/appraisal_template.txt b/erpnext/hr/doctype/appraisal_template/appraisal_template.txt
new file mode 100644
index 0000000..62a0d5b
--- /dev/null
+++ b/erpnext/hr/doctype/appraisal_template/appraisal_template.txt
@@ -0,0 +1,111 @@
+# DocType, Appraisal Template
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:58',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:58',
+		'modified_by': u'Administrator',
+		'owner': u'ashwini@webnotestech.com'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'field:kra_title',
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'document_type': u'Master',
+		'module': u'HR',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'version': 3
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Appraisal Template',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# These values are common for all DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Appraisal Template',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'write': 1
+	},
+
+	# DocType, Appraisal Template
+	{
+		'doctype': 'DocType',
+		'name': u'Appraisal Template'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'role': u'HR Manager'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'role': u'HR User'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'kra_title',
+		'fieldtype': u'Data',
+		'label': u'KRA Title',
+		'oldfieldname': u'kra_title',
+		'oldfieldtype': u'Data',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Small Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Small Text',
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'kra_sheet',
+		'fieldtype': u'Table',
+		'label': u'Appraisal Template Goal',
+		'oldfieldname': u'kra_sheet',
+		'oldfieldtype': u'Table',
+		'options': u'Appraisal Template Goal'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/appraisal_detail/__init__.py b/erpnext/hr/doctype/appraisal_template_goal/__init__.py
similarity index 100%
copy from erpnext/hr/doctype/appraisal_detail/__init__.py
copy to erpnext/hr/doctype/appraisal_template_goal/__init__.py
diff --git a/erpnext/hr/doctype/appraisal_template_goal/appraisal_template_goal.txt b/erpnext/hr/doctype/appraisal_template_goal/appraisal_template_goal.txt
new file mode 100644
index 0000000..c3e95e5
--- /dev/null
+++ b/erpnext/hr/doctype/appraisal_template_goal/appraisal_template_goal.txt
@@ -0,0 +1,66 @@
+# DocType, Appraisal Template Goal
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:58',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:58',
+		'modified_by': u'Administrator',
+		'owner': u'ashwini@webnotestech.com'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'KSHEET.#####',
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'HR',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'version': 6
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Appraisal Template Goal',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocType, Appraisal Template Goal
+	{
+		'doctype': 'DocType',
+		'name': u'Appraisal Template Goal'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Key Performance Area',
+		'doctype': u'DocField',
+		'fieldname': u'kra',
+		'fieldtype': u'Small Text',
+		'label': u'KRA',
+		'oldfieldname': u'kra',
+		'oldfieldtype': u'Small Text',
+		'width': u'200px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'per_weightage',
+		'fieldtype': u'Currency',
+		'label': u'Weightage (%)',
+		'oldfieldname': u'per_weightage',
+		'oldfieldtype': u'Currency',
+		'width': u'100px'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/attendance/attendance.py b/erpnext/hr/doctype/attendance/attendance.py
index 0d0c23c..ba06995 100644
--- a/erpnext/hr/doctype/attendance/attendance.py
+++ b/erpnext/hr/doctype/attendance/attendance.py
@@ -59,48 +59,15 @@
       msgprint("Employee's attendance already marked.")
       raise Exception
       
-  #validation - leave_type is mandatory for status absent/ half day else not required to entered.
-  def validate_status(self):
-    if self.doc.status == 'Present' and self.doc.leave_type:
-      msgprint("You can not enter leave type for attendance status 'Present'")
-      raise Exception
-
-    elif (self.doc.status == 'Absent' or self.doc.status == 'Half Day') and not self.doc.leave_type:
-      msgprint("Please enter leave type for attendance status 'Absent'")
-      raise Exception
   
   #check for already record present in leave transaction for same date
   def check_leave_record(self):
     if self.doc.status == 'Present':
-      chk = sql("select name from `tabLeave Transaction` where employee=%s and (from_date <= %s and to_date >= %s) and status = 'Submitted' and leave_transaction_type = 'Deduction' and docstatus!=2", (self.doc.employee, self.doc.att_date, self.doc.att_date))
+      chk = sql("select name from `tabLeave Application` where employee=%s and (from_date <= %s and to_date >= %s) and docstatus!=2", (self.doc.employee, self.doc.att_date, self.doc.att_date))
       if chk:
         msgprint("Leave Application created for employee "+self.doc.employee+" whom you are trying to mark as 'Present' ")
         raise Exception
   
-  #For absent/ half day record - check for leave balances of the employees 
-  def validate_leave_type(self):
-    if not self.doc.status =='Present' and self.doc.leave_type not in ('Leave Without Pay','Compensatory Off'):
-      #check for leave allocated to employee from leave transaction
-      ret = sql("select name from `tabLeave Transaction` where employee = '%s' and leave_type = '%s' and leave_transaction_type = 'Allocation' and fiscal_year = '%s'"%(self.doc.employee,self.doc.leave_type,self.doc.fiscal_year))   
-      
-      #if leave allocation is present then calculate leave balance i.e. sum(allocation) - sum(deduction) 
-      if ret:
-        q1 = 'SUM(CASE WHEN leave_transaction_type = "Allocation" THEN total_leave ELSE 0 END)-SUM(CASE WHEN leave_transaction_type = "Deduction" THEN total_leave ELSE 0 END)'
-        q2 = "select %s from `tabLeave Transaction` where employee = '%s' and leave_type = '%s' and fiscal_year = '%s' and docstatus = 1"
-        
-        res = sql(q2%(q1,self.doc.employee,self.doc.leave_type,self.doc.fiscal_year))
-       
-        if res:
-          if self.doc.status == 'Absent' and flt(res[0][0]) < 1:
-            msgprint("%s balances are insufficient to cover a day absence, please select other leave type."%self.doc.leave_type)
-            raise Exception
-          if self.doc.status == 'Half Day' and flt(res[0][0]) < 0.5:
-            msgprint("%s balances are insufficient to cover a half day absence, please select other leave type."%self.doc.leave_type)
-            raise Exception
-
-      else:
-        msgprint("Leave Allocation for employee %s not done.\n You can allocate leaves from HR -> Leave Transaction OR HR -> Leave Control Panel."%self.doc.employee)
-        raise Exception
          
   def validate_fiscal_year(self):
     fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"% self.doc.fiscal_year)
@@ -129,7 +96,6 @@
   def validate(self):
     self.validate_fiscal_year()
     self.validate_att_date()
-    #self.validate_leave_type()
     self.validate_duplicate_record()
     #self.validate_status()
     self.check_leave_record()
diff --git a/erpnext/hr/doctype/attendance/attendance.txt b/erpnext/hr/doctype/attendance/attendance.txt
index 9c795bb..04df67d 100644
--- a/erpnext/hr/doctype/attendance/attendance.txt
+++ b/erpnext/hr/doctype/attendance/attendance.txt
@@ -3,48 +3,49 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-09-23 10:26:03',
+		'creation': '2012-03-27 14:35:53',
 		'docstatus': 0,
-		'modified': '2011-12-19 14:11:15',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
+		'modified': '2012-03-27 14:45:46',
+		'modified_by': u'Administrator',
+		'owner': u'ashwini@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1317365120',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'_last_update': u'1317365120',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'HR',
+		'document_type': u'Master',
+		'is_submittable': 1,
+		'module': u'HR',
 		'name': '__common__',
-		'search_fields': 'employee, employee_name, att_date, status',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'search_fields': u'employee, employee_name, att_date, status',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 75
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Attendance',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
+		'parent': u'Attendance',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
+		'amend': 0,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Attendance',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Attendance',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
 		'submit': 1,
@@ -54,151 +55,187 @@
 	# DocType, Attendance
 	{
 		'doctype': 'DocType',
-		'name': 'Attendance'
+		'name': u'Attendance'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'role': 'HR User'
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'role': 'HR Manager'
+		'doctype': u'DocPerm',
+		'role': u'HR User'
 	},
 
 	# DocPerm
 	{
-		'amend': 0,
-		'doctype': 'DocPerm',
-		'role': 'System Manager'
+		'doctype': u'DocPerm',
+		'role': u'HR Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Attendance Details',
-		'oldfieldtype': 'Section Break',
-		'options': 'Simple'
+		'doctype': u'DocField',
+		'fieldname': u'attendance_details',
+		'fieldtype': u'Section Break',
+		'label': u'Attendance Details',
+		'oldfieldtype': u'Section Break',
+		'options': u'Simple',
+		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'naming_series',
-		'fieldtype': 'Select',
-		'label': 'Naming Series',
+		'doctype': u'DocField',
+		'fieldname': u'naming_series',
+		'fieldtype': u'Select',
+		'label': u'Naming Series',
 		'no_copy': 1,
-		'oldfieldname': 'naming_series',
-		'oldfieldtype': 'Select',
-		'options': 'ATT',
+		'oldfieldname': u'naming_series',
+		'oldfieldtype': u'Select',
+		'options': u'ATT',
+		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'employee',
-		'fieldtype': 'Link',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'employee',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Employee',
-		'oldfieldname': 'employee',
-		'oldfieldtype': 'Link',
-		'options': 'Employee',
+		'label': u'Employee',
+		'oldfieldname': u'employee',
+		'oldfieldtype': u'Link',
+		'options': u'Employee',
+		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'employee_name',
-		'fieldtype': 'Data',
-		'label': 'Employee Name',
-		'oldfieldname': 'employee_name',
-		'oldfieldtype': 'Data'
+		'doctype': u'DocField',
+		'fieldname': u'employee_name',
+		'fieldtype': u'Data',
+		'label': u'Employee Name',
+		'oldfieldname': u'employee_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'status',
-		'fieldtype': 'Select',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'status',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Status',
+		'label': u'Status',
 		'no_copy': 1,
-		'oldfieldname': 'status',
-		'oldfieldtype': 'Select',
-		'options': '\nPresent\nAbsent\nHalf Day',
+		'oldfieldname': u'status',
+		'oldfieldtype': u'Select',
+		'options': u'\nPresent\nAbsent\nHalf Day',
+		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'leave_type',
-		'fieldtype': 'Link',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'leave_type',
+		'fieldtype': u'Link',
 		'hidden': 1,
-		'label': 'Leave Type',
-		'oldfieldname': 'leave_type',
-		'oldfieldtype': 'Link',
-		'options': 'Leave Type',
+		'label': u'Leave Type',
+		'oldfieldname': u'leave_type',
+		'oldfieldtype': u'Link',
+		'options': u'Leave Type',
+		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
-		'width': '50%'
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'att_date',
-		'fieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'att_date',
+		'fieldtype': u'Date',
 		'in_filter': 1,
-		'label': 'Attendance Date',
-		'oldfieldname': 'att_date',
-		'oldfieldtype': 'Date',
+		'label': u'Attendance Date',
+		'oldfieldname': u'att_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Fiscal Year',
-		'oldfieldname': 'fiscal_year',
-		'oldfieldtype': 'Select',
-		'options': 'link:Fiscal Year',
+		'label': u'Fiscal Year',
+		'oldfieldname': u'fiscal_year',
+		'oldfieldtype': u'Select',
+		'options': u'link:Fiscal Year',
+		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Company',
-		'oldfieldname': 'company',
-		'oldfieldtype': 'Link',
-		'options': 'link:Company',
+		'label': u'Company',
+		'oldfieldname': u'company',
+		'oldfieldtype': u'Link',
+		'options': u'link:Company',
+		'permlevel': 0,
 		'reqd': 1
+	},
+
+	# DocField
+	{
+		'depends_on': u'eval:doc.amended_from',
+		'description': u'The date at which current entry is corrected in the system.',
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
+		'label': u'Amendment Date',
+		'no_copy': 1,
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Link',
+		'label': u'Amended From',
+		'no_copy': 1,
+		'options': u'Sales Invoice',
+		'permlevel': 1,
+		'print_hide': 1
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/attendance_control_panel/attendance_control_panel.js b/erpnext/hr/doctype/attendance_control_panel/attendance_control_panel.js
index 6c141cc..917002f 100644
--- a/erpnext/hr/doctype/attendance_control_panel/attendance_control_panel.js
+++ b/erpnext/hr/doctype/attendance_control_panel/attendance_control_panel.js
@@ -15,8 +15,8 @@
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 cur_frm.cscript.onload = function(doc,cdt,cdn){
-  cur_frm.log_div = $a(cur_frm.fields_dict['Import Log1'].wrapper,'div','',{border:'1px solid #CCC', backgroundColor:'#DDD',width : '100%', height : '300px', overflow : 'auto'});
-  hide_field('Import Log1')
+  cur_frm.log_div = $a(cur_frm.fields_dict['import_log1'].wrapper,'div','',{border:'1px solid #CCC', backgroundColor:'#DDD',width : '100%', height : '300px', overflow : 'auto'});
+  hide_field('import_log1')
   doc.att_fr_date = get_today();
   doc.file_list = '';
   doc.overwrite = 0;
@@ -26,7 +26,7 @@
 }
 
 //download attendance template - csv file
-cur_frm.cscript['Get Template'] = function(doc,cdt,cdn){
+cur_frm.cscript.get_template = function(doc,cdt,cdn){
 
   if(doc.att_to_date && !doc.att_fr_date)
     alert("Please enter 'Attendance To Date'");
@@ -37,7 +37,7 @@
 }
 
 //---------------------------------------------------------
-cur_frm.cscript['Import'] = function(doc,cdt,cdn){
+cur_frm.cscript.import = function(doc,cdt,cdn){
   if(!doc.file_list){
     alert("Please upload attendance data CSV file");
   }
@@ -58,9 +58,9 @@
 //====================================================
 cur_frm.cscript.refresh = function(doc,cdt,cdn){
   if(cur_frm.log_div.innerHTML == '')
-    hide_field('Import Log1');
+    hide_field('import_log1');
   else
-    unhide_field('Import Log1');
-  refresh_field('Import Log1');
+    unhide_field('import_log1');
+  refresh_field('import_log1');
 
-}
\ No newline at end of file
+}
diff --git a/erpnext/hr/doctype/attendance_control_panel/attendance_control_panel.txt b/erpnext/hr/doctype/attendance_control_panel/attendance_control_panel.txt
index af30e04..78904db 100644
--- a/erpnext/hr/doctype/attendance_control_panel/attendance_control_panel.txt
+++ b/erpnext/hr/doctype/attendance_control_panel/attendance_control_panel.txt
@@ -3,227 +3,217 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-10-19 11:19:24',
+		'creation': '2012-03-27 14:35:53',
 		'docstatus': 0,
-		'modified': '2011-01-04 13:33:33',
-		'modified_by': 'rahul@webnotestech.com',
-		'owner': 'harshada@webnotestech.com'
+		'modified': '2012-03-27 14:35:53',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1294312182',
+		'_last_update': u'1294312182',
 		'allow_attach': 1,
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'issingle': 1,
 		'max_attachments': 1,
-		'module': 'HR',
+		'module': u'HR',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 122
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Attendance Control Panel',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Attendance Control Panel',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Attendance Control Panel',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Attendance Control Panel',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Attendance Control Panel
 	{
 		'doctype': 'DocType',
-		'name': 'Attendance Control Panel'
+		'name': u'Attendance Control Panel'
 	},
 
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 2,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'HR User',
+		'role': u'HR User',
 		'write': 1
 	},
 
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 3,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'HR Manager',
+		'role': u'HR Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 4,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'HR User'
+		'role': u'HR User'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 5,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'HR Manager'
+		'role': u'HR Manager'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': "Get the template of the Attendance for which you want to import in CSV (Comma seperated values) format.\nFill data in the template. Save the template in CSV format.\nAll attendance dates inbetween 'Attendance From Date' and 'Attendance To Date' will come in the template with employees list.",
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 1,
-		'label': 'Download Template',
+		'colour': u'White:FFF',
+		'description': u"Get the template of the Attendance for which you want to import in CSV (Comma seperated values) format.\nFill data in the template. Save the template in CSV format.\nAll attendance dates inbetween 'Attendance From Date' and 'Attendance To Date' will come in the template with employees list.",
+		'doctype': u'DocField',
+		'fieldname': u'download_template',
+		'fieldtype': u'Section Break',
+		'label': u'Download Template',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Selected Attendance date will comes in the attendance template.',
-		'doctype': 'DocField',
-		'fieldname': 'att_fr_date',
-		'fieldtype': 'Date',
-		'idx': 2,
-		'label': 'Attendance From Date',
-		'oldfieldname': 'attenadnce_date',
-		'oldfieldtype': 'Date',
+		'colour': u'White:FFF',
+		'description': u'Selected Attendance date will comes in the attendance template.',
+		'doctype': u'DocField',
+		'fieldname': u'att_fr_date',
+		'fieldtype': u'Date',
+		'label': u'Attendance From Date',
+		'oldfieldname': u'attenadnce_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 3,
-		'label': 'Get Template',
-		'oldfieldtype': 'Button',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'get_template',
+		'fieldtype': u'Button',
+		'label': u'Get Template',
+		'oldfieldtype': u'Button',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 4,
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'All attendance dates inbetween selected Attendance From Date and Attendance To Date will come in the template with employees list.',
-		'doctype': 'DocField',
-		'fieldname': 'att_to_date',
-		'fieldtype': 'Date',
-		'idx': 5,
-		'label': 'Attendance To Date',
+		'colour': u'White:FFF',
+		'description': u'All attendance dates inbetween selected Attendance From Date and Attendance To Date will come in the template with employees list.',
+		'doctype': u'DocField',
+		'fieldname': u'att_to_date',
+		'fieldtype': u'Date',
+		'label': u'Attendance To Date',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'To import attendance data, click on "Add" button, select the saved CSV file and click on "Upload".\nSelect the date format as attendance date format in CSV file.\nClick on "Import".',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 6,
-		'label': 'Upload Attendance Data',
+		'colour': u'White:FFF',
+		'description': u'To import attendance data, click on "Add" button, select the saved CSV file and click on "Upload".\nSelect the date format as attendance date format in CSV file.\nClick on "Import".',
+		'doctype': u'DocField',
+		'fieldname': u'upload_attendance_data',
+		'fieldtype': u'Section Break',
+		'label': u'Upload Attendance Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'import_date_format',
-		'fieldtype': 'Select',
-		'idx': 7,
-		'label': 'Import Date Format ',
-		'options': 'yyyy-mm-dd\nmm/dd/yyyy\nmm/dd/yy\ndd-mm-yyyy\ndd/mm/yyyy',
+		'doctype': u'DocField',
+		'fieldname': u'import_date_format',
+		'fieldtype': u'Select',
+		'label': u'Import Date Format ',
+		'options': u'yyyy-mm-dd\nmm/dd/yyyy\nmm/dd/yy\ndd-mm-yyyy\ndd/mm/yyyy',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'overwrite',
-		'fieldtype': 'Check',
-		'idx': 8,
-		'label': 'Overwrite',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'overwrite',
+		'fieldtype': u'Check',
+		'label': u'Overwrite',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 9,
-		'label': 'Import',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'import',
+		'fieldtype': u'Button',
+		'label': u'Import',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'file_list',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'idx': 10,
-		'label': 'File List',
+		'label': u'File List',
 		'permlevel': 1,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 11,
-		'label': 'Import Log',
+		'doctype': u'DocField',
+		'fieldname': u'import_log',
+		'fieldtype': u'Section Break',
+		'label': u'Import Log',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 12,
-		'label': 'Import Log1',
+		'doctype': u'DocField',
+		'fieldname': u'import_log1',
+		'fieldtype': u'HTML',
+		'label': u'Import Log1',
 		'permlevel': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/branch/branch.js b/erpnext/hr/doctype/branch/branch.js
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/branch/branch.js
+++ /dev/null
diff --git a/erpnext/hr/doctype/branch/branch.txt b/erpnext/hr/doctype/branch/branch.txt
index f402474..2bf7c21 100644
--- a/erpnext/hr/doctype/branch/branch.txt
+++ b/erpnext/hr/doctype/branch/branch.txt
@@ -3,101 +3,94 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:53',
+		'creation': '2012-03-27 14:35:54',
 		'docstatus': 0,
-		'modified': '2011-05-30 15:24:02',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:54',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
 		'allow_trash': 1,
-		'autoname': 'field:branch',
-		'colour': 'White:FFF',
+		'autoname': u'field:branch',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'HR',
+		'document_type': u'Master',
+		'module': u'HR',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 11
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Branch',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Branch',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'amend': 0,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Branch',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Branch',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
-		'submit': 0,
 		'write': 1
 	},
 
 	# DocType, Branch
 	{
 		'doctype': 'DocType',
-		'name': 'Branch'
+		'name': u'Branch'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'System Manager'
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'HR User'
+		'doctype': u'DocPerm',
+		'role': u'HR User'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'role': 'HR Manager'
+		'doctype': u'DocPerm',
+		'role': u'HR Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'branch',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Branch',
-		'oldfieldname': 'branch',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'branch',
+		'fieldtype': u'Data',
+		'label': u'Branch',
+		'oldfieldname': u'branch',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	}
diff --git a/erpnext/hr/doctype/chapter_vi_a_detail/__init__.py b/erpnext/hr/doctype/chapter_vi_a_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/chapter_vi_a_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/doctype/chapter_vi_a_detail/chapter_vi_a_detail.txt b/erpnext/hr/doctype/chapter_vi_a_detail/chapter_vi_a_detail.txt
deleted file mode 100644
index 60ce4b3..0000000
--- a/erpnext/hr/doctype/chapter_vi_a_detail/chapter_vi_a_detail.txt
+++ /dev/null
@@ -1,145 +0,0 @@
-# DocType, Chapter VI A Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:54',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'HR',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 9
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Chapter VI A Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'Chapter VI A Detail',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1,
-		'role': 'System Manager'
-	},
-
-	# DocType, Chapter VI A Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Chapter VI A Detail'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'permlevel': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'particulars3',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Particulars',
-		'oldfieldname': 'particulars3',
-		'oldfieldtype': 'Small Text',
-		'permlevel': 1,
-		'reqd': 1,
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'under_section3',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Under Section',
-		'oldfieldname': 'under_section3',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'max_limit3',
-		'fieldtype': 'Currency',
-		'idx': 3,
-		'label': 'Max. Limit',
-		'oldfieldname': 'max_limit3',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'actual_amount3',
-		'fieldtype': 'Currency',
-		'idx': 4,
-		'label': 'Actual Amount',
-		'oldfieldname': 'actual_amount3',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'eligible_amount3',
-		'fieldtype': 'Currency',
-		'idx': 5,
-		'label': 'Eligible Amount',
-		'oldfieldname': 'eligible_amount3',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'modified_amount3',
-		'fieldtype': 'Currency',
-		'idx': 6,
-		'label': 'Modified Amount',
-		'oldfieldname': 'modified_amount3',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/declaration_detail/__init__.py b/erpnext/hr/doctype/declaration_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/declaration_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/doctype/declaration_detail/declaration_detail.txt b/erpnext/hr/doctype/declaration_detail/declaration_detail.txt
deleted file mode 100644
index 3c06cfd..0000000
--- a/erpnext/hr/doctype/declaration_detail/declaration_detail.txt
+++ /dev/null
@@ -1,144 +0,0 @@
-# DocType, Declaration Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:57',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'HR',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 7
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Declaration Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'Declaration Detail',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1,
-		'role': 'System Manager'
-	},
-
-	# DocType, Declaration Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Declaration Detail'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'permlevel': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'particulars1',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Particulars',
-		'oldfieldname': 'particulars1',
-		'oldfieldtype': 'Small Text',
-		'permlevel': 1,
-		'reqd': 1,
-		'width': '200px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'under_section1',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Under Section',
-		'oldfieldname': 'under_section1',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'max_limit1',
-		'fieldtype': 'Currency',
-		'idx': 3,
-		'label': 'Max. Limit',
-		'oldfieldname': 'max_limit1',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1,
-		'reqd': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'actual_amount1',
-		'fieldtype': 'Currency',
-		'idx': 4,
-		'label': 'Actual Amount',
-		'oldfieldname': 'actual_amount1',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'eligible_amount1',
-		'fieldtype': 'Currency',
-		'idx': 5,
-		'label': 'Eligible Amount',
-		'oldfieldname': 'eligible_amount1',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'modified_amount1',
-		'fieldtype': 'Currency',
-		'idx': 6,
-		'label': 'Modified Amount',
-		'oldfieldname': 'modified_amount1',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/deduction_detail/__init__.py b/erpnext/hr/doctype/deduction_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/deduction_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/doctype/deduction_detail/deduction_detail.txt b/erpnext/hr/doctype/deduction_detail/deduction_detail.txt
deleted file mode 100644
index ee24d79..0000000
--- a/erpnext/hr/doctype/deduction_detail/deduction_detail.txt
+++ /dev/null
@@ -1,77 +0,0 @@
-# DocType, Deduction Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:57',
-		'docstatus': 0,
-		'modified': '2010-11-02 20:44:58',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'HR',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 14
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Deduction Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, Deduction Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Deduction Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'd_type',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Type',
-		'oldfieldname': 'd_type',
-		'oldfieldtype': 'Select',
-		'options': 'Deduction Type',
-		'reqd': 1,
-		'width': '200px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'd_modified_amt',
-		'fieldtype': 'Currency',
-		'idx': 3,
-		'label': 'Amount',
-		'oldfieldname': 'd_modified_amt',
-		'oldfieldtype': 'Currency'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'depend_on_lwp',
-		'fieldtype': 'Check',
-		'idx': 4,
-		'label': 'Depend on LWP',
-		'oldfieldname': 'depend_on_lwp',
-		'oldfieldtype': 'Check'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/deduction_type/deduction_type.js b/erpnext/hr/doctype/deduction_type/deduction_type.js
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/deduction_type/deduction_type.js
+++ /dev/null
diff --git a/erpnext/hr/doctype/deduction_type/deduction_type.txt b/erpnext/hr/doctype/deduction_type/deduction_type.txt
index c54836f..4d3bbdd 100644
--- a/erpnext/hr/doctype/deduction_type/deduction_type.txt
+++ b/erpnext/hr/doctype/deduction_type/deduction_type.txt
@@ -3,46 +3,46 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:57',
+		'creation': '2012-03-27 14:35:54',
 		'docstatus': 0,
-		'modified': '2010-10-12 17:19:47',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:54',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
 		'allow_trash': 1,
-		'autoname': 'field:deduction_name',
-		'colour': 'White:FFF',
+		'autoname': u'field:deduction_name',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'HR',
+		'document_type': u'Master',
+		'module': u'HR',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 10
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Deduction Type',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Deduction Type',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Deduction Type',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Deduction Type',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
 		'write': 1
@@ -51,65 +51,59 @@
 	# DocType, Deduction Type
 	{
 		'doctype': 'DocType',
-		'name': 'Deduction Type'
+		'name': u'Deduction Type'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'System Manager'
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'HR User'
+		'doctype': u'DocPerm',
+		'role': u'HR User'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'role': 'HR Manager'
+		'doctype': u'DocPerm',
+		'role': u'HR Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'deduction_name',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Name',
-		'oldfieldname': 'deduction_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'deduction_name',
+		'fieldtype': u'Data',
+		'label': u'Name',
+		'oldfieldname': u'deduction_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Small Text',
-		'idx': 3,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Small Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 0,
-		'width': '300px'
+		'width': u'300px'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/department/department.js b/erpnext/hr/doctype/department/department.js
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/department/department.js
+++ /dev/null
diff --git a/erpnext/hr/doctype/department/department.txt b/erpnext/hr/doctype/department/department.txt
index aae0127..8d56347 100644
--- a/erpnext/hr/doctype/department/department.txt
+++ b/erpnext/hr/doctype/department/department.txt
@@ -3,46 +3,46 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:58',
+		'creation': '2012-03-27 14:35:54',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:54',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
 		'allow_trash': 1,
-		'autoname': 'field:department_name',
-		'colour': 'White:FFF',
+		'autoname': u'field:department_name',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'HR',
+		'document_type': u'Master',
+		'module': u'HR',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 7
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Department',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Department',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Department',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Department',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
 		'write': 1
@@ -51,51 +51,46 @@
 	# DocType, Department
 	{
 		'doctype': 'DocType',
-		'name': 'Department'
+		'name': u'Department'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'System Manager'
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'HR User'
+		'doctype': u'DocPerm',
+		'role': u'HR User'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'role': 'HR Manager'
+		'doctype': u'DocPerm',
+		'role': u'HR Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'department_name',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Department',
-		'oldfieldname': 'department_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'department_name',
+		'fieldtype': u'Data',
+		'label': u'Department',
+		'oldfieldname': u'department_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	}
diff --git a/erpnext/hr/doctype/designation/designation.js b/erpnext/hr/doctype/designation/designation.js
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/designation/designation.js
+++ /dev/null
diff --git a/erpnext/hr/doctype/designation/designation.txt b/erpnext/hr/doctype/designation/designation.txt
index 8a8f4d3..0d9ca32 100644
--- a/erpnext/hr/doctype/designation/designation.txt
+++ b/erpnext/hr/doctype/designation/designation.txt
@@ -3,46 +3,46 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:58',
+		'creation': '2012-03-27 14:35:54',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:54',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
 		'allow_trash': 1,
-		'autoname': 'field:designation_name',
-		'colour': 'White:FFF',
+		'autoname': u'field:designation_name',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'HR',
+		'document_type': u'Master',
+		'module': u'HR',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 7
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Designation',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Designation',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Designation',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Designation',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
 		'write': 1
@@ -51,51 +51,46 @@
 	# DocType, Designation
 	{
 		'doctype': 'DocType',
-		'name': 'Designation'
+		'name': u'Designation'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'System Manager'
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'HR User'
+		'doctype': u'DocPerm',
+		'role': u'HR User'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'role': 'HR Manager'
+		'doctype': u'DocPerm',
+		'role': u'HR Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'designation_name',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Designation',
-		'oldfieldname': 'designation_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'designation_name',
+		'fieldtype': u'Data',
+		'label': u'Designation',
+		'oldfieldname': u'designation_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	}
diff --git a/erpnext/hr/doctype/earn_deduction_detail/__init__.py b/erpnext/hr/doctype/earn_deduction_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/earn_deduction_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/doctype/earn_deduction_detail/earn_deduction_detail.txt b/erpnext/hr/doctype/earn_deduction_detail/earn_deduction_detail.txt
deleted file mode 100644
index 8b05961..0000000
--- a/erpnext/hr/doctype/earn_deduction_detail/earn_deduction_detail.txt
+++ /dev/null
@@ -1,116 +0,0 @@
-# DocType, Earn Deduction Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:59',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'HR',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'show_in_menu': 0,
-		'version': 4
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Earn Deduction Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# These values are common for all DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'name': '__common__',
-		'parent': 'Earn Deduction Detail',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'permlevel': 0,
-		'read': 1,
-		'role': 'All',
-		'write': 1
-	},
-
-	# DocType, Earn Deduction Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Earn Deduction Detail'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'earn_deduction_name',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'label': 'Earn/Deduction Name',
-		'oldfieldname': 'earn_deduction_name',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'mode',
-		'fieldtype': 'Select',
-		'idx': 2,
-		'label': 'Mode',
-		'oldfieldname': 'mode',
-		'oldfieldtype': 'Select',
-		'options': '\n%\nRs'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'per',
-		'fieldtype': 'Data',
-		'idx': 3,
-		'label': 'Per.(%)',
-		'oldfieldname': 'per',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'amount',
-		'fieldtype': 'Data',
-		'idx': 4,
-		'label': 'Amount',
-		'oldfieldname': 'amount',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'type',
-		'fieldtype': 'Data',
-		'idx': 5,
-		'label': 'Type',
-		'oldfieldname': 'type',
-		'oldfieldtype': 'Data'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/earning_detail/earning_detail.txt b/erpnext/hr/doctype/earning_detail/earning_detail.txt
deleted file mode 100644
index 399c6cb..0000000
--- a/erpnext/hr/doctype/earning_detail/earning_detail.txt
+++ /dev/null
@@ -1,80 +0,0 @@
-# DocType, Earning Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:59',
-		'docstatus': 0,
-		'modified': '2011-02-09 13:02:55',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'hide_heading': 0,
-		'hide_toolbar': 0,
-		'istable': 1,
-		'module': 'HR',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 26
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Earning Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, Earning Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Earning Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'e_type',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Type',
-		'oldfieldname': 'e_type',
-		'oldfieldtype': 'Data',
-		'options': 'Earning Type',
-		'reqd': 1,
-		'width': '200px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'modified_value',
-		'fieldtype': 'Currency',
-		'idx': 2,
-		'label': 'Amount',
-		'oldfieldname': 'modified_value',
-		'oldfieldtype': 'Currency',
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'depend_on_lwp',
-		'fieldtype': 'Check',
-		'idx': 3,
-		'label': 'Depend on LWP',
-		'oldfieldname': 'depend_on_lwp',
-		'oldfieldtype': 'Check'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/earning_type/earning_type.js b/erpnext/hr/doctype/earning_type/earning_type.js
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/earning_type/earning_type.js
+++ /dev/null
diff --git a/erpnext/hr/doctype/earning_type/earning_type.txt b/erpnext/hr/doctype/earning_type/earning_type.txt
index 203f8b5..f5588f1 100644
--- a/erpnext/hr/doctype/earning_type/earning_type.txt
+++ b/erpnext/hr/doctype/earning_type/earning_type.txt
@@ -3,46 +3,46 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:59',
+		'creation': '2012-03-27 14:35:54',
 		'docstatus': 0,
-		'modified': '2010-10-12 17:15:46',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:54',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
 		'allow_trash': 1,
-		'autoname': 'field:earning_name',
-		'colour': 'White:FFF',
+		'autoname': u'field:earning_name',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'HR',
+		'document_type': u'Master',
+		'module': u'HR',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 13
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Earning Type',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Earning Type',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Earning Type',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Earning Type',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
 		'write': 1
@@ -51,97 +51,89 @@
 	# DocType, Earning Type
 	{
 		'doctype': 'DocType',
-		'name': 'Earning Type'
+		'name': u'Earning Type'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'System Manager'
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'HR User'
+		'doctype': u'DocPerm',
+		'role': u'HR User'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'role': 'HR Manager'
+		'doctype': u'DocPerm',
+		'role': u'HR Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'earning_name',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Name',
-		'oldfieldname': 'earning_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'earning_name',
+		'fieldtype': u'Data',
+		'label': u'Name',
+		'oldfieldname': u'earning_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Small Text',
-		'idx': 3,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Small Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 0,
 		'reqd': 0,
-		'width': '300px'
+		'width': u'300px'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'taxable',
-		'fieldtype': 'Select',
-		'idx': 4,
-		'label': 'Taxable',
-		'oldfieldname': 'taxable',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'taxable',
+		'fieldtype': u'Select',
+		'label': u'Taxable',
+		'oldfieldname': u'taxable',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 0,
 		'reqd': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': "eval:doc.taxable=='No'",
-		'doctype': 'DocField',
-		'fieldname': 'exemption_limit',
-		'fieldtype': 'Currency',
+		'colour': u'White:FFF',
+		'depends_on': u"eval:doc.taxable=='No'",
+		'doctype': u'DocField',
+		'fieldname': u'exemption_limit',
+		'fieldtype': u'Currency',
 		'hidden': 1,
-		'idx': 5,
-		'label': 'Exemption Limit',
-		'oldfieldname': 'exemption_limit',
-		'oldfieldtype': 'Currency',
+		'label': u'Exemption Limit',
+		'oldfieldname': u'exemption_limit',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/educational_qualifications/__init__.py b/erpnext/hr/doctype/educational_qualifications/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/educational_qualifications/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/doctype/educational_qualifications/educational_qualifications.txt b/erpnext/hr/doctype/educational_qualifications/educational_qualifications.txt
deleted file mode 100644
index 76776d2..0000000
--- a/erpnext/hr/doctype/educational_qualifications/educational_qualifications.txt
+++ /dev/null
@@ -1,112 +0,0 @@
-# DocType, Educational Qualifications
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:59',
-		'docstatus': 0,
-		'modified': '2012-03-21 14:48:02',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': u'HR',
-		'name': '__common__',
-		'section_style': u'Simple',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 12
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Educational Qualifications',
-		'parentfield': u'fields',
-		'parenttype': u'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, Educational Qualifications
-	{
-		'doctype': 'DocType',
-		'name': u'Educational Qualifications'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'school_univ',
-		'fieldtype': u'Data',
-		'label': u'School/University',
-		'oldfieldname': u'school_univ',
-		'oldfieldtype': u'Data'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'qualification',
-		'fieldtype': u'Data',
-		'label': u'Qualification (Degree/Diploma)',
-		'oldfieldname': u'qualification',
-		'oldfieldtype': u'Data',
-		'reqd': 0,
-		'search_index': 1,
-		'width': u'170px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'level',
-		'fieldtype': u'Select',
-		'label': u'Level',
-		'oldfieldname': u'level',
-		'oldfieldtype': u'Select',
-		'options': u'\nGraduate\nPost Graduate\nUnder Graduate',
-		'reqd': 0,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'year_of_passing',
-		'fieldtype': u'Int',
-		'label': u'Year of Passing',
-		'oldfieldname': u'year_of_passing',
-		'oldfieldtype': u'Int',
-		'reqd': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'class_percent',
-		'fieldtype': u'Data',
-		'label': u'Class / Percentage',
-		'oldfieldname': u'class_percent',
-		'oldfieldtype': u'Data',
-		'reqd': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'maj_opt_sub',
-		'fieldtype': u'Data',
-		'label': u'Major / Optional Subject',
-		'oldfieldname': u'maj_opt_sub',
-		'oldfieldtype': u'Data',
-		'reqd': 0,
-		'width': u'170px'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/educational_qualifications_detail/__init__.py b/erpnext/hr/doctype/educational_qualifications_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/educational_qualifications_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/doctype/educational_qualifications_detail/educational_qualifications_detail.txt b/erpnext/hr/doctype/educational_qualifications_detail/educational_qualifications_detail.txt
deleted file mode 100644
index 38067e0..0000000
--- a/erpnext/hr/doctype/educational_qualifications_detail/educational_qualifications_detail.txt
+++ /dev/null
@@ -1,109 +0,0 @@
-# DocType, Educational Qualifications Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:59',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'HR',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 5
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Educational Qualifications Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, Educational Qualifications Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Educational Qualifications Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'school_univ',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'School/University',
-		'oldfieldname': 'school_univ',
-		'oldfieldtype': 'Small Text'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'qualification',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Qualification',
-		'oldfieldname': 'qualification',
-		'oldfieldtype': 'Data',
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'level',
-		'fieldtype': 'Select',
-		'idx': 3,
-		'label': 'Level',
-		'oldfieldname': 'level',
-		'oldfieldtype': 'Select',
-		'options': 'Graduate\nPost Graduate\nUnder Graduate'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'year_of_passing',
-		'fieldtype': 'Int',
-		'idx': 4,
-		'label': 'Year of Passing',
-		'oldfieldname': 'year_of_passing',
-		'oldfieldtype': 'Int'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'class_per',
-		'fieldtype': 'Data',
-		'idx': 5,
-		'label': 'Class / Percentage',
-		'oldfieldname': 'class_per',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'maj_opt_subj',
-		'fieldtype': 'Text',
-		'idx': 6,
-		'label': 'Major/Optional Subjects',
-		'oldfieldname': 'maj_opt_subj',
-		'oldfieldtype': 'Text'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index 2cf46a6..06833bf 100644
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -39,7 +39,7 @@
   # Autoname
   #========================================================================================================
   def autoname(self):
-    ret = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = 'emp_created_by'")
+    ret = sql("select value from `tabSingles` where doctype = 'Global Defaults' and field = 'emp_created_by'")
     if not ret:
       msgprint("To Save Employee, please go to Setup -->Global Defaults. Click on HR and select 'Employee Records to be created by'.")
       raise Exception 
@@ -113,7 +113,7 @@
   # Validate name
   #========================================================================================================
   def validate_name(self):  
-    ret = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = 'emp_created_by'")
+    ret = sql("select value from `tabSingles` where doctype = 'Global Defaults' and field = 'emp_created_by'")
 
     if not ret:
       msgprint("To Save Employee, please go to Setup -->Global Defaults. Click on HR and select 'Employee Records to be created by'.")
diff --git a/erpnext/hr/doctype/employee/employee.txt b/erpnext/hr/doctype/employee/employee.txt
index 98caa2c..d9e2c1f 100644
--- a/erpnext/hr/doctype/employee/employee.txt
+++ b/erpnext/hr/doctype/employee/employee.txt
@@ -3,224 +3,260 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:59',
+		'creation': '2012-03-27 14:35:55',
 		'docstatus': 0,
-		'modified': '2011-08-11 17:27:12',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:55',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1308918132',
+		'_last_update': u'1308918132',
 		'allow_attach': 1,
 		'allow_trash': 1,
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'HR',
+		'document_type': u'Master',
+		'module': u'HR',
 		'name': '__common__',
-		'search_fields': 'employee_name',
-		'section_style': 'Tabbed',
-		'server_code_error': ' ',
+		'search_fields': u'employee_name',
+		'section_style': u'Tabbed',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'subject': '%(employee_name)s',
-		'tag_fields': 'status',
+		'subject': u'%(employee_name)s',
+		'tag_fields': u'status',
 		'version': 444
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Employee',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Employee',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'amend': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Employee',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1,
-		'submit': 0
+		'parent': u'Employee',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1
 	},
 
 	# DocType, Employee
 	{
 		'doctype': 'DocType',
-		'name': 'Employee'
+		'name': u'Employee'
 	},
 
 	# DocPerm
 	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'permlevel': 0,
-		'role': 'Employee',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 2,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'All',
+		'role': u'All'
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'HR User',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'HR Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'HR User'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'HR Manager'
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'match': u'owner',
+		'permlevel': 0,
+		'submit': 0,
 		'write': 0
 	},
 
 	# DocPerm
 	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 3,
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'match': u'owner',
 		'permlevel': 0,
-		'role': 'HR User',
-		'write': 1
+		'submit': 0,
+		'write': 0
 	},
 
 	# DocPerm
 	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 4,
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'match': u'owner',
 		'permlevel': 0,
-		'role': 'HR Manager',
-		'write': 1
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'match': u'owner',
+		'permlevel': 0,
+		'submit': 0,
+		'write': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 1,
-		'label': 'Basic Information',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'basic_information',
+		'fieldtype': u'Section Break',
+		'label': u'Basic Information',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 2,
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'description': 'To manage multiple series please go to Setup > Manage Series',
-		'doctype': 'DocField',
-		'fieldname': 'naming_series',
-		'fieldtype': 'Select',
-		'idx': 3,
-		'label': 'Naming Series',
+		'description': u'To manage multiple series please go to Setup > Manage Series',
+		'doctype': u'DocField',
+		'fieldname': u'naming_series',
+		'fieldtype': u'Select',
+		'label': u'Naming Series',
 		'no_copy': 1,
-		'oldfieldname': 'naming_series',
-		'oldfieldtype': 'Select',
-		'options': 'EMP/',
+		'oldfieldname': u'naming_series',
+		'oldfieldtype': u'Select',
+		'options': u'EMP/',
 		'permlevel': 0,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'salutation',
-		'fieldtype': 'Select',
-		'idx': 4,
-		'label': 'Salutation',
-		'oldfieldname': 'salutation',
-		'oldfieldtype': 'Select',
-		'options': '\nMr\nMs',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'salutation',
+		'fieldtype': u'Select',
+		'label': u'Salutation',
+		'oldfieldname': u'salutation',
+		'oldfieldtype': u'Select',
+		'options': u'\nMr\nMs',
 		'permlevel': 0,
 		'search_index': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'employee_name',
-		'fieldtype': 'Data',
-		'idx': 5,
-		'label': 'Employee Name',
-		'oldfieldname': 'employee_name',
-		'oldfieldtype': 'Data',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'employee_name',
+		'fieldtype': u'Data',
+		'label': u'Employee Name',
+		'oldfieldname': u'employee_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'employee_number',
-		'fieldtype': 'Data',
-		'idx': 6,
+		'doctype': u'DocField',
+		'fieldname': u'employee_number',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Employee Number',
-		'oldfieldname': 'employee_number',
-		'oldfieldtype': 'Data',
+		'label': u'Employee Number',
+		'oldfieldname': u'employee_number',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'date_of_joining',
-		'fieldtype': 'Date',
-		'idx': 7,
-		'label': 'Date of Joining',
-		'oldfieldname': 'date_of_joining',
-		'oldfieldtype': 'Date',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'date_of_joining',
+		'fieldtype': u'Date',
+		'label': u'Date of Joining',
+		'oldfieldname': u'date_of_joining',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'date_of_birth',
-		'fieldtype': 'Date',
-		'idx': 8,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'date_of_birth',
+		'fieldtype': u'Date',
 		'in_filter': 1,
-		'label': 'Date of Birth',
-		'oldfieldname': 'date_of_birth',
-		'oldfieldtype': 'Date',
+		'label': u'Date of Birth',
+		'oldfieldname': u'date_of_birth',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'gender',
-		'fieldtype': 'Select',
-		'idx': 9,
+		'doctype': u'DocField',
+		'fieldname': u'gender',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Gender',
-		'oldfieldname': 'gender',
-		'oldfieldtype': 'Select',
-		'options': '\nMale\nFemale',
+		'label': u'Gender',
+		'oldfieldname': u'gender',
+		'oldfieldtype': u'Select',
+		'options': u'\nMale\nFemale',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 0
@@ -228,13 +264,12 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Select',
-		'idx': 10,
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Company',
-		'options': 'link:Company',
+		'label': u'Company',
+		'options': u'link:Company',
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1
@@ -242,26 +277,25 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 11,
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'Active',
-		'doctype': 'DocField',
-		'fieldname': 'status',
-		'fieldtype': 'Select',
-		'idx': 12,
+		'colour': u'White:FFF',
+		'default': u'Active',
+		'doctype': u'DocField',
+		'fieldname': u'status',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Status',
-		'oldfieldname': 'status',
-		'oldfieldtype': 'Select',
-		'options': '\nActive\nLeft',
+		'label': u'Status',
+		'oldfieldname': u'status',
+		'oldfieldtype': u'Select',
+		'options': u'\nActive\nLeft',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1
@@ -269,149 +303,140 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'employment_type',
-		'fieldtype': 'Link',
-		'idx': 13,
+		'doctype': u'DocField',
+		'fieldname': u'employment_type',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Employment Type',
-		'oldfieldname': 'employment_type',
-		'oldfieldtype': 'Link',
-		'options': 'Employment Type',
+		'label': u'Employment Type',
+		'oldfieldname': u'employment_type',
+		'oldfieldtype': u'Link',
+		'options': u'Employment Type',
 		'permlevel': 0,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'scheduled_confirmation_date',
-		'fieldtype': 'Date',
-		'idx': 14,
+		'doctype': u'DocField',
+		'fieldname': u'scheduled_confirmation_date',
+		'fieldtype': u'Date',
 		'in_filter': 1,
-		'label': 'Scheduled Confirmation Date',
-		'oldfieldname': 'scheduled_confirmation_date',
-		'oldfieldtype': 'Date',
+		'label': u'Scheduled Confirmation Date',
+		'oldfieldname': u'scheduled_confirmation_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'final_confirmation_date',
-		'fieldtype': 'Date',
-		'idx': 15,
-		'label': 'Final Confirmation Date',
-		'oldfieldname': 'final_confirmation_date',
-		'oldfieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'final_confirmation_date',
+		'fieldtype': u'Date',
+		'label': u'Final Confirmation Date',
+		'oldfieldname': u'final_confirmation_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'contract_end_date',
-		'fieldtype': 'Date',
-		'idx': 16,
+		'doctype': u'DocField',
+		'fieldname': u'contract_end_date',
+		'fieldtype': u'Date',
 		'in_filter': 1,
-		'label': 'Contract End Date',
-		'oldfieldname': 'contract_end_date',
-		'oldfieldtype': 'Date',
+		'label': u'Contract End Date',
+		'oldfieldname': u'contract_end_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'date_of_retirement',
-		'fieldtype': 'Date',
-		'idx': 17,
-		'label': 'Date Of Retirement',
-		'oldfieldname': 'date_of_retirement',
-		'oldfieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'date_of_retirement',
+		'fieldtype': u'Date',
+		'label': u'Date Of Retirement',
+		'oldfieldname': u'date_of_retirement',
+		'oldfieldtype': u'Date',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Applicable Holiday List',
-		'doctype': 'DocField',
-		'fieldname': 'holiday_list',
-		'fieldtype': 'Link',
-		'idx': 18,
-		'label': 'Holiday List',
-		'oldfieldname': 'holiday_list',
-		'oldfieldtype': 'Link',
-		'options': 'Holiday List',
+		'colour': u'White:FFF',
+		'description': u'Applicable Holiday List',
+		'doctype': u'DocField',
+		'fieldname': u'holiday_list',
+		'fieldtype': u'Link',
+		'label': u'Holiday List',
+		'oldfieldname': u'holiday_list',
+		'oldfieldtype': u'Link',
+		'options': u'Holiday List',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 19,
-		'label': 'Job Profile',
+		'doctype': u'DocField',
+		'fieldname': u'job_profile',
+		'fieldtype': u'Section Break',
+		'label': u'Job Profile',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 20,
+		'doctype': u'DocField',
+		'fieldname': u'column_break2',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'branch',
-		'fieldtype': 'Link',
-		'idx': 21,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'branch',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Branch',
-		'oldfieldname': 'branch',
-		'oldfieldtype': 'Link',
-		'options': 'Branch',
+		'label': u'Branch',
+		'oldfieldname': u'branch',
+		'oldfieldtype': u'Link',
+		'options': u'Branch',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'department',
-		'fieldtype': 'Link',
-		'idx': 22,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'department',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Department',
-		'oldfieldname': 'department',
-		'oldfieldtype': 'Link',
-		'options': 'Department',
+		'label': u'Department',
+		'oldfieldname': u'department',
+		'oldfieldtype': u'Link',
+		'options': u'Department',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'designation',
-		'fieldtype': 'Link',
-		'idx': 23,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'designation',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Designation',
-		'oldfieldname': 'designation',
-		'oldfieldtype': 'Link',
-		'options': 'Designation',
+		'label': u'Designation',
+		'oldfieldname': u'designation',
+		'oldfieldtype': u'Link',
+		'options': u'Designation',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1
@@ -419,666 +444,624 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'grade',
-		'fieldtype': 'Link',
-		'idx': 24,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'grade',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Grade',
-		'oldfieldname': 'grade',
-		'oldfieldtype': 'Link',
-		'options': 'Grade',
+		'label': u'Grade',
+		'oldfieldname': u'grade',
+		'oldfieldtype': u'Link',
+		'options': u'Grade',
 		'permlevel': 0,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'reports_to',
-		'fieldtype': 'Link',
-		'idx': 25,
-		'label': 'Reports to',
-		'oldfieldname': 'reports_to',
-		'oldfieldtype': 'Link',
-		'options': 'Employee',
+		'doctype': u'DocField',
+		'fieldname': u'reports_to',
+		'fieldtype': u'Link',
+		'label': u'Reports to',
+		'oldfieldname': u'reports_to',
+		'oldfieldtype': u'Link',
+		'options': u'Employee',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'description': 'Provide email id registered in company',
-		'doctype': 'DocField',
-		'fieldname': 'company_email',
-		'fieldtype': 'Data',
-		'idx': 26,
+		'description': u'Provide email id registered in company',
+		'doctype': u'DocField',
+		'fieldname': u'company_email',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Email (By company)',
-		'oldfieldname': 'company_email',
-		'oldfieldtype': 'Data',
+		'label': u'Email (By company)',
+		'oldfieldname': u'company_email',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 27,
-		'label': 'Salary Information',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'salary_information',
+		'fieldtype': u'Column Break',
+		'label': u'Salary Information',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'salary_mode',
-		'fieldtype': 'Select',
-		'idx': 28,
-		'label': 'Salary Mode',
-		'oldfieldname': 'salary_mode',
-		'oldfieldtype': 'Select',
-		'options': '\nBank\nCash\nCheque',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'salary_mode',
+		'fieldtype': u'Select',
+		'label': u'Salary Mode',
+		'oldfieldname': u'salary_mode',
+		'oldfieldtype': u'Select',
+		'options': u'\nBank\nCash\nCheque',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': "eval:doc.salary_mode == 'Bank'",
-		'doctype': 'DocField',
-		'fieldname': 'bank_name',
-		'fieldtype': 'Data',
+		'colour': u'White:FFF',
+		'depends_on': u"eval:doc.salary_mode == 'Bank'",
+		'doctype': u'DocField',
+		'fieldname': u'bank_name',
+		'fieldtype': u'Data',
 		'hidden': 0,
-		'idx': 29,
 		'in_filter': 1,
-		'label': 'Bank Name',
-		'oldfieldname': 'bank_name',
-		'oldfieldtype': 'Link',
-		'options': 'Suggest',
+		'label': u'Bank Name',
+		'oldfieldname': u'bank_name',
+		'oldfieldtype': u'Link',
+		'options': u'Suggest',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': "eval:doc.salary_mode == 'Bank'",
-		'doctype': 'DocField',
-		'fieldname': 'bank_ac_no',
-		'fieldtype': 'Data',
+		'colour': u'White:FFF',
+		'depends_on': u"eval:doc.salary_mode == 'Bank'",
+		'doctype': u'DocField',
+		'fieldname': u'bank_ac_no',
+		'fieldtype': u'Data',
 		'hidden': 0,
-		'idx': 30,
-		'label': 'Bank A/C No.',
-		'oldfieldname': 'bank_ac_no',
-		'oldfieldtype': 'Data',
+		'label': u'Bank A/C No.',
+		'oldfieldname': u'bank_ac_no',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'esic_card_no',
-		'fieldtype': 'Data',
-		'idx': 31,
-		'label': 'ESIC CARD No',
-		'oldfieldname': 'esic_card_no',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'esic_card_no',
+		'fieldtype': u'Data',
+		'label': u'ESIC CARD No',
+		'oldfieldname': u'esic_card_no',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'pf_number',
-		'fieldtype': 'Data',
-		'idx': 32,
-		'label': 'PF Number',
-		'oldfieldname': 'pf_number',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'pf_number',
+		'fieldtype': u'Data',
+		'label': u'PF Number',
+		'oldfieldname': u'pf_number',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'gratuity_lic_id',
-		'fieldtype': 'Data',
-		'idx': 33,
-		'label': 'Gratuity LIC ID',
-		'oldfieldname': 'gratuity_lic_id',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'gratuity_lic_id',
+		'fieldtype': u'Data',
+		'label': u'Gratuity LIC ID',
+		'oldfieldname': u'gratuity_lic_id',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 34,
-		'label': 'Contact Details',
+		'doctype': u'DocField',
+		'fieldname': u'contact_details',
+		'fieldtype': u'Section Break',
+		'label': u'Contact Details',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 35,
+		'doctype': u'DocField',
+		'fieldname': u'column_break3',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'cell_number',
-		'fieldtype': 'Data',
-		'idx': 36,
-		'label': 'Cell Number',
+		'doctype': u'DocField',
+		'fieldname': u'cell_number',
+		'fieldtype': u'Data',
+		'label': u'Cell Number',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'personal_email',
-		'fieldtype': 'Data',
-		'idx': 37,
-		'label': 'Personal Email',
+		'doctype': u'DocField',
+		'fieldname': u'personal_email',
+		'fieldtype': u'Data',
+		'label': u'Personal Email',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'notice_number_of_days',
-		'fieldtype': 'Int',
-		'idx': 38,
-		'label': 'Notice - Number of Days',
-		'oldfieldname': 'notice_number_of_days',
-		'oldfieldtype': 'Int',
+		'doctype': u'DocField',
+		'fieldname': u'notice_number_of_days',
+		'fieldtype': u'Int',
+		'label': u'Notice - Number of Days',
+		'oldfieldname': u'notice_number_of_days',
+		'oldfieldtype': u'Int',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 39,
-		'label': 'Emergency Contact Details',
-		'options': '<b>Emergency Contact Details</b>',
+		'doctype': u'DocField',
+		'fieldname': u'emergency_contact_details',
+		'fieldtype': u'HTML',
+		'label': u'Emergency Contact Details',
+		'options': u'<b>Emergency Contact Details</b>',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'person_to_be_contacted',
-		'fieldtype': 'Data',
-		'idx': 40,
-		'label': 'Person To Be Contacted',
+		'doctype': u'DocField',
+		'fieldname': u'person_to_be_contacted',
+		'fieldtype': u'Data',
+		'label': u'Person To Be Contacted',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'relation',
-		'fieldtype': 'Data',
-		'idx': 41,
-		'label': 'Relation',
+		'doctype': u'DocField',
+		'fieldname': u'relation',
+		'fieldtype': u'Data',
+		'label': u'Relation',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'emergency_phone_number',
-		'fieldtype': 'Data',
-		'idx': 42,
-		'label': 'Emergency Phone Number',
+		'doctype': u'DocField',
+		'fieldname': u'emergency_phone_number',
+		'fieldtype': u'Data',
+		'label': u'Emergency Phone Number',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 43,
+		'doctype': u'DocField',
+		'fieldname': u'column_break4',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'permanent_accommodation_type',
-		'fieldtype': 'Select',
-		'idx': 44,
-		'label': 'Permanent Accommodation Type',
-		'options': '\nRented\nOwned',
+		'doctype': u'DocField',
+		'fieldname': u'permanent_accommodation_type',
+		'fieldtype': u'Select',
+		'label': u'Permanent Accommodation Type',
+		'options': u'\nRented\nOwned',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'permanent_address',
-		'fieldtype': 'Small Text',
-		'idx': 45,
-		'label': 'Permanent Address',
+		'doctype': u'DocField',
+		'fieldname': u'permanent_address',
+		'fieldtype': u'Small Text',
+		'label': u'Permanent Address',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'current_accommodation_type',
-		'fieldtype': 'Select',
-		'idx': 46,
-		'label': 'Current Accommodation Type',
-		'options': '\nRented\nOwned',
+		'doctype': u'DocField',
+		'fieldname': u'current_accommodation_type',
+		'fieldtype': u'Select',
+		'label': u'Current Accommodation Type',
+		'options': u'\nRented\nOwned',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'current_address',
-		'fieldtype': 'Small Text',
-		'idx': 47,
-		'label': 'Current Address',
+		'doctype': u'DocField',
+		'fieldname': u'current_address',
+		'fieldtype': u'Small Text',
+		'label': u'Current Address',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 48,
-		'label': 'Personal Details',
+		'doctype': u'DocField',
+		'fieldname': u'personal_details',
+		'fieldtype': u'Section Break',
+		'label': u'Personal Details',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 49,
+		'doctype': u'DocField',
+		'fieldname': u'column_break5',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'pan_number',
-		'fieldtype': 'Data',
-		'idx': 50,
-		'label': 'PAN Number',
+		'doctype': u'DocField',
+		'fieldname': u'pan_number',
+		'fieldtype': u'Data',
+		'label': u'PAN Number',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'passport_number',
-		'fieldtype': 'Data',
-		'idx': 51,
-		'label': 'Passport Number',
+		'doctype': u'DocField',
+		'fieldname': u'passport_number',
+		'fieldtype': u'Data',
+		'label': u'Passport Number',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'employee_profile',
+		'fieldtype': u'Button',
 		'hidden': 1,
-		'idx': 52,
-		'label': 'Employee Profile',
-		'oldfieldtype': 'Button',
+		'label': u'Employee Profile',
+		'oldfieldtype': u'Button',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'date_of_issue',
-		'fieldtype': 'Date',
-		'idx': 53,
-		'label': 'Date of Issue',
+		'doctype': u'DocField',
+		'fieldname': u'date_of_issue',
+		'fieldtype': u'Date',
+		'label': u'Date of Issue',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'valid_upto',
-		'fieldtype': 'Date',
-		'idx': 54,
-		'label': 'Valid Upto',
+		'doctype': u'DocField',
+		'fieldname': u'valid_upto',
+		'fieldtype': u'Date',
+		'label': u'Valid Upto',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'salary_structure',
+		'fieldtype': u'Button',
 		'hidden': 1,
-		'idx': 55,
-		'label': 'Salary Structure',
-		'oldfieldtype': 'Button',
+		'label': u'Salary Structure',
+		'oldfieldtype': u'Button',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'place_of_issue',
-		'fieldtype': 'Data',
-		'idx': 56,
-		'label': 'Place of Issue',
+		'doctype': u'DocField',
+		'fieldname': u'place_of_issue',
+		'fieldtype': u'Data',
+		'label': u'Place of Issue',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'marital_status',
-		'fieldtype': 'Select',
-		'idx': 57,
-		'label': 'Marital Status',
-		'options': '\nSingle\nMarried\nDivorced\nWidowed',
+		'doctype': u'DocField',
+		'fieldname': u'marital_status',
+		'fieldtype': u'Select',
+		'label': u'Marital Status',
+		'options': u'\nSingle\nMarried\nDivorced\nWidowed',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'blood_group',
-		'fieldtype': 'Select',
-		'idx': 58,
-		'label': 'Blood Group',
-		'options': '\nA+\nA-\nB+\nB-\nAB+\nAB-\nO+\nO-',
+		'doctype': u'DocField',
+		'fieldname': u'blood_group',
+		'fieldtype': u'Select',
+		'label': u'Blood Group',
+		'options': u'\nA+\nA-\nB+\nB-\nAB+\nAB-\nO+\nO-',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 59,
+		'doctype': u'DocField',
+		'fieldname': u'column_break6',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Here you can maintain family details like name and occupation of parent, spouse and children',
-		'doctype': 'DocField',
-		'fieldname': 'family_background',
-		'fieldtype': 'Small Text',
-		'idx': 60,
-		'label': 'Family Background',
+		'colour': u'White:FFF',
+		'description': u'Here you can maintain family details like name and occupation of parent, spouse and children',
+		'doctype': u'DocField',
+		'fieldname': u'family_background',
+		'fieldtype': u'Small Text',
+		'label': u'Family Background',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Here you can maintain height, weight, allergies, medical concerns etc',
-		'doctype': 'DocField',
-		'fieldname': 'health_details',
-		'fieldtype': 'Small Text',
-		'idx': 61,
-		'label': 'Health Details',
+		'colour': u'White:FFF',
+		'description': u'Here you can maintain height, weight, allergies, medical concerns etc',
+		'doctype': u'DocField',
+		'fieldname': u'health_details',
+		'fieldtype': u'Small Text',
+		'label': u'Health Details',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 62,
-		'label': 'Educational Qualification',
+		'doctype': u'DocField',
+		'fieldname': u'educational_qualification',
+		'fieldtype': u'Section Break',
+		'label': u'Educational Qualification',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'educational_qualification_details',
-		'fieldtype': 'Table',
-		'idx': 63,
-		'label': 'Educational Qualification Details',
-		'options': 'Educational Qualifications Detail',
+		'doctype': u'DocField',
+		'fieldname': u'educational_qualification_details',
+		'fieldtype': u'Table',
+		'label': u'Educational Qualification Details',
+		'options': u'Employee Education',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 64,
-		'label': 'Career History',
+		'doctype': u'DocField',
+		'fieldname': u'career_history',
+		'fieldtype': u'Section Break',
+		'label': u'Career History',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 65,
-		'label': 'Previous Work Experience',
-		'options': 'Simple',
+		'doctype': u'DocField',
+		'fieldname': u'previous_work_experience',
+		'fieldtype': u'Section Break',
+		'label': u'Previous Work Experience',
+		'options': u'Simple',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'previous_experience_details',
-		'fieldtype': 'Table',
-		'idx': 66,
-		'label': 'Previous Experience Details',
-		'options': 'Previous Experience Detail',
+		'doctype': u'DocField',
+		'fieldname': u'previous_experience_details',
+		'fieldtype': u'Table',
+		'label': u'Employee External Work History',
+		'options': u'Employee External Work History',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 67,
-		'label': 'History In Company',
-		'options': 'Simple',
+		'doctype': u'DocField',
+		'fieldname': u'history_in_company',
+		'fieldtype': u'Section Break',
+		'label': u'History In Company',
+		'options': u'Simple',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'experience_in_company_details',
-		'fieldtype': 'Table',
-		'idx': 68,
-		'label': 'Experience In Company Details',
-		'options': 'Experience In Company Detail',
+		'doctype': u'DocField',
+		'fieldname': u'experience_in_company_details',
+		'fieldtype': u'Table',
+		'label': u'Employee Internal Work Historys',
+		'options': u'Employee Internal Work History',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 69,
-		'label': 'Exit',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'exit',
+		'fieldtype': u'Section Break',
+		'label': u'Exit',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 70,
+		'doctype': u'DocField',
+		'fieldname': u'column_break7',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'resignation_letter_date',
-		'fieldtype': 'Date',
-		'idx': 71,
-		'label': 'Resignation Letter Date',
-		'oldfieldname': 'resignation_letter_date',
-		'oldfieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'resignation_letter_date',
+		'fieldtype': u'Date',
+		'label': u'Resignation Letter Date',
+		'oldfieldname': u'resignation_letter_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'relieving_date',
-		'fieldtype': 'Date',
-		'idx': 72,
+		'doctype': u'DocField',
+		'fieldname': u'relieving_date',
+		'fieldtype': u'Date',
 		'in_filter': 1,
-		'label': 'Relieving Date',
-		'oldfieldname': 'relieving_date',
-		'oldfieldtype': 'Date',
+		'label': u'Relieving Date',
+		'oldfieldname': u'relieving_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'reason_for_leaving',
-		'fieldtype': 'Data',
-		'idx': 73,
-		'label': 'Reason for Leaving',
-		'oldfieldname': 'reason_for_leaving',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'reason_for_leaving',
+		'fieldtype': u'Data',
+		'label': u'Reason for Leaving',
+		'oldfieldname': u'reason_for_leaving',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'leave_encashed',
-		'fieldtype': 'Select',
-		'idx': 74,
-		'label': 'Leave Encashed?',
-		'oldfieldname': 'leave_encashed',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'doctype': u'DocField',
+		'fieldname': u'leave_encashed',
+		'fieldtype': u'Select',
+		'label': u'Leave Encashed?',
+		'oldfieldname': u'leave_encashed',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'encashment_date',
-		'fieldtype': 'Date',
-		'idx': 75,
-		'label': 'Encashment Date',
-		'oldfieldname': 'encashment_date',
-		'oldfieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'encashment_date',
+		'fieldtype': u'Date',
+		'label': u'Encashment Date',
+		'oldfieldname': u'encashment_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 76,
-		'label': 'Exit Interview Details',
-		'oldfieldname': 'col_brk6',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'exit_interview_details',
+		'fieldtype': u'Column Break',
+		'label': u'Exit Interview Details',
+		'oldfieldname': u'col_brk6',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'held_on',
-		'fieldtype': 'Date',
-		'idx': 77,
-		'label': 'Held On',
-		'oldfieldname': 'held_on',
-		'oldfieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'held_on',
+		'fieldtype': u'Date',
+		'label': u'Held On',
+		'oldfieldname': u'held_on',
+		'oldfieldtype': u'Date',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'reason_for_resignation',
-		'fieldtype': 'Select',
-		'idx': 78,
-		'label': 'Reason for Resignation',
-		'oldfieldname': 'reason_for_resignation',
-		'oldfieldtype': 'Select',
-		'options': '\nBetter Prospects\nHealth Concerns',
+		'doctype': u'DocField',
+		'fieldname': u'reason_for_resignation',
+		'fieldtype': u'Select',
+		'label': u'Reason for Resignation',
+		'oldfieldname': u'reason_for_resignation',
+		'oldfieldtype': u'Select',
+		'options': u'\nBetter Prospects\nHealth Concerns',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'new_workplace',
-		'fieldtype': 'Data',
-		'idx': 79,
-		'label': 'New Workplace',
-		'oldfieldname': 'new_workplace',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'new_workplace',
+		'fieldtype': u'Data',
+		'label': u'New Workplace',
+		'oldfieldname': u'new_workplace',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'feedback',
-		'fieldtype': 'Small Text',
-		'idx': 80,
-		'label': 'Feedback',
-		'oldfieldname': 'feedback',
-		'oldfieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'feedback',
+		'fieldtype': u'Small Text',
+		'label': u'Feedback',
+		'oldfieldname': u'feedback',
+		'oldfieldtype': u'Text',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'file_list',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'idx': 81,
-		'label': 'File List',
+		'label': u'File List',
 		'permlevel': 0,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 82,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	}
-]
\ No newline at end of file
+]
diff --git a/erpnext/hr/doctype/absent_days_detail/__init__.py b/erpnext/hr/doctype/employee_education/__init__.py
similarity index 100%
rename from erpnext/hr/doctype/absent_days_detail/__init__.py
rename to erpnext/hr/doctype/employee_education/__init__.py
diff --git a/erpnext/hr/doctype/employee_education/employee_education.txt b/erpnext/hr/doctype/employee_education/employee_education.txt
new file mode 100644
index 0000000..b920fd6
--- /dev/null
+++ b/erpnext/hr/doctype/employee_education/employee_education.txt
@@ -0,0 +1,103 @@
+# DocType, Employee Education
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:54',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:54',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'HR',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 5
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Employee Education',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# DocType, Employee Education
+	{
+		'doctype': 'DocType',
+		'name': u'Employee Education'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'school_univ',
+		'fieldtype': u'Small Text',
+		'label': u'School/University',
+		'oldfieldname': u'school_univ',
+		'oldfieldtype': u'Small Text'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'qualification',
+		'fieldtype': u'Data',
+		'label': u'Qualification',
+		'oldfieldname': u'qualification',
+		'oldfieldtype': u'Data',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'level',
+		'fieldtype': u'Select',
+		'label': u'Level',
+		'oldfieldname': u'level',
+		'oldfieldtype': u'Select',
+		'options': u'Graduate\nPost Graduate\nUnder Graduate'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'year_of_passing',
+		'fieldtype': u'Int',
+		'label': u'Year of Passing',
+		'oldfieldname': u'year_of_passing',
+		'oldfieldtype': u'Int'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'class_per',
+		'fieldtype': u'Data',
+		'label': u'Class / Percentage',
+		'oldfieldname': u'class_per',
+		'oldfieldtype': u'Data'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'maj_opt_subj',
+		'fieldtype': u'Text',
+		'label': u'Major/Optional Subjects',
+		'oldfieldname': u'maj_opt_subj',
+		'oldfieldtype': u'Text'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/absent_days_detail/__init__.py b/erpnext/hr/doctype/employee_external_work_history/__init__.py
similarity index 100%
copy from erpnext/hr/doctype/absent_days_detail/__init__.py
copy to erpnext/hr/doctype/employee_external_work_history/__init__.py
diff --git a/erpnext/hr/doctype/employee_external_work_history/employee_external_work_history.txt b/erpnext/hr/doctype/employee_external_work_history/employee_external_work_history.txt
new file mode 100644
index 0000000..167675a
--- /dev/null
+++ b/erpnext/hr/doctype/employee_external_work_history/employee_external_work_history.txt
@@ -0,0 +1,120 @@
+# DocType, Employee External Work History
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:59',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:59',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'HR',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 3
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Employee External Work History',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# These values are common for all DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Employee External Work History',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': u'All',
+		'write': 1
+	},
+
+	# DocType, Employee External Work History
+	{
+		'doctype': 'DocType',
+		'name': u'Employee External Work History'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'company_name',
+		'fieldtype': u'Data',
+		'label': u'Company',
+		'oldfieldname': u'company_name',
+		'oldfieldtype': u'Data'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'designation',
+		'fieldtype': u'Data',
+		'label': u'Designation',
+		'oldfieldname': u'designation',
+		'oldfieldtype': u'Data'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'salary',
+		'fieldtype': u'Currency',
+		'label': u'Salary',
+		'oldfieldname': u'salary',
+		'oldfieldtype': u'Currency'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'address',
+		'fieldtype': u'Small Text',
+		'label': u'Address',
+		'oldfieldname': u'address',
+		'oldfieldtype': u'Small Text'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'contact',
+		'fieldtype': u'Data',
+		'label': u'Contact',
+		'oldfieldname': u'contact',
+		'oldfieldtype': u'Data'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'total_experience',
+		'fieldtype': u'Data',
+		'label': u'Total Experience',
+		'oldfieldname': u'total_experience',
+		'oldfieldtype': u'Data'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/absent_days_detail/__init__.py b/erpnext/hr/doctype/employee_internal_work_history/__init__.py
similarity index 100%
copy from erpnext/hr/doctype/absent_days_detail/__init__.py
copy to erpnext/hr/doctype/employee_internal_work_history/__init__.py
diff --git a/erpnext/hr/doctype/employee_internal_work_history/employee_internal_work_history.txt b/erpnext/hr/doctype/employee_internal_work_history/employee_internal_work_history.txt
new file mode 100644
index 0000000..3dcc1ff
--- /dev/null
+++ b/erpnext/hr/doctype/employee_internal_work_history/employee_internal_work_history.txt
@@ -0,0 +1,104 @@
+# DocType, Employee Internal Work History
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:57',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:57',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'HR',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'show_in_menu': 0,
+		'version': 6
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Employee Internal Work History',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# DocType, Employee Internal Work History
+	{
+		'doctype': 'DocType',
+		'name': u'Employee Internal Work History'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'branch',
+		'fieldtype': u'Select',
+		'label': u'Branch',
+		'oldfieldname': u'branch',
+		'oldfieldtype': u'Select',
+		'options': u'link:Branch'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'department',
+		'fieldtype': u'Select',
+		'label': u'Department',
+		'oldfieldname': u'department',
+		'oldfieldtype': u'Select',
+		'options': u'link:Department'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'designation',
+		'fieldtype': u'Select',
+		'label': u'Designation',
+		'oldfieldname': u'designation',
+		'oldfieldtype': u'Select',
+		'options': u'link:Designation'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'grade',
+		'fieldtype': u'Select',
+		'label': u'Grade',
+		'oldfieldname': u'grade',
+		'oldfieldtype': u'Select',
+		'options': u'link:Grade'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'from_date',
+		'fieldtype': u'Date',
+		'label': u'From Date',
+		'oldfieldname': u'from_date',
+		'oldfieldtype': u'Date'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'to_date',
+		'fieldtype': u'Date',
+		'label': u'To Date',
+		'oldfieldname': u'to_date',
+		'oldfieldtype': u'Date'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/earning_detail/__init__.py b/erpnext/hr/doctype/employee_training/__init__.py
similarity index 100%
rename from erpnext/hr/doctype/earning_detail/__init__.py
rename to erpnext/hr/doctype/employee_training/__init__.py
diff --git a/erpnext/hr/doctype/employee_training/employee_training.txt b/erpnext/hr/doctype/employee_training/employee_training.txt
new file mode 100644
index 0000000..c751836
--- /dev/null
+++ b/erpnext/hr/doctype/employee_training/employee_training.txt
@@ -0,0 +1,95 @@
+# DocType, Employee Training
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:59',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:59',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'HR',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 5
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Employee Training',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# DocType, Employee Training
+	{
+		'doctype': 'DocType',
+		'name': u'Employee Training'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'institute',
+		'fieldtype': u'Small Text',
+		'label': u'Institute / Conducted By',
+		'oldfieldname': u'institute',
+		'oldfieldtype': u'Small Text',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'nature_of_training',
+		'fieldtype': u'Small Text',
+		'label': u'Program / Seminar Title',
+		'oldfieldname': u'nature_of_training',
+		'oldfieldtype': u'Small Text',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'duration',
+		'fieldtype': u'Data',
+		'label': u'Duration',
+		'oldfieldname': u'duration',
+		'oldfieldtype': u'Data',
+		'reqd': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'loc',
+		'fieldtype': u'Data',
+		'label': u'Location',
+		'oldfieldname': u'loc',
+		'oldfieldtype': u'Data',
+		'reqd': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'certificate',
+		'fieldtype': u'Small Text',
+		'label': u'Certificate',
+		'oldfieldname': u'certificate',
+		'oldfieldtype': u'Small Text'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/employment_type/employment_type.js b/erpnext/hr/doctype/employment_type/employment_type.js
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/employment_type/employment_type.js
+++ /dev/null
diff --git a/erpnext/hr/doctype/employment_type/employment_type.txt b/erpnext/hr/doctype/employment_type/employment_type.txt
index 67d54d1..5768382 100644
--- a/erpnext/hr/doctype/employment_type/employment_type.txt
+++ b/erpnext/hr/doctype/employment_type/employment_type.txt
@@ -3,46 +3,46 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:00',
+		'creation': '2012-03-27 14:35:55',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:55',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
 		'allow_trash': 1,
-		'autoname': 'field:employee_type_name',
-		'colour': 'White:FFF',
+		'autoname': u'field:employee_type_name',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'HR',
+		'document_type': u'Master',
+		'module': u'HR',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 16
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Employment Type',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Employment Type',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Employment Type',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Employment Type',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
 		'write': 1
@@ -51,52 +51,47 @@
 	# DocType, Employment Type
 	{
 		'doctype': 'DocType',
-		'name': 'Employment Type'
+		'name': u'Employment Type'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'System Manager'
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'HR User'
+		'doctype': u'DocPerm',
+		'role': u'HR User'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'role': 'HR Manager'
+		'doctype': u'DocPerm',
+		'role': u'HR Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'employee_type_name',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'label': 'Employment Type',
-		'oldfieldname': 'employee_type_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'employee_type_name',
+		'fieldtype': u'Data',
+		'label': u'Employment Type',
+		'oldfieldname': u'employee_type_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 2,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/expense_type/__init__.py b/erpnext/hr/doctype/expense_claim/__init__.py
similarity index 100%
rename from erpnext/hr/doctype/expense_type/__init__.py
rename to erpnext/hr/doctype/expense_claim/__init__.py
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js
new file mode 100644
index 0000000..346e248
--- /dev/null
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.js
@@ -0,0 +1,253 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.	If not, see <http://www.gnu.org/licenses/>.
+
+cur_frm.add_fetch('employee', 'company', 'company');
+
+cur_frm.cscript.onload = function(doc,cdt,cdn){
+	// 
+	if(!doc.approval_status) set_multiple(cdt,cdn,{approval_status:'Draft'});
+	if(doc.employee) cur_frm.cscript.employee(doc,cdt,cdn);
+	
+	if (doc.__islocal) {
+		if(doc.amended_from) set_multiple(cdt,cdn,{approval_status:'Draft'});
+		var val = getchildren('Expense Claim Detail', doc.name, 'expense_voucher_details', doc.doctype);
+		for(var i = 0; i<val.length; i++){
+			val[i].sanctioned_amount ='';
+		}
+		//doc.total_claimed_amount = '';
+		doc.total_sanctioned_amount = '';
+		refresh_many(['sanctioned_amount', 'total_sanctioned_amount']);
+	}
+}
+
+cur_frm.cscript.refresh = function(doc,cdt,cdn){
+	if((user == doc.exp_approver && doc.approval_status == 'Submitted') || doc.docstatus == 0) unhide_field('calculate_total_amount');
+	else hide_field('calculate_total_amount');
+	
+	if(user == doc.exp_approver && doc.approval_status == 'Submitted')	unhide_field(['update_voucher', 'approve', 'reject']);
+
+	else hide_field(['update_voucher', 'approve', 'reject']);
+
+	
+	if(user == doc.exp_approver && doc.approval_status == 'Submitted') set_field_permlevel('remark', 0);
+	else set_field_permlevel('remark', 1);
+}
+
+cur_frm.cscript.employee = function(doc,cdt,cdn){
+	if(doc.employee){
+		$c_obj(make_doclist(doc.doctype, doc.name),'set_approver','', function(r,rt){
+			if(r.message){
+				doc.employee_name = r.message['emp_nm'];
+				get_field(doc.doctype, 'exp_approver' , doc.name).options = r.message['app_lst'];				
+				refresh_many(['exp_approver','employee_name']);
+			}		
+		});
+	}
+}
+
+cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
+	if(doc.approval_status == 'Draft'){
+		var val = getchildren('Expense Claim Detail', doc.name, 'expense_voucher_details', doc.doctype);
+		var total_claim =0;
+		for(var i = 0; i<val.length; i++){
+			total_claim = flt(total_claim)+flt(val[i].claim_amount);
+		}
+		doc.total_claimed_amount = flt(total_claim);
+		refresh_field('total_claimed_amount');
+		
+		$c_obj(make_doclist(doc.doctype, doc.name),'validate_approver','', function(r,rt){
+			if(r.message){
+				if(r.message['valid_approver'] == 'No'){
+					doc.exp_approver ='';
+				}
+				get_field(doc.doctype, 'exp_approver' , doc.name).options = '';
+				get_field(doc.doctype, 'exp_approver' , doc.name).options = r.message['app_lst'];
+				refresh_field('exp_approver');
+			}
+		});
+	}
+	else if(doc.approval_status == 'Submitted'){
+		var val = getchildren('Expense Claim Detail', doc.name, 'expense_voucher_details', doc.doctype);
+		var total_sanctioned = 0;
+		for(var i = 0; i<val.length; i++){
+			total_sanctioned = flt(total_sanctioned)+flt(val[i].sanctioned_amount);
+		}
+		doc.total_sanctioned_amount = flt(total_sanctioned);
+		refresh_field('total_sanctioned_amount');
+	}
+}
+
+cur_frm.cscript.calculate_total_amount = function(doc,cdt,cdn){
+	cur_frm.cscript.calculate_total(doc,cdt,cdn);
+}
+cur_frm.cscript.claim_amount = function(doc,cdt,cdn){
+	cur_frm.cscript.calculate_total(doc,cdt,cdn);
+}
+cur_frm.cscript.sanctioned_amount = function(doc,cdt,cdn){
+	cur_frm.cscript.calculate_total(doc,cdt,cdn);
+}
+
+wn.require('erpnext/setup/doctype/notification_control/notification_control.js');
+
+cur_frm.cscript.approve = function(doc,cdt,cdn){
+
+	if(user == doc.exp_approver){
+		var approve_voucher_dialog;
+		
+		set_approve_voucher_dialog = function() {
+			approve_voucher_dialog = new Dialog(400, 200, 'Approve Voucher');
+			approve_voucher_dialog.make_body([
+				['HTML', 'Message', '<div class = "comment">You wont be able to do any changes after approving this expense voucher. Are you sure, you want to approve it ?</div>'],
+				['HTML', 'Response', '<div class = "comment" id="approve_voucher_dialog_response"></div>'],
+				['HTML', 'Approve Voucher', '<div></div>']
+			]);
+			
+			var approve_voucher_btn1 = $a($i(approve_voucher_dialog.widgets['Approve Voucher']), 'button', 'button');
+			approve_voucher_btn1.innerHTML = 'Yes';
+			approve_voucher_btn1.onclick = function(){ approve_voucher_dialog.add(); }
+			
+			var approve_voucher_btn2 = $a($i(approve_voucher_dialog.widgets['Approve Voucher']), 'button', 'button');
+			approve_voucher_btn2.innerHTML = 'No';
+			$y(approve_voucher_btn2,{marginLeft:'4px'});
+			approve_voucher_btn2.onclick = function(){ approve_voucher_dialog.hide();}
+			
+			approve_voucher_dialog.onshow = function() {
+				$i('approve_voucher_dialog_response').innerHTML = '';
+			}
+			
+			approve_voucher_dialog.add = function() {
+				// sending...
+				$i('approve_voucher_dialog_response').innerHTML = 'Processing...';
+				
+				$c_obj(make_doclist(this.doc.doctype, this.doc.name),'approve_voucher','', function(r,rt){
+					if(r.message == 'Approved'){
+						$i('approve_voucher_dialog_response').innerHTML = 'Approved';
+						refresh_field('approval_status');
+						hide_field(['update_voucher', 'approve', 'reject', 'calculate_total_amount']);
+						approve_voucher_dialog.hide();
+			var args = {
+				type: 'Expense Claim Approved',
+				doctype: 'Expense Claim',
+				contact_name: doc.employee_name,
+				send_to: doc.email_id
+			}
+			cur_frm.cscript.notify(doc, args);
+					}
+					else if(r.message == 'Incomplete'){
+						$i('approve_voucher_dialog_response').innerHTML = 'Incomplete Voucher';
+					}
+					else if(r.message == 'No Amount'){
+						$i('approve_voucher_dialog_response').innerHTML = 'Calculate total amount';
+					}
+				});
+			}
+		}	
+		
+		if(!approve_voucher_dialog){
+			set_approve_voucher_dialog();
+		}	
+		approve_voucher_dialog.doc = doc;
+		approve_voucher_dialog.cdt = cdt;
+		approve_voucher_dialog.cdn = cdn;
+		approve_voucher_dialog.show();
+		refresh_field('expense_voucher_details');
+		doc.__unsaved = 0;
+		cur_frm.refresh_header();
+	}else{
+		msgprint("Expense Claim can be approved by Approver only");
+	}
+}
+
+cur_frm.cscript.reject = function(doc,cdt,cdn){
+	if(user == doc.exp_approver){
+		var reject_voucher_dialog;
+		
+		set_reject_voucher_dialog = function() {
+			reject_voucher_dialog = new Dialog(400, 200, 'Reject Voucher');
+			reject_voucher_dialog.make_body([
+				['HTML', 'Message', '<div class = "comment">You wont be able to do any changes after rejecting this expense voucher. Are you sure, you want to reject it ?</div>'],
+				['HTML', 'Response', '<div class = "comment" id="reject_voucher_dialog_response"></div>'],
+				['HTML', 'Reject Voucher', '<div></div>']
+			]);
+			
+			var reject_voucher_btn1 = $a($i(reject_voucher_dialog.widgets['Reject Voucher']), 'button', 'button');
+			reject_voucher_btn1.innerHTML = 'Yes';
+			reject_voucher_btn1.onclick = function(){ reject_voucher_dialog.add(); }
+			
+			var reject_voucher_btn2 = $a($i(reject_voucher_dialog.widgets['Reject Voucher']), 'button', 'button');
+			reject_voucher_btn2.innerHTML = 'No';
+			$y(reject_voucher_btn2,{marginLeft:'4px'});
+			reject_voucher_btn2.onclick = function(){ reject_voucher_dialog.hide();}
+			
+			reject_voucher_dialog.onshow = function() {
+				$i('reject_voucher_dialog_response').innerHTML = '';
+			}
+			
+			reject_voucher_dialog.add = function() {
+				// sending...
+				$i('reject_voucher_dialog_response').innerHTML = 'Processing...';
+				
+				$c_obj(make_doclist(this.doc.doctype, this.doc.name),'reject_voucher','', function(r,rt){
+					if(r.message == 'Rejected'){
+						$i('reject_voucher_dialog_response').innerHTML = 'Rejected';
+						refresh_field('approval_status');
+						hide_field(['update_voucher', 'approve', 'reject', 'calculate_total_amount']);
+						reject_voucher_dialog.hide();
+			var args = {
+				type: 'Expense Claim Rejected',
+				doctype: 'Expense Claim',
+				contact_name: doc.employee_name,
+				send_to: doc.email_id
+			}
+			cur_frm.cscript.notify(doc, args);
+					}
+				});
+			}
+		}	
+		
+		if(!reject_voucher_dialog){
+			set_reject_voucher_dialog();
+		}	
+		reject_voucher_dialog.doc = doc;
+		reject_voucher_dialog.cdt = cdt;
+		reject_voucher_dialog.cdn = cdn;
+		reject_voucher_dialog.show();
+		refresh_field('expense_voucher_details');
+		doc.__unsaved = 0;
+		cur_frm.refresh_header();
+	}else{
+		msgprint("Expense Claim can be rejected by Approver only");
+	}
+}
+
+//update follow up
+//=================================================================================
+cur_frm.cscript.update_voucher = function(doc){
+
+	$c_obj(make_doclist(doc.doctype, doc.name),'update_voucher','',function(r, rt){
+		refresh_field('expense_voucher_details');
+		doc.__unsaved = 0;
+		cur_frm.refresh_header();
+	});
+}
+
+cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
+	var args = {
+		type: 'Expense Claim',
+		doctype: 'Expense Claim'
+	}
+	cur_frm.cscript.notify(doc, args);
+}
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.py b/erpnext/hr/doctype/expense_claim/expense_claim.py
new file mode 100644
index 0000000..937ada7
--- /dev/null
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.py
@@ -0,0 +1,159 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.	If not, see <http://www.gnu.org/licenses/>.
+
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self, doc, doclist=[]):
+		self.doc = doc
+		self.doclist = doclist
+
+	def get_employee_name(self):
+		emp_dtl = sql("select employee_name,company_email from `tabEmployee` where name=%s", self.doc.employee)
+		emp_nm = emp_dtl and emp_dtl[0][0] or ''
+		self.doc.employee_name = emp_nm
+		self.doc.email_id = emp_dtl and emp_dtl[0][1] or ''
+
+		return cstr(emp_nm)	
+	
+	def get_approver_lst(self):
+		approver_lst =[]
+		approver_lst1 = get_obj('Authorization Control').get_approver_name(self.doc.doctype,0,self)
+		if approver_lst1:
+			approver_lst=approver_lst1
+		else:
+			approver_lst = [x[0] for x in sql("select distinct name from `tabProfile` where enabled=1 and name!='Administrator' and name!='Guest' and docstatus!=2")]
+		return approver_lst
+
+	def set_approver(self):
+		ret={}
+		approver_lst =[]
+		emp_nm = self.get_employee_name()
+		approver_lst = self.get_approver_lst()		
+		ret = {'app_lst':"\n" + "\n".join(approver_lst), 'emp_nm':cstr(emp_nm)}
+		return ret
+
+	def update_voucher(self):
+		sql("delete from `tabExpense Claim Detail` where parent = '%s'"%self.doc.name)
+		for d in getlist(self.doclist, 'expense_voucher_details'):
+			if not d.expense_type or not d.claim_amount:
+				msgprint("Please remove the extra blank row added")
+				raise Exception
+			d.save(1)
+		if self.doc.total_sanctioned_amount:
+			set(self.doc,'total_sanctioned_amount',self.doc.total_sanctioned_amount)
+		if self.doc.remark:
+			set(self.doc, 'remark', self.doc.remark)
+	
+	def approve_voucher(self):
+		for d in getlist(self.doclist, 'expense_voucher_details'):
+			if not d.sanctioned_amount:
+				msgprint("Please add 'Sanctioned Amount' for all expenses")
+				return cstr('Incomplete')
+		
+		if not self.doc.total_sanctioned_amount:
+			msgprint("Please calculate total sanctioned amount using button 'Calculate Total Amount'")
+			return cstr('No Amount')
+		self.update_voucher()
+		
+		set(self.doc, 'approval_status', 'Approved')		
+		# on approval notification
+		#get_obj('Notification Control').notify_contact('Expense Claim Approved', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.employee_name)
+
+		return cstr('Approved')
+	
+	def reject_voucher(self):
+		
+		if self.doc.remark:
+			set(self.doc, 'remark', self.doc.remark)	 
+		set(self.doc, 'approval_status', 'Rejected')		
+
+		# on approval notification
+		#get_obj('Notification Control').notify_contact('Expense Claim Rejected', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.employee_name)
+
+		return cstr('Rejected')
+	
+	def validate_curr_exp(self):
+		for d in getlist(self.doclist, 'expense_voucher_details'):
+			if flt(d.sanctioned_amount) > 0:
+				if self.doc.approval_status == 'Draft':
+					msgprint("Sanctioned amount can be added by Approver person only for submitted Expense Claim")
+					raise Exception
+				elif self.doc.approval_status == 'Submitted' and session['user'] != self.doc.exp_approver:
+					msgprint("Sanctioned amount can be added only by expense voucher Approver")
+					raise Exception
+	
+	def validate_fiscal_year(self):
+		fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
+		ysd=fy and fy[0][0] or ""
+		yed=add_days(str(ysd),365)
+		if str(self.doc.posting_date) < str(ysd) or str(self.doc.posting_date) > str(yed):
+			msgprint("Posting Date is not within the Fiscal Year selected")
+			raise Exception
+		
+	def validate(self):
+		self.validate_curr_exp()
+		self.validate_fiscal_year()
+	
+	def on_update(self):
+		set(self.doc, 'approval_status', 'Draft')
+	
+	def validate_exp_details(self):
+		if not getlist(self.doclist, 'expense_voucher_details'):
+			msgprint("Please add expense voucher details")
+			raise Exception
+		
+		if not self.doc.total_claimed_amount:
+			msgprint("Please calculate Total Claimed Amount")
+			raise Exception
+		
+		if not self.doc.exp_approver:
+			msgprint("Please select Expense Claim approver")
+			raise Exception
+	
+	def validate_approver(self):
+		app_lst = self.get_approver_lst()
+		if self.doc.exp_approver and self.doc.exp_approver not in app_lst:
+			msgprint("Approver "+self.doc.exp_approver+" is not authorized to approve this expense voucher. Please select another approver")
+			valid_app = 'No'
+		else:
+			valid_app = 'Yes'
+		ret = {'app_lst':("\n" + "\n".join(app_lst)), 'valid_approver':valid_app}
+		return ret
+	
+	def on_submit(self):
+		self.validate_exp_details()
+		set(self.doc, 'approval_status', 'Submitted')
+	
+	def on_cancel(self):
+		set(self.doc, 'approval_status', 'Cancelled')
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.txt b/erpnext/hr/doctype/expense_claim/expense_claim.txt
new file mode 100644
index 0000000..34ed31c
--- /dev/null
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.txt
@@ -0,0 +1,390 @@
+# DocType, Expense Claim
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:56',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:45:48',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': u'1308808105',
+		'autoname': u'EXP.######',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'is_submittable': 1,
+		'module': u'HR',
+		'name': '__common__',
+		'search_fields': u'approval_status,employee,employee_name',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'subject': u'From %(employee_name)s for %(total_claimed_amount)s (claimed)',
+		'tag_fields': u'approval_status',
+		'version': 135
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Expense Claim',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Expense Claim',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1
+	},
+
+	# DocType, Expense Claim
+	{
+		'doctype': 'DocType',
+		'name': u'Expense Claim'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'All'
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'match': u'owner',
+		'permlevel': 0,
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'HR Manager',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'HR User',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'details',
+		'fieldtype': u'Section Break',
+		'label': u'Details',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'Draft',
+		'doctype': u'DocField',
+		'fieldname': u'approval_status',
+		'fieldtype': u'Select',
+		'in_filter': 1,
+		'label': u'Approval Status',
+		'no_copy': 1,
+		'oldfieldname': u'approval_status',
+		'oldfieldtype': u'Select',
+		'options': u'\nDraft\nSubmitted\nApproved \nRejected\nCancelled',
+		'permlevel': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'employee',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'From Employee',
+		'oldfieldname': u'employee',
+		'oldfieldtype': u'Link',
+		'options': u'Employee',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'employee_name',
+		'fieldtype': u'Data',
+		'in_filter': 1,
+		'label': u'Employee Name',
+		'oldfieldname': u'employee_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'search_index': 0,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
+		'in_filter': 1,
+		'label': u'Fiscal Year',
+		'oldfieldname': u'fiscal_year',
+		'oldfieldtype': u'Select',
+		'options': u'link:Fiscal Year',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Select',
+		'in_filter': 1,
+		'label': u'Company',
+		'oldfieldname': u'company',
+		'oldfieldtype': u'Link',
+		'options': u'link:Company',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'posting_date',
+		'fieldtype': u'Date',
+		'in_filter': 1,
+		'label': u'Posting Date',
+		'oldfieldname': u'posting_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'exp_approver',
+		'fieldtype': u'Select',
+		'label': u'Approver',
+		'oldfieldname': u'exp_approver',
+		'oldfieldtype': u'Select',
+		'permlevel': 0,
+		'width': u'160px'
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'remark',
+		'fieldtype': u'Small Text',
+		'label': u'Remark',
+		'no_copy': 1,
+		'oldfieldname': u'remark',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Data',
+		'label': u'Amended From',
+		'no_copy': 1,
+		'oldfieldname': u'amended_from',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'width': u'160px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
+		'label': u'Amendment Date',
+		'no_copy': 1,
+		'oldfieldname': u'amendment_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'width': u'160px'
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'doctype': u'DocField',
+		'fieldname': u'approve',
+		'fieldtype': u'Button',
+		'hidden': 1,
+		'label': u'Approve',
+		'oldfieldtype': u'Button',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'doctype': u'DocField',
+		'fieldname': u'reject',
+		'fieldtype': u'Button',
+		'hidden': 1,
+		'label': u'Reject',
+		'oldfieldtype': u'Button',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'expense_details',
+		'fieldtype': u'Section Break',
+		'label': u'Expense Details',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'calculate_total_amount',
+		'fieldtype': u'Button',
+		'label': u'Calculate Total Amount',
+		'oldfieldtype': u'Button',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'total_claimed_amount',
+		'fieldtype': u'Currency',
+		'in_filter': 0,
+		'label': u'Total Claimed Amount',
+		'no_copy': 1,
+		'oldfieldname': u'total_claimed_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'reqd': 0,
+		'width': u'160px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'total_sanctioned_amount',
+		'fieldtype': u'Currency',
+		'in_filter': 0,
+		'label': u'Total Sanctioned Amount',
+		'no_copy': 1,
+		'oldfieldname': u'total_sanctioned_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'width': u'160px'
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'doctype': u'DocField',
+		'fieldname': u'update_voucher',
+		'fieldtype': u'Button',
+		'hidden': 1,
+		'label': u'Update Voucher',
+		'oldfieldtype': u'Button',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'doctype': u'DocField',
+		'fieldname': u'expense_voucher_details',
+		'fieldtype': u'Table',
+		'label': u'Expense Claim Details',
+		'oldfieldname': u'expense_voucher_details',
+		'oldfieldtype': u'Table',
+		'options': u'Expense Claim Detail',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'email_id',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Employees Email Id',
+		'oldfieldname': u'email_id',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'print_hide': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/expense_voucher_detail/__init__.py b/erpnext/hr/doctype/expense_claim_detail/__init__.py
similarity index 100%
rename from erpnext/hr/doctype/expense_voucher_detail/__init__.py
rename to erpnext/hr/doctype/expense_claim_detail/__init__.py
diff --git a/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.txt b/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.txt
new file mode 100644
index 0000000..a11ce5c
--- /dev/null
+++ b/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.txt
@@ -0,0 +1,103 @@
+# DocType, Expense Claim Detail
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:56',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:56',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'HR',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'version': 5
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Expense Claim Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# DocType, Expense Claim Detail
+	{
+		'doctype': 'DocType',
+		'name': u'Expense Claim Detail'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'expense_date',
+		'fieldtype': u'Date',
+		'label': u'Expense Date',
+		'oldfieldname': u'expense_date',
+		'oldfieldtype': u'Date',
+		'reqd': 0,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'expense_type',
+		'fieldtype': u'Link',
+		'label': u'Expense Claim Type',
+		'oldfieldname': u'expense_type',
+		'oldfieldtype': u'Link',
+		'options': u'Expense Claim Type',
+		'reqd': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Small Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Small Text',
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'claim_amount',
+		'fieldtype': u'Currency',
+		'label': u'Claim Amount',
+		'oldfieldname': u'claim_amount',
+		'oldfieldtype': u'Currency',
+		'reqd': 1,
+		'trigger': u'Client',
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'doctype': u'DocField',
+		'fieldname': u'sanctioned_amount',
+		'fieldtype': u'Currency',
+		'label': u'Sanctioned Amount',
+		'no_copy': 1,
+		'oldfieldname': u'sanctioned_amount',
+		'oldfieldtype': u'Currency',
+		'trigger': u'Client',
+		'width': u'150px'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/expense_type/__init__.py b/erpnext/hr/doctype/expense_claim_type/__init__.py
similarity index 100%
copy from erpnext/hr/doctype/expense_type/__init__.py
copy to erpnext/hr/doctype/expense_claim_type/__init__.py
diff --git a/erpnext/hr/doctype/expense_claim_type/expense_claim_type.txt b/erpnext/hr/doctype/expense_claim_type/expense_claim_type.txt
new file mode 100644
index 0000000..a5c09c8
--- /dev/null
+++ b/erpnext/hr/doctype/expense_claim_type/expense_claim_type.txt
@@ -0,0 +1,96 @@
+# DocType, Expense Claim Type
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:55',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:55',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'field:expense_type',
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'document_type': u'Master',
+		'module': u'HR',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'version': 5
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Expense Claim Type',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# These values are common for all DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Expense Claim Type',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'write': 1
+	},
+
+	# DocType, Expense Claim Type
+	{
+		'doctype': 'DocType',
+		'name': u'Expense Claim Type'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'role': u'HR Manager'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'expense_type',
+		'fieldtype': u'Data',
+		'in_filter': 0,
+		'label': u'Expense Claim Type',
+		'oldfieldname': u'expense_type',
+		'oldfieldtype': u'Data',
+		'reqd': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Small Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Small Text',
+		'width': u'300px'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/expense_type/expense_type.js b/erpnext/hr/doctype/expense_type/expense_type.js
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/expense_type/expense_type.js
+++ /dev/null
diff --git a/erpnext/hr/doctype/expense_type/expense_type.txt b/erpnext/hr/doctype/expense_type/expense_type.txt
deleted file mode 100644
index ddf1104..0000000
--- a/erpnext/hr/doctype/expense_type/expense_type.txt
+++ /dev/null
@@ -1,101 +0,0 @@
-# DocType, Expense Type
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-09-03 16:45:08',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'harshada@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'field:expense_type',
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'HR',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'version': 5
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Expense Type',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# These values are common for all DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'Expense Type',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'permlevel': 0,
-		'read': 1,
-		'write': 1
-	},
-
-	# DocType, Expense Type
-	{
-		'doctype': 'DocType',
-		'name': 'Expense Type'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'System Manager'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'HR Manager'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'role': 'System Manager'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'expense_type',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'in_filter': 0,
-		'label': 'Expense Type',
-		'oldfieldname': 'expense_type',
-		'oldfieldtype': 'Data',
-		'reqd': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Small Text',
-		'idx': 2,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Small Text',
-		'width': '300px'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/expense_voucher/__init__.py b/erpnext/hr/doctype/expense_voucher/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/expense_voucher/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/doctype/expense_voucher/expense_voucher.js b/erpnext/hr/doctype/expense_voucher/expense_voucher.js
deleted file mode 100644
index 2e03567..0000000
--- a/erpnext/hr/doctype/expense_voucher/expense_voucher.js
+++ /dev/null
@@ -1,254 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-cur_frm.add_fetch('employee', 'company', 'company');
-
-cur_frm.cscript.onload = function(doc,cdt,cdn){
-  // 
-  if(!doc.approval_status) set_multiple(cdt,cdn,{approval_status:'Draft'});
-  if(doc.employee) cur_frm.cscript.employee(doc,cdt,cdn);
-  
-  if (doc.__islocal) {
-    if(doc.amended_from) set_multiple(cdt,cdn,{approval_status:'Draft'});
-    var val = getchildren('Expense Voucher Detail', doc.name, 'expense_voucher_details', doc.doctype);
-    for(var i = 0; i<val.length; i++){
-      val[i].sanctioned_amount ='';
-    }
-    //doc.total_claimed_amount = '';
-    doc.total_sanctioned_amount = '';
-    refresh_many(['sanctioned_amount', 'total_sanctioned_amount']);
-  }
-}
-
-cur_frm.cscript.refresh = function(doc,cdt,cdn){
-  if((user == doc.exp_approver && doc.approval_status == 'Submitted') || doc.docstatus == 0) unhide_field('Calculate Total Amount');
-  else hide_field('Calculate Total Amount');
-  
-  if(user == doc.exp_approver && doc.approval_status == 'Submitted')  unhide_field(['Update Voucher', 'Approve', 'Reject']);
-
-  else hide_field(['Update Voucher', 'Approve', 'Reject']);
-
-  
-  if(user == doc.exp_approver && doc.approval_status == 'Submitted') set_field_permlevel('remark', 0);
-  else set_field_permlevel('remark', 1);
-}
-
-cur_frm.cscript.employee = function(doc,cdt,cdn){
-  if(doc.employee){
-    $c_obj(make_doclist(doc.doctype, doc.name),'set_approver','', function(r,rt){
-      if(r.message){
-        doc.employee_name = r.message['emp_nm'];
-        get_field(doc.doctype, 'exp_approver' , doc.name).options = r.message['app_lst'];        
-        refresh_many(['exp_approver','employee_name']);
-      }    
-    });
-  }
-}
-
-cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
-  if(doc.approval_status == 'Draft'){
-    var val = getchildren('Expense Voucher Detail', doc.name, 'expense_voucher_details', doc.doctype);
-    var total_claim =0;
-    for(var i = 0; i<val.length; i++){
-      total_claim = flt(total_claim)+flt(val[i].claim_amount);
-    }
-    doc.total_claimed_amount = flt(total_claim);
-    refresh_field('total_claimed_amount');
-    
-    $c_obj(make_doclist(doc.doctype, doc.name),'validate_approver','', function(r,rt){
-      if(r.message){
-        if(r.message['valid_approver'] == 'No'){
-          doc.exp_approver ='';
-        }
-        get_field(doc.doctype, 'exp_approver' , doc.name).options = '';
-        get_field(doc.doctype, 'exp_approver' , doc.name).options = r.message['app_lst'];
-        refresh_field('exp_approver');
-      }
-    });
-  }
-  else if(doc.approval_status == 'Submitted'){
-    var val = getchildren('Expense Voucher Detail', doc.name, 'expense_voucher_details', doc.doctype);
-    var total_sanctioned = 0;
-    for(var i = 0; i<val.length; i++){
-      total_sanctioned = flt(total_sanctioned)+flt(val[i].sanctioned_amount);
-    }
-    doc.total_sanctioned_amount = flt(total_sanctioned);
-    refresh_field('total_sanctioned_amount');
-  }
-}
-
-cur_frm.cscript['Calculate Total Amount'] = function(doc,cdt,cdn){
-  cur_frm.cscript.calculate_total(doc,cdt,cdn);
-}
-cur_frm.cscript.claim_amount = function(doc,cdt,cdn){
-  cur_frm.cscript.calculate_total(doc,cdt,cdn);
-}
-cur_frm.cscript.sanctioned_amount = function(doc,cdt,cdn){
-  cur_frm.cscript.calculate_total(doc,cdt,cdn);
-}
-
-$import(Notification Control);
-
-cur_frm.cscript['Approve'] = function(doc,cdt,cdn){
-
-  if(user == doc.exp_approver){
-    var approve_voucher_dialog;
-    
-    set_approve_voucher_dialog = function() {
-      approve_voucher_dialog = new Dialog(400, 200, 'Approve Voucher');
-      approve_voucher_dialog.make_body([
-        ['HTML', 'Message', '<div class = "comment">You wont be able to do any changes after approving this expense voucher. Are you sure, you want to approve it ?</div>'],
-        ['HTML', 'Response', '<div class = "comment" id="approve_voucher_dialog_response"></div>'],
-        ['HTML', 'Approve Voucher', '<div></div>']
-      ]);
-      
-      var approve_voucher_btn1 = $a($i(approve_voucher_dialog.widgets['Approve Voucher']), 'button', 'button');
-      approve_voucher_btn1.innerHTML = 'Yes';
-      approve_voucher_btn1.onclick = function(){ approve_voucher_dialog.add(); }
-      
-      var approve_voucher_btn2 = $a($i(approve_voucher_dialog.widgets['Approve Voucher']), 'button', 'button');
-      approve_voucher_btn2.innerHTML = 'No';
-      $y(approve_voucher_btn2,{marginLeft:'4px'});
-      approve_voucher_btn2.onclick = function(){ approve_voucher_dialog.hide();}
-      
-      approve_voucher_dialog.onshow = function() {
-        $i('approve_voucher_dialog_response').innerHTML = '';
-      }
-      
-      approve_voucher_dialog.add = function() {
-        // sending...
-        $i('approve_voucher_dialog_response').innerHTML = 'Processing...';
-        
-        $c_obj(make_doclist(this.doc.doctype, this.doc.name),'approve_voucher','', function(r,rt){
-          if(r.message == 'Approved'){
-            $i('approve_voucher_dialog_response').innerHTML = 'Approved';
-            refresh_field('approval_status');
-            hide_field(['Update Voucher', 'Approve', 'Reject', 'Calculate Total Amount']);
-            approve_voucher_dialog.hide();
-			var args = {
-				type: 'Expense Voucher Approved',
-				doctype: 'Expense Voucher',
-				contact_name: doc.employee_name,
-				send_to: doc.email_id
-			}
-			cur_frm.cscript.notify(doc, args);
-          }
-          else if(r.message == 'Incomplete'){
-            $i('approve_voucher_dialog_response').innerHTML = 'Incomplete Voucher';
-          }
-          else if(r.message == 'No Amount'){
-            $i('approve_voucher_dialog_response').innerHTML = 'Calculate total amount';
-          }
-        });
-      }
-    }  
-    
-    if(!approve_voucher_dialog){
-      set_approve_voucher_dialog();
-    }  
-    approve_voucher_dialog.doc = doc;
-    approve_voucher_dialog.cdt = cdt;
-    approve_voucher_dialog.cdn = cdn;
-    approve_voucher_dialog.show();
-    refresh_field('expense_voucher_details');
-    doc.__unsaved = 0;
-    cur_frm.refresh_header();
-  }else{
-    msgprint("Expense Voucher can be approved by Approver only");
-  }
-}
-
-cur_frm.cscript['Reject'] = function(doc,cdt,cdn){
-  if(user == doc.exp_approver){
-    var reject_voucher_dialog;
-    
-    set_reject_voucher_dialog = function() {
-      reject_voucher_dialog = new Dialog(400, 200, 'Reject Voucher');
-      reject_voucher_dialog.make_body([
-        ['HTML', 'Message', '<div class = "comment">You wont be able to do any changes after rejecting this expense voucher. Are you sure, you want to reject it ?</div>'],
-        ['HTML', 'Response', '<div class = "comment" id="reject_voucher_dialog_response"></div>'],
-        ['HTML', 'Reject Voucher', '<div></div>']
-      ]);
-      
-      var reject_voucher_btn1 = $a($i(reject_voucher_dialog.widgets['Reject Voucher']), 'button', 'button');
-      reject_voucher_btn1.innerHTML = 'Yes';
-      reject_voucher_btn1.onclick = function(){ reject_voucher_dialog.add(); }
-      
-      var reject_voucher_btn2 = $a($i(reject_voucher_dialog.widgets['Reject Voucher']), 'button', 'button');
-      reject_voucher_btn2.innerHTML = 'No';
-      $y(reject_voucher_btn2,{marginLeft:'4px'});
-      reject_voucher_btn2.onclick = function(){ reject_voucher_dialog.hide();}
-      
-      reject_voucher_dialog.onshow = function() {
-        $i('reject_voucher_dialog_response').innerHTML = '';
-      }
-      
-      reject_voucher_dialog.add = function() {
-        // sending...
-        $i('reject_voucher_dialog_response').innerHTML = 'Processing...';
-        
-        $c_obj(make_doclist(this.doc.doctype, this.doc.name),'reject_voucher','', function(r,rt){
-          if(r.message == 'Rejected'){
-            $i('reject_voucher_dialog_response').innerHTML = 'Rejected';
-            refresh_field('approval_status');
-            hide_field(['Update Voucher', 'Approve', 'Reject', 'Calculate Total Amount']);
-            reject_voucher_dialog.hide();
-			var args = {
-				type: 'Expense Voucher Rejected',
-				doctype: 'Expense Voucher',
-				contact_name: doc.employee_name,
-				send_to: doc.email_id
-			}
-			cur_frm.cscript.notify(doc, args);
-          }
-        });
-      }
-    }  
-    
-    if(!reject_voucher_dialog){
-      set_reject_voucher_dialog();
-    }  
-    reject_voucher_dialog.doc = doc;
-    reject_voucher_dialog.cdt = cdt;
-    reject_voucher_dialog.cdn = cdn;
-    reject_voucher_dialog.show();
-    refresh_field('expense_voucher_details');
-    doc.__unsaved = 0;
-    cur_frm.refresh_header();
-  }else{
-    msgprint("Expense Voucher can be rejected by Approver only");
-  }
-}
-
-//update follow up
-//=================================================================================
-cur_frm.cscript['Update Voucher'] = function(doc){
-
-  $c_obj(make_doclist(doc.doctype, doc.name),'update_voucher','',function(r, rt){
-    refresh_field('expense_voucher_details');
-    doc.__unsaved = 0;
-    cur_frm.refresh_header();
-  });
-}
-
-$import(Notification Control)
-cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
-	var args = {
-		type: 'Expense Voucher',
-		doctype: 'Expense Voucher'
-	}
-	cur_frm.cscript.notify(doc, args);
-}
diff --git a/erpnext/hr/doctype/expense_voucher/expense_voucher.py b/erpnext/hr/doctype/expense_voucher/expense_voucher.py
deleted file mode 100644
index b349100..0000000
--- a/erpnext/hr/doctype/expense_voucher/expense_voucher.py
+++ /dev/null
@@ -1,159 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-	
-# -----------------------------------------------------------------------------------------
-
-
-class DocType:
-  def __init__(self, doc, doclist=[]):
-    self.doc = doc
-    self.doclist = doclist
-
-  def get_employee_name(self):
-    emp_dtl = sql("select employee_name,company_email from `tabEmployee` where name=%s", self.doc.employee)
-    emp_nm = emp_dtl and emp_dtl[0][0] or ''
-    self.doc.employee_name = emp_nm
-    self.doc.email_id = emp_dtl and emp_dtl[0][1] or ''
-
-    return cstr(emp_nm)  
-  
-  def get_approver_lst(self):
-    approver_lst =[]
-    approver_lst1 = get_obj('Authorization Control').get_approver_name(self.doc.doctype,0,self)
-    if approver_lst1:
-      approver_lst=approver_lst1
-    else:
-      approver_lst = [x[0] for x in sql("select distinct name from `tabProfile` where enabled=1 and name!='Administrator' and name!='Guest' and docstatus!=2")]
-    return approver_lst
-
-  def set_approver(self):
-    ret={}
-    approver_lst =[]
-    emp_nm = self.get_employee_name()
-    approver_lst = self.get_approver_lst()    
-    ret = {'app_lst':"\n" + "\n".join(approver_lst), 'emp_nm':cstr(emp_nm)}
-    return ret
-
-  def update_voucher(self):
-    sql("delete from `tabExpense Voucher Detail` where parent = '%s'"%self.doc.name)
-    for d in getlist(self.doclist, 'expense_voucher_details'):
-      if not d.expense_type or not d.claim_amount:
-        msgprint("Please remove the extra blank row added")
-        raise Exception
-      d.save(1)
-    if self.doc.total_sanctioned_amount:
-      set(self.doc,'total_sanctioned_amount',self.doc.total_sanctioned_amount)
-    if self.doc.remark:
-      set(self.doc, 'remark', self.doc.remark)
-  
-  def approve_voucher(self):
-    for d in getlist(self.doclist, 'expense_voucher_details'):
-      if not d.sanctioned_amount:
-        msgprint("Please add 'Sanctioned Amount' for all expenses")
-        return cstr('Incomplete')
-    
-    if not self.doc.total_sanctioned_amount:
-      msgprint("Please calculate total sanctioned amount using button 'Calculate Total Amount'")
-      return cstr('No Amount')
-    self.update_voucher()
-    
-    set(self.doc, 'approval_status', 'Approved')    
-    # on approval notification
-    #get_obj('Notification Control').notify_contact('Expense Voucher Approved', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.employee_name)
-
-    return cstr('Approved')
-  
-  def reject_voucher(self):
-    
-    if self.doc.remark:
-      set(self.doc, 'remark', self.doc.remark)   
-    set(self.doc, 'approval_status', 'Rejected')    
-
-    # on approval notification
-    #get_obj('Notification Control').notify_contact('Expense Voucher Rejected', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.employee_name)
-
-    return cstr('Rejected')
-  
-  def validate_curr_exp(self):
-    for d in getlist(self.doclist, 'expense_voucher_details'):
-      if flt(d.sanctioned_amount) > 0:
-        if self.doc.approval_status == 'Draft':
-          msgprint("Sanctioned amount can be added by Approver person only for submitted Expense Voucher")
-          raise Exception
-        elif self.doc.approval_status == 'Submitted' and session['user'] != self.doc.exp_approver:
-          msgprint("Sanctioned amount can be added only by expense voucher Approver")
-          raise Exception
-  
-  def validate_fiscal_year(self):
-    fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
-    ysd=fy and fy[0][0] or ""
-    yed=add_days(str(ysd),365)
-    if str(self.doc.posting_date) < str(ysd) or str(self.doc.posting_date) > str(yed):
-      msgprint("Posting Date is not within the Fiscal Year selected")
-      raise Exception
-    
-  def validate(self):
-    self.validate_curr_exp()
-    self.validate_fiscal_year()
-  
-  def on_update(self):
-    set(self.doc, 'approval_status', 'Draft')
-  
-  def validate_exp_details(self):
-    if not getlist(self.doclist, 'expense_voucher_details'):
-      msgprint("Please add expense voucher details")
-      raise Exception
-    
-    if not self.doc.total_claimed_amount:
-      msgprint("Please calculate Total Claimed Amount")
-      raise Exception
-    
-    if not self.doc.exp_approver:
-      msgprint("Please select Expense Voucher approver")
-      raise Exception
-  
-  def validate_approver(self):
-    app_lst = self.get_approver_lst()
-    if self.doc.exp_approver and self.doc.exp_approver not in app_lst:
-      msgprint("Approver "+self.doc.exp_approver+" is not authorized to approve this expense voucher. Please select another approver")
-      valid_app = 'No'
-    else:
-      valid_app = 'Yes'
-    ret = {'app_lst':("\n" + "\n".join(app_lst)), 'valid_approver':valid_app}
-    return ret
-  
-  def on_submit(self):
-    self.validate_exp_details()
-    set(self.doc, 'approval_status', 'Submitted')
-  
-  def on_cancel(self):
-    set(self.doc, 'approval_status', 'Cancelled')
diff --git a/erpnext/hr/doctype/expense_voucher/expense_voucher.txt b/erpnext/hr/doctype/expense_voucher/expense_voucher.txt
deleted file mode 100644
index ccc4cb4..0000000
--- a/erpnext/hr/doctype/expense_voucher/expense_voucher.txt
+++ /dev/null
@@ -1,383 +0,0 @@
-# DocType, Expense Voucher
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-09-03 16:45:08',
-		'docstatus': 0,
-		'modified': '2012-03-21 14:37:04',
-		'modified_by': u'Administrator',
-		'owner': u'harshada@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': u'1308808105',
-		'autoname': u'EXP.######',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'module': u'HR',
-		'name': '__common__',
-		'search_fields': u'approval_status,employee,employee_name',
-		'section_style': u'Simple',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'subject': u'From %(employee_name)s for %(total_claimed_amount)s (claimed)',
-		'tag_fields': u'approval_status',
-		'version': 135
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Expense Voucher',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': u'DocPerm',
-		'name': '__common__',
-		'parent': u'Expense Voucher',
-		'parentfield': u'permissions',
-		'parenttype': u'DocType',
-		'read': 1
-	},
-
-	# DocType, Expense Voucher
-	{
-		'doctype': 'DocType',
-		'name': u'Expense Voucher'
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'match': u'owner',
-		'permlevel': 0,
-		'role': u'Employee',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'HR Manager',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'HR User',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'All'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Details',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'Draft',
-		'doctype': u'DocField',
-		'fieldname': u'approval_status',
-		'fieldtype': u'Select',
-		'in_filter': 1,
-		'label': u'Approval Status',
-		'no_copy': 1,
-		'oldfieldname': u'approval_status',
-		'oldfieldtype': u'Select',
-		'options': u'\nDraft\nSubmitted\nApproved \nRejected\nCancelled',
-		'permlevel': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'employee',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'From Employee',
-		'oldfieldname': u'employee',
-		'oldfieldtype': u'Link',
-		'options': u'Employee',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'employee_name',
-		'fieldtype': u'Data',
-		'in_filter': 1,
-		'label': u'Employee Name',
-		'oldfieldname': u'employee_name',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'search_index': 0,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'fiscal_year',
-		'fieldtype': u'Select',
-		'in_filter': 1,
-		'label': u'Fiscal Year',
-		'oldfieldname': u'fiscal_year',
-		'oldfieldtype': u'Select',
-		'options': u'link:Fiscal Year',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'company',
-		'fieldtype': u'Select',
-		'in_filter': 1,
-		'label': u'Company',
-		'oldfieldname': u'company',
-		'oldfieldtype': u'Link',
-		'options': u'link:Company',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'posting_date',
-		'fieldtype': u'Date',
-		'in_filter': 1,
-		'label': u'Posting Date',
-		'oldfieldname': u'posting_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'exp_approver',
-		'fieldtype': u'Select',
-		'label': u'Approver',
-		'oldfieldname': u'exp_approver',
-		'oldfieldtype': u'Select',
-		'permlevel': 0,
-		'width': u'160px'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'remark',
-		'fieldtype': u'Small Text',
-		'label': u'Remark',
-		'no_copy': 1,
-		'oldfieldname': u'remark',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'amended_from',
-		'fieldtype': u'Data',
-		'label': u'Amended From',
-		'no_copy': 1,
-		'oldfieldname': u'amended_from',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'report_hide': 1,
-		'width': u'160px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'amendment_date',
-		'fieldtype': u'Date',
-		'label': u'Amendment Date',
-		'no_copy': 1,
-		'oldfieldname': u'amendment_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 1,
-		'print_hide': 1,
-		'report_hide': 1,
-		'width': u'160px'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'hidden': 1,
-		'label': u'Approve',
-		'oldfieldtype': u'Button',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'hidden': 1,
-		'label': u'Reject',
-		'oldfieldtype': u'Button',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Expense Details',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Calculate Total Amount',
-		'oldfieldtype': u'Button',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'total_claimed_amount',
-		'fieldtype': u'Currency',
-		'in_filter': 0,
-		'label': u'Total Claimed Amount',
-		'no_copy': 1,
-		'oldfieldname': u'total_claimed_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'reqd': 0,
-		'width': u'160px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'total_sanctioned_amount',
-		'fieldtype': u'Currency',
-		'in_filter': 0,
-		'label': u'Total Sanctioned Amount',
-		'no_copy': 1,
-		'oldfieldname': u'total_sanctioned_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'width': u'160px'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'hidden': 1,
-		'label': u'Update Voucher',
-		'oldfieldtype': u'Button',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'expense_voucher_details',
-		'fieldtype': u'Table',
-		'label': u'Expense Voucher Details',
-		'oldfieldname': u'expense_voucher_details',
-		'oldfieldtype': u'Table',
-		'options': u'Expense Voucher Detail',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'email_id',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'label': u'Employees Email Id',
-		'oldfieldname': u'email_id',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'print_hide': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/expense_voucher_detail/expense_voucher_detail.txt b/erpnext/hr/doctype/expense_voucher_detail/expense_voucher_detail.txt
deleted file mode 100644
index d6cb015..0000000
--- a/erpnext/hr/doctype/expense_voucher_detail/expense_voucher_detail.txt
+++ /dev/null
@@ -1,108 +0,0 @@
-# DocType, Expense Voucher Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-09-03 16:45:08',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'harshada@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'HR',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'version': 5
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Expense Voucher Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, Expense Voucher Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Expense Voucher Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'expense_date',
-		'fieldtype': 'Date',
-		'idx': 1,
-		'label': 'Expense Date',
-		'oldfieldname': 'expense_date',
-		'oldfieldtype': 'Date',
-		'reqd': 0,
-		'width': '150px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'expense_type',
-		'fieldtype': 'Link',
-		'idx': 2,
-		'label': 'Expense Type',
-		'oldfieldname': 'expense_type',
-		'oldfieldtype': 'Link',
-		'options': 'Expense Type',
-		'reqd': 1,
-		'width': '150px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Small Text',
-		'idx': 3,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Small Text',
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'claim_amount',
-		'fieldtype': 'Currency',
-		'idx': 4,
-		'label': 'Claim Amount',
-		'oldfieldname': 'claim_amount',
-		'oldfieldtype': 'Currency',
-		'reqd': 1,
-		'trigger': 'Client',
-		'width': '150px'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': 'DocField',
-		'fieldname': 'sanctioned_amount',
-		'fieldtype': 'Currency',
-		'idx': 5,
-		'label': 'Sanctioned Amount',
-		'no_copy': 1,
-		'oldfieldname': 'sanctioned_amount',
-		'oldfieldtype': 'Currency',
-		'trigger': 'Client',
-		'width': '150px'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/experience_in_company_detail/__init__.py b/erpnext/hr/doctype/experience_in_company_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/experience_in_company_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/doctype/experience_in_company_detail/experience_in_company_detail.txt b/erpnext/hr/doctype/experience_in_company_detail/experience_in_company_detail.txt
deleted file mode 100644
index c1b826b..0000000
--- a/erpnext/hr/doctype/experience_in_company_detail/experience_in_company_detail.txt
+++ /dev/null
@@ -1,110 +0,0 @@
-# DocType, Experience In Company Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:01',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'HR',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'show_in_menu': 0,
-		'version': 6
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Experience In Company Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, Experience In Company Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Experience In Company Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'branch',
-		'fieldtype': 'Select',
-		'idx': 1,
-		'label': 'Branch',
-		'oldfieldname': 'branch',
-		'oldfieldtype': 'Select',
-		'options': 'link:Branch'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'department',
-		'fieldtype': 'Select',
-		'idx': 2,
-		'label': 'Department',
-		'oldfieldname': 'department',
-		'oldfieldtype': 'Select',
-		'options': 'link:Department'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'designation',
-		'fieldtype': 'Select',
-		'idx': 3,
-		'label': 'Designation',
-		'oldfieldname': 'designation',
-		'oldfieldtype': 'Select',
-		'options': 'link:Designation'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'grade',
-		'fieldtype': 'Select',
-		'idx': 4,
-		'label': 'Grade',
-		'oldfieldname': 'grade',
-		'oldfieldtype': 'Select',
-		'options': 'link:Grade'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'from_date',
-		'fieldtype': 'Date',
-		'idx': 5,
-		'label': 'From Date',
-		'oldfieldname': 'from_date',
-		'oldfieldtype': 'Date'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'to_date',
-		'fieldtype': 'Date',
-		'idx': 6,
-		'label': 'To Date',
-		'oldfieldname': 'to_date',
-		'oldfieldtype': 'Date'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/grade/grade.js b/erpnext/hr/doctype/grade/grade.js
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/grade/grade.js
+++ /dev/null
diff --git a/erpnext/hr/doctype/grade/grade.txt b/erpnext/hr/doctype/grade/grade.txt
index afa74ad..2e14d9d 100644
--- a/erpnext/hr/doctype/grade/grade.txt
+++ b/erpnext/hr/doctype/grade/grade.txt
@@ -3,46 +3,46 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:03',
+		'creation': '2012-03-27 14:35:57',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:57',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
 		'allow_trash': 1,
-		'autoname': 'field:grade_name',
-		'colour': 'White:FFF',
+		'autoname': u'field:grade_name',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'HR',
+		'document_type': u'Master',
+		'module': u'HR',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 7
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Grade',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Grade',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Grade',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Grade',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
 		'write': 1
@@ -51,52 +51,47 @@
 	# DocType, Grade
 	{
 		'doctype': 'DocType',
-		'name': 'Grade'
+		'name': u'Grade'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'System Manager'
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'HR User',
+		'doctype': u'DocPerm',
+		'role': u'HR User',
 		'submit': 0
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'role': 'HR Manager'
+		'doctype': u'DocPerm',
+		'role': u'HR Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'grade_name',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Grade',
-		'oldfieldname': 'grade_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'grade_name',
+		'fieldtype': u'Data',
+		'label': u'Grade',
+		'oldfieldname': u'grade_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	}
diff --git a/erpnext/hr/doctype/holiday_list_detail/__init__.py b/erpnext/hr/doctype/holiday/__init__.py
similarity index 100%
rename from erpnext/hr/doctype/holiday_list_detail/__init__.py
rename to erpnext/hr/doctype/holiday/__init__.py
diff --git a/erpnext/hr/doctype/holiday/holiday.txt b/erpnext/hr/doctype/holiday/holiday.txt
new file mode 100644
index 0000000..bfcc7b3
--- /dev/null
+++ b/erpnext/hr/doctype/holiday/holiday.txt
@@ -0,0 +1,61 @@
+# DocType, Holiday
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:57',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:57',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'HR',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 2
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Holiday',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# DocType, Holiday
+	{
+		'doctype': 'DocType',
+		'name': u'Holiday'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Small Text',
+		'label': u'Description',
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'holiday_date',
+		'fieldtype': u'Date',
+		'label': u'Date',
+		'oldfieldname': u'holiday_date',
+		'oldfieldtype': u'Date'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/holiday_list/holiday_list.js b/erpnext/hr/doctype/holiday_list/holiday_list.js
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/holiday_list/holiday_list.js
+++ /dev/null
diff --git a/erpnext/hr/doctype/holiday_list/holiday_list.py b/erpnext/hr/doctype/holiday_list/holiday_list.py
index 2f73159..dd31559 100644
--- a/erpnext/hr/doctype/holiday_list/holiday_list.py
+++ b/erpnext/hr/doctype/holiday_list/holiday_list.py
@@ -105,7 +105,7 @@
     yr_start_date, yr_end_date = self.get_fy_start_end_dates()
     date_list = self.get_weekly_off_date_list(yr_start_date, yr_end_date)
     for d in date_list:
-      ch = addchild(self.doc, 'holiday_list_details', 'Holiday List Detail', 1, self.doclist)
+      ch = addchild(self.doc, 'holiday_list_details', 'Holiday', 1, self.doclist)
       ch.description = self.doc.weekly_off
       ch.holiday_date = d
 
diff --git a/erpnext/hr/doctype/holiday_list/holiday_list.txt b/erpnext/hr/doctype/holiday_list/holiday_list.txt
index f9407e3..ce0e49f 100644
--- a/erpnext/hr/doctype/holiday_list/holiday_list.txt
+++ b/erpnext/hr/doctype/holiday_list/holiday_list.txt
@@ -3,129 +3,116 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:03',
+		'creation': '2012-03-27 14:35:57',
 		'docstatus': 0,
-		'modified': '2011-02-12 13:37:12',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:57',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
 		'allow_trash': 1,
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'HR',
+		'document_type': u'Master',
+		'module': u'HR',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 17
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Holiday List',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Holiday List',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Holiday List',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Holiday List',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'permlevel': 0,
 		'read': 1,
-		'role': 'HR Manager'
+		'role': u'HR Manager',
+		'write': 1
 	},
 
 	# DocType, Holiday List
 	{
 		'doctype': 'DocType',
-		'name': 'Holiday List'
+		'name': u'Holiday List'
 	},
 
 	# DocPerm
 	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'permlevel': 0,
-		'write': 1
+		'doctype': u'DocPerm'
 	},
 
-	# DocPerm
+	# DocField
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'holiday_list_name',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Holiday List Name',
-		'oldfieldname': 'holiday_list_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'holiday_list_name',
+		'fieldtype': u'Data',
+		'label': u'Holiday List Name',
+		'oldfieldname': u'holiday_list_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'is_default',
-		'fieldtype': 'Check',
-		'idx': 3,
-		'label': 'Default',
+		'doctype': u'DocField',
+		'fieldname': u'is_default',
+		'fieldtype': u'Check',
+		'label': u'Default',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Select',
-		'idx': 4,
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Fiscal Year',
-		'oldfieldname': 'fiscal_year',
-		'oldfieldtype': 'Link',
-		'options': 'link:Fiscal Year',
+		'label': u'Fiscal Year',
+		'oldfieldname': u'fiscal_year',
+		'oldfieldtype': u'Link',
+		'options': u'link:Fiscal Year',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'weekly_off',
-		'fieldtype': 'Select',
-		'idx': 5,
-		'label': 'Weekly Off',
+		'doctype': u'DocField',
+		'fieldname': u'weekly_off',
+		'fieldtype': u'Select',
+		'label': u'Weekly Off',
 		'no_copy': 1,
-		'options': '\nSunday\nMonday\nTuesday\nWednesday\nThursday\nFriday\nSaturday',
+		'options': u'\nSunday\nMonday\nTuesday\nWednesday\nThursday\nFriday\nSaturday',
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 1
@@ -133,35 +120,34 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 6,
-		'label': 'Get Weekly Off Dates',
-		'options': 'get_weekly_off_dates',
+		'doctype': u'DocField',
+		'fieldname': u'get_weekly_off_dates',
+		'fieldtype': u'Button',
+		'label': u'Get Weekly Off Dates',
+		'options': u'get_weekly_off_dates',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'holiday_list_details',
-		'fieldtype': 'Table',
-		'idx': 7,
-		'label': 'Holiday List Details',
-		'oldfieldname': 'holiday_list_details',
-		'oldfieldtype': 'Table',
-		'options': 'Holiday List Detail',
+		'doctype': u'DocField',
+		'fieldname': u'holiday_list_details',
+		'fieldtype': u'Table',
+		'label': u'Holidays',
+		'oldfieldname': u'holiday_list_details',
+		'oldfieldtype': u'Table',
+		'options': u'Holiday',
 		'permlevel': 0,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 8,
-		'label': 'Clear Table',
-		'options': 'clear_table',
+		'doctype': u'DocField',
+		'fieldname': u'clear_table',
+		'fieldtype': u'Button',
+		'label': u'Clear Table',
+		'options': u'clear_table',
 		'permlevel': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/holiday_list_detail/holiday_list_detail.txt b/erpnext/hr/doctype/holiday_list_detail/holiday_list_detail.txt
deleted file mode 100644
index cc7ba94..0000000
--- a/erpnext/hr/doctype/holiday_list_detail/holiday_list_detail.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-# DocType, Holiday List Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:03',
-		'docstatus': 0,
-		'modified': '2012-03-21 14:36:29',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': u'HR',
-		'name': '__common__',
-		'section_style': u'Simple',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 2
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Holiday List Detail',
-		'parentfield': u'fields',
-		'parenttype': u'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, Holiday List Detail
-	{
-		'doctype': 'DocType',
-		'name': u'Holiday List Detail'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'description',
-		'fieldtype': u'Small Text',
-		'label': u'Description',
-		'width': u'300px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'holiday_date',
-		'fieldtype': u'Date',
-		'label': u'Date',
-		'oldfieldname': u'holiday_date',
-		'oldfieldtype': u'Date'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/invest_80_declaration_detail/__init__.py b/erpnext/hr/doctype/invest_80_declaration_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/invest_80_declaration_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/doctype/invest_80_declaration_detail/invest_80_declaration_detail.txt b/erpnext/hr/doctype/invest_80_declaration_detail/invest_80_declaration_detail.txt
deleted file mode 100644
index 841b21e..0000000
--- a/erpnext/hr/doctype/invest_80_declaration_detail/invest_80_declaration_detail.txt
+++ /dev/null
@@ -1,143 +0,0 @@
-# DocType, Invest 80 Declaration Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:05',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'HR',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 10
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Invest 80 Declaration Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'Invest 80 Declaration Detail',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1,
-		'role': 'System Manager'
-	},
-
-	# DocType, Invest 80 Declaration Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Invest 80 Declaration Detail'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'permlevel': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'particulars4',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Particulars',
-		'oldfieldname': 'particulars4',
-		'oldfieldtype': 'Small Text',
-		'permlevel': 1,
-		'reqd': 1,
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'under_section4',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Under Section',
-		'oldfieldname': 'under_section4',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'max_limit4',
-		'fieldtype': 'Currency',
-		'idx': 3,
-		'label': 'Max. Limit',
-		'oldfieldname': 'max_limit4',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'actual_amount4',
-		'fieldtype': 'Currency',
-		'idx': 4,
-		'label': 'Actual Amount',
-		'oldfieldname': 'actual_amount4',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'eligible_amount4',
-		'fieldtype': 'Currency',
-		'idx': 5,
-		'label': 'Eligible Amount',
-		'oldfieldname': 'eligible_amount4',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'modified_amount4',
-		'fieldtype': 'Currency',
-		'idx': 6,
-		'label': 'Modified Amount',
-		'oldfieldname': 'modified_amount4',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/it_checklist/__init__.py b/erpnext/hr/doctype/it_checklist/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/it_checklist/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/doctype/it_checklist/it_checklist.js b/erpnext/hr/doctype/it_checklist/it_checklist.js
deleted file mode 100644
index a97ae65..0000000
--- a/erpnext/hr/doctype/it_checklist/it_checklist.js
+++ /dev/null
@@ -1,177 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-cur_frm.cscript.onload=function(doc,cdt,cdn){
-
-  if(doc.employee && doc.__islocal ==1){
-    cur_frm.cscript.employee(doc,cdt,cdn);
-  }
-  if(doc.rent_acc == "Yes") unhide_field('ann_rent');
-}
-
-// when user select an employee corresponding basic, gross income and pf is set.
-cur_frm.cscript.employee = function(doc,cdt,cdn){
-  var mydoc=doc;
-  $c('runserverobj', args={'method':'set_values','docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
-      function(r, rt) {
-        var doc = locals[mydoc.doctype][mydoc.name];
-       
-        if(r.message){
-        doc.hra_count = r.message;
-        refresh_field('hra_count')
-        }
-        refresh_many(['employee','employee_name','basic','gross_income','pf']);
-        
-      }
-    );
-}
-
-cur_frm.fields_dict['employee'].get_query = function(doc,dt,dn) {
-   return 'SELECT tabEmployee.name FROM tabEmployee WHERE tabEmployee.status = "Active" AND tabEmployee.docstatus !=2 AND tabEmployee.name LIKE "%s" ORDER BY tabEmployee.name DESC LIMIT 50'
-}
-
-//---------------------------------------------------------
-//if rent accomodation is yes then unhide annual rent paid else unhide.
-cur_frm.cscript.rent_acc = function(doc,cdt,cdn){
-  doc.ann_rent = 0
-  if(doc.rent_acc == 'Yes')
-    unhide_field('ann_rent');
-  else
-    hide_field('ann_rent');
-  refresh_field('ann_rent');
-}
-
-//---------------------------------------------------------
-//On done button click check for all values filled or not, and accordingly add records in child tables
-
-cur_frm.cscript['Done']=function(doc,cdt,cdn){
-  var mydoc=doc;
-
-  if(doc.employee && doc.fiscal_year && doc.metro && doc.sr_citizen && doc.part_sr_citizen && doc.basic && doc.gross_income){
-    if((doc.rent_acc == "Yes" && doc.ann_rent) || (doc.rent_acc == "No")){
-        
-        $c('runserverobj', args={'method':'set_tables', 'arg': doc.hra_count, 'docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
-        function(r, rt) {
-          var doc = locals[mydoc.doctype][mydoc.name];
-          refresh_many(['edu_cess','tax_tot_income','net_tot_tax_income','tax_per_month','applicable_from','rem_months']);
-          refresh_many(['exe_declaration_details','oth_inc_decl_details','chap_via_decl_details','invest_80_decl_details']);
-          }
-        );
-      
-    }
-    
-    else if(doc.rent_acc == "Yes" && !doc.ann_rent)
-      alert("Please enter annual rent");
-  }
-  else
-    alert("please fill up all data");
-}
-
-
-//---------------------------------------------------------
-//change event of actual amount1 field (exemption declaration detail table) : check for values of actual amount & maximum limit, and accordingly do actions.
-cur_frm.cscript.actual_amount1= function(doc,cdt,cdn){
-  
-  var cl = getchildren('Declaration Detail', doc.name, 'exe_declaration_details');
-  for(var c=0; c<cl.length; c++) {
-    if(cl[c].name == cdn){
-      if(((flt(cl[c].actual_amount1) <= flt(cl[c].max_limit1)) || (flt(cl[c].actual_amount1) == 0)) || ((cl[c].particulars1 != 'House Rent Allowance') && (flt(cl[c].max_limit1) == 0.00)) || ((cl[c].particulars1 == 'House Rent Allowance') && (flt(cl[c].max_limit1) != 0.00) && (flt(cl[c].actual_amount1) <= flt(cl[c].max_limit1)))){
-        cl[c].eligible_amount1 =cl[c].actual_amount1
-        cl[c].modified_amount1 =cl[c].actual_amount1
-      } 
-      else {
-        
-        cl[c].eligible_amount1 =cl[c].max_limit1
-        cl[c].modified_amount1 =cl[c].max_limit1
-      } 
-     
-      refresh_field('exe_declaration_details'); 
-    }
-  }
- 
-}
-
-
-
-//---------------------------------------------------------
-////change event of actual amount2 field (Other Income declaration detail table) : check for values of actual amount & maximum limit, and accordingly do actions.
-cur_frm.cscript.actual_amount2= function(doc,cdt,cdn){
-  var cl = getchildren('Other Income Detail', doc.name, 'oth_inc_decl_details');
-  for(var c=0; c<cl.length; c++) {
-    if(cl[c].name == cdn){
-      if((flt(cl[c].actual_amount2) <= flt(cl[c].max_limit2)) || flt((cl[c].actual_amount2) ==0) || !(cl[c].max_limit2)){
-        cl[c].eligible_amount2 =cl[c].actual_amount2
-        cl[c].modified_amount2 =cl[c].actual_amount2
-          
-      } 
-      else {
-        cl[c].eligible_amount2 =cl[c].max_limit2
-        cl[c].modified_amount2 =cl[c].max_limit2
-      } 
-    
-    
-      refresh_field('oth_inc_decl_details');
-    }
-  }
-}
-
-//---------------------------------------------------------
-//change event of actual amount3 field (Chapter VI A declaration detail table) : check for values of actual amount & maximum limit, and accordingly do actions.
-cur_frm.cscript.actual_amount3= function(doc,cdt,cdn){
-  
-
-  var cl = getchildren('Chapter VI A Detail', doc.name, 'chap_via_decl_details');
-  for(var c=0; c<cl.length; c++) {
-    if(cl[c].name == cdn){
-      if((flt(cl[c].actual_amount3) <= flt(cl[c].max_limit3)) || flt((cl[c].actual_amount3) ==0) || !(cl[c].max_limit3)){
-        cl[c].eligible_amount3 =cl[c].actual_amount3
-        cl[c].modified_amount3 =cl[c].actual_amount3
-          
-      } 
-      else {
-        cl[c].eligible_amount3 =cl[c].max_limit3
-        cl[c].modified_amount3 =cl[c].max_limit3
-      } 
-    
-      refresh_field('chap_via_decl_details');
-    }
-  }
-}
-
-//---------------------------------------------------------
-//change event of actual amount4 field (Invest 80 declaration detail table) : check for values of actual amount & maximum limit, and accordingly do actions.
-cur_frm.cscript.actual_amount4= function(doc,cdt,cdn){
-  
-  var cl = getchildren('Invest 80 Declaration Detail', doc.name, 'invest_80_decl_details');
-  for(var c=0; c<cl.length; c++) {
-    if(cl[c].name == cdn){
-      if((flt(cl[c].actual_amount4) <= flt(cl[c].max_limit4)) || flt((cl[c].actual_amount4) ==0) || !(cl[c].max_limit4)){
-        cl[c].eligible_amount4 =cl[c].actual_amount4
-        cl[c].modified_amount4 =cl[c].actual_amount4
-          
-      } 
-      else {
-        cl[c].eligible_amount4 =cl[c].max_limit4
-        cl[c].modified_amount4 =cl[c].max_limit4
-      } 
-   
-      refresh_field('invest_80_decl_details');
-    }
-  }  
-}
-cur_frm.cscript.refresh=function(doc,cdt,cdn){
-
-}
diff --git a/erpnext/hr/doctype/it_checklist/it_checklist.py b/erpnext/hr/doctype/it_checklist/it_checklist.py
deleted file mode 100644
index 4ddfc0a..0000000
--- a/erpnext/hr/doctype/it_checklist/it_checklist.py
+++ /dev/null
@@ -1,429 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-	
-# -----------------------------------------------------------------------------------------
-
-
-class DocType:
-  #init function
-  def __init__(self,doc,doclist=[]):
-    self.doc = doc
-    self.doclist = doclist  
-  
-  def autoname(self):
-    self.doc.name = make_autoname('IT Check/' +self.doc.employee + '/.#####')
-    
-  #===========================================================
-  #check for already exist IT Checklist for resp. Employee
-  def exist_IT_Check(self):
-    
-    #query for return already exist IT Checklist for respective employee
-    exist_ret = sql("select name from `tabIT Checklist` where is_cheklist_active = 'Yes' and employee = '%s' and name!='%s'"%(self.doc.employee,self.doc.name))
-    
-    # validation - if exist then raise exception 
-    if exist_ret:
-      msgprint("Active IT Checklist '%s' for employee '%s' exist."%(exist_ret[0][0],self.doc.employee))
-      self.doc.employee = ""
-      self.doc.basic = 0
-      self.doc.gross_income = 0
-      self.doc.pf = 0
-      return 0
-    else:
-      flag = self.exist_sal_struct() #check for slaray structure exist or not, if exist then further action can be done.
-      return flag
-      
-  #===========================================================
-  #check for salary structure exist or not, if exist then further action can be done.
-  def exist_sal_struct(self):
-    #query return salary structure for particular employee exist or not
-    exist_salstr=sql("select name from `tabSalary Structure` where employee = '%s' and is_active='Yes'"%self.doc.employee)
-    if not exist_salstr:
-      msgprint("Please first create salary structure for employee '%s'"%self.doc.employee)
-      self.doc.employee = ''
-      return 0
-    else:
-      return 1
-    
-  #===========================================================
-  #get previous salary slip gross income and basic amount
-  def get_info(self):
-    ret_sal_slip = sql("select count(name), sum(gross_pay) from `tabSalary Slip` where docstatus =1 and fiscal_year = '%s' and employee = '%s'"%(self.doc.fiscal_year,self.doc.employee))
-    
-    sum_basic = sum_pf = 0
-    
-    if ret_sal_slip:
-      #get name of salary slip of resp. employee 
-      ret_name =convert_to_lists(sql("select name from `tabSalary Slip` where docstatus =1 and fiscal_year = '%s' and employee = '%s' "%(self.doc.fiscal_year,self.doc.employee)))
-      
-      if ret_name:
-        for b in ret_name:
-          #get earning amount of basic 
-          ret_basic = sql("select e_amount from `tabSS Earning Detail` where parent = '%s' and e_type = 'Basic'"%(b[0]))
-          sum_basic += ret_basic[0][0] or 0  
-          
-          #get deduction amount of Provident Fund
-          ret_pf = sql("select d_amount from `tabSS Deduction Detail` where parent = '%s' and d_type = 'Provident Fund'"%(b[0]))
-          
-          sum_pf += ret_pf[0][0] or 0
-                  
-    ret_list = [ret_sal_slip[0][0] or 0,ret_sal_slip[0][1] or 0, sum_basic, sum_pf]
-    return ret_list  
-  
-  #-------------------------------------------
-  def get_basic_gross(self,ret_list0,ret_list1,ret_list2):
-   
-    self.doc.basic = self.doc.gross_income = 0
-    #query return list of earning types and resp. modified amount
-    ret = convert_to_lists(sql("select e.e_type, e.modified_value from `tabEarning Detail` e , `tabSalary Structure` s where s.is_active = 'Yes' and s.employee='%s' and e.parent = s.name" %(self.doc.employee)))
-    hra_count=1
-    if ret:
-      count = 0.0
-      for i in ret:
-        if i[0] == 'Basic':
-          if i[1] == 0:  
-            msgprint("Basic is zero in salary structure")
-
-          self.doc.basic = flt(i[1])*(12-int(ret_list0)) + flt(ret_list2)
-        count += flt(i[1])
-        if i[0] =='House Rent Allowance':
-          hra_count = flt(i[1])
-      if count == 0:
-        msgprint("Gross Income is zero in salary structure")    
-
-     
-      self.doc.gross_income = count*(12-int(ret_list0)) + flt(ret_list1)
-
-    if hra_count == 0 or hra_count == "":
-      hra_count=1
-          
-    return hra_count
-    
-  #-------------------------------------------
-  def get_pf(self,ret_list0,ret_list3):
-    self.doc.pf = 0.0    
-              
-    #query returns amount 
-    ret_ded = sql("select d.d_modified_amt from `tabDeduction Detail` d , `tabSalary Structure` s where s.is_active = 'Yes' and s.employee='%s' and d.parent = s.name and d.d_type = 'Provident Fund'" %(self.doc.employee))
-    
-    if not ret_ded:
-      msgprint("PF Amount in Salary Structure is zero")
-    
-    ret_ded = flt(ret_ded[0][0]) or 0
-        
-    #annual pf = salary structure * (12 - remaining month to complete fiscal year)- previous salary slip's total pf for current fiscal year
-    self.doc.pf = (ret_ded*(12 - int(ret_list0)))+flt(ret_list3)  
-    
-    
-  #-------------------------------------------
-  def set_values(self):
-    hra_count=1
-    if not self.doc.fiscal_year:
-      msgprint("Please select Fiscal Year")
-      self.doc.employee = ''
-    
-    elif self.doc.employee:
-      
-      flag = self.exist_IT_Check()   #check for already exist IT Checklist for resp. Employee
-    
-      if flag == 1:
-     
-        ename = sql("select employee_name from `tabEmployee` where name = '%s'"%self.doc.employee)[0][0]
-        set(self.doc,'employee_name',cstr(ename))
-        #call get_info to get values of salary slip's total basic, pf and gross income amount
-        ret_list = self.get_info()
-
-        self.get_pf(ret_list[0],ret_list[3])
-      
-        hra_count = self.get_basic_gross(ret_list[0],ret_list[1],ret_list[2])        
-  
-    return hra_count
-  
-  #===========================================================  
-  #-------------------------------------------
-  def set_tables(self, hra_count):        #set tables values
-    
-    self.set_exemption_table(hra_count)
-    self.set_other_income_table()
-    self.set_deduction_via_table()
-    self.set_invest_80c_table()
-    self.doc.edu_cess = self.doc.tax_tot_income = self.doc.net_tot_tax_income = self.doc.tax_per_month = 0
-    self.doc.applicable_from = self.doc.rem_months=''
-    msgprint("Successful")
-    return ''
-  
-  #-------------------------------------------
-  def get_month_diff(self):
-    #end_month = get_defaults()['end_month']
-      
-    month_dict = {"January" :'01', "February" :'02',"March" :'03',"April":'04',"May":'05',"June":'06',"July":'07',"August":'08',"September":'09',"October":'10',"November":'11',"December":'12'}
-    
-    import datetime
-
-    start_month =  getdate(get_defaults()['year_start_date']).month
-    end_month = cint(start_month) - 1
-    if end_month <= 0:
-      end_month = 12
-    str_end_month = cstr(end_month)
-    
-    if len(str_end_month)==1:
-      str_end_month = '0'+str_end_month
-    
-    
-    to_month = datetime.date.today().strftime("%B")
-    to_year = datetime.date.today().strftime("%Y")
-    
-    fiscal_year = self.doc.fiscal_year
-    
-    str_fy =fiscal_year.split("-")
-    
-    endym=int(str_fy[1]+str_end_month)
-    startym= int(to_year+month_dict[to_month])
-
-    month_diff =sql("SELECT PERIOD_DIFF(%d,%d);" %(endym,startym))[0][0]+1
-    
-    return month_diff
-  
-  
- 
-  #------------------------------------------- 
-  def set_exemption_values(self,ann_hra):
-    ret = convert_to_lists(sql("select name, exemption_limit from `tabEarning Type` where taxable = 'No' and docstatus !=2"))
-    
-    if ret:
-      for r in ret:
-
-        ch = addchild(self.doc,'exe_declaration_details','Declaration Detail',0, self.doclist)
-        ch.particulars1 = r[0]
-        ch.under_section1 = "U/Sec 10 & 17"
-        
-        if r[0] == 'House Rent Allowance':
-          if (self.doc.ann_rent <= 0.00):
-            ch.max_limit1 = 0.00
-            
-          else:
-            hra1=0.00
-            if(self.doc.metro == 'Yes'):
-              hra1 = flt(self.doc.basic)*50/100
-            elif(self.doc.metro == 'No'):
-              hra1 = flt(self.doc.basic)*40/100
-            hra2 = flt(ann_hra)
-            hra3 = flt(self.doc.ann_rent) - (flt(self.doc.basic)/10)
-
-
-            if hra1 <= 0 or hra2 <=0 or hra3 <=0:
-              ch.max_limit1 = 0
-            else:
-              ch.max_limit1=min(hra1,min(hra2,hra3))
-        else:    
-          ch.max_limit1 = r[1]
-        
-        ch.actual_amount1 = 0.00
-        ch.eligible_amount1 = 0.00
-        ch.modified_amount1 = 0.00
-  
-  #-------------------------------------------    
-  def set_exemption_table(self, hra_count):
-    self.doc.clear_table(self.doclist, 'exe_declaration_details',1)
-    ann_hra = 0
-    if (self.doc.ann_rent > 0):
-    
-      #query return sum of earning types amount where earning type = 'HRA'
-      ret_sal_slip = sql("select sum(e.e_amount) from `tabSS Earning Detail` e , `tabSalary Slip` s where s.fiscal_year = '%s' and s.docstatus = 1 and s.employee='%s' and e.parent = s.name and e.e_type = 'House Rent Allowance'" %(self.doc.fiscal_year,self.doc.employee))
-      if not ret_sal_slip:
-        ret_sal_slip = 0.00
-      else:
-        ret_sal_slip = ret_sal_slip[0][0]      
-     
-      month_diff = self.get_month_diff()     
-      
-      #ret_sal_slip = ret_sal_slip[0][0] or 0.00
-      ann_hra = (flt(hra_count)*flt(month_diff))+flt(ret_sal_slip);
-      
-    self.set_exemption_values(ann_hra)
- 
-  #-------------------------------------------     
-  def set_other_income_table(self):
-    self.doc.clear_table(self.doclist, 'oth_inc_decl_details',1)
-    other_income =[["Income from Housing","----",0.00],["Relief on interest paid on Housing Loan","U/S 24(1)(Vi)",150000],["Any other Income","----",0.00]]
-    
-    for oi in other_income:
-      ch1 = addchild(self.doc,'oth_inc_decl_details','Other Income Detail',0, self.doclist)
-      ch1.particulars2 = oi[0]
-      ch1.under_section2 = oi[1]
-      ch1.max_limit2 = oi[2]
-      ch1.actual_amount2 = 0.00
-      ch1.eligible_amount2 = 0.00
-      ch1.modified_amount2 = 0.00
-  
-  
-  #---------------------------------------  
-  def get_maxlmt_via(self):
-    if(self.doc.part_sr_citizen == 'Yes'): 
-      max_lmt1 = 20000
-    else:
-      max_lmt1 = 15000
-      
-    if(self.doc.per_dep_dis == "Less than 80% disability"):
-      max_lmt2 = 50000
-    elif(self.doc.per_dep_dis == "More than 80% disability"):
-      max_lmt2 = 100000
-    else:
-      max_lmt2 = 0.00
-
-    if(self.doc.per_self_dis == "Less than 80% disability"):
-      max_lmt3 = 50000
-    elif(self.doc.per_self_dis == "More than 80% disability"):
-      max_lmt3 = 75000
-    else:
-      max_lmt3 = 0.00
-    
-    maxlmt_lst=[max_lmt1,max_lmt2,max_lmt3]
-    
-    return maxlmt_lst
-
-  #---------------------------------------     
-  def set_deduction_via_table(self):
-    self.doc.clear_table(self.doclist, 'chap_via_decl_details',1)
-    
-    maxlmt_lst = self.get_maxlmt_via()
-
-    deduct_via = [["Medical Insurance Premium","U/Sec 80D(2A)",15000],["Medical Insurance Premium for parents","U/Sec 80D(2A)", maxlmt_lst[0]],["Medical for handicapped dependents","U/Sec 80DD",maxlmt_lst[1]],["Medical for specified diseases","U/Sec 80DDB",40000],["Higher Education Loan Interest Repayment","U/Sec 80E",0.00],["*Donation to approved Fund and charities","U/sec 80G",0.00],["*Rent deduction only if HRA not received","U/sec 80GG",0.00],["Deduction for permanent disability","U/Sec 80 U",maxlmt_lst[2]],["Any other deductions","----",0.00]]
-   
-    
-    for dv in deduct_via:
-      ch = addchild(self.doc,'chap_via_decl_details','Chapter VI A Detail',0, self.doclist)
-      ch.particulars3 = dv[0]
-      ch.under_section3 = dv[1]
-      ch.max_limit3 = dv[2]
-      ch.actual_amount3 = 0.00
-      ch.eligible_amount3 = 0.00
-      ch.modified_amount3 = 0.00
-    
-   
-  #----------------------------------------   
-  def set_invest_80c_table(self):
-    self.doc.clear_table(self.doclist, 'invest_80_decl_details',1)
-    invest_lst = [["Employees Provident Fund","U/Sec 80C",0.00],["Voluntary Contribution Provident Fund","U/Sec 80C",0.00],["Investment in Pension Scheme","U/Sec 80 CCC",10000],["Housing Loan Principal Repayment","U/Sec 80C",0.00],["Public Provident Fund (PPF)","U/Sec 80C",0.00],["Life Insurance Premium Paid","U/Sec 80C",0.00],["Unit Linked Insurance Plans","U/Sec 80C",0.00],["NSC - National Saving Certificate","U/Sec 80C",0.00],["Deposite in National Saving Scheme (NSS)","U/Sec 80C",0.00],["Infrastructure Investment in approved Shares, Debentures & Bonds","U/Sec 80C",0.00],["Mutual Funds notified under Section 10 (23D)","U/Sec 80C",0.00],["Equity Link Saving Scheme (ELSS) Mutual Funds notified under Section 10 (23D)","U/Sec 80C",0.00],["Term Deposite with a SCH. Bank in a notified Scheme for a team not less than 5 years ","U/Sec 80C",0.00],["Tution Fees Paid (Only full time education tution fees paid to any Indian Univ, College, School)","U/Sec 80C","24000"],["Senior Citizen Savings Scheme Rules, 2004","U/Sec 80C",0.00],["Post Office Time Deposit Rules, 1981 for a term not less than 5 years","U/Sec 80C",0.00]]
-  
-  
-    for il in invest_lst:
-      ch = addchild(self.doc,'invest_80_decl_details','Invest 80 Declaration Detail',0, self.doclist)
-      ch.particulars4 = il[0]
-      ch.under_section4 = il[1]
-      ch.max_limit4 = il[2]
-      ch.actual_amount4 = 0.00
-      ch.eligible_amount4 = 0.00
-      ch.modified_amount4 = 0.00
-      
-      
-  #---------------------------------------
-  def sum_mod_val(self):
-    count = count1 = count2 = 0.0
-    
-    for e in getlist(self.doclist,'exe_declaration_details'):
-      count += flt(e.modified_amount1)
-    
-    count = round(flt(self.doc.gross_income)) - count
-    
-    for oi in getlist(self.doclist,'oth_inc_decl_details'):
-      count += flt(oi.modified_amount2)
-    
-    for vi in getlist(self.doclist,'chap_via_decl_details'):
-      count2 += flt(vi.modified_amount3)
-    
-    count = count - count2
-    
-    for inv in getlist(self.doclist,'invest_80_decl_details'):
-      count1 += flt(inv.modified_amount4)
-      if(count1 >= 100000):
-        break
-      
-    if(count1>100000):
-      count1=100000
-      
-    count_lst = [count,count1]
-    return count_lst
-  
-  #----------------------------------------  
-  def calculate_tax(self):
-    
-    count_lst = self.sum_mod_val()
-    
-    count = round(flt(count_lst[0]) - flt(count_lst[1]))
-    if(count>0):
-      self.doc.net_tot_tax_income = count
-      
-      ret_gender = sql("select gender from `tabEmployee` where name = '%s' "%self.doc.employee)[0][0]
-      
-      if(self.doc.sr_citizen == 'Yes'):
-        self.calc_tax(count,240000)        
-      elif(ret_gender == 'Male'):
-        self.calc_tax(count,160000)
-      elif(ret_gender == 'Female'):
-        self.calc_tax(count,190000)
-    else:
-      self.doc.net_tot_tax_income = 0
-      self.doc.tax_tot_income = 0
-      self.doc.edu_cess = 0
-  #-----------------------------------------------    
-  def calc_tax(self,count,upper_limit):
-    balance = 0
-    tax = 0
-    if(count> upper_limit):
-      balance = count - upper_limit
-      if balance > (500000 - upper_limit):
-        balance = balance - (500000 - upper_limit)
-        tax = round(balance/10)
-        if balance > 300000:
-          balance = balance - 300000
-          tax = round(tax+ 60000)
-          if balance > 0:
-            tax = round(tax + (balance * 30 / 100))
-        else:
-          tax = round(balance * 20 / 100 )
-      else:
-        tax = round(balance /10)
-    else:
-      tax = 0
-    
-    self.doc.tax_tot_income = tax
-    self.doc.edu_cess = round(tax*3/100)
-    
-  #-----------------------------------------------     
-  def calc_tax_pm(self):
-       
-    ret_income_tax = 0
-    ret_income_tax = sql("select sum(d.d_amount) from `tabSS Deduction Detail` d , `tabSalary Slip` s where s.docstatus = 1 and s.fiscal_year = '%s' and s.employee='%s' and d.parent = s.name and d.d_type = 'Income Tax'" %(self.doc.fiscal_year,self.doc.employee))
-    
-    new_tot_income = cint(self.doc.tax_tot_income) + cint(self.doc.edu_cess) - (cint(ret_income_tax[0][0]) or 0)
-    
-    self.doc.tax_per_month = new_tot_income/cint(self.doc.rem_months)
diff --git a/erpnext/hr/doctype/it_checklist/it_checklist.txt b/erpnext/hr/doctype/it_checklist/it_checklist.txt
deleted file mode 100644
index b28e9df..0000000
--- a/erpnext/hr/doctype/it_checklist/it_checklist.txt
+++ /dev/null
@@ -1,637 +0,0 @@
-# DocType, IT Checklist
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:05',
-		'docstatus': 0,
-		'modified': '2010-12-30 14:53:02',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'allow_trash': 1,
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'module': 'HR',
-		'name': '__common__',
-		'section_style': 'Tabbed',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 455
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'IT Checklist',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'IT Checklist',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1
-	},
-
-	# DocType, IT Checklist
-	{
-		'doctype': 'DocType',
-		'name': 'IT Checklist'
-	},
-
-	# DocPerm
-	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'permlevel': 0,
-		'role': 'System Manager',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'permlevel': 0,
-		'role': 'HR User',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'permlevel': 0,
-		'role': 'HR Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 4,
-		'permlevel': 1,
-		'role': 'System Manager'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 5,
-		'permlevel': 1,
-		'role': 'HR User'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 6,
-		'permlevel': 1,
-		'role': 'HR Manager'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'in_filter': 1,
-		'label': 'Fiscal Year',
-		'oldfieldname': 'fiscal_year',
-		'oldfieldtype': 'Data',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 3,
-		'oldfieldtype': 'Column Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'default': 'Yes',
-		'doctype': 'DocField',
-		'fieldname': 'is_cheklist_active',
-		'fieldtype': 'Select',
-		'idx': 4,
-		'label': 'Is IT Cheklist Active?',
-		'oldfieldname': 'is_cheklist_active',
-		'oldfieldtype': 'Select',
-		'options': 'Yes\nNo',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 5,
-		'label': 'Employee Information',
-		'oldfieldtype': 'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 6,
-		'oldfieldtype': 'Column Break',
-		'permlevel': 0,
-		'width': '50%'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'employee',
-		'fieldtype': 'Link',
-		'idx': 7,
-		'label': 'Employee',
-		'oldfieldname': 'employee',
-		'oldfieldtype': 'Link',
-		'options': 'Employee',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'employee_name',
-		'fieldtype': 'Data',
-		'idx': 8,
-		'label': 'Employee Name',
-		'oldfieldname': 'employee_name',
-		'oldfieldtype': 'Data',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'hra_count',
-		'fieldtype': 'Currency',
-		'hidden': 1,
-		'idx': 9,
-		'label': 'HRA Count',
-		'no_copy': 0,
-		'oldfieldname': 'hra_count',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'metro',
-		'fieldtype': 'Select',
-		'idx': 10,
-		'label': 'Is location a metro city?',
-		'oldfieldname': 'metro',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'sr_citizen',
-		'fieldtype': 'Select',
-		'idx': 11,
-		'label': 'Is senior citizen?',
-		'oldfieldname': 'sr_citizen',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'part_sr_citizen',
-		'fieldtype': 'Select',
-		'idx': 12,
-		'label': 'Parents are sr. citizen?',
-		'oldfieldname': 'part_sr_citizen',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'basic',
-		'fieldtype': 'Currency',
-		'idx': 13,
-		'label': 'Annual Basic',
-		'oldfieldname': 'basic',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'sum of earning terms',
-		'doctype': 'DocField',
-		'fieldname': 'gross_income',
-		'fieldtype': 'Currency',
-		'idx': 14,
-		'label': 'Annual Gross Income',
-		'oldfieldname': 'gross_income',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'Please fill up all data then press "Done"',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 15,
-		'label': 'Done',
-		'oldfieldtype': 'Button',
-		'permlevel': 0,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 16,
-		'oldfieldtype': 'Column Break',
-		'permlevel': 0,
-		'width': '50%'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'rent_acc',
-		'fieldtype': 'Select',
-		'idx': 17,
-		'label': 'Having rented accomodation?',
-		'oldfieldname': 'rent_acc',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'ann_rent',
-		'fieldtype': 'Currency',
-		'hidden': 1,
-		'idx': 18,
-		'label': 'Enter annual rent paid',
-		'oldfieldname': 'ann_rent',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'Disability % of the Handicapped Dependents',
-		'doctype': 'DocField',
-		'fieldname': 'per_dep_dis',
-		'fieldtype': 'Select',
-		'idx': 19,
-		'label': 'Dependents Disability %',
-		'oldfieldname': 'per_dep_dis',
-		'oldfieldtype': 'Select',
-		'options': '\nLess than 80% disability\nMore than 80% disability',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'per_self_dis',
-		'fieldtype': 'Select',
-		'idx': 20,
-		'label': 'Self disability %',
-		'oldfieldname': 'per_self_dis',
-		'oldfieldtype': 'Select',
-		'options': '\nLess than 80% disability\nMore than 80% disability',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'pf',
-		'fieldtype': 'Currency',
-		'idx': 21,
-		'label': 'Annual PF',
-		'oldfieldname': 'pf',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 22,
-		'label': 'Exemptions',
-		'oldfieldtype': 'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 23,
-		'label': 'Exemptions1',
-		'oldfieldtype': 'HTML',
-		'options': '<b>Exemptions under section 10 & 17</b>',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'exe_declaration_details',
-		'fieldtype': 'Table',
-		'idx': 24,
-		'label': 'Exemption Detail',
-		'oldfieldname': 'exe_declaration_details',
-		'oldfieldtype': 'Table',
-		'options': 'Declaration Detail',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 25,
-		'label': 'Other Income',
-		'oldfieldtype': 'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'oth_inc_decl_details',
-		'fieldtype': 'Table',
-		'idx': 26,
-		'label': 'Other Income Details',
-		'oldfieldname': 'oth_inc_decl_details',
-		'oldfieldtype': 'Table',
-		'options': 'Other Income Detail',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 27,
-		'label': 'Chapter VI A',
-		'oldfieldtype': 'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 28,
-		'label': 'deduction chap via',
-		'oldfieldtype': 'HTML',
-		'options': '<b>Deduction under Chapter VI A</b>',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'chap_via_decl_details',
-		'fieldtype': 'Table',
-		'idx': 29,
-		'label': 'Chap VI A Details',
-		'oldfieldname': 'chap_via_decl_details',
-		'oldfieldtype': 'Table',
-		'options': 'Chapter VI A Detail',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 30,
-		'label': '80 C',
-		'oldfieldtype': 'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 31,
-		'label': 'investment 80 C',
-		'oldfieldtype': 'HTML',
-		'options': '<b>Investment under Section 80 C & 80CCC qualifying for deduction upto RS. 1 Lac</b>',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'invest_80_decl_details',
-		'fieldtype': 'Table',
-		'idx': 32,
-		'label': 'Invest 80 Decl Details',
-		'oldfieldname': 'invest_80_decl_details',
-		'oldfieldtype': 'Table',
-		'options': 'Invest 80 Declaration Detail',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 33,
-		'label': 'Total Taxable Income',
-		'oldfieldtype': 'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 34,
-		'label': 'Calculate',
-		'oldfieldtype': 'Button',
-		'options': 'calculate_tax',
-		'permlevel': 0,
-		'trigger': 'Server'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'net_tot_tax_income',
-		'fieldtype': 'Currency',
-		'idx': 35,
-		'label': 'Net Total Taxable Income',
-		'oldfieldname': 'net_tot_tax_income',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'tax_tot_income',
-		'fieldtype': 'Currency',
-		'idx': 36,
-		'label': 'Tax on Total Income',
-		'oldfieldname': 'tax_tot_income',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'edu_cess',
-		'fieldtype': 'Currency',
-		'idx': 37,
-		'label': 'Education Cess',
-		'oldfieldname': 'edu_cess',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'applicable_from',
-		'fieldtype': 'Select',
-		'idx': 38,
-		'label': 'Applicable from ',
-		'oldfieldname': 'applicable_from',
-		'oldfieldtype': 'Select',
-		'options': '\nJanuary\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'rem_months',
-		'fieldtype': 'Select',
-		'idx': 39,
-		'label': 'Remaining month in year',
-		'oldfieldname': 'rem_months',
-		'oldfieldtype': 'Select',
-		'options': '\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 40,
-		'label': 'Calculate Tax',
-		'oldfieldtype': 'Section Break',
-		'options': 'Simple',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 41,
-		'label': 'Calculate Monthly Tax ',
-		'oldfieldtype': 'Button',
-		'options': 'calc_tax_pm',
-		'permlevel': 0,
-		'trigger': 'Server'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'tax_per_month',
-		'fieldtype': 'Currency',
-		'idx': 42,
-		'label': 'Tax per Month',
-		'oldfieldname': 'tax_per_month',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/kra_sheet/__init__.py b/erpnext/hr/doctype/kra_sheet/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/kra_sheet/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/doctype/kra_sheet/kra_sheet.txt b/erpnext/hr/doctype/kra_sheet/kra_sheet.txt
deleted file mode 100644
index a1e466b..0000000
--- a/erpnext/hr/doctype/kra_sheet/kra_sheet.txt
+++ /dev/null
@@ -1,68 +0,0 @@
-# DocType, KRA Sheet
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-09-01 15:48:06',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'KSHEET.#####',
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'HR',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'version': 6
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'KRA Sheet',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocType, KRA Sheet
-	{
-		'doctype': 'DocType',
-		'name': 'KRA Sheet'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'Key Performance Area',
-		'doctype': 'DocField',
-		'fieldname': 'kra',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'KRA',
-		'oldfieldname': 'kra',
-		'oldfieldtype': 'Small Text',
-		'width': '200px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'per_weightage',
-		'fieldtype': 'Currency',
-		'idx': 2,
-		'label': 'Weightage (%)',
-		'oldfieldname': 'per_weightage',
-		'oldfieldtype': 'Currency',
-		'width': '100px'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/kra_template/__init__.py b/erpnext/hr/doctype/kra_template/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/kra_template/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/doctype/kra_template/kra_template.js b/erpnext/hr/doctype/kra_template/kra_template.js
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/kra_template/kra_template.js
+++ /dev/null
diff --git a/erpnext/hr/doctype/kra_template/kra_template.txt b/erpnext/hr/doctype/kra_template/kra_template.txt
deleted file mode 100644
index 5518926..0000000
--- a/erpnext/hr/doctype/kra_template/kra_template.txt
+++ /dev/null
@@ -1,115 +0,0 @@
-# DocType, KRA Template
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-09-01 15:48:06',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'field:kra_title',
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'HR',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'version': 3
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'KRA Template',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# These values are common for all DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'KRA Template',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'permlevel': 0,
-		'read': 1,
-		'write': 1
-	},
-
-	# DocType, KRA Template
-	{
-		'doctype': 'DocType',
-		'name': 'KRA Template'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'role': 'HR Manager'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'role': 'HR User'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'role': 'System Manager'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'System Manager'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'kra_title',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'label': 'KRA Title',
-		'oldfieldname': 'kra_title',
-		'oldfieldtype': 'Data',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Small Text',
-		'idx': 2,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Small Text',
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'kra_sheet',
-		'fieldtype': 'Table',
-		'idx': 3,
-		'label': 'KRA Sheet',
-		'oldfieldname': 'kra_sheet',
-		'oldfieldtype': 'Table',
-		'options': 'KRA Sheet'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation.txt b/erpnext/hr/doctype/leave_allocation/leave_allocation.txt
index f461ca8..9045221 100644
--- a/erpnext/hr/doctype/leave_allocation/leave_allocation.txt
+++ b/erpnext/hr/doctype/leave_allocation/leave_allocation.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-02-14 10:18:47',
+		'creation': '2012-03-27 14:35:58',
 		'docstatus': 0,
-		'modified': '2012-03-21 12:49:25',
+		'modified': '2012-03-27 14:45:49',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -17,6 +17,7 @@
 		'colour': u'White:FFF',
 		'default_print_format': u'Standard',
 		'doctype': 'DocType',
+		'is_submittable': 1,
 		'module': u'HR',
 		'name': '__common__',
 		'search_fields': u'employee,employee_name,leave_type,total_leaves_allocated,fiscal_year',
@@ -83,110 +84,6 @@
 		'cancel': 1,
 		'create': 1,
 		'doctype': u'DocPerm',
-		'match': u'owner',
-		'permlevel': 0,
-		'role': u'HR User',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'match': u'owner',
-		'permlevel': 0,
-		'role': u'HR User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'match': u'owner',
-		'permlevel': 0,
-		'role': u'HR User',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'match': u'owner',
-		'permlevel': 0,
-		'role': u'HR User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'match': u'owner',
-		'permlevel': 0,
-		'role': u'HR User',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'match': u'owner',
-		'permlevel': 0,
-		'role': u'HR User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'match': u'owner',
-		'permlevel': 0,
-		'role': u'HR User',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'match': u'owner',
-		'permlevel': 0,
-		'role': u'HR User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
 		'permlevel': 0,
 		'role': u'HR Manager',
 		'submit': 1,
@@ -203,6 +100,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'width': u'50%'
@@ -304,6 +202,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break1',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'width': u'50%'
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index 66647c1..7ad637d 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -59,9 +59,9 @@
 		"""
 			get total holidays
 		"""
-		tot_hol = sql("select count(*) from `tabHoliday List Detail` h1, `tabHoliday List` h2, `tabEmployee` e1 where e1.name = '%s' and h1.parent = h2.name and e1.holiday_list = h2.name and h1.holiday_date between '%s' and '%s'"% (self.doc.employee, self.doc.from_date, self.doc.to_date))
+		tot_hol = sql("select count(*) from `tabHoliday` h1, `tabHoliday List` h2, `tabEmployee` e1 where e1.name = '%s' and h1.parent = h2.name and e1.holiday_list = h2.name and h1.holiday_date between '%s' and '%s'"% (self.doc.employee, self.doc.from_date, self.doc.to_date))
 		if not tot_hol:
-			tot_hol = sql("select count(*) from `tabHoliday List Detail` h1, `tabHoliday List` h2 where h1.parent = h2.name and h1.holiday_date between '%s' and '%s' and ifnull(h2.is_default,0) = 1 and h2.fiscal_year = %s"% (self.doc.from_date, self.doc.to_date, self.doc.fiscal_year))
+			tot_hol = sql("select count(*) from `tabHoliday` h1, `tabHoliday List` h2 where h1.parent = h2.name and h1.holiday_date between '%s' and '%s' and ifnull(h2.is_default,0) = 1 and h2.fiscal_year = %s"% (self.doc.from_date, self.doc.to_date, self.doc.fiscal_year))
 		return tot_hol and flt(tot_hol[0][0]) or 0
 
 	
diff --git a/erpnext/hr/doctype/leave_application/leave_application.txt b/erpnext/hr/doctype/leave_application/leave_application.txt
index 06b4170..b2ce2ab 100644
--- a/erpnext/hr/doctype/leave_application/leave_application.txt
+++ b/erpnext/hr/doctype/leave_application/leave_application.txt
@@ -3,53 +3,54 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-02-10 14:10:08',
+		'creation': '2012-03-27 14:35:58',
 		'docstatus': 0,
-		'modified': '2011-07-11 12:48:49',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:45:49',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1310019491',
-		'autoname': 'LAP/.#####',
-		'colour': 'White:FFF',
+		'_last_update': u'1310019491',
+		'autoname': u'LAP/.#####',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Transaction',
-		'module': 'HR',
+		'document_type': u'Transaction',
+		'is_submittable': 1,
+		'module': u'HR',
 		'name': '__common__',
-		'search_fields': 'employee,employee_name,leave_type,from_date,to_date,total_leave_days,fiscal_year',
-		'section_style': 'Simple',
+		'search_fields': u'employee,employee_name,leave_type,from_date,to_date,total_leave_days,fiscal_year',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
-		'subject': 'From %(employee_name)s, %(designation)s',
-		'tag_fields': 'leave_type',
+		'subject': u'From %(employee_name)s, %(designation)s',
+		'tag_fields': u'leave_type',
 		'version': 17
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Leave Application',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Leave Application',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Leave Application',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Leave Application',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Leave Application
 	{
 		'doctype': 'DocType',
-		'name': 'Leave Application'
+		'name': u'Leave Application'
 	},
 
 	# DocPerm
@@ -57,9 +58,8 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'match': 'owner',
+		'doctype': u'DocPerm',
+		'match': u'owner',
 		'permlevel': 0,
 		'submit': 1,
 		'write': 1
@@ -70,9 +70,8 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'match': 'owner',
+		'doctype': u'DocPerm',
+		'match': u'owner',
 		'permlevel': 0,
 		'submit': 0,
 		'write': 0
@@ -83,10 +82,9 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 3,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'HR User',
+		'role': u'HR User',
 		'submit': 1,
 		'write': 1
 	},
@@ -96,48 +94,54 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 4,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'HR Manager',
+		'role': u'HR Manager',
 		'submit': 1,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 5,
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'HR User'
+		'role': u'HR User',
+		'submit': 0,
+		'write': 0
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 6,
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'HR Manager'
+		'role': u'HR Manager',
+		'submit': 0,
+		'write': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 1,
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'employee',
-		'fieldtype': 'Link',
-		'idx': 2,
+		'doctype': u'DocField',
+		'fieldname': u'employee',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Employee',
-		'options': 'Employee',
+		'label': u'Employee',
+		'options': u'Employee',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1
@@ -145,25 +149,23 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'employee_name',
-		'fieldtype': 'Data',
-		'idx': 3,
+		'doctype': u'DocField',
+		'fieldname': u'employee_name',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Employee Name',
+		'label': u'Employee Name',
 		'permlevel': 1,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'leave_type',
-		'fieldtype': 'Select',
-		'idx': 4,
+		'doctype': u'DocField',
+		'fieldname': u'leave_type',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Leave Type',
-		'options': 'link:Leave Type',
+		'label': u'Leave Type',
+		'options': u'link:Leave Type',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1
@@ -171,23 +173,21 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'leave_balance',
-		'fieldtype': 'Currency',
-		'idx': 5,
-		'label': 'Leave Balance',
+		'doctype': u'DocField',
+		'fieldname': u'leave_balance',
+		'fieldtype': u'Currency',
+		'label': u'Leave Balance',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'Today',
-		'doctype': 'DocField',
-		'fieldname': 'posting_date',
-		'fieldtype': 'Date',
-		'idx': 6,
-		'label': 'Posting Date',
+		'colour': u'White:FFF',
+		'default': u'Today',
+		'doctype': u'DocField',
+		'fieldname': u'posting_date',
+		'fieldtype': u'Date',
+		'label': u'Posting Date',
 		'no_copy': 1,
 		'permlevel': 1,
 		'reqd': 1
@@ -195,13 +195,12 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Select',
-		'idx': 7,
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Fiscal Year',
-		'options': 'link:Fiscal Year',
+		'label': u'Fiscal Year',
+		'options': u'link:Fiscal Year',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 0
@@ -209,100 +208,92 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 8,
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'half_day',
-		'fieldtype': 'Check',
-		'idx': 9,
-		'label': 'Half Day',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'half_day',
+		'fieldtype': u'Check',
+		'label': u'Half Day',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'from_date',
-		'fieldtype': 'Date',
-		'idx': 10,
-		'label': 'From Date',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'from_date',
+		'fieldtype': u'Date',
+		'label': u'From Date',
 		'permlevel': 0,
 		'search_index': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'to_date',
-		'fieldtype': 'Date',
-		'idx': 11,
-		'label': 'To Date',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'to_date',
+		'fieldtype': u'Date',
+		'label': u'To Date',
 		'permlevel': 0,
 		'search_index': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'total_leave_days',
-		'fieldtype': 'Currency',
-		'idx': 12,
-		'label': 'Total Leave Days',
+		'doctype': u'DocField',
+		'fieldname': u'total_leave_days',
+		'fieldtype': u'Currency',
+		'label': u'Total Leave Days',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Small Text',
-		'idx': 13,
-		'label': 'Description',
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Small Text',
+		'label': u'Description',
 		'permlevel': 0,
-		'width': '300px'
+		'width': u'300px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'letter_head',
-		'fieldtype': 'Link',
-		'idx': 14,
-		'label': 'Letter Head',
-		'options': 'Letter Head',
+		'doctype': u'DocField',
+		'fieldname': u'letter_head',
+		'fieldtype': u'Link',
+		'label': u'Letter Head',
+		'options': u'Letter Head',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amended_from',
-		'fieldtype': 'Data',
-		'idx': 15,
-		'label': 'Amended From',
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Data',
+		'label': u'Amended From',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amendment_date',
-		'fieldtype': 'Date',
-		'idx': 16,
-		'label': 'Amendment Date',
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
+		'label': u'Amendment Date',
 		'permlevel': 1
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/leave_control_panel/leave_control_panel.txt b/erpnext/hr/doctype/leave_control_panel/leave_control_panel.txt
index a044b16..9adc243 100644
--- a/erpnext/hr/doctype/leave_control_panel/leave_control_panel.txt
+++ b/erpnext/hr/doctype/leave_control_panel/leave_control_panel.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:08',
+		'creation': '2012-03-27 14:35:59',
 		'docstatus': 0,
-		'modified': '2012-03-21 14:42:27',
+		'modified': '2012-03-27 14:35:59',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -108,6 +108,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'width': u'50%'
 	},
@@ -170,6 +171,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break1',
 		'fieldtype': u'Column Break',
 		'width': u'50%'
 	},
@@ -218,6 +220,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'allocate',
 		'fieldtype': u'Button',
 		'label': u'Allocate',
 		'options': u'allocate_leave',
diff --git a/erpnext/hr/doctype/leave_type/leave_type.js b/erpnext/hr/doctype/leave_type/leave_type.js
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/leave_type/leave_type.js
+++ /dev/null
diff --git a/erpnext/hr/doctype/leave_type/leave_type.txt b/erpnext/hr/doctype/leave_type/leave_type.txt
index fb9aafd..a6a1f2d 100644
--- a/erpnext/hr/doctype/leave_type/leave_type.txt
+++ b/erpnext/hr/doctype/leave_type/leave_type.txt
@@ -3,46 +3,46 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:08',
+		'creation': '2012-03-27 14:35:59',
 		'docstatus': 0,
-		'modified': '2011-02-10 17:05:15',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:59',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
 		'allow_trash': 1,
-		'autoname': 'field:leave_type_name',
-		'colour': 'White:FFF',
+		'autoname': u'field:leave_type_name',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'HR',
+		'document_type': u'Master',
+		'module': u'HR',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 23
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Leave Type',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Leave Type',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Leave Type',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Leave Type',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
 		'write': 1
@@ -51,90 +51,82 @@
 	# DocType, Leave Type
 	{
 		'doctype': 'DocType',
-		'name': 'Leave Type'
+		'name': u'Leave Type'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'System Manager'
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'HR User'
+		'doctype': u'DocPerm',
+		'role': u'HR User'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'role': 'HR Manager'
+		'doctype': u'DocPerm',
+		'role': u'HR Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'leave_type_name',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Leave Type Name',
-		'oldfieldname': 'leave_type_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'leave_type_name',
+		'fieldtype': u'Data',
+		'label': u'Leave Type Name',
+		'oldfieldname': u'leave_type_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'max_days_allowed',
-		'fieldtype': 'Data',
-		'idx': 3,
-		'label': 'Max Days Leave Allowed',
-		'oldfieldname': 'max_days_allowed',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'max_days_allowed',
+		'fieldtype': u'Data',
+		'label': u'Max Days Leave Allowed',
+		'oldfieldname': u'max_days_allowed',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'is_carry_forward',
-		'fieldtype': 'Check',
-		'idx': 4,
-		'label': 'Is Carry Forward',
-		'oldfieldname': 'is_carry_forward',
-		'oldfieldtype': 'Check',
+		'doctype': u'DocField',
+		'fieldname': u'is_carry_forward',
+		'fieldtype': u'Check',
+		'label': u'Is Carry Forward',
+		'oldfieldname': u'is_carry_forward',
+		'oldfieldtype': u'Check',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'is_encash',
-		'fieldtype': 'Check',
+		'doctype': u'DocField',
+		'fieldname': u'is_encash',
+		'fieldtype': u'Check',
 		'hidden': 1,
-		'idx': 5,
-		'label': 'Is Encash',
-		'oldfieldname': 'is_encash',
-		'oldfieldtype': 'Check',
+		'label': u'Is Encash',
+		'oldfieldname': u'is_encash',
+		'oldfieldtype': u'Check',
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 1
@@ -142,11 +134,10 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'is_lwp',
-		'fieldtype': 'Check',
-		'idx': 6,
-		'label': 'Is LWP',
+		'doctype': u'DocField',
+		'fieldname': u'is_lwp',
+		'fieldtype': u'Check',
+		'label': u'Is LWP',
 		'permlevel': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/other_income_detail/other_income_detail.txt b/erpnext/hr/doctype/other_income_detail/other_income_detail.txt
index 232427d..93a9ea0 100644
--- a/erpnext/hr/doctype/other_income_detail/other_income_detail.txt
+++ b/erpnext/hr/doctype/other_income_detail/other_income_detail.txt
@@ -3,139 +3,131 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:11',
+		'creation': '2012-03-27 14:35:59',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:59',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'HR',
+		'module': u'HR',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 6
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Other Income Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Other Income Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Other Income Detail',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Other Income Detail',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1,
-		'role': 'System Manager'
+		'role': u'System Manager'
 	},
 
 	# DocType, Other Income Detail
 	{
 		'doctype': 'DocType',
-		'name': 'Other Income Detail'
+		'name': u'Other Income Detail'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
+		'doctype': u'DocPerm',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'particulars2',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Particulars',
-		'oldfieldname': 'particulars2',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'particulars2',
+		'fieldtype': u'Small Text',
+		'label': u'Particulars',
+		'oldfieldname': u'particulars2',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1,
 		'reqd': 1,
-		'width': '200px'
+		'width': u'200px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'under_section2',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Under Section',
-		'oldfieldname': 'under_section2',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'under_section2',
+		'fieldtype': u'Data',
+		'label': u'Under Section',
+		'oldfieldname': u'under_section2',
+		'oldfieldtype': u'Data',
 		'permlevel': 1,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'max_limit2',
-		'fieldtype': 'Currency',
-		'idx': 3,
-		'label': 'Max. Limit',
-		'oldfieldname': 'max_limit2',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'max_limit2',
+		'fieldtype': u'Currency',
+		'label': u'Max. Limit',
+		'oldfieldname': u'max_limit2',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'actual_amount2',
-		'fieldtype': 'Currency',
-		'idx': 4,
-		'label': 'Actual Amount',
-		'oldfieldname': 'actual_amount2',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'actual_amount2',
+		'fieldtype': u'Currency',
+		'label': u'Actual Amount',
+		'oldfieldname': u'actual_amount2',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'eligible_amount2',
-		'fieldtype': 'Currency',
-		'idx': 5,
-		'label': 'Eligible Amount',
-		'oldfieldname': 'eligible_amount2',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'eligible_amount2',
+		'fieldtype': u'Currency',
+		'label': u'Eligible Amount',
+		'oldfieldname': u'eligible_amount2',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'modified_amount2',
-		'fieldtype': 'Currency',
-		'idx': 6,
-		'label': 'Modified Amount',
-		'oldfieldname': 'modified_amount2',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'modified_amount2',
+		'fieldtype': u'Currency',
+		'label': u'Modified Amount',
+		'oldfieldname': u'modified_amount2',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/previous_experience_detail/__init__.py b/erpnext/hr/doctype/previous_experience_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/previous_experience_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/doctype/previous_experience_detail/previous_experience_detail.txt b/erpnext/hr/doctype/previous_experience_detail/previous_experience_detail.txt
deleted file mode 100644
index 4cce723..0000000
--- a/erpnext/hr/doctype/previous_experience_detail/previous_experience_detail.txt
+++ /dev/null
@@ -1,127 +0,0 @@
-# DocType, Previous Experience Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:13',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'HR',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 3
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Previous Experience Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# These values are common for all DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'name': '__common__',
-		'parent': 'Previous Experience Detail',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'permlevel': 0,
-		'read': 1,
-		'role': 'All',
-		'write': 1
-	},
-
-	# DocType, Previous Experience Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Previous Experience Detail'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'company_name',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'label': 'Company',
-		'oldfieldname': 'company_name',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'designation',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Designation',
-		'oldfieldname': 'designation',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'salary',
-		'fieldtype': 'Currency',
-		'idx': 3,
-		'label': 'Salary',
-		'oldfieldname': 'salary',
-		'oldfieldtype': 'Currency'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'address',
-		'fieldtype': 'Small Text',
-		'idx': 4,
-		'label': 'Address',
-		'oldfieldname': 'address',
-		'oldfieldtype': 'Small Text'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'contact',
-		'fieldtype': 'Data',
-		'idx': 5,
-		'label': 'Contact',
-		'oldfieldname': 'contact',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'total_experience',
-		'fieldtype': 'Data',
-		'idx': 6,
-		'label': 'Total Experience',
-		'oldfieldname': 'total_experience',
-		'oldfieldtype': 'Data'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/professional_training_details/__init__.py b/erpnext/hr/doctype/professional_training_details/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/professional_training_details/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/doctype/professional_training_details/professional_training_details.txt b/erpnext/hr/doctype/professional_training_details/professional_training_details.txt
deleted file mode 100644
index c94c6c5..0000000
--- a/erpnext/hr/doctype/professional_training_details/professional_training_details.txt
+++ /dev/null
@@ -1,100 +0,0 @@
-# DocType, Professional Training Details
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:14',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'HR',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 5
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Professional Training Details',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, Professional Training Details
-	{
-		'doctype': 'DocType',
-		'name': 'Professional Training Details'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'institute',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Institute / Conducted By',
-		'oldfieldname': 'institute',
-		'oldfieldtype': 'Small Text',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'nature_of_training',
-		'fieldtype': 'Small Text',
-		'idx': 2,
-		'label': 'Program / Seminar Title',
-		'oldfieldname': 'nature_of_training',
-		'oldfieldtype': 'Small Text',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'duration',
-		'fieldtype': 'Data',
-		'idx': 3,
-		'label': 'Duration',
-		'oldfieldname': 'duration',
-		'oldfieldtype': 'Data',
-		'reqd': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'loc',
-		'fieldtype': 'Data',
-		'idx': 4,
-		'label': 'Location',
-		'oldfieldname': 'loc',
-		'oldfieldtype': 'Data',
-		'reqd': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'certificate',
-		'fieldtype': 'Small Text',
-		'idx': 5,
-		'label': 'Certificate',
-		'oldfieldname': 'certificate',
-		'oldfieldtype': 'Small Text'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/salary_manager/salary_manager.js b/erpnext/hr/doctype/salary_manager/salary_manager.js
index 91eac1a..afe7e70 100644
--- a/erpnext/hr/doctype/salary_manager/salary_manager.js
+++ b/erpnext/hr/doctype/salary_manager/salary_manager.js
@@ -16,14 +16,14 @@
 
 var display_activity_log = function(msg) {
 	if(!pscript.ss_html)
-		pscript.ss_html = $a(cur_frm.fields_dict['Activity Log'].wrapper,'div','',{border:'1px solid #CCC', backgroundColor:'#CCC'});
+		pscript.ss_html = $a(cur_frm.fields_dict['activity_log'].wrapper,'div','',{border:'1px solid #CCC', backgroundColor:'#CCC'});
 	pscript.ss_html.innerHTML = '<div style="color:#EEE; background-color:#555;"><b><i>Activity Log:</i><br></b></div>';
 	pscript.ss_html.innerHTML += '<div style="color:#666; padding: 5px">'+ msg + '</div>';
 }
 
 //Create salary slip
 //-----------------------
-cur_frm.cscript['Create Salary Slip'] = function(doc, cdt, cdn) {
+cur_frm.cscript.create_salary_slip = function(doc, cdt, cdn) {
 	var callback = function(r, rt){
 		if (r.message)
 			display_activity_log(r.message);
@@ -35,7 +35,7 @@
 
 //Submit salary slip
 //-----------------------
-cur_frm.cscript['Submit Salary Slip'] = function(doc, cdt, cdn) {
+cur_frm.cscript.submit_salary_slip = function(doc, cdt, cdn) {
 	var check = confirm("Do you really want to Submit all Salary Slip for month : " + doc.month+" and fiscal year : "+doc.fiscal_year);
 	if(check){
 		var callback = function(r, rt){
@@ -48,7 +48,7 @@
 
 // Make Bank Voucher
 //-----------------------
-cur_frm.cscript['Make Bank Voucher'] = function(doc,cdt,cdn){
+cur_frm.cscript.make_bank_voucher = function(doc,cdt,cdn){
   if(doc.month && doc.fiscal_year){
   	cur_frm.cscript.make_jv(doc, cdt, cdn);
   }
diff --git a/erpnext/hr/doctype/salary_manager/salary_manager.txt b/erpnext/hr/doctype/salary_manager/salary_manager.txt
index c1ca4c6..6eff0db 100644
--- a/erpnext/hr/doctype/salary_manager/salary_manager.txt
+++ b/erpnext/hr/doctype/salary_manager/salary_manager.txt
@@ -3,49 +3,49 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-08-11 16:40:04',
+		'creation': '2012-03-27 14:35:59',
 		'docstatus': 0,
-		'modified': '2011-11-07 10:47:32',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:35:59',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1314253977',
+		'_last_update': u'1314253977',
 		'allow_copy': 1,
 		'allow_email': 1,
 		'allow_print': 1,
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
-		'document_type': 'Other',
+		'document_type': u'Other',
 		'issingle': 1,
-		'module': 'HR',
+		'module': u'HR',
 		'name': '__common__',
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 1,
 		'version': 30
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Salary Manager',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Salary Manager',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Salary Manager',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Salary Manager',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
 		'write': 1
@@ -54,201 +54,214 @@
 	# DocType, Salary Manager
 	{
 		'doctype': 'DocType',
-		'name': 'Salary Manager'
+		'name': u'Salary Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'role': 'System Manager'
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'role': 'HR User'
+		'doctype': u'DocPerm',
+		'role': u'HR User'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'role': 'HR Manager'
+		'doctype': u'DocPerm',
+		'role': u'HR Manager'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'label': 'Document Description',
-		'options': '<div class="field_description">You can generate multiple salary slips based on the selected criteria, submit and mail those to the employee directly from here</div>'
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'document_description',
+		'fieldtype': u'HTML',
+		'label': u'Document Description',
+		'options': u'<div class="field_description">You can generate multiple salary slips based on the selected criteria, submit and mail those to the employee directly from here</div>'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break'
+		'doctype': u'DocField',
+		'fieldname': u'section_break0',
+		'fieldtype': u'Section Break'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'width': '50%'
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Select',
-		'label': 'Company',
-		'options': 'link:Company',
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Select',
+		'label': u'Company',
+		'options': u'link:Company',
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'branch',
-		'fieldtype': 'Link',
-		'label': 'Branch',
-		'options': 'Branch'
+		'doctype': u'DocField',
+		'fieldname': u'branch',
+		'fieldtype': u'Link',
+		'label': u'Branch',
+		'options': u'Branch'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'department',
-		'fieldtype': 'Link',
-		'label': 'Department',
-		'options': 'Department'
+		'doctype': u'DocField',
+		'fieldname': u'department',
+		'fieldtype': u'Link',
+		'label': u'Department',
+		'options': u'Department'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'designation',
-		'fieldtype': 'Link',
-		'label': 'Designation',
-		'options': 'Designation'
+		'doctype': u'DocField',
+		'fieldname': u'designation',
+		'fieldtype': u'Link',
+		'label': u'Designation',
+		'options': u'Designation'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'width': '50%'
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'grade',
-		'fieldtype': 'Select',
-		'label': 'Grade',
-		'options': 'link:Grade'
+		'doctype': u'DocField',
+		'fieldname': u'grade',
+		'fieldtype': u'Select',
+		'label': u'Grade',
+		'options': u'link:Grade'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Select',
-		'label': 'Fiscal Year',
-		'options': 'link:Fiscal Year',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
+		'label': u'Fiscal Year',
+		'options': u'link:Fiscal Year',
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'month',
-		'fieldtype': 'Select',
-		'label': 'Month',
-		'options': '\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'month',
+		'fieldtype': u'Select',
+		'label': u'Month',
+		'options': u'\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12',
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Check if you want to send salary slip in mail to each employee while submitting salary slip',
-		'doctype': 'DocField',
-		'fieldname': 'send_email',
-		'fieldtype': 'Check',
-		'label': 'Send Email'
+		'colour': u'White:FFF',
+		'description': u'Check if you want to send salary slip in mail to each employee while submitting salary slip',
+		'doctype': u'DocField',
+		'fieldname': u'send_email',
+		'fieldtype': u'Check',
+		'label': u'Send Email'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break'
+		'doctype': u'DocField',
+		'fieldname': u'section_break1',
+		'fieldtype': u'Section Break'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'width': '50%'
+		'doctype': u'DocField',
+		'fieldname': u'column_break2',
+		'fieldtype': u'Column Break',
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Creates salary slip for above mentioned criteria.',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Create Salary Slip',
-		'trigger': 'Client'
+		'colour': u'White:FFF',
+		'description': u'Creates salary slip for above mentioned criteria.',
+		'doctype': u'DocField',
+		'fieldname': u'create_salary_slip',
+		'fieldtype': u'Button',
+		'label': u'Create Salary Slip',
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'width': '25%'
+		'doctype': u'DocField',
+		'fieldname': u'column_break3',
+		'fieldtype': u'Column Break',
+		'width': u'25%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Submit all salary slips for the above selected criteria',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Submit Salary Slip',
-		'trigger': 'Client'
+		'colour': u'White:FFF',
+		'description': u'Submit all salary slips for the above selected criteria',
+		'doctype': u'DocField',
+		'fieldname': u'submit_salary_slip',
+		'fieldtype': u'Button',
+		'label': u'Submit Salary Slip',
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'width': '25%'
+		'doctype': u'DocField',
+		'fieldname': u'column_break4',
+		'fieldtype': u'Column Break',
+		'width': u'25%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Create Bank Voucher for the total salary paid for the above selected criteria',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Make Bank Voucher',
-		'trigger': 'Client'
+		'colour': u'White:FFF',
+		'description': u'Create Bank Voucher for the total salary paid for the above selected criteria',
+		'doctype': u'DocField',
+		'fieldname': u'make_bank_voucher',
+		'fieldtype': u'Button',
+		'label': u'Make Bank Voucher',
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break'
+		'doctype': u'DocField',
+		'fieldname': u'section_break2',
+		'fieldtype': u'Section Break'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'label': 'Activity Log'
+		'doctype': u'DocField',
+		'fieldname': u'activity_log',
+		'fieldtype': u'HTML',
+		'label': u'Activity Log'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/salary_manager/test_salary_manager.py b/erpnext/hr/doctype/salary_manager/test_salary_manager.py
index 0282bfe..8cea105 100644
--- a/erpnext/hr/doctype/salary_manager/test_salary_manager.py
+++ b/erpnext/hr/doctype/salary_manager/test_salary_manager.py
@@ -30,15 +30,15 @@
 		ss1[0].employee = emp1.name
 		for s in ss1: s.save(1)
 		for s in ss1[1:]:
-			sql("update `tabEarning Detail` set parent = '%s' where name = '%s'" % (ss1[0].name, s.name))
-			sql("update `tabDeduction Detail` set parent = '%s' where name = '%s'" % (ss1[0].name, s.name))
+			sql("update `tabSalary Structure Earning` set parent = '%s' where name = '%s'" % (ss1[0].name, s.name))
+			sql("update `tabSalary Structure Deduction` set parent = '%s' where name = '%s'" % (ss1[0].name, s.name))
 			
 		
 		ss2[0].employee = emp2.name
 		for s in ss2: s.save(1)		
 		for s in ss2[1:]:
-			sql("update `tabEarning Detail` set parent = '%s' where name = '%s'" % (ss2[0].name, s.name))
-			sql("update `tabDeduction Detail` set parent = '%s' where name = '%s'" % (ss2[0].name, s.name))
+			sql("update `tabSalary Structure Earning` set parent = '%s' where name = '%s'" % (ss2[0].name, s.name))
+			sql("update `tabSalary Structure Deduction` set parent = '%s' where name = '%s'" % (ss2[0].name, s.name))
 			
 		sman.save()
 		self.sm = get_obj('Salary Manager')	
@@ -158,7 +158,7 @@
 	Document(fielddata={
 		'parenttype':'Salary Structure',
 		'parentfield':'earning_details',
-		'doctype':'Earning Detail',
+		'doctype':'Salary Structure Earning',
 		'e_type' : 'Basic',
 		'depend_on_lwp':1,
 		'modified_value':100
@@ -166,7 +166,7 @@
 	Document(fielddata={
 		'parenttype':'Salary Structure',
 		'parentfield':'earning_details',
-		'doctype':'Deduction Detail',
+		'doctype':'Salary Structure Deduction',
 		'd_type':'TDS',
 		'd_modified_amt':20
 	})
@@ -181,14 +181,14 @@
 	Document(fielddata={
 		'parenttype':'Salary Structure',
 		'parentfield':'deduction_details',
-		'doctype':'Earning Detail',
+		'doctype':'Salary Structure Earning',
 		'e_type' : 'Basic',
 		'modified_value':100
 	}),
 	Document(fielddata={
 		'parenttype':'Salary Structure',
 		'parentfield':'deduction_details',
-		'doctype':'Deduction Detail',
+		'doctype':'Salary Structure Deduction',
 		'd_type':'TDS',
 		'd_modified_amt':20
 	})
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.js b/erpnext/hr/doctype/salary_slip/salary_slip.js
index 0dc7ad9..5fe93a6 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.js
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.js
@@ -79,7 +79,7 @@
 // Calculate earning total
 // ------------------------------------------------------------------------
 var calculate_earning_total = function(doc, dt, dn) {
-	var tbl = getchildren('SS Earning Detail', doc.name, 'earning_details', doc.doctype);
+	var tbl = getchildren('Salary Slip Earning', doc.name, 'earning_details', doc.doctype);
 
 	var total_earn = 0;
 	for(var i = 0; i < tbl.length; i++){
@@ -96,7 +96,7 @@
 // Calculate deduction total
 // ------------------------------------------------------------------------
 var calculate_ded_total = function(doc, dt, dn) {
-	var tbl = getchildren('SS Deduction Detail', doc.name, 'deduction_details', doc.doctype);
+	var tbl = getchildren('Salary Slip Deduction', doc.name, 'deduction_details', doc.doctype);
 
 	var total_ded = 0;
 	for(var i = 0; i < tbl.length; i++){
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py
index e0313a4..0350404 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.py
@@ -73,7 +73,7 @@
 		self.doc.clear_table(self.doclist, 'earning_details')
 		self.doc.clear_table(self.doclist, 'deduction_details')
 
-		get_obj('DocType Mapper', 'Salary Structure-Salary Slip').dt_map('Salary Structure', 'Salary Slip', struct, self.doc, self.doclist, "[['Salary Structure', 'Salary Slip'],['Earning Detail', 'SS Earning Detail'],['Deduction Detail','SS Deduction Detail']]")
+		get_obj('DocType Mapper', 'Salary Structure-Salary Slip').dt_map('Salary Structure', 'Salary Slip', struct, self.doc, self.doclist, "[['Salary Structure', 'Salary Slip'],['Salary Structure Earning', 'Salary Slip Earning'],['Salary Structure Deduction','Salary Slip Deduction']]")
 
 		basic_info = sql("select bank_name, bank_ac_no, esic_card_no, pf_number from `tabEmployee` where name ='%s'" % self.doc.employee)
 		self.doc.bank_name = basic_info[0][0]
@@ -109,9 +109,9 @@
 	# Calculate LWP
 	#=======================================================
 	def calculate_lwp(self, m):
-		holidays = sql("select t1.holiday_date from `tabHoliday List Detail` t1, tabEmployee t2 where t1.parent = t2.holiday_list and t2.name = '%s' and t1.holiday_date between '%s' and '%s'" % (self.doc.employee, m[1], m[2]))
+		holidays = sql("select t1.holiday_date from `tabHoliday` t1, tabEmployee t2 where t1.parent = t2.holiday_list and t2.name = '%s' and t1.holiday_date between '%s' and '%s'" % (self.doc.employee, m[1], m[2]))
 		if not holidays:
-			holidays = sql("select t1.holiday_date from `tabHoliday List Detail` t1, `tabHoliday List` t2 where t1.parent = t2.name and ifnull(t2.is_default, 0) = 1 and t2.fiscal_year = '%s'" % self.doc.fiscal_year)
+			holidays = sql("select t1.holiday_date from `tabHoliday` t1, `tabHoliday List` t2 where t1.parent = t2.name and ifnull(t2.is_default, 0) = 1 and t2.fiscal_year = '%s'" % self.doc.fiscal_year)
 		holidays = [cstr(i[0]) for i in holidays]
 		lwp = 0
 		for d in range(m[3]):
@@ -192,8 +192,8 @@
 		if emailid_ret:
 			receiver = cstr(emailid_ret[0][0]) 
 			subj = 'Salary Slip - ' + cstr(self.doc.month) +'/'+cstr(self.doc.fiscal_year)
-			earn_ret=sql("select e_type,e_modified_amount from `tabSS Earning Detail` where parent = '%s'"%self.doc.name)
-			ded_ret=sql("select d_type,d_modified_amount from `tabSS Deduction Detail` where parent = '%s'"%self.doc.name)
+			earn_ret=sql("select e_type,e_modified_amount from `tabSalary Slip Earning` where parent = '%s'"%self.doc.name)
+			ded_ret=sql("select d_type,d_modified_amount from `tabSalary Slip Deduction` where parent = '%s'"%self.doc.name)
 		 
 			earn_table = ''
 			ded_table = ''
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.txt b/erpnext/hr/doctype/salary_slip/salary_slip.txt
index 423b6c0..398b2b3 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.txt
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.txt
@@ -3,74 +3,60 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:20',
+		'creation': '2012-03-27 14:36:00',
 		'docstatus': 0,
-		'modified': '2011-07-27 13:10:28',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:45:51',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1310019491',
-		'colour': 'White:FFF',
+		'_last_update': u'1310019491',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'module': 'HR',
+		'is_submittable': 1,
+		'module': u'HR',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'subject': 'For %(employee_name)s, %(designation)s',
+		'subject': u'For %(employee_name)s, %(designation)s',
 		'version': 393
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Salary Slip',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Salary Slip',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Salary Slip',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Salary Slip',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Salary Slip
 	{
 		'doctype': 'DocType',
-		'name': 'Salary Slip'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'match': 'owner',
-		'permlevel': 0,
-		'role': 'Employee',
-		'submit': 0,
-		'write': 0
+		'name': u'Salary Slip'
 	},
 
 	# DocPerm
 	{
 		'amend': 0,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 2,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'HR User',
+		'role': u'HR User',
 		'submit': 1,
 		'write': 1
 	},
@@ -80,62 +66,58 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 3,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'HR Manager',
+		'role': u'HR Manager',
 		'submit': 1,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 4,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'HR User'
+		'role': u'HR User'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 5,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'HR Manager'
+		'role': u'HR Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 1,
-		'label': 'Basic Info',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'basic_info',
+		'fieldtype': u'Section Break',
+		'label': u'Basic Info',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 2,
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'employee',
-		'fieldtype': 'Link',
-		'idx': 3,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'employee',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Employee',
-		'oldfieldname': 'employee',
-		'oldfieldtype': 'Link',
-		'options': 'Employee',
+		'label': u'Employee',
+		'oldfieldname': u'employee',
+		'oldfieldtype': u'Link',
+		'options': u'Employee',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1
@@ -143,29 +125,27 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'employee_name',
-		'fieldtype': 'Data',
-		'idx': 4,
+		'doctype': u'DocField',
+		'fieldname': u'employee_name',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Employee Name',
-		'oldfieldname': 'employee_name',
-		'oldfieldtype': 'Data',
+		'label': u'Employee Name',
+		'oldfieldname': u'employee_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 1,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'department',
-		'fieldtype': 'Link',
-		'idx': 5,
+		'doctype': u'DocField',
+		'fieldname': u'department',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Department',
-		'oldfieldname': 'department',
-		'oldfieldtype': 'Link',
-		'options': 'Department',
+		'label': u'Department',
+		'oldfieldname': u'department',
+		'oldfieldtype': u'Link',
+		'options': u'Department',
 		'permlevel': 1,
 		'reqd': 0,
 		'search_index': 0
@@ -173,106 +153,99 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'designation',
-		'fieldtype': 'Link',
-		'idx': 6,
+		'doctype': u'DocField',
+		'fieldname': u'designation',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Designation',
-		'oldfieldname': 'designation',
-		'oldfieldtype': 'Link',
-		'options': 'Designation',
+		'label': u'Designation',
+		'oldfieldname': u'designation',
+		'oldfieldtype': u'Link',
+		'options': u'Designation',
 		'permlevel': 1,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'branch',
-		'fieldtype': 'Link',
-		'idx': 7,
+		'doctype': u'DocField',
+		'fieldname': u'branch',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Branch',
-		'oldfieldname': 'branch',
-		'oldfieldtype': 'Link',
-		'options': 'Branch',
+		'label': u'Branch',
+		'oldfieldname': u'branch',
+		'oldfieldtype': u'Link',
+		'options': u'Branch',
 		'permlevel': 1,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'grade',
-		'fieldtype': 'Link',
-		'idx': 8,
+		'doctype': u'DocField',
+		'fieldname': u'grade',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Grade',
-		'oldfieldname': 'grade',
-		'oldfieldtype': 'Link',
-		'options': 'Grade',
+		'label': u'Grade',
+		'oldfieldname': u'grade',
+		'oldfieldtype': u'Link',
+		'options': u'Grade',
 		'permlevel': 1,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'pf_no',
-		'fieldtype': 'Data',
-		'idx': 9,
-		'label': 'PF No.',
-		'oldfieldname': 'pf_no',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'pf_no',
+		'fieldtype': u'Data',
+		'label': u'PF No.',
+		'oldfieldname': u'pf_no',
+		'oldfieldtype': u'Data',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'esic_no',
-		'fieldtype': 'Data',
-		'idx': 10,
-		'label': 'ESIC No.',
-		'oldfieldname': 'esic_no',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'esic_no',
+		'fieldtype': u'Data',
+		'label': u'ESIC No.',
+		'oldfieldname': u'esic_no',
+		'oldfieldtype': u'Data',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'letter_head',
-		'fieldtype': 'Link',
-		'idx': 11,
-		'label': 'Letter Head',
-		'options': 'Letter Head',
+		'doctype': u'DocField',
+		'fieldname': u'letter_head',
+		'fieldtype': u'Link',
+		'label': u'Letter Head',
+		'options': u'Letter Head',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 12,
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Link',
-		'idx': 13,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Fiscal Year',
-		'oldfieldname': 'fiscal_year',
-		'oldfieldtype': 'Data',
-		'options': 'Fiscal Year',
+		'label': u'Fiscal Year',
+		'oldfieldname': u'fiscal_year',
+		'oldfieldtype': u'Data',
+		'options': u'Fiscal Year',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 0
@@ -280,111 +253,103 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Select',
-		'idx': 14,
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Company',
-		'options': 'link:Company',
+		'label': u'Company',
+		'options': u'link:Company',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'month',
-		'fieldtype': 'Select',
-		'idx': 15,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'month',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Month',
-		'oldfieldname': 'month',
-		'oldfieldtype': 'Select',
-		'options': '\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12',
+		'label': u'Month',
+		'oldfieldname': u'month',
+		'oldfieldtype': u'Select',
+		'options': u'\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1,
-		'trigger': 'Client',
-		'width': '37%'
+		'trigger': u'Client',
+		'width': u'37%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'total_days_in_month',
-		'fieldtype': 'Data',
-		'idx': 16,
-		'label': 'Total days in month',
-		'oldfieldname': 'total_days_in_month',
-		'oldfieldtype': 'Int',
+		'doctype': u'DocField',
+		'fieldname': u'total_days_in_month',
+		'fieldtype': u'Data',
+		'label': u'Total days in month',
+		'oldfieldname': u'total_days_in_month',
+		'oldfieldtype': u'Int',
 		'permlevel': 1,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'leave_without_pay',
-		'fieldtype': 'Currency',
-		'idx': 17,
-		'label': 'Leave Without Pay',
-		'oldfieldname': 'leave_without_pay',
-		'oldfieldtype': 'Currency',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'leave_without_pay',
+		'fieldtype': u'Currency',
+		'label': u'Leave Without Pay',
+		'oldfieldname': u'leave_without_pay',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'payment_days',
-		'fieldtype': 'Float',
-		'idx': 18,
-		'label': 'Payment days',
-		'oldfieldname': 'payment_days',
-		'oldfieldtype': 'Float',
+		'doctype': u'DocField',
+		'fieldname': u'payment_days',
+		'fieldtype': u'Float',
+		'label': u'Payment days',
+		'oldfieldname': u'payment_days',
+		'oldfieldtype': u'Float',
 		'permlevel': 1,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'bank_name',
-		'fieldtype': 'Data',
-		'idx': 19,
-		'label': 'Bank Name',
-		'oldfieldname': 'bank_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'bank_name',
+		'fieldtype': u'Data',
+		'label': u'Bank Name',
+		'oldfieldname': u'bank_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'bank_account_no',
-		'fieldtype': 'Data',
-		'idx': 20,
-		'label': 'Bank Account No.',
-		'oldfieldname': 'bank_account_no',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'bank_account_no',
+		'fieldtype': u'Data',
+		'label': u'Bank Account No.',
+		'oldfieldname': u'bank_account_no',
+		'oldfieldtype': u'Data',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'email_check',
-		'fieldtype': 'Check',
-		'idx': 21,
-		'label': 'Email',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'email_check',
+		'fieldtype': u'Check',
+		'label': u'Email',
 		'no_copy': 1,
-		'oldfieldname': 'email_check',
-		'oldfieldtype': 'Check',
+		'oldfieldname': u'email_check',
+		'oldfieldtype': u'Check',
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 1
@@ -392,15 +357,14 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amended_from',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Data',
 		'hidden': 0,
-		'idx': 22,
-		'label': 'Amended From',
+		'label': u'Amended From',
 		'no_copy': 1,
-		'oldfieldname': 'amended_from',
-		'oldfieldtype': 'Data',
+		'oldfieldname': u'amended_from',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 0
@@ -408,15 +372,14 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amendment_date',
-		'fieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
 		'hidden': 0,
-		'idx': 23,
-		'label': 'Amendment Date',
+		'label': u'Amendment Date',
 		'no_copy': 1,
-		'oldfieldname': 'amendment_date',
-		'oldfieldtype': 'Date',
+		'oldfieldname': u'amendment_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 0
@@ -424,179 +387,170 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 24,
-		'label': 'Earning & Deduction',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'earning_deduction',
+		'fieldtype': u'Section Break',
+		'label': u'Earning & Deduction',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 25,
-		'label': 'Earning',
-		'oldfieldtype': 'Column Break',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'earning',
+		'fieldtype': u'Column Break',
+		'label': u'Earning',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
 		'reqd': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'earning_details',
-		'fieldtype': 'Table',
-		'idx': 26,
-		'label': 'Earning Details',
-		'oldfieldname': 'earning_details',
-		'oldfieldtype': 'Table',
-		'options': 'SS Earning Detail',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'earning_details',
+		'fieldtype': u'Table',
+		'label': u'Salary Structure Earnings',
+		'oldfieldname': u'earning_details',
+		'oldfieldtype': u'Table',
+		'options': u'Salary Slip Earning',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 27,
-		'label': 'Deduction',
-		'oldfieldtype': 'Column Break',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'deduction',
+		'fieldtype': u'Column Break',
+		'label': u'Deduction',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'deduction_details',
-		'fieldtype': 'Table',
-		'idx': 28,
-		'label': 'Deduction Details',
-		'oldfieldname': 'deduction_details',
-		'oldfieldtype': 'Table',
-		'options': 'SS Deduction Detail',
+		'doctype': u'DocField',
+		'fieldname': u'deduction_details',
+		'fieldtype': u'Table',
+		'label': u'Deductions',
+		'oldfieldname': u'deduction_details',
+		'oldfieldtype': u'Table',
+		'options': u'Salary Slip Deduction',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 29,
-		'label': 'Totals',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'totals',
+		'fieldtype': u'Section Break',
+		'label': u'Totals',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 30,
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break2',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'arrear_amount',
-		'fieldtype': 'Currency',
-		'idx': 31,
-		'label': 'Arrear Amount',
-		'oldfieldname': 'arrear_amount',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'arrear_amount',
+		'fieldtype': u'Currency',
+		'label': u'Arrear Amount',
+		'oldfieldname': u'arrear_amount',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'leave_encashment_amount',
-		'fieldtype': 'Currency',
-		'idx': 32,
-		'label': 'Leave Encashment Amount',
-		'oldfieldname': 'encashment_amount',
-		'oldfieldtype': 'Currency',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'leave_encashment_amount',
+		'fieldtype': u'Currency',
+		'label': u'Leave Encashment Amount',
+		'oldfieldname': u'encashment_amount',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'gross_pay',
-		'fieldtype': 'Currency',
-		'idx': 33,
-		'label': 'Gross Pay',
-		'oldfieldname': 'gross_pay',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'gross_pay',
+		'fieldtype': u'Currency',
+		'label': u'Gross Pay',
+		'oldfieldname': u'gross_pay',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'total_deduction',
-		'fieldtype': 'Currency',
-		'idx': 34,
-		'label': 'Total Deduction',
-		'oldfieldname': 'total_deduction',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'total_deduction',
+		'fieldtype': u'Currency',
+		'label': u'Total Deduction',
+		'oldfieldname': u'total_deduction',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 35,
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break3',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Gross Pay + Arrear Amount +Encashment Amount - Total Deduction',
-		'doctype': 'DocField',
-		'fieldname': 'net_pay',
-		'fieldtype': 'Currency',
-		'idx': 36,
-		'label': 'Net Pay',
-		'oldfieldname': 'net_pay',
-		'oldfieldtype': 'Currency',
+		'colour': u'White:FFF',
+		'description': u'Gross Pay + Arrear Amount +Encashment Amount - Total Deduction',
+		'doctype': u'DocField',
+		'fieldname': u'net_pay',
+		'fieldtype': u'Currency',
+		'label': u'Net Pay',
+		'oldfieldname': u'net_pay',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'rounded_total',
-		'fieldtype': 'Currency',
-		'idx': 37,
-		'label': 'Rounded Total',
+		'doctype': u'DocField',
+		'fieldname': u'rounded_total',
+		'fieldtype': u'Currency',
+		'label': u'Rounded Total',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'description': 'Net Pay (in words) will be visible once you save the Salary Slip.',
-		'doctype': 'DocField',
-		'fieldname': 'total_in_words',
-		'fieldtype': 'Data',
-		'idx': 38,
-		'label': 'Total in words',
-		'oldfieldname': 'net_pay_in_words',
-		'oldfieldtype': 'Data',
+		'description': u'Net Pay (in words) will be visible once you save the Salary Slip.',
+		'doctype': u'DocField',
+		'fieldname': u'total_in_words',
+		'fieldtype': u'Data',
+		'label': u'Total in words',
+		'oldfieldname': u'net_pay_in_words',
+		'oldfieldtype': u'Data',
 		'permlevel': 1
 	}
-]
\ No newline at end of file
+]
diff --git a/erpnext/hr/doctype/absent_days_detail/__init__.py b/erpnext/hr/doctype/salary_slip_deduction/__init__.py
similarity index 100%
copy from erpnext/hr/doctype/absent_days_detail/__init__.py
copy to erpnext/hr/doctype/salary_slip_deduction/__init__.py
diff --git a/erpnext/hr/doctype/salary_slip_deduction/salary_slip_deduction.txt b/erpnext/hr/doctype/salary_slip_deduction/salary_slip_deduction.txt
new file mode 100644
index 0000000..e76a1ba
--- /dev/null
+++ b/erpnext/hr/doctype/salary_slip_deduction/salary_slip_deduction.txt
@@ -0,0 +1,104 @@
+# DocType, Salary Slip Deduction
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:00',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:00',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'HR',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 9
+	},
+
+	# These values are common for all DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Salary Slip Deduction',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# These values are common for all DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Salary Slip Deduction',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': u'System Manager',
+		'write': 1
+	},
+
+	# DocType, Salary Slip Deduction
+	{
+		'doctype': 'DocType',
+		'name': u'Salary Slip Deduction'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'd_type',
+		'fieldtype': u'Link',
+		'label': u'Type',
+		'oldfieldname': u'd_type',
+		'oldfieldtype': u'Data',
+		'options': u'Deduction Type',
+		'permlevel': 0,
+		'width': u'200px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'd_amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount',
+		'oldfieldname': u'd_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'd_modified_amount',
+		'fieldtype': u'Currency',
+		'label': u'Modified Amount',
+		'permlevel': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'd_depends_on_lwp',
+		'fieldtype': u'Check',
+		'label': u'Depends on LWP',
+		'permlevel': 0,
+		'trigger': u'Client'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/ss_deduction_detail/__init__.py b/erpnext/hr/doctype/salary_slip_earning/__init__.py
similarity index 100%
rename from erpnext/hr/doctype/ss_deduction_detail/__init__.py
rename to erpnext/hr/doctype/salary_slip_earning/__init__.py
diff --git a/erpnext/hr/doctype/salary_slip_earning/salary_slip_earning.txt b/erpnext/hr/doctype/salary_slip_earning/salary_slip_earning.txt
new file mode 100644
index 0000000..d8c4c9b
--- /dev/null
+++ b/erpnext/hr/doctype/salary_slip_earning/salary_slip_earning.txt
@@ -0,0 +1,105 @@
+# DocType, Salary Slip Earning
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:00',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:00',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'HR',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 7
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Salary Slip Earning',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# These values are common for all DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Salary Slip Earning',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': u'System Manager',
+		'write': 1
+	},
+
+	# DocType, Salary Slip Earning
+	{
+		'doctype': 'DocType',
+		'name': u'Salary Slip Earning'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'e_type',
+		'fieldtype': u'Link',
+		'label': u'Type',
+		'oldfieldname': u'e_type',
+		'oldfieldtype': u'Data',
+		'options': u'Earning Type',
+		'permlevel': 0,
+		'width': u'200px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'e_amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount',
+		'oldfieldname': u'e_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'e_modified_amount',
+		'fieldtype': u'Currency',
+		'label': u'Modified Amount',
+		'permlevel': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'e_depends_on_lwp',
+		'fieldtype': u'Check',
+		'label': u'Depends on LWP',
+		'permlevel': 0,
+		'trigger': u'Client'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.js b/erpnext/hr/doctype/salary_structure/salary_structure.js
index fe57910..2cfab81 100644
--- a/erpnext/hr/doctype/salary_structure/salary_structure.js
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.js
@@ -19,8 +19,8 @@
 // On load
 //=======================================================================
 cur_frm.cscript.onload = function(doc, dt, dn){
-  e_tbl = getchildren('Earning Detail', doc.name, 'earning_details', doc.doctype);
-  d_tbl = getchildren('Deduction Detail', doc.name, 'deduction_details', doc.doctype);
+  e_tbl = getchildren('Salary Structure Earning', doc.name, 'earning_details', doc.doctype);
+  d_tbl = getchildren('Salary Structure Deduction', doc.name, 'deduction_details', doc.doctype);
   if (e_tbl.length == 0 && d_tbl.length == 0)
     $c_obj(make_doclist(doc.doctype,doc.name),'make_earn_ded_table','', function(r, rt) { refresh_many(['earning_details', 'deduction_details']);});
 }
@@ -29,7 +29,6 @@
 //=======================================================================
 cur_frm.cscript.refresh = function(doc, dt, dn){
   if((!doc.__islocal) && (doc.is_active == 'Yes')){
-    cur_frm.add_custom_button('Make IT Checklist', cur_frm.cscript['Make IT Checklist']);
     cur_frm.add_custom_button('Make Salary Slip', cur_frm.cscript['Make Salary Slip']);
   
     get_field(doc.doctype, 'employee', doc.name).permlevel = 1;
@@ -37,16 +36,6 @@
   }
 }
 
-// Make IT checklist
-//=======================================================================
-cur_frm.cscript['Make IT Checklist']=function(){
-  var itc = LocalDB.create('IT Checklist');
-  itc = locals['IT Checklist'][itc];
-  itc.employee = cur_frm.doc.employee;
-  itc.fiscal_year = sys_defaults.fiscal_year;
-  itc.is_cheklist_active='Yes';
-  loaddoc('IT Checklist', itc.name);
-}
 
 // Make Salry Slip
 //=======================================================================
@@ -60,7 +49,7 @@
       'from_doctype':'Salary Structure',
       'to_doctype':'Salary Slip',
       'from_docname':doc.name,
-      'from_to_list':"[['Salary Structure', 'Salary Slip'], ['Earning Detail', 'SS Earning Detail'], ['Deduction Detail', 'SS Deduction Detail']]"
+      'from_to_list':"[['Salary Structure', 'Salary Slip'], ['Salary Structure Earning', 'Salary Slip Earning'], ['Salary Structure Deduction', 'Salary Slip Deduction']]"
       }, 
       function(r,rt) {
         n.fiscal_year = sys_defaults.fiscal_year;
@@ -98,8 +87,8 @@
 // calculate totals
 //=======================================================================
 var calculate_totals = function(doc, cdt, cdn) {
-  var tbl1 = getchildren('Earning Detail', doc.name, 'earning_details', doc.doctype);
-  var tbl2 = getchildren('Deduction Detail', doc.name, 'deduction_details', doc.doctype);
+  var tbl1 = getchildren('Salary Structure Earning', doc.name, 'earning_details', doc.doctype);
+  var tbl2 = getchildren('Salary Structure Deduction', doc.name, 'deduction_details', doc.doctype);
   
   var total_earn = 0; var total_ded = 0;
   for(var i = 0; i < tbl1.length; i++){
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.py b/erpnext/hr/doctype/salary_structure/salary_structure.py
index 562a885..18d9291 100644
--- a/erpnext/hr/doctype/salary_structure/salary_structure.py
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.py
@@ -88,10 +88,10 @@
   #---------------------------------------------------------   
   def make_earn_ded_table(self):           
     #Earning List
-    self.make_table('Earning Type','earning_details','Earning Detail')
+    self.make_table('Earning Type','earning_details','Salary Structure Earning')
     
     #Deduction List
-    self.make_table('Deduction Type','deduction_details', 'Deduction Detail')
+    self.make_table('Deduction Type','deduction_details', 'Salary Structure Deduction')
     
 
   # Check if another active ss exists
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.txt b/erpnext/hr/doctype/salary_structure/salary_structure.txt
index d9a9acd..e760f74 100644
--- a/erpnext/hr/doctype/salary_structure/salary_structure.txt
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.txt
@@ -3,425 +3,442 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 16:50:05',
+		'creation': '2012-03-27 14:36:00',
 		'docstatus': 0,
-		'modified': '2011-08-11 16:56:38',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:00',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1311621379',
-		'colour': 'White:FFF',
+		'_last_update': u'1311621379',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'module': 'HR',
+		'module': u'HR',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'subject': 'For %(employee_name)s',
+		'subject': u'For %(employee_name)s',
 		'version': 587
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Salary Structure',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Salary Structure',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'amend': 0,
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Salary Structure',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Salary Structure',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Salary Structure
 	{
 		'doctype': 'DocType',
-		'name': 'Salary Structure'
+		'name': u'Salary Structure'
 	},
 
 	# DocPerm
 	{
-		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
+		'match': u'owner',
 		'permlevel': 0,
-		'role': 'Employee',
 		'submit': 0,
 		'write': 0
 	},
 
 	# DocPerm
 	{
-		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 2,
+		'doctype': u'DocPerm',
+		'match': u'owner',
+		'permlevel': 0,
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'match': u'owner',
+		'permlevel': 0,
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'match': u'owner',
+		'permlevel': 0,
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'All',
-		'submit': 0,
+		'role': u'All',
 		'write': 0
 	},
 
 	# DocPerm
 	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'permlevel': 0,
-		'role': 'HR User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 4,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'HR Manager',
-		'submit': 1,
+		'role': u'HR User',
 		'write': 1
 	},
 
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'HR Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'HR Manager'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'HR User'
+	},
+
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 1,
-		'label': 'Basic Info',
-		'oldfieldname': 'basic_info',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'basic_info',
+		'fieldtype': u'Section Break',
+		'label': u'Basic Info',
+		'oldfieldname': u'basic_info',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 2,
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'employee',
-		'fieldtype': 'Link',
-		'idx': 3,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'employee',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Employee',
-		'oldfieldname': 'employee',
-		'oldfieldtype': 'Link',
-		'options': 'Employee',
+		'label': u'Employee',
+		'oldfieldname': u'employee',
+		'oldfieldtype': u'Link',
+		'options': u'Employee',
 		'permlevel': 0,
 		'reqd': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'employee_name',
-		'fieldtype': 'Data',
-		'idx': 4,
-		'label': 'Employee Name',
-		'oldfieldname': 'employee_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'employee_name',
+		'fieldtype': u'Data',
+		'label': u'Employee Name',
+		'oldfieldname': u'employee_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'branch',
-		'fieldtype': 'Select',
-		'idx': 5,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'branch',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Branch',
-		'oldfieldname': 'branch',
-		'oldfieldtype': 'Select',
-		'options': 'link:Branch',
+		'label': u'Branch',
+		'oldfieldname': u'branch',
+		'oldfieldtype': u'Select',
+		'options': u'link:Branch',
 		'permlevel': 1,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'designation',
-		'fieldtype': 'Select',
-		'idx': 6,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'designation',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Designation',
-		'oldfieldname': 'designation',
-		'oldfieldtype': 'Select',
-		'options': 'link:Designation',
+		'label': u'Designation',
+		'oldfieldname': u'designation',
+		'oldfieldtype': u'Select',
+		'options': u'link:Designation',
 		'permlevel': 1,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'department',
-		'fieldtype': 'Select',
-		'idx': 7,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'department',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Department',
-		'oldfieldname': 'department',
-		'oldfieldtype': 'Select',
-		'options': 'link:Department',
+		'label': u'Department',
+		'oldfieldname': u'department',
+		'oldfieldtype': u'Select',
+		'options': u'link:Department',
 		'permlevel': 1,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'grade',
-		'fieldtype': 'Select',
-		'idx': 8,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'grade',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Grade',
-		'oldfieldname': 'grade',
-		'oldfieldtype': 'Select',
-		'options': 'link:Grade',
+		'label': u'Grade',
+		'oldfieldname': u'grade',
+		'oldfieldtype': u'Select',
+		'options': u'link:Grade',
 		'permlevel': 1,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 9,
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'Yes',
-		'doctype': 'DocField',
-		'fieldname': 'is_active',
-		'fieldtype': 'Select',
-		'idx': 10,
+		'colour': u'White:FFF',
+		'default': u'Yes',
+		'doctype': u'DocField',
+		'fieldname': u'is_active',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Is Active',
-		'oldfieldname': 'is_active',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'label': u'Is Active',
+		'oldfieldname': u'is_active',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'from_date',
-		'fieldtype': 'Date',
-		'idx': 11,
-		'label': 'From Date',
-		'oldfieldname': 'from_date',
-		'oldfieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'from_date',
+		'fieldtype': u'Date',
+		'label': u'From Date',
+		'oldfieldname': u'from_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'to_date',
-		'fieldtype': 'Date',
-		'idx': 12,
-		'label': 'To Date',
-		'oldfieldname': 'to_date',
-		'oldfieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'to_date',
+		'fieldtype': u'Date',
+		'label': u'To Date',
+		'oldfieldname': u'to_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Cost to Company',
-		'doctype': 'DocField',
-		'fieldname': 'ctc',
-		'fieldtype': 'Currency',
-		'idx': 13,
+		'colour': u'White:FFF',
+		'description': u'Cost to Company',
+		'doctype': u'DocField',
+		'fieldname': u'ctc',
+		'fieldtype': u'Currency',
 		'in_filter': 1,
-		'label': 'CTC',
-		'oldfieldname': 'ctc',
-		'oldfieldtype': 'Currency',
+		'label': u'CTC',
+		'oldfieldname': u'ctc',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Select',
-		'idx': 14,
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Company',
-		'options': 'link:Company',
+		'label': u'Company',
+		'options': u'link:Company',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'description': 'You can create more earning and deduction type from Setup --> HR',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 15,
-		'label': 'Earning & Deduction',
-		'oldfieldname': 'earning_deduction',
-		'oldfieldtype': 'Section Break',
+		'description': u'You can create more earning and deduction type from Setup --> HR',
+		'doctype': u'DocField',
+		'fieldname': u'earning_deduction',
+		'fieldtype': u'Section Break',
+		'label': u'Earning & Deduction',
+		'oldfieldname': u'earning_deduction',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'earning',
+		'fieldtype': u'Column Break',
 		'hidden': 0,
-		'idx': 16,
-		'label': 'Earning',
-		'oldfieldname': 'col_brk2',
-		'oldfieldtype': 'Column Break',
+		'label': u'Earning',
+		'oldfieldname': u'col_brk2',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'earning_details',
-		'fieldtype': 'Table',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'earning_details',
+		'fieldtype': u'Table',
 		'hidden': 0,
-		'idx': 17,
-		'label': 'Earning1',
-		'oldfieldname': 'earning_details',
-		'oldfieldtype': 'Table',
-		'options': 'Earning Detail',
+		'label': u'Earning1',
+		'oldfieldname': u'earning_details',
+		'oldfieldtype': u'Table',
+		'options': u'Salary Structure Earning',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'deduction',
+		'fieldtype': u'Column Break',
 		'hidden': 0,
-		'idx': 18,
-		'label': 'Deduction',
-		'oldfieldname': 'col_brk3',
-		'oldfieldtype': 'Column Break',
+		'label': u'Deduction',
+		'oldfieldname': u'col_brk3',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'deduction_details',
-		'fieldtype': 'Table',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'deduction_details',
+		'fieldtype': u'Table',
 		'hidden': 0,
-		'idx': 19,
-		'label': 'Deduction1',
-		'oldfieldname': 'deduction_details',
-		'oldfieldtype': 'Table',
-		'options': 'Deduction Detail',
+		'label': u'Deduction1',
+		'oldfieldname': u'deduction_details',
+		'oldfieldtype': u'Table',
+		'options': u'Salary Structure Deduction',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 20,
-		'options': 'Simple',
+		'doctype': u'DocField',
+		'fieldname': u'section_break0',
+		'fieldtype': u'Section Break',
+		'options': u'Simple',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 21,
+		'doctype': u'DocField',
+		'fieldname': u'column_break2',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'total_earning',
-		'fieldtype': 'Currency',
-		'idx': 22,
-		'label': 'Total Earning',
-		'oldfieldname': 'total_earning',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'total_earning',
+		'fieldtype': u'Currency',
+		'label': u'Total Earning',
+		'oldfieldname': u'total_earning',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'total_deduction',
-		'fieldtype': 'Currency',
-		'idx': 23,
-		'label': 'Total Deduction',
-		'oldfieldname': 'total_deduction',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'total_deduction',
+		'fieldtype': u'Currency',
+		'label': u'Total Deduction',
+		'oldfieldname': u'total_deduction',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 24,
+		'doctype': u'DocField',
+		'fieldname': u'column_break3',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'net_pay',
-		'fieldtype': 'Currency',
-		'idx': 25,
-		'label': 'Net Pay',
+		'doctype': u'DocField',
+		'fieldname': u'net_pay',
+		'fieldtype': u'Currency',
+		'label': u'Net Pay',
 		'permlevel': 1
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/ss_deduction_detail/__init__.py b/erpnext/hr/doctype/salary_structure_deduction/__init__.py
similarity index 100%
copy from erpnext/hr/doctype/ss_deduction_detail/__init__.py
copy to erpnext/hr/doctype/salary_structure_deduction/__init__.py
diff --git a/erpnext/hr/doctype/salary_structure_deduction/salary_structure_deduction.txt b/erpnext/hr/doctype/salary_structure_deduction/salary_structure_deduction.txt
new file mode 100644
index 0000000..1815ca3
--- /dev/null
+++ b/erpnext/hr/doctype/salary_structure_deduction/salary_structure_deduction.txt
@@ -0,0 +1,74 @@
+# DocType, Salary Structure Deduction
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:54',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:54',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'HR',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 14
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Salary Structure Deduction',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# DocType, Salary Structure Deduction
+	{
+		'doctype': 'DocType',
+		'name': u'Salary Structure Deduction'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'd_type',
+		'fieldtype': u'Link',
+		'label': u'Type',
+		'oldfieldname': u'd_type',
+		'oldfieldtype': u'Select',
+		'options': u'Deduction Type',
+		'reqd': 1,
+		'width': u'200px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'd_modified_amt',
+		'fieldtype': u'Currency',
+		'label': u'Amount',
+		'oldfieldname': u'd_modified_amt',
+		'oldfieldtype': u'Currency'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'depend_on_lwp',
+		'fieldtype': u'Check',
+		'label': u'Depend on LWP',
+		'oldfieldname': u'depend_on_lwp',
+		'oldfieldtype': u'Check'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/absent_days_detail/__init__.py b/erpnext/hr/doctype/salary_structure_earning/__init__.py
similarity index 100%
copy from erpnext/hr/doctype/absent_days_detail/__init__.py
copy to erpnext/hr/doctype/salary_structure_earning/__init__.py
diff --git a/erpnext/hr/doctype/salary_structure_earning/salary_structure_earning.txt b/erpnext/hr/doctype/salary_structure_earning/salary_structure_earning.txt
new file mode 100644
index 0000000..09ac7f5
--- /dev/null
+++ b/erpnext/hr/doctype/salary_structure_earning/salary_structure_earning.txt
@@ -0,0 +1,77 @@
+# DocType, Salary Structure Earning
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:35:54',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:35:54',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'hide_heading': 0,
+		'hide_toolbar': 0,
+		'istable': 1,
+		'module': u'HR',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 26
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Salary Structure Earning',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# DocType, Salary Structure Earning
+	{
+		'doctype': 'DocType',
+		'name': u'Salary Structure Earning'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'e_type',
+		'fieldtype': u'Link',
+		'label': u'Type',
+		'oldfieldname': u'e_type',
+		'oldfieldtype': u'Data',
+		'options': u'Earning Type',
+		'reqd': 1,
+		'width': u'200px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'modified_value',
+		'fieldtype': u'Currency',
+		'label': u'Amount',
+		'oldfieldname': u'modified_value',
+		'oldfieldtype': u'Currency',
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'depend_on_lwp',
+		'fieldtype': u'Check',
+		'label': u'Depend on LWP',
+		'oldfieldname': u'depend_on_lwp',
+		'oldfieldtype': u'Check'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/ss_deduction_detail/ss_deduction_detail.txt b/erpnext/hr/doctype/ss_deduction_detail/ss_deduction_detail.txt
deleted file mode 100644
index e760226..0000000
--- a/erpnext/hr/doctype/ss_deduction_detail/ss_deduction_detail.txt
+++ /dev/null
@@ -1,109 +0,0 @@
-# DocType, SS Deduction Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:24',
-		'docstatus': 0,
-		'modified': '2011-02-12 18:24:31',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'HR',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 9
-	},
-
-	# These values are common for all DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'SS Deduction Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'name': '__common__',
-		'parent': 'SS Deduction Detail',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'permlevel': 0,
-		'read': 1,
-		'role': 'System Manager',
-		'write': 1
-	},
-
-	# DocType, SS Deduction Detail
-	{
-		'doctype': 'DocType',
-		'name': 'SS Deduction Detail'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'd_type',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Type',
-		'oldfieldname': 'd_type',
-		'oldfieldtype': 'Data',
-		'options': 'Deduction Type',
-		'permlevel': 0,
-		'width': '200px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'd_amount',
-		'fieldtype': 'Currency',
-		'idx': 2,
-		'label': 'Amount',
-		'oldfieldname': 'd_amount',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'd_modified_amount',
-		'fieldtype': 'Currency',
-		'idx': 3,
-		'label': 'Modified Amount',
-		'permlevel': 0,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'd_depends_on_lwp',
-		'fieldtype': 'Check',
-		'idx': 4,
-		'label': 'Depends on LWP',
-		'permlevel': 0,
-		'trigger': 'Client'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/ss_earning_detail/__init__.py b/erpnext/hr/doctype/ss_earning_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/doctype/ss_earning_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/doctype/ss_earning_detail/ss_earning_detail.txt b/erpnext/hr/doctype/ss_earning_detail/ss_earning_detail.txt
deleted file mode 100644
index 10931d1..0000000
--- a/erpnext/hr/doctype/ss_earning_detail/ss_earning_detail.txt
+++ /dev/null
@@ -1,110 +0,0 @@
-# DocType, SS Earning Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:24',
-		'docstatus': 0,
-		'modified': '2011-02-12 18:24:20',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'HR',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 7
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'SS Earning Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'name': '__common__',
-		'parent': 'SS Earning Detail',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'permlevel': 0,
-		'read': 1,
-		'role': 'System Manager',
-		'write': 1
-	},
-
-	# DocType, SS Earning Detail
-	{
-		'doctype': 'DocType',
-		'name': 'SS Earning Detail'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'e_type',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Type',
-		'oldfieldname': 'e_type',
-		'oldfieldtype': 'Data',
-		'options': 'Earning Type',
-		'permlevel': 0,
-		'width': '200px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'e_amount',
-		'fieldtype': 'Currency',
-		'idx': 2,
-		'label': 'Amount',
-		'oldfieldname': 'e_amount',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'e_modified_amount',
-		'fieldtype': 'Currency',
-		'idx': 3,
-		'label': 'Modified Amount',
-		'permlevel': 0,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'e_depends_on_lwp',
-		'fieldtype': 'Check',
-		'idx': 4,
-		'label': 'Depends on LWP',
-		'permlevel': 0,
-		'trigger': 'Client'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/page/hr_home/hr_home.html b/erpnext/hr/page/hr_home/hr_home.html
index 7d1f27f..7f0c65d 100644
--- a/erpnext/hr/page/hr_home/hr_home.html
+++ b/erpnext/hr/page/hr_home/hr_home.html
@@ -1,17 +1,21 @@
 <div class="layout-wrapper layout-wrapper-background">
+	<div class="appframe-area"></div>
 	<div class="layout-main-section">
-		<a class="close" onclick="window.history.back();">&times;</a>
 		<h1>Human Resources</h1>
 		<hr>
 		<div style="width: 48%; float: left;">
 			<h4><a href="#!List/Attendance">Attendance</a></h4>
 			<p class="help">Attendance Mark</p>
+			<br>
 			<h4><a href="#!List/Leave Application">Leave Application</a></h4>
 			<p class="help">Applications for leave</p>
-			<h4><a href="#!List/Expense Voucher">Expense Voucher</a></h4>
+			<br>
+			<h4><a href="#!List/Expense Claim">Expense Claim</a></h4>
 			<p class="help">Claims for expenses</p>
+			<br>
 			<h4><a href="#!List/Salary Slip">Salary Slip</a></h4>
 			<p class="help">Monthly salary statement</p>	
+			<br>
 			<h4><a href="#!List/Appraisal">Appraisal</a></h4>
 			<p class="help">Performance appraisal</p>	
 		</div>
@@ -37,7 +41,7 @@
 					<div class="section-item">
 						<a class="section-link" 
 							title = "Leave allocation helper"
-							href="#!Form/Leave Control Panel/Leave Control Panel">Allocate Leaves</a>
+							href="#!Form/Leave Control Panel/Leave Control Panel">Leave Allocation Tool</a>
 					</div>
 					<div class="section-item">
 						<a class="section-link" 
@@ -53,7 +57,7 @@
 					<div class="section-item">
 						<a class="section-link" 
 							title = "List of holidays"
-							href="#!List/Leave Allocation">Holiday List</a>
+							href="#!List/Holiday List">Holiday List</a>
 					</div>
 				</div>
 			</div>
@@ -93,7 +97,7 @@
 					<div class="section-item">
 						<a class="section-link"
 							title = "Template for employee performance appraisals"
-							href="#!List/KRA Template">Key Performance Area (KRA) Template</a>
+							href="#!List/Appraisal Template">Appraisal Template</a>
 					</div>
 					<div class="section-item">
 						<a class="section-link"
@@ -120,4 +124,4 @@
 		</div>
 	</div>
 	<div style="clear: both;"></div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/hr/page/hr_home/hr_home.js b/erpnext/hr/page/hr_home/hr_home.js
index 418ed57..1971b46 100644
--- a/erpnext/hr/page/hr_home/hr_home.js
+++ b/erpnext/hr/page/hr_home/hr_home.js
@@ -15,5 +15,6 @@
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 pscript['onload_hr-home'] = function(wrapper) {
+	wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
 	erpnext.module_page.setup_page('HR', wrapper);
 }
\ No newline at end of file
diff --git a/erpnext/hr/search_criteria/employee_appraisals/employee_appraisals.txt b/erpnext/hr/search_criteria/employee_appraisals/employee_appraisals.txt
index 31b5d45..c338770 100644
--- a/erpnext/hr/search_criteria/employee_appraisals/employee_appraisals.txt
+++ b/erpnext/hr/search_criteria/employee_appraisals/employee_appraisals.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-09-01 15:48:09',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2010-09-01 14:18:42',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'ashwini@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Appraisal\x01ID,Appraisal\x01Status,Appraisal\x01Employee,Appraisal\x01Employee Name,Appraisal\x01Start Date,Appraisal\x01End Date,Appraisal\x01Approver,Appraisal\x01Total Score',
-		'criteria_name': 'Employee Appraisals',
-		'doc_type': 'Appraisal',
+		'columns': u'Appraisal\x01ID,Appraisal\x01Status,Appraisal\x01Employee,Appraisal\x01Employee Name,Appraisal\x01Start Date,Appraisal\x01End Date,Appraisal\x01Approver,Appraisal\x01Total Score',
+		'criteria_name': u'Employee Appraisals',
+		'doc_type': u'Appraisal',
 		'doctype': 'Search Criteria',
-		'filters': "{'Appraisal\x01Saved':1,'Appraisal\x01Submitted':1,'Appraisal\x01Status':'','Appraisal\x01Fiscal Year':''}",
-		'module': 'HR',
+		'filters': u"{'Appraisal\x01Saved':1,'Appraisal\x01Submitted':1,'Appraisal\x01Status':'','Appraisal\x01Fiscal Year':''}",
+		'module': u'HR',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabAppraisal`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabAppraisal`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, employee_appraisals
 	{
 		'doctype': 'Search Criteria',
-		'name': 'employee_appraisals'
+		'name': u'employee_appraisals'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/search_criteria/employee_details/__init__.py b/erpnext/hr/search_criteria/employee_details/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/search_criteria/employee_details/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/search_criteria/employee_details/employee_details.txt b/erpnext/hr/search_criteria/employee_details/employee_details.txt
deleted file mode 100644
index 08d785b..0000000
--- a/erpnext/hr/search_criteria/employee_details/employee_details.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-[
-	{
-		'add_col': None,
-		'add_cond': None,
-		'add_tab': None,
-		'columns': 'Employee\x01ID,Employee\x01Employee Name,Employee\x01Employee Code,Employee\x01Employee Number,Employee\x01Gender,Employee\x01Employment Type,Employee\x01Date of Joining,Employee\x01Scheduled Confirmation Date,Employee\x01Contract End Date,Employee\x01Status,Employee\x01Branch,Employee\x01Department,Employee\x01Designation,Employee\x01Grade,Employee\x01Company Email,Employee\x01Relieving Date',
-		'creation': '2010-12-14 10:33:09',
-		'criteria_name': 'Employee Details',
-		'custom_query': '',
-		'description': None,
-		'dis_filters': None,
-		'disabled': None,
-		'doc_type': 'Employee',
-		'docstatus': 0,
-		'doctype': 'Search Criteria',
-		'filters': "{'Employee\x01Gender':'','Employee\x01Month of Birth':'','Employee\x01Status':''}",
-		'graph_series': None,
-		'graph_values': None,
-		'group_by': None,
-		'idx': None,
-		'modified': '2010-04-01 14:27:15',
-		'modified_by': 'Administrator',
-		'module': 'Payroll',
-		'name': 'employee_details',
-		'owner': 'Administrator',
-		'page_len': 50,
-		'parent': None,
-		'parent_doc_type': None,
-		'parentfield': None,
-		'parenttype': None,
-		'report_script': '',
-		'server_script': None,
-		'sort_by': 'ID',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/search_criteria/employee_in_company_experience/__init__.py b/erpnext/hr/search_criteria/employee_in_company_experience/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/search_criteria/employee_in_company_experience/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/search_criteria/employee_in_company_experience/employee_in_company_experience.txt b/erpnext/hr/search_criteria/employee_in_company_experience/employee_in_company_experience.txt
deleted file mode 100644
index f3e1b48..0000000
--- a/erpnext/hr/search_criteria/employee_in_company_experience/employee_in_company_experience.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-[
-	{
-		'add_col': None,
-		'add_cond': None,
-		'add_tab': None,
-		'columns': 'Employee Profile\x01Employee,Experience In Company Detail\x01Branch,Experience In Company Detail\x01Department,Experience In Company Detail\x01Designation,Experience In Company Detail\x01Grade,Experience In Company Detail\x01From Date,Experience In Company Detail\x01To Date',
-		'creation': '2010-12-14 10:33:09',
-		'criteria_name': 'Employee In Company Experience',
-		'custom_query': '',
-		'description': None,
-		'dis_filters': None,
-		'disabled': 1,
-		'doc_type': 'Experience In Company Detail',
-		'docstatus': 0,
-		'doctype': 'Search Criteria',
-		'filters': '{}',
-		'graph_series': None,
-		'graph_values': None,
-		'group_by': None,
-		'idx': None,
-		'modified': '2010-04-01 14:27:15',
-		'modified_by': 'Administrator',
-		'module': 'Payroll',
-		'name': 'employee_in_company_experience',
-		'owner': 'Administrator',
-		'page_len': 50,
-		'parent': None,
-		'parent_doc_type': 'Employee Profile',
-		'parentfield': None,
-		'parenttype': None,
-		'report_script': '',
-		'server_script': '',
-		'sort_by': 'ID',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/search_criteria/employee_information/employee_information.txt b/erpnext/hr/search_criteria/employee_information/employee_information.txt
index edb68f8..84cb448 100644
--- a/erpnext/hr/search_criteria/employee_information/employee_information.txt
+++ b/erpnext/hr/search_criteria/employee_information/employee_information.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 10:23:25',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2010-10-26 12:03:08',
-		'modified_by': 'Administrator',
-		'owner': 'harshada@webnotestech.com'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Employee\x01ID,Employee\x01Employee Name,Employee\x01Employee Number,Employee\x01Date of Joining,Employee\x01Gender,Employee\x01Date of Birth,Employee\x01Employment Type,Employee\x01Scheduled Confirmation Date,Employee\x01Contract End Date,Employee\x01Status,Employee\x01Branch,Employee\x01Department,Employee\x01Designation,Employee\x01Grade,Employee\x01Reports to,Employee\x01Email (By company),Employee\x01Bank Name,Employee\x01Relieving Date',
-		'criteria_name': 'Employee Information',
-		'doc_type': 'Employee',
+		'columns': u'Employee\x01ID,Employee\x01Employee Name,Employee\x01Employee Number,Employee\x01Date of Joining,Employee\x01Gender,Employee\x01Date of Birth,Employee\x01Employment Type,Employee\x01Scheduled Confirmation Date,Employee\x01Contract End Date,Employee\x01Status,Employee\x01Branch,Employee\x01Department,Employee\x01Designation,Employee\x01Grade,Employee\x01Reports to,Employee\x01Email (By company),Employee\x01Bank Name,Employee\x01Relieving Date',
+		'criteria_name': u'Employee Information',
+		'doc_type': u'Employee',
 		'doctype': 'Search Criteria',
-		'filters': "{'Employee\x01Saved':1,'Employee\x01Submitted':1,'Employee\x01Gender':'','Employee\x01Month of Birth':'','Employee\x01Status':''}",
-		'module': 'HR',
+		'filters': u"{'Employee\x01Saved':1,'Employee\x01Submitted':1,'Employee\x01Gender':'','Employee\x01Month of Birth':'','Employee\x01Status':''}",
+		'module': u'HR',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabEmployee`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabEmployee`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, employee_information
 	{
 		'doctype': 'Search Criteria',
-		'name': 'employee_information'
+		'name': u'employee_information'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/search_criteria/employees_birthday/employees_birthday.txt b/erpnext/hr/search_criteria/employees_birthday/employees_birthday.txt
index ecbce74..42cfff2 100644
--- a/erpnext/hr/search_criteria/employees_birthday/employees_birthday.txt
+++ b/erpnext/hr/search_criteria/employees_birthday/employees_birthday.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 10:33:12',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2010-08-04 13:15:28',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Employee\x01ID,Employee\x01Employee Name,Employee\x01Department,Employee\x01Gender,Employee\x01Date of Birth,Employee\x01Month of Birth',
-		'criteria_name': "Employee's Birthday",
-		'doc_type': 'Employee',
+		'columns': u'Employee\x01ID,Employee\x01Employee Name,Employee\x01Department,Employee\x01Gender,Employee\x01Date of Birth,Employee\x01Month of Birth',
+		'criteria_name': u"Employee's Birthday",
+		'doc_type': u'Employee',
 		'doctype': 'Search Criteria',
-		'filters': "{'Employee\x01Saved':1,'Employee\x01Gender':'','Employee\x01Month of Birth':'May','Employee\x01Status':''}",
-		'module': 'HR',
+		'filters': u"{'Employee\x01Saved':1,'Employee\x01Gender':'','Employee\x01Month of Birth':'May','Employee\x01Status':''}",
+		'module': u'HR',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabEmployee`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabEmployee`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, employees_birthday
 	{
 		'doctype': 'Search Criteria',
-		'name': 'employees_birthday'
+		'name': u'employees_birthday'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/search_criteria/employeewise_leave_transaction_details/__init__.py b/erpnext/hr/search_criteria/employeewise_leave_transaction_details/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/search_criteria/employeewise_leave_transaction_details/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/search_criteria/employeewise_leave_transaction_details/employeewise_leave_transaction_details.txt b/erpnext/hr/search_criteria/employeewise_leave_transaction_details/employeewise_leave_transaction_details.txt
deleted file mode 100644
index fb54227..0000000
--- a/erpnext/hr/search_criteria/employeewise_leave_transaction_details/employeewise_leave_transaction_details.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# Search Criteria, employeewise_leave_transaction_details
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:32',
-		'docstatus': 0,
-		'modified': '2010-08-04 08:56:43',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'Leave Transaction\x01ID,Leave Transaction\x01Fiscal Year,Leave Transaction\x01Employee,Leave Transaction\x01Leave Type,Leave Transaction\x01Previous Balance,Leave Transaction\x01Leave Transaction Type,Leave Transaction\x01Allocation Type,Leave Transaction\x01Deduction Type,Leave Transaction\x01Half Day,Leave Transaction\x01From Date,Leave Transaction\x01To Date,Leave Transaction\x01Encashment Date,Leave Transaction\x01Total Leave Days,Leave Transaction\x01Status',
-		'criteria_name': 'Employeewise Leave Transaction Details',
-		'doc_type': 'Leave Transaction',
-		'doctype': 'Search Criteria',
-		'filters': "{'Leave Transaction\x01Saved':1,'Leave Transaction\x01Submitted':1}",
-		'module': 'HR',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabLeave Transaction`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, employeewise_leave_transaction_details
-	{
-		'doctype': 'Search Criteria',
-		'name': 'employeewise_leave_transaction_details'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/search_criteria/expense_vouchers/__init__.py b/erpnext/hr/search_criteria/expense_claims/__init__.py
similarity index 100%
rename from erpnext/hr/search_criteria/expense_vouchers/__init__.py
rename to erpnext/hr/search_criteria/expense_claims/__init__.py
diff --git a/erpnext/hr/search_criteria/expense_claims/expense_claims.txt b/erpnext/hr/search_criteria/expense_claims/expense_claims.txt
new file mode 100644
index 0000000..0032df5
--- /dev/null
+++ b/erpnext/hr/search_criteria/expense_claims/expense_claims.txt
@@ -0,0 +1,33 @@
+# Search Criteria, expense_claims
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-30 13:33:32',
+		'docstatus': 0,
+		'modified': '2012-03-30 13:33:32',
+		'modified_by': u'Administrator',
+		'owner': u'ashwini@webnotestech.com'
+	},
+
+	# These values are common for all Search Criteria
+	{
+		'columns': u'Expense Claim\x01ID,Expense Claim\x01Approval Status,Expense Claim\x01From Employee,Expense Claim\x01Employee Name,Expense Claim\x01Approver,Expense Claim\x01Posting Date,Expense Claim\x01Total Claimed Amount,Expense Claim\x01Total Sanctioned Amount',
+		'criteria_name': u'Expense Claims',
+		'doc_type': u'Expense Claim',
+		'doctype': 'Search Criteria',
+		'filters': u"{'Expense Claim\x01Saved':1,'Expense Claim\x01Submitted':1,'Expense Claim\x01Approval Status':'','Expense Claim\x01Fiscal Year':''}",
+		'module': u'HR',
+		'name': '__common__',
+		'page_len': 50,
+		'sort_by': u'`tabExpense Claim`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
+	},
+
+	# Search Criteria, expense_claims
+	{
+		'doctype': 'Search Criteria',
+		'name': u'expense_claims'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/hr/search_criteria/expense_vouchers/expense_vouchers.txt b/erpnext/hr/search_criteria/expense_vouchers/expense_vouchers.txt
deleted file mode 100644
index eeca0e0..0000000
--- a/erpnext/hr/search_criteria/expense_vouchers/expense_vouchers.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# Search Criteria, expense_vouchers
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-09-03 16:45:09',
-		'docstatus': 0,
-		'modified': '2010-09-02 11:05:37',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'Expense Voucher\x01ID,Expense Voucher\x01Approval Status,Expense Voucher\x01From Employee,Expense Voucher\x01Employee Name,Expense Voucher\x01Approver,Expense Voucher\x01Posting Date,Expense Voucher\x01Total Claimed Amount,Expense Voucher\x01Total Sanctioned Amount',
-		'criteria_name': 'Expense Vouchers',
-		'doc_type': 'Expense Voucher',
-		'doctype': 'Search Criteria',
-		'filters': "{'Expense Voucher\x01Saved':1,'Expense Voucher\x01Submitted':1,'Expense Voucher\x01Approval Status':'','Expense Voucher\x01Fiscal Year':''}",
-		'module': 'HR',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabExpense Voucher`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, expense_vouchers
-	{
-		'doctype': 'Search Criteria',
-		'name': 'expense_vouchers'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.txt b/erpnext/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.txt
index 23e4063..64a0eb2 100644
--- a/erpnext/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.txt
+++ b/erpnext/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 10:23:25',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2010-11-30 18:03:56',
-		'modified_by': 'Administrator',
-		'owner': 'harshada@webnotestech.com'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Attendance\x01Employee',
-		'criteria_name': 'Monthly Attendance Details',
-		'doc_type': 'Attendance',
+		'columns': u'Attendance\x01Employee',
+		'criteria_name': u'Monthly Attendance Details',
+		'doc_type': u'Attendance',
 		'doctype': 'Search Criteria',
-		'filters': "{'Attendance\x01Status':'','Attendance\x01Fiscal Year':''}",
-		'module': 'HR',
+		'filters': u"{'Attendance\x01Status':'','Attendance\x01Fiscal Year':''}",
+		'module': u'HR',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabAttendance`.`employee`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabAttendance`.`employee`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, monthly_attendance_details
 	{
 		'doctype': 'Search Criteria',
-		'name': 'monthly_attendance_details'
+		'name': u'monthly_attendance_details'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/search_criteria/monthly_salary_register/monthly_salary_register.py b/erpnext/hr/search_criteria/monthly_salary_register/monthly_salary_register.py
new file mode 100644
index 0000000..bbf6fb0
--- /dev/null
+++ b/erpnext/hr/search_criteria/monthly_salary_register/monthly_salary_register.py
@@ -0,0 +1,98 @@
+colwidths[col_idx['Employee Name']]="120px" 
+colwidths[col_idx['Leave Without Pay']] = '120px'
+
+sum_net = total_earning = total_deduction = total_lwp = total_arr = 0
+total = ['Total Net Pay','','']
+
+
+earn_type_lst = sql("select name from `tabEarning Type`")
+
+ded_type_lst = sql("select name from `tabDeduction Type`")
+li=[]
+for lst in earn_type_lst:
+  
+  li.append(lst[0])
+  
+  
+
+li.append('Total Earning')
+for lst in ded_type_lst:
+  
+  li.append(lst[0])
+  
+
+li.append('Total Deduction')
+li.append('Net Pay')
+
+
+
+for d in li:
+  colnames.append(d)
+  colwidths.append("150px")
+  coltypes.append("Currency")
+  coloptions.append("")
+  col_idx[d] = len(colnames)-1
+  for r in res:
+    r.append("0")
+
+for r in res:
+  
+  total_lwp += r[col_idx['Leave Without Pay']]
+  total_arr += r[col_idx['Arrear Amount']]
+  
+  for d1 in li:
+    d2 = '%s'%d1
+    
+    earn_ret=convert_to_lists(sql("select e_type,e_amount from `tabSalary Slip Earning` where parent = '%s'"%r[col_idx['ID']]))
+    ded_ret=convert_to_lists(sql("select d_type,d_amount from `tabSalary Slip Deduction` where parent = '%s'"%r[col_idx['ID']]))
+    
+
+    for e in earn_ret:
+      e0 = '%s'%e[0]
+      r[col_idx[e0]]=flt(e[1]) or 0.00
+     
+    
+    for d in ded_ret:
+      d0 = '%s'%d[0]
+      r[col_idx[d0]]=flt(d[1]) or 0.00
+      
+        
+    tot_earn_ded_net_ret = sql("select gross_pay, total_deduction,net_pay from `tabSalary Slip` where name = '%s'"%r[col_idx['ID']])
+    if d2 == 'Total Earning':
+      r[col_idx[d2]] = flt(tot_earn_ded_net_ret[0][0]) or 0
+      total_earning += flt(tot_earn_ded_net_ret[0][0]) or 0
+    elif d2 == 'Total Deduction':
+      r[col_idx[d2]] = flt(tot_earn_ded_net_ret[0][1]) or 0
+      total_deduction += flt(tot_earn_ded_net_ret[0][1]) or 0
+    elif d2 == 'Net Pay':
+      r[col_idx[d2]] = flt(tot_earn_ded_net_ret[0][2]) or 0
+      sum_net += flt(tot_earn_ded_net_ret[0][2]) or 0
+ 
+ 
+total.append(total_lwp)
+total.append(total_arr)
+
+for lst in earn_type_lst:
+  
+  total_ear = 0
+  for r in res:
+   
+    lst0 = '%s'%lst[0]
+    total_ear += flt(r[col_idx[lst0]])
+    
+  total.append(total_ear) 
+  
+total.append(total_earning)
+for lst in ded_type_lst:
+  total_ded = 0
+  for r in res:
+    lst0 = '%s'%lst[0]
+    total_ded += flt(r[col_idx[lst0]])
+    
+  total.append(total_ded) 
+
+
+total.append(total_deduction)
+total.append(sum_net)
+
+res.append(total)
diff --git a/erpnext/hr/search_criteria/monthly_salary_register/monthly_salary_register.txt b/erpnext/hr/search_criteria/monthly_salary_register/monthly_salary_register.txt
index e480563..b24bfb1 100644
--- a/erpnext/hr/search_criteria/monthly_salary_register/monthly_salary_register.txt
+++ b/erpnext/hr/search_criteria/monthly_salary_register/monthly_salary_register.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 10:33:12',
+		'creation': '2012-03-30 14:50:44',
 		'docstatus': 0,
-		'modified': '2010-04-05 14:43:08',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-05 17:23:13',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Salary Slip\x01ID,Salary Slip\x01Employee,Salary Slip\x01Employee Name,Salary Slip\x01Leave Without Pay,Salary Slip\x01Arrear Amount',
-		'criteria_name': 'Monthly Salary Register',
-		'doc_type': 'Salary Slip',
+		'columns': u'Salary Slip\x01ID,Salary Slip\x01Employee,Salary Slip\x01Employee Name,Salary Slip\x01Leave Without Pay,Salary Slip\x01Arrear Amount',
+		'criteria_name': u'Monthly Salary Register',
+		'doc_type': u'Salary Slip',
 		'doctype': 'Search Criteria',
-		'filters': "{'Salary Slip\x01Month':'','Salary Slip\x01Year':''}",
-		'module': 'HR',
+		'filters': u'{"Salary Slip\\u0001Submitted":1,"Salary Slip\\u0001Company":[""],"Salary Slip\\u0001Month":[""]}',
+		'module': u'HR',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': 'ID',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabSalary Slip`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, monthly_salary_register
 	{
 		'doctype': 'Search Criteria',
-		'name': 'monthly_salary_register'
+		'name': u'monthly_salary_register'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.txt b/erpnext/hr/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.txt
index f58984c..eee5bfa 100644
--- a/erpnext/hr/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.txt
+++ b/erpnext/hr/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 10:23:25',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2010-12-01 09:54:34',
-		'modified_by': 'Administrator',
-		'owner': 'harshada@webnotestech.com'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Employee\x01ID',
-		'criteria_name': 'New or left employees for a month',
-		'doc_type': 'Employee',
+		'columns': u'Employee\x01ID',
+		'criteria_name': u'New or left employees for a month',
+		'doc_type': u'Employee',
 		'doctype': 'Search Criteria',
-		'filters': "{'Employee\x01Saved':1,'Employee\x01Submitted':1,'Employee\x01Gender':'','Employee\x01Month of Birth':'','Employee\x01Status':''}",
-		'module': 'HR',
+		'filters': u"{'Employee\x01Saved':1,'Employee\x01Submitted':1,'Employee\x01Gender':'','Employee\x01Month of Birth':'','Employee\x01Status':''}",
+		'module': u'HR',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabEmployee`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabEmployee`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, new_or_left_employees_for_a_month
 	{
 		'doctype': 'Search Criteria',
-		'name': 'new_or_left_employees_for_a_month'
+		'name': u'new_or_left_employees_for_a_month'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/search_criteria/pending_appraisals/__init__.py b/erpnext/hr/search_criteria/pending_appraisals/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/search_criteria/pending_appraisals/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/search_criteria/pending_appraisals/pending_appraisals.js b/erpnext/hr/search_criteria/pending_appraisals/pending_appraisals.js
deleted file mode 100644
index 810fe16..0000000
--- a/erpnext/hr/search_criteria/pending_appraisals/pending_appraisals.js
+++ /dev/null
@@ -1,57 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-  this.hide_all_filters();  
-  
-  this.add_filter({fieldname:'approver', label:'Approver', fieldtype:'Link', options:'Profile', ignore : 1, parent:'Appraisal'});  
-  this.filter_fields_dict['Appraisal'+FILTER_SEP +'Approver'].df.in_first_page = 1;
-  
-  this.filter_fields_dict['Appraisal'+FILTER_SEP +'Employee'].df.filter_hide = 0;
-  this.filter_fields_dict['Appraisal'+FILTER_SEP +'Employee Name'].df.filter_hide = 0;
-  this.filter_fields_dict['Appraisal'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;  
-  this.filter_fields_dict['Appraisal'+FILTER_SEP +'From Start Date'].df.filter_hide = 0;
-  //this.filter_fields_dict['Appraisal'+FILTER_SEP +'To Start Date'].df.filter_hide = 0;
-  //this.filter_fields_dict['Appraisal'+FILTER_SEP +'From End Date'].df.filter_hide = 0;
-  this.filter_fields_dict['Appraisal'+FILTER_SEP +'To End Date'].df.filter_hide = 0;
-}
-this.mytabs.items['Select Columns'].hide();
-
-report.get_query = function(){
-  //get filter values
-  emp = this.filter_fields_dict['Appraisal'+FILTER_SEP+'Employee'].get_value(); 
-  emp_nm = this.filter_fields_dict['Appraisal'+FILTER_SEP+'Employee Name'].get_value(); 
-  frm_start_date = this.filter_fields_dict['Appraisal'+FILTER_SEP+'From Start Date'].get_value(); 
-  //to_start_date = this.filter_fields_dict['Appraisal'+FILTER_SEP+'To Start Date'].get_value(); 
-  //frm_end_date = this.filter_fields_dict['Appraisal'+FILTER_SEP+'From End Date'].get_value(); 
-  to_end_date = this.filter_fields_dict['Appraisal'+FILTER_SEP+'To End Date'].get_value(); 
-  fiscal_year = this.filter_fields_dict['Appraisal'+FILTER_SEP+'Fiscal Year'].get_value();
-  approver = this.filter_fields_dict['Appraisal'+FILTER_SEP+'Approver'].get_value();
-  
-  var cond = '';
-  if(emp) cond += ' AND `tabAppraisal`.employee = "'+emp+'"';
-  if(emp_nm) cond += ' AND `tabAppraisal`.employee_name = "'+emp_nm+'"';
-  if(frm_start_date) cond += ' AND `tabAppraisal`.start_date >= "'+frm_start_date+'"';
-  //if(to_start_date) cond += ' AND `tabAppraisal`.start_date <= "'+to_start_date+'"';
-  //if(frm_end_date) cond += ' AND `tabAppraisal`.end_date >= "'+frm_end_date+'"';
-  if(to_end_date) cond += ' AND `tabAppraisal`.end_date <= "'+to_end_date+'"';
-  if(fiscal_year !='') cond += ' AND `tabAppraisal`.fiscal_year = "'+fiscal_year+'"';
-  if(approver) cond += ' AND `tabAppraisal`.kra_approver = "'+approver+'"';
-
-  //var q = 'SELECT DISTINCT `tabAppraisal`.name, `tabAppraisal`.status, `tabAppraisal`.employee, `tabAppraisal`.employee_name, `tabAppraisal`.start_date,`tabAppraisal`.end_date,`tabAppraisal`.kra_approver, `tabAppraisal`.total_score FROM `tabAppraisal` WHERE `tabAppraisal`.status= "Submitted" AND `tabAppraisal`.kra_approver = "'+ user+'"'+cond;  
-  var q = 'SELECT DISTINCT `tabAppraisal`.name, `tabAppraisal`.employee, `tabAppraisal`.employee_name, `tabAppraisal`.start_date,`tabAppraisal`.end_date,`tabAppraisal`.kra_approver, `tabAppraisal`.total_score FROM `tabAppraisal` WHERE `tabAppraisal`.status= "Submitted"'+cond;  
-  return q;
-}
\ No newline at end of file
diff --git a/erpnext/hr/search_criteria/pending_appraisals/pending_appraisals.txt b/erpnext/hr/search_criteria/pending_appraisals/pending_appraisals.txt
deleted file mode 100644
index 3010bc9..0000000
--- a/erpnext/hr/search_criteria/pending_appraisals/pending_appraisals.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# Search Criteria, pending_appraisals
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-09-01 15:48:09',
-		'docstatus': 0,
-		'modified': '2010-09-01 14:19:02',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'criteria_name': 'Pending Appraisals',
-		'disabled': 0,
-		'doc_type': 'Appraisal',
-		'doctype': 'Search Criteria',
-		'filters': "{'Appraisal\x01Submitted':1,'Appraisal\x01Status':'Submitted','Appraisal\x01Fiscal Year':'','Appraisal\x01Approver':''}",
-		'module': 'HR',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabAppraisal`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, pending_appraisals
-	{
-		'doctype': 'Search Criteria',
-		'name': 'pending_appraisals'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/search_criteria/pending_expense_vouchers/__init__.py b/erpnext/hr/search_criteria/pending_expense_vouchers/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/hr/search_criteria/pending_expense_vouchers/__init__.py
+++ /dev/null
diff --git a/erpnext/hr/search_criteria/pending_expense_vouchers/pending_expense_vouchers.js b/erpnext/hr/search_criteria/pending_expense_vouchers/pending_expense_vouchers.js
deleted file mode 100644
index 388aa7b..0000000
--- a/erpnext/hr/search_criteria/pending_expense_vouchers/pending_expense_vouchers.js
+++ /dev/null
@@ -1,53 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-  this.hide_all_filters();  
-  
-  this.add_filter({fieldname:'approver', label:'Approver', fieldtype:'Link', options:'Profile', ignore : 1, parent:'Expense Voucher'});  
-  this.filter_fields_dict['Expense Voucher'+FILTER_SEP +'Approver'].df.in_first_page = 1;
-  
-  this.filter_fields_dict['Expense Voucher'+FILTER_SEP +'From Employee'].df.filter_hide = 0;
-  this.filter_fields_dict['Expense Voucher'+FILTER_SEP +'Employee Name'].df.filter_hide = 0;
-  this.filter_fields_dict['Expense Voucher'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;  
-  this.filter_fields_dict['Expense Voucher'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
-  this.filter_fields_dict['Expense Voucher'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
-  this.filter_fields_dict['Expense Voucher'+FILTER_SEP +'Company'].df.filter_hide = 0;
-}
-this.mytabs.items['Select Columns'].hide();
-
-report.get_query = function(){
-  //get filter values
-  emp = this.filter_fields_dict['Expense Voucher'+FILTER_SEP+'From Employee'].get_value(); 
-  emp_nm = this.filter_fields_dict['Expense Voucher'+FILTER_SEP+'Employee Name'].get_value(); 
-  frm_start_date = this.filter_fields_dict['Expense Voucher'+FILTER_SEP+'From Posting Date'].get_value(); 
-  to_end_date = this.filter_fields_dict['Expense Voucher'+FILTER_SEP+'To Posting Date'].get_value(); 
-  fiscal_year = this.filter_fields_dict['Expense Voucher'+FILTER_SEP+'Fiscal Year'].get_value();
-  approver = this.filter_fields_dict['Expense Voucher'+FILTER_SEP+'Approver'].get_value();
-  company = this.filter_fields_dict['Expense Voucher'+FILTER_SEP+'Company'].get_value();
-  
-  var cond = '';
-  if(emp) cond += ' AND `tabExpense Voucher`.employee = "'+emp+'"';
-  if(emp_nm) cond += ' AND `tabExpense Voucher`.employee_name = "'+emp_nm+'"';
-  if(frm_start_date) cond += ' AND `tabExpense Voucher`.posting_date >= "'+frm_start_date+'"';
-  if(to_end_date) cond += ' AND `tabExpense Voucher`.posting_date <= "'+to_end_date+'"';
-  if(fiscal_year !='') cond += ' AND `tabExpense Voucher`.fiscal_year = "'+fiscal_year+'"';
-  if(approver) cond += ' AND `tabExpense Voucher`.exp_approver = "'+approver+'"';
-  if(company) cond += ' AND `tabExpense Voucher`.company = "'+company+'"';
-
-  var q = 'SELECT DISTINCT `tabExpense Voucher`.name, `tabExpense Voucher`.employee, `tabExpense Voucher`.employee_name, `tabExpense Voucher`.posting_date,`tabExpense Voucher`.exp_approver, `tabExpense Voucher`.total_claimed_amount, `tabExpense Voucher`.total_sanctioned_amount FROM `tabExpense Voucher` WHERE `tabExpense Voucher`.approval_status= "Submitted"'+cond;  
-  return q;
-}
\ No newline at end of file
diff --git a/erpnext/hr/search_criteria/pending_expense_vouchers/pending_expense_vouchers.txt b/erpnext/hr/search_criteria/pending_expense_vouchers/pending_expense_vouchers.txt
deleted file mode 100644
index 423b614..0000000
--- a/erpnext/hr/search_criteria/pending_expense_vouchers/pending_expense_vouchers.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-# Search Criteria, pending_expense_vouchers
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-09-03 16:45:09',
-		'docstatus': 0,
-		'modified': '2010-09-02 11:04:41',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'criteria_name': 'Pending Expense Vouchers',
-		'doc_type': 'Expense Voucher',
-		'doctype': 'Search Criteria',
-		'filters': "{'Expense Voucher\x01Approval Status':'','Expense Voucher\x01Fiscal Year':''}",
-		'module': 'HR',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, pending_expense_vouchers
-	{
-		'doctype': 'Search Criteria',
-		'name': 'pending_expense_vouchers'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/hr/search_criteria/salary_register/salary_register.py b/erpnext/hr/search_criteria/salary_register/salary_register.py
index c44954c..9b9d5d4 100644
--- a/erpnext/hr/search_criteria/salary_register/salary_register.py
+++ b/erpnext/hr/search_criteria/salary_register/salary_register.py
@@ -19,8 +19,8 @@
   if not sal_slips_ids == '': sal_slips_ids +=","
   sal_slips_ids+="'%s'"%r[col_idx['ID']]
 
-earn_heads =[i[0] for i in sql("select distinct e_type from `tabSS Earning Detail` where parent in (%s)"%sal_slips_ids)]
-ded_heads =[i[0] for i in sql("select distinct d_type from `tabSS Deduction Detail` where parent in (%s)"%sal_slips_ids)]
+earn_heads =[i[0] for i in sql("select distinct e_type from `tabSalary Slip Earning` where parent in (%s)"%sal_slips_ids)]
+ded_heads =[i[0] for i in sql("select distinct d_type from `tabSalary Slip Deduction` where parent in (%s)"%sal_slips_ids)]
 
 col=[]
 
@@ -57,9 +57,9 @@
 
   for i in range(6,len(colnames)):
     if colnames[i] not in ('Arrear Amount','Encashment Amount','Net Pay','Gross Pay','Total Deduction'):
-      amt = sql("select e_modified_amount from `tabSS Earning Detail` where e_type = '%s' and parent = '%s'"%(colnames[i],r[0]))
+      amt = sql("select e_modified_amount from `tabSalary Slip Earning` where e_type = '%s' and parent = '%s'"%(colnames[i],r[0]))
       if not amt:
-        amt = sql("select d_modified_amount from `tabSS Deduction Detail` where d_type = '%s' and parent = '%s'"%(colnames[i],r[0]))
+        amt = sql("select d_modified_amount from `tabSalary Slip Deduction` where d_type = '%s' and parent = '%s'"%(colnames[i],r[0]))
       amt = amt and amt[0][0] or 0
       r.append(flt(amt))
       
diff --git a/erpnext/hr/search_criteria/salary_register/salary_register.txt b/erpnext/hr/search_criteria/salary_register/salary_register.txt
index 6d9c4fa..700423b 100644
--- a/erpnext/hr/search_criteria/salary_register/salary_register.txt
+++ b/erpnext/hr/search_criteria/salary_register/salary_register.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-29 12:30:57',
+		'creation': '2012-04-03 12:49:52',
 		'docstatus': 0,
-		'modified': '2010-12-29 12:11:18',
-		'modified_by': 'Administrator',
-		'owner': 'harshada@webnotestech.com'
+		'modified': '2012-04-03 12:49:52',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Salary Slip\x01ID,Salary Slip\x01Employee,Salary Slip\x01Employee Name,Salary Slip\x01Year,Salary Slip\x01Month,Salary Slip\x01Total days in month,Salary Slip\x01Payment days',
-		'criteria_name': 'Salary Register',
-		'doc_type': 'Salary Slip',
+		'columns': u'Salary Slip\x01ID,Salary Slip\x01Employee,Salary Slip\x01Employee Name,Salary Slip\x01Year,Salary Slip\x01Month,Salary Slip\x01Total days in month,Salary Slip\x01Payment days',
+		'criteria_name': u'Salary Register',
+		'doc_type': u'Salary Slip',
 		'doctype': 'Search Criteria',
-		'filters': "{'Salary Slip\x01Submitted':1,'Salary Slip\x01Month':''}",
-		'module': 'HR',
+		'filters': u"{'Salary Slip\x01Submitted':1,'Salary Slip\x01Month':''}",
+		'module': u'HR',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabSalary Slip`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabSalary Slip`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, salary_register
 	{
 		'doctype': 'Search Criteria',
-		'name': 'salary_register'
+		'name': u'salary_register'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/search_criteria/salary_slips/salary_slips.txt b/erpnext/hr/search_criteria/salary_slips/salary_slips.txt
index 00e6d46..9951896 100644
--- a/erpnext/hr/search_criteria/salary_slips/salary_slips.txt
+++ b/erpnext/hr/search_criteria/salary_slips/salary_slips.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:32',
+		'creation': '2012-04-03 12:49:52',
 		'docstatus': 0,
-		'modified': '2010-08-04 13:07:29',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:52',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Salary Slip\x01ID,Salary Slip\x01Fiscal Year,Salary Slip\x01Month,Salary Slip\x01Employee,Salary Slip\x01Employee Name,Salary Slip\x01Department,Salary Slip\x01Designation,Salary Slip\x01Branch,Salary Slip\x01Grade,Salary Slip\x01PF No.,Salary Slip\x01ESIC No.,Salary Slip\x01Leave Without Pay,Salary Slip\x01Bank Name,Salary Slip\x01Bank Account No.,Salary Slip\x01Payment days,Salary Slip\x01Arrear Amount,Salary Slip\x01Encashment Amount,Salary Slip\x01Gross Pay,Salary Slip\x01Total Deduction,Salary Slip\x01Net Pay',
-		'criteria_name': 'Salary Slips',
-		'doc_type': 'Salary Slip',
+		'columns': u'Salary Slip\x01ID,Salary Slip\x01Fiscal Year,Salary Slip\x01Month,Salary Slip\x01Employee,Salary Slip\x01Employee Name,Salary Slip\x01Department,Salary Slip\x01Designation,Salary Slip\x01Branch,Salary Slip\x01Grade,Salary Slip\x01PF No.,Salary Slip\x01ESIC No.,Salary Slip\x01Leave Without Pay,Salary Slip\x01Bank Name,Salary Slip\x01Bank Account No.,Salary Slip\x01Payment days,Salary Slip\x01Arrear Amount,Salary Slip\x01Encashment Amount,Salary Slip\x01Gross Pay,Salary Slip\x01Total Deduction,Salary Slip\x01Net Pay',
+		'criteria_name': u'Salary Slips',
+		'doc_type': u'Salary Slip',
 		'doctype': 'Search Criteria',
-		'filters': "{'Salary Slip\x01Saved':1,'Salary Slip\x01Submitted':1}",
-		'module': 'HR',
+		'filters': u"{'Salary Slip\x01Saved':1,'Salary Slip\x01Submitted':1}",
+		'module': u'HR',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabSalary Slip`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabSalary Slip`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, salary_slips
 	{
 		'doctype': 'Search Criteria',
-		'name': 'salary_slips'
+		'name': u'salary_slips'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/hr/search_criteria/salary_structure_details/salary_structure_details.txt b/erpnext/hr/search_criteria/salary_structure_details/salary_structure_details.txt
index 1111a38..a0e3438 100644
--- a/erpnext/hr/search_criteria/salary_structure_details/salary_structure_details.txt
+++ b/erpnext/hr/search_criteria/salary_structure_details/salary_structure_details.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 10:23:25',
+		'creation': '2012-04-03 12:49:52',
 		'docstatus': 0,
-		'modified': '2010-08-04 09:19:01',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:52',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Salary Structure\x01ID,Salary Structure\x01Employee,Salary Structure\x01From Date,Salary Structure\x01To Date,Salary Structure\x01Fiscal Year,Salary Structure\x01Branch,Salary Structure\x01Designation,Salary Structure\x01Department,Salary Structure\x01Grade,Salary Structure\x01Is Active,Salary Structure\x01Total Earning,Salary Structure\x01Total Deduction,Salary Structure\x01CTC,Salary Structure\x01Total',
-		'criteria_name': 'Salary Structure Details',
-		'doc_type': 'Salary Structure',
+		'columns': u'Salary Structure\x01ID,Salary Structure\x01Employee,Salary Structure\x01From Date,Salary Structure\x01To Date,Salary Structure\x01Fiscal Year,Salary Structure\x01Branch,Salary Structure\x01Designation,Salary Structure\x01Department,Salary Structure\x01Grade,Salary Structure\x01Is Active,Salary Structure\x01Total Earning,Salary Structure\x01Total Deduction,Salary Structure\x01CTC,Salary Structure\x01Total',
+		'criteria_name': u'Salary Structure Details',
+		'doc_type': u'Salary Structure',
 		'doctype': 'Search Criteria',
-		'filters': "{'Salary Structure\x01Branch':'','Salary Structure\x01Designation':'','Salary Structure\x01Department':'','Salary Structure\x01Grade':'','Salary Structure\x01Is Active':''}",
-		'module': 'HR',
+		'filters': u"{'Salary Structure\x01Branch':'','Salary Structure\x01Designation':'','Salary Structure\x01Department':'','Salary Structure\x01Grade':'','Salary Structure\x01Is Active':''}",
+		'module': u'HR',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabSalary Structure`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabSalary Structure`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, salary_structure_details
 	{
 		'doctype': 'Search Criteria',
-		'name': 'salary_structure_details'
+		'name': u'salary_structure_details'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/knowledge_base/Module Def/Knowledge Base/Knowledge Base.txt b/erpnext/knowledge_base/Module Def/Knowledge Base/Knowledge Base.txt
deleted file mode 100644
index 8aee002..0000000
--- a/erpnext/knowledge_base/Module Def/Knowledge Base/Knowledge Base.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-[
-	{
-		'creation': '2010-08-08 17:35:42',
-		'disabled': 'Yes',
-		'docstatus': 0,
-		'doctype': u'Module Def',
-		'doctype_list': None,
-		'file_list': None,
-		'idx': None,
-		'is_hidden': None,
-		'last_updated_date': None,
-		'modified': '2011-05-02 12:40:40',
-		'modified_by': 'Administrator',
-		'module_desc': '<p>Maintain your knowledge base of Questions &amp; Answers</p>',
-		'module_icon': 'help.png',
-		'module_label': 'Knowledge Base',
-		'module_name': 'Knowledge Base',
-		'module_page': 'questions',
-		'module_seq': 13,
-		'name': 'Knowledge Base',
-		'owner': 'Administrator',
-		'parent': None,
-		'parentfield': None,
-		'parenttype': None,
-		'trash_reason': None,
-		'widget_code': None
-	},
-	{
-		'creation': '2010-08-08 17:35:42',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 1,
-		'modified': '2010-08-08 17:35:42',
-		'modified_by': 'Administrator',
-		'name': 'MDR00106',
-		'owner': 'Administrator',
-		'parent': 'Knowledge Base',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'All'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/knowledge_base/__init__.py b/erpnext/knowledge_base/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/knowledge_base/__init__.py
+++ /dev/null
diff --git a/erpnext/knowledge_base/doctype/__init__.py b/erpnext/knowledge_base/doctype/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/knowledge_base/doctype/__init__.py
+++ /dev/null
diff --git a/erpnext/knowledge_base/doctype/answer/__init__.py b/erpnext/knowledge_base/doctype/answer/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/knowledge_base/doctype/answer/__init__.py
+++ /dev/null
diff --git a/erpnext/knowledge_base/doctype/answer/answer.txt b/erpnext/knowledge_base/doctype/answer/answer.txt
deleted file mode 100644
index 904e498..0000000
--- a/erpnext/knowledge_base/doctype/answer/answer.txt
+++ /dev/null
@@ -1,109 +0,0 @@
-# DocType, Answer
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-05-04 11:09:49',
-		'docstatus': 0,
-		'modified': '2011-05-30 15:52:52',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'allow_attach': 0,
-		'allow_trash': 1,
-		'autoname': '_ANS.#######',
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'in_create': 1,
-		'module': 'Knowledge Base',
-		'name': '__common__',
-		'read_only': 1,
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 3
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Answer',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# These values are common for all DocPerm
-	{
-		'amend': 0,
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'name': '__common__',
-		'parent': 'Answer',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'permlevel': 0,
-		'read': 1,
-		'role': 'All',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocType, Answer
-	{
-		'doctype': 'DocType',
-		'name': 'Answer'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'question',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Question',
-		'options': 'Question'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'answer',
-		'fieldtype': 'Text',
-		'idx': 2,
-		'label': 'Answer',
-		'oldfieldname': 'question',
-		'oldfieldtype': 'Text'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'points',
-		'fieldtype': 'Int',
-		'idx': 3,
-		'label': 'Points'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': '_users_voted',
-		'fieldtype': 'Text',
-		'hidden': 1,
-		'idx': 4,
-		'label': 'Users Voted',
-		'print_hide': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/knowledge_base/doctype/question/__init__.py b/erpnext/knowledge_base/doctype/question/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/knowledge_base/doctype/question/__init__.py
+++ /dev/null
diff --git a/erpnext/knowledge_base/doctype/question/question.txt b/erpnext/knowledge_base/doctype/question/question.txt
deleted file mode 100644
index 187789c..0000000
--- a/erpnext/knowledge_base/doctype/question/question.txt
+++ /dev/null
@@ -1,168 +0,0 @@
-# DocType, Question
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:17',
-		'docstatus': 0,
-		'modified': '2011-04-20 18:22:44',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'allow_attach': 0,
-		'allow_trash': 1,
-		'autoname': 'QUES.#######',
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'in_create': 1,
-		'module': 'Knowledge Base',
-		'name': '__common__',
-		'read_only': 1,
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 7
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Question',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# These values are common for all DocPerm
-	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'name': '__common__',
-		'parent': 'Question',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'permlevel': 0,
-		'read': 1,
-		'role': 'All',
-		'write': 1
-	},
-
-	# DocType, Question
-	{
-		'doctype': 'DocType',
-		'name': 'Question'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'question',
-		'fieldtype': 'Text',
-		'idx': 1,
-		'label': 'Question',
-		'oldfieldname': 'question',
-		'oldfieldtype': 'Text'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'points',
-		'fieldtype': 'Int',
-		'hidden': 1,
-		'idx': 2,
-		'label': 'Points'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'answer',
-		'fieldtype': 'Text Editor',
-		'idx': 3,
-		'label': 'Answer',
-		'oldfieldname': 'answer',
-		'oldfieldtype': 'Text Editor'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': '_user_tags',
-		'fieldtype': 'Data',
-		'hidden': 1,
-		'idx': 4,
-		'label': 'User Tags'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'tag_1',
-		'fieldtype': 'Link',
-		'idx': 5,
-		'label': 'Tag 1',
-		'oldfieldname': 'tag_1',
-		'oldfieldtype': 'Link',
-		'options': 'Question Tag',
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': '_users_voted',
-		'fieldtype': 'Text',
-		'idx': 6,
-		'label': 'Users Voted'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'tag_2',
-		'fieldtype': 'Link',
-		'idx': 7,
-		'label': 'Tag 2',
-		'oldfieldname': 'tag_2',
-		'oldfieldtype': 'Link',
-		'options': 'Question Tag',
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'tag_3',
-		'fieldtype': 'Link',
-		'idx': 8,
-		'label': 'Tag 3',
-		'oldfieldname': 'tag_3',
-		'oldfieldtype': 'Link',
-		'options': 'Question Tag',
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'file_list',
-		'fieldtype': 'Text',
-		'hidden': 1,
-		'idx': 9,
-		'label': 'File List',
-		'oldfieldname': 'file_list',
-		'oldfieldtype': 'Text'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/knowledge_base/doctype/question_control/question_control.txt b/erpnext/knowledge_base/doctype/question_control/question_control.txt
deleted file mode 100644
index 42b491b..0000000
--- a/erpnext/knowledge_base/doctype/question_control/question_control.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# DocType, Question Control
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:17',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'issingle': 1,
-		'module': 'Knowledge Base',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'version': 1
-	},
-
-	# DocType, Question Control
-	{
-		'doctype': 'DocType',
-		'name': 'Question Control'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/knowledge_base/doctype/question_tag/__init__.py b/erpnext/knowledge_base/doctype/question_tag/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/knowledge_base/doctype/question_tag/__init__.py
+++ /dev/null
diff --git a/erpnext/knowledge_base/doctype/question_tag/question_tag.txt b/erpnext/knowledge_base/doctype/question_tag/question_tag.txt
deleted file mode 100644
index e6e3d35..0000000
--- a/erpnext/knowledge_base/doctype/question_tag/question_tag.txt
+++ /dev/null
@@ -1,71 +0,0 @@
-# DocType, Question Tag
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:17',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'field:tag_name',
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'module': 'Knowledge Base',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'version': 1
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'tag_name',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'label': 'Tag Name',
-		'name': '__common__',
-		'oldfieldname': 'tag_name',
-		'oldfieldtype': 'Data',
-		'parent': 'Question Tag',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# These values are common for all DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'name': '__common__',
-		'parent': 'Question Tag',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'permlevel': 0,
-		'read': 1,
-		'role': 'All',
-		'write': 1
-	},
-
-	# DocType, Question Tag
-	{
-		'doctype': 'DocType',
-		'name': 'Question Tag'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/knowledge_base/page/__init__.py b/erpnext/knowledge_base/page/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/knowledge_base/page/__init__.py
+++ /dev/null
diff --git a/erpnext/knowledge_base/page/kb_common/kb_common.js b/erpnext/knowledge_base/page/kb_common/kb_common.js
deleted file mode 100644
index a734f65..0000000
--- a/erpnext/knowledge_base/page/kb_common/kb_common.js
+++ /dev/null
@@ -1,174 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-// question toolbar
-// contains - voting widget / tag list and user info / timestamp
-// By XXXXXX on YYYYY
-
-KBItemToolbar = function(args, kb) {
-	$.extend(this, args);
-	var me = this;
-	this.make = function() {
-		this.wrapper = $a(this.parent, 'div', '', {});
-		this.line1 = $a(this.wrapper, 'div', '', {color: '#888', fontSize:'11px', margin:'7px 0px'});
-		this.make_timestamp();
-		this.make_vote();
-		if(this.with_tags)
-			this.make_tags();
-	}
-	
-	this.make_timestamp = function() {
-		this.line1.innerHTML = repl('By %(name)s | %(when)s', {
-			name: wn.utils.full_name(this.det.first_name, this.det.last_name),
-			when: wn.datetime.comment_when(this.det.modified)
-		});
-		
-		// allow system manager to delete questions / answers
-		if(has_common(user_roles, ['Administrator', 'System Manager'])) {
-			this.line1.innerHTML += ' | '
-			$ln(this.line1, 'delete', me.del);
-		}
-	}
-
-	this.make_vote = function() {
-		this.line1.innerHTML += ' | '
-		new KBPoints(this.line1, this.det.points, this.det._users_voted, this.doctype, this.det.name, this.det.owner);
-	}
-	
-	this.del = function() {
-		this.innerHTML = 'deleting...'; this.disabled = 1;
-		$c_page('knowledge_base', 'questions', 'delete', {dt:me.doctype, dn:me.det.name}, function(r,rt) {
-			// reload the list
-			kb.list.run()
-		});
-	}
-	
-	this.make_tags = function() {
-		this.line1.innerHTML += ' | '
-		this.tags_area = $a(this.line1, 'span', 'kb-tags')
-		this.tags = new TagList(this.tags_area, 
-			this.det._user_tags && (this.det._user_tags.split(',')), 
-			this.doctype, this.det.name, 0, kb.set_tag_filter)		
-	}
-
-	this.make();
-}
-
-
-// kb points
-// x points | Vote Up | Vote Down (if not voted and not guest)
-KBPoints = function(parent, points, voted, dt, dn, owner) {
-	var me = this;
-	voted = voted ? voted.split(',') : [];
-
-	this.wrapper = $a(parent, 'span', '', {fontSize: '11px', marginRight: '7px', marginLeft: '7px'});
-	
-	this.render_points = function(p) {
-		if(!this.points_area)
-			this.points_area = $a(this.wrapper, 'span');
-		this.points_area.innerHTML = cint(p) + ' point' + (p>1 ? 's' : '');			
-	}
-	
-	this.render_points(points);
-	
-	// vote up or down
-	// if user has not already voted
-	
-	if(user!='Guest' && !in_list(voted, user) && user!=owner) {
-		this.vote_up = $a(this.wrapper, 'img', 'lib/images/ui/vote_up.gif', {margin:'0px 0px -2px 7px', cursor: 'pointer'});
-		this.vote_down = $a(this.wrapper, 'img', 'lib/images/ui/vote_down.gif', {margin:'0px 0px -3px 0px', cursor: 'pointer'});
-		
-		this.vote_up.title = 'Vote Up'; this.vote_down.title = 'Vote Down';
-		
-		var callback = function(r, rt) {
-			if(r.exc) { msgprint(r.exc); return; }
-			$dh(me.vote_up); $dh(me.vote_down);
-			me.render_points(r.message);
-		}
-		
-		this.vote_up.onclick = function() {
-			$c_page('knowledge_base', 'questions', 'vote', {vote:'up', dn:dn, dt:dt}, callback);
-		}
-		this.vote_down.onclick = function() {
-			$c_page('knowledge_base', 'questions', 'vote', {vote:'down', dn:dn, dt:dt}, callback);
-		}
-	}
-}
-
-// displays an editable text,
-// needs parent, text, disp_class, inp_class
-// dt, dn
-
-EditableText = function(args) {
-	$.extend(this, args);
-	var me = this;
-	
-	this.wrapper = $a(me.parent, 'div');
-	this.display = $a(me.wrapper, 'div', me.disp_class, '', me.text);
-	this.input = $a(me.wrapper, 'textarea', me.inp_class, {display:'none'});
-	
-	var div = $a(me.wrapper, 'div', '', {marginTop:'5px', height:'23px'});
-	
-	// edit text
-	this.edit_btn = $a(div, 'a', '', {cursor:'pointer'}, '[edit]');
-
-	this.edit_btn.onclick = function() {
-		me.input.value = me.display.innerHTML;
-		me.show_as_input();
-	}
-	
-	// save button - save the new text
-	// check if text is written
-	this.save_btn = $btn(div, 'Save', function() {
-		var v = me.rich_text ? wn.tinymce.get_value(me.input) : me.input.value;
-		if(!v) {
-			msgprint('Please write something!');
-			return;
-		}
-		me.save_btn.set_working();
-		$c_page('knowledge_base', 'question_view', 'update_item', {
-				dt: me.dt, dn: me.dn, fn: me.fieldname, text: v
-			}, 
-			function(r, rt) {
-				me.save_btn.done_working();
-				if(r.exc) {msgprint(r.exc); return; }
-				me.display.innerHTML = v;
-				me.show_as_text();
-			});
-	}, {display: 'none'});
-
-	// cancel button
-	this.cancel_btn = $a(div, 'span', 'link_type', {color: '#555', display:'none'}, 'Cancel', {marginLeft:'7px'});
-	this.cancel_btn.onclick = function() {
-		me.show_as_text();		
-	}
-
-	this.show_as_text = function() {
-		$ds(me.display); $ds(me.edit_btn);
-		if(me.rich_text)
-			wn.tinymce.remove(me.input);
-		$dh(me.input); $dh(me.save_btn); $dh(me.cancel_btn);
-				
-	}
-
-	this.show_as_input = function() {
-		$ds(me.input); $ds(me.save_btn); $ds(me.cancel_btn); 
-		$dh(me.edit_btn); $dh(me.display);
-		if(me.rich_text)
-			wn.tinymce.add_simple(me.input, '300px');
-	}	
-
-}
\ No newline at end of file
diff --git a/erpnext/knowledge_base/page/question_view/question_view.html b/erpnext/knowledge_base/page/question_view/question_view.html
deleted file mode 100644
index 9939332..0000000
--- a/erpnext/knowledge_base/page/question_view/question_view.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<div class="layout-wrapper">
-	<a class="close" onclick="window.history.back();">&times;</a>
-	<h1>Knowledge Base</h1>
-	<hr>
-	<p style="text-align: right"><a href="#!questions">&larr; Back to Questions</a></p>
-	<div class="qv-question-wrapper">
-	</div>
-	<hr>
-	<div class="qv-answer-wrapper">
-	</div>
-	<div class="add-answer-link"></div>
-	<div class="add-answer-area"></div>
-</div>
\ No newline at end of file
diff --git a/erpnext/knowledge_base/page/question_view/question_view.js b/erpnext/knowledge_base/page/question_view/question_view.js
deleted file mode 100644
index 5783471..0000000
--- a/erpnext/knowledge_base/page/question_view/question_view.js
+++ /dev/null
@@ -1,188 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-pscript['onload_question-view'] = function(wrapper) {
-	wrapper.add_answer_area = $('.add-answer-area').get(0);
-}
-
-pscript['refresh_question-view'] = function() {
-	$('.add-answer-area').empty();
-	// href
-	var qid = window.location.hash.split('/')[1];
-	if(qid) {
-		pscript.question_view(qid);
-	}
-}
-
-pscript.question_view = function(qid, qtext) {
-	var w = wn.pages['question-view'];
-	new KBQuestionView(w, qid, qtext);
-}
-
-KBQuestionView = function(w, qid, qtext) {
-	var me = this;
-		
-	this.make_question = function() {
-		$(w).find('.qv-question-wrapper').empty();
-		new EditableText({
-			parent: $(w).find('.qv-question-wrapper').get(0),
-			dt: 'Question',
-			dn: qid,
-			fieldname: 'question',
-			text: qtext,
-			inp_class: 'qv-input',
-			disp_class: 'qv-text'
-		});
-
-		// show tags
-	}
-	
-	// answer list
-	this.make_answer_list = function() {
-		$(w).find('.qv-answer-wrapper').empty();
-		this.ans_list = new KBAnswerList({
-			parent: $(w).find('.qv-answer-wrapper').get(0),
-			qid: qid
-		})
-	}
-	
-	// check if users has answered 
-	// (if no) then add a box to add a new answer
-	this.make_add_answer = function() {
-		$c_page('knowledge_base', 'question_view', 'has_answered', qid, function(r, rt) {
-			if(r.message=='No') {
-				me.make_answer_box_link();
-			}
-		});
-	}
-	
-	// add a link to open add answer
-	this.make_answer_box_link = function() {
-		$('.add-answer-link').html('<button class="btn btn-small">\
-			<i class="icon-plus"></i> Add you answer</button>').find('button').click(
-				function() {
-					$(this).toggle(false);
-					me.make_answer_box();
-				});
-	}
-	
-	// answer box
-	// text area + add button
-	this.make_answer_box = function() {
-		$ds(w.add_answer_area);
-		$a(w.add_answer_area, 'h3', '', {}, 'Add Your Answer')
-		this.input = $a(w.add_answer_area, 'textarea');
-		wn.tinymce.add_simple(this.input);
-		
-		this.btn = $btn($a(w.add_answer_area, 'div'), 'Post', function() {
-			var v = wn.tinymce.get_value(me.input);
-			if(!v) { msgprint('Write something!'); return; }
-			me.btn.set_working();
-			$c_page('knowledge_base', 'question_view', 'add_answer', {qid: qid, answer:v}, 
-				function(r, rt) {
-					me.btn.done_working();
-					me.ans_list.list.run();
-					$dh(w.add_answer_area);
-				}
-			);
-		});
-	}
-	
-	this.setup = function() {
-		if(qtext) {
-			this.make();
-		}
-		else {
-			$c_page('knowledge_base', 'question_view', 'get_question', qid, function(r, rt) {
-				qtext = r.message;
-				me.make();
-			});
-		}
-	}
-	
-	this.make = function() {
-		set_title(qtext);
-		this.make_question();
-		this.make_answer_list();
-		this.make_add_answer();		
-	}
-	
-	this.setup();
-}
-
-
-// kb answer list
-KBAnswerList = function(args) {
-	var me = this;
-	$.extend(this, args);
-	
-	this.make_list = function() {
-	
-		this.list = new wn.widgets.Listing({
-			parent: me.parent,
-			as_dict: 1,
-			no_result_message: 'No answers yet, be the first one to answer!',
-			render_row: function(body, data) {
-				new KBAnswer(body, data, me)
-			},
-			get_query: function() {
-				return repl("SELECT t1.name, t1.owner, t1.answer, t1.points, t1._users_voted, t2.first_name, "
-					+"t2.last_name, t1.modified from tabAnswer t1, tabProfile t2 "
-					+"where question='%(qid)s' and t1.owner = t2.name "
-					+"order by t1.points desc, t1.modified desc", {qid: me.qid})
-			},
-			title: 'Answers'
-		});
-		
-		this.list.run();
-		
-	}
-	
-	this.make_list();
-	
-}
-
-// kb answer
-// answer
-// by xxx | on xxx
-// points yyy
-KBAnswer = function(body, data, ans_list) {
-	body.className = 'qv-answer';
-	var edtxt = new EditableText({
-		parent: body,
-		dt: 'Answer',
-		dn: data.name,
-		fieldname: 'answer',
-		text: data.answer,
-		inp_class: 'qv-ans-input',
-		disp_class: 'qv-ans-text',
-		rich_text: 1
-	});	
-	
-	$(edtxt.wrapper).addClass('well');
-	
-	var div = $a(body, 'div', '', {})
-	new KBItemToolbar({
-		parent: div,
-		det: data,
-		with_tags: 0,
-		doctype: 'Answer'
-	}, ans_list)
-	
-}
-
-
-$import(knowledge_base/page/kb_common/kb_common.js);
\ No newline at end of file
diff --git a/erpnext/knowledge_base/page/question_view/question_view.txt b/erpnext/knowledge_base/page/question_view/question_view.txt
deleted file mode 100644
index 9a10f8f..0000000
--- a/erpnext/knowledge_base/page/question_view/question_view.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Page, question-view
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-05-04 11:09:50',
-		'docstatus': 0,
-		'modified': '2011-03-29 13:54:27',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Page
-	{
-		'doctype': 'Page',
-		'module': 'Knowledge Base',
-		'name': '__common__',
-		'page_name': 'Question View',
-		'standard': 'Yes'
-	},
-
-	# Page, question-view
-	{
-		'doctype': 'Page',
-		'name': 'question-view'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/knowledge_base/page/questions/questions.css b/erpnext/knowledge_base/page/questions/questions.css
deleted file mode 100644
index aa97ffc..0000000
--- a/erpnext/knowledge_base/page/questions/questions.css
+++ /dev/null
@@ -1,28 +0,0 @@
-div.kb-search-wrapper textarea {
-	height: 2.2em;
-	width: 80%;
-	font-size: 14px;
-	padding: 3px;
-	margin-bottom: 7px;
-}
-
-.kb-question-wrapper {
-	border-bottom: 1px solid #AAA;
-	padding-bottom: 3px;
-	margin-bottom: 3px;
-}
-
-.kb-questions {
-}
-
-.kb-question-details {
-	margin: 11px 0px 11px 29px;
-}
-
-.kb-tag-filter-area {
-	padding: 7px;
-	background-color: #F2F2E8;
-	color: #222;
-	margin: 7px 0px;
-	display: none;
-}
\ No newline at end of file
diff --git a/erpnext/knowledge_base/page/questions/questions.html b/erpnext/knowledge_base/page/questions/questions.html
deleted file mode 100644
index c76f490..0000000
--- a/erpnext/knowledge_base/page/questions/questions.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<div class="layout-wrapper layout-wrapper-background">
-	<div class="layout-main-section">
-		<a class="close" onclick="window.history.back();">&times;</a>
-		<h1>Knowledge Base</h1>
-		<hr>
-		<div class="well kb-search-wrapper">
-			<textarea></textarea>
-			<div>
-				<button class="btn btn-small search" onclick="">
-					<i class="icon-search"></i> Search</button>
-				<button class="btn btn-small ask">
-					<i class="icon-question-sign"></i> Ask</button>
-			</div>
-		</div>
-	</div>
-	<div class="layout-side-section">
-	</div>
-	<div style="clear: both;"></div>
-</div>
\ No newline at end of file
diff --git a/erpnext/knowledge_base/page/questions/questions.js b/erpnext/knowledge_base/page/questions/questions.js
deleted file mode 100644
index 7261cd8..0000000
--- a/erpnext/knowledge_base/page/questions/questions.js
+++ /dev/null
@@ -1,218 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-pscript.onload_questions = function(wrapper) {	
-	body = $(wrapper).find('.layout-main-section').get(0);
-	
-	// kb
-	var kb = new KnowledgeBase(body);
-	
-	// sidebar
-	this.sidebar = new wn.widgets.PageSidebar($(wrapper).find('.layout-side-section').get(0), {
-		sections: [
-			{
-				title: 'Top Tags',
-				render: function(body) {
-					new wn.widgets.TagCloud(body, 'Question', function(tag) 
-						{ kb.set_tag_filter(tag) });
-				}				
-			}
-		]
-	});
-	set_title('Knowledge Base');
-}
-
-// knowledge base object
-// has a box for search or ask a question
-// and list of top rated search results
-//
-function KnowledgeBase(w) {
-	var me = this;
-	this.sort_by = 'modified';
-	this.tag_filter_dict = {};
-	
-	this.make_search_bar = function() {
-		this.search = $(w).find('.kb-search-wrapper textarea').get(0);
-		
-		$(w).find('.btn.search').click(function() {
-			me.run();
-		})
-		$(w).find('.btn.ask').click(function() {
-			me.ask();
-		})
-	}
-	
-	// ask a new question
-	this.ask = function() {
-		if(this.search.value==$(this.search).attr('default_text')) {
-			msgprint('Please enter some text'); return;
-		}
-		this.suggest();
-	}
-	
-	// suggest a few users who can answer
-	this.suggest = function() {
-		this.dialog = new wn.widgets.Dialog({
-			title: 'Suggest a users',
-			width: 400,
-			fields: [
-				{fieldtype:'HTML', options:'Optional: Suggest a few users who can help you answer this question<br>'},
-				{fieldtype:'Link', fieldname:'profile1', label:'1st User',options:'Profile'},
-				{fieldtype:'Link', fieldname:'profile2', label:'2nd User',options:'Profile'},
-				{fieldtype:'Link', fieldname:'profile3', label:'3rd User',options:'Profile'},
-				{fieldtype:'Button', fieldname:'ask', label:'Add the Question'}
-			]
-		});
-		this.dialog.fields_dict.ask.input.onclick = function() {
-			me.dialog.hide();
-			me.add_question(values(me.dialog.get_values()));
-		}
-		this.dialog.show();
-	}
-	
-	// add a new question to the database
-	this.add_question = function(suggest_list) {
-		$c_page('knowledge_base', 'questions', 'add_question', {
-			question: this.search.value,
-			suggest: suggest_list
-		}, function(r,rt) {
-			$(me.search).val('').blur();
-			me.run();
-		})
-	}
-	
-	// where tags that filter will be displayed
-	this.make_tag_filter_area = function() {
-		this.tag_filters = $a(w, 'div', 'kb-tag-filter-area');
-		$a(this.tag_filters,'span','',{marginRight:'4px',color:'#442'}, '<i>Showing for:</i>');
-		this.tag_area = $a(this.tag_filters, 'span');
-	}
-	
-	// make a list of questions
-	this.make_list = function() {
-		this.make_tag_filter_area();
-		this.list_area = $a(w, 'div', '', {marginRight:'13px'})
-		this.no_result = $a(w, 'div','help_box',{display:'none'},'No questions asked yet! Be the first one to ask')
-
-		this.list = new wn.widgets.Listing({
-			parent: this.list_area,
-			no_results_message: 'No questions found. Ask a new question!',
-			as_dict: 1,
-			get_query: function() {
-				
-				// filter by search string
-				var v = me.search.value==$(me.search).attr('default_text') ? '' : me.search.value;
-				cond = v ? (' and t1.question like "%'+v+'%"') : '';
-				
-				// filter by tags
-				if(me.tag_filter_dict) {
-					for(f in me.tag_filter_dict) {
-						cond += ' and t1.`_user_tags` like "%' + f + '%"'
-					}
-				}
-				return repl('select t1.name, t1.owner, t1.question, t1.points, t1.modified, t1._user_tags, '
-				+'t1._users_voted, t2.first_name, t2.last_name '
-				+'from tabQuestion t1, tabProfile t2 '
-				+'where t1.docstatus!=2 '
-				+'and t1.owner = t2.name'
-				+'%(cond)s order by t1.modified desc', {user:user, cond: cond})
-			},
-			render_row: function(parent, data, listing) {
-				new KBQuestion(parent, data, me);
-			}
-		});
-		
-		this.list.run();
-
-	}
-
-	// add a tag filter to the search in the
-	// main page
-	this.set_tag_filter = function(tag) {
-
-		// check if exists
-		if(in_list(keys(me.tag_filter_dict), tag.label)) return;
-
-		// create a tag in filters
-		var filter_tag = new SingleTag({
-			parent: me.tag_area,
-			label: tag.label,
-			dt: 'Question',
-			color: tag.color
-		});
-
-		// remove tag from filters
-		filter_tag.remove = function(tag_remove) {
-			$(tag_remove.body).fadeOut();
-			delete me.tag_filter_dict[tag_remove.label];
-
-			// hide everything?
-			if(!keys(me.tag_filter_dict).length) {
-				$(me.tag_filters).slideUp(); // hide
-			}
-
-			// run
-			me.run();
-		}
-
-		// add to dict
-		me.tag_filter_dict[tag.label] = filter_tag;
-		$ds(me.tag_filters);
-
-		// run
-		me.run();
-	}	
-	this.run = function() {
-		this.list.run();
-	}
-
-	this.make_search_bar();
-	this.make_list();
-	
-}
-
-// single kb question
-// "question
-//  points | tag list"
-
-KBQuestion = function(parent, det, kb) {
-	
-	this.make = function() {
-		this.wrapper = $a(parent, 'div', 'kb-question-wrapper');
-		this.q_area = $a($a(this.wrapper, 'div'), 'h3', 'kb-questions link_type', {display:'inline', textDecoration:'none'}, det.question);
-
-		this.q_area.onclick = function() {
-			var q = this;
-			window.location.href = '#!question-view/' + q.id;
-			//loadpage('question-view', function() { pscript.question_view(q.id, q.txt) })
-		}
-		
-		this.q_area.id = det.name; this.q_area.txt = det.question;
-
-		new KBItemToolbar({
-			parent: this.wrapper,
-			det: det,
-			with_tags: 1,
-			doctype: 'Question'
-		}, kb)
-		
-	}
-	
-
-	this.make()
-}
-
-$import(knowledge_base/page/kb_common/kb_common.js);
\ No newline at end of file
diff --git a/erpnext/knowledge_base/page/questions/questions.py b/erpnext/knowledge_base/page/questions/questions.py
deleted file mode 100644
index 1b90fc7..0000000
--- a/erpnext/knowledge_base/page/questions/questions.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import webnotes
-
-from webnotes.utils import load_json, cint, cstr
-
-# add a new question
-@webnotes.whitelist()
-def add_question(arg):
-	args = load_json(arg)
-	
-	from webnotes.model.doc import Document
-	d = Document('Question')
-	d.question = args['question'].title()
-	d.points = 1
-	d.save(1)
-	
-	if args['suggest']:
-		from home.page.my_company.my_company import post_comment
-		for s in args['suggest']:
-			if s:
-				post_comment({
-					'uid': s,
-					'comment': 'Please help me and answer the question "%s" in the Knowledge Base' % d.question,
-					'notify': 1
-				})
-	
-@webnotes.whitelist()
-def vote(arg):
-	args = load_json(arg)
-	
-	res = webnotes.conn.sql("select points, _users_voted from `tab%s` where name=%s" % (args['dt'], '%s'), args['dn'])[0]
-	p = cint(res[0])
-	p = args['vote']=='up' and p+1 or p-1
-	
-	# update
-	webnotes.conn.sql("update `tab%s` set points=%s, _users_voted=%s where name=%s" % (args['dt'], '%s', '%s', '%s'), \
-		(p, cstr(res[1]) + ',' + webnotes.user.name, args['dn']))
-	
-	return p
-
-@webnotes.whitelist()
-def delete(arg):
-	"""
-		delete a question or answer (called from kb toolbar)
-	"""
-	args = load_json(arg)
-	from webnotes.model import delete_doc
-	delete_doc(args['dt'], args['dn'])
\ No newline at end of file
diff --git a/erpnext/knowledge_base/page/questions/questions.txt b/erpnext/knowledge_base/page/questions/questions.txt
deleted file mode 100644
index 1ca11ff..0000000
--- a/erpnext/knowledge_base/page/questions/questions.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Page, questions
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-05-04 11:09:49',
-		'docstatus': 0,
-		'modified': '2011-03-29 13:53:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Page
-	{
-		'doctype': 'Page',
-		'module': 'Knowledge Base',
-		'name': '__common__',
-		'page_name': 'Questions',
-		'standard': 'Yes'
-	},
-
-	# Page, questions
-	{
-		'doctype': 'Page',
-		'name': 'Questions'
-	}
-]
diff --git a/erpnext/patches/april_2012/naming_series_patch.py b/erpnext/patches/april_2012/naming_series_patch.py
new file mode 100644
index 0000000..574d036
--- /dev/null
+++ b/erpnext/patches/april_2012/naming_series_patch.py
@@ -0,0 +1,12 @@
+def execute():
+	import webnotes
+	from webnotes.model.code import get_obj
+	ns_list = webnotes.conn.sql("""\
+		SELECT `tabDocField`.`parent`, `tabDocField`.`options`
+		FROM `tabDocField`, `tabDocType`
+		WHERE `tabDocField`.`fieldname` = 'naming_series'
+		AND `tabDocType`.name=`tabDocField`.parent""")
+	ns_obj = get_obj('Naming Series')
+	for ns in ns_list:
+		if ns[0] and isinstance(ns[1], basestring):			
+			ns_obj.set_series_for(ns[0], ns[1].split("\n"))
diff --git a/erpnext/patches/before_jan_2012/Discount_purchase_cycle.py b/erpnext/patches/before_jan_2012/Discount_purchase_cycle.py
index 8fee8c5..4214576 100644
--- a/erpnext/patches/before_jan_2012/Discount_purchase_cycle.py
+++ b/erpnext/patches/before_jan_2012/Discount_purchase_cycle.py
@@ -16,13 +16,13 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 
 	reload_doc('accounts', 'doctype', 'pv_detail')
 	reload_doc('buying', 'doctype', 'po_detail')
 	reload_doc('stock', 'doctype', 'purchase_receipt_detail')
-	if webnotes.conn.sql("select name from `tabDocField` where parent = 'PO Detail' and fieldname = 'discount'"):
-		webnotes.conn.sql("update `tabPO Detail` set discount_rate=discount")
+	if webnotes.conn.sql("select name from `tabDocField` where parent = 'Purchase Order Item' and fieldname = 'discount'"):
+		webnotes.conn.sql("update `tabPurchase Order Item` set discount_rate=discount")
 
 	# Features setup
 	reload_doc('setup', 'doctype', 'features_setup')
diff --git a/erpnext/patches/before_jan_2012/accounts_default_form.py b/erpnext/patches/before_jan_2012/accounts_default_form.py
index 282ebf5..eb8f586 100644
--- a/erpnext/patches/before_jan_2012/accounts_default_form.py
+++ b/erpnext/patches/before_jan_2012/accounts_default_form.py
@@ -16,7 +16,7 @@
 
 def execute():
         import webnotes
-        from webnotes.modules.module_manager import reload_doc
+        from webnotes.modules import reload_doc
         reload_doc('setup', 'doctype', 'company')
         reload_doc('setup', 'doctype', 'manage_account')
  
diff --git a/erpnext/patches/before_jan_2012/auto_indent.py b/erpnext/patches/before_jan_2012/auto_indent.py
index 7373c39..a472d80 100644
--- a/erpnext/patches/before_jan_2012/auto_indent.py
+++ b/erpnext/patches/before_jan_2012/auto_indent.py
@@ -16,7 +16,7 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('setup', 'doctype', 'manage_account')
 	reload_doc('stock', 'doctype', 'item')
 	webnotes.conn.sql("delete from `tabDocField` where fieldname='minimum_inventory_level' and parent='item'")
diff --git a/erpnext/patches/before_jan_2012/c_form_patch.py b/erpnext/patches/before_jan_2012/c_form_patch.py
index 8c00891..76e3646 100644
--- a/erpnext/patches/before_jan_2012/c_form_patch.py
+++ b/erpnext/patches/before_jan_2012/c_form_patch.py
@@ -16,7 +16,7 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 
 	reload_doc('accounts', 'doctype', 'receivable_voucher')
 	reload_doc('accounts', 'doctype', 'c_form')
@@ -24,5 +24,5 @@
 	reload_doc('accounts', 'Module Def', 'Accounts')
 
 	sql = webnotes.conn.sql
-	sql("update `tabReceivable Voucher` set c_form_applicable = 'Yes' where c_form_applicable = 'Y'")
-	sql("update `tabReceivable Voucher` set c_form_applicable = 'No' where c_form_applicable = 'N'")
+	sql("update `tabSales Invoice` set c_form_applicable = 'Yes' where c_form_applicable = 'Y'")
+	sql("update `tabSales Invoice` set c_form_applicable = 'No' where c_form_applicable = 'N'")
diff --git a/erpnext/patches/before_jan_2012/delivery_billing_status_patch.py b/erpnext/patches/before_jan_2012/delivery_billing_status_patch.py
index 2213c20..424ef4a 100644
--- a/erpnext/patches/before_jan_2012/delivery_billing_status_patch.py
+++ b/erpnext/patches/before_jan_2012/delivery_billing_status_patch.py
@@ -23,15 +23,15 @@
 #--------------------------
 def update_delivered_billed_qty():
 	# update billed amt in item table in so and dn
-	sql("""	update `tabSales Order Detail` so
-		set billed_amt = (select sum(amount) from `tabRV Detail` where `so_detail`= so.name and docstatus=1 and parent not like 'old%%'),
-		delivered_qty = (select sum(qty) from `tabDelivery Note Detail` where `prevdoc_detail_docname`= so.name and docstatus=1 and parent not like 'old%%'), 
+	sql("""	update `tabSales Order Item` so
+		set billed_amt = (select sum(amount) from `tabSales Invoice Item` where `so_detail`= so.name and docstatus=1 and parent not like 'old%%'),
+		delivered_qty = (select sum(qty) from `tabDelivery Note Item` where `prevdoc_detail_docname`= so.name and docstatus=1 and parent not like 'old%%'), 
 		modified = now()
 		where docstatus = 1
 	""")
 
-	sql(""" update `tabDelivery Note Detail` dn
-		set billed_amt = (select sum(amount) from `tabRV Detail` where `dn_detail`= dn.name and docstatus=1 and parent not like 'old%%'), 
+	sql(""" update `tabDelivery Note Item` dn
+		set billed_amt = (select sum(amount) from `tabSales Invoice Item` where `dn_detail`= dn.name and docstatus=1 and parent not like 'old%%'), 
 		modified = now()
 		where docstatus = 1
 	""")
@@ -41,8 +41,8 @@
 def update_percent():
 	# calculate % billed based on item table
 	sql("""	update `tabSales Order` so
-		set per_delivered = (select sum(if(qty > ifnull(delivered_qty, 0), delivered_qty, qty))/sum(qty)*100 from `tabSales Order Detail` where parent=so.name), 
-		per_billed = (select sum(if(amount > ifnull(billed_amt, 0), billed_amt, amount))/sum(amount)*100 from `tabSales Order Detail` where parent = so.name), 
+		set per_delivered = (select sum(if(qty > ifnull(delivered_qty, 0), delivered_qty, qty))/sum(qty)*100 from `tabSales Order Item` where parent=so.name), 
+		per_billed = (select sum(if(amount > ifnull(billed_amt, 0), billed_amt, amount))/sum(amount)*100 from `tabSales Order Item` where parent = so.name), 
 		modified = now()
 		where docstatus = 1
 	""")
@@ -50,7 +50,7 @@
 	# update DN	
 	# ---------	
 	sql("""	update `tabDelivery Note` dn
-		set per_billed = (select sum(if(amount > ifnull(billed_amt, 0), billed_amt, amount))/sum(amount)*100 from `tabDelivery Note Detail` where parent = dn.name), 
+		set per_billed = (select sum(if(amount > ifnull(billed_amt, 0), billed_amt, amount))/sum(amount)*100 from `tabDelivery Note Item` where parent = dn.name), 
 		modified = now()
 		where docstatus=1
 	""")
diff --git a/erpnext/patches/before_jan_2012/deploy_email_digest.py b/erpnext/patches/before_jan_2012/deploy_email_digest.py
index 5adeb97..8474b64 100644
--- a/erpnext/patches/before_jan_2012/deploy_email_digest.py
+++ b/erpnext/patches/before_jan_2012/deploy_email_digest.py
@@ -21,7 +21,7 @@
 		* Reload email_digest doctype
 		* Create default email digest
 	"""
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	
 	# Minor fix in print_format doctype
 	#reload_doc('core', 'doctype', 'print_format')
diff --git a/erpnext/patches/before_jan_2012/employeewise_balance_leave_report.py b/erpnext/patches/before_jan_2012/employeewise_balance_leave_report.py
index bab119e..83f2143 100644
--- a/erpnext/patches/before_jan_2012/employeewise_balance_leave_report.py
+++ b/erpnext/patches/before_jan_2012/employeewise_balance_leave_report.py
@@ -22,7 +22,7 @@
 """
 def execute():
 	from webnotes.model.doc import Document
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('hr', 'search_criteria', 'employeewise_balance_leave_report')
 	d = Document('Search Criteria', 'employeewise_balance_leave_report')
 	d.criteria_name = 'Employee Leave Balance Report'
diff --git a/erpnext/patches/before_jan_2012/erpnext_structure_cleanup.py b/erpnext/patches/before_jan_2012/erpnext_structure_cleanup.py
index aab64a0..0e0e68f 100644
--- a/erpnext/patches/before_jan_2012/erpnext_structure_cleanup.py
+++ b/erpnext/patches/before_jan_2012/erpnext_structure_cleanup.py
@@ -19,7 +19,7 @@
 
 import webnotes
 from webnotes.model import delete_doc
-from webnotes.modules.module_manager import reload_doc
+from webnotes.modules import reload_doc
 from webnotes.modules.export_module import export_to_files
 sql = webnotes.conn.sql
 
@@ -85,7 +85,7 @@
 def delete_unwanted_mappers():
 	"deletes unwanted mappers"
 	
-	lst = ['Customer Issue-Maintenance Report', 'Enquiry-Service Quotation', 'Sales Order-Maintenance Report', 'Service Quotation-Service Order', 'Supplier Quotation-Purchase Order', 'Visit Schedule-Maintenance Report', 'RFQ-Supplier Quotation', 'Indent-RFQ']
+	lst = ['Customer Issue-Maintenance Report', 'Enquiry-Service Quotation', 'Sales Order-Maintenance Report', 'Service Quotation-Service Order', 'Supplier Quotation-Purchase Order', 'Visit Schedule-Maintenance Report', 'RFQ-Supplier Quotation', 'Purchase Request-RFQ']
 	for d in lst:
 		try:
 			delete_doc('DocType Mapper', d)
@@ -161,13 +161,13 @@
 	"Put mappers into corresponding module"
 		
 	mappers = {
-		'Accounts':		('Delivery Note-Receivable Voucher', 'Project-Receivable Voucher', 'Purchase Order-Payable Voucher', 'Purchase Receipt-Payable Voucher', 'Sales Order-Receivable Voucher'), 
-		'Selling': 		('Delivery Note-Installation Note', 'Enquiry-Quotation', 'Lead-Enquiry', 'Lead-Customer', 'Project-Sales Order', 'Quotation-Sales Order', ), 
-		'Buying':		('Indent-Purchase Order', 'Sales Order-Indent'), 
-		'Stock':		('Purchase Order-Purchase Receipt', 'Project-Delivery Note', 'Receivable Voucher-Delivery Note', 'Sales Order-Delivery Note'), 
+		'Accounts':		('Delivery Note-Sales Invoice', 'Project-Sales Invoice', 'Purchase Order-Purchase Invoice', 'Purchase Receipt-Purchase Invoice', 'Sales Order-Sales Invoice'), 
+		'Selling': 		('Delivery Note-Installation Note', 'Opportunity-Quotation', 'Lead-Opportunity', 'Lead-Customer', 'Project-Sales Order', 'Quotation-Sales Order', ), 
+		'Buying':		('Purchase Request-Purchase Order', 'Sales Order-Purchase Request'), 
+		'Stock':		('Purchase Order-Purchase Receipt', 'Project-Delivery Note', 'Sales Invoice-Delivery Note', 'Sales Order-Delivery Note'), 
 		'Support':		('Customer Issue-Maintenance Visit', 'Sales Order-Maintenance Schedule', 'Sales Order-Maintenance Visit'), 
 		'Production':	('Production Forecast-Production Plan', 'Production Forecast-Production Planning Tool', 'Sales Order-Production Plan'), 
-		'HR':			('KRA Template-Appraisal', 'Salary Structure-Salary Slip')
+		'HR':			('Appraisal Template-Appraisal', 'Salary Structure-Salary Slip')
 	}
 	
 	for mod in mappers.keys():
@@ -195,7 +195,7 @@
 #---------------------------------------
 def run_patches():
 	# update module
-	dt_module = {'LC PR Detail':'Stock', 'Landed Cost Detail':'Stock', 'Comment Widget Record': 'Core', 'Tag':'Core', 'Tag Detail': 'Core', 'POS Settings': 'Accounts', 'Menu Item': 'Setup', 'Menu Item Role': 'Setup'}
+	dt_module = {'Landed Cost Purchase Receipt':'Stock', 'Landed Cost Item':'Stock', 'Comment': 'Core', 'Tag':'Core', 'Tag Detail': 'Core', 'POS Settings': 'Accounts', 'Menu Item': 'Setup', 'Menu Item Role': 'Setup'}
 	for d in dt_module.keys():
 		sql("update `tabDocType` set module = '%s' where name = '%s'" % (dt_module[d], d))
 	delete_unwanted_mappers()
diff --git a/erpnext/patches/before_jan_2012/index_patch.py b/erpnext/patches/before_jan_2012/index_patch.py
index 7e1991c..fef48de 100644
--- a/erpnext/patches/before_jan_2012/index_patch.py
+++ b/erpnext/patches/before_jan_2012/index_patch.py
@@ -26,14 +26,14 @@
 	from webnotes.modules.export_module import export_to_files
 
 	dt_index_fields={
-						'Purchase Receipt Detail': ['prevdoc_docname', 'item_code', 'warehouse', 'prevdoc_detail_docname'], 
+						'Purchase Receipt Item': ['prevdoc_docname', 'item_code', 'warehouse', 'prevdoc_detail_docname'], 
 						'Period Closing Voucher': ['closing_account_head', 'fiscal_year'], 
 						'Lead': ['lead_name', 'status', 'transaction_date'], 
 						'Time Sheet Detail': ['app_name'], 
-						'Item Specification Detail': [], 
+						'Item Quality Inspection Parameter': [], 
 						'Budget Detail': ['fiscal_year', 'account'], 
 						'Grade': [], 
-						'RV Tax Detail': ['parenttype', 'account_head'], 
+						'Sales Taxes and Charges': ['parenttype', 'account_head'], 
 						'TDS Category Account': ['account_head'], 
 						'Role': [], 
 						'Leave Allocation': ['leave_type', 'employee', 'fiscal_year'], 
@@ -50,25 +50,25 @@
 						'DocFormat': ['format'], 
 						'DocType Mapper': ['from_doctype', 'to_doctype'], 
 						'Brand': [], 
-						'Order Lost Reason': [], 
+						'Quotation Lost Reason': [], 
 						'Journal Voucher': ['posting_date', 'voucher_type'], 
 						'TDS Return Acknowledgement': ['date_of_receipt', 'acknowledgement'], 
 						'BOM Report Detail': ['item_code'], 
-						'Quotation Detail': ['item_code'], 
+						'Quotation Item': ['item_code'], 
 						'Update Delivery Date Detail': ['sales_order_no'], 
-						'Advance Adjustment Detail': ['journal_voucher'], 
+						'Sales Invoice Advance': ['journal_voucher'], 
 						'Authorization Rule': ['approving_user', 'system_user', 'system_role', 'approving_role'], 
 						'DocPerm': ['permlevel', 'role'], 
 						'Stock Entry Detail': ['item_code', 't_warehouse', 's_warehouse'], 
 						'Stock Entry': ['posting_date', 'delivery_note_no', 'purchase_receipt_no', 'production_order'], 
 						'Price List': [], 
-						'KRA Sheet': [], 
+						'Appraisal Template Goal': [], 
 						'Production Order': ['status', 'project_name', 'production_item'], 
 						'Account': ['lft', 'rgt', 'parent_account'], 
 						'Earn Deduction Detail': [], 
-						'Indent': ['status', 'transaction_date'], 
+						'Purchase Request': ['status', 'transaction_date'], 
 						'Tag Detail': [], 
-						'SS Deduction Detail': ['d_type'], 
+						'Salary Slip Deduction': ['d_type'], 
 						'Batch': ['item'], 
 						'Deduction Type': [], 
 						'Project': ['project_name', 'customer'], 
@@ -77,33 +77,33 @@
 						'Property Setter': ['doc_type', 'doc_name', 'property'], 
 						'Appraisal': ['status', 'employee'], 
 						'Letter Head': [], 
-						'Follow up': ['follow_up_by'], 
+						'Communication Log': ['follow_up_by'], 
 						'Project Cost Breakup': [], 
 						'Table Mapper Detail': [], 
 						'Campaign': [], 
-						'Static Parameter Detail': [], 
+						'SMS Parameter': [], 
 						'Leave Type': [], 
 						'Account Balance': ['period', 'start_date', 'end_date', 'account'], 
 						'Absent Days Detail': [], 
 						'Tag': [], 
 						'Raw Materials Supplied': ['raw_material'], 
 						'Project Activity Update': [], 
-						'PR Raw Material Detail': [], 
+						'Purchase Receipt Item Supplied': [], 
 						'Bank Reconciliation Detail': ['voucher_id'], 
 						'Sales Order': ['quotation_no', 'project_name', 'customer', 'posting_date'], 
 						'Chapter VI A Detail': [], 
-						'Experience In Company Detail': [], 
+						'Employee Internal Work History': [], 
 						'Order Reconciliation Detail': ['sales_order_no'], 
 						'Attendance': ['employee', 'att_date'], 
-						'Previous Experience Detail': [], 
-						'Earning Detail': ['e_type'], 
-						'Sales Order Detail': ['item_code', 'prevdoc_docname', 'reserved_warehouse'], 
-						'KRA Template': [], 
+						'Employee External Work History': [], 
+						'Salary Structure Earning': ['e_type'], 
+						'Sales Order Item': ['item_code', 'prevdoc_docname', 'reserved_warehouse'], 
+						'Appraisal Template': [], 
 						'Budget Distribution': ['fiscal_year'], 
 						'Workstation': ['warehouse'], 
 						'Period': [], 
 						'Training Session Details': [], 
-						'Other Charges': [], 
+						'Sales Taxes and Charges Master': [], 
 						'State': [], 
 						'Bulk Rename Tool': [], 
 						'Landed Cost Master Detail': [], 
@@ -119,48 +119,47 @@
 						'Campaign Expense': [], 
 						'Time Sheet': ['employee_name', 'time_sheet_date'], 
 						'File Group': ['parent_group'], 
-						'Maintenance Visit Detail': ['item_code', 'service_person'], 
+						'Maintenance Visit Purpose': ['item_code', 'service_person'], 
 						'Support Ticket Response': [], 
-						'PV Detail': ['item_code', 'purchase_order', 'po_detail', 'purchase_receipt', 'pr_detail', 'expense_head', 'cost_center'], 
+						'Purchase Invoice Item': ['item_code', 'purchase_order', 'po_detail', 'purchase_receipt', 'pr_detail', 'expense_head', 'cost_center'], 
 						'Timesheet Detail': ['project_name', 'task_id', 'customer_name'], 
-						'Holiday List Detail': [], 
+						'Holiday': [], 
 						'Workflow Rule Detail': [], 
 						'Module Def': ['module_seq', 'module_page'], 
-						'Term': [], 
+						'Terms and Conditions': [], 
 						'PF Detail': ['item_code'], 
 						'POS Setting': ['user', 'territory'], 
-						'QA Specification Detail': [], 
+						'Quality Inspection Reading': [], 
 						'Support Ticket': ['customer', 'allocated_to', 'status'], 
 						'Project Activity': ['project'], 
 						'Customer Group': ['lft', 'rgt', 'parent_customer_group'], 
-						'Return Detail': ['item_code'], 
+						'Sales and Purchase Return Item': ['item_code'], 
 						'Series Detail': [], 
 						'Event Role': ['role'], 
 						'Contact': ['employee_id'], 
-						'BOM Material': ['item_code', 'bom_no'], 
+						'BOM Item': ['item_code', 'bom_no'], 
 						'Invest 80 Declaration Detail': [], 
-						'PO Raw Material Detail': [], 
+						'Purchase Order Item Supplied': [], 
 						'Industry Type': [], 
 						'Declaration Detail': [], 
 						'Holiday List': ['fiscal_year'], 
 						'Sales Person': ['lft', 'rgt', 'parent_sales_person'], 
-						'RV Detail': ['item_code', 'sales_order', 'so_detail', 'delivery_note', 'dn_detail', 'cost_center', 'income_account'], 
+						'Sales Invoice Item': ['item_code', 'sales_order', 'so_detail', 'delivery_note', 'dn_detail', 'cost_center', 'income_account'], 
 						'Module Def Item': [], 
 						'TDS Category': [], 
 						'DocTrigger': [], 
 						'Print Format': ['standard'], 
-						'Installed Item Details': ['prevdoc_docname', 'item_code'], 
+						'Installation Note Item': ['prevdoc_docname', 'item_code'], 
 						'Form 16A Tax Detail': [], 
 						'Event': ['event_date', 'event_type'], 
 						'Currency': [], 
-						'Service Quotation Detail': ['item_code'], 
 						'Warehouse Type': ['warehouse_type'], 
 						'Sales BOM': ['item_group'], 
 						'IT Checklist': ['employee'], 
-						'Purchase Other Charges': [], 
+						'Purchase Taxes and Charges Master': [], 
 						'Company': [], 
 						'Call Log': [], 
-						'Professional Training Details': [], 
+						'Employee Training': [], 
 						'Warehouse': ['warehouse_type'], 
 						'Competitor': [], 
 						'Mode of Payment': [], 
@@ -168,19 +167,19 @@
 						'Cost Center': ['lft', 'rgt', 'parent_cost_center'], 
 						'Timesheet': ['status', 'timesheet_date'], 
 						'Form 16A': ['party_no'], 
-						'Sales BOM Detail': ['item_code'], 
+						'Sales BOM Item': ['item_code'], 
 						'Answer': ['question'], 
 						'Supplier': [], 
 						'Installation Note': ['delivery_note_no', 'customer', 'inst_date'], 
-						'Expense Voucher': ['approval_status', 'employee'], 
+						'Expense Claim': ['approval_status', 'employee'], 
 						'Target Detail': ['from_date', 'to_date', 'fiscal_year'], 
 						'Page Role': ['role'], 
 						'Partner Target Detail': ['fiscal_year', 'item_group'], 
 						'Shipping Address': ['customer'], 
-						'Indent Detail': ['item_code', 'warehouse'], 
+						'Purchase Request Item': ['item_code', 'warehouse'], 
 						'TDS Payment Detail': [], 
 						'Market Segment': [], 
-						'Comment Widget Record': [], 
+						'Comment': [], 
 						'Service Order Detail': ['item_code', 'prevdoc_docname'], 
 						'TDS Payment': ['from_date', 'to_date', 'tds_category'], 
 						'Lead Email CC Detail': [], 
@@ -188,28 +187,28 @@
 						'Salary Slip': ['month', 'year', 'employee'], 
 						'Maintenance Schedule Detail': ['item_code', 'scheduled_date'], 
 						'Employment Type': [], 
-						'Advance Allocation Detail': ['journal_voucher'], 
+						'Purchase Invoice Advance': ['journal_voucher'], 
 						'Quotation': ['customer', 'transaction_date'], 
-						'Deduction Detail': ['d_type'], 
-						'Bill Of Materials': ['item', 'project_name'], 
+						'Salary Structure Deduction': ['d_type'], 
+						'BOM': ['item', 'project_name'], 
 						'Earning Type': [], 
 						'Designation': [], 
 						'BOM Replace Utility Detail': ['parent_bom'], 
 						'Question': [], 
 						'Stock Ledger Entry': ['item_code', 'warehouse', 'posting_date', 'posting_time'], 
-						'Educational Qualifications Detail': [], 
+						'Employee Education': [], 
 						'BOM Operation': [], 
 						'Item Group': ['lft', 'rgt', 'parent_item_group'], 
 						'Workflow Action Detail': [], 
 						'User Setting-Profile': [], 
 						'Customer Issue': ['item_code', 'customer', 'complaint_date'], 
 						'Feed': [], 
-						'Purchase Tax Detail': ['account_head'], 
+						'Purchase Taxes and Charges': ['account_head'], 
 						'GL Mapper Detail': [], 
 						'TDS Detail': [], 
 						'PRO Detail': ['item_code', 'source_warehouse'], 
 						'DocType Label': [], 
-						'Receivable Voucher': ['posting_date', 'debit_to', 'project_name'], 
+						'Sales Invoice': ['posting_date', 'debit_to', 'project_name'], 
 						'GL Entry': ['posting_date', 'account', 'voucher_no'], 
 						'Serial No': ['status', 'warehouse'], 
 						'Delivery Note': ['posting_date', 'project_name', 'customer'], 
@@ -221,23 +220,23 @@
 						'GL Mapper': [], 
 						'Announcement': [], 
 						'Call Log Details': [], 
-						'Enquiry': ['lead', 'customer', 'transaction_date'], 
-						'Flat BOM Detail': ['item_code'], 
-						'Landed Cost Detail': ['account_head'], 
+						'Opportunity': ['lead', 'customer', 'transaction_date'], 
+						'BOM Explosion Item': ['item_code'], 
+						'Landed Cost Item': ['account_head'], 
 						'Field Mapper Detail': ['from_field', 'to_field'], 
 						'File Data': [], 
 						'Question Tag': [], 
-						'QA Inspection Report': ['item_code', 'purchase_receipt_no', 'report_date'], 
-						'Appraisal Detail': [], 
+						'Quality Inspection': ['item_code', 'purchase_receipt_no', 'report_date'], 
+						'Appraisal Goal': [], 
 						'POS Settings': ['territory'], 
-						'Delivery Note Detail': ['item_code', 'prevdoc_docname', 'warehouse', 'prevdoc_detail_docname'], 
+						'Delivery Note Item': ['item_code', 'prevdoc_docname', 'warehouse', 'prevdoc_detail_docname'], 
 						'Profile': [], 
 						'Other Income Detail': [], 
 						'Product': ['item_code', 'stock_warehouse'], 
-						'PO Detail': ['prevdoc_docname', 'item_code', 'prevdoc_detail_docname', 'warehouse'], 
+						'Purchase Order Item': ['prevdoc_docname', 'item_code', 'prevdoc_detail_docname', 'warehouse'], 
 						'Module Def Role': ['role'], 
 						'Sales Team': ['sales_person'], 
-						'Enquiry Detail': ['item_code'], 
+						'Opportunity Item': ['item_code'], 
 						'DocType': [], 
 						'Compaint Note': ['nature_of_complaint', 'compliance_date'], 
 						'Maintenance Schedule': ['customer', 'sales_order_no'], 
@@ -246,39 +245,38 @@
 						'Purchase Receipt': ['posting_date', 'supplier', 'project_name'], 
 						'Complaint Detail': ['item_name'], 
 						'Address': ['customer', 'supplier'], 
-						'Ticket': ['request_date', 'allocated_to', 'category', 'customer', 'project'], 
+						'Task': ['request_date', 'allocated_to', 'category', 'customer', 'project'], 
 						'Territory Target Detail': ['month', 'fiscal_year'], 
-						'LC PR Detail': ['purchase_receipt_no'], 
+						'Landed Cost Purchase Receipt': ['purchase_receipt_no'], 
 						'Customer': ['customer_name', 'customer_group'], 
-						'PP SO Detail': [], 
-						'PP Detail': ['document_date', 'item_code', 'parent_item'], 
+						'Production Plan Sales Order': [], 
+						'Production Plan Item': ['document_date', 'item_code', 'parent_item'], 
 						'User Setting-Role Permission': [], 
 						'Custom Script': ['dt'], 
 						'Country': [], 
 						'DefaultValue': [], 
-						'Ledger Detail': [], 
-						'SS Earning Detail': ['e_type'], 
+						'Multi Ledger Report Detail': [], 
+						'Salary Slip Earning': ['e_type'], 
 						'SMS Log': [], 
-						'Expense Type': [], 
+						'Expense Claim Type': [], 
 						'Item': ['item_group'], 
 						'Fiscal Year': [], 
-						'ToDo Item': ['role'], 
-						'Payable Voucher': ['posting_date', 'credit_to', 'project_name', 'supplier'], 
+						'ToDo': ['role'], 
+						'Purchase Invoice': ['posting_date', 'credit_to', 'project_name', 'supplier'], 
 						'Journal Voucher Detail': ['account', 'against_voucher', 'against_invoice', 'against_jv'], 
 						'Online Contact': [], 
 						'Page': ['module'], 
 						'Leave Application': ['employee', 'leave_type', 'from_date', 'to_date'], 
-						'Expense Voucher Detail': ['expense_type'], 
+						'Expense Claim Detail': ['expense_type'], 
 						'Maintenance Visit': ['customer', 'sales_order_no', 'customer_issue_no'], 
-						'Ref Rate Detail': ['price_list_name', 'ref_currency'], 
-						'Receiver Detail': [], 
+						'Item Price': ['price_list_name', 'ref_currency'], 
+						'SMS Receiver': [], 
 						'Naming Series Options': ['doc_type'], 
 						'Activity Type': [], 
-						'PRO PP Detail': [], 
-						'Delivery Note Packing Detail': ['item_code', 'parent_item', 'warehouse'], 
+						'Delivery Note Packing Item': ['item_code', 'parent_item', 'warehouse'], 
 						'Workflow Rule': ['select_form'], 
 						'File': ['file_group'], 
-						'Item Maintenance Detail': ['item_code', 'start_date', 'end_date', 'prevdoc_docname'], 
+						'Maintenance Schedule Item': ['item_code', 'start_date', 'end_date', 'prevdoc_docname'], 
 						'Purchase Order': ['supplier', 'project_name', 'posting_date'], 
 						'Print Heading': [], 
 						'TDS Rate Detail': ['category']
diff --git a/erpnext/patches/before_jan_2012/install_print_formats.py b/erpnext/patches/before_jan_2012/install_print_formats.py
index 3a18aae..92bd60c 100644
--- a/erpnext/patches/before_jan_2012/install_print_formats.py
+++ b/erpnext/patches/before_jan_2012/install_print_formats.py
@@ -39,7 +39,7 @@
 pf_to_install = prepare_pf_dict([
 	{
 		'name' : 'Sales Invoice',
-		'doc_type' : 'Receivable Voucher',
+		'doc_type' : 'Sales Invoice',
 		'module' : 'Accounts'
 	},
 	{
@@ -68,7 +68,7 @@
 	"""
 		Install print formats
 	"""
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('core', 'doctype', 'print_format')
 	
 	#copy_doctype_to_pfs()
diff --git a/erpnext/patches/before_jan_2012/lcw_patch.py b/erpnext/patches/before_jan_2012/lcw_patch.py
index b274069..dbf2f6d 100644
--- a/erpnext/patches/before_jan_2012/lcw_patch.py
+++ b/erpnext/patches/before_jan_2012/lcw_patch.py
@@ -16,10 +16,10 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	
 	
 	reload_doc('stock', 'doctype', 'landed_cost_wizard')
 	reload_doc('stock', 'doctype', 'lc_pr_detail')
 	
-	webnotes.conn.sql("delete from `tabDocField` where parent ='LC PR Detail' and fieldname in ('purchase_receipt_no', 'include_in_landed_cost')")
+	webnotes.conn.sql("delete from `tabDocField` where parent ='Landed Cost Purchase Receipt' and fieldname in ('purchase_receipt_no', 'include_in_landed_cost')")
diff --git a/erpnext/patches/before_jan_2012/p1.py b/erpnext/patches/before_jan_2012/p1.py
index ef8ca4c..74d8470 100644
--- a/erpnext/patches/before_jan_2012/p1.py
+++ b/erpnext/patches/before_jan_2012/p1.py
@@ -16,5 +16,5 @@
 
 def execute():
 	import webnotes
-	if not webnotes.conn.sql("select name from tabDocFormat where parent = 'Receivable Voucher' and format != 'POS Invoice'"):
-		webnotes.conn.sql("update tabDocType set default_print_format = 'Standard' where name =  'Receivable Voucher'")
+	if not webnotes.conn.sql("select name from tabDocFormat where parent = 'Sales Invoice' and format != 'POS Invoice'"):
+		webnotes.conn.sql("update tabDocType set default_print_format = 'Standard' where name =  'Sales Invoice'")
diff --git a/erpnext/patches/before_jan_2012/packing_slip.py b/erpnext/patches/before_jan_2012/packing_slip.py
index 23c34d9d..7fe2d5d 100644
--- a/erpnext/patches/before_jan_2012/packing_slip.py
+++ b/erpnext/patches/before_jan_2012/packing_slip.py
@@ -16,7 +16,7 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('stock', 'doctype', 'delivery_note_detail')
 	reload_doc('stock', 'Print Format', 'Delivery Note Packing List Wise')
 	
diff --git a/erpnext/patches/before_jan_2012/price_list_patch.py b/erpnext/patches/before_jan_2012/price_list_patch.py
index ce2ff4a..d5d673e 100644
--- a/erpnext/patches/before_jan_2012/price_list_patch.py
+++ b/erpnext/patches/before_jan_2012/price_list_patch.py
@@ -16,7 +16,7 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 
 	reload_doc('accounts', 'doctype', 'receivable_voucher')
 	reload_doc('stock', 'doctype', 'delivery_note')
@@ -25,5 +25,5 @@
 	reload_doc('setup', 'doctype', 'manage_account')
 
 
-	for d in ['Receivable Voucher', 'Delivery Note', 'Sales Order', 'Quotation']:
+	for d in ['Sales Invoice', 'Delivery Note', 'Sales Order', 'Quotation']:
 		webnotes.conn.sql("update `tab%s` set price_list_currency = currency, plc_conversion_rate = conversion_rate" % d)
diff --git a/erpnext/patches/before_jan_2012/project_patch.py b/erpnext/patches/before_jan_2012/project_patch.py
index f4b0ea6..8090029 100644
--- a/erpnext/patches/before_jan_2012/project_patch.py
+++ b/erpnext/patches/before_jan_2012/project_patch.py
@@ -16,7 +16,7 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	sql = webnotes.conn.sql
 	
 	# Reload item table
@@ -25,10 +25,10 @@
 	reload_doc('stock', 'doctype', 'purchase_receipt_detail')
 	
 	# copy project value from parent to child
-	sql("update `tabPO Detail` t1, `tabPurchase Order` t2 set t1.project_name = t2.project_name where t1.parent = t2.name and ifnull(t1.project_name, '') = ''")
-	sql("update `tabPV Detail` t1, `tabPayable Voucher` t2 set t1.project_name = t2.project_name where t1.parent = t2.name and ifnull(t1.project_name, '') = ''")
-	sql("update `tabPurchase Receipt Detail` t1, `tabPurchase Receipt` t2 set t1.project_name = t2.project_name where t1.parent = t2.name and ifnull(t1.project_name, '') = ''")
+	sql("update `tabPurchase Order Item` t1, `tabPurchase Order` t2 set t1.project_name = t2.project_name where t1.parent = t2.name and ifnull(t1.project_name, '') = ''")
+	sql("update `tabPurchase Invoice Item` t1, `tabPurchase Invoice` t2 set t1.project_name = t2.project_name where t1.parent = t2.name and ifnull(t1.project_name, '') = ''")
+	sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.project_name = t2.project_name where t1.parent = t2.name and ifnull(t1.project_name, '') = ''")
 	
 	# delete project from parent
-	sql("delete from `tabDocField` where fieldname = 'project_name' and parent in ('Purchase Order', 'Purchase Receipt', 'Payable Voucher')")
+	sql("delete from `tabDocField` where fieldname = 'project_name' and parent in ('Purchase Order', 'Purchase Receipt', 'Purchase Invoice')")
 
diff --git a/erpnext/patches/before_jan_2012/reload_address.py b/erpnext/patches/before_jan_2012/reload_address.py
index 3ef80d8..ae68f6f 100644
--- a/erpnext/patches/before_jan_2012/reload_address.py
+++ b/erpnext/patches/before_jan_2012/reload_address.py
@@ -16,6 +16,6 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 
 	reload_doc('utilities', 'doctype', 'address')
diff --git a/erpnext/patches/before_jan_2012/reload_bom.py b/erpnext/patches/before_jan_2012/reload_bom.py
index f925bc6..cbacce1 100644
--- a/erpnext/patches/before_jan_2012/reload_bom.py
+++ b/erpnext/patches/before_jan_2012/reload_bom.py
@@ -16,6 +16,6 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 
 	reload_doc('production', 'doctype', 'bill_of_materials')
diff --git a/erpnext/patches/before_jan_2012/reload_doclayer.py b/erpnext/patches/before_jan_2012/reload_doclayer.py
index 4ab077e..6c694a0 100644
--- a/erpnext/patches/before_jan_2012/reload_doclayer.py
+++ b/erpnext/patches/before_jan_2012/reload_doclayer.py
@@ -15,17 +15,17 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 """
-	Reload DocLayer, DocLayerField and Print Format doctypes
+	Reload Customize Form, Customize Form Field and Print Format doctypes
 """
 def execute():
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('core', 'doctype', 'print_format')
 	reload_doc('core', 'doctype', 'doclayer')
 	reload_doc('core', 'doctype', 'doclayerfield')
 	reload_doc('accounts', 'doctype', 'gl_entry')
 	from webnotes.model.doc import Document
 	d = Document('DocType Label')
-	d.dt = "DocLayer"
+	d.dt = "Customize Form"
 	d.dt_label = "Customize Form View"
 	d.save(1)
 	from webnotes.session_cache import clear
diff --git a/erpnext/patches/before_jan_2012/reload_email_digest.py b/erpnext/patches/before_jan_2012/reload_email_digest.py
index 13a2614..15cbfc3 100644
--- a/erpnext/patches/before_jan_2012/reload_email_digest.py
+++ b/erpnext/patches/before_jan_2012/reload_email_digest.py
@@ -15,5 +15,5 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 def execute():
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('Setup', 'DocType', 'Email Digest')
diff --git a/erpnext/patches/before_jan_2012/reload_employeewise_balance_leave_report.py b/erpnext/patches/before_jan_2012/reload_employeewise_balance_leave_report.py
index b60d3d4..53183cb 100644
--- a/erpnext/patches/before_jan_2012/reload_employeewise_balance_leave_report.py
+++ b/erpnext/patches/before_jan_2012/reload_employeewise_balance_leave_report.py
@@ -16,5 +16,5 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('hr', 'search_criteria', 'employeewise_balance_leave_report')
diff --git a/erpnext/patches/before_jan_2012/reload_flat_bom.py b/erpnext/patches/before_jan_2012/reload_flat_bom.py
index a46ad5e..020bd7e 100644
--- a/erpnext/patches/before_jan_2012/reload_flat_bom.py
+++ b/erpnext/patches/before_jan_2012/reload_flat_bom.py
@@ -16,7 +16,7 @@
 
 def execute():
 	from webnotes.modules import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 
 	reload_doc('production', 'doctype', 'flat_bom_detail')
 	reload_doc('production', 'doctype', 'bom_material')
diff --git a/erpnext/patches/before_jan_2012/reload_gl_mapper.py b/erpnext/patches/before_jan_2012/reload_gl_mapper.py
index 27f2c58..c43ab67 100644
--- a/erpnext/patches/before_jan_2012/reload_gl_mapper.py
+++ b/erpnext/patches/before_jan_2012/reload_gl_mapper.py
@@ -16,7 +16,7 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	
 	# reload jv gl mapper
 	reload_doc('accounts', 'GL Mapper', 'Journal Voucher')
diff --git a/erpnext/patches/before_jan_2012/reload_lc_wizard.py b/erpnext/patches/before_jan_2012/reload_lc_wizard.py
index 7645419..ac65177 100644
--- a/erpnext/patches/before_jan_2012/reload_lc_wizard.py
+++ b/erpnext/patches/before_jan_2012/reload_lc_wizard.py
@@ -16,10 +16,10 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	from webnotes.model import delete_doc
 
 	delete_doc('DocType', 'Landed Cost Wizard')
-	delete_doc('DocType', 'LC PR Detail')
+	delete_doc('DocType', 'Landed Cost Purchase Receipt')
 	reload_doc('stock', 'doctype', 'landed_cost_wizard')
 	reload_doc('stock', 'doctype', 'lc_pr_detail')
diff --git a/erpnext/patches/before_jan_2012/reload_print_format.py b/erpnext/patches/before_jan_2012/reload_print_format.py
index 37b83a6..cac8d6e 100644
--- a/erpnext/patches/before_jan_2012/reload_print_format.py
+++ b/erpnext/patches/before_jan_2012/reload_print_format.py
@@ -16,7 +16,7 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	from webnotes.model.doc import addchild
 	from webnotes.model.code import get_obj
 	reload_doc('stock', 'Print Format', 'Delivery Note Packing List Wise')
@@ -26,8 +26,8 @@
 	reload_doc('accounts', 'Print Format', 'Form 16A Print Format')
 	reload_doc('accounts', 'Print Format', 'Cheque Printing Format')
 	
-	if not webnotes.conn.sql("select format from `tabDocFormat` where name = 'POS Invoice' and parent = 'Receivable Voucher'"):		
-		dt_obj = get_obj('DocType', 'Receivable Voucher', with_children = 1)
+	if not webnotes.conn.sql("select format from `tabDocFormat` where name = 'POS Invoice' and parent = 'Sales Invoice'"):		
+		dt_obj = get_obj('DocType', 'Sales Invoice', with_children = 1)
 		ch = addchild(dt_obj.doc, 'formats', 'DocFormat', 1)
 		ch.format = 'POS Invoice'
 		ch.save(1)
diff --git a/erpnext/patches/before_jan_2012/reload_project_task.py b/erpnext/patches/before_jan_2012/reload_project_task.py
index 14d39fd..b21135b 100644
--- a/erpnext/patches/before_jan_2012/reload_project_task.py
+++ b/erpnext/patches/before_jan_2012/reload_project_task.py
@@ -18,6 +18,6 @@
 	Reload Task Doctype of Project Module
 """
 def execute():
-	from webnotes.modules.module_manager import reload_doc
-	reload_doc('Projects', 'DocType', 'Ticket')
+	from webnotes.modules import reload_doc
+	reload_doc('Projects', 'DocType', 'Task')
 
diff --git a/erpnext/patches/before_jan_2012/reload_reco.py b/erpnext/patches/before_jan_2012/reload_reco.py
index 9335992..782fc7f 100644
--- a/erpnext/patches/before_jan_2012/reload_reco.py
+++ b/erpnext/patches/before_jan_2012/reload_reco.py
@@ -16,7 +16,7 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	
 	reload_doc('stock', 'doctype', 'stock_reconciliation')
 	webnotes.conn.sql("delete from `tabDocField` where (label in ('Validate Data', 'Attachment HTML', 'Attachment') or fieldname in ('next_step', 'company', 'fiscal_year', 'amendment_date')) and parent = 'Stock Reconciliation'")
diff --git a/erpnext/patches/before_jan_2012/reload_rv.py b/erpnext/patches/before_jan_2012/reload_rv.py
index f41db49..4365563 100644
--- a/erpnext/patches/before_jan_2012/reload_rv.py
+++ b/erpnext/patches/before_jan_2012/reload_rv.py
@@ -16,7 +16,7 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	from webnotes.model.code import get_obj
 
 	reload_doc('accounts', 'doctype', 'receivable_voucher')
diff --git a/erpnext/patches/before_jan_2012/reload_support_ticket.py b/erpnext/patches/before_jan_2012/reload_support_ticket.py
index 803754f..f889687 100644
--- a/erpnext/patches/before_jan_2012/reload_support_ticket.py
+++ b/erpnext/patches/before_jan_2012/reload_support_ticket.py
@@ -16,7 +16,7 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('Support', 'DocType', 'Support Ticket')
 	from webnotes.model.code import get_obj
 	get_obj('DocType', 'Support Ticket').validate()
diff --git a/erpnext/patches/before_jan_2012/repost_stock.py b/erpnext/patches/before_jan_2012/repost_stock.py
index 2c62039..d8267ff 100644
--- a/erpnext/patches/before_jan_2012/repost_stock.py
+++ b/erpnext/patches/before_jan_2012/repost_stock.py
@@ -24,7 +24,7 @@
     sr = sql("""select name, item_code, purchase_document_no from `tabSerial No`
             where docstatus = 1 and purchase_document_type = 'Purchase Receipt'""")
     for d in sr:
-        val_rate = sql("""select valuation_rate from `tabPurchase Receipt Detail`
+        val_rate = sql("""select valuation_rate from `tabPurchase Receipt Item`
             where item_code = %s and parent = %s""", (d[1], d[2]))
         sql("""update `tabSerial No` set purchase_rate = %s where name = %s""",
            (val_rate and flt(val_rate[0][0]) or 0, d[0]))
diff --git a/erpnext/patches/before_jan_2012/sal_man_patch.py b/erpnext/patches/before_jan_2012/sal_man_patch.py
index b8f5301..626d2e3 100644
--- a/erpnext/patches/before_jan_2012/sal_man_patch.py
+++ b/erpnext/patches/before_jan_2012/sal_man_patch.py
@@ -17,7 +17,7 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	sql = webnotes.conn.sql
 
 	reload_doc('hr', 'doctype', 'salary_manager')
diff --git a/erpnext/patches/before_jan_2012/task_email_notification.py b/erpnext/patches/before_jan_2012/task_email_notification.py
index 8d1a078..9f7669a 100644
--- a/erpnext/patches/before_jan_2012/task_email_notification.py
+++ b/erpnext/patches/before_jan_2012/task_email_notification.py
@@ -16,5 +16,5 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('projects', 'doctype', 'ticket')
diff --git a/erpnext/patches/jan_mar_2012/allocated_to_profile.py b/erpnext/patches/jan_mar_2012/allocated_to_profile.py
index 32c7a2c..ef0ee97 100644
--- a/erpnext/patches/jan_mar_2012/allocated_to_profile.py
+++ b/erpnext/patches/jan_mar_2012/allocated_to_profile.py
@@ -32,5 +32,5 @@
 		AND label='Make Maintenance Visit'
 	""")
 
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('support', 'doctype', 'customer_issue')
diff --git a/erpnext/patches/jan_mar_2012/apps/todo_item.py b/erpnext/patches/jan_mar_2012/apps/todo_item.py
index 6eec6fd..f9a02bd 100644
--- a/erpnext/patches/jan_mar_2012/apps/todo_item.py
+++ b/erpnext/patches/jan_mar_2012/apps/todo_item.py
@@ -16,7 +16,7 @@
 
 def execute():
 	"""
-		* Reload ToDo Item
+		* Reload ToDo
 	"""
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('utilities', 'doctype', 'todo_item')
diff --git a/erpnext/patches/jan_mar_2012/customer_address_contact_patch.py b/erpnext/patches/jan_mar_2012/customer_address_contact_patch.py
index 4671143..32a2125 100644
--- a/erpnext/patches/jan_mar_2012/customer_address_contact_patch.py
+++ b/erpnext/patches/jan_mar_2012/customer_address_contact_patch.py
@@ -26,7 +26,7 @@
 	patch_primary_address()
 
 def reload_sc():
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('selling', 'search_criteria', 'customer_address_contact')
 	reload_doc('selling', 'Module Def', 'Selling')
 
diff --git a/erpnext/patches/jan_mar_2012/deploy_packing_slip.py b/erpnext/patches/jan_mar_2012/deploy_packing_slip.py
index 7a28ef8..d349dbc 100644
--- a/erpnext/patches/jan_mar_2012/deploy_packing_slip.py
+++ b/erpnext/patches/jan_mar_2012/deploy_packing_slip.py
@@ -15,7 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 import webnotes
-from webnotes.modules.module_manager import reload_doc
+from webnotes.modules import reload_doc
 
 def execute():
 	delete_fields_dn_detail()
@@ -33,7 +33,7 @@
 			'print_packing_slip', 'shipping_mark', 'packed_by',
 			'packing_checked_by', 'Text', 'pack_size'
 		],
-		'Delivery Note Detail': [
+		'Delivery Note Item': [
 			'pack_no', 'pack_gross_wt', 'weight_uom', 
 			'pack_nett_wt', 'no_of_packs', 'pack_unit', 'pack_size', 
 			'packed_by', 'packing_checked_by'
diff --git a/erpnext/patches/jan_mar_2012/doclabel_in_doclayer.py b/erpnext/patches/jan_mar_2012/doclabel_in_doclayer.py
index a6f7a7c..9091e95 100644
--- a/erpnext/patches/jan_mar_2012/doclabel_in_doclayer.py
+++ b/erpnext/patches/jan_mar_2012/doclabel_in_doclayer.py
@@ -22,7 +22,7 @@
 	"""
 	webnotes.conn.sql("""
 		UPDATE `tabDocField` SET options=NULL
-		WHERE parent='DocLayer' AND fieldname='doc_type'
+		WHERE parent='Customize Form' AND fieldname='doc_type'
 	""")
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('core', 'doctype', 'doclayer')
diff --git a/erpnext/patches/jan_mar_2012/dt_map_fix.py b/erpnext/patches/jan_mar_2012/dt_map_fix.py
index f669009..37732df 100644
--- a/erpnext/patches/jan_mar_2012/dt_map_fix.py
+++ b/erpnext/patches/jan_mar_2012/dt_map_fix.py
@@ -1,6 +1,6 @@
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	webnotes.conn.sql("delete from `tabField Mapper Detail` where from_field = 'transaction_date' and parent in ('Sales Order-Delivery Note', 'Purchase Order-Purchase Receipt')")
 
 	reload_doc('stock', 'DocType Mapper', 'Sales Order-Delivery Note')
diff --git a/erpnext/patches/jan_mar_2012/email_settings_reload.py b/erpnext/patches/jan_mar_2012/email_settings_reload.py
index ec6f05d..85c683e 100644
--- a/erpnext/patches/jan_mar_2012/email_settings_reload.py
+++ b/erpnext/patches/jan_mar_2012/email_settings_reload.py
@@ -25,5 +25,5 @@
 		WHERE parent = 'Email Settings' AND fieldname = 'mail_port'
 	""")
 
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('setup', 'doctype', 'email_settings')
diff --git a/erpnext/patches/jan_mar_2012/jan_production_patches.py b/erpnext/patches/jan_mar_2012/jan_production_patches.py
index d57fb9e..65dd5a8 100644
--- a/erpnext/patches/jan_mar_2012/jan_production_patches.py
+++ b/erpnext/patches/jan_mar_2012/jan_production_patches.py
@@ -20,7 +20,7 @@
 		Patch includes:
 		* Reload of Stock Entry Detail
 	"""
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 
 	reload_doc('stock', 'doctype', 'stock_entry_detail')
 	reload_doc('stock', 'doctype', 'item_supplier')
@@ -28,13 +28,13 @@
 
 	webnotes.conn.sql("""
 		UPDATE tabDocField SET fieldtype='Float'
-		WHERE parent='Bill Of Materials'
+		WHERE parent='BOM'
 		AND fieldname IN ('operating_cost', 'raw_material_cost', 'total_cost')
 	""")
 
 	webnotes.conn.sql("""
 		UPDATE tabDocField SET fieldtype='Float'
-		WHERE parent='BOM Material'
+		WHERE parent='BOM Item'
 		AND fieldname IN ('qty', 'rate', 'amount', 'qty_consumed_per_unit')
 	""")
 	
diff --git a/erpnext/patches/jan_mar_2012/label_cleanup.py b/erpnext/patches/jan_mar_2012/label_cleanup.py
index b40f36f..642140b 100644
--- a/erpnext/patches/jan_mar_2012/label_cleanup.py
+++ b/erpnext/patches/jan_mar_2012/label_cleanup.py
@@ -1,29 +1,19 @@
 def execute():
 	import webnotes
 	from webnotes.model import delete_doc
-	from webnotes.modules.module_manager import reload_doc
-
-	dt = {
-		'selling':	['quotation', 'sales_order', 'quotation_detail', 'sales_order_detail'], 
-		'stock':	['delivery_note', 'delivery_note_detail', 'purchase_receipt', 'purchase_receipt_detail'],
-		'accounts': ['receivable_voucher', 'payable_voucher', 'rv_detail', 'pv_detail', 'rv_tax_detail', 'purchase_tax_detail'],
-		'buying':	['purchase_order', 'po_detail']
-	}
-	for m in dt:
-		for d in dt[m]:
-			reload_doc(m, 'doctype', d)
+	from webnotes.modules import reload_doc
 
 
 	webnotes.conn.sql("""delete from `tabDocField` 
 		where label in ('Note1', 'OT Notes', 'Note', 'Note HTML', 'Rates HTML') 
-		and parent in ('Quotation', 'Sales Order', 'Delivery Note', 'Receivable Voucher', 'Purchase Order')""")
+		and parent in ('Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice', 'Purchase Order')""")
 
 
 	del_flds = {
-		'Sales Order Detail':	"'delivery_date', 'confirmation_date'", 
+		'Sales Order Item':	"'delivery_date', 'confirmation_date'", 
 		'Delivery Note':		"'supplier', 'supplier_address', 'purchase_receipt_no', 'purchase_order_no', 'transaction_date'",
-		'Receivable Voucher':	"'voucher_date'",
-		'Payable Voucher':		"'voucher_date'",
+		'Sales Invoice':	"'voucher_date'",
+		'Purchase Invoice':		"'voucher_date'",
 		'Purchase Receipt':		"'transaction_date'"
 	} 
 
diff --git a/erpnext/patches/jan_mar_2012/map_conversion_rate.py b/erpnext/patches/jan_mar_2012/map_conversion_rate.py
index 0b947b3..dcb212d 100644
--- a/erpnext/patches/jan_mar_2012/map_conversion_rate.py
+++ b/erpnext/patches/jan_mar_2012/map_conversion_rate.py
@@ -33,10 +33,10 @@
 			}]
 		},
 		{
-			'parent': 'Purchase Order-Payable Voucher',
+			'parent': 'Purchase Order-Purchase Invoice',
 			'map': [{
 				'from_table': 'Purchase Order',
-				'to_table': 'Payable Voucher',
+				'to_table': 'Purchase Invoice',
 				'fields': [['conversion_rate', 'conversion_rate', 'Yes']]
 			}]
 		},
diff --git a/erpnext/patches/jan_mar_2012/mapper_fix.py b/erpnext/patches/jan_mar_2012/mapper_fix.py
index c651c5e..a9b1a9b 100644
--- a/erpnext/patches/jan_mar_2012/mapper_fix.py
+++ b/erpnext/patches/jan_mar_2012/mapper_fix.py
@@ -1,3 +1,3 @@
 def execute():
 	import webnotes
-	webnotes.conn.sql("delete from `tabTable Mapper Detail` where to_table = 'RV Detail' and parent = 'Delivery Note-Receivable Voucher' and validation_logic = 'amount > ifnull(billed_amt, 0) and docstatus = 1'")
+	webnotes.conn.sql("delete from `tabTable Mapper Detail` where to_table = 'Sales Invoice Item' and parent = 'Delivery Note-Sales Invoice' and validation_logic = 'amount > ifnull(billed_amt, 0) and docstatus = 1'")
diff --git a/erpnext/patches/jan_mar_2012/pending_patches.py b/erpnext/patches/jan_mar_2012/pending_patches.py
index 351200f..c21030a 100644
--- a/erpnext/patches/jan_mar_2012/pending_patches.py
+++ b/erpnext/patches/jan_mar_2012/pending_patches.py
@@ -17,11 +17,10 @@
 def execute():
 	import webnotes
 	from webnotes.model.code import get_obj
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	sql = webnotes.conn.sql
 
 	reload_doc('hr', 'doctype', 'appraisal')
-	reload_doc('hr', 'doctype', 'appraisal_detail')
 
 	sql("update `tabDocField` set `hidden` = 0 where fieldname = 'group_or_ledger' and parent = 'Cost Center'")
 	sql("update tabDocPerm set amend = 0 where parent = 'Salary Structure'")
@@ -31,21 +30,14 @@
 		sql("delete from `tabDocField` where label = 'View Ledger Entry' and parent = 'Journal Voucher' and fieldtype = 'Button' limit 1")
 	if sql("select count(name) from `tabDocField` where label = 'Get Balance' and parent = 'Journal Voucher' and fieldtype = 'Button'")[0][0] > 1:
 		sql("delete from `tabDocField` where label = 'Get Balance' and parent = 'Journal Voucher' and fieldtype = 'Button' limit 1")
-	
-	reload_doc('accounts', 'doctype', 'internal_reconciliation')
-	reload_doc('accounts', 'doctype', 'ir_payment_detail')
-	reload_doc('accounts', 'Module Def', 'Accounts')
+			
 		
-
-		
-	if sql("select count(name) from `tabDocField` where label = 'Get Specification Details' and parent = 'QA Inspection Report' and fieldtype = 'Button'")[0][0] > 1:
-		sql("delete from `tabDocField` where label = 'Get Specification Details' and parent = 'QA Inspection Report' and fieldtype = 'Button' limit 1")
+	if sql("select count(name) from `tabDocField` where label = 'Get Specification Details' and parent = 'Quality Inspection' and fieldtype = 'Button'")[0][0] > 1:
+		sql("delete from `tabDocField` where label = 'Get Specification Details' and parent = 'Quality Inspection' and fieldtype = 'Button' limit 1")
 	
 	reload_doc('stock', 'DocType Mapper', 'Purchase Order-Purchase Receipt')
 		
 	reload_doc('accounts', 'doctype', 'cost_center')
-	reload_doc('stock', 'Module Def', 'Stock')
-	sql("delete from `tabModule Def Item` where display_name = 'Serial No' and parent = 'Support'")
 	sql("update `tabDocType` set subject = 'Item Code: %(item_code)s, Warehouse: %(warehouse)s' where name = 'Serial No'")
 
 	# Patch for adding packing related columns (packed by, checked by, shipping mark etc)
diff --git a/erpnext/patches/jan_mar_2012/print_hide_totals.py b/erpnext/patches/jan_mar_2012/print_hide_totals.py
index 4299cb4..bf16a77 100644
--- a/erpnext/patches/jan_mar_2012/print_hide_totals.py
+++ b/erpnext/patches/jan_mar_2012/print_hide_totals.py
@@ -23,7 +23,7 @@
 		Uncheck print_hide for fields:
 			net_total, grand_total_export and rounded_total_export
 		For DocType(s):
-			* Receivable Voucher
+			* Sales Invoice
 			* Sales Order
 			* Delivery Note
 			* Quotation
@@ -32,5 +32,5 @@
 		UPDATE tabDocField
 		SET print_hide = 0
 		WHERE fieldname IN ('net_total', 'grand_total_export', 'rounded_total_export')
-		AND parent IN ('Receivable Voucher', 'Sales Order', 'Delivery Note', 'Quotation')
+		AND parent IN ('Sales Invoice', 'Sales Order', 'Delivery Note', 'Quotation')
 	""")
diff --git a/erpnext/patches/jan_mar_2012/production_cleanup.py b/erpnext/patches/jan_mar_2012/production_cleanup.py
index d0a5879..e724ab8 100644
--- a/erpnext/patches/jan_mar_2012/production_cleanup.py
+++ b/erpnext/patches/jan_mar_2012/production_cleanup.py
@@ -16,16 +16,16 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	from webnotes.model import delete_doc
 	sql = webnotes.conn.sql
 	
 	# Production Planning Tool
 	#---------------------------------------------------------------
-	#delete_doc('DocType', 'PP Detail')
-	#delete_doc('DocType', 'PP SO Detail')
+	#delete_doc('DocType', 'Production Plan Item')
+	#delete_doc('DocType', 'Production Plan Sales Order')
 	#delete_doc('DocType', 'Production Planning Tool')
-	sql("delete from `tabDocField` where parent in ('Production Planning Tool', 'PP Detail', 'PP SO Detail')")
+	sql("delete from `tabDocField` where parent in ('Production Planning Tool', 'Production Plan Item', 'Production Plan Sales Order')")
 	
 	reload_doc('production', 'doctype', 'production_planning_tool')
 	reload_doc('production', 'doctype', 'pp_detail')
@@ -42,7 +42,7 @@
 	""")
 
 
-	# Bill Of Materials
+	# BOM
 	#---------------------------------------------------------------
 	reload_doc('production', 'doctype', 'bill_of_materials')
 	reload_doc('production', 'doctype', 'bom_material')
@@ -50,17 +50,17 @@
 	reload_doc('production', 'doctype', 'flat_bom_detail')
 
 	#copy values
-	sql("""update `tabBill Of Materials` set rm_cost_as_per = 'Valuation Rate', 
+	sql("""update `tabBOM` set rm_cost_as_per = 'Valuation Rate', 
 		raw_material_cost = dir_mat_as_per_mar,	total_cost = cost_as_per_mar, costing_date = cost_as_on""")
 
-	sql("update `tabBOM Material` set rate = moving_avg_rate, amount = amount_as_per_mar")
+	sql("update `tabBOM Item` set rate = moving_avg_rate, amount = amount_as_per_mar")
 
-	sql("update `tabFlat BOM Detail` set rate = moving_avg_rate, amount = amount_as_per_mar")
+	sql("update `tabBOM Explosion Item` set rate = moving_avg_rate, amount = amount_as_per_mar")
 
 
 
 	# delete depricated flds from bom
-	sql("""	delete from `tabDocField` where parent = 'Bill Of Materials' 
+	sql("""	delete from `tabDocField` where parent = 'BOM' 
 		and (
 			label in ('TreeView1', 'Set as Default BOM', 'Activate BOM', 'Inactivate BOM') 
 			or fieldname in ('cost_as_per_mar', 'cost_as_per_lpr', 'cost_as_per_sr', 'cost_as_on',
@@ -72,14 +72,14 @@
 	sql("delete from `tabDocField` where parent = 'BOM Operation' and fieldname in ('details', 'workstation_capacity')")
 
 	# delete depricated flds from bom material
-	sql("""delete from `tabDocField` where parent = 'BOM Material' 
+	sql("""delete from `tabDocField` where parent = 'BOM Item' 
 		and fieldname in ('dir_mat_as_per_mar', 'dir_mat_as_per_sr', 'dir_mat_as_per_lpr', 'operating_cost', 'value_as_per_mar', 
 			'value_as_per_sr', 'value_as_per_lpr', 'moving_avg_rate', 'standard_rate', 'last_purchase_rate', 'amount_as_per_sr', 
 			'amount_as_per_lpr', 'amount_as_per_mar')	
 	""")
 
 	# delete depricated flds from flat bom
-	sql("""delete from tabDocField where parent = 'Flat BOM Detail' 
+	sql("""delete from tabDocField where parent = 'BOM Explosion Item' 
 		and fieldname in ('moving_avg_rate', 'standard_rate', 'last_purchase_rate', 'amount_as_per_mar', 
 			'amount_as_per_sr', 'amount_as_per_lpr', 'flat_bom_no', 'bom_mat_no', 'is_pro_applicable')
 	""")
diff --git a/erpnext/patches/jan_mar_2012/reload_doctype.py b/erpnext/patches/jan_mar_2012/reload_doctype.py
index 51241b8..957864b 100644
--- a/erpnext/patches/jan_mar_2012/reload_doctype.py
+++ b/erpnext/patches/jan_mar_2012/reload_doctype.py
@@ -16,5 +16,5 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('core', 'doctype', 'doctype')
diff --git a/erpnext/patches/jan_mar_2012/reload_item.py b/erpnext/patches/jan_mar_2012/reload_item.py
index c45b818..e42b50b 100644
--- a/erpnext/patches/jan_mar_2012/reload_item.py
+++ b/erpnext/patches/jan_mar_2012/reload_item.py
@@ -16,7 +16,7 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('stock', 'doctype', 'item')
 
 	webnotes.conn.sql("update `tabItem` set re_order_qty = min_order_qty")
diff --git a/erpnext/patches/jan_mar_2012/reload_mapper.py b/erpnext/patches/jan_mar_2012/reload_mapper.py
index a6e3102..987d4a7 100644
--- a/erpnext/patches/jan_mar_2012/reload_mapper.py
+++ b/erpnext/patches/jan_mar_2012/reload_mapper.py
@@ -1,9 +1,9 @@
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 
 	reload_doc('stock', 'DocType Mapper', 'Sales Order-Delivery Note')
-	reload_doc('accounts', 'DocType Mapper', 'Sales Order-Receivable Voucher')
-	reload_doc('accounts', 'DocType Mapper', 'Delivery Note-Receivable Voucher')
+	reload_doc('accounts', 'DocType Mapper', 'Sales Order-Sales Invoice')
+	reload_doc('accounts', 'DocType Mapper', 'Delivery Note-Sales Invoice')
 
 	webnotes.conn.sql("delete from `tabField Mapper Detail` where parent = 'Sales Order-Delivery Note' and from_field = 'basic_rate' and to_field = 'basic_rate'")
diff --git a/erpnext/patches/jan_mar_2012/reload_po_pr_mapper.py b/erpnext/patches/jan_mar_2012/reload_po_pr_mapper.py
index 4ed252b..5866429 100644
--- a/erpnext/patches/jan_mar_2012/reload_po_pr_mapper.py
+++ b/erpnext/patches/jan_mar_2012/reload_po_pr_mapper.py
@@ -16,5 +16,5 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('stock', 'DocType Mapper', 'Purchase Order-Purchase Receipt')
diff --git a/erpnext/patches/jan_mar_2012/reload_quote.py b/erpnext/patches/jan_mar_2012/reload_quote.py
index 5715bb4..8df293f 100644
--- a/erpnext/patches/jan_mar_2012/reload_quote.py
+++ b/erpnext/patches/jan_mar_2012/reload_quote.py
@@ -1,4 +1,4 @@
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('selling', 'doctype', 'quotation')
diff --git a/erpnext/patches/jan_mar_2012/reload_table.py b/erpnext/patches/jan_mar_2012/reload_table.py
index 481b46f..5358320 100644
--- a/erpnext/patches/jan_mar_2012/reload_table.py
+++ b/erpnext/patches/jan_mar_2012/reload_table.py
@@ -1,11 +1,3 @@
 def execute():
-	import webnotes
-	from webnotes.modules.module_manager import reload_doc
-	reload_doc('selling', 'doctype', 'quotation_detail')
-	reload_doc('selling', 'doctype', 'sales_order_detail')
-	reload_doc('stock', 'doctype', 'delivery_note_detail')
-	reload_doc('stock', 'doctype', 'purchase_receipt_detail')
-	reload_doc('buying', 'doctype', 'po_detail')
-	reload_doc('accounts', 'doctype', 'rv_detail')
-	reload_doc('accounts', 'doctype', 'pv_detail')
+	pass
 
diff --git a/erpnext/patches/jan_mar_2012/remove_get_tds_button.py b/erpnext/patches/jan_mar_2012/remove_get_tds_button.py
index fe804c0..8549e0d 100644
--- a/erpnext/patches/jan_mar_2012/remove_get_tds_button.py
+++ b/erpnext/patches/jan_mar_2012/remove_get_tds_button.py
@@ -26,5 +26,5 @@
 		AND fieldtype='Button'
 	""")
 
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('accounts', 'doctype', 'journal_voucher')
diff --git a/erpnext/patches/jan_mar_2012/remove_series_defval.py b/erpnext/patches/jan_mar_2012/remove_series_defval.py
index 123cc41..45eed57 100644
--- a/erpnext/patches/jan_mar_2012/remove_series_defval.py
+++ b/erpnext/patches/jan_mar_2012/remove_series_defval.py
@@ -1,3 +1,3 @@
 def execute():
 	import webnotes
-	webnotes.conn.sql("update `tabDocField` set `default`='' where parent = 'Receivable Voucher' and fieldname = 'naming_series' and `default` = 'INV'")
+	webnotes.conn.sql("update `tabDocField` set `default`='' where parent = 'Sales Invoice' and fieldname = 'naming_series' and `default` = 'INV'")
diff --git a/erpnext/patches/jan_mar_2012/rename_doctype_indent.py b/erpnext/patches/jan_mar_2012/rename_doctype_indent.py
deleted file mode 100644
index 01aeebf..0000000
--- a/erpnext/patches/jan_mar_2012/rename_doctype_indent.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import webnotes
-def execute():
-	"""
-		* Create DocType Label
-		* Reload Related DocTypes
-	"""
-	create_doctype_label()
-	reload_related_doctype()
-
-
-def create_doctype_label():
-	"""
-		Creates a DocType Label Record for Indent
-	"""
-	res = webnotes.conn.sql("""\
-		SELECT name FROM `tabDocType Label`
-		WHERE name='Indent'
-	""")
-	if not(res and res[0] and res[0][0]):
-		from webnotes.model.doc import Document
-		doclabel = Document('DocType Label')
-		doclabel.dt = 'Indent'
-		doclabel.dt_label = 'Purchase Requisition'
-		doclabel.save(1)
-
-
-def reload_related_doctype():
-	"""
-		Reload:
-		* indent
-		* purchase_order
-		* po_detail
-	"""
-	from webnotes.modules.module_manager import reload_doc
-	reload_doc('buying', 'doctype', 'indent')
-	reload_doc('buying', 'doctype', 'purchase_order')
-	reload_doc('buying', 'doctype', 'po_detail')
diff --git a/erpnext/patches/jan_mar_2012/rename_dt.py b/erpnext/patches/jan_mar_2012/rename_dt.py
index 80cad95..7847ee1 100644
--- a/erpnext/patches/jan_mar_2012/rename_dt.py
+++ b/erpnext/patches/jan_mar_2012/rename_dt.py
@@ -1,21 +1,221 @@
+import webnotes
+import conf
+from webnotes.model import rename, delete_doc
+from webnotes.model.code import get_obj
+from wnf import replace_code
+from termcolor import colored
+from webnotes.modules import reload_doc
+from webnotes.utils import make_esc
+import os
+
+def execute1():
+	#rendt = get_dt_to_be_renamed()
+	#rename_dt_files(rendt)
+	#update_local_file_system()
+	replace_labels_with_fieldnames()
+
 def execute():
-	import webnotes
-	from webnotes.model import rename, delete_doc
-	from webnotes.model.code import get_obj
-	from wnf import replace_code
-	import os
-	 
 
-	# delete dt
-	#-------------
-	deldt = ['Widget Control', 'Update Delivery Date Detail', 'Update Delivery Date', 'Tag Detail', 'Supplier rating', 'Stylesheet', 'Question Tag', 'PRO PP Detail', 'PRO Detail', 'PPW Detail', 'PF Detail', 'Personalize', 'Patch Util', 'Page Template', 'Module Def Role', 'Module Def Item', 'File Group', 'File Browser Control', 'File', 'Educational Qualifications', 'Earn Deduction Detail', 'DocType Property Setter', 'DocFormat', 'Contact Detail', 'BOM Report Detail', 'BOM Replace Utility Detail', 'BOM Replace Utility', 'Absent Days Detail', 'Activity Dashboard Control', 'Raw Materials Supplied', 'Setup Wizard Control', 'Company Group']
+	#---------------------------------------------------
+	# doctype renaming
+	rendt = get_dt_to_be_renamed()
+	# Rename dt	in db
+	rename_in_db(rendt, 'DocType', 1)
+	# Upadte dt in records
+	update_dt_in_records(rendt)
 
-	for d in deldt:
-		delete_doc('DocType', d)
+	#---------------------------------------------------
+	# Dt Mapper renaming
+	ren_mapper = get_mapper_to_be_renamed()
+	# Rename mapper in db
+	rename_in_db(ren_mapper, 'DocType Mapper', 0)
+
+	#---------------------------------------------------
+	# GL Mapper renaming
+	gl_mapper = {'Receivable Voucher': 'Sales Invoice', 'Payable Voucher': 'Purchase Invoice'}
+	rename_in_db(gl_mapper, 'GL Mapper', 0)
 
 
-	# Rename dt	
-	#-------------
+	#---------------------------------------------------
+	# remove dt label
+	webnotes.conn.sql("""delete from `tabDocType Label` where name in ('Ticket', 'Receivable Voucher', 
+		'QA Inspection Report', 'Payable Voucher', 'Manage Account', 'Indent', 'DocLayer')""")
+
+	#---------------------------------------------------
+	# Reload mapper from file
+	for d in ren_mapper:
+		mod = '_'.join(webnotes.conn.sql("select module from `tabDocType Mapper` where name = %s", 
+			ren_mapper[d])[0][0].lower().split())
+		reload_doc(mod, 'DocType Mapper', ren_mapper[d])
+
+	delete_search_criteria()
+	change_report_module()
+
+	# reload custom search criteria
+	#for d in  webnotes.conn.sql("""select name, module from
+	#		`tabSearch Criteria` where ifnull(standard, 'No') = 'Yes' and ifnull(disabled, 0) = 0"""):
+	#
+	for path, folders, files in os.walk(conf.modules_path):
+		if not path.endswith('search_criteria'): continue
+		module = path.split(os.sep)[-2]
+		for sc in folders:
+			try:
+				reload_doc(module, 'search_criteria', sc)
+				print module, sc
+			except Exception, e:
+				print "did not reload: " + str(d)
+	
+	webnotes.conn.sql("""DELETE FROM `tabPrint Format`
+			WHERE name IN ('Delivery Note Format', 'Purchase Order Format',
+			'Quotation Format', 'Receivable Voucher Format', 'Sales Order',
+			'SalesInvoiceModern_test', 'SalesInvoiceStdNew',
+			'Service Order Format', 'Service Quotation Format')""")
+
+	# reload custom print format
+	for d in webnotes.conn.sql("""select name, module from `tabPrint Format`
+			where ifnull(standard, 'No') = 'Yes'"""):
+		try:
+			reload_doc(d[1], 'Print Format', d[0])
+		except Exception, e:
+			print "did not reload: " + str(d)
+
+	#  Reload GL Mapper
+	for d in webnotes.conn.sql("select name from `tabGL Mapper`"):
+		reload_doc('accounts', 'GL Mapper', d[0])
+		
+	#gl entry, stock ledger entry, 
+
+
+
+	# T0-do-list
+	# gl mapper name
+
+def delete_search_criteria():
+	webnotes.conn.sql("""DELETE FROM `tabSearch Criteria`
+			WHERE name IN ('', 'bills-to_be_paid',
+			'bills-to_be_submitted', 'cenvat_credit_-_input_or_capital_goods',
+			'appraisal_custom', 'custom_test', 'custom_test1', 'delivery_note-to_be_billed',
+			'delivery_note-to_be_submitted', 'delivery_notes',
+			'employee_leave_balance_report', 'flat_bom_report',
+			'general_ledger1', 'lead_interested',
+			'payables_-_as_on_outstanding', 'periodical_budget_report',
+			'projectwise_delivered_qty_and_costs_as_per_purchase_cost',
+			'projectwise_pending_qty_and_costs_as_per_purchase_cost', 'sales',
+			'sales_order1', 'sales_order_pending_items',
+			'territory_wise_sales_-_target_vs_actual_', 'test_report',
+			'lease_agreement_list', 'lease_monthly_future_installment_inflows',
+			'lease_over_due_list', 'lease_overdue_age_wise',
+			'lease_receipt_summary_month_wise', 'lease_receipts_client_wise',
+			'lease_yearly_future_installment_inflows',
+			'monthly_ledger_summary_report', 'payables_-_as_on_outstanding',
+			'payment_report', 'progressive_total_excise_duty',
+			'service_tax_credit_account_-_inputs',
+			'total_amout_collection_for_a_period_-_customerwise',
+			'invoices-to_be_submitted', 'invoices-to_receive_payment',
+			'opportunity-quotations_to_be_sent', 'purchase_order-to_be_billed',
+			'purchase_order-to_be_submitted',
+			'purchase_order-to_receive_items',
+			'purchase_request-purchase_order_to_be_made',
+			'purchase_request-to_be_submitted',
+			'sales-order_to_be_submitted', 'sales_order-overdue',
+			'sales_order-to_be_billed', 'sales_order-to_be_delivered',
+			'sales_order-to_be_submitted', 'task-open', 'appraisal_custom',
+			'employee_details', 'employee_in_company_experience',
+			'employee_leave_balance_report', 'employeewise_leave_transaction_details',
+			'pending_appraisals', 'pending_expense_claims', 'delivery_plan', 'flat_bom_report',
+			'dispatch_report', 'projectwise_delivered_qty_and_costs_as_per_purchase_cost', 
+			'projectwise_pending_qty_and_costs_as_per_purchase_cost', 'custom_test', 'custom_test1',
+			'delivery_notes', 'delivery_note_disabled', 'lead', 'lead_interested', 'lead_report',
+			'periodic_sales_summary', 'monthly_despatched_trend', 'sales', 'sales_order',
+			'sales_order1', 'sales_agentwise_commission', 'test_report', 
+			'territory_wise_sales_-_target_vs_actual_', 
+			'pending_po_items_to_bill1', 'pending_po_items_to_receive1', 
+			'expense_vouchers', 'pending_expense_vouchers', 'shortage_to_indent')""")
+
+	webnotes.conn.sql("""
+		DELETE FROM `tabSearch Criteria`
+		WHERE name IN ('monthly_transaction_summary', 'trend_analyzer',
+		'yearly_transaction_summary', 'invoices-overdue', 'lead-to_follow_up',
+		'opportunity-to_follow_up', 'serial_no-amc_expiring_this_month',
+		'serial_no-warranty_expiring_this_month')
+		AND IFNULL(standard, 'No') = 'Yes'
+		""")
+
+def change_report_module():
+	reports = {'itemwise_receipt_details': 'Stock'}
+	for k in reports:
+		webnotes.conn.sql("update `tabSearch Criteria` set module = %s where name = %s", (reports[k], k))
+
+def rename_in_db(ren_data, data_type, is_doctype):
+	for d in ren_data:
+		print colored('Renaming... ' + d + ' --> '+ ren_data[d], 'yellow')
+		#rename
+		try:
+			rename(data_type, d, ren_data[d], is_doctype)
+		except Exception, e:
+			print e
+			pass
+
+
+def update_dt_in_records(rendt):
+	for d in rendt:
+		# Feed, property setter, search criteria, gl mapper, form 16A, naming series options, doclayer - dodtype is not mentioed in options
+		dt_list = webnotes.conn.sql("""select t1.parent, t1.fieldname from
+			tabDocField t1, tabDocType t2 where t1.parent = t2.name and
+			t1.fieldname in ('dt', 'doctype', 'doc_type', 'dt_type') and
+			ifnull(t1.options, '') = '' and ifnull(t2.issingle, 0) = 0 and
+			t1.parent in ('Custom Field', 'Custom Script', 'Property Setter')""")
+		for dt in dt_list:
+			webnotes.conn.sql("update `tab%s` set %s = replace(%s, '%s', '%s') where %s = '%s'" % (dt[0], dt[1], dt[1], d, rendt[d], dt[1], d))
+
+		# gl mapper, gl entry
+		webnotes.conn.sql("update `tabGL Mapper Detail` set against_voucher_type = replace(against_voucher_type, '%s', '%s') where against_voucher_type like '%%%s%%'" % (d, rendt[d], d))
+		webnotes.conn.sql("update `tabGL Entry` set against_voucher_type = replace(against_voucher_type, '%s', '%s') where against_voucher_type = '%s'" % (d, rendt[d], d))
+		webnotes.conn.sql("update `tabGL Entry` set voucher_type = replace(voucher_type, '%s', '%s') where voucher_type = '%s'" % (d, rendt[d], d))
+
+		# Stock ledger entry
+		webnotes.conn.sql("update `tabStock Ledger Entry` set voucher_type = replace(voucher_type, '%s', '%s') where voucher_type = '%s'" % (d, rendt[d], d))
+
+		# Custom fld: options
+		webnotes.conn.sql("update `tabCustom Field` set options = replace(options, %s, %s) where fieldtype in ('Link', 'Select', 'Table')", (d, rendt[d]))
+		
+		#Property Setter: value (if property=options)
+		webnotes.conn.sql("update `tabProperty Setter` set value = replace(value, %s, %s) where property = 'Options'", (d, rendt[d]))
+
+		# custom script: script
+		webnotes.conn.sql("update `tabCustom Script` set script = replace(script, %s, %s)", (d, rendt[d]))
+
+		# print format: html
+		webnotes.conn.sql("update `tabPrint Format` set html = replace(html, %s, %s) where ifnull(standard, 'Yes') = 'No'", (d, rendt[d]))
+
+		# custom report: doc_type, filters, columns, parent_doc_type, add_cond, add_col, add_tab,
+		#					dis_filters, group_by, sort_by, report_script, server_script, custom_query
+		webnotes.conn.sql("""
+			update
+				`tabSearch Criteria` 
+			set 
+				doc_type		= replace(doc_type, %s, %s), 
+				filters			= replace(filters, %s, %s), 
+				columns			= replace(columns, %s, %s), 
+				parent_doc_type = replace(parent_doc_type, %s, %s), 
+				add_cond		= replace(add_cond, %s, %s), 
+				add_col			= replace(add_col, %s, %s), 
+				add_tab			= replace(add_tab, %s, %s), 
+				dis_filters		= replace(dis_filters, %s, %s), 
+				group_by		= replace(group_by, %s, %s), 
+				sort_by			= replace(sort_by, %s, %s), 
+				report_script	= replace(report_script, %s, %s), 
+				server_script	= replace(server_script, %s, %s), 
+				custom_query	= replace(custom_query, %s, %s)
+			where 
+				ifnull(standard, 'Yes') = 'No'
+		""", (d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d], 
+				d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d], ))
+
+
+
+
+def get_dt_to_be_renamed():
 	rendt = {
 		'Receivable Voucher'		:	'Sales Invoice',
 		'RV Detail'					:	'Sales Invoice Item',
@@ -28,8 +228,6 @@
 		'QA Inspection Report'		:	'Quality Inspection',
 		'Ticket'					:	'Task',
 		'Manage Account'			:	'Global Defaults',
-		'DocLayer'					:	'Customize Form View',
-		'DocLayerField'				:	'CFV Field',
 		'ToDo Item'					:	'ToDo',
 		'Term'						:	'Terms and Conditions',
 		'Static Parameter Detail'	:	'SMS Parameter',
@@ -82,7 +280,7 @@
 		'Bill Of Materials'			:	'BOM',
 		'Appraisal Detail'			:	'Appraisal Goal',
 		'Advance Allocation Detail' :	'Purchase Invoice Advance',
-		'Advance Adjustment Detail' :	'Sales Invoice Advance'
+		'Advance Adjustment Detail' :	'Sales Invoice Advance',
 		'Ledger Detail'				:	'Multi Ledger Report Detail',
 		'TA Control'				:	'Trend Analyzer Control',
 		'Sales and Purchase Return Wizard'	: 'Sales and Purchase Return Tool',
@@ -92,33 +290,145 @@
 		'Professional Training Details'		: 'Employee Training',
 		'Previous Experience Detail'		: 'Employee External Work History',
 	}
+	return rendt
 
+
+def get_mapper_to_be_renamed():
+	ren_map = {
+		'Sales Order-Receivable Voucher'	:	'Sales Order-Sales Invoice',
+		'Sales Order-Indent'				: 	'Sales Order-Purchase Request',
+		'Receivable Voucher-Delivery Note' 	: 	'Sales Invoice-Delivery Note',
+		'Purchase Receipt-Payable Voucher'	: 	'Purchase Receipt-Purchase Invoice',
+		'Purchase Order-Payable Voucher'	: 	'Purchase Order-Purchase Invoice',
+		'Project-Receivable Voucher' 		: 	'Project-Sales Invoice',
+		'Lead-Enquiry'						: 	'Lead-Opportunity',
+		'KRA Template-Appraisal'			: 	'Appraisal Template-Appraisal',
+		'Indent-Purchase Order'				: 	'Purchase Request-Purchase Order',
+		'Enquiry-Quotation'					: 	'Opportunity-Quotation',
+		'Delivery Note-Receivable Voucher'	: 	'Delivery Note-Sales Invoice'
+	}
+	return ren_map
+
+
+
+
+#--------------------------------------------------------------------------------------------------------
+
+
+def update_local_file_system():
+	""" RUN ONLY IN LOCAL"""
+	
+	# doctype renaming
+	rendt = get_dt_to_be_renamed()
+
+	# replace dt in js/py file
+	update_file_content(rendt)
+	# git mv
+	rename_dt_files(rendt)
+
+
+	# Mapper renaming
+	ren_mapper = get_mapper_to_be_renamed()
+
+	rename_mapper_files(ren_mapper)
+
+	os.system('git mv erpnext/accounts/GL\ Mapper/Payable\ Voucher erpnext/accounts/GL\ Mapper/Purchase\ Invoice')
+	os.system('git mv erpnext/accounts/GL\ Mapper/Purchase\ Invoice/Payable\ Voucher.txt erpnext/accounts/GL\ Mapper/Purchase\ Invoice/Purchase\ Invoice.txt')
+	os.system('git mv erpnext/accounts/GL\ Mapper/Receivable\ Voucher erpnext/accounts/GL\ Mapper/Sales\ Invoice')
+	os.system('git mv erpnext/accounts/GL\ Mapper/Sales\ Invoice/Receivable\ Voucher.txt erpnext/accounts/GL\ Mapper/Sales\ Invoice/Sales\ Invoice.txt')
+	
+	# git rm production dt mapper
+	os.system('git rm -r erpnext/production/DocType\ Mapper/')
+
+
+
+def update_file_content(rendt):
 	for d in rendt:
-		#rename
-		rename('DocType', d, rendt[d], 1)
+		print colored('Renaming... ' + d + ' --> '+ rendt[d], 'yellow')
+		for extn in ['js', 'py', 'txt', 'html']:
+			res = replace_code('/var/www/erpnext/', d, rendt[d], extn)
+			if res == 'skip':
+				break
+		
+		
+def rename_dt_files(rendt):
+	for d in rendt:
+		mod = webnotes.conn.sql("select module from tabDocType where name = %s", rendt[d])[0][0]
+		if mod == 'Core':
+			os.chdir('/var/www/erpnext/lib/')
+			path = 'py/core/doctype/'
+		else:
+			os.chdir('/var/www/erpnext/')
+			path = 'erpnext/' + '_'.join(mod.lower().split()) + '/doctype/'
+		old = '_'.join(d.lower().split())
+		new = '_'.join(rendt[d].lower().split())
 
-		# update txt
-		obj = get_obj('DocType', rendt[d])
-		obj.doc.save()
+		print 'git mv ' + path + old + ' ' + path + new
+		# rename old dir
+		os.system('git mv ' + path + old + ' ' + path + new)
+
+		# rename all files in that dir
+		for extn in ['js', 'py', 'txt', 'html']:
+			if os.path.exists(path + new + '/'+ old + '.' +extn):
+				os.system('git mv ' + path + new + '/'+ old + '.' +extn + ' ' + path + new + '/' + new + '.' +extn)
+				print 'git mv ' + path + new + '/'+ old + '.' +extn + ' ' + path + new + '/' + new + '.' +extn
 
 
-		# RUN ONLY IN LOCAL
-		######################
+def rename_mapper_files(ren_mapper):
+	for d in ren_mapper:
+		# module
+		mod = '_'.join(webnotes.conn.sql("select module from `tabDocType Mapper` where name = %s", ren_mapper[d])[0][0].lower().split())
+		path = 'erpnext/' + mod + '/DocType Mapper/'
 
-		# replace dt in js/py file
-		for extn in ['js', 'py', 'txt']:
-			replace_code('/var/www/erpnext/', d, rendt[d], extn)
-
+		# rename old dir
+		esc = make_esc('$ ')
+		os.system('git mv ' + esc(path + d) + ' ' + esc(path + ren_mapper[d]))
+		print 'git mv ' + esc(path + d) + ' ' + esc(path + ren_mapper[d])
+		os.system('git mv ' + esc(path + ren_mapper[d] + '/'+ d + '.txt')
+				+ ' ' + esc(path + ren_mapper[d] + '/' + ren_mapper[d] + '.txt'))
+		print 'git mv ' + esc(path + ren_mapper[d] + '/'+ d + '.txt') + ' ' + esc(path + ren_mapper[d] + '/' + ren_mapper[d] + '.txt')
 		
 
-
-
-
-
+def replace_labels_with_fieldnames():
+	"""
+		This is used for replacing instances like cur_frm.cscript['LABEL'] with
+		cur_frm.cscript.FIELDNAME in js files
+	"""
+	doctype = {}
+	doctype.update(prepare_dict_of_label_fieldname('/var/www/erpnext/erpnext/'))
+	doctype.update(prepare_dict_of_label_fieldname('/var/www/erpnext/lib/py'))
+	#print doctype
 	
+	for doc in doctype:
+		label_fieldname = doctype[doc]
+		for d in label_fieldname:
+			#label = "cur_frm.cscript['%s']" % d
+			#fieldname = "cur_frm.cscript.%s" % label_fieldname[d]
+			label = d
+			fieldname = label_fieldname[d]
+			print colored('Changing... ' + doc + ': ' + label + ' --> '+ fieldname, 'yellow')
+			#res = replace_code('/var/www/erpnext/', label, fieldname, 'js')
+			res = replace_code('/var/www/erpnext/', label, fieldname, 'js',
+					'hide_field\(.*%s' % label)
+			if res == 'skip':
+				break
 
-#------TO-DO--------
-# remove dir
-# git remove
-# dt mapper rename
-# change in gl mapper
+def prepare_dict_of_label_fieldname(module_path):
+	from webnotes.model.utils import peval_doclist
+	from webnotes.model.sync import get_file_path
+	doctype = {}
+	for path, folders, files in os.walk(module_path):
+		if path == module_path:
+			modules_list = folders
+		for f in files:
+			if f.endswith(".txt"):
+				rel_path = os.path.relpath(path, conf.modules_path)
+				path_tuple = rel_path.split(os.sep)
+				if (len(path_tuple)==3 and path_tuple[0] in modules_list and
+						path_tuple[1] == 'doctype'):
+					file_name = f[:-4]
+					with open(get_file_path(path_tuple[0], file_name), 'r') as fn:
+						doclist = peval_doclist(fn.read())
+						doctype[file_name] = dict(([d.get('label'),d.get('fieldname')] \
+								for d in doclist if d.get('doctype')=='DocField'))
+	return doctype
diff --git a/erpnext/patches/jan_mar_2012/serial_no_add_opt.py b/erpnext/patches/jan_mar_2012/serial_no_add_opt.py
index 947c28d..ec45c27 100644
--- a/erpnext/patches/jan_mar_2012/serial_no_add_opt.py
+++ b/erpnext/patches/jan_mar_2012/serial_no_add_opt.py
@@ -30,5 +30,5 @@
 			webnotes.conn.commit()
 			webnotes.conn.begin()
 
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('stock', 'doctype', 'serial_no')
diff --git a/erpnext/patches/jan_mar_2012/stable_branch_shift_09_01_12.py b/erpnext/patches/jan_mar_2012/stable_branch_shift_09_01_12.py
index e4078aa..99366be 100644
--- a/erpnext/patches/jan_mar_2012/stable_branch_shift_09_01_12.py
+++ b/erpnext/patches/jan_mar_2012/stable_branch_shift_09_01_12.py
@@ -15,14 +15,14 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 import webnotes
-from webnotes.modules.module_manager import reload_doc
+from webnotes.modules import reload_doc
 	
 def execute():
 	"""
-		* Reload RV Tax Detail
+		* Reload Sales Taxes and Charges
 		* Reload Support Ticket
 		* Run Install Print Format Patch
-		* Reload DocLayer
+		* Reload Customize Form
 	"""
 	reload_doc('accounts', 'doctype', 'rv_tax_detail')
 	reload_doc('support', 'doctype', 'support_ticket')
diff --git a/erpnext/patches/jan_mar_2012/stock_entry_others_patch.py b/erpnext/patches/jan_mar_2012/stock_entry_others_patch.py
index 3a94419..7562fca 100644
--- a/erpnext/patches/jan_mar_2012/stock_entry_others_patch.py
+++ b/erpnext/patches/jan_mar_2012/stock_entry_others_patch.py
@@ -1,6 +1,6 @@
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('stock', 'doctype', 'stock_entry')
 
 	webnotes.conn.sql("update `tabDocField` set options = concat(options, '\nOthers') where fieldname = 'purpose' and parent = 'Stock Entry'")
diff --git a/erpnext/patches/jan_mar_2012/sync_ref_db.py b/erpnext/patches/jan_mar_2012/sync_ref_db.py
index 62b3947..a86bb3f 100644
--- a/erpnext/patches/jan_mar_2012/sync_ref_db.py
+++ b/erpnext/patches/jan_mar_2012/sync_ref_db.py
@@ -1,15 +1,52 @@
-def execute():
-	import webnotes
-	sql = webnotes.conn.sql
-	from webnotes.model import delete_doc
+import webnotes
+sql = webnotes.conn.sql
+from webnotes.model import delete_doc
 
+def execute():
 	del_rec = {
-		'DocType'	:	['Update Series', 'File', 'File Browser Control', 'File Group', 'Tag Detail', 'DocType Property Setter', 'Company Group'],
-		'Page'		:	['File Browser']
+		'DocType'	:	['Update Series', 'File', 'File Browser Control', 'File Group',
+			'Tag Detail', 'DocType Property Setter', 'Company Group', 'Widget Control', 
+			'Update Delivery Date Detail', 'Update Delivery	Date',
+			'Tag Detail', 'Supplier rating', 'Stylesheet', 'Question Tag',
+			'PRO PP Detail', 'PRO Detail', 'PPW Detail', 'PF Detail',
+			'Personalize', 'Patch Util', 'Page Template', 'Module Def Role',
+			'Module Def Item', 'File Group', 'File Browser Control', 'File',
+			'Educational Qualifications', 'Earn Deduction Detail',
+			'DocType Property Setter', 'Contact Detail', 'BOM Report Detail', 
+			'BOM Replace Utility Detail', 'BOM Replace Utility', 
+			'Absent Days Detail', 'Activity Dashboard Control', 'Raw Materials Supplied',
+			'Setup Wizard Control', 'Company Group', 'Lease Agreement', 'Lease Installment',
+			'Terms and Conditions', 'Time Sheet', 'Time Sheet Detail', 'Naming Series Options',
+			'Invest 80 Declaration Detail', 'IT Checklist', 'Chapter VI A Detail', 'Declaration Detail',
+			'Personalize', 'Salary Slip Control Panel',
+			],
+		'Page'		:	['File Browser'],
+		'DocType Mapper': ['Production Forecast-Production Planning Tool', 'Production Forecast-Production Plan', 'Sales Order-Production Plan']
 	}
 
 	for d in del_rec:
 		for r in del_rec[d]:
+			if d=='DocType':
+				sql("delete from tabFeed where doc_type=%s", r)
 			delete_doc(d, r)
 
-	sql("delete from tabDocField where label='Repair Indent' and parent = 'Indent'")
+	sql("delete from tabDocField where label='Repair Purchase Request' and parent = 'Purchase Request'")
+
+	drop_tables()
+
+
+def drop_tables():
+	webnotes.conn.commit()
+	from webnotes.model.db_schema import remove_all_foreign_keys
+	remove_all_foreign_keys()
+	count = 0
+	tab_list = sql("SHOW TABLES")
+	for tab in tab_list:
+		if tab[0].startswith('_') or tab[0] in ('tabSingles', 'tabSessions', 'tabSeries'): continue
+		res = sql("SELECT COUNT(*) FROM `tabDocType` WHERE name = %s", tab[0][3:])
+		if not res[0][0]:
+			count += 1
+			print tab[0]
+			sql("DROP TABLE `%s`" % tab[0])
+	print count
+	webnotes.conn.begin()
diff --git a/erpnext/patches/jan_mar_2012/update_se_fld_options.py b/erpnext/patches/jan_mar_2012/update_se_fld_options.py
index fab0b19..0428fc9 100644
--- a/erpnext/patches/jan_mar_2012/update_se_fld_options.py
+++ b/erpnext/patches/jan_mar_2012/update_se_fld_options.py
@@ -1,6 +1,6 @@
 def execute():
 	import webnotes
-	webnotes.conn.sql("update `tabDocField` set options = 'Bill Of Materials' where fieldname = 'bom_no' and parent = 'Stock Entry'")
+	webnotes.conn.sql("update `tabDocField` set options = 'BOM' where fieldname = 'bom_no' and parent = 'Stock Entry'")
 
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('stock', 'doctype', 'stock_entry')
diff --git a/erpnext/patches/jan_mar_2012/website/domain_list.py b/erpnext/patches/jan_mar_2012/website/domain_list.py
index 25f50e2..26824a4 100644
--- a/erpnext/patches/jan_mar_2012/website/domain_list.py
+++ b/erpnext/patches/jan_mar_2012/website/domain_list.py
@@ -16,7 +16,7 @@
 
 def execute():
 	import webnotes
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('website', 'doctype', 'website_settings')
 
 	res = webnotes.conn.sql("""\
diff --git a/erpnext/patches/jan_mar_2012/website/getfile_rename.py b/erpnext/patches/jan_mar_2012/website/getfile_rename.py
index 769ac37..d6d4c57 100644
--- a/erpnext/patches/jan_mar_2012/website/getfile_rename.py
+++ b/erpnext/patches/jan_mar_2012/website/getfile_rename.py
@@ -19,10 +19,10 @@
 def execute():
 	"""rename from getfle"""
 	l = [
-		('Quotation Detail', 'description'),
-		('Sales Order Detail', 'description'),
-		('Delivery Note Detail', 'description'),
-		('RV Detail', 'description'),
+		('Quotation Item', 'description'),
+		('Sales Order Item', 'description'),
+		('Delivery Note Item', 'description'),
+		('Sales Invoice Item', 'description'),
 		('Item', 'description_html'),
 		('Letter Head', 'content')
 	]
diff --git a/erpnext/patches/mar_2012/add_fieldnames.py b/erpnext/patches/mar_2012/add_fieldnames.py
new file mode 100644
index 0000000..3f96380
--- /dev/null
+++ b/erpnext/patches/mar_2012/add_fieldnames.py
@@ -0,0 +1,42 @@
+# do not run this patch
+def execute():
+	import webnotes
+	import webnotes.modules
+	forbidden = ['%', "'", '"', '#', '*', '?', '`', '(', ')', '<', '>', '-',
+	'\\', '/', '.', '&', '!', '@', '$', '^', '+']
+	doctype_list = webnotes.conn.sql("SELECT name, module FROM `tabDocType`")
+	for doctype, module in doctype_list:
+		docfield_list = webnotes.conn.sql("""\
+				SELECT name, label, fieldtype FROM `tabDocField`
+				WHERE parent = %s AND IFNULL(fieldname, '') = ''""", doctype)
+		field_type_count = {}
+		count = 0
+		for name, label, fieldtype in docfield_list:
+			fieldname = None
+			if label:
+				temp_label = label
+				if len(temp_label)==1:
+					temp_label = fieldtype + temp_label
+				
+				fieldname = temp_label.lower().replace(' ', '_')
+				if "<" in fieldname:
+					count = field_type_count.setdefault(fieldtype, 0)
+					fieldname = fieldtype.lower().replace(' ', '_') + str(count)
+					field_type_count[fieldtype] = count + 1
+			elif fieldtype:
+				count = field_type_count.setdefault(fieldtype, 0)
+				fieldname = fieldtype.lower().replace(' ', '_') + str(count)
+				field_type_count[fieldtype] = count + 1
+
+			if fieldname:
+				for f in forbidden: fieldname = fieldname.replace(f, '')
+				fieldname = fieldname.replace('__', '_')
+				if fieldname.endswith('_'):
+					fieldname = fieldname[:-1]
+				if fieldname.startswith('_'):
+					fieldname = fieldname[1:]
+				#print fieldname
+				webnotes.conn.sql("""\
+						UPDATE `tabDocField` SET fieldname = %s
+						WHERE name = %s""", (fieldname, name))
+		webnotes.modules.export_doc('DocType', doctype)
diff --git a/erpnext/patches/mar_2012/clean_property_setter.py b/erpnext/patches/mar_2012/clean_property_setter.py
new file mode 100644
index 0000000..2d83fb1
--- /dev/null
+++ b/erpnext/patches/mar_2012/clean_property_setter.py
@@ -0,0 +1,78 @@
+import webnotes
+
+def execute():
+	"""
+		* Remove unnecessary doctype properties
+		* Remove docfield property setters if fieldname doesn't exist
+		* Remove prev_field properties if value fieldname doesn't exist
+	"""
+	change_property_setter_fieldnames()
+	clean_doctype_properties()
+	clean_docfield_properties()
+
+def change_property_setter_fieldnames():
+	import webnotes.model.sync
+	webnotes.model.sync.sync('core', 'property_setter')
+	docfield_list = webnotes.conn.sql("""\
+		SELECT name, fieldname FROM `tabDocField`""", as_list=1)
+	custom_field_list = webnotes.conn.sql("""\
+		SELECT name, fieldname FROM `tabCustom Field`""", as_list=1)
+	field_list = docfield_list + custom_field_list
+	property_setter_list = webnotes.conn.sql("""\
+		SELECT name, doc_name, value, property
+		FROM `tabProperty Setter`
+		WHERE doctype_or_field='DocField'""")
+	field_dict = dict(field_list)
+	for name, doc_name, value, prop in property_setter_list:
+		if doc_name in field_dict:
+			webnotes.conn.sql("""\
+				UPDATE `tabProperty Setter`
+				SET field_name = %s
+				WHERE name = %s""", (field_dict.get(doc_name), name))
+		if value in field_dict and prop=='previous_field':
+			webnotes.conn.sql("""\
+				UPDATE `tabProperty Setter`
+				SET value = %s
+				WHERE name = %s""", (field_dict.get(value), name))
+
+def clean_doctype_properties():
+	desc = webnotes.conn.sql("DESC `tabDocType`", as_dict=1)
+	property_list = '", "'.join([d.get('Field') for d in desc])
+	webnotes.conn.sql("""\
+		DELETE FROM `tabProperty Setter`
+		WHERE doctype_or_field = 'DocType'
+		AND property NOT IN ("%s")""" % property_list)
+	
+def clean_docfield_properties():
+	delete_list_1 = webnotes.conn.sql("""\
+		SELECT name FROM `tabProperty Setter` ps
+		WHERE doctype_or_field = 'DocField'
+		AND NOT EXISTS (
+			SELECT fieldname FROM `tabDocField` df
+			WHERE df.parent = ps.doc_type
+			AND df.fieldname = ps.field_name
+		) AND NOT EXISTS (
+			SELECT fieldname FROM `tabCustom Field` cf
+			WHERE cf.dt = ps.doc_type
+			AND cf.fieldname = ps.field_name
+		)""")
+	
+	delete_list_2 = webnotes.conn.sql("""\
+		SELECT name FROM `tabProperty Setter` ps
+		WHERE doctype_or_field = 'DocField'
+		AND property = 'previous_field'
+		AND NOT EXISTS (
+			SELECT fieldname FROM `tabDocField` df
+			WHERE df.parent = ps.doc_type
+			AND df.fieldname = ps.value
+		) AND NOT EXISTS (
+			SELECT fieldname FROM `tabCustom Field` cf
+			WHERE cf.dt = ps.doc_type
+			AND cf.fieldname = ps.value
+		)""")
+
+	delete_list = [d[0] for d in delete_list_1] + [d[0] for d in delete_list_2]
+
+	webnotes.conn.sql("""\
+		DELETE FROM `tabProperty Setter`
+		WHERE NAME IN ("%s")""" % '", "'.join(delete_list))
diff --git a/erpnext/patches/mar_2012/cleanup_control_panel.py b/erpnext/patches/mar_2012/cleanup_control_panel.py
new file mode 100644
index 0000000..f26db15
--- /dev/null
+++ b/erpnext/patches/mar_2012/cleanup_control_panel.py
@@ -0,0 +1,7 @@
+import webnotes
+def execute():
+	webnotes.conn.sql("""\
+		DELETE FROM `tabSingles`
+		WHERE doctype = 'Control Panel'
+		AND field IN ("sync_with_gateway", "mail_password", "auto_email_id",
+		"mail_port", "outgoing_mail_server", "mail_login", "use_ssl")""")
diff --git a/erpnext/patches/mar_2012/create_custom_fields.py b/erpnext/patches/mar_2012/create_custom_fields.py
new file mode 100644
index 0000000..759a4d5
--- /dev/null
+++ b/erpnext/patches/mar_2012/create_custom_fields.py
@@ -0,0 +1,115 @@
+# do not run this patch
+field_list = [
+['Contact', 'notes'],
+['Contact', 'birthday'],
+['Contact', 'anniversary'],
+['Customer', 'state_tax_type'],
+['Customer', 'tin_no'],
+['Customer', 'excise_registration_number'],
+['Customer', 'customer_discount_details'],
+['Customer', 'notes'],
+['Customer', 'follow_up_section'],
+['Customer', 'follow_up'],
+['Delivery Note', 'shipping_contact_no'],
+['Delivery Note', 'shipping_tin_no'],
+['Delivery Note', 'shipping_excise_no'],
+['Delivery Note', 'tin_no'],
+['Delivery Note', 'excise_no'],
+['Delivery Note Detail', 'cetsh_number'],
+['Item', 'base_material'],
+['Item', 'tool_type'],
+['Item', 'no_of_flutes'],
+['Item', 'special_treatment'],
+['Item', 'length'],
+['Item', 'width'],
+['Item', 'height_dia'],
+['Item', 'pl_item'],
+['Item', 'cetsh_number'],
+['Item', 'stock_maintained'],
+['Item', 'is_rm'],
+['Journal Voucher Detail', 'line_remarks'],
+['Lead', 'designation'],
+['Purchase Order', 'challan_number'],
+['Quotation', 'cust_enq_no'],
+['Quotation', 'enq_date'],
+['Quotation', 'quote_valid'],
+['Quotation', 'due_date'],
+['Receivable Voucher', 'voucher_time'],
+['Receivable Voucher', 'removal_time'],
+['Receivable Voucher', 'removal_date'],
+['Receivable Voucher', 'shipping_address'],
+['Receivable Voucher', 'shipping_location'],
+['Receivable Voucher', 'ship_to'],
+['Receivable Voucher', 'shipping_contact_no'],
+['Receivable Voucher', 'shipping_excise_no'],
+['Receivable Voucher', 'shipping_tin_no'],
+['Receivable Voucher', 'po_no'],
+['Receivable Voucher', 'po_date'],
+['Receivable Voucher', 'lr_no'],
+['Receivable Voucher', 'transporters'],
+['Receivable Voucher', 'ship_terms'],
+['Receivable Voucher', 'tin_no'],
+['Receivable Voucher', 'excise_no'],
+['RV Detail', 'cetsh_number'],
+['Sales Order', 'shipping_contact_no'],
+['Sales Order', 'shipping_tin_no'],
+['Sales Order', 'shipping_excise_no'],
+['Sales Order', 'tin_no'],
+['Sales Order', 'excise_number'],
+['Sales Order Detail', 'cetsh_number'],
+['Sales Order Detail', 'prd_notes'],
+['Shipping Address', 'phone_no'],
+['Shipping Address', 'tin_no'],
+['Shipping Address', 'excise_no'],
+['Stock Entry', 'process_custom'],
+['Stock Entry', 'city'],
+['Stock Entry', 'address_line_2'],
+['Stock Entry', 'address_line_1'],
+['Stock Entry', 'comp_other'],
+['Stock Entry', 'mobile_no'],
+['Stock Entry', 'phone_no'],
+['Stock Entry', 'country'],
+['Stock Entry', 'state'],
+['Stock Entry', 'challan_number'],
+['Stock Entry Detail', 'machine'],
+['Stock Entry Detail', 'worker'],
+['Supplier', 'notes'],
+['Supplier', 'purchase_other_charges'],
+['Supplier', 'tax_details'],
+['Supplier', 'tin_number'],
+['Supplier', 'excise_regd_number'],
+['Supplier', 'service_tax_regd_number'],
+['Warehouse', 'comp_other'],
+['Warehouse', 'process'],
+['Warehouse', 'country'],
+['Warehouse', 'tax_registration_number'],
+['Warehouse Type', 'process'],
+['Workstation', 'maintenance_data'],
+]
+
+
+import webnotes
+from webnotes.model.code import get_obj
+from webnotes.model.doc import Document
+
+def execute():
+	import webnotes.model.sync
+	webnotes.model.sync.sync('core', 'custom_field')	
+	for f in field_list:
+		res = webnotes.conn.sql("""SELECT name FROM `tabCustom Field`
+				WHERE dt=%s AND fieldname=%s""", (f[0], f[1]))
+		if res: continue
+		docfield = webnotes.conn.sql("""SELECT * FROM `tabDocField`
+			WHERE parent=%s AND fieldname=%s""", (f[0], f[1]), as_dict=1)
+		if not docfield: continue
+		custom_field = docfield[0]
+
+		# scrub custom field dict
+		custom_field['dt'] = custom_field['parent']
+		del custom_field['parent']
+		
+		d = Document('Custom Field', fielddata=custom_field)
+		d.name = custom_field['dt'] + '-' + custom_field['fieldname']
+		d.save(1, ignore_fields=1)
+		#obj = get_obj(doc=d)
+		#obj.on_update()
diff --git a/erpnext/patches/mar_2012/delete_docformat.py b/erpnext/patches/mar_2012/delete_docformat.py
new file mode 100644
index 0000000..77a6c82
--- /dev/null
+++ b/erpnext/patches/mar_2012/delete_docformat.py
@@ -0,0 +1,8 @@
+def execute():
+	import webnotes
+	webnotes.conn.sql("DELETE FROM `tabDocField` WHERE options='DocFormat'")
+	webnotes.conn.sql("DELETE FROM `tabDocField` WHERE parent='DocFormat'")
+	webnotes.conn.sql("DELETE FROM `tabDocType` WHERE name='DocFormat'")
+	webnotes.conn.commit()
+	webnotes.conn.sql("DROP TABLE `tabDocFormat`")
+	webnotes.conn.begin()
diff --git a/erpnext/patches/mar_2012/doctype_get_refactor.py b/erpnext/patches/mar_2012/doctype_get_refactor.py
new file mode 100644
index 0000000..147fb93
--- /dev/null
+++ b/erpnext/patches/mar_2012/doctype_get_refactor.py
@@ -0,0 +1,145 @@
+import webnotes
+def execute():
+	"""
+		* Custom Field changes
+		* Add file_list to required tables
+		* Change floats/currency to decimal(18, 6)
+		* Remove DocFormat from DocType's fields
+		* Remove 'no_column' from DocField
+		* Drop table DocFormat
+	"""
+	import webnotes.model.sync
+	webnotes.model.sync.sync_all(force=1)
+	
+	handle_custom_fields()
+	create_file_list()
+
+	# do at last - needs commit due to DDL statements
+	change_to_decimal()
+
+def handle_custom_fields():
+	"""
+		* Assign idx to custom fields
+		* Create property setter entry of previous field
+		* Remove custom fields from tabDocField
+	"""
+	print "in handle custom fields"
+	cf = get_cf()
+	assign_idx(cf)
+	create_prev_field_prop_setter(cf)
+	remove_custom_from_docfield(cf)
+
+def get_cf():
+	return webnotes.conn.sql("""\
+		SELECT * FROM `tabCustom Field`
+		WHERE docstatus < 2""", as_dict=1)
+
+def assign_idx(cf):
+	from webnotes.model.doctype import get
+	from webnotes.utils import cint
+	#print len(cf)
+	for f in cf:
+		#print f.get('dt'), f.get('name')
+		if f.get('idx'): continue
+		temp_doclist = get(f.get('dt'), form=0)
+		#print len(temp_doclist)
+		max_idx = max(d.idx for d in temp_doclist if d.doctype=='DocField')
+		if not max_idx: continue
+		webnotes.conn.sql("""\
+			UPDATE `tabCustom Field` SET idx=%s
+			WHERE name=%s""", (cint(max_idx)+1, f.get('name')))
+
+def create_prev_field_prop_setter(cf):
+	from webnotes.model.doc import Document
+	from core.doctype.custom_field.custom_field import get_fields_label
+	for f in cf:
+		idx_label_list, field_list = get_fields_label(f.get('dt'), 0)
+		temp_insert_after = (f.get('insert_after') or '').split(" - ")
+		if len(temp_insert_after)<=1: continue
+		similar_idx_label = [il for il in idx_label_list \
+			if temp_insert_after[0] in il]
+		if not similar_idx_label: continue
+		label_index = idx_label_list.index(similar_idx_label[0])
+		if label_index==-1: return
+
+		webnotes.conn.sql("""\
+			UPDATE `tabCustom Field`
+			SET insert_after = %s
+			WHERE name = %s""", (similar_idx_label[0], f.get('name')))
+
+		prev_field = field_list[label_index]
+		res = webnotes.conn.sql("""\
+			SELECT name FROM `tabProperty Setter`
+			WHERE doc_type = %s
+			AND field_name = %s
+			AND property = 'previous_field'""", (f.get('dt'), f.get('fieldname')))
+
+		if not res:
+			ps = Document('Property Setter', fielddata = {
+				'doctype_or_field': 'DocField',
+				'doc_type': f.get('dt'),
+				'field_name': f.get('fieldname'),
+				'property': 'previous_field',
+				'value': prev_field,
+				'property_type': 'Data',
+				'select_doctype': f.get('dt')
+			})
+			ps.save(1)
+
+def remove_custom_from_docfield(cf):
+	for f in cf:
+		webnotes.conn.sql("""\
+			DELETE FROM `tabDocField`
+			WHERE parent=%s AND fieldname=%s""", (f.get('dt'),
+			f.get('fieldname')))
+
+def create_file_list():
+	should_exist = ['Website Settings', 'Web Page', 'Timesheet', 'Task',
+		'Support Ticket', 'Supplier', 'Style Settings', 'Stock Reconciliation',
+		'Stock Entry', 'Serial No', 'Sales Order', 'Sales Invoice',
+		'Quotation', 'Question', 'Purchase Receipt', 'Purchase Order',
+		'Project', 'Profile', 'Production Order', 'Product', 'Print Format',
+		'Price List', 'Purchase Invoice', 'Page', 
+		'Maintenance Visit', 'Maintenance Schedule', 'Letter Head',
+		'Leave Application', 'Lead', 'Journal Voucher', 'Item', 'Purchase Request',
+		'Expense Claim', 'Opportunity', 'Employee', 'Delivery Note',
+		'Customer Issue', 'Customer', 'Contact Us Settings', 'Company',
+		'Bulk Rename Tool', 'Blog', 'BOM', 'About Us Settings']
+
+	from webnotes.model.code import get_obj
+
+	for dt in should_exist:
+		obj = get_obj('DocType', dt, with_children=1)
+		obj.doc.allow_attach = 1
+		obj.doc.save()
+		obj.make_file_list()
+		from webnotes.model.db_schema import updatedb
+		updatedb(obj.doc.name)
+		from webnotes.utils.cache import CacheItem
+		CacheItem(obj.doc.name).clear()
+
+def change_to_decimal():
+	print "in change to decimal"
+	webnotes.conn.commit()
+	tables = webnotes.conn.sql("SHOW TABLES")
+	alter_tables_list = []
+	for tab in tables:
+		if not tab: continue
+		desc = webnotes.conn.sql("DESC `%s`" % tab[0], as_dict=1)
+		flist = []
+		for d in desc:
+			if d.get('Type')=='decimal(14,2)':
+				flist.append(d.get('Field'))
+		if flist:
+			#print tab[0], flist
+			statements = ("MODIFY `%s` decimal(18,6)" % f for f in flist)
+			statements = ", \n".join(statements)
+			alter_tables_list.append("ALTER TABLE `%s` \n%s\n" % (tab[0],
+				statements))
+	
+	#print "\n\n".join(alter_tables_list)
+	for at in alter_tables_list:
+		webnotes.conn.sql(at)
+
+	webnotes.conn.begin()
+
diff --git a/erpnext/patches/mar_2012/is_submittable_patch.py b/erpnext/patches/mar_2012/is_submittable_patch.py
new file mode 100644
index 0000000..d49160c
--- /dev/null
+++ b/erpnext/patches/mar_2012/is_submittable_patch.py
@@ -0,0 +1,23 @@
+# dont run this patch
+def execute():
+	import webnotes
+	import webnotes.model.doctype
+	from webnotes.utils import cint
+	from webnotes.model.doc import Document
+	from webnotes.model.code import get_obj
+	doctype_list = webnotes.conn.sql("SELECT name FROM `tabDocType`")
+	for dt in doctype_list:
+		doclist = webnotes.model.doctype.get(dt[0], form=0)
+		is_submittable = 0
+		for d in doclist:
+			if d.doctype == 'DocPerm' and d.fields.get('permlevel') == 0 \
+				and cint(d.fields.get('submit')) == 1:
+					is_submittable = 1
+					break
+		if is_submittable:
+			dt_doc = Document('DocType', doclist[0].name)
+			dt_doc.is_submittable = 1
+			dt_doc.save()
+			obj = get_obj(doc=dt_doc)
+			obj.make_amendable()
+			obj.on_update()
diff --git a/erpnext/patches/mar_2012/pos_invoice_fix.py b/erpnext/patches/mar_2012/pos_invoice_fix.py
index 77ebcb4..9848eb8 100644
--- a/erpnext/patches/mar_2012/pos_invoice_fix.py
+++ b/erpnext/patches/mar_2012/pos_invoice_fix.py
@@ -1,5 +1,3 @@
 def execute():
-	import webnotes
-	webnotes.conn.sql("DELETE FROM `tabDocFormat` WHERE format='POS Invoice'")
-	from webnotes.modules.module_manager import reload_doc
+	from webnotes.modules import reload_doc
 	reload_doc('accounts', 'Print Format', 'POS Invoice')
diff --git a/erpnext/patches/mar_2012/so_rv_mapper_fix.py b/erpnext/patches/mar_2012/so_rv_mapper_fix.py
index 8844773..5d60b3c 100644
--- a/erpnext/patches/mar_2012/so_rv_mapper_fix.py
+++ b/erpnext/patches/mar_2012/so_rv_mapper_fix.py
@@ -1,10 +1,10 @@
 def execute():
 	import webnotes
 	count = webnotes.conn.sql("""SELECT COUNT(*) FROM `tabTable Mapper Detail`
-		WHERE parent='Sales Order-Receivable Voucher'
-		AND from_table='Sales Order Detail'""")
+		WHERE parent='Sales Order-Sales Invoice'
+		AND from_table='Sales Order Item'""")
 	if count and count[0][0]==2:
 		webnotes.conn.sql("""DELETE FROM `tabTable Mapper Detail`
-			WHERE parent='Sales Order-Receivable Voucher'
-			AND from_table='Sales Order Detail'
+			WHERE parent='Sales Order-Sales Invoice'
+			AND from_table='Sales Order Item'
 			AND validation_logic='docstatus = 1'""")
diff --git a/erpnext/patches/mar_2012/usertags.py b/erpnext/patches/mar_2012/usertags.py
new file mode 100644
index 0000000..eff2543
--- /dev/null
+++ b/erpnext/patches/mar_2012/usertags.py
@@ -0,0 +1,17 @@
+def execute():
+	import webnotes
+	doctype_list = webnotes.conn.sql("""SELECT name FROM `tabDocType`
+		WHERE docstatus<2 AND IFNULL(issingle, 0)=0
+		AND IFNULL(istable, 0)=0""")
+	webnotes.conn.commit()
+	for d in doctype_list:
+		add_col = True
+		desc = webnotes.conn.sql("DESC `tab%s`" % d[0], as_dict=1)
+		for td in desc:
+			if td.get('Field')=='_user_tags':
+				add_col = False		
+
+		if add_col:
+			webnotes.conn.sql("alter table `tab%s` add column `_user_tags` varchar(180)" % d[0])
+	webnotes.conn.begin()		
+
diff --git a/erpnext/patches/old_patches/__init__.py b/erpnext/patches/old_patches/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/patches/old_patches/__init__.py
+++ /dev/null
diff --git a/erpnext/patches/old_patches/customer_address.py b/erpnext/patches/old_patches/customer_address.py
deleted file mode 100644
index 44568ce..0000000
--- a/erpnext/patches/old_patches/customer_address.py
+++ /dev/null
@@ -1,704 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import webnotes
-
-from webnotes.model.doc import Document
-from webnotes.utils import load_json, cint, cstr
-from webnotes import msgprint, errprint
-
-def make_address():
-	from webnotes.modules.module_manager import reload_doc
-	reload_doc('utilities','doctype','address')
-	
-	from webnotes.model.db_schema import updatedb
-	updatedb('Address')
-
-def make_address_from_customer():
-	for c in webnotes.conn.sql("select * from tabCustomer", as_dict=1):		
-		d = Document('Address') 
-		d.address_line1 = c['address_line1'] 
-		d.address_line2 = c['address_line2']  
-		d.city = c['city']  
-		d.country = c['country']  
-		d.pincode = c['pincode']
-		d.state = c['state']  
-		d.fax = c['fax_1']  
-		d.email_id = c['email_id']  		
-		d.phone = c['phone_1']  
-		d.customer = c['name']  
-		d.customer_name = c['customer_name']  
-		d.is_primary_address = 1
-		d.address_type = 'Office'
-		try:
-			d.save(1)
-		except NameError, e:
-			pass
-
-def make_address_from_supplier():
-	for c in webnotes.conn.sql("select * from tabSupplier", as_dict=1):		
-		d = Document('Address')
-		d.address_line1 = c['address_line1'] 
-		d.address_line2 = c['address_line2']  
-		d.city = c['city']  
-		d.country = c['country']  
-		d.pincode = c['pincode']
-		d.state = c['state']  		  		
-		d.supplier = c['name']  
-		d.supplier_name = c['supplier_name']  
-		d.is_primary_address = 1
-		d.address_type = 'Office'
-		try:
-			d.save(1)
-		except NameError, e:
-			pass
-
-def make_contact_from_contacttab():
-	webnotes.conn.sql("""
-	update ignore tabContact set
-		is_primary_contact = if(is_primary_contact='Yes',1,0)
-	""")
-
-	webnotes.conn.sql("""
-	update ignore tabContact t1, tabCustomer t2 set
-		t1.name = concat(ifnull(t1.contact_name,t1.name), '-', ifnull(t1.customer_name, t2.name))
-		where ifnull(t1.is_customer,0)=1
-		and t1.customer = t2.name
-	""")
-
-	webnotes.conn.sql("""
-	update ignore tabContact t1, tabSupplier t2 set
-		t1.name = concat(ifnull(t1.contact_name,t1.name), '-', ifnull(t1.supplier_name, t2.name))
-		where ifnull(t1.is_supplier,0)=1
-		and t1.supplier = t2.name
-	""")
-
-	webnotes.conn.sql("""
-	update ignore tabContact set
-		name = concat(ifnull(contact_name,name), '-', sales_partner)
-		where ifnull(is_sales_partner,0)=1
-	""")
-
-	webnotes.conn.commit()
-	try:
-		webnotes.conn.sql("""alter table tabContact change contact_no phone varchar(180)""")
-		webnotes.conn.sql("""alter table tabContact change is_primary_contact is_primary_contact int(1)""")
-	except:
-		pass
-	webnotes.conn.begin()
-	
-def delete_unwanted_fields():
-	delete_fields = [
-		('Contact', 'is_sales_partner'), ('Contact', 'sales_partner_address'), ('Contact', 'partner_type'), ('Contact', 'disable_login'), ('Contact', 'contact_address'), ('Contact', 'fax'), ('Contact', 'company_name'), ('Contact', 'contact_no'), ('Contact', 'customer_group'), ('Contact', 'has_login'), ('Contact', 'Create Login'), ('Contact', 'contact_name'), ('Contact', 'company_address'), ('Contact', 'customer_address'), ('Contact', 'supplier_address'), ('Contact', 'supplier_type'), ('Contact', 'is_customer'), ('Contact', 'is_supplier'), ('Contact', 'employee_id'), ('Contact', 'is_employee'), 
-		('Customer', 'region'), ('Customer', 'pincode'), ('Customer', 'city'), ('Customer', 'country'), ('Customer', 'state'), ('Customer', 'address'), ('Customer', 'telephone'), ('Customer', 'address_line2'), ('Customer', 'address_line1'), ('Customer', 'last_sales_order'), ('Customer', 'Shipping HTML'), ('Customer', 'phone_1'), ('Customer', 'Territory Help'), ('Customer', 'CG Help'), ('Customer', 'fax_1'), ('Customer', 'email_id'), 
-		('Customer Issue', 'email_id'), ('Customer Issue', 'contact_no'),
-		('Delivery Note', 'customer_mobile_no'), ('Delivery Note', 'Send SMS'), ('Delivery Note', 'Get Other Charges'), ('Delivery Note', 'message'), ('Delivery Note', 'shipping_address'), ('Delivery Note', 'ship_to'), ('Delivery Note', 'ship_det_no'), ('Delivery Note', 'contact_no'), ('Delivery Note', 'Customer Details'), ('Delivery Note', 'email_id'), ('Delivery Note', 'delivery_address'), ('Delivery Note', 'Contact Help'), ('Delivery Note', 'Territory Help'), 
-		('Enquiry', 'address'), ('Enquiry', 'Send Email'), ('Enquiry', 'enquiry_attachment_detail'), ('Enquiry', 'contact_date_ref'), ('Enquiry', 'Update Follow up'), ('Enquiry', 'email_id1'), ('Enquiry', 'cc_to'), ('Enquiry', 'subject'), ('Enquiry', 'message'), ('Enquiry', 'Attachment Html'), ('Enquiry', 'Create New File'), ('Enquiry', 'contact_no'), ('Enquiry', 'email_id'), ('Enquiry', 'project'), ('Enquiry', 'update_follow_up'), ('Enquiry', 'Contact Help'), 
-		('Installation Note', 'address'), 
-		('Lead', 'message'), ('Lead', 'Send Email'), ('Lead', 'address'), ('Lead', 'subject'), ('Lead', 'contact_no'), ('Lead', 'TerritoryHelp'), 
-		('Maintenance Schedule', 'address'), 
-		('Maintenance Visit', 'address'), 
-		('Purchase Order', 'Contact Help'), ('Purchase Order', 'supplier_qtn'), ('Purchase Order', 'contact_no'), ('Purchase Order', 'email'), 
-		('Purchase Receipt', 'Contact Help'), 
-		('Quotation', 'email_id'), ('Quotation', 'contact_no'), ('Quotation', 'Update Follow up'), ('Quotation', 'contact_date_ref'), ('Quotation', 'Territory Help'), ('Quotation', 'Contact Help'), 
-		('Receivable Voucher', 'Territory Help'), 
-		('Sales Order', 'contact_no'), ('Sales Order', 'email_id'), ('Sales Order', 'Contact Help'), ('Sales Order', 'file_list'), ('Sales Order', 'ship_det_no'), ('Sales Order', 'mobile_no'), ('Sales Order', 'Territory Help'), ('Sales Order', 'ship_to'), ('Sales Order', 'Customer Details'), 
-		('Sales Partner', 'area_code'), ('Sales Partner', 'telephone'), ('Sales Partner', 'email'), ('Sales Partner', 'address'), ('Sales Partner', 'TerritoryHelp'), ('Sales Partner', 'pincode'), ('Sales Partner', 'country'), ('Sales Partner', 'city'), ('Sales Partner', 'address_line2'), ('Sales Partner', 'address_line1'), ('Sales Partner', 'mobile'), ('Sales Partner', 'state'), 
-		('Serial No', 'supplier_address'), 
-		('Supplier', 'city'), ('Supplier', 'country'), ('Supplier', 'state'), ('Supplier', 'address_line1'), ('Supplier', 'last_purchase_order'), ('Supplier', 'address'), ('Supplier', 'address_line2'), ('Supplier', 'pincode'), ('Supplier rating', 'address'), ('Supplier rating', 'select'), ('Supplier rating', 'supplier')]
-	for d in delete_fields:
-		webnotes.conn.sql("delete from tabDocField where parent=%s and if(ifnull(fieldname,'')='',ifnull(label,''),fieldname)=%s", (d[0], d[1]))
-
-#def gen_txt_files():
-#	from webnotes.modules.export_module import export_to_files
-#	for dt in ['Contact','Customer','Customer Issue','Delivery Note','Enquiry','Installation Note','Lead','Maintenance Schedule','Maintenance Visit','Purchase Order','Purchase Receipt','Quotation','Receivable Voucher','Sales Order','Sales Partner','Serial No','Supplier']:
-#		export_to_files(record_list=[['DocType',dt]])
-
-def reload_doc_files():
-	from webnotes.modules.module_manager import reload_doc	
-	reload_doc('utilities', 'doctype', 'contact')
-	reload_doc('selling', 'doctype', 'customer')
-	reload_doc('support', 'doctype', 'customer_issue')
-	reload_doc('stock', 'doctype', 'delivery_note')
-	reload_doc('selling', 'doctype', 'enquiry')
-	reload_doc('selling', 'doctype', 'installation_note')
-	reload_doc('selling', 'doctype', 'lead')
-	reload_doc('support', 'doctype', 'maintenance_schedule')
-	reload_doc('support', 'doctype', 'maintenance_visit')
-	reload_doc('buying', 'doctype', 'purchase_order')
-	reload_doc('stock', 'doctype', 'purchase_receipt')
-	reload_doc('selling', 'doctype', 'quotation')
-	reload_doc('accounts', 'doctype', 'receivable_voucher')
-	reload_doc('accounts', 'doctype', 'payable_voucher')	
-	reload_doc('selling', 'doctype', 'sales_order')
-	reload_doc('setup', 'doctype', 'sales_partner')
-	reload_doc('stock', 'doctype', 'serial_no')
-	reload_doc('buying', 'doctype', 'supplier')
-	
-def reload_mapper_files():
-	from webnotes.modules.module_manager import reload_doc	
-	reload_doc('Mapper', 'DocType Mapper', 'Customer Issue-Maintenance Visit')
-	reload_doc('Mapper', 'DocType Mapper', 'Delivery Note-Installation Note')
-	reload_doc('Mapper', 'DocType Mapper', 'Delivery Note-Receivable Voucher')
-	reload_doc('Mapper', 'DocType Mapper', 'Enquiry-Quotation')
-	reload_doc('Mapper', 'DocType Mapper', 'Lead-Customer')
-	reload_doc('Mapper', 'DocType Mapper', 'Lead-Enquiry')
-	reload_doc('Mapper', 'DocType Mapper', 'Purchase Order-Payable Voucher')
-	reload_doc('Mapper', 'DocType Mapper', 'Purchase Order-Purchase Receipt')
-	reload_doc('Mapper', 'DocType Mapper', 'Purchase Receipt-Payable Voucher')
-	reload_doc('Mapper', 'DocType Mapper', 'Quotation-Sales Order')
-	reload_doc('Mapper', 'DocType Mapper', 'Receivable Voucher-Delivery Note')
-	reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Delivery Note')
-	reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Maintenance Schedule')
-	reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Maintenance Visit')
-	reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Receivable Voucher')		
-  	
-def delete_unwanted_mapper_fields():
-	delete_fields = [
-	('Customer Issue-Maintenance Visit', 'customer_address', 'address'),
-	('Delivery Note-Installation Note', 'customer_address', 'address'),
-	('Enquiry-Quotation', 'contact_no', 'contact_no'), ('Enquiry-Quotation', 'subject', 'enq_det'), ('Enquiry-Quotation', 'customer_name', 'customer_name'), ('Enquiry-Quotation', 'customer_name', 'customer_name'), ('Enquiry-Quotation', 'address', 'customer_address'), ('Enquiry-Quotation', 'email_id', 'email_id'),
-	('Quotation-Sales Order', 'contact_no', 'contact_no'), ('Quotation-Sales Order', 'email_id', 'email_id'), ('Quotation-Sales Order', 'customer_mobile_no', 'customer_mobile_no'),
-	('Sales Order-Delivery Note', 'customer_address', 'delivery_address'), ('Sales Order-Delivery Note', 'customer_address', 'customer_address'), ('Sales Order-Delivery Note', 'contact_no', 'contact_no'), ('Sales Order-Delivery Note', 'email_id', 'email_id'), ('Sales Order-Delivery Note', 'ship_det_no', 'ship_det_no'), ('Sales Order-Delivery Note', 'ship_to', 'ship_to'), ('Sales Order-Delivery Note', 'shipping_address', 'shipping_address'), ('Sales Order-Delivery Note', 'customer_mobile_no', 'customer_mobile_no'),
-	('Sales Order-Maintenance Schedule', 'customer_address', 'address'),
-	('Sales Order-Maintenance Visit', 'customer_address', 'address'),
-	('Sales Order-Receivable Voucher', 'contact_no', 'contact_no')]
-	
-  	for rec in delete_fields:  		
-		webnotes.conn.sql("delete from `tabField Mapper Detail` where parent=%s and from_field=%s and to_field=%s",(rec[0], rec[1], rec[2]))
-  	
-def sync_docfield_properties():
-	update_fields = [	
-	('Contact', 'customer', 'Customer', 0L, None, 0L, None), ('Contact', 'supplier', 'Supplier', 0L, None, None, None), ('Contact', 'is_primary_contact', None, 0L, None, None, None), ('Contact', 'email_id', None, 0L, 1L, None, None), ('Contact', 'department', 'Suggest', 0L, None, None, None), ('Contact', 'designation', 'Suggest', 0L, None, None, None),
-	('Customer Issue', 'customer', 'Customer', 0L, 1L, 1L, None), ('Customer Issue', 'customer_address', 'Address', 0L, None, 1L, None), ('Customer Issue', 'contact_person', 'Contact', 0L, None, 1L, None), ('Customer Issue', 'customer_name', None, 1L, None, None, None), ('Customer Issue', 'company', 'Company', 0L, 1L, 1L, None), ('Customer Issue', 'fiscal_year', 'link:Fiscal Year', 0L, 1L, 1L, None),
-	('Delivery Note', 'customer_address', 'Address', 0L, None, 1L, None), ('Delivery Note', 'contact_person', 'Contact', 0L, None, 1L, None), ('Delivery Note', 'customer_name', None, 1L, None, None, None), ('Delivery Note', 'status', '\nDraft\nSubmitted\nCancelled', 1L, 1L, 1L, None), ('Delivery Note', 'territory', 'Territory', 0L, 1L, 1L, 0L), ('Delivery Note', 'customer_group', 'Customer Group', 0L, None, 1L, None), ('Delivery Note', 'transporter_name', None, 0L, 0L, 1L, None), ('Delivery Note', 'lr_no', None, 0L, 0L, 1L, None), ('Delivery Note', 'lr_date', None, 0L, None, 1L, None), ('Delivery Note', 'currency', 'link:Currency', 0L, 1L, 1L, None), ('Delivery Note', 'letter_head', 'link:Letter Head', 0L, None, 1L, None),
-	('Enquiry', 'contact_person', 'Contact', 0L, None, 1L, None), ('Enquiry', 'customer_name', None, 1L, None, 0L, None), ('Enquiry', 'lead', 'Lead', 0L, None, 1L, 0L), ('Enquiry', 'enquiry_type', '\nSales\nMaintenance', 0L, 1L, None, None), ('Enquiry', 'territory', 'Territory', 0L, 1L, 1L, None), ('Enquiry', 'customer_group', 'Customer Group', 0L, 0L, 1L, 0L), ('Enquiry', 'contact_by', 'Profile', 0L, None, None, None),
-	('Installation Note', 'contact_person', 'Contact', 0L, None, 1L, None), ('Installation Note', 'customer_name', None, 1L, 0L, None, None), ('Installation Note', 'territory', 'Territory', 0L, 1L, 1L, None), ('Installation Note', 'status', 'Draft\nSubmitted\nCancelled', 1L, 1L, 1L, None),
-	('Lead', 'city', None, 0L, 1L, 1L, None), ('Lead', 'country', 'link:Country', 0L, 1L, 1L, None), ('Lead', 'state', 'Suggest', 0L, None, 1L, None), ('Lead', 'company', 'Company', 0L, 1L, None, None), ('Lead', 'contact_by', 'Profile', 0L, 0L, 0L, 0L),
-	('Maintenance Schedule', 'customer', 'Customer', 0L, 1L, 1L, None), ('Maintenance Schedule', 'contact_person', 'Contact', 0L, None, 1L, None), ('Maintenance Schedule', 'status', '\nDraft\nSubmitted\nCancelled', 1L, 1L, None, None), ('Maintenance Schedule', 'territory', 'Territory', 0L, 1L, None, None),
-	('Maintenance Visit', 'customer', 'Customer', 0L, 1L, 1L, None), ('Maintenance Visit', 'contact_person', 'Contact', 0L, None, 1L, None), ('Maintenance Visit', 'customer_name', None, 1L, None, None, None), ('Maintenance Visit', 'company', 'link:Company', 0L, 1L, 1L, None), ('Maintenance Visit', 'fiscal_year', 'link:Fiscal Year', 0L, 1L, 1L, None), ('Maintenance Visit', 'status', '\nDraft\nCancelled\nSubmitted', 1L, 1L, None, None), ('Maintenance Visit', 'territory', 'Territory', 0L, None, 1L, None),
-	('Purchase Order', 'supplier_address', 'Address', 0L, None, 1L, None), ('Purchase Order', 'contact_person', 'Contact', 0L, None, 1L, None), ('Purchase Order', 'supplier_name', None, 1L, None, None, None), ('Purchase Order', 'status', '\nDraft\nSubmitted\nStopped\nCancelled', 1L, 1L, 1L, None), ('Purchase Order', 'indent_no', 'Indent', 0L, None, 1L, 0L), ('Purchase Order', 'is_subcontracted', '\nYes\nNo', 0L, None, 1L, None), ('Purchase Order', 'currency', 'link:Currency', 0L, 1L, 1L, None), ('Purchase Order', 'net_total', None, 1L, 0L, 1L, None),
-	('Purchase Receipt', 'supplier_address', 'Address', 0L, None, 1L, None), ('Purchase Receipt', 'contact_person', 'Contact', 0L, None, 1L, None), ('Purchase Receipt', 'supplier_name', None, 1L, None, None, None), ('Purchase Receipt', 'status', '\nDraft\nSubmitted\nCancelled', 1L, 1L, 1L, None), ('Purchase Receipt', 'currency', 'link:Currency', 0L, 1L, 1L, None),
-	('Quotation', 'customer', 'Customer', 0L, None, 1L, 0L), ('Quotation', 'customer_address', 'Address', 0L, None, 1L, 0L), ('Quotation', 'contact_person', 'Contact', 0L, 0L, 1L, 0L), ('Quotation', 'customer_name', None, 1L, None, None, None), ('Quotation', 'lead', 'Lead', 0L, None, 1L, 0L), ('Quotation', 'lead_name', None, 1L, None, None, None), ('Quotation', 'order_type', '\nSales\nMaintenance', 0L, 1L, 0L, None), ('Quotation', 'status', '\nDraft\nSubmitted\nOrder Confirmed\nOrder Lost\nCancelled', 1L, 1L, 1L, None), ('Quotation', 'territory', 'Territory', 0L, 1L, 1L, 0L), ('Quotation', 'currency', 'link:Currency', 0L, 1L, 1L, None), ('Quotation', 'letter_head', 'link:Letter Head', 0L, None, 1L, None), ('Quotation', 'order_lost_reason', None, 1L, None, 1L, None), ('Quotation', 'contact_by', 'Profile', 0L, None, 1L, None), ('Quotation', 'contact_date', None, 0L, None, 1L, None), ('Quotation', 'to_discuss', None, 0L, None, 1L, None),
-	('Receivable Voucher', 'debit_to', 'Account', 0L, 1L, 1L, None), ('Receivable Voucher', 'customer_address', 'Address', 0L, None, 1L, None), ('Receivable Voucher', 'territory', 'Territory', 0L, 1L, 1L, None), ('Receivable Voucher', 'paid_amount', None, 0L, None, 1L, None), ('Receivable Voucher', 'company', 'Company', 0L, 1L, 1L, None), ('Receivable Voucher', 'fiscal_year', 'link:Fiscal Year', 0L, 1L, 1L, None), ('Receivable Voucher', 'outstanding_amount', None, 1L, None, 1L, None),
-	('Payable Voucher', 'supplier_address', 'Address', 0L, None, 1L, None), ('Payable Voucher', 'contact_display', None, 1L, None, None, None), ('Payable Voucher', 'contact_mobile', None, 1L, None, None, None), ('Payable Voucher', 'contact_email', None, 1L, None, 1L, None), ('Payable Voucher', 'currency', 'link:Currency', 0L, 1L, 1L, None), ('Payable Voucher', 'conversion_rate', None, 0L, 1L, 1L, None), ('Payable Voucher', 'company', 'Company', 0L, 1L, 1L, None), ('Payable Voucher', 'fiscal_year', 'link:Fiscal Year', 0L, 1L, 1L, None),
-	('Sales Order', 'customer_address', 'Address', 0L, None, 1L, 0L), ('Sales Order', 'contact_person', 'Contact', 0L, None, 1L, None), ('Sales Order', 'customer_name', None, 1L, None, None, None), ('Sales Order', 'status', '\nDraft\nSubmitted\nStopped\nCancelled', 1L, 1L, 1L, None), ('Sales Order', 'quotation_date', None, 1L, 0L, 1L, 1L), ('Sales Order', 'currency', 'link:Currency', 0L, 1L, 1L, None), ('Sales Order', 'letter_head', 'link:Letter Head', 0L, None, 1L, None),
-	('Sales Partner', 'territory', 'Territory', 0L, 1L, None, None),
-	('Supplier', 'company', 'Company', 0L, 1L, None, None)]
-	
-	for rec in update_fields:
-		webnotes.conn.sql("UPDATE `tabDocField` SET options=%s, permlevel=%s, reqd=%s, print_hide=%s, hidden=%s where parent=%s and fieldname=%s",(rec[2], rec[3], rec[4], rec[5], rec[6], rec[0], rec[1]))
-	
-def run_patch():
-	make_address()
-  	make_address_from_customer()
-  	make_address_from_supplier()
-  	make_contact_from_contacttab()
-  	delete_unwanted_fields()
-	reload_doc_files()
-	reload_mapper_files()
-	delete_unwanted_mapper_fields()
-	sync_docfield_properties()	
-
-#Old Customer Data Sync Patch for "Quotation, SO, PO, RV, PV, DN, PR, Installation Note, Maintenance Schedule, Customer Issue, Maintenance Visit"
-#--------------------------------------------------------------
-
-def run_old_data_sync_patch():
-	sync_quotation_customer_data()
-	sync_sales_order_customer_data()
-	sync_purchase_order_supplier_data()
-	sync_receivable_voucher_customer_data()
-	sync_payable_voucher_supplier_data()
-	sync_delivery_note_customer_data()
-	sync_purchase_receipt_supplier_data()
-	sync_installation_note_customer_data()
-	sync_maintenance_schedule_customer_data()
-	sync_customer_issue_customer_data()
-	sync_maintenance_visit_customer_data()
-	sync_lead_phone()
-	
-#Quotation
-def sync_quotation_customer_data():
-	data_rec = webnotes.conn.sql("""
-	SELECT tq.name as id,tq.customer, 
-	ta.name as customer_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
-	FROM tabQuotation tq, tabAddress ta
-	WHERE tq.customer = ta.customer
-	AND tq.quotation_to = 'Customer'	
-	AND tq.docstatus !=2
-	ORDER BY tq.name
-	""", as_dict=1)
-	
-	for rec in data_rec:			
-		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))											
-		
-		webnotes.conn.sql("""
-		UPDATE tabQuotation SET
-			customer_address = %s,
-			address_display = %s
-			WHERE name = %s
-		""",(rec['customer_address'],address_display,rec['id']))
-		
-	data_rec = webnotes.conn.sql("""
-	SELECT tq.name as id,tq.customer, 
-	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
-	FROM tabQuotation tq, tabContact tc
-	WHERE tq.customer = tc.customer 
-	AND tq.quotation_to = 'Customer'	
-	AND tq.docstatus !=2
-	ORDER BY tq.name
-	""", as_dict=1)
-	
-	for rec in data_rec:			
-		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
-											
-		webnotes.conn.sql("""
-		UPDATE tabQuotation SET
-			contact_person = %s,
-			contact_mobile = %s,
-			contact_email = %s,
-			contact_display = %s			
-			WHERE name = %s
-		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))
-				
-		
-#Sales Order		
-def sync_sales_order_customer_data():
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.customer, 
-	ta.name as customer_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
-	FROM `tabSales Order` t, tabAddress ta
-	WHERE t.customer = ta.customer
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:			
-		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Phone: '+rec['phone'] or ''))
-											
-		webnotes.conn.sql("""
-		UPDATE `tabSales Order` SET
-			customer_address = %s,
-			address_display = %s
-			WHERE name = %s
-		""",(rec['customer_address'],address_display,rec['id']))		
-
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.customer, 
-	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
-	FROM `tabSales Order` t, tabContact tc
-	WHERE t.customer = tc.customer 
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:					
-		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
-											
-		webnotes.conn.sql("""
-		UPDATE `tabSales Order` SET
-			contact_person = %s,
-			contact_mobile = %s,
-			contact_email = %s,
-			contact_display = %s			
-			WHERE name = %s
-		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))		
-				
-#Purchase Order
-def sync_purchase_order_supplier_data():
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.supplier, 
-	ta.name as supplier_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
-	FROM `tabPurchase Order` t, tabAddress ta
-	WHERE t.supplier = ta.supplier
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:			
-		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))
-											
-		webnotes.conn.sql("""
-		UPDATE `tabPurchase Order` SET
-			supplier_address = %s,
-			address_display = %s
-			WHERE name = %s
-		""",(rec['supplier_address'],address_display,rec['id']))				
-
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.supplier, 
-	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
-	FROM `tabPurchase Order` t, tabContact tc
-	WHERE t.supplier = tc.supplier 
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:					
-		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
-											
-		webnotes.conn.sql("""
-		UPDATE `tabPurchase Order` SET
-			contact_person = %s,
-			contact_mobile = %s,
-			contact_email = %s,
-			contact_display = %s			
-			WHERE name = %s
-		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))				
-		
-#Sales Invoice		
-def sync_receivable_voucher_customer_data():
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.customer, 
-	ta.name as customer_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
-	FROM `tabReceivable Voucher` t, tabAddress ta
-	WHERE t.customer = ta.customer
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:			
-		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))
-											
-		webnotes.conn.sql("""
-		UPDATE `tabReceivable Voucher` SET
-			customer_address = %s,
-			address_display = %s
-			WHERE name = %s
-		""",(rec['customer_address'],address_display,rec['id']))		
-		
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.customer, 
-	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
-	FROM `tabReceivable Voucher` t, tabContact tc
-	WHERE t.customer = tc.customer 
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:					
-		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
-											
-		webnotes.conn.sql("""
-		UPDATE `tabReceivable Voucher` SET
-			contact_person = %s,
-			contact_mobile = %s,
-			contact_email = %s,
-			contact_display = %s			
-			WHERE name = %s
-		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))				
-		
-#Purchase Invoice
-def sync_payable_voucher_supplier_data():
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.supplier, 
-	ta.name as supplier_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
-	FROM `tabPayable Voucher` t, tabAddress ta
-	WHERE t.supplier = ta.supplier
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:			
-		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))
-											
-		webnotes.conn.sql("""
-		UPDATE `tabPayable Voucher` SET
-			supplier_address = %s,
-			address_display = %s
-			WHERE name = %s
-		""",(rec['supplier_address'],address_display,rec['id']))				
-
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.supplier, 
-	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
-	FROM `tabPayable Voucher` t, tabContact tc
-	WHERE t.supplier = tc.supplier 
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:					
-		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
-											
-		webnotes.conn.sql("""
-		UPDATE `tabPayable Voucher` SET
-			contact_person = %s,
-			contact_mobile = %s,
-			contact_email = %s,
-			contact_display = %s			
-			WHERE name = %s
-		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))				
-		
-#Delivery Note
-def sync_delivery_note_customer_data():
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.customer, 
-	ta.name as customer_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
-	FROM `tabDelivery Note` t, tabAddress ta
-	WHERE t.customer = ta.customer
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:			
-		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))
-											
-		webnotes.conn.sql("""
-		UPDATE `tabDelivery Note` SET
-			customer_address = %s,
-			address_display = %s
-			WHERE name = %s
-		""",(rec['customer_address'],address_display,rec['id']))				
-
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.customer, 
-	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
-	FROM `tabDelivery Note` t, tabContact tc
-	WHERE t.customer = tc.customer 
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:			
-		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
-											
-		webnotes.conn.sql("""
-		UPDATE `tabDelivery Note` SET
-			contact_person = %s,
-			contact_mobile = %s,
-			contact_email = %s,
-			contact_display = %s			
-			WHERE name = %s
-		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))				
-
-#Purchase Receipt
-def sync_purchase_receipt_supplier_data():
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.supplier, 
-	ta.name as supplier_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
-	FROM `tabPurchase Receipt` t, tabAddress ta
-	WHERE t.supplier = ta.supplier
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:			
-		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))
-											
-		webnotes.conn.sql("""
-		UPDATE `tabPurchase Receipt` SET
-			supplier_address = %s,
-			address_display = %s
-			WHERE name = %s
-		""",(rec['supplier_address'],address_display,rec['id']))				
-
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.supplier, 
-	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
-	FROM `tabPurchase Receipt` t, tabContact tc
-	WHERE t.supplier = tc.supplier 
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:					
-		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
-											
-		webnotes.conn.sql("""
-		UPDATE `tabPurchase Receipt` SET
-			contact_person = %s,
-			contact_mobile = %s,
-			contact_email = %s,
-			contact_display = %s			
-			WHERE name = %s
-		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))				
-
-#Installation Note
-def sync_installation_note_customer_data():
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.customer, 
-	ta.name as customer_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
-	FROM `tabInstallation Note` t, tabAddress ta
-	WHERE t.customer = ta.customer
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:			
-		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))
-											
-		webnotes.conn.sql("""
-		UPDATE `tabInstallation Note` SET
-			customer_address = %s,
-			address_display = %s
-			WHERE name = %s
-		""",(rec['customer_address'],address_display,rec['id']))				
-
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.customer, 
-	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
-	FROM `tabInstallation Note` t, tabContact tc
-	WHERE t.customer = tc.customer 
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:			
-		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
-											
-		webnotes.conn.sql("""
-		UPDATE `tabInstallation Note` SET
-			contact_person = %s,
-			contact_mobile = %s,
-			contact_email = %s,
-			contact_display = %s			
-			WHERE name = %s
-		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))				
-		
-#Maintenance Schedule
-def sync_maintenance_schedule_customer_data():
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.customer, 
-	ta.name as customer_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
-	FROM `tabMaintenance Schedule` t, tabAddress ta
-	WHERE t.customer = ta.customer
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:			
-		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))
-											
-		webnotes.conn.sql("""
-		UPDATE `tabMaintenance Schedule` SET
-			customer_address = %s,
-			address_display = %s
-			WHERE name = %s
-		""",(rec['customer_address'],address_display,rec['id']))	
-
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.customer, 
-	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
-	FROM `tabMaintenance Schedule` t, tabContact tc
-	WHERE t.customer = tc.customer 
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:			
-		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
-											
-		webnotes.conn.sql("""
-		UPDATE `tabMaintenance Schedule` SET
-			contact_person = %s,
-			contact_mobile = %s,
-			contact_email = %s,
-			contact_display = %s			
-			WHERE name = %s
-		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))	
-				
-#Customer Issue
-def sync_customer_issue_customer_data():
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.customer, 
-	ta.name as customer_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
-	FROM `tabCustomer Issue` t, tabAddress ta
-	WHERE t.customer = ta.customer
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:			
-		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))
-											
-		webnotes.conn.sql("""
-		UPDATE `tabCustomer Issue` SET
-			customer_address = %s,
-			address_display = %s
-			WHERE name = %s
-		""",(rec['customer_address'],address_display,rec['id']))
-
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.customer, 
-	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
-	FROM `tabCustomer Issue` t, tabContact tc
-	WHERE t.customer = tc.customer 
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:			
-		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
-											
-		webnotes.conn.sql("""
-		UPDATE `tabCustomer Issue` SET
-			contact_person = %s,
-			contact_mobile = %s,
-			contact_email = %s,
-			contact_display = %s			
-			WHERE name = %s
-		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))
-		
-#Maintenance Visit
-def sync_maintenance_visit_customer_data():
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.customer, 
-	ta.name as customer_address, ta.address_line1, ta.address_line2, ta.city, ta.country, ta.pincode, ta.state, ta.phone
-	FROM `tabMaintenance Visit` t, tabAddress ta
-	WHERE t.customer = ta.customer
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:			
-		address_display = cstr((rec['address_line1'] and rec['address_line1'] or '')) + cstr((rec['address_line2'] and '\n' + rec['address_line2'] or '')) + cstr((rec['city'] and '\n'+rec['city'] or '')) + cstr((rec['pincode'] and ', ' + rec['pincode'] or '')) + cstr((rec['state'] and '\n'+rec['state']+', ' or '')) + cstr((rec['country'] and rec['country'] or '')) + '\n' + cstr((rec['phone'] and 'Tel: '+rec['phone'] or ''))
-											
-		webnotes.conn.sql("""
-		UPDATE `tabMaintenance Visit` SET
-			customer_address = %s,
-			address_display = %s
-			WHERE name = %s
-		""",(rec['customer_address'],address_display,rec['id']))	
-
-	data_rec = webnotes.conn.sql("""
-	SELECT t.name as id,t.customer, 
-	tc.name as contact_person, tc.first_name, tc.last_name, tc.email_id, tc.phone as contact_phone, tc.mobile_no, tc.department, tc.designation
-	FROM `tabMaintenance Visit` t, tabContact tc
-	WHERE t.customer = tc.customer 
-	AND t.docstatus !=2
-	ORDER BY t.name
-	""", as_dict=1)
-	
-	for rec in data_rec:			
-		contact_display = (rec['first_name'] and rec['first_name'] or '') + (rec['last_name'] and ' ' + rec['last_name'] or '')
-											
-		webnotes.conn.sql("""
-		UPDATE `tabMaintenance Visit` SET
-			contact_person = %s,
-			contact_mobile = %s,
-			contact_email = %s,
-			contact_display = %s			
-			WHERE name = %s
-		""",(rec['contact_person'],rec['mobile_no'],rec['email_id'],contact_display,rec['id']))			
-
-#lead phone data sync
-def sync_lead_phone():
-	webnotes.conn.sql("""
-		update ignore tabLead set
-			phone = contact_no
-			where contact_no is not null			
-		""")
diff --git a/erpnext/patches/old_patches/doctype_permission_patch.py b/erpnext/patches/old_patches/doctype_permission_patch.py
deleted file mode 100644
index 0953864..0000000
--- a/erpnext/patches/old_patches/doctype_permission_patch.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import webnotes
-
-def set_doctype_permissions():
-	
-	# remove descriptions
-	webnotes.conn.sql("update tabDocType set description=null")
-		
-	from webnotes.modules.module_manager import reload_doc
-	reload_doc('core','doctype','custom_script')
-	reload_doc('core','doctype','custom_field')
-	reload_doc('core','doctype','property_setter')
-	
-	# remove admin rights
-	webnotes.conn.sql("delete from tabUserRole where role in ('Administrator','Customer','Supplier') and parent!='Administrator'")	
-	
-	# create custom scripts
-	create_custom_scripts()
-
-	# remove script fields
-	reload_doc('core','doctype','doctype')
-
-	# allow sys manager to read doctype, custom script
-	allow_sys_manager()
-	
-def create_custom_scripts():
-	
-	cs_list = webnotes.conn.sql("select name, server_code, client_script from tabDocType where ifnull(server_code,'')!='' or ifnull(client_script,'')!=''")
-	
-	from webnotes.model.doc import Document
-	
-	for c in cs_list:
-		if c[1]:
-			cs = Document('Custom Script')
-			cs.dt = c[0]
-			cs.script_type = 'Server'
-			cs.script = c[1]
-			try:
-				cs.save(1)
-			except NameError:
-				pass
-
-		if c[2]:
-			cs = Document('Custom Script')
-			cs.dt = c[0]
-			cs.script_type = 'Client'
-			cs.script = c[2]
-			try:
-				cs.save(1)
-			except NameError:
-				pass
-
-def allow_sys_manager():
-	from webnotes.model.doc import Document
-
-	if not webnotes.conn.sql("select name from tabDocPerm where parent='DocType' and role='System Manager' and `read`=1"):
-		d = Document('DocPerm')
-		d.parent = 'DocType'
-		d.parenttype = 'DocType'
-		d.parentfield = 'permissions'
-		d.role = 'System Manager'
-		d.read = 1
-		d.save(1)
-
-	
-	if not webnotes.conn.sql("select name from tabDocPerm where parent='Custom Script' and role='System Manager' and `write`=1"):
-		d = Document('DocPerm')
-		d.parent = 'Custom Script'
-		d.parenttype = 'DocType'
-		d.parentfield = 'permissions'
-		d.role = 'System Manager'
-		d.read = 1
-		d.write = 1
-		d.create = 1
-		d.save(1)
\ No newline at end of file
diff --git a/erpnext/patches/old_patches/feed_patch.py b/erpnext/patches/old_patches/feed_patch.py
deleted file mode 100644
index 1edac88..0000000
--- a/erpnext/patches/old_patches/feed_patch.py
+++ /dev/null
@@ -1,118 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# long patches
-import webnotes
-
-def set_subjects_and_tagfields():
-	subject_dict = {
-		'Item':'%(item_name)s',
-		'Customer':' ',
-		'Contact':'%(first_name)s %(last_name)s - Email: %(email_id)s | Contact: %(contact_no)s',
-		'Supplier':' ',
-		'Lead':'%(lead_name)s from %(company_name)s | To Discuss: %(to_discuss)s',
-		'Quotation':'To %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s',
-		'Enquiry':'To %(customer_name)s%(lead_name)s on %(transaction_date)s',
-		'Sales Order':'From %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s | %(per_delivered)s% delivered | %(per_billed)s% billed',
-		'Delivery Note':'To %(customer_name)s on %(transaction_date)s | %(per_billed)s% billed',
-		'Indent':'%(per_ordered)s% ordered',
-		'Purchase Order':'To %(supplier_name)s on %(transaction_date)s | %(per_received)s% delivered',
-		'Purchase Receipt':'From %(supplier_name)s against %(purchase_order)s on %(transaction_date)s',
-		'Receivable Voucher':'To %(customer_name)s worth %(currency)s %(grand_total_export)s due on %(due_date)s | %(outstanding_amount)s outstanding',
-		'Payable Voucher':'From %(supplier_name)s due on %(due_date)s | %(outstanding_amount)s outstanding',
-		'Journal Voucher':' ',
-		'Serial No':'%(item_code)s',
-		'Project':' ',
-		'Ticket':'%(subject)s',
-		'Timesheet':'%(owner)s',
-		'Support Ticket':'%(problem_description)s',
-		'Installation Note':'At %(customer_name)s on %(inst_date)s',
-		'Maintenance Visit':'To %(customer_name)s on %(mntc_date)s',
-		'Customer Issue':'%(complaint)s By %(complaint_raised_by)s on %(issue_date)s',
-		'Employee':'%(employee_name)s',
-		'Expense Voucher':'From %(employee_name)s for %(total_claimed_amount)s (claimed)',
-		'Appraisal':'',
-		'Leave Application':'From %(employee_name)s, %(designation)s',
-		'Salary Structure':'For %(employee_name)s',
-		'Salary Slip':'For %(employee_name)s, %(designation)s',
-		'Bill of Materials':'%(item_code)s'
-	}
-	
-	tags_dict = {
-		'Item':'item_group',
-		'Customer':'customer_group,customer_type',
-		#'Contact':'',
-		'Supplier':'supplier_type',
-		'Lead':'status,source',
-		'Quotation':'status',
-		'Enquiry':'',
-		'Sales Order':'status',
-		'Delivery Note':'',
-		'Indent':'',
-		'Purchase Order':'',
-		'Purchase Receipt':'',
-		'Receivable Voucher':'',
-		'Payable Voucher':'',
-		'Journal Voucher':'voucher_type',
-		'Serial No':'status',
-		'Project':'status',
-		'Ticket':'status',
-		'Timesheet':'',
-		'Support Ticket':'',
-		'Installation Note':'',
-		'Maintenance Visit':'completion_status,maintenance_type',
-		'Customer Issue':'status',
-		'Employee':'status',
-		'Expense Voucher':'approval_status',
-		'Appraisal':'',
-		'Leave Application':'leave_type',
-		'Salary Structure':'',
-		'Bill of Materials':''
-	}
-	
-	description_dict = {
-		'Property Setter':'Property Setter overrides a standard DocType or Field property',
-		'Custom Field':'Adds a custom field to a DocType',
-		'Custom Script':'Adds a custom script (client or server) to a DocType'
-	}
-	
-	alldt = []
-	
-	for dt in subject_dict:
-		webnotes.conn.sql('update tabDocType set subject=%s where name=%s', (subject_dict[dt], dt))
-		if not dt in alldt: alldt.append(dt)
-	
-	for dt in tags_dict:
-		webnotes.conn.sql('update tabDocType set tag_fields=%s where name=%s', (tags_dict[dt], dt))
-		if not dt in alldt: alldt.append(dt)
-
-	for dt in description_dict:
-		webnotes.conn.sql('update tabDocType set description=%s where name=%s', (description_dict[dt], dt))
-		if not dt in alldt: alldt.append(dt)
-	
-	#from webnotes.modules.export_module import export_to_files
-	#for dt in alldt:
-	#	export_to_files(record_list=[['DocType',dt]])
-
-def support_patch():
-	# relaod support and other doctypes
-	
-	from webnotes.modules.module_manager import reload_doc
-	
-	webnotes.model.delete_doc('DocType','Support Ticket')
-	reload_doc('setup','doctype','support_email_settings')
-	reload_doc('support','doctype','support_ticket')
-	reload_doc('support','doctype','support_ticket_response')
diff --git a/erpnext/patches/old_patches/patch_1.py b/erpnext/patches/old_patches/patch_1.py
deleted file mode 100644
index 4176bf5..0000000
--- a/erpnext/patches/old_patches/patch_1.py
+++ /dev/null
@@ -1,1196 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-"""
-	Old patches for reference
-"""
-
-if patch_no==33:
-	pass
-elif patch_no==34:
-	webnotes.conn.sql("update `tabDocField` set options = 'Letter Head', print_hide = 1 where fieldname = 'letter_head' and fieldtype = 'Link'")
-elif patch_no==35:
-	webnotes.conn.sql("update tabDocType set module = 'Event Updates' where name = 'Feed Control'")
-elif patch_no==36:
-	# remove delivery note foreign key in Serial Number
-	from webnotes.model.db_schema import DbTable
-	t = DbTable('Serial No')
-	fk_list  = t.get_foreign_keys()
-	for f in fk_list:
-		if f[0]=='delivery_note_no':
-			webnotes.conn.commit()
-			webnotes.conn.sql("alter table `tabSerial No` drop foreign key `%s`" % f[1])
-			webnotes.conn.begin()
-			webnotes.conn.sql("update tabDocField set fieldtype='Data' where fieldname='delivery_note_no' and parent='Serial No' limit 1")
-elif patch_no==37:
-	import os
-	mod_path = webnotes.defs.modules_path
-	path_list = []
-	for m in os.listdir(mod_path):
-		for t in ['doctype', 'page', 'search_criteria']:
-			dt_path = os.path.join(mod_path, m, t)
-			if os.path.exists(dt_path):
-				for dt in os.listdir(dt_path):
-					if '.' not in dt and os.path.exists(os.path.join(dt_path, dt, dt+ '.txt')):
-						path_list.append(os.path.join(dt_path, dt, dt+ '.txt'))
-
-	for d in path_list:
-		doclist = eval(open(d,'r').read())
-		webnotes.conn.sql("update `tab%s` set module = '%s' where name = '%s'" % (doclist[0]['doctype'], doclist[0]['module'], doclist[0]['name']))
-
-elif patch_no==38:
-	import webnotes
-	webnotes.conn.set_global("system_message", "System Updates: Hello! You would have noticed some changes on the Home Page. As a part of our commitment to make the system more friendly and social, we have re-designed the feed so that now you will only see feed that is relevant to you (either you have created something or you have been mentioned in the document).<br><br>On the individual listings, you can add tags and also color them!<br><br>You will also get time-to-time updates from our side here. Do keep sending your feedback at support@erpnext.com.")
-	webnotes.conn.set_global("system_message_id", "1")
-
-elif patch_no == 39:
-	pass
-
-elif patch_no == 40:
-	import_from_files(record_list=[['material_management','doctype','item']])
-
-elif patch_no == 42:
-	acc = sql("select name, lft, rgt from tabAccount where account_name in ('Incomes', 'Expenses')")
-	for d in acc:
-		sql("update tabAccount set is_pl_account = 'Yes' where lft >= '%s' and rgt <= '%s'" % (d[1], d[2]))
-elif patch_no == 43:
-	import webnotes.model
-	webnotes.model.delete_doc('Page', 'Module Manager')
-
-# cleanup of Service, Customer Support, Utilities Modules
-# -------------------------------------------------------
-elif patch_no == 44:
-	from webnotes.model import delete_doc
-
-	for dt in sql("select name from tabDocType where module in ('Customer Support')"):
-		delete_doc('DocType', dt[0])
-
-	for dt in sql("select name from `tabSearch Criteria` where module in ('Customer Support')"):
-		delete_doc('Search Criteria', dt[0])
-
-	for dt in sql("select name from tabPage where module in ('Customer Support')"):
-		delete_doc('Page', dt[0])
-
-	# move a couple
-	webnotes.conn.sql("update `tab%s` set module=%s where name=%s" % ('DocType', '%s', '%s'), ('Application Internal', 'Patch Util'))
-	webnotes.conn.sql("update `tab%s` set module=%s where name=%s" % ('DocType', '%s', '%s'), ('Application Internal', 'DocType Property Setter'))
-
-	# remove utilities
-	webnotes.conn.sql('delete from `tabModule Def` where name in ("Customer Support", "Utilities")')
-
-elif patch_no == 45:
-	webnotes.conn.sql('delete from tabDocField where options="Ticket Response Detail"')
-
-elif patch_no == 46:
-	import webnotes
-	webnotes.conn.set_global("system_message", "<b>SYSTEM DOWNTIME:</b> Hello! As part of our commitment to keep improving the service, we are planning a scheduled maintenance on our servers for 4 hrs on 16-Jan-2011(Sunday), from 10AM to 2PM. Do keep sending your feedback at support@erpnext.com.")
-	webnotes.conn.set_global("system_message_id", "2")
-
-elif patch_no == 47:
-	import webnotes
-	webnotes.conn.set_global("system_message", "")
-	webnotes.conn.set_global("system_message_id", "3")
-
-elif patch_no == 48:
-	webnotes.conn.sql("update tabDocField set options = 'Print Heading' where fieldname = 'select_print_heading'")
-
-elif patch_no == 49:
-	webnotes.conn.sql("update tabDocType set autoname = '' where name = 'Search Criteria'")
-elif patch_no == 50:
-	sql("update tabDocField set in_filter = 1 where fieldname in ('cost_center', 'income_account', 'Item Group') and parent = 'RV Detail'")
-elif patch_no == 51:
-	sql("update tabDocField set options = 'link:Print Heading' where fieldtype = 'Select' and fieldname = 'select_print_heading' and parent = 'POS Setting'")
-elif patch_no == 52:
-	sql("update tabDocField set print_hide = 1 where fieldname = 'letter_head'")
-elif patch_no == 53:
-	sql("update tabDocType set search_fields = 'lead_name,lead_owner,status,contact_by,contact_date' where name = 'Lead'")
-elif patch_no == 54:
-	sql("delete from tabDocField where parent = 'Supplier' and label = 'Supplier Contacts' and fieldtype = 'Section Break'")
-elif patch_no == 55:
-	sql("commit")
-	try:
-		sql("alter table tabFeed add column `_user_tags` varchar(180)")
-	except Exception, e:
-		if e.args[0]!=1060:
-			raise e
-elif patch_no == 56:
-	sql("delete from `tabModule Def Item` where parent = 'CRM' and doc_type = 'Reports' and doc_name = 'Delivery Note' and display_name = 'Territory, Item Group wise GP'")
-elif patch_no == 57:
-	import_from_files(record_list=[['selling','doctype','sales_order_detail']])
-
-elif patch_no == 58:
-	# module def patches
-	sql("update `tabModule Def` set module_page = NULL where name not in ('Event Updates', 'Setup', 'My Company')")
-	sql("delete from `tabModule Def Item` where doc_type in ('Separator', 'Setup Forms', 'More Reports')")
-	sql("delete from `tabModule Def Item` where doc_name = 'Project Activity'")
-	sql("update `tabModule Def` set module_label = 'People', disabled='No', is_hidden='No' where name = 'My Company'")
-
-	# insert new module items
-	from webnotes.model.doc import make_autoname
-	if not sql("select name from `tabModule Def Item` where parent='Projects' and doc_name='Ticket'"):
-		sql("""insert into `tabModule Def Item`
-			(name, parent, parenttype, parentfield, docstatus, doc_type, doc_name, display_name, idx) values
-			(%s, 'Projects', 'Module Def', 'items', 0, 'Forms', 'Ticket', 'Task', 1)""", make_autoname('MDI.#####'))
-
-	if not sql("select name from `tabModule Def Item` where parent='Projects' and doc_name='Timesheet'"):
-		sql("""insert into `tabModule Def Item`
-			(name, parent, parenttype, parentfield, docstatus, doc_type, doc_name, display_name, idx) values
-			(%s, 'Projects', 'Module Def', 'items', 0, 'Forms', 'Timesheet', 'Timesheet', 2)""", make_autoname('MDI.#####'))
-
-	if not sql("select name from `tabModule Def Item` where parent='Projects' and doc_name='Projects'"):
-		sql("""insert into `tabModule Def Item`
-			(name, parent, parenttype, parentfield, docstatus, doc_type, doc_name, display_name, idx) values
-			(%s, 'Projects', 'Module Def', 'items', 0, 'Pages', 'Projects', 'Gantt Chart', 1)""", make_autoname('MDI.#####'))
-
-elif patch_no == 59:
-	webnotes.conn.set_value('Control Panel',None,'mail_footer','')
-	webnotes.conn.set_global('global_mail_footer','<div style="margin-top:8px; padding: 8px; font-size: 11px; text-align:right; border-top: 1px solid #AAA">Sent via <a href="https://www.erpnext.com">ERPNext</a></div>')
-elif patch_no == 60:
-	sql("delete from `tabModule Def Item` where display_name = 'Point of Sales'")
-elif patch_no == 61:
-	sql("delete from `tabTDS Category Account` where company not in (select name from tabCompany)")
-elif patch_no == 62:
-	# Import Supplier Quotation
-	import_from_files(record_list=[['srm','doctype','supplier_quotation']])
-
-	# Adding Status Filter
-	sql("update tabDocType set search_fields = concat('status,',search_fields) where name IN ('Delivery Note','Leave Transaction')")
-	# Import Other Charges
-
-	import_from_files(record_list=[['setup','doctype','other_charges']])
-elif patch_no == 63:
-	sql("update `tabDocField` set permlevel = 1 where fieldname in ('return_date', 'return_details') and parent = 'Sales and Purchase Return Wizard'")
-	import_from_files(record_list = [['accounts', 'doctype', 'rv_detail'], ['material_management', 'doctype', 'sales_and_purchase_return_wizard'], ['material_management', 'doctype', 'stock_entry']])
-
-elif patch_no == 64:
-	sql("update tabDocField set `hidden` = 1, `print_hide` = 1, `report_hide` = 1 where options in ('RFQ','Supplier Quotation')")
-	sql("update tabDocType set `read_only` = 1, in_create = 1 where name in ('RFQ','Supplier Quotation')")
-	sql("update tabDocField set `report_hide` = 0 where fieldname in ('email_id','phone_1','fax_1') and parent = 'Customer'")
-elif patch_no == 65:
-	# Monthly Trend Analyzer <-> Trend Analyzer
-	sql("update `tabSearch Criteria` set criteria_name = 'Trend Analyzer' where criteria_name = 'Monthly Trend Analyzer' and name = 'SRCH/00159'")
-	sql("update `tabModule Def Item` set display_name = 'Trend Analyzer' where parent = 'Analysis' and display_name = 'Monthly Trend Analyzer'")
-elif patch_no == 66:
-	import webnotes
-	webnotes.conn.set_global("system_message", """<h3>UI Updates</h3>Based on user feedback, we have made a couple of changes in the UI:<ul><li>Sidebar menus are now collapsable</li><li>Forms are now scrollable (we removed the confusing tabs)</li><li>Feed is a lot more descriptive</li></ul>Do send us your feedback!""")
-	webnotes.conn.set_global("system_message_id", "4")
-
-	sql("update `tabModule Def Item` set doc_type = 'Setup Forms' where doc_name in ('TDS Payment', 'TDS Return Acknowledgement', 'Form 16A', 'Period Closing Voucher', 'IT Checklist')")
-	from webnotes.session_cache import clear_cache
-	clear_cache(webnotes.session['user'])
-elif patch_no == 67:
-	sql("update `tabDocField` set in_filter = 1 where fieldname = 'brand' and parent = 'RV Detail'")
-	sql("delete from `tabModule Def Item` where (display_name = 'Sales Invoice' and parent = 'CRM') or (display_name = 'Purchase Invoice' and parent = 'SRM')")
-elif patch_no == 68:
-	from webnotes.modules.import_module import import_from_files
-	import_from_files(record_list=[['hr','doctype','employee'],['roles','Role','Employee']])
-elif patch_no == 69:
-	# delete flds from employee master
-	p = get_obj('Patch Util')
-	emp_del_flds = ['month_of_birth']
-	for f in emp_del_flds:
-		p.delete_field('Employee', f)
-
-	sql("Update tabDocField set `default` = 'Active' where fieldname = 'status' and parent = 'Employee'")
-
-	# map parent flds
-	fld_map = ['cell_number', 'personal_email', 'person_to_be_contacted', 'relation', 'emergency_phone_number', 'pan_number', 'passport_number', 'date_of_issue', 'valid_upto', 'place_of_issue', 'marital_status', 'blood_group', 'permanent_accommodation_type']
-
-	emp_prof = sql("select t1.name, t1.employee, t1.permanent_address_line_1, t1.permanent_address_line_2, t1.city1, t1.state1, t1.country1, t1.pin_code1, t1.phn_no1, t1.present_address_line_1, t1.present_address_line_2, t1.city2, t1.state2, t1.country2, t1.pin_code2, t1.phn_no2, t1.fathers_name, t1.fathers_occupation, t1.mothers_name, t1.mothers_occupation, t1.spouses_name, t1.spouses_occupation, t1.height_cms, t1.weight_kgs, t1.allergies, t1.other_medical_concerns, t1.physical_handicap from `tabEmployee Profile` t1, `tabEmployee` t2 where t1.employee = t2.name")
-	for e in emp_prof:
-		prof_obj = get_obj('Employee Profile', e[0])
-		emp_obj = get_obj('Employee', e[1])
-		for d in fld_map:
-			emp_obj.doc.fields[d] = prof_obj.doc.fields[d]
-		emp_obj.doc.current_accommodation_type = prof_obj.doc.present_accommodation_type
-
-		# address
-		per_addr = cstr(e[2]) + '\n' + cstr(e[3]) + '\n' + cstr(e[4]) + '\n' + cstr(e[5]) + ', ' + cstr(e[6]) + '\n' + 'PIN - ' + cstr(e[7]) + '\n' + 'Ph. No' + cstr(e[8])
-		cur_addr = cstr(e[9]) + '\n' + cstr(e[10]) + '\n' + cstr(e[11]) + '\n' + cstr(e[12]) + ', ' + cstr(e[13]) + '\n' + 'PIN - ' + cstr(e[14]) + '\n' + 'Ph. No' + cstr(e[15])
-		emp_obj.doc.permanent_address = per_addr
-		emp_obj.doc.current_address = cur_addr
-		#family
-		fam = "Father's Name: " + cstr(e[16]) + '\n' + "Father's Occupation: " + cstr(e[17]) + '\n' + "Mother's Name: " + cstr(e[18]) + '\n' + "Mother's Occupation: " + cstr(e[19]) + '\n' + "Spouse's Name: " + cstr(e[20]) + '\n' + "Spouse's Occupation: " + cstr(e[21])
-		emp_obj.doc.family_background = fam
-		# health
-		health = 'Height(cms): ' + cstr(e[22]) + '\n' + 'Weight(kgs): ' + cstr(e[23]) + '\n' + 'Allergies: ' +cstr( e[24]) + '\n' + 'Other Medical Concern: ' + cstr(e[25]) + '\n' + 'Physically Handicapped(if any): ' + cstr(e[26])
-		emp_obj.doc.health_details = health
-		emp_obj.doc.save()
-
-
-	# map tables
-	tbl_list = ['Experience In Company Detail', 'Previous Experience Detail', 'Educational Qualifications Detail']
-	for t in tbl_list:
-		sql("update `tab%s` t1, `tabEmployee Profile` t2 set t1.parent = t2.employee, t1.parenttype = 'Employee' where t1.parent = t2.name" % t)
-
-
-	# overwrite idx?????????
-
-
-	# delete emp profile
-	webnotes.model.delete_doc('DocType', 'Employee Profile')
-	for e in emp_prof:
-		webnotes.model.delete_doc('Employee Profile', e[0])
-
-elif patch_no == 70:
-	# update search criteria module -> System
-	sql("update tabDocType set module='System' where name='Search Criteria'")
-
-	# Cleanups to Contact
-	sql("update tabDocField set fieldtype='Data' where options='Designation' and parent='Contact'")
-	sql("update tabDocField set fieldtype='Data' where options='Department' and parent='Contact'")
-	sql("update tabDocField set depends_on='eval:(cint(doc.is_customer) || cint(doc.is_supplier) || cint(doc.is_sales_partner))' where fieldname='is_primary_contact' and parent='Contact'")
-
-	# import Contact, Employee
-	from webnotes.modules.import_module import import_from_files
-	import_from_files(record_list=[['utilities','doctype','contact']])
-
-
-	# remove last_contact_date from Lead
-	sql("delete from tabDocField where fieldname='last_contact_date' and parent='Lead'")
-
-elif patch_no == 71:
-	# Make Stock Qty and Conversion Factor field editable. Also no need to mention Conversion factor in table can do it directly
-	sql("update `tabDocField` set `permlevel` = 0, `width` = '100px', `trigger` = 'Client' where parent IN ('PO Detail','Purchase Receipt Detail') and fieldname in ('stock_qty','conversion_factor')")
-	sql("update `tabDocField` set `width` = '100px' where parent IN ('PO Detail','Purchase Receipt Detail') and fieldname = 'stock_uom'")
-
-elif patch_no == 72:
-	# Core Patch
-	# ----------
-
-	from webnotes.modules.import_module import import_from_files
-
-	# import module def
-	import_from_files(record_list = [['core', 'Module Def', 'Core']])
-elif patch_no == 73:
-	# set module in DocTypes
-	sql("update tabDocType set module='Core' where name in ('DocType', 'DocField', 'DocPerm', 'Role', 'UserRole', 'Profile', 'Print Format', 'DocFormat', 'Control Panel', 'Event', 'Event Role', 'Event User', 'DefaultValue', 'Default Home Page', 'File', 'File Group', 'File Data', 'Letter Head', 'Module Def', 'Module Def Item', 'Module Def Role', 'Page', 'Page Role', 'Search Criteria', 'DocType Label', 'DocType Mapper', 'Field Mapper Detail', 'Table Mapper Detail')")
-
-	# set module in Page
-	sql("update tabPage set module='Core' where name='Login Page'")
-
-	# move file browser to Tools
-	sql("update tabPage set module='Tools' where name='File Browser'")
-	sql("update tabDocType set module='Tools' where name='File Browser Control'")
-	sql("update tabDocType set module='Application Internal' where name='Profile Control'")
-elif patch_no == 74:
-	p = get_obj('Patch Util')
-	# permission
-	p.delete_permission('Employee', 'Administrator', 0)
-	p.delete_permission('Employee', 'Administrator', 1)
-	p.add_permission('Employee', 'Employee', 0, read = 1, match = 'owner')
-	p.add_permission('Employee', 'Employee', 1, read = 1, match = 'owner')
-	sql("delete from `tabDocField` where parent = 'Employee' and label = 'Payroll Rule'")
-elif patch_no == 75:
-	#sal structure patch
-	# import
-	from webnotes.modules.import_module import import_from_files
-	import_from_files(record_list=[['hr','doctype','salary_structure'], ['hr','doctype','earning_detail'],['hr','doctype','deduction_detail']])
-elif patch_no == 76:
-	# property
-	p = get_obj('Patch Util')
-	p.set_field_property('Salary Structure', 'is_active', 'default', 'Yes')
-	p.set_field_property('Salary Structure', 'ctc', 'reqd', '1')
-	p.set_field_property('Earning Detail', 'modified_value', 'width', '')
-	p.set_field_property('Earning Detail', 'modified_value', 'trigger', 'Client')
-	p.set_field_property('Deduction Detail', 'd_modified_amt', 'width', '')
-	p.set_field_property('Earning Detail', 'd_modified_amt', 'trigger', 'Client')
-	sql("Update tabDocField set `description` = 'You can create more earning and deduction type from Setup --> HR' where label = 'Earning & Deduction' and parent = 'Salary Structure' and fieldtype = 'Section Break'")
-
-	# delete
-	sql("update `tabSalary Structure` set net_pay = total")
-	sql("delete from tabDocField where label in ('LWP Help', 'Calculate Total', 'Total') and parent = 'Salary Structure'")
-	sql("delete from tabDocPerm where parent in ('Earning Detail', 'Deduction Detail')")
-
-
-	# permission
-	p.delete_permission('Salary Structure', 'Administrator', 0)
-	p.delete_permission('Salary Structure', 'Administrator', 1)
-	p.add_permission('Salary Structure', 'Employee', 0, read = 1, match = 'owner')
-	p.add_permission('Salary Structure', 'Employee', 1, read = 1, match = 'owner')
-elif patch_no == 77:
-	# sal slip patch
-	# import
-	from webnotes.modules.import_module import import_from_files
-	import_from_files(record_list=[['hr','doctype','salary_slip'], ['hr','doctype','ss_earning_detail'],['hr','doctype','ss_deduction_detail'], ['mapper', 'DocType Mapper', 'Salary Structure-Salary Slip']])
-elif patch_no == 78:
-	p = get_obj('Patch Util')
-	# delete
-	sql("update `tabSalary Slip` set leave_encashment_amount = encashment_amount")
-	p.delete_field('Salary Slip', 'encashment_amount')
-	p.delete_field('Salary Slip', 'year')
-	p.delete_field('Salary Slip', 'flag')
-	sql("delete from tabDocField where label = 'Process Payroll' and parent = 'Salary Slip'")
-
-	# field property
-	p.set_field_property('Salary Slip', 'bank_name', 'permlevel', '1')
-	p.set_field_property('Salary Slip', 'leave_without_pay', 'permlevel', '0')
-	p.set_field_property('Salary Slip', 'leave_without_pay', 'trigger', 'Client')
-	p.set_field_property('SS Earning Detail', 'e_type', 'permlevel', '0')
-	p.set_field_property('SS Earning Detail', 'e_type', 'fieldtype', 'Link')
-	p.set_field_property('SS Earning Detail', 'e_type', 'options', 'Earning Type')
-	p.set_field_property('SS Deduction Detail', 'd_type', 'permlevel', '0')
-	p.set_field_property('SS Deduction Detail', 'd_type', 'fieldtype', 'Link')
-	p.set_field_property('SS Deduction Detail', 'd_type', 'options', 'Deduction Type')
-	sql("update `tabSS Earning Detail` set e_modified_amount = e_amount")
-	sql("update `tabSS Deduction Detail` set d_modified_amount = d_amount")
-
-	# permission
-	p.delete_permission('Salary Slip', 'Administrator', 0)
-	p.delete_permission('Salary Slip', 'Administrator', 1)
-	p.add_permission('Salary Slip', 'Employee', 0, read = 1, match = 'owner')
-	p.add_permission('Salary Slip', 'Employee', 1, read = 1, match = 'owner')
-elif patch_no == 79:
-	# Import Modules
-	import_from_files(record_list=[['hr','doctype','leave_application'],['hr','doctype','leave_allocation'],['hr','doctype','leave_control_panel'],['hr','doctype','holiday_list'],['hr','doctype','holiday_list_detail'],['hr','Module Def','HR']])
-elif patch_no == 80:
-	# Holiday List
-	sql("update `tabHoliday List Detail` set description = holiday_name")
-	sql("delete from tabDocField where parent = 'Holiday List Detail' and fieldname = 'holiday_name'")
-	sql("update tabDocField set fieldtype = 'Select', options = 'link:Fiscal Year' where parent = 'Holiday List' and fieldname = 'fiscal_year'")
-	sql("delete from tabDocPerm where role in ('Administrator','HR User') and parent = 'Holiday List'")
-
-	# Leave Control Panel
-	# --------------------
-	sql("delete from `tabDocField` where parent = 'Leave Control Panel' and label in ('Leave Control Panel','Allocation Details') and fieldtype = 'Section Break'")
-	sql("delete from tabDocField where parent = 'Leave Control Panel' and fieldname in ('col_brk3','allocation_type','col_brk2','from_date','to_date','leave_transaction_type','posting_date')")
-	sql("update tabDocField set fieldtype = 'Select', options = 'link:Fiscal Year' where parent = 'Leave Control Panel' and fieldname = 'fiscal_year'")
-	sql("update tabDocField set fieldtype = 'Select', options = 'link:Leave Type' where parent = 'Leave Control Panel' and fieldname = 'leave_type'")
-	sql("update tabDocField set reqd = 1 where parent = 'Leave Control Panel' and fieldname = 'no_of_days'")
-
-	# Leave Application
-	# ------------------
-	for d in sql("select * from `tabLeave Transaction` where leave_transaction_type = 'Deduction' and ifnull(deduction_type, '') = 'Leave'", as_dict = 1):
-		lp = Document('Leave Application')
-		lp.employee = d['employee']
-		lp.leave_type = d['leave_type']
-		lp.posting_date = d['date']
-		lp.fiscal_year = d['fiscal_year']
-		lp.leave_balance = d['pre_balance']
-		lp.half_day = d['half_day']
-		lp.from_date = d['from_date']
-		lp.to_date = d['to_date']
-		lp.total_leave_days = d['total_leave']
-		lp.description = d['reason']
-		lp.docstatus = cint(d['docstatus'])
-		lp.save(1)
-
-	# Leave Allocation
-	# -----------------
-	for d in sql("select * from `tabLeave Transaction` where leave_transaction_type = 'Allocation'", as_dict = 1):
-		la = Document('Leave Allocation')
-		la.employee = d['employee']
-		la.leave_type = d['leave_type']
-		la.posting_date = d['date']
-		la.fiscal_year = d['fiscal_year']
-		la.new_leaves_allocated = d['total_leave']
-		la.total_leaves_allocated = d['total_leave']
-		la.description = d['reason']
-		la.docstatus = cint(d['docstatus'])
-		la.save(1)
-
-	# Payroll Module Def
-	# -------------------
-	sql("delete from `tabModule Def Item` where doc_name = 'Leave Transaction' and display_name = 'Leave Transaction' and parent = 'Payroll' and doc_type = 'Forms'")
-
-elif patch_no == 81:
-	# Import Modules
-	import_from_files(record_list=[['hr','Module Def','HR']])
-elif patch_no == 82:
-	sql("update tabDocType set search_fields = 'employee,leave_type,total_leaves_allocated,fiscal_year' where name = 'Leave Allocation'")
-	sql("update tabDocType set search_fields = 'employee,leave_type,from_date,to_date,total_leave_days,fiscal_year' where name = 'Leave Application'")
-elif patch_no == 83:
-	# delete leave transaction
-	webnotes.conn.sql("set foreign_key_checks=0")
-	sql("delete from `tabLeave Transaction`")
-	import webnotes.model
-	webnotes.model.delete_doc('DocType','Badge Settings Detail')
-	webnotes.model.delete_doc('DocType','Leave Transaction')
-	webnotes.conn.sql("set foreign_key_checks=1")
-elif patch_no == 84:
-	p = get_obj('Patch Util')
-	p.set_field_property('SS Earning Detail', 'e_amount', 'permlevel', '1')
-	p.set_field_property('SS Deduction Detail', 'd_amount', 'permlevel', '1')
-elif patch_no == 85:
-	# permission
-	p = get_obj('Patch Util')
-	p.add_permission('Leave Application', 'Employee', 0, read = 1, write = 1, create = 1, submit = 1, cancel = 1, amend = 1, match = 'owner')
-	p.add_permission('Leave Application', 'Employee', 1, read = 1, match = 'owner')
-	p.add_permission('Leave Allocation', 'HR User', 0, read = 1, write = 1, create = 1, submit = 1, cancel = 1, amend = 1, match = 'owner')
-	p.add_permission('Leave Allocation', 'HR User', 1, read = 1)
-	sql("update tabDocPerm set `match` = '' where parent = 'Leave Application' and role = 'HR User'")
-elif patch_no == 86:
-	# Import Modules
-	import_from_files(record_list=[['hr','doctype','leave_type']])
-elif patch_no == 87:
-	sql("update `tabLeave Type` set is_lwp = 1 where name = 'Leave Without Pay'")
-elif patch_no == 88:
-	# Import Modules
-	import_from_files(record_list=[['hr','doctype','leave_allocation']])
-
-elif patch_no == 89:
-	sql("delete from `tabModule Def Item` where doc_type = 'Setup Forms' and doc_name in ('Payroll Rule', 'IT Checklist', 'Employee Profile') and parent = 'Payroll'")
-	sql("update `tabDocField` set `hidden` = 1, `print_hide` = 1, `report_hide` = 1 where parent = 'Leave Type' and fieldname = 'is_encash'")
-elif patch_no == 90:
-	sql("update `tabLeave Allocation` set docstatus = 1")
-elif patch_no == 91:
-	import webnotes
-	webnotes.conn.set_global("system_message", """<h3>System Updates</h3>Based on user feedback, we have cleaned up HR module (Partly):<ul><li>Employee and Employee Profile are merged into a single document</li><li>Salary Structure and Salary Slip are now more user friendly</li><li>Leave Transaction document is now divided into 2 documents Leave Application and Leave Allocation</li></ul>We will work on Reports, Attendance and other documents of Payroll module next week<br><br> Do send us your feedback!""")
-	webnotes.conn.set_global("system_message_id", "5")
-elif patch_no == 92:
-	sql("update tabDocField set label = 'Get Charges' where parent IN ('Sales Order','Delivery Note','Receivable Voucher') and label = 'Get Other Charges' and fieldtype = 'Button'")
-	# Automated Other Charges Calculation basis
-	sql("update tabDocField set options = '', `trigger` = 'Client' where parent IN ('Quotation','Sales Order','Delivery Note','Receivable Voucher') and label = 'Get Charges' and fieldtype = 'Button'")
-elif patch_no == 93:
-	sql("update `tabTable Mapper Detail` set validation_logic = 'qty > ifnull(billed_qty,0) and docstatus = 1' where parent = 'Sales Order-Receivable Voucher' and from_table = 'Sales Order Detail'")
-	sql("update `tabField Mapper Detail` set from_field = 'customer' where to_field = 'customer' and parent = 'Sales Order-Receivable Voucher'")
-elif patch_no == 94:
-	import_from_files(record_list=[['selling','doctype','sms_center']])
-elif patch_no == 95:
-	import_from_files(record_list=[['mapper','DocType Mapper','Sales Order-Receivable Voucher'], ['mapper','DocType Mapper','Delivery Note-Receivable Voucher']])
-elif patch_no == 96:
-	sql("delete from `tabModule Def Item` where doc_type = 'Reports' and display_name = 'Cenvat Credit - Input or Capital Goods' and parent = 'Accounts'")
-elif patch_no == 97:
-	sql("update tabFeed set doc_label = 'Feed', doc_name = name where ifnull(doc_name,'') = '' and ifnull(doc_label,'') = ''")
-elif patch_no == 98:
-	import_from_files(record_list=[['accounts','doctype','payable_voucher']])
-elif patch_no == 99:
-	import_from_files(record_list=[['accounts','doctype','account']])
-elif patch_no == 100:
-	p = get_obj('Patch Util')
-	p.set_field_property('Account', 'level', 'hidden', '1')
-	p.set_field_property('Account', 'level', 'print_hide', '1')
-	p.set_field_property('Account', 'account_type', 'search_index', '0')
-	p.set_field_property('TDS Detail', 'tds_category', 'width', '150px')
-	p.set_field_property('TDS Detail', 'special_tds_rate_applicable', 'width', '150px')
-	p.set_field_property('TDS Detail', 'special_tds_rate', 'width', '150px')
-	p.set_field_property('TDS Detail', 'special_tds_limit', 'width', '150px')
-elif patch_no == 101:
-	# Leave Application Details and Leave Allocation Details
-	sql("update tabDocField set search_index = 1, in_filter = 1 where fieldname in ('employee','leave_type','fiscal_year') and parent in ('Leave Application','Leave Allocation')")
-	get_obj('DocType','Leave Application').doc.save()
-	get_obj('DocType','Leave Allocation').doc.save()
-elif patch_no == 102:
-	# make item description field editable in production order
-	sql("update tabDocField set permlevel = 0 where fieldname = 'description' and parent = 'Production Order'")
-elif patch_no == 103:
-	sql("update tabDocField set fieldname = '' where fieldtype = 'HTML'")
-elif patch_no == 104:
-	import_from_files(record_list=[['hr','search_criteria','stdsrch_00001'],['hr','search_criteria','stdsrch_00002'],['hr','search_criteria','stdsrch_00003'],['hr','Module Def','HR'],['hr','doctype','leave_application'],['hr','doctype','leave_allocation']])
-
-elif patch_no == 105:
-	# Employee Leave Balance
-	sql("delete from `tabModule Def Item` where parent = 'Payroll' and doc_type = 'Reports' and display_name IN ('Employeewise Leave Transaction Details','Employeewise Balance Leave Report')")
-	# Update Search Fields
-	sql("update tabDocType set search_fields = 'employee,employee_name,leave_type,from_date,to_date,total_leave_days,fiscal_year' where name = 'Leave Application'")
-	sql("update tabDocType set search_fields = 'employee,employee_name,leave_type,total_leaves_allocated,fiscal_year' where name = 'Leave Allocation'")
-elif patch_no == 106:
-	for d in sql("select name,employee,employee_name from `tabLeave Allocation`"):
-		if not cstr(d[2]):
-			sql("update `tabLeave Allocation` set employee_name = '%s' where name = '%s'" % (webnotes.conn.get_value('Employee',cstr(d[1]),'employee_name'), cstr(d[0])))
-	for d in sql("select name,employee,employee_name from `tabLeave Application`"):
-		if not cstr(d[2]):
-			sql("update `tabLeave Application` set employee_name = '%s' where name = '%s'" % (webnotes.conn.get_value('Employee',cstr(d[1]),'employee_name'), cstr(d[0])))
-elif patch_no == 107:
-	sql("delete from `tabDocField` where fieldname = 'fiscal_year' and parent = 'Employee'")
-elif patch_no == 108:
-	import_from_files(record_list=[['hr','search_criteria','srch_std_00013']])
-elif patch_no == 109:
-	import_from_files(record_list=[['hr','search_criteria','srch_std_00015']])
-elif patch_no == 110:
-	import_from_files(record_list=[['hr','doctype','salary_structure'], ['hr', 'doctype', 'salary_slip']])
-elif patch_no == 111:
-	sql("update tabDocType set search_fields = 'transfer_date, from_warehouse, to_warehouse, purpose, remarks' where name = 'Stock Entry'")
-elif patch_no == 112:
-	sql("delete from tabDocField where label = 'Get Other Charges' and fieldtype = 'Button' and parent = 'Receivable Voucher'")
-elif patch_no == 113:
-	sql("update tabDocField set reqd = 1 where parent = 'Customer' and fieldname = 'phone_1'")
-elif patch_no == 114:
-	for d in sql("select name, master_name, credit_days, credit_limit from tabAccount where master_type = 'Customer'"):
-		if cstr(d[1]):
-			days, limit = cint(d[2]), flt(d[3])
-			cust_det = sql("select credit_days, credit_limit from tabCustomer where name = '%s'" % (cstr(d[1])))
-			if not days: days = cust_det and cint(cust_det[0][0]) or 0
-			if not limit: limit = cust_det and flt(cust_det[0][1]) or 0
-			sql("COMMIT")
-			sql("START TRANSACTION")
-			sql("update tabAccount set credit_days = '%s', credit_limit = '%s' where name = '%s'" % (days, limit, cstr(d[0])))
-			sql("COMMIT")
-
-elif patch_no == 115:
-	# patch for timesheet cleanup
-	from webnotes.model import delete_doc
-	delete_doc('DocType', 'Timesheet Detail')
-
-	from webnotes.modules.import_module import import_from_files
-	import_from_files(record_list = [['Projects', 'DocType', 'Timesheet'], ['Projects', 'DocType', 'Timesheet Detail'], ['Projects', 'DocType', 'Activity Type']])
-
-elif patch_no == 116:
-	# again!
-	from webnotes.model import delete_doc
-	delete_doc('DocType', 'Timesheet Detail')
-
-	from webnotes.modules.import_module import import_from_files
-	import_from_files(record_list = [['Projects', 'DocType', 'Timesheet Detail']])
-elif patch_no == 117:
-	op = '\n' + 'Walk In'
-	sql("update `tabDocField` set `options` = concat(options, %s) where parent = 'Enquiry' and fieldname = 'source' and options not like '%%Walk%%'", op)
-elif patch_no == 118:
-	from webnotes.utils import get_defaults
-	ss = sql("select name, net_pay from `tabSalary Slip`")
-	for d in ss:
-		if d[1]:
-			w = get_obj('Sales Common').get_total_in_words(get_defaults()['currency'], d[1])
-			sql("update `tabSalary Slip` set net_pay_in_words = '%s' where name = '%s'" % (w, d[0]))
-elif patch_no == 119:
-	sql("update tabDocType set in_create = 1 where name = 'Profile'")
-elif patch_no == 120:
-	sql("update tabDocField set permlevel = 0 where parent = 'Sales and Purchase Return Wizard' and fieldname = 'return_date'")
-elif patch_no == 121:
-	import_from_files(record_list = [['CRM', 'DocType', 'Return Detail'], ['Material Management', 'DocType', 'Sales and Purchase Return Wizard']])
-elif patch_no == 122:
-	sql("delete from tabDocField where (fieldname = 'serial_no' or label = 'Warrany Status') and parent = 'Sales Order'")
-elif patch_no == 123:
-	import_from_files(record_list = [['CRM', 'Module Def', 'CRM'], ['CRM', 'Search Criteria', 'STDSRCH/00004']])
-elif patch_no == 124:
-	import webnotes
-	webnotes.conn.set_global("system_message", """<h3>Updates(New)</h3>We have added a new report in the Selling Module.<br><br><b>Sales Personwise Transaction Summary: </b>In this report you can see sales person's contribution in a particular order, delivery or invoice. You can select voucher type in "Based On" filter.<br><br> Do send us your feedback!""")
-	webnotes.conn.set_global("system_message_id", "5")
-elif patch_no == 125:
-	import_from_files(record_list = [['Material Management', 'DocType', 'Delivery Note']])
-elif patch_no == 126:
-	sql("delete from tabDocField where parent = 'Delivery Note' and label in ('Make Sales Invoice', 'Make Installation Note', 'Intro Note')")
-elif patch_no == 127:
-	sql("delete from tabDocPerm where role = 'All' and parent = 'Expense Voucher' and (permlevel = 0 or permlevel = 2)")
-	p = get_obj('Patch Util')
-	p.add_permission('Expense Voucher', 'Employee', 0, read = 1, write = 1, create = 1, submit = 1, cancel = 1, amend = 1, match = 'owner')
-	p.add_permission('Expense Voucher', 'HR Manager', 0, read = 1, write = 1, create = 1, submit = 1, cancel = 1, amend = 1)
-	p.add_permission('Expense Voucher', 'HR User', 0, read = 1, write = 1, create = 1, submit = 1, cancel = 1, amend = 1)
-elif patch_no == 128:
-	from webnotes.modules import import_module
-	import_module.import_from_files(record_list=[['selling','doctype','sales_order'], ['selling','doctype','sales_order_detail'],  ['stock','doctype','delivery_note'], ['stock','doctype','delivery_note_detail']])
-elif patch_no == 129:
-	sql("update `tabTable Mapper Detail` set validation_logic = '(qty > ifnull(billed_qty, 0) or amount > ifnull(billed_amt, 0)) and docstatus = 1' where parent = 'Sales Order-Receivable Voucher' and from_table = 'Sales Order Detail' and to_table = 'RV Detail'")
-	sql("update `tabTable Mapper Detail` set validation_logic = '(qty > ifnull(billed_qty, 0) or amount > ifnull(billed_amt, 0)) and docstatus = 1' where parent = 'Delivery Note-Receivable Voucher' and from_table = 'Delivery Note Detail' and to_table = 'RV Detail'")
-elif patch_no == 130:
-	# update from rv
-	from webnotes.model.code import get_obj
-	from webnotes.utils import cstr
-	for d in sql("select name, docstatus from `tabReceivable Voucher` where ifnull(docstatus,0) != 0"):
-		sql("COMMIT")
-		sql("START TRANSACTION")
-		try:
-			obj = get_obj('Receivable Voucher', cstr(d[0]), with_children = 1)
-			is_submit = 1
-			if cint(d[1]) == 2: is_submit = 0
-			get_obj('Sales Common').update_prevdoc_detail(is_submit, obj)
-		except:
-			pass
-		sql("COMMIT")
-
-	# update from dn
-	from webnotes.model.code import get_obj
-	for d in sql("select name, docstatus from `tabDelivery Note` where ifnull(docstatus,0) != 0"):
-		sql("COMMIT")
-		sql("START TRANSACTION")
-		try:
-			obj = get_obj('Delivery Note', cstr(d[0]), with_children = 1)
-			is_submit = 1
-			if cint(d[1]) == 2: is_submit = 0
-			get_obj('Sales Common').update_prevdoc_detail(is_submit, obj)
-		except:
-			pass
-		sql("COMMIT")
-elif patch_no == 131:
-	sql("update `tabDocType` set allow_trash = 1 where name = 'Purchase Other Charges'")
-	sql("update tabDocPerm set `cancel` = 1 where parent = 'Purchase Other Charges' and permlevel = 0 and `read` = 1 and `write` = 1")
-elif patch_no == 132:
-	sql("update tabDocField set no_copy = 0 where parent = 'Receivable Voucher' and fieldname = 'customer'")
-elif patch_no == 133:
-	from webnotes.modules import import_module
-	import_module.import_from_files(record_list=[['accounts','doctype','receivable_voucher']])
-elif patch_no == 134:
-	sql("update tabDocField set no_copy = 1 where parent = 'Receivable Voucher' and fieldname = 'posting_time'")
-elif patch_no == 135:
-	sql("update tabDocField set `default` = 'Today' where parent = 'Receivable Voucher' and fieldname = 'due_date'")
-elif patch_no == 136:
-	from webnotes.modules import import_module
-	import_module.import_from_files(record_list=[['accounts','doctype','rv_detail']])
-elif patch_no == 137:
-	from webnotes.modules import import_module
-	import_module.import_from_files(record_list=[['setup','doctype','price_list']])
-elif patch_no == 138:
-	sql("update `tabDocType` set allow_attach = 1 where name = 'Price List'")
-elif patch_no == 139:
-	from webnotes.modules import import_module
-	import_module.import_from_files(record_list=[['mapper','DocType Mapper','Sales Order-Receivable Voucher'], ['mapper','DocType Mapper','Delivery Note-Receivable Voucher']])
-elif patch_no == 140:
-	from webnotes.modules import import_module
-	import_module.import_from_files(record_list=[['accounts','doctype','rv_detail']])
-elif patch_no == 141:
-	sql("delete from tabDocField where (fieldname = 'letter_head' or label = 'Letter Head') and parent = 'Company'")
-elif patch_no == 142:
-	# fixes to letter head and personalize
-	from webnotes.model import delete_doc
-
-	delete_doc('DocType', 'Batch Settings')
-	delete_doc('DocType', 'Batch Settings Detail')
-	delete_doc('DocType', 'Social Badge')
-	delete_doc('Page', 'Personalize Page')
-	delete_doc('DocType', 'Personalize Page Control')
-
-	import_from_files(record_list=[['core','doctype','letter_head'], ['setup','doctype','personalize']])
-elif patch_no == 144:
-	webnotes.conn.sql("update tabDocField set fieldtype='Code' where parent='Letter Head' and fieldname='content'")
-elif patch_no == 145:
-	sql("update `tabDocField` set permlevel=1 where fieldname = 'group_or_ledger' and parent = 'Account'")
-elif patch_no == 146:
-	import_from_files(record_list=[['accounts','doctype','account']])
-elif patch_no == 147:
-	import_from_files(record_list=[['mapper', 'DocType Mapper', 'Purchase Order-Payable Voucher'], ['mapper', 'DocType Mapper', 'Purchase Receipt-Payable Voucher'], ['mapper', 'DocType Mapper', 'Purchase Order-Purchase Receipt']])
-elif patch_no == 148:
-	sql("delete from `tabDocField` where (fieldname = 'account_balances' or label = 'Balances') and parent = 'Account'")
-	sql("update tabDocType set istable = 0, section_style = 'Simple', search_fields = 'account, period, fiscal_year, balance' where name = 'Account Balance'")
-	sql("update tabDocField set permlevel = 0 where parent = 'Account Balance'")
-	p = get_obj('Patch Util')
-	p.add_permission('Account Balance', 'Accounts User', 0, read = 1)
-	p.add_permission('Account Balance', 'Accounts Manager', 0, read = 1)
-	import_from_files(record_list=[['accounts','doctype','account_balance']])
-elif patch_no == 149:
-	sql("update `tabAccount Balance` set account = parent")
-elif patch_no == 150:
-	sql("update tabDocField set in_filter = 1, search_index = 1 where parent = 'Account Balance' and fieldname in ('account', 'period', 'fiscal_year', 'start_date', 'end_date')")
-	ac_bal = Document("DocType", "Account Balance")
-	ac_bal.save()
-elif patch_no == 151:
-	sql("delete from tabDocField where label = 'Add / Manage Contacts' and fieldtype = 'Button' and parent = 'Customer'")
-	sql("delete from `tabField Mapper Detail` where parent = 'Sales Order-Delivery Note' and from_field = 'note' and to_field = 'note'")
-elif patch_no == 152:
-	import_from_files(record_list=[['selling','doctype','sales_order'], ['stock','doctype','delivery_note'], ['selling','doctype','customer'], ['selling','doctype','shipping_address'], ['mapper', 'DocType Mapper', 'Sales Order-Delivery Note']])
-elif patch_no == 153:
-	sql("delete from `tabDocField` where fieldname = 'sales_person' and parent = 'Customer'")
-elif patch_no == 154:
-	import_from_files(record_list=[['stock','doctype','serial_no'], ['support','doctype','customer_issue']])
-elif patch_no == 155:
-	for d in sql("select name, item_code from `tabSerial No`"):
-		sql("COMMIT")
-		sql("START TRANSACTION")
-		sql("update `tabSerial No` set item_name = '%s' where name = '%s'" % (webnotes.conn.get_value('Item',cstr(d[1]),'item_name'), cstr(d[0])))
-		sql("COMMIT")
-elif patch_no == 156:
-	sql("update tabDocField set fieldtype = 'Code' where fieldname = 'html' and parent = 'Print Format'")
-elif patch_no == 157:
-	import_from_files(record_list=[['accounts', 'doctype', 'journal_voucher'], ['accounts', 'Print Format', 'Payment Receipt Voucher'], ['accounts', 'Print Format', 'Cheque Printing Format']])
-elif patch_no == 158:
-	from webnotes.model.doc import addchild
-	sql("delete from tabDocField where parent = 'Customer Issue' and fieldname = 'customer_group'")
-elif patch_no == 159:
-	sql("update tabAccount set account_type = 'Chargeable' where account_name in ('Advertising and Publicity', 'Freight & Forwarding Charges', 'Miscellaneous Expenses', 'Sales Promotion Expenses')")
-elif patch_no == 160:
-	sql("update `tabDocType` set search_fields = 'posting_date, due_date, debit_to, fiscal_year, grand_total, outstanding_amount' where name = 'Receivable Voucher'")
-	sql("update `tabDocType` set search_fields = 'posting_date, credit_to, fiscal_year, bill_no, grand_total, outstanding_amount' where name = 'Payable Voucher'")
-elif patch_no == 161:
-	sql("update tabDocType set autoname = 'field:batch_id' where name = 'Batch'")
-	sql("update tabDocField set no_copy = 1 where parent = 'Batch' and fieldname = 'batch_id'")
-elif patch_no == 162:
-	import_from_files(record_list=[['selling', 'search_criteria', 'sales_order_pending_items1']])
-elif patch_no == 163:
-	sql("delete from `tabModule Def Item` where display_name = 'Sales Orderwise Pending Packing Item Summary' and parent = 'CRM'")
-	import_from_files(record_list=[['selling', 'search_criteria', 'sales_orderwise_pending_qty_to_deliver'], ['selling', 'search_criteria', 'sales_orderwise_pending_amount_to_bill'], ['selling', 'search_criteria', 'delivered_items_to_be_install']])
-elif patch_no == 164:
-	import_from_files(record_list=[['buying', 'search_criteria', 'pending_po_items_to_receive'], ['buying', 'search_criteria', 'pending_po_items_to_bill']])
-elif patch_no == 165:
-	pass
-elif patch_no == 166:
-	import_from_files(record_list=[['buying', 'doctype', 'purchase_order']])
-elif patch_no == 167:
-	if webnotes.conn.get_value('Control Panel', None, 'account_id') not in ['ax0000956', 'ax0001338']:
-		sql("delete from tabDocField where parent = 'Purchase Order' and fieldname in ('test_certificate_required', 'estimated_cost', 'transport', 'vendor_reference', 'transportation_required', 'mode_of_dispatch', 'octroi')")
-elif patch_no == 168:
-	sql("update tabDocField set fieldtype = 'Data', options = 'Suggest' where fieldname = 'bank_name' and parent = 'Employee'")
-elif patch_no == 169:
-	import_from_files(record_list=[['accounts', 'doctype', 'pv_detail'], ['accounts', 'doctype', 'rv_detail']])
-elif patch_no == 170:
-	import_from_files(record_list=[['mapper', 'DocType Mapper', 'Delivery Note-Receivable Voucher']])
-elif patch_no == 171:
-	import_from_files(record_list=[['buying', 'doctype', 'supplier']])
-elif patch_no == 172:
-	import webnotes
-	webnotes.conn.set_global("system_message", """<b>Welcome to the new financial year 2011-2012 !!! </b><br><br> So obvious question in your mind is how to start Entries in the New Fiscal Year in ERPNext? What are the changes you have to make in the system? <br>We have made some guidelines regarding the basic steps you should follow. Please click on link <a href='http://erpnext.blogspot.com/2011/03/how-to-start-entries-in-new-fiscal-year.html'>How to start Entries in the New Fiscal Year in ERPNext?</a>""")
-	webnotes.conn.set_global("system_message_id", "6")
-elif patch_no == 173:
-	sql("delete from tabDocField where label = 'Get Other Charges' and parent = 'Delivery Note'")
-	sql("update tabDocField set reqd = 0 where fieldname = 'posting_time' and parent = 'Serial No'")
-elif patch_no == 174:
-	c = sql("select count(name) from `tabField Mapper Detail` where parent = 'Delivery Note-Receivable Voucher' and from_field = 'description' and to_field = 'description' and match_id = 2")
-	if c and cint(c[0][0]) > 1:
-		sql("update `tabField Mapper Detail` set match_id = 1 where parent = 'Delivery Note-Receivable Voucher' and from_field = 'description' and to_field = 'description' limit 1")
-elif patch_no == 175:
-	import webnotes
-	webnotes.conn.set_global("system_message", """If your financial year starts on 1st April then you have make some changes in the system to start entry in the new year.<br>We have made some guidelines regarding the basic steps you should follow. Please click on link <a href='http://erpnext.blogspot.com/2011/03/how-to-start-entries-in-new-fiscal-year.html'>How to start Entries in the New Fiscal Year in ERPNext?</a>""")
-	webnotes.conn.set_global("system_message_id", "6")
-elif patch_no == 176:
-	sql("update tabDocPerm set role='Guest', `write`=0, `create`=0 where role='Administrator' and parent='Notification Control' limit 1")
-elif patch_no == 177:
-	sql("delete from `tabDocField` where label = 'Next Steps' and parent = 'Purchase Order'")
-	sql("update tabDocField set options = 'Material Issue\nMaterial Receipt\nMaterial Transfer\nSales Return\nPurchase Return\nSubcontracting\nProduction Order' where parent = 'Stock Entry' and fieldname = 'purpose'")
-elif patch_no == 178:
-	import_from_files(record_list = [['hr', 'doctype', 'salary_slip']])
-elif patch_no == 179:
-	from webnotes.utils import get_defaults
-	sl = sql("select name, net_pay from `tabSalary Slip`")
-	for d in sl:
-		in_words = get_obj('Sales Common').get_total_in_words(get_defaults()['currency'], round(flt(d[1])))
-		sql("update `tabSalary Slip` set rounded_total = '%s', total_in_words = '%s' where name = '%s'" % (round(flt(d[1])), in_words, d[0]))
-elif patch_no == 180:
-	sql("delete from tabDocField where parent = 'Salary Slip' and fieldname = 'net_pay_in_words'")
-elif patch_no == 181:
-	import_from_files(record_list = [['accounts', 'doctype', 'journal_voucher']])
-elif patch_no == 182:
-	sql("update tabDocField set options = CONCAT(options, '\nWrite Off Voucher') where fieldname = 'voucher_type' and parent = 'Journal Voucher'")
-elif patch_no == 183:
-	sql("delete from tabDocField where label = 'SMS' and fieldtype = 'Section Break' and parent in  ('Enquiry', 'Lead', 'Sales Order', 'Delivery Note')")
-elif patch_no == 184:
-	from webnotes.model import delete_doc
-	delete_doc('DocType', 'Feed')
-	delete_doc('DocType', 'Feed List')
-	delete_doc('DocType', 'Feed Control')
-
-	# add trigger
-	from webnotes.model.triggers import add_trigger
-	add_trigger('*','*','*','event_updates.update_feed')
-
-	webnotes.conn.commit()
-
-	try:
-		sql("drop table tabFeed")
-		sql("drop table `tabFeed List`")
-	except: pass
-
-	# import
-	from webnotes.modules.module_manager import reload_doc
-	reload_doc('event_updates','doctype','feed')
-elif patch_no==185:
-	sql("delete from tabDocTrigger where method = 'webnotes.widgets.follow.on_docsave'")
-elif patch_no==186:
-	from webnotes.modules.module_manager import reload_doc
-	reload_doc('event_updates','doctype','feed')
-elif patch_no == 187:
-	sql("update tabDocType set autoname = '' where name = 'QA Inspection Report'")
-elif patch_no == 188:
-	import_from_files(record_list = [['buying', 'doctype', 'qa_inspection_report']])
-elif patch_no == 189:
-	sql("update `tabDocField` set allow_on_submit = 1 where fieldname in ('entries', 'other_charges') and parent = 'Receivable Voucher'")
-elif patch_no == 190:
-	sql("update tabDocField set permlevel=0 where fieldname = 'fiscal_year' and parent = 'Stock Entry'")
-elif patch_no == 191:
-	import_from_files(record_list = [['support', 'doctype', 'customer_issue']])
-elif patch_no == 192:
-	sql("delete from `tabModule Def Item` where parent = 'Material Management' and doc_name = 'Landed Cost Wizard' and display_name = 'Landed Cost Wizard'")
-	import_from_files(record_list = [['buying', 'Module Def', 'SRM']])
-elif patch_no == 193:
-	sql("update tabDocField set fieldtype='Button', `trigger`='Client' where parent='Letter Head' and fieldname='set_from_image'")
-elif patch_no == 194:
-	sql("delete from `tabModule Def Item` where parent = 'SRM' and doc_name = 'Landed Cost Wizard' and display_name = 'Landed Cost Wizard'")
-	import_from_files(record_list = [['stock', 'Module Def', 'Material Management']])
-elif patch_no == 195:
-	from webnotes.modules.module_manager import reload_doc
-	reload_doc('setup','doctype','manage_account')
-elif patch_no == 196:
-	sql("update `tabModule Def` set module_page = null where name = 'Material Management'")
-elif patch_no == 197:
-	sql("update `tabDocField` set permlevel = 0, in_filter = 1 where fieldname = 'warranty_amc_status' and parent = 'Customer Issue'")
-	import_from_files(record_list = [['support', 'doctype', 'customer_issue']])
-elif patch_no == 198:
-	sql("delete from `tabDocField` where (label in ('SMS', 'Send SMS') or fieldname in ('message', 'customer_mobile_no')) and parent in ('Quoattion', 'Sales Order', 'Delivery Note', 'Receivable Voucher')")
-	sql("delete from `tabDocField` where label in ('SMS', 'Send SMS') and parent = 'Purchase Order'")
-	sql("delete from `tabDocField` where (label in ('Send SMS', 'SMS Html') or fieldname in ('sms_message', 'lead_sms_detail', 'enquiry_sms_detail')) and parent in ('Lead', 'Enquiry')")
-	from webnotes.model import delete_doc
-	delete_doc('DocType', 'Lead SMS Detail')
-	delete_doc('DocType', 'Enquiry SMS Detail')
-elif patch_no == 199:
-	sql("update tabDocField set reqd = 0 where parent = 'Attendance' and fieldname = 'shifts'")
-elif patch_no == 200:
-	reload_doc('event_updates','page','profile_settings')
-elif patch_no == 201:
-	reload_doc('setup','doctype','price_list')
-elif patch_no == 202:
-	name1 = sql("select name from tabDocField where parent='Price List' and label='Clear Prices' limit 1,1")
-	name2 = sql("select name from tabDocField where parent='Price List' and label='Update Prices' limit 1,1")
-	if name1:
-		sql("delete from tabDocField where name=%s limit 1", name1[0][0])
-	if name2:
-		sql("delete from tabDocField where name=%s limit 1", name2[0][0])
-elif patch_no == 203:
-	sql("delete from tabDocField where parent = 'Company' and fieldname = 'default_salary_account' limit 1")
-elif patch_no == 204:
-	sql("delete from tabDocField where parent = 'Company' and fieldname = 'default_salary_acount' limit 1")
-elif patch_no == 205:
-	sql("update `tabDocField` set `default` = '' where fieldname = 'naming_series' and parent = 'Installation Note'")
-elif patch_no == 206:
-	reload_doc('selling','doctype','installation_note')
-elif patch_no == 207:
-	import_from_files(record_list = [['setup', 'doctype', 'company']])
-elif patch_no == 208:
-	sql("delete from `tabDocField` where (label in ('SMS', 'Send SMS') or fieldname in ('message', 'customer_mobile_no')) and parent ='Quotation'")
-	default_currency = get_obj('Manage Account').doc.default_currency
-	sql("update tabCompany set default_currency = '%s'" % default_currency)
-elif patch_no == 209:
-	import_from_files(record_list = [['setup', 'doctype', 'company']])
-elif patch_no == 210:
-	sql("delete FROM `tabDocField` WHERE parent = 'Lead' AND label in ('CC:','Attachment Html','Create New File','Attachment')")
-elif patch_no == 212:
-	# reload company because of disturbed UI
-	import_from_files(record_list = [['setup', 'doctype', 'company']])
-elif patch_no == 213:
-	reload_doc('selling','doctype','lead')
-	reload_doc('setup','doctype','company')
-elif patch_no == 214:
-	reload_doc('selling','doctype','sales_order')
-elif patch_no == 215:
-	# patch for item and image in description
-	sql("update tabDocField set width = '300px' where fieldname='description'")
-	reload_doc('stock', 'doctype', 'item')
-	sql("delete from __DocTypeCache")
-elif patch_no == 216:
-	import_from_files(record_list = [['stock', 'doctype', 'serial_no'], ['stock', 'doctype', 'stock_ledger_entry']])
-elif patch_no == 217:
-	sql("update tabDocField set options = '\nIn Store\nDelivered\nNot in Use' where fieldname = 'status' and parent = 'Serial No'")
-	sql("update tabDocField set no_copy = 1 where fieldname = 'serial_no' and parent = 'Delivery Note Detail'")
-	sql("update tabDocField set no_copy = 1 where fieldname = 'serial_no' and parent = 'Stock Entry Detail'")
-elif patch_no == 218:
-	for d in sql("select name from `tabSerial No`"):
-		sql("Commit")
-		sql("Start Transaction")
-		s = Document('Serial No', d[0])
-		if s.pr_no:
-			s.purchase_document_type = 'Purchase Receipt'
-			s.purchase_document_no = s.pr_no
-		if s.delivery_note_no:
-			s.delivery_document_type = 'Delivery Note'
-			s.delivery_document_no = s.delivery_note_no
-		if s.notes:
-			s.delivery_note_no = s.notes
-		s.company = webnotes.utils.get_defaults()['company']
-		s.fiscal_year = webnotes.utils.get_defaults()['fiscal_year']
-		s.save()
-elif patch_no == 219:
-	sql("delete from tabDocField where fieldname in ('pr_no', 'make', 'label', 'delivery_note_no', 'notes') and parent = 'Serial No'")
-elif patch_no == 220:
-	sql("update tabDocField set label = 'Incoming Rate' where fieldname = 'purchase_rate' and parent = 'Serial No'")
-	sql("update tabDocField set label = 'Incoming Time' where fieldname = 'purchase_time' and parent = 'Serial No'")
-elif patch_no == 221:
-	sql("update tabDocField set reqd = 1 where fieldname in ('purchase_rate', 'warehouse') and parent = 'Serial No'")
-elif patch_no == 222:
-	sql("update tabDocField set options = '\nDelivery Note\nReceivable Voucher\nStock Entry' where fieldname = 'delivery_document_type' and parent = 'Serial No'")
-elif patch_no == 223:
-	sql("update tabDocField set hidden = 0 where fieldname in ('pay_to_recd_from', 'total_amount', 'total_amount_in_words') and parent = 'Journal Voucher'")
-	sql("update tabDocField set permlevel = 0 where fieldname = 'pay_to_recd_from' and parent = 'Journal Voucher'")
-elif patch_no == 224:
-	import_from_files(record_list = [['stock', 'doctype', 'delivery_note_packing_detail'], ['accounts', 'Print Format', 'Payment Receipt Voucher']])
-elif patch_no == 225:
-	import_from_files(record_list = [['stock', 'doctype', 'delivery_note_packing_detail']])
-elif patch_no == 226:
-	import_from_files(record_list = [['stock', 'doctype', 'delivery_note_packing_detail']])
-elif patch_no == 227:
-	reload_doc('stock', 'doctype', 'item')
-	if webnotes.conn.get_value('Control Panel', None, 'account_id') != 'axjanak2011':
-		sql("delete from tabDocField where parent = 'Item' and fieldname='alternate_description' limit 1")
-elif patch_no == 228:
-	# knowledge base patch
-	reload_doc('knowledge_base', 'doctype', 'question')
-	reload_doc('knowledge_base', 'doctype', 'answer')
-	reload_doc('knowledge_base', 'page', 'questions')
-	reload_doc('knowledge_base', 'Module Def', 'Knowledge Base')
-	sql("update `tabModule Def` set disabled='No' where name='Knowledge Base'")
-elif patch_no == 229:
-	reload_doc('knowledge_base', 'page', 'question_view')
-elif patch_no == 230:
-	reload_doc('buying', 'doctype', 'indent')
-	reload_doc('buying', 'doctype', 'indent_detail')
-	reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Indent')
-elif patch_no == 231:
-	reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Indent')
-elif patch_no == 232:
-	sql("update `tabDocField` set options = 'Sales Order' where fieldname = 'sales_order_no' and parent = 'Indent'")
-elif patch_no == 233:
-	reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Receivable Voucher')
-	reload_doc('Mapper', 'DocType Mapper', 'Delivery Note-Receivable Voucher')
-elif patch_no == 234:
-	sql("update `tabTable Mapper Detail` set validation_logic = 'docstatus=1' where parent = 'Sales Order-Indent' and from_table = 'Sales Order Detail'")
-elif patch_no == 235:
-	for sc in sql("""select name from `tabSearch Criteria` where ifnull(name,'')
-		like 'srch%' or ifnull(name,'') like '%stdsrch'"""):
-		try:
-			get_obj('Search Criteria', sc[0]).rename()
-		except AttributeError, e:
-			pass
-	reload_doc('core', 'doctype', 'system_console')
-elif patch_no == 236:
-	# warehouse not mandatory for delivered serial nos
-	sql("update tabDocField set reqd=0 where parent='Serial No' and fieldname='warehouse'")
-elif patch_no == 237:
-	sql("update tabDocField set depends_on = 'eval:doc.is_pos==1' where fieldname = 'cash_bank_account' and parent = 'Receivable Voucher'")
-elif patch_no == 238:
-	reload_doc('accounts', 'doctype', 'receivable_voucher')
-	reload_doc('accounts', 'GL Mapper', 'POS with write off')
-elif patch_no == 239:
-	reload_doc('core', 'doctype', 'docfield')
-	reload_doc('core', 'doctype', 'doctype')
-	from patches.old_patches.feed_patch import set_subjects_and_tagfields
-
-	set_subjects_and_tagfields()
-elif patch_no == 240:
-	# again for sales order (status)
-	from patches.old_patches.feed_patch import set_subjects_and_tagfields
-	set_subjects_and_tagfields()
-elif patch_no == 241:
-	sql("update `tabDocField` set fieldtype = 'Text', options = '', in_filter = '' where fieldname = 'serial_no' and parent = 'Stock Ledger Entry'")
-elif patch_no == 242:
-	if webnotes.conn.get_value('Control Panel', None, 'account_id') not in ['axjanak2011']:
-		sql("commit")
-		try:
-			sql("alter table `tabStock Ledger Entry` drop index serial_no")
-		except:
-			pass
-
-		sql("alter table `tabStock Ledger Entry` change serial_no serial_no text")
-elif patch_no == 243:
-	# moving custom script and custom fields to framework
-	webnotes.conn.set_value('DocType', 'Custom Script', 'module', 'Core')
-	webnotes.conn.set_value('DocType', 'Custom Field', 'module', 'Core')
-	reload_doc('setup', 'doctype', 'company')
-elif patch_no == 244:
-	reload_doc('stock', 'search_criteria', 'shortage_to_indent')
-elif patch_no == 245:
-	from patches.old_patches.doctype_permission_patch import set_doctype_permissions
-	set_doctype_permissions()
-
-	from patches.old_patches.feed_patch import set_subjects_and_tagfields
-	set_subjects_and_tagfields()
-elif patch_no == 246:
-	webnotes.conn.set_value('DocType','Stock Entry','tag_fields','purpose')
-	webnotes.conn.set_value('DocType','Stock Entry','subject','%(remarks)s')
-elif patch_no == 247:
-	webnotes.conn.set_value('DocType','Stock Entry','subject','%(remarks)s')
-elif patch_no == 248:
-	reload_doc('setup', 'doctype', 'manage_account')
-elif patch_no == 249:
-	sql("update `tabDocPerm` t1, `tabDocType` t2 set t1.role = 'System Manager' where t1.role = 'Administrator' and t1.parent = t2.name and t2.module != 'Core'")
-elif patch_no == 250:
-	from patches.old_patches.feed_patch  import support_patch
-	support_patch()
-elif patch_no == 251:
-	from webnotes.model import db_schema
-	db_schema.remove_all_foreign_keys()
-	from patches.old_patches.customer_address import run_patch
-	run_patch()
-elif patch_no == 252:
-	reload_doc('support','doctype','support_ticket')
-	reload_doc('support','doctype','support_ticket_response')
-elif patch_no == 253:
-	reload_doc('accounts','doctype','ledger_balance_export')
-	reload_doc('accounts','doctype','ledger_detail')
-	reload_doc('accounts', 'Module Def', 'Accounts')
-
-	from webnotes.model.db_schema import updatedb
-	updatedb('Ledger Balance Export')
-	updatedb('Ledger Detail')
-elif patch_no == 254:
-	reload_doc('setup', 'doctype', 'sms_settings')
-	reload_doc('setup', 'doctype', 'static_parameter_detail')
-
-	from webnotes.model.db_schema import updatedb
-	updatedb('SMS Settings')
-	updatedb('Static Parameter Detail')
-elif patch_no == 255:
-	from patches.old_patches.customer_address import run_old_data_sync_patch
-	run_old_data_sync_patch()
-elif patch_no == 256:
-	sql("update `tabLetter Head` set content = replace(content, 'http://46.4.50.84/v170-test/', '')")
-	sql("update `tabSingles` set value = replace(value, 'http://46.4.50.84/v170-test/', '') where field in ('letter_head', 'client_name') and doctype = 'Control Panel'")
-	sql("update `tabItem` set description_html = replace(description_html, 'http://46.4.50.84/v170-test/', '')")
-elif patch_no == 257:
-	from patches.old_patches.customer_address import run_old_data_sync_patch
-	run_old_data_sync_patch()
-elif patch_no == 258:
-	sql("update tabDocField set `default`=NULL where fieldname = 'naming_series'")
-elif patch_no == 259:
-	sql("update `tabQuotation Detail` set description = replace(description, 'http://46.4.50.84/v170-test/', '')")
-	sql("update `tabSales Order Detail` set description = replace(description, 'http://46.4.50.84/v170-test/', '')")
-	sql("update `tabRV Detail` set description = replace(description, 'http://46.4.50.84/v170-test/', '')")
-	sql("update `tabDelivery Note Detail` set description = replace(description, 'http://46.4.50.84/v170-test/', '')")
-elif patch_no == 260:
-	sql("update `tabLetter Head` set content = replace(content, 'http://46.4.50.84/v170/', '')")
-	sql("update `tabSingles` set value = replace(value, 'http://46.4.50.84/v170/', '') where field in ('letter_head', 'client_name') and doctype = 'Control Panel'")
-	sql("update `tabItem` set description_html = replace(description_html, 'http://46.4.50.84/v170/', '')")
-	sql("update `tabQuotation Detail` set description = replace(description, 'http://46.4.50.84/v170/', '')")
-	sql("update `tabSales Order Detail` set description = replace(description, 'http://46.4.50.84/v170/', '')")
-	sql("update `tabRV Detail` set description = replace(description, 'http://46.4.50.84/v170/', '')")
-	sql("update `tabDelivery Note Detail` set description = replace(description, 'http://46.4.50.84/v170/', '')")
-elif patch_no == 261:
-	sql("update `tabPrint Format` set html = replace(html, 'customer_address', 'address_display')")
-elif patch_no == 262:
-	from patches.old_patches.customer_address import sync_lead_phone
-	sync_lead_phone()
-elif patch_no == 263:
-	ol = ['','Open','To Reply','Waiting for Customer','Hold','Closed']
-	sql("update tabDocField set options=%s where parent=%s and fieldname=%s", ('\n'.join(ol), 'Support Ticket', 'status'))
-elif patch_no == 264:
-	sql("delete from tabDocField where parent = 'Customer Issue' and (fieldname = 'issue_in' or fieldname = 'issue_category')")
-	sql("update tabDocField set options=NULL where parent='Support Ticket' and label = 'Send'")
-elif patch_no == 266:
-	reload_doc('setup','doctype','support_email_settings')
-elif patch_no == 267:
-	sql("update `tabPrint Format` set html = replace(html, 'supplier_address', 'address_display')")
-elif patch_no == 268:
-	sql("update `tabDocPerm` set permlevel = 0 where permlevel is null")
-elif patch_no == 269:
-	p = get_obj('Patch Util')
-	p.add_permission('GL Entry', 'Accounts User', 0, read = 1)
-elif patch_no == 270:
-	pages = ['Accounts Setup', 'Accounts', 'Accounting Reports','GeneralLedger','How do I - Accounts','Making Opening Entries',\
-	'Analysis','How do I - CRM','How do I - Inventory','Inventory Setup', 'Stock','HR','HR & Payroll Setup',\
-	'Payroll Setup','Production Setup','Production','Buying','SRM Setup','Contact Page','Forum','Messages','Test Toolbar',\
-	'Trend Analyzer']
-	from webnotes.model import delete_doc
-	sql("delete from `tabPage Visit`")
-	for p in pages:
-		try: delete_doc('Page', p)
-		except: pass
-elif patch_no == 271:
-	# tags patch
-	reload_doc('selling','doctype','sales_order')
-	reload_doc('stock','doctype','delivery_note')
-	sql("delete from tabDocField where fieldname='per_amt_billed' and parent in ('Sales Order', 'Delivery Note')")
-
-	sql("""update `tabSales Order` set delivery_status = if(ifnull(per_delivered,0) < 0.001, 'Not Delivered',
-			if(per_delivered >= 99.99, 'Fully Delivered', 'Partly Delivered'))""")
-	sql("""update `tabSales Order` set billing_status = if(ifnull(per_billed,0) < 0.001, 'Not Billed',
-			if(per_billed >= 99.99, 'Fully Billed', 'Partly Billed'))""")
-	sql("""update `tabDelivery Note` set billing_status = if(ifnull(per_billed,0) < 0.001, 'Not Billed',
-			if(per_billed >= 99.99, 'Fully Billed', 'Partly Billed'))""")
-elif patch_no == 272:
-	from webnotes.model import delete_doc
-	try:
-		delete_doc('Search Criteria', '_SRCH00003')
-	except:
-		pass
-	reload_doc('accounts', 'search_criteria', 'purchase_register')
-elif patch_no == 276:
-	from webnotes.model import delete_doc
-	sn = sql("select name from `tabSearch Criteria` where criteria_name = 'Sales Personwise Transaction Summary'")
-	for d in sn:
-		delete_doc('Search Criteria', d[0])
-	reload_doc('selling', 'search_criteria', 'sales_personwise_transaction_summary')
-elif patch_no == 277:
-	webnotes.model.delete_doc('DocType','HomePage Settings')
-	webnotes.model.delete_doc('DocType','Badge Settings')
-	sql("update tabDocType set module='Home' where module in ('Event Updates', 'My Company')")
-	sql("update tabPage set module='Home' where module in ('Event Updates', 'My Company')")
-	sql("update `tabSearch Criteria` set module='Home' where module in ('Event Updates', 'My Company')")
-
-
-	delete_pages = ('Chat User Gallery', 'Badge Info', 'Home', 'Website Setup', 'Test Page', 'Setup Masters', 'Service', 'Selling', 'Sales Reports', 'Organize','My Cart', 'My Activity', 'Manage Users', 'Maintenance', 'Getting Started', 'Gantt Test', 'Custom Reports - Stock', 'Custom Reports - Selling', 'Custom Reports - Production', 'Custom Reports - Payroll', 'Custom Reports - Maintenance', 'Custom Reports - Buying', 'Custom Reports - Accounts', 'CRM Setup', 'CRM Reports')
-	for p in delete_pages:
-	  webnotes.model.delete_doc('Page',p)
-elif patch_no == 278:
-	sql("update tabDocTrigger set method = 'home.update_feed' where method = 'event_updates.update_feed'")
-elif patch_no == 279:
-	dt = ['GL Entry', 'Stock Ledger Entry']
-	for t in dt:
-		rec = sql("select voucher_type, voucher_no, ifnull(is_cancelled, 'No') from `tab%s` where modified >= '2011-06-15 01:00:00' group by voucher_no" % t)
-		for d in rec:
-			sql("update `tab%s` set docstatus = %s where name = '%s'" % (d[0], d[2]=='No' and 1 or 2, d[1]))
-
-	other_dt = ['Enquiry', 'Quotation', 'Sales Order', 'Indent', 'Purchase Order', 'Production Order', 'Customer Issue', 'Installation Note']
-	for dt in other_dt:
-		rec = sql("select name, status from `tab%s` where modified >= '2011-06-15 01:00:00'" % dt)
-		for r in rec:
-			sql("update `tab%s` set docstatus = %s where name = '%s'" % (dt, (r[1] in ['Submitted', 'Closed'] and 1 or r[1]=='Cancelled' and 2 or 0), r[0]))
-elif patch_no == 280:
-	reload_doc('accounts', 'doctype', 'form_16a')
-elif patch_no == 281:
-	dt_list = ['Delivery Note', 'Purchase Receipt']
-	for dt in dt_list:
-		sql("update `tab%s` set status = 'Submitted' where docstatus = 1 and modified >='2011-06-15 01:00:00'" % dt)
-		sql("update `tab%s` set status = 'Cancelled' where docstatus = 2 and modified >='2011-06-15 01:00:00'" % dt)
-elif patch_no == 282:
-	dt_list = ['Enquiry', 'Quotation', 'Sales Order', 'Indent', 'Purchase Order', 'Production Order', 'Customer Issue', 'Installation Note', 'Receivable Voucher', 'Payable Voucher', 'Delivery Note', 'Purchase Receipt', 'Journal Voucher', 'Stock Entry']
-	for d in dt_list:
-		tbl = sql("select options from `tabDocField` where fieldtype = 'Table' and parent = '%s'" % d)
-		for t in tbl:
-			sql("update `tab%s` t1, `tab%s` t2 set t1.docstatus = t2.docstatus where t1.parent = t2.name" % (t[0], d))
-elif patch_no == 283:
-	rec = sql("select voucher_type, voucher_no, ifnull(is_cancelled, 'No') from `tabGL Entry` where modified >= '2011-06-15 01:00:00' order by name ASC")
-	for d in rec:
-		sql("update `tab%s` set docstatus = %s where name = '%s'" % (d[0], d[2]=='No' and 1 or 2, d[1]))
-elif patch_no == 284:
-	reload_doc('support', 'doctype', 'support_ticket')
-	sql("update `tabDocField` set in_filter = 1 where fieldname in ('raised_by', 'subject') and parent = 'Support Ticket'")
-elif patch_no == 286:
-	reload_doc('accounts', 'search_criteria', 'itemwise_sales_register')
-	reload_doc('accounts', 'search_criteria', 'itemwise_purchase_register')
-elif patch_no == 287:
-	sql("update `tabDocField` set no_copy = 1 where fieldname in ('per_received', 'per_billed', 'per_delivered') and parent in ('Purchase Order', 'Purchase Receipt', 'Sales Order', 'Delivery Note')")
-elif patch_no == 288:
-	reload_doc('accounts', 'doctype', 'payable_voucher')
-elif patch_no == 289:
-	sql("update `tabDocType` set subject = 'From %(supplier_name)s worth %(grand_total)s due on %(due_date)s | %(outstanding_amount)s outstanding' where name = 'Payable Voucher'")
-	sql("update `tabDocType` set search_fields = 'status,transaction_date,customer,lead,order_type' where name = 'Quotation'")
-elif patch_no == 290:
-	count = sql("""SELECT * FROM  `tabModule Def`
-		   WHERE `module_name` LIKE 'Home'""")
-	if not count:
-		md = Document('Module Def')
-		md.module_name = 'Home'
-		md.module_label = 'Home'
-		md.save(1)
-elif patch_no == 291:
-	reload_doc('utilities','doctype','rename_tool')
-elif patch_no == 292:
-	reload_doc('accounts', 'search_criteria', 'trial_balance')
-elif patch_no == 293:
-	sql("delete from tabDocField where parent='Account' and fieldname='address'")
-	reload_doc('accounts', 'doctype', 'account')
-elif patch_no == 294:
-	# new account profile fix
-	ul = sql("select name from tabProfile where ifnull(name,'') not in ('Administrator', 'Guest', '')")
-	# if one user and one user has no roles
-	if len(ul)==1 and not sql("select parent from tabUserRole where role='System Manager' and parent=%s", ul[0][0]):
-		get_obj('Setup Control').add_roles(Document('Profile', ul[0][0]))
-elif patch_no == 295:
-	sql("update `tabDocField` set options = 'Delivered\nNot Delivered\nPartly Delivered\nClosed\nNot Applicable' where parent = 'Sales Order' and fieldname = 'delivery_status'")
-	sql("update `tabDocField` set options = 'Billed\nNot Billed\nPartly Billed\nClosed' where parent = 'Sales Order' and fieldname = 'billing_status'")
-elif patch_no == 296:
-	sql("delete from tabDocField where parent='Support Ticket' and fieldname='contact_no'")
-	reload_doc('support', 'doctype', 'support_ticket')
-elif patch_no == 297:
-	reload_doc('hr', 'doctype', 'employee')
-	reload_doc('hr', 'doctype', 'attendance')
-	reload_doc('hr', 'doctype', 'expense_voucher')
-	reload_doc('hr', 'doctype', 'appraisal')
-	reload_doc('hr', 'doctype', 'salary_structure')
-	reload_doc('hr', 'doctype', 'salary_slip')
-elif patch_no == 298:
-	sql("update `tabDocField` set options = 'link:Company' where parent = 'Attendance' and fieldname = 'company'")
-	sql("update `tabDocField` set options = 'link:Company' where parent = 'Expense Voucher' and fieldname = 'company'")
-	sql("update `tabDocField` set options = 'link:Company' where parent = 'Appraisal' and fieldname = 'company'")
-elif patch_no == 299:
-	sql("update `tabDocPerm` set `match` = NULL where parent = 'Employee' and role = 'Employee'")
-elif patch_no == 300:
-	sql("""DELETE FROM `tabSearch Criteria` WHERE name IN
-		   ('sales_register1', 'sales_register2', 'purchase_register1')""")
\ No newline at end of file
diff --git a/erpnext/patches/old_patches/rename_search_criteria.py b/erpnext/patches/old_patches/rename_search_criteria.py
deleted file mode 100644
index 0cd23ed..0000000
--- a/erpnext/patches/old_patches/rename_search_criteria.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import webnotes
-from webnotes.model.code import get_obj
-def execute():
-	for sc in webnotes.conn.sql("""select name from `tabSearch Criteria` where ifnull(name,'')
-		like 'srch%' or ifnull(name,'') like '%stdsrch'"""):
-		get_obj('Search Criteria', sc[0]).rename()
diff --git a/erpnext/patches/old_patches/replacecode.py b/erpnext/patches/old_patches/replacecode.py
deleted file mode 100644
index 0043f9c..0000000
--- a/erpnext/patches/old_patches/replacecode.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import os
-
-def replace_code(old, new):
-	txt = os.popen("""grep "%s" ./*/*/*/*.js""" % old).read().split()
-	txt = [t.split(':')[0] for t in txt]
-	txt = list(set(filter(lambda t: t.startswith('./'), txt)))
-	for t in txt:
-		if new:
-			code = open(t,'r').read().replace(old, new)
-			open(t, 'w').write(code)
-			print "Replaced for %s" % t
-		else:
-			print 'Found in %s' % t
-	
-if __name__=='__main__':
-	old = """cur_frm.cscript.get_tips(doc, cdt, cdn);"""
-	new = " "
-	replace_code(old, new)
-			
diff --git a/erpnext/patches/patch.py b/erpnext/patches/patch.py
deleted file mode 100644
index 744b102..0000000
--- a/erpnext/patches/patch.py
+++ /dev/null
@@ -1,480 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# REMEMBER to update this
-# ========================
-
-last_patch = 388
-
-#-------------------------------------------
-
-def execute(patch_no):
-	return
-	import webnotes
-	from webnotes.modules.module_manager import reload_doc
-
-	from webnotes.model.code import get_obj
-	sql = webnotes.conn.sql
-	from webnotes.utils import cint, cstr, flt
-	from webnotes.model.doc import Document
-	from webnotes.model import delete_doc
-
-	if patch_no == 301:
-		from patches.delivery_billing_status_patch import run_patch
-		run_patch()
-	elif patch_no == 302:
-		sql("update `tabDocField` set no_copy = 1 where fieldname = 'naming_series'")
-	elif patch_no == 303:
-		pass
-	elif patch_no == 304:
-		sql("delete from `tabDocField` where parent = 'company' and label = 'Trash Company' and fieldtype = 'button'")
-		reload_doc('setup', 'doctype', 'company')
-	elif patch_no == 305:
-		sql("update `tabDocField` set options = 'link:Company' where options='link:Company' and fieldname='company' and fieldtype='Select'")
-	elif patch_no == 306:
-		sql("update `tabDocField` set options = '\nAccount\nCompany\nCustomer\nSupplier\nEmployee\nWarehouse\nItem' where parent = 'Rename Tool' and fieldname = 'select_doctype'")
-		sql("update `tabDocField` set options = 'link:Item' where parent = 'Raw Materials Supplied' and fieldname = 'po_item'")
-		sql("update `tabDocField` set options = 'Sales Order' where parent = 'Indent Detail' and fieldname = 'sales_order_no'")
-		sql("update `tabDocField` set options = 'link:Company', fieldtype = 'Select' where parent = 'Stock Ledger Entry' and fieldname = 'company'")
-		reload_doc('utilities', 'doctype', 'rename_tool')
-	elif patch_no == 307:
-		sql("delete from `tabDocField` where parent = 'company' and label = 'Trash Company' and fieldtype = 'Button'")
-		reload_doc('setup', 'doctype', 'company')
-	elif patch_no == 308:
-		sql("update `tabDocField` set reqd = 0 where fieldname = 'select_item' and parent = 'Property Setter'")
-	elif patch_no == 309:
-		sql("delete from `tabDocField` where fieldname = 'item_attachments_details' and parent = 'Item'")
-		sql("delete from `tabModule Def Item` where parent = 'Stock' and doc_name = 'Landed Cost Wizard'")
-	elif patch_no == 310:
-		from erpnext_structure_cleanup import run_patches
-		run_patches()
-	elif patch_no == 311:
-		sql("update `tabDocField` set reqd = 0 where fieldname = 'select_item' and parent = 'Property Setter'")
-		#reload_doc('core', 'doctype', 'property_setter')
-	elif patch_no == 312:
-		sql("delete from `tabSessions`")
-		sql("delete from `__SessionCache`")
-	elif patch_no == 313:
-		dt = ['GL Entry', 'Stock Ledger Entry']
-		for t in dt:
-			rec = sql("select voucher_type, voucher_no, ifnull(is_cancelled, 'No') from `tab%s` where modified >= '2011-07-06 10:00:00' group by voucher_no" % t)
-			for d in rec:
-				sql("update `tab%s` set docstatus = %s where name = '%s'" % (d[0], d[2]=='No' and 1 or 2, d[1]))
-
-		other_dt = ['Enquiry', 'Quotation', 'Sales Order', 'Indent', 'Purchase Order', 'Production Order', 'Customer Issue', 'Installation Note']
-		for dt in other_dt:
-			rec = sql("select name, status from `tab%s` where modified >= '2011-07-06 10:00:00'" % dt)
-			for r in rec:
-				sql("update `tab%s` set docstatus = %s where name = '%s'" % (dt, (r[1] in ['Submitted', 'Closed'] and 1 or r[1]=='Cancelled' and 2 or 0), r[0]))
-
-
-		dt_list = ['Delivery Note', 'Purchase Receipt']
-		for dt in dt_list:
-			sql("update `tab%s` set status = 'Submitted' where docstatus = 1 and modified >='2011-07-06 10:00:00'" % dt)
-			sql("update `tab%s` set status = 'Cancelled' where docstatus = 2 and modified >='2011-07-06 10:00:00'" % dt)
-
-		dt_list = ['Enquiry', 'Quotation', 'Sales Order', 'Indent', 'Purchase Order', 'Production Order', 'Customer Issue', 'Installation Note', 'Receivable Voucher', 'Payable Voucher', 'Delivery Note', 'Purchase Receipt', 'Journal Voucher', 'Stock Entry']
-		for d in dt_list:
-			tbl = sql("select options from `tabDocField` where fieldtype = 'Table' and parent = '%s'" % d)
-			for t in tbl:
-				sql("update `tab%s` t1, `tab%s` t2 set t1.docstatus = t2.docstatus where t1.parent = t2.name" % (t[0], d))
-
-	elif patch_no == 314:
-		# delete double feed
-		sql("delete from tabFeed where subject like 'New %'")
-	elif patch_no == 315:
-		# delete double feed
-		sql("delete from tabFeed where doc_name like 'New %'")
-		reload_doc('core', 'doctype', 'property_setter')
-
-		from webnotes.model.doc import Document
-		m = Document('Module Def Role')
-		m.role = 'All'
-		m.parent = 'Home'
-		m.parenttype = 'Module Def'
-		m.parentfield = 'roles'
-		m.save(1)
-	elif patch_no == 316:
-		pass
-	elif patch_no == 317:
-		sql("update `tabPage` set name = 'profile-settings' where page_name = 'Profile Settings'")
-	elif patch_no == 318:
-		reload_doc('utilities', 'doctype', 'bulk_rename_tool')
-	elif patch_no == 319:
-		sql("delete from tabFeed where doc_name like 'New %'")
-	elif patch_no == 320:
-		reload_doc('setup', 'doctype', 'series_detail')
-	elif patch_no == 321:
-		reload_doc('hr','doctype','leave_application')
-	elif patch_no == 322:
-		sql("delete from `tabDocField` where parent = 'Leave Application' and fieldname = 'latter_head'")
-	elif patch_no == 323:
-		reload_doc('stock', 'doctype', 'stock_entry')
-		sql("update `tabDocField` set options = 'get_stock_and_rate' where parent = 'Stock Entry' and label = 'Get Stock and Rate'")
-		sql("delete from `tabDocField` where label = 'Get Current Stock' and parent = 'Stock Entry'")
-	elif patch_no == 324:
-		sql("delete from `tabDocField` where fieldname = 'test_field' and parent = 'Customer'")
-	elif patch_no == 325:
-		sql("update `tabDocField` set fieldtype = 'Data' where parent = 'Salary Slip' and fieldname = 'total_days_in_month'")
-		reload_doc('hr', 'doctype', 'salary_slip')
-	elif patch_no == 326:
-		# load the new billing page
-		if cint(webnotes.conn.get_value('Control Panel',None,'sync_with_gateway')):
-			reload_doc('server_tools','page','billing')
-	elif patch_no == 327:
-		# patch for support email settings now moved to email settings
-		reload_doc('setup','doctype','email_settings')
-
-		# map fields from support to email settings
-		field_map = {
-			'support_email': 'email',
-			'support_host':'host',
-			'support_username': 'username',
-			'support_password': 'password',
-			'support_use_ssl': 'use_ssl',
-			'sync_support_mails': 'integrate_incoming',
-			'signature': 'support_signature'
-		}
-
-		for key in field_map:
-			webnotes.conn.set_value('Email Settings',None,key, \
-				webnotes.conn.get_value('Support Email Settings',None,field_map[key]))
-
-		# delete support email settings
-		delete_doc('DocType', 'Support Email Settings')
-
-		reload_doc('support','doctype','support_ticket')
-		sql("delete from tabDocField where fieldname='problem_description' and parent='Support Ticket'")
-	elif patch_no == 328:
-		if webnotes.conn.get_value('Control Panel', None, 'account_id') != 'axjanak2011':
-			sql("delete from `tabDocField` where fieldname = 'supplier_status' and parent = 'Supplier'")
-	elif patch_no == 329:
-		reload_doc('utilities', 'doctype', 'rename_tool')
-		reload_doc('utilities', 'doctype', 'bulk_rename_tool')
-	elif patch_no == 330:
-		reload_doc('accounts', 'doctype', 'lease_agreement')
-		reload_doc('accounts', 'doctype', 'lease_installment')
-
-		reload_doc('accounts', 'search_criteria', 'lease_agreement_list')
-		reload_doc('accounts', 'search_criteria', 'lease_monthly_future_installment_inflows')
-		reload_doc('accounts', 'search_criteria', 'lease_overdue_age_wise')
-		reload_doc('accounts', 'search_criteria', 'lease_over_due_list')
-		reload_doc('accounts', 'search_criteria', 'lease_receipts_client_wise')
-		reload_doc('accounts', 'search_criteria', 'lease_receipt_summary_year_to_date')
-		reload_doc('accounts', 'search_criteria', 'lease_yearly_future_installment_inflows')
-
-		reload_doc('accounts', 'Module Def', 'Accounts')
-	elif patch_no == 331:
-		p = get_obj('Patch Util')
-		# permission
-		p.add_permission('Lease Agreement', 'Accounts Manager', 0, read = 1, write=1,submit=1, cancel=1,amend=1)
-		p.add_permission('Lease Agreement', 'Accounts Manager', 1, read = 1)
-	elif patch_no == 332:
-		sql("update `tabDocField` set permlevel=1, hidden = 1 where parent = 'Bulk Rename Tool' and fieldname = 'file_list'")
-	elif patch_no == 333:
-		sql("update `tabDocPerm` set `create`  =1 where role = 'Accounts Manager' and parent = 'Lease Agreement'")
-
-		p = get_obj('Patch Util')
-		p.add_permission('DocType Mapper', 'System Manager', 0, read = 1, write=1, create=1)
-		p.add_permission('Role', 'System Manager', 0, read = 1, write=1, create=1)
-		p.add_permission('Print Format', 'System Manager', 0, read = 1, write=1, create=1)
-	elif patch_no == 334:
-		reload_doc('knowledge_base', 'doctype', 'answer')
-	elif patch_no == 335:
-		for dt in ['Account', 'Cost Center', 'Territory', 'Item Group', 'Customer Group']:
-			sql("update `tabDocField` set fieldtype = 'Link', options = %s where fieldname = 'old_parent' and parent = %s", (dt, dt))
-	elif patch_no == 336:
-		reload_doc('server_tools','page','billing')
-	elif patch_no == 337:
-		item_list = webnotes.conn.sql("""SELECT name, description_html
-									FROM tabItem""")
-		if item_list:
-			for item, html in item_list:
-				if html and "getfile" in html and "acx" in html:
-					ac_id = webnotes.conn.sql("""SELECT value FROM `tabSingles` WHERE doctype='Control Panel' AND field='account_id'""")
-					sp_acx = html.split("acx=")
-					l_acx = len(sp_acx)
-					if l_acx > 1:
-						for i in range(l_acx-1):
-							sp_quot = sp_acx[i+1].split('"')
-							if len(sp_quot) > 1: sp_quot[0] = str(ac_id[0][0])
-							sp_acx[i+1] = '"'.join(sp_quot)
-					html = "acx=".join(sp_acx)
-					webnotes.conn.sql("""UPDATE tabItem SET description_html=%s WHERE name=%s""", (html, item))
-	elif patch_no == 338:
-		# Patch for billing status based on amount
-		# reload so and dn
-		reload_doc('selling','doctype','sales_order')
-		reload_doc('stock','doctype','delivery_note')
-
-		# delete billed_qty field
-		sql("delete from `tabDocField` where fieldname = 'billed_qty' and parent in ('Sales Order Detail', 'Delivery Note Detail')")
-
-		# update billed amt in item table in so and dn
-		sql("""	update `tabSales Order Detail` so
-				set billed_amt = (select sum(amount) from `tabRV Detail` where `so_detail`= so.name and docstatus=1 and parent not like 'old%%'), modified = now()""")
-
-		sql(""" update `tabDelivery Note Detail` dn
-				set billed_amt = (select sum(amount) from `tabRV Detail` where `dn_detail`= dn.name and docstatus=1 and parent not like 'old%%'), modified = now()""")
-
-		# calculate % billed based on item table
-		sql("""	update `tabSales Order` so
-				set per_billed = (select sum(if(amount > ifnull(billed_amt, 0), billed_amt, amount))/sum(amount)*100 from `tabSales Order Detail` where parent = so.name), modified = now()""")
-
-		sql("""	update `tabDelivery Note` dn
-				set per_billed = (select sum(if(amount > ifnull(billed_amt, 0), billed_amt, amount))/sum(amount)*100 from `tabDelivery Note Detail` where parent = dn.name), modified = now()""")
-
-		# update billing status based on % billed
-		sql("""update `tabSales Order` set billing_status = if(ifnull(per_billed,0) < 0.001, 'Not Billed',
-				if(per_billed >= 99.99, 'Fully Billed', 'Partly Billed'))""")
-		sql("""update `tabDelivery Note` set billing_status = if(ifnull(per_billed,0) < 0.001, 'Not Billed',
-				if(per_billed >= 99.99, 'Fully Billed', 'Partly Billed'))""")
-
-		# update name of questions page
-		sql("update tabPage set name='questions' where name='Questions'")
-		sql("update tabPage set name='question-view' where name='Question View'")
-	elif patch_no == 339:
-		reload_doc('production','doctype','bill_of_materials')
-	elif patch_no == 340:
-		sql("update `tabDocField` set permlevel = 0 where (fieldname in ('process', 'production_order', 'fg_completed_qty') or label = 'Get Items') and parent = 'Stock Entry'")
-	elif patch_no == 341:
-		reload_doc('stock','doctype','delivery_note')
-		reload_doc('stock','doctype','item')
-		reload_doc('selling','doctype','quotation')
-		reload_doc('stock','Print Format','Delivery Note Packing List Wise')
-
-		if not sql("select format from `tabDocFormat` where name = 'Delivery Note Packing List Wise' and parent = 'Delivery Note'"):
-			from webnotes.model.doc import addchild
-			dt_obj = get_obj('DocType', 'Delivery Note', with_children = 1)
-			ch = addchild(dt_obj.doc, 'formats', 'DocFormat', 1)
-			ch.format = 'Delivery Note Packing List Wise'
-			ch.save(1)
-	elif patch_no == 342:
-		sql("update `tabDocField` set permlevel = 0 where parent = 'Stock Entry Detail' and fieldname in ('s_warehouse', 't_warehouse', 'fg_item')")
-	elif patch_no == 343:
-		reload_doc('stock','doctype','item_customer_detail')
-	elif patch_no == 344:
-		sql("delete from `tabDocFormat` where ifnull(format, '') = '' and parent = 'Delivery Note'")
-		reload_doc('stock', 'doctype', 'delivery_note_detail')
-		reload_doc('stock', 'doctype', 'item_customer_detail')
-	elif patch_no == 345:
-		# rerun 343 (merge confict)
-		reload_doc('stock','doctype','item_customer_detail')
-		sql("delete from `tabModule Def Item` where display_name = 'Salary Slip Control Panel' and parent = 'HR'")
-		reload_doc('hr','Module Def','HR')
-	elif patch_no == 346:
-		pass
-	elif patch_no == 347:
-		sql("delete from `tabField Mapper Detail` where from_field = to_field and map = 'Yes' and ifnull(checking_operator, '') = ''")
-	elif patch_no == 348:
-		sql("update `tabStock Ledger Entry` set is_cancelled = 'No' where voucher_type = 'Serial No'")
-	elif patch_no == 349:
-		delete_doc('Custom Script', 'Update Series-Server')
-		delete_doc('Custom Script', 'Profile-Client')
-		delete_doc('Custom Script', 'Event-Client')
-		delete_doc('Custom Script', 'File-Server')
-
-		# reload profile with new fields for security
-		delete_doc('DocType', 'Profile')
-		reload_doc('core', 'doctype', 'profile')
-	elif patch_no == 350:
-		reload_doc('stock', 'doctype', 'delivery_note_detail')
-		reload_doc('stock', 'doctype', 'item_customer_detail')
-	elif patch_no == 351:
-		reload_doc('home', 'page', 'dashboard')
-	elif patch_no == 352:
-		reload_doc('stock','doctype','delivery_note')
-		reload_doc('stock','doctype','item')
-		reload_doc('selling','doctype','quotation')
-		reload_doc('stock','Print Format','Delivery Note Packing List Wise')
-
-		if not sql("select format from `tabDocFormat` where name = 'Delivery Note Packing List Wise' and parent = 'Delivery Note'"):
-			from webnotes.model.doc import addchild
-			dt_obj = get_obj('DocType', 'Delivery Note', with_children = 1)
-			ch = addchild(dt_obj.doc, 'formats', 'DocFormat', 1)
-			ch.format = 'Delivery Note Packing List Wise'
-			ch.save(1)
-	elif patch_no == 353:
-		reload_doc('core', 'doctype', 'doctype')
-		sql("update `tabDocType` set default_print_format = 'Standard' where name = 'Delivery Note'")
-	elif patch_no == 354:
-		reload_doc('stock', 'doctype', 'delivery_note')
-		reload_doc('stock', 'doctype', 'delivery_note_detail')
-	elif patch_no == 355:
-		sql("update `tabDocField` set print_hide =1 where fieldname in ('pack_no', 'pack_gross_wt', 'weight_uom', 'pack_nett_wt') and parent = 'Delivery Note Detail'")
-	elif patch_no == 356:
-		sql("update `tabDocField` set print_hide =1 where fieldname = 'print_packing_slip' and parent = 'Delivery Note'")
-	elif patch_no == 357:
-		reload_doc('hr', 'doctype', 'salary_manager')
-	elif patch_no == 358:
-		reload_doc('setup', 'doctype','features_setup')
-		reload_doc('stock','doctype','item')
-		sql("update tabDocField set label='Produced Qty',description='Updated after finished goods are transferred to FG Warehouse through Stock Entry' where parent='Production Order' and fieldname='produced_qty'")
-		rs = sql("select fieldname from tabDocField where parent='Features Setup' and fieldname is not null")
-		from webnotes.model.doc import Document
-		m = Document('Features Setup')
-		for d in rs:
-			m.fields[d[0]] = 1
-		m.save()
-	elif patch_no == 359:
-		reload_doc('hr', 'doctype', 'salary_slip')
-		delete_doc('DocType', 'Salary Control Panel')
-	elif patch_no == 360:
-		sql("delete from `tabDocField` where (fieldname in ('client_string', 'server_code_error', 'server_code_compiled', 'server_code', 'server_code_core', 'client_script', 'client_script_core', 'dt_template', 'change_log') or label = 'Template') and parent = 'DocType'")
-	elif patch_no == 361:
-		sql("update `tabModule Def Item` set doc_name = 'GL Entry' where display_name in ('Lease Agreement List', 'Lease Monthly Future Installment Inflows', 'Lease Overdue Age Wise', 'Lease Overdue List', 'Lease Receipts Client Wise', 'Lease Receipt Summary Month Wise', 'Lease Yearly Future Installment Inflows') and parent = 'Accounts'")
-	elif patch_no == 362:
-		sql("update `tabDocField` set no_copy = 1 where fieldname in ('amended_from', 'amendment_date', 'file_list', 'naming_series', 'status')")
-	elif patch_no == 363:
-		reload_doc('accounts', 'search_criteria', 'voucher_wise_tax_details')
-		reload_doc('accounts', 'Module Def', 'Accounts')
-		mappers = sql("select name, module from `tabDocType Mapper`")
-		for d in mappers:
-			if d[0] and d[1]:
-				reload_doc(d[1].lower(), 'DocType Mapper', d[0])
-	elif patch_no == 364:
-		sql("""delete from `tabField Mapper Detail` 
-			where to_field in ('qty', 'amount', 'export_amount') 
-			and parent in ('Sales Order-Receivable Voucher', 'Delivery Note-Receivable Voucher')
-		""")
-		mappers = sql("select name, module from `tabDocType Mapper`")
-		for d in mappers:
-			if d[0] and d[1]:
-				reload_doc(d[1].lower(), 'DocType Mapper', d[0])
-	elif patch_no == 365:
-		from patches.delivery_billing_status_patch import run_patch
-		run_patch()
-	elif patch_no == 367:
-		bin = sql("select name from tabBin")
-		for b in bin:
-			bobj = get_obj('Bin',b[0])
-			bobj.update_entries_after(posting_date = '2011-09-01', posting_time = '01:00')
-	elif patch_no == 368:
-		from webnotes.utils import nestedset
-		t = [
-			['Account', 'parent_account'], ['Cost Center', 'parent_cost_center'], 
-			['Item Group', 'parent_item_group'], ['Territory', 'parent_territory'],
-			['Customer Group', 'parent_customer_group'], ['Sales Person', 'parent_sales_person']
-		]
-		for d in t:
-			nestedset.rebuild_tree(d[0], d[1])
-	elif patch_no == 369:
-		reload_doc('hr', 'doctype', 'appraisal')
-		reload_doc('hr', 'doctype', 'appraisal_detail')
-	elif patch_no == 370:
-		sql("update `tabDocField` set `hidden` = 0 where fieldname = 'group_or_ledger' and parent = 'Cost Center'")
-	elif patch_no == 371:
-		from webnotes.modules.module_manager import reload_doc
-
-		reload_doc('setup', 'doctype','features_setup')
-		flds = ['page_break', 'projects', 'packing_details', 'discounts', 'brands', 'item_batch_nos', 'after_sales_installations', 'item_searial_nos', 'item_group_in_details', 'exports', 'imports', 'item_advanced', 'sales_extras', 'more_info', 'quality', 'manufacturing', 'pos', 'item_serial_nos']
-
-		for f in flds:
-			val = sql("select value from tabSingles where field = '%s' and doctype = 'Features Setup'" % f)
-			val = val and val[0][0] or 0
-			sql("update `tabSingles` set `value` = %s where `field` = '%s' and doctype = 'Features Setup'" % (val, '__'+f))
-
-		st = "'"+"', '".join(flds)+"'"
-		sql("delete from `tabDocField` where fieldname in (%s) and parent = 'Features Setup'" % st)
-		sql("delete from `tabDefaultValue` where defkey in (%s) and parent = 'Control Panel'" % st)
-
-		get_obj('Features Setup', 'Features Setup').doc.save()
-	elif patch_no == 372:
-		from webnotes.modules.module_manager import reload_doc
-
-		reload_doc('setup', 'doctype','features_setup')
-		flds = ['page_break', 'projects', 'packing_details', 'discounts', 'brands', 'item_batch_nos', 'after_sales_installations', 'item_searial_nos', 'item_group_in_details', 'exports', 'imports', 'item_advanced', 'sales_extras', 'more_info', 'quality', 'manufacturing', 'pos', 'item_serial_nos']
-
-		for f in flds:
-			val = sql("select value from tabSingles where field = '%s' and doctype = 'Features Setup'" % f)
-			val = val and val[0][0] or 0
-			sql("update `tabSingles` set `value` = %s where `field` = '%s' and doctype = 'Features Setup'" % (val, 'fs_'+f))
-
-		st = "'__"+"', '__".join(flds)+"'"
-		
-		sql("delete from `tabDocField` where fieldname in (%s) and parent = 'Features Setup'" % st)
-		sql("delete from `tabDefaultValue` where defkey in (%s) and parent = 'Control Panel'" % st)
-
-		get_obj('Features Setup', 'Features Setup').doc.save()
-	elif patch_no == 373:
-		sql("delete from `tabDocField` where fieldname = 'item_searial_nos' and parent = 'Features Setup'")
-		sql("delete from `tabDefaultValue` where defkey = 'item_searial_nos' and parent = 'Control Panel'")
-	elif patch_no == 374:
-		rs = sql("select fieldname from tabDocField where parent='Features Setup' and fieldname is not null")
-		from webnotes.model.code import get_obj
-		m = get_obj('Features Setup')
-		for d in rs:
-			m.doc.fields[d[0]] = 1
-		m.doc.save()
-		m.validate()
-	elif patch_no == 375:
-		from webnotes.session_cache import clear_cache
-		clear_cache(webnotes.session['user'])
-	elif patch_no == 376:
-		reload_doc('stock', 'DocType Mapper', 'Purchase Order-Purchase Receipt')
-	elif patch_no == 377:
-		flds = ['page_break', 'projects', 'packing_details', 'discounts', 'brands', 'item_batch_nos', 'after_sales_installations', 'item_searial_nos', 'item_group_in_details', 'exports', 'imports', 'item_advanced', 'sales_extras', 'more_info', 'quality', 'manufacturing', 'pos', 'item_serial_nos']
-		
-		st = "'"+"', '".join(flds)+"'"
-		sql("delete from `tabDocField` where fieldname in (%s) and parent = 'Features Setup'" % st)
-		sql("delete from `tabDefaultValue` where defkey in (%s) and parent = 'Control Panel'" % st)
-		
-		from webnotes.session_cache import clear_cache
-		clear_cache(webnotes.session['user'])
-	elif patch_no == 378:
-		comp = sql("select name from tabCompany where docstatus!=2")
-		fy = sql("select name from `tabFiscal Year` order by year_start_date asc")
-		for c in comp:
-			prev_fy = ''
-			for f in fy:
-				fy_obj = get_obj('Fiscal Year', f[0])
-				fy_obj.doc.past_year = prev_fy
-				fy_obj.doc.company = c[0]
-				fy_obj.doc.save()
-				fy_obj.repost()
-				prev_fy = f[0]
-				sql("commit")
-				sql("start transaction")
-	elif patch_no == 379:
-		sql("update tabDocPerm set amend = 0 where parent = 'Salary Structure'")
-		sql("update tabDocPerm set cancel = 1 where parent = 'Company' and role = 'System Manager'")
-	elif patch_no == 380:
-		if sql("select count(name) from `tabDocField` where label = 'View Ledger Entry' and parent = 'Journal Voucher' and fieldtype = 'Button'")[0][0] > 1:
-			sql("delete from `tabDocField` where label = 'View Ledger Entry' and parent = 'Journal Voucher' and fieldtype = 'Button' limit 1")
-		if sql("select count(name) from `tabDocField` where label = 'Get Balance' and parent = 'Journal Voucher' and fieldtype = 'Button'")[0][0] > 1:
-			sql("delete from `tabDocField` where label = 'Get Balance' and parent = 'Journal Voucher' and fieldtype = 'Button' limit 1")
-	elif patch_no == 381:
-		reload_doc('accounts', 'doctype', 'internal_reconciliation')
-		reload_doc('accounts', 'doctype', 'ir_payment_detail')
-		reload_doc('accounts', 'Module Def', 'Accounts')
-	elif patch_no == 382:
-		if sql("select count(name) from `tabDocField` where label = 'Get Specification Details' and parent = 'QA Inspection Report' and fieldtype = 'Button'")[0][0] > 1:
-			sql("delete from `tabDocField` where label = 'Get Specification Details' and parent = 'QA Inspection Report' and fieldtype = 'Button' limit 1")
-	elif patch_no == 383:
-		reload_doc('accounts', 'doctype', 'cost_center')
-	elif patch_no == 384:
-		reload_doc('stock', 'Module Def', 'Stock')
-		sql("delete from `tabModule Def Item` where display_name = 'Serial No' and parent = 'Support'")
-		sql("update `tabDocType` set subject = 'Item Code: %(item_code)s, Warehouse: %(warehouse)s' where name = 'Serial No'")
-	elif patch_no == 385:
-		# Patch for adding packing related columns (packed by, checked by, shipping mark etc)
-		reload_doc('stock','doctype','delivery_note')
-	elif patch_no == 386:
-		sql("update `tabDocField` set allow_on_submit = 1 where fieldname = 'page_break'")
-	elif patch_no == 387:
-		sql("update `tabDocField` set allow_on_submit = 1 where fieldname in ('indent_details', 'po_details', 'purchase_receipt_details', 'entries', 'sales_order_details', 'delivery_note_details', 'quotation_details') and fieldtype = 'Table'")
-	elif patch_no == 388:
-		pass
diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py
index cd38480..f134ed2 100644
--- a/erpnext/patches/patch_list.py
+++ b/erpnext/patches/patch_list.py
@@ -28,7 +28,7 @@
 	{
 		'patch_module': 'patches.jan_mar_2012',
 		'patch_file': 'rename_doctype_indent',
-		'description': 'Add DocType Label: Indent to Purchase Requisition'
+		'description': 'Add DocType Label: Purchase Request to Purchase Requisition'
 	},
 	{
 		'patch_module': 'patches.jan_mar_2012',
@@ -208,6 +208,11 @@
 		'description': 'Purpose SE: Others to Other' 
 	},
 	{
+		'patch_module': 'patches.mar_2012',
+		'patch_file': 'pos_invoice_fix',
+		'description': 'Reload POS Invoice' 
+	},
+	{
 		'patch_module': 'patches.jan_mar_2012',
 		'patch_file': 'reload_mapper',
 		'description': 'SO-DN, SO-Rv, DN-RV'
@@ -223,9 +228,48 @@
 		'description': 'SO-RV duplicate mapper entry removal'
 	},
 	{
+		'patch_module': 'patches.jan_mar_2012',
+		'patch_file': 'sync_ref_db',
+		'description': 'Deletes non required doctypes'
+	},
+	{
+		'patch_module': 'patches.mar_2012',
+		'patch_file': 'clean_property_setter',
+		'description': 'Patch related to property setter cleanup' 
+	},
+	{
+		'patch_module': 'patches.jan_mar_2012',
+		'patch_file': 'rename_dt',
+		'description': 'Rename DocType Patch'
+	},
+	{
+		'patch_module': 'patches.mar_2012',
+		'patch_file': 'cleanup_control_panel',
+		'description': 'Remove email related fields from Control Panel' 
+	},
+	{
+		'patch_module': 'patches.mar_2012',
+		'patch_file': 'doctype_get_refactor',
+		'description': 'Patch related to doctype get refactoring' 
+	},
+	{
+		'patch_module': 'patches.mar_2012',
+		'patch_file': 'delete_docformat',
+		'description': 'Deletes DocFormat from database' 
+	},
+	{
+		'patch_module': 'patches.mar_2012',
+		'patch_file': 'usertags',
+		'description': 'Adds _user_tags columns to tables' 
+	},
+	{
 		'patch_module': 'patches.april_2012',
 		'patch_file': 'reload_c_form',
 		'description': 'Added attchemnt option and total field'
 	},
-
+	{
+		'patch_module': 'patches.april_2012',
+		'patch_file': 'naming_series_patch',
+		'description': 'Move naming series options into property setter'
+	},
 ]
diff --git a/erpnext/patches/print_formats/DeliveryNoteClassic.html b/erpnext/patches/print_formats/DeliveryNoteClassic.html
deleted file mode 100644
index 65d30e6..0000000
--- a/erpnext/patches/print_formats/DeliveryNoteClassic.html
+++ /dev/null
@@ -1,291 +0,0 @@
-<!--
-	Sample Print Format for ERPNext
-	Please use at your own discretion
-	For suggestions and contributions:
-		https://github.com/webnotes/erpnext-print-templates
-
-	Freely usable under MIT license
--->
-
-<!-- Style Settings -->
-<style>
-	/*
-		common style for whole page
-		This should include:
-		+ page size related settings
-		+ font family settings
-		+ line spacing settings
-	*/
-	@media screen {
-		body {
-			width: 8.3in;
-		}
-	}
-
-	html, body, div, span, td {
-		font-family: "Georgia", serif;
-		font-size: 12px;
-	}
-
-	body {
-		padding: 10px;
-		margin: auto;
-		font-size: 12px;
-		line-height: 150%;
-	}
-
-	.common {
-		font-family: "Georgia", serif !important;
-		font-size: 12px;
-		padding: 10px 0px;
-	}
-
-	table {
-		border-collapse: collapse;
-		width: 100%;
-		vertical-align: top;
-	}
-
-	table td {
-		padding: 2px 0px;
-	}
-	
-	table h1, h2, h3, h4, h5, h6 {
-		padding: 0px;
-		margin: 0px;
-	}
-
-	table.header-table td {
-		vertical-align: top;
-	}
-
-	table.header-table thead {
-		border-bottom: 1px solid black;
-	}
-
-	table.header-table h3 {
-		color: gray;
-	}
-
-	table.header-table thead td {
-		padding: 5px 0px;
-	}
-
-	div.page-body table td:nth-child(6),
-	div.page-body table td:nth-child(7) {
-		text-align: right;
-	}
-
-	table.footer-table td {
-		vertical-align: top;
-	}
-
-	table.footer-table td table td:nth-child(2),
-	table.footer-table td table td:nth-child(3) {
-		text-align: right;
-	}
-</style>
-
-
-<!-- Javascript -->
-<script>
-	si_std = {
-		print_item_table: function() {
-			var table = print_table(
-				'Delivery Note',
-				doc.name,
-				'delivery_note_details',
-				'Delivery Note Detail',
-				[// Here specify the table columns to be displayed
-					'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',
-					'basic_rate', 'amount'
-				],
-				[// Here specify the labels of column headings
-					'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',
-					'UoM', 'Basic Rate', 'Amount'
-				],
-				[// Here specify the column widths
-					'3%', '10%', '15%', '32%', '5%',
-					'5%', '15%', '15%'
-				],
-				null,
-				null,
-				{
-					'description' : function(data_row) {
-						var to_append = ''
-						if(data_row.adj_rate){
-							to_append = '<div style="padding-left: 15px;"><i>Discount: ' + 
-								data_row.adj_rate + '% on ' + doc.currency + ' ' +
-								fmt_money(data_row.ref_rate) + '</i></div>';
-							if(data_row.description.indexOf(to_append)==-1) {
-								data_row.description = data_row.description + to_append;
-							}
-						}
-						
-						if(data_row.serial_no) {
-							to_append = '<div style="padding-left: 15px;"><i>Serial No.:' + 
-								((data_row.serial_no.indexOf('\n')>-1)?'<br />':'&nbsp;') + 
-								data_row.serial_no + '</i></div>';
-							if(data_row.description.indexOf(to_append)==-1) {
-								data_row.description = data_row.description + to_append;
-							}
-						}
-	
-						return data_row.description;
-					}
-				}
-			);
-
-			// This code takes care of page breaks
-			if(table.appendChild) {
-				out = table.innerHTML;
-			} else {
-				out = '';
-				for(var i=0; i < (table.length-1); i++) {
-					out += table[i].innerHTML + 
-						'<div style = "page-break-after: always;" \
-						class = "page_break"></div>\
-						<div class="page-settings"></div>';
-				}
-				out += table[table.length-1].innerHTML;
-			}
-			return out;
-		},
-
-
-		print_other_charges: function(parent) {
-			var oc = getchildren('RV Tax Detail', doc.name, 'other_charges');
-			var rows = '<table width=100%>\n';
-			for(var i=0; i<oc.length; i++) {
-				if(!oc[i].included_in_print_rate) {
-					rows +=
-						'<tr>\n' +
-							'\t<td>' + oc[i].description + '</td>\n' +
-							'\t<td></td>\n' +
-							'\t<td width=38%>' + fmt_money(oc[i].tax_amount) + '</td>\n' +
-						'</tr>\n';
-				}
-			}
-			return rows + '</table>\n';
-		}
-	};
-</script>
-
-
-<!-- Page Layout Settings -->
-<div class='common page-header'>
-	<!-- 
-		Page Header will contain
-			+ table 1
-				+ table 1a
-					- Name
-					- Address
-					- Contact
-					- Mobile No
-				+ table 1b
-					- Voucher Date
-					- Due Date
-	-->
-	<table class='header-table' cellspacing=0>
-		<thead>
-			<tr><td><script>'<h1>' + (doc.select_print_heading || 'Delivery Note') + '</h1>'</script></td></tr>
-			<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60%><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=22%><b>Name</b></td>
-						<td><script>doc.customer_name</script></td>
-					</tr>
-					<tr>
-						<td><b>Address</b></td>
-						<td><script>replace_newlines(doc.address_display)</script></td>
-					</tr>
-					<tr>
-						<td><b>Contact</b></td>
-						<td><script>doc.contact_display</script></td>
-					</tr>
-				</tbody></table></td>
-				<td><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=63%><b>Delivery Note Date</b></td>
-						<td><script>date.str_to_user(doc.transaction_date)</script></td>
-					<tr>					
-					<tr>
-						<td><b>Sales Order No.</b></td>
-						<td>
-							<script>doc.sales_order_no</script><br />
-							<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>
-						</td>
-					<tr>					
-				</tbody></table></td>
-			</tr>
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
-<div class='common page-body'>
-	<!-- 
-		Page Body will contain
-			+ table 2
-				- Sales Invoice Data
-	-->
-	<script>si_std.print_item_table()</script>
-</div>
-<div class='common page-footer'>
-	<!-- 
-		Page Footer will contain
-			+ table 3
-				- Terms and Conditions
-				- Total Rounded Amount Calculation
-				- Total Rounded Amount in Words
-	-->
-	<table class='footer-table' width=100% cellspacing=0>
-		<thead>
-			
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60% style='padding-right: 10px;'>
-					<b>Terms, Conditions &amp; Other Information:</b><br />
-					<script>doc.terms</script>
-				</td>
-				<td>
-					<table cellspacing=0 width=100%><tbody>
-						<tr>
-							<td>Net Total</td>
-							<td></td>
-							<td width=38%><script>
-								fmt_money(doc.net_total)
-							</script></td>
-						</tr>
-						<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>
-						<tr>
-							<td>Grand Total</td>
-							<td></td>
-							<td><script>
-								fmt_money(doc.grand_total_export)
-							</script></td>
-						</tr>
-						<tr style='font-weight: bold'>
-							<td>Rounded Total</td>
-							<td><script>doc.currency</script></td>
-							<td><script>
-								fmt_money(doc.rounded_total_export)
-							</script></td>
-						</tr>
-					</tbody></table>
-					<br /><b>In Words</b><br />
-					<i><script>doc.in_words_export</script></i>
-				</td>
-			</tr>		
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
-
diff --git a/erpnext/patches/print_formats/DeliveryNoteModern.html b/erpnext/patches/print_formats/DeliveryNoteModern.html
deleted file mode 100644
index 652358f..0000000
--- a/erpnext/patches/print_formats/DeliveryNoteModern.html
+++ /dev/null
@@ -1,317 +0,0 @@
-<!--
-	Sample Print Format for ERPNext
-	Please use at your own discretion
-	For suggestions and contributions:
-		https://github.com/webnotes/erpnext-print-templates
-
-	Freely usable under MIT license
--->
-
-<!-- Style Settings -->
-<style>
-	/*
-		common style for whole page
-		This should include:
-		+ page size related settings
-		+ font family settings
-		+ line spacing settings
-	*/
-	@media screen {
-		body {
-			width: 8.3in;
-		}
-	}
-
-	html, body, div, span, td {
-		font-family: "Helvetica", "Arial", sans-serif;
-		font-size: 12px;
-	}
-
-	body {
-		padding: 10px;
-		margin: auto;
-		font-size: 12px;
-		line-height: 150%;
-	}
-
-	.common {
-		font-family: "Helvetica", "Arial", sans-serif !important;
-		font-size: 12px;
-		padding: 10px 0px;
-	}
-
-	table {
-		border-collapse: collapse;
-		width: 100%;
-		vertical-align: top;
-		border-style: none !important;
-	}
-
-	table td {
-		padding: 2px 0px;
-		border-style: none !important;
-	}
-	
-	table h1, h2, h3, h4, h5, h6 {
-		padding: 0px;
-		margin: 0px;
-	}
-
-	table.header-table td {
-		vertical-align: top;
-	}
-
-	table.header-table h1 {
-		text-transform: uppercase;
-		color: white;
-		font-size: 55px;
-		font-style: italic;
-	}
-
-	table.header-table thead tr:nth-child(1) div {
-		height: 24px;
-		background-color: #696969;
-		vertical-align: middle;
-		padding: 12px 0px 0px 0px;
-		width: 100%;
-	}
-
-	div.page-body table td:nth-child(6),
-	div.page-body table td:nth-child(7) {
-		text-align: right;
-	}
-
-	div.page-body table tr td {
-		background-color: #DCDCDC !important;
-	}
-
-	div.page-body table tr:nth-child(1) td {
-		background-color: #696969 !important;
-		color: white !important;
-	}
-
-	table.footer-table td {
-		vertical-align: top;
-	}
-
-	table.footer-table td table td:nth-child(2),
-	table.footer-table td table td:nth-child(3) {
-		text-align: right;
-	}
-
-	table.footer-table tfoot td {
-		background-color: #696969;
-		height: 10px;
-	}
-
-	.imp-details {
-		background-color: #DCDCDC;
-	}
-</style>
-
-
-<!-- Javascript -->
-<script>
-	si_std = {
-		print_item_table: function() {
-			var table = print_table(
-				'Delivery Note',
-				doc.name,
-				'delivery_note_details',
-				'Delivery Note Detail',
-				[// Here specify the table columns to be displayed
-					'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',
-					'basic_rate', 'amount'
-				],
-				[// Here specify the labels of column headings
-					'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',
-					'UoM', 'Basic Rate', 'Amount'
-				],
-				[// Here specify the column widths
-					'3%', '10%', '15%', '32%', '5%',
-					'5%', '15%', '15%'
-				],
-				null,
-				null,
-				{
-					'description' : function(data_row) {
-						var to_append = ''
-						if(data_row.adj_rate){
-							to_append = '<div style="padding-left: 15px;"><i>Discount: ' + 
-								data_row.adj_rate + '% on ' + doc.currency + ' ' +
-								fmt_money(data_row.ref_rate) + '</i></div>';
-							if(data_row.description.indexOf(to_append)==-1) {
-								data_row.description = data_row.description + to_append;
-							}
-						}
-						
-						if(data_row.serial_no) {
-							to_append = '<div style="padding-left: 15px;"><i>Serial No.:' + 
-								((data_row.serial_no.indexOf('\n')>-1)?'<br />':'&nbsp;') + 
-								data_row.serial_no + '</i></div>';
-							if(data_row.description.indexOf(to_append)==-1) {
-								data_row.description = data_row.description + to_append;
-							}
-						}
-	
-						return data_row.description;
-					}
-				}
-			);
-
-			// This code takes care of page breaks
-			if(table.appendChild) {
-				out = table.innerHTML;
-			} else {
-				out = '';
-				for(var i=0; i < (table.length-1); i++) {
-					out += table[i].innerHTML + 
-						'<div style = "page-break-after: always;" \
-						class = "page_break"></div>\
-						<div class="page-settings"></div>';
-				}
-				out += table[table.length-1].innerHTML;
-			}
-			return out;
-		},
-
-
-		print_other_charges: function(parent) {
-			var oc = getchildren('RV Tax Detail', doc.name, 'other_charges');
-			var rows = '<table width=100%>\n';
-			for(var i=0; i<oc.length; i++) {
-				if(!oc[i].included_in_print_rate) {
-					rows +=
-						'<tr>\n' +
-							'\t<td>' + oc[i].description + '</td>\n' +
-							'\t<td></td>\n' +
-							'\t<td width=38%>' + fmt_money(oc[i].tax_amount) + '</td>\n' +
-						'</tr>\n';
-				}
-			}
-			return rows + '</table>\n';
-		}
-	};
-</script>
-
-
-<!-- Page Layout Settings -->
-<div class='common page-header'>
-	<!-- 
-		Page Header will contain
-			+ table 1
-				+ table 1a
-					- Name
-					- Address
-					- Contact
-					- Mobile No
-				+ table 1b
-					- Voucher Date
-					- Due Date
-	-->
-	<table class='header-table' cellspacing=0>
-		<thead>
-			<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Delivery Note') + '</h1>'</script></div></td></tr>
-			<tr><td colspan=2><div style="height:15px"></div></td></tr>
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60%><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=22%><b>Name</b></td>
-						<td><script>doc.customer_name</script></td>
-					</tr>
-					<tr>
-						<td><b>Address</b></td>
-						<td><script>replace_newlines(doc.address_display)</script></td>
-					</tr>
-					<tr>
-						<td><b>Contact</b></td>
-						<td><script>doc.contact_display</script></td>
-					</tr>
-				</tbody></table></td>
-				<td><table width=100% cellspacing=0><tbody>
-					<tr class='imp-details'>
-						<td><b>Delivery Note No.</b></td>
-						<td><script>cur_frm.docname</script></td>
-					</tr>
-					<tr>
-						<td width=63%><b>Delivery Note Date</b></td>
-						<td><script>date.str_to_user(doc.transaction_date)</script></td>
-					<tr>					
-					<tr>
-						<td><b>Sales Order No.</b></td>
-						<td>
-							<script>doc.sales_order_no</script><br />
-							<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>
-						</td>
-					<tr>					
-				</tbody></table></td>
-			</tr>
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
-<div class='common page-body'>
-	<!-- 
-		Page Body will contain
-			+ table 2
-				- Sales Invoice Data
-	-->
-	<script>si_std.print_item_table()</script>
-</div>
-<div class='common page-footer'>
-	<!-- 
-		Page Footer will contain
-			+ table 3
-				- Terms and Conditions
-				- Total Rounded Amount Calculation
-				- Total Rounded Amount in Words
-	-->
-	<table class='footer-table' width=100% cellspacing=0>
-		<thead>
-			
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60% style='padding-right: 10px;'>
-					<b>Terms, Conditions &amp; Other Information:</b><br />
-					<script>doc.terms</script>
-				</td>
-				<td>
-					<table cellspacing=0 width=100%><tbody>
-						<tr>
-							<td>Net Total</td>
-							<td></td>
-							<td width=38%><script>
-								fmt_money(doc.net_total)
-							</script></td>
-						</tr>
-						<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>
-						<tr>
-							<td>Grand Total</td>
-							<td></td>
-							<td><script>
-								fmt_money(doc.grand_total_export)
-							</script></td>
-						</tr>
-						<tr style='font-weight: bold' class='imp-details'>
-							<td>Rounded Total</td>
-							<td><script>doc.currency</script></td>
-							<td><script>
-								fmt_money(doc.rounded_total_export)
-							</script></td>
-						</tr>
-					</tbody></table>
-					<br /><b>In Words</b><br />
-					<i><script>doc.in_words_export</script></i>
-				</td>
-			</tr>		
-		</tbody>
-		<tfoot>
-			<tr><td colspan=2><div></div></td><tr>
-		</tfoot>
-	</table>
-</div>
diff --git a/erpnext/patches/print_formats/DeliveryNoteSpartan.html b/erpnext/patches/print_formats/DeliveryNoteSpartan.html
deleted file mode 100644
index 978183d..0000000
--- a/erpnext/patches/print_formats/DeliveryNoteSpartan.html
+++ /dev/null
@@ -1,312 +0,0 @@
-<!--
-	Sample Print Format for ERPNext
-	Please use at your own discretion
-	For suggestions and contributions:
-		https://github.com/webnotes/erpnext-print-templates
-
-	Freely usable under MIT license
--->
-
-<!-- Style Settings -->
-<style>
-	/*
-		common style for whole page
-		This should include:
-		+ page size related settings
-		+ font family settings
-		+ line spacing settings
-	*/
-	@media screen {
-		body {
-			width: 8.3in;
-		}
-	}
-
-	html, body, div, span, td {
-		font-family: "Arial", sans-serif;
-		font-size: 12px;
-	}
-
-	body {
-		padding: 10px;
-		margin: auto;
-		font-size: 12px;
-		line-height: 150%;
-	}
-
-	.common {
-		font-family: "Arial", sans-serif !important;
-		font-size: 12px;
-		padding: 0px;
-	}
-
-	table {
-		width: 100% !important;
-		vertical-align: top;
-	}
-
-	table td {
-		padding: 2px 0px;
-	}
-
-	table, td {
-		border-collapse: collapse !important;
-		padding: 0px;
-		margin: 0px !important;
-	}
-	
-	table h1, h2, h3, h4, h5, h6 {
-		padding: 0px;
-		margin: 0px;
-	}
-
-	table.header-table td {
-		vertical-align: top;
-	}
-
-	table.header-table h3 {
-		color: gray;
-	}
-
-	table.header-table thead td {
-		padding: 5px;
-	}
-
-	table.header-table > thead,
-	table.header-table > tbody > tr > td,
-	table.footer-table > tbody > tr > td {
-		border: 1px solid black;
-		padding: 5px;
-	}
-
-	table.footer-table > tbody,
-	table.header-table > thead {
-		border-bottom: 3px solid black;
-	}
-
-	table.header-table > thead {
-		border-top: 3px solid black;
-	}
-
-	div.page-body table td:nth-child(6),
-	div.page-body table td:nth-child(7) {
-		text-align: right;
-	}
-
-	div.page-body td {
-		background-color: white !important;
-		border: 1px solid black !important;
-	}
-
-	table.footer-table td {
-		vertical-align: top;
-	}
-
-	table.footer-table td table td:nth-child(2),
-	table.footer-table td table td:nth-child(3) {
-		text-align: right;
-	}
-</style>
-
-
-<!-- Javascript -->
-<script>
-	si_std = {
-		print_item_table: function() {
-			var table = print_table(
-				'Delivery Note',
-				doc.name,
-				'delivery_note_details',
-				'Delivery Note Detail',
-				[// Here specify the table columns to be displayed
-					'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',
-					'basic_rate', 'amount'
-				],
-				[// Here specify the labels of column headings
-					'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',
-					'UoM', 'Basic Rate', 'Amount'
-				],
-				[// Here specify the column widths
-					'3%', '10%', '15%', '32%', '5%',
-					'5%', '15%', '15%'
-				],
-				null,
-				null,
-				{
-					'description' : function(data_row) {
-						var to_append = ''
-						if(data_row.adj_rate){
-							to_append = '<div style="padding-left: 15px;"><i>Discount: ' + 
-								data_row.adj_rate + '% on ' + doc.currency + ' ' +
-								fmt_money(data_row.ref_rate) + '</i></div>';
-							if(data_row.description.indexOf(to_append)==-1) {
-								data_row.description = data_row.description + to_append;
-							}
-						}
-						
-						if(data_row.serial_no) {
-							to_append = '<div style="padding-left: 15px;"><i>Serial No.:' + 
-								((data_row.serial_no.indexOf('\n')>-1)?'<br />':'&nbsp;') + 
-								data_row.serial_no + '</i></div>';
-							if(data_row.description.indexOf(to_append)==-1) {
-								data_row.description = data_row.description + to_append;
-							}
-						}
-	
-						return data_row.description;
-					}
-				}
-			);
-
-			// This code takes care of page breaks
-			if(table.appendChild) {
-				out = table.innerHTML;
-			} else {
-				out = '';
-				for(var i=0; i < (table.length-1); i++) {
-					out += table[i].innerHTML + 
-						'<div style = "page-break-after: always;" \
-						class = "page_break"></div>\
-						<div class="page-settings"></div>';
-				}
-				out += table[table.length-1].innerHTML;
-			}
-			return out;
-		},
-
-
-		print_other_charges: function(parent) {
-			var oc = getchildren('RV Tax Detail', doc.name, 'other_charges');
-			var rows = '<table width=100%>\n';
-			for(var i=0; i<oc.length; i++) {
-				if(!oc[i].included_in_print_rate) {
-					rows +=
-						'<tr>\n' +
-							'\t<td>' + oc[i].description + '</td>\n' +
-							'\t<td></td>\n' +
-							'\t<td width=38%>' + fmt_money(oc[i].tax_amount) + '</td>\n' +
-						'</tr>\n';
-				}
-			}
-			return rows + '</table>\n';
-		}
-	};
-</script>
-
-
-<!-- Page Layout Settings -->
-<div class='common page-header'>
-	<!-- 
-		Page Header will contain
-			+ table 1
-				+ table 1a
-					- Name
-					- Address
-					- Contact
-					- Mobile No
-				+ table 1b
-					- Voucher Date
-					- Due Date
-	-->
-	<table class='header-table' cellspacing=0>
-		<thead>
-			<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Delivery Note') + '</h1>'</script></td></tr>
-			<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60%><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=22%><b>Name</b></td>
-						<td><script>doc.customer_name</script></td>
-					</tr>
-					<tr>
-						<td><b>Address</b></td>
-						<td><script>replace_newlines(doc.address_display)</script></td>
-					</tr>
-					<tr>
-						<td><b>Contact</b></td>
-						<td><script>doc.contact_display</script></td>
-					</tr>
-				</tbody></table></td>
-				<td><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=63%><b>Delivery Note Date</b></td>
-						<td><script>date.str_to_user(doc.transaction_date)</script></td>
-					<tr>					
-					<tr>
-						<td><b>Sales Order No.</b></td>
-						<td>
-							<script>doc.sales_order_no</script><br />
-							<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>
-						</td>
-					<tr>					
-				</tbody></table></td>
-			</tr>
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
-<div class='common page-body'>
-	<!-- 
-		Page Body will contain
-			+ table 2
-				- Sales Invoice Data
-	-->
-	<script>si_std.print_item_table()</script>
-</div>
-<div class='common page-footer'>
-	<!-- 
-		Page Footer will contain
-			+ table 3
-				- Terms and Conditions
-				- Total Rounded Amount Calculation
-				- Total Rounded Amount in Words
-	-->
-	<table class='footer-table' width=100% cellspacing=0>
-		<thead>
-			
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60% style='padding-right: 10px;'>
-					<b>Terms, Conditions &amp; Other Information:</b><br />
-					<script>doc.terms</script>
-				</td>
-				<td>
-					<table cellspacing=0 width=100%><tbody>
-						<tr>
-							<td>Net Total</td>
-							<td></td>
-							<td width=38%><script>
-								fmt_money(doc.net_total)
-							</script></td>
-						</tr>
-						<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>
-						<tr>
-							<td>Grand Total</td>
-							<td></td>
-							<td><script>
-								fmt_money(doc.grand_total_export)
-							</script></td>
-						</tr>
-						<tr style='font-weight: bold'>
-							<td>Rounded Total</td>
-							<td><script>doc.currency</script></td>
-							<td><script>
-								fmt_money(doc.rounded_total_export)
-							</script></td>
-						</tr>
-					</tbody></table>
-					<br /><b>In Words</b><br />
-					<i><script>doc.in_words_export</script></i>
-				</td>
-			</tr>		
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
diff --git a/erpnext/patches/print_formats/PurchaseOrderClassic.html b/erpnext/patches/print_formats/PurchaseOrderClassic.html
deleted file mode 100644
index e9a9ff8..0000000
--- a/erpnext/patches/print_formats/PurchaseOrderClassic.html
+++ /dev/null
@@ -1,248 +0,0 @@
-<!--
-	Sample Print Format for ERPNext
-	Please use at your own discretion
-	For suggestions and contributions:
-		https://github.com/webnotes/erpnext-print-templates
-
-	Freely usable under MIT license
--->
-
-<!-- Style Settings -->
-<style>
-	/*
-		common style for whole page
-		This should include:
-		+ page size related settings
-		+ font family settings
-		+ line spacing settings
-	*/
-	@media screen {
-		body {
-			width: 8.3in;
-		}
-	}
-
-	html, body, div, span, td {
-		font-family: "Georgia", serif;
-		font-size: 12px;
-	}
-
-	body {
-		padding: 10px;
-		margin: auto;
-		font-size: 12px;
-		line-height: 150%;
-	}
-
-	.common {
-		font-family: "Georgia", serif !important;
-		font-size: 12px;
-		padding: 10px 0px;
-	}
-
-	table {
-		border-collapse: collapse;
-		width: 100%;
-		vertical-align: top;
-	}
-
-	table td {
-		padding: 2px 0px;
-	}
-	
-	table h1, h2, h3, h4, h5, h6 {
-		padding: 0px;
-		margin: 0px;
-	}
-
-	table.header-table td {
-		vertical-align: top;
-	}
-
-	table.header-table thead {
-		border-bottom: 1px solid black;
-	}
-
-	table.header-table h3 {
-		color: gray;
-	}
-
-	table.header-table thead td {
-		padding: 5px 0px;
-	}
-
-	div.page-body table td:nth-child(6),
-	div.page-body table td:nth-child(7) {
-		text-align: right;
-	}
-
-	table.footer-table td {
-		vertical-align: top;
-	}
-
-	table.footer-table td table td:nth-child(2),
-	table.footer-table td table td:nth-child(3) {
-		text-align: right;
-	}
-</style>
-
-
-<!-- Javascript -->
-<script>
-	si_std = {
-		print_item_table: function() {
-			var table = print_table(
-				'Purchase Order',
-				doc.name,
-				'po_details',
-				'PO Detail',
-				[// Here specify the table columns to be displayed
-					'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',
-					'import_rate', 'import_amount'
-				],
-				[// Here specify the labels of column headings
-					'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',
-					'UoM', 'Basic Rate', 'Amount'
-				],
-				[// Here specify the column widths
-					'3%', '10%', '15%', '32%', '5%',
-					'5%', '15%', '15%'
-				]
-			);
-
-			// This code takes care of page breaks
-			if(table.appendChild) {
-				out = table.innerHTML;
-			} else {
-				out = '';
-				for(var i=0; i < (table.length-1); i++) {
-					out += table[i].innerHTML + 
-						'<div style = "page-break-after: always;" \
-						class = "page_break"></div>\
-						<div class="page-settings"></div>';
-				}
-				out += table[table.length-1].innerHTML;
-			}
-			return out;
-		},
-
-
-		print_other_charges: function(parent) {
-			var oc = getchildren('Purchase Tax Detail', doc.name, 'purchase_tax_details');
-			var rows = '<table width=100%>\n';
-			for(var i=0; i<oc.length; i++) {
-				rows +=
-					'<tr>\n' +
-						'\t<td>' + oc[i].description + '</td>\n' +
-						'\t<td></td>\n' +
-						'\t<td width=38%>' + fmt_money(oc[i].tax_amount / (doc.conversion_rate || 1)) + '</td>\n' +
-					'</tr>\n';
-			}
-			return rows + '</table>\n';
-		}
-	};
-</script>
-
-
-<!-- Page Layout Settings -->
-<div class='common page-header'>
-	<!-- 
-		Page Header will contain
-			+ table 1
-				+ table 1a
-					- Name
-					- Address
-					- Contact
-					- Mobile No
-				+ table 1b
-					- Voucher Date
-					- Due Date
-	-->
-	<table class='header-table' cellspacing=0>
-		<thead>
-			<tr><td><script>'<h1>' + (doc.select_print_heading || 'Purchase Order') + '</h1>'</script></td></tr>
-			<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60%><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=22%><b>Name</b></td>
-						<td><script>doc.supplier_name</script></td>
-					</tr>
-					<tr>
-						<td><b>Address</b></td>
-						<td><script>replace_newlines(doc.address_display)</script></td>
-					</tr>
-					<tr>
-						<td><b>Contact</b></td>
-						<td><script>doc.contact_display</script></td>
-					</tr>
-				</tbody></table></td>
-				<td><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=63%><b>Purchase Order Date</b></td>
-						<td><script>date.str_to_user(doc.transaction_date)</script></td>
-					<tr>					
-				</tbody></table></td>
-			</tr>
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
-<div class='common page-body'>
-	<!-- 
-		Page Body will contain
-			+ table 2
-				- Sales Invoice Data
-	-->
-	<script>si_std.print_item_table()</script>
-</div>
-<div class='common page-footer'>
-	<!-- 
-		Page Footer will contain
-			+ table 3
-				- Terms and Conditions
-				- Total Rounded Amount Calculation
-				- Total Rounded Amount in Words
-	-->
-	<table class='footer-table' width=100% cellspacing=0>
-		<thead>
-			
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60% style='padding-right: 10px;'>
-					<b>Terms, Conditions &amp; Other Information:</b><br />
-					<script>doc.terms</script>
-				</td>
-				<td>
-					<table cellspacing=0 width=100%><tbody>
-						<tr>
-							<td>Net Total</td>
-							<td></td>
-							<td width=38%><script>
-								fmt_money(doc.net_total_import)
-							</script></td>
-						</tr>
-						<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>
-						<tr style='font-weight: bold'>
-							<td>Grand Total</td>
-							<td><script>doc.currency</script></td>
-							<td><script>
-								fmt_money(doc.grand_total_import)
-							</script></td>
-						</tr>
-					</tbody></table>
-					<br /><b>In Words</b><br />
-					<i><script>doc.in_words_import</script></i>
-				</td>
-			</tr>		
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
diff --git a/erpnext/patches/print_formats/PurchaseOrderModern.html b/erpnext/patches/print_formats/PurchaseOrderModern.html
deleted file mode 100644
index 73b607b..0000000
--- a/erpnext/patches/print_formats/PurchaseOrderModern.html
+++ /dev/null
@@ -1,275 +0,0 @@
-<!--
-	Sample Print Format for ERPNext
-	Please use at your own discretion
-	For suggestions and contributions:
-		https://github.com/webnotes/erpnext-print-templates
-
-	Freely usable under MIT license
--->
-
-<!-- Style Settings -->
-<style>
-	/*
-		common style for whole page
-		This should include:
-		+ page size related settings
-		+ font family settings
-		+ line spacing settings
-	*/
-	@media screen {
-		body {
-			width: 8.3in;
-		}
-	}
-
-	html, body, div, span, td {
-		font-family: "Helvetica", "Arial", sans-serif;
-		font-size: 12px;
-	}
-
-	body {
-		padding: 10px;
-		margin: auto;
-		font-size: 12px;
-		line-height: 150%;
-	}
-
-	.common {
-		font-family: "Helvetica", "Arial", sans-serif !important;
-		font-size: 12px;
-		padding: 10px 0px;
-	}
-
-	table {
-		border-collapse: collapse;
-		width: 100%;
-		vertical-align: top;
-		border-style: none !important;
-	}
-
-	table td {
-		padding: 2px 0px;
-		border-style: none !important;
-	}
-	
-	table h1, h2, h3, h4, h5, h6 {
-		padding: 0px;
-		margin: 0px;
-	}
-
-	table.header-table td {
-		vertical-align: top;
-	}
-
-	table.header-table h1 {
-		text-transform: uppercase;
-		color: white;
-		font-size: 55px;
-		font-style: italic;
-	}
-
-	table.header-table thead tr:nth-child(1) div {
-		height: 24px;
-		background-color: #696969;
-		vertical-align: middle;
-		padding: 12px 0px 0px 0px;
-		width: 100%;
-	}
-
-	div.page-body table td:nth-child(6),
-	div.page-body table td:nth-child(7) {
-		text-align: right;
-	}
-
-	div.page-body table tr td {
-		background-color: #DCDCDC !important;
-	}
-
-	div.page-body table tr:nth-child(1) td {
-		background-color: #696969 !important;
-		color: white !important;
-	}
-
-	table.footer-table td {
-		vertical-align: top;
-	}
-
-	table.footer-table td table td:nth-child(2),
-	table.footer-table td table td:nth-child(3) {
-		text-align: right;
-	}
-
-	table.footer-table tfoot td {
-		background-color: #696969;
-		height: 10px;
-	}
-
-	.imp-details {
-		background-color: #DCDCDC;
-	}
-</style>
-
-
-<!-- Javascript -->
-<script>
-	si_std = {
-		print_item_table: function() {
-			var table = print_table(
-				'Purchase Order',
-				doc.name,
-				'po_details',
-				'PO Detail',
-				[// Here specify the table columns to be displayed
-					'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',
-					'import_rate', 'import_amount'
-				],
-				[// Here specify the labels of column headings
-					'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',
-					'UoM', 'Basic Rate', 'Amount'
-				],
-				[// Here specify the column widths
-					'3%', '10%', '15%', '32%', '5%',
-					'5%', '15%', '15%'
-				]
-			);
-
-			// This code takes care of page breaks
-			if(table.appendChild) {
-				out = table.innerHTML;
-			} else {
-				out = '';
-				for(var i=0; i < (table.length-1); i++) {
-					out += table[i].innerHTML + 
-						'<div style = "page-break-after: always;" \
-						class = "page_break"></div>\
-						<div class="page-settings"></div>';
-				}
-				out += table[table.length-1].innerHTML;
-			}
-			return out;
-		},
-
-
-		print_other_charges: function(parent) {
-			var oc = getchildren('Purchase Tax Detail', doc.name, 'purchase_tax_details');
-			var rows = '<table width=100%>\n';
-			for(var i=0; i<oc.length; i++) {
-				rows +=
-					'<tr>\n' +
-						'\t<td>' + oc[i].description + '</td>\n' +
-						'\t<td></td>\n' +
-						'\t<td width=38%>' + fmt_money(oc[i].tax_amount / (doc.conversion_rate || 1)) + '</td>\n' +
-					'</tr>\n';
-			}
-			return rows + '</table>\n';
-		}
-	};
-</script>
-
-
-<!-- Page Layout Settings -->
-<div class='common page-header'>
-	<!-- 
-		Page Header will contain
-			+ table 1
-				+ table 1a
-					- Name
-					- Address
-					- Contact
-					- Mobile No
-				+ table 1b
-					- Voucher Date
-					- Due Date
-	-->
-	<table class='header-table' cellspacing=0>
-		<thead>
-			<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Purchase Order') + '</h1>'</script></div></td></tr>
-			<tr><td colspan=2><div style="height:15px"></div></td></tr>
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60%><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=22%><b>Name</b></td>
-						<td><script>doc.supplier_name</script></td>
-					</tr>
-					<tr>
-						<td><b>Address</b></td>
-						<td><script>replace_newlines(doc.address_display)</script></td>
-					</tr>
-					<tr>
-						<td><b>Contact</b></td>
-						<td><script>doc.contact_display</script></td>
-					</tr>
-				</tbody></table></td>
-				<td><table width=100% cellspacing=0><tbody>
-					<tr class='imp-details'>
-						<td><b>Purchase Order No.</b></td>
-						<td><script>cur_frm.docname</script></td>
-					</tr>
-					<tr>
-						<td width=63%><b>Purchase Order Date</b></td>
-						<td><script>date.str_to_user(doc.transaction_date)</script></td>
-					<tr>					
-				</tbody></table></td>
-			</tr>
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
-<div class='common page-body'>
-	<!-- 
-		Page Body will contain
-			+ table 2
-				- Sales Invoice Data
-	-->
-	<script>si_std.print_item_table()</script>
-</div>
-<div class='common page-footer'>
-	<!-- 
-		Page Footer will contain
-			+ table 3
-				- Terms and Conditions
-				- Total Rounded Amount Calculation
-				- Total Rounded Amount in Words
-	-->
-	<table class='footer-table' width=100% cellspacing=0>
-		<thead>
-			
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60% style='padding-right: 10px;'>
-					<b>Terms, Conditions &amp; Other Information:</b><br />
-					<script>doc.terms</script>
-				</td>
-				<td>
-					<table cellspacing=0 width=100%><tbody>
-						<tr>
-							<td>Net Total</td>
-							<td></td>
-							<td width=38%><script>
-								fmt_money(doc.net_total_import)
-							</script></td>
-						</tr>
-						<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>
-						<tr style='font-weight: bold' class='imp-details'>
-							<td>Grand Total</td>
-							<td><script>doc.currency</script></td>
-							<td><script>
-								fmt_money(doc.grand_total_import)
-							</script></td>
-						</tr>
-					</tbody></table>
-					<br /><b>In Words</b><br />
-					<i><script>doc.in_words_import</script></i>
-				</td>
-			</tr>		
-		</tbody>
-		<tfoot>
-			<tr><td colspan=2><div></div></td><tr>
-		</tfoot>
-	</table>
-</div>
diff --git a/erpnext/patches/print_formats/PurchaseOrderSpartan.html b/erpnext/patches/print_formats/PurchaseOrderSpartan.html
deleted file mode 100644
index 9058e0c..0000000
--- a/erpnext/patches/print_formats/PurchaseOrderSpartan.html
+++ /dev/null
@@ -1,270 +0,0 @@
-<!--
-	Sample Print Format for ERPNext
-	Please use at your own discretion
-	For suggestions and contributions:
-		https://github.com/webnotes/erpnext-print-templates
-
-	Freely usable under MIT license
--->
-
-<!-- Style Settings -->
-<style>
-	/*
-		common style for whole page
-		This should include:
-		+ page size related settings
-		+ font family settings
-		+ line spacing settings
-	*/
-	@media screen {
-		body {
-			width: 8.3in;
-		}
-	}
-
-	html, body, div, span, td {
-		font-family: "Arial", sans-serif;
-		font-size: 12px;
-	}
-
-	body {
-		padding: 10px;
-		margin: auto;
-		font-size: 12px;
-		line-height: 150%;
-	}
-
-	.common {
-		font-family: "Arial", sans-serif !important;
-		font-size: 12px;
-		padding: 0px;
-	}
-
-	table {
-		width: 100% !important;
-		vertical-align: top;
-	}
-
-	table td {
-		padding: 2px 0px;
-	}
-
-	table, td {
-		border-collapse: collapse !important;
-		padding: 0px;
-		margin: 0px !important;
-	}
-	
-	table h1, h2, h3, h4, h5, h6 {
-		padding: 0px;
-		margin: 0px;
-	}
-
-	table.header-table td {
-		vertical-align: top;
-	}
-
-	table.header-table h3 {
-		color: gray;
-	}
-
-	table.header-table thead td {
-		padding: 5px;
-	}
-
-	table.header-table > thead,
-	table.header-table > tbody > tr > td,
-	table.footer-table > tbody > tr > td {
-		border: 1px solid black;
-		padding: 5px;
-	}
-
-	table.footer-table > tbody,
-	table.header-table > thead {
-		border-bottom: 3px solid black;
-	}
-
-	table.header-table > thead {
-		border-top: 3px solid black;
-	}
-
-	div.page-body table td:nth-child(6),
-	div.page-body table td:nth-child(7) {
-		text-align: right;
-	}
-
-	div.page-body td {
-		background-color: white !important;
-		border: 1px solid black !important;
-	}
-
-	table.footer-table td {
-		vertical-align: top;
-	}
-
-	table.footer-table td table td:nth-child(2),
-	table.footer-table td table td:nth-child(3) {
-		text-align: right;
-	}
-</style>
-
-
-<!-- Javascript -->
-<script>
-	si_std = {
-		print_item_table: function() {
-			var table = print_table(
-				'Purchase Order',
-				doc.name,
-				'po_details',
-				'PO Detail',
-				[// Here specify the table columns to be displayed
-					'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',
-					'import_rate', 'import_amount'
-				],
-				[// Here specify the labels of column headings
-					'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',
-					'UoM', 'Basic Rate', 'Amount'
-				],
-				[// Here specify the column widths
-					'3%', '10%', '15%', '32%', '5%',
-					'5%', '15%', '15%'
-				]
-			);
-
-			// This code takes care of page breaks
-			if(table.appendChild) {
-				out = table.innerHTML;
-			} else {
-				out = '';
-				for(var i=0; i < (table.length-1); i++) {
-					out += table[i].innerHTML + 
-						'<div style = "page-break-after: always;" \
-						class = "page_break"></div>\
-						<div class="page-settings"></div>';
-				}
-				out += table[table.length-1].innerHTML;
-			}
-			return out;
-		},
-
-
-		print_other_charges: function(parent) {
-			var oc = getchildren('Purchase Tax Detail', doc.name, 'purchase_tax_details');
-			var rows = '<table width=100%>\n';
-			for(var i=0; i<oc.length; i++) {
-				rows +=
-					'<tr>\n' +
-						'\t<td>' + oc[i].description + '</td>\n' +
-						'\t<td></td>\n' +
-						'\t<td width=38%>' + fmt_money(oc[i].tax_amount / (doc.conversion_rate || 1)) + '</td>\n' +
-					'</tr>\n';
-			}
-			return rows + '</table>\n';
-		}
-	};
-</script>
-
-
-<!-- Page Layout Settings -->
-<div class='common page-header'>
-	<!-- 
-		Page Header will contain
-			+ table 1
-				+ table 1a
-					- Name
-					- Address
-					- Contact
-					- Mobile No
-				+ table 1b
-					- Voucher Date
-					- Due Date
-	-->
-	<table class='header-table' cellspacing=0>
-		<thead>
-			<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Purchase Order') + '</h1>'</script></td></tr>
-			<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60%><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=22%><b>Name</b></td>
-						<td><script>doc.supplier_name</script></td>
-					</tr>
-					<tr>
-						<td><b>Address</b></td>
-						<td><script>replace_newlines(doc.address_display)</script></td>
-					</tr>
-					<tr>
-						<td><b>Contact</b></td>
-						<td><script>doc.contact_display</script></td>
-					</tr>
-				</tbody></table></td>
-				<td><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=63%><b>Purchase Order Date</b></td>
-						<td><script>date.str_to_user(doc.transaction_date)</script></td>
-					<tr>					
-				</tbody></table></td>
-			</tr>
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
-<div class='common page-body'>
-	<!-- 
-		Page Body will contain
-			+ table 2
-				- Sales Invoice Data
-	-->
-	<script>si_std.print_item_table()</script>
-</div>
-<div class='common page-footer'>
-	<!-- 
-		Page Footer will contain
-			+ table 3
-				- Terms and Conditions
-				- Total Rounded Amount Calculation
-				- Total Rounded Amount in Words
-	-->
-	<table class='footer-table' width=100% cellspacing=0>
-		<thead>
-			
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60% style='padding-right: 10px;'>
-					<b>Terms, Conditions &amp; Other Information:</b><br />
-					<script>doc.terms</script>
-				</td>
-				<td>
-					<table cellspacing=0 width=100%><tbody>
-						<tr>
-							<td>Net Total</td>
-							<td></td>
-							<td width=38%><script>
-								fmt_money(doc.net_total_import)
-							</script></td>
-						</tr>
-						<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>
-						<tr style='font-weight: bold'>
-							<td>Grand Total</td>
-							<td><script>doc.currency</script></td>
-							<td><script>
-								fmt_money(doc.grand_total_import)
-							</script></td>
-						</tr>
-					</tbody></table>
-					<br /><b>In Words</b><br />
-					<i><script>doc.in_words_import</script></i>
-				</td>
-			</tr>		
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
diff --git a/erpnext/patches/print_formats/QuotationClassic.html b/erpnext/patches/print_formats/QuotationClassic.html
deleted file mode 100644
index ca69755..0000000
--- a/erpnext/patches/print_formats/QuotationClassic.html
+++ /dev/null
@@ -1,275 +0,0 @@
-<!--
-	Sample Print Format for ERPNext
-	Please use at your own discretion
-	For suggestions and contributions:
-		https://github.com/webnotes/erpnext-print-templates
-
-	Freely usable under MIT license
--->
-
-<!-- Style Settings -->
-<style>
-	/*
-		common style for whole page
-		This should include:
-		+ page size related settings
-		+ font family settings
-		+ line spacing settings
-	*/
-	@media screen {
-		body {
-			width: 8.3in;
-		}
-	}
-
-	html, body, div, span, td {
-		font-family: "Georgia", serif;
-		font-size: 12px;
-	}
-
-	body {
-		padding: 10px;
-		margin: auto;
-		font-size: 12px;
-		line-height: 150%;
-	}
-
-	.common {
-		font-family: "Georgia", serif !important;
-		font-size: 12px;
-		padding: 10px 0px;
-	}
-
-	table {
-		border-collapse: collapse;
-		width: 100%;
-		vertical-align: top;
-	}
-
-	table td {
-		padding: 2px 0px;
-	}
-	
-	table h1, h2, h3, h4, h5, h6 {
-		padding: 0px;
-		margin: 0px;
-	}
-
-	table.header-table td {
-		vertical-align: top;
-	}
-
-	table.header-table thead {
-		border-bottom: 1px solid black;
-	}
-
-	table.header-table h3 {
-		color: gray;
-	}
-
-	table.header-table thead td {
-		padding: 5px 0px;
-	}
-
-	div.page-body table td:nth-child(6),
-	div.page-body table td:nth-child(7) {
-		text-align: right;
-	}
-
-	table.footer-table td {
-		vertical-align: top;
-	}
-
-	table.footer-table td table td:nth-child(2),
-	table.footer-table td table td:nth-child(3) {
-		text-align: right;
-	}
-</style>
-
-
-<!-- Javascript -->
-<script>
-	si_std = {
-		print_item_table: function() {
-			var table = print_table(
-				'Quotation',
-				doc.name,
-				'quotation_details',
-				'Quotation Detail',
-				[// Here specify the table columns to be displayed
-					'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',
-					'export_rate', 'export_amount'
-				],
-				[// Here specify the labels of column headings
-					'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',
-					'UoM', 'Basic Rate', 'Amount'
-				],
-				[// Here specify the column widths
-					'3%', '10%', '15%', '32%', '5%',
-					'5%', '15%', '15%'
-				],
-				null,
-				null,
-				{
-					'description' : function(data_row) {
-						if(data_row.adj_rate) {
-							var to_append = '<div style="padding-left: 15px;"><i>Discount: ' + 
-								data_row.adj_rate + '% on ' + doc.currency + ' ' +
-								fmt_money(data_row.ref_rate) + '</i></div>';
-							if(data_row.description.indexOf(to_append)==-1) {
-								return data_row.description + to_append;
-							} else { return data_row.description; }
-						} else {
-							return data_row.description;
-						}
-					}
-				}
-			);
-
-			// This code takes care of page breaks
-			if(table.appendChild) {
-				out = table.innerHTML;
-			} else {
-				out = '';
-				for(var i=0; i < (table.length-1); i++) {
-					out += table[i].innerHTML + 
-						'<div style = "page-break-after: always;" \
-						class = "page_break"></div>\
-						<div class="page-settings"></div>';
-				}
-				out += table[table.length-1].innerHTML;
-			}
-			return out;
-		},
-
-
-		print_other_charges: function(parent) {
-			var oc = getchildren('RV Tax Detail', doc.name, 'other_charges');
-			var rows = '<table width=100%>\n';
-			for(var i=0; i<oc.length; i++) {
-				if(!oc[i].included_in_print_rate) {
-					rows +=
-						'<tr>\n' +
-							'\t<td>' + oc[i].description + '</td>\n' +
-							'\t<td></td>\n' +
-							'\t<td width=38%>' + fmt_money(oc[i].tax_amount) + '</td>\n' +
-						'</tr>\n';
-				}
-			}
-			return rows + '</table>\n';
-		}
-	};
-</script>
-
-
-<!-- Page Layout Settings -->
-<div class='common page-header'>
-	<!-- 
-		Page Header will contain
-			+ table 1
-				+ table 1a
-					- Name
-					- Address
-					- Contact
-					- Mobile No
-				+ table 1b
-					- Voucher Date
-					- Due Date
-	-->
-	<table class='header-table' cellspacing=0>
-		<thead>
-			<tr><td>
-					<script>'<h1>' + (doc.select_print_heading || 'Quotation') + '</h1>'</script>
-			</td></tr>
-			<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60%><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=39%><b>Name</b></td>
-						<td><script>doc.customer?doc.customer:doc.lead_name</script></td>
-					</tr>
-					<tr>
-						<td><b>Address</b></td>
-						<td><script>replace_newlines(doc.address_display)</script></td>
-					</tr>
-					<tr>
-						<td><b>Contact</b></td>
-						<td><script>doc.contact_display</script></td>
-					</tr>
-				</tbody></table></td>
-				<td><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=63%><b>Quotation Date</b></td>
-						<td><script>date.str_to_user(doc.transaction_date)</script></td>
-					<tr>					
-				</tbody></table></td>
-			</tr>
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
-<div class='common page-body'>
-	<!-- 
-		Page Body will contain
-			+ table 2
-				- Sales Invoice Data
-	-->
-	<script>si_std.print_item_table()</script>
-</div>
-<div class='common page-footer'>
-	<!-- 
-		Page Footer will contain
-			+ table 3
-				- Terms and Conditions
-				- Total Rounded Amount Calculation
-				- Total Rounded Amount in Words
-	-->
-	<table class='footer-table' width=100% cellspacing=0>
-		<thead>
-			
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60% style='padding-right: 10px;'>
-					<b>Terms, Conditions &amp; Other Information:</b><br />
-					<script>doc.terms</script>
-				</td>
-				<td>
-					<table cellspacing=0 width=100%><tbody>
-						<tr>
-							<td>Net Total</td>
-							<td></td>
-							<td width=38%><script>
-								fmt_money(doc.net_total/doc.conversion_rate)
-							</script></td>
-						</tr>
-						<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>
-						<tr>
-							<td>Grand Total</td>
-							<td></td>
-							<td><script>
-								fmt_money(doc.grand_total_export)
-							</script></td>
-						</tr>
-						<tr style='font-weight: bold'>
-							<td>Rounded Total</td>
-							<td><script>doc.currency</script></td>
-							<td><script>
-								fmt_money(doc.rounded_total_export)
-							</script></td>
-						</tr>
-					</tbody></table>
-					<br /><b>In Words</b><br />
-					<i><script>doc.in_words_export</script></i>
-				</td>
-			</tr>		
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
diff --git a/erpnext/patches/print_formats/QuotationModern.html b/erpnext/patches/print_formats/QuotationModern.html
deleted file mode 100644
index 7f7727a..0000000
--- a/erpnext/patches/print_formats/QuotationModern.html
+++ /dev/null
@@ -1,300 +0,0 @@
-<!--
-	Sample Print Format for ERPNext
-	Please use at your own discretion
-	For suggestions and contributions:
-		https://github.com/webnotes/erpnext-print-templates
-
-	Freely usable under MIT license
--->
-
-<!-- Style Settings -->
-<style>
-	/*
-		common style for whole page
-		This should include:
-		+ page size related settings
-		+ font family settings
-		+ line spacing settings
-	*/
-	@media screen {
-		body {
-			width: 8.3in;
-		}
-	}
-
-	html, body, div, span, td {
-		font-family: "Helvetica", "Arial", sans-serif;
-		font-size: 12px;
-	}
-
-	body {
-		padding: 10px;
-		margin: auto;
-		font-size: 12px;
-		line-height: 150%;
-	}
-
-	.common {
-		font-family: "Helvetica", "Arial", sans-serif !important;
-		font-size: 12px;
-		padding: 10px 0px;
-	}
-
-	table {
-		border-collapse: collapse;
-		width: 100%;
-		vertical-align: top;
-		border-style: none !important;
-	}
-
-	table td {
-		padding: 2px 0px;
-		border-style: none !important;
-	}
-	
-	table h1, h2, h3, h4, h5, h6 {
-		padding: 0px;
-		margin: 0px;
-	}
-
-	table.header-table td {
-		vertical-align: top;
-	}
-
-	table.header-table h1 {
-		text-transform: uppercase;
-		color: white;
-		font-size: 55px;
-		font-style: italic;
-	}
-
-	table.header-table thead tr:nth-child(1) div {
-		height: 24px;
-		background-color: #696969;
-		vertical-align: middle;
-		padding: 12px 0px 0px 0px;
-		width: 100%;
-	}
-
-	div.page-body table td:nth-child(6),
-	div.page-body table td:nth-child(7) {
-		text-align: right;
-	}
-
-	div.page-body table tr td {
-		background-color: #DCDCDC !important;
-	}
-
-	div.page-body table tr:nth-child(1) td {
-		background-color: #696969 !important;
-		color: white !important;
-	}
-
-	table.footer-table td {
-		vertical-align: top;
-	}
-
-	table.footer-table td table td:nth-child(2),
-	table.footer-table td table td:nth-child(3) {
-		text-align: right;
-	}
-
-	table.footer-table tfoot td {
-		background-color: #696969;
-		height: 10px;
-	}
-
-	.imp-details {
-		background-color: #DCDCDC;
-	}
-</style>
-
-
-<!-- Javascript -->
-<script>
-	si_std = {
-		print_item_table: function() {
-			var table = print_table(
-				'Quotation',
-				doc.name,
-				'quotation_details',
-				'Quotation Detail',
-				[// Here specify the table columns to be displayed
-					'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',
-					'export_rate', 'export_amount'
-				],
-				[// Here specify the labels of column headings
-					'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',
-					'UoM', 'Basic Rate', 'Amount'
-				],
-				[// Here specify the column widths
-					'3%', '10%', '15%', '32%', '5%',
-					'5%', '15%', '15%'
-				],
-				null,
-				null,
-				{
-					'description' : function(data_row) {
-						if(data_row.adj_rate) {
-							var to_append = '<div style="padding-left: 15px;"><i>Discount: ' + 
-								data_row.adj_rate + '% on ' + doc.currency + ' ' +
-								fmt_money(data_row.ref_rate) + '</i></div>';
-							if(data_row.description.indexOf(to_append)==-1) {
-								return data_row.description + to_append;
-							} else { return data_row.description; }
-						} else {
-							return data_row.description;
-						}
-					}
-				}
-			);
-
-			// This code takes care of page breaks
-			if(table.appendChild) {
-				out = table.innerHTML;
-			} else {
-				out = '';
-				for(var i=0; i < (table.length-1); i++) {
-					out += table[i].innerHTML + 
-						'<div style = "page-break-after: always;" \
-						class = "page_break"></div>\
-						<div class="page-settings"></div>';
-				}
-				out += table[table.length-1].innerHTML;
-			}
-			return out;
-		},
-
-
-		print_other_charges: function(parent) {
-			var oc = getchildren('RV Tax Detail', doc.name, 'other_charges');
-			var rows = '<table width=100%>\n';
-			for(var i=0; i<oc.length; i++) {
-				if(!oc[i].included_in_print_rate) {
-					rows +=
-						'<tr>\n' +
-							'\t<td>' + oc[i].description + '</td>\n' +
-							'\t<td></td>\n' +
-							'\t<td width=38%>' + fmt_money(oc[i].tax_amount) + '</td>\n' +
-						'</tr>\n';
-				}
-			}
-			return rows + '</table>\n';
-		}
-	};
-</script>
-
-
-<!-- Page Layout Settings -->
-<div class='common page-header'>
-	<!-- 
-		Page Header will contain
-			+ table 1
-				+ table 1a
-					- Name
-					- Address
-					- Contact
-					- Mobile No
-				+ table 1b
-					- Voucher Date
-					- Due Date
-	-->
-	<table class='header-table' cellspacing=0>
-		<thead>
-			<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Quotation') + '</h1>'</script></div></td></tr>
-			<tr><td colspan=2><div style="height:15px"></div></td></tr>
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60%><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=39%><b>Name</b></td>
-						<td><script>doc.customer?doc.customer:doc.lead_name</script></td>
-					</tr>
-					<tr>
-						<td><b>Address</b></td>
-						<td><script>replace_newlines(doc.address_display)</script></td>
-					</tr>
-					<tr>
-						<td><b>Contact</b></td>
-						<td><script>doc.contact_display</script></td>
-					</tr>
-				</tbody></table></td>
-				<td><table width=100% cellspacing=0><tbody>
-					<tr class='imp-details'>
-						<td><b>Quotation No.</b></td>
-						<td><script>cur_frm.docname</script></td>
-					</tr>
-					<tr>
-						<td width=63%><b>Quotation Date</b></td>
-						<td><script>date.str_to_user(doc.transaction_date)</script></td>
-					<tr>					
-				</tbody></table></td>
-			</tr>
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
-<div class='common page-body'>
-	<!-- 
-		Page Body will contain
-			+ table 2
-				- Sales Invoice Data
-	-->
-	<script>si_std.print_item_table()</script>
-</div>
-<div class='common page-footer'>
-	<!-- 
-		Page Footer will contain
-			+ table 3
-				- Terms and Conditions
-				- Total Rounded Amount Calculation
-				- Total Rounded Amount in Words
-	-->
-	<table class='footer-table' width=100% cellspacing=0>
-		<thead>
-			
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60% style='padding-right: 10px;'>
-					<b>Terms, Conditions &amp; Other Information:</b><br />
-					<script>doc.terms</script>
-				</td>
-				<td>
-					<table cellspacing=0 width=100%><tbody>
-						<tr>
-							<td>Net Total</td>
-							<td></td>
-							<td width=38%><script>
-								fmt_money(doc.net_total/doc.conversion_rate)
-							</script></td>
-						</tr>
-						<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>
-						<tr>
-							<td>Grand Total</td>
-							<td></td>
-							<td><script>
-								fmt_money(doc.grand_total_export)
-							</script></td>
-						</tr>
-						<tr style='font-weight: bold' class='imp-details'>
-							<td>Rounded Total</td>
-							<td><script>doc.currency</script></td>
-							<td><script>
-								fmt_money(doc.rounded_total_export)
-							</script></td>
-						</tr>
-					</tbody></table>
-					<br /><b>In Words</b><br />
-					<i><script>doc.in_words_export</script></i>
-				</td>
-			</tr>		
-		</tbody>
-		<tfoot>
-			<tr><td colspan=2><div></div></td><tr>
-		</tfoot>
-	</table>
-</div>
diff --git a/erpnext/patches/print_formats/QuotationSpartan.html b/erpnext/patches/print_formats/QuotationSpartan.html
deleted file mode 100644
index e082993..0000000
--- a/erpnext/patches/print_formats/QuotationSpartan.html
+++ /dev/null
@@ -1,295 +0,0 @@
-<!--
-	Sample Print Format for ERPNext
-	Please use at your own discretion
-	For suggestions and contributions:
-		https://github.com/webnotes/erpnext-print-templates
-
-	Freely usable under MIT license
--->
-
-<!-- Style Settings -->
-<style>
-	/*
-		common style for whole page
-		This should include:
-		+ page size related settings
-		+ font family settings
-		+ line spacing settings
-	*/
-	@media screen {
-		body {
-			width: 8.3in;
-		}
-	}
-
-	html, body, div, span, td {
-		font-family: "Arial", sans-serif;
-		font-size: 12px;
-	}
-
-	body {
-		padding: 10px;
-		margin: auto;
-		font-size: 12px;
-		line-height: 150%;
-	}
-
-	.common {
-		font-family: "Arial", sans-serif !important;
-		font-size: 12px;
-		padding: 0px;
-	}
-
-	table {
-		width: 100% !important;
-		vertical-align: top;
-	}
-
-	table td {
-		padding: 2px 0px;
-	}
-
-	table, td {
-		border-collapse: collapse !important;
-		padding: 0px;
-		margin: 0px !important;
-	}
-	
-	table h1, h2, h3, h4, h5, h6 {
-		padding: 0px;
-		margin: 0px;
-	}
-
-	table.header-table td {
-		vertical-align: top;
-	}
-
-	table.header-table h3 {
-		color: gray;
-	}
-
-	table.header-table thead td {
-		padding: 5px;
-	}
-
-	table.header-table > thead,
-	table.header-table > tbody > tr > td,
-	table.footer-table > tbody > tr > td {
-		border: 1px solid black;
-		padding: 5px;
-	}
-
-	table.footer-table > tbody,
-	table.header-table > thead {
-		border-bottom: 3px solid black;
-	}
-
-	table.header-table > thead {
-		border-top: 3px solid black;
-	}
-
-	div.page-body table td:nth-child(6),
-	div.page-body table td:nth-child(7) {
-		text-align: right;
-	}
-
-	div.page-body td {
-		background-color: white !important;
-		border: 1px solid black !important;
-	}
-
-	table.footer-table td {
-		vertical-align: top;
-	}
-
-	table.footer-table td table td:nth-child(2),
-	table.footer-table td table td:nth-child(3) {
-		text-align: right;
-	}
-</style>
-
-
-<!-- Javascript -->
-<script>
-	si_std = {
-		print_item_table: function() {
-			var table = print_table(
-				'Quotation',
-				doc.name,
-				'quotation_details',
-				'Quotation Detail',
-				[// Here specify the table columns to be displayed
-					'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',
-					'export_rate', 'export_amount'
-				],
-				[// Here specify the labels of column headings
-					'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',
-					'UoM', 'Basic Rate', 'Amount'
-				],
-				[// Here specify the column widths
-					'3%', '10%', '15%', '32%', '5%',
-					'5%', '15%', '15%'
-				],
-				null,
-				null,
-				{
-					'description' : function(data_row) {
-						if(data_row.adj_rate) {
-							var to_append = '<div style="padding-left: 15px;"><i>Discount: ' + 
-								data_row.adj_rate + '% on ' + doc.currency + ' ' +
-								fmt_money(data_row.ref_rate) + '</i></div>';
-							if(data_row.description.indexOf(to_append)==-1) {
-								return data_row.description + to_append;
-							} else { return data_row.description; }
-						} else {
-							return data_row.description;
-						}
-					}
-				}
-			);
-
-			// This code takes care of page breaks
-			if(table.appendChild) {
-				out = table.innerHTML;
-			} else {
-				out = '';
-				for(var i=0; i < (table.length-1); i++) {
-					out += table[i].innerHTML + 
-						'<div style = "page-break-after: always;" \
-						class = "page_break"></div>\
-						<div class="page-settings"></div>';
-				}
-				out += table[table.length-1].innerHTML;
-			}
-			return out;
-		},
-
-
-		print_other_charges: function(parent) {
-			var oc = getchildren('RV Tax Detail', doc.name, 'other_charges');
-			var rows = '<table width=100%>\n';
-			for(var i=0; i<oc.length; i++) {
-				if(!oc[i].included_in_print_rate) {
-					rows +=
-						'<tr>\n' +
-							'\t<td>' + oc[i].description + '</td>\n' +
-							'\t<td></td>\n' +
-							'\t<td width=38%>' + fmt_money(oc[i].tax_amount) + '</td>\n' +
-						'</tr>\n';
-				}
-			}
-			return rows + '</table>\n';
-		}
-	};
-</script>
-
-
-<!-- Page Layout Settings -->
-<div class='common page-header'>
-	<!-- 
-		Page Header will contain
-			+ table 1
-				+ table 1a
-					- Name
-					- Address
-					- Contact
-					- Mobile No
-				+ table 1b
-					- Voucher Date
-					- Due Date
-	-->
-	<table class='header-table' cellspacing=0>
-		<thead>
-			<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Quotation') + '</h1>'</script></td></tr>
-			<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60%><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=39%><b>Name</b></td>
-						<td><script>doc.customer?doc.customer:doc.lead_name</script></td>
-					</tr>
-					<tr>
-						<td><b>Address</b></td>
-						<td><script>replace_newlines(doc.address_display)</script></td>
-					</tr>
-					<tr>
-						<td><b>Contact</b></td>
-						<td><script>doc.contact_display</script></td>
-					</tr>
-				</tbody></table></td>
-				<td><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=63%><b>Quotation Date</b></td>
-						<td><script>date.str_to_user(doc.transaction_date)</script></td>
-					<tr>					
-				</tbody></table></td>
-			</tr>
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
-<div class='common page-body'>
-	<!-- 
-		Page Body will contain
-			+ table 2
-				- Sales Invoice Data
-	-->
-	<script>si_std.print_item_table()</script>
-</div>
-<div class='common page-footer'>
-	<!-- 
-		Page Footer will contain
-			+ table 3
-				- Terms and Conditions
-				- Total Rounded Amount Calculation
-				- Total Rounded Amount in Words
-	-->
-	<table class='footer-table' width=100% cellspacing=0>
-		<thead>
-			
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60% style='padding-right: 10px;'>
-					<b>Terms, Conditions &amp; Other Information:</b><br />
-					<script>doc.terms</script>
-				</td>
-				<td>
-					<table cellspacing=0 width=100%><tbody>
-						<tr>
-							<td>Net Total</td>
-							<td></td>
-							<td width=38%><script>
-								fmt_money(doc.net_total/doc.conversion_rate)
-							</script></td>
-						</tr>
-						<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>
-						<tr>
-							<td>Grand Total</td>
-							<td></td>
-							<td><script>
-								fmt_money(doc.grand_total_export)
-							</script></td>
-						</tr>
-						<tr style='font-weight: bold'>
-							<td>Rounded Total</td>
-							<td><script>doc.currency</script></td>
-							<td><script>
-								fmt_money(doc.rounded_total_export)
-							</script></td>
-						</tr>
-					</tbody></table>
-					<br /><b>In Words</b><br />
-					<i><script>doc.in_words_export</script></i>
-				</td>
-			</tr>		
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
diff --git a/erpnext/patches/print_formats/SalesInvoiceClassic.html b/erpnext/patches/print_formats/SalesInvoiceClassic.html
deleted file mode 100644
index d40f801..0000000
--- a/erpnext/patches/print_formats/SalesInvoiceClassic.html
+++ /dev/null
@@ -1,277 +0,0 @@
-<!--
-	Sample Print Format for ERPNext
-	Please use at your own discretion
-	For suggestions and contributions:
-		https://github.com/webnotes/erpnext-print-templates
-
-	Freely usable under MIT license
--->
-
-<!-- Style Settings -->
-<style>
-	/*
-		common style for whole page
-		This should include:
-		+ page size related settings
-		+ font family settings
-		+ line spacing settings
-	*/
-	@media screen {
-		body {
-			width: 8.3in;
-		}
-	}
-
-	html, body, div, span, td {
-		font-family: "Georgia", serif;
-		font-size: 12px;
-	}
-
-	body {
-		padding: 10px;
-		margin: auto;
-		font-size: 12px;
-		line-height: 150%;
-	}
-
-	.common {
-		font-family: "Georgia", serif !important;
-		font-size: 12px;
-		padding: 10px 0px;
-	}
-
-	table {
-		border-collapse: collapse;
-		width: 100%;
-		vertical-align: top;
-	}
-
-	table td {
-		padding: 2px 0px;
-	}
-	
-	table h1, h2, h3, h4, h5, h6 {
-		padding: 0px;
-		margin: 0px;
-	}
-
-	table.header-table td {
-		vertical-align: top;
-	}
-
-	table.header-table thead {
-		border-bottom: 1px solid black;
-	}
-
-	table.header-table h3 {
-		color: gray;
-	}
-
-	table.header-table thead td {
-		padding: 5px 0px;
-	}
-
-	div.page-body table td:nth-child(6),
-	div.page-body table td:nth-child(7) {
-		text-align: right;
-	}
-
-	table.footer-table td {
-		vertical-align: top;
-	}
-
-	table.footer-table td table td:nth-child(2),
-	table.footer-table td table td:nth-child(3) {
-		text-align: right;
-	}
-</style>
-
-
-<!-- Javascript -->
-<script>
-	si_std = {
-		print_item_table: function() {
-			var table = print_table(
-				'Receivable Voucher',
-				doc.name,
-				'entries',
-				'RV Detail',
-				[// Here specify the table columns to be displayed
-					'SR', 'item_name', 'description', 'qty', 'stock_uom',
-					'export_rate', 'export_amount'
-				],
-				[// Here specify the labels of column headings
-					'Sr', 'Item Name', 'Description', 'Qty',
-					'UoM', 'Basic Rate', 'Amount'
-				],
-				[// Here specify the column widths
-					'3%', '20%', '37%', '5%',
-					'5%', '15%', '15%'
-				],
-				null,
-				null,
-				{
-					'description' : function(data_row) {
-						if(data_row.adj_rate) {
-							var to_append = '<div style="padding-left: 15px;"><i>Discount: ' + 
-								data_row.adj_rate + '% on ' + doc.currency + ' ' +
-								fmt_money(data_row.ref_rate) + '</i></div>';
-							if(data_row.description.indexOf(to_append)==-1) {
-								return data_row.description + to_append;
-							} else { return data_row.description; }
-						} else {
-							return data_row.description;
-						}
-					}
-				}
-			);
-
-			// This code takes care of page breaks
-			if(table.appendChild) {
-				out = table.innerHTML;
-			} else {
-				out = '';
-				for(var i=0; i < (table.length-1); i++) {
-					out += table[i].innerHTML + 
-						'<div style = "page-break-after: always;" \
-						class = "page_break"></div>\
-						<div class="page-settings"></div>';
-				}
-				out += table[table.length-1].innerHTML;
-			}
-			return out;
-		},
-
-
-		print_other_charges: function(parent) {
-			var oc = getchildren('RV Tax Detail', doc.name, 'other_charges');
-			var rows = '<table width=100%>\n';
-			for(var i=0; i<oc.length; i++) {
-				if(!oc[i].included_in_print_rate) {
-					rows +=
-						'<tr>\n' +
-							'\t<td>' + oc[i].description + '</td>\n' +
-							'\t<td></td>\n' +
-							'\t<td width=38%>' + fmt_money(oc[i].tax_amount) + '</td>\n' +
-						'</tr>\n';
-				}
-			}
-			return rows + '</table>\n';
-		}
-	};
-</script>
-
-
-<!-- Page Layout Settings -->
-<div class='common page-header'>
-	<!-- 
-		Page Header will contain
-			+ table 1
-				+ table 1a
-					- Name
-					- Address
-					- Contact
-					- Mobile No
-				+ table 1b
-					- Voucher Date
-					- Due Date
-	-->
-	<table class='header-table' cellspacing=0>
-		<thead>
-			<tr><td><script>'<h1>' + (doc.select_print_heading || 'Invoice') + '</h1>'</script></td></tr>
-			<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60%><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=39%><b>Name</b></td>
-						<td><script>doc.customer_name</script></td>
-					</tr>
-					<tr>
-						<td><b>Address</b></td>
-						<td><script>replace_newlines(doc.address_display)</script></td>
-					</tr>
-					<tr>
-						<td><b>Contact</b></td>
-						<td><script>doc.contact_display</script></td>
-					</tr>
-				</tbody></table></td>
-				<td><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=40%><b>Invoice Date</b></td>
-						<td><script>date.str_to_user(doc.posting_date)</script></td>
-					<tr>					
-					<tr>
-						<td><b>Due Date</b></td>
-						<td><script>date.str_to_user(doc.due_date)</script></td>
-					<tr>					
-				</tbody></table></td>
-			</tr>
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
-<div class='common page-body'>
-	<!-- 
-		Page Body will contain
-			+ table 2
-				- Sales Invoice Data
-	-->
-	<script>si_std.print_item_table()</script>
-</div>
-<div class='common page-footer'>
-	<!-- 
-		Page Footer will contain
-			+ table 3
-				- Terms and Conditions
-				- Total Rounded Amount Calculation
-				- Total Rounded Amount in Words
-	-->
-	<table class='footer-table' width=100% cellspacing=0>
-		<thead>
-			
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60% style='padding-right: 10px;'>
-					<b>Terms, Conditions &amp; Other Information:</b><br />
-					<script>doc.terms</script>
-				</td>
-				<td>
-					<table cellspacing=0 width=100%><tbody>
-						<tr>
-							<td>Net Total</td>
-							<td></td>
-							<td width=38%><script>
-								fmt_money(doc.net_total/doc.conversion_rate)
-							</script></td>
-						</tr>
-						<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>
-						<tr>
-							<td>Grand Total</td>
-							<td></td>
-							<td><script>
-								fmt_money(doc.grand_total_export)
-							</script></td>
-						</tr>
-						<tr style='font-weight: bold'>
-							<td>Rounded Total</td>
-							<td><script>doc.currency</script></td>
-							<td><script>
-								fmt_money(doc.rounded_total_export)
-							</script></td>
-						</tr>
-					</tbody></table>
-					<br /><b>In Words</b><br />
-					<i><script>doc.in_words_export</script></i>
-				</td>
-			</tr>		
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
diff --git a/erpnext/patches/print_formats/SalesInvoiceModern.html b/erpnext/patches/print_formats/SalesInvoiceModern.html
deleted file mode 100644
index ac66423..0000000
--- a/erpnext/patches/print_formats/SalesInvoiceModern.html
+++ /dev/null
@@ -1,304 +0,0 @@
-<!--
-	Sample Print Format for ERPNext
-	Please use at your own discretion
-	For suggestions and contributions:
-		https://github.com/webnotes/erpnext-print-templates
-
-	Freely usable under MIT license
--->
-
-<!-- Style Settings -->
-<style>
-	/*
-		common style for whole page
-		This should include:
-		+ page size related settings
-		+ font family settings
-		+ line spacing settings
-	*/
-	@media screen {
-		body {
-			width: 8.3in;
-		}
-	}
-
-	html, body, div, span, td {
-		font-family: "Helvetica", "Arial", sans-serif;
-		font-size: 12px;
-	}
-
-	body {
-		padding: 10px;
-		margin: auto;
-		font-size: 12px;
-		line-height: 150%;
-	}
-
-	.common {
-		font-family: "Helvetica", "Arial", sans-serif !important;
-		font-size: 12px;
-		padding: 10px 0px;
-	}
-
-	table {
-		border-collapse: collapse;
-		width: 100%;
-		vertical-align: top;
-		border-style: none !important;
-	}
-
-	table td {
-		padding: 2px 0px;
-		border-style: none !important;
-	}
-	
-	table h1, h2, h3, h4, h5, h6 {
-		padding: 0px;
-		margin: 0px;
-	}
-
-	table.header-table td {
-		vertical-align: top;
-	}
-
-	table.header-table h1 {
-		text-transform: uppercase;
-		color: white;
-		font-size: 55px;
-		font-style: italic;
-	}
-
-	table.header-table thead tr:nth-child(1) div {
-		height: 24px;
-		background-color: #696969;
-		vertical-align: middle;
-		padding: 12px 0px 0px 0px;
-		width: 100%;
-	}
-
-	div.page-body table td:nth-child(6),
-	div.page-body table td:nth-child(7) {
-		text-align: right;
-	}
-
-	div.page-body table tr td {
-		background-color: #DCDCDC !important;
-	}
-
-	div.page-body table tr:nth-child(1) td {
-		background-color: #696969 !important;
-		color: white !important;
-	}
-
-	table.footer-table td {
-		vertical-align: top;
-	}
-
-	table.footer-table td table td:nth-child(2),
-	table.footer-table td table td:nth-child(3) {
-		text-align: right;
-	}
-
-	table.footer-table tfoot td {
-		background-color: #696969;
-		height: 10px;
-	}
-
-	.imp-details {
-		background-color: #DCDCDC;
-	}
-</style>
-
-
-<!-- Javascript -->
-<script>
-	si_std = {
-		print_item_table: function() {
-			var table = print_table(
-				'Receivable Voucher',
-				doc.name,
-				'entries',
-				'RV Detail',
-				[// Here specify the table columns to be displayed
-					'SR', 'item_name', 'description', 'qty', 'stock_uom',
-					'export_rate', 'export_amount'
-				],
-				[// Here specify the labels of column headings
-					'Sr', 'Item Name', 'Description', 'Qty',
-					'UoM', 'Basic Rate', 'Amount'
-				],
-				[// Here specify the column widths
-					'3%', '20%', '37%', '5%',
-					'5%', '15%', '15%'
-				],
-				null,
-				null,
-				{
-					'description' : function(data_row) {
-						if(data_row.adj_rate) {
-							var to_append = '<div style="padding-left: 15px;"><i>Discount: ' + 
-								data_row.adj_rate + '% on ' + doc.currency + ' ' +
-								fmt_money(data_row.ref_rate) + '</i></div>';
-							if(data_row.description.indexOf(to_append)==-1) {
-								return data_row.description + to_append;
-							} else { return data_row.description; }
-						} else {
-							return data_row.description;
-						}
-					}
-				}
-			);
-
-			// This code takes care of page breaks
-			if(table.appendChild) {
-				out = table.innerHTML;
-			} else {
-				out = '';
-				for(var i=0; i < (table.length-1); i++) {
-					out += table[i].innerHTML + 
-						'<div style = "page-break-after: always;" \
-						class = "page_break"></div>\
-						<div class="page-settings"></div>';
-				}
-				out += table[table.length-1].innerHTML;
-			}
-			return out;
-		},
-
-
-		print_other_charges: function(parent) {
-			var oc = getchildren('RV Tax Detail', doc.name, 'other_charges');
-			var rows = '<table width=100%>\n';
-			for(var i=0; i<oc.length; i++) {
-				if(!oc[i].included_in_print_rate) {
-					rows +=
-						'<tr>\n' +
-							'\t<td>' + oc[i].description + '</td>\n' +
-							'\t<td></td>\n' +
-							'\t<td width=38%>' + fmt_money(oc[i].tax_amount) + '</td>\n' +
-						'</tr>\n';
-				}
-			}
-			return rows + '</table>\n';
-		}
-	};
-</script>
-
-
-<!-- Page Layout Settings -->
-<div class='common page-header'>
-	<!-- 
-		Page Header will contain
-			+ table 1
-				+ table 1a
-					- Name
-					- Address
-					- Contact
-					- Mobile No
-				+ table 1b
-					- Voucher Date
-					- Due Date
-	-->
-	<table class='header-table' cellspacing=0>
-		<thead>
-			<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Invoice') + '</h1>'</script></div></td></tr>
-			<tr><td colspan=2><div style="height:15px"></div></td></tr>
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60%><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=39%><b>Name</b></td>
-						<td><script>doc.customer_name</script></td>
-					</tr>
-					<tr>
-						<td><b>Address</b></td>
-						<td><script>replace_newlines(doc.address_display)</script></td>
-					</tr>
-					<tr>
-						<td><b>Contact</b></td>
-						<td><script>doc.contact_display</script></td>
-					</tr>
-				</tbody></table></td>
-				<td><table width=100% cellspacing=0><tbody>
-					<tr class='imp-details'>
-						<td><b>Invoice No.</b></td>
-						<td><script>cur_frm.docname</script></td>
-					</tr>
-					<tr>
-						<td width=40%><b>Invoice Date</b></td>
-						<td><script>date.str_to_user(doc.posting_date)</script></td>
-					<tr>					
-					<tr>
-						<td><b>Due Date</b></td>
-						<td><script>date.str_to_user(doc.due_date)</script></td>
-					<tr>					
-				</tbody></table></td>
-			</tr>
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
-<div class='common page-body'>
-	<!-- 
-		Page Body will contain
-			+ table 2
-				- Sales Invoice Data
-	-->
-	<script>si_std.print_item_table()</script>
-</div>
-<div class='common page-footer'>
-	<!-- 
-		Page Footer will contain
-			+ table 3
-				- Terms and Conditions
-				- Total Rounded Amount Calculation
-				- Total Rounded Amount in Words
-	-->
-	<table class='footer-table' width=100% cellspacing=0>
-		<thead>
-			
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60% style='padding-right: 10px;'>
-					<b>Terms, Conditions &amp; Other Information:</b><br />
-					<script>doc.terms</script>
-				</td>
-				<td>
-					<table cellspacing=0 width=100%><tbody>
-						<tr>
-							<td>Net Total</td>
-							<td></td>
-							<td width=38%><script>
-								fmt_money(doc.net_total/doc.conversion_rate)
-							</script></td>
-						</tr>
-						<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>
-						<tr>
-							<td>Grand Total</td>
-							<td></td>
-							<td><script>
-								fmt_money(doc.grand_total_export)
-							</script></td>
-						</tr>
-						<tr style='font-weight: bold' class='imp-details'>
-							<td>Rounded Total</td>
-							<td><script>doc.currency</script></td>
-							<td><script>
-								fmt_money(doc.rounded_total_export)
-							</script></td>
-						</tr>
-					</tbody></table>
-					<br /><b>In Words</b><br />
-					<i><script>doc.in_words_export</script></i>
-				</td>
-			</tr>		
-		</tbody>
-		<tfoot>
-			<tr><td colspan=2><div></div></td><tr>
-		</tfoot>
-	</table>
-</div>
diff --git a/erpnext/patches/print_formats/SalesInvoiceSpartan.html b/erpnext/patches/print_formats/SalesInvoiceSpartan.html
deleted file mode 100644
index 81e1c38..0000000
--- a/erpnext/patches/print_formats/SalesInvoiceSpartan.html
+++ /dev/null
@@ -1,299 +0,0 @@
-<!--
-	Sample Print Format for ERPNext
-	Please use at your own discretion
-	For suggestions and contributions:
-		https://github.com/webnotes/erpnext-print-templates
-
-	Freely usable under MIT license
--->
-
-<!-- Style Settings -->
-<style>
-	/*
-		common style for whole page
-		This should include:
-		+ page size related settings
-		+ font family settings
-		+ line spacing settings
-	*/
-	@media screen {
-		body {
-			width: 8.3in;
-		}
-	}
-
-	html, body, div, span, td {
-		font-family: "Arial", sans-serif;
-		font-size: 12px;
-	}
-
-	body {
-		padding: 10px;
-		margin: auto;
-		font-size: 12px;
-		line-height: 150%;
-	}
-
-	.common {
-		font-family: "Arial", sans-serif !important;
-		font-size: 12px;
-		padding: 0px;
-	}
-
-	table {
-		width: 100% !important;
-		vertical-align: top;
-	}
-
-	table td {
-		padding: 2px 0px;
-	}
-
-	table, td {
-		border-collapse: collapse !important;
-		padding: 0px;
-		margin: 0px !important;
-	}
-	
-	table h1, h2, h3, h4, h5, h6 {
-		padding: 0px;
-		margin: 0px;
-	}
-
-	table.header-table td {
-		vertical-align: top;
-	}
-
-	table.header-table h3 {
-		color: gray;
-	}
-
-	table.header-table thead td {
-		padding: 5px;
-	}
-
-	table.header-table > thead,
-	table.header-table > tbody > tr > td,
-	table.footer-table > tbody > tr > td {
-		border: 1px solid black;
-		padding: 5px;
-	}
-
-	table.footer-table > tbody,
-	table.header-table > thead {
-		border-bottom: 3px solid black;
-	}
-
-	table.header-table > thead {
-		border-top: 3px solid black;
-	}
-
-	div.page-body table td:nth-child(6),
-	div.page-body table td:nth-child(7) {
-		text-align: right;
-	}
-
-	div.page-body td {
-		background-color: white !important;
-		border: 1px solid black !important;
-	}
-
-	table.footer-table td {
-		vertical-align: top;
-	}
-
-	table.footer-table td table td:nth-child(2),
-	table.footer-table td table td:nth-child(3) {
-		text-align: right;
-	}
-</style>
-
-
-<!-- Javascript -->
-<script>
-	si_std = {
-		print_item_table: function() {
-			var table = print_table(
-				'Receivable Voucher',
-				doc.name,
-				'entries',
-				'RV Detail',
-				[// Here specify the table columns to be displayed
-					'SR', 'item_name', 'description', 'qty', 'stock_uom',
-					'export_rate', 'export_amount'
-				],
-				[// Here specify the labels of column headings
-					'Sr', 'Item Name', 'Description', 'Qty',
-					'UoM', 'Basic Rate', 'Amount'
-				],
-				[// Here specify the column widths
-					'3%', '20%', '37%', '5%',
-					'5%', '15%', '15%'
-				],
-				null,
-				null,
-				{
-					'description' : function(data_row) {
-						if(data_row.adj_rate) {
-							var to_append = '<div style="padding-left: 15px;"><i>Discount: ' + 
-								data_row.adj_rate + '% on ' + doc.currency + ' ' +
-								fmt_money(data_row.ref_rate) + '</i></div>';
-							if(data_row.description.indexOf(to_append)==-1) {
-								return data_row.description + to_append;
-							} else { return data_row.description; }
-						} else {
-							return data_row.description;
-						}
-					}
-				}
-			);
-
-			// This code takes care of page breaks
-			if(table.appendChild) {
-				out = table.innerHTML;
-			} else {
-				out = '';
-				for(var i=0; i < (table.length-1); i++) {
-					out += table[i].innerHTML + 
-						'<div style = "page-break-after: always;" \
-						class = "page_break"></div>\
-						<div class="page-settings"></div>';
-				}
-				out += table[table.length-1].innerHTML;
-			}
-			return out;
-		},
-
-
-		print_other_charges: function(parent) {
-			var oc = getchildren('RV Tax Detail', doc.name, 'other_charges');
-			var rows = '<table width=100%>\n';
-			for(var i=0; i<oc.length; i++) {
-				if(!oc[i].included_in_print_rate) {
-					rows +=
-						'<tr>\n' +
-							'\t<td>' + oc[i].description + '</td>\n' +
-							'\t<td></td>\n' +
-							'\t<td width=38%>' + fmt_money(oc[i].tax_amount) + '</td>\n' +
-						'</tr>\n';
-				}
-			}
-			return rows + '</table>\n';
-		}
-	};
-</script>
-
-
-<!-- Page Layout Settings -->
-<div class='common page-header'>
-	<!-- 
-		Page Header will contain
-			+ table 1
-				+ table 1a
-					- Name
-					- Address
-					- Contact
-					- Mobile No
-				+ table 1b
-					- Voucher Date
-					- Due Date
-	-->
-	<table class='header-table' cellspacing=0>
-		<thead>
-			<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Invoice') + '</h1>'</script></td></tr>
-			<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60%><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=39%><b>Name</b></td>
-						<td><script>doc.customer_name</script></td>
-					</tr>
-					<tr>
-						<td><b>Address</b></td>
-						<td><script>replace_newlines(doc.address_display)</script></td>
-					</tr>
-					<tr>
-						<td><b>Contact</b></td>
-						<td><script>doc.contact_display</script></td>
-					</tr>
-				</tbody></table></td>
-				<td><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=40%><b>Invoice Date</b></td>
-						<td><script>date.str_to_user(doc.posting_date)</script></td>
-					<tr>					
-					<tr>
-						<td><b>Due Date</b></td>
-						<td><script>date.str_to_user(doc.due_date)</script></td>
-					<tr>					
-				</tbody></table></td>
-			</tr>
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
-<div class='common page-body'>
-	<!-- 
-		Page Body will contain
-			+ table 2
-				- Sales Invoice Data
-	-->
-	<script>si_std.print_item_table()</script>
-</div>
-<div class='common page-footer'>
-	<!-- 
-		Page Footer will contain
-			+ table 3
-				- Terms and Conditions
-				- Total Rounded Amount Calculation
-				- Total Rounded Amount in Words
-	-->
-	<table class='footer-table' width=100% cellspacing=0>
-		<thead>
-			
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60% style='padding-right: 10px;'>
-					<b>Terms, Conditions &amp; Other Information:</b><br />
-					<script>doc.terms</script>
-				</td>
-				<td>
-					<table cellspacing=0 width=100%><tbody>
-						<tr>
-							<td>Net Total</td>
-							<td></td>
-							<td width=38%><script>
-								fmt_money(doc.net_total/doc.conversion_rate)
-							</script></td>
-						</tr>
-						<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>
-						<tr>
-							<td>Grand Total</td>
-							<td></td>
-							<td><script>
-								fmt_money(doc.grand_total_export)
-							</script></td>
-						</tr>
-						<tr style='font-weight: bold'>
-							<td>Rounded Total</td>
-							<td><script>doc.currency</script></td>
-							<td><script>
-								fmt_money(doc.rounded_total_export)
-							</script></td>
-						</tr>
-					</tbody></table>
-					<br /><b>In Words</b><br />
-					<i><script>doc.in_words_export</script></i>
-				</td>
-			</tr>		
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
diff --git a/erpnext/patches/print_formats/SalesOrderClassic.html b/erpnext/patches/print_formats/SalesOrderClassic.html
deleted file mode 100644
index 070feb0..0000000
--- a/erpnext/patches/print_formats/SalesOrderClassic.html
+++ /dev/null
@@ -1,277 +0,0 @@
-<!--
-	Sample Print Format for ERPNext
-	Please use at your own discretion
-	For suggestions and contributions:
-		https://github.com/webnotes/erpnext-print-templates
-
-	Freely usable under MIT license
--->
-
-<!-- Style Settings -->
-<style>
-	/*
-		common style for whole page
-		This should include:
-		+ page size related settings
-		+ font family settings
-		+ line spacing settings
-	*/
-	@media screen {
-		body {
-			width: 8.3in;
-		}
-	}
-
-	html, body, div, span, td {
-		font-family: "Georgia", serif;
-		font-size: 12px;
-	}
-
-	body {
-		padding: 10px;
-		margin: auto;
-		font-size: 12px;
-		line-height: 150%;
-	}
-
-	.common {
-		font-family: "Georgia", serif !important;
-		font-size: 12px;
-		padding: 10px 0px;
-	}
-
-	table {
-		border-collapse: collapse;
-		width: 100%;
-		vertical-align: top;
-	}
-
-	table td {
-		padding: 2px 0px;
-	}
-	
-	table h1, h2, h3, h4, h5, h6 {
-		padding: 0px;
-		margin: 0px;
-	}
-
-	table.header-table td {
-		vertical-align: top;
-	}
-
-	table.header-table thead {
-		border-bottom: 1px solid black;
-	}
-
-	table.header-table h3 {
-		color: gray;
-	}
-
-	table.header-table thead td {
-		padding: 5px 0px;
-	}
-
-	div.page-body table td:nth-child(6),
-	div.page-body table td:nth-child(7) {
-		text-align: right;
-	}
-
-	table.footer-table td {
-		vertical-align: top;
-	}
-
-	table.footer-table td table td:nth-child(2),
-	table.footer-table td table td:nth-child(3) {
-		text-align: right;
-	}
-</style>
-
-
-<!-- Javascript -->
-<script>
-	si_std = {
-		print_item_table: function() {
-			var table = print_table(
-				'Sales Order',
-				doc.name,
-				'sales_order_details',
-				'Sales Order Detail',
-				[// Here specify the table columns to be displayed
-					'SR', 'item_code', 'description', 'qty', 'stock_uom',
-					'basic_rate', 'amount'
-				],
-				[// Here specify the labels of column headings
-					'Sr', 'Item Code', 'Description', 'Qty',
-					'UoM', 'Basic Rate', 'Amount'
-				],
-				[// Here specify the column widths
-					'3%', '20%', '37%', '5%',
-					'5%', '15%', '15%'
-				],
-				null,
-				null,
-				{
-					'description' : function(data_row) {
-						if(data_row.adj_rate) {
-							var to_append = '<div style="padding-left: 15px;"><i>Discount: ' + 
-								data_row.adj_rate + '% on ' + doc.currency + ' ' +
-								fmt_money(data_row.ref_rate) + '</i></div>';
-							if(data_row.description.indexOf(to_append)==-1) {
-								return data_row.description + to_append;
-							} else { return data_row.description; }
-						} else {
-							return data_row.description;
-						}
-					}
-				}
-			);
-
-			// This code takes care of page breaks
-			if(table.appendChild) {
-				out = table.innerHTML;
-			} else {
-				out = '';
-				for(var i=0; i < (table.length-1); i++) {
-					out += table[i].innerHTML + 
-						'<div style = "page-break-after: always;" \
-						class = "page_break"></div>\
-						<div class="page-settings"></div>';
-				}
-				out += table[table.length-1].innerHTML;
-			}
-			return out;
-		},
-
-
-		print_other_charges: function(parent) {
-			var oc = getchildren('RV Tax Detail', doc.name, 'other_charges');
-			var rows = '<table width=100%>\n';
-			for(var i=0; i<oc.length; i++) {
-				if(!oc[i].included_in_print_rate) {
-					rows +=
-						'<tr>\n' +
-							'\t<td>' + oc[i].description + '</td>\n' +
-							'\t<td></td>\n' +
-							'\t<td width=38%>' + fmt_money(oc[i].tax_amount) + '</td>\n' +
-						'</tr>\n';
-				}
-			}
-			return rows + '</table>\n';
-		}
-	};
-</script>
-
-
-<!-- Page Layout Settings -->
-<div class='common page-header'>
-	<!-- 
-		Page Header will contain
-			+ table 1
-				+ table 1a
-					- Name
-					- Address
-					- Contact
-					- Mobile No
-				+ table 1b
-					- Voucher Date
-					- Due Date
-	-->
-	<table class='header-table' cellspacing=0>
-		<thead>
-			<tr><td><script>'<h1>' + (doc.select_print_heading || 'Sales Order') + '</h1>'</script></td></tr>
-			<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60%><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=39%><b>Name</b></td>
-						<td><script>doc.customer_name</script></td>
-					</tr>
-					<tr>
-						<td><b>Address</b></td>
-						<td><script>replace_newlines(doc.address_display)</script></td>
-					</tr>
-					<tr>
-						<td><b>Contact</b></td>
-						<td><script>doc.contact_display</script></td>
-					</tr>
-				</tbody></table></td>
-				<td><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=63%><b>Sales Order Date</b></td>
-						<td><script>date.str_to_user(doc.transaction_date)</script></td>
-					<tr>					
-					<tr>
-						<td><b>Delivery Date</b></td>
-						<td><script>date.str_to_user(doc.delivery_date)</script></td>
-					<tr>					
-				</tbody></table></td>
-			</tr>
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
-<div class='common page-body'>
-	<!-- 
-		Page Body will contain
-			+ table 2
-				- Sales Invoice Data
-	-->
-	<script>si_std.print_item_table()</script>
-</div>
-<div class='common page-footer'>
-	<!-- 
-		Page Footer will contain
-			+ table 3
-				- Terms and Conditions
-				- Total Rounded Amount Calculation
-				- Total Rounded Amount in Words
-	-->
-	<table class='footer-table' width=100% cellspacing=0>
-		<thead>
-			
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60% style='padding-right: 10px;'>
-					<b>Terms, Conditions &amp; Other Information:</b><br />
-					<script>doc.terms</script>
-				</td>
-				<td>
-					<table cellspacing=0 width=100%><tbody>
-						<tr>
-							<td>Net Total</td>
-							<td></td>
-							<td width=38%><script>
-								fmt_money(doc.net_total)
-							</script></td>
-						</tr>
-						<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>
-						<tr>
-							<td>Grand Total</td>
-							<td></td>
-							<td><script>
-								fmt_money(doc.grand_total_export)
-							</script></td>
-						</tr>
-						<tr style='font-weight: bold'>
-							<td>Rounded Total</td>
-							<td><script>doc.currency</script></td>
-							<td><script>
-								fmt_money(doc.rounded_total_export)
-							</script></td>
-						</tr>
-					</tbody></table>
-					<br /><b>In Words</b><br />
-					<i><script>doc.in_words_export</script></i>
-				</td>
-			</tr>		
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
diff --git a/erpnext/patches/print_formats/SalesOrderModern.html b/erpnext/patches/print_formats/SalesOrderModern.html
deleted file mode 100644
index e2ac0c1..0000000
--- a/erpnext/patches/print_formats/SalesOrderModern.html
+++ /dev/null
@@ -1,304 +0,0 @@
-<!--
-	Sample Print Format for ERPNext
-	Please use at your own discretion
-	For suggestions and contributions:
-		https://github.com/webnotes/erpnext-print-templates
-
-	Freely usable under MIT license
--->
-
-<!-- Style Settings -->
-<style>
-	/*
-		common style for whole page
-		This should include:
-		+ page size related settings
-		+ font family settings
-		+ line spacing settings
-	*/
-	@media screen {
-		body {
-			width: 8.3in;
-		}
-	}
-
-	html, body, div, span, td {
-		font-family: "Helvetica", "Arial", sans-serif;
-		font-size: 12px;
-	}
-
-	body {
-		padding: 10px;
-		margin: auto;
-		font-size: 12px;
-		line-height: 150%;
-	}
-
-	.common {
-		font-family: "Helvetica", "Arial", sans-serif !important;
-		font-size: 12px;
-		padding: 10px 0px;
-	}
-
-	table {
-		border-collapse: collapse;
-		width: 100%;
-		vertical-align: top;
-		border-style: none !important;
-	}
-
-	table td {
-		padding: 2px 0px;
-		border-style: none !important;
-	}
-	
-	table h1, h2, h3, h4, h5, h6 {
-		padding: 0px;
-		margin: 0px;
-	}
-
-	table.header-table td {
-		vertical-align: top;
-	}
-
-	table.header-table h1 {
-		text-transform: uppercase;
-		color: white;
-		font-size: 55px;
-		font-style: italic;
-	}
-
-	table.header-table thead tr:nth-child(1) div {
-		height: 24px;
-		background-color: #696969;
-		vertical-align: middle;
-		padding: 12px 0px 0px 0px;
-		width: 100%;
-	}
-
-	div.page-body table td:nth-child(6),
-	div.page-body table td:nth-child(7) {
-		text-align: right;
-	}
-
-	div.page-body table tr td {
-		background-color: #DCDCDC !important;
-	}
-
-	div.page-body table tr:nth-child(1) td {
-		background-color: #696969 !important;
-		color: white !important;
-	}
-
-	table.footer-table td {
-		vertical-align: top;
-	}
-
-	table.footer-table td table td:nth-child(2),
-	table.footer-table td table td:nth-child(3) {
-		text-align: right;
-	}
-
-	table.footer-table tfoot td {
-		background-color: #696969;
-		height: 10px;
-	}
-
-	.imp-details {
-		background-color: #DCDCDC;
-	}
-</style>
-
-
-<!-- Javascript -->
-<script>
-	si_std = {
-		print_item_table: function() {
-			var table = print_table(
-				'Sales Order',
-				doc.name,
-				'sales_order_details',
-				'Sales Order Detail',
-				[// Here specify the table columns to be displayed
-					'SR', 'item_code', 'description', 'qty', 'stock_uom',
-					'basic_rate', 'amount'
-				],
-				[// Here specify the labels of column headings
-					'Sr', 'Item Code', 'Description', 'Qty',
-					'UoM', 'Basic Rate', 'Amount'
-				],
-				[// Here specify the column widths
-					'3%', '20%', '37%', '5%',
-					'5%', '15%', '15%'
-				],
-				null,
-				null,
-				{
-					'description' : function(data_row) {
-						if(data_row.adj_rate) {
-							var to_append = '<div style="padding-left: 15px;"><i>Discount: ' + 
-								data_row.adj_rate + '% on ' + doc.currency + ' ' +
-								fmt_money(data_row.ref_rate) + '</i></div>';
-							if(data_row.description.indexOf(to_append)==-1) {
-								return data_row.description + to_append;
-							} else { return data_row.description; }
-						} else {
-							return data_row.description;
-						}
-					}
-				}
-			);
-
-			// This code takes care of page breaks
-			if(table.appendChild) {
-				out = table.innerHTML;
-			} else {
-				out = '';
-				for(var i=0; i < (table.length-1); i++) {
-					out += table[i].innerHTML + 
-						'<div style = "page-break-after: always;" \
-						class = "page_break"></div>\
-						<div class="page-settings"></div>';
-				}
-				out += table[table.length-1].innerHTML;
-			}
-			return out;
-		},
-
-
-		print_other_charges: function(parent) {
-			var oc = getchildren('RV Tax Detail', doc.name, 'other_charges');
-			var rows = '<table width=100%>\n';
-			for(var i=0; i<oc.length; i++) {
-				if(!oc[i].included_in_print_rate) {
-					rows +=
-						'<tr>\n' +
-							'\t<td>' + oc[i].description + '</td>\n' +
-							'\t<td></td>\n' +
-							'\t<td width=38%>' + fmt_money(oc[i].tax_amount) + '</td>\n' +
-						'</tr>\n';
-				}
-			}
-			return rows + '</table>\n';
-		}
-	};
-</script>
-
-
-<!-- Page Layout Settings -->
-<div class='common page-header'>
-	<!-- 
-		Page Header will contain
-			+ table 1
-				+ table 1a
-					- Name
-					- Address
-					- Contact
-					- Mobile No
-				+ table 1b
-					- Voucher Date
-					- Due Date
-	-->
-	<table class='header-table' cellspacing=0>
-		<thead>
-			<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Sales Order') + '</h1>'</script></div></td></tr>
-			<tr><td colspan=2><div style="height:15px"></div></td></tr>
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60%><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=39%><b>Name</b></td>
-						<td><script>doc.customer_name</script></td>
-					</tr>
-					<tr>
-						<td><b>Address</b></td>
-						<td><script>replace_newlines(doc.address_display)</script></td>
-					</tr>
-					<tr>
-						<td><b>Contact</b></td>
-						<td><script>doc.contact_display</script></td>
-					</tr>
-				</tbody></table></td>
-				<td><table width=100% cellspacing=0><tbody>
-					<tr class='imp-details'>
-						<td><b>Sales Order No.</b></td>
-						<td><script>cur_frm.docname</script></td>
-					</tr>
-					<tr>
-						<td width=63%><b>Sales Order Date</b></td>
-						<td><script>date.str_to_user(doc.transaction_date)</script></td>
-					<tr>					
-					<tr>
-						<td><b>Delivery Date</b></td>
-						<td><script>date.str_to_user(doc.delivery_date)</script></td>
-					<tr>					
-				</tbody></table></td>
-			</tr>
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
-<div class='common page-body'>
-	<!-- 
-		Page Body will contain
-			+ table 2
-				- Sales Invoice Data
-	-->
-	<script>si_std.print_item_table()</script>
-</div>
-<div class='common page-footer'>
-	<!-- 
-		Page Footer will contain
-			+ table 3
-				- Terms and Conditions
-				- Total Rounded Amount Calculation
-				- Total Rounded Amount in Words
-	-->
-	<table class='footer-table' width=100% cellspacing=0>
-		<thead>
-			
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60% style='padding-right: 10px;'>
-					<b>Terms, Conditions &amp; Other Information:</b><br />
-					<script>doc.terms</script>
-				</td>
-				<td>
-					<table cellspacing=0 width=100%><tbody>
-						<tr>
-							<td>Net Total</td>
-							<td></td>
-							<td width=38%><script>
-								fmt_money(doc.net_total)
-							</script></td>
-						</tr>
-						<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>
-						<tr>
-							<td>Grand Total</td>
-							<td></td>
-							<td><script>
-								fmt_money(doc.grand_total_export)
-							</script></td>
-						</tr>
-						<tr style='font-weight: bold' class='imp-details'>
-							<td>Rounded Total</td>
-							<td><script>doc.currency</script></td>
-							<td><script>
-								fmt_money(doc.rounded_total_export)
-							</script></td>
-						</tr>
-					</tbody></table>
-					<br /><b>In Words</b><br />
-					<i><script>doc.in_words_export</script></i>
-				</td>
-			</tr>		
-		</tbody>
-		<tfoot>
-			<tr><td colspan=2><div></div></td><tr>
-		</tfoot>
-	</table>
-</div>
diff --git a/erpnext/patches/print_formats/SalesOrderSpartan.html b/erpnext/patches/print_formats/SalesOrderSpartan.html
deleted file mode 100644
index 866e84f..0000000
--- a/erpnext/patches/print_formats/SalesOrderSpartan.html
+++ /dev/null
@@ -1,299 +0,0 @@
-<!--
-	Sample Print Format for ERPNext
-	Please use at your own discretion
-	For suggestions and contributions:
-		https://github.com/webnotes/erpnext-print-templates
-
-	Freely usable under MIT license
--->
-
-<!-- Style Settings -->
-<style>
-	/*
-		common style for whole page
-		This should include:
-		+ page size related settings
-		+ font family settings
-		+ line spacing settings
-	*/
-	@media screen {
-		body {
-			width: 8.3in;
-		}
-	}
-
-	html, body, div, span, td {
-		font-family: "Arial", sans-serif;
-		font-size: 12px;
-	}
-
-	body {
-		padding: 10px;
-		margin: auto;
-		font-size: 12px;
-		line-height: 150%;
-	}
-
-	.common {
-		font-family: "Arial", sans-serif !important;
-		font-size: 12px;
-		padding: 0px;
-	}
-
-	table {
-		width: 100% !important;
-		vertical-align: top;
-	}
-
-	table td {
-		padding: 2px 0px;
-	}
-
-	table, td {
-		border-collapse: collapse !important;
-		padding: 0px;
-		margin: 0px !important;
-	}
-	
-	table h1, h2, h3, h4, h5, h6 {
-		padding: 0px;
-		margin: 0px;
-	}
-
-	table.header-table td {
-		vertical-align: top;
-	}
-
-	table.header-table h3 {
-		color: gray;
-	}
-
-	table.header-table thead td {
-		padding: 5px;
-	}
-
-	table.header-table > thead,
-	table.header-table > tbody > tr > td,
-	table.footer-table > tbody > tr > td {
-		border: 1px solid black;
-		padding: 5px;
-	}
-
-	table.footer-table > tbody,
-	table.header-table > thead {
-		border-bottom: 3px solid black;
-	}
-
-	table.header-table > thead {
-		border-top: 3px solid black;
-	}
-
-	div.page-body table td:nth-child(6),
-	div.page-body table td:nth-child(7) {
-		text-align: right;
-	}
-
-	div.page-body td {
-		background-color: white !important;
-		border: 1px solid black !important;
-	}
-
-	table.footer-table td {
-		vertical-align: top;
-	}
-
-	table.footer-table td table td:nth-child(2),
-	table.footer-table td table td:nth-child(3) {
-		text-align: right;
-	}
-</style>
-
-
-<!-- Javascript -->
-<script>
-	si_std = {
-		print_item_table: function() {
-			var table = print_table(
-				'Sales Order',
-				doc.name,
-				'sales_order_details',
-				'Sales Order Detail',
-				[// Here specify the table columns to be displayed
-					'SR', 'item_code', 'description', 'qty', 'stock_uom',
-					'basic_rate', 'amount'
-				],
-				[// Here specify the labels of column headings
-					'Sr', 'Item Code', 'Description', 'Qty',
-					'UoM', 'Basic Rate', 'Amount'
-				],
-				[// Here specify the column widths
-					'3%', '20%', '37%', '5%',
-					'5%', '15%', '15%'
-				],
-				null,
-				null,
-				{
-					'description' : function(data_row) {
-						if(data_row.adj_rate) {
-							var to_append = '<div style="padding-left: 15px;"><i>Discount: ' + 
-								data_row.adj_rate + '% on ' + doc.currency + ' ' +
-								fmt_money(data_row.ref_rate) + '</i></div>';
-							if(data_row.description.indexOf(to_append)==-1) {
-								return data_row.description + to_append;
-							} else { return data_row.description; }
-						} else {
-							return data_row.description;
-						}
-					}
-				}
-			);
-
-			// This code takes care of page breaks
-			if(table.appendChild) {
-				out = table.innerHTML;
-			} else {
-				out = '';
-				for(var i=0; i < (table.length-1); i++) {
-					out += table[i].innerHTML + 
-						'<div style = "page-break-after: always;" \
-						class = "page_break"></div>\
-						<div class="page-settings"></div>';
-				}
-				out += table[table.length-1].innerHTML;
-			}
-			return out;
-		},
-
-
-		print_other_charges: function(parent) {
-			var oc = getchildren('RV Tax Detail', doc.name, 'other_charges');
-			var rows = '<table width=100%>\n';
-			for(var i=0; i<oc.length; i++) {
-				if(!oc[i].included_in_print_rate) {
-					rows +=
-						'<tr>\n' +
-							'\t<td>' + oc[i].description + '</td>\n' +
-							'\t<td></td>\n' +
-							'\t<td width=38%>' + fmt_money(oc[i].tax_amount) + '</td>\n' +
-						'</tr>\n';
-				}
-			}
-			return rows + '</table>\n';
-		}
-	};
-</script>
-
-
-<!-- Page Layout Settings -->
-<div class='common page-header'>
-	<!-- 
-		Page Header will contain
-			+ table 1
-				+ table 1a
-					- Name
-					- Address
-					- Contact
-					- Mobile No
-				+ table 1b
-					- Voucher Date
-					- Due Date
-	-->
-	<table class='header-table' cellspacing=0>
-		<thead>
-			<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Sales Order') + '</h1>'</script></td></tr>
-			<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60%><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=39%><b>Name</b></td>
-						<td><script>doc.customer_name</script></td>
-					</tr>
-					<tr>
-						<td><b>Address</b></td>
-						<td><script>replace_newlines(doc.address_display)</script></td>
-					</tr>
-					<tr>
-						<td><b>Contact</b></td>
-						<td><script>doc.contact_display</script></td>
-					</tr>
-				</tbody></table></td>
-				<td><table width=100% cellspacing=0><tbody>
-					<tr>
-						<td width=63%><b>Sales Order Date</b></td>
-						<td><script>date.str_to_user(doc.transaction_date)</script></td>
-					<tr>					
-					<tr>
-						<td><b>Delivery Date</b></td>
-						<td><script>date.str_to_user(doc.delivery_date)</script></td>
-					<tr>					
-				</tbody></table></td>
-			</tr>
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
-<div class='common page-body'>
-	<!-- 
-		Page Body will contain
-			+ table 2
-				- Sales Invoice Data
-	-->
-	<script>si_std.print_item_table()</script>
-</div>
-<div class='common page-footer'>
-	<!-- 
-		Page Footer will contain
-			+ table 3
-				- Terms and Conditions
-				- Total Rounded Amount Calculation
-				- Total Rounded Amount in Words
-	-->
-	<table class='footer-table' width=100% cellspacing=0>
-		<thead>
-			
-		</thead>
-		<tbody>
-			<tr>
-				<td width=60% style='padding-right: 10px;'>
-					<b>Terms, Conditions &amp; Other Information:</b><br />
-					<script>doc.terms</script>
-				</td>
-				<td>
-					<table cellspacing=0 width=100%><tbody>
-						<tr>
-							<td>Net Total</td>
-							<td></td>
-							<td width=38%><script>
-								fmt_money(doc.net_total)
-							</script></td>
-						</tr>
-						<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>
-						<tr>
-							<td>Grand Total</td>
-							<td></td>
-							<td><script>
-								fmt_money(doc.grand_total_export)
-							</script></td>
-						</tr>
-						<tr style='font-weight: bold'>
-							<td>Rounded Total</td>
-							<td><script>doc.currency</script></td>
-							<td><script>
-								fmt_money(doc.rounded_total_export)
-							</script></td>
-						</tr>
-					</tbody></table>
-					<br /><b>In Words</b><br />
-					<i><script>doc.in_words_export</script></i>
-				</td>
-			</tr>		
-		</tbody>
-		<tfoot>
-		
-		</tfoot>
-	</table>
-</div>
diff --git a/erpnext/production/DocType Mapper/Production Forecast-Production Plan/Production Forecast-Production Plan.txt b/erpnext/production/DocType Mapper/Production Forecast-Production Plan/Production Forecast-Production Plan.txt
deleted file mode 100644
index 7065fa6..0000000
--- a/erpnext/production/DocType Mapper/Production Forecast-Production Plan/Production Forecast-Production Plan.txt
+++ /dev/null
@@ -1,102 +0,0 @@
-# DocType Mapper, Production Forecast-Production Plan
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:35',
-		'docstatus': 0,
-		'modified': '2011-09-15 15:04:42',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'name': '__common__',
-		'parent': 'Production Forecast-Production Plan',
-		'parentfield': 'table_mapper_details',
-		'parenttype': 'DocType Mapper'
-	},
-
-	# These values are common for all Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'map': 'Yes',
-		'match_id': 1,
-		'name': '__common__',
-		'parent': 'Production Forecast-Production Plan',
-		'parentfield': 'field_mapper_details',
-		'parenttype': 'DocType Mapper'
-	},
-
-	# These values are common for all DocType Mapper
-	{
-		'doctype': 'DocType Mapper',
-		'from_doctype': 'Production Forecast',
-		'module': 'Production',
-		'name': '__common__',
-		'to_doctype': 'Production Plan'
-	},
-
-	# DocType Mapper, Production Forecast-Production Plan
-	{
-		'doctype': 'DocType Mapper',
-		'name': 'Production Forecast-Production Plan'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'eval:flt(obj.qty)-flt(obj.planned_qty)',
-		'to_field': 'prevdoc_reqd_qty'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'parenttype',
-		'to_field': 'against_document'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'parent',
-		'to_field': 'document_no'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'start_date',
-		'to_field': 'document_date'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'end_date',
-		'to_field': 'confirmation_date'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_table': 'Production Forecast',
-		'match_id': 0,
-		'to_table': 'Production Plan',
-		'validation_logic': 'docstatus =1'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_field': 'pf_details',
-		'from_table': 'PF Detail',
-		'match_id': 1,
-		'to_field': 'pp_details',
-		'to_table': 'PP Detail',
-		'validation_logic': 'docstatus =1 and qty > planned_qty '
-	}
-]
\ No newline at end of file
diff --git a/erpnext/production/DocType Mapper/Production Forecast-Production Planning Tool/Production Forecast-Production Planning Tool.txt b/erpnext/production/DocType Mapper/Production Forecast-Production Planning Tool/Production Forecast-Production Planning Tool.txt
deleted file mode 100644
index 3d62811..0000000
--- a/erpnext/production/DocType Mapper/Production Forecast-Production Planning Tool/Production Forecast-Production Planning Tool.txt
+++ /dev/null
@@ -1,95 +0,0 @@
-# DocType Mapper, Production Forecast-Production Planning Tool
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:35',
-		'docstatus': 0,
-		'modified': '2011-09-15 15:04:43',
-		'modified_by': 'Administrator',
-		'owner': 'jai@webnotestech.com'
-	},
-
-	# These values are common for all Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'name': '__common__',
-		'parent': 'Production Forecast-Production Planning Tool',
-		'parentfield': 'table_mapper_details',
-		'parenttype': 'DocType Mapper'
-	},
-
-	# These values are common for all Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'map': 'Yes',
-		'match_id': 1,
-		'name': '__common__',
-		'parent': 'Production Forecast-Production Planning Tool',
-		'parentfield': 'field_mapper_details',
-		'parenttype': 'DocType Mapper'
-	},
-
-	# These values are common for all DocType Mapper
-	{
-		'doctype': 'DocType Mapper',
-		'from_doctype': 'Production Forecast',
-		'module': 'Production',
-		'name': '__common__',
-		'to_doctype': 'Production Planning Tool'
-	},
-
-	# DocType Mapper, Production Forecast-Production Planning Tool
-	{
-		'doctype': 'DocType Mapper',
-		'name': 'Production Forecast-Production Planning Tool'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'eval:flt(obj.qty)-flt(obj.planned_qty)',
-		'to_field': 'prevdoc_reqd_qty'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'parenttype',
-		'to_field': 'source_doctype'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'parent',
-		'to_field': 'source_docname'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'end_date',
-		'to_field': 'confirmation_date'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_table': 'Production Forecast',
-		'match_id': 0,
-		'to_table': 'Production Planning Tool',
-		'validation_logic': 'docstatus =1'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_field': 'pf_details',
-		'from_table': 'PF Detail',
-		'match_id': 1,
-		'to_field': 'pp_details',
-		'to_table': 'PP Detail',
-		'validation_logic': 'docstatus =1 and qty > planned_qty '
-	}
-]
\ No newline at end of file
diff --git a/erpnext/production/DocType Mapper/Sales Order-Production Plan/Sales Order-Production Plan.txt b/erpnext/production/DocType Mapper/Sales Order-Production Plan/Sales Order-Production Plan.txt
deleted file mode 100644
index 780b841..0000000
--- a/erpnext/production/DocType Mapper/Sales Order-Production Plan/Sales Order-Production Plan.txt
+++ /dev/null
@@ -1,103 +0,0 @@
-# DocType Mapper, Sales Order-Production Plan
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:36',
-		'docstatus': 0,
-		'modified': '2011-09-15 15:04:45',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'name': '__common__',
-		'parent': 'Sales Order-Production Plan',
-		'parentfield': 'table_mapper_details',
-		'parenttype': 'DocType Mapper'
-	},
-
-	# These values are common for all Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'map': 'Yes',
-		'match_id': 1,
-		'name': '__common__',
-		'parent': 'Sales Order-Production Plan',
-		'parentfield': 'field_mapper_details',
-		'parenttype': 'DocType Mapper'
-	},
-
-	# These values are common for all DocType Mapper
-	{
-		'doctype': 'DocType Mapper',
-		'from_doctype': 'Sales Order',
-		'module': 'Production',
-		'name': '__common__',
-		'ref_doc_submitted': 1,
-		'to_doctype': 'Production Plan'
-	},
-
-	# DocType Mapper, Sales Order-Production Plan
-	{
-		'doctype': 'DocType Mapper',
-		'name': 'Sales Order-Production Plan'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'parenttype',
-		'to_field': 'against_document'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'parent',
-		'to_field': 'document_no'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'uom',
-		'to_field': 'stock_uom'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'eval:flt(obj.qty)-flt(obj.planned_qty)',
-		'to_field': 'prevdoc_total_qty'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'transaction_date',
-		'to_field': 'document_date'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_table': 'Sales Order',
-		'match_id': 0,
-		'to_table': 'Production Plan',
-		'validation_logic': 'docstatus =1'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_field': 'packing_details',
-		'from_table': 'Delivery Note Packing Detail',
-		'match_id': 1,
-		'to_field': 'pp_details',
-		'to_table': 'PP Detail',
-		'validation_logic': 'docstatus =1 and qty > planned_qty'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/production/Module Def/Production/Production.txt b/erpnext/production/Module Def/Production/Production.txt
deleted file mode 100644
index 169acf5..0000000
--- a/erpnext/production/Module Def/Production/Production.txt
+++ /dev/null
@@ -1,519 +0,0 @@
-[
-	{
-		'_last_update': '1300959287',
-		'creation': '2010-11-30 22:42:49',
-		'disabled': 'No',
-		'docstatus': 0,
-		'doctype': u'Module Def',
-		'doctype_list': None,
-		'file_list': 'support.gif,FileData/00214',
-		'idx': None,
-		'is_hidden': 'No',
-		'last_updated_date': '2010-11-29 12:02:02',
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'module_desc': '<p>Production Documents</p>',
-		'module_icon': 'process.png',
-		'module_label': 'Production',
-		'module_name': 'Production',
-		'module_page': None,
-		'module_seq': 7,
-		'name': 'Production',
-		'owner': 'Administrator',
-		'parent': None,
-		'parentfield': None,
-		'parenttype': None,
-		'trash_reason': None,
-		'widget_code': None
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:42:49',
-		'description': 'Bill of material master containing raw materials, operation and costs',
-		'display_name': 'Bill Of Materials',
-		'doc_name': 'Bill Of Materials',
-		'doc_type': 'Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': 'id\nitem\ndescription\noperating_cost\nmaintained_by',
-		'hide': None,
-		'icon': None,
-		'idx': 1,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': 'MDI00209',
-		'owner': 'Administrator',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:42:49',
-		'description': 'Machinery in warehouse where operations are performed on raw materials',
-		'display_name': 'Workstation',
-		'doc_name': 'Workstation',
-		'doc_type': 'Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': 'id\nworkstation_name\nwarehouse\ndescription',
-		'hide': None,
-		'icon': None,
-		'idx': 2,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': 'MDI00210',
-		'owner': 'Administrator',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:42:49',
-		'description': 'Explode Bill of Materials in a tree and calculate the cost',
-		'display_name': 'Bill of Materials (Tree)',
-		'doc_name': 'Bill of Materials',
-		'doc_type': 'Pages',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 3,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': 'MDI00211',
-		'owner': 'Administrator',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:42:49',
-		'description': 'Update confirmed delivery dates in Sales Orders included in Production Plan',
-		'display_name': 'Update Delivery Dates',
-		'doc_name': 'Update Delivery Date',
-		'doc_type': 'Single DocType',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 4,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': 'MDI00212',
-		'owner': 'jai@webnotestech.com',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:42:49',
-		'description': 'Plan your production by including relevant Sales Orders in your plan',
-		'display_name': 'Production Planning Tool',
-		'doc_name': 'Production Planning Tool',
-		'doc_type': 'Single DocType',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 5,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': 'MDI00213',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:42:49',
-		'description': 'Change raw materials used in a Bill of Material through BOM replace utility',
-		'display_name': 'BOM Replace Utility',
-		'doc_name': 'BOM Replace Utility',
-		'doc_type': 'Single DocType',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 6,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': 'MDI00214',
-		'owner': 'jai@webnotestech.com',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:42:49',
-		'description': 'Raise your Production Orders Manually',
-		'display_name': 'Production Order',
-		'doc_name': 'Production Order',
-		'doc_type': 'Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 7,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': 'MDI00215',
-		'owner': 'Administrator',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 15:04:47',
-		'description': None,
-		'display_name': None,
-		'doc_name': 'Reports',
-		'doc_type': 'Separator',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 8,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': '000003093',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 15:04:47',
-		'description': None,
-		'display_name': 'Delivery Plan',
-		'doc_name': 'Sales Order Detail',
-		'doc_type': 'Reports',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 9,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': '000003094',
-		'owner': 'Administrator',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 15:04:47',
-		'description': None,
-		'display_name': 'Itemwise Production Report',
-		'doc_name': 'Stock Entry Detail',
-		'doc_type': 'Reports',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 10,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': '000003095',
-		'owner': 'jai@webnotestech.com',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 15:04:47',
-		'description': None,
-		'display_name': 'Production Orders In Process',
-		'doc_name': 'Production Order',
-		'doc_type': 'Reports',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 11,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': '000003096',
-		'owner': 'jai@webnotestech.com',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:42:49',
-		'description': 'Bill of material master containing raw materials, operation and costs',
-		'display_name': 'Bill Of Materials',
-		'doc_name': 'Bill Of Materials',
-		'doc_type': 'Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': 'id\nitem\ndescription\noperating_cost\nmaintained_by',
-		'hide': None,
-		'icon': None,
-		'idx': 1,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': 'MDI00209',
-		'owner': 'Administrator',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:42:49',
-		'description': 'Machinery in warehouse where operations are performed on raw materials',
-		'display_name': 'Workstation',
-		'doc_name': 'Workstation',
-		'doc_type': 'Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': 'id\nworkstation_name\nwarehouse\ndescription',
-		'hide': None,
-		'icon': None,
-		'idx': 2,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': 'MDI00210',
-		'owner': 'Administrator',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:42:49',
-		'description': 'Explode Bill of Materials in a tree and calculate the cost',
-		'display_name': 'Bill of Materials (Tree)',
-		'doc_name': 'Bill of Materials',
-		'doc_type': 'Pages',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 3,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': 'MDI00211',
-		'owner': 'Administrator',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:42:49',
-		'description': 'Update confirmed delivery dates in Sales Orders included in Production Plan',
-		'display_name': 'Update Delivery Dates',
-		'doc_name': 'Update Delivery Date',
-		'doc_type': 'Single DocType',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 4,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': 'MDI00212',
-		'owner': 'jai@webnotestech.com',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:42:49',
-		'description': 'Plan your production by including relevant Sales Orders in your plan',
-		'display_name': 'Production Planning Tool',
-		'doc_name': 'Production Planning Tool',
-		'doc_type': 'Single DocType',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 5,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': 'MDI00213',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:42:49',
-		'description': 'Change raw materials used in a Bill of Material through BOM replace utility',
-		'display_name': 'BOM Replace Utility',
-		'doc_name': 'BOM Replace Utility',
-		'doc_type': 'Single DocType',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 6,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': 'MDI00214',
-		'owner': 'jai@webnotestech.com',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:42:49',
-		'description': 'Raise your Production Orders Manually',
-		'display_name': 'Production Order',
-		'doc_name': 'Production Order',
-		'doc_type': 'Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 7,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': 'MDI00215',
-		'owner': 'Administrator',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 15:04:47',
-		'description': None,
-		'display_name': None,
-		'doc_name': 'Reports',
-		'doc_type': 'Separator',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 8,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': '000003093',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 15:04:47',
-		'description': None,
-		'display_name': 'Delivery Plan',
-		'doc_name': 'Sales Order Detail',
-		'doc_type': 'Reports',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 9,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': '000003094',
-		'owner': 'Administrator',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 15:04:47',
-		'description': None,
-		'display_name': 'Itemwise Production Report',
-		'doc_name': 'Stock Entry Detail',
-		'doc_type': 'Reports',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 10,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': '000003095',
-		'owner': 'jai@webnotestech.com',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 15:04:47',
-		'description': None,
-		'display_name': 'Production Orders In Process',
-		'doc_name': 'Production Order',
-		'doc_type': 'Reports',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 11,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': '000003096',
-		'owner': 'jai@webnotestech.com',
-		'parent': 'Production',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'creation': '2010-11-30 22:42:49',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 1,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': 'MDR00040',
-		'owner': 'Administrator',
-		'parent': 'Production',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'Production User'
-	},
-	{
-		'creation': '2010-11-30 22:42:49',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 2,
-		'modified': '2011-03-24 15:29:36',
-		'modified_by': 'Administrator',
-		'name': 'MDR00041',
-		'owner': 'Administrator',
-		'parent': 'Production',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'Production Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/production/Role/Production Manager/Production Manager.txt b/erpnext/production/Role/Production Manager/Production Manager.txt
deleted file mode 100644
index b87fc74..0000000
--- a/erpnext/production/Role/Production Manager/Production Manager.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Production Manager
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2009-09-23 16:35:35',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Production',
-		'name': '__common__',
-		'role_name': 'Production Manager'
-	},
-
-	# Role, Production Manager
-	{
-		'doctype': 'Role',
-		'name': 'Production Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/production/Role/Production User/Production User.txt b/erpnext/production/Role/Production User/Production User.txt
deleted file mode 100644
index ed6d6d6..0000000
--- a/erpnext/production/Role/Production User/Production User.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Production User
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2009-09-23 16:36:08',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Production',
-		'name': '__common__',
-		'role_name': 'Production User'
-	},
-
-	# Role, Production User
-	{
-		'doctype': 'Role',
-		'name': 'Production User'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/production/__init__.py b/erpnext/production/__init__.py
index e69de29..4fb00a3 100644
--- a/erpnext/production/__init__.py
+++ b/erpnext/production/__init__.py
@@ -0,0 +1,4 @@
+install_docs = [
+	{"doctype":"Role", "role_name":"Production Manager", "name":"Production Manager"},
+	{"doctype":"Role", "role_name":"Production User", "name":"Production User"},
+]
diff --git a/erpnext/production/doctype/bill_of_materials/__init__.py b/erpnext/production/doctype/bill_of_materials/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/production/doctype/bill_of_materials/__init__.py
+++ /dev/null
diff --git a/erpnext/production/doctype/bill_of_materials/bill_of_materials.js b/erpnext/production/doctype/bill_of_materials/bill_of_materials.js
deleted file mode 100644
index c49a9bc..0000000
--- a/erpnext/production/doctype/bill_of_materials/bill_of_materials.js
+++ /dev/null
@@ -1,164 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-// On REFRESH
-cur_frm.cscript.refresh = function(doc,dt,dn){
-	if(!doc.__islocal) {
-		set_field_permlevel('item',1);
-		unhide_field('Update Cost as on today');
-	} else {
-		hide_field('Update Cost as on today');
-	}
-}
-
-
-// Triggers
-//--------------------------------------------------------------------------------------------------
-cur_frm.cscript.item = function(doc, dt, dn) {
-	if (doc.item) {
-		get_server_fields('get_item_detail',doc.item,'',doc,dt,dn,1);
-	}
-}
-
-
-cur_frm.cscript.workstation = function(doc,dt,dn) {
-	var d = locals[dt][dn];
-	if (d.workstation) {
-		var callback = function(r, rt) {
-			calculate_op_cost(doc, dt, dn);
-			calculate_total(doc);
-		}
-		get_server_fields('get_workstation_details',d.workstation,'bom_operations',doc,dt,dn,1, callback);
-	}
-}
-
-
-cur_frm.cscript.hour_rate = function(doc, dt, dn) {
-	calculate_op_cost(doc, dt, dn);
-	calculate_total(doc);
-}
-
-
-cur_frm.cscript.time_in_mins = cur_frm.cscript.hour_rate;
-
-
-cur_frm.cscript.item_code = function(doc,dt,dn) {
-	get_bom_material_detail(doc, dt, dn);
-}
-
-
-cur_frm.cscript.bom_no  = function(doc,dt,dn) {
-	get_bom_material_detail(doc, dt, dn);
-}
-
-
-var get_bom_material_detail= function(doc,dt,dn) {
-	var d = locals[dt][dn];
-	var callback = function(doc, dt, dn) {
-		calculate_rm_cost(doc, dt, dn);
-		calculate_total(doc);
-	}
-
-	var bom_no = (d.bom_no!=null) ? d.bom_no:''
-	if (d.item_code) {
-		arg = {'item_code': d.item_code, 'bom_no': bom_no, 'qty': d.qty};
-		get_server_fields('get_bom_material_detail', JSON.stringify(arg), 'bom_materials', doc, dt, dn, 1, callback);
-	}
-}
-
-
-cur_frm.cscript.qty = function(doc, dt, dn) {
-	calculate_rm_cost(doc, dt, dn);
-	calculate_total(doc);
-}
-
-
-cur_frm.cscript.rate = cur_frm.cscript.qty;
-
-
-cur_frm.cscript.is_default = function(doc, dt, dn) {
-	if (doc.docstatus == 1)
-		$c_obj(make_doclist(dt, dn), 'manage_default_bom', '', '');
-}
-
-
-cur_frm.cscript.is_active = function(doc, dt, dn) {
-	if (!doc.__islocal)
-		$c_obj(make_doclist(dt, dn), 'manage_active_bom', '', '');
-}
-
-
-// Calculate Operating Cost
-var calculate_op_cost = function(doc, dt, dn) {  
-	var op = getchildren('BOM Operation', doc.name, 'bom_operations');
-	total_op_cost = 0;
-	for(var i=0;i<op.length;i++) {
-		op_cost =  flt(op[i].hour_rate) * flt(op[i].time_in_mins) / 60;
-		set_multiple('BOM Operation',op[i].name, {'operating_cost': op_cost}, 'bom_operations');
-		total_op_cost += op_cost;
-	}
-	doc.operating_cost = total_op_cost;
-	refresh_field('operating_cost');
-}
-
-
-// Calculate Raw Material Cost
-var calculate_rm_cost = function(doc, dt, dn) {  
-	var rm = getchildren('BOM Material', doc.name, 'bom_materials');
-	total_rm_cost = 0;
-	for(var i=0;i<rm.length;i++) {
-		amt =  flt(rm[i].rate) * flt(rm[i].qty);
-		set_multiple('BOM Material',rm[i].name, {'amount': amt}, 'bom_materials');
-		set_multiple('BOM Material',rm[i].name, {'qty_consumed_per_unit': flt(rm[i].qty)/flt(doc.quantity)}, 'bom_materials');
-		total_rm_cost += amt;
-	}
-	doc.raw_material_cost = total_rm_cost;
-	refresh_field('raw_material_cost');
-}
-
-
-// Calculate Total Cost
-var calculate_total = function(doc) {
-	doc.total_cost = flt(doc.raw_material_cost) + flt(doc.operating_cost);
-	refresh_field('total_cost');
-}
-
-
-
-// Get Query
-//-----------------------------------------------------------------------------------------------------
-cur_frm.fields_dict['item'].get_query = function(doc) {
-	return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.description FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.`%(key)s` like "%s" ORDER BY `tabItem`.`name` LIMIT 50';
-}
-
-cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) {
-	return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
-}
-
-cur_frm.fields_dict['bom_materials'].grid.get_field('item_code').get_query = function(doc) {
-	return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.description FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.`%(key)s` like "%s" ORDER BY `tabItem`.`name` LIMIT 50';
-}
-
-cur_frm.fields_dict['bom_materials'].grid.get_field('bom_no').get_query = function(doc) {
-	var d = locals[this.doctype][this.docname];
-	return 'SELECT DISTINCT `tabBill Of Materials`.`name`, `tabBill Of Materials`.`remarks` FROM `tabBill Of Materials` WHERE `tabBill Of Materials`.`item` = "' + d.item_code + '" AND `tabBill Of Materials`.`is_active` = "Yes" AND `tabBill Of Materials`.docstatus = 1 AND `tabBill Of Materials`.`name` like "%s" ORDER BY `tabBill Of Materials`.`name` LIMIT 50';
-}
-
-cur_frm.cscript.validate = function(doc, dt, dn) {
-	calculate_op_cost(doc, dt, dn);
-	calculate_rm_cost(doc, dt, dn);
-	calculate_total(doc);
-}
\ No newline at end of file
diff --git a/erpnext/production/doctype/bill_of_materials/bill_of_materials.py b/erpnext/production/doctype/bill_of_materials/bill_of_materials.py
deleted file mode 100644
index dfbc998..0000000
--- a/erpnext/production/doctype/bill_of_materials/bill_of_materials.py
+++ /dev/null
@@ -1,404 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import webnotes
-from webnotes.utils import cint, cstr, flt, get_defaults, getdate, now, nowdate
-from webnotes.model.doc import Document, addchild, getchildren, make_autoname
-from webnotes.model.doclist import getlist
-from webnotes.model.code import get_obj
-from webnotes import msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-
-# -----------------------------------------------------------------------------------------
-
-class DocType:
-	def __init__(self, doc, doclist=[]):
-		self.doc = doc
-		self.doclist = doclist
-
-	def autoname(self):
-		last_name = sql("select max(name) from `tabBill Of Materials` where name like 'BOM/%s/%%'" % self.doc.item)
-		if last_name:
-			idx = cint(cstr(last_name[0][0]).split('/')[-1]) + 1
-		else:
-			idx = 1
-		self.doc.name = 'BOM/' + self.doc.item + ('/%.3i' % idx)
-
-
-	def get_item_det(self, item_code):
-		item = sql("""select name, is_asset_item, is_purchase_item, docstatus, is_sub_contracted_item,
-			description, stock_uom, default_bom, last_purchase_rate, standard_rate, is_manufactured_item from `tabItem` 
-			where item_code = %s""", item_code, as_dict = 1)
-
-		return item
-
-
-	def get_item_detail(self, item_code):
-		""" Get stock uom and description for finished good item"""
-
-		item = self.get_item_det(item_code)
-		ret={
-			'description'	 : item and item[0]['description'] or '',
-			'uom'				: item and item[0]['stock_uom'] or ''
-		}
-		return ret
-
-
-
-	def get_workstation_details(self,workstation):
-		""" Fetch hour rate from workstation master"""
-
-		ws = sql("select hour_rate from `tabWorkstation` where name = %s",workstation , as_dict = 1)
-		ret = {
-			'hour_rate'				: ws and flt(ws[0]['hour_rate']) or '',
-		}
-		return ret
-
-
-
-	def validate_rm_item(self, item):
-		""" Validate raw material items"""
-
-		if item[0]['name'] == self.doc.item:
-			msgprint(" Item_code: "+item[0]['name']+" in materials tab cannot be same as FG Item in BOM := " +cstr(self.doc.name), raise_exception=1)
-		
-		if item and item[0]['is_asset_item'] == 'Yes':
-			msgprint("Sorry!!! Item " + item[0]['name'] + " is an Asset of the company. Entered in BOM => " + cstr(self.doc.name), raise_exception = 1)
-
-		if not item or item[0]['docstatus'] == 2:
-			msgprint("Item %s does not exist in system" % item[0]['item_code'], raise_exception = 1)
-
-
-
-	def get_bom_material_detail(self, arg):
-		""" Get raw material details like uom, desc and rate"""
-
-		arg = eval(arg)
-		item = self.get_item_det(arg['item_code'])
-		self.validate_rm_item(item)
-		
-		arg['bom_no'] = arg['bom_no'] or item and cstr(item[0]['default_bom']) or ''
-		arg.update(item[0])
-
-		rate = self.get_rm_rate(arg)
-		ret_item = {
-					 'description'  : item and arg['description'] or '',
-					 'stock_uom'	: item and arg['stock_uom'] or '',
-					 'bom_no'		: arg['bom_no'],
-					 'rate'			: rate
-		}
-		return ret_item
-
-
-
-	def get_rm_rate(self, arg):
-		"""	Get raw material rate as per selected method, if bom exists takes bom cost """
-
-		if arg['bom_no']:
-			bom = sql("""select name, total_cost/quantity as unit_cost from `tabBill Of Materials`
-				where is_active = 'Yes' and name = %s""", arg['bom_no'], as_dict=1)
-			rate = bom and bom[0]['unit_cost'] or 0
-		elif arg and (arg['is_purchase_item'] == 'Yes' or arg['is_sub_contracted_item'] == 'Yes'):
-			if self.doc.rm_cost_as_per == 'Valuation Rate':
-				rate = self.get_valuation_rate(arg)
-			elif self.doc.rm_cost_as_per == 'Last Purchase Rate':
-				rate = arg['last_purchase_rate']
-			elif self.doc.rm_cost_as_per == 'Standard Rate':
-				rate = arg['standard_rate']
-
-		return rate
-
-	
-
-	def get_valuation_rate(self, arg):
-		""" Get average valuation rate of relevant warehouses 
-			as per valuation method (MAR/FIFO) 
-			as on costing date	
-		"""
-
-		dt = self.doc.costing_date or nowdate()
-		time = self.doc.costing_date == nowdate() and now().split()[1] or '23:59'
-		warehouse = sql("select warehouse from `tabBin` where item_code = %s", arg['item_code'])
-		rate = []
-		for wh in warehouse:
-			r = get_obj('Valuation Control').get_incoming_rate(dt, time, arg['item_code'], wh[0], qty = arg.get('qty', 0))
-			if r:
-				rate.append(r)
-
-		return rate and flt(sum(rate))/len(rate) or 0
-
-
-
-	def manage_default_bom(self):
-		""" Uncheck others if current one is selected as default, update default bom in item master"""
-
-		if self.doc.is_default and self.doc.is_active == 'Yes':
-			sql("update `tabBill Of Materials` set is_default = 0 where name != %s and item=%s", (self.doc.name, self.doc.item))
-
-			# update default bom in Item Master
-			sql("update `tabItem` set default_bom = %s where name = %s", (self.doc.name, self.doc.item))
-		else:
-			sql("update `tabItem` set default_bom = '' where name = %s and default_bom = %s", (self.doc.item, self.doc.name))
-	
-
-
-	def manage_active_bom(self):
-		""" Manage active/inactive """
-		if self.doc.is_active == 'Yes':
-			self.validate()
-		else:
-			self.check_active_parent_boms()
-
-
-
-	def check_active_parent_boms(self):
-		""" Check parent BOM before making it inactive """
-		act_pbom = sql("""select distinct t1.parent from `tabBOM Material` t1, `tabBill Of Materials` t2 
-			where t1.bom_no =%s and t2.name = t1.parent and t2.is_active = 'Yes' 
-			and t2.docstatus = 1 and t1.docstatus =1 """, self.doc.name)
-		if act_pbom and act_pbom[0][0]:
-			msgprint("""Sorry cannot inactivate as BOM: %s is child 
-				of one or many other active parent BOMs""" % self.doc.name, raise_exception=1)
-
-
-
-	def calculate_cost(self):
-		"""Calculate bom totals"""
-		self.doc.costing_date = nowdate()
-		self.calculate_op_cost()
-		self.calculate_rm_cost()
-		self.doc.total_cost = self.doc.raw_material_cost + self.doc.operating_cost
-		self.doc.modified = now()
-		self.doc.save()
-
-		self.update_flat_bom_engine(is_submit = self.doc.docstatus)
-
-	
-
-	def calculate_op_cost(self):
-		"""Update workstation rate and calculates totals"""
-		total_op_cost = 0
-		for d in getlist(self.doclist, 'bom_operations'):
-			hour_rate = sql("select hour_rate from `tabWorkstation` where name = %s", d.workstation)
-			d.hour_rate = hour_rate and flt(hour_rate[0][0]) or 0
-			d.operating_cost = flt(d.hour_rate) * flt(d.time_in_mins) / 60
-			total_op_cost += d.operating_cost
-		self.doc.operating_cost = total_op_cost
-
-
-
-	def calculate_rm_cost(self):
-		"""Fetch RM rate as per today's valuation rate and calculate totals"""
-		total_rm_cost = 0
-		for d in getlist(self.doclist, 'bom_materials'):
-			#if self.doc.rm_cost_as_per == 'Valuation Rate':
-			arg = {'item_code': d.item_code, 'qty': d.qty, 'bom_no': d.bom_no}
-			ret = self.get_bom_material_detail(cstr(arg))
-			for k in ret:
-				d.fields[k] = ret[k]
-
-			d.amount = flt(d.rate) * flt(d.qty)
-			total_rm_cost += d.amount
-		self.doc.raw_material_cost = total_rm_cost
-
-
-
-	def validate_main_item(self):
-		""" Validate main FG item"""
-		item = self.get_item_det(self.doc.item)
-		if not item:
-			msgprint("Item %s does not exists in the system or expired." % self.doc.item, raise_exception = 1)
-
-		elif item[0]['is_manufactured_item'] != 'Yes' and item[0]['is_sub_contracted_item'] != 'Yes':
-			msgprint("""As Item: %s is not a manufactured / sub-contracted item, 
-				you can not make BOM for it""" % self.doc.item, raise_exception = 1)
-
-
-
-	def validate_operations(self):
-		""" Check duplicate operation no"""
-		self.op = []
-		for d in getlist(self.doclist, 'bom_operations'):
-			if cstr(d.operation_no) in self.op:
-				msgprint("Operation no: %s is repeated in Operations Table"% d.operation_no, raise_exception=1)
-			else:
-				# add operation in op list
-				self.op.append(cstr(d.operation_no))
-
-
-
-	def validate_materials(self):
-		""" Validate raw material entries """
-		check_list = []
-		for m in getlist(self.doclist, 'bom_materials'):
-			# check if operation no not in op table
-			if m.operation_no not in self.op:
-				msgprint("""Operation no: %s against item: %s at row no: %s is not present 
-					at Operations table"""% (m.operation_no, m.item_code, m.idx), raise_exception = 1)
-		
-			item = self.get_item_det(m.item_code)
-			if item[0]['is_manufactured_item'] == 'Yes' or item[0]['is_sub_contracted_item'] == 'Yes':
-				if not m.bom_no:
-					msgprint("Please enter BOM No aginst item: %s at row no: %s"% (m.item_code, m.idx), raise_exception=1)
-				else:
-					self.validate_bom_no(m.item_code, m.bom_no, m.idx)
-
-			elif m.bom_no:
-				msgprint("""As Item %s is not a manufactured / sub-contracted item, 
-					you can enter BOM against it (Row No: %s)."""% (m.item_code, m.idx), raise_excepiton = 1)
-
-			if flt(m.qty) <= 0:
-				msgprint("Please enter qty against raw material: %s at row no: %s"% (m.item_code, m.idx), raise_exception = 1)
-
-			self.check_if_item_repeated(m.item_code, m.operation_no, check_list)
-
-
-
-	def validate_bom_no(self, item, bom_no, idx):
-		"""Validate BOM No of sub-contracted items"""
-		bom = sql("""select name from `tabBill Of Materials` where name = %s and item = %s 
-			and ifnull(is_active, 'No') = 'Yes'	and docstatus < 2 """, (bom_no, item), as_dict =1)
-		if not bom:
-			msgprint("""Incorrect BOM No: %s against item: %s at row no: %s.
-				It may be inactive or cancelled or for some other item."""% (bom_no, item, idx), raise_exception = 1)
-				
-
-
-	def check_if_item_repeated(self, item, op, check_list):
-		if [cstr(item), cstr(op)] in check_list:
-			msgprint("Item %s has been entered twice against same operation" % item, raise_exception = 1)
-		else:
-			check_list.append([cstr(item), cstr(op)])
-
-
-
-	#----- Document on Save function------
-	def validate(self):
-		self.validate_main_item()
-		self.validate_operations()
-		self.validate_materials()
-		self.validate_operations()
-
-
-
-	def check_recursion(self):
-		""" Check whether reqursion occurs in any bom"""
-
-		check_list = [['parent', 'bom_no', 'parent'], ['bom_no', 'parent', 'child']]
-		for d in check_list:
-			bom_list, count = [self.doc.name], 0
-			while (len(bom_list) > count ):
-				boms = sql(" select %s from `tabBOM Material` where %s = '%s' " % (d[0], d[1], cstr(bom_list[count])))
-				count = count + 1
-				for b in boms:
-					if b[0] == self.doc.name:
-						msgprint("""Recursion Occured => '%s' cannot be '%s' of '%s'.
-							""" % (cstr(b), cstr(d[2]), self.doc.name), raise_exception = 1)
-					if b[0]:
-						bom_list.append(b[0])
-
-
-
-	def on_update(self):
-		if self.doc.item != cstr(self.doc.name.split('/')[1]):
-			msgprint("Cannot change Item once the Bill Of Material is created.")
-			raise Exception
-		self.check_recursion()
-
-
-
-	def add_to_flat_bom_detail(self, is_submit = 0):
-		"Add items to Flat BOM table"
-		self.doc.clear_table(self.doclist, 'flat_bom_details', 1)
-		for d in self.cur_flat_bom_items:
-			ch = addchild(self.doc, 'flat_bom_details', 'Flat BOM Detail', 1, self.doclist)
-			for i in d.keys():
-				ch.fields[i] = d[i]
-			ch.docstatus = is_submit
-			ch.save(1)
-		self.doc.save()
-
-
-
-	def get_child_flat_bom_items(self, bom_no, qty):
-		""" Add all items from Flat BOM of child BOM"""
-
-		child_fb_items = sql("""select item_code, description, stock_uom, qty, rate, amount, parent_bom, mat_detail_no, qty_consumed_per_unit 
-			from `tabFlat BOM Detail` where parent = '%s' and docstatus = 1""" % bom_no, as_dict = 1)
-		for d in child_fb_items:
-			self.cur_flat_bom_items.append({
-				'item_code'				: d['item_code'], 
-				'description'			: d['description'], 
-				'stock_uom'				: d['stock_uom'], 
-				'qty'					: flt(d['qty_consumed_per_unit'])*qty,
-				'rate'					: flt(d['rate']), 
-				'amount'				: flt(d['amount']),
-				'parent_bom'			: d['parent_bom'],
-				'mat_detail_no'			: d['mat_detail_no'],
-				'qty_consumed_per_unit' : flt(d['qty_consumed_per_unit'])*qty/flt(self.doc.quantity)
-
-			})
-
-
-
-
-	# Get Current Flat BOM Items
-	# -----------------------------
-	def get_current_flat_bom_items(self):
-		""" Get all raw materials including items from child bom"""
-		self.cur_flat_bom_items = []
-		for d in getlist(self.doclist, 'bom_materials'):
-			self.cur_flat_bom_items.append({
-				'item_code'				: d.item_code, 
-				'description'			: d.description, 
-				'stock_uom'				: d.stock_uom, 
-				'qty'					: flt(d.qty),
-				'rate'					: flt(d.rate), 
-				'amount'				: flt(d.amount),
-				'parent_bom'			: d.parent, #item and item[0][0]=='No' and d.bom_no or d.parent, 
-				'mat_detail_no'			: d.name,
-				'qty_consumed_per_unit' : flt(d.qty_consumed_per_unit)
-			})
-			if d.bom_no:
-				self.get_child_flat_bom_items(d.bom_no, d.qty)
-
-
-	def update_flat_bom_engine(self, is_submit = 0):
-		""" Update Flat BOM, following will be correct data"""
-		self.get_current_flat_bom_items()
-		self.add_to_flat_bom_detail(is_submit)
-
-
-	def get_parent_bom_list(self, bom_no):
-		p_bom = sql("select parent from `tabBOM Material` where bom_no = '%s'" % bom_no)
-		return p_bom and [i[0] for i in p_bom] or []
-
-
-	def on_submit(self):
-		self.manage_default_bom()
-		self.update_flat_bom_engine(1)
-
-
-	def on_cancel(self):
-		# check if used in any other bom
-		par = sql("""select t1.parent from `tabBOM Material` t1, `tabBill Of Materials` t2 
-			where t1.parent = t2.name and t1.bom_no = %s and t1.docstatus = 1 and t2.is_active = 'Yes'""", self.doc.name)
-		if par:
-			msgprint("BOM can not be cancelled, as it is a child item in following active BOM %s"% [d[0] for d in par])
-			raise Exception
diff --git a/erpnext/production/doctype/bill_of_materials/bill_of_materials.txt b/erpnext/production/doctype/bill_of_materials/bill_of_materials.txt
deleted file mode 100644
index cc29380..0000000
--- a/erpnext/production/doctype/bill_of_materials/bill_of_materials.txt
+++ /dev/null
@@ -1,440 +0,0 @@
-# DocType, Bill Of Materials
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:52',
-		'docstatus': 0,
-		'modified': '2012-01-24 19:49:00',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': '1326963484',
-		'allow_attach': 0,
-		'allow_copy': 0,
-		'allow_email': 0,
-		'allow_print': 0,
-		'allow_rename': 0,
-		'allow_trash': 1,
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
-		'doctype': 'DocType',
-		'document_type': 'Master',
-		'hide_heading': 0,
-		'hide_toolbar': 0,
-		'in_create': 0,
-		'issingle': 0,
-		'istable': 0,
-		'module': 'Production',
-		'name': '__common__',
-		'read_only': 0,
-		'search_fields': 'item',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'subject': '%(item)s',
-		'version': 196
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Bill Of Materials',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'amend': 0,
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'Bill Of Materials',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1
-	},
-
-	# DocType, Bill Of Materials
-	{
-		'doctype': 'DocType',
-		'name': 'Bill Of Materials'
-	},
-
-	# DocPerm
-	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'System Manager',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'permlevel': 1,
-		'role': 'System Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'Production Manager',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'permlevel': 1,
-		'role': 'Production Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'Production User',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'permlevel': 1,
-		'role': 'Production User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
-		'permlevel': 0,
-		'width': '50%'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'Select the item code for which Bill of Material is being created',
-		'doctype': 'DocField',
-		'fieldname': 'item',
-		'fieldtype': 'Link',
-		'in_filter': 1,
-		'label': 'Item',
-		'oldfieldname': 'item',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'Total quantity of items for which raw materials required and operations done will be defined',
-		'doctype': 'DocField',
-		'fieldname': 'quantity',
-		'fieldtype': 'Currency',
-		'label': 'Quantity',
-		'oldfieldname': 'quantity',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'uom',
-		'fieldtype': 'Select',
-		'label': 'UOM',
-		'options': 'link:UOM',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Text',
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Text',
-		'permlevel': 0,
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'permlevel': 0,
-		'width': '50%'
-	},
-
-	# DocField
-	{
-		'description': 'Select name of the project if Bill Of Materials need to be created against any project',
-		'doctype': 'DocField',
-		'fieldname': 'project_name',
-		'fieldtype': 'Link',
-		'in_filter': 1,
-		'label': 'Project Name',
-		'oldfieldname': 'project_name',
-		'oldfieldtype': 'Link',
-		'options': 'Project',
-		'permlevel': 0,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'is_active',
-		'fieldtype': 'Select',
-		'hidden': 0,
-		'label': 'Is Active',
-		'no_copy': 1,
-		'oldfieldname': 'is_active',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'is_default',
-		'fieldtype': 'Check',
-		'label': 'Is Default',
-		'no_copy': 1,
-		'oldfieldname': 'is_default',
-		'oldfieldtype': 'Check',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'maintained_by',
-		'fieldtype': 'Data',
-		'label': 'Maintained By',
-		'oldfieldname': 'maintained_by',
-		'oldfieldtype': 'Data',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'remarks',
-		'fieldtype': 'Text',
-		'label': 'Remarks',
-		'no_copy': 1,
-		'oldfieldname': 'remarks',
-		'oldfieldtype': 'Text',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Operations',
-		'oldfieldtype': 'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'Specify the operations, operating cost and give a unique Operation no to your operations.',
-		'doctype': 'DocField',
-		'fieldname': 'bom_operations',
-		'fieldtype': 'Table',
-		'label': 'BOM Operations',
-		'oldfieldname': 'bom_operations',
-		'oldfieldtype': 'Table',
-		'options': 'BOM Operation',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Materials',
-		'oldfieldtype': 'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'Enter the raw materials required to manufacture the BOM item. Specify the operation no as entered in the previous tab which will be performed on the raw materials entered.',
-		'doctype': 'DocField',
-		'fieldname': 'bom_materials',
-		'fieldtype': 'Table',
-		'label': 'BOM Material',
-		'oldfieldname': 'bom_materials',
-		'oldfieldtype': 'Table',
-		'options': 'BOM Material',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Costing',
-		'oldfieldtype': 'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'permlevel': 0,
-		'width': '50%'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'rm_cost_as_per',
-		'fieldtype': 'Select',
-		'label': 'Consider Raw Material Cost As Per',
-		'options': 'Valuation Rate\nLast Purchase Rate\nStandard Rate',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'costing_date',
-		'fieldtype': 'Date',
-		'label': 'Costing Date',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Update Cost as on today',
-		'options': 'calculate_cost',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'permlevel': 0,
-		'width': '50%'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'raw_material_cost',
-		'fieldtype': 'Float',
-		'label': 'Raw Material Cost',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'operating_cost',
-		'fieldtype': 'Float',
-		'label': 'Operating Cost',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'total_cost',
-		'fieldtype': 'Float',
-		'label': 'Total Cost',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'hidden': 1,
-		'options': 'Simple',
-		'permlevel': 0,
-		'print_hide': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'default': 'No Toolbar',
-		'doctype': 'DocField',
-		'fieldname': 'flat_bom_details',
-		'fieldtype': 'Table',
-		'hidden': 1,
-		'label': 'Flat BOM Detail',
-		'no_copy': 1,
-		'oldfieldname': 'flat_bom_details',
-		'oldfieldtype': 'Table',
-		'options': 'Flat BOM Detail',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'hidden': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
-		'permlevel': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/production/doctype/bom_material/__init__.py b/erpnext/production/doctype/bom/__init__.py
similarity index 100%
rename from erpnext/production/doctype/bom_material/__init__.py
rename to erpnext/production/doctype/bom/__init__.py
diff --git a/erpnext/production/doctype/bom/bom.js b/erpnext/production/doctype/bom/bom.js
new file mode 100644
index 0000000..81f9ae6
--- /dev/null
+++ b/erpnext/production/doctype/bom/bom.js
@@ -0,0 +1,164 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+// On REFRESH
+cur_frm.cscript.refresh = function(doc,dt,dn){
+	if(!doc.__islocal) {
+		set_field_permlevel('item',1);
+		unhide_field('update_cost_as_on_today');
+	} else {
+		hide_field('update_cost_as_on_today');
+	}
+}
+
+
+// Triggers
+//--------------------------------------------------------------------------------------------------
+cur_frm.cscript.item = function(doc, dt, dn) {
+	if (doc.item) {
+		get_server_fields('get_item_detail',doc.item,'',doc,dt,dn,1);
+	}
+}
+
+
+cur_frm.cscript.workstation = function(doc,dt,dn) {
+	var d = locals[dt][dn];
+	if (d.workstation) {
+		var callback = function(r, rt) {
+			calculate_op_cost(doc, dt, dn);
+			calculate_total(doc);
+		}
+		get_server_fields('get_workstation_details',d.workstation,'bom_operations',doc,dt,dn,1, callback);
+	}
+}
+
+
+cur_frm.cscript.hour_rate = function(doc, dt, dn) {
+	calculate_op_cost(doc, dt, dn);
+	calculate_total(doc);
+}
+
+
+cur_frm.cscript.time_in_mins = cur_frm.cscript.hour_rate;
+
+
+cur_frm.cscript.item_code = function(doc,dt,dn) {
+	get_bom_material_detail(doc, dt, dn);
+}
+
+
+cur_frm.cscript.bom_no  = function(doc,dt,dn) {
+	get_bom_material_detail(doc, dt, dn);
+}
+
+
+var get_bom_material_detail= function(doc,dt,dn) {
+	var d = locals[dt][dn];
+	var callback = function(doc, dt, dn) {
+		calculate_rm_cost(doc, dt, dn);
+		calculate_total(doc);
+	}
+
+	var bom_no = (d.bom_no!=null) ? d.bom_no:''
+	if (d.item_code) {
+		arg = {'item_code': d.item_code, 'bom_no': bom_no, 'qty': d.qty};
+		get_server_fields('get_bom_material_detail', JSON.stringify(arg), 'bom_materials', doc, dt, dn, 1, callback);
+	}
+}
+
+
+cur_frm.cscript.qty = function(doc, dt, dn) {
+	calculate_rm_cost(doc, dt, dn);
+	calculate_total(doc);
+}
+
+
+cur_frm.cscript.rate = cur_frm.cscript.qty;
+
+
+cur_frm.cscript.is_default = function(doc, dt, dn) {
+	if (doc.docstatus == 1)
+		$c_obj(make_doclist(dt, dn), 'manage_default_bom', '', '');
+}
+
+
+cur_frm.cscript.is_active = function(doc, dt, dn) {
+	if (!doc.__islocal)
+		$c_obj(make_doclist(dt, dn), 'manage_active_bom', '', '');
+}
+
+
+// Calculate Operating Cost
+var calculate_op_cost = function(doc, dt, dn) {  
+	var op = getchildren('BOM Operation', doc.name, 'bom_operations');
+	total_op_cost = 0;
+	for(var i=0;i<op.length;i++) {
+		op_cost =  flt(op[i].hour_rate) * flt(op[i].time_in_mins) / 60;
+		set_multiple('BOM Operation',op[i].name, {'operating_cost': op_cost}, 'bom_operations');
+		total_op_cost += op_cost;
+	}
+	doc.operating_cost = total_op_cost;
+	refresh_field('operating_cost');
+}
+
+
+// Calculate Raw Material Cost
+var calculate_rm_cost = function(doc, dt, dn) {  
+	var rm = getchildren('BOM Item', doc.name, 'bom_materials');
+	total_rm_cost = 0;
+	for(var i=0;i<rm.length;i++) {
+		amt =  flt(rm[i].rate) * flt(rm[i].qty);
+		set_multiple('BOM Item',rm[i].name, {'amount': amt}, 'bom_materials');
+		set_multiple('BOM Item',rm[i].name, {'qty_consumed_per_unit': flt(rm[i].qty)/flt(doc.quantity)}, 'bom_materials');
+		total_rm_cost += amt;
+	}
+	doc.raw_material_cost = total_rm_cost;
+	refresh_field('raw_material_cost');
+}
+
+
+// Calculate Total Cost
+var calculate_total = function(doc) {
+	doc.total_cost = flt(doc.raw_material_cost) + flt(doc.operating_cost);
+	refresh_field('total_cost');
+}
+
+
+
+// Get Query
+//-----------------------------------------------------------------------------------------------------
+cur_frm.fields_dict['item'].get_query = function(doc) {
+	return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.description FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.`%(key)s` like "%s" ORDER BY `tabItem`.`name` LIMIT 50';
+}
+
+cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) {
+	return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
+}
+
+cur_frm.fields_dict['bom_materials'].grid.get_field('item_code').get_query = function(doc) {
+	return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.description FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.`%(key)s` like "%s" ORDER BY `tabItem`.`name` LIMIT 50';
+}
+
+cur_frm.fields_dict['bom_materials'].grid.get_field('bom_no').get_query = function(doc) {
+	var d = locals[this.doctype][this.docname];
+	return 'SELECT DISTINCT `tabBOM`.`name`, `tabBOM`.`remarks` FROM `tabBOM` WHERE `tabBOM`.`item` = "' + d.item_code + '" AND `tabBOM`.`is_active` = "Yes" AND `tabBOM`.docstatus = 1 AND `tabBOM`.`name` like "%s" ORDER BY `tabBOM`.`name` LIMIT 50';
+}
+
+cur_frm.cscript.validate = function(doc, dt, dn) {
+	calculate_op_cost(doc, dt, dn);
+	calculate_rm_cost(doc, dt, dn);
+	calculate_total(doc);
+}
diff --git a/erpnext/production/doctype/bom/bom.py b/erpnext/production/doctype/bom/bom.py
new file mode 100644
index 0000000..89e4d4b
--- /dev/null
+++ b/erpnext/production/doctype/bom/bom.py
@@ -0,0 +1,404 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+import webnotes
+from webnotes.utils import cint, cstr, flt, get_defaults, getdate, now, nowdate
+from webnotes.model.doc import Document, addchild, getchildren, make_autoname
+from webnotes.model.doclist import getlist
+from webnotes.model.code import get_obj
+from webnotes import msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+
+# -----------------------------------------------------------------------------------------
+
+class DocType:
+	def __init__(self, doc, doclist=[]):
+		self.doc = doc
+		self.doclist = doclist
+
+	def autoname(self):
+		last_name = sql("select max(name) from `tabBOM` where name like 'BOM/%s/%%'" % self.doc.item)
+		if last_name:
+			idx = cint(cstr(last_name[0][0]).split('/')[-1]) + 1
+		else:
+			idx = 1
+		self.doc.name = 'BOM/' + self.doc.item + ('/%.3i' % idx)
+
+
+	def get_item_det(self, item_code):
+		item = sql("""select name, is_asset_item, is_purchase_item, docstatus, is_sub_contracted_item,
+			description, stock_uom, default_bom, last_purchase_rate, standard_rate, is_manufactured_item from `tabItem` 
+			where item_code = %s""", item_code, as_dict = 1)
+
+		return item
+
+
+	def get_item_detail(self, item_code):
+		""" Get stock uom and description for finished good item"""
+
+		item = self.get_item_det(item_code)
+		ret={
+			'description'	 : item and item[0]['description'] or '',
+			'uom'				: item and item[0]['stock_uom'] or ''
+		}
+		return ret
+
+
+
+	def get_workstation_details(self,workstation):
+		""" Fetch hour rate from workstation master"""
+
+		ws = sql("select hour_rate from `tabWorkstation` where name = %s",workstation , as_dict = 1)
+		ret = {
+			'hour_rate'				: ws and flt(ws[0]['hour_rate']) or '',
+		}
+		return ret
+
+
+
+	def validate_rm_item(self, item):
+		""" Validate raw material items"""
+
+		if item[0]['name'] == self.doc.item:
+			msgprint(" Item_code: "+item[0]['name']+" in materials tab cannot be same as FG Item in BOM := " +cstr(self.doc.name), raise_exception=1)
+		
+		if item and item[0]['is_asset_item'] == 'Yes':
+			msgprint("Sorry!!! Item " + item[0]['name'] + " is an Asset of the company. Entered in BOM => " + cstr(self.doc.name), raise_exception = 1)
+
+		if not item or item[0]['docstatus'] == 2:
+			msgprint("Item %s does not exist in system" % item[0]['item_code'], raise_exception = 1)
+
+
+
+	def get_bom_material_detail(self, arg):
+		""" Get raw material details like uom, desc and rate"""
+
+		arg = eval(arg)
+		item = self.get_item_det(arg['item_code'])
+		self.validate_rm_item(item)
+		
+		arg['bom_no'] = arg['bom_no'] or item and cstr(item[0]['default_bom']) or ''
+		arg.update(item[0])
+
+		rate = self.get_rm_rate(arg)
+		ret_item = {
+					 'description'  : item and arg['description'] or '',
+					 'stock_uom'	: item and arg['stock_uom'] or '',
+					 'bom_no'		: arg['bom_no'],
+					 'rate'			: rate
+		}
+		return ret_item
+
+
+
+	def get_rm_rate(self, arg):
+		"""	Get raw material rate as per selected method, if bom exists takes bom cost """
+
+		if arg['bom_no']:
+			bom = sql("""select name, total_cost/quantity as unit_cost from `tabBOM`
+				where is_active = 'Yes' and name = %s""", arg['bom_no'], as_dict=1)
+			rate = bom and bom[0]['unit_cost'] or 0
+		elif arg and (arg['is_purchase_item'] == 'Yes' or arg['is_sub_contracted_item'] == 'Yes'):
+			if self.doc.rm_cost_as_per == 'Valuation Rate':
+				rate = self.get_valuation_rate(arg)
+			elif self.doc.rm_cost_as_per == 'Last Purchase Rate':
+				rate = arg['last_purchase_rate']
+			elif self.doc.rm_cost_as_per == 'Standard Rate':
+				rate = arg['standard_rate']
+
+		return rate
+
+	
+
+	def get_valuation_rate(self, arg):
+		""" Get average valuation rate of relevant warehouses 
+			as per valuation method (MAR/FIFO) 
+			as on costing date	
+		"""
+
+		dt = self.doc.costing_date or nowdate()
+		time = self.doc.costing_date == nowdate() and now().split()[1] or '23:59'
+		warehouse = sql("select warehouse from `tabBin` where item_code = %s", arg['item_code'])
+		rate = []
+		for wh in warehouse:
+			r = get_obj('Valuation Control').get_incoming_rate(dt, time, arg['item_code'], wh[0], qty = arg.get('qty', 0))
+			if r:
+				rate.append(r)
+
+		return rate and flt(sum(rate))/len(rate) or 0
+
+
+
+	def manage_default_bom(self):
+		""" Uncheck others if current one is selected as default, update default bom in item master"""
+
+		if self.doc.is_default and self.doc.is_active == 'Yes':
+			sql("update `tabBOM` set is_default = 0 where name != %s and item=%s", (self.doc.name, self.doc.item))
+
+			# update default bom in Item Master
+			sql("update `tabItem` set default_bom = %s where name = %s", (self.doc.name, self.doc.item))
+		else:
+			sql("update `tabItem` set default_bom = '' where name = %s and default_bom = %s", (self.doc.item, self.doc.name))
+	
+
+
+	def manage_active_bom(self):
+		""" Manage active/inactive """
+		if self.doc.is_active == 'Yes':
+			self.validate()
+		else:
+			self.check_active_parent_boms()
+
+
+
+	def check_active_parent_boms(self):
+		""" Check parent BOM before making it inactive """
+		act_pbom = sql("""select distinct t1.parent from `tabBOM Item` t1, `tabBOM` t2 
+			where t1.bom_no =%s and t2.name = t1.parent and t2.is_active = 'Yes' 
+			and t2.docstatus = 1 and t1.docstatus =1 """, self.doc.name)
+		if act_pbom and act_pbom[0][0]:
+			msgprint("""Sorry cannot inactivate as BOM: %s is child 
+				of one or many other active parent BOMs""" % self.doc.name, raise_exception=1)
+
+
+
+	def calculate_cost(self):
+		"""Calculate bom totals"""
+		self.doc.costing_date = nowdate()
+		self.calculate_op_cost()
+		self.calculate_rm_cost()
+		self.doc.total_cost = self.doc.raw_material_cost + self.doc.operating_cost
+		self.doc.modified = now()
+		self.doc.save()
+
+		self.update_flat_bom_engine(is_submit = self.doc.docstatus)
+
+	
+
+	def calculate_op_cost(self):
+		"""Update workstation rate and calculates totals"""
+		total_op_cost = 0
+		for d in getlist(self.doclist, 'bom_operations'):
+			hour_rate = sql("select hour_rate from `tabWorkstation` where name = %s", cstr(d.workstation))
+			d.hour_rate = hour_rate and flt(hour_rate[0][0]) or 0
+			d.operating_cost = flt(d.hour_rate) * flt(d.time_in_mins) / 60
+			total_op_cost += d.operating_cost
+		self.doc.operating_cost = total_op_cost
+
+
+
+	def calculate_rm_cost(self):
+		"""Fetch RM rate as per today's valuation rate and calculate totals"""
+		total_rm_cost = 0
+		for d in getlist(self.doclist, 'bom_materials'):
+			#if self.doc.rm_cost_as_per == 'Valuation Rate':
+			arg = {'item_code': d.item_code, 'qty': d.qty, 'bom_no': d.bom_no}
+			ret = self.get_bom_material_detail(cstr(arg))
+			for k in ret:
+				d.fields[k] = ret[k]
+
+			d.amount = flt(d.rate) * flt(d.qty)
+			total_rm_cost += d.amount
+		self.doc.raw_material_cost = total_rm_cost
+
+
+
+	def validate_main_item(self):
+		""" Validate main FG item"""
+		item = self.get_item_det(self.doc.item)
+		if not item:
+			msgprint("Item %s does not exists in the system or expired." % self.doc.item, raise_exception = 1)
+
+		elif item[0]['is_manufactured_item'] != 'Yes' and item[0]['is_sub_contracted_item'] != 'Yes':
+			msgprint("""As Item: %s is not a manufactured / sub-contracted item, 
+				you can not make BOM for it""" % self.doc.item, raise_exception = 1)
+
+
+
+	def validate_operations(self):
+		""" Check duplicate operation no"""
+		self.op = []
+		for d in getlist(self.doclist, 'bom_operations'):
+			if cstr(d.operation_no) in self.op:
+				msgprint("Operation no: %s is repeated in Operations Table"% d.operation_no, raise_exception=1)
+			else:
+				# add operation in op list
+				self.op.append(cstr(d.operation_no))
+
+
+
+	def validate_materials(self):
+		""" Validate raw material entries """
+		check_list = []
+		for m in getlist(self.doclist, 'bom_materials'):
+			# check if operation no not in op table
+			if m.operation_no not in self.op:
+				msgprint("""Operation no: %s against item: %s at row no: %s is not present 
+					at Operations table"""% (m.operation_no, m.item_code, m.idx), raise_exception = 1)
+		
+			item = self.get_item_det(m.item_code)
+			if item[0]['is_manufactured_item'] == 'Yes' or item[0]['is_sub_contracted_item'] == 'Yes':
+				if not m.bom_no:
+					msgprint("Please enter BOM No aginst item: %s at row no: %s"% (m.item_code, m.idx), raise_exception=1)
+				else:
+					self.validate_bom_no(m.item_code, m.bom_no, m.idx)
+
+			elif m.bom_no:
+				msgprint("""As Item %s is not a manufactured / sub-contracted item, 
+					you can enter BOM against it (Row No: %s)."""% (m.item_code, m.idx), raise_excepiton = 1)
+
+			if flt(m.qty) <= 0:
+				msgprint("Please enter qty against raw material: %s at row no: %s"% (m.item_code, m.idx), raise_exception = 1)
+
+			self.check_if_item_repeated(m.item_code, m.operation_no, check_list)
+
+
+
+	def validate_bom_no(self, item, bom_no, idx):
+		"""Validate BOM No of sub-contracted items"""
+		bom = sql("""select name from `tabBOM` where name = %s and item = %s 
+			and ifnull(is_active, 'No') = 'Yes'	and docstatus < 2 """, (bom_no, item), as_dict =1)
+		if not bom:
+			msgprint("""Incorrect BOM No: %s against item: %s at row no: %s.
+				It may be inactive or cancelled or for some other item."""% (bom_no, item, idx), raise_exception = 1)
+				
+
+
+	def check_if_item_repeated(self, item, op, check_list):
+		if [cstr(item), cstr(op)] in check_list:
+			msgprint("Item %s has been entered twice against same operation" % item, raise_exception = 1)
+		else:
+			check_list.append([cstr(item), cstr(op)])
+
+
+
+	#----- Document on Save function------
+	def validate(self):
+		self.validate_main_item()
+		self.validate_operations()
+		self.validate_materials()
+		self.validate_operations()
+
+
+
+	def check_recursion(self):
+		""" Check whether reqursion occurs in any bom"""
+
+		check_list = [['parent', 'bom_no', 'parent'], ['bom_no', 'parent', 'child']]
+		for d in check_list:
+			bom_list, count = [self.doc.name], 0
+			while (len(bom_list) > count ):
+				boms = sql(" select %s from `tabBOM Item` where %s = '%s' " % (d[0], d[1], cstr(bom_list[count])))
+				count = count + 1
+				for b in boms:
+					if b[0] == self.doc.name:
+						msgprint("""Recursion Occured => '%s' cannot be '%s' of '%s'.
+							""" % (cstr(b), cstr(d[2]), self.doc.name), raise_exception = 1)
+					if b[0]:
+						bom_list.append(b[0])
+
+
+
+	def on_update(self):
+		if self.doc.item != cstr(self.doc.name.split('/')[1]):
+			msgprint("Cannot change Item once the Bill Of Material is created.")
+			raise Exception
+		self.check_recursion()
+
+
+
+	def add_to_flat_bom_detail(self, is_submit = 0):
+		"Add items to Flat BOM table"
+		self.doc.clear_table(self.doclist, 'flat_bom_details', 1)
+		for d in self.cur_flat_bom_items:
+			ch = addchild(self.doc, 'flat_bom_details', 'BOM Explosion Item', 1, self.doclist)
+			for i in d.keys():
+				ch.fields[i] = d[i]
+			ch.docstatus = is_submit
+			ch.save(1)
+		self.doc.save()
+
+
+
+	def get_child_flat_bom_items(self, bom_no, qty):
+		""" Add all items from Flat BOM of child BOM"""
+
+		child_fb_items = sql("""select item_code, description, stock_uom, qty, rate, amount, parent_bom, mat_detail_no, qty_consumed_per_unit 
+			from `tabBOM Explosion Item` where parent = '%s' and docstatus = 1""" % bom_no, as_dict = 1)
+		for d in child_fb_items:
+			self.cur_flat_bom_items.append({
+				'item_code'				: d['item_code'], 
+				'description'			: d['description'], 
+				'stock_uom'				: d['stock_uom'], 
+				'qty'					: flt(d['qty_consumed_per_unit'])*qty,
+				'rate'					: flt(d['rate']), 
+				'amount'				: flt(d['amount']),
+				'parent_bom'			: d['parent_bom'],
+				'mat_detail_no'			: d['mat_detail_no'],
+				'qty_consumed_per_unit' : flt(d['qty_consumed_per_unit'])*qty/flt(self.doc.quantity)
+
+			})
+
+
+
+
+	# Get Current Flat BOM Items
+	# -----------------------------
+	def get_current_flat_bom_items(self):
+		""" Get all raw materials including items from child bom"""
+		self.cur_flat_bom_items = []
+		for d in getlist(self.doclist, 'bom_materials'):
+			self.cur_flat_bom_items.append({
+				'item_code'				: d.item_code, 
+				'description'			: d.description, 
+				'stock_uom'				: d.stock_uom, 
+				'qty'					: flt(d.qty),
+				'rate'					: flt(d.rate), 
+				'amount'				: flt(d.amount),
+				'parent_bom'			: d.parent, #item and item[0][0]=='No' and d.bom_no or d.parent, 
+				'mat_detail_no'			: d.name,
+				'qty_consumed_per_unit' : flt(d.qty_consumed_per_unit)
+			})
+			if d.bom_no:
+				self.get_child_flat_bom_items(d.bom_no, d.qty)
+
+
+	def update_flat_bom_engine(self, is_submit = 0):
+		""" Update Flat BOM, following will be correct data"""
+		self.get_current_flat_bom_items()
+		self.add_to_flat_bom_detail(is_submit)
+
+
+	def get_parent_bom_list(self, bom_no):
+		p_bom = sql("select parent from `tabBOM Item` where bom_no = '%s'" % bom_no)
+		return p_bom and [i[0] for i in p_bom] or []
+
+
+	def on_submit(self):
+		self.manage_default_bom()
+		self.update_flat_bom_engine(1)
+
+
+	def on_cancel(self):
+		# check if used in any other bom
+		par = sql("""select t1.parent from `tabBOM Item` t1, `tabBOM` t2 
+			where t1.parent = t2.name and t1.bom_no = %s and t1.docstatus = 1 and t2.is_active = 'Yes'""", self.doc.name)
+		if par:
+			msgprint("BOM can not be cancelled, as it is a child item in following active BOM %s"% [d[0] for d in par])
+			raise Exception
diff --git a/erpnext/production/doctype/bom/bom.txt b/erpnext/production/doctype/bom/bom.txt
new file mode 100644
index 0000000..646321e
--- /dev/null
+++ b/erpnext/production/doctype/bom/bom.txt
@@ -0,0 +1,462 @@
+# DocType, BOM
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:02',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:45:46',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': u'1326963484',
+		'allow_attach': 0,
+		'allow_copy': 0,
+		'allow_email': 0,
+		'allow_print': 0,
+		'allow_rename': 0,
+		'allow_trash': 1,
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'document_type': u'Master',
+		'hide_heading': 0,
+		'hide_toolbar': 0,
+		'in_create': 0,
+		'is_submittable': 1,
+		'issingle': 0,
+		'istable': 0,
+		'module': u'Production',
+		'name': '__common__',
+		'read_only': 0,
+		'search_fields': u'item',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'subject': u'%(item)s',
+		'version': 196
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'BOM',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'BOM',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1
+	},
+
+	# DocType, BOM
+	{
+		'doctype': 'DocType',
+		'name': u'BOM'
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'System Manager',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'System Manager'
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Production Manager',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Production Manager'
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Production User',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Production User'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Select the item code for which Bill of Material is being created',
+		'doctype': u'DocField',
+		'fieldname': u'item',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Item',
+		'oldfieldname': u'item',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Total quantity of items for which raw materials required and operations done will be defined',
+		'doctype': u'DocField',
+		'fieldname': u'quantity',
+		'fieldtype': u'Currency',
+		'label': u'Quantity',
+		'oldfieldname': u'quantity',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'uom',
+		'fieldtype': u'Select',
+		'label': u'UOM',
+		'options': u'link:UOM',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Text',
+		'permlevel': 0,
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'description': u'Select name of the project if BOM need to be created against any project',
+		'doctype': u'DocField',
+		'fieldname': u'project_name',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Project Name',
+		'oldfieldname': u'project_name',
+		'oldfieldtype': u'Link',
+		'options': u'Project',
+		'permlevel': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'is_active',
+		'fieldtype': u'Select',
+		'hidden': 0,
+		'label': u'Is Active',
+		'no_copy': 1,
+		'oldfieldname': u'is_active',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'is_default',
+		'fieldtype': u'Check',
+		'label': u'Is Default',
+		'no_copy': 1,
+		'oldfieldname': u'is_default',
+		'oldfieldtype': u'Check',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'maintained_by',
+		'fieldtype': u'Data',
+		'label': u'Maintained By',
+		'oldfieldname': u'maintained_by',
+		'oldfieldtype': u'Data',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'remarks',
+		'fieldtype': u'Text',
+		'label': u'Remarks',
+		'no_copy': 1,
+		'oldfieldname': u'remarks',
+		'oldfieldtype': u'Text',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'operations',
+		'fieldtype': u'Section Break',
+		'label': u'Operations',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Specify the operations, operating cost and give a unique Operation no to your operations.',
+		'doctype': u'DocField',
+		'fieldname': u'bom_operations',
+		'fieldtype': u'Table',
+		'label': u'BOM Operations',
+		'oldfieldname': u'bom_operations',
+		'oldfieldtype': u'Table',
+		'options': u'BOM Operation',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'materials',
+		'fieldtype': u'Section Break',
+		'label': u'Materials',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Enter the raw materials required to manufacture the BOM item. Specify the operation no as entered in the previous tab which will be performed on the raw materials entered.',
+		'doctype': u'DocField',
+		'fieldname': u'bom_materials',
+		'fieldtype': u'Table',
+		'label': u'BOM Item',
+		'oldfieldname': u'bom_materials',
+		'oldfieldtype': u'Table',
+		'options': u'BOM Item',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'costing',
+		'fieldtype': u'Section Break',
+		'label': u'Costing',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break2',
+		'fieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'rm_cost_as_per',
+		'fieldtype': u'Select',
+		'label': u'Consider Raw Material Cost As Per',
+		'options': u'Valuation Rate\nLast Purchase Rate\nStandard Rate',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'costing_date',
+		'fieldtype': u'Date',
+		'label': u'Costing Date',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'doctype': u'DocField',
+		'fieldname': u'update_cost_as_on_today',
+		'fieldtype': u'Button',
+		'label': u'Update Cost as on today',
+		'options': u'calculate_cost',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break3',
+		'fieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'raw_material_cost',
+		'fieldtype': u'Float',
+		'label': u'Raw Material Cost',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'operating_cost',
+		'fieldtype': u'Float',
+		'label': u'Operating Cost',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'total_cost',
+		'fieldtype': u'Float',
+		'label': u'Total Cost',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'section_break0',
+		'fieldtype': u'Section Break',
+		'hidden': 1,
+		'options': u'Simple',
+		'permlevel': 0,
+		'print_hide': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'No Toolbar',
+		'doctype': u'DocField',
+		'fieldname': u'flat_bom_details',
+		'fieldtype': u'Table',
+		'hidden': 1,
+		'label': u'BOM Explosion Item',
+		'no_copy': 1,
+		'oldfieldname': u'flat_bom_details',
+		'oldfieldtype': u'Table',
+		'options': u'BOM Explosion Item',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'hidden': 1,
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'depends_on': u'eval:doc.amended_from',
+		'description': u'The date at which current entry is corrected in the system.',
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
+		'label': u'Amendment Date',
+		'no_copy': 1,
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Link',
+		'label': u'Amended From',
+		'no_copy': 1,
+		'options': u'Sales Invoice',
+		'permlevel': 1,
+		'print_hide': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/production/doctype/bom_control/bom_control.py b/erpnext/production/doctype/bom_control/bom_control.py
index d8a9e59..8123fcc 100644
--- a/erpnext/production/doctype/bom_control/bom_control.py
+++ b/erpnext/production/doctype/bom_control/bom_control.py
@@ -44,7 +44,7 @@
 		ret = sql("select name from `tabItem Group` ")
 		item_group = []
 		for r in ret:
-			item =sql("select t1.name from `tabItem` t1, `tabBill Of Materials` t2 where t2.item = t1.name and t1.item_group = '%s' " % (r[0]))
+			item =sql("select t1.name from `tabItem` t1, `tabBOM` t2 where t2.item = t1.name and t1.item_group = '%s' " % (r[0]))
 			if item and item[0][0]:
 				item_group.append(r[0])
 		return '~~~'.join([r for r in item_group])
@@ -52,23 +52,23 @@
 
 
 	def get_item_code(self,item_group):
-		""" here Bill Of Materials docstatus = 1 and is_active ='yes' condition is not given because some bom
+		""" here BOM docstatus = 1 and is_active ='yes' condition is not given because some bom
 			is under construction that is it is still in saved mode and they want see till where they have reach.
 		"""
-		ret = sql("select distinct t1.name from `tabItem` t1, `tabBill Of Materials` t2 where t2.item = t1.name and t1.item_group = '%s' " % (item_group))
+		ret = sql("select distinct t1.name from `tabItem` t1, `tabBOM` t2 where t2.item = t1.name and t1.item_group = '%s' " % (item_group))
 		return '~~~'.join([r[0] for r in ret])
 
 
 
 	def get_bom_no(self,item_code):
-		ret = sql("select name from `tabBill Of Materials` where item = '%s' " % (item_code))
+		ret = sql("select name from `tabBOM` where item = '%s' " % (item_code))
 		return '~~~'.join([r[0] for r in ret])
 
 
 
 	def get_operations(self,bom_no):
 		ret = sql("select operation_no,opn_description,workstation,hour_rate,time_in_mins from `tabBOM Operation` where parent = %s", bom_no, as_dict = 1)
-		cost = sql("select dir_mat_as_per_mar , operating_cost , cost_as_per_mar from `tabBill Of Materials` where name = %s", bom_no, as_dict = 1)
+		cost = sql("select dir_mat_as_per_mar , operating_cost , cost_as_per_mar from `tabBOM` where name = %s", bom_no, as_dict = 1)
 
 		# Validate the BOM ENTRIES
 		reply = []
@@ -87,7 +87,7 @@
 	def get_item_bom(self,data):
 		data = eval(data)
 		reply = []
-		ret = sql("select item_code,description,bom_no,qty,scrap,stock_uom,value_as_per_mar,moving_avg_rate from `tabBOM Material` where parent = '%s' and operation_no = '%s'" % (data['bom_no'],data['op_no']), as_dict =1 )
+		ret = sql("select item_code,description,bom_no,qty,scrap,stock_uom,value_as_per_mar,moving_avg_rate from `tabBOM Item` where parent = '%s' and operation_no = '%s'" % (data['bom_no'],data['op_no']), as_dict =1 )
 
 		for r in ret:
 			item = sql("select is_manufactured_item, is_sub_contracted_item from `tabItem` where name = '%s'" % r['item_code'], as_dict=1)
@@ -106,7 +106,7 @@
 		main_bom_list = get_obj('Production Control').traverse_bom_tree( bom_no = bom_no, qty = 1, calculate_cost = 1)
 		main_bom_list.reverse()
 		for bom in main_bom_list:
-			bom_obj = get_obj('Bill Of Materials', bom, with_children = 1)
+			bom_obj = get_obj('BOM', bom, with_children = 1)
 			bom_obj.calculate_cost()
 		return 'calculated'
 
@@ -115,7 +115,7 @@
 	def get_bom_tree_list(self,args):
 		arg = eval(args)
 		i =[]
-		for a in sql("select t1.name from `tabBill Of Materials` t1, `tabItem` t2 where t2.item_group like '%s' and t1.item like '%s'"%(arg['item_group'] +'%',arg['item_code'] + '%')):
+		for a in sql("select t1.name from `tabBOM` t1, `tabItem` t2 where t2.item_group like '%s' and t1.item like '%s'"%(arg['item_group'] +'%',arg['item_code'] + '%')):
 			if a[0] not in i:
 				i.append(a[0])
 		return i
diff --git a/erpnext/production/doctype/bom_control/bom_control.txt b/erpnext/production/doctype/bom_control/bom_control.txt
index 127d997..3c322e1 100644
--- a/erpnext/production/doctype/bom_control/bom_control.txt
+++ b/erpnext/production/doctype/bom_control/bom_control.txt
@@ -3,22 +3,22 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:53',
+		'creation': '2012-03-27 14:36:02',
 		'docstatus': 0,
-		'modified': '2012-01-24 20:56:54',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:02',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'issingle': 1,
-		'module': 'Production',
+		'module': u'Production',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 108
 	},
@@ -26,6 +26,6 @@
 	# DocType, BOM Control
 	{
 		'doctype': 'DocType',
-		'name': 'BOM Control'
+		'name': u'BOM Control'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/production/doctype/bom_material/__init__.py b/erpnext/production/doctype/bom_explosion_item/__init__.py
similarity index 100%
copy from erpnext/production/doctype/bom_material/__init__.py
copy to erpnext/production/doctype/bom_explosion_item/__init__.py
diff --git a/erpnext/production/doctype/bom_explosion_item/bom_explosion_item.txt b/erpnext/production/doctype/bom_explosion_item/bom_explosion_item.txt
new file mode 100644
index 0000000..1ba688f
--- /dev/null
+++ b/erpnext/production/doctype/bom_explosion_item/bom_explosion_item.txt
@@ -0,0 +1,138 @@
+# DocType, BOM Explosion Item
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:03',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:03',
+		'modified_by': u'Administrator',
+		'owner': u'jai@webnotestech.com'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'FBD/.######',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Production',
+		'name': '__common__',
+		'read_only': 0,
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 24
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'BOM Explosion Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# DocType, BOM Explosion Item
+	{
+		'doctype': 'DocType',
+		'name': u'BOM Explosion Item'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Text',
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'qty',
+		'fieldtype': u'Float',
+		'label': u'Qty',
+		'oldfieldname': u'qty',
+		'oldfieldtype': u'Currency'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'rate',
+		'fieldtype': u'Float',
+		'label': u'Rate',
+		'oldfieldname': u'standard_rate',
+		'oldfieldtype': u'Currency'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amount',
+		'fieldtype': u'Float',
+		'label': u'Amount',
+		'oldfieldname': u'amount_as_per_sr',
+		'oldfieldtype': u'Currency'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'stock_uom',
+		'fieldtype': u'Link',
+		'label': u'Stock UOM',
+		'oldfieldname': u'stock_uom',
+		'oldfieldtype': u'Link',
+		'options': u'UOM'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'parent_bom',
+		'fieldtype': u'Link',
+		'hidden': 0,
+		'label': u'Parent BOM',
+		'oldfieldname': u'parent_bom',
+		'oldfieldtype': u'Link',
+		'width': u'250px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'mat_detail_no',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Mat Detail No'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'qty_consumed_per_unit',
+		'fieldtype': u'Float',
+		'hidden': 0,
+		'label': u'Qty Consumed Per Unit',
+		'no_copy': 0
+	}
+]
\ No newline at end of file
diff --git a/erpnext/production/doctype/bom_material/__init__.py b/erpnext/production/doctype/bom_item/__init__.py
similarity index 100%
copy from erpnext/production/doctype/bom_material/__init__.py
copy to erpnext/production/doctype/bom_item/__init__.py
diff --git a/erpnext/production/doctype/bom_item/bom_item.txt b/erpnext/production/doctype/bom_item/bom_item.txt
new file mode 100644
index 0000000..741de0e
--- /dev/null
+++ b/erpnext/production/doctype/bom_item/bom_item.txt
@@ -0,0 +1,194 @@
+# DocType, BOM Item
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:02',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:02',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Production',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 27
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'BOM Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'BOM Item',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1,
+		'role': u'System Manager'
+	},
+
+	# DocType, BOM Item
+	{
+		'doctype': 'DocType',
+		'name': u'BOM Item'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'operation_no',
+		'fieldtype': u'Data',
+		'label': u'Operation No',
+		'oldfieldname': u'operation_no',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'bom_no',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'BOM No',
+		'oldfieldname': u'bom_no',
+		'oldfieldtype': u'Link',
+		'options': u'BOM',
+		'permlevel': 0,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': u'Client',
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'qty',
+		'fieldtype': u'Float',
+		'label': u'Qty',
+		'oldfieldname': u'qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'reqd': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'stock_uom',
+		'fieldtype': u'Data',
+		'label': u'Stock UOM',
+		'oldfieldname': u'stock_uom',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'rate',
+		'fieldtype': u'Float',
+		'label': u'Rate',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amount',
+		'fieldtype': u'Float',
+		'label': u'Amount',
+		'oldfieldname': u'amount_as_per_mar',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'scrap',
+		'fieldtype': u'Currency',
+		'label': u'Scrap %',
+		'oldfieldname': u'scrap',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Text',
+		'label': u'Item Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Text',
+		'permlevel': 0,
+		'reqd': 0,
+		'width': u'250px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'qty_consumed_per_unit',
+		'fieldtype': u'Float',
+		'hidden': 1,
+		'label': u'Qty Consumed Per Unit',
+		'oldfieldname': u'qty_consumed_per_unit',
+		'oldfieldtype': u'Float',
+		'permlevel': 1,
+		'print_hide': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/production/doctype/bom_material/bom_material.txt b/erpnext/production/doctype/bom_material/bom_material.txt
deleted file mode 100644
index ebef2b4..0000000
--- a/erpnext/production/doctype/bom_material/bom_material.txt
+++ /dev/null
@@ -1,194 +0,0 @@
-# DocType, BOM Material
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:53',
-		'docstatus': 0,
-		'modified': '2012-01-24 19:47:34',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Production',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 27
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'BOM Material',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'BOM Material',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1,
-		'role': 'System Manager'
-	},
-
-	# DocType, BOM Material
-	{
-		'doctype': 'DocType',
-		'name': 'BOM Material'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'operation_no',
-		'fieldtype': 'Data',
-		'label': 'Operation No',
-		'oldfieldname': 'operation_no',
-		'oldfieldtype': 'Data',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'item_code',
-		'fieldtype': 'Link',
-		'in_filter': 1,
-		'label': 'Item Code',
-		'oldfieldname': 'item_code',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'bom_no',
-		'fieldtype': 'Link',
-		'in_filter': 1,
-		'label': 'BOM No',
-		'oldfieldname': 'bom_no',
-		'oldfieldtype': 'Link',
-		'options': 'Bill Of Materials',
-		'permlevel': 0,
-		'reqd': 0,
-		'search_index': 1,
-		'trigger': 'Client',
-		'width': '150px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'qty',
-		'fieldtype': 'Float',
-		'label': 'Qty',
-		'oldfieldname': 'qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'stock_uom',
-		'fieldtype': 'Data',
-		'label': 'Stock UOM',
-		'oldfieldname': 'stock_uom',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'rate',
-		'fieldtype': 'Float',
-		'label': 'Rate',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'amount',
-		'fieldtype': 'Float',
-		'label': 'Amount',
-		'oldfieldname': 'amount_as_per_mar',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1,
-		'width': '150px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'scrap',
-		'fieldtype': 'Currency',
-		'label': 'Scrap %',
-		'oldfieldname': 'scrap',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Text',
-		'label': 'Item Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Text',
-		'permlevel': 0,
-		'reqd': 0,
-		'width': '250px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'qty_consumed_per_unit',
-		'fieldtype': 'Float',
-		'hidden': 1,
-		'label': 'Qty Consumed Per Unit',
-		'oldfieldname': 'qty_consumed_per_unit',
-		'oldfieldtype': 'Float',
-		'permlevel': 1,
-		'print_hide': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/production/doctype/bom_operation/bom_operation.txt b/erpnext/production/doctype/bom_operation/bom_operation.txt
index f3cc659..1e5b93a 100644
--- a/erpnext/production/doctype/bom_operation/bom_operation.txt
+++ b/erpnext/production/doctype/bom_operation/bom_operation.txt
@@ -3,133 +3,133 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:53',
+		'creation': '2012-03-27 14:36:02',
 		'docstatus': 0,
-		'modified': '2011-12-28 12:28:02',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:02',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Production',
+		'module': u'Production',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 8
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'BOM Operation',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'BOM Operation',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'BOM Operation',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'BOM Operation',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1,
-		'role': 'System Manager'
+		'role': u'System Manager'
 	},
 
 	# DocType, BOM Operation
 	{
 		'doctype': 'DocType',
-		'name': 'BOM Operation'
+		'name': u'BOM Operation'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'operation_no',
-		'fieldtype': 'Data',
-		'label': 'Operation No',
-		'oldfieldname': 'operation_no',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'operation_no',
+		'fieldtype': u'Data',
+		'label': u'Operation No',
+		'oldfieldname': u'operation_no',
+		'oldfieldtype': u'Data',
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'opn_description',
-		'fieldtype': 'Text',
-		'label': 'Opn Description',
-		'oldfieldname': 'opn_description',
-		'oldfieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'opn_description',
+		'fieldtype': u'Text',
+		'label': u'Opn Description',
+		'oldfieldname': u'opn_description',
+		'oldfieldtype': u'Text',
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'workstation',
-		'fieldtype': 'Link',
-		'label': 'Workstation',
-		'oldfieldname': 'workstation',
-		'oldfieldtype': 'Link',
-		'options': 'Workstation',
+		'doctype': u'DocField',
+		'fieldname': u'workstation',
+		'fieldtype': u'Link',
+		'label': u'Workstation',
+		'oldfieldname': u'workstation',
+		'oldfieldtype': u'Link',
+		'options': u'Workstation',
 		'reqd': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'hour_rate',
-		'fieldtype': 'Currency',
-		'label': 'Hour Rate',
-		'oldfieldname': 'hour_rate',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'hour_rate',
+		'fieldtype': u'Currency',
+		'label': u'Hour Rate',
+		'oldfieldname': u'hour_rate',
+		'oldfieldtype': u'Currency',
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'time_in_mins',
-		'fieldtype': 'Currency',
-		'label': 'Operation Time (mins)',
-		'oldfieldname': 'time_in_mins',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'time_in_mins',
+		'fieldtype': u'Currency',
+		'label': u'Operation Time (mins)',
+		'oldfieldname': u'time_in_mins',
+		'oldfieldtype': u'Currency',
 		'reqd': 0
 	},
 
 	# DocField
 	{
 		'allow_on_submit': 0,
-		'doctype': 'DocField',
-		'fieldname': 'operating_cost',
-		'fieldtype': 'Currency',
-		'label': 'Operating Cost',
-		'oldfieldname': 'operating_cost',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'operating_cost',
+		'fieldtype': u'Currency',
+		'label': u'Operating Cost',
+		'oldfieldname': u'operating_cost',
+		'oldfieldtype': u'Currency',
 		'reqd': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/production/doctype/bom_replace_utility/__init__.py b/erpnext/production/doctype/bom_replace_utility/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/production/doctype/bom_replace_utility/__init__.py
+++ /dev/null
diff --git a/erpnext/production/doctype/bom_replace_utility/bom_replace_utility.js b/erpnext/production/doctype/bom_replace_utility/bom_replace_utility.js
deleted file mode 100644
index 41cb17c..0000000
--- a/erpnext/production/doctype/bom_replace_utility/bom_replace_utility.js
+++ /dev/null
@@ -1,36 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-
-// Get Query functions 
-cur_frm.fields_dict['s_bom'].get_query = function(doc) {
-  return 'SELECT `tabBill Of Materials`.`name` FROM `tabBill Of Materials` WHERE `tabBill Of Materials`.`docstatus` = 1 AND `tabBill Of Materials`.%(key)s LIKE "%s" ORDER BY `tabBill Of Materials`.`name` DESC LIMIT 50';
-}
-
-cur_frm.fields_dict['r_bom'].get_query = function(doc) {
-  return 'SELECT `tabBill Of Materials`.`name` FROM `tabBill Of Materials` WHERE `tabBill Of Materials`.`docstatus` = 1 and `tabBill Of Materials`.%(key)s LIKE "%s" ORDER BY `tabBill Of Materials`.`name` DESC LIMIT 50';
-}
-
-cur_frm.fields_dict['s_item'].get_query = function(doc) {
-  return 'SELECT DISTINCT `tabItem`.name FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND (`tabItem`.is_purchase_item = "Yes" OR`tabItem`.is_sub_contracted_item = "Yes") AND tabItem.%(key)s LIKE "%s" ORDER BY `tabItem`.item_code LIMIT 50';
-}
-
-cur_frm.fields_dict['r_item'].get_query = function(doc) {
-  return 'SELECT DISTINCT `tabItem`.name FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND (`tabItem`.is_purchase_item = "Yes" OR`tabItem`.is_sub_contracted_item = "Yes") AND tabItem.%(key)s LIKE "%s" ORDER BY `tabItem`.item_code LIMIT 50';
-}
-
-// Client Triggers
-
diff --git a/erpnext/production/doctype/bom_replace_utility/bom_replace_utility.py b/erpnext/production/doctype/bom_replace_utility/bom_replace_utility.py
deleted file mode 100644
index c7ab0d3..0000000
--- a/erpnext/production/doctype/bom_replace_utility/bom_replace_utility.py
+++ /dev/null
@@ -1,143 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-	
-# -----------------------------------------------------------------------------------------
-
-
-class DocType:
-  def __init__(self, doc, doclist=[]):
-    self.doc = doc
-    self.doclist = doclist
-    
-  def search_parent_bom_of_bom(self):
-    pbom = sql("select parent from `tabBOM Material` where bom_no = '%s' and docstatus = 1 " % self.doc.s_bom )
-    self.doc.clear_table(self.doclist,'replace_bom_details', 1)
-    self.add_to_replace_bom_utility_detail(pbom, 'replace_bom_details')
-  
-  def search_parent_bom_of_item(self):
-    pbom = sql("select parent from `tabBOM Material` where item_code = '%s' and (bom_no is NULL or bom_no = '') and docstatus =1" % self.doc.s_item )
-    self.doc.clear_table(self.doclist,'replace_item_details', 1)
-    self.add_to_replace_bom_utility_detail(pbom, 'replace_item_details')
-    
-  def add_to_replace_bom_utility_detail(self, pbom, t_fname):
-    for d in pbom:
-      br_child = addchild( self.doc, t_fname, 'BOM Replace Utility Detail', 0,self.doclist)
-      br_child.parent_bom = d[0]
-      br_child.save()
-    self.doc.save()  
-    
-  def replace_bom(self):
-    # validate r_bom
-    bom = sql("select name, is_active, docstatus from `tabBill Of Materials` where name = %s",self.doc.r_bom, as_dict =1)
-    if not bom:
-      msgprint("Please Enter Valid BOM to replace with.")
-      raise Exception
-    if bom and bom[0]['is_active'] != 'Yes':
-      msgprint("BOM '%s' is not Active BOM." % cstr(self.doc.r_bom))
-      raise Exception
-    if bom and flt(bom[0]['docstatus']) != 1:
-      msgprint("BOM '%s' is not Submitted BOM." % cstr(self.doc.r_bom))
-      raise Exception
-    
-    # get item code of r_bom
-    item_code = cstr(sql("select item from `tabBill Of Materials` where name = '%s' " % self.doc.r_bom)[0][0])
-    # call replace bom engine
-    self.replace_bom_engine('replace_bom_details', 'bom_no', self.doc.s_bom, self.doc.r_bom, item_code)
-  
-  def replace_item(self):
-    item = sql("select name, is_active from `tabItem` where name = %s", self.doc.r_item, as_dict = 1)
-    if not item:
-      msgprint("Please enter Valid Item Code to replace with.")
-      raise Exception
-    if item and item[0]['is_active'] != 'Yes':
-      msgprint("Item Code '%s' is not Active Item." % cstr(self.doc.r_item))
-      raise Exception
-    self.replace_bom_engine('replace_item_details', 'item_code', self.doc.s_item, self.doc.r_item)
-    
-  def replace_data_in_bom_materials(self, dl, fname, s_data, r_data, item_code =''):
-    for d in getlist(dl, 'bom_materials'):
-      if d.fields[fname] == s_data:
-        d.fields[fname] = r_data
-        if fname == 'bom_no':
-          d.item_code = item_code
-        d.save()
-
-  def replace_bom_engine(self, t_fname, fname, s_data, r_data, item_code = ''):
-    if not r_data:
-      msgprint("Please Enter '%s' and then click on '%s'." % ((t_fname == 'replace_bom_details') and 'BOM to Replace' or 'Item to Replace',(t_fname == 'replace_bom_details') and 'Replace BOM' or 'Replace Item' ))
-      raise Exception
-      
-    for d in getlist(self.doclist, t_fname):
-      if d.bom_created:
-        msgprint("Please click on '%s' and then on '%s'." % ((t_fname == 'replace_bom_details') and 'Search BOM' or 'Search Item',(t_fname == 'replace_bom_details') and 'Replace BOM' or 'Replace Item' ))
-        raise Exception
-        
-      if d.replace:
-        # copy_doclist is the framework funcn which create duplicate document and returns doclist of new document
-        # Reinder := 
-        # make copy
-        if self.doc.create_new_bom:
-          import webnotes.model.doc
-          new_bom_dl = copy_doclist(webnotes.model.doc.get('Bill Of Materials', d.parent_bom), no_copy = ['is_active', 'is_default', 'is_sub_assembly', 'remarks', 'flat_bom_details'])
-        
-          new_bom_dl[0].docstatus = 0
-          new_bom_dl[0].save()
-        else:
-          new_bom_dl = get_obj('Bill Of Materials', d.parent_bom, with_children = 1).doclist
-
-        # replace s_data with r_data in Bom Material Detail Table
-        self.replace_data_in_bom_materials(new_bom_dl, fname, s_data, r_data, item_code)
-       
-        d.bom_created = new_bom_dl[0].name
-        d.save()
-
-  def update_docstatus(self):
-    sql("update `tabBill Of Materials` set docstatus = 0 where  name = '%s' limit 1" % self.doc.bom)
-    msgprint("Updated")
-
-  def update_bom(self):
-    self.check_bom_list = []
-    main_bom_list = get_obj('Production Control').traverse_bom_tree(self.doc.fg_bom_no, 1)
-    main_bom_list.reverse()
-    # run calculate cost and get
-    #msgprint(main_bom_list)
-    for bom in main_bom_list:
-      if bom and bom not in self.check_bom_list:
-        bom_obj = get_obj('Bill Of Materials', bom, with_children = 1)
-        #print(bom_obj.doc.fields)
-        bom_obj.validate()
-        bom_obj.doc.docstatus = 1
-        bom_obj.check_recursion()
-        bom_obj.update_flat_bom_engine(is_submit = 1)
-        bom_obj.doc.docstatus = 1
-        bom_obj.doc.save()
-        self.check_bom_list.append(bom)
diff --git a/erpnext/production/doctype/bom_replace_utility/bom_replace_utility.txt b/erpnext/production/doctype/bom_replace_utility/bom_replace_utility.txt
deleted file mode 100644
index f3e1412..0000000
--- a/erpnext/production/doctype/bom_replace_utility/bom_replace_utility.txt
+++ /dev/null
@@ -1,398 +0,0 @@
-# DocType, BOM Replace Utility
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:53',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'jai@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'issingle': 1,
-		'module': 'Production',
-		'name': '__common__',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
-		'show_in_menu': 1,
-		'version': 56
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'BOM Replace Utility',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'BOM Replace Utility',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1
-	},
-
-	# DocType, BOM Replace Utility
-	{
-		'doctype': 'DocType',
-		'name': 'BOM Replace Utility'
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'permlevel': 0,
-		'role': 'System Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'permlevel': 1,
-		'role': 'System Manager'
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'permlevel': 0,
-		'role': 'Production User',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 4,
-		'permlevel': 1,
-		'role': 'Production User'
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 5,
-		'permlevel': 0,
-		'role': 'Production Manager',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 6,
-		'permlevel': 1,
-		'role': 'Production Manager'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'create_new_bom',
-		'fieldtype': 'Check',
-		'idx': 1,
-		'label': 'Create New BOM'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 2,
-		'label': 'BOM Details'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'Select the relevant BOM to be replaced which is actually a raw material used for a parent BOM.',
-		'doctype': 'DocField',
-		'fieldname': 's_bom',
-		'fieldtype': 'Link',
-		'idx': 3,
-		'label': 'Select BOM',
-		'options': 'Bill Of Materials',
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 4,
-		'label': 'Note 1',
-		'options': 'Click on the button "Search BOM" to fetch in the table below all the parent BOMs in which the above selected BOM is used as a raw material.'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 5
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 6,
-		'label': 'Search BOM',
-		'options': 'search_parent_bom_of_bom'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 7,
-		'options': 'Simple'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'Select the BOM by which you want the above sected BOM to be replaced.',
-		'doctype': 'DocField',
-		'fieldname': 'r_bom',
-		'fieldtype': 'Link',
-		'idx': 8,
-		'label': 'Replace Bom with',
-		'options': 'Bill Of Materials',
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 9,
-		'label': 'Note 2',
-		'options': 'Click on the button "Replace BOM" after checking under the column Replace against relevant Parent BOMs'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 10
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 11,
-		'label': 'Replace BOM',
-		'options': 'replace_bom'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 12,
-		'options': 'Simple'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'replace_bom_details',
-		'fieldtype': 'Table',
-		'idx': 13,
-		'label': 'Replace BOM Detail',
-		'options': 'BOM Replace Utility Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 14,
-		'label': 'Item Details'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'Select the relevant item to be replaced which is actually a raw material used for a parent BOM.',
-		'doctype': 'DocField',
-		'fieldname': 's_item',
-		'fieldtype': 'Link',
-		'idx': 15,
-		'label': 'Select Item',
-		'options': 'Item',
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 16,
-		'label': 'Note 3',
-		'options': 'Click on the button "Search Item" to fetch in the table below all the parent BOMs in which the above selected item is used as a raw material.'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 17
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 18,
-		'label': 'Search Item',
-		'options': 'search_parent_bom_of_item'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 19,
-		'options': 'Simple'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'Select the item by which you want the above sected item to be replaced.',
-		'doctype': 'DocField',
-		'fieldname': 'r_item',
-		'fieldtype': 'Link',
-		'idx': 20,
-		'label': 'Replace Item with',
-		'options': 'Item',
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 21,
-		'label': 'Note 4',
-		'options': 'Click on the button "Replace Item" after checking under the column Replace against relevant Parent BOMs'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 22
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 23,
-		'label': 'Replace Item',
-		'options': 'replace_item'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 24,
-		'options': 'Simple'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'replace_item_details',
-		'fieldtype': 'Table',
-		'idx': 25,
-		'label': 'Replace Item Detail',
-		'options': 'BOM Replace Utility Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 26,
-		'label': 'Update BOM Tree'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'Select the root Bill of Materials in which raw materials are replaced and click on the button below to update costs.',
-		'doctype': 'DocField',
-		'fieldname': 'fg_bom_no',
-		'fieldtype': 'Link',
-		'idx': 27,
-		'label': 'FG BOM No',
-		'options': 'Bill Of Materials'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 28,
-		'label': 'Update',
-		'options': 'update_bom'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 29,
-		'label': 'Update BOM'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'bom',
-		'fieldtype': 'Link',
-		'idx': 30,
-		'label': 'BOM',
-		'options': 'Bill Of Materials'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 31,
-		'label': 'Update Docstatus',
-		'options': 'update_docstatus'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/production/doctype/bom_replace_utility_detail/__init__.py b/erpnext/production/doctype/bom_replace_utility_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/production/doctype/bom_replace_utility_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/production/doctype/bom_replace_utility_detail/bom_replace_utility_detail.txt b/erpnext/production/doctype/bom_replace_utility_detail/bom_replace_utility_detail.txt
deleted file mode 100644
index d36f26b..0000000
--- a/erpnext/production/doctype/bom_replace_utility_detail/bom_replace_utility_detail.txt
+++ /dev/null
@@ -1,105 +0,0 @@
-# DocType, BOM Replace Utility Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:53',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'jai@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'BRUD/.#####',
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'hide_toolbar': 1,
-		'in_create': 1,
-		'istable': 1,
-		'module': 'Production',
-		'name': '__common__',
-		'read_only': 1,
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 8
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'BOM Replace Utility Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'name': '__common__',
-		'parent': 'BOM Replace Utility Detail',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'permlevel': 0,
-		'read': 1,
-		'role': 'System Manager',
-		'write': 1
-	},
-
-	# DocType, BOM Replace Utility Detail
-	{
-		'doctype': 'DocType',
-		'name': 'BOM Replace Utility Detail'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'parent_bom',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Parent BOM',
-		'oldfieldname': 'parent_bom',
-		'oldfieldtype': 'Link',
-		'options': 'Bill Of Materials',
-		'permlevel': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'replace',
-		'fieldtype': 'Check',
-		'idx': 2,
-		'label': 'Replace',
-		'oldfieldname': 'replace',
-		'oldfieldtype': 'Check',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'bom_created',
-		'fieldtype': 'Link',
-		'idx': 3,
-		'label': 'BOM Created',
-		'oldfieldname': 'bom_created',
-		'oldfieldtype': 'Link',
-		'options': 'Bill Of Materials',
-		'permlevel': 1,
-		'search_index': 0
-	}
-]
\ No newline at end of file
diff --git a/erpnext/production/doctype/bom_report_detail/__init__.py b/erpnext/production/doctype/bom_report_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/production/doctype/bom_report_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/production/doctype/bom_report_detail/bom_report_detail.txt b/erpnext/production/doctype/bom_report_detail/bom_report_detail.txt
deleted file mode 100644
index 307fe7d..0000000
--- a/erpnext/production/doctype/bom_report_detail/bom_report_detail.txt
+++ /dev/null
@@ -1,161 +0,0 @@
-# DocType, BOM Report Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:53',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Production',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'show_in_menu': 0,
-		'version': 8
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'BOM Report Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'BOM Report Detail',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1,
-		'role': 'System Manager'
-	},
-
-	# DocType, BOM Report Detail
-	{
-		'doctype': 'DocType',
-		'name': 'BOM Report Detail'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'permlevel': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'item_code',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'in_filter': 1,
-		'label': 'Item Code',
-		'oldfieldname': 'item_code',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Text',
-		'idx': 2,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Text',
-		'permlevel': 1,
-		'reqd': 0,
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'moving_avg_rate',
-		'fieldtype': 'Currency',
-		'idx': 5,
-		'label': 'Moving Avg Rate',
-		'oldfieldname': 'moving_avg_rate',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'amount',
-		'fieldtype': 'Currency',
-		'idx': 6,
-		'label': 'Amount',
-		'oldfieldname': 'amount',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1,
-		'reqd': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'last_purchase_rate',
-		'fieldtype': 'Currency',
-		'idx': 7,
-		'label': 'Last Purchase Rate',
-		'oldfieldname': 'last_purchase_rate',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1,
-		'width': '150px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'qty',
-		'fieldtype': 'Data',
-		'idx': 9,
-		'label': 'Qty',
-		'oldfieldname': 'qty',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'reqd': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'stock_uom',
-		'fieldtype': 'Data',
-		'idx': 12,
-		'label': 'Stock UOM',
-		'oldfieldname': 'stock_uom',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'reqd': 0
-	}
-]
\ No newline at end of file
diff --git a/erpnext/production/doctype/flat_bom_detail/__init__.py b/erpnext/production/doctype/flat_bom_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/production/doctype/flat_bom_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/production/doctype/flat_bom_detail/flat_bom_detail.txt b/erpnext/production/doctype/flat_bom_detail/flat_bom_detail.txt
deleted file mode 100644
index 1c2d76e..0000000
--- a/erpnext/production/doctype/flat_bom_detail/flat_bom_detail.txt
+++ /dev/null
@@ -1,138 +0,0 @@
-# DocType, Flat BOM Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:02',
-		'docstatus': 0,
-		'modified': '2012-01-11 14:32:31',
-		'modified_by': 'Administrator',
-		'owner': 'jai@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'FBD/.######',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Production',
-		'name': '__common__',
-		'read_only': 0,
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 24
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Flat BOM Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, Flat BOM Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Flat BOM Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'item_code',
-		'fieldtype': 'Link',
-		'label': 'Item Code',
-		'oldfieldname': 'item_code',
-		'oldfieldtype': 'Link',
-		'options': 'Item'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Text',
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Text',
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'qty',
-		'fieldtype': 'Float',
-		'label': 'Qty',
-		'oldfieldname': 'qty',
-		'oldfieldtype': 'Currency'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'rate',
-		'fieldtype': 'Float',
-		'label': 'Rate',
-		'oldfieldname': 'standard_rate',
-		'oldfieldtype': 'Currency'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'amount',
-		'fieldtype': 'Float',
-		'label': 'Amount',
-		'oldfieldname': 'amount_as_per_sr',
-		'oldfieldtype': 'Currency'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'stock_uom',
-		'fieldtype': 'Link',
-		'label': 'Stock UOM',
-		'oldfieldname': 'stock_uom',
-		'oldfieldtype': 'Link',
-		'options': 'UOM'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'parent_bom',
-		'fieldtype': 'Link',
-		'hidden': 0,
-		'label': 'Parent BOM',
-		'oldfieldname': 'parent_bom',
-		'oldfieldtype': 'Link',
-		'width': '250px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'mat_detail_no',
-		'fieldtype': 'Data',
-		'hidden': 1,
-		'label': 'Mat Detail No'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'qty_consumed_per_unit',
-		'fieldtype': 'Float',
-		'hidden': 0,
-		'label': 'Qty Consumed Per Unit',
-		'no_copy': 0
-	}
-]
\ No newline at end of file
diff --git a/erpnext/production/doctype/pf_detail/__init__.py b/erpnext/production/doctype/pf_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/production/doctype/pf_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/production/doctype/pf_detail/pf_detail.txt b/erpnext/production/doctype/pf_detail/pf_detail.txt
deleted file mode 100644
index 5c29c84..0000000
--- a/erpnext/production/doctype/pf_detail/pf_detail.txt
+++ /dev/null
@@ -1,216 +0,0 @@
-# DocType, PF Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:12',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'PFD/.#####',
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Production',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'show_in_menu': 0,
-		'version': 1
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'PF Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'PF Detail',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1,
-		'role': 'System Manager'
-	},
-
-	# DocType, PF Detail
-	{
-		'doctype': 'DocType',
-		'name': 'PF Detail'
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'permlevel': 0,
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'item_code',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'in_filter': 1,
-		'label': 'Item Code',
-		'oldfieldname': 'item_code',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': 'Client',
-		'width': '150px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Text',
-		'idx': 2,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Text',
-		'permlevel': 1,
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'default': '0.00',
-		'doctype': 'DocField',
-		'fieldname': 'planned_qty',
-		'fieldtype': 'Currency',
-		'idx': 5,
-		'label': 'Planned Quantity',
-		'oldfieldname': 'planned_qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'produced_qty',
-		'fieldtype': 'Currency',
-		'idx': 6,
-		'label': 'Produced Quantity',
-		'oldfieldname': 'produced_qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'start_date',
-		'fieldtype': 'Date',
-		'hidden': 0,
-		'idx': 7,
-		'in_filter': 0,
-		'label': 'Start Date',
-		'oldfieldname': 'start_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 0,
-		'report_hide': 0,
-		'reqd': 1,
-		'search_index': 0,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'end_date',
-		'fieldtype': 'Date',
-		'hidden': 0,
-		'idx': 8,
-		'in_filter': 0,
-		'label': 'End Date',
-		'oldfieldname': 'end_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 0,
-		'report_hide': 0,
-		'reqd': 1,
-		'search_index': 0,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'qty',
-		'fieldtype': 'Currency',
-		'idx': 9,
-		'label': 'Quantity',
-		'oldfieldname': 'qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'reqd': 1,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'forecast_date',
-		'fieldtype': 'Date',
-		'hidden': 1,
-		'idx': 9,
-		'label': 'Forecast Date',
-		'oldfieldname': 'forecast_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 1,
-		'report_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'forecast_due_date',
-		'fieldtype': 'Date',
-		'hidden': 1,
-		'idx': 10,
-		'label': 'Forecast Due Date',
-		'oldfieldname': 'forecast_due_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 1,
-		'report_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'stock_uom',
-		'fieldtype': 'Data',
-		'idx': 12,
-		'label': 'Stock UOM',
-		'oldfieldname': 'stock_uom',
-		'oldfieldtype': 'Data',
-		'permlevel': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/production/doctype/pp_detail/__init__.py b/erpnext/production/doctype/pp_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/production/doctype/pp_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/production/doctype/pp_detail/pp_detail.txt b/erpnext/production/doctype/pp_detail/pp_detail.txt
deleted file mode 100644
index a90d59c..0000000
--- a/erpnext/production/doctype/pp_detail/pp_detail.txt
+++ /dev/null
@@ -1,159 +0,0 @@
-# DocType, PP Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:12',
-		'docstatus': 0,
-		'modified': '2012-01-09 16:25:13',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'PPID/.#####',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Production',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 27
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'PP Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# DocType, PP Detail
-	{
-		'doctype': 'DocType',
-		'name': 'PP Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'sales_order',
-		'fieldtype': 'Data',
-		'label': 'Sales Order',
-		'oldfieldname': 'source_docname',
-		'oldfieldtype': 'Data',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'item_code',
-		'fieldtype': 'Link',
-		'label': 'Item Code',
-		'oldfieldname': 'item_code',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': 'Client',
-		'width': '150px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'bom_no',
-		'fieldtype': 'Link',
-		'label': 'BOM No',
-		'oldfieldname': 'bom_no',
-		'oldfieldtype': 'Link',
-		'options': 'Bill Of Materials',
-		'permlevel': 0,
-		'reqd': 1,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'default': '0.00',
-		'doctype': 'DocField',
-		'fieldname': 'so_pending_qty',
-		'fieldtype': 'Currency',
-		'label': 'SO Pending Qty',
-		'oldfieldname': 'prevdoc_reqd_qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1,
-		'reqd': 0,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'default': '0.00',
-		'doctype': 'DocField',
-		'fieldname': 'planned_qty',
-		'fieldtype': 'Currency',
-		'label': 'Planned Qty',
-		'oldfieldname': 'planned_qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'reqd': 1,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'stock_uom',
-		'fieldtype': 'Data',
-		'label': 'UOM',
-		'oldfieldname': 'stock_uom',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'reqd': 1,
-		'width': '80px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Text',
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Text',
-		'permlevel': 1,
-		'width': '200px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'parent_packing_item',
-		'fieldtype': 'Link',
-		'label': 'Parent Packing Item',
-		'oldfieldname': 'parent_item',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'is_pro_created',
-		'fieldtype': 'Check',
-		'label': 'Is PRO Created',
-		'oldfieldname': 'pro_created',
-		'oldfieldtype': 'Check',
-		'permlevel': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/production/doctype/pp_so_detail/__init__.py b/erpnext/production/doctype/pp_so_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/production/doctype/pp_so_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/production/doctype/pp_so_detail/pp_so_detail.txt b/erpnext/production/doctype/pp_so_detail/pp_so_detail.txt
deleted file mode 100644
index c07d71b..0000000
--- a/erpnext/production/doctype/pp_so_detail/pp_so_detail.txt
+++ /dev/null
@@ -1,100 +0,0 @@
-# DocType, PP SO Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:13',
-		'docstatus': 0,
-		'modified': '2012-01-09 17:41:37',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'PP/.SO/.#####',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Production',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 5
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'PP SO Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# DocType, PP SO Detail
-	{
-		'doctype': 'DocType',
-		'name': 'PP SO Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'sales_order',
-		'fieldtype': 'Link',
-		'label': 'Sales Order',
-		'oldfieldname': 'prevdoc_docname',
-		'oldfieldtype': 'Data',
-		'options': 'Sales Order',
-		'permlevel': 0,
-		'width': '150px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'sales_order_date',
-		'fieldtype': 'Date',
-		'label': 'Sales Order Date',
-		'oldfieldname': 'document_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 1,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'customer',
-		'fieldtype': 'Link',
-		'label': 'Customer',
-		'options': 'Customer',
-		'permlevel': 1,
-		'width': '150px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'grand_total',
-		'fieldtype': 'Currency',
-		'label': 'Grand Total',
-		'permlevel': 1,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'include_in_plan',
-		'fieldtype': 'Check',
-		'label': 'Include In Plan',
-		'oldfieldname': 'include_in_plan',
-		'oldfieldtype': 'Check',
-		'permlevel': 0,
-		'width': '100px'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/production/doctype/ppw_detail/__init__.py b/erpnext/production/doctype/ppw_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/production/doctype/ppw_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/production/doctype/ppw_detail/ppw_detail.txt b/erpnext/production/doctype/ppw_detail/ppw_detail.txt
deleted file mode 100644
index 96bcf85..0000000
--- a/erpnext/production/doctype/ppw_detail/ppw_detail.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-# DocType, PPW Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:13',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'PPWD/.#######',
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'module': 'Production',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'show_in_menu': 0,
-		'version': 1
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'warehouse',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Warehouse',
-		'name': '__common__',
-		'oldfieldname': 'warehouse',
-		'oldfieldtype': 'Link',
-		'options': 'Warehouse',
-		'parent': 'PPW Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, PPW Detail
-	{
-		'doctype': 'DocType',
-		'name': 'PPW Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/production/doctype/pro_detail/pro_detail.txt b/erpnext/production/doctype/pro_detail/pro_detail.txt
deleted file mode 100644
index df7465e..0000000
--- a/erpnext/production/doctype/pro_detail/pro_detail.txt
+++ /dev/null
@@ -1,157 +0,0 @@
-# DocType, PRO Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:13',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'PRODC/.#######',
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Production',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'show_in_menu': 0,
-		'version': 4
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'PRO Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# DocType, PRO Detail
-	{
-		'doctype': 'DocType',
-		'name': 'PRO Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'item_code',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Item Code',
-		'oldfieldname': 'item_code',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Text',
-		'idx': 2,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Text',
-		'permlevel': 1,
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'source_warehouse',
-		'fieldtype': 'Link',
-		'idx': 3,
-		'label': 'Source Warehouse',
-		'oldfieldname': 'source_warehouse',
-		'oldfieldtype': 'Link',
-		'options': 'Warehouse',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'actual_qty',
-		'fieldtype': 'Currency',
-		'idx': 4,
-		'label': 'Current Stock',
-		'oldfieldname': 'actual_qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'qty_reqd',
-		'fieldtype': 'Currency',
-		'idx': 6,
-		'label': 'Qty Reqd',
-		'oldfieldname': 'qty_reqd',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'issued_qty',
-		'fieldtype': 'Currency',
-		'idx': 7,
-		'label': 'Issued Qty',
-		'oldfieldname': 'issued_qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'consumed_qty',
-		'fieldtype': 'Currency',
-		'idx': 8,
-		'label': 'Consumed Qty',
-		'oldfieldname': 'consumed_qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'qty_consumed_per_unit',
-		'fieldtype': 'Currency',
-		'idx': 9,
-		'label': 'Qty Consumed Per Unit',
-		'oldfieldname': 'qty_consumed_per_unit',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'stock_uom',
-		'fieldtype': 'Data',
-		'idx': 12,
-		'label': 'Stock UOM',
-		'oldfieldname': 'stock_uom',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'reqd': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/production/doctype/pro_pp_detail/__init__.py b/erpnext/production/doctype/pro_pp_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/production/doctype/pro_pp_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/production/doctype/pro_pp_detail/pro_pp_detail.txt b/erpnext/production/doctype/pro_pp_detail/pro_pp_detail.txt
deleted file mode 100644
index 042ec1a..0000000
--- a/erpnext/production/doctype/pro_pp_detail/pro_pp_detail.txt
+++ /dev/null
@@ -1,129 +0,0 @@
-# DocType, PRO PP Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:13',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'jai@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Production',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'show_in_menu': 0,
-		'version': 5
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'PRO PP Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, PRO PP Detail
-	{
-		'doctype': 'DocType',
-		'name': 'PRO PP Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'source_doctype',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'label': 'Source Doctype',
-		'oldfieldname': 'source_doctype',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'source_docname',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Source Docname',
-		'oldfieldname': 'source_docname',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'source_detail_docname',
-		'fieldtype': 'Data',
-		'idx': 3,
-		'label': 'Source Detail Docname ',
-		'oldfieldname': 'source_detail_docname',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'prevdoc_detail_docname',
-		'fieldtype': 'Data',
-		'idx': 4,
-		'label': 'Prevdoc Detail Docname',
-		'oldfieldname': 'prevdoc_detail_docname',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'confirm_date',
-		'fieldtype': 'Date',
-		'idx': 5,
-		'label': 'Confirm Date',
-		'oldfieldname': 'confirm_date',
-		'oldfieldtype': 'Date'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'qty_reqd',
-		'fieldtype': 'Currency',
-		'idx': 6,
-		'label': 'Qty Reqd',
-		'oldfieldname': 'qty_reqd',
-		'oldfieldtype': 'Currency'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'produced_qty',
-		'fieldtype': 'Currency',
-		'idx': 7,
-		'label': 'Produced Qty',
-		'oldfieldname': 'produced_qty',
-		'oldfieldtype': 'Currency'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': 'DocField',
-		'fieldname': 'update',
-		'fieldtype': 'Check',
-		'idx': 8,
-		'label': 'Update',
-		'oldfieldname': 'update',
-		'oldfieldtype': 'Check'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/production/doctype/production_control/production_control.py b/erpnext/production/doctype/production_control/production_control.py
index c051d1e..6afd6ae 100644
--- a/erpnext/production/doctype/production_control/production_control.py
+++ b/erpnext/production/doctype/production_control/production_control.py
@@ -46,7 +46,7 @@
 		count, bom_list, qty_list = 0, [bom_no], [qty]
 		while (count < len(bom_list)):
 			# get child items from BOM MAterial Table.
-			child_items = sql("select item_code, bom_no, qty, qty_consumed_per_unit from `tabBOM Material` where parent = %s", bom_list[count], as_dict = 1)
+			child_items = sql("select item_code, bom_no, qty, qty_consumed_per_unit from `tabBOM Item` where parent = %s", bom_list[count], as_dict = 1)
 			child_items = child_items and child_items or []
 			for item in child_items:
 				# Calculate qty required for FG's qty.
@@ -106,7 +106,7 @@
 		# run calculate cost and get
 		for bom in main_bom_list:
 			if bom and bom not in self.check_bom_list:
-				bom_obj = get_obj('Bill Of Materials', bom, with_children = 1)
+				bom_obj = get_obj('BOM', bom, with_children = 1)
 				bom_obj.doc.save()
 				bom_obj.check_recursion()
 				bom_obj.update_flat_bom_engine()
diff --git a/erpnext/production/doctype/production_control/production_control.txt b/erpnext/production/doctype/production_control/production_control.txt
index 7ca5160..4f8564c 100644
--- a/erpnext/production/doctype/production_control/production_control.txt
+++ b/erpnext/production/doctype/production_control/production_control.txt
@@ -3,22 +3,22 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:14',
+		'creation': '2012-03-27 14:36:05',
 		'docstatus': 0,
-		'modified': '2010-12-23 11:22:14',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:05',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'issingle': 1,
-		'module': 'Production',
+		'module': u'Production',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 19
 	},
@@ -26,6 +26,6 @@
 	# DocType, Production Control
 	{
 		'doctype': 'DocType',
-		'name': 'Production Control'
+		'name': u'Production Control'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/production/doctype/production_order/production_order.js b/erpnext/production/doctype/production_order/production_order.js
index 227f3ca..6ac7065 100644
--- a/erpnext/production/doctype/production_order/production_order.js
+++ b/erpnext/production/doctype/production_order/production_order.js
@@ -109,7 +109,7 @@
 
 cur_frm.fields_dict['bom_no'].get_query = function(doc)  {
   if (doc.production_item){
-    return 'SELECT DISTINCT `tabBill Of Materials`.`name` FROM `tabBill Of Materials` WHERE `tabBill Of Materials`.`is_active` = "Yes" AND `tabBill Of Materials`.docstatus = 1 AND `tabBill Of Materials`.`item` = "' + cstr(doc.production_item) + '" AND`tabBill Of Materials`.%(key)s LIKE "%s" ORDER BY `tabBill Of Materials`.`name` LIMIT 50';
+    return 'SELECT DISTINCT `tabBOM`.`name` FROM `tabBOM` WHERE `tabBOM`.`is_active` = "Yes" AND `tabBOM`.docstatus = 1 AND `tabBOM`.`item` = "' + cstr(doc.production_item) + '" AND`tabBOM`.%(key)s LIKE "%s" ORDER BY `tabBOM`.`name` LIMIT 50';
   }
   else {
     alert(" Please Enter Production Item First.")
diff --git a/erpnext/production/doctype/production_order/production_order.py b/erpnext/production/doctype/production_order/production_order.py
index ded32ff..65ee471 100644
--- a/erpnext/production/doctype/production_order/production_order.py
+++ b/erpnext/production/doctype/production_order/production_order.py
@@ -63,7 +63,7 @@
 				raise Exception
 
 		if self.doc.bom_no:
-			bom = sql("""select name from `tabBill Of Materials`	where name = %s and docstatus = 1 
+			bom = sql("""select name from `tabBOM`	where name = %s and docstatus = 1 
 				and is_active = 'Yes' and item = %s""", (self.doc.bom_no, self.doc.production_item), as_dict =1)
 			if not bom:
 				msgprint("""Incorrect BOM: %s entered. 
diff --git a/erpnext/production/doctype/production_order/production_order.txt b/erpnext/production/doctype/production_order/production_order.txt
index d94ccc9..62aa610 100644
--- a/erpnext/production/doctype/production_order/production_order.txt
+++ b/erpnext/production/doctype/production_order/production_order.txt
@@ -3,51 +3,52 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:14',
+		'creation': '2012-03-27 14:36:05',
 		'docstatus': 0,
-		'modified': '2012-01-11 17:36:23',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:45:50',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1325837006',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'_last_update': u'1325837006',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
 		'in_create': 0,
-		'module': 'Production',
+		'is_submittable': 1,
+		'module': u'Production',
 		'name': '__common__',
-		'section_style': 'Tabbed',
-		'server_code_error': ' ',
+		'section_style': u'Tabbed',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 190
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Production Order',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Production Order',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Production Order',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Production Order',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Production Order
 	{
 		'doctype': 'DocType',
-		'name': 'Production Order'
+		'name': u'Production Order'
 	},
 
 	# DocPerm
@@ -55,18 +56,18 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'submit': 1,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'All'
+		'role': u'All'
 	},
 
 	# DocPerm
@@ -74,9 +75,9 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Production Manager',
+		'role': u'Production Manager',
 		'submit': 1,
 		'write': 1
 	},
@@ -86,227 +87,229 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Production User',
+		'role': u'Production User',
 		'submit': 1,
 		'write': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Item for which this Production Order is raised.',
-		'doctype': 'DocField',
-		'fieldname': 'production_item',
-		'fieldtype': 'Link',
+		'colour': u'White:FFF',
+		'description': u'Item for which this Production Order is raised.',
+		'doctype': u'DocField',
+		'fieldname': u'production_item',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Production Item',
-		'oldfieldname': 'production_item',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
+		'label': u'Production Item',
+		'oldfieldname': u'production_item',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
 		'permlevel': 1,
 		'reqd': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Text',
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Text',
 		'permlevel': 0,
-		'width': '300px'
+		'width': u'300px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'stock_uom',
-		'fieldtype': 'Data',
-		'label': 'Stock UOM',
-		'oldfieldname': 'stock_uom',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'stock_uom',
+		'fieldtype': u'Data',
+		'label': u'Stock UOM',
+		'oldfieldname': u'stock_uom',
+		'oldfieldtype': u'Data',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Bill of Material which was considered for manufacturing the production item.',
-		'doctype': 'DocField',
-		'fieldname': 'bom_no',
-		'fieldtype': 'Link',
-		'label': 'BOM No',
-		'oldfieldname': 'bom_no',
-		'oldfieldtype': 'Link',
-		'options': 'Bill Of Materials',
+		'colour': u'White:FFF',
+		'description': u'Bill of Material which was considered for manufacturing the production item.',
+		'doctype': u'DocField',
+		'fieldname': u'bom_no',
+		'fieldtype': u'Link',
+		'label': u'BOM No',
+		'oldfieldname': u'bom_no',
+		'oldfieldtype': u'Link',
+		'options': u'BOM',
 		'permlevel': 1,
 		'reqd': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Quantity of item for which Production Order is raised.',
-		'doctype': 'DocField',
-		'fieldname': 'qty',
-		'fieldtype': 'Currency',
-		'label': 'Qty',
-		'oldfieldname': 'qty',
-		'oldfieldtype': 'Currency',
+		'colour': u'White:FFF',
+		'description': u'Quantity of item for which Production Order is raised.',
+		'doctype': u'DocField',
+		'fieldname': u'qty',
+		'fieldtype': u'Currency',
+		'label': u'Qty',
+		'oldfieldname': u'qty',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'The warehouse for finished goods where stock of produced items will be updated.',
-		'doctype': 'DocField',
-		'fieldname': 'fg_warehouse',
-		'fieldtype': 'Link',
+		'colour': u'White:FFF',
+		'description': u'The warehouse for finished goods where stock of produced items will be updated.',
+		'doctype': u'DocField',
+		'fieldname': u'fg_warehouse',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'FG Warehouse',
-		'oldfieldname': 'fg_warehouse',
-		'oldfieldtype': 'Link',
-		'options': 'Warehouse',
+		'label': u'FG Warehouse',
+		'oldfieldname': u'fg_warehouse',
+		'oldfieldtype': u'Link',
+		'options': u'Warehouse',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'The work in progress warehouse where raw materials will be operated upon to create finished goods.',
-		'doctype': 'DocField',
-		'fieldname': 'wip_warehouse',
-		'fieldtype': 'Link',
+		'colour': u'White:FFF',
+		'description': u'The work in progress warehouse where raw materials will be operated upon to create finished goods.',
+		'doctype': u'DocField',
+		'fieldname': u'wip_warehouse',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'WIP Warehouse',
-		'oldfieldname': 'wip_warehouse',
-		'oldfieldtype': 'Link',
-		'options': 'Warehouse',
+		'label': u'WIP Warehouse',
+		'oldfieldname': u'wip_warehouse',
+		'oldfieldtype': u'Link',
+		'options': u'Warehouse',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amended_from',
-		'fieldtype': 'Data',
-		'label': 'Amended From',
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Data',
+		'label': u'Amended From',
 		'no_copy': 1,
-		'oldfieldname': 'amended_from',
-		'oldfieldtype': 'Data',
+		'oldfieldname': u'amended_from',
+		'oldfieldtype': u'Data',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amendment_date',
-		'fieldtype': 'Date',
-		'label': 'Amendment Date',
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
+		'label': u'Amendment Date',
 		'no_copy': 1,
-		'oldfieldname': 'amendment_date',
-		'oldfieldtype': 'Date',
+		'oldfieldname': u'amendment_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'The date on which current entry will get or has actually executed.',
-		'doctype': 'DocField',
-		'fieldname': 'posting_date',
-		'fieldtype': 'Date',
-		'label': 'Posting Date',
-		'oldfieldname': 'posting_date',
-		'oldfieldtype': 'Date',
+		'colour': u'White:FFF',
+		'description': u'The date on which current entry will get or has actually executed.',
+		'doctype': u'DocField',
+		'fieldname': u'posting_date',
+		'fieldtype': u'Date',
+		'label': u'Posting Date',
+		'oldfieldname': u'posting_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Select "Yes" if stock is maintained and tracked for sub-assembly items. Select "No" if you want child items of sub-assembly for material transfer.',
-		'doctype': 'DocField',
-		'fieldname': 'consider_sa_items',
-		'fieldtype': 'Select',
+		'colour': u'White:FFF',
+		'description': u'Select "Yes" if stock is maintained and tracked for sub-assembly items. Select "No" if you want child items of sub-assembly for material transfer.',
+		'doctype': u'DocField',
+		'fieldname': u'consider_sa_items',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Consider SA Items as raw material',
-		'oldfieldname': 'consider_sa_items',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'label': u'Consider SA Items as raw material',
+		'oldfieldname': u'consider_sa_items',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 1,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'description': 'Select name of the project if Production Order need to be created against any project',
-		'doctype': 'DocField',
-		'fieldname': 'project_name',
-		'fieldtype': 'Link',
+		'description': u'Select name of the project if Production Order need to be created against any project',
+		'doctype': u'DocField',
+		'fieldname': u'project_name',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Project Name',
-		'oldfieldname': 'project_name',
-		'oldfieldtype': 'Link',
-		'options': 'Project',
+		'label': u'Project Name',
+		'oldfieldname': u'project_name',
+		'oldfieldtype': u'Link',
+		'options': u'Project',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'origin',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'origin',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Origin',
+		'label': u'Origin',
 		'no_copy': 1,
-		'oldfieldname': 'origin',
-		'oldfieldtype': 'Select',
-		'options': 'Manual\nMRP',
+		'oldfieldname': u'origin',
+		'oldfieldtype': u'Select',
+		'options': u'Manual\nMRP',
 		'permlevel': 1,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'status',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'status',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Status',
+		'label': u'Status',
 		'no_copy': 1,
-		'oldfieldname': 'status',
-		'oldfieldtype': 'Select',
-		'options': '\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled',
+		'oldfieldname': u'status',
+		'oldfieldtype': u'Select',
+		'options': u'\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled',
 		'permlevel': 1,
 		'reqd': 1,
 		'search_index': 1
@@ -314,40 +317,40 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Updated after finished goods are transferred to FG Warehouse through Stock Entry',
-		'doctype': 'DocField',
-		'fieldname': 'produced_qty',
-		'fieldtype': 'Currency',
-		'label': 'Produced Qty',
-		'oldfieldname': 'produced_qty',
-		'oldfieldtype': 'Currency',
+		'colour': u'White:FFF',
+		'description': u'Updated after finished goods are transferred to FG Warehouse through Stock Entry',
+		'doctype': u'DocField',
+		'fieldname': u'produced_qty',
+		'fieldtype': u'Currency',
+		'label': u'Produced Qty',
+		'oldfieldname': u'produced_qty',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Link',
-		'label': 'Company',
-		'oldfieldname': 'company',
-		'oldfieldtype': 'Link',
-		'options': 'Company',
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Link',
+		'label': u'Company',
+		'oldfieldname': u'company',
+		'oldfieldtype': u'Link',
+		'options': u'Company',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Fiscal Year',
-		'oldfieldname': 'fiscal_year',
-		'oldfieldtype': 'Select',
-		'options': 'link:Fiscal Year',
+		'label': u'Fiscal Year',
+		'oldfieldname': u'fiscal_year',
+		'oldfieldtype': u'Select',
+		'options': u'link:Fiscal Year',
 		'permlevel': 0,
 		'reqd': 1
 	}
diff --git a/erpnext/production/doctype/pro_detail/__init__.py b/erpnext/production/doctype/production_plan_item/__init__.py
similarity index 100%
rename from erpnext/production/doctype/pro_detail/__init__.py
rename to erpnext/production/doctype/production_plan_item/__init__.py
diff --git a/erpnext/production/doctype/production_plan_item/production_plan_item.txt b/erpnext/production/doctype/production_plan_item/production_plan_item.txt
new file mode 100644
index 0000000..8b546a4
--- /dev/null
+++ b/erpnext/production/doctype/production_plan_item/production_plan_item.txt
@@ -0,0 +1,159 @@
+# DocType, Production Plan Item
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:03',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:03',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'PPID/.#####',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Production',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 27
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Production Plan Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Production Plan Item
+	{
+		'doctype': 'DocType',
+		'name': u'Production Plan Item'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'sales_order',
+		'fieldtype': u'Data',
+		'label': u'Sales Order',
+		'oldfieldname': u'source_docname',
+		'oldfieldtype': u'Data',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 0,
+		'reqd': 1,
+		'trigger': u'Client',
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'bom_no',
+		'fieldtype': u'Link',
+		'label': u'BOM No',
+		'oldfieldname': u'bom_no',
+		'oldfieldtype': u'Link',
+		'options': u'BOM',
+		'permlevel': 0,
+		'reqd': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'so_pending_qty',
+		'fieldtype': u'Currency',
+		'label': u'SO Pending Qty',
+		'oldfieldname': u'prevdoc_reqd_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'reqd': 0,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'planned_qty',
+		'fieldtype': u'Currency',
+		'label': u'Planned Qty',
+		'oldfieldname': u'planned_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'reqd': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'stock_uom',
+		'fieldtype': u'Data',
+		'label': u'UOM',
+		'oldfieldname': u'stock_uom',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'reqd': 1,
+		'width': u'80px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Text',
+		'permlevel': 1,
+		'width': u'200px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'parent_packing_item',
+		'fieldtype': u'Link',
+		'label': u'Parent Packing Item',
+		'oldfieldname': u'parent_item',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'is_pro_created',
+		'fieldtype': u'Check',
+		'label': u'Is PRO Created',
+		'oldfieldname': u'pro_created',
+		'oldfieldtype': u'Check',
+		'permlevel': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/production/doctype/pro_detail/__init__.py b/erpnext/production/doctype/production_plan_sales_order/__init__.py
similarity index 100%
copy from erpnext/production/doctype/pro_detail/__init__.py
copy to erpnext/production/doctype/production_plan_sales_order/__init__.py
diff --git a/erpnext/production/doctype/production_plan_sales_order/production_plan_sales_order.txt b/erpnext/production/doctype/production_plan_sales_order/production_plan_sales_order.txt
new file mode 100644
index 0000000..810c140
--- /dev/null
+++ b/erpnext/production/doctype/production_plan_sales_order/production_plan_sales_order.txt
@@ -0,0 +1,124 @@
+# DocType, Production Plan Sales Order
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:04',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:04',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'PP/.SO/.#####',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Production',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 5
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Production Plan Sales Order',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Production Plan Sales Order',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1,
+		'role': u'System Manager'
+	},
+
+	# DocType, Production Plan Sales Order
+	{
+		'doctype': 'DocType',
+		'name': u'Production Plan Sales Order'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'sales_order',
+		'fieldtype': u'Link',
+		'label': u'Sales Order',
+		'oldfieldname': u'prevdoc_docname',
+		'oldfieldtype': u'Data',
+		'options': u'Sales Order',
+		'permlevel': 0,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'sales_order_date',
+		'fieldtype': u'Date',
+		'label': u'Sales Order Date',
+		'oldfieldname': u'document_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'customer',
+		'fieldtype': u'Link',
+		'label': u'Customer',
+		'options': u'Customer',
+		'permlevel': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'grand_total',
+		'fieldtype': u'Currency',
+		'label': u'Grand Total',
+		'permlevel': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'include_in_plan',
+		'fieldtype': u'Check',
+		'label': u'Include In Plan',
+		'oldfieldname': u'include_in_plan',
+		'oldfieldtype': u'Check',
+		'permlevel': 0,
+		'width': u'100px'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/production/doctype/production_planning_tool/production_planning_tool.js b/erpnext/production/doctype/production_planning_tool/production_planning_tool.js
index e52c853..11d6e44 100644
--- a/erpnext/production/doctype/production_planning_tool/production_planning_tool.js
+++ b/erpnext/production/doctype/production_planning_tool/production_planning_tool.js
@@ -29,7 +29,7 @@
 }
 
 
-cur_frm.cscript['Download Raw Material'] = function(doc, cdt, cdn) {
+cur_frm.cscript.download_raw_material = function(doc, cdt, cdn) {
 	var callback = function(r, rt){
 		if (r.message) 
 			$c_obj_csv(make_doclist(cdt, cdn), 'download_raw_materials', '', '');
@@ -46,5 +46,5 @@
 
 cur_frm.fields_dict['pp_details'].grid.get_field('bom_no').get_query = function(doc) {
   var d = locals[this.doctype][this.docname];
-  return 'SELECT DISTINCT `tabBill Of Materials`.`name` FROM `tabBill Of Materials` WHERE `tabBill Of Materials`.`item` = "' + d.item_code + '" AND `tabBill Of Materials`.`is_active` = "Yes" AND `tabBill Of Materials`.docstatus = 1 AND `tabBill Of Materials`.`name` like "%s" ORDER BY `tabBill Of Materials`.`name` LIMIT 50';
+  return 'SELECT DISTINCT `tabBOM`.`name` FROM `tabBOM` WHERE `tabBOM`.`item` = "' + d.item_code + '" AND `tabBOM`.`is_active` = "Yes" AND `tabBOM`.docstatus = 1 AND `tabBOM`.`name` like "%s" ORDER BY `tabBOM`.`name` LIMIT 50';
 }
diff --git a/erpnext/production/doctype/production_planning_tool/production_planning_tool.py b/erpnext/production/doctype/production_planning_tool/production_planning_tool.py
index 272d13f..d910a20 100644
--- a/erpnext/production/doctype/production_planning_tool/production_planning_tool.py
+++ b/erpnext/production/doctype/production_planning_tool/production_planning_tool.py
@@ -75,7 +75,7 @@
 			select 
 				distinct t1.name, t1.transaction_date, t1.customer, t1.grand_total 
 			from 
-				`tabSales Order` t1, `tabSales Order Detail` t2, `tabDelivery Note Packing Detail` t3, tabItem t4
+				`tabSales Order` t1, `tabSales Order Item` t2, `tabDelivery Note Packing Item` t3, tabItem t4
 			where 
 				t1.name = t2.parent and t1.name = t3.parent and t3.parenttype = 'Sales Order' and t1.docstatus = 1 and t2.item_code = t3.parent_item 
 				and t4.name = t3.item_code and  t1.status != 'Stopped' and t1.company = '%s' and ifnull(t2.qty, 0) > ifnull(t2.delivered_qty, 0) 
@@ -117,7 +117,7 @@
 			so_list.append(d.sales_order)
 		for r in open_so:
 			if cstr(r['name']) not in so_list:
-				pp_so = addchild(self.doc, 'pp_so_details', 'PP SO Detail', 1, self.doclist)
+				pp_so = addchild(self.doc, 'pp_so_details', 'Production Plan Sales Order', 1, self.doclist)
 				pp_so.sales_order = r['name']
 				pp_so.sales_order_date = cstr(r['transaction_date'])
 				pp_so.customer = cstr(r['customer'])
@@ -147,7 +147,7 @@
 				t0.name, t2.parent_item, t2.item_code, 
 				(t1.qty - ifnull(t1.delivered_qty,0)) * (ifnull(t2.qty,0) / ifnull(t1.qty,1)) as 'pending_qty' 
 			from
-				`tabSales Order` t0, `tabSales Order Detail` t1, `tabDelivery Note Packing Detail` t2, `tabItem` t3
+				`tabSales Order` t0, `tabSales Order Item` t1, `tabDelivery Note Packing Item` t2, `tabItem` t3
 			where 
 				t0.name = t1.parent and t0.name = t2.parent and t1.name = t2.parent_detail_docname
 				and t0.name in (%s) and t0.docstatus = 1 and t1.qty > ifnull(t1.delivered_qty,0) and t3.name = t2.item_code 
@@ -164,7 +164,7 @@
 
 		for p in packing_items:	
 			item_details = sql("select description, stock_uom, default_bom from tabItem where name=%s", p['item_code'])
-			pi = addchild(self.doc, 'pp_details', 'PP Detail', 1, self.doclist)
+			pi = addchild(self.doc, 'pp_details', 'Production Plan Item', 1, self.doclist)
 			pi.sales_order				= p['name']
 			pi.parent_packing_item		= p['parent_item']
 			pi.item_code				= p['item_code']
@@ -191,7 +191,7 @@
 		if not d.bom_no:
 			msgprint("Please enter bom no for item: %s at row no: %s" % (d.item_code, d.idx), raise_exception=1)
 		else:
-			bom = sql("""select name from `tabBill Of Materials` where item = %s and docstatus = 1 
+			bom = sql("""select name from `tabBOM` where item = %s and docstatus = 1 
 				and name = %s and ifnull(is_active, 'No') = 'Yes'""", (d.item_code, d.bom_no), as_dict = 1)
 			if not bom:
 				msgprint("""Incorrect BOM No: %s entered for item: %s at row no: %s
@@ -216,7 +216,7 @@
 				# so no childs of SA items
 				fl_bom_items = sql("""
 					select item_code, ifnull(sum(qty_consumed_per_unit), 0) * '%s', description, stock_uom 
-					from `tabBOM Material` 
+					from `tabBOM Item` 
 					where parent = '%s' and docstatus < 2 
 					group by item_code
 				""" % (flt(bom_dict[bom]), bom))
@@ -229,7 +229,7 @@
 					from 
 						( 
 							select distinct fb.name, fb.description, fb.item_code, fb.qty_consumed_per_unit, fb.stock_uom 
-							from `tabFlat BOM Detail` fb,`tabItem` it 
+							from `tabBOM Explosion Item` fb,`tabItem` it 
 							where it.name = fb.item_code and ifnull(it.is_pro_applicable, 'No') = 'No'
 							and ifnull(it.is_sub_contracted_item, 'No') = 'No' and fb.docstatus<2 and fb.parent=%s
 						) a
@@ -246,7 +246,7 @@
 
 
 	def get_csv(self):
-		item_list = [['Item Code', 'Description', 'Stock UOM', 'Required Qty', 'Warehouse', 'Indented Qty', 'Ordered Qty', 'Actual Qty']]
+		item_list = [['Item Code', 'Description', 'Stock UOM', 'Required Qty', 'Warehouse', 'Quantity Requested for Purchase', 'Ordered Qty', 'Actual Qty']]
 		for d in self.item_dict:
 			item_list.append([d, self.item_dict[d][1], self.item_dict[d][2], self.item_dict[d][0]]),
 			item_qty= sql("select warehouse, indented_qty, ordered_qty, actual_qty from `tabBin` where item_code = %s", d)
diff --git a/erpnext/production/doctype/production_planning_tool/production_planning_tool.txt b/erpnext/production/doctype/production_planning_tool/production_planning_tool.txt
index 14b0b75..9634f93 100644
--- a/erpnext/production/doctype/production_planning_tool/production_planning_tool.txt
+++ b/erpnext/production/doctype/production_planning_tool/production_planning_tool.txt
@@ -3,48 +3,48 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:14',
+		'creation': '2012-03-27 14:36:05',
 		'docstatus': 0,
-		'modified': '2012-01-10 16:26:10',
-		'modified_by': 'Administrator',
-		'owner': 'jai@webnotestech.com'
+		'modified': '2012-03-27 14:36:05',
+		'modified_by': u'Administrator',
+		'owner': u'jai@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1326188323',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'_last_update': u'1326188323',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
 		'in_create': 1,
 		'issingle': 1,
-		'module': 'Production',
+		'module': u'Production',
 		'name': '__common__',
 		'read_only': 1,
-		'section_style': 'Tabbed',
-		'server_code_error': ' ',
+		'section_style': u'Tabbed',
+		'server_code_error': u' ',
 		'show_in_menu': 1,
 		'version': 106
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Production Planning Tool',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Production Planning Tool',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Production Planning Tool',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Production Planning Tool',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
 		'write': 1
@@ -53,247 +53,266 @@
 	# DocType, Production Planning Tool
 	{
 		'doctype': 'DocType',
-		'name': 'Production Planning Tool'
+		'name': u'Production Planning Tool'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'role': 'System Manager'
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'role': 'Production User'
+		'doctype': u'DocPerm',
+		'role': u'Production User'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'role': 'Production Manager'
+		'doctype': u'DocPerm',
+		'role': u'Production Manager'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Select Sales Orders'
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'select_sales_orders',
+		'fieldtype': u'Section Break',
+		'label': u'Select Sales Orders'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'width': '50%'
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'from_date',
-		'fieldtype': 'Date',
-		'label': 'From Date'
+		'doctype': u'DocField',
+		'fieldname': u'from_date',
+		'fieldtype': u'Date',
+		'label': u'From Date'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'to_date',
-		'fieldtype': 'Date',
-		'label': 'To Date'
+		'doctype': u'DocField',
+		'fieldname': u'to_date',
+		'fieldtype': u'Date',
+		'label': u'To Date'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fg_item',
-		'fieldtype': 'Link',
-		'label': 'FG Item',
-		'options': 'Item'
+		'doctype': u'DocField',
+		'fieldname': u'fg_item',
+		'fieldtype': u'Link',
+		'label': u'FG Item',
+		'options': u'Item'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'width': '50%'
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'customer',
-		'fieldtype': 'Link',
-		'label': 'Customer',
-		'options': 'Customer'
+		'doctype': u'DocField',
+		'fieldname': u'customer',
+		'fieldtype': u'Link',
+		'label': u'Customer',
+		'options': u'Customer'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Link',
-		'label': 'Company',
-		'options': 'Company',
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Link',
+		'label': u'Company',
+		'options': u'Company',
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'options': 'Simple'
+		'doctype': u'DocField',
+		'fieldname': u'section_break0',
+		'fieldtype': u'Section Break',
+		'options': u'Simple'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'width': '50%'
+		'doctype': u'DocField',
+		'fieldname': u'column_break2',
+		'fieldtype': u'Column Break',
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Get Sales Orders',
-		'options': 'get_open_sales_orders'
+		'doctype': u'DocField',
+		'fieldname': u'get_sales_orders',
+		'fieldtype': u'Button',
+		'label': u'Get Sales Orders',
+		'options': u'get_open_sales_orders'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'width': '50%'
+		'doctype': u'DocField',
+		'fieldname': u'column_break3',
+		'fieldtype': u'Column Break',
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Clear SO Table',
-		'options': 'clear_so_table',
-		'trigger': 'Client'
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'clear_so_table',
+		'fieldtype': u'Button',
+		'label': u'Clear SO Table',
+		'options': u'clear_so_table',
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'options': 'Simple'
+		'doctype': u'DocField',
+		'fieldname': u'section_break1',
+		'fieldtype': u'Section Break',
+		'options': u'Simple'
 	},
 
 	# DocField
 	{
-		'description': 'Select Sales Orders from which you want to create Production Orders. You can get sales orders based on above criteria.',
-		'doctype': 'DocField',
-		'fieldname': 'pp_so_details',
-		'fieldtype': 'Table',
-		'label': 'PP SO Details',
-		'options': 'PP SO Detail'
+		'description': u'Select Sales Orders from which you want to create Production Orders. You can get sales orders based on above criteria.',
+		'doctype': u'DocField',
+		'fieldname': u'pp_so_details',
+		'fieldtype': u'Table',
+		'label': u'Production Plan Sales Orders',
+		'options': u'Production Plan Sales Order'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Items'
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'items',
+		'fieldtype': u'Section Break',
+		'label': u'Items'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Get Items from SO',
-		'options': 'get_items_from_so'
+		'doctype': u'DocField',
+		'fieldname': u'get_items_from_so',
+		'fieldtype': u'Button',
+		'label': u'Get Items from SO',
+		'options': u'get_items_from_so'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'width': '50%'
+		'doctype': u'DocField',
+		'fieldname': u'column_break4',
+		'fieldtype': u'Column Break',
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Clear Item Table',
-		'options': 'clear_item_table',
-		'trigger': 'Client'
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'clear_item_table',
+		'fieldtype': u'Button',
+		'label': u'Clear Item Table',
+		'options': u'clear_item_table',
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'options': 'Simple'
+		'doctype': u'DocField',
+		'fieldname': u'section_break2',
+		'fieldtype': u'Section Break',
+		'options': u'Simple'
 	},
 
 	# DocField
 	{
-		'description': 'Enter items and planned qty for which you want to raise production orders or download raw materials for analysis. You can pull items (which are pending to deliver) from SO as well by adding SO in plan.',
-		'doctype': 'DocField',
-		'fieldname': 'pp_details',
-		'fieldtype': 'Table',
-		'label': 'PP Details',
-		'options': 'PP Detail'
+		'description': u'Enter items and planned qty for which you want to raise production orders or download raw materials for analysis. You can pull items (which are pending to deliver) from SO as well by adding SO in plan.',
+		'doctype': u'DocField',
+		'fieldname': u'pp_details',
+		'fieldtype': u'Table',
+		'label': u'Production Plan Items',
+		'options': u'Production Plan Item'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'No',
-		'description': 'Select "Yes" if stock is maintained and tracked for sub assembly items.',
-		'doctype': 'DocField',
-		'fieldname': 'consider_sa_items',
-		'fieldtype': 'Select',
-		'label': 'Consider Sub Assemblies as Raw Material',
-		'options': 'No\nYes',
+		'colour': u'White:FFF',
+		'default': u'No',
+		'description': u'Select "Yes" if stock is maintained and tracked for sub assembly items.',
+		'doctype': u'DocField',
+		'fieldname': u'consider_sa_items',
+		'fieldtype': u'Select',
+		'label': u'Consider Sub Assemblies as Raw Material',
+		'options': u'No\nYes',
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'options': 'Simple'
+		'doctype': u'DocField',
+		'fieldname': u'section_break3',
+		'fieldtype': u'Section Break',
+		'options': u'Simple'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'width': '50%'
+		'doctype': u'DocField',
+		'fieldname': u'column_break5',
+		'fieldtype': u'Column Break',
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Raise Production Order',
-		'options': 'raise_production_order'
+		'doctype': u'DocField',
+		'fieldname': u'raise_production_order',
+		'fieldtype': u'Button',
+		'label': u'Raise Production Order',
+		'options': u'raise_production_order'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'width': '50%'
+		'doctype': u'DocField',
+		'fieldname': u'column_break6',
+		'fieldtype': u'Column Break',
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Download Raw Material',
-		'trigger': 'Client'
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'download_raw_material',
+		'fieldtype': u'Button',
+		'label': u'Download Raw Material',
+		'trigger': u'Client'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/production/doctype/workstation/workstation.txt b/erpnext/production/doctype/workstation/workstation.txt
index dd0868d..999ce58 100644
--- a/erpnext/production/doctype/workstation/workstation.txt
+++ b/erpnext/production/doctype/workstation/workstation.txt
@@ -3,80 +3,80 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:31',
+		'creation': '2012-03-27 14:36:05',
 		'docstatus': 0,
-		'modified': '2011-11-24 14:34:41',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 18:46:49',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1322125389',
+		'_last_update': u'1322125389',
 		'allow_email': 0,
 		'allow_trash': 1,
-		'autoname': 'field:workstation_name',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'autoname': u'field:workstation_name',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'Production',
+		'document_type': u'Master',
+		'module': u'Production',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'version': 13
+		'version': 14
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Workstation',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Workstation',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Workstation',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Workstation',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Workstation
 	{
 		'doctype': 'DocType',
-		'name': 'Workstation'
+		'name': u'Workstation'
 	},
 
 	# DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'System Manager'
+		'role': u'System Manager'
 	},
 
 	# DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Production User',
+		'role': u'Production User',
 		'write': 1
 	},
 
@@ -84,184 +84,186 @@
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Production User',
+		'role': u'Production User',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Production Manager'
+		'role': u'Production Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Production User'
+		'role': u'Production User'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'workstation_name',
-		'fieldtype': 'Data',
-		'label': 'Workstation Name',
-		'oldfieldname': 'workstation_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'workstation_name',
+		'fieldtype': u'Data',
+		'label': u'Workstation Name',
+		'oldfieldname': u'workstation_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'warehouse',
-		'fieldtype': 'Link',
-		'label': 'Warehouse',
-		'oldfieldname': 'warehouse',
-		'oldfieldtype': 'Link',
-		'options': 'Warehouse',
+		'doctype': u'DocField',
+		'fieldname': u'warehouse',
+		'fieldtype': u'Link',
+		'label': u'Warehouse',
+		'oldfieldname': u'warehouse',
+		'oldfieldtype': u'Link',
+		'options': u'Warehouse',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Text',
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Text',
 		'permlevel': 0,
-		'width': '300px'
+		'width': u'300px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'capacity',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'capacity',
+		'fieldtype': u'Data',
 		'hidden': 1,
-		'label': 'Capacity',
-		'oldfieldname': 'capacity',
-		'oldfieldtype': 'Data',
+		'label': u'Capacity',
+		'oldfieldname': u'capacity',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'capacity_units',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'capacity_units',
+		'fieldtype': u'Select',
 		'hidden': 1,
-		'label': 'Capacity Units',
-		'oldfieldname': 'capacity_units',
-		'oldfieldtype': 'Select',
-		'options': '\nUnits/Shifts\nUnits/Hour',
+		'label': u'Capacity Units',
+		'oldfieldname': u'capacity_units',
+		'oldfieldtype': u'Select',
+		'options': u'\nUnits/Shifts\nUnits/Hour',
 		'permlevel': 0,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'hour_rate_labour',
-		'fieldtype': 'Currency',
-		'label': 'Hour Rate Labour',
-		'oldfieldname': 'hour_rate_labour',
-		'oldfieldtype': 'Currency',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'hour_rate_labour',
+		'fieldtype': u'Currency',
+		'label': u'Hour Rate Labour',
+		'oldfieldname': u'hour_rate_labour',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Over Heads',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'over_heads',
+		'fieldtype': u'Section Break',
+		'label': u'Over Heads',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'hour_rate_electricity',
-		'fieldtype': 'Currency',
-		'label': 'Hour Rate Electricity',
-		'oldfieldname': 'hour_rate_electricity',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'hour_rate_electricity',
+		'fieldtype': u'Currency',
+		'label': u'Hour Rate Electricity',
+		'oldfieldname': u'hour_rate_electricity',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'hour_rate_consumable',
-		'fieldtype': 'Currency',
-		'label': 'Hour Rate Consumable',
-		'oldfieldname': 'hour_rate_consumable',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'hour_rate_consumable',
+		'fieldtype': u'Currency',
+		'label': u'Hour Rate Consumable',
+		'oldfieldname': u'hour_rate_consumable',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'hour_rate_rent',
-		'fieldtype': 'Currency',
-		'label': 'Hour Rate Rent',
-		'oldfieldname': 'hour_rate_rent',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'hour_rate_rent',
+		'fieldtype': u'Currency',
+		'label': u'Hour Rate Rent',
+		'oldfieldname': u'hour_rate_rent',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'overhead',
-		'fieldtype': 'Currency',
-		'label': 'Overhead',
-		'oldfieldname': 'overhead',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'overhead',
+		'fieldtype': u'Currency',
+		'label': u'Overhead',
+		'oldfieldname': u'overhead',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Hour Rate',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'hour_rate_section_break',
+		'fieldtype': u'Section Break',
+		'label': u'Hour Rate',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'hour_rate',
-		'fieldtype': 'Currency',
-		'label': 'Hour Rate',
-		'oldfieldname': 'hour_rate',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'hour_rate',
+		'fieldtype': u'Currency',
+		'label': u'Hour Rate',
+		'oldfieldname': u'hour_rate',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/production/page/bill_of_materials/bill_of_materials.js b/erpnext/production/page/bill_of_materials/bill_of_materials.js
index aba5666..7fcd6aa 100644
--- a/erpnext/production/page/bill_of_materials/bill_of_materials.js
+++ b/erpnext/production/page/bill_of_materials/bill_of_materials.js
@@ -489,7 +489,7 @@
     if(i==1) {
       var c = $a(this.tab.rows[0].cells[i], 'div', 'link_type', {overflow:'hidden', width:'100%'});
       c.bom_no = label[tree.col_details[i][3]]
-      c.onclick = function() { loaddoc("Bill Of Materials", this.bom_no); }
+      c.onclick = function() { loaddoc("BOM", this.bom_no); }
       c.innerHTML = label[tree.col_details[i][3]];
     }
     if(this.is_item == 1 && i > 1 && i < 6) {
diff --git a/erpnext/production/page/production_home/production_home.html b/erpnext/production/page/production_home/production_home.html
index 13e2468..77d8019 100644
--- a/erpnext/production/page/production_home/production_home.html
+++ b/erpnext/production/page/production_home/production_home.html
@@ -1,17 +1,19 @@
 <div class="layout-wrapper layout-wrapper-background">
+	<div class="appframe-area"></div>
 	<div class="layout-main-section">
-		<a class="close" onclick="window.history.back();">&times;</a>
 		<h1>Production</h1>
 		<hr>
 		<div style="width: 48%; float: left;">
 			<h4><a href="#!List/Production Order">Production Order</a></h4>
 			<p class="help">Orders for manufacturing</p>
+			<br>
 			<h4><a href="#!Form/Production Planning Tool/Production Planning Tool">Production Plan</a></h4>
 			<p class="help">Generate Purchase Requisition (MRP) and Production Orders</p>
 		</div>
 		<div style="width: 48%; float: right;">
-			<h4><a href="#!List/Bill Of Materials">Bill of Materials</a></h4>
+			<h4><a href="#!List/BOM">Bill of Materials</a></h4>
 			<p class="help">Bill of Materials (BOM) Master</p>
+			<br>
 			<h4><a href="#!List/Item">Item</a></h4>
 			<p class="help">Item Master</p>
 		</div>
@@ -42,11 +44,6 @@
 					</div>
 					<div class="section-item">
 						<a class="section-link" 
-							title = "Replace item/sub-assembly from a sub-assembly from all BOMs"
-							href="#!Form/BOM Replace Utility/BOM Replace Utility">BOM Replace Item</a>
-					</div>
-					<div class="section-item">
-						<a class="section-link" 
 							title = "Update delivery dates in all Sales Orders"
 							href="#!Form/Update Delivery Date/Update Delivery Date">Update Delivery Dates</a>
 					</div>
@@ -55,4 +52,4 @@
 		</div>
 	</div>
 	<div style="clear: both;"></div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/production/page/production_home/production_home.js b/erpnext/production/page/production_home/production_home.js
index 5367815..af4ba9d 100644
--- a/erpnext/production/page/production_home/production_home.js
+++ b/erpnext/production/page/production_home/production_home.js
@@ -15,5 +15,6 @@
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 pscript['onload_production-home'] = function(wrapper) {
+	wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
 	erpnext.module_page.setup_page('Production', wrapper);
 }
\ No newline at end of file
diff --git a/erpnext/production/search_criteria/consumption_against_production/consumption_against_production.txt b/erpnext/production/search_criteria/consumption_against_production/consumption_against_production.txt
index a0da069..54d6a19 100644
--- a/erpnext/production/search_criteria/consumption_against_production/consumption_against_production.txt
+++ b/erpnext/production/search_criteria/consumption_against_production/consumption_against_production.txt
@@ -3,35 +3,35 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:32',
+		'creation': '2012-04-03 12:49:50',
 		'docstatus': 0,
-		'modified': '2010-06-11 16:32:48',
-		'modified_by': 'Administrator',
-		'owner': 'jai@webnotestech.com'
+		'modified': '2012-04-03 12:49:50',
+		'modified_by': u'Administrator',
+		'owner': u'jai@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_col': '`tabProduction Order`.consider_sa_items',
-		'add_cond': '`tabProduction Order`.name = `tabStock Entry`.production_order',
-		'add_tab': '`tabProduction Order`',
-		'columns': 'Stock Entry\x01ID,Stock Entry\x01Production Order,Stock Entry\x01Process,Stock Entry\x01Posting Date,Stock Entry\x01Company,Stock Entry Detail\x01Source Warehouse,Stock Entry Detail\x01Target Warehouse,Stock Entry Detail\x01FG Item,Stock Entry Detail\x01Item Code,Stock Entry Detail\x01Description,Stock Entry Detail\x01Reqd Qty,Stock Entry Detail\x01Transfer Quantity',
-		'criteria_name': 'Consumption Against Production',
-		'doc_type': 'Stock Entry Detail',
+		'add_col': u'`tabProduction Order`.consider_sa_items',
+		'add_cond': u'`tabProduction Order`.name = `tabStock Entry`.production_order',
+		'add_tab': u'`tabProduction Order`',
+		'columns': u'Stock Entry\x01ID,Stock Entry\x01Production Order,Stock Entry\x01Process,Stock Entry\x01Posting Date,Stock Entry\x01Company,Stock Entry Detail\x01Source Warehouse,Stock Entry Detail\x01Target Warehouse,Stock Entry Detail\x01FG Item,Stock Entry Detail\x01Item Code,Stock Entry Detail\x01Description,Stock Entry Detail\x01Reqd Qty,Stock Entry Detail\x01Transfer Quantity',
+		'criteria_name': u'Consumption Against Production',
+		'doc_type': u'Stock Entry Detail',
 		'doctype': 'Search Criteria',
-		'filters': "{'Stock Entry\x01Submitted':1,'Stock Entry\x01Purpose':'Production Order','Stock Entry\x01Process':''}",
-		'module': 'Production',
+		'filters': u"{'Stock Entry\x01Submitted':1,'Stock Entry\x01Purpose':'Production Order','Stock Entry\x01Process':''}",
+		'module': u'Production',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Stock Entry',
-		'sort_by': '`tabStock Entry`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Stock Entry',
+		'sort_by': u'`tabStock Entry`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, consumption_against_production
 	{
 		'doctype': 'Search Criteria',
-		'name': 'consumption_against_production'
+		'name': u'consumption_against_production'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/production/search_criteria/delivery_plan/__init__.py b/erpnext/production/search_criteria/delivery_plan/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/production/search_criteria/delivery_plan/__init__.py
+++ /dev/null
diff --git a/erpnext/production/search_criteria/delivery_plan/delivery_plan.js b/erpnext/production/search_criteria/delivery_plan/delivery_plan.js
deleted file mode 100644
index 63d0da8..0000000
--- a/erpnext/production/search_criteria/delivery_plan/delivery_plan.js
+++ /dev/null
@@ -1,34 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-
-  //to hide all filters
-  //this.hide_all_filters();
-
-  // to disable a filter from query set 
-  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Status'].df.ignore = 1;
-
-  // to unhide required filters
-  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer'].df.filter_hide = 0;
-  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer Name'].df.filter_hide = 0;
-  this.filter_fields_dict['Sales Order Detail'+FILTER_SEP +'From Confirmed Delivery Date'].df.filter_hide = 0;
-  this.filter_fields_dict['Sales Order Detail'+FILTER_SEP +'To Confirmed Delivery Date'].df.filter_hide = 0;
-
-
-  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
-  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
-}
\ No newline at end of file
diff --git a/erpnext/production/search_criteria/delivery_plan/delivery_plan.txt b/erpnext/production/search_criteria/delivery_plan/delivery_plan.txt
deleted file mode 100644
index 683acb7..0000000
--- a/erpnext/production/search_criteria/delivery_plan/delivery_plan.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-# Search Criteria, delivery_plan
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-09-01 15:48:09',
-		'docstatus': 0,
-		'modified': '2010-08-30 14:06:22',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_col': "SUM(`tabSales Order Detail`.`pending_qty` * `tabSales Order Detail`.`basic_rate` ) AS 'Amount'",
-		'add_cond': "`tabSales Order Detail`.pending_qty > 0 and (`tabSales Order Detail`.confirmation_date is not null or `tabSales Order Detail`.confirmation_date!='' or `tabSales Order Detail`.confirmation_date != '00-00-0000')",
-		'columns': 'Sales Order\x01ID,Sales Order\x01Customer,Sales Order\x01Customer Name',
-		'criteria_name': 'Delivery Plan',
-		'doc_type': 'Sales Order Detail',
-		'doctype': 'Search Criteria',
-		'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
-		'group_by': '`tabSales Order Detail`.`confirmation_date`, `tabSales Order`.`name`',
-		'module': 'Production',
-		'name': '__common__',
-		'page_len': 50,
-		'parent_doc_type': 'Sales Order',
-		'sort_by': '`tabSales Order`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, delivery_plan
-	{
-		'doctype': 'Search Criteria',
-		'name': 'delivery_plan'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/production/search_criteria/itemwise_production_report/itemwise_production_report.txt b/erpnext/production/search_criteria/itemwise_production_report/itemwise_production_report.txt
index b861d17..6f0c3eb 100644
--- a/erpnext/production/search_criteria/itemwise_production_report/itemwise_production_report.txt
+++ b/erpnext/production/search_criteria/itemwise_production_report/itemwise_production_report.txt
@@ -3,32 +3,32 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:32',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2010-06-14 15:50:44',
-		'modified_by': 'Administrator',
-		'owner': 'jai@webnotestech.com'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'jai@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Stock Entry\x01ID,Stock Entry\x01Posting Date,Stock Entry\x01Production Order,Stock Entry\x01Process,Stock Entry\x01Company,Stock Entry Detail\x01Target Warehouse,Stock Entry Detail\x01Item Code,Stock Entry Detail\x01Description,Stock Entry Detail\x01Stock UOM,Stock Entry Detail\x01Transfer Quantity',
-		'criteria_name': 'Itemwise Production Report',
-		'doc_type': 'Stock Entry Detail',
+		'columns': u'Stock Entry\x01ID,Stock Entry\x01Posting Date,Stock Entry\x01Production Order,Stock Entry\x01Process,Stock Entry\x01Company,Stock Entry Detail\x01Target Warehouse,Stock Entry Detail\x01Item Code,Stock Entry Detail\x01Description,Stock Entry Detail\x01Stock UOM,Stock Entry Detail\x01Transfer Quantity',
+		'criteria_name': u'Itemwise Production Report',
+		'doc_type': u'Stock Entry Detail',
 		'doctype': 'Search Criteria',
-		'filters': "{'Stock Entry\x01Saved':1,'Stock Entry\x01Submitted':1,'Stock Entry\x01Purpose':'Production Order','Stock Entry\x01Process':'Backflush','Stock Entry Detail\x01FG Item':1}",
-		'module': 'Production',
+		'filters': u"{'Stock Entry\x01Saved':1,'Stock Entry\x01Submitted':1,'Stock Entry\x01Purpose':'Production Order','Stock Entry\x01Process':'Backflush','Stock Entry Detail\x01FG Item':1}",
+		'module': u'Production',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Stock Entry',
-		'sort_by': '`tabStock Entry`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Stock Entry',
+		'sort_by': u'`tabStock Entry`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, itemwise_production_report
 	{
 		'doctype': 'Search Criteria',
-		'name': 'itemwise_production_report'
+		'name': u'itemwise_production_report'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/production/search_criteria/production_orders_in_process/production_orders_in_process.txt b/erpnext/production/search_criteria/production_orders_in_process/production_orders_in_process.txt
index a5fd27d..51eb1f4 100644
--- a/erpnext/production/search_criteria/production_orders_in_process/production_orders_in_process.txt
+++ b/erpnext/production/search_criteria/production_orders_in_process/production_orders_in_process.txt
@@ -3,32 +3,32 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:32',
+		'creation': '2012-04-03 12:49:52',
 		'docstatus': 0,
-		'modified': '2010-06-15 10:01:15',
-		'modified_by': 'Administrator',
-		'owner': 'jai@webnotestech.com'
+		'modified': '2012-04-03 12:49:52',
+		'modified_by': u'Administrator',
+		'owner': u'jai@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_cond': '`tabProduction Order`.qty > `tabProduction Order`.produced_qty',
-		'columns': 'Production Order\x01ID,Production Order\x01Origin,Production Order\x01Status,Production Order\x01Posting Date,Production Order\x01Production Item,Production Order\x01BOM No,Production Order\x01Description,Production Order\x01Stock UOM,Production Order\x01Qty,Production Order\x01Produced Qty,Production Order\x01FG Warehouse,Production Order\x01WIP Warehouse,Production Order\x01Consider SA Items,Production Order\x01Fiscal Year,Production Order\x01Company',
-		'criteria_name': 'Production Orders In Process',
-		'doc_type': 'Production Order',
+		'add_cond': u'`tabProduction Order`.qty > `tabProduction Order`.produced_qty',
+		'columns': u'Production Order\x01ID,Production Order\x01Origin,Production Order\x01Status,Production Order\x01Posting Date,Production Order\x01Production Item,Production Order\x01BOM No,Production Order\x01Description,Production Order\x01Stock UOM,Production Order\x01Qty,Production Order\x01Produced Qty,Production Order\x01FG Warehouse,Production Order\x01WIP Warehouse,Production Order\x01Consider SA Items,Production Order\x01Fiscal Year,Production Order\x01Company',
+		'criteria_name': u'Production Orders In Process',
+		'doc_type': u'Production Order',
 		'doctype': 'Search Criteria',
-		'filters': "{'Production Order\x01Submitted':1,'Production Order\x01Origin':'','Production Order\x01Status':'','Production Order\x01Consider SA Items':'','Production Order\x01Fiscal Year':''}",
-		'module': 'Production',
+		'filters': u"{'Production Order\x01Submitted':1,'Production Order\x01Origin':'','Production Order\x01Status':'','Production Order\x01Consider SA Items':'','Production Order\x01Fiscal Year':''}",
+		'module': u'Production',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabProduction Order`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabProduction Order`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, production_orders_in_process
 	{
 		'doctype': 'Search Criteria',
-		'name': 'production_orders_in_process'
+		'name': u'production_orders_in_process'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/projects/Module Def/Projects/Projects.txt b/erpnext/projects/Module Def/Projects/Projects.txt
deleted file mode 100644
index f8cf6f7..0000000
--- a/erpnext/projects/Module Def/Projects/Projects.txt
+++ /dev/null
@@ -1,141 +0,0 @@
-[
-	{
-		'_last_update': '1300959287',
-		'creation': '2010-11-30 17:31:44',
-		'disabled': 'No',
-		'docstatus': 0,
-		'doctype': u'Module Def',
-		'doctype_list': None,
-		'file_list': 'undefined,undefined',
-		'idx': None,
-		'is_hidden': 'No',
-		'last_updated_date': '2011-03-10 15:57:47',
-		'modified': '2011-03-24 15:07:53',
-		'modified_by': 'Administrator',
-		'module_desc': '<div id="projects_div"></div>',
-		'module_icon': 'puzzle.png',
-		'module_label': 'Projects',
-		'module_name': 'Projects',
-		'module_page': None,
-		'module_seq': 2,
-		'name': 'Projects',
-		'owner': 'Administrator',
-		'parent': None,
-		'parentfield': None,
-		'parenttype': None,
-		'trash_reason': None,
-		'widget_code': None
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 17:31:44',
-		'description': None,
-		'display_name': 'Project',
-		'doc_name': 'Project',
-		'doc_type': 'Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 1,
-		'modified': '2011-03-24 15:07:53',
-		'modified_by': 'Administrator',
-		'name': 'MDI00099',
-		'owner': 'Administrator',
-		'parent': 'Projects',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': None,
-		'description': None,
-		'display_name': 'Task',
-		'doc_name': 'Ticket',
-		'doc_type': 'Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 2,
-		'modified': '2011-03-24 15:07:53',
-		'modified_by': 'Administrator',
-		'name': 'MDI00285',
-		'owner': None,
-		'parent': 'Projects',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': None,
-		'description': None,
-		'display_name': 'Gantt Chart',
-		'doc_name': 'Projects',
-		'doc_type': 'Pages',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 3,
-		'modified': '2011-03-24 15:07:53',
-		'modified_by': 'Administrator',
-		'name': 'MDI00286',
-		'owner': None,
-		'parent': 'Projects',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': None,
-		'description': None,
-		'display_name': 'Timesheet',
-		'doc_name': 'Timesheet',
-		'doc_type': 'Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 4,
-		'modified': '2011-03-24 15:07:53',
-		'modified_by': 'Administrator',
-		'name': 'MDI00287',
-		'owner': None,
-		'parent': 'Projects',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'creation': '2010-11-30 17:31:44',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 1,
-		'modified': '2011-03-24 15:07:53',
-		'modified_by': 'Administrator',
-		'name': 'MDR00012',
-		'owner': 'Administrator',
-		'parent': 'Projects',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'Projects User'
-	},
-	{
-		'creation': '2010-11-30 17:31:44',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 2,
-		'modified': '2011-03-24 15:07:53',
-		'modified_by': 'Administrator',
-		'name': 'MDR00013',
-		'owner': 'Administrator',
-		'parent': 'Projects',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'System Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/projects/Role/Projects User/Projects User.txt b/erpnext/projects/Role/Projects User/Projects User.txt
deleted file mode 100644
index 61a5a3b..0000000
--- a/erpnext/projects/Role/Projects User/Projects User.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Projects User
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2010-05-08 09:40:07',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Projects',
-		'name': '__common__',
-		'role_name': 'Projects User'
-	},
-
-	# Role, Projects User
-	{
-		'doctype': 'Role',
-		'name': 'Projects User'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/projects/__init__.py b/erpnext/projects/__init__.py
index e69de29..61a6eb6 100644
--- a/erpnext/projects/__init__.py
+++ b/erpnext/projects/__init__.py
@@ -0,0 +1,3 @@
+install_docs = [
+	{"doctype":"Role", "role_name":"Projects User", "name":"Projects User"},
+]
diff --git a/erpnext/projects/doctype/activity_type/activity_type.txt b/erpnext/projects/doctype/activity_type/activity_type.txt
index f366101..46ed917 100644
--- a/erpnext/projects/doctype/activity_type/activity_type.txt
+++ b/erpnext/projects/doctype/activity_type/activity_type.txt
@@ -3,76 +3,76 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-02-23 11:22:28',
+		'creation': '2012-03-27 14:36:05',
 		'docstatus': 0,
-		'modified': '2011-02-21 15:43:40',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:05',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'autoname': 'field:activity_type',
-		'colour': 'White:FFF',
+		'autoname': u'field:activity_type',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'in_dialog': 1,
-		'module': 'Projects',
+		'module': u'Projects',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 12
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'activity_type',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'label': 'Activity Type',
+		'doctype': u'DocField',
+		'fieldname': u'activity_type',
+		'fieldtype': u'Data',
+		'label': u'Activity Type',
 		'name': '__common__',
-		'parent': 'Activity Type',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Activity Type',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# These values are common for all DocPerm
 	{
+		'amend': 0,
+		'cancel': 0,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Activity Type',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Activity Type',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
+		'submit': 0,
 		'write': 1
 	},
 
 	# DocType, Activity Type
 	{
 		'doctype': 'DocType',
-		'name': 'Activity Type'
+		'name': u'Activity Type'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'System Manager'
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'Projects User'
+		'doctype': u'DocPerm',
+		'role': u'Projects User'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField'
+		'doctype': u'DocField'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/projects/doctype/project/help.md b/erpnext/projects/doctype/project/help.md
new file mode 100644
index 0000000..0043f04
--- /dev/null
+++ b/erpnext/projects/doctype/project/help.md
@@ -0,0 +1,5 @@
+You can use projects to:
+
+1. Track budgets (Purchase Orders, Invoices).
+2. Track material consumption.
+3. Create and assign tasks (and view them on a Gantt Chart).
\ No newline at end of file
diff --git a/erpnext/projects/doctype/project/project.js b/erpnext/projects/doctype/project/project.js
index 801ba56..faa175f 100644
--- a/erpnext/projects/doctype/project/project.js
+++ b/erpnext/projects/doctype/project/project.js
@@ -52,4 +52,4 @@
 //--------- calculate gross profit --------------------------------
 cur_frm.cscript.est_material_cost = function(doc, cdt, cdn){
   get_server_fields('get_gross_profit','','',doc, cdt, cdn, 1);
-}
\ No newline at end of file
+}
diff --git a/erpnext/projects/doctype/project/project.txt b/erpnext/projects/doctype/project/project.txt
index 0cc81c6..527201e 100644
--- a/erpnext/projects/doctype/project/project.txt
+++ b/erpnext/projects/doctype/project/project.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:14',
+		'creation': '2012-03-27 14:36:05',
 		'docstatus': 0,
-		'modified': '2012-03-22 14:39:13',
+		'modified': '2012-03-27 14:36:05',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -43,16 +43,12 @@
 
 	# These values are common for all DocPerm
 	{
-		'cancel': 1,
-		'create': 1,
 		'doctype': u'DocPerm',
 		'name': '__common__',
 		'parent': u'Project',
 		'parentfield': u'permissions',
 		'parenttype': u'DocType',
-		'permlevel': 0,
-		'read': 1,
-		'write': 1
+		'read': 1
 	},
 
 	# DocType, Project
@@ -63,14 +59,33 @@
 
 	# DocPerm
 	{
+		'amend': 0,
+		'cancel': 1,
+		'create': 1,
 		'doctype': u'DocPerm',
-		'role': u'All'
+		'permlevel': 0,
+		'role': u'All',
+		'submit': 0,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Projects User',
+		'submit': 0,
+		'write': 1
 	},
 
 	# DocPerm
 	{
 		'doctype': u'DocPerm',
-		'role': u'Projects User'
+		'permlevel': 1,
+		'role': u'All'
 	},
 
 	# DocField
@@ -78,6 +93,7 @@
 		'colour': u'White:FFF',
 		'description': u'Helps you keep track of your projects and links to Tasks. You can tag a task to a project to track its progress',
 		'doctype': u'DocField',
+		'fieldname': u'basic_info',
 		'fieldtype': u'Section Break',
 		'label': u'Basic Info',
 		'oldfieldtype': u'Section Break',
@@ -95,8 +111,7 @@
 		'oldfieldname': u'project_name',
 		'oldfieldtype': u'Data',
 		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1
+		'reqd': 1
 	},
 
 	# DocField
@@ -114,7 +129,7 @@
 		'options': u'Open\nCompleted\nCancelled',
 		'permlevel': 0,
 		'reqd': 1,
-		'search_index': 0
+		'search_index': 1
 	},
 
 	# DocField
@@ -287,6 +302,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'project_details',
 		'fieldtype': u'Section Break',
 		'label': u'Project Details',
 		'oldfieldtype': u'Section Break',
@@ -297,6 +313,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -306,6 +323,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'section_break0',
 		'fieldtype': u'Section Break',
 		'oldfieldtype': u'Section Break',
 		'options': u'Simple',
@@ -328,6 +346,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'customer_details',
 		'fieldtype': u'Section Break',
 		'label': u'Customer Details',
 		'oldfieldtype': u'Section Break',
@@ -365,7 +384,7 @@
 		'oldfieldname': u'customer_name',
 		'oldfieldtype': u'Data',
 		'permlevel': 1,
-		'search_index': 0
+		'search_index': 1
 	},
 
 	# DocField
@@ -406,7 +425,6 @@
 		'fieldtype': u'Link',
 		'in_filter': 1,
 		'label': u'Territory',
-		'no_copy': 0,
 		'oldfieldname': u'territory',
 		'oldfieldtype': u'Link',
 		'options': u'Territory',
@@ -461,6 +479,7 @@
 		'colour': u'White:FFF',
 		'description': u'Important dates and commitments in your project life cycle',
 		'doctype': u'DocField',
+		'fieldname': u'milestones',
 		'fieldtype': u'Section Break',
 		'label': u'Milestones',
 		'oldfieldtype': u'Section Break',
diff --git a/erpnext/projects/doctype/project_activity/project_activity.js b/erpnext/projects/doctype/project_activity/project_activity.js
index ed2b1df..46531b7 100644
--- a/erpnext/projects/doctype/project_activity/project_activity.js
+++ b/erpnext/projects/doctype/project_activity/project_activity.js
@@ -55,7 +55,7 @@
       if (ci==0){ 
         var d1 = $a(cell,'div');
         var img = $a(cell,'img','',{width:'40px'});
-        set_user_img(img,d[ri][0])
+        img.src = wn.user_info(d[ri][0]).image;
         var d2 = $a(cell,'div');
         d2.innerHTML =  d[ri][0] + ' on: ' + date.str_to_user(d[ri][1]);
       }
@@ -71,7 +71,7 @@
       }
     }
   
-    lst.make(cur_frm.fields_dict['Updates HTML'].wrapper);
+    lst.make(cur_frm.fields_dict['updates_html'].wrapper);
     cur_frm.mylist = lst;
     lst.run();
   }
@@ -81,14 +81,14 @@
 
   // show activities only after project is saved
 
-  var fl = ['new_update','Add','hours','Updates HTML'];
+  var fl = ['new_update','add','hours','updates_html'];
   if(doc.__islocal) { 
     hide_field(fl);}
   else { 
     unhide_field(fl); }
 }
 
-cur_frm.cscript['Add'] = function(doc, dt, dn) {
+cur_frm.cscript.add = function(doc, dt, dn) {
   var callback = function(r,rt) {
     
     // refresh listing
@@ -96,4 +96,4 @@
 
   }
   $c_obj([doc],'add_update','',callback);
-}
\ No newline at end of file
+}
diff --git a/erpnext/projects/doctype/project_activity/project_activity.txt b/erpnext/projects/doctype/project_activity/project_activity.txt
index d194131..5447165 100644
--- a/erpnext/projects/doctype/project_activity/project_activity.txt
+++ b/erpnext/projects/doctype/project_activity/project_activity.txt
@@ -3,173 +3,165 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:14',
+		'creation': '2012-03-27 14:36:06',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:06',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'autoname': 'Activity.######',
-		'colour': 'White:FFF',
+		'autoname': u'Activity.######',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'module': 'Projects',
+		'module': u'Projects',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 15
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Project Activity',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Project Activity',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Project Activity',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Project Activity',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
-		'role': 'All',
+		'role': u'All',
 		'write': 1
 	},
 
 	# DocType, Project Activity
 	{
 		'doctype': 'DocType',
-		'name': 'Project Activity'
+		'name': u'Project Activity'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm'
+		'doctype': u'DocPerm'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'project',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Project',
-		'oldfieldname': 'project',
-		'oldfieldtype': 'Link',
-		'options': 'Project'
+		'doctype': u'DocField',
+		'fieldname': u'project',
+		'fieldtype': u'Link',
+		'label': u'Project',
+		'oldfieldname': u'project',
+		'oldfieldtype': u'Link',
+		'options': u'Project'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'activity_name',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Activity Name',
-		'oldfieldname': 'activity_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'activity_name',
+		'fieldtype': u'Data',
+		'label': u'Activity Name',
+		'oldfieldname': u'activity_name',
+		'oldfieldtype': u'Data',
 		'print_hide': 1,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'percent_complete',
-		'fieldtype': 'Select',
-		'idx': 3,
-		'label': 'Percent Complete',
-		'oldfieldname': 'percent_complete',
-		'oldfieldtype': 'Select',
-		'options': '0\n5\n10\n15\n20\n25\n30\n35\n40\n45\n50\n55\n60\n65\n70\n75\n80\n85\n90\n95\n100',
+		'doctype': u'DocField',
+		'fieldname': u'percent_complete',
+		'fieldtype': u'Select',
+		'label': u'Percent Complete',
+		'oldfieldname': u'percent_complete',
+		'oldfieldtype': u'Select',
+		'options': u'0\n5\n10\n15\n20\n25\n30\n35\n40\n45\n50\n55\n60\n65\n70\n75\n80\n85\n90\n95\n100',
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'last_update',
-		'fieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'last_update',
+		'fieldtype': u'Date',
 		'hidden': 1,
-		'idx': 4,
-		'label': 'Last Update',
-		'oldfieldname': 'last_update',
-		'oldfieldtype': 'Date',
+		'label': u'Last Update',
+		'oldfieldname': u'last_update',
+		'oldfieldtype': u'Date',
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'last_update_by',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'last_update_by',
+		'fieldtype': u'Data',
 		'hidden': 1,
-		'idx': 5,
-		'label': 'Last Update By',
-		'oldfieldname': 'last_update_by',
-		'oldfieldtype': 'Data',
+		'label': u'Last Update By',
+		'oldfieldname': u'last_update_by',
+		'oldfieldtype': u'Data',
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 6,
-		'label': 'Updates',
-		'oldfieldtype': 'Section Break'
+		'doctype': u'DocField',
+		'fieldname': u'updates',
+		'fieldtype': u'Section Break',
+		'label': u'Updates',
+		'oldfieldtype': u'Section Break'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 7,
-		'label': 'Updates HTML',
-		'oldfieldtype': 'HTML'
+		'doctype': u'DocField',
+		'fieldname': u'updates_html',
+		'fieldtype': u'HTML',
+		'label': u'Updates HTML',
+		'oldfieldtype': u'HTML'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'new_update',
-		'fieldtype': 'Text',
-		'idx': 8,
-		'label': 'New Update',
-		'oldfieldname': 'new_update',
-		'oldfieldtype': 'Text'
+		'doctype': u'DocField',
+		'fieldname': u'new_update',
+		'fieldtype': u'Text',
+		'label': u'New Update',
+		'oldfieldname': u'new_update',
+		'oldfieldtype': u'Text'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'hours',
-		'fieldtype': 'Float',
-		'idx': 9,
-		'label': 'Hours',
-		'oldfieldname': 'hours',
-		'oldfieldtype': 'Float'
+		'doctype': u'DocField',
+		'fieldname': u'hours',
+		'fieldtype': u'Float',
+		'label': u'Hours',
+		'oldfieldname': u'hours',
+		'oldfieldtype': u'Float'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 10,
-		'label': 'Add',
-		'oldfieldtype': 'Button',
-		'trigger': 'Client'
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'add',
+		'fieldtype': u'Button',
+		'label': u'Add',
+		'oldfieldtype': u'Button',
+		'trigger': u'Client'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/projects/doctype/project_activity_update/project_activity_update.txt b/erpnext/projects/doctype/project_activity_update/project_activity_update.txt
index 5455de5..8155ccf 100644
--- a/erpnext/projects/doctype/project_activity_update/project_activity_update.txt
+++ b/erpnext/projects/doctype/project_activity_update/project_activity_update.txt
@@ -3,61 +3,59 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:15',
+		'creation': '2012-03-27 14:36:06',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:06',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Projects',
+		'module': u'Projects',
 		'name': '__common__',
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'version': 1
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Project Activity Update',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Project Activity Update',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# DocType, Project Activity Update
 	{
 		'doctype': 'DocType',
-		'name': 'Project Activity Update'
+		'name': u'Project Activity Update'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'update',
-		'fieldtype': 'Text',
-		'idx': 1,
-		'label': 'Update',
-		'oldfieldname': 'update',
-		'oldfieldtype': 'Text'
+		'doctype': u'DocField',
+		'fieldname': u'update',
+		'fieldtype': u'Text',
+		'label': u'Update',
+		'oldfieldname': u'update',
+		'oldfieldtype': u'Text'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'e.g. 0.5, 2.5 etc',
-		'doctype': 'DocField',
-		'fieldname': 'hours',
-		'fieldtype': 'Float',
-		'idx': 2,
-		'label': 'Hours',
-		'oldfieldname': 'hours',
-		'oldfieldtype': 'Float'
+		'colour': u'White:FFF',
+		'description': u'e.g. 0.5, 2.5 etc',
+		'doctype': u'DocField',
+		'fieldname': u'hours',
+		'fieldtype': u'Float',
+		'label': u'Hours',
+		'oldfieldname': u'hours',
+		'oldfieldtype': u'Float'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/projects/doctype/project_control/project_control.py b/erpnext/projects/doctype/project_control/project_control.py
index a1fdf11..036ffb8 100644
--- a/erpnext/projects/doctype/project_control/project_control.py
+++ b/erpnext/projects/doctype/project_control/project_control.py
@@ -68,10 +68,10 @@
 		n_tasks = {}
 		
 		for p in pl:
-			t1 = sql('select count(*) from tabTicket where project=%s and docstatus!=2', p)[0][0]
+			t1 = sql('select count(*) from tabTask where project=%s and docstatus!=2', p)[0][0]
 			n_tasks[p] = t1 or 0
 			if t1:
-				t2 = sql('select count(*) from tabTicket where project=%s and docstatus!=2 and status="Closed"', p)[0][0]
+				t2 = sql('select count(*) from tabTask where project=%s and docstatus!=2 and status="Closed"', p)[0][0]
 				comp[p] = cint(flt(t2)*100/t1)
 		
 		return {'pl':pl, 'ml':ml, 'comp':comp, 'n_tasks':n_tasks, 'status':status}
@@ -80,15 +80,15 @@
 		ret = {}
 
 		# resource list
-		rl = sql("select distinct allocated_to, assignee_email from tabTicket")
+		rl = sql("select distinct allocated_to, assignee_email from tabTask")
 
 		# get open & closed tickets
 		for r in rl:
 			if r[0]:
 				ret[r[1]] = {}
 				ret[r[1]]['id'] = r[0]
-				ret[r[1]]['Total'] = sql("select count(*) from tabTicket where allocated_to=%s and docstatus!=2", r[0])[0][0]
-				ret[r[1]]['Closed'] = sql("select count(*) from tabTicket where allocated_to=%s and status='Closed' and docstatus!=2", r[0])[0][0]
+				ret[r[1]]['Total'] = sql("select count(*) from tabTask where allocated_to=%s and docstatus!=2", r[0])[0][0]
+				ret[r[1]]['Closed'] = sql("select count(*) from tabTask where allocated_to=%s and status='Closed' and docstatus!=2", r[0])[0][0]
 				ret[r[1]]['percent'] = cint(flt(ret[r[1]]['Closed']) * 100 / ret[r[1]]['Total'])
 
 		return ret
@@ -98,7 +98,7 @@
 
 	def get_init_data(self, arg=''):
 		pl = [p[0] for p in sql('select name from tabProject where docstatus != 2')]
-		rl = [p[0] for p in sql('select distinct allocated_to from tabTicket where docstatus != 2 and ifnull(allocated_to,"") != ""')]
+		rl = [p[0] for p in sql('select distinct allocated_to from tabTask where docstatus != 2 and ifnull(allocated_to,"") != ""')]
 		return {'pl':pl, 'rl':rl}
 
 	def get_tasks(self, arg):
@@ -113,7 +113,7 @@
 
 		tl = sql("""
 			select subject, allocated_to, project, exp_start_date, exp_end_date, priority, status, name
-			from tabTicket 
+			from tabTask 
 			where 
 				((exp_start_date between '%(st)s' and '%(end)s') or 
 				(exp_end_date between '%(st)s' and '%(end)s') or 
@@ -122,7 +122,7 @@
 		return convert_to_lists(tl)
 	
 	def declare_proj_completed(self, arg):
-		chk = sql("select name from `tabTicket` where project=%s and status='Open'", arg)
+		chk = sql("select name from `tabTask` where project=%s and status='Open'", arg)
 		if chk:
 			chk_lst = [x[0] for x in chk]
 			msgprint("Task(s) "+','.join(chk_lst)+" has staus 'Open'. Please submit all tasks against this project before closing the project.")
@@ -136,7 +136,7 @@
 	task_list = sql("""
 		select subject, allocated_to, project, exp_start_date, exp_end_date,
 			priority, status, name, senders_name, opening_date, review_date, description 
-		from tabTicket
+		from tabTask
 		where task_email_notify=1 
 			and sent_reminder=0 
 			and status='Open' 
@@ -157,5 +157,5 @@
 			<p>(This notification is autogenerated)</p>""" % i
 			sendmail(i['allocated_to'], sender='automail@webnotestech.com', msg=msg2,send_now=1, \
 				subject='A task has been assigned')
-			sql("update `tabTicket` set sent_reminder='1' where name='%(name)s' and allocated_to= '%(allocated_to)s'" % i)	
+			sql("update `tabTask` set sent_reminder='1' where name='%(name)s' and allocated_to= '%(allocated_to)s'" % i)	
 	
diff --git a/erpnext/projects/doctype/project_control/project_control.txt b/erpnext/projects/doctype/project_control/project_control.txt
index 9e1422d..76861cc 100644
--- a/erpnext/projects/doctype/project_control/project_control.txt
+++ b/erpnext/projects/doctype/project_control/project_control.txt
@@ -3,28 +3,28 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:15',
+		'creation': '2012-03-27 14:36:06',
 		'docstatus': 0,
-		'modified': '2010-12-23 10:43:22',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'harshada@webnotestech.com'
+		'modified': '2012-03-27 14:36:06',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'issingle': 1,
-		'module': 'Projects',
+		'module': u'Projects',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 30
 	},
 
 	# DocType, Project Control
 	{
 		'doctype': 'DocType',
-		'name': 'Project Control'
+		'name': u'Project Control'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/projects/doctype/project_milestone/project_milestone.txt b/erpnext/projects/doctype/project_milestone/project_milestone.txt
index 6d45a7c..6a7a4fb 100644
--- a/erpnext/projects/doctype/project_milestone/project_milestone.txt
+++ b/erpnext/projects/doctype/project_milestone/project_milestone.txt
@@ -3,72 +3,72 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:15',
+		'creation': '2012-03-27 14:36:06',
 		'docstatus': 0,
-		'modified': '2011-12-19 14:11:40',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:06',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Projects',
+		'module': u'Projects',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 4
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Project Milestone',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Project Milestone',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# DocType, Project Milestone
 	{
 		'doctype': 'DocType',
-		'name': 'Project Milestone'
+		'name': u'Project Milestone'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'milestone_date',
-		'fieldtype': 'Date',
-		'label': 'Milestone Date',
-		'oldfieldname': 'milestone_date',
-		'oldfieldtype': 'Date'
+		'doctype': u'DocField',
+		'fieldname': u'milestone_date',
+		'fieldtype': u'Date',
+		'label': u'Milestone Date',
+		'oldfieldname': u'milestone_date',
+		'oldfieldtype': u'Date'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'milestone',
-		'fieldtype': 'Text',
-		'label': 'Milestone',
-		'oldfieldname': 'milestone',
-		'oldfieldtype': 'Text',
-		'width': '300px'
+		'doctype': u'DocField',
+		'fieldname': u'milestone',
+		'fieldtype': u'Text',
+		'label': u'Milestone',
+		'oldfieldname': u'milestone',
+		'oldfieldtype': u'Text',
+		'width': u'300px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'status',
-		'fieldtype': 'Select',
-		'label': 'Status',
+		'doctype': u'DocField',
+		'fieldname': u'status',
+		'fieldtype': u'Select',
+		'label': u'Status',
 		'no_copy': 1,
-		'oldfieldname': 'status',
-		'oldfieldtype': 'Select',
-		'options': 'Pending\nCompleted'
+		'oldfieldname': u'status',
+		'oldfieldtype': u'Select',
+		'options': u'Pending\nCompleted'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/projects/doctype/ticket/__init__.py b/erpnext/projects/doctype/task/__init__.py
similarity index 100%
rename from erpnext/projects/doctype/ticket/__init__.py
rename to erpnext/projects/doctype/task/__init__.py
diff --git a/erpnext/projects/doctype/task/task.js b/erpnext/projects/doctype/task/task.js
new file mode 100644
index 0000000..af4864b
--- /dev/null
+++ b/erpnext/projects/doctype/task/task.js
@@ -0,0 +1,122 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+cur_frm.cscript.onload = function(doc,cdt,cdn){
+  if(!doc.senders_name) {  
+    doc.senders_name = user_fullname;
+    doc.senders_email = user;
+    refresh_many(['senders_name', 'senders_email']);
+  }
+
+  if(doc.__islocal) {
+    doc.status = 'Open';
+    doc.opening_date = get_today();
+    refresh_many(['status', 'opening_date']);
+  }
+  else{
+    if(!doc.opening_date){
+      doc.opening_date = dateutil.str_to_user(only_date(doc.creation));
+      refresh_field('opening_date');      
+    }
+  }  
+  
+  //hide unhide field depends on status
+  if(doc.status == 'Open') doc.review_date = doc.closing_date = '';
+  else if(doc.status == 'Pending Review') doc.closing_date = '';
+  refresh_many(['closing_date','review_date']); 
+
+  if(doc.project) cur_frm.cscript.project(doc, cdt, cdn);  
+}
+
+cur_frm.cscript.refresh = function(doc,cdt,cdn) {
+  cur_frm.clear_custom_buttons();
+  if(doc.status == 'Pending Review' && (doc.senders_name == user_fullname || doc.senders_email == user)) {
+    cur_frm.add_custom_button('Declare Completed', cur_frm.cscript.declare_completed);
+    cur_frm.add_custom_button('Reopen Task', cur_frm.cscript['Reopen Task']);
+  }
+  if(doc.status == 'Open' && !doc.__islocal) {
+    cur_frm.add_custom_button('Cancel Task', cur_frm.cscript['Cancel Task']);
+    if(doc.allocated_to == user) cur_frm.add_custom_button('Get Approval', cur_frm.cscript['Get Approval']);
+  }
+}
+
+cur_frm.fields_dict['project'].get_query = function(doc,cdt,cdn){
+  var cond='';
+  if(doc.customer) cond = 'ifnull(`tabProject`.customer, "") = "'+doc.customer+'" AND';
+  
+  return repl('SELECT distinct `tabProject`.`name` FROM `tabProject` WHERE %(cond)s `tabProject`.`name` LIKE "%s" ORDER BY `tabProject`.`name` ASC LIMIT 50', {cond:cond});
+}
+
+
+cur_frm.cscript.project = function(doc, cdt, cdn){
+  if(doc.project) get_server_fields('get_project_details', '','', doc, cdt, cdn, 1);
+}
+
+cur_frm.fields_dict['customer'].get_query = function(doc,cdt,cdn){
+  var cond='';
+  if(doc.project) cond = 'ifnull(`tabProject`.customer, "") = `tabCustomer`.name AND ifnull(`tabProject`.name, "") = "'+doc.project+'" AND';
+  
+  return repl('SELECT distinct `tabCustomer`.`name` FROM `tabCustomer`, `tabProject` WHERE %(cond)s `tabCustomer`.`name` LIKE "%s" ORDER BY `tabCustomer`.`name` ASC LIMIT 50', {cond:cond});
+}
+
+cur_frm.cscript.customer = function(doc, cdt, cdn){
+  if(doc.customer) get_server_fields('get_customer_details', '','', doc, cdt, cdn, 1);
+  else doc.customer_name ='';
+}
+
+cur_frm.cscript.allocated_to = function(doc,cdt,cdn){
+  get_server_fields('get_allocated_to_name','','',doc,cdt,cdn,1);
+}
+
+cur_frm.cscript['Get Approval'] = function(){
+  $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name), 'set_for_review', '',function(r, rt) {
+    if(r.message == 'true'){
+      doc.status = 'Pending Review'; //for refresh
+      refresh_many(['review_date','status']);
+      cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
+    }
+  });  
+}
+
+cur_frm.cscript['Reopen Task'] = function(){
+  $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name), 'reopen_task', '',function(r, rt) {
+    if(r.message == 'true'){
+      doc.status = 'Open'; //for refresh
+      refresh_many(['status']);
+      cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
+    }
+  });  
+}
+
+cur_frm.cscript['Cancel Task'] = function(){
+  $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name), 'cancel_task', '',function(r, rt) {
+    if(r.message == 'true'){
+      doc.status = 'Cancelled'; //for refresh
+      refresh_many(['status']);
+      cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
+    }
+  });  
+}
+
+cur_frm.cscript.declare_completed = function(){
+  $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name),'declare_completed', '',function(r, rt) {
+    if(r.message == 'true'){
+      doc.status = 'Closed'; //for refresh
+      refresh_many(['review_date', 'closing_date', 'status']);
+      cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
+    }
+  });  
+}
diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py
new file mode 100644
index 0000000..9cca9a7
--- /dev/null
+++ b/erpnext/projects/doctype/task/task.py
@@ -0,0 +1,244 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.utils.email_lib import sendmail
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+sql = webnotes.conn.sql
+set = webnotes.conn.set
+get_value = webnotes.conn.get_value
+
+# -----------------------------------------------------------------------------------------
+
+
+class DocType:
+	def __init__(self,doc,doclist=[]):
+		self.doc = doc
+		self.doclist = doclist
+	
+	def get_project_details(self):
+		cust = sql("select customer, customer_name from `tabProject` where name = %s", self.doc.project)
+		if cust:
+			ret = {'customer': cust and cust[0][0] or '', 'customer_name': cust and cust[0][1] or ''}
+			return ret
+	
+	def get_customer_details(self):
+		cust = sql("select customer_name from `tabCustomer` where name=%s", self.doc.customer)
+		if cust:
+			ret = {'customer_name': cust and cust[0][0] or ''}
+			return ret
+	
+	def get_allocated_to_name(self):
+		as_em = sql("select first_name, last_name from `tabProfile` where name=%s",str(self.doc.allocated_to))
+		ret = { 'allocated_to_name' : as_em and (cstr(as_em[0][0]) + ' ' + cstr(as_em[0][1])) or ''}
+		return ret
+
+	# validate
+	#--------------------------------------------	 
+
+
+	def validate(self):
+		if not self.doc.opening_date:
+			msgprint("Please enter Opening Date.")
+			raise Exception
+		elif getdate(self.doc.opening_date) > getdate(nowdate()):
+			msgprint("Opening date can not be future date")
+			raise Exception
+		
+		if self.doc.exp_start_date and self.doc.exp_end_date and getdate(self.doc.exp_start_date) > getdate(self.doc.exp_end_date):
+			msgprint("'Expected Start Date' can not be greater than 'Expected End Date'")
+			raise Exception
+		
+		if self.doc.act_start_date and self.doc.act_end_date and getdate(self.doc.act_start_date) > getdate(self.doc.act_end_date):
+			msgprint("'Actual Start Date' can not be greater than 'Actual End Date'")
+			raise Exception
+		
+		if self.doc.opening_date and self.doc.review_date and getdate(self.doc.opening_date) > getdate(self.doc.review_date):
+			msgprint("Review Date should be greater than or equal to Opening Date ")
+			raise Exception
+		
+		if self.doc.closing_date and self.doc.review_date and getdate(self.doc.closing_date) < getdate(self.doc.review_date):
+			msgprint("Closing Date should be greater than or equal to Review Date ")
+			raise Exception
+
+	# on update
+	#--------------------------------------------	 
+	
+	def on_update(self):
+		if self.doc.status =='Open' and self.doc.allocated_to:
+			if self.doc.task_email_notify and (self.doc.allocated_to != self.doc.allocated_to_old):
+				self.doc.sent_reminder = 0
+				self.doc.allocated_to_old = self.doc.allocated_to
+				self.sent_notification()
+			if self.doc.exp_start_date:
+				sql("delete from tabEvent where ref_type='Task' and ref_name=%s", self.doc.name)
+				self.add_calendar_event()
+			else:
+				msgprint("An Expeted start date has not been set for this task.Please set 'Expected Start date'\
+				to add an event to allocated persons calender.You can save a task without this also.")
+			
+			
+	def validate_for_pending_review(self):
+		if not self.doc.allocated_to:
+			msgprint("Please enter allocated_to.")
+			raise Exception
+		self.validate_with_timesheet_dates()
+		
+	#Sent Notification
+	def sent_notification(self):
+		i = {
+			'name' : self.doc.name,
+			'senders_name': self.doc.allocated_to,
+			'opening_date': self.doc.opening_date,
+			'exp_start_date': self.doc.exp_start_date,
+			'exp_end_date' : self.doc.exp_end_date,
+			'subject' : self.doc.subject,
+			'project': self.doc.project,
+			'review_date': self.doc.review_date,
+			'description': self.doc.description
+		}
+
+		msg2="""<h2>%(name)s</h2>
+			<p>This is a Notification for the task %(name)s that has been assigned to you 
+				by %(senders_name)s on %(opening_date)s</p>
+			<p><b>Subject:</b> %(subject)s </p>
+			<p><b>Project:</b> %(project)s</p>
+			<p><b>Review Date:</b> %(review_date)s</p>
+			<p><b>Expected Start Date:</b> %(exp_start_date)s</p>
+			<p><b>Expected End Date:</b> %(exp_end_date)s</p>
+			<p><b>Details:</b> %(description)s</p>
+			<p>You will also recieve another reminder 2 days before the commencement of the task</p>
+			<p>Good Luck!</p>
+			<p>(This notification is autogenerated)</p>""" % i
+		sendmail(self.doc.allocated_to, sender='automail@webnotestech.com', msg=msg2,send_now=1,\
+			subject='A task has been assigned')
+
+
+	
+	#validate before closing task
+	def validate_for_closed(self):
+		self.check_non_submitted_timesheets()
+		self.get_actual_total_hrs()
+	
+	def check_non_submitted_timesheets(self):
+		chk = sql("select t1.name from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent=t1.name and t2.task_id=%s and t1.status='Draft'", self.doc.name)
+		if chk:
+			chk_lst = [x[0] for x in chk]
+			msgprint("Please submit timesheet(s) : "+','.join(chk_lst)+" before declaring this task as completed. As details of this task present in timesheet(s)")
+			raise Exception
+	
+	#calculate actual total hours taken to complete task from timesheets
+	def get_actual_total_hrs(self):
+		import datetime
+		import time
+		chk = sql("select t2.act_total_hrs from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent = t1.name and t2.task_id = %s and t1.status = 'Submitted' and ifnull(t2.act_total_hrs, '')!='' order by t1.timesheet_date asc", self.doc.name)
+		if chk:
+			chk_lst = [x[0] for x in chk]
+			actual_total = total =0
+			
+			for m in chk_lst:
+				m1, m2=[], 0
+				m1 = m.split(":")
+				m2 = (datetime.timedelta(minutes=cint(m1[1]), hours=cint(m1[0]))).seconds
+				total = total + m2
+			
+			actual_total = time.strftime("%H:%M", time.gmtime(total))
+			set(self.doc, 'act_total_hrs', actual_total)
+	
+	# validate and fetch actual start and end date
+	def validate_with_timesheet_dates(self):
+		chk = sql("select t1.name, t1.timesheet_date from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent = t1.name and t2.task_id = %s and t1.status = 'Submitted' order by t1.timesheet_date asc", self.doc.name, as_dict=1)
+		if chk:
+			if self.doc.act_start_date:
+				if chk[0]['timesheet_date'] > getdate(self.doc.act_start_date) or chk[0]['timesheet_date'] < getdate(self.doc.act_start_date):
+					msgprint("Actual start date of this task is "+cstr(chk[0]['timesheet_date'])+" as per timesheet "+cstr(chk[0]['name']))
+					raise Exception
+			else:
+				self.doc.act_start_date = chk[0]['timesheet_date']
+			
+			if self.doc.act_end_date:
+				if chk[len(chk)-1]['timesheet_date'] < getdate(self.doc.act_end_date) or chk[len(chk)-1]['timesheet_date'] > getdate(self.doc.act_end_date):
+					msgprint("Actual end date of this task is "+cstr(chk[len(chk)-1]['timesheet_date'])+" as per timesheet "+cstr(chk[len(chk)-1]['name']))
+					raise Exception
+			else:
+				self.doc.act_end_date = chk[len(chk)-1]['timesheet_date']
+	
+	def set_for_review(self):
+		self.check_non_submitted_timesheets()
+		self.validate_for_pending_review()
+		self.get_actual_total_hrs()
+		self.doc.review_date = nowdate()
+		self.doc.status = 'Pending Review'
+		self.doc.save()
+		return cstr('true')
+	
+	def reopen_task(self):
+		self.doc.status = 'Open'
+		self.doc.save()
+		return cstr('true')
+	
+	def declare_completed(self):
+		if self.doc.status == 'Open':
+			self.validate_for_pending_review()
+			self.doc.review_date = nowdate()
+		else:
+			self.validate_with_timesheet_dates()
+		self.validate_for_closed()
+
+		self.doc.closing_date = nowdate()
+		self.doc.status = 'Closed'
+		self.doc.docstatus = 1
+		self.doc.save()
+
+		self.remove_event_from_calender()
+		return cstr('true')
+		
+	def remove_event_from_calender(self):
+		sql("delete from tabEvent where ref_type='Task' and ref_name=%s", self.doc.name)
+		
+	def cancel_task(self):
+		chk = sql("select distinct t1.name from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent = t1.name and t2.task_id = %s and t1.status!='Cancelled'", self.doc.name)
+		if chk:
+			chk_lst = [x[0] for x in chk]
+			msgprint("Timesheet(s) "+','.join(chk_lst)+" created against this task. Thus can not be cancelled")
+			raise Exception
+		else:
+			self.doc.status = 'Cancelled'
+			self.doc.docstatus = 2
+			self.remove_event_from_calender()
+		self.doc.save()
+		return cstr('true')
+
+	
+	def add_calendar_event(self):
+		""" Add calendar event for task in calendar of Allocated person"""
+		event = Document('Event')
+		event.owner = self.doc.allocated_to
+		event.description = self.doc.name 
+		event.event_date = self.doc.exp_start_date and self.doc.exp_start_date or ''
+		event.event_hour =  self.doc.event_hour and self.doc.event_hour or '10:00'
+		event.event_type = 'Private'
+		event.ref_type = 'Task'
+		event.ref_name = self.doc.name
+		event.save(1)
diff --git a/erpnext/projects/doctype/task/task.txt b/erpnext/projects/doctype/task/task.txt
new file mode 100644
index 0000000..8110719
--- /dev/null
+++ b/erpnext/projects/doctype/task/task.txt
@@ -0,0 +1,561 @@
+# DocType, Task
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:06',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:06',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': u'1324880734',
+		'allow_trash': 1,
+		'autoname': u'TIC/.####',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'document_type': u'Master',
+		'module': u'Projects',
+		'name': '__common__',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'subject': u'%(subject)s',
+		'tag_fields': u'status',
+		'version': 254
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Task',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Task',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1
+	},
+
+	# DocType, Task
+	{
+		'doctype': 'DocType',
+		'name': u'Task'
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'All',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'All',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Projects User',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Projects User'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'task_details',
+		'fieldtype': u'Section Break',
+		'label': u'Task Details',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0,
+		'search_index': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'subject',
+		'fieldtype': u'Data',
+		'in_filter': 1,
+		'label': u'Subject',
+		'oldfieldname': u'subject',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'status',
+		'fieldtype': u'Select',
+		'label': u'Status',
+		'no_copy': 1,
+		'oldfieldname': u'status',
+		'oldfieldtype': u'Select',
+		'options': u'Open\nPending Review\nClosed\nCancelled',
+		'permlevel': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'opening_date',
+		'fieldtype': u'Date',
+		'label': u'Creation Date',
+		'oldfieldname': u'opening_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'depends_on': u'eval:doc.status == "Closed" || doc.status == "Pending Review"',
+		'doctype': u'DocField',
+		'fieldname': u'review_date',
+		'fieldtype': u'Date',
+		'hidden': 1,
+		'label': u'Review Date',
+		'oldfieldname': u'review_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'depends_on': u'eval:doc.status == "Closed"',
+		'doctype': u'DocField',
+		'fieldname': u'closing_date',
+		'fieldtype': u'Date',
+		'hidden': 1,
+		'label': u'Closing Date',
+		'oldfieldname': u'closing_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'priority',
+		'fieldtype': u'Select',
+		'in_filter': 1,
+		'label': u'Priority',
+		'oldfieldname': u'priority',
+		'oldfieldtype': u'Select',
+		'options': u'Low\nMedium\nHigh\nUrgent',
+		'permlevel': 0,
+		'reqd': 0,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'project',
+		'fieldtype': u'Link',
+		'label': u'Project',
+		'oldfieldname': u'project',
+		'oldfieldtype': u'Link',
+		'options': u'Project',
+		'permlevel': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'customer',
+		'fieldtype': u'Link',
+		'label': u'Customer',
+		'oldfieldname': u'customer',
+		'oldfieldtype': u'Link',
+		'options': u'Customer',
+		'permlevel': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'customer_name',
+		'fieldtype': u'Data',
+		'label': u'Customer Name',
+		'oldfieldname': u'customer_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'allocated_to_old',
+		'fieldtype': u'Link',
+		'hidden': 1,
+		'label': u'Allocated To Old',
+		'no_copy': 1,
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'allocated_to',
+		'fieldtype': u'Link',
+		'label': u'Allocated To',
+		'oldfieldname': u'allocated_to',
+		'oldfieldtype': u'Link',
+		'options': u'Profile',
+		'permlevel': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'task_email_notify',
+		'fieldtype': u'Check',
+		'label': u'Sent Mail Notification',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'allocated_to_name',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Allocated To Name',
+		'oldfieldname': u'allocated_to_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'sent_reminder',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Sent Reminder',
+		'no_copy': 1,
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'senders_name',
+		'fieldtype': u'Data',
+		'in_filter': 1,
+		'label': u'Raised By',
+		'oldfieldname': u'senders_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'senders_email',
+		'fieldtype': u'Data',
+		'label': u'Email',
+		'oldfieldname': u'senders_email',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'reqd': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'senders_contact_no',
+		'fieldtype': u'Data',
+		'label': u'Senders Contact No',
+		'oldfieldname': u'senders_contact_no',
+		'oldfieldtype': u'Data',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'senders_company',
+		'fieldtype': u'Data',
+		'label': u'Senders Company',
+		'oldfieldname': u'senders_company',
+		'oldfieldtype': u'Data',
+		'permlevel': 0
+	},
+	
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'external_or_internal',
+		'fieldtype': u'Select',
+		'label': u'External or Internal',
+		'oldfieldname': u'external_or_internal',
+		'oldfieldtype': u'Select',
+		'options': u'External\nInternal',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Amended From',
+		'no_copy': 1,
+		'oldfieldname': u'amended_from',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
+		'hidden': 1,
+		'label': u'Amendment Date',
+		'no_copy': 1,
+		'oldfieldname': u'amendment_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'section_break0',
+		'fieldtype': u'Section Break',
+		'oldfieldtype': u'Section Break',
+		'options': u'Simple',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Text Editor',
+		'label': u'Details',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Text Editor',
+		'permlevel': 0,
+		'reqd': 0,
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'first_creation_flag',
+		'fieldtype': u'Int',
+		'hidden': 1,
+		'in_filter': 0,
+		'label': u'First Creation Flag',
+		'no_copy': 1,
+		'oldfieldname': u'first_creation_flag',
+		'oldfieldtype': u'Int',
+		'permlevel': 0,
+		'print_hide': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'second_creation_flag',
+		'fieldtype': u'Int',
+		'hidden': 1,
+		'label': u'Second Creation Flag',
+		'no_copy': 1,
+		'oldfieldname': u'second_creation_flag',
+		'oldfieldtype': u'Int',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'time_and_budget',
+		'fieldtype': u'Section Break',
+		'label': u'Time and Budget',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'expected',
+		'fieldtype': u'Column Break',
+		'label': u'Expected',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'exp_start_date',
+		'fieldtype': u'Date',
+		'label': u'Expected Start Date',
+		'oldfieldname': u'exp_start_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'reqd': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'exp_end_date',
+		'fieldtype': u'Date',
+		'in_filter': 1,
+		'label': u'Expected End Date',
+		'oldfieldname': u'exp_end_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'reqd': 0,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'exp_total_hrs',
+		'fieldtype': u'Data',
+		'label': u'Total Hours (Expected)',
+		'oldfieldname': u'exp_total_hrs',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'reqd': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'allocated_budget',
+		'fieldtype': u'Currency',
+		'label': u'Allocated Budget',
+		'oldfieldname': u'allocated_budget',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'actual',
+		'fieldtype': u'Column Break',
+		'label': u'Actual',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'act_start_date',
+		'fieldtype': u'Date',
+		'label': u'Actual Start Date',
+		'oldfieldname': u'act_start_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'act_end_date',
+		'fieldtype': u'Date',
+		'label': u'Actual End Date',
+		'oldfieldname': u'act_end_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'act_total_hrs',
+		'fieldtype': u'Data',
+		'label': u'Total Hours (Actual)',
+		'oldfieldname': u'act_total_hrs',
+		'oldfieldtype': u'Data',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'actual_budget',
+		'fieldtype': u'Currency',
+		'label': u'Actual Budget',
+		'oldfieldname': u'actual_budget',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0
+	}
+]
diff --git a/erpnext/projects/doctype/ticket/ticket.js b/erpnext/projects/doctype/ticket/ticket.js
deleted file mode 100644
index 322b8a1..0000000
--- a/erpnext/projects/doctype/ticket/ticket.js
+++ /dev/null
@@ -1,122 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-cur_frm.cscript.onload = function(doc,cdt,cdn){
-  if(!doc.senders_name) {  
-    doc.senders_name = user_fullname;
-    doc.senders_email = user;
-    refresh_many(['senders_name', 'senders_email']);
-  }
-
-  if(doc.__islocal) {
-    doc.status = 'Open';
-    doc.opening_date = get_today();
-    refresh_many(['status', 'opening_date']);
-  }
-  else{
-    if(!doc.opening_date){
-      doc.opening_date = dateutil.str_to_user(only_date(doc.creation));
-      refresh_field('opening_date');      
-    }
-  }  
-  
-  //hide unhide field depends on status
-  if(doc.status == 'Open') doc.review_date = doc.closing_date = '';
-  else if(doc.status == 'Pending Review') doc.closing_date = '';
-  refresh_many(['closing_date','review_date']); 
-
-  if(doc.project) cur_frm.cscript.project(doc, cdt, cdn);  
-}
-
-cur_frm.cscript.refresh = function(doc,cdt,cdn) {
-  cur_frm.clear_custom_buttons();
-  if(doc.status == 'Pending Review' && (doc.senders_name == user_fullname || doc.senders_email == user)) {
-    cur_frm.add_custom_button('Declare Completed', cur_frm.cscript['Declare Completed']);
-    cur_frm.add_custom_button('Reopen Task', cur_frm.cscript['Reopen Task']);
-  }
-  if(doc.status == 'Open' && !doc.__islocal) {
-    cur_frm.add_custom_button('Cancel Task', cur_frm.cscript['Cancel Task']);
-    if(doc.allocated_to == user) cur_frm.add_custom_button('Get Approval', cur_frm.cscript['Get Approval']);
-  }
-}
-
-cur_frm.fields_dict['project'].get_query = function(doc,cdt,cdn){
-  var cond='';
-  if(doc.customer) cond = 'ifnull(`tabProject`.customer, "") = "'+doc.customer+'" AND';
-  
-  return repl('SELECT distinct `tabProject`.`name` FROM `tabProject` WHERE %(cond)s `tabProject`.`name` LIKE "%s" ORDER BY `tabProject`.`name` ASC LIMIT 50', {cond:cond});
-}
-
-
-cur_frm.cscript.project = function(doc, cdt, cdn){
-  if(doc.project) get_server_fields('get_project_details', '','', doc, cdt, cdn, 1);
-}
-
-cur_frm.fields_dict['customer'].get_query = function(doc,cdt,cdn){
-  var cond='';
-  if(doc.project) cond = 'ifnull(`tabProject`.customer, "") = `tabCustomer`.name AND ifnull(`tabProject`.name, "") = "'+doc.project+'" AND';
-  
-  return repl('SELECT distinct `tabCustomer`.`name` FROM `tabCustomer`, `tabProject` WHERE %(cond)s `tabCustomer`.`name` LIKE "%s" ORDER BY `tabCustomer`.`name` ASC LIMIT 50', {cond:cond});
-}
-
-cur_frm.cscript.customer = function(doc, cdt, cdn){
-  if(doc.customer) get_server_fields('get_customer_details', '','', doc, cdt, cdn, 1);
-  else doc.customer_name ='';
-}
-
-cur_frm.cscript.allocated_to = function(doc,cdt,cdn){
-  get_server_fields('get_allocated_to_name','','',doc,cdt,cdn,1);
-}
-
-cur_frm.cscript['Get Approval'] = function(){
-  $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name), 'set_for_review', '',function(r, rt) {
-    if(r.message == 'true'){
-      doc.status = 'Pending Review'; //for refresh
-      refresh_many(['review_date','status']);
-      cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
-    }
-  });  
-}
-
-cur_frm.cscript['Reopen Task'] = function(){
-  $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name), 'reopen_task', '',function(r, rt) {
-    if(r.message == 'true'){
-      doc.status = 'Open'; //for refresh
-      refresh_many(['status']);
-      cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
-    }
-  });  
-}
-
-cur_frm.cscript['Cancel Task'] = function(){
-  $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name), 'cancel_task', '',function(r, rt) {
-    if(r.message == 'true'){
-      doc.status = 'Cancelled'; //for refresh
-      refresh_many(['status']);
-      cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
-    }
-  });  
-}
-
-cur_frm.cscript['Declare Completed'] = function(){
-  $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name),'declare_completed', '',function(r, rt) {
-    if(r.message == 'true'){
-      doc.status = 'Closed'; //for refresh
-      refresh_many(['review_date', 'closing_date', 'status']);
-      cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
-    }
-  });  
-}
\ No newline at end of file
diff --git a/erpnext/projects/doctype/ticket/ticket.py b/erpnext/projects/doctype/ticket/ticket.py
deleted file mode 100644
index 51a9875..0000000
--- a/erpnext/projects/doctype/ticket/ticket.py
+++ /dev/null
@@ -1,244 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.utils.email_lib import sendmail
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-sql = webnotes.conn.sql
-set = webnotes.conn.set
-get_value = webnotes.conn.get_value
-
-# -----------------------------------------------------------------------------------------
-
-
-class DocType:
-	def __init__(self,doc,doclist=[]):
-		self.doc = doc
-		self.doclist = doclist
-	
-	def get_project_details(self):
-		cust = sql("select customer, customer_name from `tabProject` where name = %s", self.doc.project)
-		if cust:
-			ret = {'customer': cust and cust[0][0] or '', 'customer_name': cust and cust[0][1] or ''}
-			return ret
-	
-	def get_customer_details(self):
-		cust = sql("select customer_name from `tabCustomer` where name=%s", self.doc.customer)
-		if cust:
-			ret = {'customer_name': cust and cust[0][0] or ''}
-			return ret
-	
-	def get_allocated_to_name(self):
-		as_em = sql("select first_name, last_name from `tabProfile` where name=%s",str(self.doc.allocated_to))
-		ret = { 'allocated_to_name' : as_em and (as_em[0][0] + ' ' + as_em[0][1]) or ''}
-		return ret
-
-	# validate
-	#--------------------------------------------	 
-
-
-	def validate(self):
-		if not self.doc.opening_date:
-			msgprint("Please enter Opening Date.")
-			raise Exception
-		elif getdate(self.doc.opening_date) > getdate(nowdate()):
-			msgprint("Opening date can not be future date")
-			raise Exception
-		
-		if self.doc.exp_start_date and self.doc.exp_end_date and getdate(self.doc.exp_start_date) > getdate(self.doc.exp_end_date):
-			msgprint("'Expected Start Date' can not be greater than 'Expected End Date'")
-			raise Exception
-		
-		if self.doc.act_start_date and self.doc.act_end_date and getdate(self.doc.act_start_date) > getdate(self.doc.act_end_date):
-			msgprint("'Actual Start Date' can not be greater than 'Actual End Date'")
-			raise Exception
-		
-		if self.doc.opening_date and self.doc.review_date and getdate(self.doc.opening_date) > getdate(self.doc.review_date):
-			msgprint("Review Date should be greater than or equal to Opening Date ")
-			raise Exception
-		
-		if self.doc.closing_date and self.doc.review_date and getdate(self.doc.closing_date) < getdate(self.doc.review_date):
-			msgprint("Closing Date should be greater than or equal to Review Date ")
-			raise Exception
-
-	# on update
-	#--------------------------------------------	 
-	
-	def on_update(self):
-		if self.doc.status =='Open' and self.doc.allocated_to:
-			if self.doc.task_email_notify and (self.doc.allocated_to != self.doc.allocated_to_old):
-				self.doc.sent_reminder = 0
-				self.doc.allocated_to_old = self.doc.allocated_to
-				self.sent_notification()
-			if self.doc.exp_start_date:
-				sql("delete from tabEvent where ref_type='Task' and ref_name=%s", self.doc.name)
-				self.add_calendar_event()
-			else:
-				msgprint("An Expeted start date has not been set for this task.Please set a, 'Expected Start date'\
-				to add an event to allocated persons calender.You can save a task without this also.")
-			
-			
-	def validate_for_pending_review(self):
-		if not self.doc.allocated_to:
-			msgprint("Please enter allocated_to.")
-			raise Exception
-		self.validate_with_timesheet_dates()
-		
-	#Sent Notification
-	def sent_notification(self):
-		i = {
-			'name' : self.doc.name,
-			'senders_name': self.doc.allocated_to,
-			'opening_date': self.doc.opening_date,
-			'exp_start_date': self.doc.exp_start_date,
-			'exp_end_date' : self.doc.exp_end_date,
-			'subject' : self.doc.subject,
-			'project': self.doc.project,
-			'review_date': self.doc.review_date,
-			'description': self.doc.description
-		}
-
-		msg2="""<h2>%(name)s</h2>
-			<p>This is a Notification for the task %(name)s that has been assigned to you 
-				by %(senders_name)s on %(opening_date)s</p>
-			<p><b>Subject:</b> %(subject)s </p>
-			<p><b>Project:</b> %(project)s</p>
-			<p><b>Review Date:</b> %(review_date)s</p>
-			<p><b>Expected Start Date:</b> %(exp_start_date)s</p>
-			<p><b>Expected End Date:</b> %(exp_end_date)s</p>
-			<p><b>Details:</b> %(description)s</p>
-			<p>You will also recieve another reminder 2 days before the commencement of the task</p>
-			<p>Good Luck!</p>
-			<p>(This notification is autogenerated)</p>""" % i
-		sendmail(self.doc.allocated_to, sender='automail@webnotestech.com', msg=msg2,send_now=1,\
-			subject='A task has been assigned')
-
-
-	
-	#validate before closing task
-	def validate_for_closed(self):
-		self.check_non_submitted_timesheets()
-		self.get_actual_total_hrs()
-	
-	def check_non_submitted_timesheets(self):
-		chk = sql("select t1.name from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent=t1.name and t2.task_id=%s and t1.status='Draft'", self.doc.name)
-		if chk:
-			chk_lst = [x[0] for x in chk]
-			msgprint("Please submit timesheet(s) : "+','.join(chk_lst)+" before declaring this task as completed. As details of this task present in timesheet(s)")
-			raise Exception
-	
-	#calculate actual total hours taken to complete task from timesheets
-	def get_actual_total_hrs(self):
-		import datetime
-		import time
-		chk = sql("select t2.act_total_hrs from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent = t1.name and t2.task_id = %s and t1.status = 'Submitted' and ifnull(t2.act_total_hrs, '')!='' order by t1.timesheet_date asc", self.doc.name)
-		if chk:
-			chk_lst = [x[0] for x in chk]
-			actual_total = total =0
-			
-			for m in chk_lst:
-				m1, m2=[], 0
-				m1 = m.split(":")
-				m2 = (datetime.timedelta(minutes=cint(m1[1]), hours=cint(m1[0]))).seconds
-				total = total + m2
-			
-			actual_total = time.strftime("%H:%M", time.gmtime(total))
-			set(self.doc, 'act_total_hrs', actual_total)
-	
-	# validate and fetch actual start and end date
-	def validate_with_timesheet_dates(self):
-		chk = sql("select t1.name, t1.timesheet_date from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent = t1.name and t2.task_id = %s and t1.status = 'Submitted' order by t1.timesheet_date asc", self.doc.name, as_dict=1)
-		if chk:
-			if self.doc.act_start_date:
-				if chk[0]['timesheet_date'] > getdate(self.doc.act_start_date) or chk[0]['timesheet_date'] < getdate(self.doc.act_start_date):
-					msgprint("Actual start date of this task is "+cstr(chk[0]['timesheet_date'])+" as per timesheet "+cstr(chk[0]['name']))
-					raise Exception
-			else:
-				self.doc.act_start_date = chk[0]['timesheet_date']
-			
-			if self.doc.act_end_date:
-				if chk[len(chk)-1]['timesheet_date'] < getdate(self.doc.act_end_date) or chk[len(chk)-1]['timesheet_date'] > getdate(self.doc.act_end_date):
-					msgprint("Actual end date of this task is "+cstr(chk[len(chk)-1]['timesheet_date'])+" as per timesheet "+cstr(chk[len(chk)-1]['name']))
-					raise Exception
-			else:
-				self.doc.act_end_date = chk[len(chk)-1]['timesheet_date']
-	
-	def set_for_review(self):
-		self.check_non_submitted_timesheets()
-		self.validate_for_pending_review()
-		self.get_actual_total_hrs()
-		self.doc.review_date = nowdate()
-		self.doc.status = 'Pending Review'
-		self.doc.save()
-		return cstr('true')
-	
-	def reopen_task(self):
-		self.doc.status = 'Open'
-		self.doc.save()
-		return cstr('true')
-	
-	def declare_completed(self):
-		if self.doc.status == 'Open':
-			self.validate_for_pending_review()
-			self.doc.review_date = nowdate()
-		else:
-			self.validate_with_timesheet_dates()
-		self.validate_for_closed()
-
-		self.doc.closing_date = nowdate()
-		self.doc.status = 'Closed'
-		self.doc.docstatus = 1
-		self.doc.save()
-
-		self.remove_event_from_calender()
-		return cstr('true')
-		
-	def remove_event_from_calender(self):
-		sql("delete from tabEvent where ref_type='Task' and ref_name=%s", self.doc.name)
-		
-	def cancel_task(self):
-		chk = sql("select distinct t1.name from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent = t1.name and t2.task_id = %s and t1.status!='Cancelled'", self.doc.name)
-		if chk:
-			chk_lst = [x[0] for x in chk]
-			msgprint("Timesheet(s) "+','.join(chk_lst)+" created against this task. Thus can not be cancelled")
-			raise Exception
-		else:
-			self.doc.status = 'Cancelled'
-			self.doc.docstatus = 2
-			self.remove_event_from_calender()
-		self.doc.save()
-		return cstr('true')
-
-	
-	def add_calendar_event(self):
-		""" Add calendar event for task in calendar of Allocated person"""
-		event = Document('Event')
-		event.owner = self.doc.allocated_to
-		event.description = self.doc.name 
-		event.event_date = self.doc.exp_start_date and self.doc.exp_start_date or ''
-		event.event_hour =  self.doc.event_hour and self.doc.event_hour or '10:00'
-		event.event_type = 'Private'
-		event.ref_type = 'Task'
-		event.ref_name = self.doc.name
-		event.save(1)
diff --git a/erpnext/projects/doctype/ticket/ticket.txt b/erpnext/projects/doctype/ticket/ticket.txt
deleted file mode 100644
index 5b8da14..0000000
--- a/erpnext/projects/doctype/ticket/ticket.txt
+++ /dev/null
@@ -1,576 +0,0 @@
-# DocType, Ticket
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-01-28 17:52:35',
-		'docstatus': 0,
-		'modified': '2011-12-26 11:56:35',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': '1324880734',
-		'allow_trash': 1,
-		'autoname': 'TIC/.####',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
-		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'Projects',
-		'name': '__common__',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'subject': '%(subject)s',
-		'tag_fields': 'status',
-		'version': 254
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Ticket',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'Ticket',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1,
-		'submit': 0
-	},
-
-	# DocType, Ticket
-	{
-		'doctype': 'DocType',
-		'name': 'Ticket'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'permlevel': 1,
-		'role': 'Projects User',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'All',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'permlevel': 1,
-		'role': 'All',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'Projects User',
-		'write': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Task Details',
-		'oldfieldtype': 'Section Break',
-		'permlevel': 0,
-		'search_index': 0,
-		'width': '50%'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'subject',
-		'fieldtype': 'Data',
-		'in_filter': 1,
-		'label': 'Subject',
-		'oldfieldname': 'subject',
-		'oldfieldtype': 'Data',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'status',
-		'fieldtype': 'Select',
-		'label': 'Status',
-		'no_copy': 1,
-		'oldfieldname': 'status',
-		'oldfieldtype': 'Select',
-		'options': 'Open\nPending Review\nClosed\nCancelled',
-		'permlevel': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'opening_date',
-		'fieldtype': 'Date',
-		'label': 'Creation Date',
-		'oldfieldname': 'opening_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:doc.status == "Closed" || doc.status == "Pending Review"',
-		'doctype': 'DocField',
-		'fieldname': 'review_date',
-		'fieldtype': 'Date',
-		'hidden': 1,
-		'label': 'Review Date',
-		'oldfieldname': 'review_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:doc.status == "Closed"',
-		'doctype': 'DocField',
-		'fieldname': 'closing_date',
-		'fieldtype': 'Date',
-		'hidden': 1,
-		'label': 'Closing Date',
-		'oldfieldname': 'closing_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'priority',
-		'fieldtype': 'Select',
-		'in_filter': 1,
-		'label': 'Priority',
-		'oldfieldname': 'priority',
-		'oldfieldtype': 'Select',
-		'options': 'Low\nMedium\nHigh\nUrgent',
-		'permlevel': 0,
-		'reqd': 0,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'project',
-		'fieldtype': 'Link',
-		'label': 'Project',
-		'oldfieldname': 'project',
-		'oldfieldtype': 'Link',
-		'options': 'Project',
-		'permlevel': 0,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'customer',
-		'fieldtype': 'Link',
-		'label': 'Customer',
-		'oldfieldname': 'customer',
-		'oldfieldtype': 'Link',
-		'options': 'Customer',
-		'permlevel': 0,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'customer_name',
-		'fieldtype': 'Data',
-		'label': 'Customer Name',
-		'oldfieldname': 'customer_name',
-		'oldfieldtype': 'Data',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
-		'permlevel': 0,
-		'width': '50%'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'allocated_to_old',
-		'fieldtype': 'Link',
-		'hidden': 1,
-		'label': 'Allocated To Old',
-		'no_copy': 1,
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'allocated_to',
-		'fieldtype': 'Link',
-		'label': 'Allocated To',
-		'oldfieldname': 'allocated_to',
-		'oldfieldtype': 'Link',
-		'options': 'Profile',
-		'permlevel': 0,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'task_email_notify',
-		'fieldtype': 'Check',
-		'label': 'Sent Mail Notification',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'allocated_to_name',
-		'fieldtype': 'Data',
-		'hidden': 1,
-		'label': 'Allocated To Name',
-		'oldfieldname': 'allocated_to_name',
-		'oldfieldtype': 'Data',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'sent_reminder',
-		'fieldtype': 'Data',
-		'hidden': 1,
-		'label': 'Sent Reminder',
-		'no_copy': 1,
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'senders_name',
-		'fieldtype': 'Data',
-		'in_filter': 1,
-		'label': 'Raised By',
-		'oldfieldname': 'senders_name',
-		'oldfieldtype': 'Data',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'senders_email',
-		'fieldtype': 'Data',
-		'label': 'Email',
-		'oldfieldname': 'senders_email',
-		'oldfieldtype': 'Data',
-		'permlevel': 0,
-		'reqd': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'senders_contact_no',
-		'fieldtype': 'Data',
-		'label': 'Senders Contact No',
-		'oldfieldname': 'senders_contact_no',
-		'oldfieldtype': 'Data',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'senders_company',
-		'fieldtype': 'Data',
-		'label': 'Senders Company',
-		'oldfieldname': 'senders_company',
-		'oldfieldtype': 'Data',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'category',
-		'fieldtype': 'Link',
-		'label': 'Category',
-		'oldfieldname': 'category',
-		'oldfieldtype': 'Link',
-		'options': 'Ticket Category',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'external_or_internal',
-		'fieldtype': 'Select',
-		'label': 'External or Internal',
-		'oldfieldname': 'external_or_internal',
-		'oldfieldtype': 'Select',
-		'options': 'External\nInternal',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'amended_from',
-		'fieldtype': 'Data',
-		'hidden': 1,
-		'label': 'Amended From',
-		'no_copy': 1,
-		'oldfieldname': 'amended_from',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'report_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'amendment_date',
-		'fieldtype': 'Date',
-		'hidden': 1,
-		'label': 'Amendment Date',
-		'no_copy': 1,
-		'oldfieldname': 'amendment_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 1,
-		'print_hide': 1,
-		'report_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'oldfieldtype': 'Section Break',
-		'options': 'Simple',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Text Editor',
-		'label': 'Details',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Text Editor',
-		'permlevel': 0,
-		'reqd': 0,
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'first_creation_flag',
-		'fieldtype': 'Int',
-		'hidden': 1,
-		'in_filter': 0,
-		'label': 'First Creation Flag',
-		'no_copy': 1,
-		'oldfieldname': 'first_creation_flag',
-		'oldfieldtype': 'Int',
-		'permlevel': 0,
-		'print_hide': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'second_creation_flag',
-		'fieldtype': 'Int',
-		'hidden': 1,
-		'label': 'Second Creation Flag',
-		'no_copy': 1,
-		'oldfieldname': 'second_creation_flag',
-		'oldfieldtype': 'Int',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Time and Budget',
-		'oldfieldtype': 'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'label': 'Expected',
-		'oldfieldtype': 'Column Break',
-		'permlevel': 0,
-		'width': '50%'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'exp_start_date',
-		'fieldtype': 'Date',
-		'label': 'Expected Start Date',
-		'oldfieldname': 'exp_start_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 0,
-		'reqd': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'exp_end_date',
-		'fieldtype': 'Date',
-		'in_filter': 1,
-		'label': 'Expected End Date',
-		'oldfieldname': 'exp_end_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 0,
-		'reqd': 0,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'exp_total_hrs',
-		'fieldtype': 'Data',
-		'label': 'Total Hours (Expected)',
-		'oldfieldname': 'exp_total_hrs',
-		'oldfieldtype': 'Data',
-		'permlevel': 0,
-		'reqd': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'allocated_budget',
-		'fieldtype': 'Currency',
-		'label': 'Allocated Budget',
-		'oldfieldname': 'allocated_budget',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'label': 'Actual',
-		'oldfieldtype': 'Column Break',
-		'permlevel': 0,
-		'width': '50%'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'act_start_date',
-		'fieldtype': 'Date',
-		'label': 'Actual Start Date',
-		'oldfieldname': 'act_start_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'act_end_date',
-		'fieldtype': 'Date',
-		'label': 'Actual End Date',
-		'oldfieldname': 'act_end_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'act_total_hrs',
-		'fieldtype': 'Data',
-		'label': 'Total Hours (Actual)',
-		'oldfieldname': 'act_total_hrs',
-		'oldfieldtype': 'Data',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'actual_budget',
-		'fieldtype': 'Currency',
-		'label': 'Actual Budget',
-		'oldfieldname': 'actual_budget',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0
-	}
-]
\ No newline at end of file
diff --git a/erpnext/projects/doctype/timesheet/timesheet.js b/erpnext/projects/doctype/timesheet/timesheet.js
index a49b5a1..81f0420 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.js
+++ b/erpnext/projects/doctype/timesheet/timesheet.js
@@ -28,9 +28,9 @@
   var cond=cond1='';
   var d = locals[cdt][cdn];
   //if(d.customer_name) cond = 'ifnull(`tabProject`.customer_name, "") = "'+d.customer_name+'" AND';
-  if(d.task_id) cond1 = 'ifnull(`tabTicket`.project, "") = `tabProject`.name AND `tabTicket`.name = "'+d.task_id+'" AND';
+  if(d.task_id) cond1 = 'ifnull(`tabTask`.project, "") = `tabProject`.name AND `tabTask`.name = "'+d.task_id+'" AND';
   
-  return repl('SELECT distinct `tabProject`.`name` FROM `tabProject`, `tabTicket` WHERE %(cond1)s `tabProject`.`name` LIKE "%s" ORDER BY `tabProject`.`name` ASC LIMIT 50', {cond1:cond1});
+  return repl('SELECT distinct `tabProject`.`name` FROM `tabProject`, `tabTask` WHERE %(cond1)s `tabProject`.`name` LIKE "%s" ORDER BY `tabProject`.`name` ASC LIMIT 50', {cond1:cond1});
 }
 
 cur_frm.cscript.task_name = function(doc, cdt, cdn){
@@ -41,7 +41,7 @@
 cur_frm.fields_dict['timesheet_details'].grid.get_field("task_name").get_query = function(doc,cdt,cdn){
   var cond='';
   var d = locals[cdt][cdn];
-  if(d.project_name) cond = 'ifnull(`tabTicket`.project, "") = "'+d.project_name+'" AND';
+  if(d.project_name) cond = 'ifnull(`tabTask`.project, "") = "'+d.project_name+'" AND';
   
-  return repl('SELECT distinct `tabTicket`.`subject` FROM `tabTicket` WHERE %(cond)s `tabTicket`.`subject` LIKE "%s" ORDER BY `tabTicket`.`subject` ASC LIMIT 50', {cond:cond});
+  return repl('SELECT distinct `tabTask`.`subject` FROM `tabTask` WHERE %(cond)s `tabTask`.`subject` LIKE "%s" ORDER BY `tabTask`.`subject` ASC LIMIT 50', {cond:cond});
 }
\ No newline at end of file
diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py
index ec58a46..cacfc74 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.py
+++ b/erpnext/projects/doctype/timesheet/timesheet.py
@@ -45,7 +45,7 @@
       return (ret)
   
   def get_task_details(self, task_sub):
-    tsk = sql("select name, project, customer, customer_name from `tabTicket` where subject = %s", task_sub)
+    tsk = sql("select name, project, customer, customer_name from `tabTask` where subject = %s", task_sub)
     if tsk:
       ret = {'task_id': tsk and tsk[0][0] or '', 'project_name': tsk and tsk[0][1] or '', 'customer_name': tsk and tsk[0][3] or ''}
       return ret
diff --git a/erpnext/projects/doctype/timesheet/timesheet.txt b/erpnext/projects/doctype/timesheet/timesheet.txt
index 839da19..1ccb781 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.txt
+++ b/erpnext/projects/doctype/timesheet/timesheet.txt
@@ -3,50 +3,52 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 10:23:29',
+		'creation': '2012-03-27 14:36:07',
 		'docstatus': 0,
-		'modified': '2011-02-23 11:22:29',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
+		'modified': '2012-03-27 18:47:10',
+		'modified_by': u'Administrator',
+		'owner': u'ashwini@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'autoname': 'TimeSheet.#####',
-		'colour': 'White:FFF',
+		'autoname': u'TimeSheet.#####',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'module': 'Projects',
+		'is_submittable': 1,
+		'module': u'Projects',
 		'name': '__common__',
-		'search_fields': 'status, owner, timesheet_date',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'subject': '%(owner)s',
-		'version': 68
+		'search_fields': u'status, owner, timesheet_date',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'subject': u'%(owner)s',
+		'version': 69
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Timesheet',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Timesheet',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Timesheet',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Timesheet',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Timesheet
 	{
 		'doctype': 'DocType',
-		'name': 'Timesheet'
+		'name': u'Timesheet'
 	},
 
 	# DocPerm
@@ -54,18 +56,18 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Projects User',
+		'role': u'Projects User',
 		'submit': 1,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Projects User'
+		'role': u'Projects User'
 	},
 
 	# DocPerm
@@ -73,44 +75,41 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'submit': 1,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'System Manager'
+		'role': u'System Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 1,
-		'label': 'Timesheet Details',
+		'doctype': u'DocField',
+		'fieldname': u'timesheet_details_section_break',
+		'fieldtype': u'Section Break',
+		'label': u'Timesheet Details',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'Draft',
-		'doctype': 'DocField',
-		'fieldname': 'status',
-		'fieldtype': 'Select',
-		'idx': 2,
+		'colour': u'White:FFF',
+		'default': u'Draft',
+		'doctype': u'DocField',
+		'fieldname': u'status',
+		'fieldtype': u'Select',
 		'in_filter': 0,
-		'label': 'Status',
-		'oldfieldname': 'status',
-		'oldfieldtype': 'Select',
-		'options': '\nDraft\nSubmitted\nCancelled',
+		'label': u'Status',
+		'oldfieldname': u'status',
+		'oldfieldtype': u'Select',
+		'options': u'\nDraft\nSubmitted\nCancelled',
 		'permlevel': 1,
 		'reqd': 1,
 		'search_index': 1
@@ -118,16 +117,15 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'Today',
-		'doctype': 'DocField',
-		'fieldname': 'timesheet_date',
-		'fieldtype': 'Date',
-		'idx': 3,
+		'colour': u'White:FFF',
+		'default': u'Today',
+		'doctype': u'DocField',
+		'fieldname': u'timesheet_date',
+		'fieldtype': u'Date',
 		'in_filter': 1,
-		'label': 'Timesheet Date',
-		'oldfieldname': 'timesheet_date',
-		'oldfieldtype': 'Date',
+		'label': u'Timesheet Date',
+		'oldfieldname': u'timesheet_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1
@@ -135,15 +133,14 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'owner',
-		'fieldtype': 'Link',
-		'idx': 4,
+		'doctype': u'DocField',
+		'fieldname': u'owner',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Timesheet By',
-		'oldfieldname': 'owner',
-		'oldfieldtype': 'Link',
-		'options': 'Profile',
+		'label': u'Timesheet By',
+		'oldfieldname': u'owner',
+		'oldfieldtype': u'Link',
+		'options': u'Profile',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 0
@@ -151,69 +148,65 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amended_from',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Data',
 		'hidden': 1,
-		'idx': 5,
-		'label': 'Amended From',
-		'oldfieldname': 'amended_from',
-		'oldfieldtype': 'Data',
+		'label': u'Amended From',
+		'oldfieldname': u'amended_from',
+		'oldfieldtype': u'Data',
 		'permlevel': 1,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amendment_date',
-		'fieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
 		'hidden': 1,
-		'idx': 6,
-		'label': 'Amendment Date',
-		'oldfieldname': 'amendment_date',
-		'oldfieldtype': 'Date',
+		'label': u'Amendment Date',
+		'oldfieldname': u'amendment_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 1,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 7,
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'notes',
-		'fieldtype': 'Text',
-		'idx': 8,
-		'label': 'Notes',
+		'doctype': u'DocField',
+		'fieldname': u'notes',
+		'fieldtype': u'Text',
+		'label': u'Notes',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 9,
-		'options': 'Simple',
+		'doctype': u'DocField',
+		'fieldname': u'section_break0',
+		'fieldtype': u'Section Break',
+		'options': u'Simple',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'timesheet_details',
-		'fieldtype': 'Table',
-		'idx': 10,
-		'label': 'Timesheet Details',
-		'oldfieldname': 'timesheet_details',
-		'oldfieldtype': 'Table',
-		'options': 'Timesheet Detail',
+		'doctype': u'DocField',
+		'fieldname': u'timesheet_details',
+		'fieldtype': u'Table',
+		'label': u'Timesheet Details',
+		'oldfieldname': u'timesheet_details',
+		'oldfieldtype': u'Table',
+		'options': u'Timesheet Detail',
 		'permlevel': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/projects/doctype/timesheet_detail/timesheet_detail.txt b/erpnext/projects/doctype/timesheet_detail/timesheet_detail.txt
index 0098228..dc4f105 100644
--- a/erpnext/projects/doctype/timesheet_detail/timesheet_detail.txt
+++ b/erpnext/projects/doctype/timesheet_detail/timesheet_detail.txt
@@ -3,167 +3,158 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-02-23 11:22:29',
+		'creation': '2012-03-27 14:36:07',
 		'docstatus': 0,
-		'modified': '2011-02-23 11:22:28',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:07',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'autoname': 'TSD.#####',
-		'colour': 'White:FFF',
+		'autoname': u'TSD.#####',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'module': 'Projects',
+		'module': u'Projects',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 15
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Timesheet Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Timesheet Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# DocType, Timesheet Detail
 	{
 		'doctype': 'DocType',
-		'name': 'Timesheet Detail'
+		'name': u'Timesheet Detail'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'act_start_time',
-		'fieldtype': 'Time',
-		'idx': 1,
-		'label': 'Actual Start Time',
-		'oldfieldname': 'act_start_time',
-		'oldfieldtype': 'Time',
+		'doctype': u'DocField',
+		'fieldname': u'act_start_time',
+		'fieldtype': u'Time',
+		'label': u'Actual Start Time',
+		'oldfieldname': u'act_start_time',
+		'oldfieldtype': u'Time',
 		'permlevel': 0,
 		'reqd': 1,
-		'width': '160px'
+		'width': u'160px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'act_end_time',
-		'fieldtype': 'Time',
-		'idx': 2,
-		'label': 'Actual End Time',
-		'oldfieldname': 'act_end_time',
-		'oldfieldtype': 'Time',
+		'doctype': u'DocField',
+		'fieldname': u'act_end_time',
+		'fieldtype': u'Time',
+		'label': u'Actual End Time',
+		'oldfieldname': u'act_end_time',
+		'oldfieldtype': u'Time',
 		'permlevel': 0,
 		'reqd': 1,
-		'width': '160px'
+		'width': u'160px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'activity_type',
-		'fieldtype': 'Link',
-		'idx': 3,
-		'label': 'Activity Type',
-		'options': 'Activity Type',
+		'doctype': u'DocField',
+		'fieldname': u'activity_type',
+		'fieldtype': u'Link',
+		'label': u'Activity Type',
+		'options': u'Activity Type',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 0,
-		'width': '200px'
+		'width': u'200px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'other_details',
-		'fieldtype': 'Text',
-		'idx': 4,
-		'label': 'Additional Info',
-		'oldfieldname': 'other_details',
-		'oldfieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'other_details',
+		'fieldtype': u'Text',
+		'label': u'Additional Info',
+		'oldfieldname': u'other_details',
+		'oldfieldtype': u'Text',
 		'permlevel': 0,
-		'width': '200px'
+		'width': u'200px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'act_total_hrs',
-		'fieldtype': 'Data',
-		'idx': 5,
-		'label': 'Total Hours (Actual)',
-		'oldfieldname': 'act_total_hrs',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'act_total_hrs',
+		'fieldtype': u'Data',
+		'label': u'Total Hours (Actual)',
+		'oldfieldname': u'act_total_hrs',
+		'oldfieldtype': u'Data',
 		'permlevel': 1,
-		'width': '100px'
+		'width': u'100px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'customer_name',
-		'fieldtype': 'Link',
-		'idx': 6,
-		'label': 'Customer Name',
-		'oldfieldname': 'customer_name',
-		'oldfieldtype': 'Data',
-		'options': 'Customer',
+		'doctype': u'DocField',
+		'fieldname': u'customer_name',
+		'fieldtype': u'Link',
+		'label': u'Customer Name',
+		'oldfieldname': u'customer_name',
+		'oldfieldtype': u'Data',
+		'options': u'Customer',
 		'permlevel': 0,
-		'width': '150px'
+		'width': u'150px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'project_name',
-		'fieldtype': 'Link',
-		'idx': 7,
+		'doctype': u'DocField',
+		'fieldname': u'project_name',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Project',
-		'oldfieldname': 'project_name',
-		'oldfieldtype': 'Link',
-		'options': 'Project',
+		'label': u'Project',
+		'oldfieldname': u'project_name',
+		'oldfieldtype': u'Link',
+		'options': u'Project',
 		'permlevel': 0,
 		'reqd': 0,
 		'search_index': 1,
-		'width': '150px'
+		'width': u'150px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'task_id',
-		'fieldtype': 'Link',
-		'idx': 8,
+		'doctype': u'DocField',
+		'fieldname': u'task_id',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Task Id',
-		'oldfieldname': 'task_id',
-		'oldfieldtype': 'Link',
-		'options': 'Ticket',
+		'label': u'Task Id',
+		'oldfieldname': u'task_id',
+		'oldfieldtype': u'Link',
+		'options': u'Task',
 		'permlevel': 0,
 		'search_index': 1,
-		'width': '150px'
+		'width': u'150px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'task_name',
-		'fieldtype': 'Link',
-		'idx': 9,
-		'label': 'Task Name',
-		'oldfieldname': 'task_name',
-		'oldfieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'task_name',
+		'fieldtype': u'Link',
+		'label': u'Task Name',
+		'oldfieldname': u'task_name',
+		'oldfieldtype': u'Link',
 		'permlevel': 0,
 		'reqd': 0,
 		'search_index': 0,
-		'width': '250px'
+		'width': u'250px'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/projects/page/projects/projects.js b/erpnext/projects/page/projects/projects.js
index 1ffbe5a..59b039a 100644
--- a/erpnext/projects/page/projects/projects.js
+++ b/erpnext/projects/page/projects/projects.js
@@ -217,7 +217,7 @@
 
 	// label
 	this.label = $a(grid.y_labels, 'div', '', {'top':(idx*40) + 'px', overflow:'hidden', position:'absolute', 'width':'100%', height: '40px'});
-	var l1 = $a($a(this.label, 'div'), 'span', 'link_type'); l1.innerHTML = data[0]; l1.dn = data[7]; l1.onclick = function() { loaddoc('Ticket', this.dn) };
+	var l1 = $a($a(this.label, 'div'), 'span', 'link_type'); l1.innerHTML = data[0]; l1.dn = data[7]; l1.onclick = function() { loaddoc('Task', this.dn) };
 	var l2 = $a(this.label, 'div', '', {fontSize:'10px'}); l2.innerHTML = data[1];
 
 	// bar
diff --git a/erpnext/projects/page/projects_home/projects_home.html b/erpnext/projects/page/projects_home/projects_home.html
index 37da61f..e86aa03 100644
--- a/erpnext/projects/page/projects_home/projects_home.html
+++ b/erpnext/projects/page/projects_home/projects_home.html
@@ -1,14 +1,16 @@
 <div class="layout-wrapper layout-wrapper-background">
+	<div class="appframe-area"></div>
 	<div class="layout-main-section">
-		<a class="close" onclick="window.history.back();">&times;</a>
 		<h1>Projects</h1>
 		<hr>
 		<div style="width: 48%; float: left;">
 			<h4><a href="#!List/Project">Project</a></h4>
 			<p class="help">Project master</p>
+			<br>
 			<h4><a href="#!List/Task">Task</a></h4>
 			<p class="help">Project activity / task</p>
-			<h4><a href="#!List/Task">Timesheet</a></h4>
+			<br>
+			<h4><a href="#!List/Timesheet">Timesheet</a></h4>
 			<p class="help">Timesheet for tasks</p>
 		</div>
 		<div style="width: 48%; float: right;">
@@ -35,4 +37,4 @@
 		</div>
 	</div>
 	<div style="clear: both;"></div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/projects/page/projects_home/projects_home.js b/erpnext/projects/page/projects_home/projects_home.js
index 73d6e33..187fc57 100644
--- a/erpnext/projects/page/projects_home/projects_home.js
+++ b/erpnext/projects/page/projects_home/projects_home.js
@@ -15,5 +15,6 @@
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 pscript['onload_projects-home'] = function(wrapper) {
+	wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
 	erpnext.module_page.setup_page('Projects', wrapper);
 }
\ No newline at end of file
diff --git a/erpnext/projects/search_criteria/dispatch_report/__init__.py b/erpnext/projects/search_criteria/dispatch_report/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/projects/search_criteria/dispatch_report/__init__.py
+++ /dev/null
diff --git a/erpnext/projects/search_criteria/dispatch_report/dispatch_report.js b/erpnext/projects/search_criteria/dispatch_report/dispatch_report.js
deleted file mode 100644
index a31d6e4..0000000
--- a/erpnext/projects/search_criteria/dispatch_report/dispatch_report.js
+++ /dev/null
@@ -1,21 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-  this.mytabs.items['Select Columns'].hide()
-  //this.mytabs.items['More Filters'].hide()
-  //this.hide_all_filters();
-}
\ No newline at end of file
diff --git a/erpnext/projects/search_criteria/dispatch_report/dispatch_report.txt b/erpnext/projects/search_criteria/dispatch_report/dispatch_report.txt
deleted file mode 100644
index fbd19fb..0000000
--- a/erpnext/projects/search_criteria/dispatch_report/dispatch_report.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Search Criteria, dispatch_report
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-12-14 10:23:31',
-		'docstatus': 0,
-		'modified': '2010-11-05 20:34:19',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'Delivery Note\x01ID,Delivery Note\x01Project Name,Delivery Note\x01Customer,Delivery Note\x01Customer Name,Delivery Note\x01Posting Date,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Item Name,Delivery Note Detail\x01Quantity,Delivery Note Detail\x01Amount*',
-		'criteria_name': 'Dispatch Report',
-		'doc_type': 'Delivery Note Detail',
-		'doctype': 'Search Criteria',
-		'filters': "{'Delivery Note\x01Saved':1,'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'Submitted','Delivery Note\x01Fiscal Year':''}",
-		'module': 'Projects',
-		'name': '__common__',
-		'page_len': 50,
-		'parent_doc_type': 'Delivery Note',
-		'sort_by': '`tabDelivery Note`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, dispatch_report
-	{
-		'doctype': 'Search Criteria',
-		'name': 'dispatch_report'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.js b/erpnext/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.js
index 77ce624..c8b42dc 100644
--- a/erpnext/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.js
+++ b/erpnext/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.js
@@ -17,7 +17,7 @@
 report.customize_filters = function() {
   this.hide_all_filters();
 
-  //this.add_filter({fieldname:'item_code', label:'Item Code', fieldtype:'Link', options:'Item',ignore : 1,parent:'Delivery Note Detail'});
+  //this.add_filter({fieldname:'item_code', label:'Item Code', fieldtype:'Link', options:'Item',ignore : 1,parent:'Delivery Note Item'});
 
   this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
   this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Company'].df.filter_hide = 0;
diff --git a/erpnext/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.txt b/erpnext/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.txt
index a084040..e4143ba 100644
--- a/erpnext/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.txt
+++ b/erpnext/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.txt
@@ -3,33 +3,33 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-09-01 15:48:09',
+		'creation': '2012-04-03 12:49:52',
 		'docstatus': 0,
-		'modified': '2010-08-30 11:54:36',
-		'modified_by': 'Administrator',
-		'owner': 'harshada@webnotestech.com'
+		'modified': '2012-04-03 12:49:52',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_cond': 'IFNULL(`tabDelivery Note`.`project_name`,"")!=""',
-		'columns': 'Delivery Note\x01ID,Delivery Note\x01Project Name,Delivery Note\x01Customer,Delivery Note\x01Customer Name,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Item Name,Delivery Note Detail\x01Quantity,Delivery Note\x01Posting Date,Delivery Note\x01% Billed,Delivery Note Detail\x01Amount*',
-		'criteria_name': 'Projectwise Delivered Qty and Costs',
-		'doc_type': 'Delivery Note Detail',
+		'add_cond': u'IFNULL(`tabDelivery Note`.`project_name`,"")!=""',
+		'columns': u'Delivery Note\x01ID,Delivery Note\x01Project Name,Delivery Note\x01Customer,Delivery Note\x01Customer Name,Delivery Note Item\x01Item Code,Delivery Note Item\x01Item Name,Delivery Note Item\x01Quantity,Delivery Note\x01Posting Date,Delivery Note\x01% Billed,Delivery Note Item\x01Amount*',
+		'criteria_name': u'Projectwise Delivered Qty and Costs',
+		'doc_type': u'Delivery Note Item',
 		'doctype': 'Search Criteria',
-		'filters': "{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'Submitted','Delivery Note\x01Fiscal Year':''}",
-		'module': 'Projects',
+		'filters': u"{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'Submitted','Delivery Note\x01Fiscal Year':''}",
+		'module': u'Projects',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Delivery Note',
-		'sort_by': '`tabDelivery Note`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Delivery Note',
+		'sort_by': u'`tabDelivery Note`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, projectwise_delivered_qty_and_costs
 	{
 		'doctype': 'Search Criteria',
-		'name': 'projectwise_delivered_qty_and_costs'
+		'name': u'projectwise_delivered_qty_and_costs'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.js b/erpnext/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.js
index e04a7c6..ce56077 100644
--- a/erpnext/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.js
+++ b/erpnext/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.js
@@ -17,7 +17,7 @@
 report.customize_filters = function() {
   this.hide_all_filters();
 
-  //this.add_filter({fieldname:'item_code', label:'Item Code', fieldtype:'Link', options:'Item',ignore : 1,parent:'Sales Order Detail'});
+  //this.add_filter({fieldname:'item_code', label:'Item Code', fieldtype:'Link', options:'Item',ignore : 1,parent:'Sales Order Item'});
 
   this.filter_fields_dict['Sales Order'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
   this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df.filter_hide = 0;
diff --git a/erpnext/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.txt b/erpnext/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.txt
index 1c6821b..e795202 100644
--- a/erpnext/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.txt
+++ b/erpnext/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.txt
@@ -3,34 +3,34 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-09-01 15:48:09',
+		'creation': '2012-04-03 12:49:52',
 		'docstatus': 0,
-		'modified': '2010-08-30 14:21:20',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
+		'modified': '2012-04-03 12:49:52',
+		'modified_by': u'Administrator',
+		'owner': u'ashwini@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_col': "SUM(`tabSales Order Detail`.`qty` - `tabSales Order Detail`.`delivered_qty`) AS 'Pending Qty'\nSUM((`tabSales Order Detail`.`qty` - `tabSales Order Detail`.`delivered_qty`)* `tabSales Order Detail`.basic_rate) AS 'Pending Amount'",
-		'add_cond': '`tabSales Order Detail`.`qty` > `tabSales Order Detail`.`delivered_qty`\nIFNULL(`tabSales Order`.`project_name`,"")!=""\n`tabSales Order`.order_type = \'Sales\'',
-		'columns': 'Sales Order\x01ID,Sales Order\x01Project Name,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order Detail\x01Item Code,Sales Order Detail\x01Item Name,Sales Order\x01%  Delivered,Sales Order\x01% Billed,Sales Order\x01Sales Order Date,Sales Order\x01Expected Delivery Date',
-		'criteria_name': 'Projectwise Pending Qty and Costs',
-		'doc_type': 'Sales Order Detail',
+		'add_col': u"SUM(`tabSales Order Item`.`qty` - `tabSales Order Item`.`delivered_qty`) AS 'Pending Qty'\nSUM((`tabSales Order Item`.`qty` - `tabSales Order Item`.`delivered_qty`)* `tabSales Order Item`.basic_rate) AS 'Pending Amount'",
+		'add_cond': u'`tabSales Order Item`.`qty` > `tabSales Order Item`.`delivered_qty`\nIFNULL(`tabSales Order`.`project_name`,"")!=""\n`tabSales Order`.order_type = \'Sales\'',
+		'columns': u'Sales Order\x01ID,Sales Order\x01Project Name,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order Item\x01Item Code,Sales Order Item\x01Item Name,Sales Order\x01%  Delivered,Sales Order\x01% Billed,Sales Order\x01Sales Order Date,Sales Order\x01Expected Delivery Date',
+		'criteria_name': u'Projectwise Pending Qty and Costs',
+		'doc_type': u'Sales Order Item',
 		'doctype': 'Search Criteria',
-		'filters': "{'Sales Order\x01Submitted':1,'Sales Order\x01Status':'Submitted','Sales Order\x01Fiscal Year':''}",
-		'module': 'Projects',
+		'filters': u"{'Sales Order\x01Submitted':1,'Sales Order\x01Status':'Submitted','Sales Order\x01Fiscal Year':''}",
+		'module': u'Projects',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Sales Order',
-		'sort_by': '`tabSales Order`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Sales Order',
+		'sort_by': u'`tabSales Order`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, projectwise_pending_qty_and_costs
 	{
 		'doctype': 'Search Criteria',
-		'name': 'projectwise_pending_qty_and_costs'
+		'name': u'projectwise_pending_qty_and_costs'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.js b/erpnext/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.js
index 0401c28..bd4be54 100644
--- a/erpnext/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.js
+++ b/erpnext/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.js
@@ -88,7 +88,7 @@
     if(fy !='') cond += ' t1.fiscal_year = "'+fy+'" AND '; 
  
   
-    var q = 'SELECT DISTINCT t1.name, t1.status, t1.project_name, t1.supplier, t1.supplier_name,t1.grand_total FROM `tabPurchase Receipt` t1,  `tabPurchase Receipt Detail` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
+    var q = 'SELECT DISTINCT t1.name, t1.status, t1.project_name, t1.supplier, t1.supplier_name,t1.grand_total FROM `tabPurchase Receipt` t1,  `tabPurchase Receipt Item` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
   
     return q;  
   }
@@ -101,7 +101,7 @@
     if(company) cond += ' t1.company = "'+company+'" AND ';
     if(fy !='') cond += ' t1.fiscal_year = "'+fy+'" AND ';     
     
-    var q = 'SELECT DISTINCT t1.name , t1.credit_to , t1.project_name, t1.supplier, t1.supplier_name , t1.grand_total FROM `tabPayable Voucher` t1,  `tabPV Detail` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
+    var q = 'SELECT DISTINCT t1.name , t1.credit_to , t1.project_name, t1.supplier, t1.supplier_name , t1.grand_total FROM `tabPurchase Invoice` t1,  `tabPurchase Invoice Item` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
   
     return q;  
   }  
diff --git a/erpnext/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.py b/erpnext/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.py
index 2147699..4dab05c 100644
--- a/erpnext/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.py
+++ b/erpnext/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.py
@@ -22,7 +22,7 @@
   col = [['Purchase Order ID','Link','Purchase Order'],['Status','Data',''],['Project Name','Link','Project'],['Supplier','Link','Supplier'],['Supplier Name','Data',''],['% Received','Data',''],['% Billed','Data',''],['Grand Total','Currency','']] 
 
 elif based_on == 'Purchase Invoice':
-  col = [['Purchase Receipt ID','Link','Payable Voucher'],['Status','Data',''],['Project Name','Link','Project'],['Supplier','Link','Supplier'],['Supplier Name','Data',''],['Grand Total','Currency','']]
+  col = [['Purchase Receipt ID','Link','Purchase Invoice'],['Status','Data',''],['Project Name','Link','Project'],['Supplier','Link','Supplier'],['Supplier Name','Data',''],['Grand Total','Currency','']]
 
 elif based_on == 'Purchase Receipt':
   col = [['Purchase Invoice ID','Link','Purchase Receipt'],['Credit To','Data',''],['Project Name','Link','Project'],['Supplier','Link','Supplier'],['Supplier Name','Data',''],['Grand Total','Currency','']]
diff --git a/erpnext/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.txt b/erpnext/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.txt
index 286ec98..4a11bac 100644
--- a/erpnext/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.txt
+++ b/erpnext/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.txt
@@ -3,29 +3,29 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 10:23:31',
+		'creation': '2012-04-03 12:49:52',
 		'docstatus': 0,
-		'modified': '2010-11-12 09:23:17',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
+		'modified': '2012-04-03 12:49:52',
+		'modified_by': u'Administrator',
+		'owner': u'ashwini@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'criteria_name': 'Projectwise Purchase Details',
-		'doc_type': 'Purchase Order',
+		'criteria_name': u'Projectwise Purchase Details',
+		'doc_type': u'Purchase Order',
 		'doctype': 'Search Criteria',
-		'filters': "{'Purchase Order\x01Status':'','Purchase Order\x01Fiscal Year':''}",
-		'module': 'Projects',
+		'filters': u"{'Purchase Order\x01Status':'','Purchase Order\x01Fiscal Year':''}",
+		'module': u'Projects',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, projectwise_purchase_details
 	{
 		'doctype': 'Search Criteria',
-		'name': 'projectwise_purchase_details'
+		'name': u'projectwise_purchase_details'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.js b/erpnext/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.js
index 83951b5..4e92c3c 100644
--- a/erpnext/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.js
+++ b/erpnext/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.js
@@ -89,7 +89,7 @@
     if(company) cond += ' t1.company = "'+company+'" AND ';
     if(fy) cond += ' t1.fiscal_year = "'+fy+'" AND '; 
     
-    var q = 'SELECT DISTINCT t1.name, t1.status, t1.project_name, t1.customer, t1.customer_name, t1.per_billed, t1.per_installed, t1.grand_total FROM `tabDelivery Note` t1, `tabDelivery Note Detail` t2  WHERE '+cond+' IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2';
+    var q = 'SELECT DISTINCT t1.name, t1.status, t1.project_name, t1.customer, t1.customer_name, t1.per_billed, t1.per_installed, t1.grand_total FROM `tabDelivery Note` t1, `tabDelivery Note Item` t2  WHERE '+cond+' IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2';
 
     return q;
   }
@@ -104,7 +104,7 @@
     if(fy) cond += ' t1.fiscal_year = "'+fy+'" AND '; 
 
        
-    var q = 'SELECT DISTINCT t1.name , t1.debit_to , t1.project_name , t1.customer , t1.customer_name , t1.grand_total  FROM `tabReceivable Voucher` t1,  `tabRV Detail` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
+    var q = 'SELECT DISTINCT t1.name , t1.debit_to , t1.project_name , t1.customer , t1.customer_name , t1.grand_total  FROM `tabSales Invoice` t1,  `tabSales Invoice Item` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
 
     return q;  
   }
diff --git a/erpnext/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.py b/erpnext/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.py
index 15a20a7..065a03d 100644
--- a/erpnext/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.py
+++ b/erpnext/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.py
@@ -25,7 +25,7 @@
   cols = [['Delivery Note No','Link','150px','Delivery Note'], ['Status','Data','100px',''], ['Project Name','Link','200px','Project'], ['Customer','Link','150px','Customer'], ['Customer Name','Data','200px',''], ['% Installed','Currency','100px',''], ['% Billed','Currency','100px',''], ['Grand Total','Currency','150px','']]
 
 elif based_on == 'Sales Invoice':
-  cols = [['Sales Invoice No','Link','150px','Receivable Voucher'], ['Debit To','Data','150px',''], ['Project Name','Link','200px','Project'], ['Customer','Link','150px','Customer'], ['Customer Name','Data','200px',''], ['Grand Total','Currency','150px','']]
+  cols = [['Sales Invoice No','Link','150px','Sales Invoice'], ['Debit To','Data','150px',''], ['Project Name','Link','200px','Project'], ['Customer','Link','150px','Customer'], ['Customer Name','Data','200px',''], ['Grand Total','Currency','150px','']]
 
 
 for c in cols:
diff --git a/erpnext/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.txt b/erpnext/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.txt
index bb51f25..0ecb1be 100644
--- a/erpnext/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.txt
+++ b/erpnext/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.txt
@@ -3,29 +3,29 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 10:23:31',
+		'creation': '2012-04-03 12:49:52',
 		'docstatus': 0,
-		'modified': '2010-11-12 09:21:11',
-		'modified_by': 'Administrator',
-		'owner': 'harshada@webnotestech.com'
+		'modified': '2012-04-03 12:49:52',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'criteria_name': 'Projectwise Sales Details',
-		'doc_type': 'Sales Order',
+		'criteria_name': u'Projectwise Sales Details',
+		'doc_type': u'Sales Order',
 		'doctype': 'Search Criteria',
-		'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':''}",
-		'module': 'Projects',
+		'filters': u"{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':''}",
+		'module': u'Projects',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, projectwise_sales_details
 	{
 		'doctype': 'Search Criteria',
-		'name': 'projectwise_sales_details'
+		'name': u'projectwise_sales_details'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/projects/search_criteria/projectwise_sales_orders/projectwise_sales_orders.txt b/erpnext/projects/search_criteria/projectwise_sales_orders/projectwise_sales_orders.txt
index 9d172b6..c36a326 100644
--- a/erpnext/projects/search_criteria/projectwise_sales_orders/projectwise_sales_orders.txt
+++ b/erpnext/projects/search_criteria/projectwise_sales_orders/projectwise_sales_orders.txt
@@ -3,32 +3,32 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-09-01 15:48:09',
+		'creation': '2012-04-03 12:49:52',
 		'docstatus': 0,
-		'modified': '2010-08-30 14:21:59',
-		'modified_by': 'Administrator',
-		'owner': 'harshada@webnotestech.com'
+		'modified': '2012-04-03 12:49:52',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_cond': "ifnull(`tabSales Order`.project_name ,'') != ''",
-		'columns': 'Sales Order\x01ID,Sales Order\x01Status,Sales Order\x01Project Name,Sales Order\x01Customer,Sales Order\x01Sales Order Date,Sales Order\x01Expected Delivery Date,Sales Order\x01Quotation No,Sales Order\x01%  Delivered,Sales Order\x01% Billed,Sales Order\x01Grand Total*',
-		'criteria_name': 'Projectwise Sales Orders',
-		'doc_type': 'Sales Order',
+		'add_cond': u"ifnull(`tabSales Order`.project_name ,'') != ''",
+		'columns': u'Sales Order\x01ID,Sales Order\x01Status,Sales Order\x01Project Name,Sales Order\x01Customer,Sales Order\x01Sales Order Date,Sales Order\x01Expected Delivery Date,Sales Order\x01Quotation No,Sales Order\x01%  Delivered,Sales Order\x01% Billed,Sales Order\x01Grand Total*',
+		'criteria_name': u'Projectwise Sales Orders',
+		'doc_type': u'Sales Order',
 		'doctype': 'Search Criteria',
-		'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
-		'module': 'Projects',
+		'filters': u"{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
+		'module': u'Projects',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabSales Order`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabSales Order`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, projectwise_sales_orders
 	{
 		'doctype': 'Search Criteria',
-		'name': 'projectwise_sales_orders'
+		'name': u'projectwise_sales_orders'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/projects/search_criteria/timesheet_report/timesheet_report.txt b/erpnext/projects/search_criteria/timesheet_report/timesheet_report.txt
index 77f9d33..64586eb 100644
--- a/erpnext/projects/search_criteria/timesheet_report/timesheet_report.txt
+++ b/erpnext/projects/search_criteria/timesheet_report/timesheet_report.txt
@@ -3,32 +3,32 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 10:23:31',
+		'creation': '2012-04-03 12:49:53',
 		'docstatus': 0,
-		'modified': '2010-11-05 20:44:03',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
+		'modified': '2012-04-03 12:49:53',
+		'modified_by': u'Administrator',
+		'owner': u'ashwini@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Timesheet\x01ID,Timesheet\x01Timesheet Date,Timesheet\x01Timesheet by,Timesheet Detail\x01Project Name,Timesheet Detail\x01Task Id,Timesheet Detail\x01Task Name,Timesheet Detail\x01Actual Start Time,Timesheet Detail\x01Actual End Time,Timesheet Detail\x01Total Hours (Actual)',
-		'criteria_name': 'Timesheet Report',
-		'doc_type': 'Timesheet Detail',
+		'columns': u'Timesheet\x01ID,Timesheet\x01Timesheet Date,Timesheet\x01Timesheet by,Timesheet Detail\x01Project Name,Timesheet Detail\x01Task Id,Timesheet Detail\x01Task Name,Timesheet Detail\x01Actual Start Time,Timesheet Detail\x01Actual End Time,Timesheet Detail\x01Total Hours (Actual)',
+		'criteria_name': u'Timesheet Report',
+		'doc_type': u'Timesheet Detail',
 		'doctype': 'Search Criteria',
-		'filters': "{'Timesheet\x01Saved':1,'Timesheet\x01Submitted':1}",
-		'module': 'Projects',
+		'filters': u"{'Timesheet\x01Saved':1,'Timesheet\x01Submitted':1}",
+		'module': u'Projects',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Timesheet',
-		'sort_by': '`tabTimesheet`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Timesheet',
+		'sort_by': u'`tabTimesheet`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, timesheet_report
 	{
 		'doctype': 'Search Criteria',
-		'name': 'timesheet_report'
+		'name': u'timesheet_report'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/sandbox/testdata/masters.py b/erpnext/sandbox/testdata/masters.py
index 368e6e4..61fa2cb 100644
--- a/erpnext/sandbox/testdata/masters.py
+++ b/erpnext/sandbox/testdata/masters.py
@@ -237,7 +237,7 @@
 		),
 		Document(
 			fielddata = {
-				'doctype': 'Ref Rate Detail',
+				'doctype': 'Item Price',
 				'parentfield': 'ref_rate_details',
 				'parenttype': 'Item',
 				'parent' : 'it',
diff --git a/erpnext/selling/DocType Mapper/Delivery Note-Installation Note/Delivery Note-Installation Note.txt b/erpnext/selling/DocType Mapper/Delivery Note-Installation Note/Delivery Note-Installation Note.txt
index da8762d..b597f92 100644
--- a/erpnext/selling/DocType Mapper/Delivery Note-Installation Note/Delivery Note-Installation Note.txt
+++ b/erpnext/selling/DocType Mapper/Delivery Note-Installation Note/Delivery Note-Installation Note.txt
@@ -123,10 +123,10 @@
 	{
 		'doctype': 'Table Mapper Detail',
 		'from_field': 'delivery_note_details',
-		'from_table': 'Delivery Note Detail',
+		'from_table': 'Delivery Note Item',
 		'match_id': 1,
 		'to_field': 'installed_item_details',
-		'to_table': 'Installed Item Details',
+		'to_table': 'Installation Note Item',
 		'validation_logic': 'qty > ifnull(installed_qty,0) and docstatus = 1'
 	},
 
@@ -147,7 +147,7 @@
 		'reference_doctype_key': 'prevdoc_doctype',
 		'reference_key': 'prevdoc_docname',
 		'to_field': 'installed_item_details',
-		'to_table': 'Installed Item Details',
+		'to_table': 'Installation Note Item',
 		'validation_logic': 'docstatus = 1'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/DocType Mapper/Enquiry-Quotation/Enquiry-Quotation.txt b/erpnext/selling/DocType Mapper/Enquiry-Quotation/Enquiry-Quotation.txt
deleted file mode 100644
index de6f60d..0000000
--- a/erpnext/selling/DocType Mapper/Enquiry-Quotation/Enquiry-Quotation.txt
+++ /dev/null
@@ -1,146 +0,0 @@
-# DocType Mapper, Enquiry-Quotation
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:34',
-		'docstatus': 0,
-		'modified': '2011-09-14 12:36:24',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'name': '__common__',
-		'parent': 'Enquiry-Quotation',
-		'parentfield': 'table_mapper_details',
-		'parenttype': 'DocType Mapper',
-		'validation_logic': 'docstatus=1'
-	},
-
-	# These values are common for all Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'name': '__common__',
-		'parent': 'Enquiry-Quotation',
-		'parentfield': 'field_mapper_details',
-		'parenttype': 'DocType Mapper'
-	},
-
-	# These values are common for all DocType Mapper
-	{
-		'doctype': u'DocType Mapper',
-		'from_doctype': 'Enquiry',
-		'module': 'Selling',
-		'name': '__common__',
-		'ref_doc_submitted': 1,
-		'to_doctype': 'Quotation'
-	},
-
-	# DocType Mapper, Enquiry-Quotation
-	{
-		'doctype': u'DocType Mapper',
-		'name': 'Enquiry-Quotation'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'uom',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'stock_uom'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'name',
-		'map': 'Yes',
-		'match_id': 0,
-		'to_field': 'enq_no'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'parent',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'prevdoc_docname'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'parenttype',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'prevdoc_doctype'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'enquiry_from',
-		'map': 'Yes',
-		'match_id': 0,
-		'to_field': 'quotation_to'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'enquiry_type',
-		'map': 'Yes',
-		'match_id': 0,
-		'to_field': 'order_type'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'transaction_date',
-		'map': 'No',
-		'match_id': 0,
-		'to_field': 'transaction_date'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'status',
-		'map': 'No',
-		'match_id': 0,
-		'to_field': 'status'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'naming_series',
-		'map': 'No',
-		'match_id': 0,
-		'to_field': 'naming_series'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_table': 'Enquiry',
-		'match_id': 0,
-		'to_table': 'Quotation'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_field': 'enq_details',
-		'from_table': 'Enquiry Detail',
-		'match_id': 1,
-		'to_field': 'quotation_details',
-		'to_table': 'Quotation Detail'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/DocType Mapper/Lead-Enquiry/Lead-Enquiry.txt b/erpnext/selling/DocType Mapper/Lead-Enquiry/Lead-Enquiry.txt
deleted file mode 100644
index 5dc1c8f..0000000
--- a/erpnext/selling/DocType Mapper/Lead-Enquiry/Lead-Enquiry.txt
+++ /dev/null
@@ -1,87 +0,0 @@
-# DocType Mapper, Lead-Enquiry
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:34',
-		'docstatus': 0,
-		'modified': '2011-09-14 12:36:24',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_table': 'Lead',
-		'match_id': 0,
-		'name': '__common__',
-		'parent': 'Lead-Enquiry',
-		'parentfield': 'table_mapper_details',
-		'parenttype': 'DocType Mapper',
-		'to_table': 'Enquiry',
-		'validation_logic': 'name is not null'
-	},
-
-	# These values are common for all Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'match_id': 0,
-		'name': '__common__',
-		'parent': 'Lead-Enquiry',
-		'parentfield': 'field_mapper_details',
-		'parenttype': 'DocType Mapper'
-	},
-
-	# These values are common for all DocType Mapper
-	{
-		'doctype': u'DocType Mapper',
-		'from_doctype': 'Lead',
-		'module': 'Selling',
-		'name': '__common__',
-		'to_doctype': 'Enquiry'
-	},
-
-	# DocType Mapper, Lead-Enquiry
-	{
-		'doctype': u'DocType Mapper',
-		'name': 'Lead-Enquiry'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'campaign_name',
-		'map': 'Yes',
-		'to_field': 'campaign'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'doctype',
-		'map': 'Yes',
-		'to_field': 'enquiry_from'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'name',
-		'map': 'Yes',
-		'to_field': 'lead'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'status',
-		'map': 'No',
-		'to_field': 'status'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/DocType Mapper/Lead-Opportunity/Lead-Opportunity.txt b/erpnext/selling/DocType Mapper/Lead-Opportunity/Lead-Opportunity.txt
new file mode 100644
index 0000000..ff4a925
--- /dev/null
+++ b/erpnext/selling/DocType Mapper/Lead-Opportunity/Lead-Opportunity.txt
@@ -0,0 +1,87 @@
+# DocType Mapper, Lead-Opportunity
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'modified': '2012-04-03 12:49:50',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_table': u'Lead',
+		'match_id': 0,
+		'name': '__common__',
+		'parent': u'Lead-Opportunity',
+		'parentfield': u'table_mapper_details',
+		'parenttype': u'DocType Mapper',
+		'to_table': u'Opportunity',
+		'validation_logic': u'name is not null'
+	},
+
+	# These values are common for all Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'match_id': 0,
+		'name': '__common__',
+		'parent': u'Lead-Opportunity',
+		'parentfield': u'field_mapper_details',
+		'parenttype': u'DocType Mapper'
+	},
+
+	# These values are common for all DocType Mapper
+	{
+		'doctype': u'DocType Mapper',
+		'from_doctype': u'Lead',
+		'module': u'Selling',
+		'name': '__common__',
+		'to_doctype': u'Opportunity'
+	},
+
+	# DocType Mapper, Lead-Opportunity
+	{
+		'doctype': u'DocType Mapper',
+		'name': u'Lead-Opportunity'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'campaign_name',
+		'map': u'Yes',
+		'to_field': u'campaign'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'doctype',
+		'map': u'Yes',
+		'to_field': u'enquiry_from'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'name',
+		'map': u'Yes',
+		'to_field': u'lead'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'status',
+		'map': u'No',
+		'to_field': u'status'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/selling/DocType Mapper/Opportunity-Quotation/Opportunity-Quotation.txt b/erpnext/selling/DocType Mapper/Opportunity-Quotation/Opportunity-Quotation.txt
new file mode 100644
index 0000000..18543e8
--- /dev/null
+++ b/erpnext/selling/DocType Mapper/Opportunity-Quotation/Opportunity-Quotation.txt
@@ -0,0 +1,146 @@
+# DocType Mapper, Opportunity-Quotation
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2010-08-08 17:09:34',
+		'docstatus': 0,
+		'modified': '2012-04-03 12:49:50',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'name': '__common__',
+		'parent': u'Opportunity-Quotation',
+		'parentfield': u'table_mapper_details',
+		'parenttype': u'DocType Mapper',
+		'validation_logic': u'docstatus=1'
+	},
+
+	# These values are common for all Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'name': '__common__',
+		'parent': u'Opportunity-Quotation',
+		'parentfield': u'field_mapper_details',
+		'parenttype': u'DocType Mapper'
+	},
+
+	# These values are common for all DocType Mapper
+	{
+		'doctype': u'DocType Mapper',
+		'from_doctype': u'Opportunity',
+		'module': u'Selling',
+		'name': '__common__',
+		'ref_doc_submitted': 1,
+		'to_doctype': u'Quotation'
+	},
+
+	# DocType Mapper, Opportunity-Quotation
+	{
+		'doctype': u'DocType Mapper',
+		'name': u'Opportunity-Quotation'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'uom',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'stock_uom'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'name',
+		'map': u'Yes',
+		'match_id': 0,
+		'to_field': u'enq_no'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'parent',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'prevdoc_docname'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'parenttype',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'prevdoc_doctype'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'enquiry_from',
+		'map': u'Yes',
+		'match_id': 0,
+		'to_field': u'quotation_to'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'enquiry_type',
+		'map': u'Yes',
+		'match_id': 0,
+		'to_field': u'order_type'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'transaction_date',
+		'map': u'No',
+		'match_id': 0,
+		'to_field': u'transaction_date'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'status',
+		'map': u'No',
+		'match_id': 0,
+		'to_field': u'status'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'naming_series',
+		'map': u'No',
+		'match_id': 0,
+		'to_field': u'naming_series'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_table': u'Opportunity',
+		'match_id': 0,
+		'to_table': u'Quotation'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'enq_details',
+		'from_table': u'Opportunity Item',
+		'match_id': 1,
+		'to_field': u'quotation_details',
+		'to_table': u'Quotation Item'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/selling/DocType Mapper/Quotation-Sales Order/Quotation-Sales Order.txt b/erpnext/selling/DocType Mapper/Quotation-Sales Order/Quotation-Sales Order.txt
index feadb98..77e6cac 100644
--- a/erpnext/selling/DocType Mapper/Quotation-Sales Order/Quotation-Sales Order.txt
+++ b/erpnext/selling/DocType Mapper/Quotation-Sales Order/Quotation-Sales Order.txt
@@ -134,10 +134,10 @@
 	{
 		'doctype': 'Table Mapper Detail',
 		'from_field': 'other_charges',
-		'from_table': 'RV Tax Detail',
+		'from_table': 'Sales Taxes and Charges',
 		'match_id': 2,
 		'to_field': 'other_charges',
-		'to_table': 'RV Tax Detail',
+		'to_table': 'Sales Taxes and Charges',
 		'validation_logic': 'name is not null'
 	},
 
@@ -145,11 +145,11 @@
 	{
 		'doctype': 'Table Mapper Detail',
 		'from_field': 'quotation_details',
-		'from_table': 'Quotation Detail',
+		'from_table': 'Quotation Item',
 		'match_id': 1,
 		'reference_doctype_key': 'prevdoc_doctype',
 		'to_field': 'sales_order_details',
-		'to_table': 'Sales Order Detail',
+		'to_table': 'Sales Order Item',
 		'validation_logic': 'name is not null'
 	},
 
diff --git a/erpnext/selling/Module Def/Selling/Selling.txt b/erpnext/selling/Module Def/Selling/Selling.txt
deleted file mode 100644
index 42c8449..0000000
--- a/erpnext/selling/Module Def/Selling/Selling.txt
+++ /dev/null
@@ -1,335 +0,0 @@
-# Module Def, Selling
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-07-01 17:39:08',
-		'docstatus': 0,
-		'modified': '2012-01-23 18:25:58',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'name': '__common__',
-		'parent': 'Selling',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def'
-	},
-
-	# These values are common for all Module Def Item
-	{
-		'doctype': 'Module Def Item',
-		'name': '__common__',
-		'parent': 'Selling',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-
-	# These values are common for all Module Def
-	{
-		'disabled': 'No',
-		'doctype': u'Module Def',
-		'doctype_list': 'Print Format, Sales Order\nPrint Format, Quotation Format\nPrint Format, Delivery Note Format',
-		'file_list': 'crm.gif,FileData/00208',
-		'is_hidden': 'No',
-		'module_desc': 'Manage you sales team, with your leads, customers, quotes, orders etc.',
-		'module_icon': 'Selling.gif',
-		'module_label': 'Selling',
-		'module_name': 'Selling',
-		'module_seq': 3,
-		'name': '__common__'
-	},
-
-	# Module Def, Selling
-	{
-		'doctype': u'Module Def',
-		'name': 'Selling'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Database of potential customers you need to keep in touch with',
-		'display_name': 'Lead',
-		'doc_name': 'Lead',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'status\nlead_owner\nlead_name\ncontact_no\ncontact_by\ncontact_date\nexpected_month'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Your Customer Database',
-		'display_name': 'Customer',
-		'doc_name': 'Customer',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'customer_group\ncountry'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Specific requirements from a Lead / Customer',
-		'display_name': 'Enquiry',
-		'doc_name': 'Enquiry',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'status\ntransaction_date\ncustomer\ncontact_person\ncost_center\ncompany'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Offers you have made to your customers',
-		'display_name': 'Quotation',
-		'doc_name': 'Quotation',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'status\ntransaction_date\ncustomer\ncontact_person\ncost_center\ngrand_total\ncompany'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Database of confirmed Sale Orders from your Customers',
-		'display_name': 'Sales Order',
-		'doc_name': 'Sales Order',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'status\ntransaction_date\ncustomer\ncost_center\ngrand_total\nper_delivered\nper_billed\ncompany'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Sales Dashboard',
-		'doc_name': 'Sales Dashboard',
-		'doc_type': 'Pages',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'doc_name': 'Reports',
-		'doc_type': 'Separator',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'doc_name': 'Reports',
-		'doc_type': 'Separator',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Gross Profit',
-		'doc_name': 'Delivery Note Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Territory, Item Group wise GP',
-		'doc_name': 'Delivery Note',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Itemwise Sales Details',
-		'doc_name': 'Sales Order Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Itemwise Delivery Details',
-		'doc_name': 'Delivery Note Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Sales Personwise Transaction Summary',
-		'doc_name': 'Sales Person',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Total Target Variance Report',
-		'doc_name': 'Target Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Sales Persons Target Variance (Item Group wise)',
-		'doc_name': 'Target Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Territories Target Variance (Item Group wise)',
-		'doc_name': 'Target Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Sales Order Pending Items',
-		'doc_name': 'Sales Order Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Sales Orderwise Booking & Delivery Summary',
-		'doc_name': 'Sales Order Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Sales Orderwise Pending Qty To Deliver',
-		'doc_name': 'Sales Order Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Sales Orderwise Pending Amount To Bill',
-		'doc_name': 'Sales Order Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Delivered Items to be Install',
-		'doc_name': 'Delivery Note Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Itemwise Price List',
-		'doc_name': 'Ref Rate Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Follow-up Report',
-		'doc_name': 'Follow up',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Ledger details of your debtors',
-		'display_name': "Debtor's Ledger",
-		'doc_name': 'GL Entry',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Report displaying Customer, Primary Address Details & Primary Contact Details',
-		'display_name': 'Customer Address Contact',
-		'doc_name': 'Customer',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Customer Category',
-		'display_name': 'Customer Group',
-		'doc_name': 'Customer Group',
-		'doc_type': 'Setup Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'id\ndescription'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Sales person details',
-		'display_name': 'Sales Person',
-		'doc_name': 'Sales Person',
-		'doc_type': 'Setup Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'id\nterritory\ndepartment\nmobile_no\nemail_id'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Item master',
-		'display_name': 'Item',
-		'doc_name': 'Item',
-		'doc_type': 'Setup Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'name\nitem_group\ndescription'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Sales partner details',
-		'display_name': 'Sales Partner',
-		'doc_name': 'Sales Partner',
-		'doc_type': 'Setup Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'id\npartner_type\nmobile\nemail\nterritory'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Business campaigns',
-		'display_name': 'Campaign',
-		'doc_name': 'Campaign',
-		'doc_type': 'Setup Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'id\ncampaign_name\ndescription'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Administrator'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Sales Manager'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Sales User'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Sales Master Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/Print Format/Quotation Classic/Quotation Classic.txt b/erpnext/selling/Print Format/Quotation Classic/Quotation Classic.txt
index 48620bc..a912888 100644
--- a/erpnext/selling/Print Format/Quotation Classic/Quotation Classic.txt
+++ b/erpnext/selling/Print Format/Quotation Classic/Quotation Classic.txt
@@ -14,7 +14,7 @@
 	{
 		'doc_type': 'Quotation',
 		'doctype': 'Print Format',
-		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Georgia", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Georgia", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Quotation\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'quotation_details\',\n\t\t\t\t\'Quotation Detail\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'export_rate\', \'export_amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'10%\', \'15%\', \'32%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'RV Tax Detail\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td>\n\t\t\t\t\t<script>\'<h1>\' + (doc.select_print_heading || \'Quotation\') + \'</h1>\'</script>\n\t\t\t</td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer?doc.customer:doc.lead_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Quotation Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total/doc.conversion_rate)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
+		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Georgia", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Georgia", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Quotation\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'quotation_details\',\n\t\t\t\t\'Quotation Item\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'export_rate\', \'export_amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'10%\', \'15%\', \'32%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'Sales Taxes and Charges\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td>\n\t\t\t\t\t<script>\'<h1>\' + (doc.select_print_heading || \'Quotation\') + \'</h1>\'</script>\n\t\t\t</td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer?doc.customer:doc.lead_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Quotation Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total/doc.conversion_rate)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
 		'module': 'Selling',
 		'name': '__common__',
 		'standard': 'Yes'
diff --git a/erpnext/selling/Print Format/Quotation Modern/Quotation Modern.txt b/erpnext/selling/Print Format/Quotation Modern/Quotation Modern.txt
index be9aa37..3bdc693 100644
--- a/erpnext/selling/Print Format/Quotation Modern/Quotation Modern.txt
+++ b/erpnext/selling/Print Format/Quotation Modern/Quotation Modern.txt
@@ -14,7 +14,7 @@
 	{
 		'doc_type': 'Quotation',
 		'doctype': 'Print Format',
-		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Helvetica", "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Helvetica", "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Quotation\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'quotation_details\',\n\t\t\t\t\'Quotation Detail\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'export_rate\', \'export_amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'10%\', \'15%\', \'32%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'RV Tax Detail\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>\'<h1>\' + (doc.select_print_heading || \'Quotation\') + \'</h1>\'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style="height:15px"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer?doc.customer:doc.lead_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class=\'imp-details\'>\n\t\t\t\t\t\t<td><b>Quotation No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Quotation Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total/doc.conversion_rate)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\' class=\'imp-details\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>\n',
+		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Helvetica", "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Helvetica", "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Quotation\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'quotation_details\',\n\t\t\t\t\'Quotation Item\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'export_rate\', \'export_amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'10%\', \'15%\', \'32%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'Sales Taxes and Charges\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>\'<h1>\' + (doc.select_print_heading || \'Quotation\') + \'</h1>\'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style="height:15px"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer?doc.customer:doc.lead_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class=\'imp-details\'>\n\t\t\t\t\t\t<td><b>Quotation No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Quotation Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total/doc.conversion_rate)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\' class=\'imp-details\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>\n',
 		'module': 'Selling',
 		'name': '__common__',
 		'standard': 'Yes'
diff --git a/erpnext/selling/Print Format/Quotation Spartan/Quotation Spartan.txt b/erpnext/selling/Print Format/Quotation Spartan/Quotation Spartan.txt
index 3700c7d..1571b41 100644
--- a/erpnext/selling/Print Format/Quotation Spartan/Quotation Spartan.txt
+++ b/erpnext/selling/Print Format/Quotation Spartan/Quotation Spartan.txt
@@ -14,7 +14,7 @@
 	{
 		'doc_type': 'Quotation',
 		'doctype': 'Print Format',
-		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Quotation\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'quotation_details\',\n\t\t\t\t\'Quotation Detail\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'export_rate\', \'export_amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'10%\', \'15%\', \'32%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'RV Tax Detail\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>\'<h1>\' + (doc.select_print_heading || \'Quotation\') + \'</h1>\'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer?doc.customer:doc.lead_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Quotation Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total/doc.conversion_rate)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
+		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Quotation\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'quotation_details\',\n\t\t\t\t\'Quotation Item\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'export_rate\', \'export_amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'10%\', \'15%\', \'32%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'Sales Taxes and Charges\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>\'<h1>\' + (doc.select_print_heading || \'Quotation\') + \'</h1>\'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer?doc.customer:doc.lead_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Quotation Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total/doc.conversion_rate)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
 		'module': 'Selling',
 		'name': '__common__',
 		'standard': 'Yes'
diff --git a/erpnext/selling/Print Format/Sales Order Classic/Sales Order Classic.txt b/erpnext/selling/Print Format/Sales Order Classic/Sales Order Classic.txt
index f955bf8..79afbce 100644
--- a/erpnext/selling/Print Format/Sales Order Classic/Sales Order Classic.txt
+++ b/erpnext/selling/Print Format/Sales Order Classic/Sales Order Classic.txt
@@ -14,7 +14,7 @@
 	{
 		'doc_type': 'Sales Order',
 		'doctype': 'Print Format',
-		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Georgia", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Georgia", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Sales Order\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'sales_order_details\',\n\t\t\t\t\'Sales Order Detail\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'basic_rate\', \'amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'20%\', \'37%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'RV Tax Detail\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>\'<h1>\' + (doc.select_print_heading || \'Sales Order\') + \'</h1>\'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Sales Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Delivery Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.delivery_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
+		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Georgia", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Georgia", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Sales Order\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'sales_order_details\',\n\t\t\t\t\'Sales Order Item\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'basic_rate\', \'amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'20%\', \'37%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'Sales Taxes and Charges\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>\'<h1>\' + (doc.select_print_heading || \'Sales Order\') + \'</h1>\'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Sales Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Delivery Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.delivery_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
 		'module': 'Selling',
 		'name': '__common__',
 		'standard': 'Yes'
diff --git a/erpnext/selling/Print Format/Sales Order Modern/Sales Order Modern.txt b/erpnext/selling/Print Format/Sales Order Modern/Sales Order Modern.txt
index 234256f..639ed63 100644
--- a/erpnext/selling/Print Format/Sales Order Modern/Sales Order Modern.txt
+++ b/erpnext/selling/Print Format/Sales Order Modern/Sales Order Modern.txt
@@ -14,7 +14,7 @@
 	{
 		'doc_type': 'Sales Order',
 		'doctype': 'Print Format',
-		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Helvetica", "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Helvetica", "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Sales Order\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'sales_order_details\',\n\t\t\t\t\'Sales Order Detail\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'basic_rate\', \'amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'20%\', \'37%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'RV Tax Detail\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>\'<h1>\' + (doc.select_print_heading || \'Sales Order\') + \'</h1>\'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style="height:15px"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class=\'imp-details\'>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Sales Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Delivery Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.delivery_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\' class=\'imp-details\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>\n',
+		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Helvetica", "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Helvetica", "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Sales Order\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'sales_order_details\',\n\t\t\t\t\'Sales Order Item\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'basic_rate\', \'amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'20%\', \'37%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'Sales Taxes and Charges\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>\'<h1>\' + (doc.select_print_heading || \'Sales Order\') + \'</h1>\'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style="height:15px"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class=\'imp-details\'>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Sales Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Delivery Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.delivery_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\' class=\'imp-details\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>\n',
 		'module': 'Selling',
 		'name': '__common__',
 		'standard': 'Yes'
diff --git a/erpnext/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt b/erpnext/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt
index 5fc3c45..dd603b3 100644
--- a/erpnext/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt
+++ b/erpnext/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt
@@ -14,7 +14,7 @@
 	{
 		'doc_type': 'Sales Order',
 		'doctype': 'Print Format',
-		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Sales Order\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'sales_order_details\',\n\t\t\t\t\'Sales Order Detail\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'basic_rate\', \'amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'20%\', \'37%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'RV Tax Detail\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>\'<h1>\' + (doc.select_print_heading || \'Sales Order\') + \'</h1>\'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Sales Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Delivery Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.delivery_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
+		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Sales Order\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'sales_order_details\',\n\t\t\t\t\'Sales Order Item\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'basic_rate\', \'amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'20%\', \'37%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tif(data_row.adj_rate) {\n\t\t\t\t\t\t\tvar to_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'Sales Taxes and Charges\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>\'<h1>\' + (doc.select_print_heading || \'Sales Order\') + \'</h1>\'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Sales Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Delivery Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.delivery_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
 		'module': 'Selling',
 		'name': '__common__',
 		'standard': 'Yes'
diff --git a/erpnext/selling/Role/Customer/Customer.txt b/erpnext/selling/Role/Customer/Customer.txt
deleted file mode 100644
index 3f7e9d2..0000000
--- a/erpnext/selling/Role/Customer/Customer.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Customer
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2009-06-26 14:42:33',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Selling',
-		'name': '__common__',
-		'role_name': 'Customer'
-	},
-
-	# Role, Customer
-	{
-		'doctype': 'Role',
-		'name': 'Customer'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/Role/Partner/Partner.txt b/erpnext/selling/Role/Partner/Partner.txt
deleted file mode 100644
index 339929c..0000000
--- a/erpnext/selling/Role/Partner/Partner.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Partner
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2009-07-13 11:29:39',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Selling',
-		'name': '__common__',
-		'role_name': 'Partner'
-	},
-
-	# Role, Partner
-	{
-		'doctype': 'Role',
-		'name': 'Partner'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/Role/Sales Manager/Sales Manager.txt b/erpnext/selling/Role/Sales Manager/Sales Manager.txt
deleted file mode 100644
index 5d975fc..0000000
--- a/erpnext/selling/Role/Sales Manager/Sales Manager.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Sales Manager
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2010-04-08 12:07:36',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Selling',
-		'name': '__common__',
-		'role_name': 'Sales Manager'
-	},
-
-	# Role, Sales Manager
-	{
-		'doctype': 'Role',
-		'name': 'Sales Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/Role/Sales Master Manager/Sales Master Manager.txt b/erpnext/selling/Role/Sales Master Manager/Sales Master Manager.txt
deleted file mode 100644
index 1140f99..0000000
--- a/erpnext/selling/Role/Sales Master Manager/Sales Master Manager.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Sales Master Manager
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2010-04-08 13:50:11',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Selling',
-		'name': '__common__',
-		'role_name': 'Sales Master Manager'
-	},
-
-	# Role, Sales Master Manager
-	{
-		'doctype': 'Role',
-		'name': 'Sales Master Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/Role/Sales User/Sales User.txt b/erpnext/selling/Role/Sales User/Sales User.txt
deleted file mode 100644
index 97229b8..0000000
--- a/erpnext/selling/Role/Sales User/Sales User.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Sales User
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2010-04-08 12:07:44',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Selling',
-		'name': '__common__',
-		'role_name': 'Sales User'
-	},
-
-	# Role, Sales User
-	{
-		'doctype': 'Role',
-		'name': 'Sales User'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/__init__.py b/erpnext/selling/__init__.py
index e69de29..f8a457a 100644
--- a/erpnext/selling/__init__.py
+++ b/erpnext/selling/__init__.py
@@ -0,0 +1,7 @@
+install_docs = [
+	{"doctype":"Role", "role_name":"Customer", "name":"Customer"},
+	{"doctype":"Role", "role_name":"Partner", "name":"Partner"},
+	{"doctype":"Role", "role_name":"Sales Manager", "name":"Sales Manager"},
+	{"doctype":"Role", "role_name":"Sales Master Manager", "name":"Sales Master Manager"},
+	{"doctype":"Role", "role_name":"Sales User", "name":"Sales User"},
+]
diff --git a/erpnext/selling/doctype/campaign/campaign.txt b/erpnext/selling/doctype/campaign/campaign.txt
index 8810cb8..0912fe7 100644
--- a/erpnext/selling/doctype/campaign/campaign.txt
+++ b/erpnext/selling/doctype/campaign/campaign.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:54',
+		'creation': '2012-03-27 14:36:07',
 		'docstatus': 0,
-		'modified': '2012-02-20 18:06:32',
+		'modified': '2012-03-27 14:36:07',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -36,12 +36,84 @@
 		'parenttype': u'DocType'
 	},
 
+	# These values are common for all DocPerm
+	{
+		'amend': 0,
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Campaign',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1,
+		'submit': 0
+	},
+
 	# DocType, Campaign
 	{
 		'doctype': 'DocType',
 		'name': u'Campaign'
 	},
 
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales Master Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales Master Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales User',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales User',
+		'write': 0
+	},
+
 	# DocField
 	{
 		'doctype': u'DocField',
@@ -56,6 +128,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'campaign',
 		'fieldtype': u'Section Break',
 		'label': u'Campaign',
 		'oldfieldtype': u'Section Break',
diff --git a/erpnext/selling/doctype/enquiry/__init__.py b/erpnext/selling/doctype/communication_log/__init__.py
similarity index 100%
copy from erpnext/selling/doctype/enquiry/__init__.py
copy to erpnext/selling/doctype/communication_log/__init__.py
diff --git a/erpnext/selling/doctype/communication_log/communication_log.txt b/erpnext/selling/doctype/communication_log/communication_log.txt
new file mode 100644
index 0000000..f5ea6be
--- /dev/null
+++ b/erpnext/selling/doctype/communication_log/communication_log.txt
@@ -0,0 +1,90 @@
+# DocType, Communication Log
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:09',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:09',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Selling',
+		'name': '__common__',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 10
+	},
+
+	# These values are common for all DocField
+	{
+		'allow_on_submit': 1,
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Communication Log',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# DocType, Communication Log
+	{
+		'doctype': 'DocType',
+		'name': u'Communication Log'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'date',
+		'fieldtype': u'Date',
+		'in_filter': 1,
+		'label': u'Date',
+		'oldfieldname': u'date',
+		'oldfieldtype': u'Date'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'notes',
+		'fieldtype': u'Small Text',
+		'in_filter': 0,
+		'label': u'Notes',
+		'oldfieldname': u'notes',
+		'oldfieldtype': u'Small Text',
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'follow_up_type',
+		'fieldtype': u'Select',
+		'in_filter': 1,
+		'label': u'Communication type',
+		'oldfieldname': u'follow_up_type',
+		'oldfieldtype': u'Select',
+		'options': u'\nPhone\nEmail\nSMS\nVisit\nOther'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'follow_up_by',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Communication by',
+		'oldfieldname': u'follow_up_by',
+		'oldfieldtype': u'Link',
+		'options': u'Sales Person'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js
index 89b95fa..78743e7 100644
--- a/erpnext/selling/doctype/customer/customer.js
+++ b/erpnext/selling/doctype/customer/customer.js
@@ -14,7 +14,7 @@
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-$import(Contact Control)
+wn.require('erpnext/setup/doctype/contact_control/contact_control.js');
 
 /* ********************************* onload ********************************************* */
 
@@ -53,11 +53,11 @@
 		unhide_field('naming_series');
 
 	if(doc.__islocal){		
-		hide_field(['Address HTML','Contact HTML']);
+		hide_field(['address_html','contact_html']);
 		//cur_frm.cscript.set_hl_msg(doc);
  		//cur_frm.cscript.set_sl_msg(doc);
 	}else{
-		unhide_field(['Address HTML','Contact HTML']);
+		unhide_field(['address_html','contact_html']);
 		// make lists
 		cur_frm.cscript.make_address(doc,dt,dn);
 		cur_frm.cscript.make_contact(doc,dt,dn);
@@ -68,19 +68,10 @@
 
 cur_frm.cscript.make_address = function() {
 	if(!cur_frm.address_list) {
-		cur_frm.address_list = new wn.widgets.Listing({
-			parent: cur_frm.fields_dict['Address HTML'].wrapper,
+		cur_frm.address_list = new wn.ui.Listing({
+			parent: cur_frm.fields_dict['address_html'].wrapper,
 			page_length: 2,
 			new_doctype: "Address",
-			new_doc_onload: function(dn) {
-				ndoc = locals["Address"][dn];
-				ndoc.customer = cur_frm.doc.name;
-				ndoc.customer_name = cur_frm.doc.customer_name;
-				ndoc.address_type = 'Office';				
-			},
-			new_doc_onsave: function(dn) {				
-				cur_frm.address_list.run()				
-			},
 			get_query: function() {
 				return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
 			},
@@ -110,21 +101,10 @@
 
 cur_frm.cscript.make_contact = function() {
 	if(!cur_frm.contact_list) {
-		cur_frm.contact_list = new wn.widgets.Listing({
-			parent: cur_frm.fields_dict['Contact HTML'].wrapper,
+		cur_frm.contact_list = new wn.ui.Listing({
+			parent: cur_frm.fields_dict['contact_html'].wrapper,
 			page_length: 2,
 			new_doctype: "Contact",
-			new_doc_onload: function(dn) {
-				ndoc = locals["Contact"][dn];
-				ndoc.customer = cur_frm.doc.name;
-				ndoc.customer_name = cur_frm.doc.customer_name;
-				if(cur_frm.doc.customer_type == 'Individual') {
-					ndoc.first_name = cur_frm.doc.customer_name;
-				}
-			},
-			new_doc_onsave: function(dn) {				
-				cur_frm.contact_list.run()
-			},
 			get_query: function() {
 				return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
 			},
@@ -174,6 +154,7 @@
 // make quotation list
 // --------------------
 cur_frm.cscript.make_qtn_list = function(parent,doc){
+	wn.require('lib/js/legacy/widgets/listing.js');
 
 	var lst = new Listing();
 	lst.colwidths = ['5%','20%','20%','20%','20%','15%'];
@@ -191,6 +172,8 @@
 // make so list
 // -------------
 cur_frm.cscript.make_so_list = function(parent,doc){
+	wn.require('lib/js/legacy/widgets/listing.js');
+
 	var lst = new Listing();
 	lst.colwidths = ['5%','20%','20%','30%','25%'];
 	lst.colnames = ['Sr.','Id','Status','Sales Order Date','Grand Total'];
@@ -207,6 +190,8 @@
 // make dn list
 // -------------
 cur_frm.cscript.make_dn_list = function(parent,doc){
+	wn.require('lib/js/legacy/widgets/listing.js');
+
 	var lst = new Listing();
 	lst.colwidths = ['5%','20%','20%','20%','20%','15%'];
 	lst.colnames = ['Sr.','Id','Status','Delivery Note Date','Territory','Grand Total'];
@@ -223,15 +208,17 @@
 // make si list
 // -------------
 cur_frm.cscript.make_si_list = function(parent,doc){
+	wn.require('lib/js/legacy/widgets/listing.js');
+	
 	var lst = new Listing();
 	lst.colwidths = ['5%','20%','20%','20%','20%','15%'];
 	lst.colnames = ['Sr.','Id','Posting Date','Due Date','Debit To','Grand Total'];
 	lst.coltypes = ['Data','Link','Data','Data','Link','Currency'];
-	lst.coloptions = ['','Receivable Voucher','','','Account',''];
+	lst.coloptions = ['','Sales Invoice','','','Account',''];
 
 
-	var q = repl("select name,posting_date,due_date,debit_to,grand_total from `tabReceivable Voucher` where customer='%(cust)s' order by posting_date desc", {'cust':doc.name});
-	var q_max = repl("select count(name) from `tabReceivable Voucher` where customer='%(cust)s'", {'cust':doc.name});
+	var q = repl("select name,posting_date,due_date,debit_to,grand_total from `tabSales Invoice` where customer='%(cust)s' order by posting_date desc", {'cust':doc.name});
+	var q_max = repl("select count(name) from `tabSales Invoice` where customer='%(cust)s'", {'cust':doc.name});
 	
-	cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Sales Invoice','Receivable Voucher');
+	cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Sales Invoice','Sales Invoice');
 }
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index 4530cf5..80ac914 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -253,19 +253,19 @@
 			('Contact', 'customer'),
 			('Customer Issue', 'customer'),
 			('Delivery Note', 'customer'),
-			('Enquiry', 'customer'),
+			('Opportunity', 'customer'),
 			('Installation Note', 'customer'),
 			('Maintenance Schedule', 'customer'),
 			('Maintenance Visit', 'customer'),
 			('Project', 'customer'),
 			('Quotation', 'customer'),
-			('Receivable Voucher', 'customer'),
+			('Sales Invoice', 'customer'),
 			('Sales Order', 'customer'),
 			('Serial No', 'customer'),
 			('Shipping Address', 'customer'),
 			('Stock Entry', 'customer'),
 			('Support Ticket', 'customer'),
-			('Ticket', 'customer')]
+			('Task', 'customer')]
 			for rec in update_fields:
 				sql("update `tab%s` set customer_name = '%s' where %s = '%s'" %(rec[0],newdn,rec[1],olddn))
 				
diff --git a/erpnext/selling/doctype/customer/customer.txt b/erpnext/selling/doctype/customer/customer.txt
index 993dc29..2914492 100644
--- a/erpnext/selling/doctype/customer/customer.txt
+++ b/erpnext/selling/doctype/customer/customer.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:56',
+		'creation': '2012-04-13 11:56:26',
 		'docstatus': 0,
-		'modified': '2012-02-29 13:24:31',
+		'modified': '2012-04-19 17:12:24',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -27,7 +27,7 @@
 		'show_in_menu': 0,
 		'subject': u'eval:"%(customer_name)s"=="%(name)s" ? "" : "%(customer_name)s"',
 		'tag_fields': u'customer_group,customer_type',
-		'version': 434
+		'version': 1
 	},
 
 	# These values are common for all DocField
@@ -122,6 +122,7 @@
 		'colour': u'White:FFF',
 		'description': u'Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts',
 		'doctype': u'DocField',
+		'fieldname': u'basic_info',
 		'fieldtype': u'Section Break',
 		'label': u'Basic Info',
 		'oldfieldtype': u'Section Break',
@@ -195,6 +196,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'width': u'50%'
@@ -241,6 +243,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'address_contacts',
 		'fieldtype': u'Section Break',
 		'label': u'Address & Contacts',
 		'permlevel': 0
@@ -251,6 +254,7 @@
 		'colour': u'White:FFF',
 		'depends_on': u'eval:doc.__islocal',
 		'doctype': u'DocField',
+		'fieldname': u'address_desc',
 		'fieldtype': u'HTML',
 		'label': u'Address Desc',
 		'options': u'<em>Addresses will appear only when you save the customer</em>',
@@ -261,6 +265,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'address_html',
 		'fieldtype': u'HTML',
 		'label': u'Address HTML',
 		'permlevel': 1
@@ -269,6 +274,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break1',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'width': u'50%'
@@ -279,6 +285,7 @@
 		'colour': u'White:FFF',
 		'depends_on': u'eval:doc.__islocal',
 		'doctype': u'DocField',
+		'fieldname': u'contact_desc',
 		'fieldtype': u'HTML',
 		'label': u'Contact Desc',
 		'options': u'<em>Contact Details will appear only when you save the customer</em>',
@@ -289,6 +296,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'contact_html',
 		'fieldtype': u'HTML',
 		'label': u'Contact HTML',
 		'oldfieldtype': u'HTML',
@@ -299,6 +307,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'more_info',
 		'fieldtype': u'Section Break',
 		'label': u'More Info',
 		'oldfieldtype': u'Section Break',
@@ -308,6 +317,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break2',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'width': u'50%'
@@ -332,6 +342,16 @@
 
 	# DocField
 	{
+		'doctype': u'DocField',
+		'fieldname': u'default_price_list',
+		'fieldtype': u'Link',
+		'label': u'Default Price List',
+		'options': u'Price List',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
 		'colour': u'White:FFF',
 		'description': u"Your Customer's TAX registration numbers (if applicable) or any general information",
 		'doctype': u'DocField',
@@ -346,6 +366,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break3',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'width': u'50%'
@@ -385,6 +406,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'sales_team_section_break',
 		'fieldtype': u'Section Break',
 		'label': u'Sales Team',
 		'oldfieldtype': u'Section Break',
@@ -431,6 +453,7 @@
 		'colour': u'White:FFF',
 		'depends_on': u'eval:!doc.__islocal',
 		'doctype': u'DocField',
+		'fieldname': u'transaction_history',
 		'fieldtype': u'Section Break',
 		'label': u'Transaction History',
 		'permlevel': 0
@@ -441,6 +464,7 @@
 		'colour': u'White:FFF',
 		'depends_on': u'eval:!doc.__islocal',
 		'doctype': u'DocField',
+		'fieldname': u'history_html',
 		'fieldtype': u'HTML',
 		'label': u'History HTML',
 		'permlevel': 0
diff --git a/erpnext/selling/doctype/customer/listview.js b/erpnext/selling/doctype/customer/listview.js
new file mode 100644
index 0000000..8543293
--- /dev/null
+++ b/erpnext/selling/doctype/customer/listview.js
@@ -0,0 +1,20 @@
+// render
+wn.doclistviews['Customer'] = wn.views.ListView.extend({
+	init: function(d) {
+		this._super(d)
+		this.fields = this.fields.concat([
+			"`tabCustomer`.customer_name",
+			"`tabCustomer`.territory",
+		]);
+		this.show_hide_check_column();
+	},
+	
+	columns: [
+		{width: '3%', content:'check'},
+		{width: '5%', content:'avatar'},
+		{width: '50%', content:'name'},
+		{width: '10%', content:'tags'},
+		{width: '20%', content:'territory', css: {'color': '#aaa'}},
+		{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
+	]
+});
diff --git a/erpnext/selling/doctype/enquiry/enquiry.js b/erpnext/selling/doctype/enquiry/enquiry.js
deleted file mode 100644
index c3f0a0b..0000000
--- a/erpnext/selling/doctype/enquiry/enquiry.js
+++ /dev/null
@@ -1,351 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-$import(SMS Control)
-
-cur_frm.cscript.refresh = function(doc, cdt, cdn){
-
-	// 
-
-	if(!doc.docstatus){
-		hide_field(['Update Follow up']);
-		hide_field(['email_id1','cc_to','subject','message','Attachment Html', 'Create New File', 'enquiry_attachment_detail','Send Email']);
-	}
-	else{
-		unhide_field(['Update Follow up']);
-		unhide_field(['email_id1','cc_to','subject','message','Attachment Html', 'Create New File', 'enquiry_attachment_detail','Send Email']);
-	}
-
-	
-	cur_frm.clear_custom_buttons();
-	if(doc.docstatus == 1) {
-		cur_frm.add_custom_button('Create Quotation', cur_frm.cscript['Create Quotation']);
-		cur_frm.add_custom_button('Enquiry Lost', cur_frm.cscript['Declare Enquiry Lost']);
-		cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
-	}
-
-	//cur_frm.cscript.clear_values(doc,cdt,cdn);
-}
-
-// ONLOAD
-// ===============================================================
-cur_frm.cscript.onload = function(doc, cdt, cdn) {
-
-	if(!doc.enquiry_from) hide_field(['customer', 'customer_address', 'contact_person', 'customer_name','lead', 'lead_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory', 'customer_group']);
-	if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
-	if(!doc.date) doc.transaction_date = date.obj_to_str(new Date());
-	if(!doc.company && sys_defaults.company) set_multiple(cdt,cdn,{company:sys_defaults.company});
-	if(!doc.fiscal_year && sys_defaults.fiscal_year) set_multiple(cdt,cdn,{fiscal_year:sys_defaults.fiscal_year});		
-	
-	if(doc.enquiry_from) {
-		if(doc.enquiry_from == 'Customer') {
-			hide_field(['lead', 'lead_name']);
-		}
-		else if (doc.enquiry_from == 'Lead') {
-			hide_field(['customer', 'customer_address', 'contact_person', 'customer_name', 'contact_display', 'customer_group']);
-		}
-	} 
-
-	// setup fetch
-	cur_frm.cscript.set_fetch();
-}
-
-cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
-	if(doc.enquiry_from == 'Lead' && doc.lead) {
-	 	cur_frm.cscript.lead(doc,cdt,cdn);
-	}
-}
-
-// fetch
-// ===============================================================
-cur_frm.cscript.set_fetch = function() {
-
-	// item
-	cur_frm.add_fetch('item_code', 'item_name', 'item_name');
-	cur_frm.add_fetch('item_code', 'stock_uom', 'uom');
-	cur_frm.add_fetch('item_code', 'description', 'description');
-	cur_frm.add_fetch('item_code', 'item_group', 'item_group');
-	cur_frm.add_fetch('item_code', 'brand', 'brand');
-
-	// customer
-
-}
-
-// hide - unhide fields on basis of enquiry_from lead or customer
-cur_frm.cscript.enquiry_from = function(doc,cdt,cdn){
-	cur_frm.cscript.lead_cust_show(doc,cdt,cdn);
-}
-
-// hide - unhide fields based on lead or customer
-cur_frm.cscript.lead_cust_show = function(doc,cdt,cdn){
-	if(doc.enquiry_from == 'Lead'){
-		unhide_field(['lead']);
-		hide_field(['lead_name','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
-		doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = "";
-	}
-	else if(doc.enquiry_from == 'Customer'){		
-		unhide_field(['customer']);
-		hide_field(['lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory']);		
-		doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = "";
-	}
-}
-
-// customer
-cur_frm.cscript.customer = function(doc,dt,dn) {
-	if(doc.customer) get_server_fields('get_default_customer_address', JSON.stringify({customer: doc.customer}),'', doc, dt, dn, 1);
-	if(doc.customer) unhide_field(['customer_name','customer_address','contact_person','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
-}
-
-cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {		
-	if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
-}
-
-cur_frm.fields_dict.customer_address.on_new = function(dn) {
-	locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
-	locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
-}
-
-cur_frm.fields_dict.contact_person.on_new = function(dn) {
-	locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
-	locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
-}
-
-cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
-	return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
-}
-
-cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
-	return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
-}
-
-// lead
-cur_frm.fields_dict['lead'].get_query = function(doc,cdt,cdn){
-	return 'SELECT `tabLead`.name, `tabLead`.lead_name FROM `tabLead` WHERE `tabLead`.%(key)s LIKE "%s"	ORDER BY	`tabLead`.`name` ASC LIMIT 50';
-}
-
-cur_frm.cscript.lead = function(doc, cdt, cdn) {
-	if(doc.lead) get_server_fields('get_lead_details', doc.lead,'', doc, cdt, cdn, 1);
-	if(doc.lead) unhide_field(['lead_name','address_display','contact_mobile','contact_email','territory']);	
-}
-
-
-//item getquery
-//=======================================
-cur_frm.fields_dict['enquiry_details'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
-	if (doc.enquiry_type == 'Maintenance')
-		return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';
-	else 
-		return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_sales_item="Yes" AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';
-}
-	
- //Fetch Item Details
-//====================================================================================================================
-cur_frm.cscript.item_code = function(doc, cdt, cdn) {
-	var d = locals[cdt][cdn];
-	if (d.item_code) {
-		get_server_fields('get_item_details',d.item_code,'enquiry_details',doc,cdt,cdn,1);
-	}
-}
-
-/*
- //Fetch Customer Details
-//======================================================================================================================
-cur_frm.cscript.customer = function(doc, cdt, cdn){
-	if (doc.customer) {
-		get_server_fields('get_cust_address',doc.customer,'',doc,cdt,cdn,1);
-	}
-}
-*/
-
-/*
-//=======================================================================================================================
-cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
-	return 'SELECT `tabContact`.contact_name FROM `tabContact` WHERE `tabContact`.is_customer = 1 AND `tabContact`.customer = "'+ doc.customer+'" AND `tabContact`.docstatus != 2 AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50';
-}
-*/
-
-/*
-//=======================================================================================================================
-cur_frm.cscript.contact_person = function(doc, cdt, cdn){
-	if (doc.contact_person) {
-		arg = {};
-		arg.contact_person = doc.contact_person;
-		arg.customer = doc.customer;
-		get_server_fields('get_contact_details',docstring(arg),'',doc,cdt,cdn,1);
-	}
-}
-*/
-
-/*
-// hide - unhide fields based on lead or customer..
-//=======================================================================================================================
-cur_frm.cscript.clear_values = function(doc,cdt,cdn) {
-	if(doc.enquiry_from == 'Lead') {
-		doc.customer = doc.customer_name = doc.contact_person = doc.customer_group = "";
-	}
-	else if(doc.enquiry_from == 'Customer') {
-		doc.lead =	doc.lead_name = "";
-	}
-	refresh_many(['lead','lead_name','customer','customer_name','contact_person','customer_group']);
-}
-*/
-
-/*
-//================ hide - unhide fields on basis of enquiry from either lead or customer =============================== 
-cur_frm.cscript.enquiry_from = function(doc,cdt,cdn){
-	cur_frm.cscript.clear_values(doc,cdt,cdn);
-	 doc.address = doc.territory = doc.contact_no = doc.email_id = "";
-	 refresh_many(['territory','address','contact_no','email_id']);
-}
-*/
-
-/*
-//================ create new contact ============================================================================
-cur_frm.cscript.new_contact = function(){
-	tn = createLocal('Contact');
-	locals['Contact'][tn].is_customer = 1;
-	if(doc.customer) locals['Contact'][tn].customer = doc.customer;
-	loaddoc('Contact', tn);
-}
-*/
-
-//=======================================================================================================================
-cur_frm.cscript['Create New File'] = function(doc){
-	var fl = LocalDB.create('File');
-	fl = locals['File'][fl];
-	loaddoc('File', fl.name);
-}
-
-//update follow up
-//=================================================================================
-cur_frm.cscript['Update Follow up'] = function(doc,cdt,cdn){
-
-	$c_obj(make_doclist(doc.doctype, doc.name),'update_follow_up','',function(r, rt){
-		refresh_field('follow_up');
-		doc.__unsaved = 0;
-		cur_frm.refresh_header();
-	});
-}
-
- // Create New Quotation
-// =======================================================================================================================
-cur_frm.cscript['Create Quotation'] = function(){
-	n = createLocal("Quotation");
-	$c('dt_map', args={
-		'docs':compress_doclist([locals["Quotation"][n]]),
-		'from_doctype':'Enquiry',
-		'to_doctype':'Quotation',
-		'from_docname':cur_frm.docname,
-		'from_to_list':"[['Enquiry', 'Quotation'],['Enquiry Detail','Quotation Detail']]"
-	}
-	, function(r,rt) {
-		loaddoc("Quotation", n);
-		}
-	);
-}
-
-
-// declare enquiry	lost
-//-------------------------
-cur_frm.cscript['Declare Enquiry Lost'] = function(){
-	var e_lost_dialog;
-
-	set_e_lost_dialog = function(){
-		e_lost_dialog = new Dialog(400,150,'Add Enquiry Lost Reason');
-		e_lost_dialog.make_body([
-			['HTML', 'Message', '<div class="comment">Please add enquiry lost reason</div>'],
-			['Text', 'Enquiry Lost Reason'],
-			['HTML', 'Response', '<div class = "comment" id="update_enquiry_dialog_response"></div>'],
-			['HTML', 'Add Reason', '<div></div>']
-		]);
-		
-		var add_reason_btn1 = $a($i(e_lost_dialog.widgets['Add Reason']), 'button', 'button');
-		add_reason_btn1.innerHTML = 'Add';
-		add_reason_btn1.onclick = function(){ e_lost_dialog.add(); }
-		
-		var add_reason_btn2 = $a($i(e_lost_dialog.widgets['Add Reason']), 'button', 'button');
-		add_reason_btn2.innerHTML = 'Cancel';
-		$y(add_reason_btn2,{marginLeft:'4px'});
-		add_reason_btn2.onclick = function(){ e_lost_dialog.hide();}
-		
-		e_lost_dialog.onshow = function() {
-			e_lost_dialog.widgets['Enquiry Lost Reason'].value = '';
-			$i('update_enquiry_dialog_response').innerHTML = '';
-		}
-		
-		e_lost_dialog.add = function() {
-			// sending...
-			$i('update_enquiry_dialog_response').innerHTML = 'Processing...';
-			var arg =	strip(e_lost_dialog.widgets['Enquiry Lost Reason'].value);
-			var call_back = function(r,rt) { 
-				if(r.message == 'true'){
-					$i('update_enquiry_dialog_response').innerHTML = 'Done';
-					e_lost_dialog.hide();
-				}
-			}
-			if(arg) {
-				$c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name),'declare_enquiry_lost',arg,call_back);
-			}
-			else{
-				msgprint("Please add enquiry lost reason");
-			}
-			
-		}
-	}	
-	
-	if(!e_lost_dialog){
-		set_e_lost_dialog();
-	}	
-	e_lost_dialog.show();
-}
-
-//get query select Territory
-//=======================================================================================================================
-cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
-	return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"	ORDER BY	`tabTerritory`.`name` ASC LIMIT 50';}
-
-/*
-//===================== Enquiry From validation - either customer or lead is mandatory =====================================
-cur_frm.cscript.enq_frm_validate = function(doc,cdt,cdn){
-	
-	if(doc.enquiry_from == 'Lead'){
-		if(!doc.lead){
-			alert("Lead is mandatory.");	
-			validated = false; 
-		}
-	}
-	else if(doc.enquiry_from == 'Customer'){
-			if(!doc.customer){
-			alert("Customer is mandatory.");
-			validated = false;
-		}
-		else if(!doc.contact_person){
-			alert("Contact Person is mandatory.");
-			validated = false;
-		}
-		else if(!doc.customer_group){
-			alert("Customer Group is mandatory.");
-			validated = false;
-		}
-	} 
-}
-*/
-
-//===================validation function ==============================================================================
-
-cur_frm.cscript.validate = function(doc,cdt,cdn){
-	//cur_frm.cscript.enq_frm_validate(doc,cdt,cdn);
-}
diff --git a/erpnext/selling/doctype/enquiry/enquiry.py b/erpnext/selling/doctype/enquiry/enquiry.py
deleted file mode 100644
index debc3d7..0000000
--- a/erpnext/selling/doctype/enquiry/enquiry.py
+++ /dev/null
@@ -1,347 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.	If not, see <http://www.gnu.org/licenses/>.
-
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-	
-# -----------------------------------------------------------------------------------------
-
-from utilities.transaction_base import TransactionBase
-
-class DocType(TransactionBase):
-	def __init__(self,doc,doclist=[]):
-		self.doc = doc
-		self.doclist = doclist
-		self.fname = 'enq_details'
-		self.tname = 'Enquiry Detail'
-
-	# Autoname
-	# ====================================================================================================================
-	def autoname(self):
-		self.doc.name = make_autoname(self.doc.naming_series+'.####')
-
-	#--------Get customer address-------
-	# ====================================================================================================================
-	def get_cust_address(self,name):
-		details = sql("select customer_name, address, territory, customer_group from `tabCustomer` where name = '%s' and docstatus != 2" %(name), as_dict = 1)
-		if details:
-			ret = {
-				'customer_name':	details and details[0]['customer_name'] or '',
-				'address'	:	details and details[0]['address'] or '',
-				'territory'			 :	details and details[0]['territory'] or '',
-				'customer_group'		:	details and details[0]['customer_group'] or ''
-			}
-			# ********** get primary contact details (this is done separately coz. , in case there is no primary contact thn it would not be able to fetch customer details in case of join query)
-
-			contact_det = sql("select contact_name, contact_no, email_id from `tabContact` where customer = '%s' and is_customer = 1 and is_primary_contact = 'Yes' and docstatus != 2" %(name), as_dict = 1)
-
-			
-			ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
-			ret['contact_no']		 = contact_det and contact_det[0]['contact_no'] or ''
-			ret['email_id']			 = contact_det and contact_det[0]['email_id'] or ''
-		
-			return ret
-		else:
-			msgprint("Customer : %s does not exist in system." % (name))
-			raise Exception
-		
-
-	# ====================================================================================================================		
-	def get_contact_details(self, arg):
-		arg = eval(arg)
-		contact = sql("select contact_no, email_id from `tabContact` where contact_name = '%s' and customer_name = '%s'" %(arg['contact_person'],arg['customer']), as_dict = 1)
-		ret = {
-			'contact_no' : contact and contact[0]['contact_no'] or '',
-			'email_id' : contact and contact[0]['email_id'] or ''
-		}
-		return ret
-		
-	# ====================================================================================================================
-	def on_update(self):
-		# Add to calendar
-		#if self.doc.contact_date and self.doc.last_contact_date != self.doc.contact_date:
-		if self.doc.contact_date and self.doc.contact_date_ref != self.doc.contact_date:
-			if self.doc.contact_by:
-				self.add_calendar_event()
-			set(self.doc, 'contact_date_ref',self.doc.contact_date)
-		set(self.doc, 'status', 'Draft')
-	
-	# Add to Calendar
-	# ====================================================================================================================
-	def add_calendar_event(self):
-		desc=''
-		user_lst =[]
-		if self.doc.customer:
-			if self.doc.contact_person:
-				desc = 'Contact '+cstr(self.doc.contact_person)
-			else:
-				desc = 'Contact customer '+cstr(self.doc.customer)
-		elif self.doc.lead:
-			if self.doc.lead_name:
-				desc = 'Contact '+cstr(self.doc.lead_name)
-			else:
-				desc = 'Contact lead '+cstr(self.doc.lead)
-		desc = desc+ '. By : ' + cstr(self.doc.contact_by)
-		
-		if self.doc.to_discuss:
-			desc = desc+' To Discuss : ' + cstr(self.doc.to_discuss)
-		
-		ev = Document('Event')
-		ev.description = desc
-		ev.event_date = self.doc.contact_date
-		ev.event_hour = '10:00'
-		ev.event_type = 'Private'
-		ev.ref_type = 'Enquiry'
-		ev.ref_name = self.doc.name
-		ev.save(1)
-		
-		user_lst.append(self.doc.owner)
-		
-		chk = sql("select t1.name from `tabProfile` t1, `tabSales Person` t2 where t2.email_id = t1.name and t2.name=%s",self.doc.contact_by)
-		if chk:
-			user_lst.append(chk[0][0])
-		
-		for d in user_lst:
-			ch = addchild(ev, 'event_individuals', 'Event User', 0)
-			ch.person = d
-			ch.save(1)
-
-	#--------------Validation For Last Contact Date-----------------
-	# ====================================================================================================================
-	def set_last_contact_date(self):
-		if self.doc.contact_date_ref and self.doc.contact_date_ref != self.doc.contact_date:
-			if getdate(self.doc.contact_date_ref) < getdate(self.doc.contact_date):
-				self.doc.last_contact_date=self.doc.contact_date_ref
-			else:
-				msgprint("Contact Date Cannot be before Last Contact Date")
-				raise Exception
-	
-	# check if item present in item table
-	# ====================================================================================================================
-	def validate_item_details(self):
-		if not getlist(self.doclist, 'enquiry_details'):
-			msgprint("Please select items for which enquiry needs to be made")
-			raise Exception
-	
-	#check if enquiry date in the range of fiscal year selected
-	#=====================================================
-	def validate_fiscal_year(self):
-		fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
-		ysd=fy and fy[0][0] or ""
-		yed=add_days(str(ysd),365)
-		if str(self.doc.transaction_date) < str(ysd) or str(self.doc.transaction_date) > str(yed):
-			msgprint("Enquiry Date is not within the Fiscal Year selected")
-			raise Exception		
-
-	def validate_lead_cust(self):
-		if self.doc.enquiry_from == 'Lead' and not self.doc.lead:
-			msgprint("Lead Id is mandatory if 'Enquiry From' is selected as Lead", raise_exception=1)
-		elif self.doc.enquiry_from == 'Customer' and not self.doc.customer:
-			msgprint("Customer is mandatory if 'Enquiry From' is selected as Customer", raise_exception=1)
-
-	
-	def validate(self):
-		self.validate_fiscal_year()
-		self.set_last_contact_date()
-		self.validate_item_details()
-		self.validate_lead_cust()
-		
-	# On Submit Functions
-	# ====================================================================================================================
-	def on_submit(self):
-		set(self.doc, 'status', 'Submitted')
-		
-	# ====================================================================================================================	
-	def on_cancel(self):
-		chk = sql("select t1.name from `tabQuotation` t1, `tabQuotation Detail` t2 where t2.parent = t1.name and t1.docstatus=1 and (t1.status!='Order Lost' and t1.status!='Cancelled') and t2.prevdoc_docname = %s",self.doc.name)
-		if chk:
-			msgprint("Quotation No. "+cstr(chk[0][0])+" is submitted against this Enquiry. Thus can not be cancelled.")
-			raise Exception
-		else:
-			set(self.doc, 'status', 'Cancelled')
-		
-	# declare as enquiry lost
-	#---------------------------
-	def declare_enquiry_lost(self,arg):
-		chk = sql("select t1.name from `tabQuotation` t1, `tabQuotation Detail` t2 where t2.parent = t1.name and t1.docstatus=1 and (t1.status!='Order Lost' and t1.status!='Cancelled') and t2.prevdoc_docname = %s",self.doc.name)
-		if chk:
-			msgprint("Quotation No. "+cstr(chk[0][0])+" is submitted against this Enquiry. Thus 'Enquiry Lost' can not be declared against it.")
-			raise Exception
-		else:
-			set(self.doc, 'status', 'Enquiry Lost')
-			set(self.doc, 'order_lost_reason', arg)
-			return 'true'
-		
-	# ====================================================================================================================	
-	def update_follow_up(self):
-		
-		sql("delete from `tabFollow up` where parent = '%s'"%self.doc.name);
-		for d in getlist(self.doclist, 'follow_up'):		
-			d.save()
-		self.doc.save()
-		
-		
-	# On Send Email
-	# ====================================================================================================================
-	#def send_emails(self,email,sender,subject,message):
-	#	if email:
-	#		sendmail(email,sender,subject=subject or 'Enquiry',parts=[['text/plain',message or self.get_enq_summary()]])
-
-	# Prepare HTML Table and Enter Enquiry Details in it, which will be added in enq summary
-	# ====================================================================================================================
-	def quote_table(self):
-		if getlist(self.doclist,'enq_details'):
-			header_lbl = ['Item Code','Item Name','Description','Reqd Qty','UOM']
-			item_tbl = '''<table style="width:90%%; border:1px solid #AAA; border-collapse:collapse"><tr>'''
-			for i in header_lbl:
-				item_header = '''<td style="width=20%%; border:1px solid #AAA; border-collapse:collapse;"><b>%s</b></td>''' % i
-				item_tbl += item_header
-			item_tbl += '''</tr>'''
-			
-			for d in getlist(self.doclist,'enq_details'):
-				item_det = '''
-					<tr><td style="width:20%%; border:1px solid #AAA; border-collpase:collapse">%s</td>
-					<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td>
-					<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td>
-					<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td>
-					<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td></tr>
-				''' % (d.item_code,d.item_name,d.description,d.reqd_qty,d.uom)
-				item_tbl += item_det
-			item_tbl += '''</table>'''
-			return item_tbl
-			
-	# Prepare HTML Page containing summary of Enquiry, which will be sent as message in E-mail
-	# ====================================================================================================================
-	def get_enq_summary(self):
-
-		t = """
-				<html><head></head>
-				<body>
-					<div style="border:1px solid #AAA; padding:20px; width:100%%">
-						<div style="text-align:center;font-size:14px"><b>Request For Quotation</b><br></div>
-						<div style="text-align:center;font-size:12px"> %(from_company)s</div>
-						<div style="text-align:center; font-size:10px"> %(company_address)s</div>
-						<div style="border-bottom:1px solid #AAA; padding:10px"></div> 
-						
-						<div style="padding-top:10px"><b>Quotation Details</b></div>
-						<div><table style="width:100%%">
-						<tr><td style="width:40%%">Enquiry No:</td> <td style="width:60%%"> %(name)s</td></tr>
-						<tr><td style="width:40%%">Opening Date:</td> <td style="width:60%%"> %(transaction_date)s</td></tr>
-						<tr><td style="width:40%%">Expected By Date:</td> <td style="width:60%%"> %(expected_date)s</td></tr>
-						</table>
-						</div>
-						
-						<div style="padding-top:10px"><b>Terms and Conditions</b></div>
-						<div> %(terms_and_conditions)s</div>
-						
-						<div style="padding-top:10px"><b>Contact Details</b></div>
-						<div><table style="width:100%%">
-						<tr><td style="width=40%%">Contact Person:</td><td style="width:60%%"> %(contact_person)s</td></tr>
-						<tr><td style="width=40%%">Contact No:</td><td style="width:60%%"> %(contact_no)s</td></tr>
-						<tr><td style="width=40%%">Email:</td><td style="width:60%%"> %(email)s</td></tr>
-						</table></div>
-						""" % (self.doc.fields)
-		
-		t += """<br><div><b>Quotation Items</b><br></div><div style="width:100%%">%s</div>
-						<br>
-To login into the system, use link : <div><a href='http://67.205.111.118/v160/login.html' target='_blank'>http://67.205.111.118/v160/login.html</a></div><br><br>
-						</div>
-					</body>
-					</html>
-					""" % (self.quote_table())
-		return t
-			
-	#-----------------Email-------------------------------------------- 
-	# ====================================================================================================================
-	def send_emails(self, email=[], subject='', message=''):
-		if email:
-			sender_email= sql("Select email from `tabProfile` where name='%s'"%session['user'])
-			if sender_email and sender_email[0][0]:
-				attach_list=[]
-				for at in getlist(self.doclist,'enquiry_attachment_detail'):
-					if at.select_file:
-						attach_list.append(at.select_file)
-				cc_list=[]
-				if self.doc.cc_to:
-					for cl in (self.doc.cc_to.split(',')):
-						if not validate_email_add(cl.strip(' ')):
-							msgprint('error:%s is not a valid email id' % cl.strip(' '))
-							raise Exception
-						cc_list.append(cl.strip(' ')) 
-						sendmail(cc_list, sender=sender_email[0][0], subject=subject, parts=[['text/html', message]], attach=attach_list)					 
-				sendmail(email, sender=sender_email[0][0], subject=subject, parts=[['text/html', message]], cc=cc_list, attach=attach_list)
-				#sendmail(cc_list, sender = sender_email[0][0], subject = subject , parts = [['text/html', message]],attach=attach_list)
-				msgprint("Mail has been sent")
-				self.add_in_follow_up(message,'Email')
-			else:
-				msgprint("Please enter your mail id in Profile")
-				raise Exception
-	
-	#-------------------------Checking Sent Mails Details----------------------------------------------
-	# ====================================================================================================================
-	def sent_mail(self):
-		if not self.doc.subject or not self.doc.message:
-			msgprint("Please enter subject & message in their respective fields.")
-		elif not self.doc.email_id1:
-			msgprint("Recipient not specified. Please add email id in 'Send To'.")
-			raise Exception
-		else :
-			if not validate_email_add(self.doc.email_id1.strip(' ')):
-				msgprint('error:%s is not a valid email id' % self.doc.email_id1)
-			else:
-				self.send_emails([self.doc.email_id1.strip(' ')], subject = self.doc.subject ,message = self.doc.message)
-
-	#---------------------- Add details in follow up table----------------
-	# ====================================================================================================================
-	def add_in_follow_up(self,message,type):
-		import datetime
-		child = addchild( self.doc, 'follow_up', 'Follow up', 1, self.doclist)
-		child.date = datetime.datetime.now().date().strftime('%Y-%m-%d')
-		child.notes = message
-		child.follow_up_type = type
-		child.save()
-
-	#-------------------SMS----------------------------------------------
-	# ====================================================================================================================
-	def send_sms(self):
-		if not self.doc.sms_message:
-			msgprint("Please enter message in SMS Section ")
-			raise Exception
-		elif not getlist(self.doclist, 'enquiry_sms_detail'):
-			msgprint("Please mention mobile no. to which sms needs to be sent")
-			raise Exception
-		else:
-			receiver_list = []
-			for d in getlist(self.doclist,'enquiry_sms_detail'):
-				if d.other_mobile_no:
-					receiver_list.append(d.other_mobile_no)
-		
-		if receiver_list:
-			msgprint(get_obj('SMS Control', 'SMS Control').send_sms(receiver_list, self.doc.sms_message))
-			self.add_in_follow_up(self.doc.sms_message,'SMS')
diff --git a/erpnext/selling/doctype/enquiry/enquiry.txt b/erpnext/selling/doctype/enquiry/enquiry.txt
deleted file mode 100644
index 0a21d8a..0000000
--- a/erpnext/selling/doctype/enquiry/enquiry.txt
+++ /dev/null
@@ -1,616 +0,0 @@
-# DocType, Enquiry
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:00',
-		'docstatus': 0,
-		'modified': '2012-03-07 13:10:00',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': u'1324284087',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'document_type': u'Transaction',
-		'module': u'Selling',
-		'name': '__common__',
-		'search_fields': u'status,transaction_date,customer,lead,enquiry_type,territory,company',
-		'section_style': u'Tabbed',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'subject': u'To %(customer_name)s%(lead_name)s on %(transaction_date)s',
-		'version': 588
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Enquiry',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': u'DocPerm',
-		'name': '__common__',
-		'parent': u'Enquiry',
-		'parentfield': u'permissions',
-		'parenttype': u'DocType',
-		'read': 1
-	},
-
-	# DocType, Enquiry
-	{
-		'doctype': 'DocType',
-		'name': u'Enquiry'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Sales Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'System Manager',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'System Manager'
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Sales User',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Sales User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Sales Manager',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Enter customer enquiry for which you might raise a quotation in future',
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Basic Info',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'To manage multiple series please go to Setup > Manage Series',
-		'doctype': u'DocField',
-		'fieldname': u'naming_series',
-		'fieldtype': u'Select',
-		'label': u'Series',
-		'no_copy': 1,
-		'oldfieldname': u'naming_series',
-		'oldfieldtype': u'Select',
-		'options': u'ENQUIRY\nENQ',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'enquiry_from',
-		'fieldtype': u'Select',
-		'label': u'Enquiry From',
-		'oldfieldname': u'enquiry_from',
-		'oldfieldtype': u'Select',
-		'options': u'\nLead\nCustomer',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 0,
-		'reqd': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'customer',
-		'fieldtype': u'Link',
-		'hidden': 0,
-		'in_filter': 1,
-		'label': u'Customer',
-		'oldfieldname': u'customer',
-		'oldfieldtype': u'Link',
-		'options': u'Customer',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 0,
-		'search_index': 0,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'customer_address',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Customer Address',
-		'options': u'Address',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'contact_person',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Contact Person',
-		'options': u'Contact',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'customer_name',
-		'fieldtype': u'Data',
-		'label': u'Customer Name',
-		'permlevel': 1,
-		'print_hide': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'lead',
-		'fieldtype': u'Link',
-		'hidden': 0,
-		'in_filter': 1,
-		'label': u'Lead',
-		'oldfieldname': u'lead',
-		'oldfieldtype': u'Link',
-		'options': u'Lead',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'lead_name',
-		'fieldtype': u'Data',
-		'hidden': 0,
-		'label': u'Name',
-		'oldfieldname': u'lead_name',
-		'oldfieldtype': u'Data',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'address_display',
-		'fieldtype': u'Small Text',
-		'hidden': 0,
-		'label': u'Address',
-		'oldfieldname': u'address',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'contact_display',
-		'fieldtype': u'Small Text',
-		'label': u'Contact',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'contact_mobile',
-		'fieldtype': u'Text',
-		'label': u'Contact Mobile No',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'contact_email',
-		'fieldtype': u'Text',
-		'label': u'Contact Email',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'default': u'Today',
-		'description': u'The date at which current entry is made in system.',
-		'doctype': u'DocField',
-		'fieldname': u'transaction_date',
-		'fieldtype': u'Date',
-		'label': u'Enquiry Date',
-		'oldfieldname': u'transaction_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0,
-		'reqd': 1,
-		'width': u'50px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'enquiry_type',
-		'fieldtype': u'Select',
-		'label': u'Enquiry Type',
-		'oldfieldname': u'enquiry_type',
-		'oldfieldtype': u'Select',
-		'options': u'\nSales\nMaintenance',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'Draft',
-		'doctype': u'DocField',
-		'fieldname': u'status',
-		'fieldtype': u'Select',
-		'label': u'Status',
-		'no_copy': 1,
-		'oldfieldname': u'status',
-		'oldfieldtype': u'Select',
-		'options': u'\nDraft\nSubmitted\nQuotation Sent\nOrder Confirmed\nEnquiry Lost\nCancelled',
-		'permlevel': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'amended_from',
-		'fieldtype': u'Data',
-		'label': u'Amended From',
-		'no_copy': 1,
-		'oldfieldname': u'amended_from',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'amendment_date',
-		'fieldtype': u'Date',
-		'label': u'Amendment Date',
-		'no_copy': 1,
-		'oldfieldname': u'amendment_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'<a href="javascript:cur_frm.cscript.TerritoryHelp();">To Manage Territory, click here</a>',
-		'doctype': u'DocField',
-		'fieldname': u'territory',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Territory',
-		'options': u'Territory',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 0,
-		'search_index': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'depends_on': u'eval:doc.enquiry_from=="Customer"',
-		'description': u'<a href="javascript:cur_frm.cscript.CGHelp();">To Manage Customer Groups, click here</a>',
-		'doctype': u'DocField',
-		'fieldname': u'customer_group',
-		'fieldtype': u'Link',
-		'hidden': 0,
-		'in_filter': 1,
-		'label': u'Customer Group',
-		'oldfieldname': u'customer_group',
-		'oldfieldtype': u'Link',
-		'options': u'Customer Group',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 0,
-		'search_index': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Items',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u"Items which do not exist in Item master can also be entered on customer's request",
-		'doctype': u'DocField',
-		'fieldname': u'enquiry_details',
-		'fieldtype': u'Table',
-		'label': u'Enquiry Details',
-		'oldfieldname': u'enquiry_details',
-		'oldfieldtype': u'Table',
-		'options': u'Enquiry Detail',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Filing in Additional Information about the Enquiry will help you analyze your data better.',
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'More Info',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'company',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Company',
-		'oldfieldname': u'company',
-		'oldfieldtype': u'Link',
-		'options': u'Company',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'fiscal_year',
-		'fieldtype': u'Select',
-		'in_filter': 1,
-		'label': u'Fiscal Year',
-		'oldfieldname': u'fiscal_year',
-		'oldfieldtype': u'Select',
-		'options': u'link:Fiscal Year',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'source',
-		'fieldtype': u'Select',
-		'label': u'Source',
-		'oldfieldname': u'source',
-		'oldfieldtype': u'Select',
-		'options': u"\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign\nWalk In",
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Enter name of campaign if source of enquiry is campaign',
-		'doctype': u'DocField',
-		'fieldname': u'campaign',
-		'fieldtype': u'Link',
-		'label': u'Campaign',
-		'oldfieldname': u'campaign',
-		'oldfieldtype': u'Link',
-		'options': u'Campaign',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'depends_on': u'eval:!doc.__islocal',
-		'doctype': u'DocField',
-		'fieldname': u'order_lost_reason',
-		'fieldtype': u'Small Text',
-		'label': u'Order Lost Reason',
-		'no_copy': 1,
-		'oldfieldname': u'order_lost_reason',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 1,
-		'report_hide': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Your sales person who will contact the customer in future',
-		'doctype': u'DocField',
-		'fieldname': u'contact_by',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Next Contact By',
-		'oldfieldname': u'contact_by',
-		'oldfieldtype': u'Link',
-		'options': u'Profile',
-		'permlevel': 0,
-		'width': u'75px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Your sales person will get a reminder on this date to contact the customer',
-		'doctype': u'DocField',
-		'fieldname': u'contact_date',
-		'fieldtype': u'Date',
-		'label': u'Next Contact Date',
-		'oldfieldname': u'contact_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 0,
-		'colour': u'White:FFF',
-		'depends_on': u'eval:!doc.__islocal',
-		'description': u'Date on which the lead was last contacted',
-		'doctype': u'DocField',
-		'fieldname': u'last_contact_date',
-		'fieldtype': u'Date',
-		'label': u'Last Contact Date',
-		'no_copy': 1,
-		'oldfieldname': u'last_contact_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'to_discuss',
-		'fieldtype': u'Small Text',
-		'label': u'To Discuss',
-		'no_copy': 1,
-		'oldfieldname': u'to_discuss',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Keep a track of communication related to this enquiry which will help for future reference.',
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Communication History',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'follow_up',
-		'fieldtype': u'Table',
-		'label': u'Follow Up',
-		'oldfieldname': u'follow_up',
-		'oldfieldtype': u'Table',
-		'options': u'Follow up',
-		'permlevel': 0
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/enquiry_detail/__init__.py b/erpnext/selling/doctype/enquiry_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/selling/doctype/enquiry_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/selling/doctype/enquiry_detail/enquiry_detail.txt b/erpnext/selling/doctype/enquiry_detail/enquiry_detail.txt
deleted file mode 100644
index 284b436..0000000
--- a/erpnext/selling/doctype/enquiry_detail/enquiry_detail.txt
+++ /dev/null
@@ -1,148 +0,0 @@
-# DocType, Enquiry Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:01',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'yogesh@webnotestech.com',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Selling',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 59
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Enquiry Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, Enquiry Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Enquiry Detail'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'item_code',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Item Code',
-		'oldfieldname': 'item_code',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
-		'reqd': 0,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'item_name',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Item Name',
-		'oldfieldname': 'item_name',
-		'oldfieldtype': 'Data',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Text',
-		'idx': 3,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Text',
-		'reqd': 1,
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'item_group',
-		'fieldtype': 'Link',
-		'hidden': 1,
-		'idx': 6,
-		'label': 'Item Group',
-		'oldfieldname': 'item_group',
-		'oldfieldtype': 'Link',
-		'options': 'Item Group',
-		'print_hide': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'brand',
-		'fieldtype': 'Link',
-		'hidden': 1,
-		'idx': 7,
-		'label': 'Brand',
-		'oldfieldname': 'brand',
-		'oldfieldtype': 'Link',
-		'options': 'Brand',
-		'print_hide': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'basic_rate',
-		'fieldtype': 'Currency',
-		'hidden': 1,
-		'idx': 8,
-		'label': 'Basic Rate',
-		'oldfieldname': 'basic_rate',
-		'oldfieldtype': 'Currency',
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'qty',
-		'fieldtype': 'Currency',
-		'idx': 9,
-		'label': 'Qty',
-		'oldfieldname': 'qty',
-		'oldfieldtype': 'Currency'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'uom',
-		'fieldtype': 'Link',
-		'idx': 10,
-		'label': 'UOM',
-		'oldfieldname': 'uom',
-		'oldfieldtype': 'Link',
-		'options': 'UOM',
-		'search_index': 0
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/follow_up/__init__.py b/erpnext/selling/doctype/follow_up/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/selling/doctype/follow_up/__init__.py
+++ /dev/null
diff --git a/erpnext/selling/doctype/follow_up/follow_up.txt b/erpnext/selling/doctype/follow_up/follow_up.txt
deleted file mode 100644
index 4c1338e..0000000
--- a/erpnext/selling/doctype/follow_up/follow_up.txt
+++ /dev/null
@@ -1,94 +0,0 @@
-# DocType, Follow up
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:02',
-		'docstatus': 0,
-		'modified': '2010-10-13 12:06:26',
-		'modified_by': 'yogesh@webnotestech.com',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Selling',
-		'name': '__common__',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 10
-	},
-
-	# These values are common for all DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Follow up',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, Follow up
-	{
-		'doctype': 'DocType',
-		'name': 'Follow up'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'date',
-		'fieldtype': 'Date',
-		'idx': 1,
-		'in_filter': 1,
-		'label': 'Date',
-		'oldfieldname': 'date',
-		'oldfieldtype': 'Date'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'notes',
-		'fieldtype': 'Small Text',
-		'idx': 2,
-		'in_filter': 0,
-		'label': 'Notes',
-		'oldfieldname': 'notes',
-		'oldfieldtype': 'Small Text',
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'follow_up_type',
-		'fieldtype': 'Select',
-		'idx': 3,
-		'in_filter': 1,
-		'label': 'Follow up type',
-		'oldfieldname': 'follow_up_type',
-		'oldfieldtype': 'Select',
-		'options': '\nPhone\nEmail\nSMS\nVisit\nOther'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'follow_up_by',
-		'fieldtype': 'Link',
-		'idx': 4,
-		'in_filter': 1,
-		'label': 'Follow up by',
-		'oldfieldname': 'follow_up_by',
-		'oldfieldtype': 'Link',
-		'options': 'Sales Person'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/industry_type/industry_type.txt b/erpnext/selling/doctype/industry_type/industry_type.txt
index 71bfa9f..7e836cd 100644
--- a/erpnext/selling/doctype/industry_type/industry_type.txt
+++ b/erpnext/selling/doctype/industry_type/industry_type.txt
@@ -3,50 +3,49 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:04',
+		'creation': '2012-03-27 14:36:09',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'harshada@webnotestech.com'
+		'modified': '2012-03-27 14:36:09',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'autoname': 'field:industry',
-		'colour': 'White:FFF',
+		'autoname': u'field:industry',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'Selling',
+		'document_type': u'Master',
+		'module': u'Selling',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 4
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'industry',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'label': 'Industry',
+		'doctype': u'DocField',
+		'fieldname': u'industry',
+		'fieldtype': u'Data',
+		'label': u'Industry',
 		'name': '__common__',
-		'oldfieldname': 'industry',
-		'oldfieldtype': 'Data',
-		'parent': 'Industry Type',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'oldfieldname': u'industry',
+		'oldfieldtype': u'Data',
+		'parent': u'Industry Type',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Industry Type',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Industry Type',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1
 	},
@@ -54,36 +53,33 @@
 	# DocType, Industry Type
 	{
 		'doctype': 'DocType',
-		'name': 'Industry Type'
+		'name': u'Industry Type'
 	},
 
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'Sales Manager',
+		'doctype': u'DocPerm',
+		'role': u'Sales Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'Sales User'
+		'doctype': u'DocPerm',
+		'role': u'Sales User'
 	},
 
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'role': 'Sales Master Manager',
+		'doctype': u'DocPerm',
+		'role': u'Sales Master Manager',
 		'write': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField'
+		'doctype': u'DocField'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/installation_note/installation_note.js b/erpnext/selling/doctype/installation_note/installation_note.js
index 5486857..44f6ac8 100644
--- a/erpnext/selling/doctype/installation_note/installation_note.js
+++ b/erpnext/selling/doctype/installation_note/installation_note.js
@@ -14,7 +14,7 @@
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-cur_frm.cscript.tname = "Installed Item Details";
+cur_frm.cscript.tname = "Installation Note Item";
 cur_frm.cscript.fname = "installed_item_details";
 
 cur_frm.cscript.onload = function(doc, dt, dn) {
@@ -34,7 +34,7 @@
   if(doc.customer) {
     cond = '`tabDelivery Note`.customer = "'+doc.customer+'" AND';
   }
-  return repl('SELECT DISTINCT `tabDelivery Note`.name, `tabDelivery Note`.customer_name  FROM `tabDelivery Note`, `tabDelivery Note Detail` WHERE `tabDelivery Note`.company = "%(company)s" AND `tabDelivery Note`.docstatus = 1 AND ifnull(`tabDelivery Note`.per_installed,0) < 100 AND %(cond)s `tabDelivery Note`.name LIKE "%s" ORDER BY `tabDelivery Note`.name DESC LIMIT 50', {company:doc.company, cond:cond});
+  return repl('SELECT DISTINCT `tabDelivery Note`.name, `tabDelivery Note`.customer_name  FROM `tabDelivery Note`, `tabDelivery Note Item` WHERE `tabDelivery Note`.company = "%(company)s" AND `tabDelivery Note`.docstatus = 1 AND ifnull(`tabDelivery Note`.per_installed,0) < 100 AND %(cond)s `tabDelivery Note`.name LIKE "%s" ORDER BY `tabDelivery Note`.name DESC LIMIT 50', {company:doc.company, cond:cond});
 }
 
 
@@ -42,7 +42,7 @@
   return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';
 }
 
-cur_frm.cscript['Get Items'] = function(doc, dt, dn) {
+cur_frm.cscript.get_items = function(doc, dt, dn) {
   var callback = function(r,rt) { 
 	  unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
 	  cur_frm.refresh();
diff --git a/erpnext/selling/doctype/installation_note/installation_note.py b/erpnext/selling/doctype/installation_note/installation_note.py
index 0b5f3c2..846d143 100644
--- a/erpnext/selling/doctype/installation_note/installation_note.py
+++ b/erpnext/selling/doctype/installation_note/installation_note.py
@@ -38,7 +38,7 @@
   def __init__(self, doc, doclist=[]):
     self.doc = doc
     self.doclist = doclist
-    self.tname = 'Installed Item Details'
+    self.tname = 'Installation Note Item'
     self.fname = 'installed_item_details'
 
   # Autoname
@@ -51,7 +51,7 @@
   #====================================
   def pull_delivery_note_details(self):
     self.validate_prev_docname()
-    self.doclist = get_obj('DocType Mapper', 'Delivery Note-Installation Note').dt_map('Delivery Note', 'Installation Note', self.doc.delivery_note_no, self.doc, self.doclist, "[['Delivery Note', 'Installation Note'],['Delivery Note Detail', 'Installed Item Details']]")
+    self.doclist = get_obj('DocType Mapper', 'Delivery Note-Installation Note').dt_map('Delivery Note', 'Installation Note', self.doc.delivery_note_no, self.doc, self.doclist, "[['Delivery Note', 'Installation Note'],['Delivery Note Item', 'Installation Note Item']]")
   
   # Validates that Delivery Note is not pulled twice 
   #============================================
@@ -116,7 +116,7 @@
   def get_prevdoc_serial_no(self, prevdoc_detail_docname, prevdoc_docname):
     from stock.doctype.stock_ledger.stock_ledger import get_sr_no_list
 	
-    res = sql("select serial_no from `tabDelivery Note Detail` where name = '%s' and parent ='%s'" % (prevdoc_detail_docname, prevdoc_docname))
+    res = sql("select serial_no from `tabDelivery Note Item` where name = '%s' and parent ='%s'" % (prevdoc_detail_docname, prevdoc_docname))
     return get_sr_no_list(res[0][0])
     
   #check if all serial nos from current record exist in resp delivery note
diff --git a/erpnext/selling/doctype/installation_note/installation_note.txt b/erpnext/selling/doctype/installation_note/installation_note.txt
index f71a5f7..a3812d7 100644
--- a/erpnext/selling/doctype/installation_note/installation_note.txt
+++ b/erpnext/selling/doctype/installation_note/installation_note.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:04',
+		'creation': '2012-03-27 14:36:09',
 		'docstatus': 0,
-		'modified': '2012-03-21 14:08:59',
+		'modified': '2012-03-27 18:48:02',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -17,13 +17,14 @@
 		'colour': u'White:FFF',
 		'default_print_format': u'Standard',
 		'doctype': 'DocType',
+		'is_submittable': 1,
 		'module': u'Selling',
 		'name': '__common__',
 		'section_style': u'Simple',
 		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'subject': u'At %(customer_name)s on %(inst_date)s',
-		'version': 97
+		'version': 98
 	},
 
 	# These values are common for all DocField
@@ -84,13 +85,6 @@
 
 	# DocPerm
 	{
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Sales User'
-	},
-
-	# DocPerm
-	{
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
@@ -105,12 +99,20 @@
 	{
 		'doctype': u'DocPerm',
 		'permlevel': 1,
+		'role': u'Sales User'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
 		'role': u'Sales Manager'
 	},
 
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'installation_note',
 		'fieldtype': u'Section Break',
 		'label': u'Installation Note',
 		'oldfieldtype': u'Section Break',
@@ -120,6 +122,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -257,6 +260,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break1',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -396,6 +400,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'item_details',
 		'fieldtype': u'Section Break',
 		'label': u'Item Details',
 		'oldfieldtype': u'Section Break',
@@ -424,18 +429,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'hidden': 0,
-		'label': u'Get Items',
-		'oldfieldtype': u'Button',
-		'options': u'pull_delivery_note_details',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
+		'fieldname': u'get_items',
 		'fieldtype': u'Button',
 		'hidden': 0,
 		'label': u'Get Items',
@@ -450,10 +444,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'installed_item_details',
 		'fieldtype': u'Table',
-		'label': u'Installed Item Details',
+		'label': u'Installation Note Item',
 		'oldfieldname': u'installed_item_details',
 		'oldfieldtype': u'Table',
-		'options': u'Installed Item Details',
+		'options': u'Installation Note Item',
 		'permlevel': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/installed_item_details/__init__.py b/erpnext/selling/doctype/installation_note_item/__init__.py
similarity index 100%
rename from erpnext/selling/doctype/installed_item_details/__init__.py
rename to erpnext/selling/doctype/installation_note_item/__init__.py
diff --git a/erpnext/selling/doctype/installation_note_item/installation_note_item.txt b/erpnext/selling/doctype/installation_note_item/installation_note_item.txt
new file mode 100644
index 0000000..8a999f4
--- /dev/null
+++ b/erpnext/selling/doctype/installation_note_item/installation_note_item.txt
@@ -0,0 +1,153 @@
+# DocType, Installation Note Item
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:10',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:10',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'IID/.#####',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Selling',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 25
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Installation Note Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Installation Note Item
+	{
+		'doctype': 'DocType',
+		'name': u'Installation Note Item'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Data',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_date',
+		'fieldtype': u'Date',
+		'hidden': 0,
+		'label': u'Delivery Date',
+		'oldfieldname': u'prevdoc_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 1,
+		'print_hide': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'serial_no',
+		'fieldtype': u'Small Text',
+		'label': u'Serial No',
+		'oldfieldname': u'serial_no',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0,
+		'width': u'180px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_detail_docname',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Against Document Detail No',
+		'no_copy': 1,
+		'oldfieldname': u'prevdoc_detail_docname',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_docname',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Against Document No',
+		'no_copy': 1,
+		'oldfieldname': u'prevdoc_docname',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_doctype',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Document Type',
+		'no_copy': 1,
+		'oldfieldname': u'prevdoc_doctype',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'qty',
+		'fieldtype': u'Currency',
+		'label': u'Installed Qty',
+		'oldfieldname': u'qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'reqd': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/installed_item_details/installed_item_details.txt b/erpnext/selling/doctype/installed_item_details/installed_item_details.txt
deleted file mode 100644
index 0aa4c1b..0000000
--- a/erpnext/selling/doctype/installed_item_details/installed_item_details.txt
+++ /dev/null
@@ -1,153 +0,0 @@
-# DocType, Installed Item Details
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:05',
-		'docstatus': 0,
-		'modified': '2012-03-21 14:52:10',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': u'IID/.#####',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': u'Selling',
-		'name': '__common__',
-		'section_style': u'Simple',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 25
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Installed Item Details',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# DocType, Installed Item Details
-	{
-		'doctype': 'DocType',
-		'name': u'Installed Item Details'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_code',
-		'fieldtype': u'Link',
-		'label': u'Item Code',
-		'oldfieldname': u'item_code',
-		'oldfieldtype': u'Link',
-		'options': u'Item',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'description',
-		'fieldtype': u'Data',
-		'label': u'Description',
-		'oldfieldname': u'description',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'width': u'300px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_date',
-		'fieldtype': u'Date',
-		'hidden': 0,
-		'label': u'Delivery Date',
-		'oldfieldname': u'prevdoc_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 1,
-		'print_hide': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'serial_no',
-		'fieldtype': u'Small Text',
-		'label': u'Serial No',
-		'oldfieldname': u'serial_no',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 0,
-		'width': u'180px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_detail_docname',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'label': u'Against Document Detail No',
-		'no_copy': 1,
-		'oldfieldname': u'prevdoc_detail_docname',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_docname',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'Against Document No',
-		'no_copy': 1,
-		'oldfieldname': u'prevdoc_docname',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_doctype',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'Document Type',
-		'no_copy': 1,
-		'oldfieldname': u'prevdoc_doctype',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'qty',
-		'fieldtype': u'Currency',
-		'label': u'Installed Qty',
-		'oldfieldname': u'qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'reqd': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/lead/lead.js b/erpnext/selling/doctype/lead/lead.js
index 7255636..e97aea5 100644
--- a/erpnext/selling/doctype/lead/lead.js
+++ b/erpnext/selling/doctype/lead/lead.js
@@ -16,11 +16,19 @@
 
 // Module CRM
 
-$import(SMS Control)
+wn.require('erpnext/utilities/doctype/sms_control/sms_control.js');
 
 cur_frm.cscript.onload = function(doc, cdt, cdn) {
   if(user =='Guest'){
-    hide_field(['status', 'naming_series', 'order_lost_reason', 'customer', 'rating', 'fax', 'website', 'territory', 'TerritoryHelp', 'address_line1', 'address_line2', 'city', 'state', 'country', 'pincode', 'address', 'lead_owner', 'market_segment', 'industry', 'campaign_name', 'interested_in', 'company', 'fiscal_year', 'contact_by', 'contact_date', 'last_contact_date', 'contact_date_ref', 'to_discuss', 'More Info', 'follow_up', 'Communication History', 'cc_to', 'subject', 'message', 'Attachment Html', 'Create New File', 'lead_attachment_detail', 'Send Email', 'Email', 'Create Customer', 'Create Enquiry', 'Next Steps', 'transaction_date', 'type', 'source']);
+    hide_field(['status', 'naming_series', 'order_lost_reason',
+	'customer', 'rating', 'fax', 'website', 'territory',
+	'TerritoryHelp', 'address_line1', 'address_line2', 'city', 'state',
+	'country', 'pincode', 'address', 'lead_owner', 'market_segment',
+	'industry', 'campaign_name', 'interested_in', 'company',
+	'fiscal_year', 'contact_by', 'contact_date', 'last_contact_date',
+	'contact_date_ref', 'to_discuss', 'more_info', 'follow_up',
+	'communication_history', 'cc_to', 'subject', 'message', 'lead_attachment_detail',
+	'Create Customer', 'Create Opportunity', 'transaction_date', 'type', 'source']);
     doc.source = 'Website';
   }
   if(!doc.status) set_multiple(dt,dn,{status:'Open'});
@@ -39,9 +47,9 @@
   //---------------
   cur_frm.clear_custom_buttons()
   if(!doc.__islocal && !in_list(['Converted', 'Lead Lost'], doc.status)) {
-    cur_frm.add_custom_button('Create Customer', cur_frm.cscript['Create Customer']);
-    cur_frm.add_custom_button('Create Enquiry', cur_frm.cscript['Create Enquiry']);
-    cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
+	if (doc.source != 'Existing Customer') cur_frm.add_custom_button('Create Customer', cur_frm.cscript['Create Customer']);
+    cur_frm.add_custom_button('Create Opportunity', cur_frm.cscript['Create Opportunity']);
+    cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
   }
 }
 
@@ -53,24 +61,6 @@
   cur_frm.cscript.refresh(doc, cdt, cdn);
 }
 
-/*
-// *********** Country ******************
-// This will show states belonging to country
-cur_frm.cscript.country = function(doc, cdt, cdn) {
-  var mydoc=doc;
-  $c('runserverobj', args={'method':'check_state', 'docs':compress_doclist([doc])},
-    function(r,rt){
-      if(r.message) {
-        var doc = locals[mydoc.doctype][mydoc.name];
-        doc.state = '';
-        get_field(doc.doctype, 'state' , doc.name).options = r.message;
-        refresh_field('state');
-      }
-    }
-  );
-}
-*/
-
 cur_frm.cscript.TerritoryHelp = function(doc,dt,dn){
   var call_back = function(){
     var sb_obj = new SalesBrowser();        
@@ -80,12 +70,6 @@
   loadpage('Sales Browser',call_back);
 }
 
-// Create New File
-// ===============================================================
-cur_frm.cscript['Create New File'] = function(doc){
-  new_doc("File");
-}
-
 //Trigger in Item Table
 //===================================
 cur_frm.cscript.item_code=function(doc,cdt,cdn){
@@ -122,7 +106,7 @@
 
 // send email
 // ===============================================================
-cur_frm.cscript['Send Email'] = function(doc,cdt,cdn){
+cur_frm.cscript.send_email = function(doc,cdt,cdn){
   if(doc.__islocal != 1){
     $c_obj(make_doclist(doc.doctype, doc.name),'send_mail','',function(r,rt){});
   }else{
@@ -130,9 +114,9 @@
   }
 }
 
-// Create New Enquiry
+// Create New Opportunity
 // ===============================================================
-cur_frm.cscript['Create Enquiry'] = function(){
+cur_frm.cscript['Create Opportunity'] = function(){
   var doc = cur_frm.doc;
   $c('runserverobj',args={ 'method':'check_status', 'docs':compress_doclist([doc])},
     function(r,rt){
@@ -140,16 +124,16 @@
         msgprint("This lead is now converted to customer. Please create enquiry on behalf of customer");
       }
       else{
-        n = createLocal("Enquiry");
+        n = createLocal("Opportunity");
         $c('dt_map', args={
-          'docs':compress_doclist([locals["Enquiry"][n]]),
+          'docs':compress_doclist([locals["Opportunity"][n]]),
           'from_doctype':'Lead',
-          'to_doctype':'Enquiry',
+          'to_doctype':'Opportunity',
           'from_docname':doc.name,
-          'from_to_list':"[['Lead', 'Enquiry']]"
+          'from_to_list':"[['Lead', 'Opportunity']]"
         }
         , function(r,rt) {
-            loaddoc("Enquiry", n);
+            loaddoc("Opportunity", n);
           }
         );
       }
diff --git a/erpnext/selling/doctype/lead/lead.py b/erpnext/selling/doctype/lead/lead.py
index e5d2633..50e996a 100644
--- a/erpnext/selling/doctype/lead/lead.py
+++ b/erpnext/selling/doctype/lead/lead.py
@@ -84,7 +84,7 @@
     #  self.doc.address = comp_address
     
     if self.doc.status == 'Lead Lost' and not self.doc.order_lost_reason:
-      msgprint("Please Enter Order Lost Reason")
+      msgprint("Please Enter Quotation Lost Reason")
       raise Exception  
     
     if self.doc.source == 'Campaign' and not self.doc.campaign_name and session['user'] != 'Guest':
@@ -204,7 +204,7 @@
 #---------------------- Add details in follow up table----------------
   def add_in_follow_up(self,message,type):
     import datetime
-    child = addchild( self.doc, 'follow_up', 'Follow up', 1, self.doclist)
+    child = addchild( self.doc, 'follow_up', 'Communication Log', 1, self.doclist)
     child.date = datetime.datetime.now().date().strftime('%Y-%m-%d')
     child.notes = message
     child.follow_up_type = type
diff --git a/erpnext/selling/doctype/lead/lead.txt b/erpnext/selling/doctype/lead/lead.txt
index 2a0cf9a..2ec8963 100644
--- a/erpnext/selling/doctype/lead/lead.txt
+++ b/erpnext/selling/doctype/lead/lead.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:07',
+		'creation': '2012-03-27 14:36:10',
 		'docstatus': 0,
-		'modified': '2012-03-21 14:35:34',
+		'modified': '2012-03-27 14:36:10',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -56,26 +56,21 @@
 
 	# DocPerm
 	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
 		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': u'Sales User',
-		'submit': 0,
-		'write': 0
+		'role': u'All'
 	},
 
 	# DocPerm
 	{
 		'amend': 0,
 		'cancel': 0,
-		'create': 0,
+		'create': 1,
 		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Sales Manager',
+		'permlevel': 0,
+		'role': u'Sales User',
 		'submit': 0,
-		'write': 0
+		'write': 1
 	},
 
 	# DocPerm
@@ -96,28 +91,44 @@
 		'cancel': 0,
 		'create': 1,
 		'doctype': u'DocPerm',
+		'match': u'owner',
 		'permlevel': 0,
-		'role': u'Sales User',
+		'role': u'System Manager',
 		'submit': 0,
 		'write': 1
 	},
 
 	# DocPerm
 	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
 		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': u'All'
+		'role': u'Sales Manager',
+		'submit': 0,
+		'write': 0
 	},
 
 	# DocPerm
 	{
 		'amend': 0,
 		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
 		'create': 1,
 		'doctype': u'DocPerm',
+		'match': u'territory',
 		'permlevel': 0,
 		'role': u'System Manager',
-		'submit': 0,
 		'write': 1
 	},
 
@@ -134,6 +145,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'basic_info',
 		'fieldtype': u'Section Break',
 		'label': u'Basic Info',
 		'oldfieldtype': u'Section Break',
@@ -143,6 +155,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -285,6 +298,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break1',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'width': u'50%'
@@ -356,7 +370,7 @@
 		'label': u'Lost Reason',
 		'oldfieldname': u'order_lost_reason',
 		'oldfieldtype': u'Link',
-		'options': u'Order Lost Reason',
+		'options': u'Quotation Lost Reason',
 		'permlevel': 0
 	},
 
@@ -376,6 +390,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'contact_info',
 		'fieldtype': u'Section Break',
 		'label': u'Contact Info',
 		'oldfieldtype': u'Column Break',
@@ -458,6 +473,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break2',
 		'fieldtype': u'Column Break',
 		'permlevel': 0
 	},
@@ -545,6 +561,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'more_info',
 		'fieldtype': u'Section Break',
 		'label': u'More Info',
 		'oldfieldtype': u'Section Break',
@@ -637,6 +654,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break3',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -715,6 +733,7 @@
 		'colour': u'White:FFF',
 		'description': u'Keep a track of communication with this lead which will help for future reference.',
 		'doctype': u'DocField',
+		'fieldname': u'communication_history',
 		'fieldtype': u'Section Break',
 		'label': u'Communication History',
 		'oldfieldtype': u'Section Break',
@@ -727,10 +746,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'follow_up',
 		'fieldtype': u'Table',
-		'label': u'Follow up',
+		'label': u'Communication Log',
 		'oldfieldname': u'follow_up',
 		'oldfieldtype': u'Table',
-		'options': u'Follow up',
+		'options': u'Communication Log',
 		'permlevel': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/lead/listview.js b/erpnext/selling/doctype/lead/listview.js
new file mode 100644
index 0000000..4751c64
--- /dev/null
+++ b/erpnext/selling/doctype/lead/listview.js
@@ -0,0 +1,32 @@
+wn.doclistviews['Lead'] = wn.views.ListView.extend({
+	init: function(d) {
+		this._super(d)
+		this.fields = this.fields.concat([
+			'tabLead.lead_name',
+			'tabLead.status',
+			'tabLead.source',
+			'tabLead.rating'
+		]);
+		this.stats = this.stats.concat(['status', 'source', 'rating', 'company']);
+	},
+
+	prepare_data: function(data) {
+		this._super(data);
+		if(data.status=='Interested') {
+			data.label_type = 'success'
+		}
+		else if(['Open', 'Attempted to Contact', 'Contacted', 'Contact in Future'].indexOf(data.status)!=-1) {
+			data.label_type = 'info'
+		}
+		data.status_html = repl('<span class="label label-%(label_type)s">%(status)s</span>', data);
+		
+		data.lead_name = (data.rating ? ('['+data.rating+'] ') : '') + '['+data.source+'] ' + data.lead_name;
+	},
+
+	columns: [
+		{width: '20%', content:'name'},
+		{width: '12%', content:'status_html'},
+		{width: '55%', content:'tags+lead_name', css: {color:'#aaa'}},
+		{width: '13%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
+	]
+})
diff --git a/erpnext/selling/doctype/enquiry/__init__.py b/erpnext/selling/doctype/opportunity/__init__.py
similarity index 100%
rename from erpnext/selling/doctype/enquiry/__init__.py
rename to erpnext/selling/doctype/opportunity/__init__.py
diff --git a/erpnext/selling/doctype/opportunity/listview.js b/erpnext/selling/doctype/opportunity/listview.js
new file mode 100644
index 0000000..db7f67c
--- /dev/null
+++ b/erpnext/selling/doctype/opportunity/listview.js
@@ -0,0 +1,37 @@
+wn.doclistviews['Opportunity'] = wn.views.ListView.extend({
+	init: function(d) {
+		this._super(d)
+		this.fields = this.fields.concat([
+			'tabOpportunity.enquiry_from',
+			'tabOpportunity.lead_name',
+			'tabOpportunity.customer_name',
+			'tabOpportunity.status',
+		]);
+		this.stats = this.stats.concat(['status', 'source', 'enquiry_from', 'company']);
+	},
+
+	prepare_data: function(data) {
+		this._super(data);
+		if(['Order Confirmed', 'Quotation Sent']
+				.indexOf(data.status)!=-1) {
+			data.label_type = 'success';
+		} else if(data.status == 'Draft') {
+			data.label_type = 'info';
+		} else if(data.status == 'Submit') {
+			data.label_type = 'important';
+		}
+		data.status_html = repl('<span class="label label-%(label_type)s">%(status)s</span>', data);
+		if(data.enquiry_from == 'Lead') {
+			data.enquiry_name = repl('[%(enquiry_from)s] %(lead_name)s', data);
+		} else {
+			data.enquiry_name = repl('[%(enquiry_from)s] %(customer_name)s', data);
+		}
+	},
+
+	columns: [
+		{width: '15%', content:'name'},
+		{width: '18%', content:'status_html'},
+		{width: '55%', content:'tags+enquiry_name', css: {color:'#aaa'}},
+		{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
+	]
+})
diff --git a/erpnext/selling/doctype/opportunity/opportunity.js b/erpnext/selling/doctype/opportunity/opportunity.js
new file mode 100644
index 0000000..207a27c
--- /dev/null
+++ b/erpnext/selling/doctype/opportunity/opportunity.js
@@ -0,0 +1,330 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+wn.require('erpnext/utilities/doctype/sms_control/sms_control.js');
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn){
+
+	// 
+
+	if(!doc.docstatus){
+		hide_field(['email_id1','cc_to','subject','message', 'enquiry_attachment_detail']);
+	}
+	else{
+		unhide_field(['email_id1','cc_to','subject','message', 'enquiry_attachment_detail']);
+	}
+
+	
+	cur_frm.clear_custom_buttons();
+	if(doc.docstatus == 1) {
+		cur_frm.add_custom_button('Create Quotation', cur_frm.cscript['Create Quotation']);
+		cur_frm.add_custom_button('Opportunity Lost', cur_frm.cscript['Declare Opportunity Lost']);
+		cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
+	}
+
+	//cur_frm.cscript.clear_values(doc,cdt,cdn);
+}
+
+// ONLOAD
+// ===============================================================
+cur_frm.cscript.onload = function(doc, cdt, cdn) {
+
+	if(!doc.enquiry_from) hide_field(['customer', 'customer_address', 'contact_person', 'customer_name','lead', 'lead_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory', 'customer_group']);
+	if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
+	if(!doc.date) doc.transaction_date = date.obj_to_str(new Date());
+	if(!doc.company && sys_defaults.company) set_multiple(cdt,cdn,{company:sys_defaults.company});
+	if(!doc.fiscal_year && sys_defaults.fiscal_year) set_multiple(cdt,cdn,{fiscal_year:sys_defaults.fiscal_year});		
+	
+	if(doc.enquiry_from) {
+		if(doc.enquiry_from == 'Customer') {
+			hide_field(['lead', 'lead_name']);
+		}
+		else if (doc.enquiry_from == 'Lead') {
+			hide_field(['customer', 'customer_address', 'contact_person', 'customer_name', 'contact_display', 'customer_group']);
+		}
+	} 
+
+	// setup fetch
+	cur_frm.cscript.set_fetch();
+}
+
+cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
+	if(doc.enquiry_from == 'Lead' && doc.lead) {
+	 	cur_frm.cscript.lead(doc,cdt,cdn);
+	}
+}
+
+// fetch
+// ===============================================================
+cur_frm.cscript.set_fetch = function() {
+
+	// item
+	cur_frm.add_fetch('item_code', 'item_name', 'item_name');
+	cur_frm.add_fetch('item_code', 'stock_uom', 'uom');
+	cur_frm.add_fetch('item_code', 'description', 'description');
+	cur_frm.add_fetch('item_code', 'item_group', 'item_group');
+	cur_frm.add_fetch('item_code', 'brand', 'brand');
+
+	// customer
+
+}
+
+// hide - unhide fields on basis of enquiry_from lead or customer
+cur_frm.cscript.enquiry_from = function(doc,cdt,cdn){
+	cur_frm.cscript.lead_cust_show(doc,cdt,cdn);
+}
+
+// hide - unhide fields based on lead or customer
+cur_frm.cscript.lead_cust_show = function(doc,cdt,cdn){
+	if(doc.enquiry_from == 'Lead'){
+		unhide_field(['lead']);
+		hide_field(['lead_name','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+		doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = "";
+	}
+	else if(doc.enquiry_from == 'Customer'){		
+		unhide_field(['customer']);
+		hide_field(['lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory']);		
+		doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = "";
+	}
+}
+
+// customer
+cur_frm.cscript.customer = function(doc,dt,dn) {
+	if(doc.customer) get_server_fields('get_default_customer_address', JSON.stringify({customer: doc.customer}),'', doc, dt, dn, 1);
+	if(doc.customer) unhide_field(['customer_name','customer_address','contact_person','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+}
+
+cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {		
+	if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
+}
+
+cur_frm.fields_dict.customer_address.on_new = function(dn) {
+	locals['Address'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+	locals['Address'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict.contact_person.on_new = function(dn) {
+	locals['Contact'][dn].customer = locals[cur_frm.doctype][cur_frm.docname].customer;
+	locals['Contact'][dn].customer_name = locals[cur_frm.doctype][cur_frm.docname].customer_name;
+}
+
+cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
+	return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+	return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
+}
+
+// lead
+cur_frm.fields_dict['lead'].get_query = function(doc,cdt,cdn){
+	return 'SELECT `tabLead`.name, `tabLead`.lead_name FROM `tabLead` WHERE `tabLead`.%(key)s LIKE "%s"	ORDER BY	`tabLead`.`name` ASC LIMIT 50';
+}
+
+cur_frm.cscript.lead = function(doc, cdt, cdn) {
+	if(doc.lead) get_server_fields('get_lead_details', doc.lead,'', doc, cdt, cdn, 1);
+	if(doc.lead) unhide_field(['lead_name','address_display','contact_mobile','contact_email','territory']);	
+}
+
+
+//item getquery
+//=======================================
+cur_frm.fields_dict['enquiry_details'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
+	if (doc.enquiry_type == 'Maintenance')
+		return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';
+	else 
+		return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_sales_item="Yes" AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';
+}
+	
+ //Fetch Item Details
+//====================================================================================================================
+cur_frm.cscript.item_code = function(doc, cdt, cdn) {
+	var d = locals[cdt][cdn];
+	if (d.item_code) {
+		get_server_fields('get_item_details',d.item_code,'enquiry_details',doc,cdt,cdn,1);
+	}
+}
+
+/*
+ //Fetch Customer Details
+//======================================================================================================================
+cur_frm.cscript.customer = function(doc, cdt, cdn){
+	if (doc.customer) {
+		get_server_fields('get_cust_address',doc.customer,'',doc,cdt,cdn,1);
+	}
+}
+*/
+
+/*
+//=======================================================================================================================
+cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
+	return 'SELECT `tabContact`.contact_name FROM `tabContact` WHERE `tabContact`.is_customer = 1 AND `tabContact`.customer = "'+ doc.customer+'" AND `tabContact`.docstatus != 2 AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50';
+}
+*/
+
+/*
+//=======================================================================================================================
+cur_frm.cscript.contact_person = function(doc, cdt, cdn){
+	if (doc.contact_person) {
+		arg = {};
+		arg.contact_person = doc.contact_person;
+		arg.customer = doc.customer;
+		get_server_fields('get_contact_details',docstring(arg),'',doc,cdt,cdn,1);
+	}
+}
+*/
+
+/*
+// hide - unhide fields based on lead or customer..
+//=======================================================================================================================
+cur_frm.cscript.clear_values = function(doc,cdt,cdn) {
+	if(doc.enquiry_from == 'Lead') {
+		doc.customer = doc.customer_name = doc.contact_person = doc.customer_group = "";
+	}
+	else if(doc.enquiry_from == 'Customer') {
+		doc.lead =	doc.lead_name = "";
+	}
+	refresh_many(['lead','lead_name','customer','customer_name','contact_person','customer_group']);
+}
+*/
+
+/*
+//================ hide - unhide fields on basis of enquiry from either lead or customer =============================== 
+cur_frm.cscript.enquiry_from = function(doc,cdt,cdn){
+	cur_frm.cscript.clear_values(doc,cdt,cdn);
+	 doc.address = doc.territory = doc.contact_no = doc.email_id = "";
+	 refresh_many(['territory','address','contact_no','email_id']);
+}
+*/
+
+/*
+//================ create new contact ============================================================================
+cur_frm.cscript.new_contact = function(){
+	tn = createLocal('Contact');
+	locals['Contact'][tn].is_customer = 1;
+	if(doc.customer) locals['Contact'][tn].customer = doc.customer;
+	loaddoc('Contact', tn);
+}
+*/
+ // Create New Quotation
+// =======================================================================================================================
+cur_frm.cscript['Create Quotation'] = function(){
+	n = createLocal("Quotation");
+	$c('dt_map', args={
+		'docs':compress_doclist([locals["Quotation"][n]]),
+		'from_doctype':'Opportunity',
+		'to_doctype':'Quotation',
+		'from_docname':cur_frm.docname,
+		'from_to_list':"[['Opportunity', 'Quotation'],['Opportunity Item','Quotation Item']]"
+	}
+	, function(r,rt) {
+		loaddoc("Quotation", n);
+		}
+	);
+}
+
+
+// declare enquiry	lost
+//-------------------------
+cur_frm.cscript['Declare Opportunity Lost'] = function(){
+	var e_lost_dialog;
+
+	set_e_lost_dialog = function(){
+		e_lost_dialog = new Dialog(400,150,'Add Opportunity Lost Reason');
+		e_lost_dialog.make_body([
+			['HTML', 'Message', '<div class="comment">Please add enquiry lost reason</div>'],
+			['Text', 'Opportunity Lost Reason'],
+			['HTML', 'Response', '<div class = "comment" id="update_enquiry_dialog_response"></div>'],
+			['HTML', 'Add Reason', '<div></div>']
+		]);
+		
+		var add_reason_btn1 = $a($i(e_lost_dialog.widgets['Add Reason']), 'button', 'button');
+		add_reason_btn1.innerHTML = 'Add';
+		add_reason_btn1.onclick = function(){ e_lost_dialog.add(); }
+		
+		var add_reason_btn2 = $a($i(e_lost_dialog.widgets['Add Reason']), 'button', 'button');
+		add_reason_btn2.innerHTML = 'Cancel';
+		$y(add_reason_btn2,{marginLeft:'4px'});
+		add_reason_btn2.onclick = function(){ e_lost_dialog.hide();}
+		
+		e_lost_dialog.onshow = function() {
+			e_lost_dialog.widgets['Opportunity Lost Reason'].value = '';
+			$i('update_enquiry_dialog_response').innerHTML = '';
+		}
+		
+		e_lost_dialog.add = function() {
+			// sending...
+			$i('update_enquiry_dialog_response').innerHTML = 'Processing...';
+			var arg =	strip(e_lost_dialog.widgets['Opportunity Lost Reason'].value);
+			var call_back = function(r,rt) { 
+				if(r.message == 'true'){
+					$i('update_enquiry_dialog_response').innerHTML = 'Done';
+					e_lost_dialog.hide();
+				}
+			}
+			if(arg) {
+				$c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name),'declare_enquiry_lost',arg,call_back);
+			}
+			else{
+				msgprint("Please add enquiry lost reason");
+			}
+			
+		}
+	}	
+	
+	if(!e_lost_dialog){
+		set_e_lost_dialog();
+	}	
+	e_lost_dialog.show();
+}
+
+//get query select Territory
+//=======================================================================================================================
+cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
+	return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"	ORDER BY	`tabTerritory`.`name` ASC LIMIT 50';}
+
+/*
+//===================== Opportunity From validation - either customer or lead is mandatory =====================================
+cur_frm.cscript.enq_frm_validate = function(doc,cdt,cdn){
+	
+	if(doc.enquiry_from == 'Lead'){
+		if(!doc.lead){
+			alert("Lead is mandatory.");	
+			validated = false; 
+		}
+	}
+	else if(doc.enquiry_from == 'Customer'){
+			if(!doc.customer){
+			alert("Customer is mandatory.");
+			validated = false;
+		}
+		else if(!doc.contact_person){
+			alert("Contact Person is mandatory.");
+			validated = false;
+		}
+		else if(!doc.customer_group){
+			alert("Customer Group is mandatory.");
+			validated = false;
+		}
+	} 
+}
+*/
+
+//===================validation function ==============================================================================
+
+cur_frm.cscript.validate = function(doc,cdt,cdn){
+	//cur_frm.cscript.enq_frm_validate(doc,cdt,cdn);
+}
diff --git a/erpnext/selling/doctype/opportunity/opportunity.py b/erpnext/selling/doctype/opportunity/opportunity.py
new file mode 100644
index 0000000..67881a6
--- /dev/null
+++ b/erpnext/selling/doctype/opportunity/opportunity.py
@@ -0,0 +1,339 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.	If not, see <http://www.gnu.org/licenses/>.
+
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+from utilities.transaction_base import TransactionBase
+
+class DocType(TransactionBase):
+	def __init__(self,doc,doclist=[]):
+		self.doc = doc
+		self.doclist = doclist
+		self.fname = 'enq_details'
+		self.tname = 'Opportunity Item'
+
+	# Autoname
+	# ====================================================================================================================
+	def autoname(self):
+		self.doc.name = make_autoname(self.doc.naming_series+'.####')
+
+	#--------Get customer address-------
+	# ====================================================================================================================
+	def get_cust_address(self,name):
+		details = sql("select customer_name, address, territory, customer_group from `tabCustomer` where name = '%s' and docstatus != 2" %(name), as_dict = 1)
+		if details:
+			ret = {
+				'customer_name':	details and details[0]['customer_name'] or '',
+				'address'	:	details and details[0]['address'] or '',
+				'territory'			 :	details and details[0]['territory'] or '',
+				'customer_group'		:	details and details[0]['customer_group'] or ''
+			}
+			# ********** get primary contact details (this is done separately coz. , in case there is no primary contact thn it would not be able to fetch customer details in case of join query)
+
+			contact_det = sql("select contact_name, contact_no, email_id from `tabContact` where customer = '%s' and is_customer = 1 and is_primary_contact = 'Yes' and docstatus != 2" %(name), as_dict = 1)
+
+			
+			ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
+			ret['contact_no']		 = contact_det and contact_det[0]['contact_no'] or ''
+			ret['email_id']			 = contact_det and contact_det[0]['email_id'] or ''
+		
+			return ret
+		else:
+			msgprint("Customer : %s does not exist in system." % (name))
+			raise Exception
+		
+
+	# ====================================================================================================================		
+	def get_contact_details(self, arg):
+		arg = eval(arg)
+		contact = sql("select contact_no, email_id from `tabContact` where contact_name = '%s' and customer_name = '%s'" %(arg['contact_person'],arg['customer']), as_dict = 1)
+		ret = {
+			'contact_no' : contact and contact[0]['contact_no'] or '',
+			'email_id' : contact and contact[0]['email_id'] or ''
+		}
+		return ret
+		
+	# ====================================================================================================================
+	def on_update(self):
+		# Add to calendar
+		#if self.doc.contact_date and self.doc.last_contact_date != self.doc.contact_date:
+		if self.doc.contact_date and self.doc.contact_date_ref != self.doc.contact_date:
+			if self.doc.contact_by:
+				self.add_calendar_event()
+			set(self.doc, 'contact_date_ref',self.doc.contact_date)
+		set(self.doc, 'status', 'Draft')
+	
+	# Add to Calendar
+	# ====================================================================================================================
+	def add_calendar_event(self):
+		desc=''
+		user_lst =[]
+		if self.doc.customer:
+			if self.doc.contact_person:
+				desc = 'Contact '+cstr(self.doc.contact_person)
+			else:
+				desc = 'Contact customer '+cstr(self.doc.customer)
+		elif self.doc.lead:
+			if self.doc.lead_name:
+				desc = 'Contact '+cstr(self.doc.lead_name)
+			else:
+				desc = 'Contact lead '+cstr(self.doc.lead)
+		desc = desc+ '. By : ' + cstr(self.doc.contact_by)
+		
+		if self.doc.to_discuss:
+			desc = desc+' To Discuss : ' + cstr(self.doc.to_discuss)
+		
+		ev = Document('Event')
+		ev.description = desc
+		ev.event_date = self.doc.contact_date
+		ev.event_hour = '10:00'
+		ev.event_type = 'Private'
+		ev.ref_type = 'Opportunity'
+		ev.ref_name = self.doc.name
+		ev.save(1)
+		
+		user_lst.append(self.doc.owner)
+		
+		chk = sql("select t1.name from `tabProfile` t1, `tabSales Person` t2 where t2.email_id = t1.name and t2.name=%s",self.doc.contact_by)
+		if chk:
+			user_lst.append(chk[0][0])
+		
+		for d in user_lst:
+			ch = addchild(ev, 'event_individuals', 'Event User', 0)
+			ch.person = d
+			ch.save(1)
+
+	#--------------Validation For Last Contact Date-----------------
+	# ====================================================================================================================
+	def set_last_contact_date(self):
+		if self.doc.contact_date_ref and self.doc.contact_date_ref != self.doc.contact_date:
+			if getdate(self.doc.contact_date_ref) < getdate(self.doc.contact_date):
+				self.doc.last_contact_date=self.doc.contact_date_ref
+			else:
+				msgprint("Contact Date Cannot be before Last Contact Date")
+				raise Exception
+	
+	# check if item present in item table
+	# ====================================================================================================================
+	def validate_item_details(self):
+		if not getlist(self.doclist, 'enquiry_details'):
+			msgprint("Please select items for which enquiry needs to be made")
+			raise Exception
+	
+	#check if enquiry date in the range of fiscal year selected
+	#=====================================================
+	def validate_fiscal_year(self):
+		fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
+		ysd=fy and fy[0][0] or ""
+		yed=add_days(str(ysd),365)
+		if str(self.doc.transaction_date) < str(ysd) or str(self.doc.transaction_date) > str(yed):
+			msgprint("Opportunity Date is not within the Fiscal Year selected")
+			raise Exception		
+
+	def validate_lead_cust(self):
+		if self.doc.enquiry_from == 'Lead' and not self.doc.lead:
+			msgprint("Lead Id is mandatory if 'Opportunity From' is selected as Lead", raise_exception=1)
+		elif self.doc.enquiry_from == 'Customer' and not self.doc.customer:
+			msgprint("Customer is mandatory if 'Opportunity From' is selected as Customer", raise_exception=1)
+
+	
+	def validate(self):
+		self.validate_fiscal_year()
+		self.set_last_contact_date()
+		self.validate_item_details()
+		self.validate_lead_cust()
+		
+	# On Submit Functions
+	# ====================================================================================================================
+	def on_submit(self):
+		set(self.doc, 'status', 'Submitted')
+		
+	# ====================================================================================================================	
+	def on_cancel(self):
+		chk = sql("select t1.name from `tabQuotation` t1, `tabQuotation Item` t2 where t2.parent = t1.name and t1.docstatus=1 and (t1.status!='Order Lost' and t1.status!='Cancelled') and t2.prevdoc_docname = %s",self.doc.name)
+		if chk:
+			msgprint("Quotation No. "+cstr(chk[0][0])+" is submitted against this Opportunity. Thus can not be cancelled.")
+			raise Exception
+		else:
+			set(self.doc, 'status', 'Cancelled')
+		
+	# declare as enquiry lost
+	#---------------------------
+	def declare_enquiry_lost(self,arg):
+		chk = sql("select t1.name from `tabQuotation` t1, `tabQuotation Item` t2 where t2.parent = t1.name and t1.docstatus=1 and (t1.status!='Order Lost' and t1.status!='Cancelled') and t2.prevdoc_docname = %s",self.doc.name)
+		if chk:
+			msgprint("Quotation No. "+cstr(chk[0][0])+" is submitted against this Opportunity. Thus 'Opportunity Lost' can not be declared against it.")
+			raise Exception
+		else:
+			set(self.doc, 'status', 'Opportunity Lost')
+			set(self.doc, 'order_lost_reason', arg)
+			return 'true'
+		
+		
+	# On Send Email
+	# ====================================================================================================================
+	#def send_emails(self,email,sender,subject,message):
+	#	if email:
+	#		sendmail(email,sender,subject=subject or 'Opportunity',parts=[['text/plain',message or self.get_enq_summary()]])
+
+	# Prepare HTML Table and Enter Opportunity Items in it, which will be added in enq summary
+	# ====================================================================================================================
+	def quote_table(self):
+		if getlist(self.doclist,'enq_details'):
+			header_lbl = ['Item Code','Item Name','Description','Reqd Qty','UOM']
+			item_tbl = '''<table style="width:90%%; border:1px solid #AAA; border-collapse:collapse"><tr>'''
+			for i in header_lbl:
+				item_header = '''<td style="width=20%%; border:1px solid #AAA; border-collapse:collapse;"><b>%s</b></td>''' % i
+				item_tbl += item_header
+			item_tbl += '''</tr>'''
+			
+			for d in getlist(self.doclist,'enq_details'):
+				item_det = '''
+					<tr><td style="width:20%%; border:1px solid #AAA; border-collpase:collapse">%s</td>
+					<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td>
+					<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td>
+					<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td>
+					<td style="width:20%%; border:1px solid #AAA; border-collapse:collpase">%s</td></tr>
+				''' % (d.item_code,d.item_name,d.description,d.reqd_qty,d.uom)
+				item_tbl += item_det
+			item_tbl += '''</table>'''
+			return item_tbl
+			
+	# Prepare HTML Page containing summary of Opportunity, which will be sent as message in E-mail
+	# ====================================================================================================================
+	def get_enq_summary(self):
+
+		t = """
+				<html><head></head>
+				<body>
+					<div style="border:1px solid #AAA; padding:20px; width:100%%">
+						<div style="text-align:center;font-size:14px"><b>Request For Quotation</b><br></div>
+						<div style="text-align:center;font-size:12px"> %(from_company)s</div>
+						<div style="text-align:center; font-size:10px"> %(company_address)s</div>
+						<div style="border-bottom:1px solid #AAA; padding:10px"></div> 
+						
+						<div style="padding-top:10px"><b>Quotation Items</b></div>
+						<div><table style="width:100%%">
+						<tr><td style="width:40%%">Opportunity No:</td> <td style="width:60%%"> %(name)s</td></tr>
+						<tr><td style="width:40%%">Opening Date:</td> <td style="width:60%%"> %(transaction_date)s</td></tr>
+						<tr><td style="width:40%%">Expected By Date:</td> <td style="width:60%%"> %(expected_date)s</td></tr>
+						</table>
+						</div>
+						
+						<div style="padding-top:10px"><b>Terms and Conditions</b></div>
+						<div> %(terms_and_conditions)s</div>
+						
+						<div style="padding-top:10px"><b>Contact Details</b></div>
+						<div><table style="width:100%%">
+						<tr><td style="width=40%%">Contact Person:</td><td style="width:60%%"> %(contact_person)s</td></tr>
+						<tr><td style="width=40%%">Contact No:</td><td style="width:60%%"> %(contact_no)s</td></tr>
+						<tr><td style="width=40%%">Email:</td><td style="width:60%%"> %(email)s</td></tr>
+						</table></div>
+						""" % (self.doc.fields)
+		
+		t += """<br><div><b>Quotation Items</b><br></div><div style="width:100%%">%s</div>
+						<br>
+To login into the system, use link : <div><a href='http://67.205.111.118/v160/login.html' target='_blank'>http://67.205.111.118/v160/login.html</a></div><br><br>
+						</div>
+					</body>
+					</html>
+					""" % (self.quote_table())
+		return t
+			
+	#-----------------Email-------------------------------------------- 
+	# ====================================================================================================================
+	def send_emails(self, email=[], subject='', message=''):
+		if email:
+			sender_email= sql("Select email from `tabProfile` where name='%s'"%session['user'])
+			if sender_email and sender_email[0][0]:
+				attach_list=[]
+				for at in getlist(self.doclist,'enquiry_attachment_detail'):
+					if at.select_file:
+						attach_list.append(at.select_file)
+				cc_list=[]
+				if self.doc.cc_to:
+					for cl in (self.doc.cc_to.split(',')):
+						if not validate_email_add(cl.strip(' ')):
+							msgprint('error:%s is not a valid email id' % cl.strip(' '))
+							raise Exception
+						cc_list.append(cl.strip(' ')) 
+						sendmail(cc_list, sender=sender_email[0][0], subject=subject, parts=[['text/html', message]], attach=attach_list)					 
+				sendmail(email, sender=sender_email[0][0], subject=subject, parts=[['text/html', message]], cc=cc_list, attach=attach_list)
+				#sendmail(cc_list, sender = sender_email[0][0], subject = subject , parts = [['text/html', message]],attach=attach_list)
+				msgprint("Mail has been sent")
+				self.add_in_follow_up(message,'Email')
+			else:
+				msgprint("Please enter your mail id in Profile")
+				raise Exception
+	
+	#-------------------------Checking Sent Mails Details----------------------------------------------
+	# ====================================================================================================================
+	def sent_mail(self):
+		if not self.doc.subject or not self.doc.message:
+			msgprint("Please enter subject & message in their respective fields.")
+		elif not self.doc.email_id1:
+			msgprint("Recipient not specified. Please add email id in 'Send To'.")
+			raise Exception
+		else :
+			if not validate_email_add(self.doc.email_id1.strip(' ')):
+				msgprint('error:%s is not a valid email id' % self.doc.email_id1)
+			else:
+				self.send_emails([self.doc.email_id1.strip(' ')], subject = self.doc.subject ,message = self.doc.message)
+
+	#---------------------- Add details in follow up table----------------
+	# ====================================================================================================================
+	def add_in_follow_up(self,message,type):
+		import datetime
+		child = addchild( self.doc, 'follow_up', 'Communication Log', 1, self.doclist)
+		child.date = datetime.datetime.now().date().strftime('%Y-%m-%d')
+		child.notes = message
+		child.follow_up_type = type
+		child.save()
+
+	#-------------------SMS----------------------------------------------
+	# ====================================================================================================================
+	def send_sms(self):
+		if not self.doc.sms_message:
+			msgprint("Please enter message in SMS Section ")
+			raise Exception
+		elif not getlist(self.doclist, 'enquiry_sms_detail'):
+			msgprint("Please mention mobile no. to which sms needs to be sent")
+			raise Exception
+		else:
+			receiver_list = []
+			for d in getlist(self.doclist,'enquiry_sms_detail'):
+				if d.other_mobile_no:
+					receiver_list.append(d.other_mobile_no)
+		
+		if receiver_list:
+			msgprint(get_obj('SMS Control', 'SMS Control').send_sms(receiver_list, self.doc.sms_message))
+			self.add_in_follow_up(self.doc.sms_message,'SMS')
diff --git a/erpnext/selling/doctype/opportunity/opportunity.txt b/erpnext/selling/doctype/opportunity/opportunity.txt
new file mode 100644
index 0000000..5886113
--- /dev/null
+++ b/erpnext/selling/doctype/opportunity/opportunity.txt
@@ -0,0 +1,624 @@
+# DocType, Opportunity
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:08',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:45:47',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': u'1324284087',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'document_type': u'Transaction',
+		'is_submittable': 1,
+		'module': u'Selling',
+		'name': '__common__',
+		'search_fields': u'status,transaction_date,customer,lead,enquiry_type,territory,company',
+		'section_style': u'Tabbed',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'subject': u'To %(customer_name)s%(lead_name)s on %(transaction_date)s',
+		'version': 588
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Opportunity',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Opportunity',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1
+	},
+
+	# DocType, Opportunity
+	{
+		'doctype': 'DocType',
+		'name': u'Opportunity'
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'System Manager',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'System Manager'
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales User',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales Manager',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Enter customer enquiry for which you might raise a quotation in future',
+		'doctype': u'DocField',
+		'fieldname': u'basic_info',
+		'fieldtype': u'Section Break',
+		'label': u'Basic Info',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'To manage multiple series please go to Setup > Manage Series',
+		'doctype': u'DocField',
+		'fieldname': u'naming_series',
+		'fieldtype': u'Select',
+		'label': u'Series',
+		'no_copy': 1,
+		'oldfieldname': u'naming_series',
+		'oldfieldtype': u'Select',
+		'options': u'ENQUIRY\nENQ',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'enquiry_from',
+		'fieldtype': u'Select',
+		'label': u'Opportunity From',
+		'oldfieldname': u'enquiry_from',
+		'oldfieldtype': u'Select',
+		'options': u'\nLead\nCustomer',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'customer',
+		'fieldtype': u'Link',
+		'hidden': 0,
+		'in_filter': 1,
+		'label': u'Customer',
+		'oldfieldname': u'customer',
+		'oldfieldtype': u'Link',
+		'options': u'Customer',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 0,
+		'search_index': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'customer_address',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Customer Address',
+		'options': u'Address',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'contact_person',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Contact Person',
+		'options': u'Contact',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'customer_name',
+		'fieldtype': u'Data',
+		'label': u'Customer Name',
+		'permlevel': 1,
+		'print_hide': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'lead',
+		'fieldtype': u'Link',
+		'hidden': 0,
+		'in_filter': 1,
+		'label': u'Lead',
+		'oldfieldname': u'lead',
+		'oldfieldtype': u'Link',
+		'options': u'Lead',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'lead_name',
+		'fieldtype': u'Data',
+		'hidden': 0,
+		'label': u'Name',
+		'oldfieldname': u'lead_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'address_display',
+		'fieldtype': u'Small Text',
+		'hidden': 0,
+		'label': u'Address',
+		'oldfieldname': u'address',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'contact_display',
+		'fieldtype': u'Small Text',
+		'label': u'Contact',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'contact_mobile',
+		'fieldtype': u'Text',
+		'label': u'Contact Mobile No',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'contact_email',
+		'fieldtype': u'Text',
+		'label': u'Contact Email',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'default': u'Today',
+		'description': u'The date at which current entry is made in system.',
+		'doctype': u'DocField',
+		'fieldname': u'transaction_date',
+		'fieldtype': u'Date',
+		'label': u'Opportunity Date',
+		'oldfieldname': u'transaction_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'reqd': 1,
+		'width': u'50px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'enquiry_type',
+		'fieldtype': u'Select',
+		'label': u'Opportunity Type',
+		'oldfieldname': u'enquiry_type',
+		'oldfieldtype': u'Select',
+		'options': u'\nSales\nMaintenance',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'Draft',
+		'doctype': u'DocField',
+		'fieldname': u'status',
+		'fieldtype': u'Select',
+		'label': u'Status',
+		'no_copy': 1,
+		'oldfieldname': u'status',
+		'oldfieldtype': u'Select',
+		'options': u'\nDraft\nSubmitted\nQuotation Sent\nOrder Confirmed\nOpportunity Lost\nCancelled',
+		'permlevel': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Data',
+		'label': u'Amended From',
+		'no_copy': 1,
+		'oldfieldname': u'amended_from',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
+		'label': u'Amendment Date',
+		'no_copy': 1,
+		'oldfieldname': u'amendment_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'<a href="javascript:cur_frm.cscript.TerritoryHelp();">To Manage Territory, click here</a>',
+		'doctype': u'DocField',
+		'fieldname': u'territory',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Territory',
+		'options': u'Territory',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'depends_on': u'eval:doc.enquiry_from=="Customer"',
+		'description': u'<a href="javascript:cur_frm.cscript.CGHelp();">To Manage Customer Groups, click here</a>',
+		'doctype': u'DocField',
+		'fieldname': u'customer_group',
+		'fieldtype': u'Link',
+		'hidden': 0,
+		'in_filter': 1,
+		'label': u'Customer Group',
+		'oldfieldname': u'customer_group',
+		'oldfieldtype': u'Link',
+		'options': u'Customer Group',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 0,
+		'search_index': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'items',
+		'fieldtype': u'Section Break',
+		'label': u'Items',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u"Items which do not exist in Item master can also be entered on customer's request",
+		'doctype': u'DocField',
+		'fieldname': u'enquiry_details',
+		'fieldtype': u'Table',
+		'label': u'Opportunity Items',
+		'oldfieldname': u'enquiry_details',
+		'oldfieldtype': u'Table',
+		'options': u'Opportunity Item',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Filing in Additional Information about the Opportunity will help you analyze your data better.',
+		'doctype': u'DocField',
+		'fieldname': u'more_info',
+		'fieldtype': u'Section Break',
+		'label': u'More Info',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Company',
+		'oldfieldname': u'company',
+		'oldfieldtype': u'Link',
+		'options': u'Company',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
+		'in_filter': 1,
+		'label': u'Fiscal Year',
+		'oldfieldname': u'fiscal_year',
+		'oldfieldtype': u'Select',
+		'options': u'link:Fiscal Year',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'source',
+		'fieldtype': u'Select',
+		'label': u'Source',
+		'oldfieldname': u'source',
+		'oldfieldtype': u'Select',
+		'options': u"\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign\nWalk In",
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Enter name of campaign if source of enquiry is campaign',
+		'doctype': u'DocField',
+		'fieldname': u'campaign',
+		'fieldtype': u'Link',
+		'label': u'Campaign',
+		'oldfieldname': u'campaign',
+		'oldfieldtype': u'Link',
+		'options': u'Campaign',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'order_lost_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Quotation Lost Reason',
+		'no_copy': 1,
+		'oldfieldname': u'order_lost_reason',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 1,
+		'report_hide': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break2',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Your sales person who will contact the customer in future',
+		'doctype': u'DocField',
+		'fieldname': u'contact_by',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Next Contact By',
+		'oldfieldname': u'contact_by',
+		'oldfieldtype': u'Link',
+		'options': u'Profile',
+		'permlevel': 0,
+		'width': u'75px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Your sales person will get a reminder on this date to contact the customer',
+		'doctype': u'DocField',
+		'fieldname': u'contact_date',
+		'fieldtype': u'Date',
+		'label': u'Next Contact Date',
+		'oldfieldname': u'contact_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 0,
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.__islocal',
+		'description': u'Date on which the lead was last contacted',
+		'doctype': u'DocField',
+		'fieldname': u'last_contact_date',
+		'fieldtype': u'Date',
+		'label': u'Last Contact Date',
+		'no_copy': 1,
+		'oldfieldname': u'last_contact_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'to_discuss',
+		'fieldtype': u'Small Text',
+		'label': u'To Discuss',
+		'no_copy': 1,
+		'oldfieldname': u'to_discuss',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Keep a track of communication related to this enquiry which will help for future reference.',
+		'doctype': u'DocField',
+		'fieldname': u'communication_history',
+		'fieldtype': u'Section Break',
+		'label': u'Communication History',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'follow_up',
+		'fieldtype': u'Table',
+		'label': u'Follow Up',
+		'oldfieldname': u'follow_up',
+		'oldfieldtype': u'Table',
+		'options': u'Communication Log',
+		'permlevel': 0
+	}
+]
diff --git a/erpnext/selling/doctype/enquiry/__init__.py b/erpnext/selling/doctype/opportunity_item/__init__.py
similarity index 100%
copy from erpnext/selling/doctype/enquiry/__init__.py
copy to erpnext/selling/doctype/opportunity_item/__init__.py
diff --git a/erpnext/selling/doctype/opportunity_item/opportunity_item.txt b/erpnext/selling/doctype/opportunity_item/opportunity_item.txt
new file mode 100644
index 0000000..f145263
--- /dev/null
+++ b/erpnext/selling/doctype/opportunity_item/opportunity_item.txt
@@ -0,0 +1,140 @@
+# DocType, Opportunity Item
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:08',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:08',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Selling',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 59
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Opportunity Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# DocType, Opportunity Item
+	{
+		'doctype': 'DocType',
+		'name': u'Opportunity Item'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'reqd': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_name',
+		'fieldtype': u'Data',
+		'label': u'Item Name',
+		'oldfieldname': u'item_name',
+		'oldfieldtype': u'Data',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Text',
+		'reqd': 1,
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_group',
+		'fieldtype': u'Link',
+		'hidden': 1,
+		'label': u'Item Group',
+		'oldfieldname': u'item_group',
+		'oldfieldtype': u'Link',
+		'options': u'Item Group',
+		'print_hide': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'brand',
+		'fieldtype': u'Link',
+		'hidden': 1,
+		'label': u'Brand',
+		'oldfieldname': u'brand',
+		'oldfieldtype': u'Link',
+		'options': u'Brand',
+		'print_hide': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'basic_rate',
+		'fieldtype': u'Currency',
+		'hidden': 1,
+		'label': u'Basic Rate',
+		'oldfieldname': u'basic_rate',
+		'oldfieldtype': u'Currency',
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'qty',
+		'fieldtype': u'Currency',
+		'label': u'Qty',
+		'oldfieldname': u'qty',
+		'oldfieldtype': u'Currency'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'uom',
+		'fieldtype': u'Link',
+		'label': u'UOM',
+		'oldfieldname': u'uom',
+		'oldfieldtype': u'Link',
+		'options': u'UOM',
+		'search_index': 0
+	}
+]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/plot_control/plot_control.py b/erpnext/selling/doctype/plot_control/plot_control.py
index 468f3c1..31ba67d 100644
--- a/erpnext/selling/doctype/plot_control/plot_control.py
+++ b/erpnext/selling/doctype/plot_control/plot_control.py
@@ -41,9 +41,9 @@
   def get_monthwise_amount(self,lst):
     lst = lst.split(',')
     if not lst[1]:
-      ret = convert_to_lists(sql("SELECT SUM(grand_total) AMOUNT,CASE MONTH(due_date) WHEN 1 THEN 'JAN' WHEN 2 THEN 'FEB' WHEN 3 THEN 'MAR' WHEN 4 THEN 'APR' WHEN 5 THEN 'MAY' WHEN 6 THEN 'JUN' WHEN 7 THEN 'JUL' WHEN 8 THEN 'AUG' WHEN 9 THEN 'SEP' WHEN 10 THEN 'OCT' WHEN 11 THEN 'NOV' WHEN 12 THEN 'DEC' END MONTHNAME FROM `tabReceivable Voucher` WHERE docstatus = 1 AND fiscal_year = '%s' GROUP BY MONTH(due_date) ORDER BY MONTH(due_date)"%lst[0]))
+      ret = convert_to_lists(sql("SELECT SUM(grand_total) AMOUNT,CASE MONTH(due_date) WHEN 1 THEN 'JAN' WHEN 2 THEN 'FEB' WHEN 3 THEN 'MAR' WHEN 4 THEN 'APR' WHEN 5 THEN 'MAY' WHEN 6 THEN 'JUN' WHEN 7 THEN 'JUL' WHEN 8 THEN 'AUG' WHEN 9 THEN 'SEP' WHEN 10 THEN 'OCT' WHEN 11 THEN 'NOV' WHEN 12 THEN 'DEC' END MONTHNAME FROM `tabSales Invoice` WHERE docstatus = 1 AND fiscal_year = '%s' GROUP BY MONTH(due_date) ORDER BY MONTH(due_date)"%lst[0]))
     else:
-      ret = convert_to_lists(sql("select sum(t2.amount) AMOUNT ,CASE MONTH(t1.due_date) WHEN 1 THEN 'JAN' WHEN 2 THEN 'FEB' WHEN 3 THEN 'MAR' WHEN 4 THEN 'APR' WHEN 5 THEN 'MAY' WHEN 6 THEN 'JUN' WHEN 7 THEN 'JUL' WHEN 8 THEN 'AUG' WHEN 9 THEN 'SEP' WHEN 10 THEN 'OCT' WHEN 11 THEN 'NOV' WHEN 12 THEN 'DEC' END MONTHNAME from `tabReceivable Voucher` t1,`tabRV Detail` t2 WHERE t1.name = t2.parent and t1.docstatus = 1 and t2.item_group = '%s' AND t1.fiscal_year = '%s' GROUP BY MONTH(t1.due_date) ORDER BY MONTH(t1.due_date)"%(lst[1],lst[0])))
+      ret = convert_to_lists(sql("select sum(t2.amount) AMOUNT ,CASE MONTH(t1.due_date) WHEN 1 THEN 'JAN' WHEN 2 THEN 'FEB' WHEN 3 THEN 'MAR' WHEN 4 THEN 'APR' WHEN 5 THEN 'MAY' WHEN 6 THEN 'JUN' WHEN 7 THEN 'JUL' WHEN 8 THEN 'AUG' WHEN 9 THEN 'SEP' WHEN 10 THEN 'OCT' WHEN 11 THEN 'NOV' WHEN 12 THEN 'DEC' END MONTHNAME from `tabSales Invoice` t1,`tabSales Invoice Item` t2 WHERE t1.name = t2.parent and t1.docstatus = 1 and t2.item_group = '%s' AND t1.fiscal_year = '%s' GROUP BY MONTH(t1.due_date) ORDER BY MONTH(t1.due_date)"%(lst[1],lst[0])))
     
     m =cint(sql("select month('%s')"%(get_defaults()['year_start_date']))[0][0])
 
@@ -68,13 +68,13 @@
     cases = self.get_week_cases(lst[0],lst[1])
           
     if not lst[2]:
-      query = "SELECT SUM(grand_total) AMOUNT,CASE WEEK(due_date)"+ cases +"END Weekly FROM `tabReceivable Voucher` WHERE MONTH(due_date) = %d AND docstatus = 1 AND fiscal_year = '%s' GROUP BY Weekly  ORDER BY Weekly"
+      query = "SELECT SUM(grand_total) AMOUNT,CASE WEEK(due_date)"+ cases +"END Weekly FROM `tabSales Invoice` WHERE MONTH(due_date) = %d AND docstatus = 1 AND fiscal_year = '%s' GROUP BY Weekly  ORDER BY Weekly"
       
       ret = convert_to_lists(sql(query%(cint(lst[0]),lst[1])))
     
     else:
           
-      query = "SELECT SUM(t2.amount) AMOUNT,CASE WEEK(t1.due_date)" + cases + "END Weekly FROM `tabReceivable Voucher` t1, `tabRV Detail` t2 WHERE MONTH(t1.due_date) = %d AND t1.docstatus = 1 AND t1.fiscal_year = '%s' AND t1.name = t2.parent AND t2.item_group ='%s' GROUP BY Weekly  ORDER BY Weekly"
+      query = "SELECT SUM(t2.amount) AMOUNT,CASE WEEK(t1.due_date)" + cases + "END Weekly FROM `tabSales Invoice` t1, `tabSales Invoice Item` t2 WHERE MONTH(t1.due_date) = %d AND t1.docstatus = 1 AND t1.fiscal_year = '%s' AND t1.name = t2.parent AND t2.item_group ='%s' GROUP BY Weekly  ORDER BY Weekly"
       
       ret =convert_to_lists(sql(query%(cint(lst[0]),lst[1],lst[2])))
  
@@ -113,12 +113,12 @@
       if(m1 == 13): m1 = 1 
     
     if not lst[1]:
-      query = "SELECT SUM(grand_total) AMOUNT,CASE WEEK(due_date)"+cases+"END Weekly, month(due_date) month FROM `tabReceivable Voucher` WHERE docstatus = 1 AND fiscal_year = '%s' GROUP BY `month`,weekly ORDER BY `month`,weekly"
+      query = "SELECT SUM(grand_total) AMOUNT,CASE WEEK(due_date)"+cases+"END Weekly, month(due_date) month FROM `tabSales Invoice` WHERE docstatus = 1 AND fiscal_year = '%s' GROUP BY `month`,weekly ORDER BY `month`,weekly"
       ret = convert_to_lists(sql(query%lst[0]))
     
     else:
     
-      query = "SELECT SUM(t2.amount) AMOUNT,CASE WEEK(t1.due_date)" + cases + "END Weekly, month(due_date) month FROM `tabReceivable Voucher` t1, `tabRV Detail` t2 WHERE t1.docstatus = 1 AND t1.fiscal_year = '%s' AND t1.name = t2.parent AND t2.item_group ='%s' GROUP BY Weekly  ORDER BY Weekly"
+      query = "SELECT SUM(t2.amount) AMOUNT,CASE WEEK(t1.due_date)" + cases + "END Weekly, month(due_date) month FROM `tabSales Invoice` t1, `tabSales Invoice Item` t2 WHERE t1.docstatus = 1 AND t1.fiscal_year = '%s' AND t1.name = t2.parent AND t2.item_group ='%s' GROUP BY Weekly  ORDER BY Weekly"
       ret = convert_to_lists(sql(query%(lst[0],lst[1])))
       
     
diff --git a/erpnext/selling/doctype/plot_control/plot_control.txt b/erpnext/selling/doctype/plot_control/plot_control.txt
index c6564d7..00af5f1 100644
--- a/erpnext/selling/doctype/plot_control/plot_control.txt
+++ b/erpnext/selling/doctype/plot_control/plot_control.txt
@@ -3,28 +3,28 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:12',
+		'creation': '2012-03-27 14:36:12',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'harshada@webnotestech.com'
+		'modified': '2012-03-27 14:36:12',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'issingle': 1,
-		'module': 'Selling',
+		'module': u'Selling',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 215
 	},
 
 	# DocType, Plot Control
 	{
 		'doctype': 'DocType',
-		'name': 'Plot Control'
+		'name': u'Plot Control'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/quotation/listview.js b/erpnext/selling/doctype/quotation/listview.js
new file mode 100644
index 0000000..1489df3
--- /dev/null
+++ b/erpnext/selling/doctype/quotation/listview.js
@@ -0,0 +1,40 @@
+// render
+wn.doclistviews['Quotation'] = wn.views.ListView.extend({
+	init: function(d) {
+		this._super(d)
+		this.fields = this.fields.concat([
+			"`tabQuotation`.quotation_to",
+			"`tabQuotation`.lead_name",
+			"`tabQuotation`.customer_name",
+			"`tabQuotation`.currency", 
+			"ifnull(`tabQuotation`.grand_total_export,0) as grand_total_export"
+		]);
+		this.stats = this.stats.concat(['status', 'quotation_to', 'company']);
+	},
+	
+	prepare_data: function(data) {
+		this._super(data);
+		if(data.quotation_to == 'Lead') {
+			data.quotation_name = repl('[%(quotation_to)s] %(lead_name)s', data);
+		} else {
+			data.quotation_name = repl('[%(quotation_to)s] %(customer_name)s', data);
+		}		
+	},
+	
+	columns: [
+		{width: '5%', content:'avatar'},
+		{width: '3%', content:'docstatus'},
+		{width: '15%', content:'name'},
+		{width: '47%', content:'tags+quotation_name', css: {color:'#aaa'}},
+		{
+			width: '18%', 
+			content: function(parent, data) { 
+				$(parent).html(data.currency + ' ' + fmt_money(data.grand_total_export)) 
+			},
+			css: {'text-align':'right'}
+		},
+		{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
+	]
+
+});
+
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index 910f54e..4be1f9a 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -15,15 +15,16 @@
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 // Module CRM
-cur_frm.cscript.tname = "Quotation Detail";
+cur_frm.cscript.tname = "Quotation Item";
 cur_frm.cscript.fname = "quotation_details";
 cur_frm.cscript.other_fname = "other_charges";
 cur_frm.cscript.sales_team_fname = "sales_team";
 
 // =====================================================================================
-$import(Sales Common)
-$import(Other Charges)
-$import(SMS Control)
+wn.require('erpnext/selling/doctype/sales_common/sales_common.js');
+wn.require('erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js');
+wn.require('erpnext/utilities/doctype/sms_control/sms_control.js');
+wn.require('erpnext/setup/doctype/notification_control/notification_control.js');
 
 // ONLOAD
 // ===================================================================================
@@ -87,27 +88,32 @@
 	if(doc.docstatus == 1 && doc.status!='Order Lost') {
 		cur_frm.add_custom_button('Make Sales Order', cur_frm.cscript['Make Sales Order']);
 		cur_frm.add_custom_button('Set as Lost', cur_frm.cscript['Declare Order Lost']);
-		cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
+		cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
 	}
-
-	if (!doc.docstatus) hide_field(['Update Follow up']);
-	else unhide_field(['Update Follow up']);
 }
 
 
 //customer
 cur_frm.cscript.customer = function(doc,dt,dn) {
 	var callback = function(r,rt) {
-			var doc = locals[cur_frm.doctype][cur_frm.docname];
-			cur_frm.refresh();
+		var doc = locals[cur_frm.doctype][cur_frm.docname];
+		cur_frm.refresh();		
+		cur_frm.cscript.price_list_name(doc, dt, dn); 
 	}
 
-	if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
-	if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+	if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 
+		'get_default_customer_address', '', callback);
+	if(doc.customer) unhide_field(['customer_address','contact_person','customer_name',
+		'address_display','contact_display','contact_mobile','contact_email','territory',
+		'customer_group']);
 }
 
 cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
-	if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
+	if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({
+		customer: doc.customer, 
+		address: doc.customer_address, 
+		contact: doc.contact_person
+	}),'', doc, dt, dn, 1);
 }
 
 cur_frm.fields_dict.customer_address.on_new = function(dn) {
@@ -143,11 +149,11 @@
 cur_frm.fields_dict['enq_no'].get_query = function(doc,cdt,cdn){
 	var cond='';
 	var cond1='';
-	if(doc.order_type) cond = 'ifnull(`tabEnquiry`.enquiry_type, "") = "'+doc.order_type+'" AND';
-	if(doc.customer) cond1 = '`tabEnquiry`.customer = "'+doc.customer+'" AND';
-	else if(doc.lead) cond1 = '`tabEnquiry`.lead = "'+doc.lead+'" AND';
+	if(doc.order_type) cond = 'ifnull(`tabOpportunity`.enquiry_type, "") = "'+doc.order_type+'" AND';
+	if(doc.customer) cond1 = '`tabOpportunity`.customer = "'+doc.customer+'" AND';
+	else if(doc.lead) cond1 = '`tabOpportunity`.lead = "'+doc.lead+'" AND';
 
-	return repl('SELECT `tabEnquiry`.`name` FROM `tabEnquiry` WHERE `tabEnquiry`.`docstatus` = 1 AND `tabEnquiry`.status = "Submitted" AND %(cond)s %(cond1)s `tabEnquiry`.`name` LIKE "%s" ORDER BY `tabEnquiry`.`name` ASC LIMIT 50', {cond:cond, cond1:cond1});
+	return repl('SELECT `tabOpportunity`.`name` FROM `tabOpportunity` WHERE `tabOpportunity`.`docstatus` = 1 AND `tabOpportunity`.status = "Submitted" AND %(cond)s %(cond1)s `tabOpportunity`.`name` LIKE "%s" ORDER BY `tabOpportunity`.`name` ASC LIMIT 50', {cond:cond, cond1:cond1});
 }
 
 // Make Sales Order
@@ -162,7 +168,7 @@
 			'from_doctype':'Quotation',
 			'to_doctype':'Sales Order',
 			'from_docname':doc.name,
-			'from_to_list':"[['Quotation', 'Sales Order'], ['Quotation Detail', 'Sales Order Detail'],['RV Tax Detail','RV Tax Detail'], ['Sales Team', 'Sales Team'], ['TC Detail', 'TC Detail']]"
+			'from_to_list':"[['Quotation', 'Sales Order'], ['Quotation Item', 'Sales Order Item'],['Sales Taxes and Charges','Sales Taxes and Charges'], ['Sales Team', 'Sales Team'], ['TC Detail', 'TC Detail']]"
 		}, function(r,rt) {
 			loaddoc("Sales Order", n);
 		});
@@ -170,7 +176,7 @@
 }
 
 //pull enquiry details
-cur_frm.cscript['Pull Enquiry Detail'] = function(doc,cdt,cdn){
+cur_frm.cscript.pull_enquiry_detail = function(doc,cdt,cdn){
 
 	var callback = function(r,rt){
 		if(r.message){
@@ -190,18 +196,6 @@
 
 }
 
-//update follow up
-//=================================================================================
-cur_frm.cscript['Update Follow up'] = function(doc){
-
-	$c_obj(make_doclist(doc.doctype, doc.name),'update_followup_details','',function(r, rt){
-		refresh_field('follow_up');
-		doc.__unsaved = 0;
-		cur_frm.refresh_header();
-	});
-}
-
-
 // declare order lost
 //-------------------------
 cur_frm.cscript['Declare Order Lost'] = function(){
@@ -251,18 +245,6 @@
 	qtn_lost_dialog.show();
 }
 
-
-// GET REPORT
-// ========================================================================================
-cur_frm.cscript['Get Report'] = function(doc,cdt,cdn) {
-	var callback = function(report){
-	report.set_filter('Sales Order Detail', 'Quotation No.',doc.name)
-	report.dt.run();
- }
- loadreport('Sales Order Detail','Itemwise Sales Details', callback);
-}
-
-
 //===================== Quotation to validation - either customer or lead mandatory ====================
 cur_frm.cscript.quot_to_validate = function(doc,cdt,cdn){
 
@@ -284,7 +266,7 @@
 //===================validation function =================================
 
 cur_frm.cscript.validate = function(doc,cdt,cdn){
-	cur_frm.cscript['Re-Calculate Values'](doc, cdt, cdn);
+	cur_frm.cscript.recalculate_values(doc, cdt, cdn);
 	cur_frm.cscript.quot_to_validate(doc,cdt,cdn);
 }
 
@@ -301,27 +283,26 @@
 		(\
 			select q.item_code,q.quote_rate from\
 			(\
-				select q.transaction_date,qd.item_code,basic_rate as quote_rate from `tabQuotation Detail` qd, `tabQuotation` q where q.name=qd.parent and q.docstatus=1 and customer='%(cust)s'\
+				select q.transaction_date,qd.item_code,basic_rate as quote_rate from `tabQuotation Item` qd, `tabQuotation` q where q.name=qd.parent and q.docstatus=1 and customer='%(cust)s'\
 			)q,\
 			(\
-				select qd.item_code,max(transaction_date) as transaction_date from `tabQuotation Detail` qd, `tabQuotation` q where q.name=qd.parent and q.docstatus=1 and customer='%(cust)s' group by qd.item_code\
+				select qd.item_code,max(transaction_date) as transaction_date from `tabQuotation Item` qd, `tabQuotation` q where q.name=qd.parent and q.docstatus=1 and customer='%(cust)s' group by qd.item_code\
 			)m where q.item_code=m.item_code and q.transaction_date=m.transaction_date\
 		)q on i.item_code=q.item_code\
 		left join\
 		(\
 			select r.item_code,r.sales_rate from\
 			(\
-				select r.voucher_date,rd.item_code,basic_rate as sales_rate from `tabRV Detail` rd, `tabReceivable Voucher` r where r.name=rd.parent and r.docstatus=1 and customer='%(cust)s'\
+				select r.voucher_date,rd.item_code,basic_rate as sales_rate from `tabSales Invoice Item` rd, `tabSales Invoice` r where r.name=rd.parent and r.docstatus=1 and customer='%(cust)s'\
 			)r,\
 			(\
-				select rd.item_code,max(voucher_date) as voucher_date from `tabRV Detail` rd, `tabReceivable Voucher` r where r.name=rd.parent and r.docstatus=1 and customer='%(cust)s' group by rd.item_code\
+				select rd.item_code,max(voucher_date) as voucher_date from `tabSales Invoice Item` rd, `tabSales Invoice` r where r.name=rd.parent and r.docstatus=1 and customer='%(cust)s' group by rd.item_code\
 			)m where r.item_code=m.item_code and r.voucher_date=m.voucher_date\
 		)s on i.item_code=s.item_code ORDER BY item_code LIMIT 50",{cust:doc.customer, cond:cond});
 	else
 		return repl("SELECT name, item_name, description FROM tabItem WHERE `tabItem`.%(key)s LIKE '%s' %(cond)s ORDER BY tabItem.item_code DESC LIMIT 50", {cond:cond});
 }
 
-$import(Notification Control)
 cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
 	var args = {
 		type: 'Quotation',
diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py
index 27206b2..bfab696 100644
--- a/erpnext/selling/doctype/quotation/quotation.py
+++ b/erpnext/selling/doctype/quotation/quotation.py
@@ -38,7 +38,7 @@
 	def __init__(self, doc, doclist=[]):
 		self.doc = doc
 		self.doclist = doclist
-		self.tname = 'Quotation Detail'
+		self.tname = 'Quotation Item'
 		self.fname = 'quotation_details'
 		
 	# Autoname
@@ -50,11 +50,11 @@
 # DOCTYPE TRIGGER FUNCTIONS
 # ==============================================================================		
  
-	# Pull Enquiry Details
+	# Pull Opportunity Details
 	# --------------------
 	def pull_enq_details(self):
 		self.doc.clear_table(self.doclist, 'quotation_details')
-		get_obj('DocType Mapper', 'Enquiry-Quotation').dt_map('Enquiry', 'Quotation', self.doc.enq_no, self.doc, self.doclist, "[['Enquiry', 'Quotation'],['Enquiry Detail', 'Quotation Detail']]")
+		get_obj('DocType Mapper', 'Opportunity-Quotation').dt_map('Opportunity', 'Quotation', self.doc.enq_no, self.doc, self.doclist, "[['Opportunity', 'Quotation'],['Opportunity Item', 'Quotation Item']]")
 
 		self.get_adj_percent()
 
@@ -65,7 +65,7 @@
 	def get_contact_details(self):
 		return get_obj('Sales Common').get_contact_details(self,0)
 	
-	# Clear Quotation Details
+	# Clear Quotation Items
 	# -----------------------
 	def clear_quotation_details(self):
 		self.doc.clear_table(self.doclist, 'quotation_details')	
@@ -77,7 +77,8 @@
 	# Get Item Details
 	# -----------------
 	def get_item_details(self, args=None):
-		args = args and eval(args) or {}
+		import json
+		args = args and json.loads(args) or {}
 		if args.get('item_code'):
 			return get_obj('Sales Common').get_item_details(args, self)
 		else:
@@ -113,7 +114,7 @@
 	def load_default_taxes(self):
 		return get_obj('Sales Common').load_default_taxes(self)
 
-	# Pull details from other charges master (Get Other Charges)
+	# Pull details from other charges master (Get Sales Taxes and Charges Master)
 	# ----------------------------------------------------------
 	def get_other_charges(self):
 		return get_obj('Sales Common').get_other_charges(self)	
@@ -244,7 +245,7 @@
 		ev.event_date = self.doc.contact_date
 		ev.event_hour = '10:00'
 		ev.event_type = 'Private'
-		ev.ref_type = 'Enquiry'
+		ev.ref_type = 'Opportunity'
 		ev.ref_name = self.doc.name
 		ev.save(1)
 		
@@ -269,18 +270,18 @@
 		
 		if prevdoc:
 			if flag == 'submit': #on submit
-				sql("update `tabEnquiry` set status = 'Quotation Sent' where name = %s", prevdoc)
+				sql("update `tabOpportunity` set status = 'Quotation Sent' where name = %s", prevdoc)
 			elif flag == 'cancel': #on cancel
-				sql("update `tabEnquiry` set status = 'Open' where name = %s", prevdoc)
+				sql("update `tabOpportunity` set status = 'Open' where name = %s", prevdoc)
 			elif flag == 'order lost': #order lost
-				sql("update `tabEnquiry` set status = 'Enquiry Lost' where name=%s", prevdoc)
+				sql("update `tabOpportunity` set status = 'Opportunity Lost' where name=%s", prevdoc)
 			elif flag == 'order confirm': #order confirm
-				sql("update `tabEnquiry` set status='Order Confirmed' where name=%s", prevdoc)
+				sql("update `tabOpportunity` set status='Order Confirmed' where name=%s", prevdoc)
 	
 	# declare as order lost
 	#-------------------------
 	def declare_order_lost(self,arg):
-		chk = sql("select t1.name from `tabSales Order` t1, `tabSales Order Detail` t2 where t2.parent = t1.name and t1.docstatus=1 and t2.prevdoc_docname = %s",self.doc.name)
+		chk = sql("select t1.name from `tabSales Order` t1, `tabSales Order Item` t2 where t2.parent = t1.name and t1.docstatus=1 and t2.prevdoc_docname = %s",self.doc.name)
 		if chk:
 			msgprint("Sales Order No. "+cstr(chk[0][0])+" is submitted against this Quotation. Thus 'Order Lost' can not be declared against it.")
 			raise Exception
@@ -349,6 +350,6 @@
 		return print_lst
 	
 	def update_followup_details(self):
-		sql("delete from `tabFollow up` where parent = '%s'"%self.doc.name)
+		sql("delete from `tabCommunication Log` where parent = '%s'"%self.doc.name)
 		for d in getlist(self.doclist, 'follow_up'):
 			d.save()
diff --git a/erpnext/selling/doctype/quotation/quotation.txt b/erpnext/selling/doctype/quotation/quotation.txt
index 39a7327..2c9bd9f 100644
--- a/erpnext/selling/doctype/quotation/quotation.txt
+++ b/erpnext/selling/doctype/quotation/quotation.txt
@@ -3,22 +3,13 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:17',
+		'creation': '2012-03-27 14:36:12',
 		'docstatus': 0,
-		'modified': '2012-03-20 14:56:28',
+		'modified': '2012-03-27 18:48:29',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
 
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Quotation',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
 	# These values are common for all DocType
 	{
 		'_last_update': u'1332235370',
@@ -30,6 +21,7 @@
 		'doctype': 'DocType',
 		'document_type': u'Transaction',
 		'hide_toolbar': 0,
+		'is_submittable': 1,
 		'is_transaction_doc': 1,
 		'max_attachments': 1,
 		'module': u'Selling',
@@ -41,15 +33,15 @@
 		'show_in_menu': 0,
 		'subject': u'To %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s',
 		'tag_fields': u'status',
-		'version': 621
+		'version': 622
 	},
 
-	# These values are common for all DocFormat
+	# These values are common for all DocField
 	{
-		'doctype': u'DocFormat',
+		'doctype': u'DocField',
 		'name': '__common__',
 		'parent': u'Quotation',
-		'parentfield': u'formats',
+		'parentfield': u'fields',
 		'parenttype': u'DocType'
 	},
 
@@ -76,21 +68,21 @@
 		'create': 1,
 		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': u'Sales Manager',
+		'role': u'Sales User',
 		'submit': 1,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
 		'doctype': u'DocPerm',
-		'permlevel': 0,
+		'permlevel': 1,
 		'role': u'Sales User',
-		'submit': 1,
-		'write': 1
+		'submit': 0,
+		'write': 0
 	},
 
 	# DocPerm
@@ -103,6 +95,30 @@
 
 	# DocPerm
 	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales Manager',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
@@ -115,6 +131,13 @@
 
 	# DocPerm
 	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Maintenance Manager'
+	},
+
+	# DocPerm
+	{
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
@@ -129,31 +152,14 @@
 	{
 		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': u'All'
-	},
-
-	# DocFormat
-	{
-		'doctype': u'DocFormat',
-		'format': u'Quotation Classic'
-	},
-
-	# DocFormat
-	{
-		'doctype': u'DocFormat',
-		'format': u'Quotation Modern'
-	},
-
-	# DocFormat
-	{
-		'doctype': u'DocFormat',
-		'format': u'Quotation Spartan'
+		'role': u'Maintenance User'
 	},
 
 	# DocField
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'basic_info',
 		'fieldtype': u'Section Break',
 		'label': u'Basic Info',
 		'oldfieldtype': u'Section Break',
@@ -164,6 +170,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'width': u'50%'
@@ -357,6 +364,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'column_break1',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -488,6 +496,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'items',
 		'fieldtype': u'Section Break',
 		'label': u'Items',
 		'oldfieldtype': u'Section Break',
@@ -546,6 +555,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break2',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'width': u'50%'
@@ -592,17 +602,17 @@
 	# DocField
 	{
 		'colour': u'White:FFF',
-		'description': u"To create Quotation against Enquiry, Select Enquiry No. and click on 'Pull Enquiry Details' ",
+		'description': u"To create Quotation against Opportunity, Select Opportunity No. and click on 'Pull Opportunity Details' ",
 		'doctype': u'DocField',
 		'fieldname': u'enq_no',
 		'fieldtype': u'Link',
 		'hidden': 0,
 		'in_filter': 1,
-		'label': u'Enquiry No',
+		'label': u'Opportunity No',
 		'no_copy': 0,
 		'oldfieldname': u'enq_no',
 		'oldfieldtype': u'Link',
-		'options': u'Enquiry',
+		'options': u'Opportunity',
 		'permlevel': 0,
 		'print_hide': 0,
 		'report_hide': 0,
@@ -612,9 +622,10 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'pull_enquiry_detail',
 		'fieldtype': u'Button',
 		'hidden': 0,
-		'label': u'Pull Enquiry Detail',
+		'label': u'Pull Opportunity Detail',
 		'no_copy': 0,
 		'oldfieldtype': u'Button',
 		'permlevel': 0,
@@ -627,6 +638,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'section_break0',
 		'fieldtype': u'Section Break',
 		'options': u'Simple',
 		'permlevel': 0
@@ -639,10 +651,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'quotation_details',
 		'fieldtype': u'Table',
-		'label': u'Quotation Details',
+		'label': u'Quotation Items',
 		'oldfieldname': u'quotation_details',
 		'oldfieldtype': u'Table',
-		'options': u'Quotation Detail',
+		'options': u'Quotation Item',
 		'permlevel': 0,
 		'width': u'40px'
 	},
@@ -650,6 +662,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'clear_table',
 		'fieldtype': u'Button',
 		'label': u'Clear Table',
 		'oldfieldtype': u'Button',
@@ -661,6 +674,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'recalculate_values',
 		'fieldtype': u'Button',
 		'label': u'Re-Calculate Values',
 		'oldfieldtype': u'Button',
@@ -688,6 +702,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'taxes',
 		'fieldtype': u'Section Break',
 		'label': u'Taxes',
 		'oldfieldtype': u'Section Break',
@@ -700,10 +715,10 @@
 		'fieldname': u'charge',
 		'fieldtype': u'Link',
 		'hidden': 0,
-		'label': u'Select Charges Master',
+		'label': u'Sales Taxes and Charges',
 		'oldfieldname': u'charge',
 		'oldfieldtype': u'Link',
-		'options': u'Other Charges',
+		'options': u'Sales Taxes and Charges Master',
 		'permlevel': 0,
 		'print_hide': 1,
 		'trigger': u'Client'
@@ -712,9 +727,10 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'get_charges',
 		'fieldtype': u'Button',
 		'hidden': 0,
-		'label': u'Get Charges',
+		'label': u'Get Taxes and Charges',
 		'oldfieldtype': u'Button',
 		'permlevel': 0,
 		'print_hide': 1,
@@ -726,10 +742,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'other_charges',
 		'fieldtype': u'Table',
-		'label': u'Other Charges',
+		'label': u'Sales Taxes and Charges',
 		'oldfieldname': u'other_charges',
 		'oldfieldtype': u'Table',
-		'options': u'RV Tax Detail',
+		'options': u'Sales Taxes and Charges',
 		'permlevel': 0
 	},
 
@@ -737,8 +753,9 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'calculate_charges',
 		'fieldtype': u'Button',
-		'label': u'Calculate Charges',
+		'label': u'Calculate Taxes and Charges',
 		'oldfieldtype': u'Button',
 		'permlevel': 0,
 		'print_hide': 1,
@@ -750,7 +767,7 @@
 		'doctype': u'DocField',
 		'fieldname': u'other_charges_total',
 		'fieldtype': u'Currency',
-		'label': u'Charges Total*',
+		'label': u'Taxes and Charges Total*',
 		'oldfieldname': u'other_charges_total',
 		'oldfieldtype': u'Currency',
 		'permlevel': 1,
@@ -760,8 +777,9 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'other_charges_calculation',
 		'fieldtype': u'HTML',
-		'label': u'Other Charges Calculation',
+		'label': u'Taxes and Charges Calculation',
 		'oldfieldtype': u'HTML',
 		'permlevel': 0,
 		'print_hide': 1
@@ -771,6 +789,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'totals',
 		'fieldtype': u'Section Break',
 		'label': u'Totals',
 		'oldfieldtype': u'Section Break',
@@ -827,6 +846,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break3',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -882,10 +902,11 @@
 	# DocField
 	{
 		'colour': u'White:FFF',
-		'description': u'Add Terms and Conditions for the Quotation like Payment Terms, Validity of Offer etc. You can also prepare a master Term Sheet and use the Template',
+		'description': u'Add Terms and Conditions for the Quotation like Payment Terms, Validity of Offer etc. You can also prepare a Terms and Conditions Master and use the Template',
 		'doctype': u'DocField',
+		'fieldname': u'terms_section_break',
 		'fieldtype': u'Section Break',
-		'label': u'Terms',
+		'label': u'Terms and Conditions',
 		'oldfieldtype': u'Section Break',
 		'permlevel': 0,
 		'print_hide': 0
@@ -896,10 +917,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'tc_name',
 		'fieldtype': u'Link',
-		'label': u'Select Terms',
+		'label': u'Select Terms and Conditions',
 		'oldfieldname': u'tc_name',
 		'oldfieldtype': u'Link',
-		'options': u'Term',
+		'options': u'Terms and Conditions',
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 1
@@ -908,8 +929,9 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'get_terms',
 		'fieldtype': u'Button',
-		'label': u'Get Terms',
+		'label': u'Get Terms and Conditions',
 		'oldfieldtype': u'Button',
 		'options': u'get_tc_details',
 		'permlevel': 0
@@ -918,8 +940,9 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'terms_html',
 		'fieldtype': u'HTML',
-		'label': u'Terms HTML',
+		'label': u'Terms and Conditions HTML',
 		'oldfieldtype': u'HTML',
 		'options': u'You can add Terms and Notes that will be printed in the Transaction',
 		'permlevel': 0,
@@ -942,6 +965,7 @@
 		'colour': u'White:FFF',
 		'description': u'Filling in additional information about the Quotation will help you analyze your data better.',
 		'doctype': u'DocField',
+		'fieldname': u'more_info',
 		'fieldtype': u'Section Break',
 		'label': u'More Info',
 		'oldfieldtype': u'Section Break',
@@ -1007,7 +1031,7 @@
 		'fieldname': u'enq_det',
 		'fieldtype': u'Text',
 		'hidden': 1,
-		'label': u'Enquiry Detail',
+		'label': u'Opportunity Item',
 		'no_copy': 0,
 		'oldfieldname': u'enq_det',
 		'oldfieldtype': u'Text',
@@ -1071,7 +1095,7 @@
 		'doctype': u'DocField',
 		'fieldname': u'order_lost_reason',
 		'fieldtype': u'Small Text',
-		'label': u'Order Lost Reason',
+		'label': u'Quotation Lost Reason',
 		'no_copy': 1,
 		'oldfieldname': u'order_lost_reason',
 		'oldfieldtype': u'Small Text',
@@ -1082,6 +1106,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break4',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -1164,6 +1189,7 @@
 		'colour': u'White:FFF',
 		'description': u'Keep a track on communications regarding this Quotation. This will help you remember earlier communications in case the Customer comes back again',
 		'doctype': u'DocField',
+		'fieldname': u'communication_history',
 		'fieldtype': u'Section Break',
 		'label': u'Communication History',
 		'oldfieldtype': u'Section Break',
@@ -1178,10 +1204,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'follow_up',
 		'fieldtype': u'Table',
-		'label': u'Follow up',
+		'label': u'Communication Log',
 		'oldfieldname': u'follow_up',
 		'oldfieldtype': u'Table',
-		'options': u'Follow up',
+		'options': u'Communication Log',
 		'permlevel': 0,
 		'print_hide': 1,
 		'width': u'40px'
diff --git a/erpnext/selling/doctype/quotation_detail/quotation_detail.txt b/erpnext/selling/doctype/quotation_detail/quotation_detail.txt
deleted file mode 100644
index 1b55879..0000000
--- a/erpnext/selling/doctype/quotation_detail/quotation_detail.txt
+++ /dev/null
@@ -1,334 +0,0 @@
-# DocType, Quotation Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:18',
-		'docstatus': 0,
-		'modified': '2012-03-05 15:00:10',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': u'QUOD/.#####',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'is_transaction_doc': 0,
-		'istable': 1,
-		'module': u'Selling',
-		'name': '__common__',
-		'section_style': u'Tray',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 33
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Quotation Detail',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# DocType, Quotation Detail
-	{
-		'doctype': 'DocType',
-		'name': u'Quotation Detail'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_code',
-		'fieldtype': u'Link',
-		'hidden': 0,
-		'in_filter': 1,
-		'label': u'Item Code',
-		'oldfieldname': u'item_code',
-		'oldfieldtype': u'Link',
-		'options': u'Item',
-		'permlevel': 0,
-		'print_hide': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': u'Client',
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_name',
-		'fieldtype': u'Data',
-		'in_filter': 1,
-		'label': u'Item Name',
-		'oldfieldname': u'item_name',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'search_index': 1,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'description',
-		'fieldtype': u'Small Text',
-		'label': u'Description',
-		'oldfieldname': u'description',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 0,
-		'print_hide': 0,
-		'reqd': 1,
-		'width': u'300px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'qty',
-		'fieldtype': u'Currency',
-		'in_filter': 0,
-		'label': u'Quantity',
-		'oldfieldname': u'qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 0,
-		'reqd': 1,
-		'search_index': 0,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'ref_rate',
-		'fieldtype': u'Currency',
-		'label': u'Price List Rate',
-		'oldfieldname': u'ref_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 0,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'adj_rate',
-		'fieldtype': u'Float',
-		'label': u'Discount (%)',
-		'oldfieldname': u'adj_rate',
-		'oldfieldtype': u'Float',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'export_rate',
-		'fieldtype': u'Currency',
-		'in_filter': 0,
-		'label': u'Rate',
-		'oldfieldname': u'export_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 0,
-		'reqd': 0,
-		'search_index': 0,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'export_amount',
-		'fieldtype': u'Currency',
-		'in_filter': 0,
-		'label': u'Amount',
-		'oldfieldname': u'export_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 0,
-		'search_index': 0,
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'base_ref_rate',
-		'fieldtype': u'Currency',
-		'label': u'Price List Rate*',
-		'oldfieldname': u'base_ref_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'basic_rate',
-		'fieldtype': u'Currency',
-		'in_filter': 0,
-		'label': u'Basic Rate*',
-		'oldfieldname': u'basic_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 0,
-		'search_index': 0,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'amount',
-		'fieldtype': u'Currency',
-		'in_filter': 0,
-		'label': u'Amount*',
-		'oldfieldname': u'amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'reqd': 0,
-		'search_index': 0,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'stock_uom',
-		'fieldtype': u'Data',
-		'label': u'UOM',
-		'oldfieldname': u'stock_uom',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 0,
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_group',
-		'fieldtype': u'Link',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'Item Group',
-		'oldfieldname': u'item_group',
-		'oldfieldtype': u'Link',
-		'options': u'Item Group',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'brand',
-		'fieldtype': u'Link',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'Brand',
-		'oldfieldname': u'brand',
-		'oldfieldtype': u'Link',
-		'options': u'Brand',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_tax_rate',
-		'fieldtype': u'Small Text',
-		'hidden': 1,
-		'label': u'Item Tax Rate',
-		'oldfieldname': u'item_tax_rate',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 1,
-		'print_hide': 1,
-		'report_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_docname',
-		'fieldtype': u'Data',
-		'label': u'Against Docname',
-		'no_copy': 1,
-		'oldfieldname': u'prevdoc_docname',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'report_hide': 0,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_doctype',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'label': u'Against Doctype',
-		'no_copy': 1,
-		'oldfieldname': u'prevdoc_doctype',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'report_hide': 0,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'page_break',
-		'fieldtype': u'Check',
-		'hidden': 0,
-		'label': u'Page Break',
-		'no_copy': 1,
-		'oldfieldname': u'page_break',
-		'oldfieldtype': u'Check',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/quotation_detail/__init__.py b/erpnext/selling/doctype/quotation_item/__init__.py
similarity index 100%
rename from erpnext/selling/doctype/quotation_detail/__init__.py
rename to erpnext/selling/doctype/quotation_item/__init__.py
diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.txt b/erpnext/selling/doctype/quotation_item/quotation_item.txt
new file mode 100644
index 0000000..9cee3de
--- /dev/null
+++ b/erpnext/selling/doctype/quotation_item/quotation_item.txt
@@ -0,0 +1,334 @@
+# DocType, Quotation Item
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:13',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:13',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'QUOD/.#####',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'is_transaction_doc': 0,
+		'istable': 1,
+		'module': u'Selling',
+		'name': '__common__',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 33
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Quotation Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Quotation Item
+	{
+		'doctype': 'DocType',
+		'name': u'Quotation Item'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'hidden': 0,
+		'in_filter': 1,
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 0,
+		'print_hide': 0,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': u'Client',
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_name',
+		'fieldtype': u'Data',
+		'in_filter': 1,
+		'label': u'Item Name',
+		'oldfieldname': u'item_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'search_index': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Small Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0,
+		'print_hide': 0,
+		'reqd': 1,
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'qty',
+		'fieldtype': u'Currency',
+		'in_filter': 0,
+		'label': u'Quantity',
+		'oldfieldname': u'qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 0,
+		'reqd': 1,
+		'search_index': 0,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'ref_rate',
+		'fieldtype': u'Currency',
+		'label': u'Price List Rate',
+		'oldfieldname': u'ref_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 0,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'adj_rate',
+		'fieldtype': u'Float',
+		'label': u'Discount (%)',
+		'oldfieldname': u'adj_rate',
+		'oldfieldtype': u'Float',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'export_rate',
+		'fieldtype': u'Currency',
+		'in_filter': 0,
+		'label': u'Rate',
+		'oldfieldname': u'export_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 0,
+		'reqd': 0,
+		'search_index': 0,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'export_amount',
+		'fieldtype': u'Currency',
+		'in_filter': 0,
+		'label': u'Amount',
+		'oldfieldname': u'export_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 0,
+		'reqd': 0,
+		'search_index': 0,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'base_ref_rate',
+		'fieldtype': u'Currency',
+		'label': u'Price List Rate*',
+		'oldfieldname': u'base_ref_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'basic_rate',
+		'fieldtype': u'Currency',
+		'in_filter': 0,
+		'label': u'Basic Rate*',
+		'oldfieldname': u'basic_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 0,
+		'search_index': 0,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'amount',
+		'fieldtype': u'Currency',
+		'in_filter': 0,
+		'label': u'Amount*',
+		'oldfieldname': u'amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'reqd': 0,
+		'search_index': 0,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'stock_uom',
+		'fieldtype': u'Data',
+		'label': u'UOM',
+		'oldfieldname': u'stock_uom',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 0,
+		'reqd': 0,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_group',
+		'fieldtype': u'Link',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Item Group',
+		'oldfieldname': u'item_group',
+		'oldfieldtype': u'Link',
+		'options': u'Item Group',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'brand',
+		'fieldtype': u'Link',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Brand',
+		'oldfieldname': u'brand',
+		'oldfieldtype': u'Link',
+		'options': u'Brand',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_tax_rate',
+		'fieldtype': u'Small Text',
+		'hidden': 1,
+		'label': u'Item Tax Rate',
+		'oldfieldname': u'item_tax_rate',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_docname',
+		'fieldtype': u'Data',
+		'label': u'Against Docname',
+		'no_copy': 1,
+		'oldfieldname': u'prevdoc_docname',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 0,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_doctype',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Against Doctype',
+		'no_copy': 1,
+		'oldfieldname': u'prevdoc_doctype',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 0,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'doctype': u'DocField',
+		'fieldname': u'page_break',
+		'fieldtype': u'Check',
+		'hidden': 0,
+		'label': u'Page Break',
+		'no_copy': 1,
+		'oldfieldname': u'page_break',
+		'oldfieldtype': u'Check',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/return_detail/__init__.py b/erpnext/selling/doctype/return_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/selling/doctype/return_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/selling/doctype/return_detail/return_detail.txt b/erpnext/selling/doctype/return_detail/return_detail.txt
deleted file mode 100644
index 4c1e2f7..0000000
--- a/erpnext/selling/doctype/return_detail/return_detail.txt
+++ /dev/null
@@ -1,151 +0,0 @@
-# DocType, Return Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:19',
-		'docstatus': 0,
-		'modified': '2011-02-23 19:09:05',
-		'modified_by': 'Administrator',
-		'owner': 'wasim@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Selling',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 8
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Return Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# DocType, Return Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Return Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'item_code',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Item Code',
-		'oldfieldname': 'item_code',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
-		'permlevel': 1,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'uom',
-		'fieldtype': 'Link',
-		'idx': 3,
-		'label': 'UOM',
-		'oldfieldname': 'uom',
-		'oldfieldtype': 'Link',
-		'options': 'UOM',
-		'permlevel': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'rate',
-		'fieldtype': 'Currency',
-		'idx': 4,
-		'label': 'Rate',
-		'oldfieldname': 'rate',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'qty',
-		'fieldtype': 'Data',
-		'idx': 5,
-		'label': 'Qty',
-		'oldfieldname': 'qty',
-		'oldfieldtype': 'Data',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'returned_qty',
-		'fieldtype': 'Data',
-		'idx': 6,
-		'label': 'Returned Qty',
-		'oldfieldname': 'returned_qty',
-		'oldfieldtype': 'Data',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'serial_no',
-		'fieldtype': 'Small Text',
-		'idx': 7,
-		'label': 'Serial No',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'batch_no',
-		'fieldtype': 'Data',
-		'idx': 8,
-		'label': 'Batch No',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'detail_name',
-		'fieldtype': 'Data',
-		'hidden': 1,
-		'idx': 9,
-		'label': 'Detail Name',
-		'oldfieldname': 'detail_name',
-		'oldfieldtype': 'Data',
-		'permlevel': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_order_detail/__init__.py b/erpnext/selling/doctype/sales_and_purchase_return_item/__init__.py
similarity index 100%
copy from erpnext/selling/doctype/sales_order_detail/__init__.py
copy to erpnext/selling/doctype/sales_and_purchase_return_item/__init__.py
diff --git a/erpnext/selling/doctype/sales_and_purchase_return_item/sales_and_purchase_return_item.txt b/erpnext/selling/doctype/sales_and_purchase_return_item/sales_and_purchase_return_item.txt
new file mode 100644
index 0000000..e064714
--- /dev/null
+++ b/erpnext/selling/doctype/sales_and_purchase_return_item/sales_and_purchase_return_item.txt
@@ -0,0 +1,142 @@
+# DocType, Sales and Purchase Return Item
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:14',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:14',
+		'modified_by': u'Administrator',
+		'owner': u'wasim@webnotestech.com'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Selling',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 8
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Sales and Purchase Return Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Sales and Purchase Return Item
+	{
+		'doctype': 'DocType',
+		'name': u'Sales and Purchase Return Item'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Data',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'uom',
+		'fieldtype': u'Link',
+		'label': u'UOM',
+		'oldfieldname': u'uom',
+		'oldfieldtype': u'Link',
+		'options': u'UOM',
+		'permlevel': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'rate',
+		'fieldtype': u'Currency',
+		'label': u'Rate',
+		'oldfieldname': u'rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'qty',
+		'fieldtype': u'Data',
+		'label': u'Qty',
+		'oldfieldname': u'qty',
+		'oldfieldtype': u'Data',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'returned_qty',
+		'fieldtype': u'Data',
+		'label': u'Returned Qty',
+		'oldfieldname': u'returned_qty',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'serial_no',
+		'fieldtype': u'Small Text',
+		'label': u'Serial No',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'batch_no',
+		'fieldtype': u'Data',
+		'label': u'Batch No',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'detail_name',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Detail Name',
+		'oldfieldname': u'detail_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_common/sales_common.js b/erpnext/selling/doctype/sales_common/sales_common.js
index a4a6fe6..8a03341 100644
--- a/erpnext/selling/doctype/sales_common/sales_common.js
+++ b/erpnext/selling/doctype/sales_common/sales_common.js
@@ -18,14 +18,14 @@
 // ------
 // cur_frm.cscript.tname - Details table name
 // cur_frm.cscript.fname - Details fieldname
-// cur_frm.cscript.other_fname - Other Charges fieldname
+// cur_frm.cscript.other_fname - wn.require('erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js'); fieldname
 // cur_frm.cscript.sales_team_fname - Sales Team fieldname
 
 // ============== Load Default Taxes ===================
 cur_frm.cscript.load_taxes = function(doc, cdt, cdn, callback) {
 	// run if this is not executed from dt_map...
 	doc = locals[doc.doctype][doc.name];
-	if(doc.customer || getchildren('RV Tax Detail', doc.name, 'other_charges', doc.doctype).length) {
+	if(doc.customer || getchildren('Sales Taxes and Charges', doc.name, 'other_charges', doc.doctype).length) {
 		if(callback) {
 			callback(doc, cdt, cdn);
 		}
@@ -76,38 +76,20 @@
 }
 
 
-
-// ============== Customer and its primary contact Details ============================
-cur_frm.cscript.customer = function(doc, cdt, cdn) {
-	if(doc.customer){
-		if (!doc.company) {
-			msgprint("Please select company to proceed");
-			doc.customer = '';
-			refresh_field('customer');
-		} else {
-			var callback = function(r, rt){
-				cur_frm.refresh();
-			}
-			$c_obj(make_doclist(doc.doctype, doc.name), 'get_customer_details', '',callback);
-		}
-	}
-}
-
-
 var set_dynamic_label_par = function(doc, cdt, cdn, base_curr) {
 	//parent flds
-	par_cols_base = {'net_total': 'Net Total', 'other_charges_total': 'Other Charges Total', 
+	par_cols_base = {'net_total': 'Net Total', 'other_charges_total': 'Taxes and Charges Total', 
 		'grand_total':	'Grand Total', 'rounded_total': 'Rounded Total', 'in_words': 'In Words'}
 	par_cols_export = {'grand_total_export': 'Grand Total', 'rounded_total_export':	'Rounded Total', 'in_words_export':	'In Words'};
 
-	for (d in par_cols_base) cur_frm.fields_dict[d].label_area.innerHTML = par_cols_base[d]+' (' + base_curr + ')';
-	for (d in par_cols_export) cur_frm.fields_dict[d].label_area.innerHTML = par_cols_export[d]+' (' + doc.currency + ')';
-	cur_frm.fields_dict['conversion_rate'].label_area.innerHTML = "Conversion Rate (" + doc.currency +' -> '+ base_curr + ')';
-	cur_frm.fields_dict['plc_conversion_rate'].label_area.innerHTML = 'Price List Currency Conversion Rate (' + doc.price_list_currency +' -> '+ base_curr + ')';
+	for (d in par_cols_base) cur_frm.fields_dict[d].label_span.innerHTML = par_cols_base[d]+' (' + base_curr + ')';
+	for (d in par_cols_export) cur_frm.fields_dict[d].label_span.innerHTML = par_cols_export[d]+' (' + doc.currency + ')';
+	cur_frm.fields_dict['conversion_rate'].label_span.innerHTML = "Conversion Rate (" + doc.currency +' -> '+ base_curr + ')';
+	cur_frm.fields_dict['plc_conversion_rate'].label_span.innerHTML = 'Price List Currency Conversion Rate (' + doc.price_list_currency +' -> '+ base_curr + ')';
 
-	if (doc.doctype == 'Receivable Voucher') {
-		cur_frm.fields_dict['total_advance'].label_area.innerHTML = 'Total Advance (' + base_curr + ')';
-		cur_frm.fields_dict['outstanding_amount'].label_area.innerHTML = 'Outstanding Amount (' + base_curr + ')';
+	if (doc.doctype == 'Sales Invoice') {
+		cur_frm.fields_dict['total_advance'].label_span.innerHTML = 'Total Advance (' + base_curr + ')';
+		cur_frm.fields_dict['outstanding_amount'].label_span.innerHTML = 'Outstanding Amount (' + base_curr + ')';
 	}
 }
 
@@ -127,12 +109,12 @@
 
 	//tax table flds
 	tax_cols = {'tax_amount': 'Amount', 'total': 'Total'};
-	for (d in tax_cols) $('[data-grid-fieldname="RV Tax Detail-'+d+'"]').html(tax_cols[d]+' ('+base_curr+')');
+	for (d in tax_cols) $('[data-grid-fieldname="Sales Taxes and Charges-'+d+'"]').html(tax_cols[d]+' ('+base_curr+')');
 		
-	if (doc.doctype == 'Receivable Voucher') {
+	if (doc.doctype == 'Sales Invoice') {
 		// advance table flds
 		adv_cols = {'advance_amount': 'Advance Amount', 'allocated_amount': 'Allocated Amount'}
-		for (d in adv_cols) $('[data-grid-fieldname="Advance Adjustment Detail-'+d+'"]').html(adv_cols[d]+' ('+base_curr+')');	
+		for (d in adv_cols) $('[data-grid-fieldname="Sales Invoice Advance-'+d+'"]').html(adv_cols[d]+' ('+base_curr+')');	
 	}
 }
 
@@ -220,13 +202,16 @@
 cur_frm.cscript.conversion_rate = cur_frm.cscript.currency;
 cur_frm.cscript.plc_conversion_rate = cur_frm.cscript.currency;
 
-cur_frm.cscript.company = function(doc, dt, dn) {
+cur_frm.cscript.company = function(doc, cdt, cdn) {
 	wn.call({
 		method: 'selling.doctype.sales_common.sales_common.get_comp_base_currency',
 		args: {company:doc.company},
 		callback: function(r, rt) {
-			var doc = locals[dt][dn];
-			set_multiple(doc.doctype, doc.name, {currency:r.message, price_list_currency:r.message});
+			var doc = locals[cdt][cdn];
+			set_multiple(doc.doctype, doc.name, {
+				currency:r.message, 
+				price_list_currency:r.message
+			});
 			cur_frm.cscript.currency(doc, cdt, cdn);
 		}
 	});
@@ -257,9 +242,20 @@
 // ******************** ITEM CODE ******************************** 
 cur_frm.fields_dict[cur_frm.cscript.fname].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
 	if (doc.order_type == 'Maintenance')
-		return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND tabItem.docstatus != 2 AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';
+		return 'SELECT tabItem.name,tabItem.item_name,tabItem.description \
+			FROM tabItem WHERE tabItem.is_service_item="Yes" \
+			AND tabItem.docstatus != 2 \
+			AND (ifnull(`tabItem`.`end_of_life`,"") = "" \
+				OR `tabItem`.`end_of_life` > NOW() \
+				OR `tabItem`.`end_of_life`="0000-00-00") \
+			AND tabItem.%(key)s LIKE "%s" LIMIT 50';
 	else 
-		return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_sales_item="Yes" AND tabItem.docstatus != 2 AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';
+		return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem \
+			WHERE tabItem.is_sales_item="Yes" AND tabItem.docstatus != 2 \
+			AND (ifnull(`tabItem`.`end_of_life`,"") = "" \
+				OR `tabItem`.`end_of_life` > NOW() \
+				OR `tabItem`.`end_of_life`="0000-00-00") \
+			AND tabItem.%(key)s LIKE "%s" LIMIT 50';
 }
 
 
@@ -275,8 +271,14 @@
 			var callback = function(r, rt){
 				cur_frm.cscript.recalc(doc, 1);
 			}
-			var args = {'item_code':d.item_code, 'income_account':d.income_account, 'cost_center': d.cost_center, 'warehouse': d.warehouse};
-			get_server_fields('get_item_details',JSON.stringify(args), fname,doc,cdt,cdn,1,callback);
+			var args = {
+				'item_code':d.item_code, 
+				'income_account':d.income_account, 
+				'cost_center': d.cost_center, 
+				'warehouse': d.warehouse
+			};
+			get_server_fields('get_item_details',JSON.stringify(args), 
+				fname,doc,cdt,cdn,1,callback);
 		}
 	}
 	if(cur_frm.cscript.custom_item_code){
@@ -347,12 +349,12 @@
 
 // ************* GET OTHER CHARGES BASED ON COMPANY *************
 cur_frm.fields_dict.charge.get_query = function(doc) {
-	return 'SELECT DISTINCT `tabOther Charges`.name FROM `tabOther Charges` WHERE `tabOther Charges`.company = "'+doc.company+'" AND `tabOther Charges`.company is not NULL AND `tabOther Charges`.docstatus != 2 AND `tabOther Charges`.%(key)s LIKE "%s" ORDER BY `tabOther Charges`.name LIMIT 50';
+	return 'SELECT DISTINCT `tabSales Taxes and Charges Master`.name FROM `tabSales Taxes and Charges Master` WHERE `tabSales Taxes and Charges Master`.company = "'+doc.company+'" AND `tabSales Taxes and Charges Master`.company is not NULL AND `tabSales Taxes and Charges Master`.docstatus != 2 AND `tabSales Taxes and Charges Master`.%(key)s LIKE "%s" ORDER BY `tabSales Taxes and Charges Master`.name LIMIT 50';
 }
 
 // ********************* Get Charges ****************************
-cur_frm.cscript['Get Charges'] = function(doc, cdt, cdn) {
-	$c_obj(make_doclist(doc.doctype,doc.name),'get_other_charges','', function(r, rt) { cur_frm.cscript['Calculate Charges'](doc, cdt, cdn);});
+cur_frm.cscript.get_charges = function(doc, cdt, cdn) {
+	$c_obj(make_doclist(doc.doctype,doc.name),'get_other_charges','', function(r, rt) { cur_frm.cscript.calculate_charges(doc, cdt, cdn);});
 }
 
 
@@ -366,13 +368,19 @@
 	var sales_team = cur_frm.cscript.sales_team_fname;
 	var other_fname	= cur_frm.cscript.other_fname;
 	
-	if(!flt(doc.conversion_rate)) { doc.conversion_rate = 1; refresh_field('conversion_rate'); }
-	if(!flt(doc.plc_conversion_rate)) { doc.plc_conversion_rate = 1; refresh_field('plc_conversion_rate'); }
+	if(!flt(doc.conversion_rate)) { 
+		doc.conversion_rate = 1; 
+		refresh_field('conversion_rate'); 
+	}
+	if(!flt(doc.plc_conversion_rate)) { 
+		doc.plc_conversion_rate = 1; 
+		refresh_field('plc_conversion_rate'); 
+	}
 
 	if(n > 0) cur_frm.cscript.update_fname_table(doc , tname , fname , n, other_fname); // updates all values in table (i.e. amount, export amount, net total etc.)
 	
 	if(flt(doc.net_total) > 0) {
-		var cl = getchildren('RV Tax Detail', doc.name, other_fname,doc.doctype);
+		var cl = getchildren('Sales Taxes and Charges', doc.name, other_fname,doc.doctype);
 		for(var i = 0; i<cl.length; i++){
 			cl[i].total_tax_amount = 0;
 			cl[i].total_amount = 0;
@@ -386,7 +394,7 @@
 		}
 		cur_frm.cscript.calc_other_charges(doc , tname , fname , other_fname); // calculate other charges
 	}
-	cur_frm.cscript.calc_doc_values(doc, cdt, cdn, tname, fname, other_fname); // calculates total amounts
+	cur_frm.cscript.calc_doc_values(doc, null, null, tname, fname, other_fname); // calculates total amounts
 
 	// ******************* calculate allocated amount of sales person ************************
 	cl = getchildren('Sales Team', doc.name, sales_team);
@@ -415,7 +423,7 @@
 	}
 
 	var inclusive_rate = 0
-	var d = getchildren('RV Tax Detail', doc.name, other_fname,doc.doctype);
+	var d = getchildren('Sales Taxes and Charges', doc.name, other_fname,doc.doctype);
 	for(var j = 0; j<d.length; j++){
 		other_charges_total += flt(d[j].tax_amount);
 		if(d[j].included_in_print_rate) {
@@ -441,14 +449,14 @@
 	doc = locals[doc.doctype][doc.name];
 
 	// Make Display Area
-	cur_frm.fields_dict['Other Charges Calculation'].disp_area.innerHTML =
-		'<b style="padding: 8px 0px;">Calculation Details for Other Charges:</b>';
+	cur_frm.fields_dict['other_charges_calculation'].disp_area.innerHTML =
+		'<b style="padding: 8px 0px;">Calculation Details for Taxes and Charges:</b>';
 
 	var cl = getchildren(tname, doc.name, fname);
-	var tax = getchildren('RV Tax Detail', doc.name, other_fname,doc.doctype);
+	var tax = getchildren('Sales Taxes and Charges', doc.name, other_fname,doc.doctype);
 	
 	// Make display table
-	var otc = make_table(cur_frm.fields_dict['Other Charges Calculation'].disp_area,
+	var otc = make_table(cur_frm.fields_dict['other_charges_calculation'].disp_area,
 		cl.length + 1, tax.length + 1, '90%', [], { border:'1px solid #AAA', padding:'2px' });
 	$y(otc,{marginTop:'8px'});
 
@@ -468,7 +476,7 @@
 		// Add Item Code in new Row
 		$td(otc,i+1,0).innerHTML = cl[i].item_code ? cl[i].item_code : cl[i].description;
 		
-		//var tax = getchildren('RV Tax Detail', doc.name, other_fname,doc.doctype);
+		//var tax = getchildren('Sales Taxes and Charges', doc.name, other_fname,doc.doctype);
 		var total = net_total;
 		
 		
@@ -494,7 +502,7 @@
 			tax[t].tax_amount += flt(tax_amount);			 
 			var total_amount = flt(tax[t].tax_amount);
 			total_tax_amount = flt(tax[t].total_tax_amount) + flt(total_amount);
-			set_multiple('RV Tax Detail', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'amount':roundNumber(flt(total_amount), 2), 'total':roundNumber(flt(total)+flt(tax[t].tax_amount), 2)}, other_fname);
+			set_multiple('Sales Taxes and Charges', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'amount':roundNumber(flt(total_amount), 2), 'total':roundNumber(flt(total)+flt(tax[t].tax_amount), 2)}, other_fname);
 			prev_total += flt(tax[t].total_amount);	 // for previous row total
 			total += flt(tax[t].tax_amount);		 // for adding total to previous amount
 
@@ -564,7 +572,7 @@
 
 // ********************** Functions for inclusive value calc ******************************
 cur_frm.cscript.consider_incl_rate = function(doc, other_fname) {
-	var tax_list = getchildren('RV Tax Detail', doc.name, other_fname, doc.doctype);
+	var tax_list = getchildren('Sales Taxes and Charges', doc.name, other_fname, doc.doctype);
 	for(var i=0; i<tax_list.length; i++) {
 		if(tax_list[i].included_in_print_rate) {
 			return true;
@@ -587,7 +595,7 @@
 		}
 	};
 
-	var tax_list = getchildren('RV Tax Detail', doc.name, other_fname, doc.doctype);
+	var tax_list = getchildren('Sales Taxes and Charges', doc.name, other_fname, doc.doctype);
 	var total = 1;
 	var temp_tax_list = [];
 	var amt = 0;
@@ -631,7 +639,7 @@
 			refresh_field('included_in_print_rate', tax.name, cur_frm.cscript.other_fname);
 		} else if(inList(['On Previous Row Total', 'On Previous Row Amount'], tax.charge_type)){
 			if(tax.row_id) {
-				var tax_list = getchildren('RV Tax Detail', doc.name, cur_frm.cscript.other_fname, doc.doctype);
+				var tax_list = getchildren('Sales Taxes and Charges', doc.name, cur_frm.cscript.other_fname, doc.doctype);
 				if(tax_list[tax.row_id-1].charge_type=='Actual') {
 					msgprint("Row of type 'Actual' cannot be depended on for type '" + tax.charge_type + "'\
 						when using tax inclusive prices.<br />\
@@ -721,14 +729,14 @@
 
 // **************** RE-CALCULATE VALUES ***************************
 
-cur_frm.cscript['Re-Calculate Values'] = function(doc, cdt, cdn) {	
-	cur_frm.cscript['Calculate Charges'](doc,cdt,cdn);
+cur_frm.cscript.recalculate_values = function(doc, cdt, cdn) {	
+	cur_frm.cscript.calculate_charges(doc,cdt,cdn);
 }
 
-cur_frm.cscript['Calculate Charges'] = function(doc, cdt, cdn) {
+cur_frm.cscript.calculate_charges = function(doc, cdt, cdn) {
 	var other_fname	= cur_frm.cscript.other_fname;
 
-	var cl = getchildren('RV Tax Detail', doc.name, other_fname, doc.doctype);
+	var cl = getchildren('Sales Taxes and Charges', doc.name, other_fname, doc.doctype);
 	for(var i = 0; i<cl.length; i++){
 		cl[i].total_tax_amount = 0;
 		cl[i].total_amount = 0;
@@ -803,14 +811,14 @@
 // =================================================================================
 cur_frm.cscript.validate = function(doc, cdt, cdn) {
 	cur_frm.cscript.validate_items(doc);
-	var cl = getchildren('Other Charges', doc.name, 'other_charges');
+	var cl = getchildren('Sales Taxes and Charges Master', doc.name, 'other_charges');
 	for(var i =0;i<cl.length;i++) {
 		if(!cl[i].amount) {
-			alert("Please Enter Amount in Row no. "+cl[i].idx+" in Other Charges table");
+			alert("Please Enter Amount in Row no. "+cl[i].idx+" in Taxes and Charges table");
 			validated = false;
 		}
 	}
-	cur_frm.cscript['Calculate Charges'] (doc, cdt, cdn);
+	cur_frm.cscript.calculate_charges (doc, cdt, cdn);
 
 	if (cur_frm.cscript.calc_adjustment_amount) cur_frm.cscript.calc_adjustment_amount(doc);
 }
diff --git a/erpnext/selling/doctype/sales_common/sales_common.py b/erpnext/selling/doctype/sales_common/sales_common.py
index 5c1a8e4..f9f8adb 100644
--- a/erpnext/selling/doctype/sales_common/sales_common.py
+++ b/erpnext/selling/doctype/sales_common/sales_common.py
@@ -43,7 +43,7 @@
 @webnotes.whitelist()
 def get_price_list_currency(arg=None):
 	""" Get all currency in which price list is maintained"""
-	plc = webnotes.conn.sql("select distinct ref_currency from `tabRef Rate Detail` where price_list_name = %s", webnotes.form_dict['price_list'])
+	plc = webnotes.conn.sql("select distinct ref_currency from `tabItem Price` where price_list_name = %s", webnotes.form_dict['price_list'])
 	plc = [d[0] for d in plc]
 	base_currency = get_comp_base_currency(webnotes.form_dict['company'])
 	return plc, base_currency
@@ -54,18 +54,18 @@
 		self.doc, self.doclist = d,dl
 
 		self.doctype_dict = {
-			'Sales Order'		: 'Sales Order Detail',
-			'Delivery Note'		: 'Delivery Note Detail',
-			'Receivable Voucher':'RV Detail',
-			'Installation Note' : 'Installed Item Details'
+			'Sales Order'		: 'Sales Order Item',
+			'Delivery Note'		: 'Delivery Note Item',
+			'Sales Invoice':'Sales Invoice Item',
+			'Installation Note' : 'Installation Note Item'
 		}
 												 
 		self.ref_doctype_dict= {}
 
 		self.next_dt_detail = {
-			'delivered_qty' : 'Delivery Note Detail',
-			'billed_qty'		: 'RV Detail',
-			'installed_qty' : 'Installed Item Details'}
+			'delivered_qty' : 'Delivery Note Item',
+			'billed_qty'		: 'Sales Invoice Item',
+			'installed_qty' : 'Installation Note Item'}
 
 		self.msg = []
 
@@ -119,24 +119,6 @@
 			acc_head = webnotes.conn.sql("select name from `tabAccount` where name = '%s' and docstatus != 2" % (cstr(obj.doc.customer) + " - " + get_value('Company', obj.doc.company, 'abbr')))
 			obj.doc.debit_to = acc_head and acc_head[0][0] or ''
 
-
-	# Get Customer Details along with its primary contact details
-	# ==============================================================
-	def get_customer_details(self, obj = '', inv_det_reqd = 1):
-		details = webnotes.conn.sql("select customer_name,address, territory, customer_group, default_sales_partner, default_commission_rate from `tabCustomer` where name = '%s' and docstatus != 2" %(obj.doc.customer), as_dict = 1)
-		obj.doc.customer_name = details and details[0]['customer_name'] or ''
-		obj.doc.customer_address =	details and details[0]['address'] or ''
-		obj.doc.territory = details and details[0]['territory'] or ''
-		obj.doc.customer_group	=	details and details[0]['customer_group'] or ''
-		obj.doc.sales_partner	 =	details and details[0]['default_sales_partner'] or ''
-		obj.doc.commission_rate =	details and flt(details[0]['default_commission_rate']) or ''
-		if obj.doc.doctype != 'Receivable Voucher':
-			obj.doc.delivery_address =	details and details[0]['address'] or ''
-			self.get_contact_details(obj,primary = 1) # get primary contact details
-		self.get_sales_person_details(obj) # get default sales person details
-
-		if obj.doc.doctype == 'Receivable Voucher' and inv_det_reqd:
-			self.get_invoice_details(obj) # get invoice details
 	
 	
 	# Get Item Details
@@ -177,7 +159,7 @@
 	
 	# ***************** Get Ref rate as entered in Item Master ********************
 	def get_ref_rate(self, item_code, price_list_name, price_list_currency, plc_conv_rate):
-		ref_rate = webnotes.conn.sql("select ref_rate from `tabRef Rate Detail` where parent = %s and price_list_name = %s and ref_currency = %s", (item_code, price_list_name, price_list_currency))
+		ref_rate = webnotes.conn.sql("select ref_rate from `tabItem Price` where parent = %s and price_list_name = %s and ref_currency = %s", (item_code, price_list_name, price_list_currency))
 		base_ref_rate = ref_rate and flt(ref_rate[0][0]) * flt(plc_conv_rate) or 0
 		return base_ref_rate
 
@@ -209,9 +191,9 @@
 			if default: add_cond = 'ifnull(t2.is_default,0) = 1'
 			else: add_cond = 't1.parent = "'+cstr(obj.doc.charge)+'"'
 			idx = 0
-			other_charge = webnotes.conn.sql("select t1.charge_type,t1.row_id,t1.description,t1.account_head,t1.rate,t1.tax_amount,t1.included_in_print_rate, t1.cost_center_other_charges from `tabRV Tax Detail` t1, `tabOther Charges` t2 where t1.parent = t2.name and t2.company = '%s' and %s order by t1.idx" % (obj.doc.company, add_cond), as_dict = 1)
+			other_charge = webnotes.conn.sql("select t1.charge_type,t1.row_id,t1.description,t1.account_head,t1.rate,t1.tax_amount,t1.included_in_print_rate, t1.cost_center_other_charges from `tabSales Taxes and Charges` t1, `tabSales Taxes and Charges Master` t2 where t1.parent = t2.name and t2.company = '%s' and %s order by t1.idx" % (obj.doc.company, add_cond), as_dict = 1)
 			for other in other_charge:
-				d =	addchild(obj.doc, 'other_charges', 'RV Tax Detail', 1, obj.doclist)
+				d =	addchild(obj.doc, 'other_charges', 'Sales Taxes and Charges', 1, obj.doclist)
 				d.charge_type = other['charge_type']
 				d.row_id = other['row_id']
 				d.description = other['description']
@@ -227,7 +209,7 @@
 	# Get TERMS AND CONDITIONS
 	# =======================================================================================
 	def get_tc_details(self,obj):
-		r = webnotes.conn.sql("select terms from `tabTerm` where name = %s", obj.doc.tc_name)
+		r = webnotes.conn.sql("select terms from `tabTerms and Conditions` where name = %s", obj.doc.tc_name)
 		if r: obj.doc.terms = r[0][0]
 
 #---------------------------------------- Get Tax Details -------------------------------#
@@ -336,7 +318,7 @@
 		return webnotes.conn.sql("select name from `tabSales BOM` where name=%s and docstatus != 2", item_code)
 	
 	def get_sales_bom_items(self, item_code):
-		return webnotes.conn.sql("select item_code, qty, uom from `tabSales BOM Detail` where parent=%s", item_code)
+		return webnotes.conn.sql("select item_code, qty, uom from `tabSales BOM Item` where parent=%s", item_code)
 
 
 	# --------------
@@ -354,7 +336,7 @@
 				# Eg.: if SO qty is 10 and there is tolerance of 20%, then it will allow DN of 12.
 				# But in this case reserved qty should only be reduced by 10 and not 12.
 
-				tot_qty, max_qty, tot_amt, max_amt = self.get_curr_and_ref_doc_details(d.doctype, 'prevdoc_detail_docname', d.prevdoc_detail_docname, 'Sales Order Detail', obj.doc.name, obj.doc.doctype)
+				tot_qty, max_qty, tot_amt, max_amt = self.get_curr_and_ref_doc_details(d.doctype, 'prevdoc_detail_docname', d.prevdoc_detail_docname, 'Sales Order Item', obj.doc.name, obj.doc.doctype)
 				if((flt(tot_qty) + flt(qty) > flt(max_qty))):
 					reserved_qty = -(flt(max_qty)-flt(tot_qty))
 				else:	
@@ -405,7 +387,7 @@
 	def add_packing_list_item(self,obj, item_code, qty, warehouse, line):
 		bin = self.get_bin_qty(item_code, warehouse)
 		item = self.get_packing_item_details(item_code)
-		pi = addchild(obj.doc, 'packing_details', 'Delivery Note Packing Detail', 1, obj.doclist)
+		pi = addchild(obj.doc, 'packing_details', 'Delivery Note Packing Item', 1, obj.doclist)
 		pi.parent_item = item_code
 		pi.item_code = item_code
 		pi.item_name = item['item_name']
@@ -511,7 +493,7 @@
 		import datetime
 		for d in getlist(obj.doclist, obj.fname):
 			if d.prevdoc_doctype and d.prevdoc_docname:
-				if d.prevdoc_doctype == 'Receivable Voucher':
+				if d.prevdoc_doctype == 'Sales Invoice':
 					dt = webnotes.conn.sql("select posting_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname))
 				else:
 					dt = webnotes.conn.sql("select transaction_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname))
@@ -537,7 +519,7 @@
 			- Update Percent
 			- Validate over delivery
 			
-		From Receivable Voucher 
+		From Sales Invoice 
 			- Update Billed Amt
 			- Update Percent
 			- Validate over billing
@@ -559,30 +541,30 @@
 	
 	def validate_all_qty(self):
 		"""
-			Validates over-billing / delivery / installation in Delivery Note, Receivable Voucher, Installation Note
+			Validates over-billing / delivery / installation in Delivery Note, Sales Invoice, Installation Note
 			To called after update_all_qty
 		"""
 		if self.obj.doc.doctype=='Delivery Note':
 			self.validate_qty({
-				'source_dt'		:'Delivery Note Detail',
+				'source_dt'		:'Delivery Note Item',
 				'compare_field'	:'delivered_qty',
 				'compare_ref_field'	:'qty',
-				'target_dt'		:'Sales Order Detail',
+				'target_dt'		:'Sales Order Item',
 				'join_field'	:'prevdoc_detail_docname'
 			})
-		elif self.obj.doc.doctype=='Receivable Voucher':
+		elif self.obj.doc.doctype=='Sales Invoice':
 			self.validate_qty({
-				'source_dt'		:'RV Detail',
+				'source_dt'		:'Sales Invoice Item',
 				'compare_field'	:'billed_amt',
 				'compare_ref_field'	:'amount',
-				'target_dt'		:'Sales Order Detail',
+				'target_dt'		:'Sales Order Item',
 				'join_field'	:'so_detail'
 			})
 			self.validate_qty({
-				'source_dt'		:'RV Detail',
+				'source_dt'		:'Sales Invoice Item',
 				'compare_field'	:'billed_amt',
 				'compare_ref_field'	:'amount',
-				'target_dt'		:'Delivery Note Detail',
+				'target_dt'		:'Delivery Note Item',
 				'join_field'	:'dn_detail'
 			}, no_tolerance =1)
 		elif self.obj.doc.doctype=='Installation Note':
@@ -590,7 +572,7 @@
 				'source_dt'		:'Installation Item Details',
 				'compare_field'	:'installed_qty',
 				'compare_ref_field'	:'qty',
-				'target_dt'		:'Delivery Note Detail',
+				'target_dt'		:'Delivery Note Item',
 				'join_field'	:'dn_detail'
 			}, no_tolerance =1)
 
@@ -606,7 +588,7 @@
 
 		if not(tolerance):
 			if self.global_tolerance == None:
-				self.global_tolerance = flt(get_value('Manage Account',None,'tolerance') or 0)
+				self.global_tolerance = flt(get_value('Global Defaults',None,'tolerance') or 0)
 			tolerance = self.global_tolerance
 		
 		self.tolerance[item_code] = tolerance
@@ -675,11 +657,11 @@
 		if self.obj.doc.doctype=='Delivery Note':
 			self.update_qty({
 				'target_field'			:'delivered_qty',
-				'target_dt'				:'Sales Order Detail',
+				'target_dt'				:'Sales Order Item',
 				'target_parent_dt'		:'Sales Order',
 				'target_parent_field'	:'per_delivered',
 				'target_ref_field'		:'qty',
-				'source_dt'				:'Delivery Note Detail',
+				'source_dt'				:'Delivery Note Item',
 				'source_field'			:'qty',
 				'join_field'			:'prevdoc_detail_docname',
 				'percent_join_field'	:'prevdoc_docname',
@@ -687,14 +669,14 @@
 				'keyword'				:'Delivered'
 			})
 			
-		elif self.obj.doc.doctype=='Receivable Voucher':
+		elif self.obj.doc.doctype=='Sales Invoice':
 			self.update_qty({
 				'target_field'			:'billed_amt',
-				'target_dt'				:'Sales Order Detail',
+				'target_dt'				:'Sales Order Item',
 				'target_parent_dt'		:'Sales Order',
 				'target_parent_field'	:'per_billed',
 				'target_ref_field'		:'amount',
-				'source_dt'				:'RV Detail',
+				'source_dt'				:'Sales Invoice Item',
 				'source_field'			:'amount',
 				'join_field'			:'so_detail',
 				'percent_join_field'	:'sales_order',
@@ -704,11 +686,11 @@
 
 			self.update_qty({
 				'target_field'			:'billed_amt',
-				'target_dt'				:'Delivery Note Detail',
+				'target_dt'				:'Delivery Note Item',
 				'target_parent_dt'		:'Delivery Note',
 				'target_parent_field'	:'per_billed',
 				'target_ref_field'		:'amount',
-				'source_dt'				:'RV Detail',
+				'source_dt'				:'Sales Invoice Item',
 				'source_field'			:'amount',
 				'join_field'			:'dn_detail',
 				'percent_join_field'	:'delivery_note',
@@ -719,11 +701,11 @@
 		if self.obj.doc.doctype=='Installation Note':
 			self.update_qty({
 				'target_field'			:'installed_qty',
-				'target_dt'				:'Delivery Note Detail',
+				'target_dt'				:'Delivery Note Item',
 				'target_parent_dt'		:'Delivery Note',
 				'target_parent_field'	:'per_installed',
 				'target_ref_field'		:'qty',
-				'source_dt'				:'Installed Item Details',
+				'source_dt'				:'Installation Note Item',
 				'source_field'			:'qty',
 				'join_field'			:'prevdoc_detail_docname',
 				'percent_join_field'	:'prevdoc_docname',
diff --git a/erpnext/selling/doctype/sales_common/sales_common.txt b/erpnext/selling/doctype/sales_common/sales_common.txt
index 4b0cf28..413e051 100644
--- a/erpnext/selling/doctype/sales_common/sales_common.txt
+++ b/erpnext/selling/doctype/sales_common/sales_common.txt
@@ -3,22 +3,22 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:21',
+		'creation': '2012-03-27 14:36:14',
 		'docstatus': 0,
-		'modified': '2011-01-03 11:21:04',
-		'modified_by': 'nabin@webnotestech.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:14',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'issingle': 1,
-		'module': 'Selling',
+		'module': u'Selling',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 290
 	},
@@ -26,6 +26,6 @@
 	# DocType, Sales Common
 	{
 		'doctype': 'DocType',
-		'name': 'Sales Common'
+		'name': u'Sales Common'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_order/listview.js b/erpnext/selling/doctype/sales_order/listview.js
new file mode 100644
index 0000000..3b764d1
--- /dev/null
+++ b/erpnext/selling/doctype/sales_order/listview.js
@@ -0,0 +1,32 @@
+// render
+wn.doclistviews['Sales Order'] = wn.views.ListView.extend({
+	init: function(d) {
+		this._super(d)
+		this.fields = this.fields.concat([
+			"`tabSales Order`.customer_name", 
+			"ifnull(`tabSales Order`.per_delivered,0) as per_delivered", 
+			"ifnull(`tabSales Order`.per_billed,0) as per_billed",
+			"`tabSales Order`.currency", 
+			"ifnull(`tabSales Order`.grand_total_export,0) as grand_total_export"
+		]);
+		this.stats = this.stats.concat(['status', 'company']);
+	},
+	
+	columns: [
+		{width: '5%', content:'avatar'},
+		{width: '3%', content:'docstatus'},
+		{width: '15%', content:'name'},
+		{width: '35%', content:'tags+customer_name', css: {color:'#aaa'}},
+		{
+			width: '18%', 
+			content: function(parent, data) { 
+				$(parent).html(data.currency + ' ' + fmt_money(data.grand_total_export)) 
+			},
+			css: {'text-align':'right'}
+		},
+		{width: '8%', content: 'per_delivered', type:'bar-graph', label:'Delivered'},
+		{width: '8%', content: 'per_billed', type:'bar-graph', label:'Billed'},
+		{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
+	]
+
+});
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index a2aaf8f..9bd8569 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -16,15 +16,16 @@
 
 // Module CRM
 
-cur_frm.cscript.tname = "Sales Order Detail";
+cur_frm.cscript.tname = "Sales Order Item";
 cur_frm.cscript.fname = "sales_order_details";
 cur_frm.cscript.other_fname = "other_charges";
 cur_frm.cscript.sales_team_fname = "sales_team";
 
 
-$import(Sales Common)
-$import(Other Charges)
-$import(SMS Control)
+wn.require('erpnext/selling/doctype/sales_common/sales_common.js');
+wn.require('erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js');
+wn.require('erpnext/utilities/doctype/sms_control/sms_control.js');
+wn.require('erpnext/setup/doctype/notification_control/notification_control.js');
 
 
 // ONLOAD
@@ -63,20 +64,20 @@
 
 	if(doc.docstatus==1) {
 		if(doc.status != 'Stopped') {
-			cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
+			cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
 			// delivery note
 			if(doc.per_delivered < 100 && doc.order_type!='Maintenance')
 				cur_frm.add_custom_button('Make Delivery', cur_frm.cscript['Make Delivery Note']);
 			
 			// maintenance
 			if(doc.per_delivered < 100 && doc.order_type=='Maintenance') {
-				cur_frm.add_custom_button('Make Maint. Visit', cur_frm.cscript['Make Maintenance Visit']);
+				cur_frm.add_custom_button('Make Maint. Visit', cur_frm.cscript.make_maintenance_visit);
 				cur_frm.add_custom_button('Make Maint. Schedule', cur_frm.cscript['Make Maintenance Schedule']);
 			}
 
 			// indent
 			if(doc.order_type != 'Maintenance')
-				cur_frm.add_custom_button('Make ' + get_doctype_label('Indent'), cur_frm.cscript['Make Purchase Requisition']);
+				cur_frm.add_custom_button('Make ' + get_doctype_label('Purchase Request'), cur_frm.cscript['Make Purchase Request']);
 			
 			// sales invoice
 			if(doc.per_billed < 100)
@@ -85,15 +86,10 @@
 			// stop
 			if(doc.per_delivered < 100 || doc.per_billed < 100)
 				cur_frm.add_custom_button('Stop!', cur_frm.cscript['Stop Sales Order']);
-	} else {
-		
+		} else {	
 			// un-stop
 			cur_frm.add_custom_button('Unstop', cur_frm.cscript['Unstop Sales Order']);
-	}
-		
-		unhide_field(['Repair Sales Order', 'Send SMS', 'message', 'customer_mobile_no'])
-	} else {
-		hide_field(['Repair Sales Order', 'Send SMS', 'message', 'customer_mobile_no'])
+		}
 	}
 }
 
@@ -103,6 +99,8 @@
 		var callback2  = function(r, rt) {
 			if(doc.customer) unhide_field(['customer_address', 'contact_person', 'customer_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory','customer_group','shipping_address']);
 			cur_frm.refresh();
+			cur_frm.cscript.price_list_name(doc, dt, dn); 
+
 		}
 		var doc = locals[cur_frm.doctype][cur_frm.docname];
 		get_server_fields('get_shipping_address',doc.customer,'',doc, dt, dn, 0, callback2);
@@ -134,7 +132,7 @@
 	return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
 }
 
-cur_frm.cscript['Pull Quotation Details'] = function(doc,dt,dn) {
+cur_frm.cscript.pull_quotation_details = function(doc,dt,dn) {
 	var callback = function(r,rt){
 		var doc = locals[cur_frm.doctype][cur_frm.docname];					
 		if(r.message){							
@@ -216,7 +214,7 @@
 									'from_doctype':'Sales Order',
 									'to_doctype':'Maintenance Schedule',
 									'from_docname':doc.name,
-						'from_to_list':"[['Sales Order', 'Maintenance Schedule'], ['Sales Order Detail', 'Item Maintenance Detail']]"
+						'from_to_list':"[['Sales Order', 'Maintenance Schedule'], ['Sales Order Item', 'Maintenance Schedule Item']]"
 					}
 					, function(r,rt) {
 						loaddoc("Maintenance Schedule", n);
@@ -232,7 +230,7 @@
 }
 
 //------------ make maintenance visit ------------
-cur_frm.cscript['Make Maintenance Visit'] = function() {
+cur_frm.cscript.make_maintenance_visit = function() {
 	var doc = cur_frm.doc;
 
 	if (doc.docstatus == 1) { 
@@ -245,7 +243,7 @@
 									'from_doctype':'Sales Order',
 									'to_doctype':'Maintenance Visit',
 									'from_docname':doc.name,
-						'from_to_list':"[['Sales Order', 'Maintenance Visit'], ['Sales Order Detail', 'Maintenance Visit Detail']]"
+						'from_to_list':"[['Sales Order', 'Maintenance Visit'], ['Sales Order Item', 'Maintenance Visit Purpose']]"
 					}
 					, function(r,rt) {
 						loaddoc("Maintenance Visit", n);
@@ -262,19 +260,19 @@
 
 // make indent
 // ================================================================================================
-cur_frm.cscript['Make Purchase Requisition'] = function() {
+cur_frm.cscript['Make Purchase Request'] = function() {
 	var doc = cur_frm.doc;
 	if (doc.docstatus == 1) { 
-	n = createLocal("Indent");
+	n = createLocal("Purchase Request");
 	$c('dt_map', args={
-					'docs':compress_doclist([locals["Indent"][n]]),
+					'docs':compress_doclist([locals["Purchase Request"][n]]),
 					'from_doctype':'Sales Order',
-					'to_doctype':'Indent',
+					'to_doctype':'Purchase Request',
 					'from_docname':doc.name,
-		'from_to_list':"[['Sales Order', 'Indent'], ['Sales Order Detail', 'Indent Detail']]"
+		'from_to_list':"[['Sales Order', 'Purchase Request'], ['Sales Order Item', 'Purchase Request Item']]"
 	}
 	, function(r,rt) {
-		loaddoc("Indent", n);
+		loaddoc("Purchase Request", n);
 		}
 		);
 	}
@@ -292,7 +290,7 @@
 					'from_doctype':'Sales Order',
 					'to_doctype':'Delivery Note',
 					'from_docname':doc.name,
-		'from_to_list':"[['Sales Order', 'Delivery Note'], ['Sales Order Detail', 'Delivery Note Detail'],['RV Tax Detail','RV Tax Detail'],['Sales Team','Sales Team']]"
+		'from_to_list':"[['Sales Order', 'Delivery Note'], ['Sales Order Item', 'Delivery Note Item'],['Sales Taxes and Charges','Sales Taxes and Charges'],['Sales Team','Sales Team']]"
 	}
 	, function(r,rt) {
 		loaddoc("Delivery Note", n);
@@ -307,15 +305,15 @@
 cur_frm.cscript['Make Sales Invoice'] = function() {
 	var doc = cur_frm.doc;
 
-	n = createLocal('Receivable Voucher');
+	n = createLocal('Sales Invoice');
 	$c('dt_map', args={
-		'docs':compress_doclist([locals['Receivable Voucher'][n]]),
+		'docs':compress_doclist([locals['Sales Invoice'][n]]),
 		'from_doctype':doc.doctype,
-		'to_doctype':'Receivable Voucher',
+		'to_doctype':'Sales Invoice',
 		'from_docname':doc.name,
-		'from_to_list':"[['Sales Order','Receivable Voucher'],['Sales Order Detail','RV Detail'],['RV Tax Detail','RV Tax Detail'],['Sales Team','Sales Team']]"
+		'from_to_list':"[['Sales Order','Sales Invoice'],['Sales Order Item','Sales Invoice Item'],['Sales Taxes and Charges','Sales Taxes and Charges'],['Sales Team','Sales Team']]"
 		}, function(r,rt) {
-			 loaddoc('Receivable Voucher', n);
+			 loaddoc('Sales Invoice', n);
 		}
 	);
 }
@@ -355,7 +353,6 @@
 	return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"	ORDER BY	`tabTerritory`.`name` ASC LIMIT 50';
 }
 
-$import(Notification Control)
 cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
 	var args = {
 		type: 'Sales Order',
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index c886ec3..8210d10 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -38,7 +38,7 @@
 	def __init__(self, doc, doclist=[]):
 		self.doc = doc
 		self.doclist = doclist
-		self.tname = 'Sales Order Detail'
+		self.tname = 'Sales Order Item'
 		self.fname = 'sales_order_details'
 		self.person_tname = 'Target Detail'
 		self.partner_tname = 'Partner Target Detail'
@@ -52,7 +52,7 @@
 		
 # DOCTYPE TRIGGER FUNCTIONS
 # =============================
-	# Pull Quotation Details
+	# Pull Quotation Items
 	# -----------------------
 	def pull_quotation_details(self):
 		self.doc.clear_table(self.doclist, 'other_charges')
@@ -60,7 +60,7 @@
 		self.doc.clear_table(self.doclist, 'sales_team')
 		self.doc.clear_table(self.doclist, 'tc_details')
 		if self.doc.quotation_no:				
-			get_obj('DocType Mapper', 'Quotation-Sales Order').dt_map('Quotation', 'Sales Order', self.doc.quotation_no, self.doc, self.doclist, "[['Quotation', 'Sales Order'],['Quotation Detail', 'Sales Order Detail'],['RV Tax Detail','RV Tax Detail'],['Sales Team','Sales Team'],['TC Detail','TC Detail']]")			
+			get_obj('DocType Mapper', 'Quotation-Sales Order').dt_map('Quotation', 'Sales Order', self.doc.quotation_no, self.doc, self.doclist, "[['Quotation', 'Sales Order'],['Quotation Item', 'Sales Order Item'],['Sales Taxes and Charges','Sales Taxes and Charges'],['Sales Team','Sales Team'],['TC Detail','TC Detail']]")			
 		else:
 			msgprint("Please select Quotation whose details need to pull")		
 
@@ -74,13 +74,6 @@
 			get_obj('DocType Mapper', 'Project-Sales Order').dt_map('Project', 'Sales Order', self.doc.project_name, self.doc, self.doclist, "[['Project', 'Sales Order']]")
 			
 	
-	# Get Customer Details
-	# ---------------------
-	#def get_customer_details(self):
-	#	sales_com_obj = get_obj('Sales Common')
-	#	sales_com_obj.get_customer_details(self)
-	#	sales_com_obj.get_shipping_details(self)
-
 	# Get contact person details based on customer selected
 	# ------------------------------------------------------
 	def get_contact_details(self):
@@ -91,7 +84,7 @@
 	def get_comm_rate(self, sales_partner):
 		return get_obj('Sales Common').get_comm_rate(sales_partner, self)
 
-	# Clear Sales Order Details Table
+	# Clear Sales Order Items Table
 	# --------------------------------
 	def clear_sales_order_details(self):
 		self.doc.clear_table(self.doclist, 'sales_order_details')
@@ -102,7 +95,8 @@
 	# Get Item Details
 	# ----------------
 	def get_item_details(self, args=None):
-		args = args and eval(args) or {}
+		import json
+		args = args and json.loads(args) or {}
 		if args.get('item_code'):
 			return get_obj('Sales Common').get_item_details(args, self)
 		else:
@@ -148,7 +142,7 @@
 	def load_default_taxes(self):
 		return get_obj('Sales Common').load_default_taxes(self)
 
-	# Pull details from other charges master (Get Other Charges)
+	# Pull details from other charges master (Get Sales Taxes and Charges Master)
 	# ----------------------------------------------------------
 	def get_other_charges(self):
 		return get_obj('Sales Common').get_other_charges(self)
@@ -162,7 +156,7 @@
 #check if maintenance schedule already generated
 #============================================
 	def check_maintenance_schedule(self):
-		nm = sql("select t1.name from `tabMaintenance Schedule` t1, `tabItem Maintenance Detail` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1", self.doc.name)
+		nm = sql("select t1.name from `tabMaintenance Schedule` t1, `tabMaintenance Schedule Item` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1", self.doc.name)
 		nm = nm and nm[0][0] or ''
 		
 		if not nm:
@@ -171,7 +165,7 @@
 #check if maintenance visit already generated
 #============================================
 	def check_maintenance_visit(self):
-		nm = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Detail` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1 and t1.completion_status='Fully Completed'", self.doc.name)
+		nm = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1 and t1.completion_status='Fully Completed'", self.doc.name)
 		nm = nm and nm[0][0] or ''
 		
 		if not nm:
@@ -215,7 +209,7 @@
 	def validate_for_items(self):
 		check_list,flag = [],0
 		chk_dupl_itm = []
-		# Sales Order Details Validations
+		# Sales Order Items Validations
 		for d in getlist(self.doclist, 'sales_order_details'):
 			if cstr(self.doc.quotation_no) == cstr(d.prevdoc_docname):
 				flag = 1
@@ -357,9 +351,9 @@
 				raise Exception , "Validation Error. "
 	
 	def update_enquiry_status(self, prevdoc, flag):
-		enq = sql("select t2.prevdoc_docname from `tabQuotation` t1, `tabQuotation Detail` t2 where t2.parent = t1.name and t1.name=%s", prevdoc)
+		enq = sql("select t2.prevdoc_docname from `tabQuotation` t1, `tabQuotation Item` t2 where t2.parent = t1.name and t1.name=%s", prevdoc)
 		if enq:
-			sql("update `tabEnquiry` set status = %s where name=%s",(flag,enq[0][0]))
+			sql("update `tabOpportunity` set status = %s where name=%s",(flag,enq[0][0]))
 
 	#update status of quotation, enquiry
 	#----------------------------------------
@@ -372,7 +366,7 @@
 					#update enquiry
 					self.update_enquiry_status(d.prevdoc_docname, 'Order Confirmed')
 				elif flag == 'cancel':
-					chk = sql("select t1.name from `tabSales Order` t1, `tabSales Order Detail` t2 where t2.parent = t1.name and t2.prevdoc_docname=%s and t1.name!=%s and t1.docstatus=1", (d.prevdoc_docname,self.doc.name))
+					chk = sql("select t1.name from `tabSales Order` t1, `tabSales Order Item` t2 where t2.parent = t1.name and t2.prevdoc_docname=%s and t1.name!=%s and t1.docstatus=1", (d.prevdoc_docname,self.doc.name))
 					if not chk:
 						sql("update `tabQuotation` set status = 'Submitted' where name=%s",d.prevdoc_docname)
 						
@@ -420,18 +414,18 @@
 	# ----------------------------------------------------------------------------
 	def check_nextdoc_docstatus(self):
 		# Checks Delivery Note
-		submit_dn = sql("select t1.name from `tabDelivery Note` t1,`tabDelivery Note Detail` t2 where t1.name = t2.parent and t2.prevdoc_docname = '%s' and t1.docstatus = 1" % (self.doc.name))
+		submit_dn = sql("select t1.name from `tabDelivery Note` t1,`tabDelivery Note Item` t2 where t1.name = t2.parent and t2.prevdoc_docname = '%s' and t1.docstatus = 1" % (self.doc.name))
 		if submit_dn:
 			msgprint("Delivery Note : " + cstr(submit_dn[0][0]) + " has been submitted against " + cstr(self.doc.doctype) + ". Please cancel Delivery Note : " + cstr(submit_dn[0][0]) + " first and then cancel "+ cstr(self.doc.doctype), raise_exception = 1)
-		# Checks Receivable Voucher
-		submit_rv = sql("select t1.name from `tabReceivable Voucher` t1,`tabRV Detail` t2 where t1.name = t2.parent and t2.sales_order = '%s' and t1.docstatus = 1" % (self.doc.name))
+		# Checks Sales Invoice
+		submit_rv = sql("select t1.name from `tabSales Invoice` t1,`tabSales Invoice Item` t2 where t1.name = t2.parent and t2.sales_order = '%s' and t1.docstatus = 1" % (self.doc.name))
 		if submit_rv:
 			msgprint("Sales Invoice : " + cstr(submit_rv[0][0]) + " has already been submitted against " +cstr(self.doc.doctype)+ ". Please cancel Sales Invoice : "+ cstr(submit_rv[0][0]) + " first and then cancel "+ cstr(self.doc.doctype), raise_exception = 1)
 		#check maintenance schedule
-		submit_ms = sql("select t1.name from `tabMaintenance Schedule` t1, `tabItem Maintenance Detail` t2 where t2.parent=t1.name and t2.prevdoc_docname = %s and t1.docstatus = 1",self.doc.name)
+		submit_ms = sql("select t1.name from `tabMaintenance Schedule` t1, `tabMaintenance Schedule Item` t2 where t2.parent=t1.name and t2.prevdoc_docname = %s and t1.docstatus = 1",self.doc.name)
 		if submit_ms:
 			msgprint("Maintenance Schedule : " + cstr(submit_ms[0][0]) + " has already been submitted against " +cstr(self.doc.doctype)+ ". Please cancel Maintenance Schedule : "+ cstr(submit_ms[0][0]) + " first and then cancel "+ cstr(self.doc.doctype), raise_exception = 1)
-		submit_mv = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Detail` t2 where t2.parent=t1.name and t2.prevdoc_docname = %s and t1.docstatus = 1",self.doc.name)
+		submit_mv = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 where t2.parent=t1.name and t2.prevdoc_docname = %s and t1.docstatus = 1",self.doc.name)
 		if submit_mv:
 			msgprint("Maintenance Visit : " + cstr(submit_mv[0][0]) + " has already been submitted against " +cstr(self.doc.doctype)+ ". Please cancel Maintenance Visit : " + cstr(submit_mv[0][0]) + " first and then cancel "+ cstr(self.doc.doctype), raise_exception = 1)
 
@@ -508,7 +502,3 @@
 	def on_update(self):
 		pass
 
-	# Repair Sales Order
-	# ===========================================
-	def repair_sales_order(self):
-		get_obj('Sales Common', 'Sales Common').repair_curr_doctype_details(self)
diff --git a/erpnext/selling/doctype/sales_order/sales_order.txt b/erpnext/selling/doctype/sales_order/sales_order.txt
index 7a11bda..af3d9b5 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.txt
+++ b/erpnext/selling/doctype/sales_order/sales_order.txt
@@ -3,30 +3,22 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:21',
+		'creation': '2012-04-11 13:18:19',
 		'docstatus': 0,
-		'modified': '2012-03-02 14:34:02',
+		'modified': '2012-04-13 11:32:08',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
 
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Sales Order',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
 	# These values are common for all DocType
 	{
 		'_last_update': u'1330670942',
-		'allow_attach': 0,
+		'allow_attach': 1,
 		'colour': u'White:FFF',
 		'default_print_format': u'Standard',
 		'doctype': 'DocType',
 		'document_type': u'Transaction',
+		'is_submittable': 1,
 		'is_transaction_doc': 1,
 		'issingle': 0,
 		'module': u'Selling',
@@ -38,15 +30,15 @@
 		'show_in_menu': 0,
 		'subject': u'From %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s | %(per_delivered)s% delivered | %(per_billed)s% billed',
 		'tag_fields': u'delivery_status,billing_status',
-		'version': 631
+		'version': 633
 	},
 
-	# These values are common for all DocFormat
+	# These values are common for all DocField
 	{
-		'doctype': u'DocFormat',
+		'doctype': u'DocField',
 		'name': '__common__',
 		'parent': u'Sales Order',
-		'parentfield': u'formats',
+		'parentfield': u'fields',
 		'parenttype': u'DocType'
 	},
 
@@ -68,13 +60,6 @@
 
 	# DocPerm
 	{
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Production Manager'
-	},
-
-	# DocPerm
-	{
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
@@ -175,28 +160,11 @@
 		'role': u'Maintenance User'
 	},
 
-	# DocFormat
-	{
-		'doctype': u'DocFormat',
-		'format': u'Sales Order Classic'
-	},
-
-	# DocFormat
-	{
-		'doctype': u'DocFormat',
-		'format': u'Sales Order Modern'
-	},
-
-	# DocFormat
-	{
-		'doctype': u'DocFormat',
-		'format': u'Sales Order Spartan'
-	},
-
 	# DocField
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'basic_info',
 		'fieldtype': u'Section Break',
 		'label': u'Basic Info',
 		'oldfieldtype': u'Section Break',
@@ -207,6 +175,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'in_filter': 0,
 		'oldfieldtype': u'Column Break',
@@ -355,6 +324,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break1',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -581,6 +551,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'items',
 		'fieldtype': u'Section Break',
 		'label': u'Items',
 		'oldfieldtype': u'Section Break',
@@ -634,6 +605,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break2',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'width': u'50%'
@@ -715,8 +687,9 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'pull_quotation_details',
 		'fieldtype': u'Button',
-		'label': u'Pull Quotation Details',
+		'label': u'Pull Quotation Items',
 		'oldfieldtype': u'Button',
 		'options': u'pull_quotation_details',
 		'permlevel': 0,
@@ -726,6 +699,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'section_break0',
 		'fieldtype': u'Section Break',
 		'permlevel': 0
 	},
@@ -737,10 +711,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'sales_order_details',
 		'fieldtype': u'Table',
-		'label': u'Sales Order Details',
+		'label': u'Sales Order Items',
 		'oldfieldname': u'sales_order_details',
 		'oldfieldtype': u'Table',
-		'options': u'Sales Order Detail',
+		'options': u'Sales Order Item',
 		'permlevel': 0,
 		'print_hide': 0,
 		'width': u'40px'
@@ -749,6 +723,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'clear_table',
 		'fieldtype': u'Button',
 		'label': u'Clear Table',
 		'oldfieldtype': u'Button',
@@ -760,6 +735,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'recalculate_values',
 		'fieldtype': u'Button',
 		'label': u'Re-Calculate Values',
 		'oldfieldtype': u'Button',
@@ -787,6 +763,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'taxes',
 		'fieldtype': u'Section Break',
 		'label': u'Taxes',
 		'oldfieldtype': u'Section Break',
@@ -799,10 +776,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'charge',
 		'fieldtype': u'Link',
-		'label': u'Select Charges Master',
+		'label': u'Sales Taxes and Charges',
 		'oldfieldname': u'charge',
 		'oldfieldtype': u'Link',
-		'options': u'Other Charges',
+		'options': u'Sales Taxes and Charges Master',
 		'permlevel': 0,
 		'print_hide': 1
 	},
@@ -810,8 +787,9 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'get_charges',
 		'fieldtype': u'Button',
-		'label': u'Get Charges',
+		'label': u'Get Taxes and Charges',
 		'oldfieldtype': u'Button',
 		'permlevel': 0,
 		'trigger': u'Client'
@@ -822,18 +800,19 @@
 		'doctype': u'DocField',
 		'fieldname': u'other_charges',
 		'fieldtype': u'Table',
-		'label': u'Other Charges',
+		'label': u'Sales Taxes and Charges',
 		'oldfieldname': u'other_charges',
 		'oldfieldtype': u'Table',
-		'options': u'RV Tax Detail',
+		'options': u'Sales Taxes and Charges',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'calculate_charges',
 		'fieldtype': u'Button',
-		'label': u'Calculate Charges',
+		'label': u'Calculate Taxes and Charges',
 		'oldfieldtype': u'Button',
 		'permlevel': 0,
 		'print_hide': 0,
@@ -845,7 +824,7 @@
 		'doctype': u'DocField',
 		'fieldname': u'other_charges_total',
 		'fieldtype': u'Currency',
-		'label': u'Charges Total*',
+		'label': u'Taxes and Charges Total*',
 		'oldfieldname': u'other_charges_total',
 		'oldfieldtype': u'Currency',
 		'permlevel': 1,
@@ -856,8 +835,9 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'other_charges_calculation',
 		'fieldtype': u'HTML',
-		'label': u'Other Charges Calculation',
+		'label': u'Taxes and Charges Calculation',
 		'oldfieldtype': u'HTML',
 		'permlevel': 0,
 		'print_hide': 0
@@ -867,6 +847,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'totals',
 		'fieldtype': u'Section Break',
 		'label': u'Totals',
 		'oldfieldtype': u'Section Break',
@@ -919,6 +900,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break3',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -971,8 +953,9 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'terms_section_break',
 		'fieldtype': u'Section Break',
-		'label': u'Terms',
+		'label': u'Terms and Conditions',
 		'oldfieldtype': u'Section Break',
 		'permlevel': 0,
 		'print_hide': 0
@@ -983,10 +966,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'tc_name',
 		'fieldtype': u'Link',
-		'label': u'Select Terms',
+		'label': u'Select Terms and Conditions',
 		'oldfieldname': u'tc_name',
 		'oldfieldtype': u'Link',
-		'options': u'Term',
+		'options': u'Terms and Conditions',
 		'permlevel': 0,
 		'print_hide': 1,
 		'search_index': 0
@@ -995,8 +978,9 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'get_terms',
 		'fieldtype': u'Button',
-		'label': u'Get Terms',
+		'label': u'Get Terms and Conditions',
 		'oldfieldtype': u'Button',
 		'options': u'get_tc_details',
 		'permlevel': 0,
@@ -1006,8 +990,9 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'terms_html',
 		'fieldtype': u'HTML',
-		'label': u'Terms HTML',
+		'label': u'Terms and Conditions HTML',
 		'oldfieldtype': u'HTML',
 		'options': u'You can add Terms and Notes that will be printed in the Transaction',
 		'permlevel': 0,
@@ -1019,7 +1004,7 @@
 		'doctype': u'DocField',
 		'fieldname': u'terms',
 		'fieldtype': u'Text Editor',
-		'label': u'Term Details',
+		'label': u'Terms and Conditions Details',
 		'oldfieldname': u'terms',
 		'oldfieldtype': u'Text Editor',
 		'permlevel': 0,
@@ -1031,6 +1016,7 @@
 		'colour': u'White:FFF',
 		'description': u'Filling in additional information about the Sales Order will help you analyze your data better.',
 		'doctype': u'DocField',
+		'fieldname': u'more_info',
 		'fieldtype': u'Section Break',
 		'label': u'More Info',
 		'oldfieldtype': u'Section Break',
@@ -1041,6 +1027,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break4',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -1097,6 +1084,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break5',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -1204,6 +1192,7 @@
 		'colour': u'White:FFF',
 		'description': u'Display all the individual items delivered with the main items',
 		'doctype': u'DocField',
+		'fieldname': u'packing_list',
 		'fieldtype': u'Section Break',
 		'hidden': 0,
 		'label': u'Packing List',
@@ -1221,7 +1210,7 @@
 		'label': u'Packing Details',
 		'oldfieldname': u'packing_details',
 		'oldfieldtype': u'Table',
-		'options': u'Delivery Note Packing Detail',
+		'options': u'Delivery Note Packing Item',
 		'permlevel': 1,
 		'print_hide': 1
 	},
@@ -1229,6 +1218,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'sales_team_section_break',
 		'fieldtype': u'Section Break',
 		'label': u'Sales Team',
 		'oldfieldtype': u'Section Break',
@@ -1239,6 +1229,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break6',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'print_hide': 1,
@@ -1267,6 +1258,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break7',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'print_hide': 1,
@@ -1303,6 +1295,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'section_break1',
 		'fieldtype': u'Section Break',
 		'options': u'Simple',
 		'permlevel': 0,
@@ -1324,13 +1317,13 @@
 
 	# DocField
 	{
-		'allow_on_submit': 1,
 		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Repair Sales Order',
-		'oldfieldtype': u'Button',
-		'options': u'repair_sales_order',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
+		'hidden': 1,
+		'label': u'File List',
+		'no_copy': 1,
 		'permlevel': 0,
 		'print_hide': 1
 	}
-]
+]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_order_detail/sales_order_detail.txt b/erpnext/selling/doctype/sales_order_detail/sales_order_detail.txt
deleted file mode 100644
index c0a01f1..0000000
--- a/erpnext/selling/doctype/sales_order_detail/sales_order_detail.txt
+++ /dev/null
@@ -1,433 +0,0 @@
-# DocType, Sales Order Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:22',
-		'docstatus': 0,
-		'modified': '2012-03-05 14:59:43',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': u'SOD/.#####',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': u'Selling',
-		'name': '__common__',
-		'section_style': u'Tray',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 54
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Sales Order Detail',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# DocType, Sales Order Detail
-	{
-		'doctype': 'DocType',
-		'name': u'Sales Order Detail'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_code',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Item Code',
-		'oldfieldname': u'item_code',
-		'oldfieldtype': u'Link',
-		'options': u'Item',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': u'Client',
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_name',
-		'fieldtype': u'Data',
-		'label': u'Item Name',
-		'oldfieldname': u'item_name',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'width': u'150'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'description',
-		'fieldtype': u'Small Text',
-		'in_filter': 1,
-		'label': u'Description',
-		'oldfieldname': u'description',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'width': u'300px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'qty',
-		'fieldtype': u'Currency',
-		'label': u'Quantity',
-		'oldfieldname': u'qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'stock_uom',
-		'fieldtype': u'Data',
-		'hidden': 0,
-		'label': u'UOM',
-		'oldfieldname': u'stock_uom',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'reqd': 0,
-		'width': u'70px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'ref_rate',
-		'fieldtype': u'Currency',
-		'label': u'Price List Rate',
-		'oldfieldname': u'ref_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 0,
-		'trigger': u'Client',
-		'width': u'70px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'adj_rate',
-		'fieldtype': u'Float',
-		'label': u'Discount(%)',
-		'oldfieldname': u'adj_rate',
-		'oldfieldtype': u'Float',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client',
-		'width': u'70px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'export_rate',
-		'fieldtype': u'Currency',
-		'label': u'Rate',
-		'oldfieldname': u'export_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'reqd': 0,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'export_amount',
-		'fieldtype': u'Currency',
-		'label': u'Amount',
-		'no_copy': 0,
-		'oldfieldname': u'export_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'reqd': 0,
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'base_ref_rate',
-		'fieldtype': u'Currency',
-		'label': u'Price List Rate*',
-		'oldfieldname': u'base_ref_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'basic_rate',
-		'fieldtype': u'Currency',
-		'label': u'Basic Rate*',
-		'oldfieldname': u'basic_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 0,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'amount',
-		'fieldtype': u'Currency',
-		'label': u'Amount*',
-		'no_copy': 0,
-		'oldfieldname': u'amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'reqd': 0,
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'reserved_warehouse',
-		'fieldtype': u'Link',
-		'label': u'Reserved Warehouse',
-		'no_copy': 1,
-		'oldfieldname': u'reserved_warehouse',
-		'oldfieldtype': u'Link',
-		'options': u'Warehouse',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 0,
-		'trigger': u'Client',
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'projected_qty',
-		'fieldtype': u'Currency',
-		'hidden': 1,
-		'label': u'Projected Qty',
-		'no_copy': 1,
-		'oldfieldname': u'projected_qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': u'70px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'actual_qty',
-		'fieldtype': u'Currency',
-		'label': u'Actual Qty',
-		'no_copy': 1,
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': u'70px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'delivered_qty',
-		'fieldtype': u'Currency',
-		'hidden': 0,
-		'in_filter': 0,
-		'label': u'Delivered Qty',
-		'no_copy': 1,
-		'oldfieldname': u'delivered_qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 0,
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'billed_amt',
-		'fieldtype': u'Currency',
-		'label': u'Billed Amt',
-		'no_copy': 1,
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'For Production',
-		'doctype': u'DocField',
-		'fieldname': u'planned_qty',
-		'fieldtype': u'Currency',
-		'hidden': 1,
-		'label': u'Planned Quantity',
-		'no_copy': 1,
-		'oldfieldname': u'planned_qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'report_hide': 1,
-		'width': u'50px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'For Production',
-		'doctype': u'DocField',
-		'fieldname': u'produced_qty',
-		'fieldtype': u'Currency',
-		'hidden': 1,
-		'label': u'Produced Quantity',
-		'oldfieldname': u'produced_qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'report_hide': 1,
-		'width': u'50px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'brand',
-		'fieldtype': u'Link',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'Brand Name',
-		'oldfieldname': u'brand',
-		'oldfieldtype': u'Link',
-		'options': u'Brand',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'item_group',
-		'fieldtype': u'Link',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'Item Group',
-		'oldfieldname': u'item_group',
-		'oldfieldtype': u'Link',
-		'options': u'Item Group',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_docname',
-		'fieldtype': u'Link',
-		'hidden': 0,
-		'in_filter': 1,
-		'label': u'Quotation No.',
-		'oldfieldname': u'prevdoc_docname',
-		'oldfieldtype': u'Link',
-		'options': u'Quotation',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'page_break',
-		'fieldtype': u'Check',
-		'label': u'Page Break',
-		'oldfieldname': u'page_break',
-		'oldfieldtype': u'Check',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'item_tax_rate',
-		'fieldtype': u'Small Text',
-		'hidden': 1,
-		'label': u'Item Tax Rate',
-		'oldfieldname': u'item_tax_rate',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 1,
-		'print_hide': 1,
-		'report_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'The date at which current entry is made in system.',
-		'doctype': u'DocField',
-		'fieldname': u'transaction_date',
-		'fieldtype': u'Date',
-		'hidden': 1,
-		'in_filter': 0,
-		'label': u'Sales Order Date',
-		'oldfieldname': u'transaction_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 1,
-		'print_hide': 1,
-		'report_hide': 1,
-		'search_index': 0
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_order_detail/__init__.py b/erpnext/selling/doctype/sales_order_item/__init__.py
similarity index 100%
rename from erpnext/selling/doctype/sales_order_detail/__init__.py
rename to erpnext/selling/doctype/sales_order_item/__init__.py
diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.txt b/erpnext/selling/doctype/sales_order_item/sales_order_item.txt
new file mode 100644
index 0000000..854d2f9
--- /dev/null
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.txt
@@ -0,0 +1,433 @@
+# DocType, Sales Order Item
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:15',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:15',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'SOD/.#####',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Selling',
+		'name': '__common__',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 54
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Sales Order Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Sales Order Item
+	{
+		'doctype': 'DocType',
+		'name': u'Sales Order Item'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': u'Client',
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_name',
+		'fieldtype': u'Data',
+		'label': u'Item Name',
+		'oldfieldname': u'item_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'width': u'150'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Small Text',
+		'in_filter': 1,
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 1,
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'qty',
+		'fieldtype': u'Currency',
+		'label': u'Quantity',
+		'oldfieldname': u'qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'reqd': 1,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'stock_uom',
+		'fieldtype': u'Data',
+		'hidden': 0,
+		'label': u'UOM',
+		'oldfieldname': u'stock_uom',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'reqd': 0,
+		'width': u'70px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'ref_rate',
+		'fieldtype': u'Currency',
+		'label': u'Price List Rate',
+		'oldfieldname': u'ref_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 0,
+		'trigger': u'Client',
+		'width': u'70px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'adj_rate',
+		'fieldtype': u'Float',
+		'label': u'Discount(%)',
+		'oldfieldname': u'adj_rate',
+		'oldfieldtype': u'Float',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client',
+		'width': u'70px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'export_rate',
+		'fieldtype': u'Currency',
+		'label': u'Rate',
+		'oldfieldname': u'export_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'reqd': 0,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'export_amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount',
+		'no_copy': 0,
+		'oldfieldname': u'export_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'reqd': 0,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'base_ref_rate',
+		'fieldtype': u'Currency',
+		'label': u'Price List Rate*',
+		'oldfieldname': u'base_ref_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'basic_rate',
+		'fieldtype': u'Currency',
+		'label': u'Basic Rate*',
+		'oldfieldname': u'basic_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 0,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount*',
+		'no_copy': 0,
+		'oldfieldname': u'amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'reqd': 0,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'reserved_warehouse',
+		'fieldtype': u'Link',
+		'label': u'Reserved Warehouse',
+		'no_copy': 1,
+		'oldfieldname': u'reserved_warehouse',
+		'oldfieldtype': u'Link',
+		'options': u'Warehouse',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 0,
+		'trigger': u'Client',
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'projected_qty',
+		'fieldtype': u'Currency',
+		'hidden': 1,
+		'label': u'Projected Qty',
+		'no_copy': 1,
+		'oldfieldname': u'projected_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'70px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'actual_qty',
+		'fieldtype': u'Currency',
+		'label': u'Actual Qty',
+		'no_copy': 1,
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'70px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'delivered_qty',
+		'fieldtype': u'Currency',
+		'hidden': 0,
+		'in_filter': 0,
+		'label': u'Delivered Qty',
+		'no_copy': 1,
+		'oldfieldname': u'delivered_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 0,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'billed_amt',
+		'fieldtype': u'Currency',
+		'label': u'Billed Amt',
+		'no_copy': 1,
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'For Production',
+		'doctype': u'DocField',
+		'fieldname': u'planned_qty',
+		'fieldtype': u'Currency',
+		'hidden': 1,
+		'label': u'Planned Quantity',
+		'no_copy': 1,
+		'oldfieldname': u'planned_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'width': u'50px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'For Production',
+		'doctype': u'DocField',
+		'fieldname': u'produced_qty',
+		'fieldtype': u'Currency',
+		'hidden': 1,
+		'label': u'Produced Quantity',
+		'oldfieldname': u'produced_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'width': u'50px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'brand',
+		'fieldtype': u'Link',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Brand Name',
+		'oldfieldname': u'brand',
+		'oldfieldtype': u'Link',
+		'options': u'Brand',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'item_group',
+		'fieldtype': u'Link',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Item Group',
+		'oldfieldname': u'item_group',
+		'oldfieldtype': u'Link',
+		'options': u'Item Group',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_docname',
+		'fieldtype': u'Link',
+		'hidden': 0,
+		'in_filter': 1,
+		'label': u'Quotation No.',
+		'oldfieldname': u'prevdoc_docname',
+		'oldfieldtype': u'Link',
+		'options': u'Quotation',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'doctype': u'DocField',
+		'fieldname': u'page_break',
+		'fieldtype': u'Check',
+		'label': u'Page Break',
+		'oldfieldname': u'page_break',
+		'oldfieldtype': u'Check',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'item_tax_rate',
+		'fieldtype': u'Small Text',
+		'hidden': 1,
+		'label': u'Item Tax Rate',
+		'oldfieldname': u'item_tax_rate',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'The date at which current entry is made in system.',
+		'doctype': u'DocField',
+		'fieldname': u'transaction_date',
+		'fieldtype': u'Date',
+		'hidden': 1,
+		'in_filter': 0,
+		'label': u'Sales Order Date',
+		'oldfieldname': u'transaction_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'search_index': 0
+	}
+]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_team/sales_team.txt b/erpnext/selling/doctype/sales_team/sales_team.txt
index 9f3c50d..ca1dbac 100644
--- a/erpnext/selling/doctype/sales_team/sales_team.txt
+++ b/erpnext/selling/doctype/sales_team/sales_team.txt
@@ -3,133 +3,126 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:23',
+		'creation': '2012-03-27 14:36:17',
 		'docstatus': 0,
-		'modified': '2010-11-24 09:09:57',
-		'modified_by': 'nabin@webnotestech.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:17',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Selling',
+		'module': u'Selling',
 		'name': '__common__',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 5
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Sales Team',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Sales Team',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# DocType, Sales Team
 	{
 		'doctype': 'DocType',
-		'name': 'Sales Team'
+		'name': u'Sales Team'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'sales_person',
-		'fieldtype': 'Link',
-		'idx': 1,
+		'doctype': u'DocField',
+		'fieldname': u'sales_person',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Sales Person',
-		'oldfieldname': 'sales_person',
-		'oldfieldtype': 'Link',
-		'options': 'Sales Person',
+		'label': u'Sales Person',
+		'oldfieldname': u'sales_person',
+		'oldfieldtype': u'Link',
+		'options': u'Sales Person',
 		'reqd': 1,
 		'search_index': 1,
-		'width': '200px'
+		'width': u'200px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'sales_designation',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Designation',
-		'oldfieldname': 'sales_designation',
-		'oldfieldtype': 'Data',
-		'width': '100px'
+		'doctype': u'DocField',
+		'fieldname': u'sales_designation',
+		'fieldtype': u'Data',
+		'label': u'Designation',
+		'oldfieldname': u'sales_designation',
+		'oldfieldtype': u'Data',
+		'width': u'100px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'contact_no',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'contact_no',
+		'fieldtype': u'Data',
 		'hidden': 1,
-		'idx': 3,
-		'label': 'Contact No.',
-		'oldfieldname': 'contact_no',
-		'oldfieldtype': 'Data',
-		'width': '100px'
+		'label': u'Contact No.',
+		'oldfieldname': u'contact_no',
+		'oldfieldtype': u'Data',
+		'width': u'100px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'allocated_percentage',
-		'fieldtype': 'Currency',
-		'idx': 4,
-		'label': 'Allocated (%)',
-		'oldfieldname': 'allocated_percentage',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'allocated_percentage',
+		'fieldtype': u'Currency',
+		'label': u'Allocated (%)',
+		'oldfieldname': u'allocated_percentage',
+		'oldfieldtype': u'Currency',
 		'reqd': 0,
-		'trigger': 'Client',
-		'width': '100px'
+		'trigger': u'Client',
+		'width': u'100px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'allocated_amount',
-		'fieldtype': 'Currency',
-		'idx': 5,
-		'label': 'Allocated Amount',
-		'oldfieldname': 'allocated_amount',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'allocated_amount',
+		'fieldtype': u'Currency',
+		'label': u'Allocated Amount',
+		'oldfieldname': u'allocated_amount',
+		'oldfieldtype': u'Currency',
 		'reqd': 0,
-		'width': '120px'
+		'width': u'120px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'parenttype',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'parenttype',
+		'fieldtype': u'Data',
 		'hidden': 1,
-		'idx': 6,
 		'in_filter': 1,
-		'label': 'Parenttype',
-		'oldfieldname': 'parenttype',
-		'oldfieldtype': 'Data',
+		'label': u'Parenttype',
+		'oldfieldname': u'parenttype',
+		'oldfieldtype': u'Data',
 		'print_hide': 1,
 		'search_index': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'incentives',
-		'fieldtype': 'Currency',
-		'idx': 7,
-		'label': 'Incentives',
-		'oldfieldname': 'incentives',
-		'oldfieldtype': 'Currency'
+		'doctype': u'DocField',
+		'fieldname': u'incentives',
+		'fieldtype': u'Currency',
+		'label': u'Incentives',
+		'oldfieldname': u'incentives',
+		'oldfieldtype': u'Currency'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/shipping_address/shipping_address.txt b/erpnext/selling/doctype/shipping_address/shipping_address.txt
index b101616..b1b3370 100755
--- a/erpnext/selling/doctype/shipping_address/shipping_address.txt
+++ b/erpnext/selling/doctype/shipping_address/shipping_address.txt
@@ -3,191 +3,179 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-03-23 10:39:45',
+		'creation': '2012-03-27 14:36:17',
 		'docstatus': 0,
-		'modified': '2011-03-24 10:39:09',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:17',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
 		'allow_trash': 1,
-		'autoname': 'SA.#####',
-		'colour': 'White:FFF',
+		'autoname': u'SA.#####',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'Selling',
+		'document_type': u'Master',
+		'module': u'Selling',
 		'name': '__common__',
-		'search_fields': 'customer, ship_to, shipping_address',
-		'section_style': 'Simple',
+		'search_fields': u'customer, ship_to, shipping_address',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
 		'version': 8
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Shipping Address',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Shipping Address',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Shipping Address',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Shipping Address',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Shipping Address
 	{
 		'doctype': 'DocType',
-		'name': 'Shipping Address'
+		'name': u'Shipping Address'
 	},
 
 	# DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Sales Master Manager',
+		'role': u'Sales Master Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Sales Master Manager'
+		'role': u'Sales Master Manager'
 	},
 
 	# DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 3,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Sales Manager',
+		'role': u'Sales Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 4,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Sales Manager'
+		'role': u'Sales Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 1,
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'customer',
-		'fieldtype': 'Link',
-		'idx': 2,
-		'label': 'Customer',
-		'options': 'Customer',
+		'doctype': u'DocField',
+		'fieldname': u'customer',
+		'fieldtype': u'Link',
+		'label': u'Customer',
+		'options': u'Customer',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'customer_name',
-		'fieldtype': 'Data',
-		'idx': 3,
-		'label': 'Customer Name',
+		'doctype': u'DocField',
+		'fieldname': u'customer_name',
+		'fieldtype': u'Data',
+		'label': u'Customer Name',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'customer_address',
-		'fieldtype': 'Text',
-		'idx': 4,
-		'label': 'Customer Address',
+		'doctype': u'DocField',
+		'fieldname': u'customer_address',
+		'fieldtype': u'Text',
+		'label': u'Customer Address',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'ship_to',
-		'fieldtype': 'Data',
-		'idx': 5,
-		'label': 'Ship To',
+		'doctype': u'DocField',
+		'fieldname': u'ship_to',
+		'fieldtype': u'Data',
+		'label': u'Ship To',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'shipping_address',
-		'fieldtype': 'Text',
-		'idx': 6,
-		'label': 'Shipping Address',
+		'doctype': u'DocField',
+		'fieldname': u'shipping_address',
+		'fieldtype': u'Text',
+		'label': u'Shipping Address',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 7,
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'is_primary_address',
-		'fieldtype': 'Select',
-		'idx': 8,
-		'label': 'Is Primary Address',
-		'options': 'Yes\nNo',
+		'doctype': u'DocField',
+		'fieldname': u'is_primary_address',
+		'fieldtype': u'Select',
+		'label': u'Is Primary Address',
+		'options': u'Yes\nNo',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'shipping_details',
-		'fieldtype': 'Text Editor',
-		'idx': 9,
-		'label': 'Shipping Details',
+		'doctype': u'DocField',
+		'fieldname': u'shipping_details',
+		'fieldtype': u'Text Editor',
+		'label': u'Shipping Details',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 10,
-		'label': 'Trash Reason',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
 		'permlevel': 1
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sms_center/sms_center.js b/erpnext/selling/doctype/sms_center/sms_center.js
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/selling/doctype/sms_center/sms_center.js
+++ /dev/null
diff --git a/erpnext/selling/doctype/sms_center/sms_center.txt b/erpnext/selling/doctype/sms_center/sms_center.txt
index cb0a8d8..d80787a 100644
--- a/erpnext/selling/doctype/sms_center/sms_center.txt
+++ b/erpnext/selling/doctype/sms_center/sms_center.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-01-11 17:52:26',
+		'creation': '2012-03-27 14:36:17',
 		'docstatus': 0,
-		'modified': '2012-03-21 13:06:26',
+		'modified': '2012-03-27 14:36:17',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -142,6 +142,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'create_receiver_list',
 		'fieldtype': u'Button',
 		'label': u'Create Receiver List',
 		'options': u'create_receiver_list'
@@ -176,6 +177,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'send_sms',
 		'fieldtype': u'Button',
 		'label': u'Send SMS',
 		'options': u'send_sms'
diff --git a/erpnext/selling/page/sales_browser/sales_browser.css b/erpnext/selling/page/sales_browser/sales_browser.css
new file mode 100644
index 0000000..38b8e96
--- /dev/null
+++ b/erpnext/selling/page/sales_browser/sales_browser.css
@@ -0,0 +1,14 @@
+span.tree-node-toolbar {
+	padding: 2px;
+	margin-left: 15px;
+	border-radius: 3px;
+	-moz-border-radius: 3px;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+	background-color: #ddd;
+}
+
+.tree-area a.selected {
+	font-weight: bold;
+	text-decoration: underline;
+}
diff --git a/erpnext/selling/page/sales_browser/sales_browser.html b/erpnext/selling/page/sales_browser/sales_browser.html
index 1acb5ee..4683a07 100644
--- a/erpnext/selling/page/sales_browser/sales_browser.html
+++ b/erpnext/selling/page/sales_browser/sales_browser.html
@@ -1,4 +1,11 @@
-<div class="layout_wrapper">
-<div id="tr_header"></div>
-<div id="tr_body" style="margin: 16px"></div>
+<div class="layout-wrapper layout-wrapper-background">
+	<div class="appframe-area"></div>
+	<div class="layout-main-section">
+		<div class="tree-area"></div>
+	</div>
+	<div class="layout-side-section">
+		<div class="help">To add child nodes, explore tree and click on the node under which you want to add more nodes.
+		</div>
+	</div>
+	<div class="clear"></div>
 </div>
\ No newline at end of file
diff --git a/erpnext/selling/page/sales_browser/sales_browser.js b/erpnext/selling/page/sales_browser/sales_browser.js
index b079515..4d5a3dc 100644
--- a/erpnext/selling/page/sales_browser/sales_browser.js
+++ b/erpnext/selling/page/sales_browser/sales_browser.js
@@ -14,6 +14,123 @@
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+pscript['onload_Sales Browser'] = function(wrapper){
+	wn.require('lib/js/wn/ui/tree.js');
+	wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
+	wrapper.appframe.add_button('Refresh', function() {  
+			wrapper.make_tree();
+		}, 'icon-refresh');
+
+	wrapper.make_tree = function() {
+		var ctype = wn.get_route()[1] || 'Territory';
+		erpnext.sales_chart = new erpnext.SalesChart(ctype, wrapper);
+	}
+	
+	wrapper.make_tree();
+}
+
+pscript['onshow_Sales Browser'] = function(wrapper){
+	// set route
+	var ctype = wn.get_route()[1] || 'Territory';
+	wrapper.appframe.title(ctype + ' Tree');  
+
+	if(erpnext.sales_chart && erpnext.sales_chart.ctype != ctype) {
+		wrapper.make_tree();
+	}
+};
+
+erpnext.SalesChart = Class.extend({
+	init: function(ctype, wrapper) {
+		var root_nodes = {
+			'Territory': 'All Territories',
+			'Item Group': 'All Item Groups',
+			'Customer Group': 'All Customer Groups',
+			'Sales Person': 'All Sales Persons'
+		}
+		
+		$(wrapper).find('.tree-area').empty();
+		var me = this;
+		me.ctype = ctype;
+		this.tree = new wn.ui.Tree({
+			parent: $(wrapper).find('.tree-area'), 
+			label: root_nodes[ctype],
+			args: {ctype: ctype},
+			method: 'selling.page.sales_browser.sales_browser.get_children',
+			click: function(link) {
+				if(me.cur_toolbar) 
+					$(me.cur_toolbar).toggle(false);
+
+				if(!link.toolbar) 
+					me.make_link_toolbar(link);
+
+				if(link.toolbar) {
+					me.cur_toolbar = link.toolbar;
+					$(me.cur_toolbar).toggle(true);					
+				}
+			}
+		});
+		this.tree.rootnode.$a
+			.data('node-data', {value: root_nodes[ctype], expandable:1})
+			.click();		
+	},
+	make_link_toolbar: function(link) {
+		var data = $(link).data('node-data');
+		if(!data) return;
+
+		link.toolbar = $('<span class="tree-node-toolbar"></span>').insertAfter(link);
+		
+		// edit
+		$('<a href="#!Form/'+encodeURIComponent(this.ctype)+'/'
+			+encodeURIComponent(data.value)+'">Edit</a>').appendTo(link.toolbar);
+
+		if(data.expandable) {
+			link.toolbar.append(' | <a onclick="erpnext.sales_chart.new_node();">Add Child</a>');
+		}
+	},
+	new_node: function() {
+		var me = this;
+
+		// the dialog
+		var d = new wn.ui.Dialog({
+			title:'New ' + me.ctype,
+			fields: [
+				{fieldtype:'Data', fieldname: 'name_field', label:'New ' + me.ctype + ' Name', reqd:true},
+				{fieldtype:'Select', fieldname:'is_group', label:'Group Node',
+					options:'No\nYes', description:'Entries can made only against non-group (leaf) nodes'},
+				{fieldtype:'Button', fieldname:'create_new', label:'Create New' }
+			]
+		})		
+	
+		// create
+		$(d.fields_dict.create_new.input).click(function() {
+			var btn = this;
+			$(btn).set_working();
+			var v = d.get_values();
+			if(!v) return;
+			
+			var node = me.selected_node();
+			
+			v.parent = node.data('label');
+			v.ctype = me.ctype;
+			
+			wn.call({
+				method: 'selling.page.sales_browser.sales_browser.add_node',
+				args: v,
+				callback: function() {
+					$(btn).done_working();
+					d.hide();
+					node.trigger('reload');
+				}	
+			})			
+		});
+		d.show();		
+	},
+	selected_node: function() {
+		return this.tree.$w.find('.tree-link.selected');
+	}
+});
+
+/*
 pscript['onshow_Sales Browser'] = function(){
   wn.require('lib/js/legacy/widgets/tree.js');
 
@@ -49,7 +166,7 @@
     var tr_main_grid = make_table(div_body,1,2,'100%',['60%','40%'],{width: "100%", tableLayout: "fixed", borderCollapse: "collapse", border:"0px", padding:"4px 4px 4px 4px"});
     
     $y($td(tr_main_grid,0,0),{border: "1px solid #dddddd", padding: "8px", width: "60%"});   
-    this.tree_area = $a($td(tr_main_grid,0,0),'div');
+    this.tree_area = $a($td(tr_main_grid,0,0),'div','',{minHeight:'400px'});
 
     $y($td(tr_main_grid,0,1),{border: "1px solid #DDD"});   
     this.detail_area = $a($td(tr_main_grid,0,1),'div');
@@ -397,14 +514,14 @@
         $c_obj('Sales Browser Control',method_name, docstring(arg2), function(r,rt) { 
           me.main_dialog.widgets[me.lbl_rec].value='';
           me.main_dialog.hide();
-          /*if(me.btn_name == "Create"){
-            me.cls_obj.cur_node.clear_child_nodes();
-            me.cls_obj.dtl.innerHTML = '';  
-            me.cls_obj.cur_node.expand();
-          }
-          else{
-            me.cls_obj.refresh_tree();   
-          }*/
+          //if(me.btn_name == "Create"){
+          //  me.cls_obj.cur_node.clear_child_nodes();
+          //  me.cls_obj.dtl.innerHTML = '';  
+          //  me.cls_obj.cur_node.expand();
+          //}
+          //else{
+          //  me.cls_obj.refresh_tree();   
+          //}
           me.cls_obj.refresh_tree(); 
         });
       }
@@ -444,3 +561,4 @@
     return {'node_title':nt,'sales_person_name':nm,'parent_sales_person':pnm,'is_group':grp,'old_parent':old_prt}
 
 }
+*/
\ No newline at end of file
diff --git a/erpnext/selling/page/sales_browser/sales_browser.py b/erpnext/selling/page/sales_browser/sales_browser.py
new file mode 100644
index 0000000..d5419f5
--- /dev/null
+++ b/erpnext/selling/page/sales_browser/sales_browser.py
@@ -0,0 +1,25 @@
+import webnotes
+
+@webnotes.whitelist()
+def get_children():
+	ctype = webnotes.form_dict.get('ctype')
+	webnotes.form_dict['parent_field'] = 'parent_' + ctype.lower().replace(' ', '_')
+	
+	return webnotes.conn.sql("""select name as value, 
+		if(is_group='Yes', 1, 0) as expandable
+		from `tab%(ctype)s`
+		where docstatus < 2
+		and %(parent_field)s = "%(parent)s"
+		order by name""" % webnotes.form_dict, as_dict=1)
+		
+@webnotes.whitelist()
+def add_node():
+	from webnotes.model.doc import Document
+	ctype = webnotes.form_dict.get('ctype')
+	parent_field = 'parent_' + ctype.lower().replace(' ', '_')
+
+	d = Document(ctype)
+	d.fields[ctype.lower().replace(' ', '_') + '_name'] = webnotes.form_dict['name_field']
+	d.fields[parent_field] = webnotes.form_dict['parent']
+	d.is_group = webnotes.form_dict['is_group']
+	d.save()
\ No newline at end of file
diff --git a/erpnext/selling/page/sales_dashboard/sales_dashboard.js b/erpnext/selling/page/sales_dashboard/sales_dashboard.js
index 1af5cb4..e89c7fb 100644
--- a/erpnext/selling/page/sales_dashboard/sales_dashboard.js
+++ b/erpnext/selling/page/sales_dashboard/sales_dashboard.js
@@ -22,8 +22,8 @@
   $dh(pscript.mnt_div1);
   //pscript.dx_axis = [];
 
-	wn.require('lib/css/jqpot.css');
-	wn.require('lib/js/legacy/jquery/jquery.jqplot.min.js');
+	wn.require('lib/css/lib/jqplot.css');
+	wn.require('lib/js/lib/jqplot/jquery.jqplot.min.js');
 	pscript.all_onchnge();
 }
 //=======================================================================
diff --git a/erpnext/selling/page/selling_home/selling_home.html b/erpnext/selling/page/selling_home/selling_home.html
index 4216f43..e686552 100644
--- a/erpnext/selling/page/selling_home/selling_home.html
+++ b/erpnext/selling/page/selling_home/selling_home.html
@@ -1,21 +1,25 @@
 <div class="layout-wrapper layout-wrapper-background">
+	<div class="appframe-area"></div>
 	<div class="layout-main-section">
-		<a class="close" onclick="window.history.back();">&times;</a>
 		<h1>Selling</h1>
 		<hr>
 		<div style="width: 48%; float: left;">
 			<h4><a href="#!List/Lead">Lead</a></h4>
 			<p class="help">Prospective customers</p>
-			<h4><a href="#!List/Enquiry">Enquiry</a></h4>
+			<br>
+			<h4><a href="#!List/Opportunity">Opportunity</a></h4>
 			<p class="help">Business opportunities</p>
+			<br>
 			<h4><a href="#!List/Quotation">Quotation</a></h4>
 			<p class="help">Quotes sent to Leads / Customers</p>
+			<br>
 			<h4><a href="#!List/Sales Order">Sales Order</a></h4>
 			<p class="help">Confirmed orders from Customers</p>	
 		</div>
 		<div style="width: 48%; float: right;">
 			<h4><a href="#!List/Customer">Customer</a></h4>
 			<p class="help">Customer Master</p>
+			<br>
 			<h4><a href="#!List/Item">Item</a></h4>
 			<p class="help">Item Master</p>
 		</div>
@@ -32,7 +36,7 @@
 					<div class="section-item">
 						<a class="section-link" 
 							title = "Tax and charges structure master"
-							href="#!List/Other Charges">Sales Other Charges</a>
+							href="#!List/Sales Taxes and Charges Master">Sales Taxes and Charges Master</a>
 					</div>
 					<div class="section-item">
 						<a class="section-link" 
@@ -47,7 +51,7 @@
 					<div class="section-item">
 						<a class="section-link" 
 							title = "Terms of contract template"
-							href="#!List/Term">Order Terms Template</a>
+							href="#!List/Terms and Conditions">Terms and Conditions Template</a>
 					</div>
 					<div class="section-item">
 						<a class="section-link" 
@@ -82,7 +86,7 @@
 					<div class="section-item">
 						<a class="section-link" 
 							title = "Helper for managing return of goods (sales or purchase)"
-							href="#!Form/Sales and Purchase Return Wizard/Sales and Purchase Return Wizard">Sales Returns</a>
+							href="#!Form/Sales and Purchase Return Tool/Sales and Purchase Return Tool">Sales Returns</a>
 					</div>
 					<div class="section-item">
 						<a class="section-link" 
@@ -99,4 +103,4 @@
 		</div>
 	</div>
 	<div style="clear: both;"></div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/selling/page/selling_home/selling_home.js b/erpnext/selling/page/selling_home/selling_home.js
index e0430d7..2561ee4 100644
--- a/erpnext/selling/page/selling_home/selling_home.js
+++ b/erpnext/selling/page/selling_home/selling_home.js
@@ -15,5 +15,6 @@
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 pscript['onload_selling-home'] = function(wrapper) {
+	wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
 	erpnext.module_page.setup_page('Selling', wrapper);
 }
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.txt b/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.txt
index f63b2cc..52d6d63 100644
--- a/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.txt
+++ b/erpnext/selling/search_criteria/customer_address_contact/customer_address_contact.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-02-23 14:18:56',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2012-02-23 14:18:56',
+		'modified': '2012-04-03 12:49:51',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
diff --git a/erpnext/selling/search_criteria/delivered_items_to_be_install/delivered_items_to_be_install.txt b/erpnext/selling/search_criteria/delivered_items_to_be_install/delivered_items_to_be_install.txt
index fb44274..b3d2359 100644
--- a/erpnext/selling/search_criteria/delivered_items_to_be_install/delivered_items_to_be_install.txt
+++ b/erpnext/selling/search_criteria/delivered_items_to_be_install/delivered_items_to_be_install.txt
@@ -3,35 +3,35 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-03-30 11:03:20',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2011-03-29 14:08:46',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_col': "(`tabDelivery Note Detail`.`qty`- ifnull(`tabDelivery Note Detail`.`installed_qty`, 0)) AS 'Pending to Install'",
-		'add_cond': '`tabDelivery Note Detail`.`qty` > ifnull(`tabDelivery Note Detail`.`installed_qty`, 0)',
-		'columns': 'Delivery Note\x01ID,Delivery Note\x01Status,Delivery Note\x01Customer,Delivery Note\x01Customer Name,Delivery Note\x01Contact Person,Delivery Note\x01Voucher Date,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Item Name,Delivery Note Detail\x01Quantity,Delivery Note Detail\x01Installed Qty,Delivery Note\x01% Installed',
-		'criteria_name': 'Delivered Items to be Install',
-		'description': 'Delivered Items to be Install',
-		'doc_type': 'Delivery Note Detail',
+		'add_col': u"(`tabDelivery Note Item`.`qty`- ifnull(`tabDelivery Note Item`.`installed_qty`, 0)) AS 'Pending to Install'",
+		'add_cond': u'`tabDelivery Note Item`.`qty` > ifnull(`tabDelivery Note Item`.`installed_qty`, 0)',
+		'columns': u'Delivery Note\x01ID,Delivery Note\x01Status,Delivery Note\x01Customer,Delivery Note\x01Customer Name,Delivery Note\x01Contact Person,Delivery Note\x01Voucher Date,Delivery Note Item\x01Item Code,Delivery Note Item\x01Item Name,Delivery Note Item\x01Quantity,Delivery Note Item\x01Installed Qty,Delivery Note\x01% Installed',
+		'criteria_name': u'Delivered Items to be Install',
+		'description': u'Delivered Items to be Install',
+		'doc_type': u'Delivery Note Item',
 		'doctype': 'Search Criteria',
-		'filters': "{'Delivery Note\x01Saved':1,'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01Fiscal Year':''}",
-		'module': 'Selling',
+		'filters': u"{'Delivery Note\x01Saved':1,'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01Fiscal Year':''}",
+		'module': u'Selling',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Delivery Note',
-		'sort_by': '`tabDelivery Note`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Delivery Note',
+		'sort_by': u'`tabDelivery Note`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, delivered_items_to_be_install
 	{
 		'doctype': 'Search Criteria',
-		'name': 'delivered_items_to_be_install'
+		'name': u'delivered_items_to_be_install'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/delivery_note_itemwise_pending_to_bill/delivery_note_itemwise_pending_to_bill.txt b/erpnext/selling/search_criteria/delivery_note_itemwise_pending_to_bill/delivery_note_itemwise_pending_to_bill.txt
index 5351e4e..762aa9e 100644
--- a/erpnext/selling/search_criteria/delivery_note_itemwise_pending_to_bill/delivery_note_itemwise_pending_to_bill.txt
+++ b/erpnext/selling/search_criteria/delivery_note_itemwise_pending_to_bill/delivery_note_itemwise_pending_to_bill.txt
@@ -3,35 +3,35 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:31',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2010-04-06 17:22:13',
-		'modified_by': 'Administrator',
-		'owner': 'jai@webnotestech.com'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'jai@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_col': "SUM(`tabDelivery Note Detail`.`qty` - `tabDelivery Note Detail`.`billed_qty`) AS 'Pending Qty'\nSUM((`tabDelivery Note Detail`.`qty` - `tabDelivery Note Detail`.`billed_qty`) * `tabDelivery Note Detail`.`basic_rate`) AS 'Pending Amount'",
-		'add_cond': "`tabDelivery Note`.status != 'Stopped'\nCASE WHEN `tabDelivery Note`.`per_billed` IS NULL OR `tabDelivery Note`.per_billed = '' THEN 0 < 100 ELSE `tabDelivery Note`.per_billed <100 END",
-		'columns': 'Delivery Note\x01ID,Delivery Note\x01Owner,Delivery Note\x01Status,Delivery Note\x01Customer Name,Delivery Note\x01Voucher Date,Delivery Note\x01% Billed,Delivery Note\x01Posting Date,Delivery Note\x01Company Name,Delivery Note\x01Fiscal Year,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Against Document No,Delivery Note Detail\x01Document Type,Delivery Note Detail\x01Against Document Detail No',
-		'criteria_name': 'Delivery Note Itemwise Pending To Bill',
-		'doc_type': 'Delivery Note Detail',
+		'add_col': u"SUM(`tabDelivery Note Item`.`qty` - `tabDelivery Note Item`.`billed_qty`) AS 'Pending Qty'\nSUM((`tabDelivery Note Item`.`qty` - `tabDelivery Note Item`.`billed_qty`) * `tabDelivery Note Item`.`basic_rate`) AS 'Pending Amount'",
+		'add_cond': u"`tabDelivery Note`.status != 'Stopped'\nCASE WHEN `tabDelivery Note`.`per_billed` IS NULL OR `tabDelivery Note`.per_billed = '' THEN 0 < 100 ELSE `tabDelivery Note`.per_billed <100 END",
+		'columns': u'Delivery Note\x01ID,Delivery Note\x01Owner,Delivery Note\x01Status,Delivery Note\x01Customer Name,Delivery Note\x01Voucher Date,Delivery Note\x01% Billed,Delivery Note\x01Posting Date,Delivery Note\x01Company Name,Delivery Note\x01Fiscal Year,Delivery Note Item\x01Item Code,Delivery Note Item\x01Against Document No,Delivery Note Item\x01Document Type,Delivery Note Item\x01Against Document Detail No',
+		'criteria_name': u'Delivery Note Itemwise Pending To Bill',
+		'doc_type': u'Delivery Note Item',
 		'doctype': 'Search Criteria',
-		'filters': "{'Delivery Note\x01Saved':1,'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01Company Name':'','Delivery Note\x01Fiscal Year':''}",
-		'group_by': '`tabDelivery Note Detail`.item_code, `tabDelivery Note`.`name`',
-		'module': 'Selling',
+		'filters': u"{'Delivery Note\x01Saved':1,'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01Company Name':'','Delivery Note\x01Fiscal Year':''}",
+		'group_by': u'`tabDelivery Note Item`.item_code, `tabDelivery Note`.`name`',
+		'module': u'Selling',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Delivery Note',
-		'sort_by': '`tabDelivery Note`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Delivery Note',
+		'sort_by': u'`tabDelivery Note`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, delivery_note_itemwise_pending_to_bill
 	{
 		'doctype': 'Search Criteria',
-		'name': 'delivery_note_itemwise_pending_to_bill'
+		'name': u'delivery_note_itemwise_pending_to_bill'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/follow_up_report/follow_up_report.js b/erpnext/selling/search_criteria/follow_up_report/follow_up_report.js
index f9c3cba..2126d0b 100644
--- a/erpnext/selling/search_criteria/follow_up_report/follow_up_report.js
+++ b/erpnext/selling/search_criteria/follow_up_report/follow_up_report.js
@@ -19,38 +19,38 @@
   this.mytabs.items['More Filters'].hide()
   
   this.hide_all_filters();
-  this.add_filter({fieldname:'follow_up_on', label:'Follow up on', fieldtype:'Select', options:''+NEWLINE+'Lead'+NEWLINE+'Enquiry'+NEWLINE+'Quotation',ignore : 1,parent:'Follow up', in_first_page : 1, single_select :1});
-  this.add_filter({fieldname:'lead_name', label:'Lead', fieldtype:'Link', options:'Lead', report_default:'', ignore : 1, parent:'Follow up', in_first_page : 1});
-  this.add_filter({fieldname:'enq_name', label:'Enquiry', fieldtype:'Link', options:'Enquiry', report_default:'', ignore : 1, parent:'Follow up', in_first_page : 1});
-  this.add_filter({fieldname:'qtn_name', label:'Quotation', fieldtype:'Link', options:'Quotation', report_default:'', ignore : 1, parent:'Follow up', in_first_page : 1});
+  this.add_filter({fieldname:'follow_up_on', label:'Communication on', fieldtype:'Select', options:''+NEWLINE+'Lead'+NEWLINE+'Opportunity'+NEWLINE+'Quotation',ignore : 1,parent:'Communication Log', in_first_page : 1, single_select :1});
+  this.add_filter({fieldname:'lead_name', label:'Lead', fieldtype:'Link', options:'Lead', report_default:'', ignore : 1, parent:'Communication Log', in_first_page : 1});
+  this.add_filter({fieldname:'enq_name', label:'Opportunity', fieldtype:'Link', options:'Opportunity', report_default:'', ignore : 1, parent:'Communication Log', in_first_page : 1});
+  this.add_filter({fieldname:'qtn_name', label:'Quotation', fieldtype:'Link', options:'Quotation', report_default:'', ignore : 1, parent:'Communication Log', in_first_page : 1});
   
-  this.get_filter('Follow up', 'Follow up type').set_as_single();
-  this.set_filter_properties('Follow up', 'Follow up by', {filter_hide:0, in_first_page : 1});
-  this.set_filter_properties('Follow up', 'Follow up type', {filter_hide:0, in_first_page : 1});
-  this.set_filter_properties('Follow up', 'From Date', {filter_hide:0, in_first_page : 1});
-  this.set_filter_properties('Follow up', 'To Date', {filter_hide:0, in_first_page : 1});
+  this.get_filter('Communication Log', 'Communication type').set_as_single();
+  this.set_filter_properties('Communication Log', 'Communication by', {filter_hide:0, in_first_page : 1});
+  this.set_filter_properties('Communication Log', 'Communication type', {filter_hide:0, in_first_page : 1});
+  this.set_filter_properties('Communication Log', 'From Date', {filter_hide:0, in_first_page : 1});
+  this.set_filter_properties('Communication Log', 'To Date', {filter_hide:0, in_first_page : 1});
 
-  this.orig_sort_list = [['Date','`tabFollow up`.`date`'],['Document Type','`tabFollow up`.`parenttype`'],['Document','`tabFollow up`.`parent`'],['Follow Up By','`tabFollow up`.`follow_up_by`'],['Follow Up Type','`tabFollow up`.`follow_up_type`']];
+  this.orig_sort_list = [['Date','`tabCommunication Log`.`date`'],['Document Type','`tabCommunication Log`.`parenttype`'],['Document','`tabCommunication Log`.`parent`'],['Follow Up By','`tabCommunication Log`.`follow_up_by`'],['Follow Up Type','`tabCommunication Log`.`follow_up_type`']];
 }
 
 
 report.get_query = function() {
-  var lead_id = this.filter_fields_dict['Follow up'+FILTER_SEP+'Lead'].get_value();
-  var enq_id = this.filter_fields_dict['Follow up'+FILTER_SEP+'Enquiry'].get_value();
-  var quo_id = this.filter_fields_dict['Follow up'+FILTER_SEP+'Quotation'].get_value();
+  var lead_id = this.filter_fields_dict['Communication Log'+FILTER_SEP+'Lead'].get_value();
+  var enq_id = this.filter_fields_dict['Communication Log'+FILTER_SEP+'Opportunity'].get_value();
+  var quo_id = this.filter_fields_dict['Communication Log'+FILTER_SEP+'Quotation'].get_value();
 
-  var follow_up_on = this.filter_fields_dict['Follow up'+FILTER_SEP+'Follow up on'].get_value();
-  var follow_up_by = this.filter_fields_dict['Follow up'+FILTER_SEP+'Follow up by'].get_value();
+  var follow_up_on = this.filter_fields_dict['Communication Log'+FILTER_SEP+'Communication on'].get_value();
+  var follow_up_by = this.filter_fields_dict['Communication Log'+FILTER_SEP+'Communication by'].get_value();
 
-  var on_type = this.filter_fields_dict['Follow up'+FILTER_SEP+'Follow up type'].get_value();
-  var from_date = this.filter_fields_dict['Follow up'+FILTER_SEP+'From Date'].get_value();
-  var to_date = this.filter_fields_dict['Follow up'+FILTER_SEP+'To Date'].get_value();
+  var on_type = this.filter_fields_dict['Communication Log'+FILTER_SEP+'Communication type'].get_value();
+  var from_date = this.filter_fields_dict['Communication Log'+FILTER_SEP+'From Date'].get_value();
+  var to_date = this.filter_fields_dict['Communication Log'+FILTER_SEP+'To Date'].get_value();
   
-  var cond = 'parenttype IN ("Lead","Enquiry","Quotation")';
+  var cond = 'parenttype IN ("Lead","Opportunity","Quotation")';
   if(follow_up_on) cond = 'parenttype = "'+follow_up_on+'"';
 
   if((follow_up_on == 'Lead' && lead_id) || (lead_id && !follow_up_on)) cond +=' AND parent = "'+lead_id+'"';
-  if((follow_up_on == 'Enquiry' && enq_id) || (enq_id && !follow_up_on)) cond +=' AND parent = "'+enq_id+'"';
+  if((follow_up_on == 'Opportunity' && enq_id) || (enq_id && !follow_up_on)) cond +=' AND parent = "'+enq_id+'"';
   if((follow_up_on == 'Quotation' && quo_id) || (quo_id && !follow_up_on)) cond +=' AND parent = "'+quo_id+'"';
 
   if(on_type) cond += ' AND follow_up_type ="'+on_type+'"';
@@ -58,6 +58,6 @@
   if(to_date) cond += ' AND date <="'+to_date+'"';
   if(follow_up_by) cond += ' AND follow_up_by = "'+follow_up_by+'"';
 
-  var q ='SELECT distinct `tabFollow up`.`parenttype`, `tabFollow up`.`parent`, `tabFollow up`.`date`, `tabFollow up`.`notes`, `tabFollow up`.`follow_up_type`, `tabFollow up`.`follow_up_by` FROM `tabFollow up` WHERE '+cond+' ORDER BY '+sel_val(this.dt.sort_sel)+' '+this.dt.sort_order;
+  var q ='SELECT distinct `tabCommunication Log`.`parenttype`, `tabCommunication Log`.`parent`, `tabCommunication Log`.`date`, `tabCommunication Log`.`notes`, `tabCommunication Log`.`follow_up_type`, `tabCommunication Log`.`follow_up_by` FROM `tabCommunication Log` WHERE '+cond+' ORDER BY '+sel_val(this.dt.sort_sel)+' '+this.dt.sort_order;
   return q;
 }
diff --git a/erpnext/selling/search_criteria/follow_up_report/follow_up_report.txt b/erpnext/selling/search_criteria/follow_up_report/follow_up_report.txt
index 64271ac..56b547f 100644
--- a/erpnext/selling/search_criteria/follow_up_report/follow_up_report.txt
+++ b/erpnext/selling/search_criteria/follow_up_report/follow_up_report.txt
@@ -3,32 +3,32 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-09-01 15:48:09',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2010-08-12 16:33:19',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'ashwini@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Lead\x01ID,Follow up\x01Date,Follow up\x01Notes,Follow up\x01Follow up type',
-		'criteria_name': 'Follow-up Report',
-		'doc_type': 'Follow up',
+		'columns': u'Lead\x01ID,Communication Log\x01Date,Communication Log\x01Notes,Communication Log\x01Communication Log type',
+		'criteria_name': u'Follow-up Report',
+		'doc_type': u'Communication Log',
 		'doctype': 'Search Criteria',
-		'filters': "{'Lead\x01Status':'','Lead\x01Source':'','Lead\x01Lead Type':'','Lead\x01Rating':'','Lead\x01Market Segment':'','Lead\x01Fiscal Year':''}",
-		'module': 'Selling',
+		'filters': u"{'Lead\x01Status':'','Lead\x01Source':'','Lead\x01Lead Type':'','Lead\x01Rating':'','Lead\x01Market Segment':'','Lead\x01Fiscal Year':''}",
+		'module': u'Selling',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Lead',
-		'sort_by': '`tabLead`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Lead',
+		'sort_by': u'`tabLead`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, follow-up_report
 	{
 		'doctype': 'Search Criteria',
-		'name': 'follow-up_report'
+		'name': u'follow-up_report'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/gross_profit/gross_profit.js b/erpnext/selling/search_criteria/gross_profit/gross_profit.js
index d53c07d..4ad6735 100644
--- a/erpnext/selling/search_criteria/gross_profit/gross_profit.js
+++ b/erpnext/selling/search_criteria/gross_profit/gross_profit.js
@@ -21,12 +21,12 @@
   this.filter_fields_dict['Delivery Note'+FILTER_SEP +'ID'].df.filter_hide = 0;
   this.filter_fields_dict['Delivery Note'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
   this.filter_fields_dict['Delivery Note'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
-  this.filter_fields_dict['Delivery Note Detail'+FILTER_SEP +'Item Code'].df.filter_hide = 0;
+  this.filter_fields_dict['Delivery Note Item'+FILTER_SEP +'Item Code'].df.filter_hide = 0;
   this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
 
   this.filter_fields_dict['Delivery Note'+FILTER_SEP +'ID'].df.in_first_page = 1;
   this.filter_fields_dict['Delivery Note'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
   this.filter_fields_dict['Delivery Note'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
-  this.filter_fields_dict['Delivery Note Detail'+FILTER_SEP +'Item Code'].df.in_first_page = 1;
+  this.filter_fields_dict['Delivery Note Item'+FILTER_SEP +'Item Code'].df.in_first_page = 1;
   this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
 }
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/gross_profit/gross_profit.py b/erpnext/selling/search_criteria/gross_profit/gross_profit.py
index 47ca383..d1b0a86 100644
--- a/erpnext/selling/search_criteria/gross_profit/gross_profit.py
+++ b/erpnext/selling/search_criteria/gross_profit/gross_profit.py
@@ -39,7 +39,7 @@
 
 for r in res:
   tot_val_rate = 0
-  packing_list_items = sql("select item_code, warehouse, qty from `tabDelivery Note Packing Detail` where parent = %s and parent_item = %s", (r[col_idx['ID']], r[col_idx['Item Code']]))
+  packing_list_items = sql("select item_code, warehouse, qty from `tabDelivery Note Packing Item` where parent = %s and parent_item = %s", (r[col_idx['ID']], r[col_idx['Item Code']]))
   for d in packing_list_items:
     if d[1]:
       val_rate = sql("select valuation_rate from `tabStock Ledger Entry` where item_code = %s and warehouse = %s and voucher_type = 'Delivery Note' and voucher_no = %s and is_cancelled = 'No'", (d[0], d[1], r[col_idx['ID']]))
diff --git a/erpnext/selling/search_criteria/gross_profit/gross_profit.txt b/erpnext/selling/search_criteria/gross_profit/gross_profit.txt
index 7675319..b98ced6 100644
--- a/erpnext/selling/search_criteria/gross_profit/gross_profit.txt
+++ b/erpnext/selling/search_criteria/gross_profit/gross_profit.txt
@@ -3,33 +3,33 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 10:23:21',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2010-11-10 12:39:03',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Delivery Note\x01ID,Delivery Note\x01Posting Date,Delivery Note\x01Posting Time,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Item Name,Delivery Note Detail\x01Description,Delivery Note\x01Project Name,Delivery Note Detail\x01Quantity,Delivery Note Detail\x01Rate*,Delivery Note Detail\x01Amount*',
-		'criteria_name': 'Gross Profit',
-		'description': 'Invoice wise',
-		'doc_type': 'Delivery Note Detail',
+		'columns': u'Delivery Note\x01ID,Delivery Note\x01Posting Date,Delivery Note\x01Posting Time,Delivery Note Item\x01Item Code,Delivery Note Item\x01Item Name,Delivery Note Item\x01Description,Delivery Note\x01Project Name,Delivery Note Item\x01Quantity,Delivery Note Item\x01Rate*,Delivery Note Item\x01Amount*',
+		'criteria_name': u'Gross Profit',
+		'description': u'Invoice wise',
+		'doc_type': u'Delivery Note Item',
 		'doctype': 'Search Criteria',
-		'filters': "{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01Fiscal Year':''}",
-		'module': 'Selling',
+		'filters': u"{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01Fiscal Year':''}",
+		'module': u'Selling',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Delivery Note',
-		'sort_by': '`tabDelivery Note`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Delivery Note',
+		'sort_by': u'`tabDelivery Note`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, gross_profit
 	{
 		'doctype': 'Search Criteria',
-		'name': 'gross_profit'
+		'name': u'gross_profit'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/itemwise_delivery_details/itemwise_delivery_details.txt b/erpnext/selling/search_criteria/itemwise_delivery_details/itemwise_delivery_details.txt
index fbba495..894aeee 100644
--- a/erpnext/selling/search_criteria/itemwise_delivery_details/itemwise_delivery_details.txt
+++ b/erpnext/selling/search_criteria/itemwise_delivery_details/itemwise_delivery_details.txt
@@ -3,32 +3,32 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-11-10 15:04:43',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2010-10-26 09:10:53',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Delivery Note\x01ID,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Item Name,Delivery Note Detail\x01Quantity,Delivery Note Detail\x01Rate*,Delivery Note Detail\x01Amount*,Delivery Note Detail\x01Billed Qty,Delivery Note\x01Company',
-		'criteria_name': 'Itemwise Delivery Details',
-		'doc_type': 'Delivery Note Detail',
+		'columns': u'Delivery Note\x01ID,Delivery Note Item\x01Item Code,Delivery Note Item\x01Item Name,Delivery Note Item\x01Quantity,Delivery Note Item\x01Rate*,Delivery Note Item\x01Amount*,Delivery Note Item\x01Billed Qty,Delivery Note\x01Company',
+		'criteria_name': u'Itemwise Delivery Details',
+		'doc_type': u'Delivery Note Item',
 		'doctype': 'Search Criteria',
-		'filters': "{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01From Voucher Date\x01lower':'','Delivery Note\x01To Voucher Date\x01upper':'','Delivery Note\x01Fiscal Year':''}",
-		'module': 'Selling',
+		'filters': u"{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01From Voucher Date\x01lower':'','Delivery Note\x01To Voucher Date\x01upper':'','Delivery Note\x01Fiscal Year':''}",
+		'module': u'Selling',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Delivery Note',
-		'sort_by': '`tabDelivery Note`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Delivery Note',
+		'sort_by': u'`tabDelivery Note`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, itemwise_delivery_details
 	{
 		'doctype': 'Search Criteria',
-		'name': 'itemwise_delivery_details'
+		'name': u'itemwise_delivery_details'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.js b/erpnext/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.js
index 05b2e75..7ff214a 100644
--- a/erpnext/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.js
+++ b/erpnext/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.js
@@ -19,7 +19,7 @@
   this.filter_fields_dict['Sales Order'+FILTER_SEP +'From Sales Order Date'].df['report_default'] = sys_defaults.year_start_date;
   this.filter_fields_dict['Sales Order'+FILTER_SEP +'To Sales Order Date'].df['report_default'] = dateutil.obj_to_str(new Date());
   this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
-  this.filter_fields_dict['Sales Order Detail'+FILTER_SEP +'Item Code'].df.in_first_page = 1;
+  this.filter_fields_dict['Sales Order Item'+FILTER_SEP +'Item Code'].df.in_first_page = 1;
   this.filter_fields_dict['Sales Order'+FILTER_SEP +'Status'].df.filter_hide = 1;
 }
 
diff --git a/erpnext/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.txt b/erpnext/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.txt
index d224693..3566ea9 100644
--- a/erpnext/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.txt
+++ b/erpnext/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.txt
@@ -3,32 +3,32 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-09-01 15:48:09',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2010-08-30 12:22:47',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Sales Order\x01ID,Sales Order\x01Customer,Sales Order Detail\x01Item Code,Sales Order Detail\x01Item Name,Sales Order Detail\x01Quantity,Sales Order Detail\x01Basic Rate*,Sales Order Detail\x01Amount*,Sales Order Detail\x01Delivered Qty,Sales Order Detail\x01Billed Qty,Sales Order\x01Company',
-		'criteria_name': 'Itemwise Sales Details',
-		'doc_type': 'Sales Order Detail',
+		'columns': u'Sales Order\x01ID,Sales Order\x01Customer,Sales Order Item\x01Item Code,Sales Order Item\x01Item Name,Sales Order Item\x01Quantity,Sales Order Item\x01Basic Rate*,Sales Order Item\x01Amount*,Sales Order Item\x01Delivered Qty,Sales Order Item\x01Billed Qty,Sales Order\x01Company',
+		'criteria_name': u'Itemwise Sales Details',
+		'doc_type': u'Sales Order Item',
 		'doctype': 'Search Criteria',
-		'filters': "{'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
-		'module': 'Selling',
+		'filters': u"{'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
+		'module': u'Selling',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Sales Order',
-		'sort_by': '`tabSales Order`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Sales Order',
+		'sort_by': u'`tabSales Order`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, itemwise_sales_details
 	{
 		'doctype': 'Search Criteria',
-		'name': 'itemwise_sales_details'
+		'name': u'itemwise_sales_details'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/lead_to_follow_up/__init__.py b/erpnext/selling/search_criteria/lead_to_follow_up/__init__.py
similarity index 100%
rename from erpnext/home/search_criteria/lead_to_follow_up/__init__.py
rename to erpnext/selling/search_criteria/lead_to_follow_up/__init__.py
diff --git a/erpnext/home/search_criteria/lead_to_follow_up/lead_to_follow_up.js b/erpnext/selling/search_criteria/lead_to_follow_up/lead_to_follow_up.js
similarity index 100%
rename from erpnext/home/search_criteria/lead_to_follow_up/lead_to_follow_up.js
rename to erpnext/selling/search_criteria/lead_to_follow_up/lead_to_follow_up.js
diff --git a/erpnext/selling/search_criteria/lead_to_follow_up/lead_to_follow_up.txt b/erpnext/selling/search_criteria/lead_to_follow_up/lead_to_follow_up.txt
new file mode 100644
index 0000000..3a5c983
--- /dev/null
+++ b/erpnext/selling/search_criteria/lead_to_follow_up/lead_to_follow_up.txt
@@ -0,0 +1,34 @@
+# Search Criteria, lead-to_follow_up
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-04-03 12:49:51',
+		'docstatus': 0,
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all Search Criteria
+	{
+		'add_cond': u"`tabLead`.status!='Converted' \n`tabLead`.status!='Lead Lost' \n`tabLead`.status!='Not Interested'",
+		'columns': u'Lead\x01ID,Lead\x01Status,Lead\x01Lead Name,Lead\x01Lead Date,Lead\x01Lead Owner,Lead\x01Next Contact Date',
+		'criteria_name': u'Lead-To follow up',
+		'doc_type': u'Lead',
+		'doctype': 'Search Criteria',
+		'filters': u"{'Lead\x01Status':'','Lead\x01Source':'','Lead\x01Expected Month':'','Lead\x01Industry':'','Lead\x01Market Segment':'','Lead\x01Rating':''}",
+		'module': u'Selling',
+		'name': '__common__',
+		'page_len': 50,
+		'sort_by': u'`tabLead`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
+	},
+
+	# Search Criteria, lead-to_follow_up
+	{
+		'doctype': 'Search Criteria',
+		'name': u'lead-to_follow_up'
+	}
+]
diff --git a/erpnext/home/search_criteria/lead_to_follow_up/sales_order_overdue.js b/erpnext/selling/search_criteria/lead_to_follow_up/sales_order_overdue.js
similarity index 100%
rename from erpnext/home/search_criteria/lead_to_follow_up/sales_order_overdue.js
rename to erpnext/selling/search_criteria/lead_to_follow_up/sales_order_overdue.js
diff --git a/erpnext/selling/search_criteria/monthly_despatched_trend/monthly_despatched_trend.js b/erpnext/selling/search_criteria/monthly_despatched_trend/monthly_despatched_trend.js
deleted file mode 100644
index ac04e28..0000000
--- a/erpnext/selling/search_criteria/monthly_despatched_trend/monthly_despatched_trend.js
+++ /dev/null
@@ -1,18 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-this.mytabs.items['Select Columns'].hide();
-this.mytabs.items['More Filters'].hide();
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/monthly_despatched_trend/monthly_despatched_trend.py b/erpnext/selling/search_criteria/monthly_despatched_trend/monthly_despatched_trend.py
deleted file mode 100644
index f18ee15..0000000
--- a/erpnext/selling/search_criteria/monthly_despatched_trend/monthly_despatched_trend.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-total = 0.0
-monthlist = ['','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
-for r in res:
-  r[0] = monthlist[r[0]]
-  total += r[1]
-
-colwidths[col_idx['Total Despatched']] = '200px'
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/monthly_despatched_trend/monthly_despatched_trend.txt b/erpnext/selling/search_criteria/monthly_despatched_trend/monthly_despatched_trend.txt
deleted file mode 100644
index 51733dc..0000000
--- a/erpnext/selling/search_criteria/monthly_despatched_trend/monthly_despatched_trend.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-# Search Criteria, monthly_despatched_trend
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:31',
-		'docstatus': 0,
-		'modified': '2010-06-07 15:19:13',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_col': "month(`tabDelivery Note`.posting_date) AS 'Sales Month'\nsum(`tabDelivery Note`.net_total) AS 'Total Despatched'",
-		'add_cond': '`tabDelivery Note`.net_total > 10',
-		'criteria_name': 'Monthly Despatched Trend',
-		'description': 'Monthly Despatched Trend',
-		'doc_type': 'Delivery Note',
-		'doctype': 'Search Criteria',
-		'filters': "{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01Chargeable':'Yes','Delivery Note\x01Department':'','Delivery Note\x01Type':'','Delivery Note\x01Company Name':'Janak Healthcare Pvt Ltd','Delivery Note\x01Fiscal Year':'2009-2010'}",
-		'graph_series': 'Despatched Month',
-		'graph_values': 'Total Despatched',
-		'group_by': 'month(`tabDelivery Note`.Posting_date)',
-		'module': 'Selling',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`Sales Month`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, monthly_despatched_trend
-	{
-		'doctype': 'Search Criteria',
-		'name': 'monthly_despatched_trend'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/monthly_despatched_trend/__init__.py b/erpnext/selling/search_criteria/opportunity_to_follow_up/__init__.py
similarity index 100%
rename from erpnext/selling/search_criteria/monthly_despatched_trend/__init__.py
rename to erpnext/selling/search_criteria/opportunity_to_follow_up/__init__.py
diff --git a/erpnext/selling/search_criteria/opportunity_to_follow_up/opportunity_to_follow_up.txt b/erpnext/selling/search_criteria/opportunity_to_follow_up/opportunity_to_follow_up.txt
new file mode 100644
index 0000000..3ca813b
--- /dev/null
+++ b/erpnext/selling/search_criteria/opportunity_to_follow_up/opportunity_to_follow_up.txt
@@ -0,0 +1,34 @@
+# Search Criteria, opportunity-to_follow_up
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-30 14:50:44',
+		'docstatus': 0,
+		'modified': '2012-03-30 14:50:44',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all Search Criteria
+	{
+		'add_cond': u"`tabOpportunity`.name=`tabQuotation`.enq_no\n`tabOpportunity`.docstatus=1\n`tabQuotation`.status='Submitted'",
+		'columns': u'Opportunity\x01ID,Opportunity\x01Owner,Opportunity\x01Company,Opportunity\x01Fiscal Year',
+		'criteria_name': u'Opportunity-To follow up',
+		'doc_type': u'Opportunity',
+		'doctype': 'Search Criteria',
+		'filters': u"{'Opportunity\x01Fiscal Year':''}",
+		'module': u'Selling',
+		'name': '__common__',
+		'page_len': 50,
+		'sort_by': u'`tabOpportunity`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
+	},
+
+	# Search Criteria, opportunity-to_follow_up
+	{
+		'doctype': 'Search Criteria',
+		'name': u'opportunity-to_follow_up'
+	}
+]
diff --git a/erpnext/selling/search_criteria/periodic_sales_summary/__init__.py b/erpnext/selling/search_criteria/periodic_sales_summary/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/selling/search_criteria/periodic_sales_summary/__init__.py
+++ /dev/null
diff --git a/erpnext/selling/search_criteria/periodic_sales_summary/periodic_sales_summary.js b/erpnext/selling/search_criteria/periodic_sales_summary/periodic_sales_summary.js
deleted file mode 100644
index ef3cef5..0000000
--- a/erpnext/selling/search_criteria/periodic_sales_summary/periodic_sales_summary.js
+++ /dev/null
@@ -1,35 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-  this.hide_all_filters();
-  this.add_filter({fieldname:'transaction_date', label:'Sales Order Date', fieldtype:'Date', parent:'Sales Order', in_first_page : 1,default:''});
-  
-  //this.filter_fields_dict['Sales Order'+FILTER_SEP +'Territory'].df.filter_hide = 0;
-  //this.filter_fields_dict['Sales Order'+FILTER_SEP +'Sales Order Date'].df.filter_hide = 0;
-  //this.filter_fields_dict['Sales Order'+FILTER_SEP +'Sales Order Date'].df.in_first_page = 1;
-  
-  this.filter_fields_dict['Sales Order Detail'+FILTER_SEP +'Item Code'].df.filter_hide = 0;
-  this.filter_fields_dict['Sales Order Detail'+FILTER_SEP +'Item Code'].df.in_first_page = 1;
-
-  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df.filter_hide = 0;
-  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df.in_first_page = 1;
-
-  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
-
-  //this.mytabs.items['Select Columns'].hide();
-  //this.mytabs.items['More Filters'].hide();
-}
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/periodic_sales_summary/periodic_sales_summary.txt b/erpnext/selling/search_criteria/periodic_sales_summary/periodic_sales_summary.txt
deleted file mode 100644
index 4672949..0000000
--- a/erpnext/selling/search_criteria/periodic_sales_summary/periodic_sales_summary.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-# Search Criteria, periodic_sales_summary
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:31',
-		'docstatus': 0,
-		'modified': '2010-06-03 13:09:00',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'Sales Order Detail\x01Item Code,Sales Order Detail\x01Quantity,Sales Order Detail\x01Delivered Qty,Sales Order Detail\x01Billed Qty',
-		'criteria_name': 'Periodic Sales Summary',
-		'dis_filters': 'fiscal_year',
-		'disabled': 1,
-		'doc_type': 'Sales Order Detail',
-		'doctype': 'Search Criteria',
-		'filters': "{'Sales Order\x01Submitted':1,'Sales Order\x01Company Name':'','Sales Order\x01Fiscal Year':''}",
-		'group_by': '`tabSales Order Detail`.`item_code`',
-		'module': 'Selling',
-		'name': '__common__',
-		'page_len': 50,
-		'parent_doc_type': 'Sales Order',
-		'sort_by': '`tabSales Order Detail`.`item_code`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, periodic_sales_summary
-	{
-		'doctype': 'Search Criteria',
-		'name': 'periodic_sales_summary'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/sales_agentwise_commission/__init__.py b/erpnext/selling/search_criteria/sales_agentwise_commission/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/selling/search_criteria/sales_agentwise_commission/__init__.py
+++ /dev/null
diff --git a/erpnext/selling/search_criteria/sales_agentwise_commission/sales_agentwise_commission.js b/erpnext/selling/search_criteria/sales_agentwise_commission/sales_agentwise_commission.js
deleted file mode 100644
index 049c597..0000000
--- a/erpnext/selling/search_criteria/sales_agentwise_commission/sales_agentwise_commission.js
+++ /dev/null
@@ -1,25 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-  this.hide_all_filters();
-  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Sales Partner'].df.filter_hide = 0;
-  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Sales Partner'].df.in_first_page = 1;
-}
-
-
-this.mytabs.items['Select Columns'].hide();
-this.mytabs.items['More Filters'].hide();
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/sales_agentwise_commission/sales_agentwise_commission.py b/erpnext/selling/search_criteria/sales_agentwise_commission/sales_agentwise_commission.py
deleted file mode 100644
index 4958674..0000000
--- a/erpnext/selling/search_criteria/sales_agentwise_commission/sales_agentwise_commission.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-coltypes[col_idx['Average Commission Rate']] = 'Currency'
-colwidths[col_idx['Average Commission Rate']] = '200px'
-
-coltypes[col_idx['Net Total']] = 'Currency'
-colwidths[col_idx['Net Total']] = '150px'
-
-coltypes[col_idx['Total Commission']] = 'Currency'
-colwidths[col_idx['Total Commission']] = '150px'
diff --git a/erpnext/selling/search_criteria/sales_agentwise_commission/sales_agentwise_commission.txt b/erpnext/selling/search_criteria/sales_agentwise_commission/sales_agentwise_commission.txt
deleted file mode 100644
index 047a175..0000000
--- a/erpnext/selling/search_criteria/sales_agentwise_commission/sales_agentwise_commission.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-# Search Criteria, sales_agentwise_commission
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-26 11:52:28',
-		'docstatus': 0,
-		'modified': '2010-08-26 11:48:17',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'add_col': "SUM(`tabSales Order`.`total_commission`) AS 'Total Commission'\nSUM(`tabSales Order`.`net_total`) AS 'Net Total'\n((SUM(`tabSales Order`.`total_commission`) / SUM(`tabSales Order`.`net_total`)) * 100) AS 'Average Commission Rate'",
-		'add_cond': '`tabSales Order`.`net_total` > 0',
-		'columns': 'Sales Order\x01Business Associate',
-		'criteria_name': 'Sales Agentwise Commission',
-		'description': 'Sales Agentwise Commission',
-		'disabled': 1,
-		'doc_type': 'Sales Order',
-		'doctype': 'Search Criteria',
-		'filters': "{'Sales Order\x01Submitted':1}",
-		'group_by': '`tabSales Order`.`sales_partner`',
-		'module': 'Selling',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, sales_agentwise_commission
-	{
-		'doctype': 'Search Criteria',
-		'name': 'sales_agentwise_commission'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/sales_order_pending_items1/__init__.py b/erpnext/selling/search_criteria/sales_order_pending_items/__init__.py
similarity index 100%
rename from erpnext/selling/search_criteria/sales_order_pending_items1/__init__.py
rename to erpnext/selling/search_criteria/sales_order_pending_items/__init__.py
diff --git a/erpnext/selling/search_criteria/sales_order_pending_items1/sales_order_pending_items1.js b/erpnext/selling/search_criteria/sales_order_pending_items/sales_order_pending_items.js
similarity index 100%
rename from erpnext/selling/search_criteria/sales_order_pending_items1/sales_order_pending_items1.js
rename to erpnext/selling/search_criteria/sales_order_pending_items/sales_order_pending_items.js
diff --git a/erpnext/selling/search_criteria/sales_order_pending_items/sales_order_pending_items.txt b/erpnext/selling/search_criteria/sales_order_pending_items/sales_order_pending_items.txt
new file mode 100644
index 0000000..036d689
--- /dev/null
+++ b/erpnext/selling/search_criteria/sales_order_pending_items/sales_order_pending_items.txt
@@ -0,0 +1,37 @@
+[
+	{
+		'add_col': '(`tabSales Order Item`.qty - ifnull(`tabSales Order Item`.delivered_qty, 0)) AS "Qty To Deliver"\n(`tabSales Order Item`.qty - ifnull(`tabSales Order Item`.billed_qty, 0)) AS "Qty To Bill"\n(`tabSales Order Item`.qty - ifnull(`tabSales Order Item`.delivered_qty, 0))*`tabSales Order Item`.basic_rate AS "Amount To Deliver"\n(`tabSales Order Item`.qty - ifnull(`tabSales Order Item`.billed_qty, 0))*`tabSales Order Item`.basic_rate AS "Amount To Bill"',
+		'add_cond': '(`tabSales Order Item`.qty - ifnull(`tabSales Order Item`.delivered_qty, 0) > 0 or `tabSales Order Item`.qty - ifnull(`tabSales Order Item`.billed_qty, 0) > 0)\n`tabSales Order`.status != "Stopped"',
+		'add_tab': None,
+		'columns': 'Sales Order\x01ID,Sales Order\x01Sales Order Date,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order Item\x01Item Code,Sales Order Item\x01Item Name,Sales Order Item\x01Description,Sales Order Item\x01Quantity,Sales Order Item\x01Delivered Qty,Sales Order Item\x01Billed Qty',
+		'creation': '2011-05-09 11:04:19',
+		'criteria_name': 'Sales Order Pending Items',
+		'custom_query': '',
+		'description': 'Sales Order Pending Items',
+		'dis_filters': None,
+		'disabled': None,
+		'doc_type': 'Sales Order Item',
+		'docstatus': 0,
+		'doctype': 'Search Criteria',
+		'filters': "{'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
+		'graph_series': None,
+		'graph_values': None,
+		'group_by': None,
+		'idx': None,
+		'modified': '2011-05-09 11:08:05',
+		'modified_by': 'Administrator',
+		'module': 'CRM',
+		'name': 'sales_order_pending_items',
+		'owner': 'Administrator',
+		'page_len': 50,
+		'parent': None,
+		'parent_doc_type': 'Sales Order',
+		'parentfield': None,
+		'parenttype': None,
+		'report_script': None,
+		'server_script': None,
+		'sort_by': '`tabSales Order`.`name`',
+		'sort_order': 'DESC',
+		'standard': 'Yes'
+	}
+]
diff --git a/erpnext/selling/search_criteria/sales_order_pending_items1/sales_order_pending_items1.txt b/erpnext/selling/search_criteria/sales_order_pending_items1/sales_order_pending_items1.txt
deleted file mode 100644
index 1ea02d9..0000000
--- a/erpnext/selling/search_criteria/sales_order_pending_items1/sales_order_pending_items1.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-[
-	{
-		'add_col': '(`tabSales Order Detail`.qty - ifnull(`tabSales Order Detail`.delivered_qty, 0)) AS "Qty To Deliver"\n(`tabSales Order Detail`.qty - ifnull(`tabSales Order Detail`.billed_qty, 0)) AS "Qty To Bill"\n(`tabSales Order Detail`.qty - ifnull(`tabSales Order Detail`.delivered_qty, 0))*`tabSales Order Detail`.basic_rate AS "Amount To Deliver"\n(`tabSales Order Detail`.qty - ifnull(`tabSales Order Detail`.billed_qty, 0))*`tabSales Order Detail`.basic_rate AS "Amount To Bill"',
-		'add_cond': '(`tabSales Order Detail`.qty - ifnull(`tabSales Order Detail`.delivered_qty, 0) > 0 or `tabSales Order Detail`.qty - ifnull(`tabSales Order Detail`.billed_qty, 0) > 0)\n`tabSales Order`.status != "Stopped"',
-		'add_tab': None,
-		'columns': 'Sales Order\x01ID,Sales Order\x01Sales Order Date,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order Detail\x01Item Code,Sales Order Detail\x01Item Name,Sales Order Detail\x01Description,Sales Order Detail\x01Quantity,Sales Order Detail\x01Delivered Qty,Sales Order Detail\x01Billed Qty',
-		'creation': '2011-05-09 11:04:19',
-		'criteria_name': 'Sales Order Pending Items1',
-		'custom_query': '',
-		'description': 'Sales Order Pending Items',
-		'dis_filters': None,
-		'disabled': None,
-		'doc_type': 'Sales Order Detail',
-		'docstatus': 0,
-		'doctype': 'Search Criteria',
-		'filters': "{'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
-		'graph_series': None,
-		'graph_values': None,
-		'group_by': None,
-		'idx': None,
-		'modified': '2011-05-09 11:08:05',
-		'modified_by': 'Administrator',
-		'module': 'CRM',
-		'name': 'sales_order_pending_items1',
-		'owner': 'Administrator',
-		'page_len': 50,
-		'parent': None,
-		'parent_doc_type': 'Sales Order',
-		'parentfield': None,
-		'parenttype': None,
-		'report_script': None,
-		'server_script': None,
-		'sort_by': '`tabSales Order`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/sales_orderwise_booking_ b/erpnext/selling/search_criteria/sales_orderwise_booking_
deleted file mode 100644
index 46a478c..0000000
--- a/erpnext/selling/search_criteria/sales_orderwise_booking_
+++ /dev/null
@@ -1,4 +0,0 @@
-report.customize_filters = function() {
-  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
-  this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
-}
diff --git a/erpnext/selling/search_criteria/sales_orderwise_booking_&_delivery_summary/sales_orderwise_booking_&_delivery_summary.txt b/erpnext/selling/search_criteria/sales_orderwise_booking_&_delivery_summary/sales_orderwise_booking_&_delivery_summary.txt
index 0ef2f07..fa03e9f 100644
--- a/erpnext/selling/search_criteria/sales_orderwise_booking_&_delivery_summary/sales_orderwise_booking_&_delivery_summary.txt
+++ b/erpnext/selling/search_criteria/sales_orderwise_booking_&_delivery_summary/sales_orderwise_booking_&_delivery_summary.txt
@@ -3,35 +3,35 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-09-01 15:48:09',
+		'creation': '2012-04-03 12:49:52',
 		'docstatus': 0,
-		'modified': '2010-08-30 12:48:21',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:52',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_col': "SUM(CASE WHEN `tabSales Order`.`status` = 'Stopped' THEN (`tabSales Order Detail`.`delivered_qty` * `tabSales Order Detail`.`basic_rate`) ELSE (`tabSales Order Detail`.`qty` * `tabSales Order Detail`.`basic_rate`) END) AS 'Booking Total'\nSUM(`tabSales Order Detail`.`delivered_qty` * `tabSales Order Detail`.`basic_rate`) AS 'Delivered Amount'",
-		'columns': 'Sales Order\x01ID,Sales Order\x01Status,Sales Order\x01% Billed,Sales Order\x01Sales Order Date,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order\x01Territory',
-		'criteria_name': 'Sales Orderwise Booking & Delivery Summary',
-		'description': 'Sales Orderwise Booking & Delivery Summary',
-		'doc_type': 'Sales Order Detail',
+		'add_col': u"SUM(CASE WHEN `tabSales Order`.`status` = 'Stopped' THEN (`tabSales Order Item`.`delivered_qty` * `tabSales Order Item`.`basic_rate`) ELSE (`tabSales Order Item`.`qty` * `tabSales Order Item`.`basic_rate`) END) AS 'Booking Total'\nSUM(`tabSales Order Item`.`delivered_qty` * `tabSales Order Item`.`basic_rate`) AS 'Delivered Amount'",
+		'columns': u'Sales Order\x01ID,Sales Order\x01Status,Sales Order\x01% Billed,Sales Order\x01Sales Order Date,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order\x01Territory',
+		'criteria_name': u'Sales Orderwise Booking & Delivery Summary',
+		'description': u'Sales Orderwise Booking & Delivery Summary',
+		'doc_type': u'Sales Order Item',
 		'doctype': 'Search Criteria',
-		'filters': "{'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
-		'group_by': '`tabSales Order`.`name`',
-		'module': 'Selling',
+		'filters': u"{'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
+		'group_by': u'`tabSales Order`.`name`',
+		'module': u'Selling',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Sales Order',
-		'sort_by': '`tabSales Order`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Sales Order',
+		'sort_by': u'`tabSales Order`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, sales_orderwise_booking_&_delivery_summary
 	{
 		'doctype': 'Search Criteria',
-		'name': 'sales_orderwise_booking_&_delivery_summary'
+		'name': u'sales_orderwise_booking_&_delivery_summary'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/sales_orderwise_pending_amount_to_bill/sales_orderwise_pending_amount_to_bill.txt b/erpnext/selling/search_criteria/sales_orderwise_pending_amount_to_bill/sales_orderwise_pending_amount_to_bill.txt
index e46e10d..6b61745 100644
--- a/erpnext/selling/search_criteria/sales_orderwise_pending_amount_to_bill/sales_orderwise_pending_amount_to_bill.txt
+++ b/erpnext/selling/search_criteria/sales_orderwise_pending_amount_to_bill/sales_orderwise_pending_amount_to_bill.txt
@@ -3,36 +3,36 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-03-30 11:03:20',
+		'creation': '2012-04-03 12:49:52',
 		'docstatus': 0,
-		'modified': '2011-03-29 14:06:13',
-		'modified_by': 'Administrator',
-		'owner': 'dhanalekshmi@webnotestech.com'
+		'modified': '2012-04-03 12:49:52',
+		'modified_by': u'Administrator',
+		'owner': u'dhanalekshmi@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_col': 'SUM((`tabSales Order Detail`.`qty` - ifnull(`tabSales Order Detail`.`billed_qty`, 0)) * `tabSales Order Detail`.`basic_rate`) AS "Pending Amount"',
-		'add_cond': '`tabSales Order`.status != "Stopped"\n`tabSales Order`.order_type!="Maintenance"',
-		'columns': 'Sales Order\x01ID,Sales Order\x01Customer,Sales Order\x01Customer Address,Sales Order\x01Status,Sales Order\x01%  Delivered,Sales Order\x01% Billed,Sales Order\x01Company Name,Sales Order\x01Sales Order Date,Sales Order\x01Net Total,Sales Order\x01Zone,Sales Order\x01Territory,Sales Order\x01Email Id',
-		'criteria_name': 'Sales Orderwise Pending Amount To Bill',
-		'description': 'Sales Orderwise Pending Amount To Bill',
-		'doc_type': 'Sales Order Detail',
+		'add_col': u'SUM((`tabSales Order Item`.`qty` - ifnull(`tabSales Order Item`.`billed_qty`, 0)) * `tabSales Order Item`.`basic_rate`) AS "Pending Amount"',
+		'add_cond': u'`tabSales Order`.status != "Stopped"\n`tabSales Order`.order_type!="Maintenance"',
+		'columns': u'Sales Order\x01ID,Sales Order\x01Customer,Sales Order\x01Customer Address,Sales Order\x01Status,Sales Order\x01%  Delivered,Sales Order\x01% Billed,Sales Order\x01Company Name,Sales Order\x01Sales Order Date,Sales Order\x01Net Total,Sales Order\x01Zone,Sales Order\x01Territory,Sales Order\x01Email Id',
+		'criteria_name': u'Sales Orderwise Pending Amount To Bill',
+		'description': u'Sales Orderwise Pending Amount To Bill',
+		'doc_type': u'Sales Order Item',
 		'doctype': 'Search Criteria',
-		'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Company Name':'','Sales Order\x01Fiscal Year':''}",
-		'group_by': '`tabSales Order`.`name`',
-		'module': 'Selling',
+		'filters': u"{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Company Name':'','Sales Order\x01Fiscal Year':''}",
+		'group_by': u'`tabSales Order`.`name`',
+		'module': u'Selling',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Sales Order',
-		'sort_by': '`tabSales Order`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Sales Order',
+		'sort_by': u'`tabSales Order`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, sales_orderwise_pending_amount_to_bill
 	{
 		'doctype': 'Search Criteria',
-		'name': 'sales_orderwise_pending_amount_to_bill'
+		'name': u'sales_orderwise_pending_amount_to_bill'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/sales_orderwise_pending_qty_to_deliver/sales_orderwise_pending_qty_to_deliver.txt b/erpnext/selling/search_criteria/sales_orderwise_pending_qty_to_deliver/sales_orderwise_pending_qty_to_deliver.txt
index 74fc106..7a73d4a 100644
--- a/erpnext/selling/search_criteria/sales_orderwise_pending_qty_to_deliver/sales_orderwise_pending_qty_to_deliver.txt
+++ b/erpnext/selling/search_criteria/sales_orderwise_pending_qty_to_deliver/sales_orderwise_pending_qty_to_deliver.txt
@@ -3,36 +3,36 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-03-30 11:03:20',
+		'creation': '2012-04-03 12:49:52',
 		'docstatus': 0,
-		'modified': '2011-03-29 14:02:58',
-		'modified_by': 'Administrator',
-		'owner': 'dhanalekshmi@webnotestech.com'
+		'modified': '2012-04-03 12:49:52',
+		'modified_by': u'Administrator',
+		'owner': u'dhanalekshmi@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_col': 'SUM(`tabSales Order Detail`.`qty` - ifnull(`tabSales Order Detail`.`delivered_qty`, 0)) AS "Pending Qty"',
-		'add_cond': '`tabSales Order`.status != "Stopped"\n`tabSales Order Detail`.`qty` > ifnull(`tabSales Order Detail`.`delivered_qty`, 0)',
-		'columns': 'Sales Order\x01ID,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order\x01Customer Address,Sales Order\x01Status,Sales Order\x01%  Delivered,Sales Order\x01% Billed,Sales Order\x01Sales Order Date,Sales Order\x01Territory,Sales Order\x01Email Id',
-		'criteria_name': 'Sales Orderwise Pending Qty To Deliver',
-		'description': 'Sales Orderwise Pending Qty To Deliver',
-		'doc_type': 'Sales Order Detail',
+		'add_col': u'SUM(`tabSales Order Item`.`qty` - ifnull(`tabSales Order Item`.`delivered_qty`, 0)) AS "Pending Qty"',
+		'add_cond': u'`tabSales Order`.status != "Stopped"\n`tabSales Order Item`.`qty` > ifnull(`tabSales Order Item`.`delivered_qty`, 0)',
+		'columns': u'Sales Order\x01ID,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order\x01Customer Address,Sales Order\x01Status,Sales Order\x01%  Delivered,Sales Order\x01% Billed,Sales Order\x01Sales Order Date,Sales Order\x01Territory,Sales Order\x01Email Id',
+		'criteria_name': u'Sales Orderwise Pending Qty To Deliver',
+		'description': u'Sales Orderwise Pending Qty To Deliver',
+		'doc_type': u'Sales Order Item',
 		'doctype': 'Search Criteria',
-		'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
-		'group_by': '`tabSales Order`.`name`',
-		'module': 'Selling',
+		'filters': u"{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
+		'group_by': u'`tabSales Order`.`name`',
+		'module': u'Selling',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Sales Order',
-		'sort_by': '`tabSales Order`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Sales Order',
+		'sort_by': u'`tabSales Order`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, sales_orderwise_pending_qty_to_deliver
 	{
 		'doctype': 'Search Criteria',
-		'name': 'sales_orderwise_pending_qty_to_deliver'
+		'name': u'sales_orderwise_pending_qty_to_deliver'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.js b/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.js
index 135b68d..9491bbb 100644
--- a/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.js
+++ b/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.js
@@ -35,7 +35,7 @@
   sales_person = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Sales Person'].get_value();
   target_on = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Target On'].get_value();   
   under = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Under'].get_value();
-  if(under == 'Sales Invoice') under = 'Receivable Voucher';
+  if(under == 'Sales Invoice') under = 'Sales Invoice';
 
   if(target_on == 'Quantity'){
     q1 = 't1.target_qty AS "Target Quantity"';
@@ -49,7 +49,7 @@
     cond1 = 'ifnull(t1.target_amount,"")!=""';
     cond2 = 'ifnull(t6.target_amount,"")!=""';
   }
-  if(under =='Receivable Voucher')
+  if(under =='Sales Invoice')
     tab = 'RV';
   else
     tab = under;
diff --git a/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.py b/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.py
index 3375f08..83a6511 100644
--- a/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.py
+++ b/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.py
@@ -25,7 +25,7 @@
 fiscal_year = filter_values.get('fiscal_year')
 period = filter_values.get('period')
 under = filter_values.get('under')
-if under == 'Sales Invoice': under = 'Receivable Voucher'
+if under == 'Sales Invoice': under = 'Sales Invoice'
 sales_person = filter_values.get('sales_person')
 target_on = filter_values.get('target_on')
 
@@ -124,12 +124,12 @@
     #----------------------------------------------------------    
     if target_on == "Quantity":
 
-      actual = sql("select sum(ifnull(t2.qty,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t2.item_group = '%s' and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, (under == 'Receivable Voucher') and 'RV' or under, based_on_fn, sales_person, r[0].strip(), date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+      actual = sql("select sum(ifnull(t2.qty,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t2.item_group = '%s' and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, (under == 'Sales Invoice') and 'RV' or under, based_on_fn, sales_person, r[0].strip(), date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
     
     #----------------------------------------------------------  
     if target_on == "Amount":
 
-      actual = sql("select sum(ifnull(t2.amount,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t2.item_group = '%s' and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, (under == 'Receivable Voucher') and 'RV' or under, based_on_fn, sales_person, r[0].strip(), date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+      actual = sql("select sum(ifnull(t2.amount,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t2.item_group = '%s' and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, (under == 'Sales Invoice') and 'RV' or under, based_on_fn, sales_person, r[0].strip(), date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
     #----------------------------------------------------------
 
     actual = actual and flt(actual[0][0]) or 0 
diff --git a/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.txt b/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.txt
index ec2b338..f001b70 100644
--- a/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.txt
+++ b/erpnext/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-10-12 15:19:31',
+		'creation': '2012-04-03 12:49:52',
 		'docstatus': 0,
-		'modified': '2010-09-25 17:22:58',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:52',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'criteria_name': 'Sales Persons Target Variance (Item Group wise)',
-		'doc_type': 'Target Detail',
+		'criteria_name': u'Sales Persons Target Variance (Item Group wise)',
+		'doc_type': u'Target Detail',
 		'doctype': 'Search Criteria',
-		'filters': "{'Sales Person\x01Country':'','Sales Person\x01State':'','Target Detail\x01Fiscal Year':''}",
-		'module': 'Selling',
+		'filters': u"{'Sales Person\x01Country':'','Sales Person\x01State':'','Target Detail\x01Fiscal Year':''}",
+		'module': u'Selling',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Sales Person',
-		'sort_by': '`tabTarget Detail`.`target_amount`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Sales Person',
+		'sort_by': u'`tabTarget Detail`.`target_amount`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, sales_persons_target_variance_item_group_wise
 	{
 		'doctype': 'Search Criteria',
-		'name': 'sales_persons_target_variance_item_group_wise'
+		'name': u'sales_persons_target_variance_item_group_wise'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.js b/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.js
index e1bd1d3..4879183 100755
--- a/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.js
+++ b/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.js
@@ -40,7 +40,7 @@
 
   date_fld = 'transaction_date';
   if(based_on == 'Sales Invoice') {
-    based_on = 'Receivable Voucher';
+    based_on = 'Sales Invoice';
     date_fld = 'voucher_date';
   }
 
diff --git a/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.py b/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.py
index 83c61f4..7b1d6b9 100755
--- a/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.py
+++ b/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.py
@@ -15,7 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 if filter_values.get('based_on') == 'Sales Invoice':
-  based_on_dt = 'Receivable Voucher'
+  based_on_dt = 'Sales Invoice'
 else:
   based_on_dt = filter_values.get('based_on')
 
diff --git a/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.txt b/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.txt
index 2e53d6f..2ca30f7 100755
--- a/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.txt
+++ b/erpnext/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-06-08 11:00:34',
+		'creation': '2012-04-03 12:49:52',
 		'docstatus': 0,
-		'modified': '2011-02-24 17:35:32',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:52',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Sales Person\x01ID',
-		'criteria_name': 'Sales Personwise Transaction Summary',
-		'doc_type': 'Sales Person',
+		'columns': u'Sales Person\x01ID',
+		'criteria_name': u'Sales Personwise Transaction Summary',
+		'doc_type': u'Sales Person',
 		'doctype': 'Search Criteria',
-		'filters': "{'Sales Person\x01Saved':1,'Sales Person\x01Submitted':1,'Sales Person\x01Country':'','Sales Person\x01State':''}",
-		'module': 'Selling',
+		'filters': u"{'Sales Person\x01Saved':1,'Sales Person\x01Submitted':1,'Sales Person\x01Country':'','Sales Person\x01State':''}",
+		'module': u'Selling',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabSales Person`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabSales Person`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, sales_personwise_transaction_summary
 	{
 		'doctype': 'Search Criteria',
-		'name': 'sales_personwise_transaction_summary'
+		'name': u'sales_personwise_transaction_summary'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/home/search_criteria/serial_no_amc_expiring_this_month/__init__.py b/erpnext/selling/search_criteria/serial_no_amc_expiring_this_month/__init__.py
similarity index 100%
rename from erpnext/home/search_criteria/serial_no_amc_expiring_this_month/__init__.py
rename to erpnext/selling/search_criteria/serial_no_amc_expiring_this_month/__init__.py
diff --git a/erpnext/selling/search_criteria/serial_no_amc_expiring_this_month/serial_no_amc_expiring_this_month.txt b/erpnext/selling/search_criteria/serial_no_amc_expiring_this_month/serial_no_amc_expiring_this_month.txt
new file mode 100644
index 0000000..1f30322
--- /dev/null
+++ b/erpnext/selling/search_criteria/serial_no_amc_expiring_this_month/serial_no_amc_expiring_this_month.txt
@@ -0,0 +1,34 @@
+# Search Criteria, serial_no-amc_expiring_this_month
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-04-03 12:49:52',
+		'docstatus': 0,
+		'modified': '2012-04-03 12:49:52',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all Search Criteria
+	{
+		'add_cond': u'`tab Serial No`.month(amc_expiry_date)=month(now()) \n`tab Serial No`.year(amc_expiry_date)=year(now())',
+		'columns': u'Serial No\x01ID,Serial No\x01Status,Serial No\x01AMC Expiry Date,Serial No\x01Customer Name',
+		'criteria_name': u'Serial No-AMC expiring this month',
+		'doc_type': u'Serial No',
+		'doctype': 'Search Criteria',
+		'filters': u"{'Serial No\x01Saved':1,'Serial No\x01Submitted':1,'Serial No\x01Status':'','Serial No\x01Warranty Status':''}",
+		'module': u'Selling',
+		'name': '__common__',
+		'page_len': 50,
+		'sort_by': u'`tabSerial No`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
+	},
+
+	# Search Criteria, serial_no-amc_expiring_this_month
+	{
+		'doctype': 'Search Criteria',
+		'name': u'serial_no-amc_expiring_this_month'
+	}
+]
diff --git a/erpnext/home/search_criteria/serial_no_warranty_expiring_this_month/__init__.py b/erpnext/selling/search_criteria/serial_no_warranty_expiring_this_month/__init__.py
similarity index 100%
rename from erpnext/home/search_criteria/serial_no_warranty_expiring_this_month/__init__.py
rename to erpnext/selling/search_criteria/serial_no_warranty_expiring_this_month/__init__.py
diff --git a/erpnext/selling/search_criteria/serial_no_warranty_expiring_this_month/serial_no_warranty_expiring_this_month.txt b/erpnext/selling/search_criteria/serial_no_warranty_expiring_this_month/serial_no_warranty_expiring_this_month.txt
new file mode 100644
index 0000000..63c3e74
--- /dev/null
+++ b/erpnext/selling/search_criteria/serial_no_warranty_expiring_this_month/serial_no_warranty_expiring_this_month.txt
@@ -0,0 +1,34 @@
+# Search Criteria, serial_no-warranty_expiring_this_month
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-04-03 12:49:52',
+		'docstatus': 0,
+		'modified': '2012-04-03 12:49:52',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all Search Criteria
+	{
+		'add_cond': u"`tab Serial No`.docstatus!=2\n`tab Serial No`.maintenance_status='Under Warranty'\n`tab Serial No`.status!='Scrapped'\n`tab Serial No`.status!='Not in Use'\n`tab Serial No`.month(ifnull(warranty_expiry_date,0)) = month(now()) \n`tab Serial No`.yearmonth(ifnull(warranty_expiry_date,0)) = year(now())",
+		'columns': u'Serial No\x01ID,Serial No\x01Status,Serial No\x01Warranty Expiry Date,Serial No\x01Customer Name',
+		'criteria_name': u'Serial No-Warranty expiring this month',
+		'doc_type': u'Serial No',
+		'doctype': 'Search Criteria',
+		'filters': u"{'Serial No\x01Saved':1,'Serial No\x01Submitted':1,'Serial No\x01Status':'Issued','Serial No\x01Maintenance Status':''}",
+		'module': u'Selling',
+		'name': '__common__',
+		'page_len': 50,
+		'sort_by': u'`tabSerial No`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
+	},
+
+	# Search Criteria, serial_no-warranty_expiring_this_month
+	{
+		'doctype': 'Search Criteria',
+		'name': u'serial_no-warranty_expiring_this_month'
+	}
+]
diff --git a/erpnext/selling/search_criteria/target_variance_report/target_variance_report.js b/erpnext/selling/search_criteria/target_variance_report/target_variance_report.js
index 155b98d..cc8e03e 100644
--- a/erpnext/selling/search_criteria/target_variance_report/target_variance_report.js
+++ b/erpnext/selling/search_criteria/target_variance_report/target_variance_report.js
@@ -21,7 +21,7 @@
   this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company',report_default:sys_defaults.company, ignore : 1, parent:'Target Detail'});
   this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Target Detail'});
   this.add_filter({fieldname:'group_by', label:'Group By', fieldtype:'Select', options:NEWLINE+'Item Group',ignore : 1, parent:'Target Detail'});
-  this.add_filter({fieldname:'under', label:'Under',fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Receivable Voucher',report_default:'Sales Order',ignore : 1, parent:'Target Detail'});
+  this.add_filter({fieldname:'under', label:'Under',fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice',report_default:'Sales Order',ignore : 1, parent:'Target Detail'});
 
 }
 
diff --git a/erpnext/selling/search_criteria/target_variance_report/target_variance_report.py b/erpnext/selling/search_criteria/target_variance_report/target_variance_report.py
index 771fd28..aa67355 100644
--- a/erpnext/selling/search_criteria/target_variance_report/target_variance_report.py
+++ b/erpnext/selling/search_criteria/target_variance_report/target_variance_report.py
@@ -108,14 +108,14 @@
     actual = 0
     if based_on == 'Cost Center' or based_on == 'Sales Partner':
       if group_by =='Item Group':
-        actual = sql("select sum(ifnull(t2.amount,0)) from `tab%s` t1, `tab%s Detail` t2, `tabItem` t3 where t2.parenttype = '%s' and t2.parent = t1.name and t1.%s = '%s' and t3.name = t2.item_code and t3.item_group = '%s' and t1.docstatus = 1 and t1.%s between '%s' and '%s'" % (under, (under == 'Receivable Voucher') and 'RV' or under, under, based_on_fn, r[0], r[1], date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+        actual = sql("select sum(ifnull(t2.amount,0)) from `tab%s` t1, `tab%s Detail` t2, `tabItem` t3 where t2.parenttype = '%s' and t2.parent = t1.name and t1.%s = '%s' and t3.name = t2.item_code and t3.item_group = '%s' and t1.docstatus = 1 and t1.%s between '%s' and '%s'" % (under, (under == 'Sales Invoice') and 'RV' or under, under, based_on_fn, r[0], r[1], date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
         actual = flt(actual[0][0])
       else:
         actual = sql("select sum(ifnull(net_total,0)) from `tab%s` where %s = '%s' and docstatus = 1 and %s between '%s' and '%s' " % (under, based_on_fn, r[0], date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
         actual = flt(actual[0][0])
     elif based_on == 'Sales Person':
       if group_by =='Item Group':
-        actual = sql("select sum(ifnull(t2.amount,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3, `tabItem` t4 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t4.name = t2.item_code and t4.item_group = '%s' and t1.docstatus != 2 and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, (under == 'Receivable Voucher') and 'RV' or under, based_on_fn, r[0], r[1], date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+        actual = sql("select sum(ifnull(t2.amount,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3, `tabItem` t4 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t4.name = t2.item_code and t4.item_group = '%s' and t1.docstatus != 2 and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, (under == 'Sales Invoice') and 'RV' or under, based_on_fn, r[0], r[1], date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
         actual = flt(actual[0][0])
       else:
         actual = sql("select sum(ifnull(t2.allocated_amount,0)) from `tab%s` t1, `tabSales Team` t2 where t2.%s = '%s' and t2.parenttype='%s' and t1.docstatus != 2 and t2.parent = t1.name and t1.%s between '%s' and '%s'"%(under, based_on_fn, r[0], under, date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
diff --git a/erpnext/selling/search_criteria/target_variance_report/target_variance_report.txt b/erpnext/selling/search_criteria/target_variance_report/target_variance_report.txt
index 7ffe1f3..06ed049 100644
--- a/erpnext/selling/search_criteria/target_variance_report/target_variance_report.txt
+++ b/erpnext/selling/search_criteria/target_variance_report/target_variance_report.txt
@@ -3,32 +3,32 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:32',
+		'creation': '2012-04-03 12:49:53',
 		'docstatus': 0,
-		'modified': '2010-06-23 12:27:37',
-		'modified_by': 'Administrator',
-		'owner': 'harshada@webnotestech.com'
+		'modified': '2012-04-03 12:49:53',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Sales Person\x01ID,Sales Person\x01Owner,Sales Person\x01Sales Person,Sales Person\x01Country,Sales Person\x01State,Target Detail\x01Item Group,Target Detail\x01Fiscal Year,Target Detail\x01Target  Amount',
-		'criteria_name': 'Target Variance Report',
+		'columns': u'Sales Person\x01ID,Sales Person\x01Owner,Sales Person\x01Sales Person,Sales Person\x01Country,Sales Person\x01State,Target Detail\x01Item Group,Target Detail\x01Fiscal Year,Target Detail\x01Target  Amount',
+		'criteria_name': u'Target Variance Report',
 		'disabled': 0,
-		'doc_type': 'Target Detail',
+		'doc_type': u'Target Detail',
 		'doctype': 'Search Criteria',
-		'filters': "{'Sales Person\x01Saved':1,'Sales Person\x01Submitted':1,'Sales Person\x01Country':'','Sales Person\x01State':'','Target Detail\x01Fiscal Year':''}",
-		'module': 'Selling',
+		'filters': u"{'Sales Person\x01Saved':1,'Sales Person\x01Submitted':1,'Sales Person\x01Country':'','Sales Person\x01State':'','Target Detail\x01Fiscal Year':''}",
+		'module': u'Selling',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Sales Person',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Sales Person',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, target_variance_report
 	{
 		'doctype': 'Search Criteria',
-		'name': 'target_variance_report'
+		'name': u'target_variance_report'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.js b/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.js
index 1afb7b1..d7dcf70 100644
--- a/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.js
+++ b/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.js
@@ -35,7 +35,7 @@
   territory = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Territory'].get_value();
   target_on = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Target On'].get_value();   
   under = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Under'].get_value();   
-  if(under == 'Sales Invoice') under = 'Receivable Voucher';
+  if(under == 'Sales Invoice') under = 'Sales Invoice';
 
   if(target_on == 'Quantity'){
     q1 = 't1.target_qty AS "Target Quantity"';
@@ -49,7 +49,7 @@
     cond1 = 'ifnull(t1.target_amount,"")!=""';
     cond2 = 'ifnull(t5.target_amount,"")!=""';
   }
-  if(under =='Receivable Voucher')
+  if(under =='Sales Invoice')
     tab = 'RV';
   else
     tab = under;
diff --git a/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.py b/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.py
index eacb606..85eb528 100644
--- a/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.py
+++ b/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.py
@@ -25,7 +25,7 @@
 fiscal_year = filter_values.get('fiscal_year')
 period = filter_values.get('period')
 under = filter_values.get('under')
-if under == 'Sales Invoice': under = 'Receivable Voucher'
+if under == 'Sales Invoice': under = 'Sales Invoice'
 territory = filter_values.get('territory')
 target_on = filter_values.get('target_on')
 
@@ -124,13 +124,13 @@
     #----------------------------------------------------------    
     if target_on == "Quantity":
 
-      actual = sql("select sum(ifnull(t2.qty,0)) from `tab%s` t1, `tab%s Detail` t2 where t2.parenttype = '%s' and t2.parent = t1.name and t1.%s = '%s' and t1.docstatus = 1 and t2.item_group = '%s' and t1.%s between '%s' and '%s'" % (under, (under == 'Receivable Voucher') and 'RV' or under, under, based_on_fn, territory, r[0],date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+      actual = sql("select sum(ifnull(t2.qty,0)) from `tab%s` t1, `tab%s Detail` t2 where t2.parenttype = '%s' and t2.parent = t1.name and t1.%s = '%s' and t1.docstatus = 1 and t2.item_group = '%s' and t1.%s between '%s' and '%s'" % (under, (under == 'Sales Invoice') and 'RV' or under, under, based_on_fn, territory, r[0],date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
       
     
     #----------------------------------------------------------  
     if target_on == "Amount":
 
-      actual = sql("select sum(ifnull(t2.amount,0)) from `tab%s` t1, `tab%s Detail` t2 where t2.parenttype = '%s' and t2.parent = t1.name and t1.%s = '%s' and t1.docstatus = 1 and t2.item_group = '%s' and t1.%s between '%s' and '%s'" % (under, (under == 'Receivable Voucher') and 'RV' or under, under, based_on_fn, territory, r[0],date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+      actual = sql("select sum(ifnull(t2.amount,0)) from `tab%s` t1, `tab%s Detail` t2 where t2.parenttype = '%s' and t2.parent = t1.name and t1.%s = '%s' and t1.docstatus = 1 and t2.item_group = '%s' and t1.%s between '%s' and '%s'" % (under, (under == 'Sales Invoice') and 'RV' or under, under, based_on_fn, territory, r[0],date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
 
     #----------------------------------------------------------
 
diff --git a/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.txt b/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.txt
index 827230a..69bb310 100644
--- a/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.txt
+++ b/erpnext/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 10:23:21',
+		'creation': '2012-04-03 12:49:53',
 		'docstatus': 0,
-		'modified': '2010-11-25 13:18:22',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:53',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'criteria_name': 'Territories Target Variance (Item Group wise)',
-		'doc_type': 'Target Detail',
+		'criteria_name': u'Territories Target Variance (Item Group wise)',
+		'doc_type': u'Target Detail',
 		'doctype': 'Search Criteria',
-		'filters': "{'Sales Person\x01Country':'','Sales Person\x01State':'','Target Detail\x01Fiscal Year':''}",
-		'module': 'Selling',
+		'filters': u"{'Sales Person\x01Country':'','Sales Person\x01State':'','Target Detail\x01Fiscal Year':''}",
+		'module': u'Selling',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Sales Person',
-		'sort_by': '`tabTarget Detail`.`target_amount`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Sales Person',
+		'sort_by': u'`tabTarget Detail`.`target_amount`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, territories_target_variance_item_group_wise
 	{
 		'doctype': 'Search Criteria',
-		'name': 'territories_target_variance_item_group_wise'
+		'name': u'territories_target_variance_item_group_wise'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/territory_item_group_wise_gp/__init__.py b/erpnext/selling/search_criteria/territory_item_group_wise_gp/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/selling/search_criteria/territory_item_group_wise_gp/__init__.py
+++ /dev/null
diff --git a/erpnext/selling/search_criteria/territory_item_group_wise_gp/territory_item_group_wise_gp.py b/erpnext/selling/search_criteria/territory_item_group_wise_gp/territory_item_group_wise_gp.py
deleted file mode 100644
index cf1df24..0000000
--- a/erpnext/selling/search_criteria/territory_item_group_wise_gp/territory_item_group_wise_gp.py
+++ /dev/null
@@ -1,123 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Add Columns
-# ------------
-based_on = filter_values.get('based_on')
-
-columns = [[based_on,'Data','150px',''],
-           ['Total Qty','Currency','150px',''],
-           ['Revenue','Currency','150px',''],
-           ['Valuation Amount','Currency','150px',''],
-           ['Gross Profit (%)','Currrency','150px',''],
-           ['Gross Profit','Currency','150px','']]           
-
-for c in columns:
-  colnames.append(c[0])
-  coltypes.append(c[1])
-  colwidths.append(c[2])
-  coloptions.append(c[3])
-  col_idx[c[0]] = len(colnames)-1
-
-
-
-def make_child_lst(based_on,name):
-  rg = sql("select lft, rgt from `tab%s` where name = '%s'"%(based_on,name))
-  ch_name = sql("select name from `tab%s` where lft between %d and %d"%(based_on,int(rg[0][0]),int(rg[0][1])))
-  chl ='('
-  flag = 1
-  for c in ch_name:
-    if flag == 1:
-     chl += "'%s'"%c[0]
-     flag = 2
-    else:
-      chl +=",'%s'"%c[0]
-
-  chl +=")"
-  return chl
-
-
-
-for r in res:
-
-  qty, rate, amt, tot_val_rate, val_amount = 0, 0, 0, 0,0
-  cn = make_child_lst(based_on,r[0].strip())
-
-
-
-  if based_on == 'Item Group':
-  
-    dn = sql("select name from `tabItem` where item_group in %s"%(cn))
-    for n in dn:
-      
-      dt = sql("select sum(qty),sum(amount) from `tabDelivery Note Detail` where item_code ='%s' and docstatus = 1"%n[0])  
-          
-      qty += dt[0][0] and dt[0][0] or 0
-      amt += dt[0][1] and dt[0][1] or 0  
-      prt = sql("select distinct t1.name from `tabDelivery Note` t1, `tabDelivery Note Detail` t2 where t1.name = t2.parent and t2.item_code = '%s' and t1.docstatus = 1 and t2.docstatus =1 order by t1.name"%n[0])
-      for p in prt:
-        d1 = sql("select qty from `tabDelivery Note Detail` where parent = '%s' and parenttype ='Delivery Note' and docstatus =1 and item_code = '%s'"%(p[0],n[0]))
-        for t in d1:
-          tot_val_rate = 0
-          packing_list_items = sql("select item_code, warehouse, qty from `tabDelivery Note Packing Detail` where parent = '%s' and parent_item = '%s' and docstatus = 1 order by item_code, warehouse, qty"%(p[0],n[0]))
-                           
-          for d in packing_list_items:
-            if d[1]:
-              val_rate = sql("select valuation_rate from `tabStock Ledger Entry` where item_code = '%s' and warehouse = '%s' and voucher_type = 'Delivery Note' and voucher_no = '%s' and is_cancelled = 'No'"%(d[0], d[1], p[0]))
-              
-              val_rate = val_rate and val_rate[0][0] or 0
-              
-              tot_val_rate += t[0] and (flt(val_rate) * flt(d[2]) / flt(t[0])) or 0
-          val_amount += flt(tot_val_rate) * flt(t[0])  
-  elif based_on == 'Territory':
-    
-
-    dn = sql("select name from `tabDelivery Note` where territory in %s and docstatus =1 order by name"%(cn))
-
-    for n in dn:
-
-      dt = sql("select sum(qty), sum(amount) from `tabDelivery Note Detail` where parent = '%s' and docstatus = 1"%n[0])
-      qty += dt[0][0] and dt[0][0] or 0
-      amt += dt[0][1] and dt[0][1] or 0
-
-      d1 = sql("select item_code,qty from `tabDelivery Note Detail` where parent = '%s' and parenttype ='Delivery Note' and docstatus =1"%n[0])
-
-      for t in d1:
-        tot_val_rate = 0
-        packing_list_items = sql("select item_code, warehouse, qty from `tabDelivery Note Packing Detail` where parent = '%s' and parent_item = '%s' and docstatus = 1 order by item_code, warehouse,qty"%(n[0],t[0]))
-       
-        for d in packing_list_items:
-          if d[1]:
-            
-            val_rate = sql("select valuation_rate from `tabStock Ledger Entry` where item_code = '%s' and warehouse = '%s' and voucher_type = 'Delivery Note' and voucher_no = '%s' and is_cancelled = 'No'"%(d[0], d[1], n[0]))
-            val_rate = val_rate and val_rate[0][0] or 0
-            
-            tot_val_rate += t[1] and (flt(val_rate) * flt(d[2]) / flt(t[1])) or 0
-        val_amount += flt(tot_val_rate) * flt(t[1])
-  r.append(fmt_money(qty))
-
-  r.append(fmt_money(amt))
-  gp = flt(r[col_idx['Revenue']]) - flt(val_amount)
-  
-  if val_amount: gp_percent = gp * 100 / flt(val_amount)
-  else: gp_percent = gp
-  gp_percent = '%0.2f'%gp_percent
-
-      
-
-  r.append(fmt_money(val_amount))
-  r.append(fmt_money(gp_percent))
-  r.append(fmt_money(gp))
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/territory_item_group_wise_gp/territory_item_group_wise_gp.txt b/erpnext/selling/search_criteria/territory_item_group_wise_gp/territory_item_group_wise_gp.txt
deleted file mode 100644
index ff29d1d..0000000
--- a/erpnext/selling/search_criteria/territory_item_group_wise_gp/territory_item_group_wise_gp.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-[
-	{
-		'add_col': None,
-		'add_cond': None,
-		'add_tab': None,
-		'columns': None,
-		'creation': '2010-12-14 17:52:48',
-		'criteria_name': 'Territory, Item Group wise GP',
-		'custom_query': '',
-		'description': None,
-		'dis_filters': None,
-		'disabled': None,
-		'doc_type': 'Delivery Note',
-		'docstatus': 0,
-		'doctype': 'Search Criteria',
-		'filters': "{'Delivery Note\x01Status':'','Delivery Note\x01Fiscal Year':''}",
-		'graph_series': None,
-		'graph_values': None,
-		'group_by': None,
-		'idx': None,
-		'modified': '2011-05-09 14:40:26',
-		'modified_by': 'Administrator',
-		'module': 'CRM',
-		'name': 'territory_item_group_wise_gp',
-		'owner': 'harshada@webnotestech.com',
-		'page_len': 50,
-		'parent': None,
-		'parent_doc_type': None,
-		'parentfield': None,
-		'parenttype': None,
-		'report_script': '',
-		'server_script': None,
-		'sort_by': None,
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.js b/erpnext/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.js
index 2d725d2..aabd4e1 100644
--- a/erpnext/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.js
+++ b/erpnext/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.js
@@ -15,7 +15,7 @@
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 report.customize_filters = function() {
-  this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Receivable Voucher',report_default:'Sales Order',ignore : 1, parent:'Territory'});
+  this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice',report_default:'Sales Order',ignore : 1, parent:'Territory'});
   this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Territory'});
   this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company',report_default:sys_defaults.company, ignore : 1, parent:'Territory'});
   this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Territory'});
diff --git a/erpnext/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.txt b/erpnext/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.txt
index 9344df2..b895894 100644
--- a/erpnext/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.txt
+++ b/erpnext/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:31',
+		'creation': '2012-04-03 12:49:53',
 		'docstatus': 0,
-		'modified': '2010-03-30 16:48:42',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:53',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Territory\x01ID',
-		'criteria_name': 'Territory Sales - Variance Report',
-		'doc_type': 'Territory',
+		'columns': u'Territory\x01ID',
+		'criteria_name': u'Territory Sales - Variance Report',
+		'doc_type': u'Territory',
 		'doctype': 'Search Criteria',
-		'filters': "{'Territory\x01State':'','Territory\x01Based On':'Sales Order','Territory\x01Fiscal Year':'2009-2010','Territory\x01Company':'Alpha Company','Territory\x01Period':'Quarterly'}",
-		'module': 'Selling',
+		'filters': u"{'Territory\x01State':'','Territory\x01Based On':'Sales Order','Territory\x01Fiscal Year':'2009-2010','Territory\x01Company':'Alpha Company','Territory\x01Period':'Quarterly'}",
+		'module': u'Selling',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': 'ID',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'ID',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, territory_sales_-_variance_report
 	{
 		'doctype': 'Search Criteria',
-		'name': 'territory_sales_-_variance_report'
+		'name': u'territory_sales_-_variance_report'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/total_target_variance_report/total_target_variance_report.py b/erpnext/selling/search_criteria/total_target_variance_report/total_target_variance_report.py
index fb6dee1..fde7237 100644
--- a/erpnext/selling/search_criteria/total_target_variance_report/total_target_variance_report.py
+++ b/erpnext/selling/search_criteria/total_target_variance_report/total_target_variance_report.py
@@ -25,7 +25,7 @@
 fiscal_year = filter_values.get('fiscal_year')
 period = filter_values.get('period')
 under = filter_values.get('under')
-if under == 'Sales Invoice': under = 'Receivable Voucher'
+if under == 'Sales Invoice': under = 'Sales Invoice'
 based_on = filter_values.get('based_on')
 target_on = filter_values.get('target_on')
 
@@ -201,10 +201,10 @@
     #----------------------------------------------------------    
     if target_on == "Quantity":
       if based_on == "Territory":
-        actual = sql("select sum(ifnull(t2.qty,0)) from `tab%s` t1, `tab%s Detail` t2 where t2.parenttype = '%s' and t2.parent = t1.name and t1.%s in %s and t1.docstatus = 1 and t1.%s between '%s' and '%s'" % (under, (under == 'Receivable Voucher') and 'RV' or under, under, based_on_fn, ch, date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+        actual = sql("select sum(ifnull(t2.qty,0)) from `tab%s` t1, `tab%s Detail` t2 where t2.parenttype = '%s' and t2.parent = t1.name and t1.%s in %s and t1.docstatus = 1 and t1.%s between '%s' and '%s'" % (under, (under == 'Sales Invoice') and 'RV' or under, under, based_on_fn, ch, date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
       
       elif based_on == 'Sales Person':
-        actual = sql("select sum(ifnull(t2.qty,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3 where t2.parent = t1.name and t3.parent = t1.name and t3.%s in %s and t1.docstatus != 2 and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, (under == 'Receivable Voucher') and 'RV' or under, based_on_fn, ch, date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+        actual = sql("select sum(ifnull(t2.qty,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3 where t2.parent = t1.name and t3.parent = t1.name and t3.%s in %s and t1.docstatus != 2 and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, (under == 'Sales Invoice') and 'RV' or under, based_on_fn, ch, date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
     
     #----------------------------------------------------------  
     if target_on == "Amount":
diff --git a/erpnext/selling/search_criteria/total_target_variance_report/total_target_variance_report.txt b/erpnext/selling/search_criteria/total_target_variance_report/total_target_variance_report.txt
index 6d679c3..510d81b 100644
--- a/erpnext/selling/search_criteria/total_target_variance_report/total_target_variance_report.txt
+++ b/erpnext/selling/search_criteria/total_target_variance_report/total_target_variance_report.txt
@@ -3,32 +3,32 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 10:23:21',
+		'creation': '2012-04-03 12:49:53',
 		'docstatus': 0,
-		'modified': '2010-11-30 15:15:34',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:53',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Sales Person\x01ID,Sales Person\x01Owner,Sales Person\x01Sales Person,Sales Person\x01Country,Sales Person\x01State,Sales Person\x01lft,Sales Person\x01rgt,Target Detail\x01Item Group,Target Detail\x01Fiscal Year,Target Detail\x01Target  Amount',
-		'criteria_name': 'Total Target Variance Report',
-		'doc_type': 'Target Detail',
+		'columns': u'Sales Person\x01ID,Sales Person\x01Owner,Sales Person\x01Sales Person,Sales Person\x01Country,Sales Person\x01State,Sales Person\x01lft,Sales Person\x01rgt,Target Detail\x01Item Group,Target Detail\x01Fiscal Year,Target Detail\x01Target  Amount',
+		'criteria_name': u'Total Target Variance Report',
+		'doc_type': u'Target Detail',
 		'doctype': 'Search Criteria',
-		'filters': "{'Sales Person\x01Saved':1,'Sales Person\x01Submitted':1,'Sales Person\x01Country':'','Sales Person\x01State':'','Target Detail\x01Fiscal Year':''}",
-		'module': 'Selling',
+		'filters': u"{'Sales Person\x01Saved':1,'Sales Person\x01Submitted':1,'Sales Person\x01Country':'','Sales Person\x01State':'','Target Detail\x01Fiscal Year':''}",
+		'module': u'Selling',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Sales Person',
-		'sort_by': '`tabSales Person`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Sales Person',
+		'sort_by': u'`tabSales Person`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, total_target_variance_report
 	{
 		'doctype': 'Search Criteria',
-		'name': 'total_target_variance_report'
+		'name': u'total_target_variance_report'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/selling/search_criteria/variance_report/variance_report.js b/erpnext/selling/search_criteria/variance_report/variance_report.js
index e4011e5..b5fe3fb 100644
--- a/erpnext/selling/search_criteria/variance_report/variance_report.js
+++ b/erpnext/selling/search_criteria/variance_report/variance_report.js
@@ -22,7 +22,7 @@
   this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Target Detail'});
 //  this.add_filter({fieldname:'item_group', label:'Item Group', fieldtype:'Link', options:'Item Group', ignore : 1, parent:'Target Detail'});
   this.add_filter({fieldname:'group_by', label:'Group By', fieldtype:'Select', options:NEWLINE+'Item Group',ignore : 1, parent:'Target Detail'});
-  this.add_filter({fieldname:'under', label:'Under',fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Receivable Voucher',report_default:'Sales Order',ignore : 1, parent:'Target Detail'});
+  this.add_filter({fieldname:'under', label:'Under',fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice',report_default:'Sales Order',ignore : 1, parent:'Target Detail'});
 }  
 
 //this.mytabs.items['Select Columns'].hide()
diff --git a/erpnext/selling/search_criteria/variance_report/variance_report.py b/erpnext/selling/search_criteria/variance_report/variance_report.py
index 6948eac..f200f11 100644
--- a/erpnext/selling/search_criteria/variance_report/variance_report.py
+++ b/erpnext/selling/search_criteria/variance_report/variance_report.py
@@ -58,7 +58,7 @@
   based = 'sales_partner'
 
 
-if under == 'Receivable Voucher':
+if under == 'Sales Invoice':
   under_detail = 'RV'
   dt = 'posting_date'
 else:
diff --git a/erpnext/selling/search_criteria/variance_report/variance_report.txt b/erpnext/selling/search_criteria/variance_report/variance_report.txt
index 9e3cbb3..f45df2f 100644
--- a/erpnext/selling/search_criteria/variance_report/variance_report.txt
+++ b/erpnext/selling/search_criteria/variance_report/variance_report.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:31',
+		'creation': '2012-04-03 12:49:53',
 		'docstatus': 0,
-		'modified': '2010-05-05 11:13:12',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:53',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'criteria_name': 'Variance Report',
-		'doc_type': 'Target Detail',
+		'criteria_name': u'Variance Report',
+		'doc_type': u'Target Detail',
 		'doctype': 'Search Criteria',
-		'filters': "{'Territory\x01State':'','Target Detail\x01Fiscal Year':'2009-2010','Target Detail\x01Based On':'Territory','Target Detail\x01Company':'Alpha Company','Target Detail\x01Period':'Quarterly','Target Detail\x01Under':'Sales Order'}",
-		'module': 'Selling',
+		'filters': u"{'Territory\x01State':'','Target Detail\x01Fiscal Year':'2009-2010','Target Detail\x01Based On':'Territory','Target Detail\x01Company':'Alpha Company','Target Detail\x01Period':'Quarterly','Target Detail\x01Under':'Sales Order'}",
+		'module': u'Selling',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Territory',
-		'sort_by': 'ID',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Territory',
+		'sort_by': u'ID',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, variance_report
 	{
 		'doctype': 'Search Criteria',
-		'name': 'variance_report'
+		'name': u'variance_report'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/Module Def/Setup/Setup.txt b/erpnext/setup/Module Def/Setup/Setup.txt
deleted file mode 100644
index 5a0dcf7..0000000
--- a/erpnext/setup/Module Def/Setup/Setup.txt
+++ /dev/null
@@ -1,652 +0,0 @@
-[
-	{
-		'_last_update': None,
-		'creation': '2010-11-30 22:43:08',
-		'disabled': 'No',
-		'docstatus': 0,
-		'doctype': 'Module Def',
-		'doctype_list': None,
-		'file_list': None,
-		'idx': None,
-		'is_hidden': 'No',
-		'last_updated_date': '2011-03-21 12:13:39',
-		'modified': '2010-09-25 00:00:00',
-		'modified_by': 'Administrator',
-		'module_desc': None,
-		'module_icon': 'wired.png',
-		'module_label': 'Setup',
-		'module_name': 'Setup',
-		'module_page': 'Setup',
-		'module_seq': 1,
-		'name': 'Setup',
-		'owner': 'Administrator',
-		'parent': None,
-		'parentfield': None,
-		'parenttype': None,
-		'trash_reason': None,
-		'widget_code': None
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:43:08',
-		'description': 'All important setup items in one place',
-		'display_name': 'Setup Wizard',
-		'doc_name': 'Setup Wizard',
-		'doc_type': 'Pages',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': 'lightbulb.gif',
-		'idx': 1,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': 'MDI00221',
-		'owner': 'Administrator',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:43:08',
-		'description': 'Personalize settings like company banner, date format, print format header etc.',
-		'display_name': 'Personalize',
-		'doc_name': 'Personalize Page',
-		'doc_type': 'Pages',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': 'star.gif',
-		'idx': 2,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': 'MDI00222',
-		'owner': 'Administrator',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:43:08',
-		'description': 'Enable / Disable users. Set user roles.',
-		'display_name': 'Manage Users',
-		'doc_name': 'Manage Users',
-		'doc_type': 'Pages',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': 'group.gif',
-		'idx': 3,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': 'MDI00223',
-		'owner': 'Administrator',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:43:08',
-		'description': 'Set global default values and account settings',
-		'display_name': 'Setup Defaults',
-		'doc_name': 'Manage Account',
-		'doc_type': 'Single DocType',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': 'folder.gif',
-		'idx': 4,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': 'MDI00224',
-		'owner': 'Administrator',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:43:08',
-		'description': 'General Masters',
-		'display_name': 'Setup Masters',
-		'doc_name': 'Setup Masters',
-		'doc_type': 'Pages',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': 'wrench.gif',
-		'idx': 5,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': 'MDI00225',
-		'owner': 'Administrator',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:43:08',
-		'description': None,
-		'display_name': 'Sales Browser',
-		'doc_name': 'Sales Browser',
-		'doc_type': 'Pages',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 6,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': 'MDI00226',
-		'owner': 'Administrator',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 15:04:47',
-		'description': None,
-		'display_name': None,
-		'doc_name': None,
-		'doc_type': 'Separator',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 7,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': '000003107',
-		'owner': 'Administrator',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:43:08',
-		'description': "Import data like Customers, Items etc in 'CSV' format",
-		'display_name': 'Import Data',
-		'doc_name': 'Import Data',
-		'doc_type': 'Pages',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': 'disk.gif',
-		'idx': 8,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': 'MDI00228',
-		'owner': 'nabin@webnotestech.com',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:43:08',
-		'description': 'Set series prefix for transactions',
-		'display_name': 'Setup Series',
-		'doc_name': 'Naming Series',
-		'doc_type': 'Single DocType',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': 'paperclip.gif',
-		'idx': 9,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': 'MDI00229',
-		'owner': 'Administrator',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:43:08',
-		'description': 'Set approval rights for transactions based on grand total and discount.',
-		'display_name': 'Authorization Rule',
-		'doc_name': 'Authorization Rule',
-		'doc_type': 'Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': 'transaction\nbased_on\nmaster_name\nsystem_user\nsystem_role\napproving_role\napproving_user\nvalue',
-		'hide': None,
-		'icon': 'accept.gif',
-		'idx': 10,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': 'MDI00230',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:43:08',
-		'description': 'Add fields in transactions, masters...',
-		'display_name': 'Custom Field',
-		'doc_name': 'Custom Field',
-		'doc_type': 'Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': 'dt\nlabel\nfieldtype\noptions',
-		'hide': None,
-		'icon': 'paperclip.gif',
-		'idx': 11,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': 'MDI00231',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2010-11-30 22:43:08',
-		'description': 'Contains records that you have trashed.',
-		'display_name': 'Trash',
-		'doc_name': 'Trash',
-		'doc_type': 'Pages',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 12,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': 'MDI00232',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 15:04:47',
-		'description': None,
-		'display_name': 'Price List',
-		'doc_name': 'Price List',
-		'doc_type': 'Setup Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 13,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': '000003108',
-		'owner': 'Administrator',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 15:04:47',
-		'description': None,
-		'display_name': 'Warehouse Type',
-		'doc_name': 'Warehouse Type',
-		'doc_type': 'Setup Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 14,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': '000003109',
-		'owner': 'Administrator',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 15:04:47',
-		'description': None,
-		'display_name': 'Warehouse',
-		'doc_name': 'Warehouse',
-		'doc_type': 'Setup Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 15,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': '000003110',
-		'owner': 'Administrator',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 15:04:47',
-		'description': None,
-		'display_name': 'UOM',
-		'doc_name': 'UOM',
-		'doc_type': 'Setup Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 16,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': '000003111',
-		'owner': 'Administrator',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 15:04:47',
-		'description': None,
-		'display_name': 'Term',
-		'doc_name': 'Term',
-		'doc_type': 'Setup Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 17,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': '000003112',
-		'owner': 'Administrator',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 15:04:47',
-		'description': None,
-		'display_name': 'Taxes and Charges',
-		'doc_name': 'Other Charges',
-		'doc_type': 'Setup Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 18,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': '000003113',
-		'owner': 'Administrator',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 15:04:47',
-		'description': None,
-		'display_name': 'Business Letter Type',
-		'doc_name': 'Business Letter Type',
-		'doc_type': 'Setup Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 19,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': '000003114',
-		'owner': 'Administrator',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 15:04:47',
-		'description': None,
-		'display_name': 'Business Letter Template',
-		'doc_name': 'Business Letter Template',
-		'doc_type': 'Setup Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 20,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': '000003115',
-		'owner': 'Administrator',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'click_function': None,
-		'creation': '2011-03-24 15:04:47',
-		'description': None,
-		'display_name': 'Mode of Payment',
-		'doc_name': 'Mode of Payment',
-		'doc_type': 'Setup Forms',
-		'docstatus': 0,
-		'doctype': 'Module Def Item',
-		'fields': None,
-		'hide': None,
-		'icon': None,
-		'idx': 21,
-		'modified': '2011-03-24 15:04:47',
-		'modified_by': 'Administrator',
-		'name': '000003116',
-		'owner': 'harshada@webnotestech.com',
-		'parent': 'Setup',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-	{
-		'creation': '2010-11-30 22:43:08',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 1,
-		'modified': '2010-11-30 22:43:08',
-		'modified_by': 'Administrator',
-		'name': 'MDR00042',
-		'owner': 'Administrator',
-		'parent': 'Setup',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'Administrator'
-	},
-	{
-		'creation': '2010-11-30 22:43:08',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 2,
-		'modified': '2010-11-30 22:43:08',
-		'modified_by': 'Administrator',
-		'name': 'MDR00043',
-		'owner': 'Administrator',
-		'parent': 'Setup',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'System Manager'
-	},
-	{
-		'creation': '2010-11-30 22:43:08',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 3,
-		'modified': '2010-11-30 22:43:08',
-		'modified_by': 'Administrator',
-		'name': 'MDR00044',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Setup',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'Sales User'
-	},
-	{
-		'creation': '2010-11-30 22:43:08',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 4,
-		'modified': '2010-11-30 22:43:08',
-		'modified_by': 'Administrator',
-		'name': 'MDR00045',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Setup',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'Sales Master Manager'
-	},
-	{
-		'creation': '2010-11-30 22:43:08',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 5,
-		'modified': '2010-11-30 22:43:08',
-		'modified_by': 'Administrator',
-		'name': 'MDR00046',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Setup',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'Sales Master Manager'
-	},
-	{
-		'creation': '2010-11-30 22:43:08',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 6,
-		'modified': '2010-11-30 22:43:08',
-		'modified_by': 'Administrator',
-		'name': 'MDR00047',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Setup',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'Purchase User'
-	},
-	{
-		'creation': '2010-11-30 22:43:08',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 7,
-		'modified': '2010-11-30 22:43:08',
-		'modified_by': 'Administrator',
-		'name': 'MDR00048',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Setup',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'Purchase Master Manager'
-	},
-	{
-		'creation': '2010-11-30 22:43:08',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 8,
-		'modified': '2010-11-30 22:43:08',
-		'modified_by': 'Administrator',
-		'name': 'MDR00049',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Setup',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'Purchase Manager'
-	},
-	{
-		'creation': '2010-11-30 22:43:08',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 9,
-		'modified': '2010-11-30 22:43:08',
-		'modified_by': 'Administrator',
-		'name': 'MDR00050',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Setup',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'Material User'
-	},
-	{
-		'creation': '2010-11-30 22:43:08',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 10,
-		'modified': '2010-11-30 22:43:08',
-		'modified_by': 'Administrator',
-		'name': 'MDR00051',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Setup',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'Material Master Manager'
-	},
-	{
-		'creation': '2010-11-30 22:43:08',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 11,
-		'modified': '2010-11-30 22:43:08',
-		'modified_by': 'Administrator',
-		'name': 'MDR00052',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Setup',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'Material Manager'
-	},
-	{
-		'creation': '2010-11-30 22:43:08',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 12,
-		'modified': '2010-11-30 22:43:08',
-		'modified_by': 'Administrator',
-		'name': 'MDR00053',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Setup',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'Accounts User'
-	},
-	{
-		'creation': '2010-11-30 22:43:08',
-		'docstatus': 0,
-		'doctype': 'Module Def Role',
-		'idx': 13,
-		'modified': '2010-11-30 22:43:08',
-		'modified_by': 'Administrator',
-		'name': 'MDR00054',
-		'owner': 'saumil@webnotestech.com',
-		'parent': 'Setup',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def',
-		'role': 'Accounts Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/setup/Role/System Manager/System Manager.txt b/erpnext/setup/Role/System Manager/System Manager.txt
deleted file mode 100644
index 0918bc4..0000000
--- a/erpnext/setup/Role/System Manager/System Manager.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, System Manager
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2009-07-07 17:00:24',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Setup',
-		'name': '__common__',
-		'role_name': 'System Manager'
-	},
-
-	# Role, System Manager
-	{
-		'doctype': 'Role',
-		'name': 'System Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/setup/__init__.py b/erpnext/setup/__init__.py
index e69de29..c4b3773 100644
--- a/erpnext/setup/__init__.py
+++ b/erpnext/setup/__init__.py
@@ -0,0 +1,3 @@
+install_docs = [
+	{'doctype':'Role', 'role_name': 'System Manager', 'name': 'System Manager'}
+]
diff --git a/erpnext/setup/doctype/authorization_control/authorization_control.js b/erpnext/setup/doctype/authorization_control/authorization_control.js
deleted file mode 100644
index 077d4f5..0000000
--- a/erpnext/setup/doctype/authorization_control/authorization_control.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-// Settings
\ No newline at end of file
diff --git a/erpnext/setup/doctype/authorization_control/authorization_control.py b/erpnext/setup/doctype/authorization_control/authorization_control.py
index ddfca53..d3c89a8 100644
--- a/erpnext/setup/doctype/authorization_control/authorization_control.py
+++ b/erpnext/setup/doctype/authorization_control/authorization_control.py
@@ -102,7 +102,7 @@
 		if based_on == 'Grand Total': auth_value = total
 		elif based_on == 'Customerwise Discount':
 			if doc_obj:
-				if doc_obj.doc.doctype == 'Receivable Voucher': customer = doc_obj.doc.customer
+				if doc_obj.doc.doctype == 'Sales Invoice': customer = doc_obj.doc.customer
 				else: customer = doc_obj.doc.customer_name
 				add_cond = " and master_name = '"+make_esc("'")(cstr(customer))+"'"
 		if based_on == 'Itemwise Discount':
@@ -116,8 +116,8 @@
 	# Check Approving Authority for transactions other than expense voucher and Appraisal
 	# -------------------------
 	def validate_approving_authority(self, doctype_name,company, total, doc_obj = ''):
-		if doctype_name == 'Payable Voucher': doctype_name = 'Purchase Invoice'
-		elif doctype_name == 'Receivable Voucher': doctype_name = 'Sales Invoice'
+		if doctype_name == 'Purchase Invoice': doctype_name = 'Purchase Invoice'
+		elif doctype_name == 'Sales Invoice': doctype_name = 'Sales Invoice'
 		av_dis = 0
 		if doc_obj:
 			ref_rate, basic_rate = 0, 0
@@ -192,7 +192,7 @@
 		rule ={}
 		
 		if doc_obj:
-			if doctype_name == 'Expense Voucher':
+			if doctype_name == 'Expense Claim':
 				rule = self.get_value_based_rule(doctype_name,doc_obj.doc.employee,doc_obj.doc.total_claimed_amount, doc_obj.doc.company)
 			elif doctype_name == 'Appraisal':
 				rule = sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and company = %s and docstatus!=2",(doctype_name,doc_obj.doc.employee, doc_obj.doc.employee, doc_obj.doc.company),as_dict=1)				
diff --git a/erpnext/setup/doctype/authorization_control/authorization_control.txt b/erpnext/setup/doctype/authorization_control/authorization_control.txt
index ce07175..bf204ce 100644
--- a/erpnext/setup/doctype/authorization_control/authorization_control.txt
+++ b/erpnext/setup/doctype/authorization_control/authorization_control.txt
@@ -3,28 +3,28 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:52',
+		'creation': '2012-03-27 14:36:18',
 		'docstatus': 0,
-		'modified': '2010-12-16 23:57:05',
-		'modified_by': 'nabin@webnotestech.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:18',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'issingle': 1,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
-		'section_style': 'Tabbed',
-		'server_code_error': ' ',
+		'section_style': u'Tabbed',
+		'server_code_error': u' ',
 		'version': 216
 	},
 
 	# DocType, Authorization Control
 	{
 		'doctype': 'DocType',
-		'name': 'Authorization Control'
+		'name': u'Authorization Control'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/authorization_rule/authorization_rule.js b/erpnext/setup/doctype/authorization_rule/authorization_rule.js
index 02bd653..8878358 100644
--- a/erpnext/setup/doctype/authorization_rule/authorization_rule.js
+++ b/erpnext/setup/doctype/authorization_rule/authorization_rule.js
@@ -32,7 +32,7 @@
   if(doc.based_on == 'Not Applicable') hide_field('value');
   else unhide_field('value');
   
-  if(doc.transaction == 'Expense Voucher' || doc.transaction == 'Appraisal'){
+  if(doc.transaction == 'Expense Claim' || doc.transaction == 'Appraisal'){
     hide_field(['master_name','system_role', 'system_user']);
     unhide_field(['to_emp','to_designation']);
     if(doc.transaction == 'Appraisal') hide_field('value');
@@ -63,7 +63,7 @@
 }
 
 cur_frm.cscript.transaction = function(doc,cdt,cdn){
-  if(doc.transaction == 'Expense Voucher' || doc.transaction == 'Appraisal'){
+  if(doc.transaction == 'Expense Claim' || doc.transaction == 'Appraisal'){
     doc.master_name = doc.system_role = doc.system_user = '';
     refresh_many(['master_name','system_role', 'system_user']);
     hide_field(['master_name','system_role', 'system_user']);
@@ -80,7 +80,7 @@
     hide_field(['to_emp','to_designation']);
   }
   
-  if(doc.transaction == 'Expense Voucher') doc.based_on = 'Total Claimed Amount';
+  if(doc.transaction == 'Expense Claim') doc.based_on = 'Total Claimed Amount';
   if(doc.transaction == 'Appraisal') doc.based_on == 'Not Applicable';
 }
 
diff --git a/erpnext/setup/doctype/authorization_rule/authorization_rule.py b/erpnext/setup/doctype/authorization_rule/authorization_rule.py
index 2c4a0dc..81ca202 100644
--- a/erpnext/setup/doctype/authorization_rule/authorization_rule.py
+++ b/erpnext/setup/doctype/authorization_rule/authorization_rule.py
@@ -69,7 +69,7 @@
   # Validate Rule
   # --------------
   def validate_rule(self):
-    if not self.doc.transaction == 'Expense Voucher' and not self.doc.transaction == 'Appraisal':
+    if not self.doc.transaction == 'Expense Claim' and not self.doc.transaction == 'Appraisal':
       if not self.doc.approving_role and not self.doc.approving_user:
         msgprint("Please enter Approving Role or Approving User")
         raise Exception
@@ -95,8 +95,8 @@
       if self.doc.transaction == 'Appraisal' and self.doc.based_on != 'Not Applicable':
         msgprint("Based on is 'Not Applicable' while setting authorization rule for 'Appraisal'")
         raise Exception
-      if self.doc.transaction == 'Expense Voucher' and self.doc.based_on != 'Total Claimed Amount':
-        msgprint("Authorization rule should be based on 'Total Calimed Amount' while setting authorization rule for 'Expense Voucher'")
+      if self.doc.transaction == 'Expense Claim' and self.doc.based_on != 'Total Claimed Amount':
+        msgprint("Authorization rule should be based on 'Total Calimed Amount' while setting authorization rule for 'Expense Claim'")
         raise Exception
 
 
diff --git a/erpnext/setup/doctype/authorization_rule/authorization_rule.txt b/erpnext/setup/doctype/authorization_rule/authorization_rule.txt
index a436495..e358544 100644
--- a/erpnext/setup/doctype/authorization_rule/authorization_rule.txt
+++ b/erpnext/setup/doctype/authorization_rule/authorization_rule.txt
@@ -3,36 +3,36 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:52',
+		'creation': '2012-03-27 14:36:18',
 		'docstatus': 0,
-		'modified': '2010-12-02 18:06:28',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:18',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1308741898',
+		'_last_update': u'1308741898',
 		'allow_trash': 1,
-		'autoname': 'AR.####',
-		'colour': 'White:FFF',
+		'autoname': u'AR.####',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'Setup',
+		'document_type': u'Master',
+		'module': u'Setup',
 		'name': '__common__',
-		'search_fields': 'transaction,based_on,system_user,system_role,approving_user,approving_role',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'search_fields': u'transaction,based_on,system_user,system_role,approving_user,approving_role',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 58
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Authorization Rule',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Authorization Rule',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
@@ -40,187 +40,173 @@
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Authorization Rule',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Authorization Rule',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
 	# DocType, Authorization Rule
 	{
 		'doctype': 'DocType',
-		'name': 'Authorization Rule'
+		'name': u'Authorization Rule'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 1
+		'doctype': u'DocPerm'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2
+		'doctype': u'DocPerm'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Company',
-		'oldfieldname': 'company',
-		'oldfieldtype': 'Link',
-		'options': 'Company',
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Link',
+		'label': u'Company',
+		'oldfieldname': u'company',
+		'oldfieldtype': u'Link',
+		'options': u'Company',
 		'reqd': 0,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'transaction',
-		'fieldtype': 'Select',
-		'idx': 2,
-		'label': 'Transaction',
-		'oldfieldname': 'transaction',
-		'oldfieldtype': 'Select',
-		'options': '\nDelivery Note\nPurchase Invoice\nPurchase Order\nPurchase Receipt\nQuotation\nSales Invoice\nSales Order\nStock Entry\nExpense Voucher\nAppraisal',
+		'doctype': u'DocField',
+		'fieldname': u'transaction',
+		'fieldtype': u'Select',
+		'label': u'Transaction',
+		'oldfieldname': u'transaction',
+		'oldfieldtype': u'Select',
+		'options': u'\nDelivery Note\nPurchase Invoice\nPurchase Order\nPurchase Receipt\nQuotation\nSales Invoice\nSales Order\nStock Entry\nExpense Claim\nAppraisal',
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'based_on',
-		'fieldtype': 'Select',
-		'idx': 3,
-		'label': 'Based On',
-		'oldfieldname': 'based_on',
-		'oldfieldtype': 'Select',
-		'options': '\nGrand Total\nAverage Discount\nCustomerwise Discount\nItemwise Discount\nTotal Claimed Amount\nNot Applicable',
+		'doctype': u'DocField',
+		'fieldname': u'based_on',
+		'fieldtype': u'Select',
+		'label': u'Based On',
+		'oldfieldname': u'based_on',
+		'oldfieldtype': u'Select',
+		'options': u'\nGrand Total\nAverage Discount\nCustomerwise Discount\nItemwise Discount\nTotal Claimed Amount\nNot Applicable',
 		'reqd': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'master_name',
-		'fieldtype': 'Link',
-		'idx': 4,
-		'label': 'Customer / Item Name',
-		'oldfieldname': 'master_name',
-		'oldfieldtype': 'Link',
-		'trigger': 'Client'
+		'doctype': u'DocField',
+		'fieldname': u'master_name',
+		'fieldtype': u'Link',
+		'label': u'Customer / Item Name',
+		'oldfieldname': u'master_name',
+		'oldfieldtype': u'Link',
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'system_role',
-		'fieldtype': 'Link',
-		'idx': 5,
-		'label': 'Applicable To (Role)',
-		'oldfieldname': 'system_role',
-		'oldfieldtype': 'Link',
-		'options': 'Role'
+		'doctype': u'DocField',
+		'fieldname': u'system_role',
+		'fieldtype': u'Link',
+		'label': u'Applicable To (Role)',
+		'oldfieldname': u'system_role',
+		'oldfieldtype': u'Link',
+		'options': u'Role'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'system_user',
-		'fieldtype': 'Link',
-		'idx': 6,
-		'label': 'Applicable To (User)',
-		'oldfieldname': 'system_user',
-		'oldfieldtype': 'Link',
-		'options': 'Profile'
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'system_user',
+		'fieldtype': u'Link',
+		'label': u'Applicable To (User)',
+		'oldfieldname': u'system_user',
+		'oldfieldtype': u'Link',
+		'options': u'Profile'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'This will be used for setting rule in HR module',
-		'doctype': 'DocField',
-		'fieldname': 'to_emp',
-		'fieldtype': 'Link',
-		'idx': 7,
-		'label': 'Applicable To (Employee)',
-		'oldfieldname': 'to_emp',
-		'oldfieldtype': 'Link',
-		'options': 'Employee',
+		'colour': u'White:FFF',
+		'description': u'This will be used for setting rule in HR module',
+		'doctype': u'DocField',
+		'fieldname': u'to_emp',
+		'fieldtype': u'Link',
+		'label': u'Applicable To (Employee)',
+		'oldfieldname': u'to_emp',
+		'oldfieldtype': u'Link',
+		'options': u'Employee',
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'This will be used for setting rule in HR module',
-		'doctype': 'DocField',
-		'fieldname': 'to_designation',
-		'fieldtype': 'Link',
-		'idx': 8,
-		'label': 'Applicable To (Designation)',
-		'oldfieldname': 'to_designation',
-		'oldfieldtype': 'Link',
-		'options': 'Designation',
+		'colour': u'White:FFF',
+		'description': u'This will be used for setting rule in HR module',
+		'doctype': u'DocField',
+		'fieldname': u'to_designation',
+		'fieldtype': u'Link',
+		'label': u'Applicable To (Designation)',
+		'oldfieldname': u'to_designation',
+		'oldfieldtype': u'Link',
+		'options': u'Designation',
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'approving_role',
-		'fieldtype': 'Link',
-		'idx': 9,
-		'label': 'Approving Role',
-		'oldfieldname': 'approving_role',
-		'oldfieldtype': 'Link',
-		'options': 'Role'
+		'doctype': u'DocField',
+		'fieldname': u'approving_role',
+		'fieldtype': u'Link',
+		'label': u'Approving Role',
+		'oldfieldname': u'approving_role',
+		'oldfieldtype': u'Link',
+		'options': u'Role'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'approving_user',
-		'fieldtype': 'Link',
-		'idx': 10,
-		'label': 'Approving User',
-		'oldfieldname': 'approving_user',
-		'oldfieldtype': 'Link',
-		'options': 'Profile'
+		'doctype': u'DocField',
+		'fieldname': u'approving_user',
+		'fieldtype': u'Link',
+		'label': u'Approving User',
+		'oldfieldname': u'approving_user',
+		'oldfieldtype': u'Link',
+		'options': u'Profile'
 	},
 
 	# DocField
 	{
-		'default': '0.00',
-		'doctype': 'DocField',
-		'fieldname': 'value',
-		'fieldtype': 'Currency',
-		'idx': 11,
-		'label': 'Above Value',
-		'oldfieldname': 'value',
-		'oldfieldtype': 'Currency'
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'value',
+		'fieldtype': u'Currency',
+		'label': u'Above Value',
+		'oldfieldname': u'value',
+		'oldfieldtype': u'Currency'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 12,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text'
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/brand/brand.txt b/erpnext/setup/doctype/brand/brand.txt
index ccf2ca6..97ab298 100644
--- a/erpnext/setup/doctype/brand/brand.txt
+++ b/erpnext/setup/doctype/brand/brand.txt
@@ -3,113 +3,60 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:53',
+		'creation': '2012-03-27 14:36:19',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'yogesh@webnotestech.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:19',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
 		'allow_trash': 1,
-		'autoname': 'field:brand',
-		'colour': 'White:FFF',
+		'autoname': u'field:brand',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'Setup',
+		'document_type': u'Master',
+		'module': u'Setup',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 5
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Brand',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Brand',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Brand',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Brand',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Brand
 	{
 		'doctype': 'DocType',
-		'name': 'Brand'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'permlevel': 1,
-		'role': 'Material Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'permlevel': 0,
-		'role': 'Material Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'permlevel': 1,
-		'role': 'Material User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 4,
-		'permlevel': 0,
-		'role': 'Material User',
-		'submit': 0,
-		'write': 0
+		'name': u'Brand'
 	},
 
 	# DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 5,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Material Master Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
@@ -117,48 +64,92 @@
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 6,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'Material Master Manager',
 		'write': 1
 	},
 
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material User',
+		'submit': 0,
+		'write': 0
+	},
+
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'brand',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Brand Name',
-		'oldfieldname': 'brand',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'brand',
+		'fieldtype': u'Data',
+		'label': u'Brand Name',
+		'oldfieldname': u'brand',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Text',
-		'idx': 3,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Text',
 		'permlevel': 0,
-		'width': '300px'
+		'width': u'300px'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 9756583..e0c12d8 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -241,14 +241,14 @@
 			#update value as blank for tabDefaultValue defkey=company
 			sql("update `tabDefaultValue` set defvalue = '' where defkey='company' and defvalue = %s", self.doc.name)
 			
-			#update value as blank for tabSingles Manage Account
-			sql("update `tabSingles` set value = '' where doctype='Manage Account' and field = 'default_company' and value = %s", self.doc.name)
+			#update value as blank for tabSingles Global Defaults
+			sql("update `tabSingles` set value = '' where doctype='Global Defaults' and field = 'default_company' and value = %s", self.doc.name)
 
 		
 	# on rename
 	# ---------
 	def on_rename(self,newdn,olddn):		
 		sql("update `tabCompany` set company_name = '%s' where name = '%s'" %(newdn,olddn))	
-		sql("update `tabSingles` set value = %s where doctype='Manage Account' and field = 'default_company' and value = %s", (newdn, olddn))	
+		sql("update `tabSingles` set value = %s where doctype='Global Defaults' and field = 'default_company' and value = %s", (newdn, olddn))	
 		if get_defaults('company') == olddn:
 			set_default('company', newdn)
diff --git a/erpnext/setup/doctype/company/company.txt b/erpnext/setup/doctype/company/company.txt
index 11ad19c..17bd61b 100644
--- a/erpnext/setup/doctype/company/company.txt
+++ b/erpnext/setup/doctype/company/company.txt
@@ -3,52 +3,52 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:55',
+		'creation': '2012-03-27 14:36:19',
 		'docstatus': 0,
-		'modified': '2011-12-14 15:12:28',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:19',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1323855292',
+		'_last_update': u'1323855292',
 		'allow_trash': 1,
-		'autoname': 'field:company_name',
-		'colour': 'White:FFF',
+		'autoname': u'field:company_name',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'Setup',
+		'document_type': u'Master',
+		'module': u'Setup',
 		'name': '__common__',
-		'section_style': 'Tabbed',
-		'server_code_error': ' ',
+		'section_style': u'Tabbed',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 96
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Company',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Company',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Company',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Company',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Company
 	{
 		'doctype': 'DocType',
-		'name': 'Company'
+		'name': u'Company'
 	},
 
 	# DocPerm
@@ -56,9 +56,9 @@
 		'amend': 0,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'submit': 0,
 		'write': 1
 	},
@@ -68,9 +68,9 @@
 		'amend': 0,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'submit': 0,
 		'write': 1
 	},
@@ -78,285 +78,291 @@
 	# DocPerm
 	{
 		'cancel': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'All'
+		'role': u'All'
 	},
 
 	# DocField
 	{
-		'description': 'Please Enter Company Name and Abbr and save the document. Once saved Accounting Settings will be populated automatically',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Details',
-		'oldfieldtype': 'Section Break',
+		'description': u'Please Enter Company Name and Abbr and save the document. Once saved Accounting Settings will be populated automatically',
+		'doctype': u'DocField',
+		'fieldname': u'details',
+		'fieldtype': u'Section Break',
+		'label': u'Details',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'company_name',
-		'fieldtype': 'Data',
-		'label': 'Company',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'company_name',
+		'fieldtype': u'Data',
+		'label': u'Company',
 		'no_copy': 0,
-		'oldfieldname': 'company_name',
-		'oldfieldtype': 'Data',
+		'oldfieldname': u'company_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Please Enter Abbreviation or Short Name properly as it will be added as Suffix to all Account Heads.',
-		'doctype': 'DocField',
-		'fieldname': 'abbr',
-		'fieldtype': 'Data',
-		'label': 'Abbr',
+		'colour': u'White:FFF',
+		'description': u'Please Enter Abbreviation or Short Name properly as it will be added as Suffix to all Account Heads.',
+		'doctype': u'DocField',
+		'fieldname': u'abbr',
+		'fieldtype': u'Data',
+		'label': u'Abbr',
 		'no_copy': 0,
-		'oldfieldname': 'abbr',
-		'oldfieldtype': 'Data',
+		'oldfieldname': u'abbr',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Default Settings',
-		'oldfieldtype': 'Section Break',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'default_settings',
+		'fieldtype': u'Section Break',
+		'label': u'Default Settings',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'default_currency',
-		'fieldtype': 'Select',
-		'label': 'Default Currency',
-		'options': 'link:Currency',
+		'doctype': u'DocField',
+		'fieldname': u'default_currency',
+		'fieldtype': u'Select',
+		'label': u'Default Currency',
+		'options': u'link:Currency',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldname': 'default_bank_account',
-		'fieldtype': 'Link',
-		'label': 'Default Bank Account',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'default_bank_account',
+		'fieldtype': u'Link',
+		'label': u'Default Bank Account',
 		'no_copy': 1,
-		'oldfieldname': 'default_bank_account',
-		'oldfieldtype': 'Link',
-		'options': 'Account',
+		'oldfieldname': u'default_bank_account',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldname': 'receivables_group',
-		'fieldtype': 'Link',
-		'label': 'Receivables Group',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'receivables_group',
+		'fieldtype': u'Link',
+		'label': u'Receivables Group',
 		'no_copy': 1,
-		'oldfieldname': 'receivables_group',
-		'oldfieldtype': 'Link',
-		'options': 'Account',
+		'oldfieldname': u'receivables_group',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldname': 'payables_group',
-		'fieldtype': 'Link',
-		'label': 'Payables Group',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'payables_group',
+		'fieldtype': u'Link',
+		'label': u'Payables Group',
 		'no_copy': 1,
-		'oldfieldname': 'payables_group',
-		'oldfieldtype': 'Link',
-		'options': 'Account',
+		'oldfieldname': u'payables_group',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldname': 'credit_days',
-		'fieldtype': 'Int',
-		'label': 'Credit Days',
-		'oldfieldname': 'credit_days',
-		'oldfieldtype': 'Int',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'credit_days',
+		'fieldtype': u'Int',
+		'label': u'Credit Days',
+		'oldfieldname': u'credit_days',
+		'oldfieldtype': u'Int',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldname': 'credit_limit',
-		'fieldtype': 'Currency',
-		'label': 'Credit Limit',
-		'oldfieldname': 'credit_limit',
-		'oldfieldtype': 'Currency',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'credit_limit',
+		'fieldtype': u'Currency',
+		'label': u'Credit Limit',
+		'oldfieldname': u'credit_limit',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldname': 'yearly_bgt_flag',
-		'fieldtype': 'Select',
-		'label': 'If Yearly Budget Exceeded',
-		'oldfieldname': 'yearly_bgt_flag',
-		'oldfieldtype': 'Select',
-		'options': '\nWarn\nIgnore\nStop',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'yearly_bgt_flag',
+		'fieldtype': u'Select',
+		'label': u'If Yearly Budget Exceeded',
+		'oldfieldname': u'yearly_bgt_flag',
+		'oldfieldtype': u'Select',
+		'options': u'\nWarn\nIgnore\nStop',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldname': 'monthly_bgt_flag',
-		'fieldtype': 'Select',
-		'label': 'If Monthly Budget Exceeded',
-		'oldfieldname': 'monthly_bgt_flag',
-		'oldfieldtype': 'Select',
-		'options': '\nWarn\nIgnore\nStop',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'monthly_bgt_flag',
+		'fieldtype': u'Select',
+		'label': u'If Monthly Budget Exceeded',
+		'oldfieldname': u'monthly_bgt_flag',
+		'oldfieldtype': u'Select',
+		'options': u'\nWarn\nIgnore\nStop',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Company Info',
+		'doctype': u'DocField',
+		'fieldname': u'company_info',
+		'fieldtype': u'Section Break',
+		'label': u'Company Info',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'address',
-		'fieldtype': 'Small Text',
-		'label': 'Address',
-		'oldfieldname': 'address',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'address',
+		'fieldtype': u'Small Text',
+		'label': u'Address',
+		'oldfieldname': u'address',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'phone_no',
-		'fieldtype': 'Data',
-		'label': 'Phone No',
-		'oldfieldname': 'phone_no',
-		'oldfieldtype': 'Data',
-		'options': 'Phone',
+		'doctype': u'DocField',
+		'fieldname': u'phone_no',
+		'fieldtype': u'Data',
+		'label': u'Phone No',
+		'oldfieldname': u'phone_no',
+		'oldfieldtype': u'Data',
+		'options': u'Phone',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fax',
-		'fieldtype': 'Data',
-		'label': 'Fax',
-		'oldfieldname': 'fax',
-		'oldfieldtype': 'Data',
-		'options': 'Phone',
+		'doctype': u'DocField',
+		'fieldname': u'fax',
+		'fieldtype': u'Data',
+		'label': u'Fax',
+		'oldfieldname': u'fax',
+		'oldfieldtype': u'Data',
+		'options': u'Phone',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'email',
-		'fieldtype': 'Data',
-		'label': 'Email',
-		'oldfieldname': 'email',
-		'oldfieldtype': 'Data',
-		'options': 'Email',
+		'doctype': u'DocField',
+		'fieldname': u'email',
+		'fieldtype': u'Data',
+		'label': u'Email',
+		'oldfieldname': u'email',
+		'oldfieldtype': u'Data',
+		'options': u'Email',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'website',
-		'fieldtype': 'Data',
-		'label': 'Website',
-		'oldfieldname': 'website',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'website',
+		'fieldtype': u'Data',
+		'label': u'Website',
+		'oldfieldname': u'website',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Company registration numbers for your reference. Example: VAT Registration Numbers etc.',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Registration Info',
-		'oldfieldtype': 'Section Break',
+		'colour': u'White:FFF',
+		'description': u'Company registration numbers for your reference. Example: VAT Registration Numbers etc.',
+		'doctype': u'DocField',
+		'fieldname': u'registration_info',
+		'fieldtype': u'Section Break',
+		'label': u'Registration Info',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Company registration numbers for your reference. Tax numbers etc.',
-		'doctype': 'DocField',
-		'fieldname': 'registration_details',
-		'fieldtype': 'Code',
-		'label': 'Registration Details',
-		'oldfieldname': 'registration_details',
-		'oldfieldtype': 'Code',
+		'colour': u'White:FFF',
+		'description': u'Company registration numbers for your reference. Tax numbers etc.',
+		'doctype': u'DocField',
+		'fieldname': u'registration_details',
+		'fieldtype': u'Code',
+		'label': u'Registration Details',
+		'oldfieldname': u'registration_details',
+		'oldfieldtype': u'Code',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'label': 'Trash Reason',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
 		'no_copy': 1,
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/contact_control/contact_control.js b/erpnext/setup/doctype/contact_control/contact_control.js
index b6825eb..51fc5cf 100755
--- a/erpnext/setup/doctype/contact_control/contact_control.js
+++ b/erpnext/setup/doctype/contact_control/contact_control.js
@@ -1,52 +1,15 @@
 // common partner functions
 // =========================
 
-/*
-// make shipping list body
-// ------------------------
-cur_frm.cscript.make_sl_body = function(){
-	cur_frm.fields_dict['Shipping HTML'].wrapper.innerHTML = '';
-	cur_frm.shipping_html = $a(cur_frm.fields_dict['Shipping HTML'].wrapper,'div');
-}
-*/
 
 // make history list body
 // -----------------------
 cur_frm.cscript.make_hl_body = function(){
-	cur_frm.fields_dict['History HTML'].wrapper.innerHTML = '';
-	cur_frm.history_html = $a(cur_frm.fields_dict['History HTML'].wrapper,'div');
+	cur_frm.fields_dict['history_html'].wrapper.innerHTML = '';
+	cur_frm.history_html = $a(cur_frm.fields_dict['history_html'].wrapper,'div');
 }
 
 
-/*
-// set shipping list message
-// --------------------------
-cur_frm.cscript.set_sl_msg = function(doc){
-	cur_frm.shipping_html.innerHTML = 'Shipping Address Details will appear only when you save the ' + doc.doctype.toLowerCase();
-}
-*/
-/*
-// set history list message
-// -------------------------
-cur_frm.cscript.set_hl_msg = function(doc){
-	cur_frm.history_html.innerHTML= 'History Details will appear only when you save the ' + doc.doctype.toLowerCase();
-}
-*/
-
-
-/*
-// make shipping address
-// -------------
-cur_frm.cscript.make_shipping_address = function(doc, dt, dn){
-  	cur_frm.shipping_html.innerHTML = '';
-
-	var dsn = cur_frm.doc.customer_name;
-	var dsa = cur_frm.doc.address;
-	cl = new AddressList(cur_frm.shipping_html,dt,dn,dsn,dsa);
-}
-*/
-
-
 // make history
 // -------------
 cur_frm.cscript.make_history = function(doc,dt,dn){
@@ -158,405 +121,3 @@
 		return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s"  ORDER BY  `tabTerritory`.`name` ASC LIMIT 50';
 	}
 }
-
-
-// =======================================================================================================
-
-// contact list
-// --------------
-ContactList = function(parent,dt,dn,dsn){
-	
-	var me = this;
-	
-	this.dt = dt;
-	this.dn = dn;
-	this.dsn = dsn ? dsn : dn;
-
-	this.wrapper = $a(parent,'div');
-	me.get_list();
-}
-
-// add contact
-// ------------
-ContactList.prototype.add_contact = function(){
-	var me = this;
-	
-	// onload - set default values
-	var cont = LocalDB.create('Contact');
-
-	var c = locals['Contact'][cont];
-	
-	if(me.dt == 'Customer')	{
-		c.is_customer = 1;
-		c.customer = me.dn;
-		c.customer_name = me.dsn;
-	}
-	else if(me.dt == 'Supplier'){
-		c.is_supplier = 1;
-		c.supplier = me.dn;
-		c.supplier_name = me.dsn;
-	}
-	else if(me.dt == 'Sales Partner'){
-		c.is_sales_partner = 1;
-		c.sales_partner = me.dn;
-		//c.sales_partner_name = me.dsn;
-	}
-	
-	loaddoc('Contact',c.name);
-}
-
-// get contact list
-// -----------------
-ContactList.prototype.get_list = function(){
-	var me = this;
-	
-	me.make_list();
-	
-	var dt = me.dt.toLowerCase().split(' ').join('_');
-	
-	// build query
-	me.lst.get_query = function(){
-		this.query = repl("select name, first_name, last_name, concat_ws(' ', first_name, last_name), email_id, contact_no, department, designation, is_primary_contact, has_login, disable_login from tabContact where %(dt)s = '%(dn)s' and docstatus != 2",{'dt':dt, 'dn':me.dn});
-
-		this.query_max = repl("select count(name) from tabContact where %(dt)s = '%(dn)s' and docstatus != 2",{'dt':dt, 'dn':me.dn});
-	}
-	
-	// render list ui
-	me.lst.show_cell = function(cell,ri,ci,d){
-		me.render_list(cell,ri,ci,d);
-	}
-	
-	// run query
-	me.lst.run();
-	
-	// onrun
-	me.lst.onrun = function(){
-		if(!this.has_data()){
-			this.rec_label.innerHTML = '';
-			
-			$a(this.rec_label,'span').innerHTML = "You do not have any contact. ";
-			$($a(this.rec_label,'span')).html('Add a new contact').addClass('link_type').click(function(){ me.add_contact(); });
-			
-			$dh(this.results);
-		}
-		else{
-			$ds(this.results);
-		}
-	}	
-}
-
-// make list
-// -----------
-ContactList.prototype.make_list = function(){
-	var me = this;
-	
-	var l = new Listing();
-	l.colwidths = ['5%','30%','30%','20%','20%'];
-	l.colnames = ['Sr.','Contact Name','Email Id','Contact No', 'Action'];
-	l.page_len = 10;
-  
-	me.lst = l;
-	
-	l.make(me.wrapper);
-	
-	// Add contact button
-	me.add_btn = $btn(l.btn_area,'+ Add Contact', function(){ me.add_contact();}, {fontWeight:'bold'});
-}
-
-// make contact cell
-// ------------------
-ContactList.prototype.render_list = function(cell,ri,ci,d){
-	var me = this;
-
-	// name
-	if(ci == 0){
-		var nm = $a($a(cell,'div'),'span','',{cursor:'pointer'});
-		nm.innerHTML = d[ri][3];
-		nm.id = d[ri][0];
-		
-		nm.onclick = function(){
-			loaddoc('Contact', this.id);
-			
-			// on save callback - refresh list
-		}
-
-		// department and designation
-		var des = d[ri][7] ? d[ri][7] : '';
-		var dep = d[ri][6] ? d[ri][6] : '';
-		
-		var sp = $a(cell,'div','comment');
-		sp.innerHTML = des + (dep ? (', ' + dep) : ''); 
-	}
-	
-	// email id, contact no, department, designation
-	// -----------------------------------------------------
-	if(ci == 1) cell.innerHTML = d[ri][4] ? d[ri][4] : '-';
-	if(ci == 2) cell.innerHTML = d[ri][5] ? d[ri][5] : '-';
-	
-	// actions
-	// --------------------------------------
-	if(ci== 3) me.make_actions(cell,ri,ci,d);
-}
-
-// make actions
-// ---------------
-ContactList.prototype.make_actions = function(cell,ri,ci,d){
-	var me = this;
-	
-	var tab = make_table(cell,1,2,'100%',['40%','60%']);
-
-	// Edit and Delete
-	var t = make_table($td(tab,0,0),1,2);
-	
-	var edit = $a($td(t,0,0),'div','wn-icon ic-doc_edit');
-	$(edit).click(function(){ loaddoc('Contact',d[ri][0]); });
-	
-	edit.setAttribute('title','Edit');
-
-// Below code should be uncommented once customer/venodr invitation process is stable
-// ===========================================================================
-/* 
-	var del = $a($td(t,0,1),'div','wn-icon ic-trash');
-	$(del).click(function(){ me.delete_contact(d[ri][0],d[ri][4]) });
-
-	set_custom_tooltip(del, 'Delete');
-	
-	//  Invite, Enable and Disable - Integrate after gateway logic incorporated
-
-	if(d[ri][9] == 'Yes')	{
-		if(d[ri][10] == 'Yes'){
-			var enb = $a($td(tab,0,1),'div','wn-icon ic-checkmark');
-			$(enb).click(function(){ me.enable_login(d[ri][0], d[ri][4]); });
-		}
-		else{
-			var dsb = $a($td(tab,0,1),'div','wn-icon ic-delete');
-			$(dsb).click(function(){ me.disable_login(d[ri][0], d[ri][4]) });
-		}
-	}
-	else{
-		var inv = $a($td(tab,0,1),'div','wn-icon ic-mail');
-		$(inv).click(function(){ me.invite_contact(d[ri][0], d[ri][4], d[ri][1], d[ri][2]) });
-	}*/
-}
-
-// enable login
-// ----------------------------------------------------------
-ContactList.prototype.enable_login = function(id, email_id){
-	var me = this;
-	
-	var callback = function(r,rt){
-		me.get_list();
-		
-		if(!r.exc) msgprint('Login for contact enabled',1);
-		else errprint(r.exc);
-	}
-	
-	var args = {};
-	args.contact = id;
-	args.email = email_id;
-	
-	$c_obj('Contact Control','enable_login',JSON.stringify(args),callback);
-}
-
-// disable login
-// -------------------------------------------------------------
-ContactList.prototype.disable_login = function(id, email_id){
-	var me = this;
-	
-	var callback = function(r,rt){
-		me.get_list();
-		
-		if(!r.exc) msgprint('Login for contact disabled',1);
-		else errprint(r.exc);
-	}
-
-	var args = {};
-	args.contact = id;
-	args.email = email_id;
-		
-	$c_obj('Contact Control','disable_login',JSON.stringify(args),callback);
-}
-
-// delete contact
-// -----------------
-ContactList.prototype.delete_contact = function(id,email_id,has_login){
-	var me = this;
-	
-	var callback = function(r,rt){
-		me.get_list();
-		
-		if(!r.exc) msgprint('Contact deleted successfully');
-		else errprint(r.exc);
-	}
-	
-	var args = {};
-	args.contact = id;
-	args.email = email_id;
-	args.has_login = has_login;
-	
-	$c_obj('Contact Control','delete_contact',JSON.stringify(args),callback);
-}
-
-// invite user
-// --------------------------------------------------------
-ContactList.prototype.invite_contact = function(id,email_id,first_name,last_name){
-	var me = this;
-
-	if(!email_id){
-		msgprint("Please add email id and save the contact first. You can then invite contact to view transactions.")
-	}
-	else{
-		var callback = function(r,rt){
-			if(!r.exc) msgprint('Invitation sent');
-			else errprint(r.exc);
-		}
-	
-		var args = {
-			'contact' : id,
-			'email' : email_id,
-			'first_name' : first_name ? first_name : '',
-			'last_name' : last_name ? last_name : '',
-			'usert_type' : 'Partner'
-		};
-		
-		$c_obj('Contact Control','invite_contact',JSON.stringify(args),callback);	
-	}
-}
-
-
-// address list
-// --------------
-AddressList = function(parent,dt,dn,dsn,dsa){
-	
-	var me = this;
-	
-	this.dt = dt;
-	this.dn = dn;
-	this.dsn = dsn ? dsn : dn;
-        this.dsa = dsa ? dsa : '';
-
-	this.wrapper = $a(parent,'div');
-	me.get_addr_list();
-}
-
-
-// add contact
-// ------------
-AddressList.prototype.add_address = function(){
-	var me = this;
-	
-	// onload - set default values
-	var addr = LocalDB.create('Shipping Address');
-
-	var a = locals['Shipping Address'][addr];
-	
-	a.customer = me.dn;
-	a.customer_name = me.dsn;
-        a.customer_address = me.dsa;	
-	loaddoc('Shipping Address',a.name);
-}
-
-
-// get address list
-// -----------------
-AddressList.prototype.get_addr_list = function(){
-	var me = this;
-	
-	me.make_addr_list();
-	
-	var dt = me.dt.toLowerCase().split(' ').join('_');
-	
-	// build query
-	me.lst.get_query = function(){
-		this.query = repl("select name, ship_to, shipping_address, is_primary_address, shipping_details from `tabShipping Address` where %(dt)s = '%(dn)s' and docstatus != 2",{'dt':dt, 'dn':me.dn});
-
-		this.query_max = repl("select count(name) from `tabShipping Address` where %(dt)s = '%(dn)s'",{'dt':dt, 'dn':me.dn});
-	}
-	
-	// render list ui
-	me.lst.show_cell = function(cell,ri,ci,d){
-		me.render_list(cell,ri,ci,d);
-	}
-	
-	// run query
-	me.lst.run();
-	
-	// onrun
-	me.lst.onrun = function(){
-		if(!this.has_data()){
-			this.rec_label.innerHTML = '';
-			
-			$a(this.rec_label,'span').innerHTML = "You do not have any shipping address.";
-			$($a(this.rec_label,'span')).html('Add a new address').addClass('link_type').click(function(){ me.add_address(); });
-			
-			$dh(this.results);
-		}
-		else{
-			$ds(this.results);
-		}
-	}	
-}
-
-
-// make list
-// -----------
-AddressList.prototype.make_addr_list = function(){
-	var me = this;
-	
-	var l = new Listing();
-	l.colwidths = ['5%', '15%', '25%','10%','35%','10%'];
-	l.colnames = ['Sr.', 'Ship To', 'Shipping Address','Primary Address', 'Shipping Details', 'Action'];
-    l.page_len = 10;
-  
-	me.lst = l;
-	
-	l.make(me.wrapper);
-	
-	// Add address button
-	me.add_btn = $btn(l.btn_area,'+ Add Address', function(){ me.add_address();}, {fontWeight:'bold'});
-}
-
-
-
-// make address cell
-// ------------------
-AddressList.prototype.render_list = function(cell,ri,ci,d){
-	var me = this;
-
-	// name
-	if(ci == 0){
-		var nm = $a($a(cell,'div'),'span','',{cursor:'pointer'});
-		nm.innerHTML = d[ri][1];
-		nm.id = d[ri][0];
-		
-		nm.onclick = function(){
-			loaddoc('Shipping Address', this.id);
-		}
-	}
-	
-	// shipping address, primary address, shipping details
-	// ----------------------------------------------------
-	if(ci == 1) cell.innerHTML = d[ri][2] ? d[ri][2] : '-';
-	if(ci == 2) cell.innerHTML = d[ri][3] ? d[ri][3] : '-';
-	if(ci == 3) cell.innerHTML = d[ri][4] ? d[ri][4] : '-';
-	
-	// actions
-	// --------------------------------------
-	if(ci== 4) me.make_actions(cell,ri,ci,d);
-}
-
-// make actions
-// ---------------
-AddressList.prototype.make_actions = function(cell,ri,ci,d){
-	var me = this;
-	
-	var tab = make_table(cell,1,2,'100%',['40%','60%']);
-
-	// Edit and Delete
-	var t = make_table($td(tab,0,0),1,2);
-	
-	var edit = $a($td(t,0,0),'div','wn-icon ic-doc_edit');
-	$(edit).click(function(){ loaddoc('Shipping Address',d[ri][0]); });
-	
-	edit.setAttribute('title','Edit');
-}
diff --git a/erpnext/setup/doctype/contact_control/contact_control.txt b/erpnext/setup/doctype/contact_control/contact_control.txt
index b9e84ad..c398190 100644
--- a/erpnext/setup/doctype/contact_control/contact_control.txt
+++ b/erpnext/setup/doctype/contact_control/contact_control.txt
@@ -3,86 +3,82 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:56',
+		'creation': '2012-03-27 14:36:19',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'yogesh@webnotestech.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:19',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'in_create': 1,
 		'issingle': 1,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
 		'read_only': 1,
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 25
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldtype': u'Text',
 		'name': '__common__',
-		'parent': 'Contact Control',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Contact Control',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
 		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Contact Control',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Contact Control',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
 	# DocType, Contact Control
 	{
 		'doctype': 'DocType',
-		'name': 'Contact Control'
+		'name': u'Contact Control'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm'
+		'doctype': u'DocPerm'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'header',
-		'idx': 1,
-		'label': 'Header'
+		'doctype': u'DocField',
+		'fieldname': u'header',
+		'label': u'Header'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'customer_intro',
-		'idx': 2,
-		'label': 'Customer Intro'
+		'doctype': u'DocField',
+		'fieldname': u'customer_intro',
+		'label': u'Customer Intro'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'supplier_intro',
-		'idx': 3,
-		'label': 'Supplier Intro'
+		'doctype': u'DocField',
+		'fieldname': u'supplier_intro',
+		'label': u'Supplier Intro'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/country/country.js b/erpnext/setup/doctype/country/country.js
deleted file mode 100644
index bb7eae6..0000000
--- a/erpnext/setup/doctype/country/country.js
+++ /dev/null
@@ -1,29 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-//Tips not required
-/*
- 
-
-//--------- ONLOAD -------------
-cur_frm.cscript.onload = function(doc, cdt, cdn) {
-   
-}
-
-cur_frm.cscript.refresh = function(doc, cdt, cdn) {
-   
-}
-*/
diff --git a/erpnext/setup/doctype/country/country.txt b/erpnext/setup/doctype/country/country.txt
index 089ceb3..bc3e9ed 100644
--- a/erpnext/setup/doctype/country/country.txt
+++ b/erpnext/setup/doctype/country/country.txt
@@ -3,42 +3,41 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:56',
+		'creation': '2012-03-27 14:36:19',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'yogesh@webnotestech.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:19',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'autoname': 'field:country_name',
-		'colour': 'White:FFF',
+		'autoname': u'field:country_name',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
+		'document_type': u'Master',
 		'in_create': 0,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
 		'read_only': 0,
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 11
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'country_name',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'label': 'Country Name',
+		'doctype': u'DocField',
+		'fieldname': u'country_name',
+		'fieldtype': u'Data',
+		'label': u'Country Name',
 		'name': '__common__',
-		'oldfieldname': 'country_name',
-		'oldfieldtype': 'Data',
-		'parent': 'Country',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'oldfieldname': u'country_name',
+		'oldfieldtype': u'Data',
+		'parent': u'Country',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'reqd': 1
 	},
@@ -46,11 +45,11 @@
 	# These values are common for all DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Country',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Country',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
 		'write': 1
@@ -59,42 +58,38 @@
 	# DocType, Country
 	{
 		'doctype': 'DocType',
-		'name': 'Country'
+		'name': u'Country'
 	},
 
 	# DocPerm
 	{
 		'amend': 0,
 		'cancel': 0,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'Sales Master Manager',
+		'doctype': u'DocPerm',
+		'role': u'Sales Master Manager',
 		'submit': 0
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'Purchase Master Manager'
+		'doctype': u'DocPerm',
+		'role': u'Purchase Master Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'role': 'HR User'
+		'doctype': u'DocPerm',
+		'role': u'HR User'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 4,
-		'role': 'HR Manager'
+		'doctype': u'DocPerm',
+		'role': u'HR Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField'
+		'doctype': u'DocField'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/currency/currency.txt b/erpnext/setup/doctype/currency/currency.txt
index d5d066c..5abf9c5 100644
--- a/erpnext/setup/doctype/currency/currency.txt
+++ b/erpnext/setup/doctype/currency/currency.txt
@@ -3,41 +3,40 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:56',
+		'creation': '2012-03-27 14:36:19',
 		'docstatus': 0,
-		'modified': '2010-11-18 16:00:32',
-		'modified_by': 'yogesh@webnotestech.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:19',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'autoname': 'field:currency_name',
-		'colour': 'White:FFF',
+		'autoname': u'field:currency_name',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'in_create': 0,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
 		'read_only': 0,
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 3
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'currency_name',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'label': 'Currency Name',
+		'doctype': u'DocField',
+		'fieldname': u'currency_name',
+		'fieldtype': u'Data',
+		'label': u'Currency Name',
 		'name': '__common__',
-		'oldfieldname': 'currency_name',
-		'oldfieldtype': 'Data',
-		'parent': 'Currency',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'oldfieldname': u'currency_name',
+		'oldfieldtype': u'Data',
+		'parent': u'Currency',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'reqd': 1
 	},
@@ -45,11 +44,11 @@
 	# These values are common for all DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Currency',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Currency',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
 		'write': 1
@@ -58,23 +57,15 @@
 	# DocType, Currency
 	{
 		'doctype': 'DocType',
-		'name': 'Currency'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'Accounts Manager'
+		'name': u'Currency'
 	},
 
 	# DocPerm
 	{
 		'amend': 0,
 		'cancel': 0,
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'Sales Master Manager',
+		'doctype': u'DocPerm',
+		'role': u'Sales Master Manager',
 		'submit': 0
 	},
 
@@ -82,14 +73,19 @@
 	{
 		'amend': 0,
 		'cancel': 0,
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'role': 'Purchase Master Manager',
+		'doctype': u'DocPerm',
+		'role': u'Purchase Master Manager',
 		'submit': 0
 	},
 
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'role': u'Accounts Manager'
+	},
+
 	# DocField
 	{
-		'doctype': 'DocField'
+		'doctype': u'DocField'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/customer_group/customer_group.txt b/erpnext/setup/doctype/customer_group/customer_group.txt
index 90043c8..ceda674 100644
--- a/erpnext/setup/doctype/customer_group/customer_group.txt
+++ b/erpnext/setup/doctype/customer_group/customer_group.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:57',
+		'creation': '2012-04-13 11:56:30',
 		'docstatus': 0,
-		'modified': '2012-03-21 14:52:40',
+		'modified': '2012-04-19 17:50:43',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -26,7 +26,7 @@
 		'section_style': u'Simple',
 		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'version': 34
+		'version': 1
 	},
 
 	# These values are common for all DocField
@@ -185,6 +185,16 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'default_price_list',
+		'fieldtype': u'Link',
+		'label': u'Default Price List',
+		'options': u'Price List',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
 		'fieldname': u'lft',
 		'fieldtype': u'Int',
 		'hidden': 1,
diff --git a/erpnext/setup/doctype/email_digest/email_digest.js b/erpnext/setup/doctype/email_digest/email_digest.js
index 67de256..1380e77 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.js
+++ b/erpnext/setup/doctype/email_digest/email_digest.js
@@ -60,7 +60,7 @@
 	}, 1);
 }
 
-cur_frm.cscript['Add/Remove Recipients'] = function(doc, dt, dn) {
+cur_frm.cscript.addremove_recipients = function(doc, dt, dn) {
 	// Get profile list
 	$c_obj(make_doclist(dt, dn), 'get_profiles', '', function(r, rt) {
 		if(r.exc) {
diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py
index fb3730c..b3ea118 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.py
+++ b/erpnext/setup/doctype/email_digest/email_digest.py
@@ -99,7 +99,7 @@
 
 			'new_enquiries': self.generate_new_type_query({
 				'type': 'new_enquiries',
-				'doctype': 'Enquiry'
+				'doctype': 'Opportunity'
 			}),
 
 			'new_quotations': self.generate_new_type_query({
@@ -110,7 +110,7 @@
 
 			'new_sales_orders': self.generate_new_type_query({
 				'type': 'new_sales_orders',
-				'doctype': 'Receivable Voucher',
+				'doctype': 'Sales Invoice',
 				'sum_col': 'grand_total'
 			}),
 
diff --git a/erpnext/setup/doctype/email_digest/email_digest.txt b/erpnext/setup/doctype/email_digest/email_digest.txt
index 897adad..0a29a8c 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.txt
+++ b/erpnext/setup/doctype/email_digest/email_digest.txt
@@ -3,99 +3,101 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-12-14 12:15:09',
+		'creation': '2012-03-27 14:36:20',
 		'docstatus': 0,
-		'modified': '2011-12-22 19:01:33',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:20',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1324556758',
-		'autoname': 'Prompt',
-		'colour': 'White:FFF',
+		'_last_update': u'1324556758',
+		'autoname': u'Prompt',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'System',
-		'module': 'Setup',
+		'document_type': u'System',
+		'module': u'Setup',
 		'name': '__common__',
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
 		'version': 81
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Email Digest',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Email Digest',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Email Digest',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Email Digest',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1,
-		'role': 'System Manager'
+		'role': u'System Manager'
 	},
 
 	# DocType, Email Digest
 	{
 		'doctype': 'DocType',
-		'name': 'Email Digest'
+		'name': u'Email Digest'
 	},
 
 	# DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Settings',
+		'doctype': u'DocField',
+		'fieldname': u'settings',
+		'fieldtype': u'Section Break',
+		'label': u'Settings',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'enabled',
-		'fieldtype': 'Check',
-		'label': 'Enabled',
+		'doctype': u'DocField',
+		'fieldname': u'enabled',
+		'fieldtype': u'Check',
+		'label': u'Enabled',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Select',
-		'label': 'For Company',
-		'options': 'link:Company',
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Select',
+		'label': u'For Company',
+		'options': u'link:Company',
 		'permlevel': 0,
 		'reqd': 1
 	},
@@ -103,249 +105,253 @@
 	# DocField
 	{
 		'allow_on_submit': 0,
-		'doctype': 'DocField',
-		'fieldname': 'frequency',
-		'fieldtype': 'Select',
-		'label': 'How frequently?',
-		'options': '\nDaily\nWeekly\nMonthly',
+		'doctype': u'DocField',
+		'fieldname': u'frequency',
+		'fieldtype': u'Select',
+		'label': u'How frequently?',
+		'options': u'\nDaily\nWeekly\nMonthly',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:doc.enabled',
-		'doctype': 'DocField',
-		'fieldname': 'next_send',
-		'fieldtype': 'Data',
-		'label': 'Next email will be sent on:',
+		'depends_on': u'eval:doc.enabled',
+		'doctype': u'DocField',
+		'fieldname': u'next_send',
+		'fieldtype': u'Data',
+		'label': u'Next email will be sent on:',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'default': '1',
-		'doctype': 'DocField',
-		'fieldname': 'use_standard',
-		'fieldtype': 'Check',
+		'default': u'1',
+		'doctype': u'DocField',
+		'fieldname': u'use_standard',
+		'fieldtype': u'Check',
 		'hidden': 1,
-		'label': 'Use standard?',
+		'label': u'Use standard?',
 		'permlevel': 0,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Add/Remove Recipients',
+		'doctype': u'DocField',
+		'fieldname': u'addremove_recipients',
+		'fieldtype': u'Button',
+		'label': u'Add/Remove Recipients',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'description': 'Note: Email will not be sent to disabled users',
-		'doctype': 'DocField',
-		'fieldname': 'recipient_list',
-		'fieldtype': 'Text',
-		'label': 'Recipients',
+		'description': u'Note: Email will not be sent to disabled users',
+		'doctype': u'DocField',
+		'fieldname': u'recipient_list',
+		'fieldtype': u'Text',
+		'label': u'Recipients',
 		'permlevel': 1,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:doc.use_standard',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Select Digest Content',
+		'depends_on': u'eval:doc.use_standard',
+		'doctype': u'DocField',
+		'fieldname': u'select_digest_content',
+		'fieldtype': u'Section Break',
+		'label': u'Select Digest Content',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:doc.use_standard',
-		'doctype': 'DocField',
-		'fieldname': 'new_leads',
-		'fieldtype': 'Check',
-		'label': 'New Leads',
+		'depends_on': u'eval:doc.use_standard',
+		'doctype': u'DocField',
+		'fieldname': u'new_leads',
+		'fieldtype': u'Check',
+		'label': u'New Leads',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:doc.use_standard',
-		'doctype': 'DocField',
-		'fieldname': 'new_enquiries',
-		'fieldtype': 'Check',
-		'label': 'New Enquiries',
+		'depends_on': u'eval:doc.use_standard',
+		'doctype': u'DocField',
+		'fieldname': u'new_enquiries',
+		'fieldtype': u'Check',
+		'label': u'New Enquiries',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:doc.use_standard',
-		'doctype': 'DocField',
-		'fieldname': 'new_quotations',
-		'fieldtype': 'Check',
-		'label': 'New Quotations',
+		'depends_on': u'eval:doc.use_standard',
+		'doctype': u'DocField',
+		'fieldname': u'new_quotations',
+		'fieldtype': u'Check',
+		'label': u'New Quotations',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:doc.use_standard',
-		'doctype': 'DocField',
-		'fieldname': 'new_sales_orders',
-		'fieldtype': 'Check',
-		'label': 'New Sales Orders',
+		'depends_on': u'eval:doc.use_standard',
+		'doctype': u'DocField',
+		'fieldname': u'new_sales_orders',
+		'fieldtype': u'Check',
+		'label': u'New Sales Orders',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:doc.use_standard',
-		'doctype': 'DocField',
-		'fieldname': 'new_purchase_orders',
-		'fieldtype': 'Check',
-		'label': 'New Purchase Orders',
+		'depends_on': u'eval:doc.use_standard',
+		'doctype': u'DocField',
+		'fieldname': u'new_purchase_orders',
+		'fieldtype': u'Check',
+		'label': u'New Purchase Orders',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:doc.use_standard',
-		'doctype': 'DocField',
-		'fieldname': 'new_transactions',
-		'fieldtype': 'Check',
-		'label': 'New Transactions',
+		'depends_on': u'eval:doc.use_standard',
+		'doctype': u'DocField',
+		'fieldname': u'new_transactions',
+		'fieldtype': u'Check',
+		'label': u'New Transactions',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:doc.use_standard',
-		'doctype': 'DocField',
-		'fieldname': 'payables',
-		'fieldtype': 'Check',
-		'label': 'Payables',
+		'depends_on': u'eval:doc.use_standard',
+		'doctype': u'DocField',
+		'fieldname': u'payables',
+		'fieldtype': u'Check',
+		'label': u'Payables',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:doc.use_standard',
-		'doctype': 'DocField',
-		'fieldname': 'payments',
-		'fieldtype': 'Check',
-		'label': 'Payments',
+		'depends_on': u'eval:doc.use_standard',
+		'doctype': u'DocField',
+		'fieldname': u'payments',
+		'fieldtype': u'Check',
+		'label': u'Payments',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:doc.use_standard',
-		'doctype': 'DocField',
-		'fieldname': 'expenses_booked',
-		'fieldtype': 'Check',
-		'label': 'Expenses Booked',
+		'depends_on': u'eval:doc.use_standard',
+		'doctype': u'DocField',
+		'fieldname': u'expenses_booked',
+		'fieldtype': u'Check',
+		'label': u'Expenses Booked',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:doc.use_standard',
-		'doctype': 'DocField',
-		'fieldname': 'invoiced_amount',
-		'fieldtype': 'Check',
-		'label': 'Invoiced Amount (Receivables)',
+		'depends_on': u'eval:doc.use_standard',
+		'doctype': u'DocField',
+		'fieldname': u'invoiced_amount',
+		'fieldtype': u'Check',
+		'label': u'Invoiced Amount (Receivables)',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:doc.use_standard',
-		'doctype': 'DocField',
-		'fieldname': 'collections',
-		'fieldtype': 'Check',
-		'label': 'Collections',
+		'depends_on': u'eval:doc.use_standard',
+		'doctype': u'DocField',
+		'fieldname': u'collections',
+		'fieldtype': u'Check',
+		'label': u'Collections',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:doc.use_standard',
-		'doctype': 'DocField',
-		'fieldname': 'income',
-		'fieldtype': 'Check',
-		'label': 'Income',
+		'depends_on': u'eval:doc.use_standard',
+		'doctype': u'DocField',
+		'fieldname': u'income',
+		'fieldtype': u'Check',
+		'label': u'Income',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:doc.use_standard',
-		'doctype': 'DocField',
-		'fieldname': 'income_year_to_date',
-		'fieldtype': 'Check',
-		'label': 'Income Year to Date',
+		'depends_on': u'eval:doc.use_standard',
+		'doctype': u'DocField',
+		'fieldname': u'income_year_to_date',
+		'fieldtype': u'Check',
+		'label': u'Income Year to Date',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:doc.use_standard',
-		'doctype': 'DocField',
-		'fieldname': 'bank_balance',
-		'fieldtype': 'Check',
-		'label': 'Bank Balance',
+		'depends_on': u'eval:doc.use_standard',
+		'doctype': u'DocField',
+		'fieldname': u'bank_balance',
+		'fieldtype': u'Check',
+		'label': u'Bank Balance',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'stock_below_rl',
-		'fieldtype': 'Check',
+		'doctype': u'DocField',
+		'fieldname': u'stock_below_rl',
+		'fieldtype': u'Check',
 		'hidden': 1,
-		'label': 'Stock Items below re-order level',
+		'label': u'Stock Items below re-order level',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:!doc.use_standard',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Enter Custom Code',
+		'depends_on': u'eval:!doc.use_standard',
+		'doctype': u'DocField',
+		'fieldname': u'enter_custom_code',
+		'fieldtype': u'Section Break',
+		'label': u'Enter Custom Code',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:!doc.use_standard',
-		'doctype': 'DocField',
-		'fieldname': 'custom_code',
-		'fieldtype': 'Code',
-		'label': 'Custom Python Code',
+		'depends_on': u'eval:!doc.use_standard',
+		'doctype': u'DocField',
+		'fieldname': u'custom_code',
+		'fieldtype': u'Code',
+		'label': u'Custom Python Code',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:!doc.use_standard',
-		'doctype': 'DocField',
-		'fieldname': 'email_template',
-		'fieldtype': 'Code',
-		'label': 'Email Template',
+		'depends_on': u'eval:!doc.use_standard',
+		'doctype': u'DocField',
+		'fieldname': u'email_template',
+		'fieldtype': u'Code',
+		'label': u'Email Template',
 		'permlevel': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/email_settings/email_settings.js b/erpnext/setup/doctype/email_settings/email_settings.js
deleted file mode 100644
index 599fbcc..0000000
--- a/erpnext/setup/doctype/email_settings/email_settings.js
+++ /dev/null
@@ -1,21 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-cur_frm.cscript.refresh = function(doc,cdt,cdn){
-  if(!doc.outgoing_mail_server || !doc.mail_login || !doc.mail_password || !doc.auto_email_id || !doc.mail_port || !doc.use_ssl){
-    get_server_fields('set_vals','','',doc, cdt, cdn, 1);
-  }
-}
\ No newline at end of file
diff --git a/erpnext/setup/doctype/email_settings/email_settings.py b/erpnext/setup/doctype/email_settings/email_settings.py
index c670b31..3e17636 100644
--- a/erpnext/setup/doctype/email_settings/email_settings.py
+++ b/erpnext/setup/doctype/email_settings/email_settings.py
@@ -23,21 +23,6 @@
 	def __init__(self,doc,doclist):
 		self.doc,self.doclist = doc,doclist
 
-	def set_vals(self):
-		res = sql("select field, value from `tabSingles` where doctype = 'Control Panel' and field IN ('outgoing_mail_server','mail_login','mail_password','auto_email_id','mail_port','use_ssl')")
-		ret = {}
-		for r in res:
-			ret[cstr(r[0])]=r[1] and cstr(r[1]) or ''
-				
-		return ret
-
-	def set_cp_value(self, key):
-		"""
-			Update value in control panel
-		"""
-		webnotes.conn.set_value('Control Panel', None, key,
-				self.doc.fields.get(key))
-
 	def validate(self):
 		"""
 			Checks connectivity to email servers before saving
@@ -113,11 +98,3 @@
 			except poplib.error_proto, e:
 				webnotes.msgprint('Invalid User Name or Support Password. Please rectify and try again.')
 				webnotes.msgprint(e)
-
-		
-	def on_update(self):
-		"""
-			update control panel
-		"""
-		for f in ('outgoing_mail_server', 'mail_login', 'mail_password', 'auto_email_id', 'mail_port', 'use_ssl'):
-			self.set_cp_value(f)
diff --git a/erpnext/setup/doctype/email_settings/email_settings.txt b/erpnext/setup/doctype/email_settings/email_settings.txt
index b6e52fc..fdf1cf0 100644
--- a/erpnext/setup/doctype/email_settings/email_settings.txt
+++ b/erpnext/setup/doctype/email_settings/email_settings.txt
@@ -3,234 +3,240 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:59',
+		'creation': '2012-03-27 14:36:20',
 		'docstatus': 0,
-		'modified': '2012-01-25 18:44:45',
-		'modified_by': 'Administrator',
-		'owner': 'harshada@webnotestech.com'
+		'modified': '2012-03-27 14:36:20',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1325570647',
+		'_last_update': u'1325570647',
 		'allow_copy': 1,
 		'allow_email': 1,
 		'allow_print': 1,
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
 		'in_create': 1,
 		'issingle': 1,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 35
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Email Settings',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Email Settings',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Email Settings',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Email Settings',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
 	# DocType, Email Settings
 	{
 		'doctype': 'DocType',
-		'name': 'Email Settings'
+		'name': u'Email Settings'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm'
+		'doctype': u'DocPerm'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm'
+		'doctype': u'DocPerm'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Outgoing Mails'
+		'doctype': u'DocField',
+		'fieldname': u'outgoing_mails',
+		'fieldtype': u'Section Break',
+		'label': u'Outgoing Mails'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'label': '1',
-		'options': '<div class="help_box">Set your outgoing mail settings here. All system generated notifications, emails will go from this mail server</div>'
+		'doctype': u'DocField',
+		'fieldname': u'html1',
+		'fieldtype': u'HTML',
+		'label': u'1',
+		'options': u'<div class="help_box">Set your outgoing mail settings here. All system generated notifications, emails will go from this mail server</div>'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'outgoing_mail_server',
-		'fieldtype': 'Data',
-		'label': 'Outgoing Mail Server'
+		'doctype': u'DocField',
+		'fieldname': u'outgoing_mail_server',
+		'fieldtype': u'Data',
+		'label': u'Outgoing Mail Server'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'mail_port',
-		'fieldtype': 'Int',
-		'label': 'Mail Port'
+		'doctype': u'DocField',
+		'fieldname': u'mail_port',
+		'fieldtype': u'Int',
+		'label': u'Mail Port'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'use_ssl',
-		'fieldtype': 'Check',
-		'label': 'Use SSL'
+		'doctype': u'DocField',
+		'fieldname': u'use_ssl',
+		'fieldtype': u'Check',
+		'label': u'Use SSL'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'mail_login',
-		'fieldtype': 'Data',
-		'label': 'Login Id'
+		'doctype': u'DocField',
+		'fieldname': u'mail_login',
+		'fieldtype': u'Data',
+		'label': u'Login Id'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'mail_password',
-		'fieldtype': 'Password',
-		'label': 'Mail Password'
+		'doctype': u'DocField',
+		'fieldname': u'mail_password',
+		'fieldtype': u'Password',
+		'label': u'Mail Password'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'auto_email_id',
-		'fieldtype': 'Data',
-		'label': 'Auto Email Id'
+		'doctype': u'DocField',
+		'fieldname': u'auto_email_id',
+		'fieldtype': u'Data',
+		'label': u'Auto Email Id'
 	},
 
 	# DocField
 	{
-		'description': 'Set the POP3 email settings to pull emails directly from a mailbox and create Support Tickets',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Support Ticket Mail Settings'
+		'description': u'Set the POP3 email settings to pull emails directly from a mailbox and create Support Tickets',
+		'doctype': u'DocField',
+		'fieldname': u'support_ticket_mail_settings',
+		'fieldtype': u'Section Break',
+		'label': u'Support Ticket Mail Settings'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'label': '2',
-		'options': '<div class="help_box">To automatically create Support Tickets from your incoming mail, set your pop3 settings here.</div>'
+		'doctype': u'DocField',
+		'fieldname': u'html2',
+		'fieldtype': u'HTML',
+		'label': u'2',
+		'options': u'<div class="help_box">To automatically create Support Tickets from your incoming mail, set your pop3 settings here.</div>'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'options': 'Simple'
+		'doctype': u'DocField',
+		'fieldname': u'section_break0',
+		'fieldtype': u'Section Break',
+		'options': u'Simple'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Check this to pull emails from your mailbox',
-		'doctype': 'DocField',
-		'fieldname': 'sync_support_mails',
-		'fieldtype': 'Check',
-		'label': 'Sync Support Mails'
+		'colour': u'White:FFF',
+		'description': u'Check this to pull emails from your mailbox',
+		'doctype': u'DocField',
+		'fieldname': u'sync_support_mails',
+		'fieldtype': u'Check',
+		'label': u'Sync Support Mails'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Your support email id - must be a valid email - this is where your emails will come!',
-		'doctype': 'DocField',
-		'fieldname': 'support_email',
-		'fieldtype': 'Data',
-		'label': 'Support Email'
+		'colour': u'White:FFF',
+		'description': u'Your support email id - must be a valid email - this is where your emails will come!',
+		'doctype': u'DocField',
+		'fieldname': u'support_email',
+		'fieldtype': u'Data',
+		'label': u'Support Email'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'POP3 mail server (e.g. pop.gmail.com)',
-		'doctype': 'DocField',
-		'fieldname': 'support_host',
-		'fieldtype': 'Data',
-		'label': 'POP3 Mail Server'
+		'colour': u'White:FFF',
+		'description': u'POP3 mail server (e.g. pop.gmail.com)',
+		'doctype': u'DocField',
+		'fieldname': u'support_host',
+		'fieldtype': u'Data',
+		'label': u'POP3 Mail Server'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'support_use_ssl',
-		'fieldtype': 'Check',
-		'label': 'Use SSL'
+		'doctype': u'DocField',
+		'fieldname': u'support_use_ssl',
+		'fieldtype': u'Check',
+		'label': u'Use SSL'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'support_username',
-		'fieldtype': 'Data',
-		'label': 'User Name'
+		'doctype': u'DocField',
+		'fieldname': u'support_username',
+		'fieldtype': u'Data',
+		'label': u'User Name'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'support_password',
-		'fieldtype': 'Password',
-		'label': 'Support Password'
+		'doctype': u'DocField',
+		'fieldname': u'support_password',
+		'fieldtype': u'Password',
+		'label': u'Support Password'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break'
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Signature to be appended at the end of every email',
-		'doctype': 'DocField',
-		'fieldname': 'support_signature',
-		'fieldtype': 'Text',
-		'label': 'Signature'
+		'colour': u'White:FFF',
+		'description': u'Signature to be appended at the end of every email',
+		'doctype': u'DocField',
+		'fieldname': u'support_signature',
+		'fieldtype': u'Text',
+		'label': u'Signature'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Autoreply when a new mail is received',
-		'doctype': 'DocField',
-		'fieldname': 'support_autoreply',
-		'fieldtype': 'Text',
-		'label': 'Autoreply'
+		'colour': u'White:FFF',
+		'description': u'Autoreply when a new mail is received',
+		'doctype': u'DocField',
+		'fieldname': u'support_autoreply',
+		'fieldtype': u'Text',
+		'label': u'Autoreply'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/features_setup/features_setup.txt b/erpnext/setup/doctype/features_setup/features_setup.txt
index eff542b..fdbf96d 100644
--- a/erpnext/setup/doctype/features_setup/features_setup.txt
+++ b/erpnext/setup/doctype/features_setup/features_setup.txt
@@ -3,46 +3,46 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-09-07 11:59:05',
+		'creation': '2012-03-27 14:36:21',
 		'docstatus': 0,
-		'modified': '2011-12-14 11:05:55',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:21',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1323840127',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'_last_update': u'1323840127',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
 		'issingle': 1,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
-		'name_case': 'Title Case',
-		'section_style': 'Simple',
+		'name_case': u'Title Case',
+		'section_style': u'Simple',
 		'show_in_menu': 1,
 		'version': 26
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Features Setup',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Features Setup',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Features Setup',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Features Setup',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
 		'write': 1
@@ -51,272 +51,282 @@
 	# DocType, Features Setup
 	{
 		'doctype': 'DocType',
-		'name': 'Features Setup'
+		'name': u'Features Setup'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'role': 'System Manager'
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'role': 'Administrator'
+		'doctype': u'DocPerm',
+		'role': u'Administrator'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Materials'
+		'doctype': u'DocField',
+		'fieldname': u'materials',
+		'fieldtype': u'Section Break',
+		'label': u'Materials'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'To track item in sales and purchase documents based on their serial nos. This is can also used to track warranty details of the product.',
-		'doctype': 'DocField',
-		'fieldname': 'fs_item_serial_nos',
-		'fieldtype': 'Check',
-		'label': 'Item Serial Nos'
+		'colour': u'White:FFF',
+		'description': u'To track item in sales and purchase documents based on their serial nos. This is can also used to track warranty details of the product.',
+		'doctype': u'DocField',
+		'fieldname': u'fs_item_serial_nos',
+		'fieldtype': u'Check',
+		'label': u'Item Serial Nos'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'To track items in sales and purchase documents with batch nos<br><b>Preferred Industry: Chemicals etc</b>',
-		'doctype': 'DocField',
-		'fieldname': 'fs_item_batch_nos',
-		'fieldtype': 'Check',
-		'label': 'Item Batch Nos'
+		'colour': u'White:FFF',
+		'description': u'To track items in sales and purchase documents with batch nos<br><b>Preferred Industry: Chemicals etc</b>',
+		'doctype': u'DocField',
+		'fieldname': u'fs_item_batch_nos',
+		'fieldtype': u'Check',
+		'label': u'Item Batch Nos'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'To track brand name in the following documents<br>\nDelivery Note, Enuiry, Indent, Item, Purchase Order, Purchase Voucher, Purchaser Receipt, Quotation, Receivable Voucher, Sales BOM, Sales Order, Serial No',
-		'doctype': 'DocField',
-		'fieldname': 'fs_brands',
-		'fieldtype': 'Check',
-		'label': 'Brands'
+		'colour': u'White:FFF',
+		'description': u'To track brand name in the following documents<br>\nDelivery Note, Enuiry, Purchase Request, Item, Purchase Order, Purchase Voucher, Purchaser Receipt, Quotation, Sales Invoice, Sales BOM, Sales Order, Serial No',
+		'doctype': u'DocField',
+		'fieldname': u'fs_brands',
+		'fieldtype': u'Check',
+		'label': u'Brands'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break'
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': '1. To maintain the customer wise item code and to make them searchable based on their code use this option',
-		'doctype': 'DocField',
-		'fieldname': 'fs_item_advanced',
-		'fieldtype': 'Check',
-		'label': 'Item Advanced'
+		'colour': u'White:FFF',
+		'description': u'1. To maintain the customer wise item code and to make them searchable based on their code use this option',
+		'doctype': u'DocField',
+		'fieldname': u'fs_item_advanced',
+		'fieldtype': u'Check',
+		'label': u'Item Advanced'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'If Sale BOM is defined, the actual BOM of the Pack is displayed as table.\nAvailable in Delivery Note and Sales Order',
-		'doctype': 'DocField',
-		'fieldname': 'fs_packing_details',
-		'fieldtype': 'Check',
-		'label': 'Packing Detials'
+		'colour': u'White:FFF',
+		'description': u'If Sale BOM is defined, the actual BOM of the Pack is displayed as table.\nAvailable in Delivery Note and Sales Order',
+		'doctype': u'DocField',
+		'fieldname': u'fs_packing_details',
+		'fieldtype': u'Check',
+		'label': u'Packing Detials'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'To get Item Group in details table',
-		'doctype': 'DocField',
-		'fieldname': 'fs_item_group_in_details',
-		'fieldtype': 'Check',
-		'label': 'Item Groups in Details'
+		'colour': u'White:FFF',
+		'description': u'To get Item Group in details table',
+		'doctype': u'DocField',
+		'fieldname': u'fs_item_group_in_details',
+		'fieldtype': u'Check',
+		'label': u'Item Groups in Details'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Sales and Purchase'
+		'doctype': u'DocField',
+		'fieldname': u'sales_and_purchase',
+		'fieldtype': u'Section Break',
+		'label': u'Sales and Purchase'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'All export related fields like currency, conversion rate, export total, export grand total etc are available in <br>\nDelivery Note, POS, Quotation, Sales Invoice, Sales Order etc.',
-		'doctype': 'DocField',
-		'fieldname': 'fs_exports',
-		'fieldtype': 'Check',
-		'label': 'Exports'
+		'colour': u'White:FFF',
+		'description': u'All export related fields like currency, conversion rate, export total, export grand total etc are available in <br>\nDelivery Note, POS, Quotation, Sales Invoice, Sales Order etc.',
+		'doctype': u'DocField',
+		'fieldname': u'fs_exports',
+		'fieldtype': u'Check',
+		'label': u'Exports'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'All import related fields like currency, conversion rate, import total, import grand total etc are available in <br>\nPurchase Receipt, Supplier Quotation, Purchase Invoice, Purchase Order etc.',
-		'doctype': 'DocField',
-		'fieldname': 'fs_imports',
-		'fieldtype': 'Check',
-		'label': 'Imports'
+		'colour': u'White:FFF',
+		'description': u'All import related fields like currency, conversion rate, import total, import grand total etc are available in <br>\nPurchase Receipt, Supplier Quotation, Purchase Invoice, Purchase Order etc.',
+		'doctype': u'DocField',
+		'fieldname': u'fs_imports',
+		'fieldtype': u'Check',
+		'label': u'Imports'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break'
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Field available in Delivery Note, Quotation, Receivable Voucher, Sales Order',
-		'doctype': 'DocField',
-		'fieldname': 'fs_discounts',
-		'fieldtype': 'Check',
-		'label': 'Sales Discounts'
+		'colour': u'White:FFF',
+		'description': u'Field available in Delivery Note, Quotation, Sales Invoice, Sales Order',
+		'doctype': u'DocField',
+		'fieldname': u'fs_discounts',
+		'fieldtype': u'Check',
+		'label': u'Sales Discounts'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Discount Fields will be available in Purchase Order, Purchase Receipt, Purchase Invoice',
-		'doctype': 'DocField',
-		'fieldname': 'fs_purchase_discounts',
-		'fieldtype': 'Check',
-		'label': 'Purchase Discounts'
+		'colour': u'White:FFF',
+		'description': u'Discount Fields will be available in Purchase Order, Purchase Receipt, Purchase Invoice',
+		'doctype': u'DocField',
+		'fieldname': u'fs_purchase_discounts',
+		'fieldtype': u'Check',
+		'label': u'Purchase Discounts'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'To track any installation or commissioning related work after sales',
-		'doctype': 'DocField',
-		'fieldname': 'fs_after_sales_installations',
-		'fieldtype': 'Check',
-		'label': 'After Sale Installations'
+		'colour': u'White:FFF',
+		'description': u'To track any installation or commissioning related work after sales',
+		'doctype': u'DocField',
+		'fieldname': u'fs_after_sales_installations',
+		'fieldtype': u'Check',
+		'label': u'After Sale Installations'
 	},
 
 	# DocField
 	{
-		'description': 'Available in \nBill Of Materials, Delivery Note, Payable Voucher, Production Order, Purchase Order, Purchase Receipt, Receivable Voucher, Sales Order, Stock Entry, Timesheet',
-		'doctype': 'DocField',
-		'fieldname': 'fs_projects',
-		'fieldtype': 'Check',
-		'label': 'Projects'
+		'description': u'Available in \nBOM, Delivery Note, Purchase Invoice, Production Order, Purchase Order, Purchase Receipt, Sales Invoice, Sales Order, Stock Entry, Timesheet',
+		'doctype': u'DocField',
+		'fieldname': u'fs_projects',
+		'fieldtype': u'Check',
+		'label': u'Projects'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'If you have Sales Team and Sale Partners (Channel Partners)  they can be tagged and maintain their contribution in the sales activity',
-		'doctype': 'DocField',
-		'fieldname': 'fs_sales_extras',
-		'fieldtype': 'Check',
-		'label': 'Sales Extras'
+		'colour': u'White:FFF',
+		'description': u'If you have Sales Team and Sale Partners (Channel Partners)  they can be tagged and maintain their contribution in the sales activity',
+		'doctype': u'DocField',
+		'fieldname': u'fs_sales_extras',
+		'fieldtype': u'Check',
+		'label': u'Sales Extras'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Accounts'
+		'doctype': u'DocField',
+		'fieldname': u'accounts',
+		'fieldtype': u'Section Break',
+		'label': u'Accounts'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Check if you need automatic recurring invoices. After submitting any sales invoice, Recurring section will be visible.',
-		'doctype': 'DocField',
-		'fieldname': 'fs_recurring_invoice',
-		'fieldtype': 'Check',
-		'label': 'Recurring Invoice'
+		'colour': u'White:FFF',
+		'description': u'Check if you need automatic recurring invoices. After submitting any sales invoice, Recurring section will be visible.',
+		'doctype': u'DocField',
+		'fieldname': u'fs_recurring_invoice',
+		'fieldtype': u'Check',
+		'label': u'Recurring Invoice'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break'
+		'doctype': u'DocField',
+		'fieldname': u'column_break2',
+		'fieldtype': u'Column Break'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'To enable <b>Point of Sale</b> features',
-		'doctype': 'DocField',
-		'fieldname': 'fs_pos',
-		'fieldtype': 'Check',
-		'label': 'Point of Sale'
+		'colour': u'White:FFF',
+		'description': u'To enable <b>Point of Sale</b> features',
+		'doctype': u'DocField',
+		'fieldname': u'fs_pos',
+		'fieldtype': u'Check',
+		'label': u'Point of Sale'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Production'
+		'doctype': u'DocField',
+		'fieldname': u'production',
+		'fieldtype': u'Section Break',
+		'label': u'Production'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'If you involve in manufacturing activity<br>\nEnables item <b>Is Manufactured</b>',
-		'doctype': 'DocField',
-		'fieldname': 'fs_manufacturing',
-		'fieldtype': 'Check',
-		'label': 'Manufacturing'
+		'colour': u'White:FFF',
+		'description': u'If you involve in manufacturing activity<br>\nEnables item <b>Is Manufactured</b>',
+		'doctype': u'DocField',
+		'fieldname': u'fs_manufacturing',
+		'fieldtype': u'Check',
+		'label': u'Manufacturing'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break'
+		'doctype': u'DocField',
+		'fieldname': u'column_break3',
+		'fieldtype': u'Column Break'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'If you follow Quality Inspection<br>\nEnables item QA Required and QA No in Purchase Receipt',
-		'doctype': 'DocField',
-		'fieldname': 'fs_quality',
-		'fieldtype': 'Check',
-		'label': 'Quality'
+		'colour': u'White:FFF',
+		'description': u'If you follow Quality Inspection<br>\nEnables item QA Required and QA No in Purchase Receipt',
+		'doctype': u'DocField',
+		'fieldname': u'fs_quality',
+		'fieldtype': u'Check',
+		'label': u'Quality'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Miscelleneous'
+		'doctype': u'DocField',
+		'fieldname': u'miscelleneous',
+		'fieldtype': u'Section Break',
+		'label': u'Miscelleneous'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'If you have long print formats, this feature can be used to split the page to be printed on multiple pages with all headers and footers on each page',
-		'doctype': 'DocField',
-		'fieldname': 'fs_page_break',
-		'fieldtype': 'Check',
-		'label': 'Page Break'
+		'colour': u'White:FFF',
+		'description': u'If you have long print formats, this feature can be used to split the page to be printed on multiple pages with all headers and footers on each page',
+		'doctype': u'DocField',
+		'fieldname': u'fs_page_break',
+		'fieldtype': u'Check',
+		'label': u'Page Break'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break'
+		'doctype': u'DocField',
+		'fieldname': u'column_break4',
+		'fieldtype': u'Column Break'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Enables <b>More Info.</b> in all documents',
-		'doctype': 'DocField',
-		'fieldname': 'fs_more_info',
-		'fieldtype': 'Check',
-		'label': 'More Info'
+		'colour': u'White:FFF',
+		'description': u'Enables <b>More Info.</b> in all documents',
+		'doctype': u'DocField',
+		'fieldname': u'fs_more_info',
+		'fieldtype': u'Check',
+		'label': u'More Info'
 	}
-]
+]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/other_charges/__init__.py b/erpnext/setup/doctype/global_defaults/__init__.py
similarity index 100%
rename from erpnext/setup/doctype/other_charges/__init__.py
rename to erpnext/setup/doctype/global_defaults/__init__.py
diff --git a/erpnext/setup/doctype/manage_account/manage_account.js b/erpnext/setup/doctype/global_defaults/global_defaults.js
similarity index 100%
rename from erpnext/setup/doctype/manage_account/manage_account.js
rename to erpnext/setup/doctype/global_defaults/global_defaults.js
diff --git a/erpnext/setup/doctype/global_defaults/global_defaults.py b/erpnext/setup/doctype/global_defaults/global_defaults.py
new file mode 100644
index 0000000..0427640
--- /dev/null
+++ b/erpnext/setup/doctype/global_defaults/global_defaults.py
@@ -0,0 +1,70 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+"""Global Defaults"""
+import webnotes
+
+keydict = {
+	"fiscal_year": "current_fiscal_year",
+    'company': 'default_company',
+    'currency': 'default_currency',
+    'price_list_name': 'default_price_list',
+	'price_list_currency': 'default_price_list_currency',
+    'item_group': 'default_item_group',
+    'customer_group': 'default_customer_group',
+    'cust_master_name': 'cust_master_name', 
+    'supplier_type': 'default_supplier_type',
+    'supp_master_name': 'supp_master_name', 
+    'territory': 'default_territory',
+    'stock_uom': 'default_stock_uom',
+    'fraction_currency': 'default_currency_fraction',
+    'valuation_method': 'default_valuation_method',
+	'date_format': 'date_format',
+	'currency_format':'default_currency_format',
+	'account_url':'account_url',
+	'allow_negative_stock' : 'allow_negative_stock'
+}
+
+class DocType:
+	def __init__(self, d, dl):
+		self.doc, self.doclist = d, dl
+
+	def get_bal(self,arg):
+		"""get account balance (??)"""
+		from webnotes.utils import fmt_money, flt
+		bal = webnotes.conn.sql("select `tabAccount Balance`.balance,`tabAccount`.debit_or_credit from `tabAccount`,`tabAccount Balance` where `tabAccount Balance`.account=%s and `tabAccount Balance`.period=%s and `tabAccount Balance`.account=`tabAccount`.name ",(arg,self.doc.current_fiscal_year))
+		if bal:
+			return fmt_money(flt(bal[0][0])) + ' ' + bal[0][1]	
+	
+	def on_update(self):
+		"""update defaults"""
+		
+		for key in keydict:
+			webnotes.conn.set_default(key, self.doc.fields.get(keydict[key], ''))
+			
+		# update year start date and year end date from fiscal_year
+		ysd = webnotes.conn.sql("""select year_start_date from `tabFiscal Year` 
+			where name=%s""", self.doc.current_fiscal_year)
+			
+		ysd = ysd and ysd[0][0] or ''
+		from webnotes.utils import get_first_day, get_last_day
+		if ysd:
+			webnotes.conn.set_default('year_start_date', ysd.strftime('%Y-%m-%d'))
+			webnotes.conn.set_default('year_end_date', \
+				get_last_day(get_first_day(ysd,0,11)).strftime('%Y-%m-%d'))
+		
+	def get_defaults(self):
+		return webnotes.conn.get_defaults()
diff --git a/erpnext/setup/doctype/global_defaults/global_defaults.txt b/erpnext/setup/doctype/global_defaults/global_defaults.txt
new file mode 100644
index 0000000..af93033
--- /dev/null
+++ b/erpnext/setup/doctype/global_defaults/global_defaults.txt
@@ -0,0 +1,546 @@
+# DocType, Global Defaults
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-04-18 17:00:50',
+		'docstatus': 0,
+		'modified': '2012-04-18 17:24:45',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': u'1323855502',
+		'allow_copy': 1,
+		'allow_email': 1,
+		'allow_print': 1,
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'hide_toolbar': 0,
+		'in_create': 1,
+		'issingle': 1,
+		'module': u'Setup',
+		'name': '__common__',
+		'read_only': 1,
+		'section_style': u'Tabbed',
+		'server_code_error': u' ',
+		'show_in_menu': 1,
+		'version': 1
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Global Defaults',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Global Defaults',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1
+	},
+
+	# DocType, Global Defaults
+	{
+		'doctype': 'DocType',
+		'name': u'Global Defaults'
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'System Manager',
+		'submit': 0,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'System Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'System Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'All'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 2,
+		'role': u'System Manager',
+		'write': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Section Break',
+		'label': u'Company'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'default_company',
+		'fieldtype': u'Link',
+		'label': u'Default Company',
+		'options': u'Company',
+		'reqd': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'current_fiscal_year',
+		'fieldtype': u'Link',
+		'label': u'Current Fiscal Year',
+		'options': u'Fiscal Year',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'date_format',
+		'fieldtype': u'Select',
+		'label': u'Date Format',
+		'options': u'yyyy-mm-dd\ndd-mm-yyyy\ndd/mm/yyyy\nmm/dd/yyyy\nmm-dd-yyyy'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'default': u'INR',
+		'doctype': u'DocField',
+		'fieldname': u'default_currency',
+		'fieldtype': u'Select',
+		'label': u'Default Currency',
+		'options': u'link:Currency',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'default_currency_format',
+		'fieldtype': u'Select',
+		'label': u'Default Currency Format',
+		'options': u'Lacs\nMillions'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'default_currency_fraction',
+		'fieldtype': u'Data',
+		'label': u'Default Currency Fraction'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'stock',
+		'fieldtype': u'Section Break',
+		'label': u'Stock'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break2',
+		'fieldtype': u'Column Break',
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'default_item_group',
+		'fieldtype': u'Link',
+		'label': u'Default Item Group',
+		'options': u'Item Group'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'ighelp',
+		'fieldtype': u'HTML',
+		'label': u'IGHelp',
+		'options': u'<a href="#!Sales Browser/Item Group">To manage Item Groups, click here</a>'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'default_stock_uom',
+		'fieldtype': u'Link',
+		'label': u'Default Stock UOM',
+		'options': u'UOM'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'default_valuation_method',
+		'fieldtype': u'Select',
+		'label': u'Default Valuation Method',
+		'options': u'FIFO\nMoving Average'
+	},	
+	
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Applicable only if valuation method is moving average',
+		'doctype': u'DocField',
+		'fieldname': u'allow_negative_stock',
+		'fieldtype': u'Check',
+		'label': u'Allow Negative Stock'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'default_warehouse_type',
+		'fieldtype': u'Link',
+		'label': u'Default Warehouse Type',
+		'options': u'Warehouse Type'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'auto_indent',
+		'fieldtype': u'Check',
+		'label': u'Raise Purchase Request when stock reaches re-order level'
+	},
+
+	# DocField
+	{
+		'default': u'1',
+		'doctype': u'DocField',
+		'fieldname': u'column_break3',
+		'fieldtype': u'Column Break',
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Percentage you are allowed to receive or deliver more against the quantity ordered. <p>For example: If you have ordered 100 units. and your Allowance is 10% then you are allowed to receive 110 units</p>',
+		'doctype': u'DocField',
+		'fieldname': u'tolerance',
+		'fieldtype': u'Currency',
+		'label': u'Allowance Percent'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Stock level frozen up to this date, nobody can do / modify entry except authorized person',
+		'doctype': u'DocField',
+		'fieldname': u'stock_frozen_upto',
+		'fieldtype': u'Date',
+		'label': u'Stock Frozen Upto'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Users with this role are allowed to do / modify stock entry before frozen date',
+		'doctype': u'DocField',
+		'fieldname': u'stock_auth_role',
+		'fieldtype': u'Link',
+		'label': u'Authorized Role (Frozen Entry)',
+		'options': u'Role'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'accounts',
+		'fieldtype': u'Section Break',
+		'label': u'Accounts'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Accounting entry frozen up to this date, nobody can do / modify entry except authorized person',
+		'doctype': u'DocField',
+		'fieldname': u'acc_frozen_upto',
+		'fieldtype': u'Date',
+		'label': u'Accounts Frozen Upto'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Users with this role are allowed to do / modify accounting entry before frozen date',
+		'doctype': u'DocField',
+		'fieldname': u'bde_auth_role',
+		'fieldtype': u'Link',
+		'label': u'Authourized Role (Frozen Entry)',
+		'options': u'Role'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'credit_controller',
+		'fieldtype': u'Link',
+		'label': u'Credit Controller',
+		'options': u'Role'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break4',
+		'fieldtype': u'Column Break'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'account_info',
+		'fieldtype': u'HTML',
+		'label': u'Account Info',
+		'options': u'<div class="help-box">For more accounting defaults, Open <a href="#!List/Company">Company</a></div>'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'selling',
+		'fieldtype': u'Section Break',
+		'label': u'Selling'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'Customer Name',
+		'doctype': u'DocField',
+		'fieldname': u'cust_master_name',
+		'fieldtype': u'Select',
+		'label': u'Customer Master created by ',
+		'options': u'Customer Name\nNaming Series'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'default_customer_group',
+		'fieldtype': u'Link',
+		'label': u'Default Customer Group',
+		'options': u'Customer Group'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'cghelp',
+		'fieldtype': u'HTML',
+		'label': u'CGHelp',
+		'options': u'<a href="#!Sales Browser/Customer Group">To manage Customer Groups, click here</a>'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'default_territory',
+		'fieldtype': u'Link',
+		'label': u'Default Territory',
+		'options': u'Territory'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'territoryhelp',
+		'fieldtype': u'HTML',
+		'label': u'TerritoryHelp',
+		'options': u'<a href="#!Sales Browser/Territory">To manage Territory, click here</a>'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break5',
+		'fieldtype': u'Column Break',
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'default_price_list',
+		'fieldtype': u'Link',
+		'label': u'Default Price List',
+		'options': u'Price List'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'default_price_list_currency',
+		'fieldtype': u'Link',
+		'label': u'Default Price List Currency',
+		'options': u'Currency'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'No',
+		'doctype': u'DocField',
+		'fieldname': u'so_required',
+		'fieldtype': u'Select',
+		'label': u'Sales Order Required',
+		'options': u'No\nYes'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'No',
+		'doctype': u'DocField',
+		'fieldname': u'dn_required',
+		'fieldtype': u'Select',
+		'label': u'Delivery Note Required',
+		'options': u'No\nYes'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'buying',
+		'fieldtype': u'Section Break',
+		'label': u'Buying'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'default_supplier_type',
+		'fieldtype': u'Link',
+		'label': u'Default Supplier Type',
+		'options': u'Supplier Type'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'Supplier Name',
+		'doctype': u'DocField',
+		'fieldname': u'supp_master_name',
+		'fieldtype': u'Select',
+		'label': u'Supplier Master created by ',
+		'options': u'Supplier Name\nNaming Series'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'column_break6',
+		'fieldtype': u'Column Break',
+		'width': u'50%'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'No',
+		'doctype': u'DocField',
+		'fieldname': u'po_required',
+		'fieldtype': u'Select',
+		'label': u'Purchase Order Required',
+		'options': u'No\nYes'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'No',
+		'doctype': u'DocField',
+		'fieldname': u'pr_required',
+		'fieldtype': u'Select',
+		'label': u'Purchase Receipt Required',
+		'options': u'No\nYes'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'hr',
+		'fieldtype': u'Section Break',
+		'label': u'HR',
+		'options': u'<div style="padding-top: 8px;" class="columnHeading">HR</div>'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Employee record is created using selected field. ',
+		'doctype': u'DocField',
+		'fieldname': u'emp_created_by',
+		'fieldtype': u'Select',
+		'label': u'Employee Records to be created by ',
+		'options': u'\nNaming Series\nEmployee Number'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'system',
+		'fieldtype': u'Section Break',
+		'label': u'System'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'sms_sender_name',
+		'fieldtype': u'Data',
+		'label': u'SMS Sender Name'
+	}
+]
diff --git a/erpnext/setup/doctype/import_data_control/import_data_control.txt b/erpnext/setup/doctype/import_data_control/import_data_control.txt
index 06787e0..fa19e10 100644
--- a/erpnext/setup/doctype/import_data_control/import_data_control.txt
+++ b/erpnext/setup/doctype/import_data_control/import_data_control.txt
@@ -3,28 +3,28 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-10-04 16:30:30',
+		'creation': '2012-03-27 14:36:21',
 		'docstatus': 0,
-		'modified': '2010-12-24 11:43:03',
-		'modified_by': 'abhishek@webnotestech.com',
-		'owner': 'harshada@webnotestech.com'
+		'modified': '2012-03-27 14:36:21',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'issingle': 1,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 12
 	},
 
 	# DocType, Import Data Control
 	{
 		'doctype': 'DocType',
-		'name': 'Import Data Control'
+		'name': u'Import Data Control'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/item_group/item_group.txt b/erpnext/setup/doctype/item_group/item_group.txt
index e744901..b56b8da 100644
--- a/erpnext/setup/doctype/item_group/item_group.txt
+++ b/erpnext/setup/doctype/item_group/item_group.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:06',
+		'creation': '2012-03-27 14:36:21',
 		'docstatus': 0,
-		'modified': '2012-03-22 14:40:03',
+		'modified': '2012-03-27 14:36:21',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -57,54 +57,6 @@
 
 	# DocPerm
 	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Material Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Material Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Material User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Material User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
 		'cancel': 1,
 		'create': 1,
 		'doctype': u'DocPerm',
@@ -123,6 +75,54 @@
 		'write': 1
 	},
 
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material User',
+		'submit': 0,
+		'write': 0
+	},
+
 	# DocField
 	{
 		'doctype': u'DocField',
diff --git a/erpnext/setup/doctype/manage_account/manage_account.py b/erpnext/setup/doctype/manage_account/manage_account.py
deleted file mode 100644
index 7f9294b..0000000
--- a/erpnext/setup/doctype/manage_account/manage_account.py
+++ /dev/null
@@ -1,70 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-"""Global Defaults"""
-import webnotes
-
-keydict = {
-	"fiscal_year": "current_fiscal_year",
-    'company': 'default_company',
-    'currency': 'default_currency',
-    'price_list_name': 'default_price_list',
-	'price_list_currency': 'default_price_list_currency',
-    'item_group': 'default_item_group',
-    'customer_group': 'default_customer_group',
-    'cust_master_name': 'cust_master_name', 
-    'supplier_type': 'default_supplier_type',
-    'supp_master_name': 'supp_master_name', 
-    'territory': 'default_territory',
-    'stock_uom': 'default_stock_uom',
-    'fraction_currency': 'default_currency_fraction',
-    'valuation_method': 'default_valuation_method',
-	'date_format': 'date_format',
-	'currency_format':'default_currency_format',
-	'account_url':'account_url',
-	'allow_negative_stock' : 'allow_negative_stock'
-}
-
-class DocType:
-	def __init__(self, d, dl):
-		self.doc, self.doclist = d, dl
-
-	def get_bal(self,arg):
-		"""get account balance (??)"""
-		from webnotes.utils import fmt_money, flt
-		bal = webnotes.conn.sql("select `tabAccount Balance`.balance,`tabAccount`.debit_or_credit from `tabAccount`,`tabAccount Balance` where `tabAccount Balance`.account=%s and `tabAccount Balance`.period=%s and `tabAccount Balance`.account=`tabAccount`.name ",(arg,self.doc.current_fiscal_year))
-		if bal:
-			return fmt_money(flt(bal[0][0])) + ' ' + bal[0][1]	
-	
-	def on_update(self):
-		"""update defaults"""
-		
-		for key in keydict:
-			webnotes.conn.set_default(key, self.doc.fields.get(keydict[key], ''))
-			
-		# update year start date and year end date from fiscal_year
-		ysd = webnotes.conn.sql("""select year_start_date from `tabFiscal Year` 
-			where name=%s""", self.doc.fiscal_year)
-			
-		ysd = ysd and ysd[0][0] or ''
-		from webnotes.utils import get_first_day, get_last_day
-		if ysd:
-			webnotes.conn.set_default('year_start_date', ysd.strftime('%Y-%m-%d'))
-			webnotes.conn.set_default('year_end_date', \
-				get_last_day(get_first_day(ysd,0,11)).strftime('%Y-%m-%d'))
-		
-	def get_defaults(self):
-		return webnotes.conn.get_defaults()
diff --git a/erpnext/setup/doctype/manage_account/manage_account.txt b/erpnext/setup/doctype/manage_account/manage_account.txt
deleted file mode 100644
index db1759c..0000000
--- a/erpnext/setup/doctype/manage_account/manage_account.txt
+++ /dev/null
@@ -1,545 +0,0 @@
-# DocType, Manage Account
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-09-20 11:59:26',
-		'docstatus': 0,
-		'modified': '2012-04-18 12:48:57',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': u'1323855502',
-		'allow_copy': 1,
-		'allow_email': 1,
-		'allow_print': 1,
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'hide_toolbar': 0,
-		'in_create': 1,
-		'issingle': 1,
-		'module': u'Setup',
-		'name': '__common__',
-		'read_only': 1,
-		'section_style': u'Tabbed',
-		'server_code_error': u' ',
-		'show_in_menu': 1,
-		'version': 518
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Manage Account',
-		'parentfield': u'fields',
-		'parenttype': u'DocType',
-		'permlevel': 0
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': u'DocPerm',
-		'name': '__common__',
-		'parent': u'Manage Account',
-		'parentfield': u'permissions',
-		'parenttype': u'DocType',
-		'read': 1
-	},
-
-	# DocType, Manage Account
-	{
-		'doctype': 'DocType',
-		'name': u'Manage Account'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'System Manager',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'System Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'All'
-	},
-
-	# DocPerm
-	{
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'System Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': u'DocPerm',
-		'permlevel': 2,
-		'role': u'System Manager',
-		'write': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'System'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Example: http://frappe.erpnext.com',
-		'doctype': u'DocField',
-		'fieldname': u'account_url',
-		'fieldtype': u'Data',
-		'label': u'Account URL'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'sms_sender_name',
-		'fieldtype': u'Data',
-		'label': u'SMS Sender Name'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Company'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'default_company',
-		'fieldtype': u'Link',
-		'label': u'Default Company',
-		'options': u'Company',
-		'reqd': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'current_fiscal_year',
-		'fieldtype': u'Link',
-		'label': u'Current Fiscal Year',
-		'options': u'Fiscal Year',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'date_format',
-		'fieldtype': u'Select',
-		'label': u'Date Format',
-		'options': u'yyyy-mm-dd\ndd-mm-yyyy\ndd/mm/yyyy\nmm/dd/yyyy\nmm-dd-yyyy'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'default': u'INR',
-		'doctype': u'DocField',
-		'fieldname': u'default_currency',
-		'fieldtype': u'Select',
-		'label': u'Default Currency',
-		'options': u'link:Currency',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'default_currency_format',
-		'fieldtype': u'Select',
-		'label': u'Default Currency Format',
-		'options': u'Lacs\nMillions'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'default_currency_fraction',
-		'fieldtype': u'Data',
-		'label': u'Default Currency Fraction'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Stock'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'default_item_group',
-		'fieldtype': u'Link',
-		'label': u'Default Item Group',
-		'options': u'Item Group'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'HTML',
-		'label': u'IGHelp',
-		'options': u'<a href="#!Sales Browser/Item Group">To manage Item Groups, click here</a>'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'default_stock_uom',
-		'fieldtype': u'Link',
-		'label': u'Default Stock UOM',
-		'options': u'UOM'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'default_valuation_method',
-		'fieldtype': u'Select',
-		'label': u'Default Valuation Method',
-		'options': u'FIFO\nMoving Average'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Applicable only if valuation method is moving average',
-		'doctype': u'DocField',
-		'fieldname': u'allow_negative_stock',
-		'fieldtype': u'Check',
-		'label': u'Allow Negative Stock'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'default_warehouse_type',
-		'fieldtype': u'Link',
-		'label': u'Default Warehouse Type',
-		'options': u'Warehouse Type'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'auto_indent',
-		'fieldtype': u'Check',
-		'label': u'Raise Indent when stock reaches re-order level'
-	},
-
-	# DocField
-	{
-		'default': u'1',
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Percentage you are allowed to receive or deliver more against the quantity ordered. <p>For example: If you have ordered 100 units. and your Allowance is 10% then you are allowed to receive 110 units</p>',
-		'doctype': u'DocField',
-		'fieldname': u'tolerance',
-		'fieldtype': u'Currency',
-		'label': u'Allowance Percent'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Stock level frozen up to this date, nobody can do / modify entry except authorized person',
-		'doctype': u'DocField',
-		'fieldname': u'stock_frozen_upto',
-		'fieldtype': u'Date',
-		'label': u'Stock Frozen Upto'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Users with this role are allowed to do / modify stock entry before frozen date',
-		'doctype': u'DocField',
-		'fieldname': u'stock_auth_role',
-		'fieldtype': u'Link',
-		'label': u'Authorized Role (Frozen Entry)',
-		'options': u'Role'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Accounts'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Accounting entry frozen up to this date, nobody can do / modify entry except authorized person',
-		'doctype': u'DocField',
-		'fieldname': u'acc_frozen_upto',
-		'fieldtype': u'Date',
-		'label': u'Accounts Frozen Upto'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Users with this role are allowed to do / modify accounting entry before frozen date',
-		'doctype': u'DocField',
-		'fieldname': u'bde_auth_role',
-		'fieldtype': u'Link',
-		'label': u'Authourized Role (Frozen Entry)',
-		'options': u'Role'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'credit_controller',
-		'fieldtype': u'Link',
-		'label': u'Credit Controller',
-		'options': u'Role'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'HTML',
-		'label': u'Account Info',
-		'options': u'<div class="help-box">For more accounting defaults, Open <a href="#!List/Company">Company</a></div>'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Selling'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'Customer Name',
-		'doctype': u'DocField',
-		'fieldname': u'cust_master_name',
-		'fieldtype': u'Select',
-		'label': u'Customer Master created by ',
-		'options': u'\nCustomer Name\nNaming Series'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'default_customer_group',
-		'fieldtype': u'Link',
-		'label': u'Default Customer Group',
-		'options': u'Customer Group'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'HTML',
-		'label': u'CGHelp',
-		'options': u'<a href="#!Sales Browser/Customer Group">To manage Customer Groups, click here</a>'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'default_territory',
-		'fieldtype': u'Link',
-		'label': u'Default Territory',
-		'options': u'Territory'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'HTML',
-		'label': u'TerritoryHelp',
-		'options': u'<a href="#!Sales Browser/Territory">To manage Territory, click here</a>'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'default_price_list',
-		'fieldtype': u'Link',
-		'label': u'Default Price List',
-		'options': u'Price List'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'default_price_list_currency',
-		'fieldtype': u'Link',
-		'label': u'Default Price List Currency',
-		'options': u'Currency'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'No',
-		'doctype': u'DocField',
-		'fieldname': u'so_required',
-		'fieldtype': u'Select',
-		'label': u'Sales Order Required',
-		'options': u'No\nYes'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'No',
-		'doctype': u'DocField',
-		'fieldname': u'dn_required',
-		'fieldtype': u'Select',
-		'label': u'Delivery Note Required',
-		'options': u'No\nYes'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Buying'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'default_supplier_type',
-		'fieldtype': u'Link',
-		'label': u'Default Supplier Type',
-		'options': u'Supplier Type'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'Supplier Name',
-		'doctype': u'DocField',
-		'fieldname': u'supp_master_name',
-		'fieldtype': u'Select',
-		'label': u'Supplier Master created by ',
-		'options': u'Supplier Name\nNaming Series'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Column Break',
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'No',
-		'doctype': u'DocField',
-		'fieldname': u'po_required',
-		'fieldtype': u'Select',
-		'label': u'Purchase Order Required',
-		'options': u'No\nYes'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'No',
-		'doctype': u'DocField',
-		'fieldname': u'pr_required',
-		'fieldtype': u'Select',
-		'label': u'Purchase Receipt Required',
-		'options': u'No\nYes'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'HR',
-		'options': u'<div style="padding-top: 8px;" class="columnHeading">HR</div>'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Employee record is created using selected field. ',
-		'doctype': u'DocField',
-		'fieldname': u'emp_created_by',
-		'fieldtype': u'Select',
-		'label': u'Employee Records to be created by ',
-		'options': u'\nNaming Series\nEmployee Number'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/market_segment/market_segment.txt b/erpnext/setup/doctype/market_segment/market_segment.txt
index 6ecdb25..64832d2 100644
--- a/erpnext/setup/doctype/market_segment/market_segment.txt
+++ b/erpnext/setup/doctype/market_segment/market_segment.txt
@@ -3,78 +3,75 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:10',
+		'creation': '2012-03-27 14:36:21',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'yogesh@webnotestech.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:21',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
 		'allow_trash': 1,
-		'autoname': 'field:segment_name',
-		'colour': 'White:FFF',
+		'autoname': u'field:segment_name',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'in_create': 1,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
-		'name_case': 'Title Case',
+		'name_case': u'Title Case',
 		'read_only': 0,
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
 		'version': 1
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Market Segment',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Market Segment',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# DocType, Market Segment
 	{
 		'doctype': 'DocType',
-		'name': 'Market Segment'
+		'name': u'Market Segment'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'segment_name',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Segment Name',
-		'oldfieldname': 'segment_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'segment_name',
+		'fieldtype': u'Data',
+		'label': u'Segment Name',
+		'oldfieldname': u'segment_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'details',
-		'fieldtype': 'Text',
-		'idx': 3,
-		'label': 'Details',
-		'oldfieldname': 'details',
-		'oldfieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'details',
+		'fieldtype': u'Text',
+		'label': u'Details',
+		'oldfieldname': u'details',
+		'oldfieldtype': u'Text',
 		'permlevel': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/naming_series/naming_series.js b/erpnext/setup/doctype/naming_series/naming_series.js
index cd70dd7..c7897e44 100644
--- a/erpnext/setup/doctype/naming_series/naming_series.js
+++ b/erpnext/setup/doctype/naming_series/naming_series.js
@@ -20,9 +20,14 @@
     set_field_options('select_doc_for_series', r.message);
   }
   $c_obj([doc],'get_transactions','',callback);
-  
+  cur_frm.cscript.refresh();
   // add page head
-  var ph = new PageHeader(cur_frm.fields_dict['Head HTML'].wrapper, 'Setup Series', 'Set prefix for numbering series on your transactions');
+  //var ph = new PageHeader(cur_frm.fields_dict['head_html'].wrapper, 'Setup Series', 'Set prefix for numbering series on your transactions');
+}
+
+cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+  // hide buttons
+  $('.appframe-toolbar').toggle(false);
 }
 
 cur_frm.cscript.select_doc_for_series = function(doc, cdt, cdn) {
@@ -32,4 +37,4 @@
   }
 
   $c_obj([doc],'get_options','',callback)
-}
\ No newline at end of file
+}
diff --git a/erpnext/setup/doctype/naming_series/naming_series.py b/erpnext/setup/doctype/naming_series/naming_series.py
index bef4987..5a9a265 100644
--- a/erpnext/setup/doctype/naming_series/naming_series.py
+++ b/erpnext/setup/doctype/naming_series/naming_series.py
@@ -19,6 +19,7 @@
 
 from webnotes.utils import cint, cstr
 from webnotes import msgprint, errprint
+import webnotes.model.doctype
 
 sql = webnotes.conn.sql
 	
@@ -31,15 +32,7 @@
 
 	#-----------------------------------------------------------------------------------------------------------------------------------
 	def get_transactions(self):
-		return "\n".join([''] + [i[0] for i in sql("SELECT `tabDocField`.`parent` FROM `tabDocField`, `tabDocType` WHERE `tabDocField`.`fieldname` = 'naming_series' and `tabDocType`.module !='Recycle Bin' and `tabDocType`.name=`tabDocField`.parent order by `tabDocField`.parent")])
-	
-	#-----------------------------------------------------------------------------------------------------------------------------------
-	def get_options_for(self, doctype):
-		sr = sql("select options from `tabDocField` where parent='%s' and fieldname='naming_series'" % (doctype))
-		if sr and sr[0][0]:
-			return sr[0][0].split("\n")
-		else:
-			return []
+		return "\n".join([''] + [i[0] for i in sql("SELECT `tabDocField`.`parent` FROM `tabDocField`, `tabDocType` WHERE `tabDocField`.`fieldname` = 'naming_series' and `tabDocType`.name=`tabDocField`.parent order by `tabDocField`.parent")])
 	
 	def scrub_options_list(self, ol):
 		options = filter(lambda x: x, [cstr(n.upper()).strip() for n in ol])
@@ -50,7 +43,7 @@
 		options = self.scrub_options_list(ol)
 		
 		# validate names
-		[self.validate_series_name(i) for i in options]
+		for i in options: self.validate_series_name(i)
 		
 		if self.doc.user_must_always_select:
 			options = [''] + options
@@ -58,9 +51,33 @@
 		else:
 			default = options[0]
 		
-		# update
-		sql("update tabDocField set `options`=%s, `default`=%s where parent=%s and fieldname='naming_series'", ("\n".join(options), default, doctype))
+		# update in property setter
+		from webnotes.model.doc import Document
+		prop_dict = {'options': "\n".join(options), 'default': default}
+		for prop in prop_dict:
+			ps_exists = webnotes.conn.sql("""SELECT name FROM `tabProperty Setter`
+					WHERE doc_type = %s AND field_name = 'naming_series'
+					AND property = %s""", (doctype, prop))
+			if ps_exists:
+				ps = Document('Property Setter', ps_exists[0][0])
+				ps.value = prop_dict[prop]
+				ps.save()
+			else:
+				ps = Document('Property Setter', fielddata = {
+					'doctype_or_field': 'DocField',
+					'doc_type': doctype,
+					'field_name': 'naming_series',
+					'property': prop,
+					'value': prop_dict[prop],
+					'property_type': 'Select',
+					'select_doctype': doctype
+				})
+				ps.save(1)
+
 		self.doc.set_options = "\n".join(options)
+
+		from webnotes.utils.cache import CacheItem
+		CacheItem(doctype).clear()
 	
 	#-----------------------------------------------------------------------------------------------------------------------------------
 	def update_series(self):
@@ -73,7 +90,8 @@
 		from core.doctype.doctype.doctype import DocType
 		dt = DocType()
 	
-		sr = sql("select options, parent from `tabDocField` where fieldname='naming_series' and parent != %s", self.doc.select_doc_for_series)
+		parent = sql("select parent from `tabDocField` where fieldname='naming_series' and parent != %s", self.doc.select_doc_for_series)
+		sr = ([webnotes.model.doctype.get_property(p[0], 'options', 'naming_series'), p[0]] for p in parent)
 		options = self.scrub_options_list(self.doc.set_options.split("\n"))
 		for series in options:
 			dt.validate_series(series, self.doc.select_doc_for_series)
@@ -91,9 +109,8 @@
 		
 	#-----------------------------------------------------------------------------------------------------------------------------------
 	def get_options(self, arg=''):
-		so = sql("select options from `tabDocField` where parent=%s and fieldname='naming_series'", self.doc.select_doc_for_series)
-		if so:
-			return so[0][0] or ''
+		sr = webnotes.model.doctype.get_property(self.doc.select_doc_for_series, 'options', 'naming_series')
+		return sr
 
 
 	#-----------------------------------------------------------------------------------------------------------------------------------
diff --git a/erpnext/setup/doctype/naming_series/naming_series.txt b/erpnext/setup/doctype/naming_series/naming_series.txt
index a02d5b7..6cb1dab 100644
--- a/erpnext/setup/doctype/naming_series/naming_series.txt
+++ b/erpnext/setup/doctype/naming_series/naming_series.txt
@@ -3,62 +3,62 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-10-27 14:29:55',
+		'creation': '2012-04-10 13:01:16',
 		'docstatus': 0,
-		'modified': '2010-11-26 18:45:26',
-		'modified_by': 'sneha@webnotestech.com',
-		'owner': 'Administrator'
+		'modified': '2012-04-10 18:45:34',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
+		'description': u'Set prefix for numbering series on your transactions',
 		'doctype': 'DocType',
-		'hide_heading': 1,
-		'hide_toolbar': 1,
+		'hide_heading': 0,
+		'hide_toolbar': 0,
 		'issingle': 1,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
 		'read_only': 1,
-		'section_style': 'Tray',
-		'server_code_error': ' ',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'version': 58
+		'version': 66
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Naming Series',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Naming Series',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Naming Series',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Naming Series',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Naming Series
 	{
 		'doctype': 'DocType',
-		'name': 'Naming Series'
+		'name': u'Naming Series'
 	},
 
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
@@ -67,20 +67,18 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 2,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'submit': 0,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 3,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'System Manager'
+		'role': u'System Manager'
 	},
 
 	# DocPerm
@@ -88,119 +86,104 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 4,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'submit': 0,
 		'write': 0
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 5,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Guest'
+		'role': u'Guest'
 	},
 
 	# DocField
 	{
-		'description': 'Set prefix for numbering series on your transactions',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 1,
-		'label': 'Setup Series'
+		'description': u'Set prefix for numbering series on your transactions',
+		'doctype': u'DocField',
+		'fieldname': u'setup_series',
+		'fieldtype': u'Section Break',
+		'label': u'Setup Series'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 2,
-		'label': 'Head HTML'
+		'doctype': u'DocField',
+		'fieldname': u'select_doc_for_series',
+		'fieldtype': u'Select',
+		'label': u'Select Transaction'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'select_doc_for_series',
-		'fieldtype': 'Select',
-		'idx': 3,
-		'label': 'Select Transaction'
+		'doctype': u'DocField',
+		'fieldname': u'help_html',
+		'fieldtype': u'HTML',
+		'label': u'Help HTML',
+		'options': u'<div style="padding: 8px; background-color: #FFD; margin: 8px 0px;">\nWrite the list of series options in the list below. Each on a new line<br>\nAllowed special characters are "/" and "-"<br>\nExamples:<br>\nINV-<br>\nINV-10-<br>\nINVK-<br>\n</div>'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 4,
-		'label': 'Help HTML',
-		'options': '<div style="padding: 8px; background-color: #FFD; margin: 8px 0px;">\nWrite the list of series options in the list below. Each on a new line<br>\nAllowed special characters are "/" and "-"<br>\nExamples:<br>\nINV-<br>\nINV-10-<br>\nINVK-<br>\n</div>'
+		'doctype': u'DocField',
+		'fieldname': u'set_options',
+		'fieldtype': u'Text',
+		'label': u'Set Series'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'set_options',
-		'fieldtype': 'Text',
-		'idx': 5,
-		'label': 'Set Series'
+		'colour': u'White:FFF',
+		'description': u'Check this if you want to force the user to select a series before saving. There will be no default if you check this.',
+		'doctype': u'DocField',
+		'fieldname': u'user_must_always_select',
+		'fieldtype': u'Check',
+		'label': u'User must always select'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Check this if you want to force the user to select a series before saving. There will be no default if you check this.',
-		'doctype': 'DocField',
-		'fieldname': 'user_must_always_select',
-		'fieldtype': 'Check',
-		'idx': 6,
-		'label': 'User must always select'
+		'doctype': u'DocField',
+		'fieldname': u'update',
+		'fieldtype': u'Button',
+		'label': u'Update',
+		'options': u'update_series'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 7,
-		'label': 'Update',
-		'options': 'update_series'
+		'description': u'Set starting number for series of your transactions',
+		'doctype': u'DocField',
+		'fieldname': u'update_series',
+		'fieldtype': u'Section Break',
+		'label': u'Update Series'
 	},
 
 	# DocField
 	{
-		'description': 'Set starting number for series of your transactions',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 8,
-		'label': 'Update Series'
+		'doctype': u'DocField',
+		'fieldname': u'prefix',
+		'fieldtype': u'Data',
+		'label': u'Prefix'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'prefix',
-		'fieldtype': 'Data',
-		'idx': 9,
-		'label': 'Prefix'
+		'doctype': u'DocField',
+		'fieldname': u'starts_from',
+		'fieldtype': u'Int',
+		'label': u'Starts From'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'starts_from',
-		'fieldtype': 'Int',
-		'idx': 10,
-		'label': 'Starts From'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 11,
-		'label': 'Update Series Start',
-		'options': 'update_series_start'
+		'doctype': u'DocField',
+		'fieldname': u'update_series_start',
+		'fieldtype': u'Button',
+		'label': u'Update Series Start',
+		'options': u'update_series_start'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/naming_series_options/naming_series_options.txt b/erpnext/setup/doctype/naming_series_options/naming_series_options.txt
index 23f4905..88554ec 100644
--- a/erpnext/setup/doctype/naming_series_options/naming_series_options.txt
+++ b/erpnext/setup/doctype/naming_series_options/naming_series_options.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 10:23:17',
+		'creation': '2012-03-27 14:36:21',
 		'docstatus': 0,
-		'modified': '2012-03-21 14:53:21',
+		'modified': '2012-03-27 14:36:21',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
diff --git a/erpnext/setup/doctype/notification_control/notification_control.py b/erpnext/setup/doctype/notification_control/notification_control.py
index 9dc0076..650486e 100644
--- a/erpnext/setup/doctype/notification_control/notification_control.py
+++ b/erpnext/setup/doctype/notification_control/notification_control.py
@@ -99,7 +99,7 @@
 		"""
 			Get default print format from doclayer
 		"""
-		doclayer = get_obj('DocLayer', 'DocLayer')
+		doclayer = get_obj('Customize Form', 'Customize Form')
 		doclayer.doc.doc_type = args.get('doctype')
 		doclayer.get()
 		if doclayer.doc.default_print_format:
diff --git a/erpnext/setup/doctype/notification_control/notification_control.txt b/erpnext/setup/doctype/notification_control/notification_control.txt
index e93408c..49526ca 100644
--- a/erpnext/setup/doctype/notification_control/notification_control.txt
+++ b/erpnext/setup/doctype/notification_control/notification_control.txt
@@ -3,11 +3,11 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-09-01 15:48:07',
+		'creation': '2012-03-27 14:36:22',
 		'docstatus': 0,
-		'modified': '2010-10-14 10:48:02',
-		'modified_by': 'nabin@webnotestech.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:22',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
@@ -15,33 +15,33 @@
 		'allow_copy': 1,
 		'allow_email': 1,
 		'allow_print': 1,
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'issingle': 1,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 79
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Notification Control',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Notification Control',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Notification Control',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Notification Control',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1
 	},
@@ -49,282 +49,259 @@
 	# DocType, Notification Control
 	{
 		'doctype': 'DocType',
-		'name': 'Notification Control'
+		'name': u'Notification Control'
 	},
 
 	# DocPerm
 	{
 		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'Guest',
+		'doctype': u'DocPerm',
+		'role': u'Guest',
 		'write': 0
 	},
 
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'System Manager',
+		'doctype': u'DocPerm',
+		'role': u'System Manager',
 		'write': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 1,
-		'label': 'Send Auto-notification for'
+		'doctype': u'DocField',
+		'fieldname': u'send_autonotification_for',
+		'fieldtype': u'Section Break',
+		'label': u'Send Auto-notification for'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 2,
-		'label': 'Sales',
-		'width': '50%'
+		'doctype': u'DocField',
+		'fieldname': u'sales',
+		'fieldtype': u'Column Break',
+		'label': u'Sales',
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'enquiry',
-		'fieldtype': 'Check',
+		'doctype': u'DocField',
+		'fieldname': u'enquiry',
+		'fieldtype': u'Check',
 		'hidden': 1,
-		'idx': 3,
-		'label': 'Enquiry',
+		'label': u'Opportunity',
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'quotation',
-		'fieldtype': 'Check',
-		'idx': 4,
-		'label': 'Quotation'
+		'doctype': u'DocField',
+		'fieldname': u'quotation',
+		'fieldtype': u'Check',
+		'label': u'Quotation'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'sales_order',
-		'fieldtype': 'Check',
-		'idx': 5,
-		'label': 'Sales Order'
+		'doctype': u'DocField',
+		'fieldname': u'sales_order',
+		'fieldtype': u'Check',
+		'label': u'Sales Order'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'delivery_note',
-		'fieldtype': 'Check',
-		'idx': 6,
-		'label': 'Delivery Note'
+		'doctype': u'DocField',
+		'fieldname': u'delivery_note',
+		'fieldtype': u'Check',
+		'label': u'Delivery Note'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'receivable_voucher',
-		'fieldtype': 'Check',
-		'idx': 7,
-		'label': 'Sales Invoice'
+		'doctype': u'DocField',
+		'fieldname': u'receivable_voucher',
+		'fieldtype': u'Check',
+		'label': u'Sales Invoice'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 8,
-		'label': 'Purchase',
-		'width': '50%'
+		'doctype': u'DocField',
+		'fieldname': u'purchase',
+		'fieldtype': u'Column Break',
+		'label': u'Purchase',
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'purchase_order',
-		'fieldtype': 'Check',
-		'idx': 9,
-		'label': 'Purchase Order'
+		'doctype': u'DocField',
+		'fieldname': u'purchase_order',
+		'fieldtype': u'Check',
+		'label': u'Purchase Order'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'purchase_receipt',
-		'fieldtype': 'Check',
-		'idx': 10,
-		'label': 'Purchase Receipt'
+		'doctype': u'DocField',
+		'fieldname': u'purchase_receipt',
+		'fieldtype': u'Check',
+		'label': u'Purchase Receipt'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'payable_voucher',
-		'fieldtype': 'Check',
-		'idx': 11,
-		'label': 'Purchase Invoice',
+		'doctype': u'DocField',
+		'fieldname': u'payable_voucher',
+		'fieldtype': u'Check',
+		'label': u'Purchase Invoice',
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'expense_voucher',
-		'fieldtype': 'Check',
-		'idx': 12,
-		'label': 'Expense Voucher'
+		'doctype': u'DocField',
+		'fieldname': u'expense_voucher',
+		'fieldtype': u'Check',
+		'label': u'Expense Claim'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 13,
-		'label': 'Customize the Notification'
+		'doctype': u'DocField',
+		'fieldname': u'customize_the_notification',
+		'fieldtype': u'Section Break',
+		'label': u'Customize the Notification'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'select_transaction',
-		'fieldtype': 'Select',
-		'idx': 14,
-		'label': 'Select Transaction',
-		'options': '\nQuotation\nSales Order\nDelivery Note\nSales Invoice\nPayment Received\nPurchase Order\nPurchase Receipt\nPayment Sent',
-		'trigger': 'Client'
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'select_transaction',
+		'fieldtype': u'Select',
+		'label': u'Select Transaction',
+		'options': u'\nQuotation\nSales Order\nDelivery Note\nSales Invoice\nPayment Received\nPurchase Order\nPurchase Receipt\nPayment Sent',
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'custom_message',
-		'fieldtype': 'Text Editor',
-		'idx': 15,
-		'label': 'Custom Message'
+		'doctype': u'DocField',
+		'fieldname': u'custom_message',
+		'fieldtype': u'Text Editor',
+		'label': u'Custom Message'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 16,
-		'label': 'Update',
-		'options': 'set_message'
+		'doctype': u'DocField',
+		'fieldname': u'update',
+		'fieldtype': u'Button',
+		'label': u'Update',
+		'options': u'set_message'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'quotation_message',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'quotation_message',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'idx': 17,
-		'label': 'Quotation Message',
+		'label': u'Quotation Message',
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'sales_order_message',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'sales_order_message',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'idx': 18,
-		'label': 'Sales Order Message',
+		'label': u'Sales Order Message',
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'delivery_note_message',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'delivery_note_message',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'idx': 19,
-		'label': 'Delivery Note Message',
+		'label': u'Delivery Note Message',
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'sales_invoice_message',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'sales_invoice_message',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'idx': 20,
-		'label': 'Sales Invoice Message',
+		'label': u'Sales Invoice Message',
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'payment_received_message',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'payment_received_message',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'idx': 21,
-		'label': 'Payment Received Message',
+		'label': u'Payment Received Message',
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'purchase_order_message',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'purchase_order_message',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'idx': 22,
-		'label': 'Purchase Order Message',
+		'label': u'Purchase Order Message',
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'purchase_receipt_message',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'purchase_receipt_message',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'idx': 23,
-		'label': 'Purchase Receipt Message',
+		'label': u'Purchase Receipt Message',
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'payment_sent_message',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'payment_sent_message',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'idx': 24,
-		'label': 'Payment Sent Message',
+		'label': u'Payment Sent Message',
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'expense_voucher_approved_message',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'expense_voucher_approved_message',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'idx': 25,
-		'label': 'Expense Voucher Approved Message',
+		'label': u'Expense Claim Approved Message',
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'expense_voucher_rejected_message',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'expense_voucher_rejected_message',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'idx': 26,
-		'label': 'Expense Voucher Rejected Message',
+		'label': u'Expense Claim Rejected Message',
 		'print_hide': 1
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/order_lost_reason/order_lost_reason.txt b/erpnext/setup/doctype/order_lost_reason/order_lost_reason.txt
deleted file mode 100644
index d1ef5a8..0000000
--- a/erpnext/setup/doctype/order_lost_reason/order_lost_reason.txt
+++ /dev/null
@@ -1,97 +0,0 @@
-# DocType, Order Lost Reason
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:10',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'yogesh@webnotestech.com',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'allow_trash': 1,
-		'autoname': 'field:order_lost_reason',
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'Setup',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 4
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Order Lost Reason',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'Order Lost Reason',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'permlevel': 0,
-		'read': 1,
-		'write': 1
-	},
-
-	# DocType, Order Lost Reason
-	{
-		'doctype': 'DocType',
-		'name': 'Order Lost Reason'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'System Manager'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'Sales Master Manager',
-		'submit': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'order_lost_reason',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Order Lost Reason',
-		'oldfieldname': 'order_lost_reason',
-		'oldfieldtype': 'Data',
-		'permlevel': 0,
-		'reqd': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/other_charges/other_charges.js b/erpnext/setup/doctype/other_charges/other_charges.js
deleted file mode 100644
index 85bdb79..0000000
--- a/erpnext/setup/doctype/other_charges/other_charges.js
+++ /dev/null
@@ -1,187 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-//--------- ONLOAD -------------
-cur_frm.cscript.onload = function(doc, cdt, cdn) {
-  // 
-}
-
-/*cur_frm.cscript.refresh = function(doc, cdt, cdn) {
-   
-}*/
-
-// For customizing print
-cur_frm.pformat.net_total = function(doc) {
-	return '';
-}
-
-cur_frm.pformat.grand_total_export = function(doc) {
-	return '';
-}
-
-cur_frm.pformat.rounded_total_export = function(doc) {
-	return '';
-}
-
-cur_frm.pformat.in_words_export = function(doc) {
-	return '';
-}
-
-cur_frm.pformat.other_charges= function(doc){
-  //function to make row of table
-	var make_row = function(title,val,bold){
-		var bstart = '<b>'; var bend = '</b>';
-		return '<tr><td style="width:50%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
-		 +'<td style="width:25%;text-align:right;">'+doc.currency+'</td>'
-		 +'<td style="width:25%;text-align:right;">'+val+'</td>'
-		 +'</tr>'
-	}
-
-	function convert_rate(val){
-		var new_val = flt(val)/flt(doc.conversion_rate);
-		return new_val;
-	}
-	out ='';
-	if (!doc.print_without_amount) {
-		print_hide_dict = {};
-		for(var i in locals['DocField']) {
-			var doc_field = locals['DocField'][i];
-			if(doc_field.fieldname) {
-				print_hide_dict[doc_field.fieldname] = doc_field.print_hide;
-			}
-		}
-
-		var cl = getchildren('RV Tax Detail',doc.name,'other_charges');
-
-		// outer table  
-		var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';
-
-		// main table
-
-		out +='<table class="noborder" style="width:100%">';
-		if(!print_hide_dict['net_total']) {
-			out +=make_row('Net Total',fmt_money(convert_rate(doc.net_total)),1);
-		}
-
-		// add rows
-		if(cl.length){
-			for(var i=0;i<cl.length;i++){
-				if(fmt_money(convert_rate(cl[i].tax_amount))!=0 && !cl[i].included_in_print_rate)
-				  out += make_row(cl[i].description,fmt_money(convert_rate(cl[i].tax_amount)),0);
-			}
-		}
-
-		// grand total
-		if(!print_hide_dict['grand_total_export']) {
-			out += make_row('Grand Total',fmt_money(doc.grand_total_export),1);
-		}
-		
-		if(!print_hide_dict['rounded_total_export']) {
-			out += make_row('Rounded Total',fmt_money(doc.rounded_total_export),1);
-		}
-
-		if(doc.in_words_export && !print_hide_dict['in_words_export']){
-			out +='</table></td></tr>';
-			out += '<tr><td colspan = "2">';
-			out += '<table><tr><td style="width:25%;"><b>In Words</b></td>'
-			out+= '<td style="width:50%;">'+doc.in_words_export+'</td></tr>'
-		}
-		out +='</table></td></tr></table></div>';   
-	}
-	return out;
-}
-
-cur_frm.cscript.charge_type = function(doc, cdt, cdn) {
-  var d = locals[cdt][cdn];
-  if(d.idx == 1 && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){
-    alert("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row");
-    d.charge_type = '';
-  }
-  validated = false;
-  refresh_field('charge_type',d.name,'other_charges');
-  cur_frm.cscript.row_id(doc, cdt, cdn);
-  cur_frm.cscript.rate(doc, cdt, cdn);
-  cur_frm.cscript.tax_amount(doc, cdt, cdn);
-}
-
-cur_frm.cscript.row_id = function(doc, cdt, cdn) {
-  var d = locals[cdt][cdn];
-  if(!d.charge_type && d.row_id){
-    alert("Please select Charge Type first");
-    d.row_id = '';
-  }
-  else if((d.charge_type == 'Actual' || d.charge_type == 'On Net Total') && d.row_id) {
-    alert("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'");
-    d.row_id = '';
-  }
-  else if((d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total') && d.row_id){
-    if(d.row_id >= d.idx){
-      alert("You cannot Enter Row no. greater than or equal to current row no. for this Charge type");
-      d.row_id = '';
-    }
-  }
-  validated = false;
-  refresh_field('row_id',d.name,'other_charges');
-}
-
-/*---------------------- Get rate if account_head has account_type as TAX or CHARGEABLE-------------------------------------*/
-
-cur_frm.fields_dict['other_charges'].grid.get_field("account_head").get_query = function(doc,cdt,cdn) {
-  return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type = "Tax" OR tabAccount.account_type = "Chargeable") AND tabAccount.company = "'+doc.company+'" AND  tabAccount.name LIKE "%s"'
-}
-
-cur_frm.fields_dict['other_charges'].grid.get_field("cost_center_other_charges").get_query = function(doc) {
-	return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY	`tabCost Center`.`name` ASC LIMIT 50';
-}
-
-
-cur_frm.cscript.account_head = function(doc, cdt, cdn) {
-  var d = locals[cdt][cdn];
-  if(!d.charge_type && d.account_head){
-    alert("Please select Charge Type first");
-    validated = false;
-    d.account_head = '';
-  }
-  else if(d.account_head && d.charge_type) {
-    arg = "{'charge_type' : '" + d.charge_type +"', 'account_head' : '" + d.account_head + "'}";
-    get_server_fields('get_rate', arg, 'other_charges', doc, cdt, cdn, 1);
-  }
-  refresh_field('account_head',d.name,'other_charges');
-}
-
-cur_frm.cscript.rate = function(doc, cdt, cdn) {
-  var d = locals[cdt][cdn];
-  if(!d.charge_type && d.rate) {
-    alert("Please select Charge Type first");
-    d.rate = '';
-  }
-  validated = false;
-  refresh_field('rate',d.name,'other_charges');
-}
-
-cur_frm.cscript.tax_amount = function(doc, cdt, cdn) {
-  var d = locals[cdt][cdn];
-  if(!d.charge_type && d.tax_amount){
-    alert("Please select Charge Type first");
-    d.tax_amount = '';
-  }
-  else if(d.charge_type && d.tax_amount) {
-    alert("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate");
-    d.tax_amount = '';
-  }
-  validated = false;
-  refresh_field('tax_amount',d.name,'other_charges');
-}
diff --git a/erpnext/setup/doctype/other_charges/other_charges.py b/erpnext/setup/doctype/other_charges/other_charges.py
deleted file mode 100644
index eb9ebb5..0000000
--- a/erpnext/setup/doctype/other_charges/other_charges.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-	
-# -----------------------------------------------------------------------------------------
-
-
-class DocType:
-  def __init__(self, doc, doclist=[]):
-    self.doc = doc
-    self.doclist = doclist
-
-  # Get Tax Rate if account type is Tax
-  # ===================================================================
-  def get_rate(self, arg):
-    get_obj('Sales Common').get_rate(arg, self)
-
-  def update_other_default_charges(self):
-    sql("update `tabOther Charges` set is_default = 0 where ifnull(is_default,0) = 1 and name != '%s' and company = '%s'" % (self.doc.name, self.doc.company))
-
-  def on_update(self):
-    self.update_other_default_charges()
diff --git a/erpnext/setup/doctype/other_charges/other_charges.txt b/erpnext/setup/doctype/other_charges/other_charges.txt
deleted file mode 100644
index b4dee65..0000000
--- a/erpnext/setup/doctype/other_charges/other_charges.txt
+++ /dev/null
@@ -1,194 +0,0 @@
-# DocType, Other Charges
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:11',
-		'docstatus': 0,
-		'modified': '2012-03-21 14:51:06',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': u'1322549700',
-		'allow_trash': 1,
-		'autoname': u'field:title',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'document_type': u'Master',
-		'module': u'Setup',
-		'name': '__common__',
-		'section_style': u'Tabbed',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 57
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Other Charges',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': u'DocPerm',
-		'name': '__common__',
-		'parent': u'Other Charges',
-		'parentfield': u'permissions',
-		'parenttype': u'DocType',
-		'read': 1
-	},
-
-	# DocType, Other Charges
-	{
-		'doctype': 'DocType',
-		'name': u'Other Charges'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Sales Master Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Sales User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Sales User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Accounts Manager',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'System Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Sales Master Manager',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'trash_reason',
-		'fieldtype': u'Small Text',
-		'label': u'Trash Reason',
-		'oldfieldname': u'trash_reason',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Section Break',
-		'label': u'Other Charges Details',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'title',
-		'fieldtype': u'Data',
-		'in_filter': 1,
-		'label': u'Title',
-		'oldfieldname': u'title',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'is_default',
-		'fieldtype': u'Check',
-		'label': u'Default',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'company',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Company',
-		'oldfieldname': u'company',
-		'oldfieldtype': u'Link',
-		'options': u'Company',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'other_charges',
-		'fieldtype': u'Table',
-		'label': u'Other Charges',
-		'oldfieldname': u'other_charges',
-		'oldfieldtype': u'Table',
-		'options': u'RV Tax Detail',
-		'permlevel': 0
-	}
-]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/period/period.txt b/erpnext/setup/doctype/period/period.txt
index 15941a5..77ee019 100644
--- a/erpnext/setup/doctype/period/period.txt
+++ b/erpnext/setup/doctype/period/period.txt
@@ -3,120 +3,113 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:12',
+		'creation': '2012-03-27 14:36:22',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'nabin@webnotestech.com'
+		'modified': '2012-03-27 14:36:22',
+		'modified_by': u'Administrator',
+		'owner': u'nabin@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'autoname': 'field:period_name',
-		'colour': 'White:FFF',
+		'autoname': u'field:period_name',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
+		'document_type': u'Master',
 		'in_create': 1,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 5
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Period',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Period',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Period',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Period',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 0
 	},
 
 	# DocType, Period
 	{
 		'doctype': 'DocType',
-		'name': 'Period'
+		'name': u'Period'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 1
+		'doctype': u'DocPerm'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2
+		'doctype': u'DocPerm'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'period_name',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'label': 'Period Name',
-		'oldfieldname': 'period_name',
-		'oldfieldtype': 'Data'
+		'doctype': u'DocField',
+		'fieldname': u'period_name',
+		'fieldtype': u'Data',
+		'label': u'Period Name',
+		'oldfieldname': u'period_name',
+		'oldfieldtype': u'Data'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'start_date',
-		'fieldtype': 'Date',
-		'idx': 2,
-		'label': 'Start Date',
-		'oldfieldname': 'start_date',
-		'oldfieldtype': 'Date'
+		'doctype': u'DocField',
+		'fieldname': u'start_date',
+		'fieldtype': u'Date',
+		'label': u'Start Date',
+		'oldfieldname': u'start_date',
+		'oldfieldtype': u'Date'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'end_date',
-		'fieldtype': 'Date',
-		'idx': 3,
-		'label': 'End Date',
-		'oldfieldname': 'end_date',
-		'oldfieldtype': 'Date'
+		'doctype': u'DocField',
+		'fieldname': u'end_date',
+		'fieldtype': u'Date',
+		'label': u'End Date',
+		'oldfieldname': u'end_date',
+		'oldfieldtype': u'Date'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'period_type',
-		'fieldtype': 'Data',
-		'idx': 4,
-		'label': 'Period Type',
-		'oldfieldname': 'period_type',
-		'oldfieldtype': 'Data'
+		'doctype': u'DocField',
+		'fieldname': u'period_type',
+		'fieldtype': u'Data',
+		'label': u'Period Type',
+		'oldfieldname': u'period_type',
+		'oldfieldtype': u'Data'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Data',
-		'idx': 5,
-		'label': 'Fiscal Year',
-		'oldfieldname': 'fiscal_year',
-		'oldfieldtype': 'Data'
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Data',
+		'label': u'Fiscal Year',
+		'oldfieldname': u'fiscal_year',
+		'oldfieldtype': u'Data'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/period_control/period_control.txt b/erpnext/setup/doctype/period_control/period_control.txt
index 5a4117e..420b319 100644
--- a/erpnext/setup/doctype/period_control/period_control.txt
+++ b/erpnext/setup/doctype/period_control/period_control.txt
@@ -3,30 +3,30 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:12',
+		'creation': '2012-03-27 14:36:22',
 		'docstatus': 0,
-		'modified': '2011-01-03 17:46:14',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'nabin@webnotestech.com'
+		'modified': '2012-03-27 14:36:22',
+		'modified_by': u'Administrator',
+		'owner': u'nabin@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'in_create': 1,
 		'issingle': 1,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
 		'read_only': 1,
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 36
 	},
 
 	# DocType, Period Control
 	{
 		'doctype': 'DocType',
-		'name': 'Period Control'
+		'name': u'Period Control'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/permission_control/permission_control.py b/erpnext/setup/doctype/permission_control/permission_control.py
index bb05bec..4ddf5c6 100644
--- a/erpnext/setup/doctype/permission_control/permission_control.py
+++ b/erpnext/setup/doctype/permission_control/permission_control.py
@@ -57,25 +57,33 @@
 	# Get Perm Level, Perm type of Doctypes of Module and Role Selected
 	# -------------------------------------------------------------------
 	def get_permissions(self,doctype):
-		ret = []
-			
-		# Get permtype for the role selected
-		ptype = sql("select `role`,`permlevel`,`read`,`write`,`create`,`submit`,`cancel`,`amend` from tabDocPerm where `parent` = %s order by `permlevel` ASC",doctype,as_dict = 1)
+		import webnotes.model.doctype
+		doclist = webnotes.model.doctype.get(doctype, form=0)
+		
+		ptype = [{
+				'role': perm.role,
+				'permlevel': cint(perm.permlevel),
+				'read': cint(perm.read),
+				'write': cint(perm.write),
+				'create': cint(perm.create),
+				'cancel': cint(perm.cancel),
+				'submit': cint(perm.submit),
+				'amend': cint(perm.amend),
+				'match': perm.match
+				} for perm in sorted(doclist,
+					key=lambda d: [d.fields.get('permlevel'),
+						d.fields.get('role')]) if perm.doctype=='DocPerm']
 
-		# to convert 0L in 0 in values of dictionary
-		for p in ptype:
-			for key in p:
-				if key!='role':
-					p[key] = cint(p[key])
-			ret.append(p)
-						
-		# fields list
-		fl = ['', 'owner'] + [l[0] for l in sql("""\
-			select fieldname from tabDocField where parent=%s
-			and ((fieldtype='Link' and ifnull(options,'')!='') or
-			(fieldtype='Select') and lcase(ifnull(options,'')) like 'link:%%')""", doctype)]
-						
-		return {'perms':ret, 'fields':fl}
+		fl = ['', 'owner'] + [d.fieldname for d in doclist \
+				if d.doctype=='DocField' and ((d.fieldtype=='Link' \
+				and cstr(d.options)!='') or (d.fieldtype=='Select' and
+					'link:' in cstr(d.options).lower()))]
+
+		return {
+			'perms':ptype,
+			'fields':fl,
+			'is_submittable': doclist[0].fields.get('is_submittable')
+		}
 		
 	# get default values
 	# ------------------
@@ -148,7 +156,7 @@
 	def update_permissions(self,args=''):
 		args = eval(args)
 		di = args['perm_dict']
-		doctype_keys = di.keys()	# ['Enquiry','Competitor','Zone','State']
+		doctype_keys = di.keys()	# ['Opportunity','Competitor','Zone','State']
 		for parent in doctype_keys:
 			for permlevel in di[parent].keys():
 				for role in di[parent][permlevel].keys(): 
@@ -183,6 +191,11 @@
 							sql("delete from tabDocPerm where parent = %s and role = %s and ifnull(permlevel,0) = %s",(parent, role, cint(permlevel)))
 						
 						sql("update tabDocType set modified = %s where name = %s",(now(), parent))
+
+
+		from webnotes.utils.cache import CacheItem
+		CacheItem(parent).clear()		
+
 		msgprint("Permissions Updated")
 				
 	# Get Fields based on DocType and Permlevel
diff --git a/erpnext/setup/doctype/permission_control/permission_control.txt b/erpnext/setup/doctype/permission_control/permission_control.txt
index 397d6c7..dd95608 100644
--- a/erpnext/setup/doctype/permission_control/permission_control.txt
+++ b/erpnext/setup/doctype/permission_control/permission_control.txt
@@ -3,24 +3,24 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:12',
+		'creation': '2012-03-27 14:36:22',
 		'docstatus': 0,
-		'modified': '2010-12-20 15:09:18',
-		'modified_by': 'sneha@webnotestech.com',
-		'owner': 'saumil@webnotestech.com'
+		'modified': '2012-03-27 14:36:22',
+		'modified_by': u'Administrator',
+		'owner': u'saumil@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'in_create': 1,
 		'issingle': 1,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
 		'read_only': 1,
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 15
 	},
@@ -28,6 +28,6 @@
 	# DocType, Permission Control
 	{
 		'doctype': 'DocType',
-		'name': 'Permission Control'
+		'name': u'Permission Control'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/personalize/__init__.py b/erpnext/setup/doctype/personalize/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/setup/doctype/personalize/__init__.py
+++ /dev/null
diff --git a/erpnext/setup/doctype/personalize/personalize.py b/erpnext/setup/doctype/personalize/personalize.py
deleted file mode 100644
index acf71e5..0000000
--- a/erpnext/setup/doctype/personalize/personalize.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import webnotes
-
-class DocType:
-	def __init__(self, d, dl):
-		self.doc, self.doclist = d, dl
-	
-	#
-	# load current banner
-	#
-	def onload(self):
-		self.doc.header_html = webnotes.conn.get_value('Control Panel', None, 'client_name')
-	
-	#
-	# on update
-	#
-	def validate(self):
-		from webnotes.utils import cint
-		if self.doc.file_list and cint(self.doc.set_from_attachment):
-			self.set_html_from_image()
-
-		# update control panel - so it loads new letter directly
-		webnotes.conn.set_value('Control Panel', None, 'client_name', self.doc.header_html)
-		 
-		# clear the cache so that the new letter head is uploaded
-		webnotes.conn.sql("delete from __SessionCache")
-
-	#
-	# set html for image
-	#
-	def set_html_from_image(self):
-		file_name = self.doc.file_list.split(',')[0]
-		self.doc.header_html = """<div>
-<img style="max-height: 120px; max-width: 600px" src="files/%s"/>
-</div>""" % file_name
diff --git a/erpnext/setup/doctype/personalize/personalize.txt b/erpnext/setup/doctype/personalize/personalize.txt
deleted file mode 100644
index bd4e1a2..0000000
--- a/erpnext/setup/doctype/personalize/personalize.txt
+++ /dev/null
@@ -1,105 +0,0 @@
-# DocType, Personalize
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-03-22 16:06:53',
-		'docstatus': 0,
-		'modified': '2011-03-17 12:20:29',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': '1303277497',
-		'allow_attach': 1,
-		'allow_copy': 1,
-		'allow_email': 1,
-		'allow_print': 1,
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'document_type': 'Other',
-		'in_create': 1,
-		'issingle': 1,
-		'max_attachments': 1,
-		'module': 'Setup',
-		'name': '__common__',
-		'read_only': 1,
-		'section_style': 'Simple',
-		'version': 4
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Personalize',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# These values are common for all DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'name': '__common__',
-		'parent': 'Personalize',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'permlevel': 0,
-		'read': 1,
-		'role': 'System Manager',
-		'write': 1
-	},
-
-	# DocType, Personalize
-	{
-		'doctype': 'DocType',
-		'name': 'Personalize'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 1,
-		'label': 'Help HTML',
-		'options': '<div class="help_box">You can edit HTML for your banner or add an attachment and click on "Set from Attachment"</div>'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'header_html',
-		'fieldtype': 'Code',
-		'idx': 2,
-		'label': 'Banner HTML'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'set_from_attachment',
-		'fieldtype': 'Check',
-		'idx': 3,
-		'label': 'Set from attachment'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'file_list',
-		'fieldtype': 'Text',
-		'hidden': 1,
-		'idx': 4,
-		'label': 'File List'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/price_list/price_list.js b/erpnext/setup/doctype/price_list/price_list.js
index 173e42f..9b7f741 100644
--- a/erpnext/setup/doctype/price_list/price_list.js
+++ b/erpnext/setup/doctype/price_list/price_list.js
@@ -21,16 +21,16 @@
 
 cur_frm.cscript.refresh = function(doc, cdt, cdn) {
 	if(doc.__islocal) {
-		set_field_options('Price Help', ''); return;
+		set_field_options('price_help', ''); return;
 	}
 	if(!doc.file_list) {
-		set_field_options('Price Help', '<div class="help_box">To upload a price list, please attach a (.csv) file with 3 columns - <b>Item Code, Price and Currency</b> (no headings necessary). See attachments box in the right column</div>')
+		set_field_options('price_help', '<div class="help_box">To upload a price list, please attach a (.csv) file with 3 columns - <b>Item Code, Price and Currency</b> (no headings necessary). See attachments box in the right column</div>')
 	} else {
-		set_field_options('Price Help', '<div class="help_box">To update prices from the attachment, please click on "Update Prices"</div>')
+		set_field_options('price_help', '<div class="help_box">To update prices from the attachment, please click on "Update Prices"</div>')
 	}
 }
 
-cur_frm.cscript['Clear Prices'] = function(doc, cdt, cdn) {
+cur_frm.cscript.clear_prices = function(doc, cdt, cdn) {
 	if(confirm("This action will clear all rates for '"+ doc.name +"' from the Item Master and cannot be un-done. Are you sure you want to continue?")) {
 		$c_obj([doc], 'clear_prices', '', function(r, rt) { });
 	}
diff --git a/erpnext/setup/doctype/price_list/price_list.py b/erpnext/setup/doctype/price_list/price_list.py
index ec1a7c2..1c6959c 100644
--- a/erpnext/setup/doctype/price_list/price_list.py
+++ b/erpnext/setup/doctype/price_list/price_list.py
@@ -62,12 +62,12 @@
 				if sql("select name from tabItem where name=%s", line[0]):
 					if self.is_currency_valid(line[2]):
 						# if price exists
-						ref_ret_detail = sql("select name from `tabRef Rate Detail` where parent=%s and price_list_name=%s and ref_currency=%s", \
+						ref_ret_detail = sql("select name from `tabItem Price` where parent=%s and price_list_name=%s and ref_currency=%s", \
 							(line[0], self.doc.name, line[2]))
 						if ref_ret_detail:
-							sql("update `tabRef Rate Detail` set ref_rate=%s where name=%s", (line[1], ref_ret_detail[0][0]))
+							sql("update `tabItem Price` set ref_rate=%s where name=%s", (line[1], ref_ret_detail[0][0]))
 						else:
-							d = Document('Ref Rate Detail')
+							d = Document('Item Price')
 							d.parent = line[0]
 							d.parentfield = 'ref_rate_details'
 							d.parenttype = 'Item'
@@ -87,8 +87,8 @@
 
 	# clear prices
 	def clear_prices(self):
-		cnt = sql("select count(*) from `tabRef Rate Detail` where price_list_name = %s", self.doc.name)
-		sql("delete from `tabRef Rate Detail` where price_list_name = %s", self.doc.name)
+		cnt = sql("select count(*) from `tabItem Price` where price_list_name = %s", self.doc.name)
+		sql("delete from `tabItem Price` where price_list_name = %s", self.doc.name)
 		msgprint("%s prices cleared" % cnt[0][0])
 
 	# Update CSV data
diff --git a/erpnext/setup/doctype/price_list/price_list.txt b/erpnext/setup/doctype/price_list/price_list.txt
index 5185a63..5d7e57e 100644
--- a/erpnext/setup/doctype/price_list/price_list.txt
+++ b/erpnext/setup/doctype/price_list/price_list.txt
@@ -3,47 +3,47 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:13',
+		'creation': '2012-03-27 14:36:22',
 		'docstatus': 0,
-		'modified': '2011-04-18 10:01:48',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:22',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1303100817',
+		'_last_update': u'1303100817',
 		'allow_attach': 1,
 		'allow_trash': 1,
-		'autoname': 'field:price_list_name',
-		'colour': 'White:FFF',
+		'autoname': u'field:price_list_name',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'Setup',
+		'document_type': u'Master',
+		'module': u'Setup',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 6
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Price List',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Price List',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
 		'amend': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Price List',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Price List',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1,
 		'submit': 0
 	},
@@ -51,135 +51,127 @@
 	# DocType, Price List
 	{
 		'doctype': 'DocType',
-		'name': 'Price List'
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'permlevel': 1,
-		'role': 'Sales Manager',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'permlevel': 0,
-		'role': 'Sales Manager',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'permlevel': 1,
-		'role': 'Sales User',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 4,
-		'permlevel': 0,
-		'role': 'Sales User',
-		'write': 0
+		'name': u'Price List'
 	},
 
 	# DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 5,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Sales Master Manager',
+		'role': u'Sales Master Manager',
 		'write': 1
 	},
 
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales User',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales User',
+		'write': 0
+	},
+
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'price_list_name',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Price List Name',
-		'oldfieldname': 'price_list_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'price_list_name',
+		'fieldtype': u'Data',
+		'label': u'Price List Name',
+		'oldfieldname': u'price_list_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 3,
-		'label': 'Price Help',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'price_help',
+		'fieldtype': u'HTML',
+		'label': u'Price Help',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:!doc.__islocal',
-		'description': 'Click on this button to clear prices for this list in all items',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 4,
-		'label': 'Clear Prices',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.__islocal',
+		'description': u'Click on this button to clear prices for this list in all items',
+		'doctype': u'DocField',
+		'fieldname': u'clear_prices',
+		'fieldtype': u'Button',
+		'label': u'Clear Prices',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'file_list',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'idx': 5,
-		'label': 'File List',
+		'label': u'File List',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:!doc.__islocal',
-		'description': 'Update prices from the attachment',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 6,
-		'label': 'Update Prices',
-		'options': 'update_prices',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.__islocal',
+		'description': u'Update prices from the attachment',
+		'doctype': u'DocField',
+		'fieldname': u'update_prices',
+		'fieldtype': u'Button',
+		'label': u'Update Prices',
+		'options': u'update_prices',
 		'permlevel': 0,
-		'trigger': 'Server'
+		'trigger': u'Server'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/print_heading/print_heading.txt b/erpnext/setup/doctype/print_heading/print_heading.txt
index db4c07a..a2de331 100644
--- a/erpnext/setup/doctype/print_heading/print_heading.txt
+++ b/erpnext/setup/doctype/print_heading/print_heading.txt
@@ -3,101 +3,97 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:13',
+		'creation': '2012-03-27 14:36:22',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:22',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1294312215',
+		'_last_update': u'1294312215',
 		'allow_trash': 1,
-		'autoname': 'field:print_heading',
-		'colour': 'White:FFF',
+		'autoname': u'field:print_heading',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'Setup',
+		'document_type': u'Master',
+		'module': u'Setup',
 		'name': '__common__',
-		'search_fields': 'print_heading',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'search_fields': u'print_heading',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 27
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Print Heading',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Print Heading',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Print Heading',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Print Heading',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
-		'role': 'All',
+		'role': u'All',
 		'write': 1
 	},
 
 	# DocType, Print Heading
 	{
 		'doctype': 'DocType',
-		'name': 'Print Heading'
+		'name': u'Print Heading'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm'
+		'doctype': u'DocPerm'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'print_heading',
-		'fieldtype': 'Data',
-		'idx': 2,
+		'doctype': u'DocField',
+		'fieldname': u'print_heading',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Print Heading',
-		'oldfieldname': 'print_heading',
-		'oldfieldtype': 'Data',
+		'label': u'Print Heading',
+		'oldfieldname': u'print_heading',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Small Text',
-		'idx': 3,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Small Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 0,
-		'width': '300px'
+		'width': u'300px'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/order_lost_reason/__init__.py b/erpnext/setup/doctype/quotation_lost_reason/__init__.py
similarity index 100%
rename from erpnext/setup/doctype/order_lost_reason/__init__.py
rename to erpnext/setup/doctype/quotation_lost_reason/__init__.py
diff --git a/erpnext/setup/doctype/order_lost_reason/order_lost_reason.js b/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.js
similarity index 100%
rename from erpnext/setup/doctype/order_lost_reason/order_lost_reason.js
rename to erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.js
diff --git a/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.txt b/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.txt
new file mode 100644
index 0000000..959745a
--- /dev/null
+++ b/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.txt
@@ -0,0 +1,93 @@
+# DocType, Quotation Lost Reason
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:22',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:22',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'allow_trash': 1,
+		'autoname': u'field:order_lost_reason',
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'document_type': u'Master',
+		'module': u'Setup',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 4
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Quotation Lost Reason',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# These values are common for all DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Quotation Lost Reason',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'write': 1
+	},
+
+	# DocType, Quotation Lost Reason
+	{
+		'doctype': 'DocType',
+		'name': u'Quotation Lost Reason'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'doctype': u'DocPerm',
+		'role': u'Sales Master Manager',
+		'submit': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'order_lost_reason',
+		'fieldtype': u'Data',
+		'label': u'Quotation Lost Reason',
+		'oldfieldname': u'order_lost_reason',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'reqd': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/sales_browser_control/sales_browser_control.py b/erpnext/setup/doctype/sales_browser_control/sales_browser_control.py
index 3d820e1..76f26da 100644
--- a/erpnext/setup/doctype/sales_browser_control/sales_browser_control.py
+++ b/erpnext/setup/doctype/sales_browser_control/sales_browser_control.py
@@ -82,7 +82,7 @@
     #validation for trash of default record
     if not type == 'Sales Person':
       field = 'default_'+type.lower().replace(' ','_')
-      chk = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = '%s' and value = '%s'"%(field,name))
+      chk = sql("select value from `tabSingles` where doctype = 'Global Defaults' and field = '%s' and value = '%s'"%(field,name))
       if chk:
         msgprint("'%s' record is set as a default %s in Global Defaults. Please change default %s then try to trash '%s' record."%(name,type.lower(), type.lower(), name))
         raise Exception
diff --git a/erpnext/setup/doctype/sales_browser_control/sales_browser_control.txt b/erpnext/setup/doctype/sales_browser_control/sales_browser_control.txt
index ce635f4..3370b9e 100644
--- a/erpnext/setup/doctype/sales_browser_control/sales_browser_control.txt
+++ b/erpnext/setup/doctype/sales_browser_control/sales_browser_control.txt
@@ -3,28 +3,28 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:21',
+		'creation': '2012-03-27 14:36:23',
 		'docstatus': 0,
-		'modified': '2010-12-24 11:56:36',
-		'modified_by': 'abhishek@webnotestech.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:23',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'issingle': 1,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 159
 	},
 
 	# DocType, Sales Browser Control
 	{
 		'doctype': 'DocType',
-		'name': 'Sales Browser Control'
+		'name': u'Sales Browser Control'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.js b/erpnext/setup/doctype/sales_partner/sales_partner.js
index 1194756..92c9966 100644
--- a/erpnext/setup/doctype/sales_partner/sales_partner.js
+++ b/erpnext/setup/doctype/sales_partner/sales_partner.js
@@ -14,7 +14,7 @@
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-$import(Contact Control)
+wn.require('erpnext/setup/doctype/contact_control/contact_control.js');
 
 cur_frm.cscript.onload = function(doc,dt,dn){
 	// history doctypes and scripts
@@ -32,12 +32,12 @@
 cur_frm.cscript.refresh = function(doc,dt,dn){  
   
 	if(doc.__islocal){
-		hide_field(['Address HTML','Contact HTML']);
+		hide_field(['address_html', 'contact_html']);
 		//cur_frm.cscript.set_cl_msg(doc);
 		//cur_frm.cscript.set_hl_msg(doc);		
 	}
 	else{
-		unhide_field(['Address HTML','Contact HTML']);
+		unhide_field(['address_html', 'contact_html']);
 		// make lists
 		cur_frm.cscript.make_address(doc,dt,dn);
 		cur_frm.cscript.make_contact(doc,dt,dn);
@@ -48,18 +48,10 @@
 
 cur_frm.cscript.make_address = function() {
 	if(!cur_frm.address_list) {
-		cur_frm.address_list = new wn.widgets.Listing({
-			parent: cur_frm.fields_dict['Address HTML'].wrapper,
+		cur_frm.address_list = new wn.ui.Listing({
+			parent: cur_frm.fields_dict['address_html'].wrapper,
 			page_length: 2,
-			new_doctype: "Address",
-			new_doc_onload: function(dn) {
-				ndoc = locals["Address"][dn];
-				ndoc.sales_partner = cur_frm.doc.name;
-				ndoc.address_type = 'Office';				
-			},
-			new_doc_onsave: function(dn) {				
-				cur_frm.address_list.run()
-			},			
+			new_doctype: "Address",			
 			get_query: function() {
 				return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where sales_partner='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
 			},
@@ -80,17 +72,10 @@
 
 cur_frm.cscript.make_contact = function() {
 	if(!cur_frm.contact_list) {
-		cur_frm.contact_list = new wn.widgets.Listing({
-			parent: cur_frm.fields_dict['Contact HTML'].wrapper,
+		cur_frm.contact_list = new wn.ui.Listing({
+			parent: cur_frm.fields_dict['contact_html'].wrapper,
 			page_length: 2,
 			new_doctype: "Contact",
-			new_doc_onload: function(dn) {
-				ndoc = locals["Contact"][dn];
-				ndoc.sales_partner = cur_frm.doc.name;				
-			},
-			new_doc_onsave: function(dn) {				
-				cur_frm.contact_list.run()
-			},
 			get_query: function() {
 				return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where sales_partner='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
 			},
@@ -153,12 +138,12 @@
 	lst.colwidths = ['5%','25%','20%','25%','25%'];
 	lst.colnames = ['Sr.','Id','Invoice Date','Total Commission','Grand Total'];
 	lst.coltypes = ['Data','Link','Data','Data','Currency','Currency'];
-	lst.coloptions = ['','Receivable Voucher','','','',''];
+	lst.coloptions = ['','Sales Invoice','','','',''];
 
 	cur_frm.cscript.set_list_opts(lst);
 
-	var q = repl("select name,posting_date, total_commission,grand_total from `tabReceivable Voucher` where sales_partner='%(sp)s'", {'sp':doc.name});
-	var q_max = repl("select count(name) from `tabReceivable Voucher` where sales_partner='%(cust)s'", {'sp':doc.name});
+	var q = repl("select name,posting_date, total_commission,grand_total from `tabSales Invoice` where sales_partner='%(sp)s'", {'sp':doc.name});
+	var q_max = repl("select count(name) from `tabSales Invoice` where sales_partner='%(cust)s'", {'sp':doc.name});
 	
-	cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Sales Invoice','Receivable Voucher');	
+	cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Sales Invoice','Sales Invoice');	
 }
diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.txt b/erpnext/setup/doctype/sales_partner/sales_partner.txt
index b030b34..0aa2de7 100644
--- a/erpnext/setup/doctype/sales_partner/sales_partner.txt
+++ b/erpnext/setup/doctype/sales_partner/sales_partner.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:22',
+		'creation': '2012-03-27 14:36:23',
 		'docstatus': 0,
-		'modified': '2012-03-21 14:53:54',
+		'modified': '2012-03-27 18:49:33',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -26,7 +26,7 @@
 		'section_style': u'Tabbed',
 		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'version': 73
+		'version': 74
 	},
 
 	# These values are common for all DocField
@@ -57,6 +57,49 @@
 	# DocPerm
 	{
 		'amend': 0,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales Master Manager',
+		'submit': 0,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales Master Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'System Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'System Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
 		'cancel': 0,
 		'create': 0,
 		'doctype': u'DocPerm',
@@ -102,54 +145,12 @@
 		'write': 0
 	},
 
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Sales Master Manager',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Sales Master Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'System Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'System Manager',
-		'write': 0
-	},
-
 	# DocField
 	{
 		'colour': u'White:FFF',
 		'description': u'Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts',
 		'doctype': u'DocField',
+		'fieldname': u'basic_info',
 		'fieldtype': u'Section Break',
 		'label': u'Basic Info',
 		'oldfieldtype': u'Section Break',
@@ -187,6 +188,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -219,6 +221,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'address_contacts',
 		'fieldtype': u'Section Break',
 		'label': u'Address & Contacts',
 		'permlevel': 0
@@ -229,6 +232,7 @@
 		'colour': u'White:FFF',
 		'depends_on': u'eval:doc.__islocal',
 		'doctype': u'DocField',
+		'fieldname': u'address_desc',
 		'fieldtype': u'HTML',
 		'label': u'Address Desc',
 		'options': u'<em>Addresses will appear only when you save the customer</em>',
@@ -238,6 +242,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'address_html',
 		'fieldtype': u'HTML',
 		'label': u'Address HTML',
 		'permlevel': 1
@@ -246,6 +251,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break1',
 		'fieldtype': u'Column Break',
 		'permlevel': 0
 	},
@@ -255,6 +261,7 @@
 		'colour': u'White:FFF',
 		'depends_on': u'eval:doc.__islocal',
 		'doctype': u'DocField',
+		'fieldname': u'contact_desc',
 		'fieldtype': u'HTML',
 		'label': u'Contact Desc',
 		'options': u'<em>Contact Details will appear only when you save the customer</em>',
@@ -264,6 +271,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'contact_html',
 		'fieldtype': u'HTML',
 		'label': u'Contact HTML',
 		'permlevel': 1
@@ -272,6 +280,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'partner_target_details_section_break',
 		'fieldtype': u'Section Break',
 		'label': u'Partner Target Details',
 		'oldfieldtype': u'Section Break',
@@ -306,6 +315,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'manage_html',
 		'fieldtype': u'HTML',
 		'hidden': 1,
 		'label': u'Manage HTML',
@@ -319,6 +329,7 @@
 		'colour': u'White:FFF',
 		'depends_on': u'eval:!doc.__islocal',
 		'doctype': u'DocField',
+		'fieldname': u'transaction_history',
 		'fieldtype': u'Section Break',
 		'label': u'Transaction History',
 		'oldfieldtype': u'Section Break',
@@ -328,6 +339,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'history_html',
 		'fieldtype': u'HTML',
 		'label': u'History HTML',
 		'oldfieldtype': u'HTML',
diff --git a/erpnext/setup/doctype/sales_person/sales_person.txt b/erpnext/setup/doctype/sales_person/sales_person.txt
index 9ae96bf..45769e1 100644
--- a/erpnext/setup/doctype/sales_person/sales_person.txt
+++ b/erpnext/setup/doctype/sales_person/sales_person.txt
@@ -3,48 +3,48 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:22',
+		'creation': '2012-03-27 14:36:23',
 		'docstatus': 0,
-		'modified': '2011-02-23 15:11:46',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 18:49:47',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1302765705',
+		'_last_update': u'1302765705',
 		'allow_trash': 1,
-		'autoname': 'field:sales_person_name',
-		'colour': 'White:FFF',
+		'autoname': u'field:sales_person_name',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
+		'document_type': u'Master',
 		'in_create': 1,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
-		'search_fields': 'name,parent_sales_person',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'search_fields': u'name,parent_sales_person',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'version': 131
+		'version': 132
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Sales Person',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Sales Person',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
 		'amend': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Sales Person',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Sales Person',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1,
 		'submit': 0
 	},
@@ -52,61 +52,16 @@
 	# DocType, Sales Person
 	{
 		'doctype': 'DocType',
-		'name': 'Sales Person'
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'permlevel': 1,
-		'role': 'Sales Manager',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'permlevel': 0,
-		'role': 'Sales Manager',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'permlevel': 1,
-		'role': 'Sales User',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 4,
-		'permlevel': 0,
-		'role': 'Sales User',
-		'write': 0
+		'name': u'Sales Person'
 	},
 
 	# DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 5,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Sales Master Manager',
+		'role': u'Sales Master Manager',
 		'write': 1
 	},
 
@@ -114,46 +69,83 @@
 	{
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 6,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Sales Master Manager',
+		'role': u'Sales Master Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales User',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales User',
 		'write': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 2,
-		'label': 'General Info',
-		'oldfieldtype': 'Section Break',
-		'options': 'Simple',
+		'doctype': u'DocField',
+		'fieldname': u'general_info',
+		'fieldtype': u'Section Break',
+		'label': u'General Info',
+		'oldfieldtype': u'Section Break',
+		'options': u'Simple',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'sales_person_name',
-		'fieldtype': 'Data',
-		'idx': 3,
+		'doctype': u'DocField',
+		'fieldname': u'sales_person_name',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Sales Person Name',
-		'oldfieldname': 'sales_person_name',
-		'oldfieldtype': 'Data',
+		'label': u'Sales Person Name',
+		'oldfieldname': u'sales_person_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 0
@@ -161,196 +153,184 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Select company name first.',
-		'doctype': 'DocField',
-		'fieldname': 'parent_sales_person',
-		'fieldtype': 'Link',
-		'idx': 4,
-		'label': 'Parent Sales Person',
-		'oldfieldname': 'parent_sales_person',
-		'oldfieldtype': 'Link',
-		'options': 'Sales Person',
+		'colour': u'White:FFF',
+		'description': u'Select company name first.',
+		'doctype': u'DocField',
+		'fieldname': u'parent_sales_person',
+		'fieldtype': u'Link',
+		'label': u'Parent Sales Person',
+		'oldfieldname': u'parent_sales_person',
+		'oldfieldtype': u'Link',
+		'options': u'Sales Person',
 		'permlevel': 0,
 		'reqd': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 5,
-		'label': 'SPHelp',
-		'oldfieldtype': 'HTML',
-		'options': '<a href="#!Sales Browser/Sales Person">To manage Sales Person, click here</a>',
+		'doctype': u'DocField',
+		'fieldname': u'sphelp',
+		'fieldtype': u'HTML',
+		'label': u'SPHelp',
+		'oldfieldtype': u'HTML',
+		'options': u'<a href="#!Sales Browser/Sales Person">To manage Sales Person, click here</a>',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'is_group',
-		'fieldtype': 'Select',
-		'idx': 6,
-		'label': 'Has Child Node',
-		'oldfieldname': 'is_group',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'doctype': u'DocField',
+		'fieldname': u'is_group',
+		'fieldtype': u'Select',
+		'label': u'Has Child Node',
+		'oldfieldname': u'is_group',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'employee',
-		'fieldtype': 'Link',
-		'idx': 7,
-		'label': 'Employee',
-		'options': 'Employee',
+		'doctype': u'DocField',
+		'fieldname': u'employee',
+		'fieldtype': u'Link',
+		'label': u'Employee',
+		'options': u'Employee',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'department',
-		'fieldtype': 'Data',
-		'idx': 8,
-		'label': 'Department',
-		'oldfieldname': 'department',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'department',
+		'fieldtype': u'Data',
+		'label': u'Department',
+		'oldfieldname': u'department',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'designation',
-		'fieldtype': 'Data',
-		'idx': 9,
-		'label': 'Designation',
-		'oldfieldname': 'designation',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'designation',
+		'fieldtype': u'Data',
+		'label': u'Designation',
+		'oldfieldname': u'designation',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'mobile_no',
-		'fieldtype': 'Data',
-		'idx': 10,
-		'label': 'Mobile No',
-		'oldfieldname': 'mobile_no',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'mobile_no',
+		'fieldtype': u'Data',
+		'label': u'Mobile No',
+		'oldfieldname': u'mobile_no',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 11,
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'email_id',
-		'fieldtype': 'Data',
-		'idx': 12,
-		'label': 'Email Id',
-		'oldfieldname': 'email_id',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'email_id',
+		'fieldtype': u'Data',
+		'label': u'Email Id',
+		'oldfieldname': u'email_id',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'country',
-		'fieldtype': 'Select',
-		'idx': 13,
+		'doctype': u'DocField',
+		'fieldname': u'country',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Country',
-		'oldfieldname': 'country',
-		'oldfieldtype': 'Select',
-		'options': 'link:Country',
+		'label': u'Country',
+		'oldfieldname': u'country',
+		'oldfieldtype': u'Select',
+		'options': u'link:Country',
 		'permlevel': 0,
 		'search_index': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'state',
-		'fieldtype': 'Select',
-		'idx': 14,
+		'doctype': u'DocField',
+		'fieldname': u'state',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'State',
-		'oldfieldname': 'state',
-		'oldfieldtype': 'Select',
-		'options': 'link:State',
+		'label': u'State',
+		'oldfieldname': u'state',
+		'oldfieldtype': u'Select',
+		'options': u'link:State',
 		'permlevel': 0,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'city',
-		'fieldtype': 'Data',
-		'idx': 15,
-		'label': 'City',
-		'oldfieldname': 'city',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'city',
+		'fieldtype': u'Data',
+		'label': u'City',
+		'oldfieldname': u'city',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'territory',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'territory',
+		'fieldtype': u'Link',
 		'hidden': 0,
-		'idx': 16,
-		'label': 'Territory',
-		'oldfieldname': 'territory',
-		'oldfieldtype': 'Link',
-		'options': 'Territory',
+		'label': u'Territory',
+		'oldfieldname': u'territory',
+		'oldfieldtype': u'Link',
+		'options': u'Territory',
 		'permlevel': 0,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 17,
-		'label': 'Territory Help',
-		'oldfieldtype': 'HTML',
-		'options': '<a href="javascript:cur_frm.cscript.TreePage(\'Territory\');">To manage Territory, click here</a>',
+		'doctype': u'DocField',
+		'fieldname': u'territory_help',
+		'fieldtype': u'HTML',
+		'label': u'Territory Help',
+		'oldfieldtype': u'HTML',
+		'options': u'<a href="javascript:cur_frm.cscript.TreePage(\'Territory\');">To manage Territory, click here</a>',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'lft',
-		'fieldtype': 'Int',
+		'doctype': u'DocField',
+		'fieldname': u'lft',
+		'fieldtype': u'Int',
 		'hidden': 1,
-		'idx': 18,
 		'in_filter': 1,
-		'label': 'lft',
+		'label': u'lft',
 		'no_copy': 1,
-		'oldfieldname': 'lft',
-		'oldfieldtype': 'Int',
+		'oldfieldname': u'lft',
+		'oldfieldtype': u'Int',
 		'permlevel': 0,
 		'print_hide': 1,
 		'search_index': 1
@@ -358,16 +338,15 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'rgt',
-		'fieldtype': 'Int',
+		'doctype': u'DocField',
+		'fieldname': u'rgt',
+		'fieldtype': u'Int',
 		'hidden': 1,
-		'idx': 19,
 		'in_filter': 1,
-		'label': 'rgt',
+		'label': u'rgt',
 		'no_copy': 1,
-		'oldfieldname': 'rgt',
-		'oldfieldtype': 'Int',
+		'oldfieldname': u'rgt',
+		'oldfieldtype': u'Int',
 		'permlevel': 0,
 		'print_hide': 1,
 		'search_index': 1
@@ -375,54 +354,51 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'old_parent',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'old_parent',
+		'fieldtype': u'Data',
 		'hidden': 1,
-		'idx': 20,
-		'label': 'old_parent',
+		'label': u'old_parent',
 		'no_copy': 1,
-		'oldfieldname': 'old_parent',
-		'oldfieldtype': 'Data',
+		'oldfieldname': u'old_parent',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'distribution_id',
-		'fieldtype': 'Link',
-		'idx': 21,
-		'label': 'Distribution Id',
-		'oldfieldname': 'distribution_id',
-		'oldfieldtype': 'Link',
-		'options': 'Budget Distribution',
+		'doctype': u'DocField',
+		'fieldname': u'distribution_id',
+		'fieldtype': u'Link',
+		'label': u'Distribution Id',
+		'oldfieldname': u'distribution_id',
+		'oldfieldtype': u'Link',
+		'options': u'Budget Distribution',
 		'permlevel': 0,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 22,
-		'label': 'Target Details',
-		'oldfieldtype': 'Section Break',
-		'options': 'Simple',
+		'doctype': u'DocField',
+		'fieldname': u'target_details_section_break',
+		'fieldtype': u'Section Break',
+		'label': u'Target Details',
+		'oldfieldtype': u'Section Break',
+		'options': u'Simple',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'target_details',
-		'fieldtype': 'Table',
-		'idx': 23,
-		'label': 'Target Details1',
-		'oldfieldname': 'target_details',
-		'oldfieldtype': 'Table',
-		'options': 'Target Detail',
+		'doctype': u'DocField',
+		'fieldname': u'target_details',
+		'fieldtype': u'Table',
+		'label': u'Target Details1',
+		'oldfieldname': u'target_details',
+		'oldfieldtype': u'Table',
+		'options': u'Target Detail',
 		'permlevel': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/series_detail/series_detail.txt b/erpnext/setup/doctype/series_detail/series_detail.txt
index a6df55d..f7411c5 100644
--- a/erpnext/setup/doctype/series_detail/series_detail.txt
+++ b/erpnext/setup/doctype/series_detail/series_detail.txt
@@ -3,61 +3,59 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-07-08 13:20:10',
+		'creation': '2012-03-27 14:36:25',
 		'docstatus': 0,
-		'modified': '2011-07-08 13:20:34',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:25',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
-		'section_style': 'Tray',
+		'section_style': u'Tray',
 		'show_in_menu': 0,
 		'version': 3
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Series Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Series Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# DocType, Series Detail
 	{
 		'doctype': 'DocType',
-		'name': 'Series Detail'
+		'name': u'Series Detail'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'series',
-		'fieldtype': 'Read Only',
-		'idx': 1,
-		'label': 'Series',
-		'oldfieldname': 'series',
-		'oldfieldtype': 'Read Only'
+		'doctype': u'DocField',
+		'fieldname': u'series',
+		'fieldtype': u'Read Only',
+		'label': u'Series',
+		'oldfieldname': u'series',
+		'oldfieldtype': u'Read Only'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'remove',
-		'fieldtype': 'Check',
-		'idx': 2,
-		'label': 'Remove',
-		'oldfieldname': 'remove',
-		'oldfieldtype': 'Check',
-		'trigger': 'Client'
+		'doctype': u'DocField',
+		'fieldname': u'remove',
+		'fieldtype': u'Check',
+		'label': u'Remove',
+		'oldfieldname': u'remove',
+		'oldfieldtype': u'Check',
+		'trigger': u'Client'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/setup_control/setup_control.py b/erpnext/setup/doctype/setup_control/setup_control.py
index 50b9bb0..ba39358 100644
--- a/erpnext/setup/doctype/setup_control/setup_control.py
+++ b/erpnext/setup/doctype/setup_control/setup_control.py
@@ -30,7 +30,7 @@
 	#Default Naming Series
 	#---------------------------------------------------
 	def naming_series(self):
-		ns = [['TDS Payment', 'TDSP'], ['Payable Voucher', 'BILL'], ['Journal Voucher', 'JV'], ['Receivable Voucher', 'INV'], ['Lead', 'Lead'], ['Indent', 'IDT'], ['Enquiry', 'Enquiry'], ['Purchase Order', 'PO'], ['Quotation', 'QTN'], ['Purchase Receipt', 'GRN'], ['Stock Entry', 'STE'], ['Sales Order', 'SO'], ['Delivery Note', 'DN'], ['Employee', 'EMP/']]
+		ns = [['TDS Payment', 'TDSP'], ['Purchase Invoice', 'BILL'], ['Journal Voucher', 'JV'], ['Sales Invoice', 'INV'], ['Lead', 'Lead'], ['Purchase Request', 'IDT'], ['Opportunity', 'Opportunity'], ['Purchase Order', 'PO'], ['Quotation', 'QTN'], ['Purchase Receipt', 'GRN'], ['Stock Entry', 'STE'], ['Sales Order', 'SO'], ['Delivery Note', 'DN'], ['Employee', 'EMP/']]
 		for r in ns: 
 			rec = Document('Naming Series')
 			rec.select_doc_for_series = r[0]
@@ -131,25 +131,25 @@
 	def create_feed_and_todo(self):
 		"""update activty feed and create todo for creation of item, customer, vendor"""
 		import home
-		home.make_feed('Comment', 'ToDo Item', '', webnotes.session['user'],
+		home.make_feed('Comment', 'ToDo', '', webnotes.session['user'],
 			'<i>"' + 'Setup Complete. Please check your <a href="#!todo">\
 			To Do List</a>' + '"</i>', '#6B24B3')
 
-		d = Document('ToDo Item')
+		d = Document('ToDo')
 		d.description = 'Create your first Customer'
 		d.priority = 'High'
 		d.date = nowdate()
 		d.reference_type = 'Customer'
 		d.save(1)
 
-		d = Document('ToDo Item')
+		d = Document('ToDo')
 		d.description = 'Create your first Item'
 		d.priority = 'High'
 		d.date = nowdate()
 		d.reference_type = 'Item'
 		d.save(1)
 
-		d = Document('ToDo Item')
+		d = Document('ToDo')
 		d.description = 'Create your first Supplier'
 		d.priority = 'High'
 		d.date = nowdate()
@@ -195,7 +195,7 @@
 	# Set System Defaults
 	# --------------------
 	def set_defaults(self, def_args):
-		ma_obj = get_obj('Manage Account','Manage Account')
+		ma_obj = get_obj('Global Defaults','Global Defaults')
 		for d in def_args.keys():
 			ma_obj.doc.fields[d] = def_args[d]
 		ma_obj.doc.save()
diff --git a/erpnext/setup/doctype/setup_control/setup_control.txt b/erpnext/setup/doctype/setup_control/setup_control.txt
index 5ded66b..58ad5f3 100644
--- a/erpnext/setup/doctype/setup_control/setup_control.txt
+++ b/erpnext/setup/doctype/setup_control/setup_control.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:24',
+		'creation': '2012-03-27 14:36:25',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'yogesh@webnotestech.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:25',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'in_create': 1,
 		'issingle': 1,
 		'istable': 0,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
 		'read_only': 1,
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 73
 	},
 
 	# DocType, Setup Control
 	{
 		'doctype': 'DocType',
-		'name': 'Setup Control'
+		'name': u'Setup Control'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/setup_wizard_control/__init__.py b/erpnext/setup/doctype/setup_wizard_control/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/setup/doctype/setup_wizard_control/__init__.py
+++ /dev/null
diff --git a/erpnext/setup/doctype/setup_wizard_control/setup_wizard_control.py b/erpnext/setup/doctype/setup_wizard_control/setup_wizard_control.py
deleted file mode 100644
index ec54f54..0000000
--- a/erpnext/setup/doctype/setup_wizard_control/setup_wizard_control.py
+++ /dev/null
@@ -1,73 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-sql = webnotes.conn.sql
-convert_to_lists = webnotes.conn.convert_to_lists
-	
-# -----------------------------------------------------------------------------------------
-
-
-class DocType:
-
-  def __init__(self, doc, doclist=[]):
-    self.doc = doc
-    self.doclist = doclist
-  #=======================================================================================================
-  def get_master_lists(self):
-    ret = convert_to_lists(sql("select name from `tabWarehouse Type`"))
-    ret = ret and ret or []
-    return ret
-      
-  #=======================================================================================================
-  def create_record(self,dict_val):
-    obj_dict = eval(dict_val)
-    
-    for d in obj_dict:
-      if not obj_dict[d] == '' and not d =='Doctype':
-        
-        ret =sql("select name from `tab%s` where name = '%s'" %(obj_dict['Doctype'],obj_dict[d]))
-        if ret:
-          return "Record already exist."
-          raise Exception
-        rec = Document(obj_dict['Doctype'])
-    for i in obj_dict:
-      if not obj_dict[i] == '' and not i == 'Doctype':
-        rec.fields[i] = obj_dict[i]
-      
-    rec.save(1)
-    return "Record created."
-
-  #=======================================================================================================
-  def get_page_lst(self,nm):
-    ret = sql("select parent from `tabPage Role` where role in ('%s') and parent = '%s'" % ("','".join(webnotes.user.get_roles()),nm))
-    return ret and True or False
-    
-  #=======================================================================================================
-  #------------------------get contry--------------------------------
-  def get_country(self):
-    cty = sql("select value from `tabSingles` where field = 'country' and doctype = 'Control Panel'")
-
-    return cty and cty[0][0] or ''
diff --git a/erpnext/setup/doctype/setup_wizard_control/setup_wizard_control.txt b/erpnext/setup/doctype/setup_wizard_control/setup_wizard_control.txt
deleted file mode 100644
index 5f432ad..0000000
--- a/erpnext/setup/doctype/setup_wizard_control/setup_wizard_control.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-# DocType, Setup Wizard Control
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:24',
-		'docstatus': 0,
-		'modified': '2011-07-04 17:10:23',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'issingle': 1,
-		'module': 'Setup',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 110
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'name': '__common__',
-		'parent': 'Setup Wizard Control',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'permlevel': 0,
-		'read': 1,
-		'role': 'All',
-		'write': 1
-	},
-
-	# DocType, Setup Wizard Control
-	{
-		'doctype': 'DocType',
-		'name': 'Setup Wizard Control'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/manage_account/__init__.py b/erpnext/setup/doctype/sms_parameter/__init__.py
old mode 100644
new mode 100755
similarity index 100%
rename from erpnext/setup/doctype/manage_account/__init__.py
rename to erpnext/setup/doctype/sms_parameter/__init__.py
diff --git a/erpnext/setup/doctype/sms_parameter/sms_parameter.txt b/erpnext/setup/doctype/sms_parameter/sms_parameter.txt
new file mode 100755
index 0000000..fd6a225
--- /dev/null
+++ b/erpnext/setup/doctype/sms_parameter/sms_parameter.txt
@@ -0,0 +1,57 @@
+# DocType, SMS Parameter
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:25',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:25',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Setup',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'show_in_menu': 0,
+		'version': 4
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'fieldtype': u'Data',
+		'name': '__common__',
+		'parent': u'SMS Parameter',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0,
+		'reqd': 1,
+		'width': u'150px'
+	},
+
+	# DocType, SMS Parameter
+	{
+		'doctype': 'DocType',
+		'name': u'SMS Parameter'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'parameter',
+		'label': u'Parameter'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'value',
+		'label': u'Value'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/sms_settings/sms_settings.txt b/erpnext/setup/doctype/sms_settings/sms_settings.txt
index f4bddd6..e54f436 100755
--- a/erpnext/setup/doctype/sms_settings/sms_settings.txt
+++ b/erpnext/setup/doctype/sms_settings/sms_settings.txt
@@ -3,137 +3,131 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-05-24 18:21:16',
+		'creation': '2012-03-27 14:36:25',
 		'docstatus': 0,
-		'modified': '2011-05-25 11:59:34',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:25',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1306304974',
+		'_last_update': u'1306304974',
 		'allow_copy': 1,
 		'allow_email': 1,
 		'allow_print': 1,
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'in_create': 0,
 		'issingle': 1,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
 		'read_only': 0,
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
 		'version': 16
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'SMS Settings',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'SMS Settings',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'SMS Settings',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'SMS Settings',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1,
-		'role': 'System Manager'
+		'role': u'System Manager'
 	},
 
 	# DocType, SMS Settings
 	{
 		'doctype': 'DocType',
-		'name': 'SMS Settings'
+		'name': u'SMS Settings'
 	},
 
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
+		'doctype': u'DocPerm',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 1,
-		'width': '50%'
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Eg. smsgateway.com/api/send_sms.cgi',
-		'doctype': 'DocField',
-		'fieldname': 'sms_gateway_url',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'SMS Gateway URL',
+		'colour': u'White:FFF',
+		'description': u'Eg. smsgateway.com/api/send_sms.cgi',
+		'doctype': u'DocField',
+		'fieldname': u'sms_gateway_url',
+		'fieldtype': u'Data',
+		'label': u'SMS Gateway URL',
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Enter url parameter for message',
-		'doctype': 'DocField',
-		'fieldname': 'message_parameter',
-		'fieldtype': 'Data',
-		'idx': 3,
-		'label': 'Message Parameter',
+		'colour': u'White:FFF',
+		'description': u'Enter url parameter for message',
+		'doctype': u'DocField',
+		'fieldname': u'message_parameter',
+		'fieldtype': u'Data',
+		'label': u'Message Parameter',
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Enter url parameter for receiver nos',
-		'doctype': 'DocField',
-		'fieldname': 'receiver_parameter',
-		'fieldtype': 'Data',
-		'idx': 4,
-		'label': 'Receiver Parameter',
+		'colour': u'White:FFF',
+		'description': u'Enter url parameter for receiver nos',
+		'doctype': u'DocField',
+		'fieldname': u'receiver_parameter',
+		'fieldtype': u'Data',
+		'label': u'Receiver Parameter',
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 5,
-		'label': 'Static Parameters',
-		'width': '50%'
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'static_parameters',
+		'fieldtype': u'Column Break',
+		'label': u'Static Parameters',
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Enter static url parameters here (Eg. sender=ERPNext, username=ERPNext, password=1234 etc.)',
-		'doctype': 'DocField',
-		'fieldname': 'static_parameter_details',
-		'fieldtype': 'Table',
-		'idx': 6,
-		'label': 'Static Parameter Details',
-		'options': 'Static Parameter Detail'
+		'colour': u'White:FFF',
+		'description': u'Enter static url parameters here (Eg. sender=ERPNext, username=ERPNext, password=1234 etc.)',
+		'doctype': u'DocField',
+		'fieldname': u'static_parameter_details',
+		'fieldtype': u'Table',
+		'label': u'SMS Parameters',
+		'options': u'SMS Parameter'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/state/state.txt b/erpnext/setup/doctype/state/state.txt
index 09e186b..b07bb67 100644
--- a/erpnext/setup/doctype/state/state.txt
+++ b/erpnext/setup/doctype/state/state.txt
@@ -3,36 +3,36 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:25',
+		'creation': '2012-03-27 14:36:25',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:25',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'autoname': 'field:state_name',
-		'colour': 'White:FFF',
+		'autoname': u'field:state_name',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
+		'document_type': u'Master',
 		'in_create': 0,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
 		'read_only': 0,
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 14
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'State',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'State',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'reqd': 1
 	},
@@ -40,11 +40,11 @@
 	# These values are common for all DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'State',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'State',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
 		'write': 1
@@ -53,53 +53,48 @@
 	# DocType, State
 	{
 		'doctype': 'DocType',
-		'name': 'State'
+		'name': u'State'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'System Manager'
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
 	},
 
 	# DocPerm
 	{
 		'amend': 0,
 		'cancel': 0,
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'Sales Master Manager',
+		'doctype': u'DocPerm',
+		'role': u'Sales Master Manager',
 		'submit': 0
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'role': 'Purchase Master Manager'
+		'doctype': u'DocPerm',
+		'role': u'Purchase Master Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'state_name',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'label': 'State Name',
-		'oldfieldname': 'state_name',
-		'oldfieldtype': 'Data'
+		'doctype': u'DocField',
+		'fieldname': u'state_name',
+		'fieldtype': u'Data',
+		'label': u'State Name',
+		'oldfieldname': u'state_name',
+		'oldfieldtype': u'Data'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'country',
-		'fieldtype': 'Select',
-		'idx': 2,
-		'label': 'Country',
-		'oldfieldname': 'country',
-		'oldfieldtype': 'Select',
-		'options': 'link:Country'
+		'doctype': u'DocField',
+		'fieldname': u'country',
+		'fieldtype': u'Select',
+		'label': u'Country',
+		'oldfieldname': u'country',
+		'oldfieldtype': u'Select',
+		'options': u'link:Country'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/static_parameter_detail/__init__.py b/erpnext/setup/doctype/static_parameter_detail/__init__.py
deleted file mode 100755
index e69de29..0000000
--- a/erpnext/setup/doctype/static_parameter_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/setup/doctype/static_parameter_detail/static_parameter_detail.txt b/erpnext/setup/doctype/static_parameter_detail/static_parameter_detail.txt
deleted file mode 100755
index 587a716..0000000
--- a/erpnext/setup/doctype/static_parameter_detail/static_parameter_detail.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-# DocType, Static Parameter Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-05-24 18:22:22',
-		'docstatus': 0,
-		'modified': '2011-05-24 18:42:30',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Setup',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'show_in_menu': 0,
-		'version': 4
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Data',
-		'name': '__common__',
-		'parent': 'Static Parameter Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0,
-		'reqd': 1,
-		'width': '150px'
-	},
-
-	# DocType, Static Parameter Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Static Parameter Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'parameter',
-		'idx': 1,
-		'label': 'Parameter'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'value',
-		'idx': 2,
-		'label': 'Value'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/supplier_type/supplier_type.txt b/erpnext/setup/doctype/supplier_type/supplier_type.txt
index e608e6c..41f76e2 100644
--- a/erpnext/setup/doctype/supplier_type/supplier_type.txt
+++ b/erpnext/setup/doctype/supplier_type/supplier_type.txt
@@ -3,45 +3,45 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:26',
+		'creation': '2012-03-27 14:36:25',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'yogesh@webnotestech.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:25',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
 		'allow_trash': 1,
-		'autoname': 'field:supplier_type',
-		'colour': 'White:FFF',
+		'autoname': u'field:supplier_type',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'Setup',
+		'document_type': u'Master',
+		'module': u'Setup',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 3
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Supplier Type',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Supplier Type',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
 		'amend': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Supplier Type',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Supplier Type',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1,
 		'submit': 0
 	},
@@ -49,85 +49,78 @@
 	# DocType, Supplier Type
 	{
 		'doctype': 'DocType',
-		'name': 'Supplier Type'
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'permlevel': 1,
-		'role': 'Purchase Manager',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'permlevel': 0,
-		'role': 'Purchase Manager',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'permlevel': 1,
-		'role': 'Purchase User',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 4,
-		'permlevel': 0,
-		'role': 'Purchase User',
-		'write': 0
+		'name': u'Supplier Type'
 	},
 
 	# DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 5,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Purchase Master Manager',
+		'role': u'Purchase Master Manager',
 		'write': 1
 	},
 
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Purchase Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Purchase Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Purchase User',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Purchase User',
+		'write': 0
+	},
+
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'supplier_type',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Supplier Type',
-		'oldfieldname': 'supplier_type',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'supplier_type',
+		'fieldtype': u'Data',
+		'label': u'Supplier Type',
+		'oldfieldname': u'supplier_type',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	}
diff --git a/erpnext/setup/doctype/target_detail/target_detail.txt b/erpnext/setup/doctype/target_detail/target_detail.txt
index 43f1d6e..171f443 100644
--- a/erpnext/setup/doctype/target_detail/target_detail.txt
+++ b/erpnext/setup/doctype/target_detail/target_detail.txt
@@ -3,93 +3,89 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:26',
+		'creation': '2012-03-27 14:36:25',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'abhishek@webnotestech.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:25',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 15
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Target Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Target Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# DocType, Target Detail
 	{
 		'doctype': 'DocType',
-		'name': 'Target Detail'
+		'name': u'Target Detail'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'item_group',
-		'fieldtype': 'Link',
-		'idx': 1,
+		'doctype': u'DocField',
+		'fieldname': u'item_group',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Item Group',
-		'oldfieldname': 'item_group',
-		'oldfieldtype': 'Link',
-		'options': 'Item Group',
+		'label': u'Item Group',
+		'oldfieldname': u'item_group',
+		'oldfieldtype': u'Link',
+		'options': u'Item Group',
 		'reqd': 0,
 		'search_index': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Select',
-		'idx': 2,
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Fiscal Year',
-		'oldfieldname': 'fiscal_year',
-		'oldfieldtype': 'Select',
-		'options': 'link:Fiscal Year',
+		'label': u'Fiscal Year',
+		'oldfieldname': u'fiscal_year',
+		'oldfieldtype': u'Select',
+		'options': u'link:Fiscal Year',
 		'reqd': 1,
 		'search_index': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'target_qty',
-		'fieldtype': 'Currency',
-		'idx': 3,
-		'label': 'Target Qty',
-		'oldfieldname': 'target_qty',
-		'oldfieldtype': 'Currency'
+		'doctype': u'DocField',
+		'fieldname': u'target_qty',
+		'fieldtype': u'Currency',
+		'label': u'Target Qty',
+		'oldfieldname': u'target_qty',
+		'oldfieldtype': u'Currency'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'target_amount',
-		'fieldtype': 'Currency',
-		'idx': 4,
+		'doctype': u'DocField',
+		'fieldname': u'target_amount',
+		'fieldtype': u'Currency',
 		'in_filter': 1,
-		'label': 'Target  Amount',
-		'oldfieldname': 'target_amount',
-		'oldfieldtype': 'Currency',
+		'label': u'Target  Amount',
+		'oldfieldname': u'target_amount',
+		'oldfieldtype': u'Currency',
 		'reqd': 0,
 		'search_index': 1
 	}
diff --git a/erpnext/setup/doctype/term/term.txt b/erpnext/setup/doctype/term/term.txt
deleted file mode 100644
index 5adae34..0000000
--- a/erpnext/setup/doctype/term/term.txt
+++ /dev/null
@@ -1,165 +0,0 @@
-# DocType, Term
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:27',
-		'docstatus': 0,
-		'modified': '2012-03-21 14:54:12',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': u'1322549700',
-		'allow_trash': 1,
-		'autoname': u'field:title',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'document_type': u'Master',
-		'module': u'Setup',
-		'name': '__common__',
-		'section_style': u'Simple',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 11
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Term',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': u'DocPerm',
-		'name': '__common__',
-		'parent': u'Term',
-		'parentfield': u'permissions',
-		'parenttype': u'DocType',
-		'read': 1
-	},
-
-	# DocType, Term
-	{
-		'doctype': 'DocType',
-		'name': u'Term'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Sales Master Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Sales Master Manager',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Sales User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Sales User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'All'
-	},
-
-	# DocPerm
-	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'System Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Accounts User',
-		'write': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'trash_reason',
-		'fieldtype': u'Small Text',
-		'label': u'Trash Reason',
-		'oldfieldname': u'trash_reason',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'title',
-		'fieldtype': u'Data',
-		'in_filter': 1,
-		'label': u'Title',
-		'oldfieldname': u'title',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'terms',
-		'fieldtype': u'Text Editor',
-		'label': u'Terms',
-		'oldfieldname': u'terms',
-		'oldfieldtype': u'Text Editor',
-		'permlevel': 0
-	}
-]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/term/__init__.py b/erpnext/setup/doctype/terms_and_conditions/__init__.py
similarity index 100%
rename from erpnext/setup/doctype/term/__init__.py
rename to erpnext/setup/doctype/terms_and_conditions/__init__.py
diff --git a/erpnext/setup/doctype/term/term.js b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.js
similarity index 100%
rename from erpnext/setup/doctype/term/term.js
rename to erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.js
diff --git a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.txt b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.txt
new file mode 100644
index 0000000..09d71f4
--- /dev/null
+++ b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.txt
@@ -0,0 +1,165 @@
+# DocType, Terms and Conditions
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:25',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:25',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': u'1322549700',
+		'allow_trash': 1,
+		'autoname': u'field:title',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'document_type': u'Master',
+		'module': u'Setup',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 11
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Terms and Conditions',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Terms and Conditions',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1
+	},
+
+	# DocType, Terms and Conditions
+	{
+		'doctype': 'DocType',
+		'name': u'Terms and Conditions'
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'All'
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'System Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Accounts User',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales Master Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales Master Manager',
+		'submit': 0,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'title',
+		'fieldtype': u'Data',
+		'in_filter': 1,
+		'label': u'Title',
+		'oldfieldname': u'title',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'terms',
+		'fieldtype': u'Text Editor',
+		'label': u'Terms and Conditions',
+		'oldfieldname': u'terms',
+		'oldfieldtype': u'Text Editor',
+		'permlevel': 0
+	}
+]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/territory/territory.txt b/erpnext/setup/doctype/territory/territory.txt
index 098c28f..2a1cc4d 100644
--- a/erpnext/setup/doctype/territory/territory.txt
+++ b/erpnext/setup/doctype/territory/territory.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:28',
+		'creation': '2012-03-27 14:36:25',
 		'docstatus': 0,
-		'modified': '2012-03-21 14:46:04',
+		'modified': '2012-03-27 18:50:08',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -27,7 +27,7 @@
 		'section_style': u'Simple',
 		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'version': 86
+		'version': 87
 	},
 
 	# These values are common for all DocField
@@ -59,56 +59,6 @@
 
 	# DocPerm
 	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Sales Manager',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Sales Manager',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Sales Master Manager',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Sales User',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Sales User',
-		'write': 0
-	},
-
-	# DocPerm
-	{
 		'cancel': 1,
 		'create': 1,
 		'doctype': u'DocPerm',
@@ -117,6 +67,56 @@
 		'write': 1
 	},
 
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales Master Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales User',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales User',
+		'write': 0
+	},
+
 	# DocField
 	{
 		'doctype': u'DocField',
@@ -172,6 +172,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'territoryhelp',
 		'fieldtype': u'HTML',
 		'label': u'TerritoryHelp',
 		'oldfieldtype': u'HTML',
@@ -259,6 +260,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'target_details_section_break',
 		'fieldtype': u'Section Break',
 		'label': u'Target Details',
 		'oldfieldtype': u'Section Break',
diff --git a/erpnext/setup/doctype/uom/uom.txt b/erpnext/setup/doctype/uom/uom.txt
index 7918322..93b5ff9 100644
--- a/erpnext/setup/doctype/uom/uom.txt
+++ b/erpnext/setup/doctype/uom/uom.txt
@@ -3,46 +3,46 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:29',
+		'creation': '2012-03-27 14:36:26',
 		'docstatus': 0,
-		'modified': '2010-12-24 15:14:23',
-		'modified_by': 'abhishek@webnotestech.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:26',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1307707462',
+		'_last_update': u'1307707462',
 		'allow_trash': 1,
-		'autoname': 'field:uom_name',
-		'colour': 'White:FFF',
+		'autoname': u'field:uom_name',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'Setup',
+		'document_type': u'Master',
+		'module': u'Setup',
 		'name': '__common__',
-		'section_style': 'Tabbed',
-		'server_code_error': ' ',
+		'section_style': u'Tabbed',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 5
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'UOM',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'UOM',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
 		'amend': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'UOM',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'UOM',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1,
 		'submit': 0
 	},
@@ -50,95 +50,88 @@
 	# DocType, UOM
 	{
 		'doctype': 'DocType',
-		'name': 'UOM'
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'permlevel': 1,
-		'role': 'Material Manager',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'permlevel': 0,
-		'role': 'Material Manager',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'permlevel': 1,
-		'role': 'Material User',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 4,
-		'permlevel': 0,
-		'role': 'Material User',
-		'write': 0
+		'name': u'UOM'
 	},
 
 	# DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 5,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Material Master Manager',
+		'role': u'Material Master Manager',
 		'write': 1
 	},
 
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material User',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material User',
+		'write': 0
+	},
+
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 2,
-		'label': 'UOM Details',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'uom_details',
+		'fieldtype': u'Section Break',
+		'label': u'UOM Details',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'uom_name',
-		'fieldtype': 'Data',
-		'idx': 3,
-		'label': 'UOM Name',
-		'oldfieldname': 'uom_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'uom_name',
+		'fieldtype': u'Data',
+		'label': u'UOM Name',
+		'oldfieldname': u'uom_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	}
diff --git a/erpnext/setup/doctype/warehouse_type/warehouse_type.txt b/erpnext/setup/doctype/warehouse_type/warehouse_type.txt
index c843838..6015752 100644
--- a/erpnext/setup/doctype/warehouse_type/warehouse_type.txt
+++ b/erpnext/setup/doctype/warehouse_type/warehouse_type.txt
@@ -3,45 +3,45 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:30',
+		'creation': '2012-03-27 14:36:26',
 		'docstatus': 0,
-		'modified': '2010-09-22 10:52:43',
-		'modified_by': 'yogesh@webnotestech.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:26',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
 		'allow_trash': 1,
-		'autoname': 'field:warehouse_type',
-		'colour': 'White:FFF',
+		'autoname': u'field:warehouse_type',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 0,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 6
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Warehouse Type',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Warehouse Type',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
 		'amend': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Warehouse Type',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Warehouse Type',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1,
 		'submit': 0
 	},
@@ -49,86 +49,79 @@
 	# DocType, Warehouse Type
 	{
 		'doctype': 'DocType',
-		'name': 'Warehouse Type'
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'permlevel': 1,
-		'role': 'Material Manager',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'permlevel': 0,
-		'role': 'Material Manager',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'permlevel': 1,
-		'role': 'Material User',
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 4,
-		'permlevel': 0,
-		'role': 'Material User',
-		'write': 0
+		'name': u'Warehouse Type'
 	},
 
 	# DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 5,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Material Master Manager',
+		'role': u'Material Master Manager',
 		'write': 1
 	},
 
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material User',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material User',
+		'write': 0
+	},
+
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'warehouse_type',
-		'fieldtype': 'Data',
-		'idx': 2,
+		'doctype': u'DocField',
+		'fieldname': u'warehouse_type',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Warehouse Type',
-		'oldfieldname': 'warehouse_type',
-		'oldfieldtype': 'Data',
+		'label': u'Warehouse Type',
+		'oldfieldname': u'warehouse_type',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1
diff --git a/erpnext/setup/doctype/workflow_action_detail/workflow_action_detail.txt b/erpnext/setup/doctype/workflow_action_detail/workflow_action_detail.txt
index 26028af..660eb11 100644
--- a/erpnext/setup/doctype/workflow_action_detail/workflow_action_detail.txt
+++ b/erpnext/setup/doctype/workflow_action_detail/workflow_action_detail.txt
@@ -3,61 +3,59 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:30',
+		'creation': '2012-03-27 14:36:26',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'swarnalata@webnotestech.com'
+		'modified': '2012-03-27 14:36:26',
+		'modified_by': u'Administrator',
+		'owner': u'swarnalata@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
 		'version': 5
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Workflow Action Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Workflow Action Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0,
-		'width': '200px'
+		'width': u'200px'
 	},
 
 	# DocType, Workflow Action Detail
 	{
 		'doctype': 'DocType',
-		'name': 'Workflow Action Detail'
+		'name': u'Workflow Action Detail'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'action_field',
-		'fieldtype': 'Select',
-		'idx': 1,
-		'label': 'Field',
-		'oldfieldname': 'action_field',
-		'oldfieldtype': 'Select'
+		'doctype': u'DocField',
+		'fieldname': u'action_field',
+		'fieldtype': u'Select',
+		'label': u'Field',
+		'oldfieldname': u'action_field',
+		'oldfieldtype': u'Select'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'action_value',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Value',
-		'oldfieldname': 'action_value',
-		'oldfieldtype': 'Data'
+		'doctype': u'DocField',
+		'fieldname': u'action_value',
+		'fieldtype': u'Data',
+		'label': u'Value',
+		'oldfieldname': u'action_value',
+		'oldfieldtype': u'Data'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/workflow_engine/workflow_engine.txt b/erpnext/setup/doctype/workflow_engine/workflow_engine.txt
index 5b090c8..f6e3ce7 100644
--- a/erpnext/setup/doctype/workflow_engine/workflow_engine.txt
+++ b/erpnext/setup/doctype/workflow_engine/workflow_engine.txt
@@ -3,22 +3,22 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:31',
+		'creation': '2012-03-27 14:36:26',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'swarnalata@webnotestech.com'
+		'modified': '2012-03-27 14:36:26',
+		'modified_by': u'Administrator',
+		'owner': u'swarnalata@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'issingle': 1,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 4
 	},
@@ -26,6 +26,6 @@
 	# DocType, Workflow Engine
 	{
 		'doctype': 'DocType',
-		'name': 'Workflow Engine'
+		'name': u'Workflow Engine'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/workflow_rule/workflow_rule.js b/erpnext/setup/doctype/workflow_rule/workflow_rule.js
index 1570045..9fb2013 100644
--- a/erpnext/setup/doctype/workflow_rule/workflow_rule.js
+++ b/erpnext/setup/doctype/workflow_rule/workflow_rule.js
@@ -57,4 +57,4 @@
      call_back_rule(mydoc)
     }
   );
-}
\ No newline at end of file
+}
diff --git a/erpnext/setup/doctype/workflow_rule/workflow_rule.txt b/erpnext/setup/doctype/workflow_rule/workflow_rule.txt
index a3ed11b..93f1c40 100644
--- a/erpnext/setup/doctype/workflow_rule/workflow_rule.txt
+++ b/erpnext/setup/doctype/workflow_rule/workflow_rule.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:31',
+		'creation': '2012-03-27 14:36:26',
 		'docstatus': 0,
-		'modified': '2012-03-21 14:58:16',
+		'modified': '2012-03-27 14:36:26',
 		'modified_by': u'Administrator',
 		'owner': u'swarnalata@webnotestech.com'
 	},
@@ -64,6 +64,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'rule_definition',
 		'fieldtype': u'Section Break',
 		'label': u'Rule Definition',
 		'oldfieldtype': u'Section Break'
@@ -72,6 +73,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'intro_html',
 		'fieldtype': u'HTML',
 		'label': u'Intro HTML',
 		'oldfieldtype': u'HTML',
@@ -135,6 +137,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'define_rule',
 		'fieldtype': u'Section Break',
 		'label': u'Define Rule',
 		'oldfieldtype': u'Section Break',
@@ -170,6 +173,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'action_detail',
 		'fieldtype': u'Section Break',
 		'label': u'Action Detail',
 		'oldfieldtype': u'Section Break'
@@ -178,6 +182,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'action_html',
 		'fieldtype': u'HTML',
 		'label': u'Action html',
 		'oldfieldtype': u'HTML',
@@ -199,6 +204,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'reject_html',
 		'fieldtype': u'HTML',
 		'hidden': 1,
 		'label': u'Reject HTML',
diff --git a/erpnext/setup/doctype/workflow_rule_detail/workflow_rule_detail.txt b/erpnext/setup/doctype/workflow_rule_detail/workflow_rule_detail.txt
index 3f22040..dbdb04b 100644
--- a/erpnext/setup/doctype/workflow_rule_detail/workflow_rule_detail.txt
+++ b/erpnext/setup/doctype/workflow_rule_detail/workflow_rule_detail.txt
@@ -3,110 +3,104 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:31',
+		'creation': '2012-03-27 14:36:26',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'swarnalata@webnotestech.com'
+		'modified': '2012-03-27 14:36:26',
+		'modified_by': u'Administrator',
+		'owner': u'swarnalata@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Setup',
+		'module': u'Setup',
 		'name': '__common__',
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
 		'version': 9
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Workflow Rule Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Workflow Rule Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# DocType, Workflow Rule Detail
 	{
 		'doctype': 'DocType',
-		'name': 'Workflow Rule Detail'
+		'name': u'Workflow Rule Detail'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'rule_field',
-		'fieldtype': 'Select',
-		'idx': 1,
-		'label': 'Field',
-		'oldfieldname': 'rule_field',
-		'oldfieldtype': 'Select',
-		'options': '[]',
-		'width': '200px'
+		'doctype': u'DocField',
+		'fieldname': u'rule_field',
+		'fieldtype': u'Select',
+		'label': u'Field',
+		'oldfieldname': u'rule_field',
+		'oldfieldtype': u'Select',
+		'options': u'[]',
+		'width': u'200px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'operator',
-		'fieldtype': 'Select',
-		'idx': 2,
-		'label': 'Operator',
-		'oldfieldname': 'operator',
-		'oldfieldtype': 'Select',
-		'options': '\nequal\nnot equal\ngreater than\ngreater than equal\nless than\nless than equal'
+		'doctype': u'DocField',
+		'fieldname': u'operator',
+		'fieldtype': u'Select',
+		'label': u'Operator',
+		'oldfieldname': u'operator',
+		'oldfieldtype': u'Select',
+		'options': u'\nequal\nnot equal\ngreater than\ngreater than equal\nless than\nless than equal'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'value',
-		'fieldtype': 'Data',
-		'idx': 3,
-		'label': 'Value',
-		'oldfieldname': 'value',
-		'oldfieldtype': 'Data',
-		'width': '100px'
+		'doctype': u'DocField',
+		'fieldname': u'value',
+		'fieldtype': u'Data',
+		'label': u'Value',
+		'oldfieldname': u'value',
+		'oldfieldtype': u'Data',
+		'width': u'100px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'comparing_field',
-		'fieldtype': 'Select',
-		'idx': 4,
-		'label': 'Field from other forms',
-		'oldfieldname': 'comparing_field',
-		'oldfieldtype': 'Select'
+		'doctype': u'DocField',
+		'fieldname': u'comparing_field',
+		'fieldtype': u'Select',
+		'label': u'Field from other forms',
+		'oldfieldname': u'comparing_field',
+		'oldfieldtype': u'Select'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'message',
-		'fieldtype': 'Data',
-		'idx': 5,
-		'label': 'Message when Cond. False',
-		'oldfieldname': 'message',
-		'oldfieldtype': 'Data',
-		'width': '200px'
+		'doctype': u'DocField',
+		'fieldname': u'message',
+		'fieldtype': u'Data',
+		'label': u'Message when Cond. False',
+		'oldfieldname': u'message',
+		'oldfieldtype': u'Data',
+		'width': u'200px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'exception',
-		'fieldtype': 'Select',
-		'idx': 6,
-		'label': 'Raise Exception',
-		'oldfieldname': 'exception',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo'
+		'doctype': u'DocField',
+		'fieldname': u'exception',
+		'fieldtype': u'Select',
+		'label': u'Raise Exception',
+		'oldfieldname': u'exception',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/page/import_data/import_data.js b/erpnext/setup/page/import_data/import_data.js
index aeb7dad..734c16d 100644
--- a/erpnext/setup/page/import_data/import_data.js
+++ b/erpnext/setup/page/import_data/import_data.js
@@ -47,7 +47,7 @@
 								
 								dt.onclick = function(){ 
 									var ovr = $('input[name="overwrite"]:checked').length;
-										window.location = outUrl + '?cmd=get_template&dt=' + this.nm + (ovr ? '&overwrite=1' : '');
+										window.location = wn.request.url + '?cmd=get_template&dt=' + this.nm + (ovr ? '&overwrite=1' : '');
 								}
 							}
 						}	
diff --git a/erpnext/setup/page/modules_setup/modules_setup.js b/erpnext/setup/page/modules_setup/modules_setup.js
index af7522f..71fed93 100644
--- a/erpnext/setup/page/modules_setup/modules_setup.js
+++ b/erpnext/setup/page/modules_setup/modules_setup.js
@@ -1,14 +1,18 @@
-wn.require('lib/js/lib/jquery-ui-sortable.min.js');
+wn.require('lib/js/lib/jquery/jquery.ui.sortable.js');
 
 $.extend(wn.pages.modules_setup, {
 	modules: ['Activity', 'Accounts', 'Selling', 'Buying', 'Stock', 'Production', 'Projects', 
 		'Support', 'HR', 'Website', 'To Do', 'Messages', 'Calendar', 'Knowledge Base'],	
 	onload: function(wrapper) {
-		wn.pages.modules_setup.refresh(wn.boot.modules_list);
+		wn.pages.modules_setup.refresh_page(wn.boot.modules_list);
 	},
-	refresh: function(ml) {
+	refresh_page: function(ml) {
 		$('#modules-list').empty();
-				
+
+		// Hide Setup and Dashboard modules
+		ml.indexOf('Setup')!=-1 && ml.splice(ml.indexOf('Setup'), 1);
+		ml.indexOf('Dashboard')!=-1 && ml.splice(ml.indexOf('Dashboard'), 1);
+
 		// checked modules
 		for(i in ml) {
 			$('#modules-list').append(repl('<p style="cursor:move;">\
@@ -47,4 +51,4 @@
 			btn: $('#modules-update').get(0)
 		});
 	}
-});
\ No newline at end of file
+});
diff --git a/erpnext/setup/page/permission_engine/permission_engine.js b/erpnext/setup/page/permission_engine/permission_engine.js
index 1d77e51..5f5630c 100644
--- a/erpnext/setup/page/permission_engine/permission_engine.js
+++ b/erpnext/setup/page/permission_engine/permission_engine.js
@@ -148,9 +148,13 @@
 		 // Get permissions
 		if(r.message.perms.length) {
 			me.get_results(r.message);
+			pscript.is_submittable = cint(r.message.is_submittable);
 		}
-		else me.body.innerHTML = '<div style = "color : red; margin:8px 0px;">No Records Found</div>'
-		pscript.show_submittable();
+		else {
+			me.body.innerHTML = '<div style = "color : red; margin:8px 0px;">No Records Found</div>'
+			pscript.is_submittable = 0;
+		}
+		pscript.hide_submit_amend()
 	});
 }
 
@@ -171,6 +175,7 @@
 	
 	var head = $a(this.body, 'h3'); head.innerHTML = 'Rules for ' + doctype;				
 	var permt = make_table(me.body, perms.length+1,9,'80%',[],{border:'1px solid #AAA', padding:'3px', verticalAlign:'middle', height:'30px'});
+	$(permt).attr('id', 'perm_table');
 		
 	// Create Grid for particular DocType
 	// ------------------------------------
@@ -203,9 +208,7 @@
 			var val = perms[l][$td(permt,0,m+2).fieldname];
 			if(val == 1) chk.checked = 1;
 			else chk.checked = 0;
-
-			if(m==3) { chk.onclick = pscript.show_submittable }
-
+			//if(m==3) { chk.onclick = pscript.show_submittable }
 			chk.doctype = doctype;
 			chk.permlevel = perms[l].permlevel; chk.perm_type = col_labels[m+2].toLowerCase(); chk.role = perms[l].role;
 			pscript.all_checkboxes.push(chk);
@@ -214,21 +217,18 @@
 	
 	// add selects for match
 	me.add_match_select(r, perms, permt, doctype);
+
 }
 
-// Show submittable warning
-pscript.show_submittable = function() {
-	var submittable = 0;
-	for(i in pscript.all_checkboxes) {
-		c = pscript.all_checkboxes[i];
-		if(c.perm_type=='submit' && c.checked) {
-			submittable = 1;
-			break;
-		}
-	}
-	if(submittable) {
+pscript.hide_submit_amend = function() {
+	var perm_table = $('#perm_table');
+	if (pscript.is_submittable) {
+		perm_table.find('td:nth-child(6)').each(function() { $(this).toggle(true); });
+		perm_table.find('td:nth-child(8)').each(function() { $(this).toggle(true); });
 		$('#submittable_warning').toggle(true);
 	} else {
+		perm_table.find('td:nth-child(6)').each(function() { $(this).toggle(false); });
+		perm_table.find('td:nth-child(8)').each(function() { $(this).toggle(false); });
 		$('#submittable_warning').toggle(false);
 	}
 }
@@ -538,6 +538,22 @@
 		if(sel_val(s))
 			add_to_out(s.details.parent, s.details.permlevel, s.details.role, 'match', sel_val(s));
 	}
+
+	if(pscript.is_submittable) {
+		var doctype = sel_val(me.type_select);
+		var validated = false;
+		for(var role in out[doctype][0]) {
+			if(out[doctype][0][role]['submit']) {
+				validated = true;
+				break;
+			};
+		}
+		if(!validated) {
+			msgprint("Atleast one Role at Level 0 needs to have submit permission. \
+					 Please rectify and try again.")
+			return;
+		}
+	}
 	
 	var args = "{'perm_dict': "+JSON.stringify(out)+"}"
 	$c_obj('Permission Control','update_permissions', args, function(r,rt) {});
diff --git a/erpnext/setup/page/setup/setup.html b/erpnext/setup/page/setup/setup.html
index 50ef112..6e177c2 100644
--- a/erpnext/setup/page/setup/setup.html
+++ b/erpnext/setup/page/setup/setup.html
@@ -31,10 +31,6 @@
 			<b><a href="#!List/Authorization Rule">Amount based Authorization Rules</a></b><br>
 			<span class="help">Restrict submission rights based on amount</span>
 		</p>
-		<p>
-			<b><a href="#!modules_setup">Modules Setup</a></b><br>
-			<span class="help">Show, hide modules</span>
-		</p>
 	</div>
 	<div class="setup-column">
 		<h3>Data</h3>
@@ -43,7 +39,7 @@
 			<span class="help">Import data from spreadsheet (csv) files</span>
 		</p>
 		<p>
-			<b><a href="#!Form/Manage Account/Manage Account">Global Defaults</a></b><br>
+			<b><a href="#!Form/Global Defaults/Global Defaults">Global Defaults</a></b><br>
 			<span class="help">Set default values for entry</span>
 		</p>
 		<p>
@@ -85,21 +81,29 @@
 	<div class="setup-column">
 		<h3>Customize ERPNext</h3>
 		<p>
+			<b><a href="#!Form/Customize Form/Customize Form">Customize Forms</a></b><br>
+			<span class="help">Change entry properties (hide fields, make mandatory etc)</span>
+		</p>
+		<p>
 			<b><a href="#!List/Custom Field">Custom Fields</a></b><br>
 			<span class="help">Add fields to forms</span>
 		</p>
 		<p>
-			<b><a href="#!Form/DocLayer/DocLayer">Customize Forms</a></b><br>
-			<span class="help">Change entry properties (hide fields, make mandatory etc)</span>
-		</p>
-		<p>
-			<b><a href="#!Form/Naming Series/Naming Series">Numbering Series</a></b><br>
-			<span class="help">Set multiple numbering series for transactions</span>
+			<b><a href="#!List/Custom Script">Custom Scripts</a></b><br>
+			<span class="help">Add custom code to forms</span>
 		</p>
 		<p>
 			<b><a href="#!Form/Features Setup/Features Setup">Disable Features</a></b><br>
 			<span class="help">Simplify entry forms by disabling features</span>
 		</p>
+		<p>
+			<b><a href="#!modules_setup">Modules Setup</a></b><br>
+			<span class="help">Show, hide modules</span>
+		</p>
+		<p>
+			<b><a href="#!Form/Naming Series/Naming Series">Numbering Series</a></b><br>
+			<span class="help">Set multiple numbering series for transactions</span>
+		</p>
 	</div>
 	<div class="setup-column">
 		<h3>Branding and Printing</h3>
@@ -115,14 +119,16 @@
 			<b><a href="#!List/Print Heading">Print Headings</a></b><br>
 			<span class="help">Add headers for standard print formats</span>
 		</p>
+		<!--
 		<p>
 			<b><a href="#!Form/Personalize/Personalize">Home Banner</a></b><br>
 			<span class="help">Add a home page banner</span>
 		</p>
+		-->
 		<p>
 			<b><a href="#!Form/Style Settings/Style Settings">Style Settings</a></b><br>
 			<span class="help">Change background fonts etc</span>
 		</p>
 	</div>
 	<div style="clear: both"></div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/setup_masters/Module Def/Setup Masters/Setup Masters.txt b/erpnext/setup_masters/Module Def/Setup Masters/Setup Masters.txt
deleted file mode 100644
index fe1a048..0000000
--- a/erpnext/setup_masters/Module Def/Setup Masters/Setup Masters.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Module Def, Setup Masters
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:35:42',
-		'docstatus': 0,
-		'modified': '2012-01-23 17:04:53',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Module Def
-	{
-		'disabled': 'No',
-		'doctype': u'Module Def',
-		'is_hidden': 'No',
-		'last_updated_date': '2010-11-29 12:02:02',
-		'module_label': 'Setup Masters',
-		'module_name': 'Setup Masters',
-		'name': '__common__'
-	},
-
-	# Module Def, Setup Masters
-	{
-		'doctype': u'Module Def',
-		'name': 'Setup Masters'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py
index 703399a..27c34a1 100644
--- a/erpnext/startup/event_handlers.py
+++ b/erpnext/startup/event_handlers.py
@@ -15,23 +15,9 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 import webnotes
-import webnotes.defs
 from webnotes.utils import cint
 import home
 
-def on_login(login_manager):
-	"""
-		called from login manager, before login
-	"""
-	if login_manager.user not in ('Guest', None, '') and webnotes.conn.cur_db_name!='accounts' and webnotes.conn.get_value('Control Panel', 'Control Panel', 'account_id')!='s5u011':
-		try:
-			login_manager = login_as(login_manager)
-			update_account_details()
-			import server_tools.gateway_utils
-			server_tools.gateway_utils.check_login(login_manager.user)
-			
-		except ImportError:
-			pass
 		
 def on_login_post_session(login_manager):
 	"""
@@ -97,6 +83,11 @@
 			
 		bootinfo['user_background'] = webnotes.conn.get_value("Profile", webnotes.session['user'], 'background_image') or ''
 
+		import conf
+		bootinfo['sync_with_gateway'] = hasattr(conf, 'sync_with_gateway') and \
+				cint(conf.sync_with_gateway) or 0
+
+
 def get_letter_heads():
 	"""load letter heads with startup"""
 	import webnotes
@@ -121,43 +112,9 @@
 
 		login_manager.user_fullname = (first_name and first_name or "") + (last_name and " " + last_name or "")
 
-		if hasattr(webnotes.defs, 'validate_ip'):
-			msg = getattr(webnotes.defs, 'validate_ip')()
-			if msg: webnotes.msgprint(msg, raise_exception=1)
-
 		# alisaing here... so check if the user is disabled
 		if not webnotes.conn.sql("select ifnull(enabled,0) from tabProfile where name=%s", user)[0][0]:
 			# throw execption
 			webnotes.msgprint("Authentication Failed", raise_exception=1)
 
-	return login_manager
-
-#
-# update account details
-#
-def update_account_details():
-	# additional details (if from gateway)
-	if webnotes.form_dict.get('is_trial'):
-		webnotes.conn.set_global('is_trial', cint(webnotes.form_dict.get('is_trial')))
-
-	if webnotes.form_dict.get('days_to_expiry'):
-		webnotes.conn.set_global('days_to_expiry', webnotes.form_dict.get('days_to_expiry'))
-
-	if webnotes.form_dict.get('first_name'):
-		from server_tools.gateway_utils import update_user_details
-		update_user_details()
-
-	if webnotes.form_dict.get('xpassword') and webnotes.form_dict.get('login_as')!='Administrator':
-		webnotes.conn.sql("""update tabProfile set password=password(%(xpassword)s) where name=%(login_as)s""", (webnotes.form_dict))
-
-	if webnotes.form_dict.get('url_name'):
-		from webnotes.utils import set_default
-		set_default('account_url', 'http://'+webnotes.form_dict.get('url_name'))
-
-#
-# logout the user from SSO
-#
-def on_logout(login_manager):
-	if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
-		from server_tools.gateway_utils import logout_sso
-		logout_sso(user=login_manager.user)
+	return login_manager
\ No newline at end of file
diff --git a/erpnext/startup/js/complete_setup.js b/erpnext/startup/js/complete_setup.js
index ac89aff..c643813 100644
--- a/erpnext/startup/js/complete_setup.js
+++ b/erpnext/startup/js/complete_setup.js
@@ -85,7 +85,7 @@
 			wn.boot.user_info[user].fullname = user_fullname;
 			d.hide();
 			$('header').toggle(true);
-			page_body.wntoolbar.set_user_name();
+			wn.container.wntoolbar.set_user_name();
 		});
 	}
 	
diff --git a/erpnext/startup/js/feature_setup.js b/erpnext/startup/js/feature_setup.js
index 8006dca..f7fdb26 100644
--- a/erpnext/startup/js/feature_setup.js
+++ b/erpnext/startup/js/feature_setup.js
@@ -28,13 +28,13 @@
 // ====================================================================*/
 pscript.feature_dict = {
 	'fs_projects': {
-		'Bill Of Materials': {'fields':['project_name']},
+		'BOM': {'fields':['project_name']},
 		'Delivery Note': {'fields':['project_name']},
-		'Payable Voucher': {'fields':['project_name']},
+		'Purchase Invoice': {'entries':['project_name']},
 		'Production Order': {'fields':['project_name']},
-		'Purchase Order': {'fields':['project_name']},
-		'Purchase Receipt': {'fields':['project_name']},
-		'Receivable Voucher': {'fields':['project_name']},
+		'Purchase Order': {'po_details':['project_name']},
+		'Purchase Receipt': {'purchase_receipt_details':['project_name']},
+		'Sales Invoice': {'fields':['project_name']},
 		'Sales Order': {'fields':['project_name']},
 		'Stock Entry': {'fields':['project_name']},
 		'Timesheet': {'timesheet_details':['project_name']}
@@ -46,22 +46,22 @@
 	'fs_discounts': {
 		'Delivery Note': {'delivery_note_details':['adj_rate']},
 		'Quotation': {'quotation_details':['adj_rate']},
-		'Receivable Voucher': {'entries':['adj_rate']},
+		'Sales Invoice': {'entries':['adj_rate']},
 		'Sales Order': {'sales_order_details':['adj_rate','ref_rate']}
 	},
 	'fs_purchase_discounts': {
 		'Purchase Order': {'po_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']},
 		'Purchase Receipt': {'purchase_receipt_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']},
-		'Payable Voucher': {'entries':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}
+		'Purchase Invoice': {'entries':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}
 	},
 	'fs_brands': {
 		'Delivery Note': {'delivery_note_details':['brand']},
-		'Indent': {'indent_details':['brand']},
+		'Purchase Request': {'indent_details':['brand']},
 		'Item': {'fields':['brand']},
 		'Purchase Order': {'po_details':['brand']},
-		'Payable Voucher': {'entries':['brand']},
+		'Purchase Invoice': {'entries':['brand']},
 		'Quotation': {'quotation_details':['brand']},
-		'Receivable Voucher': {'entries':['brand']},
+		'Sales Invoice': {'entries':['brand']},
 		'Sales BOM': {'fields':['new_item_brand']},
 		'Sales Order': {'sales_order_details':['brand']},
 		'Serial No': {'fields':['brand']}
@@ -73,9 +73,9 @@
 		'Delivery Note': {'delivery_note_details':['batch_no']},
 		'Item': {'fields':['has_batch_no']},
 		'Purchase Receipt': {'purchase_receipt_details':['batch_no']},
-		'QA Inspection Report': {'fields':['batch_no']},
+		'Quality Inspection': {'fields':['batch_no']},
 		'Sales and Pruchase Return Wizard': {'return_details':['batch_no']},
-		'Receivable Voucher': {'entries':['batch_no']},
+		'Sales Invoice': {'entries':['batch_no']},
 		'Stock Entry': {'mtn_details':['batch_no']},
 		'Stock Ledger Entry': {'fields':['batch_no']}
 	},
@@ -84,26 +84,26 @@
 		'Delivery Note': {'delivery_note_details':['serial_no'],'packing_details':['serial_no']},
 		'Installation Note': {'installed_item_details':['serial_no']},
 		'Item': {'fields':['has_serial_no']},
-		'Maintenance Schedule': {'item_maintenance_details':['serial_no'],'maintenance_schedule_details':['serial_no']},
+		'Maintenance Schedule': {'item_maintenance_detail':['serial_no'],'maintenance_schedule_detail':['serial_no']},
 		'Maintenance Visit': {'maintenance_visit_details':['serial_no']},
 		'Purchase Receipt': {'purchase_receipt_details':['serial_no']},
-		'QA Inspection Report': {'fields':['item_serial_no']},
+		'Quality Inspection': {'fields':['item_serial_no']},
 		'Sales and Pruchase Return Wizard': {'return_details':['serial_no']},
-		'Receivable Voucher': {'entries':['serial_no']},
+		'Sales Invoice': {'entries':['serial_no']},
 		'Stock Entry': {'mtn_details':['serial_no']},
 		'Stock Ledger Entry': {'fields':['serial_no']}
 	},
 	'fs_item_group_in_details': {
 		'Delivery Note': {'delivery_note_details':['item_group']},
-		'Enquiry': {'enquiry_details':['item_group']},
-		'Indent': {'indent_details':['item_group']},
+		'Opportunity': {'enquiry_details':['item_group']},
+		'Purchase Request': {'indent_details':['item_group']},
 		'Item': {'fields':['item_group']},
-		'Manage Account': {'fields':['default_item_group']},
+		'Global Defaults': {'fields':['default_item_group']},
 		'Purchase Order': {'po_details':['item_group']},
 		'Purchase Receipt': {'purchase_receipt_details':['item_group']},
 		'Purchase Voucher': {'entries':['item_group']},
 		'Quotation': {'quotation_details':['item_group']},
-		'Receivable Voucher': {'entries':['item_group']},
+		'Sales Invoice': {'entries':['item_group']},
 		'Sales BOM': {'fields':['serial_no']},
 		'Sales Order': {'sales_order_details':['item_group']},
 		'Serial No': {'fields':['item_group']},
@@ -113,25 +113,25 @@
 	},
 	'fs_page_break': {
 		'Delivery Note': {'delivery_note_details':['page_break'],'packing_details':['page_break']},
-		'Indent': {'indent_details':['page_break']},
+		'Purchase Request': {'indent_details':['page_break']},
 		'Purchase Order': {'po_details':['page_break']},
 		'Purchase Receipt': {'purchase_receipt_details':['page_break']},
 		'Purchase Voucher': {'entries':['page_break']},
 		'Quotation': {'quotation_details':['page_break']},
-		'Receivable Voucher': {'entries':['page_break']},
+		'Sales Invoice': {'entries':['page_break']},
 		'Sales Order': {'sales_order_details':['page_break']}
 	},
 	'fs_exports': {
 		'Delivery Note': {'fields':['Note','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','amount','basic_rate']},
 		'POS Setting': {'fields':['conversion_rate','currency']},
 		'Quotation': {'fields':['Note HTML','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['base_ref_rate','amount','basic_rate']},
-		'Receivable Voucher': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['base_ref_rate','amount','basic_rate']},
+		'Sales Invoice': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['base_ref_rate','amount','basic_rate']},
 		'Item': {'ref_rate_details':['ref_currency']},
 		'Sales BOM': {'fields':['currency']},
 		'Sales Order': {'fields':['Note1','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['base_ref_rate','amount','basic_rate']}
 	},
 	'fs_imports': {
-		'Payable Voucher': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'entries':['purchase_ref_rate', 'amount','rate']},
+		'Purchase Invoice': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'entries':['purchase_ref_rate', 'amount','rate']},
 		'Purchase Order': {'fields':['Note HTML','conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'po_details':['purchase_ref_rate', 'amount','purchase_rate']},
 		'Purchase Receipt': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'purchase_receipt_details':['purchase_ref_rate','amount','purchase_rate']},
 		'Supplier Quotation': {'fields':['conversion_rate','currency']}
@@ -145,19 +145,19 @@
 		'Customer': {'fields':['sales_team']},
 		'Delivery Note': {'fields':['sales_team','Packing List']},
 		'Item': {'fields':['item_customer_details']},
-		'Receivable Voucher': {'fields':['sales_team']},
+		'Sales Invoice': {'fields':['sales_team']},
 		'Sales Order': {'fields':['sales_team','Packing List']}
 	},
 	'fs_more_info': {
 		'Delivery Note': {'fields':['More Info']},
-		'Enquiry': {'fields':['More Info']},
-		'Indent': {'fields':['More Info']},
+		'Opportunity': {'fields':['More Info']},
+		'Purchase Request': {'fields':['More Info']},
 		'Lead': {'fields':['More Info']},
-		'Payable Voucher': {'fields':['More Info']},
+		'Purchase Invoice': {'fields':['More Info']},
 		'Purchase Order': {'fields':['More Info']},
 		'Purchase Receipt': {'fields':['More Info']},
 		'Quotation': {'fields':['More Info']},
-		'Receivable Voucher': {'fields':['More Info']},
+		'Sales Invoice': {'fields':['More Info']},
 		'Sales Order': {'fields':['More Info']},
 	},
 	'fs_quality': {
@@ -168,10 +168,10 @@
 		'Item': {'fields':['Manufacturing']}
 	},
 	'fs_pos': {
-		'Receivable Voucher': {'fields':['is_pos']}
+		'Sales Invoice': {'fields':['is_pos']}
 	},
 	'fs_recurring_invoice': {
-		'Receivable Voucher': {'fields': ['Recurring Invoice']}
+		'Sales Invoice': {'fields': ['Recurring Invoice']}
 	}
 }
 
diff --git a/erpnext/startup/js/modules.js b/erpnext/startup/js/modules.js
index d43b021..2e0e701 100644
--- a/erpnext/startup/js/modules.js
+++ b/erpnext/startup/js/modules.js
@@ -61,7 +61,7 @@
 
 erpnext.module_page.make_list = function(module, wrapper) {
 	// make project listing
-	wrapper.list = new wn.widgets.Listing({
+	wrapper.list = new wn.ui.Listing({
 		parent: $(wrapper).find('.reports-list').get(0),
 		method: 'utilities.get_report_list',
 		render_row: function(row, data) {
diff --git a/erpnext/startup/js/toolbar.js b/erpnext/startup/js/toolbar.js
index 7bf9c6a..eb3bff8 100644
--- a/erpnext/startup/js/toolbar.js
+++ b/erpnext/startup/js/toolbar.js
@@ -48,7 +48,7 @@
 		$('#toolbar-user').append('<li><a href="#billing">Billing</a></li>')
 	}
 
-	$.extend(page_body.wntoolbar, {
+	$.extend(wn.container.wntoolbar, {
 		set_new_comments: function(new_comments) {
 			var navbar_nc = $('.navbar-new-comments');
 			if(new_comments && new_comments.length>0) {
@@ -66,7 +66,7 @@
 		}
 	});
 
-	page_body.wntoolbar.set_new_comments();
+	wn.container.wntoolbar.set_new_comments();
 }
 
 erpnext.toolbar.add_modules = function() {
diff --git a/erpnext/startup/startup.css b/erpnext/startup/startup.css
index 225e444..bd21144 100644
--- a/erpnext/startup/startup.css
+++ b/erpnext/startup/startup.css
@@ -1,11 +1,11 @@
 h1, h2, h3, h4, h5 {
-	font-family: Tahoma, Arial, Verdana, sans-serif;
-	font-weight: bold;
+	font-family: "Helvetica Neue", "Open Sans", Helvetica, sans-serif;
+	margin-top: 0.2em;
 }
 
 body {
-	font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
-	font-size: 12px;
+	font-family: "Helvetica Neue", "Open Sans", Helvetica, sans-serif;
+	font-size: 13px;
 }
 
 span, div, td, input, textarea, button, select {
@@ -13,7 +13,12 @@
 }
 
 body {
-	background: url(../images/stripedbg.png) repeat;
+	background: url(../images/redbeech.jpg) repeat;
+	color: #616161;
+}
+
+.small {
+	font-size: 11.5px;
 }
 
 .erpnext-footer {
@@ -21,25 +26,6 @@
 	text-align: center;
 }
 
-.module-icons {
-   background: url(../images/module-icons.png) no-repeat top left;
-   width:16px;
-   height:16px;
-}
-
-.module-icons-accounts{ background-position: 0 0;  } 
-.module-icons-analysis{ background-position: 0 -66px;  } 
-.module-icons-buying{ background-position: 0 -132px;  } 
-.module-icons-home{ background-position: 0 -198px;  } 
-.module-icons-hr{ background-position: 0 -264px;  } 
-.module-icons-people{ background-position: 0 -330px;  } 
-.module-icons-production{ background-position: 0 -396px;  } 
-.module-icons-projects{ background-position: 0 -462px;  } 
-.module-icons-selling{ background-position: 0 -528px;  } 
-.module-icons-setup{ background-position: 0 -594px;  } 
-.module-icons-stock{ background-position: 0 -660px;  } 
-.module-icons-support{ background-position: 0 -726px;  } 
-
 .navbar-new-comments {
 	margin: -3px 0px;
 	padding: 2px;
@@ -57,26 +43,11 @@
 	color: #fff;
 }
 
-
 .navbar-new-comments-true {
 	color: #fff;
 	background-color: #B00D07;
 }
 
-.navbar-icon-home {
-	vertical-align: middle;
-	opacity:0.4;
-	Filter:alpha(opacity=40); /* For IE8 and earlier */
-}
-
-.navbar-icon-home:hover,
-.navbar-icon-home:focus,
-.navbar-icon-home:active,
-.navbar-icon-home-hover{
-	opacity:1;
-	Filter:alpha(opacity=100); /* For IE8 and earlier */
-}
-
 /*extra size menus for recent*/
 .dropdown-menu#toolbar-recent, .dropdown-menu#toolbar-options, .dropdown-menu#toolbar-help{
 	min-width: 160px !important;
diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js
index c00770c..456b1cf 100644
--- a/erpnext/startup/startup.js
+++ b/erpnext/startup/startup.js
@@ -39,6 +39,7 @@
 }
 
 erpnext.startup.set_globals = function() {
+	wn.control_panel.sync_with_gateway = wn.boot.sync_with_gateway
 	pscript.is_erpnext_saas = cint(wn.control_panel.sync_with_gateway)
 	if(inList(user_roles,'System Manager')) is_system_manager = 1;
 }
@@ -49,14 +50,14 @@
 	
 	erpnext.startup.set_globals();
 
-	if(wn.boot.custom_css) {
-		set_style(wn.boot.custom_css);
-	}
 	if(wn.boot.user_background) {
 		erpnext.set_user_background(wn.boot.user_background);
 	}
 		
 	if(user == 'Guest'){
+		if(wn.boot.custom_css) {
+			set_style(wn.boot.custom_css);
+		}
 		if(wn.boot.website_settings.title_prefix) {
 			wn.title_prefix = wn.boot.website_settings.title_prefix;
 		}
@@ -64,6 +65,10 @@
 		// always allow apps
 		wn.boot.profile.allow_modules = wn.boot.profile.allow_modules.concat(
 			['To Do', 'Knowledge Base', 'Calendar', 'Activity', 'Messages'])
+		// allow dashboard to accounts manager
+		if(user_roles.indexOf('Accounts Manager')!=-1) {
+			wn.boot.profile.allow_modules.push('Dashboard');
+		}
 		
 		// setup toolbar
 		erpnext.toolbar.setup();
@@ -73,8 +78,8 @@
 
 		// border to the body
 		// ------------------
-		$('footer').html('<div class="web-footer erpnext-footer">\
-			<a href="#!attributions">ERPNext | Attributions and License</a></div>');
+		//$('footer').html('<div class="web-footer erpnext-footer">\
+		//	<a href="#!attributions">ERPNext | Attributions and License</a></div>');
 
 		// complete registration
 		if(in_list(user_roles,'System Manager') && (wn.boot.setup_complete=='No')) { 
@@ -84,6 +89,8 @@
 
 	}
 
+	erpnext.set_about();
+
 	$('#startup_div').toggle(false);
 }
 
@@ -107,39 +114,43 @@
 var update_messages = function(reset) {
 	// Updates Team Messages
 	
-	if(inList(['Guest'], user)) { return; }
+	if(inList(['Guest'], user) || !wn.session_alive) { return; }
 
 	if(!reset) {
-		$c_page('home', 'event_updates', 'get_global_status_messages', null,
-			function(r,rt) {
-				if(!r.exc) {
-					// This function is defined in toolbar.js
-					page_body.wntoolbar.set_new_comments(r.message.unread_messages);
-					
-					var show_in_circle = function(parent_id, msg) {
-						var parent = $('#'+parent_id);
-						if(parent) {
-							if(msg) {
-								parent.find('span:first').text(msg);
-								parent.toggle(true);
-							} else {
-								parent.toggle(false);
-							}
+		var set_messages = function(r) {
+			if(!r.exc) {
+				// This function is defined in toolbar.js
+				wn.container.wntoolbar.set_new_comments(r.message.unread_messages);
+				
+				var show_in_circle = function(parent_id, msg) {
+					var parent = $('#'+parent_id);
+					if(parent) {
+						if(msg) {
+							parent.find('span:first').text(msg);
+							parent.toggle(true);
+						} else {
+							parent.toggle(false);
 						}
 					}
-
-					show_in_circle('unread_messages', r.message.unread_messages.length);
-					show_in_circle('open_support_tickets', r.message.open_support_tickets);
-					show_in_circle('things_todo', r.message.things_todo);
-					show_in_circle('todays_events', r.message.todays_events);
-
-				} else {
-					clearInterval(wn.updates.id);
 				}
+				
+				show_in_circle('unread_messages', r.message.unread_messages.length);
+				show_in_circle('open_support_tickets', r.message.open_support_tickets);
+				show_in_circle('things_todo', r.message.things_todo);
+				show_in_circle('todays_events', r.message.todays_events);
+
+			} else {
+				clearInterval(wn.updates.id);
 			}
-		);
+		}
+
+		wn.call({
+			method: 'startup.startup.get_global_status_messages',
+			callback: set_messages
+		});
+	
 	} else {
-		page_body.wntoolbar.set_new_comments(0);
+		wn.container.wntoolbar.set_new_comments(0);
 		$('#unread_messages').toggle(false);
 	}
 }
diff --git a/erpnext/startup/startup.py b/erpnext/startup/startup.py
new file mode 100644
index 0000000..8bc13f8
--- /dev/null
+++ b/erpnext/startup/startup.py
@@ -0,0 +1,54 @@
+import webnotes
+
+def get_unread_messages():
+	"returns unread (docstatus-0 messages for a user)"
+	return webnotes.conn.sql("""\
+		SELECT name, comment
+		FROM `tabComment`
+		WHERE comment_doctype IN ('My Company', 'Message')
+		AND comment_docname = %s
+		AND ifnull(docstatus,0)=0
+		""", webnotes.user.name, as_list=1)
+
+def get_open_support_tickets():
+	"""
+		Returns a count of open support tickets
+	"""
+	from webnotes.utils import cint
+	open_support_tickets = webnotes.conn.sql("""\
+		SELECT COUNT(*) FROM `tabSupport Ticket`
+		WHERE status = 'Open'""")
+	return open_support_tickets and cint(open_support_tickets[0][0]) or 0
+
+def get_things_todo():
+	"""
+		Returns a count of incomplete todos
+	"""
+	from webnotes.utils import cint
+	incomplete_todos = webnotes.conn.sql("""\
+		SELECT COUNT(*) FROM `tabToDo`
+		WHERE IFNULL(checked, 0) = 0
+		AND owner = %s""", webnotes.session.get('user'))
+	return incomplete_todos and cint(incomplete_todos[0][0]) or 0
+
+def get_todays_events():
+	"""
+		Returns a count of todays events in calendar
+	"""
+	from webnotes.utils import nowdate, cint
+	todays_events = webnotes.conn.sql("""\
+		SELECT COUNT(*) FROM `tabEvent`
+		WHERE owner = %s
+		AND event_type != 'Cancel'
+		AND event_date = %s""", (
+		webnotes.session.get('user'), nowdate()))
+	return todays_events and cint(todays_events[0][0]) or 0
+
+@webnotes.whitelist()
+def get_global_status_messages(arg=None):
+	return {
+		'unread_messages': get_unread_messages(),
+		'open_support_tickets': get_open_support_tickets(),
+		'things_todo': get_things_todo(),
+		'todays_events': get_todays_events(),
+	}
diff --git a/erpnext/stock/DocType Label/QA Inspection Report/QA Inspection Report.txt b/erpnext/stock/DocType Label/QA Inspection Report/QA Inspection Report.txt
deleted file mode 100644
index a4d266f..0000000
--- a/erpnext/stock/DocType Label/QA Inspection Report/QA Inspection Report.txt
+++ /dev/null
@@ -1 +0,0 @@
-[{'modified_by': 'Administrator', 'name': 'QA Inspection Report', 'parent': None, 'dt_label': 'Quality Inspection', 'creation': '2010-06-28 12:56:06', 'modified': '2010-06-28 12:56:06', 'module': 'Accounts', 'doctype': 'DocType Label', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'dt': 'QA Inspection Report', 'parentfield': None}]
\ No newline at end of file
diff --git a/erpnext/stock/DocType Mapper/Delivery Note-Packing Slip/Delivery Note-Packing Slip.txt b/erpnext/stock/DocType Mapper/Delivery Note-Packing Slip/Delivery Note-Packing Slip.txt
index 7cc2350..42ba6f0 100644
--- a/erpnext/stock/DocType Mapper/Delivery Note-Packing Slip/Delivery Note-Packing Slip.txt
+++ b/erpnext/stock/DocType Mapper/Delivery Note-Packing Slip/Delivery Note-Packing Slip.txt
@@ -84,10 +84,10 @@
 	{
 		'doctype': u'Table Mapper Detail',
 		'from_field': u'delivery_note_details',
-		'from_table': u'Delivery Note Detail',
+		'from_table': u'Delivery Note Item',
 		'match_id': 1,
 		'to_field': u'item_details',
-		'to_table': u'Packing Slip Detail',
+		'to_table': u'Packing Slip Item',
 		'validation_logic': u'IFNULL(packed_qty, 0) < IFNULL(qty, 0)'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt b/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt
index d628495..745ef1f 100644
--- a/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt
+++ b/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt
@@ -5,7 +5,7 @@
 	{
 		'creation': '2010-08-08 17:09:35',
 		'docstatus': 0,
-		'modified': '2012-03-20 14:24:12',
+		'modified': '2012-04-02 14:03:39',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -189,12 +189,25 @@
 	{
 		'doctype': u'Table Mapper Detail',
 		'from_field': u'po_details',
-		'from_table': u'PO Detail',
+		'from_table': u'Purchase Order Item',
 		'match_id': 1,
 		'reference_doctype_key': u'prevdoc_doctype',
 		'reference_key': u'prevdoc_detail_docname',
 		'to_field': u'purchase_receipt_details',
-		'to_table': u'Purchase Receipt Detail',
+		'to_table': u'Purchase Receipt Item',
+		'validation_logic': u'docstatus=1 and qty > ifnull(received_qty,0)'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'po_details',
+		'from_table': u'Purchase Order Item',
+		'match_id': 1,
+		'reference_doctype_key': u'prevdoc_doctype',
+		'reference_key': u'prevdoc_detail_docname',
+		'to_field': u'purchase_receipt_details',
+		'to_table': u'Purchase Receipt Item',
 		'validation_logic': u'docstatus=1 and qty > ifnull(received_qty,0)'
 	},
 
@@ -212,10 +225,21 @@
 	{
 		'doctype': u'Table Mapper Detail',
 		'from_field': u'purchase_tax_details',
-		'from_table': u'Purchase Tax Detail',
+		'from_table': u'Purchase Taxes and Charges',
 		'match_id': 2,
 		'to_field': u'purchase_tax_details',
-		'to_table': u'Purchase Tax Detail',
+		'to_table': u'Purchase Taxes and Charges',
+		'validation_logic': u'docstatus = 1'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'purchase_tax_details',
+		'from_table': u'Purchase Taxes and Charges',
+		'match_id': 2,
+		'to_field': u'purchase_tax_details',
+		'to_table': u'Purchase Taxes and Charges',
 		'validation_logic': u'docstatus = 1'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/DocType Mapper/Receivable Voucher-Delivery Note/Receivable Voucher-Delivery Note.txt b/erpnext/stock/DocType Mapper/Receivable Voucher-Delivery Note/Receivable Voucher-Delivery Note.txt
deleted file mode 100755
index 61b33ee..0000000
--- a/erpnext/stock/DocType Mapper/Receivable Voucher-Delivery Note/Receivable Voucher-Delivery Note.txt
+++ /dev/null
@@ -1,169 +0,0 @@
-# DocType Mapper, Receivable Voucher-Delivery Note
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-12-14 17:56:41',
-		'docstatus': 0,
-		'modified': '2011-09-15 15:04:44',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'name': '__common__',
-		'parent': 'Receivable Voucher-Delivery Note',
-		'parentfield': 'table_mapper_details',
-		'parenttype': 'DocType Mapper'
-	},
-
-	# These values are common for all Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'name': '__common__',
-		'parent': 'Receivable Voucher-Delivery Note',
-		'parentfield': 'field_mapper_details',
-		'parenttype': 'DocType Mapper'
-	},
-
-	# These values are common for all DocType Mapper
-	{
-		'doctype': u'DocType Mapper',
-		'from_doctype': 'Receivable Voucher',
-		'module': 'Stock',
-		'name': '__common__',
-		'ref_doc_submitted': 1,
-		'to_doctype': 'Delivery Note'
-	},
-
-	# DocType Mapper, Receivable Voucher-Delivery Note
-	{
-		'doctype': u'DocType Mapper',
-		'name': 'Receivable Voucher-Delivery Note'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'eval: flt(obj.qty) - flt(obj.delivered_qty)',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'qty'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'parent',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'prevdoc_docname'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'parenttype',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'prevdoc_doctype'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'name',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'prevdoc_detail_docname'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'eval: (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.basic_rate)',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'amount'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'eval: (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.export_rate)',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'export_amount'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'naming_series',
-		'map': 'No',
-		'match_id': 0,
-		'to_field': 'naming_series'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'customer_address',
-		'map': 'Yes',
-		'match_id': 0,
-		'to_field': 'delivery_address'
-	},
-
-	# Field Mapper Detail
-	{
-		'doctype': 'Field Mapper Detail',
-		'from_field': 'serial_no',
-		'map': 'Yes',
-		'match_id': 1,
-		'to_field': 'serial_no'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_table': 'Receivable Voucher',
-		'match_id': 0,
-		'to_table': 'Delivery Note',
-		'validation_logic': 'docstatus=1'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_field': 'entries',
-		'from_table': 'RV Detail',
-		'match_id': 1,
-		'to_field': 'delivery_note_details',
-		'to_table': 'Delivery Note Detail',
-		'validation_logic': 'docstatus = 1'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_field': 'other_charges',
-		'from_table': 'RV Tax Detail',
-		'match_id': 2,
-		'to_field': 'other_charges',
-		'to_table': 'RV Tax Detail',
-		'validation_logic': 'name is not null'
-	},
-
-	# Table Mapper Detail
-	{
-		'doctype': 'Table Mapper Detail',
-		'from_field': 'sales_team',
-		'from_table': 'Sales Team',
-		'match_id': 3,
-		'to_field': 'sales_team',
-		'to_table': 'Sales Team',
-		'validation_logic': 'name is not null'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/stock/DocType Mapper/Sales Invoice-Delivery Note/Sales Invoice-Delivery Note.txt b/erpnext/stock/DocType Mapper/Sales Invoice-Delivery Note/Sales Invoice-Delivery Note.txt
new file mode 100755
index 0000000..608a1d7
--- /dev/null
+++ b/erpnext/stock/DocType Mapper/Sales Invoice-Delivery Note/Sales Invoice-Delivery Note.txt
@@ -0,0 +1,169 @@
+# DocType Mapper, Sales Invoice-Delivery Note
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2010-12-14 17:56:41',
+		'docstatus': 0,
+		'modified': '2012-04-03 12:49:50',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'name': '__common__',
+		'parent': u'Sales Invoice-Delivery Note',
+		'parentfield': u'table_mapper_details',
+		'parenttype': u'DocType Mapper'
+	},
+
+	# These values are common for all Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'name': '__common__',
+		'parent': u'Sales Invoice-Delivery Note',
+		'parentfield': u'field_mapper_details',
+		'parenttype': u'DocType Mapper'
+	},
+
+	# These values are common for all DocType Mapper
+	{
+		'doctype': u'DocType Mapper',
+		'from_doctype': u'Sales Invoice',
+		'module': u'Stock',
+		'name': '__common__',
+		'ref_doc_submitted': 1,
+		'to_doctype': u'Delivery Note'
+	},
+
+	# DocType Mapper, Sales Invoice-Delivery Note
+	{
+		'doctype': u'DocType Mapper',
+		'name': u'Sales Invoice-Delivery Note'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'eval: flt(obj.qty) - flt(obj.delivered_qty)',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'qty'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'parent',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'prevdoc_docname'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'parenttype',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'prevdoc_doctype'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'name',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'prevdoc_detail_docname'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'eval: (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.basic_rate)',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'amount'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'eval: (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.export_rate)',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'export_amount'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'naming_series',
+		'map': u'No',
+		'match_id': 0,
+		'to_field': u'naming_series'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'customer_address',
+		'map': u'Yes',
+		'match_id': 0,
+		'to_field': u'delivery_address'
+	},
+
+	# Field Mapper Detail
+	{
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'serial_no',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'serial_no'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_table': u'Sales Invoice',
+		'match_id': 0,
+		'to_table': u'Delivery Note',
+		'validation_logic': u'docstatus=1'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'entries',
+		'from_table': u'Sales Invoice Item',
+		'match_id': 1,
+		'to_field': u'delivery_note_details',
+		'to_table': u'Delivery Note Item',
+		'validation_logic': u'docstatus = 1'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'other_charges',
+		'from_table': u'Sales Taxes and Charges',
+		'match_id': 2,
+		'to_field': u'other_charges',
+		'to_table': u'Sales Taxes and Charges',
+		'validation_logic': u'name is not null'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'sales_team',
+		'from_table': u'Sales Team',
+		'match_id': 3,
+		'to_field': u'sales_team',
+		'to_table': u'Sales Team',
+		'validation_logic': u'name is not null'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/stock/DocType Mapper/Sales Order-Delivery Note/Sales Order-Delivery Note.txt b/erpnext/stock/DocType Mapper/Sales Order-Delivery Note/Sales Order-Delivery Note.txt
index 43e800f..3024da5 100644
--- a/erpnext/stock/DocType Mapper/Sales Order-Delivery Note/Sales Order-Delivery Note.txt
+++ b/erpnext/stock/DocType Mapper/Sales Order-Delivery Note/Sales Order-Delivery Note.txt
@@ -5,7 +5,7 @@
 	{
 		'creation': '2010-08-08 17:09:35',
 		'docstatus': 0,
-		'modified': '2012-03-01 17:58:16',
+		'modified': '2012-04-02 13:05:03',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -131,6 +131,16 @@
 	{
 		'checking_operator': u'=',
 		'doctype': u'Field Mapper Detail',
+		'from_field': u'basic_rate',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'basic_rate'
+	},
+
+	# Field Mapper Detail
+	{
+		'checking_operator': u'=',
+		'doctype': u'Field Mapper Detail',
 		'from_field': u'export_rate',
 		'map': u'Yes',
 		'match_id': 1,
@@ -139,6 +149,16 @@
 
 	# Field Mapper Detail
 	{
+		'checking_operator': u'=',
+		'doctype': u'Field Mapper Detail',
+		'from_field': u'basic_rate',
+		'map': u'Yes',
+		'match_id': 1,
+		'to_field': u'basic_rate'
+	},
+
+	# Field Mapper Detail
+	{
 		'doctype': u'Field Mapper Detail',
 		'from_field': u'eval: flt(obj.qty) - flt(obj.delivered_qty)',
 		'map': u'Yes',
@@ -235,10 +255,21 @@
 	{
 		'doctype': u'Table Mapper Detail',
 		'from_field': u'other_charges',
-		'from_table': u'RV Tax Detail',
+		'from_table': u'Sales Taxes and Charges',
 		'match_id': 2,
 		'to_field': u'other_charges',
-		'to_table': u'RV Tax Detail',
+		'to_table': u'Sales Taxes and Charges',
+		'validation_logic': u'name is not null'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'other_charges',
+		'from_table': u'Sales Taxes and Charges',
+		'match_id': 2,
+		'to_field': u'other_charges',
+		'to_table': u'Sales Taxes and Charges',
 		'validation_logic': u'name is not null'
 	},
 
@@ -246,12 +277,25 @@
 	{
 		'doctype': u'Table Mapper Detail',
 		'from_field': u'sales_order_details',
-		'from_table': u'Sales Order Detail',
+		'from_table': u'Sales Order Item',
 		'match_id': 1,
 		'reference_doctype_key': u'prevdoc_doctype',
 		'reference_key': u'prevdoc_detail_docname',
 		'to_field': u'delivery_note_details',
-		'to_table': u'Delivery Note Detail',
+		'to_table': u'Delivery Note Item',
+		'validation_logic': u'qty > ifnull(delivered_qty,0) and docstatus = 1'
+	},
+
+	# Table Mapper Detail
+	{
+		'doctype': u'Table Mapper Detail',
+		'from_field': u'sales_order_details',
+		'from_table': u'Sales Order Item',
+		'match_id': 1,
+		'reference_doctype_key': u'prevdoc_doctype',
+		'reference_key': u'prevdoc_detail_docname',
+		'to_field': u'delivery_note_details',
+		'to_table': u'Delivery Note Item',
 		'validation_logic': u'qty > ifnull(delivered_qty,0) and docstatus = 1'
 	},
 
@@ -264,4 +308,4 @@
 		'to_table': u'Delivery Note',
 		'validation_logic': u'docstatus = 1'
 	}
-]
+]
\ No newline at end of file
diff --git a/erpnext/stock/Module Def/Stock/Stock.txt b/erpnext/stock/Module Def/Stock/Stock.txt
deleted file mode 100644
index 991d410..0000000
--- a/erpnext/stock/Module Def/Stock/Stock.txt
+++ /dev/null
@@ -1,242 +0,0 @@
-# Module Def, Stock
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-07-01 17:40:49',
-		'docstatus': 0,
-		'modified': '2012-02-01 15:43:00',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'name': '__common__',
-		'parent': 'Stock',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def'
-	},
-
-	# These values are common for all Module Def Item
-	{
-		'doctype': 'Module Def Item',
-		'name': '__common__',
-		'parent': 'Stock',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-
-	# These values are common for all Module Def
-	{
-		'disabled': 'No',
-		'doctype': u'Module Def',
-		'doctype_list': 'DocType Label, QA Inspection Report',
-		'is_hidden': 'No',
-		'module_desc': 'Material Management',
-		'module_icon': 'Stock.gif',
-		'module_label': 'Stock',
-		'module_name': 'Stock',
-		'module_seq': 7,
-		'name': '__common__'
-	},
-
-	# Module Def, Stock
-	{
-		'doctype': u'Module Def',
-		'name': 'Stock'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Item master',
-		'display_name': 'Item',
-		'doc_name': 'Item',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'name\nitem_group\ndescription'
-	},
-
-	# Module Def Item
-	{
-		'description': 'A unique number identifying each entity of an item',
-		'display_name': 'Serial No',
-		'doc_name': 'Serial No',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'item_code\nstatus\nwarehouse\npr_no\ndelivery_note_no\ncustomer'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Record of items added, removed or moved from one warehouse to another.',
-		'display_name': 'Stock Entry',
-		'doc_name': 'Stock Entry',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'transfer_date\npurpose\nfrom_warehouse\nto_warehouse\nremarks'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Record of items delivered to your customers along with the Printed Note',
-		'display_name': 'Delivery Note',
-		'doc_name': 'Delivery Note',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'status\ntransaction_date\ncustomer\nterritory\ngrand_total\nper_billed'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Generate Packing Slips based on a Delivery Note',
-		'display_name': 'Packing Slip',
-		'doc_name': 'Packing Slip',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'delivery_note\nfrom_case_no\nto_case_no\nnet_weight_pkg\ngross_weight_pkg'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Record of incoming material from your suppliers',
-		'display_name': 'Purchase Receipt',
-		'doc_name': 'Purchase Receipt',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'status\ntransaction_date\nsupplier\ngrand_total\nper_billed'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Details of Installation done after delivery',
-		'display_name': 'Installation Note',
-		'doc_name': 'Installation Note',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Create Quality Inspection Report for any item',
-		'display_name': 'Inspection Report',
-		'doc_name': 'QA Inspection Report',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'inspection_type\nitem_code\nreport_date\npurchase_receipt_no\ndelivery_note_no'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Reconcile your stock by uploading it form an excel file',
-		'display_name': 'Stock Reconciliation',
-		'doc_name': 'Stock Reconciliation',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'reconciliation_date\nreconciliation_time\nremark'
-	},
-
-	# Module Def Item
-	{
-		'description': 'This utility tool will update Stock UOM in Item and will respectively update Actual Qty in Stock Ledger as per Conversion Factor.',
-		'display_name': 'Stock UOM Replace Utility',
-		'doc_name': 'Stock UOM Replace Utility',
-		'doc_type': 'Single DocType',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'description': 'This utility will help in tracking stock for Sales Return and Purchase Return.',
-		'display_name': 'Sales and Purchase Return Wizard',
-		'doc_name': 'Sales and Purchase Return Wizard',
-		'doc_type': 'Single DocType',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'description': 'You can create master template for landed cost wizard',
-		'display_name': 'Landed Cost Master',
-		'doc_name': 'Landed Cost Master',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'icon': 'accept.gif'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Add extra expenses into Purchase Receipt which should be consider for item valuation. The cost will be added proportionately as per purchase receipt value.',
-		'display_name': 'Landed Cost Wizard',
-		'doc_name': 'Landed Cost Wizard',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'icon': 'accept.gif'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Stock Ledger',
-		'doc_name': 'Stock Ledger Entry',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Stock Level',
-		'doc_name': 'Bin',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Shortage To Indent',
-		'doc_name': 'Item',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Stock Value as per Item and Warehouse',
-		'display_name': 'Stock Report',
-		'doc_name': 'Stock Ledger Entry',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Stock Aging Report',
-		'doc_name': 'Serial No',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Material User'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Material Master Manager'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Material Manager'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Quality Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt b/erpnext/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt
index b33b28d..30181e3 100644
--- a/erpnext/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt
+++ b/erpnext/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt
@@ -14,7 +14,7 @@
 	{
 		'doc_type': 'Delivery Note',
 		'doctype': 'Print Format',
-		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Georgia", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Georgia", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Delivery Note\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'delivery_note_details\',\n\t\t\t\t\'Delivery Note Detail\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'basic_rate\', \'amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'10%\', \'15%\', \'32%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tvar to_append = \'\'\n\t\t\t\t\t\tif(data_row.adj_rate){\n\t\t\t\t\t\t\tto_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(data_row.serial_no) {\n\t\t\t\t\t\t\tto_append = \'<div style="padding-left: 15px;"><i>Serial No.:\' + \n\t\t\t\t\t\t\t\t((data_row.serial_no.indexOf(\'\\n\')>-1)?\'<br />\':\'&nbsp;\') + \n\t\t\t\t\t\t\t\tdata_row.serial_no + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'RV Tax Detail\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>\'<h1>\' + (doc.select_print_heading || \'Delivery Note\') + \'</h1>\'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Delivery Note Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<script>doc.sales_order_no</script><br />\n\t\t\t\t\t\t\t<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
+		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Georgia", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Georgia", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Delivery Note\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'delivery_note_details\',\n\t\t\t\t\'Delivery Note Item\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'basic_rate\', \'amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'10%\', \'15%\', \'32%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tvar to_append = \'\'\n\t\t\t\t\t\tif(data_row.adj_rate){\n\t\t\t\t\t\t\tto_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(data_row.serial_no) {\n\t\t\t\t\t\t\tto_append = \'<div style="padding-left: 15px;"><i>Serial No.:\' + \n\t\t\t\t\t\t\t\t((data_row.serial_no.indexOf(\'\\n\')>-1)?\'<br />\':\'&nbsp;\') + \n\t\t\t\t\t\t\t\tdata_row.serial_no + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'Sales Taxes and Charges\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>\'<h1>\' + (doc.select_print_heading || \'Delivery Note\') + \'</h1>\'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Delivery Note Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<script>doc.sales_order_no</script><br />\n\t\t\t\t\t\t\t<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
 		'module': 'Stock',
 		'name': '__common__',
 		'standard': 'Yes'
diff --git a/erpnext/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt b/erpnext/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt
index 065f3f4..8da9cb7 100644
--- a/erpnext/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt
+++ b/erpnext/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt
@@ -14,7 +14,7 @@
 	{
 		'doc_type': 'Delivery Note',
 		'doctype': 'Print Format',
-		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Helvetica", "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Helvetica", "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Delivery Note\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'delivery_note_details\',\n\t\t\t\t\'Delivery Note Detail\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'basic_rate\', \'amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'10%\', \'15%\', \'32%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tvar to_append = \'\'\n\t\t\t\t\t\tif(data_row.adj_rate){\n\t\t\t\t\t\t\tto_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(data_row.serial_no) {\n\t\t\t\t\t\t\tto_append = \'<div style="padding-left: 15px;"><i>Serial No.:\' + \n\t\t\t\t\t\t\t\t((data_row.serial_no.indexOf(\'\\n\')>-1)?\'<br />\':\'&nbsp;\') + \n\t\t\t\t\t\t\t\tdata_row.serial_no + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'RV Tax Detail\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>\'<h1>\' + (doc.select_print_heading || \'Delivery Note\') + \'</h1>\'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style="height:15px"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class=\'imp-details\'>\n\t\t\t\t\t\t<td><b>Delivery Note No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Delivery Note Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<script>doc.sales_order_no</script><br />\n\t\t\t\t\t\t\t<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\' class=\'imp-details\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>\n',
+		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Helvetica", "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Helvetica", "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Delivery Note\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'delivery_note_details\',\n\t\t\t\t\'Delivery Note Item\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'basic_rate\', \'amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'10%\', \'15%\', \'32%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tvar to_append = \'\'\n\t\t\t\t\t\tif(data_row.adj_rate){\n\t\t\t\t\t\t\tto_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(data_row.serial_no) {\n\t\t\t\t\t\t\tto_append = \'<div style="padding-left: 15px;"><i>Serial No.:\' + \n\t\t\t\t\t\t\t\t((data_row.serial_no.indexOf(\'\\n\')>-1)?\'<br />\':\'&nbsp;\') + \n\t\t\t\t\t\t\t\tdata_row.serial_no + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'Sales Taxes and Charges\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>\'<h1>\' + (doc.select_print_heading || \'Delivery Note\') + \'</h1>\'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style="height:15px"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class=\'imp-details\'>\n\t\t\t\t\t\t<td><b>Delivery Note No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Delivery Note Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<script>doc.sales_order_no</script><br />\n\t\t\t\t\t\t\t<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\' class=\'imp-details\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>\n',
 		'module': 'Stock',
 		'name': '__common__',
 		'standard': 'Yes'
diff --git a/erpnext/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt b/erpnext/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt
index 1309b5c..7e5fd31 100644
--- a/erpnext/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt
+++ b/erpnext/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt
@@ -14,7 +14,7 @@
 	{
 		'doc_type': 'Delivery Note',
 		'doctype': 'Print Format',
-		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Delivery Note\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'delivery_note_details\',\n\t\t\t\t\'Delivery Note Detail\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'basic_rate\', \'amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'10%\', \'15%\', \'32%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tvar to_append = \'\'\n\t\t\t\t\t\tif(data_row.adj_rate){\n\t\t\t\t\t\t\tto_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(data_row.serial_no) {\n\t\t\t\t\t\t\tto_append = \'<div style="padding-left: 15px;"><i>Serial No.:\' + \n\t\t\t\t\t\t\t\t((data_row.serial_no.indexOf(\'\\n\')>-1)?\'<br />\':\'&nbsp;\') + \n\t\t\t\t\t\t\t\tdata_row.serial_no + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'RV Tax Detail\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>\'<h1>\' + (doc.select_print_heading || \'Delivery Note\') + \'</h1>\'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Delivery Note Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<script>doc.sales_order_no</script><br />\n\t\t\t\t\t\t\t<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
+		'html': '<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: "Arial", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t\tline-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: "Arial", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t\'Delivery Note\',\n\t\t\t\tdoc.name,\n\t\t\t\t\'delivery_note_details\',\n\t\t\t\t\'Delivery Note Item\',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t\'SR\', \'item_code\', \'item_name\', \'description\', \'qty\', \'stock_uom\',\n\t\t\t\t\t\'basic_rate\', \'amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t\'Sr\', \'Item Code\', \'Item Name\', \'Description\', \'Qty\',\n\t\t\t\t\t\'UoM\', \'Basic Rate\', \'Amount\'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t\'3%\', \'10%\', \'15%\', \'32%\', \'5%\',\n\t\t\t\t\t\'5%\', \'15%\', \'15%\'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t\'description\' : function(data_row) {\n\t\t\t\t\t\tvar to_append = \'\'\n\t\t\t\t\t\tif(data_row.adj_rate){\n\t\t\t\t\t\t\tto_append = \'<div style="padding-left: 15px;"><i>Discount: \' + \n\t\t\t\t\t\t\t\tdata_row.adj_rate + \'% on \' + doc.currency + \' \' +\n\t\t\t\t\t\t\t\tfmt_money(data_row.ref_rate) + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(data_row.serial_no) {\n\t\t\t\t\t\t\tto_append = \'<div style="padding-left: 15px;"><i>Serial No.:\' + \n\t\t\t\t\t\t\t\t((data_row.serial_no.indexOf(\'\\n\')>-1)?\'<br />\':\'&nbsp;\') + \n\t\t\t\t\t\t\t\tdata_row.serial_no + \'</i></div>\';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = \'\';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t\'<div style = "page-break-after: always;" \\\n\t\t\t\t\t\tclass = "page_break"></div>\\\n\t\t\t\t\t\t<div class="page-settings"></div>\';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren(\'Sales Taxes and Charges\', doc.name, \'other_charges\');\n\t\t\tvar rows = \'<table width=100%>\\n\';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t\'<tr>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td>\' + oc[i].description + \'</td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td></td>\\n\' +\n\t\t\t\t\t\t\t\'\\t<td width=38%>\' + fmt_money(oc[i].tax_amount) + \'</td>\\n\' +\n\t\t\t\t\t\t\'</tr>\\n\';\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn rows + \'</table>\\n\';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class=\'common page-header\'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class=\'header-table\' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>\'<h1>\' + (doc.select_print_heading || \'Delivery Note\') + \'</h1>\'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Delivery Note Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<script>doc.sales_order_no</script><br />\n\t\t\t\t\t\t\t<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class=\'common page-body\'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class=\'common page-footer\'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class=\'footer-table\' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style=\'padding-right: 10px;\'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td width=38%><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.net_total)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.grand_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style=\'font-weight: bold\'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td><script>doc.currency</script></td>\n\t\t\t\t\t\t\t<td><script>\n\t\t\t\t\t\t\t\tfmt_money(doc.rounded_total_export)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n',
 		'module': 'Stock',
 		'name': '__common__',
 		'standard': 'Yes'
diff --git a/erpnext/stock/Print Format/Purchase Receipt Format/Purchase Receipt Format.txt b/erpnext/stock/Print Format/Purchase Receipt Format/Purchase Receipt Format.txt
index 8ffb83e..4cfaeb9 100644
--- a/erpnext/stock/Print Format/Purchase Receipt Format/Purchase Receipt Format.txt
+++ b/erpnext/stock/Print Format/Purchase Receipt Format/Purchase Receipt Format.txt
@@ -13,7 +13,7 @@
 	# These values are common for all Print Format
 	{
 		'doctype': 'Print Format',
-		'html': '<html>\n<head>\n<!--Other charges function-->\n<script>\n    var make_row = function(title,val,bold){\n    var bstart = \'<b>\'; var bend = \'</b>\';\n    return \'<tr><td style="width:50%">\'+(bold?bstart:\'\')+title+(bold?bend:\'\')+\'</td>\'\n              +\'<td style="width:20%;text-align:right">\'+doc.currency+\'</td>\'\n              +\'<td style="width:30%;text-align:right">\'+(val?val:\'0.00\')+\'</td>\'\n              +\'</tr>\'\n  }\n\n  function get_other_charges(){\n    var out =\'\';\n    out += \'<div><table class="noborder" style="width:100%">\';\n    out += make_row(\'Total Amount\',fmt_money(convert_rate(doc.total_amount)),1)\n          +make_row(\'Grand Total\',fmt_money(convert_rate(doc.grand_total)),1);\n    out += \'</table></div>\';\n    return out;\n  }\n\n  function get_buying_costs(){\n    var out =\'\';\n    if(doc.buying_cost_transport || doc.buying_cost_taxes || doc.buying_cost_other){\n      out += \'<div><table class="noborder" style="width:100%">\'\n            + \'<tr><td style="width:100%"><b>\'+\'Buying Cost Details\'+\'</b></td></tr>\';\n      if(doc.buying_cost_transport){ out += make_row(\'Transport Cost\',fmt_money(convert_rate(doc.buying_cost_transport)),0)}\n      if(doc.buying_cost_taxes){ out += make_row(\'Taxes\',fmt_money(convert_rate(doc.buying_cost_taxes)),0)}\n      if(doc.buying_cost_other){ out += make_row(\'Other Cost\',fmt_money(convert_rate(doc.buying_cost_other)),0)}\n      out += \'</table></div>\';\n    }\n    return out;\n  }\n\nfunction get_letter_head() {\n\t// add letter head\n\tvar cp = locals[\'Control Panel\'][\'Control Panel\'];\n\tif(doc.letter_head)\n\t\tvar lh= cstr(_p.letter_heads[doc.letter_head]);\n\telse if(cp.letter_head)\n\t\tvar lh= cp.letter_head;\n\telse \n\t\tvar lh= \'\';\n\t\t\n\treturn lh;\n}\n\n  \n  function convert_rate(val){\n    var new_val = flt(val)/flt(doc.conversion_rate);\n    return new_val;\n  }\n  \n    function get_transport_details(){\n    var out = \'\';\n    if(doc.transporter_name || doc.lr_no || doc.lr_date){\n     out += \'<div><table class="noborder" style="width:40%">\'\n            +\'<tr><td style="width:80%"><b>\' + \'Transporter Details\'+\'</b></td><td style="width:20%"></td></tr>\'\n\n     if(doc.transporter_name){ out += \'<tr><td style="width:40%">\' + \'Transporter Name\'+\'</td><td style="width:60%">\'+doc.transporter_name+\'</td></tr>\'}\n     if(doc.lr_no){ out += \'<tr><td style="width:40%">\' + \'LR No\'+\'</td><td style="width:60%">\'+doc.lr_no+\'</td></tr>\'}\n     if(doc.lr_date){ out += \'<tr><td style="width:40%">\' + \'LR Date\'+\'</td><td style="width:60%">\'+doc.lr_date+\'</td></tr>\'}\n     out += \'</table></div>\'\n    }\n    return out;\n  }\n\n</script>\n</head>\n<body>\n<div style="border:1px solid black;padding:15px">\n<!--header-->\n<div><script>get_letter_head()</script></div>\n<div style="border-bottom: 1px solid; padding-bottom: 5px;">\n <div><br><b>Purchase Receipt: <script>doc.name</script></b></div>\n <div>Date: <script>date.str_to_user(doc.transaction_date)</script></div>\n</div>\n\n<div style="padding-top:15px">\n<div><script>doc.supplier</script></div>\n<div><br><script>replace_newlines(doc.address_display)</script></div>\n</div>\n\n<div>\n<br>\n    <script>\n    var t = print_table(\'Purchase Receipt\', doc.name, \'purchase_receipt_details\', \'Purchase Receipt Detail\', [\'SR\', \'item_code\',\'description\',\'received_qty\',\'qty\',\'rejected_qty\',\'po_rate\',\'amount\',\'billed_qty\'], [\'Sr\', \'Item Code\', \'Description\',\'Received Quantity\',\'Accepted Qty\',\'Rejected Qty\',\'Rate\',\'Amount\',\'Billed Qty\'], [\'4%\',\'12%\', \'24%\', \'10%\',\'10%\',\'10%\',\'10%\',\'10%\',\'10%\'])\n    if(t.appendChild) {\n      // single\n      out = t.innerHTML;\n    } \n    else {//multiple\n      out = \'\'\n      for(var i=0;i<t.length;i++) {\n        if(i!=t.length-1){\n          out += \'<div style:"padding-top:5px;"></div>\' + t[i].innerHTML +\'<div style="page-break-after:always"></div>\';\n        }\n        else out += \'<div style:"padding-top:5px;"></div>\' + t[i].innerHTML;\n      }\n    }\n    out;\n    </script>\n\n</div>\n\n<!--Other charges table-->\n<div>\n<table style="width:100%">\n  <tr><td style="width:40%"><script>get_buying_costs()</script></td>\n  <td style="width:20%"></td><td style="width:40%"><script>get_other_charges()</script></td></tr>\n</table>\n</div>\n<div><script>get_transport_details()</script></div>\n<div><br>Payment Terms</div>\n<div><br><script>replace_newlines(doc.payment_terms)</script></div>\n<div><br>For NCSCI</div>\n<div><br><br>(Authorised Signatory)</div>\n</div></body>\n</html>',
+		'html': '<html>\n<head>\n<!--Other charges function-->\n<script>\n    var make_row = function(title,val,bold){\n    var bstart = \'<b>\'; var bend = \'</b>\';\n    return \'<tr><td style="width:50%">\'+(bold?bstart:\'\')+title+(bold?bend:\'\')+\'</td>\'\n              +\'<td style="width:20%;text-align:right">\'+doc.currency+\'</td>\'\n              +\'<td style="width:30%;text-align:right">\'+(val?val:\'0.00\')+\'</td>\'\n              +\'</tr>\'\n  }\n\n  function get_other_charges(){\n    var out =\'\';\n    out += \'<div><table class="noborder" style="width:100%">\';\n    out += make_row(\'Total Amount\',fmt_money(convert_rate(doc.total_amount)),1)\n          +make_row(\'Grand Total\',fmt_money(convert_rate(doc.grand_total)),1);\n    out += \'</table></div>\';\n    return out;\n  }\n\n  function get_buying_costs(){\n    var out =\'\';\n    if(doc.buying_cost_transport || doc.buying_cost_taxes || doc.buying_cost_other){\n      out += \'<div><table class="noborder" style="width:100%">\'\n            + \'<tr><td style="width:100%"><b>\'+\'Buying Cost Details\'+\'</b></td></tr>\';\n      if(doc.buying_cost_transport){ out += make_row(\'Transport Cost\',fmt_money(convert_rate(doc.buying_cost_transport)),0)}\n      if(doc.buying_cost_taxes){ out += make_row(\'Taxes\',fmt_money(convert_rate(doc.buying_cost_taxes)),0)}\n      if(doc.buying_cost_other){ out += make_row(\'Other Cost\',fmt_money(convert_rate(doc.buying_cost_other)),0)}\n      out += \'</table></div>\';\n    }\n    return out;\n  }\n\nfunction get_letter_head() {\n\t// add letter head\n\tvar cp = locals[\'Control Panel\'][\'Control Panel\'];\n\tif(doc.letter_head)\n\t\tvar lh= cstr(_p.letter_heads[doc.letter_head]);\n\telse if(cp.letter_head)\n\t\tvar lh= cp.letter_head;\n\telse \n\t\tvar lh= \'\';\n\t\t\n\treturn lh;\n}\n\n  \n  function convert_rate(val){\n    var new_val = flt(val)/flt(doc.conversion_rate);\n    return new_val;\n  }\n  \n    function get_transport_details(){\n    var out = \'\';\n    if(doc.transporter_name || doc.lr_no || doc.lr_date){\n     out += \'<div><table class="noborder" style="width:40%">\'\n            +\'<tr><td style="width:80%"><b>\' + \'Transporter Details\'+\'</b></td><td style="width:20%"></td></tr>\'\n\n     if(doc.transporter_name){ out += \'<tr><td style="width:40%">\' + \'Transporter Name\'+\'</td><td style="width:60%">\'+doc.transporter_name+\'</td></tr>\'}\n     if(doc.lr_no){ out += \'<tr><td style="width:40%">\' + \'LR No\'+\'</td><td style="width:60%">\'+doc.lr_no+\'</td></tr>\'}\n     if(doc.lr_date){ out += \'<tr><td style="width:40%">\' + \'LR Date\'+\'</td><td style="width:60%">\'+doc.lr_date+\'</td></tr>\'}\n     out += \'</table></div>\'\n    }\n    return out;\n  }\n\n</script>\n</head>\n<body>\n<div style="border:1px solid black;padding:15px">\n<!--header-->\n<div><script>get_letter_head()</script></div>\n<div style="border-bottom: 1px solid; padding-bottom: 5px;">\n <div><br><b>Purchase Receipt: <script>doc.name</script></b></div>\n <div>Date: <script>date.str_to_user(doc.transaction_date)</script></div>\n</div>\n\n<div style="padding-top:15px">\n<div><script>doc.supplier</script></div>\n<div><br><script>replace_newlines(doc.address_display)</script></div>\n</div>\n\n<div>\n<br>\n    <script>\n    var t = print_table(\'Purchase Receipt\', doc.name, \'purchase_receipt_details\', \'Purchase Receipt Item\', [\'SR\', \'item_code\',\'description\',\'received_qty\',\'qty\',\'rejected_qty\',\'po_rate\',\'amount\',\'billed_qty\'], [\'Sr\', \'Item Code\', \'Description\',\'Received Quantity\',\'Accepted Qty\',\'Rejected Qty\',\'Rate\',\'Amount\',\'Billed Qty\'], [\'4%\',\'12%\', \'24%\', \'10%\',\'10%\',\'10%\',\'10%\',\'10%\',\'10%\'])\n    if(t.appendChild) {\n      // single\n      out = t.innerHTML;\n    } \n    else {//multiple\n      out = \'\'\n      for(var i=0;i<t.length;i++) {\n        if(i!=t.length-1){\n          out += \'<div style:"padding-top:5px;"></div>\' + t[i].innerHTML +\'<div style="page-break-after:always"></div>\';\n        }\n        else out += \'<div style:"padding-top:5px;"></div>\' + t[i].innerHTML;\n      }\n    }\n    out;\n    </script>\n\n</div>\n\n<!--Other charges table-->\n<div>\n<table style="width:100%">\n  <tr><td style="width:40%"><script>get_buying_costs()</script></td>\n  <td style="width:20%"></td><td style="width:40%"><script>get_other_charges()</script></td></tr>\n</table>\n</div>\n<div><script>get_transport_details()</script></div>\n<div><br>Payment Terms</div>\n<div><br><script>replace_newlines(doc.payment_terms)</script></div>\n<div><br>For NCSCI</div>\n<div><br><br>(Authorised Signatory)</div>\n</div></body>\n</html>',
 		'module': 'Stock',
 		'name': '__common__',
 		'standard': 'Yes'
diff --git a/erpnext/stock/Role/Material Manager/Material Manager.txt b/erpnext/stock/Role/Material Manager/Material Manager.txt
deleted file mode 100644
index 1d6369b..0000000
--- a/erpnext/stock/Role/Material Manager/Material Manager.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Material Manager
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2009-03-19 14:56:51',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Stock',
-		'name': '__common__',
-		'role_name': 'Material Manager'
-	},
-
-	# Role, Material Manager
-	{
-		'doctype': 'Role',
-		'name': 'Material Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/stock/Role/Material Master Manager/Material Master Manager.txt b/erpnext/stock/Role/Material Master Manager/Material Master Manager.txt
deleted file mode 100644
index 10fac2c..0000000
--- a/erpnext/stock/Role/Material Master Manager/Material Master Manager.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Material Master Manager
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2010-04-08 13:49:58',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Stock',
-		'name': '__common__',
-		'role_name': 'Material Master Manager'
-	},
-
-	# Role, Material Master Manager
-	{
-		'doctype': 'Role',
-		'name': 'Material Master Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/stock/Role/Material User/Material User.txt b/erpnext/stock/Role/Material User/Material User.txt
deleted file mode 100644
index 1436ccb..0000000
--- a/erpnext/stock/Role/Material User/Material User.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Material User
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2010-04-08 12:08:13',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Stock',
-		'name': '__common__',
-		'role_name': 'Material User'
-	},
-
-	# Role, Material User
-	{
-		'doctype': 'Role',
-		'name': 'Material User'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/stock/Role/Quality Manager/Quality Manager.txt b/erpnext/stock/Role/Quality Manager/Quality Manager.txt
deleted file mode 100644
index 226e9aa..0000000
--- a/erpnext/stock/Role/Quality Manager/Quality Manager.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Quality Manager
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2010-05-04 13:12:27',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Stock',
-		'name': '__common__',
-		'role_name': 'Quality Manager'
-	},
-
-	# Role, Quality Manager
-	{
-		'doctype': 'Role',
-		'name': 'Quality Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/stock/__init__.py b/erpnext/stock/__init__.py
index e69de29..f171425 100644
--- a/erpnext/stock/__init__.py
+++ b/erpnext/stock/__init__.py
@@ -0,0 +1,6 @@
+install_docs = [
+	{"doctype":"Role", "role_name":"Material Manager", "name":"Material Manager"},
+	{"doctype":"Role", "role_name":"Material Master Manager", "name":"Material Master Manager"},
+	{"doctype":"Role", "role_name":"Material User", "name":"Material User"},
+	{"doctype":"Role", "role_name":"Quality Manager", "name":"Quality Manager"},
+]
diff --git a/erpnext/stock/doctype/batch/batch.txt b/erpnext/stock/doctype/batch/batch.txt
index f589b12..85dbef3 100644
--- a/erpnext/stock/doctype/batch/batch.txt
+++ b/erpnext/stock/doctype/batch/batch.txt
@@ -3,155 +3,146 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:52',
+		'creation': '2012-03-27 14:36:26',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'harshada@webnotestech.com'
+		'modified': '2012-03-27 14:36:26',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
 		'allow_trash': 1,
-		'autoname': 'field:batch_id',
-		'colour': 'White:FFF',
+		'autoname': u'field:batch_id',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'Stock',
+		'document_type': u'Master',
+		'module': u'Stock',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 12
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Batch',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Batch',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Batch',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Batch',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1,
-		'role': 'Material Master Manager'
+		'role': u'Material Master Manager'
 	},
 
 	# DocType, Batch
 	{
 		'doctype': 'DocType',
-		'name': 'Batch'
+		'name': u'Batch'
 	},
 
 	# DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
+		'doctype': u'DocPerm',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'batch_id',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Batch ID',
+		'doctype': u'DocField',
+		'fieldname': u'batch_id',
+		'fieldtype': u'Data',
+		'label': u'Batch ID',
 		'no_copy': 1,
-		'oldfieldname': 'batch_id',
-		'oldfieldtype': 'Data',
+		'oldfieldname': u'batch_id',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Small Text',
-		'idx': 3,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Small Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 0,
-		'width': '300px'
+		'width': u'300px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'start_date',
-		'fieldtype': 'Date',
-		'idx': 4,
-		'label': 'Batch Started Date',
-		'oldfieldname': 'start_date',
-		'oldfieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'start_date',
+		'fieldtype': u'Date',
+		'label': u'Batch Started Date',
+		'oldfieldname': u'start_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'finished_date',
-		'fieldtype': 'Date',
-		'idx': 5,
-		'label': 'Batch Finished Date',
-		'oldfieldname': 'finished_date',
-		'oldfieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'finished_date',
+		'fieldtype': u'Date',
+		'label': u'Batch Finished Date',
+		'oldfieldname': u'finished_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'expiry_date',
-		'fieldtype': 'Date',
-		'idx': 6,
-		'label': 'Expiry Date',
-		'oldfieldname': 'expiry_date',
-		'oldfieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'expiry_date',
+		'fieldtype': u'Date',
+		'label': u'Expiry Date',
+		'oldfieldname': u'expiry_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'item',
-		'fieldtype': 'Link',
-		'idx': 7,
-		'label': 'Item',
-		'oldfieldname': 'item',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
+		'doctype': u'DocField',
+		'fieldname': u'item',
+		'fieldtype': u'Link',
+		'label': u'Item',
+		'oldfieldname': u'item',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
 		'permlevel': 0,
 		'reqd': 1
 	}
diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py
index 8e1c949..a6fc1c4 100644
--- a/erpnext/stock/doctype/bin/bin.py
+++ b/erpnext/stock/doctype/bin/bin.py
@@ -78,10 +78,7 @@
 				msg = """Actual Qty(%s) in Bin is mismatched with total number(%s) of serial no in store 
 					for item: '%s' and warehouse: '%s'""" % \
 					(self.doc.actual_qty, sr_count, self.doc.item_code, self.doc.warehouse)
-					
-				if getattr(webnotes.defs,'admin_email_notification',1):
-					sendmail(['developers@iwebnotes.com'], sender='automail@webnotestech.com', \
-						subject='Serial No Count vs Bin Actual Qty', parts=[['text/plain', msg]])			
+
 				msgprint(msg, raise_exception=1)
 
 	# --------------------------------
@@ -333,7 +330,7 @@
 	def reorder_item(self,doc_type,doc_name):
 		""" Reorder item if stock reaches reorder level"""
 
-		if get_value('Manage Account', None, 'auto_indent'):
+		if get_value('Global Defaults', None, 'auto_indent'):
 			#check if re-order is required
 			ret = sql("select re_order_level, item_name, description, brand, item_group, lead_time_days, min_order_qty, email_notify, re_order_qty from tabItem where item_code = %s", (self.doc.item_code), as_dict=1)
 			
@@ -354,15 +351,15 @@
 	def create_auto_indent(self, i , doc_type, doc_name, cur_qty):
 		"""	Create indent on reaching reorder level	"""
 
-		indent = Document('Indent')
+		indent = Document('Purchase Request')
 		indent.transaction_date = nowdate()
 		indent.naming_series = 'IDT'
 		indent.company = get_defaults()['company']
 		indent.fiscal_year = get_defaults()['fiscal_year']
-		indent.remark = "This is an auto generated Indent. It was raised because the (actual + ordered + indented - reserved) quantity reaches re-order level when %s %s was created"%(doc_type,doc_name)
+		indent.remark = "This is an auto generated Purchase Request. It was raised because the (actual + ordered + indented - reserved) quantity reaches re-order level when %s %s was created"%(doc_type,doc_name)
 		indent.save(1)
-		indent_obj = get_obj('Indent',indent.name,with_children=1)
-		indent_details_child = addchild(indent_obj.doc,'indent_details','Indent Detail',0)
+		indent_obj = get_obj('Purchase Request',indent.name,with_children=1)
+		indent_details_child = addchild(indent_obj.doc,'indent_details','Purchase Request Item',0)
 		indent_details_child.item_code = self.doc.item_code
 		indent_details_child.uom = self.doc.stock_uom
 		indent_details_child.warehouse = self.doc.warehouse
@@ -373,11 +370,11 @@
 		indent_details_child.qty = i['re_order_qty'] or (flt(i['re_order_level']) - flt(cur_qty))
 		indent_details_child.brand = i['brand']
 		indent_details_child.save()
-		indent_obj = get_obj('Indent',indent.name,with_children=1)
+		indent_obj = get_obj('Purchase Request',indent.name,with_children=1)
 		indent_obj.validate()
 		set(indent_obj.doc,'docstatus',1)
 		indent_obj.on_submit()
-		msgprint("Item: " + self.doc.item_code + " is to be re-ordered. Indent %s raised. It was generated from %s %s"%(indent.name,doc_type, doc_name ))
+		msgprint("Item: " + self.doc.item_code + " is to be re-ordered. Purchase Request %s raised. It was generated from %s %s"%(indent.name,doc_type, doc_name ))
 		if(i['email_notify']):
 			send_email_notification(doc_type,doc_name)
 			
@@ -387,9 +384,9 @@
 		""" Notify user about auto creation of indent"""
 
 		email_list=[d for d in sql("select parent from tabUserRole where role in ('Purchase Manager','Material Manager') ")]
-		msg1='An Indent has been raised for item %s: %s on %s '%(doc_type, doc_name, nowdate())
+		msg1='A Purchase Request has been raised for item %s: %s on %s '%(doc_type, doc_name, nowdate())
 		sendmail(email_list, sender='automail@webnotestech.com', \
-		subject='Auto Indent Generation Notification', parts=[['text/plain',msg1]])	
+		subject='Auto Purchase Request Generation Notification', parts=[['text/plain',msg1]])	
 
 
 
diff --git a/erpnext/stock/doctype/bin/bin.txt b/erpnext/stock/doctype/bin/bin.txt
index c0c525e..7956e67 100644
--- a/erpnext/stock/doctype/bin/bin.txt
+++ b/erpnext/stock/doctype/bin/bin.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:52',
+		'creation': '2012-03-27 14:36:27',
 		'docstatus': 0,
-		'modified': '2012-03-21 14:07:49',
+		'modified': '2012-03-27 14:36:27',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -41,17 +41,12 @@
 
 	# These values are common for all DocPerm
 	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
 		'doctype': u'DocPerm',
 		'name': '__common__',
 		'parent': u'Bin',
 		'parentfield': u'permissions',
 		'parenttype': u'DocType',
-		'read': 1,
-		'submit': 0,
-		'write': 0
+		'read': 1
 	},
 
 	# DocType, Bin
@@ -90,16 +85,26 @@
 
 	# DocPerm
 	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
 		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': u'Material User'
+		'role': u'Material User',
+		'submit': 0,
+		'write': 0
 	},
 
 	# DocPerm
 	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
 		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': u'Material Manager'
+		'role': u'Material Manager',
+		'submit': 0,
+		'write': 0
 	},
 
 	# DocField
@@ -184,7 +189,7 @@
 		'fieldname': u'indented_qty',
 		'fieldtype': u'Currency',
 		'in_filter': 0,
-		'label': u'Indented Quantity',
+		'label': u'Quantity Requested for Purchase',
 		'oldfieldname': u'indented_qty',
 		'oldfieldtype': u'Currency',
 		'search_index': 0
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index d2b58f8..f0fd801 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -15,14 +15,15 @@
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 // Module Material Management
-cur_frm.cscript.tname = "Delivery Note Detail";
+cur_frm.cscript.tname = "Delivery Note Item";
 cur_frm.cscript.fname = "delivery_note_details";
 cur_frm.cscript.other_fname = "other_charges";
 cur_frm.cscript.sales_team_fname = "sales_team";
 
-$import(Sales Common)
-$import(Other Charges)
-$import(SMS Control)
+wn.require('erpnext/selling/doctype/sales_common/sales_common.js');
+wn.require('erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js');
+wn.require('erpnext/utilities/doctype/sms_control/sms_control.js');
+wn.require('erpnext/setup/doctype/notification_control/notification_control.js');
 
 // ONLOAD
 // ================================================================================================
@@ -62,12 +63,7 @@
 	
 	if(doc.per_installed < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Installation Note', cur_frm.cscript['Make Installation Note']);
 
-	if (doc.docstatus!=1) {
-		hide_field(['SMS', 'Send SMS', 'message', 'customer_mobile_no', 'Repair Delivery Note']);
-	} else {
-		cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
-		unhide_field(['SMS','Send SMS', 'message', 'customer_mobile_no', 'Repair Delivery Note']);
-	}
+	if (doc.docstatus==1) cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
 
 	if(doc.docstatus==0 && !doc.__islocal) {
 		cur_frm.add_custom_button('Make Packing Slip', cur_frm.cscript['Make Packing Slip']);
@@ -83,6 +79,7 @@
 			var doc = locals[cur_frm.doctype][cur_frm.docname];
 			if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','shipping_address']);
 			cur_frm.refresh();
+			cur_frm.cscript.price_list_name(doc, dt, dn); 
 	} 
 	var args = onload ? 'onload':''
 	if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_shipping_address', args, callback);
@@ -110,7 +107,7 @@
 	return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
 }
 
-cur_frm.cscript['Get Items'] = function(doc,dt,dn) {
+cur_frm.cscript.get_items = function(doc,dt,dn) {
 	var callback = function(r,rt){
 		var doc = locals[cur_frm.doctype][cur_frm.docname];					
 		if(r.message){							
@@ -202,15 +199,15 @@
 //-----------------------------------Make Sales Invoice----------------------------------------------
 cur_frm.cscript['Make Sales Invoice'] = function() {
 	var doc = cur_frm.doc
-	n = createLocal('Receivable Voucher');
+	n = createLocal('Sales Invoice');
 	$c('dt_map', args={
-		'docs':compress_doclist([locals['Receivable Voucher'][n]]),
+		'docs':compress_doclist([locals['Sales Invoice'][n]]),
 		'from_doctype':doc.doctype,
-		'to_doctype':'Receivable Voucher',
+		'to_doctype':'Sales Invoice',
 		'from_docname':doc.name,
-		'from_to_list':"[['Delivery Note','Receivable Voucher'],['Delivery Note Detail','RV Detail'],['RV Tax Detail','RV Tax Detail'],['Sales Team','Sales Team']]"
+		'from_to_list':"[['Delivery Note','Sales Invoice'],['Delivery Note Item','Sales Invoice Item'],['Sales Taxes and Charges','Sales Taxes and Charges'],['Sales Team','Sales Team']]"
 		}, function(r,rt) {
-			 loaddoc('Receivable Voucher', n);
+			 loaddoc('Sales Invoice', n);
 		}
 	);
 }
@@ -225,7 +222,7 @@
 			'from_doctype':doc.doctype,
 			'to_doctype':'Installation Note',
 			'from_docname':doc.name,
-			'from_to_list':"[['Delivery Note','Installation Note'],['Delivery Note Detail','Installed Item Details']]"
+			'from_to_list':"[['Delivery Note','Installation Note'],['Delivery Note Item','Installation Note Item']]"
 			}, function(r,rt) {
 				 loaddoc('Installation Note', n);
 			}
@@ -244,7 +241,7 @@
 		'from_doctype':doc.doctype,
 		'to_doctype':'Packing Slip',
 		'from_docname':doc.name,
-		'from_to_list':"[['Delivery Note','Packing Slip'],['Delivery Note Detail','Packing Slip Detail']]"
+		'from_to_list':"[['Delivery Note','Packing Slip'],['Delivery Note Item','Packing Slip Item']]"
 		}, function(r,rt) {
 			 loaddoc('Packing Slip', n);
 		}
@@ -261,18 +258,21 @@
 //------------------------for printing without amount----------
 
 var set_print_hide= function(doc, cdt, cdn){
+	var dn_fields = wn.meta.docfield_map['Delivery Note'];
+	var dn_item_fields = wn.meta.docfield_map['Delivery Note Item'];
+	
 	if (doc.print_without_amount) {
-		fields['Delivery Note']['currency'].print_hide = 1;
-		fields['Delivery Note Detail']['export_rate'].print_hide = 1;
-		fields['Delivery Note Detail']['adj_rate'].print_hide = 1;
-		fields['Delivery Note Detail']['ref_rate'].print_hide = 1;
-		fields['Delivery Note Detail']['export_amount'].print_hide = 1;
+		dn_fields['currency'].print_hide = 1;
+		dn_item_fields['export_rate'].print_hide = 1;
+		dn_item_fields['adj_rate'].print_hide = 1;
+		dn_item_fields['ref_rate'].print_hide = 1;
+		dn_item_fields['export_amount'].print_hide = 1;
 	} else {
-		fields['Delivery Note']['currency'].print_hide = 0;
-		fields['Delivery Note Detail']['export_rate'].print_hide = 0;
-		fields['Delivery Note Detail']['adj_rate'].print_hide = 0;
-		fields['Delivery Note Detail']['ref_rate'].print_hide = 0;
-		fields['Delivery Note Detail']['export_amount'].print_hide = 0;
+		dn_fields['currency'].print_hide = 0;
+		dn_item_fields['export_rate'].print_hide = 0;
+		dn_item_fields['adj_rate'].print_hide = 0;
+		dn_item_fields['ref_rate'].print_hide = 0;
+		dn_item_fields['export_amount'].print_hide = 0;
 	}
 }
 
@@ -295,7 +295,7 @@
 
 	out ='';
 	
-	var cl = getchildren('Delivery Note Detail',doc.name,'delivery_note_details');
+	var cl = getchildren('Delivery Note Item',doc.name,'delivery_note_details');
 
 	// outer table	
 	var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 50%"></td><td>';
@@ -322,7 +322,6 @@
 	return out;
 }
 
-$import(Notification Control)
 cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
 	var args = {
 		type: 'Delivery Note',
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index aeccc43..51c123c 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -38,7 +38,7 @@
 	def __init__(self, doc, doclist=[]):
 		self.doc = doc
 		self.doclist = doclist
-		self.tname = 'Delivery Note Detail'
+		self.tname = 'Delivery Note Item'
 		self.fname = 'delivery_note_details'
 
 	# Autoname
@@ -62,13 +62,13 @@
 	def get_comm_rate(self, sales_partner):
 		return get_obj('Sales Common').get_comm_rate(sales_partner, self)
 
-	# *************** Pull Sales Order Details ************************
+	# *************** Pull Sales Order Items ************************
 	def pull_sales_order_details(self):
 		self.validate_prev_docname()
 		self.doc.clear_table(self.doclist,'other_charges')
 
 		if self.doc.sales_order_no:
-			get_obj('DocType Mapper', 'Sales Order-Delivery Note').dt_map('Sales Order', 'Delivery Note', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Delivery Note'],['Sales Order Detail', 'Delivery Note Detail'],['RV Tax Detail','RV Tax Detail'],['Sales Team','Sales Team']]")
+			get_obj('DocType Mapper', 'Sales Order-Delivery Note').dt_map('Sales Order', 'Delivery Note', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Delivery Note'],['Sales Order Item', 'Delivery Note Item'],['Sales Taxes and Charges','Sales Taxes and Charges'],['Sales Team','Sales Team']]")
 		else:
 			msgprint("Please select Sales Order No. whose details need to be pulled")
 
@@ -107,7 +107,8 @@
 
 	# ***************** Get Item Details ******************************
 	def get_item_details(self, args=None):
-		args = args and eval(args) or {}
+		import json
+		args = args and json.loads(args) or {}
 		if args.get('item_code'):
 			return get_obj('Sales Common').get_item_details(args, self)
 		else:
@@ -150,7 +151,7 @@
 		return get_obj('Sales Common').load_default_taxes(self)
 
 
-	# **** Pull details from other charges master (Get Other Charges) ****
+	# **** Pull details from other charges master (Get Sales Taxes and Charges Master) ****
 	def get_other_charges(self):
 		return get_obj('Sales Common').get_other_charges(self)
 
@@ -158,7 +159,7 @@
 	#check in manage account if sales order required or not.
 	# ====================================================================================
 	def so_required(self):
-		res = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = 'so_required'")
+		res = sql("select value from `tabSingles` where doctype = 'Global Defaults' and field = 'so_required'")
 		if res and res[0][0] == 'Yes':
 			 for d in getlist(self.doclist,'delivery_note_details'):
 				 if not d.prevdoc_docname:
@@ -296,9 +297,9 @@
 	# ------------------------------------------------------------------
 	def validate_items_with_prevdoc(self, d):
 		if d.prevdoc_doctype == 'Sales Order':
-			data = sql("select item_code, reserved_warehouse from `tabSales Order Detail` where parent = '%s' and name = '%s'" % (d.prevdoc_docname, d.prevdoc_detail_docname))
+			data = sql("select item_code, reserved_warehouse from `tabSales Order Item` where parent = '%s' and name = '%s'" % (d.prevdoc_docname, d.prevdoc_detail_docname))
 		if d.prevdoc_doctype == 'Purchase Receipt':
-			data = sql("select item_code, rejected_warehouse from `tabPurchase Receipt Detail` where parent = '%s' and name = '%s'" % (d.prevdoc_docname, d.prevdoc_detail_docname))
+			data = sql("select item_code, rejected_warehouse from `tabPurchase Receipt Item` where parent = '%s' and name = '%s'" % (d.prevdoc_docname, d.prevdoc_detail_docname))
 		if not data or data[0][0] != d.item_code or data[0][1] != d.warehouse:
 			msgprint("Item: %s / Warehouse: %s is not matching with Sales Order: %s. Sales Order might be modified after fetching data from it. Please delete items and fetch again." % (d.item_code, d.warehouse, d.prevdoc_docname))
 			raise Exception
@@ -341,11 +342,11 @@
 			Validate that if packed qty exists, it should be equal to qty
 		"""
 		if not any([flt(d.fields.get('packed_qty')) for d in self.doclist if
-				d.doctype=='Delivery Note Detail']):
+				d.doctype=='Delivery Note Item']):
 			return
 		packing_error_list = []
 		for d in self.doclist:
-			if d.doctype != 'Delivery Note Detail': continue
+			if d.doctype != 'Delivery Note Item': continue
 			if flt(d.fields.get('qty')) != flt(d.fields.get('packed_qty')):
 				packing_error_list.append([
 					d.fields.get('item_code', ''),
@@ -377,12 +378,12 @@
 
 	# ******************** Check Next DocStatus **************************
 	def check_next_docstatus(self):
-		submit_rv = sql("select t1.name from `tabReceivable Voucher` t1,`tabRV Detail` t2 where t1.name = t2.parent and t2.delivery_note = '%s' and t1.docstatus = 1" % (self.doc.name))
+		submit_rv = sql("select t1.name from `tabSales Invoice` t1,`tabSales Invoice Item` t2 where t1.name = t2.parent and t2.delivery_note = '%s' and t1.docstatus = 1" % (self.doc.name))
 		if submit_rv:
 			msgprint("Sales Invoice : " + cstr(submit_rv[0][0]) + " has already been submitted !")
 			raise Exception , "Validation Error."
 
-		submit_in = sql("select t1.name from `tabInstallation Note` t1, `tabInstalled Item Details` t2 where t1.name = t2.parent and t2.prevdoc_docname = '%s' and t1.docstatus = 1" % (self.doc.name))
+		submit_in = sql("select t1.name from `tabInstallation Note` t1, `tabInstallation Note Item` t2 where t1.name = t2.parent and t2.prevdoc_docname = '%s' and t1.docstatus = 1" % (self.doc.name))
 		if submit_in:
 			msgprint("Installation Note : "+cstr(submit_in[0][0]) +" has already been submitted !")
 			raise Exception , "Validation Error."
@@ -477,8 +478,4 @@
 		self.set_actual_qty()
 		get_obj('Stock Ledger').scrub_serial_nos(self)
 
-	# Repair Delivery Note
-	# ===========================================
-	def repair_delivery_note(self):
-		get_obj('Sales Common', 'Sales Common').repair_curr_doctype_details(self)
 
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.txt b/erpnext/stock/doctype/delivery_note/delivery_note.txt
index 7bbd7d5..d29acf5 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.txt
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.txt
@@ -3,30 +3,23 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-04-18 15:58:20',
+		'creation': '2012-04-11 13:18:36',
 		'docstatus': 0,
-		'modified': '2012-03-02 12:15:44',
+		'modified': '2012-04-13 11:02:43',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
 
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Delivery Note',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
 	# These values are common for all DocType
 	{
 		'_last_update': u'1330593645',
+		'allow_attach': 1,
 		'colour': u'White:FFF',
 		'default_print_format': u'Standard',
 		'doctype': 'DocType',
 		'document_type': u'Transaction',
 		'in_create': 0,
+		'is_submittable': 1,
 		'is_transaction_doc': 1,
 		'module': u'Stock',
 		'name': '__common__',
@@ -37,15 +30,15 @@
 		'show_in_menu': 0,
 		'subject': u'To %(customer_name)s on %(posting_date)s | %(per_billed)s% billed',
 		'tag_fields': u'billing_status',
-		'version': 475
+		'version': 477
 	},
 
-	# These values are common for all DocFormat
+	# These values are common for all DocField
 	{
-		'doctype': u'DocFormat',
+		'doctype': u'DocField',
 		'name': '__common__',
 		'parent': u'Delivery Note',
-		'parentfield': u'formats',
+		'parentfield': u'fields',
 		'parenttype': u'DocType'
 	},
 
@@ -79,26 +72,14 @@
 
 	# DocPerm
 	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
 		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Sales User',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Material Master Manager',
-		'submit': 1,
-		'write': 1
+		'permlevel': 1,
+		'role': u'Material User',
+		'submit': 0,
+		'write': 0
 	},
 
 	# DocPerm
@@ -115,53 +96,79 @@
 
 	# DocPerm
 	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
 		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': u'Sales Manager',
+		'role': u'Sales User',
 		'submit': 1,
 		'write': 1
 	},
 
 	# DocPerm
 	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
 		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': u'All',
+		'role': u'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Accounts User',
+		'submit': 0,
 		'write': 0
 	},
 
 	# DocPerm
 	{
 		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Accounts User'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'match': u'customer_name',
+		'permlevel': 0,
+		'role': u'Customer'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
 		'permlevel': 2,
-		'role': u'All'
-	},
-
-	# DocFormat
-	{
-		'doctype': u'DocFormat',
-		'format': u'Delivery Note Classic'
-	},
-
-	# DocFormat
-	{
-		'doctype': u'DocFormat',
-		'format': u'Delivery Note Modern'
-	},
-
-	# DocFormat
-	{
-		'doctype': u'DocFormat',
-		'format': u'Delivery Note Spartan'
+		'role': u'All',
+		'write': 1
 	},
 
 	# DocField
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'basic_info',
 		'fieldtype': u'Section Break',
 		'label': u'Basic Info',
 		'oldfieldtype': u'Section Break',
@@ -171,6 +178,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -313,6 +321,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break1',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0
@@ -516,6 +525,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'items',
 		'fieldtype': u'Section Break',
 		'label': u'Items',
 		'oldfieldtype': u'Section Break',
@@ -569,6 +579,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break2',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'width': u'50%'
@@ -626,6 +637,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'get_items',
 		'fieldtype': u'Button',
 		'hidden': 0,
 		'label': u'Get Items',
@@ -638,6 +650,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'section_break0',
 		'fieldtype': u'Section Break',
 		'permlevel': 0
 	},
@@ -648,11 +661,11 @@
 		'doctype': u'DocField',
 		'fieldname': u'delivery_note_details',
 		'fieldtype': u'Table',
-		'label': u'Delivery Note Details',
+		'label': u'Delivery Note Items',
 		'no_copy': 0,
 		'oldfieldname': u'delivery_note_details',
 		'oldfieldtype': u'Table',
-		'options': u'Delivery Note Detail',
+		'options': u'Delivery Note Item',
 		'permlevel': 0,
 		'print_hide': 0
 	},
@@ -675,6 +688,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'recalculate_values',
 		'fieldtype': u'Button',
 		'label': u'Re-Calculate Values',
 		'oldfieldtype': u'Button',
@@ -686,6 +700,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'taxes',
 		'fieldtype': u'Section Break',
 		'label': u'Taxes',
 		'oldfieldtype': u'Section Break',
@@ -695,14 +710,14 @@
 	# DocField
 	{
 		'colour': u'White:FFF',
-		'description': u'If you have created a standard template in Other Charges master, select one and click on the button below.',
+		'description': u'If you have created a standard template in Sales Taxes and Charges Master, select one and click on the button below.',
 		'doctype': u'DocField',
 		'fieldname': u'charge',
 		'fieldtype': u'Link',
-		'label': u'Charge',
+		'label': u'Taxes and Charges',
 		'oldfieldname': u'charge',
 		'oldfieldtype': u'Link',
-		'options': u'Other Charges',
+		'options': u'Sales Taxes and Charges Master',
 		'permlevel': 0,
 		'print_hide': 1
 	},
@@ -710,8 +725,9 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'get_charges',
 		'fieldtype': u'Button',
-		'label': u'Get Charges',
+		'label': u'Get Taxes and Charges',
 		'oldfieldtype': u'Button',
 		'permlevel': 0,
 		'print_hide': 1,
@@ -723,11 +739,11 @@
 		'doctype': u'DocField',
 		'fieldname': u'other_charges',
 		'fieldtype': u'Table',
-		'label': u'Other Charges',
+		'label': u'Sales Taxes and Charges',
 		'no_copy': 0,
 		'oldfieldname': u'other_charges',
 		'oldfieldtype': u'Table',
-		'options': u'RV Tax Detail',
+		'options': u'Sales Taxes and Charges',
 		'permlevel': 0
 	},
 
@@ -736,7 +752,7 @@
 		'doctype': u'DocField',
 		'fieldname': u'other_charges_total',
 		'fieldtype': u'Currency',
-		'label': u'Charges Total',
+		'label': u'Taxes and Charges Total',
 		'oldfieldname': u'other_charges_total',
 		'oldfieldtype': u'Currency',
 		'permlevel': 1,
@@ -747,6 +763,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'calculate_charges',
 		'fieldtype': u'Button',
 		'label': u'Calculate Charges',
 		'oldfieldtype': u'Button',
@@ -758,8 +775,9 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'other_charges_calculation',
 		'fieldtype': u'HTML',
-		'label': u'Other Charges Calculation',
+		'label': u'Taxes and Charges Calculation',
 		'oldfieldtype': u'HTML',
 		'permlevel': 0
 	},
@@ -768,6 +786,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'totals',
 		'fieldtype': u'Section Break',
 		'label': u'Totals',
 		'oldfieldtype': u'Section Break',
@@ -823,6 +842,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break3',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0
@@ -876,8 +896,9 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'terms_section_break',
 		'fieldtype': u'Section Break',
-		'label': u'Terms',
+		'label': u'Terms and Conditions',
 		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
@@ -887,10 +908,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'tc_name',
 		'fieldtype': u'Link',
-		'label': u'Select Terms',
+		'label': u'Select Terms and Conditions',
 		'oldfieldname': u'tc_name',
 		'oldfieldtype': u'Link',
-		'options': u'Term',
+		'options': u'Terms and Conditions',
 		'permlevel': 0,
 		'print_hide': 1
 	},
@@ -899,8 +920,9 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'get_terms',
 		'fieldtype': u'Button',
-		'label': u'Get Terms',
+		'label': u'Get Terms and Conditions',
 		'oldfieldtype': u'Button',
 		'options': u'get_tc_details',
 		'permlevel': 0,
@@ -912,8 +934,9 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'terms_html',
 		'fieldtype': u'HTML',
-		'label': u'Terms HTML',
+		'label': u'Terms and Conditions HTML',
 		'oldfieldtype': u'HTML',
 		'options': u'You can add Terms and Notes that will be printed in the Transaction',
 		'permlevel': 0,
@@ -926,7 +949,7 @@
 		'doctype': u'DocField',
 		'fieldname': u'terms',
 		'fieldtype': u'Text Editor',
-		'label': u'Term Details',
+		'label': u'Terms and Conditions Details',
 		'oldfieldname': u'terms',
 		'oldfieldtype': u'Text Editor',
 		'permlevel': 0
@@ -935,6 +958,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'transporter_info',
 		'fieldtype': u'Section Break',
 		'label': u'Transporter Info',
 		'permlevel': 0,
@@ -944,6 +968,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break4',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'print_hide': 1,
@@ -1006,6 +1031,7 @@
 		'colour': u'White:FFF',
 		'description': u'Filling in Additional Information about the Delivery Note will help you analyze your data better.',
 		'doctype': u'DocField',
+		'fieldname': u'more_info',
 		'fieldtype': u'Section Break',
 		'label': u'More Info',
 		'oldfieldtype': u'Section Break',
@@ -1052,6 +1078,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break5',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -1218,6 +1245,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'packing_list',
 		'fieldtype': u'Section Break',
 		'label': u'Packing List',
 		'oldfieldtype': u'Section Break',
@@ -1233,7 +1261,7 @@
 		'label': u'Packing Details',
 		'oldfieldname': u'packing_details',
 		'oldfieldtype': u'Table',
-		'options': u'Delivery Note Packing Detail',
+		'options': u'Delivery Note Packing Item',
 		'permlevel': 1,
 		'print_hide': 1
 	},
@@ -1242,6 +1270,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'sales_team_section_break',
 		'fieldtype': u'Section Break',
 		'label': u'Sales Team',
 		'oldfieldtype': u'Section Break',
@@ -1252,6 +1281,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break6',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'print_hide': 1,
@@ -1277,6 +1307,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break7',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'print_hide': 1,
@@ -1316,6 +1347,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'section_break1',
 		'fieldtype': u'Section Break',
 		'options': u'Simple',
 		'permlevel': 0,
@@ -1337,13 +1369,13 @@
 
 	# DocField
 	{
-		'allow_on_submit': 1,
 		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Repair Delivery Note',
-		'oldfieldtype': u'Button',
-		'options': u'repair_delivery_note',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
+		'hidden': 1,
+		'label': u'File List',
+		'no_copy': 1,
 		'permlevel': 0,
 		'print_hide': 1
 	}
-]
+]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/delivery_note_detail/delivery_note_detail.txt b/erpnext/stock/doctype/delivery_note_detail/delivery_note_detail.txt
deleted file mode 100644
index c4bacb3..0000000
--- a/erpnext/stock/doctype/delivery_note_detail/delivery_note_detail.txt
+++ /dev/null
@@ -1,437 +0,0 @@
-# DocType, Delivery Note Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:58',
-		'docstatus': 0,
-		'modified': '2012-03-05 15:00:39',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': u'1311621379',
-		'autoname': u'DND/.#######',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': u'Stock',
-		'name': '__common__',
-		'section_style': u'Tray',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 56
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Delivery Note Detail',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# DocType, Delivery Note Detail
-	{
-		'doctype': 'DocType',
-		'name': u'Delivery Note Detail'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_code',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Item Code',
-		'oldfieldname': u'item_code',
-		'oldfieldtype': u'Link',
-		'options': u'Item',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': u'Client',
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'item_name',
-		'fieldtype': u'Data',
-		'label': u'Item Name',
-		'oldfieldname': u'item_name',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'description',
-		'fieldtype': u'Small Text',
-		'label': u'Description',
-		'oldfieldname': u'description',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 0,
-		'reqd': 1,
-		'width': u'300px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'qty',
-		'fieldtype': u'Currency',
-		'label': u'Quantity',
-		'oldfieldname': u'qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'stock_uom',
-		'fieldtype': u'Data',
-		'label': u'UOM',
-		'oldfieldname': u'stock_uom',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 1,
-		'width': u'50px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'ref_rate',
-		'fieldtype': u'Currency',
-		'label': u'Price List Rate',
-		'no_copy': 0,
-		'oldfieldname': u'ref_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 0,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'adj_rate',
-		'fieldtype': u'Float',
-		'label': u'Discount (%)',
-		'oldfieldname': u'adj_rate',
-		'oldfieldtype': u'Float',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'export_rate',
-		'fieldtype': u'Currency',
-		'label': u'Rate',
-		'oldfieldname': u'export_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 0,
-		'reqd': 0,
-		'trigger': u'Client',
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'export_amount',
-		'fieldtype': u'Currency',
-		'label': u'Amount',
-		'oldfieldname': u'export_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 0,
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'base_ref_rate',
-		'fieldtype': u'Currency',
-		'label': u'Price List Rate*',
-		'oldfieldname': u'base_ref_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'basic_rate',
-		'fieldtype': u'Currency',
-		'label': u'Rate*',
-		'oldfieldname': u'basic_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 0,
-		'trigger': u'Client',
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'amount',
-		'fieldtype': u'Currency',
-		'label': u'Amount*',
-		'oldfieldname': u'amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'reqd': 0,
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'warehouse',
-		'fieldtype': u'Link',
-		'label': u'Warehouse',
-		'oldfieldname': u'warehouse',
-		'oldfieldtype': u'Link',
-		'options': u'Warehouse',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'serial_no',
-		'fieldtype': u'Text',
-		'in_filter': 1,
-		'label': u'Serial No',
-		'no_copy': 1,
-		'oldfieldname': u'serial_no',
-		'oldfieldtype': u'Text',
-		'permlevel': 0,
-		'print_hide': 0,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'batch_no',
-		'fieldtype': u'Link',
-		'label': u'Batch No',
-		'oldfieldname': u'batch_no',
-		'oldfieldtype': u'Link',
-		'options': u'Batch',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_group',
-		'fieldtype': u'Link',
-		'hidden': 1,
-		'label': u'Item Group',
-		'oldfieldname': u'item_group',
-		'oldfieldtype': u'Link',
-		'options': u'Item Group',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'brand',
-		'fieldtype': u'Link',
-		'hidden': 1,
-		'label': u'Brand Name',
-		'oldfieldname': u'brand',
-		'oldfieldtype': u'Link',
-		'options': u'Brand',
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'actual_qty',
-		'fieldtype': u'Currency',
-		'label': u'Available Qty at Warehouse',
-		'no_copy': 1,
-		'oldfieldname': u'actual_qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'billed_amt',
-		'fieldtype': u'Currency',
-		'label': u'Billed Amt',
-		'no_copy': 1,
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'installed_qty',
-		'fieldtype': u'Currency',
-		'label': u'Installed Qty',
-		'no_copy': 1,
-		'oldfieldname': u'installed_qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': u'White:FFF',
-		'default': u'0',
-		'doctype': u'DocField',
-		'fieldname': u'packed_qty',
-		'fieldtype': u'Currency',
-		'label': u'Packed Quantity',
-		'no_copy': 1,
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_doctype',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'Document Type',
-		'oldfieldname': u'prevdoc_doctype',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_docname',
-		'fieldtype': u'Data',
-		'hidden': 0,
-		'in_filter': 1,
-		'label': u'Against Document No',
-		'no_copy': 1,
-		'oldfieldname': u'prevdoc_docname',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_date',
-		'fieldtype': u'Date',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'Against Document Date',
-		'oldfieldname': u'prevdoc_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_detail_docname',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'Against Document Detail No',
-		'oldfieldname': u'prevdoc_detail_docname',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 0,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_tax_rate',
-		'fieldtype': u'Small Text',
-		'hidden': 1,
-		'label': u'Item Tax Rate',
-		'oldfieldname': u'item_tax_rate',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'page_break',
-		'fieldtype': u'Check',
-		'label': u'Page Break',
-		'oldfieldname': u'page_break',
-		'oldfieldtype': u'Check',
-		'permlevel': 0,
-		'print_hide': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/delivery_note_detail/__init__.py b/erpnext/stock/doctype/delivery_note_item/__init__.py
similarity index 100%
rename from erpnext/stock/doctype/delivery_note_detail/__init__.py
rename to erpnext/stock/doctype/delivery_note_item/__init__.py
diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.txt b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.txt
new file mode 100644
index 0000000..c1ea5d1
--- /dev/null
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.txt
@@ -0,0 +1,437 @@
+# DocType, Delivery Note Item
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:29',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:29',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': u'1311621379',
+		'autoname': u'DND/.#######',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Stock',
+		'name': '__common__',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 56
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Delivery Note Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Delivery Note Item
+	{
+		'doctype': 'DocType',
+		'name': u'Delivery Note Item'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': u'Client',
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'item_name',
+		'fieldtype': u'Data',
+		'label': u'Item Name',
+		'oldfieldname': u'item_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Small Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0,
+		'reqd': 1,
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'qty',
+		'fieldtype': u'Currency',
+		'label': u'Quantity',
+		'oldfieldname': u'qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'reqd': 1,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'stock_uom',
+		'fieldtype': u'Data',
+		'label': u'UOM',
+		'oldfieldname': u'stock_uom',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 0,
+		'reqd': 1,
+		'width': u'50px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'ref_rate',
+		'fieldtype': u'Currency',
+		'label': u'Price List Rate',
+		'no_copy': 0,
+		'oldfieldname': u'ref_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 0,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'adj_rate',
+		'fieldtype': u'Float',
+		'label': u'Discount (%)',
+		'oldfieldname': u'adj_rate',
+		'oldfieldtype': u'Float',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'export_rate',
+		'fieldtype': u'Currency',
+		'label': u'Rate',
+		'oldfieldname': u'export_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 0,
+		'reqd': 0,
+		'trigger': u'Client',
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'export_amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount',
+		'oldfieldname': u'export_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 0,
+		'reqd': 0,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'base_ref_rate',
+		'fieldtype': u'Currency',
+		'label': u'Price List Rate*',
+		'oldfieldname': u'base_ref_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'basic_rate',
+		'fieldtype': u'Currency',
+		'label': u'Rate*',
+		'oldfieldname': u'basic_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 0,
+		'trigger': u'Client',
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount*',
+		'oldfieldname': u'amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'reqd': 0,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'warehouse',
+		'fieldtype': u'Link',
+		'label': u'Warehouse',
+		'oldfieldname': u'warehouse',
+		'oldfieldtype': u'Link',
+		'options': u'Warehouse',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'serial_no',
+		'fieldtype': u'Text',
+		'in_filter': 1,
+		'label': u'Serial No',
+		'no_copy': 1,
+		'oldfieldname': u'serial_no',
+		'oldfieldtype': u'Text',
+		'permlevel': 0,
+		'print_hide': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'batch_no',
+		'fieldtype': u'Link',
+		'label': u'Batch No',
+		'oldfieldname': u'batch_no',
+		'oldfieldtype': u'Link',
+		'options': u'Batch',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_group',
+		'fieldtype': u'Link',
+		'hidden': 1,
+		'label': u'Item Group',
+		'oldfieldname': u'item_group',
+		'oldfieldtype': u'Link',
+		'options': u'Item Group',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'brand',
+		'fieldtype': u'Link',
+		'hidden': 1,
+		'label': u'Brand Name',
+		'oldfieldname': u'brand',
+		'oldfieldtype': u'Link',
+		'options': u'Brand',
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'actual_qty',
+		'fieldtype': u'Currency',
+		'label': u'Available Qty at Warehouse',
+		'no_copy': 1,
+		'oldfieldname': u'actual_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'billed_amt',
+		'fieldtype': u'Currency',
+		'label': u'Billed Amt',
+		'no_copy': 1,
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'installed_qty',
+		'fieldtype': u'Currency',
+		'label': u'Installed Qty',
+		'no_copy': 1,
+		'oldfieldname': u'installed_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'colour': u'White:FFF',
+		'default': u'0',
+		'doctype': u'DocField',
+		'fieldname': u'packed_qty',
+		'fieldtype': u'Currency',
+		'label': u'Packed Quantity',
+		'no_copy': 1,
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_doctype',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Document Type',
+		'oldfieldname': u'prevdoc_doctype',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_docname',
+		'fieldtype': u'Data',
+		'hidden': 0,
+		'in_filter': 1,
+		'label': u'Against Document No',
+		'no_copy': 1,
+		'oldfieldname': u'prevdoc_docname',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_date',
+		'fieldtype': u'Date',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Against Document Date',
+		'oldfieldname': u'prevdoc_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_detail_docname',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Against Document Detail No',
+		'oldfieldname': u'prevdoc_detail_docname',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 0,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_tax_rate',
+		'fieldtype': u'Small Text',
+		'hidden': 1,
+		'label': u'Item Tax Rate',
+		'oldfieldname': u'item_tax_rate',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'doctype': u'DocField',
+		'fieldname': u'page_break',
+		'fieldtype': u'Check',
+		'label': u'Page Break',
+		'oldfieldname': u'page_break',
+		'oldfieldtype': u'Check',
+		'permlevel': 0,
+		'print_hide': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/delivery_note_packing_detail/delivery_note_packing_detail.txt b/erpnext/stock/doctype/delivery_note_packing_detail/delivery_note_packing_detail.txt
deleted file mode 100644
index 3924c13..0000000
--- a/erpnext/stock/doctype/delivery_note_packing_detail/delivery_note_packing_detail.txt
+++ /dev/null
@@ -1,286 +0,0 @@
-# DocType, Delivery Note Packing Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:58',
-		'docstatus': 0,
-		'modified': '2011-03-14 14:50:55',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Stock',
-		'name': '__common__',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 17
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Delivery Note Packing Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# DocType, Delivery Note Packing Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Delivery Note Packing Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'parent_item',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Parent Item',
-		'oldfieldname': 'parent_item',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'item_code',
-		'fieldtype': 'Link',
-		'idx': 2,
-		'in_filter': 1,
-		'label': 'Item Code',
-		'oldfieldname': 'item_code',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'item_name',
-		'fieldtype': 'Data',
-		'idx': 3,
-		'in_filter': 1,
-		'label': 'Item Name',
-		'oldfieldname': 'item_name',
-		'oldfieldtype': 'Data',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'parent_detail_docname',
-		'fieldtype': 'Data',
-		'hidden': 1,
-		'idx': 4,
-		'label': 'Parent Detail docname',
-		'no_copy': 1,
-		'oldfieldname': 'parent_detail_docname',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Text',
-		'idx': 5,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Text',
-		'permlevel': 1,
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'warehouse',
-		'fieldtype': 'Link',
-		'idx': 6,
-		'label': 'Warehouse',
-		'oldfieldname': 'warehouse',
-		'oldfieldtype': 'Link',
-		'options': 'Warehouse',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'qty',
-		'fieldtype': 'Currency',
-		'idx': 7,
-		'label': 'Qty',
-		'oldfieldname': 'qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'serial_no',
-		'fieldtype': 'Text',
-		'idx': 8,
-		'label': 'Serial No',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'actual_qty',
-		'fieldtype': 'Currency',
-		'idx': 9,
-		'label': 'Actual Qty',
-		'no_copy': 1,
-		'oldfieldname': 'actual_qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'projected_qty',
-		'fieldtype': 'Currency',
-		'idx': 10,
-		'label': 'Projected Qty',
-		'no_copy': 1,
-		'oldfieldname': 'projected_qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'uom',
-		'fieldtype': 'Link',
-		'idx': 11,
-		'label': 'UOM',
-		'oldfieldname': 'uom',
-		'oldfieldtype': 'Link',
-		'options': 'UOM',
-		'permlevel': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'planned_qty',
-		'fieldtype': 'Currency',
-		'hidden': 1,
-		'idx': 12,
-		'label': 'Planned Qty ',
-		'no_copy': 1,
-		'oldfieldname': 'planned_qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'produced_qty',
-		'fieldtype': 'Currency',
-		'hidden': 1,
-		'idx': 13,
-		'label': 'Produced Qty',
-		'no_copy': 1,
-		'oldfieldname': 'produced_qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'prevdoc_doctype',
-		'fieldtype': 'Data',
-		'hidden': 1,
-		'idx': 14,
-		'label': 'Prevdoc DocType',
-		'oldfieldname': 'prevdoc_doctype',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'description': 'The date at which current entry is made in system.',
-		'doctype': 'DocField',
-		'fieldname': 'transaction_date',
-		'fieldtype': 'Date',
-		'hidden': 0,
-		'idx': 15,
-		'label': 'Sales Order Date',
-		'oldfieldname': 'transaction_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'delivery_date',
-		'fieldtype': 'Date',
-		'hidden': 0,
-		'idx': 16,
-		'label': 'Expected Delivery Date',
-		'oldfieldname': 'delivery_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'confirmation_date',
-		'fieldtype': 'Date',
-		'hidden': 1,
-		'idx': 17,
-		'label': 'Confirmed delivery date',
-		'no_copy': 1,
-		'oldfieldname': 'confirmation_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': 'DocField',
-		'fieldname': 'page_break',
-		'fieldtype': 'Check',
-		'idx': 18,
-		'label': 'Page Break',
-		'oldfieldname': 'page_break',
-		'oldfieldtype': 'Check',
-		'permlevel': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/delivery_note_packing_detail/__init__.py b/erpnext/stock/doctype/delivery_note_packing_item/__init__.py
similarity index 100%
rename from erpnext/stock/doctype/delivery_note_packing_detail/__init__.py
rename to erpnext/stock/doctype/delivery_note_packing_item/__init__.py
diff --git a/erpnext/stock/doctype/delivery_note_packing_item/delivery_note_packing_item.txt b/erpnext/stock/doctype/delivery_note_packing_item/delivery_note_packing_item.txt
new file mode 100644
index 0000000..4299fcc
--- /dev/null
+++ b/erpnext/stock/doctype/delivery_note_packing_item/delivery_note_packing_item.txt
@@ -0,0 +1,268 @@
+# DocType, Delivery Note Packing Item
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:30',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:30',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Stock',
+		'name': '__common__',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 17
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Delivery Note Packing Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Delivery Note Packing Item
+	{
+		'doctype': 'DocType',
+		'name': u'Delivery Note Packing Item'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'parent_item',
+		'fieldtype': u'Link',
+		'label': u'Parent Item',
+		'oldfieldname': u'parent_item',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_name',
+		'fieldtype': u'Data',
+		'in_filter': 1,
+		'label': u'Item Name',
+		'oldfieldname': u'item_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'parent_detail_docname',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Parent Detail docname',
+		'no_copy': 1,
+		'oldfieldname': u'parent_detail_docname',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Text',
+		'permlevel': 1,
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'warehouse',
+		'fieldtype': u'Link',
+		'label': u'Warehouse',
+		'oldfieldname': u'warehouse',
+		'oldfieldtype': u'Link',
+		'options': u'Warehouse',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'qty',
+		'fieldtype': u'Currency',
+		'label': u'Qty',
+		'oldfieldname': u'qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'serial_no',
+		'fieldtype': u'Text',
+		'label': u'Serial No',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'actual_qty',
+		'fieldtype': u'Currency',
+		'label': u'Actual Qty',
+		'no_copy': 1,
+		'oldfieldname': u'actual_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'projected_qty',
+		'fieldtype': u'Currency',
+		'label': u'Projected Qty',
+		'no_copy': 1,
+		'oldfieldname': u'projected_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'uom',
+		'fieldtype': u'Link',
+		'label': u'UOM',
+		'oldfieldname': u'uom',
+		'oldfieldtype': u'Link',
+		'options': u'UOM',
+		'permlevel': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'planned_qty',
+		'fieldtype': u'Currency',
+		'hidden': 1,
+		'label': u'Planned Qty ',
+		'no_copy': 1,
+		'oldfieldname': u'planned_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'produced_qty',
+		'fieldtype': u'Currency',
+		'hidden': 1,
+		'label': u'Produced Qty',
+		'no_copy': 1,
+		'oldfieldname': u'produced_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_doctype',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Prevdoc DocType',
+		'oldfieldname': u'prevdoc_doctype',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'description': u'The date at which current entry is made in system.',
+		'doctype': u'DocField',
+		'fieldname': u'transaction_date',
+		'fieldtype': u'Date',
+		'hidden': 0,
+		'label': u'Sales Order Date',
+		'oldfieldname': u'transaction_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'delivery_date',
+		'fieldtype': u'Date',
+		'hidden': 0,
+		'label': u'Expected Delivery Date',
+		'oldfieldname': u'delivery_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'confirmation_date',
+		'fieldtype': u'Date',
+		'hidden': 1,
+		'label': u'Confirmed delivery date',
+		'no_copy': 1,
+		'oldfieldname': u'confirmation_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'doctype': u'DocField',
+		'fieldname': u'page_break',
+		'fieldtype': u'Check',
+		'label': u'Page Break',
+		'oldfieldname': u'page_break',
+		'oldfieldtype': u'Check',
+		'permlevel': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index f60a5f0..33e5f77 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -34,7 +34,7 @@
 
 cur_frm.fields_dict['default_bom'].get_query = function(doc) {
    //var d = locals[this.doctype][this.docname];
-   return 'SELECT DISTINCT `tabBill Of Materials`.`name` FROM `tabBill Of Materials` WHERE `tabBill Of Materials`.`item` = "' + doc.item_code + '"  AND `tabBill Of Materials`.`is_active` = "No" and `tabBill Of Materials`.docstatus != 2 AND `tabBill Of Materials`.%(key)s LIKE "%s" ORDER BY `tabBill Of Materials`.`name` LIMIT 50'
+   return 'SELECT DISTINCT `tabBOM`.`name` FROM `tabBOM` WHERE `tabBOM`.`item` = "' + doc.item_code + '"  AND `tabBOM`.`is_active` = "No" and `tabBOM`.docstatus != 2 AND `tabBOM`.%(key)s LIKE "%s" ORDER BY `tabBOM`.`name` LIMIT 50'
 }
 
 
@@ -93,7 +93,7 @@
 // takes the first attachment and creates
 // a table with both image and attachment in HTML
 // in the "alternate_description" field
-cur_frm.cscript['Add Image'] = function(doc, dt, dn) {
+cur_frm.cscript.add_image = function(doc, dt, dn) {
 	if(!doc.file_list) {
 		msgprint('Please attach a file first!');
 	}
@@ -127,7 +127,7 @@
   cur_frm.cscript.weight_to_validate(doc,cdt,cdn);
 }
 
-//===========Fill Default Currency in "Ref Rate Details====================
+//===========Fill Default Currency in "Item Prices====================
 cur_frm.fields_dict['ref_rate_details'].grid.onrowadd = function(doc, cdt, cdn){
 	locals[cdt][cdn].ref_currency = sys_defaults.currency;
 	refresh_field('ref_currency',cdn,'ref_rate_details');
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 64cb0c9..ab61f28 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -118,12 +118,12 @@
 
 	def check_for_active_boms(self, check):
 		if check in ['Is Active', 'Is Purchase Item']:
-			bom_mat = sql("select distinct t1.parent from `tabBOM Material` t1, `tabBill Of Materials` t2 where t1.item_code ='%s' and (t1.bom_no = '' or t1.bom_no is NULL) and t2.name = t1.parent and t2.is_active = 'Yes' and t2.docstatus = 1 and t1.docstatus =1 " % self.doc.name )
+			bom_mat = sql("select distinct t1.parent from `tabBOM Item` t1, `tabBOM` t2 where t1.item_code ='%s' and (t1.bom_no = '' or t1.bom_no is NULL) and t2.name = t1.parent and t2.is_active = 'Yes' and t2.docstatus = 1 and t1.docstatus =1 " % self.doc.name )
 			if bom_mat and bom_mat[0][0]:
 				msgprint("%s should be 'Yes'. As Item %s is present in one or many Active BOMs." % (cstr(check), cstr(self.doc.name)))
 				raise Exception
 		if check == 'Is Active' or ( check == 'Is Manufactured Item' and self.doc.is_sub_contracted_item != 'Yes') or (check ==	'Is Sub Contracted Item' and self.doc.is_manufactured_item != 'Yes') :
-			bom = sql("select name from `tabBill Of Materials` where item = '%s' and is_active ='Yes'" % cstr(self.doc.name))
+			bom = sql("select name from `tabBOM` where item = '%s' and is_active ='Yes'" % cstr(self.doc.name))
 			if bom and bom[0][0]:
 				msgprint("%s should be 'Yes'. As Item %s is present in one or many Active BOMs." % (cstr(check), cstr(self.doc.name)))
 				raise Exception
diff --git a/erpnext/stock/doctype/item/item.txt b/erpnext/stock/doctype/item/item.txt
index 682b69c..28efdf8 100644
--- a/erpnext/stock/doctype/item/item.txt
+++ b/erpnext/stock/doctype/item/item.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:05',
+		'creation': '2012-03-27 14:36:31',
 		'docstatus': 0,
-		'modified': '2012-02-21 12:40:01',
+		'modified': '2012-03-27 18:51:27',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -29,7 +29,7 @@
 		'show_in_menu': 0,
 		'subject': u'%(item_name)s',
 		'tag_fields': u'item_group',
-		'version': 171
+		'version': 172
 	},
 
 	# These values are common for all DocField
@@ -59,73 +59,6 @@
 
 	# DocPerm
 	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Material Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Material Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Material User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Material User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Material Master Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Material Master Manager',
-		'write': 0
-	},
-
-	# DocPerm
-	{
 		'cancel': 1,
 		'create': 1,
 		'doctype': u'DocPerm',
@@ -136,14 +69,82 @@
 
 	# DocPerm
 	{
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material Master Manager',
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material Master Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
 		'doctype': u'DocPerm',
 		'permlevel': 1,
 		'role': u'System Manager'
 	},
 
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material User',
+		'submit': 0,
+		'write': 0
+	},
+
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'item',
 		'fieldtype': u'Section Break',
 		'label': u'Item',
 		'no_copy': 0,
@@ -211,6 +212,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'ighelp',
 		'fieldtype': u'HTML',
 		'label': u'IGHelp',
 		'oldfieldtype': u'HTML',
@@ -236,6 +238,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'permlevel': 0
 	},
@@ -269,6 +272,7 @@
 		'colour': u'White:FFF',
 		'description': u'Generates HTML to include image (1st attachment) in the description',
 		'doctype': u'DocField',
+		'fieldname': u'add_image',
 		'fieldtype': u'Button',
 		'label': u'Add Image',
 		'permlevel': 0
@@ -277,6 +281,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'inventory',
 		'fieldtype': u'Section Break',
 		'label': u'Inventory',
 		'oldfieldtype': u'Section Break',
@@ -402,6 +407,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break1',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -502,6 +508,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'purchase_details',
 		'fieldtype': u'Section Break',
 		'label': u'Purchase Details',
 		'oldfieldtype': u'Section Break',
@@ -527,7 +534,7 @@
 	# DocField
 	{
 		'colour': u'White:FFF',
-		'description': u'Lead Time days is number of days by which this item is expected in your warehouse. This days is fetched in Indent when you select this item.',
+		'description': u'Lead Time days is number of days by which this item is expected in your warehouse. This days is fetched in Purchase Request when you select this item.',
 		'doctype': u'DocField',
 		'fieldname': u'lead_time_days',
 		'fieldtype': u'Int',
@@ -608,6 +615,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break2',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -657,6 +665,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'sales_details',
 		'fieldtype': u'Section Break',
 		'label': u'Sales Details',
 		'oldfieldtype': u'Section Break',
@@ -759,6 +768,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break3',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -772,10 +782,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'ref_rate_details',
 		'fieldtype': u'Table',
-		'label': u'Ref Rate Details',
+		'label': u'Item Prices',
 		'oldfieldname': u'ref_rate_details',
 		'oldfieldtype': u'Table',
-		'options': u'Ref Rate Detail',
+		'options': u'Item Price',
 		'permlevel': 0
 	},
 
@@ -793,6 +803,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'item_tax_section_break',
 		'fieldtype': u'Section Break',
 		'label': u'Item Tax',
 		'oldfieldtype': u'Section Break',
@@ -814,6 +825,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'inspection_criteria',
 		'fieldtype': u'Section Break',
 		'label': u'Inspection Criteria',
 		'oldfieldtype': u'Section Break',
@@ -840,16 +852,17 @@
 		'doctype': u'DocField',
 		'fieldname': u'item_specification_details',
 		'fieldtype': u'Table',
-		'label': u'Item Specification Detail',
+		'label': u'Item Quality Inspection Parameter',
 		'oldfieldname': u'item_specification_details',
 		'oldfieldtype': u'Table',
-		'options': u'Item Specification Detail',
+		'options': u'Item Quality Inspection Parameter',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'manufacturing',
 		'fieldtype': u'Section Break',
 		'label': u'Manufacturing',
 		'oldfieldtype': u'Section Break',
@@ -882,7 +895,7 @@
 		'no_copy': 1,
 		'oldfieldname': u'default_bom',
 		'oldfieldtype': u'Link',
-		'options': u'Bill Of Materials',
+		'options': u'BOM',
 		'permlevel': 1
 	},
 
diff --git a/erpnext/stock/doctype/item/listview.js b/erpnext/stock/doctype/item/listview.js
new file mode 100644
index 0000000..7f0dbc8
--- /dev/null
+++ b/erpnext/stock/doctype/item/listview.js
@@ -0,0 +1,23 @@
+// render
+wn.doclistviews['Item'] = wn.views.ListView.extend({
+	init: function(d) {
+		this._super(d)
+		this.fields = this.fields.concat([
+			"`tabItem`.item_name",
+			"`tabItem`.description",
+		]);
+		this.stats = this.stats.concat(['default_warehouse', 'brand']);
+	},
+
+	prepare_data: function(data) {
+		this._super(data);
+		data.description = repl("%(item_name)s | %(description)s", data);
+	},
+	
+	columns: [
+		{width: '5%', content:'avatar'},
+		{width: '20%', content:'name'},
+		{width: '63%', content:'tags+description', css: {'color': '#aaa'}},
+		{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
+	]
+});
diff --git a/erpnext/stock/doctype/item_customer_detail/item_customer_detail.txt b/erpnext/stock/doctype/item_customer_detail/item_customer_detail.txt
index f53f18e..d41c927 100644
--- a/erpnext/stock/doctype/item_customer_detail/item_customer_detail.txt
+++ b/erpnext/stock/doctype/item_customer_detail/item_customer_detail.txt
@@ -3,38 +3,38 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-08-18 11:38:43',
+		'creation': '2012-03-27 14:36:33',
 		'docstatus': 0,
-		'modified': '2011-08-18 11:54:36',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:33',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'autoname': 'ITEMCUST/.#####',
-		'colour': 'White:FFF',
-		'description': 'For the convenience of customers, these codes can be used in print formats like Invoices and Delivery Notes',
+		'autoname': u'ITEMCUST/.#####',
+		'colour': u'White:FFF',
+		'description': u'For the convenience of customers, these codes can be used in print formats like Invoices and Delivery Notes',
 		'doctype': 'DocType',
 		'in_create': 1,
 		'istable': 1,
-		'module': 'Stock',
+		'module': u'Stock',
 		'name': '__common__',
 		'read_only': 0,
-		'section_style': 'Tray',
-		'server_code_error': ' ',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 7
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'in_filter': 1,
 		'name': '__common__',
-		'parent': 'Item Customer Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Item Customer Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1
@@ -43,31 +43,29 @@
 	# DocType, Item Customer Detail
 	{
 		'doctype': 'DocType',
-		'name': 'Item Customer Detail'
+		'name': u'Item Customer Detail'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'customer_name',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Customer Name',
-		'oldfieldname': 'price_list_name',
-		'oldfieldtype': 'Select',
-		'options': 'Customer',
-		'width': '180px'
+		'doctype': u'DocField',
+		'fieldname': u'customer_name',
+		'fieldtype': u'Link',
+		'label': u'Customer Name',
+		'oldfieldname': u'price_list_name',
+		'oldfieldtype': u'Select',
+		'options': u'Customer',
+		'width': u'180px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'ref_code',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Ref Code',
-		'oldfieldname': 'ref_rate',
-		'oldfieldtype': 'Currency',
-		'width': '120px'
+		'doctype': u'DocField',
+		'fieldname': u'ref_code',
+		'fieldtype': u'Data',
+		'label': u'Ref Code',
+		'oldfieldname': u'ref_rate',
+		'oldfieldtype': u'Currency',
+		'width': u'120px'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/lc_pr_detail/__init__.py b/erpnext/stock/doctype/item_price/__init__.py
similarity index 100%
rename from erpnext/stock/doctype/lc_pr_detail/__init__.py
rename to erpnext/stock/doctype/item_price/__init__.py
diff --git a/erpnext/stock/doctype/item_price/item_price.txt b/erpnext/stock/doctype/item_price/item_price.txt
new file mode 100644
index 0000000..a48f8d1
--- /dev/null
+++ b/erpnext/stock/doctype/item_price/item_price.txt
@@ -0,0 +1,82 @@
+# DocType, Item Price
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:36',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:36',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'RFD/.#####',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'in_create': 1,
+		'istable': 1,
+		'module': u'Stock',
+		'name': '__common__',
+		'read_only': 0,
+		'section_style': u'Tray',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 3
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'in_filter': 1,
+		'name': '__common__',
+		'parent': u'Item Price',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0,
+		'search_index': 1
+	},
+
+	# DocType, Item Price
+	{
+		'doctype': 'DocType',
+		'name': u'Item Price'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'price_list_name',
+		'fieldtype': u'Select',
+		'label': u'Price List Name',
+		'oldfieldname': u'price_list_name',
+		'oldfieldtype': u'Select',
+		'options': u'link:Price List',
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'ref_rate',
+		'fieldtype': u'Currency',
+		'label': u'Ref Rate',
+		'oldfieldname': u'ref_rate',
+		'oldfieldtype': u'Currency',
+		'reqd': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'ref_currency',
+		'fieldtype': u'Select',
+		'label': u'Currency',
+		'oldfieldname': u'ref_currency',
+		'oldfieldtype': u'Select',
+		'options': u'link:Currency',
+		'reqd': 1
+	}
+]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item_specification_detail/__init__.py b/erpnext/stock/doctype/item_quality_inspection_parameter/__init__.py
similarity index 100%
rename from erpnext/stock/doctype/item_specification_detail/__init__.py
rename to erpnext/stock/doctype/item_quality_inspection_parameter/__init__.py
diff --git a/erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.txt b/erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.txt
new file mode 100644
index 0000000..1ab6d06
--- /dev/null
+++ b/erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.txt
@@ -0,0 +1,64 @@
+# DocType, Item Quality Inspection Parameter
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:33',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:33',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'IISD/.#####',
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Stock',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 1
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'fieldtype': u'Data',
+		'name': '__common__',
+		'oldfieldtype': u'Data',
+		'parent': u'Item Quality Inspection Parameter',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# DocType, Item Quality Inspection Parameter
+	{
+		'doctype': 'DocType',
+		'name': u'Item Quality Inspection Parameter'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'specification',
+		'in_filter': 0,
+		'label': u'Parameter',
+		'oldfieldname': u'specification',
+		'reqd': 1,
+		'search_index': 0,
+		'width': u'200px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'value',
+		'label': u'Acceptance Criteria',
+		'oldfieldname': u'value'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item_specification_detail/item_specification_detail.txt b/erpnext/stock/doctype/item_specification_detail/item_specification_detail.txt
deleted file mode 100644
index 7173b09..0000000
--- a/erpnext/stock/doctype/item_specification_detail/item_specification_detail.txt
+++ /dev/null
@@ -1,66 +0,0 @@
-# DocType, Item Specification Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:06',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'IISD/.#####',
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Stock',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 1
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Data',
-		'name': '__common__',
-		'oldfieldtype': 'Data',
-		'parent': 'Item Specification Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, Item Specification Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Item Specification Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'specification',
-		'idx': 1,
-		'in_filter': 0,
-		'label': 'Parameter',
-		'oldfieldname': 'specification',
-		'reqd': 1,
-		'search_index': 0,
-		'width': '200px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'value',
-		'idx': 2,
-		'label': 'Acceptance Criteria',
-		'oldfieldname': 'value'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item_supplier/item_supplier.txt b/erpnext/stock/doctype/item_supplier/item_supplier.txt
index 609c1e9..e7806b3 100644
--- a/erpnext/stock/doctype/item_supplier/item_supplier.txt
+++ b/erpnext/stock/doctype/item_supplier/item_supplier.txt
@@ -3,56 +3,56 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-01-17 18:36:35',
+		'creation': '2012-03-27 14:36:33',
 		'docstatus': 0,
-		'modified': '2012-01-17 18:40:37',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:33',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Stock',
+		'module': u'Stock',
 		'name': '__common__',
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
 		'version': 3
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Item Supplier',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Item Supplier',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# DocType, Item Supplier
 	{
 		'doctype': 'DocType',
-		'name': 'Item Supplier'
+		'name': u'Item Supplier'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'supplier',
-		'fieldtype': 'Link',
-		'label': 'Supplier',
-		'options': 'Supplier'
+		'doctype': u'DocField',
+		'fieldname': u'supplier',
+		'fieldtype': u'Link',
+		'label': u'Supplier',
+		'options': u'Supplier'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'supplier_part_no',
-		'fieldtype': 'Data',
-		'label': 'Supplier Part Number',
-		'width': '200px'
+		'doctype': u'DocField',
+		'fieldname': u'supplier_part_no',
+		'fieldtype': u'Data',
+		'label': u'Supplier Part Number',
+		'width': u'200px'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item_tax/item_tax.txt b/erpnext/stock/doctype/item_tax/item_tax.txt
index 1d4adb7..1ceffdb 100644
--- a/erpnext/stock/doctype/item_tax/item_tax.txt
+++ b/erpnext/stock/doctype/item_tax/item_tax.txt
@@ -3,64 +3,62 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:06',
+		'creation': '2012-03-27 14:36:33',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:33',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Stock',
+		'module': u'Stock',
 		'name': '__common__',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
 		'show_in_menu': 0
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Item Tax',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Item Tax',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# DocType, Item Tax
 	{
 		'doctype': 'DocType',
-		'name': 'Item Tax'
+		'name': u'Item Tax'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'tax_type',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Tax',
-		'oldfieldname': 'tax_type',
-		'oldfieldtype': 'Link',
-		'options': 'Account',
+		'doctype': u'DocField',
+		'fieldname': u'tax_type',
+		'fieldtype': u'Link',
+		'label': u'Tax',
+		'oldfieldname': u'tax_type',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
 		'reqd': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'tax_rate',
-		'fieldtype': 'Currency',
-		'idx': 2,
-		'label': 'Tax Rate',
-		'oldfieldname': 'tax_rate',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'tax_rate',
+		'fieldtype': u'Currency',
+		'label': u'Tax Rate',
+		'oldfieldname': u'tax_rate',
+		'oldfieldtype': u'Currency',
 		'reqd': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/landed_cost_detail/landed_cost_detail.txt b/erpnext/stock/doctype/landed_cost_detail/landed_cost_detail.txt
deleted file mode 100644
index 9792f33..0000000
--- a/erpnext/stock/doctype/landed_cost_detail/landed_cost_detail.txt
+++ /dev/null
@@ -1,76 +0,0 @@
-# DocType, Landed Cost Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:06',
-		'docstatus': 0,
-		'modified': '2012-03-21 14:58:34',
-		'modified_by': u'Administrator',
-		'owner': u'wasim@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': u'Stock',
-		'name': '__common__',
-		'section_style': u'Simple',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 2
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Landed Cost Detail',
-		'parentfield': u'fields',
-		'parenttype': u'DocType',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocType, Landed Cost Detail
-	{
-		'doctype': 'DocType',
-		'name': u'Landed Cost Detail'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'account_head',
-		'fieldtype': u'Link',
-		'label': u'Account Head',
-		'oldfieldname': u'account_head',
-		'oldfieldtype': u'Link',
-		'options': u'Account',
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'description',
-		'fieldtype': u'Data',
-		'label': u'Description',
-		'oldfieldname': u'description',
-		'oldfieldtype': u'Data',
-		'width': u'300px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'amount',
-		'fieldtype': u'Currency',
-		'label': u'Amount',
-		'oldfieldname': u'amount',
-		'oldfieldtype': u'Currency'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/landed_cost_detail/__init__.py b/erpnext/stock/doctype/landed_cost_item/__init__.py
similarity index 100%
rename from erpnext/stock/doctype/landed_cost_detail/__init__.py
rename to erpnext/stock/doctype/landed_cost_item/__init__.py
diff --git a/erpnext/stock/doctype/landed_cost_item/landed_cost_item.txt b/erpnext/stock/doctype/landed_cost_item/landed_cost_item.txt
new file mode 100644
index 0000000..4157039
--- /dev/null
+++ b/erpnext/stock/doctype/landed_cost_item/landed_cost_item.txt
@@ -0,0 +1,76 @@
+# DocType, Landed Cost Item
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:33',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:33',
+		'modified_by': u'Administrator',
+		'owner': u'wasim@webnotestech.com'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Stock',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 2
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Landed Cost Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocType, Landed Cost Item
+	{
+		'doctype': 'DocType',
+		'name': u'Landed Cost Item'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'account_head',
+		'fieldtype': u'Link',
+		'label': u'Account Head',
+		'oldfieldname': u'account_head',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Data',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Data',
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount',
+		'oldfieldname': u'amount',
+		'oldfieldtype': u'Currency'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/landed_cost_master/landed_cost_master.txt b/erpnext/stock/doctype/landed_cost_master/landed_cost_master.txt
index 71374f8..f84eafe 100644
--- a/erpnext/stock/doctype/landed_cost_master/landed_cost_master.txt
+++ b/erpnext/stock/doctype/landed_cost_master/landed_cost_master.txt
@@ -3,166 +3,155 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:07',
+		'creation': '2012-03-27 14:36:34',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:34',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1309508838',
-		'autoname': 'field:title',
-		'colour': 'White:FFF',
+		'_last_update': u'1309508838',
+		'autoname': u'field:title',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'Stock',
+		'document_type': u'Master',
+		'module': u'Stock',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 2
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Landed Cost Master',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Landed Cost Master',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Landed Cost Master',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Landed Cost Master',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Landed Cost Master
 	{
 		'doctype': 'DocType',
-		'name': 'Landed Cost Master'
+		'name': u'Landed Cost Master'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'All'
+		'role': u'All'
 	},
 
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 2,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Purchase Manager',
+		'role': u'Purchase Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 3,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 4,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Purchase User',
+		'role': u'Purchase User',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 5,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'All'
+		'role': u'All'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 6,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'System Manager'
+		'role': u'System Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 7,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Purchase User'
+		'role': u'Purchase User'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 8,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Purchase Manager'
+		'role': u'Purchase Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'title',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Title',
-		'oldfieldname': 'title',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'title',
+		'fieldtype': u'Data',
+		'label': u'Title',
+		'oldfieldname': u'title',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 3,
-		'label': 'Landed Cost Details',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'landed_cost_details',
+		'fieldtype': u'Section Break',
+		'label': u'Landed Cost Items',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'landed_cost',
-		'fieldtype': 'Table',
-		'idx': 4,
-		'label': 'Landed Cost',
-		'oldfieldname': 'landed_cost',
-		'oldfieldtype': 'Table',
-		'options': 'Landed Cost Master Detail',
+		'doctype': u'DocField',
+		'fieldname': u'landed_cost',
+		'fieldtype': u'Table',
+		'label': u'Landed Cost',
+		'oldfieldname': u'landed_cost',
+		'oldfieldtype': u'Table',
+		'options': u'Landed Cost Master Detail',
 		'permlevel': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/landed_cost_master_detail/landed_cost_master_detail.txt b/erpnext/stock/doctype/landed_cost_master_detail/landed_cost_master_detail.txt
index bc752d9..1beccea 100644
--- a/erpnext/stock/doctype/landed_cost_master_detail/landed_cost_master_detail.txt
+++ b/erpnext/stock/doctype/landed_cost_master_detail/landed_cost_master_detail.txt
@@ -3,59 +3,57 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:07',
+		'creation': '2012-03-27 14:36:34',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:34',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Stock',
+		'module': u'Stock',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 2
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldtype': u'Data',
 		'name': '__common__',
-		'oldfieldtype': 'Data',
-		'parent': 'Landed Cost Master Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'oldfieldtype': u'Data',
+		'parent': u'Landed Cost Master Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# DocType, Landed Cost Master Detail
 	{
 		'doctype': 'DocType',
-		'name': 'Landed Cost Master Detail'
+		'name': u'Landed Cost Master Detail'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'account_head',
-		'idx': 1,
-		'label': 'Account Head',
-		'oldfieldname': 'account_head'
+		'doctype': u'DocField',
+		'fieldname': u'account_head',
+		'label': u'Account Head',
+		'oldfieldname': u'account_head'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'idx': 2,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'width': '300px'
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'width': u'300px'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/landed_cost_detail/__init__.py b/erpnext/stock/doctype/landed_cost_purchase_receipt/__init__.py
similarity index 100%
copy from erpnext/stock/doctype/landed_cost_detail/__init__.py
copy to erpnext/stock/doctype/landed_cost_purchase_receipt/__init__.py
diff --git a/erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.txt b/erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.txt
new file mode 100644
index 0000000..ada4fef
--- /dev/null
+++ b/erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.txt
@@ -0,0 +1,65 @@
+# DocType, Landed Cost Purchase Receipt
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:34',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:34',
+		'modified_by': u'Administrator',
+		'owner': u'wasim@webnotestech.com'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Stock',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 5
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Landed Cost Purchase Receipt',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# DocType, Landed Cost Purchase Receipt
+	{
+		'doctype': 'DocType',
+		'name': u'Landed Cost Purchase Receipt'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'purchase_receipt',
+		'fieldtype': u'Link',
+		'label': u'Purchase Receipt',
+		'oldfieldname': u'purchase_receipt_no',
+		'oldfieldtype': u'Link',
+		'options': u'Purchase Receipt',
+		'width': u'220px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'select_pr',
+		'fieldtype': u'Check',
+		'label': u'Select PR',
+		'oldfieldname': u'include_in_landed_cost',
+		'oldfieldtype': u'Check',
+		'width': u'120px'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py
index 2468247..6123ac2 100644
--- a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py
+++ b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py
@@ -51,7 +51,7 @@
 			msgprint("Please enter date of shorter duration as there are too many purchase receipt, hence it cannot be loaded.", raise_exception=1)
 			
 		for i in pr:
-			ch = addchild(self.doc, 'lc_pr_details', 'LC PR Detail', 1, self.doclist)
+			ch = addchild(self.doc, 'lc_pr_details', 'Landed Cost Purchase Receipt', 1, self.doclist)
 			ch.purchase_receipt = i and i['name'] or ''
 			ch.save()
 
@@ -62,7 +62,7 @@
 		idx = 0
 		landed_cost = sql("select account_head, description from `tabLanded Cost Master Detail` where parent=%s", (self.doc.landed_cost), as_dict = 1)
 		for cost in landed_cost:
-			lct = addchild(self.doc, 'landed_cost_details', 'Landed Cost Detail', 1, self.doclist)
+			lct = addchild(self.doc, 'landed_cost_details', 'Landed Cost Item', 1, self.doclist)
 			lct.account_head = cost['account_head']
 			lct.description = cost['description']
 
@@ -98,9 +98,9 @@
 				self.prwise_cost[pr] = self.prwise_cost.get(pr, 0) + amt
 				cumulative_grand_total += amt
 				
-				pr_oc_row = sql("select name from `tabPurchase Tax Detail` where parent = %s and category = 'For Valuation' and add_deduct_tax = 'Add' and charge_type = 'Actual' and account_head = %s",(pr, lc.account_head))
+				pr_oc_row = sql("select name from `tabPurchase Taxes and Charges` where parent = %s and category = 'For Valuation' and add_deduct_tax = 'Add' and charge_type = 'Actual' and account_head = %s",(pr, lc.account_head))
 				if not pr_oc_row:	# add if not exists
-					ch = addchild(pr_obj.doc, 'purchase_tax_details', 'Purchase Tax Detail', 1)
+					ch = addchild(pr_obj.doc, 'purchase_tax_details', 'Purchase Taxes and Charges', 1)
 					ch.category = 'For Valuation'
 					ch.add_deduct_tax = 'Add'
 					ch.charge_type = 'Actual'
@@ -113,7 +113,7 @@
 					ch.idx = 500 # add at the end
 					ch.save(1)
 				else:	# overwrite if exists
-					sql("update `tabPurchase Tax Detail` set rate = %s, tax_amount = %s where name = %s and parent = %s ", (amt, amt, pr_oc_row[0][0], pr))
+					sql("update `tabPurchase Taxes and Charges` set rate = %s, tax_amount = %s where name = %s and parent = %s ", (amt, amt, pr_oc_row[0][0], pr))
 		
 		
 	def reset_other_charges(self, pr_obj):
diff --git a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt
index 1e12afa..c8db02e 100644
--- a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt
+++ b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt
@@ -3,59 +3,59 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-11-16 16:17:22',
+		'creation': '2012-03-27 14:36:34',
 		'docstatus': 0,
-		'modified': '2011-11-16 16:32:18',
-		'modified_by': 'Administrator',
-		'owner': 'wasim@webnotestech.com'
+		'modified': '2012-03-27 14:36:34',
+		'modified_by': u'Administrator',
+		'owner': u'wasim@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1321441191',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'_last_update': u'1321441191',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
 		'issingle': 1,
-		'module': 'Stock',
+		'module': u'Stock',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 1,
 		'version': 35
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Landed Cost Wizard',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Landed Cost Wizard',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Landed Cost Wizard',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Landed Cost Wizard',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Landed Cost Wizard
 	{
 		'doctype': 'DocType',
-		'name': 'Landed Cost Wizard'
+		'name': u'Landed Cost Wizard'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'All',
+		'role': u'All',
 		'write': 0
 	},
 
@@ -64,9 +64,9 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Purchase Manager',
+		'role': u'Purchase Manager',
 		'submit': 0,
 		'write': 1
 	},
@@ -74,148 +74,154 @@
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Purchase User',
+		'role': u'Purchase User',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'All'
+		'role': u'All'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'System Manager'
+		'role': u'System Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Purchase User'
+		'role': u'Purchase User'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Purchase Manager'
+		'role': u'Purchase Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'label': 'Process',
-		'options': '<div class="field_description"><b>Process:</b><br>1. Fetch and select Purchase Receipt<br>2. Enter extra costs<br>3. Click on Update Landed Cost button<br> 4. Cost will be added into other charges table of selected PR proportionately based on net total<br>5. Item Valuation Rate will be recalculated</div>'
+		'doctype': u'DocField',
+		'fieldname': u'process',
+		'fieldtype': u'HTML',
+		'label': u'Process',
+		'options': u'<div class="field_description"><b>Process:</b><br>1. Fetch and select Purchase Receipt<br>2. Enter extra costs<br>3. Click on Update Landed Cost button<br> 4. Cost will be added into other charges table of selected PR proportionately based on net total<br>5. Item Valuation Rate will be recalculated</div>'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'options': 'Simple'
+		'doctype': u'DocField',
+		'fieldname': u'section_break0',
+		'fieldtype': u'Section Break',
+		'options': u'Simple'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'from_pr_date',
-		'fieldtype': 'Date',
-		'label': 'From PR Date',
+		'doctype': u'DocField',
+		'fieldname': u'from_pr_date',
+		'fieldtype': u'Date',
+		'label': u'From PR Date',
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'to_pr_date',
-		'fieldtype': 'Date',
-		'label': 'To PR Date',
+		'doctype': u'DocField',
+		'fieldname': u'to_pr_date',
+		'fieldtype': u'Date',
+		'label': u'To PR Date',
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'currency',
-		'fieldtype': 'Select',
-		'label': 'Currency',
-		'options': 'link:Currency',
+		'doctype': u'DocField',
+		'fieldname': u'currency',
+		'fieldtype': u'Select',
+		'label': u'Currency',
+		'options': u'link:Currency',
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Get Purchase Receipt',
-		'options': 'get_purchase_receipts'
+		'doctype': u'DocField',
+		'fieldname': u'get_purchase_receipt',
+		'fieldtype': u'Button',
+		'label': u'Get Purchase Receipt',
+		'options': u'get_purchase_receipts'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'lc_pr_details',
-		'fieldtype': 'Table',
-		'label': 'LC PR Details',
-		'options': 'LC PR Detail'
+		'doctype': u'DocField',
+		'fieldname': u'lc_pr_details',
+		'fieldtype': u'Table',
+		'label': u'Landed Cost Purchase Receipts',
+		'options': u'Landed Cost Purchase Receipt'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'options': 'Simple'
+		'doctype': u'DocField',
+		'fieldname': u'section_break1',
+		'fieldtype': u'Section Break',
+		'options': u'Simple'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'landed_cost',
-		'fieldtype': 'Link',
-		'label': 'Select Landed Cost Details Master',
-		'options': 'Landed Cost Master'
+		'doctype': u'DocField',
+		'fieldname': u'landed_cost',
+		'fieldtype': u'Link',
+		'label': u'Select Landed Cost Items Master',
+		'options': u'Landed Cost Master'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Get Details',
-		'options': 'get_landed_cost_master_details'
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'get_details',
+		'fieldtype': u'Button',
+		'label': u'Get Details',
+		'options': u'get_landed_cost_master_details'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'landed_cost_details',
-		'fieldtype': 'Table',
-		'label': 'Landed Cost Details',
-		'options': 'Landed Cost Detail'
+		'doctype': u'DocField',
+		'fieldname': u'landed_cost_details',
+		'fieldtype': u'Table',
+		'label': u'Landed Cost Items',
+		'options': u'Landed Cost Item'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Update PR',
-		'options': 'update_landed_cost'
+		'doctype': u'DocField',
+		'fieldname': u'update_pr',
+		'fieldtype': u'Button',
+		'label': u'Update PR',
+		'options': u'update_landed_cost'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/lc_pr_detail/lc_pr_detail.txt b/erpnext/stock/doctype/lc_pr_detail/lc_pr_detail.txt
deleted file mode 100644
index b6bcb42..0000000
--- a/erpnext/stock/doctype/lc_pr_detail/lc_pr_detail.txt
+++ /dev/null
@@ -1,65 +0,0 @@
-# DocType, LC PR Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:07',
-		'docstatus': 0,
-		'modified': '2011-11-16 16:10:00',
-		'modified_by': 'Administrator',
-		'owner': 'wasim@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Stock',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 5
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'LC PR Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, LC PR Detail
-	{
-		'doctype': 'DocType',
-		'name': 'LC PR Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'purchase_receipt',
-		'fieldtype': 'Link',
-		'label': 'Purchase Receipt',
-		'oldfieldname': 'purchase_receipt_no',
-		'oldfieldtype': 'Link',
-		'options': 'Purchase Receipt',
-		'width': '220px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'select_pr',
-		'fieldtype': 'Check',
-		'label': 'Select PR',
-		'oldfieldname': 'include_in_landed_cost',
-		'oldfieldtype': 'Check',
-		'width': '120px'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.js b/erpnext/stock/doctype/packing_slip/packing_slip.js
index d3f4fb4..559f027 100644
--- a/erpnext/stock/doctype/packing_slip/packing_slip.js
+++ b/erpnext/stock/doctype/packing_slip/packing_slip.js
@@ -21,7 +21,7 @@
 
 cur_frm.fields_dict['item_details'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
 	return 'SELECT name, description FROM `tabItem` WHERE name IN ( \
-		SELECT item_code FROM `tabDelivery Note Detail` dnd \
+		SELECT item_code FROM `tabDelivery Note Item` dnd \
 		WHERE parent="'	+ doc.delivery_note + '" AND qty > packed_qty) AND %(key)s LIKE "%s" LIMIT 50';
 }
 
@@ -42,7 +42,7 @@
 
 cur_frm.cscript.onload = function(doc, cdt, cdn) {
 	if(doc.delivery_note) {
-		var ps_detail = getchildren('Packing Slip Detail', doc.name, 'item_details');
+		var ps_detail = getchildren('Packing Slip Item', doc.name, 'item_details');
 		if(!(flt(ps_detail[0].net_weight) && cstr(ps_detail[0].weight_uom))) {
 			cur_frm.cscript.update_item_details(doc);
 		}
@@ -85,7 +85,7 @@
 
 cur_frm.cscript.validate_calculate_item_details = function(doc) {
 	doc = locals[doc.doctype][doc.name];
-	var ps_detail = getchildren('Packing Slip Detail', doc.name, 'item_details');
+	var ps_detail = getchildren('Packing Slip Item', doc.name, 'item_details');
 
 	cur_frm.cscript.validate_duplicate_items(doc, ps_detail);
 	cur_frm.cscript.calc_net_total_pkg(doc, ps_detail);
diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.py b/erpnext/stock/doctype/packing_slip/packing_slip.py
index 90a1d71..74c8036 100644
--- a/erpnext/stock/doctype/packing_slip/packing_slip.py
+++ b/erpnext/stock/doctype/packing_slip/packing_slip.py
@@ -72,7 +72,7 @@
 		"""
 			Check packed qty across packing slips and delivery note
 		"""
-		# Get Delivery Note Details, Item Quantity Dict and No. of Cases for this Packing slip
+		# Get Delivery Note Items, Item Quantity Dict and No. of Cases for this Packing slip
 		dn_details, ps_item_qty, no_of_cases = self.get_details_for_packing()
 
 		for item in dn_details:
@@ -84,7 +84,7 @@
 	def get_details_for_packing(self):
 		"""
 			Returns
-			* 'Delivery Note Details' query result as a list of dict
+			* 'Delivery Note Items' query result as a list of dict
 			* Item Quantity dict of current packing slip doc
 			* No. of Cases of this packing slip
 		"""
@@ -96,7 +96,7 @@
 
 		res = webnotes.conn.sql("""\
 			SELECT item_code, IFNULL(SUM(qty), 0) as qty, IFNULL(packed_qty, 0) as packed_qty, stock_uom
-			FROM `tabDelivery Note Detail`
+			FROM `tabDelivery Note Item`
 			WHERE parent = "%s" AND item_code IN (%s)
 			GROUP BY item_code""" % (self.doc.delivery_note, item_codes),
 			as_dict=1)
@@ -143,7 +143,7 @@
 		if event not in ['submit', 'cancel']:
 			raise Exception('update_packed_quantity can only be called on submit or cancel')
 
-		# Get Delivery Note Details, Item Quantity Dict and No. of Cases for this Packing slip
+		# Get Delivery Note Items, Item Quantity Dict and No. of Cases for this Packing slip
 		dn_details, ps_item_qty, no_of_cases = self.get_details_for_packing()
 
 		for item in dn_details:
@@ -158,7 +158,7 @@
 					Please try again or contact support@erpnext.com" % item['item_code'], raise_exception=1)
 
 			webnotes.conn.sql("""\
-				UPDATE `tabDelivery Note Detail`
+				UPDATE `tabDelivery Note Item`
 				SET packed_qty = %s
 				WHERE parent = %s AND item_code = %s""",
 				(new_packed_qty, self.doc.delivery_note, item['item_code']))			
@@ -166,7 +166,7 @@
 
 	def update_item_details(self):
 		"""
-			Fill empty columns in Packing Slip Detail
+			Fill empty columns in Packing Slip Item
 		"""
 		self.doc.from_case_no = self.get_recommended_case_no()
 
diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.txt b/erpnext/stock/doctype/packing_slip/packing_slip.txt
index 6c54a9d..e380122 100644
--- a/erpnext/stock/doctype/packing_slip/packing_slip.txt
+++ b/erpnext/stock/doctype/packing_slip/packing_slip.txt
@@ -3,54 +3,55 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-01-30 12:13:10',
+		'creation': '2012-03-27 14:36:34',
 		'docstatus': 0,
-		'modified': '2012-02-02 10:37:15',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:45:49',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1328091392',
-		'autoname': 'PS.#######',
-		'colour': 'White:FFF',
+		'_last_update': u'1328091392',
+		'autoname': u'PS.#######',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Transaction',
+		'document_type': u'Transaction',
+		'is_submittable': 1,
 		'is_transaction_doc': 1,
-		'module': 'Stock',
+		'module': u'Stock',
 		'name': '__common__',
 		'read_only_onload': 1,
-		'search_fields': 'delivery_note',
-		'section_style': 'Simple',
+		'search_fields': u'delivery_note',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
-		'subject': '[%(delivery_note)s] Case Nos: %(from_case_no)s - %(to_case_no)s  |  Net Weight: %(net_weight_pkg)s %(net_weight_uom)s  |  Gross Weight: %(gross_weight_pkg)s %(gross_weight_uom)s',
+		'subject': u'[%(delivery_note)s] Case Nos: %(from_case_no)s - %(to_case_no)s  |  Net Weight: %(net_weight_pkg)s %(net_weight_uom)s  |  Gross Weight: %(gross_weight_pkg)s %(gross_weight_uom)s',
 		'version': 40
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Packing Slip',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Packing Slip',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Packing Slip',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Packing Slip',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Packing Slip
 	{
 		'doctype': 'DocType',
-		'name': 'Packing Slip'
+		'name': u'Packing Slip'
 	},
 
 	# DocPerm
@@ -58,9 +59,9 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Material User',
+		'role': u'Material User',
 		'submit': 1,
 		'write': 1
 	},
@@ -70,9 +71,9 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Sales User',
+		'role': u'Sales User',
 		'submit': 1,
 		'write': 1
 	},
@@ -82,9 +83,9 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Material Master Manager',
+		'role': u'Material Master Manager',
 		'submit': 1,
 		'write': 1
 	},
@@ -94,9 +95,9 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Material Manager',
+		'role': u'Material Manager',
 		'submit': 1,
 		'write': 1
 	},
@@ -106,61 +107,64 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Sales Manager',
+		'role': u'Sales Manager',
 		'submit': 1,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'All'
+		'role': u'All'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Packing Slip Details',
+		'doctype': u'DocField',
+		'fieldname': u'packing_slip_details',
+		'fieldtype': u'Section Break',
+		'label': u'Packing Slip Items',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'delivery_note',
-		'fieldtype': 'Link',
-		'label': 'Delivery Note',
-		'options': 'Delivery Note',
+		'doctype': u'DocField',
+		'fieldname': u'delivery_note',
+		'fieldtype': u'Link',
+		'label': u'Delivery Note',
+		'options': u'Delivery Note',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'naming_series',
-		'fieldtype': 'Select',
-		'label': 'Series',
+		'doctype': u'DocField',
+		'fieldname': u'naming_series',
+		'fieldtype': u'Select',
+		'label': u'Series',
 		'no_copy': 0,
-		'options': 'PS',
+		'options': u'PS',
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1
@@ -168,147 +172,167 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'section_break0',
+		'fieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break2',
+		'fieldtype': u'Column Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'from_case_no',
-		'fieldtype': 'Data',
-		'label': 'From Case No.',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'from_case_no',
+		'fieldtype': u'Data',
+		'label': u'From Case No.',
 		'no_copy': 1,
 		'permlevel': 0,
 		'reqd': 1,
-		'width': '50px'
+		'width': u'50px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break3',
+		'fieldtype': u'Column Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'to_case_no',
-		'fieldtype': 'Data',
-		'label': 'To Case No.',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'to_case_no',
+		'fieldtype': u'Data',
+		'label': u'To Case No.',
 		'no_copy': 1,
 		'permlevel': 0,
-		'width': '50px'
+		'width': u'50px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Package Item Details',
+		'doctype': u'DocField',
+		'fieldname': u'package_item_details',
+		'fieldtype': u'Section Break',
+		'label': u'Package Item Details',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'item_details',
-		'fieldtype': 'Table',
-		'label': 'Items',
-		'options': 'Packing Slip Detail',
+		'doctype': u'DocField',
+		'fieldname': u'item_details',
+		'fieldtype': u'Table',
+		'label': u'Items',
+		'options': u'Packing Slip Item',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Package Weight Details',
+		'doctype': u'DocField',
+		'fieldname': u'package_weight_details',
+		'fieldtype': u'Section Break',
+		'label': u'Package Weight Details',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'net_weight_pkg',
-		'fieldtype': 'Currency',
-		'label': 'Net Weight',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'net_weight_pkg',
+		'fieldtype': u'Currency',
+		'label': u'Net Weight',
 		'no_copy': 1,
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'net_weight_uom',
-		'fieldtype': 'Data',
-		'label': 'Net Weight UOM',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'net_weight_uom',
+		'fieldtype': u'Data',
+		'label': u'Net Weight UOM',
 		'no_copy': 1,
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break4',
+		'fieldtype': u'Column Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'gross_weight_pkg',
-		'fieldtype': 'Currency',
-		'label': 'Gross Weight',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'gross_weight_pkg',
+		'fieldtype': u'Currency',
+		'label': u'Gross Weight',
 		'no_copy': 1,
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'gross_weight_uom',
-		'fieldtype': 'Link',
-		'label': 'Gross Weight UOM',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'gross_weight_uom',
+		'fieldtype': u'Link',
+		'label': u'Gross Weight UOM',
 		'no_copy': 1,
-		'options': 'UOM',
+		'options': u'UOM',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:doc.amended_from',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Misc Details',
+		'depends_on': u'eval:doc.amended_from',
+		'doctype': u'DocField',
+		'fieldname': u'misc_details',
+		'fieldtype': u'Section Break',
+		'label': u'Misc Details',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amended_from',
-		'fieldtype': 'Link',
-		'label': 'Amended From',
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Link',
+		'label': u'Amended From',
 		'no_copy': 1,
-		'options': 'Packing Slip',
+		'options': u'Packing Slip',
 		'permlevel': 1,
 		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'depends_on': u'eval:doc.amended_from',
+		'description': u'The date at which current entry is corrected in the system.',
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
+		'label': u'Amendment Date',
+		'no_copy': 1,
+		'permlevel': 0,
+		'print_hide': 1
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/packing_slip_detail/packing_slip_detail.py b/erpnext/stock/doctype/packing_slip_detail/packing_slip_detail.py
deleted file mode 100644
index 2b48ed0..0000000
--- a/erpnext/stock/doctype/packing_slip_detail/packing_slip_detail.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import webnotes
-
-class DocType:
-	def __init__(self, d, dl):
-		self.doc, self.doclist = d, dl
-
-	def get_item_details(self, delivery_note):
-		res = webnotes.conn.sql("""\
-			SELECT item_name, SUM(IFNULL(qty, 0)) as total_qty,
-			IFNULL(packed_qty,	0) as packed_qty, stock_uom
-			FROM `tabDelivery Note Detail`
-			WHERE parent=%s AND item_code=%s GROUP BY item_code""",
-			(delivery_note, self.doc.item_code), as_dict=1)
-
-		if res and len(res)>0:
-			res = res[0]
-			res['qty'] = res['total_qty'] - res['packed_qty']
-			res['qty'] = self.doc.qty or (res['qty']>=0 and res['qty'] or 0)
-			del res['total_qty']
-			del res['packed_qty']
-			self.doc.fields.update(res)
-
-		res = webnotes.conn.sql("""\
-			SELECT net_weight, weight_uom FROM `tabItem`
-			WHERE name=%s""", self.doc.item_code, as_dict=1)
-
-		if res and len(res)>0:
-			res = res[0]
-			self.doc.fields.update(res)
diff --git a/erpnext/stock/doctype/packing_slip_detail/packing_slip_detail.txt b/erpnext/stock/doctype/packing_slip_detail/packing_slip_detail.txt
deleted file mode 100644
index 5a83b6f..0000000
--- a/erpnext/stock/doctype/packing_slip_detail/packing_slip_detail.txt
+++ /dev/null
@@ -1,113 +0,0 @@
-# DocType, Packing Slip Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-01-30 17:40:50',
-		'docstatus': 0,
-		'modified': '2012-01-31 13:15:40',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'PSD/.#######',
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Stock',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'show_in_menu': 0,
-		'version': 9
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Packing Slip Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# DocType, Packing Slip Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Packing Slip Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'item_code',
-		'fieldtype': 'Link',
-		'label': 'Item Code',
-		'options': 'Item',
-		'permlevel': 0,
-		'reqd': 1,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'item_name',
-		'fieldtype': 'Data',
-		'label': 'Item Name',
-		'permlevel': 1,
-		'width': '200px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'qty',
-		'fieldtype': 'Currency',
-		'label': 'Quantity',
-		'permlevel': 0,
-		'reqd': 1,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'stock_uom',
-		'fieldtype': 'Data',
-		'label': 'UOM',
-		'permlevel': 1,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'net_weight',
-		'fieldtype': 'Float',
-		'label': 'Net Weight',
-		'permlevel': 1,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'weight_uom',
-		'fieldtype': 'Link',
-		'label': 'Weight UOM',
-		'options': 'UOM',
-		'permlevel': 1,
-		'width': '100px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'page_break',
-		'fieldtype': 'Check',
-		'label': 'Page Break',
-		'permlevel': 0
-	}
-]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/packing_slip_detail/__init__.py b/erpnext/stock/doctype/packing_slip_item/__init__.py
similarity index 100%
rename from erpnext/stock/doctype/packing_slip_detail/__init__.py
rename to erpnext/stock/doctype/packing_slip_item/__init__.py
diff --git a/erpnext/stock/doctype/packing_slip_item/packing_slip_item.py b/erpnext/stock/doctype/packing_slip_item/packing_slip_item.py
new file mode 100644
index 0000000..761c572
--- /dev/null
+++ b/erpnext/stock/doctype/packing_slip_item/packing_slip_item.py
@@ -0,0 +1,45 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+import webnotes
+
+class DocType:
+	def __init__(self, d, dl):
+		self.doc, self.doclist = d, dl
+
+	def get_item_details(self, delivery_note):
+		res = webnotes.conn.sql("""\
+			SELECT item_name, SUM(IFNULL(qty, 0)) as total_qty,
+			IFNULL(packed_qty,	0) as packed_qty, stock_uom
+			FROM `tabDelivery Note Item`
+			WHERE parent=%s AND item_code=%s GROUP BY item_code""",
+			(delivery_note, self.doc.item_code), as_dict=1)
+
+		if res and len(res)>0:
+			res = res[0]
+			res['qty'] = res['total_qty'] - res['packed_qty']
+			res['qty'] = self.doc.qty or (res['qty']>=0 and res['qty'] or 0)
+			del res['total_qty']
+			del res['packed_qty']
+			self.doc.fields.update(res)
+
+		res = webnotes.conn.sql("""\
+			SELECT net_weight, weight_uom FROM `tabItem`
+			WHERE name=%s""", self.doc.item_code, as_dict=1)
+
+		if res and len(res)>0:
+			res = res[0]
+			self.doc.fields.update(res)
diff --git a/erpnext/stock/doctype/packing_slip_item/packing_slip_item.txt b/erpnext/stock/doctype/packing_slip_item/packing_slip_item.txt
new file mode 100644
index 0000000..66376a4
--- /dev/null
+++ b/erpnext/stock/doctype/packing_slip_item/packing_slip_item.txt
@@ -0,0 +1,113 @@
+# DocType, Packing Slip Item
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:34',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:34',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'PSD/.#######',
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Stock',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'show_in_menu': 0,
+		'version': 9
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Packing Slip Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Packing Slip Item
+	{
+		'doctype': 'DocType',
+		'name': u'Packing Slip Item'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'label': u'Item Code',
+		'options': u'Item',
+		'permlevel': 0,
+		'reqd': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_name',
+		'fieldtype': u'Data',
+		'label': u'Item Name',
+		'permlevel': 1,
+		'width': u'200px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'qty',
+		'fieldtype': u'Currency',
+		'label': u'Quantity',
+		'permlevel': 0,
+		'reqd': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'stock_uom',
+		'fieldtype': u'Data',
+		'label': u'UOM',
+		'permlevel': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'net_weight',
+		'fieldtype': u'Float',
+		'label': u'Net Weight',
+		'permlevel': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'weight_uom',
+		'fieldtype': u'Link',
+		'label': u'Weight UOM',
+		'options': u'UOM',
+		'permlevel': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'page_break',
+		'fieldtype': u'Check',
+		'label': u'Page Break',
+		'permlevel': 0
+	}
+]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index 7ad9d91..8761881 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -14,13 +14,14 @@
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-cur_frm.cscript.tname = "Purchase Receipt Detail";
+cur_frm.cscript.tname = "Purchase Receipt Item";
 cur_frm.cscript.fname = "purchase_receipt_details";
 cur_frm.cscript.other_fname = "purchase_tax_details";
 
-$import(Purchase Common)
-$import(Purchase Other Charges)
-$import(SMS Control)
+wn.require('erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js');
+wn.require('erpnext/buying/doctype/purchase_common/purchase_common.js');
+wn.require('erpnext/utilities/doctype/sms_control/sms_control.js');
+wn.require('erpnext/setup/doctype/notification_control/notification_control.js');
 
 //========================== On Load ================================================================
 cur_frm.cscript.onload = function(doc, cdt, cdn) {
@@ -62,16 +63,13 @@
 
 
 	if(doc.docstatus == 1){
-		var ch = getchildren('Purchase Receipt Detail',doc.name,'purchase_receipt_details');
+		var ch = getchildren('Purchase Receipt Item',doc.name,'purchase_receipt_details');
 		allow_billing = 0;
 		for(var i in ch){
 			if(ch[i].qty > ch[i].billed_qty) allow_billing = 1;
 		}
 	 cur_frm.add_custom_button('Make Purchase Invoice', cur_frm.cscript['Make Purchase Invoice']);
-	 cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
-	}
-	else{
-		hide_field(['Repair Purchase Receipt']);
+	 cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
 	}
 }
 
@@ -108,7 +106,7 @@
 
 // Get Purchase Order Button
 // -----------------
-cur_frm.cscript['Pull Purchase Order Details'] = function(doc, dt, dn) {
+cur_frm.cscript.pull_purchase_order_details = function(doc, dt, dn) {
 	var callback = function(r,rt) { 
 		unhide_field(['supplier_address','contact_person','supplier_name','address_display', 'contact_display', 'contact_mobile','contact_email']);				
 		refresh_many(['supplier','supplier_address','contact_person', 'supplier_name', 'address_display', 'contact_display','contact_mobile', 'contact_email', 'purchase_receipt_details', 'purchase_tax_details']);
@@ -172,7 +170,7 @@
 			'stock_qty': 0,
 			'rejected_qty' : 0
 		}
-	set_multiple('Purchase Receipt Detail', cdn, ret, 'purchase_receipt_details');
+	set_multiple('Purchase Receipt Item', cdn, ret, 'purchase_receipt_details');
 	cur_frm.cscript.calc_amount(doc, 2);
 }
 
@@ -189,7 +187,7 @@
 			'rejected_qty' : 0
 		}
 		// => Set Qty = 0 and rejected_qty = 0
-		set_multiple('Purchase Receipt Detail', cdn, ret, 'purchase_receipt_details');
+		set_multiple('Purchase Receipt Item', cdn, ret, 'purchase_receipt_details');
 		cur_frm.cscript.calc_amount(doc, 2);
 		// => Return
 		return
@@ -200,7 +198,7 @@
 			'rejected_qty':flt(d.received_qty) - flt(d.qty)
 		}
 		// => Set Rejected Qty = Received Qty - Qty
-		set_multiple('Purchase Receipt Detail', cdn, ret, 'purchase_receipt_details');
+		set_multiple('Purchase Receipt Item', cdn, ret, 'purchase_receipt_details');
 		// => Calculate Amount
 		cur_frm.cscript.calc_amount(doc, 2);
 		cur_frm.cscript.update_stock_qty(doc,cdt,cdn);
@@ -219,7 +217,7 @@
 			'rejected_qty' : 0
 		}
 		// => Set Qty = 0 and rejected_qty = 0
-		set_multiple('Purchase Receipt Detail', cdn, ret, 'purchase_receipt_details');
+		set_multiple('Purchase Receipt Item', cdn, ret, 'purchase_receipt_details');
 		cur_frm.cscript.calc_amount(doc, 2);
 		// => Return
 		return
@@ -230,7 +228,7 @@
 			'qty':flt(d.received_qty) - flt(d.rejected_qty)
 		}
 		// => Set Qty = Received Qty - Rejected Qty
-		set_multiple('Purchase Receipt Detail', cdn, ret, 'purchase_receipt_details');
+		set_multiple('Purchase Receipt Item', cdn, ret, 'purchase_receipt_details');
 		// Calculate Amount
 		cur_frm.cscript.calc_amount(doc, 2);
 		cur_frm.cscript.update_stock_qty(doc,cdt,cdn);
@@ -249,7 +247,7 @@
 //---------------------------------
 
 cur_frm.fields_dict.purchase_receipt_details.grid.get_field("qa_no").get_query = function(doc) {
-	return 'SELECT `tabQA Inspection Report`.name FROM `tabQA Inspection Report` WHERE `tabQA Inspection Report`.docstatus = 1 AND `tabQA Inspection Report`.%(key)s LIKE "%s"';
+	return 'SELECT `tabQuality Inspection`.name FROM `tabQuality Inspection` WHERE `tabQuality Inspection`.docstatus = 1 AND `tabQuality Inspection`.%(key)s LIKE "%s"';
 }
 
 // On Button Click Functions
@@ -258,15 +256,15 @@
 
 // ================================ Make Purchase Invoice ==========================================
 cur_frm.cscript['Make Purchase Invoice'] = function() {
-	n = createLocal('Payable Voucher');
+	n = createLocal('Purchase Invoice');
 	$c('dt_map', args={
-		'docs':compress_doclist([locals['Payable Voucher'][n]]),
+		'docs':compress_doclist([locals['Purchase Invoice'][n]]),
 		'from_doctype': cur_frm.doc.doctype,
-		'to_doctype':'Payable Voucher',
+		'to_doctype':'Purchase Invoice',
 		'from_docname': cur_frm.doc.name,
-		'from_to_list':"[['Purchase Receipt','Payable Voucher'],['Purchase Receipt Detail','PV Detail'],['Purchase Tax Detail','Purchase Tax Detail']]"
+		'from_to_list':"[['Purchase Receipt','Purchase Invoice'],['Purchase Receipt Item','Purchase Invoice Item'],['Purchase Taxes and Charges','Purchase Taxes and Charges']]"
 		}, function(r,rt) {
-			loaddoc('Payable Voucher', n);
+			loaddoc('Purchase Invoice', n);
 		}
 	);
 }
@@ -288,7 +286,7 @@
 
 	out ='';
 	
-	var cl = getchildren('Purchase Receipt Detail',doc.name,'purchase_receipt_details');
+	var cl = getchildren('Purchase Receipt Item',doc.name,'purchase_receipt_details');
 
 	// outer table	
 	var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 50%"></td><td>';
@@ -315,7 +313,6 @@
 	return out;
 }
 
-$import(Notification Control)
 cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
 	var args = {
 		type: 'Purchase Receipt',
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 88cfbe3..798a2c5 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -39,7 +39,7 @@
 		self.doc = doc
 		self.doclist = doclist
 		self.defaults = get_defaults()
-		self.tname = 'Purchase Receipt Detail'
+		self.tname = 'Purchase Receipt Item'
 		self.fname = 'purchase_receipt_details'
 		self.count = 0
 
@@ -96,7 +96,7 @@
 	# Pull Purchase Order
 	def get_po_details(self):
 		self.validate_prev_docname()
-		get_obj('DocType Mapper', 'Purchase Order-Purchase Receipt').dt_map('Purchase Order', 'Purchase Receipt', self.doc.purchase_order_no, self.doc, self.doclist, "[['Purchase Order','Purchase Receipt'],['PO Detail', 'Purchase Receipt Detail'],['Purchase Tax Detail','Purchase Tax Detail']]")
+		get_obj('DocType Mapper', 'Purchase Order-Purchase Receipt').dt_map('Purchase Order', 'Purchase Receipt', self.doc.purchase_order_no, self.doc, self.doclist, "[['Purchase Order','Purchase Receipt'],['Purchase Order Item', 'Purchase Receipt Item'],['Purchase Taxes and Charges','Purchase Taxes and Charges']]")
 
 	# validate if PO has been pulled twice
 	def validate_prev_docname(self):
@@ -155,7 +155,7 @@
 	#check in manage account if purchase order required or not.
 	# ====================================================================================
 	def po_required(self):
-		res = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = 'po_required'")
+		res = sql("select value from `tabSingles` where doctype = 'Global Defaults' and field = 'po_required'")
 		if res and res[0][0]== 'Yes':
 			 for d in getlist(self.doclist,'purchase_receipt_details'):
 				 if not d.prevdoc_docname:
@@ -216,7 +216,7 @@
 				# Check If Prevdoc Doctype is Purchase Order
 				if cstr(d.prevdoc_doctype) == 'Purchase Order':
 					# get qty and pending_qty of prevdoc
-					curr_ref_qty = pc_obj.get_qty( d.doctype, 'prevdoc_detail_docname', d.prevdoc_detail_docname, 'PO Detail', 'Purchase Order - Purchase Receipt', self.doc.name)
+					curr_ref_qty = pc_obj.get_qty( d.doctype, 'prevdoc_detail_docname', d.prevdoc_detail_docname, 'Purchase Order Item', 'Purchase Order - Purchase Receipt', self.doc.name)
 					max_qty, qty, curr_qty = flt(curr_ref_qty.split('~~~')[1]), flt(curr_ref_qty.split('~~~')[0]), 0
 
 					if flt(qty) + flt(pr_qty) > flt(max_qty):
@@ -267,7 +267,7 @@
 			ins_reqd = sql("select inspection_required from `tabItem` where name = %s", (d.item_code), as_dict = 1)
 			ins_reqd = ins_reqd and ins_reqd[0]['inspection_required'] or 'No'
 			if ins_reqd == 'Yes' and not d.qa_no:
-				msgprint("Item: " + d.item_code + " requires QA Inspection. Please enter QA No or report to authorized person to create QA Inspection Report")
+				msgprint("Item: " + d.item_code + " requires QA Inspection. Please enter QA No or report to authorized person to create Quality Inspection")
 
 	# Check for Stopped status
 	def check_for_stopped_status(self, pc_obj):
@@ -304,7 +304,7 @@
 	#On Cancel
 	#----------------------------------------------------------------------------------------------------
 	def check_next_docstatus(self):
-		submit_rv = sql("select t1.name from `tabPayable Voucher` t1,`tabPV Detail` t2 where t1.name = t2.parent and t2.purchase_receipt = '%s' and t1.docstatus = 1" % (self.doc.name))
+		submit_rv = sql("select t1.name from `tabPurchase Invoice` t1,`tabPurchase Invoice Item` t2 where t1.name = t2.parent and t2.purchase_receipt = '%s' and t1.docstatus = 1" % (self.doc.name))
 		if submit_rv:
 			msgprint("Purchase Invoice : " + cstr(self.submit_rv[0][0]) + " has already been submitted !")
 			raise Exception , "Validation Error."
@@ -314,10 +314,10 @@
 		pc_obj = get_obj('Purchase Common')
 
 		self.check_for_stopped_status(pc_obj)
-		# 1.Check if Payable Voucher has been submitted against current Purchase Order
-		# pc_obj.check_docstatus(check = 'Next', doctype = 'Payable Voucher', docname = self.doc.name, detail_doctype = 'PV Detail')
+		# 1.Check if Purchase Invoice has been submitted against current Purchase Order
+		# pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Invoice', docname = self.doc.name, detail_doctype = 'Purchase Invoice Item')
 
-		submitted = sql("select t1.name from `tabPayable Voucher` t1,`tabPV Detail` t2 where t1.name = t2.parent and t2.purchase_receipt = '%s' and t1.docstatus = 1" % self.doc.name)
+		submitted = sql("select t1.name from `tabPurchase Invoice` t1,`tabPurchase Invoice Item` t2 where t1.name = t2.parent and t2.purchase_receipt = '%s' and t1.docstatus = 1" % self.doc.name)
 		if submitted:
 			msgprint("Purchase Invoice : " + cstr(submitted[0][0]) + " has already been submitted !")
 			raise Exception
@@ -331,7 +331,7 @@
 		# 4.Update Bin
 		self.update_stock(is_submit = 0)
 
-		# 5.Update Indents Pending Qty and accordingly it's Status
+		# 5.Update Purchase Requests Pending Qty and accordingly it's Status
 		pc_obj.update_prevdoc_detail(self, is_submit = 0)
 
 		# 6. Update last purchase rate
@@ -365,13 +365,13 @@
 					self.add_bom(d)
 
 			self.delete_irrelevant_raw_material()
-			#---------------calculate amt in	PR Raw Material Detail-------------
+			#---------------calculate amt in	Purchase Receipt Item Supplied-------------
 			self.calculate_amount(d)
 
 
 	def add_bom(self, d):
 		#----- fetching default bom from Bill of Materials instead of Item Master --
-		bom_det = sql("select t1.item, t2.item_code, t2.qty_consumed_per_unit, t2.moving_avg_rate, t2.value_as_per_mar, t2.stock_uom, t2.name, t2.description from `tabBill Of Materials` t1, `tabBOM Material` t2 where t2.parent = t1.name and t1.item = '%s' and ifnull(t1.is_default,0) = 1 and t1.docstatus = 1 and t2.docstatus =1" % d.item_code)
+		bom_det = sql("select t1.item, t2.item_code, t2.qty_consumed_per_unit, t2.moving_avg_rate, t2.value_as_per_mar, t2.stock_uom, t2.name, t2.description from `tabBOM` t1, `tabBOM Item` t2 where t2.parent = t1.name and t1.item = '%s' and ifnull(t1.is_default,0) = 1 and t1.docstatus = 1 and t2.docstatus =1" % d.item_code)
 		if not bom_det:
 			msgprint("No default BOM exists for item: %s" % d.item_code)
 			raise Exception
@@ -380,9 +380,9 @@
 			chgd_rqd_qty = []
 			for i in bom_det:
 
-				if i and not sql("select name from `tabPR Raw Material Detail` where reference_name = '%s' and bom_detail_no = '%s' and parent = '%s' " %(d.name, i[6], self.doc.name)):
+				if i and not sql("select name from `tabPurchase Receipt Item Supplied` where reference_name = '%s' and bom_detail_no = '%s' and parent = '%s' " %(d.name, i[6], self.doc.name)):
 
-					rm_child = addchild(self.doc, 'pr_raw_material_details', 'PR Raw Material Detail', 1, self.doclist)
+					rm_child = addchild(self.doc, 'pr_raw_material_details', 'Purchase Receipt Item Supplied', 1, self.doclist)
 
 					rm_child.reference_name = d.name
 					rm_child.bom_detail_no = i and i[6] or ''
@@ -419,7 +419,7 @@
 	#--------------------------------------------------------------
 	def delete_irrelevant_raw_material(self):
 		for d in getlist(self.doclist,'pr_raw_material_details'):
-			if not sql("select name from `tabPurchase Receipt Detail` where name = '%s' and parent = '%s' and item_code = '%s'" % (d.reference_name, self.doc.name, d.main_item_code)):
+			if not sql("select name from `tabPurchase Receipt Item` where name = '%s' and parent = '%s' and item_code = '%s'" % (d.reference_name, self.doc.name, d.main_item_code)):
 				d.parent = 'old_par:'+self.doc.name
 				d.save()
 
@@ -466,8 +466,3 @@
 	# **** Pull details from other charges master (Get Other Charges) ****
 	def get_purchase_tax_details(self):
 		return get_obj('Purchase Common').get_purchase_tax_details(self)
-
-	# Repair Purchase Order
-	# ===========================================
-	def repair_purchase_receipt(self):
-		get_obj('Purchase Common').repair_curr_doctype_details(self)
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt
index 6724b69..7b5c82c 100755
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:15',
+		'creation': '2012-04-11 13:18:46',
 		'docstatus': 0,
-		'modified': '2012-03-02 12:26:39',
+		'modified': '2012-04-12 17:50:10',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -13,10 +13,12 @@
 	# These values are common for all DocType
 	{
 		'_last_update': u'1330593645',
+		'allow_attach': 1,
 		'colour': u'White:FFF',
 		'default_print_format': u'Standard',
 		'doctype': 'DocType',
 		'document_type': u'Transaction',
+		'is_submittable': 1,
 		'is_transaction_doc': 1,
 		'module': u'Stock',
 		'name': '__common__',
@@ -26,7 +28,7 @@
 		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'subject': u'From %(supplier_name)s against %(purchase_order)s on %(posting_date)s',
-		'version': 325
+		'version': 327
 	},
 
 	# These values are common for all DocField
@@ -142,6 +144,7 @@
 		'colour': u'White:FFF',
 		'description': u'Enter Basic Information about the Purchase Receipt',
 		'doctype': u'DocField',
+		'fieldname': u'basic_info',
 		'fieldtype': u'Section Break',
 		'label': u'Basic Info',
 		'oldfieldtype': u'Section Break',
@@ -151,6 +154,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -296,6 +300,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break1',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -435,6 +440,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'items',
 		'fieldtype': u'Section Break',
 		'label': u'Items',
 		'oldfieldtype': u'Section Break',
@@ -511,6 +517,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break2',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0
@@ -536,6 +543,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'pull_purchase_order_details',
 		'fieldtype': u'Button',
 		'label': u'Pull Purchase Order Details',
 		'oldfieldtype': u'Button',
@@ -548,6 +556,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'section_break0',
 		'fieldtype': u'Section Break',
 		'oldfieldtype': u'Section Break',
 		'options': u'Simple',
@@ -560,10 +569,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'purchase_receipt_details',
 		'fieldtype': u'Table',
-		'label': u'Purchase Receipt Details',
+		'label': u'Purchase Receipt Items',
 		'oldfieldname': u'purchase_receipt_details',
 		'oldfieldtype': u'Table',
-		'options': u'Purchase Receipt Detail',
+		'options': u'Purchase Receipt Item',
 		'permlevel': 0,
 		'print_hide': 0,
 		'reqd': 0
@@ -586,6 +595,19 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'get_current_stock',
+		'fieldtype': u'Button',
+		'label': u'Get Current Stock',
+		'oldfieldtype': u'Button',
+		'options': u'get_current_stock',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'recalculate_values',
 		'fieldtype': u'Button',
 		'label': u'Re-Calculate Values',
 		'oldfieldtype': u'Button',
@@ -596,8 +618,9 @@
 	# DocField
 	{
 		'colour': u'White:FFF',
-		'description': u'Add / Edit taxes and other charges',
+		'description': u'Add / Edit Taxes and Charges',
 		'doctype': u'DocField',
+		'fieldname': u'taxes',
 		'fieldtype': u'Section Break',
 		'label': u'Taxes',
 		'oldfieldtype': u'Section Break',
@@ -607,14 +630,14 @@
 	# DocField
 	{
 		'colour': u'White:FFF',
-		'description': u'If you have created a standard template in Other Charges master, select one and click on the button below.',
+		'description': u'If you have created a standard template in Purchase Taxes and Charges Master, select one and click on the button below.',
 		'doctype': u'DocField',
 		'fieldname': u'purchase_other_charges',
 		'fieldtype': u'Link',
-		'label': u'Purchase Other Charges',
+		'label': u'Purchase Taxes and Charges',
 		'oldfieldname': u'purchase_other_charges',
 		'oldfieldtype': u'Link',
-		'options': u'Purchase Other Charges',
+		'options': u'Purchase Taxes and Charges Master',
 		'permlevel': 0,
 		'print_hide': 1
 	},
@@ -622,6 +645,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'get_tax_detail',
 		'fieldtype': u'Button',
 		'label': u'Get Tax Detail',
 		'oldfieldtype': u'Button',
@@ -635,16 +659,17 @@
 		'doctype': u'DocField',
 		'fieldname': u'purchase_tax_details',
 		'fieldtype': u'Table',
-		'label': u'Purchase Tax Details',
+		'label': u'Purchase Taxes and Charges',
 		'oldfieldname': u'purchase_tax_details',
 		'oldfieldtype': u'Table',
-		'options': u'Purchase Tax Detail',
+		'options': u'Purchase Taxes and Charges',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'calculate_tax',
 		'fieldtype': u'Button',
 		'label': u'Calculate Tax',
 		'oldfieldtype': u'Button',
@@ -668,6 +693,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'tax_calculation',
 		'fieldtype': u'HTML',
 		'label': u'Tax Calculation',
 		'oldfieldtype': u'HTML',
@@ -680,6 +706,7 @@
 		'colour': u'White:FFF',
 		'description': u'Detailed Breakup of the totals',
 		'doctype': u'DocField',
+		'fieldname': u'totals',
 		'fieldtype': u'Section Break',
 		'label': u'Totals',
 		'oldfieldtype': u'Section Break',
@@ -730,7 +757,7 @@
 		'doctype': u'DocField',
 		'fieldname': u'other_charges_added',
 		'fieldtype': u'Currency',
-		'label': u'Other Charges Added',
+		'label': u'Taxes and Charges Added',
 		'oldfieldname': u'other_charges_added',
 		'oldfieldtype': u'Currency',
 		'permlevel': 1,
@@ -742,7 +769,7 @@
 		'doctype': u'DocField',
 		'fieldname': u'other_charges_deducted',
 		'fieldtype': u'Currency',
-		'label': u'Other Charges Deducted',
+		'label': u'Taxes and Charges Deducted',
 		'oldfieldname': u'other_charges_deducted',
 		'oldfieldtype': u'Currency',
 		'permlevel': 1,
@@ -752,6 +779,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break3',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'width': u'50%'
@@ -799,7 +827,7 @@
 		'doctype': u'DocField',
 		'fieldname': u'other_charges_added_import',
 		'fieldtype': u'Currency',
-		'label': u'Other Charges Added (Import)',
+		'label': u'Taxes and Charges Added (Import)',
 		'oldfieldname': u'other_charges_added_import',
 		'oldfieldtype': u'Currency',
 		'permlevel': 1,
@@ -811,7 +839,7 @@
 		'doctype': u'DocField',
 		'fieldname': u'other_charges_deducted_import',
 		'fieldtype': u'Currency',
-		'label': u'Other Charges Deducted (Import)',
+		'label': u'Taxes and Charges Deducted (Import)',
 		'oldfieldname': u'other_charges_deducted_import',
 		'oldfieldtype': u'Currency',
 		'permlevel': 1,
@@ -821,10 +849,11 @@
 	# DocField
 	{
 		'colour': u'White:FFF',
-		'description': u'Add Terms and Conditions for the Purchase Receipt. You can also prepare a master Term Sheet and use the Template.',
+		'description': u'Add Terms and Conditions for the Purchase Receipt. You can also prepare a Terms and Conditions Master and use the Template.',
 		'doctype': u'DocField',
+		'fieldname': u'terms_section_break',
 		'fieldtype': u'Section Break',
-		'label': u'Terms',
+		'label': u'Terms and Conditions',
 		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
@@ -834,10 +863,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'tc_name',
 		'fieldtype': u'Link',
-		'label': u'Select Terms',
+		'label': u'Select Terms and Conditions',
 		'oldfieldname': u'tc_name',
 		'oldfieldtype': u'Link',
-		'options': u'Term',
+		'options': u'Terms and Conditions',
 		'permlevel': 0,
 		'print_hide': 1
 	},
@@ -845,8 +874,9 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'get_terms',
 		'fieldtype': u'Button',
-		'label': u'Get Terms',
+		'label': u'Get Terms and Conditions',
 		'oldfieldtype': u'Button',
 		'options': u'get_tc_details',
 		'permlevel': 0
@@ -855,8 +885,9 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'terms_html',
 		'fieldtype': u'HTML',
-		'label': u'Terms HTML',
+		'label': u'Terms and Conditions HTML',
 		'oldfieldtype': u'HTML',
 		'options': u'You can add Terms and Notes that will be printed in the Transaction',
 		'permlevel': 0,
@@ -868,7 +899,7 @@
 		'doctype': u'DocField',
 		'fieldname': u'terms',
 		'fieldtype': u'Text Editor',
-		'label': u'Terms1',
+		'label': u'Terms and Conditions1',
 		'oldfieldname': u'terms',
 		'oldfieldtype': u'Text Editor',
 		'permlevel': 0
@@ -879,6 +910,7 @@
 		'colour': u'White:FFF',
 		'description': u'Filing in Additional Information about the Purchase Receipt will help you analyze your data better.',
 		'doctype': u'DocField',
+		'fieldname': u'more_info',
 		'fieldtype': u'Section Break',
 		'label': u'More Info',
 		'oldfieldtype': u'Section Break',
@@ -926,6 +958,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break4',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -937,6 +970,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'other_details',
 		'fieldtype': u'HTML',
 		'hidden': 1,
 		'label': u'Other Details',
@@ -1006,6 +1040,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'transporter_info',
 		'fieldtype': u'Section Break',
 		'label': u'Transporter Info',
 		'permlevel': 0
@@ -1057,6 +1092,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break5',
 		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'width': u'50%'
@@ -1099,6 +1135,7 @@
 		'colour': u'White:FFF',
 		'description': u'Following table will show values if items are sub - contracted. These values will be fetched from the master of "Bill of Materials" of sub - contracted items.',
 		'doctype': u'DocField',
+		'fieldname': u'raw_material_details',
 		'fieldtype': u'Section Break',
 		'label': u'Raw Material Details',
 		'oldfieldtype': u'Section Break',
@@ -1109,37 +1146,25 @@
 	# DocField
 	{
 		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Get Current Stock',
-		'oldfieldtype': u'Button',
-		'options': u'get_current_stock',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
 		'fieldname': u'pr_raw_material_details',
 		'fieldtype': u'Table',
-		'label': u'PR Raw Material Details',
+		'label': u'Purchase Receipt Item Supplieds',
 		'no_copy': 1,
 		'oldfieldname': u'pr_raw_material_details',
 		'oldfieldtype': u'Table',
-		'options': u'PR Raw Material Detail',
+		'options': u'Purchase Receipt Item Supplied',
 		'permlevel': 1,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'allow_on_submit': 1,
-		'colour': u'White:FFF',
 		'doctype': u'DocField',
-		'fieldtype': u'Button',
-		'label': u'Repair Purchase Receipt',
-		'oldfieldtype': u'Button',
-		'options': u'repair_purchase_receipt',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
+		'hidden': 1,
+		'label': u'File List',
+		'no_copy': 1,
 		'permlevel': 0,
 		'print_hide': 1
 	}
diff --git a/erpnext/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt b/erpnext/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt
deleted file mode 100755
index 815864f..0000000
--- a/erpnext/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt
+++ /dev/null
@@ -1,582 +0,0 @@
-# DocType, Purchase Receipt Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:16',
-		'docstatus': 0,
-		'modified': '2012-03-05 17:44:23',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': u'GRND/.#######',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': u'Stock',
-		'name': '__common__',
-		'section_style': u'Tray',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 78
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Purchase Receipt Detail',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# DocType, Purchase Receipt Detail
-	{
-		'doctype': 'DocType',
-		'name': u'Purchase Receipt Detail'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_code',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Item Code',
-		'oldfieldname': u'item_code',
-		'oldfieldtype': u'Link',
-		'options': u'Item',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_name',
-		'fieldtype': u'Data',
-		'in_filter': 0,
-		'label': u'Item Name',
-		'oldfieldname': u'item_name',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'description',
-		'fieldtype': u'Text',
-		'label': u'Description',
-		'oldfieldname': u'description',
-		'oldfieldtype': u'Text',
-		'permlevel': 0,
-		'reqd': 1,
-		'width': u'300px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'received_qty',
-		'fieldtype': u'Currency',
-		'label': u'Recd Quantity',
-		'oldfieldname': u'received_qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'qty',
-		'fieldtype': u'Currency',
-		'label': u'Accepted Quantity',
-		'oldfieldname': u'qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'rejected_qty',
-		'fieldtype': u'Currency',
-		'in_filter': 0,
-		'label': u'Rejected Quantity',
-		'oldfieldname': u'rejected_qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'search_index': 0,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'import_ref_rate',
-		'fieldtype': u'Currency',
-		'label': u'Ref Rate ',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'discount_rate',
-		'fieldtype': u'Currency',
-		'label': u'Discount  %',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'import_rate',
-		'fieldtype': u'Currency',
-		'label': u'Rate',
-		'oldfieldname': u'import_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 0,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'import_amount',
-		'fieldtype': u'Currency',
-		'label': u'Amount',
-		'oldfieldname': u'import_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'purchase_ref_rate',
-		'fieldtype': u'Currency',
-		'label': u'Ref Rate *',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'purchase_rate',
-		'fieldtype': u'Currency',
-		'label': u'Rate *(Default Curr.)',
-		'oldfieldname': u'purchase_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'amount',
-		'fieldtype': u'Currency',
-		'label': u'Amount (Default Curr.)',
-		'oldfieldname': u'amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 0,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'warehouse',
-		'fieldtype': u'Link',
-		'hidden': 0,
-		'label': u'Accepted Warehouse',
-		'oldfieldname': u'warehouse',
-		'oldfieldtype': u'Link',
-		'options': u'Warehouse',
-		'permlevel': 0,
-		'print_hide': 1,
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'uom',
-		'fieldtype': u'Link',
-		'label': u'UOM',
-		'oldfieldname': u'uom',
-		'oldfieldtype': u'Link',
-		'options': u'UOM',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'conversion_factor',
-		'fieldtype': u'Currency',
-		'label': u'Conversion Factor',
-		'oldfieldname': u'conversion_factor',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'stock_uom',
-		'fieldtype': u'Data',
-		'label': u'Stock UOM',
-		'oldfieldname': u'stock_uom',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'reqd': 1,
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'serial_no',
-		'fieldtype': u'Text',
-		'in_filter': 1,
-		'label': u'Serial No',
-		'no_copy': 1,
-		'oldfieldname': u'serial_no',
-		'oldfieldtype': u'Text',
-		'permlevel': 0,
-		'print_hide': 0,
-		'report_hide': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'batch_no',
-		'fieldtype': u'Link',
-		'label': u'Batch No',
-		'oldfieldname': u'batch_no',
-		'oldfieldtype': u'Link',
-		'options': u'Batch',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'rejected_warehouse',
-		'fieldtype': u'Link',
-		'hidden': 1,
-		'label': u'Rejected Warehouse',
-		'no_copy': 1,
-		'oldfieldname': u'rejected_warehouse',
-		'oldfieldtype': u'Link',
-		'options': u'Warehouse',
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'schedule_date',
-		'fieldtype': u'Date',
-		'label': u'Schedule date',
-		'no_copy': 1,
-		'oldfieldname': u'schedule_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'project_name',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Project Name',
-		'options': u'Project',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'qa_no',
-		'fieldtype': u'Link',
-		'label': u'QA No',
-		'no_copy': 1,
-		'oldfieldname': u'qa_no',
-		'oldfieldtype': u'Link',
-		'options': u'QA Inspection Report',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'brand',
-		'fieldtype': u'Link',
-		'hidden': 1,
-		'label': u'Brand',
-		'oldfieldname': u'brand',
-		'oldfieldtype': u'Link',
-		'options': u'Brand',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_group',
-		'fieldtype': u'Link',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'Item Group',
-		'oldfieldname': u'item_group',
-		'oldfieldtype': u'Link',
-		'options': u'Item Group',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'stock_qty',
-		'fieldtype': u'Currency',
-		'label': u'Stock Qty',
-		'oldfieldname': u'stock_qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_doctype',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'label': u'Prevdoc Doctype',
-		'oldfieldname': u'prevdoc_doctype',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_docname',
-		'fieldtype': u'Link',
-		'hidden': 0,
-		'in_filter': 1,
-		'label': u'PO No',
-		'no_copy': 0,
-		'oldfieldname': u'prevdoc_docname',
-		'oldfieldtype': u'Link',
-		'options': u'Purchase Order',
-		'permlevel': 1,
-		'print_hide': 1,
-		'reqd': 0,
-		'search_index': 1,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_date',
-		'fieldtype': u'Date',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'PO Date',
-		'oldfieldname': u'prevdoc_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'rm_supp_cost',
-		'fieldtype': u'Currency',
-		'hidden': 1,
-		'in_filter': 0,
-		'label': u'Raw Materials Supplied Cost',
-		'oldfieldname': u'rm_supp_cost',
-		'oldfieldtype': u'Currency',
-		'permlevel': 2,
-		'print_hide': 1,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'item_tax_amount',
-		'fieldtype': u'Currency',
-		'hidden': 1,
-		'label': u'Item Tax Amount',
-		'no_copy': 1,
-		'oldfieldname': u'item_tax_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'reqd': 0,
-		'search_index': 1,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_detail_docname',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'PO Detail No',
-		'no_copy': 0,
-		'oldfieldname': u'prevdoc_detail_docname',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'default': u'0.00',
-		'doctype': u'DocField',
-		'fieldname': u'billed_qty',
-		'fieldtype': u'Currency',
-		'label': u'Billed Quantity',
-		'no_copy': 1,
-		'oldfieldname': u'billed_qty',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'valuation_rate',
-		'fieldtype': u'Currency',
-		'hidden': 1,
-		'in_filter': 0,
-		'label': u'Valuation Rate',
-		'no_copy': 1,
-		'oldfieldname': u'valuation_rate',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': u'80px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Tax detail table fetched from item master as a string and stored in this field.\nUsed for Purchase Other Charges',
-		'doctype': u'DocField',
-		'fieldname': u'item_tax_rate',
-		'fieldtype': u'Small Text',
-		'hidden': 1,
-		'in_filter': 0,
-		'label': u'Item Tax Rate',
-		'oldfieldname': u'item_tax_rate',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 1,
-		'print_hide': 1,
-		'report_hide': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'page_break',
-		'fieldtype': u'Check',
-		'label': u'Page Break',
-		'oldfieldname': u'page_break',
-		'oldfieldtype': u'Check',
-		'permlevel': 0,
-		'print_hide': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/purchase_receipt_detail/__init__.py b/erpnext/stock/doctype/purchase_receipt_item/__init__.py
similarity index 100%
rename from erpnext/stock/doctype/purchase_receipt_detail/__init__.py
rename to erpnext/stock/doctype/purchase_receipt_item/__init__.py
diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt
new file mode 100755
index 0000000..1a2c383
--- /dev/null
+++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt
@@ -0,0 +1,582 @@
+# DocType, Purchase Receipt Item
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:35',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:35',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'GRND/.#######',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Stock',
+		'name': '__common__',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 78
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Purchase Receipt Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Purchase Receipt Item
+	{
+		'doctype': 'DocType',
+		'name': u'Purchase Receipt Item'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_name',
+		'fieldtype': u'Data',
+		'in_filter': 0,
+		'label': u'Item Name',
+		'oldfieldname': u'item_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Text',
+		'permlevel': 0,
+		'reqd': 1,
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'received_qty',
+		'fieldtype': u'Currency',
+		'label': u'Recd Quantity',
+		'oldfieldname': u'received_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'qty',
+		'fieldtype': u'Currency',
+		'label': u'Accepted Quantity',
+		'oldfieldname': u'qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'rejected_qty',
+		'fieldtype': u'Currency',
+		'in_filter': 0,
+		'label': u'Rejected Quantity',
+		'oldfieldname': u'rejected_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'search_index': 0,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'import_ref_rate',
+		'fieldtype': u'Currency',
+		'label': u'Ref Rate ',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'discount_rate',
+		'fieldtype': u'Currency',
+		'label': u'Discount  %',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'import_rate',
+		'fieldtype': u'Currency',
+		'label': u'Rate',
+		'oldfieldname': u'import_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 0,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'import_amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount',
+		'oldfieldname': u'import_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'purchase_ref_rate',
+		'fieldtype': u'Currency',
+		'label': u'Ref Rate *',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'purchase_rate',
+		'fieldtype': u'Currency',
+		'label': u'Rate *(Default Curr.)',
+		'oldfieldname': u'purchase_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount (Default Curr.)',
+		'oldfieldname': u'amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 0,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'warehouse',
+		'fieldtype': u'Link',
+		'hidden': 0,
+		'label': u'Accepted Warehouse',
+		'oldfieldname': u'warehouse',
+		'oldfieldtype': u'Link',
+		'options': u'Warehouse',
+		'permlevel': 0,
+		'print_hide': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'uom',
+		'fieldtype': u'Link',
+		'label': u'UOM',
+		'oldfieldname': u'uom',
+		'oldfieldtype': u'Link',
+		'options': u'UOM',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'conversion_factor',
+		'fieldtype': u'Currency',
+		'label': u'Conversion Factor',
+		'oldfieldname': u'conversion_factor',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'reqd': 1,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'stock_uom',
+		'fieldtype': u'Data',
+		'label': u'Stock UOM',
+		'oldfieldname': u'stock_uom',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'reqd': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'serial_no',
+		'fieldtype': u'Text',
+		'in_filter': 1,
+		'label': u'Serial No',
+		'no_copy': 1,
+		'oldfieldname': u'serial_no',
+		'oldfieldtype': u'Text',
+		'permlevel': 0,
+		'print_hide': 0,
+		'report_hide': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'batch_no',
+		'fieldtype': u'Link',
+		'label': u'Batch No',
+		'oldfieldname': u'batch_no',
+		'oldfieldtype': u'Link',
+		'options': u'Batch',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'rejected_warehouse',
+		'fieldtype': u'Link',
+		'hidden': 1,
+		'label': u'Rejected Warehouse',
+		'no_copy': 1,
+		'oldfieldname': u'rejected_warehouse',
+		'oldfieldtype': u'Link',
+		'options': u'Warehouse',
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'schedule_date',
+		'fieldtype': u'Date',
+		'label': u'Schedule date',
+		'no_copy': 1,
+		'oldfieldname': u'schedule_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'project_name',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Project Name',
+		'options': u'Project',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'qa_no',
+		'fieldtype': u'Link',
+		'label': u'QA No',
+		'no_copy': 1,
+		'oldfieldname': u'qa_no',
+		'oldfieldtype': u'Link',
+		'options': u'Quality Inspection',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'brand',
+		'fieldtype': u'Link',
+		'hidden': 1,
+		'label': u'Brand',
+		'oldfieldname': u'brand',
+		'oldfieldtype': u'Link',
+		'options': u'Brand',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_group',
+		'fieldtype': u'Link',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Item Group',
+		'oldfieldname': u'item_group',
+		'oldfieldtype': u'Link',
+		'options': u'Item Group',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'stock_qty',
+		'fieldtype': u'Currency',
+		'label': u'Stock Qty',
+		'oldfieldname': u'stock_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'print_hide': 1,
+		'trigger': u'Client',
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_doctype',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Prevdoc Doctype',
+		'oldfieldname': u'prevdoc_doctype',
+		'oldfieldtype': u'Data',
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_docname',
+		'fieldtype': u'Link',
+		'hidden': 0,
+		'in_filter': 1,
+		'label': u'PO No',
+		'no_copy': 0,
+		'oldfieldname': u'prevdoc_docname',
+		'oldfieldtype': u'Link',
+		'options': u'Purchase Order',
+		'permlevel': 1,
+		'print_hide': 1,
+		'reqd': 0,
+		'search_index': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_date',
+		'fieldtype': u'Date',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'PO Date',
+		'oldfieldname': u'prevdoc_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'rm_supp_cost',
+		'fieldtype': u'Currency',
+		'hidden': 1,
+		'in_filter': 0,
+		'label': u'Raw Materials Supplied Cost',
+		'oldfieldname': u'rm_supp_cost',
+		'oldfieldtype': u'Currency',
+		'permlevel': 2,
+		'print_hide': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'item_tax_amount',
+		'fieldtype': u'Currency',
+		'hidden': 1,
+		'label': u'Item Tax Amount',
+		'no_copy': 1,
+		'oldfieldname': u'item_tax_amount',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'reqd': 0,
+		'search_index': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_detail_docname',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'in_filter': 1,
+		'label': u'Purchase Order Item No',
+		'no_copy': 0,
+		'oldfieldname': u'prevdoc_detail_docname',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1,
+		'width': u'150px'
+	},
+
+	# DocField
+	{
+		'default': u'0.00',
+		'doctype': u'DocField',
+		'fieldname': u'billed_qty',
+		'fieldtype': u'Currency',
+		'label': u'Billed Quantity',
+		'no_copy': 1,
+		'oldfieldname': u'billed_qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'100px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'valuation_rate',
+		'fieldtype': u'Currency',
+		'hidden': 1,
+		'in_filter': 0,
+		'label': u'Valuation Rate',
+		'no_copy': 1,
+		'oldfieldname': u'valuation_rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 1,
+		'print_hide': 1,
+		'width': u'80px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges',
+		'doctype': u'DocField',
+		'fieldname': u'item_tax_rate',
+		'fieldtype': u'Small Text',
+		'hidden': 1,
+		'in_filter': 0,
+		'label': u'Item Tax Rate',
+		'oldfieldname': u'item_tax_rate',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1
+	},
+
+	# DocField
+	{
+		'allow_on_submit': 1,
+		'doctype': u'DocField',
+		'fieldname': u'page_break',
+		'fieldtype': u'Check',
+		'label': u'Page Break',
+		'oldfieldname': u'page_break',
+		'oldfieldtype': u'Check',
+		'permlevel': 0,
+		'print_hide': 1
+	}
+]
diff --git a/erpnext/stock/doctype/ref_rate_detail/__init__.py b/erpnext/stock/doctype/ref_rate_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/stock/doctype/ref_rate_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/stock/doctype/ref_rate_detail/ref_rate_detail.txt b/erpnext/stock/doctype/ref_rate_detail/ref_rate_detail.txt
deleted file mode 100644
index 5e17acd..0000000
--- a/erpnext/stock/doctype/ref_rate_detail/ref_rate_detail.txt
+++ /dev/null
@@ -1,82 +0,0 @@
-# DocType, Ref Rate Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:19',
-		'docstatus': 0,
-		'modified': '2012-03-21 14:57:41',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': u'RFD/.#####',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'in_create': 1,
-		'istable': 1,
-		'module': u'Stock',
-		'name': '__common__',
-		'read_only': 0,
-		'section_style': u'Tray',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 3
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'in_filter': 1,
-		'name': '__common__',
-		'parent': u'Ref Rate Detail',
-		'parentfield': u'fields',
-		'parenttype': u'DocType',
-		'permlevel': 0,
-		'search_index': 1
-	},
-
-	# DocType, Ref Rate Detail
-	{
-		'doctype': 'DocType',
-		'name': u'Ref Rate Detail'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'price_list_name',
-		'fieldtype': u'Select',
-		'label': u'Price List Name',
-		'oldfieldname': u'price_list_name',
-		'oldfieldtype': u'Select',
-		'options': u'link:Price List',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'ref_rate',
-		'fieldtype': u'Currency',
-		'label': u'Ref Rate',
-		'oldfieldname': u'ref_rate',
-		'oldfieldtype': u'Currency',
-		'reqd': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'ref_currency',
-		'fieldtype': u'Select',
-		'label': u'Currency',
-		'oldfieldname': u'ref_currency',
-		'oldfieldtype': u'Select',
-		'options': u'link:Currency',
-		'reqd': 1
-	}
-]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/sales_and_purchase_return_wizard/__init__.py b/erpnext/stock/doctype/sales_and_purchase_return_tool/__init__.py
similarity index 100%
rename from erpnext/stock/doctype/sales_and_purchase_return_wizard/__init__.py
rename to erpnext/stock/doctype/sales_and_purchase_return_tool/__init__.py
diff --git a/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.js b/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.js
new file mode 100644
index 0000000..19cec92
--- /dev/null
+++ b/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.js
@@ -0,0 +1,229 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+// Onload
+//-------------------------------
+cur_frm.cscript.onload = function(doc,dt,dn){
+	if(!doc.return_date) set_multiple(dt,dn,{return_date:get_today()});
+	doc.delivery_note_no = '';
+	doc.purchase_receipt_no = '';
+	doc.sales_invoice_no = '';
+	doc.return_type ='';
+	refresh_many(['delivery_note_no', 'sales_invoice_no', 'purchase_receipt_no', 'return_type']);
+}
+
+// Link field query
+//--------------------------------
+cur_frm.fields_dict.delivery_note_no.get_query = function(doc) {
+	return 'SELECT DISTINCT `tabDelivery Note`.name FROM `tabDelivery Note` WHERE `tabDelivery Note`.docstatus = 1 AND `tabDelivery Note`.%(key)s LIKE "%s" ORDER BY `tabDelivery Note`.name desc LIMIT 50';
+}
+
+cur_frm.fields_dict.sales_invoice_no.get_query = function(doc) {
+	return 'SELECT DISTINCT `tabSales Invoice`.name FROM `tabSales Invoice` WHERE `tabSales Invoice`.docstatus = 1 AND `tabSales Invoice`.%(key)s LIKE "%s" ORDER BY `tabSales Invoice`.name desc LIMIT 50';
+}
+
+cur_frm.fields_dict.purchase_receipt_no.get_query = function(doc) {
+	return 'SELECT DISTINCT `tabPurchase Receipt`.name FROM `tabPurchase Receipt` WHERE `tabPurchase Receipt`.docstatus = 1 AND `tabPurchase Receipt`.%(key)s LIKE "%s" ORDER BY `tabPurchase Receipt`.name desc LIMIT 50';
+}
+
+// Hide/unhide based on return type
+//----------------------------------
+cur_frm.cscript.return_type = function(doc, cdt, cdn) {
+	var cp = wn.control_panel;
+	hide_field(['purchase_receipt_no', 'delivery_note_no', 'sales_invoice_no',
+		'return_details', 'get_items', 'Make Excise Invoice', 'Make Stock Entry',
+		'Make Debit Note', 'Make Credit Note']);
+
+	if(doc.return_type == 'Sales Return') {
+		unhide_field(['delivery_note_no', 'sales_invoice_no', 'get_items',
+			'return_details', 'Make Credit Note', 'Make Stock Entry']);
+		
+		if(cp.country == 'India') {	unhide_field(['Make Excise Invoice']); }
+
+	} else if(doc.return_type == 'Purchase Return') {
+		unhide_field(['purchase_receipt_no', 'get_items', 'return_details',
+			'Make Debit Note', 'Make Stock Entry']);
+
+		if(cp.country == 'India') {	unhide_field(['Make Excise Invoice']); }
+	}
+	
+	cur_frm.cscript.clear_fields(doc);
+}
+
+// Create item table
+//-------------------------------
+cur_frm.cscript.get_items = function(doc, cdt, cdn) {
+	flag = 0
+	if(doc.return_type == 'Sales Return') {
+		if (doc.delivery_note_no && doc.sales_invoice_no) {
+			msgprint("You can not enter both Delivery Note No and Sales Invoice No. Please enter any one.");
+			flag = 1;
+		} else if (!doc.delivery_note_no && !doc.sales_invoice_no) {
+			msgprint("Please enter Delivery Note No or Sales Invoice No to proceed");
+			flag = 1;
+		}
+	} else if (doc.return_type == 'Purchase Return' && !doc.purchase_receipt_no) {
+		msgprint("Please enter Purchase Receipt No to proceed");
+		flag = 1;
+	}
+	if (!flag)
+		$c_obj(make_doclist(doc.doctype, doc.name),'pull_item_details','', function(r, rt) {
+			refresh_many(['return_details', 'cust_supp', 'cust_supp_name', 'cust_supp_address']);
+		});
+}
+
+// Clear fields
+//-------------------------------
+cur_frm.cscript.clear_fields = function(doc) {
+	doc.purchase_receipt_no, doc.delivery_note_no, doc.sales_invoice_no = '', '', '';
+	var cl = getchildren('Sales and Purchase Return Item', doc.name, 'return_details')
+	if(cl.length) $c_obj(make_doclist(doc.doctype, doc.name),'clear_return_table','', function(r, rt) {refresh_field('return_details')});
+	refresh_many(['delivery_note_no', 'sales_invoice_no', 'purchase_receipt_no', 'return_details']);
+}
+
+// Make Stock Entry
+//-------------------------------
+cur_frm.cscript.make_stock_entry = function(doc, cdt, cdn) {
+	var cl = getchildren('Sales and Purchase Return Item', doc.name, 'return_details');
+	if (!cl.length)
+		msgprint("Item table can not be blank. Please click on 'Get Items'.");
+	else if (!cur_frm.cscript.validate_returned_qty(cl)) {
+		se = cur_frm.cscript.map_parent_fields(doc,cdt,cdn);
+		cur_frm.cscript.map_child_fields(cl, se);
+		loaddoc('Stock Entry', se.name);
+	}
+}
+
+// Validate returned qty
+//---------------------------
+cur_frm.cscript.validate_returned_qty = function(cl) {
+	flag = 0
+	for(var i = 0; i<cl.length; i++){
+		if(cl[i].returned_qty > cl[i].qty) {
+			msgprint("Returned Qty can not be greater than qty. Please check for item: " + cl[i].item_code);
+			flag = 1
+		}
+	}
+	return flag
+}
+
+
+// map parent fields of stock entry
+//----------------------------------
+cur_frm.cscript.map_parent_fields = function(doc, cdt, cdn) {
+	var se = LocalDB.create('Stock Entry');
+	se = locals['Stock Entry'][se];
+	se.posting_date = dateutil.obj_to_str(new Date());
+	se.transfer_date = dateutil.obj_to_str(new Date());
+	se.fiscal_year = sys_defaults.fiscal_year;
+	se.purpose = doc.return_type;
+	se.remarks = doc.return_type + ' of ' + (doc.delivery_note_no || doc.sales_invoice_no || doc.purchase_receipt_no);
+	if(doc.return_type == 'Sales Return'){
+		se.delivery_note_no = doc.delivery_note_no;
+		se.sales_invoice_no = doc.sales_invoice_no;
+		se.customer = doc.cust_supp_name;
+		se.customer_name = doc.cust_supp_name;
+		se.customer_address = doc.cust_supp_address;
+	}
+	else if(doc.return_type == 'Purchase Return'){
+		se.purchase_receipt_no = doc.purchase_receipt_no;
+		se.supplier = doc.cust_supp_name;
+		se.supplier_name = doc.cust_supp_name;
+		se.supplier_address = doc.cust_supp_address;
+	}
+	return se
+}
+
+// map child fields of stock entry
+//---------------------------------
+cur_frm.cscript.map_child_fields = function(cl, se) {
+	for(var i = 0; i<cl.length; i++){
+		if (cl[i].returned_qty) {
+			var d1 = LocalDB.add_child(se, 'Stock Entry Detail', 'mtn_details');
+			d1.detail_name = cl[i].detail_name;
+			d1.item_code = cl[i].item_code;
+			d1.description = cl[i].description;
+			d1.transfer_qty = cl[i].returned_qty;
+			d1.qty = cl[i].returned_qty;
+			d1.stock_uom = cl[i].uom;
+			d1.uom = cl[i].uom;
+			d1.conversion_factor = 1;
+			d1.incoming_rate = cl[i].rate;
+			d1.serial_no = cl[i].serial_no;
+			d1.batch_no = cl[i].batch_no;
+		}
+	}
+}
+
+// Make excise voucher
+//-------------------------------
+cur_frm.cscript.make_excise_invoice = function(doc) {
+	var excise = LocalDB.create('Journal Voucher');
+	excise = locals['Journal Voucher'][excise];
+	excise.voucher_type = 'Excise Voucher';
+	loaddoc('Journal Voucher',excise.name);
+}
+// Make debit note
+//------------------------------
+cur_frm.cscript.make_debit_note = function(doc) {
+	var doclist = make_doclist(doc.doctype, doc.name);
+	$c('accounts.get_new_jv_details', {
+			doclist: JSON.stringify(doclist),
+			fiscal_year: sys_defaults.fiscal_year
+		}, function(r, rt) {
+		if(!r.exc) {
+			cur_frm.cscript.make_jv(doc, 'Debit Note', r.message);
+		}
+	});
+}
+// Make credit note
+//------------------------------
+cur_frm.cscript.make_credit_note = function(doc) {
+	var doclist = make_doclist(doc.doctype, doc.name);
+	$c('accounts.get_new_jv_details', {
+			doclist: JSON.stringify(doclist),
+			fiscal_year: sys_defaults.fiscal_year
+		}, function(r, rt) {
+		if(!r.exc) {
+			cur_frm.cscript.make_jv(doc, 'Credit Note', r.message);
+		}
+	});
+}
+
+
+// Make JV
+//--------------------------------
+cur_frm.cscript.make_jv = function(doc, dr_or_cr, children) {
+	var jv = LocalDB.create('Journal Voucher');
+	jv = locals['Journal Voucher'][jv];
+	
+	jv.voucher_type = dr_or_cr;
+	jv.company = sys_defaults.company;
+	jv.fiscal_year = sys_defaults.fiscal_year;
+	jv.is_opening = 'No';
+	jv.posting_date = dateutil.obj_to_str(new Date());
+	jv.voucher_date = dateutil.obj_to_str(new Date());
+
+	// Add children
+	if(children) {
+		for(var i=0; i<children.length; i++) {
+			var ch = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
+			$.extend(ch, children[i]);
+		}
+	}
+
+	loaddoc('Journal Voucher', jv.name);
+}
diff --git a/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.py b/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.py
new file mode 100644
index 0000000..fcf909c
--- /dev/null
+++ b/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.py
@@ -0,0 +1,77 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please edit this list and import only required elements
+import webnotes
+
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
+
+set = webnotes.conn.set
+sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+in_transaction = webnotes.conn.in_transaction
+convert_to_lists = webnotes.conn.convert_to_lists
+	
+# -----------------------------------------------------------------------------------------
+
+class DocType :
+  def __init__(self, doc, doclist=[]):
+    self.doc = doc
+    self.doclist = doclist
+
+  # Pull Item Details
+  # ---------------------------
+  def pull_item_details(self):
+    if self.doc.return_type == 'Sales Return':
+      if self.doc.delivery_note_no:
+        det = sql("select t1.name, t1.item_code, t1.description, t1.qty, t1.uom, t2.export_rate * t3.conversion_rate, t3.customer, t3.customer_name, t3.customer_address, t2.serial_no, t2.batch_no from `tabDelivery Note Packing Detail` t1, `tabDelivery Note Detail` t2, `tabDelivery Note` t3 where t1.parent = t3.name and t2.parent = t3.name and t1.parent_detail_docname = t2.name and t3.name = '%s' and t3.docstatus = 1" % self.doc.delivery_note_no)
+      elif self.doc.sales_invoice_no:
+        det = sql("select t1.name, t1.item_code, t1.description, t1.qty, t1.stock_uom, t1.export_rate * t2.conversion_rate, t2.customer, t2.customer_name, t2.customer_address, t1.serial_no from `tabRV Detail` t1, `tabReceivable Voucher` t2 where t1.parent = t2.name and t2.name = '%s' and t2.docstatus = 1" % self.doc.sales_invoice_no)
+    elif self.doc.return_type == 'Purchase Return' and self.doc.purchase_receipt_no:
+      det = sql("select t1.name, t1.item_code, t1.description, t1.received_qty, t1.uom, t1.purchase_rate, t2.supplier, t2.supplier_name, t2.supplier_address, t1.serial_no, t1.batch_no from `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 where t1.parent = t2.name and t2.name = '%s' and t2.docstatus = 1" % self.doc.purchase_receipt_no)
+
+    self.doc.cust_supp = det and det[0][6] or ''
+    self.doc.cust_supp_name = det and det[0][7] or ''
+    self.doc.cust_supp_address = det and det[0][8] or ''
+    self.create_item_table(det)
+    self.doc.save()
+ 
+  # Create Item Table
+  # -----------------------------
+  def create_item_table(self, det):
+    self.doc.clear_table(self.doclist, 'return_details', 1)
+    for i in det:
+      ch = addchild(self.doc, 'return_details', 'Sales and Purchase Return Item', 1, self.doclist)
+      ch.detail_name = i and i[0] or ''
+      ch.item_code = i and i[1] or ''
+      ch.description = i and i[2] or ''
+      ch.qty = i and flt(i[3]) or 0
+      ch.uom = i and i[4] or ''
+      ch.rate = i and flt(i[5]) or 0
+      ch.serial_no = i and i[9] or ''
+      ch.batch_no = (len(i) == 11) and i[10] or ''
+      ch.save()
+
+  # Clear return table
+  # --------------------------------
+  def clear_return_table(self):
+    self.doc.clear_table(self.doclist, 'return_details', 1)
+    self.doc.save()
diff --git a/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.txt b/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.txt
new file mode 100644
index 0000000..c5d4d6d
--- /dev/null
+++ b/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.txt
@@ -0,0 +1,414 @@
+# DocType, Sales and Purchase Return Tool
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:36',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:36',
+		'modified_by': u'Administrator',
+		'owner': u'wasim@webnotestech.com'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'is_transaction_doc': 0,
+		'issingle': 1,
+		'istable': 0,
+		'menu_index': 1,
+		'module': u'Stock',
+		'name': '__common__',
+		'parent_node': u'Materials',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 1,
+		'version': 46
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Sales and Purchase Return Tool',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Sales and Purchase Return Tool',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'read': 1
+	},
+
+	# DocType, Sales and Purchase Return Tool
+	{
+		'doctype': 'DocType',
+		'name': u'Sales and Purchase Return Tool'
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'All',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'System Manager',
+		'submit': 0,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'All'
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'System Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Accounts Manager'
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Purchase Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Purchase User',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales User',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Accounts User',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Accounts Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Accounts User'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales User'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales Manager'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Purchase User'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Purchase Manager'
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material Manager',
+		'submit': 0,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material User',
+		'submit': 0,
+		'write': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'return_date',
+		'fieldtype': u'Date',
+		'label': u'Return Date',
+		'no_copy': 1,
+		'oldfieldname': u'return_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'return_type',
+		'fieldtype': u'Select',
+		'label': u'Return Type',
+		'no_copy': 1,
+		'oldfieldname': u'return_type',
+		'oldfieldtype': u'Select',
+		'options': u'\nSales Return\nPurchase Return',
+		'permlevel': 0,
+		'reqd': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'delivery_note_no',
+		'fieldtype': u'Link',
+		'hidden': 1,
+		'label': u'Delivery Note No',
+		'no_copy': 1,
+		'oldfieldname': u'delivery_note_no',
+		'oldfieldtype': u'Link',
+		'options': u'Delivery Note',
+		'permlevel': 0,
+		'reqd': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'sales_invoice_no',
+		'fieldtype': u'Link',
+		'hidden': 1,
+		'label': u'Sales Invoice No',
+		'options': u'Sales Invoice',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'purchase_receipt_no',
+		'fieldtype': u'Link',
+		'hidden': 1,
+		'label': u'Purchase Receipt No',
+		'no_copy': 1,
+		'oldfieldname': u'purchase_receipt_no',
+		'oldfieldtype': u'Link',
+		'options': u'Purchase Receipt',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'cust_supp',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Customer/Supplier',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'cust_supp_name',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Cust/Supp Name',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'cust_supp_address',
+		'fieldtype': u'Small Text',
+		'hidden': 1,
+		'label': u'Cust/Supp Address',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'get_items',
+		'fieldtype': u'Button',
+		'hidden': 1,
+		'label': u'Get Items',
+		'oldfieldtype': u'Button',
+		'permlevel': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'return_details',
+		'fieldtype': u'Table',
+		'hidden': 1,
+		'label': u'Sales and Purchase Return Items',
+		'no_copy': 1,
+		'oldfieldname': u'return_details',
+		'oldfieldtype': u'Table',
+		'options': u'Sales and Purchase Return Item',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'make_stock_entry',
+		'fieldtype': u'Button',
+		'hidden': 1,
+		'label': u'Make Stock Entry',
+		'oldfieldtype': u'Button',
+		'permlevel': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'make_excise_invoice',
+		'fieldtype': u'Button',
+		'hidden': 1,
+		'label': u'Make Excise Invoice',
+		'oldfieldtype': u'Button',
+		'permlevel': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'make_credit_note',
+		'fieldtype': u'Button',
+		'hidden': 1,
+		'label': u'Make Credit Note',
+		'oldfieldtype': u'Button',
+		'permlevel': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'make_debit_note',
+		'fieldtype': u'Button',
+		'hidden': 1,
+		'label': u'Make Debit Note',
+		'oldfieldtype': u'Button',
+		'permlevel': 0,
+		'trigger': u'Client'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.js b/erpnext/stock/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.js
deleted file mode 100644
index 2320f00..0000000
--- a/erpnext/stock/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.js
+++ /dev/null
@@ -1,229 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-// Onload
-//-------------------------------
-cur_frm.cscript.onload = function(doc,dt,dn){
-	if(!doc.return_date) set_multiple(dt,dn,{return_date:get_today()});
-	doc.delivery_note_no = '';
-	doc.purchase_receipt_no = '';
-	doc.sales_invoice_no = '';
-	doc.return_type ='';
-	refresh_many(['delivery_note_no', 'sales_invoice_no', 'purchase_receipt_no', 'return_type']);
-}
-
-// Link field query
-//--------------------------------
-cur_frm.fields_dict.delivery_note_no.get_query = function(doc) {
-	return 'SELECT DISTINCT `tabDelivery Note`.name FROM `tabDelivery Note` WHERE `tabDelivery Note`.docstatus = 1 AND `tabDelivery Note`.%(key)s LIKE "%s" ORDER BY `tabDelivery Note`.name desc LIMIT 50';
-}
-
-cur_frm.fields_dict.sales_invoice_no.get_query = function(doc) {
-	return 'SELECT DISTINCT `tabReceivable Voucher`.name FROM `tabReceivable Voucher` WHERE `tabReceivable Voucher`.docstatus = 1 AND `tabReceivable Voucher`.%(key)s LIKE "%s" ORDER BY `tabReceivable Voucher`.name desc LIMIT 50';
-}
-
-cur_frm.fields_dict.purchase_receipt_no.get_query = function(doc) {
-	return 'SELECT DISTINCT `tabPurchase Receipt`.name FROM `tabPurchase Receipt` WHERE `tabPurchase Receipt`.docstatus = 1 AND `tabPurchase Receipt`.%(key)s LIKE "%s" ORDER BY `tabPurchase Receipt`.name desc LIMIT 50';
-}
-
-// Hide/unhide based on return type
-//----------------------------------
-cur_frm.cscript.return_type = function(doc, cdt, cdn) {
-	var cp = wn.control_panel;
-	hide_field(['purchase_receipt_no', 'delivery_note_no', 'sales_invoice_no',
-		'return_details', 'Get Items', 'Make Excise Invoice', 'Make Stock Entry',
-		'Make Debit Note', 'Make Credit Note']);
-
-	if(doc.return_type == 'Sales Return') {
-		unhide_field(['delivery_note_no', 'sales_invoice_no', 'Get Items',
-			'return_details', 'Make Credit Note', 'Make Stock Entry']);
-		
-		if(cp.country == 'India') {	unhide_field(['Make Excise Invoice']); }
-
-	} else if(doc.return_type == 'Purchase Return') {
-		unhide_field(['purchase_receipt_no', 'Get Items', 'return_details',
-			'Make Debit Note', 'Make Stock Entry']);
-
-		if(cp.country == 'India') {	unhide_field(['Make Excise Invoice']); }
-	}
-	
-	cur_frm.cscript.clear_fields(doc);
-}
-
-// Create item table
-//-------------------------------
-cur_frm.cscript['Get Items'] = function(doc, cdt, cdn) {
-	flag = 0
-	if(doc.return_type == 'Sales Return') {
-		if (doc.delivery_note_no && doc.sales_invoice_no) {
-			msgprint("You can not enter both Delivery Note No and Sales Invoice No. Please enter any one.");
-			flag = 1;
-		} else if (!doc.delivery_note_no && !doc.sales_invoice_no) {
-			msgprint("Please enter Delivery Note No or Sales Invoice No to proceed");
-			flag = 1;
-		}
-	} else if (doc.return_type == 'Purchase Return' && !doc.purchase_receipt_no) {
-		msgprint("Please enter Purchase Receipt No to proceed");
-		flag = 1;
-	}
-	if (!flag)
-		$c_obj(make_doclist(doc.doctype, doc.name),'pull_item_details','', function(r, rt) {
-			refresh_many(['return_details', 'cust_supp', 'cust_supp_name', 'cust_supp_address']);
-		});
-}
-
-// Clear fields
-//-------------------------------
-cur_frm.cscript.clear_fields = function(doc) {
-	doc.purchase_receipt_no, doc.delivery_note_no, doc.sales_invoice_no = '', '', '';
-	var cl = getchildren('Return Detail', doc.name, 'return_details')
-	if(cl.length) $c_obj(make_doclist(doc.doctype, doc.name),'clear_return_table','', function(r, rt) {refresh_field('return_details')});
-	refresh_many(['delivery_note_no', 'sales_invoice_no', 'purchase_receipt_no', 'return_details']);
-}
-
-// Make Stock Entry
-//-------------------------------
-cur_frm.cscript['Make Stock Entry'] = function(doc, cdt, cdn) {
-	var cl = getchildren('Return Detail', doc.name, 'return_details');
-	if (!cl.length)
-		msgprint("Item table can not be blank. Please click on 'Get Items'.");
-	else if (!cur_frm.cscript.validate_returned_qty(cl)) {
-		se = cur_frm.cscript.map_parent_fields(doc,cdt,cdn);
-		cur_frm.cscript.map_child_fields(cl, se);
-		loaddoc('Stock Entry', se.name);
-	}
-}
-
-// Validate returned qty
-//---------------------------
-cur_frm.cscript.validate_returned_qty = function(cl) {
-	flag = 0
-	for(var i = 0; i<cl.length; i++){
-		if(cl[i].returned_qty > cl[i].qty) {
-			msgprint("Returned Qty can not be greater than qty. Please check for item: " + cl[i].item_code);
-			flag = 1
-		}
-	}
-	return flag
-}
-
-
-// map parent fields of stock entry
-//----------------------------------
-cur_frm.cscript.map_parent_fields = function(doc, cdt, cdn) {
-	var se = LocalDB.create('Stock Entry');
-	se = locals['Stock Entry'][se];
-	se.posting_date = dateutil.obj_to_str(new Date());
-	se.transfer_date = dateutil.obj_to_str(new Date());
-	se.fiscal_year = sys_defaults.fiscal_year;
-	se.purpose = doc.return_type;
-	se.remarks = doc.return_type + ' of ' + (doc.delivery_note_no || doc.sales_invoice_no || doc.purchase_receipt_no);
-	if(doc.return_type == 'Sales Return'){
-		se.delivery_note_no = doc.delivery_note_no;
-		se.sales_invoice_no = doc.sales_invoice_no;
-		se.customer = doc.cust_supp_name;
-		se.customer_name = doc.cust_supp_name;
-		se.customer_address = doc.cust_supp_address;
-	}
-	else if(doc.return_type == 'Purchase Return'){
-		se.purchase_receipt_no = doc.purchase_receipt_no;
-		se.supplier = doc.cust_supp_name;
-		se.supplier_name = doc.cust_supp_name;
-		se.supplier_address = doc.cust_supp_address;
-	}
-	return se
-}
-
-// map child fields of stock entry
-//---------------------------------
-cur_frm.cscript.map_child_fields = function(cl, se) {
-	for(var i = 0; i<cl.length; i++){
-		if (cl[i].returned_qty) {
-			var d1 = LocalDB.add_child(se, 'Stock Entry Detail', 'mtn_details');
-			d1.detail_name = cl[i].detail_name;
-			d1.item_code = cl[i].item_code;
-			d1.description = cl[i].description;
-			d1.transfer_qty = cl[i].returned_qty;
-			d1.qty = cl[i].returned_qty;
-			d1.stock_uom = cl[i].uom;
-			d1.uom = cl[i].uom;
-			d1.conversion_factor = 1;
-			d1.incoming_rate = cl[i].rate;
-			d1.serial_no = cl[i].serial_no;
-			d1.batch_no = cl[i].batch_no;
-		}
-	}
-}
-
-// Make excise voucher
-//-------------------------------
-cur_frm.cscript['Make Excise Invoice'] = function(doc) {
-	var excise = LocalDB.create('Journal Voucher');
-	excise = locals['Journal Voucher'][excise];
-	excise.voucher_type = 'Excise Voucher';
-	loaddoc('Journal Voucher',excise.name);
-}
-// Make debit note
-//------------------------------
-cur_frm.cscript['Make Debit Note'] = function(doc) {
-	var doclist = make_doclist(doc.doctype, doc.name);
-	$c('accounts.get_new_jv_details', {
-			doclist: JSON.stringify(doclist),
-			fiscal_year: sys_defaults.fiscal_year
-		}, function(r, rt) {
-		if(!r.exc) {
-			cur_frm.cscript.make_jv(doc, 'Debit Note', r.message);
-		}
-	});
-}
-// Make credit note
-//------------------------------
-cur_frm.cscript['Make Credit Note'] = function(doc) {
-	var doclist = make_doclist(doc.doctype, doc.name);
-	$c('accounts.get_new_jv_details', {
-			doclist: JSON.stringify(doclist),
-			fiscal_year: sys_defaults.fiscal_year
-		}, function(r, rt) {
-		if(!r.exc) {
-			cur_frm.cscript.make_jv(doc, 'Credit Note', r.message);
-		}
-	});
-}
-
-
-// Make JV
-//--------------------------------
-cur_frm.cscript.make_jv = function(doc, dr_or_cr, children) {
-	var jv = LocalDB.create('Journal Voucher');
-	jv = locals['Journal Voucher'][jv];
-	
-	jv.voucher_type = dr_or_cr;
-	jv.company = sys_defaults.company;
-	jv.fiscal_year = sys_defaults.fiscal_year;
-	jv.is_opening = 'No';
-	jv.posting_date = dateutil.obj_to_str(new Date());
-	jv.voucher_date = dateutil.obj_to_str(new Date());
-
-	// Add children
-	if(children) {
-		for(var i=0; i<children.length; i++) {
-			var ch = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
-			$.extend(ch, children[i]);
-		}
-	}
-
-	loaddoc('Journal Voucher', jv.name);
-}
diff --git a/erpnext/stock/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.py b/erpnext/stock/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.py
deleted file mode 100644
index 36f019b..0000000
--- a/erpnext/stock/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.py
+++ /dev/null
@@ -1,77 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-	
-# -----------------------------------------------------------------------------------------
-
-class DocType :
-  def __init__(self, doc, doclist=[]):
-    self.doc = doc
-    self.doclist = doclist
-
-  # Pull Item Details
-  # ---------------------------
-  def pull_item_details(self):
-    if self.doc.return_type == 'Sales Return':
-      if self.doc.delivery_note_no:
-        det = sql("select t1.name, t1.item_code, t1.description, t1.qty, t1.uom, t2.export_rate * t3.conversion_rate, t3.customer, t3.customer_name, t3.customer_address, t2.serial_no, t2.batch_no from `tabDelivery Note Packing Detail` t1, `tabDelivery Note Detail` t2, `tabDelivery Note` t3 where t1.parent = t3.name and t2.parent = t3.name and t1.parent_detail_docname = t2.name and t3.name = '%s' and t3.docstatus = 1" % self.doc.delivery_note_no)
-      elif self.doc.sales_invoice_no:
-        det = sql("select t1.name, t1.item_code, t1.description, t1.qty, t1.stock_uom, t1.export_rate * t2.conversion_rate, t2.customer, t2.customer_name, t2.customer_address, t1.serial_no from `tabRV Detail` t1, `tabReceivable Voucher` t2 where t1.parent = t2.name and t2.name = '%s' and t2.docstatus = 1" % self.doc.sales_invoice_no)
-    elif self.doc.return_type == 'Purchase Return' and self.doc.purchase_receipt_no:
-      det = sql("select t1.name, t1.item_code, t1.description, t1.received_qty, t1.uom, t1.purchase_rate, t2.supplier, t2.supplier_name, t2.supplier_address, t1.serial_no, t1.batch_no from `tabPurchase Receipt Detail` t1, `tabPurchase Receipt` t2 where t1.parent = t2.name and t2.name = '%s' and t2.docstatus = 1" % self.doc.purchase_receipt_no)
-
-    self.doc.cust_supp = det and det[0][6] or ''
-    self.doc.cust_supp_name = det and det[0][7] or ''
-    self.doc.cust_supp_address = det and det[0][8] or ''
-    self.create_item_table(det)
-    self.doc.save()
- 
-  # Create Item Table
-  # -----------------------------
-  def create_item_table(self, det):
-    self.doc.clear_table(self.doclist, 'return_details', 1)
-    for i in det:
-      ch = addchild(self.doc, 'return_details', 'Return Detail', 1, self.doclist)
-      ch.detail_name = i and i[0] or ''
-      ch.item_code = i and i[1] or ''
-      ch.description = i and i[2] or ''
-      ch.qty = i and flt(i[3]) or 0
-      ch.uom = i and i[4] or ''
-      ch.rate = i and flt(i[5]) or 0
-      ch.serial_no = i and i[9] or ''
-      ch.batch_no = (len(i) == 11) and i[10] or ''
-      ch.save()
-
-  # Clear return table
-  # --------------------------------
-  def clear_return_table(self):
-    self.doc.clear_table(self.doclist, 'return_details', 1)
-    self.doc.save()
diff --git a/erpnext/stock/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.txt b/erpnext/stock/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.txt
deleted file mode 100644
index bc6d6fa..0000000
--- a/erpnext/stock/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.txt
+++ /dev/null
@@ -1,443 +0,0 @@
-# DocType, Sales and Purchase Return Wizard
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:21',
-		'docstatus': 0,
-		'modified': '2011-02-23 19:09:18',
-		'modified_by': 'Administrator',
-		'owner': 'wasim@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'is_transaction_doc': 0,
-		'issingle': 1,
-		'istable': 0,
-		'menu_index': 1,
-		'module': 'Stock',
-		'name': '__common__',
-		'parent_node': 'Materials',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'show_in_menu': 1,
-		'version': 46
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Sales and Purchase Return Wizard',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'Sales and Purchase Return Wizard',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1
-	},
-
-	# DocType, Sales and Purchase Return Wizard
-	{
-		'doctype': 'DocType',
-		'name': 'Sales and Purchase Return Wizard'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'permlevel': 0,
-		'role': 'Material User',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'permlevel': 1,
-		'role': 'Material User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'permlevel': 0,
-		'role': 'Material Manager',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 4,
-		'permlevel': 1,
-		'role': 'Material Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 5,
-		'permlevel': 0,
-		'role': 'All',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 6,
-		'permlevel': 0,
-		'role': 'System Manager',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 7,
-		'permlevel': 0,
-		'role': 'Accounts Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 8,
-		'permlevel': 0,
-		'role': 'Accounts User',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 9,
-		'permlevel': 0,
-		'role': 'Sales User',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 10,
-		'permlevel': 0,
-		'role': 'Sales Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 11,
-		'permlevel': 0,
-		'role': 'Purchase User',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 12,
-		'permlevel': 0,
-		'role': 'Purchase Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 13,
-		'permlevel': 1,
-		'role': 'All'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 14,
-		'permlevel': 1,
-		'role': 'System Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 15,
-		'permlevel': 1,
-		'role': 'Accounts Manager'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 16,
-		'permlevel': 1,
-		'role': 'Accounts User'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 17,
-		'permlevel': 1,
-		'role': 'Sales User'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 18,
-		'permlevel': 1,
-		'role': 'Sales Manager'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 19,
-		'permlevel': 1,
-		'role': 'Purchase User'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 20,
-		'permlevel': 1,
-		'role': 'Purchase Manager'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'return_date',
-		'fieldtype': 'Date',
-		'idx': 1,
-		'label': 'Return Date',
-		'no_copy': 1,
-		'oldfieldname': 'return_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'return_type',
-		'fieldtype': 'Select',
-		'idx': 2,
-		'label': 'Return Type',
-		'no_copy': 1,
-		'oldfieldname': 'return_type',
-		'oldfieldtype': 'Select',
-		'options': '\nSales Return\nPurchase Return',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'delivery_note_no',
-		'fieldtype': 'Link',
-		'hidden': 1,
-		'idx': 3,
-		'label': 'Delivery Note No',
-		'no_copy': 1,
-		'oldfieldname': 'delivery_note_no',
-		'oldfieldtype': 'Link',
-		'options': 'Delivery Note',
-		'permlevel': 0,
-		'reqd': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'sales_invoice_no',
-		'fieldtype': 'Link',
-		'hidden': 1,
-		'idx': 4,
-		'label': 'Sales Invoice No',
-		'options': 'Receivable Voucher',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'purchase_receipt_no',
-		'fieldtype': 'Link',
-		'hidden': 1,
-		'idx': 5,
-		'label': 'Purchase Receipt No',
-		'no_copy': 1,
-		'oldfieldname': 'purchase_receipt_no',
-		'oldfieldtype': 'Link',
-		'options': 'Purchase Receipt',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'cust_supp',
-		'fieldtype': 'Data',
-		'hidden': 1,
-		'idx': 6,
-		'label': 'Customer/Supplier',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'cust_supp_name',
-		'fieldtype': 'Data',
-		'hidden': 1,
-		'idx': 7,
-		'label': 'Cust/Supp Name',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'cust_supp_address',
-		'fieldtype': 'Small Text',
-		'hidden': 1,
-		'idx': 8,
-		'label': 'Cust/Supp Address',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'hidden': 1,
-		'idx': 9,
-		'label': 'Get Items',
-		'oldfieldtype': 'Button',
-		'permlevel': 0,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'return_details',
-		'fieldtype': 'Table',
-		'hidden': 1,
-		'idx': 10,
-		'label': 'Return Details',
-		'no_copy': 1,
-		'oldfieldname': 'return_details',
-		'oldfieldtype': 'Table',
-		'options': 'Return Detail',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'hidden': 1,
-		'idx': 11,
-		'label': 'Make Stock Entry',
-		'oldfieldtype': 'Button',
-		'permlevel': 0,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'hidden': 1,
-		'idx': 12,
-		'label': 'Make Excise Invoice',
-		'oldfieldtype': 'Button',
-		'permlevel': 0,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'hidden': 1,
-		'idx': 13,
-		'label': 'Make Credit Note',
-		'oldfieldtype': 'Button',
-		'permlevel': 0,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'hidden': 1,
-		'idx': 14,
-		'label': 'Make Debit Note',
-		'oldfieldtype': 'Button',
-		'permlevel': 0,
-		'trigger': 'Client'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.js b/erpnext/stock/doctype/sales_bom/sales_bom.js
index be159e7..f7f6e4d 100644
--- a/erpnext/stock/doctype/sales_bom/sales_bom.js
+++ b/erpnext/stock/doctype/sales_bom/sales_bom.js
@@ -41,6 +41,6 @@
   $c_obj(make_doclist(cdt,cdn), 'get_rates', '', function(r,rt){refresh_field('sales_bom_items');});
 }
 
-cur_frm.cscript['Find Sales BOM'] = function(doc, dt, dn) {
+cur_frm.cscript.find_sales_bom = function(doc, dt, dn) {
   $c_obj(make_doclist(dt,dn), 'check_duplicate', 1, '');
 }
\ No newline at end of file
diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.py b/erpnext/stock/doctype/sales_bom/sales_bom.py
index 39fa2cd..bfb5cee 100644
--- a/erpnext/stock/doctype/sales_bom/sales_bom.py
+++ b/erpnext/stock/doctype/sales_bom/sales_bom.py
@@ -45,7 +45,7 @@
   # --------------
   def get_rates(self):
     for d in getlist(self.doclist, "sales_bom_items"):
-      r = sql("select ref_rate from `tabRef Rate Detail` where price_list_name=%s and parent=%s and ref_currency = %s", (self.doc.price_list, d.item_code, self.doc.currency))
+      r = sql("select ref_rate from `tabItem Price` where price_list_name=%s and parent=%s and ref_currency = %s", (self.doc.price_list, d.item_code, self.doc.currency))
       d.rate = r and flt(r[0][0]) or 0.00
 
 
@@ -53,7 +53,7 @@
   # -----------------
   def get_item_details(self, name):
     det = sql("select description, stock_uom from `tabItem` where name = '%s' " % cstr(name))
-    rate = sql("select ref_rate from `tabRef Rate Detail` where price_list_name = %s and parent = %s and ref_currency = %s", (self.doc.price_list, name, self.doc.currency))
+    rate = sql("select ref_rate from `tabItem Price` where price_list_name = %s and parent = %s and ref_currency = %s", (self.doc.price_list, name, self.doc.currency))
     return {'description' : det and det[0][0] or '', 'uom': det and det[0][1] or '', 'rate': rate and flt(rate[0][0]) or 0.00}
 
 
@@ -107,7 +107,7 @@
       msgprint("Please enter Currency.")
       raise Exception
     for d in getlist(self.doclist, "sales_bom_items"):
-      item_rate = sql("select ref_rate,ref_currency from `tabRef Rate Detail` where price_list_name=%s and parent=%s", (p, d.item_code))      
+      item_rate = sql("select ref_rate,ref_currency from `tabItem Price` where price_list_name=%s and parent=%s", (p, d.item_code))      
       if not item_rate:
         msgprint("Item %s does not have a rate for Price List %s. Did not update rates for this Price List" % (d.item_code, p))
         raise Exception
@@ -118,7 +118,7 @@
       count += 1
       ref_rate += (flt(d.qty) * flt(item_rate[0][0]))
       
-    pld = addchild(i,"ref_rate_details", "Ref Rate Detail")
+    pld = addchild(i,"ref_rate_details", "Item Price")
     pld.price_list_name = p
     pld.ref_rate = flt(ref_rate)
     pld.ref_currency = currency
@@ -136,7 +136,7 @@
     i.item_group = self.doc.item_group
 	
     # clear old rates
-    sql("delete from `tabRef Rate Detail` where parent=%s", i.name)
+    sql("delete from `tabItem Price` where parent=%s", i.name)
     
     # update rates
     new_rates = {}
@@ -193,14 +193,14 @@
       return
     
     # get all Sales BOM that have the first item  
-    sbl = sql("select distinct parent from `tabSales BOM Detail` where item_code=%s", il[0].item_code)
+    sbl = sql("select distinct parent from `tabSales BOM Item` where item_code=%s", il[0].item_code)
     
     # check all siblings
     sub_items = [[d.item_code, flt(d.qty)] for d in il]
     
     for s in sbl:
       if not cstr(s[0]) == cstr(self.doc.name) :
-        t = sql("select item_code, qty from `tabSales BOM Detail` where parent=%s", s[0])
+        t = sql("select item_code, qty from `tabSales BOM Item` where parent=%s", s[0])
         t = [[d[0], flt(d[1])] for d in t]
   
         if self.has_same_items(sub_items, t):
diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.txt b/erpnext/stock/doctype/sales_bom/sales_bom.txt
index 2e80a37..6eb726a 100644
--- a/erpnext/stock/doctype/sales_bom/sales_bom.txt
+++ b/erpnext/stock/doctype/sales_bom/sales_bom.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:21',
+		'creation': '2012-03-27 14:36:36',
 		'docstatus': 0,
-		'modified': '2012-03-21 14:55:47',
+		'modified': '2012-03-27 14:45:51',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -18,6 +18,7 @@
 		'default_print_format': u'Standard',
 		'doctype': 'DocType',
 		'document_type': u'Master',
+		'is_submittable': 1,
 		'module': u'Stock',
 		'name': '__common__',
 		'section_style': u'Simple',
@@ -54,6 +55,30 @@
 	# DocPerm
 	{
 		'amend': 0,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales User',
+		'submit': 0,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Sales User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
 		'cancel': 0,
 		'create': 0,
 		'doctype': u'DocPerm',
@@ -99,30 +124,6 @@
 		'write': 0
 	},
 
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Sales User',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Sales User',
-		'submit': 0,
-		'write': 0
-	},
-
 	# DocField
 	{
 		'doctype': u'DocField',
@@ -225,6 +226,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'find_sales_bom',
 		'fieldtype': u'Button',
 		'label': u'Find Sales BOM',
 		'oldfieldtype': u'Button',
@@ -240,7 +242,7 @@
 		'label': u'Sales BOM Items',
 		'oldfieldname': u'sales_bom_items',
 		'oldfieldtype': u'Table',
-		'options': u'Sales BOM Detail',
+		'options': u'Sales BOM Item',
 		'permlevel': 0
 	},
 
@@ -254,5 +256,30 @@
 		'oldfieldtype': u'Link',
 		'options': u'UOM',
 		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'depends_on': u'eval:doc.amended_from',
+		'description': u'The date at which current entry is corrected in the system.',
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
+		'label': u'Amendment Date',
+		'no_copy': 1,
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Link',
+		'label': u'Amended From',
+		'no_copy': 1,
+		'options': u'Sales Invoice',
+		'permlevel': 1,
+		'print_hide': 1
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/sales_bom_detail/sales_bom_detail.txt b/erpnext/stock/doctype/sales_bom_detail/sales_bom_detail.txt
deleted file mode 100644
index 3b104e7..0000000
--- a/erpnext/stock/doctype/sales_bom_detail/sales_bom_detail.txt
+++ /dev/null
@@ -1,120 +0,0 @@
-# DocType, Sales BOM Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:21',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Stock',
-		'name': '__common__',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 3
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Sales BOM Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# DocType, Sales BOM Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Sales BOM Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'is_main_item',
-		'fieldtype': 'Select',
-		'idx': 1,
-		'label': 'Is Main Item',
-		'oldfieldname': 'is_main_item',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'item_code',
-		'fieldtype': 'Link',
-		'idx': 2,
-		'label': 'Item',
-		'oldfieldname': 'item_code',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Text',
-		'idx': 3,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Text',
-		'permlevel': 0,
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'rate',
-		'fieldtype': 'Currency',
-		'idx': 6,
-		'label': 'Rate',
-		'oldfieldname': 'rate',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'qty',
-		'fieldtype': 'Currency',
-		'idx': 9,
-		'label': 'Qty',
-		'oldfieldname': 'qty',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'uom',
-		'fieldtype': 'Link',
-		'idx': 10,
-		'label': 'UOM',
-		'oldfieldname': 'uom',
-		'oldfieldtype': 'Link',
-		'options': 'UOM',
-		'permlevel': 1,
-		'search_index': 0
-	}
-]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/sales_bom_detail/__init__.py b/erpnext/stock/doctype/sales_bom_item/__init__.py
similarity index 100%
rename from erpnext/stock/doctype/sales_bom_detail/__init__.py
rename to erpnext/stock/doctype/sales_bom_item/__init__.py
diff --git a/erpnext/stock/doctype/sales_bom_item/sales_bom_item.txt b/erpnext/stock/doctype/sales_bom_item/sales_bom_item.txt
new file mode 100644
index 0000000..8cf93f5
--- /dev/null
+++ b/erpnext/stock/doctype/sales_bom_item/sales_bom_item.txt
@@ -0,0 +1,114 @@
+# DocType, Sales BOM Item
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:37',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:37',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Stock',
+		'name': '__common__',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 3
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Sales BOM Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Sales BOM Item
+	{
+		'doctype': 'DocType',
+		'name': u'Sales BOM Item'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'is_main_item',
+		'fieldtype': u'Select',
+		'label': u'Is Main Item',
+		'oldfieldname': u'is_main_item',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'label': u'Item',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 0,
+		'reqd': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Text',
+		'permlevel': 0,
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'rate',
+		'fieldtype': u'Currency',
+		'label': u'Rate',
+		'oldfieldname': u'rate',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'qty',
+		'fieldtype': u'Currency',
+		'label': u'Qty',
+		'oldfieldname': u'qty',
+		'oldfieldtype': u'Currency',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'uom',
+		'fieldtype': u'Link',
+		'label': u'UOM',
+		'oldfieldname': u'uom',
+		'oldfieldtype': u'Link',
+		'options': u'UOM',
+		'permlevel': 1,
+		'search_index': 0
+	}
+]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/serial_no/serial_no.txt b/erpnext/stock/doctype/serial_no/serial_no.txt
index df42c7f..aa0ea66 100644
--- a/erpnext/stock/doctype/serial_no/serial_no.txt
+++ b/erpnext/stock/doctype/serial_no/serial_no.txt
@@ -3,113 +3,65 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:23',
+		'creation': '2012-03-27 14:36:37',
 		'docstatus': 0,
-		'modified': '2012-01-31 15:53:38',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:37',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1325570647',
+		'_last_update': u'1325570647',
 		'allow_trash': 1,
-		'autoname': 'field:serial_no',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'autoname': u'field:serial_no',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'Stock',
+		'document_type': u'Master',
+		'module': u'Stock',
 		'name': '__common__',
-		'search_fields': 'item_code,status',
-		'section_style': 'Tabbed',
-		'server_code_error': ' ',
+		'search_fields': u'item_code,status',
+		'section_style': u'Tabbed',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'subject': 'Item Code: %(item_code)s, Warehouse: %(warehouse)s',
-		'tag_fields': 'status',
+		'subject': u'Item Code: %(item_code)s, Warehouse: %(warehouse)s',
+		'tag_fields': u'status',
 		'version': 191
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Serial No',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Serial No',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Serial No',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Serial No',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Serial No
 	{
 		'doctype': 'DocType',
-		'name': 'Serial No'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'permlevel': 1,
-		'role': 'Material Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'Material Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'permlevel': 1,
-		'role': 'Material User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'Material User',
-		'submit': 0,
-		'write': 0
+		'name': u'Serial No'
 	},
 
 	# DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
@@ -117,54 +69,104 @@
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Material Master Manager',
+		'role': u'Material Master Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'System Manager'
+		'role': u'System Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Sales Master Manager'
+		'role': u'Sales Master Manager'
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material Manager',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material User',
+		'submit': 0,
+		'write': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Details',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'details',
+		'fieldtype': u'Section Break',
+		'label': u'Details',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'default': 'In Store',
-		'doctype': 'DocField',
-		'fieldname': 'status',
-		'fieldtype': 'Select',
+		'default': u'In Store',
+		'doctype': u'DocField',
+		'fieldname': u'status',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Status',
+		'label': u'Status',
 		'no_copy': 1,
-		'oldfieldname': 'status',
-		'oldfieldtype': 'Select',
-		'options': '\nIn Store\nDelivered\nNot in Use\nPurchase Returned',
+		'oldfieldname': u'status',
+		'oldfieldtype': u'Select',
+		'options': u'\nIn Store\nDelivered\nNot in Use\nPurchase Returned',
 		'permlevel': 1,
 		'reqd': 1,
 		'search_index': 1
@@ -172,14 +174,14 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'serial_no',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'serial_no',
+		'fieldtype': u'Data',
 		'in_filter': 0,
-		'label': 'Serial No',
+		'label': u'Serial No',
 		'no_copy': 1,
-		'oldfieldname': 'serial_no',
-		'oldfieldtype': 'Data',
+		'oldfieldname': u'serial_no',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1
@@ -187,61 +189,62 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'item_code',
-		'fieldtype': 'Link',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Item Code',
-		'oldfieldname': 'item_code',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'item_name',
-		'fieldtype': 'Data',
-		'label': 'Item Name',
+		'doctype': u'DocField',
+		'fieldname': u'item_name',
+		'fieldtype': u'Data',
+		'label': u'Item Name',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Text',
 		'in_filter': 1,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Text',
 		'permlevel': 1,
 		'search_index': 0,
-		'width': '300px'
+		'width': u'300px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'item_group',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'item_group',
+		'fieldtype': u'Link',
 		'in_filter': 0,
-		'label': 'Item Group',
-		'oldfieldname': 'item_group',
-		'oldfieldtype': 'Link',
-		'options': 'Item Group',
+		'label': u'Item Group',
+		'oldfieldname': u'item_group',
+		'oldfieldtype': u'Link',
+		'options': u'Item Group',
 		'permlevel': 1,
 		'reqd': 1,
 		'search_index': 0
@@ -249,14 +252,14 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'brand',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'brand',
+		'fieldtype': u'Link',
 		'in_filter': 0,
-		'label': 'Brand',
-		'oldfieldname': 'brand',
-		'oldfieldtype': 'Link',
-		'options': 'Brand',
+		'label': u'Brand',
+		'oldfieldname': u'brand',
+		'oldfieldtype': u'Link',
+		'options': u'Brand',
 		'permlevel': 1,
 		'reqd': 0,
 		'search_index': 0
@@ -264,65 +267,67 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Purchase Details',
+		'doctype': u'DocField',
+		'fieldname': u'purchase_details',
+		'fieldtype': u'Section Break',
+		'label': u'Purchase Details',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break2',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'purchase_document_type',
-		'fieldtype': 'Select',
-		'label': 'Purchase Document Type',
+		'doctype': u'DocField',
+		'fieldname': u'purchase_document_type',
+		'fieldtype': u'Select',
+		'label': u'Purchase Document Type',
 		'no_copy': 1,
-		'options': '\nPurchase Receipt\nStock Entry',
+		'options': u'\nPurchase Receipt\nStock Entry',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'purchase_document_no',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'purchase_document_no',
+		'fieldtype': u'Data',
 		'hidden': 0,
-		'label': 'Purchase Document No',
+		'label': u'Purchase Document No',
 		'no_copy': 1,
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'purchase_date',
-		'fieldtype': 'Date',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'purchase_date',
+		'fieldtype': u'Date',
 		'in_filter': 1,
-		'label': 'Purchase Date',
+		'label': u'Purchase Date',
 		'no_copy': 1,
-		'oldfieldname': 'purchase_date',
-		'oldfieldtype': 'Date',
+		'oldfieldname': u'purchase_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'reqd': 0,
 		'search_index': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'purchase_time',
-		'fieldtype': 'Time',
-		'label': 'Incoming Time',
+		'doctype': u'DocField',
+		'fieldname': u'purchase_time',
+		'fieldtype': u'Time',
+		'label': u'Incoming Time',
 		'no_copy': 1,
 		'permlevel': 0,
 		'reqd': 1
@@ -330,14 +335,14 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'purchase_rate',
-		'fieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'purchase_rate',
+		'fieldtype': u'Currency',
 		'in_filter': 0,
-		'label': 'Incoming Rate',
+		'label': u'Incoming Rate',
 		'no_copy': 1,
-		'oldfieldname': 'purchase_rate',
-		'oldfieldtype': 'Currency',
+		'oldfieldname': u'purchase_rate',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 0
@@ -345,23 +350,24 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break3',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'warehouse',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'warehouse',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Warehouse',
+		'label': u'Warehouse',
 		'no_copy': 1,
-		'oldfieldname': 'warehouse',
-		'oldfieldtype': 'Link',
-		'options': 'Warehouse',
+		'oldfieldname': u'warehouse',
+		'oldfieldtype': u'Link',
+		'options': u'Warehouse',
 		'permlevel': 0,
 		'reqd': 0,
 		'search_index': 1
@@ -369,186 +375,189 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'supplier',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'supplier',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Supplier',
+		'label': u'Supplier',
 		'no_copy': 1,
-		'options': 'Supplier',
+		'options': u'Supplier',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'supplier_name',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'supplier_name',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Supplier Name',
+		'label': u'Supplier Name',
 		'no_copy': 1,
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'address_display',
-		'fieldtype': 'Text',
-		'label': 'Supplier Address',
+		'doctype': u'DocField',
+		'fieldname': u'address_display',
+		'fieldtype': u'Text',
+		'label': u'Supplier Address',
 		'no_copy': 1,
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Delivery Details',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'delivery_details',
+		'fieldtype': u'Section Break',
+		'label': u'Delivery Details',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break4',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'delivery_document_type',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'delivery_document_type',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Delivery Document Type',
+		'label': u'Delivery Document Type',
 		'no_copy': 1,
-		'options': '\nDelivery Note\nReceivable Voucher\nStock Entry',
+		'options': u'\nDelivery Note\nSales Invoice\nStock Entry',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'delivery_document_no',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'delivery_document_no',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Delivery Document No',
+		'label': u'Delivery Document No',
 		'no_copy': 1,
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'customer_address',
-		'fieldtype': 'Text',
-		'label': 'Customer Address',
-		'oldfieldname': 'customer_address',
-		'oldfieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'customer_address',
+		'fieldtype': u'Text',
+		'label': u'Customer Address',
+		'oldfieldname': u'customer_address',
+		'oldfieldtype': u'Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'delivery_date',
-		'fieldtype': 'Date',
-		'label': 'Delivery Date',
+		'doctype': u'DocField',
+		'fieldname': u'delivery_date',
+		'fieldtype': u'Date',
+		'label': u'Delivery Date',
 		'no_copy': 1,
-		'oldfieldname': 'delivery_date',
-		'oldfieldtype': 'Date',
+		'oldfieldname': u'delivery_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 1,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'delivery_time',
-		'fieldtype': 'Time',
-		'label': 'Delivery Time',
+		'doctype': u'DocField',
+		'fieldname': u'delivery_time',
+		'fieldtype': u'Time',
+		'label': u'Delivery Time',
 		'no_copy': 1,
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'is_cancelled',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'is_cancelled',
+		'fieldtype': u'Select',
 		'hidden': 1,
-		'label': 'Is Cancelled',
-		'oldfieldname': 'is_cancelled',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'label': u'Is Cancelled',
+		'oldfieldname': u'is_cancelled',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 0,
 		'report_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break5',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'customer',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'customer',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Customer',
+		'label': u'Customer',
 		'no_copy': 1,
-		'oldfieldname': 'customer',
-		'oldfieldtype': 'Link',
-		'options': 'Customer',
+		'oldfieldname': u'customer',
+		'oldfieldtype': u'Link',
+		'options': u'Customer',
 		'permlevel': 1,
 		'print_hide': 1,
 		'search_index': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'customer_name',
-		'fieldtype': 'Data',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'customer_name',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Customer Name',
+		'label': u'Customer Name',
 		'no_copy': 1,
-		'oldfieldname': 'customer_name',
-		'oldfieldtype': 'Data',
+		'oldfieldname': u'customer_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 1,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'delivery_address',
-		'fieldtype': 'Text',
-		'label': 'Delivery Address',
+		'doctype': u'DocField',
+		'fieldname': u'delivery_address',
+		'fieldtype': u'Text',
+		'label': u'Delivery Address',
 		'no_copy': 1,
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'territory',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'territory',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Territory',
+		'label': u'Territory',
 		'no_copy': 1,
-		'oldfieldname': 'territory',
-		'oldfieldtype': 'Link',
-		'options': 'Territory',
+		'oldfieldname': u'territory',
+		'oldfieldtype': u'Link',
+		'options': u'Territory',
 		'permlevel': 1,
 		'print_hide': 1,
 		'report_hide': 0
@@ -556,110 +565,114 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Warranty / AMC Details',
+		'doctype': u'DocField',
+		'fieldname': u'warranty_amc_details',
+		'fieldtype': u'Section Break',
+		'label': u'Warranty / AMC Details',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break6',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'maintenance_status',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'maintenance_status',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Maintenance Status',
+		'label': u'Maintenance Status',
 		'no_copy': 0,
-		'oldfieldname': 'maintenance_status',
-		'oldfieldtype': 'Select',
-		'options': '\nUnder Warranty\nOut of Warranty\nUnder AMC\nOut of AMC',
+		'oldfieldname': u'maintenance_status',
+		'oldfieldtype': u'Select',
+		'options': u'\nUnder Warranty\nOut of Warranty\nUnder AMC\nOut of AMC',
 		'permlevel': 0,
 		'search_index': 1,
-		'width': '150px'
+		'width': u'150px'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'warranty_period',
-		'fieldtype': 'Int',
-		'label': 'Warranty Period (Days)',
-		'oldfieldname': 'warranty_period',
-		'oldfieldtype': 'Int',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'warranty_period',
+		'fieldtype': u'Int',
+		'label': u'Warranty Period (Days)',
+		'oldfieldname': u'warranty_period',
+		'oldfieldtype': u'Int',
 		'permlevel': 0,
-		'trigger': 'Client',
-		'width': '150px'
+		'trigger': u'Client',
+		'width': u'150px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break7',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'warranty_expiry_date',
-		'fieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'warranty_expiry_date',
+		'fieldtype': u'Date',
 		'in_filter': 1,
-		'label': 'Warranty Expiry Date',
-		'oldfieldname': 'warranty_expiry_date',
-		'oldfieldtype': 'Date',
+		'label': u'Warranty Expiry Date',
+		'oldfieldname': u'warranty_expiry_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
-		'width': '150px'
+		'width': u'150px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amc_expiry_date',
-		'fieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'amc_expiry_date',
+		'fieldtype': u'Date',
 		'in_filter': 1,
-		'label': 'AMC Expiry Date',
-		'oldfieldname': 'amc_expiry_date',
-		'oldfieldtype': 'Date',
+		'label': u'AMC Expiry Date',
+		'oldfieldname': u'amc_expiry_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'search_index': 0,
-		'width': '150px'
+		'width': u'150px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'More Info',
+		'doctype': u'DocField',
+		'fieldname': u'more_info',
+		'fieldtype': u'Section Break',
+		'label': u'More Info',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'serial_no_details',
-		'fieldtype': 'Text Editor',
-		'label': 'Serial No Details',
+		'doctype': u'DocField',
+		'fieldname': u'serial_no_details',
+		'fieldtype': u'Text Editor',
+		'label': u'Serial No Details',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Company',
-		'options': 'link:Company',
+		'label': u'Company',
+		'options': u'link:Company',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1
@@ -667,12 +680,12 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Fiscal Year',
-		'options': 'link:Fiscal Year',
+		'label': u'Fiscal Year',
+		'options': u'link:Fiscal Year',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1
@@ -680,12 +693,12 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index bc6c44d..229600f 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -30,8 +30,8 @@
 
 
   if (doc.purpose == 'Production Order' || doc.purpose == 'Other'){
-    unhide_field('Get Items');
-    hide_field(['from_warehouse', 'to_warehouse','purchase_receipt_no','delivery_note_no', 'sales_invoice_no','Warehouse HTML', 'transporter', 'is_excisable_goods', 'excisable_goods']);
+    unhide_field('get_items');
+    hide_field(['from_warehouse', 'to_warehouse','purchase_receipt_no','delivery_note_no', 'sales_invoice_no','warehouse_html', 'transporter', 'is_excisable_goods', 'excisable_goods']);
 	if (doc.purpose=='Production Order') unhide_field(['production_order', 'process']);
     
 	doc.from_warehouse = '';
@@ -46,7 +46,7 @@
   }
   else{
     unhide_field(['from_warehouse', 'to_warehouse']);
-    hide_field(['production_order', 'process', 'Get Items', 'fg_completed_qty','purchase_receipt_no','delivery_note_no', 'sales_invoice_no']);
+    hide_field(['production_order', 'process', 'get_items', 'fg_completed_qty','purchase_receipt_no','delivery_note_no', 'sales_invoice_no']);
     doc.production_order = '';
     doc.process = '';
     doc.fg_completed_qty = 0;
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index a1cec39..dee8790 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -124,7 +124,7 @@
 		if fg_item and bom_no:
 			# re-calculate cost for production item from bom
 			get_obj('BOM Control').calculate_cost(bom_no)
-			bom_obj = get_obj('Bill Of Materials', bom_no)
+			bom_obj = get_obj('BOM', bom_no)
 			in_rate = flt(bom_obj.doc.total_cost) / (flt(bom_obj.doc.quantity) or 1)
 		elif wh:
 			in_rate = get_obj('Valuation Control').get_incoming_rate(dt, tm, item, wh, qty, serial_no)
@@ -169,7 +169,7 @@
 			# so no childs of SA items
 			fl_bom_sa_items = sql("""
 				select item_code, ifnull(sum(qty_consumed_per_unit), 0) * '%s', description, stock_uom 
-				from `tabBOM Material` 
+				from `tabBOM Item` 
 				where parent = '%s' and docstatus < 2 
 				group by item_code
 			""" % (fg_qty, bom_no))
@@ -184,7 +184,7 @@
 				from 
 					( 
 						select distinct fb.name, fb.description, fb.item_code, fb.qty_consumed_per_unit, fb.stock_uom 
-						from `tabFlat BOM Detail` fb,`tabItem` it 
+						from `tabBOM Explosion Item` fb,`tabItem` it 
 						where it.name = fb.item_code and ifnull(it.is_pro_applicable, 'No') = 'No'
 						and ifnull(it.is_sub_contracted_item, 'No') = 'No' and fb.docstatus<2 and fb.parent=%s
 					) a
@@ -252,7 +252,7 @@
 			fg_item_dict = {cstr(pro_obj.doc.production_item) : [self.doc.fg_completed_qty, pro_obj.doc.description, pro_obj.doc.stock_uom]}
 		elif self.doc.purpose == 'Other' and self.doc.bom_no:
 			sw, tw = '', ''
-			item = sql("select item, description, uom from `tabBill Of Materials` where name = %s", self.doc.bom_no, as_dict=1)
+			item = sql("select item, description, uom from `tabBOM` where name = %s", self.doc.bom_no, as_dict=1)
 			fg_item_dict = {item[0]['item'] : [self.doc.fg_completed_qty, item[0]['description'], item[0]['uom']]}
 
 		if fg_item_dict:
@@ -355,7 +355,7 @@
 	def validate_bom_belongs_to_item(self):
 		for d in getlist(self.doclist, 'mtn_details'):
 			if d.bom_no and not webnotes.conn.sql("""\
-					SELECT name FROM `tabBill Of Materials`
+					SELECT name FROM `tabBOM`
 					WHERE item = %s and name = %s
 				""", (d.item_code, d.bom_no)):
 				msgprint("BOM %s does not belong to Item: %s at row %s" % (d.bom_no, d.item_code, d.idx), raise_exception=1)
@@ -496,7 +496,7 @@
 		
 
 	def get_cust_values(self):
-		tbl = self.doc.delivery_note_no and 'Delivery Note' or 'Receivable Voucher'
+		tbl = self.doc.delivery_note_no and 'Delivery Note' or 'Sales Invoice'
 		record_name = self.doc.delivery_note_no or self.doc.sales_invoice_no
 		res = sql("select customer,customer_name, customer_address from `tab%s` where name = '%s'" % (tbl, record_name))
 		ret = {
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.txt b/erpnext/stock/doctype/stock_entry/stock_entry.txt
index 54053b7..fd330e9 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.txt
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2009-05-12 16:46:45',
+		'creation': '2012-04-16 15:08:16',
 		'docstatus': 0,
-		'modified': '2012-04-13 14:12:02',
+		'modified': '2012-04-16 15:54:45',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -41,7 +41,7 @@
 		'subject': u'%(remarks)s',
 		'tag_fields': u'purpose',
 		'use_template': 0,
-		'version': 263
+		'version': 264
 	},
 
 	# These values are common for all DocField
@@ -76,18 +76,6 @@
 		'create': 1,
 		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': u'Material User',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
 		'role': u'Material Manager',
 		'submit': 1,
 		'write': 1
@@ -95,42 +83,61 @@
 
 	# DocPerm
 	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Production User',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Production Manager',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
 		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': u'All',
+		'role': u'Material Manager',
 		'submit': 0,
 		'write': 0
 	},
 
 	# DocPerm
 	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Material User',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Material User',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Production User',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Production User'
+	},
+
+	# DocPerm
+	{
 		'create': 0,
 		'doctype': u'DocPerm',
 		'permlevel': 2,
@@ -140,6 +147,25 @@
 
 	# DocPerm
 	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Production Manager',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'Production Manager'
+	},
+
+	# DocPerm
+	{
 		'doctype': u'DocPerm',
 		'permlevel': 2,
 		'role': u'Production Manager',
@@ -149,6 +175,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'warehouse_section',
 		'fieldtype': u'Section Break',
 		'label': u'Warehouse',
 		'oldfieldtype': u'Section Break',
@@ -158,6 +185,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'col1',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -498,6 +526,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'warehouse_html',
 		'fieldtype': u'HTML',
 		'label': u'Warehouse HTML',
 		'no_copy': 0,
@@ -568,6 +597,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'col2',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -773,6 +803,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'items_section',
 		'fieldtype': u'Section Break',
 		'label': u'Items',
 		'oldfieldtype': u'Section Break',
@@ -782,6 +813,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'get_stock_and_rate',
 		'fieldtype': u'Button',
 		'label': u'Get Stock and Rate',
 		'oldfieldtype': u'Button',
@@ -793,6 +825,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'col3',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0
@@ -803,6 +836,7 @@
 		'allow_on_submit': 0,
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'get_items',
 		'fieldtype': u'Button',
 		'hidden': 0,
 		'in_filter': 0,
@@ -820,6 +854,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'item_section',
 		'fieldtype': u'Section Break',
 		'oldfieldtype': u'Section Break',
 		'options': u'Simple',
@@ -869,6 +904,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'other_details_section',
 		'fieldtype': u'Section Break',
 		'label': u'Other Details',
 		'oldfieldtype': u'Section Break',
diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.txt b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.txt
index 03ee1af..9b0170f 100644
--- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.txt
+++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.txt
@@ -3,134 +3,134 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:25',
+		'creation': '2012-03-27 14:36:38',
 		'docstatus': 0,
-		'modified': '2012-01-12 11:51:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:38',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'autoname': 'MTND/.######',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'autoname': u'MTND/.######',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Stock',
+		'module': u'Stock',
 		'name': '__common__',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 26
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Stock Entry Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Stock Entry Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# DocType, Stock Entry Detail
 	{
 		'doctype': 'DocType',
-		'name': 'Stock Entry Detail'
+		'name': u'Stock Entry Detail'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 's_warehouse',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u's_warehouse',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Source Warehouse',
-		'oldfieldname': 's_warehouse',
-		'oldfieldtype': 'Link',
-		'options': 'Warehouse',
+		'label': u'Source Warehouse',
+		'oldfieldname': u's_warehouse',
+		'oldfieldtype': u'Link',
+		'options': u'Warehouse',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 't_warehouse',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u't_warehouse',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Target Warehouse',
-		'oldfieldname': 't_warehouse',
-		'oldfieldtype': 'Link',
-		'options': 'Warehouse',
+		'label': u'Target Warehouse',
+		'oldfieldname': u't_warehouse',
+		'oldfieldtype': u'Link',
+		'options': u'Warehouse',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fg_item',
-		'fieldtype': 'Check',
+		'doctype': u'DocField',
+		'fieldname': u'fg_item',
+		'fieldtype': u'Check',
 		'in_filter': 1,
-		'label': 'FG Item',
-		'oldfieldname': 'fg_item',
-		'oldfieldtype': 'Check',
+		'label': u'FG Item',
+		'oldfieldname': u'fg_item',
+		'oldfieldtype': u'Check',
 		'permlevel': 0,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'item_code',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Item Code',
-		'oldfieldname': 'item_code',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Text',
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Text',
 		'permlevel': 0,
-		'width': '300px'
+		'width': u'300px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'batch_no',
-		'fieldtype': 'Link',
-		'label': 'Batch No',
-		'oldfieldname': 'batch_no',
-		'oldfieldtype': 'Link',
-		'options': 'Batch',
+		'doctype': u'DocField',
+		'fieldname': u'batch_no',
+		'fieldtype': u'Link',
+		'label': u'Batch No',
+		'oldfieldname': u'batch_no',
+		'oldfieldtype': u'Link',
+		'options': u'Batch',
 		'permlevel': 0,
 		'print_hide': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'actual_qty',
-		'fieldtype': 'Read Only',
+		'doctype': u'DocField',
+		'fieldname': u'actual_qty',
+		'fieldtype': u'Read Only',
 		'in_filter': 1,
-		'label': 'Actual Qty (at source)',
+		'label': u'Actual Qty (at source)',
 		'no_copy': 1,
-		'oldfieldname': 'actual_qty',
-		'oldfieldtype': 'Read Only',
+		'oldfieldname': u'actual_qty',
+		'oldfieldtype': u'Read Only',
 		'permlevel': 1,
 		'print_hide': 1,
 		'reqd': 0,
@@ -139,67 +139,67 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'qty',
-		'fieldtype': 'Currency',
-		'label': 'Qty',
-		'oldfieldname': 'qty',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'qty',
+		'fieldtype': u'Currency',
+		'label': u'Qty',
+		'oldfieldname': u'qty',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0,
 		'reqd': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'reqd_qty',
-		'fieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'reqd_qty',
+		'fieldtype': u'Currency',
 		'in_filter': 0,
-		'label': 'Reqd Qty',
-		'oldfieldname': 'reqd_qty',
-		'oldfieldtype': 'Currency',
+		'label': u'Reqd Qty',
+		'oldfieldname': u'reqd_qty',
+		'oldfieldtype': u'Currency',
 		'permlevel': 3,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'uom',
-		'fieldtype': 'Link',
-		'label': 'UOM',
-		'oldfieldname': 'uom',
-		'oldfieldtype': 'Link',
-		'options': 'UOM',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'uom',
+		'fieldtype': u'Link',
+		'label': u'UOM',
+		'oldfieldname': u'uom',
+		'oldfieldtype': u'Link',
+		'options': u'UOM',
 		'permlevel': 0,
 		'reqd': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'conversion_factor',
-		'fieldtype': 'Currency',
-		'label': 'Conversion Factor',
-		'oldfieldname': 'conversion_factor',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'conversion_factor',
+		'fieldtype': u'Currency',
+		'label': u'Conversion Factor',
+		'oldfieldname': u'conversion_factor',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'stock_uom',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'stock_uom',
+		'fieldtype': u'Link',
 		'in_filter': 0,
-		'label': 'Stock UOM',
-		'oldfieldname': 'stock_uom',
-		'oldfieldtype': 'Link',
-		'options': 'UOM',
+		'label': u'Stock UOM',
+		'oldfieldname': u'stock_uom',
+		'oldfieldtype': u'Link',
+		'options': u'UOM',
 		'permlevel': 1,
 		'reqd': 1,
 		'search_index': 0
@@ -207,60 +207,60 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'transfer_qty',
-		'fieldtype': 'Currency',
-		'label': 'Stock Qty',
-		'oldfieldname': 'transfer_qty',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'transfer_qty',
+		'fieldtype': u'Currency',
+		'label': u'Stock Qty',
+		'oldfieldname': u'transfer_qty',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'serial_no',
-		'fieldtype': 'Text',
-		'label': 'Serial No',
+		'doctype': u'DocField',
+		'fieldname': u'serial_no',
+		'fieldtype': u'Text',
+		'label': u'Serial No',
 		'no_copy': 1,
-		'oldfieldname': 'serial_no',
-		'oldfieldtype': 'Text',
+		'oldfieldname': u'serial_no',
+		'oldfieldtype': u'Text',
 		'permlevel': 0,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'incoming_rate',
-		'fieldtype': 'Currency',
-		'label': 'Incoming Rate',
-		'oldfieldname': 'incoming_rate',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'incoming_rate',
+		'fieldtype': u'Currency',
+		'label': u'Incoming Rate',
+		'oldfieldname': u'incoming_rate',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amount',
-		'fieldtype': 'Currency',
-		'label': 'Amount',
-		'oldfieldname': 'amount',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'amount',
+		'fieldtype': u'Currency',
+		'label': u'Amount',
+		'oldfieldname': u'amount',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'description': 'BOM No. for a Finished Good Item',
-		'doctype': 'DocField',
-		'fieldname': 'bom_no',
-		'fieldtype': 'Link',
-		'label': 'BOM No.',
-		'options': 'Bill Of Materials',
+		'description': u'BOM No. for a Finished Good Item',
+		'doctype': u'DocField',
+		'fieldname': u'bom_no',
+		'fieldtype': u'Link',
+		'label': u'BOM No.',
+		'options': u'BOM',
 		'permlevel': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/stock_ledger/stock_ledger.txt b/erpnext/stock/doctype/stock_ledger/stock_ledger.txt
index 2bbfbb9..cebe0d0 100644
--- a/erpnext/stock/doctype/stock_ledger/stock_ledger.txt
+++ b/erpnext/stock/doctype/stock_ledger/stock_ledger.txt
@@ -3,36 +3,36 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:25',
+		'creation': '2012-03-27 14:36:38',
 		'docstatus': 0,
-		'modified': '2010-12-16 23:57:05',
-		'modified_by': 'nabin@webnotestech.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:38',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'hide_toolbar': 1,
 		'in_create': 1,
 		'issingle': 1,
-		'module': 'Stock',
+		'module': u'Stock',
 		'name': '__common__',
 		'read_only': 1,
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 10
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Stock Ledger',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Stock Ledger',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 1,
 		'read': 1
 	},
@@ -40,20 +40,18 @@
 	# DocType, Stock Ledger
 	{
 		'doctype': 'DocType',
-		'name': 'Stock Ledger'
+		'name': u'Stock Ledger'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'All'
+		'doctype': u'DocPerm',
+		'role': u'All'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'Material User'
+		'doctype': u'DocPerm',
+		'role': u'Material User'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
index c9d23c6..bb23226 100644
--- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
+++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
@@ -83,9 +83,9 @@
 	# Nobody can do SL Entries where posting date is before freezing date except authorized person
 	#----------------------------------------------------------------------------------------------
 	def check_stock_frozen_date(self):
-		stock_frozen_upto = get_value('Manage Account', None, 'stock_frozen_upto') or ''
+		stock_frozen_upto = get_value('Global Defaults', None, 'stock_frozen_upto') or ''
 		if stock_frozen_upto:
-			stock_auth_role = get_value('Manage Account', None,'stock_auth_role')
+			stock_auth_role = get_value('Global Defaults', None,'stock_auth_role')
 			if getdate(self.doc.posting_date) <= getdate(stock_frozen_upto) and not stock_auth_role in webnotes.user.get_roles():
 				msgprint("You are not authorized to do / modify back dated stock entries before %s" % getdate(stock_frozen_upto).strftime('%d-%m-%Y'), raise_exception=1)
 
diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt
index b9d982b..275cf30 100644
--- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt
+++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt
@@ -3,18 +3,19 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2009-05-12 16:46:51',
+		'creation': '2012-03-27 14:36:38',
 		'docstatus': 0,
-		'modified': '2012-04-18 11:59:34',
+		'modified': '2012-03-27 14:36:38',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': u'1334728856',
+		'_last_update': u'1322549701',
 		'autoname': u'SLE/.########',
 		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
 		'hide_toolbar': 1,
 		'in_create': 1,
@@ -23,7 +24,7 @@
 		'section_style': u'Simple',
 		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'version': 54
+		'version': 53
 	},
 
 	# These values are common for all DocField
@@ -94,14 +95,12 @@
 		'doctype': u'DocField',
 		'fieldname': u'item_code',
 		'fieldtype': u'Link',
-		'hidden': 0,
 		'in_filter': 1,
 		'label': u'Item Code',
 		'oldfieldname': u'item_code',
 		'oldfieldtype': u'Link',
 		'options': u'Item',
 		'permlevel': 1,
-		'print_hide': 0,
 		'reqd': 0,
 		'search_index': 1,
 		'width': u'100px'
@@ -124,13 +123,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'batch_no',
 		'fieldtype': u'Data',
-		'hidden': 0,
 		'label': u'Batch No',
 		'oldfieldname': u'batch_no',
 		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'print_hide': 0,
-		'reqd': 0
+		'permlevel': 0
 	},
 
 	# DocField
@@ -138,15 +134,12 @@
 		'doctype': u'DocField',
 		'fieldname': u'warehouse',
 		'fieldtype': u'Link',
-		'hidden': 0,
 		'in_filter': 1,
 		'label': u'Warehouse',
 		'oldfieldname': u'warehouse',
 		'oldfieldtype': u'Link',
 		'options': u'Warehouse',
 		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 0,
 		'search_index': 1,
 		'width': u'100px'
 	},
@@ -156,16 +149,13 @@
 		'doctype': u'DocField',
 		'fieldname': u'warehouse_type',
 		'fieldtype': u'Select',
-		'hidden': 0,
 		'in_filter': 1,
 		'label': u'Warehouse Type',
 		'oldfieldname': u'warehouse_type',
 		'oldfieldtype': u'Select',
-		'options': u'\nStores',
+		'options': u'link:Warehouse Type',
 		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 0,
-		'search_index': 1
+		'search_index': 0
 	},
 
 	# DocField
@@ -174,13 +164,11 @@
 		'doctype': u'DocField',
 		'fieldname': u'posting_date',
 		'fieldtype': u'Date',
-		'hidden': 0,
 		'in_filter': 1,
 		'label': u'Posting Date',
 		'oldfieldname': u'posting_date',
 		'oldfieldtype': u'Date',
 		'permlevel': 1,
-		'print_hide': 0,
 		'reqd': 0,
 		'search_index': 1,
 		'width': u'100px'
@@ -191,14 +179,11 @@
 		'doctype': u'DocField',
 		'fieldname': u'posting_time',
 		'fieldtype': u'Time',
-		'hidden': 0,
 		'in_filter': 0,
 		'label': u'Posting Time',
 		'oldfieldname': u'posting_time',
 		'oldfieldtype': u'Time',
 		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 0,
 		'search_index': 0,
 		'width': u'100px'
 	},
@@ -209,15 +194,12 @@
 		'doctype': u'DocField',
 		'fieldname': u'transaction_date',
 		'fieldtype': u'Date',
-		'hidden': 0,
 		'in_filter': 1,
 		'label': u'Transaction Date',
 		'oldfieldname': u'transaction_date',
 		'oldfieldtype': u'Date',
 		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 0,
-		'search_index': 1,
+		'search_index': 0,
 		'width': u'100px'
 	},
 
@@ -226,15 +208,12 @@
 		'doctype': u'DocField',
 		'fieldname': u'voucher_type',
 		'fieldtype': u'Data',
-		'hidden': 0,
 		'in_filter': 1,
 		'label': u'Voucher Type',
 		'oldfieldname': u'voucher_type',
 		'oldfieldtype': u'Data',
 		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 0,
-		'search_index': 1,
+		'search_index': 0,
 		'width': u'150px'
 	},
 
@@ -243,15 +222,12 @@
 		'doctype': u'DocField',
 		'fieldname': u'voucher_no',
 		'fieldtype': u'Data',
-		'hidden': 0,
 		'in_filter': 1,
 		'label': u'Voucher No',
 		'oldfieldname': u'voucher_no',
 		'oldfieldtype': u'Data',
 		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 0,
-		'search_index': 1,
+		'search_index': 0,
 		'width': u'150px'
 	},
 
@@ -260,13 +236,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'voucher_detail_no',
 		'fieldtype': u'Data',
-		'hidden': 0,
 		'label': u'Voucher Detail No',
 		'oldfieldname': u'voucher_detail_no',
 		'oldfieldtype': u'Data',
 		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 0,
 		'width': u'150px'
 	},
 
@@ -276,14 +249,11 @@
 		'doctype': u'DocField',
 		'fieldname': u'actual_qty',
 		'fieldtype': u'Currency',
-		'hidden': 0,
 		'in_filter': 1,
 		'label': u'Actual Quantity',
 		'oldfieldname': u'actual_qty',
 		'oldfieldtype': u'Currency',
 		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 0,
 		'width': u'150px'
 	},
 
@@ -292,13 +262,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'incoming_rate',
 		'fieldtype': u'Currency',
-		'hidden': 0,
 		'label': u'Incoming Rate',
 		'oldfieldname': u'incoming_rate',
 		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 0,
-		'reqd': 0
+		'permlevel': 0
 	},
 
 	# DocField
@@ -306,13 +273,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'stock_uom',
 		'fieldtype': u'Data',
-		'hidden': 0,
 		'label': u'Stock UOM',
 		'oldfieldname': u'stock_uom',
 		'oldfieldtype': u'Data',
 		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 0,
 		'width': u'150px'
 	},
 
@@ -321,14 +285,11 @@
 		'doctype': u'DocField',
 		'fieldname': u'bin_aqat',
 		'fieldtype': u'Currency',
-		'hidden': 0,
 		'in_filter': 1,
 		'label': u'Bin Actual Qty After Transaction',
 		'oldfieldname': u'bin_aqat',
 		'oldfieldtype': u'Currency',
 		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 0,
 		'width': u'150px'
 	},
 
@@ -343,8 +304,7 @@
 		'oldfieldtype': u'Currency',
 		'permlevel': 0,
 		'print_hide': 1,
-		'report_hide': 1,
-		'reqd': 0
+		'report_hide': 1
 	},
 
 	# DocField
@@ -358,8 +318,7 @@
 		'oldfieldtype': u'Currency',
 		'permlevel': 0,
 		'print_hide': 1,
-		'report_hide': 1,
-		'reqd': 0
+		'report_hide': 1
 	},
 
 	# DocField
@@ -367,13 +326,10 @@
 		'doctype': u'DocField',
 		'fieldname': u'valuation_rate',
 		'fieldtype': u'Currency',
-		'hidden': 0,
 		'label': u'Valuation Rate',
 		'oldfieldname': u'valuation_rate',
 		'oldfieldtype': u'Currency',
 		'permlevel': 0,
-		'print_hide': 0,
-		'reqd': 0,
 		'width': u'150px'
 	},
 
@@ -382,18 +338,14 @@
 		'doctype': u'DocField',
 		'fieldname': u'stock_value',
 		'fieldtype': u'Currency',
-		'hidden': 0,
 		'label': u'Stock Value',
 		'oldfieldname': u'stock_value',
 		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'print_hide': 0,
-		'reqd': 0
+		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': u'White:FFF',
 		'doctype': u'DocField',
 		'fieldname': u'fcfs_stack',
 		'fieldtype': u'Text',
@@ -405,7 +357,6 @@
 		'permlevel': 2,
 		'print_hide': 1,
 		'report_hide': 1,
-		'reqd': 0,
 		'search_index': 0
 	},
 
@@ -414,16 +365,13 @@
 		'doctype': u'DocField',
 		'fieldname': u'company',
 		'fieldtype': u'Select',
-		'hidden': 0,
 		'in_filter': 1,
 		'label': u'Company',
 		'oldfieldname': u'company',
 		'oldfieldtype': u'Data',
-		'options': u'\nWeb Notes Technologies Pvt Ltd',
+		'options': u'link:Company',
 		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 0,
-		'search_index': 1,
+		'search_index': 0,
 		'width': u'150px'
 	},
 
@@ -432,15 +380,12 @@
 		'doctype': u'DocField',
 		'fieldname': u'fiscal_year',
 		'fieldtype': u'Data',
-		'hidden': 0,
 		'in_filter': 1,
 		'label': u'Fiscal Year',
 		'oldfieldname': u'fiscal_year',
 		'oldfieldtype': u'Data',
 		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 0,
-		'search_index': 1,
+		'search_index': 0,
 		'width': u'150px'
 	},
 
@@ -449,16 +394,13 @@
 		'doctype': u'DocField',
 		'fieldname': u'is_cancelled',
 		'fieldtype': u'Select',
-		'hidden': 0,
 		'in_filter': 1,
 		'label': u'Is Cancelled',
 		'oldfieldname': u'is_cancelled',
 		'oldfieldtype': u'Select',
 		'options': u'\nYes\nNo',
 		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 0,
-		'search_index': 1,
+		'search_index': 0,
 		'width': u'100px'
 	},
 
@@ -467,16 +409,13 @@
 		'doctype': u'DocField',
 		'fieldname': u'is_stock_entry',
 		'fieldtype': u'Select',
-		'hidden': 0,
 		'in_filter': 1,
 		'label': u'Is Stock Entry',
 		'oldfieldname': u'is_stock_entry',
 		'oldfieldtype': u'Select',
 		'options': u'\nYes\nNo',
 		'permlevel': 1,
-		'print_hide': 0,
-		'reqd': 0,
-		'search_index': 1,
+		'search_index': 0,
 		'width': u'100px'
 	}
-]
\ No newline at end of file
+]
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
index 613c230..941b863 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
@@ -15,9 +15,9 @@
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 cur_frm.cscript.refresh = function(doc) {	
-	if (doc.docstatus) hide_field('Steps');
+	if (doc.docstatus) hide_field('steps');
 }
 
-cur_frm.cscript['Download Template'] = function(doc, cdt, cdn) {
+cur_frm.cscript.download_template = function(doc, cdt, cdn) {
 	$c_obj_csv(make_doclist(cdt, cdn), 'get_template', '');
 }
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.txt b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.txt
index 9a21130..c2fe30a 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.txt
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.txt
@@ -3,76 +3,78 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:26',
+		'creation': '2012-03-27 14:36:40',
 		'docstatus': 0,
-		'modified': '2011-11-24 12:04:03',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:45:52',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1321617741',
+		'_last_update': u'1321617741',
 		'allow_attach': 1,
-		'autoname': 'SR/.######',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'autoname': u'SR/.######',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
+		'is_submittable': 1,
 		'max_attachments': 1,
-		'module': 'Stock',
+		'module': u'Stock',
 		'name': '__common__',
-		'search_fields': 'reconciliation_date',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
+		'search_fields': u'reconciliation_date',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'subject': 'Date: %(reconciliation_date)s, Time: %(reconciliation_time)s',
+		'subject': u'Date: %(reconciliation_date)s, Time: %(reconciliation_time)s',
 		'version': 107
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Stock Reconciliation',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Stock Reconciliation',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'amend': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Stock Reconciliation',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Stock Reconciliation',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Stock Reconciliation
 	{
 		'doctype': 'DocType',
-		'name': 'Stock Reconciliation'
+		'name': u'Stock Reconciliation'
 	},
 
 	# DocPerm
 	{
+		'amend': 0,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Material Manager',
+		'role': u'Material Manager',
 		'submit': 1,
 		'write': 1
 	},
 
 	# DocPerm
 	{
+		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Material Manager',
+		'role': u'Material Manager',
 		'submit': 0,
 		'write': 0
 	},
@@ -81,77 +83,104 @@
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'submit': 1,
 		'write': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'label': 'Steps',
-		'options': '<div class="field_description"><b>Steps:</b><br>1. Enter Reconciliation Date and Time<br>2. Save the document<br>3. Attach csv file as per template.<br>4. Submit the document<br>5. Enter tilde (~) sign if no difference in qty or valuation rate</div>',
+		'doctype': u'DocField',
+		'fieldname': u'steps',
+		'fieldtype': u'HTML',
+		'label': u'Steps',
+		'options': u'<div class="field_description"><b>Steps:</b><br>1. Enter Reconciliation Date and Time<br>2. Save the document<br>3. Attach csv file as per template.<br>4. Submit the document<br>5. Enter tilde (~) sign if no difference in qty or valuation rate</div>',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'reconciliation_date',
-		'fieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'reconciliation_date',
+		'fieldtype': u'Date',
 		'in_filter': 0,
-		'label': 'Reconciliation Date',
-		'oldfieldname': 'reconciliation_date',
-		'oldfieldtype': 'Date',
+		'label': u'Reconciliation Date',
+		'oldfieldname': u'reconciliation_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'reconciliation_time',
-		'fieldtype': 'Time',
+		'doctype': u'DocField',
+		'fieldname': u'reconciliation_time',
+		'fieldtype': u'Time',
 		'in_filter': 0,
-		'label': 'Reconciliation Time',
-		'oldfieldname': 'reconciliation_time',
-		'oldfieldtype': 'Time',
+		'label': u'Reconciliation Time',
+		'oldfieldname': u'reconciliation_time',
+		'oldfieldtype': u'Time',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'remark',
-		'fieldtype': 'Text',
-		'label': 'Remark',
-		'oldfieldname': 'remark',
-		'oldfieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'remark',
+		'fieldtype': u'Text',
+		'label': u'Remark',
+		'oldfieldname': u'remark',
+		'oldfieldtype': u'Text',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Download Template',
+		'doctype': u'DocField',
+		'fieldname': u'download_template',
+		'fieldtype': u'Button',
+		'label': u'Download Template',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'file_list',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'label': 'File List',
+		'label': u'File List',
 		'no_copy': 1,
-		'oldfieldname': 'file_list',
-		'oldfieldtype': 'Text',
+		'oldfieldname': u'file_list',
+		'oldfieldtype': u'Text',
+		'permlevel': 1,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'depends_on': u'eval:doc.amended_from',
+		'description': u'The date at which current entry is corrected in the system.',
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
+		'label': u'Amendment Date',
+		'no_copy': 1,
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Link',
+		'label': u'Amended From',
+		'no_copy': 1,
+		'options': u'Sales Invoice',
 		'permlevel': 1,
 		'print_hide': 1
 	}
diff --git a/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.txt b/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.txt
index 7818530..87241b5 100644
--- a/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.txt
+++ b/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.txt
@@ -3,159 +3,149 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:26',
+		'creation': '2012-03-27 14:36:40',
 		'docstatus': 0,
-		'modified': '2010-12-23 14:40:02',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:40',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'in_create': 0,
 		'issingle': 1,
-		'module': 'Stock',
+		'module': u'Stock',
 		'name': '__common__',
 		'read_only': 0,
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 25
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Stock UOM Replace Utility',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Stock UOM Replace Utility',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Stock UOM Replace Utility',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Stock UOM Replace Utility',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Stock UOM Replace Utility
 	{
 		'doctype': 'DocType',
-		'name': 'Stock UOM Replace Utility'
+		'name': u'Stock UOM Replace Utility'
 	},
 
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 0
 	},
 
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 3,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Material Master Manager',
+		'role': u'Material Master Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 4,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Material Manager',
+		'role': u'Material Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 5,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Material Master Manager'
+		'role': u'Material Master Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 6,
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Material Manager'
+		'role': u'Material Manager'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'item_code',
-		'fieldtype': 'Link',
-		'idx': 1,
-		'label': 'Item',
-		'options': 'Item',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'label': u'Item',
+		'options': u'Item',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'current_stock_uom',
-		'fieldtype': 'Link',
-		'idx': 2,
-		'label': 'Current Stock UOM',
-		'options': 'UOM',
+		'doctype': u'DocField',
+		'fieldname': u'current_stock_uom',
+		'fieldtype': u'Link',
+		'label': u'Current Stock UOM',
+		'options': u'UOM',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'new_stock_uom',
-		'fieldtype': 'Link',
-		'idx': 3,
-		'label': 'New Stock UOM',
-		'options': 'UOM',
+		'doctype': u'DocField',
+		'fieldname': u'new_stock_uom',
+		'fieldtype': u'Link',
+		'label': u'New Stock UOM',
+		'options': u'UOM',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 5,
-		'label': 'Update',
-		'options': 'update_stock_uom',
+		'doctype': u'DocField',
+		'fieldname': u'update',
+		'fieldtype': u'Button',
+		'label': u'Update',
+		'options': u'update_stock_uom',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'conversion_factor',
-		'fieldtype': 'Currency',
-		'idx': 11,
-		'label': 'Conversion Factor',
+		'doctype': u'DocField',
+		'fieldname': u'conversion_factor',
+		'fieldtype': u'Currency',
+		'label': u'Conversion Factor',
 		'permlevel': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.txt b/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.txt
index 14608be..e3ee023 100644
--- a/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.txt
+++ b/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.txt
@@ -3,63 +3,61 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:29',
+		'creation': '2012-03-27 14:36:40',
 		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:40',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'autoname': 'UCDD/.#####',
-		'colour': 'White:FFF',
+		'autoname': u'UCDD/.#####',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Stock',
+		'module': u'Stock',
 		'name': '__common__',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 1
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'UOM Conversion Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'UOM Conversion Detail',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# DocType, UOM Conversion Detail
 	{
 		'doctype': 'DocType',
-		'name': 'UOM Conversion Detail'
+		'name': u'UOM Conversion Detail'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'uom',
-		'fieldtype': 'Link',
-		'idx': 10,
-		'label': 'UOM',
-		'oldfieldname': 'uom',
-		'oldfieldtype': 'Link',
-		'options': 'UOM'
+		'doctype': u'DocField',
+		'fieldname': u'uom',
+		'fieldtype': u'Link',
+		'label': u'UOM',
+		'oldfieldname': u'uom',
+		'oldfieldtype': u'Link',
+		'options': u'UOM'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'conversion_factor',
-		'fieldtype': 'Float',
-		'idx': 11,
-		'label': 'Conversion Factor',
-		'oldfieldname': 'conversion_factor',
-		'oldfieldtype': 'Float'
+		'doctype': u'DocField',
+		'fieldname': u'conversion_factor',
+		'fieldtype': u'Float',
+		'label': u'Conversion Factor',
+		'oldfieldname': u'conversion_factor',
+		'oldfieldtype': u'Float'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/valuation_control/valuation_control.txt b/erpnext/stock/doctype/valuation_control/valuation_control.txt
index c2a2935..abaaa7b 100644
--- a/erpnext/stock/doctype/valuation_control/valuation_control.txt
+++ b/erpnext/stock/doctype/valuation_control/valuation_control.txt
@@ -3,29 +3,29 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:30',
+		'creation': '2012-03-27 14:36:40',
 		'docstatus': 0,
-		'modified': '2010-12-23 11:18:22',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:40',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'in_create': 1,
 		'issingle': 1,
-		'module': 'Stock',
+		'module': u'Stock',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 4
 	},
 
 	# DocType, Valuation Control
 	{
 		'doctype': 'DocType',
-		'name': 'Valuation Control'
+		'name': u'Valuation Control'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/warehouse/warehouse.txt b/erpnext/stock/doctype/warehouse/warehouse.txt
index 87b0eda..2deacf0 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.txt
+++ b/erpnext/stock/doctype/warehouse/warehouse.txt
@@ -3,54 +3,54 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:30',
+		'creation': '2012-04-11 13:18:57',
 		'docstatus': 0,
-		'modified': '2011-11-15 15:06:24',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-11 17:47:35',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1319016431',
+		'_last_update': u'1319016431',
 		'allow_trash': 1,
-		'autoname': 'field:warehouse_name',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'autoname': u'field:warehouse_name',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
-		'document_type': 'Master',
-		'module': 'Stock',
+		'document_type': u'Master',
+		'module': u'Stock',
 		'name': '__common__',
-		'search_fields': 'warehouse_type',
-		'section_style': 'Tabbed',
-		'server_code_error': ' ',
+		'search_fields': u'warehouse_type',
+		'section_style': u'Tabbed',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'version': 58
+		'version': 59
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Warehouse',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Warehouse',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Warehouse',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Warehouse',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Warehouse
 	{
 		'doctype': 'DocType',
-		'name': 'Warehouse'
+		'name': u'Warehouse'
 	},
 
 	# DocPerm
@@ -58,9 +58,9 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 2,
-		'role': 'Material User',
+		'role': u'Material User',
 		'submit': 0,
 		'write': 0
 	},
@@ -70,9 +70,9 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Material User',
+		'role': u'Material User',
 		'submit': 0,
 		'write': 0
 	},
@@ -82,9 +82,9 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Material User',
+		'role': u'Material User',
 		'submit': 0,
 		'write': 0
 	},
@@ -94,9 +94,9 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 2,
-		'role': 'Material Manager',
+		'role': u'Material Manager',
 		'submit': 0,
 		'write': 0
 	},
@@ -106,9 +106,9 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Material Manager',
+		'role': u'Material Manager',
 		'submit': 0,
 		'write': 0
 	},
@@ -118,18 +118,18 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Material Manager',
+		'role': u'Material Manager',
 		'submit': 0,
 		'write': 0
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'All'
+		'role': u'All'
 	},
 
 	# DocPerm
@@ -137,239 +137,243 @@
 		'amend': 0,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Material Master Manager',
+		'role': u'Material Master Manager',
 		'submit': 0,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Material Master Manager'
+		'role': u'Material Master Manager'
 	},
 
 	# DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 2,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Warehouse Detail',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'warehouse_detail',
+		'fieldtype': u'Section Break',
+		'label': u'Warehouse Detail',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'warehouse_name',
-		'fieldtype': 'Data',
-		'label': 'Warehouse Name',
-		'oldfieldname': 'warehouse_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'warehouse_name',
+		'fieldtype': u'Data',
+		'label': u'Warehouse Name',
+		'oldfieldname': u'warehouse_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'warehouse_type',
-		'fieldtype': 'Link',
-		'label': 'Warehouse Type',
-		'oldfieldname': 'warehouse_type',
-		'oldfieldtype': 'Link',
-		'options': 'Warehouse Type',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'warehouse_type',
+		'fieldtype': u'Link',
+		'label': u'Warehouse Type',
+		'oldfieldname': u'warehouse_type',
+		'oldfieldtype': u'Link',
+		'options': u'Warehouse Type',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'The valuation of items in this warehouse will be considered for the company that is specified',
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Link',
+		'colour': u'White:FFF',
+		'description': u'The valuation of items in this warehouse will be considered for the company that is specified',
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Company',
-		'oldfieldname': 'company',
-		'oldfieldtype': 'Link',
-		'options': 'Company',
+		'label': u'Company',
+		'oldfieldname': u'company',
+		'oldfieldtype': u'Link',
+		'options': u'Company',
 		'permlevel': 0,
 		'search_index': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'email_id',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'email_id',
+		'fieldtype': u'Data',
 		'hidden': 1,
-		'label': 'Email Id',
-		'oldfieldname': 'email_id',
-		'oldfieldtype': 'Data',
+		'label': u'Email Id',
+		'oldfieldname': u'email_id',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'print_hide': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'auto_indent_mail',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'auto_indent_mail',
+		'fieldtype': u'Select',
 		'hidden': 1,
-		'label': 'Send Reorder Alert Mail ',
+		'label': u'Send Reorder Alert Mail ',
 		'no_copy': 1,
-		'oldfieldname': 'auto_indent_mail',
-		'oldfieldtype': 'Select',
-		'options': 'No\nYes',
+		'oldfieldname': u'auto_indent_mail',
+		'oldfieldtype': u'Select',
+		'options': u'No\nYes',
 		'permlevel': 0,
 		'print_hide': 1,
 		'report_hide': 1,
 		'reqd': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'phone_no',
-		'fieldtype': 'Int',
-		'label': 'Phone No',
-		'oldfieldname': 'phone_no',
-		'oldfieldtype': 'Int',
-		'options': 'Phone',
+		'doctype': u'DocField',
+		'fieldname': u'phone_no',
+		'fieldtype': u'Data',
+		'label': u'Phone No',
+		'oldfieldname': u'phone_no',
+		'oldfieldtype': u'Int',
+		'options': u'Phone',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'mobile_no',
-		'fieldtype': 'Int',
-		'label': 'Mobile No',
-		'oldfieldname': 'mobile_no',
-		'oldfieldtype': 'Int',
-		'options': 'Phone',
+		'doctype': u'DocField',
+		'fieldname': u'mobile_no',
+		'fieldtype': u'Data',
+		'label': u'Mobile No',
+		'oldfieldname': u'mobile_no',
+		'oldfieldtype': u'Int',
+		'options': u'Phone',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'address_line_1',
-		'fieldtype': 'Data',
-		'label': 'Address Line 1',
-		'oldfieldname': 'address_line_1',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'address_line_1',
+		'fieldtype': u'Data',
+		'label': u'Address Line 1',
+		'oldfieldname': u'address_line_1',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'address_line_2',
-		'fieldtype': 'Data',
-		'label': 'Address Line 2',
-		'oldfieldname': 'address_line_2',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'address_line_2',
+		'fieldtype': u'Data',
+		'label': u'Address Line 2',
+		'oldfieldname': u'address_line_2',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'state',
-		'fieldtype': 'Select',
-		'label': 'State',
-		'oldfieldname': 'state',
-		'oldfieldtype': 'Select',
-		'options': '\nSelect country first',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'state',
+		'fieldtype': u'Select',
+		'label': u'State',
+		'oldfieldname': u'state',
+		'oldfieldtype': u'Select',
+		'options': u'\nSelect country first',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'city',
-		'fieldtype': 'Data',
-		'label': 'City',
-		'oldfieldname': 'city',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'city',
+		'fieldtype': u'Data',
+		'label': u'City',
+		'oldfieldname': u'city',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'pin',
-		'fieldtype': 'Int',
-		'label': 'PIN',
-		'oldfieldname': 'pin',
-		'oldfieldtype': 'Int',
+		'doctype': u'DocField',
+		'fieldname': u'pin',
+		'fieldtype': u'Int',
+		'label': u'PIN',
+		'oldfieldname': u'pin',
+		'oldfieldtype': u'Int',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Repost Stock',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'repost_stock',
+		'fieldtype': u'Section Break',
+		'label': u'Repost Stock',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 2
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
+		'doctype': u'DocField',
+		'fieldname': u'repost_stock_ledger',
+		'fieldtype': u'Button',
 		'hidden': 0,
-		'label': 'Repost Stock Ledger',
-		'oldfieldtype': 'Button',
-		'options': 'repost_stock',
+		'label': u'Repost Stock Ledger',
+		'oldfieldtype': u'Button',
+		'options': u'repost_stock',
 		'permlevel': 2
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/page/stock_home/stock_home.html b/erpnext/stock/page/stock_home/stock_home.html
index 03c5fab..d1b2507 100644
--- a/erpnext/stock/page/stock_home/stock_home.html
+++ b/erpnext/stock/page/stock_home/stock_home.html
@@ -1,23 +1,28 @@
 <div class="layout-wrapper layout-wrapper-background">
+	<div class="appframe-area"></div>
 	<div class="layout-main-section">
-		<a class="close" onclick="window.history.back();">&times;</a>
 		<h1>Stock</h1>
 		<hr>
 		<div style="width: 48%; float: left;">
 			<h4><a href="#!List/Stock Entry">Stock Entry</a></h4>
 			<p class="help">Transfer stock from one warehouse to another</p>
+			<br>
 			<h4><a href="#!List/Delivery Note">Delivery Note</a></h4>
 			<p class="help">Delivery (shipment) to customers</p>
+			<br>
 			<h4><a href="#!List/Purchase Receipt">Purchase Receipt</a></h4>
 			<p class="help">Goods received from Suppliers</p>
 		</div>
 		<div style="width: 48%; float: right;">
 			<h4><a href="#!List/Item">Item</a></h4>
 			<p class="help">Item Master</p>
+			<br>
 			<h4><a href="#!List/Serial No">Serial No</a></h4>
 			<p class="help">Single unit of an Item</p>
+			<br>
 			<h4><a href="#!List/Batch">Batch</a></h4>
 			<p class="help">Batch of units of an Item</p>
+			<br>
 			<h4><a href="#!List/Warehouse">Warehouse</a></h4>
 			<p class="help">Warehouse is where items are stored</p>
 		</div>
@@ -49,7 +54,7 @@
 					<div class="section-item">
 						<a class="section-link" 
 							title = "Readings of incoming quality inspections"
-							href="#!List/QA Inspection Report">Incoming Inspection</a>
+							href="#!List/Quality Inspection">Incoming Inspection</a>
 					</div>
 					<div class="section-item">
 						<a class="section-link" 
@@ -59,7 +64,7 @@
 					<div class="section-item">
 						<a class="section-link" 
 							title = "Distribute costs on Purchase Receipts and add them to item value"
-							href="#!List/Landed Cost Wizard">Landed Cost Wizard</a>
+							href="#!Form/Landed Cost Wizard/Landed Cost Wizard">Landed Cost Wizard</a>
 					</div>
 					<div class="section-item">
 						<a class="section-link" 
@@ -69,7 +74,7 @@
 					<div class="section-item">
 						<a class="section-link" 
 							title = "Helper for managing return of goods (sales or purchase)"
-							href="#!Form/Sales and Purchase Return Wizard/Sales and Purchase Return Wizard">Sales or Purchase Returns</a>
+							href="#!Form/Sales and Purchase Return Tool/Sales and Purchase Return Tool">Sales or Purchase Returns</a>
 					</div>
 				</div>
 			</div>
diff --git a/erpnext/stock/page/stock_home/stock_home.js b/erpnext/stock/page/stock_home/stock_home.js
index aa33722..7df9b27 100644
--- a/erpnext/stock/page/stock_home/stock_home.js
+++ b/erpnext/stock/page/stock_home/stock_home.js
@@ -15,5 +15,6 @@
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 pscript['onload_stock-home'] = function(wrapper) {
+	wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
 	erpnext.module_page.setup_page('Stock', wrapper);
 }
\ No newline at end of file
diff --git a/erpnext/stock/search_criteria/itemwise_price_list/itemwise_price_list.txt b/erpnext/stock/search_criteria/itemwise_price_list/itemwise_price_list.txt
index 0e029cb..d9e9973 100644
--- a/erpnext/stock/search_criteria/itemwise_price_list/itemwise_price_list.txt
+++ b/erpnext/stock/search_criteria/itemwise_price_list/itemwise_price_list.txt
@@ -3,32 +3,32 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-20 12:20:56',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2010-08-20 12:15:17',
-		'modified_by': 'Administrator',
-		'owner': 'harshada@webnotestech.com'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Item\x01Item Name,Item\x01Item Group,Ref Rate Detail\x01Price List Name,Ref Rate Detail\x01Ref Rate,Ref Rate Detail\x01Currency',
-		'criteria_name': 'Itemwise Price List',
-		'doc_type': 'Ref Rate Detail',
+		'columns': u'Item\x01Item Name,Item\x01Item Group,Item Price\x01Price List Name,Item Price\x01Ref Rate,Item Price\x01Currency',
+		'criteria_name': u'Itemwise Price List',
+		'doc_type': u'Item Price',
 		'doctype': 'Search Criteria',
-		'filters': "{'Item\x01Saved':1,'Ref Rate Detail\x01Price List Name':'','Ref Rate Detail\x01Currency':''}",
-		'module': 'Stock',
+		'filters': u"{'Item\x01Saved':1,'Item Price\x01Price List Name':'','Item Price\x01Currency':''}",
+		'module': u'Stock',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Item',
-		'sort_by': '`tabItem`.`item_name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Item',
+		'sort_by': u'`tabItem`.`item_name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, itemwise_price_list
 	{
 		'doctype': 'Search Criteria',
-		'name': 'itemwise_price_list'
+		'name': u'itemwise_price_list'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/buying/search_criteria/itemwise_receipt_details/__init__.py b/erpnext/stock/search_criteria/itemwise_receipt_details/__init__.py
similarity index 100%
rename from erpnext/buying/search_criteria/itemwise_receipt_details/__init__.py
rename to erpnext/stock/search_criteria/itemwise_receipt_details/__init__.py
diff --git a/erpnext/buying/search_criteria/itemwise_receipt_details/itemwise_receipt_details.js b/erpnext/stock/search_criteria/itemwise_receipt_details/itemwise_receipt_details.js
similarity index 100%
rename from erpnext/buying/search_criteria/itemwise_receipt_details/itemwise_receipt_details.js
rename to erpnext/stock/search_criteria/itemwise_receipt_details/itemwise_receipt_details.js
diff --git a/erpnext/stock/search_criteria/itemwise_receipt_details/itemwise_receipt_details.txt b/erpnext/stock/search_criteria/itemwise_receipt_details/itemwise_receipt_details.txt
new file mode 100644
index 0000000..b9c8b9c
--- /dev/null
+++ b/erpnext/stock/search_criteria/itemwise_receipt_details/itemwise_receipt_details.txt
@@ -0,0 +1,34 @@
+# Search Criteria, itemwise_receipt_details
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-04-11 13:16:55',
+		'docstatus': 0,
+		'modified': '2012-04-13 11:16:40',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all Search Criteria
+	{
+		'columns': u'Purchase Receipt\x01ID,Purchase Receipt\x01Posting Date,Purchase Receipt Item\x01Item Code,Purchase Receipt Item\x01Item Name,Purchase Receipt Item\x01Accepted Quantity,Purchase Receipt Item\x01Rejected Quantity,Purchase Receipt Item\x01UOM,Purchase Receipt Item\x01Accepted Warehouse,Purchase Receipt Item\x01Rejected Warehouse,Purchase Receipt Item\x01Amount',
+		'criteria_name': u'Itemwise Receipt Details',
+		'doc_type': u'Purchase Receipt Item',
+		'doctype': 'Search Criteria',
+		'filters': u'{"Purchase Receipt\\u0001Submitted":1,"Purchase Receipt\\u0001Status":[""],"Purchase Receipt\\u0001Fiscal Year":[""]}',
+		'module': u'Stock',
+		'name': '__common__',
+		'page_len': 50,
+		'parent_doc_type': u'Purchase Receipt',
+		'sort_by': u'`tabPurchase Receipt`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
+	},
+
+	# Search Criteria, itemwise_receipt_details
+	{
+		'doctype': 'Search Criteria',
+		'name': u'itemwise_receipt_details'
+	}
+]
diff --git a/erpnext/stock/search_criteria/shortage_to_indent/shortage_to_indent.js b/erpnext/stock/search_criteria/shortage_to_indent/shortage_to_indent.js
deleted file mode 100644
index d9cf4d4..0000000
--- a/erpnext/stock/search_criteria/shortage_to_indent/shortage_to_indent.js
+++ /dev/null
@@ -1,27 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-
-  this.add_filter({fieldname:'posting_date', label:'Posting Date', fieldtype:'Date', ignore : 1, parent:'Item'});
-  //this.add_filter({fieldname:'weekly_working_days', label:'Weekly Working Days', fieldtype:'Select', options:NEWLINE+1+NEWLINE+2+NEWLINE+3+NEWLINE+4+NEWLINE+5+NEWLINE+6+NEWLINE+7, ignore : 1, parent:'Item'});
-
-  this.filter_fields_dict['Item'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
-  this.filter_fields_dict['Item'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
-  //this.filter_fields_dict['Item'+FILTER_SEP +'Weekly Working Days'].df.in_first_page = 1;
-
-
-}
\ No newline at end of file
diff --git a/erpnext/stock/search_criteria/shortage_to_indent/shortage_to_indent.py b/erpnext/stock/search_criteria/shortage_to_indent/shortage_to_indent.py
deleted file mode 100644
index 2645d50..0000000
--- a/erpnext/stock/search_criteria/shortage_to_indent/shortage_to_indent.py
+++ /dev/null
@@ -1,148 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-mon_list = []
-data = {'start_date':0, 'end_date':1, 'working_days': 2}
-
-def make_month_list(start_date, end_date, mon_list, colnames, coltypes, colwidths, coloptions, col_idx):
-
-  # get period between from date and to date
-
-  period_diff = sql("select PERIOD_DIFF('%s','%s')"% (('').join( end_date.split('-')[i] for i in range(len(end_date.split('-')) - 1)),('').join(start_date.split('-')[i] for i in range(len(start_date.split('-')) - 1))))
-  period_diff = period_diff and int(period_diff[0][0])
-
-  for pd in range(int(period_diff) + 1):
-    # get last date
-    last_date = str(sql("select LAST_DAY('%s')" % start_date)[0][0])
-      
-    # get no of days in the month            
-    if not int(sql("select DATEDIFF('%s','%s')" % (end_date, last_date))[0][0]) >0:
-      last_date = end_date
-    diff = int(sql("select DATEDIFF('%s','%s')" % (last_date, start_date))[0][0]) + 1
-      
-    # make mon_list
-    mon_list.append([start_date, last_date, (diff > 26) and 26 or diff])
-           
-    # add months as Column names
-    month_name = sql("select MONTHNAME('%s')" % start_date)[0][0]
-  
-    colnames.append(str(str(month_name)[:3])+ '-'+ str(start_date[:4]))
-    coltypes.append('Currency')
-    colwidths.append('150px')
-    coloptions.append('')
-    col_idx[str(str(month_name)[:3])+ '-'+ str(start_date[:4])] = len(colnames) - 1
-
-    # get start date
-    start_date = str(sql("select DATE_ADD('%s',INTERVAL 1 DAY)" % last_date)[0][0])
-
-# Validation for 'ID' and 'Lead Time Days' Column Name
-if 'ID' not in colnames or 'Lead Time Days' not in colnames:
-  msgprint("Please select Id and Lead Time Days in 'Select Columns' tab Else Report will not be generated")
-  raise Exception
-
-# Validation for Posting Date Filters
-if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
-  msgprint("Please select From Posting Date and To Posting Date")
-  raise Exception
-else:
-  from_date = str(filter_values.get('posting_date'))
-  to_date = str(filter_values.get('posting_date1'))
-
-
-# Call Make Month List Function
-make_month_list(from_date, to_date, mon_list, colnames, coltypes, colwidths, coloptions, col_idx)
-
-
-# Add Column names 
-col = [['Total Daily Consumption','Currency','150px','']
-      ,['MIL(Min Inv. Level)','Currency','150px','']
-      ,['ROL(Re-Order Level)','Currency','150px','']
-      ,['Actual Quantity','Currency','150px','']
-      ,['Indented Quantity','Currency','150px','']
-      ,['Ordered Quantity','Currency','150px','']
-      ,['Shortage To Indent','Currency','150px','']
-      ,['MAR','Currency','100px','']
-      ,['LPR','Currency','100px','']]
-
-for c in col:
-  colnames.append(c[0])
-  coltypes.append(c[1])
-  colwidths.append(c[2])
-  coloptions.append(c[3])
-  col_idx[c[0]] = len(colnames) - 1
-
-for r in res:
-
-  # calculate Total Daily Consumption Monthly
-  count, tot_consumption, tot_days = 0, 0, 1
-  #for idx in range(col_idx['Stock Unit of Measurement'] + 1 , col_idx['Total Daily Consumption'] ):
-  for idx in range(col_idx['Lead Time Days'] + 1 , col_idx['Total Daily Consumption'] ):
-  
-    # As Consumption Means:= Adding Qty Transfered to WIP Warehouse ++ Qty Issued directly warehouse whose waraehouse_type != WIP Warehouse and Subtracting Qty Issued from WIP Warehouse
-    #Capture item qty coming to WIP Warehouse for production purpose which means consuming that items
-    add_con = sql("select ifnull(sum(t1.actual_qty),0)  from `tabStock Ledger Entry` t1 where t1.item_code = '%s' and t1.is_cancelled = 'No'  and t1.posting_date >= '%s' and t1.posting_date <= '%s' and t1.warehouse_type = 'WIP Warehouse' and t1.actual_qty > 0 " % (r[col_idx['ID']],mon_list[count][data['start_date']],mon_list[count][data['end_date']]))
-    
-    # This is Stock Entry which is of Type Material Issue also to mention that Source Warehouse should not be WIP WArehouse
-    #Transfering items to Internal Other Warehouse but not to WIP Warehouse
-    dir_con = sql("select ifnull(sum(t1.actual_qty),0) from `tabStock Ledger Entry` t1, `tabStock Entry Detail` t2 where t1.item_code = '%s' and t1.is_cancelled = 'No' and t1.posting_date >= '%s' and t1.posting_date <= '%s' and t1.warehouse_type != 'WIP Warehouse' and t1.actual_qty < 0 and t1.voucher_type = 'Stock Entry' and t1.voucher_detail_no = t2.name and ifnull(t2.t_warehouse, '') = ''"%(r[col_idx['ID']],mon_list[count][data['start_date']],mon_list[count][data['end_date']]))
-    
-    # This is Stock Entry which is of Type MAterial TRansfer also to mention that Source Warehouse should be WIP WArhouse
-    #like, transfering items from internal warehouse to customer
-    red_con = sql("select ifnull(sum(t1.actual_qty),0) from `tabStock Ledger Entry` t1, `tabStock Entry Detail` t2 where t1.item_code = '%s' and t1.is_cancelled = 'No'  and t1.posting_date >= '%s' and t1.posting_date <= '%s' and t1.warehouse_type = 'WIP Warehouse' and t1.actual_qty < 0 and t1.voucher_type = 'Stock Entry' and t1.voucher_detail_no = t2.name and ifnull(t2.t_warehouse, '') != ''"%(r[col_idx['ID']],mon_list[count][data['start_date']],mon_list[count][data['end_date']]))
-    #msgprint(str(add_con[0][0]) + "~~~" + str(dir_con[0][0]) + "~~~" + str(red_con[0][0]))
-
-    add_con = add_con and add_con[0][0] or 0.00
-    dir_con = dir_con and ((-1) * dir_con[0][0]) or 0.00
-    red_con = red_con and red_con[0][0] or 0.00
-    tot_con = flt(add_con) + flt(dir_con) + flt(red_con)
-    #tot_con = add_con and add_con[0][0] or 0 + dir_con and (-1) * dir_con[0][0] or 0 +  red_con and red_con[0][0] or 0
-    tot_con = flt(r[col_idx['Lead Time Days']] and tot_con  or 0)
-
-
-    # monthly avg consumption
-    r.append(flt(tot_con / mon_list[count][data['working_days']]))
-
-    # calculate tot_consumption and tot_days   
-    tot_consumption = flt(tot_consumption) + flt(tot_con)
-    tot_days = (tot_days == 1) and flt(mon_list[count][data['working_days']]) or (flt(tot_days) + flt(mon_list[count][data['working_days']]))
-    count = count + 1  
-
-  # Calculate Daily Consumption
-  r.append(tot_consumption and flt(tot_consumption /tot_days) or 0)
-
-  # Calculate Minimum Inventory Level
-  r.append(flt(r[col_idx['Total Daily Consumption']]) * flt(r[col_idx['Lead Time Days']]))
- 
-  # Calculate Re-Order Level
-  r.append(flt(r[col_idx['MIL(Min Inv. Level)']] * 2))
-
-  # get stock level
-  stock_level = sql("select sum(t1.actual_qty), sum(t1.indented_qty), sum(t1.ordered_qty) from `tabBin` t1, `tabWarehouse` t2 where t1.warehouse = t2.name and t2.warehouse_type != 'WIP Warehouse' and t1.item_code = '%s'"%(r[col_idx['ID']]))
- 
-  r.append(stock_level and flt(stock_level[0][0]) or 0) # Actual Qty
-  r.append(stock_level and flt(stock_level[0][1]) or 0) # Indented Qty
-  r.append(stock_level and flt(stock_level[0][2]) or 0) # Ordered Qty
-  
-  # calculate shortage
-  r.append((r[col_idx['ROL(Re-Order Level)']] > 0) and flt(flt(r[col_idx['ROL(Re-Order Level)']]) - flt(r[col_idx['Actual Quantity']]) - flt(r[col_idx['Indented Quantity']]) - flt(r[col_idx['Ordered Quantity']])) or 0)
-
-  # get moving average rate
-  m_a_r = sql("select ifnull(sum(t1.ma_rate), 0)/ ifnull(count(t1.name),1) from `tabBin` t1, `tabWarehouse` t2 where t1.item_code = '%s' and ifnull(t1.ma_rate, 0) > 0 and t1.warehouse = t2.name and t2.warehouse_type != 'WIP Warehouse'" % r[col_idx['ID']])
-  r.append(m_a_r and flt(m_a_r[0][0]) or 0)
-    
-  # get recent last purchase rate 
-  lpr_rate = flt(sql("select last_purchase_rate from `tabItem` where name = '%s'" %r[col_idx['ID']])[0][0]) or 0.00
-  r.append(lpr_rate)
diff --git a/erpnext/stock/search_criteria/shortage_to_indent/shortage_to_indent.txt b/erpnext/stock/search_criteria/shortage_to_indent/shortage_to_indent.txt
deleted file mode 100644
index 4b3e396..0000000
--- a/erpnext/stock/search_criteria/shortage_to_indent/shortage_to_indent.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# Search Criteria, shortage_to_indent
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-05-18 11:48:54',
-		'docstatus': 0,
-		'modified': '2011-05-18 11:52:59',
-		'modified_by': 'Administrator',
-		'owner': 'wasim@webnotestech.com'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'Item\x01ID,Item\x01Item Name,Item\x01Description,Item\x01Lead Time Days',
-		'criteria_name': 'Shortage To Indent',
-		'doc_type': 'Item',
-		'doctype': 'Search Criteria',
-		'filters': "{'Item\x01Saved':1}",
-		'module': 'Stock',
-		'name': '__common__',
-		'page_len': 50,
-		'sort_by': '`tabItem`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, shortage_to_indent
-	{
-		'doctype': 'Search Criteria',
-		'name': 'shortage_to_indent'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/stock/search_criteria/shortage_to_indent/__init__.py b/erpnext/stock/search_criteria/shortage_to_purchase_request/__init__.py
similarity index 100%
rename from erpnext/stock/search_criteria/shortage_to_indent/__init__.py
rename to erpnext/stock/search_criteria/shortage_to_purchase_request/__init__.py
diff --git a/erpnext/stock/search_criteria/shortage_to_purchase_request/shortage_to_purchase_request.txt b/erpnext/stock/search_criteria/shortage_to_purchase_request/shortage_to_purchase_request.txt
new file mode 100644
index 0000000..91700ac
--- /dev/null
+++ b/erpnext/stock/search_criteria/shortage_to_purchase_request/shortage_to_purchase_request.txt
@@ -0,0 +1,33 @@
+# Search Criteria, shortage_to_purchase_request
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-30 14:50:44',
+		'docstatus': 0,
+		'modified': '2012-03-30 14:50:44',
+		'modified_by': u'Administrator',
+		'owner': u'wasim@webnotestech.com'
+	},
+
+	# These values are common for all Search Criteria
+	{
+		'columns': u'Item\x01ID,Item\x01Item Name,Item\x01Description,Item\x01Lead Time Days',
+		'criteria_name': u'Shortage To Purchase Request',
+		'doc_type': u'Item',
+		'doctype': 'Search Criteria',
+		'filters': u"{'Item\x01Saved':1}",
+		'module': u'Stock',
+		'name': '__common__',
+		'page_len': 50,
+		'sort_by': u'`tabItem`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
+	},
+
+	# Search Criteria, shortage_to_purchase_request
+	{
+		'doctype': 'Search Criteria',
+		'name': u'shortage_to_purchase_request'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/stock/search_criteria/stock_aging_report/stock_aging_report.txt b/erpnext/stock/search_criteria/stock_aging_report/stock_aging_report.txt
index bbc8b5c..f2b0306 100644
--- a/erpnext/stock/search_criteria/stock_aging_report/stock_aging_report.txt
+++ b/erpnext/stock/search_criteria/stock_aging_report/stock_aging_report.txt
@@ -3,32 +3,32 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-09-01 15:48:09',
+		'creation': '2012-04-03 12:49:53',
 		'docstatus': 0,
-		'modified': '2010-08-16 13:42:24',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
+		'modified': '2012-04-03 12:49:53',
+		'modified_by': u'Administrator',
+		'owner': u'ashwini@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_cond': "`tabSerial No`.status = 'In Store'",
-		'columns': 'Serial No\x01ID,Serial No\x01Item Code,Serial No\x01Description,Serial No\x01Item Group,Serial No\x01Purchase Date',
-		'criteria_name': 'Stock Aging Report',
-		'doc_type': 'Serial No',
+		'add_cond': u"`tabSerial No`.status = 'In Store'",
+		'columns': u'Serial No\x01ID,Serial No\x01Item Code,Serial No\x01Description,Serial No\x01Item Group,Serial No\x01Purchase Date',
+		'criteria_name': u'Stock Aging Report',
+		'doc_type': u'Serial No',
 		'doctype': 'Search Criteria',
-		'filters': "{'Serial No\x01Saved':1,'Serial No\x01Submitted':1,'Serial No\x01Status':'In Store','Serial No\x01Maintenance Status':''}",
-		'module': 'Stock',
+		'filters': u"{'Serial No\x01Saved':1,'Serial No\x01Submitted':1,'Serial No\x01Status':'In Store','Serial No\x01Maintenance Status':''}",
+		'module': u'Stock',
 		'name': '__common__',
 		'page_len': 1000,
-		'sort_by': '`tabSerial No`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabSerial No`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, stock_aging_report
 	{
 		'doctype': 'Search Criteria',
-		'name': 'stock_aging_report'
+		'name': u'stock_aging_report'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/search_criteria/stock_ledger/stock_ledger.txt b/erpnext/stock/search_criteria/stock_ledger/stock_ledger.txt
index 34dd521..cee810b 100644
--- a/erpnext/stock/search_criteria/stock_ledger/stock_ledger.txt
+++ b/erpnext/stock/search_criteria/stock_ledger/stock_ledger.txt
@@ -3,31 +3,34 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-10-14 08:43:05',
+		'creation': '2012-04-16 11:42:44',
 		'docstatus': 0,
-		'modified': '2010-10-14 08:31:40',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-16 16:00:35',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_col': '`tabItem`.`item_name`\n`tabItem`.`description`',
-		'add_cond': '`tabItem`.`name` = `tabStock Ledger Entry`.`item_code`',
-		'add_tab': '`tabItem`',
-		'columns': 'Stock Ledger Entry\x01Item Code,Stock Ledger Entry\x01Warehouse,Stock Ledger Entry\x01Posting Date,Stock Ledger Entry\x01Voucher Detail No,Stock Ledger Entry\x01Actual Quantity,Stock Ledger Entry\x01Bin Actual Qty After Transaction',
-		'criteria_name': 'Stock Ledger',
-		'doc_type': 'Stock Ledger Entry',
+		'add_col': u'`tabItem`.`item_name`\n`tabItem`.`description`',
+		'add_cond': u'`tabItem`.`name` = `tabStock Ledger Entry`.`item_code`',
+		'add_tab': u'`tabItem`',
+		'columns': u'Stock Ledger Entry\x01Item Code,Stock Ledger Entry\x01Warehouse,Stock Ledger Entry\x01Posting Date,Stock Ledger Entry\x01Posting Time,Stock Ledger Entry\x01Actual Quantity,Stock Ledger Entry\x01Bin Actual Qty After Transaction,Stock Ledger Entry\x01Voucher Type,Stock Ledger Entry\x01Voucher No',
+		'criteria_name': u'Stock Ledger',
+		'doc_type': u'Stock Ledger Entry',
 		'doctype': 'Search Criteria',
-		'filters': "{'Stock Ledger Entry\x01Is Cancelled':'','Stock Ledger Entry\x01Is Stock Entry':''}",
-		'module': 'Stock',
+		'filters': u'{"Stock Ledger Entry\\u0001Warehouse Type":[""],"Stock Ledger Entry\\u0001Company":[""],"Stock Ledger Entry\\u0001Is Cancelled":[""],"Stock Ledger Entry\\u0001Is Stock Entry":[""]}',
+		'module': u'Stock',
 		'name': '__common__',
-		'standard': 'Yes'
+		'page_len': 50,
+		'sort_by': u'`tabStock Ledger Entry`.`item_code`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, stock_ledger
 	{
 		'doctype': 'Search Criteria',
-		'name': 'stock_ledger'
+		'name': u'stock_ledger'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/search_criteria/stock_level/stock_level.txt b/erpnext/stock/search_criteria/stock_level/stock_level.txt
index 252cdff..f19016e 100644
--- a/erpnext/stock/search_criteria/stock_level/stock_level.txt
+++ b/erpnext/stock/search_criteria/stock_level/stock_level.txt
@@ -3,34 +3,34 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-12-14 10:23:23',
+		'creation': '2012-04-03 12:49:53',
 		'docstatus': 0,
-		'modified': '2010-10-20 16:51:11',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:53',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_col': '`tabItem`.`item_name`\n`tabItem`.`description`',
-		'add_cond': '`tabItem`.name = `tabBin`.item_code',
-		'add_tab': '`tabItem`',
-		'columns': 'Bin\x01Warehouse,Bin\x01Item Code,Bin\x01UOM,Bin\x01Reserved Quantity,Bin\x01Actual Quantity,Bin\x01Ordered Quantity,Bin\x01Planned Qty,Bin\x01Projected Qty,Bin\x01Indented Quantity,Bin\x01Valuation Rate,Bin\x01Stock Value',
-		'criteria_name': 'Stock Level',
-		'doc_type': 'Bin',
+		'add_col': u'`tabItem`.`item_name`\n`tabItem`.`description`',
+		'add_cond': u'`tabItem`.name = `tabBin`.item_code',
+		'add_tab': u'`tabItem`',
+		'columns': u'Bin\x01Warehouse,Bin\x01Item Code,Bin\x01UOM,Bin\x01Reserved Quantity,Bin\x01Actual Quantity,Bin\x01Ordered Quantity,Bin\x01Planned Qty,Bin\x01Projected Qty,Bin\x01Quantity Requested for Purchase,Bin\x01Valuation Rate,Bin\x01Stock Value',
+		'criteria_name': u'Stock Level',
+		'doc_type': u'Bin',
 		'doctype': 'Search Criteria',
-		'filters': '{}',
-		'module': 'Stock',
+		'filters': u'{}',
+		'module': u'Stock',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabBin`.`warehouse`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabBin`.`warehouse`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, stock_level
 	{
 		'doctype': 'Search Criteria',
-		'name': 'stock_level'
+		'name': u'stock_level'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/stock/search_criteria/stock_report/stock_report.txt b/erpnext/stock/search_criteria/stock_report/stock_report.txt
index df73fba..8a92201 100644
--- a/erpnext/stock/search_criteria/stock_report/stock_report.txt
+++ b/erpnext/stock/search_criteria/stock_report/stock_report.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-11-02 15:37:37',
+		'creation': '2012-04-03 12:49:53',
 		'docstatus': 0,
-		'modified': '2010-11-02 15:35:12',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:53',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Stock Ledger Entry\x01ID',
-		'criteria_name': 'Stock Report',
-		'doc_type': 'Stock Ledger Entry',
+		'columns': u'Stock Ledger Entry\x01ID',
+		'criteria_name': u'Stock Report',
+		'doc_type': u'Stock Ledger Entry',
 		'doctype': 'Search Criteria',
-		'filters': "{'Stock Ledger Entry\x01Is Cancelled':'','Stock Ledger Entry\x01Is Stock Entry':''}",
-		'module': 'Stock',
+		'filters': u"{'Stock Ledger Entry\x01Is Cancelled':'','Stock Ledger Entry\x01Is Stock Entry':''}",
+		'module': u'Stock',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabStock Ledger Entry`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabStock Ledger Entry`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, stock_report
 	{
 		'doctype': 'Search Criteria',
-		'name': 'stock_report'
+		'name': u'stock_report'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/support/DocType Label/Ticket/Ticket.txt b/erpnext/support/DocType Label/Ticket/Ticket.txt
deleted file mode 100644
index 8707e8f..0000000
--- a/erpnext/support/DocType Label/Ticket/Ticket.txt
+++ /dev/null
@@ -1 +0,0 @@
-[{'modified_by': 'Administrator', 'name': 'Ticket', 'parent': None, 'dt_label': 'Task', 'creation': '2010-06-28 12:55:47', 'modified': '2010-06-28 12:55:47', 'module': 'Accounts', 'doctype': 'DocType Label', 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'dt': 'Ticket', 'parentfield': None}]
\ No newline at end of file
diff --git a/erpnext/support/DocType Mapper/Customer Issue-Maintenance Visit/Customer Issue-Maintenance Visit.txt b/erpnext/support/DocType Mapper/Customer Issue-Maintenance Visit/Customer Issue-Maintenance Visit.txt
index 55060ea..8bb3fa1 100644
--- a/erpnext/support/DocType Mapper/Customer Issue-Maintenance Visit/Customer Issue-Maintenance Visit.txt
+++ b/erpnext/support/DocType Mapper/Customer Issue-Maintenance Visit/Customer Issue-Maintenance Visit.txt
@@ -96,7 +96,7 @@
 		'match_id': 1,
 		'reference_doctype_key': 'prevdoc_doctype',
 		'to_field': 'maintenance_visit_details',
-		'to_table': 'Maintenance Visit Detail'
+		'to_table': 'Maintenance Visit Purpose'
 	},
 
 	# Table Mapper Detail
diff --git a/erpnext/support/DocType Mapper/Sales Order-Maintenance Schedule/Sales Order-Maintenance Schedule.txt b/erpnext/support/DocType Mapper/Sales Order-Maintenance Schedule/Sales Order-Maintenance Schedule.txt
index ccd0e60..b22ca54 100644
--- a/erpnext/support/DocType Mapper/Sales Order-Maintenance Schedule/Sales Order-Maintenance Schedule.txt
+++ b/erpnext/support/DocType Mapper/Sales Order-Maintenance Schedule/Sales Order-Maintenance Schedule.txt
@@ -83,10 +83,10 @@
 	{
 		'doctype': 'Table Mapper Detail',
 		'from_field': 'sales_order_details',
-		'from_table': 'Sales Order Detail',
+		'from_table': 'Sales Order Item',
 		'match_id': 1,
 		'to_field': 'item_maintenance_detail',
-		'to_table': 'Item Maintenance Detail',
+		'to_table': 'Maintenance Schedule Item',
 		'validation_logic': 'docstatus =1'
 	},
 
diff --git a/erpnext/support/DocType Mapper/Sales Order-Maintenance Visit/Sales Order-Maintenance Visit.txt b/erpnext/support/DocType Mapper/Sales Order-Maintenance Visit/Sales Order-Maintenance Visit.txt
index e4bd45b..6ef99b4 100644
--- a/erpnext/support/DocType Mapper/Sales Order-Maintenance Visit/Sales Order-Maintenance Visit.txt
+++ b/erpnext/support/DocType Mapper/Sales Order-Maintenance Visit/Sales Order-Maintenance Visit.txt
@@ -83,10 +83,10 @@
 	{
 		'doctype': 'Table Mapper Detail',
 		'from_field': 'sales_order_details',
-		'from_table': 'Sales Order Detail',
+		'from_table': 'Sales Order Item',
 		'match_id': 1,
 		'to_field': 'maintenance_visit_details',
-		'to_table': 'Maintenance Visit Detail'
+		'to_table': 'Maintenance Visit Purpose'
 	},
 
 	# Table Mapper Detail
diff --git a/erpnext/support/Module Def/Support/Support.txt b/erpnext/support/Module Def/Support/Support.txt
deleted file mode 100644
index 9c66c3d..0000000
--- a/erpnext/support/Module Def/Support/Support.txt
+++ /dev/null
@@ -1,149 +0,0 @@
-# Module Def, Support
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-07-01 17:42:15',
-		'docstatus': 0,
-		'modified': '2011-10-10 16:59:49',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'name': '__common__',
-		'parent': 'Support',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def'
-	},
-
-	# These values are common for all Module Def Item
-	{
-		'doctype': 'Module Def Item',
-		'name': '__common__',
-		'parent': 'Support',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-
-	# These values are common for all Module Def
-	{
-		'disabled': 'No',
-		'doctype': u'Module Def',
-		'doctype_list': 'DocType Label, Ticket',
-		'is_hidden': 'No',
-		'module_desc': 'Manage maintenance quotes, orders, schedule etc.',
-		'module_icon': 'Maintenance.gif',
-		'module_label': 'Support',
-		'module_name': 'Support',
-		'module_seq': 8,
-		'name': '__common__'
-	},
-
-	# Module Def, Support
-	{
-		'doctype': u'Module Def',
-		'name': 'Support'
-	},
-
-	# Module Def Item
-	{
-		'description': "Database of Support Ticket's raised by Customers",
-		'display_name': 'Support Ticket',
-		'doc_name': 'Support Ticket',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'status\nopening_date\ncustomer\nallocated_to'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Create schedule based on maintenance order',
-		'display_name': 'Maintenance Schedule',
-		'doc_name': 'Maintenance Schedule',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'status\ntransaction_date\ncustomer\nsales_order_no'
-	},
-
-	# Module Def Item
-	{
-		'description': 'Database of issues raised your Customers',
-		'display_name': 'Customer Issue',
-		'doc_name': 'Customer Issue',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'status\ncomplaint_date\ncustomer\nallocated_to\nallocated_on'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Maintenance Visit',
-		'doc_name': 'Maintenance Visit',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item',
-		'fields': 'status\nmntc_date\ncustomer\nmaintenance_type\ncompletion_status'
-	},
-
-	# Module Def Item
-	{
-		'description': 'List of all scheduled mainteance. You can filter by sales person, date, serial no etc. ',
-		'display_name': 'Maintenance Schedule Details',
-		'doc_name': 'Maintenance Schedule Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'description': 'List of all issues raised by customer',
-		'display_name': 'Customer Issues',
-		'doc_name': 'Customer Issue',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Warranty/AMC Expiry Details',
-		'doc_name': 'Serial No',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Warranty/AMC Summary',
-		'doc_name': 'Serial No',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Maintenance Orderwise Pending Amount To Bill',
-		'doc_name': 'Sales Order Detail',
-		'doc_type': 'Reports',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Administrator'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Maintenance User'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Maintenance Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/support/Role/Maintenance Manager/Maintenance Manager.txt b/erpnext/support/Role/Maintenance Manager/Maintenance Manager.txt
deleted file mode 100644
index 291a52c..0000000
--- a/erpnext/support/Role/Maintenance Manager/Maintenance Manager.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Maintenance Manager
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2010-07-22 15:19:33',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Support',
-		'name': '__common__',
-		'role_name': 'Maintenance Manager'
-	},
-
-	# Role, Maintenance Manager
-	{
-		'doctype': 'Role',
-		'name': 'Maintenance Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/support/Role/Maintenance User/Maintenance User.txt b/erpnext/support/Role/Maintenance User/Maintenance User.txt
deleted file mode 100644
index c0a9e4e..0000000
--- a/erpnext/support/Role/Maintenance User/Maintenance User.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Maintenance User
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2010-07-22 15:19:19',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Support',
-		'name': '__common__',
-		'role_name': 'Maintenance User'
-	},
-
-	# Role, Maintenance User
-	{
-		'doctype': 'Role',
-		'name': 'Maintenance User'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/support/Role/Support Manager/Support Manager.txt b/erpnext/support/Role/Support Manager/Support Manager.txt
deleted file mode 100644
index 409280f..0000000
--- a/erpnext/support/Role/Support Manager/Support Manager.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Support Manager
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-12-28 17:02:39',
-		'docstatus': 0,
-		'modified': '2010-12-28 15:17:40',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Support',
-		'name': '__common__',
-		'role_name': 'Support Manager'
-	},
-
-	# Role, Support Manager
-	{
-		'doctype': 'Role',
-		'name': 'Support Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/support/Role/Support Team/Support Team.txt b/erpnext/support/Role/Support Team/Support Team.txt
deleted file mode 100644
index f5bcca6..0000000
--- a/erpnext/support/Role/Support Team/Support Team.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Support Team
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-12-28 17:02:39',
-		'docstatus': 0,
-		'modified': '2010-12-28 15:19:11',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': 'Support',
-		'name': '__common__',
-		'role_name': 'Support Team'
-	},
-
-	# Role, Support Team
-	{
-		'doctype': 'Role',
-		'name': 'Support Team'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/support/__init__.py b/erpnext/support/__init__.py
index e69de29..71ef684 100644
--- a/erpnext/support/__init__.py
+++ b/erpnext/support/__init__.py
@@ -0,0 +1,6 @@
+install_docs = [
+	{'doctype':'Role', 'role_name':'Support Team', 'name':'Support Team'},
+	{'doctype':'Role', 'role_name':'Support Manager', 'name':'Support Manager'},
+	{'doctype':'Role', 'role_name':'Maintenance User', 'name':'Maintenance User'},
+	{'doctype':'Role', 'role_name':'Maintenance Manager', 'name':'Maintenance Manager'}
+]
diff --git a/erpnext/support/doctype/customer_issue/customer_issue.js b/erpnext/support/doctype/customer_issue/customer_issue.js
index 3890cb7..699c97f 100644
--- a/erpnext/support/doctype/customer_issue/customer_issue.js
+++ b/erpnext/support/doctype/customer_issue/customer_issue.js
@@ -22,8 +22,8 @@
 }
 
 cur_frm.cscript.refresh = function(doc,ct,cdn){
-  if(!doc.docstatus) hide_field('Make Maintenance Visit');
-  else if(doc.docstatus && (doc.status == 'Open' || doc.status == 'Work In Progress')) unhide_field('Make Maintenance Visit');
+  if(!doc.docstatus) hide_field('make_maintenance_visit');
+  else if(doc.docstatus && (doc.status == 'Open' || doc.status == 'Work In Progress')) unhide_field('make_maintenance_visit');
 }
 
 
@@ -63,7 +63,7 @@
 
 
 
-cur_frm.cscript['Make Maintenance Visit'] = function(doc, cdt, cdn) {
+cur_frm.cscript.make_maintenance_visit = function(doc, cdt, cdn) {
   if (doc.docstatus == 1) { 
     $c_obj(make_doclist(doc.doctype, doc.name),'check_maintenance_visit','',
       function(r,rt){
@@ -74,7 +74,7 @@
                   'from_doctype':'Customer Issue',
                   'to_doctype':'Maintenance Visit',
                   'from_docname':doc.name,
-            'from_to_list':"[['Customer Issue', 'Maintenance Visit'], ['Customer Issue', 'Maintenance Visit Detail']]"
+            'from_to_list':"[['Customer Issue', 'Maintenance Visit'], ['Customer Issue', 'Maintenance Visit Purpose']]"
           }
           , function(r,rt) {
             loaddoc("Maintenance Visit", n);
diff --git a/erpnext/support/doctype/customer_issue/customer_issue.py b/erpnext/support/doctype/customer_issue/customer_issue.py
index af839cf..096d688 100644
--- a/erpnext/support/doctype/customer_issue/customer_issue.py
+++ b/erpnext/support/doctype/customer_issue/customer_issue.py
@@ -48,7 +48,7 @@
 #check if maintenance schedule already generated
 #============================================
   def check_maintenance_visit(self):
-    nm = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Detail` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1 and t1.completion_status='Fully Completed'", self.doc.name)
+    nm = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1 and t1.completion_status='Fully Completed'", self.doc.name)
     nm = nm and nm[0][0] or ''
     
     if not nm:
@@ -72,7 +72,7 @@
     #  raise Exception
   
   def on_cancel(self):
-    lst = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Detail` t2 where t2.parent = t1.name and t2.prevdoc_docname = '%s' and  t1.docstatus!=2"%(self.doc.name))
+    lst = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 where t2.parent = t1.name and t2.prevdoc_docname = '%s' and  t1.docstatus!=2"%(self.doc.name))
     if lst:
       lst1 = ','.join([x[0] for x in lst])
       msgprint("Maintenance Visit No. "+lst1+" already created against this customer issue. So can not be Cancelled")
diff --git a/erpnext/support/doctype/customer_issue/customer_issue.txt b/erpnext/support/doctype/customer_issue/customer_issue.txt
index b19a1a8..2c27735 100644
--- a/erpnext/support/doctype/customer_issue/customer_issue.txt
+++ b/erpnext/support/doctype/customer_issue/customer_issue.txt
@@ -3,62 +3,54 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:57',
+		'creation': '2012-03-27 14:36:40',
 		'docstatus': 0,
-		'modified': '2012-01-19 12:29:40',
-		'modified_by': 'Administrator',
-		'owner': 'harshada@webnotestech.com'
+		'modified': '2012-03-27 14:45:47',
+		'modified_by': u'Administrator',
+		'owner': u'harshada@webnotestech.com'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1325570647',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'_last_update': u'1325570647',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
-		'module': 'Support',
+		'is_submittable': 1,
+		'module': u'Support',
 		'name': '__common__',
-		'search_fields': 'status,customer,customer_name,allocated_to,allocated_on, territory',
-		'section_style': 'Tabbed',
-		'server_code_error': ' ',
+		'search_fields': u'status,customer,customer_name,allocated_to,allocated_on, territory',
+		'section_style': u'Tabbed',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'subject': '%(complaint)s By %(complaint_raised_by)s on %(issue_date)s',
-		'tag_fields': 'status',
+		'subject': u'%(complaint)s By %(complaint_raised_by)s on %(issue_date)s',
+		'tag_fields': u'status',
 		'version': 97
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Customer Issue',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Customer Issue',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Customer Issue',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Customer Issue',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Customer Issue
 	{
 		'doctype': 'DocType',
-		'name': 'Customer Issue'
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'Guest',
-		'write': 1
+		'name': u'Customer Issue'
 	},
 
 	# DocPerm
@@ -66,18 +58,18 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'submit': 1,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'System Manager'
+		'role': u'System Manager'
 	},
 
 	# DocPerm
@@ -85,18 +77,18 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Maintenance Manager',
+		'role': u'Maintenance Manager',
 		'submit': 1,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Maintenance Manager'
+		'role': u'Maintenance Manager'
 	},
 
 	# DocPerm
@@ -104,40 +96,50 @@
 		'amend': 1,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Maintenance User',
+		'role': u'Maintenance User',
 		'submit': 1,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Maintenance User'
+		'role': u'Maintenance User'
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Guest',
+		'write': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Customer Issue',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'customer_issue',
+		'fieldtype': u'Section Break',
+		'label': u'Customer Issue',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'naming_series',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'naming_series',
+		'fieldtype': u'Select',
 		'in_filter': 0,
-		'label': 'Series',
+		'label': u'Series',
 		'no_copy': 1,
-		'oldfieldname': 'naming_series',
-		'oldfieldtype': 'Select',
-		'options': '\nCI/2010-2011/',
+		'oldfieldname': u'naming_series',
+		'oldfieldtype': u'Select',
+		'options': u'\nCI/2010-2011/',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 0
@@ -145,17 +147,17 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'Open',
-		'doctype': 'DocField',
-		'fieldname': 'status',
-		'fieldtype': 'Select',
+		'colour': u'White:FFF',
+		'default': u'Open',
+		'doctype': u'DocField',
+		'fieldname': u'status',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Status',
+		'label': u'Status',
 		'no_copy': 1,
-		'oldfieldname': 'status',
-		'oldfieldtype': 'Select',
-		'options': '\nOpen\nClosed\nWork In Progress\nCancelled',
+		'oldfieldname': u'status',
+		'oldfieldtype': u'Select',
+		'options': u'\nOpen\nClosed\nWork In Progress\nCancelled',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1
@@ -163,14 +165,14 @@
 
 	# DocField
 	{
-		'default': 'Today',
-		'doctype': 'DocField',
-		'fieldname': 'complaint_date',
-		'fieldtype': 'Date',
+		'default': u'Today',
+		'doctype': u'DocField',
+		'fieldname': u'complaint_date',
+		'fieldtype': u'Date',
 		'in_filter': 1,
-		'label': 'Issue Date',
-		'oldfieldname': 'complaint_date',
-		'oldfieldtype': 'Date',
+		'label': u'Issue Date',
+		'oldfieldname': u'complaint_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1
@@ -178,142 +180,143 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'complaint_raised_by',
-		'fieldtype': 'Data',
-		'label': 'Raised By',
-		'oldfieldname': 'complaint_raised_by',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'complaint_raised_by',
+		'fieldtype': u'Data',
+		'label': u'Raised By',
+		'oldfieldname': u'complaint_raised_by',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'from_company',
-		'fieldtype': 'Data',
-		'label': 'From Company',
-		'oldfieldname': 'from_company',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'from_company',
+		'fieldtype': u'Data',
+		'label': u'From Company',
+		'oldfieldname': u'from_company',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'service_address',
-		'fieldtype': 'Small Text',
-		'label': 'Service Address',
-		'oldfieldname': 'service_address',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'service_address',
+		'fieldtype': u'Small Text',
+		'label': u'Service Address',
+		'oldfieldname': u'service_address',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'customer',
-		'fieldtype': 'Link',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'customer',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Customer',
-		'oldfieldname': 'customer',
-		'oldfieldtype': 'Link',
-		'options': 'Customer',
+		'label': u'Customer',
+		'oldfieldname': u'customer',
+		'oldfieldtype': u'Link',
+		'options': u'Customer',
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
 		'search_index': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'customer_address',
-		'fieldtype': 'Link',
-		'label': 'Customer Address',
-		'options': 'Address',
+		'doctype': u'DocField',
+		'fieldname': u'customer_address',
+		'fieldtype': u'Link',
+		'label': u'Customer Address',
+		'options': u'Address',
 		'permlevel': 0,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'contact_person',
-		'fieldtype': 'Link',
-		'label': 'Contact Person',
-		'options': 'Contact',
+		'doctype': u'DocField',
+		'fieldname': u'contact_person',
+		'fieldtype': u'Link',
+		'label': u'Contact Person',
+		'options': u'Contact',
 		'permlevel': 0,
 		'print_hide': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'customer_name',
-		'fieldtype': 'Data',
-		'label': 'Name',
+		'doctype': u'DocField',
+		'fieldname': u'customer_name',
+		'fieldtype': u'Data',
+		'label': u'Name',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'address_display',
-		'fieldtype': 'Small Text',
-		'label': 'Address',
+		'doctype': u'DocField',
+		'fieldname': u'address_display',
+		'fieldtype': u'Small Text',
+		'label': u'Address',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'contact_display',
-		'fieldtype': 'Small Text',
-		'label': 'Contact',
+		'doctype': u'DocField',
+		'fieldname': u'contact_display',
+		'fieldtype': u'Small Text',
+		'label': u'Contact',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'contact_mobile',
-		'fieldtype': 'Data',
-		'label': 'Mobile No',
+		'doctype': u'DocField',
+		'fieldname': u'contact_mobile',
+		'fieldtype': u'Data',
+		'label': u'Mobile No',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'contact_email',
-		'fieldtype': 'Data',
-		'label': 'Contact Email',
+		'doctype': u'DocField',
+		'fieldname': u'contact_email',
+		'fieldtype': u'Data',
+		'label': u'Contact Email',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'territory',
-		'fieldtype': 'Link',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'territory',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Territory',
-		'oldfieldname': 'territory',
-		'oldfieldtype': 'Link',
-		'options': 'Territory',
+		'label': u'Territory',
+		'oldfieldname': u'territory',
+		'oldfieldtype': u'Link',
+		'options': u'Territory',
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 0,
@@ -322,11 +325,11 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'customer_group',
-		'fieldtype': 'Link',
-		'label': 'Customer Group',
-		'options': 'Customer Group',
+		'doctype': u'DocField',
+		'fieldname': u'customer_group',
+		'fieldtype': u'Link',
+		'label': u'Customer Group',
+		'options': u'Customer Group',
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 0
@@ -334,32 +337,32 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Link',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'company',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Company',
-		'oldfieldname': 'company',
-		'oldfieldtype': 'Link',
-		'options': 'Company',
+		'label': u'Company',
+		'oldfieldname': u'company',
+		'oldfieldtype': u'Link',
+		'options': u'Company',
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
 		'search_index': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'fiscal_year',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Fiscal Year',
-		'oldfieldname': 'fiscal_year',
-		'oldfieldtype': 'Select',
-		'options': 'link:Fiscal Year',
+		'label': u'Fiscal Year',
+		'oldfieldname': u'fiscal_year',
+		'oldfieldtype': u'Select',
+		'options': u'link:Fiscal Year',
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 1,
@@ -368,235 +371,239 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amended_from',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Data',
 		'hidden': 1,
-		'label': 'Amended From',
+		'label': u'Amended From',
 		'no_copy': 1,
-		'oldfieldname': 'amended_from',
-		'oldfieldtype': 'Data',
+		'oldfieldname': u'amended_from',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'print_hide': 1,
-		'width': '150px'
+		'width': u'150px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amendment_date',
-		'fieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
 		'hidden': 1,
-		'label': 'Amendment Date',
+		'label': u'Amendment Date',
 		'no_copy': 1,
-		'oldfieldname': 'amendment_date',
-		'oldfieldtype': 'Date',
+		'oldfieldname': u'amendment_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'print_hide': 1,
-		'width': '100px'
+		'width': u'100px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Issue Details',
-		'oldfieldtype': 'Section Break',
-		'options': 'Simple',
+		'doctype': u'DocField',
+		'fieldname': u'issue_details',
+		'fieldtype': u'Section Break',
+		'label': u'Issue Details',
+		'oldfieldtype': u'Section Break',
+		'options': u'Simple',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'serial_no',
-		'fieldtype': 'Link',
-		'label': 'Serial No',
-		'options': 'Serial No',
+		'doctype': u'DocField',
+		'fieldname': u'serial_no',
+		'fieldtype': u'Link',
+		'label': u'Serial No',
+		'options': u'Serial No',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'item_code',
-		'fieldtype': 'Link',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Item Code',
-		'oldfieldname': 'item_code',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
 		'permlevel': 0,
 		'reqd': 0,
 		'search_index': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:doc.item_code',
-		'doctype': 'DocField',
-		'fieldname': 'item_name',
-		'fieldtype': 'Data',
-		'label': 'Item Name',
-		'oldfieldname': 'item_name',
-		'oldfieldtype': 'Data',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:doc.item_code',
+		'doctype': u'DocField',
+		'fieldname': u'item_name',
+		'fieldtype': u'Data',
+		'label': u'Item Name',
+		'oldfieldname': u'item_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:doc.item_code',
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Small Text',
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Small Text',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:doc.item_code',
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Small Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1,
-		'width': '300px'
+		'width': u'300px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'complaint',
-		'fieldtype': 'Small Text',
-		'label': 'Issue',
+		'doctype': u'DocField',
+		'fieldname': u'complaint',
+		'fieldtype': u'Small Text',
+		'label': u'Issue',
 		'no_copy': 1,
-		'oldfieldname': 'complaint',
-		'oldfieldtype': 'Small Text',
+		'oldfieldname': u'complaint',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'warranty_amc_status',
-		'fieldtype': 'Select',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'warranty_amc_status',
+		'fieldtype': u'Select',
 		'hidden': 0,
 		'in_filter': 1,
-		'label': 'Warranty / AMC Status',
-		'options': '\nUnder Warranty\nOut of Warranty\nUnder AMC\nOut of AMC',
+		'label': u'Warranty / AMC Status',
+		'options': u'\nUnder Warranty\nOut of Warranty\nUnder AMC\nOut of AMC',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'warranty_expiry_date',
-		'fieldtype': 'Date',
-		'label': 'Warranty Expiry Date',
+		'doctype': u'DocField',
+		'fieldname': u'warranty_expiry_date',
+		'fieldtype': u'Date',
+		'label': u'Warranty Expiry Date',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'amc_expiry_date',
-		'fieldtype': 'Date',
-		'label': 'AMC Expiry Date',
+		'doctype': u'DocField',
+		'fieldname': u'amc_expiry_date',
+		'fieldtype': u'Date',
+		'label': u'AMC Expiry Date',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'allocated_on',
-		'fieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'allocated_on',
+		'fieldtype': u'Date',
 		'in_filter': 1,
-		'label': 'Allocated On',
-		'oldfieldname': 'allocated_on',
-		'oldfieldtype': 'Date',
+		'label': u'Allocated On',
+		'oldfieldname': u'allocated_on',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'search_index': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'allocated_to',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'allocated_to',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Allocated To',
-		'oldfieldname': 'allocated_to',
-		'oldfieldtype': 'Link',
-		'options': 'Profile',
+		'label': u'Allocated To',
+		'oldfieldname': u'allocated_to',
+		'oldfieldtype': u'Link',
+		'options': u'Profile',
 		'permlevel': 0,
 		'search_index': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Resolution Detail',
-		'oldfieldtype': 'Section Break',
-		'options': 'Simple',
+		'doctype': u'DocField',
+		'fieldname': u'resolution_detail',
+		'fieldtype': u'Section Break',
+		'label': u'Resolution Detail',
+		'oldfieldtype': u'Section Break',
+		'options': u'Simple',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'resolution_details',
-		'fieldtype': 'Text',
-		'label': 'Resolution Details',
+		'doctype': u'DocField',
+		'fieldname': u'resolution_details',
+		'fieldtype': u'Text',
+		'label': u'Resolution Details',
 		'no_copy': 1,
-		'oldfieldname': 'resolution_details',
-		'oldfieldtype': 'Text',
+		'oldfieldname': u'resolution_details',
+		'oldfieldtype': u'Text',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break2',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'resolution_date',
-		'fieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'resolution_date',
+		'fieldtype': u'Date',
 		'in_filter': 1,
-		'label': 'Resolution Date',
+		'label': u'Resolution Date',
 		'no_copy': 1,
-		'oldfieldname': 'resolution_date',
-		'oldfieldtype': 'Date',
+		'oldfieldname': u'resolution_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 0,
 		'search_index': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'resolved_by',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'resolved_by',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Resolved By',
+		'label': u'Resolved By',
 		'no_copy': 1,
-		'oldfieldname': 'resolved_by',
-		'oldfieldtype': 'Link',
-		'options': 'Sales Person',
+		'oldfieldname': u'resolved_by',
+		'oldfieldtype': u'Link',
+		'options': u'Sales Person',
 		'permlevel': 0,
 		'search_index': 1
 	},
@@ -604,24 +611,26 @@
 	# DocField
 	{
 		'allow_on_submit': 0,
-		'colour': 'White:FFF',
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Next Steps',
-		'oldfieldtype': 'Section Break',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'next_steps',
+		'fieldtype': u'Section Break',
+		'label': u'Next Steps',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
 		'allow_on_submit': 1,
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Make Maintenance Visit',
-		'oldfieldtype': 'Button',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'make_maintenance_visit',
+		'fieldtype': u'Button',
+		'label': u'Make Maintenance Visit',
+		'oldfieldtype': u'Button',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/support/doctype/item_maintenance_detail/__init__.py b/erpnext/support/doctype/item_maintenance_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/support/doctype/item_maintenance_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/support/doctype/item_maintenance_detail/item_maintenance_detail.txt b/erpnext/support/doctype/item_maintenance_detail/item_maintenance_detail.txt
deleted file mode 100644
index e323498..0000000
--- a/erpnext/support/doctype/item_maintenance_detail/item_maintenance_detail.txt
+++ /dev/null
@@ -1,176 +0,0 @@
-# DocType, Item Maintenance Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:06',
-		'docstatus': 0,
-		'modified': '2012-03-21 14:57:06',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': u'IMD.#####',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': u'Support',
-		'name': '__common__',
-		'section_style': u'Simple',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 9
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Item Maintenance Detail',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# DocType, Item Maintenance Detail
-	{
-		'doctype': 'DocType',
-		'name': u'Item Maintenance Detail'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'item_code',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Item Code',
-		'oldfieldname': u'item_code',
-		'oldfieldtype': u'Link',
-		'options': u'Item',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'item_name',
-		'fieldtype': u'Data',
-		'label': u'Item Name',
-		'oldfieldname': u'item_name',
-		'oldfieldtype': u'Data',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'description',
-		'fieldtype': u'Data',
-		'label': u'Description',
-		'oldfieldname': u'description',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'width': u'300px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'start_date',
-		'fieldtype': u'Date',
-		'in_filter': 1,
-		'label': u'Start Date',
-		'oldfieldname': u'start_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'end_date',
-		'fieldtype': u'Date',
-		'in_filter': 1,
-		'label': u'End Date',
-		'oldfieldname': u'end_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'periodicity',
-		'fieldtype': u'Select',
-		'label': u'Periodicity',
-		'oldfieldname': u'periodicity',
-		'oldfieldtype': u'Select',
-		'options': u'\nWeekly\nMonthly\nQuarterly\nHalf Yearly\nYearly\nRandom',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'no_of_visits',
-		'fieldtype': u'Int',
-		'label': u'No of Visits',
-		'oldfieldname': u'no_of_visits',
-		'oldfieldtype': u'Int',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'incharge_name',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Incharge Name',
-		'oldfieldname': u'incharge_name',
-		'oldfieldtype': u'Link',
-		'options': u'Sales Person',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'serial_no',
-		'fieldtype': u'Small Text',
-		'label': u'Serial No',
-		'oldfieldname': u'serial_no',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'prevdoc_docname',
-		'fieldtype': u'Data',
-		'in_filter': 1,
-		'label': u'Against Docname',
-		'no_copy': 1,
-		'oldfieldname': u'prevdoc_docname',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'search_index': 1,
-		'width': u'150px'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js
index 51853a6..efa3eac 100644
--- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js
+++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js
@@ -63,7 +63,7 @@
 }
 
 // Get Items based on SO Selected
-cur_frm.cscript['Get Items'] = function(doc, dt, dn) {
+cur_frm.cscript.get_items = function(doc, dt, dn) {
   var callback = function(r,rt) { 
 	  unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
 	  cur_frm.refresh();
@@ -97,7 +97,7 @@
   if(doc.customer) {
     cond = '`tabSales Order`.customer = "'+doc.customer+'" AND';
   }
-  return repl('SELECT DISTINCT `tabSales Order`.name FROM `tabSales Order`, `tabSales Order Detail`, `tabItem` WHERE `tabSales Order`.company = "%(company)s" AND `tabSales Order`.docstatus = 1 AND `tabSales Order Detail`.parent = `tabSales Order`.name AND `tabSales Order Detail`.item_code = `tabItem`.name AND `tabItem`.is_service_item = "Yes" AND %(cond)s `tabSales Order`.name LIKE "%s" ORDER BY `tabSales Order`.name DESC LIMIT 50', {company:doc.company, cond:cond});
+  return repl('SELECT DISTINCT `tabSales Order`.name FROM `tabSales Order`, `tabSales Order Item`, `tabItem` WHERE `tabSales Order`.company = "%(company)s" AND `tabSales Order`.docstatus = 1 AND `tabSales Order Item`.parent = `tabSales Order`.name AND `tabSales Order Item`.item_code = `tabItem`.name AND `tabItem`.is_service_item = "Yes" AND %(cond)s `tabSales Order`.name LIKE "%s" ORDER BY `tabSales Order`.name DESC LIMIT 50', {company:doc.company, cond:cond});
 }
 
 cur_frm.cscript.periodicity = function(doc, cdt, cdn){
@@ -114,7 +114,7 @@
   }
 }
 
-cur_frm.cscript['Generate Schedule'] = function(doc, cdt, cdn) {
+cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) {
   if (!doc.__islocal) {
     $c('runserverobj', args={'method':'generate_schedule', 'docs':compress_doclist(make_doclist(cdt,cdn))},
       function(r,rt){
diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py
index 30083da..9aee9ff 100644
--- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py
+++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py
@@ -44,7 +44,7 @@
   def pull_sales_order_detail(self):
     self.doc.clear_table(self.doclist, 'item_maintenance_detail')
     self.doc.clear_table(self.doclist, 'maintenance_schedule_detail')
-    self.doclist = get_obj('DocType Mapper', 'Sales Order-Maintenance Schedule').dt_map('Sales Order', 'Maintenance Schedule', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Maintenance Schedule'],['Sales Order Detail', 'Item Maintenance Detail']]")
+    self.doclist = get_obj('DocType Mapper', 'Sales Order-Maintenance Schedule').dt_map('Sales Order', 'Maintenance Schedule', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Maintenance Schedule'],['Sales Order Item', 'Maintenance Schedule Item']]")
   
   #pull item details 
   #-------------------
@@ -213,7 +213,7 @@
   def validate_sales_order(self):
     for d in getlist(self.doclist, 'item_maintenance_detail'):
       if d.prevdoc_docname:
-        chk = sql("select t1.name from `tabMaintenance Schedule` t1, `tabItem Maintenance Detail` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1", d.prevdoc_docname)
+        chk = sql("select t1.name from `tabMaintenance Schedule` t1, `tabMaintenance Schedule Item` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1", d.prevdoc_docname)
         if chk:
           msgprint("Maintenance Schedule against "+d.prevdoc_docname+" already exist")
           raise Exception
diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.txt b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.txt
index 5048c85..4662ce9 100644
--- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.txt
+++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:09',
+		'creation': '2012-03-27 14:36:41',
 		'docstatus': 0,
-		'modified': '2012-03-21 14:09:46',
+		'modified': '2012-03-27 14:45:49',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -17,6 +17,7 @@
 		'colour': u'White:FFF',
 		'default_print_format': u'Standard',
 		'doctype': 'DocType',
+		'is_submittable': 1,
 		'module': u'Support',
 		'name': '__common__',
 		'search_fields': u'status,customer,customer_name, sales_order_no',
@@ -92,6 +93,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'customer_details',
 		'fieldtype': u'Section Break',
 		'label': u'Customer Details',
 		'oldfieldtype': u'Section Break',
@@ -102,6 +104,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0
@@ -201,6 +204,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break1',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0
@@ -310,6 +314,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'items',
 		'fieldtype': u'Section Break',
 		'label': u'Items',
 		'oldfieldtype': u'Section Break',
@@ -336,6 +341,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'get_items',
 		'fieldtype': u'Button',
 		'label': u'Get Items',
 		'oldfieldtype': u'Button',
@@ -349,16 +355,17 @@
 		'doctype': u'DocField',
 		'fieldname': u'item_maintenance_detail',
 		'fieldtype': u'Table',
-		'label': u'Item Maintenance Detail',
+		'label': u'Maintenance Schedule Item',
 		'oldfieldname': u'item_maintenance_detail',
 		'oldfieldtype': u'Table',
-		'options': u'Item Maintenance Detail',
+		'options': u'Maintenance Schedule Item',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'schedule',
 		'fieldtype': u'Section Break',
 		'label': u'Schedule',
 		'oldfieldtype': u'Section Break',
@@ -370,6 +377,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'generate_schedule',
 		'fieldtype': u'Button',
 		'label': u'Generate Schedule',
 		'oldfieldtype': u'Button',
diff --git a/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt b/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt
index b526538..8dc9b91 100644
--- a/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt
+++ b/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:09',
+		'creation': '2012-03-27 14:36:42',
 		'docstatus': 0,
-		'modified': '2012-03-21 14:10:17',
+		'modified': '2012-03-27 14:36:42',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
diff --git a/erpnext/support/doctype/maintenance_visit_detail/__init__.py b/erpnext/support/doctype/maintenance_schedule_item/__init__.py
similarity index 100%
copy from erpnext/support/doctype/maintenance_visit_detail/__init__.py
copy to erpnext/support/doctype/maintenance_schedule_item/__init__.py
diff --git a/erpnext/support/doctype/maintenance_schedule_item/maintenance_schedule_item.txt b/erpnext/support/doctype/maintenance_schedule_item/maintenance_schedule_item.txt
new file mode 100644
index 0000000..7e815f5
--- /dev/null
+++ b/erpnext/support/doctype/maintenance_schedule_item/maintenance_schedule_item.txt
@@ -0,0 +1,176 @@
+# DocType, Maintenance Schedule Item
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:41',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:41',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'IMD.#####',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Support',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 9
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Maintenance Schedule Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Maintenance Schedule Item
+	{
+		'doctype': 'DocType',
+		'name': u'Maintenance Schedule Item'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_name',
+		'fieldtype': u'Data',
+		'label': u'Item Name',
+		'oldfieldname': u'item_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Data',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'start_date',
+		'fieldtype': u'Date',
+		'in_filter': 1,
+		'label': u'Start Date',
+		'oldfieldname': u'start_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'end_date',
+		'fieldtype': u'Date',
+		'in_filter': 1,
+		'label': u'End Date',
+		'oldfieldname': u'end_date',
+		'oldfieldtype': u'Date',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'periodicity',
+		'fieldtype': u'Select',
+		'label': u'Periodicity',
+		'oldfieldname': u'periodicity',
+		'oldfieldtype': u'Select',
+		'options': u'\nWeekly\nMonthly\nQuarterly\nHalf Yearly\nYearly\nRandom',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'no_of_visits',
+		'fieldtype': u'Int',
+		'label': u'No of Visits',
+		'oldfieldname': u'no_of_visits',
+		'oldfieldtype': u'Int',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'incharge_name',
+		'fieldtype': u'Link',
+		'in_filter': 1,
+		'label': u'Incharge Name',
+		'oldfieldname': u'incharge_name',
+		'oldfieldtype': u'Link',
+		'options': u'Sales Person',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'serial_no',
+		'fieldtype': u'Small Text',
+		'label': u'Serial No',
+		'oldfieldname': u'serial_no',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_docname',
+		'fieldtype': u'Data',
+		'in_filter': 1,
+		'label': u'Against Docname',
+		'no_copy': 1,
+		'oldfieldname': u'prevdoc_docname',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'search_index': 1,
+		'width': u'150px'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.js b/erpnext/support/doctype/maintenance_visit/maintenance_visit.js
index df976d1..a2c0772 100644
--- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.js
+++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.js
@@ -60,7 +60,7 @@
   return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
 }
 
-cur_frm.cscript['Get Items'] = function(doc, dt, dn) {
+cur_frm.cscript.get_items = function(doc, dt, dn) {
   var callback = function(r,rt) { 
 	  unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
 	  cur_frm.refresh();
@@ -110,8 +110,8 @@
   if(doc.customer) {
     cond = '`tabSales Order`.customer = "'+doc.customer+'" AND';
   }
-  //return repl('SELECT DISTINCT `tabSales Order`.name FROM `tabSales Order`, `tabSales Order Detail` WHERE `tabSales Order`.company = "%(company)s" AND `tabSales Order`.docstatus = 1 AND %(cond)s `tabSales Order`.name LIKE "%s" ORDER BY `tabSales Order`.name DESC LIMIT 50', {company:doc.company, cond:cond});
-  return repl('SELECT DISTINCT `tabSales Order`.name FROM `tabSales Order`, `tabSales Order Detail`, `tabItem` WHERE `tabSales Order`.company = "%(company)s" AND `tabSales Order`.docstatus = 1 AND `tabSales Order Detail`.parent = `tabSales Order`.name AND `tabSales Order Detail`.item_code = `tabItem`.name AND `tabItem`.is_service_item = "Yes" AND %(cond)s `tabSales Order`.name LIKE "%s" ORDER BY `tabSales Order`.name DESC LIMIT 50', {company:doc.company, cond:cond});
+  //return repl('SELECT DISTINCT `tabSales Order`.name FROM `tabSales Order`, `tabSales Order Item` WHERE `tabSales Order`.company = "%(company)s" AND `tabSales Order`.docstatus = 1 AND %(cond)s `tabSales Order`.name LIKE "%s" ORDER BY `tabSales Order`.name DESC LIMIT 50', {company:doc.company, cond:cond});
+  return repl('SELECT DISTINCT `tabSales Order`.name FROM `tabSales Order`, `tabSales Order Item`, `tabItem` WHERE `tabSales Order`.company = "%(company)s" AND `tabSales Order`.docstatus = 1 AND `tabSales Order Item`.parent = `tabSales Order`.name AND `tabSales Order Item`.item_code = `tabItem`.name AND `tabItem`.is_service_item = "Yes" AND %(cond)s `tabSales Order`.name LIKE "%s" ORDER BY `tabSales Order`.name DESC LIMIT 50', {company:doc.company, cond:cond});
 }
 
 cur_frm.fields_dict['customer_issue_no'].get_query = function(doc) {
diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.py b/erpnext/support/doctype/maintenance_visit/maintenance_visit.py
index 902b92a..1786afc 100644
--- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.py
+++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.py
@@ -59,10 +59,10 @@
     self.doc.clear_table(self.doclist, 'maintenance_visit_details')
     
     if self.doc.sales_order_no:
-      self.doclist = get_obj('DocType Mapper', 'Sales Order-Maintenance Visit').dt_map('Sales Order', 'Maintenance Visit', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Maintenance Visit'],['Sales Order Detail', 'Maintenance Visit Detail']]")
+      self.doclist = get_obj('DocType Mapper', 'Sales Order-Maintenance Visit').dt_map('Sales Order', 'Maintenance Visit', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Maintenance Visit'],['Sales Order Item', 'Maintenance Visit Purpose']]")
     
     elif self.doc.customer_issue_no:      
-      self.doclist = get_obj('DocType Mapper', 'Customer Issue-Maintenance Visit').dt_map('Customer Issue', 'Maintenance Visit', self.doc.customer_issue_no, self.doc, self.doclist, "[['Customer Issue', 'Maintenance Visit'],['Customer Issue', 'Maintenance Visit Detail']]")
+      self.doclist = get_obj('DocType Mapper', 'Customer Issue-Maintenance Visit').dt_map('Customer Issue', 'Maintenance Visit', self.doc.customer_issue_no, self.doc, self.doclist, "[['Customer Issue', 'Maintenance Visit'],['Customer Issue', 'Maintenance Visit Purpose']]")
   
   #validate reference value using doctype mapper
   #-----------------------------------------------------
@@ -117,7 +117,7 @@
           elif self.doc.completion_status == 'Partially Completed':
             status = 'Work In Progress'
         else:
-          nm = sql("select t1.name, t1.mntc_date, t2.service_person, t2.work_done from `tabMaintenance Visit` t1, `tabMaintenance Visit Detail` t2 where t2.parent = t1.name and t1.completion_status = 'Partially Completed' and t2.prevdoc_docname = %s and t1.name!=%s and t1.docstatus = 1 order by t1.name desc limit 1", (d.prevdoc_docname, self.doc.name))
+          nm = sql("select t1.name, t1.mntc_date, t2.service_person, t2.work_done from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 where t2.parent = t1.name and t1.completion_status = 'Partially Completed' and t2.prevdoc_docname = %s and t1.name!=%s and t1.docstatus = 1 order by t1.name desc limit 1", (d.prevdoc_docname, self.doc.name))
           
           if nm:
             status = 'Work In Progress'
@@ -141,7 +141,7 @@
         check_for_doctype = d.prevdoc_doctype
     
     if check_for_docname:
-      check = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Detail` t2 where t2.parent = t1.name and t1.name!=%s and t2.prevdoc_docname=%s and t1.docstatus = 1 and (t1.mntc_date > %s or (t1.mntc_date = %s and t1.mntc_time > %s))", (self.doc.name, check_for_docname, self.doc.mntc_date, self.doc.mntc_date, self.doc.mntc_time))
+      check = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 where t2.parent = t1.name and t1.name!=%s and t2.prevdoc_docname=%s and t1.docstatus = 1 and (t1.mntc_date > %s or (t1.mntc_date = %s and t1.mntc_time > %s))", (self.doc.name, check_for_docname, self.doc.mntc_date, self.doc.mntc_date, self.doc.mntc_time))
       
       if check:
         check_lst = [x[0] for x in check]
diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.txt b/erpnext/support/doctype/maintenance_visit/maintenance_visit.txt
index 6643db5..93ed656 100644
--- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.txt
+++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:09',
+		'creation': '2012-03-27 14:36:42',
 		'docstatus': 0,
-		'modified': '2012-03-21 14:11:12',
+		'modified': '2012-03-27 14:45:49',
 		'modified_by': u'Administrator',
 		'owner': u'ashwini@webnotestech.com'
 	},
@@ -17,6 +17,7 @@
 		'colour': u'White:FFF',
 		'default_print_format': u'Standard',
 		'doctype': 'DocType',
+		'is_submittable': 1,
 		'module': u'Support',
 		'name': '__common__',
 		'search_fields': u'status,maintenance_type,customer,customer_name, address,mntc_date,company,fiscal_year',
@@ -113,6 +114,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'customer_details',
 		'fieldtype': u'Section Break',
 		'label': u'Customer Details',
 		'oldfieldtype': u'Section Break',
@@ -123,6 +125,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0
@@ -247,6 +250,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break1',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -348,6 +352,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'maintenance_details',
 		'fieldtype': u'Section Break',
 		'label': u'Maintenance Details',
 		'oldfieldtype': u'Section Break',
@@ -388,6 +393,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break2',
 		'fieldtype': u'Column Break',
 		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
@@ -429,6 +435,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'get_items',
 		'fieldtype': u'Button',
 		'label': u'Get Items',
 		'oldfieldtype': u'Button',
@@ -441,6 +448,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'section_break0',
 		'fieldtype': u'Section Break',
 		'oldfieldtype': u'Section Break',
 		'options': u'Simple',
@@ -452,16 +460,17 @@
 		'doctype': u'DocField',
 		'fieldname': u'maintenance_visit_details',
 		'fieldtype': u'Table',
-		'label': u'Maintenance Visit Detail',
+		'label': u'Maintenance Visit Purpose',
 		'oldfieldname': u'maintenance_visit_details',
 		'oldfieldtype': u'Table',
-		'options': u'Maintenance Visit Detail',
+		'options': u'Maintenance Visit Purpose',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'feedback',
 		'fieldtype': u'Section Break',
 		'label': u'Feedback',
 		'oldfieldtype': u'Section Break',
diff --git a/erpnext/support/doctype/maintenance_visit_detail/maintenance_visit_detail.txt b/erpnext/support/doctype/maintenance_visit_detail/maintenance_visit_detail.txt
deleted file mode 100644
index df72e47..0000000
--- a/erpnext/support/doctype/maintenance_visit_detail/maintenance_visit_detail.txt
+++ /dev/null
@@ -1,172 +0,0 @@
-# DocType, Maintenance Visit Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:09',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'MVD.#####',
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Support',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'version': 13
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Maintenance Visit Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# DocType, Maintenance Visit Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Maintenance Visit Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Small Text',
-		'idx': 1,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Small Text',
-		'permlevel': 0,
-		'reqd': 1,
-		'width': '300px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'service_person',
-		'fieldtype': 'Link',
-		'idx': 2,
-		'label': 'Service Person',
-		'oldfieldname': 'service_person',
-		'oldfieldtype': 'Link',
-		'options': 'Sales Person',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'work_done',
-		'fieldtype': 'Small Text',
-		'idx': 3,
-		'label': 'Work Done',
-		'oldfieldname': 'work_done',
-		'oldfieldtype': 'Small Text',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'item_code',
-		'fieldtype': 'Link',
-		'idx': 4,
-		'label': 'Item Code',
-		'oldfieldname': 'item_code',
-		'oldfieldtype': 'Link',
-		'options': 'Item',
-		'permlevel': 0,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'item_name',
-		'fieldtype': 'Data',
-		'idx': 5,
-		'label': 'Item Name',
-		'oldfieldname': 'item_name',
-		'oldfieldtype': 'Data',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'serial_no',
-		'fieldtype': 'Small Text',
-		'idx': 6,
-		'label': 'Serial No',
-		'oldfieldname': 'serial_no',
-		'oldfieldtype': 'Small Text',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'prevdoc_docname',
-		'fieldtype': 'Data',
-		'hidden': 0,
-		'idx': 7,
-		'label': 'Against Document No',
-		'no_copy': 1,
-		'oldfieldname': 'prevdoc_docname',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'report_hide': 1,
-		'width': '160px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'prevdoc_detail_docname',
-		'fieldtype': 'Data',
-		'hidden': 1,
-		'idx': 8,
-		'label': 'Against Document Detail No',
-		'no_copy': 1,
-		'oldfieldname': 'prevdoc_detail_docname',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'report_hide': 1,
-		'width': '160px'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'prevdoc_doctype',
-		'fieldtype': 'Data',
-		'hidden': 0,
-		'idx': 9,
-		'label': 'Document Type',
-		'no_copy': 1,
-		'oldfieldname': 'prevdoc_doctype',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'report_hide': 1,
-		'width': '150px'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/support/doctype/maintenance_visit_detail/__init__.py b/erpnext/support/doctype/maintenance_visit_purpose/__init__.py
similarity index 100%
rename from erpnext/support/doctype/maintenance_visit_detail/__init__.py
rename to erpnext/support/doctype/maintenance_visit_purpose/__init__.py
diff --git a/erpnext/support/doctype/maintenance_visit_purpose/maintenance_visit_purpose.txt b/erpnext/support/doctype/maintenance_visit_purpose/maintenance_visit_purpose.txt
new file mode 100644
index 0000000..cd25bff
--- /dev/null
+++ b/erpnext/support/doctype/maintenance_visit_purpose/maintenance_visit_purpose.txt
@@ -0,0 +1,163 @@
+# DocType, Maintenance Visit Purpose
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:43',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:43',
+		'modified_by': u'Administrator',
+		'owner': u'ashwini@webnotestech.com'
+	},
+
+	# These values are common for all DocType
+	{
+		'autoname': u'MVD.#####',
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Support',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'version': 13
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Maintenance Visit Purpose',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
+	},
+
+	# DocType, Maintenance Visit Purpose
+	{
+		'doctype': 'DocType',
+		'name': u'Maintenance Visit Purpose'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Small Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0,
+		'reqd': 1,
+		'width': u'300px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'service_person',
+		'fieldtype': u'Link',
+		'label': u'Service Person',
+		'oldfieldname': u'service_person',
+		'oldfieldtype': u'Link',
+		'options': u'Sales Person',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'work_done',
+		'fieldtype': u'Small Text',
+		'label': u'Work Done',
+		'oldfieldname': u'work_done',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Link',
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Link',
+		'options': u'Item',
+		'permlevel': 0,
+		'trigger': u'Client'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_name',
+		'fieldtype': u'Data',
+		'label': u'Item Name',
+		'oldfieldname': u'item_name',
+		'oldfieldtype': u'Data',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'serial_no',
+		'fieldtype': u'Small Text',
+		'label': u'Serial No',
+		'oldfieldname': u'serial_no',
+		'oldfieldtype': u'Small Text',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_docname',
+		'fieldtype': u'Data',
+		'hidden': 0,
+		'label': u'Against Document No',
+		'no_copy': 1,
+		'oldfieldname': u'prevdoc_docname',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'width': u'160px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_detail_docname',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'Against Document Detail No',
+		'no_copy': 1,
+		'oldfieldname': u'prevdoc_detail_docname',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'width': u'160px'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'prevdoc_doctype',
+		'fieldtype': u'Data',
+		'hidden': 0,
+		'label': u'Document Type',
+		'no_copy': 1,
+		'oldfieldname': u'prevdoc_doctype',
+		'oldfieldtype': u'Data',
+		'permlevel': 1,
+		'print_hide': 1,
+		'report_hide': 1,
+		'width': u'150px'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/support/doctype/support_ticket/__init__.py b/erpnext/support/doctype/support_ticket/__init__.py
index eebb6cf..d745808 100644
--- a/erpnext/support/doctype/support_ticket/__init__.py
+++ b/erpnext/support/doctype/support_ticket/__init__.py
@@ -86,9 +86,8 @@
 				self.save_attachments(st.doc, mail.attachments)
 				return
 				
-		opts = webnotes.conn.sql("""\
-			SELECT options FROM tabDocField
-			WHERE parent='Support Ticket' AND fieldname='naming_series'""")
+		from webnotes.model.doctype import get_property
+		opts = get_property('Support Ticket', 'options', 'naming_series')
 		# new ticket
 		from webnotes.model.doc import Document
 		d = Document('Support Ticket')
@@ -97,7 +96,7 @@
 		d.raised_by = mail.mail['From']
 		d.content_type = content_type
 		d.status = 'Open'
-		d.naming_series = (opts and opts[0] and opts[0][0] and opts[0][0].split("\n")[0]) or 'SUP'
+		d.naming_series = opts and opts.split("\n")[0] or 'SUP'
 		try:
 			d.save(1)
 		except:
diff --git a/erpnext/support/doctype/support_ticket/listview.js b/erpnext/support/doctype/support_ticket/listview.js
new file mode 100644
index 0000000..944c08f
--- /dev/null
+++ b/erpnext/support/doctype/support_ticket/listview.js
@@ -0,0 +1,54 @@
+// render
+wn.doclistviews['Support Ticket'] = wn.views.ListView.extend({
+	me: this,
+
+	init: function(d) {
+		this._super(d)
+		this.fields = this.fields.concat([
+			"`tabSupport Ticket`.status", 
+			"`tabSupport Ticket`.subject",
+			"`tabSupport Ticket`.description"
+		]);
+		this.stats = this.stats.concat(['status']);
+		this.show_hide_check_column();
+	},
+	
+	prepare_data: function(data) {
+		this._super(data);
+		if(data.status=='Open' || data.status=='To Reply') {
+			data.label_type = 'important'
+		}
+		else if(data.status=='Closed') {
+			data.label_type = 'success'
+		}
+		else if(data.status=='Hold') {
+			data.label_type = 'info'
+		}
+		else if(data.status=='Waiting for Customer') {
+			data.label_type = 'info'
+			data.status = 'Waiting'
+		}
+		data.status_html = repl('<span class="label label-%(label_type)s">%(status)s</span>', data);
+		var a = $(data.status_html).click(function() {
+			me.set_filter('status', $(this).text());
+		});
+		
+		// replace double quote with blank string
+		data.description = cstr(data.subject).replace(/"/gi, '')
+			+ " | " + cstr(data.description).replace(/"/gi, '');
+		
+		// description
+		if(data.description && data.description.length > 50) {
+			data.description = '<span title="'+data.description+'">' + data.description.substr(0,50) + '...</span>';
+		}
+	},
+	
+	columns: [
+		{width: '3%', content:'check'},
+		{width: '20%', content:'name'},
+		{width: '10%', content:'status_html'},		
+		{width: '53%', content:'tags+description', css: {color:'#aaa'}},
+		{width: '14%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
+	]
+
+});
diff --git a/erpnext/support/doctype/support_ticket/support_ticket.js b/erpnext/support/doctype/support_ticket/support_ticket.js
index 86264a6..2b1d50e 100644
--- a/erpnext/support/doctype/support_ticket/support_ticket.js
+++ b/erpnext/support/doctype/support_ticket/support_ticket.js
@@ -70,10 +70,10 @@
 	// make thread listing
 	//
 	make_listing: function(doc) {
-		cur_frm.fields_dict['Thread HTML'].wrapper.innerHTML = '';
+		cur_frm.fields_dict['thread_html'].wrapper.innerHTML = '';
 		
 		// render first message
-		new EmailMessage(cur_frm.fields_dict['Thread HTML'].wrapper, {
+		new EmailMessage($a(cur_frm.fields_dict['thread_html'].wrapper, 'div'), {
 			from_email: doc.raised_by,
 			creation: doc.creation,
 			mail: doc.description,
@@ -81,8 +81,8 @@
 		}, null, -1)
 		
 		// render thread		
-		cs.thread_list = new wn.widgets.Listing({
-			parent: cur_frm.fields_dict['Thread HTML'].wrapper,
+		cs.thread_list = new wn.ui.Listing({
+			parent: $a(cur_frm.fields_dict['thread_html'].wrapper, 'div'),
 			no_result_message: 'No responses yet',
 			get_query: function() {
 				return 'select mail, from_email, creation, content_type '+
@@ -97,7 +97,7 @@
 
 	},
 	
-	Send: function(doc, dt, dn) {
+	send: function(doc, dt, dn) {
 		$c_obj([doc], 'send_response', '', function(r,rt) {
 			locals[dt][dn].new_response = '';
 			if(!(r.exc || r.server_messages)) {
@@ -188,7 +188,7 @@
 		);
 		
 		// show only first and last message
-		if(idx==-1 || list && list.values.length-1==idx) {
+		if(idx==-1 || list && list.data.length-1==idx) {
 			$ds(this.message)
 		}
 		
diff --git a/erpnext/support/doctype/support_ticket/support_ticket.txt b/erpnext/support/doctype/support_ticket/support_ticket.txt
index bcdda14..67e60c2 100644
--- a/erpnext/support/doctype/support_ticket/support_ticket.txt
+++ b/erpnext/support/doctype/support_ticket/support_ticket.txt
@@ -3,50 +3,49 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-05-23 12:37:01',
+		'creation': '2012-03-27 14:36:43',
 		'docstatus': 0,
-		'modified': '2012-01-05 16:29:45',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:43',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1311584009',
+		'_last_update': u'1311584009',
 		'allow_attach': 1,
 		'allow_trash': 1,
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
-		'module': 'Support',
+		'module': u'Support',
 		'name': '__common__',
-		'search_fields': 'status,customer,allocated_to,subject,raised_by',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
+		'search_fields': u'status,customer,allocated_to,subject,raised_by',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'subject': '%(subject)s',
-		'tag_fields': 'status,allocated_to',
+		'subject': u'%(subject)s',
+		'tag_fields': u'status,allocated_to',
 		'version': 153
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Support Ticket',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Support Ticket',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
 		'amend': 0,
-		'cancel': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Support Ticket',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Support Ticket',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1,
 		'submit': 0
 	},
@@ -54,67 +53,72 @@
 	# DocType, Support Ticket
 	{
 		'doctype': 'DocType',
-		'name': 'Support Ticket'
+		'name': u'Support Ticket'
 	},
 
 	# DocPerm
 	{
+		'cancel': 0,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Guest',
+		'role': u'Guest',
 		'write': 1
 	},
 
 	# DocPerm
 	{
+		'cancel': 0,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Customer',
+		'role': u'Customer',
 		'write': 1
 	},
 
 	# DocPerm
 	{
+		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Support Team',
+		'role': u'Support Team',
 		'write': 1
 	},
 
 	# DocPerm
 	{
+		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Support Team',
+		'role': u'Support Team',
 		'write': 1
 	},
 
 	# DocPerm
 	{
+		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 2,
-		'role': 'Support Team',
+		'role': u'Support Team',
 		'write': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'Open',
-		'doctype': 'DocField',
-		'fieldname': 'status',
-		'fieldtype': 'Select',
+		'colour': u'White:FFF',
+		'default': u'Open',
+		'doctype': u'DocField',
+		'fieldname': u'status',
+		'fieldtype': u'Select',
 		'in_filter': 0,
-		'label': 'Status',
+		'label': u'Status',
 		'no_copy': 1,
-		'oldfieldname': 'status',
-		'oldfieldtype': 'Select',
-		'options': '\nOpen\nTo Reply\nWaiting for Customer\nHold\nClosed',
+		'oldfieldname': u'status',
+		'oldfieldtype': u'Select',
+		'options': u'\nOpen\nTo Reply\nWaiting for Customer\nHold\nClosed',
 		'permlevel': 1,
 		'reqd': 0,
 		'search_index': 1
@@ -122,116 +126,120 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'subject',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'subject',
+		'fieldtype': u'Text',
 		'in_filter': 1,
-		'label': 'Subject',
+		'label': u'Subject',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:doc.__islocal',
-		'doctype': 'DocField',
-		'fieldname': 'raised_by',
-		'fieldtype': 'Data',
+		'depends_on': u'eval:doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'raised_by',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Raised By (Email)',
-		'oldfieldname': 'raised_by',
-		'oldfieldtype': 'Data',
+		'label': u'Raised By (Email)',
+		'oldfieldname': u'raised_by',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:doc.__islocal',
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Text',
-		'label': 'Description',
-		'oldfieldname': 'problem_description',
-		'oldfieldtype': 'Text',
+		'depends_on': u'eval:doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Text',
+		'label': u'Description',
+		'oldfieldname': u'problem_description',
+		'oldfieldtype': u'Text',
 		'permlevel': 0,
 		'reqd': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'label': 'Thread HTML',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'thread_html',
+		'fieldtype': u'HTML',
+		'label': u'Thread HTML',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldname': 'new_response',
-		'fieldtype': 'Text',
-		'label': 'New Response',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'new_response',
+		'fieldtype': u'Text',
+		'label': u'New Response',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Send',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'send',
+		'fieldtype': u'Button',
+		'label': u'Send',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Additional Info',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'additional_info',
+		'fieldtype': u'Section Break',
+		'label': u'Additional Info',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 1,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'customer',
-		'fieldtype': 'Link',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'customer',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Customer',
-		'oldfieldname': 'customer',
-		'oldfieldtype': 'Link',
-		'options': 'Customer',
+		'label': u'Customer',
+		'oldfieldname': u'customer',
+		'oldfieldtype': u'Link',
+		'options': u'Customer',
 		'permlevel': 1,
 		'print_hide': 1,
 		'reqd': 0,
 		'search_index': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'customer_name',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'customer_name',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Customer Name',
-		'oldfieldname': 'customer_name',
-		'oldfieldtype': 'Data',
+		'label': u'Customer Name',
+		'oldfieldname': u'customer_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 2,
 		'reqd': 0,
 		'search_index': 0
@@ -239,151 +247,152 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'address_display',
-		'fieldtype': 'Small Text',
-		'label': 'Address',
+		'doctype': u'DocField',
+		'fieldname': u'address_display',
+		'fieldtype': u'Small Text',
+		'label': u'Address',
 		'permlevel': 2
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'contact_display',
-		'fieldtype': 'Data',
-		'label': 'Contact Name',
+		'doctype': u'DocField',
+		'fieldname': u'contact_display',
+		'fieldtype': u'Data',
+		'label': u'Contact Name',
 		'permlevel': 2
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'contact_mobile',
-		'fieldtype': 'Data',
-		'label': 'Mobile No',
+		'doctype': u'DocField',
+		'fieldname': u'contact_mobile',
+		'fieldtype': u'Data',
+		'label': u'Mobile No',
 		'permlevel': 2
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'contact_email',
-		'fieldtype': 'Data',
-		'label': 'Contact Email',
-		'oldfieldname': 'contact_no',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'contact_email',
+		'fieldtype': u'Data',
+		'label': u'Contact Email',
+		'oldfieldname': u'contact_no',
+		'oldfieldtype': u'Data',
 		'permlevel': 2
 	},
 
 	# DocField
 	{
-		'default': 'Today',
-		'doctype': 'DocField',
-		'fieldname': 'opening_date',
-		'fieldtype': 'Date',
-		'label': 'Opening Date',
+		'default': u'Today',
+		'doctype': u'DocField',
+		'fieldname': u'opening_date',
+		'fieldtype': u'Date',
+		'label': u'Opening Date',
 		'no_copy': 1,
-		'oldfieldname': 'opening_date',
-		'oldfieldtype': 'Date',
+		'oldfieldname': u'opening_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'opening_time',
-		'fieldtype': 'Time',
-		'label': 'Opening Time',
+		'doctype': u'DocField',
+		'fieldname': u'opening_time',
+		'fieldtype': u'Time',
+		'label': u'Opening Time',
 		'no_copy': 1,
-		'oldfieldname': 'opening_time',
-		'oldfieldtype': 'Time',
+		'oldfieldname': u'opening_time',
+		'oldfieldtype': u'Time',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldname': 'allocated_to',
-		'fieldtype': 'Link',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'allocated_to',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Allocated To',
-		'oldfieldname': 'allocated_to',
-		'oldfieldtype': 'Link',
-		'options': 'Profile',
+		'label': u'Allocated To',
+		'oldfieldname': u'allocated_to',
+		'oldfieldtype': u'Link',
+		'options': u'Profile',
 		'permlevel': 1,
 		'search_index': 1
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldname': 'resolution_details',
-		'fieldtype': 'Text',
-		'label': 'Resolution Details',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'resolution_details',
+		'fieldtype': u'Text',
+		'label': u'Resolution Details',
 		'no_copy': 1,
-		'oldfieldname': 'resolution_details',
-		'oldfieldtype': 'Text',
+		'oldfieldname': u'resolution_details',
+		'oldfieldtype': u'Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldname': 'resolution_date',
-		'fieldtype': 'Date',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'resolution_date',
+		'fieldtype': u'Date',
 		'in_filter': 0,
-		'label': 'Resolution Date',
+		'label': u'Resolution Date',
 		'no_copy': 1,
-		'oldfieldname': 'resolution_date',
-		'oldfieldtype': 'Date',
+		'oldfieldname': u'resolution_date',
+		'oldfieldtype': u'Date',
 		'permlevel': 1,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'depends_on': 'eval:!doc.__islocal',
-		'doctype': 'DocField',
-		'fieldname': 'resolution_time',
-		'fieldtype': 'Time',
-		'label': 'Resolution Time',
-		'oldfieldname': 'resolution_time',
-		'oldfieldtype': 'Time',
+		'depends_on': u'eval:!doc.__islocal',
+		'doctype': u'DocField',
+		'fieldname': u'resolution_time',
+		'fieldtype': u'Time',
+		'label': u'Resolution Time',
+		'oldfieldname': u'resolution_time',
+		'oldfieldtype': u'Time',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'content_type',
-		'fieldtype': 'Data',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'content_type',
+		'fieldtype': u'Data',
 		'hidden': 1,
-		'label': 'Content Type',
+		'label': u'Content Type',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'file_list',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'label': 'File List',
+		'label': u'File List',
 		'no_copy': 1,
 		'permlevel': 0,
 		'print_hide': 1
@@ -391,13 +400,13 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'naming_series',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'naming_series',
+		'fieldtype': u'Select',
 		'hidden': 1,
-		'label': 'Series',
+		'label': u'Series',
 		'no_copy': 1,
-		'options': 'SUP',
+		'options': u'SUP',
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 0,
diff --git a/erpnext/support/doctype/support_ticket_response/support_ticket_response.txt b/erpnext/support/doctype/support_ticket_response/support_ticket_response.txt
index 036601f..7209264 100644
--- a/erpnext/support/doctype/support_ticket_response/support_ticket_response.txt
+++ b/erpnext/support/doctype/support_ticket_response/support_ticket_response.txt
@@ -3,65 +3,62 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-05-23 14:50:48',
+		'creation': '2012-03-27 14:36:44',
 		'docstatus': 0,
-		'modified': '2011-05-24 10:17:30',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:44',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Support',
+		'module': u'Support',
 		'name': '__common__',
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
 		'version': 4
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Support Ticket Response',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Support Ticket Response',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# DocType, Support Ticket Response
 	{
 		'doctype': 'DocType',
-		'name': 'Support Ticket Response'
+		'name': u'Support Ticket Response'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'mail',
-		'fieldtype': 'Text',
-		'idx': 1,
-		'label': 'Mail'
+		'doctype': u'DocField',
+		'fieldname': u'mail',
+		'fieldtype': u'Text',
+		'label': u'Mail'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'from_email',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'From Email'
+		'doctype': u'DocField',
+		'fieldname': u'from_email',
+		'fieldtype': u'Data',
+		'label': u'From Email'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'content_type',
-		'fieldtype': 'Data',
-		'idx': 3,
-		'label': 'Content Type'
+		'doctype': u'DocField',
+		'fieldname': u'content_type',
+		'fieldtype': u'Data',
+		'label': u'Content Type'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/support/page/support_home/support_home.html b/erpnext/support/page/support_home/support_home.html
index 6c1f790..dcabe1c 100644
--- a/erpnext/support/page/support_home/support_home.html
+++ b/erpnext/support/page/support_home/support_home.html
@@ -1,15 +1,18 @@
 <div class="layout-wrapper layout-wrapper-background">
+	<div class="appframe-area"></div>
 	<div class="layout-main-section">
-		<a class="close" onclick="window.history.back();">&times;</a>
 		<h1>Support</h1>
 		<hr>
 		<div style="width: 48%; float: left;">
 			<h4><a href="#!List/Support Ticket">Support Ticket</a></h4>
 			<p class="help">Support queries from customers via email or website</p>
+			<br>
 			<h4><a href="#!List/Customer Issue">Customer Issue</a></h4>
 			<p class="help">Customer Issue against a Serial No (warranty)</p>
+			<br>
 			<h4><a href="#!List/Maintenance Schedule">Maintenance Schedule</a></h4>
 			<p class="help">Plan for scheduled maintenance contracts</p>
+			<br>
 			<h4><a href="#!List/Maintenance Visit">Maintenance Visit</a></h4>
 			<p class="help">Visit report for maintenance visit</p>
 		</div>
diff --git a/erpnext/support/page/support_home/support_home.js b/erpnext/support/page/support_home/support_home.js
index b9fd85e..3b95eb6 100644
--- a/erpnext/support/page/support_home/support_home.js
+++ b/erpnext/support/page/support_home/support_home.js
@@ -15,5 +15,6 @@
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 pscript['onload_support-home'] = function(wrapper) {
+	wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
 	erpnext.module_page.setup_page('Support', wrapper);
 }
\ No newline at end of file
diff --git a/erpnext/support/search_criteria/amc_summary/amc_summary.txt b/erpnext/support/search_criteria/amc_summary/amc_summary.txt
index 008efb4..e650095 100644
--- a/erpnext/support/search_criteria/amc_summary/amc_summary.txt
+++ b/erpnext/support/search_criteria/amc_summary/amc_summary.txt
@@ -3,33 +3,33 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:32',
+		'creation': '2012-04-03 12:49:50',
 		'docstatus': 0,
-		'modified': '2010-07-15 16:00:11',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:50',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_cond': "`tabSerial No`.`territory` is not null\n`tabSerial No`.`territory` != ''\n`tabSerial No`.`status` not in ('In Store', 'Scrapped')",
-		'columns': 'Serial No\x01Territory',
-		'criteria_name': 'AMC Summary',
-		'doc_type': 'Serial No',
+		'add_cond': u"`tabSerial No`.`territory` is not null\n`tabSerial No`.`territory` != ''\n`tabSerial No`.`status` not in ('In Store', 'Scrapped')",
+		'columns': u'Serial No\x01Territory',
+		'criteria_name': u'AMC Summary',
+		'doc_type': u'Serial No',
 		'doctype': 'Search Criteria',
-		'filters': "{'Serial No\x01Saved':1,'Serial No\x01Status':''}",
-		'group_by': '`tabSerial No`.`cost_center`',
-		'module': 'Support',
+		'filters': u"{'Serial No\x01Saved':1,'Serial No\x01Status':''}",
+		'group_by': u'`tabSerial No`.`cost_center`',
+		'module': u'Support',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabSerial No`.`cost_center`',
-		'sort_order': 'ASC',
-		'standard': 'Yes'
+		'sort_by': u'`tabSerial No`.`cost_center`',
+		'sort_order': u'ASC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, amc_summary
 	{
 		'doctype': 'Search Criteria',
-		'name': 'amc_summary'
+		'name': u'amc_summary'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/support/search_criteria/customer_issues/customer_issues.txt b/erpnext/support/search_criteria/customer_issues/customer_issues.txt
index 652d1fb..c313235 100644
--- a/erpnext/support/search_criteria/customer_issues/customer_issues.txt
+++ b/erpnext/support/search_criteria/customer_issues/customer_issues.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-09-01 15:48:09',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2010-08-30 13:21:32',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Customer Issue\x01ID,Customer Issue\x01Status,Customer Issue\x01Complaint Date,Customer Issue\x01Complaint,Customer Issue\x01Item Code,Customer Issue\x01Item Name,Customer Issue\x01Allocated To,Customer Issue\x01Allocated On,Customer Issue\x01Resolved By,Customer Issue\x01Resolution Date,Customer Issue\x01Customer Name,Customer Issue\x01Fiscal Year',
-		'criteria_name': 'Customer Issues',
-		'doc_type': 'Customer Issue',
+		'columns': u'Customer Issue\x01ID,Customer Issue\x01Status,Customer Issue\x01Complaint Date,Customer Issue\x01Complaint,Customer Issue\x01Item Code,Customer Issue\x01Item Name,Customer Issue\x01Allocated To,Customer Issue\x01Allocated On,Customer Issue\x01Resolved By,Customer Issue\x01Resolution Date,Customer Issue\x01Customer Name,Customer Issue\x01Fiscal Year',
+		'criteria_name': u'Customer Issues',
+		'doc_type': u'Customer Issue',
 		'doctype': 'Search Criteria',
-		'filters': "{'Customer Issue\x01Saved':1,'Customer Issue\x01Submitted':1,'Customer Issue\x01Status':'','Customer Issue\x01Fiscal Year':''}",
-		'module': 'Support',
+		'filters': u"{'Customer Issue\x01Saved':1,'Customer Issue\x01Submitted':1,'Customer Issue\x01Status':'','Customer Issue\x01Fiscal Year':''}",
+		'module': u'Support',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabCustomer Issue`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabCustomer Issue`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, customer_issues
 	{
 		'doctype': 'Search Criteria',
-		'name': 'customer_issues'
+		'name': u'customer_issues'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/support/search_criteria/maintenance_orderwise_pending_amount_to_bill/maintenance_orderwise_pending_amount_to_bill.txt b/erpnext/support/search_criteria/maintenance_orderwise_pending_amount_to_bill/maintenance_orderwise_pending_amount_to_bill.txt
index d0c3578..2e6e11d 100644
--- a/erpnext/support/search_criteria/maintenance_orderwise_pending_amount_to_bill/maintenance_orderwise_pending_amount_to_bill.txt
+++ b/erpnext/support/search_criteria/maintenance_orderwise_pending_amount_to_bill/maintenance_orderwise_pending_amount_to_bill.txt
@@ -3,34 +3,34 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-09-01 15:48:09',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2010-08-30 13:40:44',
-		'modified_by': 'Administrator',
-		'owner': 'ashwini@webnotestech.com'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'ashwini@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'add_col': "SUM((`tabSales Order Detail`.`qty` - `tabSales Order Detail`.`billed_qty`) * `tabSales Order Detail`.`basic_rate`) AS 'Pending Amount'",
-		'add_cond': "`tabSales Order`.status != 'Stopped'\n`tabSales Order`.order_type='Maintenance'",
-		'columns': 'Sales Order\x01ID,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order\x01Customer Address,Sales Order\x01Status,Sales Order\x01% Billed,Sales Order\x01Sales Order Date',
-		'criteria_name': 'Maintenance Orderwise Pending Amount To Bill',
-		'doc_type': 'Sales Order Detail',
+		'add_col': u"SUM((`tabSales Order Item`.`qty` - `tabSales Order Item`.`billed_qty`) * `tabSales Order Item`.`basic_rate`) AS 'Pending Amount'",
+		'add_cond': u"`tabSales Order`.status != 'Stopped'\n`tabSales Order`.order_type='Maintenance'",
+		'columns': u'Sales Order\x01ID,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order\x01Customer Address,Sales Order\x01Status,Sales Order\x01% Billed,Sales Order\x01Sales Order Date',
+		'criteria_name': u'Maintenance Orderwise Pending Amount To Bill',
+		'doc_type': u'Sales Order Item',
 		'doctype': 'Search Criteria',
-		'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
-		'module': 'Support',
+		'filters': u"{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
+		'module': u'Support',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Sales Order',
-		'sort_by': '`tabSales Order`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Sales Order',
+		'sort_by': u'`tabSales Order`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, maintenance_orderwise_pending_amount_to_bill
 	{
 		'doctype': 'Search Criteria',
-		'name': 'maintenance_orderwise_pending_amount_to_bill'
+		'name': u'maintenance_orderwise_pending_amount_to_bill'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/support/search_criteria/maintenance_schedule_details/maintenance_schedule_details.txt b/erpnext/support/search_criteria/maintenance_schedule_details/maintenance_schedule_details.txt
index b1ae15f..a81b187 100644
--- a/erpnext/support/search_criteria/maintenance_schedule_details/maintenance_schedule_details.txt
+++ b/erpnext/support/search_criteria/maintenance_schedule_details/maintenance_schedule_details.txt
@@ -3,32 +3,32 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-09-01 15:48:09',
+		'creation': '2012-04-03 12:49:51',
 		'docstatus': 0,
-		'modified': '2010-08-30 13:18:23',
-		'modified_by': 'Administrator',
-		'owner': 'nabin@webnotestech.com'
+		'modified': '2012-04-03 12:49:51',
+		'modified_by': u'Administrator',
+		'owner': u'nabin@webnotestech.com'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Maintenance Schedule Detail\x01Item Code,Maintenance Schedule Detail\x01Item Name,Maintenance Schedule Detail\x01Serial No,Maintenance Schedule Detail\x01Incharge Name,Maintenance Schedule Detail\x01Scheduled Date,Maintenance Schedule\x01Customer Name,Maintenance Schedule\x01Address,Maintenance Schedule\x01Sales Order No',
-		'criteria_name': 'Maintenance Schedule Details',
-		'doc_type': 'Maintenance Schedule Detail',
+		'columns': u'Maintenance Schedule Detail\x01Item Code,Maintenance Schedule Detail\x01Item Name,Maintenance Schedule Detail\x01Serial No,Maintenance Schedule Detail\x01Incharge Name,Maintenance Schedule Detail\x01Scheduled Date,Maintenance Schedule\x01Customer Name,Maintenance Schedule\x01Address,Maintenance Schedule\x01Sales Order No',
+		'criteria_name': u'Maintenance Schedule Details',
+		'doc_type': u'Maintenance Schedule Detail',
 		'doctype': 'Search Criteria',
-		'filters': "{'Maintenance Schedule\x01Submitted':1,'Maintenance Schedule\x01Status':''}",
-		'module': 'Support',
+		'filters': u"{'Maintenance Schedule\x01Submitted':1,'Maintenance Schedule\x01Status':''}",
+		'module': u'Support',
 		'name': '__common__',
 		'page_len': 50,
-		'parent_doc_type': 'Maintenance Schedule',
-		'sort_by': '`tabMaintenance Schedule Detail`.`item_code`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'parent_doc_type': u'Maintenance Schedule',
+		'sort_by': u'`tabMaintenance Schedule Detail`.`item_code`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, maintenance_schedule_details
 	{
 		'doctype': 'Search Criteria',
-		'name': 'maintenance_schedule_details'
+		'name': u'maintenance_schedule_details'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/support/search_criteria/warranty_amc_expiry_details/warranty_amc_expiry_details.txt b/erpnext/support/search_criteria/warranty_amc_expiry_details/warranty_amc_expiry_details.txt
index 89b5797..a80ee64 100644
--- a/erpnext/support/search_criteria/warranty_amc_expiry_details/warranty_amc_expiry_details.txt
+++ b/erpnext/support/search_criteria/warranty_amc_expiry_details/warranty_amc_expiry_details.txt
@@ -3,31 +3,31 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-09-01 15:48:09',
+		'creation': '2012-04-03 12:49:53',
 		'docstatus': 0,
-		'modified': '2010-08-30 13:32:21',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:53',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'columns': 'Serial No\x01ID,Serial No\x01Item Code,Serial No\x01Description,Serial No\x01Status,Serial No\x01Item Group,Serial No\x01Purchase Receipt No,Serial No\x01Delivery Note No,Serial No\x01Customer,Serial No\x01Customer Name,Serial No\x01AMC Expiry Date,Serial No\x01Warranty Expiry Date',
-		'criteria_name': 'Warranty/AMC Expiry Details',
-		'doc_type': 'Serial No',
+		'columns': u'Serial No\x01ID,Serial No\x01Item Code,Serial No\x01Description,Serial No\x01Status,Serial No\x01Item Group,Serial No\x01Purchase Receipt No,Serial No\x01Delivery Note No,Serial No\x01Customer,Serial No\x01Customer Name,Serial No\x01AMC Expiry Date,Serial No\x01Warranty Expiry Date',
+		'criteria_name': u'Warranty/AMC Expiry Details',
+		'doc_type': u'Serial No',
 		'doctype': 'Search Criteria',
-		'filters': "{'Serial No\x01Saved':1,'Serial No\x01Status':'','Serial No\x01Maintenance Status':''}",
-		'module': 'Support',
+		'filters': u"{'Serial No\x01Saved':1,'Serial No\x01Status':'','Serial No\x01Maintenance Status':''}",
+		'module': u'Support',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': '`tabSerial No`.`name`',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'`tabSerial No`.`name`',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, warranty-amc_expiry_details
 	{
 		'doctype': 'Search Criteria',
-		'name': 'warranty-amc_expiry_details'
+		'name': u'warranty-amc_expiry_details'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/support/search_criteria/warranty_amc_summary/warranty_amc_summary.txt b/erpnext/support/search_criteria/warranty_amc_summary/warranty_amc_summary.txt
index 02aa84c..cdc76d2 100644
--- a/erpnext/support/search_criteria/warranty_amc_summary/warranty_amc_summary.txt
+++ b/erpnext/support/search_criteria/warranty_amc_summary/warranty_amc_summary.txt
@@ -3,30 +3,30 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-10-12 15:19:31',
+		'creation': '2012-04-03 12:49:53',
 		'docstatus': 0,
-		'modified': '2010-09-25 12:14:49',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-03 12:49:53',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all Search Criteria
 	{
-		'criteria_name': 'Warranty/AMC Summary',
-		'doc_type': 'Serial No',
+		'criteria_name': u'Warranty/AMC Summary',
+		'doc_type': u'Serial No',
 		'doctype': 'Search Criteria',
-		'filters': "{'Serial No\x01Saved':1,'Serial No\x01Status':''}",
-		'module': 'Support',
+		'filters': u"{'Serial No\x01Saved':1,'Serial No\x01Status':''}",
+		'module': u'Support',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': 'name',
-		'sort_order': 'DESC',
-		'standard': 'Yes'
+		'sort_by': u'name',
+		'sort_order': u'DESC',
+		'standard': u'Yes'
 	},
 
 	# Search Criteria, warranty-amc_summary
 	{
 		'doctype': 'Search Criteria',
-		'name': 'warranty-amc_summary'
+		'name': u'warranty-amc_summary'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/utilities/Module Def/Utilities/Utilities.txt b/erpnext/utilities/Module Def/Utilities/Utilities.txt
deleted file mode 100644
index 98b4d0f..0000000
--- a/erpnext/utilities/Module Def/Utilities/Utilities.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# Module Def, Utilities
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-07-01 17:46:25',
-		'docstatus': 0,
-		'modified': '2011-07-01 17:47:34',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Module Def
-	{
-		'disabled': 'No',
-		'doctype': 'Module Def',
-		'is_hidden': 'No',
-		'module_label': 'Utilities',
-		'module_name': 'Utilities',
-		'name': '__common__'
-	},
-
-	# Module Def, Utilities
-	{
-		'doctype': 'Module Def',
-		'name': 'Utilities'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/activity_dashboard_control/__init__.py b/erpnext/utilities/doctype/activity_dashboard_control/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/utilities/doctype/activity_dashboard_control/__init__.py
+++ /dev/null
diff --git a/erpnext/utilities/doctype/activity_dashboard_control/activity_dashboard_control.py b/erpnext/utilities/doctype/activity_dashboard_control/activity_dashboard_control.py
deleted file mode 100644
index e3063e9..0000000
--- a/erpnext/utilities/doctype/activity_dashboard_control/activity_dashboard_control.py
+++ /dev/null
@@ -1,111 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-	
-# -----------------------------------------------------------------------------------------
-
-
-class DocType:
-    def __init__(self, doc, doclist=[]):
-        self.doc = doc
-        self.doclist = doclist
-    
-    
-    # get dashboard counts
-    # --------------------
-    def get_dashboard_counts(self, dt):
-        dtl = eval(dt)
-        dt = {}
-        
-        for d in dtl:
-            # if Lead
-            if d=='Lead':
-                dt[d] = {'To follow up':sql("select count(name) from tabLead where status!='Converted' and docstatus=1")[0][0] or 0}
-                
-            # if Enquiry
-            elif d=='Enquiries':
-                args = {}
-                args['Quotations to be sent'] = sql("select count(distinct(t2.name)) from `tabQuotation`t1, `tabEnquiry`t2 where t1.enq_no!=t2.name and t2.docstatus=1")[0][0] or 0
-                args['To follow up'] = sql("select count(name) from `tabQuotation` where docstatus=0")[0][0] or 0       #Draft
-                dt[d] = args
-                
-            # if Sales Order
-            elif d=='Sales Order':
-                args = {}
-                args['To be delivered'] = sql("select count(name) from `tabSales Order` where per_delivered<100 and delivery_date>now() and docstatus=1")[0][0] or 0
-                args['To be billed'] = sql("select count(name) from `tabSales Order` where per_billed<100 and docstatus=1")[0][0] or 0  
-                args['Overdue'] = sql("select count(name) from `tabSales Order` where per_delivered<100 and delivery_date<now() and docstatus=1")[0][0] or 0
-                args['To be submitted'] = sql("select count(name) from `tabSales Order` where status='Draft'")[0][0] or 0       #Draft
-                dt[d] = args
-            
-            # if Invoice
-            elif d=='Invoices':
-                args = {}
-                args['To receive payment'] = sql("select count(name) from `tabReceivable Voucher` where docstatus=1 and due_date>now() and outstanding_amount!=0")[0][0] or 0
-                args['Overdue'] = sql("select count(name) from `tabReceivable Voucher` where docstatus=1 and due_date<now() and outstanding_amount!=0")[0][0] or 0  
-                args['To be submitted'] = sql("select count(name) from `tabReceivable Voucher` where docstatus=0")[0][0] or 0       #Draft
-                dt[d] = args
-            
-            # if Indent 
-            elif d=='Indent':
-                args = {}
-                args['Purchase Order to be made'] = sql("select count(name) from `tabIndent` where per_ordered<100 and docstatus=1")[0][0] or 0
-                args['To be submitted'] = sql("select count(name) from `tabIndent` where status='Draft'")[0][0] or 0       #Draft
-                dt[d] = args
-                
-            # if Purchase Order    
-            elif d=='Purchase Order':
-                args = {}
-                args['To receive items'] = sql("select count(name) from `tabPurchase Order` where per_received<100 and docstatus=1")[0][0] or 0
-                args['To be billed'] = sql("select count(name) from `tabPurchase Order` where per_billed<100 and docstatus=1")[0][0] or 0
-                args['To be submitted'] = sql("select count(name) from `tabPurchase Order` where status='Draft'")[0][0] or 0        #Draft
-                dt[d] = args
-            
-            # if Bills
-            elif d=='Bills':
-                args = {}
-                args['To be payed'] = sql("select count(name) from `tabPayable Voucher` where docstatus=1 and outstanding_amount!=0")[0][0] or 0
-                args['To be submitted'] = sql("select count(name) from `tabPayable Voucher` where docstatus=0")[0][0] or 0       #Draft
-                dt[d] = args
-                
-            # if Tasks
-            elif d=='Tasks':
-                dt[d] = {'Open': sql("select count(name) from `tabTicket` where status='Open'")[0][0] or 0}
-                
-            # if Maintenance
-            elif d=='Serial No':
-              args = {}
-              args['AMC to expire this month'] = sql("select count(name) from `tabSerial No` where docstatus=1 and month(getdate()) = month(amc_expiry_date) and year(getdate()) = year(amc_expiry_date)")[0][0] or 0
-              args['Warranty to expire this month'] = ql("select count(name) from `tabSerial No` where docstatus=1 and month(getdate()) = month(warranty_expiry_date) and year(getdate())=year(warranty_expiry_date)")[0][0] or 0
-              dt[d] = args
-              
-        msgprint(dt)
-        return dt
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/activity_dashboard_control/activity_dashboard_control.txt b/erpnext/utilities/doctype/activity_dashboard_control/activity_dashboard_control.txt
deleted file mode 100644
index 58f489e..0000000
--- a/erpnext/utilities/doctype/activity_dashboard_control/activity_dashboard_control.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# DocType, Activity Dashboard Control
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:51',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'issingle': 1,
-		'module': 'Utilities',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'version': 42
-	},
-
-	# DocType, Activity Dashboard Control
-	{
-		'doctype': 'DocType',
-		'name': 'Activity Dashboard Control'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/address/address.js b/erpnext/utilities/doctype/address/address.js
index fc274ef..8949c5a 100644
--- a/erpnext/utilities/doctype/address/address.js
+++ b/erpnext/utilities/doctype/address/address.js
@@ -17,5 +17,28 @@
 cur_frm.cscript.onload = function(doc, cdt, cdn) {
 	if(doc.customer) cur_frm.add_fetch('customer', 'customer_name', 'customer_name');
 	if(doc.supplier) cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name');
+	
+	var route = wn.get_route();
+	if(route[1]=='Supplier') {
+		var supplier = locals.Supplier[route[2]]
+		doc.supplier = supplier.name;
+		doc.supplier_name = supplier.supplier_name;
+		doc.address_type = 'Office';
+	} else if(route[1]=='Customer') {
+		var customer = locals.Customer[route[2]]
+		doc.customer = customer.name;
+		doc.customer_name = customer.customer_name;
+		doc.address_type = 'Office';
+	} else if(route[1]=='Sales Partner') {
+		var sp = locals['Sales Partner'][route[2]];
+		doc.sales_partner = sp.name;
+		doc.address_type = 'Office';				
+	}
 }
 
+cur_frm.cscript.hide_dialog = function() {
+	if(cur_frm.address_list)
+		cur_frm.address_list.run();
+}
+
+
diff --git a/erpnext/utilities/doctype/address/address.txt b/erpnext/utilities/doctype/address/address.txt
index 776321b..56bbbe5 100644
--- a/erpnext/utilities/doctype/address/address.txt
+++ b/erpnext/utilities/doctype/address/address.txt
@@ -3,114 +3,115 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-05-24 14:57:59',
+		'creation': '2012-03-27 14:36:45',
 		'docstatus': 0,
-		'modified': '2011-11-23 13:21:00',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:45',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1319016431',
+		'_last_update': u'1319016431',
 		'allow_trash': 1,
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
-		'document_type': 'Master',
+		'document_type': u'Master',
 		'in_dialog': 1,
-		'module': 'Utilities',
+		'module': u'Utilities',
 		'name': '__common__',
-		'search_fields': 'customer, supplier, sales_partner, country, state',
-		'section_style': 'Simple',
+		'search_fields': u'customer, supplier, sales_partner, country, state',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
 		'version': 43
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Address',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Address',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Address',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Address',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
-		'role': 'All',
+		'role': u'All',
 		'write': 1
 	},
 
 	# DocType, Address
 	{
 		'doctype': 'DocType',
-		'name': 'Address'
+		'name': u'Address'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm'
+		'doctype': u'DocPerm'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Address Details',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'address_details',
+		'fieldtype': u'Section Break',
+		'label': u'Address Details',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': '<em>e.g. Office, Billing, Shipping</em>',
-		'doctype': 'DocField',
-		'fieldname': 'address_type',
-		'fieldtype': 'Data',
-		'label': 'Address Type',
+		'colour': u'White:FFF',
+		'description': u'<em>e.g. Office, Billing, Shipping</em>',
+		'doctype': u'DocField',
+		'fieldname': u'address_type',
+		'fieldtype': u'Data',
+		'label': u'Address Type',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'address_line1',
-		'fieldtype': 'Data',
-		'label': 'Address Line1',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'address_line1',
+		'fieldtype': u'Data',
+		'label': u'Address Line1',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'address_line2',
-		'fieldtype': 'Data',
-		'label': 'Address Line2',
+		'doctype': u'DocField',
+		'fieldname': u'address_line2',
+		'fieldtype': u'Data',
+		'label': u'Address Line2',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'city',
-		'fieldtype': 'Data',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'city',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'City/Town',
+		'label': u'City/Town',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1
@@ -118,172 +119,173 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'pincode',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'pincode',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Pincode',
+		'label': u'Pincode',
 		'permlevel': 0,
 		'search_index': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'country',
-		'fieldtype': 'Select',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'country',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Country',
-		'options': 'link:Country',
+		'label': u'Country',
+		'options': u'link:Country',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'state',
-		'fieldtype': 'Data',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'state',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'State',
-		'options': 'Suggest',
+		'label': u'State',
+		'options': u'Suggest',
 		'permlevel': 0,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
 		'permlevel': 0,
 		'print_hide': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'phone',
-		'fieldtype': 'Data',
-		'label': 'Phone',
+		'doctype': u'DocField',
+		'fieldname': u'phone',
+		'fieldtype': u'Data',
+		'label': u'Phone',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'email_id',
-		'fieldtype': 'Data',
-		'label': 'Email Id',
+		'doctype': u'DocField',
+		'fieldname': u'email_id',
+		'fieldtype': u'Data',
+		'label': u'Email Id',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fax',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'fax',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Fax',
+		'label': u'Fax',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:!doc.supplier && !doc.sales_partner',
-		'doctype': 'DocField',
-		'fieldname': 'customer',
-		'fieldtype': 'Link',
-		'label': 'Customer',
-		'options': 'Customer',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.supplier && !doc.sales_partner',
+		'doctype': u'DocField',
+		'fieldname': u'customer',
+		'fieldtype': u'Link',
+		'label': u'Customer',
+		'options': u'Customer',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:!doc.supplier && !doc.sales_partner',
-		'doctype': 'DocField',
-		'fieldname': 'customer_name',
-		'fieldtype': 'Data',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.supplier && !doc.sales_partner',
+		'doctype': u'DocField',
+		'fieldname': u'customer_name',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Customer Name',
+		'label': u'Customer Name',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:!doc.customer && !doc.sales_partner',
-		'doctype': 'DocField',
-		'fieldname': 'supplier',
-		'fieldtype': 'Link',
-		'label': 'Supplier',
-		'options': 'Supplier',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.customer && !doc.sales_partner',
+		'doctype': u'DocField',
+		'fieldname': u'supplier',
+		'fieldtype': u'Link',
+		'label': u'Supplier',
+		'options': u'Supplier',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:!doc.customer && !doc.sales_partner',
-		'doctype': 'DocField',
-		'fieldname': 'supplier_name',
-		'fieldtype': 'Data',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.customer && !doc.sales_partner',
+		'doctype': u'DocField',
+		'fieldname': u'supplier_name',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Supplier Name',
+		'label': u'Supplier Name',
 		'permlevel': 1,
 		'search_index': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:!doc.customer && !doc.supplier',
-		'doctype': 'DocField',
-		'fieldname': 'sales_partner',
-		'fieldtype': 'Link',
-		'label': 'Sales Partner',
-		'options': 'Sales Partner',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.customer && !doc.supplier',
+		'doctype': u'DocField',
+		'fieldname': u'sales_partner',
+		'fieldtype': u'Link',
+		'label': u'Sales Partner',
+		'options': u'Sales Partner',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': '0',
-		'description': 'Check to make primary address',
-		'doctype': 'DocField',
-		'fieldname': 'is_primary_address',
-		'fieldtype': 'Check',
-		'label': 'Is Primary Address',
+		'colour': u'White:FFF',
+		'default': u'0',
+		'description': u'Check to make primary address',
+		'doctype': u'DocField',
+		'fieldname': u'is_primary_address',
+		'fieldtype': u'Check',
+		'label': u'Is Primary Address',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': '0',
-		'description': 'Check to make Shipping Address',
-		'doctype': 'DocField',
-		'fieldname': 'is_shipping_address',
-		'fieldtype': 'Check',
-		'label': 'Is Shipping Address',
+		'colour': u'White:FFF',
+		'default': u'0',
+		'description': u'Check to make Shipping Address',
+		'doctype': u'DocField',
+		'fieldname': u'is_shipping_address',
+		'fieldtype': u'Check',
+		'label': u'Is Shipping Address',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'label': 'Trash Reason',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
 		'permlevel': 0
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/patch_util/__init__.py b/erpnext/utilities/doctype/answer/__init__.py
similarity index 100%
rename from erpnext/utilities/doctype/patch_util/__init__.py
rename to erpnext/utilities/doctype/answer/__init__.py
diff --git a/erpnext/utilities/doctype/answer/answer.txt b/erpnext/utilities/doctype/answer/answer.txt
new file mode 100644
index 0000000..75c3f33
--- /dev/null
+++ b/erpnext/utilities/doctype/answer/answer.txt
@@ -0,0 +1,102 @@
+# DocType, Answer
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:01',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:01',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'allow_attach': 0,
+		'allow_trash': 1,
+		'autoname': u'_ANS.#######',
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'in_create': 1,
+		'module': u'Utilities',
+		'name': '__common__',
+		'read_only': 1,
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 3
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Answer',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# These values are common for all DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Answer',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': u'All',
+		'write': 1
+	},
+
+	# DocType, Answer
+	{
+		'doctype': 'DocType',
+		'name': u'Answer'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'question',
+		'fieldtype': u'Link',
+		'label': u'Question',
+		'options': u'Question'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'answer',
+		'fieldtype': u'Text',
+		'label': u'Answer',
+		'oldfieldname': u'question',
+		'oldfieldtype': u'Text'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'points',
+		'fieldtype': u'Int',
+		'label': u'Points'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'_users_voted',
+		'fieldtype': u'Text',
+		'hidden': 1,
+		'label': u'Users Voted',
+		'print_hide': 1
+	}
+]
diff --git a/erpnext/utilities/doctype/bulk_rename_tool/bulk_rename_tool.txt b/erpnext/utilities/doctype/bulk_rename_tool/bulk_rename_tool.txt
index 0a5d877..d8f9c00 100644
--- a/erpnext/utilities/doctype/bulk_rename_tool/bulk_rename_tool.txt
+++ b/erpnext/utilities/doctype/bulk_rename_tool/bulk_rename_tool.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-07-07 17:47:52',
+		'creation': '2012-03-27 14:36:46',
 		'docstatus': 0,
-		'modified': '2012-03-21 14:56:46',
+		'modified': '2012-03-27 14:45:46',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -18,6 +18,7 @@
 		'colour': u'White:FFF',
 		'default_print_format': u'Standard',
 		'doctype': 'DocType',
+		'is_submittable': 1,
 		'module': u'Utilities',
 		'name': '__common__',
 		'section_style': u'Simple',
@@ -91,9 +92,35 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'rename',
 		'fieldtype': u'Button',
 		'label': u'Rename',
 		'options': u'do_rename',
 		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'depends_on': u'eval:doc.amended_from',
+		'description': u'The date at which current entry is corrected in the system.',
+		'doctype': u'DocField',
+		'fieldname': u'amendment_date',
+		'fieldtype': u'Date',
+		'label': u'Amendment Date',
+		'no_copy': 1,
+		'permlevel': 0,
+		'print_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'amended_from',
+		'fieldtype': u'Link',
+		'label': u'Amended From',
+		'no_copy': 1,
+		'options': u'Sales Invoice',
+		'permlevel': 1,
+		'print_hide': 1
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/contact/contact.js b/erpnext/utilities/doctype/contact/contact.js
index 2aa89c1..9244b79 100644
--- a/erpnext/utilities/doctype/contact/contact.js
+++ b/erpnext/utilities/doctype/contact/contact.js
@@ -18,54 +18,28 @@
 cur_frm.cscript.onload = function(doc, cdt, cdn) {
 	if(doc.customer) cur_frm.add_fetch('customer', 'customer_name', 'customer_name');
 	if(doc.supplier) cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name');
-}
 
-/*
-//---------- on refresh ----------------------
-cur_frm.cscript.refresh = function(doc,cdt,cdn){
-	
-}
-
-
-//------------- Trigger on customer ---------------------
-cur_frm.cscript.is_customer = function(doc,cdt,cdn){
-	if(!doc.is_customer){
-		doc.customer = doc.customer_name = doc.customer_address = doc.customer_group = '';
-		refresh_many(['customer','customer_name','customer_address','customer_group']);
+	var route = wn.get_route();
+	if(route[1]=='Supplier') {
+		var supplier = locals.Supplier[route[2]]
+		doc.supplier = supplier.name;
+		doc.supplier_name = supplier.supplier_name;
+	} else if(route[1]=='Customer') {
+		var customer = locals.Customer[route[2]];
+		doc.customer = customer.name;
+		doc.customer_name = customer.customer_name;
+		if(customer.customer_type == 'Individual') {
+			doc.first_name = customer.customer_name;
+		}		
+	} else if(route[1]=='Sales Partner') {
+		var sp = locals['Sales Partner'][route[2]];
+		doc.sales_partner = sp.name;
 	}
 }
 
-//------------- Trigger on supplier -----------------------
-cur_frm.cscript.is_supplier = function(doc,cdt,cdn){
-	if(!doc.is_supplier){
-		doc.supplier = doc.supplier_name = doc.supplier_address = doc.supplier_type = ''; 
-		refresh_many(['supplier','supplier_address','supplier_name','supplier_type']);
-	}
-}
-	
-//--------------- Trigger on sales partner ---------------------
-cur_frm.cscript.is_sales_partner = function(doc,cdt,cdn){
-	if(!doc.is_sales_partner){
-		doc.sales_partner = doc.sales_partner_address = doc.partner_type = '';
-		refresh_many(['sales_partner','sales_partner_address','partner_type']);
-	}
+cur_frm.cscript.hide_dialog = function() {
+	if(cur_frm.contact_list)
+		cur_frm.contact_list.run();
 }
 
-//----------- Trigger on supplier name ------------------------
-cur_frm.cscript.supplier = function(doc,cdt,cdn){
-	arg = {'dt':'Supplier','dn':doc.supplier,'nm':'supplier_name','fld':'supplier_address','type':'supplier_type'};
-	get_server_fields('get_address',docstring(arg),'',doc,cdt,cdn,1);
-}
 
-//------------ Trigger on customer name ------------------------
-cur_frm.cscript.customer = function(doc,cdt,cdn){
-	arg = {'dt':'Customer','dn':doc.customer,'nm':'customer_name','fld':'customer_address','type':'customer_group'};
-	get_server_fields('get_address',docstring(arg),'',doc,cdt,cdn,1);
-}
-
-//------------ Trigger on sales partner ------------------------
-cur_frm.cscript.sales_partner = function(doc,cdt,cdn){
-	arg = {'dt':'Sales Partner','dn':doc.sales_partner,'nm':'partner_name','fld':'sales_partner_address','type':'partner_type'};
-	get_server_fields('get_address',docstring(arg),'',doc,cdt,cdn,1);
-}
-*/
diff --git a/erpnext/utilities/doctype/contact/contact.txt b/erpnext/utilities/doctype/contact/contact.txt
index 9167ed4..f385bd6 100644
--- a/erpnext/utilities/doctype/contact/contact.txt
+++ b/erpnext/utilities/doctype/contact/contact.txt
@@ -3,69 +3,55 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:08:55',
+		'creation': '2012-03-27 14:36:46',
 		'docstatus': 0,
-		'modified': '2012-01-23 16:07:56',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:46',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1327314958',
+		'_last_update': u'1327314958',
 		'allow_trash': 1,
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
-		'document_type': 'Master',
+		'document_type': u'Master',
 		'in_create': 0,
 		'in_dialog': 1,
-		'module': 'Utilities',
+		'module': u'Utilities',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'subject': '%(first_name)s %(last_name)s - Email: %(email_id)s | Contact: %(phone)s | Mobile: %(mobile_no)s',
+		'subject': u'%(first_name)s %(last_name)s - Email: %(email_id)s | Contact: %(phone)s | Mobile: %(mobile_no)s',
 		'version': 245
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Contact',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Contact',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Contact',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Contact',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Contact
 	{
 		'doctype': 'DocType',
-		'name': 'Contact'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'Sales User'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'permlevel': 0,
-		'role': 'Purchase User'
+		'name': u'Contact'
 	},
 
 	# DocPerm
@@ -73,35 +59,35 @@
 		'amend': 0,
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Sales Master Manager',
+		'role': u'Sales Master Manager',
 		'submit': 0,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'All',
+		'role': u'All',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 2,
-		'role': 'All'
+		'role': u'All'
 	},
 
 	# DocPerm
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Purchase Master Manager',
+		'role': u'Purchase Master Manager',
 		'write': 1
 	},
 
@@ -109,208 +95,225 @@
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales User'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Purchase User'
+	},
+
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Contact Details',
-		'oldfieldtype': 'Section Break',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'contact_details',
+		'fieldtype': u'Section Break',
+		'label': u'Contact Details',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'first_name',
-		'fieldtype': 'Data',
-		'label': 'First Name',
-		'oldfieldname': 'first_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'first_name',
+		'fieldtype': u'Data',
+		'label': u'First Name',
+		'oldfieldname': u'first_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'last_name',
-		'fieldtype': 'Data',
-		'label': 'Last Name',
-		'oldfieldname': 'last_name',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'last_name',
+		'fieldtype': u'Data',
+		'label': u'Last Name',
+		'oldfieldname': u'last_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:!doc.supplier && !doc.sales_partner',
-		'doctype': 'DocField',
-		'fieldname': 'customer',
-		'fieldtype': 'Link',
-		'label': 'Customer',
-		'oldfieldname': 'customer',
-		'oldfieldtype': 'Link',
-		'options': 'Customer',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.supplier && !doc.sales_partner',
+		'doctype': u'DocField',
+		'fieldname': u'customer',
+		'fieldtype': u'Link',
+		'label': u'Customer',
+		'oldfieldname': u'customer',
+		'oldfieldtype': u'Link',
+		'options': u'Customer',
 		'permlevel': 0,
 		'print_hide': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:!doc.supplier && !doc.sales_partner',
-		'doctype': 'DocField',
-		'fieldname': 'customer_name',
-		'fieldtype': 'Data',
-		'label': 'Customer Name',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.supplier && !doc.sales_partner',
+		'doctype': u'DocField',
+		'fieldname': u'customer_name',
+		'fieldtype': u'Data',
+		'label': u'Customer Name',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:!doc.customer && !doc.sales_partner',
-		'doctype': 'DocField',
-		'fieldname': 'supplier',
-		'fieldtype': 'Link',
-		'label': 'Supplier',
-		'options': 'Supplier',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.customer && !doc.sales_partner',
+		'doctype': u'DocField',
+		'fieldname': u'supplier',
+		'fieldtype': u'Link',
+		'label': u'Supplier',
+		'options': u'Supplier',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
 		'allow_on_submit': 0,
-		'colour': 'White:FFF',
-		'depends_on': 'eval:!doc.customer && !doc.sales_partner',
-		'doctype': 'DocField',
-		'fieldname': 'supplier_name',
-		'fieldtype': 'Data',
-		'label': 'Supplier Name',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.customer && !doc.sales_partner',
+		'doctype': u'DocField',
+		'fieldname': u'supplier_name',
+		'fieldtype': u'Data',
+		'label': u'Supplier Name',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'depends_on': 'eval:!doc.customer && !doc.supplier',
-		'doctype': 'DocField',
-		'fieldname': 'sales_partner',
-		'fieldtype': 'Link',
-		'label': 'Sales Partner',
-		'options': 'Sales Partner',
+		'colour': u'White:FFF',
+		'depends_on': u'eval:!doc.customer && !doc.supplier',
+		'doctype': u'DocField',
+		'fieldname': u'sales_partner',
+		'fieldtype': u'Link',
+		'label': u'Sales Partner',
+		'options': u'Sales Partner',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': '0',
-		'depends_on': 'eval:(doc.customer || doc.supplier || doc.sales_partner)',
-		'doctype': 'DocField',
-		'fieldname': 'is_primary_contact',
-		'fieldtype': 'Check',
-		'label': 'Is Primary Contact',
-		'oldfieldname': 'is_primary_contact',
-		'oldfieldtype': 'Select',
+		'colour': u'White:FFF',
+		'default': u'0',
+		'depends_on': u'eval:(doc.customer || doc.supplier || doc.sales_partner)',
+		'doctype': u'DocField',
+		'fieldname': u'is_primary_contact',
+		'fieldtype': u'Check',
+		'label': u'Is Primary Contact',
+		'oldfieldname': u'is_primary_contact',
+		'oldfieldtype': u'Select',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'email_id',
-		'fieldtype': 'Data',
-		'label': 'Email Id',
-		'oldfieldname': 'email_id',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'email_id',
+		'fieldtype': u'Data',
+		'label': u'Email Id',
+		'oldfieldname': u'email_id',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'phone',
-		'fieldtype': 'Data',
-		'label': 'Phone',
-		'oldfieldname': 'contact_no',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'phone',
+		'fieldtype': u'Data',
+		'label': u'Phone',
+		'oldfieldname': u'contact_no',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'mobile_no',
-		'fieldtype': 'Data',
-		'label': 'Mobile No',
-		'oldfieldname': 'mobile_no',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'mobile_no',
+		'fieldtype': u'Data',
+		'label': u'Mobile No',
+		'oldfieldname': u'mobile_no',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Enter department to which this Contact belongs',
-		'doctype': 'DocField',
-		'fieldname': 'department',
-		'fieldtype': 'Data',
-		'label': 'Department',
-		'options': 'Suggest',
+		'colour': u'White:FFF',
+		'description': u'Enter department to which this Contact belongs',
+		'doctype': u'DocField',
+		'fieldname': u'department',
+		'fieldtype': u'Data',
+		'label': u'Department',
+		'options': u'Suggest',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Enter designation of this Contact',
-		'doctype': 'DocField',
-		'fieldname': 'designation',
-		'fieldtype': 'Data',
-		'label': 'Designation',
-		'options': 'Suggest',
+		'colour': u'White:FFF',
+		'description': u'Enter designation of this Contact',
+		'doctype': u'DocField',
+		'fieldname': u'designation',
+		'fieldtype': u'Data',
+		'label': u'Designation',
+		'options': u'Suggest',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/contact_detail/__init__.py b/erpnext/utilities/doctype/contact_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/utilities/doctype/contact_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/utilities/doctype/contact_detail/contact_detail.txt b/erpnext/utilities/doctype/contact_detail/contact_detail.txt
deleted file mode 100644
index 306491f..0000000
--- a/erpnext/utilities/doctype/contact_detail/contact_detail.txt
+++ /dev/null
@@ -1,98 +0,0 @@
-# DocType, Contact Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:08:56',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'CD/.#####',
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Utilities',
-		'name': '__common__',
-		'section_style': 'Tray',
-		'show_in_menu': 0,
-		'version': 5
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Contact Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, Contact Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Contact Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'contact_person',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'label': 'Contact Person',
-		'oldfieldname': 'contact_person',
-		'oldfieldtype': 'Data',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'contact_no',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Contact No',
-		'oldfieldname': 'contact_no',
-		'oldfieldtype': 'Data',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'department',
-		'fieldtype': 'Data',
-		'idx': 3,
-		'label': 'Department',
-		'oldfieldname': 'department',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'designation',
-		'fieldtype': 'Data',
-		'idx': 4,
-		'label': 'Designation',
-		'oldfieldname': 'designation',
-		'oldfieldtype': 'Data'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'email_id',
-		'fieldtype': 'Small Text',
-		'idx': 5,
-		'label': 'Email Id',
-		'oldfieldname': 'email_id',
-		'oldfieldtype': 'Small Text'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/gl_mapper/gl_mapper.txt b/erpnext/utilities/doctype/gl_mapper/gl_mapper.txt
index e1ce2a9..ef45427 100644
--- a/erpnext/utilities/doctype/gl_mapper/gl_mapper.txt
+++ b/erpnext/utilities/doctype/gl_mapper/gl_mapper.txt
@@ -3,44 +3,44 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:03',
+		'creation': '2012-03-27 14:36:46',
 		'docstatus': 0,
-		'modified': '2011-05-10 11:16:01',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:46',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1305006361',
-		'autoname': 'field:doc_type',
-		'colour': 'White:FFF',
+		'_last_update': u'1305006361',
+		'autoname': u'field:doc_type',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'module': 'Utilities',
+		'module': u'Utilities',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 3
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'GL Mapper',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'GL Mapper',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'GL Mapper',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'GL Mapper',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1
 	},
@@ -48,7 +48,7 @@
 	# DocType, GL Mapper
 	{
 		'doctype': 'DocType',
-		'name': 'GL Mapper'
+		'name': u'GL Mapper'
 	},
 
 	# DocPerm
@@ -56,43 +56,38 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'role': 'Accounts User',
+		'doctype': u'DocPerm',
+		'role': u'Accounts User',
 		'submit': 0,
 		'write': 0
 	},
 
 	# DocPerm
 	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'role': 'System Manager',
+		'doctype': u'DocPerm',
+		'role': u'System Manager',
 		'write': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'doc_type',
-		'fieldtype': 'Data',
-		'idx': 1,
-		'label': 'Doc Type',
-		'oldfieldname': 'doc_type',
-		'oldfieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'doc_type',
+		'fieldtype': u'Data',
+		'label': u'Doc Type',
+		'oldfieldname': u'doc_type',
+		'oldfieldtype': u'Link',
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'fields',
-		'fieldtype': 'Table',
-		'idx': 2,
-		'label': 'Fields',
-		'oldfieldname': 'fields',
-		'oldfieldtype': 'Table',
-		'options': 'GL Mapper Detail'
+		'doctype': u'DocField',
+		'fieldname': u'fields',
+		'fieldtype': u'Table',
+		'label': u'Fields',
+		'oldfieldname': u'fields',
+		'oldfieldtype': u'Table',
+		'options': u'GL Mapper Detail'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/gl_mapper_detail/gl_mapper_detail.txt b/erpnext/utilities/doctype/gl_mapper_detail/gl_mapper_detail.txt
index d35cc06..a62d2e7 100644
--- a/erpnext/utilities/doctype/gl_mapper_detail/gl_mapper_detail.txt
+++ b/erpnext/utilities/doctype/gl_mapper_detail/gl_mapper_detail.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:03',
+		'creation': '2012-03-27 14:36:46',
 		'docstatus': 0,
-		'modified': '2012-03-21 14:44:47',
+		'modified': '2012-03-27 14:36:46',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
diff --git a/erpnext/utilities/doctype/patch_util/patch_util.py b/erpnext/utilities/doctype/patch_util/patch_util.py
deleted file mode 100644
index 19a5232..0000000
--- a/erpnext/utilities/doctype/patch_util/patch_util.py
+++ /dev/null
@@ -1,118 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Please edit this list and import only required elements
-import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-
-# -----------------------------------------------------------------------------------------
-
-class DocType:
-	def __init__(self, d, dl):
-		self.doc, self.doclist = d, dl
-
-	def get_field_id(self, doctype, fieldname):
-		f = sql("select name, idx from tabDocField where parent=%s and fieldname=%s", (doctype, fieldname))
-		if not f:
-			f=sql("select name, idx from tabDocField where parent=%s and label=%s", (doctype, fieldname))
-		if not f:
-			return '__notfound__', 0
-			#msgprint("No field found for %s" % fieldname)
-			#raise Exception
-		return f[0]
-
-	def set_field_property(self, doctype, fieldname, property, value):
-		f = self.get_field_id(doctype, fieldname)
-		sql("update tabDocField set `%s`=%s where name=%s" % (property,'%s','%s'), (value, f[0]))
-	
-	def move_field(self, doctype, fieldname, before_field='', after_field=''):
-		f1 = self.get_field_id(doctype, fieldname)
-		
-		# get new id
-		new_idx = self.get_field_id(doctype, before_field or after_field)[1]
-		if after_field: 
-			new_idx = new_idx + 1
-				
-		# push fields down at new idx
-		sql("update tabDocField set idx=idx+1 where idx>=%s and parent=%s", (new_idx, doctype))
-
-		# push fields up at old idx
-		sql("update tabDocField set idx=idx-1 where idx>%s and parent=%s", (f1[1], doctype))
-		
-		# set field idx
-		sql("update tabDocField set idx=%s where name=%s", (new_idx, f1[0]))
-	
-	def delete_field(self, doctype, fieldname):
-		sql("delete from tabDocField where name=%s limit 1", self.get_field_id(doctype, fieldname)[0])
-
-	def delete_unnamed_field(self, doctype, after_field=''):
-		f1 = self.get_field_id(doctype, after_field)
-		
-		if f1[0]=='__notfound__':
-			return
-		
-		# check if truly un-named
-		f2 = sql("select name, fieldname, label from tabDocField where idx=%s and parent=%s limit 1", (f1[1]+1, doctype))
-		
-		if not f2:
-			return
-		f2 = f2[0]
-		
-		if f2[1] or f2[2]:
-			return
-		else:
-			sql("delete from tabDocField where name=%s limit 1", (f2[0]))
-
-			# move fields up
-			sql("update tabDocField set idx=idx-1 where idx>%s and parent=%s", (f1[1], doctype))
-		
-	def add_permission(self, doctype, role, level=0, read=0, write=0, create=0, submit=0, cancel=0, amend=0, match=''): 
-		# check if exists
-		pid = sql("select name from tabDocPerm where parent=%s and role=%s and permlevel=%s", (doctype, role, level))
-		if pid:
-			d = Document('DocPerm', pid[0][0])
-		else:
-			d = Document('DocPerm')
-			d.parent = doctype
-			d.parenttype = 'DocType'
-			d.parentfield = 'permissions'
-			
-		d.permlevel = level
-		d.role = role
-		d.read = read
-		d.write = write
-		d.create = create
-		d.submit = submit
-		d.cancel = cancel
-		d.amend = amend
-		d.match = match
-		
-		d.save(new = (not d.name and 1 or 0))
-
-	def delete_permission(self, doctype, role, level):
-		sql("delete from `tabDocPerm` where role = '%s' and parent = '%s' and permlevel = '%s'" % (role, doctype, level))
diff --git a/erpnext/utilities/doctype/patch_util/patch_util.txt b/erpnext/utilities/doctype/patch_util/patch_util.txt
deleted file mode 100644
index 3ed62b7..0000000
--- a/erpnext/utilities/doctype/patch_util/patch_util.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# DocType, Patch Util
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-10-27 14:33:29',
-		'docstatus': 0,
-		'modified': '2010-12-21 10:19:44',
-		'modified_by': 'sneha@webnotestech.com',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'issingle': 1,
-		'module': 'Utilities',
-		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
-		'version': 5
-	},
-
-	# DocType, Patch Util
-	{
-		'doctype': 'DocType',
-		'name': 'Patch Util'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/profile_control/profile_control.txt b/erpnext/utilities/doctype/profile_control/profile_control.txt
index caaa440..3e6affe 100644
--- a/erpnext/utilities/doctype/profile_control/profile_control.txt
+++ b/erpnext/utilities/doctype/profile_control/profile_control.txt
@@ -3,22 +3,22 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2009-05-29 12:19:21',
+		'creation': '2012-03-27 14:36:47',
 		'docstatus': 0,
-		'modified': '2010-11-03 11:03:11',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:47',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'issingle': 1,
-		'module': 'Utilities',
+		'module': u'Utilities',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 12
 	},
@@ -26,6 +26,6 @@
 	# DocType, Profile Control
 	{
 		'doctype': 'DocType',
-		'name': 'Profile Control'
+		'name': u'Profile Control'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/patch_util/__init__.py b/erpnext/utilities/doctype/question/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/patch_util/__init__.py
copy to erpnext/utilities/doctype/question/__init__.py
diff --git a/erpnext/knowledge_base/doctype/question/question.py b/erpnext/utilities/doctype/question/question.py
similarity index 100%
rename from erpnext/knowledge_base/doctype/question/question.py
rename to erpnext/utilities/doctype/question/question.py
diff --git a/erpnext/utilities/doctype/question/question.txt b/erpnext/utilities/doctype/question/question.txt
new file mode 100644
index 0000000..1173867
--- /dev/null
+++ b/erpnext/utilities/doctype/question/question.txt
@@ -0,0 +1,158 @@
+# DocType, Question
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:01',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:01',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'allow_attach': 0,
+		'allow_trash': 1,
+		'autoname': u'QUES.#######',
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'in_create': 1,
+		'module': u'Utilities',
+		'name': '__common__',
+		'read_only': 1,
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'show_in_menu': 0,
+		'version': 7
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'name': '__common__',
+		'parent': u'Question',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# These values are common for all DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'name': '__common__',
+		'parent': u'Question',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': u'All',
+		'write': 1
+	},
+
+	# DocType, Question
+	{
+		'doctype': 'DocType',
+		'name': u'Question'
+	},
+
+	# DocPerm
+	{
+		'doctype': u'DocPerm'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'question',
+		'fieldtype': u'Text',
+		'label': u'Question',
+		'oldfieldname': u'question',
+		'oldfieldtype': u'Text'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'points',
+		'fieldtype': u'Int',
+		'hidden': 1,
+		'label': u'Points'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'answer',
+		'fieldtype': u'Text Editor',
+		'label': u'Answer',
+		'oldfieldname': u'answer',
+		'oldfieldtype': u'Text Editor'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'_user_tags',
+		'fieldtype': u'Data',
+		'hidden': 1,
+		'label': u'User Tags'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'tag_1',
+		'fieldtype': u'Link',
+		'label': u'Tag 1',
+		'oldfieldname': u'tag_1',
+		'oldfieldtype': u'Link',
+		'options': u'Question Tag',
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'_users_voted',
+		'fieldtype': u'Text',
+		'label': u'Users Voted'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'tag_2',
+		'fieldtype': u'Link',
+		'label': u'Tag 2',
+		'oldfieldname': u'tag_2',
+		'oldfieldtype': u'Link',
+		'options': u'Question Tag',
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'tag_3',
+		'fieldtype': u'Link',
+		'label': u'Tag 3',
+		'oldfieldname': u'tag_3',
+		'oldfieldtype': u'Link',
+		'options': u'Question Tag',
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
+		'hidden': 1,
+		'label': u'File List',
+		'oldfieldname': u'file_list',
+		'oldfieldtype': u'Text'
+	}
+]
diff --git a/erpnext/knowledge_base/doctype/question_control/__init__.py b/erpnext/utilities/doctype/question_control/__init__.py
similarity index 100%
rename from erpnext/knowledge_base/doctype/question_control/__init__.py
rename to erpnext/utilities/doctype/question_control/__init__.py
diff --git a/erpnext/utilities/doctype/question_control/question_control.txt b/erpnext/utilities/doctype/question_control/question_control.txt
new file mode 100644
index 0000000..b037b67
--- /dev/null
+++ b/erpnext/utilities/doctype/question_control/question_control.txt
@@ -0,0 +1,30 @@
+# DocType, Question Control
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:02',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:02',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'issingle': 1,
+		'module': u'Utilities',
+		'name': '__common__',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
+		'version': 1
+	},
+
+	# DocType, Question Control
+	{
+		'doctype': 'DocType',
+		'name': u'Question Control'
+	}
+]
diff --git a/erpnext/utilities/doctype/receiver_detail/__init__.py b/erpnext/utilities/doctype/receiver_detail/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/utilities/doctype/receiver_detail/__init__.py
+++ /dev/null
diff --git a/erpnext/utilities/doctype/receiver_detail/receiver_detail.txt b/erpnext/utilities/doctype/receiver_detail/receiver_detail.txt
deleted file mode 100644
index 9e330ba..0000000
--- a/erpnext/utilities/doctype/receiver_detail/receiver_detail.txt
+++ /dev/null
@@ -1,72 +0,0 @@
-# DocType, Receiver Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-08-08 17:09:19',
-		'docstatus': 0,
-		'modified': '2010-09-20 14:06:57',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': 'Utilities',
-		'name': '__common__',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
-		'version': 2
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Data',
-		'name': '__common__',
-		'oldfieldtype': 'Data',
-		'parent': 'Receiver Detail',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, Receiver Detail
-	{
-		'doctype': 'DocType',
-		'name': 'Receiver Detail'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'customer_name',
-		'idx': 1,
-		'label': 'Customer Name',
-		'oldfieldname': 'customer_name'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'receiver_name',
-		'idx': 2,
-		'label': 'Receiver Name',
-		'oldfieldname': 'receiver_name',
-		'width': '350px'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'mobile_no',
-		'idx': 3,
-		'label': 'Mobile No',
-		'oldfieldname': 'mobile_no',
-		'reqd': 1,
-		'width': '200px'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/rename_tool/rename_tool.txt b/erpnext/utilities/doctype/rename_tool/rename_tool.txt
index 3b8a5dd..f84fbd5 100755
--- a/erpnext/utilities/doctype/rename_tool/rename_tool.txt
+++ b/erpnext/utilities/doctype/rename_tool/rename_tool.txt
@@ -3,100 +3,96 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-06-27 10:52:02',
+		'creation': '2012-03-27 14:36:47',
 		'docstatus': 0,
-		'modified': '2011-07-26 00:59:27',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:47',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1308739509',
+		'_last_update': u'1308739509',
 		'allow_email': 1,
 		'allow_print': 1,
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'hide_heading': 0,
 		'hide_toolbar': 0,
 		'issingle': 1,
-		'module': 'Utilities',
+		'module': u'Utilities',
 		'name': '__common__',
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
 		'version': 7
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Rename Tool',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Rename Tool',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Rename Tool',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Rename Tool',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
 	# DocType, Rename Tool
 	{
 		'doctype': 'DocType',
-		'name': 'Rename Tool'
+		'name': u'Rename Tool'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm'
+		'doctype': u'DocPerm'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'select_doctype',
-		'fieldtype': 'Select',
-		'idx': 1,
-		'label': 'Select DocType',
-		'options': '\nAccount\nCompany\nCustomer\nSupplier\nEmployee\nWarehouse\nItem'
+		'doctype': u'DocField',
+		'fieldname': u'select_doctype',
+		'fieldtype': u'Select',
+		'label': u'Select DocType',
+		'options': u'\nAccount\nCompany\nCustomer\nSupplier\nEmployee\nWarehouse\nItem'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'document_to_rename',
-		'fieldtype': 'Link',
-		'idx': 2,
-		'label': 'Document to rename'
+		'doctype': u'DocField',
+		'fieldname': u'document_to_rename',
+		'fieldtype': u'Link',
+		'label': u'Document to rename'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'new_name',
-		'fieldtype': 'Data',
-		'idx': 3,
-		'label': 'New Name'
+		'doctype': u'DocField',
+		'fieldname': u'new_name',
+		'fieldtype': u'Data',
+		'label': u'New Name'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 4,
-		'label': 'Rename',
-		'options': 'rename'
+		'doctype': u'DocField',
+		'fieldname': u'rename',
+		'fieldtype': u'Button',
+		'label': u'Rename',
+		'options': u'rename'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/reposting_tool/reposting_tool.js b/erpnext/utilities/doctype/reposting_tool/reposting_tool.js
index 006ef9a..d44a2cd 100644
--- a/erpnext/utilities/doctype/reposting_tool/reposting_tool.js
+++ b/erpnext/utilities/doctype/reposting_tool/reposting_tool.js
@@ -18,7 +18,7 @@
 var msg = [];
 var binidx = 0;
 
-cur_frm.cscript['Repost Bin'] = function(doc,cdt,cdn) {
+cur_frm.cscript.repost_bin = function(doc,cdt,cdn) {
   args = {'check': 'Bin'};
   $c_obj('Reposting Tool','get_count_for_reposting', docstring(args), function(r,rt) {
        bin_list = r.message;
@@ -50,7 +50,7 @@
 //======================================================
 var acc_list = [];
 var accidx = 0;
-cur_frm.cscript['Repost Account Balances'] = function(doc,cdt,cdn) {
+cur_frm.cscript.repost_account_balances = function(doc,cdt,cdn) {
   args = {'check': 'Account Balance'};
   $c_obj('Reposting Tool','get_count_for_reposting', docstring(args), function(r,rt) {
        acc_list = r.message;
diff --git a/erpnext/utilities/doctype/reposting_tool/reposting_tool.py b/erpnext/utilities/doctype/reposting_tool/reposting_tool.py
index 82df4e3..e75f27c 100644
--- a/erpnext/utilities/doctype/reposting_tool/reposting_tool.py
+++ b/erpnext/utilities/doctype/reposting_tool/reposting_tool.py
@@ -64,16 +64,16 @@
 		act_qty = act_qty and flt(act_qty[0][0]) or 0
 	
 		# get indented_qty 
-		ind_qty = sql("select sum(if( ifnull(t2.qty, 0) > ifnull(t2.ordered_qty, 0), ifnull(t2.qty, 0) - ifnull(t2.ordered_qty, 0), 0) ) from `tabIndent` t1, `tabIndent Detail`t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.warehouse = '%s' and t2.item_code = '%s' and status != 'Stopped'" % (wh, item))
+		ind_qty = sql("select sum(if( ifnull(t2.qty, 0) > ifnull(t2.ordered_qty, 0), ifnull(t2.qty, 0) - ifnull(t2.ordered_qty, 0), 0) ) from `tabPurchase Request` t1, `tabPurchase Request Item`t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.warehouse = '%s' and t2.item_code = '%s' and status != 'Stopped'" % (wh, item))
 		ind_qty = ind_qty and flt(ind_qty[0][0]) or 0
 		
 		# get ordered_qty
-		ord_qty = sql("select sum(if ( ifnull(t2.qty, 0) > ifnull(t2.received_qty, 0), (ifnull(t2.qty, 0) - ifnull(t2.received_qty, 0)) * ifnull(t2.conversion_factor, 0) , 0) ) from `tabPurchase Order` t1, `tabPO Detail` t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.warehouse = '%s' and t2.item_code = '%s' and status != 'Stopped'" % (wh, item))
+		ord_qty = sql("select sum(if ( ifnull(t2.qty, 0) > ifnull(t2.received_qty, 0), (ifnull(t2.qty, 0) - ifnull(t2.received_qty, 0)) * ifnull(t2.conversion_factor, 0) , 0) ) from `tabPurchase Order` t1, `tabPurchase Order Item` t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.warehouse = '%s' and t2.item_code = '%s' and status != 'Stopped'" % (wh, item))
 		ord_qty = ord_qty and flt(ord_qty[0][0]) or 0
 		
 
 		# get reserved_qty
-		res_qty =sql("select sum(if ( ifnull(t2.qty, 0) > ifnull(t2.delivered_qty, 0), ifnull(t2.qty, 0) - ifnull(t2.delivered_qty, 0) , 0) ) from `tabSales Order` t1, `tabSales Order Detail` t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.reserved_warehouse = '%s' and t2.item_code = '%s' and status != 'Stopped'" % (wh, item))
+		res_qty =sql("select sum(if ( ifnull(t2.qty, 0) > ifnull(t2.delivered_qty, 0), ifnull(t2.qty, 0) - ifnull(t2.delivered_qty, 0) , 0) ) from `tabSales Order` t1, `tabSales Order Item` t2 where t1.name = t2.parent and t1.docstatus = 1 and t2.reserved_warehouse = '%s' and t2.item_code = '%s' and status != 'Stopped'" % (wh, item))
 		res_qty = res_qty and flt(res_qty[0][0]) or 0
 
 		# get planned_qty 
@@ -84,7 +84,7 @@
 
 	# =============================================================================
 	def check_bin_qty(self, bin_obj, qty_dict):
-		label_dict = {'actual_qty': 'Actual Qty', 'indented_qty': 'Indent Qty', 'ordered_qty': 'Ordered Qty', 'reserved_qty': 'Reserved Qty', 'planned_qty': 'Planned Qty'}
+		label_dict = {'actual_qty': 'Actual Qty', 'indented_qty': 'Quantity Requested for Purchase', 'ordered_qty': 'Ordered Qty', 'reserved_qty': 'Reserved Qty', 'planned_qty': 'Planned Qty'}
 		for f in qty_dict:
 			if flt(bin_obj.doc.fields[f]) != qty_dict[f]:
 				msgprint('<div style="color: RED"> Difference found in %s for Item:= %s and Warehouse:= %s (Before : %s; After : %s)</div>' % (label_dict[f], bin_obj.doc.item_code, bin_obj.doc.warehouse, cstr(bin_obj.doc.fields[f]), cstr(qty_dict[f])))
diff --git a/erpnext/utilities/doctype/reposting_tool/reposting_tool.txt b/erpnext/utilities/doctype/reposting_tool/reposting_tool.txt
index ba165de..453902b 100644
--- a/erpnext/utilities/doctype/reposting_tool/reposting_tool.txt
+++ b/erpnext/utilities/doctype/reposting_tool/reposting_tool.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:19',
+		'creation': '2012-03-27 14:36:47',
 		'docstatus': 0,
-		'modified': '2012-03-21 14:56:21',
+		'modified': '2012-03-27 14:36:47',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -77,6 +77,7 @@
 	{
 		'colour': u'White:FFF',
 		'doctype': u'DocField',
+		'fieldname': u'repost_bin',
 		'fieldtype': u'Button',
 		'label': u'Repost Bin',
 		'trigger': u'Client'
@@ -85,6 +86,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'repost_account_balances',
 		'fieldtype': u'Button',
 		'label': u'Repost Account Balances',
 		'trigger': u'Client'
diff --git a/erpnext/utilities/doctype/sms_control/sms_control.js b/erpnext/utilities/doctype/sms_control/sms_control.js
index 42d961f..cd3db12 100644
--- a/erpnext/utilities/doctype/sms_control/sms_control.js
+++ b/erpnext/utilities/doctype/sms_control/sms_control.js
@@ -77,33 +77,33 @@
 	}
 }
 
-cur_frm.cscript['Send SMS'] = function(doc,dt,dn) {
+cur_frm.cscript.send_sms = function(doc,dt,dn) {
 	var doc = cur_frm.doc;
 	var sms_man = new SMSManager();
 	var default_msg = {
 		'Lead'				: '',
-		'Enquiry'			: 'Your enquiry has been logged into the system. Ref No: ' + doc.name,
+		'Opportunity'			: 'Your enquiry has been logged into the system. Ref No: ' + doc.name,
 		'Quotation'			: 'Quotation ' + doc.name + ' has been sent via email. Thanks!',
 		'Sales Order'		: 'Sales Order ' + doc.name + ' has been created against ' 
 					+ (doc.quotation_no ? ('Quote No:' + doc.quotation_no) : '')
 					+ (doc.po_no ? (' for your PO: ' + doc.po_no) : ''),
 		'Delivery Note'		: 'Items has been delivered against delivery note: ' + doc.name
 					+ (doc.po_no ? (' for your PO: ' + doc.po_no) : ''),		
-		'Receivable Voucher': 'Invoice ' + doc.name + ' has been sent via email '
+		'Sales Invoice': 'Invoice ' + doc.name + ' has been sent via email '
 					+ (doc.po_no ? (' for your PO: ' + doc.po_no) : ''),
-		'Indent'			: 'Indent ' + doc.name + ' has been raised in the system',
+		'Purchase Request'			: 'Purchase Request ' + doc.name + ' has been raised in the system',
 		'Purchase Order'	: 'Purchase Order ' + doc.name + ' has been sent via email',
 		'Purchase Receipt'	: 'Items has been received against purchase receipt: ' + doc.name
 	}
 
-	if (in_list(['Quotation', 'Sales Order', 'Delivery Note', 'Receivable Voucher'], doc.doctype))
+	if (in_list(['Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice'], doc.doctype))
 		sms_man.show(doc.contact_person, 'customer', doc.customer, '', default_msg[doc.doctype]);
 	else if (in_list(['Purchase Order', 'Purchase Receipt'], doc.doctype))
 		sms_man.show(doc.contact_person, 'supplier', doc.supplier, '', default_msg[doc.doctype]);
 	else if (doc.doctype == 'Lead')
 		sms_man.show('', '', '', doc.mobile_no, default_msg[doc.doctype]);
-	else if (doc.doctype == 'Enquiry')
+	else if (doc.doctype == 'Opportunity')
 		sms_man.show('', '', '', doc.contact_no, default_msg[doc.doctype]);
-	else if (doc.doctype == 'Indent')
+	else if (doc.doctype == 'Purchase Request')
 		sms_man.show('', '', '', '', default_msg[doc.doctype]);
 }
diff --git a/erpnext/utilities/doctype/sms_control/sms_control.py b/erpnext/utilities/doctype/sms_control/sms_control.py
index 9d11283..f19ccf1 100644
--- a/erpnext/utilities/doctype/sms_control/sms_control.py
+++ b/erpnext/utilities/doctype/sms_control/sms_control.py
@@ -79,7 +79,7 @@
 
 	def get_sender_name(self):
 		"returns name as SMS sender"
-		sender_name = webnotes.conn.get_value('Manage Account', None, 'sms_sender_name') or 'ERPNXT'
+		sender_name = webnotes.conn.get_value('Global Defaults', None, 'sms_sender_name') or 'ERPNXT'
 		if len(sender_name) > 6:
 			msgprint("""
 				As per TRAI rule, sender name must be exactly 6 characters.
diff --git a/erpnext/utilities/doctype/sms_control/sms_control.txt b/erpnext/utilities/doctype/sms_control/sms_control.txt
index 7f8d071..c69a34f 100644
--- a/erpnext/utilities/doctype/sms_control/sms_control.txt
+++ b/erpnext/utilities/doctype/sms_control/sms_control.txt
@@ -3,57 +3,55 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:24',
+		'creation': '2012-03-27 14:36:47',
 		'docstatus': 0,
-		'modified': '2011-01-11 18:40:35',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:47',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'in_create': 0,
 		'issingle': 1,
-		'module': 'Utilities',
+		'module': u'Utilities',
 		'name': '__common__',
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'version': 8
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'SMS Control',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'SMS Control',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1,
-		'role': 'System Manager'
+		'role': u'System Manager'
 	},
 
 	# DocType, SMS Control
 	{
 		'doctype': 'DocType',
-		'name': 'SMS Control'
+		'name': u'SMS Control'
 	},
 
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'doctype': u'DocPerm',
 		'permlevel': 0,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'idx': 2,
+		'doctype': u'DocPerm',
 		'permlevel': 1
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/sms_log/sms_log.txt b/erpnext/utilities/doctype/sms_log/sms_log.txt
index c2b7ba9..55acd7d 100644
--- a/erpnext/utilities/doctype/sms_log/sms_log.txt
+++ b/erpnext/utilities/doctype/sms_log/sms_log.txt
@@ -3,128 +3,121 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-01-11 13:00:09',
+		'creation': '2012-03-27 14:36:47',
 		'docstatus': 0,
-		'modified': '2011-01-11 12:51:46',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:47',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'autoname': 'SMSLOG/.########',
-		'colour': 'White:FFF',
+		'autoname': u'SMSLOG/.########',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'module': 'Utilities',
+		'module': u'Utilities',
 		'name': '__common__',
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
 		'version': 3
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'SMS Log',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'SMS Log',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
+		'create': 0,
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'SMS Log',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'SMS Log',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
-		'role': 'System Manager',
-		'write': 1
+		'role': u'System Manager',
+		'write': 0
 	},
 
 	# DocType, SMS Log
 	{
 		'doctype': 'DocType',
-		'name': 'SMS Log'
+		'name': u'SMS Log'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm'
+		'doctype': u'DocPerm'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 1,
-		'width': '50%'
+		'doctype': u'DocField',
+		'fieldname': u'column_break0',
+		'fieldtype': u'Column Break',
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'sender_name',
-		'fieldtype': 'Data',
-		'idx': 2,
-		'label': 'Sender Name'
+		'doctype': u'DocField',
+		'fieldname': u'sender_name',
+		'fieldtype': u'Data',
+		'label': u'Sender Name'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'sent_on',
-		'fieldtype': 'Date',
-		'idx': 3,
-		'label': 'Sent On'
+		'doctype': u'DocField',
+		'fieldname': u'sent_on',
+		'fieldtype': u'Date',
+		'label': u'Sent On'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'receiver_list',
-		'fieldtype': 'Small Text',
-		'idx': 4,
-		'label': 'Receiver List'
+		'doctype': u'DocField',
+		'fieldname': u'receiver_list',
+		'fieldtype': u'Small Text',
+		'label': u'Receiver List'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 5,
-		'width': '50%'
+		'doctype': u'DocField',
+		'fieldname': u'column_break1',
+		'fieldtype': u'Column Break',
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'no_of_requested_sms',
-		'fieldtype': 'Int',
-		'idx': 6,
-		'label': 'No of Requested SMS'
+		'doctype': u'DocField',
+		'fieldname': u'no_of_requested_sms',
+		'fieldtype': u'Int',
+		'label': u'No of Requested SMS'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'no_of_sent_sms',
-		'fieldtype': 'Int',
-		'idx': 7,
-		'label': 'No of Sent SMS'
+		'doctype': u'DocField',
+		'fieldname': u'no_of_sent_sms',
+		'fieldtype': u'Int',
+		'label': u'No of Sent SMS'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'message',
-		'fieldtype': 'Small Text',
-		'idx': 8,
-		'label': 'Message'
+		'doctype': u'DocField',
+		'fieldname': u'message',
+		'fieldtype': u'Small Text',
+		'label': u'Message'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/patch_util/__init__.py b/erpnext/utilities/doctype/sms_receiver/__init__.py
similarity index 100%
copy from erpnext/utilities/doctype/patch_util/__init__.py
copy to erpnext/utilities/doctype/sms_receiver/__init__.py
diff --git a/erpnext/utilities/doctype/sms_receiver/sms_receiver.txt b/erpnext/utilities/doctype/sms_receiver/sms_receiver.txt
new file mode 100644
index 0000000..a36b98a
--- /dev/null
+++ b/erpnext/utilities/doctype/sms_receiver/sms_receiver.txt
@@ -0,0 +1,69 @@
+# DocType, SMS Receiver
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-03-27 14:36:47',
+		'docstatus': 0,
+		'modified': '2012-03-27 14:36:47',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'colour': u'White:FFF',
+		'doctype': 'DocType',
+		'istable': 1,
+		'module': u'Utilities',
+		'name': '__common__',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
+		'version': 2
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': u'DocField',
+		'fieldtype': u'Data',
+		'name': '__common__',
+		'oldfieldtype': u'Data',
+		'parent': u'SMS Receiver',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
+		'permlevel': 0
+	},
+
+	# DocType, SMS Receiver
+	{
+		'doctype': 'DocType',
+		'name': u'SMS Receiver'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'customer_name',
+		'label': u'Customer Name',
+		'oldfieldname': u'customer_name'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'receiver_name',
+		'label': u'Receiver Name',
+		'oldfieldname': u'receiver_name',
+		'width': u'350px'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'mobile_no',
+		'label': u'Mobile No',
+		'oldfieldname': u'mobile_no',
+		'reqd': 1,
+		'width': u'200px'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/todo_item/__init__.py b/erpnext/utilities/doctype/todo_item/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/utilities/doctype/todo_item/__init__.py
+++ /dev/null
diff --git a/erpnext/utilities/doctype/todo_item/todo_item.txt b/erpnext/utilities/doctype/todo_item/todo_item.txt
deleted file mode 100644
index 86f5d0d..0000000
--- a/erpnext/utilities/doctype/todo_item/todo_item.txt
+++ /dev/null
@@ -1,213 +0,0 @@
-# DocType, ToDo Item
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2009-05-12 16:43:58',
-		'docstatus': 0,
-		'modified': '2012-02-17 15:48:54',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'allow_attach': 0,
-		'allow_copy': 0,
-		'allow_email': 0,
-		'allow_print': 0,
-		'allow_rename': 0,
-		'allow_trash': 0,
-		'autoname': u'TDI.########',
-		'colour': u'White:FFF',
-		'doctype': 'DocType',
-		'hide_heading': 0,
-		'hide_toolbar': 0,
-		'in_create': 1,
-		'in_dialog': 0,
-		'is_transaction_doc': 0,
-		'issingle': 0,
-		'max_attachments': 0,
-		'module': u'Utilities',
-		'name': '__common__',
-		'read_only': 1,
-		'read_only_onload': 0,
-		'section_style': u'Simple',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'use_template': 0,
-		'version': 5
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'ToDo Item',
-		'parentfield': u'fields',
-		'parenttype': u'DocType',
-		'permlevel': 0
-	},
-
-	# These values are common for all DocPerm
-	{
-		'create': 1,
-		'doctype': u'DocPerm',
-		'name': '__common__',
-		'parent': u'ToDo Item',
-		'parentfield': u'permissions',
-		'parenttype': u'DocType',
-		'permlevel': 0,
-		'read': 1,
-		'role': u'All',
-		'write': 1
-	},
-
-	# DocType, ToDo Item
-	{
-		'doctype': 'DocType',
-		'name': u'ToDo Item'
-	},
-
-	# DocPerm
-	{
-		'doctype': u'DocPerm'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 0,
-		'doctype': u'DocField',
-		'fieldname': u'description',
-		'fieldtype': u'Text',
-		'hidden': 0,
-		'in_filter': 0,
-		'label': u'Description',
-		'no_copy': 0,
-		'oldfieldname': u'description',
-		'oldfieldtype': u'Text',
-		'print_hide': 0,
-		'report_hide': 0,
-		'reqd': 0,
-		'search_index': 0,
-		'width': u'300px'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 0,
-		'doctype': u'DocField',
-		'fieldname': u'date',
-		'fieldtype': u'Date',
-		'hidden': 0,
-		'in_filter': 0,
-		'label': u'Date',
-		'no_copy': 0,
-		'oldfieldname': u'date',
-		'oldfieldtype': u'Date',
-		'print_hide': 0,
-		'report_hide': 0,
-		'reqd': 0,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 0,
-		'doctype': u'DocField',
-		'fieldname': u'priority',
-		'fieldtype': u'Data',
-		'hidden': 0,
-		'in_filter': 0,
-		'label': u'Priority',
-		'no_copy': 0,
-		'oldfieldname': u'priority',
-		'oldfieldtype': u'Data',
-		'print_hide': 0,
-		'report_hide': 0,
-		'reqd': 0,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 0,
-		'doctype': u'DocField',
-		'fieldname': u'reference_type',
-		'fieldtype': u'Data',
-		'hidden': 0,
-		'in_filter': 0,
-		'label': u'Reference Type',
-		'no_copy': 0,
-		'oldfieldname': u'reference_type',
-		'oldfieldtype': u'Data',
-		'print_hide': 0,
-		'report_hide': 0,
-		'reqd': 0,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 0,
-		'doctype': u'DocField',
-		'fieldname': u'reference_name',
-		'fieldtype': u'Data',
-		'hidden': 0,
-		'in_filter': 0,
-		'label': u'Reference Name',
-		'no_copy': 0,
-		'oldfieldname': u'reference_name',
-		'oldfieldtype': u'Data',
-		'print_hide': 0,
-		'report_hide': 0,
-		'reqd': 0,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 0,
-		'doctype': u'DocField',
-		'fieldname': u'checked',
-		'fieldtype': u'Check',
-		'hidden': 0,
-		'in_filter': 0,
-		'label': u'Checked',
-		'no_copy': 0,
-		'oldfieldname': u'checked',
-		'oldfieldtype': u'Check',
-		'print_hide': 0,
-		'report_hide': 0,
-		'reqd': 0,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 0,
-		'doctype': u'DocField',
-		'fieldname': u'role',
-		'fieldtype': u'Link',
-		'hidden': 0,
-		'in_filter': 0,
-		'label': u'Role',
-		'no_copy': 0,
-		'oldfieldname': u'role',
-		'oldfieldtype': u'Link',
-		'options': u'Role',
-		'print_hide': 0,
-		'report_hide': 0,
-		'reqd': 0,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'assigned_by',
-		'fieldtype': u'Link',
-		'label': u'Assigned By',
-		'options': u'Profile'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/trash_control/trash_control.txt b/erpnext/utilities/doctype/trash_control/trash_control.txt
index b7a4a1e..3688342 100644
--- a/erpnext/utilities/doctype/trash_control/trash_control.txt
+++ b/erpnext/utilities/doctype/trash_control/trash_control.txt
@@ -3,30 +3,30 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2010-08-08 17:09:29',
+		'creation': '2012-03-27 14:36:47',
 		'docstatus': 0,
-		'modified': '2010-12-30 11:44:36',
-		'modified_by': 'umair@iwebnotes.com',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:47',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'in_create': 1,
 		'issingle': 1,
-		'module': 'Utilities',
+		'module': u'Utilities',
 		'name': '__common__',
 		'read_only': 1,
-		'section_style': 'Simple',
-		'server_code_error': ' ',
+		'section_style': u'Simple',
+		'server_code_error': u' ',
 		'version': 35
 	},
 
 	# DocType, Trash Control
 	{
 		'doctype': 'DocType',
-		'name': 'Trash Control'
+		'name': u'Trash Control'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/utilities/page/calendar/calendar.js b/erpnext/utilities/page/calendar/calendar.js
index ac1ac88..9aa5df8 100644
--- a/erpnext/utilities/page/calendar/calendar.js
+++ b/erpnext/utilities/page/calendar/calendar.js
@@ -24,7 +24,11 @@
 	if(!erpnext.calendar) {
 		erpnext.calendar = new Calendar();
 		erpnext.calendar.init(wrapper);
-		rename_observers.push(erpnext.calendar);
+
+		var me = this;
+		$(document).bind('rename', function(event, dt, old_name, new_name) {
+			erpnext.calendar.rename_notify(dt, old_name, new_name)
+		});
 	}
 }
 
@@ -63,7 +67,7 @@
 
 Calendar.prototype.rename_notify = function(dt, old_name, new_name) {
 	// calendar
-	if(dt = 'Event'){		
+	if(dt = 'Event'){
 		if(this.events_by_name[old_name]) {
 			delete this.events_by_name[old_name];
 		}
diff --git a/erpnext/utilities/page/kb_common/kb_common.js b/erpnext/utilities/page/kb_common/kb_common.js
new file mode 100644
index 0000000..d77a938
--- /dev/null
+++ b/erpnext/utilities/page/kb_common/kb_common.js
@@ -0,0 +1,143 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+// question toolbar
+// contains - voting widget / tag list and user info / timestamp
+// By XXXXXX on YYYYY
+
+KBItemToolbar = function(args, kb) {
+	$.extend(this, args);
+	var me = this;
+	this.make = function() {
+		this.wrapper = $a(this.parent, 'div', '', {});
+		this.line1 = $a(this.wrapper, 'div', '', {color: '#888', fontSize:'11px', margin:'7px 0px'});
+		this.make_timestamp();
+		if(this.with_tags)
+			this.make_tags();
+		this.setup_del();
+	}
+	
+	this.make_timestamp = function() {
+		this.line1.innerHTML = repl('By %(name)s | %(when)s', {
+			name: wn.utils.full_name(this.det.first_name, this.det.last_name),
+			when: wn.datetime.comment_when(this.det.modified)
+		});
+		
+		// allow system manager to delete questions / answers
+		if(has_common(user_roles, ['Administrator', 'System Manager'])) {
+			this.line1.innerHTML += ' | <a style="cursor:pointer;"\
+				class="del-link">delete</a>';
+		}
+	}
+
+	this.make_tags = function() {
+		this.line1.innerHTML += ' | '
+		this.tags_area = $a(this.line1, 'span', 'kb-tags')
+		this.tags = new TagList(this.tags_area, 
+			this.det._user_tags && (this.det._user_tags.split(',')), 
+			this.doctype, this.det.name, 0, kb.set_tag_filter)		
+	}
+
+	this.setup_del = function() {
+		$(this.line1).find('.del-link').click(function() {
+			console.log(1);
+			this.innerHTML = 'deleting...'; 
+			this.disabled = 1;
+			$c_page('utilities', 'questions', 'delete', {
+				dt: me.doctype, dn: me.det.name}, function(r,rt) {
+				// reload the list
+				kb.list.run()
+			});
+		});		
+	}
+
+	this.make();
+}
+
+
+// displays an editable text,
+// needs parent, text, disp_class, inp_class
+// dt, dn
+
+EditableText = function(args) {
+	$.extend(this, args);
+	var me = this;
+	
+	me.$w = $(repl('<div class="ed-text">\
+		<div class="ed-text-display %(disp_class)s"></div>\
+		<a class="ed-text-edit" style="cursor: pointer; float: right; margin-top: -16px;">[edit]</a>\
+		<textarea class="ed-text-input %(inp_class)s hide"></textarea>\
+		<div class="help hide"><br>Formatted as <a href="http://en.wikipedia.org/wiki/Markdown#Syntax_examples"\
+		 	target="_blank">markdown</a></div>\
+		<button class="btn btn-small btn-info hide ed-text-save">Save</button>\
+		<a class="ed-text-cancel hide" style="cursor: pointer;">Cancel</a>\
+	</div>', args)).appendTo(me.parent);
+	
+	this.set_display = function(txt) {
+		me.$w.find('.ed-text-display').html(wn.markdown(txt));
+		me.text = txt;
+	}
+	
+	this.set_display(me.text);
+	
+	if(me.height) me.$w.find('.ed-text-input').css('height', me.height);
+	
+	// edit
+	me.$w.find('.ed-text-edit').click(function() {
+		me.$w.find('.ed-text-input').val(me.text);
+		me.show_as_input();
+	})
+	
+	// save button - save the new text
+	me.$w.find('.ed-text-save').click(
+		function() {
+			var v = me.$w.find('.ed-text-input').val();
+			// check if text is written
+			if(!v) {
+				msgprint('Please write something!');
+				return;
+			}
+			var btn = this;
+			$(btn).set_working();
+			$c_page('utilities', 'question_view', 'update_item', {
+					dt: me.dt, dn: me.dn, fn: me.fieldname, text: v
+				}, 
+				function(r) {
+					$(btn).done_working();
+					if(r.exc) {msgprint(r.exc); return; }
+					me.set_display(v);
+					me.show_as_text();
+				});
+		}
+	)
+	
+
+	// cancel button
+	me.$w.find('.ed-text-cancel').click(function() {
+		me.show_as_text();		
+	})
+
+	this.show_as_text = function() {
+		me.$w.find('.ed-text-display, .ed-text-edit').toggle(true);
+		me.$w.find('.ed-text-input, .ed-text-save, .ed-text-cancel, .help').toggle(false);
+	}
+
+	this.show_as_input = function() {
+		me.$w.find('.ed-text-display, .ed-text-edit').toggle(false);
+		me.$w.find('.ed-text-input, .ed-text-save, .ed-text-cancel, .help').toggle(true);
+	}
+
+}
diff --git a/erpnext/utilities/page/messages/messages.css b/erpnext/utilities/page/messages/messages.css
index 81260ab..49b3771 100644
--- a/erpnext/utilities/page/messages/messages.css
+++ b/erpnext/utilities/page/messages/messages.css
@@ -1,9 +1,9 @@
 #message-post-text {
-	height: 3em;
+	width: 50%;
 }
 
 #message-list {
-	margin: 0px 40px;
+	
 }
 
 .message {
diff --git a/erpnext/utilities/page/messages/messages.html b/erpnext/utilities/page/messages/messages.html
index b645d3f..7538785 100644
--- a/erpnext/utilities/page/messages/messages.html
+++ b/erpnext/utilities/page/messages/messages.html
@@ -3,7 +3,7 @@
 		<a class="close" onclick="window.history.back();">&times;</a>		
 		<h1>Messages</h1>
 		<div class="well">
-			<textarea id="message-post-text"></textarea>
+			<input id="message-post-text"></input>
 			<button disabled="disabled" id="message-post" class="btn btn-small"><i class="icon-play"></i> Post</button>
 		</div>
 		<div id="message-list">
diff --git a/erpnext/utilities/page/messages/messages.js b/erpnext/utilities/page/messages/messages.js
index 6937796..ef56020 100644
--- a/erpnext/utilities/page/messages/messages.js
+++ b/erpnext/utilities/page/messages/messages.js
@@ -43,20 +43,24 @@
 	});
 	
 	// enable, disable button
-	$('#message-post-text').keyup(function() {
+	$('#message-post-text').keyup(function(e) {
 		if($(this).val()) {
 			$('#message-post').attr('disabled', false);
 		} else {
 			$('#message-post').attr('disabled', true);
 		}
+		
+		if(e.which==13) {
+			$('#message-post').click();
+		}
 	})
 }
 
-wn.pages.messages.onshow = function(wrapper) {
+$(wn.pages.messages).bind('show', function() {
 	erpnext.messages.show();
-	setTimeout(erpnext.messages.refresh, 5000);
+	setTimeout(erpnext.messages.refresh, 7000);
 	$('#message-post-text').focus();
-}
+})
 
 erpnext.messages = {
 	show: function() {
@@ -75,8 +79,8 @@
 	},
 	// check for updates every 5 seconds if page is active
 	refresh: function() {
-		setTimeout(erpnext.messages.refresh, 10000);
-		if(page_body.cur_page_label != 'messages') return;
+		setTimeout(erpnext.messages.refresh, 7000);
+		if(wn.container.page.label != 'Messages') return;
 		erpnext.messages.show();
 	},
 	get_contact: function() {
@@ -91,13 +95,15 @@
 		return user;	
 	},
 	make_list: function() {
-		erpnext.messages.list = new wn.widgets.Listing({
+		erpnext.messages.list = new wn.ui.Listing({
 			parent: $('#message-list').get(0),
 			method: 'utilities.page.messages.messages.get_list',
 			args: {
 				contact: null
 			},
 			render_row: function(wrapper, data) {
+				$(wrapper).removeClass('list-row');
+				
 				data.creation = dateutil.comment_when(data.creation);
 				data.comment_by_fullname = wn.user_info(data.owner).fullname;
 
diff --git a/erpnext/utilities/page/messages/messages.py b/erpnext/utilities/page/messages/messages.py
index b282991..212a268 100644
--- a/erpnext/utilities/page/messages/messages.py
+++ b/erpnext/utilities/page/messages/messages.py
@@ -25,19 +25,19 @@
 
 	if webnotes.form_dict['contact'] == webnotes.session['user']:
 		# set all messages as read
-		webnotes.conn.sql("""UPDATE `tabComment Widget Record`
+		webnotes.conn.sql("""UPDATE `tabComment`
 		set docstatus = 1 where comment_doctype in ('My Company', 'Message')
 		and comment_docname = %s
 		""", webnotes.user.name)
 				
 		# return messages
-		return webnotes.conn.sql("""select * from `tabComment Widget Record` 
+		return webnotes.conn.sql("""select * from `tabComment` 
 		where (owner=%(contact)s or comment_docname=%(user)s)
 		and comment_doctype in ('My Company', 'Message')
 		order by creation desc
 		limit %(limit_start)s, %(limit_page_length)s""", webnotes.form_dict, as_dict=1)		
 	else:
-		return webnotes.conn.sql("""select * from `tabComment Widget Record` 
+		return webnotes.conn.sql("""select * from `tabComment` 
 		where (owner=%(contact)s and comment_docname=%(user)s)
 		or (owner=%(user)s and comment_docname=%(contact)s)
 		and comment_doctype in ('My Company', 'Message')
@@ -56,17 +56,53 @@
 @webnotes.whitelist()
 def post(arg=None):
 	"""post message"""
-	import json
-	arg = json.loads(arg)
+	if arg:
+		import json
+		arg = json.loads(arg)
+	else:
+		arg = {}
+		arg.update(webnotes.form_dict)
 	from webnotes.model.doc import Document
-	d = Document('Comment Widget Record')
+	d = Document('Comment')
 	d.comment = arg['txt']
 	d.comment_docname = arg['contact']
 	d.comment_doctype = 'Message'
 	d.save()
+
+	import webnotes.utils
+	if webnotes.utils.cint(arg.get('notify')):
+		notify(arg)
 	
 @webnotes.whitelist()
 def delete(arg=None):
-	webnotes.conn.sql("""delete from `tabComment Widget Record` where name=%s""", 
+	webnotes.conn.sql("""delete from `tabComment` where name=%s""", 
 		webnotes.form_dict['name']);
-	
\ No newline at end of file
+
+def notify(arg=None):
+	from webnotes.utils import cstr
+	fn = webnotes.conn.sql('select first_name, last_name from tabProfile where name=%s', webnotes.user.name)[0]
+	if fn[0] or f[1]:
+		fn = cstr(fn[0]) + (fn[0] and ' ' or '') + cstr(fn[1])
+	else:
+		fn = webnotes.user.name
+
+	message = '''A new comment has been posted on your page by %s:
+	
+	<b>Comment:</b> %s
+	
+	To answer, please login to your erpnext account!
+
+	<a href='https://signin.erpnext.com'>https://signin.erpnext.com</a>
+	''' % (fn, arg['txt'])
+	
+	from webnotes.model.code import get_obj
+	note = get_obj('Notification Control')
+	email_msg = note.prepare_message({
+		'type': 'New Comment',
+		'message': message
+	})
+
+	sender = webnotes.user.name!='Administrator' and webnotes.user.name or 'support+admin_post@erpnext.com'
+	
+	from webnotes.utils.email_lib import sendmail
+	sendmail([arg['contact']], sender, email_msg, fn + ' has posted a new comment')	
diff --git a/erpnext/knowledge_base/page/question_view/__init__.py b/erpnext/utilities/page/question_view/__init__.py
similarity index 100%
rename from erpnext/knowledge_base/page/question_view/__init__.py
rename to erpnext/utilities/page/question_view/__init__.py
diff --git a/erpnext/knowledge_base/page/question_view/question_view.css b/erpnext/utilities/page/question_view/question_view.css
similarity index 100%
rename from erpnext/knowledge_base/page/question_view/question_view.css
rename to erpnext/utilities/page/question_view/question_view.css
diff --git a/erpnext/utilities/page/question_view/question_view.html b/erpnext/utilities/page/question_view/question_view.html
new file mode 100644
index 0000000..721e48a
--- /dev/null
+++ b/erpnext/utilities/page/question_view/question_view.html
@@ -0,0 +1,12 @@
+<div class="layout-wrapper layout-wrapper-appframe">
+	<div class="layout-appframe"></div>
+	<div class="layout-main" style="min-height: 400px">
+		<div class="qv-question-wrapper">
+		</div>
+		<hr>
+		<div class="qv-answer-wrapper">
+		</div>
+		<div class="add-answer-link"></div>
+		<div class="add-answer-area"></div>
+	</div>
+</div>
\ No newline at end of file
diff --git a/erpnext/utilities/page/question_view/question_view.js b/erpnext/utilities/page/question_view/question_view.js
new file mode 100644
index 0000000..14b6850
--- /dev/null
+++ b/erpnext/utilities/page/question_view/question_view.js
@@ -0,0 +1,188 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+pscript['onload_question-view'] = function(wrapper) {
+	wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.layout-appframe'));
+	wrapper.appframe.title('<a href="#questions">Knowledge Base</a>');
+
+	wrapper.add_answer_area = $('.add-answer-area').get(0);
+}
+
+pscript['refresh_question-view'] = function() {
+	// href
+	var qid = window.location.hash.split('/')[1];
+	console.log(qid)
+	if(qid) {
+		pscript.question_view(qid);
+	}
+}
+
+pscript.question_view = function(qid, qtext) {
+	var w = wn.pages['question-view'];
+	new KBQuestionView(w, qid, qtext);
+}
+
+KBQuestionView = function(w, qid, qtext) {
+	var me = this;
+		
+	this.make_question = function() {
+		$(w).find('.qv-question-wrapper').empty();
+		new EditableText({
+			parent: $(w).find('.qv-question-wrapper').get(0),
+			dt: 'Question',
+			dn: qid,
+			fieldname: 'question',
+			text: qtext,
+			inp_class: 'qv-input',
+			disp_class: 'qv-text'
+		});
+
+		// show tags
+	}
+	
+	// answer list
+	this.make_answer_list = function() {
+		$(w).find('.qv-answer-wrapper').empty();
+		this.ans_list = new KBAnswerList({
+			parent: $(w).find('.qv-answer-wrapper').get(0),
+			qid: qid
+		})
+	}
+	
+	// check if users has answered 
+	// (if no) then add a box to add a new answer
+	this.make_add_answer = function() {
+		$c_page('utilities', 'question_view', 'has_answered', qid, function(r, rt) {
+			if(r.message=='No') {
+				me.make_answer_box_link();
+			}
+		});
+	}
+	
+	// add a link to open add answer
+	this.make_answer_box_link = function() {
+		wn.pages['question-view'].appframe.add_button('Add your answer', function() {
+			$(this).toggle(false);
+			me.make_answer_box();
+		}, 'icon-plus');
+	}
+	
+	// answer box
+	// text area + add button
+	this.make_answer_box = function() {
+		$ds(w.add_answer_area);
+		$a(w.add_answer_area, 'h3', '', {}, 'Add Your Answer')
+		this.input = $a(w.add_answer_area, 'textarea');
+		wn.tinymce.add_simple(this.input);
+		
+		this.btn = $btn($a(w.add_answer_area, 'div'), 'Post', function() {
+			var v = wn.tinymce.get_value(me.input);
+			if(!v) { msgprint('Write something!'); return; }
+			me.btn.set_working();
+			$c_page('utilities', 'question_view', 'add_answer', {qid: qid, answer:v}, 
+				function(r, rt) {
+					me.btn.done_working();
+					me.ans_list.list.run();
+					$dh(w.add_answer_area);
+				}
+			);
+		});
+	}
+	
+	this.setup = function() {
+		if(qtext) {
+			this.make();
+		}
+		else {
+			$c_page('utilities', 'question_view', 'get_question', qid, function(r, rt) {
+				qtext = r.message;
+				me.make();
+			});
+		}
+	}
+	
+	this.make = function() {
+		set_title(qtext);
+		this.make_question();
+		this.make_answer_list();
+		this.make_add_answer();		
+	}
+	
+	this.setup();
+}
+
+
+// kb answer list
+KBAnswerList = function(args) {
+	var me = this;
+	$.extend(this, args);
+	
+	this.make_list = function() {
+		wn.pages['question-view'].appframe.clear_buttons();
+		this.list = new wn.ui.Listing({
+			parent: me.parent,
+			appframe: wn.pages['question-view'].appframe,
+			as_dict: 1,
+			no_result_message: 'No answers yet, be the first one to answer!',
+			render_row: function(body, data) {
+				new KBAnswer(body, data, me)
+			},
+			get_query: function() {
+				return repl("SELECT t1.name, t1.owner, t1.answer, t1._users_voted, t2.first_name, "
+					+"t2.last_name, t1.modified from tabAnswer t1, tabProfile t2 "
+					+"where question='%(qid)s' and t1.owner = t2.name "
+					+"order by t1.modified desc", {qid: me.qid})
+			}
+		});
+		
+		this.list.run();
+		
+	}
+	
+	this.make_list();
+	
+}
+
+// kb answer
+// answer
+// by xxx | on xxx
+KBAnswer = function(body, data, ans_list) {
+	body.className = 'qv-answer';
+	var edtxt = new EditableText({
+		parent: body,
+		dt: 'Answer',
+		dn: data.name,
+		fieldname: 'answer',
+		text: data.answer,
+		inp_class: 'qv-ans-input',
+		disp_class: 'qv-ans-text',
+		height: '300px'
+	});	
+	
+	$(edtxt.wrapper).addClass('well');
+	
+	var div = $a(body, 'div', '', {})
+	new KBItemToolbar({
+		parent: div,
+		det: data,
+		with_tags: 0,
+		doctype: 'Answer'
+	}, ans_list)
+	
+}
+
+
+wn.require('erpnext/utilities/page/kb_common/kb_common.js');
diff --git a/erpnext/knowledge_base/page/question_view/question_view.py b/erpnext/utilities/page/question_view/question_view.py
similarity index 100%
rename from erpnext/knowledge_base/page/question_view/question_view.py
rename to erpnext/utilities/page/question_view/question_view.py
diff --git a/erpnext/utilities/page/question_view/question_view.txt b/erpnext/utilities/page/question_view/question_view.txt
new file mode 100644
index 0000000..719b551
--- /dev/null
+++ b/erpnext/utilities/page/question_view/question_view.txt
@@ -0,0 +1,27 @@
+# Page, question-view
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2011-05-04 11:09:50',
+		'docstatus': 0,
+		'modified': '2011-03-29 13:54:27',
+		'modified_by': 'Administrator',
+		'owner': 'Administrator'
+	},
+
+	# These values are common for all Page
+	{
+		'doctype': 'Page',
+		'module': 'Utilities',
+		'name': '__common__',
+		'page_name': 'Question View',
+		'standard': 'Yes'
+	},
+
+	# Page, question-view
+	{
+		'doctype': 'Page',
+		'name': 'question-view'
+	}
+]
diff --git a/erpnext/knowledge_base/page/questions/__init__.py b/erpnext/utilities/page/questions/__init__.py
similarity index 100%
rename from erpnext/knowledge_base/page/questions/__init__.py
rename to erpnext/utilities/page/questions/__init__.py
diff --git a/erpnext/utilities/page/questions/questions.css b/erpnext/utilities/page/questions/questions.css
new file mode 100644
index 0000000..52e8a38
--- /dev/null
+++ b/erpnext/utilities/page/questions/questions.css
@@ -0,0 +1,27 @@
+div.kb-search-wrapper textarea {
+	height: 2.2em;
+	width: 80%;
+	font-size: 14px;
+	padding: 3px;
+	margin-bottom: 7px;
+}
+
+.kb-question-wrapper {
+	padding-bottom: 3px;
+	margin-bottom: 3px;
+}
+
+.kb-questions {
+}
+
+.kb-question-details {
+	margin: 11px 0px 11px 29px;
+}
+
+.kb-tag-filter-area {
+	padding: 7px;
+	background-color: #F2F2E8;
+	color: #222;
+	margin: 7px 0px;
+	display: none;
+}
\ No newline at end of file
diff --git a/erpnext/utilities/page/questions/questions.html b/erpnext/utilities/page/questions/questions.html
new file mode 100644
index 0000000..bec483e
--- /dev/null
+++ b/erpnext/utilities/page/questions/questions.html
@@ -0,0 +1,19 @@
+<div class="layout-wrapper layout-wrapper-background">
+	<div class="layout-appframe"></div>
+	<div class="layout-main-section">
+		<div class="kb-search-wrapper">
+			<textarea></textarea>
+			<div>
+				<button class="btn btn-small search" onclick="">
+					<i class="icon-search"></i> Search</button>
+				<button class="btn btn-small ask">
+					<i class="icon-question-sign"></i> Ask</button>
+			</div>
+		</div>
+	</div>
+	<div class="layout-side-section">
+		<div class="questions-tags"></div>
+		<p class="help">A wiki or Q&A for your organization</p>
+	</div>
+	<div style="clear: both;"></div>
+</div>
\ No newline at end of file
diff --git a/erpnext/utilities/page/questions/questions.js b/erpnext/utilities/page/questions/questions.js
new file mode 100644
index 0000000..6992fa1
--- /dev/null
+++ b/erpnext/utilities/page/questions/questions.js
@@ -0,0 +1,222 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+pscript.onload_questions = function(wrapper) {	
+	body = $(wrapper).find('.layout-main-section').get(0);
+	
+	wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.layout-appframe'));
+	wrapper.appframe.title('Knowledge Base');
+	
+	// kb
+	var kb = new KnowledgeBase(body);
+	
+	// sidebar
+	this.sidebar = new wn.widgets.PageSidebar($(wrapper).find('.questions-tags').get(0), {
+		sections: [
+			{
+				title: 'Top Tags',
+				render: function(body) {
+					new wn.widgets.TagCloud(body, 'Question', function(tag) 
+						{ kb.set_tag_filter(tag) });
+				}				
+			}
+		]
+	});
+	set_title('Knowledge Base');
+}
+
+// knowledge base object
+// has a box for search or ask a question
+// and list of top rated search results
+//
+function KnowledgeBase(w) {
+	var me = this;
+	this.sort_by = 'modified';
+	this.tag_filter_dict = {};
+	
+	this.make_search_bar = function() {
+		this.search = $(w).find('.kb-search-wrapper textarea').get(0);
+		
+		$(w).find('.btn.search').click(function() {
+			me.run();
+		})
+		$(w).find('.btn.ask').click(function() {
+			me.ask();
+		})
+	}
+	
+	// ask a new question
+	this.ask = function() {
+		if(this.search.value==$(this.search).attr('default_text')) {
+			msgprint('Please enter some text'); return;
+		}
+		this.add_question([]);
+	}
+	
+	// suggest a few users who can answer
+	this.suggest = function() {
+		this.dialog = new wn.widgets.Dialog({
+			title: 'Suggest a users',
+			width: 400,
+			fields: [
+				{fieldtype:'HTML', options:'Optional: Suggest a few users who can help you answer this question<br>'},
+				{fieldtype:'Link', fieldname:'profile1', label:'1st User',options:'Profile'},
+				{fieldtype:'Link', fieldname:'profile2', label:'2nd User',options:'Profile'},
+				{fieldtype:'Link', fieldname:'profile3', label:'3rd User',options:'Profile'},
+				{fieldtype:'Button', fieldname:'ask', label:'Add the Question'}
+			]
+		});
+		this.dialog.fields_dict.ask.input.onclick = function() {
+			me.dialog.hide();
+			me.add_question(values(me.dialog.get_values()));
+		}
+		this.dialog.show();
+	}
+	
+	// add a new question to the database
+	this.add_question = function(suggest_list) {
+		$c_page('utilities', 'questions', 'add_question', {
+			question: this.search.value,
+			suggest: suggest_list
+		}, function(r,rt) {
+			$(me.search).val('').blur();
+			me.run();
+		})
+	}
+	
+	// where tags that filter will be displayed
+	this.make_tag_filter_area = function() {
+		this.tag_filters = $a(w, 'div', 'kb-tag-filter-area');
+		$a(this.tag_filters,'span','',{marginRight:'4px',color:'#442'}, '<i>Showing for:</i>');
+		this.tag_area = $a(this.tag_filters, 'span');
+	}
+	
+	// make a list of questions
+	this.make_list = function() {
+		this.make_tag_filter_area();
+		this.list_area = $a(w, 'div', '', {marginRight:'13px'})
+		this.no_result = $a(w, 'div','help_box',{display:'none'},'No questions asked yet! Be the first one to ask')
+
+		this.list = new wn.ui.Listing({
+			parent: this.list_area,
+			no_results_message: 'No questions found. Ask a new question!',
+			appframe: wn.pages.questions.appframe,
+			as_dict: 1,
+			get_query: function() {
+				
+				// filter by search string
+				var v = me.search.value==$(me.search).attr('default_text') ? '' : me.search.value;
+				cond = v ? (' and t1.question like "%'+v+'%"') : '';
+				
+				// filter by tags
+				if(me.tag_filter_dict) {
+					for(f in me.tag_filter_dict) {
+						cond += ' and t1.`_user_tags` like "%' + f + '%"'
+					}
+				}
+				return repl('select t1.name, t1.owner, t1.question, t1.modified, t1._user_tags, '
+				+'t1._users_voted, t2.first_name, t2.last_name '
+				+'from tabQuestion t1, tabProfile t2 '
+				+'where t1.docstatus!=2 '
+				+'and t1.owner = t2.name'
+				+'%(cond)s order by t1.modified desc', {user:user, cond: cond})
+			},
+			render_row: function(parent, data, listing) {
+				new KBQuestion(parent, data, me);
+			}
+		});
+		
+		this.list.run();
+
+	}
+
+	// add a tag filter to the search in the
+	// main page
+	this.set_tag_filter = function(tag) {
+
+		// check if exists
+		if(in_list(keys(me.tag_filter_dict), tag.label)) return;
+
+		// create a tag in filters
+		var filter_tag = new SingleTag({
+			parent: me.tag_area,
+			label: tag.label,
+			dt: 'Question',
+			color: tag.color
+		});
+
+		// remove tag from filters
+		filter_tag.remove = function(tag_remove) {
+			$(tag_remove.body).fadeOut();
+			delete me.tag_filter_dict[tag_remove.label];
+
+			// hide everything?
+			if(!keys(me.tag_filter_dict).length) {
+				$(me.tag_filters).slideUp(); // hide
+			}
+
+			// run
+			me.run();
+		}
+
+		// add to dict
+		me.tag_filter_dict[tag.label] = filter_tag;
+		$ds(me.tag_filters);
+
+		// run
+		me.run();
+	}	
+	this.run = function() {
+		this.list.run();
+	}
+
+	this.make_search_bar();
+	this.make_list();
+	
+}
+
+// single kb question
+// "question
+//  points | tag list"
+
+KBQuestion = function(parent, det, kb) {
+	
+	this.make = function() {
+		this.wrapper = $a(parent, 'div', 'kb-question-wrapper');
+		this.q_area = $a($a(this.wrapper, 'div'), 'h3', 'kb-questions link_type', {display:'inline', textDecoration:'none'}, det.question);
+
+		this.q_area.onclick = function() {
+			var q = this;
+			window.location.href = '#!question-view/' + q.id;
+			//loadpage('question-view', function() { pscript.question_view(q.id, q.txt) })
+		}
+		
+		this.q_area.id = det.name; this.q_area.txt = det.question;
+
+		new KBItemToolbar({
+			parent: this.wrapper,
+			det: det,
+			with_tags: 1,
+			doctype: 'Question'
+		}, kb)
+		
+	}
+	
+
+	this.make()
+}
+
+wn.require('erpnext/utilities/page/kb_common/kb_common.js');
diff --git a/erpnext/utilities/page/questions/questions.py b/erpnext/utilities/page/questions/questions.py
new file mode 100644
index 0000000..52b80fe
--- /dev/null
+++ b/erpnext/utilities/page/questions/questions.py
@@ -0,0 +1,64 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+import webnotes
+
+from webnotes.utils import load_json, cint, cstr
+import json
+
+# add a new question
+@webnotes.whitelist()
+def add_question(arg):
+	args = load_json(arg)
+	
+	from webnotes.model.doc import Document
+	d = Document('Question')
+	d.question = args['question'].title()
+	d.points = 1
+	d.save(1)
+	
+	if args['suggest']:
+		from utilities.page.messages import messages
+		for s in args['suggest']:
+			if s:
+				messages.post(json.dumps({
+					'contact': s,
+					'txt': 'Please help me and answer the question "%s" in the Knowledge Base' % d.question,
+					'notify': 1
+				}))
+	
+@webnotes.whitelist()
+def vote(arg):
+	args = load_json(arg)
+	
+	res = webnotes.conn.sql("select points, _users_voted from `tab%s` where name=%s" % (args['dt'], '%s'), args['dn'])[0]
+	p = cint(res[0])
+	p = args['vote']=='up' and p+1 or p-1
+	
+	# update
+	webnotes.conn.sql("update `tab%s` set points=%s, _users_voted=%s where name=%s" % (args['dt'], '%s', '%s', '%s'), \
+		(p, cstr(res[1]) + ',' + webnotes.user.name, args['dn']))
+	
+	return p
+
+@webnotes.whitelist()
+def delete(arg):
+	"""
+		delete a question or answer (called from kb toolbar)
+	"""
+	args = load_json(arg)
+	from webnotes.model import delete_doc
+	delete_doc(args['dt'], args['dn'])
diff --git a/erpnext/utilities/page/questions/questions.txt b/erpnext/utilities/page/questions/questions.txt
new file mode 100644
index 0000000..8231625
--- /dev/null
+++ b/erpnext/utilities/page/questions/questions.txt
@@ -0,0 +1,27 @@
+# Page, questions
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2011-05-04 11:09:49',
+		'docstatus': 0,
+		'modified': '2011-03-29 13:53:57',
+		'modified_by': 'Administrator',
+		'owner': 'Administrator'
+	},
+
+	# These values are common for all Page
+	{
+		'doctype': 'Page',
+		'module': 'Utilities',
+		'name': '__common__',
+		'page_name': 'Questions',
+		'standard': 'Yes'
+	},
+
+	# Page, questions
+	{
+		'doctype': 'Page',
+		'name': 'Questions'
+	}
+]
diff --git a/erpnext/utilities/page/todo/todo.css b/erpnext/utilities/page/todo/todo.css
index 01a4d24..704e600 100644
--- a/erpnext/utilities/page/todo/todo.css
+++ b/erpnext/utilities/page/todo/todo.css
@@ -3,6 +3,7 @@
 	border-bottom: 1px solid #DEB85F;
 	margin-bottom: 5px;
 	height: 14px;
+	clear: both;
 }
 
 .todoitem .label {
diff --git a/erpnext/utilities/page/todo/todo.html b/erpnext/utilities/page/todo/todo.html
index 3400455..32a0a78 100644
--- a/erpnext/utilities/page/todo/todo.html
+++ b/erpnext/utilities/page/todo/todo.html
@@ -4,7 +4,7 @@
 	<br>
 	<div id="todo-list">
 	</div>
-	<div style="margin-top: 21px">
+	<div style="margin-top: 21px; clear: both">
 		<button id="add-todo" class="btn btn-small"><i class="icon-plus"></i> Add</button>
 	</div>
 </div>
\ No newline at end of file
diff --git a/erpnext/utilities/page/todo/todo.js b/erpnext/utilities/page/todo/todo.js
index dcdf50a..9a90ce3 100644
--- a/erpnext/utilities/page/todo/todo.js
+++ b/erpnext/utilities/page/todo/todo.js
@@ -60,6 +60,7 @@
 		} else {
 			todo.link = '';
 		}
+		if(!todo.description) todo.description = '';
 		$('#todo-list').append(repl('<div class="todoitem">\
 				<span class="description">\
 					<span class="label %(labelclass)s">%(priority)s</span>\
diff --git a/erpnext/utilities/page/todo/todo.py b/erpnext/utilities/page/todo/todo.py
index 05d55fe..73bd0b0 100644
--- a/erpnext/utilities/page/todo/todo.py
+++ b/erpnext/utilities/page/todo/todo.py
@@ -22,7 +22,7 @@
 	"""get todo list"""
 	return webnotes.conn.sql("""select name, owner, description, date,
 		priority, checked, reference_type, reference_name, assigned_by
-		from `tabToDo Item` where owner=%s 
+		from `tabToDo` where owner=%s 
 		order by field(priority, 'High', 'Medium', 'Low') asc, date asc""",
 		webnotes.session['user'], as_dict=1)
 
@@ -30,7 +30,7 @@
 def edit(arg=None):
 	args = webnotes.form_dict
 
-	d = Document('ToDo Item', args.get('name') or None)
+	d = Document('ToDo', args.get('name') or None)
 	d.description = args['description']
 	d.date = args['date']
 	d.priority = args['priority']
@@ -46,10 +46,10 @@
 @webnotes.whitelist()
 def delete(arg=None):
 	name = webnotes.form_dict['name']
-	d = Document('ToDo Item', name)
+	d = Document('ToDo', name)
 	if d and d.name:
 		notify_assignment(d)
-	webnotes.conn.sql("delete from `tabToDo Item` where name = %s", name)
+	webnotes.conn.sql("delete from `tabToDo` where name = %s", name)
 
 def notify_assignment(d):
 	doc_type = d.reference_type
diff --git a/erpnext/utilities/page/users/users.js b/erpnext/utilities/page/users/users.js
index 130e538..ad238ae 100644
--- a/erpnext/utilities/page/users/users.js
+++ b/erpnext/utilities/page/users/users.js
@@ -232,7 +232,7 @@
 				$c_page('utilities', 'users', 'add_user', v, function(r,rt) {
 					if(r.exc) { msgprint(r.exc); return; }
 					else {
-						wn.boot.user_info[v.user] = {fullname:v.first_name + ' ' + v.last_name};
+						wn.boot.user_info[v.user] = {fullname:v.first_name + ' ' + (v.last_name || '')};
 						d.hide();
 						me.refresh();
 					}
@@ -269,8 +269,8 @@
 			</div>', {role: this.roles[i]}));
 		}
 		$(this.dialog.body).append('<div style="clear: both">\
-			<button class="btn btn-small btn-primary">Save</button></div>');
-		$(this.dialog.body).find('button.btn-primary').click(function() {
+			<button class="btn btn-small btn-info">Save</button></div>');
+		$(this.dialog.body).find('button.btn-info').click(function() {
 			me.save();
 		});
 		$(this.dialog.body).find('.user-role a').click(function() {
@@ -314,7 +314,7 @@
 				unset_roles: JSON.stringify(unset_roles),
 				uid: this.uid
 			},
-			btn: $(this.dialog.body).find('.btn-primary').get(0),
+			btn: $(this.dialog.body).find('.btn-info').get(0),
 			callback: function() {
 				
 			}
diff --git a/erpnext/utilities/page/users/users.py b/erpnext/utilities/page/users/users.py
index f2bb1a5..6735dc0 100644
--- a/erpnext/utilities/page/users/users.py
+++ b/erpnext/utilities/page/users/users.py
@@ -83,12 +83,7 @@
 	webnotes.conn.set_value('Profile', args['user'], 'enabled', int(args.get('enabled',0)) or 0)
 
 	if args.get('new_password') and args.get('sys_admin_pwd'):
-		if cint(webnotes.conn.get_value('Control Panel',None,'sync_with_gateway')):
-			import server_tools.gateway_utils
-			res = server_tools.gateway_utils.change_password('', args['new_password'], 
-				args['user'], args['sys_admin_pwd'])
-			if 'Traceback' not in res['message']:
-				webnotes.msgprint(res['message'])
+		from webnotes.utils import cint
 		webnotes.conn.sql("update tabProfile set password=password(%s) where name=%s", 
 			(args['new_password'], args['user']))
 	else: 
@@ -103,11 +98,6 @@
 @webnotes.whitelist()
 def add_user(args):
 	args = json.loads(args)
-	# erpnext-saas
-	if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
-		from server_tools.gateway_utils import add_user_gateway
-		add_user_gateway(args)
-	
 	add_profile(args)
 	
 @webnotes.whitelist()
@@ -168,11 +158,6 @@
 	"""delete user"""
 	webnotes.conn.sql("update tabProfile set enabled=0, docstatus=2 where name=%s", 
 		webnotes.form_dict['uid'])
-	# erpnext-saas
-	if int(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
-		from server_tools.gateway_utils import remove_user_gateway
-		remove_user_gateway(webnotes.form_dict['uid'])
-
 	webnotes.login_manager.logout(user=webnotes.form_dict['uid'])
 	
 welcome_txt = """
diff --git a/erpnext/utilities/page/wip_monitor/wip_monitor.js b/erpnext/utilities/page/wip_monitor/wip_monitor.js
index 9e7bdd0..fcfc96f 100644
--- a/erpnext/utilities/page/wip_monitor/wip_monitor.js
+++ b/erpnext/utilities/page/wip_monitor/wip_monitor.js
@@ -39,7 +39,7 @@
 {
 	var me = this;
 	// list of doctypes which user can read
-	var can_read_dt = ['Lead', 'Enquiry', 'Sales Order', 'Receivable Voucher', 'Indent', 'Purchase Order', 'Payable Voucher', 'Delivery Note', 'Task', 'Serial No'];
+	var can_read_dt = ['Lead', 'Opportunity', 'Sales Order', 'Sales Invoice', 'Purchase Request', 'Purchase Order', 'Purchase Invoice', 'Delivery Note', 'Task', 'Serial No'];
   
 	$i('wip_body').innerHTML = '';
 	this.tab = make_table('wip_body',1,0,'100%',[],{padding:'4px'});
@@ -70,7 +70,7 @@
 	var report_dt
   
 	// dictionary for labels to be displayed
-	var wip_lbl_map = {'Lead':'Lead', 'Enquiry':'Enquiries', 'Sales Order':'Sales Order', 'Receivable Voucher':'Invoices', 'Indent':'Indent', 'Purchase Order':'Purchase Order', 'Payable Voucher':'Bills', 'Delivery Note':'Delivery Note', 'Task':'Tasks', 'Serial No':'Maintenance'};
+	var wip_lbl_map = {'Lead':'Lead', 'Opportunity':'Enquiries', 'Sales Order':'Sales Order', 'Sales Invoice':'Invoices', 'Purchase Request':'Purchase Request', 'Purchase Order':'Purchase Order', 'Purchase Invoice':'Bills', 'Delivery Note':'Delivery Note', 'Task':'Tasks', 'Serial No':'Maintenance'};
 
 	// header
 	var h = $a(parent,'h3');
diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py
index 032b52f..eecbb06 100644
--- a/erpnext/utilities/transaction_base.py
+++ b/erpnext/utilities/transaction_base.py
@@ -33,9 +33,9 @@
 		self.doc.contact_display = contact_text or ''
 		self.doc.contact_email = contact_email or ''
 		self.doc.contact_mobile = contact_mobile or ''
-	
-		self.get_customer_details(self.doc.customer)
+
 		if args != 'onload':
+			self.get_customer_details(self.doc.customer)
 			self.get_sales_person(self.doc.customer)
 		
 	# Get Customer Default Shipping Address - first load
@@ -50,8 +50,8 @@
 		self.doc.contact_email = contact_email or ''
 		self.doc.contact_mobile = contact_mobile or ''
 		
-		self.get_customer_details(self.doc.customer)
 		if self.doc.doctype != 'Quotation' and args != 'onload':
+			self.get_customer_details(self.doc.customer)
 			self.get_sales_person(self.doc.customer)			
 
 	# Get Customer Address
@@ -118,13 +118,18 @@
 	# Get Customer Details
 	# -----------------------
 	def get_customer_details(self, name):		
-		customer_details = webnotes.conn.sql("select customer_name, customer_group, territory, default_sales_partner, default_commission_rate from tabCustomer where name = '%s' and docstatus != 2" %(name), as_dict = 1)
+		customer_details = webnotes.conn.sql("select customer_name, customer_group, territory, default_sales_partner, default_commission_rate, default_price_list from tabCustomer where name = '%s' and docstatus != 2" %(name), as_dict = 1)
 		if customer_details:
 			self.doc.customer_name = customer_details[0]['customer_name'] or ''
 			self.doc.customer_group = customer_details[0]['customer_group'] or ''
 			self.doc.territory = customer_details[0]['territory'] or ''
 			self.doc.sales_partner = customer_details[0]['default_sales_partner'] or ''
 			self.doc.commission_rate = customer_details[0]['default_commission_rate'] or ''
+			def_price_list = customer_details[0]['default_price_list'] or ''
+			if not def_price_list:
+				cg_price_list = webnotes.conn.sql("select default_price_list from `tabCustomer Group` where name = %s", customer_details[0]['customer_group'])
+				def_price_list = cg_price_list and cg_price_list[0][0] or ''
+			self.doc.price_list_name = def_price_list or self.doc.price_list_name
 			
 	# Get Customer Shipping Address
 	# -----------------------
diff --git a/erpnext/website/Module Def/Website/Website.txt b/erpnext/website/Module Def/Website/Website.txt
deleted file mode 100644
index e423869..0000000
--- a/erpnext/website/Module Def/Website/Website.txt
+++ /dev/null
@@ -1,142 +0,0 @@
-# Module Def, Website
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-01-23 17:05:32',
-		'docstatus': 0,
-		'modified': '2012-02-02 13:23:41',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'name': '__common__',
-		'parent': 'Website',
-		'parentfield': 'roles',
-		'parenttype': 'Module Def'
-	},
-
-	# These values are common for all Module Def Item
-	{
-		'doctype': 'Module Def Item',
-		'name': '__common__',
-		'parent': 'Website',
-		'parentfield': 'items',
-		'parenttype': 'Module Def'
-	},
-
-	# These values are common for all Module Def
-	{
-		'disabled': 'No',
-		'doctype': u'Module Def',
-		'is_hidden': 'No',
-		'module_label': 'Website',
-		'module_name': 'Website',
-		'name': '__common__'
-	},
-
-	# Module Def, Website
-	{
-		'doctype': u'Module Def',
-		'name': 'Website'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Web Page',
-		'doc_name': 'Web Page',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Product',
-		'doc_name': 'Product',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Blog',
-		'doc_name': 'Blog',
-		'doc_type': 'Forms',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Style Settings',
-		'doc_name': 'Style Settings',
-		'doc_type': 'Single DocType',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Website Settings',
-		'doc_name': 'Website Settings',
-		'doc_type': 'Single DocType',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Home Settings',
-		'doc_name': 'Home Settings',
-		'doc_type': 'Single DocType',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'About Us Settings',
-		'doc_name': 'About Us Settings',
-		'doc_type': 'Single DocType',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Contact Us Settings',
-		'doc_name': 'Contact Us Settings',
-		'doc_type': 'Single DocType',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Item
-	{
-		'display_name': 'Products Settings',
-		'doc_name': 'Products Settings',
-		'doc_type': 'Single DocType',
-		'doctype': 'Module Def Item'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'System Manager'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'System Manager'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Website Manager'
-	},
-
-	# Module Def Role
-	{
-		'doctype': 'Module Def Role',
-		'role': 'Website Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/website/Role/Blogger/Blogger.txt b/erpnext/website/Role/Blogger/Blogger.txt
deleted file mode 100644
index a380d4c..0000000
--- a/erpnext/website/Role/Blogger/Blogger.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Blogger
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-01-27 12:22:24',
-		'docstatus': 0,
-		'modified': '2012-01-27 12:22:24',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': u'Website',
-		'name': '__common__',
-		'role_name': u'Blogger'
-	},
-
-	# Role, Blogger
-	{
-		'doctype': 'Role',
-		'name': u'Blogger'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/website/Role/Website Manager/Website Manager.txt b/erpnext/website/Role/Website Manager/Website Manager.txt
deleted file mode 100644
index ad1ad9a..0000000
--- a/erpnext/website/Role/Website Manager/Website Manager.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Role, Website Manager
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-01-24 10:18:47',
-		'docstatus': 0,
-		'modified': '2012-02-06 15:22:27',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all Role
-	{
-		'doctype': 'Role',
-		'module': u'Website',
-		'name': '__common__',
-		'role_name': u'Website Manager'
-	},
-
-	# Role, Website Manager
-	{
-		'doctype': 'Role',
-		'name': u'Website Manager'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/website/__init__.py b/erpnext/website/__init__.py
index e69de29..97062cf 100644
--- a/erpnext/website/__init__.py
+++ b/erpnext/website/__init__.py
@@ -0,0 +1,4 @@
+install_docs = [
+	{"doctype":"Role", "role_name":"Blogger", "name":"Blogger"},
+	{"doctype":"Role", "role_name":"Website Manager", "name":"Website Manager"},
+]
diff --git a/erpnext/website/css/website.css b/erpnext/website/css/website.css
index 693b8fb..1fd0bb0 100644
--- a/erpnext/website/css/website.css
+++ b/erpnext/website/css/website.css
@@ -1,17 +1,13 @@
+div#body_div, header .container, .content, #opened-page-selector, footer {
+	width: 900px;
+}
+
 .layout_wrapper {
-	padding: 20px;
+	padding: 27px;
 }
 
-h1 {
-	margin-bottom: 15px;
-}
-
-h2 {
-	margin-bottom: 11px;
-}
-
-h3 {
-	margin-bottom: 7px;
+p, li {
+	line-height: 1.6em;
 }
 
 pre {
@@ -46,6 +42,7 @@
 	margin-right: 15px;
 	color: #606060;
 	overflow-x: hidden;
+	font-size: 90%;
 }
 
 .web-page-status {
@@ -109,4 +106,43 @@
 
 .web-footer-menu ul li:last-child {
 	border-right: 0px solid #777 !important;
-}
\ No newline at end of file
+}
+
+/* slide view */
+
+.next-slide {
+	margin: 0px -27px 100px -27px;
+	background: #ffffff; /* Old browsers */
+	background: -moz-linear-gradient(top,  #eeeeee 0%, #fff 100%); /* FF3.6+ */
+	background: -webkit-linear-gradient(top,  #eeeeee 0%, #fff 100%); /* Chrome10+,Safari5.1+ */
+	background: -o-linear-gradient(top,  #eeeeee 0%, #fff 100%); /* Opera 11.10+ */
+	background: -ms-linear-gradient(top,  #eeeeee 0%, #fff 100%); /* IE10+ */
+	background: linear-gradient(top,  #eeeeee 0%, #fff 100%); /* W3C */
+	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#fff',GradientType=0 ); /* IE6-9 */
+	height: 36px;
+}
+
+.slide-shadow {
+	background: #eeeeee; /* Old browsers */
+	background: -moz-linear-gradient(top,  #bababa 0%,#eeeeee 100%); /* FF3.6+ */
+	background: -webkit-linear-gradient(top,  #bababa 0%,#eeeeee 100%); /* Chrome10+,Safari5.1+ */
+	background: -o-linear-gradient(top,  #bababa 0%,#eeeeee 100%); /* Opera 11.10+ */
+	background: -ms-linear-gradient(top,  #bababa 0%,#eeeeee 100%); /* IE10+ */
+	background: linear-gradient(top,  #bababa 0%,#eeeeee 100%); /* W3C */
+	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#bababa', endColorstr='#eeeeee',GradientType=0 ); /* IE6-9 */	
+	height: 3px;
+	margin: 100px -27px 0px -27px;
+	border-top: 1px solid #bababa;
+}
+
+.two-column {
+	width: 40%;
+	float: left;
+	padding: 5%;
+}
+
+.clear {
+	clear: both;
+}
+
+/* */
\ No newline at end of file
diff --git a/erpnext/website/doctype/about_us_settings/about_us_settings.txt b/erpnext/website/doctype/about_us_settings/about_us_settings.txt
index 5ecae16..1682ca3 100644
--- a/erpnext/website/doctype/about_us_settings/about_us_settings.txt
+++ b/erpnext/website/doctype/about_us_settings/about_us_settings.txt
@@ -3,103 +3,103 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-01-27 10:13:16',
+		'creation': '2012-03-27 14:36:47',
 		'docstatus': 0,
-		'modified': '2012-01-27 11:36:44',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:47',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1327641155',
+		'_last_update': u'1327641155',
 		'allow_attach': 1,
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'issingle': 1,
 		'max_attachments': 10,
-		'module': 'Website',
+		'module': u'Website',
 		'name': '__common__',
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
 		'version': 4
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'About Us Settings',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'About Us Settings',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'About Us Settings',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'About Us Settings',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
-		'role': 'Website Manager',
+		'role': u'Website Manager',
 		'write': 1
 	},
 
 	# DocType, About Us Settings
 	{
 		'doctype': 'DocType',
-		'name': 'About Us Settings'
+		'name': u'About Us Settings'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm'
+		'doctype': u'DocPerm'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'headline',
-		'fieldtype': 'Data',
-		'label': 'Headline'
+		'doctype': u'DocField',
+		'fieldname': u'headline',
+		'fieldtype': u'Data',
+		'label': u'Headline'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'main_section',
-		'fieldtype': 'Code',
-		'label': 'Main Section'
+		'doctype': u'DocField',
+		'fieldname': u'main_section',
+		'fieldtype': u'Code',
+		'label': u'Main Section'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'team',
-		'fieldtype': 'Table',
-		'label': 'Team',
-		'options': 'About Us Team'
+		'doctype': u'DocField',
+		'fieldname': u'team',
+		'fieldtype': u'Table',
+		'label': u'Team',
+		'options': u'About Us Team'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'side_section',
-		'fieldtype': 'Code',
-		'label': 'Side Section'
+		'doctype': u'DocField',
+		'fieldname': u'side_section',
+		'fieldtype': u'Code',
+		'label': u'Side Section'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'file_list',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'label': 'File List',
+		'label': u'File List',
 		'no_copy': 1,
 		'print_hide': 1
 	}
diff --git a/erpnext/website/doctype/about_us_settings/template.html b/erpnext/website/doctype/about_us_settings/template.html
index 864fb65..404ebe9 100644
--- a/erpnext/website/doctype/about_us_settings/template.html
+++ b/erpnext/website/doctype/about_us_settings/template.html
@@ -1,9 +1,10 @@
-<div class="layout_wrapper">
+<div class="layout-wrapper layout-wrapper-background">
 	<div class="web-content" id="content-about-us">
-		{% if doc.headline %}
-			<h1>{{ doc.headline }}</h1>
-		{% endif %}
-		<div class="web-main-section">
+		<div class="layout-main-section">
+			{% if doc.headline %}
+				<h1>{{ doc.headline }}</h1>
+			{% endif %}
+			
 			{{ doc.main_section_html }}
 			
 			{% if doc.about_team %}
@@ -28,7 +29,7 @@
 				</table>
 			{% endif %}
 		</div>
-		<div class="web-side-section">
+		<div class="layout-side-section">
 			{{ doc.side_section_html }}
 		</div>
 		<div style="clear: both"></div>
diff --git a/erpnext/website/doctype/about_us_team/about_us_team.txt b/erpnext/website/doctype/about_us_team/about_us_team.txt
index bbbf47d..3e60290 100644
--- a/erpnext/website/doctype/about_us_team/about_us_team.txt
+++ b/erpnext/website/doctype/about_us_team/about_us_team.txt
@@ -3,72 +3,72 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-01-27 10:14:18',
+		'creation': '2012-03-27 14:36:47',
 		'docstatus': 0,
-		'modified': '2012-01-27 11:54:18',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:47',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Website',
+		'module': u'Website',
 		'name': '__common__',
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
 		'version': 5
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'About Us Team',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'About Us Team',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# DocType, About Us Team
 	{
 		'doctype': 'DocType',
-		'name': 'About Us Team'
+		'name': u'About Us Team'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'person_name',
-		'fieldtype': 'Data',
-		'label': 'Person Name'
+		'doctype': u'DocField',
+		'fieldname': u'person_name',
+		'fieldtype': u'Data',
+		'label': u'Person Name'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'designation',
-		'fieldtype': 'Data',
-		'label': 'Designation'
+		'doctype': u'DocField',
+		'fieldname': u'designation',
+		'fieldtype': u'Data',
+		'label': u'Designation'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'image',
-		'fieldtype': 'Select',
-		'label': 'Image',
-		'options': 'attach_files:'
+		'doctype': u'DocField',
+		'fieldname': u'image',
+		'fieldtype': u'Select',
+		'label': u'Image',
+		'options': u'attach_files:'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'bio',
-		'fieldtype': 'Text',
-		'label': 'Bio (markdown)',
-		'width': '300px'
+		'doctype': u'DocField',
+		'fieldname': u'bio',
+		'fieldtype': u'Text',
+		'label': u'Bio (markdown)',
+		'width': u'300px'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/website/doctype/blog/blog.txt b/erpnext/website/doctype/blog/blog.txt
index 59444f8..f9ff6fd 100644
--- a/erpnext/website/doctype/blog/blog.txt
+++ b/erpnext/website/doctype/blog/blog.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-01-27 12:24:03',
+		'creation': '2012-03-27 14:36:47',
 		'docstatus': 0,
-		'modified': '2012-02-07 13:55:17',
+		'modified': '2012-03-27 14:36:47',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -35,12 +35,15 @@
 
 	# These values are common for all DocPerm
 	{
+		'create': 1,
 		'doctype': u'DocPerm',
 		'name': '__common__',
 		'parent': u'Blog',
 		'parentfield': u'permissions',
 		'parenttype': u'DocType',
-		'read': 1
+		'permlevel': 0,
+		'read': 1,
+		'write': 1
 	},
 
 	# DocType, Blog
@@ -51,27 +54,14 @@
 
 	# DocPerm
 	{
-		'create': 1,
 		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Website Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Blogger',
-		'write': 1
+		'role': u'Website Manager'
 	},
 
 	# DocPerm
 	{
 		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'All'
+		'role': u'Blogger'
 	},
 
 	# DocField
diff --git a/erpnext/website/doctype/blog/blog_page.js b/erpnext/website/doctype/blog/blog_page.js
index 76cbf81..aa3f4c5 100644
--- a/erpnext/website/doctype/blog/blog_page.js
+++ b/erpnext/website/doctype/blog/blog_page.js
@@ -21,7 +21,7 @@
 	var side = $(wrapper).find('.web-side-section')
 		.append('<h4>Recent Posts</h4>').get(0);
 		
-	wrapper.recent_list = new wn.widgets.Listing({
+	wrapper.recent_list = new wn.ui.Listing({
 		parent: side,
 		query: 'select name, title, left(content, 100) as content from tabBlog\
 			where ifnull(published,1)=1',
@@ -39,10 +39,10 @@
 	// comments
 	$(wrapper).find('.web-main-section').append('<hr><h3>Comments</h3>');
 
-	wrapper.comment_list = new wn.widgets.Listing({
+	wrapper.comment_list = new wn.ui.Listing({
 		parent: $(wrapper).find('.web-main-section').get(0),
 		query: 'select comment, comment_by_fullname, modified\
-			from `tabComment Widget Record` where comment_doctype="Page"\
+			from `tabComment` where comment_doctype="Page"\
 			and comment_docname="{{ doc.name }}"',
 		no_result_message: 'Be the first one to comment',
 		render_row: function(parent, data) {
diff --git a/erpnext/website/doctype/blog/template.html b/erpnext/website/doctype/blog/template.html
index 1b81fe2..467f301 100644
--- a/erpnext/website/doctype/blog/template.html
+++ b/erpnext/website/doctype/blog/template.html
@@ -1,13 +1,13 @@
-<div class="layout_wrapper">
+<div class="layout-wrapper layout-wrapper-background">
 	<div class="web-content" id="blog-{{ doc.name }}">
-		<h1>Blog</h1>
-		<div class="web-main-section">
+		<div class="layout-main-section">
+			<h1>Blog</h1>
 			<h3>{{ doc.title }}</h3>
 			<div class="help">By {{ doc.full_name }} on {{ doc.updated }}</div>
 			<br>
 			{{ doc.content_html }}
 		</div>
-		<div class="web-side-section">
+		<div class="layout-side-section">
 			<p><a href="#!blog">All Blogs</a></p>
 			<h4>Subscribe</h4>
 			<p>
diff --git a/erpnext/website/doctype/blog_subscriber/blog_subscriber.txt b/erpnext/website/doctype/blog_subscriber/blog_subscriber.txt
index 1b4a987..1fa8223 100644
--- a/erpnext/website/doctype/blog_subscriber/blog_subscriber.txt
+++ b/erpnext/website/doctype/blog_subscriber/blog_subscriber.txt
@@ -3,20 +3,20 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-01-27 17:18:33',
+		'creation': '2012-03-27 14:36:47',
 		'docstatus': 0,
-		'modified': '2012-01-27 17:18:33',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:47',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'module': 'Website',
+		'module': u'Website',
 		'name': '__common__',
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
 		'version': 1
 	},
@@ -24,6 +24,6 @@
 	# DocType, Blog Subscriber
 	{
 		'doctype': 'DocType',
-		'name': 'Blog Subscriber'
+		'name': u'Blog Subscriber'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/website/doctype/contact_us_settings/contact_us_settings.txt b/erpnext/website/doctype/contact_us_settings/contact_us_settings.txt
index ff43a0a..bb518b6 100644
--- a/erpnext/website/doctype/contact_us_settings/contact_us_settings.txt
+++ b/erpnext/website/doctype/contact_us_settings/contact_us_settings.txt
@@ -3,45 +3,45 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-01-25 16:01:33',
+		'creation': '2012-03-27 14:36:47',
 		'docstatus': 0,
-		'modified': '2012-01-25 16:01:33',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:47',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
-		'document_type': 'Other',
+		'document_type': u'Other',
 		'issingle': 1,
-		'module': 'Website',
+		'module': u'Website',
 		'name': '__common__',
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
 		'version': 1
 	},
 
 	# These values are common for all DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Contact Us Settings',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Contact Us Settings',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Contact Us Settings',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Contact Us Settings',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'permlevel': 0,
 		'read': 1,
 		'write': 1
@@ -50,51 +50,51 @@
 	# DocType, Contact Us Settings
 	{
 		'doctype': 'DocType',
-		'name': 'Contact Us Settings'
+		'name': u'Contact Us Settings'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'role': 'Website Manager'
+		'doctype': u'DocPerm',
+		'role': u'Website Manager'
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
-		'role': 'System Manager'
+		'doctype': u'DocPerm',
+		'role': u'System Manager'
 	},
 
 	# DocField
 	{
-		'default': 'Contact Us',
-		'doctype': 'DocField',
-		'fieldname': 'headline',
-		'fieldtype': 'Data',
-		'label': 'Headline'
+		'default': u'Contact Us',
+		'doctype': u'DocField',
+		'fieldname': u'headline',
+		'fieldtype': u'Data',
+		'label': u'Headline'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'send_email_notification',
-		'fieldtype': 'Check',
-		'label': 'Send Email Notification'
+		'doctype': u'DocField',
+		'fieldname': u'send_email_notification',
+		'fieldtype': u'Check',
+		'label': u'Send Email Notification'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'main_section',
-		'fieldtype': 'Code',
-		'label': 'Main Section'
+		'doctype': u'DocField',
+		'fieldname': u'main_section',
+		'fieldtype': u'Code',
+		'label': u'Main Section'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'side_section',
-		'fieldtype': 'Code',
-		'label': 'Side Section'
+		'doctype': u'DocField',
+		'fieldname': u'side_section',
+		'fieldtype': u'Code',
+		'label': u'Side Section'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/website/doctype/contact_us_settings/template.html b/erpnext/website/doctype/contact_us_settings/template.html
index 6453784..508b534 100644
--- a/erpnext/website/doctype/contact_us_settings/template.html
+++ b/erpnext/website/doctype/contact_us_settings/template.html
@@ -1,9 +1,9 @@
-<div class="layout_wrapper">
+<div class="layout-wrapper layout-wrapper-background">
 	<div class="web-content" id="content-contact-us">
-		{% if doc.headline %}
-			<h1>{{ doc.headline }}</h1>
-		{% endif %}
-		<div class="web-main-section">
+		<div class="layout-main-section">
+			{% if doc.headline %}
+				<h1>{{ doc.headline }}</h1>
+			{% endif %}
 			<label>Your Name*</label>
 			<div><input name="contact-name" type="text"/></div>
 			<br>
@@ -16,7 +16,7 @@
 			<div><button class="btn primary">Send</button></div>
 			{{ doc.main_section_html }}
 		</div>
-		<div class="web-side-section">
+		<div class="layout-side-section">
 			{{ doc.side_section_html }}
 		</div>
 		<div style="clear: both"></div>
diff --git a/erpnext/website/doctype/product/product.txt b/erpnext/website/doctype/product/product.txt
index 1c2b472..7d9c770 100644
--- a/erpnext/website/doctype/product/product.txt
+++ b/erpnext/website/doctype/product/product.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-02-17 15:53:22',
+		'creation': '2012-03-27 14:36:47',
 		'docstatus': 0,
-		'modified': '2012-02-22 18:32:46',
+		'modified': '2012-03-27 14:36:47',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -38,13 +38,17 @@
 
 	# These values are common for all DocPerm
 	{
+		'amend': 0,
+		'create': 1,
 		'doctype': u'DocPerm',
 		'name': '__common__',
 		'parent': u'Product',
 		'parentfield': u'permissions',
 		'parenttype': u'DocType',
+		'permlevel': 0,
 		'read': 1,
-		'role': u'Website Manager'
+		'submit': 0,
+		'write': 1
 	},
 
 	# DocType, Product
@@ -55,16 +59,23 @@
 
 	# DocPerm
 	{
-		'create': 1,
+		'cancel': 0,
 		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'write': 1
+		'role': u'Sales Manager'
 	},
 
 	# DocPerm
 	{
+		'cancel': 0,
 		'doctype': u'DocPerm',
-		'permlevel': 1
+		'role': u'Sales User'
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'doctype': u'DocPerm',
+		'role': u'Website Manager'
 	},
 
 	# DocField
@@ -124,6 +135,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'column_break0',
 		'fieldtype': u'Column Break',
 		'permlevel': 0
 	},
@@ -166,6 +178,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'section_break0',
 		'fieldtype': u'Section Break',
 		'permlevel': 0
 	},
@@ -185,6 +198,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'section_break1',
 		'fieldtype': u'Section Break',
 		'permlevel': 0
 	},
@@ -249,4 +263,4 @@
 		'permlevel': 0,
 		'print_hide': 1
 	}
-]
+]
\ No newline at end of file
diff --git a/erpnext/website/doctype/product/product_page.js b/erpnext/website/doctype/product/product_page.js
index 0f0c56b..926ef69 100644
--- a/erpnext/website/doctype/product/product_page.js
+++ b/erpnext/website/doctype/product/product_page.js
@@ -30,7 +30,7 @@
 	});
 	
 	// similar products
-	wrapper.similar = new wn.widgets.Listing({
+	wrapper.similar = new wn.ui.Listing({
 		parent: $(wrapper).find('.similar-products').get(0),
 		hide_refresh: true,
 		page_length: 5,
diff --git a/erpnext/website/doctype/product_group/product_group.txt b/erpnext/website/doctype/product_group/product_group.txt
index b26ec13..e199b86 100644
--- a/erpnext/website/doctype/product_group/product_group.txt
+++ b/erpnext/website/doctype/product_group/product_group.txt
@@ -3,55 +3,55 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-01-30 12:17:12',
+		'creation': '2012-03-27 14:36:48',
 		'docstatus': 0,
-		'modified': '2012-01-30 12:17:12',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-03-27 14:36:48',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'colour': 'White:FFF',
+		'colour': u'White:FFF',
 		'doctype': 'DocType',
 		'istable': 1,
-		'module': 'Website',
+		'module': u'Website',
 		'name': '__common__',
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
 		'version': 1
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Product Group',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Product Group',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# DocType, Product Group
 	{
 		'doctype': 'DocType',
-		'name': 'Product Group'
+		'name': u'Product Group'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'item_group',
-		'fieldtype': 'Link',
-		'label': 'Item Group',
-		'options': 'Item Group'
+		'doctype': u'DocField',
+		'fieldname': u'item_group',
+		'fieldtype': u'Link',
+		'label': u'Item Group',
+		'options': u'Item Group'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'label',
-		'fieldtype': 'Data',
-		'label': 'Label'
+		'doctype': u'DocField',
+		'fieldname': u'label',
+		'fieldtype': u'Data',
+		'label': u'Label'
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/website/doctype/products_settings/products_settings.txt b/erpnext/website/doctype/products_settings/products_settings.txt
index aa0fbb3..31d2074 100644
--- a/erpnext/website/doctype/products_settings/products_settings.txt
+++ b/erpnext/website/doctype/products_settings/products_settings.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-01-30 12:15:00',
+		'creation': '2012-03-27 14:36:48',
 		'docstatus': 0,
-		'modified': '2012-02-14 14:29:41',
+		'modified': '2012-03-27 14:36:48',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
diff --git a/erpnext/website/doctype/related_page/related_page.txt b/erpnext/website/doctype/related_page/related_page.txt
index 67a30b7..b107286 100644
--- a/erpnext/website/doctype/related_page/related_page.txt
+++ b/erpnext/website/doctype/related_page/related_page.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-02-01 16:16:47',
+		'creation': '2012-03-27 14:36:48',
 		'docstatus': 0,
-		'modified': '2012-02-06 12:24:29',
+		'modified': '2012-03-27 14:36:48',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
diff --git a/erpnext/website/doctype/style_settings/custom_template.css b/erpnext/website/doctype/style_settings/custom_template.css
index 8eb3d63..72c15a1 100644
--- a/erpnext/website/doctype/style_settings/custom_template.css
+++ b/erpnext/website/doctype/style_settings/custom_template.css
@@ -5,13 +5,19 @@
 	background-color: #{{ doc.background_color }};
 {% endif %}	
 {% if doc.font %}
-	font-family: {{ doc.font }} !important;
+	font-family: '{{ doc.font }}', Verdana, Sans !important;
 {% endif %}
 {% if doc.font_size %}
 	font-size: {{ doc.font_size }} !important;
 {% endif %}
 }
 
+{% if doc.font_size %}
+.small {
+	font-size: {{ doc.small_font_size }} !important;
+}
+{% endif %}
+
 {% if doc.footer_font_color %}
 footer {
 	color: {{ doc.footer_font_color }};
@@ -26,6 +32,6 @@
 
 {% if doc.heading_font %}
 h1, h2, h3, h4, h5 {
-	font-family: {{ doc.heading_font}} !important;
+	font-family: '{{ doc.heading_font}}', Arial, 'Helvetica Neue' !important;
 }	
 {% endif %}
diff --git a/erpnext/website/doctype/style_settings/style_settings.py b/erpnext/website/doctype/style_settings/style_settings.py
index 83961e0..282cd93 100644
--- a/erpnext/website/doctype/style_settings/style_settings.py
+++ b/erpnext/website/doctype/style_settings/style_settings.py
@@ -25,9 +25,13 @@
 		with open('erpnext/website/doctype/style_settings/custom_template.css', 'r') as f:
 			temp = Template(f.read())
 		
+		self.doc.small_font_size = str(int(self.doc.font_size[:-2])-2) + 'px'
+		
 		self.doc.custom_css = temp.render(doc = self.doc)
 		
 		from webnotes.session_cache import clear_cache
 		clear_cache('Guest')
 		
+		del self.doc.fields['small_font_size']
+		
 		
\ No newline at end of file
diff --git a/erpnext/website/doctype/style_settings/style_settings.txt b/erpnext/website/doctype/style_settings/style_settings.txt
index f07a947..b87a02c 100644
--- a/erpnext/website/doctype/style_settings/style_settings.txt
+++ b/erpnext/website/doctype/style_settings/style_settings.txt
@@ -3,152 +3,152 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-02-02 09:57:25',
+		'creation': '2012-04-02 16:02:43',
 		'docstatus': 0,
-		'modified': '2012-02-02 10:47:38',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-16 13:36:48',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1328159294',
+		'_last_update': u'1330594969',
 		'allow_attach': 1,
-		'colour': 'White:FFF',
-		'description': 'Set your background color, font and image (tiled)',
+		'colour': u'White:FFF',
+		'description': u'Set your background color, font and image (tiled)',
 		'doctype': 'DocType',
 		'issingle': 1,
 		'max_attachments': 1,
-		'module': 'Website',
+		'module': u'Website',
 		'name': '__common__',
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
-		'version': 9
+		'version': 19
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Style Settings',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Style Settings',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Style Settings',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Style Settings',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1,
-		'role': 'Website Manager'
+		'role': u'Website Manager'
 	},
 
 	# DocType, Style Settings
 	{
 		'doctype': 'DocType',
-		'name': 'Style Settings'
+		'name': u'Style Settings'
 	},
 
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Solid background color (default light gray)',
-		'doctype': 'DocField',
-		'fieldname': 'background_color',
-		'fieldtype': 'Data',
-		'label': 'Background Color',
+		'colour': u'White:FFF',
+		'description': u'If image is selected, color will be ignored (attach first)',
+		'doctype': u'DocField',
+		'fieldname': u'background_image',
+		'fieldtype': u'Select',
+		'label': u'Background Image',
+		'options': u'attach_files:',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'If image is selected, color will be ignored (attach first)',
-		'doctype': 'DocField',
-		'fieldname': 'background_image',
-		'fieldtype': 'Select',
-		'label': 'Background Image',
-		'options': 'attach_files:',
+		'colour': u'White:FFF',
+		'description': u'Solid background color (default light gray)',
+		'doctype': u'DocField',
+		'fieldname': u'background_color',
+		'fieldtype': u'Data',
+		'label': u'Background Color',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'font',
-		'fieldtype': 'Select',
-		'label': 'Font',
-		'options': '\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma',
+		'doctype': u'DocField',
+		'fieldname': u'font',
+		'fieldtype': u'Select',
+		'label': u'Font',
+		'options': u'\nHelvetica Neue\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma\nLato\nOpen Sans',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'font_size',
-		'fieldtype': 'Select',
-		'label': 'Font Size',
-		'options': '\n12px\n13px\n14px',
+		'doctype': u'DocField',
+		'fieldname': u'font_size',
+		'fieldtype': u'Select',
+		'label': u'Font Size',
+		'options': u'\n12px\n13px\n14px\n15px\n16px',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'heading_font',
-		'fieldtype': 'Select',
-		'label': 'Heaing Font',
-		'options': '\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma',
+		'doctype': u'DocField',
+		'fieldname': u'heading_font',
+		'fieldtype': u'Select',
+		'label': u'Heading Font',
+		'options': u'\nHelvetica Neue\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma\nLato\nOpen Sans',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Select a white footer foreground color if you have a dark background',
-		'doctype': 'DocField',
-		'fieldname': 'footer_font_color',
-		'fieldtype': 'Select',
-		'label': 'Footer Font Color',
-		'options': '\nwhite',
+		'colour': u'White:FFF',
+		'description': u'Select a white footer foreground color if you have a dark background',
+		'doctype': u'DocField',
+		'fieldname': u'footer_font_color',
+		'fieldtype': u'Select',
+		'label': u'Footer Font Color',
+		'options': u'\nwhite',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Auto generated',
-		'doctype': 'DocField',
-		'fieldname': 'custom_css',
-		'fieldtype': 'Code',
-		'label': 'Custom CSS',
+		'colour': u'White:FFF',
+		'description': u'Auto generated',
+		'doctype': u'DocField',
+		'fieldname': u'custom_css',
+		'fieldtype': u'Code',
+		'label': u'Custom CSS',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'file_list',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'label': 'File List',
+		'label': u'File List',
 		'no_copy': 1,
 		'permlevel': 0,
 		'print_hide': 1
diff --git a/erpnext/website/doctype/top_bar_item/top_bar_item.txt b/erpnext/website/doctype/top_bar_item/top_bar_item.txt
index 3ff23b3..632425e 100644
--- a/erpnext/website/doctype/top_bar_item/top_bar_item.txt
+++ b/erpnext/website/doctype/top_bar_item/top_bar_item.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-01-24 10:24:19',
+		'creation': '2012-03-27 14:36:48',
 		'docstatus': 0,
-		'modified': '2012-02-07 10:35:19',
+		'modified': '2012-03-27 14:36:48',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
diff --git a/erpnext/website/doctype/web_page/template.html b/erpnext/website/doctype/web_page/template.html
index 1fb613c..2c92a25 100644
--- a/erpnext/website/doctype/web_page/template.html
+++ b/erpnext/website/doctype/web_page/template.html
@@ -1,17 +1,21 @@
-<div class="layout_wrapper">
-	<div class="web-content" id="content-{{ doc.name }}">
-		{% if doc.head_section %}
-		<div class="web-head-section">
-			{{ doc.head_section_html }}
-		</div>
+<div class="layout-wrapper layout-wrapper-background">
+	<div class="web-content" id="content-{{ doc.name }}" 
+		style="text-align: {{ doc.text_align }};">
+		
+		{% if doc.layout.startswith('Two column') %}
+		<div class="layout-main-section">
+		{% else %}
+		<div class="layout-main">
 		{% endif %}
-		<div class="web-main-section">
 			{{ doc.main_section_html }}
 			{% if doc.next_page_html %}
 				{{ doc.next_page_html }}
 			{% endif %}
+
 		</div>
-		<div class="web-side-section">
+		
+		{% if doc.layout.startswith('Two column') %}
+		<div class="layout-side-section">
 			{{ doc.side_section_html }}
 			{% if doc.see_also %}
 			<div class="info-box">
@@ -20,9 +24,10 @@
 			</div>
 			{% endif %}
 		</div>
+		{% endif %}
 		<div style="clear: both"></div>
 	</div>
 </div>
-<div class="web-page-status">
+<div class="web-page-status small">
 	Last Modified: {{ doc.updated }} <a href="#contact">Feedback</a>
 </div>
diff --git a/erpnext/website/doctype/web_page/web_page.js b/erpnext/website/doctype/web_page/web_page.js
new file mode 100644
index 0000000..4429075
--- /dev/null
+++ b/erpnext/website/doctype/web_page/web_page.js
@@ -0,0 +1,15 @@
+$.extend(cur_frm.cscript, {
+	layout: function(doc) {
+		if(!doc.layout) doc.layout = 'Two column with header'
+		hide_field(['head_section', 'side_section']);
+		if(doc.layout=='Two column with header') {
+			unhide_field(['head_section', 'side_section']);
+		}
+		if(doc.layout=='Two column') {
+			unhide_field('side_section');
+		}
+	},
+	refresh: function(doc) {
+		cur_frm.cscript.layout(doc);
+	}
+})
\ No newline at end of file
diff --git a/erpnext/website/doctype/web_page/web_page.txt b/erpnext/website/doctype/web_page/web_page.txt
index 0bacc43..7c155d7 100644
--- a/erpnext/website/doctype/web_page/web_page.txt
+++ b/erpnext/website/doctype/web_page/web_page.txt
@@ -3,139 +3,193 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-01-31 15:18:49',
+		'creation': '2012-04-02 16:02:43',
 		'docstatus': 0,
-		'modified': '2012-02-02 13:15:36',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-04-10 10:41:00',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1328093379',
+		'_last_update': u'1328093379',
 		'allow_attach': 1,
-		'colour': 'White:FFF',
-		'description': 'A custom page is a simple page with the layout - headline, main section, side section\n\nEditing:\n\n- Editing is in [markdown format](http://daringfireball.net/projects/markdown/syntax)\n- You can also add images and embed html code\n\nAccessing the page:\n\n- The page can be accessed as #![page-name] after the main url\n\nIdeal for pages like FAQ, Terms, Help etc.\n\n',
+		'colour': u'White:FFF',
+		'description': u'A custom page is a simple page with the layout - headline, main section, side section\n\nEditing:\n\n- Editing is in [markdown format](http://daringfireball.net/projects/markdown/syntax)\n- You can also add images and embed html code\n\nAccessing the page:\n\n- The page can be accessed as #![page-name] after the main url\n\nIdeal for pages like FAQ, Terms and Conditions, Help etc.\n\n',
 		'doctype': 'DocType',
-		'max_attachments': 5,
-		'module': 'Website',
+		'max_attachments': 20,
+		'module': u'Website',
 		'name': '__common__',
-		'section_style': 'Simple',
+		'section_style': u'Simple',
 		'show_in_menu': 0,
-		'version': 6
+		'version': 11
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Web Page',
-		'parentfield': 'fields',
-		'parenttype': 'DocType',
+		'parent': u'Web Page',
+		'parentfield': u'fields',
+		'parenttype': u'DocType',
 		'permlevel': 0
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Web Page',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Web Page',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1,
-		'role': 'Website Manager'
+		'role': u'Website Manager'
 	},
 
 	# DocType, Web Page
 	{
 		'doctype': 'DocType',
-		'name': 'Web Page'
+		'name': u'Web Page'
 	},
 
 	# DocPerm
 	{
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Title / headline of your page',
-		'doctype': 'DocField',
-		'fieldname': 'title',
-		'fieldtype': 'Data',
-		'label': 'Title',
+		'doctype': u'DocField',
+		'fieldname': u'sb0',
+		'fieldtype': u'Section Break',
+		'label': u'Title and Style'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Title / headline of your page',
+		'doctype': u'DocField',
+		'fieldname': u'title',
+		'fieldtype': u'Data',
+		'label': u'Title',
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Section that will span 2 columns, formatted as markdown. If no head, leave blank. If you are displaying a banner, it must be 860px',
-		'doctype': 'DocField',
-		'fieldname': 'head_section',
-		'fieldtype': 'Text',
-		'label': 'Head Section'
+		'doctype': u'DocField',
+		'fieldname': u'layout',
+		'fieldtype': u'Select',
+		'label': u'Layout',
+		'options': u'Two column with header\nTwo column\nSingle column'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Content in markdown format that appears on the main side of your page',
-		'doctype': 'DocField',
-		'fieldname': 'main_section',
-		'fieldtype': 'Code',
-		'label': 'Main Section'
+		'doctype': u'DocField',
+		'fieldname': u'cb1',
+		'fieldtype': u'Column Break',
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Content in markdown format that appears on the right side',
-		'doctype': 'DocField',
-		'fieldname': 'side_section',
-		'fieldtype': 'Code',
-		'label': 'Side Section'
+		'doctype': u'DocField',
+		'fieldname': u'text_align',
+		'fieldtype': u'Select',
+		'label': u'Text Align',
+		'options': u'Left\nCenter\nRight'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Link for next page appears at the bottom of the page',
-		'doctype': 'DocField',
-		'fieldname': 'next_page',
-		'fieldtype': 'Link',
-		'label': 'Next Page',
-		'options': 'Page'
+		'colour': u'White:FFF',
+		'description': u'Page content',
+		'doctype': u'DocField',
+		'fieldname': u'sb1',
+		'fieldtype': u'Section Break',
+		'label': u'Content'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Related pages appear on the right side of the link and are linked both ways.',
-		'doctype': 'DocField',
-		'fieldname': 'related_pages',
-		'fieldtype': 'Table',
-		'label': 'Related Pages',
-		'options': 'Related Page'
+		'colour': u'White:FFF',
+		'description': u'Section that will span 2 columns, formatted as markdown. If no head, leave blank. If you are displaying a banner, it must be 860px',
+		'doctype': u'DocField',
+		'fieldname': u'head_section',
+		'fieldtype': u'Text',
+		'label': u'Head Section'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'file_list',
-		'fieldtype': 'Text',
+		'colour': u'White:FFF',
+		'description': u'Content in markdown format that appears on the main side of your page',
+		'doctype': u'DocField',
+		'fieldname': u'main_section',
+		'fieldtype': u'Code',
+		'label': u'Main Section'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Content in markdown format that appears on the right side',
+		'doctype': u'DocField',
+		'fieldname': u'side_section',
+		'fieldtype': u'Code',
+		'label': u'Side Section'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Link to other pages in the side bar and next section',
+		'doctype': u'DocField',
+		'fieldname': u'sb2',
+		'fieldtype': u'Section Break',
+		'label': u'Links'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Link for next page appears at the bottom of the page',
+		'doctype': u'DocField',
+		'fieldname': u'next_page',
+		'fieldtype': u'Link',
+		'label': u'Next Page',
+		'options': u'Page'
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'Related pages appear on the right side of the link and are linked both ways.',
+		'doctype': u'DocField',
+		'fieldname': u'related_pages',
+		'fieldtype': u'Table',
+		'label': u'Related Pages',
+		'options': u'Related Page'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'label': 'File List',
+		'label': u'File List',
 		'no_copy': 1,
 		'print_hide': 1
 	}
diff --git a/erpnext/website/doctype/website_settings/website_settings.txt b/erpnext/website/doctype/website_settings/website_settings.txt
index b6ea7a3..32e31c0 100644
--- a/erpnext/website/doctype/website_settings/website_settings.txt
+++ b/erpnext/website/doctype/website_settings/website_settings.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-02-02 13:19:50',
+		'creation': '2012-03-27 14:36:48',
 		'docstatus': 0,
-		'modified': '2012-02-14 16:13:59',
+		'modified': '2012-03-27 14:36:48',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -79,6 +79,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'top_bar',
 		'fieldtype': u'Section Break',
 		'label': u'Top Bar',
 		'permlevel': 0
@@ -132,6 +133,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'footer',
 		'fieldtype': u'Section Break',
 		'label': u'Footer',
 		'permlevel': 0
@@ -180,6 +182,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'domains',
 		'fieldtype': u'Section Break',
 		'label': u'Domains',
 		'permlevel': 0
@@ -210,6 +213,7 @@
 	# DocField
 	{
 		'doctype': u'DocField',
+		'fieldname': u'analytics',
 		'fieldtype': u'Section Break',
 		'label': u'Analytics',
 		'permlevel': 0
diff --git a/erpnext/website/js/product_category.js b/erpnext/website/js/product_category.js
index 9e0c7f0..956d7a6 100644
--- a/erpnext/website/js/product_category.js
+++ b/erpnext/website/js/product_category.js
@@ -18,7 +18,7 @@
 erpnext.product_item_group = {}
 
 erpnext.make_product_categories = function(wrapper) {
-	wrapper.category_list = new wn.widgets.Listing({
+	wrapper.category_list = new wn.ui.Listing({
 		parent: $(wrapper).find('.more-categories').get(0),
 		query: 'select label, count(t2.name) as items, t1.item_group \
 			from `tabProduct Group` t1, `tabProduct` t2, tabItem t3\
diff --git a/erpnext/website/js/topbar.js b/erpnext/website/js/topbar.js
index 90ad3e8..aec0f02 100644
--- a/erpnext/website/js/topbar.js
+++ b/erpnext/website/js/topbar.js
@@ -24,7 +24,7 @@
 </li>\
 */
 
-erpnext.navbar.navbar = Class.extend({
+erpnext.navbar.Navbar = Class.extend({
 	init: function() {
 		this.make();
 		$('.brand').html(wn.boot.website_settings.brand_html);
@@ -113,5 +113,5 @@
 
 $(document).bind('startup', function() {
 	erpnext.footer = new erpnext.Footer();
-	erpnext.navbar.navbar = new erpnext.navbar.navbar();	
+	erpnext.navbar.navbar = new erpnext.navbar.Navbar();	
 })
diff --git a/erpnext/website/page/blog/blog.html b/erpnext/website/page/blog/blog.html
index 79ea7f0..ffb8128 100644
--- a/erpnext/website/page/blog/blog.html
+++ b/erpnext/website/page/blog/blog.html
@@ -1,10 +1,10 @@
-<div class="layout_wrapper">
+<div class="layout-wrapper layout-wrapper-background">
 	<div class="web-content" id="content-blog">
-		<h1>Blog</h1>
-		<br>
-		<div class="web-main-section">
+		<div class="layout-main-section">
+			<h1>Blog</h1>
+			<br>
 		</div>
-		<div class="web-side-section">
+		<div class="layout-side-section">
 			<!-- for later
 			<h4>Get Updates</h4>
 			<p>
diff --git a/erpnext/website/page/blog/blog.js b/erpnext/website/page/blog/blog.js
index 9ca7392..418fc6c 100644
--- a/erpnext/website/page/blog/blog.js
+++ b/erpnext/website/page/blog/blog.js
@@ -16,8 +16,8 @@
 
 
 pscript.onload_blog = function(wrapper) {
-	wrapper.blog_list = new wn.widgets.Listing({
-		parent: $(wrapper).find('.web-main-section').get(0),
+	wrapper.blog_list = new wn.ui.Listing({
+		parent: $(wrapper).find('.layout-main-section').get(0),
 		query: 'select tabBlog.name, title, left(content, 300) as content, tabBlog.modified, \
 			ifnull(first_name, "") as first_name, ifnull(last_name, "") as last_name \
 			from tabProfile, tabBlog\
diff --git a/erpnext/website/page/products/products.js b/erpnext/website/page/products/products.js
index 7af551e..09ccba0 100644
--- a/erpnext/website/page/products/products.js
+++ b/erpnext/website/page/products/products.js
@@ -57,7 +57,7 @@
 }
 
 erpnext.products.make_product_list = function(wrapper) {
-	wrapper.mainlist = new wn.widgets.Listing({
+	wrapper.mainlist = new wn.ui.Listing({
 		parent: $(wrapper).find('.web-main-section').get(0),
 		run_btn: $(wrapper).find('.products-search .btn').get(0),
 		hide_refresh: true,
diff --git a/erpnext/website/page/website_home/website_home.html b/erpnext/website/page/website_home/website_home.html
index f7bb208..3252282 100644
--- a/erpnext/website/page/website_home/website_home.html
+++ b/erpnext/website/page/website_home/website_home.html
@@ -1,25 +1,25 @@
 <div class="layout-wrapper layout-wrapper-background">
+	<div class="appframe-area"></div>
 	<div class="layout-main-section">
-		<a class="close" onclick="window.history.back();">&times;</a>
 		<h1>Website</h1>
 		<hr>
 		<div style="width: 48%; float: left;">
 			<h4><a href="#!List/Web Page">Web Page</a></h4>
 			<p class="help">Static (content) web page</p>
+			<br>
 			<h4><a href="#!List/Product">Product</a></h4>
 			<p class="help">Product listed in catolog</p>
+			<br>
 			<h4><a href="#!List/Blog">Blog</a></h4>
 			<p class="help">Weblog (blog) entry</p>
 		</div>
 		<div style="width: 48%; float: right;">
 			<h4><a href="#!Form/Website Settings/Website Settings">Website Settings</a></h4>
 			<p class="help">Setup of top navigation bar, footer and logo</p>
-		</div>
-		<div style="width: 48%; float: right;">
+			<br>
 			<h4><a href="#!Form/Style Settings/Style Settings">Style Settings</a></h4>
 			<p class="help">Setup of fonts and background</p>
-		</div>
-		<div style="width: 48%; float: right;">
+			<br>
 			<h4><a href="#!Form/Products Settings/Products Settings">Products Settings</a></h4>
 			<p class="help">Setup product categories</p>
 		</div>
diff --git a/erpnext/website/page/website_home/website_home.js b/erpnext/website/page/website_home/website_home.js
index ec6053f..51f12ba 100644
--- a/erpnext/website/page/website_home/website_home.js
+++ b/erpnext/website/page/website_home/website_home.js
@@ -15,5 +15,6 @@
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 pscript['onload_website-home'] = function(wrapper) {
+	wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
 	erpnext.module_page.setup_page('Website', wrapper);
 }
\ No newline at end of file
diff --git a/favicon.ico b/favicon.ico
deleted file mode 100644
index 794eaaf..0000000
--- a/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/images/favicon.ico b/images/favicon.ico
new file mode 100644
index 0000000..045b1bd
--- /dev/null
+++ b/images/favicon.ico
Binary files differ
diff --git a/images/redbeech.jpg b/images/redbeech.jpg
new file mode 100644
index 0000000..2480dc9
--- /dev/null
+++ b/images/redbeech.jpg
Binary files differ
diff --git a/index.cgi b/index.cgi
index ed766eb..31da310 100755
--- a/index.cgi
+++ b/index.cgi
@@ -1,33 +1,42 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+# Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com)
 # 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# MIT License (MIT)
 # 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Permission is hereby granted, free of charge, to any person obtaining a 
+# copy of this software and associated documentation files (the "Software"), 
+# to deal in the Software without restriction, including without limitation 
+# the rights to use, copy, modify, merge, publish, distribute, sublicense, 
+# and/or sell copies of the Software, and to permit persons to whom the 
+# Software is furnished to do so, subject to the following conditions:
 # 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# The above copyright notice and this permission notice shall be included in 
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
+# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
+# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 
+# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
+# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+# 
 
 
 import cgi, cgitb, os, sys
 cgitb.enable()
 
 # import libs
+sys.path.append('.')
+
+import conf
+
 sys.path.append('lib/py')
-sys.path.append('erpnext')
+sys.path.append(conf.modules_path)
 
 import webnotes
 import webnotes.handler
 import webnotes.auth
-import webnotes.defs
 
 def init():
 	# make the form_dict
@@ -42,7 +51,7 @@
 	except webnotes.AuthenticationError, e:
 		return True
 	except webnotes.UnknownDomainError, e:
-		print "Location: " + (webnotes.defs.redirect_404)
+		print "Location: " + (conf.redirect_404)
 	except webnotes.SessionStopped, e:
 		if 'cmd' in webnotes.form_dict:
 			webnotes.handler.print_json()
diff --git a/js/all-app.js b/js/all-app.js
index 6987da6..8c1058b 100644
--- a/js/all-app.js
+++ b/js/all-app.js
Binary files differ
diff --git a/js/all-web.js b/js/all-web.js
index 5133644..8628f45 100644
--- a/js/all-web.js
+++ b/js/all-web.js
@@ -1,7 +1,8 @@
 
 /*
  *	lib/js/lib/history/history.min.js
- *//*
+ */
+/*
  * jQuery hashchange event - v1.3 - 7/21/2010
  * http://benalman.com/projects/jquery-hashchange-plugin/
  * 
@@ -11,56 +12,17 @@
  */
 (function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);
 
-// manage history
-// load pages via ajax
-// setup the history adapter
-// if settings no_history is set, no history will be bound
-// this can be used to make it work with legacy
 
-$(document).bind('ready', function() {
-	// standard page openener
-	$(window).bind('hashchange', function() {
-		if(wn.settings.no_history) 
-			return;
-
-		// load the state on the browser	
-		wn.page.set(location.hash);
-	});	
-})
 
 /*
  *	lib/js/lib/bootstrap.min.js
- */!function(a){a(function(){"use strict",a.support.transition=function(){var b=document.body||document.documentElement,c=b.style,d=c.transition!==undefined||c.WebkitTransition!==undefined||c.MozTransition!==undefined||c.MsTransition!==undefined||c.OTransition!==undefined;return d&&{end:function(){var b="TransitionEnd";return a.browser.webkit?b="webkitTransitionEnd":a.browser.mozilla?b="transitionend":a.browser.opera&&(b="oTransitionEnd"),b}()}}()})}(window.jQuery),!function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype={constructor:c,close:function(b){function f(){e.remove(),e.trigger("closed")}var c=a(this),d=c.attr("data-target"),e;d||(d=c.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),e=a(d),e.trigger("close"),b&&b.preventDefault(),e.length||(e=c.hasClass("alert")?c:c.parent()),e.removeClass("in"),a.support.transition&&e.hasClass("fade")?e.on(a.support.transition.end,f):f()}},a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("alert");e||d.data("alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a(function(){a("body").on("click.alert.data-api",b,c.prototype.close)})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};b.prototype={constructor:b,setState:function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},toggle:function(){var a=this.$element.parent('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")}},a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("button"),f=typeof c=="object"&&c;e||d.data("button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a(function(){a("body").on("click.button.data-api","[data-toggle^=button]",function(b){a(b.target).button("toggle")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.carousel.defaults,c),this.options.slide&&this.slide(this.options.slide)};b.prototype={cycle:function(){return this.interval=setInterval(a.proxy(this.next,this),this.options.interval),this},to:function(b){var c=this.$element.find(".active"),d=c.parent().children(),e=d.index(c),f=this;if(b>d.length-1||b<0)return;return this.sliding?this.$element.one("slid",function(){f.to(b)}):e==b?this.pause().cycle():this.slide(b>e?"next":"prev",a(d[b]))},pause:function(){return clearInterval(this.interval),this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(b,c){var d=this.$element.find(".active"),e=c||d[b](),f=this.interval,g=b=="next"?"left":"right",h=b=="next"?"first":"last",i=this;return this.sliding=!0,f&&this.pause(),e=e.length?e:this.$element.find(".item")[h](),!a.support.transition&&this.$element.hasClass("slide")?(this.$element.trigger("slide"),d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")):(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),this.$element.trigger("slide"),this.$element.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)})),f&&this.cycle(),this}},a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("carousel"),f=typeof c=="object"&&c;e||d.data("carousel",e=new b(this,f)),typeof c=="number"?e.to(c):typeof c=="string"||(c=f.slide)?e[c]():e.cycle()})},a.fn.carousel.defaults={interval:5e3},a.fn.carousel.Constructor=b,a(function(){a("body").on("click.carousel.data-api","[data-slide]",function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=!e.data("modal")&&a.extend({},e.data(),c.data());e.carousel(f),b.preventDefault()})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find(".in"),e;d&&d.length&&(e=d.data("collapse"),d.collapse("hide"),e||d.data("collapse",null)),this.$element[b](0),this.transition("addClass","show","shown"),this.$element[b](this.$element[0][c])},hide:function(){var a=this.dimension();this.reset(this.$element[a]()),this.transition("removeClass","hide","hidden"),this.$element[a](0)},reset:function(a){var b=this.dimension();this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element.addClass("collapse")},transition:function(b,c,d){var e=this,f=function(){c=="show"&&e.reset(),e.$element.trigger(d)};this.$element.trigger(c)[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("collapse"),f=typeof c=="object"&&c;e||d.data("collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a(function(){a("body").on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":c.data();a(e).collapse(f)})})}(window.jQuery),!function(a){function d(){a(b).parent().removeClass("open")}"use strict";var b='[data-toggle="dropdown"]',c=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};c.prototype={constructor:c,toggle:function(b){var c=a(this),e=c.attr("data-target"),f,g;return e||(e=c.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,"")),f=a(e),f.length||(f=c.parent()),g=f.hasClass("open"),d(),!g&&f.toggleClass("open"),!1}},a.fn.dropdown=function(b){return this.each(function(){var d=a(this),e=d.data("dropdown");e||d.data("dropdown",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.dropdown.Constructor=c,a(function(){a("html").on("click.dropdown.data-api",d),a("body").on("click.dropdown.data-api",b,c.prototype.toggle)})}(window.jQuery),!function(a){function c(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),d.call(b)},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),d.call(b)})}function d(a){this.$element.hide().trigger("hidden"),e.call(this)}function e(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(a.proxy(this.hide,this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),e?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,a.proxy(f,this)):f.call(this)):b&&b()}function f(){this.$backdrop.remove(),this.$backdrop=null}function g(){var b=this;this.isShown&&this.options.keyboard?a(document).on("keyup.dismiss.modal",function(a){a.which==27&&b.hide()}):this.isShown||a(document).off("keyup.dismiss.modal")}"use strict";var b=function(b,c){this.options=a.extend({},a.fn.modal.defaults,c),this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this))};b.prototype={constructor:b,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this;if(this.isShown)return;a("body").addClass("modal-open"),this.isShown=!0,this.$element.trigger("show"),g.call(this),e.call(this,function(){var c=a.support.transition&&b.$element.hasClass("fade");!b.$element.parent().length&&b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in"),c?b.$element.one(a.support.transition.end,function(){b.$element.trigger("shown")}):b.$element.trigger("shown")})},hide:function(b){b&&b.preventDefault();if(!this.isShown)return;var e=this;this.isShown=!1,a("body").removeClass("modal-open"),g.call(this),this.$element.trigger("hide").removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?c.call(this):d.call(this)}},a.fn.modal=function(c){return this.each(function(){var d=a(this),e=d.data("modal"),f=typeof c=="object"&&c;e||d.data("modal",e=new b(this,f)),typeof c=="string"?e[c]():e.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0},a.fn.modal.Constructor=b,a(function(){a("body").on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({},e.data(),c.data());b.preventDefault(),e.modal(f)})})}(window.jQuery),!function(a){"use strict";var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,this.options.trigger!="manual"&&(e=this.options.trigger=="hover"?"mouseenter":"focus",f=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(e,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);!c.options.delay||!c.options.delay.show?c.show():(c.hoverState="in",setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show))},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);!c.options.delay||!c.options.delay.hide?c.hide():(c.hoverState="out",setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide))},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f=typeof this.options.placement=="function"?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.remove().css({top:0,left:0,display:"block"}).appendTo(b?this.$element:document.body),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight;switch(b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.css(g).addClass(f).addClass("in")}},setContent:function(){var a=this.tip();a.find(".tooltip-inner").html(this.getTitle()),a.removeClass("fade in top bottom left right")},hide:function(){function d(){var b=setTimeout(function(){c.off(a.support.transition.end).remove()},500);c.one(a.support.transition.end,function(){clearTimeout(b),c.remove()})}var b=this,c=this.tip();c.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d():c.remove()},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(b){return a.extend({},b?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a=a.toString().replace(/(^\s*|\s*$)/,""),a},tip:function(){return this.$tip=this.$tip||a(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()}},a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("tooltip"),f=typeof c=="object"&&c;e||d.data("tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.defaults={animation:!0,delay:0,selector:!1,placement:"top",trigger:"hover",title:"",template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'}}(window.jQuery),!function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype,{constructor:b,setContent:function(){var b=this.tip(),c=this.getTitle(),d=this.getContent();b.find(".popover-title")[a.type(c)=="object"?"append":"html"](c),b.find(".popover-content > *")[a.type(d)=="object"?"append":"html"](d),b.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-content")||(typeof c.content=="function"?c.content.call(b[0]):c.content),a=a.toString().replace(/(^\s*|\s*$)/,""),a},tip:function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip}}),a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("popover"),f=typeof c=="object"&&c;e||d.data("popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.defaults=a.extend({},a.fn.tooltip.defaults,{placement:"right",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'})}(window.jQuery),!function(a){function b(b,c){var d=a.proxy(this.process,this),e=a(b).is("body")?a(window):a(b),f;this.options=a.extend({},a.fn.scrollspy.defaults,c),this.$scrollElement=e.on("scroll.scroll.data-api",d),this.selector=(this.options.target||(f=a(b).attr("href"))&&f.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=a("body").on("click.scroll.data-api",this.selector,d),this.refresh(),this.process()}"use strict",b.prototype={constructor:b,refresh:function(){this.targets=this.$body.find(this.selector).map(function(){var b=a(this).attr("href");return/^#\w/.test(b)&&a(b).length?b:null}),this.offsets=a.map(this.targets,function(b){return a(b).position().top})},process:function(){var a=this.$scrollElement.scrollTop()+this.options.offset,b=this.offsets,c=this.targets,d=this.activeTarget,e;for(e=b.length;e--;)d!=c[e]&&a>=b[e]&&(!b[e+1]||a<=b[e+1])&&this.activate(c[e])},activate:function(a){var b;this.activeTarget=a,this.$body.find(this.selector).parent(".active").removeClass("active"),b=this.$body.find(this.selector+'[href="'+a+'"]').parent("li").addClass("active"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active")}},a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("scrollspy"),f=typeof c=="object"&&c;e||d.data("scrollspy",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.defaults={offset:10},a(function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery),!function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype={constructor:b,show:function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.attr("data-target"),e,f;d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,""));if(b.parent("li").hasClass("active"))return;e=c.find(".active a").last()[0],b.trigger({type:"show",relatedTarget:e}),f=a(d),this.activate(b.parent("li"),c),this.activate(f,f.parent(),function(){b.trigger({type:"shown",relatedTarget:e})})},activate:function(b,c,d){function g(){e.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),f?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var e=c.find("> .active"),f=d&&a.support.transition&&e.hasClass("fade");f?e.one(a.support.transition.end,g):g(),e.removeClass("in")}},a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("tab");e||d.data("tab",e=new b(this)),typeof c=="string"&&e[c]()})},a.fn.tab.Constructor=b,a(function(){a("body").on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.typeahead.defaults,c),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.$menu=a(this.options.menu).appendTo("body"),this.source=this.options.source,this.shown=!1,this.listen()};b.prototype={constructor:b,select:function(){var a=this.$menu.find(".active").attr("data-value");return this.$element.val(a),this.hide()},show:function(){var b=a.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:b.top+b.height,left:b.left}),this.$menu.show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(b){var c=this,d,e;return this.query=this.$element.val(),this.query?(d=a.grep(this.source,function(a){if(c.matcher(a))return a}),d=this.sorter(d),d.length?this.render(d.slice(0,this.options.items)).show():this.shown?this.hide():this):this.shown?this.hide():this},matcher:function(a){return~a.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(a){var b=[],c=[],d=[],e;while(e=a.shift())e.toLowerCase().indexOf(this.query.toLowerCase())?~e.indexOf(this.query)?c.push(e):d.push(e):b.push(e);return b.concat(c,d)},highlighter:function(a){return a.replace(new RegExp("("+this.query+")","ig"),function(a,b){return"<strong>"+b+"</strong>"})},render:function(b){var c=this;return b=a(b).map(function(b,d){return b=a(c.options.item).attr("data-value",d),b.find("a").html(c.highlighter(d)),b[0]}),b.first().addClass("active"),this.$menu.html(b),this},next:function(b){var c=this.$menu.find(".active").removeClass("active"),d=c.next();d.length||(d=a(this.$menu.find("li")[0])),d.addClass("active")},prev:function(a){var b=this.$menu.find(".active").removeClass("active"),c=b.prev();c.length||(c=this.$menu.find("li").last()),c.addClass("active")},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),(a.browser.webkit||a.browser.msie)&&this.$element.on("keydown",a.proxy(this.keypress,this)),this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this))},keyup:function(a){a.stopPropagation(),a.preventDefault();switch(a.keyCode){case 40:case 38:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:this.hide();break;default:this.lookup()}},keypress:function(a){a.stopPropagation();if(!this.shown)return;switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:a.preventDefault(),this.prev();break;case 40:a.preventDefault(),this.next()}},blur:function(a){var b=this;a.stopPropagation(),a.preventDefault(),setTimeout(function(){b.hide()},150)},click:function(a){a.stopPropagation(),a.preventDefault(),this.select()},mouseenter:function(b){this.$menu.find(".active").removeClass("active"),a(b.currentTarget).addClass("active")}},a.fn.typeahead=function(c){return this.each(function(){var d=a(this),e=d.data("typeahead"),f=typeof c=="object"&&c;e||d.data("typeahead",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>'},a.fn.typeahead.Constructor=b,a(function(){a("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(b){var c=a(this);if(c.data("typeahead"))return;b.preventDefault(),c.typeahead(c.data())})})}(window.jQuery);
-/*
- *	lib/js/lib/sprintf.js
  */
-var sprintf=(function(){function get_type(variable){return Object.prototype.toString.call(variable).slice(8,-1).toLowerCase();}
-function str_repeat(input,multiplier){for(var output=[];multiplier>0;output[--multiplier]=input){}
-return output.join('');}
-var str_format=function(){if(!str_format.cache.hasOwnProperty(arguments[0])){str_format.cache[arguments[0]]=str_format.parse(arguments[0]);}
-return str_format.format.call(null,str_format.cache[arguments[0]],arguments);};str_format.format=function(parse_tree,argv){var cursor=1,tree_length=parse_tree.length,node_type='',arg,output=[],i,k,match,pad,pad_character,pad_length;for(i=0;i<tree_length;i++){node_type=get_type(parse_tree[i]);if(node_type==='string'){output.push(parse_tree[i]);}
-else if(node_type==='array'){match=parse_tree[i];if(match[2]){arg=argv[cursor];for(k=0;k<match[2].length;k++){if(!arg.hasOwnProperty(match[2][k])){arg='';}else{arg=arg[match[2][k]];}}}
-else if(match[1]){arg=argv[match[1]];}
-else{arg=argv[cursor++];}
-if(/[^s]/.test(match[8])&&(get_type(arg)!='number')){throw(sprintf('[sprintf] expecting number but found %s',get_type(arg)));}
-switch(match[8]){case'b':arg=arg.toString(2);break;case'c':arg=String.fromCharCode(arg);break;case'd':arg=parseInt(arg,10);break;case'e':arg=match[7]?arg.toExponential(match[7]):arg.toExponential();break;case'f':arg=match[7]?parseFloat(arg).toFixed(match[7]):parseFloat(arg);break;case'o':arg=arg.toString(8);break;case's':arg=((arg=String(arg))&&match[7]?arg.substring(0,match[7]):arg);break;case'u':arg=Math.abs(arg);break;case'x':arg=arg.toString(16);break;case'X':arg=arg.toString(16).toUpperCase();break;}
-arg=(/[def]/.test(match[8])&&match[3]&&arg>=0?'+'+arg:arg);pad_character=match[4]?match[4]=='0'?'0':match[4].charAt(1):' ';pad_length=match[6]-String(arg).length;pad=match[6]?str_repeat(pad_character,pad_length):'';output.push(match[5]?arg+pad:pad+arg);}}
-return output.join('');};str_format.cache={};str_format.parse=function(fmt){var _fmt=fmt,match=[],parse_tree=[],arg_names=0;while(_fmt){if((match=/^[^\x25]+/.exec(_fmt))!==null){parse_tree.push(match[0]);}
-else if((match=/^\x25{2}/.exec(_fmt))!==null){parse_tree.push('%');}
-else if((match=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt))!==null){if(match[2]){arg_names|=1;var field_list=[],replacement_field=match[2],field_match=[];if((field_match=/^([a-z_][a-z_\d]*)/i.exec(replacement_field))!==null){field_list.push(field_match[1]);while((replacement_field=replacement_field.substring(field_match[0].length))!==''){if((field_match=/^\.([a-z_][a-z_\d]*)/i.exec(replacement_field))!==null){field_list.push(field_match[1]);}
-else if((field_match=/^\[(\d+)\]/.exec(replacement_field))!==null){field_list.push(field_match[1]);}
-else{throw('[sprintf] huh?');}}}
-else{throw('[sprintf] huh?');}
-match[2]=field_list;}
-else{arg_names|=2;}
-if(arg_names===3){throw('[sprintf] mixing positional and named placeholders is not (yet) supported');}
-parse_tree.push(match);}
-else{throw('[sprintf] huh?');}
-_fmt=_fmt.substring(match[0].length);}
-return parse_tree;};return str_format;})();var vsprintf=function(fmt,argv){argv.unshift(fmt);return sprintf.apply(null,argv);};
+!function(a){a(function(){"use strict",a.support.transition=function(){var b=document.body||document.documentElement,c=b.style,d=c.transition!==undefined||c.WebkitTransition!==undefined||c.MozTransition!==undefined||c.MsTransition!==undefined||c.OTransition!==undefined;return d&&{end:function(){var b="TransitionEnd";return a.browser.webkit?b="webkitTransitionEnd":a.browser.mozilla?b="transitionend":a.browser.opera&&(b="oTransitionEnd"),b}()}}()})}(window.jQuery),!function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype={constructor:c,close:function(b){function f(){e.remove(),e.trigger("closed")}var c=a(this),d=c.attr("data-target"),e;d||(d=c.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),e=a(d),e.trigger("close"),b&&b.preventDefault(),e.length||(e=c.hasClass("alert")?c:c.parent()),e.removeClass("in"),a.support.transition&&e.hasClass("fade")?e.on(a.support.transition.end,f):f()}},a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("alert");e||d.data("alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a(function(){a("body").on("click.alert.data-api",b,c.prototype.close)})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};b.prototype={constructor:b,setState:function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},toggle:function(){var a=this.$element.parent('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")}},a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("button"),f=typeof c=="object"&&c;e||d.data("button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a(function(){a("body").on("click.button.data-api","[data-toggle^=button]",function(b){a(b.target).button("toggle")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.carousel.defaults,c),this.options.slide&&this.slide(this.options.slide)};b.prototype={cycle:function(){return this.interval=setInterval(a.proxy(this.next,this),this.options.interval),this},to:function(b){var c=this.$element.find(".active"),d=c.parent().children(),e=d.index(c),f=this;if(b>d.length-1||b<0)return;return this.sliding?this.$element.one("slid",function(){f.to(b)}):e==b?this.pause().cycle():this.slide(b>e?"next":"prev",a(d[b]))},pause:function(){return clearInterval(this.interval),this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(b,c){var d=this.$element.find(".active"),e=c||d[b](),f=this.interval,g=b=="next"?"left":"right",h=b=="next"?"first":"last",i=this;return this.sliding=!0,f&&this.pause(),e=e.length?e:this.$element.find(".item")[h](),!a.support.transition&&this.$element.hasClass("slide")?(this.$element.trigger("slide"),d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")):(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),this.$element.trigger("slide"),this.$element.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)})),f&&this.cycle(),this}},a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("carousel"),f=typeof c=="object"&&c;e||d.data("carousel",e=new b(this,f)),typeof c=="number"?e.to(c):typeof c=="string"||(c=f.slide)?e[c]():e.cycle()})},a.fn.carousel.defaults={interval:5e3},a.fn.carousel.Constructor=b,a(function(){a("body").on("click.carousel.data-api","[data-slide]",function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=!e.data("modal")&&a.extend({},e.data(),c.data());e.carousel(f),b.preventDefault()})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find(".in"),e;d&&d.length&&(e=d.data("collapse"),d.collapse("hide"),e||d.data("collapse",null)),this.$element[b](0),this.transition("addClass","show","shown"),this.$element[b](this.$element[0][c])},hide:function(){var a=this.dimension();this.reset(this.$element[a]()),this.transition("removeClass","hide","hidden"),this.$element[a](0)},reset:function(a){var b=this.dimension();this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element.addClass("collapse")},transition:function(b,c,d){var e=this,f=function(){c=="show"&&e.reset(),e.$element.trigger(d)};this.$element.trigger(c)[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("collapse"),f=typeof c=="object"&&c;e||d.data("collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a(function(){a("body").on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":c.data();a(e).collapse(f)})})}(window.jQuery),!function(a){function d(){a(b).parent().removeClass("open")}"use strict";var b='[data-toggle="dropdown"]',c=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};c.prototype={constructor:c,toggle:function(b){var c=a(this),e=c.attr("data-target"),f,g;return e||(e=c.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,"")),f=a(e),f.length||(f=c.parent()),g=f.hasClass("open"),d(),!g&&f.toggleClass("open"),!1}},a.fn.dropdown=function(b){return this.each(function(){var d=a(this),e=d.data("dropdown");e||d.data("dropdown",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.dropdown.Constructor=c,a(function(){a("html").on("click.dropdown.data-api",d),a("body").on("click.dropdown.data-api",b,c.prototype.toggle)})}(window.jQuery),!function(a){function c(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),d.call(b)},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),d.call(b)})}function d(a){this.$element.hide().trigger("hidden"),e.call(this)}function e(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(a.proxy(this.hide,this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),e?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,a.proxy(f,this)):f.call(this)):b&&b()}function f(){this.$backdrop.remove(),this.$backdrop=null}function g(){var b=this;this.isShown&&this.options.keyboard?a(document).on("keyup.dismiss.modal",function(a){a.which==27&&b.hide()}):this.isShown||a(document).off("keyup.dismiss.modal")}"use strict";var b=function(b,c){this.options=a.extend({},a.fn.modal.defaults,c),this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this))};b.prototype={constructor:b,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this;if(this.isShown)return;a("body").addClass("modal-open"),this.isShown=!0,this.$element.trigger("show"),g.call(this),e.call(this,function(){var c=a.support.transition&&b.$element.hasClass("fade");!b.$element.parent().length&&b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in"),c?b.$element.one(a.support.transition.end,function(){b.$element.trigger("shown")}):b.$element.trigger("shown")})},hide:function(b){b&&b.preventDefault();if(!this.isShown)return;var e=this;this.isShown=!1,a("body").removeClass("modal-open"),g.call(this),this.$element.trigger("hide").removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?c.call(this):d.call(this)}},a.fn.modal=function(c){return this.each(function(){var d=a(this),e=d.data("modal"),f=typeof c=="object"&&c;e||d.data("modal",e=new b(this,f)),typeof c=="string"?e[c]():e.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0},a.fn.modal.Constructor=b,a(function(){a("body").on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({},e.data(),c.data());b.preventDefault(),e.modal(f)})})}(window.jQuery),!function(a){"use strict";var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,this.options.trigger!="manual"&&(e=this.options.trigger=="hover"?"mouseenter":"focus",f=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(e,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);!c.options.delay||!c.options.delay.show?c.show():(c.hoverState="in",setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show))},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);!c.options.delay||!c.options.delay.hide?c.hide():(c.hoverState="out",setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide))},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f=typeof this.options.placement=="function"?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.remove().css({top:0,left:0,display:"block"}).appendTo(b?this.$element:document.body),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight;switch(b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.css(g).addClass(f).addClass("in")}},setContent:function(){var a=this.tip();a.find(".tooltip-inner").html(this.getTitle()),a.removeClass("fade in top bottom left right")},hide:function(){function d(){var b=setTimeout(function(){c.off(a.support.transition.end).remove()},500);c.one(a.support.transition.end,function(){clearTimeout(b),c.remove()})}var b=this,c=this.tip();c.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d():c.remove()},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(b){return a.extend({},b?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a=a.toString().replace(/(^\s*|\s*$)/,""),a},tip:function(){return this.$tip=this.$tip||a(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()}},a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("tooltip"),f=typeof c=="object"&&c;e||d.data("tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.defaults={animation:!0,delay:0,selector:!1,placement:"top",trigger:"hover",title:"",template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'}}(window.jQuery),!function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype,{constructor:b,setContent:function(){var b=this.tip(),c=this.getTitle(),d=this.getContent();b.find(".popover-title")[a.type(c)=="object"?"append":"html"](c),b.find(".popover-content > *")[a.type(d)=="object"?"append":"html"](d),b.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-content")||(typeof c.content=="function"?c.content.call(b[0]):c.content),a=a.toString().replace(/(^\s*|\s*$)/,""),a},tip:function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip}}),a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("popover"),f=typeof c=="object"&&c;e||d.data("popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.defaults=a.extend({},a.fn.tooltip.defaults,{placement:"right",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'})}(window.jQuery),!function(a){function b(b,c){var d=a.proxy(this.process,this),e=a(b).is("body")?a(window):a(b),f;this.options=a.extend({},a.fn.scrollspy.defaults,c),this.$scrollElement=e.on("scroll.scroll.data-api",d),this.selector=(this.options.target||(f=a(b).attr("href"))&&f.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=a("body").on("click.scroll.data-api",this.selector,d),this.refresh(),this.process()}"use strict",b.prototype={constructor:b,refresh:function(){this.targets=this.$body.find(this.selector).map(function(){var b=a(this).attr("href");return/^#\w/.test(b)&&a(b).length?b:null}),this.offsets=a.map(this.targets,function(b){return a(b).position().top})},process:function(){var a=this.$scrollElement.scrollTop()+this.options.offset,b=this.offsets,c=this.targets,d=this.activeTarget,e;for(e=b.length;e--;)d!=c[e]&&a>=b[e]&&(!b[e+1]||a<=b[e+1])&&this.activate(c[e])},activate:function(a){var b;this.activeTarget=a,this.$body.find(this.selector).parent(".active").removeClass("active"),b=this.$body.find(this.selector+'[href="'+a+'"]').parent("li").addClass("active"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active")}},a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("scrollspy"),f=typeof c=="object"&&c;e||d.data("scrollspy",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.defaults={offset:10},a(function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery),!function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype={constructor:b,show:function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.attr("data-target"),e,f;d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,""));if(b.parent("li").hasClass("active"))return;e=c.find(".active a").last()[0],b.trigger({type:"show",relatedTarget:e}),f=a(d),this.activate(b.parent("li"),c),this.activate(f,f.parent(),function(){b.trigger({type:"shown",relatedTarget:e})})},activate:function(b,c,d){function g(){e.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),f?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var e=c.find("> .active"),f=d&&a.support.transition&&e.hasClass("fade");f?e.one(a.support.transition.end,g):g(),e.removeClass("in")}},a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("tab");e||d.data("tab",e=new b(this)),typeof c=="string"&&e[c]()})},a.fn.tab.Constructor=b,a(function(){a("body").on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.typeahead.defaults,c),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.$menu=a(this.options.menu).appendTo("body"),this.source=this.options.source,this.shown=!1,this.listen()};b.prototype={constructor:b,select:function(){var a=this.$menu.find(".active").attr("data-value");return this.$element.val(a),this.hide()},show:function(){var b=a.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:b.top+b.height,left:b.left}),this.$menu.show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(b){var c=this,d,e;return this.query=this.$element.val(),this.query?(d=a.grep(this.source,function(a){if(c.matcher(a))return a}),d=this.sorter(d),d.length?this.render(d.slice(0,this.options.items)).show():this.shown?this.hide():this):this.shown?this.hide():this},matcher:function(a){return~a.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(a){var b=[],c=[],d=[],e;while(e=a.shift())e.toLowerCase().indexOf(this.query.toLowerCase())?~e.indexOf(this.query)?c.push(e):d.push(e):b.push(e);return b.concat(c,d)},highlighter:function(a){return a.replace(new RegExp("("+this.query+")","ig"),function(a,b){return"<strong>"+b+"</strong>"})},render:function(b){var c=this;return b=a(b).map(function(b,d){return b=a(c.options.item).attr("data-value",d),b.find("a").html(c.highlighter(d)),b[0]}),b.first().addClass("active"),this.$menu.html(b),this},next:function(b){var c=this.$menu.find(".active").removeClass("active"),d=c.next();d.length||(d=a(this.$menu.find("li")[0])),d.addClass("active")},prev:function(a){var b=this.$menu.find(".active").removeClass("active"),c=b.prev();c.length||(c=this.$menu.find("li").last()),c.addClass("active")},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),(a.browser.webkit||a.browser.msie)&&this.$element.on("keydown",a.proxy(this.keypress,this)),this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this))},keyup:function(a){a.stopPropagation(),a.preventDefault();switch(a.keyCode){case 40:case 38:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:this.hide();break;default:this.lookup()}},keypress:function(a){a.stopPropagation();if(!this.shown)return;switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:a.preventDefault(),this.prev();break;case 40:a.preventDefault(),this.next()}},blur:function(a){var b=this;a.stopPropagation(),a.preventDefault(),setTimeout(function(){b.hide()},150)},click:function(a){a.stopPropagation(),a.preventDefault(),this.select()},mouseenter:function(b){this.$menu.find(".active").removeClass("active"),a(b.currentTarget).addClass("active")}},a.fn.typeahead=function(c){return this.each(function(){var d=a(this),e=d.data("typeahead"),f=typeof c=="object"&&c;e||d.data("typeahead",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>'},a.fn.typeahead.Constructor=b,a(function(){a("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(b){var c=a(this);if(c.data("typeahead"))return;b.preventDefault(),c.typeahead(c.data())})})}(window.jQuery);
+
 /*
  *	lib/js/core.min.js
  */
+
 /*
  *	lib/js/wn/class.js
  */;(function(){var initializing=false,fnTest=/xyz/.test(function(){xyz;})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(prop){var _super=this.prototype;initializing=true;var prototype=new this();initializing=false;for(var name in prop){prototype[name]=typeof prop[name]=="function"&&typeof _super[name]=="function"&&fnTest.test(prop[name])?(function(name,fn){return function(){var tmp=this._super;this._super=_super[name];var ret=fn.apply(this,arguments);this._super=tmp;return ret;};})(name,prop[name]):prop[name];}
@@ -75,13 +37,6 @@
 parent=parent[n];}}
 wn.provide('wn.settings');wn.provide('wn.ui');
 /*
- *	lib/js/wn/xmlhttp.js
- */
-wn.xmlhttp={request:function(){if(window.XMLHttpRequest)
-return new XMLHttpRequest();else if(window.ActiveXObject)
-return new ActiveXObject("MsXml2.XmlHttp");},complete:function(req,callback,url){if(req.status==200||req.status==304){callback(req.responseText);}else{alert(url+' request error: '+req.statusText+' ('+req.status+')');}},get:function(url,callback,args,async){if(async===null)async=true;var req=wn.xmlhttp.request();req.onreadystatechange=function(){if(req.readyState==4){wn.xmlhttp.complete(req,callback,url)}}
-var sep=((args&&args.indexOf('?'))==-1)?'?':'&';var u=args?(url+sep+args):url;req.open('GET',u,async);req.send(null);if(!async){wn.xmlhttp.complete(req,callback,url)}}}
-/*
  *	lib/js/wn/versions.js
  */
 wn.versions={check:function(){if(window.localStorage){if(window._version_number==-1||parseInt(localStorage._version_number)!=parseInt(window._version_number)){var localversion=localStorage._version_number;localStorage.clear();console.log("Cache cleared - version: "+localversion
@@ -92,19 +47,20 @@
  */
 wn.assets={executed_:{},exists:function(src){if('localStorage'in window&&localStorage.getItem(src))
 return true},add:function(src,txt){if('localStorage'in window){localStorage.setItem(src,txt);}},get:function(src){return localStorage.getItem(src);},extn:function(src){if(src.indexOf('?')!=-1){src=src.split('?').slice(-1)[0];}
-return src.split('.').slice(-1)[0];},load:function(src){var t=src;wn.xmlhttp.get(t,function(txt){wn.assets.add(src,txt);},'q='+Math.floor(Math.random()*1000),false)},execute:function(src){if(!wn.assets.exists(src)){wn.assets.load(src);}
-var type=wn.assets.extn(src);if(wn.assets.handler[type]){wn.assets.handler[type](wn.assets.get(src),src);wn.assets.executed_[src]=1;}},handler:{js:function(txt,src){wn.dom.eval(txt);},css:function(txt,src){var se=document.createElement('style');se.type="text/css";if(se.styleSheet){se.styleSheet.cssText=txt;}else{se.appendChild(document.createTextNode(txt));}
-document.getElementsByTagName('head')[0].appendChild(se);},cgi:function(txt,src){wn.dom.eval(txt)}}}
+return src.split('.').slice(-1)[0];},load:function(src){var t=src;$.ajax({url:t,data:{q:Math.floor(Math.random()*1000)},dataType:'text',success:function(txt){wn.assets.add(src,txt);},async:false})},execute:function(src){if(!wn.assets.exists(src)){wn.assets.load(src);}
+var type=wn.assets.extn(src);if(wn.assets.handler[type]){wn.assets.handler[type](wn.assets.get(src),src);wn.assets.executed_[src]=1;}},handler:{js:function(txt,src){wn.dom.eval(txt);},css:function(txt,src){wn.dom.set_style(txt);},cgi:function(txt,src){wn.dom.eval(txt)}}}
 /*
  *	lib/js/wn/require.js
  */
 wn.require=function(items){if(typeof items==="string"){items=[items];}
-var l=items.length;for(var i=0;i<l;i++){var src=items[i];if(!(src in wn.assets.executed_)){wn.assets.execute(src);}}}
+var l=items.length;for(var i=0;i<l;i++){var src=items[i];wn.assets.execute(src);}}
 /*
  *	lib/js/wn/dom.js
  */
 wn.provide('wn.dom');wn.dom.by_id=function(id){return document.getElementById(id);}
-wn.dom.eval=function(txt){var el=document.createElement('script');el.appendChild(document.createTextNode(txt));document.getElementsByTagName('head')[0].appendChild(el);}
+wn.dom.eval=function(txt){if(!txt)return;var el=document.createElement('script');el.appendChild(document.createTextNode(txt));document.getElementsByTagName('head')[0].appendChild(el);}
+wn.dom.set_style=function(txt){if(!txt)return;var se=document.createElement('style');se.type="text/css";if(se.styleSheet){se.styleSheet.cssText=txt;}else{se.appendChild(document.createTextNode(txt));}
+document.getElementsByTagName('head')[0].appendChild(se);}
 wn.dom.add=function(parent,newtag,className,cs,innerHTML,onclick){if(parent&&parent.substr)parent=wn.dom.by_id(parent);var c=document.createElement(newtag);if(parent)
 parent.appendChild(c);if(className){if(newtag.toLowerCase()=='img')
 c.src=className
@@ -112,15 +68,29 @@
 c.className=className;}
 if(cs)wn.dom.css(c,cs);if(innerHTML)c.innerHTML=innerHTML;if(onclick)c.onclick=onclick;return c;}
 wn.dom.css=function(ele,s){if(ele&&s){for(var i in s)ele.style[i]=s[i];};return ele;}
-wn.dom.hide=function(ele){ele.style.display='none';}
-wn.dom.show=function(ele,value){if(!value)value='block';ele.style.display=value;}
+wn.get_cookie=function(c){var t=""+document.cookie;var ind=t.indexOf(c);if(ind==-1||c=="")return"";var ind1=t.indexOf(';',ind);if(ind1==-1)ind1=t.length;return unescape(t.substring(ind+c.length+1,ind1));}
+wn.dom.set_box_shadow=function(ele,spread){$(ele).css('-moz-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')
+$(ele).css('-webkit-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')
+$(ele).css('-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')};(function($){$.fn.add_options=function(options_list){for(var i=0;i<options_list.length;i++){var v=options_list[i];value=v.value||v;label=v.label||v;$('<option>').html(label).attr('value',value).appendTo(this);}
+$(this).val(options_list[0].value||options_list[0]);}
+$.fn.set_working=function(){var ele=this.get(0);if(ele.loading_img){$(ele.loading_img).toggle(true);}else{ele.disabled=1;ele.loading_img=$('<img src="lib/images/ui/button-load.gif" \
+    style="margin-left: 4px; margin-bottom: -2px; display: inline;" />').insertAfter(ele);}}
+$.fn.done_working=function(){var ele=this.get(0);ele.disabled=0;if(ele.loading_img){$(ele.loading_img).toggle(false);};}})(jQuery);
 /*
- *	lib/js/wn/page.js
+ *	lib/js/wn/model.js
  */
-wn.page={set:function(src){var new_selection=$('.inner div.content[_src="'+src+'"]');if(!new_selection.length){wn.assets.execute(src);new_selection=$('.inner div.content[_src="'+src+'"]');}
-$('.inner .current_page').removeClass('current_page');new_selection.addClass('current_page');var title=$('nav ul li a[href*="'+src+'"]').attr('title')||'No Title'
-state=window.location.hash;if(state!=src){window.location.hash=state;}
-else{document.title=title;}}}
+wn.provide('wn.model');wn.model={no_value_type:['Section Break','Column Break','HTML','Table','Button','Image'],new_names:{},with_doctype:function(doctype,callback){if(locals.DocType[doctype]){callback();}else{wn.call({method:'webnotes.widgets.form.load.getdoctype',args:{doctype:doctype},callback:callback});}},with_doc:function(doctype,name,callback){if(!name)name=doctype;if(locals[doctype]&&locals[doctype][name]){callback(name);}else{wn.call({method:'webnotes.widgets.form.load.getdoc',args:{doctype:doctype,name:name},callback:function(r){callback(name,r);}});}},can_delete:function(doctype){if(!doctype)return false;return locals.DocType[doctype].allow_trash&&wn.boot.profile.can_cancel.indexOf(doctype)!=-1;}}
+/*
+ *	lib/js/wn/meta.js
+ */
+wn.provide('wn.meta.docfield_map');wn.provide('wn.meta.docfield_list');wn.provide('wn.meta.doctypes');$.extend(wn.meta,{add_field:function(df){wn.provide('wn.meta.docfield_map.'+df.parent);wn.meta.docfield_map[df.parent][df.fieldname||df.label]=df;if(!wn.meta.docfield_list[df.parent])
+wn.meta.docfield_list[df.parent]=[]
+wn.meta.docfield_list[df.parent].push(df);}});
+/*
+ *	lib/js/wn/misc/tools.js
+ */
+wn.markdown=function(txt){if(!wn.md2html){wn.require('lib/js/lib/showdown.js');wn.md2html=new Showdown.converter();}
+return wn.md2html.makeHtml(txt);}
 /*
  *	lib/js/wn/misc/user.js
  */
@@ -130,6 +100,10 @@
 if(!wn.boot.user_info[uid].fullname)
 wn.boot.user_info[uid].fullname=uid;if(!wn.boot.user_info[uid].image)
 wn.boot.user_info[uid].image=def.image;return wn.boot.user_info[uid];}
+wn.provide('wn.user');$.extend(wn.user,{name:wn.boot.profile.name,has_role:function(rl){if(typeof rl=='string')rl=[rl];for(var i in rl){if(wn.boot.profile.roles.indexOf(rl[i])!=-1)
+return true;}}})
+wn.session_alive=true;$(document).bind('mousemove',function(){wn.session_alive=true;if(wn.session_alive_timeout)
+clearTimeout(wn.session_alive_timeout);wn.session_alive_timeout=setTimeout('wn.session_alive=false;',30000);})
 /*
  *	lib/js/lib/json2.js
  */
@@ -159,19 +133,270 @@
 if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
 throw new SyntaxError('JSON.parse');};}}());
 /*
+ *	lib/js/wn/router.js
+ */
+wn.re_route={}
+wn.route=function(){if(wn.re_route[window.location.hash]){window.location.hash=wn.re_route[window.location.hash];}
+wn._cur_route=window.location.hash;route=wn.get_route();switch(route[0]){case"List":wn.views.doclistview.show(route[1]);break;case"Form":if(route.length>3){route[2]=route.splice(2).join('/');}
+wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;case"Report2":wn.views.reportview2.show(route[1],route[2]);break;default:wn.views.pageview.show(route[0]);}}
+wn.get_route=function(route){if(!route)
+route=window.location.hash;if(route.substr(0,1)=='#')route=route.substr(1);if(route.substr(0,1)=='!')route=route.substr(1);return $.map(route.split('/'),function(r){return decodeURIComponent(r);});}
+wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;wn.app.set_favicon();}
+wn._cur_route=null;$(window).bind('hashchange',function(){if(location.hash==wn._cur_route)
+return;wn.route();if(wn.boot.analytics_code){try{eval(wn.boot.analytics_code);}catch(e){console.log(e);}}});
+/*
+ *	lib/js/wn/ui/listing.js
+ */
+wn.provide('wn.ui');wn.ui.Listing=Class.extend({init:function(opts){this.opts=opts||{};this.page_length=20;this.start=0;this.data=[];if(opts){this.make();}},prepare_opts:function(){if(this.opts.new_doctype){if(wn.boot.profile.can_read.indexOf(this.opts.new_doctype)==-1){this.opts.new_doctype=null;}else{this.opts.new_doctype=get_doctype_label(this.opts.new_doctype);}}
+if(!this.opts.no_result_message){this.opts.no_result_message='Nothing to show'}},make:function(opts){if(opts){this.opts=opts;}
+this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
+   <div class="wnlist">\
+    <h3 class="title hide">%(title)s</h3>\
+    \
+    <div class="list-filters hide">\
+     <div class="show_filters well">\
+      <div>\
+       <button class="btn btn-small add-filter-btn">\
+        <i class="icon-plus"></i> Add Filter</button>\
+      </div>\
+      <div class="filter_area"></div>\
+     </div>\
+    </div>\
+    \
+    <div style="margin-bottom:9px" class="list-toolbar-wrapper">\
+     <div class="list-toolbar" style="display:inline-block; margin-right: 10px;">\
+     </div>\
+     <div style="display:inline-block; width: 24px; margin-left: 4px">\
+      <img src="lib/images/ui/button-load.gif" \
+      class="img-load"/></div>\
+    </div><div style="clear:both"></div>\
+    \
+    <div class="no-result help hide">\
+     %(no_result_message)s\
+    </div>\
+    \
+    <div class="result">\
+     <div class="result-list"></div>\
+    </div>\
+    \
+    <div class="paging-button">\
+     <button class="btn btn-small btn-more hide">More...</div>\
+    </div>\
+   </div>\
+  ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.appframe){this.$w.find('.list-toolbar-wrapper').toggle(false);}
+if(this.show_filters){this.make_filters();}},add_button:function(label,click,icon){if(this.appframe){return this.appframe.add_button(label,click,icon)}else{$button=$('<button class="btn btn-small"></button>').appendTo(this.$w.find('.list-toolbar'))
+if(icon){$('<i>').addClass(icon).appendTo($button);}
+$button.html(label).click(click);return $button}},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
+if(!(this.hide_refresh||this.no_refresh)){this.add_button('Refresh',function(){me.run();},'icon-refresh');}
+if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){newdoc(me.new_doctype);},'icon-plus');}
+if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}
+if(me.no_toolbar||me.hide_toolbar){me.$w.find('.list-toolbar-wrapper').toggle(false);}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
+this.onrun=a0;if(a0&&a0.callback)
+this.onrun=a0.callback;if(!a1&&!(a0&&a0.append))
+this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(a0),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(opts){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1}
+args.simple_query=this.query;}else{var args={limit_start:this.start,limit_page_length:this.page_length}}
+if(this.args)
+$.extend(args,this.args)
+if(this.get_args){$.extend(args,this.get_args(opts));}
+return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);this.update_paging(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}}
+if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i<m;i++){this.render_row(this.add_row(),values[i],this,i);}},update_paging:function(values){if(values.length>=this.page_length){this.$w.find('.btn-more').toggle(true);this.start+=this.page_length;}},add_row:function(){return this.$w.find('.result-list').append('<div class="list-row">').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});
+/*
+ *	lib/js/wn/ui/filters.js
+ */
+wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},show_filters:function(){this.$w.find('.show_filters').slideToggle();if(!this.filters.length)
+this.add_filter();},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field)
+values.push(f.get_value());})
+return values;},update_filters:function(){var fl=[];$.each(this.filters,function(i,f){if(f.field)fl.push(f);})
+this.filters=fl;},get_filter:function(fieldname){for(var i in this.filters){if(this.filters[i].field.df.fieldname==fieldname)
+return this.filters[i];}}});wn.ui.Filter=Class.extend({init:function(opts){$.extend(this,opts);this.doctype=this.flist.doctype;this.make();this.make_select();this.set_events();},make:function(){this.flist.$w.find('.filter_area').append('<div class="list_filter">\
+  <span class="fieldname_select_area"></span>\
+  <select class="condition">\
+   <option value="=">Equals</option>\
+   <option value="like">Like</option>\
+   <option value=">=">Greater or equals</option>\
+   <option value=">=">Less or equals</option>\
+   <option value=">">Greater than</option>\
+   <option value="<">Less than</option>\
+   <option value="in">In</option>\
+   <option value="!=">Not equals</option>\
+  </select>\
+  <span class="filter_field"></span>\
+  <a class="close">&times;</a>\
+  </div>');this.$w=this.flist.$w.find('.list_filter:last-child');},make_select:function(){this.fieldselect=new wn.ui.FieldSelect(this.$w.find('.fieldname_select_area'),this.doctype,this.filter_fields);},set_events:function(){var me=this;this.fieldselect.$select.bind('change',function(){me.set_field(this.value);});this.$w.find('a.close').bind('click',function(){me.$w.css('display','none');var value=me.field.get_value();me.field=null;if(!me.flist.get_filters().length){me.flist.$w.find('.set_filters').toggle(true);me.flist.$w.find('.show_filters').toggle(false);}
+if(value){me.flist.listobj.run();}
+me.flist.update_filters();return false;});me.$w.find('.condition').change(function(){if($(this).val()=='in'){me.set_field(me.field.df.fieldname,'Data');if(!me.field.desc_area)
+me.field.desc_area=$a(me.field.wrapper,'span','help',null,'values separated by comma');}else{me.set_field(me.field.df.fieldname);}});if(me.fieldname){this.set_values(me.fieldname,me.condition,me.value);}else{me.set_field('name');}},set_values:function(fieldname,condition,value){this.set_field(fieldname);if(condition)this.$w.find('.condition').val(condition).change();if(value)this.field.set_input(value)},set_field:function(fieldname,fieldtype){var me=this;var cur=me.field?{fieldname:me.field.df.fieldname,fieldtype:me.field.df.fieldtype}:{}
+var df=me.fieldselect.fields_by_name[fieldname];this.set_fieldtype(df,fieldtype);if(me.field&&cur.fieldname==fieldname&&df.fieldtype==cur.fieldtype){return;}
+me.fieldselect.$select.val(fieldname);var field_area=me.$w.find('.filter_field').empty().get(0);f=make_field(df,null,field_area,null,0,1);f.df.single_select=1;f.not_in_form=1;f.with_label=0;f.refresh();me.field=f;this.set_default_condition(df,fieldtype);$(me.field.wrapper).find(':input').keydown(function(ev){if(ev.which==13){me.flist.listobj.run();}})},set_fieldtype:function(df,fieldtype){if(df.original_type)
+df.fieldtype=df.original_type;else
+df.original_type=df.fieldtype;df.description='';df.reqd=0;if(fieldtype){df.fieldtype=fieldtype;return;}
+if(df.fieldtype=='Check'){df.fieldtype='Select';df.options='No\nYes';}else if(['Text','Text Editor','Code','Link'].indexOf(df.fieldtype)!=-1){df.fieldtype='Data';}},set_default_condition:function(df,fieldtype){if(!fieldtype){if(df.fieldtype=='Data'){this.$w.find('.condition').val('like');}else{this.$w.find('.condition').val('=');}}},get_value:function(){var me=this;var val=me.field.get_value();var cond=me.$w.find('.condition').val();if(me.field.df.original_type=='Check'){val=(val=='Yes'?1:0);}
+if(cond=='like'){val=val+'%';}
+return[me.fieldselect.$select.find('option:selected').attr('table'),me.field.df.fieldname,me.$w.find('.condition').val(),cstr(val)];}});wn.ui.FieldSelect=Class.extend({init:function(parent,doctype,filter_fields){this.doctype=doctype;this.fields_by_name={};this.$select=$('<select>').appendTo(parent);if(filter_fields){for(var i in filter_fields)
+this.add_field_option(this.filter_fields[i])}else{this.build_options();}},build_options:function(){var me=this;me.table_fields=[];var std_filters=[{fieldname:'name',fieldtype:'Data',label:'ID',parent:me.doctype},{fieldname:'modified',fieldtype:'Date',label:'Last Modified',parent:me.doctype},{fieldname:'owner',fieldtype:'Data',label:'Created By',parent:me.doctype},{fieldname:'creation',fieldtype:'Date',label:'Created On',parent:me.doctype},{fieldname:'_user_tags',fieldtype:'Data',label:'Tags',parent:me.doctype}];$.each(std_filters.concat(wn.meta.docfield_list[me.doctype]),function(i,df){me.add_field_option(df);});$.each(me.table_fields,function(i,table_df){if(table_df.options){$.each(wn.meta.docfield_list[table_df.options],function(i,df){me.add_field_option(df);});}});},add_field_option:function(df){var me=this;if(me.doctype&&df.parent==me.doctype){var label=df.label;var table=me.doctype;if(df.fieldtype=='Table')me.table_fields.push(df);}else{var label=df.label+' ('+df.parent+')';var table=df.parent;}
+if(wn.model.no_value_type.indexOf(df.fieldtype)==-1&&!me.fields_by_name[df.fieldname]){this.$select.append($('<option>',{value:df.fieldname,table:table}).text(label));me.fields_by_name[df.fieldname]=df;}}})
+/*
+ *	lib/js/wn/views/container.js
+ */
+wn.provide('wn.pages');wn.provide('wn.views');wn.views.Container=Class.extend({init:function(){this.container=$('#body_div').get(0);this.page=null;this.pagewidth=$('#body_div').width();this.pagemargin=50;},add_page:function(label,onshow,onhide){var page=$('<div class="content"></div>').appendTo(this.container).get(0);if(onshow)
+$(page).bind('show',onshow);if(onshow)
+$(page).bind('hide',onhide);page.label=label;wn.pages[label]=page;return page;},change_to:function(label){if(this.page&&this.page.label==label){return;}
+var me=this;if(label.tagName){var page=label;}else{var page=wn.pages[label];}
+if(!page){console.log('Page not found '+label);return;}
+if(this.page){$(this.page).toggle(false);$(this.page).trigger('hide');}
+this.page=page;$(this.page).fadeIn();$(this.page).trigger('show');this.page._route=window.location.hash;document.title=this.page.label;scroll(0,0);return this.page;}});wn.views.add_module_btn=function(parent,module){$(parent).append(repl('<span class="label" style="margin-right: 8px; cursor: pointer;"\
+     onclick="wn.set_route(\'%(module_small)s-home\')">\
+     <i class="icon-home icon-white"></i> %(module)s Home\
+    </span>',{module:module,module_small:module.toLowerCase()}));}
+wn.views.add_list_btn=function(parent,doctype){$(parent).append(repl('<span class="label" style="margin-right: 8px; cursor: pointer;"\
+     onclick="wn.set_route(\'List\', \'%(doctype)s\')">\
+     <i class="icon-list icon-white"></i> %(doctype)s List\
+    </span>',{doctype:doctype}));}
+/*
+ *	lib/js/wn/views/doclistview.js
+ */
+wn.provide('wn.views.doclistview');wn.provide('wn.doclistviews');wn.views.doclistview.pages={};wn.views.doclistview.show=function(doctype){var pagename=doctype+' List';var doctype=get_label_doctype(doctype);wn.model.with_doctype(doctype,function(r){if(r&&r['403'])return;var page=wn.views.doclistview.pages[pagename];if(!page){var page=wn.container.add_page(pagename);page.doclistview=new wn.views.DocListView(doctype,page);wn.views.doclistview.pages[pagename]=page;}
+document.title=page.doclistview.label;wn.container.change_to(pagename);})}
+wn.views.DocListView=wn.ui.Listing.extend({init:function(doctype,page){this.doctype=doctype;this.$page=$(page);this.label=get_doctype_label(doctype);this.label=(this.label.toLowerCase().substr(-4)=='list')?this.label:(this.label+' List');this.make_page();this.setup();},make_page:function(){var me=this;this.$page.html(repl('<div class="layout-wrapper layout-wrapper-background">\
+   <div class="appframe-area"></div>\
+   <div class="layout-main-section">\
+    <h1>%(label)s</h1>\
+    <hr>\
+    <div class="wnlist-area"><div class="help">Loading...</div></div>\
+   </div>\
+   <div class="layout-side-section">\
+    <div class="stat-wrapper show-docstatus hide">\
+     <h4>Show</h4>\
+     <div><input data-docstatus="0" type="checkbox" checked="checked" /> Drafts</div>\
+     <div><input data-docstatus="1" type="checkbox" checked="checked" /> Submitted</div>\
+     <div><input data-docstatus="2" type="checkbox" /> Cancelled</div>\
+    </div>\
+   </div>\
+   <div style="clear: both"></div>\
+  </div>',{label:this.label}));this.appframe=new wn.ui.AppFrame(this.$page.find('.appframe-area'));wn.views.breadcrumbs($('<span>').appendTo(this.appframe.$titlebar),locals.DocType[this.doctype].module);},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.add_delete_option();},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1
+else return null;}).length;if(this.can_submit){this.$page.find('.show-docstatus').removeClass('hide');this.$page.find('.show-docstatus input').click(function(){me.run();})}},setup_listview:function(){if(this.meta.__listjs){eval(this.meta.__listjs);this.listview=new wn.doclistviews[this.doctype](this);}else{this.listview=new wn.views.ListView(this);}
+this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.widgets.doclistview.get',get_args:this.get_args,parent:this.$page.find('.wnlist-area'),start:0,page_length:20,show_filters:true,show_grid:true,new_doctype:this.doctype,allow_delete:true,no_result_message:this.make_no_result(),columns:this.listview.fields});this.run();},make_no_result:function(){return repl('<div class="well"><p>No %(doctype_label)s found</p>\
+  %(description)s\
+  <hr>\
+  <p><button class="btn btn-info btn-small"\
+    onclick="newdoc(\'%(doctype)s\');"\
+    >Make a new %(doctype_label)s</button>\
+  </p></div>',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype,description:wn.markdown(locals.DocType[this.doctype].description||'')});},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[]}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('Delete',function(){me.delete_items();},'icon-remove')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length)
+return;if(!confirm('This is PERMANENT action and you cannot undo. Continue?')){return;}
+me.set_working(true);wn.call({method:'webnotes.widgets.doclistview.delete_items',args:{items:dl,doctype:me.doctype},callback:function(){me.set_working(false);me.refresh();}})},init_stats:function(){var me=this
+wn.call({method:'webnotes.widgets.doclistview.get_stats',args:{stats:me.listview.stats,doctype:me.doctype},callback:function(r){$.each(me.listview.stats,function(i,v){me.render_stat(v,r.message[v]);});}});},render_stat:function(field,stat){var me=this;if(!stat||!stat.length){if(field=='_user_tags'){this.$page.find('.layout-side-section').append('<div class="stat-wrapper"><h4>Tags</h4>\
+      <div class="help small"><i>No records tagged.</i><br><br> \
+      To add a tag, open the document and click on \
+      "Add Tag" on the sidebar</div></div>');}
+return;}
+var label=wn.meta.docfield_map[this.doctype][field]?wn.meta.docfield_map[this.doctype][field].label:field;if(label=='_user_tags')label='Tags';var $w=$('<div class="stat-wrapper">\
+   <h4>'+label+'</h4>\
+   <div class="stat-grid">\
+   </div>\
+  </div>');stat=stat.sort(function(a,b){return b[1]-a[1]});var sum=0;$.each(stat,function(i,v){sum=sum+v[1];})
+$.each(stat,function(i,v){me.render_stat_item(i,v,sum,field).appendTo($w.find('.stat-grid'));});$w.appendTo(this.$page.find('.layout-side-section'));},render_stat_item:function(i,v,max,field){var me=this;var args={}
+args.label=v[0];args.width=flt(v[1])/max*100;args.count=v[1];args.field=field;$item=$(repl('<div class="stat-item">\
+   <div class="stat-bar" style="width: %(width)s%"></div>\
+   <div class="stat-label">\
+    <a href="#" data-label="%(label)s" data-field="%(field)s">\
+     %(label)s</a> \
+    (%(count)s)</div>\
+  </div>',args));this.setup_stat_item_click($item);return $item;},setup_stat_item_click:function($item){var me=this;$item.find('a').click(function(){var fieldname=$(this).attr('data-field');var label=$(this).attr('data-label');me.set_filter(fieldname,label);return false;});},set_filter:function(fieldname,label){var filter=this.filter_list.get_filter(fieldname);if(filter){var v=filter.field.get_value();if(v.indexOf(label)!=-1){return false;}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{filter.set_values(fieldname,'in',v+', '+label);}}}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{this.filter_list.add_filter(fieldname,'=',label);}}
+this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags'];this.show_hide_check_column();},columns:[{width:'3%',content:'check'},{width:'4%',content:'avatar'},{width:'3%',content:'docstatus',css:{"text-align":"center"}},{width:'35%',content:'name'},{width:'40%',content:'tags',css:{'color':'#aaa'}},{width:'15%',content:'modified',css:{'text-align':'right','color':'#777'}}],render_column:function(data,parent,opts){var me=this;if(opts.css){$.each(opts.css,function(k,v){$(parent).css(k,v)});}
+if(opts.content.indexOf&&opts.content.indexOf('+')!=-1){$.map(opts.content.split('+'),function(v){me.render_column(data,parent,{content:v});});return;}
+if(typeof opts.content=='function'){opts.content(parent,data);}
+else if(opts.content=='name'){$(parent).append(repl('<a href="#!Form/%(doctype)s/%(name)s">%(name)s</a>',data));}
+else if(opts.content=='avatar'){$(parent).append(repl('<span class="avatar-small"><img src="%(avatar)s" \
+    title="%(fullname)s"/></span>',data));}
+else if(opts.content=='check'){$(parent).append('<input class="list-delete" type="checkbox">');$(parent).find('input').data('name',data.name);}
+else if(opts.content=='docstatus'){$(parent).append(repl('<span class="docstatus"><i class="%(docstatus_icon)s" \
+    title="%(docstatus_title)s"></i></span>',data));}
+else if(opts.content=='tags'){this.add_user_tags(parent,data);}
+else if(opts.content=='modified'){$(parent).append(data.when);}
+else if(opts.type=='bar-graph'){args={percent:data[opts.content],fully_delivered:(data[opts.content]>99?'bar-complete':''),label:opts.label}
+$(parent).append(repl('<span class="bar-outer" style="width: 30px; float: right" \
+    title="%(percent)s% %(label)s">\
+    <span class="bar-inner %(fully_delivered)s" \
+     style="width: %(percent)s%;"></span>\
+   </span>',args));}
+else if(data[opts.content]){$(parent).append(' '+data[opts.content]);}},render:function(row,data){var me=this;this.prepare_data(data);rowhtml='';$.each(this.columns,function(i,v){rowhtml+=repl('<td style="width: %(width)s"></td>',v);});var tr=$(row).html('<table><tbody><tr>'+rowhtml+'</tr></tbody></table>').find('tr').get(0);$.each(this.columns,function(i,v){me.render_column(data,tr.cells[i],v);});},prepare_data:function(data){data.fullname=wn.user_info(data.owner).fullname;data.avatar=wn.user_info(data.owner).image;data.when=dateutil.str_to_user(data.modified).split(' ')[0];var diff=dateutil.get_diff(dateutil.get_today(),data.modified.split(' ')[0]);if(diff==0){data.when='Today'}
+if(diff==1){data.when='Yesterday'}
+if(diff==2){data.when='2 days ago'}
+if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';data.docstatus_title='Editable';}else if(data.docstatus==1){data.docstatus_icon='icon-lock';data.docstatus_title='Submitted';}else if(data.docstatus==2){data.docstatus_icon='icon-remove';data.docstatus_title='Cancelled';}},add_user_tags:function(parent,data){var me=this;if(data._user_tags){$.each(data._user_tags.split(','),function(i,t){if(t){$('<span class="label label-info" style="cursor: pointer">'
++strip(t)+'</span>').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}},show_hide_check_column:function(){if(!this.doclistview.can_delete){this.columns=$.map(this.columns,function(v,i){if(v.content!='check')return v});}}})
+/*
+ *	lib/js/wn/views/pageview.js
+ */
+wn.provide('wn.views.pageview');wn.views.pageview={pages:{},with_page:function(name,callback){if(!locals.Page[name]){wn.call({method:'webnotes.widgets.page.getpage',args:{'name':name},callback:callback});}else{callback();}},show:function(name){if(!name)name=wn.boot.home_page;wn.views.pageview.with_page(name,function(r){if(r&&r.exc){if(!r['403'])wn.container.change_to('404');}else if(!wn.pages[name]){wn.views.pageview.pages[name]=new wn.views.Page(name);}
+wn.container.change_to(name);});}}
+wn.views.Page=Class.extend({init:function(name){this.name=name;var me=this;this.pagedoc=locals.Page[this.name];this.wrapper=wn.container.add_page(this.name);this.wrapper.label=this.pagedoc.title||this.pagedoc.name;this.wrapper.innerHTML=this.pagedoc.content;wn.dom.eval(this.pagedoc.__script||this.pagedoc.script||'');wn.dom.set_style(this.pagedoc.style||'');this.trigger('onload');$(this.wrapper).bind('show',function(){cur_frm=null;me.trigger('onshow');me.trigger('refresh');});},trigger:function(eventname){var me=this;try{if(pscript[eventname+'_'+this.name]){pscript[eventname+'_'+this.name](me.wrapper);}else if(me.wrapper[eventname]){me.wrapper[eventname](me.wrapper);}}catch(e){console.log(e);}}})
+wn.views.make_404=function(){var page=wn.container.add_page('404');$(page).html('<div class="layout-wrapper">\
+  <h1>Not Found</h1><br>\
+  <p>Sorry we were unable to find what you were looking for.</p>\
+  <p><a href="#">Go back to home</a></p>\
+  </div>').toggle(false);};wn.views.make_403=function(){var page=wn.container.add_page('403');$(page).html('<div class="layout-wrapper">\
+  <h1>Not Permitted</h1><br>\
+  <p>Sorry you are not permitted to view this page.</p>\
+  <p><a href="#">Go back to home</a></p>\
+  </div>').toggle(false);};
+/*
+ *	lib/js/wn/views/formview.js
+ */
+wn.provide('wn.views.formview');wn.views.formview={show:function(dt,dn){if(wn.model.new_names[dn])
+dn=wn.model.new_names[dn];wn.model.with_doctype(dt,function(){wn.model.with_doc(dt,dn,function(dn,r){if(r&&r['403'])return;if(!(locals[dt]&&locals[dt][dn])){wn.container.change_to('404');return;}
+if(!wn.views.formview[dt]){wn.views.formview[dt]=wn.container.add_page('Form - '+dt);wn.views.formview[dt].frm=new _f.Frm(dt,wn.views.formview[dt]);}
+wn.container.change_to('Form - '+dt);wn.views.formview[dt].frm.refresh(dn);});})},create:function(dt){var new_name=LocalDB.create(dt);wn.set_route('Form',dt,new_name);}}
+/*
+ *	lib/js/wn/views/reportview.js
+ */
+wn.views.reportview={show:function(dt,rep_name){wn.require('lib/js/legacy/report.compressed.js');dt=get_label_doctype(dt);if(!_r.rb_con){_r.rb_con=new _r.ReportContainer();}
+_r.rb_con.set_dt(dt,function(rb){if(rep_name){var t=rb.current_loaded;rb.load_criteria(rep_name);if((rb.dt)&&(!rb.dt.has_data()||rb.current_loaded!=t)){rb.dt.run();}}
+if(!rb.forbidden){wn.container.change_to('Report Builder');}});}}
+wn.views.reportview2={show:function(dt){var page_name='Report-'+dt;if(!wn.pages[page_name])
+new wn.views.ReportView(dt);else
+wn.container.change_to(page_name);}}
+wn.views.ReportView=wn.ui.Listing.extend({init:function(doctype){var me=this;this.import_slickgrid();this.doctype=doctype;this.tab_name='`tab'+doctype+'`';this.columns=[['name'],['owner'],['creation'],['modified']];this.page=wn.container.add_page('Report-'+doctype);wn.model.with_doctype(doctype,function(){me.make_page();me.setup();me.make_column_picker();me.make_export();});},import_slickgrid:function(){wn.require('lib/js/lib/slickgrid/slick.grid.css');wn.require('lib/js/lib/slickgrid/slick-default-theme.css');wn.require('lib/js/lib/slickgrid/jquery.event.drag.min.js');wn.require('lib/js/lib/slickgrid/slick.core.js');wn.require('lib/js/lib/slickgrid/slick.grid.js');wn.dom.set_style('.slick-cell { font-size: 12px; }');},make_page:function(){wn.ui.make_app_page({parent:this.page,title:'Report - '+this.doctype,single_column:true});wn.container.change_to(this.page.label);},setup:function(){var me=this;this.make({appframe:this.page.appframe,method:'webnotes.widgets.doclistview.get',get_args:this.get_args,parent:$(this.page).find('.layout-main'),start:0,page_length:20,show_filters:true,show_grid:true,new_doctype:this.doctype,allow_delete:true,});this.run();},get_args:function(){var me=this;return{doctype:this.doctype,fields:$.map(this.columns,function(v){return(v[1]?('`tab'+v[1]+'`'):me.tab_name)+'.'+v[0]}),filters:this.filter_list.get_filters(),docstatus:['0','1','2']}},build_columns:function(){var me=this;return $.map(this.columns,function(c){return{id:c[0],field:c[0],name:(wn.meta.docfield_map[c[1]||me.doctype][c[0]]?wn.meta.docfield_map[c[1]||me.doctype][c[0]].label:toTitle(c[0])),width:120}});},render_list:function(){var columns=[{id:'_idx',field:'_idx',name:'Sr.',width:40}].concat(this.build_columns());$.each(this.data,function(i,v){v._idx=i+1;});var options={enableCellNavigation:true,enableColumnReorder:false};var grid=new Slick.Grid(this.$w.find('.result-list').css('border','1px solid grey').css('height','500px').get(0),this.data,columns,options);},make_column_picker:function(){var me=this;this.column_picker=new wn.ui.ColumnPicker(this);this.page.appframe.add_button('Pick Columns',function(){me.column_picker.show(me.columns);},'icon-th-list');},make_export:function(){var me=this;if(wn.user.has_role(['Administrator','System Manager','Data Export'])){this.page.appframe.add_button('Export',function(){me.export();},'icon-download-alt');}},export:function(){var args=this.get_args();args.cmd='webnotes.widgets.doclistview.export_query'
+open_url_post(wn.request.url,args)}});wn.ui.ColumnPicker=Class.extend({init:function(list){this.list=list;this.doctype=list.doctype;this.selects={};},show:function(columns){wn.require('lib/js/lib/jquery/jquery.ui.sortable.js');var me=this;if(!this.dialog){this.dialog=new wn.ui.Dialog({title:'Pick Columns',width:'400'});}
+$(this.dialog.body).html('<div class="help">Drag to sort columns</div>\
+   <div class="column-list"></div>\
+   <div><button class="btn btn-small btn-add"><i class="icon-plus"></i>\
+    Add Column</button></div>\
+   <hr>\
+   <div><button class="btn btn-small btn-info">Update</div>');$.each(columns,function(i,c){me.add_column(c);});$(this.dialog.body).find('.column-list').sortable();$(this.dialog.body).find('.btn-add').click(function(){me.add_column('name');});$(this.dialog.body).find('.btn-info').click(function(){me.dialog.hide();me.list.columns=[];$(me.dialog.body).find('select').each(function(){me.list.columns.push([$(this).val(),$(this).find('option:selected').attr('table')]);})
+me.list.run();});this.dialog.show();},add_column:function(c){var w=$('<div style="padding: 5px 5px 5px 35px; background-color: #eee; width: 70%; \
+   margin-bottom: 10px; border-radius: 3px; cursor: move;">\
+   <a class="close" style="margin-top: 5px;">&times</a>\
+   </div>').appendTo($(this.dialog.body).find('.column-list'));var fieldselect=new wn.ui.FieldSelect(w,this.doctype);fieldselect.$select.css('width','90%').val(c);w.find('.close').click(function(){$(this).parent().remove();});}});
+/*
+ *	lib/js/wn/request.js
+ */
+wn.provide('wn.request');wn.request.url='index.cgi';wn.request.prepare=function(opts){if(opts.btn)$(opts.btn).set_working();if(opts.show_spinner)set_loading();if(opts.freeze)freeze();if(!opts.args.cmd){console.log(opts)
+throw"Incomplete Request";}}
+wn.request.cleanup=function(opts,r){if(opts.btn)$(opts.btn).done_working();if(opts.show_spinner)hide_loading();if(opts.freeze)unfreeze();if(wn.boot.sid&&wn.get_cookie('sid')!=wn.boot.sid){msgprint('Session expired');setTimeout('wn.app.redirect_to_login()',3000);return;}
+if(r.server_messages)msgprint(r.server_messages)
+if(r.exc){console.log(r.exc);};if(r['403']){wn.container.change_to('403');}
+if(r.docs)LocalDB.sync(r.docs);}
+wn.request.call=function(opts){wn.request.prepare(opts);$.ajax({url:opts.url||wn.request.url,data:opts.args,type:opts.type||'POST',dataType:opts.dataType||'json',success:function(r,xhr){wn.request.cleanup(opts,r);opts.success(r,xhr.responseText);},error:function(xhr,textStatus){wn.request.cleanup(opts,{});show_alert('Unable to complete request: '+textStatus)
+if(opts.error)opts.error(xhr)}})}
+wn.call=function(opts){var args=$.extend({},opts.args)
+if(opts.module&&opts.page){args.cmd=opts.module+'.page.'+opts.page+'.'+opts.page+'.'+opts.method}else if(opts.method){args.cmd=opts.method;}
+for(key in args){if(args[key]&&typeof args[key]!='string'){args[key]=JSON.stringify(args[key]);}}
+wn.request.call({args:args,success:opts.callback,error:opts.error,btn:opts.btn,freeze:opts.freeze,show_spinner:!opts.no_spinner});}
+/*
  *	lib/js/core.js
  */
-if(!console){var console={log:function(txt){errprint(txt);}}}
-wn.versions.check();$(document).bind('ready',function(){var base=window.location.href.split('#')[0];$.each($('a[softlink!="false"]'),function(i,v){if(v.href.substr(0,base.length)==base){var path=(v.href.substr(base.length));if(path.substr(0,1)!='#'){v.href=base+'#'+path;}}});if(!wn.settings.no_history&&window.location.hash){wn.page.set(window.location.hash.substr(1));}});
+if(!console){var console={log:function(txt){alert(txt);}}}
+wn.versions.check();$(document).bind('ready',function(){wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
+
 /*
  *	lib/js/legacy/globals.js
  */
 wn.provide('wn.widgets.form');wn.provide('wn.widgets.report');wn.provide('wn.utils');wn.provide('wn.model');wn.provide('wn.profile');wn.provide('wn.session');wn.provide('_f');wn.provide('_p');wn.provide('_r');wn.provide('_c');wn.provide('_e');wn.provide('_startup_data')
-wn.settings.no_history=1;var NEWLINE='\n';var login_file='';var version='v170';var profile=null;var session={};var is_testing=false;var user=null;var user_defaults=null;var user_roles=null;var user_fullname=null;var user_email=null;var user_img={};var home_page=null;var hide_autosuggest=null;var page_body=null;var pscript={};var selector=null;var top_index=91;var _f={};var _p={};var _e={};var _r={};var FILTER_SEP='\1';var frms={};var cur_frm=null;var pscript={};var validated=true;var validation_message='';var tinymce_loaded=null;var cur_autosug=null;
+wn.settings.no_history=1;var NEWLINE='\n';var profile=null;var user=null;var user_defaults=null;var user_roles=null;var user_fullname=null;var user_email=null;var user_img={};var pscript={};var selector=null;var top_index=91;var _f={};var _p={};var _e={};var _r={};var FILTER_SEP='\1';var frms={};var cur_frm=null;var pscript={};var validated=true;var validation_message='';var tinymce_loaded=null;
 /*
  *	lib/js/legacy/utils/datatype.js
  */
-var startup_list=[];wn.utils.full_name=function(fn,ln){return fn+(ln?' ':'')+(ln?ln:'')}
+wn.utils.full_name=function(fn,ln){return fn+(ln?' ':'')+(ln?ln:'')}
 function fmt_money(v){if(v==null||v=='')return'0.00';v=(v+'').replace(/,/g,'');v=parseFloat(v);if(isNaN(v)){return'';}else{var cp=wn.control_panel;var val=2;if(cp.currency_format=='Millions')val=3;v=v.toFixed(2);var delimiter=",";amount=v+'';var a=amount.split('.',2)
 var d=a[1];var i=parseInt(a[0]);if(isNaN(i)){return'';}
 var minus='';if(v<0){minus='-';}
@@ -198,7 +423,7 @@
 function nth(number){number=cint(number);var s='th';if((number+'').substr(-1)=='1')s='st';if((number+'').substr(-1)=='2')s='nd';if((number+'').substr(-1)=='3')s='rd';return number+s;}
 function flt(v,decimals){if(v==null||v=='')return 0;v=(v+'').replace(/,/g,'');v=parseFloat(v);if(isNaN(v))
 v=0;if(decimals!=null)
-return v.toFixed(decimals);return v;}
+return parseFloat(v.toFixed(decimals));return v;}
 function esc_quotes(s){if(s==null)s='';return s.replace(/'/,"\'");}
 var crop=function(s,len){if(s.length>len)
 return s.substr(0,len-3)+'...';else
@@ -207,7 +432,7 @@
 s=rstrip(s,chars);return s;}
 var lstrip=function(s,chars){if(!chars)chars=['\n','\t',' '];var first_char=s.substr(0,1);while(in_list(chars,first_char)){var s=s.substr(1);first_char=s.substr(0,1);}
 return s;}
-var rstrip=function(s,chars){if(!chars)chars=['\n','\t',' '];var last_char=s.substr(s.length-1);while(in_list(chars,last_char)){var s=s.substr(0,this.length-1);last_char=s.substr(this.length-1);}
+var rstrip=function(s,chars){if(!chars)chars=['\n','\t',' '];var last_char=s.substr(s.length-1);while(in_list(chars,last_char)){var s=s.substr(0,s.length-1);last_char=s.substr(s.length-1);}
 return s;}
 function repl_all(s,s1,s2){var idx=s.indexOf(s1);while(idx!=-1){s=s.replace(s1,s2);idx=s.indexOf(s1);}
 return s;}
@@ -221,17 +446,7 @@
 var inList=in_list;function add_lists(l1,l2){var l=[];for(var k in l1)l.push(l1[k]);for(var k in l2)l.push(l2[k]);return l;}
 function docstring(obj){return JSON.stringify(obj);}
 function DocLink(p,doctype,name,onload){var a=$a(p,'span','link_type');a.innerHTML=a.dn=name;a.dt=doctype;a.onclick=function(){loaddoc(this.dt,this.dn,onload)};return a;}
-var doc_link=DocLink;var known_numbers={0:'zero',1:'one',2:'two',3:'three',4:'four',5:'five',6:'six',7:'seven',8:'eight',9:'nine',10:'ten',11:'eleven',12:'twelve',13:'thirteen',14:'fourteen',15:'fifteen',16:'sixteen',17:'seventeen',18:'eighteen',19:'nineteen',20:'twenty',30:'thirty',40:'forty',50:'fifty',60:'sixty',70:'seventy',80:'eighty',90:'ninety'}
-function in_words(n){var is_million=wn.control_panel.currency_format=='Millions'?1:0;n=cint(n)
-if(known_numbers[n])return known_numbers[n];var bestguess=n+'';var remainder=0
-if(n<=20)
-alert('Error while converting to words');else if(n<100){return in_words(Math.floor(n/10)*10)+'-'+in_words(n%10);}else if(n<1000){bestguess=in_words(Math.floor(n/100))+' '+'hundred';remainder=n%100;}else if(!is_million){if(n<100000){bestguess=in_words(Math.floor(n/1000))+' '+'thousand';remainder=n%1000;}else if(n<10000000){bestguess=in_words(Math.floor(n/100000))+' '+'lakh';remainder=n%100000;}else{bestguess=in_words(Math.floor(n/10000000))+' '+'crore'
-remainder=n%10000000}}else{if(n<1000000){bestguess=in_words(Math.floor(n/1000))+' '+'thousand';remainder=n%1000;}else if(n<1000000000){bestguess=in_words(Math.floor(n/1000000))+' '+'million';remainder=n%1000000;}else{bestguess=in_words(Math.floor(n/1000000000))+' '+'billion'
-remainder=n%1000000000}}
-if(remainder){if(remainder>=100)comma=','
-else comma=''
-return bestguess+comma+' '+in_words(remainder);}else{return bestguess;}}
-function roundNumber(num,dec){var result=Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);return result;}
+var doc_link=DocLink;function roundNumber(num,dec){var result=Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);return result;}
 /*
  *	lib/js/legacy/utils/datetime.js
  */
@@ -239,7 +454,7 @@
 var month_list=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];var month_last={1:31,2:28,3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31}
 var month_list_full=['January','February','March','April','May','June','July','August','September','October','November','December'];var week_list=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];var week_list_full=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];function int_to_str(i,len){i=''+i;if(i.length<len)for(c=0;c<(len-i.length);c++)i='0'+i;return i}
 wn.datetime={str_to_obj:function(d){if(!d)return new Date();var tm=[null,null];if(d.search(' ')!=-1){var tm=d.split(' ')[1].split(':');var d=d.split(' ')[0];}
-if(d.search('-')!=-1){var t=d.split('-');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else if(d.search('/')!=-1){var t=d.split('/');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else{return new Date();}},obj_to_str:function(d){return d.getFullYear()+'-'+int_to_str(d.getMonth()+1,2)+'-'+int_to_str(d.getDate(),2);},obj_to_user:function(d){return dateutil.str_to_user(dateutil.obj_to_str(d));},get_diff:function(d1,d2){return((d1-d2)/86400000);},get_day_diff:function(d1,d2){return dateutil.get_diff(new Date(d1.getYear(),d1.getMonth(),d1.getDate(),0,0),new Date(d2.getYear(),d2.getMonth(),d2.getDate(),0,0))},add_days:function(d,days){d.setTime(d.getTime()+(days*24*60*60*1000));return d},add_months:function(d,months){dt=dateutil.str_to_obj(d)
+if(d.search('-')!=-1){var t=d.split('-');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else if(d.search('/')!=-1){var t=d.split('/');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else{return new Date();}},obj_to_str:function(d){return d.getFullYear()+'-'+int_to_str(d.getMonth()+1,2)+'-'+int_to_str(d.getDate(),2);},obj_to_user:function(d){return dateutil.str_to_user(dateutil.obj_to_str(d));},get_diff:function(d1,d2){if(typeof d1=='string')d1=dateutil.str_to_obj(d1);if(typeof d2=='string')d2=dateutil.str_to_obj(d2);return((d1-d2)/86400000);},get_day_diff:function(d1,d2){return dateutil.get_diff(new Date(d1.getYear(),d1.getMonth(),d1.getDate(),0,0),new Date(d2.getYear(),d2.getMonth(),d2.getDate(),0,0))},add_days:function(d,days){d.setTime(d.getTime()+(days*24*60*60*1000));return d},add_months:function(d,months){dt=dateutil.str_to_obj(d)
 new_dt=new Date(dt.getFullYear(),dt.getMonth()+months,dt.getDate())
 if(new_dt.getDate()!=dt.getDate()){return dateutil.month_end(new Date(dt.getFullYear(),dt.getMonth()+months,1))}
 return dateutil.obj_to_str(new_dt);},month_start:function(){var d=new Date();return d.getFullYear()+'-'+int_to_str(d.getMonth()+1,2)+'-01';},month_end:function(d){if(!d)var d=new Date();var m=d.getMonth()+1;var y=d.getFullYear();last_date=month_last[m];if(m==2&&(y%4)==0&&((y%100)!=0||(y%400)==0))
@@ -280,20 +495,22 @@
  */
 wn.dom.set_unique_id=function(ele){var id='unique-'+wn.dom.id_count;ele.setAttribute('id',id);wn.dom.id_count++;return id;}
 wn.tinymce={add_simple:function(ele,height){if(ele.myid){tinyMCE.execCommand('mceAddControl',true,ele.myid);return;}
-ele.myid=wn.dom.set_unique_id(ele);$(ele).tinymce({script_url:'lib/js/legacy/tiny_mce_33/tiny_mce.js',height:height?height:'200px',theme:"advanced",theme_advanced_buttons1:"bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,outdent,indent,link,unlink,forecolor,backcolor,code,",theme_advanced_buttons2:"",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",theme_advanced_path:false,theme_advanced_resizing:false});},remove:function(ele){tinyMCE.execCommand('mceRemoveControl',true,ele.myid);},get_value:function(ele){return tinymce.get(ele.myid).getContent();}}
+ele.myid=wn.dom.set_unique_id(ele);$(ele).tinymce({script_url:'lib/js/lib/tiny_mce_33/tiny_mce.js',height:height?height:'200px',theme:"advanced",theme_advanced_buttons1:"bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,outdent,indent,link,unlink,forecolor,backcolor,code,",theme_advanced_buttons2:"",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",theme_advanced_path:false,theme_advanced_resizing:false});},remove:function(ele){tinyMCE.execCommand('mceRemoveControl',true,ele.myid);},get_value:function(ele){return tinymce.get(ele.myid).getContent();}}
 wn.ele={link:function(args){var span=$a(args.parent,'span','link_type',args.style);span.loading_img=$a(args.parent,'img','',{margin:'0px 4px -2px 4px',display:'none'});span.loading_img.src='lib/images/ui/button-load.gif';span.innerHTML=args.label;span.user_onclick=args.onclick;span.onclick=function(){if(!this.disabled)this.user_onclick(this);}
 span.set_working=function(){this.disabled=1;$di(this.loading_img);}
 span.done_working=function(){this.disabled=0;$dh(this.loading_img);}
 return span;}}
 function $ln(parent,label,onclick,style){return wn.ele.link({parent:parent,label:label,onclick:onclick,style:style})}
-function $btn(parent,label,onclick,style,css_class,is_ajax){wn.require('lib/js/wn/ui/button.js');if(css_class==='green')css_class='btn-primary';return new wn.ui.Button({parent:parent,label:label,onclick:onclick,style:style,is_ajax:is_ajax,css_class:css_class}).btn;}
+function $btn(parent,label,onclick,style,css_class,is_ajax){if(css_class==='green')css_class='btn-info';return new wn.ui.Button({parent:parent,label:label,onclick:onclick,style:style,is_ajax:is_ajax,css_class:css_class}).btn;}
 $item_normal=function(ele){$y(ele,{padding:'6px 8px',cursor:'pointer',marginRight:'8px',whiteSpace:'nowrap',overflow:'hidden',borderBottom:'1px solid #DDD'});$bg(ele,'#FFF');$fg(ele,'#000');}
 $item_active=function(ele){$bg(ele,'#FE8');$fg(ele,'#000');}
 $item_selected=function(ele){$bg(ele,'#777');$fg(ele,'#FFF');}
-$item_pressed=function(ele){$bg(ele,'#F90');$fg(ele,'#FFF');};(function($){$.fn.set_working=function(){var ele=this.get(0);if(ele.loading_img){$di(ele.loading_img)}else{ele.disabled=1;ele.loading_img=$a(ele.parentNode,'img','',{marginLeft:'4px',marginBottom:'-2px',display:'inline'});ele.loading_img.src='lib/images/ui/button-load.gif';}}
-$.fn.done_working=function(){var ele=this.get(0);ele.disabled=0;if(ele.loading_img){$dh(ele.loading_img)};}})(jQuery);function set_opacity(ele,ieop){var op=ieop/100;if(ele.filters){try{ele.filters.item("DXImageTransform.Microsoft.Alpha").opacity=ieop;}catch(e){ele.style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity='+ieop+')';}}else{ele.style.opacity=op;}}
+$item_pressed=function(ele){$bg(ele,'#F90');$fg(ele,'#FFF');};function set_opacity(ele,ieop){var op=ieop/100;if(ele.filters){try{ele.filters.item("DXImageTransform.Microsoft.Alpha").opacity=ieop;}catch(e){ele.style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity='+ieop+')';}}else{ele.style.opacity=op;}}
 $br=function(ele,r,corners){if(corners){var cl=['top-left','top-right','bottom-right','bottom-left'];for(var i=0;i<4;i++){if(corners[i]){$(ele).css('-moz-border-radius-'+cl[i].replace('-',''),r).css('-webkit-'+cl[i]+'-border-radius',r);}}}else{$(ele).css('-moz-border-radius',r).css('-webkit-border-radius',r).css('border-radius',r);}}
 $bs=function(ele,r){$(ele).css('-moz-box-shadow',r).css('-webkit-box-shadow',r).css('box-shadow',r);}
+function SelectWidget(parent,options,width,editable,bg_color){var me=this;this.inp=$a(parent,'select');if(options)add_sel_options(this.inp,options);if(width)$y(this.inp,{width:width});this.set_width=function(w){$y(this.inp,{width:w})};this.set_options=function(o){add_sel_options(this.inp,o);}
+this.inp.onchange=function(){if(me.onchange)me.onchange(this);}
+return;}
 function empty_select(s){if(s.custom_select){s.empty();return;}
 if(s.inp)s=s.inp;if(s){var tmplen=s.length;for(var i=0;i<tmplen;i++)s.options[0]=null;}}
 function sel_val(s){if(s.custom_select){return s.inp.value?s.inp.value:'';}
@@ -323,12 +540,9 @@
 d.style.display=t;}
 function $di(d){if(d&&d.substr)d=$i(d);if(d)d.style.display='inline';}
 function $i(id){if(!id)return null;if(id&&id.appendChild)return id;return document.getElementById(id);}
-function $t(parent,txt){if(parent.substr)parent=$i(parent);return parent.appendChild(document.createTextNode(txt));}
 function $w(e,w){if(e&&e.style&&w)e.style.width=w;}
 function $h(e,h){if(e&&e.style&&h)e.style.height=h;}
 function $bg(e,w){if(e&&e.style&&w)e.style.backgroundColor=w;}
-function $fg(e,w){if(e&&e.style&&w)e.style.color=w;}
-function $op(e,w){if(e&&e.style&&w){set_opacity(e,w);}}
 function $y(ele,s){if(ele&&s){for(var i in s)ele.style[i]=s[i];};return ele;}
 function $yt(tab,r,c,s){var rmin=r;var rmax=r;if(r=='*'){rmin=0;rmax=tab.rows.length-1;}
 if(r.search&&r.search('-')!=-1){r=r.split('-');rmin=cint(r[0]);rmax=cint(r[1]);}
@@ -336,8 +550,7 @@
 if(c.search&&c.search('-')!=-1){c=c.split('-');rmin=cint(c[0]);rmax=cint(c[1]);}
 for(var ri=rmin;ri<=rmax;ri++){for(var ci=cmin;ci<=cmax;ci++)
 $y($td(tab,ri,ci),s);}}
-function set_style(txt){var se=document.createElement('style');se.type="text/css";if(se.styleSheet){se.styleSheet.cssText=txt;}else{se.appendChild(document.createTextNode(txt));}
-document.getElementsByTagName('head')[0].appendChild(se);}
+function set_style(txt){wn.dom.set_style(txt);}
 function make_table(parent,nr,nc,table_width,widths,cell_style,table_style){var t=$a(parent,'table');t.style.borderCollapse='collapse';if(table_width)t.style.width=table_width;if(cell_style)t.cell_style=cell_style;for(var ri=0;ri<nr;ri++){var r=t.insertRow(ri);for(var ci=0;ci<nc;ci++){var c=r.insertCell(ci);if(ri==0&&widths&&widths[ci]){c.style.width=widths[ci];}
 if(cell_style){for(var s in cell_style)c.style[s]=cell_style[s];}}}
 t.append_row=function(){return append_row(this);}
@@ -354,56 +567,29 @@
 function get_scroll_top(){var st=0;if(document.documentElement&&document.documentElement.scrollTop)
 st=document.documentElement.scrollTop;else if(document.body&&document.body.scrollTop)
 st=document.body.scrollTop;return st;}
-function get_cookie(c){var t=""+document.cookie;var ind=t.indexOf(c);if(ind==-1||c=="")return"";var ind1=t.indexOf(';',ind);if(ind1==-1)ind1=t.length;return unescape(t.substring(ind+c.length+1,ind1));}
 wn.urllib={get_arg:function(name){name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(window.location.href);if(results==null)
 return"";else
 return decodeURIComponent(results[1]);},get_dict:function(){var d={}
 var t=window.location.href.split('?')[1];if(!t)return d;if(t.indexOf('#')!=-1)t=t.split('#')[0];if(!t)return d;t=t.split('&');for(var i=0;i<t.length;i++){var a=t[i].split('=');d[decodeURIComponent(a[0])]=decodeURIComponent(a[1]);}
 return d;},get_base_url:function(){var url=window.location.href.split('#')[0].split('?')[0].split('index.cgi')[0];if(url.substr(url.length-1,1)=='/')url=url.substr(0,url.length-1)
 return url},get_file_url:function(file_id){return repl('files/%(fn)s',{fn:file_id})}}
-get_url_arg=wn.urllib.get_arg;get_url_dict=wn.urllib.get_dict;var user_img={}
-var user_img_queue={};var user_img_loading=[];set_user_img=function(img,username,get_latest,img_id){function set_it(i){if(user_img[username]=='no_img_m')
-i.src='lib/images/ui/no_img_m.gif';else if(user_img[username]=='no_img_f')
-i.src='lib/images/ui/no_img_f.gif';else{ac_id=wn.control_panel.account_id;i.src=repl('cgi-bin/getfile.cgi?ac=%(ac)s&name=%(fn)s',{fn:user_img[username],ac:ac_id});}}
-if(img_id){user_img[username]=img_id;set_it(img);return;}
-if(user_img[username]&&!get_latest){set_it(img);}else{if(in_list(user_img_loading,username)){if(!user_img_queue[username])
-user_img_queue[username]=[];user_img_queue[username].push(img);return;}
-$c('webnotes.profile.get_user_img',{username:username},function(r,rt){delete user_img_loading[user_img_loading.indexOf(username)];user_img[username]=r.message;if(user_img_queue[username]){var q=user_img_queue[username];for(var i in q){set_it(q[i]);}}
-set_it(img);},null,1);user_img_loading.push(username);}}
+get_url_arg=wn.urllib.get_arg;get_url_dict=wn.urllib.get_dict;
 /*
  *	lib/js/legacy/utils/handler.js
  */
-var outUrl="index.cgi";var NULL_CHAR='^\5*';function checkResponse(r,on_timeout,no_spinner,freeze_msg){try{if(r.readyState==4&&r.status==200)return true;else return false;}catch(e){msgprint("error:Request timed out, try again");if(on_timeout)
-on_timeout();hide_loading();if(freeze_msg)
-unfreeze();return false;}}
-var pending_req=0;function newHttpReq(){if(!$.browser.msie)
-var r=new XMLHttpRequest();else if(window.ActiveXObject)
-var r=new ActiveXObject("Microsoft.XMLHTTP");return r;}
-function $c(command,args,fn,on_timeout,no_spinner,freeze_msg,btn){var req=newHttpReq();ret_fn=function(){if(checkResponse(req,on_timeout,no_spinner,freeze_msg)){if(btn)$(btn).done_working();if(!no_spinner)
-hide_loading();var rtxt=req.responseText;try{var r=JSON.parse(rtxt);}catch(e){msgprint('Handler Exception:'+rtxt);return;}
-if(freeze_msg)unfreeze();if(!validate_session(r,rtxt))return;if(r.exc){errprint(r.exc);console.log(r.exc);};if(r.server_messages){msgprint(r.server_messages);};if(r.docs){LocalDB.sync(r.docs);}
-saveAllowed=true;if(fn)fn(r,rtxt);}}
-if(btn)$(btn).set_working();req.onreadystatechange=ret_fn;req.open("POST",outUrl,true);req.setRequestHeader("ENCTYPE","multipart/form-data");req.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");args['cmd']=command;req.send(makeArgString(args));if(!no_spinner)set_loading();if(freeze_msg)freeze(freeze_msg,1);}
-function validate_session(r,rt){if(r.message=='Logged In'){start_sid=get_cookie('sid');return true;}
-if(start_sid&&start_sid!=get_cookie('sid')&&user&&user!='Guest'){page_body.set_session_changed();return;}
-if(r.exc&&r.session_status=='Session Expired'){resume_session();return;}
-if(r.exc&&r.session_status=='Logged Out'){msgprint('You have been logged out');setTimeout('redirect_to_login()',3000);return;}
-if(r.exc&&r.exc_type&&r.exc_type=='PermissionError'){loadpage('_home');}
-return true;}
-function $c_obj(doclist,method,arg,call_back,no_spinner,freeze_msg,btn){var args={'method':method,'arg':(typeof arg=='string'?arg:JSON.stringify(arg))}
-if(typeof doclist=='string')args.doctype=doclist;else args.docs=compress_doclist(doclist)
-$c('runserverobj',args,call_back,null,no_spinner,freeze_msg,btn);}
-function $c_page(module,page,method,arg,call_back,no_spinner,freeze_msg,btn){if(arg&&!arg.substr)arg=JSON.stringify(arg);$c(module+'.page.'+page+'.'+page+'.'+method,{'arg':arg},call_back,null,no_spinner,freeze_msg,btn);}
-wn.call=function(args){if(!args.args)args.args={};if(args.module&&args.page){$c_page(args.module,args.page,args.method,args.args,args.callback,args.no_spinner,false,args.btn);}else if(args.docs){$c_obj(args.doc,args.method,args.args,args.callback,args.no_spinner,false,args.btn);}else{$c(args.method,args.args,args.callback,false,args.no_spinner,false,args.btn);}}
+function $c(command,args,callback,error,no_spinner,freeze_msg,btn){wn.request.call({args:$.extend(args,{cmd:command}),success:callback,error:error,btn:btn,freeze:freeze_msg,show_spinner:!no_spinner})}
+function $c_obj(doclist,method,arg,callback,no_spinner,freeze_msg,btn){if(arg&&typeof arg!='string')arg=JSON.stringify(arg);args={cmd:'runserverobj',arg:arg,method:method};if(typeof doclist=='string')
+args.doctype=doclist;else
+args.docs=compress_doclist(doclist)
+wn.request.call({args:args,success:callback,btn:btn,freeze:freeze_msg,show_spinner:!no_spinner});}
+function $c_page(module,page,method,arg,callback,no_spinner,freeze_msg,btn){if(arg&&typeof arg!='string')arg=JSON.stringify(arg);wn.request.call({args:{cmd:module+'.page.'+page+'.'+page+'.'+method,arg:arg,method:method},success:callback,btn:btn,freeze:freeze_msg,show_spinner:!no_spinner});}
 function $c_obj_csv(doclist,method,arg){var args={}
 args.cmd='runserverobj';args.as_csv=1;args.method=method;args.arg=arg;if(doclist.substr)
 args.doctype=doclist;else
-args.docs=compress_doclist(doclist);open_url_post(outUrl,args);}
-function my_eval(co){var w=window;if(!w.execScript){if(/Gecko/.test(navigator.userAgent)){eval(co,w);}else{eval.call(w,co);}}else{w.execScript(co);}}
-function makeArgString(dict){var varList=[];for(key in dict){varList[varList.length]=key+'='+encodeURIComponent(dict[key]);}
-return varList.join('&');}
+args.docs=compress_doclist(doclist);open_url_post(wn.request.url,args);}
 function open_url_post(URL,PARAMS,new_window){var temp=document.createElement("form");temp.action=URL;temp.method="POST";temp.style.display="none";if(new_window){temp.target='_blank';}
-for(var x in PARAMS){var opt=document.createElement("textarea");opt.name=x;opt.value=PARAMS[x];temp.appendChild(opt);}
+for(var x in PARAMS){var opt=document.createElement("textarea");opt.name=x;var val=PARAMS[x];if(typeof val!='string')
+val=JSON.stringify(val);opt.value=val;temp.appendChild(opt);}
 document.body.appendChild(temp);temp.submit();return temp;}
 /*
  *	lib/js/legacy/utils/msgprint.js
@@ -418,233 +604,36 @@
 if(!msg_dialog.display)msg_dialog.show();var has_msg=msg_dialog.msg_area.innerHTML?1:0;var m=$a(msg_dialog.msg_area,'div','');if(has_msg)$y(m,{marginTop:'4px'});$dh(msg_dialog.msg_icon);if(msg.substr(0,6).toLowerCase()=='error:'){msg_dialog.msg_icon.src='lib/images/icons/error.gif';$di(msg_dialog.msg_icon);msg=msg.substr(6);}else if(msg.substr(0,8).toLowerCase()=='message:'){msg_dialog.msg_icon.src='lib/images/icons/application.gif';$di(msg_dialog.msg_icon);msg=msg.substr(8);}else if(msg.substr(0,3).toLowerCase()=='ok:'){msg_dialog.msg_icon.src='lib/images/icons/accept.gif';$di(msg_dialog.msg_icon);msg=msg.substr(3);}
 m.innerHTML=replace_newlines(msg);if(m.offsetHeight>200){$y(m,{height:'200px',width:'400px',overflow:'auto'})}
 msg_dialog.custom_onhide=callback;}
-var growl_area;function show_alert(txt,id){if(!growl_area){growl_area=$a(popup_cont,'div','',{position:'fixed',bottom:'8px',right:'8px',width:'320px',zIndex:10});}
+var growl_area;function show_alert(txt,id){if(!growl_area){if(!$('#dialog-container').length){$('<div id="dialog-container">').appendTo('body');}
+growl_area=$a($i('dialog-container'),'div','',{position:'fixed',bottom:'8px',right:'8px',width:'320px',zIndex:10});}
 var wrapper=$a(growl_area,'div','',{position:'relative'});var body=$a(wrapper,'div','notice');var c=$a(body,'i','icon-remove-sign',{cssFloat:'right',cursor:'pointer'});$(c).click(function(){$dh(this.wrapper)});c.wrapper=wrapper;var t=$a(body,'div','',{color:'#FFF'});$(t).html(txt);if(id){$(t).attr('id',id);}
 $(wrapper).hide().fadeIn(1000);}
 /*
- *	lib/js/legacy/utils/shortcut.js
+ *	lib/js/wn/ui/appframe.js
  */
-(function(jQuery){jQuery.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":"\"",",":"<",".":">","/":"?","\\":"|"}};function keyHandler(handleObj){if(typeof handleObj.data!=="string"){return;}
-var origHandler=handleObj.handler,keys=handleObj.data.toLowerCase().split(" ");handleObj.handler=function(event){if(this!==event.target&&(/textarea|select/i.test(event.target.nodeName)||event.target.type==="text")){return;}
-var special=event.type!=="keypress"&&jQuery.hotkeys.specialKeys[event.which],character=String.fromCharCode(event.which).toLowerCase(),key,modif="",possible={};if(event.altKey&&special!=="alt"){modif+="alt+";}
-if(event.ctrlKey&&special!=="ctrl"){modif+="ctrl+";}
-if(event.metaKey&&!event.ctrlKey&&special!=="meta"){modif+="meta+";}
-if(event.shiftKey&&special!=="shift"){modif+="shift+";}
-if(special){possible[modif+special]=true;}else{possible[modif+character]=true;possible[modif+jQuery.hotkeys.shiftNums[character]]=true;if(modif==="shift+"){possible[jQuery.hotkeys.shiftNums[character]]=true;}}
-for(var i=0,l=keys.length;i<l;i++){if(possible[keys[i]]){return origHandler.apply(this,arguments);}}};}
-jQuery.each(["keydown","keyup","keypress"],function(){jQuery.event.special[this]={add:keyHandler};});})(jQuery);
-/*
- *	lib/js/legacy/widgets/form/fields.js
- */
-var no_value_fields=['Section Break','Column Break','HTML','Table','FlexTable','Button','Image'];var codeid=0;var code_editors={};function Field(){this.with_label=1;}
-Field.prototype.make_body=function(){var ischk=(this.df.fieldtype=='Check'?1:0);if(this.parent)
-this.wrapper=$a(this.parent,'div');else
-this.wrapper=document.createElement('div');this.label_area=$a(this.wrapper,'div','',{margin:'8px 0px 2px 0px'});if(ischk&&!this.in_grid){this.input_area=$a(this.label_area,'span','',{marginRight:'4px'});this.disp_area=$a(this.label_area,'span','',{marginRight:'4px'});}
-if(this.with_label){this.label_span=$a(this.label_area,'span','field_label')
-this.label_icon=$a(this.label_area,'img','',{margin:'-3px 4px -3px 4px'});$dh(this.label_icon);this.label_icon.src='lib/images/icons/error.gif';this.label_icon.title='Mandatory value needs to be entered';this.suggest_icon=$a(this.label_area,'img','',{margin:'-3px 4px -3px 0px'});$dh(this.suggest_icon);this.suggest_icon.src='lib/images/icons/bullet_arrow_down.png';this.suggest_icon.title='With suggestions';}else{this.label_span=$a(this.label_area,'span','',{marginRight:'4px'})
-$dh(this.label_area);}
-if(!this.input_area){this.input_area=$a(this.wrapper,'div');this.disp_area=$a(this.wrapper,'div');}
-if(this.in_grid){if(this.label_area)$dh(this.label_area);}else{this.input_area.className='input_area';$y(this.wrapper,{marginBottom:'4px'});this.set_description();}
-if(this.onmake)this.onmake();}
-Field.prototype.set_max_width=function(){var no_max=['Code','Text Editor','Text','Table','HTML']
-if(this.wrapper&&this.layout_cell&&this.layout_cell.parentNode.cells&&this.layout_cell.parentNode.cells.length==1&&!in_list(no_max,this.df.fieldtype)){$y(this.wrapper,{paddingRight:'50%'});}}
-Field.prototype.set_label=function(){if(this.with_label&&this.label_area&&this.label!=this.df.label){this.label_span.innerHTML=this.df.label;this.label=this.df.label;}}
-Field.prototype.set_description=function(){if(this.df.description){var p=in_list(['Text Editor','Code','Check'],this.df.fieldtype)?this.label_area:this.wrapper;this.desc_area=$a(p,'div','field_description','',this.df.description)
-if(in_list(['Text Editor','Code'],this.df.fieldtype))
-$(this.desc_area).addClass('field_description_top');}}
-Field.prototype.get_status=function(){if(this.in_filter)this.not_in_form=this.in_filter;if(this.not_in_form){return'Write';}
-var fn=this.df.fieldname?this.df.fieldname:this.df.label;this.df=get_field(this.doctype,fn,this.docname);if(!this.df.permlevel)this.df.permlevel=0;var p=this.perm[this.df.permlevel];var ret;if(cur_frm.editable&&p&&p[WRITE])ret='Write';else if(p&&p[READ])ret='Read';else ret='None';if(this.df.fieldtype=='Binary')
-ret='None';if(cint(this.df.hidden))
-ret='None';if(ret=='Write'&&cint(cur_frm.doc.docstatus)>0)ret='Read';var a_o_s=cint(this.df.allow_on_submit);if(a_o_s&&(this.in_grid||(this.frm&&this.frm.not_in_container))){a_o_s=null;if(this.in_grid)a_o_s=this.grid.field.df.allow_on_submit;if(this.frm&&this.frm.not_in_container){a_o_s=cur_grid.field.df.allow_on_submit;}}
-if(cur_frm.editable&&a_o_s&&cint(cur_frm.doc.docstatus)>0&&!this.df.hidden){tmp_perm=get_perm(cur_frm.doctype,cur_frm.docname,1);if(tmp_perm[this.df.permlevel]&&tmp_perm[this.df.permlevel][WRITE])ret='Write';}
-return ret;}
-Field.prototype.set_style_mandatory=function(add){if(add){$(this.txt?this.txt:this.input).addClass('input-mandatory');if(this.disp_area)$(this.disp_area).addClass('input-mandatory');}else{$(this.txt?this.txt:this.input).removeClass('input-mandatory');if(this.disp_area)$(this.disp_area).removeClass('input-mandatory');}}
-Field.prototype.refresh_mandatory=function(){if(this.in_filter)return;if(this.df.reqd){if(this.label_area)this.label_area.style.color="#d22";this.set_style_mandatory(1);}else{if(this.label_area)this.label_area.style.color="#222";this.set_style_mandatory(0);}
-this.refresh_label_icon()
-this.set_reqd=this.df.reqd;}
-Field.prototype.refresh_display=function(){if(!this.current_status||this.current_status!=this.disp_status){if(this.disp_status=='Write'){if(this.make_input&&(!this.input)){this.make_input();if(this.onmake_input)this.onmake_input();}
-if(this.show)this.show()
-else{$ds(this.wrapper);}
-if(this.input){$ds(this.input_area);$dh(this.disp_area);if(this.input.refresh)this.input.refresh();}else{$dh(this.input_area);$ds(this.disp_area);}}else if(this.disp_status=='Read'){if(this.show)this.show()
-else{$ds(this.wrapper);}
-$dh(this.input_area);$ds(this.disp_area);}else{if(this.hide)this.hide();else $dh(this.wrapper);}
-this.current_status=this.disp_status;}}
-Field.prototype.refresh=function(){this.disp_status=this.get_status();if(this.in_grid&&this.table_refresh&&this.disp_status=='Write')
-{this.table_refresh();return;}
-this.set_label();this.refresh_display();if(this.onrefresh)
-this.onrefresh();if(this.input){if(this.input.refresh)this.input.refresh(this.df);}
-if(this.wrapper){this.wrapper.fieldobj=this;$(this.wrapper).trigger('refresh');}
-if(!this.not_in_form)
-this.set_input(_f.get_value(this.doctype,this.docname,this.df.fieldname));this.refresh_mandatory();this.set_max_width();}
-Field.prototype.refresh_label_icon=function(){if(this.df.reqd){if(this.get_value&&is_null(this.get_value())){if(this.label_icon)$ds(this.label_icon);$(this.txt?this.txt:this.input).addClass('field-to-update')}else{if(this.label_icon)$dh(this.label_icon);$(this.txt?this.txt:this.input).removeClass('field-to-update')}}}
-Field.prototype.set=function(val){if(this.not_in_form)
-return;if((!this.docname)&&this.grid){this.docname=this.grid.add_newrow();}
-if(in_list(['Data','Text','Small Text','Code'],this.df.fieldtype))
-val=clean_smart_quotes(val);var set_val=val;if(this.validate)set_val=this.validate(val);_f.set_value(this.doctype,this.docname,this.df.fieldname,set_val);this.value=val;}
-Field.prototype.set_input=function(val){this.value=val;if(this.input&&this.input.set_input){if(val==null)this.input.set_input('');else this.input.set_input(val);}
-var disp_val=val;if(val==null)disp_val='';this.set_disp(disp_val);}
-Field.prototype.run_trigger=function(){this.refresh_label_icon();if(this.df.reqd&&this.get_value&&!is_null(this.get_value())&&this.set_as_error)
-this.set_as_error(0);if(this.not_in_form){return;}
-if(cur_frm.cscript[this.df.fieldname])
-cur_frm.runclientscript(this.df.fieldname,this.doctype,this.docname);cur_frm.refresh_dependency();}
-Field.prototype.set_disp_html=function(t){if(this.disp_area){$(this.disp_area).addClass('disp_area');this.disp_area.innerHTML=(t==null?'':t);if(!t)$(this.disp_area).addClass('disp_area_no_val');}}
-Field.prototype.set_disp=function(val){this.set_disp_html(val);}
-Field.prototype.set_as_error=function(set){if(this.in_grid||this.in_filter)return;var w=this.txt?this.txt:this.input;if(set){$y(w,{border:'2px solid RED'});}else{$y(w,{border:'1px solid #888'});}}
-Field.prototype.activate=function(docname){this.docname=docname;this.refresh();if(this.input){var v=_f.get_value(this.doctype,this.docname,this.df.fieldname);this.last_value=v;if(this.input.onchange&&this.input.get_value&&this.input.get_value()!=v){if(this.validate)
-this.input.set_value(this.validate(v));else
-this.input.set_value((v==null)?'':v);if(this.format_input)
-this.format_input();}
-if(this.input.focus){try{this.input.focus();}catch(e){}}}
-if(this.txt){try{this.txt.focus();}catch(e){}
-this.txt.field_object=this;}}
-function DataField(){}DataField.prototype=new Field();DataField.prototype.make_input=function(){var me=this;this.input=$a_input(this.input_area,this.df.fieldtype=='Password'?'password':'text');this.get_value=function(){var v=this.input.value;if(this.validate)v=this.validate(v);return v;}
-this.input.name=this.df.fieldname;this.input.onchange=function(){if(!me.last_value)me.last_value='';if(me.validate)
-me.input.value=me.validate(me.input.value);me.set(me.input.value);if(me.format_input)
-me.format_input();if(in_list(['Currency','Float','Int'],me.df.fieldtype)){if(flt(me.last_value)==flt(me.input.value)){me.last_value=me.input.value;return;}}
-me.last_value=me.input.value;me.run_trigger();}
-this.input.set_input=function(val){if(val==null)val='';me.input.value=val;if(me.format_input)me.format_input();}
-if(this.df.options=='Suggest'){wn.require('lib/js/legacy/widgets/autosuggest.js');if(this.suggest_icon)$di(this.suggest_icon);this.set_get_query=function(){}
-this.get_query=function(doc,dt,dn){return repl('SELECT DISTINCT `%(fieldname)s` FROM `tab%(dt)s` WHERE `%(fieldname)s` LIKE "%s" LIMIT 50',{fieldname:me.df.fieldname,dt:me.df.parent})}
-var opts={script:'',json:true,maxresults:10,link_field:this};this.as=new AutoSuggest(this.input,opts);}}
-DataField.prototype.validate=function(v){if(this.df.options=='Phone'){if(v+''=='')return'';v1=''
-v=v.replace(/ /g,'').replace(/-/g,'').replace(/\(/g,'').replace(/\)/g,'');if(v&&v.substr(0,1)=='+'){v1='+';v=v.substr(1);}
-if(v&&v.substr(0,2)=='00'){v1+='00';v=v.substr(2);}
-if(v&&v.substr(0,1)=='0'){v1+='0';v=v.substr(1);}
-v1+=cint(v)+'';return v1;}else if(this.df.options=='Email'){if(v+''=='')return'';if(!validate_email(v)){msgprint(this.df.label+': '+v+' is not a valid email id');return'';}else
-return v;}else{return v;}}
-DataField.prototype.onrefresh=function(){if(this.input&&this.df.colour){var col='#'+this.df.colour.split(':')[1];$bg(this.input,col);}}
-function ReadOnlyField(){}
-ReadOnlyField.prototype=new Field();function HTMLField(){}
-HTMLField.prototype=new Field();HTMLField.prototype.with_label=0;HTMLField.prototype.set_disp=function(val){this.disp_area.innerHTML=val;}
-HTMLField.prototype.set_input=function(val){if(val)this.set_disp(val);}
-HTMLField.prototype.onrefresh=function(){this.set_disp(this.df.options?this.df.options:'');}
-var datepicker_active=0;function DateField(){}DateField.prototype=new Field();DateField.prototype.make_input=function(){var me=this;this.user_fmt=wn.control_panel.date_format;if(!this.user_fmt)this.user_fmt='dd-mm-yy';this.input=$a(this.input_area,'input');wn.require('lib/css/legacy/jquery-ui.css');$(this.input).datepicker({dateFormat:me.user_fmt.replace('yyyy','yy'),altFormat:'yy-mm-dd',changeYear:true,beforeShow:function(input,inst){datepicker_active=1},onClose:function(dateText,inst){datepicker_active=0;if(_f.cur_grid_cell)
-_f.cur_grid_cell.grid.cell_deselect();}});var me=this;me.input.onchange=function(){if(this.value==null)this.value='';if(!this.not_in_form)
-me.set(dateutil.user_to_str(me.input.value));me.run_trigger();}
-me.input.set_input=function(val){if(val==null)val='';else val=dateutil.str_to_user(val);me.input.value=val;}
-me.get_value=function(){if(me.input.value)
-return dateutil.user_to_str(me.input.value);}}
-DateField.prototype.set_disp=function(val){var v=dateutil.str_to_user(val);if(v==null)v='';this.set_disp_html(v);}
-DateField.prototype.validate=function(v){if(!v)return;var me=this;this.clear=function(){msgprint("Date must be in format "+this.user_fmt);me.input.set_input('');return'';}
-var t=v.split('-');if(t.length!=3){return this.clear();}
-else if(cint(t[1])>12||cint(t[1])<1){return this.clear();}
-else if(cint(t[2])>31||cint(t[2])<1){return this.clear();}
-return v;};var _link_onchange_flag=null;function LinkField(){}LinkField.prototype=new Field();LinkField.prototype.make_input=function(){var me=this;if(me.df.no_buttons){this.txt=$a(this.input_area,'input');this.input=this.txt;}else{makeinput_popup(this,'icon-search','icon-play','icon-plus');me.setup_buttons();me.onrefresh=function(){if(me.can_create&&cur_frm.doc.docstatus==0)
-$(me.btn2).css('display','inline-block');else $dh(me.btn2);}}
-me.txt.field_object=this;me.set_onchange();me.input.set_input=function(val){if(val==undefined)val='';me.txt.value=val;}
-me.get_value=function(){return me.txt.value;}
-wn.require('lib/js/legacy/widgets/autosuggest.js');var opts={script:'',json:true,maxresults:10,link_field:me};this.as=new AutoSuggest(me.txt,opts);}
-LinkField.prototype.setup_buttons=function(){var me=this;me.btn.onclick=function(){selector.set(me,me.df.options,me.df.label);selector.show(me.txt);}
-if(me.btn1)me.btn1.onclick=function(){if(me.txt.value&&me.df.options){loaddoc(me.df.options,me.txt.value);}}
-me.can_create=0;if((!me.not_in_form)&&in_list(profile.can_create,me.df.options)){me.can_create=1;me.btn2.onclick=function(){var on_save_callback=function(new_rec){if(new_rec){var d=_f.calling_doc_stack.pop();locals[d[0]][d[1]][me.df.fieldname]=new_rec;me.refresh();if(me.grid)me.grid.refresh();me.run_trigger();}}
-_f.calling_doc_stack.push([me.doctype,me.docname]);new_doc(me.df.options,me.on_new,1,on_save_callback,me.doctype,me.docname,me.frm.not_in_container);}}else{$dh(me.btn2);$y($td(me.tab,0,2),{width:'0px'});}}
-LinkField.prototype.set_onchange=function(){var me=this;me.txt.onchange=function(e){if(cur_autosug)return;if(_link_onchange_flag){return;}
-_link_onchange_flag=1;me.refresh_label_icon();if(me.not_in_form){_link_onchange_flag=0;return;}
-if(cur_frm){if(me.txt.value==locals[me.doctype][me.docname][me.df.fieldname]){me.set(me.txt.value);me.run_trigger();setTimeout('_link_onchange_flag = 0',500);return;}}
-me.set(me.txt.value);if(_f.cur_grid_cell)
-_f.cur_grid_cell.grid.cell_deselect();if(!me.txt.value){me.run_trigger();setTimeout('_link_onchange_flag = 0',500);return;}
-var fetch='';if(cur_frm.fetch_dict[me.df.fieldname])
-fetch=cur_frm.fetch_dict[me.df.fieldname].columns.join(', ');$c('webnotes.widgets.form.utils.validate_link',{'value':me.txt.value,'options':me.df.options,'fetch':fetch},function(r,rt){setTimeout('_link_onchange_flag = 0',500);if(selector&&selector.display)return;if(r.message=='Ok'){if(r.fetch_values)me.set_fetch_values(r.fetch_values);me.run_trigger();}else{var astr='';if(in_list(profile.can_create,me.df.options))astr=repl('<br><br><span class="link_type" onclick="newdoc(\'%(dt)s\')">Click here</span> to create a new %(dtl)s',{dt:me.df.options,dtl:get_doctype_label(me.df.options)})
-msgprint(repl('error:<b>%(val)s</b> is not a valid %(dt)s.<br><br>You must first create a new %(dt)s <b>%(val)s</b> and then select its value. To find an existing %(dt)s, click on the magnifying glass next to the field.%(add)s',{val:me.txt.value,dt:get_doctype_label(me.df.options),add:astr}));me.txt.value='';me.set('');}});}}
-LinkField.prototype.set_fetch_values=function(fetch_values){var fl=cur_frm.fetch_dict[this.df.fieldname].fields;var changed_fields=[];for(var i=0;i<fl.length;i++){if(locals[this.doctype][this.docname][fl[i]]!=fetch_values[i]){locals[this.doctype][this.docname][fl[i]]=fetch_values[i];if(!this.grid){refresh_field(fl[i]);changed_fields.push(fl[i]);}}}
-for(i=0;i<changed_fields.length;i++){if(cur_frm.fields_dict[changed_fields[i]])
-cur_frm.fields_dict[changed_fields[i]].run_trigger();}
-if(this.grid)this.grid.refresh();}
-LinkField.prototype.set_get_query=function(){if(this.get_query)return;if(this.grid){var f=this.grid.get_field(this.df.fieldname);if(f.get_query)this.get_query=f.get_query;}}
-LinkField.prototype.set_disp=function(val){var t=null;if(val)t="<a href=\'javascript:loaddoc(\""+this.df.options+"\", \""+val+"\")\'>"+val+"</a>";this.set_disp_html(t);}
-function IntField(){}IntField.prototype=new DataField();IntField.prototype.validate=function(v){if(isNaN(parseInt(v)))return null;return cint(v);};IntField.prototype.format_input=function(){if(this.input.value==null)this.input.value='';}
-function FloatField(){}FloatField.prototype=new DataField();FloatField.prototype.validate=function(v){var v=parseFloat(v);if(isNaN(v))return null;return v;};FloatField.prototype.format_input=function(){if(this.input.value==null)this.input.value='';}
-function CurrencyField(){}CurrencyField.prototype=new DataField();CurrencyField.prototype.format_input=function(){var v=fmt_money(this.input.value);if(this.not_in_form){if(!flt(this.input.value))v='';}
-this.input.value=v;}
-CurrencyField.prototype.validate=function(v){if(v==null||v=='')
-return 0;return flt(v,2);}
-CurrencyField.prototype.set_disp=function(val){var v=fmt_money(val);this.set_disp_html(v);}
-CurrencyField.prototype.onmake_input=function(){if(!this.input)return;this.input.onfocus=function(){if(flt(this.value)==0)this.select();}}
-function CheckField(){}CheckField.prototype=new Field();CheckField.prototype.validate=function(v){var v=parseInt(v);if(isNaN(v))return 0;return v;};CheckField.prototype.onmake=function(){this.checkimg=$a(this.disp_area,'div');var img=$a(this.checkimg,'img');img.src='lib/images/ui/tick.gif';$dh(this.checkimg);}
-CheckField.prototype.make_input=function(){var me=this;this.input=$a_input(this.input_area,'checkbox');$y(this.input,{width:"16px",border:'0px',margin:'2px'});$(this.input).click(function(){me.set(this.checked?1:0);me.run_trigger();})
-this.input.set_input=function(v){v=parseInt(v);if(isNaN(v))v=0;if(v)me.input.checked=true;else me.input.checked=false;}
-this.get_value=function(){return this.input.checked?1:0;}}
-CheckField.prototype.set_disp=function(val){if(val){$ds(this.checkimg);}
-else{$dh(this.checkimg);}}
-function TextField(){}TextField.prototype=new Field();TextField.prototype.set_disp=function(val){this.disp_area.innerHTML=replace_newlines(val);}
-TextField.prototype.make_input=function(){var me=this;if(this.in_grid)
-return;this.input=$a(this.input_area,'textarea');if(this.df.fieldtype=='Small Text')
-this.input.style.height="80px";this.input.set_input=function(v){me.input.value=v;}
-this.input.onchange=function(){me.set(me.input.value);me.run_trigger();}
-this.get_value=function(){return this.input.value;}}
-var text_dialog;function make_text_dialog(){var d=new Dialog(520,410,'Edit Text');d.make_body([['Text','Enter Text'],['HTML','Description'],['Button','Update']]);d.widgets['Update'].onclick=function(){var t=this.dialog;t.field.set(t.widgets['Enter Text'].value);t.hide();}
-d.onshow=function(){this.widgets['Enter Text'].style.height='300px';var v=_f.get_value(this.field.doctype,this.field.docname,this.field.df.fieldname);this.widgets['Enter Text'].value=v==null?'':v;this.widgets['Enter Text'].focus();this.widgets['Description'].innerHTML=''
-if(this.field.df.description)
-$a(this.widgets['Description'],'div','field_description','',this.field.df.description);}
-d.onhide=function(){if(_f.cur_grid_cell)
-_f.cur_grid_cell.grid.cell_deselect();}
-text_dialog=d;}
-TextField.prototype.table_refresh=function(){if(!this.text_dialog)
-make_text_dialog();text_dialog.set_title('Enter text for "'+this.df.label+'"');text_dialog.field=this;text_dialog.show();}
-function SelectField(){}SelectField.prototype=new Field();SelectField.prototype.make_input=function(){var me=this;var opt=[];if(this.in_filter&&(!this.df.single_select)){this.input=$a(this.input_area,'select');this.input.multiple=true;this.input.style.height='4em';this.input.lab=$a(this.input_area,'div',{fontSize:'9px',color:'#999'});this.input.lab.innerHTML='(Use Ctrl+Click to select multiple or de-select)'}else{this.input=$a(this.input_area,'select');this.input.onchange=function(){if(me.validate)
-me.validate();me.set(sel_val(this));me.run_trigger();}
-if(this.df.options=='attach_files:'){this.file_attach=true;}}
-this.set_as_single=function(){var i=this.input;i.multiple=false;i.style.height=null;if(i.lab)$dh(i.lab)}
-this.refresh_options=function(options){if(options)
-me.df.options=options;if(this.file_attach)
-this.set_attach_options();me.options_list=me.df.options?me.df.options.split('\n'):[];empty_select(this.input);if(me.in_filter&&me.options_list[0]!=''){me.options_list=add_lists([''],me.options_list);}
-add_sel_options(this.input,me.options_list);}
-this.onrefresh=function(){this.refresh_options();if(this.not_in_form){this.input.value='';return;}
-if(_f.get_value)
-var v=_f.get_value(this.doctype,this.docname,this.df.fieldname);else{if(this.options_list&&this.options_list.length)
-var v=this.options_list[0];else
-var v=null;}
-this.input.set_input(v);}
-this.input.set_input=function(v){if(!v){if(!me.input.multiple){if(me.docname){if(me.options_list&&me.options_list.length){me.set(me.options_list[0]);me.input.value=me.options_list[0];}else{me.input.value='';}}}}else{if(me.options_list){if(me.input.multiple){for(var i=0;i<me.input.options.length;i++){me.input.options[i].selected=0;if(me.input.options[i].value&&inList(typeof(v)=='string'?v.split(","):v,me.input.options[i].value))
-me.input.options[i].selected=1;}}else if(in_list(me.options_list,v)){me.input.value=v;}}}}
-this.get_value=function(){if(me.input.multiple){var l=[];for(var i=0;i<me.input.options.length;i++){if(me.input.options[i].selected)l[l.length]=me.input.options[i].value;}
-return l;}else{if(me.input.options){var val=sel_val(me.input);if(!val&&!me.input.selectedIndex)
-val=me.input.options[0].value;return val;}
-return me.input.value;}}
-this.set_attach_options=function(){if(!cur_frm)return;var fl=cur_frm.doc.file_list;if(fl){this.df.options='';var fl=fl.split('\n');for(var i in fl){this.df.options+='\n'+fl[i].split(',')[1];}}else{this.df.options=''}}
-this.refresh();}
-function TimeField(){}TimeField.prototype=new Field();TimeField.prototype.get_time=function(){return time_to_hhmm(sel_val(this.input_hr),sel_val(this.input_mn),sel_val(this.input_am));}
-TimeField.prototype.set_time=function(v){ret=time_to_ampm(v);this.input_hr.inp.value=ret[0];this.input_mn.inp.value=ret[1];this.input_am.inp.value=ret[2];}
-TimeField.prototype.set_style_mandatory=function(){}
-TimeField.prototype.set_as_error=function(){}
-TimeField.prototype.make_input=function(){var me=this;this.input=$a(this.input_area,'div','time_field');var t=make_table(this.input,1,3,'200px');var opt_hr=['1','2','3','4','5','6','7','8','9','10','11','12'];var opt_mn=['00','05','10','15','20','25','30','35','40','45','50','55'];var opt_am=['AM','PM'];this.input_hr=new SelectWidget($td(t,0,0),opt_hr,'50px');this.input_mn=new SelectWidget($td(t,0,1),opt_mn,'50px');this.input_am=new SelectWidget($td(t,0,2),opt_am,'50px');var onchange_fn=function(){me.set(me.get_time());me.run_trigger();}
-this.input_hr.inp.onchange=onchange_fn;this.input_mn.inp.onchange=onchange_fn;this.input_am.inp.onchange=onchange_fn;this.onrefresh=function(){var v=_f.get_value?_f.get_value(me.doctype,me.docname,me.df.fieldname):null;me.set_time(v);if(!v)
-me.set(me.get_time());}
-this.input.set_input=function(v){if(v==null)v='';me.set_time(v);}
-this.get_value=function(){return this.get_time();}
-this.refresh();}
-TimeField.prototype.set_disp=function(v){var t=time_to_ampm(v);var t=t[0]+':'+t[1]+' '+t[2];this.set_disp_html(t);}
-function makeinput_popup(me,iconsrc,iconsrc1,iconsrc2){var icon_style={cursor:'pointer',width:'16px',verticalAlign:'middle',marginBottom:'-3px'};me.input=$a(me.input_area,'div');if(!me.not_in_form)
-$y(me.input,{width:'80%'});me.input.set_width=function(w){$y(me.input,{width:(w-2)+'px'});}
-var tab=$a(me.input,'table');me.tab=tab;$y(tab,{width:'100%',borderCollapse:'collapse',tableLayout:'fixed'});var c0=tab.insertRow(0).insertCell(0);var c1=tab.rows[0].insertCell(1);$y(c1,{width:'20px'});me.txt=$a($a($a(c0,'div','',{paddingRight:'8px'}),'div'),'input','',{width:'100%'});me.btn=$a(c1,'i',iconsrc,icon_style)
-if(iconsrc1)
-me.btn.setAttribute('title','Search');else
-me.btn.setAttribute('title','Select Date');if(iconsrc1){var c2=tab.rows[0].insertCell(2);$y(c2,{width:'20px'});me.btn1=$a(c2,'i',iconsrc1,icon_style)
-me.btn1.setAttribute('title','Open Link');}
-if(iconsrc2){var c3=tab.rows[0].insertCell(3);$y(c3,{width:'20px'});me.btn2=$a(c3,'i',iconsrc2,icon_style)
-me.btn2.setAttribute('title','Create New');$dh(me.btn2);}
-if(me.df.colour)
-me.txt.style.background='#'+me.df.colour.split(':')[1];me.txt.name=me.df.fieldname;me.setdisabled=function(tf){me.txt.disabled=tf;}}
-var tmpid=0;_f.ButtonField=function(){};_f.ButtonField.prototype=new Field();_f.ButtonField.prototype.with_label=0;_f.ButtonField.prototype.init=function(){this.prev_button=null;if(!this.frm)return;if(cur_frm&&cur_frm.fields[cur_frm.fields.length-1]&&cur_frm.fields[cur_frm.fields.length-1].df.fieldtype=='Button'){this.make_body=function(){this.prev_button=cur_frm.fields[cur_frm.fields.length-1];if(!this.prev_button.prev_button){this.prev_button.button_area=$a(this.prev_button.input_area,'span');}
-this.wrapper=this.prev_button.wrapper;this.input_area=this.prev_button.input_area;this.disp_area=this.prev_button.disp_area;this.button_area=$a(this.prev_button.input_area,'span');}}}
-_f.ButtonField.prototype.make_input=function(){var me=this;if(!this.prev_button){$y(this.input_area,{marginTop:'4px',marginBottom:'4px'});}
-if(!this.button_area)
-this.button_area=$a(this.input_area,'span','',{marginRight:'4px'});this.input=$btn(this.button_area,me.df.label,null,{fontWeight:'bold'},null,1)
-this.input.onclick=function(){if(me.not_in_form)return;this.disabled='disabled';if(cur_frm.cscript[me.df.label]&&(!me.in_filter)){cur_frm.runclientscript(me.df.label,me.doctype,me.docname);this.disabled=false;}else{cur_frm.runscript(me.df.options,me);this.disabled=false;}}}
-_f.ButtonField.prototype.hide=function(){$dh(this.button_area);};_f.ButtonField.prototype.show=function(){$ds(this.button_area);};_f.ButtonField.prototype.set=function(v){};_f.ButtonField.prototype.set_disp=function(val){}
-function make_field(docfield,doctype,parent,frm,in_grid,hide_label){switch(docfield.fieldtype.toLowerCase()){case'data':var f=new DataField();break;case'password':var f=new DataField();break;case'int':var f=new IntField();break;case'float':var f=new FloatField();break;case'currency':var f=new CurrencyField();break;case'read only':var f=new ReadOnlyField();break;case'link':var f=new LinkField();break;case'date':var f=new DateField();break;case'time':var f=new TimeField();break;case'html':var f=new HTMLField();break;case'check':var f=new CheckField();break;case'text':var f=new TextField();break;case'small text':var f=new TextField();break;case'select':var f=new SelectField();break;case'button':var f=new _f.ButtonField();break;case'code':var f=new _f.CodeField();break;case'text editor':var f=new _f.CodeField();break;case'table':var f=new _f.TableField();break;case'section break':var f=new _f.SectionBreak();break;case'column break':var f=new _f.ColumnBreak();break;case'image':var f=new _f.ImageField();break;}
-f.parent=parent;f.doctype=doctype;f.df=docfield;f.perm=frm?frm.perm:[[1,1,1]];if(_f)
-f.col_break_width=_f.cur_col_break_width;if(in_grid){f.in_grid=true;f.with_label=0;}
-if(hide_label){f.with_label=0;}
-if(frm){f.frm=frm;if(parent)
-f.layout_cell=parent.parentNode;}
-if(f.init)f.init();f.make_body();return f;}
+wn.ui.AppFrame=Class.extend({init:function(parent){this.buttons={};this.$w=$('<div></div>').appendTo(parent);this.$titlebar=$('<div class="appframe-titlebar">\
+   <span class="appframe-title"></span>\
+   <span class="close">&times;</span>\
+  </div>').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})},title:function(txt){this.$titlebar.find('.appframe-title').html(txt);},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length)
+this.$w.append('<div class="appframe-toolbar"></div>');args={label:label,icon:''};if(icon){args.icon='<i class="'+icon+'"></i>';}
+this.buttons[label]=$(repl('<button class="btn btn-small">\
+   %(icon)s %(label)s</button>',args)).click(click).appendTo(this.$w.find('.appframe-toolbar'));return this.buttons[label];},clear_buttons:function(){this.$w.find('.appframe-toolbar').empty();}});wn.ui.make_app_page=function(opts){if(opts.single_column){$(opts.parent).html('<div class="layout-wrapper layout-wrapper-appframe">\
+   <div class="layout-appframe"></div>\
+   <div class="layout-main"></div>\
+  </div>');}else{$(opts.parent).html('<div class="layout-wrapper layout-wrapper-background">\
+   <div class="layout-appframe"></div>\
+   <div class="layout-main-section"></div>\
+   <div class="layout-side-section"></div>\
+   <div class="clear"></div>\
+  </div>');}
+opts.parent.appframe=new wn.ui.AppFrame($(opts.parent).find('.layout-appframe'));if(opts.title)opts.parent.appframe.title(opts.title);}
 /*
  *	lib/js/wn/ui/dialog.js
  */
-wn.widgets.FieldGroup=function(){this.first_button=false;this.make_fields=function(body,fl){$y(this.body,{padding:'11px'});this.fields_dict={};for(var i=0;i<fl.length;i++){var df=fl[i];var div=$a(body,'div','',{margin:'6px 0px'})
+wn.widgets.FieldGroup=function(){this.first_button=false;this.make_fields=function(body,fl){if(!window.make_field){wn.require('lib/css/legacy/fields.css');wn.require('lib/js/legacy/widgets/form/fields.js');wn.require('lib/js/wn/ui/button.js');}
+$y(this.body,{padding:'11px'});this.fields_dict={};for(var i=0;i<fl.length;i++){var df=fl[i];var div=$a(body,'div','',{margin:'6px 0px'})
 f=make_field(df,null,div,null);f.not_in_form=1;this.fields_dict[df.fieldname]=f
-f.refresh();if(df.fieldtype=='Button'&&!this.first_button){$(f.input).addClass('btn-primary');this.first_button=true;}}}
+f.refresh();if(df.fieldtype=='Button'&&!this.first_button){$(f.input).addClass('btn-info');this.first_button=true;}}}
 this.get_values=function(){var ret={};var errors=[];for(var key in this.fields_dict){var f=this.fields_dict[key];var v=f.get_value?f.get_value():null;if(f.df.reqd&&!v)
 errors.push(f.df.label+' is mandatory');if(v)ret[f.df.fieldname]=v;}
 if(errors.length){msgprint('<b>Please check the following Errors</b>\n'+errors.join('\n'));return null;}
@@ -653,19 +642,20 @@
 this.set_values=function(dict){for(var key in dict){if(this.fields_dict[key]){this.set_value(key,dict[key]);}}}
 this.clear=function(){for(key in this.fields_dict){var f=this.fields_dict[key];if(f){f.set_input(f.df['default']||'');}}}}
 wn.widgets.Dialog=function(opts){this.opts=opts;this.display=false;this.make=function(opts){if(opts)
-this.opts=opts;if(!this.opts.width)this.opts.width=480;this.wrapper=$a(popup_cont,'div','dialog_wrapper');if(this.opts.width)
+this.opts=opts;if(!this.opts.width)this.opts.width=480;if(!$('#dialog-container').length){$('<div id="dialog-container">').appendTo('body');}
+this.wrapper=$('<div class="dialog_wrapper">').appendTo('#dialog-container').get(0);if(this.opts.width)
 this.wrapper.style.width=this.opts.width+'px';this.make_head();this.body=$a(this.wrapper,'div','dialog_body');if(this.opts.fields)
 this.make_fields(this.body,this.opts.fields);}
-this.make_head=function(){var me=this;this.head=$a(this.wrapper,'div','dialog_head');var t=make_table(this.head,1,2,'100%',['100%','16px'],{padding:'2px'});$y($td(t,0,0),{paddingLeft:'16px',fontWeight:'bold',fontSize:'14px',textAlign:'center'});$y($td(t,0,1),{textAlign:'right'});var img=$a($td(t,0,01),'img','',{cursor:'pointer'});img.src='lib/images/icons/close.gif';this.title_text=$td(t,0,0);this.set_title(this.opts.title);img.onclick=function(){if(me.oncancel)me.oncancel();me.hide();}
-this.cancel_img=img;}
-this.set_title=function(t){this.title_text.innerHTML=t?t:'';}
+this.make_head=function(){var me=this;this.appframe=new wn.ui.AppFrame(this.wrapper);this.appframe.$titlebar.find('.close').unbind('click').click(function(){if(me.oncancel)me.oncancel();me.hide();});this.set_title(this.opts.title);}
+this.set_title=function(t){this.appframe.$titlebar.find('.appframe-title').html(t||'');}
 this.set_postion=function(){var d=get_screen_dims();this.wrapper.style.left=((d.w-cint(this.wrapper.style.width))/2)+'px';this.wrapper.style.top=(get_scroll_top()+60)+'px';top_index++;$y(this.wrapper,{zIndex:top_index});}
 this.show=function(){if(this.display)return;this.set_postion()
 $ds(this.wrapper);freeze();this.display=true;cur_dialog=this;if(this.onshow)this.onshow();}
-this.hide=function(){if(this.onhide)this.onhide();unfreeze();$dh(this.wrapper);if(cur_autosug)cur_autosug.clearSuggestions();this.display=false;cur_dialog=null;}
-this.no_cancel=function(){$dh(this.cancel_img);}
+this.hide=function(){if(this.onhide)this.onhide();unfreeze();$dh(this.wrapper);this.display=false;cur_dialog=null;}
+this.no_cancel=function(){this.appframe.$titlebar.find('.close').toggle(false);}
 if(opts)this.make();}
-wn.widgets.Dialog.prototype=new wn.widgets.FieldGroup();$(document).bind('keydown',function(e){if(cur_dialog&&!cur_dialog.no_cancel_flag&&e.which==27){cur_dialog.hide();}});
+wn.widgets.Dialog.prototype=new wn.widgets.FieldGroup();wn.provide('wn.ui');wn.ui.Dialog=wn.widgets.Dialog
+$(document).bind('keydown',function(e){if(cur_dialog&&!cur_dialog.no_cancel_flag&&e.which==27){cur_dialog.hide();}});
 /*
  *	lib/js/legacy/widgets/dialog.js
  */
@@ -674,7 +664,7 @@
 Dialog.prototype.make_body=function(content){this.rows={};this.widgets={};for(var i in content)this.make_row(content[i]);}
 Dialog.prototype.clear_inputs=function(d){for(var wid in this.widgets){var w=this.widgets[wid];var tn=w.tagName?w.tagName.toLowerCase():'';if(tn=='input'||tn=='textarea'){w.value='';}else if(tn=='select'){sel_val(w.options[0].value);}else if(w.txt){w.txt.value='';}else if(w.input){w.input.value='';}}}
 Dialog.prototype.make_row=function(d){var me=this;this.rows[d[1]]=$a(this.body,'div','dialog_row');var row=this.rows[d[1]];if(d[0]!='HTML'){var t=make_table(row,1,2,'100%',['30%','70%']);row.tab=t;var c1=$td(t,0,0);var c2=$td(t,0,1);if(d[0]!='Check'&&d[0]!='Button')
-$t(c1,d[1]);}
+$(c1).text(d[1]);}
 if(d[0]=='HTML'){if(d[2])row.innerHTML=d[2];this.widgets[d[1]]=row;}
 else if(d[0]=='Check'){var i=$a_input(c2,'checkbox','',{width:'20px'});c1.innerHTML=d[1];this.widgets[d[1]]=i;}
 else if(d[0]=='Data'){c1.innerHTML=d[1];c2.style.overflow='auto';this.widgets[d[1]]=$a_input(c2,'text');if(d[2])$a(c2,'div','field_description').innerHTML=d[2];}
@@ -684,229 +674,36 @@
 else if(d[0]=='Select'){c1.innerHTML=d[1];this.widgets[d[1]]=$a(c2,'select','',{width:'160px'})
 if(d[2])$a(c2,'div','field_description').innerHTML=d[2];if(d[3])add_sel_options(this.widgets[d[1]],d[3],d[3][0]);}
 else if(d[0]=='Text'){c1.innerHTML=d[1];c2.style.overflow='auto';this.widgets[d[1]]=$a(c2,'textarea');if(d[2])$a(c2,'div','field_description').innerHTML=d[2];}
-else if(d[0]=='Button'){c2.style.height='32px';var b=$btn(c2,d[1],function(btn){if(btn._onclick)btn._onclick(me)},null,null,1);b.dialog=me;if(!this.first_button){$(b).addClass('btn-primary');this.first_button=true;}
+else if(d[0]=='Button'){c2.style.height='32px';var b=$btn(c2,d[1],function(btn){if(btn._onclick)btn._onclick(me)},null,null,1);b.dialog=me;if(!this.first_button){$(b).addClass('btn-info');this.first_button=true;}
 if(d[2]){b._onclick=d[2];}
 this.widgets[d[1]]=b;}}
 /*
- *	lib/js/wn/ui/listing.js
- */
-wn.widgets.Listing=function(opts){this.opts=opts;this.page_length=20;this.btns={};this.start=0;var me=this;this.make=function(opts){if(this.opts.parent.jquery)
-this.opts.parent=this.opts.parent.get(0);this.wrapper=$a(this.opts.parent,'div');this.filters_area=$a(this.wrapper,'div','listing-filters');this.toolbar_area=$a(this.wrapper,'div','listing-toolbar');this.results_area=$a(this.wrapper,'div','listing-results');this.more_button_area=$a(this.wrapper,'div','listing-more');this.no_results_area=$a(this.wrapper,'div','help_box',{display:'none'},(this.opts.no_result_message?this.opts.no_result_message:'No results'));if(opts)this.opts=opts;this.page_length=this.opts.page_length?this.opts.page_length:this.page_length;this.make_toolbar();this.make_filters();this.make_more_button();}
-this.make_filters=function(){if(this.opts.filters){$ds(this.filters_area);this.filters=new wn.widgets.FieldGroup(this.filters_area,this.opts.fields);}}
-this.make_toolbar=function(){if(!(this.opts.hide_refresh||this.opts.no_refresh)){if(this.opts.title){$a(this.toolbar_area,'h3','',{display:'inline-block',marginRight:'15px'},this.opts.title);}
-this.ref_img=$a(this.toolbar_area,'span','link_type',{color:'#888'},'[refresh]');this.ref_img.onclick=function(){me.run();}
-this.loading_img=$a(this.toolbar_area,'img','lib/images/ui/button-load.gif',{display:'none',marginLeft:'3px',marginBottom:'-2px'});}
-if(this.opts.new_doctype){this.new_btn=$btn(this.toolbar_area,'New '+get_doctype_label(this.opts.new_doctype),function(){newdoc(me.opts.new_doctype,me.opts.new_doc_onload,me.opts.new_doc_indialog,me.opts.new_doc_onsave);},{marginLeft:'7px'});}}
-this.make_more_button=function(){this.more_btn=$btn(this.more_button_area,'More...',function(){me.more_btn.set_working();me.run(function(){me.more_btn.done_working();},1);},'',0,1);$y(this.more_btn.loading_img,{marginBottom:'0px'});}
-this.clear=function(){this.results_area.innerHTML='';this.table=null;$ds(this.results_area);$dh(this.no_results_area);}
-this.make_results=function(r,rt){if(this.start==0)this.clear();$dh(this.more_button_area);if(this.loading_img)$dh(this.loading_img)
-if(r.message)r.values=r.message;if(r.values&&r.values.length){this.values=r.values;var m=Math.min(r.values.length,this.page_length);for(var i=0;i<m;i++){var row=this.add_row();this.opts.render_row(row,r.values[i],this,i);}
-this.start+=m;if(r.values.length>=this.page_length)$ds(this.more_button_area);}else{if(this.start==0){$dh(this.results_area);$ds(this.no_results_area);}}
-if(this.onrun)this.onrun();if(this.opts.onrun)this.opts.onrun();if(this.opts.callback)this.opts.callback(r);}
-this.add_row=function(){return $a(this.results_area,'div','',(opts.cell_style?opts.cell_style:{padding:'3px 0px'}));}
-this.run=function(callback,append){if(callback)
-this.onrun=callback;if(!append)
-this.start=0;if(!this.opts.method){this.query=this.opts.get_query?this.opts.get_query():this.opts.query;this.add_limits();var args={query_max:this.query_max||this.opts.query_max||'',as_dict:1}
-args.simple_query=this.query;}else{var args={limit_start:this.start,limit_page_length:this.page_length}}
-if(this.opts.args)
-$.extend(args,this.opts.args)
-if(this.loading_img)$di(this.loading_img);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:args,callback:function(r,rt){me.make_results(r,rt)},no_spinner:this.opts.no_loading,btn:this.opts.run_btn});}
-this.refresh=this.run;this.add_limits=function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}
-if(opts)this.make();}
-/*
- *	lib/js/legacy/widgets/layout.js
- */
-function Layout(parent,width){if(parent&&parent.substr){parent=$i(parent);}
-this.wrapper=$a(parent,'div','',{display:'none'});if(width){this.width=this.wrapper.style.width;}
-this.myrows=[];}
-Layout.prototype.addrow=function(){this.cur_row=new LayoutRow(this,this.wrapper);this.myrows[this.myrows.length]=this.cur_row;return this.cur_row}
-Layout.prototype.addsubrow=function(){this.cur_row=new LayoutRow(this,this.cur_row.main_body);this.myrows[this.myrows.length]=this.cur_row;return this.cur_row}
-Layout.prototype.addcell=function(width){return this.cur_row.addCell(width);}
-Layout.prototype.setcolour=function(col){$bg(cc,col);}
-Layout.prototype.show=function(){$ds(this.wrapper);}
-Layout.prototype.hide=function(){$dh(this.wrapper);}
-Layout.prototype.close_borders=function(){if(this.with_border){this.myrows[this.myrows.length-1].wrapper.style.borderBottom='1px solid #000';}}
-function LayoutRow(layout,parent){this.layout=layout;this.wrapper=$a(parent,'div');this.main_head=$a(this.wrapper,'div');this.main_body=$a(this.wrapper,'div');if(layout.with_border){this.wrapper.style.border='1px solid #000';this.wrapper.style.borderBottom='0px';}
-this.header=$a(this.main_body,'div','',{padding:(layout.with_border?'0px 8px':'0px')});this.body=$a(this.main_body,'div');this.table=$a(this.body,'table','',{width:'100%',borderCollapse:'collapse'});this.row=this.table.insertRow(0);this.mycells=[];}
-LayoutRow.prototype.hide=function(){$dh(this.wrapper);}
-LayoutRow.prototype.show=function(){$ds(this.wrapper);}
-LayoutRow.prototype.addCell=function(wid){var lc=new LayoutCell(this.layout,this,wid);this.mycells[this.mycells.length]=lc;return lc;}
-function LayoutCell(layout,layoutRow,width){if(width){var w=width+'';if(w.substr(w.length-2,2)!='px'){if(w.substr(w.length-1,1)!="%"){width=width+'%'};}}
-this.width=width;this.layout=layout;var cidx=layoutRow.row.cells.length;this.cell=layoutRow.row.insertCell(cidx);this.cell.style.verticalAlign='top';this.set_width(layoutRow.row,width);var h=$a(this.cell,'div','',{padding:(layout.with_border?'0px 8px':'0px')});this.wrapper=$a(this.cell,'div','',{padding:(layout.with_border?'8px':'8px 0px')});layout.cur_cell=this.wrapper;layout.cur_cell.header=h;}
-LayoutCell.prototype.set_width=function(row,width){var w=100;var n_cells=row.cells.length;var cells_with_no_width=n_cells;if(width){$y(row.cells[n_cells-1],{width:cint(width)+'%'})}else{row.cells[n_cells-1].estimated_width=1;}
-for(var i=0;i<n_cells;i++){if(!row.cells[i].estimated_width){w=w-cint(row.cells[i].style.width);cells_with_no_width--;}}
-for(var i=0;i<n_cells;i++){if(row.cells[i].estimated_width)
-$y(row.cells[i],{width:cint(w/cells_with_no_width)+'%'})}}
-LayoutCell.prototype.show=function(){$ds(this.wrapper);}
-LayoutCell.prototype.hide=function(){$dh(this.wrapper);}
-/*
  *	lib/js/legacy/webpage/page_header.js
  */
-var def_ph_style={wrapper:{marginBottom:'16px',backgroundColor:'#EEE'},main_heading:{},sub_heading:{marginBottom:'8px',color:'#555',display:'none'},separator:{borderTop:'3px solid #777'},toolbar_area:{padding:'3px 0px',display:'none',borderBottom:'1px solid #AAA'}}
-function PageHeader(parent,main_text,sub_text){this.wrapper=$a(parent,'div','page_header');this.t1=make_table($a(this.wrapper,'div','',def_ph_style.wrapper.backgroundColor),1,2,'100%',[null,'100px'],{padding:'2px'});$y(this.t1,{borderCollapse:'collapse'})
-this.lhs=$td(this.t1,0,0);this.main_head=$a(this.lhs,'h1','',def_ph_style.main_heading);this.sub_head=$a(this.lhs,'h4','',def_ph_style.sub_heading);this.separator=$a(this.wrapper,'div','',def_ph_style.separator);this.toolbar_area=$a(this.wrapper,'div','',def_ph_style.toolbar_area);this.padding_area=$a(this.wrapper,'div','',{padding:'3px'});$y($td(this.t1,0,1),{textAlign:'right',padding:'3px'});this.close_btn=$a($td(this.t1,0,1),'span','close',{},'&times;');this.close_btn.onclick=function(){nav_obj.show_last_open();};if(main_text)this.main_head.innerHTML=main_text;if(sub_text)this.sub_head.innerHTML=sub_text;this.buttons={};this.buttons2={};}
-PageHeader.prototype.add_button=function(label,fn,bold,icon,green){var tb=this.toolbar_area;if(this.buttons[label])return;var btn=$btn(tb,label,fn,{marginRight:'4px'},(green?'btn-primary':''));if(bold)$y(btn,{fontWeight:'bold'});this.buttons[label]=btn;$ds(this.toolbar_area);return btn;}
+var def_ph_style={wrapper:{marginBottom:'16px',backgroundColor:'#EEE'},main_heading:{},sub_heading:{marginBottom:'8px',color:'#555',display:'none'},separator:{borderTop:'1px solid #ddd'},toolbar_area:{padding:'3px 0px',display:'none',borderBottom:'1px solid #ddd'}}
+function PageHeader(parent,main_text,sub_text){this.wrapper=$a(parent,'div','page_header');this.close_btn=$a(this.wrapper,'a','close',{},'&times;');this.close_btn.onclick=function(){window.history.back();};this.breadcrumbs=$a(this.wrapper,'div','breadcrumbs-area');this.main_head=$a(this.wrapper,'h1','',def_ph_style.main_heading);this.sub_head=$a(this.wrapper,'h4','',def_ph_style.sub_heading);this.separator=$a(this.wrapper,'div','',def_ph_style.separator);this.toolbar_area=$a(this.wrapper,'div','',def_ph_style.toolbar_area);this.padding_area=$a(this.wrapper,'div','',{padding:'3px'});if(main_text)this.main_head.innerHTML=main_text;if(sub_text)this.sub_head.innerHTML=sub_text;this.buttons={};this.buttons2={};}
+PageHeader.prototype.add_button=function(label,fn,bold,icon,green){var tb=this.toolbar_area;if(this.buttons[label])return;iconhtml=icon?('<i class="'+icon+'"></i> '):'';var $button=$('<button class="btn btn-small">'+iconhtml+label+'</button>').click(fn).appendTo(tb);if(green){$button.addClass('btn-info');$button.find('i').addClass('icon-white');}
+if(bold)$button.css('font-weight','bold');this.buttons[label]=$button.get(0);$ds(this.toolbar_area);return this.buttons[label];}
 PageHeader.prototype.clear_toolbar=function(){this.toolbar_area.innerHTML='';this.buttons={};}
 PageHeader.prototype.make_buttonset=function(){$(this.toolbar_area).buttonset();}
 /*
- *	lib/js/legacy/widgets/select.js
- */
-function SelectWidget(parent,options,width,editable,bg_color){var me=this;this.inp=$a(parent,'select');if(options)add_sel_options(this.inp,options);if(width)$y(this.inp,{width:width});this.set_width=function(w){$y(this.inp,{width:w})};this.set_options=function(o){add_sel_options(this.inp,o);}
-this.inp.onchange=function(){if(me.onchange)me.onchange(this);}
-return;}
-/*
- *	lib/js/legacy/webpage/history.js
- */
-var nav_obj={}
-nav_obj.observers=[];nav_obj.add_observer=function(o){nav_obj.observers.push(o);}
-nav_obj.ol=[];nav_obj.open_notify=function(t,dt,dn,no_history){if(nav_obj.ol.length){var tmp=nav_obj.ol[nav_obj.ol.length-1];if(tmp&&tmp[0]==t&&tmp[1]==dt&&tmp[2]==dn)return;}
-if(!no_history){var tmp=[];for(var i in nav_obj.ol)
-if(!(nav_obj.ol[i][0]==t&&nav_obj.ol[i][1]==dt&&nav_obj.ol[i][2]==dn))tmp.push(nav_obj.ol[i]);nav_obj.ol=tmp;nav_obj.ol.push([t,dt,dn])
-en_t=encodeURIComponent(t);en_dt=encodeURIComponent(dt);en_dn=dn?encodeURIComponent(dn):'';if(en_t=='Page'){var id=en_dt+(dn?('/'+en_dn):'')}else{var id=en_t+'/'+en_dt+(dn?('/'+en_dn):'')}
-if(nav_obj.on_open)
-nav_obj.on_open(id);if(window.location.hash!='!'+id){window.location.hash='!'+id;}}
-nav_obj.notify_observers(t,dt,dn);if(wn.boot.analytics_code){try{eval(wn.boot.analytics_code);}catch(e){console.log(e);}}}
-nav_obj.notify_observers=function(t,dt,dn){for(var i=0;i<nav_obj.observers.length;i++){var o=nav_obj.observers[i];if(o&&o.notify)o.notify(t,dt,dn);}}
-nav_obj.rename_notify=function(dt,oldn,newn){for(var i=0;i<nav_obj.ol.length;i++){var o=nav_obj.ol[i];if(o[1]==dt&&o[2]==oldn)o[2]=newn;}}
-nav_obj.show_last_open=function(){var l=nav_obj.ol[nav_obj.ol.length-2];delete nav_obj.ol[nav_obj.ol.length-1];if(!l)loadpage('_home');else if(l[0]=='Page'){loadpage(l[1]);}else if(l[0]=='Report'){loadreport(l[1],l[2]);}else if(l[0]=='Form'){loaddoc(l[1],l[2]);}else if(l[0]=='DocBrowser'||l[0]=='List'){loaddocbrowser(l[1]);}}
-var _history_current;function history_get_name(t){var parts=[];if(t.length>=3){for(var i=2;i<t.length;i++){parts.push(t[i]);}}
-return parts.join('/')}
-nav_obj.get_page=function(loc){if(!loc)loc=window.location.hash;if(loc.substr(0,1)=='#'){loc=loc.substr(1);}
-if(loc.substr(0,1)=='!'){loc=loc.substr(1);}
-if(!in_list(['Page/','Form/','Repor','DocBr','List/'],loc.substr(0,5))){loc='Page/'+loc;}
-return loc.split('/');}
-function historyChange(newLocation){var t=nav_obj.get_page(newLocation)
-for(var i=0;i<t.length;i++)
-t[i]=decodeURIComponent(t[i]);if(nav_obj.ol.length){var c=nav_obj.ol[nav_obj.ol.length-1];if(t.length==2){if(c[0]==t[0]&&c[1]==t[1])return;}else{if(c[0]==t[0]&&c[1]==t[1]&&c[2]==t[2])return;}}
-if(t[2])
-var docname=history_get_name(t);if(t[0]=='Form'){_history_current=newLocation;if(docname.substr(0,3)=='New'&&!(locals[t[1]]&&locals[t[1]][docname])){newdoc(t[1]);}else{loaddoc(t[1],docname);}}else if(t[0]=='Report'){_history_current=newLocation;loadreport(t[1],docname);}else if(t[0]=='Page'){_history_current=newLocation;loadpage(t[1]);}else if(t[0]=='Application'){_history_current=newLocation;loadapp(t[1]);}else if(t[0]=='DocBrowser'||t[0]=='List'){_history_current=newLocation;loaddocbrowser(t[1]);}};$(window).bind('hashchange',function(){historyChange(location.hash);});
-/*
- *	lib/js/legacy/webpage/search.js
- */
-search_fields={};function setlinkvalue(name){selector.input.set_input(name);selector.hide();}
-function makeselector(){var d=new Dialog(540,440,'Search');d.make_body([['Data','Beginning With','Tip: You can use wildcard "%"'],['Select','Search By'],['Button','Search'],['HTML','Help'],['HTML','Result']]);var inp=d.widgets['Beginning With'];var field_sel=d.widgets['Search By'];var btn=d.widgets['Search'];d.sel_type='';d.values_len=0;d.set=function(input,type,label){d.sel_type=type;d.input=input;if(d.style!='Link'){d.rows['Result'].innerHTML='';d.values_len=0;}
-d.style='Link';d.set_query_description()
-if(!d.sel_type)d.sel_type='Value';d.set_title('Select a "'+d.sel_type+'" for field "'+label+'"');}
-d.set_search=function(dt){if(d.style!='Search'){d.rows['Result'].innerHTML='';d.values_len=0;}
-d.style='Search';if(d.input){d.input=null;sel_type=null;}
-d.sel_type=get_label_doctype(dt);d.set_title('Quick Search for '+dt);}
-$(inp).keydown(function(e){if(e.which==13){if(!btn.disabled)btn.onclick();}})
-d.set_query_description=function(){if(d.input&&d.input.query_description){d.rows['Help'].innerHTML='<div class="help_box">'+d.input.query_description+'</div>';}else{d.rows['Help'].innerHTML=''}}
-d.onshow=function(){if(d.set_doctype!=d.sel_type){d.rows['Result'].innerHTML='';d.values_len=0;}
-inp.value='';if(d.input&&d.input.txt.value){inp.value=d.input.txt.value;}
-try{inp.focus();}catch(e){}
-if(d.input)d.input.set_get_query();var get_sf_list=function(dt){var l=[];var lf=search_fields[dt];for(var i=0;i<lf.length;i++)l.push(lf[i][1]);return l;}
-$ds(d.rows['Search By']);if(search_fields[d.sel_type]){empty_select(field_sel);add_sel_options(field_sel,get_sf_list(d.sel_type),'ID');}else{empty_select(field_sel);add_sel_options(field_sel,['ID'],'ID');$c('webnotes.widgets.search.getsearchfields',{'doctype':d.sel_type},function(r,rt){search_fields[d.sel_type]=r.searchfields;empty_select(field_sel);add_sel_options(field_sel,get_sf_list(d.sel_type));field_sel.selectedIndex=0;});}}
-d.onhide=function(){if(d.input&&d.input.txt)
-d.input.txt.onchange()}
-btn.onclick=function(){if(this.disabled)return;this.args.is_ajax=true;this.set_working();d.set_doctype=d.sel_type;var q='';args={};if(d.input&&d.input.get_query){var doc={};args.is_simple=1;if(cur_frm)doc=locals[cur_frm.doctype][cur_frm.docname];var q=d.input.get_query(doc,d.input.doctype,d.input.docname);if(!q){return'';}}
-var get_sf_fieldname=function(v){var lf=search_fields[d.sel_type];if(!lf)
-return'name'
-for(var i=0;i<lf.length;i++)if(lf[i][1]==v)return lf[i][0];}
-$.extend(args,{'txt':strip(inp.value),'doctype':d.sel_type,'query':q,'searchfield':get_sf_fieldname(sel_val(field_sel))});$c('webnotes.widgets.search.search_widget',args,function(r,rtxt){btn.done_working();if(r.coltypes)r.coltypes[0]='Link';d.values_len=r.values.length;d.set_result(r);},function(){btn.done_working();});}
-d.set_result=function(r){d.rows['Result'].innerHTML='';var c=$a(d.rows['Result'],'div','comment',{paddingBottom:'4px',marginBottom:'4px',borderBottom:'1px solid #CCC',marginLeft:'4px'});if(r.values.length==50)
-c.innerHTML='Showing max 50 results. Use filters to narrow down your search';else
-c.innerHTML='Showing '+r.values.length+' resuts.';var w=$a(d.rows['Result'],'div','',{height:'240px',overflow:'auto',margin:'4px'});for(var i=0;i<r.values.length;i++){var div=$a(w,'div','',{marginBottom:'4px',paddingBottom:'4px',borderBottom:'1px dashed #CCC'});var l=$a($a(div,'div'),'span','link_type');l.innerHTML=r.values[i][0];l.link_name=r.values[i][0];l.dt=r.coloptions[0];if(d.input)
-l.onclick=function(){setlinkvalue(this.link_name);}
-else
-l.onclick=function(){loaddoc(this.dt,this.link_name);d.hide();}
-var cl=[]
-for(var j=1;j<r.values[i].length;j++)cl.push(r.values[i][j]);var c=$a(div,'div','comment',{marginTop:'2px'});c.innerHTML=cl.join(', ');}}
-selector=d;}
-/*
  *	lib/js/legacy/webpage/spinner.js
  */
-function set_loading(){pending_req++;$('#spinner').css('visibility','visible');$('body').css('cursor','progress');}
+var pending_req=0;var fcount=0;var dialog_back;function set_loading(){pending_req++;$('#spinner').css('visibility','visible');$('body').css('cursor','progress');}
 function hide_loading(){pending_req--;if(!pending_req){$('body').css('cursor','default');$('#spinner').css('visibility','hidden');}}
-/*
- *	lib/js/legacy/webpage/freeze_page.js
- */
-var fcount=0;var frozen=0;var dialog_message;var dialog_back;function freeze(msg,do_freeze){if(!dialog_back){dialog_back=$a($i('body_div'),'div','dialog_back');$(dialog_back).css('opacity',0.6);}
-$ds(dialog_back);fcount++;frozen=1;}
-function unfreeze(){if(dialog_message)
-$dh(dialog_message);if(!fcount)return;fcount--;if(!fcount){$dh(dialog_back);frozen=0;}}
-/*
- *	lib/js/legacy/webpage/error_console.js
- */
-var err_console;var err_list=[];function errprint(t){if(!err_list)err_list=[];err_list.push('<pre style="font-family: Courier, Fixed; font-size: 11px; \
-  border-bottom: 1px solid #AAA; overflow: auto; width: 90%;">'+t+'</pre>');}
-function setup_err_console(){err_console=new Dialog(640,480,'Error Console')
-err_console.make_body([['HTML','Error List'],['Button','Clear'],['HTML','Error Report']]);var span=$a(err_console.widgets['Error Report'],'span','link_type');span.innerHTML='Send Error Report';span.onclick=function(){msg=prompt('How / where did you get the error [optional]')
-var call_back=function(r,rt){err_console.hide();msgprint("Error Report Sent")}
-$c('webnotes.utils.send_error_report',{'err_msg':err_console.rows['Error List'].innerHTML,'msg':msg},call_back);}
-err_console.widgets['Clear'].onclick=function(){err_list=[];err_console.rows['Error List'].innerHTML='';err_console.hide();}
-err_console.onshow=function(){err_console.rows['Error List'].innerHTML='<div style="padding: 16px; height: 360px; width: 90%; overflow: auto;">'
-+err_list.join('<div style="height: 10px; margin-bottom: 10px; border-bottom: 1px solid #AAA"></div>')+'</div>';}}
-startup_list.push(setup_err_console);
+function freeze(){if(!dialog_back){dialog_back=$a($i('body_div'),'div','dialog_back');$(dialog_back).css('opacity',0.6);}
+$ds(dialog_back);fcount++;}
+function unfreeze(){if(!fcount)return;fcount--;if(!fcount){$dh(dialog_back);}}
 /*
  *	lib/js/legacy/webpage/loaders.js
  */
-function loadreport(dt,rep_name,onload,menuitem,reset_report){wn.require('lib/js/legacy/report.compressed.js');dt=get_label_doctype(dt);var show_report_builder=function(){if(!_r.rb_con){_r.rb_con=new _r.ReportContainer();}
-_r.rb_con.set_dt(dt,function(rb){if(rep_name){var t=rb.current_loaded;rb.load_criteria(rep_name);if(onload)
-onload(rb);if((rb.dt)&&(!rb.dt.has_data()||rb.current_loaded!=t))
-rb.dt.run();}else{if(reset_report){rb.reset_report();}}
-if(!rb.forbidden){page_body.change_to('Report Builder');nav_obj.open_notify('Report',dt,rep_name);}});}
-show_report_builder();}
-var load_doc=loaddoc;function loaddoc(doctype,name,onload,menuitem,from_archive){doctype=get_label_doctype(doctype);if(frms['DocType']&&frms['DocType'].opendocs[doctype]){msgprint("Cannot open an instance of \""+doctype+"\" when the DocType is open.");return;}
-if(doctype=='DocType'&&frms[name]){msgprint("Cannot open DocType \""+name+"\" when its instance is open.");return;}
-var show_form=function(f){if(!_f.frm_con){_f.frm_con=new _f.FrmContainer();}
-if(!frms[doctype]){_f.add_frm(doctype,show_doc,name,from_archive);}else if(LocalDB.is_doc_loaded(doctype,name)){show_doc();}else{$c('webnotes.widgets.form.load.getdoc',{'name':name,'doctype':doctype,'user':user,'from_archive':(from_archive?1:0)},show_doc,null,null);}}
-var show_doc=function(r,rt){if(locals[doctype]&&locals[doctype][name]){var frm=frms[doctype];frm.refresh(name);if(!frm.in_dialog)
-nav_obj.open_notify('Form',doctype,name);if(onload)onload();}else{if(r.exc){msgprint('There were errors while loading '+doctype+' '+name);}
-loadpage('_home');}}
-show_form();}
-function new_doc(doctype,onload,in_dialog,on_save_callback,cdt,cdn,cnic){doctype=get_label_doctype(doctype);if(!doctype){if(cur_frm)doctype=cur_frm.doctype;else return;}
-var show_doc=function(){frm=frms[doctype];if(frm.perm[0][CREATE]==1){if(frm.meta.issingle){var dn=doctype;LocalDB.set_default_values(locals[doctype][doctype]);}else
-var dn=LocalDB.create(doctype);if(onload)onload(dn);if(frm.in_dialog){var fd=_f.frm_dialog;fd.cdt=cdt;fd.cdn=cdn;fd.cnic=cnic;fd.on_save_callback=on_save_callback;}else{nav_obj.open_notify('Form',doctype,dn);}
-frm.refresh(dn);}else{msgprint('error:Not Allowed To Create '+doctype+'\nContact your Admin for help');}}
-var show_form=function(){if(!_f.frm_con){_f.frm_con=new _f.FrmContainer();}
-if(!frms[doctype])
-_f.add_frm(doctype,show_doc);else
-show_doc(frms[doctype]);}
-show_form();}
-var newdoc=new_doc;var pscript={};var cur_page;function loadpage(page_name,call_back,no_history){if(!page_name)return;if(page_name=='_home')
-page_name=home_page;var fn=function(r,rt){if(wn.pages[page_name]){var p=wn.pages[page_name]
-page_body.change_to(page_name);}else{var p=render_page(page_name);if(!p)return;}
-cur_page=page_name;if(call_back)call_back();scroll(0,0);pscript.update_page_history(page_name,no_history)
-try{if(pscript['refresh_'+page_name])pscript['refresh_'+page_name]();}catch(e){console.log(e);}}
-if(get_local('Page',page_name)||wn.pages[page_name])
-fn();else{args=get_url_dict();args.name=page_name;$c('webnotes.widgets.page.getpage',args,fn);}}
-pscript.update_page_history=function(page_name,no_history){var arg=null;var t=null;if(window.location.hash){var t=nav_obj.get_page(window.location.hash)}else if(get_url_arg('page')){var t=nav_obj.get_page(get_url_arg('page'))}
-if(t&&t[1]==page_name)arg=t[2];nav_obj.open_notify('Page',page_name,arg,no_history);}
-function loadscript(src,call_back){set_loading();var script=$a('head','script');script.type='text/javascript';script.src=src;script.onload=function(){if(call_back)call_back();hide_loading();}
-script.onreadystatechange=function(){if(this.readyState=='complete'||this.readyState=='loaded'){hide_loading();call_back();}}}
-var doc_browser_page;function loaddocbrowser(dt,label,fields){wn.require('lib/js/legacy/webpage/docbrowser.js');dt=get_label_doctype(dt);if(!doc_browser_page)
-doc_browser_page=new ItemBrowserPage();doc_browser_page.show(dt,label,fields);nav_obj.open_notify('List',dt,'');}
-/*
- *	lib/js/legacy/webpage/uploader.js
- */
-var uploaders={};var upload_frame_count=0;Uploader=function(parent,args,callback){var id='frame'+upload_frame_count;upload_frame_count++;this.callback=callback;var div=$a(parent,'div');div.innerHTML='<iframe id="'+id+'" name="'+id+'" src="blank.html" \
-  style="width:0px; height:0px; border:0px"></iframe>';var div=$a(parent,'div');div.innerHTML='<form method="POST" enctype="multipart/form-data" action="'+outUrl+'" target="'+id+'"></form>';var ul_form=div.childNodes[0];var f_list=[];var inp_fdata=$a_input($a(ul_form,'span'),'file',{name:'filedata'},{marginLeft:'7px'});if(!('cmd'in args)){var inp=$a_input($a(ul_form,'span'),'hidden',{name:'cmd'});inp.value='uploadfile';}
-var inp=$a_input($a(ul_form,'span'),'hidden',{name:'uploader_id'});inp.value=id;var inp=$a_input($a(ul_form,'span'),'submit',null,{marginLeft:'7px'});inp.value='Upload';$y(inp,{width:'80px'});for(var key in args){var inp=$a_input($a(ul_form,'span'),'hidden',{name:key});inp.value=args[key];}
-uploaders[id]=this;}
-function upload_callback(id,fid){uploaders[id].callback(fid);}
-/*
- *	lib/js/legacy/webpage/page.js
- */
-var stylesheets=[];function Page(page_name,content){var me=this;this.name=page_name;this.trigger=function(event){try{if(pscript[event+'_'+this.name])
-pscript[event+'_'+this.name](me.wrapper);if(me.wrapper[event]){me.wrapper[event](me.wrapper);}}catch(e){console.log(e);}}
-this.page_show=function(){set_title(me.doc.title?me.doc.title:me.name);if(!me.onload_complete){me.trigger('onload');me.onload_complete=true;}
-me.trigger('onshow');cur_frm=null;}
-this.wrapper=page_body.add_page(page_name,this.page_show);this.cont=this.wrapper
-if(content)
-this.wrapper.innerHTML=content;return this;}
-function render_page(page_name,menuitem){if(!page_name)return;if((!locals['Page'])||(!locals['Page'][page_name])){loadpage('_home');return;}
-var pdoc=locals['Page'][page_name];if(pdoc.style)set_style(pdoc.style)
-if(pdoc.stylesheet){set_style(locals.Stylesheet[pdoc.stylesheet].stylesheet);stylesheets.push(pdoc.stylesheet);}
-var p=new Page(page_name,pdoc._Page__content?pdoc._Page__content:pdoc.content);var script=pdoc.__script?pdoc.__script:pdoc.script;p.doc=pdoc;if(script){eval(script);}
-page_body.change_to(page_name);return p;}
-function refresh_page(page_name){var fn=function(r,rt){render_page(page_name)}
-$c('webnotes.widgets.page.getpage',{'name':page_name,stylesheets:JSON.stringify(stylesheets)},fn);}
-/*
- *	lib/js/legacy/wn/page_layout.js
- */
-wn.PageLayout=function(args){$.extend(this,args)
-this.wrapper=$a(this.parent,'div','layout-wrapper layout-wrapper-background');this.main=$a(this.wrapper,'div','layout-main-section');this.sidebar_area=$a(this.wrapper,'div','layout-side-section');$a(this.wrapper,'div','',{clear:'both'});this.head=$a(this.main,'div');this.toolbar_area=$a(this.main,'div');this.body=$a(this.main,'div');this.footer=$a(this.main,'div');if(this.heading){this.page_head=new PageHeader(this.head,this.heading);}}
+function loadreport(dt,rep_name,onload){if(rep_name)
+wn.set_route('Report',dt,rep_name);else
+wn.set_route('Report',dt);}
+function loaddoc(doctype,name,onload){wn.model.with_doctype(doctype,function(){if(locals.DocType[doctype].in_dialog){_f.edit_record(doctype,name);}else{wn.set_route('Form',doctype,name);}})}
+var load_doc=loaddoc;function new_doc(doctype,onload,in_dialog,on_save_callback,cdt,cdn,cnic){doctype=get_label_doctype(doctype);wn.model.with_doctype(doctype,function(){if(locals.DocType[doctype].in_dialog){var new_name=LocalDB.create(doctype);_f.edit_record(doctype,new_name);}else{wn.views.formview.create(doctype);}})}
+var newdoc=new_doc;var pscript={};function loadpage(page_name,call_back,no_history){wn.set_route(page_name);}
+function loaddocbrowser(dt){wn.set_route('List',dt);}
 /*
  *	lib/js/legacy/wn/widgets/footer.js
  */
@@ -917,24 +714,18 @@
 /*
  *	lib/js/legacy/model/local_data.js
  */
-var locals={'DocType':{}};var fields={};var fields_list={};var LocalDB={};var READ=0;var WRITE=1;var CREATE=2;var SUBMIT=3;var CANCEL=4;var AMEND=5;LocalDB.getchildren=function(child_dt,parent,parentfield,parenttype){var l=[];for(var key in locals[child_dt]){var d=locals[child_dt][key];if((d.parent==parent)&&(d.parentfield==parentfield)){if(parenttype){if(d.parenttype==parenttype)l.push(d);}else{l.push(d);}}}
+var locals={'DocType':{}};var LocalDB={};var READ=0;var WRITE=1;var CREATE=2;var SUBMIT=3;var CANCEL=4;var AMEND=5;LocalDB.getchildren=function(child_dt,parent,parentfield,parenttype){var l=[];for(var key in locals[child_dt]){var d=locals[child_dt][key];if((d.parent==parent)&&(d.parentfield==parentfield)){if(parenttype){if(d.parenttype==parenttype)l.push(d);}else{l.push(d);}}}
 l.sort(function(a,b){return(cint(a.idx)-cint(b.idx))});return l;}
 LocalDB.add=function(dt,dn){if(!locals[dt])locals[dt]={};if(locals[dt][dn])delete locals[dt][dn];locals[dt][dn]={'name':dn,'doctype':dt,'docstatus':0};return locals[dt][dn];}
 LocalDB.delete_doc=function(dt,dn){var doc=get_local(dt,dn);for(var ndt in locals){if(locals[ndt]){for(var ndn in locals[ndt]){var doc=locals[ndt][ndn];if(doc&&doc.parenttype==dt&&(doc.parent==dn||doc.__oldparent==dn)){delete locals[ndt][ndn];}}}}
 delete locals[dt][dn];}
 function get_local(dt,dn){return locals[dt]?locals[dt][dn]:null;}
 LocalDB.sync=function(list){if(list._kl)list=expand_doclist(list);for(var i=0;i<list.length;i++){var d=list[i];if(!d.name)
-d.name=LocalDB.get_localname(d.doctype);LocalDB.add(d.doctype,d.name);locals[d.doctype][d.name]=d;if(d.doctype=='DocType'){fields_list[d.name]=[];}else if(d.doctype=='DocField'){if(!d.parent){alert('Error: No parent specified for field "'+d.label+'"');}
-if(!fields_list[d.parent])fields_list[d.parent]=[];fields_list[d.parent][fields_list[d.parent].length]=d;if(!fields[d.parent])
-fields[d.parent]={};if(d.fieldname){fields[d.parent][d.fieldname]=d;}else if(d.label){fields[d.parent][d.label]=d;}}
-if(d.localname)
-notify_rename_observers(d.doctype,d.localname,d.name);}}
+d.name=LocalDB.get_localname(d.doctype);LocalDB.add(d.doctype,d.name);locals[d.doctype][d.name]=d;if(d.doctype=='DocField')wn.meta.add_field(d);if(d.localname){wn.model.new_names[d.localname]=d.name;$(document).trigger('rename',[d.doctype,d.localname,d.name]);delete locals[d.doctype][d.localname];}}}
 local_name_idx={};LocalDB.get_localname=function(doctype){if(!local_name_idx[doctype])local_name_idx[doctype]=1;var n='New '+get_doctype_label(doctype)+' '+local_name_idx[doctype];local_name_idx[doctype]++;return n;}
-LocalDB.set_default_values=function(doc){var doctype=doc.doctype;var docfields=fields_list[doctype];if(!docfields){return;}
+LocalDB.set_default_values=function(doc){var doctype=doc.doctype;var docfields=wn.meta.docfield_list[doctype];if(!docfields){return;}
 var fields_to_refresh=[];for(var fid=0;fid<docfields.length;fid++){var f=docfields[fid];if(!in_list(no_value_fields,f.fieldtype)&&doc[f.fieldname]==null){var v=LocalDB.get_default_value(f.fieldname,f.fieldtype,f['default']);if(v){doc[f.fieldname]=v;fields_to_refresh.push(f.fieldname);}}}
 return fields_to_refresh;}
-LocalDB.is_doc_loaded=function(dt,dn){var exists=false;if(locals[dt]&&locals[dt][dn])exists=true;if(exists&&dt=='DocType'&&!locals[dt][dn].__islocal&&!frms[dt])
-exists=false;return exists;}
 function check_perm_match(p,dt,dn){if(!dn)return true;var out=false;if(p.match){if(user_defaults[p.match]){for(var i=0;i<user_defaults[p.match].length;i++){if(user_defaults[p.match][i]==locals[dt][dn][p.match]){return true;}}
 return false;}else if(!locals[dt][dn][p.match]){return true;}else{return false;}}else{return true;}}
 function get_perm(doctype,dn,ignore_submit){var perm=[[0,0],];if(in_list(user_roles,'Administrator'))perm[0][READ]=1;var plist=getchildren('DocPerm',doctype,'permissions','DocType');for(var pidx in plist){var p=plist[pidx];var pl=cint(p.permlevel?p.permlevel:0);if(in_list(user_roles,p.role)){if(check_perm_match(p,doctype,dn)){if(!perm[pl])perm[pl]=[];if(!perm[pl][READ]){if(cint(p.read))perm[pl][READ]=1;else perm[pl][READ]=0;}
@@ -963,26 +754,17 @@
 return locals[dt][newdoc];}
 function make_doclist(dt,dn,deleted){var dl=[];dl[0]=locals[dt][dn];for(var ndt in locals){if(locals[ndt]){for(var ndn in locals[ndt]){var doc=locals[ndt][ndn];if(doc&&doc.parenttype==dt&&(doc.parent==dn||(deleted&&doc.__oldparent==dn))){dl[dl.length]=doc;}}}}
 return dl;}
-var rename_observers=[];function notify_rename_observers(dt,old_name,new_name){try{delete locals[dt][old_name];}catch(e){alert("[rename_from_local] No Document for: "+old_name);}
-for(var i=0;i<rename_observers.length;i++){if(rename_observers[i])
-rename_observers[i].rename_notify(dt,old_name,new_name);}}
 var Meta={};var local_dt={};Meta.make_local_dt=function(dt,dn){var dl=make_doclist('DocType',dt);if(!local_dt[dt])local_dt[dt]={};if(!local_dt[dt][dn])local_dt[dt][dn]={};for(var i=0;i<dl.length;i++){var d=dl[i];if(d.doctype=='DocField'){var key=d.fieldname?d.fieldname:d.label;local_dt[dt][dn][key]=copy_dict(d);}}}
-Meta.get_field=function(dt,fn,dn){if(dn&&local_dt[dt]&&local_dt[dt][dn]){return local_dt[dt][dn][fn];}else{if(fields[dt])var d=fields[dt][fn];if(d)return d;}
+Meta.get_field=function(dt,fn,dn){if(dn&&local_dt[dt]&&local_dt[dt][dn]){return local_dt[dt][dn][fn];}else{if(wn.meta.docfield_map[dt])var d=wn.meta.docfield_map[dt][fn];if(d)return d;}
 return{};}
 Meta.set_field_property=function(fn,key,val,doc){if(!doc&&(cur_frm.doc))doc=cur_frm.doc;try{local_dt[doc.doctype][doc.name][fn][key]=val;refresh_field(fn);}catch(e){alert("Client Script Error: Unknown values for "+doc.name+','+fn+'.'+key+'='+val);}}
-function get_doctype_label(dt){if(session.dt_labels&&session.dt_labels[dt])
-return session.dt_labels[dt]
-else
-return dt}
-function get_label_doctype(label){if(session.rev_dt_labels&&session.rev_dt_labels[label])
-return session.rev_dt_labels[label]
-else
-return label}
+function get_doctype_label(dt){return dt}
+function get_label_doctype(label){return label}
 var getchildren=LocalDB.getchildren;var get_field=Meta.get_field;var createLocal=LocalDB.create;
 /*
  *	lib/js/legacy/model/doclist.js
  */
-function compress_doclist(list){var kl={};var vl=[];var flx={};for(var i=0;i<list.length;i++){var o=list[i];var fl=[];if(!kl[o.doctype]){var tfl=['doctype','name','docstatus','owner','parent','parentfield','parenttype','idx','creation','modified','modified_by','__islocal','__deleted','__newname','__modified','_user_tags'];var fl=['doctype','name','docstatus','owner','parent','parentfield','parenttype','idx','creation','modified','modified_by','__islocal','__deleted','__newname','__modified','_user_tags'];for(key in fields[o.doctype]){if(!in_list(fl,key)&&!in_list(no_value_fields,fields[o.doctype][key].fieldtype)&&!fields[o.doctype][key].no_column){fl[fl.length]=key;tfl[tfl.length]=key}}
+function compress_doclist(list){var kl={};var vl=[];var flx={};for(var i=0;i<list.length;i++){var o=list[i];var fl=[];if(!kl[o.doctype]){var tfl=['doctype','name','docstatus','owner','parent','parentfield','parenttype','idx','creation','modified','modified_by','__islocal','__deleted','__newname','__modified','_user_tags'];var fl=['doctype','name','docstatus','owner','parent','parentfield','parenttype','idx','creation','modified','modified_by','__islocal','__deleted','__newname','__modified','_user_tags'];for(key in wn.meta.docfield_map[o.doctype]){if(!in_list(fl,key)&&!in_list(no_value_fields,wn.meta.docfield_map[o.doctype][key].fieldtype)&&!wn.meta.docfield_map[o.doctype][key].no_column){fl[fl.length]=key;tfl[tfl.length]=key}}
 flx[o.doctype]=fl;kl[o.doctype]=tfl}
 var nl=[];var fl=flx[o.doctype];for(var j=0;j<fl.length;j++){var v=o[fl[j]];nl.push(v);}
 vl.push(nl);}
@@ -991,94 +773,55 @@
 l[l.length]=zip(docs._kl[docs._vl[i][0]],docs._vl[i]);return l;}
 function zip(k,v){var obj={};for(var i=0;i<k.length;i++){obj[k[i]]=v[i];}
 return obj;}
-function save_doclist(dt,dn,save_action,onsave,onerr){var doc=locals[dt][dn];var doctype=locals['DocType'][dt];var tmplist=[];var doclist=make_doclist(dt,dn,1);var all_clear=true;if(save_action!='Cancel'){for(var n in doclist){var tmp=check_required(doclist[n].doctype,doclist[n].name,doclist[0].doctype);if(doclist[n].docstatus+''!='2'&&all_clear)
-all_clear=tmp;}}
-var f=frms[dt];if(f&&!all_clear){if(f)f.savingflag=false;return'Error';}
+function save_doclist(dt,dn,save_action,onsave,onerr){var doc=locals[dt][dn];var doctype=locals['DocType'][dt];var tmplist=[];var doclist=make_doclist(dt,dn,1);var all_reqd_ok=true;if(save_action!='Cancel'){for(var n in doclist){var reqd_ok=check_required(doclist[n].doctype,doclist[n].name,doclist[0].doctype);if(doclist[n].docstatus+''!='2'&&all_reqd_ok)
+all_reqd_ok=reqd_ok;}}
+if(!all_reqd_ok){onerr()
+return;}
 var _save=function(){$c('webnotes.widgets.form.save.savedocs',{'docs':compress_doclist(doclist),'docname':dn,'action':save_action,'user':user},function(r,rtxt){if(f){f.savingflag=false;}
 if(r.saved){if(onsave)onsave(r);}else{if(onerr)onerr(r);}},function(){if(f){f.savingflag=false;}},0,(f?'Saving...':''));}
 if(doc.__islocal&&(doctype&&doctype.autoname&&doctype.autoname.toLowerCase()=='prompt')){var newname=prompt('Enter the name of the new '+dt,'');if(newname){doc.__newname=strip(newname);_save();}else{msgprint('Not Saved');onerr();}}else{_save();}}
-function check_required(dt,dn,parent_dt){var doc=locals[dt][dn];if(doc.docstatus>1)return true;var fl=fields_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;i<fl.length;i++){var key=fl[i].fieldname;var v=doc[key];if(fl[i].reqd&&is_null(v)&&fl[i].fieldname){errfld[errfld.length]=fl[i].label;if(cur_frm){var f=cur_frm.fields_dict[fl[i].fieldname];if(f){if(f.set_as_error)f.set_as_error(1);if(!cur_frm.error_in_section&&f.parent_section){cur_frm.set_section(f.parent_section.sec_id);cur_frm.error_in_section=1;}}}
+function check_required(dt,dn,parent_dt){var doc=locals[dt][dn];if(doc.docstatus>1)return true;var fl=wn.meta.docfield_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;i<fl.length;i++){var key=fl[i].fieldname;var v=doc[key];if(fl[i].reqd&&is_null(v)&&fl[i].fieldname){errfld[errfld.length]=fl[i].label;if(cur_frm){var f=cur_frm.fields_dict[fl[i].fieldname];if(f){if(f.set_as_error)f.set_as_error(1);if(!cur_frm.error_in_section&&f.parent_section){cur_frm.error_in_section=1;}}}
 if(all_clear)all_clear=false;}}
 if(errfld.length)msgprint('<b>Mandatory fields required in '+
-(doc.parenttype?(fields[doc.parenttype][doc.parentfield].label+' (Table)'):get_doctype_label(doc.doctype))+':</b>\n'+errfld.join('\n'));return all_clear;}
+(doc.parenttype?(wn.meta.docfield_map[doc.parenttype][doc.parentfield].label+' (Table)'):get_doctype_label(doc.doctype))+':</b>\n'+errfld.join('\n'));return all_clear;}
 /*
- *	lib/js/legacy/webpage/body.js
+ *	lib/js/wn/app.js
  */
-wn.provide('wn.pages');function Body(){this.left_sidebar=null;this.right_sidebar=null;this.status_area=null;var me=this;page_body=this;this.ready=function(){$dh('startup_div');$ds('body_div');}
-this.setup_page_areas=function(){this.center=this.body;this.center.header=$a(this.center,'div');this.center.body=$a(this.center,'div');this.center.loading=$a(this.center,'div','',{margin:'200px 0px',fontSize:'14px',color:'#999',textAlign:'center'});this.center.loading.innerHTML='Loading...'}
-this.run_startup_code=function(){$(document).trigger('startup');try{if(this.cp.custom_startup_code)
-eval(this.cp.custom_startup_code);}catch(e){errprint(e);}}
-this.setup=function(){this.cp=wn.control_panel;this.wrapper=$a($i('body_div'),'div');this.body=$a(this.wrapper,'div');this.setup_page_areas();if(user=='Guest')user_defaults.hide_webnotes_toolbar=1;if(!cint(user_defaults.hide_webnotes_toolbar)||user=='Administrator'){this.wntoolbar=new wn.ui.toolbar.Toolbar();}
-if(this.cp.page_width)
-$y(this.wrapper,{width:cint(this.cp.page_width)+'px'});}
-this.cur_page=null;this.add_page=function(label,onshow,onhide){var c=$a(this.center.body,'div');if(onshow)
-c.page_show=onshow;if(onhide)
-c.page_hide=onhide;wn.pages[label]=c;$dh(c);return c;}
-this.change_to=function(label){$dh(this.center.loading);if(me.cur_page&&wn.pages[label]!=me.cur_page){if(me.cur_page.page_hide)
-me.cur_page.page_hide();$dh(me.cur_page);}
-me.cur_page=wn.pages[label];me.cur_page_label=label;$(me.cur_page).fadeIn();if(me.cur_page.page_show)
-me.cur_page.page_show(me.cur_page);}
-this.set_session_changed=function(){if(this.session_message_set)return;var div=$a($i('body_div').parentNode,'div','',{textAlign:'center',fontSize:'14px',margin:'150px auto'});$dh('body_div');div.innerHTML='This session has been changed. Please <span class="link_type" onclick="window.location.reload()">refresh</span> to continue';this.session_message_set=1;}
-this.setup();}
-/*
- *	lib/js/legacy/app.js
- */
-var popup_cont;var session={};var start_sid=null;if(!wn)var wn={};function startup(){start_sid=get_cookie('sid');popup_cont=$a(document.getElementsByTagName('body')[0],'div');var setup_globals=function(r){wn.boot=r;profile=r.profile;user=r.profile.name;user_fullname=wn.user_info(user).fullname;user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;home_page=r.home_page;_p.letter_heads=r.letter_heads;sys_defaults=r.sysdefaults;session.rt=profile.can_read;if(r.ipinfo)session.ipinfo=r.ipinfo;session.dt_labels=r.dt_labels;session.rev_dt_labels={}
-if(r.dt_labels){for(key in r.dt_labels)session.rev_dt_labels[r.dt_labels[key]]=key;}
-wn.control_panel=r.control_panel;}
-var setup_history=function(r){rename_observers.push(nav_obj);}
-var callback=function(r,rt){if(r.exc)console.log(r.exc);setup_globals(r);setup_history();var a=new Body();page_body.run_startup_code();for(var i=0;i<startup_list.length;i++){startup_list[i]();}
-var t=to_open();if(t){historyChange(t);}else if(home_page){loadpage(home_page);}
-page_body.ready();}
-if(wn.boot){LocalDB.sync(wn.boot.docs);callback(wn.boot,'');if(wn.boot.error_messages)
+wn.Application=Class.extend({init:function(){this.load_bootinfo();this.make_page_container();this.make_nav_bar();this.set_favicon();$(document).trigger('startup');wn.route();},load_bootinfo:function(){LocalDB.sync(wn.boot.docs);wn.control_panel=wn.boot.control_panel;if(wn.boot.error_messages)
 console.log(wn.boot.error_messages)
 if(wn.boot.server_messages)
-msgprint(wn.boot.server_messages);}else{if($i('startup_div'))
-$c('startup',{},callback,null,1);}}
-function to_open(){if(get_url_arg('page'))
-return get_url_arg('page');var h=location.hash;if(h){return h.substr(1);}}
-function logout(){$c('logout',args={},function(r,rt){if(r.exc){msgprint(r.exc);return;}
-redirect_to_login();});}
-function redirect_to_login(){if(login_file)
-window.location.href=login_file;else{window.location.reload();}}
-_p.def_print_style_body="html, body, div, span, td { font-family: Arial, Helvetica; font-size: 12px; }"+"\npre { margin:0; padding:0;}"
-_p.def_print_style_other="\n.simpletable, .noborder { border-collapse: collapse; margin-bottom: 10px;}"
-+"\n.simpletable td {border: 1pt solid #000; vertical-align: top; padding: 2px; }"
-+"\n.noborder td { vertical-align: top; }"
-_p.go=function(html){var d=document.createElement('div')
-d.innerHTML=html
-$(d).printElement();}
-_p.preview=function(html){var w=window.open('');w.document.write(html)
-w.document.close();}
-var resize_observers=[]
-function set_resize_observer(fn){if(resize_observers.indexOf(fn)==-1)resize_observers.push(fn);}
-window.onresize=function(){return;var ht=get_window_height();for(var i=0;i<resize_observers.length;i++){resize_observers[i](ht);}}
-get_window_height=function(){var ht=window.innerHeight?window.innerHeight:document.documentElement.offsetHeight?document.documentElement.offsetHeight:document.body.offsetHeight;return ht;}
+msgprint(wn.boot.server_messages);this.set_globals();},set_globals:function(){profile=wn.boot.profile;user=wn.boot.profile.name;user_fullname=wn.user_info(user).fullname;user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;sys_defaults=wn.boot.sysdefaults;},make_page_container:function(){wn.container=new wn.views.Container();wn.views.make_403();wn.views.make_404();$('#startup_div').toggle(false);$('#body_div').toggle(true);},make_nav_bar:function(){if(wn.user.name!='Guest'){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();}},logout:function(){var me=this;wn.call({method:'logout',callback:function(r){if(r.exc){console.log(r.exc);return;}
+me.redirect_to_login();}})},redirect_to_login:function(){window.location.hash='';window.location.reload();},set_favicon:function(){var link=$('link[type="image/x-icon"]').remove().attr("href");var favicon='\
+   <link rel="shortcut icon" href="'+link+'" type="image/x-icon"> \
+   <link rel="icon" href="'+link+'" type="image/x-icon">'
+$(favicon).appendTo('head');}})
 /*
  *	js/app.js
  */
-wn.app={name:'ERPNext',license:'GNU/GPL - Usage Condition: All "erpnext" branding must be kept as it is',source:'https://github.com/webnotes/erpnext',publisher:'Web Notes Technologies Pvt Ltd, Mumbai',copyright:'&copy; Web Notes Technologies Pvt Ltd',version:'2.'+window._version_number}
-wn.modules_path='erpnext';wn.settings.no_history=true;$(document).bind('ready',function(){startup();});$(document).bind('toolbar_setup',function(){$('.brand').html('<b>erp</b>next\
-  <i class="icon-home icon-white navbar-icon-home" ></i>').hover(function(){$(this).find('.icon-home').addClass('navbar-icon-home-hover');},function(){$(this).find('.icon-home').removeClass('navbar-icon-home-hover');});})
+wn.provide('erpnext');erpnext.set_about=function(){wn.provide('wn.app');$.extend(wn.app,{name:'ERPNext',license:'GNU/GPL - Usage Condition: All "erpnext" branding must be kept as it is',source:'https://github.com/webnotes/erpnext',publisher:'Web Notes Technologies Pvt Ltd, Mumbai',copyright:'&copy; Web Notes Technologies Pvt Ltd',version:'2.'+window._version_number});}
+wn.modules_path='erpnext';$(document).bind('toolbar_setup',function(){$('.brand').html('<b>erp</b>next\
+  <i class="icon-home icon-white navbar-icon-home" ></i>').hover(function(){$(this).find('.icon-home').addClass('navbar-icon-home-hover');},function(){$(this).find('.icon-home').removeClass('navbar-icon-home-hover');});});
 /*
  *	erpnext/startup/startup.js
  */
 var current_module;var is_system_manager=0;wn.provide('erpnext.startup');erpnext.modules={'Selling':'selling-home','Accounts':'accounts-home','Stock':'stock-home','Buying':'buying-home','Support':'support-home','Projects':'projects-home','Production':'production-home','Website':'website-home','HR':'hr-home','Setup':'Setup','Activity':'activity','To Do':'todo','Calendar':'calendar','Messages':'messages','Knowledge Base':'questions','Dashboard':'dashboard'}
-erpnext.startup.set_globals=function(){pscript.is_erpnext_saas=cint(wn.control_panel.sync_with_gateway)
+erpnext.startup.set_globals=function(){wn.control_panel.sync_with_gateway=wn.boot.sync_with_gateway
+pscript.is_erpnext_saas=cint(wn.control_panel.sync_with_gateway)
 if(inList(user_roles,'System Manager'))is_system_manager=1;}
-erpnext.startup.start=function(){$('#startup_div').html('Starting up...').toggle(true);erpnext.startup.set_globals();if(wn.boot.custom_css){set_style(wn.boot.custom_css);}
-if(wn.boot.user_background){erpnext.set_user_background(wn.boot.user_background);}
-if(user=='Guest'){if(wn.boot.website_settings.title_prefix){wn.title_prefix=wn.boot.website_settings.title_prefix;}}else{wn.boot.profile.allow_modules=wn.boot.profile.allow_modules.concat(['To Do','Knowledge Base','Calendar','Activity','Messages'])
-erpnext.toolbar.setup();erpnext.startup.set_periodic_updates();$('footer').html('<div class="web-footer erpnext-footer">\
-   <a href="#!attributions">ERPNext | Attributions and License</a></div>');if(in_list(user_roles,'System Manager')&&(wn.boot.setup_complete=='No')){wn.require("erpnext/startup/js/complete_setup.js");erpnext.complete_setup();}}
-$('#startup_div').toggle(false);}
+erpnext.startup.start=function(){$('#startup_div').html('Starting up...').toggle(true);erpnext.startup.set_globals();if(wn.boot.user_background){erpnext.set_user_background(wn.boot.user_background);}
+if(user=='Guest'){if(wn.boot.custom_css){set_style(wn.boot.custom_css);}
+if(wn.boot.website_settings.title_prefix){wn.title_prefix=wn.boot.website_settings.title_prefix;}}else{wn.boot.profile.allow_modules=wn.boot.profile.allow_modules.concat(['To Do','Knowledge Base','Calendar','Activity','Messages'])
+if(user_roles.indexOf('Accounts Manager')!=-1){wn.boot.profile.allow_modules.push('Dashboard');}
+erpnext.toolbar.setup();erpnext.startup.set_periodic_updates();if(in_list(user_roles,'System Manager')&&(wn.boot.setup_complete=='No')){wn.require("erpnext/startup/js/complete_setup.js");erpnext.complete_setup();}}
+erpnext.set_about();$('#startup_div').toggle(false);}
 show_chart_browser=function(nm,chart_type){var call_back=function(){if(nm=='Sales Browser'){var sb_obj=new SalesBrowser();sb_obj.set_val(chart_type);}
 else if(nm=='Accounts Browser')
 pscript.make_chart(chart_type);}
 loadpage(nm,call_back);}
-var update_messages=function(reset){if(inList(['Guest'],user)){return;}
-if(!reset){$c_page('home','event_updates','get_global_status_messages',null,function(r,rt){if(!r.exc){page_body.wntoolbar.set_new_comments(r.message.unread_messages);var show_in_circle=function(parent_id,msg){var parent=$('#'+parent_id);if(parent){if(msg){parent.find('span:first').text(msg);parent.toggle(true);}else{parent.toggle(false);}}}
-show_in_circle('unread_messages',r.message.unread_messages.length);show_in_circle('open_support_tickets',r.message.open_support_tickets);show_in_circle('things_todo',r.message.things_todo);show_in_circle('todays_events',r.message.todays_events);}else{clearInterval(wn.updates.id);}});}else{page_body.wntoolbar.set_new_comments(0);$('#unread_messages').toggle(false);}}
+var update_messages=function(reset){if(inList(['Guest'],user)||!wn.session_alive){return;}
+if(!reset){var set_messages=function(r){if(!r.exc){wn.container.wntoolbar.set_new_comments(r.message.unread_messages);var show_in_circle=function(parent_id,msg){var parent=$('#'+parent_id);if(parent){if(msg){parent.find('span:first').text(msg);parent.toggle(true);}else{parent.toggle(false);}}}
+show_in_circle('unread_messages',r.message.unread_messages.length);show_in_circle('open_support_tickets',r.message.open_support_tickets);show_in_circle('things_todo',r.message.things_todo);show_in_circle('todays_events',r.message.todays_events);}else{clearInterval(wn.updates.id);}}
+wn.call({method:'startup.startup.get_global_status_messages',callback:set_messages});}else{wn.container.wntoolbar.set_new_comments(0);$('#unread_messages').toggle(false);}}
 erpnext.startup.set_periodic_updates=function(){wn.updates={};if(wn.updates.id){clearInterval(wn.updates.id);}
 wn.updates.id=setInterval(update_messages,60000);}
 erpnext.set_user_background=function(src){set_style(repl('body { background: url("files/%(src)s") repeat;}',{src:src}))}
@@ -1086,7 +829,7 @@
 /*
  *	erpnext/website/js/topbar.js
  */
-wn.provide('erpnext.navbar');erpnext.navbar.navbar=Class.extend({init:function(){this.make();$('.brand').html(wn.boot.website_settings.brand_html);this.make_items();$('.dropdown-toggle').dropdown();},make:function(){$('header').append('<div class="navbar navbar-fixed-top">\
+wn.provide('erpnext.navbar');erpnext.navbar.Navbar=Class.extend({init:function(){this.make();$('.brand').html(wn.boot.website_settings.brand_html);this.make_items();$('.dropdown-toggle').dropdown();},make:function(){$('header').append('<div class="navbar navbar-fixed-top">\
    <div class="navbar-inner">\
    <div class="container">\
     <a class="brand">[brand]</a>\
@@ -1110,4 +853,4 @@
     <a href="https://erpnext.com">erpnext.com</a></div>\
   </div>',wn.boot.website_settings));this.make_items();},make_items:function(){var items=wn.boot.website_menus
 for(var i=0;i<items.length;i++){var item=items[i];if(!item.parent_label&&item.parentfield=='footer_items'){item.route=item.url||item.custom_page;$('.web-footer-menu ul').append(repl('<li><a href="#!%(route)s" \
-     data-label="%(label)s">%(label)s</a></li>',item))}}}});$(document).bind('startup',function(){erpnext.footer=new erpnext.Footer();erpnext.navbar.navbar=new erpnext.navbar.navbar();})
\ No newline at end of file
+     data-label="%(label)s">%(label)s</a></li>',item))}}}});$(document).bind('startup',function(){erpnext.footer=new erpnext.Footer();erpnext.navbar.navbar=new erpnext.navbar.Navbar();})
\ No newline at end of file
diff --git a/js/app.js b/js/app.js
index f2e24bb..b8b772e 100644
--- a/js/app.js
+++ b/js/app.js
@@ -1,34 +1,17 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-wn.app = {
-	name: 'ERPNext',
-	license: 'GNU/GPL - Usage Condition: All "erpnext" branding must be kept as it is',
-	source: 'https://github.com/webnotes/erpnext',
-	publisher: 'Web Notes Technologies Pvt Ltd, Mumbai',
-	copyright: '&copy; Web Notes Technologies Pvt Ltd',
-	version: '2.' + window._version_number
+wn.provide('erpnext');
+erpnext.set_about = function() {
+	wn.provide('wn.app');
+	$.extend(wn.app, {
+		name: 'ERPNext',
+		license: 'GNU/GPL - Usage Condition: All "erpnext" branding must be kept as it is',
+		source: 'https://github.com/webnotes/erpnext',
+		publisher: 'Web Notes Technologies Pvt Ltd, Mumbai',
+		copyright: '&copy; Web Notes Technologies Pvt Ltd',
+		version: '2.' + window._version_number
+	});
 }
 
 wn.modules_path = 'erpnext';
-wn.settings.no_history = true;
-
-$(document).bind('ready', function() {
-	startup();
-});
 
 $(document).bind('toolbar_setup', function() {
 	$('.brand').html('<b>erp</b>next\
@@ -38,4 +21,4 @@
 	}, function() {
 		$(this).find('.icon-home').removeClass('navbar-icon-home-hover');
 	});
-})
+});
diff --git a/temp.py b/temp.py
index cdbd4b0..b6080f0 100644
--- a/temp.py
+++ b/temp.py
@@ -39,17 +39,19 @@
 
 if __name__=='__main__':
 	import os
-	clicense = '\n'.join([('# ' + l) for l in license2.split('\n')])
-	
-	for wt in os.walk('lib/py/build/'):
+	#clicense = '\n'.join([('# ' + l) for l in license2.split('\n')])
+	cnt = 0	
+	for wt in os.walk('.'):
 		for fname in wt[2]:
-			if fname.endswith('.py'):
-				path = os.path.join(wt[0], fname)
-				with open(path, 'r') as codefile:
-					codetxt = codefile.read()
+			if fname.endswith('.js'):
+				cnt += 1
+				#path = os.path.join(wt[0], fname)
+				#with open(path, 'r') as codefile:
+				#	codetxt = codefile.read()
 				
-				if codetxt.strip():
-					with open(path, 'w') as codefile:
-						codefile.write(clicense + '\n\n' + codetxt)
+				#if codetxt.strip():
+				#	with open(path, 'w') as codefile:
+				#		codefile.write(clicense + '\n\n' + codetxt)
 				
-					print 'updated in ' + path				
\ No newline at end of file
+				#	print 'updated in ' + path	
+	print cnt
diff --git a/version.num b/version.num
deleted file mode 100644
index 3f986b9..0000000
--- a/version.num
+++ /dev/null
@@ -1 +0,0 @@
-842
\ No newline at end of file
diff --git a/wnf.py b/wnf.py
deleted file mode 100755
index a80cc27..0000000
--- a/wnf.py
+++ /dev/null
@@ -1,247 +0,0 @@
-#!/usr/bin/env python
-
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import os, sys
-
-def replace_code(start, txt1, txt2, extn):
-	"""replace all txt1 by txt2 in files with extension (extn)"""
-	import os, re
-	for wt in os.walk(start, followlinks=1):
-		for fn in wt[2]:
-			if fn.split('.')[-1]==extn:
-				fpath = os.path.join(wt[0], fn)
-				with open(fpath, 'r') as f:
-					content = f.read()
-				
-				if re.search(txt1, content):
-					search_replace_with_prompt(fpath, txt1, txt2)
-
-
-
-def search_replace_with_prompt(fpath, txt1, txt2):
-	""" Search and replace all txt1 by txt2 in the file with confirmation"""
-
-	from termcolor import colored
-	with open(fpath, 'r') as f:
-		content = f.readlines()
-
-	tmp = []
-	for c in content:
-		if c.find(txt1) != -1:
-			print '\n', fpath
-			print  colored(txt1, 'red').join(c[:-1].split(txt1))
-
-			a = raw_input('Do you want to Change [y/n]?')
-			if a=='y':
-				c = c.replace(txt1, txt2)
-			tmp.append(c)
-
-	with open(fpath, 'w') as f:
-		f.write(''.join(tmp))
-	print colored('Updated in %s'  % fpath, 'green')
-	
-
-def setup_options():
-	from optparse import OptionParser
-	parser = OptionParser()
-
-	parser.add_option("-d", "--db",
-						dest="db_name",
-						help="Apply the patches on given db")
-
-	# build
-	parser.add_option("-b", "--build", default=False, action="store_true",
-						help="minify + concat js files")
-	parser.add_option("-c", "--clear", default=False, action="store_true",
-						help="increment version")
-
-	# git
-	parser.add_option("--status", default=False, action="store_true",
-						help="git status")
-	parser.add_option("--pull", nargs=2, default=False,
-						metavar = "remote branch",
-						help="git pull (both repos)")
-	parser.add_option("--push", nargs=3, default=False, 
-						metavar = "remote branch comment",
-						help="git commit + push (both repos) [remote] [branch] [comment]")
-	parser.add_option("-l", "--latest",
-						action="store_true", dest="run_latest", default=False,
-						help="Apply the latest patches")
-
-	# patch
-	parser.add_option("-p", "--patch", nargs=1, dest="patch_list", metavar='patch_module',
-						action="append",
-						help="Apply patch")
-	parser.add_option("-f", "--force",
-						action="store_true", dest="force", default=False,
-						help="Force Apply all patches specified using option -p or --patch")
-	parser.add_option('--reload_doc', nargs=3, metavar = "module doctype docname",
-						help="reload doc")
-	parser.add_option('--export_doc', nargs=2, metavar = "doctype docname",
-						help="export doc")
-
-	# install
-	parser.add_option('--install', nargs=3, metavar = "rootpassword dbname source",
-						help="install fresh db")
-	parser.add_option('--sync_with_gateway', nargs=1, metavar = "1/0", \
-						help="Set or Unset Sync with Gateway")
-
-	# diff
-	parser.add_option('--diff_ref_file', nargs=0, \
-						help="Get missing database records and mismatch properties, with file as reference")
-	parser.add_option('--diff_ref_db', nargs=0, \
-						help="Get missing .txt files and mismatch properties, with database as reference")
-
-	# scheduler
-	parser.add_option('--run_scheduler', default=False, action="store_true",
-						help="Trigger scheduler")
-	parser.add_option('--run_scheduler_event', nargs=1, metavar="[all|daily|weekly|monthly]",
-						help="Run scheduler event")
-
-	# misc
-	parser.add_option("--replace", nargs=3, default=False, 
-						metavar = "search replace_by extension",
-						help="file search-replace")
-
-	parser.add_option("--cci", nargs=1, metavar="CacheItem Key",
-		help="Clear Cache Item")
-	
-
-	return parser.parse_args()
-	
-def run():
-	sys.path.append('lib')
-	sys.path.append('lib/py')
-	import webnotes
-	import webnotes.defs
-	sys.path.append(webnotes.defs.modules_path)
-
-	(options, args) = setup_options()
-
-
-	from webnotes.db import Database
-	import webnotes.modules.patch_handler
-
-	# connect
-	if options.db_name is not None:
-		webnotes.connect(options.db_name)
-
-	# build
-	if options.build:
-		import build.project
-		build.project.build()		
-
-	elif options.clear:
-		from build.project import increment_version
-		print "Version:" + str(increment_version())
-	
-	# code replace
-	elif options.replace:
-		replace_code('.', options.replace[0], options.replace[1], options.replace[2])
-	
-	# git
-	elif options.status:
-		os.system('git status')
-		os.chdir('lib')
-		os.system('git status')
-	
-	elif options.pull:
-		os.system('git pull %s %s' % (options.pull[0], options.pull[1]))
-		os.chdir('lib')
-		os.system('git pull %s %s' % (options.pull[0], options.pull[1]))
-
-	elif options.push:
-		os.system('git commit -a -m "%s"' % options.push[2])
-		os.system('git push %s %s' % (options.push[0], options.push[1]))
-		os.chdir('lib')
-		os.system('git commit -a -m "%s"' % options.push[2])
-		os.system('git push %s %s' % (options.push[0], options.push[1]))
-	
-	# patch
-	elif options.patch_list:
-		# clear log
-		webnotes.modules.patch_handler.log_list = []
-		
-		# run individual patches
-		for patch in options.patch_list:
-			webnotes.modules.patch_handler.run_single(\
-				patchmodule = patch, force = options.force)
-		
-		print '\n'.join(webnotes.modules.patch_handler.log_list)
-	
-		# reload
-	elif options.reload_doc:
-		webnotes.modules.patch_handler.reload_doc(\
-			{"module":options.reload_doc[0], "dt":options.reload_doc[1], "dn":options.reload_doc[2]})		
-		print '\n'.join(webnotes.modules.patch_handler.log_list)
-
-	elif options.export_doc:
-		from webnotes.modules import export_doc
-		export_doc(options.export_doc[0], options.export_doc[1])
-
-	# run all pending
-	elif options.run_latest:
-		webnotes.modules.patch_handler.run_all()
-		print '\n'.join(webnotes.modules.patch_handler.log_list)
-	
-	elif options.install:
-		from webnotes.install_lib.install import Installer
-		inst = Installer('root', options.install[0])
-		inst.import_from_db(options.install[1], source_path=options.install[2], \
-			password='admin', verbose = 1)
-	
-	elif options.sync_with_gateway:
-		if int(options.sync_with_gateway[0]) in [0, 1]:
-			webnotes.conn.begin()
-			webnotes.conn.sql("""\
-				UPDATE `tabSingles` SET value=%s
-				WHERE field='sync_with_gateway' AND doctype='Control Panel'""", int(options.sync_with_gateway[0]))
-			webnotes.conn.commit()
-			webnotes.message_log.append("sync_with_gateway set to %s" % options.sync_with_gateway[0])
-		else:
-			webnotes.message_log.append("ERROR: sync_with_gateway can be either 0 or 1")
-	
-	elif options.diff_ref_file is not None:
-		import webnotes.modules.diff
-		webnotes.modules.diff.diff_ref_file()
-
-	elif options.diff_ref_db is not None:
-		import webnotes.modules.diff
-		webnotes.modules.diff.diff_ref_db()
-	
-	elif options.run_scheduler:
-		import webnotes.utils.scheduler
-		print webnotes.utils.scheduler.execute()
-	
-	elif options.run_scheduler_event is not None:
-		import webnotes.utils.scheduler
-		print webnotes.utils.scheduler.trigger('execute_' + options.run_scheduler_event)
-	
-	elif options.cci is not None:
-		if options.cci=='all':
-			webnotes.conn.sql("DELETE FROM __CacheItem")
-		else:
-			from webnotes.utils.cache import CacheItem
-			CacheItem(options.cci).clear()
-
-	# print messages
-	if webnotes.message_log:
-		print '\n'.join(webnotes.message_log)
-
-if __name__=='__main__':
-	run()