'Get total loan principal, loan interest and salary amount from submitted salary slip based on selected criteria'

def get_total_salary_and_loan_amounts(self):

    cond = self.get_filter_condition()
    totals = frappe.db.sql((u'\n DCTB  DCTB  DCTB select    sum(principal_amount)    as    total_principal_amount,    sum(interest_amount)    as    total_interest_amount,    \n DCTB  DCTB  DCTB sum(total_loan_repayment)    as    total_loan_repayment,    sum(rounded_total)    as    rounded_total    from    `tabSalary    Slip`    t1\n DCTB  DCTB  DCTB where    t1.docstatus    =    1    and    start_date    >=    %s    and    end_date    <=    %s    %s\n DCTB  DCTB  DCTB ' % (u'%s', u'%s', cond)), (self.start_date, self.end_date), as_dict=True)
    return totals[0]
