FILES_MERGE_CONFLICT : AADHAVAN

This commit is contained in:
aadhavan valli 2024-04-23 15:20:03 +05:30
commit 4f96026771
36 changed files with 1227 additions and 763 deletions

49
.htaccess Normal file
View File

@ -0,0 +1,49 @@
# Disable directory browsing
Options -Indexes
# ----------------------------------------------------------------------
# Rewrite engine
# ----------------------------------------------------------------------
# Turning on the rewrite engine is necessary for the following rules and features.
# FollowSymLinks must be enabled for this to work.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
# If you installed CodeIgniter in a subfolder, you will need to
# change the following line to match the subfolder you need.
# http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
# RewriteBase /
# Redirect Trailing Slashes...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Rewrite "www.example.com -> example.com"
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to the front controller, index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]
# Ensure Authorization header is passed along
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
ErrorDocument 404 index.php
</IfModule>
# Disable server signature start
ServerSignature Off
# Disable server signature end

View File

@ -16,7 +16,7 @@ class App extends BaseConfig
* *
* E.g., http://example.com/ * E.g., http://example.com/
*/ */
public string $baseURL = 'http://localhost/the_mechanic/public'; public string $baseURL = 'http://localhost/the_mechanic/';
/** /**
* Allowed Hostnames in the Site URL other than the hostname in the baseURL. * Allowed Hostnames in the Site URL other than the hostname in the baseURL.
@ -57,7 +57,8 @@ class App extends BaseConfig
* *
* WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded! * WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/ */
public string $uriProtocol = 'REQUEST_URI'; // public string $uriProtocol = 'REQUEST_URI';
public string $uriProtocol = 'PATH_INFO';
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------

View File

@ -154,6 +154,8 @@ $routes->get("delete_purchase/(:any)", "Purchase::delete_purchase/$1");
$routes->post("getVendorProducts", "Purchase::getVendorProducts"); $routes->post("getVendorProducts", "Purchase::getVendorProducts");
$routes->post("delete_purchase_product", "Purchase::delete_purchase_product"); $routes->post("delete_purchase_product", "Purchase::delete_purchase_product");
$routes->get("download_purchase_invoice/(:any)", "Purchase::download_purchase_invoice/$1"); $routes->get("download_purchase_invoice/(:any)", "Purchase::download_purchase_invoice/$1");
$routes->get("reorder_purchase/(:any)", "Purchase::reorder_purchase/$1");
// Reorder Level// // Reorder Level//
$routes->get('reorder_level_index', 'Reorderlevel::reorder_level_index'); $routes->get('reorder_level_index', 'Reorderlevel::reorder_level_index');
$routes->get('rise_order/(:any)', 'Reorderlevel::rise_order/$1'); $routes->get('rise_order/(:any)', 'Reorderlevel::rise_order/$1');

View File

@ -11,16 +11,16 @@ class Client extends BaseController
{ {
public $session; public $session;
protected $UsersModel;
public function __construct() public function __construct()
{ {
$this->session = session(); // Initialize session
$this->session = session();
$this->UsersModel = new UsersModel(); $this->UsersModel = new UsersModel();
} }
public function client_index() public function client_index()
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$ClientModel = new ClientModel(); $ClientModel = new ClientModel();
$client = $ClientModel->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll(); $client = $ClientModel->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
$data['client']=$client; $data['client']=$client;
@ -32,7 +32,7 @@ class Client extends BaseController
public function new_client($client_id) public function new_client($client_id)
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
if ($client_id === '0') { if ($client_id === '0') {
$data['client'] = []; $data['client'] = [];
@ -53,7 +53,7 @@ class Client extends BaseController
public function add_client() public function add_client()
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$ClientModel = new ClientModel(); $ClientModel = new ClientModel();
@ -86,8 +86,10 @@ class Client extends BaseController
return redirect()->to('client_index'); return redirect()->to('client_index');
} }
public function delete_client($client_id) public function delete_client($client_id)
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$model = new ClientModel(); $model = new ClientModel();
$where = ['client_id' => $client_id, 'isactive' => 1 , 'branch_id' => $this->session->get('logged_user_branch_id')]; // Assuming 'isactive' is a column in your database $where = ['client_id' => $client_id, 'isactive' => 1 , 'branch_id' => $this->session->get('logged_user_branch_id')]; // Assuming 'isactive' is a column in your database
$existingBusiness = $model->where($where)->first(); $existingBusiness = $model->where($where)->first();
@ -106,6 +108,7 @@ class Client extends BaseController
} }
public function client_quick_create(){ public function client_quick_create(){
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
// Load ClientModel // Load ClientModel
$ClientModel = new ClientModel(); $ClientModel = new ClientModel();

View File

@ -11,7 +11,7 @@ class Manufacturer extends BaseController
public $session; public $session;
use ResponseTrait; use ResponseTrait;
protected $ManufacturerModel;
public function __construct() public function __construct()
{ {
@ -21,6 +21,7 @@ class Manufacturer extends BaseController
public function index() public function index()
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$ManufacturerModel = new ManufacturerModel(); $ManufacturerModel = new ManufacturerModel();
$spare_manufacturer = $ManufacturerModel->findAll(); $spare_manufacturer = $ManufacturerModel->findAll();
@ -33,6 +34,7 @@ class Manufacturer extends BaseController
public function create_manufacturer() public function create_manufacturer()
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
try { try {
$manufacturer_name = $this->request->getPost('manufacturername'); $manufacturer_name = $this->request->getPost('manufacturername');
$quality = $this->request->getPost('quality'); $quality = $this->request->getPost('quality');

View File

@ -22,7 +22,7 @@ class Products extends BaseController
public function product_index($manufacturer_id = null) public function product_index($manufacturer_id = null)
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
if ($manufacturer_id) { if ($manufacturer_id) {
$ProductModel = new ProductModel(); $ProductModel = new ProductModel();
$ManufacturerModel = new ManufacturerModel(); $ManufacturerModel = new ManufacturerModel();
@ -54,7 +54,7 @@ class Products extends BaseController
public function new_product($product_id) public function new_product($product_id)
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
if ($product_id === '0') { if ($product_id === '0') {
$data['products'] = []; $data['products'] = [];
@ -113,7 +113,7 @@ class Products extends BaseController
public function add_product() public function add_product()
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$ProductModel = new ProductModel(); $ProductModel = new ProductModel();
$tax= $this->request->getPost('tax')/2; $tax= $this->request->getPost('tax')/2;
@ -140,11 +140,13 @@ class Products extends BaseController
'rack_number' => $this->request->getPost('rack_number'), 'rack_number' => $this->request->getPost('rack_number'),
'manufacturer_id' => $this->request->getPost('manufacturer'), 'manufacturer_id' => $this->request->getPost('manufacturer'),
'prefered_vendor' => $this->request->getPost('prefered_vendor'), 'prefered_vendor' => $this->request->getPost('prefered_vendor'),
'specification' => $this->request->getPost('specification'),
'hsn_sac' => $this->request->getPost('hsn_sac'),
'isactive' => 1 , 'isactive' => 1 ,
'branch_id' => $this->session->get('logged_user_branch_id') 'branch_id' => $this->session->get('logged_user_branch_id')
]; ];
// print_r($data);die;
$product_id = $this->request->getPost('product_id'); $product_id = $this->request->getPost('product_id');
@ -158,7 +160,7 @@ class Products extends BaseController
} }
$orderNumber = 'TM' . str_pad($product_id, 8, '0', STR_PAD_LEFT); $orderNumber = 'TM' . str_pad($product_id, 8, '0', STR_PAD_LEFT);
// print_r($orderNumber);die;
// Update sales order with generated order number // Update sales order with generated order number
$ProductModel->update($product_id, ['sku_id' => $orderNumber]); $ProductModel->update($product_id, ['sku_id' => $orderNumber]);
return redirect()->to('product_index'); return redirect()->to('product_index');
@ -166,6 +168,7 @@ class Products extends BaseController
public function delete_product($product_id) public function delete_product($product_id)
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$model = new ProductModel(); $model = new ProductModel();
$where = ['product_id' => $product_id, 'isactive' => 1 , 'branch_id' => $this->session->get('logged_user_branch_id')]; // Assuming 'isactive' is a column in your database $where = ['product_id' => $product_id, 'isactive' => 1 , 'branch_id' => $this->session->get('logged_user_branch_id')]; // Assuming 'isactive' is a column in your database
$existingProduct = $model->where($where)->first(); $existingProduct = $model->where($where)->first();

View File

@ -21,6 +21,7 @@ class Purchase extends BaseController
public function purchase_index() public function purchase_index()
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$PurchaseOrderModel = new PurchaseOrderModel(); $PurchaseOrderModel = new PurchaseOrderModel();
// $purchase = $PurchaseOrderModel->where('purchase_order.branch_id', $this->session->get('logged_user_business_id')) // $purchase = $PurchaseOrderModel->where('purchase_order.branch_id', $this->session->get('logged_user_business_id'))
@ -31,6 +32,8 @@ class Purchase extends BaseController
$purchase = $PurchaseOrderModel->getPurchaseOrdersWithProducts($this->session->get('logged_user_branch_id')); $purchase = $PurchaseOrderModel->getPurchaseOrdersWithProducts($this->session->get('logged_user_branch_id'));
// echo "<pre>"; // echo "<pre>";
// print_r($product);die; // print_r($product);die;
// echo json_encode($purchase);die;
$data['purchase']=$purchase; $data['purchase']=$purchase;
// echo "<pre>"; // echo "<pre>";
@ -40,6 +43,7 @@ class Purchase extends BaseController
public function new_purchase($purchase_order_id) public function new_purchase($purchase_order_id)
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
if ($purchase_order_id === '0') { if ($purchase_order_id === '0') {
$data['purchase'] = []; $data['purchase'] = [];
@ -107,8 +111,92 @@ class Purchase extends BaseController
echo view('purchase_form',$data); echo view('purchase_form',$data);
} }
public function reorder_purchase($purchase_order_id)
{
// $data['page_name']="Edit Purchase Order";
// $PurchaseOrderModel = new PurchaseOrderModel();
// $purchase=$PurchaseOrderModel->where('purchase_order_id', $purchase_order_id)->get()->getRowArray();
// $VendorModel = new VendorModel();
// $vendor = $VendorModel->where('branch_id',$this->session->get('logged_user_business_id'))->select('vendor_id,vendor_name')->findAll();
// $data['vendor']=$vendor;
// $data['purchase'] = $purchase;
// $VendorModel = new VendorModel();
// $vendor = $VendorModel->findAll();
// $data['vendor'] = $vendor;
// $data['vendor_id'] = $purchase['vendor_id'];
// // print_r($vendor);die;
// $vendorId=$purchase['vendor_id'];
// $encodedVendorId = json_encode([$vendorId]);
// $productModel = new ProductModel();
// // Query the database to find the product based on make_id and model_id
// $product = $productModel->where('JSON_CONTAINS(vendor, \'' . $encodedVendorId . '\')', null, false)
// ->findAll();
// $data['product']=$product;
// // print_r($product);die;
$data['purchase'] = [];
$PurchaseOrderModel = new PurchaseOrderModel();
$purchase=$PurchaseOrderModel->where('purchase_order_id', $purchase_order_id)->get()->getRowArray();
$VendorModel = new VendorModel();
$vendor = $VendorModel->where('branch_id',$this->session->get('logged_user_business_id'))->select('vendor_id,vendor_name')->findAll();
$data['vendor']=$vendor;
unset($purchase['purchase_order_id']);
$data['purchase'] = $purchase;
$VendorModel = new VendorModel();
$vendor = $VendorModel->findAll();
$data['vendor'] = $vendor;
// $data['vendor_id'] = $purchase['vendor_id'];
$BranchModel = new BranchModel();
$BusinessModel = new BusinessModel();
$branch = $BranchModel->where('branch_id', $this->session->get('logged_user_branch_id'))->get()->getRowArray();
$business = $BusinessModel->where('business_id', $this->session->get('logged_user_business_id'))->get()->getRowArray();
$ProductModel = new ProductModel();
$product=$ProductModel
->where('isactive',1)
->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
$data['product']=$product;
$data['branch'] = $branch;
$data['business'] = $business;
$data['reorder'] = true;
$data['page_name']="Add Purchase Order";
$data['vendor']=$vendor;
$data['vendor_id'] = [];
$PurchaseOrderChildModel = new PurchaseOrderChildModel();
$purchase_product = $PurchaseOrderChildModel
->select('product_id, qty, received_qty, isactive, is_selected')
->where('purchase_order_id', $purchase_order_id)
->where('(is_selected = 0 OR (qty > received_qty AND received_qty != 0) )')
->findAll();
$data['purchase_product'] = $purchase_product;
// echo json_encode($purchase_product);die;
echo view('purchase_form',$data);
}
public function add_purchase() public function add_purchase()
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$PurchaseOrderModel = new PurchaseOrderModel(); $PurchaseOrderModel = new PurchaseOrderModel();
$ProductModel = new ProductModel(); $ProductModel = new ProductModel();
$PurchaseOrderChildModel = new PurchaseOrderChildModel(); $PurchaseOrderChildModel = new PurchaseOrderChildModel();
@ -132,10 +220,7 @@ class Purchase extends BaseController
'branch_id'=> $this->session->get('logged_user_branch_id'), 'branch_id'=> $this->session->get('logged_user_branch_id'),
]; ];
// echo '<pre>';
// print_r($this->request->getPost());
// echo '</pre>';
//die;
$purchase_order_id = $this->request->getPost('purchase_order_id'); $purchase_order_id = $this->request->getPost('purchase_order_id');
// echo $purchase_order_id;die; // echo $purchase_order_id;die;
if (!empty($purchase_order_id)) { if (!empty($purchase_order_id)) {
@ -184,7 +269,8 @@ class Purchase extends BaseController
$child_data = [ $child_data = [
'purchase_order_id' => $purchase_order_id, 'purchase_order_id' => $purchase_order_id,
'product_id' => $product_id, 'product_id' => $product_id,
'qty' => $qty, // 'qty' => $qty,
// 'received_qty' => $qty,
// 'discount' => $discount, // 'discount' => $discount,
// 'discount_type' => $discount_type, // 'discount_type' => $discount_type,
'net_price'=>$rate, 'net_price'=>$rate,
@ -193,6 +279,14 @@ class Purchase extends BaseController
'is_selected'=>$selected_item, 'is_selected'=>$selected_item,
'isactive'=>1, 'isactive'=>1,
]; ];
if($status == 'Received') {
$child_data['received_qty'] = $qty;
}
else{
$child_data['qty'] = $qty;
}
// print_r($child_data);die; // print_r($child_data);die;
if (!empty($purchase_order_child_id[$key])) { if (!empty($purchase_order_child_id[$key])) {
@ -211,9 +305,11 @@ class Purchase extends BaseController
return redirect()->to('purchase_index'); return redirect()->to('purchase_index');
} }
private function addBackProductQuantity($ProductModel, $product_id, $sold_qty) private function addBackProductQuantity($ProductModel, $product_id, $sold_qty)
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
// Fetch current product quantity // Fetch current product quantity
$product = $ProductModel->find($product_id); $product = $ProductModel->find($product_id);
$current_qty = $product['qty_stock']; $current_qty = $product['qty_stock'];
@ -227,6 +323,7 @@ class Purchase extends BaseController
public function delete_purchase($purchase_order_id) public function delete_purchase($purchase_order_id)
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$PurchaseOrderModel = new PurchaseOrderModel(); $PurchaseOrderModel = new PurchaseOrderModel();
$where = ['purchase_order_id' => $purchase_order_id, 'isactive' => 1 ]; // Assuming 'isactive' is a column in your database $where = ['purchase_order_id' => $purchase_order_id, 'isactive' => 1 ]; // Assuming 'isactive' is a column in your database
$existingPurchase = $PurchaseOrderModel->where($where)->first(); $existingPurchase = $PurchaseOrderModel->where($where)->first();
@ -258,6 +355,7 @@ class Purchase extends BaseController
return json_encode($products); return json_encode($products);
} }
public function getVendorProducts() public function getVendorProducts()
{ {
// Retrieve make_id and model_id from the request // Retrieve make_id and model_id from the request
@ -372,4 +470,5 @@ public function download_purchase_invoice($purchase_order_id)
// Output the PDF to the browser for download // Output the PDF to the browser for download
$mpdf->Output('invoice_' . date('Y-m-d H-i-s') . '.pdf', 'D'); $mpdf->Output('invoice_' . date('Y-m-d H-i-s') . '.pdf', 'D');
} }
} }

View File

@ -22,25 +22,56 @@ class Reorderlevel extends BaseController
public function reorder_level_index() public function reorder_level_index()
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$productModel = new ProductModel(); $productModel = new ProductModel();
$reorder = $productModel->where('qty_stock <= purchase_order_level')->findAll(); $reorder = $productModel->select('products.*, vendor.vendor_name as prefered_vendor_name, COUNT(vendor.vendor_name) as product_count')
->join('vendor', 'vendor.vendor_id = products.prefered_vendor')
// print_r($reorder);die; ->where('products.qty_stock <= purchase_order_level')
->groupBy('products.prefered_vendor')
->findAll();
// echo json_encode($reorder);die;
$data['reorder']=$reorder; $data['reorder']=$reorder;
// echo "<pre>";
// print_r($data);die;
return view('reorder_level_list',$data); return view('reorder_level_list',$data);
} }
public function rise_order($product_id)
// public function rise_order($product_id)
// {
// if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
// $data['page_name']="Rise Order";
// $ProductModel = new ProductModel();
// $products=$ProductModel->where('product_id', $product_id)->get()->getRowArray();
// $data['products']=$products;
// // echo "<pre>";
// // print_r($products);die;
// $vendorid= $products['prefered_vendor'];
// $VendorModel = new VendorModel();
// $vendor=$VendorModel->where('vendor_id',$vendorid)->findAll();
// $data['vendor']=$vendor;
// $PurchaseOrderModel = new PurchaseOrderModel();
// $purchase=$PurchaseOrderModel->where('vendor_id',$vendorid)->first();
// $data['purchase']=$purchase;
// return view('reorder_level_form',$data);
// }
public function rise_order($prefered_vendor)
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$data['page_name']="Rise Order"; $data['page_name']="Rise Order";
$ProductModel = new ProductModel(); $ProductModel = new ProductModel();
$products=$ProductModel->where('product_id', $product_id)->get()->getRowArray(); $products=$ProductModel->where('prefered_vendor', $prefered_vendor)->where('qty_stock <= purchase_order_level')->findAll();
// echo json_encode($products);die;
$data['products']=$products; $data['products']=$products;
// echo "<pre>"; // echo "<pre>";
// print_r($products);die; // print_r($products);die;
$vendorid= $products['prefered_vendor']; $vendorid= $prefered_vendor;
$product_data = $ProductModel->where('prefered_vendor', $vendorid)->findAll();
// echo json_encode($product_data);die;
$data['product_data'] = $product_data;
$VendorModel = new VendorModel(); $VendorModel = new VendorModel();
$vendor=$VendorModel->where('vendor_id',$vendorid)->findAll(); $vendor=$VendorModel->where('vendor_id',$vendorid)->findAll();
$data['vendor']=$vendor; $data['vendor']=$vendor;

