first commit

This commit is contained in:
LAPTOP-V9RRD1TL\Michelle's Computer
2025-07-21 21:38:17 +08:00
commit f8f8fcaf96
2529 changed files with 227800 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
if ( $boolean_login ){
$status = '201' ;
$list = [] ;
$query = '' ;
$mysqli_category = $mysqli->query( "SELECT a.category_id, b.title FROM rms_bill_category a
LEFT JOIN rms_bill_category_translation b ON ( a.category_id = b.category_id )
WHERE a.deleted_at IS NULL AND a.status = 'active' AND b.lang = '".$array['lang']."' ORDER BY a.sortable ASC" ) ;
if ( $mysqli_category->num_rows > 0 ){
$status = '200' ;
$items = [] ;
$mysqli_item = $mysqli->query( "SELECT a.item_id, a.category_id, a.min_amount, a.max_amount, a.is_reference1, a.is_reference2, a.is_reference3, a.is_reference4, a.file, b.title, b.content, b.reference1, b.reference2, b.reference3, b.reference4 FROM rms_bill_item a
LEFT JOIN rms_bill_item_translation b ON ( a.item_id = b.item_id )
WHERE a.deleted_at IS NULL AND a.status = 'active' AND b.lang = '".$array['lang']."' ORDER BY a.sortable ASC" ) ;
if ( $mysqli_item->num_rows > 0 ){
while ( $row_item = $mysqli_item->fetch_assoc() ){
$row_item['title'] = dataFilter( $row_item['title'] ) ;
$row_item['content'] = dataFilter( $row_item['content'] ) ;
$row_item['file'] = ( $row_item['file'] != '' ? PATH.'uploads/RmsBillItem/b/'.$row_item['file'] : '' ) ;
$items[$row_item['category_id']][] = $row_item ;
}
}
while ( $row_category = $mysqli_category->fetch_assoc() ){
$row_category['id'] = dataFilter( $row_category['category_id'] ) ;
$row_category['title'] = dataFilter( $row_category['title'] ) ;
$row_category['items'] = ( $items[$row_category['category_id']] != null ? $items[$row_category['category_id']] : [] ) ;
$list[] = $row_category ;
}
}
$data['list'] = $list ;
}
require( $require_sub.'footer.php' ) ;
?>
+86
View File
@@ -0,0 +1,86 @@
<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
if ( $boolean_login ){
$status = '300' ;
$bill_id = $array['bill_id'] ;
$amount = $array['amount'] ;
if ( $bill_id != '' && $amount > 0 ){
$status = '250' ;
$amount = numberFormat( $amount, 2 ) ;
if ( $staff_info['staff_wallet'] >= $amount ){
$status = '201' ;
$select_bill = $mysqli->query( "SELECT a.bill_id, a.reference1, a.reference2, a.reference3, a.reference4, b.biller_code, b.min_amount, b.max_amount FROM staff_rms_bill a
LEFT JOIN rms_bill_item b ON ( a.item_id = b.item_id )
WHERE a.deleted_at IS NULL AND b.deleted_at IS NULL AND a.staff_id = '".$staff_info['staff_id']."' AND a.bill_id = '".$bill_id."' LIMIT 1" ) ;
if ( $select_bill->num_rows > 0 ){
$status = 'rms-39' ;
$row_bill = $select_bill->fetch_assoc() ;
if ( $amount >= $row_bill['min_amount'] && $amount <= $row_bill['max_amount'] ){
$status = '203' ;
if ( $mysqli->query( "INSERT INTO staff_rms_bill_order
( `branch_id`, `staff_id`, `bill_id`, `biller_code`, `cashier_id`, `reference1`, `reference2`, `reference3`, `reference4`, `amount` ) VALUES
( '".$array['branch_id']."', '".$staff_info['staff_id']."', '".$bill_id."', '".$row_bill['biller_code']."', '".RMSLOCATION."', '".$row_bill['reference1']."', '".$row_bill['reference2']."', '".$row_bill['reference3']."', '".$row_bill['reference4']."', '".$amount."' )" ) ){
// update sonumber
$order_id = $mysqli->insert_id ;
$sonumber = 'BO'.strPad( 6, $order_id ) ;
$mysqli->query( "UPDATE staff_rms_bill_order SET sonumber = '".$sonumber."' WHERE order_id = '".$order_id."'" ) ;
$rms_content = [
'referenceId' => $sonumber,
'billerCode' => $row_bill['biller_code'],
'billReferenceNo1' => $row_bill['reference1'],
'billReferenceNo2' => $row_bill['reference2'],
'billReferenceNo3' => $row_bill['reference3'],
'billReferenceNo4' => $row_bill['reference4'],
'amount' => $amount
] ;
$rms_call = rmsCall( 'bill/initiate', $rms_content ) ;
saveLog( 'rms-api', 'Intiate Bill Order', $rms_content, $rms_call ) ;
if ( $rms_call['respCode'] == '00' ){
$status = '298' ;
// deduct the wallet first
$remark = 'You have been deducted the wallet from bill order '.$row_bill['reference1'].' (' . $sonumber . ')' ;
$walletdeduct = walletMovement( 'staff_rms_bill_order', $order_id, 'minus', 'normal', $staff_info['staff_id'], -($amount), $remark ) ;
if ( $walletdeduct ){
$status = '200' ;
// update status
$mysqli->query( "UPDATE staff_rms_bill_order SET
rms_accountname = '".$rms_call['billAccountName']."',
rms_instruction = '".$rms_call['instruction']."',
rms_authorizationtoken = '".$rms_call['authorizationToken']."',
status = 'pending'
WHERE order_id = '".$order_id."'" ) ;
}
}else{
$status = 'rms-'.$rms_call['respCode'] ;
}
}
}
}
}
}
}
require( $require_sub.'footer.php' ) ;
?>
+25
View File
@@ -0,0 +1,25 @@
<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
if ( $boolean_login ){
$status = '201' ;
$mysqli_bill = $mysqli->query( "SELECT a.bill_id FROM staff_rms_bill a
WHERE a.deleted_at IS NULL AND a.staff_id = '".$staff_info['staff_id']."' AND a.bill_id = '".$array['bill_id']."'" ) ;
if ( $mysqli_bill->num_rows > 0 ){
$status = '200' ;
$mysqli->query( "UPDATE staff_rms_bill SET
deleted_at = '".TODAYDATE."'
WHERE bill_id = '".$array['bill_id']."'" ) ;
}
}
require( $require_sub.'footer.php' ) ;
?>
+28
View File
@@ -0,0 +1,28 @@
<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
if ( $boolean_login ){
$status = '201' ;
$query = "SELECT a.sonumber, a.biller_code, a.reference1, a.reference2, a.reference3, a.reference4, a.amount, a.status, a.created_at, b.title, c.file FROM staff_rms_bill_order a
LEFT JOIN staff_rms_bill b ON ( a.bill_id = b.bill_id )
LEFT JOIN rms_bill_item c ON ( b.item_id = c.item_id )
WHERE a.deleted_at IS NULL AND a.staff_id = '".$staff_info['staff_id']."' AND a.order_id = '".$array['id']."'" ;
$mysqli_query = $mysqli->query( $query . " LIMIT 1" ) ;
if ( $mysqli_query->num_rows > 0 ){
$status = '200' ;
$row = $mysqli_query->fetch_assoc() ;
$row['file'] = ( $row['file'] != '' ? PATH.'uploads/RmsBillItem/b/'.$row['file'] : '' ) ;
$data['list'] = $row ;
}
}
require( $require_sub.'footer.php' ) ;
?>
+52
View File
@@ -0,0 +1,52 @@
<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
if ( $boolean_login ){
$status = '201' ;
$searchfilter = $array['searchfilter'] ;
$search_query = '' ;
if ( $array['search'] != '' ){
$search_query .= " AND ( a.sonumber LIKE '%".$array['search']."%' OR a.reference1 LIKE '%".$array['search']."%' OR b.title LIKE '%".$array['search']."%' )" ;
}
switch ( $searchfilter ){
case 'pending' :
$search_query .= " AND a.status IN ( 'new', 'pending', 'progress' )" ;
break ;
case 'confirmed' :
$search_query .= " AND a.status IN ( 'confirmed' )" ;
break ;
case 'cancelled' :
$search_query .= " AND a.status IN ( 'cancelled', 'failed' )" ;
break ;
}
$query = "SELECT a.order_id, a.sonumber, a.biller_code, a.reference1, a.reference2, a.reference3, a.reference4, a.amount, a.status, a.created_at, b.title, c.file FROM staff_rms_bill_order a
LEFT JOIN staff_rms_bill b ON ( a.bill_id = b.bill_id )
LEFT JOIN rms_bill_item c ON ( b.item_id = c.item_id )
WHERE a.deleted_at IS NULL AND a.staff_id = '".$staff_info['staff_id']."' " . $search_query ;
$mysqli_query = $mysqli->query( $query . " ORDER BY a.order_id DESC LIMIT " . getLimit( $current ) ) ;
if ( $mysqli_query->num_rows > 0 ){
$status = '200' ;
$list = [] ;
while ( $row = $mysqli_query->fetch_assoc() ){
$row['created_at'] = resetDateFormat( $row['created_at'] ) ;
$row['order_status'] = ( checkExists( $row['status'] ) != '' ? $row['status'] : '' ) ;
$row['file'] = ( $row['file'] != '' ? PATH.'uploads/RmsBillItem/b/'.$row['file'] : '' ) ;
$list[] = $row ;
}
$data['list'] = $list ;
}
}
require( $require_sub.'footer.php' ) ;
?>
+29
View File
@@ -0,0 +1,29 @@
<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
if ( $boolean_login ){
$status = '201' ;
$list = [] ;
$mysqli_bill = $mysqli->query( "SELECT a.bill_id, a.item_id, a.title, a.reference1, a.reference2, a.reference3, a.reference4, a.created_at, b.is_reference1, b.is_reference2, b.is_reference3, b.is_reference4, c.reference1 as reference1_title, c.reference2 as reference2_title, c.reference3 as reference3_title, c.reference4 as reference4_title FROM staff_rms_bill a
LEFT JOIN rms_bill_item b ON ( a.item_id = b.item_id )
LEFT JOIN rms_bill_item_translation c ON ( b.item_id = c.item_id )
WHERE a.deleted_at IS NULL AND a.staff_id = '".$staff_info['staff_id']."' AND a.item_id = '".$array['item_id']."' AND b.deleted_at IS NULL AND b.status = 'active' AND c.lang = '".$array['lang']."'" ) ;
if ( $mysqli_bill->num_rows > 0 ){
$status = '200' ;
while ( $row_bill = $mysqli_bill->fetch_assoc() ){
$list[] = $row_bill ;
}
}
$data['list'] = $list ;
}
require( $require_sub.'footer.php' ) ;
?>
+58
View File
@@ -0,0 +1,58 @@
<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
if ( $boolean_login ){
$status = '300' ;
$item_id = $array['item_id'] ;
$title = $array['title'] ;
$reference1 = $array['reference1'] ;
$reference2 = $array['reference2'] ;
$reference3 = $array['reference3'] ;
$reference4 = $array['reference4'] ;
if ( $array['item_id'] != '' && $array['title'] != '' ){
$status = '201' ;
$select_item = $mysqli->query( "SELECT is_reference1, is_reference2, is_reference3, is_reference4 FROM rms_bill_item
WHERE deleted_at IS NULL AND status = 'active' AND item_id = '".$item_id."' LIMIT 1" ) ;
if ( $select_item->num_rows > 0 ){
$status = '300' ;
$row_item = $select_item->fetch_assoc() ;
$is_error = 0 ;
if ( $row_item['is_reference1'] == 'yes' && $reference1 == '' ){
$is_error++ ;
}
if ( $row_item['is_reference2'] == 'yes' && $reference2 == '' ){
$is_error++ ;
}
if ( $row_item['is_reference3'] == 'yes' && $reference3 == '' ){
$is_error++ ;
}
if ( $row_item['is_reference4'] == 'yes' && $reference4 == '' ){
$is_error++ ;
}
if ( $is_error == 0 ){
$status = '203' ;
if ( $mysqli->query( "INSERT INTO staff_rms_bill
( `branch_id`, `staff_id`, `item_id`, `title`, `reference1`, `reference2`, `reference3`, `reference4` ) VALUES
( '".$array['branch_id']."', '".$staff_info['staff_id']."', '".$array['item_id']."', '".$array['title']."', '".$array['reference1']."', '".$array['reference2']."', '".$array['reference3']."', '".$array['reference4']."' )" ) ){
$status = '200' ;
}
}
}
}
}
require( $require_sub.'footer.php' ) ;
?>
+65
View File
@@ -0,0 +1,65 @@
<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
if ( $boolean_login ){
$status = '300' ;
$item_id = $array['item_id'] ;
$lists = $array['lists'] ;
if ( $item_id != '' && count( $array['lists'] ) > 0 ){
$status = '201' ;
$select_item = $mysqli->query( "SELECT is_reference1, is_reference2, is_reference3, is_reference4 FROM rms_bill_item
WHERE deleted_at IS NULL AND status = 'active' AND item_id = '".$item_id."' LIMIT 1" ) ;
if ( $select_item->num_rows > 0 ){
$status = '300' ;
$row_item = $select_item->fetch_assoc() ;
$is_error = 0 ;
foreach ( $lists as $k => $v ){
if ( $row_item['is_reference1'] == 'yes' && $v['reference1'] == '' ){
$is_error++ ;
}
if ( $row_item['is_reference2'] == 'yes' && $v['reference2'] == '' ){
$is_error++ ;
}
if ( $row_item['is_reference3'] == 'yes' && $v['reference3'] == '' ){
$is_error++ ;
}
if ( $row_item['is_reference4'] == 'yes' && $v['reference4'] == '' ){
$is_error++ ;
}
}
if ( $is_error == 0 ){
$status = '203' ;
$is_update = false ;
foreach ( $lists as $k => $v ){
if ( $mysqli->query( "UPDATE staff_rms_bill SET
title = '".$v['title']."',
reference1 = '".$v['reference1']."',
reference2 = '".$v['reference2']."',
reference3 = '".$v['reference3']."',
reference4 = '".$v['reference4']."'
WHERE bill_id = '".$v['bill_id']."'" ) ){
$is_update = true ;
}
}
if ( $is_update ){
$status = '200' ;
}
}
}
}
}
require( $require_sub.'footer.php' ) ;
?>
+68
View File
@@ -0,0 +1,68 @@
<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
if ( $boolean_login ){
$status = 'rms-47' ;
$item_id = $array['item_id'] ;
$dialcode = $array['dialcode'] ;
$mobile = $array['mobile'] ;
if ( $item_id != '' && $dialcode != '' && $mobile != '' ){
$status = '203' ;
$dialcode = str_replace( '+', '', $dialcode ) ;
$referenceid = strPad( '5', $staff_info['staff_id'] ) . time() . strPad( '5', rand( 0, 99999 ) ) ;
if ( $mysqli->query( "INSERT INTO staff_rms_prepaid_pretemp
( `referenceid`, `item_id`, `dialcode`, `mobile` ) VALUES
( '".$referenceid."', '".$item_id."', '".$dialcode."', '".$mobile."' )" ) ){
$temp_id = $mysqli->insert_id ;
// $rms_content = [
// 'referenceId' => $referenceid,
// 'countryCode' => $dialcode,
// 'mobileNumber' => $mobile
// ] ;
// $rms_call = rmsCall( 'pinless/getproductidlistbymobilenumber', $rms_content ) ;
// saveLog( 'rms-api', 'Check Prepaid Mobile Number', $rms_content, $rms_call ) ;
// if ( $rms_call['respCode'] == '00' ){
// $status = '202' ;
// if ( $mysqli->query( "UPDATE staff_rms_prepaid_pretemp SET
// rms_authorizationtoken = '".$rms_call['authorizationToken']."',
// status = 'progress'
// WHERE temp_id = '".$temp_id."'" ) ){
// $status = '200' ;
// $data = [
// 'temp_id' => $temp_id
// ] ;
// }
// }else{
// $status = 'rms-'.$rms_call['respCode'] ;
// }
$status = '202' ;
if ( $mysqli->query( "UPDATE staff_rms_prepaid_pretemp SET
status = 'progress'
WHERE temp_id = '".$temp_id."'" ) ){
$status = '200' ;
$data = [
'temp_id' => $temp_id
] ;
}
}
}
}
require( $require_sub.'footer.php' ) ;
?>
+88
View File
@@ -0,0 +1,88 @@
<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
if ( $boolean_login ){
$status = '300' ;
$temp_id = $array['temp_id'] ;
$item_id = $array['item_id'] ;
$deno_id = $array['deno_id'] ;
$dialcode = $array['dialcode'] ;
$mobile = $array['mobile'] ;
if ( $temp_id != '' && $item_id != '' && $deno_id != '' ){
$dialcode = str_replace( '+', '', $dialcode ) ;
$select_deno = $mysqli->query( "SELECT deno_code, amount FROM rms_prepaid_deno
WHERE deleted_at IS NULL AND item_id = '".$item_id."' AND deno_id = '".$deno_id."' AND status = 'active' LIMIT 1" ) ;
if ( $select_deno->num_rows > 0 ){
$row_deno = $select_deno->fetch_assoc() ;
$amount = numberFormat( $row_deno['amount'], 2 ) ;
$select_temp = $mysqli->query( "SELECT rms_authorizationtoken FROM staff_rms_prepaid_pretemp
WHERE deleted_at IS NULL AND temp_id = '".$temp_id."' AND item_id = '".$item_id."' AND dialcode = '".$dialcode."' AND mobile = '".$mobile."' LIMIT 1" ) ;
if ( $select_temp->num_rows > 0 ){
$status = '250' ;
$row_temp = $select_temp->fetch_assoc() ;
if ( $amount > 0 && $staff_info['staff_wallet'] >= $amount ){
$status = '203' ;
if ( $mysqli->query( "INSERT INTO staff_rms_prepaid_order
( `branch_id`, `staff_id`, `temp_id`, `item_id`, `deno_id`, `deno_code`, `cashier_id`, `dialcode`, `mobile`, `amount` ) VALUES
( '".$array['branch_id']."', '".$staff_info['staff_id']."', '".$temp_id."', '".$item_id."', '".$deno_id."', '".$row_deno['deno_code']."', '".RMSLOCATION."', '".$dialcode."', '".$mobile."', '".$amount."' )" ) ){
// update sonumber
$order_id = $mysqli->insert_id ;
$sonumber = 'TO'.strPad( 6, $order_id ) ;
$mysqli->query( "UPDATE staff_rms_prepaid_order SET sonumber = '".$sonumber."' WHERE order_id = '".$order_id."'" ) ;
$status = '298' ;
// deduct the wallet first
$remark = 'You have been deducted the wallet from prepaid order '.$dialcode.'-'.$mobile.' (' . $sonumber . ')' ;
$walletdeduct = walletMovement( 'staff_rms_prepaid_order', $order_id, 'minus', 'normal', $staff_info['staff_id'], -($amount), $remark ) ;
if ( $walletdeduct ){
$status = '200' ;
$rms_content = [
'referenceId' => $sonumber,
'cashierId' => RMSLOCATION,
'productCode' => $row_deno['deno_code'],
'transactionDateTime' => date( "Y-m-d\TH:i:s", time() ),
'businessDate' => date( "Y-m-d", time() ),
'countryCode' => $dialcode,
'mobileNumber' => $mobile,
'partnerReferenceId' => $sonumber
] ;
$rms_call = rmsCall( 'pinless/requesttopup', $rms_content ) ;
saveLog( 'rms-api', 'Request Prepaid Order', $rms_content, $rms_call ) ;
// update status
$mysqli->query( "UPDATE staff_rms_prepaid_order SET
rms_instruction = '".$rms_call['instructions']."',
rms_order_id = '".$rms_call['orderId']."',
status = 'pending'
WHERE order_id = '".$order_id."'" ) ;
}
}
}
}
}
}
}
require( $require_sub.'footer.php' ) ;
?>
+28
View File
@@ -0,0 +1,28 @@
<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
if ( $boolean_login ){
$status = '201' ;
$query = "SELECT a.order_id, a.sonumber, a.deno_code, a.dialcode, a.mobile, a.amount, a.status, a.created_at, b.file , c.title FROM staff_rms_prepaid_order a
LEFT JOIN rms_prepaid_item b ON ( a.item_id = b.item_id )
LEFT JOIN rms_prepaid_deno_translation c ON ( a.deno_id = c.deno_id )
WHERE a.deleted_at IS NULL AND a.staff_id = '".$staff_info['staff_id']."' AND c.lang = '".$array['lang']."' AND a.order_id = '".$array['id']."'" ;
$mysqli_query = $mysqli->query( $query . " LIMIT 1" ) ;
if ( $mysqli_query->num_rows > 0 ){
$status = '200' ;
$row = $mysqli_query->fetch_assoc() ;
$row['file'] = ( $row['file'] != '' ? PATH.'uploads/RmsPrepaidItem/b/'.$row['file'] : '' ) ;
$data['list'] = $row ;
}
}
require( $require_sub.'footer.php' ) ;
?>
+52
View File
@@ -0,0 +1,52 @@
<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
if ( $boolean_login ){
$status = '201' ;
$searchfilter = $array['searchfilter'] ;
$search_query = '' ;
if ( $array['search'] != '' ){
$search_query .= " AND ( a.sonumber LIKE '%".$array['search']."%' OR a.dialcode LIKE '%".$array['search']."%' OR a.mobile LIKE '%".$array['search']."%' OR c.title LIKE '%".$array['search']."%' )" ;
}
switch ( $searchfilter ){
case 'pending' :
$search_query .= " AND a.status IN ( 'new', 'pending', 'progress' )" ;
break ;
case 'confirmed' :
$search_query .= " AND a.status IN ( 'confirmed' )" ;
break ;
case 'cancelled' :
$search_query .= " AND a.status IN ( 'cancelled', 'failed' )" ;
break ;
}
$query = "SELECT a.order_id, a.sonumber, a.deno_code, a.dialcode, a.mobile, a.amount, a.status, a.created_at, b.file , c.title FROM staff_rms_prepaid_order a
LEFT JOIN rms_prepaid_item b ON ( a.item_id = b.item_id )
LEFT JOIN rms_prepaid_deno_translation c ON ( a.deno_id = c.deno_id )
WHERE a.deleted_at IS NULL AND a.staff_id = '".$staff_info['staff_id']."' AND c.lang = '".$array['lang']."' " . $search_query ;
$mysqli_query = $mysqli->query( $query . " ORDER BY a.order_id DESC LIMIT " . getLimit( $current ) ) ;
if ( $mysqli_query->num_rows > 0 ){
$status = '200' ;
$list = [] ;
while ( $row = $mysqli_query->fetch_assoc() ){
$row['created_at'] = resetDateFormat( $row['created_at'] ) ;
$row['order_status'] = ( checkExists( $row['status'] ) != '' ? $row['status'] : '' ) ;
$row['file'] = ( $row['file'] != '' ? PATH.'uploads/RmsPrepaidItem/b/'.$row['file'] : '' ) ;
$list[] = $row ;
}
$data['list'] = $list ;
}
}
require( $require_sub.'footer.php' ) ;
?>
+45
View File
@@ -0,0 +1,45 @@
<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
if ( $boolean_login ){
$status = '201' ;
$list = [] ;
$query = '' ;
$mysqli_item = $mysqli->query( "SELECT a.item_id, a.file, b.title FROM rms_prepaid_item a
LEFT JOIN rms_prepaid_item_translation b ON ( a.item_id = b.item_id )
WHERE a.deleted_at IS NULL AND a.status = 'active' AND b.lang = '".$array['lang']."' ORDER BY a.sortable ASC" ) ;
if ( $mysqli_item->num_rows > 0 ){
$status = '200' ;
$denos = [] ;
$mysqli_deno = $mysqli->query( "SELECT a.deno_id, a.item_id, b.title FROM rms_prepaid_deno a
LEFT JOIN rms_prepaid_deno_translation b ON ( a.deno_id = b.deno_id )
WHERE a.deleted_at IS NULL AND a.status = 'active' AND b.lang = '".$array['lang']."' ORDER BY a.sortable ASC" ) ;
if ( $mysqli_deno->num_rows > 0 ){
while ( $row_deno = $mysqli_deno->fetch_assoc() ){
$row_deno['title'] = dataFilter( $row_deno['title'] ) ;
$denos[$row_deno['item_id']][] = $row_deno ;
}
}
while ( $row_item = $mysqli_item->fetch_assoc() ){
$row_item['id'] = dataFilter( $row_item['item_id'] ) ;
$row_item['title'] = dataFilter( $row_item['title'] ) ;
$row_item['file'] = ( $row_item['file'] != '' ? PATH.'uploads/RmsPrepaidItem/b/'.$row_item['file'] : '' ) ;
$row_item['denos'] = ( $denos[$row_item['item_id']] != null ? $denos[$row_item['item_id']] : [] ) ;
$list[] = $row_item ;
}
}
$data['list'] = $list ;
}
require( $require_sub.'footer.php' ) ;
?>