<?php

require_once('../classes/b2b.class.dbConnect.php');
require_once('../classes/b2b.class.dbQuery.php');
require_once('../classes/b2b.class.BusiLogic.php');

$DBName = isset($_SESSION['DBName']) ? $_SESSION['DBName'] : 'b2b_solar_sc';
$objDBConnect	= new DBConnect($DBName);
$objDBQuery		= new DBQuery($objDBConnect);
$classBusiLogic	= new BusiLogic($objDBQuery, $DBName);
?>

	<link rel="stylesheet" type="text/css" href="<?php echo '../stylesheet/style_header.css'; ?>" />
	<script src="../jQuery/Popup/jquery-1.11.0.min.js"></script>
		<script src="../jQuery/Popup/bpopup.js"></script>

<html>
	<head>
			<style>
	#maintable th, #maintable td {
			  padding: 0.25rem;
			  text-align: left;
			  border: 1px solid #ccc;
			}
			
		</style>
		<?php  if($_GET['IsView'] == 0){ ?>
		<link rel="stylesheet" type="text/css" href="<?php echo '../stylesheet/style_header.css'; ?>" />
	<!--	<script src="../jQuery/Popup/jquery-1.11.0.min.js"></script>
		<script src="../jQuery/Popup/bpopup.js"></script>
		-->
		<style>
		#popup{
				background-color: #fff;  
				min-width: 320px;
				padding: 10px;
				top: 100px !important;
				border: 4px solid gray;
				border-radius: 10px;
			}	
		</style>
		
	</head>
	<body>
	<div align="center" id="popup" style="display:none;">
	
	<?php
		}
$CustomerCd 		= $_GET['CustomerCd'];	
$Year 				= $_GET['Year'];	
$Month 				= $_GET['Month'];	
//$Date 				= $_GET['Date'];	
$AEDAllotment_Id 	= $_GET['AEDAllotment_Id'];	
	
$listData = $classBusiLogic->getDealerSubdealerAEDAllocation($CustomerCd, $Year, $Month, $AEDAllotment_Id);

