changes in master tables

This commit is contained in:
vadivel J 2024-11-18 17:44:41 +05:30
parent bcd74f8b39
commit 360de67475
5 changed files with 103 additions and 12 deletions

View File

@ -319,6 +319,8 @@ class Supplier extends BaseController
return $this->response->setJSON($query);
}
function deletesupplier()
{
$Sid = $this->request->getPost('id');
@ -329,8 +331,10 @@ class Supplier extends BaseController
$result = $this->supplier_model->deleteSupplier($Sid, $SupplierInfo);
echo 'Succssfully change the Supplier status to InAcive';
echo 'Succssfully deleted the Supplier ..!!';
}
function exportsupplier()
{

View File

@ -19,7 +19,6 @@ class Rawmaterialdetails_model extends Model
$builder = $this->db->table('t_materialmaster')
->select('*')
->where('IsActive', 1)
->orderBy('CreatedDate','desc');
$query = $builder->get();
$result = $query->getResult();

View File

@ -20,7 +20,7 @@ class Supplier_model extends Model
$builder = $this->db->table('t_supplierdetailsn as BaseT')
->select('BaseT.SupplierID, BaseT.SupplierName, BaseT.Address, BaseT.ContactNumber, BaseT.AlternateContactNumber,BaseT.EmailAddress,BaseT.Exiseregistration, BaseT.TIN, BaseT.PAN,,BaseT.GSTNO,BaseT.GSTRange,BaseT.CollectrateAddress,BaseT.UANumber,BaseT.CreatedOn,BaseT.PaymentID,pmt.PaymentTerms,BaseT.CSTDate,BaseT.IsActive') //,BaseT.PaymentTerms,BaseT.PaymentDays,BaseT.PayableAT,pmt.Details');
->join('t_paymentterms as pmt', 'pmt.PaymentID = BaseT.PaymentID', 'left')
->orderBy('BaseT.CreatedOn', 'desc'); // Adjust this column as needed
->orderBy('BaseT.CreatedOn', 'desc');
$query = $builder->get();
@ -34,6 +34,16 @@ class Supplier_model extends Model
*/
function deleteSupplier($Sid, $SupplierInfo){
$builder = $this->db->table('t_supplierdetailsn')
->where('SupplierID',$Sid)
->update($SupplierInfo);
return $this->db->affectedRows();
}
function getpayment($Configvalue = '')
{
$ConfigID = 'C009';
@ -114,7 +124,6 @@ class Supplier_model extends Model
->where('SupplierID', $supplierID)
->update($supplier);
return $this->db->affectedRows();
return TRUE;
}

View File

@ -75,6 +75,12 @@
<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 class="error" id="error"></div>
@ -100,7 +106,11 @@
foreach ($userRecords as $record) {
$date = date("Y-m-d");
?>
<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->CreatedDate)) == "30-11--0001") {
$cdate = '00-00-0000';
} else {
@ -223,4 +233,25 @@
}
});
});
</script>
<script>
function showArchiveList() {
let isChecked = $("#showArchiveId").prop('checked');
console.log($(".deactivatedRow").length);
// Show or hide the rows based on checkbox status
$(".deactivatedRow").each(function() {
if (isChecked) {
$(this).show();
} else {
$(this).hide();
}
});
}
$(document).ready(function() {
showArchiveList();
});
</script>

View File

@ -76,6 +76,12 @@
<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 class="error" id="error"></div>
@ -101,7 +107,12 @@
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->CreatedOn)) == "30-11--0001") {
$cdate = '00-00-0000';
} else {
@ -151,25 +162,42 @@
<script type="text/javascript">
function deletesupplier(sid) {
alert(sid);
var answer = confirm(" Do you want to delete the Supplier from the List?")
if (answer) {
$.ajax({
data: {
id: userid
id: sid
},
type: "POST",
url: "<?php echo base_url() ?>deletesupplier",
url: "<?php echo base_url();?>deletesupplier",
success: function(data) {
if (data) {
// $('#content').loader('hide');
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>
<script>
$(document).ready(function() {
@ -262,4 +290,24 @@
}
});
});
</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();
});
</script>