<?php include "layouts/menu.php"; ?>
<script>
	function autocomplet() {
	var min_length = 0; // min caracters to display the autocomplete
	var keyword = $('#did').val();
	if (keyword.length >= min_length) {
		$.ajax({
			url: 'ajax_area.php',
			type: 'POST',
			data: {keyword:keyword},
			success:function(data){
				$('#country_list_id').show();
				$('#country_list_id').html(data);
			}
		});
	} else {
		$('#country_list_id').hide();
	}
}
function set_item(item) {
	// change input value
	$('#did').val(item);
	// hide proposition list
	$('#country_list_id').hide();
}
	</script>
	 <script>
	function autocompa() {
	var min_length = 0; // min caracters to display the autocomplete
	var keyword = $('#didna').val();
	if (keyword.length >= min_length) {
		$.ajax({
			url: 'ajax_color.php',
			type: 'POST',
			data: {keyword:keyword},
			success:function(data){
				$('#dnamea').show();
				$('#dnamea').html(data);
			}
		});
	} else {
		$('#dnamea').hide();
	}
}

// set_item : this function will be executed when we select an item
function set_itemm(item) {
	// change input value
	$('#didna').val(item);
	// hide proposition list
	$('#dnamea').hide();
}
	</script>
 <script>
	function autocomplett() {
	var min_length = 0; // min caracters to display the autocomplete
	var keyword = $('#zxcvb').val();
	if (keyword.length >= min_length) {
		$.ajax({
			url: 'ajax_refreshvname.php',
			type: 'POST',
			data: {keyword:keyword},
			success:function(data){
				$('#qwertyu').show();
				$('#qwertyu').html(data);
			}
		});
	} else {
		$('#qwertyu').hide();
	}
}
// set_item : this function will be executed when we select an item
function set_itemmm(item) {
	// change input value
	$('#zxcvb').val(item);
	// hide proposition list
	$('#qwertyu').hide();
}
	</script>
<script>
function add3()
{
var x = document.getElementById("hp1").value;
var y = document.getElementById("bba").value;
document.getElementById("1").value =(x*1)+(y*1);
}
</script>
 <script>
function interr()
{
var x = document.getElementById("5555").value;
var y = (x*1)/(12);
document.getElementById("intt2").value = (y).toFixed(2);
}
</script>

 <script>
function ddd()
{
var x = document.getElementById("hpdate").value;
document.getElementById("hpdate2").value = x;
}
</script>

 <script>
function add11()
{
var x = document.getElementById("44").value;
var y = document.getElementById("33").value;
document.getElementById("hp1").value =(x*1)+(y*1);
}
</script>
  <script>
function add()
{
var x = document.getElementById("txt1").value;
var y = document.getElementById("txt2").value;
document.getElementById("tot").value =(x*1)+(y*1);
}
</script>
  <script>
function down()
{
var x = document.getElementById("vval").value;
var y = document.getElementById("downn").value;
document.getElementById("44").value =(x*1)-(y*1);
document.getElementById("hp1").value =(x*1)-(y*1);
document.getElementById("netp").value =(x*1)-(y*1);
}
function deall()
{
var x = document.getElementById("hp1").value;

var z = document.getElementById("gfjghgf").value;
document.getElementById("netp").value =(x*1)-(z*1);
}

function allq() {
    var loanAmount = parseFloat(document.getElementById("44").value) || 0;  
    var interestRate = parseFloat(document.getElementById("intt2").value) || 0;

    var y = loanAmount * 0.03;
    var interestAmount = loanAmount * (interestRate / 100);
    var principalAfterInterest = loanAmount - interestAmount;

    document.getElementById("hp1").value = principalAfterInterest;
    document.getElementById("duemnt3").value = 0;

    var principal = parseFloat(document.getElementById("hp1").value) || 0;
    var balance = loanAmount - principal;
    var monthlyDues = parseFloat(document.getElementById("duemnt3").value) || 0;
document.getElementById("preinc").value = parseInt(loanAmount - principal);
    document.getElementById("txt1").value = parseInt(loanAmount / monthlyDues);
    document.getElementById("txt2").value = 0;
    document.getElementById("tot").value = parseInt(document.getElementById("txt1").value) + parseInt(document.getElementById("txt2").value);

    
    //var agentPercentage = parseFloat(document.getElementById("dealeramt").value);  
    // var commission = (loanAmount * agentPercentage) / 100;
    
    
    document.getElementById("txtgh3").value = commission.toFixed(0);
}


