<!doctype html>
<html lang="en" class="w-[640px]">
   <head>
   <?php echo view('user/layout/head');?>
   <link rel="stylesheet" href="https://code.jquery.com/ui/1.13.3/themes/base/jquery-ui.css">
   </head>
   <style>
       .pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    }
    .pagination-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin: 0 5px;
    }
    .pagination-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    }
    #pageInfo {
    align-self: center;
    margin: 0 10px;
    color:#fff;
    }
    .pagination1 {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    }
   
    #pageInfo1 {
    align-self: center;
    margin: 0 10px;
    }
    .pagination2 {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    }
   
    #pageInfo2 {
    align-self: center;
    margin: 0 10px;
    }
    .pagination3 {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    }
   
    #pageInfo3 {
    align-self: center;
    margin: 0 10px;
    }
    .form-control
      {
        background:#e9e9ed !important;
        color:#000 !important;
      }
      .modal-backdrop { --bs-backdrop-zindex:none;}
      .accordion-toggle
      {
         background:rgb(22, 22, 75) !important;
         border-radius:10px !important;
         border:1px solid #fff;
      }
      @media only screen and (max-width:320px) {
  .referral {
    height: 65vh !important;
  }
}

/* For screens between 391px and 432px */
@media only screen and (min-width: 321px) and (max-width: 432px) {
  .referral {
    height: 76vh !important;
  }
}
     
   </style>
   <body class="section-overflow">
      <!--banner start -->
      <section class="banner-bg overall-bg ">
         <div class="container">
         <?php echo view('user/layout/header');?>
         </div>
         <section class="dash-wrap referral">
            <div class="container">
               <div class="team-tab">
                  <ul class="nav nav-pills d-flex justify-content-center ps-0" id="pills-tab" role="tablist">
                     <li class="nav-item" role="presentation">
                        <button class="nav-link" id="pills-dep1-tab" data-bs-toggle="pill" data-bs-target="#pills-dep1"
                        type="button" role="tab" aria-controls="pills-dep1" aria-selected="false" onclick="all_transaction()" >
                           <div class="make-list">
                              <div class="process">
                                 <span>All</span>
                              </div>
                           </div>
                        </button>
                     </li>
                     <li class="nav-item" role="presentation">
                        <button class="nav-link" id="pills-dep2-tab" data-bs-toggle="pill" data-bs-target="#pills-dep2"
                           type="button" role="tab" aria-controls="pills-dep2" aria-selected="false" onclick="revenue()">
                           <div class="make-list">
                              <div class="process">
                                 <span>Trade Profit</span>
                              </div>
                           </div>
                        </button>
                     </li>
                     <!--<li class="nav-item" role="presentation">
                        <button class="nav-link" id="pills-dep3-tab" data-bs-toggle="pill" data-bs-target="#pills-dep3"
                           type="button" role="tab" aria-controls="pills-dep3" aria-selected="true"  onclick="rank_bonus()">
                           <div class="make-list">
                              <div class="process">
                                 <span>Rank Bonus</span>
                              </div>
                           </div>
                        </button>
                     </li>-->
                     <li class="nav-item" role="presentation">
                        <button class="nav-link" id="pills-dep4-tab" data-bs-toggle="pill" data-bs-target="#pills-dep4"
                           type="button" role="tab" aria-controls="pills-dep4" aria-selected="true"  onclick="gas_bonus()">
                           <div class="make-list">
                              <div class="process">
                                 <span>Gas Bonus</span>
                              </div>
                           </div>
                        </button>
                     </li>
                  </ul>
                  <div class="tab-content" id="pills-tabContent">
                     <div class="tab-pane fade" id="pills-dep1" role="tabpanel" aria-labelledby="pills-dep1-tab">

                     <?php 
                           use App\Libraries\MyEncrypt;
                           use App\Helpers\site_helper;
                           use App\Helpers\form_helper;
                           $this->db = db_connect();
                           $this->session = session();
                           $this->common_model = model('CommonModel');
                           helper('form_helper');
                           
                           
                           $id = 'NyYmemh5aXA=';
                                    
                           $myencrypt = new MyEncrypt;
                           $coinid = $myencrypt->decode($id);
                           $user=$this->session->get('uusersid');
                           $buy_bal=curbalance($this->session->get('uusersid'),$coinid);
                           $bal=str_replace(",","", $buy_bal);
                           
                        ?>

                     <div class="row" style="margin-top:15px;margin-bottom:15px">
                        <div class="col-12">
                           <div class="quantify-header d-flex align-items-center text-white justify-content-between">
                              <div class="trade-content ms-2">
                                 <h6 class="text-white fw-semibold aleo mb-0 align-items-center">
                                 <span id="total_count"> <?php echo $total_count;?> </span> Records
                              </div>
                              <div class="repeat-icon d-flex align-items-center">
                                 <a data-bs-toggle="modal" data-bs-target="#staticBackdrop1" data-bs-whatever="@fat" class="text-decoration-none">
                                 <i class="fa fa-filter" id="balance_load" ></i>
                                 </a>
                              </div>
                           </div>
                        </div>
                     </div>

                     <div class="modal fade" id="staticBackdrop1" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" style="display: none;" aria-hidden="true">
                        <div class="modal-dialog modal-dialog-centered" role="document">
                           <div class="modal-content" style="border-radius:30px;padding: 11px;" >
                           <div class="modal-header" style="padding-top: 11px;margin-bottom:-15px;">
                              <p class="modal-title" id="staticBackdropLabel" style="padding-left:170px;"><b>Records Filter</b></p>
                              <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                           </div>
                           <div class="modal-body">
                              <div class="row col-lg-12 mt-3">
                                 <div class="form-check form-check-right mb-3" style="font-size: 14px;">
                                 <div class="form-group">
                                    <label class="btn btn-default">Start Date</label>
                                    <input type="text" name="start_date" id="start_date" class="form-control" required>
                                 </div>
                                 <div class="form-group">
                                    <label class="btn btn-default">End Date</label>
                                    <input type="text" name="end_date" id="end_date" class="form-control" required>
                                 </div>
                                 <div id="date_err" style="color:red;font-size:12px;font-weight:bold;"></div>

                                 <div class="form-group">
                                    <label class="btn btn-default">Select Mode</label>
                                    <select class="form-control" name="his_type" id="his_type">
                                       <option value="">ALL</option>
                                       <option value="deposit">Deposit</option>
                                       <option value="commissions">Commission</option>
                                       <option value="activation">Activation</option>
                                       <option value="bonus">Bonus</option>
                                       <option value="penality">Penality</option>
                                       <option value="fund_transfer">Fund Transfer</option>
                                       <option value="fund_received">Fund Receive</option>
                                       <option value="transfer_gaswallet">Gaswallet Earning</option>
                                       <option value="deduct_gaswallet">Gaswallet Deduction</option>
                                       <option value="withdraw_request">Withdraw Requested</option>
                                       <option value="withdrawal">Withdrawal</option>
                                       <option value="withdraw_fee">Withdrawal Fee</option>
                                       <option value="transfer_fee">Transfer Fee</option>
                                 
                                    </select>
                                 </div>

                                 </div>
                              </div>
                           </div>
                           <div class="modal-footer" >
                              <button  type="button" class="btn btn-secondary" name="button"  id="confirm">Search</button>
                              <button  type="button" class="btn btn-secondary" name="button"  id="reset">Reset</button>
                           </div>
                           </div>
                        </div>
                     </div>

                     <div class="table-responsive trans asset-trans position-relative mb-5">
                     
                        <table class="payment-info">
                           <tbody id="myItems">
                           <?php 
                              $i=0;
                              if ($records) 
                              {
                              foreach ($records as $value) 
                              {
                                 
                                 $type=str_replace('_',' ',$value->type);
                                 $type=ucwords($type);
                              $i++;
                              
                                if($type == 'activation')
                                {
                                    $amount = "0";
                                }
                                else
                                {
                                    $amount = $value->amount;
                                }
                              ?>
                              <tr>
                                 <td>
                                    <div class="asset-trans-content d-flex align-items-center justify-content-between">
                                       <div class="asset-trans-left text-start">
                                          <h6 class="aleo text-white mb-0"><?php echo $type;?></h6>
                                          <small class="text-primary fs-6 py-2 fw-bold lato"><?php echo $value->date;?></small>
                                          <h6 class="fw-medium fs-6 mb-0"><?php echo $value->description;?></h6>
                                       </div>
                                       <div class="asset-trans-right text-end">
                                          <small class="text-primary lato fw-bold ">+ <?php echo number_format($amount,4);?></small>
                                          
                                       </div>
                                    </div>
                                 </td>
                              </tr>
                              <?php } }?>
                           </tbody>
                        </table>

                       

                        
                     </div>

                     <div class="pagination"  style="margin-bottom:15px">
                        <button id="prevPage" class="pagination-btn" onclick="changePage('prev')">« Previous</button>
                        <span id="pageInfo"></span>
                        <button id="nextPage" class="pagination-btn" onclick="changePage('next')">Next »</button>
                     </div>
                     
                       <p style="color:#fff;"><b>*Trade Pilot by Aqua-X*:</b> Our mission is to empower investors by optimizing their profit potential, even during times when they are busy, asleep, or occupied with other commitments. 
            Our cutting-edge platform ensures seamless and efficient trading, enabling investors to achieve consistent results without constant monitoring.</p>
            <div style="clear:both;height:40px;"><br></div>
                     
                                      

               
                     </div>

                     <div class="tab-pane fade " id="pills-dep2" role="tabpanel" aria-labelledby="pills-dep2-tab">
                        <?php 

                        $this->db = db_connect();
                        $this->session = session();
                        $this->common_model = model('CommonModel');
                        helper('form_helper');
                        
                        
                        $id = 'NyYmemh5aXA=';
                              
                        $myencrypt = new MyEncrypt;
                        $coinid = $myencrypt->decode($id);
                        $user=$this->session->get('uusersid');
                        $buy_bal=curbalance($this->session->get('uusersid'),$coinid);
                        $bal=str_replace(",","", $buy_bal);
                        
                        if(!empty($datewis_profit_count))
                        $datewis_profit_count=$datewis_profit_count;
                        else
                        $datewis_profit_count=0;
                        ?>
                    
                        <div class="row" style="margin-top:15px">
                           
                           <div class="col-6">
                              <div class="team-list">
                                 <p class="fw-light text-white-50 mb-0">Today's total Profit(USDT)</p>
                                 <h5 class="fw-bold text-white"> <?php echo  number_format($today_profit,8); ?> USDT</h5>
                              </div>
                           </div>
                           <div class="col-6">
                              <div class="team-list">
                                 <p class="fw-light text-white-50 mb-0">Cumulative profit(USDT)</p>
                                 <h5 class="fw-bold text-white"><?php echo  number_format($total_profit,8); ?> USDT</h5>
                              </div>
                           </div>
                        </div>

                        <div class="row" style="margin-top:15px;margin-bottom:15px">
                        <div class="col-12">
                           <div class="quantify-header d-flex align-items-center text-white justify-content-between">
                              <div class="trade-content ms-2">
                                 <h6 class="text-white fw-semibold aleo mb-0 align-items-center">
                                 <span id="total_count1"> <?php echo $datewis_profit_count;?> </span> Records 
                              </div>
                              <div class="repeat-icon d-flex align-items-center">
                                 <a data-bs-toggle="modal" data-bs-target="#staticBackdrop2" data-bs-whatever="@fat" class="text-decoration-none">
                                 <i class="fa fa-filter" id="balance_load" ></i>
                                 </a>
                              </div>
                           </div>
                        </div>
                     </div>

                     <div class="modal fade" id="staticBackdrop2" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" style="display: none;" aria-hidden="true">
                        <div class="modal-dialog modal-dialog-centered" role="document">
                           <div class="modal-content" style="border-radius:30px;padding: 11px;" >
                              <div class="modal-header" style="padding-top: 11px;margin-bottom:-15px;">
                                 <p class="modal-title" id="staticBackdropLabel" style="padding-left:170px;"><b>Records Filter</b></p>
                                 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                              </div>
                              <div class="modal-body">
                                 <div class="row col-lg-12 mt-3">
                                    <div class="form-check form-check-right mb-3" style="font-size: 14px;">
                                       <div class="form-group">
                                          <label class="btn btn-default">Start Date</label>
                                          <input type="text" name="start_date" id="start_date1" class="form-control" required>
                                       </div>
                                       <div class="form-group">
                                          <label class="btn btn-default">End Date</label>
                                          <input type="text" name="end_date" id="end_date1" class="form-control" required>
                                       </div>
                                       <div id="date_err1" style="color:red;font-size:12px;font-weight:bold;"></div>
                                    </div>
                                 </div>
                              </div>
                              <div class="modal-footer" >
                                 <button  type="button" class="btn btn-secondary" name="button"  id="confirm1">Search</button>
                                 <button  type="button" class="btn btn-secondary" name="button"  id="reset1">Reset</button>
                              </div>
                           </div>
                        </div>
                     </div>


                     <div class="profit-content" id="myItems1">
                        <?php 
                           $i=0;
                           if (!empty($datewis_profit)) {
                            foreach ($datewis_profit as $value) 
                            {
                                $profit=$this->db->query("select sum(comm_price) as profit from `api_trade_history` where date='".$value->date."' and uuserid = '".$user."' AND `type` = '2'  ORDER BY `id` DESC")->getRow();
                                if($profit)
                                {
                                    $profit_amount=$profit->profit;
                                }
                                else
                                {
                                    $profit_amount='0';
                                }
                                
                             $i++;
                             ?>
                        <div class="faq_accordian mb-3"  >
                           <div class="accordion">
                              <div class="row">
                                 <div class="col-md-10 offset-md-1">
                                    <div class="team-right accordion-toggle " style="">
                                       <ul class="mb-0 mt-0 asset-user-static  list-unstyled" style="">
                                          <li>
                                             <a class="text-white" href="<?php echo base_url();?>/profit_details/<?php echo date('d-M-Y',strtotime($value->date));?>">
                                                <p class="text-white-50 mb-0" style="align-content:center">Date</p>
                                                <b class="text-white"><?php echo date('d-M-Y',strtotime($value->date));?></b>
                                             </a>
                                          </li>
                                          <li>
                                             <a class="text-white" href="<?php echo base_url();?>/profit_details/<?php echo date('d-M-Y',strtotime($value->date));?>">
                                                <p class="text-white-50 mb-0">Total Profit</p>
                                                <b class="text-white"><?php echo number_format($profit_amount,4); ?></b>
                                             </a>
                                          </li>
                                          <li style="margin-top:10px">
                                             <b ><a class="text-white " href="<?php echo base_url();?>/profit_details/<?php echo date('d-M-Y',strtotime($value->date));?>"><i class="fa-solid fa-greater-than"></i></a></b>
                                          </li>
                                       </ul>
                                    </div>
                                 </div>
                              </div>
                           </div>
                        </div>
                        <?php } }?>
                     </div>

                     <div class="pagination1"  style="margin-bottom:15px">
                        <button id="prevPage1" class="pagination-btn" onclick="changePage1('prev')">« Previous</button>
                        <span id="pageInfo1" class="text-white"></span>
                        <button id="nextPage1" class="pagination-btn" onclick="changePage1('next')">Next »</button>
                     </div>
                          <p style="color:#fff;"><b>*Trade Pilot by Aqua-X*:</b> Our mission is to empower investors by optimizing their profit potential, even during times when they are busy, asleep, or occupied with other commitments. 
            Our cutting-edge platform ensures seamless and efficient trading, enabling investors to achieve consistent results without constant monitoring.</p>
            <div style="clear:both;height:40px;"><br></div>
                                                           


                     </div>

                     <div class="tab-pane fade " id="pills-dep3" role="tabpanel" aria-labelledby="pills-dep3-tab">
                     
                     <?php 

                        $this->db = db_connect();
                        $this->session = session();
                        $this->common_model = model('CommonModel');
                        helper('form_helper');


                        $id = 'NyYmemh5aXA=';
                              
                        $myencrypt = new MyEncrypt;
                        $coinid = $myencrypt->decode($id);
                        $user=$this->session->get('uusersid');
                        $buy_bal=curbalance($this->session->get('uusersid'),$coinid);
                        $bal=str_replace(",","", $buy_bal);

                        if(!empty($datewis_profit_count))
                        $datewis_profit_count=$datewis_profit_count;
                        else
                        $datewis_profit_count=0;

                        $today = date('Y-m-d'); // Get today's date in 'YYYY-MM-DD' format

                        // Query to calculate the sum of the 'amount' column for today
                        $query  = $this->db->table('history')
                           ->selectSum('amount')
                           ->where('uusersid', $user) // Assuming `uuserid` is an integer
                           ->where('DATE(date)', $today) // Assuming `date` column stores the date in a datetime format
                           ->where('type', 'commissions')
                           ->like('description', 'Rank Activation') 
                           ->get();

                           $todaytotalAmount = ($query && $query->getRow() && isset($query->getRow()->amount)) ? $query->getRow()->amount : 0;
                          

                           $query1 = $this->db->table('history')
                           ->selectSum('amount')
                           ->where('uusersid', $user) // Assuming `uuserid` is an integer
                           ->where('type', 'commissions')
                           ->like('description', 'Rank Activation') 
                           ->get();

                           $totalAmount = ($query1 && $query1->getRow() && isset($query1->getRow()->amount)) ? $query1->getRow()->amount : 0;
                           

                        ?>

                        <div class="row" style="margin-top:15px">
                           
                           <div class="col-6">
                              <div class="team-list">
                                 <p class="fw-light text-white-50 mb-0">Today's total Rank Profit(USDT)</p>
                                 <h5 class="fw-bold text-white"> <?php echo  number_format($todaytotalAmount,8); ?> USDT</h5>
                              </div>
                           </div>
                           <div class="col-6">
                              <div class="team-list">
                                 <p class="fw-light text-white-50 mb-0">Cumulative Rank Profit(USDT)</p>
                                 <h5 class="fw-bold text-white"><?php echo  number_format($totalAmount,8); ?> USDT</h5>
                              </div>
                           </div>
                        </div>

                        <div class="row" style="margin-top:15px;margin-bottom:15px">
                        <div class="col-12">
                           <div class="quantify-header d-flex align-items-center text-white justify-content-between">
                              <div class="trade-content ms-2">
                                 <h6 class="text-white fw-semibold aleo mb-0 align-items-center">
                                 <span id="total_count2"> <?php echo $datewis_profit_count;?> </span> Records 
                              </div>
                              <div class="repeat-icon d-flex align-items-center">
                                 <a data-bs-toggle="modal" data-bs-target="#staticBackdrop3" data-bs-whatever="@fat" class="text-decoration-none">
                                 <i class="fa fa-filter" id="balance_load" ></i>
                                 </a>
                              </div>
                           </div>
                        </div>
                        </div>

                        <div class="modal fade" id="staticBackdrop3" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" style="display: none;" aria-hidden="true">
                        <div class="modal-dialog modal-dialog-centered" role="document">
                           <div class="modal-content" style="border-radius:30px;padding: 11px;" >
                              <div class="modal-header" style="padding-top: 11px;margin-bottom:-15px;">
                                 <p class="modal-title" id="staticBackdropLabel" style="padding-left:170px;"><b>Records Filter</b></p>
                                 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                              </div>
                              <div class="modal-body">
                                 <div class="row col-lg-12 mt-3">
                                    <div class="form-check form-check-right mb-3" style="font-size: 14px;">
                                       <div class="form-group">
                                          <label class="btn btn-default">Start Date</label>
                                          <input type="text" name="start_date" id="start_date2" class="form-control" required>
                                       </div>
                                       <div class="form-group">
                                          <label class="btn btn-default">End Date</label>
                                          <input type="text" name="end_date" id="end_date2" class="form-control" required>
                                       </div>
                                       <div id="date_err2" style="color:red;font-size:12px;font-weight:bold;"></div>
                                    </div>
                                 </div>
                              </div>
                              <div class="modal-footer" >
                                 <button  type="button" class="btn btn-secondary" name="button"  id="confirm2">Search</button>
                                 <button  type="button" class="btn btn-secondary" name="button"  id="reset2">Reset</button>
                              </div>
                           </div>
                        </div>
                        </div>


                        <div class="profit-content" id="myItems2">
                        <?php 
                           $i=0;
                           if (!empty($datewis_profit)) {
                           foreach ($datewis_profit as $value) 
                           {
                              $profit=$this->db->query("select sum(comm_price) as profit from `api_trade_history` where date='".$value->date."' and uuserid = '".$user."' AND `type` = '2'  ORDER BY `id` DESC")->getRow();
                              if($profit)
                              {
                                    $profit_amount=$profit->profit;
                              }
                              else
                              {
                                    $profit_amount='0';
                              }
                              
                           $i++;
                           ?>
                        <div class="faq_accordian mb-3"  >
                           <div class="accordion">
                              <div class="row">
                                 <div class="col-md-10 offset-md-1">
                                    <div class="team-right accordion-toggle " style="">
                                       <ul class="mb-0 mt-0 asset-user-static  list-unstyled" style="">
                                          <li>
                                             <a class="text-white" href="<?php echo base_url();?>/profit_details/<?php echo date('d-M-Y',strtotime($value->date));?>">
                                                <p class="text-white-50 mb-0" style="align-content:center">Date</p>
                                                <b class="text-white"><?php echo date('d-M-Y',strtotime($value->date));?></b>
                                             </a>
                                          </li>
                                          <li>
                                             <a class="text-white" href="<?php echo base_url();?>/profit_details/<?php echo date('d-M-Y',strtotime($value->date));?>">
                                                <p class="text-white-50 mb-0">Total Profit</p>
                                                <b class="text-white"><?php echo number_format($profit_amount,4); ?></b>
                                             </a>
                                          </li>
                                          <li style="margin-top:10px">
                                             <b ><a class="text-white " href="<?php echo base_url();?>/profit_details/<?php echo date('d-M-Y',strtotime($value->date));?>"><i class="fa-solid fa-greater-than"></i></a></b>
                                          </li>
                                       </ul>
                                    </div>
                                 </div>
                              </div>
                           </div>
                        </div>
                        <?php } }?>
                        </div>

                        <div class="pagination2"  style="margin-bottom:15px">
                        <button id="prevPage2" class="pagination-btn" onclick="changePage2('prev')">« Previous</button>
                        <span id="pageInfo2" class="text-white"></span>
                        <button id="nextPage2" class="pagination-btn" onclick="changePage2('next')">Next »</button>
                        </div>
                        
                          <p style="color:#fff;"><b>*Trade Pilot by Aqua-X*:</b> Our mission is to empower investors by optimizing their profit potential, even during times when they are busy, asleep, or occupied with other commitments. 
            Our cutting-edge platform ensures seamless and efficient trading, enabling investors to achieve consistent results without constant monitoring.</p>
            <div style="clear:both;height:40px;"><br></div>
                                                             


                     </div>


                     <div class="tab-pane fade " id="pills-dep4" role="tabpanel" aria-labelledby="pills-dep4-tab">

                     <?php 

                        $this->db = db_connect();
                        $this->session = session();
                        $this->common_model = model('CommonModel');
                        helper('form_helper');


                        $id = 'NyYmemh5aXA=';
                              
                        $myencrypt = new MyEncrypt;
                        $coinid = $myencrypt->decode($id);
                        $user=$this->session->get('uusersid');
                        $buy_bal=curbalance($this->session->get('uusersid'),$coinid);
                        $bal=str_replace(",","", $buy_bal);

                        if(!empty($datewis_profit_count))
                        $datewis_profit_count=$datewis_profit_count;
                        else
                        $datewis_profit_count=0;

                        $today = date('Y-m-d'); // Get today's date in 'YYYY-MM-DD' format

                        // Query to calculate the sum of the 'amount' column for today
                        $query  = $this->db->table('history')
                           ->selectSum('amount')
                           ->where('uusersid', $user) // Assuming `uuserid` is an integer
                           ->where('DATE(date)', $today) // Assuming `date` column stores the date in a datetime format
                           ->where('type', 'commissions')
                           ->like('description', 'Gas Wallet') 
                           ->get();

                           $todaytotalAmount1 = ($query && $query->getRow() && isset($query->getRow()->amount)) ? $query->getRow()->amount : 0;
                        

                           $query1 = $this->db->table('history')
                           ->selectSum('amount')
                           ->where('uusersid', $user) // Assuming `uuserid` is an integer
                           ->where('type', 'commissions')
                           ->like('description', 'Gas Wallet') 
                           ->get();

                           $totalAmount1 = ($query1 && $query1->getRow() && isset($query1->getRow()->amount)) ? $query1->getRow()->amount : 0;
                           

                        ?>

                        <div class="row" style="margin-top:15px">
                           
                           <div class="col-6">
                              <div class="team-list">
                                 <p class="fw-light text-white-50 mb-0">Today's total Rank Profit(USDT)</p>
                                 <h5 class="fw-bold text-white"> <?php echo  number_format($todaytotalAmount1,8); ?> USDT</h5>
                              </div>
                           </div>
                           <div class="col-6">
                              <div class="team-list">
                                 <p class="fw-light text-white-50 mb-0">Cumulative Rank Profit(USDT)</p>
                                 <h5 class="fw-bold text-white"><?php echo  number_format($totalAmount1,8); ?> USDT</h5>
                              </div>
                           </div>
                        </div>

                        <div class="row" style="margin-top:15px;margin-bottom:15px">
                        <div class="col-12">
                           <div class="quantify-header d-flex align-items-center text-white justify-content-between">
                              <div class="trade-content ms-2">
                                 <h6 class="text-white fw-semibold aleo mb-0 align-items-center">
                                 <span id="total_count3"> <?php echo $datewis_profit_count;?> </span> Records 
                              </div>
                              <div class="repeat-icon d-flex align-items-center">
                                 <a data-bs-toggle="modal" data-bs-target="#staticBackdrop4" data-bs-whatever="@fat" class="text-decoration-none">
                                 <i class="fa fa-filter" id="balance_load" ></i>
                                 </a>
                              </div>
                           </div>
                        </div>
                        </div>

                        <div class="modal fade" id="staticBackdrop4" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" style="display: none;" aria-hidden="true">
                        <div class="modal-dialog modal-dialog-centered" role="document">
                           <div class="modal-content" style="border-radius:30px;padding: 11px;" >
                              <div class="modal-header" style="padding-top: 11px;margin-bottom:-15px;">
                                 <p class="modal-title" id="staticBackdropLabel" style="padding-left:170px;"><b>Records Filter</b></p>
                                 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                              </div>
                              <div class="modal-body">
                                 <div class="row col-lg-12 mt-3">
                                    <div class="form-check form-check-right mb-3" style="font-size: 14px;">
                                       <div class="form-group">
                                          <label class="btn btn-default">Start Date</label>
                                          <input type="text" name="start_date" id="start_date3" class="form-control" required>
                                       </div>
                                       <div class="form-group">
                                          <label class="btn btn-default">End Date</label>
                                          <input type="text" name="end_date" id="end_date3" class="form-control" required>
                                       </div>
                                       <div id="date_err3" style="color:red;font-size:12px;font-weight:bold;"></div>
                                    </div>
                                 </div>
                              </div>
                              <div class="modal-footer" >
                                 <button  type="button" class="btn btn-secondary" name="button"  id="confirm3">Search</button>
                                 <button  type="button" class="btn btn-secondary" name="button"  id="reset3">Reset</button>
                              </div>
                           </div>
                        </div>
                        </div>


                        <div class="profit-content" id="myItems3">
                        <?php 
                           $i=0;
                           if (!empty($datewis_profit)) {
                           foreach ($datewis_profit as $value) 
                           {
                              $profit=$this->db->query("select sum(comm_price) as profit from `api_trade_history` where date='".$value->date."' and uuserid = '".$user."' AND `type` = '2'  ORDER BY `id` DESC")->getRow();
                              if($profit)
                              {
                                    $profit_amount=$profit->profit;
                              }
                              else
                              {
                                    $profit_amount='0';
                              }
                              
                           $i++;
                           ?>
                        <div class="faq_accordian mb-3"  >
                           <div class="accordion">
                              <div class="row">
                                 <div class="col-md-10 offset-md-1">
                                    <div class="team-right accordion-toggle " style="">
                                       <ul class="mb-0 mt-0 asset-user-static  list-unstyled" style="">
                                          <li>
                                             <a class="text-white" href="<?php echo base_url();?>/profit_details/<?php echo date('d-M-Y',strtotime($value->date));?>">
                                                <p class="text-white-50 mb-0" style="align-content:center">Date</p>
                                                <b class="text-white"><?php echo date('d-M-Y',strtotime($value->date));?></b>
                                             </a>
                                          </li>
                                          <li>
                                             <a class="text-white" href="<?php echo base_url();?>/profit_details/<?php echo date('d-M-Y',strtotime($value->date));?>">
                                                <p class="text-white-50 mb-0">Total Profit</p>
                                                <b class="text-white"><?php echo number_format($profit_amount,4); ?></b>
                                             </a>
                                          </li>
                                          <li style="margin-top:10px">
                                             <b ><a class="text-white " href="<?php echo base_url();?>/profit_details/<?php echo date('d-M-Y',strtotime($value->date));?>"><i class="fa-solid fa-greater-than"></i></a></b>
                                          </li>
                                       </ul>
                                    </div>
                                 </div>
                              </div>
                           </div>
                        </div>
                        <?php } }?>
                        </div>

                        <div class="pagination3"  style="margin-bottom:15px">
                        <button id="prevPage3" class="pagination-btn" onclick="changePage2('prev')">« Previous</button>
                        <span id="pageInfo3" class="text-white"></span>
                        <button id="nextPage3" class="pagination-btn" onclick="changePage2('next')">Next »</button>
                        </div>
                        
                          <p style="color:#fff;"><b>*Trade Pilot by Aqua-X*:</b> Our mission is to empower investors by optimizing their profit potential, even during times when they are busy, asleep, or occupied with other commitments. 
            Our cutting-edge platform ensures seamless and efficient trading, enabling investors to achieve consistent results without constant monitoring.</p>
            <div style="clear:both;height:40px;"><br></div>
                                                                  

                     </div>

                    
                     <!---banner end---->
                  </div>
               </div>
            </div>
         </section>
         <!--footer start -->
         <?php echo view('user/layout/footer');?>

         <!--footer end -->
      </section>
     
      <?php echo view('user/layout/footer-script');?>
      <script src="https://code.jquery.com/jquery-3.7.1.js"></script>
      <script src="https://code.jquery.com/ui/1.13.3/jquery-ui.js"></script>
      <script>
         AOS.init({
         });
      </script>

    <script>
      $( function() {
             $( "#start_date").datepicker({
                 dateFormat: 'yy-mm-dd'
             });
               $( "#end_date").datepicker({
                 dateFormat: 'yy-mm-dd'
             });

             $( "#start_date1").datepicker({
                    dateFormat: 'yy-mm-dd'
                });
                  $( "#end_date1").datepicker({
                    dateFormat: 'yy-mm-dd'
                });
                $( "#start_date2").datepicker({
                    dateFormat: 'yy-mm-dd'
                });
                  $( "#end_date2").datepicker({
                    dateFormat: 'yy-mm-dd'
                });
                $( "#start_date3").datepicker({
                    dateFormat: 'yy-mm-dd'
                });
                  $( "#end_date3").datepicker({
                    dateFormat: 'yy-mm-dd'
                });
         } );

   let currentPage = 1;
   const itemsPerPage = 10; // Number of items per page
   let totalPages =1;
   let start_date='';
   let end_date='';
   let type='';

   function all_transaction()
   {
   
      loadPage(currentPage, start_date, end_date, type);
   }

   let currentPage1 = 1;
   const itemsPerPage1 = 10; // Number of items per page
   let totalPages1 =1;
   let start_date1='';
   let end_date1='';    
   // document.addEventListener('DOMContentLoaded', function() {
   //    loadPage(currentPage,start_date,end_date,type);
   //    });

   document.addEventListener('DOMContentLoaded', function () {
    // Get the URL parameters
    const params = new URLSearchParams(window.location.search);
    const tab = params.get('tab'); // Get the 'tab' parameter

  
    if (tab === 'alltransaction') {
      

        // Select the target tab and content
        const targetTab = document.querySelector('#pills-dep1-tab');
        const targetContent = document.querySelector('#pills-dep1');

   

        if (targetTab && targetContent) {
           

            // Remove 'active' and 'show' classes from all tabs and content
            document.querySelectorAll('.nav-link').forEach(tab => tab.classList.remove('active'));
            document.querySelectorAll('.tab-pane').forEach(content => content.classList.remove('show', 'active'));

            // Add 'active' class to the target tab and 'show active' classes to the content
            targetTab.classList.add('active');
            targetContent.classList.add('show', 'active');

            // Call your custom function
            loadPage(currentPage, start_date, end_date, type);
        }
        
    }
    else if (tab === 'revenue_details') {
     
        // Select the target tab and content
        const targetTab = document.querySelector('#pills-dep2-tab');
        const targetContent = document.querySelector('#pills-dep2');

       
        if (targetTab && targetContent) {
     

            // Remove 'active' and 'show' classes from all tabs and content
            document.querySelectorAll('.nav-link').forEach(tab => tab.classList.remove('active'));
            document.querySelectorAll('.tab-pane').forEach(content => content.classList.remove('show', 'active'));

            // Add 'active' class to the target tab and 'show active' classes to the content
            targetTab.classList.add('active');
            targetContent.classList.add('show', 'active');

            // Call your custom function
            loadPage1(currentPage1,start_date1,end_date1);
        }
        
    }
    else
    {
      const targetTab = document.querySelector('#pills-dep1-tab');
        const targetContent = document.querySelector('#pills-dep1');

        if (targetTab && targetContent) {

            // Remove 'active' and 'show' classes from all tabs and content
            document.querySelectorAll('.nav-link').forEach(tab => tab.classList.remove('active'));
            document.querySelectorAll('.tab-pane').forEach(content => content.classList.remove('show', 'active'));

            // Add 'active' class to the target tab and 'show active' classes to the content
            targetTab.classList.add('active');
            targetContent.classList.add('show', 'active');

            // Call your custom function
            loadPage(currentPage, start_date, end_date, type);
        }
    }
});


   function loadPage(page, start_date, end_date, type) {
      const uusersid = '<?php echo $this->session->get('uusersid');?>';
       const exchange = '<?php echo $this->session->get('exchange');?>';
      $.ajax({
         method: 'POST',
         url: '<?php echo base_url("/allhistory_records");?>',
         data: {
            uusersid: uusersid,
            exchange: exchange,
            page: page,
            itemsPerPage: itemsPerPage,
            start_date: start_date,
            end_date: end_date,
            type: type
         },
         success: function (data) {
            const response = JSON.parse(data);
            console.log(response.totalPages);

            const tableBody = document.getElementById('myItems');
            tableBody.innerHTML = '';

            if (response.items.length === 0) {
               tableBody.innerHTML = `
                  <tr>
                     <td colspan="3" style="text-align:center; color:red;">No Records Found</td>
                  </tr>`;
            } else {
               var value="<?php if(!empty($value->date)) {  echo date('d-M-Y',strtotime($value->date)); } else { echo "";} ?>";
               response.items.forEach(item => {
              

                  tableBody.innerHTML += `
                     <tr>
                        <td>
                           <div class="asset-trans-content d-flex align-items-center justify-content-between">
                              <div class="asset-trans-left text-start">
                                 <h6 class="aleo text-white mb-0">${item.type}</h6>
                                 <small class="text-primary fs-6 py-2 fw-bold lato">${item.date}</small>
                                 <h6 class="fw-medium fs-6 mb-0"> ${item.description}</h6>
                              </div>
                              <div class="asset-trans-right text-end">
                                 <small class="text-primary lato fw-bold ">${item.amount}</small>
                              </div>
                           </div>
                        </td>
                     </tr>`;
               });
            }

            totalPages=response.totalPages;
            start_date=start_date;
            end_date=end_date;
      
      
            document.getElementById('total_count').innerHTML=response.totalitems;
            document.getElementById('prevPage').disabled = !response.hasPrev;
            document.getElementById('nextPage').disabled = !response.hasNext;
            document.getElementById('pageInfo').innerText = `Page ${page} of ${response.totalPages}`;
         }
         
      });
   }
      
      function changePage(direction) {
      
      if (direction === 'prev' && currentPage > 1) {
      currentPage--;
      } else if (direction === 'next' && currentPage < totalPages) {
      currentPage++;
      }
      
      loadPage(currentPage,start_date,end_date);
      }
      
      
      $('#confirm').click(function(){
      $("#date_err").html("");
      var start_date=$("#start_date").val();
      var end_date=$("#end_date").val();
      var type = $("#his_type").val();
      
      if(start_date!='' && end_date=='')
      {
      $("#date_err").html("Start and End date Must Required");
      }
      else if(start_date=='' && end_date!='')
      {
      $("#date_err").html("Start and End date Must Required");
      }
      else
      {
      
      $('#staticBackdrop1').modal('hide');
      let currentPage = 1;
      loadPage(currentPage,start_date,end_date,type);
      }
      
      });
      
      $('#reset').click(function(){
      let currentPage = 1;
      $("#start_date").val('');
      $("#end_date").val('');
      
      $('#staticBackdrop1').modal('hide');
      
      loadPage(currentPage);
      });


         // let currentPage1 = 1;
         // const itemsPerPage1 = 10; // Number of items per page
         // let totalPages1 =1;
         // let start_date1='';
         // let end_date1='';
         
        function revenue()
        {
        
         loadPage1(currentPage1,start_date1,end_date1);
        }

       
         
         
         
         
         function loadPage1(page1,start_date1,end_date1)
         {
         var uusersid1='<?php echo $this->session->get('uusersid');?>';
         var exchange='<?php echo $this->session->get('exchange');?>';
         $.ajax({
         'method': 'POST',
         'url': '<?php echo base_url("/revenue_records");?>',
         data:{'uusersid':uusersid1,"exchange":exchange,"page":page1,"itemsPerPage":itemsPerPage1,"start_date":start_date1,"end_date":end_date1},
         success:function(data11)
         {
         // alert('ok');
            var data1= JSON.parse(data11);
           // console.log(data1.totalPages);
            const myItems1 = document.getElementById('myItems1');
            myItems1.innerHTML = '';
         
            if (data1.items1.length === 0) {
                myItems2.innerHTML = `<div class="faq_accordian mb-3">
                        <div class="accordion" style="margin:10px;text-align:center;color:red;"> No Records Found</div></div>`;
            }
            else
            {
         
            data1.items1.forEach(item => {
                myItems1.innerHTML += `
                <div class="faq_accordian mb-3"  >
                     <div class="accordion">
                        <div class="row">
                           <div class="col-md-10 offset-md-1">
                              <div class="team-right accordion-toggle " style="">
                                 <ul class="mb-0 mt-0 asset-user-static d-flex list-unstyled" style="justify-content:space-between">
                                    <li>
                                    <a class="text-white " href="<?php echo base_url();?>/profit_details/${item.date1}">
                                       <p class="text-white-50 mb-0" style="align-content:center">Date</p>
                                       <b class="text-white">${item.date1}</b>
                                       </a>
                                    </li>
                                    <li>
                                    <a class="text-white " href="<?php echo base_url();?>/profit_details/${item.date1}">
                                       <p class="text-white-50 mb-0">Total Profit</p>
                                       <b class="text-white">${item.profit1}</b>
                                       </a>
                                    </li>
                                    <li style="margin-top:10px">
                                       <b ><a class="text-white " href="<?php echo base_url();?>/profit_details/${item.date1}"><i class="fa-solid fa-greater-than"></i></a></b>
                                    </li>
                                 </ul>
                              </div>
                           </div>
                        </div>
                     </div>
                  </div>
                
                `; });
            }
         
         totalPages1=data1.totalPages1;
         start_date1=start_date1;
         end_date1=end_date1;
         
         
         document.getElementById('total_count1').innerHTML=data1.totalitems1;
         document.getElementById('prevPage1').disabled = !data1.hasPrev1;
            document.getElementById('nextPage1').disabled = !data1.hasNext1;
            document.getElementById('pageInfo1').innerText = `Page ${page1} of ${data1.totalPages1}`;
         }
         })
         
         
         
         }
         
         function changePage1(direction) {
         
         if (direction === 'prev' && currentPage1 > 1) {
         currentPage1--;
         } else if (direction === 'next' && currentPage1 < totalPages1) {
         currentPage1++;
         }
         
         loadPage1(currentPage1,start_date1,end_date1);
         }

         $('#confirm1').click(function(){
         $("#date_err1").html("");
         var start_date1=$("#start_date1").val();
         var end_date1=$("#end_date1").val();
         
         if(start_date1!='' && end_date1=='')
         {
         $("#date_err1").html("Start and End date Must Required");
         }
         else if(start_date1=='' && end_date1!='')
         {
         $("#date_err1").html("Start and End date Must Required");
         }
         else
         {
         
         $('#staticBackdrop2').modal('hide');
         let currentPage1 = 1;
         loadPage1(currentPage1,start_date1,end_date1);
         }
         
         });
         
         $('#reset1').click(function(){
         let currentPage1 = 1;
         $("#start_date1").val('');
         $("#end_date1").val('');
         
         $('#staticBackdrop2').modal('hide');
         
         loadPage1(currentPage1);
         });


        
     
      </script>

      <script>
        let currentPage2 = 1;
         const itemsPerPage2 = 10; // Number of items per page
         let totalPages2 =1;
         let start_date2='';
         let end_date2='';
         
         function rank_bonus()
        {
        

         loadPage2(currentPage2,start_date2,end_date2);
        }
         
         
         
         
         function loadPage2(page2,start_date2,end_date2)
         {
         var uusersid2='<?php echo $this->session->get('uusersid');?>';
         $.ajax({
         'method': 'POST',
         'url': '<?php echo base_url("/rank_bonus");?>',
         data:{'uusersid':uusersid2,"page":page2,"itemsPerPage":itemsPerPage2,"start_date":start_date2,"end_date":end_date2},
         success:function(data2)
         {
         // alert('ok');
            var data2= JSON.parse(data2);
           // console.log(data1.totalPages);
            const myItems2 = document.getElementById('myItems2');
            myItems2.innerHTML = '';
         
            if (data2.items2.length === 0) {
                myItems1.innerHTML = `<div class="faq_accordian mb-3">
                        <div class="accordion" style="margin:10px;text-align:center;color:red;"> No Records Found</div></div>`;
            }
            else
            {
         
            data2.items2.forEach(item => {
                myItems2.innerHTML += `
                <div class="faq_accordian mb-3"  >
                     <div class="accordion">
                        <div class="row">
                           <div class="col-md-10 offset-md-1">
                              <div class="team-right accordion-toggle " style="">
                                 <ul class="mb-0 mt-0 asset-user-static d-flex list-unstyled" style="justify-content:space-between">
                                    <li>
                                    <a class="text-white " href="<?php echo base_url();?>/rankbonus_details/${item.date2}">
                                       <p class="text-white-50 mb-0" style="align-content:center">Date</p>
                                       <b class="text-white">${item.date2}</b>
                                       </a>
                                    </li>
                                    <li>
                                    <a class="text-white " href="<?php echo base_url();?>/rankbonus_details/${item.date2}">
                                       <p class="text-white-50 mb-0">Total Profit</p>
                                       <b class="text-white">${item.profit2}</b>
                                       </a>
                                    </li>
                                    <li style="margin-top:10px">
                                       <b ><a class="text-white " href="<?php echo base_url();?>/rankbonus_details/${item.date2}"><i class="fa-solid fa-greater-than"></i></a></b>
                                    </li>
                                 </ul>
                              </div>
                           </div>
                        </div>
                     </div>
                  </div>
                
                `; });
            }
         
         totalPages2=data2.totalPages2;
         start_date2=start_date2;
         end_date2=end_date2;
         
         
         document.getElementById('total_count2').innerHTML=data2.totalitems2;
         document.getElementById('prevPage2').disabled = !data2.hasPrev2;
            document.getElementById('nextPage2').disabled = !data2.hasNext2;
            document.getElementById('pageInfo2').innerText = `Page ${page2} of ${data2.totalPages2}`;
         }
         })
         
         
         
         }
         
         function changePage2(direction) {
         
         if (direction === 'prev' && currentPage2 > 1) {
         currentPage2--;
         } else if (direction === 'next' && currentPage2 < totalPages2) {
         currentPage2++;
         }
         
         loadPage2(currentPage2,start_date2,end_date2);
         }

         $('#confirm2').click(function(){
         $("#date_err2").html("");
         var start_date1=$("#start_date2").val();
         var end_date1=$("#end_date2").val();
         
         if(start_date2!='' && end_date2=='')
         {
         $("#date_err2").html("Start and End date Must Required");
         }
         else if(start_date2=='' && end_date2!='')
         {
         $("#date_err2").html("Start and End date Must Required");
         }
         else
         {
         
         $('#staticBackdrop3').modal('hide');
         let currentPage2= 1;
         loadPage2(currentPage2,start_date2,end_date2);
         }
         
         });
         
         $('#reset2').click(function(){
         let currentPage2 = 1;
         $("#start_date2").val('');
         $("#end_date2").val('');
         
         $('#staticBackdrop3').modal('hide');
         
         loadPage2(currentPage2);
         });
      </script>

