<!-- Script PHP/MYSQL of management of classifieds ads developed by Script PAG Script PAG all rights reserved. Use under license. http://www.script-pag.com -->
<div class="container-100">
	<div class="container-100-child account-invoices">
	
		<h1><?php echo $info_page; ?></h1>
		
		<div class="not-mobile">
			<div class="flex-container">
				<p><?php echo  $language['title_inc_1']; ?></p>
				<p><?php echo  $language['title_inc_2']; ?></p>
				<p><?php echo  $language['title_inc_3']; ?></p>
				<p><?php echo  $language['title_inc_4']; ?></p>
			</div>
				
			<?php
				
			$i = 0;
			
			foreach($invoices as $v)
			{
				$id_inv = (int) $v['id_inv'];
				$id_acc = (int) $v['id_acc'];
				$id_ad = (int) $v['id_ad'];
				$url = stripslashes(htmlspecialchars($v['url']));
				$price = (float) $v['price'];
				$price_vat = (float) $v['price_vat'];
				$price_total = $price + $price_vat;
				$price_total = number_format($price_total, 2, ',', ' ');
				
				if(!empty($url)) {
					$date = explode('/', $url);
					$date = $date[3] .'/'. $date[2] .'/'. $date[1];
				} else
					$date = date(($_SESSION['code_lang'] == 'en' ? 'm/d/Y' : 'd/m/Y'), strtotime($v['created']));
				
				$class_invoices = $i%2 == 1 ? 'background' : '';
				
				$invoice_url = !empty($url) ? URL .'/'. $url .'/'. $id_acc .'-'. $id_inv .'.php' : URL.'/invoice.php?i='.md5($id_inv.$id_acc.$id_ad.(!empty($v['price_vat']) ? (float) $v['price_vat'] : 0).((float) $v['price']));
				
				echo '<div class="flex-container '. $class_invoices .'">';
				echo '<p>'. $date .'</p>';
				echo '<p>'. $id_inv .'</p>';
				echo '<p>'. $price_total .' '. $param_gen['currency'] .'</p>';
				echo '<p><a onclick="window.open(this.href); return false;" href="'.$invoice_url.'"><strong>'. $language['account_dashboard_inc_number'] .'</strong></a></p>';
				echo '</div>';
				
				$i++;
			}
		
			?>
		</div>
		
		<div class="mobile">
			<?php
				
			$i = 0;
			
			foreach($invoices as $v)
			{
				$id_inv = (int) $v['id_inv'];
				$id_acc = (int) $v['id_acc'];
				$url = stripslashes(htmlspecialchars($v['url']));
				$price = (float) $v['price'];
				$price_vat = (float) $v['price_vat'];
				$price_total = $price + $price_vat;
				$price_total = number_format($price_total, 2, ',', ' ');
				
				if(!empty($url)) {
					$date = explode('/', $url);
					$date = $date[3] .'/'. $date[2] .'/'. $date[1];
				} else
					$date = date(($_SESSION['code_lang'] == 'en' ? 'm/d/Y' : 'd/m/Y'), strtotime($v['created']));
				
				$class_invoices = $i%2 == 1 ? 'background' : '';
				
				$invoice_url = !empty($url) ? URL .'/'. $url .'/'. $id_acc .'-'. $id_inv .'.php' : URL.'/invoice.php?i='.md5($id_inv.$id_acc.$id_ad.(!empty($v['price_vat']) ? (float) $v['price_vat'] : 0).((float) $v['price']));
				
				echo '<div>';
				echo '<p class="title">'. $language['title_inc_1'] .'</p>';
				echo '<p>'. $date .'</p>';
				echo '<p class="title">'. $language['title_inc_2'] .'</p>';
				echo '<p>'. $id_inv .'</p>';
				echo '<p class="title">'. $language['title_inc_3'] .'</p>';
				echo '<p>'. $price_total .' '. $param_gen['currency'] .'</p>';
				echo '<p class="title">'. $language['title_inc_4'] .'</p>';
				echo '<p><a href="'.$invoice_url.'" target="_blank">'. $language['account_dashboard_inc_number'] .'</a></p>';
				echo '</div>';
				
				$i++;
			}
		
			?>
		</div>
		
	</div>
</div>