<div class="page-content-wrapper">
                <div class="page-content">
                    <div class="page-bar">
                        <div class="page-title-breadcrumb">
                            <div class=" pull-left">
                               <!--<div class="page-title"><?php //if($isEdit){ echo 'Edit Income';} else { echo 'Add Income'; }?></div>-->
                            </div>
                            <ol class="breadcrumb page-breadcrumb pull-right">
                                <li><i class="fa fa-home"></i>&nbsp;<a class="parent-item" href="index.html">Home</a>&nbsp;<i class="fa fa-angle-right"></i>
                                </li>
                                <li><a class="parent-item" href="index.php?page=view_technician&id=<?php echo $techId; ?>">Technician</a>&nbsp;<i class="fa fa-angle-right"></i></li><li class="active">Income</li>
                            </ol>
                        </div>
                    </div>
<div class="row">
                        <div class="col-md-12 col-sm-12">
                            <div class="card card-box">
                                <div class="card-head">
                                    <header>
                                    	<div>Add Payment to <?php echo(SITE_NAME); ?> (<?php echo getTechnicianName($techId); ?>)<?php //if($isEdit){ echo 'Edit Income';} else { echo 'Add Income'; } echo ' from '.getTechnicianName($techId);?></div>                                    	
                                    	
                                    </header>                                                                    
                                </div>
                                <div class="card-body" id="bar-parent1">
                                	
                                	<?php if(isset($error) && $error!='') { ?> 
                                	<div class="alert alert-danger"><?php echo $error; ?></div>
                                	<?php } else if(isset($success) && $success!=''){ ?>                                		
                                		<div class="alert alert-success"><?php echo $success; ?></div>
                                	<?php } else if(isset($_REQUEST['success'])){ ?>                                		
                                		<div class="alert alert-success"><?php echo urldecode($_REQUEST['success']); ?></div>
                                	<?php } ?>
                                	                                	
                                    <form action="" id="form_staff_add" class="form-horizontal" method="post">
                                        <div class="form-body">
                                        	                                        	 
                                            <div class="form-group row">
                                                <label class="control-label col-md-3">Balance Amount from technician</label>
                                                <div class="col-md-6 pt-2">     
                                                	<?php if($totalAmountPending>0){ ?>                                                                                                                                                              
                                                       <b> Rs. <?php echo money_format('%!i', $totalAmountPending); ?></b>
                                                    <?php } else { ?>
                                                    	<span style="color: red;font-weight: bold;"><?php echo money_format('%!i', $totalAmountPending); ?></span>                                                    	
                                                    <?php } ?>
                                                </div>
                                            </div> 
                                            <div class="form-group row">
                                                <label class="control-label col-md-3">Enter Amount<span class="required"> * </span></label>
                                                <div class="col-md-4">                                                                                                                                                                   
                                                        <input name="amount" type="text" id="amount" class="form-control" value="<?php if(isset($_POST['amount'])) { echo htmlentities(($_POST['amount']), ENT_QUOTES); } else if(isset($resEdit['amount']) && $resEdit['amount']!=''){ echo $resEdit['amount'];} ?>" />
                                                </div>
                                            </div>                                                                                      
                                            <div class="form-group row">
                                                <label class="control-label col-md-3">Notes</label>
                                                <div class="col-md-4">        
                                                	<textarea name="description" id="description"><?php if(isset($_POST['description'])) { echo htmlentities(($_POST['description']), ENT_QUOTES); } else if(isset($resEdit['description']) && $resEdit['description']!=''){ echo $resEdit['description'];} ?></textarea>                                            
                                                </div>
                                            </div>
                                            
                                        </div>             
                                                                   
                                      	<div class="form-group">
                                            <div class="offset-md-3 col-md-9">
                                            	<?php if($totalAmountPending>0){ ?>
	                                            	<?php if($isEdit){ ?>
	                                            		<button type="submit" name="update" class="btn btn-info">Update</button>
	                                            	<?php } else { ?>
	                                            		<button type="submit" name="add" class="btn btn-info">Submit</button>
	                                            	<?php } ?>   
                                            	<?php } else { ?> 
                                            		<span style="color: red;">The technician have no balance in account!</span>
                                            	<?php } ?>                                                                                               
                                            </div>
                                        </div>
                                        
                                    </form>
                                </div>
                            </div>
                        </div>
                        
                       
                       <?php if(isset($execDetails) && mysqli_num_rows($execDetails)>0) { ?>
                        <div class="col-md-12">
                            <div class="card card-topline-red">
                                <div class="card-head">
                                    <header>Subtechnician Payments</header>
                                    <div class="tools">                                        
	                                    <a class="t-collapse btn-color fa fa-chevron-down" href="javascript:;"></a>
	                                    <a class="t-close btn-color fa fa-times" href="javascript:;"></a>
                                    </div>
                                </div>
                                <div class="card-body "> 
                                    <table class="table table-striped table-bordered table-hover table-checkable order-column" style="width: 100%" id="example4">
                                        <thead>
                                            <tr>                                                
                                                <th> S.No. </th>
                                                <th> Sub Technician </th>
                                                <th> Amount </th>                                                                                                
                                                <th> Date </th>
                                                <th> Actions </th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        	<?php
                                        	if(isset($_GET['p']) && is_numeric($_GET['p']) && ($_GET['p'] > 1)) {
												$slNo = ($_GET['p']*30-29);
											} else {
												$slNo = 1;
											}
											$totalSubTechAmount = 0;
												while($resDetails = mysqli_fetch_array($execDetails)) {	
													$totalSubTechAmount+= $resDetails['amount']; ?>
                                            <tr class="odd gradeX">                                                
                                                <td><?php echo $slNo; ?></td>
                                                <td><?php echo getTechnicianName($resDetails['sub_id']); ?></td>
                                                <td><?php echo $resDetails['amount']; ?></td>
                                                <td><?php echo getFormattedDateTime($resDetails['date']); ?></td>      
                                                <td>
                                                	<a class="btn btn-xs deepPink-bgcolor dropdown-toggle no-margin" href="index.php?page=tech_add_income&pay_id=<?php echo $resDetails['id']; ?>&action=add_income">Mark Paid </a>
                                                </td>                                                 
                                            </tr>
                                            <?php ++$slNo; } ?>  
                                            <tr class="odd gradeX">                                                
                                                <td colspan="2">&nbsp;</td>
                                                <td colspan="2"><?php echo 'Total : <b>Rs.'.$totalSubTechAmount.'</b>'; ?></td>
                                                <td>&nbsp;</td>                                                 
                                            </tr>                                          
                                        </tbody>
                                    </table>
                                    <div style="float: left; width: auto;"> <?php echo $pageNums; ?> </div>
                                     
                                </div>
                            </div>
                        <?php } else { ?>
                             <!--<div class="alert alert-danger">No Subtechnician Payments Found.</div>-->					        		
					   <?php }	?>
                        
                        
                        
                    </div>
	</div>
</div>