function dchange()
{
var x = 1; //or whatever offset
var CurrentDate = document.getElementById("hpdate").value;
document.getElementById("hpdate2").value = CurrentDate.setMonth(CurrentDate.getMonth() + x);
}
</script>
<script>
function add1()
{
var x1 = document.getElementById("hp1").value;
var y1 = document.getElementById("intt2").value;
var g = (x1*1)*(y1/100);
document.getElementById("txt2").value =Math.round(g);
//var y = (x*1)/(12);
//document.getElementById("2").value =Math.round(y);
}
</script>
<script>
function add2()
{
var x1 = document.getElementById("hp1").value;
var xx1 = document.getElementById("44").value;
var zz1 = (xx1*1)-(x1*1);
var y1 = document.getElementById("duemnt3").value;
document.getElementById("txt1").value =parseInt((x1*1)/(y1*1));
document.getElementById("txt2").value =parseInt((zz1*1)/(y1*1));
var x = document.getElementById("txt1").value;
var y = document.getElementById("txt2").value;
document.getElementById("tot").value =(x*1)+(y*1);
}

function due()
{
var x = document.getElementById("txt1").value;
var y = document.getElementById("tot").value;
document.getElementById("txt2").value =(y*1)-(x*1);
}

function uch()
{
    //alert("came");
var email=$("#email").val();// value in field email
$.ajax({
    type:'post',
        url:'checkmail.php',// put your real file name 
        data:{email: email},
        success:function(msg){
        alert(msg); // your message will come here.     
        } 
 });

}



navigator.geolocation.getCurrentPosition();
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;

if (e.keyCode == 37)
   e.preventDefault();
   
</script>
<script>
$('body').on('keydown', 'input, select, textarea', function(e) {
    var self = $(this)
      , form = self.parents('form:eq(0)')
      , focusable
      , next
      ;
    if (e.keyCode == 13) {
        focusable = form.find('input,a,select,button,textarea').filter(':visible');
        next = focusable.eq(focusable.index(this)+1);
        if (next.length) {
            next.focus();
        } else {
            form.submit();
        }
        return false;
    }
});
</script>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
    $(document).on("keypress", "input", function(e){
        if(e.which == 13){
         event.stopPropagation();
        event.preventDefault();
        $(this).next("input").focus();
        }
    }); 
    
    function getUsers(searchKey) {

    $.ajax({
        url: 'getUserm.php',
        type: 'POST',
        dataType: 'json',
        data: {value: searchKey},
        success: function(data) {
            if(data.status) {
                $("#name").val(data.userData.name);
                $("#fname").val(data.userData.fname);
				$("#address").val(data.userData.address);
				$("#address1").val(data.userData.address1);
				$("#address2").val(data.userData.address2);
				$("#lmark").val(data.userData.lmark);
				$("#pnoresi").val(data.userData.pnoresi);
				$("#gg1").val(data.userData.gg1);
					$("#img01").val(data.userData.uimg);
            } else {
                // Some code to run when nothing is found
            }   
        }
    });   

}

