<?php defined('BASEPATH') OR exit('No direct script access allowed');
$from_date = isset($from_date) ? format_date($from_date) :'';
$to_date = isset($to_date) ? format_date($to_date): '';
if(!empty($branchName)) {
	$branchName = (!empty($branchName) && $branchName == 'All Branches') ? '' : $branchName;
}
$currency_symbol = get_company('symbol');
 ?>
 <table  border="0"  cellspacing="0" cellpadding="0" style="width:100%;table-layout:fixed;" class="pdf_head">
			<tr>
				
				<td style="width:100%;text-align:center;font-size:17px;">
				<?php if(!empty($heading)) { echo $heading.'<br>'; } ?>
				DayBoard<br>
				<?php if(!empty($branchName)) { ?> 
							<span style="font-weight:normal;font-size:16px;"><?php echo $branchName; ?></span>
					<br>
				<?php } ?>
				<?php if($from_date && $to_date && ($from_date != $to_date)){ ?>
					
					<span style="font-weight:normal;font-size:15px;"><?php echo $from_date.'&nbsp;-&nbsp;'.$to_date ; ?></span>
					
					<?php }else{?>
						<span style="font-weight:normal;font-size:10px;"><?php echo $to_date ; ?></span>
					<?php } ?>
				</td>
			</tr>
