internal issues (#19496)

* fix: user remark mandatory in quick entry but not in form

* fix: preview salary slip btn showing in draft and unsaved states

* minor: removed unecessay comma

* fix: department analytics report showing departments of all companies
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js
index 11d847d..221e3a7 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.js
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js
@@ -570,7 +570,7 @@
 				},
 				{fieldtype: "Date", fieldname: "posting_date", label: __("Date"), reqd: 1,
 					default: frm.doc.posting_date},
-				{fieldtype: "Small Text", fieldname: "user_remark", label: __("User Remark"), reqd: 1},
+				{fieldtype: "Small Text", fieldname: "user_remark", label: __("User Remark")},
 				{fieldtype: "Select", fieldname: "naming_series", label: __("Series"), reqd: 1,
 					options: naming_series_options, default: naming_series_default},
 			]
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.js b/erpnext/hr/doctype/salary_structure/salary_structure.js
index d56320a..dd34ef2 100755
--- a/erpnext/hr/doctype/salary_structure/salary_structure.js
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.js
@@ -46,10 +46,12 @@
 		frm.trigger("toggle_fields");
 		frm.fields_dict['earnings'].grid.set_column_disp("default_amount", false);
 		frm.fields_dict['deductions'].grid.set_column_disp("default_amount", false);
-
-		frm.add_custom_button(__("Preview Salary Slip"), function() {
-			frm.trigger('preview_salary_slip');
-		});
+		
+		if(frm.doc.docstatus === 1) {
+			frm.add_custom_button(__("Preview Salary Slip"), function() {
+				frm.trigger('preview_salary_slip');
+			});
+		}
 
 		if(frm.doc.docstatus==1) {
 			frm.add_custom_button(__("Assign Salary Structure"), function() {
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.py b/erpnext/hr/doctype/salary_structure/salary_structure.py
index f7d712d..0e1a74f 100644
--- a/erpnext/hr/doctype/salary_structure/salary_structure.py
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.py
@@ -169,5 +169,10 @@
 @frappe.whitelist()
 def get_employees(salary_structure):
 	employees = frappe.get_list('Salary Structure Assignment',
-		filters={'salary_structure': salary_structure}, fields=['employee'])
+		filters={'salary_structure': salary_structure, 'docstatus': 1}, fields=['employee'])
+	
+	if not employees:
+		frappe.throw(_("There's no Employee with Salary Structure: {0}. \
+			Assign {1} to an Employee to preview Salary Slip").format(salary_structure, salary_structure))
+
 	return list(set([d.employee for d in employees]))
diff --git a/erpnext/hr/report/department_analytics/department_analytics.js b/erpnext/hr/report/department_analytics/department_analytics.js
index a0b6fc7..29fedcd 100644
--- a/erpnext/hr/report/department_analytics/department_analytics.js
+++ b/erpnext/hr/report/department_analytics/department_analytics.js
@@ -2,4 +2,14 @@
 // For license information, please see license.txt
 
 frappe.query_reports["Department Analytics"] = {
+	"filters": [
+		{
+			"fieldname":"company",
+			"label": __("Company"),
+			"fieldtype": "Link",
+			"options": "Company",
+			"default": frappe.defaults.get_user_default("Company"),
+			"reqd": 1
+		},
+	]
 };
\ No newline at end of file
diff --git a/erpnext/hr/report/department_analytics/department_analytics.py b/erpnext/hr/report/department_analytics/department_analytics.py
index c4a9030..b28eac4 100644
--- a/erpnext/hr/report/department_analytics/department_analytics.py
+++ b/erpnext/hr/report/department_analytics/department_analytics.py
@@ -7,6 +7,10 @@
 
 def execute(filters=None):
 	if not filters: filters = {}
+
+	if not filters["company"]:
+		frappe.throw(_('{0} is mandatory').format(_('Company')))
+
 	columns = get_columns()
 	employees = get_employees(filters)
 	departments_result = get_department(filters)
@@ -28,6 +32,9 @@
 	conditions = ""
 	if filters.get("department"): conditions += " and department = '%s'" % \
 		filters["department"].replace("'", "\\'")
+	
+	if filters.get("company"): conditions += " and company = '%s'" % \
+		filters["company"].replace("'", "\\'")
 	return conditions
 
 def get_employees(filters):
@@ -37,7 +44,7 @@
 	gender, company from `tabEmployee` where status = 'Active' %s""" % conditions, as_list=1)
 
 def get_department(filters):
-	return frappe.db.sql("""select name from `tabDepartment`""" , as_list=1)
+	return frappe.db.sql("""select name from `tabDepartment` where company = %s""", (filters["company"]), as_list=1)
 	
 def get_chart_data(departments,employees):
 	if not departments:
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.js b/erpnext/manufacturing/doctype/production_plan/production_plan.js
index 4b654b4..96bb0ae 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.js
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.js
@@ -233,7 +233,7 @@
 
 		if (item_wise_qty) {
 			for (var key in item_wise_qty) {
-				title += __('Item {0}: {1} qty produced, ', [key, item_wise_qty[key]]);
+				title += __('Item {0}: {1} qty produced. ', [key, item_wise_qty[key]]);
 			}
 		}