Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for($j=0;$j<count($fees_type_arr);$j++){
- $month = "N/A";
- switch ($fees_type_arr[$j]) {
- case 'adm':
- $sql_record_data = array(
- 'tid' => $tid.$j+1,
- 'slip_no' => $slip_no,
- 'date_time' => $current_date_time,
- 'uid' => $uid,
- 'month' => $month,
- 'amount' => $admission_fees,
- 'fees_type' => 'adm'
- );
- if($wpdb->insert($record_table, $sql_record_data)){
- $ok = 1;
- }
- else{
- $ok = 0;
- throw new Exception($wpdb->print_error());
- }
- break;
- case "trn":
- $sql_record_data = array(
- 'tid' => $tid.$j+1,
- 'slip_no' => $slip_no,
- 'date_time' => $current_date_time,
- 'uid' => $uid,
- 'month' => $month,
- 'amount' => $transport_chg,
- 'fees_type' => 'trn'
- );
- if($wpdb->insert($record_table, $sql_record_data)){
- $ok = 1;
- }
- else{
- $ok = 0;
- throw new Exception($wpdb->print_error());
- }
- break;
- case "ann":
- $sql_record_data = array(
- 'tid' => $tid.$j+1,
- 'slip_no' => $slip_no,
- 'date_time' => $current_date_time,
- 'uid' => $uid,
- 'month' => $month,
- 'amount' => $annual_chg,
- 'fees_type' => 'ann'
- );
- if($wpdb->insert($record_table, $sql_record_data)){
- $ok = 1;
- }
- else{
- $ok = 0;
- throw new Exception($wpdb->print_error());
- }
- break;
- case "rec":
- $sql_record_data = array(
- 'tid' => $tid.$j+1,
- 'slip_no' => $slip_no,
- 'date_time' => $current_date_time,
- 'uid' => $uid,
- 'month' => $month,
- 'amount' => $recreation_chg,
- 'fees_type' => 'rec'
- );
- if($wpdb->insert($record_table, $sql_record_data)){
- $ok = 1;
- }
- else{
- $ok = 0;
- throw new Exception($wpdb->print_error());
- }
- break;
- }
- }
- $fees_type_arr = array("adm","ttn","trn","ann","rec");
Add Comment
Please, Sign In to add comment