Rushabh Mehta | 3966f1d | 2012-02-23 12:35:32 +0530 | [diff] [blame] | 1 | # ERPNext - web based ERP (http://erpnext.com) |
| 2 | # Copyright (C) 2012 Web Notes Technologies Pvt Ltd |
| 3 | # |
| 4 | # This program is free software: you can redistribute it and/or modify |
| 5 | # it under the terms of the GNU General Public License as published by |
| 6 | # the Free Software Foundation, either version 3 of the License, or |
| 7 | # (at your option) any later version. |
| 8 | # |
| 9 | # This program is distributed in the hope that it will be useful, |
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | # GNU General Public License for more details. |
| 13 | # |
| 14 | # You should have received a copy of the GNU General Public License |
| 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | |
Anand Doshi | 486f9df | 2012-07-19 13:40:31 +0530 | [diff] [blame] | 17 | from __future__ import unicode_literals |
Anand Doshi | 962c2aa | 2012-02-02 15:22:11 +0530 | [diff] [blame] | 18 | import webnotes |
Anand Doshi | 110047e | 2012-02-10 10:48:35 +0530 | [diff] [blame] | 19 | from webnotes.utils import flt |
| 20 | from webnotes.model.code import get_obj |
Anand Doshi | 440c1eb | 2012-09-28 16:03:11 +0530 | [diff] [blame] | 21 | from accounts.utils import get_balance_on |
Anand Doshi | 962c2aa | 2012-02-02 15:22:11 +0530 | [diff] [blame] | 22 | |
Rushabh Mehta | f17ce7b | 2012-02-13 16:50:52 +0530 | [diff] [blame] | 23 | @webnotes.whitelist() |
Anand Doshi | 962c2aa | 2012-02-02 15:22:11 +0530 | [diff] [blame] | 24 | def get_default_bank_account(): |
| 25 | """ |
| 26 | Get default bank account for a company |
| 27 | """ |
| 28 | company = webnotes.form_dict.get('company') |
| 29 | if not company: return |
| 30 | res = webnotes.conn.sql("""\ |
| 31 | SELECT default_bank_account FROM `tabCompany` |
| 32 | WHERE name=%s AND docstatus<2""", company) |
| 33 | |
| 34 | if res: return res[0][0] |