<?php include('connection/conn.php');
$id=$_GET['c_id'];

$get="select * from `company` where   `company_id`=$id";
$get_r=$conn->query($get);
$get_row=mysqli_fetch_array($get_r);

$name=$get_row['company_name'];


?>
<html>
	<head>
		<style>
		@media print {body {-webkit-print-color-adjust: exact;}}
		</style>
	</head>
	<body style="font-family: nrt;">
		<div style="width:750px"  id="right">
			<table dir=rtl id="mydiv" height="" width="100%" border=0>
				<tr>
					<td width=325px style="font-size:11pt">
						<center>
						<font style="font-size:14pt">کۆگای شاهۆ بەرزنجی</font><br>
						بۆ بازرگانی جل و بەرگ<br>
						بە تاک و بە کۆ
						</center>
					</td>
					
					<td style="text-align:left"  width=100px>
					<img src="icon/logo.jpg" width="100">
					<font style="font-size:14pt">کشف حساب</font>
					</td>
					<td width=325px style="font-size:11pt">
						<center>
						<font style="font-size:14pt">SB Store</font><br>
						
						
						</center>
					</td>
				</tr>
				</table>
				<br>
			<table dir=rtl id="mydiv" height="" width="740px" border=0 style="font-size:16pt">
				<tr style="text-align:right" bgcolor="#f0f0f0">
					<th width=350px>کۆمپانیای : <?php echo $name;?></th>
					
				</tr>
			</table>
			
			<br>
			
			<table style="text-align:center;font-size:10pt" bgcolor="#d1eaf0" id='mydiv' width='740px' dir=rtl align="center">					
				<tr bgcolor="#708090" style="color:#ffffff">
					<td>مامەڵە</td>
					<td>بەروار</td>
					
					
					<td>بڕی پارە</td>
					<td>باقی پارە</td>
				</tr>
				<?php
				$count=1;
				
				$get2="select * from `company_inv` where  `company`=$id order by `date`";
				$get_r2=$conn->query($get2);
				$sum=0;
				while($get_row2=mysqli_fetch_array($get_r2))
				{ 
				if($count%2==0) $col="#f9f9f9"; else $col="white"; 
				$count++;
					$type=$get_row2['inv_type'];
					if($type=="p")
					{
						
					?>
						
						
						<tr bgcolor="<?php echo $col;?>">
							<th style="color:#7A7DCE">ناردن</th>
							<td style="color:#bb141c;background-color:#f0f0f0; font-size:8pt"><?php echo $get_row2['date'];?></td>
							<td><?php echo number_format($a=$get_row2['amount'],0); $sum+=$a;?></td>
							
							
							<td><?php echo number_format($sum,0); ?> </td>
							
						</tr>
						<?php //}
					}
					elseif($type=="g")
					{
						
					?>
						<tr bgcolor="<?php echo $col;?>">
							<th style="color:green">ڕاکێشان</th>
							<td style="color:#bb141c;background-color:#f0f0f0;font-size:8pt"><?php echo $get_row2['date'];?></td>
							
							<th dir=ltr style="color:#bb141c" bgcolor="#cccccc"><?php echo number_format($a=$get_row2['amount'],0); $sum-=$a;?></th>
							<th dir=ltr bgcolor="#a9a9a9"> <?php echo number_format($sum,0);?></th>
						</tr>
					<?php
					}
					
					
				
					
				
					
				}?>
				<tr bgcolor="#f9f9f9">
					
					<th colspan=2>کۆی گشتی باقی پارە</th>
					<th><?php if($sum<0) echo "ماوە لای ئێمە"; elseif($sum>0) echo "ماوە لای ئەوان";?></th>
					<th dir=ltr style="color:#ffffff" bgcolor="#708090"> <?php echo number_format($sum,0);?></th>
					
				</tr>
			</table>
			<br>
			
		</div>
	</body>
</html>