$(function() { // wait until to DOM is ready
var searchTimeout; //Timer to wait a little before fetching the data
$("#pno").keyup(function() {
    searchKey = this.value;

    clearTimeout(searchTimeout);

    searchTimeout = setTimeout(function() {
        getUsers(searchKey);    
    }, 400); //If the key isn't pressed 400 ms, we fetch the data
});
});
    </script>
  <!--  page-wrapper -->
         <div class="right_col" role="main">
            <div class="row">
                <div class="col-lg-12">
                    <!-- Form Elements -->
                    <div class="panel panel-default">
                          <div class="panel-heading">
                   New Registration For Daily  Loan
                        </div>
                        <div class="panel-body">
                            
                               
                                 
                                   <?php	$qry=mysqli_query($conn, "select * from customerdetails where mfin='$mfin' order by id DESC");
								   $qry234=mysqli_query($conn, "select * from abc where mfin='$mfin'");
								   $row234 = mysqli_fetch_array($qry234);
								   $prem = $row234['pref'];
								   $def = $row234['def'];
								   $intt = $row234['intt'];
								    $intt55 = $intt/12;
									$intt5 = round($intt55,2);
								   $intt1 = $row234['intt1'];
								   $intt2 = $row234['intt2'];
					$n=mysqli_num_rows($qry);
						if($n==0)
						{
							$rty = "$prem" . 1;
							$rtyt = 1;
						}
						else
					    {
						$row=mysqli_fetch_array($qry);
						
						$sss = $row['hplt'];
						$hhh = $row['hpl'];
						if(($sss==NULL) || ($prem==NULL)) {
							$sss = $hhh;
						}
							$hpdate5 = $row['hpdate5'];
						$rtyy = $sss + 1;
						$rtyt = $rtyy;
						$rty = $prem."".$rtyy;
						
						} ?>
						
  <form role="form" name="form1" id="form1" method="post" action="" enctype="multipart/form-data">
	
                     		<script>
  
        // onkeyup event will occur when the user 
        // release the key and calls the function
        // assigned to this event
        function GetDetails(str) {
            if (str.length == 0) {
                document.getElementById("first_name").value = "";
           
                return;
            }
            else {
  
                // Creates a new XMLHttpRequest object
                var xmlhttp = new XMLHttpRequest();
                xmlhttp.onreadystatechange = function () {
  
                    // Defines a function to be called when
                    // the readyState property changes
                    if (this.readyState == 4 && 
                            this.status == 200) {
                          
                        // Typical action to be performed
                        // when the document is ready
                        var myObj = JSON.parse(this.responseText);
  
                        // Returns the response data as a
                        // string and store this array in
                        // a variable assign the value 
                        // received to first name input field
                          
        document.getElementById("name").value = myObj[0];
        document.getElementById("pno").value = myObj[1];
        document.getElementById("fname").value = myObj[2];
        document.getElementById("pnoresi1").value = myObj[3];
        document.getElementById("address").value = myObj[4];
        document.getElementById("address1").value = myObj[5];
        document.getElementById("address2").value = myObj[6];
        document.getElementById("houserent").value = myObj[7];
        document.getElementById("area").value = myObj[8];
        document.getElementById("gg1").value = myObj[9];
        document.getElementById("g2").value = myObj[10];
        document.getElementById("lmark").value = myObj[11];
        document.getElementById("nname").value = myObj[12];
        document.getElementById("npno").value = myObj[13];
        document.getElementById("naddress").value = myObj[14];
        document.getElementById("naddress1").value = myObj[15];
        document.getElementById("naddress2").value = myObj[16];
        document.getElementById("npno1").value = myObj[17];
        document.getElementById("nhouserent").value = myObj[18];
        document.getElementById("narea").value = myObj[19];
        document.getElementById("nlmark").value = myObj[10];
        document.getElementById("ngg1").value = myObj[21];
        document.getElementById("ng2").value = myObj[22];
        
          
                 
                    }
                };
  
                // xhttp.open("GET", "filename", true);
                xmlhttp.open("GET", "getUserw.php?user_id=" + str, true);
                  
                // Sends the request to the server
                xmlhttp.send();
            }
        }
        
      
    </script> 		
  <div class="row">

  <!-- ================= MEMBER DETAILS ================= -->
  <div class="col-lg-12">
    <h3 style="background:#f5f5f5;padding:10px;border-radius:5px;">Member Details</h3>
  </div>

  <div class="col-lg-4">
  <div class="form-group has-success has-feedback">
    <label for="cid">Customer ID <font color="red">*</font></label>
    <input type="text" class="form-control" name="cid" id="user_id" onkeyup="GetDetails(this.value)" placeholder="Enter Customer ID">
    <span class="glyphicon glyphicon-user form-control-feedback"></span>
  </div> 
      
  <div class="form-group has-success has-feedback">
    <label for="hpl">Member ID <font color="red">*</font></label>
    <input type="text" class="form-control" name="hpl" id="hpl" value="<?php echo $rty;?>" placeholder="E.g 1008" required>
    <input type="hidden" class="form-control" name="hplt" id="hplt" value="<?php echo $rtyt;?>">
    <input type="hidden" class="form-control" name="mfin" id="mfin" value="<?php echo $mfin;?>">
    <input type="hidden" class="form-control" name="scode" id="scode" value="<?php echo $scode;?>">
    <span class="glyphicon glyphicon-phone-alt form-control-feedback"></span>
  </div>

  <div class="form-group has-success has-feedback">
    <label for="name">Member Name <font color="red">*</font></label>
    <input style="text-transform:uppercase" type="text" class="form-control" name="name" id="name"  placeholder="Name">
    <ul id="dname"></ul>
    <span class="glyphicon glyphicon-user form-control-feedback"></span>
  </div>

  <div class="form-group has-success has-feedback">
    <label for="pno">Mobile Number <font color="red">*</font></label>
    <input type="text" class="form-control" id="pno" name="pno" placeholder="Eg: 9876543210">
    <span class="glyphicon glyphicon-phone-alt form-control-feedback"></span>
  </div>

  <div class="form-group has-success has-feedback">
    <label for="fname">Father's Name</label>
    <input type="text" class="form-control" name="fname" id="fname" placeholder="Name">
    <span class="glyphicon glyphicon-user form-control-feedback"></span>
  </div>

  <div class="form-group has-success has-feedback">
    <label for="pnoresi1">Father Phone No</label>
    <input type="text" class="form-control" name="pnoresi1" id="pnoresi1" placeholder="Eg: 9876543210">
    <span class="glyphicon glyphicon-phone-alt form-control-feedback"></span>
  </div>
