0byt3m1n1
Path:
/
home
/
k74ns2xygros
/
www
/
globetech
/
cms
/
accounts
/
[
Home
]
File: test.php
<?php session_start(); include "../assets/config.php"; $user = new user(); $row_count = $row_id = 1; $sal_txn_no = '01032022174612'; echo $sql = "SELECT * FROM `salary_table_combined` WHERE `salary_checked`='yes' AND `sal_txn_no`='$sal_txn_no' ORDER BY `sal_substation` asc,`emp_work_type` asc,`emp_category` desc LIMIT 1"; //echo $sql = "SELECT unit_id,unit_name,unit_code FROM `salary_table_combined` WHERE `salary_checked`='yes' AND `sal_txn_no`='$sal_txn_no' ORDER BY `sal_substation` asc,`emp_work_type` asc,`emp_category` desc LIMIT 1"; $result_party = $user->select_custom_query($sql); print_r($result_party); $company_id = $result_party[0]['company_id']; $unit_id = $result_party[0]['unit_id']; $unit_name = $result_party[0]['unit_name']; echo $unit_code = $result_party[0]['unit_code']; if ($row_count == $row_id) { echo $sel_query1 = "SELECT * FROM `new_payments` WHERE voucher_type='BANK' AND payment_status IN ('approved') AND unit_id='$unit_id' order by payment_authority_date desc"; $res_query1 = $user->select_custom_query($sel_query1); if ($res_query1[0]['voucher_no_digit'] != '') { $total_voucher1 = $res_query1[0]['voucher_no_digit']; } else { $total_voucher1 = 0; } // echo $total_voucher1; $sel_query2 = "SELECT * FROM `party_payments` where voucher_type='BANK' AND payment_status IN ('approved') AND unit_id='$unit_id' order by payment_authority_date desc"; $res_query2 = $user->select_custom_query($sel_query2); if ($res_query2[0]['voucher_no_digit'] != '') { $total_voucher2 = $res_query2[0]['voucher_no_digit']; } else { $total_voucher2 = 0; } // echo $total_voucher2; $sel_query3 = "SELECT salary_voucher_no_digit FROM `salary_table_combined` where salary_status='pay_authority' AND unit_id='$unit_id' order by salary_voucher_no_digit desc"; $res_query3 = $user->select_custom_query($sel_query3); if ($res_query3[0]['salary_voucher_no_digit'] != '') { $total_voucher3 = $res_query3[0]['salary_voucher_no_digit']; } else { $total_voucher3 = 0; } // echo $total_voucher3; $sel_query4 = "SELECT epf_voucher_no_digit FROM `salary_table_combined` where epf_status='epf_pay_authority' AND unit_id='$unit_id' order by epf_voucher_no_digit desc"; $res_query4 = $user->select_custom_query($sel_query4); if ($res_query4[0]['epf_voucher_no_digit'] != '') { $total_voucher4 = $res_query4[0]['epf_voucher_no_digit']; } else { $total_voucher4 = 0; } $sel_query5 = "SELECT esic_voucher_no_digit FROM `salary_table_combined` where esic_status='esic_pay_authority' AND unit_id='$unit_id' order by esic_voucher_no_digit desc"; $res_query5 = $user->select_custom_query($sel_query5); if ($res_query5[0]['esic_voucher_no_digit'] != '') { $total_voucher5 = $res_query5[0]['esic_voucher_no_digit']; } else { $total_voucher5 = 0; } $sel_query6 = "SELECT reverse_salary_voucher_no_digit FROM `salary_table_combined` where salary_status='pay_authority' AND sal_disburse_state='signed' AND unit_id='$unit_id' order by reverse_salary_voucher_no_digit desc"; $res_query6 = $user->select_custom_query($sel_query6); if ($res_query6[0]['reverse_salary_voucher_no_digit'] != '') { $total_voucher6 = $res_query3[0]['reverse_salary_voucher_no_digit']; } else { $total_voucher6 = 0; } // echo $total_voucher6; $total_voucher = max($total_voucher1, $total_voucher2, $total_voucher3, $total_voucher4, $total_voucher5, $total_voucher6); // $total_voucher = $res_query[0]['voucher_no_digit']; //mysqli_num_rows($res_query); $inc_no = $total_voucher + 1; $inc_no_padd = str_pad($inc_no, 4, 0, STR_PAD_LEFT); $voucher_no = $unit_code . '-' . $inc_no_padd; echo $query_up = "UPDATE `salary_table_combined` SET epf_voucher_no_digit='$inc_no',epf_voucher_no='$voucher_no' WHERE `sal_txn_no`='$sal_txn_no'"; // $res_val_up = mysqli_query($user->conn, $query_up); } ?>