Merge pull request #6352 from superlack/patch-1

Activity Summary to not show cancelled timesheets on click
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index 0917428..97d2cdb 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -12,20 +12,12 @@
 	"""Get a list of dict {"from_date": from_date, "to_date": to_date, "key": key, "label": label}
 		Periodicity can be (Yearly, Quarterly, Monthly)"""
 
-	from_fy_start_end_date = frappe.db.get_value("Fiscal Year", from_fiscal_year, ["year_start_date", "year_end_date"])
-	to_fy_start_end_date = frappe.db.get_value("Fiscal Year", to_fiscal_year, ["year_start_date", "year_end_date"])
-
-	if not from_fy_start_end_date:
-		frappe.throw(_("Start Year {0} not found.").format(from_fiscal_year))
-	
-	if not to_fy_start_end_date:
-		frappe.throw(_("End Year {0} not found.").format(to_fiscal_year))
+	fiscal_year = get_fiscal_year_data(from_fiscal_year, to_fiscal_year)
+	validate_fiscal_year(fiscal_year, from_fiscal_year, to_fiscal_year)
 
 	# start with first day, so as to avoid year to_dates like 2-April if ever they occur]
-	year_start_date = getdate(from_fy_start_end_date[0])
-	year_end_date = getdate(to_fy_start_end_date[1])
-
-	validate_fiscal_year(year_start_date, year_end_date)
+	year_start_date = getdate(fiscal_year.year_start_date)
+	year_end_date = getdate(fiscal_year.year_end_date)
 
 	months_to_add = {
 		"Yearly": 12,
@@ -46,7 +38,7 @@
 
 		to_date = add_months(start_date, months_to_add)
 		start_date = to_date
-		
+
 		if to_date == get_first_day(to_date):
 			# if to_date is the first day, get the last day of previous month
 			to_date = add_days(to_date, -1)
@@ -85,8 +77,16 @@
 
 	return period_list
 
-def validate_fiscal_year(start_date, end_date):
-	if date_diff(end_date, start_date) <= 0:
+def get_fiscal_year_data(from_fiscal_year, to_fiscal_year):
+	fiscal_year = frappe.db.sql("""select min(year_start_date) as year_start_date, 
+		max(year_end_date) as year_end_date from `tabFiscal Year` where 
+		name between %(from_fiscal_year)s and %(to_fiscal_year)s""",
+		{'from_fiscal_year': from_fiscal_year, 'to_fiscal_year': to_fiscal_year}, as_dict=1)
+
+	return fiscal_year[0] if fiscal_year else {}
+
+def validate_fiscal_year(fiscal_year, from_fiscal_year, to_fiscal_year):
+	if not fiscal_year.get('year_start_date') and not fiscal_year.get('year_end_date'):
 		frappe.throw(_("End Year cannot be before Start Year"))
 
 def get_months(start_date, end_date):
@@ -142,10 +142,9 @@
 			for period in period_list:
 				# check if posting date is within the period
 
-				fiscal_year = get_date_fiscal_year(entry.posting_date)
 				if entry.posting_date <= period.to_date:
 					if (accumulated_values or entry.posting_date >= period.from_date) and \
-						(fiscal_year == period.to_date_fiscal_year or not ignore_accumulated_values_for_fy):
+						(entry.fiscal_year == period.to_date_fiscal_year or not ignore_accumulated_values_for_fy):
 						d[period.key] = d.get(period.key, 0.0) + flt(entry.debit) - flt(entry.credit)
 
 			if entry.posting_date < period_list[0].year_start_date:
@@ -294,7 +293,7 @@
 
 	additional_conditions = get_additional_conditions(from_date, ignore_closing_entries, filters)
 
-	gl_entries = frappe.db.sql("""select posting_date, account, debit, credit, is_opening from `tabGL Entry`
+	gl_entries = frappe.db.sql("""select posting_date, account, debit, credit, is_opening, fiscal_year from `tabGL Entry`
 		where company=%(company)s
 		{additional_conditions}
 		and posting_date <= %(to_date)s
diff --git a/erpnext/public/css/website.css b/erpnext/public/css/website.css
index 065e281..ab3beb0 100644
--- a/erpnext/public/css/website.css
+++ b/erpnext/public/css/website.css
@@ -45,11 +45,6 @@
 .product-text {
   padding: 15px 0px;
 }
-.product-label {
-  padding-bottom: 4px;
-  text-transform: uppercase;
-  font-size: 12px;
-}
 .product-search {
   margin-bottom: 15px;
 }
diff --git a/erpnext/public/less/website.less b/erpnext/public/less/website.less
index 4aa3940..37d69e0 100644
--- a/erpnext/public/less/website.less
+++ b/erpnext/public/less/website.less
@@ -51,12 +51,6 @@
 	padding: 15px 0px;
 }
 
-.product-label {
-	padding-bottom: 4px;
-	text-transform: uppercase;
-	font-size: 12px;
-}
-
 .product-search {
 	margin-bottom: 15px;
 }
@@ -165,7 +159,7 @@
 
 .cart-container {
 	margin: 50px 0px;
-	
+
 	.checkout {
 		margin-bottom:15px;
 	}
@@ -223,7 +217,7 @@
 .cart-dropdown-container {
 	width: 400px;
 	padding: 15px;
-	
+
 	.item-price {
 		display: block !important;
 		padding-bottom: 10px;
@@ -232,12 +226,12 @@
 	.cart-item-header {
 		border-bottom: 1px solid #d1d8dd;
 	}
-	
+
 	.cart-items-dropdown {
 		max-height: 350px;
-		overflow: auto;	
+		overflow: auto;
 	}
-	
+
 	.cart-items-dropdown .cart-dropdown {
 		display:block;
 	   	margin-top:15px;
diff --git a/erpnext/schools/doctype/student_sibling/student_sibling.json b/erpnext/schools/doctype/student_sibling/student_sibling.json
index b07b958..d620987 100644
--- a/erpnext/schools/doctype/student_sibling/student_sibling.json
+++ b/erpnext/schools/doctype/student_sibling/student_sibling.json
@@ -14,15 +14,15 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "name1", 
+   "columns": 4, 
+   "fieldname": "full_name", 
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Name", 
+   "label": "Full Name", 
    "length": 0, 
    "no_copy": 0, 
    "options": "", 
@@ -101,7 +101,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-09-01 14:43:53.473391", 
+ "modified": "2016-09-13 12:39:05.078062", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Student Sibling", 
diff --git a/erpnext/templates/generators/item.html b/erpnext/templates/generators/item.html
index cf6f89b..5a8116c 100644
--- a/erpnext/templates/generators/item.html
+++ b/erpnext/templates/generators/item.html
@@ -88,7 +88,7 @@
 				<table class="table borderless" style="width: 100%">
 				{% for d in website_specifications -%}
 					<tr>
-						<td class="product-label text-muted" style="width: 30%;">{{ d.label }}</td>
+						<td class="uppercase text-muted" style="width: 30%;">{{ d.label }}</td>
 						<td>{{ d.description }}</td>
 					</tr>
 				{%- endfor %}