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 @@ Cost Center Code Cost Center Name Created By - Status Action @@ -99,16 +98,11 @@ code ?> CostCenterName ?> FirstName ?> - IsActive == 1 ? $R = 'ACTIVE' : $R = 'INACTIVE'; - echo $R; - ?> DeletedBy == '') { ?> - +        diff --git a/app/Views/editRawmaterial.php b/app/Views/editRawmaterial.php index 27e6625e..d3aa141f 100755 --- a/app/Views/editRawmaterial.php +++ b/app/Views/editRawmaterial.php @@ -111,7 +111,9 @@ if ($total <= $reorder) {

Edit Material - Details

- Back +
@@ -284,7 +286,9 @@ if ($total <= $reorder) { diff --git a/app/Views/editSupplier.php b/app/Views/editSupplier.php index 4baeeca8..f4650928 100755 --- a/app/Views/editSupplier.php +++ b/app/Views/editSupplier.php @@ -283,7 +283,9 @@ if (!empty($supplier)) {

Edit Supplier Details

- Back +
@@ -301,9 +303,7 @@ if (!empty($supplier)) {
Supplier Information
-
- name="isactive"> IsActive -
+ @@ -456,6 +456,9 @@ if (!empty($supplier)) {
+
@@ -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) } }); diff --git a/app/Views/rawmaterialListing.php b/app/Views/rawmaterialListing.php index 4d688eb9..92441c4b 100755 --- a/app/Views/rawmaterialListing.php +++ b/app/Views/rawmaterialListing.php @@ -75,14 +75,20 @@ -
- - -
- + +
+
+ + +
+ +
+
@@ -98,6 +104,7 @@ Opening Stock Material Category HSN Code + Action @@ -116,18 +123,37 @@ } else { $cdate = date('d-m-Y', strtotime($record->CreatedDate)); } ?> - - MaterialCode ?> - MaterialName ?> - MaterialType ?> - UOM ?> + + MaterialCode ?> + MaterialName ?> + MaterialType ?> + UOM ?> stock != null || '') { ?> - stock ?> + stock ?> - 0 + 0 - Category ?> - HSNCODE ?> + Category ?> + HSNCODE ?> + IsActive == 0) { ?> + +     + + + +     + + +     + + + 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: "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 + } + }); + } + } + \ No newline at end of file diff --git a/app/Views/supplierListing.php b/app/Views/supplierListing.php index f100b6dc..398f35a4 100755 --- a/app/Views/supplierListing.php +++ b/app/Views/supplierListing.php @@ -75,16 +75,24 @@ - -
- - -
- + + +
+
+ + +
+ +
+ +
+
@@ -120,15 +128,7 @@ } ?> - + @@ -136,10 +136,23 @@ - @@ -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 @@ + +
+ +
+
@@ -109,6 +114,18 @@ + +
+
+ + +
+
+ +
@@ -119,7 +136,6 @@
- @@ -131,19 +147,24 @@ $date = $createdat->format('d-m-Y'); $time = $createdat->format('h:i A'); ?> - + " + style="isactive == 0){echo"display:none";}?>" + > - @@ -329,4 +350,36 @@ } }); }); + + + \ No newline at end of file
- - SupplierID ?> - - - SupplierID ?> SupplierName ?> Address ?> ContactNumber ?>PAN ?> GSTNO ?> PaymentTerms ?>IsActive == 0) { - echo "Deactived"; - } else { ?> -     + IsActive == 0) { ?> + +     + + + +     + + +     +
Create Date Transporter Name Created ByStatus Action
name ?> FirstName ?>isactive == 1 ? 'ACTIVE' : 'INACTIVE'; - echo $a; - ?> - isactive == 1) { ?> - -     + isactive == 0) { ?> +     + +    +