<?php include "layouts/menu.php"; ?>
<style>
    #my_camera{
        width: 320px;
        height: 240px;
        border: 1px solid black;
    }
	</style>
 <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
 <script>
function ddd()
{
var x = document.getElementById("hpdate").value;
document.getElementById("hpdate2").value = x;
}
</script>

<!-- Card - 1 -->
<script>
function tgram1()
{
var x = document.getElementById("n11").value;
var y = document.getElementById("n21").value;
var z = document.getElementById("n31").value;
var u = document.getElementById("n41").value;
var v = document.getElementById("n51").value;
document.getElementById("ggm1").value =(x*1)+(y*1)+(z*1)+(u*1)+(v*1);
}
</script>
<script>
function hpamt1()
{
var x1 = document.getElementById("n11").value;
var x2 = document.getElementById("n21").value;
var x3 = document.getElementById("n31").value;
var x4 = document.getElementById("n41").value;
var x5 = document.getElementById("n51").value;
var y = document.getElementById("pgram").value;
var f = document.getElementById("grate").value;
var z = document.getElementById("lvalue").value;
var a = document.getElementById("pgramo").value;
var z1 = document.getElementById("c11").value;
var z2 = document.getElementById("c21").value;
var z3 = document.getElementById("c31").value;
var z4 = document.getElementById("c41").value;
var z5 = document.getElementById("c51").value;
var it = document.getElementById("intert").value;
var pt = document.getElementById("pinter1").value;


var b1 = (((x1*1)*(z*1)));
var b2 = (((x2*1)*(z*1)));
var b3 = (((x3*1)*(z*1)));
var b4 = (((x4*1)*(z*1)));
var b5 = (((x5*1)*(z*1)));

var bt = (b1*1)+(b2*1)+(b3*1)+(b4*1)+(b5*1);
var xt = (x1*1)+(x2*1)+(x3*1)+(x4*1)+(x5*1); 

var boost1 = document.getElementById("boost1").value;

document.getElementById("hpamtt1").value =Math.floor(((bt*1)+(boost1*1))/10)*10;
document.getElementById("hpamtt21").value =Math.floor(((bt*1)+(boost1*1))/10)*10;
var vg = document.getElementById("hpamtt1").value;
var pros = document.getElementById("pros").value;
var bgt1 = (vg*1)*(pros/100);
document.getElementById("pcharge1").value = Math.ceil(bgt1 / 10) * 10;
var pcharge1 = document.getElementById("pcharge1").value;
add11()
add21()
var sd = document.getElementById("txt21").value;
if (it == 'Yes') {
document.getElementById("hpam1").value =Math.floor(((vg*1)-(sd*1)-(pcharge1*1))/1)*1;
document.getElementById("pinter1").value =(sd*1);
}
else{
document.getElementById("hpam1").value =Math.floor(((vg*1)-(pcharge1*1))/1)*1;	
}
document.getElementById("val1").value =Math.floor((xt*1)*(f*1)/1)*1;
}
</script>



<script>
function pbp1()
{
var x2 = document.getElementById("boost1").value;
var it = document.getElementById("intert").value;
var x4 = document.getElementById("hpamtt21").value;
var xx1 = document.getElementById("hpamtt1").value;
add11()
add21()
var sd = document.getElementById("txt21").value;
var vg = document.getElementById("hpamtt1").value;
var pros = document.getElementById("pros").value;
var bgt1 = (vg*1)*(pros/100);
document.getElementById("pcharge1").value = Math.ceil(bgt1 / 10) * 10;
var x1 = document.getElementById("pcharge1").value;
if (it == 'Yes') {
document.getElementById("pinter1").value =(sd*1);
var x3 = document.getElementById("pinter1").value;
document.getElementById("hpam1").value =Math.floor(((xx1*1)-(x1*1)-(x3*1))/1)*1;
}
else{
document.getElementById("pinter1").value =(0*1);
var x3 = document.getElementById("pinter1").value;
document.getElementById("hpam1").value =Math.floor(((xx1*1)-(x1*1)-(x3*1))/1)*1;
}
document.getElementById("boost1").value =((x4*1)-(xx1*1));

}
</script>




