Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme

This commit is contained in:
Gowtham M 2025-03-04 10:37:29 +05:30
commit 9a590b9811
72 changed files with 5161 additions and 2999 deletions

View File

@ -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');

View File

@ -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 = "<tr><td rowspan=" . $rowspanvalue . ">" . $MaterialCode . "-" . $MaterialName . "</td></tr>";
$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 = "<tr><td rowspan=" . $rowspanvalue . ">" . $MaterialCode . "</td></tr>";
$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 = "<tr><td rowspan=" . $rowspanvalue . ">" . $MaterialCode . "</td></tr>";
$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);

View File

@ -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);

View File

@ -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');
}

View File

@ -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()
{

View File

@ -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;
}
}

View File

@ -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

View File

@ -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 = "<br>The following values have been edited:";
$history_content = "<br>IGR History<br><br> <ul>";
$history = $result_for_history['history'];
if(!empty($history)){
for ($j = 0; $j < count($history); $j++) {
$field_name = $history[$j]->field;
$readable_field = isset($field_labels[$field_name]) ? $field_labels[$field_name] : $field_name;
$history_content .= "<br>" . $readable_field . ": `" . $history[$j]->old_data . "` was updated to `" . $history[$j]->new_data . "` .";
}
$email = "";
for ($i = 0; $i < count($result_for_email['emails']); $i++) {
$email .= $result_for_email['emails'][$i]->email . " , ";
}
$email = rtrim($email, " ,");
$field_labels = [
"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",
"IGRItemNo" => "IGR Item No",
"MaterialCode" => "Material Code",
"QuantityAsPerInvoice" => "Received Qty",
"Remarks" => "Remarks",
"IGRItemStatus" => "IGR Item Status",
"CancelNote" => "Cancel Note",
"BankStatus" => "Bank Status",
"GrossWeight" => "Gross Weight",
"GrossWeightDate" => "Gross Weight Date",
"TareWeight" => "Tare Weight",
"TareWeightDate" => "Tare Weight Date",
"NetWeight" => "Net Weight",
"WeightFile" => "Weight File"
];
// $history_content = "<br>The following values have been edited:"; //old Format
$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,
'company' => $result_for_email['company'],
'from_mail'=> $result_for_email['from_mail']
]);
for ($j = 0; $j < count($history); $j++) {
$field_name = $history[$j]->field;
$readable_field = isset($field_labels[$field_name]) ? $field_labels[$field_name] : $field_name;
$history_content .= "<li>" .
(($history[$j]->IGRItem_No)
? $history[$j]->MaterialName . " (" . $history[$j]->MaterialCode . ") - "
: "") .
$readable_field . " " . $history[$j]->old_data .
" was updated into " . $history[$j]->new_data .
" by " . $history[$j]->history_by .
" on " . $history[$j]->indian_date .
" at " . $history[$j]->indian_time .
"</li><br>";
// $history_content .= "<br>" . $readable_field . ": `" . $history[$j]->old_data . "` was updated to `" . $history[$j]->new_data . "` .";
}
$history_content .= "</ul>";
$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']."<br>" .$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']}");
}
}
}
}

View File

@ -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 .= "<option value='" . $list->EmpId . "'>" . $list->EmpId . "-" . $list->Fname . "</option>";
$HTML .= "<option value='" . $list->EmpId . "'>" . $list->EmpId . "-" . $list->FullName . "</option>";
}
}
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)

View File

@ -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)) {

View File

@ -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);

View File

@ -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()

View File

@ -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 '<form id="postForm" action="' . base_url('drierMachineDetails') . '" method="POST">';
foreach ($postData as $key => $value) {
echo '<input type="hidden" name="' . $key . '" value="' . $value . '">';
}
echo '</form>';
echo '<script type="text/javascript">document.getElementById("postForm").submit();</script>';
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";

View File

@ -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'
}
}

View File

@ -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){

View File

@ -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);
}

View File

@ -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 = '')
{

View File

@ -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;
}
}

View File

@ -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();

View File

@ -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);
}

View File

@ -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()
{

View File

@ -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')

View File

@ -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 );

View File

@ -0,0 +1,46 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class TrpAbstract extends Model
{
protected $table = 't_trp_abstract';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['abs_opening_stock','abs_physical_stock','abs_remarks','abs_particular_id'];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
protected array $casts = [];
protected array $castHandlers = [];
// Dates
protected $useTimestamps = false;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $validationRules = [];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
}

View File

@ -0,0 +1,46 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class TrpAbstractParticulars extends Model
{
protected $table = 't_trp_abstract_particulars';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['particular'];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
protected array $casts = [];
protected array $castHandlers = [];
// Dates
protected $useTimestamps = false;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $validationRules = [];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
}

View File

@ -54,18 +54,19 @@ class TrpProductionModel extends Model
public function trpProductionDetails($startDate,$endDate){
$data =[];
// Subquery definition
$subquery = $this->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];
}

View File

@ -1229,22 +1229,25 @@ if (!empty($getlogpodtl)) {
</div>
</div>
<div class="form-row">
<div class="table-responsive table-bordered" style="padding-bottom: 30px;">
<table id="ServiceTable" class="table table-striped table-hover mb-0" style="font-size:12px;">
<div class="table-responsive" style="padding-bottom: 30px;">
<table id="ServiceTable" class="table table-bordered table-hover mb-0"
style="font-size:12px;">
<thead>
<tr>
<th style="text-align:center !important;">SNo</th>
<th style="text-align:center !important;">Requisition No</th>
<th style="text-align:center !important;">Item Code</th>
<th>Item Name</th>
<th>Line Item Specs</th>
<th style="text-align: center;">Quantity</th>
<th>UOM</th>
<th style="text-align: right;">Rate <?php echo "($INRSYM)" ?></th>
<th style="text-align: right;">Basic Amount <?php echo "($INRSYM)" ?></th>
<th style="text-align: right;">Tax Amount <?php echo "($INRSYM)" ?></th>
<th style="text-align: right;">Total Order Amount <?php echo "($INRSYM)" ?></th>
<th style="text-align:left !important; white-space: nowrap !important;">SNo</th>
<th style="text-align:center !important; white-space: nowrap !important;">Requisition No</th>
<th style="text-align:left !important; white-space: nowrap !important;">Item Code</th>
<th style="white-space: nowrap !important;">Item Description</th>
<th style="white-space: nowrap !important;">Line Item Specs</th>
<th style="text-align: left; white-space: nowrap !important;">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th>
<th style="text-align: right; white-space: nowrap !important;">Rate <?php echo "($INRSYM)" ?></th>
<th style="text-align: right; white-space: nowrap !important;">Basic Amount <?php echo "($INRSYM)" ?></th>
<th style="text-align: right; white-space: nowrap !important;">Tax Amount <?php echo "($INRSYM)" ?></th>
<th style="text-align: right; white-space: nowrap !important;">Total Order Amount <?php echo "($INRSYM)" ?></th>
<th>Action</th>
</tr>
</thead>
@ -1268,11 +1271,12 @@ if (!empty($getlogpodtl)) {
?>
<tr id="<?php echo $index; ?>">
<td align="center"><?php echo $index; ?></td>
<td align="center"><?php echo $record->ReqNo ?></td>
<td align="center"><?php echo $record->MaterialCode ?></td>
<td><?php echo $record->MaterialName ?></td>
<td>
<td style="text-align:left !important;"><?php echo $index; ?></td>
<td style="text-align:center !important;"><?php echo $record->ReqNo ?></td>
<td style="text-align:left !important;"><?php echo $record->MaterialCode ?></td>
<td style="text-align:left !important;">
<?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td>
<?php if ($PONOStatus === PO_DRAFT || $PONOStatus === PO_CREATED) { ?>
<a href="#"
class="editable-field"
@ -1286,15 +1290,15 @@ if (!empty($getlogpodtl)) {
</div>
<?php }else{ echo !empty($record->LineitemAuditorNotes) ? $record->LineitemAuditorNotes : "-"; } ?>
</td>
<td align="center"><?php echo $record->Quantity ?></td>
<td style="text-align:left !important;"><?php echo $record->Quantity ?></td>
<td><?php echo $record->UOM ?></td>
<td align="right"><?php echo $record->Rate ?></td>
<td style="text-align:right !important;"><?php echo $record->Rate ?></td>
<td align="right"><?php echo number_format($record->BasicValue * $FrequencyNo, 2, '.', ''); ?></td>
<td style="text-align:right !important;"><?php echo number_format($record->BasicValue * $FrequencyNo, 2, '.', ''); ?></td>
<td align="right"><?php echo $record->Taxamount ?></td>
<td align="right"><?php echo $record->TotalValue ?></td>
<td style="text-align:right !important;"><?php echo $record->Taxamount ?></td>
<td style="text-align:right !important;"><?php echo $record->TotalValue ?></td>
<!-- <td align="right"><?php echo $record->Quantity ?></td>
<td align="right"><?php echo $record->ReceivedQuantity ?></td>
<td align="right"><?php echo number_format($record->Quantity - $record->ReceivedQuantity, 2, '.', ''); ?></td> -->
@ -2610,12 +2614,13 @@ if (!empty($getlogpodtl)) {
// TotalValue: TotalOrderValue
// }));
PONOStatus = <?php echo $PONOStatus; ?>
var shorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName;
var rowHtml = `
<tr id="${temp}">
<td align="left">${temp}</td>
<td align="left">${Reqnumber}</td>
<td align="left">${materialCode}</td>
<td align="left">${materialName}</td>`;
<td align="left">${shorten}</td>`;
if (PONOStatus === "PO_DRAFT" || PONOStatus === "PO_CREATED") {
rowHtml += `<td><a href="#" class="editable-field"
data-id="${temp}"
@ -2991,15 +2996,8 @@ if (!empty($getlogpodtl)) {
type: "POST",
url: "<?php echo base_url() ?>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);
}
});
}
// }
}
}

View File

