diff --git a/app/Config/Routes.php b/app/Config/Routes.php index a7164a8c..6f97e693 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -87,6 +87,7 @@ $routes->post('fetchDriverAttendanceDetails', 'Driver::fetchDriverAttendanceDeta $routes->get('reActivateDriverAttendance', 'Driver::reActivateDriverAttendance'); $routes->get('deleteDriverAttendance', 'Driver::deleteDriverAttendance'); $routes->post('gatheredCustAndQty', 'Driver::gatheredCustAndQty'); +$routes->match(['GET', 'POST'], 'updateDieselAndShedValuesBasedonEmpID', 'Driver::updateDieselAndShedValuesBasedonEmpID'); // Driver Monthly Pay Inputs Routes $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'driverMonthlyPayInputs', 'Driver::driverMonthlyPayInputs'); $routes->post('saveMonthlyData', 'Driver::saveMonthlyData'); @@ -124,6 +125,7 @@ $routes->get('exportemployee', 'Employeedetails::exportemployee'); $routes->post('employeeEmailExist', 'Employeedetails::CheckEmail'); +$routes->post('employeeMobileExist', 'Employeedetails::CheckMobile'); $routes->post('employeePANExist', 'Employeedetails::checkPAN'); $routes->post('employeecheckAadharNoExist', 'Employeedetails::checkAadharNo'); diff --git a/app/Controllers/Amendmentpurchaseorder.php b/app/Controllers/Amendmentpurchaseorder.php index 34d8c875..df3325dc 100755 --- a/app/Controllers/Amendmentpurchaseorder.php +++ b/app/Controllers/Amendmentpurchaseorder.php @@ -546,6 +546,8 @@ class Amendmentpurchaseorder extends BaseController $RecQtyvalue = $ReceivedQty[0]['ReceivedQuantity']; } + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $POLineItemList = array('PONO' => $NewPO, 'ReqNo' => $Reqnumber, 'MaterialCode' => $MaterialCode, 'ReceivedQuantity' => $RecQtyvalue, 'Quantity' => $Quantity, 'Per' => $per, 'ServiceMaterialDescription' => $servicematerialdescription, 'Rate' => $itemRate, 'Status' => $LineItemStatus, 'CreatedBy' => $updatedBy, 'CreatedDate' => $updateddt, 'CostCenterCode' => $CostCenter, 'ServiceFrequency' => $ServiceFrequency, 'AmendedDetails' => $CAD); $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); @@ -815,6 +817,8 @@ class Amendmentpurchaseorder extends BaseController $CAD = "" . $MaterialCode . "-" . $MaterialName . ""; $CAD .= $CAD2; } + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $POLineItemList = array('PONO' => $NewPO, 'ReqNo' => $Reqnumber, 'MaterialCode' => $MaterialCode, 'Quantity' => $Quantity, 'Rate' => $itemRate, 'Status' => $LineItemStatus, 'ServiceMaterialDescription' => $servicematerialdescription, 'CreatedBy' => $updatedBy, 'CreatedDate' => $updateddt, 'CostCenterCode' => $CostCenter, 'ServiceFrequency' => $ServiceFrequency, 'ReceivedQuantity' => $RecQtyvalue, 'AmendedDetails' => $CAD, 'Per' => $Per); @@ -1248,6 +1252,8 @@ class Amendmentpurchaseorder extends BaseController $CAD = "" . $MaterialCode . ""; $CAD .= $CAD2; } + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $POLineItemList = array('PONO' => $NewPO, 'ReqNo' => $Reqnumber, 'MaterialCode' => $MaterialCode, 'Quantity' => $Quantity, 'Rate' => $itemRate, 'Status' => $LineItemStatus, 'CreatedBy' => $CreateBy, 'CreatedDate' => $createddt, 'CostCenterCode' => $CostCenter, 'AmendedDetails' => $CAD, 'Per' => $Per, 'ServiceMaterialDescription' => $CapitalItemDescrition); $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); @@ -1636,6 +1642,8 @@ class Amendmentpurchaseorder extends BaseController $CAD = "" . $MaterialCode . ""; $CAD .= $CAD2; } + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $POLineItemList = array('PONO' => $NewPO, 'ReqNo' => $Reqnumber, 'MaterialCode' => $MaterialCode, 'Quantity' => $Quantity, 'Rate' => $itemRate, 'Status' => $LineItemStatus, 'CreatedBy' => $CreateBy, 'CreatedDate' => $createddt, 'CostCenterCode' => $CostCenter, 'AmendedDetails' => $CAD, 'Per' => $per, 'ServiceMaterialDescription' => $specialinstruction); diff --git a/app/Controllers/Assetdetails.php b/app/Controllers/Assetdetails.php index d1b2977a..8d512fcb 100755 --- a/app/Controllers/Assetdetails.php +++ b/app/Controllers/Assetdetails.php @@ -235,11 +235,12 @@ class Assetdetails extends BaseController $DateOfCommission = $this->request->getPost('DateOfCommission'); $CreatedBy = $this->session->get('userId'); $DateOfPurchase = $this->request->getPost('DateOfPurchase'); + $DOpurchase = ""; if ($DateOfPurchase != '') { $DOpurchase = get_date_time_format($DateOfPurchase); } $AssetValue = $this->request->getPost('Assetvalue'); - + $DOCommission = ""; if ($DateOfCommission != '') { $DOCommission = get_date_time_format($DateOfCommission); //$DOCommission= get_date_time_format($DateOfCommission); diff --git a/app/Controllers/CostCenter.php b/app/Controllers/CostCenter.php index d23a4a2d..478b0bfa 100755 --- a/app/Controllers/CostCenter.php +++ b/app/Controllers/CostCenter.php @@ -102,11 +102,13 @@ class CostCenter extends BaseController if(!empty($CostCenterCode)){ $updatedBy = $this->session->get('userId'); $message = $this->costcenter_model->reActivateCostCenter($CostCenterCode, $updatedBy); + return redirect()->route('costListing'); }else{ - $message = "Cost Center Code Not Avalable"; + // $message = "Cost Center Code Not Avalable"; + return redirect()->route('costListing'); } - $this->session->setFlashdata('success', $message); - return redirect()->route('costListing'); + // $this->session->setFlashdata('success', $message); + // return redirect()->route('costListing'); } @@ -121,11 +123,13 @@ class CostCenter extends BaseController if(!empty($CostCenterID)){ $updatedBy = $this->session->get('userId'); $message = $this->costcenter_model->deleteCostCenter($CostCenterID, $updatedBy); + return redirect()->route('costListing'); }else{ $message = "Cost Center Code Not Avalable"; + return redirect()->route('costListing'); } - $this->session->setFlashdata('success', $message); - return redirect()->route('costListing'); + // $this->session->setFlashdata('success', $message); + // return redirect()->route('costListing'); } diff --git a/app/Controllers/Driver.php b/app/Controllers/Driver.php index f1f46924..f73d7c7b 100755 --- a/app/Controllers/Driver.php +++ b/app/Controllers/Driver.php @@ -133,28 +133,53 @@ class Driver extends BaseController return $this->response->setJSON($results); } - public function loadDriverAttendance() + public function loadDriverAttendance() { - $input_driver_id = $this->request->getPost('gobal_driver_id') ? $this->request->getPost('gobal_driver_id') : $this->request->getGet('gobal_driver_id'); - $input_month_year = $this->request->getPost('month_year') ? $this->request->getPost('month_year') : $this->request->getGet('month_year'); - list($month, $year) = explode('-', $input_month_year); + $input_driver_id = $this->request->getGet('gobal_driver_id'); + // $input_month_year = $this->request->getPost('month_year') ? $this->request->getPost('month_year') : get_date_time_dynamical_format('d-M-Y','d-m-',"01-"+$this->request->getGet('month_year')) ; + $input_date = $this->request->getGet('date') + ? $this->request->getGet('date') + : get_date_time_dynamical_format('d-M-Y','d-m-Y',"01-".$this->request->getGet('month_year')); - $month_in_number = get_date_time_dynamical_format('M','m',"$month");// refer helper - $get_last_date_of_the_month = cal_days_in_month(CAL_GREGORIAN, $month_in_number, $year); - $from_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"01-$month_in_number-$year"); - $to_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"$get_last_date_of_the_month-$month_in_number-$year"); - $indian_date = get_date_time_dynamical_format('d-m-Y','d-m-Y',"$get_last_date_of_the_month-$month_in_number-$year"); + + list($date,$month,$year) = explode('-', $input_date); + + $get_last_date_of_the_month = cal_days_in_month(CAL_GREGORIAN, $month, $year); + $from_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"01-$month-$year"); + $to_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"$get_last_date_of_the_month-$month-$year"); + $indian_date = get_date_time_dynamical_format('d-m-Y','d-m-Y',"$get_last_date_of_the_month-$month-$year"); + + $amount = $this->driver_model->getDriverAttendanceTable($input_driver_id,"$year-$month"); + $data['driver_attendance_list'] = $this->driver_model->useDriverAttendanceTable()->getDriverAttendanceList($input_driver_id,$from_mysql_date,$to_mysql_date); - $data['page_driver_name'] = $this->driver_model->getDriverName($input_driver_id); + $data['page_driver_name'] = $this->driver_model->getDriverName($input_driver_id,0); $data['invoice_info'] = $this->driver_model->getInvoiceInfo(); - $data['datefordropdown'] = $input_month_year; + $data['datefordropdown'] = $input_date; $data['gobal_driver_id'] = $input_driver_id; + $data['gobal_diesel_amount'] = isset($amount->diesel_amount) ? $amount->diesel_amount : 0 ; + $data['gobal_shed_amount'] = isset($amount->shed_amount) ? $amount->shed_amount : 0 ; $this->global['pageTitle'] = 'Driver Attendance List'; $this->loadViews("driverAttendance", $this->global, $data, NULL); } + public function updateDieselAndShedValuesBasedonEmpID(){ + $arr = $this->request->getPost(); + $userId = $this->session->get('userId'); + $to_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m',$arr['date']); + + $update_arr = ['driver_id' =>$arr['empid'],$arr['column'] =>$arr['value'],'updated_by' => $userId]; + $where_arr = ['DATE_FORMAT(t_driver_attendance.date, "%Y-%m")' =>$to_mysql_date,'t_driver_attendance.driver_id' =>$arr['empid']]; + $data = $this->driver_model->updateDieselAndShedValuesBasedonEmpID($where_arr,$update_arr); + return $data; + // [column] => shed_amount + // [value] => 400 + // [date] => 21-02-2025 + // [empid] => RIPL136 + + + } public function fetchDriverAttendanceDetails(){ $userId = $this->session->get('userId'); @@ -376,11 +401,11 @@ class Driver extends BaseController echo json_encode(count($result)); } - public function driverPayslip() + public function driverPayslip_old() { $PayOn = $this->request->getPost('payon'); - $Driver = $this->request->getPost('driver'); + $Driver = $this->request->getPost('employee'); $res = $this->driver_model->getMonthlyPayDetails($Driver, $PayOn); @@ -389,13 +414,9 @@ class Driver extends BaseController $data = [ 'PayOn' => $result->month_year, 'driver_id' => $result->driver_id, - 'driver_name' => $result->driver_name, 'no_of_loads' => $result->no_of_loads, 'driver_monthly_salary_amount' => $result->driver_monthly_salary_amount, - 'driver_monthly_food_amount' => $result->driver_monthly_food_amount, 'driver_earnings_amount' => $result->driver_earnings_amount, - 'diesel' => $result->diesel, - 'shed_duty_amount' => $result->shed_duty_amount, 'driver_final_payment' => $result->driver_final_payment, 'created_by' => $this->session->get('userId') ]; @@ -405,6 +426,84 @@ class Driver extends BaseController } + public function driverPayslip() + { + + $PayOn = $this->request->getPost('payon'); + + $Driver = $this->request->getPost('employee'); + + $res = $this->driver_model->getMonthlyPayDetails($Driver, $PayOn); + + $result = $res[0]; + + + $loan = []; + $loanHistory = []; + $loan_id = 0; + $BalanceAdvance = 0; + if(is_null($result->Loan_ID)){ + + }else{ + if($result->Loan_Recovered > 0) + { + $loan_id = $result->Loan_ID; + + if($result->Remaining_Due - 1 == 0){ $is_Active = 0; }else{ $is_Active = 1; } + + $loan = [ + 'Paid_Due' => $result->Paid_Due + 1, + 'Remaining_Due' => $result->Remaining_Due - 1, + 'Paid_Amount' => $result->Paid_Amount + $result->Loan_Recovered, + 'is_Active' => $is_Active + ]; + + + $loanHistory = [ + 'Loan_ID' => $loan_id, + 'Due_Amount' => $result->Loan_Recovered, + 'Balance_Amount' => (int)$result->Loan_Amount - ((int)$result->Paid_Amount + (int)$result->Loan_Recovered), + 'Due_Date' => (string)$PayOn, + ]; + + $BalanceAdvance = $result->Loan_Amount - ($result->Paid_Amount + $result->Loan_Recovered); + + + } + } + + $data = [ + 'PayOn' => $result->month_year, + 'driver_id' => $result->driver_id, + 'no_of_loads' => $result->no_of_loads, + 'monthly_salary_amount' => $result->monthly_salary_amount, + 'monthly_food_amount' => $result->monthly_food_amount, + 'final_payment' => $result->final_payment, + 'created_by' => $this->session->get('userId'), + 'shed_amount' => $result->total_shed_amount, + 'diesel_amount' => $result->total_diesel_amount, + 'ESI' => $result->ESI, + 'PF' => $result->PF, + 'Advance' => $result->Loan_Recovered, + 'BalanceAdvance' => $BalanceAdvance, + 'LessAdvance' => 0, + 'Festival_Bonus' => $result->Festival_Bonus, + ]; + + + + $insert = $this->driver_model->insertPayroll($data); + if($insert){ + if(count($loan)){ + $this->driver_model->updateLoan($loan_id,$result->driver_id,$loan); + } + if(count($loanHistory)){ + $this->driver_model->insertLoanHistory($loanHistory); + } + } + return $insert; + } + public function driverPrintPdf() { diff --git a/app/Controllers/Emergencypurchaseorder.php b/app/Controllers/Emergencypurchaseorder.php index c18be944..d4a143a2 100755 --- a/app/Controllers/Emergencypurchaseorder.php +++ b/app/Controllers/Emergencypurchaseorder.php @@ -257,6 +257,8 @@ class Emergencypurchaseorder extends BaseController $TotalOrderValue = $this->request->getPost('TotalOrderValue' . $i); $ServiceFrequency = $this->request->getPost('Frequency' . $i) . ' - ' . $this->request->getPost('FrequencyValue' . $i); $ServiceMaterialDescription = $this->request->getPost('ItemServiceDescription' . $i); + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; if (count($comma_separated) > 0) { for ($j = 1; $j < count($comma_separated); $j++) { @@ -524,6 +526,8 @@ class Emergencypurchaseorder extends BaseController $AfterCgst = $this->request->getPost('RevenueAfterCgst' . $i); $AfterSgst = $this->request->getPost('RevenueAfterSgst' . $i); $AfterIgst = $this->request->getPost('RevenueAfterIgst' . $i); + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; if (count($comma_separated) > 0) { for ($j = 1; $j < count($comma_separated); $j++) { @@ -632,7 +636,7 @@ class Emergencypurchaseorder extends BaseController if (count($mrirmaster) > 0) { foreach ($mrirmaster as $key) { - $MRIRNO = $key->MRIRNo; + $MRIRNO = $key->MRIRNO; } } @@ -1231,7 +1235,8 @@ class Emergencypurchaseorder extends BaseController $InsuranceValue = $this->request->getPost('Insval' . $i); $TotalOrderValue = $this->request->getPost('TotalOrderValue' . $i); $CostCenter = $this->request->getPost('costCode' . $i); - + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; if (count($comma_separated) > 0) { for ($j = 1; $j < count($comma_separated); $j++) { @@ -1398,7 +1403,8 @@ class Emergencypurchaseorder extends BaseController /*----------end--------------------*/ - + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; if (count($comma_separated) > 0) { @@ -1525,6 +1531,6 @@ class Emergencypurchaseorder extends BaseController $this->purchaseorder_model->DeletePOServiceTax($LineItemNo); } $this->purchaseorder_model->DeletePOLineItem($LineItemNo, $ReqNo, $MaterialCode); - echo "Successfully Deleted the Line item" . $LineItemNo; + echo "Successfully Deleted the Line item " . $LineItemNo; } } diff --git a/app/Controllers/Employeedetails.php b/app/Controllers/Employeedetails.php index 5344a673..7f0aa25a 100755 --- a/app/Controllers/Employeedetails.php +++ b/app/Controllers/Employeedetails.php @@ -271,7 +271,7 @@ class Employeedetails extends BaseController $Nominee = $this->request->getPost('nomineename'); $createdby = $this->session->get('userId'); $is_management_team = $this->request->getPost('is_management_team'); - + $is_driver = $this->request->getPost('is_driver'); $TDS_Rate = $this->request->getPost('TDS_Rate'); $tds_applicable=$this->request->getPost('tds_applicable'); @@ -337,7 +337,8 @@ class Employeedetails extends BaseController 'is_management_team' => $is_management_team, 'esi_applicable' => $esi_applicable, 'pf_applicable' => $pf_applicable, - 'work_location' => $work_location + 'work_location' => $work_location, + 'is_driver' => $is_driver, ); //print_r($Employee);die(); @@ -480,6 +481,25 @@ class Employeedetails extends BaseController return $this->response->setJSON($response); } + + function CheckMobile() + { + $ContactNumber = $this->request->getPost('ContactNumber'); + //print_r($id); + + $result = $this->employeedetails_model->checkMobileExists($ContactNumber); + + $result = $result->getResultArray(); + + $response = [ + "message" => "success", + "data" => $result + ]; + + + return $this->response->setJSON($response); + } + function checkPAN() { @@ -728,6 +748,7 @@ class Employeedetails extends BaseController $Nominee = $this->request->getPost('nomineename'); $chked = $this->request->getPost('isactive'); $is_management_team = $this->request->getPost('is_management_team'); + $is_driver = $this->request->getPost('is_driver'); $esi_applicable = $this->request->getPost('esi_applicable'); $pf_applicable = $this->request->getPost('pf_applicable'); $work_location = $this->request->getPost('work_location'); @@ -798,6 +819,7 @@ class Employeedetails extends BaseController 'ESI' => $esino, 'NomineeDetails' => $Nominee, 'is_management_team' => $is_management_team, + 'is_driver' => $is_driver, 'esi_applicable' => $esi_applicable, 'pf_applicable' => $pf_applicable, 'work_location' => $work_location diff --git a/app/Controllers/Inwardgateregister.php b/app/Controllers/Inwardgateregister.php index 8e48dd03..1df68778 100755 --- a/app/Controllers/Inwardgateregister.php +++ b/app/Controllers/Inwardgateregister.php @@ -402,9 +402,9 @@ class Inwardgateregister extends BaseController $IsThisOpenOrderPO = $this->request->getPost('hiddenIsOpenOrder'); $DeliveryChellanOrInvoiceNo = $this->request->getPost('InvoiceNo'); $DeliveryChellan = (string)$this->request->getPost('InvoiceDate'); - $DeliveryChellanDate = get_date_time_dynamical_format('d-m-Y','',$DeliveryChellan); + $DeliveryChellanDate = !$DeliveryChellan || $DeliveryChellan === null ? NULL : get_date_time_format($DeliveryChellan); $Mat_Rcvd_Dt = (string)$this->request->getPost('MaterialRcvdDate'); - $MaterialRcvdDt = get_date_time_dynamical_format('d-m-Y','',$Mat_Rcvd_Dt); + $MaterialRcvdDt = !$Mat_Rcvd_Dt || $Mat_Rcvd_Dt === null ? NULL : get_date_time_format($Mat_Rcvd_Dt); $VehicleNo = $this->request->getPost('VehicleNo'); $TransporterId = $this->request->getPost('TransporterId'); $DriverName = $this->request->getPost('DriverName'); @@ -830,19 +830,13 @@ function viewIGRDetails() } } - log_message('error', 'UpdateIGR igrarr: ' . json_encode($igrarr)); + $this->saveIGRMasterHistory($igrarr,$IGRNo); $getigrstatus = $this->inwardgateregister_model->getigrstatus($IGRNo); $getigrstatus = $getigrstatus->IGRStatus; $updateigrmaster = $this->inwardgateregister_model->updateigr($igrarr, $IGRNo); + log_message('error', "Master updated successfully: " . $updateigrmaster); if(!empty($tableData )){ - #Save IGR Master On History Table - foreach ($igrarr as $key => $value) { - if (!empty($value)) { // Ensure the value is not empty - $hist = array( 'key' => $key, 'value' => $value, 'igr_no' => $IGRNo,'igr_item_no' => NULL); - $this->saveIGRHistory($hist); - } - } foreach ($tableData as $row) { $quantityAsPerInvoice = $row['QuantityAsPerInvoice']; @@ -867,6 +861,7 @@ function viewIGRDetails() 'IGRItemNo' => $igrItemNo, 'UpdateBY' => $updateby ); + $this->saveIGRLineitemHistory($igrline, $IGRNo,$igrItemNo); // $WeightFile = $this->request->getfile('WeightFile'); // $requestWeightFileName = $WeightFile->getName(); @@ -883,24 +878,6 @@ function viewIGRDetails() // } $updateigrlineitem = $this->inwardgateregister_model->updateIGRLineItem($igrline, $igrItemNo); - if($updateigrlineitem){ - foreach ($igrline as $key => $value) { - if (!empty($value)) { // Ensure the value is not empty - if($key == 'IGRNO'){ $key = 'LineItemIGRNO'; } - - $hist = array( 'key' => $key, 'value' => $value, 'igr_no' => $IGRNo,'igr_item_no' => NULL); - $this->saveIGRHistory($hist); - } - } - } - if($grossWeight){ - $hist = array('key' => 'GrossWeight', 'value' => $grossWeight, 'igr_no' => $IGRNo, 'igr_item_no' => $igrItemNo); - $this->saveIGRHistory($hist); - } - if($grossWeight){ - $hist = array('key' => 'GrossWeight', 'value' => $grossWeight, 'igr_no' => $IGRNo, 'igr_item_no' => $igrItemNo); - $this->saveIGRHistory($hist); - } log_message('error', "lineitem updated successfully: " . $updateigrlineitem); log_message('error', 'UpdateIGR updateigrlineitem: ' . json_encode($igrline)); } @@ -913,81 +890,93 @@ function viewIGRDetails() $result_for_email = $this->inwardgateregister_model->getDetailsforEmail($this->session->get('userId')); $result_for_history = $this->inwardgateregister_model->getHistoryDetailsforEmail($IGRNo); - print_r($result_for_history);die; + $notification = new Notification(); - $history_content = NULL; - $history = $result_for_history; - $field_labels = [ - "IGRItemNo" => "IGRItemNo", - "IGRNO" => "IGRNO", - "MaterialCode" => "MaterialCode", - "QuantityAsPerInvoice" => "Received Qty", - "Remarks" => "Remarks", - "IGRItemStatus" => "IGRItemStatus", - "CancelNote" => "CancelNote", - "BankStatus" => "BankStatus", - "GrossWeight" => "Gross Weight", - "GrossWeightDate" => "Gross Weight Date", - "TareWeight" => "Tare Weight", - "TareWeightDate" => "Tare Weight Date", - "NetWeight" => "Net Weight", - "WeightFile" => "WeightFile", - "IGRID" => "IGRID", - "IGRNO" => "IGRNO", - "PONO" => "PONO", - "DeliveryChellanOrInvoiceNo" => "Invoice NO", - "DeliveryChellanDate" => "Invoice Date", - "MaterialRcvdDate" => "Material Received Date", - "VehicleNo" => "Vehicle Number", - "VehicleType" => "Vehicle Type", - "TransporterId" => "Transporter Id", - "CourierNo" => "Courier No", - "Remark" => "Master Remark", - "IGRStatus" => "IGR Status", - "file" => "File", - "Paymentstatus" => "Payment Status", - "DriverName" => "Driver Name", - "DriverMobileNumber" => "Driver Mobile Number", - "MasterFile" => "Master File", - ]; - $history_content = "
The following values have been edited:"; + $history_content = "
IGR History

