<?php
// ****************************** Invoice payment modal *********************************
		echo"<div class='modal fade' id='exampleModalo$i' tabindex='-1' role='dialog' aria-labelledby='exampleModalLabel' aria-hidden='true' 
		style='top:20px;'>
  <div class='modal-dialog' role='document'>
    <div class='modal-content'>
      <div class='modal-header'>
        <h5 class='modal-title' id='exampleModalLabel'>ADD A PAYMENT 
    <label class='pull-right'><b>$dst : &nbsp;&nbsp; $balo</b>
            </label></h5>

      </div>
      <div class='modal-body' style='text-align:center; height:auto; font-size:14px;'>
      <form action='' method='post' enctype='multipart/form-data'>";

	  if($bal>0)
		$pa=$balo;
	else
		$pa="0.00";
	 
	?>

 <div class="col-md-3" align="right">
			 <label class="control-label">Done&nbsp;By</label></div> 
			 
	<div class="col-md-4">
			 <input name="usa" class="form-control" type="text" value="<?php echo $loge ?>" style='height:30px; width:160px' readonly></div>

		<div class="col-md-1 text-right"> &nbsp;Date </div> 
			
	<div class="col-md-4"><div class="input-group date" data-provide="datepicker"><input class="form-control form-center" name="dati" type="text" value="<?php echo $Date ?>" onkeypress='return isNumberKey(event)' style="height:30px;" required><div class="input-group-addon"><span class="lnr lnr-calendar-full"></span></div>
			</div></div><div class="col-md-12"> </div><div class="row"> </div><div class="col-md-1"> </div>

<div class="col-md-2 text-right" style="margin-top:30px;"> Paid&nbsp;Amount </div> 

 <div class="col-md-3" style="margin-top:30px;">
 <input name="amo" class="form-control text-center" type="text" onkeyup='format(this);' onkeypress='return isNumberKey(event)' value="<?php echo $balo ?>" style='height:28px;' placeholder="Paid Amount"></div><div class='col-md-3' style='padding-left:0px;margin-top:30px;'>
		   <?php
		   echo"<select class='form-control' name='currency' style='padding-left:1px; padding-right:0px; font-size:14px; height:28px; padding-top:4px;' required>
		   <option value='' selected='selected'>Currency</option>";
			 
			$doi=mysqli_query($conn, "SELECT `Code`, `Rate` FROM `currency` WHERE `Code`!='' ORDER BY `Code` ASC");
			while($roi=mysqli_fetch_assoc($doi)){
				$fna=$roi['Code'];
				$rate=$roi['Rate'];
				$rte=number_format($rate, 2);
				if($curr==$fna)
					$sc="selected";
				else
					$sc="";
			echo"<option value='$fna' $sc> $fna @ $rte </option>";
			}
		
		   echo"</select>
		   
            </div>	   
		   
		   
		   
		   <div class='col-md-2' align='right' style='margin-top:30px;'>
<SELECT name='pline' class='form-control' style='width:120px; font-size:14px; height:28px; padding-top:4px;' onchange='showDiv(this.value);'>
				<OPTION VALUE=''>MODE</OPTION>
				<OPTION VALUE='CHEQUE-$i'>CHEQUE</OPTION>
				<OPTION VALUE='TRANSFER-$i'>TRANSFER</OPTION>
				<OPTION VALUE='PAYOUT-$i'>PAYOUT</OPTION></SELECT></div>
					
					
		<div class='col-md-12 text-center'>
 <div id='TRANSFER-$i' class='hiddenDiv' style='border:1px solid #6666ff; border-radius:5px; padding:15px; color:#000099; font-weight:normal; height:140px; padding-top:20px; width:96%; margin:80px 0px 0px 20px; float:center;'>