</table>
<br>
<table width="100%"  cellspacing ="1" cellpadding ="1" border="0">
	<tbody>
	<tr><td width="50%" class="tc bod">Sales invoices</td><td width="50%" class="tc bod">Purchase Bills/Expense</td></tr>
	<tr>
	<td width="50%" >
		<table width="100%"  class= "content" cellspacing ="0" cellpadding ="0">
		<tbody>
		<?php
		foreach($paymodetot as $pay){?>
		<tr>
		<td><?php echo $pay['name'];?></td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$pay['salRec'] ?></td>
		</tr>
		<?php } ?>
		<!--<tr>
		<td>Bank</td>
		<td class="ta"><?php //echo $currency_symbol.'&nbsp;'.$salesBank ?></td>
		</tr>-->
		<tr>
		<td>Advance</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$AdvAmt ?></td>
		</tr>
		<tr>
		<td>Credit</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$salesCredit ?></td>
		</tr>
		<tr>
		<td ><b>Total Invoices
		<?php if(!empty($cntSales)) {?>
		<span>(<?php echo($cntSales) ?>)</span>
		<?php } ?>
		</b>
		</td>
		<td class="ta"><b><?php echo $currency_symbol.'&nbsp;'.$salesTotal ?></b></td>
		</tr>
		</tbody>
		</table>
	</td>
	<td width="50%">
		<table width="100%"  class= "content" cellspacing ="0" cellpadding ="0">
		<tbody>
		<?php
		foreach($paymodetot as $pay){?>
		<tr>
		<td><?php echo $pay['name'];?></td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$pay['purPay'] ?></td>
		</tr>
		<?php } ?>
		<!--<tr>
		<td>Bank</td>
		<td class="ta"><?php //echo $currency_symbol.'&nbsp;'.$purBank ?></td>
		</tr>-->
		<tr>
		<td>Advance</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$purAdv ?></td>
		</tr>
		<tr>
		<td>Credit</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$purCredit ?></td>
		</tr>
		<tr>
		<td><b>Total Bills
		<?php if(!empty($cntPur)) {?>
		<span>(<?php echo($cntPur) ?>)</span>
		<?php } ?></b>
		</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$purTotal ?></td>
		</tr>
		</tbody>
		</table>
	</td>
	</tr>
	<tr>
		<tr><td width="50%" class="tc bod">Cash</td><td width="50%" class="tc bod">Outstandings</td></tr>
		<tr>
		<td width="50%">
			<table  width="100%" cellspacing ="0" class= "content" cellpadding ="0" style="margin-left: 30px !important;">
		<tbody>
		<tr>
		<td>Opening</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$open ?></td>
		</tr>
		<tr>
		<td>Closing</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$close ?></td>
		</tr>
		</tbody>
		</table>
		</td>
		<td width="50%">
			<table  width="100%" cellspacing ="0" class= "content" cellpadding ="0" style="margin-left: 30px !important;">
		<tbody>
		<tr>
		<td>Receivables</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$OutstandingReceivable ?></td>
		</tr>
		<tr>
		<td>Payables</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$OutstandingPayable ?></td>
		</tr>
		</tbody>
		</table>
		</td>
	</tr>
	<tr>
	<?php if ((!empty($receiptCreditbyCash) && $receiptCreditbyCash !='0.00') || (!empty($receiptCreditbyBank) && $receiptCreditbyBank !='0.00') || (!empty($receiptAdvancebyCash) && $receiptAdvancebyCash !='0.00') || (!empty($receiptAdvancebyBank) && $receiptAdvancebyBank !='0.00') || (!empty($salesCash) && $salesCash !='0.00') || (!empty($salesBank) && $salesBank !='0.00')){ ?>
	<td  width="50%" class="tc bod">Receipts</td>
	<?php } ?>
	<?php if((!empty($payDuesByCash) && $payDuesByCash !='0.00') || (!empty($payDuesByBank) && $payDuesByBank !='0.00') || (!empty($payOthersByCash) && $payOthersByCash !='0.00') ||(!empty($payOthersbyBank) && $payOthersbyBank !='0.00') || (!empty($expenseBank) && $expenseBank !='0.00') || (!empty($expenseBank) && $expenseBank !='0.00')) {?>
	<td  width="50%" class="tc bod">Payments</td>
	<?php } ?>
	</tr>
	<tr>
	<td width="50%">
			<table width="100%"  class= "content" cellspacing ="0" cellpadding ="0">
	<tbody>
		<?php if (!empty($salesCash) && $salesCash !='0.00'){?>
		<tr>
		<td>Cash (Sales)</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$salesCash ?></td>
		</tr>
		<?php } ?>
		<?php if (!empty($salesBank) && $salesBank !='0.00'){?>
		<tr>
		<td>Bank(Sales)</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$salesBank ?></td>
		</tr>
		<?php } ?>
		<?php if (!empty($receiptCreditbyCash) && $receiptCreditbyCash !='0.00'){?>
		<tr>
		<td>Cash(Due)</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$receiptCreditbyCash ?></td>
		</tr>
		<?php } ?>
		<?php if (!empty($receiptCreditbyBank) && $receiptCreditbyBank !='0.00'){?>
		<tr>
		<td>Bank(Due)</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$receiptCreditbyBank ?></td>
		</tr>
		<?php } ?>
		<?php if (!empty($receiptAdvancebyCash) && $receiptAdvancebyCash !='0.00'){?>
		<tr>
		<td>Cash (Adv)</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$receiptAdvancebyCash ?></td>
		</tr>
		<?php } ?>
		<?php if (!empty($receiptAdvancebyBank) && $receiptAdvancebyBank !='0.00'){?>
		<tr>
		<td>Bank (Adv)</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$receiptAdvancebyBank ?></td>
		</tr>
		<?php } ?>
		
		<?php if (!empty($receipttotal) && $receipttotal !='0.00'){?>
		<tr>
		<td><b>Total</b></td>
		<td class="ta"><b><?php echo $currency_symbol.'&nbsp;'.$receipttotal ?></b></td>
		</tr>
		<?php } ?>
	</tbody>
