FIX_From date and to date

This commit is contained in:
VE10-Sanjeev 2024-08-16 10:22:46 +00:00
parent a6620b84e8
commit 440c772645
24 changed files with 3156 additions and 1795 deletions

View File

@ -311,7 +311,6 @@ class Inwardgateregister extends BaseController
function SaveIGR()
{
//print_r($this->request->getPost());die;
#Step 1 IGR Details
$PONO = $this->request->getPost('PONO');
$IsThisOpenOrderPO = $this->request->getPost('hiddenIsOpenOrder');
@ -362,9 +361,9 @@ class Inwardgateregister extends BaseController
// print_r( $igr );die;
#Step 4 Calling DB to Save IGR Master
$IGRNO = $this->inwardgateregister_model->addigrM($igr);
// Get the uploaded files
// $IGRNO = "IGRNO02750";
// $IGRNO = "IGRNO02734";
// echo "master - no problem";
// $IGRNO = "IGRNO02767";
// print_r($this->request->getPost());die;
if($IGRNO){
$files = $this->request->getFiles();
$fileNames = $this->request->getPost('file_name'); // Get user-entered file names
@ -461,20 +460,25 @@ class Inwardgateregister extends BaseController
$GrossWeightDate = !empty($grossWeightDate) && is_string($grossWeightDate) ? date('Y-m-d H:i:s', strtotime($grossWeightDate)) : null;
$TareWeightDate = !empty($tareWeightDate) && is_string($tareWeightDate) ? date('Y-m-d H:i:s', strtotime($tareWeightDate)) : null;
log_message('error', "TareWeightDate" . $TareWeightDate);
if (strlen($QuantityAsPerInvoice) > 0 && $QuantityAsPerInvoice != '0') {
$Remarks = $this->request->getPost('txtRemarks' . $i);
$ItemStatus = '';
if ($PendingQty == 0.00) {
$ItemStatus = $IGRStatus;
} else {
if (strlen($QuantityAsPerInvoice) > 0 && $QuantityAsPerInvoice != '0') {
if ($PendingQty == 0.00) {
$ItemStatus = $IGRStatus;
} else {
$ItemStatus = POLINEITEM_IGRPARTIAL_CREATED;
}
}
else if ((int)$IsThisOpenOrderPO == 1) {
$ItemStatus = POLINEITEM_IGRPARTIAL_CREATED;
}
$CreatedBy = $this->session->get('userId');
$igrDetails = array('IGRNO' => $IGRNO, 'MaterialCode' => $MaterialCode, 'QuantityAsPerInvoice' => $QuantityAsPerInvoice, 'Remarks' => $Remarks, 'IGRItemStatus' => $IGRItemStatus,'GrossWeight' => (float)$GrossWeight ,'GrossWeightDate'=> $GrossWeightDate,'TareWeight' => (float)$TareWeight ,'TareWeightDate' => $TareWeightDate ,'NetWeight' => (float)$NetWeight, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt);
$igrDetails['WeightFile'] = $requestWeightFileName;
log_message('error', 'SaveIGR igrDetails result : ' . json_encode($igrDetails));
$igrlineno = "";
$igrD = $this->inwardgateregister_model->addigrD($igrDetails);
$igrlineno = !empty($igrD) ? $igrD : '';
@ -527,7 +531,7 @@ class Inwardgateregister extends BaseController
log_message('error', "History updated successfully. History id: " . $history_id);
}
$get_pre_qty = $this->inwardgateregister_model->get_CurrentQty($MaterialCode);
$av_qty = 0;
$av_qty = 0; //$av_qty means Avaliable Quantity
if (!empty($get_pre_qty)) {
foreach ($get_pre_qty as $gt) {
$av_qty = $gt->Current_stock;
@ -543,49 +547,11 @@ class Inwardgateregister extends BaseController
$ReceivedQuantity = $key->ReceivedQuantity;
}
}
$totalReceivedqty = $ReceivedQuantity + $QuantityAsPerInvoice;
$totalReceivedqty = (int)$IsThisOpenOrderPO == 1 ? 0 : $ReceivedQuantity + $QuantityAsPerInvoice ;
// $totalReceivedqty = $ReceivedQuantity + $QuantityAsPerInvoice;
$POLineItem = array('ReceivedQuantity' => $totalReceivedqty, 'Status' => $ItemStatus, 'UpdateBY' => $CreatedBy, 'UpdatedOn' => $createddt);
$this->inwardgateregister_model->UpdatePOLineItem($POLineItem, $PONO, $MaterialCode);
}
else if ((int)$IsThisOpenOrderPO == 1) {
$ItemStatus = POLINEITEM_IGRPARTIAL_CREATED;
# Is this open order po means i have to save IGR DETAILS
$Remarks = $this->request->getPost('txtRemarks' . $i);
$ItemStatus = POLINEITEM_IGRPARTIAL_CREATED;
$CreatedBy = $this->session->get('userId');
$igrDetails = array('IGRNO' => $IGRNO, 'MaterialCode' => $MaterialCode, 'QuantityAsPerInvoice' => $QuantityAsPerInvoice, 'Remarks' => $Remarks, 'IGRItemStatus' => $IGRItemStatus,'GrossWeight' => (float)$GrossWeight ,'GrossWeightDate'=> $GrossWeightDate,'TareWeight' => (float)$TareWeight ,'TareWeightDate' => $TareWeightDate ,'NetWeight' => (float)$NetWeight, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt);
$igrDetails['WeightFile'] = $requestWeightFileName;
$igrD = $this->inwardgateregister_model->addigrD($igrDetails);
$igrD ='';
$igrlineno = !empty($igrD) ? $igrD : '';
log_message('error', 'SaveIGR igrDetails result : ' . json_encode($igrDetails)." IgrLineNo : ".$igrlineno);
$itemvalue = '';
$SupplierId = '';
$polineitemvalue = $this->inwardgateregister_model->getitemvalue($PONO, $MaterialCode);
foreach ($polineitemvalue as $it) {
$itemvalue = $it->Rate;
$SupplierId = $it->SupplierID;
}
# Is this open order po means i have to save add material history
$historydetails = array('MaterialCode' => $MaterialCode, 'Transaction_type' => "Add", 'Ref_Type' => "IGR", 'Ref_No' => $igrlineno, 'Quantity' => $QuantityAsPerInvoice, 'CreatedBy' => $CreatedBy, 'CreatedOn' => $createddt, 'SupplierID' => $SupplierId, 'ItemValue' => $itemvalue);
$this->inwardgateregister_model->addmaterialhistory($historydetails);
# Is this open order po means i have to save the get received qty in PO lineitem table
$get_pre_qty = $this->inwardgateregister_model->get_CurrentQty($MaterialCode);
$Recqty = $this->inwardgateregister_model->getPOLineItemReceivedQty($PONO, $MaterialCode);
$ReceivedQuantity = 0.00;
if (count($Recqty) > 0) {
foreach ($Recqty as $key) {
$ReceivedQuantity = $key->ReceivedQuantity;
}
}
$totalReceivedqty = $ReceivedQuantity + $QuantityAsPerInvoice;
$POLineItem = array('ReceivedQuantity' => $totalReceivedqty, 'Status' => $ItemStatus, 'UpdateBY' => $CreatedBy, 'UpdatedOn' => $createddt);
$this->inwardgateregister_model->UpdatePOLineItem($POLineItem, $PONO, $MaterialCode);
}
}
$this->inwardgateregister_model->UpdatePOMaster($PONO, $CreatedBy,$IGRStatus);
#Step 9 Updating Pending Quantity IN PO Master amd Line Item Details.

View File

@ -51,7 +51,7 @@ class Department_model extends Model
function departmentListing()
{
$builder = $this->db->table('t_departmentdetails as BaseT')
->select('BaseT.DepartmentName, BaseT.DEPCode, BaseT.HeadDept, BaseT.IsActive')
->select('BaseT.CreatedDt,BaseT.DepartmentName, BaseT.DEPCode, BaseT.HeadDept, BaseT.IsActive')
->orderBy("BaseT.DEPCode", "asc");
$query =$builder->get();
$result = $query->getResult();

View File

@ -153,7 +153,7 @@ class Inwardgateregister_model extends Model
->join('t_purchaseorder_lineitem POL', 'POL.PONO = POM.PONO')
->join('t_supplierdetailsn sup', 'POM.SupplierID = sup.SupplierID')
->join('t_ogr_master OGM ', 'POM.PONO = OGM.PONO_INV', 'left')
->where('POM.POType !=', SERVICE)
// ->where('POM.POType !=', SERVICE) // due to client requirements - he wants to remove the conidition.
->where('POM.Status', PO_RELEASED)
->orWhere('POM.Status',REQITEM_Emergency_PO_CREATED)
->orWhere('POM.Status',IGR_CREATED)
@ -164,6 +164,7 @@ class Inwardgateregister_model extends Model
$query = $builder->get();
$result = $query->getResult();
// echo $this->db->getLastQuery()->getQuery(); die;
return $result;
}
@ -328,11 +329,10 @@ class Inwardgateregister_model extends Model
->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO')
->join('t_supplierdetailsn` sup', 'PO.SupplierID = sup.SupplierID')
->where('igr.IGRStatus !=', MRIR_CREATED)
->where('PO.IsQualityChkReqired', 1)
->orderBy('igr.CreatedDate', 'desc');
$query = $builder->get();
$result = $query->getResult();
// echo $this->db->getLastQuery()->getQuery();die;
return $result;
}
@ -346,7 +346,7 @@ class Inwardgateregister_model extends Model
$builder = $this->db->table('t_igr_master igr')
->distinct()
->select('igr.IGRNO,igr.*,igrd.*,MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity,POM.POType')
->select('igr.IGRNO,igr.*,igrd.*,MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity,POM.POType,POM.IsOpenOrder')
->join('t_igr_details igrd', 'igrd.IGRNO = igr.IGRNO')
->join('t_purchaseorder_master POM', 'igr.PONO = POM.PONO')
->join('t_purchaseorder_lineitem POL', 'igr.PONO = POL.PONO and POL.MaterialCode=igrd.MaterialCode ')

View File

@ -1578,7 +1578,7 @@ QuantityRejected,ROUND(Quantity-ReceivedQuantity)as PendingQty,Per,
$builder = $this->db->table('t_purchaseorder_master mast')->distinct()
->select('mast.PONO,mast.TotalOrderValue,st.StatusCode,st.StatusName,emp.FirstName,mast.CreatedDate,ccm.CostCenterName,ccm.CostCenterCode,mast.POType as RType,mast.Remarks,DepartmentName,mast.ApprovedBy,(select EmpID from tbl_users where userId=mast.ApprovedBy )as EID,rmast.ReqType,mast.Status,mast.CapitalRange,
->select('mast.PODate,mast.PONO,mast.TotalOrderValue,st.StatusCode,st.StatusName,emp.FirstName,mast.CreatedDate,ccm.CostCenterName,ccm.CostCenterCode,mast.POType as RType,mast.Remarks,DepartmentName,mast.ApprovedBy,(select EmpID from tbl_users where userId=mast.ApprovedBy )as EID,rmast.ReqType,mast.Status,mast.CapitalRange,
(select FirstName from t_employee_details where EmpID=EID)as Approver,sup.SupplierName,sup.MSME')
// ->orderBy('mast.Status',"PO_CREATED");

View File

@ -18,7 +18,7 @@ class User_model extends Model
function userListing()
{
$builder = $this->db->table('t_employee_details EMP')
->select('EMP.EmpID,EMP.FirstName,EMP.LastName,EMP.Designation,EMP.EmailId,EMP.ContactNumber,
->select('user.createdDtm,EMP.EmpID,EMP.FirstName,EMP.LastName,EMP.Designation,user.email as EmailId,EMP.ContactNumber,
DEPT.DEPCode,DEPT.DepartmentName,role.role,user.userId')
->join('t_departmentdetails DEPT', 'EMP.Departmentcode = DEPT.DEPCode')
->join('tbl_users user', 'user.EmpID = EMP.EmpID')

View File

@ -5,6 +5,40 @@
margin: 0px !important;
}
</style>
<style>
.Date-filter-form {
display: flex;
align-items: center;
gap: 10px; /* Adjust the gap as needed */
}
.Date-filter-form input, .Date-filter-form button {
padding: 5px;
font-size: 14px;
}
.Date-filter-form button {
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
.Date-filter-form button:hover {
background-color: #0056b3;
}
.icon-button {
background: none;
border: none;
cursor: pointer;
color: #007bff;
font-size: 18px;
}
.icon-button:hover {
color: #0056b3;
}
th, td {
white-space: nowrap;
}
</style>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
@ -20,13 +54,25 @@
</div>
<!-- /.box-header -->
<div class="box-body">
<form class="Date-filter-form" id="DateRangeFilter" >
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input type="text" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input type="text" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit">Search</button>
<i class="fa fa-repeat" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
<table id="example1" class="table table-hover editableTable" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
<!-- <th>#</th> -->
<th>PONO#</th>
<th>PO Type</th>
<th>PO Date</th>
<th>PONO</th>
<th>PO Type</th>
<th>Supplier Name</th>
<th>Total Order Value</th>
<th>PO Status</th>
@ -44,12 +90,12 @@
?>
<tr id="<?php echo $index; ?>">
<!-- <td align="left"><?php echo $index; ?></td> -->
<td><?php echo $record->PONO ?></td>
<td><?php echo $record->ReqType ?></td>
<td align="right"><?php $Pdt = new DateTime($record->PODate);
$PODate = $Pdt->format('d-m-Y');
echo $PODate
?></td>
<td><?php echo $record->PONO ?></td>
<td><?php echo $record->ReqType ?></td>
<td><?php echo $record->SupplierName ?></td>
<td align="right"><?php echo $record->TotalOrderValue ?></td>
@ -121,7 +167,7 @@
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<script>
<!-- <script>
$(function() {
$.fn.dataTable.moment('DD-MM-YYYY');
$('#example1').DataTable({
@ -138,5 +184,85 @@
"autoWidth": false
});
});
</script>
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
</script> -->
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
<script>
$(document).ready(function() {
$.fn.dataTable.ext.type.order['date-eu-pre'] = function (date) {
var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
};
// Initialize the DataTable
var table = $('#example1').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"columnDefs": [{
"targets": 0,
"type": "date-eu"
}],
"aaSorting": [
[0, "desc"]
],
"info": true,
"autoWidth": true,
"pageLength": 10,
"lengthMenu": [10, 25, 50, 100],
});
// Initialize the datepickers
$("#fromDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var minDate = $(this).datepicker("getDate");
$("#toDate").datepicker("option", "minDate", minDate);
}
});
$("#toDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var maxDate = $(this).datepicker("getDate");
$("#fromDate").datepicker("option", "maxDate", maxDate);
}
});
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").datepicker("setDate", null);
$("#toDate").datepicker("setDate", null);
$("#toDate").datepicker("option", "minDate", null);
$("#fromDate").datepicker("option", "maxDate", null);
table.draw();
});
// Date range filter
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $("#fromDate").datepicker("getDate");
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[0]; // Assuming the date is in the first column
// Convert dateStr to Date object
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
if (!fromDate || !toDate) {
return true; // No filter if dates are not selected
}
return date >= fromDate && date <= toDate;
}
);
// Handle form submission
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
});
});
</script>

