diff --git a/selling/search_criteria/gross_profit/gross_profit.js b/selling/search_criteria/gross_profit/gross_profit.js
index 4ad67358bf..29c7e72ccf 100644
--- a/selling/search_criteria/gross_profit/gross_profit.js
+++ b/selling/search_criteria/gross_profit/gross_profit.js
@@ -15,18 +15,24 @@
// along with this program. If not, see .
report.customize_filters = function() {
- this.mytabs.items['Select Columns'].hide();
- this.mytabs.tabs['More Filters'].hide();
- this.hide_all_filters();
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'ID'].df.filter_hide = 0;
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
- this.filter_fields_dict['Delivery Note Item'+FILTER_SEP +'Item Code'].df.filter_hide = 0;
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
+ this.mytabs.items['Select Columns'].hide();
+ this.mytabs.tabs['More Filters'].hide();
+ this.hide_all_filters();
+ this.filter_fields_dict['Delivery Note'+FILTER_SEP +'ID'].df.filter_hide = 0;
+ this.filter_fields_dict['Delivery Note'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
+ this.filter_fields_dict['Delivery Note'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
+ this.filter_fields_dict['Delivery Note Item'+FILTER_SEP +'Item Code'].df.filter_hide = 0;
+ this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'ID'].df.in_first_page = 1;
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
- this.filter_fields_dict['Delivery Note Item'+FILTER_SEP +'Item Code'].df.in_first_page = 1;
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
+ this.filter_fields_dict['Delivery Note'+FILTER_SEP +'ID'].df.in_first_page = 1;
+ this.filter_fields_dict['Delivery Note'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
+ this.filter_fields_dict['Delivery Note'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
+ this.filter_fields_dict['Delivery Note Item'+FILTER_SEP +'Item Code'].df.in_first_page = 1;
+ this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
+
+ this.filter_fields_dict['Delivery Note' + FILTER_SEP +
+ 'From Posting Date'].df['report_default'] = sys_defaults["year_start_date"]
+ this.filter_fields_dict['Delivery Note' + FILTER_SEP +
+ 'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
+
}
\ No newline at end of file
diff --git a/selling/search_criteria/gross_profit/gross_profit.py b/selling/search_criteria/gross_profit/gross_profit.py
index 02a4949cf0..c0909a697b 100644
--- a/selling/search_criteria/gross_profit/gross_profit.py
+++ b/selling/search_criteria/gross_profit/gross_profit.py
@@ -14,10 +14,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-
from __future__ import unicode_literals
from webnotes.utils import flt
+if not (filter_values.get('posting_date') or filter_values.get('posting_date1')):
+ msgprint("Please select From and To Posting Date", raise_exception=1)
+
columns = [
['Delivery Note', 'Link', '120px', 'Delivery Note'],
['Posting Date', 'Date', '120px', ''],
diff --git a/selling/search_criteria/gross_profit/gross_profit.sql b/selling/search_criteria/gross_profit/gross_profit.sql
index f59ea6a03a..91b7ea6302 100644
--- a/selling/search_criteria/gross_profit/gross_profit.sql
+++ b/selling/search_criteria/gross_profit/gross_profit.sql
@@ -5,6 +5,10 @@ SELECT
FROM
`tabDelivery Note Item` dn_item, `tabDelivery Note` dn
WHERE
- dn.docstatus = 1
- AND dn_item.parent = dn.name
+ dn_item.parent = dn.name
+ AND dn.docstatus = 1
+ AND dn.name like '%(name)s%%'
+ AND dn_item.item_code like '%(item_code)s%%'
+ AND dn.posting_date >= '%(posting_date)s'
+ AND dn.posting_date <= '%(posting_date1)s'
ORDER BY dn.name DESC
\ No newline at end of file