From 9292ac773ee3b15ef70c370c844505d5e5a3b51e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 25 Aug 2011 16:21:58 +0530 Subject: [PATCH] Email will be sent on submit --- hr/doctype/salary_manager/salary_manager.py | 16 ++- hr/doctype/salary_slip/salary_slip.py | 112 ++++++++++---------- 2 files changed, 67 insertions(+), 61 deletions(-) diff --git a/hr/doctype/salary_manager/salary_manager.py b/hr/doctype/salary_manager/salary_manager.py index ec8fba271a..50710568e8 100644 --- a/hr/doctype/salary_manager/salary_manager.py +++ b/hr/doctype/salary_manager/salary_manager.py @@ -68,9 +68,9 @@ class DocType: emp_list = self.get_emp_list() log = "" if emp_list: - log = "" + log = "
Following Salary Slip has been created:
SAL SLIP IDEMPLOYEE NAME
" else: - log = "
Following Salary Slip has been created:
SAL SLIP IDEMPLOYEE NAME
" + log = "
No employee found for the above selected criteria
" for emp in emp_list: if not sql("""select name from `tabSalary Slip` @@ -119,9 +119,17 @@ class DocType: ss_list = self.get_sal_slip_list() log = "" if ss_list: - log = "
No employee found for the above selected criteria
" + log = """
Following Salary Slip has been submitted:
SAL SLIP IDEMPLOYEE NAME
+ + + + + + + + """ else: - log = "
Following Salary Slip has been submitted:
SAL SLIP IDEMPLOYEE NAME
" + log = "
No salary slip found to submit for the above selected criteria
" for ss in ss_list: ss_obj = get_obj("Salary Slip",ss[0],with_children=1) diff --git a/hr/doctype/salary_slip/salary_slip.py b/hr/doctype/salary_slip/salary_slip.py index 0cdc898673..6a1705054e 100644 --- a/hr/doctype/salary_slip/salary_slip.py +++ b/hr/doctype/salary_slip/salary_slip.py @@ -175,9 +175,9 @@ class DocType(TransactionBase): emailid_ret=sql("select company_email from `tabEmployee` where name = '%s'"%self.doc.employee) if emailid_ret: receiver = cstr(emailid_ret[0][0]) - subj = 'Salary Slip ' + cstr(self.doc.month) +' '+cstr(self.doc.year) - earn_ret=sql("select e_type,e_amount from `tabSS Earning Detail` where parent = '%s'"%self.doc.name) - ded_ret=sql("select d_type,d_amount from `tabSS Deduction Detail` where parent = '%s'"%self.doc.name) + subj = 'Salary Slip - ' + cstr(self.doc.month) +'/'+cstr(self.doc.fiscal_year) + earn_ret=sql("select e_type,e_modified_amount from `tabSS Earning Detail` where parent = '%s'"%self.doc.name) + ded_ret=sql("select d_type,d_modified_amount from `tabSS Deduction Detail` where parent = '%s'"%self.doc.name) earn_table = '' ded_table = '' @@ -207,62 +207,60 @@ class DocType(TransactionBase): if not letter_head: letter_head = '' - msg = ''' %s
+ msg = '''
%s
+
No salary slip found to submit for the above selected criteria
+ + + + + + + + + + + +

Salary Slip

Employee Code : %sEmployee Name : %s
Month : %sFiscal Year : %s
- - - - - - - - - - - - - - - - + + + + + + + + + - - - - - + + + + - - - - - - - - - - - - -

- - - - - - - - -
- - - - - - - - -

Salary Slip

Employee Code : %sEmployee Name : %s
Month : %sYear : %sFiscal Year : %s
Department : %sBranch : %sDesignation : %s
Department : %sBranch : %sDesignation : %s
Grade : %sBank Account No. : %sBank Name : %s
Grade : %sBank Account No. : %sBank Name : %s
Arrear Amount : %sPayment days : %s
PF No. : %sESIC No. : %sArrear Amount : %s
Total days in month : %sLeave Without Pay : %sPayment days : %s
EarningDeduction
%s%s
Gross Pay : %sTotal Deduction : %s
Net Pay : %sNet Pay (in words) : %s
'''%(cstr(letter_head[0][0]),cstr(self.doc.employee),self.doc.employee_name,cstr(self.doc.month),cstr(self.doc.year),cstr(self.doc.fiscal_year),self.doc.department,self.doc.branch,self.doc.designation,self.doc.grade,cstr(self.doc.bank_account_no),self.doc.bank_name,cstr(self.doc.pf_no),cstr(self.doc.esic_no),cstr(self.doc.arrear_amount),cstr(self.doc.total_days_in_month),cstr(self.doc.leave_without_pay),cstr(self.doc.payment_days),earn_table,ded_table,cstr(self.doc.gross_pay),cstr(self.doc.total_deduction),cstr(self.doc.net_pay),cstr(self.doc.net_pay_in_words)) - sendmail([receiver], sender='automail@webnotestech.com', subject=subj, parts=[['text/plain', msg]]) + + + + + + + + + + + +
EarningDeduction
%s%s
+ + + + + + + + + + + +
Gross Pay : %sTotal Deduction : %s
Net Pay : %s
Net Pay(in words) : %s
'''%(cstr(letter_head[0][0]),cstr(self.doc.employee), cstr(self.doc.employee_name), cstr(self.doc.month), cstr(self.doc.fiscal_year), cstr(self.doc.department), cstr(self.doc.branch), cstr(self.doc.designation), cstr(self.doc.grade), cstr(self.doc.bank_account_no), cstr(self.doc.bank_name), cstr(self.doc.arrear_amount), cstr(self.doc.payment_days), earn_table, ded_table, cstr(self.doc.gross_pay), cstr(self.doc.total_deduction), cstr(self.doc.net_pay), cstr(self.doc.total_in_words)) + sendmail([receiver], sender='automail@erpnext.com', subject=subj, parts=[['text/plain', msg]]) else: msgprint("Company Email ID not found.")