"; + $email = ""; + for ($i = 0; $i < count($result_for_email['emails']); $i++) { + $email .= $result_for_email['emails'][$i]->email . " , "; + } + $email = rtrim($email, " ,"); + $email_response = $notification->sendEmail([ + 'recipient_email' => $email, + 'subject' => $result_for_email['company'].' - IGR Notification', + // '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'] + ]); - log_message('error', 'email reponse : ' . json_encode($email_response)); - // Determine the email response - $mail_log = isset($email_response['success']) ? 'Email sent successfully' : 'Failed to send email'; - $receiving_status = isset($email_response['success']) ? 1 : 0; + log_message('error', 'email reponse : ' . json_encode($email_response)); + // Determine the email response + $mail_log = isset($email_response['success']) ? 'Email sent successfully' : 'Failed to send email'; + $receiving_status = isset($email_response['success']) ? 1 : 0; - // Log the result - if ($receiving_status) { - $this->logger->info("Email IDs = " . $email . " " . $mail_log); - } else { - $this->logger->error("Email IDs = " . $email . " " . $mail_log); - } + // Log the result + if ($receiving_status) { + $this->logger->info("Email IDs = " . $email . " " . $mail_log); + } else { + $this->logger->error("Email IDs = " . $email . " " . $mail_log); + } - // echo "***".$history_content;die; + // echo "***".$history_content;die; + }else{ + $this->logger->info("History content Not Founded...."); + } } if ($updateigrmaster > 0) { @@ -1029,13 +1018,8 @@ function updateIGRWeight(){ $IGRItemNo = $this->request->getPost('IGRlineitem'); $igr_lineitem = array('GrossWeight' => $GrossWeight,'GrossWeightDate' => $GrossWtDt,'TareWeightDate' => $TareWtDt,'TareWeight' => $TareWeight,'NetWeight' => $NetWeight,'UpdateBY' => $updateby); + $this->saveIGRLineitemHistory($igr_lineitem, $IGRNO,$IGRItemNo); - foreach ($igr_lineitem as $key => $value) { - if (!empty($value)) { // Ensure the value is not empty - $hist = array( 'key' => $key, 'value' => $value, 'igr_no' => $IGRNO,'igr_item_no' => $IGRItemNo); - $this->saveIGRHistory($hist); - } - } $requestWeightFileName =null ; if($WeightFile){ if (!empty($requestWeightFileName)) { @@ -1422,134 +1406,72 @@ function updateIGRWeight(){ } + public function saveIGRMasterHistory($request, $IGRNo) { + $dbIGRMaster = $this->inwardgateregister_model->get_igr_master_for_history($IGRNo); + $history_entries = []; - // public function saveIGRHistory($hist) { - - // // Extract fields from the input array - // $field = $hist['key']; - - // $igr_no = $hist['igr_no']; - // $igr_item_no = $hist['igr_item_no']; - // $new_data = $hist['value']; // Incoming new value - // $old_data = NULL; // Default old value is null - - // log_message('error', "Save History function entered for IGR No: $igr_no, Item No: $igr_item_no, Field: $field."); - - // $latestHist = $this->inwardgateregister_model->get_igr_history($field, $igr_no, $igr_item_no); - // $latestIGRMasterForHist = $this->inwardgateregister_model->get_igr_master_for_history($field, $igr_no); // it have value - // $latestIGRChildForHist = $this->inwardgateregister_model->get_igr_child_for_history($field, $igr_no, $igr_item_no); - - // if(empty($igr_item_no)){ - // if(!empty($latestIGRMasterForHist)){ - // if (!empty($latestHist)) { - // if ($latestHist->new_data == $new_data) { - // log_message('error', "No update needed for IGR No: $igr_no, Item No: $igr_item_no, Field: $field. Data already exists: $new_data"); - // return; - // } else { - // $old_data = $latestHist->new_data; - // } - // }else{ - // $old_data = $latestIGRMasterForHist; - // } - // }} - - // if(!empty($igr_item_no)){ - // if(!empty($latestIGRChildForHist)){ - // if (!empty($latestHist)) { - // if ($latestHist->new_data == $new_data) { - // log_message('error', "No update needed for IGR No: $igr_no, Item No: $igr_item_no, Field: $field. Data already exists: $new_data"); - // return; - // } else { - // $old_data = $latestHist->new_data; - // } - // }else{ - // $old_data = $latestIGRChildForHist; - // } - // }} - - - - // // Prepare history entry - // $igr_history = [ - // 'field' => $field, - // 'new_data' => $new_data, - // 'old_data' => $old_data, - // 'history_dated' => get_current_date_time(), - // 'by' => $this->session->get('userId'), - // 'IGR_No' => $igr_no, - // 'IGRItem_No' => $igr_item_no, - // 'is_edit' => ($old_data !== NULL) ? 1 : 0, - // 'is_add' => ($old_data === NULL) ? 1 : 0 - // ]; - - // // Insert history entry - // $history_id = $this->inwardgateregister_model->igr_history($igr_history); - // if ($history_id) { - // log_message('error', "History updated successfully for IGR No: $igr_no, Item No: $igr_item_no, Field: $field. History ID: $history_id"); - // } else { - // log_message('error', "Failed to update history for IGR No: $igr_no, Item No: $igr_item_no, Field: $field."); - // } - // } - public function saveIGRHistory($hist) { - - // Extract fields from the input array - $field = $hist['key']; - $igr_no = $hist['igr_no']; - $igr_item_no = $hist['igr_item_no']; - $new_data = $hist['value']; // Incoming new value - $old_data = null; // Default old value is null - - log_message('error', "Save History function entered for IGR No: $igr_no, Item No: $igr_item_no, Field: $field."); - - // Fetch the latest history record for the field - $latestHist = $this->inwardgateregister_model->get_igr_history($field, $igr_no, $igr_item_no); - - - // Fetch the current value from the master or child table - if (empty($igr_item_no)) { - $current_data = $this->inwardgateregister_model->get_igr_master_for_history($field, $igr_no); - } else { - $current_data = $this->inwardgateregister_model->get_igr_child_for_history($field, $igr_no, $igr_item_no); + foreach ($request as $key => $value) { + foreach ($dbIGRMaster as $key1 => $value1) { + if ($value1 != $value && $key1 == $key) { + $value = ($key1 == "IGRStatus") ? $this->inwardgateregister_model->get_status($value) : $value; + $value1 = ($key1 == "IGRStatus") ? $this->inwardgateregister_model->get_status($value1) : $value1; + // Store each changed field in an array + $history_entries[] = [ + 'field' => $key1, + 'new_data' => $value, + 'old_data' => $value1, + 'history_dated' => get_current_date_time(), + 'by' => $this->session->get('userId'), + 'IGR_No' => $IGRNo, + 'IGRItem_No' => NULL, + 'is_edit' => 1, + ]; + } + } } - // Determine the old_data - if (!empty($latestHist)) { - // If history exists, use the latest new_data as old_data - $old_data = $latestHist->new_data; - } else { - // If no history exists, use the current data from the master/child table as old_data - $old_data = $current_data; + // Insert all history entries + foreach ($history_entries as $entry) { + $history_id = $this->inwardgateregister_model->igr_history($entry); + if ($history_id) { + log_message('error', "History updated successfully for IGR No: $IGRNo, Field: {$entry['field']}. History ID: $history_id"); + } else { + log_message('error', "Failed to update history for IGR No: $IGRNo, Field: {$entry['field']}"); + } } + } - // Check if the new_data is different from the old_data - if ($new_data == $old_data) { - log_message('error', "No update needed for IGR No: $igr_no, Item No: $igr_item_no, Field: $field. Data already exists: $new_data"); - return; // No need to insert history if data hasn't changed - } + public function saveIGRLineitemHistory($request, $IGRNo, $IGRLineItem) { + $dbIGRChild = $this->inwardgateregister_model->get_igr_child_for_history($IGRNo, $IGRLineItem); + $history_entries = []; - // Prepare history entry - $igr_history = [ - 'field' => $field, - 'new_data' => $new_data, - 'old_data' => $old_data, - 'history_dated' => get_current_date_time(), - 'by' => $this->session->get('userId'), - 'IGR_No' => $igr_no, - 'IGRItem_No' => $igr_item_no, - 'is_edit' => ($old_data !== null) ? 1 : 0, // 1 if it's an edit, 0 if it's an add - 'is_add' => ($old_data === null) ? 1 : 0 // 1 if it's an add, 0 if it's an edit - ]; + foreach ($request as $key => $value) { + foreach ($dbIGRChild as $key1 => $value1) { + if ($value1 != $value && $key1 == $key) { + // Store each changed field in an array + $history_entries[] = [ + 'field' => $key1, + 'new_data' => $value, + 'old_data' => $value1, + 'history_dated' => get_current_date_time(), + 'by' => $this->session->get('userId'), + 'IGR_No' => $IGRNo, + 'IGRItem_No' => $IGRLineItem, + 'is_edit' => 1, + ]; + } + } + } - // Insert history entry - $history_id = $this->inwardgateregister_model->igr_history($igr_history); - if ($history_id) { - log_message('error', "History updated successfully for IGR No: $igr_no, Item No: $igr_item_no, Field: $field. History ID: $history_id"); - } else { - log_message('error', "Failed to update history for IGR No: $igr_no, Item No: $igr_item_no, Field: $field."); - } -} - - - + // Insert all history entries + foreach ($history_entries as $entry) { + $history_id = $this->inwardgateregister_model->igr_history($entry); + if ($history_id) { + log_message('error', "History updated successfully for IGR No: $IGRNo, Item No: $IGRLineItem, Field: {$entry['field']}. History ID: $history_id"); + } else { + log_message('error', "Failed to update history for IGR No: $IGRNo, Item No: $IGRLineItem, Field: {$entry['field']}"); + } + } + } } \ No newline at end of file diff --git a/app/Controllers/Payslip.php b/app/Controllers/Payslip.php index 5e3aae25..f790bb11 100755 --- a/app/Controllers/Payslip.php +++ b/app/Controllers/Payslip.php @@ -10,6 +10,7 @@ use CodeIgniter\Validation\Exceptions\ValidationException; use App\Models\Monthlypay_model; use App\Models\Payroll_model; +use App\Models\Driver_model; use Mpdf\Mpdf; use PhpOffice\PhpSpreadsheet\Spreadsheet; @@ -33,6 +34,7 @@ class Payslip extends BaseController { protected $payroll_model; protected $monthlypay_model; + protected $driver_model; protected $session; /** @@ -43,6 +45,7 @@ class Payslip extends BaseController parent::__construct(); $this->payroll_model = new Payroll_model(); $this->monthlypay_model = new Monthlypay_model(); + $this->driver_model = new Driver_model(); $this->session = session(); helper('form'); //$this->load->library('form_validation'); $this->isLoggedIn(); @@ -590,20 +593,20 @@ class Payslip extends BaseController public function monthlyInputs() { - $current = date("m-Y"); - + $current = $this->request->getPost('monthyear') ? $this->request->getPost('monthyear') :date("m-Y"); $data['month'] = $this->monthlypay_model->monthlyListing($current); $data['dropdownvalue'] = $current; $data['fresh'] = $this->monthlypay_model->getEmpPayDetailsforMonthInputs($current); - + // dd($data['fresh']); + $data['drivermonthinputs'] = $this->driverMonthlyPayInputs($current); $employeeSalary = []; $esi = []; $pf = []; $ot = []; foreach ($data['fresh'] as $value) { - + $is_driver = $value->is_driver; $NoofDays = $value->NoofDays; //Month day 30,31,28 $HRA_Amount = $value->HRA_Amount; $Basic_Pay = $value->Basic_Pay; @@ -623,6 +626,11 @@ class Payslip extends BaseController $Loan_Recovered = $value->Loan_Recovered; //MANUAL LOAN DUE $due_start_date = $value->DueDate; $paydate = $current; //From POST parm + if (strlen((string)$paydate) == 6) { + $paydate = '0' . $paydate; + } + $pmonth = substr($paydate, 0, 2); + $pyear = substr($paydate, -4); $pmonth = substr($paydate, 0, 2); $pyear = substr($paydate, -4); @@ -722,6 +730,158 @@ class Payslip extends BaseController $this->loadViews("monthlypayinputs", $this->global, $data, NULL); } + public function driverMonthlyPayInputs($current) + { + + list($month, $year) = explode('-', $current); + + $month_in_number = get_date_time_dynamical_format('n','m',"$month");// refer helper + + $get_last_date_of_the_month = cal_days_in_month(CAL_GREGORIAN, $month_in_number, $year); + + $from_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"01-$month_in_number-$year"); + $to_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"$get_last_date_of_the_month-$month_in_number-$year"); + + // $data['monthinputs'] + $load_driver_data = $this->driver_model->driverAttendanceForMonthlyPayInputs($from_mysql_date,$to_mysql_date); + // dd($load_driver_data); + + + $format_month_year = get_date_time_dynamical_format('n-Y','m-Y',"$current"); + + $monthly_pay_data = $this->driver_model->driverMonthlyPayInputs($format_month_year); + + + + // both foreach refer with chatgpt array data replacement.... + $monthly_pay_array = []; + foreach ($monthly_pay_data as $row) { + $monthly_pay_array[$row->driver_id] = $row; + } + + for ($i = 0; $i < count((array)$load_driver_data); $i++) { + $driver_id = $load_driver_data[$i]->driver_id; + if (isset($monthly_pay_array[$driver_id])) { + + $PF_Rate = $load_driver_data[$i]->PF_Rate; + $ESI_Rate = $load_driver_data[$i]->ESI_Rate; + + $monthly_salary_amount = isset($load_driver_data[$i]->monthly_salary_amount) ? (int)$load_driver_data[$i]->monthly_salary_amount : 0; + $monthly_food_amount = isset($load_driver_data[$i]->monthly_food_amount) ? (int)$load_driver_data[$i]->monthly_food_amount : 0; + $final_salary_amount = $monthly_salary_amount+$monthly_food_amount; + + $shed = isset($load_driver_data[$i]->shed_amount) ? (int)$load_driver_data[$i]->shed_amount : 0; + $diesel = isset($load_driver_data[$i]->diesel_amount) ? (int)$load_driver_data[$i]->diesel_amount : 0; + + $load_driver_data[$i]->driver_salary = $final_salary_amount; + $load_driver_data[$i]->driver_shed = $shed; + $load_driver_data[$i]->driver_diesel = $diesel; + + $Monthly_Due = $load_driver_data[$i]->Monthly_Due; // AUTO LOAN DUE + $Loan_Recovered = $load_driver_data[$i]->Loan_Recovered; //MANUAL LOAN DUE + $loan = 0; + $due_start_date = $load_driver_data[$i]->DueDate; + $paydate = $current; //From POST parm + if ($Loan_Recovered == 'NA') { + $loan = 0.00; + } else if ($Loan_Recovered == 0.00) { + if (strtotime($due_start_date) <= strtotime($to_mysql_date)) { + $loan = $Monthly_Due; + } + } else if ($Loan_Recovered >= 0.00) { + if (strtotime($due_start_date) <= strtotime($to_mysql_date)) { + $loan = $Loan_Recovered; + } + } + + $Loan_amount = $load_driver_data[$i]->Loan_Amount; + $Paid_Amount = $load_driver_data[$i]->Paid_Amount; + $Balance_Amount = $Loan_amount - $Paid_Amount; + if ($Monthly_Due > $Balance_Amount) { + $loan = $Balance_Amount; + } + + $empSalaryAdd = $final_salary_amount+$shed+$diesel; + $empSalarySub = $loan; + $salaryInCurrentday = $empSalaryAdd - $empSalarySub; + $load_driver_data[$i]->driver_final_payment = $salaryInCurrentday; + + $load_driver_data[$i]->payroll_id = $monthly_pay_array[$driver_id]->payroll_id; + $load_driver_data[$i]->Festival_Bonus = $monthly_pay_array[$driver_id]->Festival_Bonus; + + $basic = ($final_salary_amount+$shed+$diesel) * 70 / 100; + $hra = ($final_salary_amount+$shed+$diesel) * 30 / 100; + + $load_driver_data[$i]->basic_worked = $basic; + $load_driver_data[$i]->hra_worked = $hra; + + $load_driver_data[$i]->esi_amount = ($load_driver_data[$i]->esi_applicable == 1) ? ($basic) * $ESI_Rate / 100 : 0; + $load_driver_data[$i]->pf_amount = ($load_driver_data[$i]->pf_applicable == 1) ? ($basic) * $PF_Rate / 100 : 0; + $load_driver_data[$i]->total_cal_days = $get_last_date_of_the_month; + + }else { + $PF_Rate = $load_driver_data[$i]->PF_Rate; + $ESI_Rate = $load_driver_data[$i]->ESI_Rate; + + $monthly_salary_amount = isset($load_driver_data[$i]->monthly_salary_amount) ? (int)$load_driver_data[$i]->monthly_salary_amount : 0; + $monthly_food_amount = isset($load_driver_data[$i]->monthly_food_amount) ? (int)$load_driver_data[$i]->monthly_food_amount : 0; + $final_salary_amount = $monthly_salary_amount+$monthly_food_amount; + $shed = isset($load_driver_data[$i]->shed_amount) ? (int)$load_driver_data[$i]->shed_amount : 0; + $diesel = isset($load_driver_data[$i]->diesel_amount) ? (int)$load_driver_data[$i]->diesel_amount : 0; + + $load_driver_data[$i]->driver_salary = $final_salary_amount; + $load_driver_data[$i]->driver_shed = $shed; + $load_driver_data[$i]->driver_diesel = $diesel; + + $load_driver_data[$i]->payroll_id = ''; + $load_driver_data[$i]->Festival_Bonus = 0; + + $basic = ($final_salary_amount+$shed+$diesel) * 70 / 100; + $hra = ($final_salary_amount+$shed+$diesel) * 30 / 100; + $load_driver_data[$i]->basic_worked = $basic; + $load_driver_data[$i]->hra_worked = $hra; + + $load_driver_data[$i]->esi_amount = ($load_driver_data[$i]->esi_applicable == 1) ? ($basic) * $ESI_Rate / 100 : 0; + $load_driver_data[$i]->pf_amount = ($load_driver_data[$i]->pf_applicable == 1) ? ($basic) * $PF_Rate / 100 : 0; + + + $Monthly_Due = $load_driver_data[$i]->Monthly_Due; // AUTO LOAN DUE + $Loan_Recovered = $load_driver_data[$i]->Loan_Recovered; //MANUAL LOAN DUE + $loan = 0; + $due_start_date = $load_driver_data[$i]->DueDate; + $paydate = $current; //From POST parm + if ($Loan_Recovered == 'NA') { + $loan = 0.00; + } else if ($Loan_Recovered == 0.00) { + if (strtotime($due_start_date) <= strtotime($to_mysql_date)) { + $loan = $Monthly_Due; + } + } else if ($Loan_Recovered >= 0.00) { + if (strtotime($due_start_date) <= strtotime($to_mysql_date)) { + $loan = $Loan_Recovered; + } + } + + $Loan_amount = $load_driver_data[$i]->Loan_Amount; + $Paid_Amount = $load_driver_data[$i]->Paid_Amount; + $Balance_Amount = $Loan_amount - $Paid_Amount; + if ($Monthly_Due > $Balance_Amount) { + $loan = $Balance_Amount; + } + + $empSalaryAdd = $final_salary_amount; + $empSalarySub = $loan; + $salaryInCurrentday = $empSalaryAdd - $empSalarySub; + $load_driver_data[$i]->driver_final_payment = $salaryInCurrentday+$shed+$diesel; + $load_driver_data[$i]->total_cal_days = $get_last_date_of_the_month; + + } + } + // dd($load_driver_data); + return $load_driver_data; + + } + function changeMonth() { @@ -857,6 +1017,11 @@ class Payslip extends BaseController $data['esi'] = $esi; $data['pf'] = $pf; $data['over_time'] = $ot; + + + + + // dd($data); //echo sizeof($data['fresh'])."-".sizeof($data['empSalary']);die; $this->global['pageTitle'] = 'Payroll Monthly Inputs'; @@ -892,7 +1057,6 @@ class Payslip extends BaseController $month = $mon . "-" . $year; - //echo $month;die(); $total = 0; $ErrorEmpId = ''; $TotalErrorFlag = 0; @@ -1002,6 +1166,7 @@ class Payslip extends BaseController $EmpID = $j['Emp ID']; + $is_driver = $this->driver_model->getDriverName($EmpID,1); $DaysWorked = $j['Days Worked']; $TotalCalDays = isset($j['Total Days']) ? $j['Total Days'] : 0.00 ; $ActualSalary = isset($j['Basic Salary']) ? $j['Basic Salary'] : 0.00 ; @@ -1020,8 +1185,11 @@ class Payslip extends BaseController $Festival_Bonus = isset($j['Festival Bonus in ₹']) ? $j['Festival Bonus in ₹'] : 0.00; $tds_Deductions = isset($j['TDS Deductions in ₹']) ? $j['TDS Deductions in ₹'] : 0.00; $Estimate = isset($j['Estimate in ₹']) ? $j['Estimate in ₹'] : 0.00; - $Created_By = $this->session->get('userId'); + $Created_By = $this->session->get('userId'); + if($is_driver == 0){ + + $monthlypaydata = array( 'Month_Year' => $month, 'EmpID' => $EmpID, @@ -1046,6 +1214,40 @@ class Payslip extends BaseController ); // print_r($monthlypaydata); die; $result = $this->monthlypay_model->saveMonthlyData_model($monthlypaydata); + + }else{ + + $get_last_date_of_the_month = cal_days_in_month(CAL_GREGORIAN, $mon, $year); + $from_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"01-$mon-$year"); + $to_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"$get_last_date_of_the_month-$mon-$year"); + $load_driver_data = $this->driver_model->driverAttendanceForMonthlyPayInputs($from_mysql_date,$to_mysql_date); + $Food = isset($load_driver_data[0]->monthly_food_amount) ? (int)$load_driver_data[0]->monthly_food_amount : 0; + $Shed = isset($load_driver_data[0]->shed_amount) ? (int)$load_driver_data[0]->shed_amount : 0; + $Diesel = isset($load_driver_data[0]->diesel_amount) ? (int)$load_driver_data[0]->diesel_amount : 0; + + $drivermonthlypaydata = array( + 'month_year'=>$month, + 'driver_id'=>$EmpID, + 'no_of_loads'=>(strpos($TotalCalDays, "(trip)") !== false) ? explode(" ", $TotalCalDays)[0] : 0, + 'monthly_food_amount'=>$Food, + 'total_diesel_amount'=>$Diesel, + 'total_shed_amount'=>$Shed, + 'monthly_salary_amount'=>($Basic+$Food), + 'final_payment'=>$Estimate, + 'HRA'=>$HRA, + 'ESI'=>$ESI, + 'PF'=>$PF, + 'Festival_Bonus'=>$Festival_Bonus, + 'Loan_Recovered'=>$Loan_Recovered, + 'created_by'=>$Created_By, + 'updated_by'=>$Created_By + + ); + + // print_r($drivermonthlypaydata);die; + $result = $this->driver_model->saveMonthlyData($drivermonthlypaydata); + + } $total = $total + $result; } } @@ -1091,6 +1293,7 @@ class Payslip extends BaseController public function viewGenerator() { + $Data['Payon'] = $this->payroll_model->getPayOn(); $this->global['pageTitle'] = 'Payroll Generater'; @@ -1112,7 +1315,11 @@ class Payslip extends BaseController { $id = $this->request->getPost('id1'); - $result = $this->payroll_model->getEmployeelist2($id); + $employee = $this->payroll_model->getEmployeelist2($id); + $driver = $this->driver_model->getDriverlist2($id); + + $result = array_merge($employee, $driver); + $HTML = ""; @@ -1120,8 +1327,7 @@ class Payslip extends BaseController foreach ($result as $list) { - - $HTML .= ""; + $HTML .= ""; } } echo $HTML; @@ -1172,6 +1378,7 @@ class Payslip extends BaseController $y = substr((string)$Payon, 3); + // if condition for all while checkbox is checked means. if ($All != '') { $filename = 'PayslipFor-' . $m . '-' . $y; $result = $this->payroll_model->getEmpAll($Payon); @@ -1196,6 +1403,26 @@ class Payslip extends BaseController } } else { $EmpID = $this->request->getPost('Employee'); + // $EmpID = "RIPL136"; + $is_driver = $this->driver_model->getDriverName($EmpID,1); + // print_r($is_driver);die; + if($is_driver == "1"){ + $Data['PayDetails'] = $this->driver_model->GetPayslipdata($Payon, $EmpID); + // print_r($Data['PayDetails']);die; + + $name = $Data['PayDetails'][0]->driver_name; + $filename = 'PayslipFor-' . $EmpID . ' ' . $name . ' ' . $m . ' ' . $y; + + $totalsalary = $Data['PayDetails'][0]->final_payment; + $totalsalaryinwords = $this->convertNumberToWords(round($totalsalary)); + $Data['amtinwords'] = $totalsalaryinwords; + $currentDayBasic = isset($Data['PayDetails'][0]->monthly_salary_amount) ? $Data['PayDetails'][0]->monthly_salary_amount : 0; + $PF_Rate = $Data['PayDetails'][0]->PF_Rate; + $ESI_Rate = $Data['PayDetails'][0]->ESI_Rate; + $Data['esi_amount'] = ($Data['PayDetails'][0]->esi_applicable == 1) ? $currentDayBasic * $ESI_Rate / 100 : 0; + $Data['pf_amount'] = ($Data['PayDetails'][0]->pf_applicable == 1) ? $currentDayBasic * $PF_Rate / 100 : 0; + $html = view("driverPayslipGeneratePrint", $Data); + }else{ //echo "EmpID" . $EmpID; $Data['PayDetails'] = $this->payroll_model->GetPayslipdata($Payon, $EmpID); @@ -1210,6 +1437,8 @@ class Payslip extends BaseController // echo view("payslipgenerateprint", $Data);die; $html = view("payslipgenerateprint", $Data); } + + } $mpdf = new Mpdf([ @@ -1231,7 +1460,7 @@ class Payslip extends BaseController $mpdf->WriteHTML($html); $mpdf->SetTitle('Resico:Payslip'); - $mpdf->Output("Payslip-" . $filename . ".pdf", 'D'); + $mpdf->Output("Payslip-" . $filename . ".pdf", 'D'); } @@ -1530,10 +1759,24 @@ class Payslip extends BaseController { $empid = $this->request->getPost('employee'); $payon = $this->request->getPost('payon'); - $result = $this->payroll_model->checkExistPayData($empid, $payon); - echo json_encode(count($result)); + $is_driver = $this->driver_model->getDriverName($empid,1); + if($is_driver){ + $result = $this->driver_model->checkDriverExistPay($empid, $payon); + $data['count'] = count($result); + $data['path'] = "driverPayslip"; + echo json_encode($data); + }else{ + $result = $this->payroll_model->checkExistPayData($empid, $payon); + $data['count'] = count($result); + $data['path'] = "payslip/callsp"; + echo json_encode($data); + } + + } + + function convertNumber($amt) diff --git a/app/Controllers/Purchaseorder.php b/app/Controllers/Purchaseorder.php index e96f797a..ee194634 100755 --- a/app/Controllers/Purchaseorder.php +++ b/app/Controllers/Purchaseorder.php @@ -1226,7 +1226,8 @@ class Purchaseorder extends BaseController $AfterSgst = $this->request->getPost('RevenueAfterSgst' . $i); $AfterIgst = $this->request->getPost('RevenueAfterIgst' . $i); $LineitemAuditorNotes = $this->request->getPost('LineItemNoteForAuditor' . $i); - + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; if (count($comma_separated) > 0) { for ($j = 1; $j < count($comma_separated); $j++) { @@ -1437,7 +1438,8 @@ class Purchaseorder extends BaseController $this->purchaseorder_model->insertlogpo($logpo); } - + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; if (count($comma_separated) > 0) { for ($j = 1; $j < count($comma_separated); $j++) { @@ -1962,7 +1964,7 @@ class Purchaseorder extends BaseController $this->purchaseorder_model->DeletePOServiceTax($LineItemNo); } $this->purchaseorder_model->DeletePOLineItem($LineItemNo, $ReqNo, $MaterialCode); - echo "Successfully Deleted the Line item" . $LineItemNo; + echo "Successfully Deleted the Line item " . $LineItemNo; } @@ -2111,6 +2113,8 @@ class Purchaseorder extends BaseController $per = $this->request->getPost('Per' . $i); $LineitemAuditorNotes = $this->request->getPost('LineItemNoteForAuditor' . $i); + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; if (count($comma_separated) > 0) { for ($j = 1; $j < count($comma_separated); $j++) { @@ -2452,6 +2456,8 @@ class Purchaseorder extends BaseController //die(); $currencytypeID = $this->request->getPost('currencytype'); + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; if (count($comma_separated) > 0) { for ($j = 1; $j < count($comma_separated); $j++) { @@ -2839,6 +2845,8 @@ class Purchaseorder extends BaseController $CapitalItemDescription = $this->request->getPost('CapitalItemDescrition' . $i); $Per = $this->request->getPost('per' . $i); $LineitemAuditorNotes = $this->request->getPost('LineItemNoteForAuditor' . $i); + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; if (count($comma_separated) > 0) { for ($j = 1; $j < count($comma_separated); $j++) { @@ -3189,7 +3197,8 @@ class Purchaseorder extends BaseController /*----------end--------------------*/ - + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; if (count($comma_separated) > 0) { for ($j = 1; $j < count($comma_separated); $j++) { @@ -3279,7 +3288,8 @@ class Purchaseorder extends BaseController } else { $LineItemNo = $POLineItemNo; - + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $POLineItemList = array('PONO' => $PONO, 'ReqNo' => $Reqnumber, 'MaterialCode' => $MaterialCode, 'Quantity' => $Quantity, 'Rate' => $itemRate, 'Status' => $LineItemStatus, 'CreatedBy' => $CreateBy, 'CostCenterCode' => $CostCenter, 'ServiceMaterialDescription' => $CapitalItemDescription, 'Per' => $Per,'LineitemAuditorNotes'=>$LineitemAuditorNotes); $POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO, $LineItemNo, $POLineItemList); @@ -4488,6 +4498,7 @@ class Purchaseorder extends BaseController $supplierid = $this->request->getPost('supplierid'); $materialcode = $this->request->getPost('materialcode'); $result = $this->purchaseorder_model->VerifyWithSupplierForPendingPO($supplierid, $materialcode); + $materialrate = $this->purchaseorder_model->materialRate($materialcode); $response = ""; if (!empty($result)) { diff --git a/app/Controllers/Rawmaterialdetails.php b/app/Controllers/Rawmaterialdetails.php index e05b1b11..679b5cec 100755 --- a/app/Controllers/Rawmaterialdetails.php +++ b/app/Controllers/Rawmaterialdetails.php @@ -248,9 +248,9 @@ class Rawmaterialdetails extends BaseController } $HSNcode = ($HSN == '') ? null : $HSN; - + $material_rate = $this->request->getPost('material_rate'); - $RawMaterial = array('MaterialName' => $MaterialName, 'MaterialType' => $MaterialType, 'UOM' => $UOM, 'Category' => $MaterialCategory, 'CreatedBy' => $CreatedBy, 'Remarks' => $Remarks, 'HSNCODE' => $HSNcode, 'stock' => $stock, 'stockdate' => $stockdate, 'reorder' => $reorder, 'Current_stock' => $currentstock); + $RawMaterial = array('MaterialName' => $MaterialName, 'MaterialType' => $MaterialType, 'UOM' => $UOM, 'Category' => $MaterialCategory, 'CreatedBy' => $CreatedBy, 'Remarks' => $Remarks, 'HSNCODE' => $HSNcode, 'stock' => $stock, 'stockdate' => $stockdate, 'reorder' => $reorder, 'Current_stock' => $currentstock, 'material_rate'=>$material_rate); //print_r($RawMaterial);die(); $result = $this->rawmaterialdetails_model->addNewRawMaterial($RawMaterial); @@ -310,6 +310,7 @@ class Rawmaterialdetails extends BaseController $MaterialType = $this->request->getPost('MaterialType'); $MaterialCategory = $this->request->getPost('MaterialCategory'); $materialcategoryarray = $this->rawmaterialdetails_model->getmaterialCategory(); + $material_rate = $this->request->getPost('material_rate'); foreach ($materialcategoryarray as $mc) { $TempArr[] = $mc->ConfigValue; @@ -330,14 +331,15 @@ class Rawmaterialdetails extends BaseController $stock = $this->request->getPost('openstock'); $reorder = $this->request->getPost('reorder'); $stockdate = $this->request->getPost('Date'); - $stockdate = (empty($stockdate)) ? NULL : format_date($stockdate,0,"Y-m-d"); + $stockdate = (empty($stockdate)) ? NULL : get_date_time_dynamical_format('d-m-Y','Y-m-d',"$stockdate"); $chked = $this->request->getPost('isactive'); $IsActive = ($chked != '') ? '1' : '0'; $HSNcode = ($HSN == '') ? null : $HSN; $RawMaterial = array(); - $RawMaterial = array('MaterialName' => $MaterialName, 'MaterialType' => $MaterialType, 'UpdatedBy' => $UpdatedBy, 'UOM' => $UOM, 'IsActive' => $IsActive, 'Category' => $MaterialCategory, 'Remarks' => $Remarks, 'HSNCODE' => $HSNcode, 'stock' => $stock, 'stockdate' => $stockdate, 'reorder' => $reorder); //,'RMCode'=>$rmcode); + $RawMaterial = array('MaterialName' => $MaterialName, 'MaterialType' => $MaterialType, 'UpdatedBy' => $UpdatedBy, 'UOM' => $UOM, 'IsActive' => $IsActive, 'Category' => $MaterialCategory, 'Remarks' => $Remarks, 'HSNCODE' => $HSNcode, 'stock' => $stock, 'stockdate' => $stockdate, 'reorder' => $reorder,'material_rate'=>$material_rate); //,'RMCode'=>$rmcode); + // print_r($RawMaterial);die; $result = $this->rawmaterialdetails_model->editRawmaterial($RawMaterial, $MaterialCode); @@ -370,7 +372,7 @@ class Rawmaterialdetails extends BaseController $materialCode = $data['materialCode'] ?? ''; $materialName = str_replace(' ', '', $data['materialName']); $materialCategory = $data['materialCategory'] ?? ''; - + $query = $this->rawmaterialdetails_model->checkMaterialExists($materialCode , $materialName , $materialCategory); return $this->response->setJSON($query); diff --git a/app/Controllers/Servicepurchaseorder.php b/app/Controllers/Servicepurchaseorder.php index 6f810d46..9207e172 100755 --- a/app/Controllers/Servicepurchaseorder.php +++ b/app/Controllers/Servicepurchaseorder.php @@ -341,7 +341,7 @@ class Servicepurchaseorder extends BaseController } } } - echo 'Service Purchase Order Created Successfully!The PO NO Is: ' . $PONO; + echo 'Service Purchase Order Created Successfully! PO Number Is: ' . $PONO; } //update service po function UpdateServicePurchaseOrder() diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php index 08de9d9d..c3b26a66 100644 --- a/app/Controllers/StockController.php +++ b/app/Controllers/StockController.php @@ -17,6 +17,8 @@ use App\Models\BagStockDetailsModel; use App\Models\DustAndRoughModel; use App\Models\ResinStockModel; use App\Models\GasStockModel; +use App\Models\TrpAbstract; +use App\Models\TrpAbstractParticulars; use App\Models\TrpSandUseStockModel; use App\Models\TrpProductionModel; use App\Models\TrpProductionMaintenanceModel; @@ -27,6 +29,7 @@ use App\Models\PowerConsumptionSummaryModel; + use CodeIgniter\HTTP\ResponseInterface; use DateTime; use DatePeriod; @@ -65,6 +68,11 @@ class StockController extends BaseController protected $employeedetails_model; + protected $trpAbstractParticularsModel ; + + protected $trpAbstractModel ; + + /** * This is default constructor of the class */ @@ -113,6 +121,10 @@ class StockController extends BaseController $this->powerConsumptionSummary_model = new PowerConsumptionSummaryModel(); + $this->trpAbstractParticularsModel = new TrpAbstractParticulars(); + + $this->trpAbstractModel = new TrpAbstract(); + $this->session = session(); helper('form'); @@ -1717,12 +1729,14 @@ class StockController extends BaseController - $data['trpProductionDetails'] = $this->TrpProduction_model->trpProductionDetails($startDate,$endDate); + $result = $this->TrpProduction_model->trpProductionDetails($startDate,$endDate); + $data['trpProductionDetails'] = $result[0] ; - // dd($data['trpProductionDetails']); + $data['crsClientList'] = $result[1] ; + + $data['wcsSupplierList'] = $result[2] ; - // dd($this->db->getLastQuery()); $date = DateTime::createFromFormat('Y-m', $month); @@ -1737,8 +1751,6 @@ class StockController extends BaseController return $this->loadViews("stock/trpProductionStockDetails", $this->global, $data, NULL); - - } @@ -1749,11 +1761,9 @@ class StockController extends BaseController { - $postData = json_decode($this->request->getPost('updateTrpProductionDetails')); - - - //converting std class object to associative array.. - $postData['updateTrpProductionDetails'] = json_decode(json_encode($postData), true); + $postData['updateTrpProductionDetails'] = json_decode($this->request->getPost('updateTrpProductionDetails'),true); + + if (empty($postData['updateTrpProductionDetails'])) { if (empty($inserts)) { @@ -1907,6 +1917,7 @@ class StockController extends BaseController { $datesInMonth = []; $inserts = []; + $trpAbstract = [] ; $period = new DatePeriod( new DateTime($startDate), @@ -1920,6 +1931,25 @@ class StockController extends BaseController foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) { + if($datesInMonthIndex == 0){ + + $trpAbstractParticulars =$this->trpAbstractParticularsModel->findAll(); + + foreach($trpAbstractParticulars as $index => $trpAbstractParticular){ + + $trpAbstract[] = [ + 'date' => $dateInMonth , + 'abs_opening_stock' => 0 , + 'abs_physical_stock'=> 0 , + 'abs_remarks' => " " , + 'abs_particular_id' => $trpAbstractParticular['id'], + ]; + } + + + } + + $inserts[] = [ 'Date' => $dateInMonth, 'openingTime' => " ", @@ -2083,18 +2113,12 @@ class StockController extends BaseController public function addOrEditdrierMachineDetails() { - $drierData = json_decode($this->request->getPost('drierData'), true) ?? []; + - // If drierData is empty, check for additionalEntry - if (empty($drierData)) { - $additionalEntry = $this->request->getPost(); - if (empty($additionalEntry)) { - echo "No data received."; - return; - } - - $drierData[] = $this->mapDrierEntry($additionalEntry); - } + $data = $this->request->getPost(); + + $drierData[] = $this->mapDrierEntry($data); + $this->db->transBegin(); try { @@ -2102,13 +2126,18 @@ class StockController extends BaseController $updates = []; foreach ($drierData as $row) { - $existingRow = $this->drierMachineDetails_model->where('id', $row['id'] ?? '')->first(); - $data = $this->mapDrierEntry($row, $existingRow); + $existingRow = $row['id']; + $data = $row; + - if ($existingRow) { + if (($existingRow)) { + // dd("inside update"); + $existingRow = $this->drierMachineDetails_model->where('id', $row['id'] ?? '')->first(); + $this->handleGasStockUpdate($existingRow, $row); $updates[] = $data; } else { + // dd("inside insert"); $this->updateGasStockConsumption($data['date'], $data['total_gas_consumption']); $inserts[] = $data; } @@ -2127,41 +2156,36 @@ class StockController extends BaseController } $this->db->transCommit(); - - // Redirect if additional entry was provided - if (!empty($additionalEntry)) { - $this->redirectToDrierMachineDetails($additionalEntry['date']); - return; + + return redirect()->to("/drierMachineDetails")->with('success', "Data Saved Successfully"); + + } catch (\Exception $error) { + $this->db->transRollback(); + return redirect()->back()->with('error', ' ' . $error->getMessage()); } - - echo "Data saved successfully. Warning..!! Kindly Update the next subsequent month Gas Stock If older month Gas Stock Updated..!!"; - } catch (\Exception $e) { - $this->db->transRollback(); - echo "Failed to save/Update data: " . $e->getMessage(); - } } /** * Maps input row to expected format. */ - private function mapDrierEntry(array $row, $existingRow = null): array + private function mapDrierEntry(array $data): array { return [ - 'id' => $existingRow['id'] ?? null, - 'date' => $this->convertToDateWithFlexibleFormats($row['date'], ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "Y-m-d"), - 'drier_on_time' => $row['drier_on_time'], - 'drier_off_time' => $row['drier_off_time'], - 'drier_running_hours' => $row['drier_running_hours'], - 'supplier_name' => $row['supplier_name'], - 'input_sand_moisture' => $row['input_sand_moisture'], - 'total_gas_consumption' => $row['total_gas_consumption'], - 'gas_per_ton' => $row['gas_per_ton'], - 'input_sand_qty' => $row['input_sand_qty'], - 'moisture_loss_qty' => $row['moisture_loss_qty'], - 'sand_dried_qty' => $row['sand_dried_qty'], - 'qty_per_hours' => $row['qty_per_hours'], - 'dust_qty' => $row['dust_qty'], - 'customer_name' => $row['customer_name'] + 'id' => $data['id'] ?? null, + 'date' => $this->convertToDateWithFlexibleFormats($data['date'], ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "Y-m-d"), + 'drier_on_time' => $data['drier_on_time'], + 'drier_off_time' => $data['drier_off_time'], + 'drier_running_hours' => $data['drier_running_hours'], + 'supplier_name' => $data['supplier_name'], + 'input_sand_moisture' => $data['input_sand_moisture'], + 'total_gas_consumption' => $data['total_gas_consumption'], + 'gas_per_ton' => $data['gas_per_ton'], + 'input_sand_qty' => $data['input_sand_qty'], + 'moisture_loss_qty' => $data['moisture_loss_qty'], + 'sand_dried_qty' => $data['sand_dried_qty'], + 'qty_per_hours' => $data['qty_per_hours'], + 'dust_qty' => $data['dust_qty'], + 'customer_name' => $data['customer_name'] ]; } @@ -2179,22 +2203,7 @@ class StockController extends BaseController } } - /** - * Redirects to the drier machine details page. - */ - private function redirectToDrierMachineDetails(string $date) - { - $postData = ['month' => $this->convertToDateWithFlexibleFormats($date, ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "M-Y")]; - - echo '
'; - foreach ($postData as $key => $value) { - echo ''; - } - echo '
'; - echo ''; - exit; - } - + function convertToDateWithFlexibleFormats($dateInput, array $inputFormats, string $outputFormat): ?string { @@ -2536,7 +2545,7 @@ class StockController extends BaseController $this->global['pageTitle'] = 'Diesel Machine Stock Details'; - // Get the previous month's last date resin stock details for next month updation + // Get the previous month's last date diesel stock details for next month updation $previousMonth = DateTime::createFromFormat('Y-m', $month)->modify('-1 month')->format('Y-m'); $previousMonthStartDate = "$previousMonth-01"; diff --git a/app/Models/Config_model.php b/app/Models/Config_model.php index ef2109e9..0bc2af59 100755 --- a/app/Models/Config_model.php +++ b/app/Models/Config_model.php @@ -229,15 +229,64 @@ class Config_model extends Model } public function getPONOcreatedBasedOnConfig($key_id){ - $builder = $this->db->table('t_purchaseorder_lineitem PL') - ->select('PL.PONO, MM.MaterialName, CD.ConfigValue as CategoryName') - ->join('t_materialmaster MM', 'MM.MaterialCode = PL.MaterialCode', 'left') - ->join('t_configdetails CD', 'CD.Key = MM.Category', 'left') - ->where('CD.Key', $key_id); + // $builder = $this->db->table('t_purchaseorder_lineitem PL') + // ->select('PL.PONO, MM.MaterialName, CD.ConfigValue as CategoryName') + // ->join('t_materialmaster MM', 'MM.MaterialCode = PL.MaterialCode', 'left') + // ->join('t_configdetails CD', 'CD.Key = MM.Category', 'left') + // ->where('CD.Key', $key_id); - $query = $builder->get(); - $result = $query->getResultArray(); - return $result; + // $query = $builder->get(); + // $result = $query->getResultArray(); + // return $result; + + + // return $this->db->table('t_purchaseorder_lineitem as pl') + // ->select('DISTINCT po.PONO, DATE_FORMAT(po.PODate, "%d-%m-%Y") as PODate, mm.MaterialName, CD.Key, CD.ConfigValue as CategoryName, s.StatusName, s.statusCode, po.POType, po.CapitalRange') + // ->join('t_purchaseorder_master po', 'po.PONO = pl.PONO') + // ->join('t_materialmaster mm', 'mm.MaterialCode = pl.MaterialCode') + // ->join('t_configdetails CD', 'CD.Key = mm.Category') + // ->join('t_status s', 's.statusCode = po.Status', 'left') // Left join + // ->where('CD.Key', $key_id) + // ->whereIn('po.Status', ['ST014', 'ST015', 'ST005', 'ST026', 'ST024', 'ST074', 'ST073']) + // ->orderBy('po.CreatedDate', 'DESC') + // ->get() + // ->getResultArray(); + + $subQuery = "SELECT DISTINCT po.PONO, DATE_FORMAT(po.PODate, '%d-%m-%Y') as PODate, + mm.MaterialName, CD.Key, CD.ConfigValue as CategoryName, + s.StatusName, s.statusCode, po.POType, po.CapitalRange, + CASE + WHEN s.statusCode = 'ST073' THEN 'OPEN ORDER PO' + WHEN s.statusCode = 'ST074' THEN 'IGR DRAFT' + WHEN s.statusCode = 'ST027' THEN 'IGR CREATED' + WHEN s.statusCode = 'ST024' THEN s.StatusName + WHEN s.statusCode = 'ST014' THEN 'PO DRAFT' + WHEN s.statusCode = 'ST015' THEN 'PO CREATED' + WHEN s.statusCode = 'ST005' THEN s.StatusName + WHEN s.statusCode = 'ST026' THEN 'PO RELEASED' + ELSE s.StatusName + END AS statusDescription + FROM t_purchaseorder_lineitem pl + JOIN t_purchaseorder_master po ON po.PONO = pl.PONO + JOIN t_materialmaster mm ON mm.MaterialCode = pl.MaterialCode + JOIN t_configdetails CD ON CD.Key = mm.Category + LEFT JOIN t_status s ON s.statusCode = po.Status + WHERE CD.Key = ? + AND po.Status IN (?, ?, ?, ?, ?, ?, ?) + ORDER BY po.CreatedDate DESC"; + +$query = $this->db->query($subQuery, [$key_id, 'ST014', 'ST015', 'ST005', 'ST026', 'ST024', 'ST074', 'ST073']); +$result = $query->getResultArray(); +return $result; + + // 'OPEN_ORDER_PO','ST073' + // 'IGR_DRAFT','ST074' + // 'IGR_CREATED','ST027' + // 'REQITEM_Emergency_PO_CREATED','ST024' + // 'PO_DRAFT','ST014' + // 'PO_CREATED','ST015' + // 'REQ_PO_CREATED','ST005' + // 'PO_RELEASED','ST026' } } \ No newline at end of file diff --git a/app/Models/Costcenter_model.php b/app/Models/Costcenter_model.php index 01c6d783..ad1290a1 100755 --- a/app/Models/Costcenter_model.php +++ b/app/Models/Costcenter_model.php @@ -399,7 +399,8 @@ where Dept.DEPCode not in } } - return "Cost center $CostCenterCode Reactivated successfully."; + // return "Cost center $CostCenterCode Reactivated successfully."; + return true; } function deleteCostCenter($CostCenterCode,$UpdatedBy) @@ -426,7 +427,8 @@ where Dept.DEPCode not in } } - return "Cost center $CostCenterCode deactivated successfully."; + // return "Cost center $CostCenterCode deactivated successfully."; + return true; } function checkCostCenter($CostCenterId,$CostCenterName){ diff --git a/app/Models/Driver_model.php b/app/Models/Driver_model.php index 843cd5e8..d0b5e716 100755 --- a/app/Models/Driver_model.php +++ b/app/Models/Driver_model.php @@ -21,7 +21,7 @@ class Driver_model extends Model { $this->table = 't_driver_attendance'; $this->primaryKey = 'driver_attendance_id'; - $this->allowedFields = ['driver_attendance_id','date','driver_id','invoice_number','vehicle_number','load_type','salary_amount','food_amount','created_on','created_by','updated_on','updated_by','isactive']; + $this->allowedFields = ['driver_attendance_id','date','driver_id','invoice_number','vehicle_number','load_type','salary_amount','food_amount','created_on','created_by','updated_on','updated_by','isactive','diesel_amount','shed_amount']; return $this; } @@ -47,11 +47,11 @@ class Driver_model extends Model return $this->table . '.' . $field; }, $this->allowedFields)); - $selectFields = "CONCAT_WS(' ', t_employee_details.FirstName, t_employee_details.LastName) AS FullName, t_employee_details.IsActive as employee_isactive, t_driver.driver_name,ip_clients.client_name as customer,ip_invoices.received_qty as quantity,t_driver_payroll.id as payroll_id,t_driver_payroll.PayOn," . $fields; + $selectFields = "CONCAT_WS(' ', t_employee_details.FirstName, t_employee_details.LastName) AS FullName, t_employee_details.IsActive as employee_isactive, CONCAT_WS(' ', driver.FirstName, driver.LastName) AS driver_name,ip_clients.client_name as customer,ip_invoices.received_qty as quantity,t_driver_payroll.id as payroll_id,t_driver_payroll.PayOn," . $fields; $month_year = get_date_time_dynamical_format('Y-m-d','m-Y',"$from"); return $this->select($selectFields) - ->join('t_driver', 't_driver.driver_id = ' . $this->table . '.driver_id', 'left') + ->join('t_employee_details as driver', 'driver.EmpID = ' . $this->table . '.driver_id', 'left') ->join('tbl_users', 'tbl_users.userId = ' . $this->table . '.created_by', 'left') ->join('t_employee_details', 'tbl_users.EmpID = t_employee_details.EmpID', 'left') ->join('ip_invoices', 'ip_invoices.invoice_number = ' . $this->table . '.invoice_number', 'left') @@ -60,6 +60,7 @@ class Driver_model extends Model ->where($this->table.'.date BETWEEN "'.$from.'" AND "'.$to.'"') ->where($this->table . '.driver_id', $driver_id) ->where($this->table . '.isactive', 1) + ->where('driver.is_driver', 1) ->findAll(); } @@ -71,17 +72,24 @@ class Driver_model extends Model return $query->getResult(); } - function getDriverName($id) + function getDriverName($id,$flag) { - $builder = $this->db->table('t_driver') - ->select('driver_name') - ->where('driver_id', $id); + $builder = $this->db->table('t_employee_details') + ->select('CONCAT_WS(" ", t_employee_details.FirstName, t_employee_details.LastName) as driver_name,is_driver') + ->where('EmpID', $id); $query = $builder->get()->getRow(); - $driver_name = $query ? $query->driver_name : null; - - return $driver_name; + if ($flag == 0){ + $driver_name = $query ? $query->driver_name : null; + return $driver_name; + } + if ($flag == 1){ + $is_driver = $query ? $query->is_driver : null; + return $is_driver; + } + return null; + } function gatheredCustAndQty($invoice){ @@ -92,20 +100,30 @@ class Driver_model extends Model $query = $builder->get(); return $query->getRowArray() ?: []; } - - + function driverAttendanceForMonthlyPayInputs($from,$to){ $builder = $this->db->table('t_driver_attendance') - ->select('t_driver_attendance.driver_id,SUM(t_driver_attendance.salary_amount) as driver_monthly_salary_amount,SUM(t_driver_attendance.food_amount) as driver_monthly_food_amount,t_driver.driver_name, - DATE_FORMAT(date, "%M-%Y") AS month_year,SUM(salary_amount + food_amount) AS driver_earnings_amount,COUNT(t_driver_attendance.load_type) AS no_of_loads') - ->join('t_driver', 't_driver.driver_id = t_driver_attendance.driver_id and t_driver.isactive = 1', 'left') + ->select('t_driver_attendance.driver_id,driver_details.FirstName as driver_name,driver_details.is_driver,COUNT(DISTINCT t_driver_attendance.date) AS unique_days, + DATE_FORMAT(date, "%M-%Y") AS month_year,COUNT(t_driver_attendance.load_type) AS no_of_loads,driver_details.*,t_emp_pay_data.PF_Rate,t_emp_pay_data.ESI_Rate') + ->select('SUM(t_driver_attendance.salary_amount) as monthly_salary_amount, + SUM(t_driver_attendance.food_amount) as monthly_food_amount, + diesel_amount,shed_amount,CONCAT_WS(" ", driver_details.FirstName, driver_details.LastName) AS FullName') + ->select('t_loan_master.Loan_ID,Loan_Amount,Loan_Issued_Date,Monthly_Due,Due_Start_Date as DueDate,No_of_Dues,Paid_Due,Remaining_Due,Paid_Amount,t_loan_history.Balance_Amount, t_driver_monthly_pay_inputs.Loan_Recovered') + ->join('t_employee_details as driver_details', 'driver_details.EmpID = t_driver_attendance.driver_id', 'left') + ->join('t_emp_pay_data','t_emp_pay_data.EmpID=driver_details.EmpID','Left') + ->join('t_loan_master','t_loan_master.EmpID = driver_details.EmpID','Left') + ->join('t_loan_history','t_loan_history.Loan_ID = t_loan_master.Loan_ID','Left') + ->join('t_driver_monthly_pay_inputs','t_driver_monthly_pay_inputs.driver_id = driver_details.EmpID','Left') ->where('t_driver_attendance.date BETWEEN "'.$from.'" AND "'.$to.'"') - ->groupBy('t_driver.driver_id, DATE_FORMAT(t_driver_attendance.date, "%M-%Y")'); - + ->groupBy('DATE_FORMAT(t_driver_attendance.date, "%M-%Y"),t_driver_attendance.driver_id'); $query = $builder->get(); + // $last_query = $this->db->getLastQuery(); + // echo $last_query;die; return $query->getResult(); } + + function driverMonthlyPayInputs($monthYear){ $builder = $this->db->table('t_driver_monthly_pay_inputs'); @@ -142,13 +160,13 @@ class Driver_model extends Model if ($count == 0) { - unset($data['updated_by']); + unset($data['updated_by']);// we need createdby. thats why updatedby unset $builder = $this->db->table('t_driver_monthly_pay_inputs'); $builder->insert($data); $i = $this->db->affectedRows(); return $i; } elseif ($count == 1) { - unset($data['created_by']); + unset($data['created_by']); // we need updatedby. thats why createdby unset $this->db->table('t_driver_monthly_pay_inputs') ->where('driver_id', $data['driver_id']) ->where('month_year', $data['month_year']) @@ -158,7 +176,21 @@ class Driver_model extends Model return $i; } } - + function updateDieselAndShedValuesBasedonEmpID($where_arr,$data){ + $this->db->table('t_driver_attendance') + ->where($where_arr) + ->update($data); + $i = $this->db->affectedRows(); + return $i; + } + public function getDriverAttendanceTable($input_driver_id,$monthyear){ + $builder = $this->db->table('t_driver_attendance') + ->where('DATE_FORMAT(`t_driver_attendance`.`date`, "%Y-%m")',$monthyear) + ->where('t_driver_attendance.driver_id',$input_driver_id); + $query = $builder->get()->getRow(); + // $last_query = $this->db->getLastQuery(); + return $query; + } function getPayOn() { $builder = $this->db->table('t_driver_monthly_pay_inputs') @@ -171,8 +203,8 @@ class Driver_model extends Model function getDriverlist2($Payon = '') { $builder = $this->db->table('t_driver_monthly_pay_inputs Pay') - ->select('Pay.driver_id as driver_id,driver.driver_name as name') - ->join('t_driver driver', 'Pay.driver_id = driver.driver_id'); + ->select('Pay.driver_id,driver.EmpID as EmpId,CONCAT_WS(" ", driver.FirstName, driver.LastName) AS FullName') + ->join('t_employee_details as driver', 'driver.EmpID = Pay.driver_id and driver.is_driver = 1', 'left'); if ($Payon != '') { $builder->where('Pay.month_year', $Payon); } @@ -196,14 +228,32 @@ class Driver_model extends Model function getMonthlyPayDetails($driver_id, $PayOn) { $builder = $this->db->table('t_driver_monthly_pay_inputs MonthlyPay ') - ->select('MonthlyPay.*') + ->select('CONCAT_WS(" ", driver.FirstName, driver.LastName) AS FullName') + ->select('MonthlyPay.*,driver.BankAccountNo , driver.PFNO , driver.ESI as ESINO , L.Loan_ID, L.Loan_Amount, L.Loan_Issued_Date, L.Monthly_Due, L.Due_Start_Date, L.No_of_Dues, L.Paid_Due, L.Remaining_Due, L.Paid_Amount') + ->join('t_employee_details as driver', 'driver.EmpID = MonthlyPay.driver_id and driver.is_driver = 1', 'left') + ->join('t_loan_master as L', 'MonthlyPay.driver_id = L.EmpID and L.is_Active = 1', 'left') ->where('MonthlyPay.driver_id', $driver_id) ->where('MonthlyPay.month_year', $PayOn); $query = $builder->get(); return $query->getResult(); } - + function insertLoanHistory($data) + { + $builder = $this->db->table('t_loan_history'); + $builder->insert($data); + $count = $this->db->affectedRows(); + return $count; + } + function updateLoan($LoanID,$EmpID,$data) + { + $builder = $this->db->table('t_loan_master') + ->where('Loan_ID', $LoanID) + ->where('EmpID', $EmpID) + ->update($data); + $count = $this->db->affectedRows(); + return $count; + } function insertPayroll($data) { $builder = $this->db->table('t_driver_payroll'); @@ -230,8 +280,17 @@ class Driver_model extends Model function GetPayslipdata($PayOn = '', $EmpId = '') { //echo "FROM MODEL" . $PayOn . $EmpId; - $builder = $this->db->table('t_driver_payroll Pay')->select('Pay.*,driver.driver_name as name ') - ->join('t_driver driver', 'Pay.driver_id = driver.driver_id'); + + + $builder = $this->db->table('t_driver_payroll Pay')->select('Pay.*') + ->select('Emp.EmpID,CONCAT_WS(" ", Emp.FirstName, Emp.LastName) as driver_name,Emp.DateofBirth as Dob,Emp.PANNo as Pan,Emp.BankBranchName as BankName,Emp.BankAccountNo as BankAccountNumber,Emp.IFSCCode as IFSCCode,Emp.DateofJoining as DOJ,Emp.AadharNo,Emp.Designation as Designation,Dep.DepartmentName as DeptName,Emp.esi_applicable,Emp.pf_applicable') + ->select('t_emp_pay_data.PF_Rate,t_emp_pay_data.ESI_Rate') + ->select('month.Festival_Bonus,month.HRA,month.Loan_Recovered,month.total_diesel_amount,month.total_shed_amount') + // ->select('month.monthly_salary_amount,month.monthly_food_amount,month.Festival_Bonus,month.final_payment,month.HRA,month.ESI,month.PF,month.Loan_Recovered,month.total_diesel_amount,month.total_shed_amount') + ->join('t_employee_details Emp', 'Pay.driver_id = Emp.EmpID') + ->join('t_departmentdetails Dep', 'Emp.Departmentcode = Dep.DEPCode') + ->join('t_emp_pay_data','t_emp_pay_data.EmpID=Emp.EmpID','Left') + ->join('t_driver_monthly_pay_inputs month', 'month.driver_id = Emp.EmpID'); if ($PayOn != '') { $builder->where('Pay.PayOn', $PayOn); } diff --git a/app/Models/Employeedetails_model.php b/app/Models/Employeedetails_model.php index 48e3eed2..a69ac2fa 100755 --- a/app/Models/Employeedetails_model.php +++ b/app/Models/Employeedetails_model.php @@ -172,6 +172,17 @@ class Employeedetails_model extends Model return $query; } + function checkMobileExists($ContactNumber= '', $Empid = ''){ + $builder = $this->db->table('t_employee_details')->select('ContactNumber') + ->where('ContactNumber', $ContactNumber); + if ($Empid != '') { + $builder->where('EmpID !=', $Empid); + } + $query = $builder->get(); + + return $query; + } + function checkAadharExists($aadharNo, $Empid = '') { diff --git a/app/Models/Inwardgateregister_model.php b/app/Models/Inwardgateregister_model.php index f8f6a1b3..f17ae0bd 100755 --- a/app/Models/Inwardgateregister_model.php +++ b/app/Models/Inwardgateregister_model.php @@ -221,6 +221,13 @@ class Inwardgateregister_model extends Model } public function igr_history($hsty_arr) { + $keysToRemove = ["UpdateBY", "MaterialRcvdDate", "DeliveryChellanDate"]; + foreach ($keysToRemove as $key) { + if (isset($hsty_arr[$key])) { + unset($hsty_arr[$key]); + } + } + $builder = $this->db->table('t_igr_history'); $builder->insert($hsty_arr); @@ -249,20 +256,12 @@ class Inwardgateregister_model extends Model return $result; } - function get_igr_master_for_history($field, $igr_no) { - $builder = $this->db->table('t_igr_master Master') - ->select("Master.$field"); // Select only the required field - if ($igr_no) { - $builder->where('Master.IGRNO', $igr_no); - } - $query = $builder->get(); - $result = $query->getRow(); - return $result ? $result->$field : null; // Return the field value directly + function get_igr_master_for_history($igr_no) { + return $this->db->table('t_igr_master Master')->where('Master.IGRNO', $igr_no)->get()->getRow(); } - function get_igr_child_for_history($field, $igr_no, $igr_item_no) { - $builder = $this->db->table('t_igr_details Child') - ->select("Child.$field"); // Select only the required field + function get_igr_child_for_history($igr_no, $igr_item_no) { + $builder = $this->db->table('t_igr_details Child'); // Select only the required field if ($igr_no) { $builder->where('Child.IGRNO', $igr_no); } @@ -271,7 +270,7 @@ class Inwardgateregister_model extends Model } $query = $builder->get(); $result = $query->getRow(); - return $result ? $result->$field : null; // Return the field value directly + return $result; // Return the field value directly } function addigrM($igrM) @@ -1097,17 +1096,19 @@ class Inwardgateregister_model extends Model { $builder = $this->db->table('t_igr_history'); - $builder->select('t_igr_history.*, CONCAT_WS(" ", t_employee_details.FirstName, t_employee_details.LastName) AS FullName'); + $builder->select('t_igr_history.*, DATE_FORMAT(t_igr_history.history_dated, "%d-%m-%Y") AS indian_date, DATE_FORMAT(t_igr_history.history_dated, "%h:%i:%s %p") AS indian_time, CONCAT_WS(" ", t_employee_details.FirstName, t_employee_details.LastName) AS FullName,t_materialmaster.MaterialName,t_materialmaster.MaterialName,t_materialmaster.MaterialCode'); $builder->join('tbl_users', 'tbl_users.userId = t_igr_history.by', 'left'); $builder->join('t_employee_details', 'tbl_users.EmpID = t_employee_details.EmpID', 'left'); - $builder->where('IGR_No', $igr); + $builder->join('t_igr_details', 'CONVERT(t_igr_history.IGRItem_No USING utf8) = CONVERT(t_igr_details.IGRItemNo USING utf8)', 'left'); + $builder->join('t_materialmaster', 'CONVERT(t_materialmaster.MaterialCode USING utf8) = CONVERT(t_igr_details.MaterialCode USING utf8)', 'left'); + $builder->where('CONVERT(IGR_No USING utf8)', $igr); + $builder->orderBy('t_igr_history.history_dated', 'asc'); + // $builder->where('IGR_No', $igr); $query = $builder->get(); $result = $query->getResult(); return $result; - // Pass the result to the view or return it as JSON - // return $this->response->setJSON($result); } public function isFileExistsInIGRmaster($filename) { @@ -1221,7 +1222,15 @@ class Inwardgateregister_model extends Model $to = date('Y-m-d H:i:s', strtotime($date . ' +30 seconds')); $from = date('Y-m-d H:i:s', strtotime($date . ' -30 seconds')); - + $query3 = $this->db->query("Select t_igr_history.IGR_No,t_igr_history.history_dated,DATE_FORMAT(t_igr_history.history_dated, '%d-%m-%Y') AS indian_date,DATE_FORMAT(t_igr_history.history_dated, '%h:%i:%s %p') AS indian_time , + t_igr_history.by,CONCAT_WS(' ', t_employee_details.FirstName, t_employee_details.LastName) AS history_by + from t_igr_history + LEFT JOIN tbl_users ON tbl_users.userId = t_igr_history.by + LEFT JOIN t_employee_details ON tbl_users.EmpID = t_employee_details.EmpID + where is_add = 1 and IGR_No = '".$igr."'"); + $first_line = $query3->getRow(); + + // 392 po $builder = $this->db->table('t_igr_history') ->select(' @@ -1234,7 +1243,9 @@ $builder = $this->db->table('t_igr_history') t_igr_history.by, t_igr_history.IGR_No, t_igr_history.IGRItem_No, - + DATE_FORMAT(t_igr_history.history_dated, "%d-%m-%Y") AS indian_date, + DATE_FORMAT(t_igr_history.history_dated, "%h:%i:%s %p") AS indian_time, + CONCAT_WS(" ", t_employee_details.FirstName, t_employee_details.LastName) AS history_by, CASE WHEN t_igr_history.field = "TransporterId" THEN (SELECT name FROM t_transporter WHERE id = t_igr_history.new_data LIMIT 1) @@ -1255,17 +1266,26 @@ $builder = $this->db->table('t_igr_history') THEN (SELECT StatusName FROM t_status WHERE StatusCode = t_igr_history.old_data LIMIT 1) ELSE t_igr_history.old_data END AS old_data, - t_igr_history.old_data as original_old_data + t_igr_history.old_data as original_old_data,t_materialmaster.MaterialName,t_materialmaster.MaterialCode ') // ->join('t_igr_details IGRD', 'IGRD.IGRItemNo = t_igr_history.IGRItem_No','left') // ->join('t_materialmaster MM','MM.MaterialCode = IGRD.MaterialCode','left') - ->where('t_igr_history.IGR_No', $igr) + ->join('tbl_users', 'tbl_users.userId = t_igr_history.by','left') + ->join('t_employee_details','tbl_users.EmpID = t_employee_details.EmpID','left') + ->join('t_igr_details', 'CONVERT(t_igr_history.IGRItem_No USING utf8) = CONVERT(t_igr_details.IGRItemNo USING utf8)', 'left') + ->join('t_materialmaster', 'CONVERT(t_materialmaster.MaterialCode USING utf8) = CONVERT(t_igr_details.MaterialCode USING utf8)', 'left') + ->where('CONVERT(t_igr_history.IGR_No USING utf8)', $igr) ->where('t_igr_history.is_edit', 1) ->where('t_igr_history.history_dated BETWEEN "'.$from.'" AND "'.$to.'"'); $query = $builder->get(); + $result = $query->getResult(); + // echo $this->db->getLastQuery()->getQuery(); die; - return $query->getResult(); + return [ + 'history' => $result, + 'first_line' => $first_line ? $first_line->IGR_No ." was Created by ". $first_line->history_by ." on ". $first_line->indian_date ." at ". $first_line->indian_time : null, + ]; } public function getDetailsforEmail($userId,$roleId = 2) @@ -1318,5 +1338,16 @@ $builder = $this->db->table('t_igr_history') return $result; } + public function get_status($value){ + $builder = $this->db->table('t_status') + ->select('StatusCode,StatusName') + ->where('StatusCode', $value); + + $query = $builder->get()->getRow(); + + $StatusName = $query ? $query->StatusName : null; + return $StatusName; + } + } \ No newline at end of file diff --git a/app/Models/Monthlypay_model.php b/app/Models/Monthlypay_model.php index 569790f8..c2e59ce0 100755 --- a/app/Models/Monthlypay_model.php +++ b/app/Models/Monthlypay_model.php @@ -39,12 +39,12 @@ class Monthlypay_model extends Model // $this->db->where('t_employee_details.DateofJoining <=',$lastdate); // $this->db->where('Month_Year',$current); - $sql = "select t_monthly_pay_inputs.*,t_employee_details.FirstName,t_employee_details.LastName,t_loan_master.Loan_ID,t_loan_master.Monthly_Due,t_payroll.Id + $sql = "select t_monthly_pay_inputs.*,t_employee_details.FirstName,t_employee_details.LastName,t_loan_master.Loan_ID,t_loan_master.Monthly_Due,t_payroll.Id,t_employee_details.is_driver from t_monthly_pay_inputs left join t_employee_details on t_monthly_pay_inputs.EmpID=t_employee_details.EmpID and t_employee_details.DateofJoining <= ? left join t_payroll on t_monthly_pay_inputs.EmpID=t_payroll.EmpID left join t_loan_master on t_monthly_pay_inputs.EmpID=t_loan_master.EmpID and t_loan_master.is_Active = 1 - where Month_Year = ? + where t_employee_details.is_driver = 0 and Month_Year = ? order by t_employee_details.EmpID asc"; $query = $this->db->query($sql, array($lastdate, $current)); @@ -64,9 +64,10 @@ class Monthlypay_model extends Model //$monthyear_val = date('Y-m',strtotime($current)); $lastdate = $year_val . '-' . $month_val . '-' . $date_val; $builder = $this->db->table('t_employee_details') - ->select('t_employee_details.EmpID,t_employee_details.FirstName,t_employee_details.LastName,t_employee_details.DateofJoining') + ->select('t_employee_details.EmpID,t_employee_details.FirstName,t_employee_details.LastName,t_employee_details.DateofJoining,t_employee_details.is_driver') //->join('t_emp_pay_data','t_emp_pay_data.EmpID=t_employee_details.EmpID','Left') ->where('t_employee_details.IsActive', 1) + ->where('t_employee_details.is_driver', 0) ->where('t_employee_details.DateofJoining <=', $lastdate) ->orderBy('EmpID', 'asc'); $query = $builder->get(); @@ -100,7 +101,7 @@ class Monthlypay_model extends Model //echo $lastdate; //left join t_payroll on t_employee_details.EmpID = t_payroll.EmpID and month(t_payroll.PayOn) = month(?) and year(t_payroll.PayOn) = year(?) - $sql = "select t_emp_pay_data.EmpID,t_emp_pay_data.*,t_employee_details.FirstName,t_employee_details.DateofJoining,t_employee_details.Designation,t_employee_details.esi_applicable,t_employee_details.pf_applicable,t_employee_details.is_management_team,t_attendance.Days_Worked as Days_worked,t_attendance.Absent as LOP_Days,t_attendance.Paid_Leave as Paid_leave,t_attendance.Total_OTHrs as OT_Hrs_Worked,t_attendance.NoofDays,t_attendance.sunday_count,t_loan_master.Loan_ID,t_loan_master.Monthly_Due,t_loan_master.Due_Start_Date as DueDate,t_loan_master.Loan_Amount,t_loan_master.Paid_Amount,t_payroll.Id,t_monthly_pay_inputs.Loan_Recovered,t_monthly_pay_inputs.Estimate,t_monthly_pay_inputs.Festival_Bonus,t_monthly_pay_inputs.Other_Deductions,t_loan_history .Balance_Amount + $sql = "select t_emp_pay_data.EmpID,t_emp_pay_data.*,t_employee_details.FirstName,t_employee_details.DateofJoining,t_employee_details.Designation,t_employee_details.esi_applicable,t_employee_details.pf_applicable,t_employee_details.is_management_team,t_attendance.Days_Worked as Days_worked,t_attendance.Absent as LOP_Days,t_attendance.Paid_Leave as Paid_leave,t_attendance.Total_OTHrs as OT_Hrs_Worked,t_attendance.NoofDays,t_attendance.sunday_count,t_loan_master.Loan_ID,t_loan_master.Monthly_Due,t_loan_master.Due_Start_Date as DueDate,t_loan_master.Loan_Amount,t_loan_master.Paid_Amount,t_payroll.Id,t_monthly_pay_inputs.Loan_Recovered,t_monthly_pay_inputs.Estimate,t_monthly_pay_inputs.Festival_Bonus,t_monthly_pay_inputs.Other_Deductions,t_loan_history .Balance_Amount,t_employee_details.is_driver from t_emp_pay_data left join t_employee_details on t_employee_details.EmpID = t_emp_pay_data.EmpID left join t_payroll on t_employee_details.EmpID = t_payroll.EmpID and t_payroll.PayOn = ? @@ -110,6 +111,7 @@ class Monthlypay_model extends Model left join t_loan_history on t_loan_history .Loan_ID = t_loan_master.Loan_ID where t_employee_details.DateofJoining <= ? and month(t_attendance.Month_Year) = month(?) and year(t_attendance.Month_Year) = year(?) + and t_employee_details.is_driver = 0 order by t_employee_details.EmpID"; $query = $this->db->query($sql, array($month, $month, $lastdate, $current, $current)); @@ -183,6 +185,7 @@ class Monthlypay_model extends Model // ->where('month(t_employee_details.DateofJoining) <= ',$month_val) ->where('t_employee_details.DateofJoining <= ', $lastdate) ->where('Month_Year', $current) + ->where('t_employee_details.is_driver', 0) // ->where('t_employee_details.IsActive',1) ->orderBy('t_attendance.EmpID', 'asc'); $query = $builder->get(); diff --git a/app/Models/Payroll_model.php b/app/Models/Payroll_model.php index 51e22f3a..3b71a779 100755 --- a/app/Models/Payroll_model.php +++ b/app/Models/Payroll_model.php @@ -331,9 +331,10 @@ class Payroll_model extends Model function getEmployeelist2($Payon = '') { + // CONCAT_WS(' ', Emp.FirstName, Emp.LastName) $builder = $this->db->table('t_monthly_pay_inputs Pay') - ->select('Pay.EmpID as EmpId,Emp.FirstName as Fname,Emp.LastName as Lname') - ->join('t_employee_details Emp', 'Pay.EmpID = Emp.EmpID'); + ->select('Pay.EmpID as EmpId,CONCAT_WS(" ",Emp.FirstName,Emp.LastName) AS FullName') + ->join('t_employee_details Emp', 'Pay.EmpID = Emp.EmpID and Emp.is_driver = 0'); if ($Payon != '') { $builder->where('Pay.Month_Year', $Payon); } diff --git a/app/Models/Purchaseorder_model.php b/app/Models/Purchaseorder_model.php index 0ad9e8fd..049f8966 100755 --- a/app/Models/Purchaseorder_model.php +++ b/app/Models/Purchaseorder_model.php @@ -1672,8 +1672,11 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath, { $builder = $this->db->table('t_purchaseorder_master mast')->distinct() - ->select('mast.PODate,mast.PONO,mast.TotalOrderValue,st.StatusCode,st.StatusName,emp.FirstName,mast.CreatedDate,ccm.CostCenterName,ccm.CostCenterCode,mast.POType as RType,mast.Remarks,DepartmentName,mast.ApprovedBy,(select EmpID from tbl_users where userId=mast.ApprovedBy )as EID,rmast.ReqType,mast.Status,mast.CapitalRange, - (select FirstName from t_employee_details where EmpID=EID)as Approver,sup.SupplierName,sup.MSME') + ->select('mast.PODate,mast.PONO,mast.TotalOrderValue,st.StatusCode,st.StatusName,emp.FirstName,mast.CreatedDate,ccm.CostCenterName,ccm.CostCenterCode,mast.POType as RType,mast.Remarks,DepartmentName,rmast.ReqType,mast.Status,mast.CapitalRange, + (select EmpID from tbl_users where userId=mast.ApprovedBy ) as AEID,mast.ApprovedBy, + (select EmpID from tbl_users where userId=mast.ReleasedBy ) as REID,mast.ReleasedBy, + (select FirstName from t_employee_details where EmpID=AEID) as Approver, + (select FirstName from t_employee_details where EmpID=REID) as Releaser,sup.SupplierName,sup.MSME') ->join('t_supplierdetailsn sup', 'sup.SupplierID = mast.SupplierID') ->join('t_status st', 'st.StatusCode=mast.Status') ->join('t_purchaseorder_lineitem req', 'req.PONO= mast.PONO') @@ -1705,8 +1708,8 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath, $result = $builder->get(); // Get the last executed query // $lastQuery = $this->db->getLastQuery(); - // echo $lastQuery; - // die; + // dd($lastQuery); + // dd($result->getResult()); return $result->getResult(); } @@ -1740,7 +1743,7 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath, $subQuery = 'SELECT distinct LineItem.LineItemNo,LineItem.Per,LineItem.ServiceMaterialDescription,Req.ReqNo,Mat.MaterialCode,Mat.MaterialName,LineItem.ServiceMaterialDescription,LineItem.ServiceFrequency, Mat.UOM,Quantity,ReceivedQuantity,Rate,Req.Status,Tax.*, ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,LandingCharge,HighSeasSalesCharge,CustomDuty,ExciseDuty,ExciseDutyEdCess,CustomEdCess,POMast.ExchangeRate,POMast.ExchangeRateCalculatedon,POMast.TotalOrderValue as BasicValue,POMast.CapitalRange,AfterLandingCharge,AfterHighSeasSalesCharge,AfterCustomDuty,AfterExciseDuty,AfterExciseDutyEdCess,AddlExciseDuty,AfterAddlExciseDuty,Grossdutypayable,AvailableModvat,Grossexpensesduetocustomduty,purchaseratePerKG,CustomDutyExpensesPerKG,RMCIncludingCustomersPerKG,QuantityKG,BasicPriceInMTon,ProductPrice,CustomSHCess,AfterCustomSHCess,AfterExciseDutySHCess,ExciseDutySHCess,AfterCustomEdCess,ROUND((POMast.ExchangeRate*BasicPriceInMTon*Quantity),2) as BasicINRValue,Tax.TotalValue as ImportTotalValue,Tax.FreightType,Tax.NoOfTrip,Tax.FreightValue,Tax.AfterFreightValue,POMast.CurrencyType, - + LineItem.LineitemAuditorNotes, Req.CostCenterCode,Dept.DepartmentName FROM t_purchaseorder_lineitem LineItem join t_purchaseorder_master POMast on POMast.PONO = LineItem.PONO join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode @@ -1799,7 +1802,7 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath, Mat.UOM,Quantity,ReceivedQuantity,Rate,Req.Status,ROUND((ServiceTax.After_CGST + ServiceTax.After_SGST + ServiceTax.After_IGST),2) as ServiceTaxamount ,ServiceTax.TotalValue,ServiceTax.CGST,ServiceTax.After_CGST,ServiceTax.SGST,ServiceTax.After_SGST,ServiceTax.IGST,ServiceTax.After_IGST,ServiceTax.otherallowance,ServiceTax.discount,ServiceTax.discountval,ServiceTax.Afterdiscountval, POMast.ExchangeRate,POMast.ExchangeRateCalculatedon,POMast.TotalOrderValue as BasicValue,POMast.CapitalRange,ROUND((POMast.TotalOrderValue),2) as BasicINRValue,POMast.CurrencyType,FreightType as Ftype,NoOfTrip as NoTrip,FreightValue as Fvalue,AfterFreightValue as Afvalue, - + LineItem.LineitemAuditorNotes, Req.CostCenterCode,Dept.DepartmentName FROM t_purchaseorder_lineitem LineItem join t_purchaseorder_master POMast on POMast.PONO = LineItem.PONO join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode @@ -2555,6 +2558,34 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath, return $query->getResultArray(); } + function materialRate($materialcode){ + $builder = $this->db->table('t_materialmaster') + ->select('t_materialmaster.material_rate') + ->where('t_materialmaster.MaterialCode', $materialcode); + + $query = $builder->get()->getRow(); + + $material_rate = $query ? $query->material_rate : 0; + return $material_rate; + + } + + public function updateMaterialRate($code, $incoming_rate) + { + $default_rate = $this->materialRate($code); + + if ($incoming_rate == $default_rate) { + return 1; + } else { + $this->db->table('t_materialmaster') + ->where('MaterialCode', $code) + ->set('material_rate', $incoming_rate) + ->update(); + + return $this->db->affectedRows(); + } + } + function lastPONO() { diff --git a/app/Models/Rawmaterialdetails_model.php b/app/Models/Rawmaterialdetails_model.php index f530ada6..cbd3a5fa 100755 --- a/app/Models/Rawmaterialdetails_model.php +++ b/app/Models/Rawmaterialdetails_model.php @@ -146,7 +146,7 @@ class Rawmaterialdetails_model extends Model $builder = $this->db->table('t_materialmaster') ->select('MaterialCode') - ->where('Category', 'silica sand') + ->where('Category', '248') ->orderBy('CreatedDate', 'desc'); $query = $builder->get(); $materialResults = $query->getResultArray(); @@ -158,7 +158,7 @@ class Rawmaterialdetails_model extends Model $builder = $this->db->table('t_materialmaster') ->select('MaterialCode') - ->where('Category', 'waste core') + ->where('Category', '328') ->orderBy('CreatedDate', 'desc'); $query = $builder->get(); $materialResults = $query->getResultArray(); @@ -171,7 +171,7 @@ class Rawmaterialdetails_model extends Model //when no data present for current month we are showing only active materials with filter option $builder = $this->db->table('t_materialmaster') ->select('MaterialCode, MaterialName') - ->where('Category', 'Packing Material') + ->where('Category', '236') ->where('IsActive', 1) ->orderBy('MaterialCode', 'asc'); $query = $builder->get(); @@ -184,7 +184,7 @@ class Rawmaterialdetails_model extends Model //when data present with whether material is active or not we have to show them with filter option $builder = $this->db->table('t_materialmaster') ->select('MaterialCode, MaterialName') - ->where('Category', 'Packing Material') + ->where('Category', '236') ->whereIn('MaterialCode', $distinctMaterialCodes) ->orderBy('MaterialCode', 'asc'); $query = $builder->get(); @@ -199,7 +199,7 @@ class Rawmaterialdetails_model extends Model $builder = $this->db->table('t_materialmaster') ->select('MaterialCode , MaterialName') ->where('IsActive', 1) - ->where('Category', 'Resin') + ->where('Category', '327') ->orderBy('MaterialCode', 'asc'); $query = $builder->get(); $materialResults = $query->getResultArray(); @@ -212,6 +212,7 @@ class Rawmaterialdetails_model extends Model { $builder = $this->db->table('t_materialmaster') ->select('MaterialCode, MaterialName') + ->where('Category', '327') ->whereIn('MaterialCode', $distinctMaterialCodes) // Matches MaterialCode with the array ->orderBy('MaterialCode', 'asc'); @@ -330,8 +331,7 @@ class Rawmaterialdetails_model extends Model // on 28/jan/2025. both add and edit. category condition added. - // on 13/Feb/2025. Change based On Config Child Values. - function checkMaterialExists($materialCode , $materialName ,$materialCategory) + function checkMaterialExists($materialCode,$materialName ,$materialCategory) { $builder = $this->db->table('t_materialmaster MM') diff --git a/app/Models/Requistion_model.php b/app/Models/Requistion_model.php index bfeed261..47a68809 100755 --- a/app/Models/Requistion_model.php +++ b/app/Models/Requistion_model.php @@ -175,7 +175,7 @@ class Requistion_model extends Model function GetMaterialCode($ReqType,$NotArray='') { $builder = $this->db->table('t_materialmaster') - ->select('MaterialCode, MaterialName,UOM') + ->select('MaterialCode, MaterialName,UOM,material_rate') ->where('IsActive',1); //->where('MaterialType',$ReqType ); diff --git a/app/Models/TrpAbstract.php b/app/Models/TrpAbstract.php new file mode 100644 index 00000000..3df62676 --- /dev/null +++ b/app/Models/TrpAbstract.php @@ -0,0 +1,46 @@ +db->table('t_materialmaster') ->select('materialCode') - ->where('Category', 'waste core') + ->where('Category' ,'waste core') //328 - is for waste core in config master ->get() ->getResultArray(); $materialCodes = array_column($subquery, 'materialCode'); // Extracts 'materialCode' values + + // dd($this->db->getLastQuery()); // Convert the array of material codes to a comma-separated string // $materialCodesString = "'" . implode("','", $materialCodes) . "'"; @@ -77,57 +78,65 @@ class TrpProductionModel extends Model $builder = $this->db->table('t_trpProductionMaintenanceDetails tpmd'); // Select required columns - $builder->select([ - 'tpmd.date', - 'tpmd.openingTime', - 'tpmd.closingTime', - 'tpmd.totalHours', - 'tpmd.coldStart', - 'tpmd.breakdownHours', - 'tpmd.burnerFiringHours', - 'tpmd.sandFeedingHours', - 'tpmd.workingPersonEngineers', - 'tpmd.workingPersonSupervisiors', - 'tpmd.workingPersonOperators', - 'tpmd.rollerDrivers', - 'tpmd.natureOfMaintenance', - 'tpmd.location', - 'tpmd.description', + $builder->select( + 'tpmd.date, + tpmd.openingTime, + tpmd.closingTime, + tpmd.totalHours, + tpmd.coldStart, + tpmd.breakdownHours, + tpmd.burnerFiringHours, + tpmd.sandFeedingHours, + tpd.gasReceiptBg, + tpd.gasReceiptPg, + + + tpd.physicalGasConsumption, + IFNULL(tdmd.totalGasConsumption, 0) AS drierGasConsumption, + IFNULL(tcmd.totalGasConsumption, 0) AS coatingGasConsumption, + tpd.trpPlusDrierGasConsumption, + tpd.trpPhysicalGasPerTon, + tpd.panelGasConsumption, + tpd.panelGasPerTon, + + tigrdot.* , - 'tpd.gasReceiptBg', - 'tpd.gasReceiptPg', - 'tpd.physicalGasConsumption', - 'tpd.trpPlusDrierGasConsumption', - 'tpd.trpPhysicalGasPerTon', - 'tpd.panelGasConsumption', - 'tpd.panelGasPerTon', - 'tpd.edRunningHours', - 'tpd.edProduction', - 'tpd.edUsage', - 'tpd.trpProduction', - 'tpd.trpProductionPerHour', - 'tpd.waterReceipt', - 'tpd.waterConsumption', - 'tpd.ebReading', - 'tpd.ebReadingPerUnitTon', - - 'tpwd.msSeperation', - 'tpwd.edWaste', - 'tpwd.coolerBags', - 'tpwd.edPlus20Waste', - 'tpwd.cycloneWaste', + tpd.edRunningHours, + tpd.edProduction, + tpd.edUsage, - // Aggregated gas consumption - 'IFNULL(tcmd.totalGasConsumption, 0) AS coatingGasConsumption', - 'IFNULL(tdmd.totalGasConsumption, 0) AS drierGasConsumption', + tpd.trpProduction, + tpd.trpProductionPerHour, - 'tsu.total_kgs AS coating' , - - 'tigrdot.*', - 'invItems.*' + tsu.total_kgs AS coating, + invItems.* , + tpd.waterReceipt, + tpd.waterConsumption, + tpd.ebReading, + tpd.ebReadingPerUnitTon, - ]); + + tpmd.workingPersonEngineers, + tpmd.workingPersonSupervisiors, + tpmd.workingPersonOperators, + tpmd.rollerDrivers, + tpmd.natureOfMaintenance, + tpmd.location, + tpmd.description, + + tpwd.msSeperation, + tpwd.edWaste, + tpwd.coolerBags, + tpwd.edPlus20Waste, + tpwd.cycloneWaste, + + + +' + + ); + // Join with other tables $builder->join('t_trpProductionDetails tpd', 'tpd.date = tpmd.date', 'inner'); @@ -150,6 +159,8 @@ class TrpProductionModel extends Model $builder->join("({$subquery2}) tdmd", 'tdmd.date = tpmd.date', 'left'); + + // Subquery: Core Sand Reclaimed by Clients $crsClientList = $this->db->table('ip_clients clients') @@ -163,30 +174,31 @@ class TrpProductionModel extends Model ->get() ->getResultArray(); - if(!empty($crsClientList)){ + $crsClientList = array_column($crsClientList, 'client_name'); // Initialize an empty array for dynamic SQL conditions - $caseStatements = []; + $caseStatementsCrs = []; // Loop through the client list and build dynamic SUM(CASE WHEN...) - foreach ($crsClientList as $client) { - // Escape column name (remove spaces and special characters) - $safeClient = str_replace(' ', '_', $client); - + foreach ($crsClientList as $index => $client) { + + $crsClientList[$index] = $client."_crs"; + $clientCrs = $client."_crs"; + // Add the condition to the array - $caseStatements[] = "SUM(CASE WHEN clients.client_name = " . $this->db->escape($client) . " THEN invItems.item_quantity ELSE 0 END) AS `$safeClient`"; + $caseStatementsCrs[] = "SUM(CASE WHEN clients.client_name = " . $this->db->escape($client) . " THEN invItems.item_quantity ELSE 0 END) AS `$clientCrs`"; } // Convert array to a comma-separated string - $caseSQL = implode(', ', $caseStatements); + $caseSQLCrs = implode(', ', $caseStatementsCrs); $subquery3 = $this->db->table('ip_invoice_items invItems') ->select([ - 'invItems.*', - $caseSQL + 'invItems.item_date_added', + $caseSQLCrs ]) ->join('ip_invoices inv', 'inv.invoice_id = invItems.invoice_id', 'left') ->join('ip_clients clients', 'clients.client_id = inv.client_id', 'left') @@ -201,27 +213,57 @@ class TrpProductionModel extends Model $builder->join("({$subquery3}) invItems", 'invItems.item_date_added = tpmd.date', 'left'); - } + + + + $materialCodes = ! empty($materialCodes) ? $materialCodes : ['600374','600422','600434']; + $wcsSupplierList = $this->db->table('t_igr_details tigrd') + ->distinct() + ->select('ts.SupplierName as supplierName') + ->join('t_igr_master tigm', 'tigm.IGRNo = tigrd.IGRNo', 'left') + ->join('t_purchaseorder_master tpom', 'tpom.PONO = tigm.PONO', 'left') + ->join('t_supplierdetailsn ts', 'tpom.SupplierID = ts.SupplierID', 'left') + ->whereIn('tigrd.MaterialCode', $materialCodes) + ->where('tigrd.CreatedDate >=', $startDate) + ->where('tigrd.CreatedDate <=', $endDate) + ->groupBy('DATE(tigrd.CreatedDate)') + ->get() + ->getResultArray(); + + + $wcsSupplierList = array_column($wcsSupplierList, 'supplierName'); + + // Initialize an empty array for dynamic SQL conditions + $caseStatementsWcs = []; + + // Loop through the client list and build dynamic SUM(CASE WHEN...) + foreach ($wcsSupplierList as $index => $supplier) { + + $wcsSupplierList[$index] = $supplier."_wcs"; + $supplierWcs = $supplier."_wcs"; + + // Add the condition to the array + $caseStatementsWcs[] = "SUM(CASE WHEN ts.SupplierName = " . $this->db->escape($supplier) . " THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS `$supplierWcs` "; + } + + // Convert array to a comma-separated string + $caseSQLWcs = implode(', ', $caseStatementsWcs); + + // Subquery: Waste Core Sand Suppliers $subquery4 = $this->db->table('t_igr_details tigrd') ->select([ 'DATE(tigrd.CreatedDate) AS CreatedDate', // Convert CreatedDate to DATE format - "SUM(CASE WHEN ts.SupplierName = 'Ashok leyland limited foundry divn-SPU' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS ALs_wcs", - "SUM(CASE WHEN ts.SupplierName = 'Ashok leyland limited foundry divn-ENU' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS ALe_wcs", - "SUM(CASE WHEN ts.SupplierName = 'MADRAS ENGINEERING INDUSTRIES PRIVATE LIMITED' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS ME_wcs", - "SUM(CASE WHEN ts.SupplierName = 'SIDDHARTH INDUSTRIES' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS SI_wcs", - "SUM(CASE WHEN ts.SupplierName = 'Caparo Engineering India Limited' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS caparo_wcs", - "SUM(CASE WHEN ts.SupplierName = 'NEMAK ALUMINIUM CASTING INDIA PVT LTD' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS Nemak_wcs", - "SUM(CASE WHEN ts.SupplierName = 'DR Axion India Private Limited' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS DR_wcs" + $caseSQLWcs ]) ->join('t_igr_master tigm', 'tigm.IGRNo = tigrd.IGRNo', 'left') ->join('t_purchaseorder_master tpom', 'tpom.PONO = tigm.PONO', 'left') ->join('t_supplierdetailsn ts', 'tpom.SupplierID = ts.SupplierID', 'left') - ->whereIn('tigrd.MaterialCode', $materialCodes) // FIXED: Now correctly formatted + ->whereIn('tigrd.MaterialCode', $materialCodes) ->where('tigrd.CreatedDate >=', $startDate) ->where('tigrd.CreatedDate <=', $endDate) ->groupBy('DATE(tigrd.CreatedDate)') @@ -237,14 +279,18 @@ class TrpProductionModel extends Model $builder->where('tpmd.date >=', $startDate); $builder->where('tpmd.date <=', $endDate); + + // Order by date $builder->orderBy('tpmd.date', 'ASC'); + + // Execute the query $query = $builder->get(); $result = $query->getResultArray(); - return $result; + return [$result,$crsClientList,$wcsSupplierList]; } diff --git a/app/Views/EditservicePurchaseorder.php b/app/Views/EditservicePurchaseorder.php index 85a67ac0..f9bd28b4 100755 --- a/app/Views/EditservicePurchaseorder.php +++ b/app/Views/EditservicePurchaseorder.php @@ -1229,22 +1229,25 @@ if (!empty($getlogpodtl)) { +
-
- +
+
- - - - - - - - - - - + + + + + + + + + + + + @@ -1268,11 +1271,12 @@ if (!empty($getlogpodtl)) { ?> - - - - - + + + LineitemAuditorNotes) ? $record->LineitemAuditorNotes : "-"; } ?> - + - + - + - - + + @@ -2610,12 +2614,13 @@ if (!empty($getlogpodtl)) { // TotalValue: TotalOrderValue // })); PONOStatus = + var shorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName; var rowHtml = ` - `; + `; if (PONOStatus === "PO_DRAFT" || PONOStatus === "PO_CREATED") { rowHtml += ` + $invdate = $record->DeliveryChellanDate; + if(!$invdate || $invdate == 'null' || $invdate === '0000-00-00 00:00:00'){ + echo ""; + }else{ + $date = new DateTime($invdate); + echo $date->format('d-m-Y'); } + ?> @@ -772,9 +777,11 @@ } // Format dates - var dcd = new Date(item.DeliveryChellanDate); - var dcd2 = (String(dcd.getDate()).padStart(2, '0') + '-' + (String(dcd.getMonth() + 1).padStart(2, '0')) + '-' + dcd.getFullYear()); - $("#Invoice_Date").val(dcd2); + if(item.DeliveryChellanDate !== '0000-00-00 00:00:00' ){ + var dcd = new Date(item.DeliveryChellanDate); + var dcd2 = (String(dcd.getDate()).padStart(2, '0') + '-' + (String(dcd.getMonth() + 1).padStart(2, '0')) + '-' + dcd.getFullYear()); + $("#Invoice_Date").val(dcd2); + } console.log(item.MaterialRcvdDate) var Mat_rcv_date = (item.MaterialRcvdDate == 'null') ? ' ' : formatDateTime(item.MaterialRcvdDate, 1); $("#MaterialRcvdDate").val(Mat_rcv_date); @@ -1179,15 +1186,22 @@ }); function constructSentence(record) { - let str = record.field; - let fieldName = str.replace(/([a-z])([A-Z])/g, '$1 $2'); - let sentence = record.FullName + ' on ' + formatDateTime(record.history_dated, 2) + " " + fieldName + " "; + + // let str = record.field; + // let fieldName = str.replace(/([a-z])([A-Z])/g, '$1 $2'); + let sentence = " "; if (parseInt(record.is_add) === 1) { - sentence += record.new_data + " was added."; + sentence += record.IGR_No + " was Created by "+record.FullName+ " on "+record.indian_date+" at "+record.indian_time; } else if (parseInt(record.is_edit) === 1) { - sentence += record.old_data + " was updated into " + record.new_data + "."; + let str = record.field; + if (str !== "UpdateBY" && str !== "MaterialRcvdDate" && str !== "DeliveryChellanDate") { + let fieldName = str.replace(/([a-z])([A-Z])/g, '$1 $2'); + sentence += ((record.IGRItem_No) ? record.MaterialName+" ( "+ record.MaterialCode + " ) - " : "")+fieldName+" "+record.old_data + " was Updated into " + record.new_data + " by "+record.FullName+ " on "+record.indian_date+" at "+record.indian_time; + } } else if (parseInt(record.is_delete) === 1) { - sentence += record.new_data + " was deleted."; + let str = record.field; + let fieldName = str.replace(/([a-z])([A-Z])/g, '$1 $2'); + sentence += fieldName+" "+record.new_data + " was deleted by "+record.FullName+ " on "+record.indian_date+" at "+record.indian_time; } return sentence; } @@ -1396,6 +1410,7 @@ @@ -49,7 +53,7 @@
- +
@@ -66,11 +70,11 @@ ?>
- +
- @@ -109,6 +113,10 @@
+
+ + +
@@ -116,23 +124,25 @@
'Date', 'value' => set_value('Date'), 'id' => 'Date', 'class' => 'form-control', 'onkeypress' => 'return false;'); - echo form_input($data); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $formattedDate = $dt->format('d-m-Y'); + $data = array('name' => 'Date', 'value' => set_value('Date', $formattedDate), 'id' => 'Date', 'class' => 'form-control', 'onkeypress' => 'return false;', 'autocomplete'=>'"off"'); + echo form_input($data); ?>
+
+
-
-
- +
@@ -195,28 +205,28 @@
- * - + +
diff --git a/app/Views/alterpurchaseorder.php b/app/Views/alterpurchaseorder.php index cded8c49..13a8efbc 100755 --- a/app/Views/alterpurchaseorder.php +++ b/app/Views/alterpurchaseorder.php @@ -1955,12 +1955,14 @@ if (!empty($INRSYMBOL)) { if (selectedMaterialCode == value.MaterialCode) { $("#ServiceDescription").val(value.MaterialName); $("#ServiceUOM").val(value.UOM); + $("#ServiceRate").val(value.material_rate); if ($('#ScheduleType').val().trim() != 'Recurring') { $('#FrequencyChange').val('One Time'); $('#ServiceNo').val(1); + } else { $('#FrequencyChange').val($('#ScheduleType').val()); @@ -2167,7 +2169,7 @@ if (!empty($INRSYMBOL)) { if (selectedRevenueMaterialCode == value.MaterialCode) { $("#ItemName").val(value.MaterialName); $("#UOM").val(value.UOM); - + $("#Rate").val(value.material_rate); } }); @@ -2810,16 +2812,16 @@ if (!empty($INRSYMBOL)) { style="background-color:#fff;">
- - - - - - - - - - + + + + + + + + + + @@ -3577,7 +3579,7 @@ if (!empty($INRSYMBOL)) { class="badge mandatory">*
'ServiceRate', 'value' => set_value('ServiceRate'), 'id' => 'ServiceRate', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'Ratechange()'); + $data = array('name' => 'ServiceRate', 'value' => set_value('ServiceRate'), 'id' => 'ServiceRate', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'Ratechange();UpdateTheRateMaster();'); echo form_input($data); ?>
@@ -6027,14 +6029,15 @@ if (!empty($INRSYMBOL)) { index = parseInt(index) + 1; var template = jQuery("#RevenueList").html(); + var rshorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName; var html = `
- + - - + + @@ -6555,7 +6558,19 @@ if (!empty($INRSYMBOL)) { $('#ServiceMaterialCode').focus(); return false; } + function UpdateTheRateMaster(){ + if ($('#ServiceMaterialCode').val() != "0" && $('#ServiceRate').val() != "0" ) { + var MaterialCode = $('#ServiceMaterialCode').val(); + var Rate = $('#ServiceRate').val(); + } + if ($('#ServiceMaterialCode').val() != "0" && $('#ServiceRate').val() != "0" ) { + var MaterialCode = $('#MaterialCode').val(); + var Rate = $('#Rate').val(); + } + if (MaterialCode != "0" && Rate != "0" ) { + } + } if ($('#ServiceQuantity').val() != '' && $('#ServiceRate').val() != '') { @@ -6695,14 +6710,16 @@ if (!empty($INRSYMBOL)) { index = parseInt(index) + 1; var template = jQuery("#ServiceList").html(); + + var sshorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName; var html = ` - + - - + + @@ -7222,26 +7239,27 @@ if (!empty($INRSYMBOL)) { // Perform form validation - if (validate()) { - if (document.getElementById('serviceTax').rows.length < 2) { - alert('Please Select Line item to Create PO'); - $('#Deliverydt').focus(); - return false; - } else if ($('#Otherpayment').val() == '' && $('#PaymentMethod').val() == 'PT08') { - alert('Please Enter Other Payable Terms Description'); - $('#Otherpayment').focus(); - return false; - } else if ($('#emergdescofpo').val().trim() == '') { - alert('Please Enter Description Of Service'); - $('#emergdescofpo').focus(); - return false; - } else if ($('#PoTypeOptions').val() == "0") { - alert('Please Select POType'); - $('#PoTypeOptions').focus(); - return false; - } else { + if (serviceValidate()) { + // if (document.getElementById('serviceTax').rows.length < 2) { + // alert('Please Select Line item to Create PO'); + // $('#Deliverydt').focus(); + // return false; + // } else if ($('#Otherpayment').val() == '' && $('#PaymentMethod').val() == 'PT08') { + // alert('Please Enter Other Payable Terms Description'); + // $('#Otherpayment').focus(); + // return false; + // } else if ($('#emergdescofpo').val().trim() == '') { + // alert('Please Enter Description Of Service'); + // $('#emergdescofpo').focus(); + // return false; + // } else if ($('#PoTypeOptions').val() == "0") { + // alert('Please Select POType'); + // $('#PoTypeOptions').focus(); + // return false; + // } else { // Submit the form using AJAX $('#loader').show(); + disableButtons(); $.ajax({ url: "emergencypurchaseorder/addNewServicePurchaseOrder", type: "POST", @@ -7260,14 +7278,16 @@ if (!empty($INRSYMBOL)) { $('#SpcialInstruction').val(''); $('#txtDeliveryAddress').val(''); window.location = "purchaseorderListing"; + setTimeout(function() { enableButtons(); }, 2000); }, error: function (xhr, status, error) { // Handle errors $('#loader').hide(); alert("Error: " + error); + setTimeout(function() { enableButtons(); }, 2000); } }); - } + // } } } @@ -7333,22 +7353,23 @@ if (!empty($INRSYMBOL)) { // Perform form validation - if (validate()) { - if (document.getElementById('serviceTax').rows.length < 2) { - alert('Please Select Line item to Create PO'); - $('#Deliverydt').focus(); - return false; - } else if ($('#insuranceStatus').val() == 'YES' && $('#InsuranceNumber').val() == '') { - alert('Please Enter Insurance Number..!'); + if (revenueValidate()) { + // if (document.getElementById('serviceTax').rows.length < 2) { + // alert('Please Select Line item to Create PO'); + // $('#Deliverydt').focus(); + // return false; + // } else if ($('#insuranceStatus').val() == 'YES' && $('#InsuranceNumber').val() == '') { + // alert('Please Enter Insurance Number..!'); - return false; - } else if ($('#PaymentMethod').val() == 'PT08' && $('#Otherpayment').val() == '') { - alert('Please Enter Other Payment Description..!'); + // return false; + // } else if ($('#PaymentMethod').val() == 'PT08' && $('#Otherpayment').val() == '') { + // alert('Please Enter Other Payment Description..!'); - return false; - } else { + // return false; + // } else { // Submit the form using AJAX $('#loader').show(); + disableButtons(); $.ajax({ url: "emergencypurchaseorder/addNewRevenuePurchaseOrder", type: "POST", @@ -7363,13 +7384,15 @@ if (!empty($INRSYMBOL)) { $('#SpcialInstruction').val(''); $('#txtDeliveryAddress').val(''); window.location = "purchaseorderListing"; + setTimeout(function() { enableButtons(); }, 2000); }, error: function (xhr, status, error) { // Handle errors alert("Error: " + error); + setTimeout(function() { enableButtons(); }, 2000); } }); - } + // } } } diff --git a/app/Views/attendance.php b/app/Views/attendance.php index a4c608f7..01592c6a 100755 --- a/app/Views/attendance.php +++ b/app/Views/attendance.php @@ -224,7 +224,7 @@ $currentday = date('d');
-
-
- -
diff --git a/app/Views/capitalpurchaseorder.php b/app/Views/capitalpurchaseorder.php index 734384d6..a2143c63 100755 --- a/app/Views/capitalpurchaseorder.php +++ b/app/Views/capitalpurchaseorder.php @@ -78,9 +78,8 @@ const LineItemNoteForAuditor = $link.data('notes'); const id = $link.data('id'); var theForm = $(".CreatePO"); - - addHidden(theForm, "LineItemNoteForAuditor" + id, value); $link.text(value).show(); + $("#LineItemNoteForAuditor" + id).val(value); $editContainer.hide(); }); @@ -334,64 +333,105 @@ if (!empty($INRSYMBOL)) { function vaildateBeforeOpenModal() { var radioValue = $("input[name='DateRange']:checked").val(); - - if ($('#PODate').val() == '') { - alert('Please Enter the Purchase Order date'); - $('#PODate').focus(); - return false; - } else if ($('#drpSupplier').val() == "0") { - alert('Please Select the Supplier details'); - $('#drpSupplier').focus(); - return false; - } else if (radioValue == 0 && $('#Deliverydate').val() == '') { - alert('Please Select the Delivery Date'); - $('#Deliverydate').focus(); - return false; - } else if (radioValue == 1 && $('#Scheduleby').val() == '') { - alert('Please Enter the Schedule By'); - $('#Deliverydate').focus(); - return false; - } else if (radioValue == 2 && $('#Dispatch').val().trim() == '') { - alert('Please Enter the Dispatch Instruction'); - $('#Deliverydate').focus(); - return false; - } else if ($('#DeliveryAddr').val() == '') { - alert('Please Enter the Delivery Address'); - $('#DeliveryAddr').focus(); - return false; - } else if ($('#PoTypeOptions').val() == "0") { - alert('Please Select POType'); - $('#PoTypeOptions').focus(); - return false; - - } else if ($('#BudgetType').val() == "0") { - alert('Please Select Budget Type'); - $('#BudgetType').focus(); - return false; - - } else if ($('#Deliverydt').val() == '' && $('#Scheduleby').val() == '') { - alert('Please Enter the Dispatch Instruction'); - $('#Deliverydt').focus(); - return false; - } else if ($('#currencytype').val() == '0') { - alert('Please Select the Currency Type'); - $('#currencytype').focus(); - return false; - } else if (capitalType == 'International') { - if ($('#ExchangeRt').val() == '') { - alert('Please Enter the Exchange Rate'); - $('#ExchangeRt').focus(); - return false; - } else if ($('#PlaceOforigin').val().trim() == '') { - alert('Please Enter the Place Of Origin'); - $('#PlaceOforigin').focus(); - return false; - } else { - return true; - } - } else { - return true; + if (capitalType == 'International') { + if ($('#drpSupplier').val() == "0") { + alert('Please Select the Supplier details'); + $('#drpSupplier').focus(); + return false; + } else if ($('#currencytype').val() == '0') { + alert('Please Select the Currency Type'); + $('#currencytype').focus(); + return false; + } else if ($('#PODate').val() == '') { + alert('Please Enter the Purchase Order date'); + $('#PODate').focus(); + return false; + } else if (radioValue == 0 && $('#Deliverydate').val() == '') { + alert('Please Select the Delivery Date'); + $('#Deliverydate').focus(); + return false; + } else if (radioValue == 1 && $('#Scheduleby').val() == '') { + alert('Please Enter the Schedule By'); + $('#Deliverydate').focus(); + return false; + } else if (radioValue == 2 && $('#Dispatch').val().trim() == '') { + alert('Please Enter the Dispatch Instruction'); + $('#Deliverydate').focus(); + return false; + } else if ($('#ExchangeRate').val() == '') { + alert('Please Enter the Exchange Rate'); + $('#ExchangeRate').focus(); + return false; + } else if ($('#ExchangeRate').val() == 0) { + alert('Please Enter the Exchange Rate'); + $('#ExchangeRate').focus(); + return false; + } else if ($('#PlaceOforigin').val() == '') { + alert('Please Enter Place Of Origin'); + $('#PlaceOforigin').focus(); + return false; + } else if ($('#PoTypeOptions').val() == "0") { + alert('Please Select Capital Type'); + $('#PoTypeOptions').focus(); + return false; + } else if ($('#PaymentTerms').val() == '') { + alert('Please Select Payment Terms'); + $('#PaymentTerms').focus(); + return false; + } else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { + alert('Please Enter Payable Terms Description'); + $('#Otherpayment').focus(); + return false; + } else if ($('#BudgetType').val() == "0") { + alert('Please Select Budget Type'); + $('#BudgetType').focus(); + return false; + } else { return true; } } + if (capitalType == 'Domestic') { + if ($('#drpSupplier').val() == "0") { + alert('Please Select the Supplier details'); + $('#drpSupplier').focus(); + return false; + } else if ($('#PODate').val() == '') { + alert('Please Enter the Purchase Order date'); + $('#PODate').focus(); + return false; + } else if (radioValue == 0 && $('#Deliverydate').val() == '') { + alert('Please Select the Delivery Date'); + $('#Deliverydate').focus(); + return false; + } else if (radioValue == 1 && $('#Scheduleby').val() == '') { + alert('Please Enter the Schedule By'); + $('#Deliverydate').focus(); + return false; + } else if (radioValue == 2 && $('#Dispatch').val().trim() == '') { + alert('Please Enter the Dispatch Instruction'); + $('#Deliverydate').focus(); + return false; + } else if ($('#PoTypeOptions').val() == "0") { + alert('Please Select Capital Type'); + $('#PoTypeOptions').focus(); + return false; + } else if ($('#PaymentTerms').val() == '') { + alert('Please Select Payment Terms'); + $('#PaymentTerms').focus(); + return false; + } else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { + alert('Please Enter Payable Terms Description'); + $('#Otherpayment').focus(); + return false; + } else if ($('#BudgetType').val() == "0") { + alert('Please Select Budget Type'); + $('#BudgetType').focus(); + return false; + } else { return true; } + } + + + + + }
@@ -515,7 +555,7 @@ if (!empty($INRSYMBOL)) { 'Scheduleby', 'value' => set_value('Scheduleby'), 'id' => 'Scheduleby', 'class' => 'form-control', 'required' => 'true', 'rows' => '3', 'cols' => '40', 'maxlength' => '110'); - echo Form_textarea($data); + echo form_textarea($data); ?>
@@ -526,7 +566,7 @@ if (!empty($INRSYMBOL)) { // $data = array('name' => 'Dispatch','value' => set_value('Dispatch'),'id'=>'Dispatch', 'class' => 'form-control' ,'required' => 'true'); // echo form_input($data); $data = array('name' => 'Dispatch', 'value' => set_value('Dispatch'), 'id' => 'Dispatch', 'class' => 'form-control', 'required' => 'true', 'rows' => '3', 'cols' => '40', 'maxlength' => '110'); - echo Form_textarea($data); + echo form_textarea($data); ?> @@ -746,17 +786,17 @@ if (!empty($INRSYMBOL)) {
SNoRequisition NoItem CodeItem NameLine Item SpecsQuantityUOMRate Basic Amount Tax Amount Total Order Amount SNoRequisition NoItem CodeItem DescriptionLine Item SpecsQuantityUOMRate Basic Amount Tax Amount Total Order Amount Action
ReqNo ?>MaterialCode ?>MaterialName ?> + ReqNo ?>MaterialCode ?> + MaterialName, 0, 13, "..."); + echo $shortName; ?> Quantity ?>Quantity ?> UOM ?>Rate ?>Rate ?>BasicValue * $FrequencyNo, 2, '.', ''); ?>BasicValue * $FrequencyNo, 2, '.', ''); ?>Taxamount ?>TotalValue ?>Taxamount ?>TotalValue ?>
${temp} ${Reqnumber} ${materialCode}${materialName}${shorten}purchaseorder/DeletePODetails", success: function(data) { - if (data) { - $('#loader').hide(); - alert(data); - } else { - $('#loader').hide(); - - alert("Error"); - } - + $('#loader').hide(); + (data) ? alert(response) : alert("Error"); } }); } @@ -3168,29 +3166,31 @@ if (!empty($getlogpodtl)) { var txtTotalOrderValueSummary = $('#txtTotBasicAmount').val(); - if (validate()) { - if (document.getElementById('ServiceTable').rows.length < 2) - { - alert('Please Select Line item to Create PO'); - $('#Deliverydt').focus(); - return false; - } + + if (serviceValidate()) { + // if (document.getElementById('ServiceTable').rows.length < 2) + // { + // alert('Please Select Line item to Create PO'); + // $('#Deliverydt').focus(); + // return false; + // } // else if(parseInt(AvlBudAmt) < parseInt(txtTotalOrderValueSummary)) { // alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.'); // return false; // } - else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { - alert('Please Enter Payable Terms'); - $('#Otherpayment').focus(); - return false; - } else if ($('#editdescofpo').val().trim() == '') { - alert('Please Enter Description Of Service'); - $('#editdescofpo').focus(); - return false; - } else { + // else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { + // alert('Please Enter Payable Terms'); + // $('#Otherpayment').focus(); + // return false; + // } else if ($('#editdescofpo').val().trim() == '') { + // alert('Please Enter Description Of Service'); + // $('#editdescofpo').focus(); + // return false; + // } else { // $('#content').loader('show'); var formData = new FormData($('.ServicePO')[0]); $('#loader').show(); + disableButtons(); $.ajax({ // data: $('.ServicePO').serialize(), type: "POST", @@ -3218,16 +3218,22 @@ if (!empty($getlogpodtl)) { $('#SpcialInstruction').val(''); $('#txtDeliveryAddress').val('') window.location = "purchaseorderListing"; - + setTimeout(function() { enableButtons(); }, 2000); } else { $('#loader').hide(); + setTimeout(function() { enableButtons(); }, 2000); alert("Error"); } + }, + error: function(jqXHR, textStatus, errorThrown) { + console.error("AJAX Error: " + textStatus + ": " + errorThrown); + alert("Error: " + textStatus); + setTimeout(function() { enableButtons(); }, 2000); } }); - } + // } } } diff --git a/app/Views/accountsDashboard.php b/app/Views/accountsDashboard.php index be4a77cc..186bbdfc 100644 --- a/app/Views/accountsDashboard.php +++ b/app/Views/accountsDashboard.php @@ -93,41 +93,41 @@ var mindt = year - 70; var maxdt = year - 15; - $("#Invoice_Date , #MaterialRcvdDate").datepicker({ - minDate: new Date(year - SIAStartYear, 1, 1), - maxDate: 'now', - dateFormat: 'dd-mm-yy', - changeMonth: true, - changeYear: true, - yearRange: '-100:+0' - }); - $('#Driver_Name').autocomplete({ + // $("#Invoice_Date , #MaterialRcvdDate").datepicker({ + // minDate: new Date(year - SIAStartYear, 1, 1), + // maxDate: 'now', + // dateFormat: 'dd-mm-yy', + // changeMonth: true, + // changeYear: true, + // yearRange: '-100:+0' + // }); + // $('#Driver_Name').autocomplete({ - onSearchStart: function(query) { - //alert(query); - $('#Driver_Name').autocomplete("option", "minLength", 0); - }, + // onSearchStart: function(query) { + // //alert(query); + // $('#Driver_Name').autocomplete("option", "minLength", 0); + // }, - serviceUrl: "drivernameautocomplete", - onSelect: function(suggestion) { - var data = suggestion.DriverName; + // serviceUrl: "drivernameautocomplete", + // onSelect: function(suggestion) { + // var data = suggestion.DriverName; - } - }); - $('#DriverMobileNumber').autocomplete({ - serviceUrl: "drivermobileautocomplete", - params: { - driverName: function() { - return $('#Driver_Name').val(); // Pass the value of the DriverName input field - } - }, - onSearchStart: function(query) { - $('#DriverMobileNumber').autocomplete("option", "minLength", 0); - }, - onSelect: function(suggestion) { - var data = suggestion.DriverMobileNumber; - } - }); + // } + // }); + // $('#DriverMobileNumber').autocomplete({ + // serviceUrl: "drivermobileautocomplete", + // params: { + // driverName: function() { + // return $('#Driver_Name').val(); // Pass the value of the DriverName input field + // } + // }, + // onSearchStart: function(query) { + // $('#DriverMobileNumber').autocomplete("option", "minLength", 0); + // }, + // onSelect: function(suggestion) { + // var data = suggestion.DriverMobileNumber; + // } + // }); }); @@ -219,8 +219,13 @@ SupplierName ?> DeliveryChellanOrInvoiceNo ?> DeliveryChellanDate); - echo $date->format('d-m-Y'); ?>itemCount ?> ReceivedQuantity ?> NetWeight ?>
SNoRequisition NoItem CodeItem DescriptionQuantityUOMRateBasic AmountTax AmountTotal Order AmountSNoRequisition NoItem CodeItem DescriptionQuantityUOMRateBasic AmountTax AmountTotal Order Amount Action
${temp}${Reqnumber}${Reqnumber} ${materialCode}${materialName}${quantity}${rshorten}${quantity} ${uom} ${itemRate} ${basicval}
${temp}${Reqnumber}${Reqnumber} ${materialCode}${materialName}${quantity}${sshorten}${quantity} ${uom} ${itemRate} ${basicval}
- - - - - - - - - - - + + + + + + + + + + + @@ -2608,6 +2648,7 @@ if (!empty($INRSYMBOL)) { $("#MaterialCode").empty(); $("#CapitalDepartmentName").val(''); $("#CPUOM").val(''); + $("#CPRate").val(''); $("#CPQuantity").val(''); $("#CapitalItemName").val(''); $("#CPTotalAmount").val(''); @@ -2677,6 +2718,7 @@ if (!empty($INRSYMBOL)) { var id = $('#MaterialCode').val(); $("#CapitalItemName").val(''); $("#CPUOM").val(''); + $("#CPRate").val(''); $("#CPQuantity").val(''); $("#CPTotalAmount").val(''); RequistQuantity = ''; @@ -2689,6 +2731,7 @@ if (!empty($INRSYMBOL)) { if (obj.MaterialCode === id) { $("#CapitalItemName").val(obj.MaterialName); $("#CPUOM").val(obj.UOM); + $("#CPRate").val(obj.material_rate); var CPUOMDisplay = obj.UOM; $("#CPQuantity").val(obj.Quantity); RequistQuantity = obj.Quantity; @@ -2740,6 +2783,7 @@ if (!empty($INRSYMBOL)) { if (obj.MaterialCode === id) { $("#EditItemName").val(obj.MaterialName); $("#EditUOM").val(obj.UOM); + $("#EditRate").val(obj.material_rate); var EDITUOMDisplay = obj.UOM; $("#EditQuantity").val(obj.Quantity); RequistQuantity = obj.Quantity; @@ -3482,14 +3526,14 @@ if (!empty($INRSYMBOL)) { // Taxvalue: TotalTaxValue, // TotalValue: Total // })); - + var shorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName; var rowHtml = ` - + - - + - + - - - - + + + + diff --git a/app/Views/driverAttendance.php b/app/Views/driverAttendance.php index b7fc4bda..25d9846d 100755 --- a/app/Views/driverAttendance.php +++ b/app/Views/driverAttendance.php @@ -93,6 +93,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); + @@ -118,6 +119,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SNoRequisition NoItem CodeItem DescriptionLine Item SpecsQuantityUOMRateBasic AmountTax AmountTotal Order AmountSNoRequisition NoItem CodeItem DescriptionLine Item SpecsQuantityUOMRateBasic AmountTax AmountTotal Order Amount Action
${temp}${Reqnumber}${Reqnumber} ${materialCode}${materialName} + ${shorten} - ${quantity}${quantity} ${uom}${itemRate}${basicval}${TotalTaxValue}${Total}${itemRate}${basicval}${TotalTaxValue}${Total}     @@ -4391,6 +4435,7 @@ if (!empty($INRSYMBOL)) { var id = $('#EditMaterialCode').val(); $("#EditCapitalItemName").val(''); $("#EditCPUOM").val(''); + $("#EditCPRate").val(''); $("#EditCPQuantity").val(''); $("#EditCPTotalAmount").val(''); RequistQuantity = ''; @@ -4403,6 +4448,7 @@ if (!empty($INRSYMBOL)) { if (obj.MaterialCode === id) { $("#EditCapitalItemName").val(obj.MaterialName); $("#EditCPUOM").val(obj.UOM); + $("#EditCPRate").val(obj.material_rate); $("#EditCPQuantity").val(obj.Quantity); RequistQuantity = obj.Quantity; } @@ -4483,32 +4529,32 @@ if (!empty($INRSYMBOL)) { } else { basicAmountRate = parseFloat($('#CapitalBasicOrder').val()) - parseFloat($('#txtTotalDiscount').val()); } - if (validate()) { - if (document.getElementById('serviceTax').rows.length < 2) { - alert('Please Select Line item to Create PO'); - $('#Deliverydt').focus(); - return false; - } else if ($('#Otherpayment').val() == '' && $('#PaymentMethod').val() == 'PT08') { - alert('Please Enter Other Payable Terms Description'); - $('#Otherpayment').focus(); - return false; - } - // else if(parseInt(AvlBudAmt) < parseInt(basicAmountRate)) { + if (capitalValidate()) { + // if (document.getElementById('serviceTax').rows.length < 2) { + // alert('Please Select Line item to Create PO'); + // $('#Deliverydt').focus(); + // return false; + // } else if ($('#Otherpayment').val() == '' && $('#PaymentMethod').val() == 'PT08') { + // alert('Please Enter Other Payable Terms Description'); + // $('#Otherpayment').focus(); + // return false; + // } + // else if(parseInt(AvlBudAmt) < parseInt(basicAmountRate)) { // alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.'); - // return false; // } - else if ($('#PoTypeOptions').val() == "0") { - alert('Please Select POType'); - $('#PoTypeOptions').focus(); - return false; + // else if ($('#PoTypeOptions').val() == "0") { + // alert('Please Select POType'); + // $('#PoTypeOptions').focus(); + // return false; - } else { + // } else { // $('#content').loader('show'); var formData = new FormData($('.CapitalPO')[0]); formData.append('ExchangeRateOn', ExchangeRateOn); formData.append('PaymentMethod', PaymentMethod); $('#loader').show(); + disableButtons(); $.ajax({ data: formData, processData: false, @@ -4530,16 +4576,22 @@ if (!empty($INRSYMBOL)) { clearAfterAddLineItemAdd(); window.location = "purchaseorderListing"; - + setTimeout(function() { enableButtons(); }, 2000); } else { // $('#content').loader('hide'); alert("Error"); + setTimeout(function() { enableButtons(); }, 2000); } - } + }, + error: function(jqXHR, textStatus, errorThrown) { + console.error("AJAX Error: " + textStatus + ": " + errorThrown); + alert("Error: " + textStatus); + setTimeout(function() { enableButtons(); }, 2000); + } }); - } + // } } } @@ -5382,9 +5434,12 @@ if (!empty($INRSYMBOL)) { function Reset() { - location.reload(); - - } + disableButtons(); + location.reload(); + setTimeout(function() { + enableButtons(); + }, 2000); + } $('#insuranceTxtDiv').hide(); $("#insuranceStatus").change(function() { diff --git a/app/Views/configlisting.php b/app/Views/configlisting.php index 21bbde54..692f8580 100755 --- a/app/Views/configlisting.php +++ b/app/Views/configlisting.php @@ -192,12 +192,12 @@    - - + --> Vehicle Number Salary Amount Food AmountTotal Load Type Action
'> @@ -134,6 +136,64 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
Salary Amount
Diesel
Shed Amount
Total-
@@ -221,7 +281,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
- @@ -234,11 +294,11 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
- +
- +
@@ -303,13 +363,21 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); $("#gobal_driver_id").val(""); $("#driver_id").val(""); } + let gobal_diesel_amount = ""; + let gobal_shed_amount = ""; + if(gobal_diesel_amount != '' || gobal_shed_amount != ''){ + $('input[data-column="diesel_amount"]').val(parseFloat(gobal_diesel_amount) || 0); + $('input[data-column="shed_amount"]').val(parseFloat(gobal_shed_amount) || 0); + calculateTotal(); + } + $("#attendanceModal").on("shown.bs.modal", function (e) { var id = $(e.relatedTarget).data('id'); - let fields = ['invoice_number', 'vehicle_number', 'load_type', 'salary_amount', 'food_amount','customer','quantity']; + let fields = ['invoice_number', 'vehicle_number', 'load_type', 'salary_amount', 'food_amount','customer','quantity','total_amount']; fields.forEach(function(field) { $("#" + field).val(""); @@ -330,10 +398,18 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); if(field == 'driver_id'){ $("#driver_id").val(arr && arr['driver_id']); } - if(field == 'salary_amount' || field == 'food_amount') { - var ttl = parseFloat(arr['salary_amount']) + (parseFloat(arr['food_amount'] || 0)); + var salary = arr['salary_amount'] ? parseFloat(arr['salary_amount']) : 0; + var food = arr['food_amount'] ? parseFloat(arr['food_amount']) : 0; + + if (isNaN(salary)) salary = 0; + if (isNaN(food)) food = 0; + + var ttl = salary + food; + $('#total_amount').val(ttl.toFixed(2)); + + var ttl = parseFloat(salary) + parseFloat(food) ; $('#total_amount').val(ttl.toFixed(2)); - } + }); $('#attendanceTitle').html("Edit Driver Trip"); } @@ -418,20 +494,88 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); buttons: [ 'excel', 'pdf' ], - pageLength: 10, - lengthMenu: [ - [10, 20, 30, 50, -1], - [10, 20, 30, 50, "All"] - ], responsive: false, order: false, - language: { - paginate: { - next: '', // Next button icon - previous: '' // Previous button icon - } + paging: false, + footerCallback: function (row, data, start, end, display) { + var api = this.api(); + var isTableEmpty = api.data().length === 0; + // Hide or show the tfoot based on whether the table is empty + if (isTableEmpty) { + $(this).find('tfoot').hide(); // Hide tfoot if the table is empty + } else { + $(this).find('tfoot').show(); // Show tfoot if the table has data + } + var api = this.api(); + var columnIndex = 7; + var sum = api + .column(columnIndex, { page: 'current' }) + .data() + .reduce(function (a, b) { + return a + parseFloat(b.replace(/[^\d.-]/g, '')); + }, 0); + $(api.column(columnIndex).footer()).html(sum); + var api = this.api(); + var columnIndex = 8; + var sum = api + .column(columnIndex, { page: 'current' }) + .data() + .reduce(function (a, b) { + return a + parseFloat(b.replace(/[^\d.-]/g, '')); + }, 0); + $(api.column(columnIndex).footer()).html(sum); + var api = this.api(); + var columnIndex = 9; + var sum = api + .column(columnIndex, { page: 'current' }) + .data() + .reduce(function (a, b) { + return a + parseFloat(b.replace(/[^\d.-]/g, '')); + }, 0); + $(api.column(columnIndex).footer()).html(sum); + } + }); + // Function to calculate the total + function calculateTotal() { + var diesel = parseFloat($('input[data-column="diesel_amount"]').val()) || 0; + var shed = parseFloat($('input[data-column="shed_amount"]').val()) || 0; + var row = parseInt($('#rowTotalAmount').text()) || 0; + console.log(row); + + var total = row + diesel + shed; + $('#totalAmount').text(total); // Display the total with 2 decimal places + } + // Make the cells editable and calculate the total on input change + $(document).on('input', '.editable', function() { + calculateTotal(); + }); + $(document).on('blur', '.editable', function() { + var column = $(this).data('column'); // Get the column name (diesel or shed) + var value = $(this).val(); // Get the updated value + let gobal_driver_id = urlParams.get("gobal_driver_id"); + let gobal_date = urlParams.get("date"); + + // Send data to the server using AJAX + $.ajax({ + url: "updateDieselAndShedValuesBasedonEmpID", + method: 'POST', + data: { + column: column, + value: value, + date: gobal_date, + empid:gobal_driver_id + }, + success: function(response) { + console.log('Data saved successfully:', response); + }, + error: function(xhr, status, error) { + console.error('Error saving data:', error); } }); + }); + + // Initial calculation of the total + calculateTotal(); }); @@ -463,25 +607,29 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); if (result) { return result; } else { event.preventDefault(); } } - function salary() { - - var type = $('#load_type').val(); - - if(type == 'Load'){ - var value = parseFloat(1300); - $('#salary_amount').val(value); - }else if(type == 'Waste Core'){ - var value = parseFloat(1050); - $('#salary_amount').val(value); - } - var sa = parseFloat($('#salary_amount').val()) || 0; - var fa = parseFloat($('#food_amount').val()) || 0; - var ttl = sa + fa; - - $('#total_amount').val(ttl.toFixed(2)); + $(document).ready(function() { + updateSalaryBasedOnType(); + fetchSalary(); + }); + function updateSalaryBasedOnType() { + var type = $('#load_type').val(); + if (type == 'Load') { + $('#salary_amount').val(1300); + } else if (type == 'Waste Core') { + $('#salary_amount').val(1050); + } + fetchSalary(); } + function fetchSalary() { + var sa = parseFloat($('#salary_amount').val()) || 0; + var fa = parseFloat($('#food_amount').val()) || 0; + var ttl = sa + fa; + + $('#total_amount').val(ttl.toFixed(2)); + } + function customerandquantity(){ if ($('#invoice_number').val() === '') { alert('Please Enter the Valid Invoice Number'); diff --git a/app/Views/driverListing.php b/app/Views/driverListing.php index f6cb32c8..184ad120 100755 --- a/app/Views/driverListing.php +++ b/app/Views/driverListing.php @@ -63,9 +63,7 @@     - -     - + diff --git a/app/Views/driverPayslipGeneratePrint (Copy).php b/app/Views/driverPayslipGeneratePrint (Copy).php new file mode 100755 index 00000000..0650169c --- /dev/null +++ b/app/Views/driverPayslipGeneratePrint (Copy).php @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + +
+
+ +
+ +
+
Resico (India) Pvt Ltd
196/4 B, 126, Mettupalayam Village, Sriperumbudur(Taluk), +
kancheepuram (Dist), Tamil Nadu, India - 631604.
PaySlip for the Month of PayOn ?>
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Name name; ?>
Designation
No Of Loads no_of_loads ?>
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EarningsAmount
 Driver Monthly Salary Amount driver_monthly_salary_amount; ?> 
 Driver Monthly Food Amountdriver_monthly_food_amount; ?> 
 Diesel diesel ?> 
 Shed Duty Amount shed_duty_amount ?> 
Net Pay(Rounded)  driver_final_payment),2,'.','') ?> 
Total Amount In Words  
This is a computer generated document. This document does not require signature.
+ + \ No newline at end of file diff --git a/app/Views/driverPayslipGeneratePrint.php b/app/Views/driverPayslipGeneratePrint.php index 0650169c..9e82bc46 100755 --- a/app/Views/driverPayslipGeneratePrint.php +++ b/app/Views/driverPayslipGeneratePrint.php @@ -11,7 +11,7 @@ - +
Resico (India) Pvt Ltd
196/4 B, 126, Mettupalayam Village, Sriperumbudur(Taluk),
kancheepuram (Dist), Tamil Nadu, India - 631604.
PaySlip for the Month of PayOn ?>
@@ -20,27 +20,48 @@ - + - + - - + + - + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + +
Name name; ?>driver_name; ?> Employee ID EmpID ?>
Designation Designation ?> Department DeptName ?>
No Of Loads no_of_loads ?>Date Of Joining DOJ)) ?> No Of Loads no_of_loads ?>
Bank Name BankName ?>PAN Number Pan;?>
Bank Acc No BankAccountNumber ?> Aadhar NumberAadharNo);?>
Bank IFSC IFSCCode ?>Loan Balance BalanceAdvance ?>
@@ -48,35 +69,61 @@ - + - - + + + + - - + + + + - - + + + + + + - - + + + + + + + + + + + + + + - - + + - - - + + + -
EarningsAmount
EarningsAmount DeductionsAmount
 Driver Monthly Salary Amount driver_monthly_salary_amount; ?>  Basicmonthly_salary_amount; ?>  PF 
 Driver Monthly Food Amountdriver_monthly_food_amount; ?>  Dieseldiesel_amount; ?>  ESI  
 Diesel diesel ?>  Shed Duty Amountshed_amount; ?>  Salary Advance Advance ?> 
 Shed Duty Amount shed_duty_amount ?>  BonusFestival_Bonus; ?>   
 Total Earning (Rounded) + monthly_salary_amount + $PayDetails[0]->Festival_Bonus + $PayDetails[0]->diesel_amount + $PayDetails[0]->shed_amount; + echo number_format(round($totEarning),2) + ?> +  Total Deduction (Rounded) + Advance+$esi_amount + $pf_amount ; + echo number_format(round($totDeduction),2) + ?> + 
Net Pay(Rounded)  driver_final_payment),2,'.','') ?> 
Net Pay(Rounded)  final_payment),2,'.','') ?> 
Total Amount In Words  
Total Amount In Words  
This is a computer generated document. This document does not require signature.
- - \ No newline at end of file + \ No newline at end of file diff --git a/app/Views/editCapitalAmendPO.php b/app/Views/editCapitalAmendPO.php index 3a6058c8..1dc1ae3c 100755 --- a/app/Views/editCapitalAmendPO.php +++ b/app/Views/editCapitalAmendPO.php @@ -797,22 +797,20 @@ if (!empty($POItem) && $CapitalRange == '1') {
- - - - - - - - - - - - - + + + + + + + + + + @@ -826,16 +824,17 @@ if (!empty($POItem) && $CapitalRange == '1') { ?> - - - - - - - + + + + + + - - @@ -3453,29 +3452,27 @@ Calculate Landing charge //alert(basicamt); } - if (validate()) { + if (capitalValidate()) { var ex = $('#ExchangeRt').val(); //alert(ex); //alert(parseInt($('#CapitalToatlOrder').val() * ex)); var AvlBudAmt = ''; //alert(AvlBudAmt); - if (document.getElementById('serviceTax').rows.length < 2) { - alert('Please Select Line item to Create PO'); - $('#Deliverydt').focus(); - return false; - } else if ($('#Otherpayment').val() == '' && $('#PaymentMethod').val() == 'PT08') { - alert('Please Enter Other Payable Terms Description'); - $('#Otherpayment').focus(); - return false; - } - + // if (document.getElementById('serviceTax').rows.length < 2) { + // alert('Please Select Line item to Create PO'); + // $('#Deliverydt').focus(); + // return false; + // } else if ($('#Otherpayment').val() == '' && $('#PaymentMethod').val() == 'PT08') { + // alert('Please Enter Other Payable Terms Description'); + // $('#Otherpayment').focus(); + // return false; + // } // else if(parseInt(AvlBudAmt) < parseInt(basicamt)) { - // alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.'); - - // return false; - // } - else { + // alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.'); + // return false; + // } + // else { //alert('else'); @@ -3500,7 +3497,7 @@ Calculate Landing charge $('#loader').show(); - + disableButtons(); $.ajax({ // data:$('.CapitalPO').serialize()+"&ExchangeRateOn="+ExchangeRateOn+"&PaymentMethod="+PaymentMethod+"&PayableAT="+PayableAT+"&PaymentDate="+PaymentDate, type: "POST", @@ -3519,15 +3516,17 @@ Calculate Landing charge $('#SpcialInstruction').val(''); $('#txtDeliveryAddress').val(''); window.location = status == 1 ? "amendmentpurchaseorder" : "purchaseorderListing"; + setTimeout(function() { enableButtons(); }, 2000); } else { $('#loader').hide(); alert("Error"); + setTimeout(function() { enableButtons(); }, 2000); } } }); - } + // } } } diff --git a/app/Views/editCapitalPo.php b/app/Views/editCapitalPo.php index 556e9f2f..714ee71a 100755 --- a/app/Views/editCapitalPo.php +++ b/app/Views/editCapitalPo.php @@ -870,7 +870,7 @@ if (!empty($getlogpodtl)) {
- +
@@ -888,16 +888,16 @@ if (!empty($getlogpodtl)) {
- - - - - - - - - - + + + + + + + + + + @@ -920,9 +920,10 @@ if (!empty($getlogpodtl)) { ?> - + - + - - - - + + + + - - + - + - + - + $record->MaterialCode, "ReqNo" => $record->ReqNo); array_push($res_arr_values, $row); @@ -990,11 +991,11 @@ if (!empty($getlogpodtl)) { - - @@ -1021,11 +1022,11 @@ if (!empty($getlogpodtl)) { - - - - - - - @@ -1159,13 +1160,13 @@ if (!empty($getlogpodtl)) { - - - @@ -1564,7 +1565,7 @@ if (!empty($getlogpodtl)) { -
+
@@ -1957,7 +1958,7 @@ if (!empty($getlogpodtl)) { echo form_input($data); ?>
-
+
@@ -1982,7 +1983,7 @@ if (!empty($getlogpodtl)) {
-
+
@@ -2011,7 +2012,7 @@ if (!empty($getlogpodtl)) {
-
+
@@ -2038,7 +2039,7 @@ if (!empty($getlogpodtl)) {
-
+
@@ -2049,7 +2050,7 @@ if (!empty($getlogpodtl)) { ?>
-
+
@@ -2645,7 +2646,7 @@ if (!empty($getlogpodtl)) { ?>
-
+
@@ -2669,7 +2670,7 @@ if (!empty($getlogpodtl)) {
-
+
@@ -2694,7 +2695,7 @@ if (!empty($getlogpodtl)) {
-
+
@@ -2721,7 +2722,7 @@ if (!empty($getlogpodtl)) {
-
+
@@ -2733,7 +2734,7 @@ if (!empty($getlogpodtl)) { ?>
-
+
@@ -3278,7 +3279,7 @@ if (!empty($getlogpodtl)) {
-
+
CGST In %
@@ -3295,7 +3296,7 @@ if (!empty($getlogpodtl)) {
-
+
SGST In %
@@ -3312,7 +3313,7 @@ if (!empty($getlogpodtl)) {
-
+
IGST In %
@@ -3329,7 +3330,7 @@ if (!empty($getlogpodtl)) {
-
+
@@ -3340,7 +3341,7 @@ if (!empty($getlogpodtl)) {
-
+
@@ -3642,7 +3643,7 @@ if (!empty($getlogpodtl)) {
-
- `; + `; if (PONOStatus === "PO_DRAFT" || PONOStatus === "PO_CREATED") { rowHtml += ``; }else{ rowHtml += ``; } - rowHtml += ` - - - - - + rowHtml += ` + + + + +
SNoRequisition NoItem NameQuantityUOMRateBasic AmountTax AmountTotal Order AmountActionSNoRequisition NoItem DescriptionQuantityUOMRateBasic AmountTax AmountTotal Order AmountAction
ReqNo ?>MaterialName ?>Quantity ?>UOM ?>Rate ?> + ReqNo ?>MaterialName, 0, 13, "..."); + echo $shortName; ?>Quantity ?>UOM ?>Rate, 2, '.', ''); ?> Rate * $record->Quantity, 2, '.', ''); ?> ServiceTaxamount; } else if ($CapitalRange == '0') { echo "0.0"; @@ -845,12 +844,12 @@ if (!empty($POItem) && $CapitalRange == '1') { - Rate * $record->Quantity + $record->ServiceTaxamount + $record->otherallowance + $record->Afvalue - $record->Afterdiscountval, 2, '.', '') ?> + Rate * $record->Quantity + $record->ServiceTaxamount + $record->otherallowance + $record->Afvalue - $record->Afterdiscountval, 2, '.', '') ?> + Rate * $record->Quantity), 2, '.', ''); ?>
SNoRequisition NoItem CodeItem DescriptionLine Item SpecsQuantityUOMRateBasic AmountTax AmountTotal Order AmountRequisition NoItem CodeItem DescriptionLine Item SpecsQuantityUOMRateBasic AmountTax AmountTotal Order Amount
ReqNo ?>ReqNo ?> MaterialCode ?>MaterialName ?>MaterialName, 0, 13, "..."); + echo $shortName; ?> LineitemAuditorNotes) ? $record->LineitemAuditorNotes : "-"; } ?> Quantity ?>UOM ?>Rate ?>Rate * $record->Quantity, 2, '.', '') ?>Quantity ?>UOM ?>Rate ?>Rate * $record->Quantity, 2, '.', '') ?> ServiceTaxamount; ?> + ServiceTaxamount; ?> Rate * $record->Quantity + $record->ServiceTaxamount + $record->otherallowance + $record->Afvalue - $record->Afterdiscountval, 2, '.', '') ?> Rate * $record->Quantity, 2, '.', '') ?>Rate * $record->Quantity, 2, '.', '') ?>
${temp} ${Reqnumber} ${materialCode}${materialName}${shorten}-${quantity}${uom}${itemRate}${basicval}${TotalTaxValue}${Total}${quantity}${uom}${itemRate}${basicval}${TotalTaxValue}${Total} @@ -5358,15 +5360,8 @@ if (!empty($getlogpodtl)) { type: "POST", url: "purchaseorder/DeletePODetails", success: function (data) { - $('#loader').show(); - - if (data) { - // $('#content').loader('hide'); - alert(data); - } else { - alert("Error"); - } - + $('#loader').hide(); + (data) ? alert(response) : alert("Error"); } }); } @@ -5996,26 +5991,25 @@ if (!empty($getlogpodtl)) { basicAmountRate = parseFloat($('#CapitalBasicOrder').val()) - parseFloat($('#txtTotalDiscount').val()); } - if (validate()) { - if (document.getElementById('serviceTax').rows.length < 2) { - alert('Please Select Line item to Create PO'); - $('#Deliverydt').focus(); - return false; - } else if ($('#Otherpayment').val() == '' && $('#PaymentMethod').val() == 'PT08') { - alert('Please Enter Other Payable Terms Description'); - $('#Otherpayment').focus(); - return false; - } + if (capitalValidate()) { + // if (document.getElementById('serviceTax').rows.length < 2) { + // alert('Please Select Line item to Create PO'); + // $('#Deliverydt').focus(); + // return false; + // } else if ($('#Otherpayment').val() == '' && $('#PaymentMethod').val() == 'PT08') { + // alert('Please Enter Other Payable Terms Description'); + // $('#Otherpayment').focus(); + // return false; + // } // else if(parseInt(AvlBudAmt) < parseInt(basicAmountRate)) { // alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.'); - // return false; - // } - else { + // } else { //alert('else'); $('#loader').show(); + disableButtons(); //alert('ss'); var formData = new FormData($('.CapitalPO')[0]); formData.append('ExchangeRateOn', ExchangeRateOn); @@ -6066,15 +6060,17 @@ if (!empty($getlogpodtl)) { clearAfterAddLineItemAdd(); window.location = "purchaseorderListing"; + setTimeout(function() { enableButtons(); }, 2000); } else { // $('#content').loader('hide'); alert("Error"); + setTimeout(function() { enableButtons(); }, 2000); } } }); - } + // } } } diff --git a/app/Views/editEmployeenew.php b/app/Views/editEmployeenew.php index e8a326ce..c4420bcf 100755 --- a/app/Views/editEmployeenew.php +++ b/app/Views/editEmployeenew.php @@ -6,6 +6,13 @@ label { font-style: bold; } + + input[type="file"] { + white-space: normal; + word-wrap: break-word; + overflow-wrap: break-word; + width: 100%; + } IsActive; $ProfilePicPath = ''; + $is_driver = $Emp->is_driver; if (!empty($Emp->ProfilePic)) { @@ -235,6 +244,11 @@ if (!empty($EmpDetails)) { + ProfilePic){ ?> +
+ + +
+
+ + + +
+

@@ -674,25 +702,25 @@ if (!empty($EmpDetails)) {
- +
- + + onkeypress="return isNumberKey(event)" required>
- + + value="" required>
@@ -779,31 +807,6 @@ if (!empty($EmpDetails)) {
-
-
- - -
-
-
-
- - * - - - -
-
@@ -827,6 +830,31 @@ if (!empty($EmpDetails)) { title="Enter the valid PF Rate, Minimum 1 digit, Maximum 2 digits" readonly /> +
+
+
+
+ + +
+
+
+
+ + * + + +
@@ -1108,7 +1136,7 @@ if (!empty($EmpDetails)) {
- + @@ -1126,7 +1154,7 @@ if (!empty($EmpDetails)) {
-
+
@@ -1235,13 +1263,13 @@ if (!empty($EmpDetails)) {
- +
- +
@@ -1318,6 +1346,15 @@ if (!empty($EmpDetails)) { } }); + $("#currentaddress, #permanentaddress").on("keyup change", function () { + if ($("#currentaddress").val().trim() === $("#permanentaddress").val().trim()) { + $("#checksame").prop("disabled", false); + $("#checksame").prop("checked", true); + } else { + $("#checksame").prop("disabled", true); + $("#checksame").prop("checked", false); + } + }); }); @@ -1699,6 +1736,18 @@ if (!empty($EmpDetails)) { } $(document).ready(function () { + var driverChecked = ""; + if (driverChecked) { + $('#Total_salary').prop('required', false); + $('#Total_salary').prop('readonly', true); + } + if ($("#currentaddress").val().trim() === $("#permanentaddress").val().trim()) { + $("#checksame").prop("disabled", false); // Enable checkbox + $("#checksame").prop("checked", true); // Optionally check it + } else { + $("#checksame").prop("disabled", true); // Disable checkbox + $("#checksame").prop("checked", false); + } $("#gender").select2(); $("#MartialStatus").select2(); $("#desigination").select2(); @@ -1735,6 +1784,15 @@ if (!empty($EmpDetails)) { function updateSwitchValue(checkbox) { checkbox.value = checkbox.checked ? "1" : "0"; } + function driverCheck(driver) { + if (driver.checked) { + $('#Total_salary').prop('required', false); + $('#Total_salary').prop('readonly', true); + } else { + $('#Total_salary').prop('required', true); + $('#Total_salary').prop('readonly', false); + } + } function calculalteHRA() { //var empid=document.getElementById('emp').value; @@ -1868,6 +1926,48 @@ if (!empty($EmpDetails)) { } }); + $('#ContactNumber').change(function() { + +var ContactNumber = $('#ContactNumber').val(); + +if (getMobileValidation() && ContactNumber != "") { + $('#loader').show(); + $.ajax({ + data: { + ContactNumber + }, + + type: "POST", + url: "employeeMobileExist", + success: function(response) { + $('#loader').hide(); + + let responseCheck = response.data[0]; + let responseContactNumber=response.data[0].ContactNumber; + + if(responseCheck ){ + if (responseContactNumber == ContactNumber) { + + var answer = confirm(" Contact Number details is already exists !!.Kindly Provide us another Contact Number" + ) + + $('#ContactNumber').val(''); + $('#ContactNumber').focus(); + return false; + + } + } + + }, + complete: function() { + $('#loader').hide(); // Ensure the loader is always hidden after the request completes + } + + }); +} + +}); + $('#panno').change(function () { var panNo = $('#panno').val(); diff --git a/app/Views/editImportAmendPO.php b/app/Views/editImportAmendPO.php index dacd1a37..d79e7184 100755 --- a/app/Views/editImportAmendPO.php +++ b/app/Views/editImportAmendPO.php @@ -1199,16 +1199,21 @@ if (!empty($RequistionDetails)) {
- +
- - - - - - - + + + + + + + + + + + + @@ -1225,13 +1230,14 @@ if (!empty($RequistionDetails)) { ?> - - - - + + + + - - + + @@ -2920,13 +2926,14 @@ if (!empty($RequistionDetails)) { if (validate() && Budgetcheck()) { - if (document.getElementById('ImportTax').rows.length <= 0) { + // if (document.getElementById('ImportTax').rows.length <= 0) { - alert('Please Select Line item to Create PO'); - $('#Deliverydt').focus(); - return false; - } else { + // alert('Please Select Line item to Create PO'); + // $('#Deliverydt').focus(); + // return false; + // } else { $('#loader').show(); + disableButtons(); var formData = new FormData($('.ImportPO')[0]); if (status == 0) { // for draft @@ -2957,21 +2964,29 @@ if (!empty($RequistionDetails)) { //$('#txtDeliveryAddress').val(''); window.location = status == 1 ? "amendmentpurchaseorder" : "purchaseorderListing"; + setTimeout(function() { enableButtons(); }, 2000); + } else { alert("Error"); + setTimeout(function() { enableButtons(); }, 2000); + } }, error : function (){ console.error(error); + setTimeout(function() { enableButtons(); }, 2000); + }, complete : function (){ console.log("ajax call is completed "); + setTimeout(function() { enableButtons(); }, 2000); + } }); - } + // } } } diff --git a/app/Views/editRawmaterial.php b/app/Views/editRawmaterial.php index 0275935b..76b374a8 100755 --- a/app/Views/editRawmaterial.php +++ b/app/Views/editRawmaterial.php @@ -26,6 +26,7 @@ if (!empty($materialDetails)) { $UOM = $MD->UOM; $remarks = $MD->Remarks; $HSNcode = $MD->HSNCODE; + $material_rate = $MD->material_rate; $openstock = $MD->stock; $date = $MD->stockdate; $reorder = $MD->reorder; @@ -84,10 +85,11 @@ if ($total <= $reorder) { $("#Date").datepicker({ //minDate :'now', //maxDate : 'now', - dateFormat: 'dd-mm-yy', + format: 'dd-mm-yyyy', changeMonth: true, changeYear: true, - yearRange: '-100:+1' + yearRange: '-100:+1', + orientation: 'bottom', }); }); @@ -161,25 +163,25 @@ if ($total <= $reorder) { - +
- -
@@ -211,6 +213,12 @@ if ($total <= $reorder) { +
+
+ + +
+
@@ -226,25 +234,32 @@ if ($total <= $reorder) {
- + +
- + 'Date', 'value' => set_value('Date',$formattedDate), 'id' => 'Date', 'class' => 'form-control', 'onkeypress' => 'return false;','readonly'=>true, 'autocomplete'=>'"off"'); + echo form_input($data); + ?> +
- + 'Date', 'value' => set_value('Date'), 'id' => 'Date', 'class' => 'form-control', 'onkeypress' => 'return false;', 'autocomplete'=>'"off"'); + echo form_input($data); + ?> +
-
-
-
@@ -264,19 +279,27 @@ if ($total <= $reorder) {
+
+
-
-
- +
+
+ + +
+
-
- > + +
@@ -284,9 +307,9 @@ if ($total <= $reorder) { @@ -304,28 +327,28 @@ if ($total <= $reorder) {
-
-
SNoRequisition NoItem NameQuantityUOMRateBasic AmountSNoRequisition NoItem DescriptionQuantityUOMRateBasic Amount Action
ReqNo ?>MaterialName ?>Quantity ?>ReqNo ?>MaterialName, 0, 13, "..."); + echo $shortName; ?>Quantity ?> UOM ?>Rate ?>BasicValue ?>Rate ?>BasicValue ?>
+
- - - - - - - - - + + + + + + + + + @@ -1248,17 +1248,18 @@ if (!empty($INRSYMBOL)) { ?> - - - + + + - + - - - + + @@ -2547,21 +2548,21 @@ if (!empty($INRSYMBOL)) { var txtTotBasicAmount = $('#txtTotBasicAmount').val(); var txtTotalDiscount = $('#txtTotalDiscount').val(); //alert('Before Validate IF condition'); - if (validate()) { + if (revenueValidate()) { //alert('insdie Validate IF condition'); var realrows = document.getElementById('txtRowCount').value; //alert(realrows); - if (document.getElementById('revenueTax').rows.length < 2) { - alert('Please Select Line item to Create PO'); - $('#Deliverydt').focus(); - return false; - } + // if (document.getElementById('revenueTax').rows.length < 2) { + // alert('Please Select Line item to Create PO'); + // $('#Deliverydt').focus(); + // return false; + // } // else if(parseInt(AvlBudAmt) < (parseInt(txtTotBasicAmount) - parseInt(txtTotalDiscount))) { // alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.'); // return false; // } - else { + // else { //alert('final else for store data'); // $('.content').loader('show'); var formData = new FormData($('.CreatePO')[0]); @@ -2574,6 +2575,7 @@ if (!empty($INRSYMBOL)) { }; $('#loader').show(); + disableButtons(); $.ajax({ // data:$('.CreatePO').serialize(), type: "POST", @@ -2592,22 +2594,25 @@ if (!empty($INRSYMBOL)) { $('#txtDeliveryAddress').val('') window.location = (status == 1) ? "amendmentpurchaseorder" : "purchaseorderListing"; - + setTimeout(function() { enableButtons(); }, 2000); } else { $('#loader').hide(); + setTimeout(function() { enableButtons(); }, 2000); } }, error : function(error){ console.error("error occured" + error); + setTimeout(function() { enableButtons(); }, 2000); }, complete : function (){ $('#loader').hide(); console.log("ajax call is completed ..!!") + setTimeout(function() { enableButtons(); }, 2000); } }); - } + // } } } diff --git a/app/Views/editRevenuepurchaseorder.php b/app/Views/editRevenuepurchaseorder.php index a8251fb0..3baeac77 100755 --- a/app/Views/editRevenuepurchaseorder.php +++ b/app/Views/editRevenuepurchaseorder.php @@ -191,7 +191,7 @@ $Reqon = ''; $RequesterName = ''; if (!empty($POMaster)) { - //print_r($POMaster); + // dd($POMaster); //print_r($POItem); foreach ($POMaster as $Req) { $parentPO = $Req->ParentPO; @@ -218,6 +218,7 @@ if (!empty($POMaster)) { $DeliveryAddress = $Req->DeliveryAddress; $PONOStatus = $Req->StatusCode; + // dd($PONOStatus); $PONO = $Req->PONO; $ServiceDescription = $Req->ServiceDescription; $CapitalRange = $Req->CapitalRange; @@ -2331,28 +2332,28 @@ if (!empty($getlogpodtl)) { - - - - - - - - + + + + + + + - - - - + @@ -2364,11 +2365,12 @@ if (!empty($getlogpodtl)) { $index = $index + 1; ?> - + - - - + + - - + + - + - `; + `; if (PONOStatus === "PO_DRAFT" || PONOStatus === "PO_CREATED") { - rowHtml += ``; - }else{ rowHtml += ``; } + }else{ rowHtml += ``; } rowHtml += ` - + @@ -5087,12 +5092,7 @@ if (!empty($getlogpodtl)) { url: "purchaseorder/DeletePODetails", success: function (data) { $('#loader').hide(); - if (data) { - alert(data); - - } else { - alert("Error"); - } + (data) ? alert(response) : alert("Error"); } }); @@ -5377,12 +5377,12 @@ if (!empty($getlogpodtl)) { var totaldiscount = $('#txtTotalDiscount').val(); //alert(txtTotalbasicamount+'-'+totaldiscount); //alert(txtTotalbasicamount-totaldiscount); - if (validate()) { - if (document.getElementById('revenueTax').rows.length < 2) { - alert('Please Select Line item to Create PO'); - $('#Deliverydt').focus(); - return false; - } + if (revenueValidate()) { + // if (document.getElementById('revenueTax').rows.length < 2) { + // alert('Please Select Line item to Create PO'); + // $('#Deliverydt').focus(); + // return false; + // } //else if(validateBudgetExceedLimit()) //{ // return false; @@ -5392,17 +5392,18 @@ if (!empty($getlogpodtl)) { // return false; // } - else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { - alert('Please Enter Payable Terms Description'); - $('#Otherpayment').focus(); - return false; - } else if ($('#insurancestatus').val() == 1 && $('#InsuranceNumber').val() == '') { - alert('Please Enter Insurance No / Insurance Details..!'); - $('#insurance').focus(); - return false; - } else { + // else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { + // alert('Please Enter Payable Terms Description'); + // $('#Otherpayment').focus(); + // return false; + // } else if ($('#insurancestatus').val() == 1 && $('#InsuranceNumber').val() == '') { + // alert('Please Enter Insurance No / Insurance Details..!'); + // $('#insurance').focus(); + // return false; + // } else { var formData = new FormData($('.CreatePO')[0]); $('#loader').show(); + disableButtons(); $.ajax({ type: "POST", url: "purchaseorder/EditRevenuePurchaseOrder", @@ -5420,9 +5421,11 @@ if (!empty($getlogpodtl)) { $('#SpcialInstruction').val(''); $('#txtDeliveryAddress').val('') window.location = "purchaseorderListing"; + setTimeout(function() { enableButtons(); }, 2000); } else { alert("Something went wrong"); + setTimeout(function() { enableButtons(); }, 2000); } }, @@ -5431,6 +5434,7 @@ if (!empty($getlogpodtl)) { $('#loader').hide(); console.error("AJAX Error: ", textStatus, errorThrown); alert("An error occurred: " + textStatus + " - " + errorThrown); + setTimeout(function() { enableButtons(); }, 2000); }, @@ -5438,10 +5442,11 @@ if (!empty($getlogpodtl)) { // // Actions that should always happen regardless of success or error // console.log("AJAX request completed."); // $('#loader').hide(); // Hide the loader in any case + // setTimeout(function() { enableButtons(); }, 2000); // } }); - } + // } } } $(document).ready(function () { diff --git a/app/Views/editServiceAmendPO.php b/app/Views/editServiceAmendPO.php index a9b852ce..0797e057 100755 --- a/app/Views/editServiceAmendPO.php +++ b/app/Views/editServiceAmendPO.php @@ -1016,18 +1016,18 @@ foreach ($PaymentTerms as $TER) { - - - - - - - - - - - - + + + + + + + + + + + + @@ -1053,19 +1053,20 @@ foreach ($PaymentTerms as $TER) { ?> - - + + - - + + - - - - - - - + + + + + + + @@ -2044,14 +2045,8 @@ foreach ($PaymentTerms as $TER) { type: "POST", url: "purchaseorder/DeletePODetails", success: function(data) { - if (data) { - $('#loader').hide(); - alert(data); - } else { - $('#loader').hide(); - alert("Error"); - } - + $('#loader').hide(); + (data) ? alert(response) : alert("Error"); } }); } @@ -2197,31 +2192,32 @@ foreach ($PaymentTerms as $TER) { var txtTotalOrderValueSummary = $('#txtTotBasicAmount').val(); // alert("worked"); - // if (validate()) { + if (serviceValidate()) { // if(parseInt(AvlBudAmt) < parseInt(txtTotalOrderValueSummary)) { // alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.'); // return false; // } - if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { - alert('Please Enter Other Payment Details'); - $('#Otherpayment').focus(); - return false; - } else if ($('#amenddescofpo').val().trim() == '') { - alert('Please Enter Description Of Service'); - $('#amenddescofpo').focus(); - return false; - } else { + // if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { + // alert('Please Enter Other Payment Details'); + // $('#Otherpayment').focus(); + // return false; + // } else if ($('#amenddescofpo').val().trim() == '') { + // alert('Please Enter Description Of Service'); + // $('#amenddescofpo').focus(); + // return false; + // } else { // $('#content').loader('show'); - var formData = new FormData($('.ServicePO')[0]); - if (status == 0) { // for draft + var formData = new FormData($('.ServicePO')[0]); + if (status == 0) { // for draft formData.append('changeStatus','ST014'); }; if (status == 1) { // for approve formData.append('changeStatus','ST026'); }; - $('#loader').show(); + disableButtons(); + $('#loader').show(); $.ajax({ // data: $('.ServicePO').serialize(), type: "POST", @@ -2240,15 +2236,19 @@ foreach ($PaymentTerms as $TER) { $('#txtDeliveryAddress').val('') window.location = status == 1 ? "amendmentpurchaseorder" : "purchaseorderListing"; + setTimeout(function() { enableButtons(); }, 2000); } else { + setTimeout(function() { enableButtons(); }, 2000); $('#loader').hide(); console.error("Error"); } }, error : function (error){ + setTimeout(function() { enableButtons(); }, 2000); console.log("error occurred" , error); }, complete : function (){ + setTimeout(function() { enableButtons(); }, 2000); console.log("Ajax call is completed ..!!"); } }); diff --git a/app/Views/editconfig.php b/app/Views/editconfig.php index 20bf6e67..ccbfc09c 100755 --- a/app/Views/editconfig.php +++ b/app/Views/editconfig.php @@ -18,6 +18,11 @@ if (!empty($master)) { } } ?> +
@@ -149,7 +154,11 @@ if (!empty($master)) { } ?>">
- + Config_ID === 'C023'){ ?> + + + + - + + 0){?> + + + + + + - + + 0){?> + + + + @@ -408,8 +423,7 @@ $timeOtions[] = "12:00 AM"; - - + @@ -420,20 +434,16 @@ $timeOtions[] = "12:00 AM"; - - - - - - - - - - - - - - + + + + + + + + + + @@ -445,17 +455,16 @@ $timeOtions[] = "12:00 AM"; - - - - - - - - - - - + + + + + + + + + + @@ -485,8 +494,8 @@ $timeOtions[] = "12:00 AM"; @@ -555,14 +564,14 @@ $timeOtions[] = "12:00 AM"; - - - + - - - + - - - - - - - - - - - + + - - - - - - - + @@ -747,7 +718,7 @@ $timeOtions[] = "12:00 AM"; - - - - - - - - - - - - - - - + + + + @@ -942,8 +895,11 @@ $timeOtions[] = "12:00 AM"; $eachDate = $trpProductionDetail['date']; // Unique identifier + + // Initialize the date entry if it doesn't exist if (!isset($summary['totalHours'])) { + $summary = [ 'totalHours' => 0, 'coldStart' => 0, @@ -959,24 +915,12 @@ $timeOtions[] = "12:00 AM"; 'trpPhysicalGasPerTon' => 0, 'panelGasConsumption' => 0, 'panelGasPerTon' => 0, - 'ALs_wcs' => 0, - 'ALe_wcs' => 0, - 'ME_wcs' => 0, - 'SI_wcs' => 0, - 'caparo_wcs' => 0, - 'Nemak_wcs' => 0, - 'DR_wcs' => 0, 'edRunningHours' => 0, 'edProduction' => 0, 'edUsage' => 0, 'trpProduction' => 0, 'trpProductionPerHour' => 0, 'coating' => 0, - 'ALs_crs' => 0, - 'Nemak_crs' => 0, - 'ME_crs' => 0, - 'BI_crs' => 0, - 'Karmen_crs' => 0, 'waterReceipt' => 0, 'waterConsumption' => 0, 'ebReading' => 0, @@ -991,13 +935,22 @@ $timeOtions[] = "12:00 AM"; 'cycloneWaste' => 0 ]; + + foreach($crsClientList as $client){ + $summary[$client] = 0; + } + + foreach($wcsSupplierList as $supplier){ + $summary[$supplier] = 0; + } + } // Sum values for the material $summary['totalHours'] += is_numeric($trpProductionDetail['totalHours']) ? $trpProductionDetail['totalHours'] : 0; $summary['coldStart'] += is_numeric($trpProductionDetail['coldStart']) ? $trpProductionDetail['coldStart'] : 0; - $summary['breakdownHours'] += is_numeric($trpProductionDetail['breakdownHours']) ? $trpProductionDetail['breakDownHours'] : 0; + $summary['breakdownHours'] += is_numeric($trpProductionDetail['breakdownHours']) ? $trpProductionDetail['breakdownHours'] : 0; $summary['burnerFiringHours'] += is_numeric($trpProductionDetail['burnerFiringHours']) ? $trpProductionDetail['burnerFiringHours'] : 0; $summary['sandFeedingHours'] += is_numeric($trpProductionDetail['sandFeedingHours']) ? $trpProductionDetail['sandFeedingHours'] : 0; $summary['gasReceiptBg'] += is_numeric($trpProductionDetail['gasReceiptBg']) ? $trpProductionDetail['gasReceiptBg'] : 0; @@ -1009,24 +962,22 @@ $timeOtions[] = "12:00 AM"; $summary['trpPhysicalGasPerTon'] += is_numeric($trpProductionDetail['trpPhysicalGasPerTon']) ? $trpProductionDetail['trpPhysicalGasPerTon'] : 0; $summary['panelGasConsumption'] += is_numeric($trpProductionDetail['panelGasConsumption']) ? $trpProductionDetail['panelGasConsumption'] : 0; $summary['panelGasPerTon'] += is_numeric($trpProductionDetail['panelGasPerTon']) ? $trpProductionDetail['panelGasPerTon'] : 0; - $summary['ALs_wcs'] += is_numeric($trpProductionDetail['ALs_wcs']) ? $trpProductionDetail['ALs_wcs'] : 0; - $summary['ALe_wcs'] += is_numeric($trpProductionDetail['ALe_wcs']) ? $trpProductionDetail['ALe_wcs'] : 0; - $summary['ME_wcs'] += is_numeric($trpProductionDetail['ME_wcs']) ? $trpProductionDetail['ME_wcs'] : 0; - $summary['SI_wcs'] += is_numeric($trpProductionDetail['SI_wcs']) ? $trpProductionDetail['SI_wcs'] : 0; - $summary['caparo_wcs'] += is_numeric($trpProductionDetail['caparo_wcs']) ? $trpProductionDetail['caparo_wcs'] : 0; - $summary['Nemak_wcs'] += is_numeric($trpProductionDetail['Nemak_wcs']) ? $trpProductionDetail['Nemak_wcs'] : 0; - $summary['DR_wcs'] += is_numeric($trpProductionDetail['DR_wcs']) ? $trpProductionDetail['DR_wcs'] : 0; + + foreach($wcsSupplierList as $supplier){ + $summary[$supplier] += is_numeric($trpProductionDetail[$supplier]) ? $trpProductionDetail[$supplier] : 0; + } + $summary['edRunningHours'] += is_numeric($trpProductionDetail['edRunningHours']) ? $trpProductionDetail['edRunningHours'] : 0; $summary['edProduction'] += is_numeric($trpProductionDetail['edProduction']) ? $trpProductionDetail['edProduction'] : 0; $summary['edUsage'] += is_numeric($trpProductionDetail['edUsage']) ? $trpProductionDetail['edUsage'] : 0; $summary['trpProduction'] += is_numeric($trpProductionDetail['trpProduction']) ? $trpProductionDetail['trpProduction'] : 0; $summary['trpProductionPerHour'] += is_numeric($trpProductionDetail['trpProductionPerHour']) ? $trpProductionDetail['trpProductionPerHour'] : 0; $summary['coating'] += is_numeric($trpProductionDetail['coating']) ? $trpProductionDetail['coating'] : 0; - $summary['ALs_crs'] += is_numeric($trpProductionDetail['ALs_crs']) ? $trpProductionDetail['ALs_crs'] : 0; - $summary['Nemak_crs'] += is_numeric($trpProductionDetail['Nemak_crs']) ? $trpProductionDetail['Nemak_crs'] : 0; - $summary['ME_crs'] += is_numeric($trpProductionDetail['ME_crs']) ? $trpProductionDetail['ME_crs'] : 0; - $summary['BI_crs'] += is_numeric($trpProductionDetail['BI_crs']) ? $trpProductionDetail['BI_crs'] : 0; - $summary['Karmen_crs'] += is_numeric($trpProductionDetail['Karmen_crs']) ? $trpProductionDetail['Karmen_crs'] : 0; + + foreach($crsClientList as $client){ + $summary[$client] += is_numeric($trpProductionDetail[$client]) ? $trpProductionDetail[$client] : 0; + } + $summary['waterReceipt'] += is_numeric($trpProductionDetail['waterReceipt']) ? $trpProductionDetail['waterReceipt'] : 0; $summary['waterConsumption'] += is_numeric($trpProductionDetail['waterConsumption']) ? $trpProductionDetail['waterConsumption'] : 0; $summary['ebReading'] += is_numeric($trpProductionDetail['ebReading']) ? $trpProductionDetail['ebReading'] : 0; @@ -1081,14 +1032,26 @@ $timeOtions[] = "12:00 AM"; + - + + 0){?> + + + + + + - + + 0){?> + + + @@ -1111,7 +1074,7 @@ $timeOtions[] = "12:00 AM"; - + @@ -1122,20 +1085,13 @@ $timeOtions[] = "12:00 AM"; - - - - - - - - - - - - - - + + + + + + + @@ -1147,17 +1103,16 @@ $timeOtions[] = "12:00 AM"; - + - - - - - - - - - + + + + + + + + @@ -1296,48 +1251,14 @@ $timeOtions[] = "12:00 AM"; - - - - - - + + + - - - - - - - - - - - - - - - - - - - - @@ -1377,32 +1298,14 @@ $timeOtions[] = "12:00 AM"; - - - + + + + - - - - - - - - - - - - @@ -1461,13 +1364,13 @@ $timeOtions[] = "12:00 AM"; - - @@ -1508,23 +1411,24 @@ $timeOtions[] = "12:00 AM";
SNoRequisition NoItem NameQuantityUOMRateBasic AmountTax AmountTotal Order AmountSNoRequisition NoItem DescriptionQuantityUOMRateBasic AmountTax AmountTotal Order Amount Action
ReqNo ?>MaterialName ?>Quantity ?>ReqNo ?>MaterialName, 0, 13, "..."); + echo $shortName; ?>Quantity ?> UOM ?>Rate ?>Rate ?> + BasicValue, 2, '.', '') ?>Taxamount ?>TotalValue ?>Taxamount ?>TotalValue ?>
SNoRequisition NoItem CodeItem DescriptionLine Item SpecsQuantityUOMRate + SNoRequisition NoItem CodeItem DescriptionLine Item SpecsQuantityUOMRate Basic Amount + Basic Amount Tax Amount + Tax Amount Total Order Amount + Total Order Amount ActionAction
ReqNo ?>MaterialCode ?>MaterialName ?> + MaterialCode ?>MaterialName, 0, 13, "..."); + echo $shortName; ?> LineitemAuditorNotes) ? $record->LineitemAuditorNotes : "-"; } ?> Quantity ?>UOM ?>Quantity ?>UOM ?> Rate ?> @@ -4477,7 +4479,10 @@ if (!empty($getlogpodtl)) { }); index = parseInt(index) + 1; // $PONOStatus == PO_DRAFT || $PONOStatus == PO_CREATED - PONOStatus = + var PONOStatus = + console.log("PONOStatus",PONOStatus); + var shorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName; + // var template = jQuery("#RevenueList").html(); @@ -4503,11 +4508,11 @@ if (!empty($getlogpodtl)) { var rowHtml = `
${temp}${Reqnumber}${Reqnumber} ${materialCode}${materialName}${shorten}- --${quantity}${quantity} ${uom} ${itemRate} ${basicval}
SNoRequisition NoItem CodeItem NameQuantityUOMRateBasic AmountTax AmountTotal Order AmountActual QuantityReceived QuantityPending QuantityRequisition NoItem CodeItem DescriptionQuantityUOMRateBasic AmountTax AmountTotal Order AmountActual QuantityReceived QuantityPending Quantity Action
ReqNo ?> ReqNo ?> MaterialCode ?>MaterialName ?>Quantity ?>MaterialName, 0, 13, "..."); + echo $shortName; ?>Quantity ?> UOM ?>Rate ?>BasicValue * $FrequencyNo, 2, '.', ''); ?>Taxamount ?>TotalValue ?>Quantity ?>ReceivedQuantity ?>Quantity - $record->ReceivedQuantity, 2, '.', ''); ?>Rate ?>BasicValue * $FrequencyNo, 2, '.', ''); ?>Taxamount ?>TotalValue ?>Quantity ?>ReceivedQuantity ?>Quantity - $record->ReceivedQuantity, 2, '.', ''); ?> ConfigValue; ?>ConfigValue ?>ConfigValue; ?> isActive == 0) { ?> @@ -308,6 +317,25 @@ if (!empty($master)) { + + @@ -489,6 +517,90 @@ if (!empty($master)) { } } + + $(".config-category").click(function () { + + const key_id = $(this).data("key"); + const value = $(this).data("value"); + $('#loader').show(); + + $('#scrollableModalTitle').text(`List of PO created using ${value} `); + // AJAX API call + $.ajax({ + url: "", + data: { key_id: key_id }, + method: 'POST', + dataType: 'json', + success: function (response) { + if (response.length > 0) { + let tableHtml = ` + + + + + + + + + + + + + `; + + response.forEach(item => { + + tableHtml += ` + + + + + + + + + `; + }); + + tableHtml += ` + +
PO NumberPO DateMaterial NamePO TypePO Status
+ ${item.PONO} + ${item.PODate}${item.MaterialName}${item.POType}${item.StatusName}
+ `; + + // Insert the table into the modal body + $('#scrollable-modal .modal-body').html(tableHtml); + + // Show the modal + $('#scrollable-modal').modal('show'); + + // Attach click event to PONO cells after the table is rendered + $('.pono-cell').click(function () { + const pono = $(this).data('pono'); + const ReqType = $(this).data('potype'); + const CapitalRange = $(this).data('capitalrange'); + const url = 'EditPO?PONO=' + pono +'&ReqType='+ReqType+'&CapitalRange='+CapitalRange; + + window.open(url, '_blank'); + // window.location.href = url; + }); + + } else { + $('#scrollable-modal .modal-body').html('

No data found.

'); + $('#scrollable-modal').modal('show'); + } + + $('#loader').hide(); + }, + error: function (xhr, status, error) { + // Handle any errors + console.error("API Error:", error); + alert("Failed to load material data."); + } + }); + }); + }); diff --git a/app/Views/editimportpo.php b/app/Views/editimportpo.php index 9a7732dd..24a5928b 100755 --- a/app/Views/editimportpo.php +++ b/app/Views/editimportpo.php @@ -828,15 +828,15 @@ if (!empty($getlogpodtl)) { - - - - - - - - - + + + + + + + + + @@ -857,10 +857,11 @@ if (!empty($getlogpodtl)) { ?> - - - - + + + - - - - + + + + @@ -4279,12 +4280,13 @@ if (!empty($getlogpodtl)) { //alert('in'); PONOStatus = + var shorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName; var rowHtml = ` - `; + `; if (PONOStatus === "PO_DRAFT" || PONOStatus === "PO_CREATED") { rowHtml += ` - - - + + + - - - + + + + diff --git a/app/Views/importpo.php b/app/Views/importpo.php index 29c1f73d..cf501437 100755 --- a/app/Views/importpo.php +++ b/app/Views/importpo.php @@ -158,8 +158,7 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) { const LineItemNoteForAuditor = $link.data('notes'); const id = $link.data('id'); var theForm = $(".CreatePO"); - - addHidden(theForm, "LineItemNoteForAuditor" + id, value); + $("#LineItemNoteForAuditor" + id).val(value); $link.text(value).show(); $editContainer.hide(); }); @@ -400,31 +399,35 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) { } function vaildateBeforeOpenModal() { - if ($('#PODate').val() == '') { - alert('Please Enter the Purchase Order date'); - $('#PODate').focus(); - return false; - } else if ($('#drpSupplier').val() == "0") { + var radioValue = parseInt($("input[name='DateRange']:checked").val()); + if ($('#drpSupplier').val() == "0") { alert('Please Select the Supplier details'); $('#drpSupplier').focus(); return false; + } else if ($('#currencytype').val() == '0') { + alert('Please Select the Currency Type'); + $('#currencytype').focus(); + return false; + } else if ($('#PODate').val() == '') { + alert('Please Enter the Purchase Order date'); + $('#PODate').focus(); + return false; } else if ($('#DeliveryAddr').val() == '') { alert('Please Enter the Delivery Address'); $('#DeliveryAddr').focus(); return false; - } else if ($('#Dispatch').val() == '' && $('#Scheduleby').val() == '') { - if (document.getElementById("Schedule").checked) { - alert('Please Enter Schedule By'); - return false; - } else if (document.getElementById("Date").checked) { - alert('Please Enter Dispatch Instruction'); - return false; - } - } else if ($('#currencytype').val() == '0') { alert('Please Select the Currency Type'); $('#currencytype').focus(); return false; + } else if (radioValue === 1 && $('#Scheduleby').val() == '') { + alert('Please Enter Schedule By'); + $('#Scheduleby').focus(); + return false; + } else if (radioValue === 2 && $('#Dispatch').val() == '') { + alert('Please Enter Dispatch Instruction'); + $('#Dispatch').focus(); + return false; } else if ($('#ExchangeRate').val() == '') { alert('Please Enter the Exchange Rate'); $('#ExchangeRate').focus(); @@ -437,22 +440,25 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) { alert('Please Enter Place Of Origin'); $('#PlaceOforigin').focus(); return false; - } else if ($('#PaymentTerms').val() == '') { - alert('Please Select Payment Terms'); - $('#PaymentTerms').focus(); - return false; - - } else if ($('#BudgetType').val() == "0") { - alert('Please Select Budget Type'); - $('#BudgetType').focus(); - return false; - - } else if ($('#Importoption').val() == "0") { + } else if ($('#Importoption').val() == "0") { alert('Please Select Import Type'); $('#Importoption').focus(); return false; - } else { + } else if ($('#PaymentTerms').val() == '') { + alert('Please Select Payment Terms'); + $('#PaymentTerms').focus(); + return false; + } else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { + alert('Please Enter Payable Terms Description'); + $('#Otherpayment').focus(); + return false; + } else if ($('#BudgetType').val() == "0") { + alert('Please Select Budget Type'); + $('#BudgetType').focus(); + return false; + } + else { return true; } } @@ -814,19 +820,20 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) {
-
-
SNoRequisition NoMaterial CodeDescriptionLine Item SpecsQuantityUOMRateBasic AmountSNoRequisition NoItem CodeItem DescriptionLine Item SpecsQuantityUOMRateBasic Amount
ReqNo ?>MaterialCode ?>MaterialName ?> + ReqNo ?>MaterialCode ?>MaterialName, 0, 13, "..."); + echo $shortName; ?> LineitemAuditorNotes) ? $record->LineitemAuditorNotes : "-"; } ?> Quantity ?>UOM ?>Rate ?>BasicValue ?>Quantity ?>UOM ?>Rate ?>BasicValue ?>
${temp} ${Reqnumber} ${materialCode}${materialName}${shorten}purchaseorder/DeletePODetails", success: function(data) { $('#loader').hide(); - - if (data) { - // $('#content').loader('hide'); - alert(data); - } else { - alert("Error"); - } - + (data) ? alert(response) : alert("Error"); } }); } @@ -5496,20 +5491,20 @@ if (!empty($getlogpodtl)) { //exit(); //var TotalOrder=$('#txtToatlOrder').val(); //exit(); - if (validate() && Budgetcheck()) { - if (document.getElementById('ImportTax').rows.length <= 0) { + if (importValidate() && Budgetcheck()) { + // if (document.getElementById('ImportTax').rows.length <= 0) { - alert('Please Select Line item to Create PO'); - $('#Deliverydt').focus(); - return false; - } else { + // alert('Please Select Line item to Create PO'); + // $('#Deliverydt').focus(); + // return false; + // } else { // $('#content').loader('show'); var formData = new FormData($('.ImportPO')[0]); formData.append('txtRowCount', Row); formData.append('txtDeletedRow', txtDeletedRow); formData.append('textStatus', stat); $('#loader').show(); - + disableButtons(); $.ajax({ // data:$('.ImportPO').serialize()+"&txtRowCount="+Row+"&txtDeletedRow="+txtDeletedRow+"&textStatus="+stat, data: formData, @@ -5530,16 +5525,18 @@ if (!empty($getlogpodtl)) { //$('#SpcialInstruction').val(''); //$('#txtDeliveryAddress').val(''); window.location = "purchaseorderListing"; + setTimeout(function() { enableButtons(); }, 2000); } else { alert("Error"); + setTimeout(function() { enableButtons(); }, 2000); } } }); - } + // } } } diff --git a/app/Views/editrequisitionform.php b/app/Views/editrequisitionform.php index 0af694b4..1762c5ee 100755 --- a/app/Views/editrequisitionform.php +++ b/app/Views/editrequisitionform.php @@ -70,12 +70,12 @@ td { .th-requestedQuantity{ - text-align:center !important; + text-align:right !important; width:15%; } .th-PoQuantity{ - text-align:center !important; + text-align:right !important; width:15%; } @@ -85,7 +85,7 @@ td { } .th-uom{ - text-align:center !important; + text-align:left !important; width:10%; } @@ -226,9 +226,9 @@ td { MaterialCode; ?> MaterialName; ?>UOM; ?>Quantity; ?>POQTY; ?>UOM; ?>Quantity; ?>POQTY; ?> StatusName; ?> @@ -818,9 +818,9 @@ td { ${temp} ${materialCode} ${materialName}${uom}${quantity}0.00${uom}${quantity}0.00 NEW diff --git a/app/Views/employeeListing.php b/app/Views/employeeListing.php index c1d033e1..7c160032 100755 --- a/app/Views/employeeListing.php +++ b/app/Views/employeeListing.php @@ -135,7 +135,15 @@ } else { $cdate = date('d-m-Y', strtotime($record->Created_date)); } ?> - EmpID ?> EmpID ?> + is_driver){ ?> +     + +     + + + + FirstName; ?> ContactNumber ?> Designation ?>
+
+
- - - - - - - - - + + + + + + + + + @@ -975,30 +982,26 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) {
- -
- -
- -
+ @@ -3514,13 +3517,14 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) { // RejectedQty: rejectedqty, // PendingQty: pendingqty // })); + var shorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName; var rowHtml = `
- - - - - + + + + - - - - + + + + + @@ -264,8 +265,6 @@ if (!empty($sample)) { - - $index = 0; $i = 0; foreach ($sample as $i => $record) { @@ -296,7 +295,7 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -519,7 +685,7 @@ - + @@ -718,7 +884,7 @@ $(document).ready(function () { // Convert the filtered array back to a JSON string if needed alldata = JSON.stringify(alldata); var month = $('#monthyear').val(); - + $('#loader').show(); $.ajax({ data: { @@ -732,7 +898,7 @@ $(document).ready(function () { if (data) { $('#loader').hide(); - alert(data); + // alert(data); } @@ -750,7 +916,7 @@ $(document).ready(function () { $("#formid").attr("method", "post"); //alert($s); - $("#formid").attr("action", "payslip/changeMonth"); + $("#formid").attr("action", "monthlypay"); $('#formid').submit(); @@ -971,6 +1137,97 @@ $(document).ready(function () { calculategrandtotal(); } + + function driverchangeInput(event, k) { + var str = event.target.id; + var sno = str.substr(8); + + // console.log(sno);return true; + + var driverEarn = parseFloat(document.getElementById('ttlsalary' + sno).textContent); + + var Festivals = parseFloat(document.getElementById('Festival' + sno).textContent); + totalfestival[sno] = Festivals; + + var element = document.getElementById('loanatm' + sno); + + var loanamt = parseFloat(element.value); + + var paidamt = parseFloat(document.getElementById('paidamt' + sno).value); + var monthDue = parseFloat(document.getElementById('monthDue' + sno).textContent); + var duedate = document.getElementById('duedate' + sno).value; + + duedate = new Date(duedate); + var paydate = document.getElementById('paydate').value; + var paydate = document.getElementById('paydate').value; + if (paydate.length == 6) { + paydate = '0' + paydate; + } + var pmonthonly = paydate.substring(0, 2); + var pyearonly = paydate.substring(3); + var pday = new Date(pyearonly, pmonthonly, 0).getDate(); + var finalpaydate = pyearonly + '-' + pmonthonly + '-' + pday; + finalpaydate = new Date(finalpaydate); + + + var current_loan_amt = 0; + var autoLoan = parseFloat(monthDue); + var Balance_Amount = loanamt - paidamt; + + if (autoLoan > Balance_Amount) { + if (duedate <= finalpaydate) { + current_loan_amt = Balance_Amount; + } + } else { + current_loan_amt = autoLoan; + } + + if (isNaN(driverEarn)) { driverEarn = 0; } + + + + + + + var driverSalaryAdd = driverEarn + Festivals; + + var driverSalarySub = current_loan_amt; + console.log(current_loan_amt); + + + var driverMonthSalary = driverSalaryAdd - driverSalarySub + var driverSalary = Math.round(driverMonthSalary); + + var cals = (driverSalary).toFixed(0); + + document.getElementById("empsal" + sno).innerHTML = cals; + + // copied from calculategrandtotal() because we need those two only thats why + var AutoLoanDueIndex = 21; + var AutoLoanDue = 0; + $('#monthlylistings tbody tr').each(function() { + var value = $(this).find('td').eq(AutoLoanDueIndex).text(); + AutoLoanDue += parseFloat(value) || 0; + }); + $('#monthloan').text(AutoLoanDue); + + var FestivalBonusIndex = 23; + var FestivalBonus = 0; + $('#monthlylistings tbody tr').each(function() { + var value = $(this).find('td').eq(FestivalBonusIndex).text(); + FestivalBonus += parseFloat(value) || 0; + }); + $('#fest').text(FestivalBonus); + + var EstimateIndex = 24; + var Estimate = 0; + $('#monthlylistings tbody tr').each(function() { + var value = $(this).find('td').eq(EstimateIndex).text(); + Estimate += parseFloat(value) || 0; + }); + $('#estsal').text(Estimate); + + } function calculategrandtotal() { diff --git a/app/Views/payslipgenerate.php b/app/Views/payslipgenerate.php index d15dd227..09364f18 100755 --- a/app/Views/payslipgenerate.php +++ b/app/Views/payslipgenerate.php @@ -57,16 +57,17 @@ $monthsoptions = array("01" => "Jan", "02" => "Feb", "03" => "Mar", "04" => "Apr }, type: "POST", url: "payslip/checkExistPay", - + dataType: "json", success: function(result) { - if (result != 1) { + + if (result['count'] != 1) { $.ajax({ data: { payon: payon, employee: employee }, type: "POST", - url: "payslip/callsp", + url: "".result['path'], success: function(result) { console.log(result); $('#loader').hide(); @@ -94,11 +95,9 @@ $monthsoptions = array("01" => "Jan", "02" => "Feb", "03" => "Mar", "04" => "Apr }, type: "POST", url: "payslip/checkExistPay", - + dataType: "json", success: function(result) { - - - if (result == 1) { + if (result['count'] == 1) { $('form#PayslipGenerator').submit(); $('#loader').hide(); @@ -111,7 +110,7 @@ $monthsoptions = array("01" => "Jan", "02" => "Feb", "03" => "Mar", "04" => "Apr employee: employee }, type: "POST", - url: "payslip/callsp", + url: ""+result['path'], success: function(result) { $('form#PayslipGenerator').submit(); $('#loader').hide(); @@ -185,11 +184,11 @@ $monthsoptions = array("01" => "Jan", "02" => "Feb", "03" => "Mar", "04" => "Apr
- Select All
+
-
+
diff --git a/app/Views/po_pdf.php b/app/Views/po_pdf.php index 683d364f..b2b75fd7 100755 --- a/app/Views/po_pdf.php +++ b/app/Views/po_pdf.php @@ -519,7 +519,6 @@
- @@ -581,19 +580,23 @@ - -   - + TotalOrderValue ?> - - + + + + +
SNoRequisition NoMaterial CodeDescriptionLine Item SpecsQuantityUOMRateBasic AmountSNoRequisition NoItem CodeItem DescriptionLine Item SpecsQuantityUOMRateBasic Amount
${temp}${Reqnumber}${materialCode}${materialName} + ${temp}${Reqnumber}${materialCode}${shorten} - ${quantity}${uom}${itemRate}${BasicAmt}${quantity}${uom}${itemRate}${BasicAmt} @@ -4184,27 +4188,15 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) { //alert(stat); //alert(JSON.stringify(txtStatus)); //exit(); - if (validate() && Budgetcheck()) { - if (document.getElementById('ImportTax').rows.length <= 0) { - - alert('Please Select Line item to Create PO'); - $('#Deliverydt').focus(); - return false; - - - - } else if ($('#Importoption').val() == "0") { - alert('Please Select Import Type'); - $('#Importoption').focus(); - return false; - - } else { + if (importValidate() && Budgetcheck()) { // $('#content').loader('show'); var formData = new FormData($('.ImportPO')[0]); formData.append('txtRowCount', txtRowCount); formData.append('txtDeletedRow', txtDeletedRow); formData.append('textStatus', stat); + disableButtons(); + $.ajax({ // data:$('.ImportPO').serialize()+"&txtRowCount="+txtRowCount+"&txtDeletedRow="+txtDeletedRow+"&textStatus="+stat, //data:$('.CreatealterPO').serialize()+"&TextRowCount="+TextRowCount+"&TextDeQletedRowCount="+TextDeletedRowCount+"&TextTotalOrderValueSummaryService="+TextTotalOrderValueSummaryService+"&TextSpcialInstruction="+TextSpcialInstruction+"&TextExchangerate"+ExcLandingCharge="+hangerate+"Status="+TextStatus, @@ -4222,17 +4214,22 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) { //$('#SpcialInstruction').val(''); //$('#txtDeliveryAddress').val(''); window.location = "purchaseorderListing"; + setTimeout(function() { enableButtons(); }, 2000); } else { alert("Error"); + setTimeout(function() { enableButtons(); }, 2000); } - } + }, + error: function(jqXHR, textStatus, errorThrown) { + console.error("AJAX Error: " + textStatus + ": " + errorThrown); + alert("Error: " + textStatus); + setTimeout(function() { enableButtons(); }, 2000); + } }); - } - } @@ -4335,4 +4332,12 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) { calculateFreight(1); }); + function Reset() { + disableButtons(); + location.reload(); + setTimeout(function() { + enableButtons(); + }, 2000); + + } \ No newline at end of file diff --git a/app/Views/includes/new_header.php b/app/Views/includes/new_header.php index eedc8e88..0601e659 100755 --- a/app/Views/includes/new_header.php +++ b/app/Views/includes/new_header.php @@ -765,13 +765,13 @@ DOJ Designation Total DaysNumber Of Trips Days Worked LOP Days Paid Leave NoofDays; ?> Key)) { echo "contenteditable='false';"; @@ -353,7 +352,7 @@ } ?> TotalSalary; ?>TotalSalary; ?> TotalSalary / $record->NoofDays; @@ -496,7 +495,8 @@ - + @@ -508,9 +508,175 @@ } } } - - + $inx = $index; + if(!empty($drivermonthinputs)){ + foreach ($drivermonthinputs as $i => $record) { + $inx++; + $hra_worked = $record->hra_worked; + $basic_worked = $record->basic_worked; + $sum_of_amount = ($record->driver_salary+$record->driver_shed+$record->driver_diesel); ?> +
+ EmpID; ?> + FirstName; ?> + + DateofJoining); + $newDateFormat = $date->format('d-m-Y'); + echo $newDateFormat; + ?> + + Designation; ?> + + total_cal_days; ?> + + no_of_loads." (trip)"; ?> + + unique_days, 2, '.', ''); ?> + + + + + + + + + + total_cal_days ; + echo number_format($worked_amt, 2, '.', ''); ?> + + + + + + + + + + + + + + esi_amount; ?> pf_amount; ?> + + payroll_id)) { echo "contenteditable='true';"; } ?> + payroll_id)) { ?> title="Payslip Calculated" + style="text-align:right;color:blue;" + style="text-align:right;" > + + Monthly_Due)) { + echo $record->Monthly_Due; + $totalmonthloan[] = $record->Monthly_Due; + } else { + echo number_format(0.00, 2, '.', ''); + } ?> + + + payroll_id)) { + echo "contenteditable='true';"; + } ?> + payroll_id)) { ?> title="Payslip Calculated" + style="text-align:right;color:blue;" + style="text-align:right;" > + Festival_Bonus)) { + echo $record->Festival_Bonus; + $totalfestival[] = $record->Festival_Bonus; + } else { + echo number_format(0.00, 2, '.', '');; + } ?> + payroll_id)) { + echo "contenteditable='false';"; + } ?> + payroll_id)) { ?> title="Payslip Calculated" + style="text-align:right;color:blue;" style="text-align:right;" > + driver_final_payment)) { + echo $record->driver_final_payment; + $estTotal[] = $record->driver_final_payment; + } else { + echo $empSalary[$i]; + $estTotal[] = $empSalary[$i]; + } + ?> +
Total Total
MaterialCode . ' - ') . ($item->MaterialName . $item->ServiceMaterialDescription); + echo ($item->LineitemAuditorNotes == '-' ? '' : '
( ' . $item->LineitemAuditorNotes. ' )
'); } ?> MaterialCode . ' - ') . ($item->MaterialName ? $item->MaterialName : $item->ServiceMaterialDescription); + echo ($item->LineitemAuditorNotes == '-' ? '' : '
( ' . $item->LineitemAuditorNotes. ' )
'); } ?> MaterialCode . ' - ') . ($item->MaterialName); + echo ($item->LineitemAuditorNotes == '-' ? '' : '
( ' . $item->LineitemAuditorNotes. ' )
'); } ?> MaterialCode . ' - ') . ($item->MaterialName); + echo ($item->LineitemAuditorNotes == '-' ? '' : '
( ' . $item->LineitemAuditorNotes. ' )
'); + //old -- echo ($item->LineitemAuditorNotes == '-' ? '' : '
'.$item->LineitemAuditorNotes ); } ?>
HSNCODE ?? 'N/A'; ?>LineitemAuditorNotes; ?> Quantity > 0) { echo number_alignment($item->Quantity); if ($item->Per) : ?> @@ -658,14 +661,13 @@
 TOTAL TOTAL  
Approver ?>StatusCode == "ST026"){ echo $record->Releaser; } ?> get('roleText') == 'System Administrator'){?> - StatusCode == PO_APPROVER_ONHOLD or $record->StatusCode == PO_CREATED or $record->StatusCode == REQITEM_Emergency_PO_CREATED) { ?> + StatusCode == PO_APPROVER_ONHOLD or $record->StatusCode == PO_CREATED or $record->StatusCode == REQITEM_Emergency_PO_CREATED or $record->StatusCode == PO_RELEASER_ONHOLD or $record->StatusCode == PO_AWAITING_RELEASE) { ?> diff --git a/app/Views/purchaseorder.php b/app/Views/purchaseorder.php index a62b00a0..e9df80b3 100755 --- a/app/Views/purchaseorder.php +++ b/app/Views/purchaseorder.php @@ -203,46 +203,47 @@ if (!empty($INRSYMBOL)) { } function vaildateBeforeOpenModal() { - var radioValue = $("input[name='DateRange']:checked").val(); - if ($('#PODate').val() == '') { - alert('Please Enter the Purchase Order date'); - $('#PODate').focus(); - return false; - } else if ($('#drpSupplier').val() == "0") { - alert('Please Select the Supplier details'); - $('#drpSupplier').focus(); - return false; - } else if ($('#DeliveryAddr').val() == '') { - alert('Please Enter the Delivery Address'); - $('#DeliveryAddr').focus(); - return false; - } else if (radioValue == 0 && $('#Deliverydate').val() == '') { - alert('Please Select the Delivery Date'); - $('#Deliverydate').focus(); - return false; - } else if (radioValue == 1 && $('#Scheduleby').val().trim() == '') { + var radioValue = parseInt($("input[name='DateRange']:checked").val()); + + if ($('#drpSupplier').val() == "0") { + alert('Please Select the Supplier details'); + $('#drpSupplier').focus(); + return false; + }else if ($('#PODate').val().trim() == '') { + alert('Please Enter the Purchase Order date'); + $('#PODate').focus(); + return false; + }else if ($('#DeliveryAddr').val().trim() == '') { + alert('Please Enter the Delivery Address'); + $('#DeliveryAddr').focus(); + return false; + }else if (radioValue === 0 && $('#Deliverydt').val() == '') { + alert('Please Select the Delivery Date'); + $('#Deliverydt').focus(); + return false; + }else if (radioValue == 1) { + var scheduleBy = $('#Scheduleby').val(); // Get the value + if (!scheduleBy || scheduleBy.trim() == '') { // Check if it's empty or undefined alert('Please Enter the Schedule By'); - $('#Deliverydate').focus(); + $('#Scheduleby').focus(); return false; - } else if (radioValue == 0 && $('#Deliverydate').val() == '') { - alert('Please Select the Delivery Date'); - $('#Deliverydate').focus(); - return false; - } else if (radioValue == 1 && $('#Scheduleby').val().trim() == '') { - alert('Please Enter the Schedule By'); - $('#Deliverydate').focus(); - return false; - } else if ($('#PoTypeOptions').val() == "0") { - alert('Please Select Revenue Type'); - $('#PoTypeOptions').focus(); - return false; - } else if ($('#BudgetType').val() == "0") { - alert('Please Select Budget Type'); - $('#BudgetType').focus(); - return false; - } else { - return true; } + }else if ($('#PoTypeOptions').val() == "0") { + alert('Please Select Revenue Type'); + $('#PoTypeOptions').focus(); + return false; + }else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { + alert('Please Enter Payable Terms Description'); + $('#Otherpayment').focus(); + return false; + }else if ($('#BudgetType').val() == "0") { + alert('Please Select Budget Type'); + $('#BudgetType').focus(); + return false; + } else { + return true; + } + } var NilType = ''; @@ -410,7 +411,7 @@ if (!empty($INRSYMBOL)) { }); $('#MaterialCode').change(function() { - +// alert("**"); var id = $('#MaterialCode').val(); var drpSupplier = $('#drpSupplier').val(); $("#ItemName").val(''); @@ -431,6 +432,7 @@ if (!empty($INRSYMBOL)) { $("#ItemName").val(obj.MaterialName); $("#UOM").val(obj.UOM); $("#Quantity").val(obj.Quantity); + $("#Rate").val(obj.material_rate); RequistQuantity = obj.Quantity; } }); @@ -474,6 +476,7 @@ if (!empty($INRSYMBOL)) { $("#EditItemName").val(obj.MaterialName); $("#EditUOM").val(obj.UOM); $("#EditQuantity").val(obj.Quantity); + $("#EditRate").val(obj.material_rate); RequistQuantity = obj.Quantity; } }); @@ -2165,20 +2168,20 @@ if (!empty($INRSYMBOL)) {
- +
- - - - - - - - - - - + + + + + + + + + + + @@ -3456,13 +3459,14 @@ if (!empty($INRSYMBOL)) { // })); // Define your template using ES6 template literals + var shorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName; var rowHtml = ` - - - - - + + + + - - - - - - + + + + + + - - + + @@ -407,11 +407,14 @@ if (!empty($Emp)) { $("#UOM").val(''); // Get the ID of the first option var firstOptionId = $('#CostCenter option:first').val(); - // Reset the Select2 dropdown to the first option - $('#CostCenter').val(firstOptionId).select2('data', { - id: firstOptionId, - text: $('#CostCenter option:selected').text() - }); + $('#CostCenter').val("-1"); + + + // // Reset the Select2 dropdown to the first option + // $('#CostCenter').val(firstOptionId).select2('data', { + // id: firstOptionId, + // text: $('#CostCenter option:selected').text() + // }); removeHiddenRows($('#Items').find('tr').length); @@ -605,12 +608,13 @@ if (!empty($Emp)) { + + + - + - + + \ No newline at end of file diff --git a/app/Views/stock/resinStockDetails.php b/app/Views/stock/resinStockDetails.php index f39ae0ef..502b17ee 100644 --- a/app/Views/stock/resinStockDetails.php +++ b/app/Views/stock/resinStockDetails.php @@ -21,7 +21,16 @@ background-color: #50bbd9; color: #ffffff; } -/* + + .grab { + cursor: grab; /* Default open-hand cursor */ + } + + .grab:active { + cursor: grabbing; /* Closed-hand cursor when dragging */ + } + + /* .fht-table td[contenteditable="true"] { background-color: lightyellow; color:rgb(13, 7, 7); @@ -155,14 +164,14 @@ } .celda_encabezado_total { - background-color:#ffffff !important; + background-color: #ffffff !important; border: 1px solid #ffffff; color: #ffffff !important; font-weight: bold; padding: 6px 10px; text-align: center; } - + .celda_normal { /*background-color: #fff;*/ /* */ @@ -176,12 +185,14 @@ .fht-table thead { position: sticky; top: 0; - z-index: 20; /* Ensure the entire header stays above table rows */ - background-color: #50bbd9; /* Header background color */ + z-index: 20; + /* Ensure the entire header stays above table rows */ + background-color: #50bbd9; + /* Header background color */ } - .dropdown-menu { - z-index :25 ; + .dropdown-menu { + z-index: 25; } @@ -190,8 +201,10 @@ .fht-table thead th { position: sticky; top: 0; - z-index: 11; /* Higher than table rows but lower than first column */ - background-color: #50bbd9; /* Green background */ + z-index: 11; + /* Higher than table rows but lower than first column */ + background-color: #50bbd9; + /* Green background */ color: #ffffff; border: 1px solid #ddd; padding: 10px; @@ -203,7 +216,8 @@ position: sticky; left: 0; background-color: #50bbd9; - z-index: 15; /* Ensures it stays above other cells */ + z-index: 15; + /* Ensures it stays above other cells */ border-right: 2px solid #ddd; color: #ffffff; } @@ -211,17 +225,16 @@ /* Table Wrapper for Scrolling */ .table-responsive { overflow-x: auto; - overflow-y: auto; - max-height: 500px; /* Adjust as needed */ + overflow-y: auto; + max-height: 500px; + /* Adjust as needed */ position: relative; } - td{ - min-width: 100px; - max-width: 100px; + td { + min-width: 100px; + max-width: 100px; } - - @@ -291,10 +304,14 @@ foreach ($period as $day) { class="form-control mt-2" data-provide="datepicker" data-date-format="M-yyyy" data-date-min-view-mode="1"> -
SNoRequisition NoItem CodeItem DescriptionLine Item SpecsQuantityUOMRate Basic Amount Tax Amount Total Order Amount SNoRequisition NoItem CodeItem DescriptionLine Item SpecsQuantityUOMRateBasic AmountTax AmountTotal Order Amount Action
${temp}${Reqnumber}${materialCode}${materialName} + ${temp}${Reqnumber}${materialCode}${shorten} - ${quantity}${uom}${itemRate}${basicval}${TotalTaxValue}${TotalOrderValue}${quantity}${uom}${itemRate}${basicval}${TotalTaxValue}${TotalOrderValue} @@ -3917,36 +3921,33 @@ if (!empty($INRSYMBOL)) { var txtTotalDiscount = $('#txtTotalDiscount').val(); var finalBasicAmount = txtTotBasicAmount - txtTotalDiscount; //alert(txtTotBasicAmount+"--"+txtTotalDiscount+"--"+finalBasicAmount+"--"+AvlBudAmt); - if (validate()) { - if (document.getElementById('revenueTax').rows.length < 1) { - alert('Please Select Line item to Create PO'); - $('#Deliverydt').focus(); - return false; - } - // else if(parseInt(AvlBudAmt) < parseInt(finalBasicAmount)) { - // alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.'); - + if (revenueValidate()) { + // if (document.getElementById('revenueTax').rows.length < 1) { + // alert('Please Select Line item to Create PO'); + // return false; + // } + // else if(parseInt(AvlBudAmt) < parseInt(finalBasicAmount)) { + // alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.'); // return false; - // } - else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { - alert('Please Enter Payable Terms Description'); - $('#Otherpayment').focus(); - return false; - } else if ($('#insurance').val() == 1 && $('#InsuranceNumber').val() == '') { - alert('Please Enter Insurance No / Insurance Details..!'); - $('#insurance').focus(); - return false; - } else if ($('#PoTypeOptions').val() == "0") { - alert('Please Select Revenue Type'); - $('#PoTypeOptions').focus(); - return false; - - } else { + // } + // else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') { + // alert('Please Enter Payable Terms Description'); + // $('#Otherpayment').focus(); + // return false; + // } else if ($('#insurance').val() == 1 && $('#InsuranceNumber').val() == '') { + // alert('Please Enter Insurance No / Insurance Details..!'); + // $('#insurance').focus(); + // return false; + // } else if ($('#PoTypeOptions').val() == "0") { + // alert('Please Select Revenue Type'); + // $('#PoTypeOptions').focus(); + // return false; + // } + // else { var formData = new FormData($('.CreatePO')[0]); - + disableButtons(); - $.ajax({ type: "POST", url: "purchaseorder/addNewPurchaseOrder", @@ -3962,19 +3963,23 @@ if (!empty($INRSYMBOL)) { //$('#SpcialInstruction').val(''); //$('#txtDeliveryAddress').val(''); window.location = "purchaseorderListing"; + setTimeout(function() { enableButtons(); }, 2000); + } else { alert("Error"); + setTimeout(function() { enableButtons(); }, 2000); } }, error: function(jqXHR, textStatus, errorThrown) { console.error("AJAX Error: " + textStatus + ": " + errorThrown); alert("Error: " + textStatus); + setTimeout(function() { enableButtons(); }, 2000); } }); - } + // } } } @@ -4214,9 +4219,29 @@ if (!empty($INRSYMBOL)) { } function Reset() { + disableButtons(); location.reload(); + setTimeout(function() { + enableButtons(); + }, 2000); } + function disableButtons() { + document.querySelectorAll('.Save, .Submit').forEach(function(button) { + button.classList.add('disabled'); + button.setAttribute('disabled', 'disabled'); + }); + } + + + function enableButtons() { + document.querySelectorAll('.Save, .Submit').forEach(function(button) { + button.classList.remove('disabled'); + button.removeAttribute('disabled'); + }); + } + + \ No newline at end of file diff --git a/app/Views/requisitionform.php b/app/Views/requisitionform.php index 24af8fb9..c04d9b09 100755 --- a/app/Views/requisitionform.php +++ b/app/Views/requisitionform.php @@ -144,8 +144,8 @@ if (!empty($Emp)) { Material Code Material Name Material CategoryUomQuantityUomQuantity Action
+
- - - - - - - - - - - + + + + + + + + + - + - + - + - - - - - + - - - + + + + - -
Total SumOpening StockReceiptUsedBalance Stock
Total SumOpening StockReceiptUsedBalance Stock
- Total -
+ Total +
+ + +
@@ -639,6 +656,86 @@ foreach ($period as $day) { + + +
+ +
+ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/Views/stock/trpProductionStockDetails.php b/app/Views/stock/trpProductionStockDetails.php index 73604cba..670d81c1 100644 --- a/app/Views/stock/trpProductionStockDetails.php +++ b/app/Views/stock/trpProductionStockDetails.php @@ -191,7 +191,6 @@ background-color: #50bbd9; /* Green background */ color: #ffffff; border: 1px solid #ddd; - padding: 10px; white-space: normal; /* Allows text to wrap */ word-wrap: break-word; /* Breaks long words if needed */ text-align: center; /* Centers text for better alignment */ @@ -221,11 +220,15 @@ max-width: 100px; } + .location{ + min-width:200px; + min-height: 200px; + } - - - - + .description{ + min-width:400px; + min-height: 200px; + } @@ -264,7 +267,7 @@ foreach ($period as $day) { $timeOptions = []; foreach (["AM", "PM"] as $meridian) { - for ($hour = 0; $hour < 12; $hour++) { + for ($hour = 0; $hour < 12; $hour++) { for ($minute = 0; $minute < 60; $minute += 15) { $formattedHour = $hour === 0 ? 12 : $hour; $timeOptions[] = sprintf("%02d:%02d %s", $formattedHour, $minute, $meridian); @@ -380,13 +383,25 @@ $timeOtions[] = "12:00 AM";
Panel Gas Per Ton Incoming Sand/ Lump details Incoming Sand/ Lump details ED details TRP Sand Coating Usage Usage Water ED +20 Waste Cyclone Waste Cyclone Waste
BG PG AL(S) AL(E) ME SI caparo Nemak DR Running Hours Production Per Hour Coating Hindhuja NemakME BI Karmen Receipt + data-id=" totalHours"> @@ -667,56 +676,18 @@ $timeOtions[] = "12:00 AM"; - - - - - - - - - - + + - - - - @@ -767,40 +738,22 @@ $timeOtions[] = "12:00 AM"; - + + + + + + + + + - - - - - - - - Panel Gas Consumption Panel Gas Per Ton Incoming Sand/ Lump details Incoming Sand/ Lump details ED details TRP Sand Coating Usage Usage Water ED +20 Waste Cyclone Waste
BG PG AL(S) AL(E) ME SI caparo Nemak DR Running Hours Production Per Hour Coating Hindhuja NemakME BI Karmen Receipt - - - - + + - - - - - - - - - - - - + + - - - - - - - - + +
- - - - - +


+
+ +

+ +
@@ -1533,6 +1437,64 @@ $timeOtions[] = "12:00 AM";
+


+ +
+
+
+
+ + + + + +

Abstract for the month

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParticularsRunning HoursPer HourOpening StockReceiptTotalConsumptionClosing StockPhysical StockRemarks
dummy dummy dummy dummy dummy dummy dummy dummy dummy dummy
+
+ +
+
+
+
+
@@ -1572,7 +1534,7 @@ $timeOtions[] = "12:00 AM";
- + @@ -1654,53 +1616,55 @@ $timeOtions[] = "12:00 AM"; const rowData = { - Date : rowCells.eq(0).text().trim() , + Date : rowCells.eq(0).text().trim() , openingTime : openingTime , closingTime : closingTime , - totalHours : rowCells.eq(3).text().trim() , - coldStart : rowCells.eq(4).text().trim() , - breakdownHours : rowCells.eq(5).text().trim() , - burnerFiringHours : rowCells.eq(6).text().trim() , - sandFeedingHours : rowCells.eq(7).text().trim() , - gasReceiptBg : rowCells.eq(8).text().trim() , - gasReceiptPg : rowCells.eq(9).text().trim() , - physicalGasConsumption : rowCells.eq(10).text().trim() , - trpPlusDrierGasConsumption : rowCells.eq(13).text().trim() , - trpPhysicalGasPerTon : rowCells.eq(14).text().trim() , - panelGasConsumption : rowCells.eq(15).text().trim() , - panelGasPerTon : rowCells.eq(16).text().trim() , - edRunningHours : rowCells.eq(24).text().trim() , - edProduction : rowCells.eq(25).text().trim() , - edUsage : rowCells.eq(26).text().trim() , - waterConsumption : rowCells.eq(26).text().trim() , - trpProduction : rowCells.eq(27).text().trim() , - trpProductionPerHour : rowCells.eq(28).text().trim() , - waterReceipt : rowCells.eq(35).text().trim() , - ebReading : rowCells.eq(37).text().trim() , - ebReadingPerUnitTon : rowCells.eq(38).text().trim() , - workingPersonEngineers : rowCells.eq(39).text().trim() , - workingPersonSupervisiors : rowCells.eq(40).text().trim() , - workingPersonOperators : rowCells.eq(41).text().trim() , - rollerDrivers : rowCells.eq(42).text().trim() , - natureOfMaintenance : rowCells.eq(43).text().trim() , - location : rowCells.eq(44).text().trim() , - description : rowCells.eq(45).text().trim() , - msSeperation : rowCells.eq(46).text().trim() , - edWaste : rowCells.eq(47).text().trim() , - coolerBags : rowCells.eq(48).text().trim() , - edPlus20Waste : rowCells.eq(49).text().trim() , - cycloneWaste : rowCells.eq(50).text().trim() + totalHours : $(this).find(`td[data-id='${dateInYmD} totalHours']`).text(), + coldStart : $(this).find(`td[data-id='${dateInYmD} coldStart']`).text() , + breakdownHours : $(this).find(`td[data-id='${dateInYmD} breakdownHours']`).text() , + burnerFiringHours : $(this).find(`td[data-id='${dateInYmD} burnerFiringHours']`).text() , + sandFeedingHours : $(this).find(`td[data-id='${dateInYmD} sandFeedingHours']`).text() , + gasReceiptBg : $(this).find(`td[data-id='${dateInYmD} gasReceiptBg']`).text() , + gasReceiptPg : $(this).find(`td[data-id='${dateInYmD} gasReceiptPg']`).text() , + physicalGasConsumption : $(this).find(`td[data-id='${dateInYmD} physicalGasConsumption']`).text() , + trpPlusDrierGasConsumption : $(this).find(`td[data-id='${dateInYmD} trpPlusDrierGasConsumption']`).text() , + trpPhysicalGasPerTon : $(this).find(`td[data-id='${dateInYmD} trpPhysicalGasPerTon']`).text() , + panelGasConsumption : $(this).find(`td[data-id='${dateInYmD} panelGasConsumption']`).text() , + panelGasPerTon : $(this).find(`td[data-id='${dateInYmD} panelGasPerTon']`).text() , + edRunningHours : $(this).find(`td[data-id='${dateInYmD} edRunningHours']`).text() , + edProduction : $(this).find(`td[data-id='${dateInYmD} edProduction']`).text() , + edUsage : $(this).find(`td[data-id='${dateInYmD} edUsage']`) .text() , + waterConsumption : $(this).find(`td[data-id='${dateInYmD} waterConsumption']`) .text() , + trpProduction : $(this).find(`td[data-id='${dateInYmD} trpProduction']`) .text() , + trpProductionPerHour : $(this).find(`td[data-id='${dateInYmD} trpProductionPerHour']`).text() , + waterReceipt : $(this).find(`td[data-id='${dateInYmD} waterReceipt']`) .text() , + ebReading : $(this).find(`td[data-id='${dateInYmD} ebReading']`) .text() , + ebReadingPerUnitTon : $(this).find(`td[data-id='${dateInYmD} ebReadingPerUnitTon']`) .text() , + workingPersonEngineers : $(this).find(`td[data-id='${dateInYmD} workingPersonEngineers']`).text() , + workingPersonSupervisiors : $(this).find(`td[data-id='${dateInYmD} workingPersonSupervisiors']`).text() , + workingPersonOperators : $(this).find(`td[data-id='${dateInYmD} workingPersonOperators']`).text() , + rollerDrivers : $(this).find(`td[data-id='${dateInYmD} rollerDrivers']`).text() , + natureOfMaintenance : $(this).find(`td[data-id='${dateInYmD} natureOfMaintenance']`).text() , + location : $(this).find(`td[data-id='${dateInYmD} location']`).text() , + description : $(this).find(`td[data-id='${dateInYmD} description']`).text() , + msSeperation : $(this).find(`td[data-id='${dateInYmD} msSeperation']`).text() , + edWaste : $(this).find(`td[data-id='${dateInYmD} edWaste']`).text() , + coolerBags : $(this).find(`td[data-id='${dateInYmD} coolerBags']`).text() , + edPlus20Waste : $(this).find(`td[data-id='${dateInYmD} edPlus20Waste']`).text() , + cycloneWaste : $(this).find(`td[data-id='${dateInYmD} cycloneWaste']`).text() , }; rows.push(rowData); + + }); return JSON.stringify(rows, null, 2); } - +