View File

@ -1986,7 +1986,7 @@ if (!empty($getlogpodtl)) {
<th>SNo</th>
<th>Requisition No</th>
<th>Item Code</th>
<th>Item Description</th>
<th>Item Name</th>
<th>Quantity</th>
<th>UOM</th>
<th>Rate <?php echo "($INRSYM)" ?></th>
@ -2022,7 +2022,7 @@ if (!empty($getlogpodtl)) {
<td align="left"><?php echo $index; ?></td>
<td><?php echo $record->ReqNo ?></td>
<td><?php echo $record->MaterialCode ?></td>
<td><?php echo $record->ServiceMaterialDescription ?></td>
<td><?php echo $record->MaterialName ?></td>
<td align="right"><?php echo $record->Quantity ?></td>
<td><?php echo $record->UOM ?></td>
@ -2477,10 +2477,6 @@ if (!empty($getlogpodtl)) {
<td align="left"><%=BasicAmount%></td>
<td align="left"><%=Taxvalue%></td>
<td align="left"><%=TotalValue%></td>
<td align="left"><%=ActualQuantity%></td>
<td align="left"><%=ReceivedQuantity%></td>
<td align="left"><%=PendingQuantity%></td>
<td>
<a data-target='#EDITSERVICE' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#EDITSERVICE"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the <%=ReqNo%> Requisition details"></i>&nbsp;&nbsp;&nbsp;</a> <a href='#' onclick="DeleteRow(<%=index%>)" class="link" data-id="<%=index%>" data-userid="<%=index%>" id="Del"><span class="glyphicon glyphicon-trash"></span></a>
@ -2580,16 +2576,13 @@ if (!empty($getlogpodtl)) {
index: temp,
ReqNo: Reqnumber,
MaterialCode: materialCode,
MaterialName: ServiceDescription,
MaterialName: materialName,
Quantity: quantity,
UOM: uom,
Rate: itemRate,
BasicAmount: basicval,
Taxvalue: TotalTaxValue,
TotalValue: TotalOrderValue,
ActualQuantity: quantity,
ReceivedQuantity: 0,
PendingQuantity: quantity
TotalValue: TotalOrderValue
}));
@ -2684,7 +2677,7 @@ if (!empty($getlogpodtl)) {
var cellval = tr.cells;
cellval[2].innerHTML = editMaterialCode;
cellval[3].innerHTML = ServiceDescription;
cellval[3].innerHTML = editDescription;
cellval[4].innerHTML = editQuantity;
cellval[5].innerHTML = editUOM;
cellval[6].innerHTML = parseFloat(itemRate).toFixed(2);

View File

@ -32,6 +32,29 @@
white-space: nowrap;
}
</style>
<style>
.dataTables_wrapper .top {
display: flex;
justify-content: space-between;
align-items: center;
}
.dataTables_wrapper .dataTables_length {
float: left;
}
.dataTables_wrapper .dt-buttons,
.dataTables_wrapper .dataTables_filter {
float: right;
margin-left: 10px;
}
.dataTables_wrapper .dt-buttons {
margin-top: 10px;
margin-bottom: 10px;
}
.dataTables_wrapper .dataTables_filter {
margin-top: 10px;
margin-bottom: 10px;
}
</style>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
@ -85,7 +108,6 @@
<table id="dataTableHistoriek" class="table table-bordered table-hover editableTable" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
<th style="display:none;"></th>
<th>PO Date</th>
<th>PONO#</th>
<th>PO Type</th>
@ -105,7 +127,6 @@
$index = $index + 1;
?>
<tr id="<?php echo $index; ?>">
<td style="display:none;"><?php echo $record->PODate ?></th>
<td align="right"><?php $Pdt = new DateTime($record->PODate);
$PODate = $Pdt->format('d-m-Y');
echo $PODate
@ -184,25 +205,58 @@
</div>
<!-- /.content-wrapper -->
<script src="https://cdn.datatables.net/plug-ins/1.10.11/sorting/date-eu.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.4/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.4/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.4/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/plug-ins/1.13.6/sorting/datetime-moment.js"></script>
<script>
$(document).ready(function() {
$.fn.dataTable.ext.type.order['date-eu-pre'] = function (date) {
var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
};
// Initialize the DataTable
var table = $('#dataTableHistoriek').DataTable({
"paging": true,
"lengthChange": true,
"scrollCollapse": true,
"searching": true,
"ordering": true,
"columnDefs": [{
"targets": 1,
"targets": 0,
"type": "date-eu"
}],
"aaSorting": [
[1, "desc"]
[0, "desc"]
],
"info": true,
"autoWidth": true,
"pageLength": 10,
"lengthMenu": [10, 25, 50, 100],
"dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" +
"<'row'<'col-md-6'><'col-md-6'>>" +
"<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>",
"buttons": [
{
extend: 'excelHtml5',
text: 'Export to Excel',
title: 'Purchase Order',
exportOptions: {
columns: ':visible:not(:last-child)' // Exclude first and last columns
}
},
{
extend: 'pdfHtml5',
text: 'Export to PDF',
title: 'Purchase Order',
exportOptions: {
columns: ':visible:not(:last-child)' // Exclude first and last columns
}
}]
});
@ -239,7 +293,7 @@ $(document).ready(function() {
var fromDate = $("#fromDate").datepicker("getDate");
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[1]; // Assuming the date is in the first column
var dateStr = data[0]; // Assuming the date is in the first column
// Convert dateStr to Date object
var dateParts = dateStr.split("-");

View File

@ -184,10 +184,9 @@
<table id="cc" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;" >
<thead style="background-color: #ddd;">
<tr>
<th style="text-align:center">PO No</th>
<th style="text-align:center">PO Date</th>
<th style="text-align:center">Supplier Name</th>
<th style="text-align:center">PO Date</th>
<th style="text-align:center">PO No</th>
<th style="text-align:center">Supplier Name</th>
<th style="text-align:center">Material Name</th>
<th style="text-align:center">Category</th>
<th style="text-align:center">Ordered Quantity</th>
@ -214,12 +213,13 @@
<!-- <td><span>
<a href="<?= base_url() ?>report/link_purchase?sid=<?php //echo $rel->sid;?>&ab=<?php //echo $ab;?>&mid=<?php //echo $rel->mid;?>"><?php //echo $rel->supplier_name;?></a>
</span></td>-->
<td><span>
<?php echo $rel->pdate;?>
</span></td>
<td><span>
<?php echo $rel->po;?>
</span></td>
<td><span>
<?php echo $rel->pdate;?>
</span></td>
<td><span>
<?php echo $rel->supplier;?>
@ -371,7 +371,9 @@ $(document).ready(function() {
"language": {
"emptyTable": "<center> Data Not Found ! </center>"
},
"aaSorting": [[ 1, "desc" ]],
"aaSorting": [[ 0, "desc" ]],
"pageLength": 10,
"lengthMenu": [10, 25, 50, 100],
"autoWidth": false,
orderCellsTop: true,
"dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" +

View File

@ -6447,7 +6447,7 @@ if (!empty($INRSYMBOL)) {
index: temp,
ReqNo: Reqnumber,
MaterialCode: materialCode,
MaterialName: ItemServiceDescription,
MaterialName: materialName,
Quantity: quantity,
UOM: uom,
Rate: itemRate,
@ -6801,7 +6801,7 @@ $('#content').loader('hide');
var tr = document.getElementById(userid);
var cellval = tr.cells;
cellval[3].innerHTML = editMaterialCode;
cellval[3].innerHTML = ItemServiceDescription;
cellval[3].innerHTML = editDescription;
cellval[4].innerHTML = editQuantity;
cellval[5].innerHTML = editUOM;
cellval[6].innerHTML = itemRate;

View File

@ -1,79 +1,137 @@
<style>
.Date-filter-form {
display: flex;
align-items: center;
gap: 10px;
/* Adjust the gap as needed */
}
.Date-filter-form input,
.Date-filter-form button {
padding: 5px;
font-size: 14px;
}
.Date-filter-form button {
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
.Date-filter-form button:hover {
background-color: #0056b3;
}
.icon-button {
background: none;
border: none;
cursor: pointer;
color: #007bff;
font-size: 18px;
}
.icon-button:hover {
color: #0056b3;
}
</style>
<div class="content-wrapper">
<section class="content">
<div class="box">
<div class="box-header">
<CENTER><h3 class="box-title"> Asset Details</h3></CENTER>
<div class="box">
<div class="box-header">
<CENTER>
<h3 class="box-title"> Asset Details</h3>
</CENTER>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 col-md-6">
<form class="Date-filter-form" id="DateRangeFilter">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input type="text" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input type="text" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit">Search</button>
<i class="fa fa-repeat" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
</div>
<div class="col-xs-12 col-md-6 text-right">
<div class="form-group">
<a class="btn btn-success" href="<?php echo base_url(); ?>addasset">Add New Asset</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportasset">Export Asset Details <i class="fa fa-download" aira-hidden="true"></i></a>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 text-right">
<div class="form-group">
<a class="btn btn-success" href="<?php echo base_url(); ?>addasset">Add New Asset</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportasset">Export Asset Details <i class="fa fa-download"aira-hidden="true"></i></a>
<div class="row">
<div class="col-xs-12">
<table class="table table-bordered table-hover" id="datatable" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
<th>Created Date</th>
<th>Asset Code</th>
<th>Asset Name</th>
<th>Asset Description</th>
<th>Department Name</th>
<th>Location</th>
<th>Asset User</th>
<th>Supplier Name</th>
<th>Received Date</th>
<th>Asset Value</th>
<th>Asset Status</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
?>
<tr>
<?php if (date('d-m-Y', strtotime($record->CreatedDt)) == "30-11--0001") {
$cdate = '00-00-0000';
} else {
$cdate = date('d-m-Y', strtotime($record->CreatedDt));
} ?>
<td align="right"><?php echo $cdate; ?></td>
<td><u><a href="<?php echo base_url() . 'assetdetails/editOldasset/?AssetID=' . $record->AssetCode ?>" data-toggle="tooltip" title="<?php echo $record->AssetCode; ?> - Click here to view Asset details"><?php echo substr($record->AssetCode, 5) ?>
<td><?php echo $record->AssetName ?></td>
<td><?php echo $record->Description ?></td>
<td><?php echo $record->DepartmentName ?></td>
<td><?php echo $record->Location ?></td>
<td><?php echo $record->UserName ?></td>
<td><?php echo $record->SupplierName ?></td>
<td><?php
$dtpurchase = new DateTime($record->DateOfPurchase);
$DOPurchase = $dtpurchase->format('d-m-Y');
echo $DOPurchase ?></td>
<td><?php echo number_format($record->AssetValue, 2); ?></td>
<td><?php echo $record->AssetStatus ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table class="table table-bordered table-hover" id="datatable" style="background-color:#fff;font-size:12px;" >
<thead style="background-color: #ddd;">
<tr>
<th>Asset Code</th>
<th>Asset Name</th>
<th>Asset Description</th>
<th>Department Name</th>
<th>Location</th>
<th>Asset User</th>
<th>Supplier Name</th>
<th>Received Date</th>
<th>Asset Value</th>
<th>Asset Status</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($userRecords))
{
foreach($userRecords as $record)
{
?>
<tr>
<td><u><a href="<?php echo base_url().'assetdetails/editOldasset/?AssetID='.$record->AssetCode ?>" data-toggle="tooltip" title="<?php echo $record->AssetCode; ?> - Click here to view Asset details"><?php echo substr($record->AssetCode, 5) ?>
<td><?php echo $record->AssetName ?></td>
<td><?php echo $record->Description ?></td>
<td><?php echo $record->DepartmentName ?></td>
<td><?php echo $record->Location ?></td>
<td><?php echo $record->UserName ?></td>
<td><?php echo $record->SupplierName ?></td>
<td><?php
$dtpurchase = new DateTime($record->DateOfPurchase);
$DOPurchase = $dtpurchase ->format('d-m-Y');
echo $DOPurchase ?></td>
<td><?php echo number_format($record->AssetValue, 2); ?></td>
<td><?php echo $record->AssetStatus ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
<script type="text/javascript">
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
<!-- <script type="text/javascript">
$(function () {
$.fn.dataTable.moment( 'DD-MM-YYYY' );
@ -90,6 +148,85 @@
});
});
</script>
</script> -->
<!-- <script src="https://cdn.datatables.net/plug-ins/1.10.11/sorting/date-eu.js"></script> -->
<script>
$(document).ready(function() {
$.fn.dataTable.ext.type.order['date-eu-pre'] = function(date) {
var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
};
// Initialize the DataTable
var table = $('#datatable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"columnDefs": [{
"targets": 0,
"type": "date-eu"
}],
"aaSorting": [
[0, "desc"]
],
"info": true,
"autoWidth": true,
"pageLength": 10,
"lengthMenu": [10, 25, 50, 100],
});
// Initialize the datepickers
$("#fromDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var minDate = $(this).datepicker("getDate");
$("#toDate").datepicker("option", "minDate", minDate);
}
});
$("#toDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var maxDate = $(this).datepicker("getDate");
$("#fromDate").datepicker("option", "maxDate", maxDate);
}
});
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").datepicker("setDate", null);
$("#toDate").datepicker("setDate", null);
$("#toDate").datepicker("option", "minDate", null);
$("#fromDate").datepicker("option", "maxDate", null);
table.draw();
});
// Date range filter
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $("#fromDate").datepicker("getDate");
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[0]; // Assuming the date is in the first column
// Convert dateStr to Date object
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
if (!fromDate || !toDate) {
return true; // No filter if dates are not selected
}
return date >= fromDate && date <= toDate;
}
);
// Handle form submission
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
});
});
</script>

