[form] [legacy-js] removed old Dialog, PageHeader etc., cleanup Opportunity and Quotation
This commit is contained in:
parent
78979dca9b
commit
9a04b19160
@ -1,8 +0,0 @@
|
||||
<div class="appframe col col-lg-12">
|
||||
<div id="fs_header"></div>
|
||||
<div id="print_html">
|
||||
<div id="stmt_title1" style="margin:16px 0px 4px 0px; font-size: 16px; font-weight: bold; color: #888;"></div>
|
||||
<div id="stmt_title2" style="margin:0px 0px 8px 0px; font-size: 16px; font-weight: bold;"></div>
|
||||
<div id="stmt_tree" style="margin: 0px 0px 16px; overflow: auto; display: none; width: 100%;"></div>
|
||||
</div>
|
||||
</div>
|
@ -14,66 +14,60 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
pscript['onload_Financial Statements'] = function() {
|
||||
|
||||
// header and toolbar
|
||||
var h = new PageHeader('fs_header','Financial Statements','Profit & Loss and Balance Sheet Builder across multiple years');
|
||||
//$y(h.toolbar_area,{padding:'8px'});
|
||||
|
||||
var dv = $a(h.toolbar_area,'div','',{margin:'4px 0px'});
|
||||
|
||||
var t = make_table(dv,1,4,'640px', [], {padding:'4px', width:'160px'});
|
||||
|
||||
var sel = $a($td(t,0,0),'select','',{width:'160px'});
|
||||
sel.id = 'stmt_type';
|
||||
|
||||
var sel = $a($td(t,0,1),'select','',{width:'160px'});
|
||||
sel.id = 'stmt_company';
|
||||
|
||||
var sel = $a($td(t,0,2),'select','',{width:'160px'});
|
||||
sel.id = 'stmt_period';
|
||||
erpnext.fs = {}
|
||||
|
||||
var sel = $a($td(t,0,3),'select','',{width:'160px'});
|
||||
sel.id = 'stmt_fiscal_year';
|
||||
|
||||
h.add_button('Create',function(){ pscript.stmt_new(); },0,'ui-icon-document');
|
||||
h.add_button('Print', function(){ _p.go($i('print_html').innerHTML); }, 0, 'ui-icon-print');
|
||||
/*
|
||||
var btn = $a($td(t,1,0),'button');
|
||||
btn.onclick = function(){ pscript.stmt_new(); }
|
||||
btn.innerHTML = 'Create';
|
||||
pscript['onload_Financial Statements'] = function(wrapper) {
|
||||
wn.ui.make_app_page({
|
||||
parent: wrapper,
|
||||
"title": "Financial Statements",
|
||||
"single_column": true,
|
||||
});
|
||||
|
||||
var btn = $a($td(t,1,1),'button');
|
||||
btn.onclick = function(){ alert('print'); }
|
||||
btn.innerHTML = 'Print';
|
||||
erpnext.fs.stmt_type = wrapper.appframe.add_field({
|
||||
fieldtype:"Select",
|
||||
fieldname:"stmt_type",
|
||||
options: ['Select Statement...','Balance Sheet','Profit & Loss']
|
||||
})
|
||||
|
||||
//Button to create new
|
||||
var btn = $a('stmt_new', 'button');
|
||||
btn.onclick = function() { pscript.stmt_new(); }
|
||||
btn.innerHTML = 'Create';*/
|
||||
erpnext.fs.stmt_company = wrapper.appframe.add_field({
|
||||
fieldtype:"Select",
|
||||
fieldname:"stmt_company",
|
||||
options: ['Loading Companies...']
|
||||
})
|
||||
|
||||
// select for statement
|
||||
add_sel_options($i('stmt_type'), ['Select Statement...','Balance Sheet','Profit & Loss']);
|
||||
erpnext.fs.stmt_period = wrapper.appframe.add_field({
|
||||
fieldtype:"Select",
|
||||
fieldname:"stmt_period",
|
||||
options: ['Select Period...', 'Annual', 'Quarterly', 'Monthly']
|
||||
})
|
||||
|
||||
// select for companies
|
||||
add_sel_options($i('stmt_company'), ['Loading Companies...']);
|
||||
erpnext.fs.stmt_fiscal_year = wrapper.appframe.add_field({
|
||||
fieldtype:"Select",
|
||||
fieldname:"stmt_fiscal_year",
|
||||
options: ['Loading...']
|
||||
})
|
||||
|
||||
wrapper.appframe.add_button("Create", function() {
|
||||
pscript.stmt_new();
|
||||
}, "icon-refresh")
|
||||
|
||||
wrapper.appframe.add_button("Print", function() {
|
||||
_p.go($i('print_html').innerHTML);
|
||||
}, "icon-print")
|
||||
|
||||
$(wrapper).find(".layout-main").html('<div id="print_html">\
|
||||
<div id="stmt_title1" style="margin:16px 0px 4px 0px; font-size: 16px; font-weight: bold; color: #888;"></div>\
|
||||
<div id="stmt_title2" style="margin:0px 0px 8px 0px; font-size: 16px; font-weight: bold;"></div>\
|
||||
<div id="stmt_tree" style="margin: 0px 0px 16px; overflow: auto;">Please select options and click on Create</div>\
|
||||
</div>').css({"min-height": "400px"});
|
||||
|
||||
// load companies
|
||||
$c_obj('MIS Control','get_comp','', function(r,rt) {
|
||||
// company
|
||||
empty_select($i('stmt_company'));
|
||||
add_sel_options($i('stmt_company'), add_lists(['Select Company...'], r.message.company), 'Select Company...');
|
||||
|
||||
|
||||
// period
|
||||
empty_select($i('stmt_period'));
|
||||
//add_sel_options($i('stmt_period'), add_lists(['Select Period...'], r.message.period), 'Select period...');
|
||||
add_sel_options($i('stmt_period'), add_lists(['Select Period...'], ['Annual', 'Quarterly', 'Monthly']), 'Select period...');
|
||||
|
||||
// fiscal-year
|
||||
empty_select($i('stmt_fiscal_year'));
|
||||
add_sel_options($i('stmt_fiscal_year'), add_lists(['Select Year...'], r.message.fiscal_year), 'Select fiscal year...');
|
||||
erpnext.fs.stmt_company.$input.empty()
|
||||
.add_options(['Select Company...'].concat(r.message.company));
|
||||
erpnext.fs.stmt_fiscal_year.$input.empty()
|
||||
.add_options(['Select Year...'].concat(r.message.fiscal_year));
|
||||
});
|
||||
|
||||
}
|
||||
@ -83,26 +77,27 @@ pscript.stmt_new = function(stmt,company_name,level,period,year) {
|
||||
$i('stmt_tree').innerHTML = 'Refreshing....';
|
||||
$i('stmt_tree').style.display = 'block';
|
||||
|
||||
var company = sel_val($i('stmt_company'))
|
||||
var company =erpnext.fs.stmt_company.get_value();
|
||||
|
||||
var arg = {
|
||||
statement:sel_val($i('stmt_type')),
|
||||
company:company,
|
||||
period:sel_val($i('stmt_period')),
|
||||
year:sel_val($i('stmt_fiscal_year'))
|
||||
statement: erpnext.fs.stmt_type.get_value(),
|
||||
company: company,
|
||||
period: erpnext.fs.stmt_period.get_value(),
|
||||
year: erpnext.fs.stmt_fiscal_year.get_value()
|
||||
}
|
||||
|
||||
$c_obj('MIS Control', 'get_statement', docstring(arg), function(r,rt) {
|
||||
var nl = r.message;
|
||||
var t = $i('stmt_tree');
|
||||
var stmt_type = sel_val($i('stmt_type'));
|
||||
var stmt_type = erpnext.fs.stmt_type.get_value();
|
||||
t.innerHTML = '';
|
||||
var tab = $a($a(t, 'div'),'table','stmt_table');
|
||||
tab.style.tableLayout = 'fixed';
|
||||
tab.style.width = '100%';
|
||||
|
||||
$i('stmt_title1').innerHTML = sel_val($i('stmt_company'));
|
||||
$i('stmt_title2').innerHTML = sel_val($i('stmt_type')) + ' - ' + sel_val($i('stmt_fiscal_year'));
|
||||
$i('stmt_title1').innerHTML = erpnext.fs.stmt_company.get_value()
|
||||
$i('stmt_title2').innerHTML = erpnext.fs.stmt_type.get_value()
|
||||
+ ' - ' + erpnext.fs.stmt_fiscal_year.get_value();
|
||||
for(i=0;i<nl.length;i++) {
|
||||
tab.insertRow(i);
|
||||
|
||||
@ -110,8 +105,6 @@ pscript.stmt_new = function(stmt,company_name,level,period,year) {
|
||||
|
||||
// heads
|
||||
var per = tab.rows[i].insertCell(0);
|
||||
// var acc_width = (sel_val($i('stmt_period'))=='Monthly')? 12 : 20;
|
||||
// per.style.width = acc_width+'%';
|
||||
per.style.width = '150px';
|
||||
per.innerHTML = pscript.space_reqd(nl[i][0])+cstr(nl[i][1]);
|
||||
per.className = 'stmt_level' + nl[i][0];
|
||||
|
@ -21,7 +21,7 @@ cur_frm.cscript.onload = function(doc,dt,dn){
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc,dt,dn) {
|
||||
cur_frm.cscript.setup_dashboard(doc);
|
||||
cur_frm.cscript.make_dashboard(doc);
|
||||
if(sys_defaults.supp_master_name == 'Supplier Name')
|
||||
hide_field('naming_series');
|
||||
else
|
||||
@ -44,19 +44,17 @@ cur_frm.cscript.refresh = function(doc,dt,dn) {
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.setup_dashboard = function(doc) {
|
||||
cur_frm.layout.dashboard.empty().toggle(doc.__islocal ? false : true);
|
||||
cur_frm.cscript.make_dashboard = function(doc) {
|
||||
cur_frm.dashboard.wrapper.empty().toggle(doc.__islocal ? false : true);
|
||||
if(doc.__islocal)
|
||||
return;
|
||||
var headline = $('<div class="form-headline col col-lg-12">\
|
||||
<span class="text-muted">Loading...</span></div>')
|
||||
.appendTo(cur_frm.layout.dashboard);
|
||||
|
||||
cur_frm.layout.add_doctype_badge("Supplier Quotation", "supplier");
|
||||
cur_frm.layout.add_doctype_badge("Purchase Order", "supplier");
|
||||
cur_frm.layout.add_doctype_badge("Purchase Receipt", "supplier");
|
||||
cur_frm.layout.add_doctype_badge("Purchase Invoice", "supplier");
|
||||
cur_frm.dashboard.set_headline('<span class="text-muted">Loading...</span>')
|
||||
|
||||
cur_frm.dashboard.add_doctype_badge("Supplier Quotation", "supplier");
|
||||
cur_frm.dashboard.add_doctype_badge("Purchase Order", "supplier");
|
||||
cur_frm.dashboard.add_doctype_badge("Purchase Receipt", "supplier");
|
||||
cur_frm.dashboard.add_doctype_badge("Purchase Invoice", "supplier");
|
||||
|
||||
wn.call({
|
||||
type: "GET",
|
||||
method:"buying.doctype.supplier.supplier.get_dashboard_info",
|
||||
@ -64,16 +62,18 @@ cur_frm.cscript.setup_dashboard = function(doc) {
|
||||
supplier: cur_frm.doc.name
|
||||
},
|
||||
callback: function(r) {
|
||||
cur_frm.layout.dashboard.find(".form-headline")
|
||||
.html(wn._("Total Billing This Year: ") + "<b>"
|
||||
+ format_currency(r.message.total_billing, cur_frm.doc.default_currency)
|
||||
+ '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>" +
|
||||
format_currency(r.message.total_unpaid, cur_frm.doc.default_currency) + '</b></span>');
|
||||
cur_frm.layout.set_badge_count(r.message);
|
||||
cur_frm.dashboard.set_headline(
|
||||
wn._("Total Billing This Year: ") + "<b>"
|
||||
+ format_currency(r.message.total_billing, cur_frm.doc.default_currency)
|
||||
+ '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>"
|
||||
+ format_currency(r.message.total_unpaid, cur_frm.doc.default_currency)
|
||||
+ '</b></span>');
|
||||
cur_frm.dashboard.set_badge_count(r.message);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
cur_frm.cscript.make_address = function() {
|
||||
if(!cur_frm.address_list) {
|
||||
cur_frm.address_list = new wn.ui.Listing({
|
||||
|
@ -55,18 +55,16 @@ cur_frm.cscript.refresh = function(doc,dt,dn) {
|
||||
}
|
||||
|
||||
cur_frm.cscript.setup_dashboard = function(doc) {
|
||||
cur_frm.layout.dashboard.empty().toggle(doc.__islocal ? false : true);
|
||||
cur_frm.dashboard.reset(doc);
|
||||
if(doc.__islocal)
|
||||
return;
|
||||
var headline = $('<div class="form-headline col col-lg-12">\
|
||||
<span class="text-muted">Loading...</span></div>')
|
||||
.appendTo(cur_frm.layout.dashboard);
|
||||
cur_frm.dashboard.set_headline('<span class="text-muted">Loading...</span>')
|
||||
|
||||
cur_frm.layout.add_doctype_badge("Opportunity", "customer");
|
||||
cur_frm.layout.add_doctype_badge("Quotation", "customer");
|
||||
cur_frm.layout.add_doctype_badge("Sales Order", "customer");
|
||||
cur_frm.layout.add_doctype_badge("Delivery Note", "customer");
|
||||
cur_frm.layout.add_doctype_badge("Sales Invoice", "customer");
|
||||
cur_frm.dashboard.add_doctype_badge("Opportunity", "customer");
|
||||
cur_frm.dashboard.add_doctype_badge("Quotation", "customer");
|
||||
cur_frm.dashboard.add_doctype_badge("Sales Order", "customer");
|
||||
cur_frm.dashboard.add_doctype_badge("Delivery Note", "customer");
|
||||
cur_frm.dashboard.add_doctype_badge("Sales Invoice", "customer");
|
||||
|
||||
wn.call({
|
||||
type: "GET",
|
||||
@ -75,12 +73,13 @@ cur_frm.cscript.setup_dashboard = function(doc) {
|
||||
customer: cur_frm.doc.name
|
||||
},
|
||||
callback: function(r) {
|
||||
cur_frm.layout.dashboard.find(".form-headline")
|
||||
.html(wn._("Total Billing This Year: ") + "<b>"
|
||||
+ format_currency(r.message.total_billing, cur_frm.doc.default_currency)
|
||||
+ '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>" +
|
||||
format_currency(r.message.total_unpaid, cur_frm.doc.default_currency) + '</b></span>');
|
||||
cur_frm.layout.set_badge_count(r.message);
|
||||
cur_frm.dashboard.set_headline(
|
||||
wn._("Total Billing This Year: ") + "<b>"
|
||||
+ format_currency(r.message.total_billing, cur_frm.doc.default_currency)
|
||||
+ '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>"
|
||||
+ format_currency(r.message.total_unpaid, cur_frm.doc.default_currency)
|
||||
+ '</b></span>');
|
||||
cur_frm.dashboard.set_badge_count(r.message);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -40,9 +40,19 @@ erpnext.LeadController = wn.ui.form.Controller.extend({
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
var doc = this.frm.doc;
|
||||
erpnext.hide_naming_series();
|
||||
this.frm.clear_custom_buttons();
|
||||
|
||||
this.frm.dashboard.reset(doc);
|
||||
if(!doc.__islocal) {
|
||||
if(doc.status=="Converted") {
|
||||
this.frm.dashboard.set_headline_alert(wn._("Converted"), "alert-success", "icon-ok-sign");
|
||||
} else {
|
||||
this.frm.dashboard.set_headline_alert(wn._(doc.status), "alert-info", "icon-exclamation-sign");
|
||||
}
|
||||
}
|
||||
|
||||
this.frm.__is_customer = this.frm.__is_customer || this.frm.doc.__is_customer;
|
||||
if(!this.frm.doc.__islocal && !this.frm.__is_customer) {
|
||||
this.frm.add_custom_button("Create Customer", this.frm.cscript['Create Customer']);
|
||||
|
@ -18,9 +18,20 @@ wn.require('app/utilities/doctype/sms_control/sms_control.js');
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn){
|
||||
erpnext.hide_naming_series();
|
||||
|
||||
cur_frm.dashboard.reset(doc);
|
||||
if(!doc.__islocal) {
|
||||
if(doc.status=="Converted" || doc.status=="Order Confirmed") {
|
||||
cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-success", "icon-ok-sign");
|
||||
} else if(doc.status=="Opportunity Lost") {
|
||||
cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-danger", "icon-exclamation-sign");
|
||||
} else {
|
||||
cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-info", "icon-exclamation-sign");
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.clear_custom_buttons();
|
||||
if(doc.docstatus == 1) {
|
||||
if(doc.docstatus === 1 && doc.status!=="Opportunity Lost") {
|
||||
cur_frm.add_custom_button('Create Quotation', cur_frm.cscript['Create Quotation']);
|
||||
cur_frm.add_custom_button('Opportunity Lost', cur_frm.cscript['Declare Opportunity Lost']);
|
||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
|
||||
@ -198,56 +209,35 @@ cur_frm.cscript['Create Quotation'] = function(){
|
||||
// declare enquiry lost
|
||||
//-------------------------
|
||||
cur_frm.cscript['Declare Opportunity Lost'] = function(){
|
||||
var e_lost_dialog;
|
||||
var dialog = new wn.ui.Dialog({
|
||||
title: "Set as Lost",
|
||||
fields: [
|
||||
{"fieldtype": "Text", "label": "Reason for losing", "fieldname": "reason",
|
||||
"reqd": 1 },
|
||||
{"fieldtype": "Button", "label": "Update", "fieldname": "update"},
|
||||
]
|
||||
});
|
||||
|
||||
set_e_lost_dialog = function(){
|
||||
e_lost_dialog = new Dialog(400,150,'Add Opportunity Lost Reason');
|
||||
e_lost_dialog.make_body([
|
||||
['HTML', 'Message', '<div class="comment">Please add enquiry lost reason</div>'],
|
||||
['Text', 'Opportunity Lost Reason'],
|
||||
['HTML', 'Response', '<div class = "comment" id="update_enquiry_dialog_response"></div>'],
|
||||
['HTML', 'Add Reason', '<div></div>']
|
||||
]);
|
||||
|
||||
var add_reason_btn1 = $a($i(e_lost_dialog.widgets['Add Reason']), 'button', 'button');
|
||||
add_reason_btn1.innerHTML = 'Add';
|
||||
add_reason_btn1.onclick = function(){ e_lost_dialog.add(); }
|
||||
|
||||
var add_reason_btn2 = $a($i(e_lost_dialog.widgets['Add Reason']), 'button', 'button');
|
||||
add_reason_btn2.innerHTML = 'Cancel';
|
||||
$y(add_reason_btn2,{marginLeft:'4px'});
|
||||
add_reason_btn2.onclick = function(){ e_lost_dialog.hide();}
|
||||
|
||||
e_lost_dialog.onshow = function() {
|
||||
e_lost_dialog.widgets['Opportunity Lost Reason'].value = '';
|
||||
$i('update_enquiry_dialog_response').innerHTML = '';
|
||||
}
|
||||
|
||||
e_lost_dialog.add = function() {
|
||||
// sending...
|
||||
$i('update_enquiry_dialog_response').innerHTML = 'Processing...';
|
||||
var arg = strip(e_lost_dialog.widgets['Opportunity Lost Reason'].value);
|
||||
var call_back = function(r,rt) {
|
||||
if(r.message == 'true'){
|
||||
$i('update_enquiry_dialog_response').innerHTML = 'Done';
|
||||
e_lost_dialog.hide();
|
||||
cur_frm.refresh();
|
||||
dialog.fields_dict.update.$input.click(function() {
|
||||
args = dialog.get_values();
|
||||
if(!args) return;
|
||||
cur_frm.call({
|
||||
doc: cur_frm.doc,
|
||||
method: "declare_enquiry_lost",
|
||||
args: args.reason,
|
||||
callback: function(r) {
|
||||
if(r.exc) {
|
||||
msgprint("There were errors.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(arg) {
|
||||
$c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name),'declare_enquiry_lost',arg,call_back);
|
||||
}
|
||||
else{
|
||||
msgprint("Please add enquiry lost reason");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
dialog.hide();
|
||||
cur_frm.refresh();
|
||||
},
|
||||
btn: this
|
||||
})
|
||||
});
|
||||
dialog.show();
|
||||
|
||||
if(!e_lost_dialog){
|
||||
set_e_lost_dialog();
|
||||
}
|
||||
e_lost_dialog.show();
|
||||
}
|
||||
|
||||
//get query select Territory
|
||||
|
@ -36,10 +36,23 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
|
||||
},
|
||||
refresh: function(doc, dt, dn) {
|
||||
this._super(doc, dt, dn);
|
||||
|
||||
cur_frm.dashboard.reset(doc);
|
||||
if(!doc.__islocal) {
|
||||
if(doc.status=="Converted" || doc.status=="Order Confirmed") {
|
||||
cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-success", "icon-ok-sign");
|
||||
} else if(doc.status==="Order Lost") {
|
||||
cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-danger", "icon-exclamation-sign");
|
||||
} else {
|
||||
cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-info", "icon-exclamation-sign");
|
||||
}
|
||||
}
|
||||
|
||||
if(doc.docstatus == 1 && doc.status!='Order Lost') {
|
||||
if(doc.docstatus == 1 && doc.status!=='Order Lost') {
|
||||
cur_frm.add_custom_button('Make Sales Order', cur_frm.cscript['Make Sales Order']);
|
||||
cur_frm.add_custom_button('Set as Lost', cur_frm.cscript['Declare Order Lost']);
|
||||
if(doc.status!=="Order Confirmed") {
|
||||
cur_frm.add_custom_button('Set as Lost', cur_frm.cscript['Declare Order Lost']);
|
||||
}
|
||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
|
||||
}
|
||||
|
||||
@ -150,51 +163,35 @@ cur_frm.cscript.pull_enquiry_detail = function(doc,cdt,cdn){
|
||||
// declare order lost
|
||||
//-------------------------
|
||||
cur_frm.cscript['Declare Order Lost'] = function(){
|
||||
var qtn_lost_dialog;
|
||||
var dialog = new wn.ui.Dialog({
|
||||
title: "Set as Lost",
|
||||
fields: [
|
||||
{"fieldtype": "Text", "label": "Reason for losing", "fieldname": "reason",
|
||||
"reqd": 1 },
|
||||
{"fieldtype": "Button", "label": "Update", "fieldname": "update"},
|
||||
]
|
||||
});
|
||||
|
||||
set_qtn_lost_dialog = function(){
|
||||
qtn_lost_dialog = new Dialog(400,400,'Add Quotation Lost Reason');
|
||||
qtn_lost_dialog.make_body([
|
||||
['HTML', 'Message', '<div class="comment">Please add quotation lost reason</div>'],
|
||||
['Text', 'Quotation Lost Reason'],
|
||||
['HTML', 'Response', '<div class = "comment" id="update_quotation_dialog_response"></div>'],
|
||||
['HTML', 'Add Reason', '<div></div>']
|
||||
]);
|
||||
|
||||
var add_reason_btn1 = $a($i(qtn_lost_dialog.widgets['Add Reason']), 'button', 'button');
|
||||
add_reason_btn1.innerHTML = 'Add';
|
||||
add_reason_btn1.onclick = function(){ qtn_lost_dialog.add(); }
|
||||
|
||||
var add_reason_btn2 = $a($i(qtn_lost_dialog.widgets['Add Reason']), 'button', 'button');
|
||||
add_reason_btn2.innerHTML = 'Cancel';
|
||||
$y(add_reason_btn2,{marginLeft:'4px'});
|
||||
add_reason_btn2.onclick = function(){ qtn_lost_dialog.hide();}
|
||||
|
||||
qtn_lost_dialog.onshow = function() {
|
||||
qtn_lost_dialog.widgets['Quotation Lost Reason'].value = '';
|
||||
$i('update_quotation_dialog_response').innerHTML = '';
|
||||
}
|
||||
|
||||
qtn_lost_dialog.add = function() {
|
||||
// sending...
|
||||
$i('update_quotation_dialog_response').innerHTML = 'Processing...';
|
||||
var arg = strip(qtn_lost_dialog.widgets['Quotation Lost Reason'].value);
|
||||
var call_back = function(r,rt) {
|
||||
if(r.message == 'true'){
|
||||
$i('update_quotation_dialog_response').innerHTML = 'Done';
|
||||
qtn_lost_dialog.hide();
|
||||
cur_frm.refresh();
|
||||
dialog.fields_dict.update.$input.click(function() {
|
||||
args = dialog.get_values();
|
||||
if(!args) return;
|
||||
cur_frm.call({
|
||||
method: "declare_order_lost",
|
||||
doc: cur_frm.doc,
|
||||
args: args.reason,
|
||||
callback: function(r) {
|
||||
if(r.exc) {
|
||||
msgprint("There were errors.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(arg) $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name),'declare_order_lost',arg,call_back);
|
||||
else msgprint("Please add Quotation lost reason");
|
||||
}
|
||||
}
|
||||
|
||||
if(!qtn_lost_dialog){
|
||||
set_qtn_lost_dialog();
|
||||
}
|
||||
qtn_lost_dialog.show();
|
||||
dialog.hide();
|
||||
cur_frm.refresh();
|
||||
},
|
||||
btn: this
|
||||
})
|
||||
});
|
||||
dialog.show();
|
||||
|
||||
}
|
||||
|
||||
//================ Last Quoted Price and Last Sold Price suggestion ======================
|
||||
|
@ -191,7 +191,7 @@ class DocType(SellingController):
|
||||
|
||||
# declare as order lost
|
||||
#-------------------------
|
||||
def declare_order_lost(self,arg):
|
||||
def declare_order_lost(self, arg):
|
||||
chk = sql("select t1.name from `tabSales Order` t1, `tabSales Order Item` t2 where t2.parent = t1.name and t1.docstatus=1 and t2.prevdoc_docname = %s",self.doc.name)
|
||||
if chk:
|
||||
msgprint("Sales Order No. "+cstr(chk[0][0])+" is submitted against this Quotation. Thus 'Order Lost' can not be declared against it.")
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-05-24 19:29:08",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-02 16:49:52",
|
||||
"modified": "2013-07-03 11:54:11",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -46,7 +46,8 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "customer_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Customer"
|
||||
"label": "Customer",
|
||||
"options": "icon-user"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
@ -117,17 +118,16 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "customer_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"hidden": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Customer Name",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "address_display",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 0,
|
||||
"hidden": 1,
|
||||
"in_filter": 0,
|
||||
"label": "Address",
|
||||
"oldfieldname": "customer_address",
|
||||
@ -138,32 +138,29 @@
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_display",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 0,
|
||||
"hidden": 1,
|
||||
"in_filter": 0,
|
||||
"label": "Contact",
|
||||
"print_hide": 0,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_mobile",
|
||||
"fieldtype": "Text",
|
||||
"hidden": 0,
|
||||
"hidden": 1,
|
||||
"label": "Mobile No",
|
||||
"print_hide": 0,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "customer",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_email",
|
||||
"fieldtype": "Text",
|
||||
"hidden": 0,
|
||||
"hidden": 1,
|
||||
"label": "Contact Email",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
@ -240,6 +237,7 @@
|
||||
"fieldname": "section_break0",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Price List and Currency",
|
||||
"options": "icon-globe",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
@ -322,6 +320,7 @@
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Items",
|
||||
"oldfieldtype": "Section Break",
|
||||
"options": "icon-shopping-cart",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"search_index": 0
|
||||
@ -343,7 +342,6 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "sec_break23",
|
||||
"fieldtype": "Section Break",
|
||||
"options": "Simple",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
@ -419,6 +417,7 @@
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Taxes",
|
||||
"oldfieldtype": "Section Break",
|
||||
"options": "icon-money",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
@ -518,6 +517,7 @@
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Totals",
|
||||
"oldfieldtype": "Section Break",
|
||||
"options": "icon-money",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
@ -618,6 +618,7 @@
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Terms and Conditions",
|
||||
"oldfieldtype": "Section Break",
|
||||
"options": "icon-legal",
|
||||
"print_hide": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
@ -665,6 +666,7 @@
|
||||
"fieldname": "contact_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Contact Info",
|
||||
"options": "icon-bullhorn",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
@ -754,6 +756,7 @@
|
||||
"fieldtype": "Section Break",
|
||||
"label": "More Info",
|
||||
"oldfieldtype": "Section Break",
|
||||
"options": "icon-file-text",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
@ -880,8 +883,9 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "communication_history",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Communication History",
|
||||
"oldfieldtype": "Section Break",
|
||||
"options": "Simple",
|
||||
"options": "icon-comments",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user