mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-20 05:29:18 +00:00
moved directory structure
This commit is contained in:
1
buying/page/__init__.py
Normal file
1
buying/page/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
||||
1
buying/page/buying_home/__init__.py
Normal file
1
buying/page/buying_home/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
||||
78
buying/page/buying_home/buying_home.html
Normal file
78
buying/page/buying_home/buying_home.html
Normal file
@@ -0,0 +1,78 @@
|
||||
<div class="layout-wrapper layout-wrapper-background">
|
||||
<div class="appframe-area"></div>
|
||||
<div class="layout-main-section">
|
||||
<div style="width: 48%; float: left;">
|
||||
<h4><a href="#!List/Purchase Request">Purchase Request</a></h4>
|
||||
<p class="help">Request for purchase</p>
|
||||
<br>
|
||||
<h4><a href="#!List/Supplier Quotation">Supplier Quotation (beta)</a></h4>
|
||||
<p class="help">Track Quotations received from Suppliers</p>
|
||||
<br>
|
||||
<h4><a href="#!List/Purchase Order">Purchase Order</a></h4>
|
||||
<p class="help">Purchase Orders given to Suppliers</p>
|
||||
</div>
|
||||
<div style="width: 48%; float: right;">
|
||||
<h4><a href="#!List/Supplier">Supplier</a></h4>
|
||||
<p class="help">Supplier Master</p>
|
||||
<br>
|
||||
<h4><a href="#!List/Item">Item</a></h4>
|
||||
<p class="help">Item Master</p>
|
||||
<br>
|
||||
<h4><a href="#!List/Contact">Contact</a></h4>
|
||||
<p class="help">Contact Master</p>
|
||||
<br>
|
||||
<h4><a href="#!List/Address">Address</a></h4>
|
||||
<p class="help">Address Master</p>
|
||||
<br>
|
||||
<h4><a href="#purchase-analytics" data-role="Analytics">Purchase Analytics</a>
|
||||
<span style="background-color: #fed; font-weight: normal; font-size: 80%">beta</span>
|
||||
</h4>
|
||||
<p class="help">Purchase trends based on Purchase Invoice</p>
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
<hr>
|
||||
<h3>Reports</h3>
|
||||
<div class="reports-list"></div>
|
||||
</div>
|
||||
<div class="layout-side-section">
|
||||
<div class="psidebar">
|
||||
<div class="section">
|
||||
<div class="section-head">Setup</div>
|
||||
<div class="section-body">
|
||||
<div class="section-item">
|
||||
<a class="section-link"
|
||||
title = "Tax and charges structure master"
|
||||
href="#!List/Purchase Taxes and Charges Master">Purchase Taxes and Charges Master</a>
|
||||
</div>
|
||||
<div class="section-item">
|
||||
<a class="section-link"
|
||||
title = "Supplier classification"
|
||||
href="#!List/Supplier Type">Supplier Type</a>
|
||||
</div>
|
||||
<div class="section-item">
|
||||
<a class="section-link"
|
||||
title = "Helper for managing return of goods (sales or purchase)"
|
||||
href="#!Form/Sales and Purchase Return Tool/Sales and Purchase Return Tool">Purchase Returns</a>
|
||||
</div>
|
||||
<div class="section-item">
|
||||
<a class="section-link"
|
||||
title = "Terms of contract template"
|
||||
href="#!List/Terms and Conditions">Terms and Conditions Template</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="section-head">Tools</div>
|
||||
<div class="section-body">
|
||||
<div class="section-item">
|
||||
<a class="section-link"
|
||||
title = "Analyze Sales and Purchase trends and slice them based on item, customer, groups etc"
|
||||
href="#!Report/Profile/Trend Analyzer">Trend Analyzer</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
20
buying/page/buying_home/buying_home.js
Normal file
20
buying/page/buying_home/buying_home.js
Normal file
@@ -0,0 +1,20 @@
|
||||
// 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/>.
|
||||
|
||||
pscript['onload_buying-home'] = function(wrapper) {
|
||||
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'), 'Buying');
|
||||
erpnext.module_page.setup_page('Buying', wrapper);
|
||||
}
|
||||
28
buying/page/buying_home/buying_home.txt
Normal file
28
buying/page/buying_home/buying_home.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
# Page, buying-home
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-02-21 13:22:54',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-02-21 13:22:54',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Page
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'module': u'Buying',
|
||||
'name': '__common__',
|
||||
'page_name': u'buying-home',
|
||||
'standard': u'Yes',
|
||||
'title': u'Buying Home'
|
||||
},
|
||||
|
||||
# Page, buying-home
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'name': u'buying-home'
|
||||
}
|
||||
]
|
||||
0
buying/page/purchase_analytics/__init__.py
Normal file
0
buying/page/purchase_analytics/__init__.py
Normal file
264
buying/page/purchase_analytics/purchase_analytics.js
Normal file
264
buying/page/purchase_analytics/purchase_analytics.js
Normal file
@@ -0,0 +1,264 @@
|
||||
// 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/>.
|
||||
|
||||
wn.pages['purchase-analytics'].onload = function(wrapper) {
|
||||
wn.ui.make_app_page({
|
||||
parent: wrapper,
|
||||
title: 'Purchase Analytics',
|
||||
single_column: true
|
||||
});
|
||||
|
||||
new erpnext.PurchaseAnalytics(wrapper);
|
||||
}
|
||||
|
||||
erpnext.PurchaseAnalytics = wn.views.TreeGridReport.extend({
|
||||
init: function(wrapper) {
|
||||
this._super({
|
||||
title: "Purchase Analytics",
|
||||
page: wrapper,
|
||||
parent: $(wrapper).find('.layout-main'),
|
||||
appframe: wrapper.appframe,
|
||||
doctypes: ["Item", "Item Group", "Supplier", "Supplier Type", "Company",
|
||||
"Purchase Invoice", "Purchase Invoice Item"],
|
||||
tree_grid: { show: true }
|
||||
});
|
||||
|
||||
this.tree_grids = {
|
||||
"Supplier Type": {
|
||||
label: "Supplier Type / Supplier",
|
||||
show: true,
|
||||
item_key: "supplier",
|
||||
parent_field: "parent_supplier_type",
|
||||
formatter: function(item) {
|
||||
// return repl('<a href="#Report2/stock-invoices/customer=%(enc_value)s">%(value)s</a>', {
|
||||
// value: item.name,
|
||||
// enc_value: encodeURIComponent(item.name)
|
||||
// });
|
||||
return item.name;
|
||||
}
|
||||
},
|
||||
"Supplier": {
|
||||
label: "Supplier",
|
||||
show: false,
|
||||
item_key: "supplier",
|
||||
formatter: function(item) {
|
||||
return item.name;
|
||||
}
|
||||
},
|
||||
"Item Group": {
|
||||
label: "Item",
|
||||
show: true,
|
||||
parent_field: "parent_item_group",
|
||||
item_key: "item_code",
|
||||
formatter: function(item) {
|
||||
return item.name;
|
||||
}
|
||||
},
|
||||
"Item": {
|
||||
label: "Item",
|
||||
show: false,
|
||||
item_key: "item_code",
|
||||
formatter: function(item) {
|
||||
return item.name;
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
setup_columns: function() {
|
||||
this.tree_grid = this.tree_grids[this.tree_type];
|
||||
|
||||
var std_columns = [
|
||||
{id: "check", name: "Plot", field: "check", width: 30,
|
||||
formatter: this.check_formatter},
|
||||
{id: "name", name: this.tree_grid.label, field: "name", width: 300,
|
||||
formatter: this.tree_formatter},
|
||||
{id: "total", name: "Total", field: "total", plot: false,
|
||||
formatter: this.currency_formatter}
|
||||
];
|
||||
|
||||
this.make_date_range_columns();
|
||||
this.columns = std_columns.concat(this.columns);
|
||||
},
|
||||
filters: [
|
||||
{fieldtype:"Select", label: "Tree Type", options:["Supplier Type", "Supplier",
|
||||
"Item Group", "Item"],
|
||||
filter: function(val, item, opts, me) {
|
||||
return me.apply_zero_filter(val, item, opts, me);
|
||||
}},
|
||||
{fieldtype:"Select", label: "Value or Qty", options:["Value", "Quantity"]},
|
||||
{fieldtype:"Select", label: "Company", link:"Company",
|
||||
default_value: "Select Company..."},
|
||||
{fieldtype:"Date", label: "From Date"},
|
||||
{fieldtype:"Label", label: "To"},
|
||||
{fieldtype:"Date", label: "To Date"},
|
||||
{fieldtype:"Select", label: "Range",
|
||||
options:["Daily", "Weekly", "Monthly", "Quarterly", "Yearly"]},
|
||||
{fieldtype:"Button", label: "Refresh", icon:"icon-refresh icon-white", cssClass:"btn-info"},
|
||||
{fieldtype:"Button", label: "Reset Filters"}
|
||||
],
|
||||
setup_filters: function() {
|
||||
var me = this;
|
||||
this._super();
|
||||
|
||||
this.filter_inputs.value_or_qty.change(function() {
|
||||
me.filter_inputs.refresh.click();
|
||||
});
|
||||
|
||||
this.filter_inputs.tree_type.change(function() {
|
||||
me.filter_inputs.refresh.click();
|
||||
});
|
||||
|
||||
this.show_zero_check()
|
||||
this.setup_plot_check();
|
||||
},
|
||||
init_filter_values: function() {
|
||||
this._super();
|
||||
this.filter_inputs.range.val('Weekly');
|
||||
},
|
||||
prepare_data: function() {
|
||||
var me = this;
|
||||
if (!this.tl) {
|
||||
this.make_transaction_list("Purchase Invoice", "Purchase Invoice Item");
|
||||
|
||||
// add 'Not Set' Supplier & Item
|
||||
// Add 'All Supplier Types' Supplier Type
|
||||
// (Supplier / Item are not mandatory!!)
|
||||
// Set parent supplier type for tree view
|
||||
|
||||
$.each(wn.report_dump.data["Supplier Type"], function(i, v) {
|
||||
v['parent_supplier_type'] = "All Supplier Types"
|
||||
})
|
||||
|
||||
wn.report_dump.data["Supplier Type"] = [{
|
||||
name: "All Supplier Types",
|
||||
id: "All Supplier Types",
|
||||
}].concat(wn.report_dump.data["Supplier Type"]);
|
||||
|
||||
wn.report_dump.data["Supplier"].push({
|
||||
name: "Not Set",
|
||||
parent_supplier_type: "All Supplier Types",
|
||||
id: "Not Set",
|
||||
});
|
||||
|
||||
wn.report_dump.data["Item"].push({
|
||||
name: "Not Set",
|
||||
parent_item_group: "All Item Groups",
|
||||
id: "Not Set",
|
||||
});
|
||||
}
|
||||
|
||||
if(!this.data || me.item_type != me.tree_type) {
|
||||
if(me.tree_type=='Supplier') {
|
||||
var items = wn.report_dump.data["Supplier"];
|
||||
} if(me.tree_type=='Supplier Type') {
|
||||
var items = this.prepare_tree("Supplier", "Supplier Type");
|
||||
} else if(me.tree_type=="Item Group") {
|
||||
var items = this.prepare_tree("Item", "Item Group");
|
||||
} else if(me.tree_type=="Item") {
|
||||
var items = wn.report_dump.data["Item"];
|
||||
}
|
||||
|
||||
me.item_type = me.tree_type
|
||||
me.parent_map = {};
|
||||
me.item_by_name = {};
|
||||
me.data = [];
|
||||
|
||||
$.each(items, function(i, v) {
|
||||
var d = copy_dict(v);
|
||||
|
||||
me.data.push(d);
|
||||
me.item_by_name[d.name] = d;
|
||||
if(d[me.tree_grid.parent_field]) {
|
||||
me.parent_map[d.name] = d[me.tree_grid.parent_field];
|
||||
}
|
||||
me.reset_item_values(d);
|
||||
});
|
||||
|
||||
this.set_indent();
|
||||
|
||||
} else {
|
||||
// otherwise, only reset values
|
||||
$.each(this.data, function(i, d) {
|
||||
me.reset_item_values(d);
|
||||
});
|
||||
}
|
||||
|
||||
this.prepare_balances();
|
||||
if(me.tree_grid.show) {
|
||||
this.set_totals(false);
|
||||
this.update_groups();
|
||||
} else {
|
||||
this.set_totals(true);
|
||||
}
|
||||
},
|
||||
prepare_balances: function() {
|
||||
var me = this;
|
||||
var from_date = dateutil.str_to_obj(this.from_date);
|
||||
var to_date = dateutil.str_to_obj(this.to_date);
|
||||
var is_val = this.value_or_qty == 'Value';
|
||||
|
||||
$.each(this.tl, function(i, tl) {
|
||||
if (me.is_default('company') ? true : me.apply_filter(tl, "company")) {
|
||||
var posting_date = dateutil.str_to_obj(tl.posting_date);
|
||||
if (posting_date >= from_date && posting_date <= to_date) {
|
||||
var item = me.item_by_name[tl[me.tree_grid.item_key]] || me.item_by_name['Not Set'];
|
||||
item[me.column_map[tl.posting_date].field] += (is_val ? tl.amount : tl.qty);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
update_groups: function() {
|
||||
var me = this;
|
||||
|
||||
$.each(this.data, function(i, item) {
|
||||
var parent = me.parent_map[item.name];
|
||||
while(parent) {
|
||||
parent_group = me.item_by_name[parent];
|
||||
|
||||
$.each(me.columns, function(c, col) {
|
||||
if (col.formatter == me.currency_formatter) {
|
||||
parent_group[col.field] =
|
||||
flt(parent_group[col.field])
|
||||
+ flt(item[col.field]);
|
||||
}
|
||||
});
|
||||
parent = me.parent_map[parent];
|
||||
}
|
||||
});
|
||||
},
|
||||
set_totals: function(sort) {
|
||||
var me = this;
|
||||
var checked = false;
|
||||
$.each(this.data, function(i, d) {
|
||||
d.total = 0.0;
|
||||
$.each(me.columns, function(i, col) {
|
||||
if(col.formatter==me.currency_formatter && !col.hidden && col.field!="total")
|
||||
d.total += d[col.field];
|
||||
if(d.checked) checked = true;
|
||||
})
|
||||
});
|
||||
|
||||
if(sort)this.data = this.data.sort(function(a, b) { return b.total - a.total; });
|
||||
|
||||
if(!this.checked) {
|
||||
this.data[0].checked = true;
|
||||
}
|
||||
},
|
||||
get_plot_points: function(item, col, idx) {
|
||||
return [[dateutil.str_to_obj(col.id).getTime(), item[col.field]],
|
||||
[dateutil.user_to_obj(col.name).getTime(), item[col.field]]];
|
||||
}
|
||||
});
|
||||
28
buying/page/purchase_analytics/purchase_analytics.txt
Normal file
28
buying/page/purchase_analytics/purchase_analytics.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
# Page, purchase-analytics
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
u'creation': '2012-09-21 15:21:10',
|
||||
u'docstatus': 0,
|
||||
u'modified': '2012-09-21 15:21:10',
|
||||
u'modified_by': u'Administrator',
|
||||
u'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Page
|
||||
{
|
||||
u'doctype': u'Page',
|
||||
'module': u'Buying',
|
||||
u'name': u'__common__',
|
||||
'page_name': u'purchase-analytics',
|
||||
'standard': u'Yes',
|
||||
'title': u'Purchase Analytics'
|
||||
},
|
||||
|
||||
# Page, purchase-analytics
|
||||
{
|
||||
u'doctype': u'Page',
|
||||
u'name': u'purchase-analytics'
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user