txt1

mail@pastecode.io avatar
unknown
plain_text
2 years ago
30 kB
2
Indexable
function getFilteredResponseOfClientMaster() {
    console.log("HELLO")
    $("#client_master_reponse").html("");
    var clientFilter = $(".myclient:checked").val();
    var formData = {
      clientFilter: clientFilter,
    };
    $.ajax({
      type: "POST",
      url: "/get-clientMaster-report",
      data: JSON.stringify(formData),
      contentType: "application/json",
      Accept: "application/text",
      dataType: "text",
      beforeSend: function () {
        $(".ajax-loader").css("display", "flex");
      },
      success: function (data) {
        $("#client_master_reponse").html(data);
      },
      complete: function () {
        $(".ajax-loader").css("display", "none");
      },
      error: function (err) {
        console.log(err);
        $(".fileError").css("display", "flex");
      },
    });
}

  // sample ajax code
function SearchTradeData() {
    var client_code1 = $("#txt1").val() || "";
    if (client_code1) {
      if (client_code1.includes("-") == true) {
        var client_code = client_code1.substring(0, client_code1.indexOf("-"));
        $("#client_code_err").text("");
      } else {
        $("#client_code_err").text("please select client");
        return false;
      }
    }
  
    var formData = {
      FromDt: $("#FromDt").val(),
      ToDt: $("#ToDt").val(),
      txt1: client_code || "",
      txt2: $("#txt2").val() || "",
      txt3: $("#txt3").val() || "",
      Fil1Num: $("#Fil1Num").val() || 0,
      Fil2Num: $("#Fil2Num").val() || 0,
      Fil3Num: $("#Fil3Num").val() || 0,
      Fil1LBL: $("#Fil1LBL").val() || "",
      Fil2LBL: $("#Fil2LBL").val() || "",
      Fil3LBL: $("#Fil3LBL").val() || "",
      Fil1Cmb: $("#Fil1Cmb").val() || "",
      Fil2Cmb: $("#Fil2Cmb").val() || "",
      Fil3Cmb: $("#Fil3Cmb").val() || "",
      RepNo: $("#RepNo").val() || "",
    };
  
    console.log(formData);
    $.ajax({
      type: "POST",
      url: "/trades-search",
      data: JSON.stringify(formData),
      contentType: "application/json",
      Accept: "application/text",
      dataType: "text",
      beforeSend: function () {
        $("#fetch").html("Requesting...");
        $("#fetch").prop("disabled", true);
      },
      success: function (data) {
        console.log("Success");
  
        $("#search_data").html(data);
        $("#collapse1").removeClass("in");
        $("#collapse2").addClass("in");
      },
      error: function (err) {
        console.log("Error  ");
        console.log(err);
      },
      complete: function () {
        $("#fetch").html("Fetch");
        $("#fetch").prop("disabled", false);
      },
    });
  }


  // START FOLLOWUP

  function GetOutstandingBalanceFUP() {
    let as_on_date="";
    var as_on_date1 = $("#as_on_date").val();
    var client_code1 = $("#client_code").val();
    var client_code = client_code1.substring(0, client_code1.indexOf("-"));
    var report_name = $("#report_name").val();
    var client_type = $("#client_type").val();   
    if (!as_on_date1) {
      $("#as_on_date_err").html("Please select from date");
      return false;
    } else {
       $("#as_on_date_err").html("");
       var myDate = new Date(as_on_date1);
       var d = myDate.getDate();
       var m =  myDate.getMonth();
       m += 1;  
       var y = myDate.getFullYear();
       as_on_date=(y+ "-" + m + "-" + d);
      //  console.log(as_on_date,"DATE")
       as_on_date=as_on_date.replaceAll("-","")
    }
    console.log(as_on_date,client_code1,client_code,report_name,client_type)
    var formData = {
      as_on_date: as_on_date,
      report_name: report_name,
      client_code: client_code || "",
      client_type: client_type,
    };
    $.ajax({
      type: "POST",
      url: "/get-outstanding-balance-followup",
      data: JSON.stringify(formData),
      contentType: "application/json",
      Accept: "application/text",
      dataType: "text",
      beforeSend: function () {
        $(".ajax-loader").css("display", "flex");
      },
      success: function (data) {
        $("#outstandingbalance").html(data);
      },
      error: function (err) {
        console.log(err);
        $(".fileError").css("display", "flex");
      },
      complete: function () {
        $(".ajax-loader").css("display", "none");
      },
    });
  }

  function getSqareupReport() {
    let as_on_date="";
    var as_on_date1 = $("#as_on_date").val();
    var client_code1 = $("#client_code").val();
    var client_code = client_code1.substring(0, client_code1.indexOf("-"));
    var report_name = $("#report_name").val();
    var period_type = $("#period_type").val();
    // console.log(as_on_date1,client_code.client_code1,report_name,period_type)
    if (!as_on_date1) {
      $("#as_on_date_err").html("Please select from date");
      return false;
    } else {
      $("#as_on_date_err").html("");
      as_on_date=as_on_date1.split("-").reverse().join("");
      // console.log(as_on_date)
      // as_on_date=as_on_date.replaceAll("-","");
    } 
    var formData = {
      as_on_date: as_on_date,
      report_name: report_name,
      client_code: client_code || "",
      period_type: period_type || "",
    };
    console.log("HELLO",formData)
    $.ajax({
      type: "POST",
      url: "/get-squareup-report",
      data: JSON.stringify(formData),
      contentType: "application/json",
      Accept: "application/text",
      dataType: "text",
      beforeSend: function () {
        $(".ajax-loader").css("display", "flex");
      },
      success: function (data) {
        $("#trade_listing_report_reponse").html(data);
      },
      error: function (err) {
        console.log(err);
        $(".fileError").css("display", "flex");
      },
      complete: function () {
        $(".ajax-loader").css("display", "none");
      },
    });
  }
  

  // END FOLLOWUP


  // PLEDE
  function GetpledgeReport() {
    var client_code1 = $("#client_code").val();
    var client_code = client_code1.substring(0, client_code1.indexOf("-"));
    console.log(client_code1)
    if (!client_code) {
      $("#client_code_err").html("Please enter client code");
      return false;
    } else {
      $("#client_code_err").html("");
    }
    var formData = {
      client_code: client_code,
    };
    console.log(formData)
    $.ajax({
      type: "POST",
      url: "/GetpledgeReport",
      data: JSON.stringify(formData),
      contentType: "application/json",
      Accept: "application/text",
      dataType: "text",
      beforeSend: function () {
        $(".ajax-loader").css("display", "flex");
      },
      success: function (data) {
        console.log("Success");
        console.log(data);
        $("#pledge_response").html(data);
      },
      complete: function () {
        $(".ajax-loader").css("display", "none");
      },
      error: function (err) {
        console.log(err);
        $(".fileError").css("display", "flex");
      },
    });
  }

  function GetunpledgeReport(){
    var client_code1 = $("#client_code").val();
    var client_code = client_code1.substring(0, client_code1.indexOf("-"));
    if(!client_code){
      $("#client_code_err").html('Please enter client code')
      return false
    }else{
      $("#client_code_err").html('')
    }
    var formData = {
      'client_code': client_code,
    };
    // console.log(formData,"FORMDATA")
    $.ajax({
      type: 'POST',
      url: '/GetunpledgeReport',
      data: JSON.stringify(formData),
      contentType: "application/json",
      Accept: "application/text",
      dataType: "text",
      beforeSend: function(){
        $('#loader').removeClass('hidden')
  
      },
      success: function (data) {
        console.log('Success1');
        console.log(data);
        $('#unpledge_response').html(data);
      },
      error: function (err) {
        console.log('Error  ');
        console.log(err);
      },
      complete: function(){
        $('#loader').addClass('hidden')
      },
  
    });
  }


