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/
*/
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.
@ -57,7 +57,8 @@ class App extends BaseConfig
*
* 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("delete_purchase_product", "Purchase::delete_purchase_product");
$routes->get("download_purchase_invoice/(:any)", "Purchase::download_purchase_invoice/$1");
$routes->get("reorder_purchase/(:any)", "Purchase::reorder_purchase/$1");
// Reorder Level//
$routes->get('reorder_level_index', 'Reorderlevel::reorder_level_index');
$routes->get('rise_order/(:any)', 'Reorderlevel::rise_order/$1');

View File

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

View File

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

View File

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

View File

@ -21,6 +21,7 @@ class Purchase extends BaseController
public function purchase_index()
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$PurchaseOrderModel = new PurchaseOrderModel();
// $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'));
// echo "<pre>";
// print_r($product);die;
// echo json_encode($purchase);die;
$data['purchase']=$purchase;
// echo "<pre>";
@ -40,6 +43,7 @@ class Purchase extends BaseController
public function new_purchase($purchase_order_id)
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
if ($purchase_order_id === '0') {
$data['purchase'] = [];
@ -107,8 +111,92 @@ class Purchase extends BaseController
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()
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$PurchaseOrderModel = new PurchaseOrderModel();
$ProductModel = new ProductModel();
$PurchaseOrderChildModel = new PurchaseOrderChildModel();
@ -132,10 +220,7 @@ class Purchase extends BaseController
'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');
// echo $purchase_order_id;die;
if (!empty($purchase_order_id)) {
@ -184,7 +269,8 @@ class Purchase extends BaseController
$child_data = [
'purchase_order_id' => $purchase_order_id,
'product_id' => $product_id,
'qty' => $qty,
// 'qty' => $qty,
// 'received_qty' => $qty,
// 'discount' => $discount,
// 'discount_type' => $discount_type,
'net_price'=>$rate,
@ -193,6 +279,14 @@ class Purchase extends BaseController
'is_selected'=>$selected_item,
'isactive'=>1,
];
if($status == 'Received') {
$child_data['received_qty'] = $qty;
}
else{
$child_data['qty'] = $qty;
}
// print_r($child_data);die;
if (!empty($purchase_order_child_id[$key])) {
@ -211,9 +305,11 @@ class Purchase extends BaseController
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
$product = $ProductModel->find($product_id);
$current_qty = $product['qty_stock'];
@ -227,6 +323,7 @@ class Purchase extends BaseController
public function delete_purchase($purchase_order_id)
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$PurchaseOrderModel = new PurchaseOrderModel();
$where = ['purchase_order_id' => $purchase_order_id, 'isactive' => 1 ]; // Assuming 'isactive' is a column in your database
$existingPurchase = $PurchaseOrderModel->where($where)->first();
@ -258,7 +355,8 @@ class Purchase extends BaseController
return json_encode($products);
}
public function getVendorProducts()
public function getVendorProducts()
{
// Retrieve make_id and model_id from the request
// $makeId = $this->request->getPost('');
@ -372,4 +470,5 @@ public function download_purchase_invoice($purchase_order_id)
// Output the PDF to the browser for download
$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()
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$productModel = new ProductModel();
$reorder = $productModel->where('qty_stock <= purchase_order_level')->findAll();
// print_r($reorder);die;
$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')
->where('products.qty_stock <= purchase_order_level')
->groupBy('products.prefered_vendor')
->findAll();
// echo json_encode($reorder);die;
$data['reorder']=$reorder;
// echo "<pre>";
// print_r($data);die;
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";
$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;
// echo "<pre>";
// 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();
$vendor=$VendorModel->where('vendor_id',$vendorid)->findAll();
$data['vendor']=$vendor;

View File

@ -16,6 +16,7 @@ use App\Models\PurchaseOrderModel;
class ReturnOrder extends BaseController
{
public $session;
protected $returnModel;
public function __construct()
{
$this->session = session();
@ -24,24 +25,24 @@ class ReturnOrder extends BaseController
public function return_order_index()
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$PurchaseOrderModel = new PurchaseOrderModel();
$purchase = $PurchaseOrderModel->getPurchaseOrdersWithProducts($this->session->get('logged_user_branch_id'));
// echo "<pre>";
// print_r($product);die;
$data['purchase']=$purchase;
$return = $this->returnModel->findAll();
$data['return']=$return;
// echo "<pre>";
// print_r($data);die;
return view('return_order_liist',$data);
}
public function return_order()
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$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')
@ -61,6 +62,7 @@ class ReturnOrder extends BaseController
}
public function new_return($purchase_order_id)
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$data['page_name']="Create Return Order";
@ -89,8 +91,8 @@ class ReturnOrder extends BaseController
$PurchaseOrderChildModel = new PurchaseOrderChildModel();
$purchase_product=$PurchaseOrderChildModel->where('purchase_order_id', $purchase_order_id)->findAll();
$data['purchase_product']=$purchase_product;
$purchase_product=$PurchaseOrderChildModel->where('purchase_order_id', $purchase_order_id)->where('received_qty >', 0)->where('is_selected', 1)->findAll();
$data['purchase_product'] = $purchase_product;
echo view('return_order_form',$data);
@ -98,6 +100,7 @@ class ReturnOrder extends BaseController
public function add_return_purchase()
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$ProductModel = new ProductModel();
@ -129,6 +132,7 @@ class ReturnOrder extends BaseController
$ReturnModel = new ReturnModel();
$ReturnOrderChildModel = new ReturnOrderChildModel();
$PurchaseOrderChildModel = new PurchaseOrderChildModel();
$return = $ReturnModel->where('return_order_id', $return_order_id)->first();
@ -140,6 +144,14 @@ class ReturnOrder extends BaseController
$quantity =$this->request->getPost('quantity');
$item_details =$this->request->getPost('item_details');
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();
$changed_quantity = $product['qty_stock'] - $quantity[$index];
$product_id = $item_detail;
@ -154,7 +166,7 @@ class ReturnOrder extends BaseController
$return_order_id = $this->request->getPost('return_order_id');
// echo $this->request->getPost('return_order_id');die;
if (!empty($return_order_id)) {
$this->returnModel->update($return_order_id, $data);
@ -294,7 +306,7 @@ class ReturnOrder extends BaseController
return $this->response->setJSON(['product'=>$product] );
} else {
// 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()

View File

@ -13,6 +13,8 @@ use Mpdf\Mpdf;
class Sales extends BaseController
{
public $session;
protected $BikemodelsModel;
protected $BikemakeModel;
public function __construct()
{
@ -24,11 +26,11 @@ class Sales extends BaseController
public function sales_order_index()
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$SalesOrderModel = new SalesOrderModel();
$sales=$SalesOrderModel->getSalesOrdersWithProducts($this->session->get('logged_user_branch_id'));
$data['sales']=$sales;
// print_r($sales);die;
return view('sales_list',$data);
}
@ -36,7 +38,7 @@ class Sales extends BaseController
public function new_sale($sales_order_id)
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
if ($sales_order_id === '0') {
$data['page_name']="Create Sales Order";
$data['sales'] = [];
@ -48,7 +50,7 @@ class Sales extends BaseController
$vehicle = $VehicleModel->getCustomerandVehicle($this->session->get('logged_user_branch_id'));
// ->where('isactive',1)
// ->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
// print_r($vehicle);die;
$ProductModel = new ProductModel();
$product=$ProductModel
->where('isactive',1)
@ -66,42 +68,42 @@ class Sales extends BaseController
$data['page_name']="Edit Sale Order";
$ClientModel = new ClientModel();
$client=$ClientModel->where('isactive',1)->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
$SalesOrderModel = new SalesOrderModel();
$sales=$SalesOrderModel->where('sales_order_id', $sales_order_id)->get()->getRowArray();
$data['sales']=$sales;
$SalesOrderModel = new SalesOrderModel();
$sales=$SalesOrderModel->where('sales_order_id', $sales_order_id)->get()->getRowArray();
$data['sales']=$sales;
$VehicleModel = new VehicleModel();
$vehicles = $VehicleModel->where('isactive',1)->where('vehicle_id',$sales['vehicle_id'])
->where('branch_id',$this->session->get('logged_user_branch_id'))
->first();
$makeId = $vehicles['make'];
$modelId = $vehicles['model'];
$VehicleModel = new VehicleModel();
$vehicles = $VehicleModel->where('isactive',1)->where('vehicle_id',$sales['vehicle_id'])
->where('branch_id',$this->session->get('logged_user_branch_id'))
->first();
$makeId = $vehicles['make'];
$modelId = $vehicles['model'];
// Encode the modelId before searching
$encodedModelId = json_encode([$modelId]);
// Encode the modelId before searching
$encodedModelId = json_encode([$modelId]);
// Load the ProductModel
$productModel = new ProductModel();
// Load the ProductModel
$productModel = new ProductModel();
// Query the database to find the product based on make_id and model_id
$product = $productModel->where('make_id', $makeId)
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
->findAll();
$data['product']=$product;
$SalesProductOrderModel = new SalesOrderProductModel();
$sales_product=$SalesProductOrderModel->where('sales_order_id', $sales_order_id)->findAll();
$data['sales_product']=$sales_product;
$data['client']=$client;
// print_r($sales_product);die;
$VehicleModel = new VehicleModel();
$vehicle=$VehicleModel
->where('isactive',1)
->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
$data['vehicle']=$vehicle;
// Query the database to find the product based on make_id and model_id
$product = $productModel->where('make_id', $makeId)
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
->findAll();
$data['product']=$product;
$SalesProductOrderModel = new SalesOrderProductModel();
$sales_product=$SalesProductOrderModel->where('sales_order_id', $sales_order_id)->findAll();
$data['sales_product']=$sales_product;
$data['client']=$client;
$VehicleModel = new VehicleModel();
$vehicle=$VehicleModel
->where('isactive',1)
->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
$data['vehicle']=$vehicle;
}
// print_r($data);die;
$data['sales_order_id'] = $sales_order_id;
$bikeMakeModel = new BikeMakeModel();
$data['makeData'] =$bikeMakeModel->findAll();
@ -109,8 +111,9 @@ $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();
$ProductModel = new ProductModel();
$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
'branch_id'=> $this->session->get('logged_user_branch_id'),
];
// print_r($data);die;
// Insert or update sales order
$sales_order_id = $this->request->getPost('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
}
$orderNumber = 'SO' . str_pad($sales_order_id, 8, '0', STR_PAD_LEFT);
// print_r($orderNumber);die;
// Update sales order with generated order number
$SalesOrderModel->update($sales_order_id, ['order_number' => $orderNumber]);
// print_r();die;
// Prepare data for sales order product
$product_ids = $this->request->getPost('item_details');
$quantities = $this->request->getPost('quantity');
@ -158,10 +161,10 @@ $VehicleModel = new VehicleModel();
$itemtax=$this->request->getPost('item-tax');
$unitprice=$this->request->getPost('unit-price');
$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) {
$qty = isset($quantities[$key]) ? $quantities[$key] : 0;
if ($status == 'Created') {
@ -212,6 +215,7 @@ $status = $this->request->getPost('status');
private function addBackProductQuantity($ProductModel, $product_id, $sold_qty)
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
// Fetch current product quantity
$product = $ProductModel->find($product_id);
$current_qty = $product['qty_stock'];
@ -224,6 +228,7 @@ private function addBackProductQuantity($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
$product = $ProductModel->find($product_id);
$current_qty = $product['qty_stock'];
@ -237,6 +242,7 @@ private function updateProductQuantity($ProductModel, $product_id, $sold_qty)
public function delete_sales_product()
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$sales_order_product_id = $this->request->getPost('sales_order_product_id');
if (!empty($sales_order_product_id)) {
@ -256,6 +262,7 @@ public function delete_sales_product()
public function delete_sale($sales_order_id)
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
$model = new SalesOrderModel();
$where = ['sales_order_id' => $sales_order_id, 'isactive' => 1]; // Assuming 'isactive' is a column in your database
$existingProduct = $model->where($where)->first();
@ -272,9 +279,11 @@ public function delete_sales_product()
return redirect()->to('sales_order_index');
}
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
$model = new SalesOrderModel();
$data = $model->getSalesPdf($sales_order_id);
@ -282,12 +291,7 @@ public function delete_sales_product()
$items = $model->getSalesOrderProductsForPdf($sales_order_id);
// print_r($items);die();
// print_r($invoiceItems);die();
// Create an mPDF object
$mpdf = new Mpdf([
'mode' => '',
'format' => 'A5',
@ -332,7 +336,7 @@ public function delete_sales_product()
// Generate the PDF content (HTML) with data
$html = view('invoice_pdf_template', ['sales' => $data,'items'=>$items]);
// echo $html;die;
// Load HTML into the mPDF instance
$mpdf->WriteHTML($html);
@ -342,6 +346,7 @@ public function delete_sales_product()
public function save_vehicle(){
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
// Load ClientModel
$VehicleModel = new VehicleModel();
@ -415,6 +420,7 @@ public function get_vehicle_products(){
public function getProducts()
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
// Retrieve make_id and model_id from the request
$makeId = $this->request->getPost('make_id');
$modelId = $this->request->getPost('model_id');
@ -428,6 +434,7 @@ public function getProducts()
// Query the database to find the product based on make_id and model_id
$product = $productModel->where('make_id', $makeId)
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
->where('qty_stock >',0)
->findAll();
$modelName = $this->BikemodelsModel->where('model_id',$modelId)->get()->getRow()->model_name;
@ -442,4 +449,4 @@ public function getProducts()
}
// Check if product exists
}
}

View File

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

View File

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

View File

@ -5,7 +5,7 @@ class ProductModel extends Model
{
protected $table = 'products';
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()

View File

@ -5,7 +5,7 @@ class PurchaseOrderChildModel extends Model
{
protected $table = 'purchase_order_child';
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
$this->where('purchase_order_child.isactive', 1);
$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');
// Get the results
return $this->findAll();

View File

@ -32,12 +32,7 @@
<th>Client Name</th>
<th>Mobile</th>
<th>Email</th>
<th>Address</th>
<th>City</th>
<th>State</th>
<th>Country</th>
<th>Pin Code</th>
<th>Email</th>
<th>Actions</th>
</tr>
@ -51,14 +46,9 @@
<td><?= $value['client_name']; ?></td>
<td><?= $value['mobile_no']; ?></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>
<a href="<?= "new_client/" . $value['client_id']; ?>" class="edit-button"><i class="ri-pencil-line"></i></a>
<a href="<?= "delete_client/" . $value['client_id']; ?>" class="delete-button"><i class="ri-delete-bin-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" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td>
<?php endif?>

View File

@ -44,6 +44,38 @@
</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> <!-- end card -->

View File

@ -124,7 +124,7 @@
<tr>
<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>
<?php foreach ($product as $value) : ?>
<?php if ((int)$value["isactive"] === 1) : ?>
@ -136,7 +136,7 @@
</select>
</td>
<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>

View File

@ -38,33 +38,33 @@
<!-- 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 -->
<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 -->
<script src="<?php echo base_url(); ?>/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(); ?>/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(); ?>/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(); ?>/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(); ?>/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(); ?>/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(); ?>/assets/libs/pdfmake/build/vfs_fonts.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(); ?>public/assets/libs/datatables.net-bs4/js/dataTables.bootstrap4.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(); ?>public/assets/libs/datatables.net-responsive-bs4/js/responsive.bootstrap4.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(); ?>public/assets/libs/datatables.net-buttons-bs4/js/buttons.bootstrap4.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(); ?>public/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.print.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(); ?>public/assets/libs/datatables.net-select/js/dataTables.select.min.js"></script>
<script src="<?php echo base_url(); ?>public/assets/libs/pdfmake/build/pdfmake.min.js"></script>
<script src="<?php echo base_url(); ?>public/assets/libs/pdfmake/build/vfs_fonts.js"></script>
<!-- third party js ends -->
<!-- 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 -->
<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 http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- 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 -->
<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()?>/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()?>/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-bs4/css/dataTables.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()?>public/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-select-bs4/css//select.bootstrap4.min.css" rel="stylesheet" type="text/css" />
<!-- third party css end -->
<!-- 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()?>/assets/css/app-modern.min.css" rel="stylesheet" type="text/css" id="app-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()?>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()?>/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/bootstrap-modern-dark.min.css" rel="stylesheet" type="text/css" id="bs-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 -->
<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>
/* Override toastr font color */
.toast-warning {
@ -58,21 +58,21 @@
<div class="logo-box">
<a href="index.html" class="logo logo-dark text-center">
<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>
<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>
</a>
<a href="index.html" class="logo logo-light text-center">
<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 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>
</a>
</div>
@ -111,9 +111,9 @@
<li>
<a href="<?php echo base_url('sales_order_index') ?>">Sales Order</a>
</li>
<li>
<!-- <li>
<a href="<?php echo base_url('job_card_index') ?>">Job Card</a>
</li>
</li> -->
<li>
<a href="<?php echo base_url('vehicle_index') ?>">Vehicles</a>
</li>
@ -145,7 +145,7 @@
<a href="<?php echo base_url('return_order') ?>"> Purchase Return</a>
</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>
<a href="<?php echo base_url('vendor_index') ?>">Vendor</a>
@ -174,9 +174,9 @@
<li>
<a href="<?php echo base_url('product_index') ?>">Products</a>
</li>
<li>
<!-- <li>
<a href="<?php echo base_url('service_index') ?>">Services</a>
</li>
</li> -->
</ul>
</div>
</li>
@ -200,11 +200,7 @@
<!-- </a> -->
</li>
<li>
<a href="<?php echo base_url('index') ?>">
<i class="fas fa-user"></i>
<span> Users</span>
</a>
</li>
<a href="<?php echo base_url('index') ?>"><i class="fas fa-user"></i><span> Users</span></a></li>
<?php } ?>
@ -311,21 +307,21 @@
<div class="logo-box">
<a class="logo logo-dark text-center">
<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>
<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>
</a>
<a class="logo logo-light text-center">
<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 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>
</a>
</div>

View File

@ -8,17 +8,17 @@
<meta content="Coderthemes" name="author" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- 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 -->
<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()?>assets/css/app-modern.min.css" rel="stylesheet" type="text/css" id="app-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()?>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()?>assets/css/app-modern-dark.min.css" rel="stylesheet" type="text/css" id="app-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()?>public/assets/css/app-modern-dark.min.css" rel="stylesheet" type="text/css" id="app-dark-stylesheet" />
<!-- 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>
@ -36,7 +36,7 @@
<div class="auth-logo">
<a class="logo text-center">
<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>
</a>
@ -92,10 +92,10 @@
</footer>
<!-- 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 -->
<script src="<?php base_url()?>assets/js/app.min.js"></script>
<script src="<?php base_url()?>public/assets/js/app.min.js"></script>
</body>
</html>

View File

@ -107,17 +107,79 @@
</select>
</div>
<div class="form-group col-md-4">
<label for="inputEmail4" class="col-form-label">Product Category<span class="text-danger"></span></label>
<input type="text" class="form-control" name="productcategory" placeholder="Product Category" value="<?= isset($products['product_category']) ? $products['product_category'] : '' ?>" >
<div class="form-group col-md-3">
<label for="inputEmail4" class="col-form-label">HSN/SAC<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'] : '' ?>" >
</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>
<input type="text" class="form-control" name="rack_number" placeholder="Rack Number" value="<?= isset($products['rack_number']) ? $products['rack_number'] : '' ?>" >
</div>
</div>
</div>
<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>
<div class="form-row">
@ -339,10 +401,10 @@ document.addEventListener('DOMContentLoaded', function() {
// Listen for the keyup event on qty in stock input
qtyInStockInput.addEventListener('keyup', function() {
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
purchaseOrderLevelInput.value = isNaN(purchaseorderLevel) ? '' : purchaseorderLevel;
purchaseOrderLevelInput.value = isNaN(purchaseOrderLevel) ? '' : purchaseOrderLevel;
purchaseReorderLevelInput.value = isNaN(qtyInStock) ? '' : qtyInStock;
});
});

View File

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

View File

@ -41,7 +41,7 @@
<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>
<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 class="form-group col-md-4">
<label for="contact_person_mobile" class="col-form-label">Contact Person Mobile<span class="text-danger">*</span></label>
@ -63,7 +63,7 @@
(<?= $purchase['status'] ?>)
<?php endif; ?></label>
<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'): ?>
<option value="">Select Status</option>
<option value="Received" <?= $purchase['status'] === 'Received' ? 'selected' : '' ?>>Received</option>
@ -83,7 +83,7 @@
</div>
<h4 class="header-title">Billing Addresss :</h4><br>
<div class="form-row">
<div class="form-group col-md-3">
<label for="billing_address" class="col-form-label">Billing Addresss<span class="text-danger">*</span></label>
@ -103,7 +103,7 @@
</div>
</div><br>
<h4 class="header-title">Shipping Addresss :</h4><br>
<div class="form-row">
<div class="form-group col-md-3">
<label for="shipping_address" class="col-form-label">Shipping Addresss<span class="text-danger">*</span></label>
@ -134,16 +134,15 @@
<div class="form-group col-md-12">
<h4>Item Details</h4>
<br />
<table class="table table-bordered" id="itemTable">
<thead>
<tr>
<th>Item Details</th>
<th>Qty</th>
<?php if (!empty($purchase["status"])): ?>
<th>Received</th>
<th>Amount</th>
<?php endif; ?>
<?php if (!empty($purchase["status"]) && !isset($reorder)): ?>
<th>Received</th>
<th>Amount</th>
<?php endif; ?>
<th hidden></th>
<th></th>
</tr>
@ -169,15 +168,17 @@
</select>
</td>
<td style="width:5%;">
<input type="number" class="form-control item-quantity" name="quantity[]" min="0" value="<?= isset($purchasechild['qty']) ? $purchasechild['qty'] : '' ?>">
</td>
<td style="width:2%;">
<input type="hidden" name="selected_items[]" value="<?= ($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' : ''; ?> >
</td>
<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="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>
<?php if(!isset($reorder)) { ?>
<td style="width:2%;">
<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 (isset($purchasechild['is_selected']) && $purchasechild['is_selected'] == 1) ? 'checked' : ''; ?> >
</td>
<td style="width:5%;">
<input type="number" class="form-control item-quantity" name="amount[]" value="<?= isset($purchasechild['amount']) ? $purchasechild['amount'] : '' ?>">
</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 style="width:5%;">
<center><i class="fa fa-trash remove-item"></i></center>
@ -189,7 +190,7 @@
<!-- You can add more rows as needed using JavaScript -->
</tbody>
</table>
<?php if (empty($purchase["status"])): ?>
<?php if (empty($purchase["status"]) || isset($reorder)): ?>
<div class="form-group text-right m-b-0">
<!-- Show the "Add More Item" button only if invoice_type is not 1 -->
<a class="btn" id="addItem">
@ -208,13 +209,11 @@
<label for="inputPassword4" class="col-form-label">Terms & Condition</label>
<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>
<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>
</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>
<?php endif; ?>

View File

@ -54,8 +54,8 @@
<th>Order Date</th>
<th>Contact Person Details</th>
<!-- <th>Contact Person Mobile</th> -->
<th>Quantity</th>
<th>Items</th>
<th>Received Items</th>
<th>Status</th>
<th>Actions</th>
</tr>
@ -71,23 +71,27 @@
<td><?= $value['contact_person_name']; ?><br>
<?= $value['contact_person_mobile']; ?>
<td><?= $value['product_count']; ?></td>
<td><?= $value['selected_product_count']; ?></td>
<td class="<?php
if ($value['status'] == 'Cancel') {
echo 'cancelled-status';
} elseif ($value['status'] == 'Draft') {
echo 'created-status';
} elseif ($value['status'] == 'Received') {
echo 'paid-status';
}
?>">
<?= $value['status']; ?>
</td>
if ($value['status'] == 'Cancel') {
echo 'cancelled-status';
} elseif ($value['status'] == 'Draft') {
echo 'created-status';
} elseif ($value['status'] == 'Received') {
echo 'paid-status';
}
?>">
<?= $value['status']; ?>
</td>
<!-- Call the model method -->
<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="<?= "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>
</td>

View File

@ -111,35 +111,34 @@
</tr>
</thead>
<tbody>
<?php if (isset($products) && !empty($products)) : ?>
<?php if (isset($products) && !empty($products)) :
foreach ($products as $product) { ?>
<tr>
<td style="width:10%;">
<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="<?= $products["product_id"] ?>" <?= isset($products['product_id']) ? 'selected' : '' ?>>
<?= $products["product_name"]; ?>
<option value="<?= $product["product_id"] ?>" <?= isset($product['product_id']) ? 'selected' : '' ?>>
<?= $product["product_name"]; ?>
</option>
</select>
</td>
<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 style="width:5%;">
<center><i class="fa fa-trash remove-item"></i></center>
<center><i class="fa fa-trash"></i></center>
</td>
</tr>
<?php endif; ?>
<?php } endif; ?>
<!-- You can add more rows as needed using JavaScript -->
</tbody>
</table>
<?php if (empty($purchase["status"])): ?>
<div class="form-group text-right m-b-0">
<!-- Show the "Add More Item" button only if invoice_type is not 1 -->
<a class="btn" id="addItem">
<h4><i class="fa fa-plus" aria-hidden="true"></i> Add Product</h4>
</a>
</div>
<?php endif; ?>
</div>
</div>
<h4 class="header-title">Terms & Condition :</h4><br>
@ -160,7 +159,39 @@
</div>
</div>
</div>
<input type="hidden" id="pr_data" value="<?= htmlspecialchars(json_encode($product_data)); ?>">
<?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="col-12">
<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">
<ol class="breadcrumb m-0">
@ -22,44 +22,34 @@
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100"
style="width:100% !important;">
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;">
<thead>
<tr>
<th>Product Name</th>
<th>Unit Price</th>
<th>Qty in Stock</th>
<th>Purchase Order Level</th>
<th>Purchase Re-Order Level</th>
<th>Actions</th>
<th>Vendor Name</th>
<!-- <th>Vendor Name</th>
<th>Unit Price</th> -->
<th>Qty</th>
<!-- <th>Re-Order Level</th> -->
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($reorder as $value) :
?>
<?php foreach ($reorder as $value) : ?>
<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><?= $value['qty_stock']; ?></td>
<td><?= $value['purchase_order_level']; ?></td>
<td><?= $value['reorder_level']; ?></td>
<td><?= $value['purchase_order_level']; ?></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>
<!-- Call the model method -->
<td>
</td>
<?php endforeach; ?>
</tr>

View File

@ -24,7 +24,7 @@
<div class="row">
<div class="col-12">
<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">
<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>
@ -54,7 +54,7 @@
<th>Order Date</th>
<th>Contact Person Details</th>
<!-- <th>Contact Person Mobile</th> -->
<th>Quantity</th>
<th>Items</th>
<th>Status</th>
<th>Actions</th>

View File

@ -149,7 +149,7 @@
</select>
</td>
<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 style="width:7%;">
<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="col-12">
<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">
<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>
</li> -->
<a href="<?= base_url() . "return_order"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
</ol>
</div>
</div>
@ -53,8 +52,8 @@
<th>Vendor Name</th>
<th>Order Date</th>
<th>Contact Person Details</th>
<th>Quantity</th>
<th>Items</th>
<th>Received Items</th>
<th>Status</th>
<th>Actions</th>
</tr>
@ -70,6 +69,7 @@
<td><?= $value['contact_person_name']; ?><br>
<?= $value['contact_person_mobile']; ?>
<td><?= $value['product_count']; ?></td>
<td><?= $value['selected_product_count']; ?></td>
<td class="<?php
if ($value['status'] == 'Cancel') {
echo 'cancelled-status';
@ -85,7 +85,7 @@
<!-- Call the model method -->
<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="<?= "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>

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -31,8 +31,7 @@
<tr>
<th>Reg No</th>
<th>Make & Model</th>
<th>Manf Year</th>
<th>Colour</th>
<th>Year of Manf</th>
<th>Client Name</th>
<th>Mobile</th>
<th>Actions</th>
@ -48,12 +47,11 @@
<td><?= $value['reg_no']; ?></td>
<td><?= $value['make_name'].' '.$value['model_name']; ?></td>
<td><?= $value['year_of_manufacturing']; ?></td>
<td><?= $value['colour']; ?></td>
<td><?= $value['client_name']; ?></td>
<td><?= $value['mobile_no']; ?></td>
<td>
<a href="<?= "new_vehicle/" . $value['vehicle_id']; ?>" class="edit-button"><i class="ri-pencil-line"></i></a>
<a href="<?= "delete_vehicle/" . $value['vehicle_id']; ?>" class="delete-button"><i class="ri-delete-bin-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" style="font-size: 20px;"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td>
<?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 */
private static $includeFile;
/** @var string|null */
/** @var ?string */
private $vendorDir;
// PSR-4
/**
* @var array<string, array<string, int>>
* @var array[]
* @psalm-var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array();
/**
* @var array<string, list<string>>
* @var array[]
* @psalm-var array<string, array<int, string>>
*/
private $prefixDirsPsr4 = array();
/**
* @var list<string>
* @var array[]
* @psalm-var array<string, string>
*/
private $fallbackDirsPsr4 = array();
// PSR-0
/**
* List of PSR-0 prefixes
*
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
*
* @var array<string, array<string, list<string>>>
* @var array[]
* @psalm-var array<string, array<string, string[]>>
*/
private $prefixesPsr0 = array();
/**
* @var list<string>
* @var array[]
* @psalm-var array<string, string>
*/
private $fallbackDirsPsr0 = array();
@ -80,7 +81,8 @@ class ClassLoader
private $useIncludePath = false;
/**
* @var array<string, string>
* @var string[]
* @psalm-var array<string, string>
*/
private $classMap = array();
@ -88,20 +90,21 @@ class ClassLoader
private $classMapAuthoritative = false;
/**
* @var array<string, bool>
* @var bool[]
* @psalm-var array<string, bool>
*/
private $missingClasses = array();
/** @var string|null */
/** @var ?string */
private $apcuPrefix;
/**
* @var array<string, self>
* @var self[]
*/
private static $registeredLoaders = array();
/**
* @param string|null $vendorDir
* @param ?string $vendorDir
*/
public function __construct($vendorDir = null)
{
@ -110,7 +113,7 @@ class ClassLoader
}
/**
* @return array<string, list<string>>
* @return string[]
*/
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()
{
@ -130,7 +134,8 @@ class ClassLoader
}
/**
* @return list<string>
* @return array[]
* @psalm-return array<string, string>
*/
public function getFallbackDirs()
{
@ -138,7 +143,8 @@ class ClassLoader
}
/**
* @return list<string>
* @return array[]
* @psalm-return array<string, string>
*/
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()
{
@ -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
*/
@ -171,25 +179,24 @@ class ClassLoader
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*
* @return void
*/
public function add($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
$paths,
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
$paths
(array) $paths
);
}
@ -198,19 +205,19 @@ class ClassLoader
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = $paths;
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$paths,
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
$paths
(array) $paths
);
}
}
@ -219,9 +226,9 @@ class ClassLoader
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*
@ -229,18 +236,17 @@ class ClassLoader
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
$paths,
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
$paths
(array) $paths
);
}
} 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.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = $paths;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$paths,
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
$paths
(array) $paths
);
}
}
@ -270,8 +276,8 @@ class ClassLoader
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 base directories
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 base directories
*
* @return void
*/
@ -288,8 +294,8 @@ class ClassLoader
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
*
* @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()
{

View File

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