mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 20:29:09 +00:00
moved directory structure
This commit is contained in:
@@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
||||
@@ -0,0 +1,112 @@
|
||||
// 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:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice',report_default:'Sales Order',ignore : 1,parent:'Sales Order', single_select:1});
|
||||
|
||||
this.add_filter({fieldname:'sales_order', label:'Sales Order', fieldtype:'Link', options:'Sales Order', ignore : 1, parent:'Sales Order'});
|
||||
this.add_filter({fieldname:'delivery_note', label:'Delivery Note', fieldtype:'Link', options:'Delivery Note',ignore : 1, parent:'Sales Order'});
|
||||
this.add_filter({fieldname:'sales_invoice', label:'Sales Invoice',fieldtype:'Link', options:'Sales Invoice',ignore : 1, parent:'Sales Order'});
|
||||
|
||||
//unhide filters
|
||||
//------------------------------------------------
|
||||
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer'].df.filter_hide = 0;
|
||||
|
||||
//move filter field in first page
|
||||
//------------------------------------------------
|
||||
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Based On'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Sales Order'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Delivery Note'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Sales Invoice'].df.in_first_page = 1;
|
||||
|
||||
// default values
|
||||
//------------------------------------------------
|
||||
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
|
||||
this.filter_fields_dict['Sales 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['Sales Order'+FILTER_SEP+'Based On'].get_value();
|
||||
sales_order = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Sales Order'].get_value();
|
||||
delivery_note = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Delivery Note'].get_value();
|
||||
sales_invoice = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Sales Invoice'].get_value();
|
||||
project_name = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Project Name'].get_value();
|
||||
company = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Company'].get_value();
|
||||
fy = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Fiscal Year'].get_value();
|
||||
|
||||
// make query based on transaction
|
||||
//-------------------------------------------------------------------------------------------
|
||||
|
||||
var cond = '';
|
||||
//for sales order
|
||||
if(based_on == 'Sales Order'){
|
||||
|
||||
if(sales_order) cond += ' AND `tabSales Order`.name = "'+sales_order+'"';
|
||||
if(project_name) cond += ' AND `tabSales Order`.project_name = "'+project_name+'"';
|
||||
if(company) cond += ' AND `tabSales Order`.company = "'+company+'"';
|
||||
if(fy) cond += ' AND `tabSales Order`.fiscal_year = "'+fy+'"';
|
||||
|
||||
var q = 'SELECT DISTINCT `tabSales Order`.name, `tabSales Order`.order_type, `tabSales Order`.status, `tabSales Order`.project_name, `tabSales Order`.customer,`tabSales Order`.customer_name,`tabSales Order`.per_delivered, `tabSales Order`.per_billed, `tabSales Order`.grand_total FROM `tabSales Order` WHERE IFNULL(`tabSales Order`.project_name,"") != ""'+cond+' AND `tabSales Order`.docstatus != 2';
|
||||
return q;
|
||||
}
|
||||
|
||||
//for delivery note
|
||||
else if(based_on == 'Delivery Note'){
|
||||
if(sales_order) cond += ' t1.name = t2.parent AND t2.prevdoc_docname = "'+sales_order+'" AND ';
|
||||
if(delivery_note) cond += ' t1.name = "'+delivery_note+'" 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.customer, t1.customer_name, t1.per_billed, t1.per_installed, t1.grand_total FROM `tabDelivery Note` t1, `tabDelivery Note Item` t2 WHERE '+cond+' IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2';
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
//for sales invoice
|
||||
else if(based_on == 'Sales Invoice'){
|
||||
if(sales_order) cond += ' t2.sales_order = "'+sales_order+'" AND ';
|
||||
if(delivery_note) cond += ' t2.delivery_note = "'+delivery_note+'" AND ';
|
||||
if(sales_invoice) cond += ' t1.name = "'+sales_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.debit_to , t1.project_name , t1.customer , t1.customer_name , t1.grand_total FROM `tabSales Invoice` t1, `tabSales Invoice Item` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
# 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')
|
||||
|
||||
cols=[]
|
||||
|
||||
if based_on == 'Sales Order':
|
||||
cols = [['Sales Order No','Link','150px','Sales Order'], ['Order Type','Data','100px',''], ['Status','Data','100px',''], ['Project Name','Link','150px','Project'], ['Customer','Link','150px','Customer'], ['Customer Name','Data','200px',''], ['% Delivered','Currency','100px',''], ['% Billed','Currency','100px',''], ['Grand Total','Currency','150px','']]
|
||||
|
||||
elif based_on == 'Delivery Note':
|
||||
cols = [['Delivery Note No','Link','150px','Delivery Note'], ['Status','Data','100px',''], ['Project Name','Link','200px','Project'], ['Customer','Link','150px','Customer'], ['Customer Name','Data','200px',''], ['% Installed','Currency','100px',''], ['% Billed','Currency','100px',''], ['Grand Total','Currency','150px','']]
|
||||
|
||||
elif based_on == 'Sales Invoice':
|
||||
cols = [['Sales Invoice No','Link','150px','Sales Invoice'], ['Debit To','Data','150px',''], ['Project Name','Link','200px','Project'], ['Customer','Link','150px','Customer'], ['Customer Name','Data','200px',''], ['Grand Total','Currency','150px','']]
|
||||
|
||||
|
||||
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
|
||||
@@ -0,0 +1,31 @@
|
||||
# Search Criteria, projectwise_sales_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'harshada@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all Search Criteria
|
||||
{
|
||||
'criteria_name': u'Projectwise Sales Details',
|
||||
'doc_type': u'Sales Order',
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': u"{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':''}",
|
||||
'module': u'Projects',
|
||||
'name': '__common__',
|
||||
'page_len': 50,
|
||||
'sort_order': u'DESC',
|
||||
'standard': u'Yes'
|
||||
},
|
||||
|
||||
# Search Criteria, projectwise_sales_details
|
||||
{
|
||||
'doctype': 'Search Criteria',
|
||||
'name': u'projectwise_sales_details'
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user