function GetstatusReport(){
    console.log("HELLO")
	var client_code1 = $("#client_code").val();
	var client_code = client_code1.substring(0, client_code1.indexOf("-"));
  console.log(client_code)
	if(!client_code){
		$("#client_code_err").html('Please enter client code')
		return false
	}else{
		$("#client_code_err").html('')
	}
	var formData = {
		'client_code': client_code,
	};
  console.log("FORMDATA",formData)
	$.ajax({
		type: 'POST',
		url: '/GetstatusReport',
		data: JSON.stringify(formData),
		contentType: "application/json",
		Accept: "application/text",
		dataType: "text",
		beforeSend: function(){
			$('#loader').removeClass('hidden')
		},
		success: function (data) {
			console.log('Success1');
			console.log(data);
			$('#status_response').html(data);
		},
		error: function (err) {
			console.log('Error  ');
			console.log(err);
		},
		complete: function(){
			$('#loader').addClass('hidden')
		},

	});
}

function statusdata()
{
	var client_code1 = $("#client_code").val();
	var client_code = client_code1.substring(0, client_code1.indexOf("-"));
console.log('client_code'+client_code);
 $("#tech-companies-1").empty();
 $.ajax({
	    url: "/GetpledgeUnpledgeStatus?client_code="+client_code+"&id=2",
	    type: 'Get',
 	    contentType: "application/json",
	  	Accept: "application/text",
	    dataType: 'text', // added data type
	    success: function(data)
	    {
		 //alert(data)
		   
		   $("#tech-companies-1").html(data);
		   
	   }
   });

}
  // PLEDE



  // START REPORTS

  function getTradeListingReport() {
    var from_date1 = "2023-01-01";
    var to_date1 = "2023-05-01";
    var client_code1 = $("#client_code").val();
    var client_code = client_code1.substring(0, client_code1.indexOf("-"));
    var report_name = $("#report_name").val();
    var segment_type = $("#segment_type").val();
    var exchange = $('input[name="exchange"]:checked').val() || "";
  
    // var exchange = $("#exchange").val();
  
    // if (Date.parse(from_date1) > Date.parse(to_date1)) {
    //   $("#to_date_err").html("To date must be greater than from date");
    //   return false;
    // }
    // validation
    if (client_code == "") {
      $("#trade_listing_report_reponse").html("");
    }
    if (!client_code) {
      $("#client_code_err").html("Please enter client code");
      return false;
    } else {
      $("#client_code_err").html("");
    }
    if (!from_date1) {
      $("#from_date_err").html("Please select from date");
      return false;
    } else {
      $("#from_date_err").html("");
    }
    if (!to_date1) {
      $("#to_date_err").html("Please select to date");
      return false;
    } else {
      $("#to_date_err").html("");
    }
    // if(!exchange){
    // 	$("#exchange_err").html('Please enter exchange')
    // 	return false
    // }else{
    // 	$("#exchange_err").html('')
    // }
  
    // if (from_date1) {
    //   let from_daten = formatDate(from_date1);
    //   console.log(from_daten);
    //   var datearray1 = from_daten.split("/");
    //   var newfrom_date =
    //     datearray1[1] + "/" + datearray1[0] + "/" + datearray1[2];
    // } else {
    //   from_date1 = "";
    // }
  
    // if (to_date1) {
    //   let to_daten = formatDate(to_date1);
    //   console.log(to_daten);
    //   var datearray1 = to_daten.split("/");
    //   var newto_date = datearray1[1] + "/" + datearray1[0] + "/" + datearray1[2];
    // } else {
    //   to_date1 = "";
    // }
  
    // var from_date = new Date(newfrom_date);
    // var to_date = new Date(newto_date);
  
    var formData = {
      from_date: from_date1.replaceAll("-",""),
      to_date: to_date1.replaceAll("-",""),
      report_name: report_name,
      client_code: client_code,
      segment_type: segment_type,
      exchange: exchange,
    };
    // console.log(formData);
    $.ajax({
      type: "POST",
      url: "/get-trade-listing-report",
      data: JSON.stringify(formData),
      contentType: "application/json",
      Accept: "application/text",
      dataType: "text",
      beforeSend: function () {
        $(".ajax-loader").css("display", "flex");
      },
      success: function (data) {
        console.log("Success");
        console.log(data);
        $("#trade_listing_report_reponse").html(data);
      },
      complete: function () {
        $(".ajax-loader").css("display", "none");
      },
      error: function (err) {
        console.log(err);
        $(".fileError").css("display", "flex");
      },
    });
  }
  

  function getOutstandingPositionReport() {
    // console.log("HELLLO")
    var as_on_date1 = $("#as_on_date").val();
    var client_type = $("#client_type").val();
    var client_code1 = $("#client_code").val();
    var client_code = client_code1.substring(0, client_code1.indexOf("-"));
    var report_name = $("#report_name").val();
    var exchange_segemnt =
      $('input[name="exchange_segment"]:checked').val() || "";
      // console.log("HELLO",exchange_segemnt)
    // console.log(as_on_date1,client_type,client_code1,client_code,report_name,exchange_segemnt)
    // validation
  
    if (!client_code) {
      $("#client_code_err").html("Please enter client code");
      return false;
    } else {
      $("#client_code_err").html("");
    }
    if (!as_on_date1) {
      $("#as_on_date_err").html("Please select from date");
      return false;
    } else {
      $("#as_on_date_err").html("");
      as_on_date1=as_on_date1.replaceAll("-","");
    }
  
  
    // var as_on_date = new Date(newas_on_date);
  
    var formData = {
      as_on_date: as_on_date1,
      report_name: report_name,
      client_code: client_code,
      client_type: client_type,
      exchange_segemnt: exchange_segemnt,
    };
    console.log(formData);
  
    $.ajax({
      type: "POST",
      url: "/get-outstanding-position-report",
      data: JSON.stringify(formData),
      contentType: "application/json",
      Accept: "application/text",
      dataType: "text",
      beforeSend: function () {
        $(".ajax-loader").css("display", "flex");
      },
      success: function (data) {
        console.log("Success");
        console.log(data);
        $("#outstandingposition").html(data);
      },
      complete: function () {
        $(".ajax-loader").css("display", "none");
      },
      error: function (err) {
        console.log(err);
        $(".fileError").css("display", "flex");
      },
    });
  }



