<?php
include '../config/conf.php';
// Add User UNIFI
if(isset($_POST['btnAddUsrUniP'])){
    $UniName=$_POST['UniNameP'];

    $sql="INSERT INTO `uni_tenant` (name) VALUES ('$UniName') ";
    //echo $sql;
    $result=mysqli_query($sqldb,$sql);    
}

// add payment UNIFI
if(isset($_POST['BtnAddPayUsrUniP'])){
    $VTxtuniPayDate=$_POST['TxtuniPayDateP'];
    $VTxtSlctUsrUni=$_POST['TxtSlctUsrUniP'];
    $VTxtdesc=$_POST['TxtdescP'];
    $VTxtbyran=$_POST['TxtbyranP'];

    $sql="INSERT INTO `uni_paymnt` (name,descuni,pay,trkpay) VALUES ('$VTxtSlctUsrUni','$VTxtdesc','$VTxtbyran', '$VTxtuniPayDate') ";
    $result=mysqli_query($sqldb,$sql);    
}

if(isset($_POST['btnAddUsrUniP'])){
    $UniName=$_POST['UniNameP'];

    $sql="INSERT INTO `uni_tenant` (name) VALUES ('$UniName') ";
    //echo $sql;
    $result=mysqli_query($sqldb,$sql);    
}

//List Unifi Payment
if(isset($_POST['dispLstPayUniP'])){
    $tblLstInfo='<table class="table">
        <thead class="thead-dark" style="font-size:80%">
          <tr>
            <th scope="col">Name</th>
            <th scope="col">Description</th>
            <th scope="col">pay</th>
            <th scope="col">Date</th>
          </tr>
        </thead>';
      
      $sql="SELECT id,name,descuni,pay,trkpay FROM uni_paymnt";
      $result=mysqli_query($sqldb,$sql);
      $number=1;
      while($row=mysqli_fetch_assoc($result)){   
        $nameP=$row['name'];
        $descuniP=$row['descuni'];
        $payP=$row['pay'];
        $trkpayP=$row['trkpay'];
    $tblLstInfo.='<tr>
            <td scope="row" >'.$nameP.'</td>
            <td>'.$descuniP.'</td>
            <td>'.$payP.'</td>
            <td>'.$trkpayP.'</td>
         </tr>';
          $number++; 
      }
    $tblLstInfo.='</table>';
      echo $tblLstInfo;
}


?>