<?php


$POType = '';
$PODate = '';
$SupplierID = '';
$SpecialOrder = '';
$UserID = '';
$RequesterEmail = '';
$RequesterPh = '';
$RequestedDate = '';
$BudgetManager = '';
$BudgetManagerDepartment = '';
$PurchasingCategory = '';


if(!empty($POInfo))
{
    foreach ($POInfo as $PO)
    {
        $POType = $PO->POType;
        $PODate = $PO->PODate;
        $SupplierID = $PO->SupplierID;
        $SpecialOrder = $PO->SpecialOrder;
        $UserID = $PO->role;
        $RequesterEmail = $PO->reemail;
        $RequesterPh = $PO->RequesterPh;
        $RequestedDate = $PO->RequestedDate;
        $BudgetManager = $PO->BudgetManager;
        $BudgetManagerDepartment = $PO->BudgetManagerDepartment;
        $PurchasingCategory = $PO->PurchasingCategory;
    }
}


?>

<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
       <center> Purchase Order</center>
         
      </h1>
    </section>
    
    <section class="content">
    <div style="text-align:right;">
    <a href="<?php echo base_url() ?>purchaseorderListing" class="btn btn-info" value="Back"/>Back</a>
	</div>
	<br/>
        <div class="row">
            <!-- left column -->
            <div class="col-md-12">
              <!-- general form elements -->
                
                
                
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">Edit Purchase Order Details</h3>
                    </div><!-- /.box-header -->
                    <!-- form start -->
                    
                    <form role="form" action="<?php echo base_url() ?>purchaseorder/editPO" method="post" id="editUser" role="form">
                        <div class="box-body">
                            <div class="row">
                                <div class="col-md-6">                                
                                                                    
                                    <div class="form-group">
                                        <label for="POType">PO Type</label>
                                         <select  class="form-control" name="POType" value="<?php echo $POType; ?>" required>
                             <option value=""></option>
                              <option value="Daily">Daily</option>
                              <option value="Weekly">Weekly</option>
                              <option value="Monthly">Monthly</option>
                              <option value="Yearly">Yearly</option>
                              <option value="Others">Others</option>
                              
                            </select>
                                    </div>
                                    
                                </div>
                                    
                                
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label for="PODate">PO Date</label>
                                        <input type="date" name="PODate" min=<?php $week = date("Y-m-d",mktime(0, 0, 0, date("m"), date("d")-7,date("Y")));echo $week;?> max=<?php  echo date('Y-m-d'); ?> value="<?php echo $PODate; ?>" class="form-control" placeholder="" />
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label for="SupplierID">SupplierID</label>
                                        <select class="form-control required" id="SupplierID" name="SupplierID">
                                            <option value="<?php echo $SupplierID; ?>">SupplierList</option>
                                            <?php
                                            if(!empty($SupplierName))
                                            {
                                                foreach ($SupplierName as $SID)
                                                {
                                                    ?>
                                                    <option value="<?php echo $SID->SupplierID; ?>"><?php echo $SID->SupplierID; ?> <?php echo $SID->SupplierName; ?></option>
                                                    <?php
                                                }
                                            }
                                            ?>
                                        </select>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label for="SpecialOrder">Special Requirement of order</label>
                                        <input type="text" class="form-control required" id="SpecialOrder" name="SpecialOrder" maxlength="255" value="<?php echo $SpecialOrder; ?>">
                                    </div>
                                </div>
								<div class="col-md-6">
                                    <div class="form-group">
                                        <label for="createdby">Created By</label>
                                        <input type="text" class="form-control required" id="Special" name="Special" maxlength="255" value="<?php echo $name; ?>"readonly>
                                    </div>
                                </div>
                            </div>
							
                            <div class="row well">
                                
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label for="role">UserID</label>
                                        <select class="form-control required" id="role" name="role">
                                            <option value="<?php echo $role; ?>">Select Role</option>
                                            <?php
                                            if(!empty($users))
                                            {
                                                foreach ($users as $us)
                                                {
                                                    ?>
                                                    <option value="<?php echo $us->userId ?>"><?php echo $us->userId ?> <?php echo $us->name ?></option>
                                                    <?php
                                                }
                                            }
                                            ?>
                                        </select>
                                    </div>
                                </div>
								
                            <div class="col-md-6 ">
                                    <div class="form-group">
                                        <label for="re_email">Requester Email</label>
                                        <input type="text" class="form-control required" id="reemail" name="RequesterEmail" value="<?php echo $RequesterEmail;?>">
                                    </div>
                                </div>
							
							
                        
						<div class="col-md-6 ">
                                    <div class="form-group">
                                        <label for="rephone">Requesters Ph</label>
                                        <input type="text" class="form-control required digits" id="re_phone" name="rephone" value="<?php echo $RequesterPh; ?>">
                                    </div>
                                </div>
						<div class="col-md-6">
                                    <div class="form-group">
                                        <label for="re_Date">Requested Date</label>
                                        <input type="date" name="reDate" min=<?php $week = date("Y-m-d",mktime(0, 0, 0, date("m"), date("d")-7,date("Y")));echo $week;?> max=<?php  echo date('Y-m-d'); ?> value="<?php echo date('Y-m-d'); ?>" class="form-control" placeholder="" />
                                    </div>
                                	</div>
									
						<div class="col-md-6">                                
                                    <div class="form-group">
                                        <label for="bud_manager">Budget Manager</label>
                                         <select  class="form-control" name="bugmanager"required>
                             <option value="<?php echo $BudgetManager; ?>"></option>
                              <option value="Daily">Daily</option>
                              <option value="Weekly">Weekly</option>
                              <option value="Monthly">Monthly</option>
                              <option value="Yearly">Yearly</option>
                              <option value="Others">Others</option>
                              
                            </select>
                                    </div>
                                    
                                </div>
						<div class="col-md-6">                                
                                    <div class="form-group">
                                        <label for="bud_manager_de">Budget Manager Department</label>
                                         <select  class="form-control" name="budmanagerde" value=""required>
                             <option value="<?php echo $BudgetManagerDepartment; ?>"></option>
                              <option value="Daily">Daily</option>
                              <option value="Weekly">Weekly</option>
                              <option value="Monthly">Monthly</option>
                              <option value="Yearly">Yearly</option>
                              <option value="Others">Others</option>
                              
                            </select>
                                    </div>
                                    
								</div>
						<div class="col-md-6">                                
                                    <div class="form-group">
                                        <label for="Pur_category">Purchasing Category</label>
                                         <select  class="form-control" name="Purcategory">
                             <option value="<?php echo $PurchasingCategory; ?>"></option>
                              <option value="Daily">Daily</option>
                              <option value="Weekly">Weekly</option>
                              <option value="Monthly">Monthly</option>
                              <option value="Yearly">Yearly</option>
                              <option value="Others">Others</option>
                              
                            </select>
                                    </div>
                                    
                                </div>
						</div>
                        </div><!-- /.box-body -->
    
                        <div class="box-footer" align="right">
                            <input type="submit" class="btn btn-primary" value="Submit" />
                            <input type="reset" class="btn btn-default" value="Reset" />
                        </div>
                    </form>
                </div>
            </div>
            <div class="col-md-4">
                <?php
                    $this->load->helper('form');
                    $error = $this->session->flashdata('error');
                    if($error)
                    {
                ?>
                <div class="alert alert-danger alert-dismissable">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    <?php echo $this->session->flashdata('error'); ?>                    
                </div>
                <?php } ?>
                <?php  
                    $success = $this->session->flashdata('success');
                    if($success)
                    {
                ?>
                <div class="alert alert-success alert-dismissable">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    <?php echo $this->session->flashdata('success'); ?>
                </div>
                <?php } ?>
                
                <div class="row">
                    <div class="col-md-12">
                        <?php echo validation_errors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'); ?>
                    </div>
                </div>
            </div>
        </div> 
</div>		
    </section>
</div>

<script src="<?php echo base_url(); ?>assets/js/editUser.js" type="text/javascript"></script>