<?php require "_header.php";?>
<script language="javascript" type="text/javascript">
document.getElementById("main-content").style.display = 'none';
</script>
<div id="main-report" align="center">
<style>
	.table-report{
		font-family:Verdana, Geneva, sans-serif;
		font-size:12px;
		text-align:left;
		border-right:0px none;
		border-bottom:0px none;
	}
	.table-report-inner{
		font-family:Verdana, Geneva, sans-serif;
		font-size:12px;
	}
	.table-report tr{
		padding:2px 2px 2px 2px;
	}
	.table-report td{
		padding:2px 2px 2px 2px;
		border-top:0px none;
		border-left:0px none;
	}
	.table-report th{
		padding:2px 2px 2px 2px;
		font-weight:bold;
		text-align:left;
		border-top:0px none;
		border-left:0px none;
	}	
	.college_name{
		font-family:QTAbbie;
		font-size:22px;	
		font-weight:bold;
		padding:2px 2px 2px 2px;
		text-align:center;
	}
	.college_address{
		font-family:Tahoma, Geneva, sans-serif;
		font-size:11px;	
		text-align:center;
		padding:2px 2px 2px 2px;
	}
</style>
<?php 
	$header_row_string = "";
	$display_str = "";
	
	$startdate 		   = Escape($_REQUEST['feesrec_startdate']);
	$enddate 			 = Escape($_REQUEST['feesrec_enddate']);
	$startrecno 		  = Escape($_REQUEST['feesrec_startno']);
	$endrecno 			= Escape($_REQUEST['feesrec_endno']);
	$report_type 		 = Escape($_REQUEST['report_type']);
	$report_selection	= Escape($_REQUEST['report_selection']);
	
	
	
	if(($startdate == "" && $enddate == "") && ($startrecno == "" && $endrecno == "")){ ?>
		<script language="javascript" type="text/javascript">
			location.href='report-daily-fees-collection-year.php';
		</script><?php
	}
	elseif($_SESSION['VedantnrCollegeId']!="" && isset($_SESSION['VedantnrCollegeId'])){ 
		ob_start();
		
		$final_cash = 0;
		$final_bank = 0;
		$date_cash = 0;
		$date_bank = 0;
		$str_date = "";		
		$condition = "";
		
		if($report_selection == "recno_selection"){
			$condition .= " AND frm.receipt_no >= '$startrecno' AND frm.receipt_no <= '$endrecno' ";
			$display_str = "Receipt No: $startrecno - $endrecno";
		} else if($report_selection == "date_selection"){
			$condition .= " AND frm.receipt_date >= '$startdate' AND frm.receipt_date <= '$enddate' ";
			
			if($_REQUEST['feesrec_startdate'] != $_REQUEST['feesrec_enddate']){
				$display_str = "Receipt Date: ".$_REQUEST['feesrec_startdate']." - ".$_REQUEST['feesrec_enddate'];
			} else{
				$display_str = "Receipt Date: ".$_REQUEST['feesrec_startdate'];
			}
		}
		
		if($report_type == "summarize_type"){
			$SQL_SELECT = "
				SELECT
					frm.receipt_no,
					bm.branch_name,
					frm.fees_type,
					sem.semester_name,
					sm.student_gturegno,
					CONCAT(sm.student_surname,' ',sm.student_firstname,' ',sm.student_lastname) AS student_name,
					frm.receive_amt,
					frm.total_receive_amt,
					frm.cheque_no,
					frm.discount,
					frm.receipt_date,
					um.user_name
				FROM
					cms_feesreceivemaster frm,
					cms_studentmaster sm,
					cms_branchmaster bm,
					cms_semestermaster sem,
					cms_usermaster um	 		
				WHERE
					um.user_id = frm.login_id AND
					frm.branch_id = bm.branch_id AND
					frm.semester_id = sem.semester_id AND 
					sm.student_id = frm.student_id ";
			$SQL_SELECT .= $condition;
			
//		echo 	$SQL_SELECT; exit;
			
			$SQL_SELECT .= " ORDER BY frm.receipt_no ASC ";
			$RES_SELECT = dbQuery($SQL_SELECT);	
			
			
			if(dbRows($RES_SELECT) > 0){?>
            	<center><h4>Daily Fees Collection - Summary Report</h4></center>
                <br />
                <div>
                	<div style="float:left; padding-left:180px;"><?php echo $display_str; ?></div>
                    <div style="float:right; padding-right:180px;">C:cash, B:cheque</div>
                </div><br /><br />
                <table class="table-report" border="1" cellpadding="0" cellspacing="0"> 
				<tr>
                	<th style="text-align:center;">Receipt No</th>
                    <th style="text-align:center;">Branch</th>
        			<th style="text-align:center;">Semester</th>            
		            <th style="text-align:center;">Enrollment No</th>
                    <th style="text-align:left;">Student Name</th>
                    <th style="text-align:right;">Amount</th>
                   	<th style="text-align:right;">Fees Type</th>

                    <th style="text-align:left;">Received By</th>
                </tr><?php
				while($REC_SELECT = dbArray($RES_SELECT)){
					$receipt_date = date('d-m-Y',strtotime($REC_SELECT['receipt_date']));
					if($startdate != $enddate){
						if($str_date != $receipt_date){
							if($date_cash > 0 || $date_bank > 0){
								if($date_cash > 0 && $date_bank > 0){?>
								<tr>
									<th colspan="5" style="text-align:right;">Cash Received</th>
									<th style="text-align:right;"><?php echo $date_cash; ?></th>
                                    <th>&nbsp;</th>
								</tr>
								<tr>
									<th colspan="5" style="text-align:right;">Cheque Received</th>
									<th style="text-align:right;"><?php echo $date_bank; ?></th>
                                    <th>&nbsp;</th>
								</tr><?php 
								}?>
								<tr>
									<th colspan="5" style="text-align:right;">Total Received Amount</th>
									<th style="text-align:right;"><?php echo $date_cash+$date_bank; ?></th>
                                    <th>&nbsp;</th>
								</tr>
								<?php	
								$date_bank = 0;
								$date_cash = 0;
							}?>           
						<tr>
							<td colspan="7">&nbsp;</td>
						</tr> 
						<tr>
							<td colspan="7" style="text-align:left;">Receipt Date: <?php echo date('d-m-Y',strtotime($REC_SELECT['receipt_date'])); ?></td>
						</tr><?php 
							$str_date = $receipt_date;
						}
					}
					?>
                	<tr>
                    	<td style="text-align:center;"><?php echo $REC_SELECT['receipt_no']; ?></td>
                        <td style="text-align:center;"><?php echo $REC_SELECT['branch_name']; ?></td>
                        <td style="text-align:center;"><?php echo $REC_SELECT['semester_name']; ?></td>
                        <td style="text-align:center;"><?php echo $REC_SELECT['student_gturegno']; ?></td>
                        <td style="text-align:left;"><?php echo $REC_SELECT['student_name']; ?></td>
                       
            <?php  if($REC_SELECT['discount'] == 0)
           {
           	?> 
                        <td style="text-align:right;">
							<?php echo $REC_SELECT['receive_amt'];?>
                            <?php
							if($REC_SELECT['cheque_no'] == ""){
								echo "(C)";
								$final_cash += $REC_SELECT['receive_amt'];
								$date_cash += $REC_SELECT['receive_amt'];
							}
							else{
								echo "(B)";
								$final_bank += $REC_SELECT['receive_amt'];
								$date_bank += $REC_SELECT['receive_amt']; 
							}
							?>
             </td>
              <?php
          }
          else
          {  
           ?>
           <td style="text-align:right;">
							
							<?php echo $REC_SELECT['total_receive_amt'];?>
							
                            <?php
							if($REC_SELECT['cheque_no'] == ""){
								echo "(C)";
								$final_cash += $REC_SELECT['total_receive_amt'];
								$date_cash += $REC_SELECT['total_receive_amt'];
							}
							else{
								echo "(B)";
								$final_bank += $REC_SELECT['total_receive_amt'];
								$date_bank += $REC_SELECT['total_receive_amt']; 
							}
							?>
              </td>
           
          <?php
        	}
        	?>
 												<?php
 												if($REC_SELECT['fees_type'] == 'T')
 												{
 												?>
 													 <td style="text-align:center;"><?php echo "Transport"; ?></td>
 												<?php
 												}
 											else
 											{
 												?>	
             		 <td style="text-align:center;"></td>
                       
                      <?php
                    }
                    ?> 
                        <td style="text-align:center;"><?php echo $REC_SELECT['user_name']; ?></td>
                    </tr><?php
				}?>
                <?php 
					if($startdate != $enddate){
						if($date_cash > 0 || $date_bank > 0){
							if($date_cash > 0 && $date_bank > 0){?>
							<tr>
								<th colspan="5" style="text-align:right;">Cash Received</th>
								<th style="text-align:right;"><?php echo $date_cash; ?></th>
                                <th>&nbsp;</th>
							</tr>
							<tr>
								<th colspan="5" style="text-align:right;">Cheque Received</th>
								<th style="text-align:right;"><?php echo $date_bank; ?></th>
                                <th>&nbsp;</th>
							</tr><?php 
							}?>
							<tr>
								<th colspan="5" style="text-align:right;">Total Received Amount</th>
								<th style="text-align:right;"><?php echo $date_cash+$date_bank; ?></th>
                                <th>&nbsp;</th>
							</tr>
							<?php	
							$date_bank = 0;
							$date_cash = 0;
						}?>           
						<tr>
							<th colspan="7" style="text-align:center; color:#000; background-color:#CCC;">FINAL TOTAL</th>
						</tr><?php
					}
				?>
                <?php if($final_cash > 0 && $final_bank > 0){ ?>
                <tr>
                	<th colspan="5" style="text-align:right;">Total Cash Received</th>
                    <th style="text-align:right;"><?php echo number_format($final_cash)." Rs"; ?></th>
                    <th>&nbsp;</th>
                </tr>
                <tr>
                	<th colspan="5" style="text-align:right;">Total Cheque Received</th>
                    <th style="text-align:right;"><?php echo number_format($final_bank)." Rs"; ?></th>
                    <th>&nbsp;</th>
                </tr>
                <?php }?>
                <tr>
                	<th colspan="5" style="text-align:right;">Total Received Amount</th>
                    <th style="text-align:right;"><?php echo number_format($final_cash+$final_bank)." Rs"; ?></th>
                    <th>&nbsp;</th>
                </tr>
                <tr>
					<th colspan="7" style="text-align:center; color:#000; background-color:#CCC;">Received By</th>
				</tr>
                <tr>
                	<td colspan="7" align="center">
                    	<table width="40%" border="1" cellpadding="0" cellspacing="0" class="table-report">
                        	<tr>
                            	<th>Receiver</th>
                                <th style="text-align:right; padding-right:2px;">Cash</th>
                                <th style="text-align:right; padding-right:2px;">Cheque</th>
                                <th style="text-align:right; padding-right:2px;">Total</th>
                            </tr>
                            <?php
                            	$SQL_RECEIVER = "
									SELECT
										sum(case when discount = '0' then receive_amt else total_receive_amt  end) AS receive_amt,
										um.user_id,
										um.user_name
									FROM
										cms_feesreceivemaster frm,
										cms_usermaster um	 		
									WHERE
										um.user_id = frm.login_id ";
										
								$SQL_RECEIVER .= $condition;	
								$SQL_RECEIVER .= " GROUP BY frm.login_id ORDER BY frm.receipt_no ASC ";
								$RES_RECEIVER = dbQuery($SQL_RECEIVER);
								
							//echo 	$SQL_RECEIVER; exit;
								
								if(dbRows($RES_RECEIVER) > 0){
									while($REC_RECEIVER = dbArray($RES_RECEIVER)){	
							?>
                            <tr>
                            	<td><?php echo $REC_RECEIVER['user_name']; ?></td>
                                <td style="text-align:right; padding-right:2px;">
                                	<?php 
										$SQL_CASH = "
											SELECT
												sum(case when discount = '0' then receive_amt else total_receive_amt  end) AS receive_amt
											FROM
												cms_feesreceivemaster frm
											WHERE
												frm.cheque_no = '' AND	 
												frm.login_id = ".$REC_RECEIVER['user_id']." ";
												
										$SQL_CASH .= $condition;	
										$RES_CASH = dbQuery($SQL_CASH);
										$REC_CASH = dbArray($RES_CASH);
										echo number_format($REC_CASH['receive_amt']);
									?>
                                </td>
                                <td style="text-align:right; padding-right:2px;">
                                	<?php 
										$SQL_CASH = "
											SELECT
												sum(case when discount = '0' then receive_amt else total_receive_amt  end) AS receive_amt
											FROM
												cms_feesreceivemaster frm
											WHERE
												frm.cheque_no != '' AND	
												
												frm.login_id = ".$REC_RECEIVER['user_id'];
										$SQL_CASH .= $condition;	
										$RES_CASH = dbQuery($SQL_CASH);
										$REC_CASH = dbArray($RES_CASH);
										echo number_format($REC_CASH['receive_amt']);
									?>
                                </td>
                                <td style="text-align:right; padding-right:2px;"><?php echo number_format($REC_RECEIVER['receive_amt'])." Rs"; ?></td>
                            </tr>
                            <?php
									}
								}
							?>                            
                        </table>                    
                    </td>
                </tr>
                </table><?php	
			}				
		}
		else if($report_type == "descriptive_type"){
			$SQL_HEADING = "SELECT head_id,head_name FROM cms_feeshead WHERE head_name != 'ACPDC Adm Fee' ORDER BY head_id ASC";
			$RES_HEADING = dbQuery($SQL_HEADING);
			if(dbRows($RES_HEADING) > 0){?>
            	<center><h4>Daily Fees Collection - Descriptive Report</h4></center>
            	<br />
                <div>
                	<div style="float:left;"><?php echo $display_str; ?></div>
                    <div style="float:right;">C:cash, B:cheque</div>
                </div><br /><br />
            	<table class="table-report" border="1" cellpadding="0" cellspacing="0"><tr>
					<th style="text-align:center;">Receipt No</th>
                    <th style="text-align:center;">Branch</th>
        			<th style="text-align:center;">Semester</th> 
                    <th style="text-align:center;">Enrollment No</th>
                    <th style="text-align:left;">Student Name</th>
				<?php
				while($REC_HEADING = dbArray($RES_HEADING)){?>
					<th style="text-align:center;"><?php echo $REC_HEADING['head_name']; ?></th>
					<?php
				} ?>
                	<th style="text-align:center;">Total Amount</th>
                    <th style="text-align:left;">Received By</th>
                </tr><?php
				$SQL_SELECT = "SELECT
						frm.feesreceive_id,
						frm.receipt_no,
						bm.branch_name,
						sem.semester_name,
						sm.student_gturegno,
						CONCAT(sm.student_surname,' ',sm.student_firstname,' ',sm.student_lastname) AS student_name,
						frm.receive_amt,
						frm.total_receive_amt,
						frm.discount,
						frm.cheque_no,
						frm.receipt_date,
						um.user_name
					FROM
						cms_feesreceivemaster frm,
						cms_studentmaster sm,
						cms_branchmaster bm,
						cms_semestermaster sem,
						cms_usermaster um			
					WHERE 
						um.user_id = frm.login_id AND
						frm.branch_id = bm.branch_id AND
						frm.semester_id = sem.semester_id AND
						sm.student_id = frm.student_id ";
						
				
				$SQL_SELECT .= $condition;	
				$SQL_SELECT .= " ORDER BY frm.receipt_no ASC ";
				$RES_SELECT = dbQuery($SQL_SELECT);	

				if(dbRows($RES_SELECT) > 0){				
					while($REC_SELECT = dbArray($RES_SELECT)){
						$receipt_date = date('d-m-Y',strtotime($REC_SELECT['receipt_date']));
						if($startdate != $enddate){
							if($str_date != $receipt_date){
								if($date_cash > 0 || $date_bank > 0){
									if($date_cash > 0 && $date_bank > 0){?>
									<tr>
										<th colspan="14" style="text-align:right;">Cash Received</th>
										<th style="text-align:right;"><?php echo number_format($date_cash); ?></th>
                                        <th>&nbsp;</th>
									</tr>
									<tr>
										<th colspan="14" style="text-align:right;">Cheque Received</th>
										<th style="text-align:right;"><?php echo number_format($date_bank); ?></th>
                                        <th>&nbsp;</th>
									</tr><?php 
									}?>
									<tr>
										<th colspan="14" style="text-align:right;">Total Received Amount</th>
										<th style="text-align:right;"><?php echo number_format($date_cash+$date_bank); ?></th>
                                        <th>&nbsp;</th>
									</tr>
									<?php	
									$date_bank = 0;
									$date_cash = 0;
								}?>           
							<tr>
								<td colspan="16">&nbsp;</td>
							</tr> 
							<tr>
								<td colspan="16" style="text-align:left;">Receipt Date: 
								<?php echo date('d-m-Y',strtotime($REC_SELECT['receipt_date'])); ?></td>
							</tr><?php 
								$str_date = $receipt_date;
							}
						}
						?>
                        <tr>
                            <td style="text-align:center;"><?php echo $REC_SELECT['receipt_no']; ?></td>
                            <td style="text-align:center;"><?php echo $REC_SELECT['branch_name']; ?></td>
                        	<td style="text-align:center;"><?php echo $REC_SELECT['semester_name']; ?></td>
                        	<td style="text-align:center;"><?php echo $REC_SELECT['student_gturegno']; ?></td>
                            <td style="text-align:left;"><?php echo $REC_SELECT['student_name']; ?></td>
                            <?php
                            	$feesreceive_id = $REC_SELECT['feesreceive_id'];
								$SQL_DATAIL = "SELECT 
										cms_feeshead.head_id,
										recdetail_amt 
									FROM 
										cms_feeshead LEFT JOIN cms_feesreceivedetail
										ON cms_feeshead.head_id = cms_feesreceivedetail.head_id AND 
										feesreceive_id = $feesreceive_id  
									ORDER BY cms_feeshead.head_id ASC";	
								
								$RES_DETAIL = dbQuery($SQL_DATAIL);
								if(dbRows($RES_DETAIL) > 0){
									while($REC_DETAIL = dbArray($RES_DETAIL)){
										if($REC_DETAIL['head_id'] != 1){?>
                                    	<td style="text-align:right; padding-right:2px;">
											<?php 
												if($REC_DETAIL['recdetail_amt'] != "" && $REC_DETAIL['recdetail_amt'] != "0"){ 
													if($REC_DETAIL['discount'] == 0)
													{
													echo $REC_DETAIL['recdetail_amt']; 
													}
													else
													{
														echo $REC_DETAIL['total_receive_amt'];
													}
												} else{
													echo '-';		
												}
											?>
                                        </td><?php
										}
									}
								}
							
								if($REC_SELECT['discount'] != 0)
							{
							?>
							
              <td style="text-align:right;">
							<?php echo $REC_SELECT['total_receive_amt']; $final_total += $REC_SELECT['total_receive_amt']; ?>
                            <?php
								if($REC_SELECT['cheque_no'] == ""){
									echo "(C)";
									$final_cash += $REC_SELECT['total_receive_amt'];
									$date_cash += $REC_SELECT['total_receive_amt'];
								}
								else{
									echo "(B)";
									$final_bank += $REC_SELECT['total_receive_amt'];
									$date_bank += $REC_SELECT['total_receive_amt']; 
								}
								
							?>
             </td>
             <?php
           	}
           	else
           	{
           		?>
							
               <td style="text-align:right;">
							<?php echo $REC_SELECT['receive_amt']; $final_total += $REC_SELECT['receive_amt']; ?>
                            <?php
								if($REC_SELECT['cheque_no'] == ""){
									echo "(C)";
									$final_cash += $REC_SELECT['receive_amt'];
									$date_cash += $REC_SELECT['receive_amt'];
								}
								else{
									echo "(B)";
									$final_bank += $REC_SELECT['receive_amt'];
									$date_bank += $REC_SELECT['receive_amt']; 
								}
							?>
               </td>
                <?php
          }
          ?>   
                            <td style="text-align:center;"><?php echo $REC_SELECT['user_name']; ?></td>
                        </tr>
						<?php
                    }
					
				}?>
                <?php
					if($startdate != $enddate){
						if($date_cash > 0 || $date_bank > 0){
							if($date_cash > 0 && $date_bank > 0){?>
							<tr>
								<th colspan="14" style="text-align:right;">Cash Received</th>
								<th style="text-align:right;"><?php echo number_format($date_cash); ?></th>
                                <th>&nbsp;</th>
							</tr>
							<tr>
								<th colspan="14" style="text-align:right;">Cheque Received</th>
								<th style="text-align:right;"><?php echo number_format($date_bank); ?></th>
                                <th>&nbsp;</th>
							</tr><?php 
							}?>
							<tr>
								<th colspan="14" style="text-align:right;">Total Received Amount</th>
								<th style="text-align:right;"><?php echo number_format($date_cash+$date_bank); ?></th>
                                <th>&nbsp;</th>
							</tr>
							<?php	
							$date_bank = 0;
							$date_cash = 0;
						}?>           
						<tr>
							<th colspan="16" style="text-align:center; color:#000; background-color:#CCC;">FINAL TOTAL</th>
						</tr><?php
					}
				?>
                <?php if($final_cash > 0 && $final_bank > 0){ ?>
                <tr>
                	<th colspan="14" style="text-align:right;">Total Cash Received</th>
                    <th style="text-align:right;"><?php echo number_format($final_cash)." Rs"; ?></th>
                    <th>&nbsp;</th>
                </tr>
                <tr>
                	<th colspan="14" style="text-align:right;">Total Cheque Received</th>
                    <th style="text-align:right;"><?php echo number_format($final_bank)." Rs"; ?></th>
                    <th>&nbsp;</th>
                </tr>
                <?php }?>
                <tr>
                	<th colspan="15" style="text-align:right;">Total Received Amount</th>
                    <th style="text-align:right;"><?php echo number_format($final_cash+$final_bank)." Rs"; ?></th>
                    <th>&nbsp;</th>
                </tr>
                <tr>
					<th colspan="17" style="text-align:center; color:#000; background-color:#CCC;">Received By</th>
				</tr>
                <tr>
                	<td colspan="17" align="center">
                    	<table width="40%" border="1" cellpadding="0" cellspacing="0" class="table-report">
                        	<tr>
                            	<th>Receiver</th>
                                <th style="text-align:right; padding-right:2px;">Cash</th>
                                <th style="text-align:right; padding-right:2px;">Cheque</th>
                                <th style="text-align:right; padding-right:2px;">Total</th>
                            </tr>
                            <?php
                            	$SQL_RECEIVER = "SELECT
										sum(case when discount = '0' then receive_amt else total_receive_amt  end) AS receive_amt,
										um.user_id,
										um.user_name
									FROM
										cms_feesreceivemaster frm,
										cms_usermaster um	 		
									WHERE
										um.user_id = frm.login_id ";
										
								$SQL_RECEIVER .= $condition;	
								$SQL_RECEIVER .= " GROUP BY frm.login_id ORDER BY frm.receipt_no ASC ";
								$RES_RECEIVER = dbQuery($SQL_RECEIVER);
								if(dbRows($RES_RECEIVER) > 0){
									while($REC_RECEIVER = dbArray($RES_RECEIVER)){	
							?>
                            <tr>
                            	<td><?php echo $REC_RECEIVER['user_name']; ?></td>
                                <td style="text-align:right; padding-right:2px;">
                                	<?php 
										$SQL_CASH = "
											SELECT
												sum(case when discount = '0' then receive_amt else total_receive_amt  end) AS receive_amt
											FROM
												cms_feesreceivemaster frm
											WHERE
												frm.cheque_no = '' AND	 
												frm.login_id = ".$REC_RECEIVER['user_id']." ";
											
										$SQL_CASH .= $condition;	
										$RES_CASH = dbQuery($SQL_CASH);
										$REC_CASH = dbArray($RES_CASH);
										echo number_format($REC_CASH['receive_amt']);
									?>
                                </td>
                                <td style="text-align:right; padding-right:2px;">
                                	<?php 
										$SQL_CASH = "
											SELECT
												sum(case when discount = '0' then receive_amt else total_receive_amt  end) AS receive_amt
											FROM
												cms_feesreceivemaster frm
											WHERE
												frm.cheque_no != '' AND	 
												
												frm.login_id = ".$REC_RECEIVER['user_id'];
										$SQL_CASH .= $condition;	
										$RES_CASH = dbQuery($SQL_CASH);
										$REC_CASH = dbArray($RES_CASH);
										echo number_format($REC_CASH['receive_amt']);
									?>
                                </td>
                                <td style="text-align:right; padding-right:2px;"><?php echo number_format($REC_RECEIVER['receive_amt'])." Rs"; ?></td>
                            </tr>
                            <?php
									}
								}
							?>                            
                        </table>                    
                    </td>
                </tr>
                </table>
                </table><?php
			}
		}
		
		$HtmlCode= ob_get_contents();
		ob_end_flush();
		$HtmlUrl  =	"daily-fees-collection-report-year.html";
		$HtmlPath =	"report/".$HtmlUrl;
		createHTMLReportPage($header_row_string,$HtmlUrl,$HtmlPath,$HtmlCode); 
	?>
		<br/>
		<form name="frm" id="frm" action="" method="post">		
			<input type="hidden"   name="txtFile" id="txtFile" value="<?php echo $HtmlUrl ;?>" />
            <input type="button"  name="btnPrint" id="btnPrint" value="Print" onClick="SetPageAction('PRINT');"/>
			<input type="button"  name="btnPdf" id="btnPdf" value="Create PDF" onClick="SetPageAction('PDF');"/>
			<input type="button" name="btnHtml" id="btnHtml" value="Create HTML" onClick="SetPageAction('HTML');"/>
			<input type="button" name="btnWord" id="btnWord" value="Create WORD" onClick="SetPageAction('WORD');"/>
			<input type="button" name="btnExcel" id="btnExcel" value="Create EXCEL" onClick="SetPageAction('Excel');"/>
		</form>
			<script language="javascript" type="text/javascript">
                function SetPageAction(varAction) {
                    if(varAction=="PRINT"){			
                        document.frm.action="print/create-print.php";
                        document.frm.target = "_blank";
                        document.frm.submit();
                    }
					else if(varAction=="PDF"){			
                        document.frm.action="convertpdf/create-pdf.php";
                        document.frm.target = "_blank";
                        document.frm.submit();
                    }
                    else if(varAction=="HTML"){
                        document.frm.action="<?php echo $HtmlPath ;?>";
                        document.frm.target = "_blank";
                        document.frm.submit();
                    }
                    else if(varAction=="WORD"){
                        document.frm.action="convertword/create-word.php";
                        document.frm.target="_blank";
                        document.frm.submit();
                    }
                    else if(varAction=="Excel"){
                        document.frm.action="convertword/create-excel.php";
                        document.frm.target="_blank";
                        document.frm.submit();
                    }
                }
		</script><?php
	}  
   	else{
      	echo "Session Expired";      
   	} 
?>
</div>
<?php require "_footer.php";
?>
