From 957616db54cea8eb15f254fb6eed6631944bef60 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Tue, 1 Apr 2025 10:27:42 +0000 Subject: [PATCH 01/14] igr live issues --- app/Controllers/Inwardgateregister.php | 38 ++++++++++++++----------- app/Models/Inwardgateregister_model.php | 17 +++++++---- 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/app/Controllers/Inwardgateregister.php b/app/Controllers/Inwardgateregister.php index 4fa4fd29..5a361bbd 100755 --- a/app/Controllers/Inwardgateregister.php +++ b/app/Controllers/Inwardgateregister.php @@ -928,7 +928,7 @@ function viewIGRDetails() $result_for_email = $this->inwardgateregister_model->getDetailsforEmail($this->session->get('userId'),$roleId); $result_for_history = $this->inwardgateregister_model->getHistoryDetailsforEmail($IGRNo); - + $notification = new Notification(); $history_content = "
IGR History

"; - $email = ""; - for ($i = 0; $i < count($result_for_email['emails']); $i++) { - $email .= $result_for_email['emails'][$i]->email . " , "; + + $to_email_addr = ""; + for ($i = 0; $i < count($result_for_email['to_mails']); $i++) { + $to_email_addr .= $result_for_email['to_mails'][$i]->email . " , "; + // $to_email_addr .= "sanjeev.p@venbainfotech.com,gowtham.m@venbainfotech.com"; } - $email = rtrim($email, " ,"); + $to_email_addr = rtrim($to_email_addr, " ,"); $email_response = $notification->sendEmail([ - 'recipient_email' => $email, + 'recipient_email' => $to_email_addr, 'subject' => $result_for_email['company'].' - IGR Notification', // 'carboncopy'=>Sales@resicoindustries.com,Factory@resicoindustries.com,Invoice@resicoindustries.com, // 'description' => 'IGR Number : '.$IGRNo.' is Edited By '.($result_for_email['full_name'] ?? $this->session->get('name'))." On ".date('d-m-Y H:i A', strtotime(get_current_date_time() . ' +30 seconds')). $history_content, 'description' => $result_for_history['first_line']."
" .$history_content, 'company' => $result_for_email['company'], - 'from_mail'=> $result_for_email['from_mail'] + 'from_mail'=> $result_for_email['from_mails'] ]); log_message('error', 'email reponse : ' . json_encode($email_response)); @@ -1006,9 +1008,9 @@ function viewIGRDetails() // Log the result if ($receiving_status) { - $this->logger->info("Email IDs = " . $email . " " . $mail_log); + $this->logger->info("Email IDs = " . $to_email_addr . " " . $mail_log); } else { - $this->logger->error("Email IDs = " . $email . " " . $mail_log); + $this->logger->error("Email IDs = " . $to_email_addr . " " . $mail_log); } // echo "***".$history_content;die; @@ -1424,22 +1426,24 @@ function updateIGRWeight(){ $result_for_email = $this->inwardgateregister_model->getDetailsforEmail($this->session->get('userId'),$roleId); - - $email = ""; - for ($i = 0; $i < count($result_for_email['emails']); $i++) { - $email .= $result_for_email['emails'][$i]->email . " , "; - } - $email = rtrim($email, " ,"); + // print_r($result_for_email);die; + + $to_email_addr = ''; + for ($i = 0; $i < count($result_for_email['to_mails']); $i++) { + $to_email_addr .= $result_for_email['to_mails'][$i]->email . " , "; + } + // $to_email_addr = " gowtham.m@venbainfotech.com , sanjeev.p@venbainfotech.com"; + $to_email_addr = rtrim($to_email_addr, " ,"); $content = 'A new remark was created by '.$result_for_email['full_name'].' against IGR no '.$IGRNo.',

