[grid reports] now show by wn.route_options

This commit is contained in:
Rushabh Mehta 2013-07-01 14:35:57 +05:30
parent affba2fd99
commit 36af6a02ad
7 changed files with 40 additions and 26 deletions

View File

@ -92,7 +92,12 @@ cur_frm.cscript.add_toolbar_buttons = function(doc) {
function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet') function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet')
cur_frm.add_custom_button('View Ledger', function() { cur_frm.add_custom_button('View Ledger', function() {
wn.set_route("general-ledger", "account=" + doc.name); wn.route_options = {
"account": doc.name,
"from_date": sys_defaults.year_start_date,
"to_date": sys_defaults.year_end_date
};
wn.set_route("general-ledger");
}); });
} }
} }

View File

@ -23,7 +23,14 @@ cur_frm.cscript.refresh = function(doc) {
erpnext.hide_naming_series(); erpnext.hide_naming_series();
cur_frm.cscript.voucher_type(doc); cur_frm.cscript.voucher_type(doc);
if(doc.docstatus==1) { if(doc.docstatus==1) {
cur_frm.add_custom_button('View Ledger', cur_frm.cscript.view_ledger_entry); cur_frm.add_custom_button('View Ledger', function() {
wn.route_options = {
"voucher_no": doc.name,
"from_date": doc.posting_date,
"to_date": doc.posting_date,
};
wn.set_route("general-ledger");
});
} }
} }
@ -131,11 +138,6 @@ cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
cur_frm.pformat.print_heading = "Journal Voucher"; cur_frm.pformat.print_heading = "Journal Voucher";
} }
cur_frm.cscript.view_ledger_entry = function(doc,cdt,cdn){
wn.set_route('Report', 'GL Entry', 'General Ledger', 'Voucher No='+cur_frm.doc.name);
}
cur_frm.cscript.voucher_type = function(doc, cdt, cdn) { cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
cur_frm.set_df_property("cheque_no", "reqd", doc.voucher_type=="Bank Voucher"); cur_frm.set_df_property("cheque_no", "reqd", doc.voucher_type=="Bank Voucher");
cur_frm.set_df_property("cheque_date", "reqd", doc.voucher_type=="Bank Voucher"); cur_frm.set_df_property("cheque_date", "reqd", doc.voucher_type=="Bank Voucher");

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-02-22 01:27:39", "creation": "2013-02-22 01:27:39",
"docstatus": 0, "docstatus": 0,
"modified": "2013-04-17 14:05:18", "modified": "2013-07-01 13:53:33",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -74,11 +74,12 @@
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "balance", "fieldname": "balance",
"fieldtype": "Data", "fieldtype": "Currency",
"label": "Account Balance", "label": "Account Balance",
"no_copy": 1, "no_copy": 1,
"oldfieldname": "balance", "oldfieldname": "balance",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"options": "Company:company:default_currency",
"read_only": 1 "read_only": 1
}, },
{ {

View File

@ -42,7 +42,14 @@ erpnext.accounts.PurchaseInvoiceController = erpnext.buying.BuyingController.ext
this.frm.add_custom_button('Make Payment Entry', this.make_bank_voucher); this.frm.add_custom_button('Make Payment Entry', this.make_bank_voucher);
if(doc.docstatus==1) { if(doc.docstatus==1) {
this.frm.add_custom_button('View Ledger', this.view_ledger_entry); cur_frm.add_custom_button('View Ledger', function() {
wn.route_options = {
"voucher_no": doc.name,
"from_date": doc.posting_date,
"to_date": doc.posting_date,
};
wn.set_route("general-ledger");
});
} }
this.is_opening(doc); this.is_opening(doc);
@ -227,7 +234,3 @@ cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
else else
cur_frm.pformat.print_heading = "Purchase Invoice"; cur_frm.pformat.print_heading = "Purchase Invoice";
} }
cur_frm.cscript.view_ledger_entry = function(){
wn.set_route('Report', 'GL Entry', 'General Ledger', 'Voucher No='+cur_frm.doc.name);
}

View File

@ -45,7 +45,15 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
cur_frm.cscript.is_opening(doc, dt, dn); cur_frm.cscript.is_opening(doc, dt, dn);
if(doc.docstatus==1) { if(doc.docstatus==1) {
cur_frm.add_custom_button('View Ledger', cur_frm.cscript.view_ledger_entry); cur_frm.add_custom_button('View Ledger', function() {
wn.route_options = {
"voucher_no": doc.name,
"from_date": doc.posting_date,
"to_date": doc.posting_date,
};
wn.set_route("general-ledger");
});
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms); cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
if(doc.is_pos==1 && doc.update_stock!=1) if(doc.is_pos==1 && doc.update_stock!=1)
@ -381,11 +389,6 @@ cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
} }
/****************** Get Accounting Entry *****************/
cur_frm.cscript.view_ledger_entry = function(){
wn.set_route('Report', 'GL Entry', 'General Ledger', 'Voucher No='+cur_frm.doc.name);
}
cur_frm.cscript.on_submit = function(doc, cdt, cdn) { cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
if(cint(wn.boot.notification_settings.sales_invoice)) { if(cint(wn.boot.notification_settings.sales_invoice)) {
cur_frm.email_doc(wn.boot.notification_settings.sales_invoice_message); cur_frm.email_doc(wn.boot.notification_settings.sales_invoice_message);

View File

@ -110,7 +110,7 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
// filter accounts options by company // filter accounts options by company
this.filter_inputs.company.change(function() { this.filter_inputs.company.change(function() {
me.setup_account_filter(this); me.setup_account_filter(this);
me.set_route() me.refresh()
}); });
this.filter_inputs.account.change(function() { this.filter_inputs.account.change(function() {
@ -220,13 +220,15 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
} }
} }
if(date < from_date || item.is_opening=="Yes") { if(!me.voucher_no && (date < from_date || item.is_opening=="Yes")) {
opening.debit += item.debit; opening.debit += item.debit;
opening.credit += item.credit; opening.credit += item.credit;
grouped_ledgers[item.account].opening.debit += item.debit; grouped_ledgers[item.account].opening.debit += item.debit;
grouped_ledgers[item.account].opening.credit += item.credit; grouped_ledgers[item.account].opening.credit += item.credit;
} else if(date <= to_date) { } else if(date <= to_date) {
totals.debit += item.debit; totals.debit += item.debit;
totals.credit += item.credit; totals.credit += item.credit;
@ -242,7 +244,7 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
+ item.voucher_no][(item.debit > 0 ? "credits" : "debits")].join(", "); + item.voucher_no][(item.debit > 0 ? "credits" : "debits")].join(", ");
} }
if(me.apply_filters(item) && item.is_opening=="No") { if(me.apply_filters(item) && (me.voucher_no || item.is_opening=="No")) {
out.push(item); out.push(item);
grouped_ledgers[item.account].entries.push(item); grouped_ledgers[item.account].entries.push(item);

View File

@ -48,8 +48,6 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
return { return {
"query": "accounts.utils.get_account_list", "query": "accounts.utils.get_account_list",
"filters": { "filters": {
"is_pl_account": "Yes",
"debit_or_credit": "Debit",
"company": me.frm.doc.company "company": me.frm.doc.company
} }
} }