<?php 
include("../config.php");
$report     = "SELECT * FROM report_setting WHERE company_id = '".$_SESSION['company_id']."' AND branch_id = '".$_SESSION['branch_id']."'";
$report_res = mysqli_query($conn,$report);
$report_row = mysqli_fetch_assoc($report_res);

$id = $_POST['lr_no'];

$lr            = "SELECT * FROM lr_opening WHERE lr_no = '".$id."' AND branch_id = '".$_SESSION['branch_id']."' AND company_id = '".$_SESSION['company_id']."'";
$lr_res        = mysqli_query($conn,$lr);
$lr_row        = mysqli_fetch_assoc($lr_res);
$master_vendor = combine(getAllRecords('vendor_master'), 'id', 'name');
?>

<?php echo $report_row['header_data']; ?>
<table class="table table-bordered table-striped">
  <thead>
    <tr>
      <td colspan="7" style="text-align: center;"><span style="font-size: 13px;"><b>lr opening details</b></span></td>
    </tr>
    <tr>
      <th class="text-center">lr No</th>
      <th class="text-center">Date</th>
      <th class="text-center">invoice.</th>
      <th class="text-center">party amount.</th>
      <th class="text-center">truck no.</th>
      <th class="text-center">From - STN</th>
      <th class="text-center">To - STN</th>
    </tr>
    <tr class="text-center">
      <td><?php echo $lr_row['lr_no'];?></td>
      <td><?php echo risFormatDate($lr_row['l_date']);?></td>
      <td><?php echo $lr_row['party_invoice'];?></td>
      <td><?php echo $lr_row['party_amount'];?></td>
      <td><?php echo $lr_row['truck_no'];?></td>
      <td><?php echo $lr_row['from_place'];?></td>
      <td><?php echo $lr_row['to_place'];?></td>
    </tr>
    <tr>
      <th class="text-center" colspan="3">CONSIGNOR</th>
      <th class="text-center" colspan="2">CONSIGNEE</th>
      <th class="text-center" colspan="2">BILLING TO</th>
    </tr>
    <tr class="text-center">
      <td colspan="3"><?php echo @$master_vendor[$lr_row['consignor_name']];?></th>
      <td colspan="2"><?php echo @$master_vendor[$lr_row['consignee_name']];?></td>
      <td colspan="2"><?php echo @$master_vendor[$lr_row['billing_to']];?></td>
    </tr>
    <tr>
      <th class="text-center">AGENT</th>
      <th class="text-center">WEIGHT (MT)</th>
      <th class="text-center">ACTUAL WEIGHT(MT).</th>
      <th class="text-center">HEIGHT</th>
      <th class="text-center">EXTRA HEIGHT</th>
      <th class="text-center">NATURE OF GOODS</th>
      <th class="text-center">PCS</th>
    </tr>
    <tr class="text-center">
      <td><?php echo $lr_row['agent'];?></td>
      <td><?php echo $lr_row['weight'];?></td>
      <td><?php echo $lr_row['actual_weight'];?></td>
      <td><?php echo $lr_row['height'];?></td>
      <td><?php echo $lr_row['extra_height'];?></td>
      <td><?php echo $lr_row['nature_of_goods'];?></td>
      <td><?php echo $lr_row['pcs'];?></td>
    </tr>
    <tr>
      <th class="text-center">RATE</th>
      <th class="text-center">RATE ON</th>
      <th class="text-center">FREIGHT</th>
      <th class="text-center">ADVANCE</th>
      <th class="text-center">TOTAL AMOUNT</th>
      <th class="text-center">BILLING PARTY</th>
      <th class="text-center">GST PAID BY</th>
    </tr>
    <tr class="text-center">
      <td><?php echo $lr_row['rate'];?></td>
      <td><?php echo $lr_row['rate_on'];?></td>
      <td><?php echo $lr_row['freight'];?></td>
      <td><?php echo $lr_row['advance'];?></td>
      <td><?php echo $lr_row['total_amnt'];?></td>
      <td><?php echo $lr_row['billing_party'];?></td>
      <td><?php echo $lr_row['gst_paid_by'];?></td>
    </tr>
    <tr>
      <th class="text-center" colspan="2">VEHICLE IN</th>
      <th class="text-center" colspan="2">VEHICLE OUT</th>
      <th class="text-center" colspan="3">REMARK</th>
    </tr>
    <tr class="text-center">
      <td class="text-center" colspan="2">
        <?php if($lr_row['vehicle_in'] == ''){
          echo "-";
        }else{
          echo risFormatDate($lr_row['vehicle_in']);
        }
        ;?></td>
        <td class="text-center" colspan="2">
        <?php if($lr_row['vehicle_out'] == ''){
          echo "-";
        }else{
          echo risFormatDate($lr_row['vehicle_out']);
        }
        ;?></td>
        <td class="text-center" colspan="3">
        <?php if($lr_row['remark'] == ''){
          echo "-";
        }else{
          echo $lr_row['remark'];
        }
        ;?></td>
      
    </tr>
  </thead>
</table>