diff --git a/app/Config/Routes.php b/app/Config/Routes.php index b613750c..bee6cc65 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -87,6 +87,7 @@ $routes->post('fetchDriverAttendanceDetails', 'Driver::fetchDriverAttendanceDeta $routes->get('reActivateDriverAttendance', 'Driver::reActivateDriverAttendance'); $routes->get('deleteDriverAttendance', 'Driver::deleteDriverAttendance'); $routes->post('gatheredCustAndQty', 'Driver::gatheredCustAndQty'); +$routes->match(['GET', 'POST'], 'updateDieselAndShedValuesBasedonEmpID', 'Driver::updateDieselAndShedValuesBasedonEmpID'); // Driver Monthly Pay Inputs Routes $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'driverMonthlyPayInputs', 'Driver::driverMonthlyPayInputs'); $routes->post('saveMonthlyData', 'Driver::saveMonthlyData'); @@ -124,6 +125,7 @@ $routes->get('exportemployee', 'Employeedetails::exportemployee'); $routes->post('employeeEmailExist', 'Employeedetails::CheckEmail'); +$routes->post('employeeMobileExist', 'Employeedetails::CheckMobile'); $routes->post('employeePANExist', 'Employeedetails::checkPAN'); $routes->post('employeecheckAadharNoExist', 'Employeedetails::checkAadharNo'); @@ -440,6 +442,7 @@ $routes->get('sales_invoice', 'Sales::sales_invoice'); $routes->post('sales_invoice', 'Sales::sales_invoice'); $routes->post('download_sales_invoice', 'Sales::download_sales_invoice'); $routes->post('updateInvRecQty', 'Sales::updateInvRecQty'); +$routes->match(['GET', 'POST'], 'sales_report', 'Sales::sales_report'); // transporter Routes $routes->match(['GET', 'POST'],'transporterListing', 'Supplier::transporterListing'); diff --git a/app/Controllers/Amendmentpurchaseorder.php b/app/Controllers/Amendmentpurchaseorder.php index 34d8c875..df3325dc 100755 --- a/app/Controllers/Amendmentpurchaseorder.php +++ b/app/Controllers/Amendmentpurchaseorder.php @@ -546,6 +546,8 @@ class Amendmentpurchaseorder extends BaseController $RecQtyvalue = $ReceivedQty[0]['ReceivedQuantity']; } + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $POLineItemList = array('PONO' => $NewPO, 'ReqNo' => $Reqnumber, 'MaterialCode' => $MaterialCode, 'ReceivedQuantity' => $RecQtyvalue, 'Quantity' => $Quantity, 'Per' => $per, 'ServiceMaterialDescription' => $servicematerialdescription, 'Rate' => $itemRate, 'Status' => $LineItemStatus, 'CreatedBy' => $updatedBy, 'CreatedDate' => $updateddt, 'CostCenterCode' => $CostCenter, 'ServiceFrequency' => $ServiceFrequency, 'AmendedDetails' => $CAD); $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); @@ -815,6 +817,8 @@ class Amendmentpurchaseorder extends BaseController $CAD = "" . $MaterialCode . "-" . $MaterialName . ""; $CAD .= $CAD2; } + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $POLineItemList = array('PONO' => $NewPO, 'ReqNo' => $Reqnumber, 'MaterialCode' => $MaterialCode, 'Quantity' => $Quantity, 'Rate' => $itemRate, 'Status' => $LineItemStatus, 'ServiceMaterialDescription' => $servicematerialdescription, 'CreatedBy' => $updatedBy, 'CreatedDate' => $updateddt, 'CostCenterCode' => $CostCenter, 'ServiceFrequency' => $ServiceFrequency, 'ReceivedQuantity' => $RecQtyvalue, 'AmendedDetails' => $CAD, 'Per' => $Per); @@ -1248,6 +1252,8 @@ class Amendmentpurchaseorder extends BaseController $CAD = "" . $MaterialCode . ""; $CAD .= $CAD2; } + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $POLineItemList = array('PONO' => $NewPO, 'ReqNo' => $Reqnumber, 'MaterialCode' => $MaterialCode, 'Quantity' => $Quantity, 'Rate' => $itemRate, 'Status' => $LineItemStatus, 'CreatedBy' => $CreateBy, 'CreatedDate' => $createddt, 'CostCenterCode' => $CostCenter, 'AmendedDetails' => $CAD, 'Per' => $Per, 'ServiceMaterialDescription' => $CapitalItemDescrition); $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); @@ -1636,6 +1642,8 @@ class Amendmentpurchaseorder extends BaseController $CAD = "" . $MaterialCode . ""; $CAD .= $CAD2; } + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $POLineItemList = array('PONO' => $NewPO, 'ReqNo' => $Reqnumber, 'MaterialCode' => $MaterialCode, 'Quantity' => $Quantity, 'Rate' => $itemRate, 'Status' => $LineItemStatus, 'CreatedBy' => $CreateBy, 'CreatedDate' => $createddt, 'CostCenterCode' => $CostCenter, 'AmendedDetails' => $CAD, 'Per' => $per, 'ServiceMaterialDescription' => $specialinstruction); diff --git a/app/Controllers/Assetdetails.php b/app/Controllers/Assetdetails.php index abe28116..ec4fe370 100755 --- a/app/Controllers/Assetdetails.php +++ b/app/Controllers/Assetdetails.php @@ -248,11 +248,12 @@ class Assetdetails extends BaseController $DateOfCommission = $this->request->getPost('DateOfCommission'); $CreatedBy = $this->session->get('userId'); $DateOfPurchase = $this->request->getPost('DateOfPurchase'); + $DOpurchase = ""; if ($DateOfPurchase != '') { $DOpurchase = get_date_time_format($DateOfPurchase); } $AssetValue = $this->request->getPost('Assetvalue'); - + $DOCommission = ""; if ($DateOfCommission != '') { $DOCommission = get_date_time_format($DateOfCommission); //$DOCommission= get_date_time_format($DateOfCommission); diff --git a/app/Controllers/CostCenter.php b/app/Controllers/CostCenter.php index b91be7f4..fd796a8b 100755 --- a/app/Controllers/CostCenter.php +++ b/app/Controllers/CostCenter.php @@ -116,11 +116,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'); } @@ -135,11 +137,13 @@ class CostCenter extends BaseController if(!empty($CostCenterID)){ $updatedBy = $this->session->get('userId'); $message = $this->costcenter_model->deleteCostCenter($CostCenterID, $updatedBy); + return redirect()->route('costListing'); }else{ $message = "Cost Center Code Not Avalable"; + return redirect()->route('costListing'); } - $this->session->setFlashdata('success', $message); - return redirect()->route('costListing'); + // $this->session->setFlashdata('success', $message); + // return redirect()->route('costListing'); } diff --git a/app/Controllers/Driver.php b/app/Controllers/Driver.php index f1f46924..f73d7c7b 100755 --- a/app/Controllers/Driver.php +++ b/app/Controllers/Driver.php @@ -133,28 +133,53 @@ class Driver extends BaseController return $this->response->setJSON($results); } - public function loadDriverAttendance() + public function loadDriverAttendance() { - $input_driver_id = $this->request->getPost('gobal_driver_id') ? $this->request->getPost('gobal_driver_id') : $this->request->getGet('gobal_driver_id'); - $input_month_year = $this->request->getPost('month_year') ? $this->request->getPost('month_year') : $this->request->getGet('month_year'); - list($month, $year) = explode('-', $input_month_year); + $input_driver_id = $this->request->getGet('gobal_driver_id'); + // $input_month_year = $this->request->getPost('month_year') ? $this->request->getPost('month_year') : get_date_time_dynamical_format('d-M-Y','d-m-',"01-"+$this->request->getGet('month_year')) ; + $input_date = $this->request->getGet('date') + ? $this->request->getGet('date') + : get_date_time_dynamical_format('d-M-Y','d-m-Y',"01-".$this->request->getGet('month_year')); - $month_in_number = get_date_time_dynamical_format('M','m',"$month");// refer helper - $get_last_date_of_the_month = cal_days_in_month(CAL_GREGORIAN, $month_in_number, $year); - $from_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"01-$month_in_number-$year"); - $to_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"$get_last_date_of_the_month-$month_in_number-$year"); - $indian_date = get_date_time_dynamical_format('d-m-Y','d-m-Y',"$get_last_date_of_the_month-$month_in_number-$year"); + + list($date,$month,$year) = explode('-', $input_date); + + $get_last_date_of_the_month = cal_days_in_month(CAL_GREGORIAN, $month, $year); + $from_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"01-$month-$year"); + $to_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"$get_last_date_of_the_month-$month-$year"); + $indian_date = get_date_time_dynamical_format('d-m-Y','d-m-Y',"$get_last_date_of_the_month-$month-$year"); + + $amount = $this->driver_model->getDriverAttendanceTable($input_driver_id,"$year-$month"); + $data['driver_attendance_list'] = $this->driver_model->useDriverAttendanceTable()->getDriverAttendanceList($input_driver_id,$from_mysql_date,$to_mysql_date); - $data['page_driver_name'] = $this->driver_model->getDriverName($input_driver_id); + $data['page_driver_name'] = $this->driver_model->getDriverName($input_driver_id,0); $data['invoice_info'] = $this->driver_model->getInvoiceInfo(); - $data['datefordropdown'] = $input_month_year; + $data['datefordropdown'] = $input_date; $data['gobal_driver_id'] = $input_driver_id; + $data['gobal_diesel_amount'] = isset($amount->diesel_amount) ? $amount->diesel_amount : 0 ; + $data['gobal_shed_amount'] = isset($amount->shed_amount) ? $amount->shed_amount : 0 ; $this->global['pageTitle'] = 'Driver Attendance List'; $this->loadViews("driverAttendance", $this->global, $data, NULL); } + public function updateDieselAndShedValuesBasedonEmpID(){ + $arr = $this->request->getPost(); + $userId = $this->session->get('userId'); + $to_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m',$arr['date']); + + $update_arr = ['driver_id' =>$arr['empid'],$arr['column'] =>$arr['value'],'updated_by' => $userId]; + $where_arr = ['DATE_FORMAT(t_driver_attendance.date, "%Y-%m")' =>$to_mysql_date,'t_driver_attendance.driver_id' =>$arr['empid']]; + $data = $this->driver_model->updateDieselAndShedValuesBasedonEmpID($where_arr,$update_arr); + return $data; + // [column] => shed_amount + // [value] => 400 + // [date] => 21-02-2025 + // [empid] => RIPL136 + + + } public function fetchDriverAttendanceDetails(){ $userId = $this->session->get('userId'); @@ -376,11 +401,11 @@ class Driver extends BaseController echo json_encode(count($result)); } - public function driverPayslip() + public function driverPayslip_old() { $PayOn = $this->request->getPost('payon'); - $Driver = $this->request->getPost('driver'); + $Driver = $this->request->getPost('employee'); $res = $this->driver_model->getMonthlyPayDetails($Driver, $PayOn); @@ -389,13 +414,9 @@ class Driver extends BaseController $data = [ 'PayOn' => $result->month_year, 'driver_id' => $result->driver_id, - 'driver_name' => $result->driver_name, 'no_of_loads' => $result->no_of_loads, 'driver_monthly_salary_amount' => $result->driver_monthly_salary_amount, - 'driver_monthly_food_amount' => $result->driver_monthly_food_amount, 'driver_earnings_amount' => $result->driver_earnings_amount, - 'diesel' => $result->diesel, - 'shed_duty_amount' => $result->shed_duty_amount, 'driver_final_payment' => $result->driver_final_payment, 'created_by' => $this->session->get('userId') ]; @@ -405,6 +426,84 @@ class Driver extends BaseController } + public function driverPayslip() + { + + $PayOn = $this->request->getPost('payon'); + + $Driver = $this->request->getPost('employee'); + + $res = $this->driver_model->getMonthlyPayDetails($Driver, $PayOn); + + $result = $res[0]; + + + $loan = []; + $loanHistory = []; + $loan_id = 0; + $BalanceAdvance = 0; + if(is_null($result->Loan_ID)){ + + }else{ + if($result->Loan_Recovered > 0) + { + $loan_id = $result->Loan_ID; + + if($result->Remaining_Due - 1 == 0){ $is_Active = 0; }else{ $is_Active = 1; } + + $loan = [ + 'Paid_Due' => $result->Paid_Due + 1, + 'Remaining_Due' => $result->Remaining_Due - 1, + 'Paid_Amount' => $result->Paid_Amount + $result->Loan_Recovered, + 'is_Active' => $is_Active + ]; + + + $loanHistory = [ + 'Loan_ID' => $loan_id, + 'Due_Amount' => $result->Loan_Recovered, + 'Balance_Amount' => (int)$result->Loan_Amount - ((int)$result->Paid_Amount + (int)$result->Loan_Recovered), + 'Due_Date' => (string)$PayOn, + ]; + + $BalanceAdvance = $result->Loan_Amount - ($result->Paid_Amount + $result->Loan_Recovered); + + + } + } + + $data = [ + 'PayOn' => $result->month_year, + 'driver_id' => $result->driver_id, + 'no_of_loads' => $result->no_of_loads, + 'monthly_salary_amount' => $result->monthly_salary_amount, + 'monthly_food_amount' => $result->monthly_food_amount, + 'final_payment' => $result->final_payment, + 'created_by' => $this->session->get('userId'), + 'shed_amount' => $result->total_shed_amount, + 'diesel_amount' => $result->total_diesel_amount, + 'ESI' => $result->ESI, + 'PF' => $result->PF, + 'Advance' => $result->Loan_Recovered, + 'BalanceAdvance' => $BalanceAdvance, + 'LessAdvance' => 0, + 'Festival_Bonus' => $result->Festival_Bonus, + ]; + + + + $insert = $this->driver_model->insertPayroll($data); + if($insert){ + if(count($loan)){ + $this->driver_model->updateLoan($loan_id,$result->driver_id,$loan); + } + if(count($loanHistory)){ + $this->driver_model->insertLoanHistory($loanHistory); + } + } + return $insert; + } + public function driverPrintPdf() { diff --git a/app/Controllers/Emergencypurchaseorder.php b/app/Controllers/Emergencypurchaseorder.php index c18be944..62ba5781 100755 --- a/app/Controllers/Emergencypurchaseorder.php +++ b/app/Controllers/Emergencypurchaseorder.php @@ -125,7 +125,7 @@ class Emergencypurchaseorder extends BaseController // print_r($this->request->getPost());die; $txtRowCount = $this->request->getPost('txtRowCount'); $POdt = $this->request->getPost('PODate'); - $PODate = get_date_time_format($POdt); + $PODate = get_date_time_dynamical_format('d-m-Y','Y-m-d',"$POdt"); $SupplierID = $this->request->getPost('drpSupplier'); $DeliveryAddr = $this->request->getPost('DeliveryAddr'); $CostCenterName = $this->request->getPost('CostCenterName'); @@ -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++) { @@ -367,7 +369,7 @@ class Emergencypurchaseorder extends BaseController $POdt = $this->request->getPost('PODate'); - $PODate = get_date_time_format($POdt); + $PODate = get_date_time_dynamical_format('d-m-Y','Y-m-d',"$POdt"); $SupplierID = $this->request->getPost('drpSupplier'); $DeliveryAddr = $this->request->getPost('DeliveryAddr'); $dt = $this->request->getPost('Deliverydt'); @@ -524,6 +526,8 @@ class Emergencypurchaseorder extends BaseController $AfterCgst = $this->request->getPost('RevenueAfterCgst' . $i); $AfterSgst = $this->request->getPost('RevenueAfterSgst' . $i); $AfterIgst = $this->request->getPost('RevenueAfterIgst' . $i); + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; if (count($comma_separated) > 0) { for ($j = 1; $j < count($comma_separated); $j++) { @@ -632,7 +636,7 @@ class Emergencypurchaseorder extends BaseController if (count($mrirmaster) > 0) { foreach ($mrirmaster as $key) { - $MRIRNO = $key->MRIRNo; + $MRIRNO = $key->MRIRNO; } } @@ -1231,7 +1235,8 @@ class Emergencypurchaseorder extends BaseController $InsuranceValue = $this->request->getPost('Insval' . $i); $TotalOrderValue = $this->request->getPost('TotalOrderValue' . $i); $CostCenter = $this->request->getPost('costCode' . $i); - + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; if (count($comma_separated) > 0) { for ($j = 1; $j < count($comma_separated); $j++) { @@ -1398,7 +1403,8 @@ class Emergencypurchaseorder extends BaseController /*----------end--------------------*/ - + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; if (count($comma_separated) > 0) { @@ -1525,6 +1531,6 @@ class Emergencypurchaseorder extends BaseController $this->purchaseorder_model->DeletePOServiceTax($LineItemNo); } $this->purchaseorder_model->DeletePOLineItem($LineItemNo, $ReqNo, $MaterialCode); - echo "Successfully Deleted the Line item" . $LineItemNo; + echo "Successfully Deleted the Line item " . $LineItemNo; } } diff --git a/app/Controllers/Employeedetails.php b/app/Controllers/Employeedetails.php index aa6e91d0..7f0aa25a 100755 --- a/app/Controllers/Employeedetails.php +++ b/app/Controllers/Employeedetails.php @@ -481,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() { diff --git a/app/Controllers/Inwardgateregister.php b/app/Controllers/Inwardgateregister.php index a66fabb8..e7f3a97a 100755 --- a/app/Controllers/Inwardgateregister.php +++ b/app/Controllers/Inwardgateregister.php @@ -1416,6 +1416,8 @@ function updateIGRWeight(){ 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, diff --git a/app/Controllers/Payslip.php b/app/Controllers/Payslip.php index 5e3aae25..977045c3 100755 --- a/app/Controllers/Payslip.php +++ b/app/Controllers/Payslip.php @@ -10,6 +10,7 @@ use CodeIgniter\Validation\Exceptions\ValidationException; use App\Models\Monthlypay_model; use App\Models\Payroll_model; +use App\Models\Driver_model; use Mpdf\Mpdf; use PhpOffice\PhpSpreadsheet\Spreadsheet; @@ -33,6 +34,7 @@ class Payslip extends BaseController { protected $payroll_model; protected $monthlypay_model; + protected $driver_model; protected $session; /** @@ -43,6 +45,7 @@ class Payslip extends BaseController parent::__construct(); $this->payroll_model = new Payroll_model(); $this->monthlypay_model = new Monthlypay_model(); + $this->driver_model = new Driver_model(); $this->session = session(); helper('form'); //$this->load->library('form_validation'); $this->isLoggedIn(); @@ -590,20 +593,20 @@ class Payslip extends BaseController public function monthlyInputs() { - $current = date("m-Y"); - + $current = $this->request->getPost('monthyear') ? $this->request->getPost('monthyear') :date("m-Y"); $data['month'] = $this->monthlypay_model->monthlyListing($current); $data['dropdownvalue'] = $current; $data['fresh'] = $this->monthlypay_model->getEmpPayDetailsforMonthInputs($current); - + // dd($data['fresh']); + $data['drivermonthinputs'] = $this->driverMonthlyPayInputs($current); $employeeSalary = []; $esi = []; $pf = []; $ot = []; foreach ($data['fresh'] as $value) { - + $is_driver = $value->is_driver; $NoofDays = $value->NoofDays; //Month day 30,31,28 $HRA_Amount = $value->HRA_Amount; $Basic_Pay = $value->Basic_Pay; @@ -623,6 +626,11 @@ class Payslip extends BaseController $Loan_Recovered = $value->Loan_Recovered; //MANUAL LOAN DUE $due_start_date = $value->DueDate; $paydate = $current; //From POST parm + if (strlen((string)$paydate) == 6) { + $paydate = '0' . $paydate; + } + $pmonth = substr($paydate, 0, 2); + $pyear = substr($paydate, -4); $pmonth = substr($paydate, 0, 2); $pyear = substr($paydate, -4); @@ -722,6 +730,158 @@ class Payslip extends BaseController $this->loadViews("monthlypayinputs", $this->global, $data, NULL); } + public function driverMonthlyPayInputs($current) + { + + list($month, $year) = explode('-', $current); + + $month_in_number = get_date_time_dynamical_format('n','m',"$month");// refer helper + + $get_last_date_of_the_month = cal_days_in_month(CAL_GREGORIAN, $month_in_number, $year); + + $from_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"01-$month_in_number-$year"); + $to_mysql_date = get_date_time_dynamical_format('d-m-Y','Y-m-d',"$get_last_date_of_the_month-$month_in_number-$year"); + + // $data['monthinputs'] + $load_driver_data = $this->driver_model->driverAttendanceForMonthlyPayInputs($from_mysql_date,$to_mysql_date); + // dd($load_driver_data); + + + $format_month_year = get_date_time_dynamical_format('n-Y','m-Y',"$current"); + + $monthly_pay_data = $this->driver_model->driverMonthlyPayInputs($format_month_year); + + + + // both foreach refer with chatgpt array data replacement.... + $monthly_pay_array = []; + foreach ($monthly_pay_data as $row) { + $monthly_pay_array[$row->driver_id] = $row; + } + + for ($i = 0; $i < count((array)$load_driver_data); $i++) { + $driver_id = $load_driver_data[$i]->driver_id; + if (isset($monthly_pay_array[$driver_id])) { + + $PF_Rate = $load_driver_data[$i]->PF_Rate; + $ESI_Rate = $load_driver_data[$i]->ESI_Rate; + + $monthly_salary_amount = isset($load_driver_data[$i]->monthly_salary_amount) ? (int)$load_driver_data[$i]->monthly_salary_amount : 0; + $monthly_food_amount = isset($load_driver_data[$i]->monthly_food_amount) ? (int)$load_driver_data[$i]->monthly_food_amount : 0; + $final_salary_amount = $monthly_salary_amount+$monthly_food_amount; + + $shed = isset($load_driver_data[$i]->shed_amount) ? (int)$load_driver_data[$i]->shed_amount : 0; + $diesel = isset($load_driver_data[$i]->diesel_amount) ? (int)$load_driver_data[$i]->diesel_amount : 0; + + $load_driver_data[$i]->driver_salary = $final_salary_amount; + $load_driver_data[$i]->driver_shed = $shed; + $load_driver_data[$i]->driver_diesel = $diesel; + + $Monthly_Due = $load_driver_data[$i]->Monthly_Due; // AUTO LOAN DUE + $Loan_Recovered = $load_driver_data[$i]->Loan_Recovered; //MANUAL LOAN DUE + $loan = 0; + $due_start_date = $load_driver_data[$i]->DueDate; + $paydate = $current; //From POST parm + if ($Loan_Recovered == 'NA') { + $loan = 0.00; + } else if ($Loan_Recovered == 0.00) { + if (strtotime($due_start_date) <= strtotime($to_mysql_date)) { + $loan = $Monthly_Due; + } + } else if ($Loan_Recovered >= 0.00) { + if (strtotime($due_start_date) <= strtotime($to_mysql_date)) { + $loan = $Loan_Recovered; + } + } + + $Loan_amount = $load_driver_data[$i]->Loan_Amount; + $Paid_Amount = $load_driver_data[$i]->Paid_Amount; + $Balance_Amount = $Loan_amount - $Paid_Amount; + if ($Monthly_Due > $Balance_Amount) { + $loan = $Balance_Amount; + } + + $empSalaryAdd = $final_salary_amount+$shed+$diesel; + $empSalarySub = $loan; + $salaryInCurrentday = $empSalaryAdd - $empSalarySub; + $load_driver_data[$i]->driver_final_payment = $salaryInCurrentday; + + $load_driver_data[$i]->payroll_id = $monthly_pay_array[$driver_id]->payroll_id; + $load_driver_data[$i]->Festival_Bonus = $monthly_pay_array[$driver_id]->Festival_Bonus; + + $basic = ($final_salary_amount+$shed+$diesel) * 70 / 100; + $hra = ($final_salary_amount+$shed+$diesel) * 30 / 100; + + $load_driver_data[$i]->basic_worked = $basic; + $load_driver_data[$i]->hra_worked = $hra; + + $load_driver_data[$i]->esi_amount = ($load_driver_data[$i]->esi_applicable == 1) ? ($basic) * $ESI_Rate / 100 : 0; + $load_driver_data[$i]->pf_amount = ($load_driver_data[$i]->pf_applicable == 1) ? ($basic) * $PF_Rate / 100 : 0; + $load_driver_data[$i]->total_cal_days = $get_last_date_of_the_month; + + }else { + $PF_Rate = $load_driver_data[$i]->PF_Rate; + $ESI_Rate = $load_driver_data[$i]->ESI_Rate; + + $monthly_salary_amount = isset($load_driver_data[$i]->monthly_salary_amount) ? (int)$load_driver_data[$i]->monthly_salary_amount : 0; + $monthly_food_amount = isset($load_driver_data[$i]->monthly_food_amount) ? (int)$load_driver_data[$i]->monthly_food_amount : 0; + $final_salary_amount = $monthly_salary_amount+$monthly_food_amount; + $shed = isset($load_driver_data[$i]->shed_amount) ? (int)$load_driver_data[$i]->shed_amount : 0; + $diesel = isset($load_driver_data[$i]->diesel_amount) ? (int)$load_driver_data[$i]->diesel_amount : 0; + + $load_driver_data[$i]->driver_salary = $final_salary_amount; + $load_driver_data[$i]->driver_shed = $shed; + $load_driver_data[$i]->driver_diesel = $diesel; + + $load_driver_data[$i]->payroll_id = ''; + $load_driver_data[$i]->Festival_Bonus = 0; + + $basic = ($final_salary_amount+$shed+$diesel) * 70 / 100; + $hra = ($final_salary_amount+$shed+$diesel) * 30 / 100; + $load_driver_data[$i]->basic_worked = $basic; + $load_driver_data[$i]->hra_worked = $hra; + + $load_driver_data[$i]->esi_amount = ($load_driver_data[$i]->esi_applicable == 1) ? ($basic) * $ESI_Rate / 100 : 0; + $load_driver_data[$i]->pf_amount = ($load_driver_data[$i]->pf_applicable == 1) ? ($basic) * $PF_Rate / 100 : 0; + + + $Monthly_Due = $load_driver_data[$i]->Monthly_Due; // AUTO LOAN DUE + $Loan_Recovered = $load_driver_data[$i]->Loan_Recovered; //MANUAL LOAN DUE + $loan = 0; + $due_start_date = $load_driver_data[$i]->DueDate; + $paydate = $current; //From POST parm + if ($Loan_Recovered == 'NA') { + $loan = 0.00; + } else if ($Loan_Recovered == 0.00) { + if (strtotime($due_start_date) <= strtotime($to_mysql_date)) { + $loan = $Monthly_Due; + } + } else if ($Loan_Recovered >= 0.00) { + if (strtotime($due_start_date) <= strtotime($to_mysql_date)) { + $loan = $Loan_Recovered; + } + } + + $Loan_amount = $load_driver_data[$i]->Loan_Amount; + $Paid_Amount = $load_driver_data[$i]->Paid_Amount; + $Balance_Amount = $Loan_amount - $Paid_Amount; + if ($Monthly_Due > $Balance_Amount) { + $loan = $Balance_Amount; + } + + $empSalaryAdd = $final_salary_amount; + $empSalarySub = $loan; + $salaryInCurrentday = $empSalaryAdd - $empSalarySub; + $load_driver_data[$i]->driver_final_payment = $salaryInCurrentday+$shed+$diesel; + $load_driver_data[$i]->total_cal_days = $get_last_date_of_the_month; + + } + } + // dd($load_driver_data); + return $load_driver_data; + + } + function changeMonth() { @@ -857,6 +1017,11 @@ class Payslip extends BaseController $data['esi'] = $esi; $data['pf'] = $pf; $data['over_time'] = $ot; + + + + + // dd($data); //echo sizeof($data['fresh'])."-".sizeof($data['empSalary']);die; $this->global['pageTitle'] = 'Payroll Monthly Inputs'; @@ -892,7 +1057,6 @@ class Payslip extends BaseController $month = $mon . "-" . $year; - //echo $month;die(); $total = 0; $ErrorEmpId = ''; $TotalErrorFlag = 0; @@ -1002,7 +1166,9 @@ class Payslip extends BaseController $EmpID = $j['Emp ID']; + $is_driver = $this->driver_model->getDriverName($EmpID,1); $DaysWorked = $j['Days Worked']; + $NoTrips = isset($j['Number Of Trips']) ? $j['Number Of Trips'] : 0.00 ; $TotalCalDays = isset($j['Total Days']) ? $j['Total Days'] : 0.00 ; $ActualSalary = isset($j['Basic Salary']) ? $j['Basic Salary'] : 0.00 ; $WorkedSalary = isset($j['Worked Salary']) ? $j['Worked Salary'] : 0.00 ; @@ -1020,8 +1186,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 +1215,41 @@ 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, + 'TotalCalDays' => $TotalCalDays, + 'no_of_loads'=>(strpos($NoTrips, "(trip)") !== false) ? explode(" ", $NoTrips)[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 +1295,7 @@ class Payslip extends BaseController public function viewGenerator() { + $Data['Payon'] = $this->payroll_model->getPayOn(); $this->global['pageTitle'] = 'Payroll Generater'; @@ -1112,7 +1317,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 +1329,7 @@ class Payslip extends BaseController foreach ($result as $list) { - - $HTML .= ""; + $HTML .= ""; } } echo $HTML; @@ -1172,6 +1380,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 +1405,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 +1439,8 @@ class Payslip extends BaseController // echo view("payslipgenerateprint", $Data);die; $html = view("payslipgenerateprint", $Data); } + + } $mpdf = new Mpdf([ @@ -1231,7 +1462,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 +1761,24 @@ class Payslip extends BaseController { $empid = $this->request->getPost('employee'); $payon = $this->request->getPost('payon'); - $result = $this->payroll_model->checkExistPayData($empid, $payon); - echo json_encode(count($result)); + $is_driver = $this->driver_model->getDriverName($empid,1); + if($is_driver){ + $result = $this->driver_model->checkDriverExistPay($empid, $payon); + $data['count'] = count($result); + $data['path'] = "driverPayslip"; + echo json_encode($data); + }else{ + $result = $this->payroll_model->checkExistPayData($empid, $payon); + $data['count'] = count($result); + $data['path'] = "payslip/callsp"; + echo json_encode($data); + } + + } + + function convertNumber($amt) diff --git a/app/Controllers/Purchaseorder.php b/app/Controllers/Purchaseorder.php index e96f797a..ee194634 100755 --- a/app/Controllers/Purchaseorder.php +++ b/app/Controllers/Purchaseorder.php @@ -1226,7 +1226,8 @@ class Purchaseorder extends BaseController $AfterSgst = $this->request->getPost('RevenueAfterSgst' . $i); $AfterIgst = $this->request->getPost('RevenueAfterIgst' . $i); $LineitemAuditorNotes = $this->request->getPost('LineItemNoteForAuditor' . $i); - + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; if (count($comma_separated) > 0) { for ($j = 1; $j < count($comma_separated); $j++) { @@ -1437,7 +1438,8 @@ class Purchaseorder extends BaseController $this->purchaseorder_model->insertlogpo($logpo); } - + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; if (count($comma_separated) > 0) { for ($j = 1; $j < count($comma_separated); $j++) { @@ -1962,7 +1964,7 @@ class Purchaseorder extends BaseController $this->purchaseorder_model->DeletePOServiceTax($LineItemNo); } $this->purchaseorder_model->DeletePOLineItem($LineItemNo, $ReqNo, $MaterialCode); - echo "Successfully Deleted the Line item" . $LineItemNo; + echo "Successfully Deleted the Line item " . $LineItemNo; } @@ -2111,6 +2113,8 @@ class Purchaseorder extends BaseController $per = $this->request->getPost('Per' . $i); $LineitemAuditorNotes = $this->request->getPost('LineItemNoteForAuditor' . $i); + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; if (count($comma_separated) > 0) { for ($j = 1; $j < count($comma_separated); $j++) { @@ -2452,6 +2456,8 @@ class Purchaseorder extends BaseController //die(); $currencytypeID = $this->request->getPost('currencytype'); + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; if (count($comma_separated) > 0) { for ($j = 1; $j < count($comma_separated); $j++) { @@ -2839,6 +2845,8 @@ class Purchaseorder extends BaseController $CapitalItemDescription = $this->request->getPost('CapitalItemDescrition' . $i); $Per = $this->request->getPost('per' . $i); $LineitemAuditorNotes = $this->request->getPost('LineItemNoteForAuditor' . $i); + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; if (count($comma_separated) > 0) { for ($j = 1; $j < count($comma_separated); $j++) { @@ -3189,7 +3197,8 @@ class Purchaseorder extends BaseController /*----------end--------------------*/ - + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $SkipInsert = "False"; if (count($comma_separated) > 0) { for ($j = 1; $j < count($comma_separated); $j++) { @@ -3279,7 +3288,8 @@ class Purchaseorder extends BaseController } else { $LineItemNo = $POLineItemNo; - + if($itemRate != 0){ + $this->purchaseorder_model->updateMaterialRate($MaterialCode, $itemRate); } $POLineItemList = array('PONO' => $PONO, 'ReqNo' => $Reqnumber, 'MaterialCode' => $MaterialCode, 'Quantity' => $Quantity, 'Rate' => $itemRate, 'Status' => $LineItemStatus, 'CreatedBy' => $CreateBy, 'CostCenterCode' => $CostCenter, 'ServiceMaterialDescription' => $CapitalItemDescription, 'Per' => $Per,'LineitemAuditorNotes'=>$LineitemAuditorNotes); $POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO, $LineItemNo, $POLineItemList); @@ -4488,6 +4498,7 @@ class Purchaseorder extends BaseController $supplierid = $this->request->getPost('supplierid'); $materialcode = $this->request->getPost('materialcode'); $result = $this->purchaseorder_model->VerifyWithSupplierForPendingPO($supplierid, $materialcode); + $materialrate = $this->purchaseorder_model->materialRate($materialcode); $response = ""; if (!empty($result)) { diff --git a/app/Controllers/Rawmaterialdetails.php b/app/Controllers/Rawmaterialdetails.php index 0c48421e..ef947deb 100755 --- a/app/Controllers/Rawmaterialdetails.php +++ b/app/Controllers/Rawmaterialdetails.php @@ -261,9 +261,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); @@ -323,6 +323,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; @@ -343,14 +344,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); diff --git a/app/Controllers/Sales.php b/app/Controllers/Sales.php index 48b2656b..a58fb3ee 100755 --- a/app/Controllers/Sales.php +++ b/app/Controllers/Sales.php @@ -118,6 +118,44 @@ class Sales extends BaseController $this->loadViews("sales_invoice", $this->global, $data, NULL); } + + public function sales_report() + { + $headline = ''; + $report = []; + + if ($this->request->getMethod(true) === 'POST' && $this->request->getPost('btn_submit')) { + + + $from_date = $this->request->getPost('from_date'); + $to_date = $this->request->getPost('to_date'); + $hsn_number = $this->request->getPost('hsn_number'); + $product_id = $this->request->getPost('product'); + $client_id = $this->request->getPost('client'); + + + + $headline .= ((isset($from_date) && isset($to_date)) && (!empty($from_date) && !empty($to_date))) ? $from_date . ' to ' . $to_date. ', ' : ''; + $headline .= (isset($hsn_number) && !empty($hsn_number)) ? $hsn_number . ', ' : ''; + $headline .= (isset($product_id) && !empty($product_id)) ? $this->ipinvoice_model->getProductName($product_id) . ', ' : ''; + $headline .= (isset($client_id) && !empty($client_id)) ? $this->ipinvoice_model->getClientName($client_id) . ', ' : ''; + + + + $report = $this->ipinvoice_model->sales_report($from_date, $to_date, $hsn_number, $product_id, $client_id); + } + $data['hsn'] = $this->ipinvoice_model->getHsn(); + $data['product'] = $this->ipinvoice_model->getProducts(); + $data['client'] = $this->ipinvoice_model->getClients(); + + $data['headline'] = $headline; + $data['sales_invoice'] = $report; + + // Load the view + $this->global['pageTitle'] = 'Reports'; + $this->loadviews("report_sales", $this->global, $data, NULL); + } + public function download_sales_invoice() { // Fetch data from the model diff --git a/app/Controllers/Servicepurchaseorder.php b/app/Controllers/Servicepurchaseorder.php index 6f810d46..9207e172 100755 --- a/app/Controllers/Servicepurchaseorder.php +++ b/app/Controllers/Servicepurchaseorder.php @@ -341,7 +341,7 @@ class Servicepurchaseorder extends BaseController } } } - echo 'Service Purchase Order Created Successfully!The PO NO Is: ' . $PONO; + echo 'Service Purchase Order Created Successfully! PO Number Is: ' . $PONO; } //update service po function UpdateServicePurchaseOrder() diff --git a/app/Controllers/User.php b/app/Controllers/User.php index 04999c49..1f962afc 100755 --- a/app/Controllers/User.php +++ b/app/Controllers/User.php @@ -1380,6 +1380,10 @@ class User extends BaseController $headers_new = $result['headers_new']; $res = json_decode($result['data'], true); $inv_array = $res['invoices']; + + // $cteditNotes = getAllCreditNotes($date_today, $date_yesterday, $token); + // dd($cteditNotes); + // dd($inv_array); // print_r($inv_array); // echo "rrrr"; @@ -1400,6 +1404,7 @@ class User extends BaseController // dd($res2); foreach ($res2 as $rs) { + $gst_no = $rs['gst_no']; $customer_id = $rs['customer_id']; $customer_name = $rs['customer_name']; @@ -1550,7 +1555,7 @@ class User extends BaseController if (isset($rs['line_items']) && count($rs['line_items']) > 0) { log_message('error', 'Processing line items' . count($rs['line_items'])); - dd($rs); + // dd($rs); for ($i = 0; $i < count($rs['line_items']); $i++) { //start insert line items $sku = $rs['line_items'][$i]['sku']; diff --git a/app/Helpers/zohobook_helper.php b/app/Helpers/zohobook_helper.php index bfce0ba3..4d957e05 100755 --- a/app/Helpers/zohobook_helper.php +++ b/app/Helpers/zohobook_helper.php @@ -110,4 +110,94 @@ if (! function_exists('test_helper')) { } } +if (! function_exists('getAllCreditNotes')) { + // function getAllCreditNotes($date_today, $date_yesterday, $accesstoken) + // { + // // Initialize cURL + // $ch = curl_init(); + + // // Zoho API credentials + // $organization_id = '776847408'; + // // $url_org = "https://books.zoho.com/api/v3/creditnotes?"; + // $url_org = "https://www.zohoapis.com/books/v3/creditnotes?"; + + // // Construct query parameters + // $fields = array( + // "usestate" => "true", + // "organization_id" => $organization_id, + // "date_start" => $date_yesterday, + // "date_end" => $date_today + // ); + // $data_all = http_build_query($fields); + + // // Set headers + // $headers = array( + // 'Authorization: Zoho-oauthtoken '.$accesstoken, + // 'Content-Type: application/json' + // ); + + // // Construct URL + // $data_access = $url_org.$data_all; + + // // Set cURL options + // curl_setopt($ch, CURLOPT_URL, $data_access); + // curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + + // curl_setopt($ch, CURLOPT_HEADER, 0); + // curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); + // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + + // // Execute cURL request + // $result = curl_exec($ch); + + // // Store headers and data + // $data['headers_new'] = $headers; + // $data['data'] = curl_exec($ch); + // // Return data + // return $data; + // } + + function getAllCreditNotes($date_today, $date_yesterday, $accesstoken) + { + // Initialize cURL + $ch = curl_init(); + var_dump($accesstoken); + // Zoho API credentials + $organization_id = '776847408'; + $url_org = "https://books.zoho.com/api/v3/creditnotes?"; + + // Construct query parameters manually (Zoho might need raw values) + $query_string = "usestate=true&organization_id=$organization_id&date_start=$date_yesterday&date_end=$date_today"; + + // Set headers + $headers = array( + 'Authorization: Zoho-oauthtoken ' . $accesstoken, + 'Content-Type: application/json' + ); + + // Set cURL options + curl_setopt($ch, CURLOPT_URL, $url_org . $query_string); + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + + // Execute cURL request + $result = curl_exec($ch); + + // Check for errors + if ($result === false) { + return ['error' => curl_error($ch)]; + } + + // Close cURL session + curl_close($ch); + + return [ + 'headers_new' => $headers, + 'data' => $result + ]; + } + +} + ?> \ No newline at end of file diff --git a/app/Models/Costcenter_model.php b/app/Models/Costcenter_model.php index bb7105ea..4e57be36 100755 --- a/app/Models/Costcenter_model.php +++ b/app/Models/Costcenter_model.php @@ -400,7 +400,8 @@ where Dept.DEPCode not in } } - return "Cost center $CostCenterCode Reactivated successfully."; + // return "Cost center $CostCenterCode Reactivated successfully."; + return true; } function deleteCostCenter($CostCenterCode,$UpdatedBy) @@ -427,7 +428,8 @@ where Dept.DEPCode not in } } - return "Cost center $CostCenterCode deactivated successfully."; + // return "Cost center $CostCenterCode deactivated successfully."; + return true; } function checkCostCenter($CostCenterId,$CostCenterName){ diff --git a/app/Models/Driver_model.php b/app/Models/Driver_model.php index 843cd5e8..d0b5e716 100755 --- a/app/Models/Driver_model.php +++ b/app/Models/Driver_model.php @@ -21,7 +21,7 @@ class Driver_model extends Model { $this->table = 't_driver_attendance'; $this->primaryKey = 'driver_attendance_id'; - $this->allowedFields = ['driver_attendance_id','date','driver_id','invoice_number','vehicle_number','load_type','salary_amount','food_amount','created_on','created_by','updated_on','updated_by','isactive']; + $this->allowedFields = ['driver_attendance_id','date','driver_id','invoice_number','vehicle_number','load_type','salary_amount','food_amount','created_on','created_by','updated_on','updated_by','isactive','diesel_amount','shed_amount']; return $this; } @@ -47,11 +47,11 @@ class Driver_model extends Model return $this->table . '.' . $field; }, $this->allowedFields)); - $selectFields = "CONCAT_WS(' ', t_employee_details.FirstName, t_employee_details.LastName) AS FullName, t_employee_details.IsActive as employee_isactive, t_driver.driver_name,ip_clients.client_name as customer,ip_invoices.received_qty as quantity,t_driver_payroll.id as payroll_id,t_driver_payroll.PayOn," . $fields; + $selectFields = "CONCAT_WS(' ', t_employee_details.FirstName, t_employee_details.LastName) AS FullName, t_employee_details.IsActive as employee_isactive, CONCAT_WS(' ', driver.FirstName, driver.LastName) AS driver_name,ip_clients.client_name as customer,ip_invoices.received_qty as quantity,t_driver_payroll.id as payroll_id,t_driver_payroll.PayOn," . $fields; $month_year = get_date_time_dynamical_format('Y-m-d','m-Y',"$from"); return $this->select($selectFields) - ->join('t_driver', 't_driver.driver_id = ' . $this->table . '.driver_id', 'left') + ->join('t_employee_details as driver', 'driver.EmpID = ' . $this->table . '.driver_id', 'left') ->join('tbl_users', 'tbl_users.userId = ' . $this->table . '.created_by', 'left') ->join('t_employee_details', 'tbl_users.EmpID = t_employee_details.EmpID', 'left') ->join('ip_invoices', 'ip_invoices.invoice_number = ' . $this->table . '.invoice_number', 'left') @@ -60,6 +60,7 @@ class Driver_model extends Model ->where($this->table.'.date BETWEEN "'.$from.'" AND "'.$to.'"') ->where($this->table . '.driver_id', $driver_id) ->where($this->table . '.isactive', 1) + ->where('driver.is_driver', 1) ->findAll(); } @@ -71,17 +72,24 @@ class Driver_model extends Model return $query->getResult(); } - function getDriverName($id) + function getDriverName($id,$flag) { - $builder = $this->db->table('t_driver') - ->select('driver_name') - ->where('driver_id', $id); + $builder = $this->db->table('t_employee_details') + ->select('CONCAT_WS(" ", t_employee_details.FirstName, t_employee_details.LastName) as driver_name,is_driver') + ->where('EmpID', $id); $query = $builder->get()->getRow(); - $driver_name = $query ? $query->driver_name : null; - - return $driver_name; + if ($flag == 0){ + $driver_name = $query ? $query->driver_name : null; + return $driver_name; + } + if ($flag == 1){ + $is_driver = $query ? $query->is_driver : null; + return $is_driver; + } + return null; + } function gatheredCustAndQty($invoice){ @@ -92,20 +100,30 @@ class Driver_model extends Model $query = $builder->get(); return $query->getRowArray() ?: []; } - - + function driverAttendanceForMonthlyPayInputs($from,$to){ $builder = $this->db->table('t_driver_attendance') - ->select('t_driver_attendance.driver_id,SUM(t_driver_attendance.salary_amount) as driver_monthly_salary_amount,SUM(t_driver_attendance.food_amount) as driver_monthly_food_amount,t_driver.driver_name, - DATE_FORMAT(date, "%M-%Y") AS month_year,SUM(salary_amount + food_amount) AS driver_earnings_amount,COUNT(t_driver_attendance.load_type) AS no_of_loads') - ->join('t_driver', 't_driver.driver_id = t_driver_attendance.driver_id and t_driver.isactive = 1', 'left') + ->select('t_driver_attendance.driver_id,driver_details.FirstName as driver_name,driver_details.is_driver,COUNT(DISTINCT t_driver_attendance.date) AS unique_days, + DATE_FORMAT(date, "%M-%Y") AS month_year,COUNT(t_driver_attendance.load_type) AS no_of_loads,driver_details.*,t_emp_pay_data.PF_Rate,t_emp_pay_data.ESI_Rate') + ->select('SUM(t_driver_attendance.salary_amount) as monthly_salary_amount, + SUM(t_driver_attendance.food_amount) as monthly_food_amount, + diesel_amount,shed_amount,CONCAT_WS(" ", driver_details.FirstName, driver_details.LastName) AS FullName') + ->select('t_loan_master.Loan_ID,Loan_Amount,Loan_Issued_Date,Monthly_Due,Due_Start_Date as DueDate,No_of_Dues,Paid_Due,Remaining_Due,Paid_Amount,t_loan_history.Balance_Amount, t_driver_monthly_pay_inputs.Loan_Recovered') + ->join('t_employee_details as driver_details', 'driver_details.EmpID = t_driver_attendance.driver_id', 'left') + ->join('t_emp_pay_data','t_emp_pay_data.EmpID=driver_details.EmpID','Left') + ->join('t_loan_master','t_loan_master.EmpID = driver_details.EmpID','Left') + ->join('t_loan_history','t_loan_history.Loan_ID = t_loan_master.Loan_ID','Left') + ->join('t_driver_monthly_pay_inputs','t_driver_monthly_pay_inputs.driver_id = driver_details.EmpID','Left') ->where('t_driver_attendance.date BETWEEN "'.$from.'" AND "'.$to.'"') - ->groupBy('t_driver.driver_id, DATE_FORMAT(t_driver_attendance.date, "%M-%Y")'); - + ->groupBy('DATE_FORMAT(t_driver_attendance.date, "%M-%Y"),t_driver_attendance.driver_id'); $query = $builder->get(); + // $last_query = $this->db->getLastQuery(); + // echo $last_query;die; return $query->getResult(); } + + function driverMonthlyPayInputs($monthYear){ $builder = $this->db->table('t_driver_monthly_pay_inputs'); @@ -142,13 +160,13 @@ class Driver_model extends Model if ($count == 0) { - unset($data['updated_by']); + unset($data['updated_by']);// we need createdby. thats why updatedby unset $builder = $this->db->table('t_driver_monthly_pay_inputs'); $builder->insert($data); $i = $this->db->affectedRows(); return $i; } elseif ($count == 1) { - unset($data['created_by']); + unset($data['created_by']); // we need updatedby. thats why createdby unset $this->db->table('t_driver_monthly_pay_inputs') ->where('driver_id', $data['driver_id']) ->where('month_year', $data['month_year']) @@ -158,7 +176,21 @@ class Driver_model extends Model return $i; } } - + function updateDieselAndShedValuesBasedonEmpID($where_arr,$data){ + $this->db->table('t_driver_attendance') + ->where($where_arr) + ->update($data); + $i = $this->db->affectedRows(); + return $i; + } + public function getDriverAttendanceTable($input_driver_id,$monthyear){ + $builder = $this->db->table('t_driver_attendance') + ->where('DATE_FORMAT(`t_driver_attendance`.`date`, "%Y-%m")',$monthyear) + ->where('t_driver_attendance.driver_id',$input_driver_id); + $query = $builder->get()->getRow(); + // $last_query = $this->db->getLastQuery(); + return $query; + } function getPayOn() { $builder = $this->db->table('t_driver_monthly_pay_inputs') @@ -171,8 +203,8 @@ class Driver_model extends Model function getDriverlist2($Payon = '') { $builder = $this->db->table('t_driver_monthly_pay_inputs Pay') - ->select('Pay.driver_id as driver_id,driver.driver_name as name') - ->join('t_driver driver', 'Pay.driver_id = driver.driver_id'); + ->select('Pay.driver_id,driver.EmpID as EmpId,CONCAT_WS(" ", driver.FirstName, driver.LastName) AS FullName') + ->join('t_employee_details as driver', 'driver.EmpID = Pay.driver_id and driver.is_driver = 1', 'left'); if ($Payon != '') { $builder->where('Pay.month_year', $Payon); } @@ -196,14 +228,32 @@ class Driver_model extends Model function getMonthlyPayDetails($driver_id, $PayOn) { $builder = $this->db->table('t_driver_monthly_pay_inputs MonthlyPay ') - ->select('MonthlyPay.*') + ->select('CONCAT_WS(" ", driver.FirstName, driver.LastName) AS FullName') + ->select('MonthlyPay.*,driver.BankAccountNo , driver.PFNO , driver.ESI as ESINO , L.Loan_ID, L.Loan_Amount, L.Loan_Issued_Date, L.Monthly_Due, L.Due_Start_Date, L.No_of_Dues, L.Paid_Due, L.Remaining_Due, L.Paid_Amount') + ->join('t_employee_details as driver', 'driver.EmpID = MonthlyPay.driver_id and driver.is_driver = 1', 'left') + ->join('t_loan_master as L', 'MonthlyPay.driver_id = L.EmpID and L.is_Active = 1', 'left') ->where('MonthlyPay.driver_id', $driver_id) ->where('MonthlyPay.month_year', $PayOn); $query = $builder->get(); return $query->getResult(); } - + function insertLoanHistory($data) + { + $builder = $this->db->table('t_loan_history'); + $builder->insert($data); + $count = $this->db->affectedRows(); + return $count; + } + function updateLoan($LoanID,$EmpID,$data) + { + $builder = $this->db->table('t_loan_master') + ->where('Loan_ID', $LoanID) + ->where('EmpID', $EmpID) + ->update($data); + $count = $this->db->affectedRows(); + return $count; + } function insertPayroll($data) { $builder = $this->db->table('t_driver_payroll'); @@ -230,8 +280,17 @@ class Driver_model extends Model function GetPayslipdata($PayOn = '', $EmpId = '') { //echo "FROM MODEL" . $PayOn . $EmpId; - $builder = $this->db->table('t_driver_payroll Pay')->select('Pay.*,driver.driver_name as name ') - ->join('t_driver driver', 'Pay.driver_id = driver.driver_id'); + + + $builder = $this->db->table('t_driver_payroll Pay')->select('Pay.*') + ->select('Emp.EmpID,CONCAT_WS(" ", Emp.FirstName, Emp.LastName) as driver_name,Emp.DateofBirth as Dob,Emp.PANNo as Pan,Emp.BankBranchName as BankName,Emp.BankAccountNo as BankAccountNumber,Emp.IFSCCode as IFSCCode,Emp.DateofJoining as DOJ,Emp.AadharNo,Emp.Designation as Designation,Dep.DepartmentName as DeptName,Emp.esi_applicable,Emp.pf_applicable') + ->select('t_emp_pay_data.PF_Rate,t_emp_pay_data.ESI_Rate') + ->select('month.Festival_Bonus,month.HRA,month.Loan_Recovered,month.total_diesel_amount,month.total_shed_amount') + // ->select('month.monthly_salary_amount,month.monthly_food_amount,month.Festival_Bonus,month.final_payment,month.HRA,month.ESI,month.PF,month.Loan_Recovered,month.total_diesel_amount,month.total_shed_amount') + ->join('t_employee_details Emp', 'Pay.driver_id = Emp.EmpID') + ->join('t_departmentdetails Dep', 'Emp.Departmentcode = Dep.DEPCode') + ->join('t_emp_pay_data','t_emp_pay_data.EmpID=Emp.EmpID','Left') + ->join('t_driver_monthly_pay_inputs month', 'month.driver_id = Emp.EmpID'); if ($PayOn != '') { $builder->where('Pay.PayOn', $PayOn); } diff --git a/app/Models/Employeedetails_model.php b/app/Models/Employeedetails_model.php index 48e3eed2..a69ac2fa 100755 --- a/app/Models/Employeedetails_model.php +++ b/app/Models/Employeedetails_model.php @@ -172,6 +172,17 @@ class Employeedetails_model extends Model return $query; } + function checkMobileExists($ContactNumber= '', $Empid = ''){ + $builder = $this->db->table('t_employee_details')->select('ContactNumber') + ->where('ContactNumber', $ContactNumber); + if ($Empid != '') { + $builder->where('EmpID !=', $Empid); + } + $query = $builder->get(); + + return $query; + } + function checkAadharExists($aadharNo, $Empid = '') { diff --git a/app/Models/Inwardgateregister_model.php b/app/Models/Inwardgateregister_model.php index 64249fc8..e93e7286 100755 --- a/app/Models/Inwardgateregister_model.php +++ b/app/Models/Inwardgateregister_model.php @@ -409,6 +409,7 @@ class Inwardgateregister_model extends Model LEFT JOIN t_purchaseorder_lineitem POL ON PONO = POL.PONO AND IGRD.MaterialCode = POL.MaterialCode LEFT JOIN t_revenue_tax tax ON tax.LineItemNo = POL.LineItemNo WHERE IGRD.IGRNO = igr.IGRNO AND IGRD.QuantityAsPerInvoice != 0 + GROUP BY POL.PONO LIMIT 1 ) WHEN (PO.POType = 'service' OR (PO.POType = 'capital' AND PO.CapitalRange = '1')) THEN ( @@ -420,6 +421,7 @@ class Inwardgateregister_model extends Model LEFT JOIN t_purchaseorder_lineitem POL ON PONO = POL.PONO AND IGRD.MaterialCode = POL.MaterialCode LEFT JOIN t_service_tax tax ON tax.LineItemNo = POL.LineItemNo WHERE IGRD.IGRNO = igr.IGRNO AND IGRD.QuantityAsPerInvoice != 0 + GROUP BY POL.PONO LIMIT 1 ) @@ -1348,6 +1350,16 @@ $builder = $this->db->table('t_igr_history') return $result; } + public function get_status($value){ + $builder = $this->db->table('t_status') + ->select('StatusCode,StatusName') + ->where('StatusCode', $value); + + $query = $builder->get()->getRow(); + + $StatusName = $query ? $query->StatusName : null; + return $StatusName; + } } \ No newline at end of file diff --git a/app/Models/Ipinvoice_model.php b/app/Models/Ipinvoice_model.php index 40f8b1c7..dc662e6f 100755 --- a/app/Models/Ipinvoice_model.php +++ b/app/Models/Ipinvoice_model.php @@ -4,6 +4,7 @@ namespace App\Models; use CodeIgniter\Model; + class Ipinvoice_model extends Model { @@ -23,7 +24,7 @@ class Ipinvoice_model extends Model ip_invoices.invoice_number, ip_invoices.invoice_terms, ip_invoices.status, ip_invoices.e_invoice_number, ip_invoices.invoice_url, ip_clients.client_name, ip_payment_methods.payment_method_name, ip_users.user_name, ip_products.product_name, ip_invoice_items.item_price, ip_products.cgst, ip_products.sgst, - ip_invoice_items.item_quantity, ip_invoice_items.item_price, ip_invoice_items.item_name, ip_invoice_items.item_quantity, + ip_invoice_items.item_quantity, ip_invoice_items.item_price, ip_invoice_items.item_name, ip_invoice_items.item_quantity,ip_invoice_items.hsn_or_sac, ip_invoice_amounts.invoice_total, ip_invoice_amounts.invoice_item_subtotal, ip_invoice_amounts.invoice_item_tax_total ,ip_invoice_attachment.file_name , ip_invoices.received_qty') ->join('ip_payment_methods', 'ip_invoices.payment_method = ip_payment_methods.payment_method_id', 'left') @@ -41,47 +42,100 @@ class Ipinvoice_model extends Model $result = $query->getResult(); // $results = $query->getResultArray(); return $result; - // $invoices = []; - - // foreach ($results as $row) { - // $invoice_id = $row['invoice_id']; - - // // If the invoice_id doesn't exist in the $invoices array, initialize it - // if (!isset($invoices[$invoice_id])) { - // $invoices[$invoice_id] = [ - // 'invoice_id' => $row['invoice_id'], - // 'user_id' => $row['user_id'], - // 'client_id' => $row['client_id'], - // 'invoice_group_id' => $row['invoice_group_id'], - // 'invoice_status_id' => $row['invoice_status_id'], - // 'invoice_date_due' => $row['invoice_date_due'], - // 'invoice_date_created' => $row['invoice_date_created'], - // 'invoice_number' => $row['invoice_number'], - // 'invoice_terms' => $row['invoice_terms'], - // 'status' => $row['status'], - // 'e_invoice_number' => $row['e_invoice_number'], - // 'invoice_url' => $row['invoice_url'], - // 'client_name' => $row['client_name'], - // 'payment_method_name' => $row['payment_method_name'], - // 'user_name' => $row['user_name'], - // 'invoice_total' => $row['invoice_total'], - // 'invoice_item_subtotal' => $row['invoice_item_subtotal'], - // 'invoice_item_tax_total' => $row['invoice_item_tax_total'], - // 'products' => [] // Initialize the products array - // ]; - // } - - // // Add the product to the products array for the current invoice - // $invoices[$invoice_id]['products'][] = [ - // 'product_name' => $row['product_name'], - // 'item_quantity' => $row['item_quantity'], - // 'item_price' => $row['item_price'], - // ]; - // } - - // // Return the grouped invoices - // return $invoices; + } + + function getHsn() + { + return $this->db->table('ip_invoice_items') + ->select('hsn_or_sac') + ->distinct() + ->get() + ->getResult(); + } + + function getProducts() + { + return $this->db->table('ip_products') + ->select('product_id,product_name') + ->distinct() + ->get() + ->getResult(); + } + + function getProductName($id) + { + return $this->db->table('ip_products') + ->select('product_id,product_name') + ->where('product_id',$id) + ->get()->getRow()->product_name; + + } + + + function getClientName($id) + { + return $this->db->table('ip_clients') + ->select('client_id,client_name') + ->where('client_id',$id) + ->get()->getRow()->client_name; + } + + function getClients() + { + return $this->db->table('ip_clients') + ->select('client_id,client_name') + ->distinct() + ->get() + ->getResult(); + } + + public function sales_report($from_date, $to_date, $hsn_number, $product_id, $client_id) + { + $builder = $this->db->table('ip_invoices') + ->select('ip_invoices.invoice_id, ip_invoices.user_id, ip_invoices.client_id, + ip_invoices.invoice_group_id, ip_invoices.invoice_status_id, ip_invoices.invoice_date_due, ip_invoices.invoice_date_created, + ip_invoices.invoice_number, ip_invoices.invoice_terms, ip_invoices.status, ip_invoices.e_invoice_number, ip_invoices.invoice_url, ip_clients.client_name, + ip_payment_methods.payment_method_name, ip_users.user_name, + ip_products.product_name, ip_invoice_items.item_price, ip_products.cgst, ip_products.sgst, + ip_invoice_items.item_quantity, ip_invoice_items.item_price, ip_invoice_items.item_name, ip_invoice_items.item_quantity,ip_invoice_items.hsn_or_sac, + ip_invoice_amounts.invoice_total, ip_invoice_amounts.invoice_item_subtotal, ip_invoice_amounts.invoice_item_tax_total, + ip_invoice_attachment.file_name, ip_invoices.received_qty') + ->join('ip_payment_methods', 'ip_invoices.payment_method = ip_payment_methods.payment_method_id', 'left') + ->join('ip_clients', 'ip_invoices.client_id = ip_clients.client_id', 'left') + ->join('ip_users', 'ip_invoices.user_id = ip_users.user_id', 'left') + ->join('ip_invoice_items', 'ip_invoices.invoice_id = ip_invoice_items.invoice_id', 'left') + ->join('ip_products', 'ip_invoice_items.item_product_id = ip_products.product_id', 'left') + ->join('ip_invoice_amounts', 'ip_invoices.invoice_id = ip_invoice_amounts.invoice_id', 'left') + ->join('ip_invoice_attachment', 'ip_invoices.invoice_id = ip_invoice_attachment.invoice_id AND ip_invoice_attachment.is_active = 1', 'left'); + + // Apply filters only if values are provided + if (!empty($from_date) && !empty($to_date)) { + $from_date = get_date_time_dynamical_format('d-m-Y', 'Y-m-d', $from_date); + $to_date = get_date_time_dynamical_format('d-m-Y', 'Y-m-d', $to_date); + $builder->where('ip_invoices.invoice_date_created >=', $from_date); + $builder->where('ip_invoices.invoice_date_created <=', $to_date); + } + + if (!empty($hsn_number)) { + $builder->where('ip_invoice_items.hsn_or_sac', $hsn_number); + } + + if (!empty($product_id)) { + $builder->where('ip_invoice_items.item_product_id', $product_id); + } + + if (!empty($client_id)) { + $builder->where('ip_invoices.client_id', $client_id); + } + + // Order by invoice number in descending order + $builder->orderBy('ip_invoices.invoice_number', 'DESC'); + + $query = $builder->get(); + return $query->getResult(); + } + diff --git a/app/Models/Monthlypay_model.php b/app/Models/Monthlypay_model.php index 569790f8..c2e59ce0 100755 --- a/app/Models/Monthlypay_model.php +++ b/app/Models/Monthlypay_model.php @@ -39,12 +39,12 @@ class Monthlypay_model extends Model // $this->db->where('t_employee_details.DateofJoining <=',$lastdate); // $this->db->where('Month_Year',$current); - $sql = "select t_monthly_pay_inputs.*,t_employee_details.FirstName,t_employee_details.LastName,t_loan_master.Loan_ID,t_loan_master.Monthly_Due,t_payroll.Id + $sql = "select t_monthly_pay_inputs.*,t_employee_details.FirstName,t_employee_details.LastName,t_loan_master.Loan_ID,t_loan_master.Monthly_Due,t_payroll.Id,t_employee_details.is_driver from t_monthly_pay_inputs left join t_employee_details on t_monthly_pay_inputs.EmpID=t_employee_details.EmpID and t_employee_details.DateofJoining <= ? left join t_payroll on t_monthly_pay_inputs.EmpID=t_payroll.EmpID left join t_loan_master on t_monthly_pay_inputs.EmpID=t_loan_master.EmpID and t_loan_master.is_Active = 1 - where Month_Year = ? + where t_employee_details.is_driver = 0 and Month_Year = ? order by t_employee_details.EmpID asc"; $query = $this->db->query($sql, array($lastdate, $current)); @@ -64,9 +64,10 @@ class Monthlypay_model extends Model //$monthyear_val = date('Y-m',strtotime($current)); $lastdate = $year_val . '-' . $month_val . '-' . $date_val; $builder = $this->db->table('t_employee_details') - ->select('t_employee_details.EmpID,t_employee_details.FirstName,t_employee_details.LastName,t_employee_details.DateofJoining') + ->select('t_employee_details.EmpID,t_employee_details.FirstName,t_employee_details.LastName,t_employee_details.DateofJoining,t_employee_details.is_driver') //->join('t_emp_pay_data','t_emp_pay_data.EmpID=t_employee_details.EmpID','Left') ->where('t_employee_details.IsActive', 1) + ->where('t_employee_details.is_driver', 0) ->where('t_employee_details.DateofJoining <=', $lastdate) ->orderBy('EmpID', 'asc'); $query = $builder->get(); @@ -100,7 +101,7 @@ class Monthlypay_model extends Model //echo $lastdate; //left join t_payroll on t_employee_details.EmpID = t_payroll.EmpID and month(t_payroll.PayOn) = month(?) and year(t_payroll.PayOn) = year(?) - $sql = "select t_emp_pay_data.EmpID,t_emp_pay_data.*,t_employee_details.FirstName,t_employee_details.DateofJoining,t_employee_details.Designation,t_employee_details.esi_applicable,t_employee_details.pf_applicable,t_employee_details.is_management_team,t_attendance.Days_Worked as Days_worked,t_attendance.Absent as LOP_Days,t_attendance.Paid_Leave as Paid_leave,t_attendance.Total_OTHrs as OT_Hrs_Worked,t_attendance.NoofDays,t_attendance.sunday_count,t_loan_master.Loan_ID,t_loan_master.Monthly_Due,t_loan_master.Due_Start_Date as DueDate,t_loan_master.Loan_Amount,t_loan_master.Paid_Amount,t_payroll.Id,t_monthly_pay_inputs.Loan_Recovered,t_monthly_pay_inputs.Estimate,t_monthly_pay_inputs.Festival_Bonus,t_monthly_pay_inputs.Other_Deductions,t_loan_history .Balance_Amount + $sql = "select t_emp_pay_data.EmpID,t_emp_pay_data.*,t_employee_details.FirstName,t_employee_details.DateofJoining,t_employee_details.Designation,t_employee_details.esi_applicable,t_employee_details.pf_applicable,t_employee_details.is_management_team,t_attendance.Days_Worked as Days_worked,t_attendance.Absent as LOP_Days,t_attendance.Paid_Leave as Paid_leave,t_attendance.Total_OTHrs as OT_Hrs_Worked,t_attendance.NoofDays,t_attendance.sunday_count,t_loan_master.Loan_ID,t_loan_master.Monthly_Due,t_loan_master.Due_Start_Date as DueDate,t_loan_master.Loan_Amount,t_loan_master.Paid_Amount,t_payroll.Id,t_monthly_pay_inputs.Loan_Recovered,t_monthly_pay_inputs.Estimate,t_monthly_pay_inputs.Festival_Bonus,t_monthly_pay_inputs.Other_Deductions,t_loan_history .Balance_Amount,t_employee_details.is_driver from t_emp_pay_data left join t_employee_details on t_employee_details.EmpID = t_emp_pay_data.EmpID left join t_payroll on t_employee_details.EmpID = t_payroll.EmpID and t_payroll.PayOn = ? @@ -110,6 +111,7 @@ class Monthlypay_model extends Model left join t_loan_history on t_loan_history .Loan_ID = t_loan_master.Loan_ID where t_employee_details.DateofJoining <= ? and month(t_attendance.Month_Year) = month(?) and year(t_attendance.Month_Year) = year(?) + and t_employee_details.is_driver = 0 order by t_employee_details.EmpID"; $query = $this->db->query($sql, array($month, $month, $lastdate, $current, $current)); @@ -183,6 +185,7 @@ class Monthlypay_model extends Model // ->where('month(t_employee_details.DateofJoining) <= ',$month_val) ->where('t_employee_details.DateofJoining <= ', $lastdate) ->where('Month_Year', $current) + ->where('t_employee_details.is_driver', 0) // ->where('t_employee_details.IsActive',1) ->orderBy('t_attendance.EmpID', 'asc'); $query = $builder->get(); diff --git a/app/Models/Payroll_model.php b/app/Models/Payroll_model.php index 51e22f3a..3b71a779 100755 --- a/app/Models/Payroll_model.php +++ b/app/Models/Payroll_model.php @@ -331,9 +331,10 @@ class Payroll_model extends Model function getEmployeelist2($Payon = '') { + // CONCAT_WS(' ', Emp.FirstName, Emp.LastName) $builder = $this->db->table('t_monthly_pay_inputs Pay') - ->select('Pay.EmpID as EmpId,Emp.FirstName as Fname,Emp.LastName as Lname') - ->join('t_employee_details Emp', 'Pay.EmpID = Emp.EmpID'); + ->select('Pay.EmpID as EmpId,CONCAT_WS(" ",Emp.FirstName,Emp.LastName) AS FullName') + ->join('t_employee_details Emp', 'Pay.EmpID = Emp.EmpID and Emp.is_driver = 0'); if ($Payon != '') { $builder->where('Pay.Month_Year', $Payon); } diff --git a/app/Models/Purchaseorder_model.php b/app/Models/Purchaseorder_model.php index 133bd261..049f8966 100755 --- a/app/Models/Purchaseorder_model.php +++ b/app/Models/Purchaseorder_model.php @@ -2558,6 +2558,34 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath, return $query->getResultArray(); } + function materialRate($materialcode){ + $builder = $this->db->table('t_materialmaster') + ->select('t_materialmaster.material_rate') + ->where('t_materialmaster.MaterialCode', $materialcode); + + $query = $builder->get()->getRow(); + + $material_rate = $query ? $query->material_rate : 0; + return $material_rate; + + } + + public function updateMaterialRate($code, $incoming_rate) + { + $default_rate = $this->materialRate($code); + + if ($incoming_rate == $default_rate) { + return 1; + } else { + $this->db->table('t_materialmaster') + ->where('MaterialCode', $code) + ->set('material_rate', $incoming_rate) + ->update(); + + return $this->db->affectedRows(); + } + } + function lastPONO() { diff --git a/app/Models/Requistion_model.php b/app/Models/Requistion_model.php index bfeed261..47a68809 100755 --- a/app/Models/Requistion_model.php +++ b/app/Models/Requistion_model.php @@ -175,7 +175,7 @@ class Requistion_model extends Model function GetMaterialCode($ReqType,$NotArray='') { $builder = $this->db->table('t_materialmaster') - ->select('MaterialCode, MaterialName,UOM') + ->select('MaterialCode, MaterialName,UOM,material_rate') ->where('IsActive',1); //->where('MaterialType',$ReqType ); diff --git a/app/Views/EditservicePurchaseorder.php b/app/Views/EditservicePurchaseorder.php index 85a67ac0..8b2aa672 100755 --- a/app/Views/EditservicePurchaseorder.php +++ b/app/Views/EditservicePurchaseorder.php @@ -1229,22 +1229,25 @@ if (!empty($getlogpodtl)) { +
-
- +
+
- - - - - - - - - - - + + + + + + + + + + + + @@ -1268,12 +1271,11 @@ if (!empty($getlogpodtl)) { ?> - - - - - + + + + - + LineitemAuditorNotes) ? $record->LineitemAuditorNotes : "-"; } ?> + - + - + - - + + @@ -2610,12 +2611,13 @@ if (!empty($getlogpodtl)) { // TotalValue: TotalOrderValue // })); PONOStatus = + var shorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName; var rowHtml = ` - `; + `; if (PONOStatus === "PO_DRAFT" || PONOStatus === "PO_CREATED") { rowHtml += ` + $invdate = $record->DeliveryChellanDate; + if(!$invdate || $invdate == 'null' || $invdate === '0000-00-00 00:00:00'){ + echo ""; + }else{ + $date = new DateTime($invdate); + echo $date->format('d-m-Y'); } + ?> @@ -772,9 +777,11 @@ } // Format dates - var dcd = new Date(item.DeliveryChellanDate); - var dcd2 = (String(dcd.getDate()).padStart(2, '0') + '-' + (String(dcd.getMonth() + 1).padStart(2, '0')) + '-' + dcd.getFullYear()); - $("#Invoice_Date").val(dcd2); + if(item.DeliveryChellanDate !== '0000-00-00 00:00:00' ){ + var dcd = new Date(item.DeliveryChellanDate); + var dcd2 = (String(dcd.getDate()).padStart(2, '0') + '-' + (String(dcd.getMonth() + 1).padStart(2, '0')) + '-' + dcd.getFullYear()); + $("#Invoice_Date").val(dcd2); + } console.log(item.MaterialRcvdDate) var Mat_rcv_date = (item.MaterialRcvdDate == 'null') ? ' ' : formatDateTime(item.MaterialRcvdDate, 1); $("#MaterialRcvdDate").val(Mat_rcv_date); @@ -1179,15 +1186,22 @@ }); function constructSentence(record) { - let str = record.field; - let fieldName = str.replace(/([a-z])([A-Z])/g, '$1 $2'); - let sentence = record.FullName + ' on ' + formatDateTime(record.history_dated, 2) + " " + fieldName + " "; + + // let str = record.field; + // let fieldName = str.replace(/([a-z])([A-Z])/g, '$1 $2'); + let sentence = " "; if (parseInt(record.is_add) === 1) { - sentence += record.new_data + " was added."; + sentence += record.IGR_No + " was Created by "+record.FullName+ " on "+record.indian_date+" at "+record.indian_time; } else if (parseInt(record.is_edit) === 1) { - sentence += record.old_data + " was updated into " + record.new_data + "."; + let str = record.field; + if (str !== "UpdateBY" && str !== "MaterialRcvdDate" && str !== "DeliveryChellanDate") { + let fieldName = str.replace(/([a-z])([A-Z])/g, '$1 $2'); + sentence += ((record.IGRItem_No) ? record.MaterialName+" ( "+ record.MaterialCode + " ) - " : "")+fieldName+" "+record.old_data + " was Updated into " + record.new_data + " by "+record.FullName+ " on "+record.indian_date+" at "+record.indian_time; + } } else if (parseInt(record.is_delete) === 1) { - sentence += record.new_data + " was deleted."; + let str = record.field; + let fieldName = str.replace(/([a-z])([A-Z])/g, '$1 $2'); + sentence += fieldName+" "+record.new_data + " was deleted by "+record.FullName+ " on "+record.indian_date+" at "+record.indian_time; } return sentence; } @@ -1396,6 +1410,7 @@ @@ -49,7 +53,7 @@
- +
@@ -66,11 +70,11 @@ ?>
- +
- @@ -109,6 +113,10 @@
+
+ + +
@@ -116,23 +124,25 @@
'Date', 'value' => set_value('Date'), 'id' => 'Date', 'class' => 'form-control', 'onkeypress' => 'return false;'); - echo form_input($data); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $formattedDate = $dt->format('d-m-Y'); + $data = array('name' => 'Date', 'value' => set_value('Date', $formattedDate), 'id' => 'Date', 'class' => 'form-control', 'onkeypress' => 'return false;', 'autocomplete'=>'"off"'); + echo form_input($data); ?>
+
+
-
-
- +
@@ -195,28 +205,28 @@
- * - + +
diff --git a/app/Views/addconfig.php b/app/Views/addconfig.php index e7c24fd3..9dd7f9bc 100755 --- a/app/Views/addconfig.php +++ b/app/Views/addconfig.php @@ -244,8 +244,7 @@ $('#ConfigValue').show(); var temp = index; - var ConfigValue = $("#ConfigValue").val(); - + var ConfigValue = $.trim($("#ConfigValue").val()); $('#ConfigValue').val(''); diff --git a/app/Views/alterpurchaseorder.php b/app/Views/alterpurchaseorder.php index cded8c49..02eac8c8 100755 --- a/app/Views/alterpurchaseorder.php +++ b/app/Views/alterpurchaseorder.php @@ -1875,6 +1875,28 @@ if (!empty($INRSYMBOL)) { } else if ($('#drpSupplier').val() == "0") { alert('Please Select the Supplier details'); $('#drpSupplier').focus(); + return false; + } else if (input == 'REVENUE' && $('#Deliverydate').val() == '' && radioValue == 0) { + alert('Please Select the Delivery Date'); + $('#Deliverydate').focus(); + return false; + } else if (input == 'REVENUE' && $('#Scheduleby').val().trim() == '' && radioValue == 1) { + alert('Please Enter the Schedule By'); + $('#Scheduleby').focus(); + return false; + } else if (input == 'SERVICE' && $('#Deliverydate').val() == '' && radioValue == 0) { + alert('Please Select the Delivery Date'); + $('#Deliverydate').focus(); + return false; + } else if (input == 'SERVICE' && $('#Scheduleby').val().trim() == '' && radioValue == 1) { + alert('Please Enter the Schedule By'); + $('#Scheduleby').focus(); + return false; + } else if ($('#DepartmentName').val() == "0") { + alert('Please Select Department Name ') + return false; + } else if ($('#CostCenterName').val() == "0") { + alert('Please Select Cost Center Name ') return false; } else if ($('#PoTypeOptions').val() == "0") { @@ -1891,40 +1913,19 @@ if (!empty($INRSYMBOL)) { return false; } - - - } else if ($('#DepartmentName').val() == "0") { - alert('Please Select Department Name ') + }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 ($('#CostCenterName').val() == "0") { - alert('Please Select Cost Center Name ') - } - - - - else if ($('#BudgetType').val() == "0") { + }else if ($('#BudgetType').val() == "0") { alert('Please Select Budget Type'); $('#BudgetType').focus(); return false; - - } else if (input == 'REVENUE' && $('#Deliverydate').val() == '' && radioValue == 0) { - alert('Please Select the Delivery Date'); - $('#Deliverydate').focus(); - return false; - } else if (input == 'REVENUE' && $('#Scheduleby').val().trim() == '' && radioValue == 1) { - alert('Please Enter the Schedule By'); - $('#Scheduleby').focus(); - return false; - - } - else if ($('#Otherpayment').length > 0 && $('#Otherpayment').is(':visible') && $('#Otherpayment').val() == '') { - - alert('Please Enter the Description of payable terms'); - $('#Otherpayment').focus(); - return false; - } - else { + } else { $("#" + input).modal('show'); $('#isEdit').val(0); if (StateTaxCheck == "0") { @@ -1955,12 +1956,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 +2170,7 @@ if (!empty($INRSYMBOL)) { if (selectedRevenueMaterialCode == value.MaterialCode) { $("#ItemName").val(value.MaterialName); $("#UOM").val(value.UOM); - + $("#Rate").val(value.material_rate); } }); @@ -2632,21 +2635,21 @@ if (!empty($INRSYMBOL)) {
format('Y-m-d'); - $data = array( - 'type' => 'date', - 'name' => 'PODate', - 'value' => set_value('PODate', $formattedDate), - 'min' => $formattedDate, - 'id' => 'PODate', - 'class' => 'form-control', - 'required' => 'true', - 'onkeypress' => 'return false;' - ); - echo form_input($data); + // $poDt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + // $formattedDate = $poDt->format('d-m-Y'); + // $data = array( + // 'type' => 'text', + // 'name' => 'PODate', + // 'value' => set_value('PODate', $formattedDate), + // 'min' => $formattedDate, + // 'id' => 'PODate', + // 'class' => 'form-control num', + // 'required' => 'true', + // 'onkeypress' => 'return false;' + // ); + // echo form_input($data); ?> +
@@ -2810,16 +2813,16 @@ if (!empty($INRSYMBOL)) { style="background-color:#fff;">
- - - - - - - - - - + + + + + + + + + + @@ -3577,7 +3580,7 @@ if (!empty($INRSYMBOL)) { class="badge mandatory">*
'ServiceRate', 'value' => set_value('ServiceRate'), 'id' => 'ServiceRate', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'Ratechange()'); + $data = array('name' => 'ServiceRate', 'value' => set_value('ServiceRate'), 'id' => 'ServiceRate', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);', 'onchange' => 'Ratechange();UpdateTheRateMaster();'); echo form_input($data); ?>
@@ -6027,14 +6030,15 @@ if (!empty($INRSYMBOL)) { index = parseInt(index) + 1; var template = jQuery("#RevenueList").html(); + var rshorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName; var html = ` - + - - + + @@ -6555,7 +6559,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 +6711,16 @@ if (!empty($INRSYMBOL)) { index = parseInt(index) + 1; var template = jQuery("#ServiceList").html(); + + var sshorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName; var html = ` - + - - + + @@ -7222,26 +7240,27 @@ if (!empty($INRSYMBOL)) { // Perform form validation - if (validate()) { - if (document.getElementById('serviceTax').rows.length < 2) { - alert('Please Select Line item to Create PO'); - $('#Deliverydt').focus(); - return false; - } else if ($('#Otherpayment').val() == '' && $('#PaymentMethod').val() == 'PT08') { - alert('Please Enter Other Payable Terms Description'); - $('#Otherpayment').focus(); - return false; - } else if ($('#emergdescofpo').val().trim() == '') { - alert('Please Enter Description Of Service'); - $('#emergdescofpo').focus(); - return false; - } else if ($('#PoTypeOptions').val() == "0") { - alert('Please Select POType'); - $('#PoTypeOptions').focus(); - return false; - } else { + if (serviceValidate()) { + // if (document.getElementById('serviceTax').rows.length < 2) { + // alert('Please Select Line item to Create PO'); + // $('#Deliverydt').focus(); + // return false; + // } else if ($('#Otherpayment').val() == '' && $('#PaymentMethod').val() == 'PT08') { + // alert('Please Enter Other Payable Terms Description'); + // $('#Otherpayment').focus(); + // return false; + // } else if ($('#emergdescofpo').val().trim() == '') { + // alert('Please Enter Description Of Service'); + // $('#emergdescofpo').focus(); + // return false; + // } else if ($('#PoTypeOptions').val() == "0") { + // alert('Please Select POType'); + // $('#PoTypeOptions').focus(); + // return false; + // } else { // Submit the form using AJAX $('#loader').show(); + // disableButtons(); $.ajax({ url: "emergencypurchaseorder/addNewServicePurchaseOrder", type: "POST", @@ -7260,14 +7279,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 +7354,23 @@ if (!empty($INRSYMBOL)) { // Perform form validation - if (validate()) { - if (document.getElementById('serviceTax').rows.length < 2) { - alert('Please Select Line item to Create PO'); - $('#Deliverydt').focus(); - return false; - } else if ($('#insuranceStatus').val() == 'YES' && $('#InsuranceNumber').val() == '') { - alert('Please Enter Insurance Number..!'); + if (revenueValidate()) { + // if (document.getElementById('serviceTax').rows.length < 2) { + // alert('Please Select Line item to Create PO'); + // $('#Deliverydt').focus(); + // return false; + // } else if ($('#insuranceStatus').val() == 'YES' && $('#InsuranceNumber').val() == '') { + // alert('Please Enter Insurance Number..!'); - return false; - } else if ($('#PaymentMethod').val() == 'PT08' && $('#Otherpayment').val() == '') { - alert('Please Enter Other Payment Description..!'); + // return false; + // } else if ($('#PaymentMethod').val() == 'PT08' && $('#Otherpayment').val() == '') { + // alert('Please Enter Other Payment Description..!'); - return false; - } else { + // return false; + // } else { // Submit the form using AJAX $('#loader').show(); + // disableButtons(); $.ajax({ url: "emergencypurchaseorder/addNewRevenuePurchaseOrder", type: "POST", @@ -7363,13 +7385,15 @@ if (!empty($INRSYMBOL)) { $('#SpcialInstruction').val(''); $('#txtDeliveryAddress').val(''); window.location = "purchaseorderListing"; + // setTimeout(function() { enableButtons(); }, 2000); }, error: function (xhr, status, error) { // Handle errors alert("Error: " + error); + // setTimeout(function() { enableButtons(); }, 2000); } }); - } + // } } } diff --git a/app/Views/attendance.php b/app/Views/attendance.php index a4c608f7..01592c6a 100755 --- a/app/Views/attendance.php +++ b/app/Views/attendance.php @@ -224,7 +224,7 @@ $currentday = date('d');
-
-
- -
diff --git a/app/Views/capitalpurchaseorder.php b/app/Views/capitalpurchaseorder.php index e035a431..a170aa5d 100755 --- a/app/Views/capitalpurchaseorder.php +++ b/app/Views/capitalpurchaseorder.php @@ -333,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; } + } + + + + + }
@@ -514,7 +555,7 @@ if (!empty($INRSYMBOL)) { 'Scheduleby', 'value' => set_value('Scheduleby'), 'id' => 'Scheduleby', 'class' => 'form-control', 'required' => 'true', 'rows' => '3', 'cols' => '40', 'maxlength' => '110'); - echo Form_textarea($data); + echo form_textarea($data); ?>
@@ -525,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); ?> @@ -742,20 +783,21 @@ if (!empty($INRSYMBOL)) {
-
SNoRequisition NoItem CodeItem NameLine Item SpecsQuantityUOMRate Basic Amount Tax Amount Total Order Amount SNoRequisition NoItem CodeItem DescriptionLine Item SpecsQuantityUOMRate Basic Amount Tax Amount Total Order Amount Action
ReqNo ?>MaterialCode ?>MaterialName ?> - + ReqNo ?>MaterialCode ?>MaterialName, 0, 13, "..."); echo $shortName; ?> @@ -1284,17 +1286,16 @@ if (!empty($getlogpodtl)) { - LineitemAuditorNotes) ? $record->LineitemAuditorNotes : "-"; } ?> - Quantity ?>Quantity ?> UOM ?>Rate ?>Rate ?>BasicValue * $FrequencyNo, 2, '.', ''); ?>BasicValue * $FrequencyNo, 2, '.', ''); ?>Taxamount ?>TotalValue ?>Taxamount ?>TotalValue ?>
${temp} ${Reqnumber} ${materialCode}${materialName}${shorten}purchaseorder/DeletePODetails", success: function(data) { - if (data) { - $('#loader').hide(); - alert(data); - } else { - $('#loader').hide(); - - alert("Error"); - } - + $('#loader').hide(); + (data) ? alert(response) : alert("Error"); } }); } @@ -3168,29 +3163,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 +3215,22 @@ if (!empty($getlogpodtl)) { $('#SpcialInstruction').val(''); $('#txtDeliveryAddress').val('') window.location = "purchaseorderListing"; - + // setTimeout(function() { enableButtons(); }, 2000); } else { $('#loader').hide(); + // setTimeout(function() { enableButtons(); }, 2000); alert("Error"); } + }, + error: function(jqXHR, textStatus, errorThrown) { + console.error("AJAX Error: " + textStatus + ": " + errorThrown); + alert("Error: " + textStatus); + // setTimeout(function() { enableButtons(); }, 2000); } }); - } + // } } } diff --git a/app/Views/accountsDashboard.php b/app/Views/accountsDashboard.php index be4a77cc..186bbdfc 100644 --- a/app/Views/accountsDashboard.php +++ b/app/Views/accountsDashboard.php @@ -93,41 +93,41 @@ var mindt = year - 70; var maxdt = year - 15; - $("#Invoice_Date , #MaterialRcvdDate").datepicker({ - minDate: new Date(year - SIAStartYear, 1, 1), - maxDate: 'now', - dateFormat: 'dd-mm-yy', - changeMonth: true, - changeYear: true, - yearRange: '-100:+0' - }); - $('#Driver_Name').autocomplete({ + // $("#Invoice_Date , #MaterialRcvdDate").datepicker({ + // minDate: new Date(year - SIAStartYear, 1, 1), + // maxDate: 'now', + // dateFormat: 'dd-mm-yy', + // changeMonth: true, + // changeYear: true, + // yearRange: '-100:+0' + // }); + // $('#Driver_Name').autocomplete({ - onSearchStart: function(query) { - //alert(query); - $('#Driver_Name').autocomplete("option", "minLength", 0); - }, + // onSearchStart: function(query) { + // //alert(query); + // $('#Driver_Name').autocomplete("option", "minLength", 0); + // }, - serviceUrl: "drivernameautocomplete", - onSelect: function(suggestion) { - var data = suggestion.DriverName; + // serviceUrl: "drivernameautocomplete", + // onSelect: function(suggestion) { + // var data = suggestion.DriverName; - } - }); - $('#DriverMobileNumber').autocomplete({ - serviceUrl: "drivermobileautocomplete", - params: { - driverName: function() { - return $('#Driver_Name').val(); // Pass the value of the DriverName input field - } - }, - onSearchStart: function(query) { - $('#DriverMobileNumber').autocomplete("option", "minLength", 0); - }, - onSelect: function(suggestion) { - var data = suggestion.DriverMobileNumber; - } - }); + // } + // }); + // $('#DriverMobileNumber').autocomplete({ + // serviceUrl: "drivermobileautocomplete", + // params: { + // driverName: function() { + // return $('#Driver_Name').val(); // Pass the value of the DriverName input field + // } + // }, + // onSearchStart: function(query) { + // $('#DriverMobileNumber').autocomplete("option", "minLength", 0); + // }, + // onSelect: function(suggestion) { + // var data = suggestion.DriverMobileNumber; + // } + // }); }); @@ -219,8 +219,13 @@ SupplierName ?> DeliveryChellanOrInvoiceNo ?> DeliveryChellanDate); - echo $date->format('d-m-Y'); ?> itemCount ?> ReceivedQuantity ?> NetWeight ?>
SNoRequisition NoItem CodeItem DescriptionQuantityUOMRateBasic AmountTax AmountTotal Order AmountSNoRequisition NoItem CodeItem DescriptionQuantityUOMRateBasic AmountTax AmountTotal Order Amount Action
${temp}${Reqnumber}${Reqnumber} ${materialCode}${materialName}${quantity}${rshorten}${quantity} ${uom} ${itemRate} ${basicval}
${temp}${Reqnumber}${Reqnumber} ${materialCode}${materialName}${quantity}${sshorten}${quantity} ${uom} ${itemRate} ${basicval}
+
+
- - - - - - - - - - - + + + + + + + + + + + @@ -765,6 +807,7 @@ if (!empty($INRSYMBOL)) {
SNoRequisition NoItem CodeItem DescriptionLine Item SpecsQuantityUOMRateBasic AmountTax AmountTotal Order AmountSNoRequisition NoItem CodeItem DescriptionLine Item SpecsQuantityUOMRateBasic AmountTax AmountTotal Order Amount Action
+
@@ -2607,6 +2650,7 @@ if (!empty($INRSYMBOL)) { $("#MaterialCode").empty(); $("#CapitalDepartmentName").val(''); $("#CPUOM").val(''); + $("#CPRate").val(''); $("#CPQuantity").val(''); $("#CapitalItemName").val(''); $("#CPTotalAmount").val(''); @@ -2676,6 +2720,7 @@ if (!empty($INRSYMBOL)) { var id = $('#MaterialCode').val(); $("#CapitalItemName").val(''); $("#CPUOM").val(''); + $("#CPRate").val(''); $("#CPQuantity").val(''); $("#CPTotalAmount").val(''); RequistQuantity = ''; @@ -2688,6 +2733,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; @@ -2739,6 +2785,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; @@ -3481,14 +3528,14 @@ if (!empty($INRSYMBOL)) { // Taxvalue: TotalTaxValue, // TotalValue: Total // })); - + var shorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName; var rowHtml = ` ${temp} - ${Reqnumber} + ${Reqnumber} ${materialCode} - ${materialName} - + ${shorten} + - - ${quantity} + ${quantity} ${uom} - ${itemRate} - ${basicval} - ${TotalTaxValue} - ${Total} + ${itemRate} + ${basicval} + ${TotalTaxValue} + ${Total}     @@ -4390,6 +4437,7 @@ if (!empty($INRSYMBOL)) { var id = $('#EditMaterialCode').val(); $("#EditCapitalItemName").val(''); $("#EditCPUOM").val(''); + $("#EditCPRate").val(''); $("#EditCPQuantity").val(''); $("#EditCPTotalAmount").val(''); RequistQuantity = ''; @@ -4402,6 +4450,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; } @@ -4482,32 +4531,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, @@ -4529,16 +4578,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); + } }); - } + // } } } @@ -5381,9 +5436,12 @@ if (!empty($INRSYMBOL)) { function Reset() { - location.reload(); - - } + // disableButtons(); + location.reload(); + // setTimeout(function() { + // enableButtons(); + // }, 2000); + } $('#insuranceTxtDiv').hide(); $("#insuranceStatus").change(function() { diff --git a/app/Views/driverAttendance.php b/app/Views/driverAttendance.php index b7fc4bda..25d9846d 100755 --- a/app/Views/driverAttendance.php +++ b/app/Views/driverAttendance.php @@ -93,6 +93,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); Vehicle Number Salary Amount Food Amount + Total Load Type Action @@ -118,6 +119,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); + '> @@ -134,6 +136,64 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); + + + + + + + + Salary Amount + + + + + + + + + + + + + + + + + Diesel + + + + + + + + + + + + + + Shed Amount + + + + + + + + + + + + + + Total + - + + + +
@@ -221,7 +281,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
- @@ -234,11 +294,11 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
- +
- +
@@ -303,13 +363,21 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); $("#gobal_driver_id").val(""); $("#driver_id").val(""); } + let gobal_diesel_amount = ""; + let gobal_shed_amount = ""; + if(gobal_diesel_amount != '' || gobal_shed_amount != ''){ + $('input[data-column="diesel_amount"]').val(parseFloat(gobal_diesel_amount) || 0); + $('input[data-column="shed_amount"]').val(parseFloat(gobal_shed_amount) || 0); + calculateTotal(); + } + $("#attendanceModal").on("shown.bs.modal", function (e) { var id = $(e.relatedTarget).data('id'); - let fields = ['invoice_number', 'vehicle_number', 'load_type', 'salary_amount', 'food_amount','customer','quantity']; + let fields = ['invoice_number', 'vehicle_number', 'load_type', 'salary_amount', 'food_amount','customer','quantity','total_amount']; fields.forEach(function(field) { $("#" + field).val(""); @@ -330,10 +398,18 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); if(field == 'driver_id'){ $("#driver_id").val(arr && arr['driver_id']); } - if(field == 'salary_amount' || field == 'food_amount') { - var ttl = parseFloat(arr['salary_amount']) + (parseFloat(arr['food_amount'] || 0)); + var salary = arr['salary_amount'] ? parseFloat(arr['salary_amount']) : 0; + var food = arr['food_amount'] ? parseFloat(arr['food_amount']) : 0; + + if (isNaN(salary)) salary = 0; + if (isNaN(food)) food = 0; + + var ttl = salary + food; + $('#total_amount').val(ttl.toFixed(2)); + + var ttl = parseFloat(salary) + parseFloat(food) ; $('#total_amount').val(ttl.toFixed(2)); - } + }); $('#attendanceTitle').html("Edit Driver Trip"); } @@ -418,20 +494,88 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); buttons: [ 'excel', 'pdf' ], - pageLength: 10, - lengthMenu: [ - [10, 20, 30, 50, -1], - [10, 20, 30, 50, "All"] - ], responsive: false, order: false, - language: { - paginate: { - next: '', // Next button icon - previous: '' // Previous button icon - } + paging: false, + footerCallback: function (row, data, start, end, display) { + var api = this.api(); + var isTableEmpty = api.data().length === 0; + // Hide or show the tfoot based on whether the table is empty + if (isTableEmpty) { + $(this).find('tfoot').hide(); // Hide tfoot if the table is empty + } else { + $(this).find('tfoot').show(); // Show tfoot if the table has data + } + var api = this.api(); + var columnIndex = 7; + var sum = api + .column(columnIndex, { page: 'current' }) + .data() + .reduce(function (a, b) { + return a + parseFloat(b.replace(/[^\d.-]/g, '')); + }, 0); + $(api.column(columnIndex).footer()).html(sum); + var api = this.api(); + var columnIndex = 8; + var sum = api + .column(columnIndex, { page: 'current' }) + .data() + .reduce(function (a, b) { + return a + parseFloat(b.replace(/[^\d.-]/g, '')); + }, 0); + $(api.column(columnIndex).footer()).html(sum); + var api = this.api(); + var columnIndex = 9; + var sum = api + .column(columnIndex, { page: 'current' }) + .data() + .reduce(function (a, b) { + return a + parseFloat(b.replace(/[^\d.-]/g, '')); + }, 0); + $(api.column(columnIndex).footer()).html(sum); + } + }); + // Function to calculate the total + function calculateTotal() { + var diesel = parseFloat($('input[data-column="diesel_amount"]').val()) || 0; + var shed = parseFloat($('input[data-column="shed_amount"]').val()) || 0; + var row = parseInt($('#rowTotalAmount').text()) || 0; + console.log(row); + + var total = row + diesel + shed; + $('#totalAmount').text(total); // Display the total with 2 decimal places + } + // Make the cells editable and calculate the total on input change + $(document).on('input', '.editable', function() { + calculateTotal(); + }); + $(document).on('blur', '.editable', function() { + var column = $(this).data('column'); // Get the column name (diesel or shed) + var value = $(this).val(); // Get the updated value + let gobal_driver_id = urlParams.get("gobal_driver_id"); + let gobal_date = urlParams.get("date"); + + // Send data to the server using AJAX + $.ajax({ + url: "updateDieselAndShedValuesBasedonEmpID", + method: 'POST', + data: { + column: column, + value: value, + date: gobal_date, + empid:gobal_driver_id + }, + success: function(response) { + console.log('Data saved successfully:', response); + }, + error: function(xhr, status, error) { + console.error('Error saving data:', error); } }); + }); + + // Initial calculation of the total + calculateTotal(); }); @@ -463,25 +607,29 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); if (result) { return result; } else { event.preventDefault(); } } - function salary() { - - var type = $('#load_type').val(); - - if(type == 'Load'){ - var value = parseFloat(1300); - $('#salary_amount').val(value); - }else if(type == 'Waste Core'){ - var value = parseFloat(1050); - $('#salary_amount').val(value); - } - var sa = parseFloat($('#salary_amount').val()) || 0; - var fa = parseFloat($('#food_amount').val()) || 0; - var ttl = sa + fa; - - $('#total_amount').val(ttl.toFixed(2)); + $(document).ready(function() { + updateSalaryBasedOnType(); + fetchSalary(); + }); + function updateSalaryBasedOnType() { + var type = $('#load_type').val(); + if (type == 'Load') { + $('#salary_amount').val(1300); + } else if (type == 'Waste Core') { + $('#salary_amount').val(1050); + } + fetchSalary(); } + function fetchSalary() { + var sa = parseFloat($('#salary_amount').val()) || 0; + var fa = parseFloat($('#food_amount').val()) || 0; + var ttl = sa + fa; + + $('#total_amount').val(ttl.toFixed(2)); + } + function customerandquantity(){ if ($('#invoice_number').val() === '') { alert('Please Enter the Valid Invoice Number'); diff --git a/app/Views/driverListing.php b/app/Views/driverListing.php index f6cb32c8..184ad120 100755 --- a/app/Views/driverListing.php +++ b/app/Views/driverListing.php @@ -63,9 +63,7 @@     - -     - + diff --git a/app/Views/driverPayslipGeneratePrint (Copy).php b/app/Views/driverPayslipGeneratePrint (Copy).php new file mode 100755 index 00000000..0650169c --- /dev/null +++ b/app/Views/driverPayslipGeneratePrint (Copy).php @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + +
+
+ +
+ +
+
Resico (India) Pvt Ltd
196/4 B, 126, Mettupalayam Village, Sriperumbudur(Taluk), +
kancheepuram (Dist), Tamil Nadu, India - 631604.
PaySlip for the Month of PayOn ?>
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Name name; ?>
Designation
No Of Loads no_of_loads ?>
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EarningsAmount
 Driver Monthly Salary Amount driver_monthly_salary_amount; ?> 
 Driver Monthly Food Amountdriver_monthly_food_amount; ?> 
 Diesel diesel ?> 
 Shed Duty Amount shed_duty_amount ?> 
Net Pay(Rounded)  driver_final_payment),2,'.','') ?> 
Total Amount In Words  
This is a computer generated document. This document does not require signature.
+ + \ No newline at end of file diff --git a/app/Views/driverPayslipGeneratePrint.php b/app/Views/driverPayslipGeneratePrint.php index 0650169c..9e82bc46 100755 --- a/app/Views/driverPayslipGeneratePrint.php +++ b/app/Views/driverPayslipGeneratePrint.php @@ -11,7 +11,7 @@ - +
Resico (India) Pvt Ltd
196/4 B, 126, Mettupalayam Village, Sriperumbudur(Taluk),
kancheepuram (Dist), Tamil Nadu, India - 631604.
PaySlip for the Month of PayOn ?>
@@ -20,27 +20,48 @@ - + - + - - + + - + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + +
Name name; ?>driver_name; ?> Employee ID EmpID ?>
Designation Designation ?> Department DeptName ?>
No Of Loads no_of_loads ?>Date Of Joining DOJ)) ?> No Of Loads no_of_loads ?>
Bank Name BankName ?>PAN Number Pan;?>
Bank Acc No BankAccountNumber ?> Aadhar NumberAadharNo);?>
Bank IFSC IFSCCode ?>Loan Balance BalanceAdvance ?>
@@ -48,35 +69,61 @@ - + - - + + + + - - + + + + - - + + + + + + - - + + + + + + + + + + + + + + - - + + - - - + + + -
EarningsAmount
EarningsAmount DeductionsAmount
 Driver Monthly Salary Amount driver_monthly_salary_amount; ?>  Basicmonthly_salary_amount; ?>  PF 
 Driver Monthly Food Amountdriver_monthly_food_amount; ?>  Dieseldiesel_amount; ?>  ESI  
 Diesel diesel ?>  Shed Duty Amountshed_amount; ?>  Salary Advance Advance ?> 
 Shed Duty Amount shed_duty_amount ?>  BonusFestival_Bonus; ?>   
 Total Earning (Rounded) + monthly_salary_amount + $PayDetails[0]->Festival_Bonus + $PayDetails[0]->diesel_amount + $PayDetails[0]->shed_amount; + echo number_format(round($totEarning),2) + ?> +  Total Deduction (Rounded) + Advance+$esi_amount + $pf_amount ; + echo number_format(round($totDeduction),2) + ?> + 
