mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 07:32:50 +00:00
moved directory structure
This commit is contained in:
1
selling/search_criteria/gross_profit/__init__.py
Normal file
1
selling/search_criteria/gross_profit/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
||||
32
selling/search_criteria/gross_profit/gross_profit.js
Normal file
32
selling/search_criteria/gross_profit/gross_profit.js
Normal file
@@ -0,0 +1,32 @@
|
||||
// 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.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;
|
||||
}
|
||||
78
selling/search_criteria/gross_profit/gross_profit.py
Normal file
78
selling/search_criteria/gross_profit/gross_profit.py
Normal file
@@ -0,0 +1,78 @@
|
||||
# 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/>.
|
||||
|
||||
# Add Columns
|
||||
# ------------
|
||||
from __future__ import unicode_literals
|
||||
colnames[colnames.index('Rate*')] = 'Rate'
|
||||
col_idx['Rate'] = col_idx['Rate*']
|
||||
col_idx.pop('Rate*')
|
||||
colnames[colnames.index('Amount*')] = 'Amount'
|
||||
col_idx['Amount'] = col_idx['Amount*']
|
||||
col_idx.pop('Amount*')
|
||||
|
||||
columns = [['Valuation Rate','Currency','150px',''],
|
||||
['Valuation Amount','Currency','150px',''],
|
||||
['Gross Profit (%)','Currrency','150px',''],
|
||||
['Gross Profit','Currency','150px','']]
|
||||
|
||||
for c in columns:
|
||||
colnames.append(c[0])
|
||||
coltypes.append(c[1])
|
||||
colwidths.append(c[2])
|
||||
coloptions.append(c[3])
|
||||
col_idx[c[0]] = len(colnames)-1
|
||||
|
||||
out, tot_amount, tot_val_amount, tot_gross_profit = [], 0, 0, 0
|
||||
|
||||
for r in res:
|
||||
tot_val_rate = 0
|
||||
packing_list_items = sql("select item_code, warehouse, qty from `tabDelivery Note Packing Item` where parent = %s and parent_item = %s", (r[col_idx['ID']], r[col_idx['Item Code']]))
|
||||
for d in packing_list_items:
|
||||
if d[1]:
|
||||
val_rate = sql("select valuation_rate from `tabStock Ledger Entry` where item_code = %s and warehouse = %s and voucher_type = 'Delivery Note' and voucher_no = %s and is_cancelled = 'No'", (d[0], d[1], r[col_idx['ID']]))
|
||||
val_rate = val_rate and val_rate[0][0] or 0
|
||||
if r[col_idx['Quantity']]: tot_val_rate += (flt(val_rate) * flt(d[2]) / flt(r[col_idx['Quantity']]))
|
||||
else: tot_val_rate = 0
|
||||
|
||||
r.append(fmt_money(tot_val_rate))
|
||||
|
||||
val_amount = flt(tot_val_rate) * flt(r[col_idx['Quantity']])
|
||||
r.append(fmt_money(val_amount))
|
||||
|
||||
gp = flt(r[col_idx['Amount']]) - flt(val_amount)
|
||||
|
||||
if val_amount: gp_percent = gp * 100 / val_amount
|
||||
else: gp_percent = gp
|
||||
|
||||
r.append(fmt_money(gp_percent))
|
||||
r.append(fmt_money(gp))
|
||||
out.append(r)
|
||||
|
||||
tot_gross_profit += flt(gp)
|
||||
tot_amount += flt(r[col_idx['Amount']])
|
||||
tot_val_amount += flt(val_amount)
|
||||
|
||||
# Add Total Row
|
||||
# --------------
|
||||
l_row = ['' for i in range(len(colnames))]
|
||||
l_row[col_idx['Quantity']] = '<b>TOTALS</b>'
|
||||
l_row[col_idx['Amount']] = fmt_money(tot_amount)
|
||||
l_row[col_idx['Valuation Amount']] = fmt_money(tot_val_amount)
|
||||
if tot_val_amount: l_row[col_idx['Gross Profit (%)']] = fmt_money((tot_amount - tot_val_amount) * 100 / tot_val_amount)
|
||||
else: l_row[col_idx['Gross Profit (%)']] = fmt_money(tot_amount)
|
||||
l_row[col_idx['Gross Profit']] = fmt_money(tot_gross_profit)
|
||||
out.append(l_row)
|
||||
35
selling/search_criteria/gross_profit/gross_profit.txt
Normal file
35
selling/search_criteria/gross_profit/gross_profit.txt
Normal file
@@ -0,0 +1,35 @@
|
||||
# Search Criteria, gross_profit
|
||||
[
|
||||
|
||||
# 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
|
||||
{
|
||||
'columns': u'Delivery Note\x01ID,Delivery Note\x01Posting Date,Delivery Note\x01Posting Time,Delivery Note Item\x01Item Code,Delivery Note Item\x01Item Name,Delivery Note Item\x01Description,Delivery Note\x01Project Name,Delivery Note Item\x01Quantity,Delivery Note Item\x01Rate*,Delivery Note Item\x01Amount*',
|
||||
'criteria_name': u'Gross Profit',
|
||||
'description': u'Invoice wise',
|
||||
'doc_type': u'Delivery Note Item',
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': u"{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01Fiscal Year':''}",
|
||||
'module': u'Selling',
|
||||
'name': '__common__',
|
||||
'page_len': 50,
|
||||
'parent_doc_type': u'Delivery Note',
|
||||
'sort_by': u'`tabDelivery Note`.`name`',
|
||||
'sort_order': u'DESC',
|
||||
'standard': u'Yes'
|
||||
},
|
||||
|
||||
# Search Criteria, gross_profit
|
||||
{
|
||||
'doctype': 'Search Criteria',
|
||||
'name': u'gross_profit'
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user