FIX_validation in all modules for release today : GWM

This commit is contained in:
bitbucket 2024-04-18 16:45:01 +05:30
parent c39e293484
commit 655bc5bb5a
24 changed files with 741 additions and 625 deletions

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'))
@ -40,6 +41,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'] = [];
@ -109,6 +111,7 @@ class Purchase extends BaseController
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 +135,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)) {
@ -211,9 +211,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 +229,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 +261,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('');

View File

@ -22,18 +22,21 @@ 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();
$reorder = $productModel->select('products.*, vendor.vendor_name as prefered_vendor_name')
->join('vendor', 'vendor.vendor_id = products.prefered_vendor')
->where('products.qty_stock <= purchase_order_level')
->findAll();
// print_r($reorder);die;
$data['reorder']=$reorder;
// echo "<pre>";
// print_r($data);die;
return view('reorder_level_list',$data);
}
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();

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";
@ -90,7 +92,7 @@ class ReturnOrder extends BaseController
$PurchaseOrderChildModel = new PurchaseOrderChildModel();
$purchase_product=$PurchaseOrderChildModel->where('purchase_order_id', $purchase_order_id)->findAll();
$data['purchase_product']=$purchase_product;
$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();
@ -294,7 +297,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

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

@ -42,7 +42,7 @@
<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" required>
<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>
@ -52,7 +52,7 @@
<div class="form-group col-md-6">
<label for="inputState" class="col-form-label">Business</label>
<select id="business" class="form-control" name="business" required>
<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>
@ -61,7 +61,7 @@
</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" required>
<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>

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

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

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>
@ -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>
@ -208,9 +208,7 @@
<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>

View File

@ -72,16 +72,16 @@
<?= $value['contact_person_mobile']; ?>
<td><?= $value['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 -->

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,32 @@
<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>Vendor 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>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><?= number_format($value['unit_price']); ?></td>
<td><?= $value['qty_stock']; ?></td>
<td><?= $value['purchase_order_level']; ?></td>
<td><?= $value['reorder_level']; ?></td>
<td>
<a href="<?= "rise_order/" . $value['product_id']; ?>" 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['qty']) ? $purchasechild['qty'] : '' ?>" value="<?= isset($purchasechild['qty']) ? $purchasechild['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,7 +52,7 @@
<th>Vendor Name</th>
<th>Order Date</th>
<th>Contact Person Details</th>
<th>Quantity</th>
<th>Items</th>
<th>Status</th>
<th>Actions</th>
@ -85,7 +84,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>

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