0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.142.135.24


Current Path : /var/www/oasis/js_old/
Upload File :
Current File : /var/www/oasis/js_old/transaction-series.js

function enableTransactionSeries() {
  $geditinternalcode = 0;
  window.enable_proper_module = "enableTransactionSeries";
  document.getElementById("module_name_for_save").value =
    "saveTransactionSeries";
  document.getElementById("display_module_name").innerHTML =
    "Transaction Series Setup";
  $("#page_main_div").load("../html_modules/Setup_auto_increment.html");
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "getTransactionSeriesModule.demo",
    success: populateTransactionSeriesModule
  });
}
function populateTransactionSeriesModule($responce) {
  $responce = eval("(" + $responce + ")");
  $g_link_details_array = "";
  $g_link_details_array = $responce.data["links_data"];
  if ($responce.error_code == "0") {
    document.getElementById(
      "transaction_series_module_name"
    ).options.length = 0;
    $op = new Option("Select One", "0");
    $op.id = "0";
    document.getElementById("transaction_series_module_name").options.add($op);
    for ($i = 0; $i < $responce.data[0].length; $i++) {
      $op = new Option(
        $responce.data[0][$i]["type"],
        $responce.data[0][$i]["internal_code"]
      );
      $op.id = $responce.data[0][$i]["internal_code"]; //specifying the id  for options
      document
        .getElementById("transaction_series_module_name")
        .options.add($op);
    }
  }
  $("#header_td_id").html($g_link_details_array["header_link"]);
  $("#footer_td_id").html($g_link_details_array["footer_link"]);
  $("#page_header").show();
  $("#page_footer").show();
}
function getTransactionSeriesModuleElements() {
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "getTransactionSeriesModuleElements.demo",
    data:
      "module_id=" +
      document.getElementById("transaction_series_module_name").value,
    success: populateTransactionSeriesModuleElements
  });
}
function populateTransactionSeriesModuleElements($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    document.getElementById("transaction_series_ele_name").options.length = 0;
    $op = new Option("Select One", "0");
    $op.id = "0";
    document.getElementById("transaction_series_ele_name").options.add($op);
    for ($i = 0; $i < $responce.data.length; $i++) {
      $op = new Option(
        $responce.data[$i]["type"],
        $responce.data[$i]["internal_code"]
      );
      $op.id = $responce.data[$i]["internal_code"]; //specifying the id  for options
      document.getElementById("transaction_series_ele_name").options.add($op);
    }
  } else {
    document.getElementById("transaction_series_ele_name").options.length = 0;
    $op = new Option("Select One", "0");
    $op.id = "0";
    document.getElementById("transaction_series_ele_name").options.add($op);
  }
}
function saveTransactionSeries() {
  if (
    trim(document.getElementById("transaction_series_module_name").value) == "0"
  ) {
    alert("Please Select Module Name");
    document.getElementById("transaction_series_module_name").focus();
    return;
  } else if (
    trim(document.getElementById("transaction_series_ele_name").value) == "0"
  ) {
    alert("Please Select Element Name");
    document.getElementById("transaction_series_ele_name").focus();
    return;
  } else if (
    trim(document.getElementById("transaction_series_start_date").value) == ""
  ) {
    alert("Please Enter Valid Start Date");
    document.getElementById("transaction_series_start_date").focus();
    return;
  } else if (
    !isDate(
      document.getElementById("transaction_series_start_date").value,
      "d/M/y"
    )
  ) {
    alert("Please Enter Valid Start date as dd//mm/yy");
    document.getElementById("transaction_series_start_date").focus();
    return;
  } else if (
    trim(document.getElementById("transaction_series_end_date").value) == ""
  ) {
    alert("Please Enter Valid End Date");
    document.getElementById("transaction_series_end_date").focus();
    return;
  } else if (
    !isDate(
      document.getElementById("transaction_series_end_date").value,
      "d/M/y"
    )
  ) {
    alert("Please Enter Valid End date as dd//mm/yy");
    document.getElementById("transaction_series_end_date").focus();
    return;
  }
  $lstr_data = "internal_code=" + $geditinternalcode;
  $lstr_data +=
    "&ref_module_code=" +
    document.getElementById("transaction_series_module_name").value;
  $lstr_data +=
    "&ref_module_element_code=" +
    document.getElementById("transaction_series_ele_name").value;
  $lstr_data +=
    "&series_name=" +
    encodeURIComponent(
      document.getElementById("transaction_series_field_name").value
    );
  $lstr_data +=
    "&prefix=" +
    encodeURIComponent(
      document.getElementById("transaction_series_prefix_name").value
    );
  $lstr_data +=
    "&starting_no=" +
    encodeURIComponent(
      document.getElementById("transaction_series_start_no").value
    );
  $lstr_data +=
    "&ending_no=" +
    encodeURIComponent(
      document.getElementById("transaction_series_end_no").value
    );
  $lstr_data +=
    "&last_no=" +
    encodeURIComponent(
      document.getElementById("transaction_series_last_no").value
    );
  $lstr_data +=
    "&starting_date=" +
    encodeURIComponent(
      date_format(
        document.getElementById("transaction_series_start_date").value
      )
    );
  $lstr_data +=
    "&ending_date=" +
    encodeURIComponent(
      date_format(document.getElementById("transaction_series_end_date").value)
    );
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "saveTransactionSeries.demo",
    data: $lstr_data,
    success: populatesaveTransactionSeries
  });
}
function populatesaveTransactionSeries($responce) {
  $responce = eval("(" + $responce + ")");
  alert($responce.data);
  $geditinternalcode = 0;
}
function getTransactionSeries($id) {
  enableTransactionSeries();
  $.ajax({
    type: "POST",
    url: $host_url + "getTransactionSeries.demo",
    data: "internal_code=" + $id,
    success: populateTransactionSeries
  });
}
function populateTransactionSeries($responce) {
  $responce = eval("(" + $responce + ")");
  $geditinternalcode = $responce.data.internal_code;
  document.getElementById("transaction_series_module_name").value =
    $responce.data.ref_module_code;
  document.getElementById("transaction_series_ele_name").value =
    $responce.data.ref_module_element_code;
  document.getElementById("transaction_series_field_name").value =
    $responce.data.series_name;
  document.getElementById("transaction_series_prefix_name").value =
    $responce.data.prefix;
  document.getElementById("transaction_series_start_no").value =
    $responce.data.starting_no;
  document.getElementById("transaction_series_end_no").value =
    $responce.data.ending_no;
  document.getElementById("transaction_series_last_no").value =
    $responce.data.last_no;
  document.getElementById("transaction_series_start_date").value =
    $responce.data.starting_date;
  document.getElementById("transaction_series_end_date").value =
    $responce.data.ending_date;
}