";
return result;
},
placement:'left',
html:true,
});
$('#call_st_div').removeClass(['clickable'])
//**********on submitt********
$('#submitt').click(function(){
var selreg = $('#id_region').val();
var selcity = $('#citi').val();
console.log(selreg);
if(selreg == "" || selreg == null)
{
alert('Kindly Select the Appropriate Region');
return false;
}
if(selcity == null)
{
alert('Kindly Select the Appropriate City');
return false;
}
var st_date = $('#sdate').val();
var en_date = $('#edate').val();
if(st_date == "" || en_date == ""){
alert("Kindly select both date filters");
return false;
}
$("#loadingDiv").show();
});
//################################# filtering using regions ##################
$("#id_region").change(function(){
var region = [];
var city = [];
isAll = false
$("#id_region :selected").each(function(){
temp = $(this).val();
if(temp == "8"){
console.log("test")
isAll = true
}
else{
region.push($(this).val());
}
});
if (isAll == true)
{
region.length = 0;
region.push("8");
}
$("#loadingDiv").show();
console.log(region);
$.ajax({
'method':'POST',
'url':'/mis/new_sales_report/',
'data':{'Region':'','reg':region,'city':city},
success:function(response,Status,code){
var resp = JSON.parse(response);
console.log(resp);
$('#citi').empty();
for(var i=0;i")
.text(resp[i]));
}
$("#loadingDiv").hide();
},
error: function(jqHXR,exception) {
$("#loadingDiv").hide();
// alert(exception+" \n"+jqXHR['responseText']);
console.log("eeeror=====================");
// console.log(jqXHR['responseText']);
console.log(exception)
},
});
});
//***********multiselect region *******
$("#citi").attr('multiple','multiple');
$("#id_region").attr('multiple','multiple');
$("#citi").click(function(){
var city = [];
isAll = false
$("#citi :selected").each(function(){
temp = $(this).val();
if (temp == "ALL"){
console.log("test");
isAll = true
}
else {
city.push($(this).val())
}
});
if (isAll == true)
{
city.length = 0;
city.push("ALL");
}
console.log(city)
});
//***********end of multiselct ********
$('.call_button').parent().css({'vertical-align':'middle','text-align':'center'});
$('#sdate').val('');
$('#edate').val('');
$('#citi').val('');
$('#id_region').val(region)
console.log('>>>>>>>>>>>>>>>>>.'+''+'')
$(document).on('click','.close_btn',function(){
var temp = $(this).closest('div.popover').prev().popover().prevObject[0]
console.log(temp);
$(temp).popover('hide');
});
$('body').on('hidden.bs.popover', function (e) {
$(e.target).data("bs.popover").inState.click = false;
});
$(document).on('show.bs.popover', function() {
$('.popover').not(this).popover('hide');
});
$('#table1').on('click', '.test', function () {
var th = $('#table1 th').eq($(this).index());
console.log(th.text()); // returns [object Object]
console.log($(this).parent('tr')[0]['children'][0]['innerText']);
var type = $(this).parent('tr')[0]['children'][0]['innerText'];
sdate = $(this).parent('tr')[0]['children'][1]['innerText'];
edate = $(this).parent('tr')[0]['children'][2]['innerText'];
console.log(type);
console.log(sdate);
console.log(edate);
});
$('#table1').on('click','.test',function(){
var col_id = $('#table1 th').eq($(this).index()).text();
if (col_id != 'FROM DATE' && col_id !='TO DATE')
{
var city = [];
$('#citi option').each(function() {
city.push( $(this).attr('value') );
});
var region = [];
$('#id_region :selected').each(function() {
region.push( $(this).attr('value') );
});
var ots='';
console.log($(this).parent('tr')[0])
var type = $(this).parent('tr')[0]['children'][0]['innerText'];
var type = type.trim();
if (type == 'HDFC-IN')
ots = '1'
else if(type == 'HDFC-OUT')
ots = '2'
else if(type == 'ICICI-IN')
ots = '3'
else if(type == 'ICICI-OUT')
ots = '4'
else if(type == 'TVS-IN')
ots = '7'
else if(type == 'TVS-OUT')
ots = '8'
else if(type == 'CSA-Sale')
ots = '5'
else if(type == 'ICICI-CV-IN')
ots = '9'
else if(type == 'ICICI-CV-OUT')
ots = '10'
else if(type == 'VKGB-IN')
ots = '15'
else if(type == 'VKGB-OUT')
ots = '16'
else if (type== 'MPGPS_RM')
ots = '18'
else if(type == 'CSA-Sale')
ots = '5'
else if(type=='HDFC-IN-TWO-W')
ots = '22' //These are sales medium id
else if(type=='DEMO_CHANNEL_PARTNER')
ots = '21'
else if(type=='DEMO_CHANNEL_PARTNER-TOTAL')
ots = ['21']
else if(type=='DEMO_EMPLOYEE')
ots = '20'
else if(type=='DEMO_EMPLOYEE-TOTAL')
ots = ['20']
else if(type=='DEMO_FRIENDS_RELATIVE')
ots = '19'
else if(type=='DEMO_FRIENDS_RELATIVE-TOTAL')
ots = ['19']
else if(type=='DEALER')
ots = '17'
else if(type=='DEALER-TOTAL')
ots = ['17']
else if(type == 'HDFC-TOTAL')
ots = ['1','2']
else if(type == 'ICICI-TOTAL')
ots = ['3','4']
else if(type == 'ICICI-CV-TOTAL')
ots = ['9','10']
else if(type == 'VKGB-TOTAL')
ots = ['15','16']
else if(type=='TVS-TOTAL')
ots = ['7','8']
else if(type=='MPGPS_RM-TOTAL')
ots = ['18']
else if(type=='HDFC-IN-TWO-W-TOTAL')
ots = ['22'] //These are sales medium id
else if(type=='MARKETING_ASSOCIATES')
ots = ['24']
else if(type=='MARKETING_ASSOCIATES-TOTAL')
ots = ['24']
else if(type=='MPGPS_EMPLOYEE')
ots = ['23']
else if(type=='OUTSIDE-TOTAL')
ots = ['24','23']
else if(type=='CARS24')
ots = ['26']
else if(type=='CUSTOMERS_SUPPORT_MPGPS')
ots = ['31']
else if(type == 'FESTIVAL_OFFER')
ots = ['34']
else if(type == 'BAJAJ_FINANCE')
ots = ['35']
else if(type == 'CARIOT')
ots = ['39']
else if(type == 'SALES_MPGPS')
ots = ['32']
else if(type == 'RKP')
ots = ['40']
else if(type == 'TRACTORJUNCTION')
ots = ['43']
else if(type == 'RENEWALS_MPGPS')
ots = ['29']
else if(type == 'TSE_Contractor')
ots = ['33']
else if(type == 'CARIOT')
ots = ['39']
else if(type == 'DISTRIBUTOR')
ots = ['27']
else if(type == 'INTERSTELLAR')
ots = ['44']
else if(type =='POD_CHANNEL')
ots = ['45']
else if(type == 'POD_DIRECT_SALES')
ots = ['46']
else if(type == 'GRAND-TOTAL')
ots = ['1','2','3','4','5','7','8','9','10','15','16','18','22','24','19','17','20','21','23','26','29','30','31','32','27','33','34','35','39','40','43','44','45','46']
sdate = $(this).parent('tr')[0]['children'][1]['innerText'];
edate = $(this).parent('tr')[0]['children'][2]['innerText'];
// var region = $('#id_region').val();
// var city = $('#citi').val();
// console.log(city)
console.log(sdate)
console.log(edate)
// console.log(city)
console.log(ots)
$.extend(
{
redirectPost: function(location, args)
{
var form = '';
$.each( args, function( key, value ) {
form += '';
});
$('').appendTo($(document.body)).submit();
}
});
var redirect = '/mis/new_sales_report/';
$.redirectPost(redirect, {'col_id': col_id, 'sdate': sdate, 'edate': edate, 'region[]':region, 'city[]':city, 'clicked':true, 'ots_status[]': ots});
// jquery extend function
}
});
$('#table2').on('click', '.test', function () {
var col_id = $('#table2 th').eq($(this).index()).text();
if (col_id != 'CALL STATUS')
{ if (col_id == 'PENDING')
{
col_id = "SCH_PENDING"
}
var ots = '';
var city = [];
$('#citi option').each(function() {
city.push( $(this).attr('value') );
});
var region = [];
$('#id_region :selected').each(function() {
region.push( $(this).attr('value') );
});
var type = $(this).parent('tr')[0]['children'][0]['innerText'];
/*if (type == "HDFC Sales")
ots = '1'
else
ots = '2'*/
var type = type.trim();
if (type == 'HDFC-IN')
ots = '1'
else if(type == 'HDFC-OUT')
ots = '2'
else if(type == 'ICICI-IN')
ots = '3'
else if(type == 'ICICI-OUT')
ots = '4'
else if(type == 'TVS-IN')
ots = '7'
else if(type == 'TVS-OUT')
ots = '8'
else if(type == 'ICICI-CV-IN')
ots = '9'
else if(type == 'ICICI-CV-OUT')
ots = '10'
else if(type == 'VKGB-IN')
ots = '15'
else if(type == 'VKGB-OUT')
ots = '16'
else if (type== 'MPGPS_RM')
ots = '18'
else if(type == 'CSA-Sale')
ots = '5'
else if(type=='HDFC-IN-TWO-W')
ots = '22' //These are sales medium id
else if(type=='DEMO_CHANNEL_PARTNER')
ots = '21'
else if(type=='DEMO_CHANNEL_PARTNER-TOTAL')
ots = ['21']
else if(type=='DEMO_EMPLOYEE')
ots = '20'
else if(type=='DEMO_EMPLOYEE-TOTAL')
ots = ['20']
else if(type=='DEMO_FRIENDS_RELATIVE')
ots = '19'
else if(type=='DEMO_FRIENDS_RELATIVE-TOTAL')
ots = ['19']
else if(type=='DEALER')
ots = '17'
else if(type=='DEALER-TOTAL')
ots = ['17']
else if(type == 'HDFC_TOTAL')
ots = ['1','2']
else if(type == 'ICICI_TOTAL')
ots = ['3','4']
else if(type == 'ICICI-CV_TOTAL')
ots = ['9','10']
else if(type == 'VKGB_TOTAL')
ots = ['15','16']
else if(type=='TVS_TOTAL')
ots = ['7','8']
else if (type== 'MPGPS_RM-TOTAL')
ots = ['18']
else if(type=='HDFC-IN-TWO-W-TOTAL')
ots = ['22'] //These are sales medium id
else if(type=='MARKETING_ASSOCIATES')
ots = ['24']
else if(type=='MARKETING_ASSOCIATES-TOTAL')
ots = ['24']
else if(type=='MPGPS_EMPLOYEE')
ots = ['23']
else if(type=='OUTSIDE-TOTAL')
ots = ['24','23']
else if(type=='CARS24')
ots = ['26']
else if(type=='BAJAJ_FINANCE')
ots = ['35']
else if(type == 'CARIOT')
ots = ['39']
else if(type == 'RKP')
ots = ['40']
else if(type == 'TRACTORJUNCTION')
ots = ['43']
else if(type == 'SALES_MPGPS')
ots = ['32']
else if(type == 'RENEWALS_MPGPS')
ots = ['29']
else if(type == 'TSE_Contractor')
ots = ['33']
else if(type == 'CARIOT')
ots = ['39']
else if(type == 'DISTRIBUTOR')
ots = ['27']
else if(type == 'INTERSTELLAR')
ots = ['44']
else if(type == 'GRAND-TOTAL')
ots = ['1','2','3','4','5','7','8','9','10','15','16','18','22','24','19','17','20','21','23','26','35','39','40','43','32','44']
var sdate = $('#sdate').val()
var edate = $('#edate').val()
// var region = $('#id_region').val();
//var city = $('#citi').val();
console.log(sdate)
$.extend(
{
redirectPost: function(location, args)
{
var form = '';
$.each( args, function( key, value ) {
form += '';
});
$('').appendTo($(document.body)).submit();
}
});
var redirect = '/mis/new_sales_report/';
$.redirectPost(redirect, {'col_id': col_id, 'sdate': sdate, 'edate': edate, 'region[]':region, 'city[]':city, 'clicked':true, 'ots_status[]': ots});
// jquery extend function
}
});
$('#table3').on('click', '.test', function () {
var ots = '';
var col_id = $('#table3 th').eq($(this).index()).text();
{ if (col_id == 'PENDING' || col_id == 'COMPLETED')
{
col_id = "EXE_"+col_id
}
}
var city = [];
$('#citi option').each(function() {
city.push( $(this).attr('value') );
});
var region = [];
$('#id_region :selected').each(function() {
region.push( $(this).attr('value') );
});
var type = $(this).parent('tr')[0]['children'][0]['innerText'];
console.log(type)
/*if (type == "HDFC Sales")
ots = '1'
else
ots = '2'*/
var type = type.trim();
if (type == 'HDFC-IN')
ots = '1'
else if(type == 'HDFC-OUT')
ots = '2'
else if(type == 'ICICI-IN')
ots = '3'
else if(type == 'ICICI-OUT')
ots = '4'
else if(type == 'TVS-IN')
ots = '7'
else if(type == 'TVS-OUT')
ots = '8'
else if(type == 'ICICI-CV-IN')
ots = '9'
else if(type == 'ICICI-CV-OUT')
ots = '10'
else if(type == 'VKGB-IN')
ots = '15'
else if(type == 'VKGB-OUT')
ots = '16'
else if (type== 'MPGPS_RM')
ots = '18'
else if(type == 'CSA-Sale')
ots = '5'
else if(type=='HDFC-IN-TWO-W')
ots = '22' //These are sales medium id
else if(type == 'HDFC-TOTAL')
ots = ['1','2']
else if(type=='DEMO_CHANNEL_PARTNER')
ots = '21'
else if(type=='DEMO_CHANNEL_PARTNER-TOTAL')
ots = ['21']
else if(type=='DEMO_EMPLOYEE')
ots = '20'
else if(type=='DEMO_EMPLOYEE-TOTAL')
ots = ['19']
else if(type=='DEMO_FRIENDS_RELATIVE')
ots = '19'
else if(type=='DEMO_FRIENDS_RELATIVE-TOTAL')
ots = ['20']
else if(type=='DEALER')
ots = '17'
else if(type=='DEALER-TOTAL')
ots = ['17']
else if(type == 'ICICI-TOTAL')
ots = ['3','4']
else if(type == 'ICICI-CV-TOTAL')
ots = ['9','10']
else if(type == 'VKGB-TOTAL')
ots = ['15','16']
else if (type== 'MPGPS_RM-TOTAL')
ots = ['18']
else if(type=='HDFC-IN-TWO-W-TOTAL')
ots = ['22'] //These are sales medium id
else if(type=='TVS-TOTAL')
ots = ['7','8']
else if(type=='MARKETING_ASSOCIATES')
ots = ['24']
else if(type=='MARKETING_ASSOCIATES-TOTAL')
ots = ['24']
else if(type=='MPGPS_EMPLOYEE')
ots = ['23']
else if(type=='OUTSIDE-TOTAL')
ots = ['24','23']
else if(type=='CARS24')
ots = ['26']
else if(type=='BAJAJ_FINANCE')
ots = ['35']
else if(type == 'CARIOT')
ots = ['39']
else if(type == 'RKP')
ots = ['40']
else if(type == 'TRACTORJUNCTION')
ots = ['43']
else if(type == 'RENEWALS_MPGPS')
ots = ['29']
else if(type == 'TSE_Contractor')
ots = ['33']
else if(type == 'CARIOT')
ots = ['39']
else if(type == 'DISTRIBUTOR')
ots = ['27']
else if(type == 'INTERSTELLAR')
ots = ['44']
else if(type == 'GRAND-TOTAL')
ots = ['1','2','3','4','5','7','8','9','10','15','16','18','22','24','19','17','20','21','23','26','35','39','40','43','44']
console.log(type)
var sdate = $('#sdate').val()
var edate = $('#edate').val()
// var region = $('#id_region').val();
// var city = $('#citi').val();
$.extend(
{
redirectPost: function(location, args)
{
var form = '';
$.each( args, function( key, value ) {
form += '';
});
$('').appendTo($(document.body)).submit();
}
});
var redirect = '/mis/new_sales_report/';
$.redirectPost(redirect, {'col_id': col_id, 'sdate': sdate, 'edate': edate, 'region[]':region, 'city[]':city, 'clicked':true, 'ots_status[]': ots});
// jquery extend function
});
$('#table4').on('click', '.test', function () {
var ots = '';
var city = [];
$('#citi option').each(function() {
city.push( $(this).attr('value') );
});
var region = [];
$('#id_region :selected').each(function() {
region.push( $(this).attr('value') );
});
var col_id = $('#table4 th').eq($(this).index()).text();
if (col_id == 'OVERALL PENDING')
{
col_id ='OVERALL_PENDING'
}
var type = $(this).parent('tr')[0]['children'][0]['innerText'];
console.log(type)
/*if (type == "HDFC Sales")
ots = '1'
else
ots = '2'*/
var type = type.trim();
if (type == 'HDFC-IN')
ots = '1'
else if(type == 'HDFC-OUT')
ots = '2'
else if(type == 'ICICI-IN')
ots = '3'
else if(type == 'ICICI-OUT')
ots = '4'
else if(type == 'TVS-IN')
ots = '7'
else if(type == 'TVS-OUT')
ots = '8'
else if(type == 'ICICI-CV-IN')
ots = '9'
else if(type == 'ICICI-CV-OUT')
ots = '10'
else if(type == 'VKGB-IN')
ots = '15'
else if(type == 'VKGB-OUT')
ots = '16'
else if (type== 'MPGPS_RM')
ots = '18'
else if(type == 'CSA-Sale')
ots = '5'
else if(type=='HDFC-IN-TWO-W')
ots = '22' //These are sales medium id
else if(type == 'HDFC-TOTAL')
ots = ['1','2']
else if(type=='DEMO_CHANNEL_PARTNER')
ots = '21'
else if(type=='DEMO_CHANNEL_PARTNER-TOTAL')
ots = ['21']
else if(type=='DEMO_EMPLOYEE')
ots = '20'
else if(type=='DEMO_EMPLOYEE-TOTAL')
ots = ['20']
else if(type=='DEALER')
ots = '17'
else if(type=='DEALER-TOTAL')
ots = ['17']
else if(type=='DEMO_FRIENDS_RELATIVE')
ots = '19'
else if(type=='DEMO_FRIENDS_RELATIVE-TOTAL')
ots = ['19']
else if(type == 'ICICI-TOTAL')
ots = ['3','4']
else if(type == 'ICICI-CV-TOTAL')
ots = ['9','10']
else if (type== 'MPGPS_RM-TOTAL')
ots = ['18']
else if(type=='HDFC-IN-TWO-W-TOTAL')
ots = ['22'] //These are sales medium id
else if(type == 'VKGB-TOTAL')
ots = ['15','16']
else if(type=='TVS-TOTAL')
ots = ['7','8']
else if(type=='MARKETING_ASSOCIATES')
ots = ['24']
else if(type=='MARKETING_ASSOCIATES-TOTAL')
ots = ['24']
else if(type=='MPGPS_EMPLOYEE')
ots = ['23']
else if(type=='OUTSIDE-TOTAL')
ots = ['24','23']
else if(type=='CARS24')
ots = ['26']
else if(type=='BAJAJ_FINANCE')
ots = ['35']
else if(type == 'CARIOT')
ots = ['39']
else if(type == 'RKP')
ots = ['40']
else if(type == 'TRACTORJUNCTION')
ots = ['43']
else if(type == 'RENEWALS_MPGPS')
ots = ['29']
else if(type == 'TSE_Contractor')
ots = ['33']
else if(type == 'CARIOT')
ots = ['39']
else if(type == 'DISTRIBUTOR')
ots = ['27']
else if(type == 'INTERSTELLAR')
ots = ['44']
else if(type == 'GRAND-TOTAL')
ots = ['1','2','3','4','5','7','8','9','10','15','16','18','22','24','19','17','20','21','23','26','35','39','40','43','44']
var sdate = $('#sdate').val()
var edate = $('#edate').val()
// var region = $('#id_region').val();
// var city = $('#citi').val();
$.extend(
{
redirectPost: function(location, args)
{
var form = '';
$.each( args, function( key, value ) {
form += '';
});
$('').appendTo($(document.body)).submit();
}
});
var redirect = '/mis/new_sales_report/';
$.redirectPost(redirect, {'col_id': col_id, 'sdate': sdate, 'edate': edate, 'region[]':region, 'city[]':city, 'clicked':true, 'ots_status[]': ots});
// jquery extend function
// alert(th.text()); // returns [object Object]
});
$('#HDFC,#Outside').click(function(){
$('.popover-content').removeClass('clickable');
});
});