function getLedgerDetailReport() {
     let from_date="20230401";
     let to_date="20230427";
     var client_type = $("#client_type").val();
     var client_code1 = $("#client_code").val();
     var client_code = client_code1.substring(0, client_code1.indexOf("-"));
    // var filter = $("#filter").val();
     var report_name = $("#report_name").val();
     var filter = $('input[name="filter[]"]:checked')
      .map(function () {
        return this.value;
      })
      .get();
      if(from_date=="" || to_date==""){
        $("#error-date-danger").html("Please Pick Date Range");
        return false;
      }
     var formData = {
      from_date:from_date.replaceAll("-","") ,
      to_date: to_date.replaceAll("-",""),
      report_name: report_name,
      client_code: client_code,
      filter: filter,
      client_type: client_type,
    };
    // console.log(formData,"form")
    $.ajax({
      type: "POST",
      url: "/get-ledger-detail-report",
      data: JSON.stringify(formData),
      contentType: "application/json",
      Accept: "application/text",
      dataType: "text",
      beforeSend: function () {
        $(".ajax-loader").css("display", "flex");
      },
      success: function (data) {
        console.log(data);
        $("#ledger_response").html(data);
      },
      complete: function () {
        $(".ajax-loader").css("display", "none");
      },
      error: function (err) {
        console.log(err);
        $(".fileError").css("display", "flex");
      },
    });
  }
  
