<?php include("parent/callMe.php"); ?>
<?php  include("sessioncheck.php"); ?>

<?php


 $branch=$_SESSION['branch'];

$sql = "SELECT * FROM eduportal_accounts_voucher_details where branch_id='$branch'";

if (isset($_REQUEST['category'])) {
    

 if($_REQUEST['category']=="All"){
    
    } else {
     $sql .= " AND account_id = '" .$_REQUEST['category']. "' ";

    }

    }

    $sql .= " order by voucher_id desc ";
 // print_r($sql);
  $WorkAssignListings = $m->query($sql); 


     ?>


<!DOCTYPE html>
<html lang="en">
  <head>
    
    <title>Journal Gernal | EduPortal</title>
    <?php include('RootMe/css_links.php');?>
   
  </head>
  




  <body class="nav-md">
    <div class="container body">
      <div class="main_container">
        <div class="col-md-3 left_col">
     
            <?php include('RootMe/sidebar.php');?>

              <?php include('RootMe/header.php');?>
     
        <!-- page content -->
          <div class="right_col" role="main">
          <div class="" style="background-color: white;">

      <a href="<?php echo $_SESSION['dashboard'];?>">Dashboard </a> &nbsp; <i style="" class="fa fa-angle-double-right"></i>  &nbsp; 
    
         <a href="#">Journal Gernal </a> 

          <br><br>

            
    <section class="add_sub_agent" id="table_sub_agent">
  <div class="container">

 <div class="" style="margin-top:10px;">
     
      <div class="clearfix"></div>
    </div>

<div style="overflow-x:auto;">
      

<form class="form-style-7" action="journal.php" method="get"  enctype="multipart/form-data">


      
              <div class="col-md-3 col-xs-12" style="padding: 8px;">
                <div class="form-group ">
                  <label class="required">Account Name</label>
                   <select name="category" onChange="getGroup(this.value)" class="form-control">

                    <option value="All">All</option>

                    <?php
                    //$m->where("parent_id", '0');
                    $accounts = $m->get("eduportal_chart_of_accounts");
                    foreach ($accounts as $account) { ?>

                <option <?php if ($_REQUEST['category']==$account['coa_id']) { echo 'selected'; } ?> value="<?php echo $account['coa_id']; ?>"><?php echo $account['account_title']; ?></option>

                    <?php } ?>

                  </select> 
                </div>
              </div>


              
       
 

              <div class="col-md-2 " style="padding:2px;">
    
        
                <div class="form-group ">
                   
                <button type="submit" class="btn btn-primary" style="margin-top: 31px;">Search</button>
                     <?php 
           if( $_REQUEST['age']!=""){
          ?>

            <a target="_blank" title="Print Arrear Report" href="print_age_wise_students_report.php?<?php echo session_id().session_id().session_id().session_id().session_id(); ?>&orderByAge=<?php echo $_GET['orderByAge'];?>&age=<?php echo $_GET['age'];?>&gender=<?php echo $_GET['gender'];?>&8lqc1oclfi4llgnioo156a61oe8lqc1oclfi4llgnioo156a61oe8lqc1" class="fa fa-print btn btn-primary" style="margin-top: 34px;padding: 9px;">&nbsp;Print
              
            </a>

          <?php 
          }
          ?>
                </div>

           

        
              </div>
    


    <table id="listofstudents" data-page-length='100' class="table table-striped table-bordered" style="width:100%">
          
         <thead>
            <tr>
                <th width="3%" class=" center"> S.No</th>
                <th width="12%" class="center"> Voucher Type</th>
                <th width="10%" class="center"> Voucher No</th>
                <th width="25%" class=" center"> Narration </th>  
                <th width="10%" class=" center"> Date</th>
                <th width="10%" class=" center"> Action </th>
                 
            </tr>
        </thead>
        <tbody>
  <?php 
$count=1;
      foreach($WorkAssignListings as $WorkAssignListVal)
      { 


        $m->where("id", $WorkAssignListVal['voucher_type']); 
        $vocherType = $m->get("eduportal_voucher_type");
      
     ?>
        <tr> 
          <td class="center"> <?php echo $count; $count++;?> </td>
          <td style="padding-left:1%;"><?php echo $vocherType[0]['voucher_name'];?></td>
          <td style="padding-left:1%;"><?php echo $WorkAssignListVal['voucher_code'];?></td>
          <td class="center">  <?php echo $WorkAssignListVal['voucher_narration'];?></td>
          <td style="padding-left:1%;"><?php echo date("d-M-Y",strtotime($WorkAssignListVal['voucher_date_entry']));?></td>
          <td style="padding-left:1%;">

            <a  style="padding: 0px 4px; font-size:14px;" target="_blank" href="print_account_voucher.php?voucher_id=<?php echo $WorkAssignListVal['voucher_id'];?>" class="btn btn-success">
                 <i class="fa fa-print" aria-hidden="true"></i>
            </a>

            <a  style="padding: 0px 4px; font-size:14px;" data-toggle="modal" data-target="#PostedVoucher<?php echo $WorkAssignListVal['voucher_id'];?>" class="btn btn-success">
                 <i class="fa fa-file" aria-hidden="true"></i>
            </a>

           


            <?php if ($WorkAssignListVal['posted_date']==NULL) { ?>
                
           
             <a href="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php?user_id=<?php echo $WorkAssignListVal['user_id'];?>&month=<?php echo $_GET['month'];?>&session=<?php echo $_GET['session'];?>&Security=<?php echo $payrolldata[0]['security_deductions'];?>&action=DeleteUserSalary" style="padding: 0px 5px; font-size:14px;" onClick="return confirm('Are you sure you want to delete this record');"  class="btn btn-danger"><i class="fa fa-remove"></i></a>

           <?php } ?>

          </td>



                                 
        </tr>
        </form>      

        <!-- popup start -->


      <div id="PostedVoucher<?php echo $WorkAssignListVal['voucher_id'];?>" class="modal fade" role="dialog">
        <div class="modal-dialog">

          <!-- Modal content-->
          <div class="modal-content">
            <div class="modal-header" style="border-bottom:none;">
              <button type="button" class="close" data-dismiss="modal">&times;</button>
              <h4 class="modal-title" style="text-align:center;"> Voucher Posted  </h4>
            </div>

            <div class="modal-body">




<form  action="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php" method="post">

     <input type="hidden" name="action" value="voucher_posted"> 
     <input type="hidden" id="voucherID"  name="voucherID" value="<?php echo $WorkAssignListVal['voucher_id'];?>" />
              
    <p style="color:red;">Any number of journal entries can be drawn from one journal voucher. The next step after the journal entry is posting the entries to appropriate ledgers</p>
                   
                            
                                     
      
            <div class="modal-footer">

            <button type="submit" class="btn btn-primary" name="submit" >Submit </button>
              


            </div>



                 </form>

          </div>

          </div>

        </div>
      </div>

      <!-- popup ending -->

       <?php } ?>

       
           
            
           
        </tbody>
        
    </table>

    


</div>


 

    <br><br>


  </div>
  <div class="clearfix"></div>
</section>

           
          </div>
        </div>

            </div>
          </div>
        </div>
        <!-- /page content -->
  

    
  <?php include('RootMe/js_linksscript.php');?>

  <script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
    <script>
        $(document).ready(function() {
        $('#listofstudents').DataTable();
        } 
        );
    </script>
  </body>
</html>