View File

@ -1,100 +1,154 @@
<div class="content-wrapper">
<section class="content">
<div class="box">
<div class="box-header">
<CENTER><h3 class="box-title"> Configuration Details</h3></CENTER>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 text-right">
<div class="form-group">
<a class="btn btn-success" href="<?php echo base_url(); ?>addconfig">Add New Configuration</a>
</div>
</div>
</div>
<div class="col-md-12">
<?php
<style>
.Date-filter-form {
display: flex;
align-items: center;
gap: 10px;
/* Adjust the gap as needed */
}
.Date-filter-form input,
.Date-filter-form button {
padding: 5px;
font-size: 14px;
}
.Date-filter-form button {
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
.Date-filter-form button:hover {
background-color: #0056b3;
}
.icon-button {
background: none;
border: none;
cursor: pointer;
color: #007bff;
font-size: 18px;
}
.icon-button:hover {
color: #0056b3;
}
</style>
<div class="content-wrapper">
<section class="content">
<div class="box">
<div class="box-header">
<CENTER>
<h3 class="box-title"> Configuration Details</h3>
</CENTER>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 col-md-6">
<form class="Date-filter-form" id="DateRangeFilter">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input type="text" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input type="text" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit">Search</button>
<i class="fa fa-repeat" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
</div>
<div class="col-xs-12 col-md-6 text-right">
<div class="form-group">
<a class="btn btn-success" href="<?php echo base_url(); ?>addconfig">Add New Configuration</a>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if ($success) {
?>
<div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<div class="row">
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>');
<div class="row">
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>');
?> </div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table id="configtable" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
<th>Configuration ID</th>
<th>Configuration Name</th>
<th>Description</th>
<th>Create Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table id="configtable" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
<th>Create Date</th>
<th>Configuration ID</th>
<th>Configuration Name</th>
<th>Description</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
?>
<tr>
<td><?php echo $record->Config_ID ?></td>
<td><?php echo $record->ConfigName ?></td>
<td><?php echo $record->Comments ?> </td>
<!-- <td><?php echo $record->CreatedDate ?></td> -->
<!-- <td align="right"><?php $dt = new DateTime($record->CreatedDate);
$CreatedDate = $dt->format('d-m-Y');
echo $CreatedDate ?> </td> -->
<?php if (date('d-m-Y', strtotime($record->CreatedDate)) == "30-11--0001") {
<tr>
<?php if (date('d-m-Y', strtotime($record->CreatedDate)) == "30-11--0001") {
$cdate = '00-00-0000';
} else {
$cdate = date('d-m-Y', strtotime($record->CreatedDate));
} ?>
<td align="right"><?php echo $cdate; ?> </td>
<td align="right"><?php echo $cdate; ?> </td>
<td><?php echo $record->Config_ID ?></td>
<td><?php echo $record->ConfigName ?></td>
<td><?php echo $record->Comments ?> </td>
<!-- <td><?php echo $record->CreatedDate ?></td> -->
<td><a href="<?php echo base_url() . 'configurationctrl/editconfig?ConfigID=' . $record->Config_ID; ?>"><i class="fa fa-pencil"></i>&nbsp;&nbsp;&nbsp;</a>
<!-- <a><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a> -->
</td>
<!-- <td align="right"><?php $dt = new DateTime($record->CreatedDate);
$CreatedDate = $dt->format('d-m-Y');
echo $CreatedDate ?> </td> -->
</tr>
<?php
<td><a href="<?php echo base_url() . 'configurationctrl/editconfig?ConfigID=' . $record->Config_ID; ?>"><i class="fa fa-pencil"></i>&nbsp;&nbsp;&nbsp;</a>
<!-- <a><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a> -->
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</tbody>
</table>
</div>
</div>
</div>
</section>
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
</div>
</div>
</div>
</section>
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
<script type="text/javascript">
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
<!-- <script type="text/javascript">
$(function() {
$.fn.dataTable.moment('DD-MM-YYYY');
$('#configtable').DataTable({
@ -110,4 +164,84 @@
});
});
</script>
</script> -->
<script>
$(document).ready(function() {
$.fn.dataTable.ext.type.order['date-eu-pre'] = function(date) {
var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
};
// Initialize the DataTable
var table = $('#configtable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"columnDefs": [{
"targets": 0,
"type": "date-eu"
}],
"aaSorting": [
[0, "desc"]
],
"info": true,
"autoWidth": true,
"pageLength": 10,
"lengthMenu": [10, 25, 50, 100],
});
// Initialize the datepickers
$("#fromDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var minDate = $(this).datepicker("getDate");
$("#toDate").datepicker("option", "minDate", minDate);
}
});
$("#toDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var maxDate = $(this).datepicker("getDate");
$("#fromDate").datepicker("option", "maxDate", maxDate);
}
});
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").datepicker("setDate", null);
$("#toDate").datepicker("setDate", null);
$("#toDate").datepicker("option", "minDate", null);
$("#fromDate").datepicker("option", "maxDate", null);
table.draw();
});
// Date range filter
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $("#fromDate").datepicker("getDate");
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[0]; // Assuming the date is in the first column
// Convert dateStr to Date object
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
if (!fromDate || !toDate) {
return true; // No filter if dates are not selected
}
return date >= fromDate && date <= toDate;
}
);
// Handle form submission
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
});
});
</script>

View File

@ -1,4 +1,35 @@
<div class="content-wrapper">
<style>
.Date-filter-form {
display: flex;
align-items: center;
gap: 10px; /* Adjust the gap as needed */
}
.Date-filter-form input, .Date-filter-form button {
padding: 5px;
font-size: 14px;
}
.Date-filter-form button {
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
.Date-filter-form button:hover {
background-color: #0056b3;
}
.icon-button {
background: none;
border: none;
cursor: pointer;
color: #007bff;
font-size: 18px;
}
.icon-button:hover {
color: #0056b3;
}
</style>
<div class="content-wrapper">
<section class="content">
<div class="box">
<div class="box-header">
@ -8,19 +39,31 @@
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 text-right">
<div class="form-group">
<a data-toggle="modal" href="#ccwizard" data-id="0" data-name="" class="btn btn-success">Add New Cost List</a>
<div class="col-xs-12 col-md-6">
<form class="Date-filter-form" id="DateRangeFilter" >
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input type="text" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input type="text" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit">Search</button>
<i class="fa fa-repeat" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
</div>
<div class="col-xs-12 col-md-6 text-right">
<div class="form-group">
<a data-toggle="modal" href="#ccwizard" data-id="0" data-name="" class="btn btn-success">Add New Cost List</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportcost">Export Cost Details <i class="fa fa-download" aira-hidden="true"></i></a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table id="datatable" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
<th style="display:none;"></th>
<th>Create Date</th>
<th>Create Time</th>
<th>Cost Center Code</th>
@ -33,16 +76,13 @@
<tbody>
<?php
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
foreach ($userRecords as $record) {
$createdat = new DateTime($record->CreatedDate);
$date = $createdat->format('d-m-Y');
$time = $createdat->format('h:i A');
?>
<tr>
<td style="display:none;"><?php echo $record->CreatedDate ?></td>
<td align="right"><?php echo $date; ?></td>
<td align="right"><?php echo $date; ?></td>
<td align="right"><?php echo $time; ?></td>
<td><?php echo $record->code ?></td>
<td><?php echo $record->CostCenterName ?></td>
@ -123,22 +163,22 @@
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
<script type="text/javascript">
$(function() {
$.fn.dataTable.moment('DD-MM-YYYY HH:mm A');
$('#datatable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
// "columnDefs" : [{"targets":3, "type":"date-eu"}],
"aaSorting": [
[3, "desc"]
],
"info": true,
"autoWidth": true
// $(function() {
// $.fn.dataTable.moment('DD-MM-YYYY HH:mm A');
// $('#datatable').DataTable({
// "paging": true,
// "lengthChange": true,
// "searching": true,
// "ordering": true,
// // "columnDefs" : [{"targets":3, "type":"date-eu"}],
// "aaSorting": [
// [3, "desc"]
// ],
// "info": true,
// "autoWidth": true
});
});
// });
// });
</script>
<script>
@ -188,5 +228,84 @@
});
});
</script>
<script>
$(document).ready(function() {
$.fn.dataTable.ext.type.order['date-eu-pre'] = function (date) {
var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
};
// Initialize the DataTable
var table = $('#datatable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"columnDefs": [{
"targets": 0,
"type": "date-eu"
}],
"aaSorting": [
[0, "desc"]
],
"info": true,
"autoWidth": true,
"pageLength": 10,
"lengthMenu": [10, 25, 50, 100],
});
// Initialize the datepickers
$("#fromDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var minDate = $(this).datepicker("getDate");
$("#toDate").datepicker("option", "minDate", minDate);
}
});
$("#toDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var maxDate = $(this).datepicker("getDate");
$("#fromDate").datepicker("option", "maxDate", maxDate);
}
});
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").datepicker("setDate", null);
$("#toDate").datepicker("setDate", null);
$("#toDate").datepicker("option", "minDate", null);
$("#fromDate").datepicker("option", "maxDate", null);
table.draw();
});
// Date range filter
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $("#fromDate").datepicker("getDate");
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[0]; // Assuming the date is in the first column
// Convert dateStr to Date object
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
if (!fromDate || !toDate) {
return true; // No filter if dates are not selected
}
return date >= fromDate && date <= toDate;
}
);
// Handle form submission
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
});
});
</script>
<!-- <script src="https://cdn.datatables.net/plug-ins/1.10.11/sorting/date-eu.js"></script> -->

View File

