From 73443de17291dcf52b13f469428d6af343e19021 Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Tue, 15 Oct 2024 20:31:31 +0530 Subject: [PATCH] commit after pull from new_theme 15/10/2024 -vadivel J --- app/Controllers/Inwardgateregister.php | 8 +- app/Controllers/Purchaseorder.php | 22 ++- app/Models/Inwardgateregister_model.php | 33 +++- app/Models/Purchaseorder_model.php | 21 ++- app/Views/EditservicePurchaseorder.php | 16 +- app/Views/POlist.php | 4 +- app/Views/userListing.php | 2 +- app/Views/viewinwardgateregister.php | 211 ++++++++++++++++-------- 8 files changed, 219 insertions(+), 98 deletions(-) diff --git a/app/Controllers/Inwardgateregister.php b/app/Controllers/Inwardgateregister.php index d99a697b..83a028c1 100755 --- a/app/Controllers/Inwardgateregister.php +++ b/app/Controllers/Inwardgateregister.php @@ -50,14 +50,14 @@ class Inwardgateregister extends BaseController function viewIGR() { + $this->global['pageTitle'] = 'View Inward Gate Register'; - $data['IGR'] = $this->inwardgateregister_model->ViewigrListing(); + $result = $this->inwardgateregister_model->ViewigrListing(); + $data['IGR'] = $result[0]; + $data['IGRDownload'] = $result[1]; $data['userRole'] = $this->session->get('role'); $data['transporter'] = $this->inwardgateregister_model->transporter(); $this->loadViews("viewinwardgateregister", $this->global, $data, NULL); - // $this->global['pageTitle'] = 'Inward Gate Register Details'; - // $data['IGR'] = $this->inwardgateregister_model->igrListing(); - // $this->loadViews("viewIGRDetails", $this->global, $data, NULL); } function addIGR() diff --git a/app/Controllers/Purchaseorder.php b/app/Controllers/Purchaseorder.php index a06ca417..b655a10d 100755 --- a/app/Controllers/Purchaseorder.php +++ b/app/Controllers/Purchaseorder.php @@ -4256,8 +4256,14 @@ class Purchaseorder extends BaseController $filelist = array('PONO' => $pono, 'IGRNO' => $igr, 'FilePath' => $Picture); $uploadfiles = $this->purchaseorder_model->insertfile($filelist); if ($uploadfiles > 0) { - echo "file updated successfully!"; - return true; + $response = [ + 'message' => 'File updated successfully!', + 'data' => $uploadfiles + ]; + + // Return the response as JSON + return $this->response->setJSON($response); + } } else{ echo " Internal Server Error..!!"; @@ -4395,8 +4401,16 @@ class Purchaseorder extends BaseController } - if($uploadfile > 0){ - echo "updated successfully!"; + if( $uploadfile['afftectedRows'] > 0){ + + $response = [ + 'message' => 'File updated successfully!', + 'data' =>$uploadfile['updatedRow'] + ]; + + // Return the response as JSON + return $this->response->setJSON($response); + } else{ echo "Update Failed (maybe same file provided for update kindly check)..!!"; diff --git a/app/Models/Inwardgateregister_model.php b/app/Models/Inwardgateregister_model.php index a0bd5054..860a415a 100755 --- a/app/Models/Inwardgateregister_model.php +++ b/app/Models/Inwardgateregister_model.php @@ -339,7 +339,7 @@ class Inwardgateregister_model extends Model $result = $query->getResult(); return $result; } - function ViewigrListing() + function ViewigrListing_old() { // $builder = $this->db->table('t_igr_master igr') @@ -368,6 +368,37 @@ class Inwardgateregister_model extends Model return $result; } + function ViewigrListing() + { + + $builder = $this->db->table('t_igr_master igr') + ->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName , SUM(IGRD.QuantityAsPerInvoice) as ReceivedQuantity, SUM(IGRD.NetWeight) as NetWeight , count(IGRD.IGRNo) as itemCount') + ->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO') + ->join('t_supplierdetailsn sup', 'PO.SupplierID = sup.SupplierID') + ->join('t_transporter trans', 'igr.TransporterId = trans.id' , 'left') + ->join('t_igr_details IGRD', 'igr.IGRNo = IGRD.IGRNo') + ->where('igr.IGRStatus !=', MRIR_CREATED) + ->groupBy('igr.IGRNo') + ->orderBy('igr.CreatedDate', 'desc'); + $query = $builder->get(); + $result = $query->getResult(); + + $builder2 = $this->db->table('t_igr_details igr_details') + ->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName,item.MaterialName, igr_details.QuantityAsPerInvoice as ReceivedQuantity , igr_details.NetWeight as NetWeight') + ->join('t_igr_master igr', 'igr_details.IGRNo = igr.IGRNo') + ->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO') + ->join('t_supplierdetailsn sup', 'PO.SupplierID = sup.SupplierID') + ->join('t_transporter trans', 'igr.TransporterId = trans.id' , 'left') + ->join('t_materialmaster` item', 'igr_details.MaterialCode = item.MaterialCode' , 'left') + ->where('igr.IGRStatus !=', MRIR_CREATED) + ->orderBy('igr.CreatedDate', 'desc'); + $query2 = $builder2->get(); + $result2 = $query2->getResult(); + // echo $this->db->getLastQuery()->getQuery();die; + return [$result,$result2]; + } + + function viewigr($IGRNO) { diff --git a/app/Models/Purchaseorder_model.php b/app/Models/Purchaseorder_model.php index b2d0c71e..9edea48b 100755 --- a/app/Models/Purchaseorder_model.php +++ b/app/Models/Purchaseorder_model.php @@ -2325,12 +2325,23 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath, function updatefile($bill, $Picture) { + $uploadfile; $this->db->table('t_purchaseorder_billupload') ->set('FilePath', $Picture) ->where('BillNo', $bill) ->update(); - $afftectedRows = $this->db->affectedRows(); - return $afftectedRows; + + $uploadfile['afftectedRows'] = $this->db->affectedRows(); + + if( $uploadfile['afftectedRows'] > 0){ + $uploadfile['updatedRow'] = $this->db->table('t_purchaseorder_billupload') + ->where('BillNo', $bill) + ->get() + ->getRowArray(); + + } + return $uploadfile; + } @@ -2425,11 +2436,11 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath, function insertfile($filelist) { - //print_r($myfile);die; $builder = $this->db->table('t_purchaseorder_billupload'); $builder->insert($filelist); - $myfile = $this->db->affectedRows(); - return $myfile; + $insertedID = $this->db->insertID(); + $insertedRow = $builder->where('BillNo', $insertedID)->get()->getRowArray(); + return $insertedRow; } /*------------------------------------------------------------------------------*/ diff --git a/app/Views/EditservicePurchaseorder.php b/app/Views/EditservicePurchaseorder.php index 27b751dd..f4a4900a 100755 --- a/app/Views/EditservicePurchaseorder.php +++ b/app/Views/EditservicePurchaseorder.php @@ -1096,11 +1096,11 @@ if (!empty($getlogpodtl)) { - - - + + + - + @@ -1132,11 +1132,11 @@ if (!empty($getlogpodtl)) { ?> - - - + + + - + diff --git a/app/Views/POlist.php b/app/Views/POlist.php index c1bb7d8f..a3696fa1 100755 --- a/app/Views/POlist.php +++ b/app/Views/POlist.php @@ -128,7 +128,7 @@ - + @@ -152,7 +152,7 @@ - + -->
SNoRequisition NoItem CodeSNoRequisition NoItem Code Item NameQuantityQuantity UOM Rate Basic Amount
ReqNo ?>MaterialCode ?>ReqNo ?>MaterialCode ?> MaterialName ?>Quantity ?>Quantity ?> UOM ?> Rate ?>PONO# PO Type Supplier NameTotal Order ValueTotal Order Value PO Status Delivery Option Delivery DateReqType ?> SupplierName ?>TotalOrderValue ?>TotalOrderValue ?> diff --git a/app/Views/viewinwardgateregister.php b/app/Views/viewinwardgateregister.php index 55a5d38b..abe442a9 100755 --- a/app/Views/viewinwardgateregister.php +++ b/app/Views/viewinwardgateregister.php @@ -163,34 +163,41 @@ +
-
- - - +
+
+ + + + - - + + - - -
- + + +
+ +
+
+ +
+
- - + - - - + + + @@ -201,62 +208,115 @@ - CreatedDate); - $datewithtime = $createddate->format('d-m-Y h:i A'); $date = $createddate->format('d-m-Y'); $time = $createddate->format('h:i A'); ?> - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + +   + + + + +   + + + +
Create DateCreate time IGR NoPO NoPO No Supplier NameInvoice NoInvoice Date ItemInvoice NoInvoice Date Item Count Rec Qty Net Weight Vechicle No
IGRNO ?> PONO ?>SupplierName ?>DeliveryChellanOrInvoiceNo ?>DeliveryChellanDate); - echo $date->format('d-m-Y'); ?>MaterialName ?>ReceivedQuantity ?>NetWeight ?>VehicleNo ?>DriverName ?>TransporterName ?>IGRStatus == 'ST074' ? 'Draft' : 'Completed'; ?> - - - -   - FilePath)) { ?> +
IGRNO ?> PONO ?>SupplierName ?>DeliveryChellanOrInvoiceNo ?>DeliveryChellanDate); + echo $date->format('d-m-Y'); ?>itemCount ?>ReceivedQuantity ?>NetWeight ?>VehicleNo ?>DriverName ?>TransporterName ?>IGRStatus == 'ST074' ? 'Draft' : 'Completed'; ?> + + + +   + FilePath)) { ?> - file)) { ?> + file)) { ?> - + - -   - - - - -   - - -
+ + + + + + + + + + + + + + + + + + + + + + + CreatedDate); + $date = $createddate->format('d-m-Y'); + $time = $createddate->format('h:i A'); + ?> + + + + + + + + + + + + + + + + + + + +
@@ -415,6 +475,7 @@
+ @@ -1612,25 +1673,15 @@ } $(document).ready(function() { - $('#view_inward_gate_register').DataTable({ - dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination - buttons: [ - 'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons - ], - pageLength: 10, // Default rows per page + table = $('#view_inward_gate_register').DataTable({ + + pageLength: 10, lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] - ], // Rows per page options - responsive: true, // Responsive table - - // Default ordering (column index 0, ascending) - // order: [ - // [0, 'desc'] - // ], - + ], + responsive: true, ordering:false, - language: { paginate: { next: '', // Next button icon @@ -1700,4 +1751,18 @@ } }); }); + + + + \ No newline at end of file