Posts

  <! DOCTYPE html > < html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >     < title >SweetAlert Confirmation Dialog</ title >     <!-- Include SweetAlert CSS -->     < link rel = "stylesheet" href = "https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css" > </ head > < body >     < button id = "yourButtonId" >Click Me</ button >     <!-- Include SweetAlert JS -->     < script src = "https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.all.min.js" ></ script >     <!-- Include custom JS -->     </ body > </ html > < script > showAlert ( "success" , "Success!" , "Your operation was successful." ); showAlert ( "error" , "Error!&q
 UPDATE tbl_booking st JOIN tbl_country ft ON st.country = ft.country_code SET st.country = ft.nationality;
SELECT   tc .country_code ,   ( SELECT   COUNT ( tb .tbl_id )   FROM   tbl_booking   tb   WHERE   tb .country   =   tc .country_code )   AS   total_booking ,   COUNT ( DISTINCT   tbd .booking_id )   AS   confirmed_booking   FROM   tbl_country   tc   LEFT   JOIN   tbl_booking   tb   ON   tc .country_code   =   tb .country   LEFT   JOIN   tbl_booking_details   tbd   ON   tb .tbl_id   =   tbd .booking_id   AND   tbd .pay_status   =   1   AND   tbd .booking_cancle_status   =   0   GROUP   BY   tc .country_code ; SELECT tc.country_code, (SELECT COUNT(tb.tbl_id) FROM tbl_booking tb WHERE tb.country = tc.country_code) AS total_booking,  COUNT(DISTINCT tbd.booking_id) AS confirmed_booking FROM tbl_country tc   JOIN tbl_booking tb ON tc.country_code = tb.country   JOIN tbl_booking_details tbd ON tb.tbl_id = tbd.booking_id AND tbd.pay_status = 1 AND tbd.booking_cancle_status = 0  GROUP BY tc.country_code; ======================percentage SELECT   tc .country_code ,   ( SELECT   COUNT ( tb .tbl_i
<!doctype html> <html lang="en">   <head>     <meta charset="utf-8">     <meta name="viewport" content="width=device-width, initial-scale=1">     <title>Bootstrap demo</title>     <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">     <style>      /* Custom checkbox style */ .custom-checkbox input[type="checkbox"] {     display: none; /* Hide the default checkbox */ } .custom-checkbox li {     position: relative;     padding-left: 35px; /* Adjust according to the size of the checkmark */     cursor: pointer; } /* Style for the custom checkmark */ .custom-checkbox li::before {     content: '';     position: absolute;     top: 0;     left: 0;     width: 25px; /* Adjust the size of

To check the key is present in an array or not

 <?php $haystack = array('foo','b','bar'); $target = array('foo', 'bar'); if(count(array_intersect($haystack, $target)) == count($target)){     echo "present"; }else{     echo "not present"; } ?>
 <?php // Sample data $carNumbers = array('123', '123', '345', '345', '567'); // Initialize serial number $serialNumber = 1; // Initialize previous car number $prevCarNumber = null; // Output the table echo "<table border='1'>         <tr>             <th>Sr.No</th>             <th>Car No</th>             <th>Allocation From Date</th>             <th>Allocation to Date</th>         </tr>"; // Loop through car numbers foreach ($carNumbers as $carNumber) {     // If the car number is different from the previous one, increment serial number     if ($carNumber !== $prevCarNumber) {         $prevCarNumber = $carNumber;         echo "<tr><td>$serialNumber</td><td>$carNumber</td><td>01-04-2024 15:00</td><td>12-04-2024 15:00</td></tr>";         $serialNumber++;     } else {         // If the car numb

missing date with current days

 <?php $dateRanges = array(   array('from' => '2024-04-01', 'to' => '2024-04-05'),   array('from' => '2024-04-10', 'to' => '2024-04-15'),   array('from' => '2024-04-20', 'to' => '2024-04-22 '),   // Add more date ranges as needed ); function calculateMissingDays($dateRanges) {   $missingDays = array();   // Get the maximum date from the date ranges   $maxDate = null;   foreach ($dateRanges as $range) {     $to = new DateTime($range['to']);     if ($maxDate === null || $to > $maxDate) {       $maxDate = $to;     }   }   // Get the current date   $currentDate = new DateTime();   foreach ($dateRanges as $index => $range) {     $from = new DateTime($range['from']);     $to = new DateTime($range['to']);     if ($index > 0) {       $prevTo = new DateTime($dateRanges[$index - 1]['to']);       $diff = $prevTo->diff($from)->days;    

Missing Days only

 <?php $dateRanges = array(     array('from' => '2024-04-01 03:00 PM', 'to' => '2024-04-05 03:00 PM'),     array('from' => '2024-04-10 03:00 PM', 'to' => '2024-04-15 03:00 PM'),     array('from' => '2024-04-20 03:00 PM', 'to' => '2024-04-22 03:00 PM'),     // Add more date ranges as needed ); function calculateMissingDays($dateRanges) {     $missingDays = array();     foreach ($dateRanges as $index => $range) {         $from = new DateTime($range['from']);         $to = new DateTime($range['to']);                  if ($index > 0) {             $prevTo = new DateTime($dateRanges[$index - 1]['to']);             $diff = $prevTo->diff($from)->days;             for ($i = 1; $i < $diff; $i++) {                 $missingDays[] = $prevTo->modify('+1 day')->format('Y-m-d h:i A');             }         }     }          re
 // Replace 'YOUR_API_KEY' with your actual API key const apiKey = 'YOUR_API_KEY'; // Function to authenticate and log in an agent async function loginAgent(username, password) {     try {         const response = await fetch('https://api.ziwo.io/v1/auth/login', {             method: 'POST',             headers: {                 'Content-Type': 'application/json',                 'Authorization': `Bearer ${apiKey}`             },             body: JSON.stringify({                 username: username,                 password: password             })         });         if (!response.ok) {             throw new Error('Login failed');         }         const data = await response.json();         const authToken = data.token;         console.log('Agent logged in successfully:', authToken);         return authToken;     } catch (error) {         console.error('Error logging in agent:', error);         return nu
 // Replace 'YOUR_API_KEY' with your actual API key const apiKey = 'YOUR_API_KEY'; // Function to make a call using Ziwo API async function makeCall(toNumber, fromNumber) {     try {         const response = await fetch('https://api.ziwo.io/v1/calls', {             method: 'POST',             headers: {                 'Content-Type': 'application/json',                 'Authorization': `Bearer ${apiKey}`             },             body: JSON.stringify({                 to: toNumber,                 from: fromNumber,                 // Additional parameters can be added here, such as custom caller ID, etc.             })         });                  if (!response.ok) {             throw new Error('Failed to make call');         }                  const data = await response.json();         console.log('Call successfully initiated:', data);     } catch (error) {         console.error('Error making call:', er