mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-09 08:02:51 +00:00
restructured erpnext and deleted unwanted
This commit is contained in:
0
selling/search_criteria/gross_profit/__init__.py
Normal file
0
selling/search_criteria/gross_profit/__init__.py
Normal file
16
selling/search_criteria/gross_profit/gross_profit.js
Normal file
16
selling/search_criteria/gross_profit/gross_profit.js
Normal file
@@ -0,0 +1,16 @@
|
||||
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 Detail'+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 Detail'+FILTER_SEP +'Item Code'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
|
||||
}
|
||||
61
selling/search_criteria/gross_profit/gross_profit.py
Normal file
61
selling/search_criteria/gross_profit/gross_profit.py
Normal file
@@ -0,0 +1,61 @@
|
||||
# Add Columns
|
||||
# ------------
|
||||
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 Detail` 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)
|
||||
37
selling/search_criteria/gross_profit/gross_profit.txt
Normal file
37
selling/search_criteria/gross_profit/gross_profit.txt
Normal file
@@ -0,0 +1,37 @@
|
||||
[
|
||||
{
|
||||
'add_col': None,
|
||||
'add_cond': None,
|
||||
'add_tab': None,
|
||||
'columns': 'Delivery Note\x01ID,Delivery Note\x01Posting Date,Delivery Note\x01Posting Time,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Item Name,Delivery Note Detail\x01Description,Delivery Note\x01Project Name,Delivery Note Detail\x01Quantity,Delivery Note Detail\x01Rate*,Delivery Note Detail\x01Amount*',
|
||||
'creation': '2010-12-14 10:33:09',
|
||||
'criteria_name': 'Gross Profit',
|
||||
'custom_query': '',
|
||||
'description': 'Invoice wise',
|
||||
'dis_filters': None,
|
||||
'disabled': None,
|
||||
'doc_type': 'Delivery Note Detail',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': "{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'','Delivery Note\x01Fiscal Year':''}",
|
||||
'graph_series': None,
|
||||
'graph_values': None,
|
||||
'group_by': None,
|
||||
'idx': None,
|
||||
'modified': '2010-11-10 12:39:03',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'CRM',
|
||||
'name': 'gross_profit',
|
||||
'owner': 'Administrator',
|
||||
'page_len': 50,
|
||||
'parent': None,
|
||||
'parent_doc_type': 'Delivery Note',
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'report_script': None,
|
||||
'server_script': None,
|
||||
'sort_by': '`tabDelivery Note`.`name`',
|
||||
'sort_order': 'DESC',
|
||||
'standard': 'Yes'
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user