CHANGE_MECHANIC_LOGIN:ss
This commit is contained in:
parent
5b719c4680
commit
8e454e7849
@ -16,6 +16,8 @@ use App\Models\BikemakeModel;
|
||||
use App\Models\VehicleModel;
|
||||
use App\Models\SalesOrderModel;
|
||||
use App\Models\SalesOrderProductModel;
|
||||
use App\Models\UsersModel;
|
||||
use App\Models\RoleModel;
|
||||
use Mpdf\Mpdf;
|
||||
class Jobcard extends BaseController
|
||||
{
|
||||
@ -35,7 +37,9 @@ class Jobcard extends BaseController
|
||||
{
|
||||
|
||||
$JobcardModel = new JobcardModel();
|
||||
$jobs=$JobcardModel->getJobCardsWithProductsAndService($this->session->get('logged_user_branch_id'));
|
||||
$data['id'] = $this->session->get('logged_user');
|
||||
$data['role'] = $this->session->get('logged_user_role');
|
||||
$jobs=$JobcardModel->getJobCardsWithProductsAndService($this->session->get('logged_user_branch_id'), $data);
|
||||
$data['jobs']=$jobs;
|
||||
// echo "<pre>";
|
||||
// print_r($jobs);die;
|
||||
@ -74,6 +78,7 @@ class Jobcard extends BaseController
|
||||
|
||||
} else if ($job_card_id !== '0')
|
||||
{
|
||||
// echo json_encode($this->session->get('logged_user_role'));die;
|
||||
$productModel = new ProductModel();
|
||||
$JobcardModel = new JobcardModel();
|
||||
$JobcardProductModel = new JobcardProductModel();
|
||||
@ -178,9 +183,15 @@ class Jobcard extends BaseController
|
||||
// print_r($jobs_product);die;
|
||||
$VehicleModel = new VehicleModel();
|
||||
$vehicle=$VehicleModel->where('isactive',1)->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
|
||||
$data['vehicle']=$vehicle;
|
||||
$data['vehicle']=$vehicle;
|
||||
|
||||
if($this->session->get('logged_user_role') == "Floor Manager")
|
||||
{
|
||||
$RoleModel = new RoleModel();
|
||||
$data['workers'] = $RoleModel->get_workers($this->session->get('logged_user_branch_id'));
|
||||
// echo json_encode($data['workers']);die;
|
||||
}
|
||||
}
|
||||
// print_r($data);die;
|
||||
$data['job_card_id'] = $job_card_id;
|
||||
$bikeMakeModel = new BikeMakeModel();
|
||||
$data['makeData'] =$bikeMakeModel->findAll();
|
||||
@ -212,6 +223,8 @@ class Jobcard extends BaseController
|
||||
'billing_state' => $this->request->getPost('state'),
|
||||
'billing_postal_code' => $this->request->getPost('postalcode'),
|
||||
'status'=> $this->request->getPost('status'),
|
||||
'assigned_to'=> json_encode($this->request->getPost('assigned_to')),
|
||||
'store_item_issued'=> $this->request->getPost('store_item_issued'),
|
||||
'subtotal'=> $this->request->getPost('sub_total'),
|
||||
'tax'=> $this->request->getPost('invoicetax'),
|
||||
'total'=> $this->request->getPost('grand_total'),
|
||||
@ -254,30 +267,7 @@ class Jobcard extends BaseController
|
||||
$service_id = $item->id;
|
||||
}
|
||||
|
||||
if(isset($item->product)) {
|
||||
// Insert into the product table
|
||||
$id = [];
|
||||
foreach ($item->product as $pt) {
|
||||
$product['job_card_id'] = $job_card_id;
|
||||
$product['product_id'] = $pt->p_id;
|
||||
$product['qty'] = $pt->qty;
|
||||
$product['tax'] = $pt->tax;
|
||||
$product['amount'] = $pt->amount;
|
||||
if(empty($pt->id)) {
|
||||
$JobcardProductModel->insert($product);
|
||||
$job_card_product_id = $JobcardProductModel->getInsertID();
|
||||
}
|
||||
else {
|
||||
$JobcardProductModel->update($pt->id, $product);
|
||||
$job_card_product_id = $pt->id;
|
||||
}
|
||||
array_push($id, $job_card_product_id);
|
||||
}
|
||||
$res = $JobcardServiceModel->update($service_id, ['product_id' => json_encode($id) ]);
|
||||
if($res) {
|
||||
$this->product_data_maintanence($id, $status);
|
||||
}
|
||||
}
|
||||
if(isset($item->product)) { $this->product_data_insertion($job_card_id, $service_id, $JobcardServiceModel, $item, $JobcardProductModel, $status); }
|
||||
}
|
||||
|
||||
/********** INSERT COMPLAINT DATA ************/
|
||||
@ -300,30 +290,7 @@ class Jobcard extends BaseController
|
||||
$complaint_id = $item->id;
|
||||
}
|
||||
|
||||
if(isset($item->product)) {
|
||||
// Insert into the product table
|
||||
$id = [];
|
||||
foreach ($item->product as $pt) {
|
||||
$product['job_card_id'] = $job_card_id;
|
||||
$product['product_id'] = $pt->p_id;
|
||||
$product['qty'] = $pt->qty;
|
||||
$product['tax'] = $pt->tax;
|
||||
$product['amount'] = $pt->amount;
|
||||
if(empty($pt->id)) {
|
||||
$JobcardProductModel->insert($product);
|
||||
$job_card_product_id = $JobcardProductModel->getInsertID();
|
||||
}
|
||||
else {
|
||||
$JobcardProductModel->update($pt->id, $product);
|
||||
$job_card_product_id = $pt->id;
|
||||
}
|
||||
array_push($id, $job_card_product_id);
|
||||
}
|
||||
$res =$JobcardComplaintModel->update($complaint_id, ['product_id' => json_encode($id) ]);
|
||||
if($res) {
|
||||
$this->product_data_maintanence($id, $status);
|
||||
}
|
||||
}
|
||||
if(isset($item->product)) { $this->product_data_insertion($job_card_id, $complaint_id, $JobcardComplaintModel, $item, $JobcardProductModel, $status); }
|
||||
}
|
||||
|
||||
/********** INSERT CUSTOM COMPLAINT DATA ************/
|
||||
@ -346,35 +313,38 @@ class Jobcard extends BaseController
|
||||
$cc_complaint_id = $item->id;
|
||||
}
|
||||
|
||||
if(isset($item->product)) {
|
||||
// Insert into the product table
|
||||
$id = [];
|
||||
foreach ($item->product as $pt) {
|
||||
$product['job_card_id'] = $job_card_id;
|
||||
$product['product_id'] = $pt->p_id;
|
||||
$product['qty'] = $pt->qty;
|
||||
$product['tax'] = $pt->tax;
|
||||
$product['amount'] = $pt->amount;
|
||||
if(empty($pt->id)) {
|
||||
$JobcardProductModel->insert($product);
|
||||
$job_card_product_id = $JobcardProductModel->getInsertID();
|
||||
}
|
||||
else {
|
||||
$JobcardProductModel->update($pt->id, $product);
|
||||
$job_card_product_id = $pt->id;
|
||||
}
|
||||
array_push($id, $job_card_product_id);
|
||||
}
|
||||
$res =$JobcardCustomComplaintModel->update($cc_complaint_id, ['product_id' => json_encode($id) ]);
|
||||
if($res) {
|
||||
$this->product_data_maintanence($id, $status);
|
||||
}
|
||||
}
|
||||
if(isset($item->product)) { $this->product_data_insertion($job_card_id, $cc_complaint_id, $JobcardCustomComplaintModel, $item, $JobcardProductModel, $status); }
|
||||
}
|
||||
|
||||
return redirect()->to('job_card_index');
|
||||
}
|
||||
|
||||
public function product_data_insertion($job_card_id, $parent_id, $ParentModel, $item, $JobcardProductModel, $status)
|
||||
{
|
||||
// Insert into the product table
|
||||
$id = [];
|
||||
foreach ($item->product as $pt) {
|
||||
$product['job_card_id'] = $job_card_id;
|
||||
$product['product_id'] = $pt->p_id;
|
||||
$product['qty'] = $pt->qty;
|
||||
$product['tax'] = $pt->tax;
|
||||
$product['amount'] = $pt->amount;
|
||||
if(empty($pt->id)) {
|
||||
$JobcardProductModel->insert($product);
|
||||
$job_card_product_id = $JobcardProductModel->getInsertID();
|
||||
}
|
||||
else {
|
||||
$JobcardProductModel->update($pt->id, $product);
|
||||
$job_card_product_id = $pt->id;
|
||||
}
|
||||
array_push($id, $job_card_product_id);
|
||||
}
|
||||
$res =$ParentModel->update($parent_id, ['product_id' => json_encode($id) ]);
|
||||
if($res) {
|
||||
$this->product_data_maintanence($id, $status);
|
||||
}
|
||||
}
|
||||
|
||||
public function delete_items($delArr)
|
||||
{
|
||||
$JobcardServiceModel = new JobcardServiceModel();
|
||||
|
||||
@ -163,7 +163,10 @@ class Products extends BaseController
|
||||
'specification' => $this->request->getPost('specification'),
|
||||
'hsn_sac' => $this->request->getPost('hsn_sac'),
|
||||
'isactive' => 1 ,
|
||||
'branch_id' => $this->session->get('logged_user_branch_id')
|
||||
'branch_id' => $this->session->get('logged_user_branch_id'),
|
||||
|
||||
'total_amount' => $this->session->get('total_amount'),
|
||||
'per' => $this->session->get('per')
|
||||
];
|
||||
|
||||
$product_id = $this->request->getPost('product_id');
|
||||
|
||||
@ -8,17 +8,20 @@ class JobcardModel extends Model
|
||||
protected $allowedFields = ['job_card_id','vehicle_id','branch_id',
|
||||
'order_number','client_mobile_no','client_name',
|
||||
'billing_address','billing_city','billing_state','billing_country',
|
||||
'billing_postal_code','status','subtotal','tax','total','isactive'];
|
||||
'billing_postal_code','status','assigned_to', 'store_item_issued','subtotal','tax','total','isactive'];
|
||||
|
||||
|
||||
|
||||
public function getJobCardsWithProductsAndService($logged_user_branch_id)
|
||||
public function getJobCardsWithProductsAndService($logged_user_branch_id,$data)
|
||||
{
|
||||
$this->select('job_card.*, COUNT(job_card_product.job_card_id) AS product_count, vehicle.reg_no');
|
||||
$this->join('job_card_product', 'job_card_product.job_card_id = job_card.job_card_id', 'left');
|
||||
$this->join('vehicle', 'vehicle.vehicle_id = job_card.vehicle_id', 'left');
|
||||
$this->groupBy('job_card.job_card_id');
|
||||
$this->where('job_card.isactive', 1);
|
||||
if ($data['role'] == 'Senior Mechanic' || $data['role'] == 'Mechanic') {
|
||||
$this->where("JSON_CONTAINS(assigned_to, '" . json_encode($data['id']) . "')", null, false);
|
||||
}
|
||||
$this->where('job_card.branch_id',$logged_user_branch_id);
|
||||
$this->orderBy('job_card.job_card_id','DESC');
|
||||
return $this->findAll();
|
||||
|
||||
@ -5,7 +5,11 @@ 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','specification','hsn_sac','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','total_amount',
|
||||
'per'];
|
||||
|
||||
|
||||
public function getTax()
|
||||
|
||||
@ -6,12 +6,23 @@ class RoleModel extends Model
|
||||
protected $table = 'roles';
|
||||
protected $primaryKey = 'role_id';
|
||||
protected $allowedFields = ['role_id','roles','isactive'];
|
||||
public function getRoles(){
|
||||
return $this->where('roles !=', 'Super Admin')->findAll();
|
||||
}
|
||||
public function getRoleNameById($roleId)
|
||||
{
|
||||
$role = $this->where('role_id', $roleId)->first();
|
||||
return $role ? $role['roles'] : 'Unknown';
|
||||
}
|
||||
public function getRoles(){
|
||||
return $this->where('roles !=', 'Super Admin')->findAll();
|
||||
}
|
||||
public function getRoleNameById($roleId)
|
||||
{
|
||||
$role = $this->where('role_id', $roleId)->first();
|
||||
return $role ? $role['roles'] : 'Unknown';
|
||||
}
|
||||
|
||||
public function get_workers($logged_user_branch_id)
|
||||
{
|
||||
$this->select('roles.*,users.user_id, users.name, users.business_id, users.branch_id, users.role, users.mobile_no, users.isactive');
|
||||
$this->join('users', 'users.role = roles.role_id');
|
||||
$this->where('roles.isactive', 1);
|
||||
$this->where('users.isactive', 1);
|
||||
$this->whereIn('roles.roles', ['Mechanic','Helper']);
|
||||
$this ->where('users.branch_id',$logged_user_branch_id);
|
||||
return $this->findAll();
|
||||
}
|
||||
}
|
||||
@ -94,6 +94,32 @@
|
||||
<?php endif; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<?php if(isset($workers) && $jobs['status'] == 'Paid') { ?>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="inputPassword4" class="col-form-label">Assign To</label>
|
||||
<select class="form-control SelExample" name="assigned_to[]" id="assigned_to" required multiple>
|
||||
<?= isset($jobs['assigned_to']) ? '' : '<option value="">Select a Make</option>' ?>
|
||||
<?php foreach ($workers as $value) : ?>
|
||||
<?php if ((int)$value["isactive"] === 1) : ?>
|
||||
<option value="<?= $value["user_id"] ?>" <?= isset($jobs['assigned_to']) && in_array($value["user_id"], json_decode($jobs['assigned_to'])) ? 'selected' : '' ?>>
|
||||
<?= $value["name"]; ?>
|
||||
</option>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if(session()->get('logged_user_role') == 'Store Manager') { ?>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="inputPassword4" class="col-form-label">Item Issued</label>
|
||||
<select class="form-control SelExample" name="store_item_issued" id="store_item_issued" required>
|
||||
<option value="0" <?= isset($jobs['store_item_issued']) && ($jobs["store_item_issued"] == 0) ? 'selected' : '' ?> >Not Issued Item</option>
|
||||
<option value="1" <?= isset($jobs['store_item_issued']) && ($jobs["store_item_issued"] == 1) ? 'selected' : '' ?> >Item Issued</option>
|
||||
</select>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="form-row" id="itemTableContainer">
|
||||
<div class="form-group col-md-12">
|
||||
@ -938,7 +964,7 @@ $(document).ready(async function() {
|
||||
'<td style="width:10%;"><input type="text" class="form-control item-rate" name="unit-price[]" readonly /></td>' +
|
||||
'<td style="width:8%;"><input type="text" class="form-control item-tax" name="item-tax[]" readonly /></td>' +
|
||||
'<td style="width:12%;"><input type="text" class="form-control item-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" id="remove-item"></i></center><input value="service" name="item_type" hidden></td>' +
|
||||
'<td hidden><input type="hidden" name="id"></td>' +
|
||||
'</tr>';
|
||||
|
||||
|
||||
@ -44,8 +44,13 @@
|
||||
<th>Client Name</th>
|
||||
<th>Client Mobile</th>
|
||||
<th>Quantity</th>
|
||||
<th>Subtotal</th>
|
||||
<th>Tax</th>
|
||||
<?php if(session()->get('logged_user_role') != 'Store Manager') { ?>
|
||||
<th>Subtotal</th>
|
||||
<th>Tax</th>
|
||||
<?php }
|
||||
else { ?>
|
||||
<th>Issued From The Store</th>
|
||||
<?php } ?>
|
||||
<th>Total</th>
|
||||
<th>Status</th>
|
||||
<th>Actions</th>
|
||||
@ -62,8 +67,13 @@
|
||||
<td><?= $value['client_name']; ?></td>
|
||||
<td><?= $value['client_mobile_no']; ?></td>
|
||||
<td><?= $value['product_count']; ?></td>
|
||||
<td><?= $value['subtotal']; ?></td>
|
||||
<td><?= $value['tax']; ?></td>
|
||||
<?php if(session()->get('logged_user_role') != 'Store Manager') { ?>
|
||||
<td><?= $value['subtotal']; ?></td>
|
||||
<td><?= $value['tax']; ?></td>
|
||||
<?php }
|
||||
else { ?>
|
||||
<td><?php echo $value['store_item_issued'] == 0 ? "Not Issued" : "Item Issued"; ?></td>
|
||||
<?php } ?>
|
||||
<td><?= $value['total']; ?></td>
|
||||
<td><?= $value['status']; ?></td>
|
||||
<td>
|
||||
|
||||
@ -148,7 +148,10 @@
|
||||
|
||||
<?php if(session()->get('logged_user_role') == 'Floor Manager' ||
|
||||
session()->get('logged_user_role') == 'Administrator' ||
|
||||
session()->get('logged_user_role') == 'Job Card Manager') {
|
||||
session()->get('logged_user_role') == 'Job Card Manager' ||
|
||||
session()->get('logged_user_role') == 'Store Manager' ||
|
||||
session()->get('logged_user_role') == 'Senior Mechanic' ||
|
||||
session()->get('logged_user_role') == 'Mechanic') {
|
||||
?>
|
||||
|
||||
|
||||
@ -164,12 +167,14 @@
|
||||
<li>
|
||||
<a href="<?php echo base_url('job_card_index') ?>">Job Card</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo base_url('vehicle_index') ?>">Vehicles</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo base_url('client_index') ?>">Clients</a>
|
||||
</li>
|
||||
<?php if(session()->get('logged_user_role') == 'Floor Manager' || session()->get('logged_user_role') == 'Administrator' || session()->get('logged_user_role') == 'Job Card Manager') { ?>
|
||||
<li>
|
||||
<a href="<?php echo base_url('vehicle_index') ?>">Vehicles</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo base_url('client_index') ?>">Clients</a>
|
||||
</li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@ -183,19 +183,15 @@
|
||||
<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">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">Unit Price<span class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control" name="unit_price" placeholder="Price"value="<?= isset($products['unit_price']) ? $products['unit_price'] : '' ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4" hidden>
|
||||
<label for="inputPassword4" class="col-form-label">Commision Rate</label>
|
||||
<input type="number" class="form-control" name="commision_rate" placeholder="Commision Rate"value="<?= isset($products['commision_rate']) ? $products['commision_rate'] : '' ?>" >
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="inputPassword4" class="col-form-label">Purchase Cost<span class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control" name="purchase_cost" placeholder="Purchase Cost"value="<?= isset($products['purchase_cost']) ? $products['purchase_cost'] : '' ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="inputPassword4" class="col-form-label">Unit Price<span class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control" name="unit_price" placeholder="Price"value="<?= isset($products['unit_price']) ? $products['unit_price'] : '' ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="inputPassword4" class="col-form-label">Tax</label>
|
||||
<select class="form-control status-select" name="tax" required data-toggle="select2">
|
||||
<?php
|
||||
@ -208,26 +204,37 @@
|
||||
<option value="28" <?= ($tax == 28) ? 'selected' : '' ?>>28%</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="inputPassword4" class="col-form-label">Unit Price + Tax</label>
|
||||
<input type="number" class="form-control" name="total_amount" placeholder="Total Price"value="<?= isset($products['total_amount']) ? $products['total_amount'] : '' ?>" required readonly>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><br>
|
||||
<h4 class="header-title">Stock Information :</h4><br>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">Qty in Stock<span class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control" id="qty_in_stock" name="qty_in_stock" placeholder="Qty in Stock" value="<?= isset($products['qty_stock']) ? $products['qty_stock'] : '' ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">Purchase Order Level<span class="text-danger"></span></label>
|
||||
<input type="number" class="form-control" id="purchase_order_level" name="purchase_order_level" placeholder="Purchase Order Level" value="<?= isset($products['purchase_order_level']) ? $products['purchase_order_level'] : '' ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">Purchase Re-Order Level<span class="text-danger"></span></label>
|
||||
<input type="number" class="form-control" id="purchase_reorder_level" name="reorder_level" placeholder="Purchase Re-Order Level" value="<?= isset($products['reorder_level']) ? $products['reorder_level'] : '' ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="inputPassword4" class="col-form-label">Unit of Measurement<span class="text-danger">*</span></label>
|
||||
<select class="form-control status-select" name="per" required data-toggle="select2">
|
||||
<option value="" <?= (isset($products['per']) && $products['per'] == '') ? 'selected' : '' ?>>Select</option>
|
||||
<option value="Nos" <?= (isset($products['per']) && $products['per'] == 'Nos') ?'selected' : '' ?>>nos</option>
|
||||
<option value="ml" <?= (isset($products['per']) && $products['per'] == 'ml') ? 'selected' : '' ?>>ml</option>
|
||||
<option value="litre" <?= (isset($products['per']) && $products['per'] == 'litre') ? 'selected' : '' ?>>litre</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="inputPassword4" class="col-form-label">Qty in Stock<span class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control" id="qty_in_stock" name="qty_in_stock" placeholder="Qty in Stock" value="<?= isset($products['qty_stock']) ? $products['qty_stock'] : '' ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="inputPassword4" class="col-form-label">Purchase Order Level<span class="text-danger"></span></label>
|
||||
<input type="number" class="form-control" id="purchase_order_level" name="purchase_order_level" placeholder="Purchase Order Level" value="<?= isset($products['purchase_order_level']) ? $products['purchase_order_level'] : '' ?>" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="inputPassword4" class="col-form-label">Purchase Re-Order Level<span class="text-danger"></span></label>
|
||||
<input type="number" class="form-control" id="purchase_reorder_level" name="reorder_level" placeholder="Purchase Re-Order Level" value="<?= isset($products['reorder_level']) ? $products['reorder_level'] : '' ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4" hidden>
|
||||
<label for="inputPassword4" class="col-form-label">Qty in Demand</label>
|
||||
@ -313,6 +320,23 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
/** CALCULATE TOTAL AMOUNT ( UNIT PRICE + TAX ) */
|
||||
$(document).ready(function() {
|
||||
function calculateTotalAmount() {
|
||||
var unitPrice = parseFloat($("input[name='unit_price']").val());
|
||||
var tax = parseFloat($("select[name='tax']").val());
|
||||
var totalAmount = unitPrice + (unitPrice * tax / 100);
|
||||
$("input[name='total_amount']").val(totalAmount.toFixed(2));
|
||||
}
|
||||
|
||||
$("input[name='unit_price'], select[name='tax']").change(function() {
|
||||
calculateTotalAmount();
|
||||
});
|
||||
|
||||
calculateTotalAmount();
|
||||
});
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
// Check SGST checkbox by default
|
||||
$('#sgstCheckbox').prop('checked', true);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user