changes in master details -vadive j

This commit is contained in:
vadivel J 2024-11-19 16:44:29 +05:30
parent 360de67475
commit d5574c72f4
11 changed files with 382 additions and 77 deletions

View File

@ -50,7 +50,7 @@ $routes->post('addNewsupplier', 'Supplier::savesupplierdetails'); // update supp
$routes->post('supplierExist','Supplier::checksupplier');
$routes->get('exportsupplier','Supplier::exportsupplier'); // export supplier details
$routes->post('deletesupplier','Supplier::deletesupplier');
$routes->post('reActivateSupplier','Supplier::reActivateSupplier');
// Material Master Routes
@ -65,6 +65,8 @@ $routes->post('rawmaterialdetails/editRawmaterial', 'Rawmaterialdetails::editRaw
$routes->post('rawmaterialdetails/addMaterialCategories', 'Rawmaterialdetails::addMaterialCategories');
$routes->get('exportmaterial' , 'Rawmaterialdetails::exportmaterial');
$routes->get('rawmaterialdetailsautocomplete' , 'Rawmaterialdetails::autocomplete');
$routes->post('deleteMaterial', 'Rawmaterialdetails::deleteMaterial');
$routes->post('reActivateMaterial', 'Rawmaterialdetails::reActivateMaterial');
// Cost Center Routes
$routes->get('costListing', 'CostCenter::index');
@ -401,6 +403,7 @@ $routes->post('sales_invoice', 'Sales::sales_invoice');
$routes->get('transporterListing', 'Supplier::transporterListing');
$routes->post('fetchTransporterDetails', 'Supplier::fetchTransporterDetails');// for Ajax both add and edit....
$routes->get('deleteTransporter', 'Supplier::deleteTransporter');
$routes->get('reActivateTransporter', 'Supplier::reActivateTransporter');
//Factory Machine Master Routes

View File

@ -16,6 +16,8 @@ use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use PhpOffice\PhpSpreadsheet\Style\Alignment;
use DateTime;
/**
* Module : Material Master details
@ -73,6 +75,44 @@ class Rawmaterialdetails extends BaseController
$this->loadViews("rawmaterialListing", $this->global, $data, NULL);
}
private function get_current_date_time() {
$datetime = new DateTime();
return $datetime->format('Y-m-d H:i:s');
}
function deleteMaterial(){
$materialId = $this->request->getPost('id');
$updatedDate = $this->get_current_date_time();
$session = \Config\Services::session();
$userId = $session->get('userId');
$info=array('IsActive' => 0 , "UpdatedBy"=>$userId , "UpdatedDate" => $updatedDate ) ;
$updated=$this->rawmaterialdetails_model->deleteMaterial($materialId,$info);
if($updated){
echo"Deleted Material successfully..!!";
}else{
echo"Deleting Material unsuccessfull ..!!";
}
}
function reActivateMaterial(){
$materialId = $this->request->getPost('id');
$updatedDate = $this->get_current_date_time();
$session = \Config\Services::session();
$userId = $session->get('userId');
$info=array('IsActive' => 1 , "UpdatedBy"=>$userId , "UpdatedDate" => $updatedDate ) ;
$updated=$this->rawmaterialdetails_model->reActivateMaterial($materialId,$info);
if($updated){
echo"Re-Activated Material successfully..!!";
}else{
echo"Re-Activated Material unsuccessfull..!!";
}
}
function shortagematerialListing()
{

View File

@ -334,6 +334,19 @@ class Supplier extends BaseController
echo 'Succssfully deleted the Supplier ..!!';
}
function reActivateSupplier()
{
$Sid = $this->request->getPost('id');
$updatedDate = get_current_date_time();
$SupplierInfo = array('IsActive' => 1, 'updatedBy' => $this->session->get('userId'), 'Updatedon' => $updatedDate);
$result = $this->supplier_model->reActivateSupplier($Sid, $SupplierInfo);
echo 'Succssfully Re-activated the Supplier ..!!';
}
function exportsupplier()
{
@ -457,11 +470,14 @@ class Supplier extends BaseController
*/
function deleteTransporter($id = NULL)
{
$ID = $id ?? $_GET['id'];
if(!empty($ID)){
$updatedBy = $this->session->get('userId');
$message = $this->supplier_model->deleteTransporter($ID, $updatedBy);
$updatedDate = get_current_date_time();
$SupplierInfo = array('isactive' => 0, 'updated_by' => $this->session->get('userId'), 'updated_on' => $updatedDate);
$message = $this->supplier_model->deleteTransporter($ID, $SupplierInfo);
}else{
$message = "Transporter ID Not Avalable";
}
@ -469,4 +485,22 @@ class Supplier extends BaseController
return redirect()->route('transporterListing');
}
function reActivateTransporter($id = NULL)
{
$ID = $id ?? $_GET['id'];
if(!empty($ID)){
$updatedDate = get_current_date_time();
$SupplierInfo = array('isactive' => 1, 'updated_by' => $this->session->get('userId'), 'updated_on' => $updatedDate);
$message = $this->supplier_model->reActivateTransporter($ID, $SupplierInfo);
}else{
$message = "Transporter ID Not Avalable";
}
$this->session->setFlashdata('success', $message);
return redirect()->route('transporterListing');
}
}