function getOutstandingBalanceReport() {
    var as_on_date = $("#as_on_date").val();
    var client_code1 = $("#client_code").val();
    var client_code = client_code1.substring(0, client_code1.indexOf("-"));
    var report_name = $("#report_name").val();
    var filter = $('input[name="filter[]"]:checked')
      .map(function () {
        return this.value;
      })
      .get();
      // console.log(as_on_date1,client_code,report_name,filter)
    if (!as_on_date) {
      $("#as_on_date_err").html("Please select from date");
      return false;
    } else {
      $("#as_on_date_err").html("");
    }
    var formData = {
      as_on_date: as_on_date.replaceAll("-",""),
      report_name: report_name,
      client_code: client_code || "",
      filter: filter || "",
    };
    // console.log(formData,"")
    $.ajax({
      type: "POST",
      url: "/get-outstanding-balance-report",
      data: JSON.stringify(formData),
      contentType: "application/json",
      Accept: "application/text",
      dataType: "text",
      beforeSend: function () {
        $(".ajax-loader").css("display", "flex");
      },
      success: function (data) {
        $("#outstandingbalance").html(data);
      },
      complete: function () {
        $(".ajax-loader").css("display", "none");
      },
      error: function (err) {
        console.log(err);
        $(".fileError").css("display", "flex");
      },
    });
  }

