Merge branch 'main' of bitbucket.org:venbainformationtechnology/the_mechanic into main
This commit is contained in:
commit
7a8d4041c9
@ -103,6 +103,7 @@ $routes->get('vendor_index/', 'Vendor::vendor_index');
|
|||||||
$routes->post("add_vendor", "Vendor::add_vendor");
|
$routes->post("add_vendor", "Vendor::add_vendor");
|
||||||
$routes->get("new_vendor/(:any)", "Vendor::new_vendor/$1");
|
$routes->get("new_vendor/(:any)", "Vendor::new_vendor/$1");
|
||||||
$routes->get("delete_vendor/(:any)", "Vendor::delete_vendor/$1");
|
$routes->get("delete_vendor/(:any)", "Vendor::delete_vendor/$1");
|
||||||
|
$routes->get("get_product_by_vendor/(:any)", "Vendor::get_product_by_vendor/$1");
|
||||||
$routes->post("fetch_models", "Vendor::fetch_models");
|
$routes->post("fetch_models", "Vendor::fetch_models");
|
||||||
//end Vendor
|
//end Vendor
|
||||||
|
|
||||||
|
|||||||
@ -35,12 +35,12 @@ class Complaint extends BaseController
|
|||||||
"labour_charge" => $this->request->getPost('labour_charge'),
|
"labour_charge" => $this->request->getPost('labour_charge'),
|
||||||
"cgst" => $this->request->getPost('tax')/2,
|
"cgst" => $this->request->getPost('tax')/2,
|
||||||
"sgst" => $this->request->getPost('tax')/2,
|
"sgst" => $this->request->getPost('tax')/2,
|
||||||
"tax" => $this->request->getPost('tax')
|
"tax" => $this->request->getPost('tax'),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!$complaint_id) {
|
if (!$complaint_id) {
|
||||||
$ComplaintModel = new ComplaintModel();
|
$ComplaintModel = new ComplaintModel();
|
||||||
// $data = $this->request->getPost();
|
$data['business_id'] = $this->session->get('logged_user_business_id');
|
||||||
$inserted = $ComplaintModel->insert($data);
|
$inserted = $ComplaintModel->insert($data);
|
||||||
if ($inserted) {
|
if ($inserted) {
|
||||||
$result = $data;
|
$result = $data;
|
||||||
|
|||||||
@ -59,7 +59,7 @@ class Model extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create_model($model_id)
|
public function create_model($model_id = 0)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$make_id = $this->request->getPost('make_id');
|
$make_id = $this->request->getPost('make_id');
|
||||||
@ -70,9 +70,9 @@ class Model extends BaseController
|
|||||||
'make_id' => $make_id,
|
'make_id' => $make_id,
|
||||||
'model_name' => $model_name
|
'model_name' => $model_name
|
||||||
];
|
];
|
||||||
|
// print_r($model_id);die;
|
||||||
|
|
||||||
if (!$model_id) {
|
if (!$model_id) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$inserted = $BikemodelsModel->insert($data);
|
$inserted = $BikemodelsModel->insert($data);
|
||||||
} catch (\CodeIgniter\Database\Exceptions\DatabaseException $e) {
|
} catch (\CodeIgniter\Database\Exceptions\DatabaseException $e) {
|
||||||
@ -90,6 +90,7 @@ class Model extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
$updated = $BikemodelsModel->update($model_id ,$data);
|
$updated = $BikemodelsModel->update($model_id ,$data);
|
||||||
if ($updated) {
|
if ($updated) {
|
||||||
$result = $data;
|
$result = $data;
|
||||||
|
|||||||
@ -291,6 +291,7 @@ class Purchase extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// print_r($child_data);die;
|
// print_r($child_data);die;
|
||||||
|
|
||||||
if (!empty($purchase_order_child_id[$key])) {
|
if (!empty($purchase_order_child_id[$key])) {
|
||||||
|
|
||||||
// print_r($purchase_order_child_id[$key]);die;
|
// print_r($purchase_order_child_id[$key]);die;
|
||||||
@ -304,11 +305,11 @@ class Purchase extends BaseController
|
|||||||
$VendorModel = new VendorModel();
|
$VendorModel = new VendorModel();
|
||||||
$vendor = $VendorModel->where('vendor_id',$this->request->getPost('vendor_id'))->findAll();
|
$vendor = $VendorModel->where('vendor_id',$this->request->getPost('vendor_id'))->findAll();
|
||||||
$mail_status = $this->download_purchase_invoice($purchase_order_id, $vendor[0]['vendor_email']);
|
$mail_status = $this->download_purchase_invoice($purchase_order_id, $vendor[0]['vendor_email']);
|
||||||
|
|
||||||
// echo $mail_status;die;
|
// echo $mail_status;die;
|
||||||
$_SESSION['mail_status'] = $mail_status;
|
$_SESSION['mail_status'] = $mail_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->to('purchase_index');
|
return redirect()->to('purchase_index');
|
||||||
@ -417,6 +418,7 @@ public function download_purchase_invoice($purchase_order_id, $mail = null)
|
|||||||
// Fetch the invoice data based on $invoice_id
|
// Fetch the invoice data based on $invoice_id
|
||||||
$model = new PurchaseOrderModel();
|
$model = new PurchaseOrderModel();
|
||||||
$data = $model->getPurchasePdf($purchase_order_id);
|
$data = $model->getPurchasePdf($purchase_order_id);
|
||||||
|
|
||||||
$items = $model->getPurchaseOrderProductsForPdf($purchase_order_id);
|
$items = $model->getPurchaseOrderProductsForPdf($purchase_order_id);
|
||||||
// Create an mPDF object
|
// Create an mPDF object
|
||||||
$mpdf = new Mpdf([
|
$mpdf = new Mpdf([
|
||||||
|
|||||||
@ -27,12 +27,14 @@ class Reorderlevel extends BaseController
|
|||||||
$productModel = new ProductModel();
|
$productModel = new ProductModel();
|
||||||
$reorder = $productModel->select('products.*, vendor.vendor_name as prefered_vendor_name, COUNT(vendor.vendor_name) as product_count')
|
$reorder = $productModel->select('products.*, vendor.vendor_name as prefered_vendor_name, COUNT(vendor.vendor_name) as product_count')
|
||||||
->join('vendor', 'vendor.vendor_id = products.prefered_vendor')
|
->join('vendor', 'vendor.vendor_id = products.prefered_vendor')
|
||||||
->where('products.qty_stock <= purchase_order_level')
|
->where('products.qty_stock <= products.purchase_order_level')
|
||||||
->groupBy('products.prefered_vendor')
|
->groupBy('products.prefered_vendor')
|
||||||
->orderBy('prefered_vendor_name', 'ASC')
|
->orderBy('prefered_vendor_name', 'ASC')
|
||||||
->findAll();
|
->findAll();
|
||||||
// echo json_encode($reorder);die;
|
// echo json_encode($reorder);die;
|
||||||
$data['reorder']=$reorder;
|
$data['reorder']=$reorder;
|
||||||
|
// echo "<pre>";
|
||||||
|
// print_r($reorder);die;
|
||||||
return view('reorder_level_list',$data);
|
return view('reorder_level_list',$data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ use App\Models\UsersModel;
|
|||||||
use App\Models\BikemakeModel;
|
use App\Models\BikemakeModel;
|
||||||
use App\Models\BikemodelsModel;
|
use App\Models\BikemodelsModel;
|
||||||
use App\Models\ManufacturerModel;
|
use App\Models\ManufacturerModel;
|
||||||
|
use App\Models\ProductModel;
|
||||||
|
|
||||||
|
|
||||||
class Vendor extends BaseController
|
class Vendor extends BaseController
|
||||||
@ -154,5 +155,16 @@ class Vendor extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function get_product_by_vendor($vendor_id){
|
||||||
|
|
||||||
|
$productModel = new ProductModel();
|
||||||
|
$reorder = $productModel->select('products.*')
|
||||||
|
->where('products.qty_stock <= products.purchase_order_level')
|
||||||
|
->where('products.prefered_vendor',$vendor_id)
|
||||||
|
->findAll();
|
||||||
|
return json_encode($reorder);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -36,7 +36,7 @@ class PurchaseOrderModel extends Model
|
|||||||
->join('branches as B','B.branch_id = purchase_order.branch_id','left')
|
->join('branches as B','B.branch_id = purchase_order.branch_id','left')
|
||||||
->join('vendor as V','V.vendor_id = purchase_order.vendor_id','left')
|
->join('vendor as V','V.vendor_id = purchase_order.vendor_id','left')
|
||||||
->select('purchase_order.*')
|
->select('purchase_order.*')
|
||||||
->select('V.vendor_name,V.contact_person_mobile1,V.address as vendor_address,V.city as vendor_city,V.state,V.postal_code as vendor_postal,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('V.vendor_name,V.contact_person_mobile1,V.address as vendor_address,V.city as vendor_city,V.state,V.postal_code as vendor_postal,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')
|
||||||
|
|
||||||
->get()
|
->get()
|
||||||
->getResult();
|
->getResult();
|
||||||
|
|||||||
@ -93,14 +93,16 @@
|
|||||||
<script>
|
<script>
|
||||||
function submitModels(params) {
|
function submitModels(params) {
|
||||||
// console.log( $('#modelname').val());
|
// console.log( $('#modelname').val());
|
||||||
var formData = {
|
|
||||||
make_id: $('#make_id').val(),
|
|
||||||
modelname: $('#modelname').val()
|
|
||||||
};
|
|
||||||
var edit_model_id = $('#edit_model_id').val();
|
var edit_model_id = $('#edit_model_id').val();
|
||||||
if (!edit_model_id) {
|
if (!edit_model_id) {
|
||||||
edit_model_id =0;
|
edit_model_id =0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var formData = {
|
||||||
|
make_id: $('#make_id').val(),
|
||||||
|
modelname: $('#modelname').val()
|
||||||
|
};
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: '<?php echo base_url()."create_model/"?>'+edit_model_id,
|
url: '<?php echo base_url()."create_model/"?>'+edit_model_id,
|
||||||
@ -145,6 +147,7 @@
|
|||||||
$('tbody').append(row);
|
$('tbody').append(row);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
window.location.reload();
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
// Handle error response here
|
// Handle error response here
|
||||||
|
|||||||
@ -145,17 +145,21 @@
|
|||||||
make_id: $('#make_id').val(),
|
make_id: $('#make_id').val(),
|
||||||
modelname: $('#modelname').val()
|
modelname: $('#modelname').val()
|
||||||
};
|
};
|
||||||
|
var model_id =0;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: 'create_model/'+$('#make_id').val(),
|
url: 'create_model/'+model_id,
|
||||||
data: formData,
|
data: formData,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
// Handle success response here
|
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
if (response.status == "failed") {
|
||||||
|
toastr.warning(response.data, 'Warning');
|
||||||
|
}else{
|
||||||
$('#bike_model_login-modal').modal('hide');
|
$('#bike_model_login-modal').modal('hide');
|
||||||
$('#modelname').val('');
|
$('#modelname').val('');
|
||||||
|
toastr.success(response.data, 'Success');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
// Handle error response here
|
// Handle error response here
|
||||||
|
|||||||
@ -38,8 +38,8 @@
|
|||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($reorder as $value) : ?>
|
<?php foreach ($reorder as $value) : ?>
|
||||||
<tr>
|
<tr id="<?php echo $value['prefered_vendor']; ?>">
|
||||||
|
<div></div>
|
||||||
<td><?= $value['prefered_vendor_name']; ?></td>
|
<td><?= $value['prefered_vendor_name']; ?></td>
|
||||||
<td><?= $value['product_count']; ?></td>
|
<td><?= $value['product_count']; ?></td>
|
||||||
<!-- <td><?= $value['prefered_vendor_name']; ?></td>
|
<!-- <td><?= $value['prefered_vendor_name']; ?></td>
|
||||||
@ -62,6 +62,25 @@
|
|||||||
</div> <!-- end col -->
|
</div> <!-- end col -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Start Product List Pop-UP -->
|
||||||
|
<div id="product_list_model" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content justify-content-center" style="height: 40vh;">
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="text-center mt-2 mb-4">
|
||||||
|
<h4>Product List</h4>
|
||||||
|
</div>
|
||||||
|
<div class="form-group" id="product_list_model_body">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- /.modal-content -->
|
||||||
|
</div><!-- /.modal-dialog -->
|
||||||
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php include('layout/footer.php'); ?>
|
<?php include('layout/footer.php'); ?>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -111,4 +130,39 @@ $(document).ready(function() {
|
|||||||
"ordering": false
|
"ordering": false
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('tr').click(function () {
|
||||||
|
var vendor_id = $(this).attr('id');
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: '<?php echo base_url()."get_product_by_vendor/"?>'+vendor_id,
|
||||||
|
method: 'GET',
|
||||||
|
success: function(response) {
|
||||||
|
var product_list = JSON.parse(response);
|
||||||
|
|
||||||
|
if (product_list) {
|
||||||
|
// console.log(product_list);
|
||||||
|
$('#product_list_model').modal('show');
|
||||||
|
|
||||||
|
var html = '';
|
||||||
|
html += '<table class="table table-striped dt-responsive nowrap w-100"><thead><tr><th>Name </th><th>Qty</th></tr></thead><tbody>';
|
||||||
|
|
||||||
|
product_list.forEach(function(product) {
|
||||||
|
// console.log(product);
|
||||||
|
html += '<tr><td>'+ product.product_name+'</td><td>'+product.qty_stock+'</td></tr>';
|
||||||
|
});
|
||||||
|
|
||||||
|
html += '</tbody></table>'
|
||||||
|
|
||||||
|
$("#product_list_model_body").html(html);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error('Error occurred while deleting the item:', error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user