 <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 class="m-0 text-dark">Print Refund Receipt</h1>
          </div><!-- /.col -->
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="<?php echo base_url() ?>admin/admin/dashboard">Dashboard</a></li>
              <li class="breadcrumb-item"><a href="#">Fees Manager</a></li>
              <li class="breadcrumb-item active">Print Refund Receipt</li>

            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->
    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="card card-default">
          <div class="card-header">
            <h3 class="card-title">View All Student Course</h3>
          </div>
            <!-- /.card-header -->
            <div class="card-body">
              <table id="example1" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th>ID</th>
                  <th>Course Name</th>
                  <th></th>
                </tr>
                </thead>
                <tbody>
                <?php $i=1; foreach ($all_course as $course):?>
                <tr>
                  <td><?php echo $i ?></td>
                  <td><?php echo $course->title; ?></td>
                  <td>
                    <div class="input-group mb-3">
                      <div class="input-group-prepend">
                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                        Action
                        </button>
                        <div class="dropdown-menu">
                          <a class="dropdown-item" href="javascript:void(0)" data-toggle="modal" data-target="#printreceivePayModal<?php echo $i; ?>"><i class="fas fa-print"></i>&nbsp;&nbsp;Print Refund Receipt</a>
                        </div>
                      </div>
                    </div>
                  </td>
                </tr>
                <?php $i++; ?>
                <?php endforeach; ?>
                </tbody>
              </table>
            </div>
          </div>
      </div><!--/. container-fluid -->
    </section>
    <!-- /.content -->
  </div>