@ -1,104 +1,164 @@
<script>
// (function(l,q){var e=function(b,c){b.extend(!0,c.defaults,{dom:"<'row'<'col-sm-9'l><'col-sm-3'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-8'i><'col-sm-4'p>>",renderer:"bootstrap"});b.extend(c.ext.classes,{sWrapper:"dataTables_wrapper form-inline dt-bootstrap",sFilterInput:"form-control input-sm",sLengthSelect:"form-control input-sm"});c.ext.renderer.pageButton.bootstrap=function(g,e,r,s,i,m){var t=new c.Api(g),u=g.oClasses,j=g.oLanguage.oPaginate,d,f,n=0,p=function(c,e){var k,h,o,a,l=function(a){a.preventDefault();
// b(a.currentTarget).hasClass("disabled")||t.page(a.data.action).draw(!1)};k=0;for(h=e.length;k<h;k++)if(a=e[k],b.isArray(a))p(c,a);else{f=d="";switch(a){case "ellipsis":d="&hellip;";f="disabled";break;case "first":d=j.sFirst;f=a+(0<i?"":" disabled");break;case "previous":d=j.sPrevious;f=a+(0<i?"":" disabled");break;case "next":d=j.sNext;f=a+(i<m-1?"":" disabled");break;case "last":d=j.sLast;f=a+(i<m-1?"":" disabled");break;default:d=a+1,f=i===a?"active":""}d&&(o=b("<li>",{"class":u.sPageButton+" "+
// f,id:0===r&&"string"===typeof a?g.sTableId+"_"+a:null}).append(b("<a>",{href:"#","aria-controls":g.sTableId,"data-dt-idx":n,tabindex:g.iTabIndex}).html(d)).appendTo(c),g.oApi._fnBindAction(o,{action:a},l),n++)}},h;try{h=b(q.activeElement).data("dt-idx")}catch(l){}p(b(e).empty().html('<ul class="pagination"/>').children("ul"),s);h&&b(e).find("[data-dt-idx="+h+"]").focus()};c.TableTools&&(b.extend(!0,c.TableTools.classes,{container:"DTTT btn-group",buttons:{normal:"btn btn-default",disabled:"disabled"},
// collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled:"disabled"}},print:{info:"DTTT_print_info"},select:{row:"active"}}),b.extend(!0,c.TableTools.DEFAULTS.oTags,{collection:{container:"ul",button:"li",liner:"a"}}))};"function"===typeof define&&define.amd?define(["jquery","datatables"],e):"object"===typeof exports?e(require("jquery"),require("datatables")):jQuery&&e(jQuery,jQuery.fn.dataTable)})(window,document);
// (function(l,q){var e=function(b,c){b.extend(!0,c.defaults,{dom:"<'row'<'col-sm-9'l><'col-sm-3'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-8'i><'col-sm-4'p>>",renderer:"bootstrap"});b.extend(c.ext.classes,{sWrapper:"dataTables_wrapper form-inline dt-bootstrap",sFilterInput:"form-control input-sm",sLengthSelect:"form-control input-sm"});c.ext.renderer.pageButton.bootstrap=function(g,e,r,s,i,m){var t=new c.Api(g),u=g.oClasses,j=g.oLanguage.oPaginate,d,f,n=0,p=function(c,e){var k,h,o,a,l=function(a){a.preventDefault();
// b(a.currentTarget).hasClass("disabled")||t.page(a.data.action).draw(!1)};k=0;for(h=e.length;k<h;k++)if(a=e[k],b.isArray(a))p(c,a);else{f=d="";switch(a){case "ellipsis":d="&hellip;";f="disabled";break;case "first":d=j.sFirst;f=a+(0<i?"":" disabled");break;case "previous":d=j.sPrevious;f=a+(0<i?"":" disabled");break;case "next":d=j.sNext;f=a+(i<m-1?"":" disabled");break;case "last":d=j.sLast;f=a+(i<m-1?"":" disabled");break;default:d=a+1,f=i===a?"active":""}d&&(o=b("<li>",{"class":u.sPageButton+" "+
// f,id:0===r&&"string"===typeof a?g.sTableId+"_"+a:null}).append(b("<a>",{href:"#","aria-controls":g.sTableId,"data-dt-idx":n,tabindex:g.iTabIndex}).html(d)).appendTo(c),g.oApi._fnBindAction(o,{action:a},l),n++)}},h;try{h=b(q.activeElement).data("dt-idx")}catch(l){}p(b(e).empty().html('<ul class="pagination"/>').children("ul"),s);h&&b(e).find("[data-dt-idx="+h+"]").focus()};c.TableTools&&(b.extend(!0,c.TableTools.classes,{container:"DTTT btn-group",buttons:{normal:"btn btn-default",disabled:"disabled"},
// collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled:"disabled"}},print:{info:"DTTT_print_info"},select:{row:"active"}}),b.extend(!0,c.TableTools.DEFAULTS.oTags,{collection:{container:"ul",button:"li",liner:"a"}}))};"function"===typeof define&&define.amd?define(["jquery","datatables"],e):"object"===typeof exports?e(require("jquery"),require("datatables")):jQuery&&e(jQuery,jQuery.fn.dataTable)})(window,document);
</script>
<style>
.Date-filter-form {
display: flex;
align-items: center;
gap: 10px;
/* Adjust the gap as needed */
}
.Date-filter-form input,
.Date-filter-form button {
padding: 5px;
font-size: 14px;
}
.Date-filter-form button {
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
.Date-filter-form button:hover {
background-color: #0056b3;
}
.icon-button {
background: none;
border: none;
cursor: pointer;
color: #007bff;
font-size: 18px;
}
.icon-button:hover {
color: #0056b3;
}
</style>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<!-- <section class="content-header"> -->
<section class="content">
<!-- Content Header (Page header) -->
<!-- <section class="content-header"> -->
<section class="content">
<div class="row">
<div class="col-md-12">
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if ($success) {
?>
<div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<div class="col-md-12">
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if ($success) {
?>
<div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<div class="row">
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>');
?> </div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>');
?> </div>
</div>
<div class="box">
<div class="box-header">
<center> <h3 class="box-title">Department Details</h3></center>
</div>
</div>
<div class="box">
<div class="box-header">
<center>
<h3 class="box-title">Department Details</h3>
</center>
</div>
<div class="container-fluid">
</div>
<div class="container-fluid">
<!-- </section> -->
<!-- <section class="content"> -->
<div class="row">
<div class="col-xs-12 text-right">
<div class="form-group">
<a class="btn btn-success" href="<?php echo base_url(); ?>adddepartment">Add New department</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportdepartment">Export department details <i class="fa fa-download"aira-hidden="true"></i></a>
</div>
<div class="row">
<div class="col-xs-12 col-md-6">
<form class="Date-filter-form" id="DateRangeFilter">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input type="text" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input type="text" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit">Search</button>
<i class="fa fa-repeat" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
</div>
<div class="col-xs-12 col-md-6 text-right">
<div class="form-group">
<a class="btn btn-success" href="<?php echo base_url(); ?>adddepartment">Add New department</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportdepartment">Export department details <i class="fa fa-download" aira-hidden="true"></i></a>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table class="table table-bordered table-hover" id="datatable" style="background-color:#fff;font-size:12px;" >
<thead style="background-color: #ddd;">
<div class="col-xs-12">
<table class="table table-bordered table-hover" id="datatable" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
<th>Create Date</th>
<th>Department Code</th>
<th>Department Name</th>
<th>Head Department</th>
<th>IsActive</th>
<!-- <th>Action</th> -->
</tr>
</thead>
<tbody>
<?php
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
?>
<tr>
<th>Department Code</th>
<th>Department Name</th>
<th>Head Department</th>
<th>IsActive</th>
<!-- <th>Action</th> -->
<!-- <td title=" - Click here to view department details"> </td> -->
<?php if (date('d-m-Y', strtotime($record->CreatedDt)) == "30-11--0001") {
$cdate = '00-00-0000';
} else {
$cdate = date('d-m-Y', strtotime($record->CreatedDt));
} ?>
<td align="right"><?php echo $cdate; ?> </td>
<td><u><a href="<?php echo base_url() . 'editOlddepartment/?SID=' . $record->DEPCode ?>" data-toggle="tooltip" title="<?php echo $record->DEPCode ?> - Click here to view Department details"><?php echo $record->DEPCode; ?></a></u></td>
<td><?php echo $record->DepartmentName ?></td>
<td><?php echo $record->HeadDept ?></td>
<td><?php if ($record->IsActive == 1) {
echo "Active";
} else {
echo "In Active";
} ?></td>
<!-- <td><a data-toggle="tooltip" "><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the department details"></i>&nbsp;&nbsp;&nbsp;</a></td> -->
</tr>
</thead>
<tbody>
<?php
if(!empty($userRecords))
{
foreach($userRecords as $record)
{
?>
<tr>
<!-- <td title=" - Click here to view department details"> </td> -->
<td><u><a href="<?php echo base_url().'editOlddepartment/?SID='.$record->DEPCode?>" data-toggle="tooltip" title="<?php echo $record->DEPCode ?> - Click here to view Department details"><?php echo $record->DEPCode; ?></a></u></td>
<td><?php echo $record->DepartmentName ?></td>
<td><?php echo $record->HeadDept ?></td>
<td><?php if($record->IsActive == 1){echo "Active";}
else { echo "In Active";} ?></td>
<!-- <td><a data-toggle="tooltip" "><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the department details"></i>&nbsp;&nbsp;&nbsp;</a></td> -->
</tr>
<?php
}
}
?>
</tbody>
</table>
</div><!-- colsxs12 div closed-->
<?php
}
}
?>
</tbody>
</table>
</div><!-- colsxs12 div closed-->
</div><!-- row div closed -->
</div><!-- containerfluid div closed -->
</div><!-- box div closed -->
</section>
</div><!-- containerfluid div closed -->
</div><!-- box div closed -->
</section>
</div><!-- content wrapper div closed -->
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript">
<!-- <script type="text/javascript">
$(function () {
@ -113,4 +173,84 @@
});
});
</script>
</script> -->
<script>
$(document).ready(function() {
$.fn.dataTable.ext.type.order['date-eu-pre'] = function(date) {
var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
};
// Initialize the DataTable
var table = $('#datatable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"columnDefs": [{
"targets": 0,
"type": "date-eu"
}],
"aaSorting": [
[0, "desc"]
],
"info": true,
"autoWidth": true,
"pageLength": 10,
"lengthMenu": [10, 25, 50, 100],
});
// Initialize the datepickers
$("#fromDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var minDate = $(this).datepicker("getDate");
$("#toDate").datepicker("option", "minDate", minDate);
}
});
$("#toDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var maxDate = $(this).datepicker("getDate");
$("#fromDate").datepicker("option", "maxDate", maxDate);
}
});
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").datepicker("setDate", null);
$("#toDate").datepicker("setDate", null);
$("#toDate").datepicker("option", "minDate", null);
$("#fromDate").datepicker("option", "maxDate", null);
table.draw();
});
// Date range filter
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $("#fromDate").datepicker("getDate");
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[0]; // Assuming the date is in the first column
// Convert dateStr to Date object
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
if (!fromDate || !toDate) {
return true; // No filter if dates are not selected
}
return date >= fromDate && date <= toDate;
}
);
// Handle form submission
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
});
});
</script>

View File

@ -1293,7 +1293,7 @@ foreach ($PaymentTerms as $TER) {
<th>SNo</th>
<th>Requisition No</th>
<th>Item Code</th>
<th>Item Description</th>
<th>Item Name</th>
<th>Quantity</th>
<th>UOM</th>
<th>Rate<?php echo $INRSYM ?></th>
@ -1331,7 +1331,7 @@ foreach ($PaymentTerms as $TER) {
<td align="left"><?php echo $index; ?></td>
<td><?php echo $record->ReqNo ?></td>
<td><?php echo $record->MaterialCode ?></td>
<td><?php echo $record->ServiceMaterialDescription ?></td>
<td><?php echo $record->MaterialName ?></td>
<td align="right"><?php echo $record->Quantity ?></td>
<td><?php echo $record->UOM ?></td>
<td align="right"><?php echo $record->Rate ?></td>
@ -1755,7 +1755,7 @@ foreach ($PaymentTerms as $TER) {
var cellval = tr.cells;
cellval[2].innerHTML = editMaterialCode;
cellval[3].innerHTML = materialspecialinstruction;
cellval[3].innerHTML = editDescription;
cellval[4].innerHTML = editQuantity;
cellval[5].innerHTML = editUOM;
cellval[6].innerHTML = parseFloat(itemRate).toFixed(2);

View File

@ -1,112 +1,174 @@
<style>
#datatable_filter{
float: inline-end;
}
#datatable_wrapper .row .col-sm-4{
flex-basis: 50%;
float: inline-end;
}
#datatable_paginate .pagination {
flex-basis: 50%;
float: inline-end;
margin:0 0 15px;
}
#datatable_wrapper .row:nth-child(3), #datatable_wrapper .row:nth-child(1){
padding: 0 15px;
}
#datatable_info{
margin-top: 5px;
}
.dataTables_wrapper{
padding-bottom: 0;
}
#datatable_filter {
float: inline-end;
}
#datatable_wrapper .row .col-sm-4 {
flex-basis: 50%;
float: inline-end;
}
#datatable_paginate .pagination {
flex-basis: 50%;
float: inline-end;
margin: 0 0 15px;
}
#datatable_wrapper .row:nth-child(3),
#datatable_wrapper .row:nth-child(1) {
padding: 0 15px;
}
#datatable_info {
margin-top: 5px;
}
.dataTables_wrapper {
padding-bottom: 0;
}
.Date-filter-form {
display: flex;
align-items: center;
gap: 10px;
/* Adjust the gap as needed */
}
.Date-filter-form input,
.Date-filter-form button {
padding: 5px;
font-size: 14px;
}
.Date-filter-form button {
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
.Date-filter-form button:hover {
background-color: #0056b3;
}
.icon-button {
background: none;
border: none;
cursor: pointer;
color: #007bff;
font-size: 18px;
}
.icon-button:hover {
color: #0056b3;
}
</style>
<div class="content-wrapper">
<section class="content">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-12">
<?php
helper('form');
$error = session()->getFlashdata('error');
if($error){
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
$type = "error";
echo show_alert($type, $error);
}
$success = session()->getFlashdata('success');
if($success){
if ($success) {
$type = "success";
echo show_alert($type, $success);
}
?>
?>
<div class="row">
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>');
?> </div>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<CENTER><h3 class="box-title"> Employee Details</h3></CENTER>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 text-right">
<div class="form-group">
<a class="btn btn-success" href="<?php echo base_url(); ?>addemployee">Add New Employee</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportemployee">Export Employee Details <i class="fa fa-download"aira-hidden="true"></i></a>
<div class="row">
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>');
?> </div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table id="datatable" class="table table-hover table-bordered" style="background-color:#fff;font-size:12px;" >
<thead style="background-color: #ddd;">
<tr>
<th>Emp ID</th>
<th>Employee Name</th>
<th>Contact Number</th>
<th>Designation</th>
<th>Department</th>
<th>Active</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($userRecords))
{
foreach($userRecords as $record)
{
?>
<tr>
<td><u><a class="a_tag_link" href="<?php echo base_url().'employeedetails/ViewEmployee/?EmpID='.$record->EmpID; ?>" data-toggle="tooltip" title="<?php echo $record->EmpID; ?> - Click here to view Employee details"><?php echo $record->EmpID ?> </a></u></td>
<td><?php echo $record->FirstName; ?></td>
<td><?php echo $record->ContactNumber ?></td>
<td><?php echo $record->Designation ?></td>
<td><?php echo $record->DepartmentName ?></td>
<td><?php echo ($record->IsActive == 1)? ' Active ' : ' In Active ' ; ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
<div class="box">
<div class="box-header">
<CENTER>
<h3 class="box-title"> Employee Details</h3>
</CENTER>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 col-md-6">
<form class="Date-filter-form" id="DateRangeFilter">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input type="text" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input type="text" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit">Search</button>
<i class="fa fa-repeat" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
</div>
<div class="col-xs-12 col-md-6 text-right">
<div class="form-group">
<a class="btn btn-success" href="<?php echo base_url(); ?>addemployee">Add New Employee</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportemployee">Export Employee Details <i class="fa fa-download" aira-hidden="true"></i></a>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table id="datatable" class="table table-hover table-bordered" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
<th>Created Date</th>
<th>Emp ID</th>
<th>Employee Name</th>
<th>Contact Number</th>
<th>Designation</th>
<th>Department</th>
<th>Active</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
?>
<tr>
<?php if (date('d-m-Y', strtotime($record->Created_date)) == "30-11--0001") {
$cdate = '00-00-0000';
} else {
$cdate = date('d-m-Y', strtotime($record->Created_date));
} ?>
<td align="right"><?php echo $cdate; ?></td>
<td><u><a class="a_tag_link" href="<?php echo base_url() . 'employeedetails/ViewEmployee/?EmpID=' . $record->EmpID; ?>" data-toggle="tooltip" title="<?php echo $record->EmpID; ?> - Click here to view Employee details"><?php echo $record->EmpID ?> </a></u></td>
<td><?php echo $record->FirstName; ?></td>
<td><?php echo $record->ContactNumber ?></td>
<td><?php echo $record->Designation ?></td>
<td><?php echo $record->DepartmentName ?></td>
<td><?php echo ($record->IsActive == 1) ? ' Active ' : ' In Active '; ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript">
<!-- <script type="text/javascript">
$(function () {
@ -123,4 +185,84 @@
});
});
</script>
</script> -->
<script>
$(document).ready(function() {
$.fn.dataTable.ext.type.order['date-eu-pre'] = function(date) {
var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
};
// Initialize the DataTable
var table = $('#datatable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"columnDefs": [{
"targets": 0,
"type": "date-eu"
}],
"aaSorting": [
[0, "desc"]
],
"info": true,
"autoWidth": true,
"pageLength": 10,
"lengthMenu": [10, 25, 50, 100],
});
// Initialize the datepickers
$("#fromDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var minDate = $(this).datepicker("getDate");
$("#toDate").datepicker("option", "minDate", minDate);
}
});
$("#toDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var maxDate = $(this).datepicker("getDate");
$("#fromDate").datepicker("option", "maxDate", maxDate);
}
});
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").datepicker("setDate", null);
$("#toDate").datepicker("setDate", null);
$("#toDate").datepicker("option", "minDate", null);
$("#fromDate").datepicker("option", "maxDate", null);
table.draw();
});
// Date range filter
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $("#fromDate").datepicker("getDate");
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[0]; // Assuming the date is in the first column
// Convert dateStr to Date object
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
if (!fromDate || !toDate) {
return true; // No filter if dates are not selected
}
return date >= fromDate && date <= toDate;
}
);
// Handle form submission
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
});
});
</script>

