

<table id="suspended_sales_table" style="border:1px solid #051387;box-shadow: 0px 8px 8px #000;" width="100%">
	<tr>
		<th>Time</th>
		<th>Customer Name</th>
		<th>Total Qty</th>
		<th>Total Amount</th>
		<th>Items List</th>
		<th>Comment</th>
		<th>Action</th>
	</tr>
	
	<?php

	$loop=1;
	foreach ($suspended_sales as $suspended_sale)
	{
		$show_comments="&nbsp;";
		if(trim($suspended_sale['comment'])=='0'){
			$show_comments="&nbsp;";
		}else{
			$show_comments=trim($suspended_sale['comment']);
		}

		if($loop%2){
			$td_back_style="background-color:#C9FAFF;";
		}else{
			$td_back_style="background-color:#FFF9E1;";
		}
		$loop++;

		$datetime1 = new DateTime($suspended_sale['sale_time']);
		$datetime2 = new DateTime(date("Y-m-d H:i:s"));
		$interval = $datetime1->diff($datetime2);
		$time_ago=$interval->format('%h')." H ".$interval->format('%i')." M ".$interval->format('%s')." S Ago";

		$item_count=0;
		$item_price=0;
		$item_details=array();

		foreach ($suspended_sales_details[$suspended_sale['sale_id']] as $key => $value) {

			$sub_arrary=explode("</br>",$value['description']);
			if(trim($sub_arrary[1])){
				$item_details[]=str_replace(" - ","-",$sub_arrary[1]);
			}else{
				$item_details[]=str_replace(" - ","-",$sub_arrary[0]);
			}
			$item_count+=$value['quantity_purchased'];
			$item_price+=$value['quantity_purchased']*$value['item_cost_price'];
		}

	?>
		<tr>
			<td style="text-align:center;border:1px solid #00ff34; <?php echo $td_back_style;?>"><?php echo date('h:i:s A',strtotime($suspended_sale['sale_time']))."</br><b>".$time_ago."<b>";?></td>
			
			<td style="text-align:center;border:1px solid #00ff34; <?php echo $td_back_style;?>">
				<?php
				if (isset($suspended_sale['customer_id']))
				{
					$customer = $this->Customer->get_info($suspended_sale['customer_id']);
					echo $customer->first_name. ' '. $customer->last_name;
				}
				else
				{
				?>
					&nbsp;
				<?php
				}
				?>
			</td>
			<td style="text-align:center;border:1px solid #00ff34;font-weight:bold; <?php echo $td_back_style;?>"><?php echo $item_count;?></td>
			<td style="text-align:center;border:1px solid #00ff34;font-weight:bold; <?php echo $td_back_style;?>"><?php echo $item_price;?></td>
			<td style="text-align:center;border:1px solid #00ff34; <?php echo $td_back_style;?>"><?php echo implode($item_details,"</br>");?></td>
			
			<td style="text-align:center;border:1px solid #00ff34; <?php echo $td_back_style;?>"><?php echo $show_comments;?></td>
			<td style="text-align:center;border:1px solid #00ff34; <?php echo $td_back_style;?>">
				<?php 
				echo form_open('sales/unsuspend');
				echo form_hidden('suspended_sale_id', $suspended_sale['sale_id']);
				?>
				<input type="submit" name="submit" value="<?php echo "Restore"; ?>" id="submit" class="button_thickbox_small button_thickbox_blue"></td>
				</form>
		</tr>
	<?php
	}

	?>
	
</table>