예제 #1
0
	def get_comp(self):
		ret = {}
		type = []
		comp = []
		# ------ get period -----------
		ret['period'] = ['Annual','Half Yearly','Quarterly','Monthly']
		
		# ---- get companies ---------
		from accounts.page.accounts_browser.accounts_browser import get_companies
		ret['company'] = get_companies()

		#--- 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
예제 #2
0
	def get_comp(self):
		ret = {}
		type = []
		comp = []
		# ------ get period -----------
		ret['period'] = ['Annual','Half Yearly','Quarterly','Monthly']
		
		# ---- get companies ---------
		from accounts.page.accounts_browser.accounts_browser import get_companies
		ret['company'] = get_companies()

		#--- to get fiscal year and start_date of that fiscal year -----
		res = webnotes.conn.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 = webnotes.conn.sql("select MONTH(year_start_date) from `tabFiscal Year` where name = %s",(webnotes.defaults.get_global_default("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 ------------------------------------------
		self.roles = webnotes.user.get_roles()
		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
예제 #3
0
    def get_comp(self):
        ret = {}
        type = []
        comp = []
        # ------ get period -----------
        ret["period"] = ["Annual", "Half Yearly", "Quarterly", "Monthly"]

        # ---- get companies ---------
        from accounts.page.accounts_browser.accounts_browser import get_companies

        ret["company"] = get_companies()

        # --- to get fiscal year and start_date of that fiscal year -----
        res = webnotes.conn.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 = webnotes.conn.sql(
            "select MONTH(year_start_date) from `tabFiscal Year` where name = %s",
            (webnotes.defaults.get_global_default("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 ------------------------------------------
        self.roles = webnotes.user.get_roles()
        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