Add/Edit Asset Details

This commit is contained in:
venbatechnologies@gmail.com 2017-08-04 17:37:07 +05:30
parent 70ba1db7fd
commit a702878f09
4 changed files with 57 additions and 40 deletions

View File

@ -38,9 +38,7 @@ class assetdetails extends BaseController
{ {
$this->load->model('assetdetails_model'); $this->load->model('assetdetails_model');
$data['userRecords'] = $this->assetdetails_model->assetListing(); $data['userRecords'] = $this->assetdetails_model->assetListing();
$this->global['pageTitle'] = 'Siddharth : Asset List'; $this->global['pageTitle'] = 'Siddharth : Asset List';
@ -129,11 +127,11 @@ class assetdetails extends BaseController
echo json_encode($ser); echo json_encode($ser);
die(); die();
} }
function getlin(){ // function getlin(){
$line = $this->input->post('line'); // $line = $this->input->post('line');
} // }
/* Validation for Department Dropdown /* Validation for Department Dropdown
*/ */
function Department_validate($selectValue) function Department_validate($selectValue)
@ -217,9 +215,15 @@ class assetdetails extends BaseController
$DateOfCommission = $this->input->post('DateOfCommission'); $DateOfCommission = $this->input->post('DateOfCommission');
$CreatedBy = $this->session->userdata('userId'); $CreatedBy = $this->session->userdata('userId');
$AssetValue = $this->input->post('Assetvalue'); $AssetValue = $this->input->post('Assetvalue');
$DOPurchase = $this->getDateformat($DateOfPurchase); if($DateOfCommission != '')
$DOCommission= $this->getDateformat($DateOfCommission); {
$AssetStatus = $this->input->post('AssetStatus'); $DOPurchase = $this->getDateformat($DateOfPurchase);
}
if($DateOfPurchase != '')
{
$DOCommission= $this->getDateformat($DateOfCommission);
}
$AssetStatus = $this->input->post('AssetStatus');
$Remarks = $this->input->post('Remarks'); $Remarks = $this->input->post('Remarks');
$PONO = $this->input->post('PONO'); $PONO = $this->input->post('PONO');
$lineitem = $this->input->post('lineitem'); $lineitem = $this->input->post('lineitem');
@ -265,12 +269,13 @@ class assetdetails extends BaseController
/** /**
* This function is used load user edit information * This function is used load user edit information
* @param number $userId : Optional : This is user id * @param number $userId : Optional : This is user id
*/
function ech(){ /*function ech(){
echo $this->input->post('Asset_Code'); echo $this->input->post('Asset_Code');
}*/ }*/
function editOldasset($AssetCode = '',$PO='') function editOldasset($AssetCode = '',$PO='')
{ {
@ -300,6 +305,7 @@ class assetdetails extends BaseController
$this->loadViews("editOldasset", $this->global, $data,NULL); $this->loadViews("editOldasset", $this->global, $data,NULL);
} }
/** /**
* This function is used to edit the user information * This function is used to edit the user information
@ -340,9 +346,17 @@ class assetdetails extends BaseController
// $DateOfPurchase = $DateOfPurchase ->format('d-m-y'); // $DateOfPurchase = $DateOfPurchase ->format('d-m-y');
$DateOfCommission = $this->input->post('DateOfCommission'); $DateOfCommission = $this->input->post('DateOfCommission');
$UpdatedBy = $this->session->userdata('userId'); $UpdatedBy = $this->session->userdata('userId');
$AssetValue = $this->input->post('Assetvalue'); $Assetvalue = $this->input->post('Assetvalue');
$DOPurchase = $this->getDateformat($DateOfPurchase); if($DateOfCommission != '')
$DOCommission= $this->getDateformat($DateOfCommission); {
$DOPurchase = $this->getDateformat($DateOfPurchase);
}
if($DateOfPurchase != '')
{
$DOCommission= $this->getDateformat($DateOfCommission);
}
$AssetStatus = $this->input->post('AssetStatus'); $AssetStatus = $this->input->post('AssetStatus');
$Remarks = $this->input->post('Remarks'); $Remarks = $this->input->post('Remarks');
$PONO = $this->input->post('PONO'); $PONO = $this->input->post('PONO');
@ -364,7 +378,7 @@ class assetdetails extends BaseController
$asset = array(); $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,'PONO'=>$PONO,'POLineItem'=>$lineitem,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity); $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(); //print_r($asset);die();
@ -388,7 +402,7 @@ class assetdetails extends BaseController
function getDateformat($Val) function getDateformat($Val)
{ {
$date = new DateTime($Val); $date = new DateTime($Val);
$retDate = $date->format('d-m-y H:i:s'); $retDate = $date->format('Y-m-d H:i:s');
return $retDate; return $retDate;
} }

View File

@ -15,7 +15,7 @@ class assetdetails_model extends CI_Model
$this->db->select('asd.*,dep.DepartmentName,sup.SupplierName'); $this->db->select('asd.*,dep.DepartmentName,sup.SupplierName');
$this->db->from('T_Asset_Details asd'); $this->db->from('T_Asset_Details asd');
$this->db->join('T_DepartmentDetails dep', ' dep.DEPCode = asd.DEPCode','left'); $this->db->join('T_DepartmentDetails dep', ' dep.DEPCode = asd.DEPCode','left');
$this->db->join ('T_SupplierDetailsN sup','sup.SupplierID = asd.SupplierCode'); $this->db->join ('T_SupplierDetailsN sup','sup.SupplierID = asd.SupplierCode','left');
$query = $this->db->get(); $query = $this->db->get();
@ -222,7 +222,7 @@ function addNewasset($asset)
$query = $this->db->get(); $query = $this->db->get();
// print_r($this->db->last_query()); //print_r($this->db->last_query());
return $query->result(); return $query->result();
} }
function editasset($asset, $Asset_Code) function editasset($asset, $Asset_Code)

View File

@ -234,7 +234,7 @@ $("#DeliveryDate").datepicker({
<b> <b>
<span for="DeliveryDate">Delivery Date</span> <span for="DeliveryDate">Delivery Date</span>
</b> </b>
<input id="DeliveryDate" name="DeliveryDate" onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo isset($_POST['DeliveryDate']) ? $_POST['DeliveryDate'] : '' ?>"> <input id="DeliveryDate" readonly name="DeliveryDate" onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo isset($_POST['DeliveryDate']) ? $_POST['DeliveryDate'] : '' ?>">
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">

View File

@ -14,6 +14,7 @@ $AssetStatus = '';
$IsActive =''; $IsActive ='';
$Remarks = ''; $Remarks = '';
$DepartmentName =''; $DepartmentName ='';
$Department ='';
$SupplierCode = ''; $SupplierCode = '';
$MaterialCode = ''; $MaterialCode = '';
$PONO = ''; $PONO = '';
@ -26,22 +27,23 @@ if(!empty($assetList))
{ {
foreach ($assetList as $Asset) foreach ($assetList as $Asset)
{ {
//print_r($Asset);die();
$AssetCode = $Asset->AssetCode; $AssetCode = $Asset->AssetCode;
$AssetName = $Asset->AssetName; $AssetName = $Asset->AssetName;
$Description = $Asset->Description; $Description = $Asset->Description;
$Department = $Asset->DepartmentName ; $Department = $Asset->DEPCode;
$DepartmentName = $Asset->DepartmentName; $DepartmentName = $Asset->DepartmentName;
$Location = $Asset->Location; $Location = $Asset->Location;
$User = $Asset->UserName; $User = $Asset->UserName;
$SupplierName = $Asset->SupplierName; $SupplierName = $Asset->SupplierName;
$SupplierCode = $Asset->SupplierCode; $SupplierCode = $Asset->SupplierCode;
$DateOfPurchase = $Asset->DateOfPurchase; $DateOfPurchase = $Asset->DateOfPurchase;//print_r($Asset->DateOfPurchase);
$PODate = new DateTime($DateOfPurchase); $PODate = new DateTime($DateOfPurchase);
$DateOfPurchase = $PODate->format('Y-m-d'); $DateOfPurchase = $PODate->format('Y-m-d');
$DateOfCommission = $Asset->DateOfCommison; //print_r($Asset->DateOfCommison);
$assetDate = new DateTime($DateOfCommison); //$assetDate = new DateTime($DateOfCommison);
$DateOfCommison = $assetDate->format('Y-m-d'); $DateOfCommission= new DateTime($Asset->DateOfCommison, new DateTimeZone('Asia/Kolkata'));
$DateOfCommison = $DateOfCommission->format('Y-m-d');
$AssetValue = $Asset->AssetValue; $AssetValue = $Asset->AssetValue;
$AssetStatus = $Asset->AssetStatus; $AssetStatus = $Asset->AssetStatus;
$MaterialCode = $Asset->MaterialCode; $MaterialCode = $Asset->MaterialCode;
@ -50,10 +52,10 @@ if(!empty($assetList))
$Quantity = $Asset->Quantity; $Quantity = $Asset->Quantity;
$MaterialName = $Asset->MaterialName; $MaterialName = $Asset->MaterialName;
$UOM = $Asset->UOM; $UOM = $Asset->UOM;
$DeliveryDate = $Asset->DeliveryDate; $DDate = new DateTime($Asset->DeliveryDate, new DateTimeZone('Asia/Kolkata'));
$PODelivery = new DateTime($DeliveryDate); //$PODelivery = new DateTime($DeliveryDate);//print_r($Asset->DeliveryDate);
$DeliveryDate = $PODelivery ->format('Y-m-d'); $DeliveryDate = $DDate ->format('Y-m-d');
//print_r($DateOfPurchase);print_r($DateOfCommison);print_r($DeliveryDate);
$Remarks = $Asset->Remarks; $Remarks = $Asset->Remarks;
$chk = $Asset->IsActive; $chk = $Asset->IsActive;
@ -71,11 +73,11 @@ if(!empty($assetList))
$dtpurchase = new DateTime($DateOfPurchase); $dtpurchase = new DateTime($DateOfPurchase);
$DOPurchase = $dtpurchase ->format('Y-m-d'); $DOPurchase = $dtpurchase ->format('Y-m-d');
} }
if($DateOfCommission != '') // if($DateOfCommission != '')
{ // {
$dtCommission = new DateTime($DateOfCommission); // $dtCommission = new DateTime($DateOfCommission);
$DOCommission = $dtCommission ->format('Y-m-d'); // $DOCommission = $dtCommission ->format('Y-m-d');
} // }
} }
} }
@ -291,10 +293,10 @@ $("#DeliveryDate").datepicker({
<div class="form-group"> <div class="form-group">
<input type="hidden" name="AssetDept" id="depcode"> <input type="hidden" name="AssetDept" id="depcode" value="<?php echo $Department?>">
<b> <b>
<span for="AssetDept">Asset Department</span></b> <span for="AssetDept">Asset Department</span></b>
<input type="text" class="form-control required" value="<?php echo $Department;?>" id="AssetDept" readonly name="" value=""> <input type="text" class="form-control required" value="<?php echo $DepartmentName;?>" id="AssetDept" readonly>
</div> </div>
@ -312,15 +314,15 @@ $("#DeliveryDate").datepicker({
<div class="form-group"> <div class="form-group">
<b> <b>
<span for="DateOfPurchase">Supplier Name</span></b> <span for="DateOfPurchase">Supplier Name</span></b>
<input type="hidden" name="SupplierName" id="SupID"> <input type="hidden" name="SupplierName" id="SupID" value="<?php echo $SupplierCode;?>">
<input id="SupplierName" required name="" readonly onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo $SupplierName ?>"> <input id="SupplierName" readonly onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo $SupplierName; ?>">
</div> </div>
</div> </div>
<div class="col-md-3" style="padding:0px;"> <div class="col-md-3" style="padding:0px;">
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group"><b> <div class="form-group"><b>
<span for="DeliveryDate">Delivery Date</span></b> <span for="DeliveryDate">Delivery Date</span></b>
<input id="DeliveryDate" required name="DeliveryDate" onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo $DeliveryDate;?>"> <input id="DeliveryDate" readonly name="DeliveryDate" maxlength="10" class="form-control" value= "<?php echo $DeliveryDate;?>">
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
@ -491,13 +493,14 @@ $("#DeliveryDate").datepicker({
$('#DeliveryDate').val(item.DeliveryDate); $('#DeliveryDate').val(item.DeliveryDate);
$('#SupplierName').val(item.SupplierName); $('#SupplierName').val(item.SupplierName);
$('#SupID').val(item.SupplierID); $('#SupID').val(item.SupplierID);
//alert(item.SupplierID);
$('#MaterialCode').val(item.MaterialCode); $('#MaterialCode').val(item.MaterialCode);
$('#UOM').val(item.UOM); $('#UOM').val(item.UOM);
$('#Quantity').val(item.Quantity); $('#Quantity').val(item.Quantity);
$('#depcode').val(item.Departmentcode); $('#depcode').val(item.Departmentcode);
$('#AssetDept').val(item.DepartmentName); $('#AssetDept').val(item.DepartmentName);
$('#PODescription').val(item.MaterialName); $('#PODescription').val(item.MaterialName);
//alert(item.TotalValue); //salert(item.TotalValue);
$('#Assetvalue').val(item.TotalValue); $('#Assetvalue').val(item.TotalValue);
var date = new Date(item.DeliveryDate); var date = new Date(item.DeliveryDate);