$HeadingRowStyleFirst = '';
$HeadingRowStyleOther = '';
$RowStyleFirst = '';
$RowStyleOther = '';
$html_str = '';
//print_r($listData);
$html_str .='<table border="1" width="700px" cellspacing="0" cellpadding="0" align="center " id="maintable">
				  <tr>
					<td class="pageHeading" align="center" style="background-color:#B1E0E0;width:100%;font-size:18px;font:weight:bold;">Total AED  Planning </td>
				  </tr>
				  <tr>
					<td valign="top" width="70%">
						<table style="border:1px solid black;" width="1000px" cellspacing="0" cellpadding="0">
							<tr style="background-color: #AFAFAF;">
								<td '.$HeadingRowStyleFirst.' align="center" rowspan="2" width="30px">S No.</td>
								<td '.$HeadingRowStyleFirst.' align="center" rowspan="2" width="270px">Dealer Name</td>
								<td '.$HeadingRowStyleOther.' align="center" colspan="4" width="280px">Supreme AED</td>
								<td '.$HeadingRowStyleOther.' align="center" colspan="3" width="210px">Solar AED</td>
								<td '.$HeadingRowStyleOther.' align="center" colspan="3" width="210px">Total AED</td>
								</tr>
							<tr style="background-color: #AFAFAF;">
								<td '.$HeadingRowStyleOther.' align="center" width="70px">AED 1.5</td>
								<td '.$HeadingRowStyleOther.' align="center" width="70px">AED 1.5 US</td>
								<td '.$HeadingRowStyleOther.' align="center" width="70px">AED 1.8</td>
								<td '.$HeadingRowStyleOther.' align="center" width="70px">AED 3.0</td>
								<td '.$HeadingRowStyleOther.' align="center" width="70px">AED 1.5</td>
								<td '.$HeadingRowStyleOther.' align="center" width="70px">AED 1.8</td>
								<td '.$HeadingRowStyleOther.' align="center" width="70px">AED 3.0</td>
								<td '.$HeadingRowStyleOther.' align="center" width="70px">AED 1.5</td>
								<td '.$HeadingRowStyleOther.' align="center" width="70px">AED 1.8</td>
								<td '.$HeadingRowStyleOther.' align="center" width="70px">AED 3.0</td>
							</tr>';
							$rowcnt = 0;
							$Dsrno = 1;
								$CustomerCd 					=	$listData[0]['CustomerCd'];	
								$Dealer_Name	 				=	$listData[0]['Dealer_Name'];	
								$Customer_SupremeAED15_Date		= 	$classBusiLogic->convertDate($listData[0]['Customer_SupremeAED15_Date'], False, 1);	
								$Customer_SupremeAED15_Qty 		= 	($listData[0]['Customer_SupremeAED15_Qty']) ? $listData[0]['Customer_SupremeAED15_Qty'] : "" ;	
								$Customer_SupremeAED15US_Date	= 	$classBusiLogic->convertDate($listData[0]['Customer_SupremeAED15US_Date'], False, 1);	
								$Customer_SupremeAED15US_Qty 	= 	($listData[0]['Customer_SupremeAED15US_Qty']) ? $listData[0]['Customer_SupremeAED15US_Qty'] : "" ;
								$Customer_SupremeAED18_Date		= 	$classBusiLogic->convertDate($listData[0]['Customer_SupremeAED18_Date'], False, 1);	
								$Customer_SupremeAED18_Qty 		= 	($listData[0]['Customer_SupremeAED18_Qty']) ? $listData[0]['Customer_SupremeAED18_Qty'] : "" ;
								$Customer_SupremeAED30_Date		= 	$classBusiLogic->convertDate($listData[0]['Customer_SupremeAED30_Date'], False, 1);	
								$Customer_SupremeAED30_Qty 		= 	($listData[0]['Customer_SupremeAED30_Qty'])? $listData[0]['Customer_SupremeAED30_Qty'] : "" ;
								$Customer_SolarAED15_Date 		=  	$classBusiLogic->convertDate($listData[0]['Customer_SolarAED15_Date'], False, 1);
								$Customer_SolarAED15_Qty	 	= 	($listData[0]['Customer_SolarAED15_Qty']) ? $listData[0]['Customer_SolarAED15_Qty'] : "" ;
								$Customer_SolarAED18_Date	 	=  	$classBusiLogic->convertDate($listData[0]['Customer_SolarAED18_Date'], False, 1);
								$Customer_SolarAED18_Qty	 	= 	($listData[0]['Customer_SolarAED18_Qty']) ? $listData[0]['Customer_SolarAED18_Qty'] : "" ;
								$Customer_SolarAED30_Date	 	=  	$classBusiLogic->convertDate($listData[0]['Customer_SolarAED30_Date'], False, 1);
								$Customer_SolarAED30_Qty	 	= 	($listData[0]['Customer_SolarAED30_Qty']) ? $listData[0]['Customer_SolarAED30_Qty'] : "" ;
								
								$Customer_SupremeAED15_ReserveQty_Open	 	= 	($listData[0]['Customer_SupremeAED15_ReserveQty_Open']) ? $listData[0]['Customer_SupremeAED15_ReserveQty_Open'] : "" ;
								$Customer_SupremeAED15US_ReserveQty_Open	= 	($listData[0]['Customer_SupremeAED15US_ReserveQty_Open']) ? $listData[0]['Customer_SupremeAED15US_ReserveQty_Open'] : "" ;
								$Customer_SupremeAED18_ReserveQty_Open	 	= 	($listData[0]['Customer_SupremeAED18_ReserveQty_Open']) ? $listData[0]['Customer_SupremeAED18_ReserveQty_Open'] : "" ;
								$Customer_SupremeAED30_ReserveQty_Open	 	= 	($listData[0]['Customer_SupremeAED30_ReserveQty_Open']) ? $listData[0]['Customer_SupremeAED30_ReserveQty_Open'] : "" ;
								$Customer_SolarAED15_ReserveQty_Open	 	= 	($listData[0]['Customer_SolarAED15_ReserveQty_Open']) ? $listData[0]['Customer_SolarAED15_ReserveQty_Open'] : "" ;
								$Customer_SolarAED18_ReserveQty_Open	 	= 	($listData[0]['Customer_SolarAED18_ReserveQty_Open']) ? $listData[0]['Customer_SolarAED18_ReserveQty_Open'] : "" ;
								$Customer_SolarAED30_ReserveQty_Open	 	= 	($listData[0]['Customer_SolarAED30_ReserveQty_Open']) ? $listData[0]['Customer_SolarAED30_ReserveQty_Open'] : "" ;
						
						
								$totalAED15	=	($Customer_SupremeAED15_Qty + $Customer_SupremeAED15US_Qty + $Customer_SolarAED15_Qty) ? ($Customer_SupremeAED15_Qty + $Customer_SupremeAED15US_Qty + $Customer_SolarAED15_Qty) : '';
								$totalAED18	=	($Customer_SupremeAED18_Qty + $Customer_SolarAED18_Qty) ? ($Customer_SupremeAED18_Qty + $Customer_SolarAED18_Qty) : '';
								$totalAED30 =	($Customer_SupremeAED30_Qty + $Customer_SolarAED30_Qty) ? ($Customer_SupremeAED30_Qty + $Customer_SolarAED30_Qty) : '';

						$html_str .= '<tr>
									<td '.$RowStyleFirst.' width="30px">'.$Dsrno.'</td>
									<td '.$RowStyleOther.' width="270px">'.strtoupper($Dealer_Name).'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.$Customer_SupremeAED15_Qty.'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.$Customer_SupremeAED15US_Qty.'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.$Customer_SupremeAED18_Qty.'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.$Customer_SupremeAED30_Qty.'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.$Customer_SolarAED15_Qty.'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.$Customer_SolarAED18_Qty.'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.$Customer_SolarAED30_Qty.'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.($totalAED15).'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.($totalAED18).'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.($totalAED30).'</td>
									
									
								</tr>';
								
								$html_str .= '<tr>
									<td '.$RowStyleFirst.' width="30px"></td>
									<td '.$RowStyleOther.' align="center" width="270px">Reserve Stock</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.$Customer_SupremeAED15_ReserveQty_Open.'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.$Customer_SupremeAED15US_ReserveQty_Open.'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.$Customer_SupremeAED18_ReserveQty_Open.'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.$Customer_SupremeAED30_ReserveQty_Open.'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.$Customer_SolarAED15_ReserveQty_Open.'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.$Customer_SolarAED18_ReserveQty_Open.'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.$Customer_SolarAED30_ReserveQty_Open.'</td>
									<td></td> <td></td> <td></td>
								</tr>';
								
								$total_Cus_SupremeAED15_Qty = $Customer_SupremeAED15_Qty + $Customer_SupremeAED15_ReserveQty_Open;
								$total_Cus_SupremeAED15US_Qty = $Customer_SupremeAED15US_Qty + $Customer_SupremeAED15US_ReserveQty_Open;
								$total_Cus_SupremeAED18_Qty = $Customer_SupremeAED18_Qty + $Customer_SupremeAED18_ReserveQty_Open;
								$total_Cus_SupremeAED30_Qty = $Customer_SupremeAED30_Qty + $Customer_SupremeAED30_ReserveQty_Open;
								$total_Cus_SolarAED15_Qty = $Customer_SolarAED15_Qty + $Customer_SolarAED15_ReserveQty_Open;
								$total_Cus_SolarAED18_Qty = $Customer_SolarAED18_Qty + $Customer_SolarAED18_ReserveQty_Open;
								$total_Cus_SolarAED30_Qty = $Customer_SolarAED30_Qty + $Customer_SolarAED30_ReserveQty_Open;
								
								$html_str .= '<tr>
									<td '.$RowStyleFirst.' width="30px"></td>
									<td '.$RowStyleOther.' align="center" width="270px">Total Stock</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.($Customer_SupremeAED15_Qty + $Customer_SupremeAED15_ReserveQty_Open).'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.($Customer_SupremeAED15US_Qty + $Customer_SupremeAED15US_ReserveQty_Open).'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.($Customer_SupremeAED18_Qty + $Customer_SupremeAED18_ReserveQty_Open).'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.($Customer_SupremeAED30_Qty + $Customer_SupremeAED30_ReserveQty_Open).'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.($Customer_SolarAED15_Qty + $Customer_SolarAED15_ReserveQty_Open).'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.($Customer_SolarAED18_Qty + $Customer_SolarAED18_ReserveQty_Open).'</td>
									<td '.$RowStyleOther.' width="70px" align="center">'.($Customer_SolarAED30_Qty + $Customer_SolarAED30_ReserveQty_Open).'</td>
									<td></td> <td></td> <td></td>
								</tr>';
								
								$Dsrno++;
							
						$html_str .= '</table>
					</td>
				</tr>
			</table><br/>';	

