Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Rushabh Mehta 2011-08-25 19:18:55 +05:30
commit 0c9b1d4887
4 changed files with 74 additions and 66 deletions

View File

@ -68,9 +68,9 @@ class DocType:
emp_list = self.get_emp_list()
log = ""
if emp_list:
log = "<table><tr><td>Following Salary Slip has been created: </td></tr><tr><td><u>SAL SLIP ID</u></td><td><u>EMPLOYEE NAME</u></td></tr>"
log = "<table><tr><td colspan = 2>Following Salary Slip has been created: </td></tr><tr><td><u>SAL SLIP ID</u></td><td><u>EMPLOYEE NAME</u></td></tr>"
else:
log = "<table><tr><td>No employee found for the above selected criteria</td></tr>"
log = "<table><tr><td colspan = 2>No employee found for the above selected criteria</td></tr>"
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 = "<table><tr><td>Following Salary Slip has been submitted: </td></tr><tr><td><u>SAL SLIP ID</u></td><td><u>EMPLOYEE NAME</u></td></tr>"
log = """<table>
<tr>
<td colspan = 2>Following Salary Slip has been submitted: </td>
</tr>
<tr>
<td><u>SAL SLIP ID</u></td>
<td><u>EMPLOYEE NAME</u></td>
</tr>
"""
else:
log = "<table><tr><td>No salary slip found to submit for the above selected criteria</td></tr>"
log = "<table><tr><td colspan = 2>No salary slip found to submit for the above selected criteria</td></tr>"
for ss in ss_list:
ss_obj = get_obj("Salary Slip",ss[0],with_children=1)

View File

@ -57,7 +57,7 @@ class TestSalarySlip(unittest.TestCase):
self.assertTrue(ss[0][0]==67)
def test_submit(self):
self.sm.submit_sal_slip()
self.sm.submit_salary_slip()
ss = webnotes.conn.sql("""
select docstatus
from `tabSalary Slip`
@ -112,7 +112,8 @@ emp1 = Document(fielddata={
'grade':'grade1',
'naming_series':'EMP/',
'status':'Active',
'docstatus':0
'docstatus':0,
'employee_name':'emp1'
})
emp2 = Document(fielddata={
@ -135,7 +136,8 @@ ss1 = [
'employee':'emp1',
'is_active':'Yes',
'department': 'dep1',
'designation' : 'des1'
'designation' : 'des1',
'employee_name': 'emp1'
}),
Document(fielddata={
'parenttype':'Salary Structure',

View File

@ -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 <br>
msg = '''<div> %s <br>
<table cellspacing= "5" cellpadding="5" width = "100%%">
<tr>
<td colspan = 4 width = "100%%"><h4>Salary Slip</h4></td>
</tr>
<tr>
<td colspan = 2 width = "50%%"><b>Employee Code : %s</b></td>
<td colspan = 2 width = "50%%"><b>Employee Name : %s</b></td>
</tr>
<tr>
<td colspan = 2 width = "50%%">Month : %s</td>
<td colspan = 2 width = "50%%">Fiscal Year : %s</td>
</tr>
</table>
<table cellspacing= "5" cellpadding="5" >
<tr>
<td colspan = 4><h4>Salary Slip</h4></td>
</tr>
<tr>
<td colspan = 2><b>Employee Code : %s</b></td>
<td colspan = 2><b>Employee Name : %s</b></td>
</tr>
<tr>
<td>Month : %s</td>
<td>Year : %s</td>
<td colspan = 2>Fiscal Year : %s</td>
</tr>
<tr>
<td>Department : %s</td>
<td>Branch : %s</td>
<td colspan = 2>Designation : %s</td>
<tr>
<td>Department : %s</td>
<td>Branch : %s</td>
<td colspan = 2>Designation : %s</td>
</tr>
<tr>
<td>Grade : %s</td>
<td>Bank Account No. : %s</td>
<td colspan = 2>Bank Name : %s</td>
</tr>
<tr>
<td>Grade : %s</td>
<td>Bank Account No. : %s</td>
<td colspan = 2>Bank Name : %s</td>
</tr>
<tr>
<td colspan = 2>Arrear Amount : <b>%s</b></td>
<td colspan = 2>Payment days : %s</td>
</tr>
<tr>
<td>PF No. : %s</td>
<td>ESIC No. : %s</td>
<td colspan = 2>Arrear Amount : <b>%s</b></td>
</tr>
<tr>
<td>Total days in month : %s</td>
<td>Leave Without Pay : %s</td>
<td colspan = 2>Payment days : %s</td>
</tr>
<br><br>
<tr>
<td colspan = 2><b>Earning</b></td>
<td colspan = 2><b>Deduction</b></td>
</tr>
<tr>
<td colspan = 2>%s</td>
<td colspan = 2>%s</td>
</tr>
<br>
<tr>
<td colspan = 2><b>Gross Pay :</b> %s</td>
<td colspan = 2><b>Total Deduction :</b> %s</td>
</tr>
<tr>
<td><b>Net Pay : %s</b></td>
<td colspan = 3><b>Net Pay (in words) : %s</b></td>
</tr>
</table>'''%(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]])
</tr>
</table>
<table border="1px solid #CCC" width="100%%" cellpadding="0" cellspacing= "0" >
<tr>
<td colspan = 2 width = "50%%"><b>Earning</b></td>
<td colspan = 2 width = "50%%"><b>Deduction</b></td>
</tr>
<tr>
<td colspan = 2 width = "50%%">%s</td>
<td colspan = 2 width = "50%%">%s</td>
</tr>
</table>
<table cellspacing= "5" cellpadding="5">
<tr>
<td colspan = 2><b>Gross Pay :</b> %s</td>
<td colspan = 2><b>Total Deduction :</b> %s</td>
</tr>
<tr>
<td><b>Net Pay : %s</b></td>
</tr>
<tr>
<td><b>Net Pay(in words) : %s</b></td>
</tr>
</table></div>'''%(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.")

View File

@ -1,7 +1,7 @@
# REMEMBER to update this
# ========================
last_patch = 344
last_patch = 346
#-------------------------------------------
def execute(patch_no):
@ -257,4 +257,4 @@ def execute(patch_no):
delete_doc('DocType', 'Profile')
reload_doc('core', 'doctype', 'profile')