<?php 

$query="SELECT tran_date,reference,ov_amount,order_,b.name,b.address,b.debtor_ref FROM ".$prefix."debtor_trans AS a,".$prefix."debtors_master AS b WHERE a.debtor_no=b.debtor_no AND order_  > 0";

$resultType=mysqli_query($linkid,$query);



?>



<div id="contentwrapper">

  <div class="main_content">

    <nav>

      <div id="jCrumbs" class="breadCrumb module">

        <ul>

          <li> <a href="#"><i class="icon-home"></i></a> </li>

          <li> <a href="#">Invoices & Deliveries </a> </li>

          <li> <a href="#">Invoices & Deliveries Datagrid</a> </li>

        </ul>

      </div>

    </nav>

    <div class="row-fluid">

      <div class="span12">

        <h3 class="heading">Current Invoices & Deliveries</h3>

        <table class="table table-striped table-bordered dTableR" id="dt_a">

          <thead>

            <tr>

              <th> Order No</th>

              <th> Reference</th>

              <th> Trans Date </th>

              <th> Customer </th>

              <th> Phone </th>

              <th> Amount(BDT)</th>
			  <th align="center"> Action</th>

            </tr>

          </thead>

          <tbody>

            <?php 



			  if($resultType)



				{



				while($mydata = mysqli_fetch_assoc($resultType))

				{

				

				$myref=explode("-",$mydata['reference']);

				//if($myref[0]=='DN'){

				

			  ?>

            <tr  class="bar<?php echo $mydata['order_']?>">

              <td><?php echo $mydata['order_'];?></td>

              <td><?php 

			  if($myref[0]=='DN'){

			   ?>

			    <a href="delivery_notes.php?id=<?php echo $mydata['reference'];?>" target="_blank"><?php echo $mydata['reference'];?>

				<?php

			    }

				else if($myref[0]=='INV'){

			   ?>

			    <a href="invoice_report.php?id=<?php echo $mydata['reference'];?>" target="_blank"><?php echo $mydata['reference'];?>

				<?php

			    }

			   ?></a></td>

              <td><?php echo $mydata['tran_date']?></td>

              <td><?php echo $mydata['name'];?></td>

              <td><img src="img/phn.png" width="16" />&nbsp;<?php echo $mydata['debtor_ref'];?></td>

              <td><?php echo number_format($mydata['ov_amount'],2)?></td>

               <td class="center">
		
				  <div class="row-fluid">
                        <div class="span10"> 
						<?php
						if($myref[0]=='INV'){
					   ?>
						<a href="index.php?tab=add-vat-challan?invid=<?php echo $mydata['reference'];?>" target="_blank"> <button class="btn btn-gebo">VAT C</button></a>
						<?php
						}
						?>
						</div>
                      </div>
				
                  </td>

            </tr>

            <?php 

					//}

				 	}



				 } 



?>

          </tbody>

        </table>

      </div>

    </div>

  </div>

</div>

