Posts

 // 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
 <!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>Ziwo Integration</title> </head> <body>     <!-- Include Ziwo JavaScript SDK -->     <script src="https://cdn.ziwo.io/sdk/ziwo.min.js"></script>     <!-- Your other HTML content goes here -->     <script>         // Initialize Ziwo client with your API key         const ziwoClient = new Ziwo.Client('YOUR_API_KEY');         // Example: Make a call         ziwoClient.call.makeCall('TO_PHONE_NUMBER', 'FROM_PHONE_NUMBER');         // Example: Send an SMS         ziwoClient.sms.send('TO_PHONE_NUMBER', 'MESSAGE_CONTENT');         // Example: Listen for incoming calls         ziwoClient.on('callIncoming', (call) => {             // Handle incoming call        
 <?php // Sample data $bookings = array(     array("car_no" => 1234, "surved_car" => 1234, "allocation_from_date" => "20-02-2024 10:00", "allocation_to_date" => "20-03-2024 12:00", "lease_start_date" => "20-02-2024", "lease_end_date" => "20-02-2025", "type" => "allocated"),     array("car_no" => 1234, "surved_car" => 3856, "allocation_from_date" => "28-03-2024 10:00", "allocation_to_date" => "27-04-2024 12:00", "lease_start_date" => "28-03-2024", "lease_end_date" => "28-03-2025", "type" => "replaced"),     array("car_no" => 6989, "surved_car" => 3856, "allocation_from_date" => "21-01-2024 10:00", "allocation_to_date" => "21-02-2024 12:00&qu
 <?php // Sample data $bookings = array(     array("car_no" => 1234, "surved_car" => 1234, "allocation_from_date" => "20-02-2024 10:00", "allocation_to_date" => "20-03-2024 12:00", "lease_start_date" => "20-02-2024", "lease_end_date" => "20-02-2025", "type" => "allocated"),     array("car_no" => 1234, "surved_car" => 3856, "allocation_from_date" => "28-03-2024 10:00", "allocation_to_date" => "27-04-2024 12:00", "lease_start_date" => "28-03-2024", "lease_end_date" => "28-03-2025", "type" => "replaced"),     array("car_no" => 6989, "surved_car" => 6989, "allocation_from_date" => "21-01-2024 10:00", "allocation_to_date" => "21-02-2024 12:00&qu
 <?php // Database connection parameters $servername = "localhost"; $username = "username"; $password = "password"; $database = "your_database"; // Create connection $conn = new mysqli($servername, $username, $password, $database); // Check connection if ($conn->connect_error) {     die("Connection failed: " . $conn->connect_error); } // Select all records from tbl_booking_details $sql = "SELECT tbl_booking_details_primary_id, actual_end_date FROM tbl_booking_details"; $result = $conn->query($sql); if ($result->num_rows > 0) {     // Loop through each row in tbl_booking_details     while ($row = $result->fetch_assoc()) {         $booking_id = $row['tbl_booking_details_primary_id'];         $actual_end_date = $row['actual_end_date'];         // Check if actual_end_date is different in tbl_booked_car_details         $check_sql = "SELECT allocation_to_date FROM tbl_booked_car_details WHER
 <?php function getTotalDays($from_date, $to_date) {     // Define the current date     $current_date = time(); // Current Unix timestamp     // Convert provided dates to Unix timestamps     $from_date_timestamp = strtotime($from_date);     $to_date_timestamp = strtotime($to_date);     // If To date is greater than current date, set it to current date     if ($to_date_timestamp > $current_date) {         $to_date_timestamp = $current_date;     }     // Calculate the total days between From date and adjusted To date     $total_days = floor(($to_date_timestamp - $from_date_timestamp) / (60 * 60 * 24)) + 1; // Add 1 to include both From date and To date     return $total_days; } // Example usage $from_date = '20-03-2024'; $to_date = '30-05-2024'; $total_days = getTotalDays($from_date, $to_date); echo "Total days between From date and adjusted To date: " . $total_days . " days.\n"; ?>