View File

@ -16,6 +16,7 @@ use App\Models\PurchaseOrderModel;
class ReturnOrder extends BaseController class ReturnOrder extends BaseController
{ {
public $session; public $session;
protected $returnModel;
public function __construct() public function __construct()
{ {
$this->session = session(); $this->session = session();
@ -24,24 +25,24 @@ class ReturnOrder extends BaseController
public function return_order_index() public function return_order_index()
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$PurchaseOrderModel = new PurchaseOrderModel(); $PurchaseOrderModel = new PurchaseOrderModel();
$purchase = $PurchaseOrderModel->getPurchaseOrdersWithProducts($this->session->get('logged_user_branch_id')); $purchase = $PurchaseOrderModel->getPurchaseOrdersWithProducts($this->session->get('logged_user_branch_id'));
// echo "<pre>";
// print_r($product);die;
$data['purchase']=$purchase; $data['purchase']=$purchase;
$return = $this->returnModel->findAll(); $return = $this->returnModel->findAll();
$data['return']=$return; $data['return']=$return;
// echo "<pre>";
// print_r($data);die;
return view('return_order_liist',$data); return view('return_order_liist',$data);
} }
public function return_order() public function return_order()
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$ReturnModel = new ReturnModel(); $ReturnModel = new ReturnModel();
$return_orders = $ReturnModel->select('return_order.*, vendor.vendor_name as vendor_name, COUNT(return_order_child.return_order_id) AS return_count') $return_orders = $ReturnModel->select('return_order.*, vendor.vendor_name as vendor_name, COUNT(return_order_child.return_order_id) AS return_count')
@ -61,6 +62,7 @@ class ReturnOrder extends BaseController
} }
public function new_return($purchase_order_id) public function new_return($purchase_order_id)
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$data['page_name']="Create Return Order"; $data['page_name']="Create Return Order";
@ -89,7 +91,7 @@ class ReturnOrder extends BaseController
$PurchaseOrderChildModel = new PurchaseOrderChildModel(); $PurchaseOrderChildModel = new PurchaseOrderChildModel();
$purchase_product=$PurchaseOrderChildModel->where('purchase_order_id', $purchase_order_id)->findAll(); $purchase_product=$PurchaseOrderChildModel->where('purchase_order_id', $purchase_order_id)->where('received_qty >', 0)->where('is_selected', 1)->findAll();
$data['purchase_product'] = $purchase_product; $data['purchase_product'] = $purchase_product;
@ -98,6 +100,7 @@ class ReturnOrder extends BaseController
public function add_return_purchase() public function add_return_purchase()
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$ProductModel = new ProductModel(); $ProductModel = new ProductModel();
@ -129,6 +132,7 @@ class ReturnOrder extends BaseController
$ReturnModel = new ReturnModel(); $ReturnModel = new ReturnModel();
$ReturnOrderChildModel = new ReturnOrderChildModel(); $ReturnOrderChildModel = new ReturnOrderChildModel();
$PurchaseOrderChildModel = new PurchaseOrderChildModel();
$return = $ReturnModel->where('return_order_id', $return_order_id)->first(); $return = $ReturnModel->where('return_order_id', $return_order_id)->first();
@ -140,6 +144,14 @@ class ReturnOrder extends BaseController
$quantity =$this->request->getPost('quantity'); $quantity =$this->request->getPost('quantity');
$item_details =$this->request->getPost('item_details'); $item_details =$this->request->getPost('item_details');
foreach ($item_details as $index => $item_detail) { foreach ($item_details as $index => $item_detail) {
// reduce qty in purchaase child
$purchase_id = $this->request->getPost('purchase_order_id');
$purchase_order_data = $PurchaseOrderChildModel->where('purchase_order_id', $purchase_id)->where('product_id', $item_detail)->first();
$received_qty = $purchase_order_data['received_qty'] - $quantity[$index];
$PurchaseOrderChildModel->update($purchase_order_data['purchase_order_child_id'], [ 'received_qty' => $received_qty ]);
$product = $ProductModel->where('product_id',$item_detail)->first(); $product = $ProductModel->where('product_id',$item_detail)->first();
$changed_quantity = $product['qty_stock'] - $quantity[$index]; $changed_quantity = $product['qty_stock'] - $quantity[$index];
$product_id = $item_detail; $product_id = $item_detail;
@ -154,7 +166,7 @@ class ReturnOrder extends BaseController
$return_order_id = $this->request->getPost('return_order_id'); $return_order_id = $this->request->getPost('return_order_id');
// echo $this->request->getPost('return_order_id');die;
if (!empty($return_order_id)) { if (!empty($return_order_id)) {
$this->returnModel->update($return_order_id, $data); $this->returnModel->update($return_order_id, $data);
@ -294,7 +306,7 @@ class ReturnOrder extends BaseController
return $this->response->setJSON(['product'=>$product] ); return $this->response->setJSON(['product'=>$product] );
} else { } else {
// If product is not found, return an empty response or appropriate message // If product is not found, return an empty response or appropriate message
return $this->response->setJSON(['product'=>[] , 'modelName'=>$modelName ,'makeName'=>$makeName]); return $this->response->setJSON(['product'=>[] ]);
} }
} }
public function delete_purchase_product() public function delete_purchase_product()

View File

