mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-16 11:39:18 +00:00
Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
@@ -135,8 +135,7 @@ erpnext.AccountsChart = Class.extend({
|
|||||||
show_ledger: function() {
|
show_ledger: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
var node = me.selected_node();
|
var node = me.selected_node();
|
||||||
wn.set_route('Report', 'GL Entry', 'General Ledger',
|
wn.set_route("general-ledger", "account=" + node.data('label'));
|
||||||
this.ctype + '=' + node.data('label'));
|
|
||||||
},
|
},
|
||||||
new_node: function() {
|
new_node: function() {
|
||||||
if(this.ctype=='Account') {
|
if(this.ctype=='Account') {
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
|
|||||||
open_btn: true,
|
open_btn: true,
|
||||||
doctype: "'Account'"
|
doctype: "'Account'"
|
||||||
}},
|
}},
|
||||||
|
{id: "against_accont", name: "Against Account", field: "against_account",
|
||||||
|
width: 240, hidden: this.is_default("account")},
|
||||||
|
|
||||||
{id: "debit", name: "Debit", field: "debit", width: 100,
|
{id: "debit", name: "Debit", field: "debit", width: 100,
|
||||||
formatter: this.currency_formatter},
|
formatter: this.currency_formatter},
|
||||||
{id: "credit", name: "Credit", field: "credit", width: 100,
|
{id: "credit", name: "Credit", field: "credit", width: 100,
|
||||||
@@ -139,9 +142,11 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
|
|||||||
var data = wn.report_dump.data["GL Entry"];
|
var data = wn.report_dump.data["GL Entry"];
|
||||||
var out = [];
|
var out = [];
|
||||||
|
|
||||||
if(!this.account_by_name)
|
if(!this.account_by_name) {
|
||||||
this.account_by_name = this.make_name_map(wn.report_dump.data["Account"]);
|
this.account_by_name = this.make_name_map(wn.report_dump.data["Account"]);
|
||||||
|
this.make_voucher_acconuts_map();
|
||||||
|
}
|
||||||
|
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
var from_date = dateutil.str_to_obj(this.from_date);
|
var from_date = dateutil.str_to_obj(this.from_date);
|
||||||
@@ -167,7 +172,7 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
|
|||||||
: true) && (me.voucher_no ? item.voucher_no==me.voucher_no : true)) {
|
: true) && (me.voucher_no ? item.voucher_no==me.voucher_no : true)) {
|
||||||
var date = dateutil.str_to_obj(item.posting_date);
|
var date = dateutil.str_to_obj(item.posting_date);
|
||||||
|
|
||||||
if(date < from_date) {
|
if(date < from_date || item.is_opening=="Yes") {
|
||||||
opening.debit += item.debit;
|
opening.debit += item.debit;
|
||||||
opening.credit += item.credit;
|
opening.credit += item.credit;
|
||||||
} else if(date <= to_date) {
|
} else if(date <= to_date) {
|
||||||
@@ -175,7 +180,12 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
|
|||||||
totals.credit += item.credit;
|
totals.credit += item.credit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(me.apply_filters(item)) {
|
if(me.account) {
|
||||||
|
item.against_account = me.voucher_accounts[item.voucher_type + ":"
|
||||||
|
+ item.voucher_no][(item.debit > 0 ? "credits" : "debits")].join(", ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(me.apply_filters(item) && item.is_opening=="No") {
|
||||||
out.push(item);
|
out.push(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -189,6 +199,8 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
|
|||||||
|
|
||||||
|
|
||||||
if(!me.is_default("account")) {
|
if(!me.is_default("account")) {
|
||||||
|
me.appframe.set_title("General Ledger: " + me.account);
|
||||||
|
|
||||||
if(me.account_by_name[me.account].debit_or_credit == "Debit") {
|
if(me.account_by_name[me.account].debit_or_credit == "Debit") {
|
||||||
opening.debit -= opening.credit; opening.credit = 0;
|
opening.debit -= opening.credit; opening.credit = 0;
|
||||||
closing.debit -= closing.credit; closing.credit = 0;
|
closing.debit -= closing.credit; closing.credit = 0;
|
||||||
@@ -198,11 +210,34 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
|
|||||||
}
|
}
|
||||||
var out = [opening].concat(out).concat([totals, closing]);
|
var out = [opening].concat(out).concat([totals, closing]);
|
||||||
} else {
|
} else {
|
||||||
|
me.appframe.set_title("General Ledger");
|
||||||
var out = out.concat([totals]);
|
var out = out.concat([totals]);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.data = out;
|
this.data = out;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
make_voucher_acconuts_map: function() {
|
||||||
|
this.voucher_accounts = {};
|
||||||
|
var data = wn.report_dump.data["GL Entry"];
|
||||||
|
for(var i=0, j=data.length; i<j; i++) {
|
||||||
|
var gl = data[i];
|
||||||
|
|
||||||
|
if(!this.voucher_accounts[gl.voucher_type + ":" + gl.voucher_no])
|
||||||
|
this.voucher_accounts[gl.voucher_type + ":" + gl.voucher_no] = {
|
||||||
|
debits: [],
|
||||||
|
credits: []
|
||||||
|
}
|
||||||
|
|
||||||
|
var va = this.voucher_accounts[gl.voucher_type + ":" + gl.voucher_no];
|
||||||
|
if(gl.debit > 0) {
|
||||||
|
va.debits.push(gl.account);
|
||||||
|
} else {
|
||||||
|
va.credits.push(gl.account);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
get_plot_data: function() {
|
get_plot_data: function() {
|
||||||
var data = [];
|
var data = [];
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ erpnext.update_messages = function(reset) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
show_in_circle('unread_messages', r.message.unread_messages.length);
|
show_in_circle('unread_messages', r.message.unread_messages);
|
||||||
show_in_circle('open_support_tickets', r.message.open_support_tickets);
|
show_in_circle('open_support_tickets', r.message.open_support_tickets);
|
||||||
show_in_circle('things_todo', r.message.things_todo);
|
show_in_circle('things_todo', r.message.things_todo);
|
||||||
show_in_circle('todays_events', r.message.todays_events);
|
show_in_circle('todays_events', r.message.todays_events);
|
||||||
|
|||||||
@@ -87,18 +87,9 @@ erpnext.toolbar.add_modules = function() {
|
|||||||
|
|
||||||
erpnext.toolbar.set_new_comments = function(new_comments) {
|
erpnext.toolbar.set_new_comments = function(new_comments) {
|
||||||
var navbar_nc = $('.navbar-new-comments');
|
var navbar_nc = $('.navbar-new-comments');
|
||||||
if(wn.container.page && wn.container.page.page_name=="messages")
|
if(cint(new_comments)) {
|
||||||
return;
|
|
||||||
if(new_comments && new_comments.length>0) {
|
|
||||||
navbar_nc.text(new_comments.length);
|
|
||||||
navbar_nc.addClass('navbar-new-comments-true')
|
navbar_nc.addClass('navbar-new-comments-true')
|
||||||
$.each(new_comments, function(i, v) {
|
navbar_nc.text(new_comments);
|
||||||
var msg = 'New Message: ' + (v[1].length<=100 ? v[1] : (v[1].substr(0, 100) + "..."));
|
|
||||||
var id = v[0].replace('/', '-');
|
|
||||||
if(!$('#' + id)[0]) {
|
|
||||||
show_alert(msg).attr("id", id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
navbar_nc.removeClass('navbar-new-comments-true');
|
navbar_nc.removeClass('navbar-new-comments-true');
|
||||||
navbar_nc.text(0);
|
navbar_nc.text(0);
|
||||||
|
|||||||
@@ -20,12 +20,12 @@ import webnotes
|
|||||||
def get_unread_messages():
|
def get_unread_messages():
|
||||||
"returns unread (docstatus-0 messages for a user)"
|
"returns unread (docstatus-0 messages for a user)"
|
||||||
return webnotes.conn.sql("""\
|
return webnotes.conn.sql("""\
|
||||||
SELECT name, comment
|
SELECT count(*)
|
||||||
FROM `tabComment`
|
FROM `tabComment`
|
||||||
WHERE comment_doctype IN ('My Company', 'Message')
|
WHERE comment_doctype IN ('My Company', 'Message')
|
||||||
AND comment_docname = %s
|
AND comment_docname = %s
|
||||||
AND ifnull(docstatus,0)=0
|
AND ifnull(docstatus,0)=0
|
||||||
""", webnotes.user.name, as_list=1)
|
""", webnotes.user.name)[0][0]
|
||||||
|
|
||||||
def get_open_support_tickets():
|
def get_open_support_tickets():
|
||||||
"""Returns a count of open support tickets"""
|
"""Returns a count of open support tickets"""
|
||||||
|
|||||||
@@ -33,12 +33,14 @@ wn.pages.messages.onload = function(wrapper) {
|
|||||||
<div class="all-messages"></div>').appendTo($(wrapper).find('.layout-main-section'));
|
<div class="all-messages"></div>').appendTo($(wrapper).find('.layout-main-section'));
|
||||||
|
|
||||||
erpnext.messages = new erpnext.Messages(wrapper);
|
erpnext.messages = new erpnext.Messages(wrapper);
|
||||||
|
erpnext.toolbar.set_new_comments(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(wn.pages.messages).bind('show', function() {
|
$(wn.pages.messages).bind('show', function() {
|
||||||
// remove alerts
|
// remove alerts
|
||||||
$('#alert-container .alert').remove();
|
$('#alert-container .alert').remove();
|
||||||
|
|
||||||
|
erpnext.toolbar.set_new_comments(0);
|
||||||
erpnext.messages.show();
|
erpnext.messages.show();
|
||||||
setTimeout("erpnext.messages.refresh()", 17000);
|
setTimeout("erpnext.messages.refresh()", 17000);
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user