$html_str .='<table border="1" width="700px" cellspacing="0" cellpadding="0" align="center" id="maintable">
				  <tr>
					<td class="pageHeading" align="center" style="background-color:#B1E0E0;width:100%;font-size:18px;font:weight:bold;">Subdealers AED Planning</td>
				  </tr>
				  <tr>
					<td valign="top" width="70%">
						<table style="border:1px solid black;" width="1000px" cellspacing="0" cellpadding="0">
							<tr style="background-color: #AFAFAF;">
								<td '.$HeadingRowStyleFirst.' align="center" rowspan="2" width="30px">S No.</td>
								<td '.$HeadingRowStyleFirst.' align="center" rowspan="2" width="270px">Subdealer Name</td>
								<td '.$HeadingRowStyleOther.' align="center" colspan="4" width="400px">Supreme AED</td>
								<td '.$HeadingRowStyleOther.' align="center" colspan="3" width="300px">Solar AED</td>
								</tr>
							<tr style="background-color: #AFAFAF;">
								<td '.$HeadingRowStyleOther.' align="center" width="100px">AED 1.5</td>
								<td '.$HeadingRowStyleOther.' align="center" width="100px">AED 1.5 US</td>
								<td '.$HeadingRowStyleOther.' align="center" width="100px">AED 1.8</td>
								<td '.$HeadingRowStyleOther.' align="center" width="100px">AED 3.0</td>
								<td '.$HeadingRowStyleOther.' align="center" width="100px">AED 1.5</td>
								<td '.$HeadingRowStyleOther.' align="center" width="100px">AED 1.8</td>
								<td '.$HeadingRowStyleOther.' align="center" width="100px">AED 3.0</td>
								
							</tr>';
							$rowcnt = 0;
							$srno = 1;
							$total_supremeAED15= 0;
							$total_supremeAED15US= 0;
							$total_supremeAED18= 0;
							$total_supremeAED30= 0;
							$total_solarAED15= 0;
							$total_solarAED18= 0;
							$total_solarAED30= 0;
							
							foreach($listData as $curRow){
								$SubdealerCd 				=	$curRow['SubdealerCd'];	
								$Subdealer_Name 			=	$curRow['subdealer_Name'];	
								$Subdealer_SupremeAED15_Date	= 	$classBusiLogic->convertDate($curRow['Subdealer_SupremeAED15_Date'], False, 1);	
								$Subdealer_SupremeAED15_Qty 	= 	($curRow['Subdealer_SupremeAED15_Qty']) ? $curRow['Subdealer_SupremeAED15_Qty'] : "";	
								$Subdealer_SupremeAED15US_Date	= 	$classBusiLogic->convertDate($curRow['Subdealer_SupremeAED15US_Date'], False, 1);	
								$Subdealer_SupremeAED15US_Qty 	= 	($curRow['Subdealer_SupremeAED15US_Qty'] ) ? $curRow['Subdealer_SupremeAED15US_Qty'] : "";	
								$Subdealer_SupremeAED18_Date	= 	$classBusiLogic->convertDate($curRow['Subdealer_SupremeAED18_Date'], False, 1);	
								$Subdealer_SupremeAED18_Qty 	= 	($curRow['Subdealer_SupremeAED18_Qty']) ? $curRow['Subdealer_SupremeAED18_Qty'] : "";	
								$Subdealer_SupremeAED30_Date	= 	$classBusiLogic->convertDate($curRow['Subdealer_SupremeAED30_Date'], False, 1);	
								$Subdealer_SupremeAED30_Qty 	= 	($curRow['Subdealer_SupremeAED30_Qty']) ? $curRow['Subdealer_SupremeAED30_Qty'] : "";	
								$Subdealer_SolarAED15_Date 	=  	$classBusiLogic->convertDate($curRow['Subdealer_SolarAED15_Date'], False, 1);
								$Subdealer_SolarAED15_Qty	 	= 	($curRow['Subdealer_SolarAED15_Qty'] ) ? $curRow['Subdealer_SolarAED15_Qty'] : "";	
						 	 	$Subdealer_SolarAED18_Date 	=  	$classBusiLogic->convertDate($curRow['Subdealer_SolarAED18_Date'], False, 1);
								$Subdealer_SolarAED18_Qty	 	= 	($curRow['Subdealer_SolarAED18_Qty'] ) ?  $curRow['Subdealer_SolarAED18_Qty'] : "" ;	
						 	 	$Subdealer_SolarAED30_Date 	=  	$classBusiLogic->convertDate($curRow['Subdealer_SolarAED30_Date'], False, 1);
								$Subdealer_SolarAED30_Qty	 	= ($curRow['Subdealer_SolarAED30_Qty'] ) ? $curRow['Subdealer_SolarAED30_Qty'] : "";	
						 	 	
							$html_str .= '<tr align="right">
									<td '.$RowStyleFirst.' width="30px"  align="center">'.$srno.'</td>
									<td '.$RowStyleOther.' width="270px" align="left">'.strtoupper($Subdealer_Name).'</td>
									<td '.$RowStyleOther.' width="50px" >'.$Subdealer_SupremeAED15_Qty .'</td>
									<td '.$RowStyleOther.' width="50px" >'.$Subdealer_SupremeAED15US_Qty.'</td>
									<td '.$RowStyleOther.' width="60px" >'.$Subdealer_SupremeAED18_Qty.'</td>
									<td '.$RowStyleOther.' width="60px" >'.$Subdealer_SupremeAED30_Qty.'</td>
									<td '.$RowStyleOther.' width="60px" >'.$Subdealer_SolarAED15_Qty.'</td>
									<td '.$RowStyleOther.' width="50px" >'.$Subdealer_SolarAED18_Qty.'</td>
									<td '.$RowStyleOther.' width="50px" >'.$Subdealer_SolarAED30_Qty.'</td>
								</tr>';
								$srno++;
								$total_supremeAED15		= ($total_supremeAED15+$Subdealer_SupremeAED15_Qty) ? $total_supremeAED15+$Subdealer_SupremeAED15_Qty : "";
								$total_supremeAED15US	= ($total_supremeAED15US+$Subdealer_SupremeAED15US_Qty) ? $total_supremeAED15US+$Subdealer_SupremeAED15US_Qty : "";
								$total_supremeAED18		= ($total_supremeAED18+$Subdealer_SupremeAED18_Qty) ? $total_supremeAED18+$Subdealer_SupremeAED18_Qty : "";
								$total_supremeAED30		= ($total_supremeAED30+$Subdealer_SupremeAED30_Qty) ? $total_supremeAED30+$Subdealer_SupremeAED30_Qty : "";
								$total_solarAED15		= ($total_solarAED15+$Subdealer_SolarAED15_Qty) ? $total_solarAED15+$Subdealer_SolarAED15_Qty : "";
								$total_solarAED18		= ($total_solarAED18+$Subdealer_SolarAED18_Qty) ? $total_solarAED18+$Subdealer_SolarAED18_Qty : "";
								$total_solarAED30		= ($total_solarAED30+$Subdealer_SolarAED30_Qty) ? $total_solarAED30+$Subdealer_SolarAED30_Qty : "";
							}
							$html_str .= '<tr  align="right" style="background-color:#ffccff;">
									<td '.$RowStyleFirst.' width="40px"></td>
									<td '.$RowStyleOther.' align="center" width="300px">Total</td>
									<td '.$RowStyleOther.' width="100px" >'.$total_supremeAED15.'</td>
									<td '.$RowStyleOther.' width="100px" >'.$total_supremeAED15US.'</td>
									<td '.$RowStyleOther.' width="100px" >'.$total_supremeAED18.'</td>
									<td '.$RowStyleOther.' width="100px" >'.$total_supremeAED30.'</td>
									<td '.$RowStyleOther.' width="100px" >'.$total_solarAED15.'</td>
									<td '.$RowStyleOther.' width="100px" >'.$total_solarAED18.'</td>
									<td '.$RowStyleOther.' width="100px" >'.$total_solarAED30.'</td>
								</tr>';
								
								
									$remainSupremeAED15 = ($total_Cus_SupremeAED15_Qty-$total_supremeAED15)? ($total_Cus_SupremeAED15_Qty-$total_supremeAED15): "";
									$remainSupremeAED15US = ($total_Cus_SupremeAED15US_Qty-$total_supremeAED15US)? ($total_Cus_SupremeAED15US_Qty-$total_supremeAED15US) : "";
									$remainSupremeAED18 = ($total_Cus_SupremeAED18_Qty-$total_supremeAED18) ? ($total_Cus_SupremeAED18_Qty-$total_supremeAED18) : "";
									$remainSupremeAED30 = ($total_Cus_SupremeAED30_Qty-$total_supremeAED30) ? ($total_Cus_SupremeAED30_Qty-$total_supremeAED30) : "";
									$remainSolarAED15 = ($total_Cus_SolarAED15_Qty-$total_solarAED15) ? ($total_Cus_SolarAED15_Qty-$total_solarAED15) : "";
									$remainSolarAED18 = ($total_Cus_SolarAED18_Qty-$total_solarAED18) ? ($total_Cus_SolarAED18_Qty-$total_solarAED18) : "";
									$remainSolarAED30 = ($total_Cus_SolarAED30_Qty-$total_solarAED30) ? ($total_Cus_SolarAED30_Qty-$total_solarAED30) : "";
									
							$html_str .= '<tr  align="right" style="background-color:#ffccff;">
									<td '.$RowStyleFirst.' width="40px"></td>
									<td '.$RowStyleOther.' align="center" width="300px">Reserve Stock</td>
									<td '.$RowStyleOther.' width="100px" >'.($remainSupremeAED15) .'</td>
									<td '.$RowStyleOther.' width="100px" >'.($remainSupremeAED15US).'</td>
									<td '.$RowStyleOther.' width="100px" >'.($remainSupremeAED18).'</td>
									<td '.$RowStyleOther.' width="100px" >'.($remainSupremeAED30).'</td>
									<td '.$RowStyleOther.' width="100px" >'.($remainSolarAED15).'</td>
									<td '.$RowStyleOther.' width="100px" >'.($remainSolarAED18).'</td>
									<td '.$RowStyleOther.' width="100px" >'.($remainSolarAED30).'</td>
								</tr>';	
							
						$html_str .= '</table>
					</td>
				</tr>
			</table>';	
			echo $html_str ;
		?>	
		<?php if($_GET['IsView']!=1){ ?>
<table width="100%">
<tr>
	<td align="left">
		<table>
			<tr>
				<td align="right">
					<table cellspacing="0" cellpadding="0"><tr><td class="button-left-bg"></td><td class="button-center-bg"><input type="button" value="<?php echo 'Save'; ?>" onclick="SaveForm();"></td><td class="button-right-bg"></td></tr></table>
				</td>
				<td>
					<table cellspacing="0" cellpadding="0" class="Cancel-Button"><tr><td class="button-left-bg"></td><td class="button-center-bg"><input type="button" id="btnCancel" value="Edit" onclick="editForm();"></td><td class="button-right-bg"></td></tr> </table>
				</td>
			</tr>
		</table>
		
	</td>
</tr>
</table>
<?php } ?>

	 
	</div>
	</body>
</html>
<script>
var queryString = window.location.search.substring(1);
    var varArray = queryString.split("&"); //eg. index.html?msg=1
    var param1 = varArray[0];	// CustomerCd 
	var param2 = varArray[1];	//Year
	var param3 = varArray[2];	//Month
	var param4 = varArray[3];	//AEDAllotment_Id
	
	$(function(){
		 $('#popup').bPopup({
			modalClose: false,
			escClose: false,
		});
	});
	
	function editForm(){
		window.location = "../index.php?action=editDealerSubDealerAEDAllocation&" +param1+"&"+param2+"&"+param3+"&"+param4;
	}
	
	function SaveForm(){
		window.location = "./../special/genrate_dealer_subdealerAED_allocation.php?"+param1+"&"+param2+"&"+param3+"&"+param4;
		
	}
	</script>