mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 03:39:11 +00:00
Merge branch 'responsive' of git://github.com/webnotes/erpnext into responsive
This commit is contained in:
@@ -82,7 +82,7 @@ cur_frm.cscript.account_type = function(doc, cdt, cdn) {
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.add_toolbar_buttons = function(doc) {
|
||||
cur_frm.add_custom_button('Chart of Accounts',
|
||||
function() { wn.set_route("Accounts Browser", "Account"); }, 'icon-list')
|
||||
function() { wn.set_route("Accounts Browser", "Account"); }, 'icon-sitemap')
|
||||
|
||||
if (cstr(doc.group_or_ledger) == 'Group') {
|
||||
cur_frm.add_custom_button('Convert to Ledger',
|
||||
@@ -92,7 +92,12 @@ cur_frm.cscript.add_toolbar_buttons = function(doc) {
|
||||
function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet')
|
||||
|
||||
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");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,9 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
|
||||
cur_frm.toggle_display('sb1', doc.group_or_ledger=='Ledger')
|
||||
cur_frm.set_intro(intro_txt);
|
||||
|
||||
cur_frm.add_custom_button('Chart of Cost Centers',
|
||||
function() { wn.set_route("Accounts Browser", "Cost Center"); }, 'icon-sitemap')
|
||||
}
|
||||
|
||||
//Account filtering for cost center
|
||||
|
||||
@@ -23,7 +23,14 @@ cur_frm.cscript.refresh = function(doc) {
|
||||
erpnext.hide_naming_series();
|
||||
cur_frm.cscript.voucher_type(doc);
|
||||
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");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,8 +56,6 @@ cur_frm.cscript.is_opening = function(doc, cdt, cdn) {
|
||||
if (doc.is_opening == 'Yes') unhide_field('aging_date');
|
||||
}
|
||||
|
||||
//Set debit and credit to zero on adding new row
|
||||
//----------------------------------------------
|
||||
cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
|
||||
var d = locals[cdt][cdn];
|
||||
if(d.idx == 1){
|
||||
@@ -59,9 +64,6 @@ cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
|
||||
}
|
||||
}
|
||||
|
||||
// Get Outstanding of Payable & Sales Invoice
|
||||
// -----------------------------------------------
|
||||
|
||||
cur_frm.cscript.against_voucher = function(doc,cdt,cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.against_voucher && !flt(d.debit)) {
|
||||
@@ -131,18 +133,24 @@ cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
|
||||
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.set_df_property("cheque_no", "reqd", doc.voucher_type=="Bank Voucher");
|
||||
cur_frm.set_df_property("cheque_date", "reqd", doc.voucher_type=="Bank Voucher");
|
||||
|
||||
if(wn.model.get("Journal Voucher Detail", {"parent":doc.name}).length!==0 // too late
|
||||
|| !doc.company) // too early
|
||||
return;
|
||||
|
||||
if(in_list(["Bank Voucher", "Cash Voucher"], doc.voucher_type)
|
||||
&& doc.company
|
||||
&& wn.model.get("Journal Voucher Detail", {"parent":doc.name}).length==0) {
|
||||
var update_jv_details = function(doc, r) {
|
||||
$.each(r.message, function(i, d) {
|
||||
var jvdetail = wn.model.add_child(doc, "Journal Voucher Detail", "entries");
|
||||
jvdetail.account = d.account;
|
||||
jvdetail.balance = d.balance;
|
||||
});
|
||||
refresh_field("entries");
|
||||
}
|
||||
|
||||
if(in_list(["Bank Voucher", "Cash Voucher"], doc.voucher_type)) {
|
||||
wn.call({
|
||||
type: "GET",
|
||||
method: "accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
|
||||
@@ -152,14 +160,26 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
|
||||
},
|
||||
callback: function(r) {
|
||||
if(r.message) {
|
||||
var jvdetail = wn.model.add_child(doc, "Journal Voucher Detail", "entries");
|
||||
jvdetail.account = r.message.account;
|
||||
// this is a data field????
|
||||
jvdetail.balance = format_currency(r.message.balance);
|
||||
refresh_field("entries");
|
||||
update_jv_details(doc, r);
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if(doc.voucher_type=="Opening Entry") {
|
||||
wn.call({
|
||||
type:"GET",
|
||||
method: "accounts.doctype.journal_voucher.journal_voucher.get_opening_accounts",
|
||||
args: {
|
||||
"company": doc.company
|
||||
},
|
||||
callback: function(r) {
|
||||
wn.model.clear_table("Journal Voucher Detail", "Journal Voucher",
|
||||
doc.name, "entries");
|
||||
if(r.message) {
|
||||
update_jv_details(doc, r);
|
||||
}
|
||||
cur_frm.set_value("is_opening", "Yes")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -352,11 +352,20 @@ def get_default_bank_cash_account(company, voucher_type):
|
||||
account = webnotes.conn.get_value("Company", company,
|
||||
voucher_type=="Bank Voucher" and "default_bank_account" or "default_cash_account")
|
||||
if account:
|
||||
return {
|
||||
return [{
|
||||
"account": account,
|
||||
"balance": get_balance_on(account)
|
||||
}
|
||||
}]
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_opening_accounts(company):
|
||||
"""get all balance sheet accounts for opening entry"""
|
||||
from accounts.utils import get_balance_on
|
||||
accounts = webnotes.conn.sql_list("""select name from tabAccount
|
||||
where group_or_ledger='Ledger' and is_pl_account='No' and company=%s""", company)
|
||||
|
||||
return [{"account": a, "balance": get_balance_on(a)} for a in accounts]
|
||||
|
||||
def get_against_purchase_invoice(doctype, txt, searchfield, start, page_len, filters):
|
||||
return webnotes.conn.sql("""select name, credit_to, outstanding_amount, bill_no, bill_date
|
||||
from `tabPurchase Invoice` where credit_to = %s and docstatus = 1
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-03-25 10:53:52",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-06-11 16:04:20",
|
||||
"modified": "2013-06-28 14:27:11",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -68,7 +68,7 @@
|
||||
"label": "Voucher Type",
|
||||
"oldfieldname": "voucher_type",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nJournal Entry\nBank Voucher\nCash Voucher\nCredit Card Voucher\nDebit Note\nCredit Note\nContra Voucher\nExcise Voucher\nWrite Off Voucher",
|
||||
"options": "\nJournal Entry\nBank Voucher\nCash Voucher\nCredit Card Voucher\nDebit Note\nCredit Note\nContra Voucher\nExcise Voucher\nWrite Off Voucher\nOpening Entry",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"search_index": 1
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:39",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-04-17 14:05:18",
|
||||
"modified": "2013-07-01 13:53:33",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -74,11 +74,12 @@
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "balance",
|
||||
"fieldtype": "Data",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Account Balance",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "balance",
|
||||
"oldfieldtype": "Data",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
|
||||
@@ -42,7 +42,14 @@ erpnext.accounts.PurchaseInvoiceController = erpnext.buying.BuyingController.ext
|
||||
this.frm.add_custom_button('Make Payment Entry', this.make_bank_voucher);
|
||||
|
||||
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);
|
||||
@@ -226,8 +233,4 @@ cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
|
||||
}
|
||||
else
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,15 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
cur_frm.cscript.is_opening(doc, dt, dn);
|
||||
|
||||
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);
|
||||
|
||||
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) {
|
||||
if(cint(wn.boot.notification_settings.sales_invoice)) {
|
||||
cur_frm.email_doc(wn.boot.notification_settings.sales_invoice_message);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
wn.module_page["Accounts"] = [
|
||||
{
|
||||
top: true,
|
||||
title: wn._("Documents"),
|
||||
icon: "icon-copy",
|
||||
items: [
|
||||
|
||||
@@ -22,10 +22,7 @@ wn.pages['general-ledger'].onload = function(wrapper) {
|
||||
});
|
||||
|
||||
erpnext.general_ledger = new erpnext.GeneralLedger(wrapper);
|
||||
|
||||
wrapper.appframe.add_home_breadcrumb()
|
||||
wrapper.appframe.add_module_icon("Accounts")
|
||||
wrapper.appframe.add_breadcrumb("icon-bar-chart")
|
||||
|
||||
}
|
||||
|
||||
@@ -110,7 +107,7 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
|
||||
// filter accounts options by company
|
||||
this.filter_inputs.company.change(function() {
|
||||
me.setup_account_filter(this);
|
||||
me.set_route()
|
||||
me.refresh()
|
||||
});
|
||||
|
||||
this.filter_inputs.account.change(function() {
|
||||
@@ -220,13 +217,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.credit += item.credit;
|
||||
|
||||
grouped_ledgers[item.account].opening.debit += item.debit;
|
||||
grouped_ledgers[item.account].opening.credit += item.credit;
|
||||
|
||||
} else if(date <= to_date) {
|
||||
|
||||
totals.debit += item.debit;
|
||||
totals.credit += item.credit;
|
||||
|
||||
@@ -242,7 +241,7 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
|
||||
+ 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);
|
||||
grouped_ledgers[item.account].entries.push(item);
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ wn.pages['voucher-import-tool'].onload = function(wrapper) {
|
||||
<p class="help">Import multiple accounting entries via CSV (spreadsheet) file:</p>\
|
||||
<h3>1. Download Template</h3><br>\
|
||||
<div style="padding-left: 30px;">\
|
||||
<button class="btn btn-download-two-accounts">Download</button>\
|
||||
<button class="btn btn-default btn-download-two-accounts">Download</button>\
|
||||
<p class="help">Import multiple vouchers with one debit and one credit entry</p>\
|
||||
</div>\
|
||||
<div style="padding-left: 30px;">\
|
||||
<button class="btn btn-download-multiple-accounts">Download</button>\
|
||||
<button class="btn btn-default btn-download-multiple-accounts">Download</button>\
|
||||
<p class="help">Import multiple vouchers with multiple accounts</p>\
|
||||
</div>\
|
||||
<hr>\
|
||||
|
||||
Reference in New Issue
Block a user