<?php 
session_start();
ob_start();
include("../../pidbco/pidbjoin.php");
$sujpath="./";
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Projects</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="<?php echo $sujpath; ?>bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="<?php echo $sujpath; ?>font-awesome/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="<?php echo $sujpath; ?>font-awesome/ionicons.min.css">
    <!-- DataTables -->
    <link rel="stylesheet" href="<?php echo $sujpath; ?>plugins/datatables/dataTables.bootstrap.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="<?php echo $sujpath; ?>dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="<?php echo $sujpath; ?>dist/css/skins/_all-skins.min.css">
    <link rel="stylesheet" type="text/css" href="tcal.css" />    
    <script type="text/javascript" src="tcal.js"></script>
    
  <script>
    function add_new_customer(){
             var vcompany = $('#vcompany').val();
             var vcontact = $('#vcontact').val();
             var vmob = $('#vmob').val();
             var vemail = $('#vemail').val();
             var vcountry = $('#vcountry').val();
             var vstate = $('#vstate').val();
             var vdistrict = $('#vdistrict').val();
             var vstatus = $('#vstatus').val();
             if(vcompany == ''){
                alert("Enter Company");   	
             } else if(vmob == ''){
             	alert("Enter Mobile");
             } else {                    
                  $.ajax({
                    type: "POST",
                    url: "ajaxmarket.php",
                     data: {
                          add_new_customer: 1,
                          vcompany     : vcompany,
                          vcontact     : vcontact,
                          vmob         : vmob,
                          vemail       : vemail,
                          vcountry     : vcountry,
                          vstate       : vstate,
                          vdistrict    : vdistrict,
                          vstatus      : vstatus
                     },
                     cache: true,
                     success: function(res23)
                     {
                     	   	$('#vcompany').val('');
                           	$('#vcontact').val('');
                           	$('#vmob').val('');
                           	$('#vemail').val('');
                           	$('#vcountry').val('');
                           	$('#vstate').val('');
                           	$('#vdistrict').val('');
                           	$("#marketingdiv123").load("customer.php #marketingdiv123");   
                            datat2();                    
                      }
                   }); 
    	    }
    }


    	
     function edit_new_customer()
       {
             var vcompany = $('#vcompany').val();
             var vcontact = $('#vcontact').val();
             var vmob = $('#vmob').val();
             var vemail = $('#vemail').val();
             var vcountry = $('#vcountry').val();
             var vstate = $('#vstate').val();
             var vdistrict = $('#vdistrict').val();
             var vstatus = $('#vstatus').val();
             var hidvall = $('#hidvall').val();
             
             if(vcompany == ''){
                alert("Enter Company");   	
             } else if(vmob == ''){
             	alert("Enter Mobile");
             } else {                    
                  $.ajax({
                    type: "POST",
                    url: "ajaxmarket.php",
                     data: {
                          edit_new_customer: 1,
                          vcompany     : vcompany,
                          vcontact     : vcontact,
                          vmob         : vmob,
                          vemail       : vemail,
                          vcountry     : vcountry,
                          vstate       : vstate,
                          vdistrict    : vdistrict,
                          vstatus      : vstatus,
                          hidvall      : hidvall
                     },
                     cache: true,
                     success: function(res23)
                     {
                     	   	$('#vcompany').val('');
                           	$('#vcontact').val('');
                           	$('#vmob').val('');
                           	$('#vemail').val('');
                           	$('#vcountry').val('');
                           	$('#vstate').val('');
                           	$('#vdistrict').val('');
                           	$("#marketingdiv123").load("customer.php #marketingdiv123");   
                            datat2();                    
                      }
                   }); 
    	    }

        }
        
        
    	
    	    	
    	
    	
    	
    	function edit_assignment(id)
    	{
    		$.ajax({
			type: "POST",
			url:  "ajaxmarket.php",
			data: {
			btn_edit_market: 1,
			id:id
			},
			cache: true,
			success: function(res)
			{
	         	$("#marketingdiv22").load("assignment.php?idd2="+id+" #marketingdiv22"); 	
			}  
			});
    	}
    	
    	