@ -13,6 +13,8 @@ use Mpdf\Mpdf;
class Sales extends BaseController class Sales extends BaseController
{ {
public $session; public $session;
protected $BikemodelsModel;
protected $BikemakeModel;
public function __construct() public function __construct()
{ {
@ -24,11 +26,11 @@ class Sales extends BaseController
public function sales_order_index() public function sales_order_index()
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$SalesOrderModel = new SalesOrderModel(); $SalesOrderModel = new SalesOrderModel();
$sales=$SalesOrderModel->getSalesOrdersWithProducts($this->session->get('logged_user_branch_id')); $sales=$SalesOrderModel->getSalesOrdersWithProducts($this->session->get('logged_user_branch_id'));
$data['sales']=$sales; $data['sales']=$sales;
// print_r($sales);die;
return view('sales_list',$data); return view('sales_list',$data);
} }
@ -36,7 +38,7 @@ class Sales extends BaseController
public function new_sale($sales_order_id) public function new_sale($sales_order_id)
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
if ($sales_order_id === '0') { if ($sales_order_id === '0') {
$data['page_name']="Create Sales Order"; $data['page_name']="Create Sales Order";
$data['sales'] = []; $data['sales'] = [];
@ -48,7 +50,7 @@ class Sales extends BaseController
$vehicle = $VehicleModel->getCustomerandVehicle($this->session->get('logged_user_branch_id')); $vehicle = $VehicleModel->getCustomerandVehicle($this->session->get('logged_user_branch_id'));
// ->where('isactive',1) // ->where('isactive',1)
// ->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll(); // ->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
// print_r($vehicle);die;
$ProductModel = new ProductModel(); $ProductModel = new ProductModel();
$product=$ProductModel $product=$ProductModel
->where('isactive',1) ->where('isactive',1)
@ -92,7 +94,7 @@ $SalesProductOrderModel = new SalesOrderProductModel();
$sales_product=$SalesProductOrderModel->where('sales_order_id', $sales_order_id)->findAll(); $sales_product=$SalesProductOrderModel->where('sales_order_id', $sales_order_id)->findAll();
$data['sales_product']=$sales_product; $data['sales_product']=$sales_product;
$data['client']=$client; $data['client']=$client;
// print_r($sales_product);die;
$VehicleModel = new VehicleModel(); $VehicleModel = new VehicleModel();
$vehicle=$VehicleModel $vehicle=$VehicleModel
->where('isactive',1) ->where('isactive',1)
@ -101,7 +103,7 @@ $VehicleModel = new VehicleModel();
} }
// print_r($data);die;
$data['sales_order_id'] = $sales_order_id; $data['sales_order_id'] = $sales_order_id;
$bikeMakeModel = new BikeMakeModel(); $bikeMakeModel = new BikeMakeModel();
$data['makeData'] =$bikeMakeModel->findAll(); $data['makeData'] =$bikeMakeModel->findAll();
@ -111,6 +113,7 @@ $VehicleModel = new VehicleModel();
public function add_sales() public function add_sales()
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$SalesOrderModel = new SalesOrderModel(); $SalesOrderModel = new SalesOrderModel();
$ProductModel = new ProductModel(); $ProductModel = new ProductModel();
$SalesOrderProductModel = new SalesOrderProductModel(); // Assuming you have a model for sales_order_product $SalesOrderProductModel = new SalesOrderProductModel(); // Assuming you have a model for sales_order_product
@ -134,7 +137,7 @@ $VehicleModel = new VehicleModel();
'isactive' => 1, // Assuming this is a default value or handled separately 'isactive' => 1, // Assuming this is a default value or handled separately
'branch_id'=> $this->session->get('logged_user_branch_id'), 'branch_id'=> $this->session->get('logged_user_branch_id'),
]; ];
// print_r($data);die;
// Insert or update sales order // Insert or update sales order
$sales_order_id = $this->request->getPost('sales_order_id'); $sales_order_id = $this->request->getPost('sales_order_id');
if (!empty($sales_order_id)) { if (!empty($sales_order_id)) {
@ -145,10 +148,10 @@ $VehicleModel = new VehicleModel();
$sales_order_id = $SalesOrderModel->getInsertID(); // Get the last inserted ID $sales_order_id = $SalesOrderModel->getInsertID(); // Get the last inserted ID
} }
$orderNumber = 'SO' . str_pad($sales_order_id, 8, '0', STR_PAD_LEFT); $orderNumber = 'SO' . str_pad($sales_order_id, 8, '0', STR_PAD_LEFT);
// print_r($orderNumber);die;
// Update sales order with generated order number // Update sales order with generated order number
$SalesOrderModel->update($sales_order_id, ['order_number' => $orderNumber]); $SalesOrderModel->update($sales_order_id, ['order_number' => $orderNumber]);
// print_r();die;
// Prepare data for sales order product // Prepare data for sales order product
$product_ids = $this->request->getPost('item_details'); $product_ids = $this->request->getPost('item_details');
$quantities = $this->request->getPost('quantity'); $quantities = $this->request->getPost('quantity');
@ -158,9 +161,9 @@ $VehicleModel = new VehicleModel();
$itemtax=$this->request->getPost('item-tax'); $itemtax=$this->request->getPost('item-tax');
$unitprice=$this->request->getPost('unit-price'); $unitprice=$this->request->getPost('unit-price');
$sales_product_id = $this->request->getPost('sales_order_product_id'); $sales_product_id = $this->request->getPost('sales_order_product_id');
// print_r($product_ids);die;
// print_r($status);die;
$status = $this->request->getPost('status'); $status = $this->request->getPost('status');
foreach ($product_ids as $key => $product_id) { foreach ($product_ids as $key => $product_id) {
$qty = isset($quantities[$key]) ? $quantities[$key] : 0; $qty = isset($quantities[$key]) ? $quantities[$key] : 0;
@ -212,6 +215,7 @@ $status = $this->request->getPost('status');
private function addBackProductQuantity($ProductModel, $product_id, $sold_qty) private function addBackProductQuantity($ProductModel, $product_id, $sold_qty)
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
// Fetch current product quantity // Fetch current product quantity
$product = $ProductModel->find($product_id); $product = $ProductModel->find($product_id);
$current_qty = $product['qty_stock']; $current_qty = $product['qty_stock'];
@ -224,6 +228,7 @@ private function addBackProductQuantity($ProductModel, $product_id, $sold_qty)
} }
private function updateProductQuantity($ProductModel, $product_id, $sold_qty) private function updateProductQuantity($ProductModel, $product_id, $sold_qty)
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
// Fetch current product quantity // Fetch current product quantity
$product = $ProductModel->find($product_id); $product = $ProductModel->find($product_id);
$current_qty = $product['qty_stock']; $current_qty = $product['qty_stock'];
@ -237,6 +242,7 @@ private function updateProductQuantity($ProductModel, $product_id, $sold_qty)
public function delete_sales_product() 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'); $sales_order_product_id = $this->request->getPost('sales_order_product_id');
if (!empty($sales_order_product_id)) { if (!empty($sales_order_product_id)) {
@ -256,6 +262,7 @@ public function delete_sales_product()
public function delete_sale($sales_order_id) public function delete_sale($sales_order_id)
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$model = new SalesOrderModel(); $model = new SalesOrderModel();
$where = ['sales_order_id' => $sales_order_id, 'isactive' => 1]; // Assuming 'isactive' is a column in your database $where = ['sales_order_id' => $sales_order_id, 'isactive' => 1]; // Assuming 'isactive' is a column in your database
$existingProduct = $model->where($where)->first(); $existingProduct = $model->where($where)->first();
@ -272,9 +279,11 @@ public function delete_sales_product()
return redirect()->to('sales_order_index'); return redirect()->to('sales_order_index');
} }
public function download_invoice($sales_order_id) public function download_invoice($sales_order_id)
{ {
// echo "hello"; die; if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
// Fetch the invoice data based on $invoice_id // Fetch the invoice data based on $invoice_id
$model = new SalesOrderModel(); $model = new SalesOrderModel();
$data = $model->getSalesPdf($sales_order_id); $data = $model->getSalesPdf($sales_order_id);
@ -283,11 +292,6 @@ public function delete_sales_product()
// print_r($items);die();
// print_r($invoiceItems);die();
// Create an mPDF object
$mpdf = new Mpdf([ $mpdf = new Mpdf([
'mode' => '', 'mode' => '',
'format' => 'A5', 'format' => 'A5',
@ -332,7 +336,7 @@ public function delete_sales_product()
// Generate the PDF content (HTML) with data // Generate the PDF content (HTML) with data
$html = view('invoice_pdf_template', ['sales' => $data,'items'=>$items]); $html = view('invoice_pdf_template', ['sales' => $data,'items'=>$items]);
// echo $html;die;
// Load HTML into the mPDF instance // Load HTML into the mPDF instance
$mpdf->WriteHTML($html); $mpdf->WriteHTML($html);
@ -342,6 +346,7 @@ public function delete_sales_product()
public function save_vehicle(){ public function save_vehicle(){
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
// Load ClientModel // Load ClientModel
$VehicleModel = new VehicleModel(); $VehicleModel = new VehicleModel();
@ -415,6 +420,7 @@ public function get_vehicle_products(){
public function getProducts() public function getProducts()
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
// Retrieve make_id and model_id from the request // Retrieve make_id and model_id from the request
$makeId = $this->request->getPost('make_id'); $makeId = $this->request->getPost('make_id');
$modelId = $this->request->getPost('model_id'); $modelId = $this->request->getPost('model_id');
@ -428,6 +434,7 @@ public function getProducts()
// Query the database to find the product based on make_id and model_id // Query the database to find the product based on make_id and model_id
$product = $productModel->where('make_id', $makeId) $product = $productModel->where('make_id', $makeId)
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false) ->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
->where('qty_stock >',0)
->findAll(); ->findAll();
$modelName = $this->BikemodelsModel->where('model_id',$modelId)->get()->getRow()->model_name; $modelName = $this->BikemodelsModel->where('model_id',$modelId)->get()->getRow()->model_name;

View File

@ -13,6 +13,8 @@ class Vehicle extends BaseController
public $session; public $session;
protected $bikeMakeModel;
protected $bikeModelsModel;
public function __construct() public function __construct()
{ {
$this->session = session(); $this->session = session();
@ -22,7 +24,7 @@ class Vehicle extends BaseController
public function vehicle_index() public function vehicle_index()
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$VehicleModel = new VehicleModel(); $VehicleModel = new VehicleModel();
$vehicle = $VehicleModel->getCustomerandVehicle($this->session->get('logged_user_branch_id')); $vehicle = $VehicleModel->getCustomerandVehicle($this->session->get('logged_user_branch_id'));
$data['vehicle'] = $vehicle; $data['vehicle'] = $vehicle;
@ -38,7 +40,7 @@ class Vehicle extends BaseController
public function new_vehicle($vehicle_id) public function new_vehicle($vehicle_id)
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
if ($vehicle_id === '0') { if ($vehicle_id === '0') {
$ClientModel = new ClientModel(); $ClientModel = new ClientModel();
$data['vehicle'] = []; $data['vehicle'] = [];
@ -69,7 +71,7 @@ class Vehicle extends BaseController
public function add_vehicle() public function add_vehicle()
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$VehicleModel = new VehicleModel(); $VehicleModel = new VehicleModel();
@ -90,7 +92,7 @@ class Vehicle extends BaseController
'specific' => $this->request->getPost('specific'), 'specific' => $this->request->getPost('specific'),
'isactive' => 1 // Assuming this is a default value or handled separately 'isactive' => 1 // Assuming this is a default value or handled separately
]; ];
// print_r($data);die;
$vehicle_id = $this->request->getPost('vehicle_id'); $vehicle_id = $this->request->getPost('vehicle_id');
@ -106,8 +108,10 @@ class Vehicle extends BaseController
return redirect()->to('vehicle_index'); return redirect()->to('vehicle_index');
} }
public function delete_vehicle($vehicle_id) public function delete_vehicle($vehicle_id)
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$model = new VehicleModel(); $model = new VehicleModel();
$where = ['vehicle_id' => $vehicle_id, 'isactive' => 1]; // Assuming 'isactive' is a column in your database $where = ['vehicle_id' => $vehicle_id, 'isactive' => 1]; // Assuming 'isactive' is a column in your database
$existingBusiness = $model->where($where)->first(); $existingBusiness = $model->where($where)->first();

View File

@ -14,6 +14,7 @@ class Vendor extends BaseController
{ {
public $session; public $session;
protected $UsersModel;
public function __construct() public function __construct()
{ {
@ -23,7 +24,7 @@ class Vendor extends BaseController
public function vendor_index() public function vendor_index()
{ {
// print_r("hi");die; if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$VendorModel = new VendorModel(); $VendorModel = new VendorModel();
$vendor = $VendorModel->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll(); $vendor = $VendorModel->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
$data['vendor']=$vendor; $data['vendor']=$vendor;
@ -34,6 +35,7 @@ class Vendor extends BaseController
public function new_vendor($vendor_id) public function new_vendor($vendor_id)
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
if ($vendor_id === '0') { if ($vendor_id === '0') {
$data['vendor'] = []; $data['vendor'] = [];
$data['page_name'] = "Add Vendor"; $data['page_name'] = "Add Vendor";
@ -58,6 +60,7 @@ class Vendor extends BaseController
public function add_vendor() public function add_vendor()
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$VendorModel = new VendorModel(); $VendorModel = new VendorModel();
@ -99,6 +102,7 @@ class Vendor extends BaseController
public function delete_vendor($vendor_id) public function delete_vendor($vendor_id)
{ {
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$model = new VendorModel(); $model = new VendorModel();
$where = ['vendor_id' => $vendor_id, 'isactive' => 1 , 'branch_id' => $this->session->get('logged_user_branch_id')]; // Assuming 'isactive' is a column in your database $where = ['vendor_id' => $vendor_id, 'isactive' => 1 , 'branch_id' => $this->session->get('logged_user_branch_id')]; // Assuming 'isactive' is a column in your database
$existingBusiness = $model->where($where)->first(); $existingBusiness = $model->where($where)->first();

View File

@ -5,7 +5,7 @@ class ProductModel extends Model
{ {
protected $table = 'products'; protected $table = 'products';
protected $primaryKey = 'product_id'; protected $primaryKey = 'product_id';
protected $allowedFields = ['sku_id','product_id','rack_number','manufacturer_id','make_id','models_id','quality','product_name','branch_id','prefered_vendor','product_category','mfr_part_no','purchase_order_level','unit_price','commision_rate','sgst','cgst','purchase_cost','usage_unit','vendor','qty_stock','reorder_level','handler','qty_in_demand','product_image','description','isactive']; protected $allowedFields = ['sku_id','product_id','rack_number','manufacturer_id','make_id','models_id','quality','product_name','branch_id','prefered_vendor','product_category','mfr_part_no','purchase_order_level','unit_price','commision_rate','sgst','cgst','purchase_cost','usage_unit','vendor','qty_stock','reorder_level','handler','qty_in_demand','product_image','description','specification','hsn_sac','isactive'];
public function getTax() public function getTax()

View File

@ -5,7 +5,7 @@ class PurchaseOrderChildModel extends Model
{ {
protected $table = 'purchase_order_child'; protected $table = 'purchase_order_child';
protected $primaryKey = 'purchase_order_child_id'; protected $primaryKey = 'purchase_order_child_id';
protected $allowedFields = ['purchase_order_child_id','is_selected','purchase_order_id','product_id','qty','total','tax','net_price','amount','discount_type','selling_price','discount','isactive']; protected $allowedFields = ['purchase_order_child_id','is_selected','purchase_order_id','product_id','qty', 'received_qty','total','tax','net_price','amount','discount_type','selling_price','discount','isactive'];
} }

View File

@ -21,6 +21,10 @@ class PurchaseOrderModel extends Model
// Add condition to fetch only active sales orders // Add condition to fetch only active sales orders
$this->where('purchase_order_child.isactive', 1); $this->where('purchase_order_child.isactive', 1);
$this ->where('purchase_order.branch_id',$logged_user_branch_id); $this ->where('purchase_order.branch_id',$logged_user_branch_id);
$subquery = "(SELECT COUNT(*) FROM purchase_order_child WHERE purchase_order_child.purchase_order_id = purchase_order.purchase_order_id AND purchase_order_child.is_selected = 1) AS selected_product_count";
$this->select($subquery, false);
$this->orderBy('purchase_order.purchase_order_id','DESC'); $this->orderBy('purchase_order.purchase_order_id','DESC');
// Get the results // Get the results
return $this->findAll(); return $this->findAll();

View File

@ -33,11 +33,6 @@
<th>Client Name</th> <th>Client Name</th>
<th>Mobile</th> <th>Mobile</th>
<th>Email</th> <th>Email</th>
<th>Address</th>
<th>City</th>
<th>State</th>
<th>Country</th>
<th>Pin Code</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
@ -51,14 +46,9 @@
<td><?= $value['client_name']; ?></td> <td><?= $value['client_name']; ?></td>
<td><?= $value['mobile_no']; ?></td> <td><?= $value['mobile_no']; ?></td>
<td><?= $value['email']; ?></td> <td><?= $value['email']; ?></td>
<td><?= $value['address']; ?></td>
<td><?= $value['city'] != 0 ? $value['city'] : ''; ?></td>
<td><?= $value['state']; ?></td>
<td><?= $value['country']; ?></td>
<td><?= $value['postal_code']; ?></td>
<td> <td>
<a href="<?= "new_client/" . $value['client_id']; ?>" class="edit-button"><i class="ri-pencil-line"></i></a> <a href="<?= "new_client/" . $value['client_id']; ?>" class="edit-button"><i class="ri-pencil-line" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="<?= "delete_client/" . $value['client_id']; ?>" class="delete-button"><i class="ri-delete-bin-line"></i></a> <a href="<?= "delete_client/" . $value['client_id']; ?>" class="delete-button"><i class="ri-delete-bin-line" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td> </td>
<?php endif?> <?php endif?>

View File

@ -44,6 +44,38 @@
</div> </div>
</div> </div>
<input type="hidden" id="user_id" name="user_id" value="<?= isset($users['user_id']) ? $users['user_id'] : '' ?>">
<div class="form-row">
<div class="form-group col-md-6">
<label for="inputState" class="col-form-label">Role</label>
<select id="inputState" class="form-control" name="role" readonly required >
<option value="">Select Role</option>
<?php foreach ($roles as $role): ?>
<option value="<?= $role['role_id'] ?>" <?= isset($users['role']) && $users['role'] == $role['role_id'] ? 'selected' : '' ?>><?= $role['roles'] ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="form-group col-md-6">
<label for="inputState" class="col-form-label">Business</label>
<select id="business" class="form-control" name="business" readonly required>
<option value="">Select Business</option>
<?php foreach ($business as $busin): ?>
<option value="<?= $busin['business_id'] ?>" <?= isset($users['business_id']) && $users['business_id'] == $busin['business_id'] ? 'selected' : '' ?>><?= $busin['business_name'] ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="form-group col-md-6">
<label for="inputState" class="col-form-label">Branch</label>
<select id="branch" class="form-control" name="branch" readonly required>
<option value="">Select Branch</option>
<?php foreach ($branches as $branch): ?>
<option value="<?= $branch['branch_id'] ?>" <?= isset($users['branch_id']) && $users['branch_id'] == $branch['branch_id'] ? 'selected' : '' ?>><?= $branch['branch_name'] ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
</div> </div>
</div> <!-- end card --> </div> <!-- end card -->

View File

@ -124,7 +124,7 @@
<tr> <tr>
<td style="width:10%;"> <td style="width:10%;">
<select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;"> <select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;" readonly>
<option value="">Select a Product</option> <option value="">Select a Product</option>
<?php foreach ($product as $value) : ?> <?php foreach ($product as $value) : ?>
<?php if ((int)$value["isactive"] === 1) : ?> <?php if ((int)$value["isactive"] === 1) : ?>
@ -136,7 +136,7 @@
</select> </select>
</td> </td>
<td style="width:5%;"> <td style="width:5%;">
<input type="number" class="form-control item-quantity" name="quantity[]" min="0" value="<?= isset($purchasechild['qty']) ? $purchasechild['qty'] : '' ?>"> <input type="number" class="form-control item-quantity" name="quantity[]" min="0" value="<?= isset($purchasechild['qty']) ? $purchasechild['qty'] : '' ?>" readonly>
</td> </td>

View File

@ -38,33 +38,33 @@
<!-- Vendor js --> <!-- Vendor js -->
<script src="<?php echo base_url(); ?>/assets/js/vendor.min.js"></script> <script src="<?php echo base_url(); ?>public/assets/js/vendor.min.js"></script>
<!-- App js --> <!-- App js -->
<script src="<?php echo base_url(); ?>/assets/js/app.min.js"></script> <script src="<?php echo base_url(); ?>public/assets/js/app.min.js"></script>
<!-- third party js --> <!-- third party js -->
<script src="<?php echo base_url(); ?>/assets/libs/datatables.net/js/jquery.dataTables.min.js"></script> <script src="<?php echo base_url(); ?>public/assets/libs/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url(); ?>/assets/libs/datatables.net-bs4/js/dataTables.bootstrap4.min.js"></script> <script src="<?php echo base_url(); ?>public/assets/libs/datatables.net-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="<?php echo base_url(); ?>/assets/libs/datatables.net-responsive/js/dataTables.responsive.min.js"></script> <script src="<?php echo base_url(); ?>public/assets/libs/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
<script src="<?php echo base_url(); ?>/assets/libs/datatables.net-responsive-bs4/js/responsive.bootstrap4.min.js"></script> <script src="<?php echo base_url(); ?>public/assets/libs/datatables.net-responsive-bs4/js/responsive.bootstrap4.min.js"></script>
<script src="<?php echo base_url(); ?>/assets/libs/datatables.net-buttons/js/dataTables.buttons.min.js"></script> <script src="<?php echo base_url(); ?>public/assets/libs/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
<script src="<?php echo base_url(); ?>/assets/libs/datatables.net-buttons-bs4/js/buttons.bootstrap4.min.js"></script> <script src="<?php echo base_url(); ?>public/assets/libs/datatables.net-buttons-bs4/js/buttons.bootstrap4.min.js"></script>
<script src="<?php echo base_url(); ?>/assets/libs/datatables.net-buttons/js/buttons.html5.min.js"></script> <script src="<?php echo base_url(); ?>public/assets/libs/datatables.net-buttons/js/buttons.html5.min.js"></script>
<script src="<?php echo base_url(); ?>/assets/libs/datatables.net-buttons/js/buttons.flash.min.js"></script> <script src="<?php echo base_url(); ?>public/assets/libs/datatables.net-buttons/js/buttons.flash.min.js"></script>
<script src="<?php echo base_url(); ?>/assets/libs/datatables.net-buttons/js/buttons.print.min.js"></script> <script src="<?php echo base_url(); ?>public/assets/libs/datatables.net-buttons/js/buttons.print.min.js"></script>
<script src="<?php echo base_url(); ?>/assets/libs/datatables.net-keytable/js/dataTables.keyTable.min.js"></script> <script src="<?php echo base_url(); ?>public/assets/libs/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
<script src="<?php echo base_url(); ?>/assets/libs/datatables.net-select/js/dataTables.select.min.js"></script> <script src="<?php echo base_url(); ?>public/assets/libs/datatables.net-select/js/dataTables.select.min.js"></script>
<script src="<?php echo base_url(); ?>/assets/libs/pdfmake/build/pdfmake.min.js"></script> <script src="<?php echo base_url(); ?>public/assets/libs/pdfmake/build/pdfmake.min.js"></script>
<script src="<?php echo base_url(); ?>/assets/libs/pdfmake/build/vfs_fonts.js"></script> <script src="<?php echo base_url(); ?>public/assets/libs/pdfmake/build/vfs_fonts.js"></script>
<!-- third party js ends --> <!-- third party js ends -->
<!-- Datatables init --> <!-- Datatables init -->
<script src="<?php echo base_url(); ?>/assets/js/pages/datatables.init.js"></script> <script src="<?php echo base_url(); ?>public/assets/js/pages/datatables.init.js"></script>
<!-- Toster --> <!-- Toster -->
<script src="https://cdn.jsdelivr.net/npm/toastr@2.1.4/toastr.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/toastr@2.1.4/toastr.min.js"></script>

View File

@ -8,24 +8,24 @@
<meta content="Coderthemes" name="author" /> <meta content="Coderthemes" name="author" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- App favicon --> <!-- App favicon -->
<link rel="shortcut icon" href="<?php echo base_url()?>/assets/images/favicon.ico"> <link rel="shortcut icon" href="<?php echo base_url()?>public/assets/images/favicon.ico">
<!-- third party css --> <!-- third party css -->
<link href="<?php echo base_url()?>/assets/libs/datatables.net-bs4/css/dataTables.bootstrap4.min.css" rel="stylesheet" type="text/css" /> <link href="<?php echo base_url()?>public/assets/libs/datatables.net-bs4/css/dataTables.bootstrap4.min.css" rel="stylesheet" type="text/css" />
<link href="<?php echo base_url()?>/assets/libs/datatables.net-responsive-bs4/css/responsive.bootstrap4.min.css" rel="stylesheet" type="text/css" /> <link href="<?php echo base_url()?>public/assets/libs/datatables.net-responsive-bs4/css/responsive.bootstrap4.min.css" rel="stylesheet" type="text/css" />
<link href="<?php echo base_url()?>/assets/libs/datatables.net-buttons-bs4/css/buttons.bootstrap4.min.css" rel="stylesheet" type="text/css" /> <link href="<?php echo base_url()?>public/assets/libs/datatables.net-buttons-bs4/css/buttons.bootstrap4.min.css" rel="stylesheet" type="text/css" />
<link href="<?php echo base_url()?>/assets/libs/datatables.net-select-bs4/css//select.bootstrap4.min.css" rel="stylesheet" type="text/css" /> <link href="<?php echo base_url()?>public/assets/libs/datatables.net-select-bs4/css//select.bootstrap4.min.css" rel="stylesheet" type="text/css" />
<!-- third party css end --> <!-- third party css end -->
<!-- App css --> <!-- App css -->
<link href="<?php echo base_url()?>/assets/css/bootstrap-modern.min.css" rel="stylesheet" type="text/css" id="bs-default-stylesheet" /> <link href="<?php echo base_url()?>public/assets/css/bootstrap-modern.min.css" rel="stylesheet" type="text/css" id="bs-default-stylesheet" />
<link href="<?php echo base_url()?>/assets/css/app-modern.min.css" rel="stylesheet" type="text/css" id="app-default-stylesheet" /> <link href="<?php echo base_url()?>public/assets/css/app-modern.min.css" rel="stylesheet" type="text/css" id="app-default-stylesheet" />
<link href="<?php echo base_url()?>/assets/css/bootstrap-modern-dark.min.css" rel="stylesheet" type="text/css" id="bs-dark-stylesheet" /> <link href="<?php echo base_url()?>public/assets/css/bootstrap-modern-dark.min.css" rel="stylesheet" type="text/css" id="bs-dark-stylesheet" />
<link href="<?php echo base_url()?>/assets/css/app-modern-dark.min.css" rel="stylesheet" type="text/css" id="app-dark-stylesheet" /> <link href="<?php echo base_url()?>public/assets/css/app-modern-dark.min.css" rel="stylesheet" type="text/css" id="app-dark-stylesheet" />
<!-- icons --> <!-- icons -->
<link href="<?php echo base_url()?>/assets/css/icons.min.css" rel="stylesheet" type="text/css" /> <link href="<?php echo base_url()?>public/assets/css/icons.min.css" rel="stylesheet" type="text/css" />
<style> <style>
/* Override toastr font color */ /* Override toastr font color */
.toast-warning { .toast-warning {
@ -58,21 +58,21 @@
<div class="logo-box"> <div class="logo-box">
<a href="index.html" class="logo logo-dark text-center"> <a href="index.html" class="logo logo-dark text-center">
<span class="logo-sm"> <span class="logo-sm">
<img src="<?php echo base_url(); ?>/assets/images/The-Mechanic-Yellow.png" alt="" height="24"> <img src="<?php echo base_url(); ?>public/assets/images/The-Mechanic-Yellow.png" alt="" height="24">
<!-- <span class="logo-lg-text-light">Minton</span> --> <!-- <span class="logo-lg-text-light">Minton</span> -->
</span> </span>
<span class="logo-lg"> <span class="logo-lg">
<img src="<?php echo base_url(); ?>/assets/images/The-Mechanic-Yellow.png" alt="" height="20"> <img src="<?php echo base_url(); ?>public/assets/images/The-Mechanic-Yellow.png" alt="" height="20">
<!-- <span class="logo-lg-text-light">M</span> --> <!-- <span class="logo-lg-text-light">M</span> -->
</span> </span>
</a> </a>
<a href="index.html" class="logo logo-light text-center"> <a href="index.html" class="logo logo-light text-center">
<span class="logo-sm"> <span class="logo-sm">
<img src="<?php echo base_url(); ?>/assets/images/The-Mechanic-Yellow.png" alt="" height="24"> <img src="<?php echo base_url(); ?>public/assets/images/The-Mechanic-Yellow.png" alt="" height="24">
</span> </span>
<span class="logo-lg"> <span class="logo-lg">
<img src="<?php echo base_url(); ?>/assets/images/The-Mechanic-Yellow.png" alt="" height="20"> <img src="<?php echo base_url(); ?>public/assets/images/The-Mechanic-Yellow.png" alt="" height="20">
</span> </span>
</a> </a>
</div> </div>
@ -111,9 +111,9 @@
<li> <li>
<a href="<?php echo base_url('sales_order_index') ?>">Sales Order</a> <a href="<?php echo base_url('sales_order_index') ?>">Sales Order</a>
</li> </li>
<li> <!-- <li>
<a href="<?php echo base_url('job_card_index') ?>">Job Card</a> <a href="<?php echo base_url('job_card_index') ?>">Job Card</a>
</li> </li> -->
<li> <li>
<a href="<?php echo base_url('vehicle_index') ?>">Vehicles</a> <a href="<?php echo base_url('vehicle_index') ?>">Vehicles</a>
</li> </li>
@ -145,7 +145,7 @@
<a href="<?php echo base_url('return_order') ?>"> Purchase Return</a> <a href="<?php echo base_url('return_order') ?>"> Purchase Return</a>
</li> </li>
<li> <li>
<a href="<?php echo base_url('reorder_level_index') ?>">Reorder List</a> <a href="<?php echo base_url('reorder_level_index') ?>">Low Stock Items</a>
</li> </li>
<li> <li>
<a href="<?php echo base_url('vendor_index') ?>">Vendor</a> <a href="<?php echo base_url('vendor_index') ?>">Vendor</a>
@ -174,9 +174,9 @@
<li> <li>
<a href="<?php echo base_url('product_index') ?>">Products</a> <a href="<?php echo base_url('product_index') ?>">Products</a>
</li> </li>
<li> <!-- <li>
<a href="<?php echo base_url('service_index') ?>">Services</a> <a href="<?php echo base_url('service_index') ?>">Services</a>
</li> </li> -->
</ul> </ul>
</div> </div>
</li> </li>
@ -200,11 +200,7 @@
<!-- </a> --> <!-- </a> -->
</li> </li>
<li> <li>
<a href="<?php echo base_url('index') ?>"> <a href="<?php echo base_url('index') ?>"><i class="fas fa-user"></i><span> Users</span></a></li>
<i class="fas fa-user"></i>
<span> Users</span>
</a>
</li>
<?php } ?> <?php } ?>
@ -311,21 +307,21 @@
<div class="logo-box"> <div class="logo-box">
<a class="logo logo-dark text-center"> <a class="logo logo-dark text-center">
<span class="logo-sm"> <span class="logo-sm">
<img src="<?php echo base_url(); ?>/assets/images/favicon.ico" alt="" height="24" style="width: 50px; height: 45px;" > <img src="<?php echo base_url(); ?>public/assets/images/favicon.ico" alt="" height="24" style="width: 50px; height: 45px;" >
<!-- <span class="logo-lg-text-light">Minton</span> --> <!-- <span class="logo-lg-text-light">Minton</span> -->
</span> </span>
<span class="logo-lg"> <span class="logo-lg">
<img src="<?php echo base_url(); ?>/assets/images/The-Mechanic-Yellow.png" alt="" height="20" style="width: 170px; height: 55px;"> <img src="<?php echo base_url(); ?>public/assets/images/The-Mechanic-Yellow.png" alt="" height="20" style="width: 170px; height: 55px;">
<!-- <span class="logo-lg-text-light">M</span> --> <!-- <span class="logo-lg-text-light">M</span> -->
</span> </span>
</a> </a>
<a class="logo logo-light text-center"> <a class="logo logo-light text-center">
<span class="logo-sm"> <span class="logo-sm">
<img src="<?php echo base_url(); ?>/assets/images/favicon.ico" alt="" height="24" style="width: 50px; height: 45px;"> <img src="<?php echo base_url(); ?>public/assets/images/favicon.ico" alt="" height="24" style="width: 50px; height: 45px;">
</span> </span>
<span class="logo-lg"> <span class="logo-lg">
<img src="<?php echo base_url(); ?>/assets/images/The-Mechanic-Yellow.png" alt="" height="20" style="width: 170px; height: 55px;"> <img src="<?php echo base_url(); ?>public/assets/images/The-Mechanic-Yellow.png" alt="" height="20" style="width: 170px; height: 55px;">
</span> </span>
</a> </a>
</div> </div>

View File

@ -8,17 +8,17 @@
<meta content="Coderthemes" name="author" /> <meta content="Coderthemes" name="author" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- App favicon --> <!-- App favicon -->
<link rel="shortcut icon" href="<?php base_url()?>assets/images/favicon.ico"> <link rel="shortcut icon" href="<?php base_url()?>public/assets/images/favicon.ico">
<!-- App css --> <!-- App css -->
<link href="<?php base_url()?>assets/css/bootstrap-modern.min.css" rel="stylesheet" type="text/css" id="bs-default-stylesheet" /> <link href="<?php base_url()?>public/assets/css/bootstrap-modern.min.css" rel="stylesheet" type="text/css" id="bs-default-stylesheet" />
<link href="<?php base_url()?>assets/css/app-modern.min.css" rel="stylesheet" type="text/css" id="app-default-stylesheet" /> <link href="<?php base_url()?>public/assets/css/app-modern.min.css" rel="stylesheet" type="text/css" id="app-default-stylesheet" />
<link href="<?php base_url()?>assets/css/bootstrap-modern-dark.min.css" rel="stylesheet" type="text/css" id="bs-dark-stylesheet" /> <link href="<?php base_url()?>public/assets/css/bootstrap-modern-dark.min.css" rel="stylesheet" type="text/css" id="bs-dark-stylesheet" />
<link href="<?php base_url()?>assets/css/app-modern-dark.min.css" rel="stylesheet" type="text/css" id="app-dark-stylesheet" /> <link href="<?php base_url()?>public/assets/css/app-modern-dark.min.css" rel="stylesheet" type="text/css" id="app-dark-stylesheet" />
<!-- icons --> <!-- icons -->
<link href="<?php base_url()?>assets/css/icons.min.css" rel="stylesheet" type="text/css" /> <link href="<?php base_url()?>public/assets/css/icons.min.css" rel="stylesheet" type="text/css" />
</head> </head>
@ -36,7 +36,7 @@
<div class="auth-logo"> <div class="auth-logo">
<a class="logo text-center"> <a class="logo text-center">
<span class="logo-lg"> <span class="logo-lg">
<img src="<?php base_url()?>assets/images/logo.png" alt="" height="22" style="width: 305px; height: 190px;"> <img src="<?php base_url()?>public/assets/images/logo.png" alt="" height="22" style="width: 305px; height: 190px;">
</span> </span>
</a> </a>
@ -92,10 +92,10 @@
</footer> </footer>
<!-- Vendor js --> <!-- Vendor js -->
<script src="<?php base_url()?>assets/js/vendor.min.js"></script> <script src="<?php base_url()?>public/assets/js/vendor.min.js"></script>
<!-- App js --> <!-- App js -->
<script src="<?php base_url()?>assets/js/app.min.js"></script> <script src="<?php base_url()?>public/assets/js/app.min.js"></script>
</body> </body>
</html> </html>

View File

@ -107,16 +107,78 @@
</select> </select>
</div> </div>
<div class="form-group col-md-3">
<div class="form-group col-md-4"> <label for="inputEmail4" class="col-form-label">HSN/SAC<span class="text-danger"></span></label>
<label for="inputEmail4" class="col-form-label">Product Category<span class="text-danger"></span></label> <input type="text" class="form-control" name="hsn_sac" placeholder="HSN/SAC" value="<?= isset($products['hsn_sac']) ? $products['hsn_sac'] : '' ?>" >
<input type="text" class="form-control" name="productcategory" placeholder="Product Category" value="<?= isset($products['product_category']) ? $products['product_category'] : '' ?>" >
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-3">
<label for="inputEmail4" class="col-form-label">Product Category<span class="text-danger"></span></label>
<select class="form-control status-select SelExample" name="productcategory" required data-toggle="select2">
<option value="" >Select Category</option>
<option value="Bearings" <?= (isset($products['product_category']) && $products['product_category'] == 'Bearings') ? 'selected' : '' ?>>Bearings</option>
<option value="Paste" <?= (isset($products['product_category']) && $products['product_category'] == 'Paste') ? 'selected' : '' ?>>Paste</option>
<option value="Clutch Plates" <?= (isset($products['product_category']) && $products['product_category'] == 'Clutch Plates') ? 'selected' : '' ?>>Clutch Plates</option>
<option value="Head Beeding" <?= (isset($products['product_category']) && $products['product_category'] == 'Head Beeding') ? 'selected' : '' ?>>Head Beeding</option>
<option value="Oil Seal" <?= (isset($products['product_category']) && $products['product_category'] == 'Oil Seal') ? 'selected' : '' ?>>Oil Seal</option>
<option value="Switches" <?= (isset($products['product_category']) && $products['product_category'] == 'Switches') ? 'selected' : '' ?>>Switches</option>
<option value="Speedometer" <?= (isset($products['product_category']) && $products['product_category'] == 'Speedometer') ? 'selected' : '' ?>>Speedometer</option>
<option value="Oil" <?= (isset($products['product_category']) && $products['product_category'] == 'Oil') ? 'selected' : '' ?>>Oil</option>
<option value="Cone set" <?= (isset($products['product_category']) && $products['product_category'] == 'Cone set') ? 'selected' : '' ?>>Cone set</option>
<option value="Brake" <?= (isset($products['product_category']) && $products['product_category'] == 'Brake') ? 'selected' : '' ?>>Brake</option>
<option value="Oil Filter" <?= (isset($products['product_category']) && $products['product_category'] == 'Oil Filter') ? 'selected' : '' ?>>Oil Filter</option>
<option value="Battery" <?= (isset($products['product_category']) && $products['product_category'] == 'Battery') ? 'selected' : '' ?>>Battery</option>
<option value="Lubricants" <?= (isset($products['product_category']) && $products['product_category'] == 'Lubricants') ? 'selected' : '' ?>>Lubricants</option>
<option value="Mirror" <?= (isset($products['product_category']) && $products['product_category'] == 'Mirror') ? 'selected' : '' ?>>Mirror</option>
<option value="Spark Plug" <?= (isset($products['product_category']) && $products['product_category'] == 'Spark Plug') ? 'selected' : '' ?>>Spark Plug</option>
<option value="Belt" <?= (isset($products['product_category']) && $products['product_category'] == 'Belt') ? 'selected' : '' ?>>Belt</option>
<option value="Indicators" <?= (isset($products['product_category']) && $products['product_category'] == 'Indicators') ? 'selected' : '' ?>>Indicators</option>
<option value="Wiring" <?= (isset($products['product_category']) && $products['product_category'] == 'Wiring') ? 'selected' : '' ?>>Wiring</option>
<option value="Light" <?= (isset($products['product_category']) && $products['product_category'] == 'Light') ? 'selected' : '' ?>>Light</option>
<option value="Flasher" <?= (isset($products['product_category']) && $products['product_category'] == 'Flasher') ? 'selected' : '' ?>>Flasher</option>
<option value="Buzzer" <?= (isset($products['product_category']) && $products['product_category'] == 'Buzzer') ? 'selected' : '' ?>>Buzzer</option>
<option value="Bush" <?= (isset($products['product_category']) && $products['product_category'] == 'Bush') ? 'selected' : '' ?>>Bush</option>
<option value="Wheel rubber" <?= (isset($products['product_category']) && $products['product_category'] == 'Wheel rubber') ? 'selected' : '' ?>>Wheel rubber</option>
<option value="Stand" <?= (isset($products['product_category']) && $products['product_category'] == 'Stand') ? 'selected' : '' ?>>Stand</option>
<option value="Kicker" <?= (isset($products['product_category']) && $products['product_category'] == 'Kicker') ? 'selected' : '' ?>>Kicker</option>
<option value="Gear" <?= (isset($products['product_category']) && $products['product_category'] == 'Gear') ? 'selected' : '' ?>>Gear</option>
<option value="Disc Pad" <?= (isset($products['product_category']) && $products['product_category'] == 'Disc Pad') ? 'selected' : '' ?>>Disc Pad</option>
<option value="Foot Rest" <?= (isset($products['product_category']) && $products['product_category'] == 'Foot Rest') ? 'selected' : '' ?>>Foot Rest</option>
<option value="Petrol Tap" <?= (isset($products['product_category']) && $products['product_category'] == 'Petrol Tap') ? 'selected' : '' ?>>Petrol Tap</option>
<option value="Bolts ,Nuts & screws" <?= (isset($products['product_category']) && $products['product_category'] == 'Bolts ,Nuts & screws') ? 'selected' : '' ?>>Bolts ,Nuts & screws</option>
<option value="Tyres & Tubes" <?= (isset($products['product_category']) && $products['product_category'] == 'Tyres & Tubes') ? 'selected' : '' ?>>Tyres & Tubes</option>
<option value="Gasket" <?= (isset($products['product_category']) && $products['product_category'] == 'Gasket') ? 'selected' : '' ?>>Gasket</option>
<option value="Clutch Switch" <?= (isset($products['product_category']) && $products['product_category'] == 'Clutch Switch') ? 'selected' : '' ?>>Clutch Switch</option>
<option value="Fuse" <?= (isset($products['product_category']) && $products['product_category'] == 'Fuse') ? 'selected' : '' ?>>Fuse</option>
<option value="Gaskets" <?= (isset($products['product_category']) && $products['product_category'] == 'Gaskets') ? 'selected' : '' ?>>Gaskets</option>
<option value="Yoke" <?= (isset($products['product_category']) && $products['product_category'] == 'Yoke') ? 'selected' : '' ?>>Yoke</option>
<option value="Air Filter" <?= (isset($products['product_category']) && $products['product_category'] == 'Air Filter') ? 'selected' : '' ?>>Air Filter</option>
<option value="Glass" <?= (isset($products['product_category']) && $products['product_category'] == 'Glass') ? 'selected' : '' ?>>Glass</option>
<option value="Chain Adjuster" <?= (isset($products['product_category']) && $products['product_category'] == 'Chain Adjuster') ? 'selected' : '' ?>>Chain Adjuster</option>
<option value="Spokes" <?= (isset($products['product_category']) && $products['product_category'] == 'Spokes') ? 'selected' : '' ?>>Spokes</option>
<option value="V bush" <?= (isset($products['product_category']) && $products['product_category'] == 'V bush') ? 'selected' : '' ?>>V bush</option>
<option value="Stay Bush" <?= (isset($products['product_category']) && $products['product_category'] == 'Stay Bush') ? 'selected' : '' ?>>Stay Bush</option>
<option value="Roller Bush" <?= (isset($products['product_category']) && $products['product_category'] == 'Roller Bush') ? 'selected' : '' ?>>Roller Bush</option>
<option value="Brake Shoe" <?= (isset($products['product_category']) && $products['product_category'] == 'Brake Shoe') ? 'selected' : '' ?>>Brake Shoe</option>
<option value="Mud Flap" <?= (isset($products['product_category']) && $products['product_category'] == 'Mud Flap') ? 'selected' : '' ?>>Mud Flap</option>
<option value="Grip" <?= (isset($products['product_category']) && $products['product_category'] == 'Grip') ? 'selected' : '' ?>>Grip</option>
<option value="Rubber" <?= (isset($products['product_category']) && $products['product_category'] == 'Rubber') ? 'selected' : '' ?>>Rubber</option>
<option value="Cables" <?= (isset($products['product_category']) && $products['product_category'] == 'Cables') ? 'selected' : '' ?>>Cables</option>
</select>
</div>
<div class="form-group col-md-3">
<label for="inputEmail4" class="col-form-label">Specification<span class="text-danger"></span></label>
<input type="text" class="form-control" name="specification" placeholder="Specification" value="<?= isset($products['specification']) ? $products['specification'] : '' ?>" >
</div>
<div class="form-group col-md-3">
<label for="inputEmail4" class="col-form-label">Rack Number<span class="text-danger"></span></label> <label for="inputEmail4" class="col-form-label">Rack Number<span class="text-danger"></span></label>
<input type="text" class="form-control" name="rack_number" placeholder="Rack Number" value="<?= isset($products['rack_number']) ? $products['rack_number'] : '' ?>" > <input type="text" class="form-control" name="rack_number" placeholder="Rack Number" value="<?= isset($products['rack_number']) ? $products['rack_number'] : '' ?>" >
</div> </div>
</div> </div>
<input type="hidden" id="product_id" name="product_id" value="<?= isset($products['product_id']) ? $products['product_id'] : '' ?>"><br> <input type="hidden" id="product_id" name="product_id" value="<?= isset($products['product_id']) ? $products['product_id'] : '' ?>"><br>
<h4 class="header-title">Pricing Information :</h4><br> <h4 class="header-title">Pricing Information :</h4><br>
@ -339,10 +401,10 @@ document.addEventListener('DOMContentLoaded', function() {
// Listen for the keyup event on qty in stock input // Listen for the keyup event on qty in stock input
qtyInStockInput.addEventListener('keyup', function() { qtyInStockInput.addEventListener('keyup', function() {
const qtyInStock = parseFloat(qtyInStockInput.value); const qtyInStock = parseFloat(qtyInStockInput.value);
const purchaseorderLevel = qtyInStock / 2; // Calculate the purchase reorder level (half of qty in stock) purchaseorderLevel = qtyInStock / 2; // Calculate the purchase reorder level (half of qty in stock)
purchaseOrderLevel = Math.floor(purchaseorderLevel);
// Update the value of purchase reorder level input // Update the value of purchase reorder level input
purchaseOrderLevelInput.value = isNaN(purchaseorderLevel) ? '' : purchaseorderLevel; purchaseOrderLevelInput.value = isNaN(purchaseOrderLevel) ? '' : purchaseOrderLevel;
purchaseReorderLevelInput.value = isNaN(qtyInStock) ? '' : qtyInStock; purchaseReorderLevelInput.value = isNaN(qtyInStock) ? '' : qtyInStock;
}); });
}); });

View File

@ -35,8 +35,7 @@
<th>Category</th> <th>Category</th>
<th>Unit Price</th> <th>Unit Price</th>
<th>Qty in Stock</th> <th>Qty in Stock</th>
<th>Sgst</th> <th>Rack No</th>
<th>Cgst</th>
<?php if(!$manufacturer_id) { ?><th>Actions</th><?php } ?> <?php if(!$manufacturer_id) { ?><th>Actions</th><?php } ?>
</tr> </tr>
</thead> </thead>
@ -52,8 +51,7 @@
<td><?= number_format($value['unit_price']); ?></td> <td><?= number_format($value['unit_price']); ?></td>
<td><?= $value['qty_stock']; ?></td> <td><?= $value['qty_stock']; ?></td>
<td><?= $value['cgst']; ?>%</td> <td><?= $value['rack_number']; ?></td>
<td><?= $value['sgst']; ?>%</td>
<!-- Call the model method --> <!-- Call the model method -->
<?php if(!$manufacturer_id) { ?> <?php if(!$manufacturer_id) { ?>

View File

@ -41,7 +41,7 @@
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="contact_person_name" class="col-form-label">Contact Person Name<span class="text-danger">*</span></label> <label for="contact_person_name" class="col-form-label">Contact Person Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="contact_person_name" id="contact_person_name" placeholder="Contact Person Name.."value="<?= isset($purchase['contact_person_name']) ? $purchase['contact_person_name'] : '' ?>" required> <input type="text" class="form-control" name="contact_person_name" id="contact_person_name" placeholder="Contact Person Name"value="<?= isset($purchase['contact_person_name']) ? $purchase['contact_person_name'] : '' ?>" required>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="contact_person_mobile" class="col-form-label">Contact Person Mobile<span class="text-danger">*</span></label> <label for="contact_person_mobile" class="col-form-label">Contact Person Mobile<span class="text-danger">*</span></label>
@ -63,7 +63,7 @@
(<?= $purchase['status'] ?>) (<?= $purchase['status'] ?>)
<?php endif; ?></label> <?php endif; ?></label>
<select class="form-control status-select" name="purchase_status" required data-toggle="select2"> <select class="form-control status-select" name="purchase_status" required data-toggle="select2">
<?php if (isset($purchase['status'])): ?> <?php if (isset($purchase['status']) && !isset($reorder)): ?>
<?php if ($purchase['status'] === 'Cancel'): ?> <?php if ($purchase['status'] === 'Cancel'): ?>
<option value="">Select Status</option> <option value="">Select Status</option>
<option value="Received" <?= $purchase['status'] === 'Received' ? 'selected' : '' ?>>Received</option> <option value="Received" <?= $purchase['status'] === 'Received' ? 'selected' : '' ?>>Received</option>
@ -83,7 +83,7 @@
</div> </div>
<h4 class="header-title">Billing Addresss :</h4><br>
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="billing_address" class="col-form-label">Billing Addresss<span class="text-danger">*</span></label> <label for="billing_address" class="col-form-label">Billing Addresss<span class="text-danger">*</span></label>
@ -103,7 +103,7 @@
</div> </div>
</div><br> </div><br>
<h4 class="header-title">Shipping Addresss :</h4><br>
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="shipping_address" class="col-form-label">Shipping Addresss<span class="text-danger">*</span></label> <label for="shipping_address" class="col-form-label">Shipping Addresss<span class="text-danger">*</span></label>
@ -134,13 +134,12 @@
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<h4>Item Details</h4> <h4>Item Details</h4>
<br /> <br />
<table class="table table-bordered" id="itemTable"> <table class="table table-bordered" id="itemTable">
<thead> <thead>
<tr> <tr>
<th>Item Details</th> <th>Item Details</th>
<th>Qty</th> <th>Qty</th>
<?php if (!empty($purchase["status"])): ?> <?php if (!empty($purchase["status"]) && !isset($reorder)): ?>
<th>Received</th> <th>Received</th>
<th>Amount</th> <th>Amount</th>
<?php endif; ?> <?php endif; ?>
@ -169,15 +168,17 @@
</select> </select>
</td> </td>
<td style="width:5%;"> <td style="width:5%;">
<input type="number" class="form-control item-quantity" name="quantity[]" min="0" value="<?= isset($purchasechild['qty']) ? $purchasechild['qty'] : '' ?>"> <input type="number" class="form-control item-quantity" name="quantity[]" min="0" value="<?= isset($purchasechild['received_qty']) && $purchasechild['received_qty'] != null ? ( (!isset($reorder) || $purchasechild['is_selected'] == 0) ? $purchasechild['received_qty'] : $purchasechild['qty'] - $purchasechild['received_qty'] ) : $purchasechild['qty'] ?>">
</td> </td>
<?php if(!isset($reorder)) { ?>
<td style="width:2%;"> <td style="width:2%;">
<input type="hidden" name="selected_items[]" value="<?= ($purchasechild['is_selected'] == 1) ? 'checked' : 'unchecked' ?>"> <!-- Hidden input for unchecked checkboxes --> <input type="hidden" name="selected_items[]" value="<?= (isset($purchasechild['is_selected']) && $purchasechild['is_selected'] == 1) ? 'checked' : 'unchecked' ?>"> <!-- Hidden input for unchecked checkboxes -->
<input type="checkbox" class="form-control-check-input" <?php echo ($purchasechild['is_selected'] == 1) ? 'checked' : ''; ?> > <input type="checkbox" class="form-control-check-input" <?php echo (isset($purchasechild['is_selected']) && $purchasechild['is_selected'] == 1) ? 'checked' : ''; ?> >
</td> </td>
<td style="width:5%;"> <td style="width:5%;">
<input type="number" class="form-control item-quantity" name="amount[]" value="<?= isset($purchasechild['amount']) ? $purchasechild['amount'] : '' ?>"> <input type="number" class="form-control item-quantity" name="amount[]" value="<?= isset($purchasechild['amount']) ? $purchasechild['amount'] : '' ?>">
</td> </td>
<?php } ?>
<td hidden><input type="hidden" value="<?= isset($purchasechild['purchase_order_child_id']) ? $purchasechild['purchase_order_child_id'] : '' ?>"name="purchase_order_child_id[]"></td> <td hidden><input type="hidden" value="<?= isset($purchasechild['purchase_order_child_id']) ? $purchasechild['purchase_order_child_id'] : '' ?>"name="purchase_order_child_id[]"></td>
<td style="width:5%;"> <td style="width:5%;">
<center><i class="fa fa-trash remove-item"></i></center> <center><i class="fa fa-trash remove-item"></i></center>
@ -189,7 +190,7 @@
<!-- You can add more rows as needed using JavaScript --> <!-- You can add more rows as needed using JavaScript -->
</tbody> </tbody>
</table> </table>
<?php if (empty($purchase["status"])): ?> <?php if (empty($purchase["status"]) || isset($reorder)): ?>
<div class="form-group text-right m-b-0"> <div class="form-group text-right m-b-0">
<!-- Show the "Add More Item" button only if invoice_type is not 1 --> <!-- Show the "Add More Item" button only if invoice_type is not 1 -->
<a class="btn" id="addItem"> <a class="btn" id="addItem">
@ -208,13 +209,11 @@
<label for="inputPassword4" class="col-form-label">Terms & Condition</label> <label for="inputPassword4" class="col-form-label">Terms & Condition</label>
<textarea class="form-control" name="terms_condition" placeholder="Terms & Condition" > <textarea class="form-control" name="terms_condition" placeholder="Terms & Condition" ><?= isset($sales['terms_condition']) ? $sales['terms_condition'] : 'Please check the products properly before purchase. Products once sold cannot be returned.' ?></textarea>
<?= isset($sales['terms_condition']) ? $sales['terms_condition'] : 'Please check the products properly before purchase. Products once sold cannot be returned.' ?>
</textarea>
</div> </div>
</div> </div>
<?php if (!isset($purchase['status']) || $purchase['status'] !== 'Received') : ?> <?php if (!isset($purchase['status']) || $purchase['status'] !== 'Received' || isset($reorder)) : ?>
<button type="submit" id="editaddbutton"class="btn btn-primary">Submit</button> <button type="submit" id="editaddbutton"class="btn btn-primary">Submit</button>
<?php endif; ?> <?php endif; ?>

View File

@ -54,8 +54,8 @@
<th>Order Date</th> <th>Order Date</th>
<th>Contact Person Details</th> <th>Contact Person Details</th>
<!-- <th>Contact Person Mobile</th> --> <!-- <th>Contact Person Mobile</th> -->
<th>Quantity</th> <th>Items</th>
<th>Received Items</th>
<th>Status</th> <th>Status</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
@ -71,6 +71,7 @@
<td><?= $value['contact_person_name']; ?><br> <td><?= $value['contact_person_name']; ?><br>
<?= $value['contact_person_mobile']; ?> <?= $value['contact_person_mobile']; ?>
<td><?= $value['product_count']; ?></td> <td><?= $value['product_count']; ?></td>
<td><?= $value['selected_product_count']; ?></td>
<td class="<?php <td class="<?php
if ($value['status'] == 'Cancel') { if ($value['status'] == 'Cancel') {
echo 'cancelled-status'; echo 'cancelled-status';
@ -88,6 +89,9 @@
<td> <td>
<a href="<?= "new_purchase/" . $value['purchase_order_id']; ?>" class="edit-button" title="Edit"><i class="ri-pencil-line" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="<?= "new_purchase/" . $value['purchase_order_id']; ?>" class="edit-button" title="Edit"><i class="ri-pencil-line" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="<?= "delete_purchase/" . $value['purchase_order_id']; ?>" class="delete-button" title="Delete"><i class="ri-delete-bin-line" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="<?= "delete_purchase/" . $value['purchase_order_id']; ?>" class="delete-button" title="Delete"><i class="ri-delete-bin-line" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<?php if($value['status'] != "PO Issued") { ?>
<a href="<?= "reorder_purchase/" . $value['purchase_order_id']; ?>" title="Pending Reorder"><i class="fa fa-retweet" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<?php } ?>
<a href="<?= "download_purchase_invoice/" . $value['purchase_order_id']; ?>" class="edit-button" title="Download"><i class="ri-download-2-fill" style="font-size: 20px;"></i></a> <a href="<?= "download_purchase_invoice/" . $value['purchase_order_id']; ?>" class="edit-button" title="Download"><i class="ri-download-2-fill" style="font-size: 20px;"></i></a>
</td> </td>

View File

@ -111,35 +111,34 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php if (isset($products) && !empty($products)) : ?> <?php if (isset($products) && !empty($products)) :
foreach ($products as $product) { ?>
<tr> <tr>
<td style="width:10%;"> <td style="width:10%;">
<select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;"> <select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;">
<option value="">Select a Product</option> <option value="">Select a Product</option>
<option value="<?= $products["product_id"] ?>" <?= isset($products['product_id']) ? 'selected' : '' ?>> <option value="<?= $product["product_id"] ?>" <?= isset($product['product_id']) ? 'selected' : '' ?>>
<?= $products["product_name"]; ?> <?= $product["product_name"]; ?>
</option> </option>
</select> </select>
</td> </td>
<td style="width:5%;"> <td style="width:5%;">
<input type="number" class="form-control item-quantity" name="quantity[]" min="0" value="<?= isset($products['reorder_level']) ? $products['reorder_level'] : '' ?>"> <input type="number" class="form-control item-quantity" name="quantity[]" min="1" value="<?= isset($product['reorder_level']) ? $product['reorder_level'] : '' ?>">
</td> </td>
<td style="width:5%;"> <td style="width:5%;">
<center><i class="fa fa-trash remove-item"></i></center> <center><i class="fa fa-trash"></i></center>
</td> </td>
</tr> </tr>
<?php endif; ?> <?php } endif; ?>
<!-- You can add more rows as needed using JavaScript --> <!-- You can add more rows as needed using JavaScript -->
</tbody> </tbody>
</table> </table>
<?php if (empty($purchase["status"])): ?>
<div class="form-group text-right m-b-0"> <div class="form-group text-right m-b-0">
<!-- Show the "Add More Item" button only if invoice_type is not 1 --> <!-- Show the "Add More Item" button only if invoice_type is not 1 -->
<a class="btn" id="addItem"> <a class="btn" id="addItem">
<h4><i class="fa fa-plus" aria-hidden="true"></i> Add Product</h4> <h4><i class="fa fa-plus" aria-hidden="true"></i> Add Product</h4>
</a> </a>
</div> </div>
<?php endif; ?>
</div> </div>
</div> </div>
<h4 class="header-title">Terms & Condition :</h4><br> <h4 class="header-title">Terms & Condition :</h4><br>
@ -160,7 +159,39 @@
</div> </div>
</div> </div>
</div> </div>
<input type="hidden" id="pr_data" value="<?= htmlspecialchars(json_encode($product_data)); ?>">
<?php include('layout/footer.php'); ?> <?php include('layout/footer.php'); ?>
<script>
// Event listener for "Add More Item" button
$('#addItem').click(function() {
const productarray = JSON.parse($('#pr_data').val())
console.log($('#pr_data').val());
var newRow = '<tr>' +
'<td><select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Product</option>';
for (var i = 0; i < productarray.length; i++) {
var product = productarray[i];
newRow += '<option value="' + product.product_id + '" >' + product.product_name +
'</option>';
}
newRow += '</select></td>' +
'<td style="width:10%;"><input type="number" class="form-control item-quantity" min="1" max="" value="1" name="quantity[]"/></td>' +
'<td><center><i class="fa fa-trash remove-item"></i></center></td>' +
'</tr>';
$('#itemTable tbody').append(newRow);
initializeSelect2();
updateCalculations();
initializeRowCalculations(row);
});
$(document).on('click', '.remove-item', function() {
$(this).closest('tr').remove();
});
</script>

View File

@ -3,7 +3,7 @@
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="page-title-box page-title-box-alt"> <div class="page-title-box page-title-box-alt">
<h4 class="page-title">Product List </h4> <h4 class="page-title">Re-order Products List </h4>
<div class="page-title-right"> <div class="page-title-right">
<ol class="breadcrumb m-0"> <ol class="breadcrumb m-0">
@ -22,44 +22,34 @@
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100" <table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;">
style="width:100% !important;">
<thead> <thead>
<tr> <tr>
<th>Vendor Name</th>
<th>Product Name</th> <!-- <th>Vendor Name</th>
<th>Unit Price</th> <th>Unit Price</th> -->
<th>Qty in Stock</th> <th>Qty</th>
<th>Purchase Order Level</th> <!-- <th>Re-Order Level</th> -->
<th>Purchase Re-Order Level</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($reorder as $value) : <?php foreach ($reorder as $value) : ?>
?>
<tr> <tr>
<td hidden><?= $value['product_id']; ?></td>
<td><?= $value['product_name']; ?></td> <td><?= $value['prefered_vendor_name']; ?></td>
<td><?= $value['product_count']; ?></td>
<!-- <td><?= $value['prefered_vendor_name']; ?></td>
<td><?= number_format($value['unit_price']); ?></td> <td><?= number_format($value['unit_price']); ?></td>
<td><?= $value['qty_stock']; ?></td> <td><?= $value['qty_stock']; ?></td>
<td><?= $value['purchase_order_level']; ?></td> <td><?= $value['purchase_order_level']; ?></td> -->
<td><?= $value['reorder_level']; ?></td>
<td> <td>
<a href="<?= "rise_order/" . $value['product_id']; ?>" class="edit-button"><i class="ri-arrow-up-circle-fill"></i>Rise</a> <!-- <a href="<?= "rise_order/" . $value['product_id']; ?>" class="edit-button"><i class="ri-arrow-up-circle-fill"></i>Rise</a> -->
<a href="<?= "rise_order/" . $value['prefered_vendor']; ?>" class="edit-button"><i class="ri-arrow-up-circle-fill"></i>Rise</a>
</td> </td>
<!-- Call the model method -->
<td>
</td>
<?php endforeach; ?> <?php endforeach; ?>
</tr> </tr>

View File

@ -24,7 +24,7 @@
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="page-title-box page-title-box-alt"> <div class="page-title-box page-title-box-alt">
<h4 class="page-title">Return Order List </h4> <h4 class="page-title">Purchase Return List </h4>
<div class="page-title-right"> <div class="page-title-right">
<ol class="breadcrumb m-0"> <ol class="breadcrumb m-0">
<li class=""> <a href="<?= base_url() . "return_order_index"; ?>" class="btn btn-primary waves-effect"> <i class="ri-add-line"></i></a> <li class=""> <a href="<?= base_url() . "return_order_index"; ?>" class="btn btn-primary waves-effect"> <i class="ri-add-line"></i></a>
@ -54,7 +54,7 @@
<th>Order Date</th> <th>Order Date</th>
<th>Contact Person Details</th> <th>Contact Person Details</th>
<!-- <th>Contact Person Mobile</th> --> <!-- <th>Contact Person Mobile</th> -->
<th>Quantity</th> <th>Items</th>
<th>Status</th> <th>Status</th>
<th>Actions</th> <th>Actions</th>

View File

@ -149,7 +149,7 @@
</select> </select>
</td> </td>
<td style="width:5%;"> <td style="width:5%;">
<input type="number" class="form-control item-quantity" name="quantity[]" min="0" value="<?= isset($purchasechild['qty']) ? $purchasechild['qty'] : '' ?>"> <input type="number" class="form-control item-quantity" name="quantity[]" min="1" max="<?= isset($purchasechild['received_qty']) ? $purchasechild['received_qty'] : '' ?>" value="<?= isset($purchasechild['received_qty']) ? $purchasechild['received_qty'] : '' ?>">
</td> </td>
<td style="width:7%;"> <td style="width:7%;">
<input type="checkbox" class="form-control-check-input" name="return_selected_items[]" value="<?= $key; ?>"> <input type="checkbox" class="form-control-check-input" name="return_selected_items[]" value="<?= $key; ?>">

View File

@ -24,11 +24,10 @@
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="page-title-box page-title-box-alt"> <div class="page-title-box page-title-box-alt">
<h4 class="page-title">Return Order List </h4> <h4 class="page-title">Create Purchase Return Order </h4>
<div class="page-title-right"> <div class="page-title-right">
<ol class="breadcrumb m-0"> <ol class="breadcrumb m-0">
<!-- <li class=""> <a href="<?= base_url() . "new_return/0"; ?>" class="btn btn-primary waves-effect"> <i class="ri-add-line"></i></a> <a href="<?= base_url() . "return_order"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
</li> -->
</ol> </ol>
</div> </div>
</div> </div>
@ -53,8 +52,8 @@
<th>Vendor Name</th> <th>Vendor Name</th>
<th>Order Date</th> <th>Order Date</th>
<th>Contact Person Details</th> <th>Contact Person Details</th>
<th>Quantity</th> <th>Items</th>
<th>Received Items</th>
<th>Status</th> <th>Status</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
@ -70,6 +69,7 @@
<td><?= $value['contact_person_name']; ?><br> <td><?= $value['contact_person_name']; ?><br>
<?= $value['contact_person_mobile']; ?> <?= $value['contact_person_mobile']; ?>
<td><?= $value['product_count']; ?></td> <td><?= $value['product_count']; ?></td>
<td><?= $value['selected_product_count']; ?></td>
<td class="<?php <td class="<?php
if ($value['status'] == 'Cancel') { if ($value['status'] == 'Cancel') {
echo 'cancelled-status'; echo 'cancelled-status';
@ -85,7 +85,7 @@
<!-- Call the model method --> <!-- Call the model method -->
<td> <td>
<a href="<?= "new_return/" . $value['purchase_order_id']; ?>" class="edit-button" title="Return"><i class="ri-arrow-left-circle-fill" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="<?= "new_return/" . $value['purchase_order_id']; ?>" class="edit-button" title="Create Purchase Return"><i class="fa fa-plus-circle" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="<?= "delete_purchase/" . $value['purchase_order_id']; ?>" class="delete-button" title="Delete"><i class="ri-delete-bin-line" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="<?= "delete_purchase/" . $value['purchase_order_id']; ?>" class="delete-button" title="Delete"><i class="ri-delete-bin-line" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="<?= "download_purchase_invoice/" . $value['purchase_order_id']; ?>" class="edit-button" title="Download"><i class="ri-download-2-fill" style="font-size: 20px;"></i></a> <a href="<?= "download_purchase_invoice/" . $value['purchase_order_id']; ?>" class="edit-button" title="Download"><i class="ri-download-2-fill" style="font-size: 20px;"></i></a>
</td> </td>

View File

@ -55,7 +55,7 @@
<th>Reg No</th> <th>Reg No</th>
<th>Client Name</th> <th>Client Name</th>
<th>Quantity</th> <th>Items</th>
<th>Total</th> <th>Total</th>
<th>Status</th> <th>Status</th>

View File

@ -25,15 +25,18 @@
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label for="inputEmail4" class="col-form-label">Vehicle<span class="text-danger">*</span></label> <label for="inputEmail4" class="col-form-label">Vehicle<span
class="text-danger">*</span></label>
<?= isset($sales['vehicle_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addVehicleModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addVehicleModal" title="Add Client"></i>' ?> <?= isset($sales['vehicle_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addVehicleModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addVehicleModal" title="Add Client"></i>' ?>
<select class="form-control vehicle-select SelExample" name="vehicle_id" id="vehicle_id" <?= isset($sales['vehicle_id']) ? 'disabled' : 'required' ?>> <select class="form-control vehicle-select SelExample" name="vehicle_id" id="vehicle_id"
<?= isset($sales['vehicle_id']) ? 'disabled' : 'required' ?>>
<?= isset($sales['vehicle_id']) ? '' : '<option value="">Select a vehicle</option>' ?> <?= isset($sales['vehicle_id']) ? '' : '<option value="">Select a vehicle</option>' ?>
<?php foreach ($vehicle as $value) : ?> <?php foreach ($vehicle as $value) : ?>
<?php if ((int)$value["isactive"] === 1) : ?> <?php if ((int)$value["isactive"] === 1) : ?>
<option value="<?= $value["vehicle_id"] ?>" <?= isset($sales['vehicle_id']) && $sales['vehicle_id'] == $value["vehicle_id"] ? 'selected' : '' ?>> <option value="<?= $value["vehicle_id"] ?>"
<?= isset($sales['vehicle_id']) && $sales['vehicle_id'] == $value["vehicle_id"] ? 'selected' : '' ?>>
<?= $value["reg_no"]?> <?= $value["reg_no"]?>
</option> </option>
<?php endif; ?> <?php endif; ?>
@ -47,12 +50,17 @@
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="inputPassword4" class="col-form-label">Client Name<span class="text-danger"></span></label> <label for="inputPassword4" class="col-form-label">Client Name<span
<input type="text" class="form-control" name="client_id" placeholder="Client"value="<?= isset($sales['client_name']) ? $sales['client_name'] : '' ?>" readonly> class="text-danger"></span></label>
<input type="text" class="form-control" name="client_id" placeholder="Client"
value="<?= isset($sales['client_name']) ? $sales['client_name'] : '' ?>" readonly>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="inputPassword4" class="col-form-label">Mobile No<span class="text-danger">*</span></label> <label for="inputPassword4" class="col-form-label">Mobile No<span
<input type="text" class="form-control" name="mobile_no" placeholder="Mobile" value="<?= isset($sales['mobile_no']) ? $sales['mobile_no'] : '' ?>" maxlength="10" minlength="10" onkeypress = "return onlyNumbers(event)" readonly> class="text-danger">*</span></label>
<input type="text" class="form-control" name="mobile_no" placeholder="Mobile"
value="<?= isset($sales['mobile_no']) ? $sales['mobile_no'] : '' ?>" maxlength="10"
minlength="10" onkeypress="return onlyNumbers(event)" readonly>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="inputPassword4" class="col-form-label">Status<span class="text-danger">*</span> <label for="inputPassword4" class="col-form-label">Status<span class="text-danger">*</span>
@ -62,12 +70,16 @@
<select class="form-control status-select" name="status" required data-toggle="select2"> <select class="form-control status-select" name="status" required data-toggle="select2">
<?php if (isset($sales['status'])): ?> <?php if (isset($sales['status'])): ?>
<?php if ($sales['status'] === 'Cancelled'): ?> <?php if ($sales['status'] === 'Cancelled'): ?>
<option value="Created" <?= $sales['status'] === 'Created' ? 'selected' : '' ?>>Created </option> <option value="Created" <?= $sales['status'] === 'Created' ? 'selected' : '' ?>>Created </option>
<option value="Paid" <?= $sales['status'] === 'Paid' ? 'selected' : '' ?>>Paid</option> <option value="Paid" <?= $sales['status'] === 'Paid' ? 'selected' : '' ?>>Paid</option>
<?php else: ?> <?php else: ?>
<option>Select Status</option> <option>Select Status</option>
<option value="Paid" <?= $sales['status'] === 'Paid' ? 'selected' : '' ?>>Paid</option> <option value="Paid" <?= $sales['status'] === 'Paid' ? 'selected' : '' ?>>Paid</option>
<option value="Cancelled" <?= $sales['status'] === 'Cancelled' ? 'selected' : '' ?>>Cancelled</option> <option value="Cancelled" <?= $sales['status'] === 'Cancelled' ? 'selected' : '' ?>>Cancelled</option>
<?php endif; ?> <?php endif; ?>
<?php else: ?> <?php else: ?>
<option value="Created" selected>Created</option> <option value="Created" selected>Created</option>
@ -83,25 +95,35 @@
<h4 class="header-title">Billing Address Details :</h4><br> <h4 class="header-title">Billing Address Details :</h4><br>
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="inputPassword4" class="col-form-label">Address<span class="text-danger"></span></label> <label for="inputPassword4" class="col-form-label">Address<span
<input type="text" class="form-control" name="billing_address" placeholder="Address"value="<?= isset($sales['billing_address']) ? $sales['billing_address'] : '' ?>" > class="text-danger"></span></label>
<input type="text" class="form-control" name="billing_address" placeholder="Address"
value="<?= isset($sales['billing_address']) ? $sales['billing_address'] : '' ?>">
</div> </div>
<input type="hidden" id="sales_order_id" name="sales_order_id" value="<?= isset($sales['sales_order_id']) ? $sales['sales_order_id'] : '' ?>"readonly> <input type="hidden" id="sales_order_id" name="sales_order_id"
value="<?= isset($sales['sales_order_id']) ? $sales['sales_order_id'] : '' ?>" readonly>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="inputPassword4" class="col-form-label">City<span class="text-danger"></span></label> <label for="inputPassword4" class="col-form-label">City<span
<input type="text" class="form-control" name="city" placeholder="City"value="<?= isset($sales['billing_city']) ? $sales['billing_city'] : 'Chennai' ?>" > class="text-danger"></span></label>
<input type="text" class="form-control" name="city" placeholder="City"
value="<?= isset($sales['billing_city']) ? $sales['billing_city'] : 'Chennai' ?>">
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="inputPassword4" class="col-form-label">State<span class="text-danger"></span></label> <label for="inputPassword4" class="col-form-label">State<span
<input type="text" class="form-control" name="state" placeholder="State"value="<?= isset($sales['billing_state']) ? $sales['billing_state'] : 'Tamil Nadu' ?>" > class="text-danger"></span></label>
<input type="text" class="form-control" name="state" placeholder="State"
value="<?= isset($sales['billing_state']) ? $sales['billing_state'] : 'Tamil Nadu' ?>">
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="inputPassword4" class="col-form-label">Pin Code<span class="text-danger"></span></label> <label for="inputPassword4" class="col-form-label">Pin Code<span
<input type="text" class="form-control" name="postalcode" placeholder="Pin Code"value="<?= isset($sales['billing_postal_code']) ? $sales['billing_postal_code'] : '' ?>" maxlength="6" minlength="6" > class="text-danger"></span></label>
<input type="text" class="form-control" name="postalcode" placeholder="Pin Code"
value="<?= isset($sales['billing_postal_code']) ? $sales['billing_postal_code'] : '' ?>"
maxlength="6" minlength="6">
</div> </div>
@ -133,11 +155,13 @@
if ($salechild['isactive'] == 1) : ?> if ($salechild['isactive'] == 1) : ?>
<tr> <tr>
<td> <td>
<select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;"> <select class="form-control book-select SelExample" name="item_details[]"
required data-toggle="select2" id="" style="width: 249px !important;">
<option value="">Select a Product</option> <option value="">Select a Product</option>
<?php foreach ($product as $value) : ?> <?php foreach ($product as $value) : ?>
<?php if ((int)$value["isactive"] === 1) : ?> <?php if ((int)$value["isactive"] === 1) : ?>
<option value="<?= $value["product_id"] ?>" <?= isset($salechild['product_id']) && $salechild['product_id'] == $value["product_id"] ? 'selected' : '' ?>> <option value="<?= $value["product_id"] ?>"
<?= isset($salechild['product_id']) && $salechild['product_id'] == $value["product_id"] ? 'selected' : '' ?>>
<?= $value["product_name"]; ?> <?= $value["product_name"]; ?>
</option> </option>
<?php endif; ?> <?php endif; ?>
@ -145,13 +169,18 @@
</select> </select>
</td> </td>
<td style="width:10%;"> <td style="width:10%;">
<input type="number" class="form-control item-quantity" name="quantity[]" min="0" value="<?= isset($salechild['qty']) ? $salechild['qty'] : '1' ?>"> <input type="number" class="form-control item-quantity" name="quantity[]"
min="0"
value="<?= isset($salechild['qty']) ? $salechild['qty'] : '1' ?>">
</td> </td>
<td style="width:10%;"> <td style="width:10%;">
<input type="text" class="form-control item-rate" name="unit-price[]" readonly value="<?= isset($salechild['net_price']) ? $salechild['net_price'] : '' ?>"> <input type="text" class="form-control item-rate" name="unit-price[]"
readonly
value="<?= isset($salechild['net_price']) ? $salechild['net_price'] : '' ?>">
</td> </td>
<td style="width:10%;"> <td style="width:10%;">
<input type="text" class="form-control item-tax" name="item-tax[]" value="<?= isset($salechild['tax']) ? $salechild['tax'] : '' ?>"> <input type="text" class="form-control item-tax" name="item-tax[]"
value="<?= isset($salechild['tax']) ? $salechild['tax'] : '' ?>">
</td> </td>
<!-- <td style="width:12%;"> <!-- <td style="width:12%;">
<input type="number" class="form-control item-discount-amount" min="0" name="discount_amount[]" value="<?= isset($salechild['discount']) ? $salechild['discount'] : '' ?>"> <input type="number" class="form-control item-discount-amount" min="0" name="discount_amount[]" value="<?= isset($salechild['discount']) ? $salechild['discount'] : '' ?>">
@ -163,9 +192,12 @@
</select> </select>
</td> --> </td> -->
<td style="width:12%;"> <td style="width:12%;">
<input type="text" class="form-control item-amount" name="amount[]" value="<?= isset($salechild['amount']) ? $salechild['amount'] : '' ?>"> <input type="text" class="form-control item-amount" name="amount[]"
value="<?= isset($salechild['amount']) ? $salechild['amount'] : '' ?>">
</td> </td>
<td hidden><input type="hidden" value="<?= isset($salechild['sales_order_product_id']) ? $salechild['sales_order_product_id'] : '' ?>"name="sales_order_product_id[]"></td> <td hidden><input type="hidden"
value="<?= isset($salechild['sales_order_product_id']) ? $salechild['sales_order_product_id'] : '' ?>"
name="sales_order_product_id[]"></td>
<td style="width:12%;"> <td style="width:12%;">
<center><i class="fa fa-trash remove-item"></i></center> <center><i class="fa fa-trash remove-item"></i></center>
</td> </td>
@ -192,12 +224,14 @@
<h4>Calculation</h4> <h4>Calculation</h4>
<div class="form-group"> <div class="form-group">
<label for="subtotal">Subtotal</label> <label for="subtotal">Subtotal</label>
<input type="text" class="form-control" id="subtotal" name="sub_total" value="<?= isset($sales['subtotal']) ? $sales['subtotal'] : '' ?>"readonly > <input type="text" class="form-control" id="subtotal" name="sub_total"
value="<?= isset($sales['subtotal']) ? $sales['subtotal'] : '' ?>" readonly>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="invoicetax">Tax Amount<span id=""></span></label> <label for="invoicetax">Tax Amount<span id=""></span></label>
<input type="text" class="form-control" id="invoicetax" name="invoice_tax" readonly value="<?= isset($sales['tax']) ? $sales['tax'] : '' ?>"> <input type="text" class="form-control" id="invoicetax" name="invoice_tax" readonly
value="<?= isset($sales['tax']) ? $sales['tax'] : '' ?>">
</div> </div>
@ -209,7 +243,8 @@
</div> --> </div> -->
<div class="form-group"> <div class="form-group">
<label for="grandtotal">Total</label> <label for="grandtotal">Total</label>
<input type="text" class="form-control" id="grandtotal" name="grand_total" readonly value="<?= isset($sales['total']) ? $sales['total'] : '' ?>"> <input type="text" class="form-control" id="grandtotal" name="grand_total" readonly
value="<?= isset($sales['total']) ? $sales['total'] : '' ?>">
</div> </div>
@ -222,9 +257,7 @@
<label for="inputPassword4" class="col-form-label">Terms & Condition</label> <label for="inputPassword4" class="col-form-label">Terms & Condition</label>
<textarea class="form-control" name="terms_condition" placeholder="Terms & Condition" > <textarea class="form-control" name="terms_condition" placeholder="Terms & Condition"><?= isset($sales['terms_condition']) ? $sales['terms_condition'] : 'Please check the products properly before purchase. Products once sold cannot be returned.' ?></textarea>
<?= isset($sales['terms_condition']) ? $sales['terms_condition'] : 'Please check the products properly before purchase. Products once sold cannot be returned.' ?>
</textarea>
</div> </div>
</div> </div>
@ -239,7 +272,8 @@
</div> </div>
<?php include('layout/footer.php'); ?> <?php include('layout/footer.php'); ?>
</div> </div>
<div class="modal fade" id="addVehicleModal" tabindex="-1" role="dialog" aria-labelledby="addVehicleModalLabel" aria-hidden="true"> <div class="modal fade" id="addVehicleModal" tabindex="-1" role="dialog" aria-labelledby="addVehicleModalLabel"
aria-hidden="true">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -255,11 +289,13 @@
<!-- <div class="form-group"> --> <!-- <div class="form-group"> -->
<label for="inputPassword4" class="col-form-label">Make</label> <label for="inputPassword4" class="col-form-label">Make</label>
<select class="form-control SelExample" name="make" id="make" <?= isset($vehicle['make']) ? '' : 'required' ?>> <select class="form-control SelExample" name="make" id="make"
<?= isset($vehicle['make']) ? '' : 'required' ?>>
<?= isset($vehicle['make']) ? '' : '<option value="">Select a Make</option>' ?> <?= isset($vehicle['make']) ? '' : '<option value="">Select a Make</option>' ?>
<?php foreach ($makeData as $value) : ?> <?php foreach ($makeData as $value) : ?>
<?php if ((int)$value["isactive"] === 1) : ?> <?php if ((int)$value["isactive"] === 1) : ?>
<option value="<?= $value["make_id"] ?>" <?= isset($vehicle['make']) && $vehicle['make'] == $value["make_id"] ? 'selected' : '' ?>> <option value="<?= $value["make_id"] ?>"
<?= isset($vehicle['make']) && $vehicle['make'] == $value["make_id"] ? 'selected' : '' ?>>
<?= $value["make"]; ?> <?= $value["make"]; ?>
</option> </option>
<?php endif; ?> <?php endif; ?>
@ -269,7 +305,8 @@
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label for="inputPassword4" class="col-form-label">Model</label> <label for="inputPassword4" class="col-form-label">Model</label>
<select class="form-control SelExample" name="model" id="model" <?= isset($vehicle['model']) ? '' : 'required' ?>> <select class="form-control SelExample" name="model" id="model"
<?= isset($vehicle['model']) ? '' : 'required' ?>>
<?php if (isset($vehicle["model_name"])) : ?> <?php if (isset($vehicle["model_name"])) : ?>
<option value="<?= $vehicle["model"] ?>"> <option value="<?= $vehicle["model"] ?>">
<?= $vehicle["model_name"]; ?> <?= $vehicle["model_name"]; ?>
@ -282,7 +319,8 @@
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<label for="inputPassword4" class="col-form-label">Reg Number</label> <label for="inputPassword4" class="col-form-label">Reg Number</label>
<input type="text" class="form-control" name="reg_no" id="reg_no" placeholder="Reg Number"value="<?= isset($vehicle['reg_no']) ? $vehicle['reg_no'] : '' ?>" required> <input type="text" class="form-control" name="reg_no" id="reg_no" placeholder="Reg Number"
value="<?= isset($vehicle['reg_no']) ? $vehicle['reg_no'] : '' ?>" required>
</div> </div>
</div> </div>
@ -305,7 +343,8 @@
<div class="form-group col-md-12 select"> <div class="form-group col-md-12 select">
<label for="clientMobile">Mobile</label> <label for="clientMobile">Mobile</label>
<input type="text" class="form-control" id="clientMobile" placeholder="Enter mobile number" maxlength="10" minlength="10"onkeypress = "return onlyNumbers(event)"required> <input type="text" class="form-control" id="clientMobile" placeholder="Enter mobile number"
maxlength="10" minlength="10" onkeypress="return onlyNumbers(event)" required>
</div> </div>
@ -314,12 +353,15 @@
<div class="form-group col-md-12 create" style="display:none;"> <div class="form-group col-md-12 create" style="display:none;">
<label for="create-clientName">Client Name</label> <label for="create-clientName">Client Name</label>
<i type="button" class="fe-user-check" id="selectClient" style="font-size: 18px;"></i> <i type="button" class="fe-user-check" id="selectClient" style="font-size: 18px;"></i>
<input type="text" class="form-control" id="create-clientName" placeholder="Enter client name" required> <input type="text" class="form-control" id="create-clientName"
placeholder="Enter client name" required>
</div> </div>
<div class="form-group col-md-6 create" style="display:none;"> <div class="form-group col-md-6 create" style="display:none;">
<label for="create-clientMobile">Mobile</label> <label for="create-clientMobile">Mobile</label>
<input type="text" class="form-control" id="create-clientMobile" placeholder="Enter mobile number" maxlength="10" minlength="10"onkeypress = "return onlyNumbers(event)"required> <input type="text" class="form-control" id="create-clientMobile"
placeholder="Enter mobile number" maxlength="10" minlength="10"
onkeypress="return onlyNumbers(event)" required>
</div> </div>
<div class="form-group col-md-6 create" style="display:none;"> <div class="form-group col-md-6 create" style="display:none;">
@ -346,7 +388,6 @@
<script> <script>
productarray = []; productarray = [];
$(document).ready(function() { $(document).ready(function() {
// Function to fetch make and model information based on make and model IDs // Function to fetch make and model information based on make and model IDs
@ -473,6 +514,7 @@ $(document).ready(function() {
// Event listener for product selection // Event listener for product selection
$(document).on('change', 'select[name="item_details[]"]', function() { $(document).on('change', 'select[name="item_details[]"]', function() {
var productId = $(this).val(); var productId = $(this).val();
var quantity = $(this).closest('tr').find('.item-quantity').val(1); var quantity = $(this).closest('tr').find('.item-quantity').val(1);
@ -481,6 +523,9 @@ $(document).ready(function() {
return item.product_id == productId; return item.product_id == productId;
}); });
$(this).closest('tr').find('.item-quantity').attr('max', product.qty_stock);
// Access unit price from product and set it as rate // Access unit price from product and set it as rate
var unitPrice = parseFloat(product.unit_price); // Convert to float if necessary var unitPrice = parseFloat(product.unit_price); // Convert to float if necessary
$(this).closest('tr').find('.item-rate').val(unitPrice); $(this).closest('tr').find('.item-rate').val(unitPrice);
@ -573,16 +618,17 @@ $(document).ready(function() {
// Event listener for "Add More Item" button // Event listener for "Add More Item" button
$('#addItem').click(function() { $('#addItem').click(function() {
console.log(productarray); console.log(productarray);
var newRow = '<tr>' + '<td><select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Product</option>'; var newRow = '<tr>' +
'<td><select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Product</option>';
for (var i = 0; i < productarray.length; i++) for (var i = 0; i < productarray.length; i++) {
{
var product = productarray[i]; var product = productarray[i];
newRow += '<option value="' + product.product_id + '">' + product.product_name + '</option>'; newRow += '<option value="' + product.product_id + '" >' + product.product_name +
'</option>';
} }
newRow += '</select></td>' + newRow += '</select></td>' +
'<td style="width:10%;"><input type="number" class="form-control item-quantity" min="0" name="quantity[]"/></td>' + '<td style="width:10%;"><input type="number" class="form-control item-quantity" min="0" max="" name="quantity[]"/></td>' +
'<td style="width:10%;"><input type="text" class="form-control item-rate" name="unit-price[]" readonly /></td>' + '<td style="width:10%;"><input type="text" class="form-control item-rate" name="unit-price[]" readonly /></td>' +
'<td style="width:8%;"><input type="text" class="form-control item-tax" name="item-tax[]" readonly /></td>' + '<td style="width:8%;"><input type="text" class="form-control item-tax" name="item-tax[]" readonly /></td>' +
'<td style="width:12%;"><input type="text" class="form-control item-amount" name="amount[]"/></td>' + '<td style="width:12%;"><input type="text" class="form-control item-amount" name="amount[]"/></td>' +
@ -609,8 +655,6 @@ function initializeRowCalculations(row) {
calculateAmount(row); calculateAmount(row);
updateCalculations(); updateCalculations();
} }
</script> </script>
<script> <script>
// Event listener for removing item // Event listener for removing item
@ -622,7 +666,9 @@ $(document).on('click', '.remove-item', function() {
$.ajax({ $.ajax({
url: '<?php echo base_url()."delete_sales_product"?>', url: '<?php echo base_url()."delete_sales_product"?>',
method: 'POST', method: 'POST',
data: { sales_order_product_id: salesOrderProductId }, data: {
sales_order_product_id: salesOrderProductId
},
success: function(response) { success: function(response) {
// Check if the deletion was successful // Check if the deletion was successful
if (response.success) { if (response.success) {
@ -663,7 +709,6 @@ $(document).ready(function() {
} }
}); });
}); });
</script> </script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
@ -709,6 +754,7 @@ $(document).ready(function(){
// Initialize select2 // Initialize select2
$(".SelExample").select2(); $(".SelExample").select2();
}); });
function initializeSelect2() { function initializeSelect2() {
$('.SelExample').select2({ $('.SelExample').select2({
width: '249px' // Adjust width as needed width: '249px' // Adjust width as needed
@ -735,11 +781,12 @@ $(document).ready(function() {
var createclientMobile = $('#create-clientMobile').val(); var createclientMobile = $('#create-clientMobile').val();
var createclientType = $('#create-clientType').val(); var createclientType = $('#create-clientType').val();
if (formType == 'select') if (formType == 'select') {
{ var ifStatementCondition =
var ifStatementCondition = "clientName !== '' && clientMobile !== '' && reg_no !== '' && model !== '' && make !== ''"; "clientName !== '' && clientMobile !== '' && reg_no !== '' && model !== '' && make !== ''";
} else { } else {
var ifStatementCondition = "createclientName !== '' && createclientMobile !== '' && createclientType !== '' && reg_no !== '' && model !== '' && make !== ''"; var ifStatementCondition =
"createclientName !== '' && createclientMobile !== '' && createclientType !== '' && reg_no !== '' && model !== '' && make !== ''";
} }
console.log(ifStatementCondition); console.log(ifStatementCondition);
@ -785,7 +832,6 @@ $(document).ready(function() {
}); });
}); });
</script> </script>
<script> <script>
$(".SelExample").select2(); $(".SelExample").select2();
@ -798,14 +844,17 @@ $.ajax({
url: '<?= base_url("fetch_models") ?>', // URL to your controller method for fetching models url: '<?= base_url("fetch_models") ?>', // URL to your controller method for fetching models
type: 'POST', type: 'POST',
dataType: 'json', dataType: 'json',
data: { selected_makes: [selected_makes] }, data: {
selected_makes: [selected_makes]
},
success: function(response) { success: function(response) {
// Clear existing options in model select dropdown // Clear existing options in model select dropdown
$("#model").empty(); $("#model").empty();
$("#model").append('<option value=""> Select a Model </option>'); $("#model").append('<option value=""> Select a Model </option>');
// Populate model select dropdown with fetched models // Populate model select dropdown with fetched models
$.each(response, function(index, model) { $.each(response, function(index, model) {
$("#model").append('<option value="' + model.model_id + '">' + model.model_name + '</option>'); $("#model").append('<option value="' + model.model_id + '">' + model
.model_name + '</option>');
}); });
// Refresh select2 to reflect changes // Refresh select2 to reflect changes
@ -821,8 +870,6 @@ document.getElementById('reg_no').addEventListener('input', function(event) {
var inputText = event.target.value; var inputText = event.target.value;
event.target.value = inputText.toUpperCase(); event.target.value = inputText.toUpperCase();
}); });
</script> </script>
<script> <script>
@ -856,13 +903,16 @@ document.getElementById('reg_no').addEventListener('input', function(event) {
color: #ffffff; color: #ffffff;
background: #526dee !important; background: #526dee !important;
} }
.select2-container .select2-selection--single { .select2-container .select2-selection--single {
height: 36px; height: 36px;
border: 1px solid #ced4da; border: 1px solid #ced4da;
} }
.select2-container--default .select2-selection--single .select2-selection__rendered { .select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: 36px; line-height: 36px;
} }
.select2-container--default .select2-selection--single .select2-selection__arrow { .select2-container--default .select2-selection--single .select2-selection__arrow {
top: 4px; top: 4px;
} }

View File

@ -31,8 +31,7 @@
<tr> <tr>
<th>Reg No</th> <th>Reg No</th>
<th>Make & Model</th> <th>Make & Model</th>
<th>Manf Year</th> <th>Year of Manf</th>
<th>Colour</th>
<th>Client Name</th> <th>Client Name</th>
<th>Mobile</th> <th>Mobile</th>
<th>Actions</th> <th>Actions</th>
@ -48,12 +47,11 @@
<td><?= $value['reg_no']; ?></td> <td><?= $value['reg_no']; ?></td>
<td><?= $value['make_name'].' '.$value['model_name']; ?></td> <td><?= $value['make_name'].' '.$value['model_name']; ?></td>
<td><?= $value['year_of_manufacturing']; ?></td> <td><?= $value['year_of_manufacturing']; ?></td>
<td><?= $value['colour']; ?></td>
<td><?= $value['client_name']; ?></td> <td><?= $value['client_name']; ?></td>
<td><?= $value['mobile_no']; ?></td> <td><?= $value['mobile_no']; ?></td>
<td> <td>
<a href="<?= "new_vehicle/" . $value['vehicle_id']; ?>" class="edit-button"><i class="ri-pencil-line"></i></a> <a href="<?= "new_vehicle/" . $value['vehicle_id']; ?>" class="edit-button"><i class="ri-pencil-line" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="<?= "delete_vehicle/" . $value['vehicle_id']; ?>" class="delete-button"><i class="ri-delete-bin-line"></i></a> <a href="<?= "delete_vehicle/" . $value['vehicle_id']; ?>" class="delete-button"><i class="ri-delete-bin-line" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td> </td>
<?php endif?> <?php endif?>

87
index.php Normal file
View File

@ -0,0 +1,87 @@
<?php
// Check PHP version.
$minPhpVersion = '7.4'; // If you update this, don't forget to update `spark`.
if (version_compare(PHP_VERSION, $minPhpVersion, '<')) {
$message = sprintf(
'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s',
$minPhpVersion,
PHP_VERSION
);
exit($message);
}
// Path to the front controller (this file)
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR);
// Ensure the current directory is pointing to the front controller's directory
if (getcwd() . DIRECTORY_SEPARATOR !== FCPATH) {
chdir(FCPATH);
}
/*
*---------------------------------------------------------------
* BOOTSTRAP THE APPLICATION
*---------------------------------------------------------------
* This process sets up the path constants, loads and registers
* our autoloader, along with Composer's, loads our constants
* and fires up an environment-specific bootstrapping.
*/
// Load our paths config file
// This is the line that might need to be changed, depending on your folder structure.
require FCPATH . '/app/Config/Paths.php';
// ^^^ Change this line if you move your application folder
$paths = new Config\Paths();
// Location of the framework bootstrap file.
require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php';
// Load environment settings from .env files into $_SERVER and $_ENV
require_once SYSTEMPATH . 'Config/DotEnv.php';
(new CodeIgniter\Config\DotEnv(ROOTPATH))->load();
// Define ENVIRONMENT
if (! defined('ENVIRONMENT')) {
define('ENVIRONMENT', env('CI_ENVIRONMENT', 'production'));
}
// Load Config Cache
// $factoriesCache = new \CodeIgniter\Cache\FactoriesCache();
// $factoriesCache->load('config');
// ^^^ Uncomment these lines if you want to use Config Caching.
/*
* ---------------------------------------------------------------
* GRAB OUR CODEIGNITER INSTANCE
* ---------------------------------------------------------------
*
* The CodeIgniter class contains the core functionality to make
* the application run, and does all the dirty work to get
* the pieces all working together.
*/
$app = Config\Services::codeigniter();
$app->initialize();
$context = is_cli() ? 'php-cli' : 'web';
$app->setContext($context);
/*
*---------------------------------------------------------------
* LAUNCH THE APPLICATION
*---------------------------------------------------------------
* Now that everything is set up, it's time to actually fire
* up the engines and make this app do its thang.
*/
$app->run();
// Save Config Cache
// $factoriesCache->save('config');
// ^^^ Uncomment this line if you want to use Config Caching.
// Exits the application, setting the exit code for CLI-based applications
// that might be watching.
exit(EXIT_SUCCESS);

View File

@ -45,34 +45,35 @@ class ClassLoader
/** @var \Closure(string):void */ /** @var \Closure(string):void */
private static $includeFile; private static $includeFile;
/** @var string|null */ /** @var ?string */
private $vendorDir; private $vendorDir;
// PSR-4 // PSR-4
/** /**
* @var array<string, array<string, int>> * @var array[]
* @psalm-var array<string, array<string, int>>
*/ */
private $prefixLengthsPsr4 = array(); private $prefixLengthsPsr4 = array();
/** /**
* @var array<string, list<string>> * @var array[]
* @psalm-var array<string, array<int, string>>
*/ */
private $prefixDirsPsr4 = array(); private $prefixDirsPsr4 = array();
/** /**
* @var list<string> * @var array[]
* @psalm-var array<string, string>
*/ */
private $fallbackDirsPsr4 = array(); private $fallbackDirsPsr4 = array();
// PSR-0 // PSR-0
/** /**
* List of PSR-0 prefixes * @var array[]
* * @psalm-var array<string, array<string, string[]>>
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
*
* @var array<string, array<string, list<string>>>
*/ */
private $prefixesPsr0 = array(); private $prefixesPsr0 = array();
/** /**
* @var list<string> * @var array[]
* @psalm-var array<string, string>
*/ */
private $fallbackDirsPsr0 = array(); private $fallbackDirsPsr0 = array();
@ -80,7 +81,8 @@ class ClassLoader
private $useIncludePath = false; private $useIncludePath = false;
/** /**
* @var array<string, string> * @var string[]
* @psalm-var array<string, string>
*/ */
private $classMap = array(); private $classMap = array();
@ -88,20 +90,21 @@ class ClassLoader
private $classMapAuthoritative = false; private $classMapAuthoritative = false;
/** /**
* @var array<string, bool> * @var bool[]
* @psalm-var array<string, bool>
*/ */
private $missingClasses = array(); private $missingClasses = array();
/** @var string|null */ /** @var ?string */
private $apcuPrefix; private $apcuPrefix;
/** /**
* @var array<string, self> * @var self[]
*/ */
private static $registeredLoaders = array(); private static $registeredLoaders = array();
/** /**
* @param string|null $vendorDir * @param ?string $vendorDir
*/ */
public function __construct($vendorDir = null) public function __construct($vendorDir = null)
{ {
@ -110,7 +113,7 @@ class ClassLoader
} }
/** /**
* @return array<string, list<string>> * @return string[]
*/ */
public function getPrefixes() public function getPrefixes()
{ {
@ -122,7 +125,8 @@ class ClassLoader
} }
/** /**
* @return array<string, list<string>> * @return array[]
* @psalm-return array<string, array<int, string>>
*/ */
public function getPrefixesPsr4() public function getPrefixesPsr4()
{ {
@ -130,7 +134,8 @@ class ClassLoader
} }
/** /**
* @return list<string> * @return array[]
* @psalm-return array<string, string>
*/ */
public function getFallbackDirs() public function getFallbackDirs()
{ {
@ -138,7 +143,8 @@ class ClassLoader
} }
/** /**
* @return list<string> * @return array[]
* @psalm-return array<string, string>
*/ */
public function getFallbackDirsPsr4() public function getFallbackDirsPsr4()
{ {
@ -146,7 +152,8 @@ class ClassLoader
} }
/** /**
* @return array<string, string> Array of classname => path * @return string[] Array of classname => path
* @psalm-return array<string, string>
*/ */
public function getClassMap() public function getClassMap()
{ {
@ -154,7 +161,8 @@ class ClassLoader
} }
/** /**
* @param array<string, string> $classMap Class to filename map * @param string[] $classMap Class to filename map
* @psalm-param array<string, string> $classMap
* *
* @return void * @return void
*/ */
@ -172,24 +180,23 @@ class ClassLoader
* appending or prepending to the ones previously set for this prefix. * appending or prepending to the ones previously set for this prefix.
* *
* @param string $prefix The prefix * @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 root directories * @param string[]|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories * @param bool $prepend Whether to prepend the directories
* *
* @return void * @return void
*/ */
public function add($prefix, $paths, $prepend = false) public function add($prefix, $paths, $prepend = false)
{ {
$paths = (array) $paths;
if (!$prefix) { if (!$prefix) {
if ($prepend) { if ($prepend) {
$this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0 = array_merge(
$paths, (array) $paths,
$this->fallbackDirsPsr0 $this->fallbackDirsPsr0
); );
} else { } else {
$this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0, $this->fallbackDirsPsr0,
$paths (array) $paths
); );
} }
@ -198,19 +205,19 @@ class ClassLoader
$first = $prefix[0]; $first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) { if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = $paths; $this->prefixesPsr0[$first][$prefix] = (array) $paths;
return; return;
} }
if ($prepend) { if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix] = array_merge(
$paths, (array) $paths,
$this->prefixesPsr0[$first][$prefix] $this->prefixesPsr0[$first][$prefix]
); );
} else { } else {
$this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix], $this->prefixesPsr0[$first][$prefix],
$paths (array) $paths
); );
} }
} }
@ -220,7 +227,7 @@ class ClassLoader
* appending or prepending to the ones previously set for this namespace. * appending or prepending to the ones previously set for this namespace.
* *
* @param string $prefix The prefix/namespace, with trailing '\\' * @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories * @param string[]|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories * @param bool $prepend Whether to prepend the directories
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
@ -229,18 +236,17 @@ class ClassLoader
*/ */
public function addPsr4($prefix, $paths, $prepend = false) public function addPsr4($prefix, $paths, $prepend = false)
{ {
$paths = (array) $paths;
if (!$prefix) { if (!$prefix) {
// Register directories for the root namespace. // Register directories for the root namespace.
if ($prepend) { if ($prepend) {
$this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4 = array_merge(
$paths, (array) $paths,
$this->fallbackDirsPsr4 $this->fallbackDirsPsr4
); );
} else { } else {
$this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4, $this->fallbackDirsPsr4,
$paths (array) $paths
); );
} }
} elseif (!isset($this->prefixDirsPsr4[$prefix])) { } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
@ -250,18 +256,18 @@ class ClassLoader
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
} }
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = $paths; $this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) { } elseif ($prepend) {
// Prepend directories for an already registered namespace. // Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix] = array_merge(
$paths, (array) $paths,
$this->prefixDirsPsr4[$prefix] $this->prefixDirsPsr4[$prefix]
); );
} else { } else {
// Append directories for an already registered namespace. // Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix], $this->prefixDirsPsr4[$prefix],
$paths (array) $paths
); );
} }
} }
@ -271,7 +277,7 @@ class ClassLoader
* replacing any others previously set for this prefix. * replacing any others previously set for this prefix.
* *
* @param string $prefix The prefix * @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 base directories * @param string[]|string $paths The PSR-0 base directories
* *
* @return void * @return void
*/ */
@ -289,7 +295,7 @@ class ClassLoader
* replacing any others previously set for this namespace. * replacing any others previously set for this namespace.
* *
* @param string $prefix The prefix/namespace, with trailing '\\' * @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories * @param string[]|string $paths The PSR-4 base directories
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* *
@ -475,9 +481,9 @@ class ClassLoader
} }
/** /**
* Returns the currently registered loaders keyed by their corresponding vendor directories. * Returns the currently registered loaders indexed by their corresponding vendor directories.
* *
* @return array<string, self> * @return self[]
*/ */
public static function getRegisteredLoaders() public static function getRegisteredLoaders()
{ {

View File

@ -3,7 +3,7 @@
'name' => 'codeigniter4/framework', 'name' => 'codeigniter4/framework',
'pretty_version' => 'dev-main', 'pretty_version' => 'dev-main',
'version' => 'dev-main', 'version' => 'dev-main',
'reference' => '61daab30b3008141deb7b9c58dc792e9799011e7', 'reference' => 'a6d5ae227f80d0f293a23092015a3ef9d9b572e4',
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
@ -22,7 +22,7 @@
'codeigniter4/framework' => array( 'codeigniter4/framework' => array(
'pretty_version' => 'dev-main', 'pretty_version' => 'dev-main',
'version' => 'dev-main', 'version' => 'dev-main',
'reference' => '61daab30b3008141deb7b9c58dc792e9799011e7', 'reference' => 'a6d5ae227f80d0f293a23092015a3ef9d9b572e4',
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),