diff --git a/app/Config/Routes.php b/app/Config/Routes.php index e52666f5..459b9ad8 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -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 diff --git a/app/Controllers/Rawmaterialdetails.php b/app/Controllers/Rawmaterialdetails.php index 6397b97a..85c9754a 100755 --- a/app/Controllers/Rawmaterialdetails.php +++ b/app/Controllers/Rawmaterialdetails.php @@ -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() { diff --git a/app/Controllers/Supplier.php b/app/Controllers/Supplier.php index 823662c9..ffc87275 100755 --- a/app/Controllers/Supplier.php +++ b/app/Controllers/Supplier.php @@ -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'); + + } + } \ No newline at end of file diff --git a/app/Models/Rawmaterialdetails_model.php b/app/Models/Rawmaterialdetails_model.php index 07f9e8e9..2b6c4b75 100755 --- a/app/Models/Rawmaterialdetails_model.php +++ b/app/Models/Rawmaterialdetails_model.php @@ -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'; diff --git a/app/Models/Supplier_model.php b/app/Models/Supplier_model.php index ff98f926..1efec261 100755 --- a/app/Models/Supplier_model.php +++ b/app/Models/Supplier_model.php @@ -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; - - } } \ No newline at end of file diff --git a/app/Views/costListing.php b/app/Views/costListing.php index d730245a..2805c7d3 100755 --- a/app/Views/costListing.php +++ b/app/Views/costListing.php @@ -82,7 +82,6 @@
| - | - - = $record->SupplierID ?> - - - | +SupplierID ?> | SupplierName ?> | Address ?> | ContactNumber ?> | @@ -136,10 +136,23 @@PAN ?> | GSTNO ?> | PaymentTerms ?> | -IsActive == 0) { - echo "Deactived"; - } else { ?> - + | IsActive == 0) { ?> + + + + + + + + + + | @@ -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: "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 + } + }); + } + } diff --git a/app/Views/transporterListing.php b/app/Views/transporterListing.php index eef6e4c1..3d499186 100755 --- a/app/Views/transporterListing.php +++ b/app/Views/transporterListing.php @@ -96,6 +96,11 @@ + +Create Date | Transporter Name | Created By | -Status | Action | @@ -131,19 +147,24 @@ $date = $createdat->format('d-m-Y'); $time = $createdat->format('h:i A'); ?> -
|---|---|---|---|---|
| name ?> | FirstName ?> | -isactive == 1 ? 'ACTIVE' : 'INACTIVE'; - echo $a; - ?> | - isactive == 1) { ?> - - + isactive == 0) { ?> + + + + |