function getDP_TransactionReport() {
    var from_date1 ="20230101";
    var to_date1 = "20230303";
    var client_code1 = $("#client_code").val();
    var client_code = client_code1.substring(0, client_code1.indexOf("-"));
    var report_name = $("#report_name").val();
    // console.log(from_date1,to_date1,client_code,client_code1,report_name);
    // validation

    if (!client_code) {
      $("#client_code_err").html("Please enter client code");
      return false;
    } else {
      $("#client_code_err").html("");
    }
    if (!from_date1) {
      $("#from_date_err").html("Please select from date");
      return false;
    } else {
      $("#from_date_err").html("");
    }
    if (!to_date1) {
      $("#to_date_err").html("Please select to date");
      return false;
    } else {
      $("#to_date_err").html("");
    }
    var formData = {
      from_date:from_date1.replaceAll("-",""),
      to_date: to_date1.replaceAll("-",""),
      report_name: report_name,
      client_code: client_code,
    };
    // console.log(formData,"FOR")
    $.ajax({
      type: "POST",
      url: "/get-dp-transaction-report",
      data: JSON.stringify(formData),
      contentType: "application/json",
      Accept: "application/text",
      dataType: "text",
      beforeSend: function () {
        $(".ajax-loader").css("display", "flex");
      },
      success: function (data) {
        console.log("Success");
        console.log(data);
        $("#dp_transaction_report_reponse").html(data);
      },
      complete: function () {
        $(".ajax-loader").css("display", "none");
      },
      error: function (err) {
        console.log(err);
        $(".fileError").css("display", "flex");
      },
    });
  }

function getDPHoldingReport() {
    var client_code1 = $("#client_code").val();
    var client_code = client_code1.substring(0, client_code1.indexOf("-"));
    var report_name = $("#report_name").val();
    // validation
    if (!client_code) {
      $("#client_code_err").html("Please enter client code");
      return false;
    } else {
      $("#client_code_err").html("");
    }
    var formData = {
      report_name: report_name,
      client_code: client_code,
    };
    // console.log(formData);  
    $.ajax({
      type: "POST",
      url: "/get-dp-hoding-report",
      data: JSON.stringify(formData),
      contentType: "application/json",
      Accept: "application/text",
      dataType: "text",
      beforeSend: function () {
        $(".ajax-loader").css("display", "flex");
      },
      success: function (data) {
        console.log("Success");
        console.log(data);
        $("#dp_holding_response").html(data);
      },
      complete: function () {
        $(".ajax-loader").css("display", "none");
      },
      error: function (err) {
        console.log(err);
        $(".fileError").css("display", "flex");
      },
    });
}