</div>

<div class="col-lg-4">
  <div class="form-group has-success has-feedback">
    <label for="address">Address</label>
    <input type="text" class="form-control" name="address" id="address" placeholder="Line 1">
    <input type="text" class="form-control" name="address1" id="address1" placeholder="Line 2">
    <input type="text" class="form-control" name="address2" id="address2" placeholder="Line 3 + Pincode">
    <span class="glyphicon glyphicon-home form-control-feedback"></span>
  </div>

  <div class="form-group has-success has-feedback">
    <label for="houserent">House Own/Rent</label>
    <select class="form-control" name="houserent" id="houserent">
      <option>Select</option>
      <option>Own House</option>
      <option>Own by Family Member</option>
      <option>Rent House</option>
      <option>Hostel/Mansion</option>
    </select>
  </div>

  <div class="form-group has-success has-feedback">
    <label for="rdate">Date</label>
    <input type="date" class="form-control" name="rdate" id="rdate">
  </div>

  <div class="form-group has-success has-feedback">
    <label for="area">Area <font color="red">*</font></label>
    <select class="form-control" name="area" id="area">
      <option></option>
      <?php
        $sql11 = mysqli_query($conn, "select * from msarea order by name asc");
        while($row11 = mysqli_fetch_array($sql11)) {
          echo "<option>".$row11['name']."</option>";
        }
      ?>
    </select>
  </div>
</div>

<div class="col-lg-4">
  <div class="form-group has-success has-feedback">
    <label for="gg1">Govt ID <font color="red">*</font></label>
    <input type="text" class="form-control" name="gg1" id="gg1" placeholder="Govt ID No">
  </div>

  <div class="form-group has-success has-feedback">
    <label for="upp1">Attachment 1</label>
    <input type="file" class="form-control" name="upp1" id="upp1">
  </div>

  <div class="form-group has-success has-feedback">
    <label for="g2">Govt ID (Alternate)</label>
    <input type="text" class="form-control" name="g2" id="g2" placeholder="Govt ID No">
  </div>

  <div class="form-group has-success has-feedback">
    <label for="upp2">Attachment 2</label>
    <input type="file" class="form-control" name="upp2" id="upp2">
  </div>

  <div class="form-group has-success has-feedback">
    <label for="lmark">Land Mark</label>
    <input type="text" class="form-control" name="lmark" id="lmark">
  </div>
