Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
f8b9c51e1b
@ -35,8 +35,10 @@ erpnext.PurchaseAnalytics = wn.views.TreeGridReport.extend({
|
|||||||
page: wrapper,
|
page: wrapper,
|
||||||
parent: $(wrapper).find('.layout-main'),
|
parent: $(wrapper).find('.layout-main'),
|
||||||
appframe: wrapper.appframe,
|
appframe: wrapper.appframe,
|
||||||
doctypes: ["Item", "Item Group", "Supplier", "Supplier Type", "Company",
|
doctypes: ["Item", "Item Group", "Supplier", "Supplier Type", "Company", "Fiscal Year",
|
||||||
"Purchase Invoice", "Purchase Invoice Item", "Fiscal Year"],
|
"Purchase Invoice", "Purchase Invoice Item",
|
||||||
|
"Purchase Order", "Purchase Order Item[Purchase Analytics]",
|
||||||
|
"Purchase Receipt", "Purchase Receipt Item[Purchase Analytics]"],
|
||||||
tree_grid: { show: true }
|
tree_grid: { show: true }
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -102,6 +104,8 @@ erpnext.PurchaseAnalytics = wn.views.TreeGridReport.extend({
|
|||||||
filter: function(val, item, opts, me) {
|
filter: function(val, item, opts, me) {
|
||||||
return me.apply_zero_filter(val, item, opts, me);
|
return me.apply_zero_filter(val, item, opts, me);
|
||||||
}},
|
}},
|
||||||
|
{fieldtype:"Select", label: "Based On", options:["Purchase Invoice",
|
||||||
|
"Purchase Order", "Purchase Receipt"]},
|
||||||
{fieldtype:"Select", label: "Value or Qty", options:["Value", "Quantity"]},
|
{fieldtype:"Select", label: "Value or Qty", options:["Value", "Quantity"]},
|
||||||
{fieldtype:"Select", label: "Company", link:"Company",
|
{fieldtype:"Select", label: "Company", link:"Company",
|
||||||
default_value: "Select Company..."},
|
default_value: "Select Company..."},
|
||||||
@ -125,6 +129,10 @@ erpnext.PurchaseAnalytics = wn.views.TreeGridReport.extend({
|
|||||||
me.filter_inputs.refresh.click();
|
me.filter_inputs.refresh.click();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.filter_inputs.based_on.change(function() {
|
||||||
|
me.filter_inputs.refresh.click();
|
||||||
|
});
|
||||||
|
|
||||||
this.show_zero_check()
|
this.show_zero_check()
|
||||||
this.setup_plot_check();
|
this.setup_plot_check();
|
||||||
},
|
},
|
||||||
@ -135,8 +143,6 @@ erpnext.PurchaseAnalytics = wn.views.TreeGridReport.extend({
|
|||||||
prepare_data: function() {
|
prepare_data: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if (!this.tl) {
|
if (!this.tl) {
|
||||||
this.make_transaction_list("Purchase Invoice", "Purchase Invoice Item");
|
|
||||||
|
|
||||||
// add 'Not Set' Supplier & Item
|
// add 'Not Set' Supplier & Item
|
||||||
// Add 'All Supplier Types' Supplier Type
|
// Add 'All Supplier Types' Supplier Type
|
||||||
// (Supplier / Item are not mandatory!!)
|
// (Supplier / Item are not mandatory!!)
|
||||||
@ -164,6 +170,11 @@ erpnext.PurchaseAnalytics = wn.views.TreeGridReport.extend({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.tl || !this.tl[this.based_on]) {
|
||||||
|
this.make_transaction_list(this.based_on, this.based_on + " Item");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!this.data || me.item_type != me.tree_type) {
|
if(!this.data || me.item_type != me.tree_type) {
|
||||||
if(me.tree_type=='Supplier') {
|
if(me.tree_type=='Supplier') {
|
||||||
var items = wn.report_dump.data["Supplier"];
|
var items = wn.report_dump.data["Supplier"];
|
||||||
@ -214,11 +225,12 @@ erpnext.PurchaseAnalytics = wn.views.TreeGridReport.extend({
|
|||||||
var to_date = dateutil.str_to_obj(this.to_date);
|
var to_date = dateutil.str_to_obj(this.to_date);
|
||||||
var is_val = this.value_or_qty == 'Value';
|
var is_val = this.value_or_qty == 'Value';
|
||||||
|
|
||||||
$.each(this.tl, function(i, tl) {
|
$.each(this.tl[this.based_on], function(i, tl) {
|
||||||
if (me.is_default('company') ? true : me.apply_filter(tl, "company")) {
|
if (me.is_default('company') ? true : me.apply_filter(tl, "company")) {
|
||||||
var posting_date = dateutil.str_to_obj(tl.posting_date);
|
var posting_date = dateutil.str_to_obj(tl.posting_date);
|
||||||
if (posting_date >= from_date && posting_date <= to_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'];
|
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);
|
item[me.column_map[tl.posting_date].field] += (is_val ? tl.amount : tl.qty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2013-01-10 16:34:18",
|
"creation": "2013-01-22 16:50:33",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-01-22 14:56:03",
|
"modified": "2013-01-24 16:06:05",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -227,7 +227,7 @@
|
|||||||
"oldfieldtype": "Data"
|
"oldfieldtype": "Data"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "<a href=\"javascript:cur_frm.cscript.TerritoryHelp();\">To manage Territory, click here</a>",
|
"description": "<a href=\"#!Sales Browser/Territory\">To manage Territory, click here</a>",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "territory",
|
"fieldname": "territory",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
@ -470,6 +470,6 @@
|
|||||||
{
|
{
|
||||||
"cancel": 0,
|
"cancel": 0,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"role": "System Manager"
|
"role": "Guest"
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -34,8 +34,10 @@ erpnext.SalesAnalytics = wn.views.TreeGridReport.extend({
|
|||||||
page: wrapper,
|
page: wrapper,
|
||||||
parent: $(wrapper).find('.layout-main'),
|
parent: $(wrapper).find('.layout-main'),
|
||||||
appframe: wrapper.appframe,
|
appframe: wrapper.appframe,
|
||||||
doctypes: ["Item", "Item Group", "Customer", "Customer Group", "Company",
|
doctypes: ["Item", "Item Group", "Customer", "Customer Group", "Company", "Territory",
|
||||||
"Sales Invoice", "Sales Invoice Item", "Territory"],
|
"Fiscal Year", "Sales Invoice", "Sales Invoice Item",
|
||||||
|
"Sales Order", "Sales Order Item[Sales Analytics]",
|
||||||
|
"Delivery Note", "Delivery Note Item[Sales Analytics]"],
|
||||||
tree_grid: { show: true }
|
tree_grid: { show: true }
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -45,13 +47,7 @@ erpnext.SalesAnalytics = wn.views.TreeGridReport.extend({
|
|||||||
show: true,
|
show: true,
|
||||||
item_key: "customer",
|
item_key: "customer",
|
||||||
parent_field: "parent_customer_group",
|
parent_field: "parent_customer_group",
|
||||||
formatter: function(item) {
|
formatter: function(item) { return item.name; }
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"Customer": {
|
"Customer": {
|
||||||
label: "Customer",
|
label: "Customer",
|
||||||
@ -110,6 +106,8 @@ erpnext.SalesAnalytics = wn.views.TreeGridReport.extend({
|
|||||||
filter: function(val, item, opts, me) {
|
filter: function(val, item, opts, me) {
|
||||||
return me.apply_zero_filter(val, item, opts, me);
|
return me.apply_zero_filter(val, item, opts, me);
|
||||||
}},
|
}},
|
||||||
|
{fieldtype:"Select", label: "Based On", options:["Sales Invoice",
|
||||||
|
"Sales Order", "Delivery Note"]},
|
||||||
{fieldtype:"Select", label: "Value or Qty", options:["Value", "Quantity"]},
|
{fieldtype:"Select", label: "Value or Qty", options:["Value", "Quantity"]},
|
||||||
{fieldtype:"Select", label: "Company", link:"Company",
|
{fieldtype:"Select", label: "Company", link:"Company",
|
||||||
default_value: "Select Company..."},
|
default_value: "Select Company..."},
|
||||||
@ -133,6 +131,10 @@ erpnext.SalesAnalytics = wn.views.TreeGridReport.extend({
|
|||||||
me.filter_inputs.refresh.click();
|
me.filter_inputs.refresh.click();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.filter_inputs.based_on.change(function() {
|
||||||
|
me.filter_inputs.refresh.click();
|
||||||
|
});
|
||||||
|
|
||||||
this.show_zero_check()
|
this.show_zero_check()
|
||||||
this.setup_plot_check();
|
this.setup_plot_check();
|
||||||
},
|
},
|
||||||
@ -143,8 +145,6 @@ erpnext.SalesAnalytics = wn.views.TreeGridReport.extend({
|
|||||||
prepare_data: function() {
|
prepare_data: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if (!this.tl) {
|
if (!this.tl) {
|
||||||
this.make_transaction_list("Sales Invoice", "Sales Invoice Item");
|
|
||||||
|
|
||||||
// add 'Not Set' Customer & Item
|
// add 'Not Set' Customer & Item
|
||||||
// (Customer / Item are not mandatory!!)
|
// (Customer / Item are not mandatory!!)
|
||||||
wn.report_dump.data["Customer"].push({
|
wn.report_dump.data["Customer"].push({
|
||||||
@ -161,6 +161,10 @@ erpnext.SalesAnalytics = wn.views.TreeGridReport.extend({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.tl || !this.tl[this.based_on]) {
|
||||||
|
this.make_transaction_list(this.based_on, this.based_on + " Item");
|
||||||
|
}
|
||||||
|
|
||||||
if(!this.data || me.item_type != me.tree_type) {
|
if(!this.data || me.item_type != me.tree_type) {
|
||||||
if(me.tree_type=='Customer') {
|
if(me.tree_type=='Customer') {
|
||||||
var items = wn.report_dump.data["Customer"];
|
var items = wn.report_dump.data["Customer"];
|
||||||
@ -214,11 +218,12 @@ erpnext.SalesAnalytics = wn.views.TreeGridReport.extend({
|
|||||||
var to_date = dateutil.str_to_obj(this.to_date);
|
var to_date = dateutil.str_to_obj(this.to_date);
|
||||||
var is_val = this.value_or_qty == 'Value';
|
var is_val = this.value_or_qty == 'Value';
|
||||||
|
|
||||||
$.each(this.tl, function(i, tl) {
|
$.each(this.tl[this.based_on], function(i, tl) {
|
||||||
if (me.is_default('company') ? true : me.apply_filter(tl, "company")) {
|
if (me.is_default('company') ? true : me.apply_filter(tl, "company")) {
|
||||||
var posting_date = dateutil.str_to_obj(tl.posting_date);
|
var posting_date = dateutil.str_to_obj(tl.posting_date);
|
||||||
if (posting_date >= from_date && posting_date <= to_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'];
|
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);
|
item[me.column_map[tl.posting_date].field] += (is_val ? tl.amount : tl.qty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,6 +134,7 @@ data_map = {
|
|||||||
"warehouse": ["Warehouse", "name"]
|
"warehouse": ["Warehouse", "name"]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
"Sales Order Item": {
|
"Sales Order Item": {
|
||||||
"columns": ["item_code", "(ifnull(qty, 0) - ifnull(delivered_qty, 0)) as qty",
|
"columns": ["item_code", "(ifnull(qty, 0) - ifnull(delivered_qty, 0)) as qty",
|
||||||
"reserved_warehouse as warehouse"],
|
"reserved_warehouse as warehouse"],
|
||||||
@ -185,6 +186,42 @@ data_map = {
|
|||||||
"item_code": ["Item", "name"]
|
"item_code": ["Item", "name"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Sales Order": {
|
||||||
|
"columns": ["name", "customer", "transaction_date as posting_date", "company"],
|
||||||
|
"conditions": ["docstatus=1"],
|
||||||
|
"order_by": "transaction_date",
|
||||||
|
"links": {
|
||||||
|
"customer": ["Customer", "name"],
|
||||||
|
"company":["Company", "name"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Sales Order Item[Sales Analytics]": {
|
||||||
|
"columns": ["parent", "item_code", "qty", "amount"],
|
||||||
|
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
||||||
|
"order_by": "parent",
|
||||||
|
"links": {
|
||||||
|
"parent": ["Sales Order", "name"],
|
||||||
|
"item_code": ["Item", "name"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Delivery Note": {
|
||||||
|
"columns": ["name", "customer", "posting_date", "company"],
|
||||||
|
"conditions": ["docstatus=1"],
|
||||||
|
"order_by": "posting_date",
|
||||||
|
"links": {
|
||||||
|
"customer": ["Customer", "name"],
|
||||||
|
"company":["Company", "name"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Delivery Note Item[Sales Analytics]": {
|
||||||
|
"columns": ["parent", "item_code", "qty", "amount"],
|
||||||
|
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
||||||
|
"order_by": "parent",
|
||||||
|
"links": {
|
||||||
|
"parent": ["Delivery Note", "name"],
|
||||||
|
"item_code": ["Item", "name"]
|
||||||
|
}
|
||||||
|
},
|
||||||
"Supplier": {
|
"Supplier": {
|
||||||
"columns": ["name", "if(supplier_name=name, '', supplier_name) as supplier_name",
|
"columns": ["name", "if(supplier_name=name, '', supplier_name) as supplier_name",
|
||||||
"supplier_type as parent_supplier_type"],
|
"supplier_type as parent_supplier_type"],
|
||||||
@ -217,7 +254,42 @@ data_map = {
|
|||||||
"item_code": ["Item", "name"]
|
"item_code": ["Item", "name"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Purchase Order": {
|
||||||
|
"columns": ["name", "supplier", "transaction_date as posting_date", "company"],
|
||||||
|
"conditions": ["docstatus=1"],
|
||||||
|
"order_by": "posting_date",
|
||||||
|
"links": {
|
||||||
|
"supplier": ["Supplier", "name"],
|
||||||
|
"company":["Company", "name"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Purchase Order Item[Purchase Analytics]": {
|
||||||
|
"columns": ["parent", "item_code", "qty", "amount"],
|
||||||
|
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
||||||
|
"order_by": "parent",
|
||||||
|
"links": {
|
||||||
|
"parent": ["Purchase Order", "name"],
|
||||||
|
"item_code": ["Item", "name"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Purchase Receipt": {
|
||||||
|
"columns": ["name", "supplier", "posting_date", "company"],
|
||||||
|
"conditions": ["docstatus=1"],
|
||||||
|
"order_by": "posting_date",
|
||||||
|
"links": {
|
||||||
|
"supplier": ["Supplier", "name"],
|
||||||
|
"company":["Company", "name"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Purchase Receipt Item[Purchase Analytics]": {
|
||||||
|
"columns": ["parent", "item_code", "qty", "amount"],
|
||||||
|
"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
|
||||||
|
"order_by": "parent",
|
||||||
|
"links": {
|
||||||
|
"parent": ["Purchase Receipt", "name"],
|
||||||
|
"item_code": ["Item", "name"]
|
||||||
|
}
|
||||||
|
},
|
||||||
# Support
|
# Support
|
||||||
"Support Ticket": {
|
"Support Ticket": {
|
||||||
"columns": ["name","status","creation","resolution_date","first_responded_on"],
|
"columns": ["name","status","creation","resolution_date","first_responded_on"],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user