modify('+1 day'); // Include the last day
$dates = [];
$interval = new DateInterval('P1D'); // 1 day interval
$date_period = new DatePeriod($start_date, $interval, $end_date);
foreach ($date_period as $date) {
$dates[] = $date->format('Y-m-d');
}
$select = $mysqli->query("select * from staff where deleted_at is null and staff_id = '138'") ;
if ( $select->num_rows > 0 ){
while ( $row = $select->fetch_assoc() ){
foreach ( $dates as $k => $v ){
$selectattendance = $mysqli->query("SELECT * FROM `staff_attendance_list` WHERE `staff_id` = '".$row['staff_id']."' and list_date LIKE '%".$v."%' and deleted_at is null;") ;
if ( $selectattendance->num_rows == 0 ){
echo $row['staff_id'] . ' : ' . $v ;
echo "\n\n" ;
}
}
echo "\n\n" ;
echo "\n\n" ;
echo "\n\n" ;
echo "\n\n" ;
}
}
exit;
$a = '' ;
$b = json_decode($a, true) ;
$c = $b['2']['data'] ;
$select_staff = $mysqli->query("select * from staff where branch_id = '1'") ;
if ( $select_staff->num_rows > 0 ){
while ($row_staff = $select_staff->fetch_assoc() ){
$check = false ;
foreach ( $c as $k => $v ){
if ( $v['badgenumber'] == $row_staff['staff_idno'] ){
$check = true ;
}
}
if ( !$check ){
// $mysqli->query("update staff set updated_at = '".date("Y-m-d H:i:s", time())."' where staff_id = '".$row_staff['staff_id']."'") ;
echo "update staff set updated_at = '".date("Y-m-d H:i:s", time())."' where staff_id = '".$row_staff['staff_id']."' ;" ;
echo "\n\n" ;
}
}
}
exit ;
// $mysqli->query("UPDATE `staff_leave_month` SET
// `given_date` = '2023-06-01'
// WHERE `given_date` = '0000-00-00'");
exit ;
$select = $mysqli->query( "SELECT SUM(given_day) as total, staff_id FROM staff_leave_month
GROUP BY staff_id" ) ;
while ( $row = $select->fetch_assoc() ){
$get_leave_year = $mysqli->query("SELECT leave_year_id, leave_record_days FROM staff_leave_year
WHERE deleted_at IS NULL AND staff_id = '".$row['staff_id']."' AND leave_type = 'annual' AND leave_year = '2023' LIMIT 1") ;
if ( $get_leave_year->num_rows > 0 ){
$row_leave_year = $get_leave_year->fetch_assoc() ;
$staff = $mysqli->query( "SELECT leave_given_days FROM staff_leave_year
WHERE leave_type = 'annual' AND leave_year = '2023' AND staff_id = '".$row['staff_id']."'" ) ;
$row_staff = $staff->fetch_assoc() ;
$extra_days = ( $row_staff['leave_given_days'] - $row['total'] ) ;
if ( $extra_days > 0 ){
echo "INSERT INTO staff_leave_month
( leave_year_id, staff_id, given_month, given_day ) VALUES
( '".$row_leave_year['leave_year_id']."', '".$row['staff_id']."', '6', '".$extra_days."' )" ;
print_r('
') ;
print_r('
') ;
// $mysqli->query( "INSERT INTO staff_leave_month
// ( leave_year_id, staff_id, given_month, given_day ) VALUES
// ( '".$row_leave_year['leave_year_id']."', '".$row['staff_id']."', '6', '".$extra_days."' )" ) ;
// $mysqli->query( "UPDATE staff_leave_year SET
// leave_days = leave_days + ".$extra_days."
// WHERE leave_year_id = '".$row_leave_year['leave_year_id']."'" ) ;
print_r('
') ;
print_r($row) ;
print_r('
') ;
print_r($extra_days) ;
print_r('
') ;
print_r('
') ;
print_r('
') ;
print_r('
') ;
}
}
}
exit ;
$select = $mysqli->query( "SELECT * FROM staff_leave_year
WHERE leave_type = 'annual' AND leave_year = '2023'" ) ;
// // Define the plaintext, IV, and encryption key
// $plaintext = '{"CompanyID":"1","IsActive":"1"}';
// $key = '1234567890030188';
// $iv = 'Info-TechGateWay' ;
// // Encrypt the plaintext using AES-256-CBC
// $ciphertext = openssl_encrypt($plaintext, 'aes-128-cbc', $key, OPENSSL_RAW_DATA, $iv);
// // Encode the ciphertext in base64 for output
// $output = base64_encode($ciphertext);
// echo $output;
// exit ;
exit ;
$rms_call = rmsCall( 'pinless/getproductidlistbymobilenumber', $rms_content ) ;
print_r($rms_call) ;
exit ;
$parameter = [
'referenceId' => 'TESTBO000043',
'countryCode' => '60',
'mobileNumber' => '176168619'
] ;
$post = 'POST' ;
$path = 'https://api-qa.molreloads.com/terminal/v1/pinless/getproductidlistbymobilenumber' ;
$content = json_encode($parameter) ;
// $datetime = gmdate("Y-m-d\TH:i:s\Z") ;
$datetime = '2023-05-07T12:36:32Z' ;
$terminal = 'IPSSB01001' ;
// $terminal = '000300001' ;
$terminaltobase64 = base64_encode($terminal) ;
$key = '3566977797971712' ;
// $key = '0806105298910204' ;
$data = $post . $path . $content . $datetime . $terminal ;
$signature = hash_hmac("sha1", $data, $key) ;
$signaturetobase64 = base64_encode($signature) ;
echo 'Post: '.$post ;
echo '
' ;
echo 'Path: '.$path ;
echo '
' ;
echo 'Content: '.$content ;
echo '
' ;
echo 'Datetime: '.$datetime ;
echo '
' ;
echo 'Terminal: '.$terminal ;
echo '
' ;
echo 'Terminal Base64: '.$terminaltobase64 ;
echo '
' ;
echo 'Secret Key: '.$key ;
echo '
' ;
echo 'Signature Before: '.$data ;
echo '
' ;
echo 'Signature: '.$signature ;
echo '
' ;
echo 'Signature Base64: '.$signaturetobase64 ;
echo '
' ;
echo '
' ;
echo '
' ;
print_r(array(
'Authorization: mol-req-sign '.$terminaltobase64.':'.$signaturetobase64,
'Content-Type: application/json',
'x-mol-date-time: '.$datetime
)) ;
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $path,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => $content,
CURLOPT_HTTPHEADER => array(
'authorization: mol-req-sign '.$terminaltobase64.':'.$signaturetobase64,
'content-type: application/json',
'x-mol-date-time: '.$datetime
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
exit ;
?>