application/controllers/Orders.php
/*
	* It gets the product id and fetch the order data. 
	* The order print logic is done here 
	*/
It gets the product id and fetch the order data.
The order print logic is done here
It gets the product id and fetch the order data . The order print logic is done here
public function printDiv($id)
	{
		if(!in_array('viewOrder', $this->permission)) {
          	redirect('dashboard', 'refresh');
  		}
		if($id) {
			$order_data = $this->model_orders->getOrdersData($id);
			$orders_items = $this->model_orders->getOrdersItemData($id);
			$company_info = $this->model_company->getCompanyData(1);
			$store_data = $this->model_stores->getStoresData($order_data['store_id']);
			$order_date = date('d-m-Y', $order_data['date_time']);
			$paid_status = ($order_data['paid_status'] == 1) ? "Paid" : "Unpaid";
			$discount = '0';
			$sum='0';
			$html = '<!-- Main content -->
			<!DOCTYPE html>
			<html>
			<head>
			  <meta charset="utf-8">
			  <meta http-equiv="X-UA-Compatible" content="IE=edge">
			  <link rel="stylesheet" type="text/css" media="print"/>
			  <title>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="'.base_url('assets/bower_components/bootstrap/dist/css/bootstrap.min.css').'">
			  <!-- Font Awesome -->
			  <link rel="stylesheet" href="'.base_url('assets/bower_components/font-awesome/css/font-awesome.min.css').'">
			  <link rel="stylesheet" href="'.base_url('assets/dist/css/AdminLTE.min.css').'">
			    <style>
				* {
					  box-sizing: border-box;
					  float:none;
				}
				::-webkit-scrollbar {
					display: none;
				}
				@media print {
					.print {visibility:visible;}
					page-break-before: auto;
				}
				.mycolumn {
  					float: left;
  					width: 50%;
  					padding: 0px;
  					height: 700px; 
				}
				/* Clear floats after the columns */
				.myrow:after {
					width: 300px;
  					content: "";
  					display: table;
  					clear: both;
				}
				div {
					box-sizing: border-box;
				}
				div.c {
					text-transform: capitalize;
				  }
				th {
					background-color: #696969;
					color: white;
				  }
				tr:nth-child(even) {background-color: #D3D3D3;}
				@media print {
					md-content {
					  overflow: visible;
					}
				  }
				</style>
			</head>
			<body onload="window.print();">
			<div class="myrow">
			 <div class="mycolumn">
			  <section class="invoice">
			 	<div class="row">  
				    <h3 class="page-header" align="middle">
				          '.$company_info['company_name'].' <br>
				           <small><font size=2><i>'.$company_info['address'].'</i></font></small>
			        </h3>
					<b>&emsp;Bill No:  <font size=4>'.$order_data['bill_no'].'</font></b>
					<span class="pull-center">&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
					    <b>Date:</b>'.$order_date.'</span>
				</div>
			    <div class="table-responsive">
			        <table class="table table-striped">
			          <thead>
					  <tr>
					    <th>Qty</th>
			            <th>Particulars</th>
						<th>Type</th>
			            <th>Amount</th>
			          </tr>
			          </thead>
			          <tbody>'; 
			          foreach ($orders_items as $k => $v) {
			          	$product_data = $this->model_products->getProductData($v['product_id']); 
						$sum += $v['qty'];
						  $html .= '<tr>
						    <td>'.$v['qty'].'</td>
				            <td style="text-transform: uppercase" >'.$product_data['name'].'</td>
							<td style="text-transform: uppercase" >'.$v['type'].'</td>
				            <td>'.$v['amount'].'</td>
			          	</tr>';
					  }
					  $html .= '</tbody>
					  <tr>
					  <td><b>'.$sum.' - Total</b></td>
					  <td><b>-</b></td>
					  <td><b>-</b></td>
					  <td><b>'.$order_data['net_amount'].'</b></td>
					  </tr>
					</table>
			    </div>	      
				<center><font size=2><i>Article is accepted at owners risk.</i></font><br>
				<b>Delivery Date : '.$order_data['due_date'].'</b> <i>after 7 p.m.</i></center>
			    <br><b><font size=2>&nbsp;&nbsp;&nbsp;Customer Sign</font></b>
				<span class="pull-right"><b><font size=2>Signature</font></b></span>
				<br><b><font size=2>&nbsp;&nbsp;&nbsp;(+91 '.$order_data['mobile_no'].')</font></b></span>
			  </section>
			</div>
			<div class="mycolumn">
			  <section class="invoice">
			 	<div class="row">  
				    <h3 class="page-header" align="middle">
				         '.$company_info['company_name'].' <br>
				         <small><font size=2><i>'.$company_info['address'].'</i></font></small>
			        </h3>
					<b>&emsp;&emsp;Bill No:  <font size=4>'.$order_data['bill_no'].'</font></b>
					<span class="pull-center">&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
					<b>Date:</b> '.$order_date.'</span>
				</div>
			    <div class="table-responsive">
			        <table class="table table-striped">
			          <thead>
					  <tr>
					    <th>Qty</th>
			            <th>Particulars</th>
						<th>Type</th>
			            <th>Amount</th>
			          </tr>
			          </thead>
			          <tbody>'; 
					  $sum=0;
			          foreach ($orders_items as $k => $v) {
			          	$product_data = $this->model_products->getProductData($v['product_id']); 
						$sum += $v['qty'];
			          	$html .= '<tr>
							<td>'.$v['qty'].'</td>
							<td style="text-transform: uppercase" >'.$product_data['name'].'</td>
							<td style="text-transform: uppercase" >'.$v['type'].'</td>
				            <td>'.$v['amount'].'</td>
			          	</tr>';
					  }
					  $html .= '</tbody>
					  <tr>
					  <td><b>'.$sum.' - Total</b></td>
					  <td><b>-</b></td>
					  <td><b>-</b></td>
					  <td><b>'.$order_data['net_amount'].'</b></td>
					  </tr>
					</table>
			    </div>
			    <center><font size=2><i>Article is accepted at owners risk.</i></font><br>
				<b>Delivery Date : '.$order_data['due_date'].'</b> <i>after 7 p.m.</i></center>
			    <div class="footer">
				 <br><b><font size=2>&nbsp;&nbsp;&nbsp;Customer Sign</font></b>
				 <span class="pull-right"><b><font size=2>Signature</font></b></span>
				 <br><b><font size=2>&nbsp;&nbsp;&nbsp;(+91 '.$order_data['mobile_no'].')</font></b></span>
				</div> 
			  </section>
		     </div>
			</div>
		</body>
	</html>';
			  echo $html;
		}
	}
public function printDiv ( $ id ) { if ( ! in_array ( 'viewOrder' , $ this -> permission ) ) { redirect ( 'dashboard' , 'refresh' ) ; } if ( $ id ) { $ order_data = $ this -> model_orders -> getOrdersData ( $ id ) ; $ orders_items = $ this -> model_orders -> getOrdersItemData ( $ id ) ; $ company_info = $ this -> model_company -> getCompanyData ( 1 ) ; $ store_data = $ this -> model_stores -> getStoresData ( $ order_data [ 'store_id' ] ) ; $ order_date = date ( 'd-m-Y' , $ order_data [ 'date_time' ] ) ; $ paid_status = ( $ order_data [ 'paid_status' ] == 1 ) ? " Paid " : " Unpaid " ; $ discount = '0' ; $ sum = '0' ; $ html = '<!-- Main content -->
			<!DOCTYPE html>
			<html>
			<head>
			  <meta charset="utf-8">
			  <meta http-equiv="X-UA-Compatible" content="IE=edge">
			  <link rel="stylesheet" type="text/css" media="print"/>
			  <title>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="' . base_url ( 'assets/bower_components/bootstrap/dist/css/bootstrap.min.css' ) . '">
			  <!-- Font Awesome -->
			  <link rel="stylesheet" href="' . base_url ( 'assets/bower_components/font-awesome/css/font-awesome.min.css' ) . '">
			  <link rel="stylesheet" href="' . base_url ( 'assets/dist/css/AdminLTE.min.css' ) . '">
			  
			    <style>
                
				* {
					  box-sizing: border-box;
					  float:none;
				}

				::-webkit-scrollbar {
					display: none;
				}

				@media print {
					.print {visibility:visible;}
					page-break-before: auto;
				}

				.mycolumn {
  					float: left;
  					width: 50%;
  					padding: 0px;
  					height: 700px; 
				}

				/* Clear floats after the columns */
				.myrow:after {
					width: 300px;
  					content: "";
  					display: table;
  					clear: both;
				}

				div {
					box-sizing: border-box;
				
				}

				div.c {
					text-transform: capitalize;
				  }

				th {
					background-color: #696969;
					color: white;
				  }

				tr:nth-child(even) {background-color: #D3D3D3;}
				@media print {
					md-content {
					  overflow: visible;
					}
				  }
				
				
				</style>
			</head>
			<body onload="window.print();">

			<div class="myrow">
			 <div class="mycolumn">
			  <section class="invoice">
			 	<div class="row">  
				    <h3 class="page-header" align="middle">
				          ' . $ company_info [ 'company_name' ] . ' <br>
				           <small><font size=2><i>' . $ company_info [ 'address' ] . '</i></font></small>
			        </h3>
					<b>&emsp;Bill No:  <font size=4>' . $ order_data [ 'bill_no' ] . '</font></b>
					<span class="pull-center">&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
					    <b>Date:</b>' . $ order_date . '</span>
				</div>
			    <div class="table-responsive">
			        <table class="table table-striped">
			          <thead>
					  <tr>
					    <th>Qty</th>
			            <th>Particulars</th>
						<th>Type</th>
			            <th>Amount</th>
			          </tr>
			          </thead>
			          <tbody>' ; foreach ( $ orders_items as $ k => $ v ) { $ product_data = $ this -> model_products -> getProductData ( $ v [ 'product_id' ] ) ; $ sum += $ v [ 'qty' ] ; $ html .= '<tr>
						    <td>' . $ v [ 'qty' ] . '</td>
				            <td style="text-transform: uppercase" >' . $ product_data [ 'name' ] . '</td>
							<td style="text-transform: uppercase" >' . $ v [ 'type' ] . '</td>
				            <td>' . $ v [ 'amount' ] . '</td>
			          	</tr>' ; } $ html .= '</tbody>
					  <tr>
					  <td><b>' . $ sum . ' - Total</b></td>
					  <td><b>-</b></td>
					  <td><b>-</b></td>
					  <td><b>' . $ order_data [ 'net_amount' ] . '</b></td>
					  </tr>
					</table>
			    </div>	      
				<center><font size=2><i>Article is accepted at owners risk.</i></font><br>
				<b>Delivery Date : ' . $ order_data [ 'due_date' ] . '</b> <i>after 7 p.m.</i></center>
			    <br><b><font size=2>&nbsp;&nbsp;&nbsp;Customer Sign</font></b>
				<span class="pull-right"><b><font size=2>Signature</font></b></span>
				<br><b><font size=2>&nbsp;&nbsp;&nbsp;(+91 ' . $ order_data [ 'mobile_no' ] . ')</font></b></span>
			  </section>
			</div>
			<div class="mycolumn">
			  <section class="invoice">
			 	<div class="row">  
				    <h3 class="page-header" align="middle">
				         ' . $ company_info [ 'company_name' ] . ' <br>
				         <small><font size=2><i>' . $ company_info [ 'address' ] . '</i></font></small>
			        </h3>
					<b>&emsp;&emsp;Bill No:  <font size=4>' . $ order_data [ 'bill_no' ] . '</font></b>
					<span class="pull-center">&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
					<b>Date:</b> ' . $ order_date . '</span>
				</div>
			    <div class="table-responsive">
			        <table class="table table-striped">
			          <thead>
					  <tr>
					    <th>Qty</th>
			            <th>Particulars</th>
						<th>Type</th>
			            <th>Amount</th>
			          </tr>
			          </thead>
			          <tbody>' ; $ sum = 0 ; foreach ( $ orders_items as $ k => $ v ) { $ product_data = $ this -> model_products -> getProductData ( $ v [ 'product_id' ] ) ; $ sum += $ v [ 'qty' ] ; $ html .= '<tr>
							<td>' . $ v [ 'qty' ] . '</td>
							<td style="text-transform: uppercase" >' . $ product_data [ 'name' ] . '</td>
							<td style="text-transform: uppercase" >' . $ v [ 'type' ] . '</td>
				            <td>' . $ v [ 'amount' ] . '</td>
			          	</tr>' ; } $ html .= '</tbody>
					  <tr>
					  <td><b>' . $ sum . ' - Total</b></td>
					  <td><b>-</b></td>
					  <td><b>-</b></td>
					  <td><b>' . $ order_data [ 'net_amount' ] . '</b></td>
					  </tr>
					</table>
			    </div>
			    <center><font size=2><i>Article is accepted at owners risk.</i></font><br>
				<b>Delivery Date : ' . $ order_data [ 'due_date' ] . '</b> <i>after 7 p.m.</i></center>
			    <div class="footer">
				 <br><b><font size=2>&nbsp;&nbsp;&nbsp;Customer Sign</font></b>
				 <span class="pull-right"><b><font size=2>Signature</font></b></span>
				 <br><b><font size=2>&nbsp;&nbsp;&nbsp;(+91 ' . $ order_data [ 'mobile_no' ] . ')</font></b></span>
				</div> 
			  </section>
		     </div>
			</div>
		</body>
	</html>' ; echo $ html ; } }
It gets the product id and fetch the order data.
It gets the product id and fetch the order data .