View File

@ -87,7 +87,6 @@
</section>
<section class="content" style="margin: 15px;"><br />
<div style="border:2px solid #333;">
<form action="<?php echo base_url() ?>SaveIGR" method="post" enctype="multipart/form-data">
<div class="row"><br /><br />
<div id="content"> </div>
@ -462,6 +461,7 @@
$('#txtRowCount').val('');
var id = $('#PONO').val();
var status = '';
var isOpenOrder = 0;
if (id != '-1') {
$('#content').loader('show');
var y = <?php echo json_encode($PO_NO, JSON_PRETTY_PRINT) ?>;
@ -473,7 +473,7 @@
$("#po").val(obj.PONO);
$("#Sup").val(obj.SupplierName);
$("#hiddenIsOpenOrder").val(obj.IsOpenOrder);
var isOpenOrder = parseInt(obj.IsOpenOrder, 2);
isOpenOrder = parseInt(obj.IsOpenOrder ? obj.IsOpenOrder : "0", 2);
var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "" : "Open";
$('.help-block').text(formatted_IsOpenOrder);
var button_text_for_IGRDraftLink = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "Save as Draft IGR" : "Save as Open IGR";
@ -510,7 +510,7 @@
'<td name="UOM">' + item.UOM + '</td>' +
'<td name="Quantity1' + i + '" id="Quantity_1' + i + '">' + item.Quantity + '</td>' +
'<td name="ReceivedQuantity' + i + '" id="ReceivedQuantity' + i + '">' + item.ReceivedQuantity + '</td>' +
'<td name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + item.PendingQty + '</td>' +
'<td name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + ((isOpenOrder === 0 || isNaN(isOpenOrder)) ? item.PendingQty : 0 ) + '</td>' +
'<td data-name="sel" ><input type="text" onchange="validateReceivedQuantity(' + i + ')"id="QuantityAsPerInvoice' + i + '" name="QuantityAsPerInvoice' + i + '" value="" onkeypress="return isNumberKey(event);" autocomplete="off"></td>' +
'<td><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')" autocomplete="off"> </td>' +
'<td><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
@ -554,7 +554,7 @@
type: 'hidden',
id: 'txtPendingQty' + i,
name: 'txtPendingQty' + i,
value: item.PendingQty
value: ((isOpenOrder === 0 || isNaN(isOpenOrder)) ? item.PendingQty : 0 )
}).appendTo('form');
$('<input>').attr({
@ -673,8 +673,11 @@
// InvoiceQty
return true;
}}else{
console.log(InvoiceQty + RecQty);
$('#PendingQuantity' + Rowid).text(0.00);
$('#txtPendingQty' + Rowid).val(0.00);
$("#txtQuantityAsPerInvoice" + Rowid).val(0.00);
$("#ReceivedQuantity" + Rowid).val(InvoiceQty + RecQty);
$("#txtQuantityAsPerInvoice" + Rowid).val((InvoiceQty + RecQty));
// InvoiceQty
return true;
}

View File