</table>
	</td>
	<td width="50%">
		<table width="100%"  class= "content" cellspacing ="0" cellpadding ="0">
	<tbody>
		<?php if (!empty($payDuesByCash) && $payDuesByCash !='0.00'){?>
		<tr>
		<td>Cash(Due)</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$payDuesByCash ?></td>
		</tr>
		<?php } ?>
		<?php if (!empty($payDuesByBank) && $payDuesByBank !='0.00'){?>
		<tr>
		<td>Bank(Due)</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$payDuesByBank ?></td>
		</tr>
		<?php } ?>
		<?php if (!empty($payOthersByCash) && $payOthersByCash !='0.00'){?>
		<tr>
		<td>Cash (Others)</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$payOthersByCash ?></td>
		</tr>
		<?php } ?>
		<?php if (!empty($payOthersbyBank) && $payOthersbyBank !='0.00'){?>
		<tr>
		<td>Bank (Others)</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$payOthersbyBank ?></td>
		</tr>
		<?php } ?>
		<?php if (!empty($expenseCash) && $expenseCash !='0.00'){?>
		<tr>
		<td>Cash (Expense)</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$expenseCash ?></td>
		</tr>
		<?php } ?>
		<?php if (!empty($expenseBank) && $expenseBank !='0.00'){?>
		<tr>
		<td>Bank (Expense)</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$expenseBank ?></td>
		</tr>
		<?php } ?>
		<?php if (!empty($paymenttotal) && $paymenttotal !='0.00'){?>
		<tr>
		<td><b>Total</b></td>
		<td class="ta"><b><?php echo $currency_symbol.'&nbsp;'.$paymenttotal ?></b></td>
		</tr>
		<?php } ?>
	</tbody>
</table>
	</td>
	</tr>
	<tr><td  width="50%" class="tc bod">Discounts</td><td  width="50%" class="tc bod">Sales Orders</td></tr>
	<tr>
	<td width="50%">
		<table width="100%" class= "content" cellspacing ="0" cellpadding ="0">
	<tbody>
		<tr>
		<td>Sales Discount
		<?php if(!empty($discnt)) {?>
		<span>(<?php echo($discnt) ?>)</span>
		<?php } ?>
		</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$discAmount ?></td>
		</tr>
	</tbody>
</table>
		
	</td>
	<td width="50%">
		<table width="100%"  class= "content" cellspacing ="0" cellpadding ="0">
	<tbody>
		<tr>
		<td>Sales Order
		<?php if(!empty($cntSalesOrder)) {?>
		<span>(<?php echo($cntSalesOrder) ?>)</span>
		<?php } ?>
		</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'. $SalesOrderAmt ?></td>
		</tr>
	</tbody>
</table>
	</td>
	</tr>
	<?php if( (!empty($cntDraft)) || (!empty($editCnt)) || (!empty($delCnt)) || (!empty($cntCancel)) || (!empty($cntRateSheet)) || (!empty($salbyRep) && $salbyRep !='0.00') || (!empty($salesCreditNote) && $salesCreditNote !='0.00' )){?>
	<tr>
	<td  width="50%" class="tc bod">Sales Actions</td>
	</tr>
	<?php }?>
	<tr>
		<td width="50%">
			<table  width="100%"  class= "content" cellspacing ="0" cellpadding ="0">
	<tbody>
		<?php if(!empty($cntDraft)){?>
		<tr>
		<td>Draft</td>
		<td class="ta"><?php echo $cntDraft ?></td>
		</tr>
		<?php }?>
		<?php if(!empty($editCnt)){?>
		<tr>
		<td>Edit</td>
		<td class="ta"><?php echo $editCnt ?></td>
		</tr>
		<?php }?>
		<?php if(!empty($delCnt)){?>
		<tr>
		<td>Delete</td>
		<td class="ta"><?php echo $delCnt ?></td>
		</tr>
		<?php }?>
		<?php if(!empty($cntCancel)){?>
		<tr>
		<td>Cancel</td>
		<td class="ta"><?php echo $cntCancel ?></td>
		</tr>
		<?php } ?>
		<?php if(!empty($cntRateSheet)){?>
		<tr>
		<td>Ratesheet</td>
		<td class="ta"><?php echo $cntRateSheet ?></td>
		</tr>
		<?php } ?>
		<?php if(!empty($salbyRep) && $salbyRep !='0.00'){?>
		<tr>
		<td>Sales By Rep</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'. $salbyRep ?></td>
		</tr>
		<?php } ?>
		<?php if(!empty($salesCreditNote) && $salesCreditNote !='0.00' ){?>
		<tr>
		<td>Credit Note</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$salesCreditNote ?></td>
		</tr>
		<?php } ?>
	</tbody>
