<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Icicle Corporation | Invoice</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.7 -->
  <link rel="stylesheet" href="<?php echo base_url(); ?>assets/bower_components/bootstrap/dist/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="<?php echo base_url(); ?>assets/bower_components/font-awesome/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="<?php echo base_url(); ?>assets/bower_components/Ionicons/css/ionicons.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="<?php echo base_url(); ?>assets/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]-->

  <!-- Google Font -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
</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">
            <img src="<?= base_url(); ?>assets/image/logo.png" alt="Icicle Logo" width="100px">
            <small class="pull-right">Date: <?= date("Y/m/d"); ?></small>
          </h2>
        </div>
        <!-- /.col -->
      </div>
      <!-- info row -->
      <div class="row invoice-info">
        <div class="col-sm-4 invoice-col">
          From
          <address>
            <strong>Icicle Corporation.</strong><br>
            House 15 A (2nd Floor )<br>
            Road 16 (New), 27 (Old) Dhanmondi Dhaka- 1209<br>
            Phone: +880-9678774488<br>
            Email: feedback@iciclelimited.com
          </address>
        </div>
        <!-- /.col -->
        <div class="col-sm-4 invoice-col">
          To
          <?php foreach($results[1] as $key => $result){ ?>
          <address>
            <strong><?= $result['client_name']; ?></strong><br>
            <?= $result['address']; ?><br>
            Phone: <?= $result['phone'] ?><br>
            Email: <?= $result['email'] ?>
          </address>
          <?php } ?>
        </div>
        <!-- /.col -->
        <div class="col-sm-4 invoice-col">
          <b>Invoice #<?= uniqid(); ?></b><br>
          <br>
          <?php foreach($results[1] as $key => $result){ ?>
          <b>Order ID:</b> <?= $result['orderid'] ?><br>
          <?php } ?>
          <!-- <b>Payment Due:</b> 2/22/2014<br>
          <b>Account:</b> 968-34567 -->
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->

      <!-- Table row -->
      <div class="row">
        <div class="col-xs-12 table-responsive">
          <table class="table table-striped">
            <thead>
            <tr>
              <th>Qty</th>
              <th>Product</th>
              <!-- <th>Package</th> -->
              <th>Package Type</th>
              <th>Subtotal</th>
            </tr>
            </thead>
            <tbody>
            <?php
              foreach ($results[2] as $key => $product) {


                if($product['type'] == 'shared_hosting'){
                  $package_type = "Shared Hosting";
                }
                elseif($product['type'] == 'wordpress_hosting'){
                  $package_type = "WordPress Hosting";
                }
                elseif($product['type'] == 'email_marketing'){
                  $package_type = "Email Marketing";
                }
                elseif($product['type'] == 'fb_packages'){
                  $package_type = "Facebook Packages";
                }
                elseif($product['type'] == 'google_adwords'){
                  $package_type = "Google Adwords";
                }
                elseif($product['type'] == 'nonmasking'){
                  
                  // $sms_title = $product['title']);
                  // settype($sms_title, "integer");
                  $price = (int)$product['title'] * $product['price'];
                  
                  $package_type = "SMS Pacakge [Non Masking]";
                }
                elseif($product['type'] == 'masking'){

                  $price = (int)$product['title'] * $product['price'];
                  $package_type = "SMS Pacakge [Masking]";
                  
                }
                elseif($product['type'] == 'business'){
                  $package_type = "Web Pacakge [Business]";
                }
                elseif($product['type'] == 'ecommerce'){
                  $package_type = "Web Pacakge [Ecommerce]";
                }
                  
            ?>

              <tr>
                <td>1</td>
                <td><?= $product['title']; ?></td>
                <td><?= $package_type ; ?></td>
                <td><?php if($product['type'] == 'masking' || $product['type'] == 'nonmasking'){ echo $price; }else{ echo $product['price']; } ?></td>
              </tr>
            <?php } ?>
                
            </tbody>
          </table>
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->

      <div class="row">
        <!-- accepted payments column -->
        <div class="col-xs-6">
          &nbsp;
          <!-- <p class="lead">Payment Methods:</p>
          <img src="../../dist/img/credit/visa.png" alt="Visa">
          <img src="../../dist/img/credit/mastercard.png" alt="Mastercard">
          <img src="../../dist/img/credit/american-express.png" alt="American Express">
          <img src="../../dist/img/credit/paypal2.png" alt="Paypal">

          <p class="text-muted well well-sm no-shadow" style="margin-top: 10px;">
            Etsy doostang zoodles disqus groupon greplin oooj voxy zoodles, weebly ning heekya handango imeem plugg
            dopplr jibjab, movity jajah plickers sifteo edmodo ifttt zimbra.
          </p> -->
        </div>
        <!-- /.col -->
        <div class="col-xs-6">
          <!-- <p class="lead">Amount Due 2/22/2014</p> -->

          <div class="table-responsive">
            <table class="table">
              <tr>
                <th style="width:50%">Subtotal:</th>
                <?php 
                  foreach ($results[2] as $key => $product) {
                    if(
                      $product['type'] == 'shared_hosting' ||
                      $product['type'] == 'wordpress_hosting' ||
                      $product['type'] == 'nonmasking' ||
                      $product['type'] == 'masking' ||
                      $product['type'] == 'business' ||
                      $product['type'] == 'ecommerce' ||
                      $product['type'] == 'email_marketing'
                    ){
                      $currency = "৳";
                    }
                    
                    else{
                      $currency = "$";
                    }

                ?>
                <td><?= $currency; ?> <?php if($product['type'] == 'masking' || $product['type'] == 'nonmasking'){ echo $price; }else{ echo $product['price']; } ?>
                </td>
                <?php } ?>
              </tr>
              <!-- <tr>
                <th>Tax (9.3%)</th>
                <td>$10.34</td>
              </tr>
              <tr>
                <th>Shipping:</th>
                <td>$5.80</td>
              </tr>
              <tr> -->
                <th>Total:</th>
                <?php 
                  foreach ($results[2] as $key => $product) {
                ?>
                <td><?= $currency; ?> <?php if($product['type'] == 'masking' || $product['type'] == 'nonmasking'){ echo $price; }else{ echo $product['price']; } ?>
                </td>
                <?php } ?>
              </tr>
            </table>
          </div>
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->

      <!-- this row will not appear when printing -->
      <div class="row no-print">
        <div class="col-xs-12">
        </div>
      </div>
    </section>
    <!-- /.content -->
</div>
<!-- ./wrapper -->
</body>
</html>
