purchase order listing tables in month wise
This commit is contained in:
parent
812147f228
commit
9ad4212f5f
@ -221,6 +221,7 @@ $routes->match(['GET', 'POST', 'PUT', 'DELETE'],'purchaseorder/EditCapitalPurcha
|
|||||||
|
|
||||||
// $routes->match(['GET', 'POST', 'PUT', 'DELETE'],'POApproval', 'Purchaseorder::poapproval');
|
// $routes->match(['GET', 'POST', 'PUT', 'DELETE'],'POApproval', 'Purchaseorder::poapproval');
|
||||||
$routes->get('amendmentpurchaseorder','Amendmentpurchaseorder::index');
|
$routes->get('amendmentpurchaseorder','Amendmentpurchaseorder::index');
|
||||||
|
$routes->post('amendmentpurchaseorderFilter','Amendmentpurchaseorder::index');
|
||||||
$routes->get('EditAmendPO', 'Amendmentpurchaseorder::EditAmendPurchaseOrder');
|
$routes->get('EditAmendPO', 'Amendmentpurchaseorder::EditAmendPurchaseOrder');
|
||||||
$routes->post('amendmentpurchaseorder/EditRevenuePurchaseOrder', 'Amendmentpurchaseorder::EditRevenuePurchaseOrder');
|
$routes->post('amendmentpurchaseorder/EditRevenuePurchaseOrder', 'Amendmentpurchaseorder::EditRevenuePurchaseOrder');
|
||||||
$routes->post('amendmentpurchaseorder/UpdateAmendServicePurchaseOrder', 'Amendmentpurchaseorder::UpdateAmendServicePurchaseOrder');
|
$routes->post('amendmentpurchaseorder/UpdateAmendServicePurchaseOrder', 'Amendmentpurchaseorder::UpdateAmendServicePurchaseOrder');
|
||||||
|
|||||||
@ -41,11 +41,33 @@ class Amendmentpurchaseorder extends BaseController
|
|||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
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->load->library('pagination');
|
// $this->load->library('pagination');
|
||||||
$forwhat = 'amendment';
|
$forwhat = 'amendment';
|
||||||
$data['POData'] = $this->purchaseorder_model->purchaseorderListing($forwhat);
|
|
||||||
|
$data['POData'] = $this->purchaseorder_model->purchaseorderListing($forwhat,$fromDate,$toDate);
|
||||||
|
$data['fromDate'] = date('d-m-Y', strtotime($fromDate));
|
||||||
|
$data['toDate'] = date('d-m-Y', strtotime($toDate));
|
||||||
|
|
||||||
$this->global['pageTitle'] = 'Amendment Purchase Order';
|
$this->global['pageTitle'] = 'Amendment Purchase Order';
|
||||||
|
|
||||||
$this->loadviews('AmendPOlist', $this->global, $data, NULL);
|
$this->loadviews('AmendPOlist', $this->global, $data, NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -109,21 +109,35 @@ class Purchaseorder extends BaseController
|
|||||||
function PurchaseOrderList()
|
function PurchaseOrderList()
|
||||||
{
|
{
|
||||||
|
|
||||||
// $this->load->library('pagination');
|
|
||||||
|
|
||||||
// $count = $this->purchaseorder_model->purchaseorderListingCount('');
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
//$returns = $this->paginationCompress ( "purchaseorderListing/", $count, 10 );
|
|
||||||
|
|
||||||
$this->purchaseorder_model->UpdateRequistionStatus();
|
$this->purchaseorder_model->UpdateRequistionStatus();
|
||||||
|
|
||||||
|
$forwhat='';
|
||||||
|
$data['POData'] = $this->purchaseorder_model->purchaseorderListing($forwhat ,$fromDate,$toDate);
|
||||||
|
$data['fromDate'] = date('d-m-Y', strtotime($fromDate));
|
||||||
|
$data['toDate'] = date('d-m-Y', strtotime($toDate));
|
||||||
|
|
||||||
|
|
||||||
$data['POData'] = $this->purchaseorder_model->purchaseorderListing();
|
|
||||||
// echo "<pre>";
|
|
||||||
// print_r($data['POData']);die;
|
|
||||||
$this->global['pageTitle'] = 'Purchase Orders';
|
$this->global['pageTitle'] = 'Purchase Orders';
|
||||||
|
|
||||||
|
|
||||||
$this->loadViews("POlist", $this->global, $data, NULL);
|
$this->loadViews("POlist", $this->global, $data, NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function validate_req($str = null)
|
function validate_req($str = null)
|
||||||
@ -2539,16 +2553,34 @@ class Purchaseorder extends BaseController
|
|||||||
function porelease()
|
function porelease()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
$q = "RELEASE";
|
$q = "RELEASE";
|
||||||
$this->global['pageTitle'] = 'Purchase Order Release';
|
$this->global['pageTitle'] = 'Purchase Order Release';
|
||||||
// $data['Status']= $this->purchaseorder_model->getStatus();
|
// $data['Status']= $this->purchaseorder_model->getStatus();
|
||||||
$userID = $this->session->get('userId');
|
$userID = $this->session->get('userId');
|
||||||
//print_r($data['Status']);echo "CON";
|
//print_r($data['Status']);echo "CON";
|
||||||
$appList = $this->purchaseorder_model->getPOList($q);
|
$appList = $this->purchaseorder_model->getPOList($q , $fromDate , $toDate);
|
||||||
$filteredAppList = array_filter($appList, function ($item) {
|
$filteredAppList = array_filter($appList, function ($item) {
|
||||||
return $item->Status !== PO_DRAFT;
|
return $item->Status !== PO_DRAFT;
|
||||||
});
|
});
|
||||||
$data['AppList'] = $filteredAppList;
|
$data['AppList'] = $filteredAppList;
|
||||||
|
$data['fromDate'] = date('d-m-Y', strtotime($fromDate));
|
||||||
|
$data['toDate'] = date('d-m-Y', strtotime($toDate));
|
||||||
|
|
||||||
$this->loadViews("porelease_view", $this->global, $data, NULL);
|
$this->loadViews("porelease_view", $this->global, $data, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4384,7 +4416,6 @@ class Purchaseorder extends BaseController
|
|||||||
$newfile = $this->request->getFile('file');
|
$newfile = $this->request->getFile('file');
|
||||||
|
|
||||||
$Picture='';
|
$Picture='';
|
||||||
$uploadfile=0;
|
|
||||||
|
|
||||||
if (!empty($newfile)) {
|
if (!empty($newfile)) {
|
||||||
|
|
||||||
@ -4401,7 +4432,7 @@ class Purchaseorder extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( $uploadfile['afftectedRows'] > 0){
|
if($uploadfile && $uploadfile['afftectedRows'] > 0){
|
||||||
|
|
||||||
$response = [
|
$response = [
|
||||||
'message' => 'File updated successfully!',
|
'message' => 'File updated successfully!',
|
||||||
|
|||||||
@ -387,8 +387,11 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
|
|||||||
* @return array $result : This is result
|
* @return array $result : This is result
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function purchaseorderListing($forwhat = '')
|
function purchaseorderListing($forwhat ,$fromDate='',$toDate='')
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$builder = $this->db->table('t_purchaseorder_master POMast')->distinct()
|
$builder = $this->db->table('t_purchaseorder_master POMast')->distinct()
|
||||||
->select('POMast.PONO,POMast.CreatedDate,supp.SupplierName,TotalOrderValue,PODate,Stat.StatusName,Stat.StatusCode,POMast.POType as ReqType,DeliveryDate,DeliverySchedule,DeliveryOption,POMast.CapitalRange')
|
->select('POMast.PONO,POMast.CreatedDate,supp.SupplierName,TotalOrderValue,PODate,Stat.StatusName,Stat.StatusCode,POMast.POType as ReqType,DeliveryDate,DeliverySchedule,DeliveryOption,POMast.CapitalRange')
|
||||||
->join('t_supplierdetailsn supp', 'supp.SupplierID = POMast.SupplierID')
|
->join('t_supplierdetailsn supp', 'supp.SupplierID = POMast.SupplierID')
|
||||||
@ -401,6 +404,11 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
|
|||||||
$builder->where('POMast.Status !=', PO_AMENDED);
|
$builder->where('POMast.Status !=', PO_AMENDED);
|
||||||
// $builder->orderBy('POMast.Status !=',PO_AMENDED);
|
// $builder->orderBy('POMast.Status !=',PO_AMENDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$builder->where('POMast.CreatedDate >=', $fromDate)
|
||||||
|
->where('POMast.CreatedDate <=', $toDate);
|
||||||
|
|
||||||
|
|
||||||
$builder->orderBy('POMast.CreatedDate', 'desc');
|
$builder->orderBy('POMast.CreatedDate', 'desc');
|
||||||
$query = $builder->get();
|
$query = $builder->get();
|
||||||
|
|
||||||
@ -1584,7 +1592,7 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
|
|||||||
* @return array $result : This is result of the query
|
* @return array $result : This is result of the query
|
||||||
* join t_departmentdetails Dept on emp.Departmentcode = Dept.DEPCode
|
* join t_departmentdetails Dept on emp.Departmentcode = Dept.DEPCode
|
||||||
*/
|
*/
|
||||||
function getPOList($type)
|
function getPOList($type, $fromDate , $toDate)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@ -1604,7 +1612,7 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
|
|||||||
->join('t_employee_details as emp', 'emp.empid=tbl.empid', 'left')
|
->join('t_employee_details as emp', 'emp.empid=tbl.empid', 'left')
|
||||||
->join('t_departmentdetails as Dep', 'Dep.DEPCode=emp.Departmentcode', 'left');
|
->join('t_departmentdetails as Dep', 'Dep.DEPCode=emp.Departmentcode', 'left');
|
||||||
|
|
||||||
// old Status Don't Deleted it.
|
// old Status Don't Delete it.
|
||||||
// if ($type == 'APPROVAL') {
|
// if ($type == 'APPROVAL') {
|
||||||
// $builder->orWhere('mast.Status', PO_DRAFT);
|
// $builder->orWhere('mast.Status', PO_DRAFT);
|
||||||
// $builder->orWhere('mast.Status', PO_CREATED);
|
// $builder->orWhere('mast.Status', PO_CREATED);
|
||||||
@ -1631,6 +1639,10 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
|
|||||||
$builder->orWhere('mast.Status', REQITEM_Emergency_PO_CREATED);
|
$builder->orWhere('mast.Status', REQITEM_Emergency_PO_CREATED);
|
||||||
// $builder->orderBy('mast.Status');
|
// $builder->orderBy('mast.Status');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$builder->where('mast.CreatedDate >=', $fromDate)
|
||||||
|
->where('mast.CreatedDate <=', $toDate);
|
||||||
|
|
||||||
$builder->orderBy('mast.CreatedDate', 'DESC');
|
$builder->orderBy('mast.CreatedDate', 'DESC');
|
||||||
|
|
||||||
$result = $builder->get();
|
$result = $builder->get();
|
||||||
@ -2325,7 +2337,7 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
|
|||||||
function updatefile($bill, $Picture)
|
function updatefile($bill, $Picture)
|
||||||
{
|
{
|
||||||
|
|
||||||
$uploadfile;
|
$uploadfile=[];
|
||||||
$this->db->table('t_purchaseorder_billupload')
|
$this->db->table('t_purchaseorder_billupload')
|
||||||
->set('FilePath', $Picture)
|
->set('FilePath', $Picture)
|
||||||
->where('BillNo', $bill)
|
->where('BillNo', $bill)
|
||||||
|
|||||||
@ -82,16 +82,29 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
|
<form class="Date-filter-form" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;" method="post" action="<?= base_url('amendmentpurchaseorderFilter'); ?>">
|
||||||
<input type="hidden" name="table" value="requisition">
|
|
||||||
<label for="fromDate">From:</label>
|
<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>
|
<input class="form-control date_range form-date-search"
|
||||||
<label for="toDate">To:</label>
|
value="<?= $fromDate?>"
|
||||||
<input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
|
id="fromDate" name="fromDate" placeholder="Select From 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>
|
<label for="toDate">To:</label>
|
||||||
<div class="error" id="error"></div>
|
<input class="form-control date_range to-date-search"
|
||||||
</form>
|
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"
|
||||||
|
style="cursor:pointer;"
|
||||||
|
aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="error" id="error"></div>
|
||||||
|
</form>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<table id="amend_po_list" class="table dt-responsive wrap w-100">
|
<table id="amend_po_list" class="table dt-responsive wrap w-100">
|
||||||
<thead>
|
<thead>
|
||||||
@ -296,7 +309,7 @@
|
|||||||
$("#resetButton").click(function() {
|
$("#resetButton").click(function() {
|
||||||
$("#fromDate").val('');
|
$("#fromDate").val('');
|
||||||
$("#toDate").val('');
|
$("#toDate").val('');
|
||||||
table.draw(); // Redraw the table to clear the filter
|
window.location="amendmentpurchaseorder"
|
||||||
});
|
});
|
||||||
|
|
||||||
// Automatically focus and open the To Date picker when From Date is selected
|
// Automatically focus and open the To Date picker when From Date is selected
|
||||||
|
|||||||
@ -108,23 +108,34 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
|
<form class="Date-filter-form" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;" method="post" action="<?= base_url('purchaseorderListing'); ?>">
|
||||||
<input type="hidden" name="table" value="requisition">
|
|
||||||
<label for="fromDate">From:</label>
|
<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>
|
<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>
|
<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>
|
<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>
|
<button type="submit" class="range_search_button" >
|
||||||
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
|
<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>
|
<div class="error" id="error"></div>
|
||||||
</form>
|
</form>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<table id="po_list" class="table dt-responsive wrap w-100">
|
<table id="po_list" class="table dt-responsive wrap w-100">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>PO Date</th>
|
<th>Created Date</th>
|
||||||
<th>PONO#</th>
|
<th>PONO#</th>
|
||||||
<th>PO Type</th>
|
<th>PO Type</th>
|
||||||
<th>Supplier Name</th>
|
<th>Supplier Name</th>
|
||||||
@ -136,7 +147,7 @@
|
|||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody id="poListTableBodyId">
|
||||||
<?php
|
<?php
|
||||||
if (!empty($POData)) {
|
if (!empty($POData)) {
|
||||||
$index = 0;
|
$index = 0;
|
||||||
@ -144,7 +155,7 @@
|
|||||||
$index = $index + 1;
|
$index = $index + 1;
|
||||||
?>
|
?>
|
||||||
<tr id="<?php echo $index; ?>">
|
<tr id="<?php echo $index; ?>">
|
||||||
<td><?php $Pdt = new DateTime($record->PODate);
|
<td><?php $Pdt = new DateTime($record->CreatedDate);
|
||||||
$PODate = $Pdt->format('d-m-Y');
|
$PODate = $Pdt->format('d-m-Y');
|
||||||
echo $PODate
|
echo $PODate
|
||||||
?></td>
|
?></td>
|
||||||
@ -266,7 +277,7 @@
|
|||||||
var table = $('#po_list').DataTable({
|
var table = $('#po_list').DataTable({
|
||||||
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
|
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
|
||||||
buttons: [
|
buttons: [
|
||||||
'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
|
'csv', 'excel', 'pdf', // Export buttons
|
||||||
],
|
],
|
||||||
pageLength: 10, // Default rows per page
|
pageLength: 10, // Default rows per page
|
||||||
lengthMenu: [
|
lengthMenu: [
|
||||||
@ -288,67 +299,15 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Date range filter function
|
|
||||||
$.fn.dataTable.ext.search.push(
|
|
||||||
function(settings, data, dataIndex) {
|
|
||||||
var fromDate = $('#fromDate').val();
|
|
||||||
var toDate = $('#toDate').val();
|
|
||||||
console.log(fromDate); // e.g., 01-09-2024
|
|
||||||
console.log(toDate); // e.g., 08-09-2024
|
|
||||||
|
|
||||||
if (!fromDate || !toDate) {
|
|
||||||
return true; // If no dates selected, don't filter
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert the fromDate and toDate from dd-mm-yyyy to Date objects
|
|
||||||
var fromParts = fromDate.split("-");
|
|
||||||
var toParts = toDate.split("-");
|
|
||||||
|
|
||||||
var startDate = new Date(fromParts[2], fromParts[1] - 1, fromParts[0]); // Year, month (0-based), day
|
|
||||||
var endDate = new Date(toParts[2], toParts[1] - 1, toParts[0]);
|
|
||||||
|
|
||||||
// Adjust startDate to include the day before the selected fromDate
|
|
||||||
startDate.setDate(startDate.getDate() - 1);
|
|
||||||
|
|
||||||
// Ensure endDate includes the entire end date by setting time to the end of the day
|
|
||||||
endDate.setHours(23, 59, 59, 999);
|
|
||||||
|
|
||||||
// Get the date from the DataTable row (assuming it's in the first column in dd-mm-yyyy format)
|
|
||||||
var dateStr = data[0];
|
|
||||||
var dateParts = dateStr.split("-");
|
|
||||||
var rowDate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
|
|
||||||
|
|
||||||
// Return true if the row date is within the range
|
|
||||||
return rowDate >= startDate && rowDate <= endDate;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// Handle form submission for the date range filter
|
|
||||||
$("#DateRangeFilter").submit(function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
table.draw(); // Redraw the table to apply the filter
|
|
||||||
});
|
|
||||||
|
|
||||||
// Reset button functionality
|
// Reset button functionality
|
||||||
$("#resetButton").click(function() {
|
$("#resetButton").click(function() {
|
||||||
$("#fromDate").val('');
|
$("#fromDate").val('');
|
||||||
$("#toDate").val('');
|
$("#toDate").val('');
|
||||||
table.draw(); // Redraw the table to clear the filter
|
window.location='purchaseorderListing'
|
||||||
});
|
});
|
||||||
|
|
||||||
// Automatically focus and open the To Date picker when From Date is selected
|
|
||||||
document.getElementById('fromDate').addEventListener('change', function() {
|
|
||||||
var fromDate = this.value;
|
|
||||||
var toDateInput = document.getElementById('toDate');
|
|
||||||
|
|
||||||
// Set the min attribute of the To Date input to the selected From Date
|
|
||||||
toDateInput.min = fromDate;
|
|
||||||
|
|
||||||
// Optionally reset the To Date input if the current value is before the new min date
|
|
||||||
if (toDateInput.value < fromDate) {
|
|
||||||
toDateInput.value = fromDate;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|||||||
@ -276,7 +276,7 @@
|
|||||||
$('#loader').show();
|
$('#loader').show();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: "<?php echo base_url() ?>assetdetails/getline",
|
url: "<?php echo base_url(); ?>assetdetails/getline",
|
||||||
data: 'line=' + line,
|
data: 'line=' + line,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$.each(JSON.parse(data), function(i, item) {
|
$.each(JSON.parse(data), function(i, item) {
|
||||||
|
|||||||
@ -146,18 +146,29 @@ if (empty($Status)) {
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
|
<form class="Date-filter-form" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;" method="post" action="<?= base_url('PORelease'); ?>">
|
||||||
<input type="hidden" name="table" value="requisition">
|
|
||||||
<label for="fromDate">From:</label>
|
<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>
|
<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>
|
<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>
|
<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>
|
<button type="submit" class="range_search_button" >
|
||||||
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
|
<i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i>
|
||||||
<div class="error" id="error"></div>
|
</button>
|
||||||
</form>
|
|
||||||
|
<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 class="card-body">
|
<div class="card-body">
|
||||||
<table id="po_release" class="table dt-responsive wrap w-100">
|
<table id="po_release" class="table dt-responsive wrap w-100">
|
||||||
<thead>
|
<thead>
|
||||||
@ -560,7 +571,7 @@ if (empty($Status)) {
|
|||||||
var table = $('#po_release').DataTable({
|
var table = $('#po_release').DataTable({
|
||||||
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
|
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
|
||||||
buttons: [
|
buttons: [
|
||||||
'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
|
'csv', 'excel', 'pdf' // Export buttons
|
||||||
],
|
],
|
||||||
pageLength: 10, // Default rows per page
|
pageLength: 10, // Default rows per page
|
||||||
lengthMenu: [
|
lengthMenu: [
|
||||||
@ -583,67 +594,15 @@ if (empty($Status)) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Date range filter function
|
|
||||||
$.fn.dataTable.ext.search.push(
|
|
||||||
function(settings, data, dataIndex) {
|
|
||||||
var fromDate = $('#fromDate').val();
|
|
||||||
var toDate = $('#toDate').val();
|
|
||||||
console.log(fromDate); // e.g., 01-09-2024
|
|
||||||
console.log(toDate); // e.g., 08-09-2024
|
|
||||||
|
|
||||||
if (!fromDate || !toDate) {
|
|
||||||
return true; // If no dates selected, don't filter
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert the fromDate and toDate from dd-mm-yyyy to Date objects
|
|
||||||
var fromParts = fromDate.split("-");
|
|
||||||
var toParts = toDate.split("-");
|
|
||||||
|
|
||||||
var startDate = new Date(fromParts[2], fromParts[1] - 1, fromParts[0]); // Year, month (0-based), day
|
|
||||||
var endDate = new Date(toParts[2], toParts[1] - 1, toParts[0]);
|
|
||||||
|
|
||||||
// Adjust startDate to include the day before the selected fromDate
|
|
||||||
startDate.setDate(startDate.getDate() - 1);
|
|
||||||
|
|
||||||
// Ensure endDate includes the entire end date by setting time to the end of the day
|
|
||||||
endDate.setHours(23, 59, 59, 999);
|
|
||||||
|
|
||||||
// Get the date from the DataTable row (assuming it's in the first column in dd-mm-yyyy format)
|
|
||||||
var dateStr = data[0];
|
|
||||||
var dateParts = dateStr.split("-");
|
|
||||||
var rowDate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
|
|
||||||
|
|
||||||
// Return true if the row date is within the range
|
|
||||||
return rowDate >= startDate && rowDate <= endDate;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// Handle form submission for the date range filter
|
|
||||||
$("#DateRangeFilter").submit(function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
table.draw(); // Redraw the table to apply the filter
|
|
||||||
});
|
|
||||||
|
|
||||||
// Reset button functionality
|
// Reset button functionality
|
||||||
$("#resetButton").click(function() {
|
$("#resetButton").click(function() {
|
||||||
$("#fromDate").val('');
|
$("#fromDate").val('');
|
||||||
$("#toDate").val('');
|
$("#toDate").val('');
|
||||||
table.draw(); // Redraw the table to clear the filter
|
window.location="PORelease"
|
||||||
});
|
});
|
||||||
|
|
||||||
// Automatically focus and open the To Date picker when From Date is selected
|
// Automatically focus and open the To Date picker when From Date is selected
|
||||||
document.getElementById('fromDate').addEventListener('change', function() {
|
|
||||||
var fromDate = this.value;
|
|
||||||
var toDateInput = document.getElementById('toDate');
|
|
||||||
|
|
||||||
// Set the min attribute of the To Date input to the selected From Date
|
|
||||||
toDateInput.min = fromDate;
|
|
||||||
|
|
||||||
// Optionally reset the To Date input if the current value is before the new min date
|
|
||||||
if (toDateInput.value < fromDate) {
|
|
||||||
toDateInput.value = fromDate;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('.supplier-content').on('click', function() {
|
$('.supplier-content').on('click', function() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user