Added new report: voucher wise tax details

This commit is contained in:
Nabin Hait 2011-09-12 13:24:08 +05:30
parent c94ba8a4c0
commit ad61f81f85
4 changed files with 103 additions and 0 deletions

View File

@ -0,0 +1,47 @@
report.customize_filters = function() {
this.hide_all_filters();
//Add filter
this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice', report_default:'Sales Invoice', ignore : 1,parent:'RV Tax Detail', single_select :1, in_first_page:1});
this.add_filter({fieldname:'posting_date', label:'Date', fieldtype:'Date', options:'', ignore : 1,parent:'RV Tax Detail', in_first_page:1});
this.add_filter({fieldname:'voucher_id', label:'Voucher Id', fieldtype:'Data', options:'', ignore : 1,parent:'RV Tax Detail', in_first_page:1});
this.add_filter({fieldname:'tax_account', label:'Tax Account', fieldtype:'Link', options:'Account', ignore : 1,parent:'RV Tax Detail', in_first_page:1});
}
// hide sections
//--------------------------------------
this.mytabs.items['More Filters'].hide();
this.mytabs.items['Select Columns'].hide();
// Get query
//--------------------------------------
report.get_query = function() {
based_on = this.get_filter('RV Tax Detail', 'Based On').get_value();
from_date = this.get_filter('RV Tax Detail', 'From Date').get_value();
to_date = this.get_filter('RV Tax Detail', 'To Date').get_value();
vid = this.get_filter('RV Tax Detail', 'Voucher Id').get_value();
acc = this.get_filter('RV Tax Detail', 'Tax Account').get_value();
date_fld = 'transaction_date';
if(based_on == 'Sales Invoice') {
based_on = 'Receivable Voucher';
date_fld = 'voucher_date';
}
sp_cond = '';
if (from_date) sp_cond += repl(' AND t1.%(dt)s >= "%(from_date)s"', {dt:date_fld, from_date:from_date});
if (to_date) sp_cond += repl(' AND t1.%(dt)s <= "%(to_date)s"', {dt:date_fld, to_date:to_date});
if (vid) sp_cond += repl(' AND t1.name LIKE "%%(voucher)s%"', {voucher:vid});
if (acc) sp_cond += repl(' AND t2.account_head = "%(acc)s"', {acc:acc});
return repl('SELECT t1.`name`, t1.`%(dt)s`, t1.`customer_name`, t1.net_total, t2.account_head, t2.description, t2.rate, t2.tax_amount \
FROM `tab%(parent)s` t1, `tabRV Tax Detail` t2 \
WHERE t1.docstatus=1 AND t2.`parenttype` = "%(parent)s" \
AND t2.`parent` = t1.`name` \
%(cond)s ORDER BY t1.`name` DESC, t1.%(dt)s DESC', {parent:based_on, cond:sp_cond, dt:date_fld});
}

View File

@ -0,0 +1,22 @@
if filter_values.get('based_on') == 'Sales Invoice':
based_on_dt = 'Receivable Voucher'
else:
based_on_dt = filter_values.get('based_on')
cols = [
[filter_values.get('based_on'), 'Link','150px', based_on_dt],
['Transaction Date', 'Date', '120px', ''],
['Customer', 'Link','150px','Customer'],
['Net Total', 'Currency', '80px', ''],
['Tax Account', 'Link','150px','Account'],
['Description', 'Text','120px',''],
['Tax Rate', 'Currency', '80px', ''],
['Tax Amount', 'Currency', '80px', '']
]
for c in cols:
colnames.append(c[0])
coltypes.append(c[1])
colwidths.append(c[2])
coloptions.append(c[3])
col_idx[c[0]] = len(colnames)-1

View File

@ -0,0 +1,34 @@
# Search Criteria, voucher_wise_tax_details
[
# These values are common in all dictionaries
{
'creation': '2011-09-06 15:36:58',
'docstatus': 0,
'modified': '2011-09-06 15:50:28',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all Search Criteria
{
'columns': 'RV Tax Detail\x01Type,RV Tax Detail\x01Account Head,RV Tax Detail\x01Cost Center,RV Tax Detail\x01Description,RV Tax Detail\x01Rate,RV Tax Detail\x01Amount*,RV Tax Detail\x01Total*',
'criteria_name': 'Voucher wise tax details',
'doc_type': 'RV Tax Detail',
'doctype': 'Search Criteria',
'filters': "{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01Fiscal Year':''}",
'module': 'Accounts',
'name': '__common__',
'page_len': 50,
'parent_doc_type': 'Delivery Note',
'sort_by': '`tabRV Tax Detail`.`parent`',
'sort_order': 'DESC',
'standard': 'Yes'
},
# Search Criteria, voucher_wise_tax_details
{
'doctype': 'Search Criteria',
'name': 'voucher_wise_tax_details'
}
]