function state_change(str)
{
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("vdistrict").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","ajaxmarket.php?state_idd="+str,true);
xmlhttp.send();
}
    </script>
    
  </head>
  <body class="hold-transition skin-blue sidebar-mini">
     <div class="wrapper">
  <?php include("head.php");
    include("left.php"); ?> 
	 
      <!-- Content Wrapper. Contains page content -->
      <div class="content-wrapper" >
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1 style=" font-size: 22px;"> Project Scheduling
          	<small>- Control panel</small>
          	</h1>
          <ol class="breadcrumb">
            <li><a href="dash_board.php"><i class="fa fa-dashboard"></i> Home</a></li>
            <li class="active">Project scheduling</li> 
          </ol>
        </section>
  <!-- Main content -->
        <section class="content" >
          <div class="row" >
            <div class="col-xs-12" >


  
  
  
  
<div id="marketingdiv123" style=" margin-top: 20px;">


<div class="box" >
   <div class="box-body" >
        <div class="box-body table-responsive no-padding" >
   
  	                 	
                  <table id="example1" class="table table-bordered table-striped" >
                    <thead >
                    <tr >
<th>#</th>                    	
<th>Company</th>
<th>Branch</th>
<th>Customer</th>
<th>Order Type</th>
<th>Order Date</th>
<th>Completion Date</th>
<th>Status</th>
<th></th>
</tr>
                    </thead>
                    <tbody>

<?php 
 $sqq = mysqli_query($con, "SELECT * FROM `p_orders` ");
 $p=1;
 while($res = mysqli_fetch_array($sqq)){
  $comid = $res['ocomp'];
  $sq1 = mysqli_query($con,"SELECT c_comp FROM `p_company` WHERE `cid`='$comid' ");
  $rs1 = mysqli_fetch_array($sq1);  
  
  $ocustm = $res['ocustm'];
  $sq5 = mysqli_query($con, "SELECT cname FROM `p_customers` WHERE `cid`='$ocustm'");
  $rs5 = mysqli_fetch_array($sq5);
?>
<tr>
	<td><?php echo $p; ?></td>
	<td><?php echo $rs1['c_comp']; ?></td>
	<td><?php echo $res['obranch']; ?></td>
	<td><?php echo $rs5['cname']; ?></td>
	<td><?php echo $res['ordr_type']; ?></td>
	<td><?php echo $res['ordr_date']; ?></td>
	<td><?php echo $res['compl_date']; ?></td>
	<td><?php if($res['ostatus'] == '1'){ echo "Open"; } else { echo "Closed"; } ?></td>
	<td>
	&nbsp;&nbsp;  <a href="" data-toggle="modal" data-target="#myModal<?php echo $res['oid']; ?>" style=" cursor: pointer;"><span class="glyphicon glyphicon-eye-open" style="font-size:14px;"></span></a> &nbsp; &nbsp;                	
  </td>
</tr>



<div class="modal fade" id="myModal<?php echo $res['oid']; ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header" style=" background-color: #E8E8E8;">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">Project Details</h4>
      </div>
      <div class="modal-body" id="myModal2">
  
 <div style=" width:550px; ">
  
  <div style=" float:left; width:150px;  font-size:14px; color:#0000FF; ">Company Name</div><div style="width:375px; ">: &nbsp;&nbsp; <?php echo $rs1['c_comp']; ?></div>
  <div style=" float:left; width:150px;font-size:14px;color:#0000FF;">Branch Name </div><div style="width:375px;">: &nbsp;&nbsp; <?php echo $res['obranch']; ?></div>
  <div style=" float:left; width:150px;font-size:14px;color:#0000FF;">Order Type </div><div style="width:375px;">: &nbsp;&nbsp; <?php echo $res["ordr_type"]; ?></div>
  <div style=" float:left; width:150px;font-size:14px;color:#0000FF;">Customer </div><div style="width:375px;">: &nbsp;&nbsp; <?php echo $rs5['cname']; ?></div>
  <div style=" float:left; width:150px;font-size:14px;color:#0000FF;">Order Date </div><div style="width:375px;">: &nbsp;&nbsp; <?php echo $res["ordr_date"]; ?></div>
  <div style=" float:left; width:150px;font-size:14px;color:#0000FF;">Completion Date </div><div style="width:375px;">: &nbsp;&nbsp; <?php echo $res["compl_date"]; ?></div>
 </div>
 <br>
 <h4 class="modal-title" id="myModalLabel"  style=" background-color: #E8E8E8;">Project scheduling</h4>
 <br>
   <div class="row" >
        <div class="col-xs-12" >
        
      <div class="col-md-5"  style=" padding-left: 2px; padding-right: 0px; ">					
      <div class="form-group">
	        <input type="text" name="vcompany" id="vcompany" class="form-control" placeholder="Assigned To"/>	
      </div></div>

     	 <div class="col-md-5"  style=" padding-left: 2px; padding-right: 0px; ">					
      <div class="form-group">
	        <input type="text" name="vcompany" id="vcompany" class="form-control" placeholder="Man Hours"/>	
      </div></div>
      
      
      
      <div class="col-md-2"  style=" padding-left: 2px; padding-right: 0px; ">				
      <div class="form-group">
      <input type="submit" class="btn btn-primary" name="frasubmit" id="frasubmit" value="Submit" onclick="add_new_customer();" style=" float: right;
margin-right: 20px; " />	
      </div></div>
      
            	
     </div></div>       	
            	
  
      </div>
    </div>
  </div>
</div>   
<?php $p=$p+1; } ?>


                    </tbody>
                    </table>
  
         		  </div>
                </div><!-- /.box-body -->
              </div><!-- /.box -->
	
	