</div>


  <div class="col-lg-12">
    <h3 style="background:#f5f5f5;padding:10px;border-radius:5px;">Loan Details</h3>
  </div>
    <div class="col-lg-4">
  <div class="form-group has-error has-feedback">
    <label for="inputPassword3" >Intr %</label>
      <input style="text-transform:uppercase" type="text" class="form-control" id="intt2" name="inter"  value="15" placeholder="2">
   <span class="glyphicon glyphicon-usd form-control-feedback"></span>
  </div>
   <div class="form-group has-error has-feedback">
    <label for="inputPassword3">Loan Amount</label>
    <input style="text-transform:uppercase" type="text" class="form-control" id="44" name="totalhpamt"  value="" placeholder="Loan Amount" onkeyup="allq()">
    <span class="glyphicon glyphicon-usd form-control-feedback"></span>
</div>
    <div class="form-group has-error has-feedback">
    <label for="inputPassword3" >Given Amount</label>
      <input style="text-transform:uppercase" type="text" class="form-control" id="hp1" name="hpamount"  value="" placeholder="Loan Amount" onkeyup="add2()" onChange="add1()">
   <span class="glyphicon glyphicon-usd form-control-feedback"></span>
  </div>
 <div class="form-group has-error has-feedback">
    <label for="inputPassword3" >Pre Interest</label>
      <input style="text-transform:uppercase" type="text" class="form-control" id="preinc" name="preinc"  value="" placeholder="interest" onkeyup="add2()" onChange="add1()">
   <span class="glyphicon glyphicon-usd form-control-feedback"></span>
  </div>

   <div class="form-group has-error has-feedback">
    <label for="inputPassword3" class="control-label">Loan Date</label>
      <input style="text-transform:uppercase" type="date" class="form-control" id="hpdate"  name="hpdate" value="<?php echo $hpdate5; ?>" onchange="dchange()"  Onkeyup="ddd()" placeholder="H.P Date" onfocus="insertDate(this,'DD-MM-YYYY')">
 <span class="glyphicon glyphicon-calendar form-control-feedback"></span>
    </div>
    <div class="form-group has-error has-feedback">
    <label for="inputPassword3" class="control-label">Due Date</label>
      <input style="text-transform:uppercase" type="date" class="form-control" id="hpdate2"  name="hpdate2" value="<?php echo $hpdate5; ?>" placeholder="Due Date" onclick="dchange()" >
 <span class="glyphicon glyphicon-calendar form-control-feedback"></span>
    </div>
	
  </div>
    <div class="col-lg-4">

   <div class="form-group has-error has-feedback">
    <label for="inputPassword3" >Due Daily</label>
      <input style="text-transform:uppercase" type="text" class="form-control" id="duemnt3" name="duemnt" value="" placeholder="Due Month" onkeyup="add2()";>
  <span class="glyphicon glyphicon-time form-control-feedback"></span>
  </div>
  <div class="form-group has-error has-feedback">
    <label for="inputPassword3" >Penlaty/per day</label>
      <input style="text-transform:uppercase" type="text" class="form-control" name="defamt" value="" >
   <span class="glyphicon glyphicon-usd form-control-feedback"></span>
  </div>
      <input style="text-transform:uppercase" type="hidden" class="form-control" name="" value="" >

   <div class="form-group has-error has-feedback">
    <label for="txt1" >Principle part</label>
      <input style="text-transform:uppercase" type="text" class="form-control" id="txt1"  name="dueamt" value="" placeholder="Due Amount" onChange="add()">
   <span class="glyphicon glyphicon-usd form-control-feedback"></span>
  </div>
  <div class="form-group has-error has-feedback">
    <label for="txt2" >Interest Part</label>
      <input style="text-transform:uppercase" type="text" class="form-control" id="txt2"  name="interest" value="" placeholder="Interest"  >
   <span class="glyphicon glyphicon-usd form-control-feedback"></span>
  </div>
    <div class="form-group has-error has-feedback">
    <label for="inputPassword3" >Total Due Amount</label>
      <input style="text-transform:uppercase" type="text" class="form-control" id="tot" name="total" value="" placeholder="Total Amount" onkeyup="due()">
   <span class="glyphicon glyphicon-usd form-control-feedback"></span>
  </div>

  </div>


  <div class="col-lg-4">
     <div class="form-group has-error has-feedback">
    <label for="inputPassword3" >Pay mode</label>
      <select type="text" class="form-control" id="pmode" name="pmode" value="">
	  <option>Cash A/c</option>
	<?php $abank = mysqli_query($conn, "select * from ledger where under='Bank Accounts'");
	while($bbank = mysqli_fetch_array($abank)) { ?>
	<option><?php echo $bbank['ledger']; ?></option>
	<?php } ?>
	  </select>
   <span class="glyphicon glyphicon-usd form-control-feedback"></span>
  </div>
   <div class="form-group has-error has-feedback">
    <label for="inputPassword3" >Net_Payable</label>
      <input style="text-transform:uppercase" type="text" class="form-control" id="netp" name="netamt" value="" >
   <span class="glyphicon glyphicon-usd form-control-feedback"></span>
  </div>
   
      

	 <div class="form-group has-error has-feedback">
    <label for="inputPassword3" >Documentation Charge</label>
      <input style="text-transform:uppercase" type="text" class="form-control" id="gfjghgf" name="document"  value="" onchange="add11()" onkeyup="deall()"  placeholder="Documentation Charge" >
  <span class="glyphicon glyphicon-usd form-control-feedback"></span>
  </div>
  	
  
 
   
  
 	 <div class="form-group has-warning has-feedback">
    <label for="inputPassword3" >Remarks</label>
      <textarea  style="text-transform:uppercase" class="form-control" rows="3" cols="3" name="remarks" value="" placeholder=""></textarea>
    <span class="glyphicon glyphicon-user form-control-feedback"></span>
  </div> 

 </div>

  <!-- ================= GUARANTOR DETAILS ================= -->
  <div class="col-lg-12">
    <h3 style="background:#f5f5f5;padding:10px;border-radius:5px;">Guarantor Details</h3>
  </div>

 <div class="col-lg-4">
  <div class="form-group has-success has-feedback">
    <label for="nname">Guarantor Name <font color="red">*</font></label>
    <input type="text" class="form-control" name="nname" id="nname" style="text-transform:uppercase" placeholder="Name">
  </div>

  <div class="form-group has-success has-feedback">
    <label for="npno">Guarantor Mobile Number <font color="red">*</font></label>
    <input type="text" class="form-control" name="npno" id="npno" placeholder="Eg: 9876543210">
  </div>
  
  <div class="form-group has-success has-feedback">
    <label for="naddress">Guarantor Address</label>
    <input type="text" class="form-control" name="naddress" id="naddress" placeholder="Line 1">
    <input type="text" class="form-control" name="naddress1" id="naddress1" placeholder="Line 2">
    <input type="text" class="form-control" name="naddress2" id="naddress2" placeholder="Line 3 + Pincode">
  </div>