</table>
		</td>
	</tr>
	</tbody>
</table>
<!--
<td width="50%">
		
		<table  width="100%" cellspacing ="0" class= "content" cellpadding ="0" style="margin-left: 30px !important;">
		<tbody>
		<tr>
		<td>Opening</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$open ?></td>
		</tr>
		<tr>
		<td>Closing</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$close ?></td>
		</tr>
		<tr>
		<td colspan ="2" class="tc bod">Outstandings
		</td>
		</tr>
		<tr>
		<td>Receivables</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$OutstandingReceivable ?></td>
		</tr>
		<tr>
		<td>Payables</td>
		<td class="ta"><?php echo $currency_symbol.'&nbsp;'.$OutstandingPayable ?></td>
		</tr>
		</tbody>
		</table>
	</td>
<table width="100%" class= "content" cellspacing ="0" cellpadding ="0" border="0">
	<tbody>
	<tr>
	<td width="50%">
		
	</td>
	<td width="50%">
	</td>
	</tr>
	</tbody>
</table
<?php if(!empty($close) && !empty($open)){?>
<table width="100%" class="head">
	<tbody>
		
	</tbody>
</table>

<?php } ?>
<table width="100%" class="head">
	<tbody>
		<tr>
		<td class="tc bod"> Sales Orders
		</td>
		</tr>
	</tbody>
</table>
<table width="100%"  class= "content" cellspacing ="0" cellpadding ="0">
	<tbody>
		<tr>
		<td>Sales Order
		<?php if(!empty($cntSalesOrder)) {?>
		<span>(<?php echo($cntSalesOrder) ?>)</span>
		<?php } ?>
		</td>
		<td><?php echo $currency_symbol.'&nbsp;'. $SalesOrderAmt ?></td>
		</tr>
	</tbody>
</table>
<table width="100%" class="head">
	<tbody>
		<tr>
		<td class="tc bod">Discounts</td>
		</tr>
	</tbody>
</table>
<table width="100%" class= "content" cellspacing ="0" cellpadding ="0">
	<tbody>
		<tr>
		<td>Discount
		<?php if(!empty($discnt)) {?>
		<span>(<?php echo($discnt) ?>)</span>
		<?php } ?>
		</td>
		<td><?php echo $currency_symbol.'&nbsp;'.$discAmount ?></td>
		</tr>
	</tbody>
</table>
<table width="100%" class="head">
	<tbody>
		<tr>
		<td class="tc bod">Outstandings</td>
		</tr>
	</tbody>
</table>
<table width="100%"  class= "content" cellspacing ="0" cellpadding ="0">
	<tbody>
		<tr>
		<td>Receivables</td>
		<td><?php echo $currency_symbol.'&nbsp;'.$OutstandingReceivable ?></td>
		</tr>
		<tr>
		<td>Payables</td>
		<td><?php echo $currency_symbol.'&nbsp;'.$OutstandingPayable ?></td>
		</tr>
	</tbody>
</table>
<table width="100%" class="head">
	<tbody>
		<tr>
		<td class="tc bod">Receipts</td>
		</tr>
	</tbody>
</table>
<table width="100%"  class= "content" cellspacing ="0" cellpadding ="0">
	<tbody>
		<tr>
		<td>Cash(Due)</td>
		<td><?php echo $currency_symbol.'&nbsp;'.$receiptCreditbyCash ?></td>
		</tr>
		<tr>
		<td>Bank(Due)</td>
		<td><?php echo $currency_symbol.'&nbsp;'.$receiptCreditbyBank ?></td>
		</tr>
		<tr>
		<td>Cash (Adv)</td>
		<td><?php echo $currency_symbol.'&nbsp;'.$receiptAdvancebyCash ?></td>
		</tr>
		<tr>
		<td>Bank (Adv)</td>
		<td><?php echo $currency_symbol.'&nbsp;'.$receiptAdvancebyBank ?></td>
		</tr>
		<tr>
		<td>Cash (Sales)</td>
		<td><?php echo $currency_symbol.'&nbsp;'.$salesCash ?></td>
		</tr>
		<tr>
		<td>Bank(Sales)</td>
		<td><?php echo $currency_symbol.'&nbsp;'.$salesBank ?></td>
		</tr>
	</tbody>
