diff --git a/app/Config/Routes.php b/app/Config/Routes.php index e3e8baa..6a81457 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -21,6 +21,7 @@ $routes->post("change_password_forget", "Users::change_password_forget"); $routes->post("add_account", "Users::add_account"); $routes->match(['get','post'],'/forgot_password','Users::forgot_password'); $routes->match(['get','post'],'/verify_otp','Users::verify_otp'); +$routes->post('status_user', 'Users::status_user'); // $routes->get("new_user/(:any)", "Users::new_user/$1"); @@ -70,6 +71,7 @@ $routes->post("save_make", "Products::save_make"); $routes->post("save_model", "Products::save_model"); $routes->post("save_manufacturer", "Products::save_manufacturer"); $routes->get("product_list_for_service", "Products::product_list_for_service"); +$routes->post('status_product', 'Products::status_product'); //end products// //Sales order // @@ -113,6 +115,7 @@ $routes->get("new_vendor/(:any)", "Vendor::new_vendor/$1"); $routes->get("delete_vendor/(:any)", "Vendor::delete_vendor/$1"); $routes->get("get_product_by_vendor/(:any)", "Vendor::get_product_by_vendor/$1"); $routes->post("fetch_models", "Vendor::fetch_models"); +$routes->post('status_vendor', 'Vendor::status_vendor'); //end Vendor //Vehicle// @@ -122,6 +125,8 @@ $routes->get("new_vehicle/(:any)", "Vehicle::new_vehicle/$1"); $routes->get("delete_vehicle/(:any)", "Vehicle::delete_vehicle/$1"); $routes->post("get_models_vehicle", "Vehicle::get_models"); $routes->post("checkRegisterNo", "Vehicle::checkRegisterNo"); +$routes->post('status_vehicle', 'Vehicle::status_vehicle'); + //end Vehicle @@ -162,6 +167,8 @@ $routes->get('dashboard', 'Users::dashboard'); $routes->post("get_models_service", "Service::get_models"); $routes->get("delete_service/(:any)", "Service::delete_service/$1"); $routes->post("get_product_by_models", "Service::get_product_by_models"); + $routes->post('status_service', 'Service::status_service'); + // Service End's// @@ -170,6 +177,7 @@ $routes->get('dashboard', 'Users::dashboard'); $routes->get('spare_manufacturer_index', 'Manufacturer::index'); $routes->post('create_manufacturer/(:any)', 'Manufacturer::create_manufacturer/$1'); $routes->post('create_manufacture_product_form', 'Manufacturer::create_manufacture_product_form'); + $routes->post('status_manufacturer', 'Manufacturer::status_manufacturer'); //Spare manufacturer End's// @@ -208,6 +216,8 @@ $routes->get('dashboard', 'Users::dashboard'); $routes->post('create_complaint/(:any)', 'Complaint::create_complaint/$1'); $routes->get('edit_complaint/(:any)', 'Complaint::edit_complaint/$1'); $routes->get("delete_complaint/(:any)", "Complaint::delete_complaint/$1"); + $routes->post('status_complaint', 'Complaint::status_complaint'); + // Complaint End's// // Out sourcing @@ -215,5 +225,6 @@ $routes->get('dashboard', 'Users::dashboard'); $routes->post('create_os', 'Outsourcing::create_os'); $routes->get('edit_os/(:any)', 'Outsourcing::edit_OS/$1'); $routes->get("delete_outsource/(:any)", "Outsourcing::delete_outsource/$1"); + $routes->post('status_outsource', 'Outsourcing::status_outsource'); // Complaint End's diff --git a/app/Controllers/Complaint.php b/app/Controllers/Complaint.php index c123e7c..e12b1fd 100644 --- a/app/Controllers/Complaint.php +++ b/app/Controllers/Complaint.php @@ -94,5 +94,31 @@ class Complaint extends BaseController // Return error response if deletion fails return $this->response->setJSON(['success' => false]); } + + public function status_complaint() + { + + try { + $complaint_id = $this->request->getPost('complaint_id'); + $isactive = $this->request->getPost('isactive'); + + $ComplaintModel = new ComplaintModel(); + $data = [ + 'isactive' => $isactive + ]; + $updated = $ComplaintModel->update($complaint_id, $data); + + if ($updated) { + $result = $data; + return $this->respond(['status' => 'success','code' => 200],200); + } else { + $result = "No Match's"; + return $this->respond(['status' => 'failed','code' => 404],404); + } + } catch (\Exception $exception) { + return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500); + } + } + } ?> \ No newline at end of file diff --git a/app/Controllers/Jobcard.php b/app/Controllers/Jobcard.php index e01ed45..7c032d7 100644 --- a/app/Controllers/Jobcard.php +++ b/app/Controllers/Jobcard.php @@ -23,6 +23,7 @@ use App\Models\SalesOrderProductModel; use App\Models\UsersModel; use App\Models\RoleModel; use Mpdf\Mpdf; +use DateTime; class Jobcard extends BaseController { @@ -84,9 +85,9 @@ class Jobcard extends BaseController public function download_jobcard_invoice($job_card_id) { $data['vehicle'] = $this->JobcardModel->get_jobcard_vehicle_details($job_card_id); - // print_r($data['vehicle']);die; $bus_id = $this->session->get('logged_user_business_id'); $data['job_card'] = $this->JobcardModel->where('job_card_id',$job_card_id)->findAll(); + $data['company_address'] = $this->BranchModel->where('branch_id', $this->session->get('logged_user_branch_id'))->where('business_id', $bus_id)->where('isactive', 1)->findAll(); // echo json_encode($data['company_address']);die; $productdata = $this->JobcardModel->get_jobcard_products_details($job_card_id); @@ -158,8 +159,8 @@ class Jobcard extends BaseController $mpdf->SetTitle('Invoice'); // $mpdf->SetAuthor($data[0]->branch_name); $mpdf->SetCreator(''); - - + // echo"
";
+ // print_r($data['job_card_products']);die;
// Generate the PDF content (HTML) with data
$html = view('invoice_pdf_template_jobcard', $data);
// echo $html;die;
@@ -167,7 +168,7 @@ class Jobcard extends BaseController
$mpdf->WriteHTML($html);
// Output the PDF to the browser for download
- $mpdf->Output('invoice_' . date('Y-m-d H-i-s') . '.pdf', 'D');
+ $mpdf->Output( $data['job_card'][0]['order_number'] .'_'. date('Y-m-d H-i-s') . '.pdf', 'D');
}
@@ -634,6 +635,11 @@ class Jobcard extends BaseController
$this->delete_items($this->request->getPost('delete_items'));
$rework = $this->request->getPost('rework');
// Job card INSERT
+ $deliveryDate = $this->request->getPost('delivery_date');
+
+ // Retrieve and validate the delivery date
+ $deliveryDate = $this->request->getPost('delivery_date');
+
$job_card_data = [
'client_name' => $this->request->getPost('client_id'),
'client_mobile_no' => $this->request->getPost('mobile_no'),
@@ -645,7 +651,7 @@ class Jobcard extends BaseController
'billing_postal_code' => $this->request->getPost('postalcode'),
'fuel_qty'=> $this->request->getPost('fuel_qty'),
'meter'=> $this->request->getPost('meter'),
- 'delivery_date'=> $this->request->getPost('delivery_date'),
+ 'delivery_date' => !empty($deliveryDate) ? $deliveryDate : '0000-00-00',
'note'=> $this->request->getPost('note'),
'status'=> $this->request->getPost('status'),
'assigned_to'=> json_encode($this->request->getPost('assigned_to')),
@@ -655,11 +661,17 @@ class Jobcard extends BaseController
'total'=> $this->request->getPost('grand_total'), //(isset($rework) ? 0 : $this->request->getPost('grand_total') ),
'isactive' => 1
];
+ // echo "";
+ // print_r($job_card_data);die;
$status = $this->request->getPost('status');
// Insert or update sales order
$job_card_id = $this->request->getPost('job_card_id');
if (!empty($job_card_id)) {
- if($status == 'Cancelled')
+ if ($status === "Paid") {
+ $job_card_data = [];
+ $job_card_data['status'] = $status;
+ $job_card_data['mode_of_payment'] = $this->request->getPost('mode_of_payment');
+ }else if($status == 'Cancelled')
{
// echo $status;die;
$job_card_data = [];
@@ -694,7 +706,7 @@ class Jobcard extends BaseController
$service['job_card_id'] = $job_card_id;
$service['service_id'] = $item->service_id;
$service['qty'] = $item->quality;
- $service['tax'] = $item->tax;
+ $service['tax'] = (int)$item->tax;
$service['labour_cost'] = $item->labour_cost; //(isset($rework) ? 0 : $item->labour_cost );
$service['amount'] = $item->amount; //(isset($rework) ? 0 : $item->amount );
@@ -726,7 +738,7 @@ class Jobcard extends BaseController
$service['complaint_id'] = $item->complaint_id;
$service['labour_cost'] = $item->amount;
$service['qty'] = $item->quality;
- $service['tax'] = $item->tax;
+ $service['tax'] = (int)$item->tax;
$service['amount'] = $item->amount;
if(empty($item->id)) {
$JobcardComplaintModel->insert($service);
diff --git a/app/Controllers/Manufacturer.php b/app/Controllers/Manufacturer.php
index 2e8334e..b255a74 100644
--- a/app/Controllers/Manufacturer.php
+++ b/app/Controllers/Manufacturer.php
@@ -107,4 +107,29 @@ class Manufacturer extends BaseController
}
}
+ public function status_manufacturer()
+ {
+
+ try {
+ $manufacturer_id = $this->request->getPost('manufacturer_id');
+ $isactive = $this->request->getPost('isactive');
+
+ $ManufacturerModel = new ManufacturerModel();
+ $data = [
+ 'isactive' => $isactive
+ ];
+ $updated = $ManufacturerModel->update($manufacturer_id, $data);
+
+ if ($updated) {
+ $result = $data;
+ return $this->respond(['status' => 'success','code' => 200],200);
+ } else {
+ $result = "No Match's";
+ return $this->respond(['status' => 'failed','code' => 404],404);
+ }
+ } catch (\Exception $exception) {
+ return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
+ }
+ }
+
}
diff --git a/app/Controllers/Outsourcing.php b/app/Controllers/Outsourcing.php
index f9d744c..ac2116f 100644
--- a/app/Controllers/Outsourcing.php
+++ b/app/Controllers/Outsourcing.php
@@ -19,7 +19,7 @@ class Outsourcing extends BaseController
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$OutsourceModel = new OutsourceModel();
- $os_data = $OutsourceModel->where('is_active', 1)->findAll();
+ $os_data = $OutsourceModel->findAll();
$data['out_source'] = $os_data;
return view('outsourcing_list', $data);
}
@@ -91,5 +91,30 @@ class Outsourcing extends BaseController
return $this->response->setJSON(['success' => false]);
}
+ public function status_outsource()
+ {
+
+ try {
+ $id = $this->request->getPost('outsource_id');
+ $isactive = $this->request->getPost('isactive');
+
+ $OutsourceModel = new OutsourceModel();
+ $data = [
+ 'is_active' => $isactive
+ ];
+ $updated = $OutsourceModel->update($id, $data);
+
+ if ($updated) {
+ $result = $data;
+ return $this->respond(['status' => 'success','code' => 200],200);
+ } else {
+ $result = "No Match's";
+ return $this->respond(['status' => 'failed','code' => 404],404);
+ }
+ } catch (\Exception $exception) {
+ return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
+ }
+ }
+
}
?>
\ No newline at end of file
diff --git a/app/Controllers/Products.php b/app/Controllers/Products.php
index d7b3dd0..729b041 100644
--- a/app/Controllers/Products.php
+++ b/app/Controllers/Products.php
@@ -8,12 +8,15 @@ use App\Models\ProductModel;
use App\Models\BikemodelsModel;
use App\Models\ManufacturerModel;
+use CodeIgniter\API\ResponseTrait;
class Products extends BaseController
{
public $session;
+ use ResponseTrait;
+
public function __construct()
{
@@ -439,4 +442,30 @@ class Products extends BaseController
return $this->response->setJSON($products);
}
+
+ public function status_product()
+ {
+
+ try {
+ $product_id = $this->request->getPost('product_id');
+ $isactive = $this->request->getPost('isactive');
+
+ $ProductModel = new ProductModel();
+ $data = [
+ 'isactive' => $isactive
+ ];
+ $updated = $ProductModel->update($product_id, $data);
+
+ if ($updated) {
+ $result = $data;
+ return $this->respond(['status' => 'success','code' => 200],200);
+ } else {
+ $result = "No Match's";
+ return $this->respond(['status' => 'failed','code' => 404],404);
+ }
+ } catch (\Exception $exception) {
+ return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
+ }
+ }
+
}
\ No newline at end of file
diff --git a/app/Controllers/Purchase.php b/app/Controllers/Purchase.php
index dc5e2c5..d6d9445 100644
--- a/app/Controllers/Purchase.php
+++ b/app/Controllers/Purchase.php
@@ -245,7 +245,8 @@ class Purchase extends BaseController
$PurchaseOrderModel->insert($data);
$purchase_order_id = $PurchaseOrderModel->getInsertID();
}
- $orderNumber = 'PO' . str_pad($purchase_order_id, 8, '0', STR_PAD_LEFT);
+
+ $orderNumber = 'PO-' . date('md') . '-' . str_pad($purchase_order_id, 5, '0', STR_PAD_LEFT);
// print_r($orderNumber);die;
// Update sales order with generated order number
$PurchaseOrderModel->update($purchase_order_id, ['order_number' => $orderNumber]);
diff --git a/app/Controllers/Sales.php b/app/Controllers/Sales.php
index 5b0f9c6..796aa3e 100644
--- a/app/Controllers/Sales.php
+++ b/app/Controllers/Sales.php
@@ -34,7 +34,7 @@ class Sales extends BaseController
$data['sales']=$sales;
// echo"";
- // print_r($data);die;
+ // print_r($sales);die;
return view('sales_list',$data);
}
@@ -139,156 +139,157 @@ class Sales extends BaseController
}
-public function add_sales()
-{
- if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
- $SalesOrderModel = new SalesOrderModel();
- $ProductModel = new ProductModel();
- $SalesOrderProductModel = new SalesOrderProductModel(); // Assuming you have a model for sales_order_product
+ public function add_sales()
+ {
+ if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
+ $SalesOrderModel = new SalesOrderModel();
+ $ProductModel = new ProductModel();
+ $SalesOrderProductModel = new SalesOrderProductModel(); // Assuming you have a model for sales_order_product
- // Prepare data for sales order
- $data = [
- 'client_name' => $this->request->getPost('client_id'),
- 'vehicle_id'=>$this->request->getPost('vehicle_id'),
- 'billing_address' => $this->request->getPost('billing_address'),
- 'billing_city' => $this->request->getPost('city'),
- 'mobile_no' => $this->request->getPost('mobile_no'),
- 'billing_state' => $this->request->getPost('state'),
- 'billing_postal_code' => $this->request->getPost('postalcode'),
- // 'billing_country' => $this->request->getPost('country'),
- 'terms_condition' => $this->request->getPost('terms_condition'),
- 'subtotal' => $this->request->getPost('sub_total'),
- 'tax' => $this->request->getPost('invoice_tax'),
-
- 'total'=> $this->request->getPost('grand_total'),
- 'status'=> $this->request->getPost('status'),
- 'isactive' => 1, // Assuming this is a default value or handled separately
- 'branch_id'=> $this->session->get('logged_user_branch_id'),
- ];
-
- // Insert or update sales order
- $sales_order_id = $this->request->getPost('sales_order_id');
- if (!empty($sales_order_id)) {
- // print_r("hello");die;
- if ($this->request->getPost('status') === "Paid") {
- $data['mode_of_payment'] = $this->request->getPost('mode_of_payment');
- }
- $SalesOrderModel->update($sales_order_id, $data);
- } else {
- $SalesOrderModel->insert($data);
- $sales_order_id = $SalesOrderModel->getInsertID(); // Get the last inserted ID
- }
- $orderNumber = 'SO' . str_pad($sales_order_id, 8, '0', STR_PAD_LEFT);
-
- // Update sales order with generated order number
- $SalesOrderModel->update($sales_order_id, ['order_number' => $orderNumber]);
-
- // Prepare data for sales order product
- $product_ids = $this->request->getPost('item_details');
- $quantities = $this->request->getPost('quantity');
- $discounts = $this->request->getPost('discount_amount');
- $discount_types = $this->request->getPost('discount_type');
- $amounts = $this->request->getPost('amount');
- $itemtax=$this->request->getPost('item-tax');
- $unitprice=$this->request->getPost('unit-price');
- $sales_product_id = $this->request->getPost('sales_order_product_id');
-
-
-
- $status = $this->request->getPost('status');
- foreach ($product_ids as $key => $product_id) {
- $qty = isset($quantities[$key]) ? $quantities[$key] : 0;
- if ($status == 'Created') {
- // echo "hello";die;
- $this->updateProductQuantity($ProductModel, $product_id, $qty);
- }elseif ($status == 'Cancelled'){
- // echo "cancel";die;
-
- // echo"hello";die;
- $this->addBackProductQuantity($ProductModel, $product_id, $qty);
- }
-
- $discount = isset($discounts[$key]) ? $discounts[$key] : 0;
- $discount_type = isset($discount_types[$key]) ? $discount_types[$key] : '';
- $tax=isset($itemtax[$key]) ? $itemtax[$key] : 0;
- $rate=isset($unitprice[$key]) ? $unitprice[$key] : 0;
- $amount = isset($amounts[$key]) ? $amounts[$key] : 0;
- // $new_qty = $this->calculateUpdatedQuantity($ProductModel, $product_id, $qty);
- // print_r($discount_type);die;
- $product_data = [
- 'sales_order_id' => $sales_order_id,
- 'product_id' => $product_id,
- 'qty' => $qty,
- 'discount' => $discount,
- 'discount_type' => $discount_type,
- 'net_price'=>$rate,
- 'tax'=>$tax,
- 'amount' => $amount,
- 'isactive'=>1,
+ // Prepare data for sales order
+ $data = [
+ 'client_name' => $this->request->getPost('client_id'),
+ 'vehicle_id'=>$this->request->getPost('vehicle_id'),
+ 'billing_address' => $this->request->getPost('billing_address'),
+ 'billing_city' => $this->request->getPost('city'),
+ 'mobile_no' => $this->request->getPost('mobile_no'),
+ 'billing_state' => $this->request->getPost('state'),
+ 'billing_postal_code' => $this->request->getPost('postalcode'),
+ // 'billing_country' => $this->request->getPost('country'),
+ 'terms_condition' => $this->request->getPost('terms_condition'),
+ 'subtotal' => $this->request->getPost('sub_total'),
+ 'tax' => $this->request->getPost('invoice_tax'),
+
+ 'total'=> $this->request->getPost('grand_total'),
+ 'status'=> $this->request->getPost('status'),
+ 'isactive' => 1, // Assuming this is a default value or handled separately
+ 'branch_id'=> $this->session->get('logged_user_branch_id'),
];
- // print_r($product_data);die;
- if (!empty($sales_product_id[$key])) {
-
-
- $SalesOrderProductModel->update($sales_product_id[$key], $product_data);
-
+
+ // Insert or update sales order
+ $sales_order_id = $this->request->getPost('sales_order_id');
+ if (!empty($sales_order_id)) {
+ // print_r("hello");die;
+ if ($this->request->getPost('status') === "Paid") {
+ $data['mode_of_payment'] = $this->request->getPost('mode_of_payment');
+ }
+ $SalesOrderModel->update($sales_order_id, $data);
} else {
- $SalesOrderProductModel->insert($product_data);
-
+ $SalesOrderModel->insert($data);
+ $sales_order_id = $SalesOrderModel->getInsertID(); // Get the last inserted ID
}
-
+
+ $orderNumber = 'SO-' . date('md') . '-' . str_pad($sales_order_id, 5, '0', STR_PAD_LEFT);
+
+ // Update sales order with generated order number
+ $SalesOrderModel->update($sales_order_id, ['order_number' => $orderNumber]);
+
+ // Prepare data for sales order product
+ $product_ids = $this->request->getPost('item_details');
+ $quantities = $this->request->getPost('quantity');
+ $discounts = $this->request->getPost('discount_amount');
+ $discount_types = $this->request->getPost('discount_type');
+ $amounts = $this->request->getPost('amount');
+ $itemtax=$this->request->getPost('item-tax');
+ $unitprice=$this->request->getPost('unit-price');
+ $sales_product_id = $this->request->getPost('sales_order_product_id');
+
+
+
+ $status = $this->request->getPost('status');
+ foreach ($product_ids as $key => $product_id) {
+ $qty = isset($quantities[$key]) ? $quantities[$key] : 0;
+ if ($status == 'Created') {
+ // echo "hello";die;
+ $this->updateProductQuantity($ProductModel, $product_id, $qty);
+ }elseif ($status == 'Cancelled'){
+ // echo "cancel";die;
+
+ // echo"hello";die;
+ $this->addBackProductQuantity($ProductModel, $product_id, $qty);
+ }
- }
-
-
- return redirect()->to('sales_order_index');
-}
-
-private function addBackProductQuantity($ProductModel, $product_id, $sold_qty)
-{
- if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
- // Fetch current product quantity
- $product = $ProductModel->find($product_id);
- $current_qty = $product['qty_stock'];
-
- // Calculate updated quantity
- $new_qty = $current_qty + $sold_qty;
-
- // Update quantity in Product table
- $ProductModel->update($product_id, ['qty_stock' => $new_qty]);
-}
-private function updateProductQuantity($ProductModel, $product_id, $sold_qty)
-{
- if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
- // Fetch current product quantity
- $product = $ProductModel->find($product_id);
- $current_qty = $product['qty_stock'];
-
- // Calculate updated quantity
- $new_qty = $current_qty - $sold_qty;
-
- // Update quantity in Product table
- $ProductModel->update($product_id, ['qty_stock' => $new_qty]);
-}
-
-public function delete_sales_product()
-{
- if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
- $sales_order_product_id = $this->request->getPost('sales_order_product_id');
-
- if (!empty($sales_order_product_id)) {
- $SalesOrderProductModel = new SalesOrderProductModel();
- $data['isactive'] = 0;
+ $discount = isset($discounts[$key]) ? $discounts[$key] : 0;
+ $discount_type = isset($discount_types[$key]) ? $discount_types[$key] : '';
+ $tax=isset($itemtax[$key]) ? $itemtax[$key] : 0;
+ $rate=isset($unitprice[$key]) ? $unitprice[$key] : 0;
+ $amount = isset($amounts[$key]) ? $amounts[$key] : 0;
+ // $new_qty = $this->calculateUpdatedQuantity($ProductModel, $product_id, $qty);
+ // print_r($discount_type);die;
+ $product_data = [
+ 'sales_order_id' => $sales_order_id,
+ 'product_id' => $product_id,
+ 'qty' => $qty,
+ 'discount' => $discount,
+ 'discount_type' => $discount_type,
+ 'net_price'=>$rate,
+ 'tax'=>$tax,
+ 'amount' => $amount,
+ 'isactive'=>1,
+ ];
+ // print_r($product_data);die;
+ if (!empty($sales_product_id[$key])) {
+
+
+ $SalesOrderProductModel->update($sales_product_id[$key], $product_data);
+
+ } else {
+ $SalesOrderProductModel->insert($product_data);
+
+ }
- if ($SalesOrderProductModel->update($sales_order_product_id, $data)) {
- // Return success response
- return $this->response->setJSON(['success' => true]);
+
}
+
+
+ return redirect()->to('sales_order_index');
}
- // Return error response if deletion fails
- return $this->response->setJSON(['success' => false]);
-}
+ private function addBackProductQuantity($ProductModel, $product_id, $sold_qty)
+ {
+ if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
+ // Fetch current product quantity
+ $product = $ProductModel->find($product_id);
+ $current_qty = $product['qty_stock'];
+
+ // Calculate updated quantity
+ $new_qty = $current_qty + $sold_qty;
+
+ // Update quantity in Product table
+ $ProductModel->update($product_id, ['qty_stock' => $new_qty]);
+ }
+ private function updateProductQuantity($ProductModel, $product_id, $sold_qty)
+ {
+ if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
+ // Fetch current product quantity
+ $product = $ProductModel->find($product_id);
+ $current_qty = $product['qty_stock'];
+
+ // Calculate updated quantity
+ $new_qty = $current_qty - $sold_qty;
+
+ // Update quantity in Product table
+ $ProductModel->update($product_id, ['qty_stock' => $new_qty]);
+ }
+
+ public function delete_sales_product()
+ {
+ if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
+ $sales_order_product_id = $this->request->getPost('sales_order_product_id');
+
+ if (!empty($sales_order_product_id)) {
+ $SalesOrderProductModel = new SalesOrderProductModel();
+ $data['isactive'] = 0;
+
+ if ($SalesOrderProductModel->update($sales_order_product_id, $data)) {
+ // Return success response
+ return $this->response->setJSON(['success' => true]);
+ }
+ }
+
+ // Return error response if deletion fails
+ return $this->response->setJSON(['success' => false]);
+ }
public function delete_sale($sales_order_id)
@@ -374,9 +375,9 @@ public function delete_sales_product()
// echo $html;die;
// Load HTML into the mPDF instance
$mpdf->WriteHTML($html);
-
+ date_default_timezone_set('Asia/Kolkata');
// Output the PDF to the browser for download
- $mpdf->Output('invoice_' . date('Y-m-d H-i-s') . '.pdf', 'D');
+ $mpdf->Output($data[0]->order_number .'_' . date('Y-m-d H-i-s') . '.pdf', 'D');
}
@@ -446,64 +447,64 @@ public function delete_sales_product()
}
}
-public function get_vehicle_products(){
-
-}
-
-
-
-
-public function getProducts()
-{
- if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
- // Retrieve make_id and model_id from the request
- $makeId = $this->request->getPost('make_id');
- $modelId = $this->request->getPost('model_id');
-
- // Encode the modelId before searching
- $encodedMakeId = json_encode([$makeId]);
- $encodedModelId = json_encode([$modelId]);
-
- // Load the ProductModel
- $productModel = new ProductModel();
- $bikemodelsModel = new BikemodelsModel();
- $BikemakeModel = new BikemakeModel();
-
- $makeGeneral = $BikemakeModel->where('make' , 'General')->first();
- $modelGeneral = $bikemodelsModel->where('model_name' , 'General')->first();
-
-
- // Query the database to find the product based on make_id and model_id
- $makeproduct = $productModel->select('products.*, manufacturer.manufacturer_name')
- ->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id')
- ->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId . '\')', null, false)
- ->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
- ->where('qty_stock >',0)
- ->where('products.isactive', 1)
- ->findAll();
-
- $encodedMakeId = json_encode(['0']);
- $encodedModelId = json_encode(['0']);
-
- $common_product = $productModel->select('products.*, manufacturer.manufacturer_name')
- ->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id')
- ->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId . '\')', null, false)
- ->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
- ->where('qty_stock >',0)
- ->where('products.isactive', 1)
- ->findAll();
- $product = array_merge($common_product, $makeproduct);
-
- $modelName = $this->BikemodelsModel->where('model_id',$modelId)->get()->getRow()->model_name;
- $makeName = $this->BikemakeModel->where('make_id',$makeId)->get()->getRow()->make;
- if($product){
- // Send JSON response
- return $this->response->setJSON(['product'=>$product , 'modelName'=>$modelName ,'makeName'=>$makeName] );
- } else {
- // If product is not found, return an empty response or appropriate message
- return $this->response->setJSON(['product'=>[] , 'modelName'=>$modelName ,'makeName'=>$makeName]);
+ public function get_vehicle_products(){
+
}
-}
- // Check if product exists
+
+
+
+
+ public function getProducts()
+ {
+ if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
+ // Retrieve make_id and model_id from the request
+ $makeId = $this->request->getPost('make_id');
+ $modelId = $this->request->getPost('model_id');
+
+ // Encode the modelId before searching
+ $encodedMakeId = json_encode([$makeId]);
+ $encodedModelId = json_encode([$modelId]);
+
+ // Load the ProductModel
+ $productModel = new ProductModel();
+ $bikemodelsModel = new BikemodelsModel();
+ $BikemakeModel = new BikemakeModel();
+
+ $makeGeneral = $BikemakeModel->where('make' , 'General')->first();
+ $modelGeneral = $bikemodelsModel->where('model_name' , 'General')->first();
+
+
+ // Query the database to find the product based on make_id and model_id
+ $makeproduct = $productModel->select('products.*, manufacturer.manufacturer_name')
+ ->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id')
+ ->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId . '\')', null, false)
+ ->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
+ ->where('qty_stock >',0)
+ ->where('products.isactive', 1)
+ ->findAll();
+
+ $encodedMakeId = json_encode(['0']);
+ $encodedModelId = json_encode(['0']);
+
+ $common_product = $productModel->select('products.*, manufacturer.manufacturer_name')
+ ->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id')
+ ->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId . '\')', null, false)
+ ->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
+ ->where('qty_stock >',0)
+ ->where('products.isactive', 1)
+ ->findAll();
+ $product = array_merge($common_product, $makeproduct);
+
+ $modelName = $this->BikemodelsModel->where('model_id',$modelId)->get()->getRow()->model_name;
+ $makeName = $this->BikemakeModel->where('make_id',$makeId)->get()->getRow()->make;
+ if($product){
+ // Send JSON response
+ return $this->response->setJSON(['product'=>$product , 'modelName'=>$modelName ,'makeName'=>$makeName] );
+ } else {
+ // If product is not found, return an empty response or appropriate message
+ return $this->response->setJSON(['product'=>[] , 'modelName'=>$modelName ,'makeName'=>$makeName]);
+ }
+ }
+ // Check if product exists
}
\ No newline at end of file
diff --git a/app/Controllers/Service.php b/app/Controllers/Service.php
index 8932f83..7b92fe8 100644
--- a/app/Controllers/Service.php
+++ b/app/Controllers/Service.php
@@ -8,10 +8,15 @@ use App\Models\VendorModel;
use App\Models\BikemodelsModel;
use App\Models\ProductModel;
+use CodeIgniter\API\ResponseTrait;
+
class Service extends BaseController
{
public $session;
+
+ use ResponseTrait;
+
public function __construct()
{
@@ -294,4 +299,30 @@ class Service extends BaseController
return $this->response->setJSON($formatted_models);
}
+
+ public function status_service()
+ {
+
+ try {
+ $service_id = $this->request->getPost('service_id');
+ $isactive = $this->request->getPost('isactive');
+
+ $ServiceModel = new ServiceModel();
+ $data = [
+ 'isactive' => $isactive
+ ];
+ $updated = $ServiceModel->update($service_id, $data);
+
+ if ($updated) {
+ $result = $data;
+ return $this->respond(['status' => 'success','code' => 200],200);
+ } else {
+ $result = "No Match's";
+ return $this->respond(['status' => 'failed','code' => 404],404);
+ }
+ } catch (\Exception $exception) {
+ return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
+ }
+ }
+
}
\ No newline at end of file
diff --git a/app/Controllers/Users.php b/app/Controllers/Users.php
index 8fd54c7..cca2665 100644
--- a/app/Controllers/Users.php
+++ b/app/Controllers/Users.php
@@ -12,12 +12,16 @@ use App\Models\BikemodelsModel;
use App\Models\BikemakeModel;
use App\Helpers\MailHelper;
+use CodeIgniter\API\ResponseTrait;
class Users extends BaseController
{
public $session;
+
+ use ResponseTrait;
+
public function __construct()
{
@@ -335,16 +339,19 @@ class Users extends BaseController
'branch_id' => $this->request->getPost('branch'),
'isactive' => 1 // Assuming this is a default value or handled separately
];
+ $user_id = $this->request->getPost('user_id');
- // Hash the password
- $password = $this->request->getPost('password');
- $hashedPassword = password_hash($password, PASSWORD_DEFAULT); // Use PASSWORD_DEFAULT for bcrypt hashing
+ if($user_id == 0){
+ // Hash the password
+ $password = $this->request->getPost('password');
+ $hashedPassword = password_hash($password, PASSWORD_DEFAULT); // Use PASSWORD_DEFAULT for bcrypt hashing
- // Add hashed password to the data array
- $data['password'] = $hashedPassword;
+ // Add hashed password to the data array
+ $data['password'] = $hashedPassword;
+ }
+
// Get user_id from the form
- $user_id = $this->request->getPost('user_id');
// Check if user_id is provided
if (!empty($user_id)) {
@@ -498,4 +505,29 @@ class Users extends BaseController
return json_encode($response);
}
}
+
+ public function status_user()
+ {
+
+ try {
+ $user_id = $this->request->getPost('user_id');
+ $isactive = $this->request->getPost('isactive');
+
+ $UsersModel = new UsersModel();
+ $data = [
+ 'isactive' => $isactive
+ ];
+ $updated = $UsersModel->update($user_id, $data);
+
+ if ($updated) {
+ $result = $data;
+ return $this->respond(['status' => 'success','code' => 200],200);
+ } else {
+ $result = "No Match's";
+ return $this->respond(['status' => 'failed','code' => 404],404);
+ }
+ } catch (\Exception $exception) {
+ return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
+ }
+ }
}
\ No newline at end of file
diff --git a/app/Controllers/Vehicle.php b/app/Controllers/Vehicle.php
index 4c16c34..d7ab1e6 100644
--- a/app/Controllers/Vehicle.php
+++ b/app/Controllers/Vehicle.php
@@ -7,12 +7,16 @@ use App\Models\RoleModel;
use App\Models\BikemakeModel;
use App\Models\BikemodelsModel;
+use CodeIgniter\API\ResponseTrait;
class Vehicle extends BaseController
{
public $session;
+
+ use ResponseTrait;
+
protected $bikeMakeModel;
protected $bikeModelsModel;
public function __construct()
@@ -172,4 +176,31 @@ class Vehicle extends BaseController
}
+
+
+ public function status_vehicle()
+ {
+
+ try {
+ $vehicle_id = $this->request->getPost('vehicle_id');
+ $isactive = $this->request->getPost('isactive');
+
+ $VehicleModel = new VehicleModel();
+ $data = [
+ 'isactive' => $isactive
+ ];
+ $updated = $VehicleModel->update($vehicle_id, $data);
+
+ if ($updated) {
+ $result = $data;
+ return $this->respond(['status' => 'success','code' => 200],200);
+ } else {
+ $result = "No Match's";
+ return $this->respond(['status' => 'failed','code' => 404],404);
+ }
+ } catch (\Exception $exception) {
+ return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
+ }
+ }
+
}
\ No newline at end of file
diff --git a/app/Controllers/Vendor.php b/app/Controllers/Vendor.php
index 266119f..2cf2c5b 100644
--- a/app/Controllers/Vendor.php
+++ b/app/Controllers/Vendor.php
@@ -10,11 +10,15 @@ use App\Models\BikemodelsModel;
use App\Models\ManufacturerModel;
use App\Models\ProductModel;
+use CodeIgniter\API\ResponseTrait;
+
class Vendor extends BaseController
{
public $session;
+ use ResponseTrait;
+
protected $UsersModel;
public function __construct()
{
@@ -165,6 +169,31 @@ class Vendor extends BaseController
return json_encode($reorder);
}
+
+ public function status_vendor()
+ {
+
+ try {
+ $vendor_id = $this->request->getPost('vendor_id');
+ $isactive = $this->request->getPost('isactive');
+
+ $VendorModel = new VendorModel();
+ $data = [
+ 'isactive' => $isactive
+ ];
+ $updated = $VendorModel->update($vendor_id, $data);
+
+ if ($updated) {
+ $result = $data;
+ return $this->respond(['status' => 'success','code' => 200],200);
+ } else {
+ $result = "No Match's";
+ return $this->respond(['status' => 'failed','code' => 404],404);
+ }
+ } catch (\Exception $exception) {
+ return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
+ }
+ }
}
\ No newline at end of file
diff --git a/app/Models/JobcardModel.php b/app/Models/JobcardModel.php
index e23223b..009a23a 100644
--- a/app/Models/JobcardModel.php
+++ b/app/Models/JobcardModel.php
@@ -9,7 +9,7 @@ class JobcardModel extends Model
'order_number','client_mobile_no','client_name',
'billing_address','billing_city','billing_state','billing_country',
'billing_postal_code','fuel_qty', 'meter', 'delivery_date', 'note',
- 'status','assigned_to', 'is_rework','subtotal','tax', 'discount','total','isactive'];
+ 'status','assigned_to', 'is_rework','subtotal','tax', 'discount','total','isactive','mode_of_payment'];
@@ -71,8 +71,9 @@ class JobcardModel extends Model
public function get_jobcard_vehicle_details($job_id)
{
- $this->select('job_card.job_card_id, job_card.order_number, job_card.vehicle_id as jobcard_vehicle_id, vehicle.*, make.make as bike_company, model.model_name as bike_name');
+ $this->select('job_card.job_card_id, job_card.order_number, job_card.vehicle_id as jobcard_vehicle_id, vehicle.*, make.make as bike_company, model.model_name as bike_name, client.client_name');
$this->join('vehicle', 'vehicle.vehicle_id = job_card.vehicle_id');
+ $this->join('client', 'client.client_id = vehicle.client_id');
$this->join('make', 'make.make_id = vehicle.make');
$this->join('model', 'model.model_id = vehicle.model');
$this->where('job_card.job_card_id', $job_id);
diff --git a/app/Models/SalesOrderModel.php b/app/Models/SalesOrderModel.php
index 17884d1..69da91f 100644
--- a/app/Models/SalesOrderModel.php
+++ b/app/Models/SalesOrderModel.php
@@ -32,9 +32,8 @@ class SalesOrderModel extends Model
$this->groupBy('sales_order.sales_order_id');
// Add condition to fetch only active sales orders
- $this->where('sales_order_product.isactive', 1);
$this ->where('sales_order.branch_id',$logged_user_branch_id);
- $this->orderBy('sales_order.sales_order_id','DESC');
+ $this->orderBy('sales_order.order_number','desc');
// Get the results
return $this->findAll();
}
diff --git a/app/Models/VehicleModel.php b/app/Models/VehicleModel.php
index f5c1455..81bf969 100644
--- a/app/Models/VehicleModel.php
+++ b/app/Models/VehicleModel.php
@@ -17,7 +17,6 @@ class VehicleModel extends Model
$this->join('make', 'make.make_id = vehicle.make');
$this->join('model', 'model.model_id = vehicle.model');
$this->where('vehicle.branch_id', $branch_id);
- $this->where('vehicle.isactive', 1);
// Get the results
return $this->findAll();
diff --git a/app/Views/bike_model_list.php b/app/Views/bike_model_list.php
index 75bf7e2..3efb383 100644
--- a/app/Views/bike_model_list.php
+++ b/app/Views/bike_model_list.php
@@ -31,7 +31,7 @@
$item): ?>
-
+
@@ -45,12 +45,12 @@
@@ -302,14 +302,23 @@
}
// Move DataTable to the saved page and draw
datatable_bikeModel.page(savedPage).draw(false);
- $('.'+hightlight_tr).css('background','#faf6ca');
+
+ // Select the highlighted row
+ var $row = $('.' + hightlight_tr);
+
+ // Smoothly scroll to the row and center it in the viewport
$('html, body').animate({
- scrollTop: $('.'+hightlight_tr).offset().top
- }, 2000);
- setTimeout(() => {
- $('.'+hightlight_tr).css('background','');
-
- }, 4000);
+ scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
+ }, 500, function() {
+
+ // After focusing, change background color
+ $row.css('background', '#faf6ca');
+
+ // Remove background color after 4 seconds
+ setTimeout(function() {
+ $row.css('background', '');
+ }, 4000);
+ });
}
sessionStorage.removeItem('currentPage');
//End DataTable Paging is session is set
diff --git a/app/Views/branch_edit_form.php b/app/Views/branch_edit_form.php
index 12337ca..91a4088 100644
--- a/app/Views/branch_edit_form.php
+++ b/app/Views/branch_edit_form.php
@@ -22,7 +22,7 @@
-
+
diff --git a/app/Views/client_list.php b/app/Views/client_list.php
index 403582a..cae162a 100644
--- a/app/Views/client_list.php
+++ b/app/Views/client_list.php
@@ -29,7 +29,7 @@
$value) :
if ($value['isactive'] == 1) : ?>
-
+
= $value['client_name']; ?>
= $value['mobile_no']; ?>
= $value['email']; ?>
@@ -37,7 +37,7 @@
@@ -78,28 +78,37 @@
//Start DataTable Paging is session is set
var savedPage = sessionStorage.getItem('currentPage');
var hightlight_tr = sessionStorage.getItem('hightlight_tr');
- // console.log(savedPage);
- // console.log(hightlight_tr);
+ console.log(savedPage);
+ console.log(hightlight_tr);
// Ensure savedPage is a number
savedPage = parseInt(savedPage);
// Check if savedPage is not null and adjust if necessary
if (savedPage !== null && !isNaN(savedPage)) {
// Check if the saved page number is within the bounds of the current DataTable
- var totalPages = datatable_make.page.info().pages; // Total number of pages in the DataTable
+ var totalPages = datatable_client.page.info().pages; // Total number of pages in the DataTable
if (savedPage >= totalPages) {
// adjust to the last page of the DataTable
savedPage = totalPages > 0 ? totalPages - 1 : 0;
}
// Move DataTable to the saved page and draw
- datatable_make.page(savedPage).draw(false);
- $('.'+hightlight_tr).css('background','#faf6ca');
+ datatable_client.page(savedPage).draw(false);
+
+ // Select the highlighted row
+ var $row = $('.' + hightlight_tr);
+
+ // Smoothly scroll to the row and center it in the viewport
$('html, body').animate({
- scrollTop: $('.'+hightlight_tr).offset().top
- }, 2000);
- setTimeout(() => {
- $('.'+hightlight_tr).css('background','');
-
- }, 4000);
+ scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
+ }, 500, function() {
+
+ // After focusing, change background color
+ $row.css('background', '#faf6ca');
+
+ // Remove background color after 4 seconds
+ setTimeout(function() {
+ $row.css('background', '');
+ }, 4000);
+ });
}
sessionStorage.removeItem('currentPage');
sessionStorage.removeItem('hightlight_tr');
@@ -109,10 +118,11 @@
});
- function datatableMake(value) {
+ function datatableClient(value) {
+ console.log("---------------");
console.log(value);
- var currentPage = datatable_make.page.info().page;
+ var currentPage = datatable_client.page.info().page;
sessionStorage.setItem('currentPage', currentPage);
sessionStorage.setItem('hightlight_tr', value);
diff --git a/app/Views/complaint_list.php b/app/Views/complaint_list.php
index 24c28a1..38d74f6 100644
--- a/app/Views/complaint_list.php
+++ b/app/Views/complaint_list.php
@@ -28,9 +28,12 @@
- $value) : ?>
-
- = $value['name']; ?>
+ $value) :
+ $color = '';
+ if($value['isactive'] == 0){
+ $color ='red';
+ }?>
+ = $value['name']; ?>
= $value['tax']; ?>
= $value['labour_cost_with_tax']; ?>
= $value['labour_charge']; ?>
@@ -45,11 +48,14 @@
-
+
+ Edit
+
+ Deactivate
+
+ Activate
+
+
@@ -221,14 +227,23 @@
}
// Move DataTable to the saved page and draw
datatable_complaint.page(savedPage).draw(false);
- $('.'+hightlight_tr).css('background','#faf6ca');
+
+ // Select the highlighted row
+ var $row = $('.' + hightlight_tr);
+
+ // Smoothly scroll to the row and center it in the viewport
$('html, body').animate({
- scrollTop: $('.'+hightlight_tr).offset().top
- }, 2000);
- setTimeout(() => {
- $('.'+hightlight_tr).css('background','');
-
- }, 4000);
+ scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
+ }, 500, function() {
+
+ // After focusing, change background color
+ $row.css('background', '#faf6ca');
+
+ // Remove background color after 4 seconds
+ setTimeout(function() {
+ $row.css('background', '');
+ }, 4000);
+ });
}
sessionStorage.removeItem('currentPage');
sessionStorage.removeItem('hightlight_tr');
@@ -243,4 +258,38 @@
sessionStorage.setItem('hightlight_tr', value);
}
+
+ function statusChange(params) {
+ var status = params.getAttribute('data-isactive');
+ var complaint_id = params.getAttribute('data-id');
+ if(status == 1){
+ var isactive= 0;
+ }else{
+ var isactive= 1;
+ }
+
+ var formData = {
+ complaint_id: complaint_id,
+ isactive: isactive
+ };
+ $.ajax({
+ type: 'POST',
+ url: '',
+ data: formData,
+ dataType: 'json',
+ success: function(response) {
+ console.log(response);
+
+ if (response.status == "success") {
+ window.location.reload();
+ }
+ },
+ error: function(xhr, status, error) {
+ // Handle error response here
+ console.error(xhr.responseText);
+ }
+ });
+
+
+ }
\ No newline at end of file
diff --git a/app/Views/invoice_pdf_template.php b/app/Views/invoice_pdf_template.php
index e31c7d4..62130d3 100644
--- a/app/Views/invoice_pdf_template.php
+++ b/app/Views/invoice_pdf_template.php
@@ -218,7 +218,16 @@
= $sales[0]->total ?>
- Amount Chargeable (in words)
+ Amount Chargeable (in words):
+ format(round($sales[0]->subtotal + $sales[0]->tax));
+ ?>
+
+
+
+
+
diff --git a/app/Views/invoice_pdf_template_jobcard.php b/app/Views/invoice_pdf_template_jobcard.php
index 23515ed..51b601f 100644
--- a/app/Views/invoice_pdf_template_jobcard.php
+++ b/app/Views/invoice_pdf_template_jobcard.php
@@ -153,15 +153,15 @@ p {
THE MECHANIC
= $value['address'] ?>,
- = 'GSTNO: '.$value['gstno'] ?>
- = 'State Name: '.$value['state'].', code'.$value['state_code'] ?>
- = 'Contact: '.$value['postal_code'] ?>
+ = 'GST: '.$value['gstno'] ?>
+ = 'State: '.$value['state'].', code'.$value['state_code'] ?>
+ = 'Contact: '.$value['contact_1'] ?>
= 'Email: '.$value['email'] ?>
- Buyer (Bill To)
+ Buyer (Bill To) - = $vehicle[0]['client_name'] ?>
= $job_card[0]['billing_address'].', '.$job_card[0]['billing_city'].', '.$job_card[0]['billing_state'].', '.$job_card[0]['billing_country'].', '.$job_card[0]['billing_postal_code'] ?>,
- = 'GSTNO: ' ?>
- = 'State Name: '.$job_card[0]['billing_state'] ?>
+ = 'GST: ' ?>
+ = 'State: '.$job_card[0]['billing_state'] ?>
= 'Place of Supply: '.$value['state'] ?>
@@ -177,18 +177,18 @@ p {
Invoice No.
= $job_card[0]['inv_no'] ?>
+
+ Vehicle No
+ = $vehicle[0]['reg_no'] ?>
+
- Bike Name
+ Model
= $vehicle[0]['bike_company'].' '.$vehicle[0]['bike_name'] ?>
Color
= $vehicle[0]['colour'] ?>
-
- Vehicle No
- = $vehicle[0]['reg_no'] ?>
-
Contact No
= $vehicle[0]['mobile_no'] ?>
@@ -203,11 +203,33 @@ p {
Delivery Date
- 04/06/2024
+ format('Y-m-d'));die;
+
+ if ($dateTime && $dateTime->format('Y-m-d') == $deliveryDate) {
+ echo '' . $dateTime->format('d/m/Y') . ' ';
+ } else {
+ echo ' No Date Provided ';
+ }
+ } else {
+ echo 'No Date Provided ';
+ }
+ ?>
Mode of Payment
- Online
+
+
+
@@ -219,16 +241,16 @@ p {
- S no
- Description Of Goods
- Amount with Tax
- Quantity
- Per
- GST
- CGST Amount
- SGST Amount
- Total Tax
- Total
+ S no
+ Description Of Goods
+ Amount with Tax
+ Quantity
+ Per
+ GST
+ CGST Amount
+ SGST Amount
+ Total Tax
+ Total
@@ -237,11 +259,31 @@ p {
$sub_tot = 0;
$tax = 0;
$tot = 0;
+ $total_CGST = 0; $total_SGST = 0;
?>
-
+
= $serialNumber++; ?>
@@ -265,28 +307,29 @@ p {
} ?>
= $item['qty'] ?>
- = ($item['tax']) ?>%
-
-
+ = $tax ?>%
+
+
- Subtotal
+ Sub Total
= round($sub_tot) ?>
CGST
- = round($tax) / 2 ?>
+ = round($total_CGST); ?>
SGST
- = round($tax) / 2 ?>
+ = round($total_SGST); ?>
+
+
Estimate
-
+
diff --git a/app/Views/job_card_form.php b/app/Views/job_card_form.php
index 4374ca1..b4e19d8 100644
--- a/app/Views/job_card_form.php
+++ b/app/Views/job_card_form.php
@@ -26,10 +26,10 @@
-
+
+
+ >
+
+
@@ -223,8 +236,12 @@
-
-
+
+
+
+
+
+
@@ -531,8 +548,8 @@ $(document).ready(async function() {
function editlabourcost(data,cls) {
console.log(data.labour_cost,'data.labour_cost');
data.labour_cost = 0;
- total_wih_tax = Number(data.labour_cost) + (Number(data.labour_cost) * (data.tax / 100));
- total_tax_amt = Number(data.labour_cost) * (data.tax / 100);
+ total_wih_tax = Number(data.labour_cost) + (Number(data.labour_cost) * (18 / 100));
+ total_tax_amt = Number(data.labour_cost) * (18 / 100);
var newRow = ' ' +
@@ -542,7 +559,7 @@ $(document).ready(async function() {
newRow += ' ';
- newRow += ' ' +
+ newRow += ' ' +
' ' +
' ' +
' ' +
@@ -1349,13 +1366,13 @@ $(document).ready(function() {
const labourcost = async (cost,tax,tr,cls) => {
console.log(cost,tax,tr,cls);
console.log('cost,tax,tr,cls');
- total_wih_tax = Number(cost) + (Number(cost) * (tax / 100));
- total_tax_amt = Number(cost) * (tax / 100);
+ total_wih_tax = Number(cost) + (Number(cost) * (18 / 100));
+ total_tax_amt = Number(cost) * (18 / 100);
var newRow = ' ' +
' ' +
' ' +
' ' +
- ' ' +
+ ' ' +
' ' +
' ' +
' ' +
@@ -2191,6 +2208,18 @@ $closestTR.remove();
$('#create-clientMobile').val('');
$('#create-clientType').val('');
});
+
+ $('.status_class_for_change').change(function (params) {
+
+ if($(this).val() === 'Paid'){
+ $('#mode_of_payment_parent_div_id').css('display','');
+ $('#mode_of_payment').prop('required','required');
+ }else{
+ $('#mode_of_payment_parent_div_id').css('display','none');
+ $('#mode_of_payment').removeAttr('required');
+ }
+ })
+
diff --git a/app/Views/jobs_list.php b/app/Views/jobs_list.php
index 9067c64..b069840 100644
--- a/app/Views/jobs_list.php
+++ b/app/Views/jobs_list.php
@@ -66,7 +66,7 @@
$value) : if ($value['isactive'] == 1) : ?>
-
+
= $value['order_number']; ?>
= $value['reg_no']; ?>
= $value['client_name']; ?>
= $value['client_mobile_no']; ?>
@@ -84,7 +84,7 @@
@@ -126,7 +123,7 @@
$(document).ready(function() {
datatable_sales_order = $('#datatable-sales-order').DataTable({
- "order": [[1, 'asc']], // Set initial sorting to descending on the first column
+ "order": [[0, 'desc']], // Set initial sorting to descending on the first column
"dom": 'Bfrtip', // Show export buttons
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
{extend: 'print',title: 'Products',text: 'Print',},
@@ -155,15 +152,23 @@
}
// Move DataTable to the saved page and draw
datatable_sales_order.page(savedPage).draw(false);
- $('.'+hightlight_tr).css('background','#faf6ca');
- // $('.'+hightlight_tr).css('background','#d2f9fa');
+
+ // Select the highlighted row
+ var $row = $('.' + hightlight_tr);
+
+ // Smoothly scroll to the row and center it in the viewport
$('html, body').animate({
- scrollTop: $('.'+hightlight_tr).offset().top
- }, 2000);
- setTimeout(() => {
- $('.'+hightlight_tr).css('background','');
-
- }, 4000);
+ scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
+ }, 500, function() {
+
+ // After focusing, change background color
+ $row.css('background', '#faf6ca');
+
+ // Remove background color after 4 seconds
+ setTimeout(function() {
+ $row.css('background', '');
+ }, 4000);
+ });
}
sessionStorage.removeItem('currentPage');
sessionStorage.removeItem('hightlight_tr');
diff --git a/app/Views/service_list.php b/app/Views/service_list.php
index a054de6..6be8a5c 100644
--- a/app/Views/service_list.php
+++ b/app/Views/service_list.php
@@ -31,8 +31,12 @@
$value) :
- if ($value['isactive'] == 1) : ?>
-
+ if ($value) :
+ $color = '';
+ if($value['isactive'] == 0){
+ $color ='red';
+ }?>
+
= $value['service_name']; ?>
= $value['price']; ?>
= $value['cgst'] + $value['sgst']; ?>
@@ -41,9 +45,13 @@
@@ -94,14 +102,23 @@
}
// Move DataTable to the saved page and draw
datatable_service.page(savedPage).draw(false);
- $('.'+hightlight_tr).css('background','#faf6ca');
+
+ // Select the highlighted row
+ var $row = $('.' + hightlight_tr);
+
+ // Smoothly scroll to the row and center it in the viewport
$('html, body').animate({
- scrollTop: $('.'+hightlight_tr).offset().top
- }, 2000);
- setTimeout(() => {
- $('.'+hightlight_tr).css('background','');
-
- }, 4000);
+ scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
+ }, 500, function() {
+
+ // After focusing, change background color
+ $row.css('background', '#faf6ca');
+
+ // Remove background color after 4 seconds
+ setTimeout(function() {
+ $row.css('background', '');
+ }, 4000);
+ });
}
sessionStorage.removeItem('currentPage');
sessionStorage.removeItem('hightlight_tr');
@@ -117,4 +134,39 @@
sessionStorage.setItem('hightlight_tr', value);
}
+
+ function statusChange(params) {
+ var status = params.getAttribute('data-isactive');
+ var service_id = params.getAttribute('data-id');
+ if(status == 1){
+ var isactive= 0;
+ }else{
+ var isactive= 1;
+ }
+
+ var formData = {
+ service_id: service_id,
+ isactive: isactive
+ };
+ $.ajax({
+ type: 'POST',
+ url: '',
+ data: formData,
+ dataType: 'json',
+ success: function(response) {
+ console.log(response);
+
+ if (response.status == "success") {
+ window.location.reload();
+ }
+ },
+ error: function(xhr, status, error) {
+ // Handle error response here
+ console.error(xhr.responseText);
+ }
+ });
+
+
+ }
+
\ No newline at end of file
diff --git a/app/Views/user_form.php b/app/Views/user_form.php
index 6ed77ad..cef5b73 100644
--- a/app/Views/user_form.php
+++ b/app/Views/user_form.php
@@ -50,6 +50,11 @@
+
+
+
+ Personal Info
+
@@ -68,11 +73,62 @@
-
-
-
-
+
+
+
+
+
+ Change Password
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -109,12 +165,112 @@
+
+
diff --git a/app/Views/user_list.php b/app/Views/user_list.php
index 5469aff..9132c0c 100644
--- a/app/Views/user_list.php
+++ b/app/Views/user_list.php
@@ -43,8 +43,14 @@
$value) :
- if ($value['isactive'] == 1) : ?>
-
+ if ($value) :
+ $color = '';
+ if($value['isactive'] == 0){
+ $color ='red';
+ }
+ ?>
+
+
= $value['name']; ?>
= $value['email']; ?>
@@ -54,10 +60,15 @@
+
@@ -108,14 +119,23 @@
}
// Move DataTable to the saved page and draw
datatable_user.page(savedPage).draw(false);
- $('.'+hightlight_tr).css('background','#faf6ca');
+
+ // Select the highlighted row
+ var $row = $('.' + hightlight_tr);
+
+ // Smoothly scroll to the row and center it in the viewport
$('html, body').animate({
- scrollTop: $('.'+hightlight_tr).offset().top
- }, 2000);
- setTimeout(() => {
- $('.'+hightlight_tr).css('background','');
-
- }, 4000);
+ scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
+ }, 500, function() {
+
+ // After focusing, change background color
+ $row.css('background', '#faf6ca');
+
+ // Remove background color after 4 seconds
+ setTimeout(function() {
+ $row.css('background', '');
+ }, 4000);
+ });
}
sessionStorage.removeItem('currentPage');
//End DataTable Paging is session is set
@@ -132,4 +152,41 @@
}
+
+
+
+ function statusChange(params) {
+ var status = params.getAttribute('data-isactive');
+ var user_id = params.getAttribute('data-id');
+ if(status == 1){
+ var isactive= 0;
+ }else{
+ var isactive= 1;
+ }
+
+ var formData = {
+ user_id: user_id,
+ isactive: isactive
+ };
+ $.ajax({
+ type: 'POST',
+ url: '',
+ data: formData,
+ dataType: 'json',
+ success: function(response) {
+ console.log(response);
+
+ if (response.status == "success") {
+ window.location.reload();
+ }
+ },
+ error: function(xhr, status, error) {
+ // Handle error response here
+ console.error(xhr.responseText);
+ }
+ });
+
+
+ }
+
\ No newline at end of file
diff --git a/app/Views/vehicle_list.php b/app/Views/vehicle_list.php
index 252a912..c28aa5f 100644
--- a/app/Views/vehicle_list.php
+++ b/app/Views/vehicle_list.php
@@ -33,28 +33,33 @@
$value) :
- if ($value['isactive'] == 1) : ?>
-
- = $value['reg_no']; ?>
- = $value['make_name'].' '.$value['model_name']; ?>
- = $value['year_of_manufacturing']; ?>
- = $value['client_name']; ?>
- = $value['mobile_no']; ?>
-
-
-
-
-
-
-
+ $color = '';
+ if($value['isactive'] == 0){
+ $color ='red';
+ }?>
+
+ = $value['reg_no']; ?>
+ = $value['make_name'].' '.$value['model_name']; ?>
+ = $value['year_of_manufacturing']; ?>
+ = $value['client_name']; ?>
+ = $value['mobile_no']; ?>
+
+
+
+
+
+
-
@@ -101,14 +106,23 @@
}
// Move DataTable to the saved page and draw
datatable_vehicle.page(savedPage).draw(false);
- $('.'+hightlight_tr).css('background','#faf6ca');
+
+ // Select the highlighted row
+ var $row = $('.' + hightlight_tr);
+
+ // Smoothly scroll to the row and center it in the viewport
$('html, body').animate({
- scrollTop: $('.'+hightlight_tr).offset().top
- }, 2000);
- setTimeout(() => {
- $('.'+hightlight_tr).css('background','');
-
- }, 4000);
+ scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
+ }, 500, function() {
+
+ // After focusing, change background color
+ $row.css('background', '#faf6ca');
+
+ // Remove background color after 4 seconds
+ setTimeout(function() {
+ $row.css('background', '');
+ }, 4000);
+ });
}
sessionStorage.removeItem('currentPage');
sessionStorage.removeItem('hightlight_tr');
@@ -125,4 +139,38 @@
sessionStorage.setItem('hightlight_tr', value);
}
+
+ function statusChange(params) {
+ var status = params.getAttribute('data-isactive');
+ var vehicle_id = params.getAttribute('data-id');
+ if(status == 1){
+ var isactive= 0;
+ }else{
+ var isactive= 1;
+ }
+
+ var formData = {
+ vehicle_id: vehicle_id,
+ isactive: isactive
+ };
+ $.ajax({
+ type: 'POST',
+ url: '',
+ data: formData,
+ dataType: 'json',
+ success: function(response) {
+ console.log(response);
+
+ if (response.status == "success") {
+ window.location.reload();
+ }
+ },
+ error: function(xhr, status, error) {
+ // Handle error response here
+ console.error(xhr.responseText);
+ }
+ });
+
+
+ }
\ No newline at end of file
diff --git a/app/Views/vendor_list.php b/app/Views/vendor_list.php
index 6a8c997..15e53f8 100644
--- a/app/Views/vendor_list.php
+++ b/app/Views/vendor_list.php
@@ -37,20 +37,28 @@
-
- $value) :
- if ($value['isactive'] == 1) : ?>
-
- = $value['vendor_name']; ?>
+ $value) :
+ if ($value) :
+ $color = '';
+ if($value['isactive'] == 0){
+ $color ='red';
+ }
+ ?>
+
+ = $value['vendor_name']; ?>
= $value['contact_person_mobile1']; ?>
= $value['category']; ?>
@@ -101,14 +109,23 @@
}
// Move DataTable to the saved page and draw
datatable_vendor.page(savedPage).draw(false);
- $('.'+hightlight_tr).css('background','#faf6ca');
+
+ // Select the highlighted row
+ var $row = $('.' + hightlight_tr);
+
+ // Smoothly scroll to the row and center it in the viewport
$('html, body').animate({
- scrollTop: $('.'+hightlight_tr).offset().top
- }, 2000);
- setTimeout(() => {
- $('.'+hightlight_tr).css('background','');
-
- }, 4000);
+ scrollTop: $row.offset().top - ($(window).height() / 2) + ($row.height() / 2)
+ }, 500, function() {
+
+ // After focusing, change background color
+ $row.css('background', '#faf6ca');
+
+ // Remove background color after 4 seconds
+ setTimeout(function() {
+ $row.css('background', '');
+ }, 4000);
+ });
}
sessionStorage.removeItem('currentPage');
//End DataTable Paging is session is set
@@ -124,4 +141,42 @@
sessionStorage.setItem('hightlight_tr', value);
}
+
+
+ function statusChange(params) {
+ var status = params.getAttribute('data-isactive');
+ var vendor_id = params.getAttribute('data-id');
+ if(status == 1){
+ var isactive= 0;
+ }else{
+ var isactive= 1;
+ }
+
+ var formData = {
+ vendor_id: vendor_id,
+ isactive: isactive
+ };
+ $.ajax({
+ type: 'POST',
+ url: '',
+ data: formData,
+ dataType: 'json',
+ success: function(response) {
+ console.log(response);
+
+ if (response.status == "success") {
+ window.location.reload();
+ }
+ },
+ error: function(xhr, status, error) {
+ // Handle error response here
+ console.error(xhr.responseText);
+ }
+ });
+
+
+ }
+
+
+
\ No newline at end of file