From 83e3d5b58a74265001ae08bc494a2bf496e35a54 Mon Sep 17 00:00:00 2001 From: venbatechnologies Date: Mon, 24 Jul 2017 12:53:46 +0530 Subject: [PATCH] ASSET DETAILS --- application/controllers/assetdetails.php | 35 +++- application/models/assetdetails_model.php | 30 +++- application/views/addasset.php | 205 +++++++++++++++------- application/views/assetListing.php | 4 +- application/views/editOldasset.php | 122 +++++++------ 5 files changed, 267 insertions(+), 129 deletions(-) diff --git a/application/controllers/assetdetails.php b/application/controllers/assetdetails.php index 1b7d1761..87300668 100755 --- a/application/controllers/assetdetails.php +++ b/application/controllers/assetdetails.php @@ -65,13 +65,30 @@ class assetdetails extends BaseController } - function getpo() + function getpodetails() { - $po = $this->input->post('PONO'); - $data = $this->assetdetails_model->getpo($po); + $PO= $this->input->post('PONO'); + + $data = $this->assetdetails_model->getpodetails($PO); + //print_r($data); - echo json_encode($data); - die(); + $HTML = ""; + if(count($data) > 0) + { + for ($j = 0; $j < count($data); $j++) + { + $Code = $data[$j]->LineItemNo; + $Name = $data[$j]->MaterialCode; + + + + $HTML .=""; + } + } + //echo $HTML; + die(json_encode(array($HTML))); + //echo json_encode($data); + //die(); } function getline() @@ -226,7 +243,7 @@ class assetdetails extends BaseController $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(); + //print_r($asset);die(); $result = $this->assetdetails_model->addNewasset($asset); // print_r($result);die(); if($result > 0) @@ -314,11 +331,13 @@ class assetdetails extends BaseController $Asset_Code = $this->input->post('AssetCode'); $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'); $DateOfPurchase = $this->input->post('DateOfPurchase'); + + // $DateOfPurchase = $DateOfPurchase ->format('d-m-y'); $DateOfCommission = $this->input->post('DateOfCommission'); $UpdatedBy = $this->session->userdata('userId'); $AssetValue = $this->input->post('Assetvalue'); @@ -369,7 +388,7 @@ class assetdetails extends BaseController function getDateformat($Val) { $date = new DateTime($Val); - $retDate = $date->format('Y-m-d H:i:s'); + $retDate = $date->format('d-m-y H:i:s'); return $retDate; } diff --git a/application/models/assetdetails_model.php b/application/models/assetdetails_model.php index a17e977e..eb86ce78 100755 --- a/application/models/assetdetails_model.php +++ b/application/models/assetdetails_model.php @@ -16,6 +16,7 @@ class assetdetails_model extends CI_Model $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(); @@ -51,7 +52,7 @@ class assetdetails_model extends CI_Model return $query->result(); } - function getPO($PO){ + function getpodetails($PO){ $this->db->distinct(); @@ -68,9 +69,24 @@ class assetdetails_model extends CI_Model return $query->result(); } + function getPO($PO) + { + $this->db->distinct(); + $this->db->select(' POM.PONO,DeliveryDate,PODate,sup.SupplierName,POM.SupplierID'); + $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->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POL.Quantity,POM.POType,re.TotalValue,req.ReqNo,emp.firstname,emp.Departmentcode,dep.DepartmentName,sup.SupplierName,POM.DeliveryDate,POM.PODate,POM.SupplierID'); $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'); @@ -78,6 +94,7 @@ class assetdetails_model extends CI_Model $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->join('T_SupplierDetailsN sup','sup.SupplierID = POM.SupplierID','left'); $this->db->where('POL.LineItemNo',$line); $query = $this->db->get(); @@ -87,7 +104,7 @@ class assetdetails_model extends CI_Model } 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->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,ser.TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode,sup.SupplierName,POM.DeliveryDate,POM.PODate,POM.SupplierID'); $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'); @@ -95,6 +112,7 @@ class assetdetails_model extends CI_Model $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->join('T_SupplierDetailsN sup','sup.SupplierID = POM.SupplierID','left'); $this->db->where('POL.LineItemNo',$line); $query = $this->db->get(); @@ -103,7 +121,7 @@ class assetdetails_model extends CI_Model 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->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,ser.TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode,sup.SupplierName,,POM.DeliveryDate,POM.PODate,POM.SupplierID'); $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'); @@ -111,6 +129,7 @@ class assetdetails_model extends CI_Model $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->join('T_SupplierDetailsN sup','sup.SupplierID = POM.SupplierID','left'); $this->db->where('POL.LineItemNo',$line); $query = $this->db->get(); @@ -120,7 +139,7 @@ class assetdetails_model extends CI_Model } 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->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,sup.SupplierName,POM.DeliveryDate,POM.PODate,POM.SupplierID'); $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'); @@ -129,6 +148,7 @@ class assetdetails_model extends CI_Model $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->join('T_SupplierDetailsN sup','sup.SupplierID = POM.SupplierID','left'); $this->db->where('POL.LineItemNo',$line); $query = $this->db->get(); diff --git a/application/views/addasset.php b/application/views/addasset.php index 95f4d68b..261a2231 100755 --- a/application/views/addasset.php +++ b/application/views/addasset.php @@ -83,16 +83,16 @@ $("#DeliveryDate").datepicker({
-
- Asset Name - +
+ Asset Name * +
- - Asset Description + + Asset Description*
@@ -101,7 +101,8 @@ $("#DeliveryDate").datepicker({
- Asset User + Asset User + *
@@ -109,8 +110,9 @@ $("#DeliveryDate").datepicker({
- - Asset Location + + Asset Location + *
@@ -120,11 +122,10 @@ $("#DeliveryDate").datepicker({
-
- Purchase Order Number - - +
+ select Material Code - - +
- - Material Code + + Material Code
@@ -172,16 +174,16 @@ $("#DeliveryDate").datepicker({
- - UOM + + UOM
-
- Quantity +
+ Quantity
@@ -189,8 +191,8 @@ $("#DeliveryDate").datepicker({
- - Description + + Description
@@ -202,8 +204,8 @@ $("#DeliveryDate").datepicker({
- - Asset Department + + Asset Department
@@ -212,14 +214,16 @@ $("#DeliveryDate").datepicker({
- Purchase Date - + + Purchase Date +
- Supplier Name + + Supplier Name
@@ -227,13 +231,15 @@ $("#DeliveryDate").datepicker({
+ Delivery Date - + +
-
- Date Of Commission +
+ Date Of Commission*
@@ -245,17 +251,20 @@ $("#DeliveryDate").datepicker({
+ Asset Value - + +
- Asset Status - +
- Remarks + + Remarks
@@ -295,7 +305,7 @@ $("#DeliveryDate").datepicker({
@@ -342,39 +352,37 @@ $("#DeliveryDate").datepicker({ $('#PONO').on('change',function(){ - - var PONO = $(this).val(); + var PONO = $(this).val(); + // alert(PONO); if(PONO){ + + $.ajax({ type:'POST', - url:"assetdetails/getpo", + url:"assetdetails/getpodetails", data:'PONO='+PONO, + dataType: 'json', success:function(data){ - // alert(data); - var line =''; - + //alert(data); + + var line =''; $('#SelectMaterialCode').empty(); - - $.each(JSON.parse(data), function (i, item) { - //alert(item.LineItemNo); - line =''; - line +=''; + //alert('before'); + $.each(data, function (i, item) { + //alert(item); + + //line =''; + //line +=''; //$('#DeliveryDate').val(item.DeliveryDate); + line+=item; + + - $('#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').append(line); }); @@ -382,6 +390,7 @@ var date = new Date(item.DeliveryDate); } }); } + }); @@ -398,13 +407,18 @@ var date = new Date(item.DeliveryDate); url:"assetdetails/getline", data:'line='+line, success:function(data){ - //alert(data); + // alert(data); var id = $('#SelectMaterialCode').val(); $.each(JSON.parse(data), function (i, item) { if(id == item.LineItemNo){ // alert(item.MaterialCode); - //alert(item.Departmentcode); + // alert(item.DeliveryDate); + // alert(item.DateOfPurchase); + $('#DateOfPurchase').val(item.PODate); + $('#DeliveryDate').val(item.DeliveryDate); + $('#SupplierName').val(item.SupplierName); + $('#SupID').val(item.SupplierID); $('#MaterialCode').val(item.MaterialCode); $('#UOM').val(item.UOM); $('#Quantity').val(item.Quantity); @@ -414,6 +428,13 @@ var date = new Date(item.DeliveryDate); //alert(item.TotalValue); $('#Assetvalue').val(item.TotalValue); + 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); } @@ -430,4 +451,66 @@ var date = new Date(item.DeliveryDate); }); + + \ No newline at end of file diff --git a/application/views/assetListing.php b/application/views/assetListing.php index f8ff559c..f64655ff 100755 --- a/application/views/assetListing.php +++ b/application/views/assetListing.php @@ -29,7 +29,7 @@ Location Asset User Supplier Name - Date Of Purchase + Received Date Asset Value Asset Status @@ -44,7 +44,7 @@ { ?> - AssetCode ?> + AssetCode, 5) ?> AssetName ?> Description ?> DepartmentName ?> diff --git a/application/views/editOldasset.php b/application/views/editOldasset.php index ef51c2f1..099ce41d 100755 --- a/application/views/editOldasset.php +++ b/application/views/editOldasset.php @@ -7,7 +7,7 @@ $Department = ''; $Location = ''; $User = ''; $SupplierName = ''; -$DOPurchase = ''; +$DateOfPurchase = ''; $DateOfCommison = ''; $AssetValue = ''; $AssetStatus = ''; @@ -139,13 +139,13 @@ $("#DeliveryDate").datepicker({

-
Siddharth Industries - Edit Asset Details
+
Siddharth Industries - Edit Asset Details-


@@ -165,9 +165,9 @@ $("#DeliveryDate").datepicker({
- + Asset Name - + @@ -175,8 +175,8 @@ $("#DeliveryDate").datepicker({
- - Asset Description + + Asset Description @@ -185,8 +185,8 @@ $("#DeliveryDate").datepicker({
- - Asset User + + Asset User
@@ -194,8 +194,8 @@ $("#DeliveryDate").datepicker({
- - Asset Location + + Asset Location @@ -207,7 +207,8 @@ $("#DeliveryDate").datepicker({
- Purchase Order Number + + Purchase Order Number @@ -247,8 +250,8 @@ $("#DeliveryDate").datepicker({
- - Material Code + + Material Code
@@ -256,15 +259,15 @@ $("#DeliveryDate").datepicker({
- - UOM + + UOM
- - Quantity + + Quantity
@@ -275,8 +278,8 @@ $("#DeliveryDate").datepicker({
- - Description + + Description
@@ -289,7 +292,8 @@ $("#DeliveryDate").datepicker({
- Asset Department + + Asset Department
@@ -298,28 +302,30 @@ $("#DeliveryDate").datepicker({
- Purchase Date + + Purchase Date
- Supplier Name + + Supplier Name
-
- Delivery Date +
+ Delivery Date
-
- Date Of Commission +
+ Date Of Commission
@@ -330,16 +336,16 @@ $("#DeliveryDate").datepicker({
-
+
Asset Value - +
-
- Asset Status +
+ Asset Status
@@ -421,37 +427,35 @@ $("#DeliveryDate").datepicker({ $('#PONO').on('change',function(){ var PONO = $(this).val(); + // alert(PONO); if(PONO){ + //alert("INSIDE IF"); $.ajax({ type:'POST', - url:"assetdetails/getpo", + url:"assetdetails/getpodetails", data:'PONO='+PONO, + dataType: 'json', success:function(data){ - // alert(data); - var line =''; - + //alert(data); + + var line =''; $('#SelectMaterialCode').empty(); - - $.each(JSON.parse(data), function (i, item) { - //alert(item.LineItemNo); - line =''; - line +=''; + //alert('before'); + $.each(data, function (i, item) { + //alert(item); + + //line =''; + //line +=''; //$('#DeliveryDate').val(item.DeliveryDate); + line+=item; + + - $('#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').append(line); }); @@ -481,7 +485,12 @@ var date = new Date(item.DeliveryDate); $.each(JSON.parse(data), function (i, item) { if(id == item.LineItemNo){ // alert(item.MaterialCode); - //alert(item.Departmentcode); + // alert(item.DeliveryDate); + // alert(item.DateOfPurchase); + $('#DateOfPurchase').val(item.PODate); + $('#DeliveryDate').val(item.DeliveryDate); + $('#SupplierName').val(item.SupplierName); + $('#SupID').val(item.SupplierID); $('#MaterialCode').val(item.MaterialCode); $('#UOM').val(item.UOM); $('#Quantity').val(item.Quantity); @@ -491,6 +500,13 @@ var date = new Date(item.DeliveryDate); //alert(item.TotalValue); $('#Assetvalue').val(item.TotalValue); + 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); }