</table>
<table width="100%" class="head">
	<tbody>
		<tr>
		<td class="tc bod">Payments</td>
		</tr>
	</tbody>
</table>
<table width="100%"  class= "content" cellspacing ="0" cellpadding ="0">
	<tbody>
		<tr>
		<td>Cash(Due)</td>
		<td><?php echo $currency_symbol.'&nbsp;'.$payDuesByCash ?></td>
		</tr>
		<tr>
		<td>Bank(Due)</td>
		<td><?php echo $currency_symbol.'&nbsp;'.$payDuesByBank ?></td>
		</tr>
		<tr>
		<td>Cash (Others)</td>
		<td><?php echo $currency_symbol.'&nbsp;'.$payOthersByCash ?></td>
		</tr>
		<tr>
		<td>Bank (Others)</td>
		<td><?php echo $currency_symbol.'&nbsp;'.$payOthersbyBank ?></td>
		</tr>
		<tr>
		<td>Cash (Expense)</td>
		<td><?php echo $currency_symbol.'&nbsp;'.$expenseCash ?></td>
		</tr>
		<tr>
		<td>Bank (Expense)</td>
		<td><?php echo $currency_symbol.'&nbsp;'.$expenseBank ?></td>
		</tr>
	</tbody>
</table><br>
<table width="100%" class="head">
	<tbody>
		<tr>
		<td class="tc bod">Sales Actions</td>
		</tr>
	</tbody>
</table>
<table  width="100%"  class= "content" cellspacing ="0" cellpadding ="0">
	<tbody>
		<?php if(!empty($cntDraft)){?>
		<tr>
		<td>Draft</td>
		<td><?php echo $cntDraft ?></td>
		</tr>
		<?php }?>
		<?php if(!empty($editCnt)){?>
		<tr>
		<td>Edit</td>
		<td><?php echo $editCnt ?></td>
		</tr>
		<?php }?>
		<?php if(!empty($delCnt)){?>
		<tr>
		<td>Delete</td>
		<td><?php echo $delCnt ?></td>
		</tr>
		<?php }?>
		<?php if(!empty($cntCancel)){?>
		<tr>
		<td>Cancel</td>
		<td><?php echo $cntCancel ?></td>
		</tr>
		<?php } ?>
		<?php if(!empty($cntRateSheet)){?>
		<tr>
		<td>Ratesheet</td>
		<td><?php echo $cntRateSheet ?></td>
		</tr>
		<?php } ?>
		<?php if(!empty($salbyRep) && $salbyRep !='0.00'){?>
		<tr>
		<td>Sales By Rep</td>
		<td><?php echo $salbyRep ?></td>
		</tr>
		<?php } ?>
		<?php if(!empty($salesCreditNote) && $salesCreditNote !='0.00' ){?>
		<tr>
		<td>Credit Note</td>
		<td><?php echo $currency_symbol.'&nbsp;'.$salesCreditNote ?></td>
		</tr>
		<?php } ?>
	</tbody>
</table>-->
<style>

.bod{
	border: 5px solid white !important;
	background: #ededed !important;
	font-size: 17px !important;
}
.tc{
	text-align: center !important;
}
.ta{
	text-align: right !important;
}
table .content{
	border:5px solid white !important;
}
.content td{
	width: 50% !important;
	border: 0.3px solid #dbdbdb57 !important;
	padding: 7px !important;
	
}


</style>