@ -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: "<?php echo base_url(); ?>drivernameautocomplete",
onSelect: function(suggestion) {
var data = suggestion.DriverName;
// serviceUrl: "<?php echo base_url(); ?>drivernameautocomplete",
// onSelect: function(suggestion) {
// var data = suggestion.DriverName;
}
});
$('#DriverMobileNumber').autocomplete({
serviceUrl: "<?php echo base_url(); ?>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: "<?php echo base_url(); ?>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 @@
<td><?php echo $record->SupplierName ?></td>
<td><?php echo $record->DeliveryChellanOrInvoiceNo ?></td>
<td align="right"><?php
$date = new DateTime($record->DeliveryChellanDate);
echo $date->format('d-m-Y'); ?></td>
$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'); }
?></td>
<td align="center"><?php echo $record->itemCount ?></td>
<td align="right"><?php echo $record->ReceivedQuantity ?></td>
<td align="center"><?php echo $record->NetWeight ?></td>
@ -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 @@
</script>
<script>
function formatDateTime(dateString, flag) {
console.log("ff",dateString);
// Note 1 means DATE only
// 2 means DATE and Time
// Check if the date string is null or empty

View File

@ -6,6 +6,13 @@
label {
font-style: bold;
}
input[type="file"] {
white-space: normal;
word-wrap: break-word;
overflow-wrap: break-word;
width: 100%;
}
</style>
<script>
$(document).ready(function() {
@ -739,6 +746,19 @@
</label>
</div>
</div>
<div class="col-md-3" style="margin-top: 18px;">
<div class="form-group">
<label class="switch">
<input type="checkbox" name="is_driver" value="0"
onchange="updateSwitchValue(this);driverCheck(this);" />
<span class="slider"></span>
</label>
<label
style="display: inline-block; vertical-align: bottom; margin-right: 10px; margin-bottom: 10px;">Driver
</label>
</div>
</div>
<br>
</div>
@ -1072,12 +1092,12 @@
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<label>Bank PassBok Name</label>
<label>Bank Passbook Name</label>
<input type="text" id="file_name" name="file_name4" maxlength="255"
class="form-control" value="Bank Passbook" readonly>
</div>
<div class="col-md-4">
<label>Select Bank PassBok File</label><br>
<label>Select Bank Passbook File</label><br>
<input type="file" name="emp_file4" class="">
</div>
</div>
@ -1124,6 +1144,15 @@
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;
@ -1220,7 +1249,7 @@
return false;
}
if ($('#ContactNumber').val().length < 1) {
alert('Please Enter Contact Number');
alert('Please Enter Contact Number');
return false;
} else if (!getMobileValidation()) {
return false;
@ -1360,6 +1389,49 @@
});
$('#ContactNumber').change(function() {
var ContactNumber = $('#ContactNumber').val();
if (getMobileValidation()) {
$('#loader').show();
$.ajax({
data: {
ContactNumber
},
type: "POST",
url: "<?php echo base_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();

View File

@ -11,11 +11,15 @@
$("#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',
autoclose: true,
autocomplete:'off'
});
});
</script>
<!-- <script type="text/javascript" src="<?php echo base_url(); ?>public/assets/Autocomplete/jquery.autocomplete.js"></script> -->
@ -49,7 +53,7 @@
<div class="form-row">
<div class=" col-md-3">
<label class="col-form-label" for="MaterialName">Material Name<span class="badge">*</span></label>
<input type="text" class="form-control required " required id="MaterialName" name="MaterialName" maxlength="255">
<input type="text" class="form-control required " required id="MaterialName" name="MaterialName" maxlength="255">
</div>
<div class=" col-md-3">
<label class="col-form-label" for="MaterialType">Material Type<span class="badge">*</span></label>
@ -66,11 +70,11 @@
?>
</select>
</div>
<div class=" col-md-3">
<label class="col-form-label" for="MatCate">Material Category
<span class="badge">*</span></label>
<!-- <i type="button" class="fe-plus-circle" id="addMaterialCaterogyModalButton"
<!-- <i type="button" class="fe-plus-circle" id="addMaterialCaterogyModalButton"
style="font-size: 16px; color:rgb(15, 155, 218);" data-toggle="modal" data-target="#addMaterialCaterogyModal"
title="Add Material Category">
</i> -->
@ -109,6 +113,10 @@
<label for="HSNcode">HSN code</label>
<input type="text" class="form-control" id="HSNcode" onkeypress="return isNumberKey(event)" name="HSNcode" maxlength="8">
</div>
<div class="col-md-3">
<label for="material_rate">Rate<span class="badge">*</span></label>
<input type="text" class="form-control" id="material_rate" onkeypress="return isNumberKey(event)" name="material_rate" required>
</div>
<div class="col-md-3">
<label for="OpeningStock">Opening Stock</label>
<input type="text" class="form-control" id="openstock" name="openstock" maxlength="255">
@ -116,23 +124,25 @@
<div class="col-md-3">
<label for="OpenStockDate">Open Stock Date</label>
<?php
$data = array('name' => '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);
?>
</div>
</div>
<div class="form-row" style="margin-top:20px">
<div class="col-md-3">
<label for="ReorderLevel">Reorder Level</label>
<input type="text" class="form-control" id="reorder" name="reorder" maxlength="255">
</div>
</div>
<div class="form-row" style="margin-top:20px">
<div class="col-md-3">
<label for="Remarks">Remarks</label>
<input type="text" class="form-control" id="remarks" name="remarks" maxlength="255">
</div>
</div>
</div>
<div class="col-md-12 text-right">
@ -195,28 +205,28 @@
<!-- addMaterialCaterogyModal -->
<div class="modal fade" id="addMaterialCaterogyModal" tabindex="-1" aria-labelledby="addMaterialCaterogyModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="addMaterialCaterogyModalLabel">Add Material Category</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form id="addMaterialCategoryForm">
<div class="form-group">
<label for="materialCategoryInput">Material Category</label>
<input type="text" class="form-control" id="materialCategoryInput" placeholder="Enter material category">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" onclick="addMaterialCategory()">Save Category</button>
</div>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="addMaterialCaterogyModalLabel">Add Material Category</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form id="addMaterialCategoryForm">
<div class="form-group">
<label for="materialCategoryInput">Material Category</label>
<input type="text" class="form-control" id="materialCategoryInput" placeholder="Enter material category">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" onclick="addMaterialCategory()">Save Category</button>
</div>
</div>
</div>
</div>
</div>
@ -298,14 +308,15 @@
let validation = Validate();
if(!validation){
if (!validation) {
return false;
}
var materialName = $('#MaterialName').val().trim();
var materialCode = '';
var materialCategory = $('#MatCate').val();
if(materialName == ''){
var materialType = $('MaterialType').val();
if (materialName == '') {
return;
}
@ -314,47 +325,48 @@
$('#loader').show();
$.ajax({
data: {
materialCode,
materialName,materialCategory
materialCode,
materialName,
materialCategory
},
type: "POST",
url: "<?php echo base_url(); ?>materialExist",
success: function(data) {
if (data && data.length >= 1) {
$('#loader').hide();
let message = "";
if (data[0]?.IsActive == 1) {
message = "Material name already exists!\n\n";
} else {
message = "Material name already exists in the deleted section!\n\n";
}
$('#loader').hide();
let message = "";
if (data[0]?.IsActive == 1) {
message = "Material name already exists!\n\n";
} else {
message = "Material name already exists in the deleted section!\n\n";
}
let related_name = "";
$.each(data, function(i, obj) {
related_name += obj.MaterialCode + " - " + obj.MaterialName + " - " + obj.MaterialType + " - " + obj.CategoryName + "\n";
});
let related_name = "";
$.each(data, function(i, obj) {
related_name += obj.MaterialCode + " - " + obj.MaterialName + " - " + obj.MaterialType + " - " + obj.CategoryName + "\n";
});
message += "'" + materialName + "' - related materials are:\n\n" + related_name;
message += "'" + materialName + "' - related materials are:\n\n" + related_name;
alert(message);
alert(message);
$("#MaterialName").val('');
$("#MaterialName").focus();
} else{
$("#MaterialName").val('');
$("#MaterialName").focus();
} else {
console.log("Material name is unique");
$('#loader').hide();
$('#addMaterialForm').submit();
}
},
error: function(error) {
$('#loader').hide();
alert("Error Occur" ,error);
alert("Error Occur", error);
},
complete: function(){
complete: function() {
$('#loader').hide();
console.log("Ajax completed..!!");
}
@ -362,35 +374,40 @@
});
function Validate() {
if ($("#MaterialName").val().length < 1) {
alert('Please Enter MaterialName');
$("#MaterialName").focus();
return false;
}
if ($("option:selected", $("#UOM")).val() == "") {
alert('Please Select UOM ');
$("#UOM").focus();
return false;
}
if ($("option:selected", $("#MaterialCategory")).val() == "") {
alert('Please Select Material Category');
$("#MaterialCategory").focus();
return false;
}
if ($("option:selected", $("#MaterialType")).val() == "") {
alert('Please Select Material Type');
$("#MaterialType").focus();
return false;
}
if ($("option:selected", $("#MatCate")).val() == "") {
alert('Please Select Material Category');
$("#MatCate").focus();
return false;
}
if ($("option:selected", $("#UOM")).val() == "") {
alert('Please Select UOM ');
$("#UOM").focus();
return false;
}
if ($("#material_rate").val().length < 1) {
alert('Please Enter Rate');
$("#material_rate").focus();
return false;
}
return true;
}
</script>
<script>
function addMaterialCategory (){
function addMaterialCategory() {
$('#materialCategoryInput').val()
@ -410,11 +427,9 @@
<script>
$(document).on('keydown', function(event) {
if (event.key === 'Enter') {
event.preventDefault(); // Prevent default Enter key behavior
}
});
$(document).on('keydown', function(event) {
if (event.key === 'Enter') {
event.preventDefault(); // Prevent default Enter key behavior
}
});
</script>

View File

@ -52,8 +52,8 @@
<input type="text" class="form-control required " readonly id="Designation" name="Designation" maxlength="128">
</div>
<div class="col-md-3">
<label for="Emailaddress">Email address</label><span class="badge">*</span>
<input type="text" class="form-control required " id="MailID" name="MailID" maxlength="128">
<label class="col-form-label" for="Emailaddress">Email address<span class="badge">*</span></label>
<input type="text" class="form-control required email" id="MailID" name="MailID" maxlength="128">
</div>
</div>
<div class="form-row" style="margin-top:20px">

View File

@ -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;">
<thead>
<tr>
<th>SNo</th>
<th>Requisition No</th>
<th>Item Code</th>
<th>Item Description</th>
<th>Quantity</th>
<th>UOM</th>
<th class="text-right">Rate<?php echo "($INRSYM)" ?></th>
<th class="text-right">Basic Amount<?php echo "($INRSYM)" ?></th>
<th class="text-right">Tax Amount<?php echo "($INRSYM)" ?></th>
<th class="text-right">Total Order Amount<?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important;">SNo</th>
<th style="white-space: nowrap !important; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important;">Item Code</th>
<th style="white-space: nowrap !important;">Item Description</th>
<th style="white-space: nowrap !important;" class="text-right">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th>
<th style="white-space: nowrap !important;" class="text-right">Rate<?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important;" class="text-right">Basic Amount<?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important;" class="text-right">Tax Amount<?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important;" class="text-right">Total Order Amount<?php echo "($INRSYM)" ?></th>
<th>Action</th>
</tr>
</thead>
@ -3577,7 +3579,7 @@ if (!empty($INRSYMBOL)) {
class="badge mandatory">*</span></label>
<div class="form-group">
<?php
$data = array('name' => '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);
?>
</div>
@ -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 = `
<tr id="${temp}">
<td>${temp}</td>
<td>${Reqnumber}</td>
<td style="text-align:center !important">${Reqnumber}</td>
<td>${materialCode}</td>
<td>${materialName}</td>
<td align="center">${quantity}</td>
<td>${rshorten}</td>
<td align="right">${quantity}</td>
<td>${uom}</td>
<td align="right">${itemRate}</td>
<td align="right">${basicval}</td>
@ -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 = `
<tr id="${temp}">
<td>${temp}</td>
<td>${Reqnumber}</td>
<td style="text-align:center !important">${Reqnumber}</td>
<td>${materialCode}</td>
<td>${materialName}</td>
<td align="center">${quantity}</td>
<td>${sshorten}</td>
<td align="right">${quantity}</td>
<td>${uom}</td>
<td align="right">${itemRate}</td>
<td align="right">${basicval}</td>
@ -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: "<?php echo base_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: "<?php echo base_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);
}
});
}
// }
}
}

View File

@ -224,7 +224,7 @@ $currentday = date('d');
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<ol class="breadcrumb mt-0.99 mb-2.5"">
<li class="breadcrumb-item"><a href="javascript: void(0);">HR</a></li>
<li class="breadcrumb-item active">
<h4 class="page-title">Attendance </h4>
@ -234,9 +234,6 @@ $currentday = date('d');
</div>
</div>
<div class="col-6 text-right">
<!-- Right-aligned buttons or links can be added here -->
</div>
</div>
<div class="row">
<div class="col-12">

View File

@ -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; }
}
}
</script>
<div class="content-page">
@ -515,7 +555,7 @@ if (!empty($INRSYMBOL)) {
<?php
$data = array('name' => '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);
?>
</div>
@ -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)) {
<table id="serviceTax" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead>
<tr>
<th>SNo</th>
<th>Requisition No</th>
<th>Item Code</th>
<th>Item Description</th>
<th>Line Item Specs</th>
<th>Quantity</th>
<th>UOM</th>
<th>Rate</th>
<th>Basic Amount</th>
<th>Tax Amount</th>
<th>Total Order Amount</th>
<th style="white-space: nowrap !important;">SNo</th>
<th style="white-space: nowrap !important;" align="center">Requisition No</th>
<th style="white-space: nowrap !important;">Item Code</th>
<th style="white-space: nowrap !important;">Item Description</th>
<th style="white-space: nowrap !important;">Line Item Specs</th>
<th style="white-space: nowrap !important;" align="right">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th>
<th style="white-space: nowrap !important;" align="right">Rate</th>
<th style="white-space: nowrap !important;" align="right">Basic Amount</th>
<th style="white-space: nowrap !important;" align="right">Tax Amount</th>
<th style="white-space: nowrap !important;" align="right">Total Order Amount</th>
<th>Action</th>
</tr>
</thead>
@ -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 = `
<tr id="${temp}">
<td align="left">${temp}</td>
<td align="left">${Reqnumber}</td>
<td align="center">${Reqnumber}</td>
<td align="left">${materialCode}</td>
<td align="left">${materialName}</td>
<td>
<td align="left">${shorten}</td>
<td align="left">
<a href="#" class="editable-field"
data-notes = "-" data-id ="${temp}">-</a>
<div class="edit-container" style="display:none;">
@ -3498,12 +3542,12 @@ if (!empty($INRSYMBOL)) {
<button class="cancel-btn"></button>
</div>
</td>
<td align="left">${quantity}</td>
<td align="right">${quantity}</td>
<td align="left">${uom}</td>
<td align="left">${itemRate}</td>
<td align="left">${basicval}</td>
<td align="left">${TotalTaxValue}</td>
<td align="left">${Total}</td>
<td align="right">${itemRate}</td>
<td align="right">${basicval}</td>
<td align="right">${TotalTaxValue}</td>
<td align="right">${Total}</td>
<td>
<a data-target='#EDITCAPITAL' id="edit${temp}" data-id="${temp}" data-userid="${temp}" data-toggle="modal" href="#EDITREVENUE">
<i class="ri-pencil-fill" data-toggle="tooltip" ></i>&nbsp;&nbsp;&nbsp;
@ -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() {

View File

@ -192,12 +192,12 @@
&nbsp;&nbsp;
<a onclick="confirmDeleteConfig(event)"
<!-- <a onclick="confirmDeleteConfig(event)"
href="<?php echo base_url() . 'configurationctrl/deleteConfig?ConfigID=' . $record->Config_ID; ?>"
data-toggle="tooltip"
title="<?php echo $record->Config_ID ?> - Click here to Delete Config Details">
<i class="fas fa-trash" data-toggle="tooltip" title="Click here to Delete the Config Value"></i>
</a>
</a> -->
<?php } ?>
</td>

View File

@ -93,6 +93,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<th>Vehicle Number</th>
<th>Salary Amount</th>
<th>Food Amount</th>
<th>Total</th>
<th>Load Type</th>
<th>Action</th>
</tr>
@ -118,6 +119,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<td><?= esc($record['vehicle_number']) ?></td>
<td><?= esc($record['salary_amount']) ?></td>
<td><?= esc($record['food_amount']) ?></td>
<td><?= esc($record['salary_amount']+$record['food_amount']) ?></td>
<td><?= esc($record['load_type']) ?></td>
<td><?php if($record['payroll_id'] == ''){ ?>
<a data-toggle="modal" href="#attendanceModal" data-arr='<?php echo json_encode($record); ?>' data-id='<?= esc($record['driver_attendance_id']) ?>'>
@ -134,6 +136,64 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<?php } ?>
<?php endif; ?>
</tbody>
<tfoot>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th>Salary Amount</th>
<th></th>
<th></th>
<th></th>
<th id="rowTotalAmount"></th>
<th></th>
<th></th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th>Diesel</th>
<th><input type="text" class="editable" data-column="diesel_amount"></th>
<th></th>
<th></th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th>Shed Amount</th>
<th><input type="text" class="editable" data-column="shed_amount"></th>
<th></th>
<th></th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th>Total</th>
<th id="totalAmount">-</th>
<th></th>
<th></th>
</tr>
</tfoot>
</table>
</div>
@ -221,7 +281,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<div class="col-md-6">
<label class="form" for="load_type">Load Type</label>
<select class="form-control" id="load_type" name="load_type" onchange="salary();">
<select class="form-control" id="load_type" name="load_type" onchange="updateSalaryBasedOnType();">
<option value="">Select</option>
<option value="Load">Load</option>
<option value="Waste Core">Waste Core</option>
@ -234,11 +294,11 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<div class="row mt-2">
<div class="col-md-4">
<label class="form" for="salary_amount">Salary Amount</label>
<input type="text" class="form-control" id="salary_amount" name="salary_amount" onkeypress="return isNumber(event);" onchange="salary();">
<input type="text" class="form-control" id="salary_amount" name="salary_amount" onkeypress="return isNumber(event);" onchange="fetchSalary();">
</div>
<div class="col-md-4">
<label class="form" for="food_amount">Food Amount</label>
<input type="text" class="form-control" id="food_amount" name="food_amount" onkeypress="return isNumber(event);" onchange="salary();">
<input type="text" class="form-control" id="food_amount" name="food_amount" onkeypress="return isNumber(event);" onchange="fetchSalary();">
</div>
<div class="col-md-4">
<label class="form" for="total_amount">Total Amount</label>
@ -303,13 +363,21 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
$("#gobal_driver_id").val("<?php echo $gobal_driver_id; ?>");
$("#driver_id").val("<?php echo $gobal_driver_id; ?>");
}
let gobal_diesel_amount = "<?php echo $gobal_diesel_amount; ?>";
let gobal_shed_amount = "<?php echo $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: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // 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: "<?php echo base_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();
});
</script>
@ -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');

View File

@ -63,9 +63,7 @@
<i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;
</a>
<?php $today = date('M-Y'); ?>
<a title="Trip Details" style="cursor:pointer;" href="<?= base_url() . 'loadDriverAttendance?gobal_driver_id=' . $record['driver_id'].'&month_year='.$today; ?>">
<i class="fa fa-truck"></i>&nbsp;&nbsp;&nbsp;
</a>
<?php } ?>
</td>
</tr>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -797,22 +797,20 @@ if (!empty($POItem) && $CapitalRange == '1') {
</div>
<div class="form-row">
<div class="table-responsive">
<table id="serviceTax" class="table table-striped table-hover mb-0"
<table id="serviceTax" class="table table-bordered table-hover mb-0"
style="font-size:12px;">
<thead>
<tr>
<th>SNo</th>
<th>Requisition No</th>
<th>Item Name</th>
<th>Quantity</th>
<th>UOM</th>
<th>Rate</th>
<th>Basic Amount</th>
<th>Tax Amount</th>
<th>Total Order Amount</th>
<th>Action</th>
<th style="white-space: nowrap !important; text-align:left !important">SNo</th>
<th style="white-space: nowrap !important; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important; text-align:left !important">Item Description</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important; text-align:left !important">UOM</th>
<th style="white-space: nowrap !important; text-align:right !important">Rate<?php echo "($INR)" ?></th>
<th style="white-space: nowrap !important; text-align:right !important">Basic Amount<?php echo "($INR)" ?></th>
<th style="white-space: nowrap !important; text-align:right !important">Tax Amount<?php echo "($INR)" ?></th>
<th style="white-space: nowrap !important; text-align:right !important">Total Order Amount<?php echo "($INR)" ?></th>
<th style="white-space: nowrap !important; text-align:left !important">Action</th>
</tr>
</thead>
@ -826,16 +824,17 @@ if (!empty($POItem) && $CapitalRange == '1') {
?>
<tr id="<?php echo $index; ?>">
<td align="left"><?php echo $index; ?></td>
<td><?php echo $record->ReqNo ?></td>
<td><?php echo $record->MaterialName ?></td>
<td style="text-align:right"><?php echo $record->Quantity ?></td>
<td><?php echo $record->UOM ?></td>
<td style="text-align:right"><?php echo $record->Rate ?></td>
<td style="text-align:right">
<td style="text-align:left !important"><?php echo $index; ?></td>
<td style="text-align:center !important"><?php echo $record->ReqNo ?></td>
<td style="text-align:left !important"><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td>
<td style="text-align:right !important"><?php echo $record->Quantity ?></td>
<td style="text-align:left !important"><?php echo $record->UOM ?></td>
<td style="text-align:right !important"><?php echo number_format($record->Rate, 2, '.', ''); ?></td>
<td style="text-align:right !important">
<?php echo number_format($record->Rate * $record->Quantity, 2, '.', ''); ?>
</td>
<td style="text-align:right"><?php if ($CapitalRange == '1') {
<td style="text-align:right !important"><?php if ($CapitalRange == '1') {
echo $record->ServiceTaxamount;
} else if ($CapitalRange == '0') {
echo "0.0";
@ -845,12 +844,12 @@ if (!empty($POItem) && $CapitalRange == '1') {
<!-- <td style="text-align:right"><?php echo $record->TotalValue + $record->Afvalue; ?></td> -->
<td><?php echo number_format($record->Rate * $record->Quantity + $record->ServiceTaxamount + $record->otherallowance + $record->Afvalue - $record->Afterdiscountval, 2, '.', '') ?>
<td style="text-align:right !important"><?php echo number_format($record->Rate * $record->Quantity + $record->ServiceTaxamount + $record->otherallowance + $record->Afvalue - $record->Afterdiscountval, 2, '.', '') ?>
</td>
<?php } else if ($CapitalRange == '0') { ?>
<td style="text-align:right">
<td style="text-align:right !important">
<?php echo number_format(($record->Rate * $record->Quantity), 2, '.', ''); ?>
</td>
<?php } ?>
@ -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 = '<?php echo $AvlAmount ?>';
//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);
}
}
});
}
// }
}
}

View File

@ -870,7 +870,7 @@ if (!empty($getlogpodtl)) {
</div>
<div class="form-row">
<!-- <div class="col-md-9" align="right" style="padding:10px"> -->
<!-- <div class="col-md-9" style="text-align:right !important" style="padding:10px"> -->
<!-- <input type="checkbox" id="IsOpenOrder" name="IsOpenOrder" value="1"> IS THIS OPEN ORDER FORMAT -->
<!-- </div> -->
<div class="form-group col-md-12" align=" right">
@ -888,16 +888,16 @@ if (!empty($getlogpodtl)) {
<thead>
<tr>
<th>SNo</th>
<th>Requisition No</th>
<th>Item Code</th>
<th>Item Description</th>
<th>Line Item Specs</th>
<th>Quantity</th>
<th>UOM</th>
<th>Rate<?php echo "($INR)" ?></th>
<th>Basic Amount<?php echo "($INR)" ?></th>
<th>Tax Amount<?php echo "($INR)" ?></th>
<th>Total Order Amount<?php echo "($INR)" ?></th>
<th style="white-space: nowrap !important; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important;">Item Code</th>
<th style="white-space: nowrap !important;">Item Description</th>
<th style="white-space: nowrap !important;">Line Item Specs</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th>
<th style="white-space: nowrap !important; text-align:right !important">Rate<?php echo "($INR)" ?></th>
<th style="white-space: nowrap !important; text-align:right !important">Basic Amount<?php echo "($INR)" ?></th>
<th style="white-space: nowrap !important; text-align:right !important">Tax Amount<?php echo "($INR)" ?></th>
<th style="white-space: nowrap !important; text-align:right !important">Total Order Amount<?php echo "($INR)" ?></th>
<!-- <th>Actual Quantity</th>
<th>Received Quantity</th>
<th>Pending Quantity</th> -->
@ -920,9 +920,10 @@ if (!empty($getlogpodtl)) {
?>
<tr id="<?php echo $index; ?>">
<td align="left"><?php echo $index; ?></td>
<td><?php echo $record->ReqNo ?></td>
<td style="text-align:center !important"><?php echo $record->ReqNo ?></td>
<td><?php echo $record->MaterialCode ?></td>
<td><?php echo $record->MaterialName ?></td>
<td><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td>
<td>
<?php if ($PONOStatus === PO_DRAFT || $PONOStatus === PO_CREATED) { ?>
<a href="#"
@ -937,28 +938,28 @@ if (!empty($getlogpodtl)) {
</div>
<?php }else{ echo !empty($record->LineitemAuditorNotes) ? $record->LineitemAuditorNotes : "-"; } ?>
</td>
<td align="right"><?php echo $record->Quantity ?></td>
<td align="right"><?php echo $record->UOM ?></td>
<td align="right"><?php echo $record->Rate ?></td>
<td align="right"><?php echo number_format($record->Rate * $record->Quantity, 2, '.', '') ?></td>
<td style="text-align:right !important"><?php echo $record->Quantity ?></td>
<td ><?php echo $record->UOM ?></td>
<td style="text-align:right !important"><?php echo $record->Rate ?></td>
<td style="text-align:right !important"><?php echo number_format($record->Rate * $record->Quantity, 2, '.', '') ?></td>
<?php if ($CapitalRange == '1') { ?>
<td align="right"><?php echo $record->ServiceTaxamount; ?></td>
<td align="right">
<td style="text-align:right !important"><?php echo $record->ServiceTaxamount; ?></td>
<td style="text-align:right !important">
<?php echo number_format($record->Rate * $record->Quantity + $record->ServiceTaxamount + $record->otherallowance + $record->Afvalue - $record->Afterdiscountval, 2, '.', '') ?>
</td>
<?php } ?>
<?php if ($CapitalRange == '0') { ?>
<td align="right"><?php echo '0'; ?></td>
<td style="text-align:right !important"><?php echo '0'; ?></td>
<td align="right"><?php echo number_format($record->Rate * $record->Quantity, 2, '.', '') ?></td>
<td style="text-align:right !important"><?php echo number_format($record->Rate * $record->Quantity, 2, '.', '') ?></td>
<?php } ?>
<!-- <td align="right"><?php echo $record->Quantity ?></td>
<td align="right"><?php echo $record->ReceivedQuantity ?></td>
<td align="right"><?php echo number_format($record->Quantity - $record->ReceivedQuantity, 2, '.', ''); ?></td> -->
<!-- <td style="text-align:right !important"><?php echo $record->Quantity ?></td>
<td style="text-align:right !important"><?php echo $record->ReceivedQuantity ?></td>
<td style="text-align:right !important"><?php echo number_format($record->Quantity - $record->ReceivedQuantity, 2, '.', ''); ?></td> -->
<?php
$row = array("materialCode" => $record->MaterialCode, "ReqNo" => $record->ReqNo);
array_push($res_arr_values, $row);
@ -990,11 +991,11 @@ if (!empty($getlogpodtl)) {
<input type="hidden" name="<?php echo 'quantity' . $index ?>"
id="<?php echo 'quantity' . $index ?>" value="<?php echo $record->Quantity; ?>" />
<input align="right" type="hidden" name="<?php echo 'b4qty' . $index ?>"
<input style="text-align:right !important" type="hidden" name="<?php echo 'b4qty' . $index ?>"
id="<?php echo 'b4qty' . $index ?>" value="<?php echo $record->Quantity; ?>" />
<input type="hidden" name="<?php echo 'itemRate' . $index ?>"
id="<?php echo 'itemRate' . $index ?>" value="<?php echo $record->Rate; ?>" />
<input align="right" type="hidden" name="<?php echo 'b4rate' . $index ?>"
<input style="text-align:right !important" type="hidden" name="<?php echo 'b4rate' . $index ?>"
id="<?php echo 'b4rate' . $index ?>" value="<?php echo $record->Rate; ?>" />
<?php if ($CapitalRange == '1') { ?>
@ -1021,11 +1022,11 @@ if (!empty($getlogpodtl)) {
<input type="hidden" name="<?php echo 'ServiceTotalOrderValue' . $index ?>"
id="<?php echo 'ServiceTotalOrderValue' . $index ?>"
value="<?php echo $record->ServiceTaxamount; ?>" />
<input align="right" type="hidden" name="<?php echo 'DisType' . $index ?>"
<input style="text-align:right !important" type="hidden" name="<?php echo 'DisType' . $index ?>"
id="<?php echo 'DisType' . $index ?>" value="<?php echo $record->discount; ?>" />
<input align="right" type="hidden" name="<?php echo 'DisVal' . $index ?>"
<input style="text-align:right !important" type="hidden" name="<?php echo 'DisVal' . $index ?>"
id="<?php echo 'DisVal' . $index ?>" value="<?php echo $record->discountval; ?>" />
<input align="right" type="hidden" name="<?php echo 'AfterDisVal' . $index ?>"
<input style="text-align:right !important" type="hidden" name="<?php echo 'AfterDisVal' . $index ?>"
id="<?php echo 'AfterDisVal' . $index ?>" value="<?php echo $record->Afterdiscountval; ?>" />
<input type="hidden" name="<?php echo 'basicvalInINR' . $index ?>"
id="<?php echo 'basicvalInINR' . $index ?>"
@ -1050,19 +1051,19 @@ if (!empty($getlogpodtl)) {
<?php } ?>
<?php if ($CapitalRange == '0') { ?>
<input align="right" type="hidden" name="<?php echo 'FreightType' . $index ?>"
<input style="text-align:right !important" type="hidden" name="<?php echo 'FreightType' . $index ?>"
id="<?php echo 'FreightType' . $index ?>" value="<?php echo $record->FreightType; ?>" />
<input align="right" type="hidden" name="<?php echo 'NoOfTrip' . $index ?>"
<input style="text-align:right !important" type="hidden" name="<?php echo 'NoOfTrip' . $index ?>"
id="<?php echo 'NoOfTrip' . $index ?>" value="<?php echo $record->NoOfTrip; ?>" />
<input align="right" type="hidden" name="<?php echo 'FreightVal' . $index ?>"
<input style="text-align:right !important" type="hidden" name="<?php echo 'FreightVal' . $index ?>"
id="<?php echo 'FreightVal' . $index ?>" value="<?php echo $record->FreightValue; ?>" />
<input align="right" type="hidden" name="<?php echo 'AfterFreightVal' . $index ?>"
<input style="text-align:right !important" type="hidden" name="<?php echo 'AfterFreightVal' . $index ?>"
id="<?php echo 'AfterFreightVal' . $index ?>"
value="<?php echo $record->AfterFreightValue; ?>" />
@ -1159,13 +1160,13 @@ if (!empty($getlogpodtl)) {
<input type="hidden" name="<?php echo 'ServiceTotalOrderValue' . $index ?>"
id="<?php echo 'ServiceTotalOrderValue' . $index ?>" value="0" />
<input align="right" type="hidden" name="<?php echo 'DisType' . $index ?>"
<input style="text-align:right !important" type="hidden" name="<?php echo 'DisType' . $index ?>"
id="<?php echo 'DisType' . $index ?>" value="0" />
<input align="right" type="hidden" name="<?php echo 'DisVal' . $index ?>"
<input style="text-align:right !important" type="hidden" name="<?php echo 'DisVal' . $index ?>"
id="<?php echo 'DisVal' . $index ?>" value="0" />
<input align="right" type="hidden" name="<?php echo 'AfterDisVal' . $index ?>"
<input style="text-align:right !important" type="hidden" name="<?php echo 'AfterDisVal' . $index ?>"
id="<?php echo 'AfterDisVal' . $index ?>" value="0" />
@ -1564,7 +1565,7 @@ if (!empty($getlogpodtl)) {
</div>
</div>
<div align="right" style="padding:3% 2%;">
<div style="text-align:right !important" style="padding:3% 2%;">
<div>
@ -1957,7 +1958,7 @@ if (!empty($getlogpodtl)) {
echo form_input($data);
?>
</div>
<div class="form-group col-md-6" align="right">
<div class="form-group col-md-6" style="text-align:right !important">
<label> CGST In % </label>
</div>
@ -1982,7 +1983,7 @@ if (!empty($getlogpodtl)) {
</div>
<div class="form-row" id="ADDCAPdiv3" style="padding:0px">
<div class="form-group col-md-6" align="right">
<div class="form-group col-md-6" style="text-align:right !important">
<label> SGST In % </label>
</div>
@ -2011,7 +2012,7 @@ if (!empty($getlogpodtl)) {
</div>
<div class="form-row" id="ADDCAPdiv2" style="padding:0px">
<div class="form-group col-md-6" align="right">
<div class="form-group col-md-6" style="text-align:right !important">
<label> IGST In % </label>
</div>
@ -2038,7 +2039,7 @@ if (!empty($getlogpodtl)) {
</div>
<div class="form-row" id="ADDCAPdiv1" style="padding:0px">
<div class="col-md-9 col-md-offset-4" align="right">
<div class="col-md-9 col-md-offset-4" style="text-align:right !important">
<label>Other Allowances <?php echo "($INR)" ?></label>
</div>
<div class="form-group col-md-3">
@ -2049,7 +2050,7 @@ if (!empty($getlogpodtl)) {
?>
</div>
</div>
<div class="col-md-9 col-md-offset-4" align="right">
<div class="col-md-9 col-md-offset-4" style="text-align:right !important">
<label>Total Amount <?php echo "($INR)" ?></label>
</div>
<div class="form-group col-md-3">
@ -2645,7 +2646,7 @@ if (!empty($getlogpodtl)) {
?>
</div>
<div class="form-group col-md-6" align="right">
<div class="form-group col-md-6" style="text-align:right !important">
<label> CGST In % <label>
</div>
@ -2669,7 +2670,7 @@ if (!empty($getlogpodtl)) {
</div>
</div>
<div class="form-row" id="EDITCAPdiv1">
<div class="form-group col-md-6" align="right">
<div class="form-group col-md-6" style="text-align:right !important">
<label> SGST In % </label>
</div>
<div class="form-group col-md-3">
@ -2694,7 +2695,7 @@ if (!empty($getlogpodtl)) {
</div>
<div class="form-row" id="EDITCAPdiv2">
<div class="form-group col-md-6" align="right">
<div class="form-group col-md-6" style="text-align:right !important">
<label> IGST In % </label>
</div>
@ -2721,7 +2722,7 @@ if (!empty($getlogpodtl)) {
</div>
<div class="form-row" id="EDITCAPdiv3">
<div class="col-md-9 col-md-offset-4" align="right">
<div class="col-md-9 col-md-offset-4" style="text-align:right !important">
<label>Other Allowances <?php echo "($INR)" ?></label>
</div>
@ -2733,7 +2734,7 @@ if (!empty($getlogpodtl)) {
?>
</div>
</div>
<div class="col-md-9 col-md-offset-4" align="right">
<div class="col-md-9 col-md-offset-4" style="text-align:right !important">
<label>Total Amount <?php echo "($INR)" ?></label>
</div>
<div class="form-group col-md-3">
@ -3278,7 +3279,7 @@ if (!empty($getlogpodtl)) {
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6" align="right">
<div class="form-group col-md-6" style="text-align:right !important">
CGST In %
</div>
<div class="form-group col-md-3">
@ -3295,7 +3296,7 @@ if (!empty($getlogpodtl)) {
</div>
</div>
<div class="form-row" id="VIEWCAPdiv1" style="padding: 0px;">
<div class="form-group col-md-6" align="right">
<div class="form-group col-md-6" style="text-align:right !important">
SGST In %
</div>
<div class="form-group col-md-3">
@ -3312,7 +3313,7 @@ if (!empty($getlogpodtl)) {
</div>
</div>
<div class="form-row" id="VIEWCAPdiv2" style="padding: 0px;">
<div class="form-group col-md-6" align="right">
<div class="form-group col-md-6" style="text-align:right !important">
IGST In %
</div>
<div class="form-group col-md-3">
@ -3329,7 +3330,7 @@ if (!empty($getlogpodtl)) {
</div>
</div>
<div class="form-row" id="VIEWCAPdiv3" style="padding: 0px;">
<div class="col-md-9 col-md-offset-4" align="right">
<div class="col-md-9 col-md-offset-4" style="text-align:right !important">
<label>Other Allowances <?php echo "($INR)" ?></label>
</div>
<div class="form-group col-md-3">
@ -3340,7 +3341,7 @@ if (!empty($getlogpodtl)) {
</div>
</div>
<div class="form-row" id="" style="padding: 0px;">
<div class="col-md-9 col-md-offset-4" align="right">
<div class="col-md-9 col-md-offset-4" style="text-align:right !important">
<label>Total Amount <?php echo "($INR)" ?></label>
</div>
<div class="form-group col-md-3">
@ -3642,7 +3643,7 @@ if (!empty($getlogpodtl)) {
<div class="form-group col-md-4">
</div>
</div>
<div class="form-group col-md-6" align="right" style="display:none;"> <label>Total Order Amount
<div class="form-group col-md-6" style="text-align:right !important" style="display:none;"> <label>Total Order Amount
:</label></div>
<div class="form-group col-md-6" style="display:none;">
<div class="form-group">
@ -4776,12 +4777,13 @@ if (!empty($getlogpodtl)) {
// PendingQuantity: quantity
// }));
PONOStatus = <?php echo $PONOStatus; ?>
var shorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName;
var rowHtml = `
<tr id="${temp}">
<td align="left">${temp}</td>
<td align="left">${Reqnumber}</td>
<td align="left">${materialCode}</td>
<td align="left">${materialName}</td>`;
<td align="left">${shorten}</td>`;
if (PONOStatus === "PO_DRAFT" || PONOStatus === "PO_CREATED") {
rowHtml += `<td><a href="#" class="editable-field"
data-id="${temp}"
@ -4792,12 +4794,12 @@ if (!empty($getlogpodtl)) {
<button class="cancel-btn"></button>
</div></td>`;
}else{ rowHtml += `<td>-</td>`; }
rowHtml += `<td align="right">${quantity}</td>
<td align="right">${uom}</td>
<td align="right">${itemRate}</td>
<td align="right">${basicval}</td>
<td align="right">${TotalTaxValue}</td>
<td align="right">${Total}</td>
rowHtml += `<td style="text-align:right !important">${quantity}</td>
<td style="text-align:right !important">${uom}</td>
<td style="text-align:right !important">${itemRate}</td>
<td style="text-align:right !important">${basicval}</td>
<td style="text-align:right !important">${TotalTaxValue}</td>
<td style="text-align:right !important">${Total}</td>
<td>
<a data-target='#EDITCAPITAL' data-id="${temp}" data-userid="${temp}" data-toggle="modal" href="#EDITREVENUE">
<i class="ri-pencil-fill" data-toggle="tooltip" ></i>
@ -5358,15 +5360,8 @@ if (!empty($getlogpodtl)) {
type: "POST",
url: "<?php echo base_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);
}
}
});
}
// }
}
}

