mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 20:59:11 +00:00
moved directory structure
This commit is contained in:
1
accounts/search_criteria/general_ledger/__init__.py
Normal file
1
accounts/search_criteria/general_ledger/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
||||
39
accounts/search_criteria/general_ledger/general_ledger.js
Normal file
39
accounts/search_criteria/general_ledger/general_ledger.js
Normal file
@@ -0,0 +1,39 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
this.mytabs.tabs['Select Columns'].hide();
|
||||
//to hide all filters
|
||||
this.hide_all_filters();
|
||||
field_list=['Voucher Type', 'Voucher No', 'From Posting Date','To Posting Date','Account','Company', 'Remarks', 'Is Cancelled', 'Is Opening']
|
||||
for(var i=0;i<field_list.length;i++){
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +field_list[i]].df.filter_hide = 0;
|
||||
}
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
|
||||
}
|
||||
|
||||
|
||||
report.aftertableprint = function(t) {
|
||||
$yt(t,'*',2,{whiteSpace:'pre'});
|
||||
$yt(t,'*',3,{whiteSpace:'pre'});
|
||||
}
|
||||
148
accounts/search_criteria/general_ledger/general_ledger.py
Normal file
148
accounts/search_criteria/general_ledger/general_ledger.py
Normal file
@@ -0,0 +1,148 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#get company letter head
|
||||
#---------------------------------------------------------------------
|
||||
from __future__ import unicode_literals
|
||||
l_head = sql("select content from `tabLetter Head` where ifnull(is_default, 0) = 1 and ifnull(disabled, 0) = 0")
|
||||
l_head = l_head and l_head[0][0] or ''
|
||||
|
||||
|
||||
# Posting date, fiscal year and year start date
|
||||
#---------------------------------------------------------------------
|
||||
if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
|
||||
msgprint("Please enter From Date and To Date")
|
||||
raise Exception
|
||||
else:
|
||||
from_date = filter_values['posting_date']
|
||||
to_date = filter_values['posting_date1']
|
||||
|
||||
from_date_year = sql("select name from `tabFiscal Year` where %s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day)",from_date)
|
||||
if not from_date_year:
|
||||
msgprint("From Date is out of range. Please check.", raise_exception=1)
|
||||
else:
|
||||
from_date_year = from_date_year[0][0]
|
||||
#to_date_year = sql("select name from `tabFiscal Year` where %s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day)",to_date)[0][0]
|
||||
|
||||
|
||||
# define columns
|
||||
#---------------------------------------------------------------------
|
||||
col = []
|
||||
col.append(['Date','Date','80px',''])
|
||||
col.append(['Detail','Text','475px',''])
|
||||
col.append(['Debit','Currency','75px',''])
|
||||
col.append(['Credit','Currency','75px',''])
|
||||
|
||||
for c in col:
|
||||
colnames.append(c[0])
|
||||
coltypes.append(c[1])
|
||||
colwidths.append(c[2])
|
||||
coloptions.append(c[3])
|
||||
col_idx[c[0]] = len(colnames)
|
||||
|
||||
|
||||
#total query
|
||||
#---------------------------------------------------------------------
|
||||
total_debit, total_credit, total_opening, total_diff = 0,0,0,0
|
||||
q = query.split('WHERE')[1].split('LIMIT')
|
||||
if len(q) > 2:
|
||||
query_where_clause = 'LIMIT'.join(q[:-1])
|
||||
else:
|
||||
query_where_clause = q[0]
|
||||
|
||||
tot = sql('select sum(debit),sum(credit) from `tabGL Entry` where %s' % query_where_clause)
|
||||
|
||||
for t in tot:
|
||||
total_debit += t and flt(t[0]) or 0
|
||||
total_credit += t and flt(t[1]) or 0
|
||||
|
||||
total_diff = total_debit - total_credit
|
||||
|
||||
out = []
|
||||
|
||||
|
||||
# If account mentioned, show opening and closing
|
||||
#---------------------------------------------------------------------
|
||||
account = filter_values.get('account')
|
||||
|
||||
if account and (total_debit != 0 or total_credit != 0):
|
||||
acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % account)
|
||||
|
||||
opening_bal = get_obj('GL Control').get_as_on_balance(account, from_date_year, add_days(from_date, -1), acc_det[0][0], acc_det[0][2], acc_det[0][3])[2]
|
||||
closing_bal = get_obj('GL Control').get_as_on_balance(account, from_date_year, to_date, acc_det[0][0], acc_det[0][2], acc_det[0][3])[2]
|
||||
|
||||
if acc_det[0][0] == 'Credit':
|
||||
closing_bal = -1*closing_bal
|
||||
opening_bal = -1*opening_bal
|
||||
|
||||
# add opening row
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[1] = 'Opening as on '+formatdate(from_date)
|
||||
t_row[col_idx['Debit']-1] = opening_bal
|
||||
out.append(t_row)
|
||||
|
||||
|
||||
# table output
|
||||
#---------------------------------------------------------------------
|
||||
count = 0
|
||||
for r in res:
|
||||
count +=1
|
||||
det = r[1].split('~~~')
|
||||
if from_export == 1:
|
||||
a = "Account: " + det[0] + NEWLINE + det[1] + NEWLINE + "Against: " + det[2] + NEWLINE + "Voucher No: " + det[4]
|
||||
else:
|
||||
a = "Account: <b>" + det[0]+ "</b>" + NEWLINE + "<div class='comment'>" +det[1]+ "</div><div class = 'comment' style='padding-left:12px'>Against: <b>" + det[2] + "</b></div><div class = 'comment' style='padding-left:12px'>Voucher No: <span class='link_type' onclick='loaddoc(" + '"' + det[3] +'", ' + '"' + det[4] +'"' + ")'>" + det[4] + "</span></div>"
|
||||
r[1] = a
|
||||
out.append(r)
|
||||
|
||||
|
||||
# Total, Difference and closing balance
|
||||
#---------------------------------------------------------------------
|
||||
if total_debit != 0 or total_credit != 0:
|
||||
# Total debit/credit
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[1] = 'Total'
|
||||
t_row[col_idx['Debit']-1] = total_debit
|
||||
t_row[col_idx['Credit']-1] = total_credit
|
||||
out.append(t_row)
|
||||
|
||||
# diffrence (dr-cr)
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[1] = 'Total(Dr-Cr)'
|
||||
t_row[col_idx['Debit']-1] = total_diff
|
||||
out.append(t_row)
|
||||
|
||||
# closing
|
||||
if account:
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[1] = 'Closing Balance on ' + formatdate(to_date)
|
||||
t_row[col_idx['Debit']-1] = flt(closing_bal)
|
||||
out.append(t_row)
|
||||
|
||||
|
||||
# Print Format
|
||||
#---------------------------------------------------------------------
|
||||
myheader = """<table width = '100%%'><tr><td>"""+l_head+"""</td>
|
||||
</tr>
|
||||
<tr> <td>
|
||||
<div><h3> %(acc)s </h3></div>
|
||||
<div>Ledger Between %(fdt)s and %(tdt)s </div></td></tr></table><br>
|
||||
|
||||
""" % {'acc':account,
|
||||
'fdt':from_date,
|
||||
'tdt':to_date}
|
||||
|
||||
page_template = myheader+"<div>%(table)s</div>"
|
||||
13
accounts/search_criteria/general_ledger/general_ledger.sql
Normal file
13
accounts/search_criteria/general_ledger/general_ledger.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
SELECT `tabGL Entry`.`posting_date`, CONCAT(`tabGL Entry`.`account`, "~~~", ifnull(`tabGL Entry`.`remarks`, ''), "~~~", ifnull(`tabGL Entry`.`against`,''), "~~~", ifnull(`tabGL Entry`.`voucher_type`, ''), "~~~", ifnull(`tabGL Entry`.`voucher_no`, '')), sum(`tabGL Entry`.`debit`), sum(`tabGL Entry`.`credit`)
|
||||
FROM `tabGL Entry`
|
||||
WHERE `tabGL Entry`.`is_cancelled` LIKE '%(is_cancelled)s%%'
|
||||
AND `tabGL Entry`.`posting_date`>='%(posting_date)s'
|
||||
AND `tabGL Entry`.`posting_date`<='%(posting_date1)s'
|
||||
AND `tabGL Entry`.`company` LIKE '%(company)s%%'
|
||||
AND `tabGL Entry`.`account` LIKE '%(account)s%%'
|
||||
AND `tabGL Entry`.`remarks` LIKE '%(remarks)s%%'
|
||||
AND `tabGL Entry`.`is_opening` LIKE '%(is_opening)s%%'
|
||||
AND `tabGL Entry`.`voucher_no` LIKE '%(voucher_no)s%%'
|
||||
AND `tabGL Entry`.`voucher_type` LIKE '%(voucher_type)s%%'
|
||||
GROUP BY `tabGL Entry`.`voucher_no`,`tabGL Entry`.`account`
|
||||
ORDER BY `tabGL Entry`.`posting_date` DESC
|
||||
32
accounts/search_criteria/general_ledger/general_ledger.txt
Normal file
32
accounts/search_criteria/general_ledger/general_ledger.txt
Normal file
@@ -0,0 +1,32 @@
|
||||
# Search Criteria, general_ledger
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-04-03 12:49:51',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-04-03 12:49:51',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Search Criteria
|
||||
{
|
||||
'criteria_name': u'General Ledger',
|
||||
'doc_type': u'GL Entry',
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': u"{'GL Entry\x01From Posting Date\x01lower':'','GL Entry\x01To Posting Date\x01upper':'','GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'No','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':'','GL Entry\x01Company':''}",
|
||||
'module': u'Accounts',
|
||||
'name': '__common__',
|
||||
'page_len': 50,
|
||||
'sort_by': u'`tabGL Entry`.`name`',
|
||||
'sort_order': u'DESC',
|
||||
'standard': u'Yes'
|
||||
},
|
||||
|
||||
# Search Criteria, general_ledger
|
||||
{
|
||||
'doctype': 'Search Criteria',
|
||||
'name': u'general_ledger'
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user