@ -764,7 +764,8 @@
<td class="text-right" style="border:0em;"><?php echo number_alignment(abs(array_sum($igst))); ?></td>
</tr>
<?php if(isset($reveuetax)){ ?>
<?php $AfterPackagingValue = []; $AfterFreightValue= []; $AfterDiscount =[];
if(isset($reveuetax)){ ?>
<?php foreach ($reveuetax as $key => $value) {
$AfterPackagingValue[] = isset($value->AfterPackagingValue) ? $value->AfterPackagingValue : 0.00;

View File

@ -1,353 +1,404 @@
<?php
<?php
//echo "OUTIF";
if(empty($Status))
{
if (empty($Status)) {
//echo "INIF";
//print_r($Status);
//print_r($Status);
}
?>
<style>
.table-bordered>thead>tr>th, .table-bordered>tbody>tr>th, .table-bordered>tfoot>tr>th, .table-bordered>thead>tr>td, .table-bordered>tbody>tr>td, .table-bordered>tfoot>tr>td {border: 1px solid #333;}
.modal-content {
width:1000px ! important;
.table-bordered>thead>tr>th,
.table-bordered>tbody>tr>th,
.table-bordered>tfoot>tr>th,
.table-bordered>thead>tr>td,
.table-bordered>tbody>tr>td,
.table-bordered>tfoot>tr>td {
border: 1px solid #333;
}
.modal
{
padding-right:25% ! important;
.modal-content {
width: 1000px ! important;
}
#Requisition_filter{
.modal {
padding-right: 25% ! important;
}
#Requisition_filter {
float: inline-end;
}
#Requisition_wrapper .row .col-sm-4{
}
#Requisition_wrapper .row .col-sm-4 {
flex-basis: 50%;
float: inline-end;
}
#Requisition_paginate .pagination {
#Requisition_paginate .pagination {
flex-basis: 50%;
float: inline-end;
margin:0 0 15px;
margin: 0 0 15px;
}
#Requisition_wrapper .row:nth-child(3), #Requisition_wrapper .row:nth-child(1){
#Requisition_wrapper .row:nth-child(3),
#Requisition_wrapper .row:nth-child(1) {
padding: 0 15px;
}
#Requisition_info{
#Requisition_info {
margin-top: 5px;
}
.dataTables_wrapper{
.dataTables_wrapper {
padding-bottom: 0;
}
</style>
<style>
.Date-filter-form {
display: flex;
align-items: center;
gap: 10px;
/* Adjust the gap as needed */
}
.Date-filter-form input,
.Date-filter-form button {
padding: 5px;
font-size: 14px;
}
.Date-filter-form button {
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
.Date-filter-form button:hover {
background-color: #0056b3;
}
.icon-button {
background: none;
border: none;
cursor: pointer;
color: #007bff;
font-size: 18px;
}
.icon-button:hover {
color: #0056b3;
}
</style>
<div class="content-wrapper">
<section class="content">
<div class="box">
<div class="box-header">
<CENTER><h3 class="box-title">Purchase Order Approve List </h3></CENTER>
</div>
<div class="container-fluid">
<table id="Requisition" class="table table-hover" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
<th>Purchase Order Number</th>
<th>Purchase Order Type</th>
<th>Cost Center Name</th>
<th>Supplier Name</th>
<th>Created By</th>
<th>Department</th>
<th>Created Date</th>
<th>Total Order Value</th>
<th>Approved By</th>
<th>Status</th>
<th>Action</th>
<th>Remarks</th>
</tr>
</thead>
<tbody id="ApprovalList">
<?php
if(!empty($AppList))
{
$index = 0;
foreach($AppList as $record)
{
$index = $index +1;
//echo $index;
?>
<tr id="<?php echo $index ?>" >
<td><a target="_blank" href="<?php echo base_url() ?>purchaseorder/CreatePOPrint?PONO=<?php echo $record->PONO ?>&ReqType=<?php echo $record->RType ?>" data-id="<%=index%>" data-userid="<?php echo $record->PONO ?>" ><u><?php echo $record->PONO ?> </td>
<td><?php echo $record->RType ?> </td>
<td><?php echo $record->CostCenterName ?> </td>
<!-- <td><?php // echo $record->CostCenterCode?></td> -->
<td><?php echo $record->SupplierName ?></td>
<td><?php echo $record->FirstName ?></td>
<td><?php echo $record->DepartmentName?></td>
<td align="right"><?php $Cdt = new DateTime($record->CreatedDate);
$CreatedDate = $Cdt->format('d-m-Y');
echo $CreatedDate;
?></td>
<td align="right"><?php echo $record->TotalOrderValue ?></td>
<td><?php echo $record->Approver?></td>
<td><?php
$statusMappings = [
'PO APPROVED' => 'AWAITING APPROVE',
'AWAITING RELEASE' => 'AWAITING APPROVE',
'RELEASER ONHOLD' => 'APPROVER ONHOLD',
'PO RELEASED' => 'PO APPROVED',
];
if (isset($record->StatusName) && !empty($record->StatusName)) {
if (isset($statusMappings[$record->StatusName])) {
echo $statusMappings[$record->StatusName];
} else {
echo $record->StatusName;
}
<section class="content">
<div class="box">
<div class="box-header">
<CENTER>
<h3 class="box-title">Purchase Order Approve List </h3>
</CENTER>
</div>
<div class="container-fluid">
<form class="Date-filter-form" id="DateRangeFilter">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input type="text" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input type="text" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit">Search</button>
<i class="fa fa-repeat" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
<table id="Requisition" class="table table-hover" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
<th>PO Date</th>
<th>Purchase Order Number</th>
<th>Purchase Order Type</th>
<th>Cost Center Name</th>
<th>Supplier Name</th>
<th>Created By</th>
<th>Department</th>
<!-- <th>Created Date</th> -->
<th>Total Order Value</th>
<th>Approved By</th>
<th>Status</th>
<th>Action</th>
<th>Remarks</th>
</tr>
</thead>
<tbody id="ApprovalList">
<?php
if (!empty($AppList)) {
$index = 0;
foreach ($AppList as $record) {
$index = $index + 1;
//echo $index;
?>
<tr id="<?php echo $index ?>">
<td align="right" style="width:75px"><?php $podt = new DateTime($record->PODate);
$PODate = $podt->format('d-m-Y');
echo $PODate;
?></td>
<td><a target="_blank" href="<?php echo base_url() ?>purchaseorder/CreatePOPrint?PONO=<?php echo $record->PONO ?>&ReqType=<?php echo $record->RType ?>" data-id="<%=index%>" data-userid="<?php echo $record->PONO ?>"><u><?php echo $record->PONO ?> </td>
<td><?php echo $record->RType ?> </td>
<td><?php echo $record->CostCenterName ?> </td>
<!-- <td><?php // echo $record->CostCenterCode
?></td> -->
<td><?php echo $record->SupplierName ?></td>
<td><?php echo $record->FirstName ?></td>
<td><?php echo $record->DepartmentName ?></td>
<!-- <td align="right"><?php // $Cdt = new DateTime($record->CreatedDate);
// $CreatedDate = $Cdt->format('d-m-Y');
// echo $CreatedDate;
?></td> -->
<td align="right"><?php echo $record->TotalOrderValue ?></td>
<td><?php echo $record->Approver ?></td>
<td><?php
$statusMappings = [
'PO APPROVED' => 'AWAITING APPROVE',
'AWAITING RELEASE' => 'AWAITING APPROVE',
'RELEASER ONHOLD' => 'APPROVER ONHOLD',
'PO RELEASED' => 'PO APPROVED',
];
if (isset($record->StatusName) && !empty($record->StatusName)) {
if (isset($statusMappings[$record->StatusName])) {
echo $statusMappings[$record->StatusName];
} else {
echo "Status not provided";
echo $record->StatusName;
}
?></td>
<?php
// if($record->StatusName == 'RELEASER ONHOLD' or $record->StatusName == 'AWAITING RELEASE' or $record->StatusName == 'AMENDMENT PO'){
if($record->StatusCode == PO_APPROVER_ONHOLD or $record->StatusCode == PO_CREATED or $record->StatusCode == REQITEM_Emergency_PO_CREATED ){
?>
<td>
<select name="selectId" id="selectId" onchange="showvalue('<?php echo $record->PONO ?>','<?php echo $index ; ?>',this.options[this.selectedIndex].value,'<?php echo $record->Remarks ?>');">
<option value="-1" >Select Action</option>
<!-- <option value="1">Release</option> -->
<option value="1">Approve And Release</option>
<option value="2">OnHold</option>
</select>
</td>
<?php }else{
echo "<td><center>-</center></td>";
}?>
<td contenteditable="true" id="remarks<?php echo $index ; ?>"><?php
if($record->Remarks == ''){
} else {
echo "Status not provided";
}
?></td>
<?php
// if($record->StatusName == 'RELEASER ONHOLD' or $record->StatusName == 'AWAITING RELEASE' or $record->StatusName == 'AMENDMENT PO'){
if ($record->StatusCode == PO_APPROVER_ONHOLD or $record->StatusCode == PO_CREATED or $record->StatusCode == REQITEM_Emergency_PO_CREATED) {
?>
<td>
<select name="selectId" id="selectId" onchange="showvalue('<?php echo $record->PONO ?>','<?php echo $index; ?>',this.options[this.selectedIndex].value,'<?php echo $record->Remarks ?>');">
<option value="-1">Select Action</option>
<!-- <option value="1">Release</option> -->
<option value="1">Approve And Release</option>
<option value="2">OnHold</option>
</select>
</td>
<?php } else {
echo "<td><center>-</center></td>";
} ?>
<td contenteditable="true" id="remarks<?php echo $index; ?>"><?php
if ($record->Remarks == '') {
} else {
echo $record->Remarks;
} ?></td>
</tr>
<?php
}
}
else{ echo $record->Remarks; }?></td>
</tr>
<?php
}
}
?>
?>
</tbody>
</table>
<br>
</div>
</div>
</section>
</tbody>
</table>
<br>
</div>
</div>
</section>
</div>
<script>
function showvalue(PONO,value,Status,Remark)
{
var Remarks='';
var curtremarks=document.getElementById('remarks'+value+'').innerHTML;
<script>
function showvalue(PONO, value, Status, Remark) {
var Remarks = '';
var curtremarks = document.getElementById('remarks' + value + '').innerHTML;
//var curtremarks = curtremarks.trim();
var PO=PONO;
var Status=Status;
var StatusCode='';
var srtMsg='';
if((curtremarks == '<br>' || curtremarks == '') && Remark == ''){
Remarks='';
var PO = PONO;
var Status = Status;
var StatusCode = '';
var srtMsg = '';
if ((curtremarks == '<br>' || curtremarks == '') && Remark == '') {
Remarks = '';
//alert("To Store both empty:-" + Remarks)
}
else if((curtremarks != '' && Remark == ''))
{
Remarks=curtremarks;
//alert("To Store current empty:-" + Remarks)
}
else if((Remark != '') && (curtremarks == '' || curtremarks == '<br>'))
{
Remarks=Remark;
//alert("To Store current empty:-" + Remarks)
}
else{
Remarks=Remark+"||"+curtremarks;
//alert("To Store both:-" + Remarks)
} else if ((curtremarks != '' && Remark == '')) {
Remarks = curtremarks;
//alert("To Store current empty:-" + Remarks)
} else if ((Remark != '') && (curtremarks == '' || curtremarks == '<br>')) {
Remarks = Remark;
//alert("To Store current empty:-" + Remarks)
} else {
Remarks = Remark + "||" + curtremarks;
//alert("To Store both:-" + Remarks)
}
//alert(PO+"-"+Status+"-"+StatusCode);
if(Status != '-1'){
if(Status == '1'){
// var strMsg='Do you want to Release this Purchase Order?'
var strMsg='Do you want to Approve and Release this Purchase Order?'
var StatusCode='ST026';
//alert(StatusCode);
}
else if(Status == '2')
{
var strMsg='Do you want to put Hold this Purchase Order?';
var StatusCode='ST052';
//alert(StatusCode);
}
/* MSG*/
var answer = confirm(strMsg);
if (answer)
{
$('#content').loader('show');
$.ajax({
data:{PONO:PO,SCode:StatusCode,NewRemarks:Remarks},
type:"POST",
url:"<?php echo base_url() ?>purchaseorder/ReleasePO",
success:function(data) {
if(data)
{
$('#content').loader('hide');
alert(data);
location.reload();
if (Status != '-1') {
if (Status == '1') {
// var strMsg='Do you want to Release this Purchase Order?'
var strMsg = 'Do you want to Approve and Release this Purchase Order?'
var StatusCode = 'ST026';
//alert(StatusCode);
} else if (Status == '2') {
var strMsg = 'Do you want to put Hold this Purchase Order?';
var StatusCode = 'ST052';
//alert(StatusCode);
}
else
{
alert("Error");
}
/* MSG*/
var answer = confirm(strMsg);
if (answer) {
$('#content').loader('show');
$.ajax({
data: {
PONO: PO,
SCode: StatusCode,
NewRemarks: Remarks
},
type: "POST",
url: "<?php echo base_url() ?>purchaseorder/ReleasePO",
success: function(data) {
if (data) {
$('#content').loader('hide');
alert(data);
location.reload();
} else {
alert("Error");
}
}
});
} else {
return;
}
/* MSG*/
} else {
alert('please Select Status!');
}
});
}
else
{
return;
}
/* MSG*/
}
else
{
alert('please Select Status!');
}
} //End of showvalue function for approve/hold po status
</script>
<script>
</script>
<script>
var startDate = '';
var endDate = '';
function Reset()
{
$('#RequisitionStatus').val("-1");
$('#SearchDate').val('');
}
<!-- JQuery For POP UP and Getting all relevant Data -->
$("#myModal").on("shown.bs.modal", function(e) {
var ReqId = $(e.relatedTarget).data('userid');
$("#RequistionNo").val('');
$("#drpSupplier").val('');
$("#POType").val('');
$("#Tax Range").val(''); //not conform
$("#SupAddress").val('');
$("#DeliveryAddr").val('');
$("#PODate").val('');
$("#Deliverydt").val('');
$("#tbleAppend").empty();
$("#txtTotBasicAmount").val('');
$("#txtTotalDiscount").val('');
$("#txtTotalVat").val('');
$("#txtTotCST").val('');
$("#txtTotalPackaing").val('');
$("#txtTotExciseDuty").val('');
$("#txtTotalGST").val('');
$("#txtTotalInsurance").val('');
$("#txtTotalFreight").val('');
$("#txtTotalOtherTaxes").val('');
$("#txtTotalOrderValueSummary").val('');
$("#txtSpcialInstruction").val('');
$('#AlertImg').attr("style","display:none;");
$('#content').loader('show');
$.ajax({
data:{id:ReqId},
type:"POST",
var endDate = '';
function Reset() {
$('#RequisitionStatus').val("-1");
$('#SearchDate').val('');
}
// <!--JQuery For POP UP and Getting all relevant Data-- >
$("#myModal").on("shown.bs.modal", function(e) {
var ReqId = $(e.relatedTarget).data('userid');
$("#RequistionNo").val('');
$("#drpSupplier").val('');
$("#POType").val('');
$("#Tax Range").val(''); //not conform
$("#SupAddress").val('');
$("#DeliveryAddr").val('');
$("#PODate").val('');
$("#Deliverydt").val('');
$("#tbleAppend").empty();
$("#txtTotBasicAmount").val('');
$("#txtTotalDiscount").val('');
$("#txtTotalVat").val('');
$("#txtTotCST").val('');
$("#txtTotalPackaing").val('');
$("#txtTotExciseDuty").val('');
$("#txtTotalGST").val('');
$("#txtTotalInsurance").val('');
$("#txtTotalFreight").val('');
$("#txtTotalOtherTaxes").val('');
$("#txtTotalOrderValueSummary").val('');
$("#txtSpcialInstruction").val('');
$('#AlertImg').attr("style", "display:none;");
$('#content').loader('show');
$.ajax({
data: {
id: ReqId
},
type: "POST",
dataType: 'json',
url:"<?php echo base_url() ?>requisitionform/ViewRequest",
success:function(json) {
// success:function(data) {
url: "<?php echo base_url() ?>requisitionform/ViewRequest",
success: function(json) {
// success:function(data) {
$('#content').loader('hide');
//alert(data);
$("#ReqType").val(json.Requist[0]['ReqType']);
$("#ReqType").val(json.Requist[0]['ReqType']);
$("#ReqBy").val(json.Requist[0]['Requestedby']);
$("#ReqDate").val(json.Requist[0]['CreatedDate']);
$("#Desigination").val(json.Requist[0]['Designation']);
$("#ReqDate").val(json.Requist[0]['CreatedDate']);
$("#Desigination").val(json.Requist[0]['Designation']);
$("#CostCenter").val(json.Requist[0]['CostCenterCode']);
$("#AvlBudgetAmount").val(json.AvilBudAmount);
$("#tbleAppend").append(json.Items);
}
});
});
$("#AvlBudgetAmount").val(json.AvilBudAmount);
function printpdf(PONO,value,Status) {
var PONO =PONO;
var Status = Status;
var value = value;
alert(PONO+Status+value);
if(PONO != '' && Status != '' && value != ''){
alert('inside if '+PONO+Status+value);
$.ajax({
data:{PONO1:PONO,Status1:Status},
type:"POST",
url:"<?php echo base_url() ?>purchaseorder/Poprintpdf",
/*success:function(data) {
$("#tbleAppend").append(json.Items);
}
});
});
function printpdf(PONO, value, Status) {
var PONO = PONO;
var Status = Status;
var value = value;
alert(PONO + Status + value);
if (PONO != '' && Status != '' && value != '') {
alert('inside if ' + PONO + Status + value);
$.ajax({
data: {
PONO1: PONO,
Status1: Status
},
type: "POST",
url: "<?php echo base_url() ?>purchaseorder/Poprintpdf",
/*success:function(data) {
if(data)
{
alert(data);
@ -359,88 +410,166 @@ function printpdf(PONO,value,Status) {
}*/
});
}
else{
alert('inside else '+PONO+Status+value);
}
}
$(function() {
var d = new Date();
});
var month = d.getMonth();
var day = d.getDate();
var year = d.getFullYear() ;
var SIAStartYear = year - 2015;
var mindt = year-70;
var maxdt = year-15;
$( ".datePicker" ).datepicker(
{
minDate : new Date(year-SIAStartYear,1,1),
maxDate :'now',
dateFormat: 'mm/dd/yy',changeMonth: true, changeYear: true,
} else {
alert('inside else ' + PONO + Status + value);
}
}
);
//$('#SearchDate').daterangepicker( );
//Initialize Select2 Elements
$(".select2").select2();
//$('#SearchDate').val('');
$('#SearchDate').daterangepicker(
{
locale: {
format: 'DD-MM-YYYY'
},
showDropdowns: true
},
function(start, end, label) {
startDate = start.format('DD-MM-YYYY');
endDate = end.format('DD-MM-YYYY');
$('#FromDate').val(startDate);
$('#ToDate').val(endDate);
//alert("A new date range was chosen: " + start.format('DD-MM-YYYY') + ' to ' + end.format('DD-MM-YYYY'));
});
});
$(function () {
$('#Items').DataTable({
"paging": false,
"lengthChange": true,
"searching": false,
"ordering": false,
"info": false,
"autoWidth": false
});
$(function() {
var d = new Date();
var month = d.getMonth();
var day = d.getDate();
var year = d.getFullYear();
var SIAStartYear = year - 2015;
var mindt = year - 70;
var maxdt = year - 15;
$(".datePicker").datepicker({
minDate: new Date(year - SIAStartYear, 1, 1),
maxDate: 'now',
dateFormat: 'mm/dd/yy',
changeMonth: true,
changeYear: true,
});
//$('#SearchDate').daterangepicker( );
//Initialize Select2 Elements
$(".select2").select2();
//$('#SearchDate').val('');
$('#SearchDate').daterangepicker({
locale: {
format: 'DD-MM-YYYY'
},
showDropdowns: true
},
function(start, end, label) {
startDate = start.format('DD-MM-YYYY');
endDate = end.format('DD-MM-YYYY');
$('#FromDate').val(startDate);
$('#ToDate').val(endDate);
//alert("A new date range was chosen: " + start.format('DD-MM-YYYY') + ' to ' + end.format('DD-MM-YYYY'));
});
$.fn.dataTable.moment( 'DD-MM-YYYY' );
$('#Requisition').DataTable({
columnDefs: [{ width: 200}],
fixedColumns: true,
paging: true,
lengthChange: true,
searching: true,
ordering: true,
aaSorting: [[ 6, "desc" ]],
info: true,
autoWidth: true,
pageLength: 10,
lengthMenu: [10, 25, 50, 100]
});
});
</script>
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
$(function() {
$('#Items').DataTable({
"paging": false,
"lengthChange": true,
"searching": false,
"ordering": false,
"info": false,
"autoWidth": false
});
$.fn.dataTable.moment('DD-MM-YYYY');
// $('#Requisition').DataTable({
// columnDefs: [{ width: 200}],
// fixedColumns: true,
// paging: true,
// lengthChange: true,
// searching: true,
// ordering: true,
// aaSorting: [[ 0, "desc" ]],
// info: true,
// autoWidth: true,
// pageLength: 10,
// lengthMenu: [10, 25, 50, 100]
// });
});
</script>
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
<script>
$.fn.dataTable.ext.type.order['date-eu-pre'] = function(date) {
var dateSplit = date.split('/');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
};
$(document).ready(function() {
// Initialize the DataTable
var table = $('#Requisition').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"columnDefs": [{
"targets": 0,
"type": "date-eu"
}],
"aaSorting": [
[0, "desc"]
],
"info": true,
"autoWidth": true,
"pageLength": 10,
"lengthMenu": [10, 25, 50, 100],
});
// Initialize the datepickers
$("#fromDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var minDate = $(this).datepicker("getDate");
$("#toDate").datepicker("option", "minDate", minDate);
}
});
$("#toDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var maxDate = $(this).datepicker("getDate");
$("#fromDate").datepicker("option", "maxDate", maxDate);
}
});
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").datepicker("setDate", null);
$("#toDate").datepicker("setDate", null);
$("#toDate").datepicker("option", "minDate", null);
$("#fromDate").datepicker("option", "maxDate", null);
table.draw();
});
// Date range filter
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $("#fromDate").datepicker("getDate");
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[0]; // Assuming the date is in the first column
// Convert dateStr to Date object
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
if (!fromDate || !toDate) {
return true; // No filter if dates are not selected
}
return date >= fromDate && date <= toDate;
}
);
// Handle form submission
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
});
});
</script>

View File

@ -1,96 +1,148 @@
<div class="content-wrapper">
<div class="row">
<div class="col-md-12">
<?php
helper('form');
$error = session()->getFlashdata('error');
if($error){
$type = "error";
echo show_alert($type, $error);
}
$success = session()->getFlashdata('success');
if($success){
$type = "success";
echo show_alert($type, $success);
}
?>
<style>
.Date-filter-form {
display: flex;
align-items: center;
gap: 10px;
/* Adjust the gap as needed */
}
<div class="row">
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>');
?> </div>
</div>
</div>
.Date-filter-form input,
.Date-filter-form button {
padding: 5px;
font-size: 14px;
}
.Date-filter-form button {
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
.Date-filter-form button:hover {
background-color: #0056b3;
}
.icon-button {
background: none;
border: none;
cursor: pointer;
color: #007bff;
font-size: 18px;
}
.icon-button:hover {
color: #0056b3;
}
</style>
<div class="content-wrapper">
<div class="row">
<div class="col-md-12">
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
$type = "error";
echo show_alert($type, $error);
}
$success = session()->getFlashdata('success');
if ($success) {
$type = "success";
echo show_alert($type, $success);
}
?>
<div class="row">
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>');
?> </div>
</div>
</div>
<section class="content">
<div class="box">
<div class="box-header">
<CENTER><h3 class="box-title"> Material Master Details</h3></CENTER>
</div>
<div class="container-fluid">
</div>
<section class="content">
<div class="box">
<div class="box-header">
<CENTER>
<h3 class="box-title"> Material Master Details</h3>
</CENTER>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 text-right">
<div class="form-group">
<a class="btn btn-success" href="<?php echo base_url(); ?>addRawmaterial">Add New Material</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportmaterial">Export Material Master <i class="fa fa-download"aira-hidden="true"></i></a>
</div>
<div class="col-xs-12 col-md-6">
<form class="Date-filter-form" id="DateRangeFilter">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input type="text" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input type="text" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit">Search</button>
<i class="fa fa-repeat" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
</div>
<div class="col-xs-12 col-md-6 text-right">
<div class="form-group">
<a class="btn btn-success" href="<?php echo base_url(); ?>addRawmaterial">Add New Material</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportmaterial">Export Material Master <i class="fa fa-download" aira-hidden="true"></i></a>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table id="datatable" class="table table-hover table-bordered" style="background-color:#fff;font-size:12px;" >
<thead style="background-color: #ddd;">
<div class="col-xs-12">
<table id="datatable" class="table table-hover table-bordered" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
<th>Created Date</th>
<th>Material Code</th>
<th>Material Description</th>
<th>Type of Material</th>
<th>UOM</th>
<th>Opening Stock</th>
<th>Material Category</th>
<th>HSN Code</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
$date = date("Y-m-d");
?>
<tr>
<th style="display: none;"></th>
<th>Created On</th>
<th>Material Code</th>
<th>Material Description</th>
<th>Type of Material</th>
<th>UOM</th>
<th>Opening Stock</th>
<th>Material Category</th>
<th>HSN Code</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($userRecords))
{
foreach($userRecords as $record)
{
$date=date("Y-m-d");
?>
<tr>
<td style="display: none;"><?php echo $record->CreatedDate; ?></td>
<td style="width:8%;"><?php echo format_date($record->CreatedDate,0,'d/m/Y') ?></td>
<td style="width:9%;"><u><a class="a_tag_link" href="<?php echo base_url().'viewRawmaterial?RID='.$record->MaterialCode.'&MType='.$record->MaterialType.'&UOM='.$record->UOM.'&date1='.$date ?>" data-toggle="tooltip" title="<?php echo $record->MaterialCode; ?> - Click here to view Material details"><?php echo $record->MaterialCode ?> </a></u></td>
<?php if (date('d-m-Y', strtotime($record->CreatedDate)) == "30-11--0001") {
$cdate = '00-00-0000';
} else {
$cdate = date('d-m-Y', strtotime($record->CreatedDate));
} ?>
<td style="width:8%;" align="right"><?php echo $cdate; ?></td>
<td style="width:9%;"><u><a class="a_tag_link" href="<?php echo base_url() . 'viewRawmaterial?RID=' . $record->MaterialCode . '&MType=' . $record->MaterialType . '&UOM=' . $record->UOM . '&date1=' . $date ?>" data-toggle="tooltip" title="<?php echo $record->MaterialCode; ?> - Click here to view Material details"><?php echo $record->MaterialCode ?> </a></u></td>
<td style="width:12%;"><?php echo $record->MaterialName ?></td>
<td style="width:10%;"><?php echo $record->MaterialType ?></td>
<td style="width:7%;"><?php echo $record->UOM ?></td>
<?php if($record->stock != null || ''){?>
<td style="width:7%;"><?php echo $record->stock?></td>
<?php } else{?>
<td style="width:7%;">0</td>
<?php }?>
<?php if ($record->stock != null || '') { ?>
<td style="width:7%;"><?php echo $record->stock ?></td>
<?php } else { ?>
<td style="width:7%;">0</td>
<?php } ?>
<td style="width:11%;"><?php echo $record->Category ?></td>
<td style="width:8%;"><?php echo $record->HSNCODE ?></td>
<td style="width:8%;"><?php echo $record->HSNCODE ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
</section>
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript">
<!-- <script type="text/javascript">
$(function () {
@ -106,4 +158,84 @@
});
});
</script>
</script> -->
<script>
$.fn.dataTable.ext.type.order['date-eu-pre'] = function(date) {
var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
};
$(document).ready(function() {
// Initialize the DataTable
var table = $('#datatable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"columnDefs": [{
"targets": 0,
"type": "date-eu"
}],
"aaSorting": [
[0, "desc"]
],
"info": true,
"autoWidth": true,
"pageLength": 10,
"lengthMenu": [10, 25, 50, 100],
});
// Initialize the datepickers
$("#fromDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var minDate = $(this).datepicker("getDate");
$("#toDate").datepicker("option", "minDate", minDate);
}
});
$("#toDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var maxDate = $(this).datepicker("getDate");
$("#fromDate").datepicker("option", "maxDate", maxDate);
}
});
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").datepicker("setDate", null);
$("#toDate").datepicker("setDate", null);
$("#toDate").datepicker("option", "minDate", null);
$("#fromDate").datepicker("option", "maxDate", null);
table.draw();
});
// Date range filter
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $("#fromDate").datepicker("getDate");
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[0]; // Assuming the date is in the first column
// Convert dateStr to Date object
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
if (!fromDate || !toDate) {
return true; // No filter if dates are not selected
}
return date >= fromDate && date <= toDate;
}
);
// Handle form submission
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
});
});
</script>