"'.$remark.'"'; $notification = new Notification(); $notification->sendEmail([ - 'recipient_email' => $email, + 'recipient_email' => $to_email_addr, 'subject' => $result_for_email['company'].' - IGR Remark Raised', 'description' => $content, 'company' => $result_for_email['company'], - 'from_mail'=> $result_for_email['from_mail'] + 'from_mail'=> $result_for_email['from_mails'] ]); diff --git a/app/Models/Inwardgateregister_model.php b/app/Models/Inwardgateregister_model.php index e8c54b66..09cc930e 100755 --- a/app/Models/Inwardgateregister_model.php +++ b/app/Models/Inwardgateregister_model.php @@ -1317,15 +1317,22 @@ $builder = $this->db->table('t_igr_history') $query2 = $this->db->query(" SELECT email FROM tbl_users - WHERE isDeleted = 0 AND roleId =".$roleId // hardcoded because auditor role only. refer with gwm 29/01/2025 + WHERE isDeleted = 0 AND roleId =".$roleId ); - $emails = $query2->getResult(); + $to_mails = $query2->getResult(); + + $query3 = $this->db->query(" + SELECT email FROM tbl_users + WHERE isDeleted = 0 AND userId =".$userId + ); + $from_mails = $query3->getRow(); return [ - 'from_mail' => $company ? $company->EmailAddress : null, - 'full_name' => $fullName ? $fullName->FullName : null, 'company' => $company ? $company->CompanyName : null, - 'emails' => $emails + 'company_mail' => $company ? $company->EmailAddress : null, + 'full_name' => $fullName ? $fullName->FullName : null, + 'from_mails' => $from_mails ? $from_mails->email : null , + 'to_mails' => $to_mails, ]; } From e775324fa2b8742f94afd5e124b8a72f5bb4166b Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Tue, 1 Apr 2025 16:48:37 +0530 Subject: [PATCH 02/14] stock module - 01-04-2025 --- app/Views/stock/dieselStockDetails.php | 183 +++++++++++++++++-------- 1 file changed, 128 insertions(+), 55 deletions(-) diff --git a/app/Views/stock/dieselStockDetails.php b/app/Views/stock/dieselStockDetails.php index 1999e936..08e5781a 100644 --- a/app/Views/stock/dieselStockDetails.php +++ b/app/Views/stock/dieselStockDetails.php @@ -574,11 +574,11 @@ foreach ($period as $day) { - $dieselStockDetails) { + foreach ($groupedDieselMachineStockDetails as $rowIndex => $dieselStockDetails) { ?> format('d-m-Y'); + $startDate = DateTime::createFromFormat('Y-m-d', $totalDiesel[$rowIndex]['date'])->format('d-m-Y'); ?> @@ -603,37 +603,37 @@ foreach ($period as $day) { + oninput="openingTDStockChange(this)" contenteditable="true" - > + > - + + data-id=""> - + + data-id=""> - + @@ -643,15 +643,15 @@ foreach ($period as $day) { //before closing outer loop if (!isset($summary['totalPurchaseDiesel'])) { - $summary['opening_diesel'] = '-'; + $summary['openingStock'] = '-'; $summary['totalPurchaseDiesel'] = 0; $summary['totalFillingDiesel'] = 0; $summary['balanceStock'] = 0; } - - $summary['totalPurchaseDiesel'] += is_numeric($totalDiesel[$groupedDieselMachineStockDetailsIndex]['purchase_diesel']) ? $totalDiesel[$groupedDieselMachineStockDetailsIndex]['purchase_diesel'] : 0; - $summary['totalFillingDiesel'] += is_numeric($totalDiesel[$groupedDieselMachineStockDetailsIndex]['total_filling_diesel']) ? $totalDiesel[$groupedDieselMachineStockDetailsIndex]['total_filling_diesel'] : 0; - $summary['balanceStock'] = is_numeric($totalDiesel[$groupedDieselMachineStockDetailsIndex]['balance_stock']) ? $totalDiesel[$groupedDieselMachineStockDetailsIndex]['balance_stock'] : 0; + $summary['openingStock'] = is_numeric($totalDiesel[$rowIndex]['opening_stock']) ? $totalDiesel[$rowIndex]['opening_stock'] : 0; + $summary['totalPurchaseDiesel'] += is_numeric($totalDiesel[$rowIndex]['purchase_diesel']) ? $totalDiesel[$rowIndex]['purchase_diesel'] : 0; + $summary['totalFillingDiesel'] += is_numeric($totalDiesel[$rowIndex]['total_filling_diesel']) ? $totalDiesel[$rowIndex]['total_filling_diesel'] : 0; + $summary['balanceStock'] = is_numeric($totalDiesel[$rowIndex]['balance_stock']) ? $totalDiesel[$rowIndex]['balance_stock'] : 0; ?> @@ -675,7 +675,7 @@ foreach ($period as $day) { + oninput="openingReadingChange(this)" contenteditable="true" > @@ -781,7 +781,7 @@ foreach ($period as $day) { - + @@ -836,41 +836,115 @@ foreach ($period as $day) { - - - oninput="openingTDStockChange(this)" - contenteditable="true" - - > - - - - - - - - - - - - + + + + + + + oninput="openingTDStockChange(this)" + contenteditable="true" + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + oninput="openingTDStockChange(this)" + contenteditable="true" + + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $dieselMachine) { ?> @@ -1566,8 +1640,7 @@ foreach ($period as $day) { const box = child.getBoundingClientRect(); const offset = y - box.top - box.height / 2; - return offset < 0 && offset > closest.offset ? - { + return offset < 0 && offset > closest.offset ? { offset, element: child } : From 663e526f291b7aede5e9497dee5f9cd18c63b05a Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Wed, 2 Apr 2025 18:34:33 +0530 Subject: [PATCH 03/14] stock module - 02-04-2025 --- app/Config/Routes.php | 4 +- app/Controllers/Inwardgateregister.php | 40 +- app/Models/GasShortageModel.php | 2 +- app/Models/Inwardgateregister_model.php | 30 + app/Models/Rawmaterialdetails_model.php | 12 + app/Views/gasCylinderEntered.php | 702 ++++++++++++++ app/Views/gasCylinderPending.php | 1103 ++++++++++++++++++++++ app/Views/gasCylinderReturned.php | 1109 +++++++++++++++++++++++ app/Views/includes/new_header.php | 16 + 9 files changed, 3012 insertions(+), 6 deletions(-) create mode 100644 app/Views/gasCylinderEntered.php create mode 100644 app/Views/gasCylinderPending.php create mode 100644 app/Views/gasCylinderReturned.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index c794b782..f2c5db30 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -326,7 +326,9 @@ $routes->post('inwardgateregister/edituploadfile', 'Inwardgateregister::edituplo $routes->post('getIGRRemarks', 'Inwardgateregister::getIGRRemarks'); $routes->post('saveIGRRemarks', 'Inwardgateregister::saveIGRRemarks'); $routes->post('updateGasShortage','Inwardgateregister::updateGasShortage'); -$routes->post('gasShortageList','Inwardgateregister::gasShortageList'); +$routes->get('gasCylinderEntered','Inwardgateregister::gasCylinderEntered'); +$routes->get('gasCylinderPending','Inwardgateregister::gasCylinderPending'); +$routes->get('gasCylinderReturned','Inwardgateregister::gasCylinderReturned'); $routes->post('getGasShortageDetail',"Inwardgateregister::getGasShortageDetail"); diff --git a/app/Controllers/Inwardgateregister.php b/app/Controllers/Inwardgateregister.php index 5a361bbd..930ed0e0 100755 --- a/app/Controllers/Inwardgateregister.php +++ b/app/Controllers/Inwardgateregister.php @@ -10,6 +10,7 @@ use App\Models\Inwardgateregister_model; use App\Models\IGRRemarks_model; use App\Models\GasShortageModel; use App\Helpers\Notification; +use App\Models\Rawmaterialdetails_model; use DateTime; use ZipArchive; @@ -27,6 +28,8 @@ class Inwardgateregister extends BaseController protected $inwardgateregister_model; protected $IGRRemarks_model; protected $gasShortage_model; + + protected $rawMaterialDetails_model; protected $session; protected $logger; @@ -40,6 +43,7 @@ class Inwardgateregister extends BaseController $this->inwardgateregister_model = new Inwardgateregister_model(); $this->IGRRemarks_model = new IGRRemarks_model(); $this->gasShortage_model = new GasShortageModel(); + $this->rawMaterialDetails_model = new Rawmaterialdetails_model(); $this->session = session(); helper('form'); //$this->load->library('form_validation'); @@ -1521,13 +1525,41 @@ function updateIGRWeight(){ - public function gasShortageList(){ + public function gasCylinderEntered(){ - $postData = $this->request->getPost(); + $this->global['pageTitle'] = 'Gas Cylinder Entered'; - $allShortages = $this->gasShortage_model->where('invoiceNo',$postData['invoiceNo'])->findAll(); + $gasMaterialCodes = $this->rawMaterialDetails_model->getAllGasMaterialCode(); - return $this->response->setJSON(['status' => 'success', 'data' => $allShortages]); + $gasMaterialCodes = array_column($gasMaterialCodes,'MaterialCode'); + + $igrDetailsListByMcatGas = $this->inwardgateregister_model->getIgrDetailsListByMcatGas($gasMaterialCodes); + + $data['gasCylinderEnteredList'] = $igrDetailsListByMcatGas; + + $this->loadViews("gasCylinderEntered", $this->global, $data, NULL); + + + } + + public function gasCylinderPending(){ + + $this->global['pageTitle'] = 'Gas Shortage List'; + + $data['gasShortageList'] = $this->gasShortage_model->findAll(); + + $this->loadViews("gasCylinderPending", $this->global, $data, NULL); + + + } + + public function gasCylinderReturned(){ + + $this->global['pageTitle'] = 'Gas Shortage List'; + + $data['gasShortageList'] = $this->gasShortage_model->findAll(); + + $this->loadViews("gasCylinderReturned", $this->global, $data, NULL); } diff --git a/app/Models/GasShortageModel.php b/app/Models/GasShortageModel.php index 4b8f5be9..e7519acf 100644 --- a/app/Models/GasShortageModel.php +++ b/app/Models/GasShortageModel.php @@ -6,7 +6,7 @@ use CodeIgniter\Model; class GasShortageModel extends Model { - protected $table = 't_gasShortageDetails'; + protected $table = 't_gasshortagedetails'; protected $primaryKey = 'id'; protected $useAutoIncrement = true; protected $returnType = 'array'; diff --git a/app/Models/Inwardgateregister_model.php b/app/Models/Inwardgateregister_model.php index 09cc930e..0a3051c8 100755 --- a/app/Models/Inwardgateregister_model.php +++ b/app/Models/Inwardgateregister_model.php @@ -1379,5 +1379,35 @@ $builder = $this->db->table('t_igr_history') return $transportername; } + //Mcat -materialCategory + public function getIgrDetailsListByMcatGas($gasMaterialCodes){ + + $result = $this->db->table('t_igr_details as t_igrd') + ->select(" + t_igrd.IGRNO, + SUM(t_igrd.QuantityAsPerInvoice) as gasCylinderCount, + t_sd.SupplierName, + t_igrm.*, + 'gas entered' AS status + ") + ->join('t_igr_master t_igrm', 't_igrm.IGRNO = t_igrd.IGRNO') + ->join('t_purchaseorder_master t_pom', 't_igrm.PONO = t_pom.PONO', 'left') + ->join('t_supplierdetailsn t_sd', 't_sd.SupplierID = t_pom.SupplierID') + ->join('t_gasshortagedetails t_gsd', 't_gsd.IGRNO = t_igrd.IGRNO', 'left') + ->whereIn('MaterialCode', $gasMaterialCodes) + ->where("DATE(t_igrd.CreatedDate) BETWEEN '2025-01-01' AND '2025-01-31' ") + ->where('t_gsd.IGRNO IS NULL') + ->groupBy('t_igrd.IGRNO') + ->get() + ->getResultArray(); + + + + return $result; + + } + + + } \ No newline at end of file diff --git a/app/Models/Rawmaterialdetails_model.php b/app/Models/Rawmaterialdetails_model.php index 22b261bb..51e60c69 100755 --- a/app/Models/Rawmaterialdetails_model.php +++ b/app/Models/Rawmaterialdetails_model.php @@ -232,6 +232,18 @@ class Rawmaterialdetails_model extends Model } + function getAllGasMaterialCode(){ + + $builder = $this->db->table('t_materialmaster') + ->select('MaterialCode') + ->where('Category', '334') + ->orderBy('MaterialCode', 'asc'); + $query = $builder->get(); + $materialResults = $query->getResultArray(); + + return $materialResults; + } + function getMaterialstock($MaterialCode, $currentdate) diff --git a/app/Views/gasCylinderEntered.php b/app/Views/gasCylinderEntered.php new file mode 100644 index 00000000..47961925 --- /dev/null +++ b/app/Views/gasCylinderEntered.php @@ -0,0 +1,702 @@ + + + + + + + + + + + + + +
+
+ +
+ +
+
+
+
+
+ +
+
+
+ +
+ getFlashdata('message')): ?> + + + +
+
+
+
+
+
+ + + + + + + + + + + + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + +

