diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 87df898..e90b0d0 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -141,6 +141,8 @@ $routes->get('dashboard', 'Users::dashboard'); // Model // $routes->get('bike_model_index/(:any)', 'Model::index/$1'); $routes->post('create_model', 'Model::create_model'); + $routes->get('delete_model/(:any)', 'Model::delete_model/$1'); + // $routes->post('create_model/(:any)', 'Model::create_model/$1'); $routes->post('status_model', 'Model::status_model'); // Model End's// diff --git a/app/Controllers/Branch.php b/app/Controllers/Branch.php index c34cf07..ca3167d 100644 --- a/app/Controllers/Branch.php +++ b/app/Controllers/Branch.php @@ -118,12 +118,13 @@ class Branch extends BaseController { if ($branch_id) { $data = $this->request->getPost(); + // echo "
";
+ // print_r($data);die;
$BranchModel = new BranchModel();
// print_r($data);die;
$BranchModel->update($branch_id,$data);
-
- return view('dashboard');
+ return redirect()->to('get_branch_edit_form/'.session()->get("logged_user_branch_id"));
}
}
diff --git a/app/Controllers/Business.php b/app/Controllers/Business.php
index 41e59fa..98fe182 100644
--- a/app/Controllers/Business.php
+++ b/app/Controllers/Business.php
@@ -31,9 +31,9 @@ class Business extends BaseController
} else if ($business_id !== '0') {
$BusinessModel = new BusinessModel();
- $business=$BusinessModel->getBusinessById($business_id);
- $data['business']=$business;
- $data['page_name']="Edit Business" ;
+ $business=$BusinessModel->getBusinessById($business_id);
+ $data['business']=$business;
+ $data['page_name']="Edit Business" ;
}
$data['business_id'] = $business_id;
@@ -68,18 +68,8 @@ class Business extends BaseController
$data = [
'business_name' => $this->request->getPost('businessname'),
- 'email' => $this->request->getPost('email'),
- 'address' => $this->request->getPost('address'),
- 'gstno' => $this->request->getPost('gstno'),
- 'mobile' => $this->request->getPost('mobile'),
- 'city' => $this->request->getPost('city'),
- 'state' => $this->request->getPost('state'),
- 'code' => $this->request->getPost('code'),
- 'postal_code' => $this->request->getPost('postalcode'),
- 'country' => $this->request->getPost('country'),
'isactive' => 1 // Assuming this is a default value or handled separately
];
- // print_r($data);die;
$business_id = $this->request->getPost('business_id');
@@ -92,8 +82,15 @@ class Business extends BaseController
$BusinessModel->insert($data);
}
+ // echo"";
+ // print_r(session()->get("logged_user_business_id"));die;
+
+ if (session()->get('logged_user_role') == "Administrator") {
+ return redirect()->to('new_business/'.session()->get("logged_user_business_id"));
+ }else{
+ return redirect()->to('business_index');
+ }
- return redirect()->to('business_index');
}
public function delete_business($business_id)
{
diff --git a/app/Controllers/Make.php b/app/Controllers/Make.php
index 243ecf1..116a822 100644
--- a/app/Controllers/Make.php
+++ b/app/Controllers/Make.php
@@ -24,7 +24,7 @@ class Make extends BaseController
{
$BikemakeModel = new BikemakeModel();
- $make = $BikemakeModel->findAll();
+ $make = $BikemakeModel->orderBy('make')->findAll();
$data['make']=$make;
return view('make_list',$data);
diff --git a/app/Controllers/Model.php b/app/Controllers/Model.php
index 925c18b..c6646c6 100644
--- a/app/Controllers/Model.php
+++ b/app/Controllers/Model.php
@@ -33,7 +33,7 @@ class Model extends BaseController
$make_name= $make_value[0]['make'];
$make_id= $make_value[0]['make_id'];
- $model = $BikemodelsModel->where('make_id',$make_id)->findAll();
+ $model = $BikemodelsModel->orderBy('model_name')->where('make_id',$make_id)->findAll();
$data['model']=$model;
$data['make_name'] =$make_name;
$data['make_id'] =$make_id;
@@ -41,6 +41,23 @@ class Model extends BaseController
return view('bike_model_list',$data);
}
+ public function delete_model($model_id){
+
+ $BikemodelsModel = new BikemodelsModel();
+
+ $model = $BikemodelsModel->where('model_id',$model_id)->first();
+
+ if ($model) {
+ $delete_done = $BikemodelsModel->where('model_id',$model_id)->delete();
+
+ if($delete_done){
+ return json_encode("delete_done");
+ }
+ }else{
+
+ }
+
+ }
public function create_model()
{
diff --git a/app/Controllers/Reorderlevel.php b/app/Controllers/Reorderlevel.php
index 657a787..20a1462 100644
--- a/app/Controllers/Reorderlevel.php
+++ b/app/Controllers/Reorderlevel.php
@@ -29,6 +29,7 @@ class Reorderlevel extends BaseController
->join('vendor', 'vendor.vendor_id = products.prefered_vendor')
->where('products.qty_stock <= purchase_order_level')
->groupBy('products.prefered_vendor')
+ ->orderBy('prefered_vendor_name', 'ASC')
->findAll();
// echo json_encode($reorder);die;
$data['reorder']=$reorder;
diff --git a/app/Controllers/Sales.php b/app/Controllers/Sales.php
index 991eaa1..544a93c 100644
--- a/app/Controllers/Sales.php
+++ b/app/Controllers/Sales.php
@@ -302,6 +302,7 @@ public function delete_sales_product()
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
// Fetch the invoice data based on $invoice_id
$model = new SalesOrderModel();
+ $saleOrderCount = count($model->where('status','Paid')->findAll());
$VehicleModel = new VehicleModel();
$BranchModel = new BranchModel();
$BusinessModel = new BusinessModel();
@@ -309,7 +310,6 @@ public function delete_sales_product()
$BikemakeModel = new BikemakeModel();
$data = $model->getSalesPdf($sales_order_id);
$bus_id = $this->session->get('logged_user_business_id');
- $company_address = $BusinessModel->where('business_id', $bus_id)->where('isactive', 1)->findAll();
$branch = $BranchModel->where('branch_id', $data[0]->branch_id)->first();
$business = $BusinessModel->where('business_id', $branch['business_id'])->first();
$vehicle = $VehicleModel->where('vehicle_id',$data[0]->vehicle_id)->first();
@@ -355,7 +355,7 @@ public function delete_sales_product()
// return view('invoice_pdf_template', ['sales' => $data,'items'=>$items, 'business' => $business , 'vehicle' => $vehicle,'bike_model'=>$bike_model,'bike_make'=>$bike_make]);
// Generate the PDF content (HTML) with data
- $html = view('invoice_pdf_template', ['sales' => $data,'company_address'=>$company_address,'items'=>$items, 'business' => $business , 'vehicle' => $vehicle,'bike_model'=>$bike_model,'bike_make'=>$bike_make]);
+ $html = view('invoice_pdf_template', ['sales' => $data,'saleOrderCount' => $saleOrderCount,'items'=>$items,'branch'=>$branch, 'business' => $business , 'vehicle' => $vehicle,'bike_model'=>$bike_model,'bike_make'=>$bike_make]);
// echo $html;die;
// Load HTML into the mPDF instance
$mpdf->WriteHTML($html);
diff --git a/app/Controllers/Vendor.php b/app/Controllers/Vendor.php
index 3c0d244..19f2edc 100644
--- a/app/Controllers/Vendor.php
+++ b/app/Controllers/Vendor.php
@@ -26,7 +26,7 @@ class Vendor extends BaseController
{
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();
+ $vendor = $VendorModel->where('branch_id',$this->session->get('logged_user_branch_id'))->orderBy('vendor_name')->findAll();
$data['vendor']=$vendor;
return view('vendor_list',$data);
diff --git a/app/Models/BranchModel.php b/app/Models/BranchModel.php
index 1372756..1b364aa 100644
--- a/app/Models/BranchModel.php
+++ b/app/Models/BranchModel.php
@@ -5,7 +5,7 @@ class BranchModel extends Model
{
protected $table = 'branches';
protected $primaryKey = 'branch_id';
- protected $allowedFields = ['business_id','branch_id','','branch_name','email','mobile_no','address','city','state','postal_code','country','isactive'];
+ protected $allowedFields = ['business_id','branch_id','branch_name','gstno','email','contact_1','contact_2','address','city','state','country','postal_code','state_code','isactive'];
public function getBranchesByBusinessId($business_id)
{
diff --git a/app/Models/BusinessModel.php b/app/Models/BusinessModel.php
index 9c35a56..9f8b865 100644
--- a/app/Models/BusinessModel.php
+++ b/app/Models/BusinessModel.php
@@ -5,7 +5,7 @@ class BusinessModel extends Model
{
protected $table = 'business';
protected $primaryKey = 'business_id';
- protected $allowedFields = ['business_id','business_unique_id','branch_unique_id','business_name','email','mobile','address', 'gstno','city','state', 'code','postal_code','country','isactive'];
+ protected $allowedFields = ['business_id','business_unique_id','branch_unique_id','business_name','isactive'];
public function getBusinessById($business_id) {
return $this->db->table('business')->where('business_id', $business_id)->get()->getRowArray();
diff --git a/app/Models/SalesOrderModel.php b/app/Models/SalesOrderModel.php
index f14cf82..17884d1 100644
--- a/app/Models/SalesOrderModel.php
+++ b/app/Models/SalesOrderModel.php
@@ -13,7 +13,7 @@ class SalesOrderModel extends Model
->join('branches as B','B.branch_id = sales_order.branch_id','left')
->select('sales_order.*')
- ->select('B.branch_name ,B.address as company_address,B.city as company_city,B.state as company_state,B.postal_code as company_postal_code,B.mobile_no as company_mobile_no')
+ ->select('B.branch_name ,B.address as company_address,B.city as company_city,B.state as company_state,B.postal_code as company_postal_code,B.contact_1 as company_mobile_no_1,B.contact_2 as company_mobile_no_2')
->get()
->getResult();
diff --git a/app/Views/bike_model_list.php b/app/Views/bike_model_list.php
index c507e48..49c1a94 100644
--- a/app/Views/bike_model_list.php
+++ b/app/Views/bike_model_list.php
@@ -42,7 +42,7 @@
-
+
@@ -68,7 +68,6 @@
Add Models
-
-
@@ -95,7 +92,7 @@
diff --git a/app/Views/branch_edit_form.php b/app/Views/branch_edit_form.php
index 2aad5ee..f36467b 100644
--- a/app/Views/branch_edit_form.php
+++ b/app/Views/branch_edit_form.php
@@ -21,16 +21,41 @@
-
-
+
+
+
+
+
+
+ Contact Details
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Address Details
+
+
+
-
-
+
+
@@ -38,10 +63,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/branch_list.php b/app/Views/branch_list.php
index fe58e12..6262112 100644
--- a/app/Views/branch_list.php
+++ b/app/Views/branch_list.php
@@ -24,11 +24,12 @@
Branch Name
+ GST
Address
City
State
Postal Code
- Mobile No
+ Contact
Active
User List
Action
@@ -39,11 +40,12 @@
?>
= $value['branch_name']; ?>
+ = $value['gstno']; ?>
= $value['address']; ?>
= $value['city']; ?>
= $value['state']; ?>
= $value['postal_code']; ?>
- = $value['mobile_no']; ?>
+ = $value['contact_1']; ?>
Inactive
@@ -74,7 +76,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/app/Views/invoice_pdf_template.php b/app/Views/invoice_pdf_template.php
index 1bc72f6..ae52d0e 100644
--- a/app/Views/invoice_pdf_template.php
+++ b/app/Views/invoice_pdf_template.php
@@ -12,8 +12,8 @@
.business-logo-container {text-align: center;}
img.business-logo {max-width: 200px;}
.business-name {font-size: 16px;font-weight: bold;margin-top: 10px;}
- table.invoice-info-table {width: 100%;}
- table.invoice-info-table th,table.invoice-info-table td {text-align: right;}
+ table.invoice-info-table {width: 110%;}
+ /* table.invoice-info-table th,table.invoice-info-table td {text-align: right;} */
table.addresses-table {width: 100%;}
table.addresses-table th {text-align: left;padding-left: 8px;}
.billing-address {width: 50%;padding-left: 8px;}
@@ -31,8 +31,11 @@
td.invoice-number {font-size: 18px;font-weight: bold; /* Make the text bold */}
p {margin-top: 0;margin-bottom: 0rem;}
.invoice-info-table {border-collapse: collapse;}
- .invoice-info-table td {border: 1px solid black;width: 100px;}
+ .invoice-info-table td {border: 1px solid black;}
.invoice-info-table tr:first-child td {border-top: none;}
+ .invoice-info-table tr:first-child td {border-right: none;}
+ .invoice-info-table tr td:nth-child(2) {border-left: none;}
+ .invoice-info-table tr:first-child td {border-bottom: none;}
.invoice-info-table tr:last-child td {border-bottom: none;}
.invoice-info-table tr td:first-child {border-left: none;}
.invoice-info-table tr td:last-child {border-right: none;}
@@ -50,28 +53,29 @@
- THE MECHANIC
+ = $business['business_name'] ?>
- = $value->company_address ?>,
+
= $value->company_address ?>,
= $value->company_city ?>,
= $value->company_state ?>
- = $value->company_postal_code ?>.
+ = $value->company_postal_code ?>.
- = $value->company_mobile_no ?>
+
+
- GSTIN:
- State Name: , Code:
- Contact :
- Email :
- Buyer (Bill To)
+ GSTIN:
+ State Name: , Code:
+ Contact : ,
+ Email :
+ Buyer (Bill To)
@@ -85,39 +89,50 @@
-
- Invoice No. = $sales[0]->order_number ?>
+
+
+ Invoice No. = $initials ."/".$yearRange."/" . $saleOrderCount+1 ?>
- Dated = date('Y-m-d', strtotime($sales[0]->created_at)) ?>
+ Date = date('Y-m-d', strtotime($sales[0]->created_at)) ?>
- Bike Name
+ Bike Make & Model
Colour
- Bike Number
+ Register Number
Contact Number
- Sale Order No. = $sales[0]->sales_order_id ?>
+ Sale Order No = $sales[0]->order_number ?>
- Delivery Date 5
-
-
- Mode Of Payment = $sales[0]->mode_of_payment ?>
+ Payment Mode = (isset($sales[0]->mode_of_payment) && strlen($sales[0]->mode_of_payment) > 0) ? $sales[0]->mode_of_payment : "Not Done" ?>
-