# Path: jasper_erpnext_report/jasper_reports/compile_reports.py
# def jasper_compile(jrxml, destFileName):
# 	try:
# 		compiler = jr.ReportCompiler()
# 		compiler.compile(jrxml,destFileName)
# 	except Exception as e:
# 		import jasper_erpnext_report as jer
# 		if jer.pyjnius == False:
# 			frappe.throw(_("Please install pyjnius python module."))
# 			return
# 		frappe.throw(_("Error while compiling report %s, error is: %s." % (jrxml, e)))
# 
# Path: jasper_erpnext_report/utils/file.py
# def get_image_name(iname):
# def get_images_path(compiled_path):
# def get_jasper_path(for_all_sites = False):
# def write_StringIO_to_file(file_path, output):
# def write_file(content, file_path, modes="w+"):
# def check_extension(fname):
# def get_extension(fname):
# def remove_from_doc(dt, dn, field, where_field = "name"):
# def delete_from_doc(dt, dn, field, value, where_field):
# def delete_from_FileData(dt, dn, file_url):
# def remove_directory(path, ignore_errors=True):
# def remove_compiled_report(root_path):
# def get_file(path, modes="r", raise_not_found=False):
# def read_file(path, modes="r", raise_not_found=False):
# def get_html_reports_path(report_name, where="reports", hash=None, localsite=None):
# def get_html_reports_images_path(report_path, where="images"):


import frappe
import os
import StringIO
			import shutil
from frappe import _
from io import BytesIO
from jasper_erpnext_report.jasper_reports.compile_reports import jasper_compile
from jasper_erpnext_report.utils.file import check_extension, get_jasper_path, get_extension, JasperXmlReport,\
	write_file
from frappe.utils.file_manager import check_max_file_size, get_content_hash
from PIL import Image, ImageOps
					from .file import remove_directory
from __future__ import unicode_literals
__author__ = 'luissaguas'



class WriteFileJrxml(object):
	def __init__(self, dt, fname, content, parent):
		self.file_path = None
		self.dt = dt
		self.fname = fname
		self.content = content
		self.parent = parent
		self.dn = frappe.form_dict.docname
		self.autofilename = None

# Path: jasper_erpnext_report/jasper_reports/compile_reports.py
# def jasper_compile(jrxml, destFileName):
# 	try:
# 		compiler = jr.ReportCompiler()
# 		compiler.compile(jrxml,destFileName)
# 	except Exception as e:
# 		import jasper_erpnext_report as jer
# 		if jer.pyjnius == False:
# 			frappe.throw(_("Please install pyjnius python module."))
# 			return
# 		frappe.throw(_("Error while compiling report %s, error is: %s." % (jrxml, e)))
# 
# Path: jasper_erpnext_report/utils/file.py
# def get_image_name(iname):
# def get_images_path(compiled_path):
# def get_jasper_path(for_all_sites = False):
# def write_StringIO_to_file(file_path, output):
# def write_file(content, file_path, modes="w+"):
# def check_extension(fname):
# def get_extension(fname):
# def remove_from_doc(dt, dn, field, where_field = "name"):
# def delete_from_doc(dt, dn, field, value, where_field):
# def delete_from_FileData(dt, dn, file_url):
# def remove_directory(path, ignore_errors=True):
# def remove_compiled_report(root_path):
# def get_file(path, modes="r", raise_not_found=False):
# def read_file(path, modes="r", raise_not_found=False):
# def get_html_reports_path(report_name, where="reports", hash=None, localsite=None):
# def get_html_reports_images_path(report_path, where="images"):


# Path: jasper_erpnext_report/utils/jasper_file_jrxml.py
import frappe
import os
import StringIO
			import shutil
from frappe import _
from io import BytesIO
from jasper_erpnext_report.jasper_reports.compile_reports import jasper_compile
from jasper_erpnext_report.utils.file import check_extension, get_jasper_path, get_extension, JasperXmlReport,\
	write_file
from frappe.utils.file_manager import check_max_file_size, get_content_hash
from PIL import Image, ImageOps
					from .file import remove_directory

from __future__ import unicode_literals
__author__ = 'luissaguas'



class WriteFileJrxml(object):
	def __init__(self, dt, fname, content, parent):
		self.file_path = None
		self.dt = dt
		self.fname = fname
		self.content = content
		self.parent = parent
		self.dn = frappe.form_dict.docname
		self.autofilename = None

		self.ext = check_extension(self.fname)