<?php
	include "db_connection/db_connection.php";
	include "config/config.php";
	
	if($_SESSION['admin_login_id'] == '')
	{
		echo "<script>window.location='index.php';</script>";
	}
?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
        <title><?php echo $PROJECT_TITLE ?></title>
        
        <link href="css/styles.css" rel="stylesheet" type="text/css" />    
        <style type="text/css">
			.timeEntry_control{
				margin-top:5px;	
			}
		</style>    
        <!--[if IE]> <link href="css/ie.css" rel="stylesheet" type="text/css"> <![endif]-->
        <script type="text/javascript" src="js/plugins/forms/jquery.min.js"></script>
        <!--<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>-->
        <script type="text/javascript" src="js/cad_update_design.js"></script>
        <script type="text/javascript" src="js/plugins/forms/ui.spinner.js"></script>
        <script type="text/javascript" src="js/plugins/forms/jquery.mousewheel.js"></script>
         <script type="text/javascript" src="js/plugins/forms/jquery.min.ui.js"></script>
        <!--<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>-->
        
        <script type="text/javascript" src="js/plugins/charts/excanvas.min.js"></script>
        <script type="text/javascript" src="js/plugins/charts/jquery.flot.js"></script>
        <script type="text/javascript" src="js/plugins/charts/jquery.flot.orderBars.js"></script>
        <script type="text/javascript" src="js/plugins/charts/jquery.flot.pie.js"></script>
        <script type="text/javascript" src="js/plugins/charts/jquery.flot.resize.js"></script>
        <script type="text/javascript" src="js/plugins/charts/jquery.sparkline.min.js"></script>
        
        <script type="text/javascript" src="js/plugins/tables/jquery.dataTables.js"></script>
        <script type="text/javascript" src="js/plugins/tables/jquery.sortable.js"></script>
        <script type="text/javascript" src="js/plugins/tables/jquery.resizable.js"></script>
        
        <script type="text/javascript" src="js/plugins/forms/autogrowtextarea.js"></script>
        <script type="text/javascript" src="js/plugins/forms/jquery.uniform.js"></script>
        <script type="text/javascript" src="js/plugins/forms/jquery.inputlimiter.min.js"></script>
        <script type="text/javascript" src="js/plugins/forms/jquery.tagsinput.min.js"></script>
        <script type="text/javascript" src="js/plugins/forms/jquery.maskedinput.min.js"></script>
        <script type="text/javascript" src="js/plugins/forms/jquery.autotab.js"></script>
        <script type="text/javascript" src="js/plugins/forms/jquery.chosen.min.js"></script>
        <script type="text/javascript" src="js/plugins/forms/jquery.dualListBox.js"></script>
        <script type="text/javascript" src="js/plugins/forms/jquery.cleditor.js"></script>
        <script type="text/javascript" src="js/plugins/forms/jquery.ibutton.js"></script>
        <script type="text/javascript" src="js/plugins/forms/jquery.validationEngine-en.js"></script>
        <script type="text/javascript" src="js/plugins/forms/jquery.validationEngine.js"></script>
        
        <script type="text/javascript" src="js/plugins/uploader/plupload.js"></script>
        <script type="text/javascript" src="js/plugins/uploader/plupload.html4.js"></script>
        <script type="text/javascript" src="js/plugins/uploader/plupload.html5.js"></script>
        <script type="text/javascript" src="js/plugins/uploader/jquery.plupload.queue.js"></script>
        
        <script type="text/javascript" src="js/plugins/wizards/jquery.form.wizard.js"></script>
        <script type="text/javascript" src="js/plugins/wizards/jquery.validate.js"></script>
        <script type="text/javascript" src="js/plugins/wizards/jquery.form.js"></script>
        
        <script type="text/javascript" src="js/plugins/ui/jquery.collapsible.min.js"></script>
        <script type="text/javascript" src="js/plugins/ui/jquery.breadcrumbs.js"></script>
        <script type="text/javascript" src="js/plugins/ui/jquery.tipsy.js"></script>
        <script type="text/javascript" src="js/plugins/ui/jquery.progress.js"></script>
        <script type="text/javascript" src="js/plugins/ui/jquery.timeentry.min.js"></script>
        <script type="text/javascript" src="js/plugins/ui/jquery.colorpicker.js"></script>
        <script type="text/javascript" src="js/plugins/ui/jquery.jgrowl.js"></script>
        <script type="text/javascript" src="js/plugins/ui/jquery.fancybox.js"></script>
        <script type="text/javascript" src="js/plugins/ui/jquery.fileTree.js"></script>
        <script type="text/javascript" src="js/plugins/ui/jquery.sourcerer.js"></script>
        
        <script type="text/javascript" src="js/plugins/others/jquery.fullcalendar.js"></script>
        <script type="text/javascript" src="js/plugins/others/jquery.elfinder.js"></script>
        
        <script type="text/javascript" src="js/plugins/ui/jquery.easytabs.min.js"></script>
        <script type="text/javascript" src="js/files/bootstrap.js"></script>
        <script type="text/javascript" src="js/files/functions.js"></script>
        
        <!-- Shared on MafiaShare.net  --><!-- Shared on MafiaShare.net  --></head>
        
        <body onload="dynamic_tabel_add('k,0'),document.getElementById('listpage').focus();">
        
        <!-- Top line begins -->
        <?php include "header_footer/header.php"; ?>
        <!-- Top line ends -->
        
        
        <!-- Sidebar begins -->
        <?php include "menus/left_menu.php"; ?>
        <!-- Sidebar ends -->
        
        
        
        <!-- Content begins -->
        <div id="content">
            <?php include "menus/top_menu.php"; ?> 
            <!-- Breadcrumbs line -->
            <div class="breadLine">
                <div class="bc">
                    <ul id="breadcrumbs" class="breadcrumbs">
                        <li><a href="home.php">Dashboard</a></li>
                        <li><a href="javascritp:">Cad Design Update</a></li>
                        
                    </ul>
                </div>        
                <?php include "menus/top_left_menu.php"; ?>  
            </div>          
            <!-- Main content -->
            <div class="wrapper">
            	<ul class="middleNavR">
                    <li><a href="cad_finishing.php" id="listpage" title="List CAD Finish" class="tipN"><img src="images/icons/middlenav/stats.png" alt="" /></a></li>
                </ul>
                <?php
					if(isset($_GET['rad_typ']) && $_GET['rad_typ']!='')
					{
						$rad_typ = base64_decode(base64_decode(base64_decode(base64_decode($_GET['rad_typ']))));
						$dis_div = 'block';
					}
					else
					{
						$rad_typ = '';
						$dis_div = 'none';
					}
					
					if(isset($_GET['des_no']) && $_GET['des_no']!='')
					{
						$splt = explode("$$",$_GET['des_no']);
						$des_det_id = $splt[0];
						$emp_id_de = $splt[1];
						$des_flagg = 1;
						$det_id = base64_decode(base64_decode(base64_decode(base64_decode($des_det_id))));
						$emp_id = base64_decode(base64_decode(base64_decode(base64_decode($emp_id_de))));
						
					}
					else
					{
						$des_det_id = '';
						$des_flagg = 2;
						$det_id = '';
						$emp_id_de = '';
						$emp_id = '';
					}
					
					$SLCT_CURR  = "SELECT * FROM emp_current_design WHERE emp_det_id='$emp_id' AND design_det_id='$det_id' AND statu_s='1' ORDER BY emp_current_design_id DESC";
					$EXEC_CURR 	= mysqli_query($connect,$SLCT_CURR);
					if(mysqli_num_rows($EXEC_CURR)>0)
					{
						$INSRT_CURR_UPD = "UPDATE `emp_current_design` SET statu_s='2' WHERE emp_det_id='$emp_id' AND design_det_id='$det_id'";
						//echo $INSRT_CURR_DET."<br>";
						$EXECT_CURR_UPD = mysqli_query($connect,$INSRT_CURR_UPD);
					}
				?>
                <div class="fluid">
                    <div class="widget"> 
                        <div class="formRow">
                            <div class="grid3"><label>Type:<span class="req">*</span></label></div>
                            <div class="grid2">
                            	<label for="cad_type1"><input <?php if($rad_typ==1){ ?> checked="checked" <?php } ?> type="radio" id="cad_type1" name="cad_type" value="<?php echo base64_encode(base64_encode(base64_encode(base64_encode(1)))); ?>" onclick="reload_page(this.value)" />Cad Load</label>
                            </div>
                            <div class="grid2">
                                <label for="cad_type2"><input <?php if($rad_typ==2){ ?> checked="checked" <?php } ?> type="radio" id="cad_type2" name="cad_type" value="<?php echo base64_encode(base64_encode(base64_encode(base64_encode(2)))); ?>" onclick="reload_page(this.value)" />Cad Finish</label>
                            </div>   
							<div class="clear"></div>
                    </div>
                </div>
                <div class="fluid" style="display:<?php echo $dis_div; ?>;">
                    <div class="widget"> 
                        <div class="formRow">
                            <div class="grid3"><label>Design No:<span class="req">*</span></label></div>
                            <div class="grid6" id="des_no_div">
								<div class="searchDrop">
                                <select data-placeholder="Choose The Design No..." class="select" name="desin_no" <?php if($des_flagg==1){ ?> disabled="disabled"<?php } ?> id="desin_no" style="width:200px;" tabindex="2" >
                                    <option value=""></option>
                                    <?php
										if($rad_typ==1)
										{
											$SLCT_comp = "SELECT *,cad_loading.emp_det_id AS emp_det FROM cad_loading, design_det WHERE cad_loading.design_det_id = design_det.design_det_id AND cad_loading.emp_det_id!='0' AND cad_loading.design_det_id NOT IN (SELECT design_det_id FROM emp_current_design WHERE curr_status='closed' OR curr_status='finished')";
										}
										else if($rad_typ==2)
										{
											$SLCT_comp = "SELECT `design_det`.`design_det_id`, `design_det`.`design_no`, `design_det`.`master_cat_id`, `cad_finishing`.`emp_det_id` AS emp_det FROM `cad_finishing`,`cad_finishing_des`,`design_det` WHERE `cad_finishing`.`cad_finishing_id` = `cad_finishing_des`.`cad_finishing_id` AND `cad_finishing_des`.`design_det_id` = `design_det`.`design_det_id` AND `cad_finishing_des`.`design_det_id` NOT IN(SELECT `design_det_id` FROM `emp_current_design` WHERE `curr_status`='closed' OR `curr_status`='finished') ORDER BY `design_det`.`design_det_id` ASC";
										}
										$QURY_comp = mysqli_query($connect,$SLCT_comp);
										if(mysqli_num_rows($QURY_comp)>0)
										{
											while($FTCH_comp = mysqli_fetch_object($QURY_comp))
											{                                            
												$design_det_id	=	base64_encode(base64_encode(base64_encode(base64_encode($FTCH_comp->design_det_id))));
												$emp_det	=	base64_encode(base64_encode(base64_encode(base64_encode($FTCH_comp->emp_det))));
												
												$SLCT_d = "SELECT  * FROM master_cat WHERE master_cat_id = '$FTCH_comp->master_cat_id'";
												$QURY_d = mysqli_query($connect,$SLCT_d);
												$FTCH_d = mysqli_fetch_object($QURY_d);
									?>
												<option <?php if($des_det_id==$design_det_id){ ?> selected="selected"<?php } ?> value="<?php echo $design_det_id."$$".$emp_det;?>"><?php echo $FTCH_d->master_cat_name." ".$FTCH_comp->design_no; ?></option>
									<?php
											}
										} 
									?>
                                </select>
								</div>
                            </div>                            
							<?php if($des_flagg!=1){?>
							<span class="grid3" style="float:right">
								<input type="button" value="Load" class="buttonM bGreen formSubmit" onclick="form_load()" onfocus="foc(this.id)" onblur="stnon(this.id)" style="float: right; margin-left:20px;"/>
							</span>
							<?php } ?>
							<div class="clear"></div>
                    </div>
                </div>
                <?php
					$page_id = base64_encode(base64_encode(base64_encode(base64_encode(1))));
					if(isset($_GET['des_no']) && $_GET['des_no']!='')
					{
						$des_no  = base64_decode(base64_decode(base64_decode(base64_decode($des_det_id))));
						$emp_ad_id  = base64_decode(base64_decode(base64_decode(base64_decode($emp_id_de))));
						
						$SLCT_CAD = "SELECT * FROM emp_current_design,design_det WHERE design_det.design_det_id = emp_current_design.design_det_id AND emp_current_design.design_det_id = '$des_no' AND emp_current_design.emp_det_id='$emp_ad_id'";
						//echo $SLCT_CAD;
						$QURY_CAD = mysqli_query($connect,$SLCT_CAD);
						if(mysqli_num_rows($QURY_CAD)>0)
						{
							$FTCH_CAD = mysqli_fetch_object($QURY_CAD);
							
							$cur_ad_id  = base64_encode(base64_encode(base64_encode(base64_encode($FTCH_CAD->emp_current_design_id))));
							
							$SLCT_CURR_TIM = "SELECT SEC_TO_TIME( SUM( TIME_TO_SEC( `time_taken` ) ) ) AS tot_time FROM emp_current_design_det WHERE emp_current_design_id = '$FTCH_CAD->emp_current_design_id'";
							$QURY_CURR_TIM = mysqli_query($connect,$SLCT_CURR_TIM);
							$FTCH_CURR_TIM = mysqli_fetch_object($QURY_CURR_TIM);
							
							$SLCT_t = "SELECT * FROM master_cad_cat WHERE master_cad_cat_id = '$FTCH_CAD->master_cad_cat_id'";
							$QURY_t = mysqli_query($connect,$SLCT_t);
							if(mysqli_num_rows($QURY_t )>0)
							{
								$FTCH_t = mysqli_fetch_object($QURY_t);
								$cad_cat_name = $FTCH_t->cad_cat_name;
								$cad_pnts = $FTCH_t->cad_points;
							}
							else
							{ 
								$cad_cat_name = "------"; 
								$cad_pnts="----"; 
							}
							
							$SLCT_re = "SELECT * FROM emp_current_design_rework WHERE emp_det_id = '$emp_ad_id' AND design_det_id='$des_no'";
							$QURY_re = mysqli_query($connect,$SLCT_re);
							if(mysqli_num_rows($QURY_re)>0)
							{
								$FTCH_t = mysqli_fetch_object($QURY_re);
								$re_pnts = $FTCH_t->rework_pnts;
							}
							else
							{
								$re_pnts = $cad_pnts;
							}
							
							$SLCT_d = "SELECT * FROM master_cat WHERE master_cat_id = '$FTCH_CAD->master_cat_id'";
							//echo $SLCT_d;
							$QURY_d = mysqli_query($connect,$SLCT_d);
							$FTCH_d = mysqli_fetch_object($QURY_d);	
							
							$SLCT_em = "SELECT * FROM emp_det WHERE emp_det_id = '$emp_ad_id'";
							//echo $SLCT_d;
							$QURY_em = mysqli_query($connect,$SLCT_em);
							$FTCH_em = mysqli_fetch_object($QURY_em);		
							//echo $FTCH_CAD->curr_status;
							if($FTCH_CAD->img_ext!='')
							{
								$imag_1 = "../cad_fin_images/M.".$FTCH_CAD->img_ext; 
								$imag_2 = "../cad_fin_images/L.".$FTCH_CAD->img_ext;
								$img_flagg = 1;
							}
							else
							{
								$img_flagg = 2;
							}
							if($FTCH_CAD->mas_fin_ext!=''){ $imag = "../mas_fin_images/M.".$FTCH_CAD->mas_fin_ext; $imag1 = "../mas_fin_images/L.".$FTCH_CAD->mas_fin_ext; }
							
							else if($FTCH_CAD->cad_fin_ext!=''){ $imag = "../cad_fin_images/M.".$FTCH_CAD->cad_fin_ext; $imag1 = "../cad_fin_images/L.".$FTCH_CAD->cad_fin_ext; }
							
							else if($FTCH_CAD->imag_ext!=''){ $imag = "../design_images/M.".$FTCH_CAD->imag_ext; $imag1 = "../design_images/L.".$FTCH_CAD->imag_ext; }
							$tot_tims = $FTCH_CURR_TIM->tot_time;
							$flgg = 1;
						}
						else
						{
							if($rad_typ==1)
							{
								$SLCT_CAD = "SELECT * FROM cad_loading,design_det WHERE design_det.design_det_id = cad_loading.design_det_id AND cad_loading.design_det_id = '$des_no' AND cad_loading.emp_det_id='$emp_ad_id'";
							}
							else if($rad_typ==2)
							{
								$SLCT_CAD = "SELECT * FROM `cad_finishing`,`cad_finishing_des`,`design_det` WHERE `cad_finishing`.`cad_finishing_id` = `cad_finishing_des`.`cad_finishing_id` AND `cad_finishing_des`.`design_det_id` = `design_det`.`design_det_id` AND cad_finishing_des.design_det_id = '$des_no' AND cad_finishing.emp_det_id='$emp_ad_id' ORDER BY `design_det`.`design_det_id` ASC";
							}
							//echo $SLCT_CAD;
							$QURY_CAD = mysqli_query($connect,$SLCT_CAD);
							$FTCH_CAD = mysqli_fetch_object($QURY_CAD);
							
							$SLCT_t = "SELECT * FROM master_cad_cat WHERE master_cad_cat_id = '$FTCH_CAD->master_cad_cat_id'";
							$QURY_t = mysqli_query($connect,$SLCT_t);
							if(mysqli_num_rows($QURY_t )>0)
							{
								$FTCH_t = mysqli_fetch_object($QURY_t);
								$cad_cat_name = $FTCH_t->cad_cat_name;
								$cad_pnts = $FTCH_t->cad_points;
							}
							else
							{ 
								$cad_cat_name = "------"; 
								$cad_pnts="----"; 
							}
							$re_pnts = $cad_pnts;
							
							$SLCT_d = "SELECT * FROM master_cat WHERE master_cat_id = '$FTCH_CAD->master_cat_id'";
							//echo $SLCT_d;
							$QURY_d = mysqli_query($connect,$SLCT_d);
							$FTCH_d = mysqli_fetch_object($QURY_d);	
							
							$SLCT_em = "SELECT * FROM emp_det WHERE emp_det_id = '$emp_ad_id'";
							//echo $SLCT_d;
							$QURY_em = mysqli_query($connect,$SLCT_em);
							$FTCH_em = mysqli_fetch_object($QURY_em);
						
							if($FTCH_CAD->mas_fin_ext!=''){ $imag = "../mas_fin_images/M.".$FTCH_CAD->mas_fin_ext; $imag1 = "../mas_fin_images/L.".$FTCH_CAD->mas_fin_ext; }
							
							else if($FTCH_CAD->cad_fin_ext!=''){ $imag = "../cad_fin_images/M.".$FTCH_CAD->cad_fin_ext; $imag1 = "../cad_fin_images/L.".$FTCH_CAD->cad_fin_ext; }
							
							else if($FTCH_CAD->imag_ext!=''){ $imag = "../design_images/M.".$FTCH_CAD->imag_ext; $imag1 = "../design_images/L.".$FTCH_CAD->imag_ext; }
							
							$tot_tims = "00:00:00";
							$flgg = 2;	
							$img_flagg = 2;						
						}
              	?>
                        <form id="validate" name="cur_des" class="main" method="post" action="bl/cad_design_update_BL.php" enctype="multipart/form-data">
                            <fieldset>
                                <input type="hidden" name="des_no" id="des_no" value="<?php echo $des_det_id ?>" />
                                <input type="hidden" name="emp_id" id="emp_id" value="<?php echo $emp_id_de; ?>" />
                                <input type="hidden" name="cad_pnts" id="cad_pnts" value="<?php echo $cad_pnts; ?>" />
                                <input type="hidden" name="des_caty" id="des_caty" value="<?php echo $FTCH_d->category; ?>" />                                
                                <div class="fluid">
                                    <div class="widget">
                                        <div class="formRow">
                                            <table width="100%">
                                                <tr>
                                                    <td width="10%" style="display:table-cell; vertical-align:middle;"><strong>Des Name  :  </strong></td>
                                                    <td width="14%" style="display:table-cell; vertical-align:middle;"><?php echo $FTCH_em->name; ?></td>
                                                    <td width="10%" style="display:table-cell; vertical-align:middle;"><strong>Design No  :  </strong></td>
                                                    <td width="10%" style="display:table-cell; vertical-align:middle;"><?php echo $FTCH_d->master_cat_name." ".$FTCH_CAD->design_no; ?></td>
                                                    <td width="10%" style="display:table-cell; vertical-align:middle;"><strong>Point  :  </strong></td>
                                                    <td width="6%" style="display:table-cell; vertical-align:middle;"><?php echo $re_pnts; ?></td>
                                                    <td width="14%" style="display:table-cell; vertical-align:middle;"><strong>App Weight  :  </strong></td>
                                            		<td width="6%" style="display:table-cell; vertical-align:middle;"><?php echo $FTCH_CAD->approximate_weight; ?></td>
                                                    <td width="10%" style="display:table-cell; vertical-align:middle;"><strong>Tot Time  :  </strong></td>
                                                    <td width="10%" style="display:table-cell; vertical-align:middle;"><?php echo $tot_tims; ?> hrs</td>
                                                </tr>
                                            </table>
                                        </div>
                                        <div class="formRow">
                                            <table width="100%">
                                                <tr>
                                                    <td width="80%" style="vertical-align:top; text-align:center; display:table-cell;">
                                                        <div class="widget" style="margin-top:0px;">
                                                            <table cellpadding="0" cellspacing="0" width="100%" class="tDefault" id="resize2">
                                                                <thead>
                                                                    <tr>
                                                                        <td class="sortCol" width="8%"><div>S.no<span></span></div></td>
                                                                        <td class="sortCol" width="15%"><div>W.app Date<span></span></div></td>
                                                                        <td class="sortCol" width="15%"><div>App. Date<span></span></div></td>
                                                                        <td class="sortCol" width="10%"><div>Admin<span></span></div></td>
                                                                        <td class="sortCol" width="15%"><div>Cad Volume<span></span></div></td>
                                                                        <td class="sortCol" width="15%"><div>Des. Height<span></span></div></td>
                                                                		<td class="sortCol" width="15%"><div>Des. Width<span></span></div></td>
                                                                        <td class="sortCol" width="20%"><div>Remarks<span></span></div></td>
                                                                    </tr>
                                                                </thead>
                                                                <tbody>
                                                                    <?php
                                                                        $i=1;
																		if($flgg == 1)
																		{
                                                                        $SLCT_CURR_APP  = "SELECT * FROM emp_current_design_det WHERE emp_current_design_id='$FTCH_CAD->emp_current_design_id' AND (waiting_app_dt!='' OR approved_dt!='')";
                                                                        //echo $SLCT_CURR_APP;
                                                                        $EXEC_CURR_APP 	= mysqli_query($connect,$SLCT_CURR_APP);
                                                                        while($FTCH_CURR_APP	= mysqli_fetch_object($EXEC_CURR_APP))
                                                                        {
                                                                    ?>
                                                                            <tr>
                                                                                <td class="sortCol"><div><?php echo $i; ?><span></span></div></td>
                                                                                <td class="sortCol"><div><?php echo $FTCH_CURR_APP->waiting_app_dt; ?><span></span></div></td>
                                                                                <td class="sortCol"><div><?php echo $FTCH_CURR_APP->approved_dt; ?><span></span></div></td>
                                                                                <td class="sortCol"><div><?php echo $FTCH_CURR_APP->appr_name; ?><span></span></div></td>
                                                                           		<td class="sortCol"><div><?php echo $FTCH_CURR_APP->cad_vol; ?><span></span></div></td>
                                                                                <td class="sortCol"><div><?php echo $FTCH_CURR_APP->design_height; ?><span></span></div></td>
                                                                        		<td class="sortCol"><div><?php echo $FTCH_CURR_APP->design_width; ?><span></span></div></td>
                                                                                <td class="sortCol"><div><?php echo $FTCH_CURR_APP->remarks; ?><span></span></div></td>
                                                                            </tr>
                                                                    <?php
                                                                            $i++;
                                                                        }
																		}
                                                                    ?>
                                                                </tbody>
                                                            </table>
                                                        </div>
                                                    </td>
                                                    <td width="20%" style="vertical-align:top; text-align:center; display:table-cell;">
                                                        <div class="body" style="height:200;text-align:center">
                                                            <a href="<?php echo $imag1; ?>" title="<?php echo $FTCH_d->master_cat_name." ".$FTCH_CAD->design_no; ?>" class="lightbox" rel="group"><img src="<?php echo $imag; ?>" width="220" height="220"/></a>
                                                        </div><br />
                                                        <?php 
															if($img_flagg==1)
															{
														?>
                                                                <div class="body" style="height:200;text-align:center">
                                                                    <a href="<?php echo $imag_2; ?>" title="<?php echo $FTCH_d->master_cat_name." ".$FTCH_CAD->design_no; ?>" class="lightbox" rel="group"><img src="<?php echo $imag_1; ?>" width="220" height="220"/></a>
                                                                </div>
                                                      	<?php
															}
														?>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                                <div class="widget">
                                    <!--<div style="max-height:700px; overflow-y:auto;">-->
                                        <table cellpadding="0" cellspacing="0" width="100%" class="tDefault" id="resize2">
                                            <thead>
                                                <tr>
                                                    <td class="sortCol" width="10%"><div>S.no<span></span></div></td>
                                                    <td class="sortCol" width="15%"><div>Date<span></span></div></td>
                                                    <td class="sortCol" width="15%"><div>Start Time<span></span></div></td>
                                                    <td class="sortCol" width="20%"><div>End Time<span></span></div></td>
                                                    <td class="sortCol" width="20%"><div>Time Taken<span></span></div></td>
                                                    <td class="sortCol" width="20%"><div>Total Design Time<span></span></div></td>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php
                                                    $loop=1;
													if($flgg == 1)
													{
                                                    $SLCT_CURR = "SELECT * FROM emp_current_design_det WHERE emp_current_design_id = '$FTCH_CAD->emp_current_design_id'";
                                                    $QURY_CURR = mysqli_query($connect,$SLCT_CURR);
                                                    while($FTCH_CURR = mysqli_fetch_object($QURY_CURR))
                                                    {
                                                        if($loop%2 != "0")
                                                            $bg = "gradeX";
                                                        else
                                                            $bg = "class='gradeC'";
                                                ?>
                                                        <tr>
                                                            <td style="display:table-cell; vertical-align:middle;" align="center"><?php echo $loop; ?></td>
                                                            <td style="display:table-cell; vertical-align:middle;" align="center"><?php echo str_replace("-","/",$FTCH_CURR->work_dt); ?></td>
                                                            <td style="display:table-cell; vertical-align:middle;" align="center"><?php echo $FTCH_CURR->start_time; ?><input type="hidden" name="st_tim[<?php echo $loop; ?>]" id="st_tim<?php echo $loop; ?>" value="<?php echo $FTCH_CURR->start_time; ?>" /></td>
                                                            <td style="display:table-cell; vertical-align:middle;" align="center"><span id="out_div<?php echo $loop; ?>"><?php echo $FTCH_CURR->end_time; ?></span><input type="hidden" name="out_tim[<?php echo $loop; ?>]" id="out_tim<?php echo $loop; ?>" value="<?php echo $FTCH_CURR->end_time; ?>" /></td>
                                                            <td style="display:table-cell; vertical-align:middle;" align="center"><span id="tak_div<?php echo $loop; ?>"><?php echo $FTCH_CURR->time_taken; ?></span><input type="hidden" name="tim_tak[<?php echo $loop; ?>]" id="tim_tak<?php echo $loop; ?>" value="<?php echo $FTCH_CURR->time_taken; ?>" /></td>
                                                            <td style="display:table-cell; vertical-align:middle;" align="center"><span id="tot_div<?php echo $loop; ?>"><?php echo $FTCH_CURR->tot_time; ?></span><input type="hidden" name="tot_tim[<?php echo $loop; ?>]" id="tot_tim<?php echo $loop; ?>" value="<?php echo $FTCH_CURR->tot_time; ?>" /></td>
                                                        </tr>
                                                <?php
                                                        $loop++;
                                                    }
													}
                                                ?>
                                            </tbody>
                                        </table> 
                                        <input type="hidden" name="tot_loop" id="tot_loop" value="<?php echo $loop; ?>" />
										<input type="hidden" name="flgg_vl" id="flgg_vl" value="<?php echo $flgg; ?>" />
                                    <!--</div>-->
                                </div> 
								<?php
									$loop2=1;
									$SLCT_STN = "SELECT * FROM emp_current_design_stone WHERE design_det_id = '$des_no' AND emp_det_id='$emp_ad_id' AND statu_s='1'";
									$QURY_STN = mysqli_query($connect,$SLCT_STN);
									if(mysqli_num_rows($QURY_STN)>0)
									{
								?>
										<div class="widget" >
											<table width="100%" class="tDefault" id="resize2">
												<thead>
													<tr>
														<td align="center"  width="5%" style="display:table-cell; vertical-align:middle;"><strong>Sl No</strong></td>
														<td align="center" width="20%" style="display:table-cell; vertical-align:middle;"><strong>Stone Shape</strong></td>
														<td align="center" width="20%" style="display:table-cell; vertical-align:middle;"><strong>Stone Size</strong></td>
														<td align="center" width="15%" style="display:table-cell; vertical-align:middle;"><strong>Stone Weight</strong></td>
														<td align="center" width="15%" style="display:table-cell; vertical-align:middle;"><strong>Quantity</strong></td>
														<td align="center" width="15%" style="display:table-cell; vertical-align:middle;"><strong>Total Weight</strong></td>
													</tr>
												</thead>
												<tbody>
												<?php
													while($FTCH_STN = mysqli_fetch_object($QURY_STN))
													{
														$SLCT_STN1 = "SELECT * FROM mas_stone_cat WHERE mas_stone_cat_id = '$FTCH_STN->mas_stone_cat_id'";
														$QURY_STN1 = mysqli_query($connect,$SLCT_STN1);
														$FTCH_STN1 = mysqli_fetch_object($QURY_STN1);	
														
														$SLCT_STN2 = "SELECT * FROM mas_stone_type WHERE mas_stone_type_id = '$FTCH_STN->mas_stone_type_id'";
														$QURY_STN2 = mysqli_query($connect,$SLCT_STN2);
														$FTCH_STN2 = mysqli_fetch_object($QURY_STN2);
												?>
														<tr>
															<td align="center" width="5%" style="display:table-cell; vertical-align:middle;"><?php echo $loop2; ?></td>
															<td align="center" width="20%" style="display:table-cell; vertical-align:middle;"><?php echo $FTCH_STN1->cat_name; ?></td>
															<td align="center" width="20%" style="display:table-cell; vertical-align:middle;"><?php echo $FTCH_STN2->stone_name; ?></td>
															<td align="center" width="15%" style="display:table-cell; vertical-align:middle;"><?php echo number_format($FTCH_STN->stone_weight,4)." g"; ?></td>
															<td align="center" width="15%" style="display:table-cell; vertical-align:middle;"><?php echo $FTCH_STN->quantity; ?></td>
															<td align="center" width="15%" style="display:table-cell; vertical-align:middle;"><?php echo number_format($FTCH_STN->total_weight,4)." g"; ?></td>
														</tr>
												<?php
														$loop2++;
													}
												?>
														<tr>
															<td align="center" colspan="4" style="display:table-cell; vertical-align:middle;">&nbsp;</td>
															<td align="center" width="15%" style="display:table-cell; vertical-align:middle;"><strong>Total Stone Weight</strong></td>
															<td align="center" width="15%" style="display:table-cell; vertical-align:middle;"><?php echo number_format($FTCH_CAD->total_stone_weight,4)." g"; ?></td>
														</tr>
												</tbody>
											</table>
											<div class="clear"></div>
										</div>
								<?php
									}
								?>
                                <div class="fluid">
                                    <div class="widget"> 
                                    	<div class="formRow">                                            
                                            <table width="100%">
                                                <tr>
                                                    <td width="15%" style="display:table-cell; vertical-align:middle;">Date :</td>
                                                    <td width="20%" style="display:table-cell; vertical-align:middle;"><input type="text" class="datepicker" name="app_dt" id="app_dt" onfocus="foc(this.id)" onblur="stnon(this.id)" value="" /></td>
                                                    <td width="15%" style="display:table-cell; vertical-align:middle;">Starting Time :</td>
                                                    <td width="20%" style="display:table-cell; vertical-align:middle;"><input type="text" class="timepicker" name="st_tim" id="st_tim" onfocus="foc(this.id)" onblur="stnon(this.id)" value="" /></td>
                                                    <td width="15%" style="display:table-cell; vertical-align:middle;">Ending Time :</td>
                                                    <td width="20%" style="display:table-cell; vertical-align:middle;"><div class="grid9"><input type="text" class="timepicker" name="ed_tim" id="ed_tim" onfocus="foc(this.id)" onblur="stnon(this.id)" value="" /></div></td>
                                                </tr>
                                            </table>                                                
                                            <div class="clear"></div>
                                        </div>
                                        <div class="formRow">
                                            <div class="grid2"><label>Type :</label> </div>
                                            <div class="grid4">
                                                <table>
                                                    <tr>
                                                        <td><input type="radio" id="radio3" name="question1" value="session_out" onfocus="foc(this.id)" onblur="stnon(this.id)" onclick="hide_sho(3)" /><label for="radio3" class="mr20">Break</label></td>
                                                        <td><input type="radio" id="radio1" name="question1" value="waiting" onfocus="foc(this.id)" onblur="stnon(this.id)" onclick="hide_sho(1)" /><label for="radio1" class="mr20">W.app</label></td>
                                                        <td><input type="radio" id="radio2" name="question1" value="finished" onfocus="foc(this.id)" onblur="stnon(this.id)" onclick="hide_sho(2)" /><label for="radio2" class="mr20">Finish</label></td>                                        		
                                                    </tr>
                                                </table>
                                                
                                            </div>
                                            <div class="clear"></div>
                                        </div>
                                        <div id="desin_div" style="display:none;">
                                            <div class="formRow" >
                                                <div class="grid2"><label>Design Image:<span class="req"></span></label></div>
                                                <div class="grid4" id="imgInp_div">
                                                    <input type="file" class="fileInput" id="imgInp" name="imgInp" onfocus="foc(this.id)" onblur="stnon(this.id)">
                                                    
                                                    <div id="img_div" style="width:250px; height:250px; border:solid 1px; margin-top:20px; display:none"><img id="blah" name="" type="image" src="#" width="250" height="250"/></div>
                                                </div>
                                                <!-- <div class="grid2"><label>Design Approximate Weight:<span class="req">*</span></label></div>
                                                <div class="grid4"> <input type="text" id="appr_wght" name="appr_wght" onfocus="foc(this.id)" onblur="stnon(this.id)" style="width:100px"></div>-->
                                                <div class="clear"></div>
                                            </div>
                                            <div class="formRow" >
                                                <div class="grid2"><label>Design Height:<span class="req">*</span></label></div>
                                                <div class="grid4"> <input type="text" id="des_hgt" name="des_hgt" onfocus="foc(this.id)" onblur="stnon(this.id)" style="width:100px"></div>
                                                <div class="grid2"><label>Design Width:<span class="req">*</span></label></div>
                                                <div class="grid4"> <input type="text" id="des_wth" name="des_wth" onfocus="foc(this.id)" onblur="stnon(this.id)" style="width:100px"></div>
                                                <div class="clear"></div>
                                            </div>
                                            <div class="formRow" >
                                                <div class="grid2"><label>Volume:<span class="req">*</span></label></div>
                                                <div class="grid9">
                                                    <input type="text" id="volum" name="volum" onfocus="foc(this.id)" onkeyup="gold_cal();" onblur="stnon(this.id)" style="width:100px">&nbsp;&nbsp;/&nbsp;&nbsp;
                                                    <input type="text" id="gold_to_vol" name="gold_to_vol" onkeyup="gold_cal();" onfocus="foc(this.id)" onblur="stnon(this.id)" style="width:100px">&nbsp;&nbsp;=&nbsp;&nbsp;
                                                    <input type="text" id="gold_wt" name="gold_wt" onfocus="foc(this.id)" onblur="stnon(this.id)" style="width:80px" readonly="">&nbsp;&nbsp;&nbsp;&nbsp;<label style="float:right; margin-right:30%; vertical-align:middle;">Approximate Gold Weight</label>
                                                </div>
                                                <div class="clear"></div>
                                            </div>
                                            <div class="formRow" >
			                                    <div class="grid2"><label>No. of Pieces:<span class="req">*</span></label></div>
			                                    <div class="grid9">
			                                        <input type="text" id="no_pce" name="no_pce" onfocus="foc(this.id)" onblur="stnon(this.id)" style="width:100px">
			                                 	</div>
			                                    <div class="clear"></div>
			                                </div>
			                                <?php
			                                if($FTCH_d->category=='Stone')
			                                {
			                                ?>
											<div class="formRow" >
												<table width="100%">
													<tr>
														<td align="center" width="5%" style="display:table-cell; vertical-align:middle;"><strong>Sl No</strong></td>
														<td align="center" width="20%" style="display:table-cell; vertical-align:middle;"><strong>Stone Shape</strong></td>
														<td align="center" width="20%" style="display:table-cell; vertical-align:middle;"><strong>Stone Size</strong></td>
														<td align="center" width="15%" style="display:table-cell; vertical-align:middle;"><strong>Stone Weight</strong></td>
														<td align="center" width="15%" style="display:table-cell; vertical-align:middle;"><strong>Quantity</strong></td>
														<td align="center" width="15%" style="display:table-cell; vertical-align:middle;"><strong>Total Weight</strong></td>
														<td align="center" width="10%" style="display:table-cell; vertical-align:middle;"><strong>Action</strong></td>
													</tr>
												</table>
													<?php
														$loop2=1;
														$SLCT_STN = "SELECT * FROM emp_current_design_stone WHERE design_det_id = '$des_no' AND emp_det_id='$emp_ad_id' AND statu_s='1'";
														$QURY_STN = mysqli_query($connect,$SLCT_STN);
														if(mysqli_num_rows($QURY_STN)>0)
														{
															while($FTCH_STN = mysqli_fetch_object($QURY_STN))
															{
													?>
																<div id="stone_div<?php echo $loop2;?>">
																	<table width="100%">
																		<tr>
																			<td align="center" width="5%" style="display:table-cell; vertical-align:middle;">&nbsp;</td>
																			<td align="center" width="20%" style="display:table-cell; vertical-align:middle;">&nbsp;</td>
																			<td align="center" width="20%" style="display:table-cell; vertical-align:middle;">&nbsp;</td>
																			<td align="center" width="15%" style="display:table-cell; vertical-align:middle;">&nbsp;</td>
																			<td align="center" width="15%" style="display:table-cell; vertical-align:middle;">&nbsp;</td>
																			<td align="center" width="15%" style="display:table-cell; vertical-align:middle;">&nbsp;</td>
																			<td align="center" width="10%" style="display:table-cell; vertical-align:middle;">&nbsp;</td>
																		</tr>
																		<tr>
																			<td align="center" style="display:table-cell; vertical-align:middle;"><?php echo $loop2; ?></td>
																			<td align="left" style="display:table-cell; vertical-align:middle;">
																				<div class="searchDrop">
																				<select data-placeholder="Choose The Stone Shape" class="select" name="cat_name[<?php echo $loop2; ?>]" id="cat_name<?php echo $loop2; ?>" style="width:150px;" tabindex="2" onchange="stone_size_chage(this.value,<?php echo '1,'.$loop2; ?>)">
																					<option value=""></option>
																					<?php
																						$SLCT_comp = "SELECT * FROM mas_stone_cat WHERE statu_s='active'";
																						$QURY_comp = mysqli_query($connect,$SLCT_comp);
																						if(mysqli_num_rows($QURY_comp)>0)
																						{
																							while($FTCH_comp = mysqli_fetch_object($QURY_comp))
																							{                                            
																								$mas_stone_cat_id =base64_encode(base64_encode(base64_encode(base64_encode($FTCH_comp->mas_stone_cat_id))));
																					?>
																								<option <?php if($FTCH_comp->mas_stone_cat_id==$FTCH_STN->mas_stone_cat_id){ ?> selected="selected" <?php } ?> value="<?php echo $mas_stone_cat_id;?>"><?php echo $FTCH_comp->cat_name; ?></option>
																					<?php
																							}
																						} 
																					?>
																				</select>
																				</div>
																			</td>
																			<td align="left" style="display:table-cell; vertical-align:middle;">
																				<div id="stn_size_div<?php echo $loop2; ?>" class="searchDrop">
																				<select data-placeholder="Choose The Stone Size" class="select" name="stn_size[<?php echo $loop2; ?>]" id="stn_size<?php echo $loop2; ?>" style="width:150px;" tabindex="2" onchange="stone_size_chage(this.value,<?php echo '2,'.$loop2; ?>)">
																					<option value=""></option>
																					<?php
																						$SLCT_comp1 = "SELECT * FROM mas_stone_type WHERE mas_stone_cat_id='$FTCH_STN->mas_stone_cat_id'";
																						$QURY_comp1 = mysqli_query($connect,$SLCT_comp1);
																						if(mysqli_num_rows($QURY_comp)>0)
																						{
																							while($FTCH_comp1 = mysqli_fetch_object($QURY_comp1))
																							{                                            
																								$mas_stone_type_id =base64_encode(base64_encode(base64_encode(base64_encode($FTCH_comp1->mas_stone_type_id))));
																					?>
																								<option <?php if($FTCH_comp1->mas_stone_type_id==$FTCH_STN->mas_stone_type_id){ ?> selected="selected" <?php } ?> value="<?php echo $mas_stone_type_id;?>"><?php echo $FTCH_comp1->stone_name; ?></option>
																					<?php
																							}
																						} 
																					?>
																				</select>
																				</div>
																			</td>
																			<td align="center" style="display:table-cell; vertical-align:middle;">
																			<div id="stn_wght_div<?php echo $loop2; ?>">
																			<input type="text" name="stn_wght[<?php echo $loop2;?>]" id="stn_wght<?php echo $loop2;?>"  class="input-text" value="<?php echo $FTCH_STN->stone_weight ?>" readonly="" style="width:100px"/></div>
																			</td>
																			<td align="center" style="display:table-cell; vertical-align:middle;"><input type="text" name="quanty[<?php echo $loop2;?>]" id="quanty<?php echo $loop2;?>"  class="input-text" onkeyup="quan_multiple(<?php echo $loop2;?>)" value="<?php echo $FTCH_STN->quantity ?>" style="width:100px"/></td>
																			<td align="center" style="display:table-cell; vertical-align:middle;"><input type="text" name="tot_wght[<?php echo $loop2;?>]" id="tot_wght<?php echo $loop2;?>"  class="input-text" readonly="" value="<?php echo $FTCH_STN->total_weight ?>" style="width:100px"/></td>
																			<td align="center" style="display:table-cell; vertical-align:middle;">
																				<div id="plus_sm<?php echo ",".$loop2 ?>" onClick="dynamic_tabel_add(this.id)" style="float:left; margin-left:20px"><a href="javascript:void(0)" title="" class="smallButton" style="margin: 5px;"><img src="images/icons/plus1.png" alt="" width="18" height="18" title="Add"/></a></div>
																				<div id="remov_sm<?php echo ",".$loop2 ?>" onClick="dynamic_tabel_remove(this.id)" style="float:left; margin-left:15px;"><a href="javascript:void(0)" title="" class="smallButton" style="margin: 5px;"><img src="images/icons/minus.png" alt="" width="18" height="18" title="Remove"/></a></div>
																			</td>
																		</tr>													
																	</table>
																</div>
													<?php
																$loop2++;
															}
															$lpp = $loop2;
															$flg=1;
														}
														else
														{
															$lpp = 1;
															$flg=2;
														}
														for($a=$lpp;$a<=30;$a++)
														{
													?>
															<div id="stone_div<?php echo $a;?>">
																<table width="100%">
																	<tr>
																		<td align="center" width="5%" style="display:table-cell; vertical-align:middle;">&nbsp;</td>
																		<td align="center" width="20%" style="display:table-cell; vertical-align:middle;">&nbsp;</td>
																		<td align="center" width="20%" style="display:table-cell; vertical-align:middle;">&nbsp;</td>
																		<td align="center" width="15%" style="display:table-cell; vertical-align:middle;">&nbsp;</td>
																		<td align="center" width="15%" style="display:table-cell; vertical-align:middle;">&nbsp;</td>
																		<td align="center" width="15%" style="display:table-cell; vertical-align:middle;">&nbsp;</td>
																		<td align="center" width="10%" style="display:table-cell; vertical-align:middle;">&nbsp;</td>
																	</tr>
																	<tr>
																		<td align="center" style="display:table-cell; vertical-align:middle;"><?php echo $a; ?></td>
																		<td align="left" style="display:table-cell; vertical-align:middle;">
																			<div class="searchDrop">
																			<select data-placeholder="Choose The Stone Shape" class="select" name="cat_name[<?php echo $a; ?>]" id="cat_name<?php echo $a; ?>" style="width:150px;" tabindex="2" onchange="stone_size_chage(this.value,<?php echo '1,'.$a; ?>)">
																				<option value=""></option>
																				<?php
																					$SLCT_comp = "SELECT * FROM mas_stone_cat WHERE statu_s='active'";
																					$QURY_comp = mysqli_query($connect,$SLCT_comp);
																					if(mysqli_num_rows($QURY_comp)>0)
																					{
																						while($FTCH_comp = mysqli_fetch_object($QURY_comp))
																						{                                            
																							$mas_stone_cat_id =base64_encode(base64_encode(base64_encode(base64_encode($FTCH_comp->mas_stone_cat_id))));
																				?>
																							<option value="<?php echo $mas_stone_cat_id;?>"><?php echo $FTCH_comp->cat_name; ?></option>
																				<?php
																						}
																					} 
																				?>
																			</select>
																			</div>
																		</td>
																		<td align="left" style="display:table-cell; vertical-align:middle;">
																			<div id="stn_size_div<?php echo $a; ?>" class="searchDrop">
																			<select data-placeholder="Choose The Stone Size" class="select" name="stn_size[<?php echo $a; ?>]" id="stn_size<?php echo $a; ?>" style="width:150px;" tabindex="2" >
																				<option value=""></option>
																			</select>
																			</div>
																		</td>
																		<td align="center" style="display:table-cell; vertical-align:middle;">
																		<div id="stn_wght_div<?php echo $a; ?>">
																		<input type="text" name="stn_wght[<?php echo $a;?>]" id="stn_wght<?php echo $a;?>"  class="input-text" value="" readonly="" style="width:100px"/></div>
																		</td>
																		<td align="center" style="display:table-cell; vertical-align:middle;"><input type="text" name="quanty[<?php echo $a;?>]" id="quanty<?php echo $a;?>"  class="input-text" onkeyup="quan_multiple(<?php echo $a;?>)" value="" style="width:100px"/></td>
																		<td align="center" style="display:table-cell; vertical-align:middle;"><input type="text" name="tot_wght[<?php echo $a;?>]" id="tot_wght<?php echo $a;?>"  class="input-text" readonly="" value="" style="width:100px"/></td>
																		<td align="center" style="display:table-cell; vertical-align:middle;">
																			<div id="plus_sm<?php echo ",".$a ?>" onClick="dynamic_tabel_add(this.id)" style="float:left; margin-left:20px"><a href="javascript:void(0)" title="" class="smallButton" style="margin: 5px;"><img src="images/icons/plus1.png" alt="" width="18" height="18" title="Add"/></a></div>
																			<div id="remov_sm<?php echo ",".$a ?>" onClick="dynamic_tabel_remove(this.id)" style="float:left; margin-left:15px;"><a href="javascript:void(0)" title="" class="smallButton" style="margin: 5px;"><img src="images/icons/minus.png" alt="" width="18" height="18" title="Remove"/></a></div>
																		</td>
																	</tr>													
																</table>
															</div>
													<?php
													}
													?>
													<table width="100%">
														<tr><td align="center" colspan="4" style="display:table-cell; vertical-align:middle;">&nbsp;</td></tr>
														<tr>
															<td align="center" colspan="4" style="display:table-cell; vertical-align:middle;">&nbsp;</td>
															<td align="center" width="15%" style="display:table-cell; vertical-align:middle;"><strong>Total Stone Weight</strong></td>
															<td align="center" width="15%" style="display:table-cell; vertical-align:middle;"><input type="text" name="final_wght" id="final_wght"  class="input-text" readonly="" value="<?php if($rad_typ==2){ echo number_format($FTCH_CAD->total_stone_weight,5); } ?>" style="width:100px"/></td>
															<td align="center" width="10%" style="display:table-cell; vertical-align:middle;">&nbsp;</td>
														</tr>
													</table>
												<input name="count_div" id="count_div" type="hidden" value="<?php echo $a;?>" />
												<input name="cur_count" id="cur_count" type="hidden" value="<?php if($flg==1){ echo $lpp-1; } else if($flg==2) { echo $lpp; } ?>" /> 
												<input name="cur_count2" id="cur_count2" type="hidden" value="<?php echo $lpp; ?>" /> 
												<div class="clear"></div>
											</div>
                                            <div class="clear"></div>
                                       	</div> 
                                       	<?php
										}
										?>
                                        <div id="wait_div" style="display:none;">
                                            <div class="formRow" >
                                                <div class="grid2"><label>Approved Date:<span class="req">*</span></label></div>
                                                <div class="grid4"><input type="text" class="datepicker" name="wait_dt" id="wait_dt" onfocus="foc(this.id)" onblur="stnon(this.id)" style="width:200px"></div>
                                                <div class="grid2"><label>Admin Name:<span class="req">*</span></label></div>
                                                <div class="grid4 searchDrop">
                                                	<select id="adm_nm" class="select" name="adm_nm" onfocus="foc(this.id)" onblur="stnon(this.id)" style="width:200px">
                                                		<option value=""></option>
                                                        <option value="<?php echo $_SESSION['admin_login_id'];?>">Admin</option>    
                                                    </select>
                                              	</div>
                                                <div class="clear"></div>
                                            </div>
                                            <div class="clear"></div>
                                       	</div>       
                                        <div class="formRow" id="sav_div">
                                            <input type="button" value="Finish" class="buttonM bBlue formSubmit" onclick="form_submit()" onfocus="foc(this.id)" onblur="stnon(this.id)" style="float: right; margin-left:20px;"/>
                                            <div class="clear"></div>
                                        </div>
                                        <div class="clear"></div>
                                    </div>
                                </div>                              
                                <div class="fluid" id="fins_div" style="display:none">
                                    <div class="widget"> 
                                        <div class="formRow">
                                            <input type="button" value="Finish" class="buttonM bBlack formSubmit" onclick="page_submit()" onfocus="foc(this.id)" onblur="stnon(this.id)" style="float: right; margin-left:20px;"/>
                                            <!--<input type="button" value="Reset" class="buttonM bRed" onclick="form_reload()" onfocus="foc(this.id)" onblur="stnon(this.id)" style="float: right; margin-left:20px;" />-->
                                            <div class="clear"></div>
                                        </div>
                                        <div class="clear"></div>
                                    </div>
                                </div>
                            </fieldset>
                        </form>
            	<?php
					}
				?>
            </div>
            <!-- Main content ends -->
        </div>       
		<script type="text/javascript"> <!--THIS IS FOR SHOWING THE IMAGE FILE WHEN ITS UPLOADING-->
		function readURL(input) {
			if (input.files && input.files[0]) {
				var reader = new FileReader();
		
				reader.onload = function (e) {
					$('#blah').attr('src', e.target.result);
				}
		
				reader.readAsDataURL(input.files[0]);
			}
		}
		
		$("#imgInp").change(function(){
			readURL(this);
			document.getElementById('img_div').style.display='block';
		});
		</script>
        <!-- Content ends -->
    </body>
</html>
