<!DOCTYPE html>
<?php 
	session_start();
	@ob_start();
	include "../../config/koneksi.php";
	include "../../config/fungsi_rupiah.php";
	include "../../config/fungsi_indotgl.php";

?>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>OUZEN MART | DO</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="../../bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="../../dist/css/AdminLTE.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body onload="window.print();">
    <div class="wrapper">
      <!-- Main content -->
      <section class="invoice">
        <!-- title row -->
        <div class="row">
          <div class="col-xs-12">
            <h2 class="page-header">
              <i class="fa fa-truck"></i> OUZEN MART - DELIVERY ORDER #
              <?php
					$inv = $_GET[id];
					$noord = str_pad($inv, 4, "0", STR_PAD_LEFT);
					$today=tgl_ind(Date("Y-m-d"));
					echo"$noord<small class='pull-right'>Print Date: $today</small>";
				?>
            </h2>
          </div><!-- /.col -->
        </div>
        <!-- info row -->
        <div class="row invoice-info">
          <div class="col-sm-12 invoice-col">
             Packing Oleh : 
			 <?php 
				$packing = mysql_result(mysql_query("select packing from delivery where pk = $inv"),0);
				echo"$packing";
			 ?>
              
          </div><!-- /.col -->
         
        </div><!-- /.row -->

        <!-- Table row -->
        <div class="row">
          <div class="col-xs-12 table-responsive">
            <table class="table table-striped">
              <thead>
                <tr>
                    <th>No</th>
                    <th>Order</th>
                    <th>Customer</th>
                    <th>Isi</th>
					<th>Tot Qty</th>
                </tr>
              </thead>
              <tbody>
                <?php
				$cek = mysql_query("Select * from deliverydetail where delivery = $_GET[id] order by jualcs asc");
				$i = 0;
				while ($r=mysql_fetch_array($cek)){	
					$i = $i + 1;
					$ord = $r['jualcs'];
					$tgl = tgl_ind($r['billdate']);

					$noord = str_pad($ord, 4, "0", STR_PAD_LEFT);
					
					$cust = mysql_result(mysql_query("select cust from jualcs where billno = $ord"),0);
					$custnm = mysql_result(mysql_query("select nama from customer where id = $cust"),0);
					$totqty = format_rupiah(mysql_result(mysql_query("select sum(qty) from jualcsdetail where billno = $ord"),0));
							
					$isi = "";
							$cek2 = mysql_query("Select * from jualcsdetail where billno = $r[jualcs]");
							while ($r2=mysql_fetch_array($cek2)){	
								$nmproduk = mysql_result(mysql_query("select produk from produk where id = $r2[produk]"),0);
								$isi = $isi.format_rupiah($r2['qty']).' x '.$nmproduk.'<br>';
							}
							
							
							echo "<tr>
									<td>$i</td>
									<td>$noord </a></td>
									<td>$custnm</td>
									<td>$isi</td>
									<td>$totqty</td>
								  </tr>";
					
				}
				?>
              </tbody>
            </table>
          </div><!-- /.col -->
        </div><!-- /.row -->

       
      </section><!-- /.content -->
    </div><!-- ./wrapper -->

    <!-- AdminLTE App -->
    <script src="../../dist/js/app.min.js"></script>
  </body>
</html>