<?php $i=1; foreach ($all_course as $course):?>
<div id="printreceivePayModal<?php echo $i; ?>" class="modal fade">
   <div class="modal-dialog modal-lg">
      <div class="modal-content">
         <div class="modal-header">
          <h4 class="modal-title" id="myModalLabel">Print Refund Receipt</h4>
            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
            </button>
            
         </div>
         <form  method="post"  class="form-horizontal">
            <?php 
              $this->db->where('user_id', $course->st_course_student_atp_id);
              $atp = $this->db->get('users')->row();
            ?>
            <div class="modal-body" id="printformdata_<?php echo $i; ?>">

               <div class="item form-group">
                  <div class=" col-md-12 col-sm-12 col-xs-12">
                     <table class="table table-bordered">
                        <tbody id="inst_stud_det">
                           <tr>
                              <td style="text-align: center;vertical-align: middle">
                                 <img src="<?php echo base_url() ?><?php echo $app_setting->app_sticky_logo; ?>" alt="<?php echo $app_setting->app_name; ?>" width="150px">
                              </td>
                              <td style="text-align: right;">
                                 <h4 style="margin-bottom: 0px;" id="center"><?php echo $atp->user_business_name; ?></h4>
                                 <h6 style="margin-top: 0px;margin-bottom: 0px;">
                                  <div><?php echo $atp->user_village; ?></div>
                                  <div><?php echo $atp->user_taluka; ?></div>
                                  <?php echo $atp->user_dist; ?>
                                  <div><?php echo $atp->user_state; ?> - <?php echo $atp->user_pin_code; ?></div>
                                </h6>
                              </td>
                           </tr>
                           <tr>
                            <td>
                              <h5 style="background-color:#000;color:#fff;padding:5px;margin-top: 0px;margin-bottom: 0px;">STUDENT COPY</h5>
                            </td>
                            <td style="text-align:right">
                              Receipt Date :  <b><span id="redate"><?php echo date('d-m-Y'); ?></span></b> |  Invoice No. <b><span  id="regno"><?php echo $course->st_course_refund_inv_id; ?></span></b>
                            </td>
                           </tr>
                           <tr>
                              <td colspan="2" style="font-size:17px">Received with thanks from <b><span id="sname"><?php echo $course->user_name; ?></span></b> </td>
                           </tr>
                        </tbody>
                     </table>
                     
                  </div>
               </div>
               <div class="item form-group">
                  <div class="col-md-12 col-sm-12 col-xs-12">
                     <table class="table table-bordered">
                        <thead style="text-align:center">
                           <tr>
                              <th style="text-align:center">Course Name</th>
                              <th style="text-align:center">Total Fees</th>
                              <th style="text-align:center">Paid Amt</th>
                              <th style="text-align:center">Processing Fee</th>
                              <th style="text-align:center">Refund Amt</th>
                           </tr>
                        </thead>
                        <tbody style="text-align:center">
                           <tr>
                              <td id="crse"><?php echo $course->title; ?></td>
                              <td id="fee"><?php echo $course->fee_student_course_main_price; ?></td>
                              <td id="totalpaid"><?php echo $course->fee_student_course_main_price - $course->fee_student_course_due; ?></td>
                              <td id="discount"><?php echo $course->st_course_refund_process_fee; ?></td>
                              <td id="rempay"><?php echo $course->st_course_refund_amount; ?></td>
                           </tr>
                        </tbody>
                     </table>
                     <table class="table table-bordered">
                      <tr>
                        <td>
                          <b>Terms & Condition</b>
                          <br/>
                          1. Fee once paid will not be refunded
                          <br/>
                          2. Cheque payments are subject to realization of cheque
                        </td>
                        <td style="vertical-align: bottom;">For <b><span id="center2"></span> <?php echo $atp->user_business_name; ?></b></td>
                      </tr>
                     </table>
                  </div>
               </div>
               <hr>
               <div class="item form-group">
                  <div class=" col-md-12 col-sm-12 col-xs-12">
                     <table class="table table-bordered">
                        <tbody id="inst_stud_det">
                           <tr>
                             <td style="text-align: center;vertical-align: middle">
                                <img src="<?php echo base_url() ?><?php echo $app_setting->app_sticky_logo; ?>" alt="<?php echo $app_setting->app_name; ?>" width="150px">
                             </td>
                             <td style="text-align: right;">
                                <h4 style="margin-bottom: 0px;" id="center"><?php echo $atp->user_business_name; ?></h4>
                                <h6 style="margin-top: 0px;margin-bottom: 0px;">
                                  <div><?php echo $atp->user_village; ?></div>
                                  <div><?php echo $atp->user_taluka; ?></div>
                                  <?php echo $atp->user_dist; ?>
                                  <div><?php echo $atp->user_state; ?> - <?php echo $atp->user_pin_code; ?></div>
                                </h6>
                             </td>
                          </tr>
                          <tr>
                           <td>
                             <h5 style="background-color:#000;color:#fff;padding:5px;margin-top: 0px;margin-bottom: 0px;">CENTRE COPY</h5>
                           </td>
                           <td style="text-align:right">
                             Receipt Date :  <b><span id="redate1"></span></b> | Invoice No. <b><span  id="regno"><?php echo $course->st_course_refund_inv_id; ?></span></b>
  
                           </td>
                          </tr>
                          <tr>
                             <td colspan="2" style="font-size:13px">Received with thanks from <b><span id="sname1"></span><?php echo $course->user_name; ?></b> </td>
                          </tr>
                        </tbody>
                     </table>
                     
                  </div>
               </div>
               <div class="item form-group">
                  <div class=" col-md-12 col-sm-12 col-xs-12">
                    <table class="table table-bordered">
                        <thead style="text-align:center">
                           <tr>
                              <th style="text-align:center">Course Name</th>
                              <th style="text-align:center">Total Fees</th>
                              <th style="text-align:center">Paid Amt</th>
                              <th style="text-align:center">Processing Fee</th>
                              <th style="text-align:center">Refund Amt</th>
                           </tr>
                        </thead>
                        <tbody style="text-align:center">
                           <tr>
                              <td id="crse"><?php echo $course->title; ?></td>
                              <td id="fee"><?php echo $course->fee_student_course_main_price; ?></td>
                              <td id="totalpaid"><?php echo $course->fee_student_course_main_price - $course->fee_student_course_due; ?></td>
                              <td id="discount"><?php echo $course->st_course_refund_process_fee; ?></td>
                              <td id="rempay"><?php echo $course->st_course_refund_amount; ?></td>
                           </tr>
                        </tbody>
                     </table>
                     <table class="table table-bordered">
                      <tr>
                        <td>
                          <b>Terms & Condition</b>
                          <br/>
                          1. Fee once paid will not be refunded
                          <br/>
                          2. Cheque payments are subject to realization of cheque
                        </td>
                        <td style="vertical-align: bottom;">For <b><span id="center3"></span><?php echo $atp->user_business_name; ?></b></td>
                      </tr>
                     </table>
                  </div>
               </div>
            </div>

            <div class="modal-footer">
               <button type="submit" class="btn btn-primary" data-dismiss="modal">Cancel</button>
               <button  type="submit" onclick="printtable(<?php echo $i; ?>);" name="action" id="action" class="btn btn-success"  /> 
               Print</button>
            </div>
         </form>
      </div>
   </div>
</div>
<?php endforeach; ?>
<script type="text/javascript">
function printtable(e)
  {
    
    var table=document.getElementById("printformdata_"+e);
    var htmltoprint=''+'<style type="text/css">table {border-spacing: 0;border-collapse: collapse; width:100%; } tbody>tr>td{padding: 8px;line-height: 1.42857143;vertical-align: top; border:1px solid #ddd;}'+ 
    'thead>tr>th{padding: 8px;line-height: 1.42857143;vertical-align: top; border:1px solid #ddd;}'+
    '</style>';
    htmltoprint+=table.outerHTML;  
    newWin=window.open("");
    newWin.document.write(htmltoprint);
    newWin.print();
    newWin.close();
  }
</script>
<style type="text/css">
#printformdata table tr td
{
  padding:0px;
}
#printformdata table 
{
  margin-bottom: 0;
}
</style>