<script>
        let currentPage3 = 1;
         const itemsPerPage3 = 10; // Number of items per page
         let totalPages3 =1;
         let start_date3='';
         let end_date3='';
         
         function gas_bonus()
        {
    
         loadPage3(currentPage3,start_date3,end_date3);
        }
         
         
         
         
         function loadPage3(page3,start_date3,end_date3)
         {
         var uusersid3='<?php echo $this->session->get('uusersid');?>';
         $.ajax({
         'method': 'POST',
         'url': '<?php echo base_url("/gas_bonus");?>',
         data:{'uusersid':uusersid3,"page":page3,"itemsPerPage":itemsPerPage3,"start_date":start_date3,"end_date":end_date3},
         success:function(data3)
         {
         // alert('ok');
            var data3= JSON.parse(data3);
           // console.log(data1.totalPages);
            const myItems3 = document.getElementById('myItems3');
            myItems3.innerHTML = '';
         
            if (data3.items3.length === 0) {
                myItems3.innerHTML = `<div class="faq_accordian mb-3">
                        <div class="accordion" style="margin:10px;text-align:center;color:red;"> No Records Found</div></div>`;
            }
            else
            {
         
            data3.items3.forEach(item => {
                myItems3.innerHTML += `
                <div class="faq_accordian mb-3"  >
                     <div class="accordion">
                        <div class="row">
                           <div class="col-md-10 offset-md-1">
                              <div class="team-right accordion-toggle " style="">
                                 <ul class="mb-0 mt-0 asset-user-static d-flex list-unstyled" style="justify-content:space-between">
                                    <li>
                                    <a class="text-white " href="<?php echo base_url();?>/gasbonus_details/${item.date3}">
                                       <p class="text-white-50 mb-0" style="align-content:center">Date</p>
                                       <b class="text-white">${item.date3}</b>
                                       </a>
                                    </li>
                                    <li>
                                    <a class="text-white " href="<?php echo base_url();?>/gasbonus_details/${item.date3}">
                                       <p class="text-white-50 mb-0">Total Profit</p>
                                       <b class="text-white">${item.profit3}</b>
                                       </a>
                                    </li>
                                    <li style="margin-top:10px">
                                       <b ><a class="text-white " href="<?php echo base_url();?>/gasbonus_details/${item.date3}"><i class="fa-solid fa-greater-than"></i></a></b>
                                    </li>
                                 </ul>
                              </div>
                           </div>
                        </div>
                     </div>
                  </div>
                
                `; });
            }
         
         totalPages3=data3.totalPages3;
         start_date3=start_date3;
         end_date3=end_date3;
         
         
         document.getElementById('total_count3').innerHTML=data3.totalitems3;
         document.getElementById('prevPage3').disabled = !data3.hasPrev3;
            document.getElementById('nextPage3').disabled = !data3.hasNext3;
            document.getElementById('pageInfo3').innerText = `Page ${page3} of ${data3.totalPages3}`;
         }
         })
         
         
         
         }
         
         function changePage3(direction) {
         
         if (direction === 'prev' && currentPage3 > 1) {
         currentPage3--;
         } else if (direction === 'next' && currentPage3 < totalPages3) {
         currentPage3++;
         }
         
         loadPage3(currentPage3,start_date3,end_date3);
         }

         $('#confirm3').click(function(){
         $("#date_err3").html("");
         var start_date3=$("#start_date3").val();
         var end_date3=$("#end_date3").val();
         
         if(start_date3!='' && end_date3=='')
         {
         $("#date_err3").html("Start and End date Must Required");
         }
         else if(start_date3=='' && end_date3!='')
         {
         $("#date_err3").html("Start and End date Must Required");
         }
         else
         {
         
         $('#staticBackdrop4').modal('hide');
         let currentPage3= 1;
         loadPage2(currentPage3,start_date3,end_date3);
         }
         
         });
         
         $('#reset3').click(function(){
         let currentPage3= 1;
         $("#start_date3").val('');
         $("#end_date3").val('');
         
         $('#staticBackdrop4').modal('hide');
         
         loadPage2(currentPage3);
         });
      </script>
   </body>
</html>
