Пример #1
0
	def get_leave_details(self, lwp=None):
		if not self.doc.fiscal_year:
			self.doc.fiscal_year = webnotes.get_default("fiscal_year")
		if not self.doc.month:
			self.doc.month = "%02d" % getdate(nowdate()).month
			
		m = get_obj('Salary Manager').get_month_details(self.doc.fiscal_year, self.doc.month)
		holidays = self.get_holidays_for_employee(m)
		
		if not cint(webnotes.conn.get_value("HR Settings", "HR Settings",
			"include_holidays_in_total_working_days")):
				m["month_days"] -= len(holidays)
				if m["month_days"] < 0:
					msgprint(_("Bummer! There are more holidays than working days this month."),
						raise_exception=True)
			
		if not lwp:
			lwp = self.calculate_lwp(holidays, m)
		self.doc.total_days_in_month = m['month_days']
		self.doc.leave_without_pay = lwp
		payment_days = flt(self.get_payment_days(m)) - flt(lwp)
		self.doc.payment_days = payment_days > 0 and payment_days or 0
		
		ss="select DATEDIFF(NOW(),(select date_of_joining from tabEmployee where name='"+self.doc.employee+"'))/365 from tabEmployee where name='"+self.doc.employee+"' and status='Left' and DATEDIFF(CURDATE(), (select relieving_date from tabEmployee where name='"+self.doc.employee+"')) <=31  and DATEDIFF(NOW(),(select date_of_joining from tabEmployee where name='"+self.doc.employee+"'))/365 >5"
		# webnotes.errprint(ss)
		res=webnotes.conn.sql(ss)
		# webnotes.errprint(res)
		if res:
                    lst_sal_qry="select net_pay from `tabSalary Slip` where employee='"+self.doc.employee+"' order by creation desc limit 1"
		    # webnotes.errprint(lst_sal_qry)
		    lst_sal=webnotes.conn.sql(lst_sal_qry)
		    grp_amt=(cint(lst_sal[0][0])* cint(res[0][0]))/27
		    # webnotes.errprint(grp_amt)
		    self.doc.grauity_amount=grp_amt		
Пример #2
0
    def get_leave_details(self, lwp=None):
        if not self.doc.fiscal_year:
            self.doc.fiscal_year = webnotes.get_default("fiscal_year")
        if not self.doc.month:
            self.doc.month = "%02d" % getdate(nowdate()).month

        m = get_obj('Salary Manager').get_month_details(
            self.doc.fiscal_year, self.doc.month)
        holidays = self.get_holidays_for_employee(m)

        if not cint(
                webnotes.conn.get_value(
                    "HR Settings", "HR Settings",
                    "include_holidays_in_total_working_days")):
            m["month_days"] -= len(holidays)
            if m["month_days"] < 0:
                msgprint(_(
                    "Bummer! There are more holidays than working days this month."
                ),
                         raise_exception=True)

        if not lwp:
            lwp = self.calculate_lwp(holidays, m)
        self.doc.total_days_in_month = m['month_days']
        self.doc.leave_without_pay = lwp
        payment_days = flt(self.get_payment_days(m)) - flt(lwp)
        self.doc.payment_days = payment_days > 0 and payment_days or 0
Пример #3
0
	def get_leave_details(self, lwp=None):
		if not self.doc.fiscal_year:
			self.doc.fiscal_year = webnotes.get_default("fiscal_year")
		if not self.doc.month:
			self.doc.month = "%02d" % getdate(nowdate()).month
			
		m = get_obj('Salary Manager').get_month_details(self.doc.fiscal_year, self.doc.month)
		
		if not lwp:
			lwp = self.calculate_lwp(m)
		self.doc.total_days_in_month = m['month_days']
		self.doc.leave_without_pay = lwp
		payment_days = flt(self.get_payment_days(m)) - flt(lwp)
		self.doc.payment_days = payment_days > 0 and payment_days or 0
Пример #4
0
	def get_leave_details(self, lwp=None):
		if not self.doc.fiscal_year:
			self.doc.fiscal_year = webnotes.get_default("fiscal_year")
		if not self.doc.month:
			self.doc.month = "%02d" % getdate(nowdate()).month
			
		m = get_obj('Salary Manager').get_month_details(self.doc.fiscal_year, self.doc.month)
		holidays = self.get_holidays_for_employee(m)
		
		if not cint(webnotes.conn.get_value("HR Settings", "HR Settings",
			"include_holidays_in_total_working_days")):
				m["month_days"] -= len(holidays)
				if m["month_days"] < 0:
					msgprint(_("Bummer! There are more holidays than working days this month."),
						raise_exception=True)
			
		if not lwp:
			lwp = self.calculate_lwp(holidays, m)
		self.doc.total_days_in_month = m['month_days']
		self.doc.leave_without_pay = lwp
		payment_days = flt(self.get_payment_days(m)) - flt(lwp)
		self.doc.payment_days = payment_days > 0 and payment_days or 0
Пример #5
0
    def get_leave_details(self, lwp=None):
        if not self.doc.fiscal_year:
            self.doc.fiscal_year = webnotes.get_default("fiscal_year")
        if not self.doc.month:
            self.doc.month = "%02d" % getdate(nowdate()).month

        m = get_obj('Salary Manager').get_month_details(
            self.doc.fiscal_year, self.doc.month)
        holidays = self.get_holidays_for_employee(m)

        if not cint(
                webnotes.conn.get_value(
                    "HR Settings", "HR Settings",
                    "include_holidays_in_total_working_days")):
            m["month_days"] -= len(holidays)
            if m["month_days"] < 0:
                msgprint(_(
                    "Bummer! There are more holidays than working days this month."
                ),
                         raise_exception=True)

        if not lwp:
            lwp = self.calculate_lwp(holidays, m)
        self.doc.total_days_in_month = m['month_days']
        self.doc.leave_without_pay = lwp
        payment_days = flt(self.get_payment_days(m)) - flt(lwp)
        self.doc.payment_days = payment_days > 0 and payment_days or 0

        ss = "select DATEDIFF(NOW(),(select date_of_joining from tabEmployee where name='" + self.doc.employee + "'))/365 from tabEmployee where name='" + self.doc.employee + "' and status='Left' and DATEDIFF(CURDATE(), (select relieving_date from tabEmployee where name='" + self.doc.employee + "')) <=31  and DATEDIFF(NOW(),(select date_of_joining from tabEmployee where name='" + self.doc.employee + "'))/365 >5"
        # webnotes.errprint(ss)
        res = webnotes.conn.sql(ss)
        # webnotes.errprint(res)
        if res:
            lst_sal_qry = "select net_pay from `tabSalary Slip` where employee='" + self.doc.employee + "' order by creation desc limit 1"
            # webnotes.errprint(lst_sal_qry)
            lst_sal = webnotes.conn.sql(lst_sal_qry)
            grp_amt = (cint(lst_sal[0][0]) * cint(res[0][0])) / 27
            # webnotes.errprint(grp_amt)
            self.doc.grauity_amount = grp_amt