function getDP_BillReport() {
  var from_date1 ="2023-01-23";
  var to_date1 = "2023-03-27";
  var client_code1 = $("#client_code").val();
  var client_code = client_code1.substring(0, client_code1.indexOf("-"));
  var report_name = $("#report_name").val();

  // validation
  if (Date.parse(from_date1) > Date.parse(to_date1)) {
    $("#to_date_err").html("To date must be greater than from date");
    return false;
  }
  if (!client_code) {
    $("#client_code_err").html("Please enter client code");
    return false;
  } else {
    $("#client_code_err").html("");
  }
  var formData = {
    from_date: from_date1.replaceAll("-",""),
    to_date:  to_date1.replaceAll("-",""),
    report_name: report_name,
    client_code: client_code,
  };
  // console.log(formData,"HELLO")
  $.ajax({
    type: "POST",
    url: "/get-dp-bill-report",
    data: JSON.stringify(formData),
    contentType: "application/json",
    Accept: "application/text",
    dataType: "text",
    beforeSend: function () {
      $("#loader").removeClass("hidden");
    },
    success: function (data) {
      console.log("Success");
      console.log(data);
      $("#dp_bill_report_reponse").html(data);
    },
    error: function (err) {
      console.log("Error  ");
      console.log(err);
    },
    complete: function () {
      $("#loader").addClass("hidden");
    },
  });
}


function getSqareupReportInReports() {
  var as_on_date = $("#as_on_date").val();
  var client_code1 = $("#client_code").val();
  var client_code = client_code1.substring(0, client_code1.indexOf("-"));
  var report_name = $("#report_name").val();
  var period_type = $("#period_type").val();
  if (!as_on_date) {
    $("#as_on_date_err").html("Please select from date");
    return false;
  } else {
    $("#as_on_date_err").html("");
  }
  var formData = {
    as_on_date: as_on_date.replaceAll("-",""),
    report_name: report_name,
    client_code: client_code || "",
    period_type: period_type || "",
  };
  console.log(formData,"formdata");

  $.ajax({
    type: "POST",
    url: "/get-squareup-report",
    data: JSON.stringify(formData),
    contentType: "application/json",
    Accept: "application/text",
    dataType: "text",
    beforeSend: function () {
      $("#loader").removeClass("hidden");
    },
    success: function (data) {
      $("#trade_listing_report_reponse").html(data);
    },
    error: function (err) {
      console.log("Error  ");
      console.log(err);
    },
    complete: function () {
      $("#loader").addClass("hidden");
    },
  });
}

function getInvestorReport() {
  var from_date1 = "2023-01-24"
  var to_date1 = "2023-05-01"
  var client_code1 = $("#client_code").val();
  var client_code = client_code1.substring(0, client_code1.indexOf("-"));
  var report_name = $("#report_name").val();
  var investor_rep_filter = $("#investor_rep_filter").val();
  var scrip_settl_summery = $("#scrip_settl_summery").val();
  var f_n_o_filter = $("#f_n_o_filter").val() || "";

  // validation
  if (!client_code) {
    $("#client_code_err").html("Please enter client code");
    return false;
  } else {
    $("#client_code_err").html("");
  }
  if (!from_date1) {
    $("#from_date_err").html("Please select from date");
    return false;
  } else {
    $("#from_date_err").html("");
  }
  if (!to_date1) {
    $("#to_date_err").html("Please select to date");
    return false;
  } else {
    $("#to_date_err").html("");
  }
  var formData = {
    from_date: from_date1.replaceAll("-",""),
    to_date: to_date1.replaceAll("-",""),
    report_name: report_name,
    client_code: client_code,
    scrip_settl_summery: scrip_settl_summery,
    investor_rep_filter: investor_rep_filter,
    f_n_o_filter: f_n_o_filter,
  };
  // console.log(formData,"FORMDAATA");

  $.ajax({
    type: "POST",
    url: "/get-investor-report",
    data: JSON.stringify(formData),
    contentType: "application/json",
    Accept: "application/text",
    dataType: "text",
    beforeSend: function () {
      $("#loader").removeClass("hidden");
    },
    success: function (data) {
      console.log("Success");
      console.log(data);
      $("#investor_report_reponse").html(data);
    },
    error: function (err) {
      console.log("Error  ");
      console.log(err);
    },
    complete: function () {
      $("#loader").addClass("hidden");
    },
  });
}


