IGR listing fixed

This commit is contained in:
vadivelJ96 2024-10-16 18:38:06 +05:30
parent 5fb6834352
commit c105e7b4dd
4 changed files with 45 additions and 13 deletions

View File

@ -259,6 +259,7 @@ $routes->match(['GET', 'POST', 'PUT', 'DELETE'],'EditStoreRequisition', 'Storere
// Application IGR Routes
$routes->get('AddIGR', 'Inwardgateregister::addIGR'); // ADD IGR page - working
$routes->get('ViewIGR', 'Inwardgateregister::viewIGR'); // View IGR PAGE - Working
$routes->post('ViewIGR', 'Inwardgateregister::viewIGR');//for filter purpose
$routes->post('ViewIGRDetails', 'Inwardgateregister::viewIGRDetails');
$routes->post('GetIGRLineItemDetails', 'Inwardgateregister::getIGRLineItemDetails');
$routes->post('SaveIGR', 'Inwardgateregister::SaveIGR');// Save IGR PAGE - Working

View File

@ -50,13 +50,31 @@ class Inwardgateregister extends BaseController
function viewIGR()
{
if ($this->request->getMethod() === 'GET')
{
$currentYear = date('Y');
$currentMonth = date('m');
$startOfMonth = "$currentYear-$currentMonth-01";
$endOfMonth = date('Y-m-t');
$fromDate = $startOfMonth;
$toDate = $endOfMonth;
} elseif ($this->request->getMethod() === 'POST') {
$fromDate = $this->request->getPost('fromDate');
$toDate = $this->request->getPost('toDate');
$fromDate = date('Y-m-d', strtotime($fromDate));
$toDate = date('Y-m-d', strtotime($toDate));
}
$this->global['pageTitle'] = 'View Inward Gate Register';
$result = $this->inwardgateregister_model->ViewigrListing();
$result = $this->inwardgateregister_model->ViewigrListing($fromDate,$toDate);
$data['IGR'] = $result[0];
$data['IGRDownload'] = $result[1];
$data['userRole'] = $this->session->get('role');
$data['transporter'] = $this->inwardgateregister_model->transporter();
$data['fromDate'] = date('d-m-Y', strtotime($fromDate));
$data['toDate'] = date('d-m-Y', strtotime($toDate));
$this->loadViews("viewinwardgateregister", $this->global, $data, NULL);
}

View File

@ -368,7 +368,7 @@ class Inwardgateregister_model extends Model
return $result;
}
function ViewigrListing()
function ViewigrListing($fromDate,$toDate)
{
$builder = $this->db->table('t_igr_master igr')
@ -378,6 +378,8 @@ class Inwardgateregister_model extends Model
->join('t_transporter trans', 'igr.TransporterId = trans.id' , 'left')
->join('t_igr_details IGRD', 'igr.IGRNo = IGRD.IGRNo')
->where('igr.IGRStatus !=', MRIR_CREATED)
->where('igr.CreatedDate >=',"$fromDate")
->where('igr.CreatedDate <=', "$toDate")
->groupBy('igr.IGRNo')
->orderBy('igr.CreatedDate', 'desc');
$query = $builder->get();

View File

@ -170,18 +170,29 @@
<div class="card">
<div class="row">
<div class="col-md-8">
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 26px;">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<form class="Date-filter-form" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;" method="post" action="<?= base_url('ViewIGR'); ?>">
<label for="fromDate">From:</label>
<input class="form-control date_range form-date-search"
value="<?= $fromDate?>"
id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range to-date-search"
value="<?= $toDate ?>"
id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
<button type="submit" class="range_search_button" >
<i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i>
</button>
<i class="fe-rotate-cw range_reset_button"
style="cursor:pointer;"
aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
</div>
<!-- <div class="col-md-4">
<button id="downloadExcel" class="btn btn-primary" style="margin-top: 14px;margin-bottom: -11px;margin-right: 25px;float: right;">Download Excel</button>
@ -1683,7 +1694,7 @@
$("#resetButton").click(function() {
$("#fromDate").val('');
$("#toDate").val('');
table.draw(); // Redraw the table to clear the filter
window.location="ViewIGR"
});
// Automatically focus and open the To Date picker when From Date is selected