</div>

<div class="col-lg-4">
  <div class="form-group has-success has-feedback">
    <label for="npno1">Guarantor Mobile Number 1 <font color="red">*</font></label>
    <input type="text" class="form-control" name="npno1" id="npno1" placeholder="Eg: 9876543210">
  </div>

  <div class="form-group has-success has-feedback">
    <label for="nhouserent">Guarantor House Own/Rent</label>
    <select class="form-control" name="nhouserent" id="nhouserent">
      <option>Select</option>
      <option>Own House</option>
      <option>Own by Family Member</option>
      <option>Rent House</option>
      <option>Hostel/Mansion</option>
    </select>
  </div>
  
  <div class="form-group has-success has-feedback">
    <label for="narea">Guarantor Area <font color="red">*</font></label>
    <select class="form-control" name="narea" id="narea">
      <option></option>
      <?php
        $sql11 = mysqli_query($conn, "select * from msarea order by name asc");
        while($row11 = mysqli_fetch_array($sql11)) {
          echo "<option>".$row11['name']."</option>";
        }
      ?>
    </select>
  </div>
  
  <div class="form-group has-success has-feedback">
    <label for="nlmark">Guarantor Land Mark</label>
    <input type="text" class="form-control" name="nlmark" id="nlmark">
  </div>