function getDividendReport() {
  var from_date1 = "2023-01-01";
  var to_date1 = "2023-05-01";
  var client_code1 = $("#client_code").val();
  var client_code = client_code1.substring(0, client_code1.indexOf("-"));
  var report_name = $("#report_name").val();

  // validation
  if (Date.parse(from_date1) > Date.parse(to_date1)) {
    $("#to_date_err").html("To date must be greater than from date");
    return false;
  }
  if (!client_code) {
    $("#client_code_err").html("Please enter client code");
    return false;
  } else {
    $("#client_code_err").html("");
  }
  if (!from_date1) {
    $("#from_date_err").html("Please select from date");
    return false;
  } else {
    $("#from_date_err").html("");
  }
  if (!to_date1) {
    $("#to_date_err").html("Please select to date");
    return false;
  } else {
    $("#to_date_err").html("");
  }

  // if (from_date1) {
  //   let from_daten = formatDate(from_date1);
  //   var datearray1 = from_daten.split("/");
  //   var newfrom_date =
  //     datearray1[1] + "/" + datearray1[0] + "/" + datearray1[2];
  // } else {
  //   from_date1 = "";
  // }

  // if (to_date1) {
  //   let to_daten = formatDate(to_date1);
  //   var datearray1 = to_daten.split("/");
  //   var newto_date = datearray1[1] + "/" + datearray1[0] + "/" + datearray1[2];
  // } else {
  //   to_date1 = "";
  // }

  // var from_date = new Date(newfrom_date);
  // var to_date = new Date(newto_date);

  var formData = {
    from_date: from_date1.replaceAll("-",""),
    to_date:to_date1.replaceAll("-",""),
    report_name: report_name,
    client_code: client_code,
  };
  console.log(formData);
  $.ajax({
    type: "POST",
    url: "/get-dividend-report",
    data: JSON.stringify(formData),
    contentType: "application/json",
    Accept: "application/text",
    dataType: "text",
    beforeSend: function () {
      $("#loader").removeClass("hidden");
    },
    success: function (data) {
      console.log("Success");
      console.log(data);
      $("#dividend_reponse").html(data);
    },
    error: function (err) {
      console.log("Error  ");
      console.log(err);
    },
    complete: function () {
      $("#loader").addClass("hidden");
    },
  });
}

function getDelStatementReport() {
  var client_code1 = $("#client_code").val();
  var client_code = client_code1.substring(0, client_code1.indexOf("-"));
  var trade_date = $("#trade_date").val() || "";
  var settlement = $("#settlement").val();
  var report_name = $("#report_name").val();

  // validation

  if (!client_code) {
    $("#client_code_err").html("Please enter client code");
    return false;
  } else {
    $("#client_code_err").html("");
  }
  if (!trade_date) {
    $("#trade_date_err").html("Please select trade date");
    return false;
  } else {
    $("#trade_date_err").html("");
  }
  // if(!settlement){
  // 	$("#settlement_err").html('Please enter settlement')
  // 	return false
  // }else{
  // 	$("#settlement_err").html('')
  // }

  // if (trade_date) {
  //   let trade_daten = formatDate(trade_date);
  //   var datearray1 = trade_daten.split("/");
  //   var newtrade_date =
  //     datearray1[1] + "/" + datearray1[0] + "/" + datearray1[2];
  // } else {
  //   trade_date = "";
  // }

  // var trade_date = new Date(newtrade_date);

  var formData = {
    trade_date: trade_date.replaceAll("-",""),
    report_name: report_name,
    settlement: settlement || "",
    client_code: client_code,
  };
  // console.log(formData);

  $.ajax({
    type: "POST",
    url: "/get-delStatement-report",
    data: JSON.stringify(formData),
    contentType: "application/json",
    Accept: "application/text",
    dataType: "text",
    beforeSend: function () {
      $("#loader").removeClass("hidden");
    },
    success: function (data) {
      console.log("Success");
      console.log(data);
      $("#delStatement_response").html(data);
    },
    error: function (err) {
      console.log("Error  ");
      console.log(err);
    },
    complete: function () {
      $("#loader").addClass("hidden");
    },
  });
}

  // END REPORTS