Şuanki Dizin: /home/wwwdreamtechnolo/www/vahtuksanghatana.com/vahtuk_society/lib/ |
Şuanki Dosya : /home/wwwdreamtechnolo/www/vahtuksanghatana.com/vahtuk_society/lib/functions.php |
<?php session_start(); date_default_timezone_set("Asia/Kolkata"); class login_function { private $con; function __construct() { // $this->con = new mysqli("localhost","root","","mahasang_society"); $this->con = new mysqli("localhost","wwwdreamtechnolo_ahasang_society_admin","ss!~mk-e6c.r","wwwdreamtechnolo_mahasang_society_main"); mysqli_set_charset($this->con, 'utf8'); } function get_password_from_user_name($mobile_no) { if($stmt_select = $this->con->prepare("Select `password` from `admin` where `admin_name` = ? ")) { $stmt_select->bind_param("s",$mobile_no); $stmt_select->bind_result($result_password); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_password; } } return false; } } function insert_item_master($item_name) { $date = date("Y-m-d"); $time = date("h:i:s A"); if($stmt = $this->con->prepare("INSERT INTO `item_master`(`item_name`,`date`,`time`) VALUES (?,?,?)")) { $stmt->bind_param("sss",$item_name,$date,$time); if($stmt->execute()) { return true; } } return false; } function delete_item_master($del_id) { if($stmt_select = $this->con->prepare("DELETE FROM `item_master` WHERE `id`=?")) { $stmt_select->bind_param("i",$del_id); if($stmt_select->execute()) { return true; } return false; } } function get_item_master_data_for_search($title,$date_from,$date_to) { if($stmt_insert = $this->con->prepare("SELECT `id`, `item_name`, `date`, `time` FROM `item_master` Where `item_name` LIKE '%$title%' AND `date` BETWEEN '$date_from' AND '$date_to'")) { $stmt_insert->bind_result($id,$item_name,$date,$time); if($stmt_insert->execute()) { $counter = 0; $details = array(); while($stmt_insert->fetch()) { $details[$counter][0] = $id; $details[$counter][1] = $item_name; $details[$counter][2] = $date; $details[$counter][3] = $time; $counter++; } if(!empty($details)) { return $details; } return false; } } } function add_expenses_for_staff($expenses,$amount,$added_by,$description,$title) { $date = date("Y-m-d"); $time = date("H-i-s A"); if($stmt_insert = $this->con->prepare("INSERT INTO `expenses_mgt`(`expenses`, `amount`, `date`, `time`, `added_by`, `description`, `title`) VALUES (?,?,?,?,?,?,?)")) { $stmt_insert->bind_param("sssssss",$expenses,$amount,$date,$time,$added_by,$description,$title); if($stmt_insert->execute()) { return true; } return false; } } function delete_expenses_staff($del_id) { if($stmt_select = $this->con->prepare("Delete from `expenses_mgt` where `id`=?")) { $stmt_select->bind_param("i",$del_id); if($stmt_select->execute()) { return true; } return false; } } function get_item_master_name_category() { if($stmt_insert = $this->con->prepare("SELECT `id`, `item_name` FROM `item_master` ")) { $stmt_insert->bind_result($id,$name); if($stmt_insert->execute()) { $counter = 0; $details = array(); while($stmt_insert->fetch()) { $details[$counter][0] = $id; $details[$counter][1] = $name; $counter++; } if(!empty($details)) { return $details; } return false; } } } function get_all_expenses_for_admin($efrom_date,$eto_date) { // Initialize details as an empty array to ensure a consistent return type $details = array(); // Prepare the SQL statement if ($stmt_insert = $this->con->prepare("SELECT `id`, `expenses`, `amount`, `date`, `description`, `title` FROM `expenses_mgt` where (`date` between ? AND ?)")) { // Bind result variables $stmt_insert->bind_param("ss",$efrom_date,$eto_date); $stmt_insert->bind_result($id, $expenses, $amount, $date, $description, $title); // Execute the statement if ($stmt_insert->execute()) { // Fetch the results into the details array $counter = 0; while ($stmt_insert->fetch()) { $details[$counter][0] = $id; $details[$counter][1] = $expenses; $details[$counter][2] = $amount; $details[$counter][3] = $date; $details[$counter][4] = $description; $details[$counter][5] = $title; $counter++; } } else { // Handle execution failure error_log("Error executing the statement: " . $stmt_insert->error); } // Close the statement $stmt_insert->close(); } else { // Handle preparation failure error_log("Error preparing the statement: " . $this->con->error); } // Return the details array, even if empty return $details; } function fetch_item_name($id) { if($stmt_select = $this->con->prepare("Select `item_name` from `item_master` where `id` = ? ")) { $stmt_select->bind_param("i",$id); $stmt_select->bind_result($result_service); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_service; } } return false; } } function expenses_update_data($update_id,$expenses,$amount,$description,$title) { $date = date("Y-m-d"); $time = date("H:i:s A"); if($stmt_select = $this->con->prepare("update `expenses_mgt` set `expenses`= ?,`amount`= ?,`description`= ?,`title`= ? where `id` = ?")) { $stmt_select->bind_param("ssssi",$expenses,$amount,$description,$title,$update_id); if($stmt_select->execute()) { return true; } return false; } } function fetch_exepense_data_for_staff($id) { if($stmt_insert = $this->con->prepare("SELECT `id`, `expenses`, `amount`, `date`,`description`,`title` FROM `expenses_mgt` WHERE `id` = ?")) { $stmt_insert->bind_param("i",$id); $stmt_insert->bind_result($id,$expenses,$amount,$date,$description,$title); if($stmt_insert->execute()) { $counter = 0; $details = array(); while($stmt_insert->fetch()) { $details[$counter][0] = $id; $details[$counter][1] = $expenses; $details[$counter][2] = $amount; $details[$counter][3] = $date; $details[$counter][4] = $description; $details[$counter][5] = $title; $counter++; } if(!empty($details)) { return $details; } return false; } } } function add_software_users($var_name, $var_address, $var_mobile_no, $var_user_type, $var_password,$sw_user) { $current_date = date("Y-m-d"); $current_time = date("h:i:s A"); if ($stmt = $this->con->prepare("INSERT INTO `software_users`(`name`, `address`, `mobile_no`, `user_type`, `password`, `date`, `time`,`sw_user`) VALUES (?,?,?,?,?,?,?,?)")) { $stmt->bind_param("ssssssss", $var_name, $var_address, $var_mobile_no, $var_user_type, $var_password, $current_date, $current_time ,$sw_user); if ($stmt->execute()) { return true; } } return false; } function delete_software_users($delete_id) { if ($stmt = $this->con->prepare("DELETE FROM `software_users` WHERE `id`=?")) { $stmt->bind_param("i", $delete_id); if ($stmt->execute()) { return true; } return false; } } function get_all_software_users_info($date_from,$date_to,$title) { $title_stmt = ""; if($title!="") { $title_stmt = " AND `name` LIKE '%".$title."%'"; } if ($stmt = $this->con->prepare("SELECT `id`, `name`, `address`, `mobile_no`, `user_type`, `password`, `date`, `time` FROM `software_users` where (`date` BETWEEN ? AND ?)".$title_stmt)) { $stmt->bind_param("ss",$date_from,$date_to); $stmt->bind_result($res_id, $res_name, $res_address, $res_mobile_no, $res_user_type, $res_password, $res_date, $res_time); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $res_name; $data[$counter][2] = $res_address; $data[$counter][3] = $res_mobile_no; $data[$counter][4] = $res_user_type; $data[$counter][5] = $res_password; $data[$counter][6] = $res_date; $data[$counter][7] = $res_time; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function get_software_users_form_id($var_edit_id) { if ($stmt = $this->con->prepare("SELECT `id`, `name`, `address`, `mobile_no`, `user_type`, `password`, `date`, `time` FROM `software_users` WHERE `id`=?")) { $stmt->bind_param("i", $var_edit_id); $stmt->bind_result($res_id, $res_name, $res_address, $res_mobile_no, $res_user_type, $res_password, $res_date, $res_time); if ($stmt->execute()) { $data = array(); $counter = 0; if ($stmt->fetch()) { $data[0] = $res_id; $data[1] = $res_name; $data[2] = $res_address; $data[3] = $res_mobile_no; $data[4] = $res_user_type; $data[5] = $res_password; $data[6] = $res_date; $data[7] = $res_time; return $data; } return false; } } } function update_software_users_details($var_name, $var_address, $var_mobile_no, $var_user_type, $var_password,$var_edit_id) { $current_date = date("Y-m-d"); $current_time = date("h:i:s A"); if ($stmt = $this->con->prepare("UPDATE `software_users` SET `name`=?,`address`=?,`mobile_no`=?,`user_type`=?,`password`=?,`date`=?,`time`=? WHERE `id`=?")) { $stmt->bind_param("sssssssi", $var_name, $var_address, $var_mobile_no, $var_user_type, $var_password, $current_date, $current_time, $var_edit_id); if ($stmt->execute()) { return true; } return false; } } function get_admin_password($current_login_admin) { if($stmt_select = $this->con->prepare("SELECT `password` FROM `admin` WHERE `admin_name` = ?")) { $stmt_select->bind_param("s",$current_login_admin); $stmt_select->bind_result($password); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $password; } } return false; } } function update_password_admin($new_pass,$current_login_admin) { if($stmt_insert = $this->con->prepare("UPDATE `admin` SET `password` = ? WHERE `admin_name`=?")) { $stmt_insert->bind_param("ss",$new_pass,$current_login_admin); if($stmt_insert->execute()) { return true; } return false; } } function get_all_data_for_item_master($id) { if($stmt_insert = $this->con->prepare("SELECT `id`, `item_name`, `date`, `time` FROM `item_master` where `id`=?")) { $stmt_insert->bind_param('i',$id); $stmt_insert->bind_result($id,$item_name,$date,$time); if($stmt_insert->execute()) { $counter = 0; $details = array(); while($stmt_insert->fetch()) { $details[$counter][0] = $id; $details[$counter][1] = $item_name; $details[$counter][2] = $date; $details[$counter][3] = $time; $counter++; } if(!empty($details)) { return $details; } return false; } } } function update_item_master($item_name,$up_id) { $date = date("Y-m-d"); $time = date("H-i-s A"); if($stmt_insert = $this->con->prepare("UPDATE `item_master` SET `item_name`=?,`date`=?,`time`=? WHERE `id` = ?")) { $stmt_insert->bind_param("sssi",$item_name,$date,$time,$up_id); if($stmt_insert->execute()) { return true; } return false; } } function get_var_select_member_from_id($select_member) { if($stmt_insert = $this->con->prepare("SELECT fullname FROM registration WHERE id=?")) { $stmt_insert->bind_param("i",$select_member); $stmt_insert->bind_result($res_fullname); if($stmt_insert->execute()) { if($stmt_insert->fetch()) { return $res_fullname; } return false; } } } function add_sabhasad($var_name,$var_address,$dob,$business,$var_mobile_no,$var_adhaar_no,$var_sanchalak_name,$var_varsadar,$var_nate,$niyam_ati,$password,$image,$account_opening_date) { $current_date = date("Y-m-d"); $current_time = date("h:i:s A"); if ($stmt = $this->con->prepare("INSERT INTO `sabhasad_entry`(`name`, `address`, `dob`, `business`, `mobile_no`, `adhaar_no`, `sanchalak_name`, `varsadar`, `nate`,`niyam_ati`,`password`, `date`, `time`,`image`,`account_opening_date`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")) { $stmt->bind_param("sssssssssssssss", $var_name,$var_address,$dob,$business,$var_mobile_no,$var_adhaar_no,$var_sanchalak_name,$var_varsadar,$var_nate,$niyam_ati,$password, $current_date, $current_time,$image,$account_opening_date); if ($stmt->execute()) { return $stmt->insert_id; } } return false; } function get_all_sabhasad($date_from,$date_to,$search_name) { // $title_stmt = ""; // if($title!="") // { // $title_stmt = " AND `name` LIKE '%".$title."%'"; // } if ($stmt = $this->con->prepare("SELECT `id`, `name`, `address`, `dob`, `business`, `mobile_no`, `adhaar_no`, `sanchalak_name`, `varsadar`, `nate`, `date`, `time` FROM `sabhasad_entry` where `name` LIKE '%".$search_name."%'")) { // $stmt->bind_param("ss",$date_from,$date_to); $stmt->bind_result($res_id, $res_name, $res_address, $dob, $res_businesss, $res_mobile_no, $res_adhaar_no, $res_sanchalak_name, $varsadar,$nate, $res_date, $res_time); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $res_name; $data[$counter][2] = $res_address; $data[$counter][3] = $dob; $data[$counter][4] = $res_businesss; $data[$counter][5] = $res_mobile_no; $data[$counter][6] = $res_adhaar_no; $data[$counter][7] = $res_sanchalak_name; $data[$counter][8] = $varsadar; $data[$counter][9] = $nate; $data[$counter][10] = $res_date; $data[$counter][11] = $res_time; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function get_all_sabhasad1() { if ($stmt = $this->con->prepare("SELECT `id`, `name`, `address`, `dob`, `business`, `mobile_no`, `adhaar_no`, `sanchalak_name`, `varsadar`, `nate`, `date`, `time` FROM `sabhasad_entry`")) { $stmt->bind_result($res_id, $res_name, $res_address, $dob, $res_businesss, $res_mobile_no, $res_adhaar_no, $res_sanchalak_name, $varsadar,$nate, $res_date, $res_time); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $res_name; $data[$counter][2] = $res_address; $data[$counter][3] = $dob; $data[$counter][4] = $res_businesss; $data[$counter][5] = $res_mobile_no; $data[$counter][6] = $res_adhaar_no; $data[$counter][7] = $res_sanchalak_name; $data[$counter][8] = $varsadar; $data[$counter][9] = $nate; $data[$counter][10] = $res_date; $data[$counter][11] = $res_time; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function get_all_sabhasad_for_print($pavati_id) { if ($stmt = $this->con->prepare("SELECT `id`, `name`, `address`, `dob`, `business`, `mobile_no`, `adhaar_no`, `sanchalak_name`, `varsadar`, `nate`, `date`, `time`,`image` FROM `sabhasad_entry` where `id`=?")) { $stmt->bind_param("s",$pavati_id); $stmt->bind_result($res_id, $res_name, $res_address, $dob, $res_businesss, $res_mobile_no, $res_adhaar_no, $res_sanchalak_name, $varsadar,$nate, $res_date ,$res_time,$image); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $res_name; $data[$counter][2] = $res_address; $data[$counter][3] = $dob; $data[$counter][4] = $res_businesss; $data[$counter][5] = $res_mobile_no; $data[$counter][6] = $res_adhaar_no; $data[$counter][7] = $res_sanchalak_name; $data[$counter][8] = $varsadar; $data[$counter][9] = $nate; $data[$counter][10] = $res_date; $data[$counter][11] = $res_time; $data[$counter][12] = $image; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function delete_sabhasad($delete_id) { if ($stmt = $this->con->prepare("DELETE FROM `sabhasad_entry` WHERE `id`=?")) { $stmt->bind_param("i", $delete_id); if ($stmt->execute()) { return true; } return false; } } function get_name_by_id($pavati_id) { if($stmt_select = $this->con->prepare("Select `name` from `sabhasad_entry` where `id` = ? ")) { $stmt_select->bind_param("s",$pavati_id); $stmt_select->bind_result($result_name); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_name; } } return false; } } function get_registered_date_by_sabhasad_id($customer_id) { if($stmt_select = $this->con->prepare("Select `account_opening_date` from `sabhasad_entry` where `id` = ? ")) { $stmt_select->bind_param("s",$customer_id); $stmt_select->bind_result($result_name); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_name; } } return false; } } function get_mobile_by_id($pavati_id) { if($stmt_select = $this->con->prepare("Select `mobile_no` from `sabhasad_entry` where `id` = ? ")) { $stmt_select->bind_param("s",$pavati_id); $stmt_select->bind_result($result_name); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_name; } } return false; } } function get_adhaar_by_id($pavati_id) { if($stmt_select = $this->con->prepare("Select `adhaar_no` from `sabhasad_entry` where `id` = ? ")) { $stmt_select->bind_param("s",$pavati_id); $stmt_select->bind_result($result_name); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_name; } } return false; } } function add_payment($sabhasad_id,$payment_date,$acc_no,$parvesh_fee,$service_charge,$shares,$karj_hapta,$farm_fee,$vilamb_akar,$other,$other_desc,$dilele_karj) { $current_date = date("Y-m-d"); $current_time = date("h:i:s A"); if ($stmt = $this->con->prepare("INSERT INTO `add_payment`(`sabhasad_id`, `payment_date`,`acc_no`, `parvesh_fee`, `service_charge`, `shares`, `karj_hapta`, `farm_fee`, `vilamb_akar`, `date`, `time`,`other`,`other_desc`,`loan_id`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)")) { $stmt->bind_param("ssssssssssssss", $sabhasad_id,$payment_date,$acc_no,$parvesh_fee,$service_charge,$shares,$karj_hapta,$farm_fee,$vilamb_akar, $current_date, $current_time,$other,$other_desc,$dilele_karj); if ($stmt->execute()) { return $stmt->insert_id; } } return false; } function get_payment_id_wise($pavati_id) { if ($stmt = $this->con->prepare("SELECT `id`, `sabhasad_id`, `payment_date`,`acc_no`, `parvesh_fee`, `service_charge`, `shares`, `karj_hapta`, `farm_fee`, `vilamb_akar`, `date`, `time`,`loan_id` FROM `add_payment` WHERE `sabhasad_id`=?")) { $stmt->bind_param("s",$pavati_id); $stmt->bind_result($res_id, $sabhasad_id, $payment_date,$acc_no, $parvesh_fee, $service_charge, $shares, $karj_hapta, $farm_fee, $vilamb_akar,$res_date, $res_time,$loan_id); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $sabhasad_id; $data[$counter][2] = $payment_date; $data[$counter][3] = $acc_no; $data[$counter][4] = $parvesh_fee; $data[$counter][5] = $service_charge; $data[$counter][6] = $shares; $data[$counter][7] = $karj_hapta; $data[$counter][8] = $farm_fee; $data[$counter][9] = $vilamb_akar; $data[$counter][10] = $res_date; $data[$counter][11] = $res_time; $data[$counter][12] = $loan_id; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function get_payment_id_wise_for_report($pavati_id) { if ($stmt = $this->con->prepare("SELECT `id`, `sabhasad_id`, `payment_date`,`acc_no`, `parvesh_fee`, `service_charge`, `shares`, `karj_hapta`, `farm_fee`, `vilamb_akar`, `date`, `time`,`loan_id` FROM `add_payment` WHERE `sabhasad_id`=?")) { $stmt->bind_param("s",$pavati_id); $stmt->bind_result($res_id, $sabhasad_id, $payment_date,$acc_no, $parvesh_fee, $service_charge, $shares, $karj_hapta, $farm_fee, $vilamb_akar,$res_date, $res_time,$loan_id); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $sabhasad_id; $data[$counter][2] = $payment_date; $data[$counter][3] = $acc_no; $data[$counter][4] = $parvesh_fee; $data[$counter][5] = $service_charge; $data[$counter][6] = $shares; $data[$counter][7] = $karj_hapta; $data[$counter][8] = $farm_fee; $data[$counter][9] = $vilamb_akar; $data[$counter][10] = $res_date; $data[$counter][11] = $res_time; $data[$counter][12] = $loan_id; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function get_payment_id_wise_for_user($pavati_id) { if ($stmt = $this->con->prepare("SELECT `id`, `sabhasad_id`, `payment_date`,`acc_no`, `parvesh_fee`, `service_charge`, `shares`, `karj_hapta`, `farm_fee`, `vilamb_akar`, `date`, `time`,`loan_id` FROM `add_payment` WHERE `sabhasad_id`=?")) { $stmt->bind_param("s",$pavati_id); $stmt->bind_result($res_id, $sabhasad_id, $payment_date,$acc_no, $parvesh_fee, $service_charge, $shares, $karj_hapta, $farm_fee, $vilamb_akar,$res_date, $res_time,$loan_id); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $sabhasad_id; $data[$counter][2] = $payment_date; $data[$counter][3] = $acc_no; $data[$counter][4] = $parvesh_fee; $data[$counter][5] = $service_charge; $data[$counter][6] = $shares; $data[$counter][7] = $karj_hapta; $data[$counter][8] = $farm_fee; $data[$counter][9] = $vilamb_akar; $data[$counter][10] = $res_date; $data[$counter][11] = $res_time; $data[$counter][12] = $loan_id; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function delete_payment($delete_id) { if ($stmt = $this->con->prepare("DELETE FROM `add_payment` WHERE `id`=?")) { $stmt->bind_param("i", $delete_id); if ($stmt->execute()) { return true; } return false; } } function add_loan($title,$sabhasad_id, $loan_amount, $jamin_name,$loan_date,$balance_loan) { $jamin_name = implode(",", $jamin_name); $current_date = date("Y-m-d"); $current_time = date("h:i:s A"); if ($stmt = $this->con->prepare("INSERT INTO `add_loan_details`(`title`,`sabhasad_id`, `loan_amount`, `jamin_name`, `date`, `time`,`loan_date`,`balance_loan`) VALUES (?,?,?,?,?,?,?,?)")) { // Ensure that jamin_name is now a string after implode $stmt->bind_param("ssssssss",$title, $sabhasad_id, $loan_amount, $jamin_name, $current_date, $current_time,$loan_date,$balance_loan); if ($stmt->execute()) { return $stmt->insert_id; } } return false; } function get_payment_details_for_pavati($pavati_id,$sabhasad_id) { if ($stmt = $this->con->prepare("SELECT `id`, `sabhasad_id`, `payment_date`,`acc_no`, `parvesh_fee`, `service_charge`, `shares`, `karj_hapta`, `farm_fee`, `vilamb_akar`, `date`, `time`,`other`,`other_desc`,`loan_id` FROM `add_payment` WHERE `id`=? AND `sabhasad_id`=?")) { $stmt->bind_param("ss",$pavati_id,$sabhasad_id); $stmt->bind_result($res_id, $sabhasad_id, $payment_date,$acc_no, $parvesh_fee, $service_charge, $shares, $karj_hapta, $farm_fee, $vilamb_akar,$res_date, $res_time,$other,$other_desc,$loan_id); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $sabhasad_id; $data[$counter][2] = $payment_date; $data[$counter][3] = $acc_no; $data[$counter][4] = $parvesh_fee; $data[$counter][5] = $service_charge; $data[$counter][6] = $shares; $data[$counter][7] = $karj_hapta; $data[$counter][8] = $farm_fee; $data[$counter][9] = $vilamb_akar; $data[$counter][10] = $res_date; $data[$counter][11] = $res_time; $data[$counter][12] = $other; $data[$counter][13] = $other_desc; $data[$counter][14] = $loan_id; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function get_loan_for_print($loan_id) { if ($stmt = $this->con->prepare("SELECT `id`, `sabhasad_id`, `loan_amount`, `jamin_name`, `date`, `time`,`loan_date` FROM `add_loan_details` WHERE `id`=?")) { $stmt->bind_param("s",$loan_id); $stmt->bind_result($res_id, $sabhasad_id, $loan_amount, $jamin_name,$res_date ,$res_time,$loan_date); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $sabhasad_id; $data[$counter][2] = $loan_amount; $data[$counter][3] = $jamin_name; $data[$counter][4] = $res_date; $data[$counter][5] = $res_time; $data[$counter][6] = $loan_date; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function fetch_jamin_names($jamin_ids) { $jamin_ids_array = explode(",", $jamin_ids); $jamin_names = []; foreach ($jamin_ids_array as $id) { $stmt = $this->con->prepare("SELECT `name` FROM `sabhasad_entry` WHERE `id` = ?"); $stmt->bind_param("i", $id); if ($stmt->execute()) { $stmt->bind_result($name); while ($stmt->fetch()) { $jamin_names[] = $name; } } } return implode(", ", $jamin_names); } function get_loan_id_wise($pavati_id) { if ($stmt = $this->con->prepare("SELECT `id`,`title`, `sabhasad_id`, `loan_amount`, `jamin_name`, `date`, `time`,`loan_date` FROM `add_loan_details` WHERE `sabhasad_id`=?")) { $stmt->bind_param("s",$pavati_id); $stmt->bind_result($res_id, $title,$sabhasad_id, $loan_amount, $jamin_name,$res_date ,$res_time,$loan_date); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $title; $data[$counter][2] = $sabhasad_id; $data[$counter][3] = $loan_amount; $data[$counter][4] = $jamin_name; $data[$counter][5] = $res_date; $data[$counter][6] = $res_time; $data[$counter][7] = $loan_date; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function delete_loan($delete_id) { if ($stmt = $this->con->prepare("DELETE FROM `add_loan_details` WHERE `id`=?")) { $stmt->bind_param("i", $delete_id); if ($stmt->execute()) { return true; } return false; } } function get_jamin_all_nameby_id($res_id) { if ($stmt_select = $this->con->prepare("SELECT `jamin_name` FROM `add_loan_details` WHERE `sabhasad_id` = ?")) { $stmt_select->bind_param("s", $res_id); $stmt_select->bind_result($result_name); $jamin_names = array(); if ($stmt_select->execute()) { while ($stmt_select->fetch()) { $jamin_names[] = $result_name; } if (count($jamin_names) > 0) { return $jamin_names; } else { return false; } } } return false; } function get_jamin_all_nameby_id_by_loan_id_and_sabhasad_id($customer_id, $loan_id) { if ($stmt_select = $this->con->prepare("SELECT `jamin_name` FROM `add_loan_details` WHERE `sabhasad_id` = ? AND `id`=?")) { $stmt_select->bind_param("si", $customer_id,$loan_id); $stmt_select->bind_result($result_name); $jamin_names = array(); if ($stmt_select->execute()) { while ($stmt_select->fetch()) { $jamin_names[] = $result_name; } if (count($jamin_names) > 0) { return $jamin_names; } else { return false; } } } return false; } function get_loan_get_detailsof_user($loan_id) { if ($stmt = $this->con->prepare("SELECT `id`,`title`, `sabhasad_id`, `loan_amount`, `jamin_name`, `date`, `time`,`balance_loan` FROM `add_loan_details` WHERE `sabhasad_id`=? AND `balance_loan`>0;")) { $stmt->bind_param("s",$loan_id); $stmt->bind_result($res_id,$title, $sabhasad_id, $loan_amount, $jamin_name,$res_date ,$res_time,$balance_loan); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $title; $data[$counter][2] = $sabhasad_id; $data[$counter][3] = $loan_amount; $data[$counter][4] = $jamin_name; $data[$counter][5] = $res_date; $data[$counter][6] = $res_time; $data[$counter][7] = $balance_loan; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function get_loadn_amount($pavati_id,$loan_id) { if($stmt_select = $this->con->prepare("Select `loan_amount` from `add_loan_details` where `sabhasad_id` = ? AND `id`=?")) { $stmt_select->bind_param("ss",$pavati_id,$loan_id); $stmt_select->bind_result($result_name); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_name; } } return false; } } function get_loadn_amount_for_account_stmt($pavati_id,$loan_id) { if($stmt_select = $this->con->prepare("Select `loan_amount` from `add_loan_details` where `sabhasad_id` = ? AND `id`=?")) { $stmt_select->bind_param("ss",$pavati_id,$loan_id); $stmt_select->bind_result($result_name); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_name; } } return false; } } function get_loan_date_for_account_stmt($sabhasad_id) { if($stmt_select = $this->con->prepare("Select `loan_date` from `add_loan_details` where `sabhasad_id` = ?")) { $stmt_select->bind_param("s",$sabhasad_id); $stmt_select->bind_result($result_name); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_name; } } return false; } } function get_paid_loan_amount($pavati_id,$loan_id) { if($stmt_select = $this->con->prepare("Select `balance_loan` from `add_loan_details` where `sabhasad_id` = ? AND `id`=?")) { $stmt_select->bind_param("ss",$pavati_id,$loan_id); $stmt_select->bind_result($result_name); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_name; } } return false; } } function update_loan($karj_hapta, $sabhasad_id, $dilele_karj) { if (empty($karj_hapta) || empty($sabhasad_id) || empty($dilele_karj)) { return false; // Exit early if any value is invalid } if ($stmt_insert = $this->con->prepare("UPDATE `add_loan_details` SET `balance_loan` = `balance_loan` - $karj_hapta WHERE `sabhasad_id` = ? AND `id` = ?")) { $stmt_insert->bind_param("si", $sabhasad_id, $dilele_karj); if ($stmt_insert->execute()) { return true; } return false; } return false; } // function get_total_shares($sabhasad_id) // { // if($stmt_select = $this->con->prepare("Select `shares` from `add_payment` where `sabhasad_id` = ? ")) // { // $stmt_select->bind_param("s",$sabhasad_id); // $stmt_select->bind_result($result_name); // if($stmt_select->execute()) // { // if($stmt_select->fetch()) // { // return $result_name; // } // } // return false; // } // } function get_total_shares($loan_id) { if($stmt = $this->con->prepare("Select `shares` from `add_payment` where `sabhasad_id` = ? ")) { $stmt->bind_param("s",$loan_id); $stmt->bind_result($shares); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $shares; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function get_password_from_sabhasad_name($mobile_no) { if($stmt_select = $this->con->prepare("Select `password` from `sabhasad_entry` where `mobile_no` = ? ")) { $stmt_select->bind_param("s",$mobile_no); $stmt_select->bind_result($result_password); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_password; } } return false; } } function get_user_data($current_login_admin) { if ($stmt = $this->con->prepare("SELECT `id`, `name`, `address`, `dob`, `business`, `mobile_no`, `adhaar_no`, `sanchalak_name`, `varsadar`, `nate`, `date`, `time`,`image` FROM `sabhasad_entry` where `mobile_no`=?")) { $stmt->bind_param("s",$current_login_admin); $stmt->bind_result($res_id, $res_name, $res_address, $dob, $res_businesss, $res_mobile_no, $res_adhaar_no, $res_sanchalak_name, $varsadar,$nate, $res_date, $res_time,$image); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $res_name; $data[$counter][2] = $res_address; $data[$counter][3] = $dob; $data[$counter][4] = $res_businesss; $data[$counter][5] = $res_mobile_no; $data[$counter][6] = $res_adhaar_no; $data[$counter][7] = $res_sanchalak_name; $data[$counter][8] = $varsadar; $data[$counter][9] = $nate; $data[$counter][10] = $res_date; $data[$counter][11] = $res_time; $data[$counter][12] = $image; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function update_sabhasad_users_details($var_name, $var_address,$var_dob,$business, $var_mobile_no,$var_adhaar_no,$var_sanchalak_name,$var_varsadar,$var_nate, $account_opening_date,$var_edit_id) { $current_date = date("Y-m-d"); $current_time = date("h:i:s A"); if ($stmt = $this->con->prepare("UPDATE `sabhasad_entry` SET `name`=?,`address`=?,`dob`=?, `business`=? ,`mobile_no`=? ,`adhaar_no`=?, `sanchalak_name`=? ,`varsadar`=? ,`nate`=?,`date`=?,`time`=?,`account_opening_date`=? WHERE `id`=?")) { $stmt->bind_param("ssssssssssssi",$var_name, $var_address,$var_dob,$business, $var_mobile_no,$var_adhaar_no,$var_sanchalak_name,$var_varsadar,$var_nate,$current_date,$current_time,$account_opening_date, $var_edit_id); if ($stmt->execute()) { return true; } return false; } } function get_sabhasad_users_form_id($var_edit_id) { if ($stmt = $this->con->prepare("SELECT `id`, `name`, `address`, `dob`, `business`, `mobile_no`, `adhaar_no`, `sanchalak_name` , `varsadar`, `nate` ,`date`, `time`,`account_opening_date` FROM `sabhasad_entry` WHERE `id`=?")) { $stmt->bind_param("i", $var_edit_id); $stmt->bind_result($res_id, $res_name, $res_address,$res_dob,$res_business, $res_mobile_no, $res_adhaar_no,$res_sanchalak_name,$res_varsadar,$res_nate, $res_date, $res_time,$account_opening_date); if ($stmt->execute()) { $data = array(); $counter = 0; if ($stmt->fetch()) { $data[0] = $res_id; $data[1] = $res_name; $data[2] = $res_address; $data[3] = $res_dob; $data[4] = $res_business; $data[5] = $res_mobile_no; $data[6] = $res_adhaar_no; $data[7] = $res_sanchalak_name; $data[8] = $res_varsadar; $data[9] = $res_nate; $data[10] = $res_date; $data[11] = $res_time; $data[12] = $account_opening_date; return $data; } return false; } } } function update_loan_form_details($var_loan_date,$var_title,$var_loan_amount, $var_edit_id) { $current_date = date("Y-m-d"); $current_time = date("h:i:s A"); if ($stmt = $this->con->prepare("UPDATE `add_loan_details` SET `loan_date`=? ,`title`=? ,`loan_amount`=?,`date`=?,`time`=? WHERE `id`=?")) { $stmt->bind_param("sssssi",$var_loan_date,$var_title,$var_loan_amount,$current_date,$current_time, $var_edit_id); if ($stmt->execute()) { return true; } return false; } } function get_loan_form_id ($var_edit_id) { if ($stmt = $this->con->prepare("SELECT `id`, `loan_date`,`title`, `loan_amount`,`date`, `time` FROM `add_loan_details` WHERE `id`=?")) { $stmt->bind_param("i", $var_edit_id); $stmt->bind_result($res_id, $res_loan_date,$res_title,$res_loan_amount, $res_date, $res_time); if ($stmt->execute()) { $data = array(); $counter = 0; if ($stmt->fetch()) { $data[0] = $res_id; $data[1] = $res_loan_date; $data[2] = $res_title; $data[3] = $res_loan_amount; $data[4] = $res_date; $data[5] = $res_time; return $data; } return false; } } } function update_pavti_details($var_payment_date ,$var_parvesh_fee, $var_service_charge, $var_shares, $var_karj_hapta ,$var_farm_fee ,$var_vilamb_akar,$var_other ,$var_other_desc ,$var_loan_id ,$var_edit_id) { $current_date = date("Y-m-d"); $current_time = date("h:i:s A"); if ($stmt = $this->con->prepare("UPDATE `add_payment` SET `payment_date`=?,`parvesh_fee`=?,`service_charge`=?,`shares`=?,`karj_hapta`=?,`farm_fee`=?,`vilamb_akar`=?,`date`=?,`time`=?,`other`=?,`other_desc`=?,`loan_id`=? WHERE `id`=?")) { $stmt->bind_param("ssssssssssssi", $var_payment_date, $var_parvesh_fee, $var_service_charge, $var_shares, $var_karj_hapta, $var_farm_fee, $var_vilamb_akar, $current_date, $current_time, $var_other, $var_other_desc, $var_loan_id, $var_edit_id); if ($stmt->execute()) { return true; } return false; } } function get_pavti_form_id($var_edit_id) { if ($stmt = $this->con->prepare("SELECT `id`, `payment_date`, `parvesh_fee`, `service_charge`, `shares`, `karj_hapta`, `farm_fee`, `vilamb_akar`, `date`, `time`, `other`, `other_desc`, `loan_id` FROM `add_payment` WHERE `id`=?")){ $stmt->bind_param("i", $var_edit_id); $stmt->bind_result($res_id,$res_payment_date ,$res_parvesh_fee, $res_service_charge, $res_shares, $res_karj_hapta ,$res_farm_fee,$res_vilamb_akar,$res_date, $res_time,$res_other,$res_other_desc,$res_loan_id ); if ($stmt->execute()) { $data = array(); $counter = 0; if ($stmt->fetch()) { $data[0] = $res_id; $data[1] = $res_payment_date ; $data[2] = $res_parvesh_fee; $data[3] = $res_service_charge; $data[4] = $res_shares; $data[5] = $res_karj_hapta ; $data[6] = $res_farm_fee; $data[7] = $res_vilamb_akar; $data[8] = $res_other; $data[9] = $res_other_desc; $data[10] = $res_date; $data[11] = $res_time; $data[12] = $res_loan_id; return $data; } return false; } } } // Assuming you are using mysqli and the user table has a 'password' column function update_password($new_pass,$current_login_admin) { if ($stmt = $this->con->prepare("UPDATE sabhasad_entry SET password = ? WHERE mobile_no = ?")) { $stmt->bind_param("ss", $new_pass, $current_login_admin); return $stmt->execute(); } return false; } function get_loan_for_statement($main_category) { if ($stmt = $this->con->prepare("SELECT `id`, `sabhasad_id`, `loan_amount`, `jamin_name`, `date`, `time`,`loan_date` FROM `add_loan_details` WHERE `sabhasad_id`=?")) { $stmt->bind_param("s",$main_category); $stmt->bind_result($res_id, $sabhasad_id, $loan_amount, $jamin_name,$res_date ,$res_time,$loan_date); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $sabhasad_id; $data[$counter][2] = $loan_amount; $data[$counter][3] = $jamin_name; $data[$counter][4] = $res_date; $data[$counter][5] = $res_time; $data[$counter][6] = $loan_date; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function get_total_shares_for_loan_management($sabhasad_id,$res_id) { if($stmt = $this->con->prepare("Select `shares` from `add_payment` where `sabhasad_id` = ? AND `loan_id`=? ")) { $stmt->bind_param("ss",$sabhasad_id,$res_id); $stmt->bind_result($shares); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $shares; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function get_loan_id_wise_for_search($from_date,$to_date,$s_name,$loan_id) { $s_name_stmt = ""; if ($s_name!="" && $s_name != "Select") { $s_name_stmt = "AND `sabhasad_id`= '".$s_name."'"; } $loan_id_stmt = ""; if ($loan_id!="" && $loan_id != "Select") { $loan_id_stmt = "AND `id`= '".$loan_id."'"; } if ($stmt = $this->con->prepare("SELECT `id`, `sabhasad_id`, `loan_amount`, `jamin_name`, `date`, `time`,`loan_date` FROM `add_loan_details` WHERE `jamin_name` LIKE '%%' ".$s_name_stmt.$loan_id_stmt)) { // $stmt->bind_param("ss",$from_date,$to_date); $stmt->bind_result($res_id, $sabhasad_id, $loan_amount, $jamin_name,$res_date ,$res_time,$loan_date); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $sabhasad_id; $data[$counter][2] = $loan_amount; $data[$counter][3] = $jamin_name; $data[$counter][4] = $res_date; $data[$counter][5] = $res_time; $data[$counter][6] = $loan_date; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function get_payment_id_wise_for_search($from_date,$to_date,$s_name,$loan_id) { $s_name_stmt = ""; if ($s_name!="" && $s_name != "Select") { $s_name_stmt = "AND `sabhasad_id`= '".$s_name."'"; } $loan_id_stmt = ""; if ($loan_id!="" && $loan_id != "Select") { $loan_id_stmt = "AND `loan_id`= '".$loan_id."'"; } if ($stmt = $this->con->prepare("SELECT `id`, `sabhasad_id`, `payment_date`,`acc_no`, `parvesh_fee`, `service_charge`, `shares`, `karj_hapta`, `farm_fee`, `vilamb_akar`, `date`, `time`,`loan_id` FROM `add_payment` WHERE (`payment_date` between ? AND ?)".$s_name_stmt.$loan_id_stmt)) { $stmt->bind_param("ss",$from_date,$to_date); $stmt->bind_result($res_id, $sabhasad_id, $payment_date,$acc_no, $parvesh_fee, $service_charge, $shares, $karj_hapta, $farm_fee, $vilamb_akar,$res_date, $res_time,$loan_id); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $sabhasad_id; $data[$counter][2] = $payment_date; $data[$counter][3] = $acc_no; $data[$counter][4] = $parvesh_fee; $data[$counter][5] = $service_charge; $data[$counter][6] = $shares; $data[$counter][7] = $karj_hapta; $data[$counter][8] = $farm_fee; $data[$counter][9] = $vilamb_akar; $data[$counter][10] = $res_date; $data[$counter][11] = $res_time; $data[$counter][12] = $loan_id; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } // function get_payment_id_wise_for_search1($from_date,$to_date,$pavati_id) // { // if ($stmt = $this->con->prepare("SELECT `id`, `sabhasad_id`, `payment_date`,`acc_no`, `parvesh_fee`, `service_charge`, `shares`, `karj_hapta`, `farm_fee`, `vilamb_akar`, `date`, `time`,`loan_id` FROM `add_payment` WHERE (`payment_date` between ? AND ?) AND `sabhasad_id`=? AND `loan_id`='no' ")) // { // $stmt->bind_param("sss",$from_date,$to_date,$pavati_id); // $stmt->bind_result($res_id, $sabhasad_id, $payment_date,$acc_no, $parvesh_fee, $service_charge, $shares, $karj_hapta, $farm_fee, $vilamb_akar,$res_date, $res_time,$loan_id); // if ($stmt->execute()) { // $data = array(); // $counter = 0; // while ($stmt->fetch()) { // $data[$counter][0] = $res_id; // $data[$counter][1] = $sabhasad_id; // $data[$counter][2] = $payment_date; // $data[$counter][3] = $acc_no; // $data[$counter][4] = $parvesh_fee; // $data[$counter][5] = $service_charge; // $data[$counter][6] = $shares; // $data[$counter][7] = $karj_hapta; // $data[$counter][8] = $farm_fee; // $data[$counter][9] = $vilamb_akar; // $data[$counter][10] = $res_date; // $data[$counter][11] = $res_time; // $data[$counter][12] = $loan_id; // $counter++; // } // if (!empty($data)) { // return $data; // } else { // return false; // } // } // } // } function get_paid_amount_history_of_users($customer_id,$loan_id,$month) { //echo $customer_id."====".$loan_id."+++".$month; $statement = ""; if($loan_id=="any") { $statement = ""; } else if($loan_id!="") { $statement = " AND `loan_id`='".$loan_id."'"; } //echo "<br />".$customer_id."====".$loan_id."+++".$month."**".$statement; if ($stmt = $this->con->prepare("SELECT `id`, `sabhasad_id`, `payment_date`, `acc_no`, `parvesh_fee`, `service_charge`, `shares`, `karj_hapta`, `farm_fee`, `vilamb_akar`, `date`, `time`, `loan_id` FROM `add_payment` WHERE `acc_no`='".$customer_id."' AND `payment_date` LIKE '".$month."%'")) { $stmt->bind_result($res_id, $sabhasad_id, $payment_date, $acc_no, $parvesh_fee, $service_charge, $shares, $karj_hapta, $farm_fee, $vilamb_akar, $res_date, $res_time, $loan_id); if ($stmt->execute()) { $data = []; $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $sabhasad_id; $data[$counter][2] = $payment_date; $data[$counter][3] = $acc_no; $data[$counter][4] = $parvesh_fee; $data[$counter][5] = $service_charge; $data[$counter][6] = $shares; $data[$counter][7] = $karj_hapta; $data[$counter][8] = $farm_fee; $data[$counter][9] = $vilamb_akar; $data[$counter][10] = $res_date; $data[$counter][11] = $res_time; $data[$counter][12] = $loan_id; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function get_payment_id_wise_for_search1($months, $customer_id, $loan_id) { if (!is_array($months)) { $months = explode(',', $months); } $months = array_filter($months, function($month) { return !empty($month); }); $month_stmt = ""; if (!empty($months)) { $months_placeholders = []; foreach ($months as $month) { $month = str_pad(trim($month), 2, "0", STR_PAD_LEFT); $months_placeholders[] = "MONTH(payment_date) = '" . $month . "'"; } $month_stmt = " AND (" . implode(" OR ", $months_placeholders) . ")"; } $customer_id_stmt = ""; if ($customer_id != "" && $customer_id != "any") { $customer_id_stmt = " AND `sabhasad_id` = '".$customer_id."'"; } $loan_id_stmt = ""; if ($loan_id != "" && $loan_id != "any") { if ($loan_id == 'no') { $loan_id_stmt = " AND `loan_id` = 'no'"; $loan_id_stmt = " AND `loan_id` = '".$loan_id."'"; } else { } } if ($stmt = $this->con->prepare("SELECT `id`, `sabhasad_id`, `payment_date`, `acc_no`, `parvesh_fee`, `service_charge`, `shares`, `karj_hapta`, `farm_fee`, `vilamb_akar`, `date`, `time`, `loan_id` FROM `add_payment` WHERE 1 " . $month_stmt . $customer_id_stmt . $loan_id_stmt)) { $stmt->bind_result($res_id, $sabhasad_id, $payment_date, $acc_no, $parvesh_fee, $service_charge, $shares, $karj_hapta, $farm_fee, $vilamb_akar, $res_date, $res_time, $loan_id); if ($stmt->execute()) { $data = []; $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $sabhasad_id; $data[$counter][2] = $payment_date; $data[$counter][3] = $acc_no; $data[$counter][4] = $parvesh_fee; $data[$counter][5] = $service_charge; $data[$counter][6] = $shares; $data[$counter][7] = $karj_hapta; $data[$counter][8] = $farm_fee; $data[$counter][9] = $vilamb_akar; $data[$counter][10] = $res_date; $data[$counter][11] = $res_time; $data[$counter][12] = $loan_id; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function get_loan_id_wise_for_search_excel($from_date, $to_date, $s_name, $loan_id) { $s_name_stmt = ""; $loan_id_stmt = ""; if ($s_name != "" && $s_name != "Select") { $s_name_stmt = "AND `sabhasad_id` = '".$s_name."'"; } if ($loan_id != "" && $loan_id != "Select") { if ($loan_id == 'no') { $loan_id_stmt = " AND `loan_id` = 'no'"; $loan_id_stmt = " AND `loan_id` = '".$loan_id."'"; } else { $loan_id_stmt = " AND `loan_id` = '".$loan_id."'"; } } if ($stmt = $this->con->prepare("SELECT `id`, `sabhasad_id`, `payment_date`, `acc_no`, `parvesh_fee`, `service_charge`, `shares`, `karj_hapta`, `farm_fee`, `vilamb_akar`, `date`, `time`, `other`, `other_desc`, `loan_id` FROM `add_payment` WHERE (`payment_date` BETWEEN ? AND ?) " . $s_name_stmt . $loan_id_stmt . " ORDER BY `acc_no` ASC")) { $stmt->bind_param("ss", $from_date, $to_date); $stmt->bind_result($res_id, $sabhasad_id, $payment_date, $acc_no, $parvesh_fee, $service_charge, $shares, $karj_hapta, $farm_fee, $vilamb_akar, $res_date, $res_time, $other, $other_desc, $loan_id); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $sabhasad_id; $data[$counter][2] = $payment_date; $data[$counter][3] = $acc_no; $data[$counter][4] = $parvesh_fee; $data[$counter][5] = $service_charge; $data[$counter][6] = $shares; $data[$counter][7] = $karj_hapta; $data[$counter][8] = $farm_fee; $data[$counter][9] = $vilamb_akar; $data[$counter][10] = $res_date; $data[$counter][11] = $res_time; $data[$counter][12] = $other; $data[$counter][13] = $other_desc; $data[$counter][14] = $loan_id; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } // function get_payment_id_wise_for_user_stmt($account_nu, $loan_id) // { // // Prepare the loan_id part of the query // $loan_id_stmt = ""; // if ($loan_id != "" && $loan_id != "any") { // if ($loan_id == 'no') { // $loan_id_stmt = " AND `loan_id` = 'no'"; // $loan_id_stmt = " AND `loan_id` = '" . $loan_id . "'"; // } else { // // $loan_id_stmt = " AND `loan_id` = '" . $loan_id . "'"; // } // } // // Prepare and execute the SQL statement // $sql = "SELECT `id`, `sabhasad_id`, `payment_date`, `acc_no`, `parvesh_fee`, `service_charge`, `shares`, // `karj_hapta`, `farm_fee`, `vilamb_akar`, `date`, `time`, `loan_id` // FROM `add_payment` // WHERE `sabhasad_id` = ? " . $loan_id_stmt; // if ($stmt = $this->con->prepare($sql)) { // $stmt->bind_param("s", $account_nu); // Bind the account number to the query // $stmt->bind_result($res_id, $sabhasad_id, $payment_date, $acc_no, $parvesh_fee, $service_charge, // $shares, $karj_hapta, $farm_fee, $vilamb_akar, $res_date, $res_time, $loan_id); // // Execute the statement // if ($stmt->execute()) { // $data = []; // $counter = 0; // // Fetch the results // while ($stmt->fetch()) { // $data[$counter] = [ // $res_id, $sabhasad_id, $payment_date, $acc_no, $parvesh_fee, $service_charge, // $shares, $karj_hapta, $farm_fee, $vilamb_akar, $res_date, $res_time, $loan_id // ]; // $counter++; // } // // Return the data if available, else return false // return !empty($data) ? $data : false; // } // } // return false; // In case the query execution fails // } function get_payment_id_wise_for_user_stmt($account_nu,$loan_id) { $loan_id_stmt = ""; if ($loan_id != "" && $loan_id != "any") { if ($loan_id == 'no') { $loan_id_stmt = " AND loan_id = 'no'"; $loan_id_stmt = " AND loan_id = '".$loan_id."'"; } else { } } if ($stmt = $this->con->prepare("SELECT id, sabhasad_id, payment_date, acc_no, parvesh_fee, service_charge, shares, karj_hapta, farm_fee, vilamb_akar, date, time, loan_id FROM add_payment where sabhasad_id=?".$loan_id_stmt)) { $stmt->bind_param("s",$account_nu); $stmt->bind_result($res_id, $sabhasad_id, $payment_date, $acc_no, $parvesh_fee, $service_charge, $shares, $karj_hapta, $farm_fee, $vilamb_akar, $res_date, $res_time, $loan_id); if ($stmt->execute()) { $data = []; $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $sabhasad_id; $data[$counter][2] = $payment_date; $data[$counter][3] = $acc_no; $data[$counter][4] = $parvesh_fee; $data[$counter][5] = $service_charge; $data[$counter][6] = $shares; $data[$counter][7] = $karj_hapta; $data[$counter][8] = $farm_fee; $data[$counter][9] = $vilamb_akar; $data[$counter][10] = $res_date; $data[$counter][11] = $res_time; $data[$counter][12] = $loan_id; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function get_name_by_id_for_user($current_login_admin) { if($stmt_select = $this->con->prepare("Select `name` from `sabhasad_entry` where `mobile_no` = ? ")) { $stmt_select->bind_param("s",$current_login_admin); $stmt_select->bind_result($result_name); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_name; } } return false; } } function get_accunt_number_by_id_for_user($current_login_admin) { if ($stmt_select = $this->con->prepare("SELECT `id` FROM `sabhasad_entry` WHERE `mobile_no` = ?")) { $stmt_select->bind_param("s", $current_login_admin); if ($stmt_select->execute()) { $result = $stmt_select->get_result(); $account_numbers = []; while ($row = $result->fetch_assoc()) { $account_numbers[] = $row['id']; } return $account_numbers; } } return []; } function get_loadn_amount_for_account_stmt_user($pavati_id) { if($stmt_select = $this->con->prepare("Select `loan_amount` from `add_loan_details` where `sabhasad_id` = ?")) { $stmt_select->bind_param("s",$pavati_id); $stmt_select->bind_result($result_name); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_name; } } return false; } } function get_paid_loan_amount_for_user($account_nu) { if($stmt_select = $this->con->prepare("Select `balance_loan` from `add_loan_details` where `sabhasad_id` = ?")) { $stmt_select->bind_param("s",$account_nu); $stmt_select->bind_result($result_name); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_name; } } return false; } } function get_loan_date_foe_user($account_nu,$loan_id) { if($stmt_select = $this->con->prepare("Select `date` from `add_loan_details` where `sabhasad_id` = ? AND `id`=?")) { $stmt_select->bind_param("ss",$account_nu,$loan_id); $stmt_select->bind_result($result_name); if($stmt_select->execute()) { if($stmt_select->fetch()) { return $result_name; } } return false; } } function get_loan_for_searc_user($account_nu) { if ($stmt = $this->con->prepare("SELECT `id`,`title`, `sabhasad_id`, `loan_amount`, `jamin_name`, `date`, `time`,`loan_date` FROM `add_loan_details` WHERE `sabhasad_id`=?")) { $stmt->bind_param("s",$account_nu); $stmt->bind_result($res_id,$title,$sabhasad_id, $loan_amount, $jamin_name,$res_date ,$res_time,$loan_date); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $data[$counter][1] = $title; $data[$counter][2] = $sabhasad_id; $data[$counter][3] = $loan_amount; $data[$counter][4] = $jamin_name; $data[$counter][5] = $res_date; $data[$counter][6] = $res_time; $data[$counter][7] = $loan_date; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } function get_previous_month_id_wise($sabhasad_id, $payment_date) { if ($stmt_select = $this->con->prepare("SELECT `payment_date` FROM `add_payment` WHERE `sabhasad_id` = ? AND `payment_date` < ?")) { $stmt_select->bind_param("ss", $sabhasad_id, $payment_date); if ($stmt_select->execute()) { $result = $stmt_select->get_result(); $previous_dates = []; while ($row = $result->fetch_assoc()) { $payment_date = $row['payment_date']; $month = date('m', strtotime($payment_date)); // Extract month (01 to 12) $year = date('Y', strtotime($payment_date)); // Extract year $previous_dates[] = [ 'month' => $month, 'year' => $year, 'payment_date' => $payment_date ]; } return $previous_dates; } } return []; } function get_prevoius_month_amount($sabhasad_id, $previous_months) { $month_shares = []; foreach ($previous_months as $previous_month) { if ($stmt_select = $this->con->prepare("SELECT `shares` FROM `add_payment` WHERE `sabhasad_id` = ? AND MONTH(`payment_date`) = ?")) { $stmt_select->bind_param("ss", $sabhasad_id, $previous_month); // Bind the result to fetch the share amount $stmt_select->bind_result($shares); // Execute the statement if ($stmt_select->execute()) { // Fetch the result if the query returns a record if ($stmt_select->fetch()) { // Store the result (shares) in the array with the month as the key $month_shares[$previous_month] = $shares; } else { // If no result is found, store false (or you can store 0 or null if preferred) $month_shares[$previous_month] = false; } // Free the result set before moving to the next query $stmt_select->free_result(); } // Close the prepared statement $stmt_select->close(); } } // Return the array of share amounts for the requested months return $month_shares; } function get_account_numbers_id_wise($current_login_admin) { if ($stmt = $this->con->prepare("SELECT `id` FROM `sabhasad_entry` WHERE `mobile_no` = ?")) { $stmt->bind_param("s", $current_login_admin); $stmt->bind_result($res_id); if ($stmt->execute()) { $data = array(); $counter = 0; while ($stmt->fetch()) { $data[$counter][0] = $res_id; $counter++; } if (!empty($data)) { return $data; } else { return false; } } } } }//End ?>
Linux 65-254-81-4.cprapid.com 5.14.0-284.11.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 9 05:49:00 EDT 2023 x86_64
Apache
65.254.81.4