igr live fixes

This commit is contained in:
VE10-Sanjeev 2025-03-31 09:19:06 +00:00
parent b2b6e788b2
commit 1b411b0e63
6 changed files with 67 additions and 26 deletions

View File

@ -658,7 +658,8 @@ class Inwardgateregister extends BaseController
if ($fileupdated_count > 0) { if ($fileupdated_count > 0) {
$finalstatement .= "Number of files updated: $fileupdated_count \n"; $finalstatement .= "Number of files updated: $fileupdated_count \n";
$finalstatement .= "Files: \n" . implode(PHP_EOL, $fileupdated_name); // $finalstatement .= "Files: \n" . implode(PHP_EOL, $fileupdated_name);
$finalstatement .= "Files: \n" . implode(PHP_EOL, array_map(fn($file) => "" . $file, $fileupdated_name));
} else { } else {
$finalstatement .= "No files to update"; $finalstatement .= "No files to update";
} }
@ -811,21 +812,23 @@ function viewIGRDetails()
$igrarr = array('DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt,'VehicleNo'=>$VehicleNo,'TransporterId'=>$TransporterId,'DriverMobileNumber'=>$DriverMobileNumber,'DriverName'=>$DriverName, 'IGRStatus' => $IGRStatus,'UpdateBY' => $updateby,'DeliveryChellanOrInvoiceNo'=>$DeliveryChellanOrInvoiceNo,'Remark'=>$MasterRemarks); $igrarr = array('DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt,'VehicleNo'=>$VehicleNo,'TransporterId'=>$TransporterId,'DriverMobileNumber'=>$DriverMobileNumber,'DriverName'=>$DriverName, 'IGRStatus' => $IGRStatus,'UpdateBY' => $updateby,'DeliveryChellanOrInvoiceNo'=>$DeliveryChellanOrInvoiceNo,'Remark'=>$MasterRemarks);
$MasterFile = $this->request->getfile('MasterFile'); $MasterFile = $this->request->getfile('MasterFile');
$fileupdated_count = 0;
$fileupdated_name = [];
if ($MasterFile) { if (!empty($MasterFile)) {
$requestMasterFileName = $MasterFile->getName(); $requestMasterFileName = $MasterFile->getName();
if ($MasterFile && $MasterFile->isValid() && !$MasterFile->hasMoved()) { if ($MasterFile && $MasterFile->isValid() && !$MasterFile->hasMoved()) {
if (!empty($this->inwardgateregister_model->isFileExistsInIGRmaster($requestMasterFileName))) { if (!empty($this->inwardgateregister_model->isFileExistsInIGRmaster($requestMasterFileName))) {
log_message('error', 'File already exists in the database'.$requestMasterFileName); log_message('error', 'File already exists in the database'.$requestMasterFileName);
} }
else{ else{
$MasterFile->move($path, $requestMasterFileName); $MasterFile->move($path, $requestMasterFileName);
$fileupdated_count++;
$fileupdated_name[] = $requestMasterFileName;
$igrarr['MasterFile'] = $requestMasterFileName; $igrarr['MasterFile'] = $requestMasterFileName;
} }
} }
} }
$fileupdated_count = 0;
$fileupdated_name = [];
$fileNames = $this->request->getPost('file_name'); $fileNames = $this->request->getPost('file_name');
$files = $this->request->getFileMultiple('emp_file'); $files = $this->request->getFileMultiple('emp_file');
@ -913,9 +916,16 @@ function viewIGRDetails()
} }
if ($getigrstatus == 'ST027' && ($updateigrmaster > 0 || $updateigrlineitem > 0)) { if ($getigrstatus == 'ST027' && ($updateigrmaster > 0 || $updateigrlineitem > 0)) {
if(session()->get('roleText') == 'System Administrator') // id is 1
$result_for_email = $this->inwardgateregister_model->getDetailsforEmail($this->session->get('userId')); {
$roleId = 2;
}
else if(session()->get('roleText') == 'Auditor') // id is 2
{
$roleId = 1;
}
$result_for_email = $this->inwardgateregister_model->getDetailsforEmail($this->session->get('userId'),$roleId);
$result_for_history = $this->inwardgateregister_model->getHistoryDetailsforEmail($IGRNo); $result_for_history = $this->inwardgateregister_model->getHistoryDetailsforEmail($IGRNo);
@ -982,6 +992,7 @@ function viewIGRDetails()
$email_response = $notification->sendEmail([ $email_response = $notification->sendEmail([
'recipient_email' => $email, 'recipient_email' => $email,
'subject' => $result_for_email['company'].' - IGR Notification', 'subject' => $result_for_email['company'].' - IGR Notification',
// 'carboncopy'=>Sales@resicoindustries.com,Factory@resicoindustries.com,Invoice@resicoindustries.com,
// 'description' => 'IGR Number : '.$IGRNo.' is Edited By '.($result_for_email['full_name'] ?? $this->session->get('name'))." On ".date('d-m-Y H:i A', strtotime(get_current_date_time() . ' +30 seconds')). $history_content, // 'description' => 'IGR Number : '.$IGRNo.' is Edited By '.($result_for_email['full_name'] ?? $this->session->get('name'))." On ".date('d-m-Y H:i A', strtotime(get_current_date_time() . ' +30 seconds')). $history_content,
'description' => $result_for_history['first_line']."<br>" .$history_content, 'description' => $result_for_history['first_line']."<br>" .$history_content,
'company' => $result_for_email['company'], 'company' => $result_for_email['company'],
@ -1016,7 +1027,8 @@ function viewIGRDetails()
if ($fileupdated_count > 0) { if ($fileupdated_count > 0) {
$finalstatement .= "Number of files updated: $fileupdated_count \n"; $finalstatement .= "Number of files updated: $fileupdated_count \n";
$finalstatement .= "Files: \n" . implode(PHP_EOL, $fileupdated_name); // $finalstatement .= "Files: \n" . implode(PHP_EOL, $fileupdated_name);
$finalstatement .= "Files: \n" . implode(PHP_EOL, array_map(fn($file) => "" . $file, $fileupdated_name));
} else { } else {
$finalstatement .= "No files to update"; $finalstatement .= "No files to update";
} }

View File

@ -1300,7 +1300,7 @@ $builder = $this->db->table('t_igr_history')
]; ];
} }
public function getDetailsforEmail($userId,$roleId = 2) public function getDetailsforEmail($userId,$roleId)
{ {
$query0 = $this->db->query(" $query0 = $this->db->query("
SELECT CompanyName,EmailAddress SELECT CompanyName,EmailAddress

View File

@ -127,6 +127,16 @@ if (!empty($emppay)) {
.num { .num {
text-align: right; text-align: right;
} }
.btn-soft-primary {
color: white;
background-color: rgb(42, 206, 150);
border-color: rgb(42, 206, 150);
}
.btn-soft-primary:hover {
background-color: rgb(32, 176, 130); /* Slightly darker shade for hover */
border-color: rgb(32, 176, 130);
}
</style> </style>
<div class="content-page"> <div class="content-page">
@ -253,7 +263,12 @@ if (!empty($emppay)) {
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group"> <div class="form-group">
<label class="d-block" for="request_letter">Request letter</label> <label class="d-block" for="request_letter">
Request letter
<!-- <?php if ($request_letter) { ?>
<a class="btn btn-soft-primary waves-effect waves-light btn-sm" title="Download Previous Upload - <?= $request_letter; ?>" href="<?php echo base_url() . 'public/uploads/images/' . $request_letter ?>"><i class="fa fa-download"></i></a>
<?php } ?> -->
</label>
<input type="file" accept=".docx,.pdf,.doc,.jpg,.png" id="request_letter" name="request_letter" style="margin-top: 5px;" /> <input type="file" accept=".docx,.pdf,.doc,.jpg,.png" id="request_letter" name="request_letter" style="margin-top: 5px;" />
<input type="hidden" id="hidden_request_letter" name="hidden_request_letter" value="<?php echo $request_letter; ?>" /> <input type="hidden" id="hidden_request_letter" name="hidden_request_letter" value="<?php echo $request_letter; ?>" />
</div> </div>
@ -271,17 +286,23 @@ if (!empty($emppay)) {
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group"> <div class="form-group">
<label class="d-block" for="payment_statement">Payment Receipt</label> <label class="d-block" for="payment_statement">
Payment Receipt
<!-- <?php if ($payment_statement) { ?>
<a class="btn btn-soft-primary waves-effect waves-light btn-sm" title="Download Previous Upload - <?= $payment_statement; ?>" href="<?php echo base_url() . 'public/uploads/images/' . $payment_statement ?>"><i class="fa fa-download"></i></a>
<?php } ?> -->
</label>
<input type="file" accept=".docx,.pdf,.doc,.jpg,.png" id="payment_statement" name="payment_statement" style="margin-top: 5px;" /> <input type="file" accept=".docx,.pdf,.doc,.jpg,.png" id="payment_statement" name="payment_statement" style="margin-top: 5px;" />
<input type="hidden" id="hidden_payment_statement" name="hidden_payment_statement" value="<?php echo $payment_statement; ?>" /> <input type="hidden" id="hidden_payment_statement" name="hidden_payment_statement" value="<?php echo $payment_statement; ?>" />
</div> </div>
<?php if ($request_letter) { ?> <?php if ($payment_statement) { ?>
<span class="help-block"><small> <div class="mb-1">
<a href="<?php echo base_url() . 'public/uploads/images/' . $payment_statement ?>"> <a href="<?php echo base_url() . 'public/uploads/images/' . $payment_statement ?>">
<span>Previous Upload - </span><small><?= $payment_statement; ?></small> <span>Previous Upload - </span><small><?= $payment_statement; ?></small>
</a> </a>
</small></span> </div>
<br>
<?php } ?> <?php } ?>
</div> </div>
</div> <!-- 2nd row div closed here --> </div> <!-- 2nd row div closed here -->

View File

@ -31,15 +31,15 @@
<div class="card"> <div class="card">
<div class="row" style="padding: 18px 26px;"> <div class="row" style="padding: 18px 26px;">
<div class="col-md-3"> <div class="col-md-3">
<span>Holiday Name : </span> <label>Holiday Name : </label>
<input type="text" name="hname" id="hname" class="form-control"> <input type="text" name="hname" id="hname" class="form-control">
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<span>Date : </span> <label>Date : </label>
<input type="text" name="hdate" id="hdate" class="form-control"> <input type="text" name="hdate" id="hdate" class="form-control">
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<input type="button" id="Add" value="Add" class="btn btn-success" class="form-control" style="margin-top: 20px;margin-bottom: 0px;"> <input type="button" id="Add" value="Add" class="btn btn-success" class="form-control" style="margin-top: 25px;margin-bottom: 0px;">
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">

View File

@ -235,7 +235,7 @@
<!-- Long Content Scroll Modal --> <!-- Long Content Scroll Modal -->
<div class="modal fade" id="scrollable-modal" tabindex="-1" role="dialog" aria-labelledby="scrollableModalTitle" aria-hidden="true" style="max-width: 100%;"> <div class="modal fade" id="scrollable-modal" tabindex="-1" role="dialog" aria-labelledby="scrollableModalTitle" aria-hidden="true" style="max-width: 100%;">
<div class="modal-dialog modal-dialog-scrollable" role="document" style="max-width: 50%;"> <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document" style="max-width: 65%;">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="scrollableModalTitle">Material Details</h5> <h5 class="modal-title" id="scrollableModalTitle">Material Details</h5>
@ -312,7 +312,7 @@ $(document).ready(function () {
<th style="text-align: center;" >PONO</th> <th style="text-align: center;" >PONO</th>
<th style="text-align: center;" >PO Type</th> <th style="text-align: center;" >PO Type</th>
<th style="text-align: center;" >Total Value</th> <th style="text-align: center;" >Total Value</th>
<th style="text-align: center;" >Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -321,6 +321,9 @@ $(document).ready(function () {
result.forEach(item => { result.forEach(item => {
CreatedDate = formatDate(item.CreatedDate); CreatedDate = formatDate(item.CreatedDate);
TotalOrderValue = formatNumberToIndianCurrency(item.TotalOrderValue); TotalOrderValue = formatNumberToIndianCurrency(item.TotalOrderValue);
baseUrl = "<?php echo base_url() ?>";
href = `${baseUrl}purchaseorder/CreatePOPrint?PONO=${item.PONO}&ReqType=${item.ReqType}`;
tableHtml += ` tableHtml += `
<tr> <tr>
<td>${CreatedDate}</td> <td>${CreatedDate}</td>
@ -328,9 +331,14 @@ $(document).ready(function () {
<td class="pono-cell" data-pono="${item.PONO}" data-potype="${item.POType}" data-capitalrange="${item.CapitalRange}" style="cursor: pointer; color: #4d3a6d;"> <td class="pono-cell" data-pono="${item.PONO}" data-potype="${item.POType}" data-capitalrange="${item.CapitalRange}" style="cursor: pointer; color: #4d3a6d;">
${item.PONO} ${item.PONO}
</td> </td>
<td style="text-align: right;">${item.POType}</td> <td style="text-align: right;">${item.POType}</td>
<td style="text-align: right;">${TotalOrderValue}</td> <td style="text-align: right;">${TotalOrderValue}</td>
</tr> <td style="text-align: center;">
<a data-toggle="tooltip" href=${href} target="_blank">
<i class="fa fa-print" data-toggle="tooltip" title="${item.PONO} - Click here to Print the Purchase Order details"></i>
</a>
</td>
</tr>
`; `;
}); });

View File

@ -529,7 +529,7 @@
<label> Master IGR file</label> <label> Master IGR file</label>
<br> <br>
<input type="file" name="MasterFile" id="MasterFile" onchange="filenames(this.name); "> <input type="file" name="MasterFile" id="MasterFile" onchange="filenames(this.name); ">
<label id="MasterFileLabel" style="display:none;"> <label id="MasterFileLabel" style="display:none;" class="mt-1">
<a><span></span><small></small></a> <a><span></span><small></small></a>
</label> </label>
</div> </div>