</div>
	
		
			
			
			








                           
            </div><!-- /.col -->
          </div><!-- /.row -->
        </section><!-- /.content -->
  </div><!-- /.content-wrapper -->
  </div>
	<!-- <?php include("footer.php"); ?> -->
 <!-- jQuery 2.1.4 -->
    <script src="<?php echo $sujpath; ?>plugins/jQuery/jQuery-2.1.4.min.js"></script>
    <!-- Bootstrap 3.3.5 -->
    <script src="<?php echo $sujpath; ?>bootstrap/js/bootstrap.min.js"></script>
    <!-- DataTables -->
	<script src="<?php echo $sujpath; ?>plugins/datatables/jquery.dataTables.min.js"></script>
    <script src="<?php echo $sujpath; ?>plugins/datatables/dataTables.bootstrap.min.js"></script>
    <!-- SlimScroll -->
    <script src="<?php echo $sujpath; ?>plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <!-- FastClick -->
    <script src="<?php echo $sujpath; ?>plugins/fastclick/fastclick.min.js"></script>
    <!-- AdminLTE App -->
    <script src="<?php echo $sujpath; ?>dist/js/app.min.js"></script>
    <!-- AdminLTE for demo purposes -->
    <script src="<?php echo $sujpath; ?>dist/js/demo.js"></script>
    <!-- page script -->
    
  <script type="text/javascript">
    function PreviewImage(no) {
    	var oFReader = new FileReader();
        oFReader.readAsDataURL(document.getElementById("uploadImage"+no).files[0]);
        oFReader.onload = function (oFREvent) {
            document.getElementById("uploadPreview"+no).src = oFREvent.target.result;
        };
    }
</script>

<style>
label.filebutton {
    width:120px;
    height:80px;
    overflow:hidden;
    position:relative;
}
label span input {
    z-index: 999;
    line-height: 0;
    font-size: 50px;
    position: absolute;
    top: -2px;
    left: -700px;
    opacity: 0;
    filter: alpha(opacity = 0);
    -ms-filter: "alpha(opacity=0)";
    cursor: pointer;
    _cursor: hand;
    margin: 0;
    padding:0;
}
</style>



    <script>
      $(document).ready(function() {
        $("#example1").DataTable();
      });
      
	function datat(){
	  alert("Data Deleted Successfully.");
      $(document).ready(function() {
        $("#example1").DataTable();
       
      });
    }
    function datat2(){
	  alert("Data Added Successfully");
      $(document).ready(function() {
        $("#example1").DataTable();
       
      });
    }
    function datat3(){
	  alert("Updated Successfully");
      $(document).ready(function() {
        $("#example1").DataTable();
       
      });
    }
   </script>  
   
   
   
  </body>
</html>
