changes in master details-1 vadivel J 21-11-2024
This commit is contained in:
parent
bfa496329f
commit
36a8ac8ccc
@ -81,8 +81,10 @@ $routes->get('assetListing', 'Assetdetails::assetListing');
|
||||
$routes->get('addasset', 'Assetdetails::addasset');
|
||||
$routes->post('assetdetails/getpodetails','Assetdetails::getpodetails');
|
||||
$routes->post('assetdetails/getline','Assetdetails::getline');
|
||||
|
||||
$routes->get('assetdetails/editOldasset', 'Assetdetails::editOldasset');
|
||||
$routes->get('assetdetails/deleteAsset', 'Assetdetails::deleteAsset');
|
||||
$routes->get('assetdetails/reActivateAsset', 'Assetdetails::reActivateAsset');
|
||||
|
||||
//uncommenting addNewAsset
|
||||
$routes->post('addNewasset', 'Assetdetails::addNewasset');
|
||||
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'editOldasset', 'Assetdetails::editasset');
|
||||
|
||||
@ -8,6 +8,7 @@ use App\Models\Assetdetails_model;
|
||||
use CodeIgniter\Validation\Exceptions\ValidationException;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use DateTime;
|
||||
/**
|
||||
* Module : Asset
|
||||
* Assetdetails Class to control all asset related operations.
|
||||
@ -316,6 +317,32 @@ class Assetdetails extends BaseController
|
||||
$this->loadViews("editOldasset", $this->global, $data, NULL);
|
||||
}
|
||||
|
||||
function deleteAsset(){
|
||||
|
||||
$assetCode = $this->request->getGet('AssetID');
|
||||
$updatedBy = $this->session->get('userId');
|
||||
$updatedDate = new DateTime();
|
||||
$updatedDate = $updatedDate->format('Y-m-d H:i:s');
|
||||
$assetInfo = array('IsActive' => 0 , 'UpdatedDate' => $updatedDate , 'UpdatedBy' => $updatedBy );
|
||||
$result = $this->assetdetails_model->deleteAsset($assetCode , $assetInfo);
|
||||
|
||||
return redirect()->route('assetListing');
|
||||
|
||||
}
|
||||
|
||||
function reActivateAsset(){
|
||||
|
||||
$assetCode = $this->request->getGet('AssetID');
|
||||
$updatedBy = $this->session->get('userId');
|
||||
$updatedDate = new DateTime();
|
||||
$updatedDate = $updatedDate->format('Y-m-d H:i:s');
|
||||
$assetInfo = array('IsActive' => 1 , 'UpdatedDate' => $updatedDate , 'UpdatedBy' => $updatedBy );
|
||||
$result = $this->assetdetails_model->deleteAsset($assetCode , $assetInfo);
|
||||
|
||||
return redirect()->route('assetListing');
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function is used to edit the user information
|
||||
|
||||
@ -137,11 +137,8 @@ class CostCenter extends BaseController
|
||||
function checkCostCenter(){
|
||||
$data = $this->request->getPost();
|
||||
$result = $this->costcenter_model->checkCostCenter( $data['CostCenterName']);
|
||||
if(empty($result)){
|
||||
echo false;
|
||||
}else{
|
||||
echo true;
|
||||
}
|
||||
|
||||
return $this->response->setJSON($result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -473,11 +473,7 @@ class Supplier extends BaseController
|
||||
|
||||
$data = $this->request->getPost();
|
||||
$message = $this->supplier_model->checkTransporter($data['transportername']);
|
||||
if(!empty($message)){
|
||||
echo true;
|
||||
}else{
|
||||
echo false;
|
||||
}
|
||||
return $this->response->setJSON($message);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -245,6 +245,27 @@ class Assetdetails_model extends Model
|
||||
return $count;
|
||||
}
|
||||
|
||||
function deleteAsset ($assetCode , $assetInfo){
|
||||
|
||||
$this->db->table('t_asset_details')
|
||||
->where('AssetCode', $assetCode)
|
||||
->update($assetInfo);
|
||||
$count = $this->db->affectedRows();
|
||||
return $count;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function reActivateAsset ($assetCode , $assetInfo){
|
||||
|
||||
$this->db->table('t_asset_details')
|
||||
->where('AssetCode', $assetCode)
|
||||
->update($assetInfo);
|
||||
$count = $this->db->affectedRows();
|
||||
return $count;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function viewasset($asset, $Asset_Code)
|
||||
{
|
||||
|
||||
@ -431,7 +431,7 @@ where Dept.DEPCode not in
|
||||
|
||||
function checkCostCenter($CostCenterName){
|
||||
$builder = $this->db->table('t_costcenter_master')
|
||||
->where('IsActive',1)
|
||||
->select('CostCenterName,IsActive')
|
||||
->where('CostCenterName', $CostCenterName);
|
||||
$query = $builder->get();
|
||||
|
||||
|
||||
@ -292,7 +292,7 @@ class Rawmaterialdetails_model extends Model
|
||||
|
||||
|
||||
$builder = $this->db->table('t_materialmaster')
|
||||
->select('MaterialCode,MaterialName,MaterialType,Category')
|
||||
->select('MaterialCode,MaterialName,MaterialType,Category,IsActive')
|
||||
->like('REPLACE(MaterialName, " ", "")', $material);
|
||||
|
||||
$query = $builder->get();
|
||||
|
||||
@ -55,8 +55,7 @@ class Supplier_model extends Model
|
||||
|
||||
function checkTransporter($transporterName){
|
||||
$builder = $this->db->table('t_transporter')
|
||||
->where('name', $transporterName)
|
||||
->where('isactive',1);
|
||||
->where('name', $transporterName);
|
||||
$query = $builder->get();
|
||||
|
||||
return $query->getResult();
|
||||
|
||||
@ -308,10 +308,15 @@
|
||||
success: function(data) {
|
||||
var count = data.length;
|
||||
//alert(count);
|
||||
|
||||
console.log(data[0].IsActive);
|
||||
if (count >= 1) {
|
||||
$('#loader').hide();
|
||||
if(data[0].IsActive == 1){
|
||||
alert('Material name already existed ! ');
|
||||
}else{
|
||||
alert('Material name already existing in the deleted section.!!');
|
||||
}
|
||||
|
||||
|
||||
var related_name = "";
|
||||
$.each(data, function(i, obj) {
|
||||
|
||||
@ -268,11 +268,15 @@
|
||||
id: supplier
|
||||
},
|
||||
success: function(data) {
|
||||
var count = data.length;
|
||||
console.log(data);
|
||||
var count = data?data.length:0;
|
||||
if (count >= 1) {
|
||||
$('#loader').hide();
|
||||
alert('supplier already existed ! ');
|
||||
if(data[0].IsActive == 1){
|
||||
alert('supplier already existed ! ');
|
||||
}else{
|
||||
alert('supplier already existing in the deleted section..!! ');
|
||||
}
|
||||
|
||||
var related_supplier = "";
|
||||
$.each(data, function(i, obj) {
|
||||
related_supplier += obj.SupplierID + " - " + obj.SupplierName + " - " + obj.Address + "\n";
|
||||
|
||||
@ -71,6 +71,19 @@
|
||||
|
||||
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
|
||||
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
|
||||
|
||||
<div style="margin-left:auto">
|
||||
<div class="form-check" style="margin-right: 25px;">
|
||||
<input class="form-check-input" type="checkbox" id="showArchiveId" name="showArchive"
|
||||
value="1" onchange="showArchiveList()" style="width: 18px; height: 18px;">
|
||||
<label class="form-check-label" for="showArchiveId" style="font-size: 1rem; margin-left: 8px;">
|
||||
Show Archive
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="error" id="error"></div>
|
||||
</form>
|
||||
<div class="card-body" style="overflow-x:scroll;">
|
||||
@ -89,6 +102,7 @@
|
||||
<th>Received Date</th>
|
||||
<th>Asset Value</th>
|
||||
<th>Asset Status</th>
|
||||
<th>Action</th>
|
||||
|
||||
|
||||
</tr>
|
||||
@ -98,14 +112,23 @@
|
||||
if (!empty($userRecords)) {
|
||||
foreach ($userRecords as $record) {
|
||||
?>
|
||||
<tr>
|
||||
<tr
|
||||
class="<?php if($record->IsActive == 0){echo"deactivatedRow";}?>"
|
||||
style="<?php if($record->IsActive == 0){echo"display:none";}?>"
|
||||
>
|
||||
|
||||
<?php if (date('d-m-Y', strtotime($record->CreatedDt)) == "30-11--0001") {
|
||||
$cdate = '00-00-0000';
|
||||
} else {
|
||||
$cdate = date('d-m-Y', strtotime($record->CreatedDt));
|
||||
} ?>
|
||||
<td><?php echo $cdate; ?></td>
|
||||
<td><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 substr($record->AssetCode, 5) ?>
|
||||
<td>
|
||||
<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 substr($record->AssetCode, 5) ?>
|
||||
</a>
|
||||
</td>
|
||||
<td><?php echo $record->AssetName ?></td>
|
||||
<td><?php echo $record->Description ?></td>
|
||||
<td><?php echo $record->DepartmentName ?></td>
|
||||
@ -118,6 +141,34 @@
|
||||
echo $DOPurchase ?></td>
|
||||
<td><?php echo number_format($record->AssetValue, 2); ?></td>
|
||||
<td><?php echo $record->AssetStatus ?></td>
|
||||
<td>
|
||||
<?php if ($record->IsActive == 0) { ?>
|
||||
|
||||
<a
|
||||
onclick ="confirmReActivatingAsset()"
|
||||
href="<?php echo base_url() . 'assetdetails/reActivateAsset/?AssetID=' . $record->AssetCode ?>"
|
||||
data-toggle="tooltip" title="<?php echo $record->AssetCode; ?> - Click here to Re-Activate Asset Details">
|
||||
<i class="fa fa-key" ></i>
|
||||
</a>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<a
|
||||
onclick ="confirmDeleteAsset()"
|
||||
href="<?php echo base_url() . 'assetdetails/editOldasset/?AssetID=' . $record->AssetCode ?>"
|
||||
data-toggle="tooltip" title="<?php echo $record->AssetCode; ?> - Click here to View Asset Details">
|
||||
<i class="fa fa-edit" ></i>
|
||||
</a>
|
||||
|
||||
<a href="<?php echo base_url() . 'assetdetails/deleteAsset/?AssetID=' . $record->AssetCode ?>"
|
||||
data-toggle="tooltip" title="<?php echo $record->AssetCode; ?> - Click here to Delete Asset Details">
|
||||
<i class="fa fa-trash" ></i>
|
||||
</a>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
<?php
|
||||
@ -126,7 +177,11 @@
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p>( Note :The entries count includes archived data... )</p>
|
||||
</div> <!-- end card body-->
|
||||
<br>
|
||||
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
@ -223,4 +278,32 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function showArchiveList() {
|
||||
let isChecked = $("#showArchiveId").prop('checked');
|
||||
|
||||
// Show or hide the rows based on checkbox status
|
||||
$(".deactivatedRow").each(function() {
|
||||
if (isChecked) {
|
||||
$(this).show();
|
||||
} else {
|
||||
$(this).hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
showArchiveList();
|
||||
});
|
||||
|
||||
function confirmReActivatingAsset(){
|
||||
|
||||
}
|
||||
|
||||
function confirmDeleteAsset(){
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -225,13 +225,19 @@
|
||||
data: {
|
||||
CostCenterName: $('#CostCenterName').val()
|
||||
},
|
||||
success: function (response) {
|
||||
success: function (data) {
|
||||
$('#loader').hide();
|
||||
let isactive =data[0].IsActive;
|
||||
|
||||
if (data && data.length > 0) {
|
||||
|
||||
if (response) {
|
||||
alert("Cost Center Name Already Exists..!!");
|
||||
if(isactive == 1){
|
||||
alert("Cost Center Name Exists..!!");
|
||||
}else{
|
||||
alert("Cost Center Name Existing in the deleted section ..!!");
|
||||
}
|
||||
$('#ccwizard').modal('hide');
|
||||
location.reload();
|
||||
|
||||
} else {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
|
||||
@ -458,8 +458,11 @@ if ($total <= $reorder) {
|
||||
|
||||
if (count >= 1) {
|
||||
$('#loader').hide();
|
||||
if(data[0].IsActive == 1){
|
||||
alert('Material name already existed ! ');
|
||||
|
||||
}else{
|
||||
alert('Material name already existing in the deleted section.!!');
|
||||
}
|
||||
var related_name = "";
|
||||
$.each(data, function(i, obj) {
|
||||
|
||||
|
||||
@ -582,7 +582,11 @@ if (!empty($supplier)) {
|
||||
var count = data.length;
|
||||
if (count >= 1) {
|
||||
$('#loader').hide();
|
||||
alert('supplier already existed ! ');
|
||||
if(data[0].IsActive == 1){
|
||||
alert('supplier already existed ! ');
|
||||
}else{
|
||||
alert('supplier already existing in the deleted section..!! ');
|
||||
}
|
||||
var related_supplier = "";
|
||||
$.each(data, function (i, obj) {
|
||||
related_supplier += obj.SupplierID + " - " + obj.SupplierName + " - " + obj.Address + "\n";
|
||||
|
||||
@ -141,7 +141,7 @@
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<a class="a_tag_link"
|
||||
<a class="a_tag_link"
|
||||
href="<?php echo base_url() . 'viewRawmaterial?RID=' . $record->MaterialCode . '&MType=' . $record->MaterialType . '&UOM=' . $record->UOM . '&date1=' . $date ?>"
|
||||
data-toggle="tooltip"
|
||||
title="<?php echo $record->MaterialCode; ?> - Click here to view Material details"><i class="fa fa-edit" style="color:#02a8b5;"></i>
|
||||
@ -151,7 +151,7 @@
|
||||
data-toggle="tooltip"
|
||||
title="<?= $record->MaterialCode ?> - Click here to delete material details"
|
||||
onclick="deleteMaterial('<?php echo $record->MaterialCode; ?>')"><i class="fa fa-trash" style="color:#02a8b5;"></i>
|
||||
</a>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -247,6 +247,9 @@
|
||||
});
|
||||
|
||||
$('#tempClick').click(function () {
|
||||
//loader is initiated
|
||||
$('#loader').show();
|
||||
|
||||
if ($('#transportername').val() === '') {
|
||||
alert('Please Enter the Transporter Name');
|
||||
return;
|
||||
@ -266,12 +269,15 @@
|
||||
data: {
|
||||
transportername
|
||||
},
|
||||
success: function (response) {
|
||||
console.log("response", response);
|
||||
if (response) {
|
||||
alert("Already Transporter with this Name Exists..!!");
|
||||
window.location.href = "transporterListing";
|
||||
return true;
|
||||
success: function (data) {
|
||||
|
||||
if (data && data.length > 0) {
|
||||
let isactive = data[0].isactive;
|
||||
if (isactive == 1 ) { alert(" Transporter with this Name Exists..!!"); }
|
||||
else { alert(" Transporter with this Name Existing in deleted section ..!!"); }
|
||||
|
||||
$('#transporterwizard').modal('hide');
|
||||
return;
|
||||
} else {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
@ -289,12 +295,22 @@
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
alert('An error occurred: ' + error);
|
||||
},
|
||||
complete: function () {
|
||||
//loader is stopped
|
||||
$('#loader').hide();
|
||||
console.log('second ajax call completed');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
alert('An error occurred inside Check transporterExsits: ' + error);
|
||||
},
|
||||
complete: function () {
|
||||
//loader is stopped
|
||||
$('#loader').hide();
|
||||
console.log('first ajax call completed')
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user