<div class='col-md-5'> <input class='form-control form-center' name='slino' type='text' placeholder='TRANSACTION No' style='height:30px;'></div>
		<div class='col-md-7'><div align='right'><select class='form-control' name='bacco' style='height:30px; padding:0px;'>
				<option value='' selected='selected'>SELECT ACCOUNT</option>";
			
	$doi=mysqli_query($conn, "SELECT `Account` FROM `baccount` ORDER BY `Account` ASC");
			while($roi=mysqli_fetch_assoc($doi)){
				$fna=$roi['Account'];
			echo"<option value='$fna'> $fna </option>";
			}
			?>   
                            </select></div></div>

	<div class="col-md-5 text-left">
	<br>&nbsp;&nbsp;&nbsp;Date of Payment&nbsp;:&nbsp;<br>
			<div class="input-group date" data-provide="datepicker">
	<input class="form-control form-center" name="tda" type="text" value="<?php echo $Date ?>" onkeypress='return isNumberKey(event)' style="height:30px;" required> <div class="input-group-addon"><span class="lnr lnr-calendar-full"></span>
				</div>
			</div></div>
			
		<div class='col-md-7 text-left'>
        <br>&nbsp;&nbsp;&nbsp;Classification&nbsp;:&nbsp;<br>
        <div class="input-group">
        <select class='form-control' name='classet' style='font-size:16px; height:30px;'><option value=''> </option>
        <?php
				for($t=1; $t<=$sp; $t++){
				    if($cat[$t])
    echo"<option value='' style='color:red;'> --- $cat[$t] --- </option>";
	           else
	    echo"<option value='$exp[$t]'> $exp[$t] </option>";
			}
		?></select><span class='input-group-addon'><a href='#' data-placement='top' data-toggle='modal' data-target='#Modal-Class'  data-dismiss='modal'>
		 <i class='lnr lnr-sync'></i></a></span>
	
	</div>
            </div>
		
			</div>
					</div>
							
							
		<?php
		echo"<div class='col-md-12 text-center'>
 <div id='CHEQUE-$i' class='hiddenDiv' style='border:1px solid #6666ff; border-radius:5px; padding:15px; color:#000099; font-weight:normal; height:140px; padding-top:20px; width:96%; margin:80px 0px 0px 20px; float:center;'>

<div class='col-md-5'> <input class='form-control form-center' name='cheno' type='text' placeholder='CHEQUE No' style='height:30px;'></div>
		<div class='col-md-7'><div align='right'><select class='form-control' name='bank' style='height:30px; padding:0px;'>
				<option value='' selected='selected'>SELECT ACCOUNT</option>";
			
	$doi=mysqli_query($conn, "SELECT `Account` FROM `baccount` ORDER BY `Account` ASC");
			while($roi=mysqli_fetch_assoc($doi)){
				$fna=$roi['Account'];
			echo"<option value='$fna'> $fna </option>";
			}
			?>   
                            </select></div></div>

	<div class="col-md-5 text-left">
	    <br>&nbsp;&nbsp;&nbsp;Date of Payment&nbsp;:&nbsp;<br> 
			    <div class="input-group date" data-provide="datepicker">
	<input class="form-control form-center" name="pda" type="text" value="<?php echo $Date ?>" onkeypress='return isNumberKey(event)' style="height:30px;" required> <div class="input-group-addon"><span class="lnr lnr-calendar-full"></span>
				</div>
			</div></div>
			
			
    <div class='col-md-7 text-left'>
        <br>&nbsp;&nbsp;&nbsp;Classification&nbsp;:&nbsp;<br>
        <div class="input-group"><select class='form-control' name='classec' style='font-size:16px; height:30px;'><option value=''> </option>
        <?php
				for($t=1; $t<=$sp; $t++){
				    if($cat[$t])
    echo"<option value='' style='color:red;'> --- $cat[$t] --- </option>";
	           else
	    echo"<option value='$exp[$t]'> $exp[$t] </option>";
			}
		?></select><span class='input-group-addon'><a href='#' data-placement='top' data-toggle='modal' data-target='#Modal-Class'  data-dismiss='modal'>
		 <i class='lnr lnr-sync'></i></a></span>
	
	</div>
            </div>
		
			</div>
					</div>
						
							
							
	<?php							
		echo"<div class='col-md-12 text-center'>
 <div id='PAYOUT-$i' class='hiddenDiv' style='border:1px solid #6666ff; border-radius:5px; padding:15px; color:#000099; font-weight:normal; height:130px; padding-top:10px; width:96%; margin:80px 0px 0px 20px; float:center;'>";
 ?>


	<div class="col-md-5 text-right"><br> SELECT A PAYOUT
			&nbsp;:&nbsp; </div><div class="col-md-7">
	<select class='form-control' name='payout' style='height:30px; padding:0px; margin-top:15px;'>
				<option value='' selected='selected'>SELECT A PAYMENT</option>
		<?php	
	$doi=mysqli_query($conn, "SELECT `Number`, `Amount`, `Payto`, `Date` FROM `expenses` WHERE `Invoice`='' AND `Classfy`='' ORDER BY `Amount` ASC");
			while($roi=mysqli_fetch_assoc($doi)){
				$num=$roi['Number'];
				$amop=number_format($roi['Amount']);
				$payto=$roi['Payto'];
				$das=$roi['Date'];
			echo"<option value='$num'> $amop &nbsp; $payto &nbsp; [$das]</option>";
			}
			?>   
                            </select>
			</div>
			
			
			
			
			
	<div class='col-md-5 text-right'><br> CLASSIFICATION &nbsp;:&nbsp;
        </div>
            <div class='col-md-7'><br><div class="input-group">