Net Pay(Rounded)  driver_final_payment),2,'.','') ?> 
Net Pay(Rounded)  final_payment),2,'.','') ?> 
Total Amount In Words  
Total Amount In Words  
This is a computer generated document. This document does not require signature.
- - \ No newline at end of file + \ No newline at end of file diff --git a/app/Views/editCapitalAmendPO.php b/app/Views/editCapitalAmendPO.php index 3a6058c8..4c873001 100755 --- a/app/Views/editCapitalAmendPO.php +++ b/app/Views/editCapitalAmendPO.php @@ -796,23 +796,20 @@ if (!empty($POItem) && $CapitalRange == '1') {
-
- +
+
- - - - - - - - - - - - + + + + + + + + + + @@ -826,16 +823,17 @@ if (!empty($POItem) && $CapitalRange == '1') { ?> - - - - - - - + + + + + + - - @@ -3453,29 +3451,27 @@ Calculate Landing charge //alert(basicamt); } - if (validate()) { + if (capitalValidate()) { var ex = $('#ExchangeRt').val(); //alert(ex); //alert(parseInt($('#CapitalToatlOrder').val() * ex)); var AvlBudAmt = ''; //alert(AvlBudAmt); - if (document.getElementById('serviceTax').rows.length < 2) { - alert('Please Select Line item to Create PO'); - $('#Deliverydt').focus(); - return false; - } else if ($('#Otherpayment').val() == '' && $('#PaymentMethod').val() == 'PT08') { - alert('Please Enter Other Payable Terms Description'); - $('#Otherpayment').focus(); - return false; - } - + // if (document.getElementById('serviceTax').rows.length < 2) { + // alert('Please Select Line item to Create PO'); + // $('#Deliverydt').focus(); + // return false; + // } else if ($('#Otherpayment').val() == '' && $('#PaymentMethod').val() == 'PT08') { + // alert('Please Enter Other Payable Terms Description'); + // $('#Otherpayment').focus(); + // return false; + // } // else if(parseInt(AvlBudAmt) < parseInt(basicamt)) { - // alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.'); - - // return false; - // } - else { + // alert('Total Order Amount is exceeding the Budget Limit.Please adjust the product value.'); + // return false; + // } + // else { //alert('else'); @@ -3500,7 +3496,7 @@ Calculate Landing charge $('#loader').show(); - + // disableButtons(); $.ajax({ // data:$('.CapitalPO').serialize()+"&ExchangeRateOn="+ExchangeRateOn+"&PaymentMethod="+PaymentMethod+"&PayableAT="+PayableAT+"&PaymentDate="+PaymentDate, type: "POST", @@ -3519,15 +3515,17 @@ Calculate Landing charge $('#SpcialInstruction').val(''); $('#txtDeliveryAddress').val(''); window.location = status == 1 ? "amendmentpurchaseorder" : "purchaseorderListing"; + // setTimeout(function() { enableButtons(); }, 2000); } else { $('#loader').hide(); alert("Error"); + // setTimeout(function() { enableButtons(); }, 2000); } } }); - } + // } } } diff --git a/app/Views/editCapitalPo.php b/app/Views/editCapitalPo.php index 556e9f2f..e57f3953 100755 --- a/app/Views/editCapitalPo.php +++ b/app/Views/editCapitalPo.php @@ -870,7 +870,7 @@ if (!empty($getlogpodtl)) {
- +
@@ -883,21 +883,22 @@ if (!empty($getlogpodtl)) {
-
SNoRequisition NoItem NameQuantityUOMRateBasic AmountTax AmountTotal Order AmountActionSNoRequisition NoItem DescriptionQuantityUOMRateBasic AmountTax AmountTotal Order AmountAction
ReqNo ?>MaterialName ?>Quantity ?>UOM ?>Rate ?> + ReqNo ?>MaterialName, 0, 13, "..."); + echo $shortName; ?>Quantity ?>UOM ?>Rate, 2, '.', ''); ?> Rate * $record->Quantity, 2, '.', ''); ?> ServiceTaxamount; } else if ($CapitalRange == '0') { echo "0.0"; @@ -845,12 +843,12 @@ if (!empty($POItem) && $CapitalRange == '1') { - Rate * $record->Quantity + $record->ServiceTaxamount + $record->otherallowance + $record->Afvalue - $record->Afterdiscountval, 2, '.', '') ?> + Rate * $record->Quantity + $record->ServiceTaxamount + $record->otherallowance + $record->Afvalue - $record->Afterdiscountval, 2, '.', '') ?> + Rate * $record->Quantity), 2, '.', ''); ?>
+
+
+
- - - - - - - - - - + + + + + + + + + + @@ -920,9 +921,10 @@ if (!empty($getlogpodtl)) { ?> - + - + - - - - + + + + - - + - + - + - + $record->MaterialCode, "ReqNo" => $record->ReqNo); array_push($res_arr_values, $row); @@ -990,11 +992,11 @@ if (!empty($getlogpodtl)) { - - @@ -1021,11 +1023,11 @@ if (!empty($getlogpodtl)) { - - - - - - - @@ -1159,13 +1161,13 @@ if (!empty($getlogpodtl)) { - - - @@ -1287,6 +1289,8 @@ if (!empty($getlogpodtl)) { ?>
SNoRequisition NoItem CodeItem DescriptionLine Item SpecsQuantityUOMRateBasic AmountTax AmountTotal Order AmountRequisition NoItem CodeItem DescriptionLine Item SpecsQuantityUOMRateBasic AmountTax AmountTotal Order Amount
ReqNo ?>ReqNo ?> MaterialCode ?>MaterialName ?>MaterialName, 0, 13, "..."); + echo $shortName; ?> LineitemAuditorNotes) ? $record->LineitemAuditorNotes : "-"; } ?> Quantity ?>UOM ?>Rate ?>Rate * $record->Quantity, 2, '.', '') ?>Quantity ?>UOM ?>Rate ?>Rate * $record->Quantity, 2, '.', '') ?> ServiceTaxamount; ?> + ServiceTaxamount; ?> Rate * $record->Quantity + $record->ServiceTaxamount + $record->otherallowance + $record->Afvalue - $record->Afterdiscountval, 2, '.', '') ?> Rate * $record->Quantity, 2, '.', '') ?>Rate * $record->Quantity, 2, '.', '') ?>
+
+
@@ -1564,7 +1568,7 @@ if (!empty($getlogpodtl)) {
-
+
@@ -1957,7 +1961,7 @@ if (!empty($getlogpodtl)) { echo form_input($data); ?>
-
+
@@ -1982,7 +1986,7 @@ if (!empty($getlogpodtl)) {
-
+
@@ -2011,7 +2015,7 @@ if (!empty($getlogpodtl)) {
-
+
@@ -2038,7 +2042,7 @@ if (!empty($getlogpodtl)) {
-
+
@@ -2049,7 +2053,7 @@ if (!empty($getlogpodtl)) { ?>
-
+
@@ -2645,7 +2649,7 @@ if (!empty($getlogpodtl)) { ?>
-
+
@@ -2669,7 +2673,7 @@ if (!empty($getlogpodtl)) {
-
+
@@ -2694,7 +2698,7 @@ if (!empty($getlogpodtl)) {
-
+
@@ -2721,7 +2725,7 @@ if (!empty($getlogpodtl)) {
-
+
@@ -2733,7 +2737,7 @@ if (!empty($getlogpodtl)) { ?>
-
+
@@ -3278,7 +3282,7 @@ if (!empty($getlogpodtl)) {
-
+
CGST In %
@@ -3295,7 +3299,7 @@ if (!empty($getlogpodtl)) {
-
+
SGST In %
@@ -3312,7 +3316,7 @@ if (!empty($getlogpodtl)) {
-
+
IGST In %
@@ -3329,7 +3333,7 @@ if (!empty($getlogpodtl)) {
-
+
@@ -3340,7 +3344,7 @@ if (!empty($getlogpodtl)) {
-
+
@@ -3642,7 +3646,7 @@ if (!empty($getlogpodtl)) {
-