# Path: jasper_erpnext_report/utils/file.py
# def get_jasper_path(for_all_sites = False):
# 	if not for_all_sites:
# 		return 	get_site_path("jasper")
# 
# 	module_path = os.path.normpath(os.path.join(os.path.dirname(jasper_erpnext_report.__file__), "jasper"))
# 	return module_path
# 
# def get_file(path, modes="r", raise_not_found=False):
# 	if modes != "r":
# 		content = read_file(path, modes=modes, raise_not_found=raise_not_found)
# 	else:
# 		content = frappe.read_file(path, raise_not_found=raise_not_found)
# 
# 	return content
# 
# Path: jasper_erpnext_report/utils/jasper_file_jrxml.py
# def get_compiled_path(dir_path, dn):
# 	jrxml_path = get_jrxml_path(dir_path, dn)
# 	compiled_path = frappe.utils.get_path("compiled", base=jrxml_path)
# 	frappe.create_folder(compiled_path)
# 	return compiled_path


from frappe import _
from frappe.utils import cint
from jasper_erpnext_report.utils.file import get_jasper_path, get_file
from jasper_erpnext_report.utils.jasper_file_jrxml import get_compiled_path
		from jasper_erpnext_report.core.FrappeTask import FrappeTask
				from jasper_erpnext_report.utils.utils import get_hook_module
			from jasper_erpnext_report.jasper_reports.FrappeDataSource import _JasperCustomDataSource
			from jasper_erpnext_report.jasper_reports.ScriptletDefault import _JasperCustomScriptlet
			from jasper_erpnext_report.utils.utils import get_hook_module
				from jasper_erpnext_report.jasper_reports.ScriptletDefault import _JasperCustomScriptlet
import frappe
import jasper_erpnext_report.utils.utils as utils
import jasper_erpnext_report.jasper_reports as jr
import JasperBase as Jb
import os
			frappe.throw(_("Error in report %s, error is: %s." % (doc.jasper_report_name, frappe.get_traceback())))

	def _run_report_async(self, path, doc, data=None, params=None, pformat="pdf", ncopies=1, for_all_sites=0):

		data = data or {}
		hashmap = jr.HashMap()
		pram, pram_server, copies = self.do_params(data, params, pformat, doc)
		pram_copy_index = copies.get("pram_copy_index", -1)
		pram_copy_page_index = copies.get("pram_copy_page_index", -1)

		path_join = os.path.join
		resp = []
		custom = doc.get("jasper_custom_fields")

		pram.extend(self.get_param_hook(doc, data, pram_server))

		self.populate_hashmap(pram, hashmap, doc.jasper_report_name)

		copies = [_("Original"), _("Duplicate"), _("Triplicate")]
		conn = ""
		if doc.query:
			conn = "jdbc:mysql://" + (frappe.conf.db_host or '127.0.0.1') + ":" + (frappe.conf.db_port or "3306") + "/" + frappe.conf.db_name + "?user="+ frappe.conf.db_name +\
				"&password=" + frappe.conf.db_password

		if not frappe.local.batch:
			batch = frappe._dict({})

			batch.batchReport = jr.BatchReport()

			batch.reportName = self.getFileName(path)

# Path: jasper_erpnext_report/utils/file.py
# def get_jasper_path(for_all_sites = False):
# 	if not for_all_sites:
# 		return 	get_site_path("jasper")
# 
# 	module_path = os.path.normpath(os.path.join(os.path.dirname(jasper_erpnext_report.__file__), "jasper"))
# 	return module_path
# 
# def get_file(path, modes="r", raise_not_found=False):
# 	if modes != "r":
# 		content = read_file(path, modes=modes, raise_not_found=raise_not_found)
# 	else:
# 		content = frappe.read_file(path, raise_not_found=raise_not_found)
# 
# 	return content
# 
# Path: jasper_erpnext_report/utils/jasper_file_jrxml.py
# def get_compiled_path(dir_path, dn):
# 	jrxml_path = get_jrxml_path(dir_path, dn)
# 	compiled_path = frappe.utils.get_path("compiled", base=jrxml_path)
# 	frappe.create_folder(compiled_path)
# 	return compiled_path


# Path: jasper_erpnext_report/core/JasperLocal.py
from frappe import _
from frappe.utils import cint
from jasper_erpnext_report.utils.file import get_jasper_path, get_file
from jasper_erpnext_report.utils.jasper_file_jrxml import get_compiled_path
		from jasper_erpnext_report.core.FrappeTask import FrappeTask
				from jasper_erpnext_report.utils.utils import get_hook_module
			from jasper_erpnext_report.jasper_reports.FrappeDataSource import _JasperCustomDataSource
			from jasper_erpnext_report.jasper_reports.ScriptletDefault import _JasperCustomScriptlet
			from jasper_erpnext_report.utils.utils import get_hook_module
				from jasper_erpnext_report.jasper_reports.ScriptletDefault import _JasperCustomScriptlet
import frappe
import jasper_erpnext_report.utils.utils as utils
import jasper_erpnext_report.jasper_reports as jr
import JasperBase as Jb
import os

			frappe.throw(_("Error in report %s, error is: %s." % (doc.jasper_report_name, frappe.get_traceback())))

	def _run_report_async(self, path, doc, data=None, params=None, pformat="pdf", ncopies=1, for_all_sites=0):

		data = data or {}
		hashmap = jr.HashMap()
		pram, pram_server, copies = self.do_params(data, params, pformat, doc)
		pram_copy_index = copies.get("pram_copy_index", -1)
		pram_copy_page_index = copies.get("pram_copy_page_index", -1)

		path_join = os.path.join
		resp = []
		custom = doc.get("jasper_custom_fields")

		pram.extend(self.get_param_hook(doc, data, pram_server))

		self.populate_hashmap(pram, hashmap, doc.jasper_report_name)

		copies = [_("Original"), _("Duplicate"), _("Triplicate")]
		conn = ""
		if doc.query:
			conn = "jdbc:mysql://" + (frappe.conf.db_host or '127.0.0.1') + ":" + (frappe.conf.db_port or "3306") + "/" + frappe.conf.db_name + "?user="+ frappe.conf.db_name +\
				"&password=" + frappe.conf.db_password

		if not frappe.local.batch:
			batch = frappe._dict({})

			batch.batchReport = jr.BatchReport()

			batch.reportName = self.getFileName(path)

			batch.jasper_path = get_jasper_path(for_all_sites)