FEATURE_dashboard:ss
This commit is contained in:
parent
eea6d7795c
commit
e060440efd
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -212,7 +212,7 @@ class Jobcard extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function new_jobcard($job_card_id)
|
public function new_jobcard($job_card_id,$rework = null)
|
||||||
{
|
{
|
||||||
if ($job_card_id === '0') {
|
if ($job_card_id === '0') {
|
||||||
$data['page_name']="Create Job Card";
|
$data['page_name']="Create Job Card";
|
||||||
@ -353,6 +353,7 @@ class Jobcard extends BaseController
|
|||||||
$vehicle=$VehicleModel->where('isactive',1)->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
|
$vehicle=$VehicleModel->where('isactive',1)->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
|
||||||
$data['vehicle']=$vehicle;
|
$data['vehicle']=$vehicle;
|
||||||
$data['logged_user_role'] = $this->session->get('logged_user_role');
|
$data['logged_user_role'] = $this->session->get('logged_user_role');
|
||||||
|
if($rework == 're-work') { $data['rework']= true; }
|
||||||
|
|
||||||
if($this->session->get('logged_user_role') == "Floor Manager")
|
if($this->session->get('logged_user_role') == "Floor Manager")
|
||||||
{
|
{
|
||||||
@ -372,14 +373,16 @@ class Jobcard extends BaseController
|
|||||||
|
|
||||||
public function add_jobs()
|
public function add_jobs()
|
||||||
{
|
{
|
||||||
|
// echo $this->request->getPost('issued_items');die;
|
||||||
// echo $this->request->getPost('products');die;
|
// echo $this->request->getPost('products');die;
|
||||||
// echo $this->request->getPost('delete_items');die;
|
// echo $this->request->getPost('delete_items');die;
|
||||||
// echo $this->request->getPost('issued_items');die;
|
// echo $this->request->getPost('issued_items');die;
|
||||||
|
// echo json_encode($this->request->getPost());die;
|
||||||
$JobcardModel = new JobcardModel();
|
$JobcardModel = new JobcardModel();
|
||||||
if($this->session->get('logged_user_role') == "Store Manager") {
|
if($this->session->get('logged_user_role') == "Store Manager") {
|
||||||
$data['status'] = $this->request->getPost('status');
|
$data['status'] = $this->request->getPost('status');
|
||||||
$job_card_id = $this->request->getPost('job_card_id');
|
$job_card_id = $this->request->getPost('job_card_id');
|
||||||
$JobcardModel->update($job_card_id, $data);
|
$JobcardModel->update($job_card_id, $data); // issued status update
|
||||||
$issued_product_id = $this->request->getPost('issued_items');
|
$issued_product_id = $this->request->getPost('issued_items');
|
||||||
$this->update_store_status($issued_product_id, $data['status']);
|
$this->update_store_status($issued_product_id, $data['status']);
|
||||||
return redirect()->to('job_card_index');
|
return redirect()->to('job_card_index');
|
||||||
@ -390,11 +393,11 @@ class Jobcard extends BaseController
|
|||||||
$JobcardCustomComplaintModel = new JobcardCustomComplaintModel();
|
$JobcardCustomComplaintModel = new JobcardCustomComplaintModel();
|
||||||
|
|
||||||
$this->delete_items($this->request->getPost('delete_items'));
|
$this->delete_items($this->request->getPost('delete_items'));
|
||||||
|
$rework = $this->request->getPost('rework');
|
||||||
// Job card INSERT
|
// Job card INSERT
|
||||||
$job_card_data = [
|
$job_card_data = [
|
||||||
'client_name' => $this->request->getPost('client_id'),
|
'client_name' => $this->request->getPost('client_id'),
|
||||||
'mobile_no' => $this->request->getPost('mobile_no'),
|
'client_mobile_no' => $this->request->getPost('mobile_no'),
|
||||||
'vehicle_id'=>$this->request->getPost('vehicle_id'),
|
'vehicle_id'=>$this->request->getPost('vehicle_id'),
|
||||||
'branch_id'=> $this->session->get('logged_user_branch_id'),
|
'branch_id'=> $this->session->get('logged_user_branch_id'),
|
||||||
'billing_address' => $this->request->getPost('billing_address'),
|
'billing_address' => $this->request->getPost('billing_address'),
|
||||||
@ -407,11 +410,10 @@ class Jobcard extends BaseController
|
|||||||
'note'=> $this->request->getPost('note'),
|
'note'=> $this->request->getPost('note'),
|
||||||
'status'=> $this->request->getPost('status'),
|
'status'=> $this->request->getPost('status'),
|
||||||
'assigned_to'=> json_encode($this->request->getPost('assigned_to')),
|
'assigned_to'=> json_encode($this->request->getPost('assigned_to')),
|
||||||
// 'store_item_issued'=> $this->request->getPost('store_item_issued'),
|
'subtotal'=> (isset($rework) ? 0 : $this->request->getPost('sub_total') ),
|
||||||
'subtotal'=> $this->request->getPost('sub_total'),
|
'tax'=> (isset($rework) ? 0 : $this->request->getPost('invoicetax') ),
|
||||||
'tax'=> $this->request->getPost('invoicetax'),
|
|
||||||
'discount'=> ($this->request->getPost('discount')) == '' ? 0 : $this->request->getPost('discount'),
|
'discount'=> ($this->request->getPost('discount')) == '' ? 0 : $this->request->getPost('discount'),
|
||||||
'total'=> $this->request->getPost('grand_total'),
|
'total'=> (isset($rework) ? 0 : $this->request->getPost('grand_total') ),
|
||||||
'isactive' => 1
|
'isactive' => 1
|
||||||
];
|
];
|
||||||
$status = $this->request->getPost('status');
|
$status = $this->request->getPost('status');
|
||||||
@ -430,10 +432,15 @@ class Jobcard extends BaseController
|
|||||||
$JobcardModel->insert($job_card_data);
|
$JobcardModel->insert($job_card_data);
|
||||||
$job_card_id = $JobcardModel->getInsertID(); // Get the last inserted ID
|
$job_card_id = $JobcardModel->getInsertID(); // Get the last inserted ID
|
||||||
|
|
||||||
$orderNumber = 'JC-' . date('md') . '-' . str_pad($job_card_id, 5, '0', STR_PAD_LEFT);
|
if(isset($rework)) {
|
||||||
|
$job_card = $JobcardModel->find($rework);
|
||||||
|
$JobcardModel->update($job_card_id, ['order_number' => $job_card['order_number'], 'is_rework' => 1 ]);
|
||||||
|
} else {
|
||||||
|
$orderNumber = 'JC-' . date('md') . '-' . str_pad($job_card_id, 5, '0', STR_PAD_LEFT);
|
||||||
|
$JobcardModel->update($job_card_id, ['order_number' => $orderNumber]);
|
||||||
|
}
|
||||||
// print_r($orderNumber);die;
|
// print_r($orderNumber);die;
|
||||||
// Update sales order with generated order number
|
// Update sales order with generated order number
|
||||||
$JobcardModel->update($job_card_id, ['order_number' => $orderNumber]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/********** INSERT SERVICE DATA ************/
|
/********** INSERT SERVICE DATA ************/
|
||||||
@ -444,11 +451,11 @@ class Jobcard extends BaseController
|
|||||||
// Insert into the service table
|
// Insert into the service table
|
||||||
$service['job_card_id'] = $job_card_id;
|
$service['job_card_id'] = $job_card_id;
|
||||||
$service['service_id'] = $item->service_id;
|
$service['service_id'] = $item->service_id;
|
||||||
$service['labour_cost'] = $item->labour_cost;
|
|
||||||
$service['qty'] = $item->quality;
|
$service['qty'] = $item->quality;
|
||||||
$service['tax'] = $item->tax;
|
$service['tax'] = $item->tax;
|
||||||
$service['amount'] = $item->amount;
|
$service['labour_cost'] = (isset($rework) ? 0 : $item->labour_cost );
|
||||||
// echo empty($item->id);die;
|
$service['amount'] = (isset($rework) ? 0 : $item->amount );
|
||||||
|
|
||||||
if(empty($item->id)) {
|
if(empty($item->id)) {
|
||||||
$JobcardServiceModel->insert($service);
|
$JobcardServiceModel->insert($service);
|
||||||
$service_id = $JobcardServiceModel->getInsertID();
|
$service_id = $JobcardServiceModel->getInsertID();
|
||||||
@ -463,7 +470,7 @@ class Jobcard extends BaseController
|
|||||||
$service_id = $item->id;
|
$service_id = $item->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($item->product)) { $this->product_data_insertion($job_card_id, $service_id, $JobcardServiceModel, $item, $JobcardProductModel, $status); }
|
if(isset($item->product)) { $this->product_data_insertion($job_card_id, $service_id, $JobcardServiceModel, $item, $JobcardProductModel, $status, $rework); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/********** INSERT COMPLAINT DATA ************/
|
/********** INSERT COMPLAINT DATA ************/
|
||||||
@ -491,7 +498,7 @@ class Jobcard extends BaseController
|
|||||||
$complaint_id = $item->id;
|
$complaint_id = $item->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($item->product)) { $this->product_data_insertion($job_card_id, $complaint_id, $JobcardComplaintModel, $item, $JobcardProductModel, $status); }
|
if(isset($item->product)) { $this->product_data_insertion($job_card_id, $complaint_id, $JobcardComplaintModel, $item, $JobcardProductModel, $status, $rework); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/********** INSERT CUSTOM COMPLAINT DATA ************/
|
/********** INSERT CUSTOM COMPLAINT DATA ************/
|
||||||
@ -519,7 +526,7 @@ class Jobcard extends BaseController
|
|||||||
$cc_complaint_id = $item->id;
|
$cc_complaint_id = $item->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($item->product)) { $this->product_data_insertion($job_card_id, $cc_complaint_id, $JobcardCustomComplaintModel, $item, $JobcardProductModel, $status); }
|
if(isset($item->product)) { $this->product_data_insertion($job_card_id, $cc_complaint_id, $JobcardCustomComplaintModel, $item, $JobcardProductModel, $status, $rework); }
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->to('job_card_index');
|
return redirect()->to('job_card_index');
|
||||||
@ -530,21 +537,25 @@ class Jobcard extends BaseController
|
|||||||
if($status == 'Issued') {
|
if($status == 'Issued') {
|
||||||
$JobcardProductModel = new JobcardProductModel();
|
$JobcardProductModel = new JobcardProductModel();
|
||||||
$productModel = new ProductModel();
|
$productModel = new ProductModel();
|
||||||
$data['status'] = 1;
|
|
||||||
$product_data = json_decode($issued_product_id);
|
$product_data = json_decode($issued_product_id);
|
||||||
foreach ($product_data as $key => $value) {
|
foreach ($product_data as $key => $value) {
|
||||||
$jc_product = $JobcardProductModel->where('job_card_product_id', $value->id)->findAll();
|
$jc_product = $JobcardProductModel->where('job_card_product_id', $value->id)->findAll();
|
||||||
if($jc_product[0]['status'] == 0)
|
if($jc_product[0]['status'] == 0)
|
||||||
{
|
{
|
||||||
|
$data['issued_qty'] = $value->qty;
|
||||||
|
if($value->qty == $jc_product[0]['qty']) { $data['status'] = 1; }
|
||||||
$res = $JobcardProductModel->update($value->id, $data);
|
$res = $JobcardProductModel->update($value->id, $data);
|
||||||
if($res && $status == 'Issued')
|
if($res)
|
||||||
$this->updateProductQuantity($productModel, $jc_product[0]['product_id'], $value->qty);
|
{
|
||||||
|
$deduct_qty = $value->qty - $jc_product[0]['issued_qty'];
|
||||||
|
$this->updateProductQuantity($productModel, $jc_product[0]['product_id'], $deduct_qty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function product_data_insertion($job_card_id, $parent_id, $ParentModel, $item, $JobcardProductModel, $status)
|
public function product_data_insertion($job_card_id, $parent_id, $ParentModel, $item, $JobcardProductModel, $status, $rework)
|
||||||
{
|
{
|
||||||
// Insert into the product table
|
// Insert into the product table
|
||||||
$id = [];
|
$id = [];
|
||||||
@ -553,7 +564,7 @@ class Jobcard extends BaseController
|
|||||||
$product['product_id'] = $pt->p_id;
|
$product['product_id'] = $pt->p_id;
|
||||||
$product['qty'] = $pt->qty;
|
$product['qty'] = $pt->qty;
|
||||||
$product['tax'] = $pt->tax;
|
$product['tax'] = $pt->tax;
|
||||||
$product['amount'] = $pt->amount / $pt->qty;
|
$product['amount'] = (isset($rework) ? 0 : $pt->amount / $pt->qty );
|
||||||
if(empty($pt->id)) {
|
if(empty($pt->id)) {
|
||||||
$JobcardProductModel->insert($product);
|
$JobcardProductModel->insert($product);
|
||||||
$job_card_product_id = $JobcardProductModel->getInsertID();
|
$job_card_product_id = $JobcardProductModel->getInsertID();
|
||||||
@ -562,8 +573,13 @@ class Jobcard extends BaseController
|
|||||||
if($status == 'Cancelled')
|
if($status == 'Cancelled')
|
||||||
{
|
{
|
||||||
$product = [];
|
$product = [];
|
||||||
|
$product['job_card_id'] = $job_card_id;
|
||||||
|
$product['product_id'] = $pt->p_id;
|
||||||
$product['is_active'] = 0;
|
$product['is_active'] = 0;
|
||||||
}
|
}
|
||||||
|
$old_data = $JobcardProductModel->find($pt->id);
|
||||||
|
if($pt->qty != $old_data['issued_qty'] && $pt->qty > $old_data['issued_qty']) { $product['status'] = 0; }
|
||||||
|
// echo $pt->id;die;
|
||||||
$JobcardProductModel->update($pt->id, $product);
|
$JobcardProductModel->update($pt->id, $product);
|
||||||
$job_card_product_id = $pt->id;
|
$job_card_product_id = $pt->id;
|
||||||
}
|
}
|
||||||
@ -646,10 +662,11 @@ class Jobcard extends BaseController
|
|||||||
|
|
||||||
foreach ($id_array as $key => $product_id) {
|
foreach ($id_array as $key => $product_id) {
|
||||||
$product = $JobcardProductModel->find($product_id);
|
$product = $JobcardProductModel->find($product_id);
|
||||||
$qty = isset($product['qty']) ? $product['qty'] : 0;
|
$qty = isset($product['issued_qty']) ? $product['issued_qty'] : 0;
|
||||||
if ($status == 'Issued') {
|
if ($status == 'Issued') {
|
||||||
// $this->updateProductQuantity($ProductModel, $product['product_id'], $qty);
|
// $this->updateProductQuantity($ProductModel, $product['product_id'], $qty);
|
||||||
}elseif ($status == 'Cancelled' && $product['status'] == 1){
|
}elseif ($status == 'Cancelled'){
|
||||||
|
|
||||||
$this->addBackProductQuantity($ProductModel, $product['product_id'], $qty);
|
$this->addBackProductQuantity($ProductModel, $product['product_id'], $qty);
|
||||||
$data['status'] = 0;
|
$data['status'] = 0;
|
||||||
// echo $product['job_card_product_id'];die;
|
// echo $product['job_card_product_id'];die;
|
||||||
@ -671,6 +688,7 @@ class Jobcard extends BaseController
|
|||||||
// Update quantity in Product table
|
// Update quantity in Product table
|
||||||
$ProductModel->update($product_id, ['qty_stock' => $new_qty]);
|
$ProductModel->update($product_id, ['qty_stock' => $new_qty]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function updateProductQuantity($ProductModel, $product_id, $sold_qty)
|
private function updateProductQuantity($ProductModel, $product_id, $sold_qty)
|
||||||
{
|
{
|
||||||
// Fetch current product quantity
|
// Fetch current product quantity
|
||||||
|
|||||||
@ -6,16 +6,46 @@ use App\Models\UsersModel;
|
|||||||
use App\Models\RoleModel;
|
use App\Models\RoleModel;
|
||||||
use App\Models\BusinessModel;
|
use App\Models\BusinessModel;
|
||||||
use App\Models\BranchModel;
|
use App\Models\BranchModel;
|
||||||
|
use App\Models\JobcardProductModel;
|
||||||
|
use App\Models\JobcardModel;
|
||||||
|
use App\Models\BikemodelsModel;
|
||||||
|
use App\Models\BikemakeModel;
|
||||||
|
|
||||||
|
|
||||||
class Users extends BaseController
|
class Users extends BaseController
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public $session;
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->session = session();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function dashboard()
|
public function dashboard()
|
||||||
{
|
{
|
||||||
return view('dashboard');
|
$UsersModel = new UsersModel();
|
||||||
|
$dashboard_data = $UsersModel->dashboard_live_data($this->session->get('logged_user_branch_id'));
|
||||||
|
foreach ($dashboard_data as &$value) {
|
||||||
|
$assigned_ids = !empty(json_decode($value['assigned_to'], true)) ? json_decode($value['assigned_to'], true) : [0];
|
||||||
|
$user = $UsersModel->select('users.name as username, roles.roles as userrole')->join('roles', 'roles.role_id = users.role', 'left')->whereIn('users.user_id', $assigned_ids)->findAll();
|
||||||
|
|
||||||
|
$value['username'] = '';
|
||||||
|
|
||||||
|
foreach ($user as $val) {
|
||||||
|
if (isset($val['username'])) {
|
||||||
|
$value['username'] .= $val['username'] . '- ' . $val['userrole'] .'<br>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$JobcardModel = new JobcardModel();
|
||||||
|
$current_date = date('Y-m-d');
|
||||||
|
$data['delivery_data'] = $JobcardModel->where('DATE(delivery_date)', $current_date)->where('isactive',1)->findAll();
|
||||||
|
$data['dashboard_data'] = $dashboard_data;
|
||||||
|
return view('dashboard',$data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ class JobcardModel extends Model
|
|||||||
'order_number','client_mobile_no','client_name',
|
'order_number','client_mobile_no','client_name',
|
||||||
'billing_address','billing_city','billing_state','billing_country',
|
'billing_address','billing_city','billing_state','billing_country',
|
||||||
'billing_postal_code','fuel_qty', 'meter', 'delivery_date', 'note',
|
'billing_postal_code','fuel_qty', 'meter', 'delivery_date', 'note',
|
||||||
'status','assigned_to', 'store_item_issued','subtotal','tax', 'discount','total','isactive'];
|
'status','assigned_to', 'is_rework','subtotal','tax', 'discount','total','isactive'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,5 +5,5 @@ class JobcardProductModel extends Model
|
|||||||
{
|
{
|
||||||
protected $table = 'job_card_product';
|
protected $table = 'job_card_product';
|
||||||
protected $primaryKey = 'job_card_product_id';
|
protected $primaryKey = 'job_card_product_id';
|
||||||
protected $allowedFields = ['job_card_product_id','job_card_id' , 'product_id', 'qty', 'tax', 'amount', 'status', 'isactive'];
|
protected $allowedFields = ['job_card_product_id','job_card_id' , 'product_id', 'qty', 'tax', 'amount', 'status', 'issued_qty', 'is_active'];
|
||||||
}
|
}
|
||||||
@ -11,4 +11,36 @@ class UsersModel extends Model
|
|||||||
public function getUserById($user_id) {
|
public function getUserById($user_id) {
|
||||||
return $this->db->table('users')->where('user_id', $user_id)->get()->getRowArray();
|
return $this->db->table('users')->where('user_id', $user_id)->get()->getRowArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function dashboard_live_data($logged_user_branch_id)
|
||||||
|
{
|
||||||
|
$this->select('job_card.*, vehicle.reg_no, vehicle.make, vehicle.colour, vehicle.model, make.make as bike_name, model.model_name as bike_modal_name');
|
||||||
|
$this->from('job_card');
|
||||||
|
$this->join('vehicle', 'vehicle.vehicle_id = job_card.vehicle_id', 'left');
|
||||||
|
$this->join('make', 'make.make_id = vehicle.make', 'left');
|
||||||
|
$this->join('model', 'model.model_id = vehicle.model', 'left');
|
||||||
|
$this->where('job_card.isactive', 1);
|
||||||
|
$this->where('job_card.branch_id',$logged_user_branch_id);
|
||||||
|
$current_date = date('Y-m-d');
|
||||||
|
$this->where('DATE(job_card.created_at)', $current_date);
|
||||||
|
$this->groupBy('job_card.job_card_id');
|
||||||
|
$this->orderBy('job_card.job_card_id','DESC');
|
||||||
|
return $this->findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function today_delivery($logged_user_branch_id)
|
||||||
|
{
|
||||||
|
$this->select('job_card.*, vehicle.reg_no, vehicle.make, vehicle.colour, vehicle.model, make.make as bike_name, model.model_name as bike_modal_name');
|
||||||
|
$this->from('job_card');
|
||||||
|
$this->join('vehicle', 'vehicle.vehicle_id = job_card.vehicle_id', 'left');
|
||||||
|
$this->join('make', 'make.make_id = vehicle.make', 'left');
|
||||||
|
$this->join('model', 'model.model_id = vehicle.model', 'left');
|
||||||
|
$this->where('job_card.isactive', 1);
|
||||||
|
$this->where('job_card.branch_id',$logged_user_branch_id);
|
||||||
|
$current_date = date('Y-m-d');
|
||||||
|
$this->where('DATE(job_card.created_at)', $current_date);
|
||||||
|
$this->groupBy('job_card.job_card_id');
|
||||||
|
$this->orderBy('job_card.job_card_id','DESC');
|
||||||
|
return $this->findAll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,14 +1,90 @@
|
|||||||
<?php include('layout/header.php'); ?>
|
<?php include('layout/header.php'); ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="page-title-box page-title-box-alt">
|
<div class="page-title-box page-title-box-alt">
|
||||||
<h4 class="page-title"><?php echo 'Dashboard' ?></h4>
|
<h4 class="page-title"><?php echo 'Dashboard' ?></h4>
|
||||||
<div class="page-title-right">
|
<div class="page-title-right">
|
||||||
<ol class="breadcrumb m-0">
|
<ol class="breadcrumb m-0"></ol>
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
<!-- <h4 class="header-title">Job Card LIVE</h4> -->
|
||||||
|
<p class="sub-header mb-1">
|
||||||
|
Current List of Job Cards
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<table class="tablesaw table mb-0" data-tablesaw-mode="swipe">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="title" scope="col" data-tablesaw-sortable-col data-tablesaw-priority="persist">Bike Details</th>
|
||||||
|
<th scope="col" data-tablesaw-sortable-col data-tablesaw-sortable-default-col data-tablesaw-priority="3">Job Card No</th>
|
||||||
|
<th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="2">Created Time</th>
|
||||||
|
<th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="1">Client</th>
|
||||||
|
<th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="4">Workers</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<?php foreach ($dashboard_data as $key => $value) { ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= $value['reg_no'] ?>, <br><?= $value['bike_name'] ?> <?= $value['bike_modal_name'] ?>,<br> <?= $value['colour'] ?> color</td>
|
||||||
|
<td><?= $value['order_number'] ?></td>
|
||||||
|
<td><?php
|
||||||
|
$date = new DateTime($value['created_at']);
|
||||||
|
$formattedTime = $date->format('h:iA');
|
||||||
|
echo $formattedTime;
|
||||||
|
?>
|
||||||
|
(TODAY)</td>
|
||||||
|
<td><?= $value['client_name'] ?><br><?= $value['client_mobile_no'] ?></td>
|
||||||
|
<td><?php echo (isset($value['username']) && $value['username'] != '' ? $value['username']: 'Not Assigned') ?> </td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div> <!-- end card -->
|
||||||
|
</div> <!-- end col-->
|
||||||
|
|
||||||
|
<div class="col-xl-7">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="dropdown float-right">
|
||||||
|
</div>
|
||||||
|
<h4 class="header-title mb-4">Delivery Today</h4>
|
||||||
|
|
||||||
|
<?php foreach ($delivery_data as $key => $value) { ?>
|
||||||
|
<div class="media">
|
||||||
|
<div class="media-body">
|
||||||
|
<span class="badge badge-soft-warning float-right" style="font-size:15px;"><?= $value['order_number'] ?></span>
|
||||||
|
<h5 class="mt-0 mb-1"><?= $value['client_name'] ?></h5>
|
||||||
|
<span class="font-13"><?= $value['client_mobile_no'] ?></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- end card-body -->
|
||||||
|
</div>
|
||||||
|
<!-- end card-->
|
||||||
|
</div>
|
||||||
|
<!-- end col -->
|
||||||
|
|
||||||
|
<div class="col-lg-6">
|
||||||
|
|
||||||
|
</div><!-- end col -->
|
||||||
|
</div><!-- end row-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php include('layout/footer.php'); ?>
|
<?php include('layout/footer.php'); ?>
|
||||||
|
|||||||
@ -250,13 +250,13 @@ p {
|
|||||||
<td style="border: 0.5px solid black;"><?php
|
<td style="border: 0.5px solid black;"><?php
|
||||||
if(isset($item['custom_amount']))
|
if(isset($item['custom_amount']))
|
||||||
{
|
{
|
||||||
echo round($item['custom_amount']) ;
|
echo round($item['custom_amount']) * $item['custom_tax'];
|
||||||
$sub_tot += round($item['custom_amount']);
|
$sub_tot += round($item['custom_amount']) * $item['qty'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo round($item['amount']);
|
echo round($item['amount']) * $item['qty'];
|
||||||
$sub_tot += round($item['amount']);
|
$sub_tot += round($item['amount']) * $item['qty'];
|
||||||
} ?></td>
|
} ?></td>
|
||||||
<td style="border: 0.5px solid black;"><?= $item['qty'] ?></td>
|
<td style="border: 0.5px solid black;"><?= $item['qty'] ?></td>
|
||||||
<td style="border: 0.5px solid black;"><?php echo isset($item['custom_amount']) ? '-' : $item['per'] ?></td>
|
<td style="border: 0.5px solid black;"><?php echo isset($item['custom_amount']) ? '-' : $item['per'] ?></td>
|
||||||
@ -265,13 +265,13 @@ p {
|
|||||||
<td style="border: 0.5px solid black;"><?php echo isset($item['custom_tax']) ? round($item['custom_tax'] / 2) : round($item['amount'] * ($item['tax'] / 2) / 100) ?></td>
|
<td style="border: 0.5px solid black;"><?php echo isset($item['custom_tax']) ? round($item['custom_tax'] / 2) : round($item['amount'] * ($item['tax'] / 2) / 100) ?></td>
|
||||||
<td style="border: 0.5px solid black;">
|
<td style="border: 0.5px solid black;">
|
||||||
<?php if(isset($item['custom_tax'])) {
|
<?php if(isset($item['custom_tax'])) {
|
||||||
echo round(($item['custom_amount'] * $item['tax'] / 100));
|
echo round(( ($item['custom_amount'] * $item['qty']) * $item['tax'] / 100));
|
||||||
$tax+= round(($item['custom_amount'] * $item['tax'] / 100));
|
$tax+= round(( ($item['custom_amount']* $item['qty'] ) * $item['tax'] / 100));
|
||||||
} else {
|
} else {
|
||||||
echo round($item['amount'] * $item['tax'] / 100);
|
echo round( ($item['amount']* $item['qty']) * $item['tax'] / 100);
|
||||||
$tax+= ($item['amount'] * $item['tax'] / 100);
|
$tax+= ( ($item['amount']* $item['qty']) * $item['tax'] / 100);
|
||||||
} ?></td>
|
} ?></td>
|
||||||
<td style="border: 0.5px solid black;"><?php echo isset($item['custom_total']) ? round($item['custom_amount'] + ($item['custom_amount'] * $item['tax'] / 100)) : round($item['amount'] + ($item['amount'] * $item['tax'] / 100) ) ?></td>
|
<td style="border: 0.5px solid black;"><?php echo isset($item['custom_total']) ? round($item['custom_amount'] + ($item['custom_amount'] * $item['tax'] / 100)) * $item['qty'] : round($item['amount'] + ($item['amount'] * $item['tax'] / 100) ) * $item['qty'] ?></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@ -301,7 +301,13 @@ p {
|
|||||||
<td style="border: 0.5px solid black;"><?= $job_card[0]['discount'] ?></td>
|
<td style="border: 0.5px solid black;"><?= $job_card[0]['discount'] ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="10" style="border: 0.5px solid black;">Amount Chargeable (in words)</td>
|
<td colspan="10" style="border: 0.5px solid black;">Amount Chargeable (in words):
|
||||||
|
<?php
|
||||||
|
$formatter = new NumberFormatter("en", NumberFormatter::SPELLOUT);
|
||||||
|
$words = $formatter->format($sub_tot + round($tax));
|
||||||
|
echo ucfirst($words);
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td></td></tr>
|
<tr><td></td></tr>
|
||||||
<tr><td></td></tr>
|
<tr><td></td></tr>
|
||||||
|
|||||||
@ -65,8 +65,14 @@
|
|||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="inputPassword4" class="col-form-label">Address<span class="text-danger"></span></label>
|
<label for="inputPassword4" class="col-form-label">Address<span class="text-danger"></span></label>
|
||||||
<input type="text" class="form-control" name="billing_address" placeholder="Address"value="<?= isset($jobs['billing_address']) ? $jobs['billing_address'] : '' ?>" >
|
<input type="text" class="form-control" name="billing_address" placeholder="Address"value="<?= isset($jobs['billing_address']) ? $jobs['billing_address'] : '' ?>" >
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" id="job_card_id" name="job_card_id" value="<?= isset($jobs['job_card_id']) ? $jobs['job_card_id'] : '' ?>"readonly>
|
|
||||||
|
<?php if(!isset($rework)) { ?>
|
||||||
|
<input type="hidden" id="job_card_id" name="job_card_id" value="<?= isset($jobs['job_card_id']) ? $jobs['job_card_id'] : '' ?>"readonly>
|
||||||
|
<?php } else { ?>
|
||||||
|
<input type="hidden" name="rework" value="<?= isset($jobs['job_card_id']) ? $jobs['job_card_id'] : '' ?>"readonly>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="inputPassword4" class="col-form-label">City<span class="text-danger"></span></label>
|
<label for="inputPassword4" class="col-form-label">City<span class="text-danger"></span></label>
|
||||||
<input type="text" class="form-control" name="city" placeholder="City"value="<?= isset($jobs['billing_city']) ? $jobs['billing_city'] : 'Chennai' ?>" >
|
<input type="text" class="form-control" name="city" placeholder="City"value="<?= isset($jobs['billing_city']) ? $jobs['billing_city'] : 'Chennai' ?>" >
|
||||||
@ -150,6 +156,9 @@
|
|||||||
<th hidden>Rate</th>
|
<th hidden>Rate</th>
|
||||||
<th hidden></th>
|
<th hidden></th>
|
||||||
<th>Qty</th>
|
<th>Qty</th>
|
||||||
|
<?php if(isset($logged_user_role) && ( $logged_user_role == "Store Manager" ) ) { ?>
|
||||||
|
<th>Issued Qty</th>
|
||||||
|
<?php } ?>
|
||||||
<th>Tax (%)</th>
|
<th>Tax (%)</th>
|
||||||
<th>Tax Amount</th>
|
<th>Tax Amount</th>
|
||||||
<th>Amount</th>
|
<th>Amount</th>
|
||||||
@ -351,14 +360,19 @@ $(document).ready(async function() {
|
|||||||
newRow += '</select></td>' +
|
newRow += '</select></td>' +
|
||||||
'<td><input hidden type="text" class="form-control rate-d-only" value="'+value.amount+'" readonly /></td>' +
|
'<td><input hidden type="text" class="form-control rate-d-only" value="'+value.amount+'" readonly /></td>' +
|
||||||
'<td hidden><input hidden type="text" class="form-control item-rate1" value="'+value.amount+'" name="unit-price[]" readonly /></td>' +
|
'<td hidden><input hidden type="text" class="form-control item-rate1" value="'+value.amount+'" name="unit-price[]" readonly /></td>' +
|
||||||
'<td><input hidden type="number" class="form-control item-quantity" min="0" value="'+value.qty+'" name="quantity[]" readonly/></td>' +
|
'<td><input hidden type="number" class="form-control item-quantity" min="0" value="'+value.qty+'" name="quantity[]" readonly/></td>';
|
||||||
'<td><input hidden type="text" class="form-control item-tax" value="'+value.tax+'" name="item-tax[]" readonly /></td>' +
|
<?php if(isset($logged_user_role) && ( $logged_user_role == "Store Manager" ) ) { ?>
|
||||||
|
newRow += '<td><input hidden type="number" class="form-control issued-qty" min"0" max="'+value.qty+'" value="" name="issued-qty" /></td>';
|
||||||
|
<?php } ?>
|
||||||
|
newRow += '<td><input hidden type="text" class="form-control item-tax" value="'+value.tax+'" name="item-tax[]" readonly /></td>' +
|
||||||
'<td><input hidden type="text" class="form-control total-tax-amount" readonly /></td>' +
|
'<td><input hidden type="text" class="form-control total-tax-amount" readonly /></td>' +
|
||||||
'<td><input hidden type="text" class="form-control item-amount1" value="'+value.amount+'" name="amount[]"/></td>' +
|
'<td><input hidden type="text" class="form-control item-amount1" value="'+value.amount+'" name="amount[]"/></td>' +
|
||||||
'<td><center><i class="fa fa-trash remove-item"></i></center><input value="service" name="item_type" hidden></td>' +
|
'<td><center><i class="fa fa-trash remove-item"></i></center><input value="service" name="item_type" hidden></td>';
|
||||||
'<td hidden><input name="id" value="'+value.job_card_service_id+'"></td>' +
|
<?php if(!isset($rework)) { ?>
|
||||||
'</tr>';
|
newRow += '<td hidden><input name="id" value="'+value.job_card_service_id+'"></td></tr>';
|
||||||
|
<?php } else { ?>
|
||||||
|
newRow += '<td hidden><input name="id" value=""></td></tr>';
|
||||||
|
<?php } ?>
|
||||||
// console.log(value);
|
// console.log(value);
|
||||||
tr = $('#productItemTable tbody').append(newRow);
|
tr = $('#productItemTable tbody').append(newRow);
|
||||||
// initializeSelect2();
|
// initializeSelect2();
|
||||||
@ -386,8 +400,11 @@ $(document).ready(async function() {
|
|||||||
newRow += '</select></td>' +
|
newRow += '</select></td>' +
|
||||||
'<td><input hidden type="text" class="form-control rate-d-only" value="'+value.amount+'" readonly /></td>' +
|
'<td><input hidden type="text" class="form-control rate-d-only" value="'+value.amount+'" readonly /></td>' +
|
||||||
'<td hidden><input hidden type="text" class="form-control item-rate1" value="'+value.amount+'" name="unit-price[]" readonly /></td>' +
|
'<td hidden><input hidden type="text" class="form-control item-rate1" value="'+value.amount+'" name="unit-price[]" readonly /></td>' +
|
||||||
'<td><input hidden type="number" class="form-control item-quantity" min="0" value="'+value.qty+'" name="quantity[]" readonly/></td>' +
|
'<td><input hidden type="number" class="form-control item-quantity" min="0" value="'+value.qty+'" name="quantity[]" readonly/></td>';
|
||||||
'<td><input hidden type="text" class="form-control item-tax" value="'+value.tax+'" name="item-tax[]" readonly /></td>' +
|
<?php if(isset($logged_user_role) && ( $logged_user_role == "Store Manager" ) ) { ?>
|
||||||
|
newRow += '<td><input hidden type="number" class="form-control"/></td>';
|
||||||
|
<?php } ?>
|
||||||
|
newRow += '<td><input hidden type="text" class="form-control item-tax" value="'+value.tax+'" name="item-tax[]" readonly /></td>' +
|
||||||
'<td><input hidden type="text" class="form-control total-tax-amount" readonly /></td>' +
|
'<td><input hidden type="text" class="form-control total-tax-amount" readonly /></td>' +
|
||||||
'<td><input hidden type="text" class="form-control item-amount1" value="'+value.amount+'" name="amount[]"/></td>' +
|
'<td><input hidden type="text" class="form-control item-amount1" value="'+value.amount+'" name="amount[]"/></td>' +
|
||||||
'<td><div style="display: inline-block;">'+
|
'<td><div style="display: inline-block;">'+
|
||||||
@ -399,9 +416,12 @@ $(document).ready(async function() {
|
|||||||
'<i class="fa fa-plus" aria-hidden="true"></i>'+
|
'<i class="fa fa-plus" aria-hidden="true"></i>'+
|
||||||
'</a>'+
|
'</a>'+
|
||||||
'</div>'+
|
'</div>'+
|
||||||
'</td>' +
|
'</td>';
|
||||||
'<td hidden><input type="hidden" name="id" value="'+value.job_card_complaint_id+'"></td>' +
|
<?php if(!isset($rework)) { ?>
|
||||||
'</tr>';
|
newRow += '<td hidden><input name="id" value="'+value.job_card_complaint_id+'"></td></tr>';
|
||||||
|
<?php } else { ?>
|
||||||
|
newRow += '<td hidden><input name="id" value=""></td></tr>';
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
|
||||||
$('#productItemTable tbody').append(newRow);
|
$('#productItemTable tbody').append(newRow);
|
||||||
@ -419,8 +439,11 @@ $(document).ready(async function() {
|
|||||||
var newRow = '<tr class="custom_complaint_class"><td hidden> <input type="number" class="form-control labour_cost" name="labour_cost" value="'+value.labour_cost+'"></td><td><textarea class="form-control custom-comp" id="custom_complaint_detail" rows="5">'+value.name+'</textarea></td>' +
|
var newRow = '<tr class="custom_complaint_class"><td hidden> <input type="number" class="form-control labour_cost" name="labour_cost" value="'+value.labour_cost+'"></td><td><textarea class="form-control custom-comp" id="custom_complaint_detail" rows="5">'+value.name+'</textarea></td>' +
|
||||||
'<td><input hidden type="text" class="form-control rate-d-only" value="'+value.amount+'" readonly /></td>' +
|
'<td><input hidden type="text" class="form-control rate-d-only" value="'+value.amount+'" readonly /></td>' +
|
||||||
'<td hidden><input hidden type="text" class="form-control item-rate1" value="'+value.amount+'" name="unit-price[]" /></td>' +
|
'<td hidden><input hidden type="text" class="form-control item-rate1" value="'+value.amount+'" name="unit-price[]" /></td>' +
|
||||||
'<td><input hidden type="number" class="form-control item-quantity" min="0" value="'+value.qty+'" name="quantity[]" readonly/></td>' +
|
'<td><input hidden type="number" class="form-control item-quantity" min="0" value="'+value.qty+'" name="quantity[]" readonly/></td>';
|
||||||
'<td><input hidden type="text" class="form-control item-tax" value="'+value.tax+'" name="item-tax[]" /></td>' +
|
<?php if(isset($logged_user_role) && ( $logged_user_role == "Store Manager" ) ) { ?>
|
||||||
|
newRow += '<td><input hidden type="number" class="form-control"/></td>';
|
||||||
|
<?php } ?>
|
||||||
|
newRow += '<td><input hidden type="text" class="form-control item-tax" value="'+value.tax+'" name="item-tax[]" /></td>' +
|
||||||
'<td><input hidden type="text" class="form-control total-tax-amount" readonly /></td>' +
|
'<td><input hidden type="text" class="form-control total-tax-amount" readonly /></td>' +
|
||||||
'<td><input hidden type="text" class="form-control item-amount1" value="'+value.amount+'" name="amount[]"/></td>' +
|
'<td><input hidden type="text" class="form-control item-amount1" value="'+value.amount+'" name="amount[]"/></td>' +
|
||||||
'<td><div style="display: inline-block;">'+
|
'<td><div style="display: inline-block;">'+
|
||||||
@ -432,10 +455,12 @@ $(document).ready(async function() {
|
|||||||
'<i class="fa fa-plus" aria-hidden="true"></i>'+
|
'<i class="fa fa-plus" aria-hidden="true"></i>'+
|
||||||
'</a>'+
|
'</a>'+
|
||||||
'</div>'+
|
'</div>'+
|
||||||
'</td>' +
|
'</td>';
|
||||||
'<td hidden><input type="hidden" name="id" value="'+value.job_card_cc_id+'"></td>' +
|
<?php if(!isset($rework)) { ?>
|
||||||
'</tr>';
|
newRow += '<td hidden><input name="id" value="'+value.job_card_cc_id+'"></td></tr>';
|
||||||
|
<?php } else { ?>
|
||||||
|
newRow += '<td hidden><input name="id" value=""></td></tr>';
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
$('#productItemTable tbody').append(newRow);
|
$('#productItemTable tbody').append(newRow);
|
||||||
// initializeSelect2();
|
// initializeSelect2();
|
||||||
@ -446,13 +471,17 @@ $(document).ready(async function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function editlabourcost(data,cls) {
|
function editlabourcost(data,cls) {
|
||||||
|
<?php if(isset($rework)) { ?> data.labour_cost = 0; <?php } ?>
|
||||||
total_wih_tax = parseInt(data.labour_cost) + (parseInt(data.labour_cost) * (data.tax / 100));
|
total_wih_tax = parseInt(data.labour_cost) + (parseInt(data.labour_cost) * (data.tax / 100));
|
||||||
total_tax_amt = total_wih_tax - parseInt(data.labour_cost);
|
total_tax_amt = total_wih_tax - parseInt(data.labour_cost);
|
||||||
var newRow = '<tr class="'+cls+'"><td hidden><input type="number" class="form-control labour_cost" name="labour_cost"></td><td style="padding-left: 40px !important;"><i class="fas fa-user-alt" style="font-size: 13px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><input type="text" class="form-control labour_cost" readonly value="Labour Cost"></td>' +
|
var newRow = '<tr class="'+cls+'"><td hidden><input type="number" class="form-control labour_cost" name="labour_cost"></td><td style="padding-left: 40px !important;"><i class="fas fa-user-alt" style="font-size: 13px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><input type="text" class="form-control labour_cost" readonly value="Labour Cost"></td>' +
|
||||||
'<td><input type="text" class="form-control rate-d-only" value="'+data.labour_cost+'" readonly /></td>' +
|
'<td><input type="text" class="form-control rate-d-only" value="'+data.labour_cost+'" readonly /></td>' +
|
||||||
'<td hidden><input hidden type="text" class="form-control item-rate" name="unit-price[]" value="'+data.labour_cost +'" /></td>' +
|
'<td hidden><input hidden type="text" class="form-control item-rate" name="unit-price[]" value="'+data.labour_cost +'" /></td>' +
|
||||||
'<td><input type="number" class="form-control item-quantity-'+cls+' item-quantity" min="0" name="quantity[]" value="1" readonly /></td>' +
|
'<td><input type="number" class="form-control item-quantity-'+cls+' item-quantity" min="0" name="quantity[]" value="1" readonly /></td>';
|
||||||
'<td><input type="text" class="form-control taxable-value item-tax" name="item-tax[]" value="'+data.tax+'" readonly /></td>' +
|
<?php if(isset($logged_user_role) && ( $logged_user_role == "Store Manager" ) ) { ?>
|
||||||
|
newRow += '<td><input type="text" readonly value="NIL" type="number" class="form-control"/></td>';
|
||||||
|
<?php } ?>
|
||||||
|
newRow += '<td><input type="text" class="form-control taxable-value item-tax" name="item-tax[]" value="'+data.tax+'" readonly /></td>' +
|
||||||
'<td><input type="text" class="form-control total-tax-amount" value="'+Math.round(total_tax_amt)+'" readonly /></td>' +
|
'<td><input type="text" class="form-control total-tax-amount" value="'+Math.round(total_tax_amt)+'" readonly /></td>' +
|
||||||
'<td><input type="text" class="form-control item-amount lab_amt" name="amount[]" value="' + Math.round(total_wih_tax) + '" /></td>' +
|
'<td><input type="text" class="form-control item-amount lab_amt" name="amount[]" value="' + Math.round(total_wih_tax) + '" /></td>' +
|
||||||
'<td hidden></td>' +
|
'<td hidden></td>' +
|
||||||
@ -467,6 +496,7 @@ $(document).ready(async function() {
|
|||||||
function edit_product_data(products) {
|
function edit_product_data(products) {
|
||||||
|
|
||||||
for (const product of products) {
|
for (const product of products) {
|
||||||
|
<?php if(isset($rework)) { ?> product.amount = 0; <?php } ?>
|
||||||
total_wih_tax =( parseInt(product.amount) + (parseInt(product.amount) * (product.tax / 100)) )* product.qty;
|
total_wih_tax =( parseInt(product.amount) + (parseInt(product.amount) * (product.tax / 100)) )* product.qty;
|
||||||
console.log(product.pname,product.qty_stock,'qty_stock');
|
console.log(product.pname,product.qty_stock,'qty_stock');
|
||||||
total_tax_amt = total_wih_tax - ( parseInt(product.amount) * product.qty);
|
total_tax_amt = total_wih_tax - ( parseInt(product.amount) * product.qty);
|
||||||
@ -487,16 +517,22 @@ $(document).ready(async function() {
|
|||||||
newRow += '</select></td>' +
|
newRow += '</select></td>' +
|
||||||
'<td><input type="text" class="form-control rate-d-only" value="'+Math.round(product.amount)+'" readonly /></td>' +
|
'<td><input type="text" class="form-control rate-d-only" value="'+Math.round(product.amount)+'" readonly /></td>' +
|
||||||
'<td hidden><input hidden type="text" class="form-control item-rate" name="unit-price[]" value="' + Math.round(product.amount * product.qty) + '" readonly /></td>' +
|
'<td hidden><input hidden type="text" class="form-control item-rate" name="unit-price[]" value="' + Math.round(product.amount * product.qty) + '" readonly /></td>' +
|
||||||
'<td><input type="number" class="form-control item-quantity" min="0" max="'+Number(product.qty_stock)+'" value="' + product.qty + '" name="quantity[]"/></td>' +
|
'<td><input type="number" class="form-control item-quantity" min="0" max="'+Number(product.qty_stock)+'" value="' + product.qty + '" name="quantity[]"/></td>';
|
||||||
'<td> <input type="text" class="form-control taxable-value item-tax" name="item-tax[]" value="' + Math.round(product.tax) + '" readonly /></td>' +
|
<?php if(isset($logged_user_role) && ( $logged_user_role == "Store Manager" ) ) { ?>
|
||||||
|
newRow += '<td><input type="number" class="form-control issued-qty" min="'+product.issued_qty+'" max="'+product.qty+'" value="'+product.issued_qty+'" name="issued-qty" /></td>';
|
||||||
|
<?php } ?>
|
||||||
|
newRow += '<td> <input type="text" class="form-control taxable-value item-tax" name="item-tax[]" value="' + Math.round(product.tax) + '" readonly /></td>' +
|
||||||
'<td><input type="text" class="form-control total-tax-amount" value="'+Math.round(total_tax_amt)+'" readonly /></td>' +
|
'<td><input type="text" class="form-control total-tax-amount" value="'+Math.round(total_tax_amt)+'" readonly /></td>' +
|
||||||
'<td><input type="text" class="form-control item-amount" name="amount[]" value="' + Math.round(total_wih_tax) + '" readonly/></center></td>' +
|
'<td><input type="text" class="form-control item-amount" name="amount[]" value="' + Math.round(total_wih_tax) + '" readonly/></center></td>' +
|
||||||
'<td>'+
|
'<td>'+
|
||||||
action+
|
action+
|
||||||
'<input value="product" name="item_type" hidden>'+
|
'<input value="product" name="item_type" hidden>'+
|
||||||
'</td>' +
|
'</td>';
|
||||||
'<td hidden><input type="hidden" name="id" value="'+product.job_card_product_id+'"></td>' +
|
<?php if(!isset($rework)) { ?>
|
||||||
'</tr>';
|
newRow += '<td hidden><input name="id" value="'+product.job_card_product_id+'"></td></tr>';
|
||||||
|
<?php } else { ?>
|
||||||
|
newRow += '<td hidden><input name="id" value=""></td></tr>';
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
|
||||||
$('#productItemTable tbody').append(newRow);
|
$('#productItemTable tbody').append(newRow);
|
||||||
@ -915,7 +951,7 @@ $(window).on('load', function() {
|
|||||||
$('.checkbox-item:checked').each(function() {
|
$('.checkbox-item:checked').each(function() {
|
||||||
var $closestTR = $(this).closest('tr');
|
var $closestTR = $(this).closest('tr');
|
||||||
var id = $closestTR.find('input[name="id"]').val();
|
var id = $closestTR.find('input[name="id"]').val();
|
||||||
var qty = $closestTR.find('.item-quantity').val();
|
var qty = $closestTR.find('.issued-qty').val();
|
||||||
product.push({ 'id': id, 'qty': qty}); // Push the id into the array
|
product.push({ 'id': id, 'qty': qty}); // Push the id into the array
|
||||||
});
|
});
|
||||||
$("#issued_items").val(JSON.stringify(product));
|
$("#issued_items").val(JSON.stringify(product));
|
||||||
@ -960,15 +996,7 @@ $(window).on('load', function() {
|
|||||||
// Event listener for product selection
|
// Event listener for product selection
|
||||||
$(document).on('change', 'select[name="service_details[]"]', async function() {
|
$(document).on('change', 'select[name="service_details[]"]', async function() {
|
||||||
|
|
||||||
/*** REMOVE SUBPRODUCT ONCHANGE */
|
onchange_remove_subproduct($(this).closest('tr'));
|
||||||
var $closestTR = $(this).closest('tr');
|
|
||||||
while ($closestTR.next().length > 0 && $closestTR.attr('class') != "product") {
|
|
||||||
if ($closestTR.next().hasClass('service_class') || $closestTR.next().hasClass('complaint_class') || $closestTR.next().hasClass('custom_complaint_class')) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// Remove the next row
|
|
||||||
$closestTR.next().remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get class name of the select element
|
// Get class name of the select element
|
||||||
var className = $(this).attr('class');
|
var className = $(this).attr('class');
|
||||||
@ -995,8 +1023,23 @@ $(window).on('load', function() {
|
|||||||
updateCalculations();
|
updateCalculations();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*** REMOVE SUBPRODUCT ONCHANGE */
|
||||||
|
function onchange_remove_subproduct(tr)
|
||||||
|
{
|
||||||
|
var $closestTR = tr;
|
||||||
|
while ($closestTR.next().length > 0 && $closestTR.attr('class') != "product") {
|
||||||
|
if ($closestTR.next().hasClass('service_class') || $closestTR.next().hasClass('complaint_class') || $closestTR.next().hasClass('custom_complaint_class')) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Remove the next row
|
||||||
|
$closestTR.next().remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
// Event listener for product selection
|
// Event listener for product selection
|
||||||
$(document).on('change', 'select[name="complaint_details[]"]', async function() {
|
$(document).on('change', 'select[name="complaint_details[]"]', async function() {
|
||||||
|
|
||||||
|
onchange_remove_subproduct($(this).closest('tr'));
|
||||||
|
|
||||||
// Get class name of the select element
|
// Get class name of the select element
|
||||||
var className = $(this).attr('class');
|
var className = $(this).attr('class');
|
||||||
var productId = $(this).val();
|
var productId = $(this).val();
|
||||||
@ -1120,12 +1163,12 @@ $(window).on('load', function() {
|
|||||||
var newRow = '<tr class="product"><td hidden><input type="number" class="form-control labour_cost" name="labour_cost"></td><td style="padding-left: 40px !important;"><i class="fa fa-wrench" style="font-size: 13px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><select class="form-control book-select SelExample product" name="item_details[]" required data-toggle="select2" style="width: 249px !important;">';
|
var newRow = '<tr class="product"><td hidden><input type="number" class="form-control labour_cost" name="labour_cost"></td><td style="padding-left: 40px !important;"><i class="fa fa-wrench" style="font-size: 13px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><select class="form-control book-select SelExample product" name="item_details[]" required data-toggle="select2" style="width: 249px !important;">';
|
||||||
newRow += '<option value="' + product.product_id + '">' + product.product_name + '</option>';
|
newRow += '<option value="' + product.product_id + '">' + product.product_name + '</option>';
|
||||||
newRow += '</select></td>' +
|
newRow += '</select></td>' +
|
||||||
'<td><input type="text" class="form-control rate-d-only" value="'+ product.unit_price +'" readonly /></td>' +
|
'<td><input type="text" class="form-control rate-d-only" value="'+ Math.round(product.unit_price) +'" readonly /></td>' +
|
||||||
'<td hidden><input type="text" class="form-control item-rate" name="unit-price[]" value="' + product.unit_price + '" readonly /></td>' +
|
'<td hidden><input type="text" class="form-control item-rate" name="unit-price[]" value="' + product.unit_price + '" readonly /></td>' +
|
||||||
'<td><input type="number" class="form-control item-quantity" min="0" max="'+Number(product.qty_stock)+'" value="1" name="quantity[]"/></td>' +
|
'<td><input type="number" class="form-control item-quantity" min="0" max="'+Number(product.qty_stock)+'" value="1" name="quantity[]"/></td>' +
|
||||||
'<td> <input type="text" class="form-control taxable-value item-tax" name="item-tax[]" value="' + tax + '" readonly /></td>' +
|
'<td> <input type="text" class="form-control taxable-value item-tax" name="item-tax[]" value="' + tax + '" readonly /></td>' +
|
||||||
'<td><input type="text" class="form-control total-tax-amount" value="'+total_tax_amt+'" readonly /></td>' +
|
'<td><input type="text" class="form-control total-tax-amount" value="'+ Math.round(total_tax_amt) +'" readonly /></td>' +
|
||||||
'<td><input type="text" class="form-control item-amount" name="amount1[]" value="' + total_wih_tax + '" readonly/></td>' +
|
'<td><input type="text" class="form-control item-amount" name="amount1[]" value="' + Math.round(total_wih_tax) + '" readonly/></td>' +
|
||||||
'<td><center><i class="fa fa-trash remove-item"></i></center><input value="product" name="item_type" hidden></td>' +
|
'<td><center><i class="fa fa-trash remove-item"></i></center><input value="product" name="item_type" hidden></td>' +
|
||||||
'<td hidden><input type="hidden" name="id" value=""></td>' +
|
'<td hidden><input type="hidden" name="id" value=""></td>' +
|
||||||
'</tr>';
|
'</tr>';
|
||||||
|
|||||||
@ -9,12 +9,15 @@
|
|||||||
float:left;
|
float:left;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<?php
|
||||||
|
$admins = $logged_user_role == 'Administrator' || $logged_user_role == 'Job Card Manager' || $logged_user_role == "Floor Manager";
|
||||||
|
?>
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="page-title-box page-title-box-alt">
|
<div class="page-title-box page-title-box-alt">
|
||||||
<h4 class="page-title">Job Card List</h4>
|
<h4 class="page-title">Job Card List</h4>
|
||||||
<?php if($logged_user_role == 'Administrator' || $logged_user_role == 'Job Card Manager' || $logged_user_role == "Floor Manager") { ?>
|
<?php if($admins) { ?>
|
||||||
<div class="page-title-right">
|
<div class="page-title-right">
|
||||||
<ol class="breadcrumb m-0">
|
<ol class="breadcrumb m-0">
|
||||||
<li class=""> <a href="<?= base_url() . "new_jobcard/0"; ?>" class="btn btn-primary waves-effect"> New Job Card</a></li>
|
<li class=""> <a href="<?= base_url() . "new_jobcard/0"; ?>" class="btn btn-primary waves-effect"> New Job Card</a></li>
|
||||||
@ -57,12 +60,16 @@
|
|||||||
<td><?= $value['reg_no']; ?></td>
|
<td><?= $value['reg_no']; ?></td>
|
||||||
<td><?= $value['client_name']; ?><br><?= $value['client_mobile_no']; ?></td>
|
<td><?= $value['client_name']; ?><br><?= $value['client_mobile_no']; ?></td>
|
||||||
<td><?= $value['total']; ?></td>
|
<td><?= $value['total']; ?></td>
|
||||||
<td><?= $value['status']; ?></td>
|
<td><?= ($value['is_rework'] == 1) ? 'Rework/'.$value['status'] :$value['status']; ?></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="<?= "new_jobcard/" . $value['job_card_id']; ?>" class="edit-button" title="Edit"><i class="ri-pencil-line" style="font-size: 20px;"></i></a>
|
<?php if($admins) { ?>
|
||||||
|
<a href="<?= "download_jobcard_invoice/" . $value['job_card_id']; ?>" class="edit-button" title="Download"><i class="ri-file-download-line" style="font-size: 20px;"></i></a>
|
||||||
<a href="<?= "download_jobcard_invoice/" . $value['job_card_id']; ?>" class="edit-button" title="Download"><i class="ri-file-download-line" style="font-size: 20px;"></i></a>
|
<?php } ?>
|
||||||
|
|
||||||
|
<a href="<?= "new_jobcard/" . $value['job_card_id']; ?>" class="edit-button" title="Edit"><i class="ri-pencil-line" style="font-size: 20px;"></i></a>
|
||||||
|
<?php if($value['is_rework'] == 0 && $admins) { ?>
|
||||||
|
<a href="<?= "new_jobcard/" . $value['job_card_id'] . "/re-work" ?>" class="edit-button" title="Re-work"><i class="ri-registered-fill" style="font-size: 20px;"></i></a>
|
||||||
|
<?php } ?>
|
||||||
</td>
|
</td>
|
||||||
<?php endif?>
|
<?php endif?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|||||||
@ -124,7 +124,12 @@
|
|||||||
<ul id="side-menu">
|
<ul id="side-menu">
|
||||||
|
|
||||||
|
|
||||||
<!-- <li class="menu-title">Navigation</li> -->
|
<li>
|
||||||
|
<a href="<?= base_url("dashboard") ?>" class="dropdown-item notify-item">
|
||||||
|
<i class="ri-layout-line"></i>
|
||||||
|
<span>Dashboard</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
<?php if(session()->get('logged_user_role') == 'Super Admin') {
|
<?php if(session()->get('logged_user_role') == 'Super Admin') {
|
||||||
@ -344,26 +349,26 @@
|
|||||||
|
|
||||||
<ul class="list-unstyled topnav-menu float-right mb-0">
|
<ul class="list-unstyled topnav-menu float-right mb-0">
|
||||||
|
|
||||||
|
<li class="dropdown d-none d-lg-inline-block">
|
||||||
|
<a class="nav-link dropdown-toggle arrow-none waves-effect waves-light" href="<?php echo base_url('job_card_index') ?>" title="Job Card">
|
||||||
<li class="dropdown d-none d-lg-inline-block">
|
<i class="fa fa-wrench" style="font-size:20px;"></i>
|
||||||
<a class="nav-link dropdown-toggle arrow-none waves-effect waves-light" data-toggle="fullscreen" href="#">
|
|
||||||
<i class="fe-maximize noti-icon"></i>
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<!-- <li class="dropdown d-none d-lg-inline-block">
|
||||||
|
<a class="nav-link dropdown-toggle arrow-none waves-effect waves-light" data-toggle="fullscreen" href="#">
|
||||||
|
<i class="fe-maximize noti-icon"></i>
|
||||||
|
</a>
|
||||||
|
</li> -->
|
||||||
|
|
||||||
|
|
||||||
<li class="dropdown notification-list topbar-dropdown">
|
<li class="dropdown notification-list topbar-dropdown">
|
||||||
<a class="nav-link dropdown-toggle nav-user mr-0 waves-effect waves-light" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
|
<a class="nav-link dropdown-toggle nav-user mr-0 waves-effect waves-light" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
|
||||||
|
|
||||||
<span class="pro-user-name ml-1">
|
<span class="pro-user-name ml-1">
|
||||||
<?php echo session()->get('logged_user_name'); ?><i class="mdi mdi-chevron-down"></i>
|
<?php echo session()->get('logged_user_name'); ?><i class="mdi mdi-chevron-down"></i>
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
<span class="pro-user-name ml-1" style="margin-top: -27px;position: absolute;color:#c9cdce;"><?php echo session()->get("logged_user_role") ?></span>
|
|
||||||
<div class="dropdown-menu dropdown-menu-right profile-dropdown ">
|
<div class="dropdown-menu dropdown-menu-right profile-dropdown ">
|
||||||
<!-- item-->
|
<!-- item-->
|
||||||
|
|
||||||
@ -385,8 +390,6 @@
|
|||||||
<span>Branches</span>
|
<span>Branches</span>
|
||||||
</a>
|
</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<!-- <div class="dropdown-divider"></div> -->
|
|
||||||
|
|
||||||
<!-- item-->
|
<!-- item-->
|
||||||
<a href="<?php echo base_url("log_out")?>" class="dropdown-item notify-item">
|
<a href="<?php echo base_url("log_out")?>" class="dropdown-item notify-item">
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user