POS Setting js code restored from history
This commit is contained in:
parent
e2f0c5dfd0
commit
612efe843b
@ -1,109 +1,38 @@
|
||||
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);
|
||||
});
|
||||
|
||||
|
||||
//--------- ONLOAD -------------
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
|
||||
}
|
||||
|
||||
// Settings Module
|
||||
|
||||
cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
||||
|
||||
|
||||
if(doc.based_on == 'Grand Total' || doc.based_on == 'Average Discount' || doc.based_on == 'Total Claimed Amount' || doc.based_on == 'Not Applicable') hide_field('master_name');
|
||||
else unhide_field('master_name');
|
||||
|
||||
if(doc.based_on == 'Not Applicable') hide_field('value');
|
||||
else unhide_field('value');
|
||||
|
||||
if(doc.transaction == 'Expense Voucher' || doc.transaction == 'Appraisal'){
|
||||
hide_field(['master_name','system_role', 'system_user']);
|
||||
unhide_field(['to_emp','to_designation']);
|
||||
if(doc.transaction == 'Appraisal') hide_field('value');
|
||||
else unhide_field('value');
|
||||
}
|
||||
else {
|
||||
unhide_field(['master_name','system_role', 'system_user','value']);
|
||||
hide_field(['to_emp','to_designation']);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.based_on = function(doc){
|
||||
if(doc.based_on == 'Grand Total' || doc.based_on == 'Average Discount' || doc.based_on == 'Total Claimed Amount' || doc.based_on == 'Not Applicable'){
|
||||
doc.master_name = '';
|
||||
refresh_field('master_name');
|
||||
hide_field('master_name');
|
||||
}
|
||||
else{
|
||||
unhide_field('master_name');
|
||||
}
|
||||
|
||||
if(doc.based_on == 'Not Applicable') {
|
||||
doc.value =0;
|
||||
refresh_field('value');
|
||||
hide_field('value');
|
||||
}
|
||||
else unhide_field('value');
|
||||
//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"'
|
||||
}
|
||||
|
||||
cur_frm.cscript.transaction = function(doc,cdt,cdn){
|
||||
if(doc.transaction == 'Expense Voucher' || doc.transaction == 'Appraisal'){
|
||||
doc.master_name = doc.system_role = doc.system_user = '';
|
||||
refresh_many(['master_name','system_role', 'system_user']);
|
||||
hide_field(['master_name','system_role', 'system_user']);
|
||||
unhide_field(['to_emp','to_designation']);
|
||||
if(doc.transaction == 'Appraisal') {
|
||||
doc.value =0;
|
||||
refresh_many('value');
|
||||
hide_field('value');
|
||||
}
|
||||
else unhide_field('value');
|
||||
}
|
||||
else {
|
||||
unhide_field(['master_name','system_role', 'system_user','value']);
|
||||
hide_field(['to_emp','to_designation']);
|
||||
}
|
||||
|
||||
if(doc.transaction == 'Expense Voucher') doc.based_on = 'Total Claimed Amount';
|
||||
if(doc.transaction == 'Appraisal') doc.based_on == 'Not Applicable';
|
||||
// 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"'
|
||||
}
|
||||
|
||||
|
||||
// System User Trigger
|
||||
// -------------------
|
||||
cur_frm.fields_dict['system_user'].get_query = function(doc) {
|
||||
return 'SELECT tabProfile.name, tabProfile.first_name FROM tabProfile WHERE tabProfile.name not in ("Administrator","Guest") AND tabProfile.docstatus != 2 AND tabProfile.%(key)s LIKE "%s" LIMIT 50'
|
||||
// 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';
|
||||
}
|
||||
|
||||
//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';
|
||||
}
|
||||
|
||||
|
||||
// System Role Trigger
|
||||
// -----------------------
|
||||
cur_frm.fields_dict['system_role'].get_query = function(doc) {
|
||||
return 'SELECT tabRole.name FROM tabRole WHERE tabRole.name not in ("Administrator","Guest","All") AND tabRole.docstatus != 2 AND tabRole.%(key)s LIKE "%s" LIMIT 50'
|
||||
}
|
||||
|
||||
|
||||
// Approving User Trigger
|
||||
// -----------------------
|
||||
cur_frm.fields_dict['approving_user'].get_query = function(doc) {
|
||||
return 'SELECT tabProfile.name, tabProfile.first_name FROM tabProfile WHERE tabProfile.name not in ("Administrator","Guest") AND tabProfile.docstatus != 2 AND tabProfile.%(key)s LIKE "%s" LIMIT 50'
|
||||
}
|
||||
|
||||
|
||||
// Approving Role Trigger
|
||||
// -----------------------
|
||||
cur_frm.fields_dict['approving_role'].get_query = function(doc) {
|
||||
return 'SELECT tabRole.name FROM tabRole WHERE tabRole.name not in ("Administrator","Guest","All") AND tabRole.docstatus != 2 AND tabRole.%(key)s LIKE "%s" LIMIT 50'
|
||||
}
|
||||
|
||||
|
||||
// Master Name Trigger
|
||||
// --------------------
|
||||
cur_frm.fields_dict['master_name'].get_query = function(doc){
|
||||
if(doc.based_on == 'Customerwise Discount')
|
||||
return 'SELECT `tabCustomer`.`name` FROM `tabCustomer` WHERE `tabCustomer`.docstatus !=2 and `tabCustomer`.`name` LIKE "%s" ORDER BY `tabCustomer`.`name` DESC LIMIT 50';
|
||||
else if(doc.based_on == 'Itemwise Discount')
|
||||
return 'SELECT `tabItem`.`name` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) and `tabItem`.is_sales_item = "Yes" and tabItem.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` DESC LIMIT 50';
|
||||
else
|
||||
return 'SELECT `tabItem`.`name` FROM `tabItem` WHERE `tabItem`.`name` = "cheating done to avoid null" ORDER BY `tabItem`.`name` DESC 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';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user