View File

@ -25,6 +25,22 @@ class Rawmaterialdetails_model extends Model
return $result;
}
function deleteMaterial($materialId,$info){
$builder = $this->db->table('t_materialmaster')
->where('MaterialCode',$materialId)
->update($info);
$result = $this->db->affectedRows();
return $result;
}
function reActivateMaterial($materialId,$info){
$builder = $this->db->table('t_materialmaster')
->where('MaterialCode',$materialId)
->update($info);
$result = $this->db->affectedRows();
return $result;
}
function getUOM($UOM = '')
{
$ConfigID = 'C001';

View File

@ -44,6 +44,26 @@ class Supplier_model extends Model
}
function deleteTransporter($Sid, $SupplierInfo){
$builder = $this->db->table('t_transporter')
->where('id',$Sid)
->update($SupplierInfo);
return $this->db->affectedRows();
}
function reActivateTransporter($Sid, $SupplierInfo){
$builder = $this->db->table('t_transporter')
->where('id',$Sid)
->update($SupplierInfo);
return $this->db->affectedRows();
}
function getpayment($Configvalue = '')
{
$ConfigID = 'C009';
@ -212,14 +232,5 @@ class Supplier_model extends Model
return $aff_row;
}
function deleteTransporter($id,$UpdatedBy)
{
$this->db->table('t_transporter')
->where('id', $id)
->update(['isactive' => 0,'updated_by' => $UpdatedBy ]);
$aff_row = $this->db->affectedRows();
return $aff_row;
}
}

View File

@ -82,7 +82,6 @@
<th>Cost Center Code</th>
<th>Cost Center Name</th>
<th>Created By</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
@ -99,16 +98,11 @@
<td><?php echo $record->code ?></td>
<td><?php echo $record->CostCenterName ?></td>
<td><?php echo $record->FirstName ?></td>
<td><?php
$R = '';
$record->IsActive == 1 ? $R = 'ACTIVE' : $R = 'INACTIVE';
echo $R;
?></td>
<td>
<?php
if ($record->DeletedBy == '') {
?>
<a data-toggle="modal" href="#ccwizard" data-id="<?php echo $record->id; ?>" data-name="<?php echo $record->CostCenterName; ?>"><i class="fas fa-pencil-alt"></i></a>
<a data-toggle="modal" href="#ccwizard" data-id="<?php echo $record->id; ?>" data-name="<?php echo $record->CostCenterName; ?>"><i class="fas fa-edit"></i>&nbsp;&nbsp;</a>
<a href="<?php echo base_url() . 'deleteCostCenter?CostCode=' . $record->code; ?>"><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a>
<?php } ?>
</td>

View File