<script>
function gwt11()
{
var x1 = document.getElementById("t11").value;
var y1 = document.getElementById("s11").value;
document.getElementById("g11").value =(x1*1)-(y1*1);
nw11();
}
</script>
<script>
function gwt21()
{
var x1 = document.getElementById("t21").value;
var y1 = document.getElementById("s21").value;
document.getElementById("g21").value =(x1*1)-(y1*1);
nw21();
}
</script>
<script>
function gwt31()
{
var x1 = document.getElementById("t31").value;
var y1 = document.getElementById("s31").value;
document.getElementById("g31").value =(x1*1)-(y1*1);
nw31();
}
</script>
<script>
function gwt41()
{
var x1 = document.getElementById("t41").value;
var y1 = document.getElementById("s41").value;
document.getElementById("g41").value =(x1*1)-(y1*1);
nw41();
}
</script>
<script>
function gwt51()
{
var x1 = document.getElementById("t51").value;
var y1 = document.getElementById("s51").value;
document.getElementById("g51").value =(x1*1)-(y1*1);
nw51();
}
</script>
<script>
function nw11()
{
var x1 = document.getElementById("g11").value;
var y1 = document.getElementById("pgram").value;
var z1 = document.getElementById("c11").value;
var h1 = document.getElementById("hh").value;
var o1 = document.getElementById("oo").value;

var q1 = ((x1*1)*((z1)/100));

document.getElementById("n11").value =Math.round((q1*1)*100)/100;
tgram1();
hpamt1();
}
</script>
<script>
function nw21()
{
var x1 = document.getElementById("g21").value;
var y1 = document.getElementById("pgram").value;
var z1 = document.getElementById("c21").value;
var h1 = document.getElementById("hh").value;
var o1 = document.getElementById("oo").value;
var q1 = ((x1*1)*((z1)/100));
document.getElementById("n21").value =Math.round((q1*1)*100)/100;
tgram1();
hpamt1();
}
</script>
<script>
function nw31()
{
var x1 = document.getElementById("g31").value;
var y1 = document.getElementById("pgram").value;
var z1 = document.getElementById("c31").value;
var h1 = document.getElementById("hh").value;
var o1 = document.getElementById("oo").value;
var q1 = ((x1*1)*((z1)/100));
document.getElementById("n31").value =Math.round((q1*1)*100)/100;
tgram1();
hpamt1();
}
</script>
<script>
function nw41()
{
var x1 = document.getElementById("g41").value;
var y1 = document.getElementById("pgram").value;
var z1 = document.getElementById("c41").value;
var h1 = document.getElementById("hh").value;
var o1 = document.getElementById("oo").value;
var q1 = ((x1*1)*((z1)/100));
document.getElementById("n41").value =Math.round((q1*1)*100)/100;
tgram1();
hpamt1();
}
</script>
<script>
function nw51()
{
var x1 = document.getElementById("g51").value;
var z1 = document.getElementById("c51").value;
var h1 = document.getElementById("hh").value;
var o1 = document.getElementById("oo").value;
var q1 = ((x1*1)*((z1)/100));
document.getElementById("n51").value =Math.round((q1*1)*100)/100;
tgram1();
hpamt1(); 
}
</script>
<script>
function add11()
{
var x1 = document.getElementById("hpamtt1").value;
var y1 = document.getElementById("intt21").value;
var g = (x1*1)*(y1/100);
document.getElementById("txt21").value =Math.round(g);
//var y = (x*1)/(12);
//document.getElementById("2").value =Math.round(y);
}
</script>
<script>
function add21()
{
var x1 = document.getElementById("hpamtt1").value;
var y1 = document.getElementById("duemnt31").value;
document.getElementById("txt11").value =parseInt((x1*1)/(y1*1));
var x = document.getElementById("txt11").value;
var y = document.getElementById("txt21").value;
document.getElementById("tot1").value =(x*1)+(y*1);
}
</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
                        </div>
                        <div class="panel-body">
                            
                               
                                   <?php		   $qry=mysqli_query($conn, "select * from mcust where mfin='$mfin' order by id DESC");
								   $qry234=mysqli_query($conn, "select * from abc where mfin='$mfin'");
								   $row234 = mysqli_fetch_array($qry234);
								   $pres = $row234['prefs'];
								   $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 = 1;
							$rtyt = 1;
						}
						else
					    {
						$row=mysqli_fetch_array($qry);
						
						$sss = $row['hplt'];
						$hhh = $row['hpl'];
						if(($sss==NULL) || ($pres==NULL)) {
							$sss = $hhh;
						}
							$hpdate5 = $row['hpdate5'];
						$rtyy = $sss + 1;
						$rtyt = $rtyy;
						$rty = $pres."".$rtyy;
						} ?>
						
  

						
  <form role="form" name="form1" id="form1" method="post" action="" enctype="multipart/form-data">
	
                     				
  <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>Member ID <font color="red">*</font></label>
      <input type="text" class="form-control" name="hpl" value="<?php echo $rty;?>" placeholder="E.g 1008" required>
      <input type="hidden" class="form-control" name="hplt" value="<?php echo $rtyt;?>">
      <input type="hidden" class="form-control" name="mfin" value="<?php echo $mfin;?>">
      <input type="hidden" class="form-control" name="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>Member Name <font color="red">*</font></label>
      <input style="text-transform:uppercase" type="text" class="form-control" name="name" id="name" onkeyup="autocomp()" 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>Mobile Number <font color="red">*</font></label>
      <input type="text" class="form-control" 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>Father's Name</label>
      <input type="text" class="form-control" name="fname" placeholder="Name">
      <span class="glyphicon glyphicon-user form-control-feedback"></span>
    </div>

    <div class="form-group has-success has-feedback">
      <label>Father Phone No</label>
      <input type="text" class="form-control" name="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>Address</label>
      <input type="text" class="form-control" name="address" placeholder="Line 1">
      <input type="text" class="form-control" name="address1" placeholder="Line 2">
      <input type="text" class="form-control" name="address2" placeholder="Line 3 + Pincode">
      <span class="glyphicon glyphicon-home form-control-feedback"></span>
    </div>

    <div class="form-group has-success has-feedback">
      <label>House Own/Rent</label>
      <select class="form-control" name="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>Date</label>
      <input type="date" class="form-control" name="rdate">
    </div>

    <div class="form-group has-success has-feedback">
      <label>Area <font color="red">*</font></label>
      <select class="form-control" name="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>Govt ID <font color="red">*</font></label>
      <input type="text" class="form-control" name="gg1" placeholder="Govt ID No">
    </div>

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

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

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

    <div class="form-group has-success has-feedback">
      <label>Land Mark</label>
      <input type="text" class="form-control" name="lmark">
    </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>Guarantor Name <font color="red">*</font></label>
      <input type="text" class="form-control" name="nname" style="text-transform:uppercase" placeholder="Name">
    </div>

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

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

    <div class="form-group has-success has-feedback">
      <label>Guarantor House Own/Rent</label>
      <select class="form-control" name="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>Guarantor Area <font color="red">*</font></label>
      <select class="form-control" name="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>Guarantor Land Mark</label>
      <input type="text" class="form-control" name="nlmark">
    </div>
    
  </div>

  <div class="col-lg-4">
  

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

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

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

    <div class="form-group has-success has-feedback">
      <label>Attachment 2</label>
      <input type="file" class="form-control" name="nupp2">
    </div>
  </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 mcust(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)
								values('$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')");
								
								
								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='mcust.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>