File diff suppressed because it is too large Load Diff

View File

@ -1,130 +1,265 @@
<div class="content-wrapper">
<section class="content">
<div class="row">
<div class="col-md-12">
<?php
helper('form');
$error = session()->getFlashdata('error');
if($error){
$type = "error";
echo show_alert($type, $error);
}
$success = session()->getFlashdata('success');
if($success){
$type = "success";
echo show_alert($type, $success);
}
?>
<style>
.Date-filter-form {
display: flex;
align-items: center;
gap: 10px;
/* Adjust the gap as needed */
}
<div class="row">
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>');
?> </div>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<center><b><h3 class="box-title">Supplier Listing</h3></b></center>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 text-right">
<div class="form-group">
<a class="btn btn-success" href="<?php echo base_url(); ?>addsupplier">Add New Supplier</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportsupplier">Export Supplier Details <i class="fa fa-download"aira-hidden="true"></i></a>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table class="table table-bordered table-hover" id="datatable" style="background-color:#fff;font-size:11px !important;" >
<thead style="background-color: #ddd;">
<tr>
<th>Supplier ID</th>
<th>Supplier Name</th>
<th>Address</th>
<th>Contact Number</th>
<th>Email Address</th>
<th>PAN</th>
<th>GST Number</th>
<th>Payment Terms</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
if(!empty($userRecords))
{
foreach($userRecords as $record)
{
?>
<tr>
<td><u><a class="a-tag-link" href="<?= base_url() ?>viewsupplier?SID=<?= $record->SupplierID ?>&Payment=<?= $record->PaymentTerms ?>" data-toggle="tooltip" title="<?= $record->SupplierID ?> - Click here to view Supplier details"><?= $record->SupplierID ?></a></u></td>
<td><?php echo $record->SupplierName ?></td>
<td><?php echo $record->Address ?></td>
<td><?php echo $record->ContactNumber ?></td>
<td><?php echo $record->EmailAddress ?></td>
<td><?php echo $record->PAN ?></td>
<td><?php echo $record->GSTNO ?></td>
<td><?php echo $record->PaymentTerms ?></td>
<td><?php if($record->IsActive == 0){ echo "Deactived"; }else{ ?>
<a onclick="deletesupplier('<?php echo $record->SupplierID;?>')"><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a>
<?php } ?>
</td>
</tr>
<?php
}
.Date-filter-form input,
.Date-filter-form button {
padding: 5px;
font-size: 14px;
}
.Date-filter-form button {
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
.Date-filter-form button:hover {
background-color: #0056b3;
}
.icon-button {
background: none;
border: none;
cursor: pointer;
color: #007bff;
font-size: 18px;
}
.icon-button:hover {
color: #0056b3;
}
</style>
<div class="content-wrapper">
<section class="content">
<div class="row">
<div class="col-md-12">
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
$type = "error";
echo show_alert($type, $error);
}
$success = session()->getFlashdata('success');
if ($success) {
$type = "success";
echo show_alert($type, $success);
}
?>
</tbody>
</table>
<div class="row">
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>');
?> </div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript">
$(function () {
$('#datatable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": true
});
});
function deletesupplier(sid)
{alert(sid);
var answer = confirm(" Do you want to delete the Supplier from the List?")
if (answer)
{
$.ajax({
data:{id:userid},
type:"POST",
url:"<?php echo base_url() ?>deletesupplier",
success:function(data) {
if(data)
{
$('#content').loader('hide');
alert(data);
location.reload();
}
}
});
}
}
</script>
</div>
<div class="box">
<div class="box-header">
<center><b>
<h3 class="box-title">Supplier Listing</h3>
</b></center>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 col-md-6">
<form class="Date-filter-form" id="DateRangeFilter">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input type="text" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input type="text" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit">Search</button>
<i class="fa fa-repeat" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
</div>
<div class="col-xs-12 col-md-6 text-right">
<div class="form-group">
<a class="btn btn-success" href="<?php echo base_url(); ?>addsupplier">Add New Supplier</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportsupplier">Export Supplier Details <i class="fa fa-download" aira-hidden="true"></i></a>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table class="table table-bordered table-hover" id="datatable" style="background-color:#fff;font-size:11px !important;">
<thead style="background-color: #ddd;">
<tr>
<th style="width:75px">Created Date</th>
<th>Supplier ID</th>
<th>Supplier Name</th>
<th>Address</th>
<th>Contact Number</th>
<th>Email Address</th>
<th>PAN</th>
<th>GST Number</th>
<th>Payment Terms</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
?>
<tr>
<?php if (date('d-m-Y', strtotime($record->CreatedOn)) == "30-11--0001") {
$cdate = '00-00-0000';
} else {
$cdate = date('d-m-Y', strtotime($record->CreatedOn));
} ?>
<td style="width:75px" align="right"><?php echo $cdate; ?></td>
<td><u><a class="a-tag-link" href="<?= base_url() ?>viewsupplier?SID=<?= $record->SupplierID ?>&Payment=<?= $record->PaymentTerms ?>" data-toggle="tooltip" title="<?= $record->SupplierID ?> - Click here to view Supplier details"><?= $record->SupplierID ?></a></u></td>
<td><?php echo $record->SupplierName ?></td>
<td><?php echo $record->Address ?></td>
<td><?php echo $record->ContactNumber ?></td>
<td><?php echo $record->EmailAddress ?></td>
<td><?php echo $record->PAN ?></td>
<td><?php echo $record->GSTNO ?></td>
<td><?php echo $record->PaymentTerms ?></td>
<td><?php if ($record->IsActive == 0) {
echo "Deactived";
} else { ?>
<a onclick="deletesupplier('<?php echo $record->SupplierID; ?>')"><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a>
<?php } ?>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript">
// $(function () {
// $('#datatable').DataTable({
// "paging": true,
// "lengthChange": true,
// "searching": true,
// "ordering": true,
// "info": true,
// "autoWidth": true
// });
// });
function deletesupplier(sid) {
alert(sid);
var answer = confirm(" Do you want to delete the Supplier from the List?")
if (answer) {
$.ajax({
data: {
id: userid
},
type: "POST",
url: "<?php echo base_url() ?>deletesupplier",
success: function(data) {
if (data) {
$('#content').loader('hide');
alert(data);
location.reload();
}
}
});
}
}
</script>
<script>
$(document).ready(function() {
$.fn.dataTable.ext.type.order['date-eu-pre'] = function(date) {
var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
};
// Initialize the DataTable
var table = $('#datatable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"columnDefs": [{
"targets": 0,
"type": "date-eu"
}],
"aaSorting": [
[0, "desc"]
],
"info": true,
"autoWidth": true,
"pageLength": 10,
"lengthMenu": [10, 25, 50, 100],
});
// Initialize the datepickers
$("#fromDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var minDate = $(this).datepicker("getDate");
$("#toDate").datepicker("option", "minDate", minDate);
}
});
$("#toDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var maxDate = $(this).datepicker("getDate");
$("#fromDate").datepicker("option", "maxDate", maxDate);
}
});
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").datepicker("setDate", null);
$("#toDate").datepicker("setDate", null);
$("#toDate").datepicker("option", "minDate", null);
$("#fromDate").datepicker("option", "maxDate", null);
table.draw();
});
// Date range filter
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $("#fromDate").datepicker("getDate");
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[0]; // Assuming the date is in the first column
// Convert dateStr to Date object
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
if (!fromDate || !toDate) {
return true; // No filter if dates are not selected
}
return date >= fromDate && date <= toDate;
}
);
// Handle form submission
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
});
});
</script>

View File

