diff --git a/app/Controllers/Products.php b/app/Controllers/Products.php index d3b345b..ca72f15 100755 --- a/app/Controllers/Products.php +++ b/app/Controllers/Products.php @@ -43,6 +43,14 @@ class Products extends BaseController $ProductCategoryModel = new ProductCategoryModel(); $productcategory = $ProductCategoryModel->orderBy('product_category_id')->findAll(); + // print_r($productcategory); + foreach ($productcategory as &$category) { + $sub_query_result = $this->ProductModel + ->select('count(product_category) as total_product') + ->where('product_category', $category['product_category_name']) + ->first(); + $category['total_product'] = $sub_query_result['total_product'] ?? 0; + } $data['productcategory'] = $productcategory; return view('product_categories',$data); } diff --git a/app/Controllers/Purchase.php b/app/Controllers/Purchase.php index c3ad635..a78f307 100755 --- a/app/Controllers/Purchase.php +++ b/app/Controllers/Purchase.php @@ -206,6 +206,12 @@ class Purchase extends BaseController $data['purchase_product'] = $purchase_product; + $productAll = $this->ProductModel->select('products.*, manufacturer.manufacturer_name') + ->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id') + ->where('products.isactive',1) + ->findAll(); + $data['productAll']= json_encode($productAll); + $data['purchase_order_id']= $purchase_order_id; diff --git a/app/Models/PurchaseOrderModel.php b/app/Models/PurchaseOrderModel.php index 61d920f..a617990 100755 --- a/app/Models/PurchaseOrderModel.php +++ b/app/Models/PurchaseOrderModel.php @@ -10,11 +10,11 @@ class PurchaseOrderModel extends Model public function getPurchaseOrdersWithProducts($logged_user_branch_id) { // Select required fields from both tables - $this->select('purchase_order.*, COUNT(purchase_order_child.purchase_order_id) AS product_count,vendor.vendor_name,SUM(purchase_order_child.qty) AS purchase_qty, purchase_order_child.received_qty'); + $this->select('purchase_order.*, COUNT(purchase_order_child.purchase_order_id) AS product_count,vendor.vendor_name,SUM(purchase_order_child.qty) AS purchase_qty, SUM(purchase_order_child.received_qty) AS received_qty'); // Join the sales_order_product table based on sales_order_id $this->join('purchase_order_child', 'purchase_order_child.purchase_order_id = purchase_order.purchase_order_id'); - $this ->join('vendor', 'vendor.vendor_id = purchase_order.vendor_id'); + $this->join('vendor', 'vendor.vendor_id = purchase_order.vendor_id'); // Group by sales_order_id to get count of products per sales order $this->groupBy('purchase_order.purchase_order_id'); diff --git a/app/Models/SalesOrderModel.php b/app/Models/SalesOrderModel.php index dd5b3ac..7646a7d 100755 --- a/app/Models/SalesOrderModel.php +++ b/app/Models/SalesOrderModel.php @@ -36,7 +36,7 @@ class SalesOrderModel extends Model // Add condition to fetch only active sales orders $this ->where('sales_order.branch_id',$logged_user_branch_id); - $this->orderBy('sales_order.order_number','desc'); + $this->orderBy('sales_order.sales_order_id','desc'); // Get the results return $this->findAll(); } diff --git a/app/Views/jobs_list.php b/app/Views/jobs_list.php index d91f31e..4fa52d8 100755 --- a/app/Views/jobs_list.php +++ b/app/Views/jobs_list.php @@ -44,15 +44,12 @@
- - - - + @@ -67,6 +64,7 @@ $value) : if ($value['isactive'] == 1) : ?> + @@ -182,6 +180,13 @@ "language": { "search": "Search: " // Customize search label }, + "columnDefs": [ + { + "targets": [0], // Target the first column (JC Id) + "visible": false, // Hide the column + "searchable": false // Make it non-searchable (optional) + } + ] }); diff --git a/app/Views/product_categories.php b/app/Views/product_categories.php index 1c1ed18..fa4cb9a 100644 --- a/app/Views/product_categories.php +++ b/app/Views/product_categories.php @@ -25,6 +25,7 @@ + @@ -33,6 +34,7 @@ $item): ?> + - - + + + - + + + @@ -184,8 +187,13 @@ + + + + - - - + - + $value) : + if ($value['isactive'] == 1) : ?> + - - + + +
Job Card Order Number Vehicle No Client

Product CategoryTotal Product Status Products
Active diff --git a/app/Views/purchase_form.php b/app/Views/purchase_form.php index 736c4fb..42afa57 100755 --- a/app/Views/purchase_form.php +++ b/app/Views/purchase_form.php @@ -149,11 +149,14 @@
Item DetailsQtyOriginal QtyRcvd Qty Received AmountQty
+ + - + 0) ? 'max="' . $purchasechild['qty'] . '"' : '' ?> > diff --git a/app/Views/purchase_list.php b/app/Views/purchase_list.php index c1400a3..b374e7b 100755 --- a/app/Views/purchase_list.php +++ b/app/Views/purchase_list.php @@ -49,31 +49,34 @@
PO Id Order Number Vendor Name Order Date Contact Details ItemsQtyReceived ItemsItems Details Status Actions

- -
".$value['product_count']." "; ?>
+ ".$value['purchase_qty']." "; ?>
+ ".$value['received_qty']." " : "Rcvd Qty : 0 "; ?> +
- - - - - + @@ -69,6 +65,7 @@ foreach ($sales as $index => $value) : if ($value['isactive'] == 1) : ?> + @@ -125,17 +122,28 @@ var datatable_sales_order =''; $(document).ready(function() { - datatable_sales_order = $('#datatable-sales-order').DataTable({ - "order": [[0, 'desc']], // Set initial sorting to descending on the first column - "dom": 'Bfrtip', // Show export buttons - "buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',}, - {extend: 'print',title: 'Products',text: 'Print',}, - {extend: 'copy',text: 'Copy', titleAttr: 'Copy',}, - {extend: 'csv',text: 'CSV', title: 'Products', }], - "language": { - "search": "Search: " // Customize search label - }, - }); + + datatable_sales_order = $('#datatable-sales-order').DataTable({ + "order": [[0, 'desc']], // Sort by Sales Order Id (hidden column) + "dom": 'Bfrtip', // Show export buttons + "buttons": [ + {extend: 'pdfHtml5', title: 'Products', text: 'PDF'}, + {extend: 'print', title: 'Products', text: 'Print'}, + {extend: 'copy', text: 'Copy', titleAttr: 'Copy'}, + {extend: 'csv', text: 'CSV', title: 'Products'} + ], + "language": { + "search": "Search: " // Customize search label + }, + "columnDefs": [ + { + "targets": [0], // Target the first column (Sales Order Id) + "visible": false, // Hide the column + "searchable": false // Make it non-searchable (optional) + } + ] + }); + //Start DataTable Paging is session is set
Sales Order Id Order Number Reg No Client Name