No Gas Cylinder Entered in the Given Dates..!!

+ + + $gasCylinder): + $gasCylinder['MaterialRcvdDate'] = date('d-m-Y',strtotime($gasCylinder['MaterialRcvdDate'])); + $gasCylinder['DeliveryChellanDate'] = date('d-m-Y',strtotime($gasCylinder['DeliveryChellanDate'])); + ?> + + + + + + + + + + + + + + + + + + + + + + + + + +
Full Cylinder DateIGR NoSupplierBill/Invoice NoBill DateDriver NameVehicle NoCylinder CountStatusGas Details
+ + + +
+ + +
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/Views/gasCylinderPending.php b/app/Views/gasCylinderPending.php new file mode 100644 index 00000000..51bbf798 --- /dev/null +++ b/app/Views/gasCylinderPending.php @@ -0,0 +1,1103 @@ + + + + + + + + + + + + + +
+
+ +
+ +
+
+
+
+
+ +
+
+
+ +
+ getFlashdata('message')): ?> + + + +
+
+
+
+
+
+ + + + + + + + + + + + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
Full Cylinder DateIGR NoSupplierCylinder NoGross WeightActual WeightBill/Invoice NoBill DateDriver NameVehicle NoStatusAction
+ + +
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/Views/gasCylinderReturned.php b/app/Views/gasCylinderReturned.php new file mode 100644 index 00000000..50a7d53e --- /dev/null +++ b/app/Views/gasCylinderReturned.php @@ -0,0 +1,1109 @@ + + + + + + + + + + + + + +
+
+ +
+ +
+
+
+
+
+ +
+
+
+ +
+ getFlashdata('message')): ?> + + + +
+
+
+
+
+
+ + + + + + + + + + + + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Full Cylinder DateIGR NoSupplierCylinder NoGross WeightEmpty Cylinder DateTare WeightNet WeightActual WeightshortageBill/Invoice NoBill DateDriver NameVehicle NoStatusAction
+ + +
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/Views/includes/new_header.php b/app/Views/includes/new_header.php index 2b66ce48..3549eee3 100755 --- a/app/Views/includes/new_header.php +++ b/app/Views/includes/new_header.php @@ -746,6 +746,22 @@ Non IGR / Expense + + + From fff8d5ed6ccb5393bd774f7d8583b42601f49161 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Thu, 3 Apr 2025 04:14:27 +0000 Subject: [PATCH 04/14] minor issues and alignment changes and igr number new series --- app/Config/Routes.php | 1 + app/Controllers/Emergencypurchaseorder.php | 6 +- app/Controllers/Inwardgateregister.php | 17 ++- app/Controllers/Monthlypay.php | 59 ++++++++- app/Controllers/Payslip.php | 5 +- app/Controllers/Purchaseorder.php | 2 +- app/Helpers/purchaseorder_helper.php | 42 ++++++ app/Models/Inwardgateregister_model.php | 14 +- app/Models/Monthlypay_model.php | 40 ++++++ app/Views/EditservicePurchaseorder.php | 71 +++++----- app/Views/attendance.php | 42 +++++- app/Views/editRevenuepurchaseorder.php | 12 +- app/Views/employeeLeaveApplicationForm.php | 145 +++++++++++++-------- 13 files changed, 341 insertions(+), 115 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index c794b782..fb60b7ad 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -200,6 +200,7 @@ $routes->post('monthlypay/deletePublicHoliday', 'Monthlypay::deletePublicHoliday $routes->get('leaveApplicationForm', 'Monthlypay::leaveApplicationForm'); $routes->post('fetchLeaveApplicationForm', 'Monthlypay::fetchLeaveApplicationForm'); $routes->get('deleteLeaveApplicationForm', 'Monthlypay::deleteLeaveApplicationForm'); +$routes->post('validateDateRange', 'Monthlypay::validateDateRange'); $routes->match(['GET', 'POST'], 'leaveApplicationPDF/(:any)', 'Monthlypay::leaveApplicationPDF/$1'); $routes->match(['GET', 'POST'], 'overTimeDetails', 'Monthlypay::overTimeDetails'); diff --git a/app/Controllers/Emergencypurchaseorder.php b/app/Controllers/Emergencypurchaseorder.php index 4e7fb046..08c9dd2d 100755 --- a/app/Controllers/Emergencypurchaseorder.php +++ b/app/Controllers/Emergencypurchaseorder.php @@ -617,12 +617,14 @@ class Emergencypurchaseorder extends BaseController $igr = array(); $paymentstatus = NO_PAIDIGR; - $igr = array('PONO' => $PONO, 'VehicleNo' => $Vehicle, 'DeliveryChellanOrInvoiceNo' => $DeliveryChellanInvoiceNo, 'DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $DeliveryChellanDate, 'CourierNo' => $Courier, 'IGRStatus' => $IGRStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt, 'MaterialRcvdDate' => $MaterialReceivedate, 'Paymentstatus' => $paymentstatus); + $last_igrno = $this->inwardgateregister_model->lastIGRNO(); + $newIGRNO = generate_igr_number($last_igrno); + $igr = array('IGRNO'=>$newIGRNO,'PONO' => $PONO, 'VehicleNo' => $Vehicle, 'DeliveryChellanOrInvoiceNo' => $DeliveryChellanInvoiceNo, 'DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $DeliveryChellanDate, 'CourierNo' => $Courier, 'IGRStatus' => $IGRStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt, 'MaterialRcvdDate' => $MaterialReceivedate, 'Paymentstatus' => $paymentstatus); //print_r($igr); $igrM = $this->inwardgateregister_model->addigrM($igr); - $IGRNO = !empty($igrM) ? $igrM : ''; + $IGRNO = $newIGRNO; if ($Qualitycheck == 0) { diff --git a/app/Controllers/Inwardgateregister.php b/app/Controllers/Inwardgateregister.php index 5a361bbd..3b241b69 100755 --- a/app/Controllers/Inwardgateregister.php +++ b/app/Controllers/Inwardgateregister.php @@ -447,7 +447,11 @@ class Inwardgateregister extends BaseController } } #Step 3 Master Details Gathering to Save In DB - $igr = array('PONO' => $PONO, 'VehicleNo' => $VehicleNo, 'TransporterId'=>$TransporterId,'DeliveryChellanOrInvoiceNo' => $DeliveryChellanOrInvoiceNo, 'DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt, 'DriverName' => $DriverName, 'DriverMobileNumber' => $DriverMobileNumber,'IGRStatus' => $IGRStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt, 'PaymentStatus' => $paymentstatus, 'Remark'=>$MasterRemarks); + $last_igrno = $this->inwardgateregister_model->lastIGRNO(); + // echo $last_igrno; + $newIGRNO = generate_igr_number($last_igrno); + // echo $newIGRNO;die; + $igr = array('IGRNO'=>$newIGRNO,'PONO' => $PONO, 'VehicleNo' => $VehicleNo, 'TransporterId'=>$TransporterId,'DeliveryChellanOrInvoiceNo' => $DeliveryChellanOrInvoiceNo, 'DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt, 'DriverName' => $DriverName, 'DriverMobileNumber' => $DriverMobileNumber,'IGRStatus' => $IGRStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt, 'PaymentStatus' => $paymentstatus, 'Remark'=>$MasterRemarks); $igr['MasterFile'] = $requestMasterFileName; #Step 4 Calling DB to Save IGR Master $IGRNO = $this->inwardgateregister_model->addigrM($igr); @@ -987,14 +991,14 @@ function viewIGRDetails() $to_email_addr = ""; for ($i = 0; $i < count($result_for_email['to_mails']); $i++) { - $to_email_addr .= $result_for_email['to_mails'][$i]->email . " , "; - // $to_email_addr .= "sanjeev.p@venbainfotech.com,gowtham.m@venbainfotech.com"; + // $to_email_addr .= $result_for_email['to_mails'][$i]->email . " , "; } + $to_email_addr .= "sanjeev.p@venbainfotech.com,gowtham.m@venbainfotech.com"; $to_email_addr = rtrim($to_email_addr, " ,"); $email_response = $notification->sendEmail([ 'recipient_email' => $to_email_addr, 'subject' => $result_for_email['company'].' - IGR Notification', - // 'carboncopy'=>Sales@resicoindustries.com,Factory@resicoindustries.com,Invoice@resicoindustries.com, + 'carboncopy' =>"pavithra.t@venbainfotech.com", // 'description' => 'IGR Number : '.$IGRNo.' is Edited By '.($result_for_email['full_name'] ?? $this->session->get('name'))." On ".date('d-m-Y H:i A', strtotime(get_current_date_time() . ' +30 seconds')). $history_content, 'description' => $result_for_history['first_line']."
" .$history_content, 'company' => $result_for_email['company'], @@ -1430,9 +1434,9 @@ function updateIGRWeight(){ $to_email_addr = ''; for ($i = 0; $i < count($result_for_email['to_mails']); $i++) { - $to_email_addr .= $result_for_email['to_mails'][$i]->email . " , "; + // $to_email_addr .= $result_for_email['to_mails'][$i]->email . " , "; } - // $to_email_addr = " gowtham.m@venbainfotech.com , sanjeev.p@venbainfotech.com"; + $to_email_addr = " venbalap08@gmail.com , sanjeev.p@venbainfotech.com"; $to_email_addr = rtrim($to_email_addr, " ,"); $content = 'A new remark was created by '.$result_for_email['full_name'].' against IGR no '.$IGRNo.',

