last update
This commit is contained in:
parent
11bb520d32
commit
aeee6bae4a
@ -22,6 +22,9 @@ class DocType:
|
|||||||
self.doc, self.doclist = d,dl
|
self.doc, self.doclist = d,dl
|
||||||
|
|
||||||
def repost(self):
|
def repost(self):
|
||||||
|
if not self.doc.company:
|
||||||
|
msgprint("Please select company", raise_exception=1)
|
||||||
|
|
||||||
if not in_transaction:
|
if not in_transaction:
|
||||||
sql("start transaction")
|
sql("start transaction")
|
||||||
|
|
||||||
@ -100,9 +103,7 @@ class DocType:
|
|||||||
def post_entries(self):
|
def post_entries(self):
|
||||||
sql("LOCK TABLE `tabGL Entry` WRITE")
|
sql("LOCK TABLE `tabGL Entry` WRITE")
|
||||||
# post each gl entry (batch or complete)
|
# post each gl entry (batch or complete)
|
||||||
gle = sql("select name, account, debit, credit, is_opening, posting_date from `tabGL Entry` where fiscal_year=%s and ifnull(is_cancelled,'No')='No' and company=%s
|
gle = sql("select name, account, debit, credit, is_opening, posting_date from `tabGL Entry` where fiscal_year=%s and ifnull(is_cancelled,'No')='No' and company=%s", (self.doc.name, self.doc.company))
|
||||||
|
|
||||||
", (self.doc.name, self.doc.company))
|
|
||||||
account_details = {}
|
account_details = {}
|
||||||
|
|
||||||
cnt = 0
|
cnt = 0
|
||||||
|
@ -1,31 +1,45 @@
|
|||||||
report.customize_filters = function() {
|
report.customize_filters = function() {
|
||||||
this.hide_all_filters();
|
this.hide_all_filters();
|
||||||
|
|
||||||
this.add_filter({fieldname:'show_group_balance', label:'Show Group Balance', fieldtype:'Select', options:'Yes'+NEWLINE+'No',ignore : 1, parent:'Account', 'report_default':'No','in_first_page':1});
|
this.add_filter({fieldname:'show_group_ledger', label:'Show Group/Ledger', fieldtype:'Select', options:'Only Groups'+NEWLINE+'Only Ledgers'+NEWLINE+'Both But Without Group Balance'+NEWLINE+'Both With Balance',ignore : 1, parent:'Account', 'report_default':'Both With Balance','in_first_page':1,single_select:1});
|
||||||
this.add_filter({fieldname:'transaction_date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'Account', 'in_first_page':1});
|
|
||||||
|
this.add_filter({fieldname:'show_zero_balance', label:'Show Zero Balance', fieldtype:'Select', options:'Yes'+NEWLINE+'No',ignore : 1, parent:'Account', 'report_default':'Yes','in_first_page':1,single_select:1});
|
||||||
|
|
||||||
|
this.add_filter({fieldname:'transaction_date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'Account', 'in_first_page':1});
|
||||||
|
|
||||||
this.filter_fields_dict['Account'+FILTER_SEP +'Company'].df.filter_hide = 0;
|
this.filter_fields_dict['Account'+FILTER_SEP +'Company'].df.filter_hide = 0;
|
||||||
this.filter_fields_dict['Account'+FILTER_SEP +'From Date'].df.filter_hide = 0;
|
this.filter_fields_dict['Account'+FILTER_SEP +'From Date'].df.filter_hide = 0;
|
||||||
this.filter_fields_dict['Account'+FILTER_SEP +'To Date'].df.filter_hide = 0;
|
this.filter_fields_dict['Account'+FILTER_SEP +'To Date'].df.filter_hide = 0;
|
||||||
|
|
||||||
this.filter_fields_dict['Account'+FILTER_SEP +'From Date'].df['report_default'] = sys_defaults.year_start_date;
|
this.filter_fields_dict['Account'+FILTER_SEP +'From Date'].df['report_default'] = sys_defaults.year_start_date;
|
||||||
this.filter_fields_dict['Account'+FILTER_SEP +'To Date'].df['report_default'] = dateutil.obj_to_str(new Date());
|
this.filter_fields_dict['Account'+FILTER_SEP +'To Date'].df['report_default'] = dateutil.obj_to_str(new Date());
|
||||||
this.filter_fields_dict['Account'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
|
this.filter_fields_dict['Account'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
|
||||||
|
|
||||||
this.filter_fields_dict['Account'+FILTER_SEP +'From Date'].df.in_first_page = 1;
|
this.filter_fields_dict['Account'+FILTER_SEP +'From Date'].df.in_first_page = 1;
|
||||||
this.filter_fields_dict['Account'+FILTER_SEP +'To Date'].df.in_first_page = 1;
|
this.filter_fields_dict['Account'+FILTER_SEP +'To Date'].df.in_first_page = 1;
|
||||||
this.filter_fields_dict['Account'+FILTER_SEP +'Company'].df.in_first_page = 1;
|
this.filter_fields_dict['Account'+FILTER_SEP +'Company'].df.in_first_page = 1;
|
||||||
|
|
||||||
this.dt.set_no_limit(1);
|
this.dt.set_no_limit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
report.aftertableprint = function(t) {
|
report.aftertableprint = function(t) {
|
||||||
$yt(t,'*',1,{whiteSpace:'pre'});
|
$yt(t,'*',1,{whiteSpace:'pre'});
|
||||||
}
|
}
|
||||||
if(window.location.href.search('/v170/') != -1) {
|
|
||||||
this.mytabs.items['More Filters'].hide();
|
$dh(this.mytabs.tabs['More Filters']);
|
||||||
this.mytabs.items['Select Columns'].hide();
|
$dh(this.mytabs.tabs['Select Columns']);
|
||||||
} else {
|
|
||||||
$dh(this.mytabs.tabs['More Filters']);
|
report.get_query = function() {
|
||||||
$dh(this.mytabs.tabs['Select Columns']);
|
var g_or_l = this.get_filter('Account', 'Show Group/Ledger').get_value();
|
||||||
|
var comp = this.get_filter('Account', 'Company').get_value();
|
||||||
|
|
||||||
|
if (g_or_l == 'Only Ledgers') {
|
||||||
|
var q = "SELECT name FROM tabAccount WHERE group_or_ledger = 'Ledger' and company = '" + comp + "' and docstatus != 2 ORDER BY lft";
|
||||||
|
} else if (g_or_l == 'Only Groups') {
|
||||||
|
var q = "SELECT CONCAT( REPEAT(' ', COUNT(parent.name) - 1), node.name) AS name FROM tabAccount AS node,tabAccount AS parent WHERE (node.lft BETWEEN parent.lft AND parent.rgt) and node.group_or_ledger = 'Group' and node.company = '" + comp + "' and node.docstatus != 2 GROUP BY node.name ORDER BY node.lft";
|
||||||
|
} else {
|
||||||
|
var q = "SELECT CONCAT( REPEAT(' ', COUNT(parent.name) - 1), node.name) AS name FROM tabAccount AS node,tabAccount AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt and node.company = '" + comp + "' and node.docstatus != 2 GROUP BY node.name ORDER BY node.lft";
|
||||||
|
}
|
||||||
|
|
||||||
|
return q;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
# Columns
|
# Columns
|
||||||
#----------
|
#----------
|
||||||
cl = [['Account','Data', '200px'],['Debit/Credit', 'Data', '100px'], ['Group/Ledger', 'Data', '100px'], ['Is PL Account', 'Data', '100px'], ['Opening','Data', '100px'],['Debit', 'Data', '100px'],['Credit', 'Data', '100px'],['Closing', 'Data', '100px']]
|
cl = [['Account','Data', '200px'],['Debit/Credit', 'Data', '100px'], ['Group/Ledger', 'Data', '100px'], ['Is PL Account', 'Data', '100px'], ['Opening','Data', '100px'],['Debit', 'Data', '100px'],['Credit', 'Data', '100px'],['Closing', 'Data', '100px']]
|
||||||
@ -42,7 +41,7 @@ total_debit, total_credit = 0,0
|
|||||||
glc = get_obj('GL Control')
|
glc = get_obj('GL Control')
|
||||||
|
|
||||||
# Main logic
|
# Main logic
|
||||||
# ----------------
|
# ----------
|
||||||
for r in res:
|
for r in res:
|
||||||
# Fetch account details
|
# Fetch account details
|
||||||
acc = r[col_idx['Account']].strip()
|
acc = r[col_idx['Account']].strip()
|
||||||
@ -51,11 +50,11 @@ for r in res:
|
|||||||
r.append(acc_det[0][4])
|
r.append(acc_det[0][4])
|
||||||
r.append(acc_det[0][1])
|
r.append(acc_det[0][1])
|
||||||
|
|
||||||
# if group, check user input
|
#if shows group and ledger both but without group balance
|
||||||
if acc_det[0][4] == 'Group' and filter_values.get('show_group_balance') == 'No':
|
if filter_values.get('show_group_ledger') == 'Both But Without Group Balance' and acc_det[0][4] == 'Group':
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
r.append('')
|
r.append('')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# opening balance
|
# opening balance
|
||||||
if from_date_year:
|
if from_date_year:
|
||||||
@ -70,7 +69,7 @@ for r in res:
|
|||||||
if from_date_year == to_date_year:
|
if from_date_year == to_date_year:
|
||||||
debit = flt(debit_on_todate) - flt(debit_on_fromdate)
|
debit = flt(debit_on_todate) - flt(debit_on_fromdate)
|
||||||
credit = flt(credit_on_todate) - flt(credit_on_fromdate)
|
credit = flt(credit_on_todate) - flt(credit_on_fromdate)
|
||||||
else: # may be wrong
|
else: # if from date is start date of the year
|
||||||
debit = flt(debit_on_todate)
|
debit = flt(debit_on_todate)
|
||||||
credit = flt(credit_on_todate)
|
credit = flt(credit_on_todate)
|
||||||
|
|
||||||
@ -89,20 +88,18 @@ for r in res:
|
|||||||
r.append(flt(closing))
|
r.append(flt(closing))
|
||||||
|
|
||||||
|
|
||||||
# Remove accounts if closing bal = debit = credit = 0
|
|
||||||
# -----------------------------------------------------
|
|
||||||
|
|
||||||
out =[]
|
out =[]
|
||||||
for r in res:
|
for r in res:
|
||||||
if r[col_idx['Opening']] or r[col_idx['Debit']] or r[col_idx['Credit']] or r[col_idx['Closing']]:
|
# Remove accounts if opening bal = debit = credit = closing bal = 0
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
if filter_values.get('show_zero_balance') != 'No':
|
||||||
out.append(r)
|
out.append(r)
|
||||||
|
elif r[col_idx['Opening']] or r[col_idx['Debit']] or r[col_idx['Credit']] or r[col_idx['Closing']] or (r[col_idx['Group/Ledger']] == 'Group' and filter_values.get('show_group_ledger') == 'Both But Without Group Balance'):
|
||||||
if r[col_idx['Group/Ledger']] == 'Group' and filter_values.get('show_group_balance') == 'No':
|
|
||||||
out.append(r)
|
out.append(r)
|
||||||
|
|
||||||
# Total Debit / Credit
|
# Total Debit / Credit
|
||||||
# --------------------------
|
# --------------------------
|
||||||
if filter_values.get('show_group_balance') == 'No':
|
if filter_values.get('show_group_ledger') in ['Only Ledgers', 'Both But Without Group Balance']:
|
||||||
t_row = ['' for i in range(len(colnames))]
|
t_row = ['' for i in range(len(colnames))]
|
||||||
t_row[col_idx['Account']] = 'Total'
|
t_row[col_idx['Account']] = 'Total'
|
||||||
t_row[col_idx['Debit']] = total_debit
|
t_row[col_idx['Debit']] = total_debit
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
'add_col': None,
|
'add_col': None,
|
||||||
'add_cond': '',
|
'add_cond': None,
|
||||||
'add_tab': None,
|
'add_tab': None,
|
||||||
'columns': 'Account\x01ID',
|
'columns': 'Account\x01ID',
|
||||||
'creation': '2010-12-14 10:33:08',
|
'creation': '2010-12-14 10:23:28',
|
||||||
'criteria_name': 'Trial Balance',
|
'criteria_name': 'Trial Balance',
|
||||||
'custom_query': None,
|
'custom_query': '',
|
||||||
'description': 'Trial Balance',
|
'description': 'Trial Balance',
|
||||||
'dis_filters': 'transaction_date',
|
'dis_filters': 'transaction_date',
|
||||||
'disabled': None,
|
'disabled': None,
|
||||||
'doc_type': 'Account',
|
'doc_type': 'Account',
|
||||||
'docstatus': 0,
|
'docstatus': 0,
|
||||||
'doctype': 'Search Criteria',
|
'doctype': 'Search Criteria',
|
||||||
'filters': "{'Account\x01Group or Ledger':'Ledger','Account\x01Is PL Account':'','Account\x01Account Type':'','Account\x01Show Group Balance':''}",
|
'filters': "{'Account\x01Is PL Account':'','Account\x01Account Type':''}",
|
||||||
'graph_series': None,
|
'graph_series': None,
|
||||||
'graph_values': None,
|
'graph_values': None,
|
||||||
'group_by': None,
|
'group_by': None,
|
||||||
'idx': None,
|
'idx': None,
|
||||||
'modified': '2010-11-25 12:25:28',
|
'modified': '2011-06-22 12:29:43',
|
||||||
'modified_by': 'Administrator',
|
'modified_by': 'Administrator',
|
||||||
'module': 'Accounts',
|
'module': 'Accounts',
|
||||||
'name': 'trial_balance',
|
'name': 'trial_balance',
|
||||||
@ -34,4 +34,4 @@
|
|||||||
'sort_order': 'DESC',
|
'sort_order': 'DESC',
|
||||||
'standard': 'Yes'
|
'standard': 'Yes'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -259,18 +259,7 @@ class DocType:
|
|||||||
if sll:
|
if sll:
|
||||||
sql("update `tabBin` set valuation_rate=%s, actual_qty=%s, stock_value = %s where name=%s", \
|
sql("update `tabBin` set valuation_rate=%s, actual_qty=%s, stock_value = %s where name=%s", \
|
||||||
(flt(val_rate), cqty, flt(stock_val), self.doc.name))
|
(flt(val_rate), cqty, flt(stock_val), self.doc.name))
|
||||||
|
|
||||||
# item re-order
|
|
||||||
# -------------
|
|
||||||
def reorder_item(self):
|
|
||||||
projected_qty = flt(self.doc.actual_qty) + flt(self.doc.indented_qty) + flt(self.doc.ordered_qty)
|
|
||||||
item_reorder_level = sql("select reorder_level from `%sItem` where name = '%s'" % (self.prefix, self.doc.item_code))[0][0] or 0
|
|
||||||
if flt(item_reorder_level) > flt(projected_qty):
|
|
||||||
msgprint("Item: " + self.doc.item_code + " is to be re-ordered. Indent raised (Not Implemented).")
|
|
||||||
|
|
||||||
# validate
|
|
||||||
def validate(self):
|
|
||||||
self.validate_mandatory()
|
|
||||||
|
|
||||||
# item re-order
|
# item re-order
|
||||||
# -------------
|
# -------------
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# REMEMBER to update this
|
# REMEMBER to update this
|
||||||
# ========================
|
# ========================
|
||||||
last_patch = 291
|
last_patch = 292
|
||||||
|
|
||||||
#-------------------------------------------
|
#-------------------------------------------
|
||||||
|
|
||||||
@ -1161,5 +1161,6 @@ def execute(patch_no):
|
|||||||
md.module_label = 'Home'
|
md.module_label = 'Home'
|
||||||
md.save(1)
|
md.save(1)
|
||||||
elif patch_no == 291:
|
elif patch_no == 291:
|
||||||
relaod_doc('tools','doctype','rename_tool')
|
reload_doc('tools','doctype','rename_tool')
|
||||||
|
elif patch_no == 292:
|
||||||
|
reload_doc('accounts', 'search_criteria', 'trial_balance')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user