@ -111,7 +111,9 @@ if ($total <= $reorder) {
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Edit Material - <?php echo $MaterialCode; ?> Details</h4>
<a class="btn btn-secondary" href="<?php echo base_url(); ?>rawmaterialListing"><span class="bold">Back</span></a>
<button type="button" class="btn btn-secondary" onclick="history.back()">
<span class="bold">Cancel</span>
</button>
</div>
</div>
</div>
@ -284,7 +286,9 @@ if ($total <= $reorder) {
</div>
</div>
<div class="box-footer text-right">
<a href="<?php echo base_url() ?>rawmaterialListing" class="btn btn-secondary">Cancel</a>
<button type="button" class="btn btn-secondary" onclick="history.back()">
<span class="bold">Cancel</span>
</button>
<input type="submit" class="btn btn-success" value="Submit" />
</div>
</form>

View File

@ -283,7 +283,9 @@ if (!empty($supplier)) {
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Edit Supplier Details</h4>
<a class="btn btn-secondary" href="<?php echo base_url(); ?>supplierlisting"><span class="bold">Back</span></a>
<button type="button" class="btn btn-secondary" onclick="history.back()">
<span class="bold">Cancel</span>
</button>
</div>
</div>
</div>
@ -301,9 +303,7 @@ if (!empty($supplier)) {
<div class="col-md-6 text-left">
<legend style="margin-left:-10px;color: #4f7c97;">Supplier Information</legend>
</div>
<div class="col-md-6 text-right">
<input type="checkbox" id="isactive" <?php echo $IsActive; ?> name="isactive"> IsActive
</div>
</div>
<?php } ?>
<!-- Supplier Information -->
@ -456,6 +456,9 @@ if (!empty($supplier)) {
<div class="col-md-12">
<div class="form-group row text-right">
<div class="col-12">
<button type="button" class="btn btn-secondary" onclick="history.back()">
<span class="bold">Cancel</span>
</button>
<button type="submit" class="btn btn-info pull-right">Submit</button>
</div>
</div>
@ -533,25 +536,29 @@ if (!empty($supplier)) {
},
success: function(data) {
var count = data.length;
if (count > 2) {
if (count >= 1) {
$('#loader').hide();
alert('supplier already existed ! ');
var related_supplier = "";
$.each(data, function(i, obj) {
related_supplier += obj.SupplierID + " - " + obj.SupplierName + " - " + obj.Address + "\n";
});
alert("'" + suppliername + "' - related supplier are , " + " \n \n" + related_supplier);
alert("'" + suppliername + "' - supplier details are , " + " \n \n" + related_supplier);
$("#supplierName").val('');
$("#supplierName").focus();
} else {
$('#loader').hide();
//4Debug
// alert('This is New Supplier! ');
}
console.log(data);
//4Debug
//console.log(data);
},
error: function() {
error: function(error) {
$('#loader').hide();
// alert("Error Occur");
console.log("an error occur supplierExist")
//forDebugging
// alert("Error Occur");
console.error("an error occur supplierExist" , error)
}
});

View File

@ -75,14 +75,20 @@
<label for="toDate">To:</label>
<input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="showArchiveId" name="showArchive"
value=1 onchange="showArchiveList()">
<label class="form-check-label" for="showArchiveId">Show Archive</label>
</div>
<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="widzth: 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;">
@ -98,6 +104,7 @@
<th>Opening Stock</th>
<th>Material Category</th>
<th>HSN Code</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@ -116,18 +123,37 @@
} else {
$cdate = date('d-m-Y', strtotime($record->CreatedDate));
} ?>
<td style="width:8%;"><?php echo $cdate; ?></td>
<td style="width:9%;"><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"><?php echo $record->MaterialCode ?> </a></td>
<td style="width:12%;"><?php echo $record->MaterialName ?></td>
<td style="width:10%;"><?php echo $record->MaterialType ?></td>
<td style="width:7%;"><?php echo $record->UOM ?></td>
<td ><?php echo $cdate; ?></td>
<td ><?php echo $record->MaterialCode ?></td>
<td ><?php echo $record->MaterialName ?></td>
<td ><?php echo $record->MaterialType ?></td>
<td ><?php echo $record->UOM ?></td>
<?php if ($record->stock != null || '') { ?>
<td style="width:10%;"><?php echo $record->stock ?></td>
<td ><?php echo $record->stock ?></td>
<?php } else { ?>
<td style="width:10%;">0</td>
<td >0</td>
<?php } ?>
<td style="width:11%;"><?php echo $record->Category ?></td>
<td style="width:8%;"><?php echo $record->HSNCODE ?></td>
<td ><?php echo $record->Category ?></td>
<td ><?php echo $record->HSNCODE ?></td>
<td><?php if ($record->IsActive == 0) { ?>
<a style="cursor:pointer;" onclick="reActivateMaterial('<?php echo $record->MaterialCode; ?>')"><i class="fa fa-key" style="color:#02a8b5;"></i>&nbsp;&nbsp;&nbsp;</a>
<?php } else { ?>
<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>&nbsp;&nbsp;&nbsp;
</a>
<a style="cursor:pointer;"
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>&nbsp;&nbsp;&nbsp;
</a>
<?php } ?>
</td>
</tr>
<?php
}
@ -254,4 +280,73 @@
$(document).ready(function() {
showArchiveList();
});
function deleteMaterial(mid) {
var answer = confirm(" Do you want to delete the Material from the List?")
if (answer) {
$.ajax({
data: {
id: mid
},
type: "POST",
url: "<?php echo base_url();?>deleteMaterial",
success: function(data) {
if (data) {
alert(data);
location.reload();
}
},
error: function(xhr, status, error) {
console.error('AJAX Error:', error);
console.error('Status:', status);
console.error('Response:', xhr.responseText);
},
complete: function(xhr, status) {
console.log('AJAX call completed');
console.log('Status:', status);
}
});
}
}
function reActivateMaterial(sid) {
var answer = confirm(" Do you want to Re-Activate the Material from the List?")
if (answer) {
$.ajax({
data: {
id: sid
},
type: "POST",
url: "<?php echo base_url();?>reActivateMaterial",
success: function(data) {
if (data) {
alert(data);
location.reload();
}
},
error: function(xhr, status, error) {
// Handle errors
console.error('AJAX Error:', error); // Logs the actual error
console.error('Status:', status); // Logs the status like "timeout", "error", etc.
console.error('Response:', xhr.responseText); // Logs the server's response
},
complete: function(xhr, status) {
// Code to run after AJAX call is complete, regardless of success or error
console.log('AJAX call completed');
console.log('Status:', status);
// Hide loader or perform other clean-up actions
// $('#content').loader('hide'); // Uncomment if you have a loader plugin
}
});
}
}
</script>

View File

@ -75,16 +75,24 @@
<label for="toDate">To:</label>
<input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="showArchiveId" name="showArchive"
value=1 onchange="showArchiveList()">
<label class="form-check-label" for="showArchiveId">Show Archive</label>
</div>
<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;">
<table class="table dt-responsive nowrap w-100" id="datatable">
@ -120,15 +128,7 @@
} ?>
<td style="width:75px" align="left"><?php echo $cdate; ?></td>
<td>
<a class="a-tag-link"
href="<?= base_url() ?>viewsupplier?SID=<?= $record->SupplierID ?>&Payment=<?= $record->PaymentTerms ?>"
data-toggle="tooltip"
title="<?= $record->SupplierID ?> - Click here to view Supplier details"><?= $record->SupplierID ?>
</a>
</td>
<td><?php echo $record->SupplierID ?></td>
<td><?php echo $record->SupplierName ?></td>
<td><?php echo $record->Address ?></td>
<td><?php echo $record->ContactNumber ?></td>
@ -136,10 +136,23 @@
<td><?php echo $record->PAN ?></td>
<td><?php echo $record->GSTNO ?></td>
<td><?php echo $record->PaymentTerms ?></td>
<td><?php if ($record->IsActive == 0) {
echo "Deactived";
} else { ?>
<a onclick="deletesupplier('<?php echo $record->SupplierID; ?>')"><i class="fa fa-trash" style="color:#02a8b5;"></i>&nbsp;&nbsp;&nbsp;</a>
<td><?php if ($record->IsActive == 0) { ?>
<a style="cursor:pointer;" onclick="reActivateSupplier('<?php echo $record->SupplierID; ?>')"><i class="fa fa-key" style="color:#02a8b5;"></i>&nbsp;&nbsp;&nbsp;</a>
<?php } else { ?>
<a class="a-tag-link"
href="<?= base_url() ?>viewsupplier?SID=<?= $record->SupplierID ?>&Payment=<?= $record->PaymentTerms ?>"
data-toggle="tooltip"
title="<?= $record->SupplierID ?> - Click here to edit Supplier details"><i class="fa fa-edit" style="color:#02a8b5;"></i>&nbsp;&nbsp;&nbsp;
</a>
<a style="cursor:pointer;"
data-toggle="tooltip"
title="<?= $record->SupplierID ?> - Click here to delete Supplier details"
onclick="deletesupplier('<?php echo $record->SupplierID; ?>')"><i class="fa fa-trash" style="color:#02a8b5;"></i>&nbsp;&nbsp;&nbsp;
</a>
<?php } ?>
</td>
</tr>
@ -195,7 +208,42 @@
});
}
}
function reActivateSupplier(sid) {
var answer = confirm(" Do you want to Re-Activate the Supplier from the List?")
if (answer) {
$.ajax({
data: {
id: sid
},
type: "POST",
url: "<?php echo base_url();?>reActivateSupplier",
success: function(data) {
if (data) {
alert(data);
location.reload();
}
},
error: function(xhr, status, error) {
// Handle errors
console.error('AJAX Error:', error); // Logs the actual error
console.error('Status:', status); // Logs the status like "timeout", "error", etc.
console.error('Response:', xhr.responseText); // Logs the server's response
},
complete: function(xhr, status) {
// Code to run after AJAX call is complete, regardless of success or error
console.log('AJAX call completed');
console.log('Status:', status);
// Hide loader or perform other clean-up actions
// $('#content').loader('hide'); // Uncomment if you have a loader plugin
}
});
}
}
</script>