"'.$remark.'"'; @@ -1441,6 +1445,7 @@ function updateIGRWeight(){ $notification->sendEmail([ 'recipient_email' => $to_email_addr, 'subject' => $result_for_email['company'].' - IGR Remark Raised', + 'carboncopy' =>"pavithra.t@venbainfotech.com", 'description' => $content, 'company' => $result_for_email['company'], 'from_mail'=> $result_for_email['from_mails'] diff --git a/app/Controllers/Monthlypay.php b/app/Controllers/Monthlypay.php index b25cd126..09f4cb68 100755 --- a/app/Controllers/Monthlypay.php +++ b/app/Controllers/Monthlypay.php @@ -101,7 +101,7 @@ class Monthlypay extends BaseController function attendanceLoad() { - + $month['month'] = ''; $monthdays = 0; $begin = 0; @@ -111,7 +111,7 @@ class Monthlypay extends BaseController $current = $this->request->getPost('month'); $month_short_name = substr((string)$current, 0, 3); - $year = substr((string)$current, 4); + $year = substr((string)$current, 4);// also used $month_arr = date_parse($month_short_name); $month = $month_arr['month']; $current = $year . "-" . $month . '-01'; @@ -151,7 +151,44 @@ class Monthlypay extends BaseController $data['datefordropdown'] = $current; $data['attendance'] = $this->monthlypay_model->monthlyAttendance($current); $data['emppay'] = $this->monthlypay_model->getEmpPayDetails($current, $string); - // dd($data); + $leavedate = $this->monthlypay_model->employeeLeaveDates($month . "-" . $year); + $employeeLeaveDate = []; + + if(!empty($leavedate)){ + foreach ($leavedate as $entry) { + $empId = $entry['emp_id']; + + list($stYear,$stMonth,$stDate) = explode('-', $entry['start_date']); + list($eYear,$eMonth,$eDate) = explode('-', $entry['end_date']); + + $start = (int)$stDate; + $end = (int)$eDate; + + if ((int)$stYear < (int)$year || ((int)$stYear == (int)$year && (int)$stMonth < (int)$month)) { + $start = 1; + } + // if ((int)$stMonth < (int)$month) $start = 1; // old if + + if ((int)$eYear > (int)$year || ((int)$eYear == (int)$year && (int)$eMonth > (int)$month)) { + $end = $monthdays; + } + // if ((int)$eMonth > (int)$month) $end = $monthdays; // old if + + if ($start > $monthdays) $start = 1; + + for ($i = $start; $i <= $end; $i++) { + $employeeLeaveDate[$empId][] = $i; + // $employeeLeaveDate[$empId][] = str_pad($i, 2, '0', STR_PAD_LEFT); + } + } + + if($employeeLeaveDate){ + array_walk($employeeLeaveDate, fn(&$dates) => $dates = array_unique($dates)); + } + } + + $data['employeeleavedate'] = $employeeLeaveDate; + // dd($data['employeeleavedate']); $this->global['pageTitle'] = 'Monthly Attendance'; $this->loadViews("attendance", $this->global, $data, NULL); } @@ -971,7 +1008,21 @@ class Monthlypay extends BaseController return $this->response->setJSON($data); } - + public function validateDateRange(){ + + $emp_id = $this->request->getPost('emp_id'); + $start_date = $this->request->getPost('start_date'); + $end_date = $this->request->getPost('end_date'); + $array = $this->monthlypay_model->validateDateRange($emp_id,$start_date,$end_date); + if (!empty($array) && count($array) > 0) { + $data = ['status' => true, 'message' => 'The selected date range overlaps with an existing approved leave.','details'=>$array]; + }else{ + $data = ['status' => false, 'message' => '','details'=>$array]; + } + + return $this->response->setJSON($data); + } + function deleteLeaveApplicationForm() { $leave_application_id = $this->request->getGet('leave_application_id') ? $this->request->getGet('leave_application_id') : ''; diff --git a/app/Controllers/Payslip.php b/app/Controllers/Payslip.php index 50d81424..5d09e9e2 100755 --- a/app/Controllers/Payslip.php +++ b/app/Controllers/Payslip.php @@ -178,6 +178,8 @@ class Payslip extends BaseController $data['fresh'] = $this->monthlypay_model->getEmpPayDetailsforMonthInputs($current); // dd($data['fresh']); $data['drivermonthinputs'] = $this->driverMonthlyPayInputs($current); + // $leavedate = $this->monthlypay_model->employeeLeaveDates($current); + $employeeSalary = []; $esi = []; $pf = []; @@ -302,8 +304,7 @@ class Payslip extends BaseController $data['esi'] = $esi; $data['pf'] = $pf; $data['over_time'] = $ot; - - + $this->global['pageTitle'] = 'Payroll Monthly Inputs'; $this->loadViews("monthlypayinputs", $this->global, $data, NULL); } diff --git a/app/Controllers/Purchaseorder.php b/app/Controllers/Purchaseorder.php index 0b69cc35..7ffdadc3 100755 --- a/app/Controllers/Purchaseorder.php +++ b/app/Controllers/Purchaseorder.php @@ -2597,7 +2597,7 @@ class Purchaseorder extends BaseController } else { $store = array('Status' => $StatusCode, 'OnHoldOn' => $ApprovedDate, 'OnHoldBy' => $ApprovedBy, 'Remarks' => $Remarks); $this->purchaseorder_model->UpdatePO($store, $PONO); - echo "The Purchase Order No: " . $PONO . "is On Hold"; + echo "The Purchase Order No: " . $PONO . " is On Hold"; } } diff --git a/app/Helpers/purchaseorder_helper.php b/app/Helpers/purchaseorder_helper.php index 8946e7b5..bc1615f7 100755 --- a/app/Helpers/purchaseorder_helper.php +++ b/app/Helpers/purchaseorder_helper.php @@ -27,6 +27,48 @@ if (!function_exists('generate_po_number')) { } } +if (!function_exists('generate_igr_number')) { + function generate_igr_number($last_igrno) + { + $shortenFinYear = get_shorten_financial_year(); + + if (preg_match('/^\w+\/\d+-\d+\/\d+$/', $last_igrno)) { + // echo $last_igrno; + $type = 1; // IGRNO/25-26/00001 // 2025 april onwards karthick asked to changed this type. + } elseif (preg_match('/^\w+-\d+$/', $last_igrno)) { + // echo $last_igrno; + $type = 2; // IGRNO-00001 // karthick asked to checked this type 2023- 2025 april + } else { + // echo $last_igrno; + $type = 3; // IGRNO00001 // very first time we followed this type + } + + if ($type == 1) { + $result = explode('/', $last_igrno); + $requestedFinYear = $result[1]; + $leftPad = "IGR"; + $digit = 5; + + if($requestedFinYear == $shortenFinYear){ // here i am comparing the shoren fin year + $number = ((int)$result[2])+1; + $IgrNo = $leftPad . '/' . $shortenFinYear . '/' . str_pad($number, $digit, '0', STR_PAD_LEFT); + }else{ + // here not same means ressetted type 1 format + $counter = 1; + $IgrNo = $leftPad . '/' . $shortenFinYear . '/' . str_pad($counter, $digit, '0', STR_PAD_LEFT); + } + return $IgrNo; + }else{ + // type 2 and type 3 is converted into type 1 format + $leftPad = "IGR"; + $digit = 5; + $counter = 1; + $IgrNo = $leftPad . '/' . $shortenFinYear . '/' . str_pad($counter, $digit, '0', STR_PAD_LEFT); + return $IgrNo; + } + } +} + function generate_amendment_po_number($PoNo, $increment = 1) { if (strpos($PoNo, '.') !== false) { list($base, $decimal) = explode('.', $PoNo); diff --git a/app/Models/Inwardgateregister_model.php b/app/Models/Inwardgateregister_model.php index 09cc930e..6ebb17a2 100755 --- a/app/Models/Inwardgateregister_model.php +++ b/app/Models/Inwardgateregister_model.php @@ -221,7 +221,9 @@ class Inwardgateregister_model extends Model } public function igr_history($hsty_arr) { - $keysToRemove = ["UpdateBY", "MaterialRcvdDate", "DeliveryChellanDate"]; + + $keysToRemove = ["UpdateBY","UpdateBy", "MaterialRcvdDate", "DeliveryChellanDate"]; + foreach ($keysToRemove as $key) { if (isset($hsty_arr[$key])) { unset($hsty_arr[$key]); @@ -230,8 +232,7 @@ class Inwardgateregister_model extends Model $builder = $this->db->table('t_igr_history'); $builder->insert($hsty_arr); - - return $this->db->insertID(); // Return last inserted ID + return $this->db->insertID(); } function get_igr_history($col,$IGR,$IGRITEM = null) @@ -273,6 +274,13 @@ class Inwardgateregister_model extends Model return $result; // Return the field value directly } + function lastIGRNO() + { + $query = $this->db->table('t_igr_master')->select('IGRNO')->orderBy('IGRID', 'DESC')->limit(1)->get(); + $lastIGRNO = $query->getRow()->IGRNO; + return $lastIGRNO; + } + function addigrM($igrM) { // print_r($igrM);die; diff --git a/app/Models/Monthlypay_model.php b/app/Models/Monthlypay_model.php index db7f7cb7..2895d9c5 100755 --- a/app/Models/Monthlypay_model.php +++ b/app/Models/Monthlypay_model.php @@ -571,6 +571,26 @@ where Month_Year = ? and att.EmpID in (select EmpID from t_attendance)"; return $this->db->affectedRows(); } } + public function validateDateRange($emp_id,$start_date,$end_date){ + + $array = $this->db->table('t_employee_leave_application_form') + ->where('emp_id', $emp_id) + ->where('status', 'Approved') + ->groupStart() // Start grouping OR conditions + ->where("'$start_date' BETWEEN start_date AND end_date", null, false) + ->orWhere("'$end_date' BETWEEN start_date AND end_date", null, false) + ->orWhere("start_date BETWEEN '$start_date' AND '$end_date'", null, false) + ->orWhere("end_date BETWEEN '$start_date' AND '$end_date'", null, false) + ->groupEnd() // End grouping + ->get() + ->getRowArray(); + + // $last_query = $this->db->getLastQuery(); + // echo $last_query; + + return $array; + + } function getEmpPayDetailsforOTListing($current = "") { @@ -617,5 +637,25 @@ where Month_Year = ? and att.EmpID in (select EmpID from t_attendance)"; return $query->getResult(); } + function employeeLeaveDates($current){ + $current =get_date_time_dynamical_format('m-Y','Y-m',"$current"); + $array = $this->db->table('t_employee_leave_application_form') + ->select("emp_id,start_date,end_date,status") + ->where('status', 'Approved') + ->groupStart() // Start grouping OR conditions + ->where("DATE_FORMAT(start_date, '%Y-%m') = '$current'", null, false) + ->orWhere("DATE_FORMAT(end_date, '%Y-%m') = '$current'", null, false) + ->orWhere("DATE_FORMAT(start_date, '%Y-%m') <= '$current' AND DATE_FORMAT(end_date, '%Y-%m') >= '$current'", null, false) + ->groupEnd() // End grouping + ->get() + ->getResultArray(); + + // $last_query = $this->db->getLastQuery(); + // echo $last_query; + + return $array; + // return [$current]; + } + } \ No newline at end of file diff --git a/app/Views/EditservicePurchaseorder.php b/app/Views/EditservicePurchaseorder.php index df67aeac..b61dff04 100755 --- a/app/Views/EditservicePurchaseorder.php +++ b/app/Views/EditservicePurchaseorder.php @@ -1504,34 +1504,37 @@ if (!empty($getlogpodtl)) {
- - - -
- - -
- +
+
+
+
+ +
+
+ +
+ +
- -
+
+
+ - + + + - @@ -1547,7 +1550,9 @@ if (!empty($getlogpodtl)) { -
Bill No FileAction
FilePath)) ? $gd->FilePath : "No File"; ?> + + +     FilePath)) { ?> @@ -1561,6 +1566,7 @@ if (!empty($getlogpodtl)) {
+ - +
--> + +
@@ -1715,10 +1721,9 @@ if (!empty($getlogpodtl)) {
- - + @@ -1969,26 +1974,25 @@ if (!empty($getlogpodtl)) {