<?php require admin_view('static/header') ?>

<div class="container-fluid">

	<div class="row">

		<div class="col-lg-12">

			<ul class="nav nav-tabs p-b">

				<form class="" action="" method="get">

					<li class="pull-right">

						<div class="btn-group" role="group">

						</div>

					</li>
					
					<li class="pull-right" style="margin-left:5px">
						<button type="submit" class="btn btn-primary">
							Filtreyi Güncelle
						</button>
						<a href="<?= admin_url('reports') ?>"  class="btn btn-primary">
							Filtreyi Sıfırla
						</a>
					</li>

					<li class="pull-right">

						<select class="selectpicker" data-actions-box="true" data-live-search="true" name="services[]" multiple="" data-max-options="100" data-size="10" title="Servisler" tabindex="-98">



							<?php foreach ($servisler as $servis) {

								$service_name = json_decode($servis['service_name'],1);



								?>

								<option value="<?= $servis['service_id']?>" selected=""><?= $service_name[0]['name'];?> </option>

								<?php

							} ?>   

						</select>

					</li>
					<?php
					function status_sor($status){
						$statusesss = isset($_GET['statuses']) ? $_GET['statuses'] : array();
						if(count($statusesss) == 0){
							return true;
						}else{
							return in_array($status, $statusesss) ? true : false;
						}
					}
					?>
					<li class="pull-right"  style="margin-right:5px">
						<select class="selectpicker"  name="statuses[]" multiple="" data-max-options="100" data-size="10" title="Sipariş Durumu" tabindex="-98">
							<option value="Pending" <?=status_sor("Pending") ? 'selected=""' : ''?>>Cron bekleniyor</option>
							<option value="Fail"  <?=status_sor("Fail") ? 'selected=""' : ''?>>Fail</option>
							<option value="Pending"  <?=status_sor("Pending") ? 'selected=""' : ''?>>Sipariş alındı</option>
							<option value="In progress"  <?=status_sor("In progress") ? 'selected=""' : ''?>>Yükleniyor</option>
							<option value="Completed"  <?=status_sor("Completed") ? 'selected=""' : ''?>>Tamamlandı</option>
							<option value="Processing"  <?=status_sor("Processing") ? 'selected=""' : ''?>>İşlemde</option>
							<option value="Partial"  <?=status_sor("Partial") ? 'selected=""' : ''?>>Kısmen Tamamlandı</option>
							<option value="Canceled"  <?=status_sor("Canceled") ? 'selected=""' : ''?>>İptal</option>
						</select>
					</li>
				</form>
			</ul>
		</div>

		<div class="col-md-12">
			<table class="table report-table" style="border:1px solid #ddd">
				<thead>

					<tr>

						<th>

						</th>

						<th align="right" style="text-align:center;">Ocak</th>

						<th align="right" style="text-align:center;">Şubat</th>

						<th align="right" style="text-align:center;">Mart</th>

						<th align="right" style="text-align:center;">Nisan</th>

						<th align="right" style="text-align:center;">Mayıs</th>

						<th align="right" style="text-align:center;">Haziran</th>

						<th align="right" style="text-align:center;">Temmuz</th>

						<th align="right" style="text-align:center;">Ağustos</th>

						<th align="right" style="text-align:center;">Eylül</th>

						<th align="right" style="text-align:center;">Ekim</th>

						<th align="right" style="text-align:center;">Kasım</th>

						<th align="right" style="text-align:center;">Aralık</th>

					</tr>

				</thead>

				<tbody>

					<?php for ($i=1; $i <=31 ; $i++) { ?>

					<tr>

						<td align="center"><?= $i ?></td>

						<td align="center">

							<?php if(is_array($aygun[2022][1]) && $aygun[2022][1][$i]){echo $aygun[2022][1][$i];}else{echo "0.00";} ?>

						</td>

						<td align="center">

							<?php if(is_array($aygun[2022][2]) && $aygun[2022][2][$i]){echo $aygun[2022][2][$i];}else{echo "0.00";} ?>

						</td>

						<td align="center">

							<?php if(is_array($aygun[2022][3]) && $aygun[2022][3][$i]){echo $aygun[2022][3][$i];}else{echo "0.00";} ?>

						</td>

						<td align="center">

							<?php if(is_array($aygun[2022][4]) && $aygun[2022][4][$i]){echo $aygun[2022][4][$i];}else{echo "0.00";} ?>

						</td>

						<td align="center">

							<?php if(is_array($aygun[2022][5]) && $aygun[2022][5][$i]){echo $aygun[2022][5][$i];}else{echo "0.00";} ?>

						</td>

						<td align="center">

							<?php if(is_array($aygun[2022][6]) && $aygun[2022][6][$i]){echo $aygun[2022][6][$i];}else{echo "0.00";} ?>

						 </td>

						<td align="center">

							<?php if(is_array($aygun[2022][7]) && $aygun[2022][7][$i]){echo $aygun[2022][7][$i];}else{echo "0.00";} ?>

						</td>

						<td align="center">

							<?php if(is_array($aygun[2022][8]) && $aygun[2022][8][$i]){echo $aygun[2022][8][$i];}else{echo "0.00";} ?>

						</td>

						<td align="center">

							<?php if(is_array($aygun[2022][9]) && $aygun[2022][9][$i]){echo $aygun[2022][9][$i];}else{echo "0.00";} ?>

						</td>

						<td align="center">

							<?php if(is_array($aygun[2022][10]) && $aygun[2022][10][$i]){echo $aygun[2022][10][$i];}else{echo "0.00";} ?>

						</td>

						<td align="center">

							<?php if(is_array($aygun[2022][11]) && $aygun[2022][11][$i]){echo $aygun[2022][11][$i];}else{echo "0.00";} ?>

						</td>

						<td align="center">

							<?php if(is_array($aygun[2022][12]) && $aygun[2022][12][$i]){echo $aygun[2022][12][$i];}else{echo "0.00";} ?>

						</td>

					</tr>

					<?php } ?> 

					<tr>

						<td align="center"><b>Brüt Kazanç: </b></td>

						<td align="center">

							<b>  <?php if(is_array($aygun[2022][1])){echo array_sum($aygun[2022][1]);}else{echo "0.00";} ?>  </b>

						</td>

						<td align="center">

							<b> <?php if(is_array($aygun[2022][2])){echo array_sum($aygun[2022][2]);}else{echo "0.00";} ?> </b>

						</td>

						<td align="center">

							<b> <?php if(is_array($aygun[2022][3])){echo array_sum($aygun[2022][3]);}else{echo "0.00";} ?>  </b>

						</td>

						<td align="center">

							<b> <?php if(is_array($aygun[2022][4])){echo array_sum($aygun[2022][4]);}else{echo "0.00";} ?>  </b>

						</td>

						<td align="center">

							<b> <?php if(is_array($aygun[2022][5])){echo array_sum($aygun[2022][5]);}else{echo "0.00";} ?> </b>

						</td>

						<td align="center">

							<b> <?php if(is_array($aygun[2022][6])){echo array_sum($aygun[2022][6]);}else{echo "0.00";} ?> </b>

						</td>

						<td align="center">

							<b>  <?php if(is_array($aygun[2022][7])){echo array_sum($aygun[2022][7]);}else{echo "0.00";} ?> </b>

						</td>

						<td align="center">

							<b>  <?php if(is_array($aygun[2022][8])){echo array_sum($aygun[2022][8]);}else{echo "0.00";} ?> </b>

						</td>

						<td align="center">

							<b>  <?php if(is_array($aygun[2022][9])){echo array_sum($aygun[2022][9]);}else{echo "0.00";} ?></b>

						</td>

						<td align="center">

							<b>  <?php if(is_array($aygun[2022][10])){echo array_sum($aygun[2022][10]);}else{echo "0.00";} ?> </b>

						</td>

						<td align="center">

							<b>  <?php if(is_array($aygun[2022][11])){echo array_sum($aygun[2022][11]);}else{echo "0.00";} ?> </b>

						</td>

						<td align="center">

							<b>  <?php if(is_array($aygun[2022][12])){echo array_sum($aygun[2022][12]);}else{echo "0.00";} ?> </b>

						</td>

					</tr>

					<tr>

						<td align="center"><b>Net Kazanç: </b></td>

						<td align="center">

							<b>  <?php if(is_array($aygun[2022][1])){echo array_sum($apigun[2022][1]);}else{echo "0.00";} ?>  </b>

						</td>

						<td align="center">

							<b> <?php if(is_array($aygun[2022][2])){echo array_sum($apigun[2022][2]);}else{echo "0.00";} ?> </b>

						</td>

						<td align="center">

							<b> <?php if(is_array($aygun[2022][3])){echo array_sum($apigun[2022][3]);}else{echo "0.00";} ?>  </b>

						</td>

						<td align="center">

							<b> <?php if(is_array($aygun[2022][4])){echo array_sum($apigun[2022][4]);}else{echo "0.00";} ?>  </b>

						</td>

						<td align="center">

							<b> <?php if(is_array($aygun[2022][5])){echo array_sum($apigun[2022][5]);}else{echo "0.00";} ?> </b>

						</td>

						<td align="center">

							<b> <?php if(is_array($aygun[2022][6])){echo array_sum($apigun[2022][6]);}else{echo "0.00";} ?> </b>

						</td>

						<td align="center">

							<b>  <?php if(is_array($aygun[2022][7])){echo array_sum($apigun[2022][7]);}else{echo "0.00";} ?> </b>

						</td>

						<td align="center">

							<b>  <?php if(is_array($aygun[2022][8])){echo array_sum($apigun[2022][8]);}else{echo "0.00";} ?> </b>

						</td>

						<td align="center">

							<b>  <?php if(is_array($aygun[2022][9])){echo array_sum($apigun[2022][9]);}else{echo "0.00";} ?></b>

						</td>

						<td align="center">

							<b>  <?php if(is_array($aygun[2022][10])){echo array_sum($apigun[2022][10]);}else{echo "0.00";} ?> </b>

						</td>

						<td align="center">

							<b>  <?php if(is_array($aygun[2022][11])){echo array_sum($apigun[2022][11]);}else{echo "0.00";} ?> </b>

						</td>

						<td align="center">

							<b>  <?php if(is_array($aygun[2022][12])){echo array_sum($apigun[2022][12]);}else{echo "0.00";} ?> </b>

						</td>

					</tr>

				</tbody>

			</table>

		</div>

	</div>

</div>

<?php require admin_view('static/footer') ?>