View File

@ -96,6 +96,11 @@
</div>
</div>
</div>
<div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
@ -109,6 +114,18 @@
<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;">
@ -119,7 +136,6 @@
<th>Create Date</th>
<th>Transporter Name</th>
<th>Created By</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
@ -131,19 +147,24 @@
$date = $createdat->format('d-m-Y');
$time = $createdat->format('h:i A');
?>
<tr>
<tr
class="<?php if($record->isactive == 0){echo"deactivatedRow";}?>"
style="<?php if($record->isactive == 0){echo"display:none";}?>"
>
<td><?php echo $date; ?></td>
<td><?php echo $record->name ?></td>
<td><?php echo $record->FirstName ?></td>
<td><?php
$a = '';
$a = $record->isactive == 1 ? 'ACTIVE' : 'INACTIVE';
echo $a;
?></td>
<td>
<?php if ($record->isactive == 1) { ?>
<a data-toggle="modal" href="#transporterwizard" data-id="<?php echo $record->id; ?>" data-name="<?php echo $record->name; ?>"><i class="fa fa-pencil"></i></a>
<a href="<?php echo base_url() . 'deleteTransporter?id=' . $record->id; ?>"><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a>
<?php if ($record->isactive == 0) { ?>
<a
onclick="confirmReActivate(event)"
style="cursor:pointer;"
href="<?php echo base_url() . 'reActivateTransporter?id=' . $record->id; ?>"><i class="fa fa-key" style="color:#02a8b5;"></i>&nbsp;&nbsp;&nbsp;</a>
<?php } else { ?>
<a data-toggle="modal" href="#transporterwizard" data-id="<?php echo $record->id; ?>" data-name="<?php echo $record->name; ?>"><i class="fa fa-edit"></i>&nbsp;&nbsp;</a>
<a
onclick="confirmDelete(event)"
href="<?php echo base_url() . 'deleteTransporter?id=' . $record->id; ?>"><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a>
<?php } ?>
</td>
</tr>
@ -329,4 +350,36 @@
}
});
});
</script>
<script>
function confirmDelete(event) {
let result = confirm(` Do you Confirm to Delete the Transporter Detail?`);
if (result) { return result; } else { event.preventDefault(); }
}
function confirmReActivate(event) {
let result = confirm(` Do you Confirm to Re-activate the Transporter Detail?`);
if (result) { return result; } else { event.preventDefault(); }
}
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();
});
</script>