fixed conflict
This commit is contained in:
commit
3cb148e53b
@ -44,9 +44,9 @@ $.extend(cur_frm.cscript, {
|
||||
},
|
||||
hide_show_buttons: function(doc) {
|
||||
if(doc.docstatus==0) {
|
||||
hide_field('Installment Reciept'); show_field('Generate');
|
||||
hide_field('installment_reciept'); show_field('generate');
|
||||
} else if (doc.docstatus==1) {
|
||||
show_field('Installment Reciept');hide_field('Generate');
|
||||
show_field('installment_reciept');hide_field('generate');
|
||||
}
|
||||
},
|
||||
clear_installments: function(doc) {
|
||||
|
@ -8,35 +8,35 @@
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
//========================== On Load =================================================
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date());
|
||||
if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date());
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
hide_field('Repost Account Balances');
|
||||
hide_field('next_fiscal_year');
|
||||
hide_field('Repost');
|
||||
hide_field('repost_account_balances');
|
||||
hide_field('next_fiscal_year');
|
||||
hide_field('repost');
|
||||
|
||||
if (doc.docstatus == 1) {
|
||||
unhide_field('Repost Account Balances');
|
||||
unhide_field('next_fiscal_year');
|
||||
unhide_field('Repost');
|
||||
}
|
||||
if (doc.docstatus == 1) {
|
||||
unhide_field('repost_account_balances');
|
||||
unhide_field('next_fiscal_year');
|
||||
unhide_field('repost');
|
||||
}
|
||||
}
|
||||
|
||||
// ***************** Get Account Head *****************
|
||||
cur_frm.fields_dict['closing_account_head'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.is_pl_account = "No" AND `tabAccount`.debit_or_credit = "Credit" AND `tabAccount`.company = "'+ cstr(doc.company) +'" AND `tabAccount`.freeze_account = "No" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name ASC LIMIT 50';
|
||||
return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.is_pl_account = "No" AND `tabAccount`.debit_or_credit = "Credit" AND `tabAccount`.company = "'+ cstr(doc.company) +'" AND `tabAccount`.freeze_account = "No" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name ASC LIMIT 50';
|
||||
}
|
||||
|
||||
cur_frm.cscript.acc_help = function(doc,dt,dn){
|
||||
show_chart_browser('Accounts Browser','Account');
|
||||
}
|
||||
show_chart_browser('Accounts Browser','Account');
|
||||
}
|
||||
|
@ -8,47 +8,47 @@
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||
$c_obj(make_doclist(cdt,cdn),'get_series','',function(r,rt){
|
||||
if(r.message) set_field_options('naming_series', r.message);
|
||||
});
|
||||
$c_obj(make_doclist(cdt,cdn),'get_series','',function(r,rt){
|
||||
if(r.message) set_field_options('naming_series', r.message);
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//cash bank account
|
||||
//------------------------------------
|
||||
cur_frm.fields_dict['cash_bank_account'].get_query = function(doc,cdt,cdn) {
|
||||
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
|
||||
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
|
||||
}
|
||||
|
||||
// Income Account
|
||||
// --------------------------------
|
||||
cur_frm.fields_dict['income_account'].get_query = function(doc,cdt,cdn) {
|
||||
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.account_type ="Income Account" AND tabAccount.%(key)s LIKE "%s"'
|
||||
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.account_type ="Income Account" AND tabAccount.%(key)s LIKE "%s"'
|
||||
}
|
||||
|
||||
|
||||
// Cost Center
|
||||
// -----------------------------
|
||||
cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) {
|
||||
return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50';
|
||||
return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50';
|
||||
}
|
||||
|
||||
//get query select Territory
|
||||
//=================================================================
|
||||
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
||||
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
|
||||
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
|
||||
}
|
||||
|
||||
|
||||
// ------------------ Get Print Heading ------------------------------------
|
||||
cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
|
||||
return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
|
||||
}
|
||||
|
@ -29,10 +29,10 @@ cur_frm.cscript.onload = function(doc,dt,dn) {
|
||||
if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
|
||||
|
||||
if(cp.country == 'India') {
|
||||
unhide_field(['TDS','tds_applicable','tds_category','Get TDS','tax_code','rate','ded_amount','total_tds_on_voucher','tds_amount_on_advance']);
|
||||
unhide_field(['tds','tds_applicable','tds_category','get_tds','tax_code','rate','ded_amount','total_tds_on_voucher','tds_amount_on_advance']);
|
||||
}
|
||||
else {
|
||||
hide_field(['TDS','tds_applicable','tds_category','Get TDS','tax_code','rate','ded_amount','total_tds_on_voucher','tds_amount_on_advance']);
|
||||
hide_field(['tds','tds_applicable','tds_category','get_tds','tax_code','rate','ded_amount','total_tds_on_voucher','tds_amount_on_advance']);
|
||||
}
|
||||
|
||||
if(doc.__islocal){
|
||||
@ -69,9 +69,9 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||
cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript.make_bank_voucher);
|
||||
|
||||
if(doc.docstatus==1) {
|
||||
unhide_field(['Repair Outstanding Amt']);
|
||||
unhide_field(['repair_outstanding_amt']);
|
||||
cur_frm.add_custom_button('View Ledger', cur_frm.cscript.view_ledger_entry);
|
||||
} else hide_field(['Repair Outstanding Amt']);
|
||||
} else hide_field(['repair_outstanding_amt']);
|
||||
|
||||
cur_frm.cscript.is_opening(doc, dt, dn);
|
||||
}
|
||||
|
@ -1,110 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
|
||||
# ============TDS==================
|
||||
# Stop payable voucher on which tds is applicable is made before posting date of the
|
||||
# voucher in which tds was applicable for 1st time
|
||||
|
||||
def validate_first_entry(self,obj):
|
||||
if obj.doc.doctype == 'Purchase Invoice':
|
||||
supp_acc = obj.doc.credit_to
|
||||
elif obj.doc.doctype == 'Journal Voucher':
|
||||
supp_acc = obj.doc.supplier_account
|
||||
|
||||
if obj.doc.ded_amount:
|
||||
# first pv
|
||||
first_pv = sql("select posting_date from `tabPurchase Invoice` where credit_to = '%s' and docstatus = 1 and tds_category = '%s' and fiscal_year = '%s' and tds_applicable = 'Yes' and (ded_amount != 0 or ded_amount is not null) order by posting_date asc limit 1"%(supp_acc, obj.doc.tds_category, obj.doc.fiscal_year))
|
||||
first_pv_date = first_pv and first_pv[0][0] or ''
|
||||
# first jv
|
||||
first_jv = sql("select posting_date from `tabJournal Voucher` where supplier_account = '%s'and docstatus = 1 and tds_category = '%s' and fiscal_year = '%s' and tds_applicable = 'Yes' and (ded_amount != 0 or ded_amount is not null) order by posting_date asc limit 1"%(supp_acc, obj.doc.tds_category, obj.doc.fiscal_year))
|
||||
first_jv_date = first_jv and first_jv[0][0] or ''
|
||||
|
||||
#first tds voucher date
|
||||
first_tds_date = ''
|
||||
if first_pv_date and first_jv_date:
|
||||
first_tds_date = first_pv_date < first_jv_date and first_pv_date or first_jv_date
|
||||
elif first_pv_date:
|
||||
first_tds_date = first_pv_date
|
||||
elif first_jv_date:
|
||||
first_tds_date = first_jv_date
|
||||
|
||||
if first_tds_date and getdate(obj.doc.posting_date) < first_tds_date:
|
||||
msgprint("First tds voucher for this category has been made already. Hence payable voucher cannot be made before posting date of first tds voucher ")
|
||||
raise Exception
|
||||
|
||||
# TDS function definition
|
||||
#---------------------------
|
||||
def get_tds_amount(self, obj):
|
||||
# Validate if posting date b4 first tds entry for this category
|
||||
self.validate_first_entry(obj)
|
||||
|
||||
# get current amount and supplier head
|
||||
if obj.doc.doctype == 'Purchase Invoice':
|
||||
supplier_account = obj.doc.credit_to
|
||||
total_amount=flt(obj.doc.grand_total)
|
||||
for d in getlist(obj.doclist,'advance_allocation_details'):
|
||||
if flt(d.tds_amount)!=0:
|
||||
total_amount -= flt(d.allocated_amount)
|
||||
elif obj.doc.doctype == 'Journal Voucher':
|
||||
supplier_account = obj.doc.supplier_account
|
||||
total_amount = obj.doc.total_debit
|
||||
|
||||
if obj.doc.tds_category:
|
||||
# get total billed
|
||||
total_billed = 0
|
||||
pv = sql("select sum(ifnull(grand_total,0)), sum(ifnull(ded_amount,0)) from `tabPurchase Invoice` where tds_category = %s and credit_to = %s and fiscal_year = %s and docstatus = 1 and name != %s and is_opening != 'Yes'", (obj.doc.tds_category, supplier_account, obj.doc.fiscal_year, obj.doc.name))
|
||||
jv = sql("select sum(ifnull(total_debit,0)), sum(ifnull(ded_amount,0)) from `tabJournal Voucher` where tds_category = %s and supplier_account = %s and fiscal_year = %s and docstatus = 1 and name != %s and is_opening != 'Yes'", (obj.doc.tds_category, supplier_account, obj.doc.fiscal_year, obj.doc.name))
|
||||
tds_in_pv = pv and pv[0][1] or 0
|
||||
tds_in_jv = jv and jv[0][1] or 0
|
||||
total_billed += flt(pv and pv[0][0] or 0)+flt(jv and jv[0][0] or 0)+flt(total_amount)
|
||||
|
||||
# get slab
|
||||
slab = sql("SELECT * FROM `tabTDS Rate Detail` t1, `tabTDS Rate Chart` t2 WHERE '%s' >= t1.slab_from AND t1.category = '%s' AND t1.parent=t2.name and t2.applicable_from <= '%s' ORDER BY t2.applicable_from DESC LIMIT 1" % (total_billed, obj.doc.tds_category, obj.doc.posting_date), as_dict = 1)
|
||||
|
||||
if slab:
|
||||
if flt(tds_in_pv) <= 0 and flt(tds_in_jv) <= 0:
|
||||
total_amount = total_billed
|
||||
slab = slab[0]
|
||||
# special tds rate
|
||||
special_tds = sql("select special_tds_rate, special_tds_limit, special_tds_rate_applicable from `tabTDS Detail` where parent = '%s' and tds_category = '%s'"% (supplier_account,obj.doc.tds_category))
|
||||
|
||||
# get_pan_number
|
||||
pan_no = sql("select pan_number from `tabAccount` where name = '%s'" % supplier_account)
|
||||
pan_no = pan_no and cstr(pan_no[0][0]) or ''
|
||||
if not pan_no and flt(slab.get('rate_without_pan')):
|
||||
msgprint("As there is no PAN number mentioned in the account head: %s, TDS amount will be calculated at rate %s%%" % (supplier_account, cstr(slab['rate_without_pan'])))
|
||||
tds_rate = flt(slab.get('rate_without_pan'))
|
||||
elif special_tds and special_tds[0][2]=='Yes' and (flt(special_tds[0][1])==0 or flt(special_tds[0][1]) >= flt(total_amount)):
|
||||
tds_rate = flt(special_tds[0][0])
|
||||
else:
|
||||
tds_rate=flt(slab['rate'])
|
||||
# calculate tds amount
|
||||
if flt(slab['rate']):
|
||||
ac = sql("SELECT account_head FROM `tabTDS Category Account` where parent=%s and company=%s", (obj.doc.tds_category,obj.doc.company))
|
||||
|
||||
if ac:
|
||||
obj.doc.tax_code = ac[0][0]
|
||||
obj.doc.rate = tds_rate
|
||||
obj.doc.ded_amount = round(flt(tds_rate) * flt(total_amount) / 100)
|
||||
else:
|
||||
msgprint("TDS Account not selected in TDS Category %s" % (obj.doc.tds_category))
|
||||
raise Exception
|
@ -8,84 +8,84 @@
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||
cur_frm.cscript.refresh(doc, cdt, cdn);
|
||||
cur_frm.cscript.refresh(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
|
||||
// get pan and tan no
|
||||
cur_frm.cscript.company = function(doc,cdt,cdn){
|
||||
if(doc.company) get_server_fields('get_registration_details','','',doc,cdt,cdn);
|
||||
if(doc.company) get_server_fields('get_registration_details','','',doc,cdt,cdn);
|
||||
}
|
||||
|
||||
// check
|
||||
cur_frm.cscript.to_date = function(doc,cdt,cdn){
|
||||
if(doc.from_date && doc.to_date && (doc.from_date>doc.to_date)){
|
||||
alert("From date can not be greater than To date");
|
||||
doc.to_date='';
|
||||
refresh_field('to_date');
|
||||
}
|
||||
if(doc.from_date && doc.to_date && (doc.from_date>doc.to_date)){
|
||||
alert("From date can not be greater than To date");
|
||||
doc.to_date='';
|
||||
refresh_field('to_date');
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.from_date = function(doc,cdt,cdn){
|
||||
if(doc.from_date && doc.to_date && (doc.from_date>doc.to_date)){
|
||||
alert("From date can not be greater than To date");
|
||||
doc.from_date='';
|
||||
refresh_field('from_date');
|
||||
}
|
||||
if(doc.from_date && doc.to_date && (doc.from_date>doc.to_date)){
|
||||
alert("From date can not be greater than To date");
|
||||
doc.from_date='';
|
||||
refresh_field('from_date');
|
||||
}
|
||||
}
|
||||
|
||||
// Make Journal Voucher
|
||||
// --------------------
|
||||
|
||||
cur_frm.cscript.make_bank_voucher = function(doc, dt, dn) {
|
||||
var call_back = function(r,rt) {
|
||||
cur_frm.cscript.make_jv(doc,dt,dn,r.message);
|
||||
}
|
||||
// get def bank and tds account
|
||||
$c_obj(make_doclist(dt, dn), 'get_bank_and_tds_account', '', call_back);
|
||||
cur_frm.cscript.make_bank_voucher = function(doc, dt, dn) {
|
||||
var call_back = function(r,rt) {
|
||||
cur_frm.cscript.make_jv(doc,dt,dn,r.message);
|
||||
}
|
||||
// get def bank and tds account
|
||||
$c_obj(make_doclist(dt, dn), 'get_bank_and_tds_account', '', call_back);
|
||||
}
|
||||
|
||||
cur_frm.cscript.make_jv = function(doc, dt, dn, det) {
|
||||
var jv = LocalDB.create('Journal Voucher');
|
||||
jv = locals['Journal Voucher'][jv];
|
||||
jv.voucher_type = 'Bank Voucher';
|
||||
jv.voucher_date = dateutil.obj_to_str(new Date());
|
||||
jv.posting_date = dateutil.obj_to_str(new Date());
|
||||
jv.aging_date = dateutil.obj_to_str(new Date());
|
||||
jv.remark = repl('Payment against voucher %(vn)s. %(rem)s', {vn:doc.name, rem:doc.remarks});
|
||||
jv.total_debit = doc.total_tds;
|
||||
jv.total_credit = doc.total_tds;
|
||||
jv.fiscal_year = sys_defaults.fiscal_year;
|
||||
jv.company = doc.company;
|
||||
var jv = LocalDB.create('Journal Voucher');
|
||||
jv = locals['Journal Voucher'][jv];
|
||||
jv.voucher_type = 'Bank Voucher';
|
||||
jv.voucher_date = dateutil.obj_to_str(new Date());
|
||||
jv.posting_date = dateutil.obj_to_str(new Date());
|
||||
jv.aging_date = dateutil.obj_to_str(new Date());
|
||||
jv.remark = repl('Payment against voucher %(vn)s. %(rem)s', {vn:doc.name, rem:doc.remarks});
|
||||
jv.total_debit = doc.total_tds;
|
||||
jv.total_credit = doc.total_tds;
|
||||
jv.fiscal_year = sys_defaults.fiscal_year;
|
||||
jv.company = doc.company;
|
||||
|
||||
// debit to tds account
|
||||
var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
|
||||
d1.account = det.tds_account;
|
||||
d1.debit = doc.total_tds;
|
||||
// debit to tds account
|
||||
var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
|
||||
d1.account = det.tds_account;
|
||||
d1.debit = doc.total_tds;
|
||||
|
||||
// credit to bank account
|
||||
var d2 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
|
||||
d2.account = det.bank_account;
|
||||
d2.credit = doc.total_tds;
|
||||
|
||||
loaddoc('Journal Voucher', jv.name);
|
||||
// credit to bank account
|
||||
var d2 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
|
||||
d2.account = det.bank_account;
|
||||
d2.credit = doc.total_tds;
|
||||
|
||||
loaddoc('Journal Voucher', jv.name);
|
||||
}
|
||||
|
||||
// Show / Hide button
|
||||
cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||
if(doc.docstatus==1) {
|
||||
unhide_field('Make Bank Voucher');
|
||||
unhide_field('Update');
|
||||
}
|
||||
else {
|
||||
hide_field('Make Bank Voucher');
|
||||
hide_field('Update');
|
||||
}
|
||||
if(doc.docstatus==1) {
|
||||
unhide_field('make_bank_voucher');
|
||||
unhide_field('update');
|
||||
}
|
||||
else {
|
||||
hide_field('make_bank_voucher');
|
||||
hide_field('update');
|
||||
}
|
||||
}
|
||||
|
@ -432,12 +432,12 @@ cur_frm.cscript.calc_other_charges = function(doc , tname , fname , other_fname)
|
||||
// ------------------
|
||||
|
||||
|
||||
cur_frm.fields_dict['Tax Calculation'].disp_area.innerHTML = '<b style="padding: 8px 0px;">Calculation Details for Taxes, Charges and Landed Cost:</b>';
|
||||
cur_frm.fields_dict['tax_calculation'].disp_area.innerHTML = '<b style="padding: 8px 0px;">Calculation Details for Taxes, Charges and Landed Cost:</b>';
|
||||
var cl = getchildren(tname, doc.name, fname);
|
||||
var tax = getchildren('Purchase Taxes and Charges', doc.name, other_fname,doc.doctype);
|
||||
// make display table
|
||||
// ------------------
|
||||
var otc = make_table(cur_frm.fields_dict['Tax Calculation'].disp_area, cl.length + 1, tax.length + 1, '90%',[],{border:'1px solid #AAA',padding:'2px'});
|
||||
var otc = make_table(cur_frm.fields_dict['tax_calculation'].disp_area, cl.length + 1, tax.length + 1, '90%',[],{border:'1px solid #AAA',padding:'2px'});
|
||||
$y(otc,{marginTop:'8px'});
|
||||
|
||||
var tax_desc = {}; var tax_desc_rates = []; var net_total = 0;
|
||||
|
@ -80,8 +80,8 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
if(doc.docstatus == 1 && doc.status == 'Stopped')
|
||||
cur_frm.add_custom_button('Unstop Purchase Order', cur_frm.cscript['Unstop Purchase Order']);
|
||||
|
||||
if(doc.docstatus == 1) unhide_field(['Repair Purchase Order']);
|
||||
else hide_field(['Repair Purchase Order']);
|
||||
if(doc.docstatus == 1) unhide_field(['repair_purchase_order']);
|
||||
else hide_field(['repair_purchase_order']);
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,14 +60,13 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
}
|
||||
if(!is_closed) {
|
||||
cur_frm.add_custom_button('Make Purchase Order', cur_frm.cscript['Make Purchase Order'])
|
||||
cur_frm.add_custom_button('Stop ' + cur_frm.cscript.indent_doctype_label, cur_frm.cscript['Stop Purchase Requisition'])
|
||||
cur_frm.add_custom_button('Stop Purchase Request', cur_frm.cscript['Stop Purchase Requisition'])
|
||||
}
|
||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
|
||||
}
|
||||
|
||||
if(doc.docstatus == 1 && doc.status == 'Stopped')
|
||||
cur_frm.add_custom_button('Unstop ' + cur_frm.cscript.indent_doctype_label, cur_frm.cscript['Unstop Purchase Requisition'])
|
||||
|
||||
cur_frm.add_custom_button('Unstop Purchase Request', cur_frm.cscript['Unstop Purchase Requisition'])
|
||||
}
|
||||
|
||||
//======================= validation ===================================
|
||||
@ -85,7 +84,7 @@ cur_frm.cscript.transaction_date = function(doc,cdt,cdn){
|
||||
cur_frm.cscript.qty = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (flt(d.qty) < flt(d.min_order_qty))
|
||||
alert("Warning: " + cur_frm.cscript.indent_doctype_label + " Qty is less than Minimum Order Qty");
|
||||
alert("Warning: Purchase Requested Qty is less than Minimum Order Qty");
|
||||
}
|
||||
|
||||
// On Button Click Functions
|
||||
@ -111,7 +110,7 @@ cur_frm.cscript['Make Purchase Order'] = function() {
|
||||
// ==================================================================================================
|
||||
cur_frm.cscript['Stop Purchase Requisition'] = function() {
|
||||
var doc = cur_frm.doc;
|
||||
var check = confirm("Do you really want to STOP this " + cur_frm.cscript.indent_doctype_label + "?");
|
||||
var check = confirm("Do you really want to STOP this Purchase Request?");
|
||||
|
||||
if (check) {
|
||||
$c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
@ -124,7 +123,7 @@ cur_frm.cscript['Stop Purchase Requisition'] = function() {
|
||||
//====================================================================================================
|
||||
cur_frm.cscript['Unstop Purchase Requisition'] = function(){
|
||||
var doc = cur_frm.doc
|
||||
var check = confirm("Do you really want to UNSTOP this " + cur_frm.cscript.indent_doctype_label + "?");
|
||||
var check = confirm("Do you really want to UNSTOP this Purchase Request?");
|
||||
|
||||
if (check) {
|
||||
$c('runserverobj', args={'method':'update_status', 'arg': 'Submitted','docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
|
@ -30,11 +30,11 @@ cur_frm.cscript.onload_post_render = function(doc,cdt,cdn){
|
||||
|
||||
cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
||||
if(user == doc.kra_approver && doc.status == 'Submitted')
|
||||
unhide_field(['Update', 'Declare Completed', 'Calculate Total Score']);
|
||||
else hide_field(['Update', 'Declare Completed', 'Calculate Total Score']);
|
||||
unhide_field(['update', 'declare_completed', 'calculate_total_score']);
|
||||
else hide_field(['update', 'declare_completed', 'calculate_total_score']);
|
||||
|
||||
if(!doc.docstatus) unhide_field('Fetch Template');
|
||||
else hide_field('Fetch Template');
|
||||
if(!doc.docstatus) unhide_field('fetch_template');
|
||||
else hide_field('fetch_template');
|
||||
}
|
||||
|
||||
|
||||
@ -119,7 +119,7 @@ cur_frm.cscript.declare_completed = function(doc,cdt,cdn){
|
||||
$i('declare_completed_dialog_response').innerHTML = 'Done';
|
||||
refresh_field('status');
|
||||
declare_completed_dialog.refresh_dt();
|
||||
hide_field(['Update', 'Declare Completed', 'Calculate Total Score']);
|
||||
hide_field(['update', 'declare_completed', 'calculate_total_score']);
|
||||
declare_completed_dialog.hide();
|
||||
}
|
||||
else if(r.message.status == 'Incomplete'){
|
||||
|
@ -15,8 +15,8 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||
cur_frm.log_div = $a(cur_frm.fields_dict['Import Log1'].wrapper,'div','',{border:'1px solid #CCC', backgroundColor:'#DDD',width : '100%', height : '300px', overflow : 'auto'});
|
||||
hide_field('Import Log1')
|
||||
cur_frm.log_div = $a(cur_frm.fields_dict['import_log1'].wrapper,'div','',{border:'1px solid #CCC', backgroundColor:'#DDD',width : '100%', height : '300px', overflow : 'auto'});
|
||||
hide_field('import_log1')
|
||||
doc.att_fr_date = get_today();
|
||||
doc.file_list = '';
|
||||
doc.overwrite = 0;
|
||||
@ -58,9 +58,9 @@ cur_frm.cscript.import = function(doc,cdt,cdn){
|
||||
//====================================================
|
||||
cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
||||
if(cur_frm.log_div.innerHTML == '')
|
||||
hide_field('Import Log1');
|
||||
hide_field('import_log1');
|
||||
else
|
||||
unhide_field('Import Log1');
|
||||
refresh_field('Import Log1');
|
||||
unhide_field('import_log1');
|
||||
refresh_field('import_log1');
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -8,136 +8,136 @@
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
cur_frm.add_fetch('employee', 'company', 'company');
|
||||
|
||||
cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||
//
|
||||
if(!doc.approval_status) set_multiple(cdt,cdn,{approval_status:'Draft'});
|
||||
if(doc.employee) cur_frm.cscript.employee(doc,cdt,cdn);
|
||||
|
||||
if (doc.__islocal) {
|
||||
if(doc.amended_from) set_multiple(cdt,cdn,{approval_status:'Draft'});
|
||||
var val = getchildren('Expense Claim Detail', doc.name, 'expense_voucher_details', doc.doctype);
|
||||
for(var i = 0; i<val.length; i++){
|
||||
val[i].sanctioned_amount ='';
|
||||
}
|
||||
//doc.total_claimed_amount = '';
|
||||
doc.total_sanctioned_amount = '';
|
||||
refresh_many(['sanctioned_amount', 'total_sanctioned_amount']);
|
||||
}
|
||||
//
|
||||
if(!doc.approval_status) set_multiple(cdt,cdn,{approval_status:'Draft'});
|
||||
if(doc.employee) cur_frm.cscript.employee(doc,cdt,cdn);
|
||||
|
||||
if (doc.__islocal) {
|
||||
if(doc.amended_from) set_multiple(cdt,cdn,{approval_status:'Draft'});
|
||||
var val = getchildren('Expense Claim Detail', doc.name, 'expense_voucher_details', doc.doctype);
|
||||
for(var i = 0; i<val.length; i++){
|
||||
val[i].sanctioned_amount ='';
|
||||
}
|
||||
//doc.total_claimed_amount = '';
|
||||
doc.total_sanctioned_amount = '';
|
||||
refresh_many(['sanctioned_amount', 'total_sanctioned_amount']);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
||||
if((user == doc.exp_approver && doc.approval_status == 'Submitted') || doc.docstatus == 0) unhide_field('Calculate Total Amount');
|
||||
else hide_field('Calculate Total Amount');
|
||||
|
||||
if(user == doc.exp_approver && doc.approval_status == 'Submitted') unhide_field(['Update Voucher', 'Approve', 'Reject']);
|
||||
if((user == doc.exp_approver && doc.approval_status == 'Submitted') || doc.docstatus == 0) unhide_field('calculate_total_amount');
|
||||
else hide_field('calculate_total_amount');
|
||||
|
||||
if(user == doc.exp_approver && doc.approval_status == 'Submitted') unhide_field(['update_voucher', 'approve', 'reject']);
|
||||
|
||||
else hide_field(['Update Voucher', 'Approve', 'Reject']);
|
||||
else hide_field(['update_voucher', 'approve', 'reject']);
|
||||
|
||||
|
||||
if(user == doc.exp_approver && doc.approval_status == 'Submitted') set_field_permlevel('remark', 0);
|
||||
else set_field_permlevel('remark', 1);
|
||||
|
||||
if(user == doc.exp_approver && doc.approval_status == 'Submitted') set_field_permlevel('remark', 0);
|
||||
else set_field_permlevel('remark', 1);
|
||||
}
|
||||
|
||||
cur_frm.cscript.employee = function(doc,cdt,cdn){
|
||||
if(doc.employee){
|
||||
$c_obj(make_doclist(doc.doctype, doc.name),'set_approver','', function(r,rt){
|
||||
if(r.message){
|
||||
doc.employee_name = r.message['emp_nm'];
|
||||
get_field(doc.doctype, 'exp_approver' , doc.name).options = r.message['app_lst'];
|
||||
refresh_many(['exp_approver','employee_name']);
|
||||
}
|
||||
});
|
||||
}
|
||||
if(doc.employee){
|
||||
$c_obj(make_doclist(doc.doctype, doc.name),'set_approver','', function(r,rt){
|
||||
if(r.message){
|
||||
doc.employee_name = r.message['emp_nm'];
|
||||
get_field(doc.doctype, 'exp_approver' , doc.name).options = r.message['app_lst'];
|
||||
refresh_many(['exp_approver','employee_name']);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
|
||||
if(doc.approval_status == 'Draft'){
|
||||
var val = getchildren('Expense Claim Detail', doc.name, 'expense_voucher_details', doc.doctype);
|
||||
var total_claim =0;
|
||||
for(var i = 0; i<val.length; i++){
|
||||
total_claim = flt(total_claim)+flt(val[i].claim_amount);
|
||||
}
|
||||
doc.total_claimed_amount = flt(total_claim);
|
||||
refresh_field('total_claimed_amount');
|
||||
|
||||
$c_obj(make_doclist(doc.doctype, doc.name),'validate_approver','', function(r,rt){
|
||||
if(r.message){
|
||||
if(r.message['valid_approver'] == 'No'){
|
||||
doc.exp_approver ='';
|
||||
}
|
||||
get_field(doc.doctype, 'exp_approver' , doc.name).options = '';
|
||||
get_field(doc.doctype, 'exp_approver' , doc.name).options = r.message['app_lst'];
|
||||
refresh_field('exp_approver');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if(doc.approval_status == 'Submitted'){
|
||||
var val = getchildren('Expense Claim Detail', doc.name, 'expense_voucher_details', doc.doctype);
|
||||
var total_sanctioned = 0;
|
||||
for(var i = 0; i<val.length; i++){
|
||||
total_sanctioned = flt(total_sanctioned)+flt(val[i].sanctioned_amount);
|
||||
}
|
||||
doc.total_sanctioned_amount = flt(total_sanctioned);
|
||||
refresh_field('total_sanctioned_amount');
|
||||
}
|
||||
if(doc.approval_status == 'Draft'){
|
||||
var val = getchildren('Expense Claim Detail', doc.name, 'expense_voucher_details', doc.doctype);
|
||||
var total_claim =0;
|
||||
for(var i = 0; i<val.length; i++){
|
||||
total_claim = flt(total_claim)+flt(val[i].claim_amount);
|
||||
}
|
||||
doc.total_claimed_amount = flt(total_claim);
|
||||
refresh_field('total_claimed_amount');
|
||||
|
||||
$c_obj(make_doclist(doc.doctype, doc.name),'validate_approver','', function(r,rt){
|
||||
if(r.message){
|
||||
if(r.message['valid_approver'] == 'No'){
|
||||
doc.exp_approver ='';
|
||||
}
|
||||
get_field(doc.doctype, 'exp_approver' , doc.name).options = '';
|
||||
get_field(doc.doctype, 'exp_approver' , doc.name).options = r.message['app_lst'];
|
||||
refresh_field('exp_approver');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if(doc.approval_status == 'Submitted'){
|
||||
var val = getchildren('Expense Claim Detail', doc.name, 'expense_voucher_details', doc.doctype);
|
||||
var total_sanctioned = 0;
|
||||
for(var i = 0; i<val.length; i++){
|
||||
total_sanctioned = flt(total_sanctioned)+flt(val[i].sanctioned_amount);
|
||||
}
|
||||
doc.total_sanctioned_amount = flt(total_sanctioned);
|
||||
refresh_field('total_sanctioned_amount');
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.calculate_total_amount = function(doc,cdt,cdn){
|
||||
cur_frm.cscript.calculate_total(doc,cdt,cdn);
|
||||
cur_frm.cscript.calculate_total(doc,cdt,cdn);
|
||||
}
|
||||
cur_frm.cscript.claim_amount = function(doc,cdt,cdn){
|
||||
cur_frm.cscript.calculate_total(doc,cdt,cdn);
|
||||
cur_frm.cscript.calculate_total(doc,cdt,cdn);
|
||||
}
|
||||
cur_frm.cscript.sanctioned_amount = function(doc,cdt,cdn){
|
||||
cur_frm.cscript.calculate_total(doc,cdt,cdn);
|
||||
cur_frm.cscript.calculate_total(doc,cdt,cdn);
|
||||
}
|
||||
|
||||
wn.require('erpnext/setup/doctype/notification_control/notification_control.js');
|
||||
|
||||
cur_frm.cscript.approve = function(doc,cdt,cdn){
|
||||
|
||||
if(user == doc.exp_approver){
|
||||
var approve_voucher_dialog;
|
||||
|
||||
set_approve_voucher_dialog = function() {
|
||||
approve_voucher_dialog = new Dialog(400, 200, 'Approve Voucher');
|
||||
approve_voucher_dialog.make_body([
|
||||
['HTML', 'Message', '<div class = "comment">You wont be able to do any changes after approving this expense voucher. Are you sure, you want to approve it ?</div>'],
|
||||
['HTML', 'Response', '<div class = "comment" id="approve_voucher_dialog_response"></div>'],
|
||||
['HTML', 'Approve Voucher', '<div></div>']
|
||||
]);
|
||||
|
||||
var approve_voucher_btn1 = $a($i(approve_voucher_dialog.widgets['Approve Voucher']), 'button', 'button');
|
||||
approve_voucher_btn1.innerHTML = 'Yes';
|
||||
approve_voucher_btn1.onclick = function(){ approve_voucher_dialog.add(); }
|
||||
|
||||
var approve_voucher_btn2 = $a($i(approve_voucher_dialog.widgets['Approve Voucher']), 'button', 'button');
|
||||
approve_voucher_btn2.innerHTML = 'No';
|
||||
$y(approve_voucher_btn2,{marginLeft:'4px'});
|
||||
approve_voucher_btn2.onclick = function(){ approve_voucher_dialog.hide();}
|
||||
|
||||
approve_voucher_dialog.onshow = function() {
|
||||
$i('approve_voucher_dialog_response').innerHTML = '';
|
||||
}
|
||||
|
||||
approve_voucher_dialog.add = function() {
|
||||
// sending...
|
||||
$i('approve_voucher_dialog_response').innerHTML = 'Processing...';
|
||||
|
||||
$c_obj(make_doclist(this.doc.doctype, this.doc.name),'approve_voucher','', function(r,rt){
|
||||
if(r.message == 'Approved'){
|
||||
$i('approve_voucher_dialog_response').innerHTML = 'Approved';
|
||||
refresh_field('approval_status');
|
||||
hide_field(['Update Voucher', 'Approve', 'Reject', 'Calculate Total Amount']);
|
||||
approve_voucher_dialog.hide();
|
||||
if(user == doc.exp_approver){
|
||||
var approve_voucher_dialog;
|
||||
|
||||
set_approve_voucher_dialog = function() {
|
||||
approve_voucher_dialog = new Dialog(400, 200, 'Approve Voucher');
|
||||
approve_voucher_dialog.make_body([
|
||||
['HTML', 'Message', '<div class = "comment">You wont be able to do any changes after approving this expense voucher. Are you sure, you want to approve it ?</div>'],
|
||||
['HTML', 'Response', '<div class = "comment" id="approve_voucher_dialog_response"></div>'],
|
||||
['HTML', 'Approve Voucher', '<div></div>']
|
||||
]);
|
||||
|
||||
var approve_voucher_btn1 = $a($i(approve_voucher_dialog.widgets['Approve Voucher']), 'button', 'button');
|
||||
approve_voucher_btn1.innerHTML = 'Yes';
|
||||
approve_voucher_btn1.onclick = function(){ approve_voucher_dialog.add(); }
|
||||
|
||||
var approve_voucher_btn2 = $a($i(approve_voucher_dialog.widgets['Approve Voucher']), 'button', 'button');
|
||||
approve_voucher_btn2.innerHTML = 'No';
|
||||
$y(approve_voucher_btn2,{marginLeft:'4px'});
|
||||
approve_voucher_btn2.onclick = function(){ approve_voucher_dialog.hide();}
|
||||
|
||||
approve_voucher_dialog.onshow = function() {
|
||||
$i('approve_voucher_dialog_response').innerHTML = '';
|
||||
}
|
||||
|
||||
approve_voucher_dialog.add = function() {
|
||||
// sending...
|
||||
$i('approve_voucher_dialog_response').innerHTML = 'Processing...';
|
||||
|
||||
$c_obj(make_doclist(this.doc.doctype, this.doc.name),'approve_voucher','', function(r,rt){
|
||||
if(r.message == 'Approved'){
|
||||
$i('approve_voucher_dialog_response').innerHTML = 'Approved';
|
||||
refresh_field('approval_status');
|
||||
hide_field(['update_voucher', 'approve', 'reject', 'calculate_total_amount']);
|
||||
approve_voucher_dialog.hide();
|
||||
var args = {
|
||||
type: 'Expense Claim Approved',
|
||||
doctype: 'Expense Claim',
|
||||
@ -145,67 +145,67 @@ cur_frm.cscript.approve = function(doc,cdt,cdn){
|
||||
send_to: doc.email_id
|
||||
}
|
||||
cur_frm.cscript.notify(doc, args);
|
||||
}
|
||||
else if(r.message == 'Incomplete'){
|
||||
$i('approve_voucher_dialog_response').innerHTML = 'Incomplete Voucher';
|
||||
}
|
||||
else if(r.message == 'No Amount'){
|
||||
$i('approve_voucher_dialog_response').innerHTML = 'Calculate total amount';
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(!approve_voucher_dialog){
|
||||
set_approve_voucher_dialog();
|
||||
}
|
||||
approve_voucher_dialog.doc = doc;
|
||||
approve_voucher_dialog.cdt = cdt;
|
||||
approve_voucher_dialog.cdn = cdn;
|
||||
approve_voucher_dialog.show();
|
||||
refresh_field('expense_voucher_details');
|
||||
doc.__unsaved = 0;
|
||||
cur_frm.refresh_header();
|
||||
}else{
|
||||
msgprint("Expense Claim can be approved by Approver only");
|
||||
}
|
||||
}
|
||||
else if(r.message == 'Incomplete'){
|
||||
$i('approve_voucher_dialog_response').innerHTML = 'Incomplete Voucher';
|
||||
}
|
||||
else if(r.message == 'No Amount'){
|
||||
$i('approve_voucher_dialog_response').innerHTML = 'Calculate total amount';
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(!approve_voucher_dialog){
|
||||
set_approve_voucher_dialog();
|
||||
}
|
||||
approve_voucher_dialog.doc = doc;
|
||||
approve_voucher_dialog.cdt = cdt;
|
||||
approve_voucher_dialog.cdn = cdn;
|
||||
approve_voucher_dialog.show();
|
||||
refresh_field('expense_voucher_details');
|
||||
doc.__unsaved = 0;
|
||||
cur_frm.refresh_header();
|
||||
}else{
|
||||
msgprint("Expense Claim can be approved by Approver only");
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.reject = function(doc,cdt,cdn){
|
||||
if(user == doc.exp_approver){
|
||||
var reject_voucher_dialog;
|
||||
|
||||
set_reject_voucher_dialog = function() {
|
||||
reject_voucher_dialog = new Dialog(400, 200, 'Reject Voucher');
|
||||
reject_voucher_dialog.make_body([
|
||||
['HTML', 'Message', '<div class = "comment">You wont be able to do any changes after rejecting this expense voucher. Are you sure, you want to reject it ?</div>'],
|
||||
['HTML', 'Response', '<div class = "comment" id="reject_voucher_dialog_response"></div>'],
|
||||
['HTML', 'Reject Voucher', '<div></div>']
|
||||
]);
|
||||
|
||||
var reject_voucher_btn1 = $a($i(reject_voucher_dialog.widgets['Reject Voucher']), 'button', 'button');
|
||||
reject_voucher_btn1.innerHTML = 'Yes';
|
||||
reject_voucher_btn1.onclick = function(){ reject_voucher_dialog.add(); }
|
||||
|
||||
var reject_voucher_btn2 = $a($i(reject_voucher_dialog.widgets['Reject Voucher']), 'button', 'button');
|
||||
reject_voucher_btn2.innerHTML = 'No';
|
||||
$y(reject_voucher_btn2,{marginLeft:'4px'});
|
||||
reject_voucher_btn2.onclick = function(){ reject_voucher_dialog.hide();}
|
||||
|
||||
reject_voucher_dialog.onshow = function() {
|
||||
$i('reject_voucher_dialog_response').innerHTML = '';
|
||||
}
|
||||
|
||||
reject_voucher_dialog.add = function() {
|
||||
// sending...
|
||||
$i('reject_voucher_dialog_response').innerHTML = 'Processing...';
|
||||
|
||||
$c_obj(make_doclist(this.doc.doctype, this.doc.name),'reject_voucher','', function(r,rt){
|
||||
if(r.message == 'Rejected'){
|
||||
$i('reject_voucher_dialog_response').innerHTML = 'Rejected';
|
||||
refresh_field('approval_status');
|
||||
hide_field(['Update Voucher', 'Approve', 'Reject', 'Calculate Total Amount']);
|
||||
reject_voucher_dialog.hide();
|
||||
if(user == doc.exp_approver){
|
||||
var reject_voucher_dialog;
|
||||
|
||||
set_reject_voucher_dialog = function() {
|
||||
reject_voucher_dialog = new Dialog(400, 200, 'Reject Voucher');
|
||||
reject_voucher_dialog.make_body([
|
||||
['HTML', 'Message', '<div class = "comment">You wont be able to do any changes after rejecting this expense voucher. Are you sure, you want to reject it ?</div>'],
|
||||
['HTML', 'Response', '<div class = "comment" id="reject_voucher_dialog_response"></div>'],
|
||||
['HTML', 'Reject Voucher', '<div></div>']
|
||||
]);
|
||||
|
||||
var reject_voucher_btn1 = $a($i(reject_voucher_dialog.widgets['Reject Voucher']), 'button', 'button');
|
||||
reject_voucher_btn1.innerHTML = 'Yes';
|
||||
reject_voucher_btn1.onclick = function(){ reject_voucher_dialog.add(); }
|
||||
|
||||
var reject_voucher_btn2 = $a($i(reject_voucher_dialog.widgets['Reject Voucher']), 'button', 'button');
|
||||
reject_voucher_btn2.innerHTML = 'No';
|
||||
$y(reject_voucher_btn2,{marginLeft:'4px'});
|
||||
reject_voucher_btn2.onclick = function(){ reject_voucher_dialog.hide();}
|
||||
|
||||
reject_voucher_dialog.onshow = function() {
|
||||
$i('reject_voucher_dialog_response').innerHTML = '';
|
||||
}
|
||||
|
||||
reject_voucher_dialog.add = function() {
|
||||
// sending...
|
||||
$i('reject_voucher_dialog_response').innerHTML = 'Processing...';
|
||||
|
||||
$c_obj(make_doclist(this.doc.doctype, this.doc.name),'reject_voucher','', function(r,rt){
|
||||
if(r.message == 'Rejected'){
|
||||
$i('reject_voucher_dialog_response').innerHTML = 'Rejected';
|
||||
refresh_field('approval_status');
|
||||
hide_field(['update_voucher', 'approve', 'reject', 'calculate_total_amount']);
|
||||
reject_voucher_dialog.hide();
|
||||
var args = {
|
||||
type: 'Expense Claim Rejected',
|
||||
doctype: 'Expense Claim',
|
||||
@ -213,35 +213,35 @@ cur_frm.cscript.reject = function(doc,cdt,cdn){
|
||||
send_to: doc.email_id
|
||||
}
|
||||
cur_frm.cscript.notify(doc, args);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(!reject_voucher_dialog){
|
||||
set_reject_voucher_dialog();
|
||||
}
|
||||
reject_voucher_dialog.doc = doc;
|
||||
reject_voucher_dialog.cdt = cdt;
|
||||
reject_voucher_dialog.cdn = cdn;
|
||||
reject_voucher_dialog.show();
|
||||
refresh_field('expense_voucher_details');
|
||||
doc.__unsaved = 0;
|
||||
cur_frm.refresh_header();
|
||||
}else{
|
||||
msgprint("Expense Claim can be rejected by Approver only");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(!reject_voucher_dialog){
|
||||
set_reject_voucher_dialog();
|
||||
}
|
||||
reject_voucher_dialog.doc = doc;
|
||||
reject_voucher_dialog.cdt = cdt;
|
||||
reject_voucher_dialog.cdn = cdn;
|
||||
reject_voucher_dialog.show();
|
||||
refresh_field('expense_voucher_details');
|
||||
doc.__unsaved = 0;
|
||||
cur_frm.refresh_header();
|
||||
}else{
|
||||
msgprint("Expense Claim can be rejected by Approver only");
|
||||
}
|
||||
}
|
||||
|
||||
//update follow up
|
||||
//=================================================================================
|
||||
cur_frm.cscript.update_voucher = function(doc){
|
||||
|
||||
$c_obj(make_doclist(doc.doctype, doc.name),'update_voucher','',function(r, rt){
|
||||
refresh_field('expense_voucher_details');
|
||||
doc.__unsaved = 0;
|
||||
cur_frm.refresh_header();
|
||||
});
|
||||
$c_obj(make_doclist(doc.doctype, doc.name),'update_voucher','',function(r, rt){
|
||||
refresh_field('expense_voucher_details');
|
||||
doc.__unsaved = 0;
|
||||
cur_frm.refresh_header();
|
||||
});
|
||||
}
|
||||
|
||||
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
var display_activity_log = function(msg) {
|
||||
if(!pscript.ss_html)
|
||||
pscript.ss_html = $a(cur_frm.fields_dict['Activity Log'].wrapper,'div','',{border:'1px solid #CCC', backgroundColor:'#CCC'});
|
||||
pscript.ss_html = $a(cur_frm.fields_dict['activity_log'].wrapper,'div','',{border:'1px solid #CCC', backgroundColor:'#CCC'});
|
||||
pscript.ss_html.innerHTML = '<div style="color:#EEE; background-color:#555;"><b><i>Activity Log:</i><br></b></div>';
|
||||
pscript.ss_html.innerHTML += '<div style="color:#666; padding: 5px">'+ msg + '</div>';
|
||||
}
|
||||
|
@ -18,9 +18,9 @@
|
||||
cur_frm.cscript.refresh = function(doc,dt,dn){
|
||||
if(!doc.__islocal) {
|
||||
set_field_permlevel('item',1);
|
||||
unhide_field('Update Cost as on today');
|
||||
unhide_field('update_cost_as_on_today');
|
||||
} else {
|
||||
hide_field('Update Cost as on today');
|
||||
hide_field('update_cost_as_on_today');
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user