CHANGE_COMPLAINT_ADD_TAX_IGST_TO_SGST : AADHAVAN
This commit is contained in:
parent
873b1350cd
commit
7e309f9594
@ -29,9 +29,18 @@ class Complaint extends BaseController
|
|||||||
{
|
{
|
||||||
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
"name" => $this->request->getPost('name'),
|
||||||
|
"labour_charge" => $this->request->getPost('labour_charge'),
|
||||||
|
"cgst" => $this->request->getPost('tax')/2,
|
||||||
|
"sgst" => $this->request->getPost('tax')/2,
|
||||||
|
"tax" => $this->request->getPost('tax')
|
||||||
|
];
|
||||||
|
|
||||||
if (!$complaint_id) {
|
if (!$complaint_id) {
|
||||||
$ComplaintModel = new ComplaintModel();
|
$ComplaintModel = new ComplaintModel();
|
||||||
$data = $this->request->getPost();
|
// $data = $this->request->getPost();
|
||||||
$inserted = $ComplaintModel->insert($data);
|
$inserted = $ComplaintModel->insert($data);
|
||||||
if ($inserted) {
|
if ($inserted) {
|
||||||
$result = $data;
|
$result = $data;
|
||||||
@ -42,7 +51,7 @@ class Complaint extends BaseController
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$ComplaintModel = new ComplaintModel();
|
$ComplaintModel = new ComplaintModel();
|
||||||
$data = $this->request->getPost();
|
// $data = $this->request->getPost();
|
||||||
$updated = $ComplaintModel->update($complaint_id,$data);
|
$updated = $ComplaintModel->update($complaint_id,$data);
|
||||||
if ($updated) {
|
if ($updated) {
|
||||||
$result = $data;
|
$result = $data;
|
||||||
|
|||||||
@ -151,7 +151,7 @@ class Service extends BaseController
|
|||||||
'category' => $this->request->getPost('category'),
|
'category' => $this->request->getPost('category'),
|
||||||
'product_id' => json_encode($this->request->getPost('product_id')),
|
'product_id' => json_encode($this->request->getPost('product_id')),
|
||||||
'cgst' => $tax,
|
'cgst' => $tax,
|
||||||
'igst' => $tax,
|
'sgst' => $tax,
|
||||||
'tax' => $this->request->getPost('tax'),
|
'tax' => $this->request->getPost('tax'),
|
||||||
'labour_cost' => $this->request->getPost('labour_cost'),
|
'labour_cost' => $this->request->getPost('labour_cost'),
|
||||||
'price' => $this->request->getPost('price'),
|
'price' => $this->request->getPost('price'),
|
||||||
|
|||||||
@ -5,5 +5,5 @@ class ComplaintModel extends Model
|
|||||||
{
|
{
|
||||||
protected $table = 'complaints';
|
protected $table = 'complaints';
|
||||||
protected $primaryKey = 'complaint_id';
|
protected $primaryKey = 'complaint_id';
|
||||||
protected $allowedFields = ['complaint_id','name','labour_charge','isactive'];
|
protected $allowedFields = ['complaint_id','name','labour_charge','cgst','sgst','tax','isactive'];
|
||||||
}
|
}
|
||||||
@ -5,7 +5,7 @@ class ServiceModel extends Model
|
|||||||
{
|
{
|
||||||
protected $table = 'services';
|
protected $table = 'services';
|
||||||
protected $primaryKey = 'service_id';
|
protected $primaryKey = 'service_id';
|
||||||
protected $allowedFields = ['service_id','branch_id','category','service_name','labour_cost','cgst','igst','price','tax','description','makes_id','models_id','product_id','sub_service_id','isactive'];
|
protected $allowedFields = ['service_id','branch_id','category','service_name','labour_cost','cgst','sgst','price','tax','description','makes_id','models_id','product_id','sub_service_id','isactive'];
|
||||||
|
|
||||||
|
|
||||||
public function getTax()
|
public function getTax()
|
||||||
|
|||||||
@ -5,7 +5,7 @@ class ServicesModel extends Model
|
|||||||
{
|
{
|
||||||
protected $table = 'services';
|
protected $table = 'services';
|
||||||
protected $primaryKey = 'service_id';
|
protected $primaryKey = 'service_id';
|
||||||
protected $allowedFields = ['service_id','service_name','price','commission_rate','cgst','igst','purchase_cost','description','isactive'];
|
protected $allowedFields = ['service_id','service_name','price','commission_rate','cgst','sgst','purchase_cost','description','isactive'];
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -70,6 +70,16 @@
|
|||||||
<label for="labour_charge">Labour Charge </label>
|
<label for="labour_charge">Labour Charge </label>
|
||||||
<input class="form-control" type="text" id="labour_charge" required="" placeholder="Labour Charge....">
|
<input class="form-control" type="text" id="labour_charge" required="" placeholder="Labour Charge....">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="labour_charge">Tax </label>
|
||||||
|
<select class="form-control status-select" id="tax" name="tax" required data-toggle="select2">
|
||||||
|
<option value="0">0%</option>
|
||||||
|
<option value="5" >5%</option>
|
||||||
|
<option value="12">12%</option>
|
||||||
|
<option value="18">18%</option>
|
||||||
|
<option value="28" >28%</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<div class="form-group text-center">
|
<div class="form-group text-center">
|
||||||
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitComplaint(this)">Submit</button>
|
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitComplaint(this)">Submit</button>
|
||||||
</div>
|
</div>
|
||||||
@ -88,6 +98,7 @@
|
|||||||
var formData = {
|
var formData = {
|
||||||
name: $('#name').val(),
|
name: $('#name').val(),
|
||||||
labour_charge: $('#labour_charge').val(),
|
labour_charge: $('#labour_charge').val(),
|
||||||
|
tax: $('#tax').val()
|
||||||
};
|
};
|
||||||
var complaint_id = $('#complaint_id').val();
|
var complaint_id = $('#complaint_id').val();
|
||||||
if (!complaint_id) {
|
if (!complaint_id) {
|
||||||
@ -124,6 +135,17 @@
|
|||||||
$('#complaint_id').val(response.complaint[0].complaint_id);
|
$('#complaint_id').val(response.complaint[0].complaint_id);
|
||||||
$('#name').val(response.complaint[0].name);
|
$('#name').val(response.complaint[0].name);
|
||||||
$('#labour_charge').val(response.complaint[0].labour_charge);
|
$('#labour_charge').val(response.complaint[0].labour_charge);
|
||||||
|
|
||||||
|
var tax = parseFloat(response.complaint[0].cgst) + parseFloat(response.complaint[0].sgst);
|
||||||
|
var selectElement = document.getElementById('tax');
|
||||||
|
var options = selectElement.options;
|
||||||
|
for (var i = 0; i < options.length; i++) {
|
||||||
|
if (parseInt(options[i].value) === tax) {
|
||||||
|
options[i].selected = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
// Handle error response here
|
// Handle error response here
|
||||||
|
|||||||
@ -439,13 +439,11 @@
|
|||||||
var product = services.find(function(item) {
|
var product = services.find(function(item) {
|
||||||
return item.service_id == productId;
|
return item.service_id == productId;
|
||||||
});
|
});
|
||||||
console.log("3333333");
|
|
||||||
console.log(product);
|
|
||||||
var cgst = parseFloat(product.cgst);
|
var cgst = parseFloat(product.cgst);
|
||||||
var igst = parseFloat(product.igst);
|
var sgst = parseFloat(product.sgst);
|
||||||
|
|
||||||
// Calculate total tax by adding CGST and SGST
|
// Calculate total tax by adding CGST and SGST
|
||||||
var tax = cgst + igst;
|
var tax = cgst + sgst;
|
||||||
$(row).find('.item-tax-service').val(tax.toFixed(2));
|
$(row).find('.item-tax-service').val(tax.toFixed(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -99,8 +99,8 @@
|
|||||||
<select class="form-control status-select" name="tax" required data-toggle="select2">
|
<select class="form-control status-select" name="tax" required data-toggle="select2">
|
||||||
<?php
|
<?php
|
||||||
$cgst = isset($services['cgst']) ? $services['cgst'] : 0; // CGST value (half of the tax amount)
|
$cgst = isset($services['cgst']) ? $services['cgst'] : 0; // CGST value (half of the tax amount)
|
||||||
$igst = isset($services['igst']) ? $services['igst'] : 0; // IGST value (half of the tax amount)
|
$sgst = isset($services['sgst']) ? $services['sgst'] : 0; // SGST value (half of the tax amount)
|
||||||
$tax = $cgst + $igst; // Total tax (sum of CGST and IGST)
|
$tax = $cgst + $sgst; // Total tax (sum of CGST and SGST)
|
||||||
?>
|
?>
|
||||||
<option value="0" <?= ($tax == 0) ? 'selected' : '' ?>>0%</option>
|
<option value="0" <?= ($tax == 0) ? 'selected' : '' ?>>0%</option>
|
||||||
<option value="5" <?= ($tax == 5) ? 'selected' : '' ?>>5%</option>
|
<option value="5" <?= ($tax == 5) ? 'selected' : '' ?>>5%</option>
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
<!-- <th>Model List</th> -->
|
<!-- <th>Model List</th> -->
|
||||||
<th>Price</th>
|
<th>Price</th>
|
||||||
<th>Cgst</th>
|
<th>Cgst</th>
|
||||||
<th>Igst</th>
|
<th>Sgst</th>
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -41,7 +41,7 @@
|
|||||||
<!-- <td><?= $value['models_names']; ?></td> -->
|
<!-- <td><?= $value['models_names']; ?></td> -->
|
||||||
<td><?= $value['price']; ?></td>
|
<td><?= $value['price']; ?></td>
|
||||||
<td><?= $value['cgst']; ?></td>
|
<td><?= $value['cgst']; ?></td>
|
||||||
<td><?= $value['igst']; ?></td>
|
<td><?= $value['sgst']; ?></td>
|
||||||
<td><?= $value['description']; ?></td>
|
<td><?= $value['description']; ?></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="<?= "new_service/" . $value['service_id']; ?>" class="edit-button">
|
<a href="<?= "new_service/" . $value['service_id']; ?>" class="edit-button">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user