<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\ListView;
use yii\base\Widget;

/* @var $this yii\web\View */
/* @var $searchModel common\models\TransferSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t ( 'frontend/transfer', 'Product sale detailed' );
$this->params ['breadcrumbs'] [] = $this->title;
?>
<style>
.dl-transfer {
	margin-bottom: 0px;
}

.item-transfer {
	border: 1px solid #b4b4b4;
	margin-top: 12px;
	padding-top: 6px;
	padding-bottom: 6px;
}

td.count, td.money {
	text-align: right;
}

td.name {
	width: 600px;
}

.table-category-product td.name {
	width: 600px;
}

.table-category-product td.count {
	text-align: right;
}

.table-category-product td.money {
	text-align: right;
}
</style>

<div class="transfer-index">

	<h1><?= Html::encode($this->title) ?></h1>
    <?php   echo $this->render('_search_sale', ['model' => $searchModel]); ?>
    <?php   echo $this->render('_export_btn_sale', ['model' => $searchModel]); ?>


	<div>
		<?php
		// ////////////////////////
		// Termék eladás
		// //////////////////////
		?>
		<h3>Termék eladások</h3>
		<div class="row">
			<div class="col-md-12 text-right" style="text-decoration: underline;">
			    				Összesen: <?php	echo $searchModel->productMoney;	?> Ft
			</div>
		</div>
		<table class="table table-bordered table-striped table-summary">
			<thead>
				<tr>
					<th>Tranzakció</th>
					<th>Kiadva</th>
					<th>Fizetve</th>
					<th>Kassza</th>
					<th>Felhasználó</th>
					<th>Vásárló</th>
					<th>Kategória</th>
					<th>Termék</th>
					<th>Egység ár</th>
					<th>Mennyiség</th>
					<th>Összeg</th>
				</tr>
			</thead>
			<tbody>
		    	<?php foreach ($searchModel->products as $p ){?>
			    	<tr>
						<td><?php echo "#".$p['id_transfer']?> </td>
						<td><?php echo $p['product_created_at']?> </td>
						<td><?php echo $p['product_paid_at']?> </td>
						<td><?php echo $p['account_name']?> </td>
						<td><?php echo $p['user_name']?> </td>
						<td><?php echo $p['customer_name']?> </td>
						<td><?php echo $p['product_category_name'] ?></td>
						<td><?php echo $p['product_name'] ?></td>
						<td class='money'><?php echo $p['product_item_price']?> Ft</td>
						<td class='count'><?php echo $p['product_count']?> Db</td>
						<td class='money'><?php echo $p['product_money']?> FT</td>
	
					</tr>
		    	<?php } ?>
			</tbody>
		</table>
						<?php
						
				if (count ( $searchModel->products ) == 0) {
											?>
										Nincs találat
										<?php
										} 
							?>
					</div>





</div>
