<commit_before>// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
// License: GNU General Public License v3. See license.txt

wn.pages['general-ledger'].onload = function(wrapper) { 
	wn.ui.make_app_page({
		parent: wrapper,
		title: wn._('General Ledger'),
		single_column: true
	});
	
	erpnext.general_ledger = new erpnext.GeneralLedger(wrapper);
	wrapper.appframe.add_module_icon("Accounts")

}

erpnext.GeneralLedger = wn.views.GridReport.extend({
	init: function(wrapper) {
		this._super({
			title: wn._("General Ledger"),
			page: wrapper,
			parent: $(wrapper).find('.layout-main'),
			appframe: wrapper.appframe,
			doctypes: ["Company", "Account", "GL Entry", "Cost Center"],
		});
	},
	setup_columns: function() {
		var DEFAULT_COMPANY_VALUE = wn._("Select Company...");
		this.columns = [
			{id: "posting_date", name: wn._("Posting Date"), field: "posting_date", width: 100,
				formatter: this.date_formatter},
			{id: "account", name: wn._("Account"), field: "account", width: 240, 	
				link_formatter: {
					filter_input: "account",
					open_btn: true,
					doctype: "'Account'"
				}},
			{id: "against_account", name: wn._("Against Account"), field: "against_account", 
				width: 240, hidden: !this.account},

			{id: "debit", name: wn._("Debit"), field: "debit", width: 100,
				formatter: this.currency_formatter},
			{id: "credit", name: wn._("Credit"), field: "credit", width: 100,
				formatter: this.currency_formatter},
			{id: "voucher_type", name: wn._("Voucher Type"), field: "voucher_type", width: 120},
			{id: "voucher_no", name: wn._("Voucher No"), field: "voucher_no", width: 160,
				link_formatter: {
					filter_input: "voucher_no",
					open_btn: true,
					doctype: "dataContext.voucher_type"
				}},
			{id: "remarks", name: wn._("Remarks"), field: "remarks", width: 200,
				formatter: this.text_formatter},
				
		];
	},
	
	filters: [
		{fieldtype:"Select", label: wn._("Company"), link:"Company", default_value: DEFAULT_COMPANY_VALUE,
			filter: function(val, item, opts) {
				return item.company == val || val == DEFAULT_COMPANY_VALUE;
			}},
		{fieldtype:"Link", label: wn._("Account"), link:"Account",
			filter: function(val, item, opts, me) {
				if(!val) {
					return true;
				} else {
					// true if GL Entry belongs to selected
					// account ledger or group
					return me.is_child_account(val, item.account);
				}
			}},
		{fieldtype:"Data", label: wn._("Voucher No"),
			filter: function(val, item, opts) {
				if(!val) return true;
				return (item.voucher_no && item.voucher_no.indexOf(val)!=-1);
			}},
		{fieldtype:"Date", label: wn._("From Date"), filter: function(val, item) {
			return dateutil.str_to_obj(val) <= dateutil.str_to_obj(item.posting_date);<commit_msg>[minor] fix in general ledger after translation merge<commit_after>// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
// License: GNU General Public License v3. See license.txt

wn.pages['general-ledger'].onload = function(wrapper) { 
	wn.ui.make_app_page({
		parent: wrapper,
		title: wn._('General Ledger'),
		single_column: true
	});
	
	erpnext.general_ledger = new erpnext.GeneralLedger(wrapper);
	wrapper.appframe.add_module_icon("Accounts")

}

erpnext.GeneralLedger = wn.views.GridReport.extend({
	init: function(wrapper) {
		this._super({
			title: wn._("General Ledger"),
			page: wrapper,
			parent: $(wrapper).find('.layout-main'),
			appframe: wrapper.appframe,
			doctypes: ["Company", "Account", "GL Entry", "Cost Center"],
		});
	},
	setup_columns: function() {
		this.columns = [
			{id: "posting_date", name: wn._("Posting Date"), field: "posting_date", width: 100,
				formatter: this.date_formatter},
			{id: "account", name: wn._("Account"), field: "account", width: 240, 	
				link_formatter: {
					filter_input: "account",
					open_btn: true,
					doctype: "'Account'"
				}},
			{id: "against_account", name: wn._("Against Account"), field: "against_account", 
				width: 240, hidden: !this.account},

			{id: "debit", name: wn._("Debit"), field: "debit", width: 100,
				formatter: this.currency_formatter},
			{id: "credit", name: wn._("Credit"), field: "credit", width: 100,
				formatter: this.currency_formatter},
			{id: "voucher_type", name: wn._("Voucher Type"), field: "voucher_type", width: 120},
			{id: "voucher_no", name: wn._("Voucher No"), field: "voucher_no", width: 160,
				link_formatter: {
					filter_input: "voucher_no",
					open_btn: true,
					doctype: "dataContext.voucher_type"
				}},
			{id: "remarks", name: wn._("Remarks"), field: "remarks", width: 200,
				formatter: this.text_formatter},
				
		];
	},
	
	filters: [
		{fieldtype:"Select", label: wn._("Company"), link:"Company", default_value: wn._("Select Company..."),
			filter: function(val, item, opts) {
				return item.company == val || val == opts.default_value;
			}},
		{fieldtype:"Link", label: wn._("Account"), link:"Account",
			filter: function(val, item, opts, me) {
				if(!val) {
					return true;
				} else {
					// true if GL Entry belongs to selected
					// account ledger or group
					return me.is_child_account(val, item.account);
				}
			}},
		{fieldtype:"Data", label: wn._("Voucher No"),
			filter: function(val, item, opts) {
				if(!val) return true;
				return (item.voucher_no && item.voucher_no.indexOf(val)!=-1);
			}},
		{fieldtype:"Date", label: wn._("From Date"), filter: function(val, item) {
			return dateutil.str_to_obj(val) <= dateutil.str_to_obj(item.posting_date);
{'fraction_non_alphanumeric': 0.17514641288433383, 'fraction_numerical': 0.010980966325036604, 'mean_word_length': 4.0368663594470044, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3512087', 'n_tokens_mistral': 2279, 'n_tokens_neox': 1885, 'n_words': 439}