<select class='form-control' name='classe' style='font-size:16px; height:34px;'>
<option value=''> </option>
        <?php
				for($t=1; $t<=$sp; $t++){
				    if($cat[$t])
    echo"<option value='' style='color:red;'> --- $cat[$t] --- </option>";
	           else
	    echo"<option value='$exp[$t]'> $exp[$t] </option>";
			}
	
	    echo"<option value=''> </option>";
	    echo"<option value='' style='color:red;'> --- ASSETS --- </option>";
	$doi=mysqli_query($conn, "SELECT `Asset` FROM `assetype` GROUP BY `Asset` ORDER BY `Asset` ASC");
			while($roi=mysqli_fetch_assoc($doi)){
				$fna=$roi['Asset'];
	    echo"<option value='$fna'> $fna </option>";
			}
		?></select><span class='input-group-addon'><a href='#' data-placement='top' data-toggle='modal' data-target='#Modal-Class'  data-dismiss='modal'>
		 <i class='lnr lnr-sync'></i></a></span>
	
	</div>
            </div>

		
			</div>
					</div>
							</div>
		   
	<div class="row"> </div>	   
	<div class="col-md-3 text-right" style="margin-top:35px; font-size:14px; text-align:right;"> Reference </div><div class="col-md-4" style="margin-top:30px; padding-left:20px;">
 <input name="refo" class="form-control" type="text" style='height:28px;' placeholder="Payment Reference"></div><div class="col-md-5" style="padding-top:20px; margin-bottom:20px; height:100px; text-align:center;">
     
    <div class="fileupload fileupload-new" data-provides="fileupload" style=''>
        <span class="btn btn-default btn-file"><span class="fileupload-new">Select</span><span class="fileupload-exists">Change</span><input name="file1" id="app_file" type="file" readonly='readonly'></span><span class="fileupload-preview"></span><button class="close fileupload-exists" data-dismiss="fileupload" style="float:none" type="button">&times;</button>
        <br><small>Zip, txt, jpeg, png, pdf, doc (Max : 2M)</small></div>
             </div>
                <div class="row"> </div>
           

            <?php
	echo"</div><div class='modal-header' style='height:50px; text-align:right; padding:10px 20px 5px 5px;'>
    	<input type='hidden' name='custo' value='$custo'>
		<input type='hidden' name='dato' value='$dato'>
		<input type='hidden' name='p' value='$p'>
		<input type='hidden' name='dest' value='$name'>
	<input type='hidden' name='datos' value='$datos'>
	<input type='hidden' name='naso' value='$code'>
	<input type='hidden' name='count' value='$count'>
	<input type='hidden' name='balo' value='$balo'>
	<input type='hidden' name='invo' value='$invo'>
	<input type='hidden' name='vous' value='$vous'>
        <button type='button' class='btn btn-sm btn-default' style='width:80px' data-dismiss='modal'>&nbsp;CLOSE&nbsp;</button>
        <button type='submit' class='btn btn-sm btn-success' style='width:80px' name='addpa'>&nbsp;&nbsp;SAVE&nbsp;&nbsp;</button>
      </div></form>
    </div></div>
    </form></div>";

	// ***************************************************** End of modal ********************************************
	?>