igr module vadivel J 03-1-2025

This commit is contained in:
vadivelJ96 2025-01-03 14:52:49 +05:30
parent 3f368e4570
commit 3d086e2c1c
8 changed files with 131 additions and 47 deletions

View File

@ -8,6 +8,8 @@ use CodeIgniter\Validation\Exceptions\ValidationException;
use App\Models\Inwardgateregister_model;
use DateTime;
use ZipArchive;
/**
@ -97,16 +99,17 @@ class Inwardgateregister extends BaseController
$toDate = date('Y-m-d');
$fromDate = date('Y-m-d');
$this->global['pageTitle'] = 'Accounts Dashboard';
$result = $this->inwardgateregister_model->customViewigrListing($fromDate, $toDate);
$igrList = $result[0];
$this->global['pageTitle'] = 'Accounts Dashboard';
$result = $this->inwardgateregister_model->ViewigrListing($fromDate, $toDate);
$igrList = $result[0];
foreach ($igrList as &$igr) {
$igrNo = $igr->IGRNO;
$fileDetails = $this->inwardgateregister_model->getAllIgrFileDetails($igrNo);
$igr->isIgrFilePresent = false; // Initialize the key
$igr->isIgrFilePresent = false;
foreach ($fileDetails as $file) {
if (!empty($file->file)) {
@ -126,7 +129,8 @@ class Inwardgateregister extends BaseController
$data['fromDate'] = date('d-m-Y', strtotime($fromDate));
$data['toDate'] = date('d-m-Y', strtotime($toDate));
$this->loadViews("accountsDashboard", $this->global, $data, NULL);
$this->loadViews("accountsDashboard" , $this->global, $data, NULL);
}
function addIGR()

View File

@ -1343,7 +1343,8 @@ class StockController extends BaseController
$data['timeDropdown'] = $this->generateTimeOptions();
$data['supplierData'] = $this->supplier_model->supplierlisting();
$data['drierDetails'] = $this->drierMachineDetails_model->where('date >=', $data['startDate'])
$data['drierDetails'] = $this->drierMachineDetails_model
->where('date >=', $data['startDate'])
->where('date <=', $data['endDate'])
->orderBy('date','asc')
->findAll();
@ -1353,6 +1354,8 @@ class StockController extends BaseController
$this->global['pageTitle'] = 'Drier Details';
$this->loadViews("drierMachineDetails", $this->global, $data, NULL);
}
public function addOrEditdrierMachineDetails()
@ -1362,7 +1365,9 @@ class StockController extends BaseController
if (empty($drierData)) {
$additionalEntry = $this->request->getPost();
if (!empty($additionalEntry)) {
$drierData[] = [
'Date' => $this->convertToDateWithFlexibleFormats($additionalEntry['Date'], ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "Y-m-d"),
@ -1460,13 +1465,27 @@ class StockController extends BaseController
$this->db->transCommit();
if (!empty($additionalEntry)) {
return redirect()->back()->with('success', " Data Saved Successfully..!!");
if (!empty($additionalEntry)) {
// Data to be sent via POST
$postData = [
'month' => $this->convertToDateWithFlexibleFormats($additionalEntry['Date'], ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "M-Y"),
];
// Generate the form and submit it via JavaScript
echo '<form id="postForm" action="' . base_url('drierMachineDetails') . '" method="POST">';
foreach ($postData as $key => $value) {
echo '<input type="hidden" name="' . $key . '" value="' . $value . '">';
}
echo '</form>';
echo '<script type="text/javascript">
document.getElementById("postForm").submit();
</script>';
exit;
}
echo "Data saved successfully . $message1";
} catch (\Exception $e) {
// Rollback the transaction on any failure
$this->db->transRollback();
@ -1560,7 +1579,7 @@ class StockController extends BaseController
array_push($tempInsert, ['date' => $value['database']]);
}
}
dd('i am here');
$this->factoryVehicleDieselStockSummary_model->insertBatch($tempInsert);
$data['summaryDetails'] = $this->factoryVehicleDieselStockSummary_model->where('date >=', $data['startDate'])->where('date <=', $data['endDate'])->findAll();

View File

@ -399,6 +399,45 @@ class Inwardgateregister_model extends Model
// echo $this->db->getLastQuery()->getQuery();die;
return [$result,$result2];
}
function customViewigrListing($fromDate,$toDate)
{
$builder = $this->db->table('t_igr_master igr')
->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName , SUM(IGRD.QuantityAsPerInvoice) as ReceivedQuantity, SUM(IGRD.NetWeight) as NetWeight , count(IGRD.IGRNo) as itemCount')
->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO')
->join('t_supplierdetailsn sup', 'PO.SupplierID = sup.SupplierID')
->join('t_transporter trans', 'igr.TransporterId = trans.id' , 'left')
->join('t_igr_details IGRD', 'igr.IGRNo = IGRD.IGRNo')
->where('igr.IGRStatus !=', MRIR_CREATED)
->groupStart()
->where('Date(igr.CreatedDate) >=', $fromDate)
->orWhere('Date(igr.UpdatedOn) >=', $fromDate)
->groupEnd()
->groupStart()
->where('Date(igr.CreatedDate) <=', $toDate)
->orWhere('Date(igr.UpdatedOn) <=', $toDate)
->groupEnd()
->groupBy('igr.IGRNo')
->orderBy('igr.CreatedDate', 'desc');
$query = $builder->get();
$result = $query->getResult();
$builder2 = $this->db->table('t_igr_details igr_details')
->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName,item.MaterialName, igr_details.QuantityAsPerInvoice as ReceivedQuantity , igr_details.NetWeight as NetWeight')
->join('t_igr_master igr', 'igr_details.IGRNo = igr.IGRNo')
->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO')
->join('t_supplierdetailsn sup', 'PO.SupplierID = sup.SupplierID')
->join('t_transporter trans', 'igr.TransporterId = trans.id' , 'left')
->join('t_materialmaster` item', 'igr_details.MaterialCode = item.MaterialCode' , 'left')
->where('igr.IGRStatus !=', MRIR_CREATED)
->orderBy('igr.CreatedDate', 'desc');
$query2 = $builder2->get();
$result2 = $query2->getResult();
// echo $this->db->getLastQuery()->getQuery();die;
return [$result,$result2];
}

View File

@ -205,7 +205,7 @@
$date = $createddate->format('d-m-Y');
$time = $createddate->format('h:i A');
$draft = [];
$record->IGRStatus == 'ST074'? $draft [] = $record:'';
$record->IGRStatus == 'ST074' || 'ST027' ? $draft [] = $record:'';
if(!empty($draft)){
?>
<tr id="<?php echo $index ?>" >
@ -227,7 +227,26 @@
<td><?php echo $record->VehicleNo ?></td>
<td><?php echo $record->DriverName ?></td>
<td><?php echo $record->TransporterName ?></td>
<td><?php echo $record->IGRStatus == 'ST074' ? 'Draft' : 'Completed'; ?></td>
<?php
if($record->IGRStatus == 'ST027' || 'ST040')
{
$igrStatusUpdate = "Created";
}
else if($record->IGRStatus == 'ST028')
{
$igrStatusUpdate = "Closed";
}else if($record->IGRStatus == 'ST029')
{
$igrStatusUpdate = "Cancelled";
}else if($record->IGRStatus == 'ST042')
{
$igrStatusUpdate = "Partial Igr Created";
}else if($record->IGRStatus == 'ST074')
{
$igrStatusUpdate = "Draft";
}
?>
<td><?php echo $igrStatusUpdate; ?></td>
<td>
<a target="_blank" data-toggle="modal" data-target="#Historyshow" data-id="<%=index%>" title="IGR History" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>">

View File

@ -173,11 +173,13 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
#drierTable td:nth-child(1) {
position: sticky;
left: 0;
background-color: #ffffff;
background-color:#00a65a;
z-index: 2;
border-right: 2px solid #ddd;
color: #0e0b0b;
color: #ffffff;
}
</style>
<div class="content-page">
<div class="content">
@ -486,7 +488,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- To Date Filter -->
<div class="col-md-6">
<div class="form-group">
<label for="toDateFilter">Select Date</label>
<label for="toDateFilter">Select To Date</label>
<select id="toDateFilter" name="toDateFilter" class="form-control">
<?php if (!empty($dateArray)) : ?>
@ -518,10 +520,13 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<form action="<?php echo base_url("/addOrEditdrierMachineDetails")?>" method="POST">
<!--14 -->
<?php $calendarStartDate = DateTime::createFromFormat('M-Y', $datefordropdown)->modify('first day of this month')->format('Y-m-d');?>
<?php $calendarEndDate = DateTime::createFromFormat('M-Y', $datefordropdown)->modify('last day of this month')->format('Y-m-d');?>
<div class="row">
<div class="col-md-3">
<label class="form" for="additionalEntryDateId">Date</label>
<input type="date" class="form-control" id="additionalEntryDateId" name="Date" value="">
<input type="date" class="form-control" id="additionalEntryDateId" name="Date" value="<?= $calendarStartDate?>"
min="<?= $calendarStartDate?>" max="<?=$calendarEndDate?>" required>
</div>
<div class="col-md-3">
<label class="form" for="additionalEntryDrierOnTimeId">Drier On Time</label>
@ -962,31 +967,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
}
$(document).ready(function() {
initialFilterDate();
});
function initialFilterDate(){
let fromDate = $('#fromDateFilter').val(); //01-12-2024
let toDate = $('#toDateFilter').val(); //05-12-2024
console.log("from Date and to date ..!!")
console.log(fromDate,toDate);
$('#drierTable').find('tbody tr').each(function() {
const rowCells = $(this).find('td');
let tableDate = rowCells.eq(0).text();
let result = checkDateRange(fromDate,toDate,tableDate);
if (result) {
$(this).show();
} else {
$(this).hide();
}
});
}
function checkDateRange(fromDate, toDate, tableDate) {
// Convert the dates to a comparable format (YYYY-MM-DD)

View File

@ -372,7 +372,7 @@ foreach ($period as $day) {
</td>
<?php elseif(formatHeader($column) == 'Opening Reading'): ?>
<td class="celda_normal"
<?= ($key == 0) ? 'contenteditable="true"' : ''; ?>
contenteditable="true"
style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
<?php elseif(formatHeader($column) == 'Closing Reading'): ?>
<td class="celda_normal" contenteditable="true"
@ -394,7 +394,7 @@ foreach ($period as $day) {
<?= $row[$column] ?? 'N/A' ?></td>
<?php elseif(formatHeader($column) == 'Opening Stock'): ?>
<td class="celda_normal"
<?= ($key == 0) ? 'contenteditable="true"' : ''; ?>
contenteditable="true"
style="padding: 5px;"><?= $row[$column] ?? 'N/A' ?></td>
<?php elseif(formatHeader($column) == 'Purchase Diesel'): ?>
<td class="celda_normal" contenteditable="true"

View File

@ -786,24 +786,44 @@
</div>
</li>
<?php } ?>
<!-- supplier module -->
<?php if(session()->get('roleText') == 'System Administrator' || session()->get('roleText') == 'Auditor'){ ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle arrow-none" href="<?php echo base_url(); ?>supplierlisting" role="button" aria-expanded="false">
<i class="fas fa-truck mr-1" style="color: gray;"></i>Supplier
</a>
</li>
<?php } ?>
<!-- material module -->
<?php if(session()->get('roleText') == 'System Administrator'){ ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle arrow-none" href="<?php echo base_url(); ?>rawmaterialListing" role="button" aria-expanded="false">
<i class="fas fa-cubes mr-1"></i>Material
</a>
</li>
<?php } ?>
<!-- master detail module -->
<?php if(session()->get('roleText') == 'System Administrator'){ ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle arrow-none" href="#" id="topnav-others" role="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@ -824,7 +844,9 @@
<a href="<?php echo base_url(); ?>readFactoryMachineMasterDetails" class="dropdown-item"><i class="ri-file-settings-line align-middle mr-1"></i>Factory Machines Details</a>
</div>
</li>
<?php } ?>
<?php } ?>

View File

@ -156,8 +156,8 @@
height: 20px;
}
#dustAndRoughStockDetailsTableId th:nth-child(1),
#dustAndRoughStockDetailsTableId td:nth-child(1) {
#trpSandUseStockDetailsTableId th:nth-child(1),
#trpSandUseStockDetailsTableId td:nth-child(1) {
position: sticky;
left: 0;
background-color: #00a65a;