@ -1,138 +1,269 @@
<style>
.Date-filter-form {
display: flex;
align-items: center;
gap: 10px;
/* Adjust the gap as needed */
}
.Date-filter-form input,
.Date-filter-form button {
padding: 5px;
font-size: 14px;
}
.Date-filter-form button {
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
.Date-filter-form button:hover {
background-color: #0056b3;
}
.icon-button {
background: none;
border: none;
cursor: pointer;
color: #007bff;
font-size: 18px;
}
.icon-button:hover {
color: #0056b3;
}
</style>
<div class="content-wrapper">
<section class="content">
<div class="row">
<div class="col-md-12">
<?php
helper('form');
$error = session()->getFlashdata('error');
if($error){
<div class="row">
<div class="col-md-12">
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
$type = "error";
echo show_alert($type, $error);
}
$success = session()->getFlashdata('success');
if($success){
if ($success) {
$type = "success";
echo show_alert($type, $success);
}
?>
?>
<div class="row">
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>');
?> </div>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<center><b><h3 class="box-title">User Listing</h3></b></center>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 text-right">
<div class="form-group">
<a class="btn btn-success" href="<?php echo base_url(); ?>addNew">Add New User</a>
<div class="row">
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>');
?> </div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table class="table table-hover table-bordered" id="datatable" style="background-color:#fff;font-size:12px;" >
<thead style="background-color: #ddd;">
<tr>
<th>User Id</th>
<th>User Name</th>
<th>Email</th>
<th>Contact Number</th>
<th>Designation</th>
<th>Department</th>
<th>Role Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($userRecords))
{
foreach($userRecords as $record)
{
?>
<tr>
<td><?php echo $record->userId ?></td>
<td><?php echo $record->FirstName ?></td>
<td><?php echo $record->EmailId ?></td>
<td><?php echo $record->ContactNumber ?></td>
<td><?php echo $record->Designation ?></td>
<td><?php echo $record->DepartmentName ?></td>
<td><?php echo $record->role ?></td>
<td>
<a href="<?php echo base_url().'user/editOld?UID='.$record->userId.'&EMPID='.$record->EmpID;?>"><i class="fa fa-pencil"></i>&nbsp;&nbsp;&nbsp;</a>
<a onclick="deleteUser(<?php echo $record->userId;?>)"><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<div class="box">
<div class="box-header">
<center><b>
<h3 class="box-title">User Listing</h3>
</b></center>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 col-md-6">
<form class="Date-filter-form" id="DateRangeFilter">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input type="text" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input type="text" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit">Search</button>
<i class="fa fa-repeat" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
</div>
<div class="col-xs-12 col-md-6 text-right">
<div class="form-group">
<a class="btn btn-success" href="<?php echo base_url(); ?>addNew">Add New User</a>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table class="table table-hover table-bordered" id="datatable" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
<th>Created Date</th>
<!-- <th>User Id</th> -->
<th>User Name</th>
<th>Email</th>
<th>Contact Number</th>
<th>Designation</th>
<th>Department</th>
<th>Role Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
?>
<tr>
<?php if (date('d-m-Y', strtotime($record->createdDtm)) == "30-11--0001") {
$cdate = '00-00-0000';
} else {
$cdate = date('d-m-Y', strtotime($record->createdDtm));
} ?>
<td align="right"><?php echo $cdate; ?> </td>
<!-- <td><?php echo $record->userId ?></td> -->
<td><?php echo $record->FirstName ?></td>
<td><?php echo $record->EmailId ?></td>
<td><?php echo $record->ContactNumber ?></td>
<td><?php echo $record->Designation ?></td>
<td><?php echo $record->DepartmentName ?></td>
<td><?php echo $record->role ?></td>
<td>
<a href="<?php echo base_url() . 'user/editOld?UID=' . $record->userId . '&EMPID=' . $record->EmpID; ?>"><i class="fa fa-pencil"></i>&nbsp;&nbsp;&nbsp;</a>
<a onclick="deleteUser(<?php echo $record->userId; ?>)"><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript">
$(function () {
$('#datatable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": true
});
});
function deleteUser(userid)
{
var answer = confirm(" Do you want to delete the user from the List?")
if (answer)
{
$.ajax({
data:{id:userid},
type:"POST",
url:"<?php echo base_url() ?>user/deleteUser",
success:function(data) {
if(data)
{
$('#content').loader('hide');
alert(data);
location.reload();
}
else
{
alert("Error");
}
}});
}
}
</script>
// $(function () {
// $('#datatable').DataTable({
// "paging": true,
// "lengthChange": true,
// "searching": true,
// "ordering": true,
// "info": true,
// "autoWidth": true
// });
// });
function deleteUser(userid) {
var answer = confirm(" Do you want to delete the user from the List?")
if (answer) {
$.ajax({
data: {
id: userid
},
type: "POST",
url: "<?php echo base_url() ?>user/deleteUser",
success: function(data) {
if (data) {
$('#content').loader('hide');
alert(data);
location.reload();
} else {
alert("Error");
}
}
});
}
}
</script>
<script>
$.fn.dataTable.ext.type.order['date-eu-pre'] = function(date) {
var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
};
$(document).ready(function() {
// Initialize the DataTable
var table = $('#datatable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"columnDefs": [{
"targets": 0,
"type": "date-eu"
}],
"aaSorting": [
[0, "desc"]
],
"info": true,
"autoWidth": true,
"pageLength": 10,
"lengthMenu": [10, 25, 50, 100],
});
// Initialize the datepickers
$("#fromDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var minDate = $(this).datepicker("getDate");
$("#toDate").datepicker("option", "minDate", minDate);
}
});
$("#toDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var maxDate = $(this).datepicker("getDate");
$("#fromDate").datepicker("option", "maxDate", maxDate);
}
});
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").datepicker("setDate", null);
$("#toDate").datepicker("setDate", null);
$("#toDate").datepicker("option", "minDate", null);
$("#fromDate").datepicker("option", "maxDate", null);
table.draw();
});
// Date range filter
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $("#fromDate").datepicker("getDate");
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[0]; // Assuming the date is in the first column
// Convert dateStr to Date object
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
if (!fromDate || !toDate) {
return true; // No filter if dates are not selected
}
return date >= fromDate && date <= toDate;
}
);
// Handle form submission
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
});
});
</script>

View File

@ -48,6 +48,29 @@
white-space: nowrap;
}
</style>
<style>
.dataTables_wrapper .top {
display: flex;
justify-content: space-between;
align-items: center;
}
.dataTables_wrapper .dataTables_length {
float: left;
}
.dataTables_wrapper .dt-buttons,
.dataTables_wrapper .dataTables_filter {
float: right;
margin-left: 10px;
}
.dataTables_wrapper .dt-buttons {
margin-top: 10px;
margin-bottom: 10px;
}
.dataTables_wrapper .dataTables_filter {
margin-top: 10px;
margin-bottom: 10px;
}
</style>
<script>
$(function() {
var d = new Date();
@ -91,7 +114,6 @@
<table id="Inwardgateregistertable" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
<th style="display:none;"></th>
<th>Create Date</th>
<th>Create time</th>
<th>IGR No</th>
@ -116,7 +138,6 @@
$time = $createddate->format('h:i A');
?>
<tr id="<?php echo $index ?>" >
<th style="display:none;"><?php echo $record->CreatedDate ?></th>
<td align="right"><?php echo $date; ?></td>
<td align="right"><?php echo $time; ?></td>
<td><a data-toggle="modal" data-target="#Igrshow" data-id="<?php echo $index;?>" data-inx="<?php echo $index;?>" data-userid="<?php echo $record->IGRNO ?>" data-igrstatus="<?php echo $record->IGRStatus ?>"> <u><?php echo $record->IGRNO ?></u></a></td>
@ -184,6 +205,7 @@
echo form_input($data);
?>
<span class="help-block"></span>
<input type="hidden" name="hiddenIsOpenOrder" id="hiddenIsOpenOrder" />
</div>
<div class="col-md-6">
<label>Supplier Name </label>
@ -608,10 +630,14 @@ console.log(parsedData);
var baseUrl = '<?php echo base_url(); ?>purchaseorder/CreatePOPrint';
var newUrl = baseUrl + '?PONO=' + item.PONO + '&ReqType=' + item.POType;
$('#printLink').attr('href', newUrl);
var isOpenOrder = parseInt(item.IsOpenOrder, 2);
var isOpenOrder = parseInt(item.IsOpenOrder ? item.IsOpenOrder : "0", 2);
console.log(item.IsOpenOrder);
console.log(isOpenOrder);
var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "" : "Open";
$('.help-block').text(formatted_IsOpenOrder);
var button_text_for_IGRDraft= (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "Save as Draft IGR" : "Save as Open IGR";
$('#draftIGR').text(button_text_for_IGRDraft);
$("#hiddenIsOpenOrder").val(isOpenOrder);
$("#Vehicle_No").val(item.VehicleNo);
$("#Driver_Name").val(item.DriverName);
$("#DriverMobileNumber").val(item.DriverMobileNumber);
@ -655,8 +681,8 @@ console.log(parsedData);
'<td style="width: 200px; word-wrap: break-word; word-break: break-all; white-space: normal;">' + item.MaterialName + '</td>' +
'<td style="width: 50px;" name="UOM">' + item.UOM + '</td>' +
'<td style="width: 100px;" align="right" id="Quantity' + i + '" name="Quantity">' + parseInt(item.Quantity) + '</td>' +
'<td style="width: 100px;" align="right" data-name="sel" ><input type="text" onchange="validateReceivedQuantity(' + i + ')"id="QuantityAsPerInvoice' + i + '" name="QuantityAsPerInvoice' + i + '" value="' + parseInt(item.QuantityAsPerInvoice) + '" onkeypress="return isNumberKey(event);" style="width: 75px;"></td>' +
'<td style="width: 100px;" name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + parseInt(item.Quantity - item.QuantityAsPerInvoice) + '</td>' +
'<td style="width: 100px;" align="right" data-name="sel" ><input type="text" onchange="validateReceivedQuantity(' + i + ','+isOpenOrder+')"id="QuantityAsPerInvoice' + i + '" name="QuantityAsPerInvoice' + i + '" value="' + parseInt(item.QuantityAsPerInvoice) + '" onkeypress="return isNumberKey(event);" style="width: 75px;"></td>' +
'<td style="width: 100px;" name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + ((isOpenOrder) ? 0 : parseInt(item.Quantity - item.QuantityAsPerInvoice)) + '</td>' +
'<td style="width: 150px;"><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')" style="width: 75px;"> </td>' +
'<td style="width: 50px;"><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="'+i+'" data-material="'+item.MaterialName+'" data-igrstatus = "'+igrstatus+'"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
@ -772,6 +798,7 @@ console.log(parsedData);
formData.append('driver_mobile', $('#DriverMobileNumber').val());
formData.append('status', status);
formData.append('tableData', JSON.stringify(tableData));
formData.append('isOpenOrder', $("#hiddenIsOpenOrder").val());
formData.append('MasterFile', $('#MasterFile')[0].files[0]);
formData.append('file_name[]', $('#file_name').val());
var empFiles = $('#emp_file')[0] ? $('#emp_file')[0].files : null;
@ -829,6 +856,7 @@ console.log(parsedData);
formData.append('driver_mobile', $('#DriverMobileNumber').val());
formData.append('status', status);
formData.append('tableData', JSON.stringify(tableData));
formData.append('isOpenOrder',$("#hiddenIsOpenOrder").val());
formData.append('MasterFile', $('#MasterFile')[0].files[0]);
formData.append('file_name[]', $('#file_name').val());
var empFiles = $('#emp_file')[0] ? $('#emp_file')[0].files : null;
@ -1376,32 +1404,39 @@ function deleteBill(Billno,i){
}
}
function validateReceivedQuantity(Rowid) {
function validateReceivedQuantity(Rowid,isOpenOrder) {
var InvoiceQty = parseFloat($('#QuantityAsPerInvoice' + Rowid).val() || '0.00'); // working fine
var OrderedQty = parseFloat($("#Quantity" + Rowid).text());
if (parseInt(OrderedQty) !== 0) {
if ((InvoiceQty) > OrderedQty) {
alert("Pending Quantity is exceeding the Ordered Quantity. Please contact the Purchase Team for further process.");
$("#QuantityAsPerInvoice" + Rowid).focus().val('');
return false;
} else if ((InvoiceQty) - OrderedQty > 0.00) {
alert("Order is completed.");
$("#QuantityAsPerInvoice" + Rowid).focus().val('');
return false;
} else {
var PendingQty = OrderedQty - (InvoiceQty);
$('#PendingQuantity' + Rowid).text(PendingQty.toFixed(0));
$('#txtPendingQty' + Rowid).val(PendingQty.toFixed(0));
$('#txtQuantityAsPerInvoice' + Rowid).val(InvoiceQty.toFixed(2));
return true;
}
} else {
var PendingQty = OrderedQty - (InvoiceQty);
if(isOpenOrder == 1){
var PendingQty = 0;
$('#PendingQuantity' + Rowid).text(PendingQty.toFixed(0));
$('#txtPendingQty' + Rowid).val(PendingQty.toFixed(0));
$('#txtQuantityAsPerInvoice' + Rowid).val(InvoiceQty.toFixed(2));
return true;
}else{
if (parseInt(OrderedQty) !== 0) {
if ((InvoiceQty) > OrderedQty) {
alert("Pending Quantity is exceeding the Ordered Quantity. Please contact the Purchase Team for further process.");
$("#QuantityAsPerInvoice" + Rowid).focus().val('');
return false;
} else if ((InvoiceQty) - OrderedQty > 0.00) {
alert("Order is completed.");
$("#QuantityAsPerInvoice" + Rowid).focus().val('');
return false;
} else {
var PendingQty = OrderedQty - (InvoiceQty);
$('#PendingQuantity' + Rowid).text(PendingQty.toFixed(0));
$('#txtPendingQty' + Rowid).val(PendingQty.toFixed(0));
$('#txtQuantityAsPerInvoice' + Rowid).val(InvoiceQty.toFixed(2));
return true;
}
} else {
var PendingQty = OrderedQty - (InvoiceQty);
$('#PendingQuantity' + Rowid).text(PendingQty.toFixed(0));
$('#txtPendingQty' + Rowid).val(PendingQty.toFixed(0));
$('#txtQuantityAsPerInvoice' + Rowid).val(InvoiceQty.toFixed(2));
return true;
}
}
}
</script>
@ -1524,8 +1559,20 @@ function deleteBill(Billno,i){
</script>
<script src="https://cdn.datatables.net/plug-ins/1.10.11/sorting/date-eu.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.4/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.4/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.4/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/plug-ins/1.13.6/sorting/datetime-moment.js"></script>
<script>
$(document).ready(function() {
$.fn.dataTable.ext.type.order['date-eu-pre'] = function (date) {
var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
};
// Initialize the DataTable
var table = $('#Inwardgateregistertable').DataTable({
"paging": true,
@ -1533,16 +1580,36 @@ $(document).ready(function() {
"searching": true,
"ordering": true,
"columnDefs": [{
"targets": 1,
"targets": 0,
"type": "date-eu"
}],
"aaSorting": [
[1, "desc"]
[0, "desc"]
],
"info": true,
"autoWidth": true,
"pageLength": 10,
"lengthMenu": [10, 25, 50, 100],
"dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" +
"<'row'<'col-md-6'><'col-md-6'>>" +
"<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>",
"buttons": [
{
extend: 'excelHtml5',
text: 'Export to Excel',
title: 'Inward Gate Register',
exportOptions: {
columns: ':visible:not(:last-child)' // Exclude first and last columns
}
},
{
extend: 'pdfHtml5',
text: 'Export to PDF',
title: 'Inward Gate Register',
exportOptions: {
columns: ':visible:not(:last-child)' // Exclude first and last columns
}
}]
});
@ -1579,7 +1646,7 @@ $(document).ready(function() {
var fromDate = $("#fromDate").datepicker("getDate");
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[1]; // Assuming the date is in the first column
var dateStr = data[0]; // Assuming the date is in the first column
// Convert dateStr to Date object
var dateParts = dateStr.split("-");