diff --git a/app/Controllers/Expense.php b/app/Controllers/Expense.php index ce24b8f8..4483e649 100755 --- a/app/Controllers/Expense.php +++ b/app/Controllers/Expense.php @@ -18,6 +18,7 @@ class Expense extends BaseController $this->expense_model = new Expense_model(); $this->supplier_model = new Supplier_model(); $this->session = session(); + $this->session = session(); helper('form'); $this->isLoggedIn(); } @@ -86,8 +87,9 @@ class Expense extends BaseController // Generate the next serial number $newSerialNumber = $this->generateSerialNumber($financialYear, $lastSerial); - + $sesn_uid = $this->session->get('userId'); $data = [ + 'created_by' => $sesn_uid, 'transporter_file' => $fileName, 'supplier_id' => $this->request->getPost('supplierid'), 'remarks' => $this->request->getPost('remarks'), @@ -141,9 +143,9 @@ class Expense extends BaseController $fileName = $this->request->getPost('existing_file'); // Use existing file if no new file is uploaded } - - + $sesn_uid = $this->session->get('userId'); $data = [ + 'updated_by' =>$sesn_uid, 'supplier_id' => $this->request->getPost('supplierid'), 'remarks' => $this->request->getPost('remarks'), 'item_description' => $this->request->getPost('item_description'), diff --git a/app/Controllers/Inwardgateregister.php b/app/Controllers/Inwardgateregister.php index 46b9cbc8..1b58896b 100755 --- a/app/Controllers/Inwardgateregister.php +++ b/app/Controllers/Inwardgateregister.php @@ -156,7 +156,7 @@ class Inwardgateregister extends BaseController }); $data['emp_data'] = []; // $data['emp_data'] = $this->inwardgateregister_model->getAdditionalIGRFile(); - // print_r($data['PO_NO']);die; + // dd($data['PO_NO']);die; $this->loadViews("inwardgateregister", $this->global, $data, NULL); } diff --git a/app/Controllers/Rawmaterialdetails.php b/app/Controllers/Rawmaterialdetails.php index d9d328c6..7effb98c 100755 --- a/app/Controllers/Rawmaterialdetails.php +++ b/app/Controllers/Rawmaterialdetails.php @@ -410,18 +410,24 @@ class Rawmaterialdetails extends BaseController $query = $this->rawmaterialdetails_model->insertvalueintoconfig($config); } + // on 28/jan/2025. both add and edit. category condition added. function checkmaterial() { $data = $this->request->getPost(); $materialCode = $data['materialCode'] ?? ''; $materialName = str_replace(' ', '', $data['materialName']); + $materialCategory = $data['materialCategory'] ?? ''; - $this->rawmaterialdetails_model = new rawmaterialdetails_model();; - $query = $this->rawmaterialdetails_model->checkMaterialExists($materialCode , $materialName); - + $query = $this->rawmaterialdetails_model->checkMaterialExists($materialCode , $materialName , $materialCategory); return $this->response->setJSON($query); + + // if (!empty($query)) { + // foreach ((array)$query as $q) { + // $text .= $q['MaterialName'] . " " . ($q['IsActive'] == 1 ? '' : ' ( Inactive ) ') . "
"; + // } + // } } diff --git a/app/Models/Expense_model.php b/app/Models/Expense_model.php index f87fb089..0de2d711 100755 --- a/app/Models/Expense_model.php +++ b/app/Models/Expense_model.php @@ -9,7 +9,7 @@ class Expense_model extends Model protected $primaryKey = 'id'; // Primary key protected $allowedFields = [ - 'serial_number' , 'transporter_file', 'supplier_id', 'remarks', 'item_description', 'cost', 'cgst', 'sgst', 'igst', 'total', 'bill_no' ,'bill_date','status' + 'serial_number' , 'transporter_file', 'supplier_id', 'remarks', 'item_description', 'cost', 'cgst', 'sgst', 'igst', 'total', 'bill_no' ,'bill_date','status','created_by','updated_by' ]; public function getLastSerialNumber($financialYear) @@ -24,9 +24,16 @@ class Expense_model extends Model // Retrieve all active expenses public function getAllExpense($fromDate,$toDate) { - - return $this->db->table('t_expense') + + return $this->db->table('t_expense') + ->select([ + "t_expense.id","t_expense.serial_number","t_expense.transporter_file","t_expense.supplier_id","t_expense.item_description","t_expense.cost","t_expense.cgst","t_expense.sgst","t_expense.igst","t_expense.total","t_expense.remarks","t_expense.status","t_expense.payment_method","t_expense.created_on","t_expense.created_by","t_expense.updated_on","t_expense.updated_by","t_expense.isactive","t_expense.bill_no","t_expense.bill_date", + "t_supplierdetailsn.SupplierName", + "CONCAT_WS(' ', emp.FirstName, emp.LastName) as created_name" + ]) ->join('t_supplierdetailsn', 't_expense.supplier_id = t_supplierdetailsn.SupplierID', 'left') + ->join('tbl_users as creator', ' t_expense.created_by = creator.userid', 'left') + ->join('t_employee_details as emp', 'emp.empid=creator.empid', 'left') ->where('t_expense.isactive', 1) ->where('t_expense.created_on >=',"$fromDate") ->orderBy('t_expense.created_on', 'DESC') diff --git a/app/Models/Rawmaterialdetails_model.php b/app/Models/Rawmaterialdetails_model.php index 8bea1a2b..28fcb3d3 100755 --- a/app/Models/Rawmaterialdetails_model.php +++ b/app/Models/Rawmaterialdetails_model.php @@ -327,17 +327,20 @@ class Rawmaterialdetails_model extends Model // $this->db->update('T_PurchaseOrderDetails', $POInfo); // return $this->db->affectedRows(); // } - function checkMaterialExists($materialCode , $materialName) - { + + + // on 28/jan/2025. both add and edit. category condition added. + function checkMaterialExists($materialCode , $materialName ,$materialCategory) + { $builder = $this->db->table('t_materialmaster') ->select('MaterialCode,MaterialName,MaterialType,Category,IsActive'); if(!empty($materialCode)){ $builder = $builder->where('MaterialCode !=' , $materialCode); } + $builder->where('Category' , $materialCategory); $builder->where('REPLACE(MaterialName, " ", "")' , $materialName); $query = $builder->get(); - if ($query->getNumRows() > 0) { return $query->getResultArray(); } else { diff --git a/app/Views/addRawMaterial.php b/app/Views/addRawMaterial.php index 44def64f..7f407380 100755 --- a/app/Views/addRawMaterial.php +++ b/app/Views/addRawMaterial.php @@ -304,7 +304,7 @@ var materialName = $('#MaterialName').val().trim(); var materialCode = ''; - + var materialCategory = $('#MatCate').val(); if(materialName == ''){ return; } @@ -315,7 +315,7 @@ $.ajax({ data: { materialCode, - materialName + materialName,materialCategory }, type: "POST", url: "materialExist", diff --git a/app/Views/editRawmaterial.php b/app/Views/editRawmaterial.php index 7e92c24d..6561130e 100755 --- a/app/Views/editRawmaterial.php +++ b/app/Views/editRawmaterial.php @@ -442,6 +442,7 @@ if ($total <= $reorder) { var materialName = $('#MaterialName').val(); var materialCode = $('#RMcode').val(); + var materialCategory = $('#MaterialCategory').val(); if(materialName == ''){ return; @@ -453,7 +454,8 @@ if ($total <= $reorder) { $.ajax({ data: { materialCode, - materialName + materialName, + materialCategory }, type: "POST", url: "materialExist", diff --git a/app/Views/expense_list.php b/app/Views/expense_list.php index 38ef48db..1334d989 100755 --- a/app/Views/expense_list.php +++ b/app/Views/expense_list.php @@ -119,11 +119,12 @@ Bill No Bill Date Cost - CGST - SGST - IGST + CGST + SGST + IGST Total Status + Created By Action @@ -177,6 +178,7 @@ +