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->get("new_vendor/(:any)", "Vendor::new_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");
|
||||
//end Vendor
|
||||
|
||||
|
||||
@ -35,12 +35,12 @@ class Complaint extends BaseController
|
||||
"labour_charge" => $this->request->getPost('labour_charge'),
|
||||
"cgst" => $this->request->getPost('tax')/2,
|
||||
"sgst" => $this->request->getPost('tax')/2,
|
||||
"tax" => $this->request->getPost('tax')
|
||||
"tax" => $this->request->getPost('tax'),
|
||||
];
|
||||
|
||||
if (!$complaint_id) {
|
||||
$ComplaintModel = new ComplaintModel();
|
||||
// $data = $this->request->getPost();
|
||||
$data['business_id'] = $this->session->get('logged_user_business_id');
|
||||
$inserted = $ComplaintModel->insert($data);
|
||||
if ($inserted) {
|
||||
$result = $data;
|
||||
|
||||
@ -59,7 +59,7 @@ class Model extends BaseController
|
||||
|
||||
}
|
||||
|
||||
public function create_model($model_id)
|
||||
public function create_model($model_id = 0)
|
||||
{
|
||||
try {
|
||||
$make_id = $this->request->getPost('make_id');
|
||||
@ -70,9 +70,9 @@ class Model extends BaseController
|
||||
'make_id' => $make_id,
|
||||
'model_name' => $model_name
|
||||
];
|
||||
// print_r($model_id);die;
|
||||
|
||||
if (!$model_id) {
|
||||
|
||||
try {
|
||||
$inserted = $BikemodelsModel->insert($data);
|
||||
} catch (\CodeIgniter\Database\Exceptions\DatabaseException $e) {
|
||||
@ -90,6 +90,7 @@ class Model extends BaseController
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
$updated = $BikemodelsModel->update($model_id ,$data);
|
||||
if ($updated) {
|
||||
$result = $data;
|
||||
|
||||
@ -291,6 +291,7 @@ class Purchase extends BaseController
|
||||
}
|
||||
|
||||
// print_r($child_data);die;
|
||||
|
||||
if (!empty($purchase_order_child_id[$key])) {
|
||||
|
||||
// print_r($purchase_order_child_id[$key]);die;
|
||||
@ -304,11 +305,11 @@ class Purchase extends BaseController
|
||||
$VendorModel = new VendorModel();
|
||||
$vendor = $VendorModel->where('vendor_id',$this->request->getPost('vendor_id'))->findAll();
|
||||
$mail_status = $this->download_purchase_invoice($purchase_order_id, $vendor[0]['vendor_email']);
|
||||
|
||||
// echo $mail_status;die;
|
||||
$_SESSION['mail_status'] = $mail_status;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
$model = new PurchaseOrderModel();
|
||||
$data = $model->getPurchasePdf($purchase_order_id);
|
||||
|
||||
$items = $model->getPurchaseOrderProductsForPdf($purchase_order_id);
|
||||
// Create an mPDF object
|
||||
$mpdf = new Mpdf([
|
||||
|
||||
@ -27,12 +27,14 @@ class Reorderlevel extends BaseController
|
||||
$productModel = new ProductModel();
|
||||
$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')
|
||||
->where('products.qty_stock <= purchase_order_level')
|
||||
->where('products.qty_stock <= products.purchase_order_level')
|
||||
->groupBy('products.prefered_vendor')
|
||||
->orderBy('prefered_vendor_name', 'ASC')
|
||||
->findAll();
|
||||
// echo json_encode($reorder);die;
|
||||
$data['reorder']=$reorder;
|
||||
// echo "<pre>";
|
||||
// print_r($reorder);die;
|
||||
return view('reorder_level_list',$data);
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ use App\Models\UsersModel;
|
||||
use App\Models\BikemakeModel;
|
||||
use App\Models\BikemodelsModel;
|
||||
use App\Models\ManufacturerModel;
|
||||
use App\Models\ProductModel;
|
||||
|
||||
|
||||
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('vendor as V','V.vendor_id = purchase_order.vendor_id','left')
|
||||
->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()
|
||||
->getResult();
|
||||
|
||||
@ -93,14 +93,16 @@
|
||||
<script>
|
||||
function submitModels(params) {
|
||||
// console.log( $('#modelname').val());
|
||||
var formData = {
|
||||
make_id: $('#make_id').val(),
|
||||
modelname: $('#modelname').val()
|
||||
};
|
||||
|
||||
var edit_model_id = $('#edit_model_id').val();
|
||||
if (!edit_model_id) {
|
||||
edit_model_id =0;
|
||||
}
|
||||
|
||||
var formData = {
|
||||
make_id: $('#make_id').val(),
|
||||
modelname: $('#modelname').val()
|
||||
};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo base_url()."create_model/"?>'+edit_model_id,
|
||||
@ -145,6 +147,7 @@
|
||||
$('tbody').append(row);
|
||||
});
|
||||
}
|
||||
window.location.reload();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
|
||||
@ -145,17 +145,21 @@
|
||||
make_id: $('#make_id').val(),
|
||||
modelname: $('#modelname').val()
|
||||
};
|
||||
|
||||
var model_id =0;
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'create_model/'+$('#make_id').val(),
|
||||
url: 'create_model/'+model_id,
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
// Handle success response here
|
||||
console.log(response);
|
||||
if (response.status == "failed") {
|
||||
toastr.warning(response.data, 'Warning');
|
||||
}else{
|
||||
$('#bike_model_login-modal').modal('hide');
|
||||
$('#modelname').val('');
|
||||
toastr.success(response.data, 'Success');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php include('layout/header.php'); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title"><?php echo $page_name?></h4>
|
||||
@ -11,8 +11,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@ -164,7 +164,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="pr_data" value="<?= htmlspecialchars(json_encode($product_data)); ?>">
|
||||
|
||||
<?php include('layout/footer.php'); ?>
|
||||
|
||||
@ -38,8 +38,8 @@
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($reorder as $value) : ?>
|
||||
<tr>
|
||||
|
||||
<tr id="<?php echo $value['prefered_vendor']; ?>">
|
||||
<div></div>
|
||||
<td><?= $value['prefered_vendor_name']; ?></td>
|
||||
<td><?= $value['product_count']; ?></td>
|
||||
<!-- <td><?= $value['prefered_vendor_name']; ?></td>
|
||||
@ -62,6 +62,25 @@
|
||||
</div> <!-- end col -->
|
||||
|
||||
</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'); ?>
|
||||
|
||||
<script>
|
||||
@ -110,5 +129,40 @@ $(document).ready(function() {
|
||||
},
|
||||
"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>
|
||||
Loading…
Reference in New Issue
Block a user