Add and Edit screen changes in Asset details

This commit is contained in:
sriramv 2017-07-18 18:30:30 +05:30
parent a665dc58e9
commit d9251b77bf
6 changed files with 2373 additions and 300 deletions

View File

@ -44,24 +44,79 @@ class assetdetails extends BaseController
$data['userRecords'] = $this->assetdetails_model->assetListing();
$this->global['pageTitle'] = 'Siddharth : Asset List';
//print_r($data);die();
$this->loadViews("assetListing", $this->global, $data, NULL);
}
/**
* This function is used to load the add new supplier */
function addasset()
function addasset($PO='')
{
$data['SupplierList'] = $this->assetdetails_model->getSupplierName();
$data['DepartmentList'] = $this->assetdetails_model->getDepartment();
$data['AssetStatus'] = $this->assetdetails_model->getConfigValue('C015');
$data['po'] = $this->assetdetails_model->getPO($PO);
//print_r($data);die();
$this->global['pageTitle'] = 'siddharth : Add Asset';
$this->loadViews("addasset", $this->global, $data, NULL);
}
function getpo()
{
$po = $this->input->post('PONO');
$data = $this->assetdetails_model->getpo($po);
echo json_encode($data);
die();
}
function getline()
{
$line = $this->input->post('line');
$type = $this->assetdetails_model->gettyp($line);
//print_r($type);die();
$data='';
if(!empty($type)){
foreach($type as $item){
$data = $item->POType;
//print_r($data);die();
}
}
if($data=='SERVICE'){
$ser= $this->assetdetails_model->getlineitemser($line);
}
elseif($data=='REVENUE'){
$ser = $this->assetdetails_model->getlineitemre($line);
}
elseif($data=='IMPORT'){
$ser = $this->assetdetails_model->getlineitemimport($line);
}
elseif($data=='CAPITAL'){
$ser = $this->assetdetails_model->getlineitemcap($line);
}
//print_r($ser);die();
//print_r($data);die();
//$data = $this->getDateformat($data);
echo json_encode($ser);
die();
}
function getlin(){
$line = $this->input->post('line');
}
/* Validation for Department Dropdown
*/
function Department_validate($selectValue)
@ -118,7 +173,7 @@ class assetdetails extends BaseController
{
$this->form_validation->set_rules('AssetName','AssetName','trim|required');
$this->form_validation->set_rules('Description','Description','trim|required');
//$this->form_validation->set_rules('Description','Description','trim|required');
$this->form_validation->set_rules('Department','Department','trim|callback_Department_validate');
$this->form_validation->set_rules('Location','Location','trim|required');
$this->form_validation->set_rules('User','User','trim|required');
@ -137,7 +192,7 @@ class assetdetails extends BaseController
{
$AssetName = strtoupper($this->input->post('AssetName'));
$Description = $this->input->post('Description');
$Department = $this->input->post('Department');
$Department = $this->input->post('AssetDept');
$Location = $this->input->post('Location');
$User = $this->input->post('User');
$SupplierName = $this->input->post('SupplierName');
@ -149,6 +204,11 @@ class assetdetails extends BaseController
$DOCommission= $this->getDateformat($DateOfCommission);
$AssetStatus = $this->input->post('AssetStatus');
$Remarks = $this->input->post('Remarks');
$PONO = $this->input->post('PONO');
$lineitem = $this->input->post('lineitem');
$MaterialCode = $this->input->post('MaterialCode');
$Quantity = $this->input->post('Quantity');
$chked = $this->input->post('isactive');
@ -165,10 +225,10 @@ class assetdetails extends BaseController
$asset = array();
$asset = array('AssetName'=>$AssetName, 'Description'=>$Description,'DEPCode'=>$Department,'Location'=>$Location,'UserName'=>$User,'SupplierCode'=>$SupplierName,'DateOfPurchase'=>$DOPurchase,'DateOfCommison'=>$DOCommission,'AssetValue'=>$AssetValue,'AssetStatus'=>$AssetStatus,'IsActive'=>$IsActive,'Remarks'=>$Remarks,'CreatedBy'=>$CreatedBy);
$asset = array('AssetName'=>$AssetName, 'Description'=>$Description,'DEPCode'=>$Department,'Location'=>$Location,'UserName'=>$User,'SupplierCode'=>$SupplierName,'DateOfPurchase'=>$DOPurchase,'DateOfCommison'=>$DOCommission,'AssetValue'=>$AssetValue,'AssetStatus'=>$AssetStatus,'IsActive'=>$IsActive,'Remarks'=>$Remarks,'CreatedBy'=>$CreatedBy,'PONO'=>$PONO,'POLineItem'=>$lineitem,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity);
//print_r($asset);die();
$result = $this->assetdetails_model->addNewasset($asset);
// print_r($result);die();
if($result > 0)
{
// $this->session->set_flashdata('success', 'New Asset created successfully');
@ -194,7 +254,7 @@ class assetdetails extends BaseController
echo $this->input->post('Asset_Code');
}*/
function editOldasset($AssetCode = '')
function editOldasset($AssetCode = '',$PO='')
{
$SupplierName = $this->input->post('SupplierName');
@ -213,10 +273,12 @@ class assetdetails extends BaseController
//echo $AssetID;
$data['assetList'] = $this->assetdetails_model->getAssetDetails($AssetID);
$data['SupplierList'] = $this->assetdetails_model->getSupplierName($SupplierName);
$data['DepartmentList'] = $this->assetdetails_model->getDepartment($Department);
// $data['SupplierList'] = $this->assetdetails_model->getSupplierName($SupplierName);
// $data['DepartmentList'] = $this->assetdetails_model->getDepartment($Department);
$data['AssetStatusList'] = $this->assetdetails_model->getConfigValue('C015');
$this->global['pageTitle'] = 'Siddharth : Edit Asset';
$data['PO'] = $this->assetdetails_model->getPO($PO);
//print_r($data);die();
$this->global['pageTitle'] = 'Siddharth : Edit Asset';
$this->loadViews("editOldasset", $this->global, $data,NULL);
@ -264,7 +326,10 @@ class assetdetails extends BaseController
$DOCommission= $this->getDateformat($DateOfCommission);
$AssetStatus = $this->input->post('AssetStatus');
$Remarks = $this->input->post('Remarks');
$PONO = $this->input->post('PONO');
$lineitem = $this->input->post('lineitem');
$MaterialCode = $this->input->post('MaterialCode');
$Quantity = $this->input->post('Quantity');
$chked = $this->input->post('isactive');
if( $chked != '')
@ -280,9 +345,9 @@ class assetdetails extends BaseController
$asset = array();
$asset = array('AssetName'=>$AssetName, 'Description'=>$Description,'DEPCode'=>$Department,'Location'=>$Location,'UserName'=>$User,'SupplierCode'=>$SupplierName,'DateOfPurchase'=>$DOPurchase,'DateOfCommison'=>$DOCommission,'AssetValue'=>$AssetValue,'AssetStatus'=>$AssetStatus,'IsActive'=>$IsActive,'Remarks'=>$Remarks,'UpdatedBy'=>$UpdatedBy);
$asset = array('AssetName'=>$AssetName, 'Description'=>$Description,'DEPCode'=>$Department,'Location'=>$Location,'UserName'=>$User,'SupplierCode'=>$SupplierName,'DateOfPurchase'=>$DOPurchase,'DateOfCommison'=>$DOCommission,'AssetValue'=>$AssetValue,'AssetStatus'=>$AssetStatus,'IsActive'=>$IsActive,'Remarks'=>$Remarks,'UpdatedBy'=>$UpdatedBy,'PONO'=>$PONO,'POLineItem'=>$lineitem,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity);
//print_r($asset);die();
$result = $this->assetdetails_model->editasset($asset, $Asset_Code);
@ -334,18 +399,23 @@ class assetdetails extends BaseController
$this->excel->getActiveSheet()->setCellValue('C5', 'AssetCode');
$this->excel->getActiveSheet()->setCellValue('D5', 'AssetName');
$this->excel->getActiveSheet()->setCellValue('E5', 'Description');
$this->excel->getActiveSheet()->setCellValue('F5', 'DEPCode');
$this->excel->getActiveSheet()->setCellValue('F5', 'DepartmentName');
$this->excel->getActiveSheet()->setCellValue('G5', 'Location');
$this->excel->getActiveSheet()->setCellValue('H5', 'UserName');
$this->excel->getActiveSheet()->setCellValue('I5', 'SupplierCode');
$this->excel->getActiveSheet()->setCellValue('J5', 'DateOfPurchase');
$this->excel->getActiveSheet()->setCellValue('K5', 'DateOfCommison');
$this->excel->getActiveSheet()->setCellValue('L5', 'AssetValue');
$this->excel->getActiveSheet()->setCellValue('M5', 'AssetStatus');
$this->excel->getActiveSheet()->setCellValue('N5', 'IsActive');
$this->excel->getActiveSheet()->setCellValue('O5', 'Remarks');
$this->excel->getActiveSheet()->setCellValue('P5', 'CreatedBy');
$this->excel->getActiveSheet()->setCellValue('Q5', 'UpdatedBy');
$this->excel->getActiveSheet()->setCellValue('H5', 'PONO');
$this->excel->getActiveSheet()->setCellValue('I5', 'POLineItem');
$this->excel->getActiveSheet()->setCellValue('J5', 'MaterialName');
$this->excel->getActiveSheet()->setCellValue('K5', 'Quanity');
$this->excel->getActiveSheet()->setCellValue('L5', 'UserName');
$this->excel->getActiveSheet()->setCellValue('M5', 'SupplierName');
$this->excel->getActiveSheet()->setCellValue('N5', 'DateOfPurchase');
$this->excel->getActiveSheet()->setCellValue('O5', 'DateOfCommison');
$this->excel->getActiveSheet()->setCellValue('P5', 'AssetValue');
$this->excel->getActiveSheet()->setCellValue('Q5', 'AssetStatus');
$this->excel->getActiveSheet()->setCellValue('R5', 'IsActive');
$this->excel->getActiveSheet()->setCellValue('S5', 'Remarks');
$this->excel->getActiveSheet()->setCellValue('T5', 'CreatedBy');
$this->excel->getActiveSheet()->setCellValue('U5', 'UpdatedBy');
@ -382,12 +452,22 @@ class assetdetails extends BaseController
$this->excel->getActiveSheet()->getStyle('P5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('Q5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('Q5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('R5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('R5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('S5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('S5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('T5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('T5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('U5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('U5')->getFont()->setBold(true);
$exportData = $this->assetdetails_model->export_excel();
//print_r($exportData);die();
if ($exportData) {
$i = 6;
$s = 1;
@ -399,16 +479,20 @@ class assetdetails extends BaseController
$this->excel->getActiveSheet()->setCellValue('E'. $i,$data[ 'Description']);
$this->excel->getActiveSheet()->setCellValue('F'. $i,$data[ 'DEPCode']);
$this->excel->getActiveSheet()->setCellValue('G'. $i,$data[ 'Location']);
$this->excel->getActiveSheet()->setCellValue('H'. $i,$data[ 'UserName']);
$this->excel->getActiveSheet()->setCellValue('I'. $i,$data[ 'SupplierCode']);
$this->excel->getActiveSheet()->setCellValue('J'. $i,$data[ 'DateOfPurchase']);
$this->excel->getActiveSheet()->setCellValue('K'. $i,$data[ 'DateOfCommison']);
$this->excel->getActiveSheet()->setCellValue('L'. $i,$data[ 'AssetValue']);
$this->excel->getActiveSheet()->setCellValue('M'. $i,$data[ 'AssetStatus']);
$this->excel->getActiveSheet()->setCellValue('N'. $i,$data[ 'IsActive']);
$this->excel->getActiveSheet()->setCellValue('O'. $i,$data[ 'Remarks']);
$this->excel->getActiveSheet()->setCellValue('P'. $i,$data[ 'firstname']);
$this->excel->getActiveSheet()->setCellValue('Q'. $i,$data[ 'Updated_By']);
$this->excel->getActiveSheet()->setCellValue('H'. $i,$data[ 'PONO']);
$this->excel->getActiveSheet()->setCellValue('I'. $i,$data[ 'POLineItem']);
$this->excel->getActiveSheet()->setCellValue('J'. $i,$data[ 'MaterialName']);
$this->excel->getActiveSheet()->setCellValue('K'. $i,$data[ 'Quantity']);
$this->excel->getActiveSheet()->setCellValue('L'. $i,$data[ 'UserName']);
$this->excel->getActiveSheet()->setCellValue('M'. $i,$data[ 'SupplierName']);
$this->excel->getActiveSheet()->setCellValue('N'. $i,$data[ 'DateOfPurchase']);
$this->excel->getActiveSheet()->setCellValue('O'. $i,$data[ 'DateOfCommison']);
$this->excel->getActiveSheet()->setCellValue('P'. $i,$data[ 'AssetValue']);
$this->excel->getActiveSheet()->setCellValue('Q'. $i,$data[ 'AssetStatus']);
$this->excel->getActiveSheet()->setCellValue('R'. $i,$data[ 'IsActive']);
$this->excel->getActiveSheet()->setCellValue('S'. $i,$data[ 'Remarks']);
$this->excel->getActiveSheet()->setCellValue('T'. $i,$data[ 'firstname']);
$this->excel->getActiveSheet()->setCellValue('U'. $i,$data[ 'Updated_By']);

File diff suppressed because it is too large Load Diff

View File

@ -12,9 +12,10 @@ class assetdetails_model extends CI_Model
*/
function assetListing()
{
$this->db->select('*');
$this->db->from('T_Asset_Details');
$this->db->select('asd.*,dep.DepartmentName,sup.SupplierName');
$this->db->from('T_Asset_Details asd');
$this->db->join('T_DepartmentDetails dep', ' dep.DEPCode = asd.DEPCode','left');
$this->db->join ('T_SupplierDetailsN sup','sup.SupplierID = asd.SupplierCode');
$query = $this->db->get();
@ -50,7 +51,102 @@ class assetdetails_model extends CI_Model
return $query->result();
}
function getPO($PO){
$this->db->distinct();
$this->db->select('POM.PONO,POM.SupplierID,POL.MaterialCode,DeliveryDate,PODate,sup.SupplierName,POL.LineItemNo');
$this->db->from('T_PurchaseOrder_Master POM');
$this->db->join('T_PurchaseOrder_LineItem POL', 'POL.PONO = POM.PONO');
$this->db->join('T_SupplierDetailsN sup', 'sup.SupplierID = POM.SupplierID');
if(!empty($PO)){
$this->db->where('POM.PONO', $PO);
}
$query = $this->db->get();
//print_r($this->db->last_query());
return $query->result();
}
function getlineitemre($line){
$this->db->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POL.Quantity,POM.POType,re.TotalValue,req.ReqNo,emp.firstname,emp.Departmentcode,dep.DepartmentName');
$this->db->from('T_PurchaseOrder_LineItem POL');
$this->db->join('T_Requestion_Master req','req.ReqNo = POL.ReqNo','left');
$this->db->join('T_PurchaseOrder_Master POM','POM.PONO=POL.PONO','left');
$this->db->join ('T_MaterialMaster MM','MM.MaterialCode = POL.MaterialCode','left');
$this->db->join('T_Employee_Details emp','emp.EmpID = req.Requestedby','left');
$this->db->join('T_DepartmentDetails dep','dep.DEPCode = emp.Departmentcode','left');
$this->db->join ('T_Revenue_Tax re','re.LineItemNo = POL.LineItemNo','left');
$this->db->where('POL.LineItemNo',$line);
$query = $this->db->get();
$result = $query->result();
return $result;
}
function getlineitemser($line){
$this->db->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,ser.TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode');
$this->db->from('T_PurchaseOrder_LineItem POL');
$this->db->join('T_Requestion_Master req','req.ReqNo = POL.ReqNo','left');
$this->db->join('T_PurchaseOrder_Master POM','POM.PONO=POL.PONO','left');
$this->db->join ('T_MaterialMaster MM','MM.MaterialCode = POL.MaterialCode','left');
$this->db->join('T_Employee_Details emp','emp.EmpID = req.Requestedby','left');
$this->db->join('T_DepartmentDetails dep','dep.DEPCode = emp.Departmentcode','left');
$this->db->join ('T_Service_Tax ser','ser.LineItemNo = POL.LineItemNo','left');
$this->db->where('POL.LineItemNo',$line);
$query = $this->db->get();
$result = $query->result();
return $result;
}
function getlineitemimport($line){
$this->db->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,ser.TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode');
$this->db->from('T_PurchaseOrder_LineItem POL');
$this->db->join('T_Requestion_Master req','req.ReqNo = POL.ReqNo','left');
$this->db->join('T_PurchaseOrder_Master POM','POM.PONO=POL.PONO','left');
$this->db->join ('T_MaterialMaster MM','MM.MaterialCode = POL.MaterialCode','left');
$this->db->join('T_Employee_Details emp','emp.EmpID = req.Requestedby','left');
$this->db->join('T_DepartmentDetails dep','dep.DEPCode = emp.Departmentcode','left');
$this->db->join ('T_Import_Tax ser','ser.LineItemNo = POL.LineItemNo','left');
$this->db->where('POL.LineItemNo',$line);
$query = $this->db->get();
$result = $query->result();
return $result;
}
function getlineitemcap($line){
$this->db->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,sum(ser.TotalValue+imp.TotalValue) as TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode');
$this->db->from('T_PurchaseOrder_LineItem POL');
$this->db->join('T_Requestion_Master req','req.ReqNo = POL.ReqNo','left');
$this->db->join('T_PurchaseOrder_Master POM','POM.PONO=POL.PONO','left');
$this->db->join ('T_MaterialMaster MM','MM.MaterialCode = POL.MaterialCode','left');
$this->db->join('T_Employee_Details emp','emp.EmpID = req.Requestedby','left');
$this->db->join('T_DepartmentDetails dep','dep.DEPCode = emp.Departmentcode','left');
$this->db->join ('T_Import_Tax imp','imp.LineItemNo = POL.LineItemNo','left');
$this->db->join ('T_Service_Tax ser','ser.LineItemNo = POL.LineItemNo','left');
$this->db->where('POL.LineItemNo',$line);
$query = $this->db->get();
$result = $query->result();
return $result;
}
function gettyp($type)
{
$this->db->select('POM.POType,POL.LineItemNo');
$this->db->from('T_PurchaseOrder_LineItem POL');
$this->db->join('T_PurchaseOrder_Master POM','POM.PONO=POL.PONO');
$this->db->where('POL.LineItemNo',$type);
$query = $this->db->get();
$result = $query->result();
return $result;
}
/**
* This function is used to get the Config value from configuration table
* @return array $result : This is result of the query
@ -96,10 +192,12 @@ function addNewasset($asset)
function getAssetDetails($Asset_Code)
{
//echo $Asset_Code;
$this->db->select('Asset.*,Dep.DepartmentName as DepartmentName,Supp.SupplierName as SupplierName');
$this->db->select('Asset.*,POM.DeliveryDate,Dep.DepartmentName as DepartmentName,MM.MaterialName,MM.UOM,Supp.SupplierName as SupplierName');
$this->db->from('T_Asset_Details Asset');
$this->db->join('T_DepartmentDetails Dep', 'Asset.DEPCode = Dep.DEPCode','left');
$this->db->join('T_SupplierDetailsN Supp', 'Asset.SupplierCode = Supp.SupplierID','left');
$this->db->join('T_MaterialMaster MM ', 'MM.MaterialCode = Asset.MaterialCode','left');
$this->db->join('T_PurchaseOrder_Master POM','POM.PONO = Asset.PONO','left');
$this->db->where('Asset.AssetCode', $Asset_Code);
@ -125,10 +223,12 @@ function addNewasset($asset)
}
function export_excel(){
$this->db->select('det.*,dep.DepartmentName as DEPCode,emp.firstname,emp1.firstname as Updated_By');
$this->db->select('det.*,dep.DepartmentName as DEPCode,sup.SupplierName,MM.MaterialName,emp.firstname,emp1.firstname as Updated_By');
$this->db->join('tbl_users as tbl',' det.createdby = tbl.userid','left');
$this->db->join('T_DepartmentDetails as dep','dep.DEPCode=det.DEPCode');
$this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid','left');
$this->db->join('T_SupplierDetailsN as sup', 'sup.SupplierID=det.SupplierCode','left');
$this->db->join('T_MaterialMaster MM ', 'MM.MaterialCode = det.MaterialCode','left');
$this->db->join('tbl_users as tbl1',' det.UpdatedBy = tbl1.userid','left');
$this->db->join('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid','left');
return $this->db->get('T_Asset_Details as det')->result_array();

View File

@ -10,7 +10,10 @@ $(function() {
var mindt = year-70;
var maxdt = year-15;
$("#PONO").select2();
$("#SelectMaterialCode").select2();
$("#AssetStatus").select2();
$("#DateOfCommission").datepicker({
minDate : new Date(year-SIAStartYear,1,1),
maxDate :'now',
@ -27,6 +30,12 @@ $(function() {
});
$("#DeliveryDate").datepicker({
minDate : new Date(year-SIAStartYear,1,1),
maxDate :'now',
dateFormat: 'mm/dd/yy',changeMonth: true, changeYear: true,
});
});
@ -43,7 +52,7 @@ $(function() {
</script>
<div class="content-wrapper">
<div class="content-wrapper" style="min-height: 537px;">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
@ -69,180 +78,229 @@ $(function() {
<form role="form" id="addAsset" action="<?php echo base_url() ?>addNewasset" method="post">
<div class="box-body">
<div class="row">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Asset_Name">Asset Name</span>
<input type="text" class="form-control required" required style="text-transform:uppercase;" id="AssetName" name="AssetName" value="<?php echo isset($_POST['AssetName']) ? $_POST['AssetName'] : '' ?>">
</div>
</div>
</div>
<div class="col-md-3">
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Description">Description</span>
<span for="Description">Asset Description</span>
<input type="text" class="form-control required" id="Description" required name="Description" value="<?php echo isset($_POST['Description']) ? $_POST['Description'] : '' ?>">
</div>
</div>
</div>
<div class="col-md-3">
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Department">Department</span>
<select class="form-control required" id="Department" name="Department" >
<option value="-1" >Select Department</option>
<?php
if(!empty($DepartmentList))
{
foreach ($DepartmentList as $DEP)
{
$DepartmentId = $DEP->DEPCode;
if ($_POST['Department'] == $DepartmentId)
{
echo "<option value=\"".$DepartmentId."\" selected=\"selected\">".$DepartmentId.' - '. $DEP->DepartmentName."</option>";
}
else
{
echo "<option value=\"".$DepartmentId."\">".$DepartmentId.' - '. $DEP->DepartmentName ."</option>";
}
}
}
?>
</select>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Location">Location</span>
<input type="text" class="form-control required" required id="Location" name="Location" value= "<?php echo isset($_POST['Location']) ? $_POST['Location'] : '' ?>">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="AssetOwner">Asset User</span>
<input type="text" class="form-control required" required id="User" name="User" value= "<?php echo isset($_POST['User']) ? $_POST['User'] : '' ?>">
</div>
</div>
</div>
<div class="col-md-3">
<div class="col-md-3">
<div class="form-group">
<span for="SupplierName">Supplier Name</span>
<select class="form-control required" id="SupplierName" name="SupplierName">
<option value="-1">Select Supplier Name</option>
<?php
if(!empty($SupplierList))
{
foreach ($SupplierList as $SID)
{
$SupplierId = $SID->SupplierID;
if ($_POST['SupplierName'] == $SupplierId)
{
echo "<option value=\"".$SupplierId."\" selected=\"selected\">".$SupplierId.' - '. $SID->SupplierName."</option>";
}
else
{
echo "<option value=\"".$SupplierId."\">".$SupplierId.' - '. $SID->SupplierName ."</option>";
}
}
}
?>
</select>
<span for="Location">Asset Location</span>
<input type="text" class="form-control required" required id="Location" name="Location" value= "<?php echo isset($_POST['Location']) ? $_POST['Location'] : '' ?>">
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<span for="PONO">Purchase Order Number</span>
<select class="form-control required select2" id="PONO" name="PONO">
<option value="-1">Select PO Number</option>
<?php
if(!empty($po))
{
foreach ($po as $po)
{
$PONO = $po->PONO;
if ($_POST['PONO'] == $PONO)
{
echo "<option value=\"".$PONO."\" selected=\"selected\">".$PONO.' - '. $SID->PONO."</option>";
}
else
{
echo "<option value=\"".$PONO."\">".$PONO.' '. $SID->PONO ."</option>";
}
}
}
?>
</select>
</div>
</div>
<div class="col-md-3" style="padding:0px;">
<div class="col-md-6">
<div class="form-group">
<span for="SelectMaterialCode">select Material Code</span>
<select class="form-control required select2" id="SelectMaterialCode" name="lineitem">
<option >select Material Code</option>
</select>
</div>
</div>
<div class="col-md-6" >
<div class="form-group">
<span for="MaterialCode">Material Code</span>
<input type="text" class="form-control required" id="MaterialCode" readonly name="MaterialCode" value="">
</div>
</div>
</div>
<div class="col-md-3" style="padding:0px;">
<div class="col-md-6">
<div class="form-group">
<span for="UOM">UOM</span>
<input type="text" class="form-control required" id="UOM" readonly name="UOM" value="">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<span for="Quantity">Quantity</span>
<input type="text" class="form-control required" id="Quantity" name="Quantity" value="">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="PODescription">Description</span>
<input type="text" class="form-control required" id="PODescription" readonly name="PODescription" value="<?php echo isset($_POST['PODescription']) ? $_POST['PODescription'] : '' ?>">
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<input type="hidden" name="AssetDept" id="depcode">
<span for="AssetDept">Asset Department</span>
<input type="text" class="form-control required" id="AssetDept" readonly name="" value="">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="DateOfPurchase">Date Of Purchase</span>
<span for="DateOfPurchase">Purchase Date</span>
<input id="DateOfPurchase" required name="DateOfPurchase" onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo isset($_POST['DateOfPurchase']) ? $_POST['DateOfPurchase'] : '' ?>">
</div>
</div>
<div class="col-md-3">
<div class="col-md-3">
<div class="form-group">
<span for="DateOfPurchase">Supplier Name</span>
<input type="hidden" name="SupplierName" id="SupID">
<input id="SupplierName" readonly name="" onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo isset($_POST['SupplierName']) ? $_POST['SupplierName'] : '' ?>">
</div>
</div>
<div class="col-md-3" style="padding:0px;">
<div class="col-md-6">
<div class="form-group">
<span for="DeliveryDate">Delivery Date</span>
<input id="DeliveryDate" required name="DeliveryDate" onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo isset($_POST['DeliveryDate']) ? $_POST['DeliveryDate'] : '' ?>">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<span for="DateOfCommission">Date Of Commission</span>
<input id="DateOfCommission" required name="DateOfCommission" onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo isset($_POST['DateOfCommission']) ? $_POST['DateOfCommission'] : '' ?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="Assetvalue">Asset Value</span>
<input type="text" class="form-control required" id="Assetvalue" name="Assetvalue" required onkeypress="return isNumberKey(event)" title="Please Enter currency value" maxlength="255" value= "<?php echo isset($_POST['Assetvalue']) ? $_POST['Assetvalue'] : '' ?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="AssetStatus">Asset Status</span>
<select class="form-control required" id="AssetStatus" name="AssetStatus">
<option value="-1" >Select Asset Status</option>
<?php
if(!empty($AssetStatus))
{
foreach ($AssetStatus as $SID)
{
$AssetValue = $SID->ConfigValue;
if ($_POST['AssetStatus'] == $AssetValue)
</div>
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<span for="Assetvalue">Asset Value</span>
<input type="text" class="form-control required" id="Assetvalue" name="Assetvalue" required onkeypress="return isNumberKey(event)" title="Please Enter currency value" maxlength="255" value= "<?php echo isset($_POST['Assetvalue']) ? $_POST['Assetvalue'] : '' ?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="AssetStatus">Asset Status</span>
<select class="form-control required select2" id="AssetStatus" name="AssetStatus">
<option value="-1" >Select Asset Status</option>
<?php
if(!empty($AssetStatus))
{
foreach ($AssetStatus as $SID)
{
$AssetValue = $SID->ConfigValue;
if ($_POST['AssetStatus'] == $AssetValue)
{
echo "<option value=\"".$AssetValue."\" selected=\"selected\">".$AssetValue."</option>";
echo "<option value=\"".$AssetValue."\" selected=\"selected\">".$AssetValue."</option>";
}
else
{
echo "<option value=\"".$AssetValue."\">".$AssetValue."</option>";
}
}
else
{
echo "<option value=\"".$AssetValue."\">".$AssetValue."</option>";
}
}
}
?>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<span for="Remarks">Remarks</span>
<input type="text" class="form-control required" id="Remarks" name="Remarks" maxlength="500" value= "<?php echo isset($_POST['Remarks']) ? $_POST['Remarks'] : '' ?>">
</div>
}
?>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<span for="Remarks">Remarks</span>
<input type="text" class="form-control required" id="Remarks" name="Remarks" maxlength="500" value= "<?php echo isset($_POST['Remarks']) ? $_POST['Remarks'] : '' ?>">
</div>
</div>
</div>
<div class="col-md-3">
<input type="checkbox" id="isactive" name="isactive" <?php echo (isset($_POST['isactive']) ? 'checked' : '') ?>> IsActive
<div class="col-md-12">
<div class="col-md-3">
<input type="checkbox" id="isactive" name="isactive" <?php echo (isset($_POST['isactive']) ? 'checked' : '') ?>> IsActive
</div>
</div>
</div><!-- /.box-body -->
</div><!-- /.box-body -->
<div class="box-footer" style="text-align:right">
<input type="submit" class="btn btn-info" value="Submit" />
<input type="reset" class="btn btn-info" value="Reset" />
</div>
</form>
</div>
</form>
</div>
<div class="col-md-4">
<?php
@ -273,9 +331,103 @@ $(function() {
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<script src="<?php echo base_url(); ?>assets/js/addUser.js" type="text/javascript"></script>
<script>
$('#PONO').on('change',function(){
var PONO = $(this).val();
if(PONO){
$.ajax({
type:'POST',
url:"<?php echo base_url() ?>assetdetails/getpo",
data:'PONO='+PONO,
success:function(data){
// alert(data);
var line ='';
$('#SelectMaterialCode').empty();
$.each(JSON.parse(data), function (i, item) {
//alert(item.LineItemNo);
line ='<option>select Material Code</option>';
line +='<option value='+item.LineItemNo+'>'+item.LineItemNo+'-'+item.MaterialCode+'</option>';
//$('#DeliveryDate').val(item.DeliveryDate);
$('#SupplierName').val(item.SupplierName);
$('#SupID').val(item.SupplierID);
$('#DateOfPurchase').val(item.PODate);
var date = new Date(item.DeliveryDate);
var date1 = (date.getDate()+ '/' + (date.getMonth() + 1)+ '/' + date.getFullYear());
$("#DeliveryDate").val(date1);
var date = new Date(item.PODate);
var date3 = (date.getDate()+ '/' + (date.getMonth() + 1)+ '/' + date.getFullYear());
$("#DateOfPurchase").val(date3);
$('#SelectMaterialCode').append(line);
});
}
});
}
});
$('#SelectMaterialCode').on('change',function(){
var line = $(this).val();
//line +='<option>select Material Code</option>'
if(line){
$.ajax({
type:'POST',
url:"<?php echo base_url() ?>assetdetails/getline",
data:'line='+line,
success:function(data){
//alert(data);
var id = $('#SelectMaterialCode').val();
$.each(JSON.parse(data), function (i, item) {
if(id == item.LineItemNo){
// alert(item.MaterialCode);
//alert(item.Departmentcode);
$('#MaterialCode').val(item.MaterialCode);
$('#UOM').val(item.UOM);
$('#Quantity').val(item.Quantity);
$('#depcode').val(item.Departmentcode);
$('#AssetDept').val(item.DepartmentName);
$('#PODescription').val(item.MaterialName);
//alert(item.TotalValue);
$('#Assetvalue').val(item.TotalValue);
}
//line ='<option>'+item.LineItemNo+'</option>';
// $('#POLineItem').append(line);
});
}
});
}
});
</script>

View File

@ -25,10 +25,10 @@
<th>Asset Code</th>
<th>Asset Name</th>
<th>Description</th>
<th>Department Code</th>
<th>Department Name</th>
<th>Location</th>
<th>Asset User</th>
<th>Supplier ID</th>
<th>Supplier Name</th>
<th>Date Of Purchase</th>
<th>Asset Value</th>
<th>Asset Status</th>
@ -47,10 +47,10 @@
<td><u><a href="<?php echo base_url().'assetdetails/editOldasset/?AssetID='.$record->AssetCode; ?>" data-toggle="tooltip" title="<?php echo $record->AssetCode; ?> - Click here to view Asset details"><?php echo $record->AssetCode ?>
<td><?php echo $record->AssetName ?></td>
<td><?php echo $record->Description ?></td>
<td><?php echo $record->DEPCode ?></td>
<td><?php echo $record->DepartmentName ?></td>
<td><?php echo $record->Location ?></td>
<td><?php echo $record->UserName ?></td>
<td><?php echo $record->SupplierCode ?></td>
<td><?php echo $record->SupplierName ?></td>
<td><?php
$dtpurchase = new DateTime($record->DateOfPurchase);
$DOPurchase = $dtpurchase ->format('Y-m-d');

View File

@ -8,13 +8,20 @@ $Location = '';
$User = '';
$SupplierName = '';
$DOPurchase = '';
$DOCommission = '';
$DateOfCommison = '';
$AssetValue = '';
$AssetStatus = '';
$IsActive ='';
$Remarks = '';
$DepartmentName ='';
$SupplierCode = '';
$MaterialCode = '';
$PONO = '';
$POLineItem='';
$Quantity='';
$UOM = '';
$MaterialName='';
$DeliveryDate='';
if(!empty($assetList))
{
foreach ($assetList as $Asset)
@ -22,16 +29,30 @@ if(!empty($assetList))
$AssetCode = $Asset->AssetCode;
$AssetName = $Asset->AssetName;
$Description = $Asset->Description;
$Department = $Asset->DEPCode ;
$Department = $Asset->DepartmentName ;
$DepartmentName = $Asset->DepartmentName;
$Location = $Asset->Location;
$User = $Asset->UserName;
$SupplierName = $Asset->SupplierName;
$SupplierCode = $Asset->SupplierCode;
$DateOfPurchase = $Asset->DateOfPurchase;
$PODate = new DateTime($DateOfPurchase);
$DateOfPurchase = $PODate->format('Y-m-d');
$DateOfCommission = $Asset->DateOfCommison;
$assetDate = new DateTime($DateOfCommison);
$DateOfCommison = $assetDate->format('Y-m-d');
$AssetValue = $Asset->AssetValue;
$AssetStatus = $Asset->AssetStatus;
$MaterialCode = $Asset->MaterialCode;
$PONO = $Asset->PONO;
$POLineItem = $Asset->POLineItem;
$Quantity = $Asset->Quantity;
$MaterialName = $Asset->MaterialName;
$UOM = $Asset->UOM;
$DeliveryDate = $Asset->DeliveryDate;
$PODelivery = new DateTime($DeliveryDate);
$DeliveryDate = $PODelivery ->format('Y-m-d');
$Remarks = $Asset->Remarks;
$chk = $Asset->IsActive;
@ -72,7 +93,10 @@ $(function() {
var mindt = year-70;
var maxdt = year-15;
$("#PONO").select2();
$("#SelectMaterialCode").select2();
$("#AssetStatus").select2();
$("#DateOfCommission").datepicker({
minDate : new Date(year-SIAStartYear,1,1),
maxDate :'now',
@ -84,10 +108,17 @@ $(function() {
$("#DateOfPurchase").datepicker({
minDate : new Date(year-SIAStartYear,1,1),
maxDate :'now',
dateFormat: 'mm/dd/yy',changeMonth: true, changeYear: true
dateFormat: 'mm/dd/yy',changeMonth: true, changeYear: true,
});
$("#DeliveryDate").datepicker({
minDate : new Date(year-SIAStartYear,1,1),
maxDate :'now',
dateFormat: 'mm/dd/yy',changeMonth: true, changeYear: true,
});
});
@ -101,147 +132,215 @@ $(function() {
return true;
}
</script>
<div class="content-wrapper">
<div class="content-wrapper" style="min-height: 537px;">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Edit Asset Details</center>
<center>Siddharth Industries - Edit Asset Details</center>
</h1>
</section>
<section class="content">
<div style="text-align:right;">
<a href="<?php echo base_url() ?>assetListing" class="btn btn-info" value="Back"/>Back</a>
<a href="<?php base_url() ?>assetListing" class="btn btn-info" value="Back"/>Back</a>
</div>
<br/>
<br>
<div class="row">
<!-- left column -->
<div class="col-md-12">
<!-- general form elements -->
<div class="box box-primary">
<!-- form start -->
<form role="form" id="addUser" action="<?php echo base_url() ?>editasset" method="post">
<form role="form" id="addAsset" action="<?php echo base_url() ?>editasset" method="post">
<div class="box-body">
<div class="row">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Asset_Name">Asset Name</span>
<input type="text" class="form-control required" id="AssetName" name="AssetName" value="<?php echo $AssetName;?>" style="text-transform:uppercase;">
<input type="hidden" name="AssetCode" id="AssetCode" class="form-control" readonly value="<?php echo $AssetCode;?>">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="Description">Asset Description</span>
<input type="text" class="form-control required" id="Description" name="Description"
value="<?php echo $Description; ?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="AssetOwner">Asset User</span>
<input type="text" class="form-control required" id="User" name="User" value="<?php echo $User;?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="Location">Asset Location</span>
<input type="text" class="form-control required" id="Location" name="Location"
value="<?php echo $Location;?>">
</div>
</div>
<div class="col-md-3">
</div>
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<span for="PONO">Purchase Order Number</span>
<select class="form-control required select2" id="PONO" name="PONO">
<option value="<?php echo $PONO;?>"><?php echo $PONO;?></option>
<?php
if(!empty($PO))
{
foreach ($PO as $po)
{
$PONO = $po->PONO;
if ($_POST['PONO'] == $PONO)
{
echo "<option value=\"".$PONO."\" selected=\"selected\">".$PONO.' - '. $SID->PONO."</option>";
}
else
{
echo "<option value=\"".$PONO."\">".$PONO.' '. $SID->PONO ."</option>";
}
}
}
?>
</select>
</div>
</div>
<div class="col-md-3" style="padding:0px;">
<div class="col-md-6">
<div class="form-group">
<span for="SelectMaterialCode" value=""> select Material Code</span>
<select class="form-control required select2" id="SelectMaterialCode" name="lineitem">
<option value="<?php echo $POLineItem;?>"><?php echo $POLineItem;?></option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<span for="MaterialCode">Material Code</span>
<input type="text" class="form-control required" id="MaterialCode" readonly name="MaterialCode" value="<?php echo $MaterialCode;?>">
</div>
</div>
</div>
<div class="col-md-3" style="padding:0px;">
<div class="col-md-6">
<div class="form-group">
<span for="UOM">UOM</span>
<input type="text" class="form-control required" id="UOM"value="<?php echo $UOM;?>"readonly name="UOM" value="">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<span for="Quantity">Quantity</span>
<input type="text" class="form-control required" id="Quantity" value="<?php echo $Quantity;?>" name="Quantity" value="">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Description">Description</span>
<input type="text" class="form-control required" id="Description" name="Description"
value="<?php echo $Description; ?>">
</div>
<input type="text" class="form-control required" id="PODescription" readonly name="PODescription" value="<?php echo $MaterialName;?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Department">Department</span>
<select class="form-control required" id="Department" name="Department">
<option value="<?php echo $Department; ?>"><?php echo $Department.' - '.$DepartmentName; ?></option>
<?php
if(!empty($DepartmentList))
{
foreach ($DepartmentList as $SID)
{
?>
<option value="<?php echo $SID->DEPCode ?>"><?php echo $SID->DEPCode.' - '. $SID->DepartmentName;?></option>
<?php
}
}
?>
</select>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Location">Location</span>
<input type="text" class="form-control required" id="Location" name="Location"
value="<?php echo $Location;?>">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="AssetOwner">Asset User Name</span>
<input type="text" class="form-control required" id="User" name="User" value="<?php echo $User;?>">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="SupplierName">Supplier Name</span>
<select class="form-control required" id="SupplierName" name="SupplierName">
<option value="<?php echo $SupplierCode;?>"><?php echo $SupplierCode.' - '.$SupplierName;?></option>
<?php
if(!empty($SupplierList))
{
foreach ($SupplierList as $SID)
{
?>
<option value="<?php echo $SID->SupplierID; ?>"><?php echo $SID->SupplierID.' - '.$SID->SupplierName ;?></option>
<?php
}
}
?>
</select>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<input type="hidden" name="AssetDept" id="depcode">
<span for="AssetDept">Asset Department</span>
<input type="text" class="form-control required" value="<?php echo $Department;?>" id="AssetDept" readonly name="" value="">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="DateOfPurchase">Date Of Purchase</span>
<input id="DateOfPurchase" required name="DateOfPurchase" onkeypress="return false;" maxlength="10" class="form-control" value="<?php echo $DOPurchase; ?>">
<span for="DateOfPurchase">Purchase Date</span>
<input id="DateOfPurchase" required name="DateOfPurchase" onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo $DateOfPurchase;?>">
</div>
</div>
<div class="col-md-3">
<div class="col-md-3">
<div class="form-group">
<span for="DateOfPurchase">Supplier Name</span>
<input type="hidden" name="SupplierName" id="SupID">
<input id="SupplierName" required name="" readonly onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo $SupplierName ?>">
</div>
</div>
<div class="col-md-3" style="padding:0px;">
<div class="col-md-6">
<div class="form-group">
<span for="DeliveryDate">Delivery Date</span>
<input id="DeliveryDate" required name="DeliveryDate" onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo $DeliveryDate;?>">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<span for="DateOfCommission">Date Of Commission</span>
<input id="DateOfCommission" required name="DateOfCommission" onkeypress="return false;" maxlength="10" class="form-control" value="<?php echo $DOCommission;?>">
<input id="DateOfCommission" required name="DateOfCommission" onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo $DateOfCommison;?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="Assetvalue">Asset Value</span>
<input type="text" class="form-control required" id="Assetvalue" name="Assetvalue" onkeypress="return isNumberKey(event)" maxlength="255" value="<?php echo $AssetValue;?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="AssetStatus">Asset Status</span>
<select class="form-control required" id="AssetStatus" name="AssetStatus">
</div>
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<span for="Assetvalue">Asset Value</span>
<input type="text" class="form-control required" id="Assetvalue" name="Assetvalue" onkeypress="return isNumberKey(event)" maxlength="255" value="<?php echo $AssetValue;?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="AssetStatus">Asset Status</span>
<select class="form-control required" id="AssetStatus" name="AssetStatus">
<option value="<?php echo $AssetStatus; ?>"><?php echo $AssetStatus; ?></option>
<?php
if(!empty($AssetStatusList))
@ -255,28 +354,157 @@ $(function() {
}
?>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<span for="Remarks">Remarks</span>
<input type="text" class="form-control required" id="Remarks" name="Remarks" maxlength="500" value="<?php echo $Remarks; ?>">
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<span for="Remarks">Remarks</span>
<input type="text" class="form-control required" id="Remarks" name="Remarks" maxlength="500" value="<?php echo $Remarks; ?>">
</div>
</div>
</div>
<div class="col-md-3">
<input type="checkbox" id="isactive" name="isactive" <?php echo $IsActive ?> > IsActive
<div class="col-md-12">
<div class="col-md-3">
<input type="checkbox" id="isactive" name="isactive" <?php echo $IsActive ?> > IsActive
</div>
</div>
</div><!-- /.box-body -->
</div><!-- /.box-body -->
<div class="box-footer" style="text-align:right">
<input type="submit" class="btn btn-info" value="Submit" />
<input type="reset" class="btn btn-info" value="Reset" />
</div>
</form>
</div>
</form>
</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/addUser.js" type="text/javascript"></script>
<script>
$('#PONO').on('change',function(){
var PONO = $(this).val();
if(PONO){
$.ajax({
type:'POST',
url:"<?php echo base_url() ?>assetdetails/getpo",
data:'PONO='+PONO,
success:function(data){
// alert(data);
var line ='';
$('#SelectMaterialCode').empty();
$.each(JSON.parse(data), function (i, item) {
//alert(item.LineItemNo);
line ='<option>select Material Code</option>';
line +='<option value='+item.LineItemNo+'>'+item.LineItemNo+'-'+item.MaterialCode+'</option>';
//$('#DeliveryDate').val(item.DeliveryDate);
$('#SupplierName').val(item.SupplierName);
$('#SupID').val(item.SupplierID);
$('#DateOfPurchase').val(item.PODate);
var date = new Date(item.DeliveryDate);
var date1 = (date.getDate()+ '/' + (date.getMonth() + 1)+ '/' + date.getFullYear());
$("#DeliveryDate").val(date1);
var date = new Date(item.PODate);
var date3 = (date.getDate()+ '/' + (date.getMonth() + 1)+ '/' + date.getFullYear());
$("#DateOfPurchase").val(date3);
$('#SelectMaterialCode').append(line);
});
}
});
}
});
$('#SelectMaterialCode').on('change',function(){
var line = $(this).val();
//line +='<option>select Material Code</option>'
if(line){
$.ajax({
type:'POST',
url:"<?php echo base_url() ?>assetdetails/getline",
data:'line='+line,
success:function(data){
//alert(data);
var id = $('#SelectMaterialCode').val();
$.each(JSON.parse(data), function (i, item) {
if(id == item.LineItemNo){
// alert(item.MaterialCode);
//alert(item.Departmentcode);
$('#MaterialCode').val(item.MaterialCode);
$('#UOM').val(item.UOM);
$('#Quantity').val(item.Quantity);
$('#depcode').val(item.Departmentcode);
$('#AssetDept').val(item.DepartmentName);
$('#PODescription').val(item.MaterialName);
//alert(item.TotalValue);
$('#Assetvalue').val(item.TotalValue);
}
//line ='<option>'+item.LineItemNo+'</option>';
// $('#POLineItem').append(line);
});
}
});
}
});
</script>