</div>

<div class="col-lg-4">
  <div class="form-group has-success has-feedback">
    <label for="ngg1">Guarantor Govt ID <font color="red">*</font></label>
    <input type="text" class="form-control" name="ngg1" id="ngg1" placeholder="Govt ID No">
  </div>

  <div class="form-group has-success has-feedback">
    <label for="nupp1">Attachment 1</label>
    <input type="file" class="form-control" name="nupp1" id="nupp1">
  </div>

  <div class="form-group has-success has-feedback">
    <label for="ng2">Guarantor Govt ID (Alternate)</label>
    <input type="text" class="form-control" name="ng2" id="ng2" placeholder="Govt ID No">
  </div>

  <div class="form-group has-success has-feedback">
    <label for="nupp2">Attachment 2</label>
    <input type="file" class="form-control" name="nupp2" id="nupp2">
  </div>
</div>



 <div class="col-lg-12">
    <div class="form-group has-success has-feedback">

      <button type="submit" class="btn btn-success btn-block" name="s1">Save This</button>
    </div></div>
</div>
      <div class="alert alert-success">
	 <?php
							if(isset($_POST['s1']))
							{
								extract($_POST);
									$upp1=$_FILES['upp1']['name'];
									$upp2=$_FILES['upp2']['name'];
								    $nupp1=$_FILES['nupp1']['name'];
								    $nupp2=$_FILES['nupp2']['name'];
								    
							

							$insert=mysqli_query($conn, "insert into customerdetails(status,cid,mfin,scode,hpl, hplt, name, pno, fname, pnoresi1, address, address1, address2,houserent, rdate, area, gg1, upp1, g2, upp2, lmark,nname, npno, naddress, naddress1, naddress2, npno1, nhouserent,narea, nlmark, ngg1, nupp1, ng2, nupp2,inter, totalhpamt, hpamount, preinc, hpdate, hpdate2, duemnt, defamt,dueamt, interest, total, pmode, netamt, document, remarks)
								values('Active','$cid','$mfin','$scode','$hpl', '$hplt', '$name', '$pno', '$fname', '$pnoresi1', '$address', '$address1', '$address2','$houserent', '$rdate', '$area', '$gg1', '$upp1', '$g2', '$upp2', '$lmark','$nname', '$npno', '$naddress', '$naddress1', '$naddress2', '$npno1', '$nhouserent','$narea', '$nlmark', '$ngg1', '$nupp1', '$ng2', '$nupp2','$inter', '$totalhpamt', '$hpamount', '$preinc', '$hpdate', '$hpdate2', '$duemnt', '$defamt','$dueamt', '$interest', '$total', '$pmode', '$netamt', '$document', '$remarks')");
								
								
								if($insert)
								{
									$move=move_uploaded_file($_FILES['upp1']['tmp_name'],"user/".$upp1);
									$move1=move_uploaded_file($_FILES['upp2']['tmp_name'],"user/".$upp2);
									$move2=move_uploaded_file($_FILES['nupp1']['tmp_name'],"user/".$nupp1);
									$move3=move_uploaded_file($_FILES['nupp2']['tmp_name'],"user/".$nupp2);
									
								
								
									echo "<script>alert('Register successfully');window.location.href='all2.php'</script><br>"; 

									
								}
								else
								{
									echo "Failure";
								}
							}
?>
   </div>
</form>
    </div>
   
</div>
</div></div>
</div></div></div><?php include "layouts/footer2.php"; ?>
 <script src="vendors/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->

    <!-- NProgress -->

    <script src="vendors/jQuery-Smart-Wizard/js/jquery.smartWizard.js"></script>
    <!-- Custom Theme Scripts -->
    <script src="build/js/custom.min.js"></script>
</body></html>
