mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 19:29:10 +00:00
moved directory structure
This commit is contained in:
@@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
||||
@@ -0,0 +1,108 @@
|
||||
// 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() {
|
||||
//hide all filters
|
||||
//------------------------------------------------
|
||||
this.hide_all_filters();
|
||||
|
||||
//add filters
|
||||
//------------------------------------------------
|
||||
this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Purchase Order'+NEWLINE+'Purchase Invoice'+NEWLINE+'Purchase Receipt',report_default:'Purchase Order',ignore : 1,parent:'Purchase Order', single_select:1});
|
||||
|
||||
this.add_filter({fieldname:'purchase_order', label:'Purchase Order', fieldtype:'Link', options:'Purchase Order', ignore : 1, parent:'Purchase Order'});
|
||||
this.add_filter({fieldname:'purchase_receipt', label:'Purchase Receipt',fieldtype:'Link', options:'Purchase Receipt',ignore : 1, parent:'Purchase Order'});
|
||||
this.add_filter({fieldname:'purchase_invoice', label:'Purchase Invoice',fieldtype:'Link', options:'Purchase Invoice',ignore : 1, parent:'Purchase Order'});
|
||||
|
||||
//unhide filters
|
||||
//------------------------------------------------
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Company'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;
|
||||
|
||||
//move filter field in first page
|
||||
//------------------------------------------------
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Based On'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Purchase Order'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Purchase Invoice'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Purchase Receipt'].df.in_first_page = 1;
|
||||
|
||||
// default values
|
||||
//------------------------------------------------
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
|
||||
}
|
||||
|
||||
//hide select columns field
|
||||
//------------------------------------------------
|
||||
this.mytabs.items['Select Columns'].hide();
|
||||
|
||||
|
||||
report.get_query = function() {
|
||||
|
||||
//get filter values
|
||||
based_on = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Based On'].get_value();
|
||||
purchase_order = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Purchase Order'].get_value();
|
||||
purchase_invoice = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Purchase Invoice'].get_value();
|
||||
purchase_receipt = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Purchase Receipt'].get_value();
|
||||
project_name = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Project Name'].get_value();
|
||||
company = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Company'].get_value();
|
||||
fy = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Fiscal Year'].get_value();
|
||||
|
||||
// make query based on transaction
|
||||
//-------------------------------------------------------------------------------------------
|
||||
|
||||
var cond = '';
|
||||
//for purchase order
|
||||
if(based_on == 'Purchase Order'){
|
||||
|
||||
if(purchase_order) cond += ' AND `tabPurchase Order`.name = "'+purchase_order+'"';
|
||||
if(project_name) cond += ' AND `tabPurchase Order`.project_name = "'+project_name+'"';
|
||||
if(company) cond += ' AND `tabPurchase Order`.company = "'+company+'"';
|
||||
if(fy !='') cond += ' AND `tabPurchase Order`.fiscal_year = "'+fy+'"';
|
||||
|
||||
var q = 'SELECT DISTINCT `tabPurchase Order`.name, `tabPurchase Order`.status, `tabPurchase Order`.project_name, `tabPurchase Order`.supplier,`tabPurchase Order`.supplier_name,`tabPurchase Order`.per_received, `tabPurchase Order`.per_billed, `tabPurchase Order`.grand_total FROM `tabPurchase Order` WHERE IFNULL(`tabPurchase Order`.project_name,"") != ""'+cond+' AND `tabPurchase Order`.docstatus != 2';
|
||||
return q;
|
||||
}
|
||||
|
||||
//for purchase receipt
|
||||
else if(based_on == 'Purchase Receipt'){
|
||||
if(purchase_order) cond += ' t2.purchase_order = "'+purchase_order+'" AND ';
|
||||
if(purchase_receipt) cond += ' t1.name = "'+purchase_receipt+'" AND ';
|
||||
if(project_name) cond += ' t1.project_name = "'+project_name+'" AND ';
|
||||
if(company) cond += ' t1.company = "'+company+'" AND ';
|
||||
if(fy !='') cond += ' t1.fiscal_year = "'+fy+'" AND ';
|
||||
|
||||
|
||||
var q = 'SELECT DISTINCT t1.name, t1.status, t1.project_name, t1.supplier, t1.supplier_name,t1.grand_total FROM `tabPurchase Receipt` t1, `tabPurchase Receipt Item` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
|
||||
|
||||
return q;
|
||||
}
|
||||
//for purchase invoice
|
||||
else if(based_on == 'Purchase Invoice'){
|
||||
if(purchase_order) cond += ' t2.purchase_order = "'+purchase_order+'" AND ';
|
||||
if(purchase_receipt) cond += ' t2.purchase_receipt = "'+purchase_receipt+'" AND';
|
||||
if(purchase_invoice) cond += ' t1.name = "'+purchase_invoice+'" AND';
|
||||
if(project_name) cond += ' t1.project_name = "'+project_name+'" AND ';
|
||||
if(company) cond += ' t1.company = "'+company+'" AND ';
|
||||
if(fy !='') cond += ' t1.fiscal_year = "'+fy+'" AND ';
|
||||
|
||||
var q = 'SELECT DISTINCT t1.name , t1.credit_to , t1.project_name, t1.supplier, t1.supplier_name , t1.grand_total FROM `tabPurchase Invoice` t1, `tabPurchase Invoice Item` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
|
||||
|
||||
return q;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
# 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/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
based_on = filter_values.get('based_on')
|
||||
# make default columns
|
||||
#for r in res:
|
||||
col = []
|
||||
if based_on == 'Purchase Order':
|
||||
col = [['Purchase Order ID','Link','Purchase Order'],['Status','Data',''],['Project Name','Link','Project'],['Supplier','Link','Supplier'],['Supplier Name','Data',''],['% Received','Data',''],['% Billed','Data',''],['Grand Total','Currency','']]
|
||||
|
||||
elif based_on == 'Purchase Invoice':
|
||||
col = [['Purchase Receipt ID','Link','Purchase Invoice'],['Status','Data',''],['Project Name','Link','Project'],['Supplier','Link','Supplier'],['Supplier Name','Data',''],['Grand Total','Currency','']]
|
||||
|
||||
elif based_on == 'Purchase Receipt':
|
||||
col = [['Purchase Invoice ID','Link','Purchase Receipt'],['Credit To','Data',''],['Project Name','Link','Project'],['Supplier','Link','Supplier'],['Supplier Name','Data',''],['Grand Total','Currency','']]
|
||||
|
||||
|
||||
for c in col:
|
||||
colnames.append(c[0])
|
||||
coltypes.append(c[1])
|
||||
coloptions.append(c[2])
|
||||
l = (len(c[0])*9)
|
||||
if l < 150 : col_width = '150px'
|
||||
else: col_width = '%spx'%(l)
|
||||
colwidths.append(col_width)
|
||||
col_idx[c[0]] = len(colnames)-1
|
||||
@@ -0,0 +1,31 @@
|
||||
# Search Criteria, projectwise_purchase_details
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-04-03 12:49:52',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-04-03 12:49:52',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'ashwini@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all Search Criteria
|
||||
{
|
||||
'criteria_name': u'Projectwise Purchase Details',
|
||||
'doc_type': u'Purchase Order',
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': u"{'Purchase Order\x01Status':'','Purchase Order\x01Fiscal Year':''}",
|
||||
'module': u'Projects',
|
||||
'name': '__common__',
|
||||
'page_len': 50,
|
||||
'sort_order': u'DESC',
|
||||
'standard': u'Yes'
|
||||
},
|
||||
|
||||
# Search Criteria, projectwise_purchase_details
|
||||
{
|
||||
'doctype': 'Search Criteria',
|
||||
'name': u'projectwise_purchase_details'
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user