View File

@ -6,6 +6,13 @@
label {
font-style: bold;
}
input[type="file"] {
white-space: normal;
word-wrap: break-word;
overflow-wrap: break-word;
width: 100%;
}
</style>
<?php
@ -60,6 +67,7 @@ $esi_applicable = 0;
$pf_applicable = 0;
$TDS_Rate = '';
$tds_apllicable = 0;
$is_driver = 0;
if (!empty($EmpDetails)) {
foreach ($EmpDetails as $Emp) {
@ -110,6 +118,7 @@ if (!empty($EmpDetails)) {
$isactive = $Emp->IsActive;
$ProfilePicPath = '';
$is_driver = $Emp->is_driver;
if (!empty($Emp->ProfilePic)) {
@ -235,6 +244,11 @@ if (!empty($EmpDetails)) {
<input type='file' onchange="readURL(this);" id="photo"
name="photo" />
<?php if($Emp->ProfilePic){ ?>
<br/>
<label style="white-space: normal; word-wrap: break-word; overflow-wrap: break-word; width: 100%;"><span>previously uploaded profile picture - </span>
<small><?= $Emp->ProfilePic; ?></small></label>
<?php } ?>
<input type="hidden" name="oldImageName" id="Image"
value="<?php echo $Emp->ProfilePic; ?>" class="form-control"
@ -647,6 +661,20 @@ if (!empty($EmpDetails)) {
Team</label>
</div>
</div>
<div class="col-md-3" style="margin-top: 18px;">
<div class="form-group">
<label class="switch">
<input type="checkbox" name="is_driver"
value="<?= $is_driver; ?>" <?php echo $is_driver == '1' ? 'checked' : ''; ?>
onchange="updateSwitchValue(this);driverCheck(this);" />
<span class="slider"></span>
</label>
<label
style="display: inline-block; vertical-align: bottom; margin-right: 10px; margin-bottom: 10px;">Driver
</label>
</div>
</div>
<br>
</div>
@ -674,25 +702,25 @@ if (!empty($EmpDetails)) {
<div class="col-md-11">
<div class="row">
<div class="col-md-3">
<label>Bank Name</label>
<label>Bank Name<span class="badge">*</span></label>
<input type="text" id="bankbranchname" name="bankbranchname"
class="form-control"
value="<?php echo $BankBranchName; ?>" required>
</div>
<div class="col-md-3">
<label>Account Number</label>
<label>Account Number<span class="badge">*</span></label>
<input type="text" id="accountno" maxlength="20"
name="accountno" placeholder="Account Number"
class="form-control"
value="<?php echo $BankAccountNo; ?>"
onkeypress="return isNumberKey(event)">
onkeypress="return isNumberKey(event)" required>
</div>
<div class="col-md-3">
<label>IFSC Code</label>
<label>IFSC Code<span class="badge">*</span></label>
<input type="text" id="ifsccode" name="ifsccode" onkeyup="convertToUpperCase()"
placeholder="IFSC Code" class="form-control"
value="<?php echo $IFSCCode; ?>">
value="<?php echo $IFSCCode; ?>" required>
</div>
<div class="col-md-3">
<label>Bank Address</label>
@ -779,31 +807,6 @@ if (!empty($EmpDetails)) {
</div>
<div class="col-md-11">
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label>ESI Number</label>
<input type="text" id="esino" name="esino"
maxlength="10" onchange="validateESI();"
class="form-control" title=" 10 digit number"
value="<?php echo $esino; ?>"
onkeypress="return isNumberKey(event)">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="ESI_Rate">ESI Rate(%)</label>
<font color="Red">*</font>
<input type="text" name="ESI_Rate"
value="<?php echo $empPay->ESI_Rate; ?>"
class="form-control num"
style="text-transform:uppercase;"
pattern="([0-9]{1,2}([.][0-9]{1,2})?)"
title="Enter the Valid ESI Rate, Minimum 1 digit, Maximum 2 digits"
readonly />
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>UAN</label>
@ -827,6 +830,31 @@ if (!empty($EmpDetails)) {
title="Enter the valid PF Rate, Minimum 1 digit, Maximum 2 digits"
readonly />
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>ESI Number</label>
<input type="text" id="esino" name="esino"
maxlength="10" onchange="validateESI();"
class="form-control" title=" 10 digit number"
value="<?php echo $esino; ?>"
onkeypress="return isNumberKey(event)">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="ESI_Rate">ESI Rate(%)</label>
<font color="Red">*</font>
<input type="text" name="ESI_Rate"
value="<?php echo $empPay->ESI_Rate; ?>"
class="form-control num"
style="text-transform:uppercase;"
pattern="([0-9]{1,2}([.][0-9]{1,2})?)"
title="Enter the Valid ESI Rate, Minimum 1 digit, Maximum 2 digits"
readonly />
</div>
</div>
</div>
@ -1108,7 +1136,7 @@ if (!empty($EmpDetails)) {
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-3">
<label>Bank PassBok Name</label>
<label>Bank Passbook Name</label>
<input type="text" id="file_name" name="file_name4"
maxlength="255" class="form-control"
value="Bank Passbook" readonly>
@ -1126,7 +1154,7 @@ if (!empty($EmpDetails)) {
<?php } ?>
<div class="col-md-4">
<label>Update Bank PassBok File</label><br>
<label>Update Bank Passbook File</label><br>
<input type="file" name="emp_file4" class="">
</div>
@ -1235,13 +1263,13 @@ if (!empty($EmpDetails)) {
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<label>Bank PassBok Name</label>
<label>Bank Passbook Name</label>
<input type="text" id="file_name" name="file_name4"
maxlength="255" class="form-control"
value="Bank Passbook">
</div>
<div class="col-md-4">
<label>Bank PassBok File</label>
<label>Bank Passbook File</label>
<input type="file" name="emp_file4" class="">
</div>
</div>
@ -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 = "<?php echo $is_driver; ?>";
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 != "<?= $ContactNumber ?>") {
$('#loader').show();
$.ajax({
data: {
ContactNumber
},
type: "POST",
url: "<?php echo base_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();

View File

@ -1199,16 +1199,21 @@ if (!empty($RequistionDetails)) {
<br />
<div class="form-row">
<div class="table-responsive">
<table id="ImportTax" class="table table-striped table-hover mb-0" style="font-size:12px;">
<table id="ImportTax" class="table table-bordered table-hover mb-0" style="font-size:12px;">
<thead>
<tr>
<th>SNo</th>
<th>Requisition No</th>
<th>Item Name</th>
<th>Quantity</th>
<th>UOM</th>
<th>Rate<?php echo $INR ?></th>
<th>Basic Amount<?php echo $INR ?></th>
<th style="white-space: nowrap !important; text-align:left !important">SNo</th>
<th style="white-space: nowrap !important; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important; text-align:left !important">Item Description</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important; text-align:left !important">UOM</th>
<th style="white-space: nowrap !important; text-align:right !important">Rate<?php echo $INR ?></th>
<th style="white-space: nowrap !important; text-align:right !important">Basic Amount<?php echo $INR ?></th>
<!-- <th>Tax Amount</th>
<th>Total Order Amount</th> -->
<th>Action</th>
@ -1225,13 +1230,14 @@ if (!empty($RequistionDetails)) {
?>
<tr id="<?php echo $index; ?>">
<td align="left"><?php echo $index; ?></td>
<td><?php echo $record->ReqNo ?></td>
<td><?php echo $record->MaterialName ?></td>
<td><?php echo $record->Quantity ?></td>
<td><?php echo $index; ?></td>
<td style="text-align:center !important"><?php echo $record->ReqNo ?></td>
<td><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td>
<td style="text-align:right !important"><?php echo $record->Quantity ?></td>
<td><?php echo $record->UOM ?></td>
<td><?php echo $record->Rate ?></td>
<td><?php echo $record->BasicValue ?></td>
<td style="text-align:right !important"><?php echo $record->Rate ?></td>
<td style="text-align:right !important"><?php echo $record->BasicValue ?></td>
<!-- <td><?php echo $record->Taxamount ?></td>
<td><?php echo $record->TotalOrderValue ?></td> -->
<input type="hidden" name="<?php echo 'Reqnumber' . $index ?>" id="<?php echo 'Reqnumber' . $index ?>" value="<?php echo $record->ReqNo; ?>" />
@ -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);
}
});
}
// }
}
}

View File

@ -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',
});
});
</script>
@ -161,25 +163,25 @@ if ($total <= $reorder) {
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="MaterialCategory">Material Category
<span class="badge">*</span></label>
<!-- <i type="button" class="fe-plus-circle" id="addMaterialCaterogyModalButton"
<span class="badge">*</span></label>
<!-- <i type="button" class="fe-plus-circle" id="addMaterialCaterogyModalButton"
style="font-size: 16px; color:rgb(15, 155, 218);" data-toggle="modal" data-target="#addMaterialCaterogyModal"
title="Add Material Caterogy">
</i> -->
<select class="form-control select2" id="MaterialCategory" name="MaterialCategory" required>
<?php
if (!empty($materialCategory)) {
foreach ($materialCategory as $SID) {
?>
<option value="<?php echo $SID->Key ?>" <?php if ($MaterialCategory === $SID->Key) echo "selected"; ?>><?php echo $SID->ConfigValue ?></option>
<?php
}
<select class="form-control select2" id="MaterialCategory" name="MaterialCategory" required>
<?php
if (!empty($materialCategory)) {
foreach ($materialCategory as $SID) {
?>
<option value="<?php echo $SID->Key ?>" <?php if ($MaterialCategory === $SID->Key) echo "selected"; ?>><?php echo $SID->ConfigValue ?></option>
<?php
}
?>
}
?>
</select>
</div>
</div>
@ -211,6 +213,12 @@ if ($total <= $reorder) {
<input type="text" class="form-control" id="HSNcode" name="HSNcode" maxlength="8" value="<?php echo $HSNcode; ?>" onkeypress="return isNumberKey(event)">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="Rate">Rate<span class="badge">*</span></label>
<input type="text" class="form-control" id="material_rate" onkeypress="return isNumberKey(event)" value="<?php echo $material_rate; ?>" name="material_rate" required>
</div>
</div>
<?php if ($openstock != "") { ?>
<div class="col-md-3">
<div class="form-group">
@ -226,25 +234,32 @@ if ($total <= $reorder) {
</div>
</div>
<?php } ?>
</div>
<div class="form-row mb-3">
<?php if ($date != "") { ?>
<div class="col-md-3">
<div class="form-group">
<label>Open Stock Date</label>
<input type="text" name="Date" id="Date" class="form-control" value="<?php echo $date; ?>" readonly>
<?php
$formattedDate = get_date_time_dynamical_format('Y-m-d','d-m-Y',"$date");
$data = array('name' => 'Date', 'value' => set_value('Date',$formattedDate), 'id' => 'Date', 'class' => 'form-control', 'onkeypress' => 'return false;','readonly'=>true, 'autocomplete'=>'"off"');
echo form_input($data);
?>
<!-- <input type="text" name="Date" id="Date" class="form-control" value="<?php echo $date; ?>" readonly> -->
</div>
</div>
<?php } else { ?>
<div class="col-md-3">
<div class="form-group">
<label>Open Stock Date</label>
<input type="text" name="Date" id="Date" class="form-control" readonly>
<?php
$data = array('name' => 'Date', 'value' => set_value('Date'), 'id' => 'Date', 'class' => 'form-control', 'onkeypress' => 'return false;', 'autocomplete'=>'"off"');
echo form_input($data);
?>
<!-- <input type="text" name="Date" id="Date" class="form-control" readonly> -->
</div>
</div>
<?php } ?>
</div>
<div class="form-row mb-3">
<div class="col-md-3">
<div class="form-group">
<label for="reorder">Reorder Level</label>
@ -264,19 +279,27 @@ if ($total <= $reorder) {
<input type="text" class="form-control" id="avg_price" name="avg_price" readonly value="<?php echo $Average_Value ?>" maxlength="255">
</div>
</div>
</div>
<div class="form-row mb-3">
<div class="col-md-3">
<div class="form-group">
<label for="remarks">Remarks</label>
<input type="text" class="form-control" id="remarks" name="remarks" maxlength="255" value="<?php echo $remarks; ?>">
</div>
</div>
</div>
<div class="form-row mb-3">
<div class="col-md-3">
<div class="form-group">
<label class="switch">
<input type="checkbox" id="isactive" name="isactive" <?php echo $IsActive; ?> />
<span class="slider"></span>
</label>
<label class="mt-4">Is Active</label>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label for="isactive">Is Active</label><br />
<input type="checkbox" id="isactive" name="isactive" <?php echo $IsActive; ?>>
</div>
</div>
</div>
@ -284,9 +307,9 @@ if ($total <= $reorder) {
</div>
</div>
<div class="box-footer text-right">
<button type="button" class="btn btn-secondary" onclick="history.back()">
<span class="bold">Cancel</span>
</button>
<button type="button" class="btn btn-secondary" onclick="history.back()">
<span class="bold">Cancel</span>
</button>
<input type="button" id="editRawMaterialBtnId" class="btn btn-success" value="Submit" />
</div>
</form>
@ -304,28 +327,28 @@ if ($total <= $reorder) {
<!-- modal -->
<div class="modal fade" id="addMaterialCaterogyModal" tabindex="-1" aria-labelledby="addMaterialCaterogyModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="addMaterialCaterogyModalLabel">Add Material Category</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form id="addMaterialCategoryForm">
<div class="form-group">
<label for="materialCategoryInput">Material Category</label>
<input type="text" class="form-control" id="materialCategoryInput" placeholder="Enter material category">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" onclick="addMaterialCategory()">Save Category</button>
</div>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="addMaterialCaterogyModalLabel">Add Material Category</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form id="addMaterialCategoryForm">
<div class="form-group">
<label for="materialCategoryInput">Material Category</label>
<input type="text" class="form-control" id="materialCategoryInput" placeholder="Enter material category">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" onclick="addMaterialCategory()">Save Category</button>
</div>
</div>
</div>
</div>
</div>
@ -399,13 +422,14 @@ if ($total <= $reorder) {
return true;
}
$('#editRawMaterialBtnId').click(function(){
$('#editRawMaterialBtnId').click(function() {
var materialName = $('#MaterialName').val();
var materialCode = $('#RMcode').val();
var materialCategory = $('#MaterialCategory').val();
var materialType = $('#MaterialType').val();
if(materialName == ''){
if (materialName == '') {
return;
}
@ -414,9 +438,9 @@ if ($total <= $reorder) {
$('#loader').show();
$.ajax({
data: {
materialCode,
materialName,
materialCategory
materialCode,
materialName,
materialCategory
},
type: "POST",
url: "<?php echo base_url(); ?>materialExist",
@ -424,24 +448,24 @@ if ($total <= $reorder) {
if (data && data.length >= 1) {
$('#loader').hide();
let message = "";
if (data[0]?.IsActive == 1) {
message = "Material name already exists!\n\n";
} else {
message = "Material name already exists in the deleted section!\n\n";
}
let message = "";
if (data[0]?.IsActive == 1) {
message = "Material name already exists!\n\n";
} else {
message = "Material name already exists in the deleted section!\n\n";
}
let related_name = "";
$.each(data, function(i, obj) {
related_name += obj.MaterialCode + " - " + obj.MaterialName + " - " + obj.MaterialType + " - " + obj.CategoryName + "\n";
});
let related_name = "";
$.each(data, function(i, obj) {
related_name += obj.MaterialCode + " - " + obj.MaterialName + " - " + obj.MaterialType + " - " + obj.CategoryName + "\n";
});
message += "'" + materialName + "' - related materials are:\n\n" + related_name;
message += "'" + materialName + "' - related materials are:\n\n" + related_name;
alert(message);
alert(message);
$("#MaterialName").val('');
$("#MaterialName").focus();
$("#MaterialName").val('');
$("#MaterialName").focus();
} else {
$('#loader').hide();
console.log("working")
@ -453,7 +477,7 @@ if ($total <= $reorder) {
$('#loader').hide();
alert("Error Occur");
},
complete: function(){
complete: function() {
$('#loader').hide();
console.log("Ajax completed..!!");
}
@ -464,7 +488,7 @@ if ($total <= $reorder) {
<script>
function addMaterialCategory (){
function addMaterialCategory() {
$('#materialCategoryInput').val()
@ -485,11 +509,9 @@ if ($total <= $reorder) {
<script>
$(document).on('keydown', function(event) {
if (event.key === 'Enter') {
event.preventDefault(); // Prevent default Enter key behavior
}
});
</script>
$(document).on('keydown', function(event) {
if (event.key === 'Enter') {
event.preventDefault(); // Prevent default Enter key behavior
}
});
</script>

View File

@ -1218,21 +1218,21 @@ if (!empty($INRSYMBOL)) {
</div>
<br>
<div class="form-row">
<div class="table-responsive">
<table id="revenueTax" class="table table-striped table-hover mb-0"
<div class="table-responsive" style="padding-bottom: 30px;">
<table id="ServiceTable" class="table table-bordered table-hover mb-0"
style="font-size:12px;">
<thead>
<tr>
<th>SNo</th>
<th>Requisition No</th>
<th>Item Name</th>
<th class="text-center">Quantity</th>
<th>UOM</th>
<th class="text-right">Rate<?php echo "($INRSYM)" ?></th>
<th class="text-right">Basic Amount<?php echo "($INRSYM)" ?></th>
<th class="text-right">Tax Amount<?php echo "($INRSYM)" ?></th>
<th class="text-right">Total Order Amount<?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important;">SNo</th>
<th class="text-center" style="white-space: nowrap !important;">Requisition No</th>
<th style="white-space: nowrap !important;">Item Description</th>
<th class="text-right" style="white-space: nowrap !important;">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th>
<th class="text-right" style="white-space: nowrap !important;">Rate<?php echo "($INRSYM)" ?></th>
<th class="text-right" style="white-space: nowrap !important;">Basic Amount<?php echo "($INRSYM)" ?></th>
<th class="text-right" style="white-space: nowrap !important;">Tax Amount<?php echo "($INRSYM)" ?></th>
<th class="text-right" style="white-space: nowrap !important;">Total Order Amount<?php echo "($INRSYM)" ?></th>
<th>Action</th>
</tr>
</thead>
@ -1248,17 +1248,18 @@ if (!empty($INRSYMBOL)) {
?>
<tr id="<?php echo $index; ?>">
<td align="left"><?php echo $index; ?></td>
<td><?php echo $record->ReqNo ?></td>
<td><?php echo $record->MaterialName ?></td>
<td align="center"><?php echo $record->Quantity ?></td>
<td class="text-center"><?php echo $record->ReqNo ?></td>
<td><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td>
<td class="text-right"><?php echo $record->Quantity ?></td>
<td><?php echo $record->UOM ?></td>
<td align="right"><?php echo $record->Rate ?></td>
<td class="text-right"><?php echo $record->Rate ?></td>
<td align="right">
<td class="text-right">
<?php echo number_format($record->BasicValue, 2, '.', '') ?></td>
<td align="right"><?php echo $record->Taxamount ?></td>
<td align="right"><?php echo $record->TotalValue ?></td>
<td class="text-right"><?php echo $record->Taxamount ?></td>
<td class="text-right"><?php echo $record->TotalValue ?></td>
<input type="hidden" name="<?php echo 'Reqnumber' . $index ?>"
id="<?php echo 'Reqnumber' . $index ?>"
value="<?php echo $record->ReqNo; ?>" />
@ -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);
}
});
}
// }
}
}

View File

@ -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)) {
<thead>
<tr>
<th style="text-align:center !important">SNo</th>
<th style="text-align:center !important">Requisition No</th>
<th style="text-align:center !important">Item Code</th>
<th style="text-align:left !important">Item Description</th>
<th style="text-align:center !important">Line Item Specs</th>
<th style="text-align:center !important">Quantity</th>
<th style="text-align:center !important">UOM</th>
<th style="text-align:right !important">Rate <?php echo "($INRSYM)" ?>
<th style="white-space: nowrap !important; text-align:left !important">SNo</th>
<th style="white-space: nowrap !important; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important; text-align:left !important">Item Code</th>
<th style="white-space: nowrap !important; text-align:left !important">Item Description</th>
<th style="white-space: nowrap !important; text-align:left !important">Line Item Specs</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important; text-align:left !important">UOM</th>
<th style="white-space: nowrap !important; text-align:right !important">Rate <?php echo "($INRSYM)" ?>
</th>
<th style="text-align:right !important">Basic Amount
<th style="white-space: nowrap !important; text-align:right !important">Basic Amount
<?php echo "($INRSYM)" ?>
</th>
<th style="text-align:right !important">Tax Amount
<th style="white-space: nowrap !important; text-align:right !important">Tax Amount
<?php echo "($INRSYM)" ?>
</th>
<th style="text-align:right !important">Total Order Amount
<th style="white-space: nowrap !important; text-align:right !important">Total Order Amount
<?php echo "($INRSYM)" ?>
</th>
<!-- <th>Actual Quantity</th>
<th>Received Quantity</th>
<th>Pending Quantity</th> -->
<th style="text-align:center !important">Action</th>
<th style="white-space: nowrap !important; text-align:left !important">Action</th>
</tr>
</thead>
<tbody id='RevenueAppend'>
@ -2364,11 +2365,12 @@ if (!empty($getlogpodtl)) {
$index = $index + 1;
?>
<tr id="<?php echo $index; ?>">
<td align="center"><?php echo $index; ?></td>
<td align="left"><?php echo $index; ?></td>
<td align="center"><?php echo $record->ReqNo ?></td>
<td align="center"><?php echo $record->MaterialCode ?></td>
<td align="left"><?php echo $record->MaterialName ?></td>
<td>
<td align="left"><?php echo $record->MaterialCode ?></td>
<td align="left"><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td>
<td align="left">
<?php if ($PONOStatus === PO_DRAFT || $PONOStatus === PO_CREATED) { ?>
<a href="#"
class="editable-field"
@ -2382,8 +2384,8 @@ if (!empty($getlogpodtl)) {
</div>
<?php }else{ echo !empty($record->LineitemAuditorNotes) ? $record->LineitemAuditorNotes : "-"; } ?>
</td>
<td align="center"><?php echo $record->Quantity ?></td>
<td align="center"><?php echo $record->UOM ?></td>
<td align="right"><?php echo $record->Quantity ?></td>
<td align="left"><?php echo $record->UOM ?></td>
<td align="right"><?php echo $record->Rate ?></td>
<td align="right">
@ -4477,7 +4479,10 @@ if (!empty($getlogpodtl)) {
});
index = parseInt(index) + 1;
// $PONOStatus == PO_DRAFT || $PONOStatus == PO_CREATED
PONOStatus = <?php echo $PONOStatus; ?>
var PONOStatus = <?php echo '"'.$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 = `
<tr id="${temp}">
<td align="left">${temp}</td>
<td align="left">${Reqnumber}</td>
<td align="center">${Reqnumber}</td>
<td align="left">${materialCode}</td>
<td align="left">${materialName}</td>`;
<td align="left">${shorten}</td>`;
if (PONOStatus === "PO_DRAFT" || PONOStatus === "PO_CREATED") {
rowHtml += `<td><a href="#" class="editable-field"
rowHtml += `<td align="left"><a href="#" class="editable-field"
data-id="${temp}"
data-notes="-">-</a>
<div class="edit-container" style="display:none;">
@ -4515,9 +4520,9 @@ if (!empty($getlogpodtl)) {
<button class="save-btn"></button>
<button class="cancel-btn"></button>
</div></td>`;
}else{ rowHtml += `<td>-</td>`; }
}else{ rowHtml += `<td align="left">-</td>`; }
rowHtml += `
<td align="left">${quantity}</td>
<td align="right">${quantity}</td>
<td align="left">${uom}</td>
<td align="right">${itemRate}</td>
<td align="right">${basicval}</td>
@ -5087,12 +5092,7 @@ if (!empty($getlogpodtl)) {
url: "<?php echo base_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: "<?php echo base_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 () {

View File

@ -1016,18 +1016,18 @@ foreach ($PaymentTerms as $TER) {
<thead>
<tr>
<th>SNo</th>
<th>Requisition No</th>
<th>Item Code</th>
<th>Item Name</th>
<th>Quantity</th>
<th>UOM</th>
<th>Rate<?php echo $INRSYM ?></th>
<th>Basic Amount<?php echo $INRSYM ?></th>
<th>Tax Amount<?php echo $INRSYM ?></th>
<th>Total Order Amount<?php echo $INRSYM ?></th>
<th>Actual Quantity</th>
<th>Received Quantity</th>
<th>Pending Quantity</th>
<th style="white-space: nowrap !important; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important;">Item Code</th>
<th style="white-space: nowrap !important;">Item Description</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th>
<th style="white-space: nowrap !important; text-align:right !important">Rate<?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important; text-align:right !important">Basic Amount<?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important; text-align:right !important">Tax Amount<?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important; text-align:right !important">Total Order Amount<?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important; text-align:right !important">Actual Quantity</th>
<th style="white-space: nowrap !important; text-align:right !important">Received Quantity</th>
<th style="white-space: nowrap !important; text-align:right !important">Pending Quantity</th>
<th>Action</th>
</tr>
</thead>
@ -1053,19 +1053,20 @@ foreach ($PaymentTerms as $TER) {
?>
<tr id="<?php echo $index; ?>">
<td align="left"><?php echo $index; ?></td>
<td><?php echo $record->ReqNo ?> </td>
<td><?php echo $index; ?></td>
<td style="text-align:center !important"><?php echo $record->ReqNo ?> </td>
<td><?php echo $record->MaterialCode ?></td>
<td><?php echo $record->MaterialName ?></td>
<td><?php echo $record->Quantity ?></td>
<td><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td>
<td style="text-align:right !important"><?php echo $record->Quantity ?></td>
<td><?php echo $record->UOM ?></td>
<td><?php echo $record->Rate ?></td>
<td><?php echo number_format($record->BasicValue * $FrequencyNo, 2, '.', ''); ?></td>
<td><?php echo $record->Taxamount ?></td>
<td><?php echo $record->TotalValue ?></td>
<td><?php echo $record->Quantity ?></td>
<td><?php echo $record->ReceivedQuantity ?></td>
<td><?php echo number_format($record->Quantity - $record->ReceivedQuantity, 2, '.', ''); ?></td>
<td style="text-align:right !important"><?php echo $record->Rate ?></td>
<td style="text-align:right !important"><?php echo number_format($record->BasicValue * $FrequencyNo, 2, '.', ''); ?></td>
<td style="text-align:right !important"><?php echo $record->Taxamount ?></td>
<td style="text-align:right !important"><?php echo $record->TotalValue ?></td>
<td style="text-align:right !important"><?php echo $record->Quantity ?></td>
<td style="text-align:right !important"><?php echo $record->ReceivedQuantity ?></td>
<td style="text-align:right !important"><?php echo number_format($record->Quantity - $record->ReceivedQuantity, 2, '.', ''); ?></td>
<input type="hidden" name="<?php echo 'Reqnumber' . $index ?>" id="<?php echo 'Reqnumber' . $index ?>" value="<?php echo $record->ReqNo; ?>" />
@ -2044,14 +2045,8 @@ foreach ($PaymentTerms as $TER) {
type: "POST",
url: "<?php echo base_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 ..!!");
}
});

View File

@ -18,6 +18,11 @@ if (!empty($master)) {
}
}
?>
<style>
.modal-content {
width: 800px ! important;
}
</style>
<div class="content-page">
<div class="content">
@ -149,7 +154,11 @@ if (!empty($master)) {
} ?>">
<td><?php echo $index; ?></td>
<td><?php echo $con->ConfigValue; ?></td>
<?php if($con->Config_ID === 'C023'){ ?>
<td><a class="config-category" data-value="<?php echo $con->ConfigValue;?>" data-key="<?php echo $con->Key; ?>"><?php echo $con->ConfigValue ?></a></td>
<?php }else{ ?>
<td><?php echo $con->ConfigValue; ?></td>
<?php } ?>
<td>
<?php if ($con->isActive == 0) { ?>
@ -308,6 +317,25 @@ if (!empty($master)) {
</div>
</div>
</div>
<!-- Long Content Scroll Modal -->
<div class="modal fade" id="scrollable-modal" tabindex="-1" role="dialog" aria-labelledby="scrollableModalTitle" aria-hidden="true" style="max-width: 100%;">
<div class="modal-dialog modal-dialog-scrollable" role="document" style="max-width: 50%;">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="scrollableModalTitle"></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<!-- Table will be dynamically inserted here -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
</div>
</div>
@ -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: "<?php echo base_url('getPONOcreatedBasedOnConfig'); ?>",
data: { key_id: key_id },
method: 'POST',
dataType: 'json',
success: function (response) {
if (response.length > 0) {
let tableHtml = `
<table class="table table-bordered">
<thead style="background-color: #539754; color: white; font-size: 12px;">
<tr>
<th style="text-align: center;" >PO Number</th>
<th>PO Date</th>
<th style="text-align: center;" >Material Name</th>
<th style="text-align: center;" >PO Type</th>
<th style="text-align: center;" >PO Status</th>
</tr>
</thead>
<tbody>
`;
response.forEach(item => {
tableHtml += `
<tr>
<td class="pono-cell" data-pono="${item.PONO}" data-potype="${item.POType}" data-capitalrange="${item.CapitalRange}" style="cursor: pointer; color: #4d3a6d;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
<u>${item.PONO}</u>
</td>
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">${item.PODate}</td>
<td style="text-align:left; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">${item.MaterialName}</td>
<td style="text-align:left;">${item.POType}</td>
<td style="text-align:left; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">${item.StatusName}</td>
</tr>
`;
});
tableHtml += `
</tbody>
</table>
`;
// 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 = '<?php echo base_url(); ?>EditPO?PONO=' + pono +'&ReqType='+ReqType+'&CapitalRange='+CapitalRange;
window.open(url, '_blank');
// window.location.href = url;
});
} else {
$('#scrollable-modal .modal-body').html('<p>No data found.</p>');
$('#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.");
}
});
});
});
</script>

View File

@ -828,15 +828,15 @@ if (!empty($getlogpodtl)) {
<table id="ImportTax" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead>
<tr>
<th>SNo</th>
<th>Requisition No</th>
<th>Material Code</th>
<th>Description</th>
<th>Line Item Specs</th>
<th>Quantity</th>
<th>UOM</th>
<th>Rate<?php echo $INR ?></th>
<th>Basic Amount<?php echo $INR ?></th>
<th style="white-space: nowrap !important; text-align:left !important">SNo</th>
<th style="white-space: nowrap !important; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important; text-align:left !important">Item Code</th>
<th style="white-space: nowrap !important; text-align:left !important">Item Description</th>
<th style="white-space: nowrap !important; text-align:left !important">Line Item Specs</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important; text-align:left !important">UOM</th>
<th style="white-space: nowrap !important; text-align:right !important">Rate<?php echo "($INR)" ?></th>
<th style="white-space: nowrap !important; text-align:right !important">Basic Amount<?php echo "($INR)" ?></th>
<!-- <th>Received Qty</th>
<th>Rejected Qty</th>
<th>Pending Qty</th> -->
@ -857,10 +857,11 @@ if (!empty($getlogpodtl)) {
?>
<tr id="<?php echo $index; ?>">
<td align="left"><?php echo $index; ?></td>
<td><?php echo $record->ReqNo ?></td>
<td><?php echo $record->MaterialCode ?></td>
<td><?php echo $record->MaterialName ?></td>
<td>
<td align="center"><?php echo $record->ReqNo ?></td>
<td align="left"><?php echo $record->MaterialCode ?></td>
<td align="left"><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td>
<td align="left">
<?php if ($PONOStatus === PO_DRAFT || $PONOStatus === PO_CREATED) { ?>
<a href="#"
class="editable-field"
@ -874,10 +875,10 @@ if (!empty($getlogpodtl)) {
</div>
<?php }else{ echo !empty($record->LineitemAuditorNotes) ? $record->LineitemAuditorNotes : "-"; } ?>
</td>
<td><?php echo $record->Quantity ?></td>
<td><?php echo $record->UOM ?></td>
<td><?php echo $record->Rate ?></td>
<td><?php echo $record->BasicValue ?></td>
<td align="right"><?php echo $record->Quantity ?></td>
<td align="left"><?php echo $record->UOM ?></td>
<td align="right"><?php echo $record->Rate ?></td>
<td align="right"><?php echo $record->BasicValue ?></td>
<!-- <td><?php echo $record->ReceivedQuantity ?></td> -->
<!-- <td><?php echo $record->QuantityRejected ?></td> -->
<!-- <td><?php echo $record->PendingQty ?></td> -->
@ -4279,12 +4280,13 @@ if (!empty($getlogpodtl)) {
//alert('in');
PONOStatus = <?php echo $PONOStatus; ?>
var shorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName;
var rowHtml = `
<tr id="${temp}">
<td align="left">${temp}</td>
<td align="left">${Reqnumber}</td>
<td align="left">${materialCode}</td>
<td align="left">${materialName}</td>`;
<td align="left">${shorten}</td>`;
if (PONOStatus === "PO_DRAFT" || PONOStatus === "PO_CREATED") {
rowHtml += `<td><a href="#" class="editable-field"
data-id="${temp}"
@ -5334,14 +5336,7 @@ if (!empty($getlogpodtl)) {
url: "<?php echo base_url() ?>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);
}
}
});
}
// }
}
}

View File

@ -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 {
<input type="hidden" name="<?php echo 'te' . $index ?>" id="<?php echo 'tes' . $index ?>" value="<?php echo $record->Quantity; ?>" />
<td align="center"><?php echo $record->MaterialCode; ?></td>
<td align="left"><?php echo $record->MaterialName; ?></td>
<td align="center"><?php echo $record->UOM; ?></td>
<td align="center"><?php echo $record->Quantity; ?></td>
<td align="center"><?php echo $record->POQTY; ?></td>
<td align="left"><?php echo $record->UOM; ?></td>
<td align="right"><?php echo $record->Quantity; ?></td>
<td align="right"><?php echo $record->POQTY; ?></td>
<td align="center"><?php echo $record->StatusName; ?></td>
<input type="hidden" name="<?php echo 'materialdesc' . $index ?>" id="<?php echo 'materialdesc' . $index ?>" value="<?php echo isset($record->MaterialDescription) ? $record->MaterialDescription : ''; ?>" />
<td>
@ -818,9 +818,9 @@ td {
<td align="center">${temp}</td>
<td align="center">${materialCode}</td>
<td align="left">${materialName}</td>
<td align="center">${uom}</td>
<td align="center">${quantity}</td>
<td align="center">0.00</td>
<td align="left">${uom}</td>
<td align="right">${quantity}</td>
<td align="right">0.00</td>
<td align="center">NEW</td>
<td>
<a data-id="${temp}" data-userid="${temp}" data-target='#edit-req-modal' data-toggle="modal" href="#edit-req-modal">

View File

@ -135,7 +135,15 @@
} else {
$cdate = date('d-m-Y', strtotime($record->Created_date));
} ?>
<td><a class="a_tag_link" href="<?php echo base_url() . 'employeedetails/ViewEmployee/?EmpID=' . $record->EmpID; ?>" data-toggle="tooltip" title="<?php echo $record->EmpID; ?> - Click here to view Employee details"><?php echo $record->EmpID ?> </a></u></td>
<td><a class="a_tag_link" href="<?php echo base_url() . 'employeedetails/ViewEmployee/?EmpID=' . $record->EmpID; ?>" data-toggle="tooltip" title="<?php echo $record->EmpID; ?> - Click here to view Employee details"><?php echo $record->EmpID ?> </a></u>
<?php if($record->is_driver){ ?>
&nbsp;&nbsp;&nbsp;
<a title="Trip Details" style="cursor:pointer;" href="<?= base_url() . 'loadDriverAttendance?gobal_driver_id=' . $record->EmpID.'&date='.$cdate; ?>">
<i class="fa fa-truck"></i>&nbsp;&nbsp;&nbsp;
</a>
<?php } ?>
</td>
<td><?php echo $record->FirstName; ?></td>
<td><?php echo $record->ContactNumber ?></td>
<td><?php echo $record->Designation ?></td>

View File

@ -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)) {
</div>
</div>
<br />
<div class="form-row">
<table id="ImportTax" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<div class="form-row table-responsive" style="padding-bottom: 30px;">
<table id="ImportTax" class="table table-bordered table-hover mb-0"
style="font-size:12px;">
<thead>
<tr>
<th>SNo</th>
<th>Requisition No</th>
<th>Material Code</th>
<th>Description</th>
<th>Line Item Specs</th>
<th>Quantity</th>
<th>UOM</th>
<th>Rate<?php echo $INR ?></th>
<th>Basic Amount<?php echo $INR ?></th>
<th style="white-space: nowrap !important;">SNo</th>
<th style="white-space: nowrap !important; text-align:right !important">Requisition No</th>
<th style="white-space: nowrap !important;">Item Code</th>
<th style="white-space: nowrap !important;">Item Description</th>
<th style="white-space: nowrap !important;">Line Item Specs</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th>
<th style="white-space: nowrap !important; text-align:right !important">Rate<?php echo "($INR)" ?></th>
<th style="white-space: nowrap !important; text-align:right !important">Basic Amount<?php echo "($INRSYM)" ?></th>
<!-- <th>Received Qty</th> -->
<!-- <th>Rejected Qty</th> -->
<!-- <th>Pending Qty</th> -->
@ -975,30 +982,26 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) {
<div class="form-row">
<div class="form-group col-md-4">
<a class="btn btn-success Save" ID="Save" onclick="Save(0)">
<span class="bold">Save as Draft</span>
</a>
</div>
<div class="form-group col-md-4">
</div>
<div class="form-group col-md-4" align="right">
<div class="form-group col-md-12" align="right">
<input type="hidden" name="txtPoRange" id="txtPoRange" />
<input type="hidden" name="isEdit" id="isEdit" value="0" />
<input type="hidden" name="txtStatus" id="txtStatus" />
<input type="hidden" name="txtRowCount" id="txtRowCount" />
<input type="hidden" name="txtDeletedRow" id="txtDeletedRow" />
<input type="hidden" name="Budget" id="Budget" />
<input type="reset" class="btn btn-success" value="Reset" onclick="window.location.reload()" style="margin-right: 15px;">
<div class="btn-container" style="text-align: right;">
<a class="btn btn-success Submit" ID="Submit" onclick="Save(1)">
<span class="bold">Submit</span>
</a>
<!-- <a class="btn btn-success Save" ID="Cancel" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a> -->
<!-- <input type="reset" class="btn btn-success" value="Reset" onclick="window.location.reload()"> -->
<a class="btn btn-success Save" ID="Cancel" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success Save" ID="Save" onclick="Save(0)">&nbsp;&nbsp;<span class="bold">Save as Draft</span></a>
<a class="btn btn-success Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
</div>
</div>
@ -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 = `
<tr id="${temp}">
<td align="left">${temp}</td>
<td align="left">${Reqnumber}</td>
<td align="left">${materialCode}</td>
<td align="left">${materialName}</td>
<td>
<td style="text-align:left !important">${temp}</td>
<td style="text-align:right !important">${Reqnumber}</td>
<td style="text-align:left !important">${materialCode}</td>
<td style="text-align:left !important">${shorten}</td>
<td style="text-align:left !important">
<a href="#" class="editable-field"
data-notes = "-" data-id ="${temp}">-</a>
<div class="edit-container" style="display:none;">
@ -3529,10 +3533,10 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) {
<button class="cancel-btn"></button>
</div>
</td>
<td align="left">${quantity}</td>
<td align="left">${uom}</td>
<td align="left">${itemRate}</td>
<td align="left">${BasicAmt}</td>
<td style="text-align:right !important">${quantity}</td>
<td style="text-align:left !important">${uom}</td>
<td style="text-align:right !important">${itemRate}</td>
<td style="text-align:right !important">${BasicAmt}</td>
<td>
<a data-target='#editimportpomodel' data-id="${temp}" data-userid="${temp}" data-toggle="modal" href="#editimportpomodel">
<i class="ri-pencil-fill" data-toggle="tooltip"></i>
@ -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);
}
</script>

View File

@ -765,13 +765,13 @@
</a>
<div class="dropdown-menu" aria-labelledby="topnav-hr">
<a href="<?php echo base_url(); ?>employeeListing" class="dropdown-item"><i class="ri-shield-user-line align-middle mr-1"></i> Employee Details</a>
<a href="<?php echo base_url(); ?>DriverListing" class="dropdown-item"><i class="ri-file-settings-line align-middle mr-1"></i> Driver Details</a>
<!-- <a href="<?php echo base_url(); ?>DriverListing" class="dropdown-item"><i class="ri-file-settings-line align-middle mr-1"></i> Driver Details</a> -->
<a href="<?php echo base_url(); ?>attendance" class="dropdown-item"><i class=" ri-time-line align-middle mr-1"></i> Attendance</a>
<div class="dropdown">
<a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-payslip"
role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="ri-secure-payment-line align-middle mr-1"></i> Employee PaySlip <div class="arrow-down"></div>
<i class="ri-secure-payment-line align-middle mr-1"></i> PaySlip <div class="arrow-down"></div>
</a>
<div class="dropdown-menu" aria-labelledby="topnav-payslip">
<a href="<?php echo base_url(); ?>monthlypay" class="dropdown-item">Monthly Pay Information </a>
@ -782,7 +782,7 @@
</div>
</div>
<div class="dropdown">
<!-- <div class="dropdown">
<a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-payslip"
role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="ri-secure-payment-line align-middle mr-1"></i> Driver PaySlip <div class="arrow-down"></div>
@ -791,7 +791,7 @@
<a href="<?php echo base_url(); ?>driverMonthlyPayInputs" class="dropdown-item">Monthly Pay Information </a>
<a href="<?php echo base_url(); ?>driverViewPay" class="dropdown-item">PaySlip Generator</a>
</div>
</div>
</div> -->
<div class="dropdown">
<a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-leave"

View File

@ -23,7 +23,7 @@
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<ol class="breadcrumb mt-2 mb-2.5">
<li class="breadcrumb-item"><a href="javascript: void(0);">Inward</a></li>
<li class="breadcrumb-item active">
<h4 class="page-title">Inward Gate Register</h4>
@ -91,7 +91,7 @@
</div>
<div class="form-group col-md-3">
<label class="col-form-label">Invoice Date<span class="text-danger">*</span></label>
<input class="form-control" data-provide="datepicker" data-date-format="dd-mm-yyyy" data-date-autoclose="true" id="InvoiceDate" name="InvoiceDate" data-date-end-date="<?= date('d-m-Y'); ?>" required autocomplete="off">
<input class="form-control" data-provide="datepicker" data-date-format="dd-mm-yyyy" data-date-autoclose="true" id="InvoiceDate" name="InvoiceDate" data-date-end-date="<?= date('d-m-Y'); ?>" required autocomplete="off" data-date-orientation="bottom">
</div>
@ -99,7 +99,7 @@
<div class="form-group col-md-3">
<label class="col-form-label">Material Received Date<span class="text-danger">*</span></label>
<input class="form-control" data-provide="datepicker" data-date-format="dd-mm-yyyy" data-date-autoclose="true" id="MaterialRcvdDate" name="MaterialRcvdDate" data-date-end-date="<?= date('d-m-Y'); ?>" required autocomplete="off">
<input class="form-control" data-provide="datepicker" data-date-format="dd-mm-yyyy" data-date-autoclose="true" id="MaterialRcvdDate" name="MaterialRcvdDate" data-date-end-date="<?= date('d-m-Y'); ?>" required autocomplete="off" data-date-orientation="bottom">
</div>
<div class="form-group col-md-3">

View File

@ -25,7 +25,7 @@
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<ol class="breadcrumb mt-2 mb-2.5">
<li class="breadcrumb-item"><a href="javascript: void(0);">HR</a></li>
<li class="breadcrumb-item"><a href="javascript: void(0);">Leave</a></li>
<li class="breadcrumb-item active">
@ -46,8 +46,8 @@
<div class="col-12">
<div class="card">
<form action="<?php echo base_url() ?>leavereports" method="POST" id="searchList">
<div class="row">
<div class="col-md-3" style="margin: 10px;">
<div class="row" style="padding: 18px 26px;">
<div class="col-md-3" style="margin: 10px 0px;">
<?php if (!empty($fiscalyears)) {
foreach ($fiscalyears as $fy):
$options[$fy] = $fy;

View File

@ -111,7 +111,7 @@
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<ol class="breadcrumb mt-2 mb-2.5">
<li class="breadcrumb-item"><a href="javascript: void(0);">HR</a></li>
<li class="breadcrumb-item"><a href="javascript: void(0);">PaySlip</a></li>
<li class="breadcrumb-item active">
@ -233,6 +233,7 @@
<th class="celda_encabezado_general">DOJ</th>
<th class="celda_encabezado_general">Designation</th>
<th class="celda_encabezado_general">Total Days</th>
<th class="celda_encabezado_general">Number Of Trips</th>
<th class="celda_encabezado_general">Days Worked</th>
<th class="celda_encabezado_general">LOP Days</th>
<th class="celda_encabezado_general">Paid Leave</th>
@ -264,8 +265,6 @@
if (!empty($sample)) {
$index = 0;
$i = 0;
foreach ($sample as $i => $record) {
@ -296,7 +295,7 @@
</td>
<td style="max-width:80px;text-align:center;"><?php echo $record->NoofDays; ?></td>
<td style="max-width:80px;text-align:center;"><?php echo 0; ?></td>
<td id="dayWork<?php echo $index ?>"
<?php if (empty($record->Key)) {
echo "contenteditable='false';";
@ -353,7 +352,7 @@
} ?>
</td>
<td style="max-width:80px;text-align:right;"><?php echo $record->TotalSalary; ?></td>
<td id="ttlsalary<?php echo $index ?>" style="max-width:80px;text-align:right;"><?php echo $record->TotalSalary; ?></td>
<td style="max-width:80px;text-align:right;">
<?php $perDaySalary = $record->TotalSalary / $record->NoofDays;
@ -496,7 +495,8 @@
<input type="hidden" id="duedate<?php echo $index ?>"
value="<?php echo $record->DueDate ?>">
<input type="hidden" id="is_driver<?php echo $index ?>"
value="<?php echo $record->is_driver ?>">
@ -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);
?>
<tr class="lastvalue">
<td style="text-align:right;" style="background-color:blue;">
<?php echo $inx; ?></td>
<td style="max-width:80px"><?php echo $record->EmpID; ?></td>
<td style="background-color: #d8d8ea;" >
<?php echo $record->FirstName; ?>
</td>
<td style="max-width: 100px;">
<?php
$date = DateTime::createFromFormat('Y-m-d H:i:s', $record->DateofJoining);
$newDateFormat = $date->format('d-m-Y');
echo $newDateFormat;
?>
</td>
<td style="max-width: 150px;overflow: hidden;text-overflow: ellipsis;">
<?php echo $record->Designation; ?>
</td>
<td style="max-width:80px;text-align:center;">
<?php echo $record->total_cal_days; ?>
</td>
<td style="max-width:80px;text-align:center;">
<?php echo $record->no_of_loads." (trip)"; ?>
</td>
<td id="dayWork<?php echo $inx ?>" style="text-align:center;">
<?php echo number_format($record->unique_days, 2, '.', ''); ?>
</td>
<td id="lopDay<?php echo $inx ?>" style="text-align:center;">
<?php echo number_format(0.00, 2, '.', ''); ?>
</td>
<td id="paidLeave<?php echo $inx ?>" style="text-align:center;">
<?php echo number_format(0.00, 2, '.', ''); ?>
</td>
<td id="otHrsWork<?php echo $inx ?>" style="text-align:center;">
<?php echo number_format(0.00, 2, '.', ''); ?>
</td>
<td id="ttlsalary<?php echo $inx ?>" style="max-width:80px;text-align:right;">
<?php echo number_format($sum_of_amount, 2, '.', ''); ?>
</td>
<td style="max-width:80px;text-align:right;">
<?php
$worked_amt = $sum_of_amount / $record->total_cal_days ;
echo number_format($worked_amt, 2, '.', ''); ?>
</td>
<td style="max-width:80px;text-align:right;">
<?php echo number_format($sum_of_amount, 2, '.', ''); ?>
</td>
<td style="max-width:80px;text-align:right;">
<?php $hr_amt = $worked_amt/8;
echo number_format($hr_amt, 2, '.', ''); ?>
</td>
<td style="max-width:80px;text-align:right;">
<!-- $record->driver_salary_amount -->
<?php echo number_format($sum_of_amount, 2, '.', ''); ?>
</td>
<td style="max-width:80px;text-align:right;">
<?php
echo number_format($basic_worked, 2, '.', ''); ?>
</td>
<td style="max-width:80px;text-align:right;">
<?php
echo number_format($hra_worked, 2, '.', ''); ?>
</td>
<td style="max-width:80px;text-align:right;">
<?php echo number_format($basic_worked + $hra_worked, 2, '.', ''); ?>
</td>
<td id="esiAmt<?php echo $inx ?>" style="max-width:80px;text-align:right;"> <?php echo $record->esi_amount; ?> </td>
<td id="pfAmt<?php echo $inx ?>" style="max-width:80px;text-align:right;"> <?php echo $record->pf_amount; ?> </td>
<td style="max-width:80px;text-align:right;">
<?php echo number_format(0.00, 2, '.', ''); ?>
</td>
<td id="monthDue<?php echo $inx ?>" onkeypress="return isNumber(event);" onkeyup="driverchangeInput(event);"
<?php if (empty($record->payroll_id)) { echo "contenteditable='true';"; } ?>
<?php if (!empty($record->payroll_id)) { ?> title="Payslip Calculated"
style="text-align:right;color:blue;"
<?php } else { ?>style="text-align:right;" <?php } ?>>
<?php if (!empty($record->Monthly_Due)) {
echo $record->Monthly_Due;
$totalmonthloan[] = $record->Monthly_Due;
} else {
echo number_format(0.00, 2, '.', '');
} ?>
</td>
<td id="otherDet<?php echo $inx ?>" onkeypress="return isNumber(event);" onkeyup="changeInput(event);" style="text-align:right;">
<?php echo number_format(0.00, 2, '.', ''); ?>
</td>
<!-- <?php $totalotherDet[] = isset($Other_Deductions) ? $Other_Deductions : []; ?> -->
<td id="Festival<?php echo $inx ?>" onkeypress="return isNumber(event);"
onkeyup="driverchangeInput(event);"
<?php if (empty($record->payroll_id)) {
echo "contenteditable='true';";
} ?>
<?php if (!empty($record->payroll_id)) { ?> title="Payslip Calculated"
style="text-align:right;color:blue;"
<?php } else { ?>style="text-align:right;" <?php } ?>>
<?php if (!empty($record->Festival_Bonus)) {
echo $record->Festival_Bonus;
$totalfestival[] = $record->Festival_Bonus;
} else {
echo number_format(0.00, 2, '.', '');;
} ?>
</td>
<?php $totalfestival[] = isset($Festival_Bonus) ? $Festival_Bonus : []; ?>
<td id="empsal<?php echo $inx ?>"
<?php if (empty($record->payroll_id)) {
echo "contenteditable='false';";
} ?>
<?php if (!empty($record->payroll_id)) { ?> title="Payslip Calculated"
style="text-align:right;color:blue;" <?php }else{ ?>style="text-align:right;" <?php } ?>>
<?php if (!empty($record->driver_final_payment)) {
echo $record->driver_final_payment;
$estTotal[] = $record->driver_final_payment;
} else {
echo $empSalary[$i];
$estTotal[] = $empSalary[$i];
}
?>
</td>
<input type="hidden" id="loanatm<?php echo $inx ?>"
value="<?php echo isset($record->Loan_Amount) ? $record->Loan_Amount : 0 ?>">
<input type="hidden" id="paidamt<?php echo $inx ?>"
value="<?php echo $record->Paid_Amount ?>">
<input type="hidden" id="duedate<?php echo $inx ?>"
value="<?php echo $record->DueDate ?>">
<input type="hidden" id="is_driver<?php echo $inx ?>"
value="<?php echo $record->is_driver ?>">
</tr>
<?php }} ?>
</tbody>
<tfoot>
@ -519,7 +685,7 @@
<th></th> <th></th> <th></th> <th></th> <th></th>
<th></th> <th></th> <th></th> <th></th> <th></th>
<th></th> <th></th> <th></th> <th></th> <th></th>
<th>Total</th>
<th></th> <th>Total</th>
<th id="monthloan" style="text-align:right;">
<?php echo isset($totalmonthloan) ? number_format(array_sum($totalmonthloan), 2) : ''; ?>
</th>
@ -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", "<?php echo base_url() ?>payslip/changeMonth");
$("#formid").attr("action", "<?php echo base_url() ?>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()
{

View File

@ -57,16 +57,17 @@ $monthsoptions = array("01" => "Jan", "02" => "Feb", "03" => "Mar", "04" => "Apr
},
type: "POST",
url: "<?php echo base_url(); ?>payslip/checkExistPay",
dataType: "json",
success: function(result) {
if (result != 1) {
if (result['count'] != 1) {
$.ajax({
data: {
payon: payon,
employee: employee
},
type: "POST",
url: "<?php echo base_url(); ?>payslip/callsp",
url: "<?php echo base_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: "<?php echo base_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: "<?php echo base_url(); ?>payslip/callsp",
url: "<?php echo base_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
<option value="-1">Select Employee</option>
</select>
<br />
<input type="checkbox" name="All" id="All"> Select All<br>
<!-- <input type="checkbox" name="All" id="All"> Select All<br> -->
</div>
<div class="col-md-6" align="right">
</div>
<div class="col-md-4 col-md-offset-6" align="right">
<div class="col-md-4 col-md-offset-6" align="right" style="padding-top: 23px;">
<input type="button" class="btn btn-info" id="Calculate" value="Calculate Pay" />
</div>
<div class="row">

View File

@ -519,7 +519,6 @@
<th rowspan="2" style="white-space: nowrap;">
<center><?php _trans('HSN'); ?></center>
</th>
<th rowspan="2" style="white-space: nowrap;"><center><?php _trans('Line Item Specs'); ?></center></th>
<th rowspan="2" style="width: 3.125em; text-align: center; vertical-align: middle;">
<center><?php _trans('Qty'); ?></center>
</th>
@ -581,19 +580,23 @@
<td colspan="2" class="no-border" style="width:12.5em">
<?php if ($POType == REVENUE) {
echo ($item->MaterialCode . ' - ') . ($item->MaterialName . $item->ServiceMaterialDescription);
echo ($item->LineitemAuditorNotes == '-' ? '' : '<br>( ' . $item->LineitemAuditorNotes. ' )</br>');
} ?>
<?php if ($POType == SERVICE) {
echo ($item->MaterialCode . ' - ') . ($item->MaterialName ? $item->MaterialName : $item->ServiceMaterialDescription);
echo ($item->LineitemAuditorNotes == '-' ? '' : '<br>( ' . $item->LineitemAuditorNotes. ' )</br>');
} ?>
<?php if ($POType == IMPORT) {
echo ($item->MaterialCode . ' - ') . ($item->MaterialName);
echo ($item->LineitemAuditorNotes == '-' ? '' : '<br>( ' . $item->LineitemAuditorNotes. ' )</br>');
} ?>
<?php if ($POType == CAPITAL) {
echo ($item->MaterialCode . ' - ') . ($item->MaterialName);
echo ($item->LineitemAuditorNotes == '-' ? '' : '<br>( ' . $item->LineitemAuditorNotes. ' )</br>');
//old -- echo ($item->LineitemAuditorNotes == '-' ? '' : '<hr>'.$item->LineitemAuditorNotes );
} ?>
</td>
<td class="text-right no-border"><?php echo $item->HSNCODE ?? 'N/A'; ?></td>
<td class="text-right no-border"><?php echo $item->LineitemAuditorNotes; ?></td>
<td class="text-right no-border"><?php if ((int)$item->Quantity > 0) {
echo number_alignment($item->Quantity);
if ($item->Per) : ?>
@ -658,14 +661,13 @@
<td class="text-right no-border"></td>
<td class="text-right no-border"></td>
<td class="text-right no-border"></td>
<td class="text-right no-border"></td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<tr>&nbsp;
<td style="text-align: right;" colspan="7"><strong>&nbsp;TOTAL</strong></td>
<td style="text-align: right;" colspan="6"><strong>&nbsp;TOTAL</strong></td>
<td class="text-right"><?php echo number_alignment(abs(array_sum($basic))); ?></td>
<td>&nbsp;</td>
<td class="text-right"><?php if ($cgst) {

View File

@ -128,6 +128,7 @@ if (empty($Status)) {
</thead>
<tbody>
<?php
if (!empty($AppList)) {
$index = 0;
foreach ($AppList as $record) {
@ -154,8 +155,7 @@ if (empty($Status)) {
<td><?php echo $record->TotalOrderValue ?></td>
<td><?php echo $record->Approver ?></td>
<td><?php if($record->StatusCode == "ST026"){ echo $record->Releaser; } ?></td>
<td>
<?php
$statusMappings = [
@ -182,7 +182,7 @@ if (empty($Status)) {
<?php if(session()->get('roleText') == 'System Administrator'){?>
<td>
<?php if ($record->StatusCode == PO_APPROVER_ONHOLD or $record->StatusCode == PO_CREATED or $record->StatusCode == REQITEM_Emergency_PO_CREATED) { ?>
<?php if ($record->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) { ?>
<select

View File

@ -13,8 +13,9 @@
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<div class="page-title-right"> <!-- style="margin: 15px 0;" -->
<!-- <ol class="breadcrumb mt-0"> -->
<ol class="breadcrumb mt-2 mb-2.5">
<li class="breadcrumb-item"><a href="javascript: void(0);">HR</a></li>
<li class="breadcrumb-item"><a href="javascript: void(0);">Leave</a></li>
<li class="breadcrumb-item active">
@ -22,14 +23,13 @@
</li>
</ol>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="row" style="padding-left: 26px;">
<div class="row" style="padding: 18px 26px;">
<div class="col-md-3">
<span>Holiday Name : </span>
<input type="text" name="hname" id="hname" class="form-control">

View File

@ -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 = '<?php echo 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)) {
<!-- Table -->
<div class="form-row">
<div class="table-responsive" style="padding-bottom: 30px;">
<table id="revenueTax" class="table table-striped table-hover mb-0" style="font-size:12px;">
<table id="revenueTax" class="table nowrap table-bordered table-hover mb-0" style="font-size:12px;">
<thead>
<tr>
<th>SNo</th>
<th>Requisition No</th>
<th>Item Code</th>
<th>Item Description</th>
<th>Line Item Specs</th>
<th>Quantity</th>
<th>UOM</th>
<th>Rate <?php echo "($INRSYM)" ?></th>
<th>Basic Amount <?php echo "($INRSYM)" ?></th>
<th>Tax Amount <?php echo "($INRSYM)" ?></th>
<th>Total Order Amount <?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important;">SNo</th>
<th style="white-space: nowrap !important; text-align:left !important">Requisition No</th>
<th style="white-space: nowrap !important;">Item Code</th>
<th style="white-space: nowrap !important;">Item Description</th>
<th style="white-space: nowrap !important;">Line Item Specs</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th>
<th style="white-space: nowrap !important; text-align:right !important">Rate<?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important; text-align:right !important">Basic Amount<?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important; text-align:right !important">Tax Amount<?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important; text-align:right !important">Total Order Amount<?php echo "($INRSYM)" ?></th>
<th>Action</th>
</tr>
</thead>
@ -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 = `
<tr id="${temp}">
<td align="left">${temp}</td>
<td align="left">${Reqnumber}</td>
<td align="left">${materialCode}</td>
<td align="left">${materialName}</td>
<td>
<td style="text-align:left !important">${temp}</td>
<td style="text-align:left !important">${Reqnumber}</td>
<td style="text-align:left !important">${materialCode}</td>
<td style="text-align:left !important">${shorten}</td>
<td style="text-align:left !important">
<a href="#" class="editable-field"
data-notes = "-" data-id ="${temp}">-</a>
<div class="edit-container" style="display:none;">
@ -3471,12 +3475,12 @@ if (!empty($INRSYMBOL)) {
<button class="cancel-btn"></button>
</div>
</td>
<td align="right">${quantity}</td>
<td align="left">${uom}</td>
<td align="right">${itemRate}</td>
<td align="right">${basicval}</td>
<td align="right">${TotalTaxValue}</td>
<td align="right">${TotalOrderValue}</td>
<td style="text-align:right !important">${quantity}</td>
<td style="text-align:left !important">${uom}</td>
<td style="text-align:right !important">${itemRate}</td>
<td style="text-align:right !important">${basicval}</td>
<td style="text-align:right !important">${TotalTaxValue}</td>
<td style="text-align:right !important">${TotalOrderValue}</td>
<td>
<a data-target='#EDITREVENUE' data-id="${temp}" data-userid="${temp}" data-toggle="modal" href="#EDITREVENUE">
<i class="ri-pencil-fill" data-toggle="tooltip"></i>
@ -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: "<?php echo base_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');
});
}
</script>

View File

@ -144,8 +144,8 @@ if (!empty($Emp)) {
<th class="th">Material Code</th>
<th class="th" style="text-align:left !important;">Material Name</th>
<th class="th">Material Category</th>
<th class="th">Uom</th>
<th class="th">Quantity</th>
<th class="th" style="text-align:left !important;">Uom</th>
<th class="th" style="text-align:right !important;">Quantity</th>
<th class="th">Action</th>
</tr>
</thead>
@ -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)) {
</script>
<script>
function validate() {
if ($("option:selected", $("#RequestType")).val() == '-1') {
alert('Please Select Request Type ');
return false;
} else if ($("option:selected", $("#EmpID")).val() == '-1') {
if ($("option:selected", $("#EmpID")).val() == '-1') {
alert('Please Select Request by');
return false;
}
else if ($("option:selected", $("#RequestType")).val() == '-1') {
alert('Please Select Request Type ');
return false;
} else if ($("#txtRowCount").val().length < 1) {
alert('Please Add Line Item');
return false;
@ -680,8 +684,8 @@ if (!empty($Emp)) {
<td align="center">${materialCode}</td>
<td align="left">${materialName}</td>
<td align="center">${categoryName}</td>
<td align="center">${uom}</td>
<td align="center">${quantity}</td>
<td align="left">${uom}</td>
<td align="right">${quantity}</td>
<td align="center">
<a
data-id="${temp}"

View File

@ -176,9 +176,9 @@ if (!empty($Status)) {
href="<?php echo base_url() . 'EditRequisitionForm?ReqNo=' . $record->ReqNo . '&ReqType=' . $record->ReqType; ?>"><i
class="fas fa-pencil-alt" data-toggle="tooltip"
title="<?php echo $record->ReqNo; ?> - Click here to view Requisition details"></i>&nbsp;&nbsp;&nbsp;</a>
<a data-toggle="tooltip" onclick="DeleteRow('<?php echo $record->ReqNo; ?>' )"><span
class="fas fa-trash"
title="<?php echo $record->ReqNo; ?> - Click here to Delete Requisition details"></span></a>
<a data-toggle="tooltip" href="#" onclick="DeleteRow('<?php echo $record->ReqNo; ?>' )"><i
class="fas fa-trash" data-toggle="tooltip"
title="<?php echo $record->ReqNo; ?> - Click here to Delete Requisition details"></i>&nbsp;&nbsp;&nbsp;</a>
</td>
</tr>

View File

@ -78,8 +78,7 @@
const LineItemNoteForAuditor = $link.data('notes');
const id = $link.data('id');
var theForm = $(".ServicePO");
addHidden(theForm, "LineItemNoteForAuditor" + id, value);
$("#LineItemNoteForAuditor" + id).val(value);
$link.text(value).show();
$editContainer.hide();
});
@ -240,20 +239,21 @@ if (!empty($INRSYMBOL)) {
});
// Conditional logic for PaymentID
if (PaymentID === 'PT08') {
$('#otheroptiondiv').show();
$('#Otherpayment').val('');
} else {
if (PaymentID != 'PT08') {
$('#otheroptiondiv').hide();
$('#Otherpayment').prop('required', false);
$('#Otherpayment').val('');
} else if (PaymentID == 'PT08') {
$('#otheroptiondiv').show();
$('#Otherpayment').prop('required', true);
}
// Populate Payment Terms
var Payment = <?php echo json_encode($Payment, JSON_PRETTY_PRINT) ?>;
$('#PaymentTerms').empty();
$.each(payments, function(pay, payobj) {
$("#PaymentTerms").append($('<option></option>').val(payobj.PaymentID).html(payobj.PaymentTerms));
$.each(Payment, function(idx, obj) {
$("#PaymentTerms").append($('<option></option>').val(obj.PaymentID).html(obj.PaymentTerms));
});
$("#PaymentTerms").val(PaymentID);
} else {
alert('Please select a Supplier.');
return false;
@ -360,6 +360,7 @@ if (!empty($INRSYMBOL)) {
$("#ItemName").val(obj.MaterialName);
$("#UOM").val(obj.UOM);
$("#Quantity").val(obj.Quantity);
$("#Rate").val(obj.material_rate);
RequistQuantity = obj.Quantity;
var materialn = obj.MaterialName;
var materialname = materialn.toUpperCase();
@ -410,6 +411,7 @@ if (!empty($INRSYMBOL)) {
$("#EditItemName").val(obj.MaterialName);
$("#EditUOM").val(obj.UOM);
$("#EditQuantity").val(obj.Quantity);
$("#EditRate").val(obj.material_rate);
RequistQuantity = obj.Quantity;
}
});
@ -1045,20 +1047,20 @@ if (!empty($INRSYMBOL)) {
</div><!-- 6. form-row div closed here -->
<div class="form-row">
<div class="table-responsive" style="padding-bottom: 30px;">
<table id="serviceTax" class="table table-striped table-hover mb-0" style="font-size:12px;">
<table id="serviceTax" class="table table-bordered table-hover mb-0" style="font-size:12px;">
<thead>
<tr>
<th>SNo</th>
<th>Requisition No</th>
<th>Item Code</th>
<th>Item Name</th>
<th>Line Item Specs</th>
<th>Quantity</th>
<th>UOM</th>
<th>Rate <?php echo "($INRSYM)" ?></th>
<th>Basic Amount <?php echo "($INRSYM)" ?></th>
<th>Tax Amount <?php echo "($INRSYM)" ?></th>
<th>Total Order Amount <?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important;">SNo</th>
<th style="white-space: nowrap !important; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important;">Item Code</th>
<th style="white-space: nowrap !important;">Item Description</th>
<th style="white-space: nowrap !important;">Line Item Specs</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th>
<th style="white-space: nowrap !important; text-align:right !important">Rate <?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important; text-align:right !important">Basic Amount <?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important; text-align:right !important">Tax Amount <?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important; text-align:right !important">Total Order Amount <?php echo "($INRSYM)" ?></th>
<th>Action</th>
</tr>
</thead>
@ -1975,13 +1977,13 @@ if (!empty($INRSYMBOL)) {
// Taxvalue: TotalTaxValue,
// TotalValue: TotalOrderValue
// }));
var shorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName;
var rowHtml = `
<tr id="${temp}">
<td align="left">${temp}</td>
<td align="left">${Reqnumber}</td>
<td align="left">${materialCode}</td>
<td align="left">${materialName}</td>
<td>${temp}</td>
<td style="text-align:center !important">${Reqnumber}</td>
<td>${materialCode}</td>
<td>${shorten}</td>
<td>
<a href="#" class="editable-field"
data-notes = "-" data-id ="${temp}">-</a>
@ -1991,12 +1993,12 @@ if (!empty($INRSYMBOL)) {
<button class="cancel-btn"></button>
</div>
</td>
<td align="left">${quantity}</td>
<td align="left">${uom}</td>
<td align="left">${itemRate}</td>
<td align="left">${basicval}</td>
<td align="left">${TotalTaxValue}</td>
<td align="left">${TotalOrderValue}</td>
<td style="text-align:right !important">${quantity}</td>
<td>${uom}</td>
<td style="text-align:right !important">${itemRate}</td>
<td style="text-align:right !important">${basicval}</td>
<td style="text-align:right !important">${TotalTaxValue}</td>
<td style="text-align:right !important">${TotalOrderValue}</td>
<td>
<a data-target='#EDITSERVICE' data-id="${temp}" data-userid="${temp}" data-toggle="modal" href="#EDITSERVICE">
<i class="ri-pencil-fill" data-toggle="tooltip"></i>
@ -2377,33 +2379,30 @@ if (!empty($INRSYMBOL)) {
$('#txtStatus').val(stat);
var AvlBudAmt = '<?php echo $AvlAmount ?>';
var txtTotalOrderValueSummary = $('#txtTotBasicAmount').val();
if (validate()) {
if (document.getElementById('serviceTax').rows.length < 2) {
alert('Please Select Line item to Create PO');
$('#Deliverydt').focus();
return false;
}
// else if(parseInt(AvlBudAmt) < parseInt(txtTotalOrderValueSummary)) {
if (serviceValidate()) {
// if (document.getElementById('serviceTax').rows.length < 2) {
// alert('Please Select Line item to Create PO');
// 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 Other Payable Terms Description');
$('#Otherpayment').focus();
return false;
} else if ($('#descofpo').val().trim() == '') {
alert('Please Enter Description Of Service');
$('#descofpo').focus();
return false;
} else if ($('#PoTypeOptions').val() == "0") {
alert('Please Select POType');
$('#PoTypeOptions').focus();
return false;
} else {
// }
// else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') {
// alert('Please Enter Other Payable Terms Description');
// $('#Otherpayment').focus();
// return false;
// } else if ($('#descofpo').val().trim() == '') {
// alert('Please Enter Description Of Service');
// $('#descofpo').focus();
// return false;
// } else if ($('#PoTypeOptions').val() == "0") {
// alert('Please Select POType');
// $('#PoTypeOptions').focus();
// return false;
// } else {
var formData = new FormData($('.ServicePO')[0]);
disableButtons();
console.log("inside add service purchase order view page");
console.log(formData);
@ -2423,15 +2422,21 @@ 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);
}
});
}
// }
}
}
@ -2455,45 +2460,58 @@ 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 ($('#workstatus').val() == "0") {
alert('Please Select the Work Status');
$('#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 ($('#workstatus').val() == "0") {
alert('Please Enter WorkStatus');
$('#workstatus').focus();
return false;
} else if ($('#PoTypeOptions').val() == "0") {
alert('Please Select POType');
$('#PoTypeOptions').focus();
return false;
} else if ($('#Otherpayment').val() == '' && $('#PaymentTerms').val() == 'PT08') {
alert('Please Enter Other Payable Terms Description');
$('#Otherpayment').focus();
return false;
} else {
return true;
}
}else if($('#PODate').val() == ''){
alert('Please Enter the Purchase Order date');
$('#PODate').focus();
return false;
}else if ($('#PoTypeOptions').val() == "0") {
alert('Please Select Service Type');
$('#PoTypeOptions').focus();
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().trim() == ''){
alert('Please Enter the Insurance No / Insurance Details');
$('#InsuranceNumber').focus();
return false;
}else if ($('#BudgetType').val() == "0") {
alert('Please Select Budget Type');
$('#BudgetType').focus();
return false;
}else {
return true;
}
}
function calculateCgstTax(varBasicValue, Cgst) {
@ -2566,9 +2584,14 @@ if (!empty($INRSYMBOL)) {
function Reset() {
disableButtons();
location.reload();
setTimeout(function() {
enableButtons();
}, 2000);
}
$('#insuranceTxtDiv').hide();
$("#insuranceStatus").change(function() {

View File

@ -256,7 +256,7 @@
</ol>
</div>
<div>
<div>
<!-- <button type="button" class="btn btn-danger" data-target="#productionBatchCardDetailModalId"
data-toggle="modal">
@ -333,19 +333,19 @@
<thead>
<tr>
<th class="celda_encabezado_general" style="padding: 10px;">Date</th>
<th class="celda_encabezado_general" style="padding: 10px;">Shift</th>
<th class="celda_encabezado_general" style="padding: 10px;">Machine On Time</th>
<th class="celda_encabezado_general" style="padding: 10px;">Machine Off Time</th>
<th class="celda_encabezado_general" style="padding: 10px;">Machine Running(hr)</th>
<th class="celda_encabezado_general" style="padding: 10px;">Customer Name</th>
<th class="celda_encabezado_general" style="padding: 10px;">Grade</th>
<th class="celda_encabezado_general" style="padding: 10px;">Total Coating</th>
<th class="celda_encabezado_general" style="padding: 10px;">Total Coating Sand(kg)</th>
<th class="celda_encabezado_general" style="padding: 10px;">Total Gas Consumption</th>
<th class="celda_encabezado_general" style="padding: 10px;">Hour Gas</th>
<th class="celda_encabezado_general" style="padding: 10px;">Hour QTY(kg)</th>
<th class="celda_encabezado_general" style="padding: 10px;">Action</th>
<th class="celda_encabezado_general" >Date</th>
<th class="celda_encabezado_general" >Shift</th>
<th class="celda_encabezado_general" >Machine On Time</th>
<th class="celda_encabezado_general" >Machine Off Time</th>
<th class="celda_encabezado_general" >Machine Running(hr)</th>
<th class="celda_encabezado_general" >Customer Name</th>
<th class="celda_encabezado_general" >Grade</th>
<th class="celda_encabezado_general" >Total Coating</th>
<th class="celda_encabezado_general" >Total Coating Sand(kg)</th>
<th class="celda_encabezado_general" >Total Gas Consumption</th>
<th class="celda_encabezado_general" >Hour Gas</th>
<th class="celda_encabezado_general" >Hour QTY(kg)</th>
<th class="celda_encabezado_general" >Action</th>
</tr>
</thead>
<tbody>
@ -462,17 +462,17 @@
<th class="celda_encabezado_total"
style="padding: 10px; background-color:#ffff;"> Date </th>
<th class="celda_encabezado_total" style="padding: 10px;">Shift</th>
<th class="celda_encabezado_total" style="padding: 10px;">Machine On Time</th>
<th class="celda_encabezado_total" style="padding: 10px;">Machine Off Time</th>
<th class="celda_encabezado_total" style="padding: 10px;">Machine Running(hr)</th>
<th class="celda_encabezado_total" style="padding: 10px;">Customer Name </th>
<th class="celda_encabezado_total" style="padding: 10px;">Grade</th>
<th class="celda_encabezado_total" style="padding: 10px;">Total Coating</th>
<th class="celda_encabezado_total" style="padding: 10px;">Total Coating Sand(kg)</th>
<th class="celda_encabezado_total" style="padding: 10px;">Total Gas Consumption</th>
<th class="celda_encabezado_total" style="padding: 10px;">Hour Gas</th>
<th class="celda_encabezado_total" style="padding: 10px;">Hour QTY(kg)</th>
<th class="celda_encabezado_total" >Shift</th>
<th class="celda_encabezado_total" >Machine On Time</th>
<th class="celda_encabezado_total" >Machine Off Time</th>
<th class="celda_encabezado_total" >Machine Running(hr)</th>
<th class="celda_encabezado_total" >Customer Name </th>
<th class="celda_encabezado_total" >Grade</th>
<th class="celda_encabezado_total" >Total Coating</th>
<th class="celda_encabezado_total" >Total Coating Sand(kg)</th>
<th class="celda_encabezado_total" >Total Gas Consumption</th>
<th class="celda_encabezado_total" >Hour Gas</th>
<th class="celda_encabezado_total" >Hour QTY(kg)</th>
</thead>
<tbody>
@ -1269,7 +1269,6 @@
var perHourCoatingSandQTY = row.find('td:eq(11)').text();
var batchCards = row.find('td:eq(13)').text().trim();
console.log(batchCards);
JSON.parse(batchCards).map(element => {

View File

@ -704,6 +704,7 @@ foreach ($period as $day) {
<?php
// dd($previousMonthDieselMachineStockDetails);
foreach ($dieselMachines as $dieselMachineIndex => $dieselMachine) {
?>
<!-- this will loop till machines present -->
@ -731,16 +732,18 @@ foreach ($period as $day) {
><?= !empty($previousMonthDieselMachineStockDetails)
><?= (!empty($previousMonthDieselMachineStockDetails) && isset($previousMonthDieselMachineStockDetails[$dieselMachineIndex]) )
? $previousMonthDieselMachineStockDetails[$dieselMachineIndex]['closing_reading']
:" " ;
?>
?>
</td>
<td class="celda_normal closingReading"
data-id="<?= $dateInMonth ?> <?= $dieselMachine['id'] ?>"
oninput="closingReadingChange(this)"
contenteditable="true"><?= !empty($previousMonthDieselMachineStockDetails)
contenteditable="true">
<?= !empty($previousMonthDieselMachineStockDetails) && isset($previousMonthDieselMachineStockDetails[$dieselMachineIndex])
? $previousMonthDieselMachineStockDetails[$dieselMachineIndex]['closing_reading']
:" " ;
?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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;*/
/* <!-- ad9271 into ffffff brown-light to green-light --> */
@ -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;
}
</style>
@ -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">
</div>
<div class="form-group col-md-2">
<div class="form-group col-md-3">
<button type="submit" class="btn btn-success"> Change Month </button>
<button type="button" class="btn" style="background-color:maroon;color:white" data-target="#customizeModalId"
data-toggle="modal">
Customize
</button>
</div>
<div class="col-md-1"></div>
<div class="col-6">
<div class="dropdown float-right">
<a href="#" class="dropdown-toggle arrow-none" data-toggle="dropdown"
@ -354,9 +371,9 @@ foreach ($period as $day) {
<?php if (!empty($groupedResinStockDetails)) {
$summary = [];
$summary = [];
foreach ($groupedResinStockDetails as $groupedResinStockDetailsIndex => $resinStockDetails) {
?>
@ -370,9 +387,9 @@ foreach ($period as $day) {
echo 'style="background: #cef0ad;"';
}
?>>
<?php foreach ($resinStockDetails as $resinStockIndex => $resinStock) {
?>
<?php foreach ($resinStockDetails as $resinStockIndex => $resinStock) {
?>
<?php if ($resinStockIndex == 0): ?>
<?php
$startDate = DateTime::createFromFormat('Y-m-d', $resinStock['date'])->format('d-m-Y');
@ -424,32 +441,31 @@ foreach ($period as $day) {
<?= $resinStock['balanceStock'] ?? ' ' ?>
</td>
<?php
//before closing inner loop we just adding the total values insidde it
$materialCode = $resinStock['materialCode']; // Unique identifier
//before closing inner loop we just adding the total values insidde it
// Initialize the material entry if it doesn't exist
if (!isset($summary[$materialCode])) {
$summary[$materialCode] = [
'opening' => "-" ,
'receipt' => 0,
'used' => 0,
'balanceStock' => 0,
];
}
$materialCode = $resinStock['materialCode']; // Unique identifier
// Sum values for the material
;
$summary[$materialCode]['opening'] = "-" ;
$summary[$materialCode]['receipt'] += is_numeric($resinStock['receipt']) ? $resinStock['receipt'] : 0;
$summary[$materialCode]['used'] += is_numeric($resinStock['used']) ? $resinStock['used'] : 0;
$summary[$materialCode]['balanceStock'] = is_numeric($resinStock['balanceStock']) ? $resinStock['balanceStock'] : 0;
// Initialize the material entry if it doesn't exist
if (!isset($summary[$materialCode])) {
$summary[$materialCode] = [
'opening' => "-",
'receipt' => 0,
'used' => 0,
'balanceStock' => 0,
];
}
} ?>
// Sum values for the material
;
$summary[$materialCode]['opening'] = "-";
$summary[$materialCode]['receipt'] += is_numeric($resinStock['receipt']) ? $resinStock['receipt'] : 0;
$summary[$materialCode]['used'] += is_numeric($resinStock['used']) ? $resinStock['used'] : 0;
$summary[$materialCode]['balanceStock'] = is_numeric($resinStock['balanceStock']) ? $resinStock['balanceStock'] : 0;
} ?>
</tr>
@ -457,41 +473,41 @@ foreach ($period as $day) {
<div class="table-responsive">
<table id="resinStockDetailsTableSummaryId" class="fht-table table-striped">
<table id="resinStockDetailsTableSummaryId" class="fht-table table-striped">
<thead >
<th class="celda_encabezado_total">Total Sum</th>
<?php foreach($summary as $each){ ?>
<th class="celda_encabezado_total">Opening Stock</th>
<th class="celda_encabezado_total">Receipt</th>
<th class="celda_encabezado_total">Used</th>
<th class="celda_encabezado_total">Balance Stock</th>
<?php } ?>
</thead>
<tbody>
<thead>
<th class="celda_encabezado_total">Total Sum</th>
<?php foreach ($summary as $each) { ?>
<th class="celda_encabezado_total">Opening Stock</th>
<th class="celda_encabezado_total">Receipt</th>
<th class="celda_encabezado_total">Used</th>
<th class="celda_encabezado_total">Balance Stock</th>
<?php } ?>
</thead>
<tr>
<tbody>
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
<b> Total </b>
</td>
<tr>
<?php foreach($summary as $each){ ?>
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
<b> Total </b>
</td>
<td class="celda_normal "><?=$each['opening']?></td>
<td class="celda_normal "><?=$each['receipt']?></td>
<td class="celda_normal "><?=$each['used']?></td>
<td class="celda_normal "><?=$each['balanceStock']?></td>
<?php foreach ($summary as $each) { ?>
<?php } ?>
</tr>
<td class="celda_normal "><?= $each['opening'] ?></td>
<td class="celda_normal "><?= $each['receipt'] ?></td>
<td class="celda_normal "><?= $each['used'] ?></td>
<td class="celda_normal "><?= $each['balanceStock'] ?></td>
</tbody>
</table>
<?php } ?>
</tr>
</tbody>
</table>
</div>
<!-- this else condition work if groupedBagStockDetails is empty and creating new records
@ -511,6 +527,7 @@ foreach ($period as $day) {
}
?>>
<?php
// dd($resinMaterials);
foreach ($resinMaterials as $resinMaterialIndex => $resinMaterial) { ?>
<!-- this will loop till materials present -->
@ -639,6 +656,86 @@ foreach ($period as $day) {
<!---------------------------------------
this modal is used to customize table header
1)list table header order
2)choose which material/machines you want
------------------------------------------------------------>
<div>
<div class="modal fade" id="customizeModalId" tabindex="-1" role="dialog" aria-labelledby="customizeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="customizeModalLabel">Customize</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="row">
<!-- Dropdown to add back removed items -->
<div class="col">
<div class="form-group">
<label for="customizeHeader"> Add For This Month </label>
<select id="customizeHeader" class="form-control" onchange="addBackToList()">
<option value="">Select</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col">
<h5>List of Selected Items</h5>
<div id="selectedItemsContainer">
<ul id="sortableList">
<?php foreach ($resinMaterials as $resinMaterial): ?>
<div class="sortable-item" draggable="true" id="<?= $resinMaterial['MaterialCode'] ?>_container">
<input type="checkbox"
id="<?= $resinMaterial['MaterialCode'] ?>_checkboxId"
name="materialCodes[]"
value="<?= $resinMaterial['MaterialCode'] ?>"
onclick="removeSelectedMaterial(this)"
checked>
<label class="grab" for="<?= $resinMaterial['MaterialCode'] ?>_checkboxId">
<?= $resinMaterial['MaterialName']; ?>
</label>
<br>
</div>
<?php endforeach; ?>
</ul>
</div>
</div>
</div>
<button type="button" class="btn btn-primary float-right"> Apply </button>
</div>
</div>
</div>
</div>
</div>
<!-- modal section ends -->
<script>
function navigateToResin() {
@ -816,7 +913,7 @@ foreach ($period as $day) {
}
function receiptStockChange(tdElement) {
try {
try {
let dataId = tdElement.getAttribute('data-id');
let [date, materialCode] = tdElement.getAttribute('data-id').split(' ');
let openingStock = validateInput(document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText);
@ -844,7 +941,7 @@ foreach ($period as $day) {
let [date, materialCode] = tdElement.getAttribute('data-id').split(' ');
let openingStock = validateInput(document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText);
let receiptStock = validateInput(document.querySelector(`td.receiptStock[data-id="${dataId}"]`).innerText);
let usedStock = validateInput(tdElement.innerText);
let usedStock = validateInput(tdElement.innerText);
let currentBalanceStock = (Number(openingStock) + Number(receiptStock)) - Number(usedStock);
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock;
@ -880,8 +977,6 @@ foreach ($period as $day) {
return input;
}
</script>
<script>
@ -920,20 +1015,19 @@ foreach ($period as $day) {
<script>
$(document).ready(function(){
$(document).ready(function() {
function exportTableToExcel(tableID, filename = '') {
let table = document.getElementById(tableID);
let cloneTable = table.cloneNode(true); // Clone the table to modify
// Remove hidden rows
$(cloneTable).find('tr').filter(function () {
$(cloneTable).find('tr').filter(function() {
return $(this).css('display') === 'none';
}).remove();
// Remove hidden columns
$(cloneTable).find('th, td').each(function () {
$(cloneTable).find('th, td').each(function() {
if ($(this).css('display') === 'none') {
$(this).remove();
}
@ -947,53 +1041,139 @@ foreach ($period as $day) {
let tableId = 'resinStockDetailsTableId';
document.getElementById('resinStockExport').addEventListener('click',function(){
document.getElementById('resinStockExport').addEventListener('click', function() {
exportTableToExcel(tableId,'Resin_Stock_Details<?=$month?>.xlsx');
exportTableToExcel(tableId, 'Resin_Stock_Details<?= $month ?>.xlsx');
})
})
})
</script>
<script>
document.addEventListener("keydown", function (event) {
document.addEventListener("keydown", function(event) {
if (event.key === "Enter") {
if (event.key === "Enter") {
let activeElement = document.activeElement;
let activeElement = document.activeElement;
// Check if the focused element is inside a table
let cell = activeElement.closest("td, th");
let table = activeElement.closest("table");
// Check if the focused element is inside a table
let cell = activeElement.closest("td, th");
let table = activeElement.closest("table");
if (table && cell) {
event.preventDefault(); // Prevent form submission
if (table && cell) {
event.preventDefault(); // Prevent form submission
let columnIndex = cell.cellIndex; // Get the current column index
let columnIndex = cell.cellIndex; // Get the current column index
let currentRow = cell.parentElement; // Get the current row
let nextRow = currentRow.nextElementSibling; // Get the next row
let currentRow = cell.parentElement; // Get the current row
// Move to the same column in the next row if available
if (nextRow) {
let nextRow = currentRow.nextElementSibling; // Get the next row
let nextCell = nextRow.cells[columnIndex];
if (nextCell) {
// Move to the same column in the next row if available
if (nextRow) {
nextCell.focus();
let nextCell = nextRow.cells[columnIndex];
if (nextCell) {
nextCell.focus();
}
}
}
}
});
</script>
<script>
document.addEventListener("DOMContentLoaded", function () {
const list = document.getElementById("sortableList");
let draggedItem = null;
function attachDragEvents(item) {
item.setAttribute("draggable", "true");
item.addEventListener("dragstart", (event) => {
draggedItem = event.target;
event.target.classList.add("dragging");
});
item.addEventListener("dragend", (event) => {
event.target.classList.remove("dragging");
});
}
list.addEventListener("dragover", (event) => {
event.preventDefault(); // Allow dropping
const dragging = document.querySelector(".dragging");
const closestItem = getClosestItem(list, event.clientY);
if (closestItem) {
list.insertBefore(dragging, closestItem);
} else {
list.appendChild(dragging);
}
});
function getClosestItem(container, y) {
const items = [...container.querySelectorAll(".sortable-item:not(.dragging)")];
return items.reduce((closest, child) => {
const box = child.getBoundingClientRect();
const offset = y - box.top - box.height / 2;
return offset < 0 && offset > closest.offset
? { offset, element: child }
: closest;
}, { offset: Number.NEGATIVE_INFINITY }).element;
}
// Attach drag events to existing items
document.querySelectorAll(".sortable-item").forEach(attachDragEvents);
window.removeSelectedMaterial = function (checkbox) {
let container = checkbox.closest(".sortable-item");
let materialCode = checkbox.value;
let materialName = container.querySelector("label").innerText;
let dropdown = document.getElementById("customizeHeader");
let newOption = document.createElement("option");
newOption.value = materialCode;
newOption.text = materialName;
dropdown.appendChild(newOption);
container.remove();
};
window.addBackToList = function () {
let dropdown = document.getElementById("customizeHeader");
let selectedOption = dropdown.options[dropdown.selectedIndex];
if (selectedOption.value !== "") {
let materialCode = selectedOption.value;
let materialName = selectedOption.text;
let container = document.createElement("div");
container.classList.add("sortable-item");
container.id = materialCode + "_container";
container.innerHTML = `
<input type="checkbox" id="${materialCode}_checkboxId"
name="materialCodes[]" value="${materialCode}"
onclick="removeSelectedMaterial(this)" checked>
<label class="grab" for="${materialCode}_checkboxId"> ${materialName} </label>
<br>
`;
attachDragEvents(container);
document.getElementById("sortableList").appendChild(container);
dropdown.removeChild(selectedOption);
}
};
});
</script>

View File

@ -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;
}
</style>
@ -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";
<!-- th:eq(15) -->
<th class="celda_encabezado_general" rowspan="2">Panel Gas Per Ton </th>
<!-- th:eq(16) -->
<th class="celda_encabezado_general" colspan="7">Incoming Sand/ Lump details </th>
<?php if(count($wcsSupplierList)>0){?>
<th class="celda_encabezado_general" colspan="<?=count($wcsSupplierList)?>">Incoming Sand/ Lump details </th>
<?php } ?>
<!-- th:eq(17) -->
<th class="celda_encabezado_general" colspan="3">ED details </th>
<!-- th:eq(18) -->
<th class="celda_encabezado_general" colspan="2">TRP Sand </th>
<th class="celda_encabezado_general" rowspan="2">Coating </th>
<!-- th:eq(19) -->
<th class="celda_encabezado_general" colspan="6">Usage </th>
<?php if(count($crsClientList)>0){?>
<th class="celda_encabezado_general" colspan="<?=count($crsClientList)?>">Usage </th>
<?php } ?>
<!-- th:eq(20) -->
<th class="celda_encabezado_general" colspan="2">Water </th>
<!-- th:eq(21) -->
@ -408,8 +423,7 @@ $timeOtions[] = "12:00 AM";
<!-- th:eq(29) -->
<th class="celda_encabezado_general" rowspan="2">ED +20 Waste </th>
<!-- th:eq(30) -->
<th class="celda_encabezado_general" rowspan="2">Cyclone Waste </th>
<!-- th:eq(31) -->
<th class="celda_encabezado_general" rowspan="2">Cyclone Waste </th>
</tr>
@ -420,20 +434,16 @@ $timeOtions[] = "12:00 AM";
<th class="celda_encabezado_general" style="z-index:11;">BG</th>
<!-- th:eq(1) -->
<th class="celda_encabezado_general">PG </th>
<!-- th:eq(2) -->
<th class="celda_encabezado_general">AL(S) </th>
<!-- th:eq(3) -->
<th class="celda_encabezado_general">AL(E) </th>
<!-- th:eq(4) -->
<th class="celda_encabezado_general">ME </th>
<!-- th:eq(6) -->
<th class="celda_encabezado_general">SI </th>
<!-- th:eq(7) -->
<th class="celda_encabezado_general">caparo </th>
<!-- th:eq(8) -->
<th class="celda_encabezado_general">Nemak </th>
<!-- th:eq(9) -->
<th class="celda_encabezado_general">DR</th>
<!-- dynamic loop wcs-->
<?php foreach($wcsSupplierList as $supplier){ ?>
<th class="celda_encabezado_general"><?=$supplier?> </th>
<?php } ?>
<!-- th:eq(10) -->
<th class="celda_encabezado_general">Running Hours </th>
<!-- th:eq(11) -->
@ -445,17 +455,16 @@ $timeOtions[] = "12:00 AM";
<!-- th:eq(14) -->
<th class="celda_encabezado_general">Production Per Hour </th>
<!-- th:eq(15) -->
<th class="celda_encabezado_general">Coating </th>
<!-- th:eq(16) -->
<th class="celda_encabezado_general">Hindhuja </th>
<!-- th:eq(17) -->
<th class="celda_encabezado_general">Nemak</th>
<!-- th:eq(18) -->
<th class="celda_encabezado_general">ME </th>
<!-- th:eq(19) -->
<th class="celda_encabezado_general">BI </th>
<!-- th:eq(20) -->
<th class="celda_encabezado_general">Karmen </th>
<!-- dynamic loop crs -->
<?php foreach($crsClientList as $client){ ?>
<th class="celda_encabezado_general"><?=$client?> </th>
<?php } ?>
<!-- th:eq(21) -->
<th class="celda_encabezado_general">Receipt </th>
<!-- th:eq(22) -->
@ -485,8 +494,8 @@ $timeOtions[] = "12:00 AM";
<?php if (!empty($trpProductionDetails)) {
dd(array_keys($trpProductionDetails[0]));
dd($trpProductionDetails);
// dd(array_keys($trpProductionDetails[0]));
// dd($trpProductionDetails);
?>
@ -555,14 +564,14 @@ $timeOtions[] = "12:00 AM";
<!-- totalHours -->
<!-- td:eq(3) -->
<td class="celda_normal trpProductionStock totalHours"
data-id="<?= $trpProductionDetail['date'] ?> totalHours">
data-id="<?=$trpProductionDetail['date']?> totalHours">
<?= $trpProductionDetail['totalHours'] ?>
</td>
<!-- coldStart -->
<!-- td:eq(4) -->
<td class="celda_normal trpProductionStock coldStart"
data-id="<?= $trpProductionDetail['date'] ?> coldStart"
data-id="<?=$trpProductionDetail['date']?> coldStart"
oninput="trpStockChange(this)"
contenteditable="true">
<?= $trpProductionDetail['coldStart'] ?>
@ -667,56 +676,18 @@ $timeOtions[] = "12:00 AM";
</td>
<!-- AL(S) -->
<!-- td:eq(17) -->
<td class="celda_normal trpProductionStock ALs_wcs"
data-id="<?= $trpProductionDetail['date'] ?> ALs_wcs">
<?= $trpProductionDetail['ALs_wcs'] == 0 ? " " : $trpProductionDetail['ALs_wcs'] ?>
</td>
<!-- loop for wcs supplier list -->
<!-- AL(E) -->
<!-- td:eq(18) -->
<td class="celda_normal trpProductionStock ALe_wcs"
data-id="<?= $trpProductionDetail['date'] ?> ALe_wcs">
<?= $trpProductionDetail['ALe_wcs'] == 0 ? " " : $trpProductionDetail['ALe_wcs'] ?>
</td>
<?php foreach($wcsSupplierList as $supplier){ ?>
<!-- ME -->
<!-- td:eq(19) -->
<td class="celda_normal trpProductionStock ME_wcs"
data-id="<?= $trpProductionDetail['date'] ?> ME_wcs"
contenteditable="true">
<?= $trpProductionDetail['ME_wcs'] == 0 ? " " : $trpProductionDetail['ME_wcs'] ?>
</td>
<!-- SI -->
<!-- td:eq(20) -->
<td class="celda_normal trpProductionStock SI_wcs"
data-id="<?= $trpProductionDetail['date'] ?> SI_wcs">
<?= $trpProductionDetail['SI_wcs'] == 0 ? " " : $trpProductionDetail['SI_wcs'] ?>
</td>
<!-- Caparo -->
<!-- td:eq(21) -->
<td class="celda_normal trpProductionStock caparo_wcs"
data-id="<?= $trpProductionDetail['date'] ?> caparo_wcs">
<?= $trpProductionDetail['caparo_wcs'] == 0 ? " " : $trpProductionDetail['caparo_wcs'] ?>
</td>
<!-- td:eq(17) -->
<td class="celda_normal trpProductionStock <?=$supplier?>"
data-id="<?= $trpProductionDetail['date'] ?> <?=$supplier?>">
<?= $trpProductionDetail[$supplier] == 0 ? " " : $trpProductionDetail[$supplier] ?>
</td>
<!-- Nemak -->
<!-- td:eq(22) -->
<td class="celda_normal trpProductionStock Nemak_wcs"
data-id="<?= $trpProductionDetail['date'] ?> Nemak_wcs">
<?= $trpProductionDetail['Nemak_wcs'] == 0 ? " " : $trpProductionDetail['Nemak_wcs'] ?>
</td>
<!-- DR -->
<!-- td:eq(23) -->
<td class="celda_normal trpProductionStock DR_wcs"
data-id="<?= $trpProductionDetail['date'] ?> DR_wcs">
<?= $trpProductionDetail['DR_wcs'] == 0 ? " " : $trpProductionDetail['DR_wcs'] ?>
</td>
<?php } ?>
<!-- edRunningHours -->
<!-- td:eq(24) -->
@ -747,7 +718,7 @@ $timeOtions[] = "12:00 AM";
<!-- trpProduction -->
<!-- td:eq(27) -->
<td class="celda_normal trpProductionStock trpProduction"
data-id="<?= $trpProductionDetail['date'] ?> trpProduction"
data-id="<?= $trpProductionDetail['date']?> trpProduction"
oninput="trpStockChange(this)"
contenteditable="true">
<?= $trpProductionDetail['trpProduction'] ?>
@ -767,40 +738,22 @@ $timeOtions[] = "12:00 AM";
<?= $trpProductionDetail['coating'] == 0 ? " " : $trpProductionDetail['coating'] ?>
</td>
<!-- Hindhuja -->
<!-- td:eq(30) -->
<td class="celda_normal trpProductionStock ALs_crs"
data-id="<?= $trpProductionDetail['date'] ?> ALs_crs">
<?= $trpProductionDetail['ALs_crs'] == 0 ? " " : $trpProductionDetail['ALs_crs'] ?>
<!-- loop for crs client ..!! -->
<?php foreach($crsClientList as $client){ ?>
<!-- td:eq(17) -->
<td class="celda_normal trpProductionStock <?=$client?>"
data-id="<?= $trpProductionDetail['date'] ?> <?=$client?>">
<?= $trpProductionDetail[$client] == 0 ? " " : $trpProductionDetail[$client] ?>
</td>
<!-- Nemak -->
<!-- td:eq(31) -->
<td class="celda_normal trpProductionStock Nemak_crs"
data-id="<?= $trpProductionDetail['date'] ?> Nemak_crs">
<?= $trpProductionDetail['Nemak_crs'] == 0 ? " " : $trpProductionDetail['Nemak_crs'] ?>
</td>
<!-- ME -->
<!-- td:eq(32) -->
<td class="celda_normal trpProductionStock ME_crs"
data-id="<?= $trpProductionDetail['date'] ?> ME_crs"
contenteditable="true">
<?= $trpProductionDetail['ME_crs'] == 0 ? " " : $trpProductionDetail['ME_crs'] ?>
</td>
<!-- BI -->
<!-- td:eq(33) -->
<td class="celda_normal trpProductionStock BI_crs"
data-id="<?= $trpProductionDetail['date'] ?> BI_crs"
contenteditable="true">
<?= $trpProductionDetail['BI_crs'] == 0 ? " " : $trpProductionDetail['BI_crs'] ?>
</td>
<!-- Karmen -->
<!-- td:eq(34) -->
<td class="celda_normal trpProductionStock Karmen_crs"
data-id="<?= $trpProductionDetail['date'] ?> Karmen_crs"
contenteditable="true">
<?= $trpProductionDetail['Karmen_crs'] == 0 ? " " : $trpProductionDetail['Karmen_crs'] ?>
</td>
<?php } ?>
<!-- waterReceipt -->
<!-- td:eq(35) -->
@ -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";
<th class="celda_encabezado_total" rowspan="2">Panel Gas Consumption </th>
<!-- th:eq(15) -->
<th class="celda_encabezado_total" rowspan="2">Panel Gas Per Ton </th>
<!-- th:eq(16) -->
<th class="celda_encabezado_total" colspan="7">Incoming Sand/ Lump details </th>
<?php if(count($wcsSupplierList)>0){?>
<th class="celda_encabezado_total" colspan="<?=count($wcsSupplierList)?>">Incoming Sand/ Lump details </th>
<?php } ?>
<!-- th:eq(17) -->
<th class="celda_encabezado_total" colspan="3">ED details </th>
<!-- th:eq(18) -->
<th class="celda_encabezado_total" colspan="2">TRP Sand </th>
<th class="celda_encabezado_total" rowspan="2">Coating </th>
<!-- th:eq(19) -->
<th class="celda_encabezado_total" colspan="6">Usage </th>
<?php if(count($crsClientList)>0){?>
<th class="celda_encabezado_total" colspan="<?=count($crsClientList)?>">Usage </th>
<?php } ?>
<!-- th:eq(20) -->
<th class="celda_encabezado_total" colspan="2">Water </th>
<!-- th:eq(21) -->
@ -1111,7 +1074,7 @@ $timeOtions[] = "12:00 AM";
<th class="celda_encabezado_total" rowspan="2">ED +20 Waste </th>
<!-- th:eq(30) -->
<th class="celda_encabezado_total" rowspan="2">Cyclone Waste </th>
<!-- th:eq(31) -->
</tr>
@ -1122,20 +1085,13 @@ $timeOtions[] = "12:00 AM";
<th class="celda_encabezado_total" style="z-index:11;">BG</th>
<!-- th:eq(1) -->
<th class="celda_encabezado_total">PG </th>
<!-- th:eq(2) -->
<th class="celda_encabezado_total">AL(S) </th>
<!-- th:eq(3) -->
<th class="celda_encabezado_total">AL(E) </th>
<!-- th:eq(4) -->
<th class="celda_encabezado_total">ME </th>
<!-- th:eq(6) -->
<th class="celda_encabezado_total">SI </th>
<!-- th:eq(7) -->
<th class="celda_encabezado_total">caparo </th>
<!-- th:eq(8) -->
<th class="celda_encabezado_total">Nemak </th>
<!-- th:eq(9) -->
<th class="celda_encabezado_total">DR</th>
<?php foreach($wcsSupplierList as $supplier){ ?>
<th class="celda_encabezado_total"><?=$supplier?> </th>
<?php } ?>
<!-- th:eq(10) -->
<th class="celda_encabezado_total">Running Hours </th>
<!-- th:eq(11) -->
@ -1147,17 +1103,16 @@ $timeOtions[] = "12:00 AM";
<!-- th:eq(14) -->
<th class="celda_encabezado_total">Production Per Hour </th>
<!-- th:eq(15) -->
<th class="celda_encabezado_total">Coating </th>
<!-- th:eq(16) -->
<th class="celda_encabezado_total">Hindhuja </th>
<!-- th:eq(17) -->
<th class="celda_encabezado_total">Nemak</th>
<!-- th:eq(18) -->
<th class="celda_encabezado_total">ME </th>
<!-- th:eq(19) -->
<th class="celda_encabezado_total">BI </th>
<!-- th:eq(20) -->
<th class="celda_encabezado_total">Karmen </th>
<?php foreach($crsClientList as $client){ ?>
<th class="celda_encabezado_total"><?=$client?> </th>
<?php } ?>
<!-- th:eq(21) -->
<th class="celda_encabezado_total">Receipt </th>
<!-- th:eq(22) -->
@ -1296,48 +1251,14 @@ $timeOtions[] = "12:00 AM";
</td>
<!-- AL(S) -->
<!-- td:eq(17) -->
<td class="celda_normal">
<?= $summary['ALs_wcs']?>
</td>
<!-- AL(E) -->
<!-- td:eq(18) -->
<td class="celda_normal">
<?=$summary['ALe_wcs']?>
</td>
<?php
foreach($wcsSupplierList as $supplier){ ?>
<td class="celda_normal">
<?=$summary[$supplier]?>
</td>
<?php } ?>
<!-- ME -->
<!-- td:eq(19) -->
<td class="celda_normal">
<?=$summary['ME_wcs'] ?>
</td>
<!-- SI -->
<!-- td:eq(20) -->
<td class="celda_normal">
<?= $summary['SI_wcs']?>
</td>
<!-- Caparo -->
<!-- td:eq(21) -->
<td class="celda_normal">
<?=$summary['caparo_wcs']?>
</td>
<!-- Nemak -->
<!-- td:eq(22) -->
<td class="celda_normal">
<?= $summary['Nemak_wcs']?>
</td>
<!-- DR -->
<!-- td:eq(23) -->
<td class="celda_normal">
<?= $summary['DR_wcs']?>
</td>
<!-- edRunningHours -->
<!-- td:eq(24) -->
@ -1377,32 +1298,14 @@ $timeOtions[] = "12:00 AM";
<?=$summary['coating'] ?>
</td>
<!-- Hindhuja -->
<!-- td:eq(30) -->
<td class="celda_normal">
<?= $summary['ALs_crs'] ?>
</td>
<?php
foreach($crsClientList as $client){ ?>
<td class="celda_normal">
<?=$summary[$client]?>
</td>
<?php } ?>
<!-- Nemak -->
<!-- td:eq(31) -->
<td class="celda_normal">
<?=$summary['Nemak_crs'] ?>
</td>
<!-- ME -->
<!-- td:eq(32) -->
<td class="celda_normal">
<?=$summary['ME_crs'] ?>
</td>
<!-- BI -->
<!-- td:eq(33) -->
<td class="celda_normal">
<?=$summary['BI_crs'] ?>
</td>
<!-- Karmen -->
<!-- td:eq(34) -->
<td class="celda_normal">
<?=$summary['Karmen_crs'] ?>
</td>
<!-- waterReceipt -->
<!-- td:eq(35) -->
@ -1461,13 +1364,13 @@ $timeOtions[] = "12:00 AM";
<!-- location -->
<!-- td:eq(44) -->
<td class="celda_normal">
<td class="celda_normal location">
<?=" "?>
</td>
<!-- description -->
<!-- td:eq(45) -->
<td class="celda_normal">
<td class="celda_normal description">
<?=" " ?>
</td>
@ -1508,23 +1411,24 @@ $timeOtions[] = "12:00 AM";
</tbody>
</table>
<br><br><br>
<?php } ?>
</tbody>
</table>
</div>
<br>
<div class="row">
<div class="col-md-12 text-center">
<input type="button" class="btn btn-success px-4" id="saveId" value="save">
@ -1533,6 +1437,64 @@ $timeOtions[] = "12:00 AM";
</div>
<br><br><br>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<?php $abstractDetails = [
] ?>
<h4 style="text-align:center">Abstract for the month <?=$month?></h4>
<div class="table-responsive">
<table id="abstractTableId" class="fht-table table-striped">
<thead class="celda_encabezado_general" style="padding: 10px ;">
<tr>
<th class="celda_encabezado_general">Particulars</th>
<th class="celda_encabezado_general">Running Hours</th>
<th class="celda_encabezado_general">Per Hour</th>
<th class="celda_encabezado_general">Opening Stock</th>
<th class="celda_encabezado_general">Receipt</th>
<th class="celda_encabezado_general">Total</th>
<th class="celda_encabezado_general">Consumption</th>
<th class="celda_encabezado_general">Closing Stock</th>
<th class="celda_encabezado_general">Physical Stock</th>
<th class="celda_encabezado_general">Remarks</th>
</tr>
</thead>
<tbody>
<tr>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div> <!-- End card-body -->
</div> <!-- End card -->
</div> <!-- End col -->
@ -1572,7 +1534,7 @@ $timeOtions[] = "12:00 AM";
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
</div>
@ -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);
}
</script>
</script>
<script>
function calculateSandFeedingHours(totalHours, coldStart, breakdownHours) {
@ -1778,38 +1742,57 @@ $timeOtions[] = "12:00 AM";
let tr = $(tdElement).closest('tr');
let date = tr.find('td:eq(0)').text().trim() ;
let totalHours = validateInput(tr.find('td:eq(3)').text().trim()) ?? 0;
let coldStart = validateInput(tr.find('td:eq(4)').text().trim()) ?? 0;
let breakdownHours = validateInput(tr.find('td:eq(5)').text().trim()) ?? 0;
let burnerFiringHours = tr.find('td:eq(6)').text().trim() ?? 0;
let sandFeedingHours = tr.find('td:eq(7)').text().trim() ?? 0;
date = `${date.split('-')[2]}-${date.split('-')[1]}-${date.split('-')[0]}`;
let totalHours = validateInput(document.querySelector(`td.totalHours[data-id="${date} totalHours"]`).innerText) ?? 0;
let coldStart = validateInput(document.querySelector(`td.coldStart[data-id="${date} coldStart"]`).innerText) ?? 0;
let breakdownHours = validateInput(document.querySelector(`td.breakdownHours[data-id="${date} breakdownHours"]`).innerText) ?? 0;
let burnerFiringHours = validateInput(document.querySelector(`td.burnerFiringHours[data-id="${date} burnerFiringHours"]`).innerText) ?? 0;
let sandFeedingHours = validateInput(document.querySelector(`td.sandFeedingHours[data-id="${date} sandFeedingHours"]`).innerText) ?? 0;
let gasReceiptBg = tr.find('td:eq(8)').text().trim() ?? 0;
let gasReceiptPg = tr.find('td:eq(9)').text().trim() ?? 0;
let physicalGasConsumption = validateInput(tr.find('td:eq(10)').text().trim()) ?? 0;
let drierGasConsumption = validateInput(tr.find('td:eq(11)').text().trim()) ?? 0;
let coatingGasConsumption = validateInput(tr.find('td:eq(12)').text().trim()) ?? 0;
let trpPlusDrierGasConsumption = tr.find('td:eq(13)').text().trim() ?? 0;
let trpPhysicalGasPerTon = tr.find('td:eq(14)').text().trim() ?? 0;
let panelGasConsumption = (tr.find('td:eq(15)').text().trim()) ?? 0;
let panelGasPerTon = tr.find('td:eq(16)').text().trim() ?? 0;
let gasReceiptBg = validateInput(document.querySelector(`td.gasReceiptBg[data-id="${date} gasReceiptBg"]`).innerText) ?? 0;
let gasReceiptPg = validateInput(document.querySelector(`td.gasReceiptPg[data-id="${date} gasReceiptPg"]`).innerText) ?? 0;
let physicalGasConsumption = validateInput(document.querySelector(`td.physicalGasConsumption[data-id="${date} physicalGasConsumption"]`).innerText) ?? 0;
let drierGasConsumption = validateInput(document.querySelector(`td.drierGasConsumption[data-id="${date} drierGasConsumption"]`).innerText) ?? 0;
let coatingGasConsumption = validateInput(document.querySelector(`td.coatingGasConsumption[data-id="${date} coatingGasConsumption"]`).innerText) ?? 0;
let trpPlusDrierGasConsumption = validateInput(document.querySelector(`td.trpPlusDrierGasConsumption[data-id="${date} trpPlusDrierGasConsumption"]`).innerText) ?? 0;
let trpPhysicalGasPerTon = validateInput(document.querySelector(`td.trpPhysicalGasPerTon[data-id="${date} trpPhysicalGasPerTon"]`).innerText) ?? 0;
let panelGasConsumption = validateInput(document.querySelector(`td.panelGasConsumption[data-id="${date} panelGasConsumption"]`).innerText) ?? 0;
let panelGasPerTon = validateInput(document.querySelector(`td.panelGasPerTon[data-id="${date} panelGasPerTon"]`).innerText) ?? 0;
let edRunningHours = validateInput(document.querySelector(`td.edRunningHours[data-id="${date} edRunningHours"]`).innerText) ?? 0;
let edProduction = validateInput(document.querySelector(`td.edProduction[data-id="${date} edProduction"]`).innerText) ?? 0;
let edUsage = validateInput(document.querySelector(`td.edUsage[data-id="${date} edUsage"]`).innerText) ?? 0;
let trpProduction = validateInput(document.querySelector(`td.trpProduction[data-id="${date} trpProduction"]`).innerText) ?? 0;
let trpProductionPerHour = validateInput(document.querySelector(`td.trpProductionPerHour[data-id="${date} trpProductionPerHour"]`).innerText) ?? 0;
let coating = validateInput(document.querySelector(`td.coating[data-id="${date} coating"]`).innerText) ?? 0;
let edRunningHours = tr.find('td:eq(24)').text().trim() ?? 0;
let edProduction = tr.find('td:eq(25)').text().trim() ?? 0;
let edUsage = tr.find('td:eq(26)').text().trim() ?? 0;
let trpProduction = validateInput(tr.find('td:eq(27)').text().trim()) ?? 0;
let trpProductionPerHour = tr.find('td:eq(28)').text().trim() ?? 0;
let coating = tr.find('td:eq(29)').text().trim() ?? 0;
let ebReading = tr.find('td:eq(37)').text().trim() ?? 0;
let ebReadingPerUnitTon = tr.find('td:eq(38)').text().trim() ?? 0;
let ebReading = validateInput(document.querySelector(`td.ebReading[data-id="${date} ebReading"]`).innerText) ?? 0;
let ebReadingPerUnitTon = validateInput(document.querySelector(`td.ebReadingPerUnitTon[data-id="${date} ebReadingPerUnitTon"]`).innerText) ?? 0;
let result = calculateSandFeedingHours(totalHours, coldStart, breakdownHours, burnerFiringHours);
let result = calculateSandFeedingHours(totalHours, coldStart, breakdownHours, burnerFiringHours);
sandFeedingHours = result[0];
@ -1818,31 +1801,32 @@ $timeOtions[] = "12:00 AM";
trpPlusDrierGasConsumption = parseInt(parseFloat(physicalGasConsumption) -
(parseFloat(drierGasConsumption) + parseFloat(coatingGasConsumption)));
trpPhysicalGasPerTon = trpProduction == 0 ? " " : parseFloat(trpPlusDrierGasConsumption) / (parseFloat(trpProduction) / 1000);
trpPhysicalGasPerTon = trpProduction == 0 ? 0 : parseFloat(trpPlusDrierGasConsumption) / (parseFloat(trpProduction) / 1000);
panelGasPerTon = parseFloat(panelGasConsumption) / (parseFloat(trpProduction) / 1000);
trpProductionPerHour = sandFeedingHours == 0 ? " " : parseFloat(trpProduction) / parseFloat(sandFeedingHours);
trpProductionPerHour = sandFeedingHours == 0 ? 0 : parseFloat(trpProduction) / parseFloat(sandFeedingHours);
ebReadingPerUnitTon = trpProduction == 0 ? " " : parseFloat(ebReading) / (parseFloat(trpProduction) / 1000);
ebReadingPerUnitTon = trpProduction == 0 ? 0 : parseFloat(ebReading) / (parseFloat(trpProduction) / 1000);
// Final updation of value into td
tr.find('td:eq(7)').text(Number.isNaN(sandFeedingHours) ? " " : sandFeedingHours);
document.querySelector(`td.sandFeedingHours[data-id="${date} sandFeedingHours"]`).innerText = isFinite(sandFeedingHours) ? sandFeedingHours : " ";
tr.find('td:eq(6)').text(Number.isNaN(burnerFiringHours) ? " " : burnerFiringHours);
document.querySelector(`td.burnerFiringHours[data-id="${date} burnerFiringHours"]`).innerText = isFinite(burnerFiringHours) ? burnerFiringHours : " ";
tr.find('td:eq(13)').text(Number.isNaN(trpPlusDrierGasConsumption) ? " " : (trpPlusDrierGasConsumption).toFixed(2));
document.querySelector(`td.trpPlusDrierGasConsumption[data-id="${date} trpPlusDrierGasConsumption"]`).innerText = isFinite(trpPlusDrierGasConsumption) ? trpPlusDrierGasConsumption : " ";
document.querySelector(`td.trpPhysicalGasPerTon[data-id="${date} trpPhysicalGasPerTon"]`).innerText = isFinite(trpPhysicalGasPerTon) ? (trpPhysicalGasPerTon).toFixed(2) : " ";
document.querySelector(`td.panelGasPerTon[data-id="${date} panelGasPerTon"]`).innerText = isFinite(panelGasPerTon) ? (panelGasPerTon).toFixed(2) : " ";
document.querySelector(`td.trpProductionPerHour[data-id="${date} trpProductionPerHour"]`).innerText = isFinite(trpProductionPerHour) ? (trpProductionPerHour).toFixed(2) : " ";
tr.find('td:eq(14)').text(Number.isNaN(trpPhysicalGasPerTon) ? " " : (trpPhysicalGasPerTon).toFixed(2));
document.querySelector(`td.ebReadingPerUnitTon[data-id="${date} ebReadingPerUnitTon"]`).innerText = isFinite(ebReadingPerUnitTon) ? (ebReadingPerUnitTon).toFixed(2) : " ";
tr.find('td:eq(16)').text(Number.isNaN(panelGasPerTon) ? " " : (panelGasPerTon.toFixed(2)));
tr.find('td:eq(28)').text(Number.isNaN(trpProductionPerHour) ? " " : (trpProductionPerHour).toFixed(2));
tr.find('td:eq(38)').text(Number.isNaN(ebReadingPerUnitTon) ? " " : (ebReadingPerUnitTon).toFixed(2));
@ -1870,6 +1854,9 @@ $timeOtions[] = "12:00 AM";
var tr = $(this).closest('tr');
let date = tr.find('td:eq(0)').text().trim() ;
date = `${date.split('-')[2]}-${date.split('-')[1]}-${date.split('-')[0]}`;
var trpOnTime = tr.find('.trp_on_time').val();
var trpOffTime = tr.find('.trp_off_time').val();
@ -1898,7 +1885,7 @@ $timeOtions[] = "12:00 AM";
const totalHours = hours + "." + minutes;
tr.find('td:eq(3)').text(totalHours);
document.querySelector(`td.totalHours[data-id="${date} totalHours"]`).innerText = totalHours;
trpStockChange(this);

View File

@ -251,8 +251,12 @@
<td><?php echo $record->SupplierName ?></td>
<td><?php echo $record->DeliveryChellanOrInvoiceNo ?></td>
<td align="right"><?php
$date = new DateTime($record->DeliveryChellanDate);
echo $date->format('d-m-Y'); ?></td>
$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'); } ?></td>
<td align="center"
style=" display : none ;"><?php echo $record->itemCount ?></td>
@ -635,14 +639,14 @@
<!-- modal4 - IGR history modal -->
<div id="Historyshow" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">IGR History Details <span id="HisTitle"></span></h4>
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">×</button>
</div>
<div class="modal-body p-4">
<div class="modal-body p-3">
<div class="row">
<div class="col-md-12">
<div id="HisStatement"></div>
@ -937,13 +941,15 @@
}
// 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());
$("#InvoiceDate").val(dcd2);
console.log(item.MaterialRcvdDate)
// (item.DeliveryChellanDate && item.DeliveryChellanDate !== "0000-00-00 00:00:00")
var dcd = (item.DeliveryChellanDate == 'null') ? ' ' : formatDateTime(item.DeliveryChellanDate, 1);
$("#InvoiceDate").val(dcd);
var Mat_rcv_date = (item.MaterialRcvdDate == 'null') ? ' ' : formatDateTime(item.MaterialRcvdDate, 1);
$("#MaterialRcvdDate").val(Mat_rcv_date);
console.log(item.MaterialRcvdDate)
// console.log(item.MaterialRcvdDate)
var gross_rcv_date = (item.GrossWeightDate == 'null') ? ' ' : formatDateTime(item.GrossWeightDate, 2);
$("#ser").val(item.ServiceDescription);
var amount = item.Rate*item.QuantityAsPerInvoice;
@ -1183,7 +1189,7 @@
success: function(data) {
alert(data);
location.reload();
// location.reload();
}
});
});
@ -1251,6 +1257,9 @@
success: function(data) {
alert(data);
// setTimeout(function () {
// $("#Igrshow").modal('hide');
// }, 2000);
location.reload();
},
error: function(xhr, status, error) { // Error callback
@ -1346,15 +1355,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;
}

View File

@ -26,6 +26,307 @@ function myFunction() {
}
}
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');
});
}
function revenueValidate(){
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');
$('#Scheduleby').focus();
return false;
}
}else if($('#PODate').val() == ''){
alert('Please Enter the Purchase Order date');
$('#PODate').focus();
return false;
}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($('#insuranceStatus').val() == "1" && $('#InsuranceNumber').val().trim() == ''){
alert('Please Enter the Insurance No / Insurance Details');
$('#InsuranceNumber').focus();
return false;
}else if ($('#BudgetType').val() == "0") {
alert('Please Select Budget Type');
$('#BudgetType').focus();
return false;
}else if ($('#revenueTax tbody tr').length < 1) {
alert('Atleast One Line needed');
return false;
}else {
return true;
}
}
function serviceValidate(){
var radioValue = parseInt($("input[name='DateRange']:checked").val());
if ($('#drpSupplier').val() == "0") {
alert('Please Select the Supplier details');
$('#drpSupplier').focus();
return false;
}else if ($('#workstatus').val() == "0") {
alert('Please Select the Work Status');
$('#workstatus').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');
$('#Scheduleby').focus();
return false;
}
}else if($('#PODate').val() == ''){
alert('Please Enter the Purchase Order date');
$('#PODate').focus();
return false;
}else if ($('#PoTypeOptions').val() == "0") {
alert('Please Select Service Type');
$('#PoTypeOptions').focus();
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().trim() == ''){
alert('Please Enter the Insurance No / Insurance Details');
$('#InsuranceNumber').focus();
return false;
}else if ($('#BudgetType').val() == "0") {
alert('Please Select Budget Type');
$('#BudgetType').focus();
return false;
}else if ($('#serviceTax tbody tr').length < 1) {
alert('Atleast One Line needed');
return false;
} else if ($('#descofpo').val().trim() == '') {
alert('Please Enter Description Of Service');
$('#descofpo').focus();
return false;
}else {
return true;
}
}
function capitalValidate(){
var radioValue = parseInt($("input[name='DateRange']:checked").val());
var PoType = $('#POType').val();
if(PoType=='CAPITAL' && 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 if ($('#serviceTax tbody tr').length < 1) {
alert('Atleast One Line needed');
return false;
} else { return true; }
}
if(PoType=='CAPITAL' && 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 if ($('#serviceTax tbody tr').length < 1) {
alert('Atleast One Line needed');
return false;
} else { return true; }
}
}
function importValidate(){
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 (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();
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 ($('#Importoption').val() == "0") {
alert('Please Select Import Type');
$('#Importoption').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 if ($('#ImportTax tbody tr').length < 1) {
alert('Atleast One Line needed');
return false;
}else {
return true;
}
}
function validate()
{
var radioValue = $("input[name='DateRange']:checked").val();