Email for remark , view igr tax,tot amot display : GWM

This commit is contained in:
Gowtham M 2025-02-10 11:29:33 +05:30
parent e75db24ab8
commit 249293c8f4
4 changed files with 51 additions and 11 deletions

View File

@ -33,6 +33,7 @@ class Inwardgateregister extends BaseController
*/
public function __construct()
{
parent::__construct();
$this->inwardgateregister_model = new Inwardgateregister_model();
$this->IGRRemarks_model = new IGRRemarks_model();
@ -42,6 +43,7 @@ class Inwardgateregister extends BaseController
$this->logger = service('logger'); // Load the logger service
$this->isLoggedIn();
}
/**
* This function used to load the first screen of the user
@ -1524,11 +1526,48 @@ function updateIGRWeight(){
->join('t_employee_details', 't_igr_remarkes.remark_by = t_employee_details.EmpID', 'left')
->where('t_igr_remarkes.igr_no', $data['igr_no'])
->findAll();
$this->sendRemarkMail($this->request->getPost('igr_no'),$this->request->getPost('remark'),session()->get('EmpID'));
echo json_encode($data);
}
public function sendRemarkMail($IGRNo,$remark,$empCode)
{
if(session()->get('roleText') == 'System Administrator') // id is 1
{
$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);
$email = "";
for ($i = 0; $i < count($result_for_email['emails']); $i++) {
$email .= $result_for_email['emails'][$i]->email . " , ";
}
$email = rtrim($email, " ,");
$content = 'A new remark was created by '.$result_for_email['full_name'].' against IGR no '.$IGRNo.',</br></br> "'.$remark.'"';
$notification = new Notification();
$notification->sendEmail([
'recipient_email' => $email,
'subject' => $result_for_email['company'].' - IGR Remark Raised',
'description' => $content,
'company' => $result_for_email['company'],
'from_mail'=> $result_for_email['from_mail']
]);
}
public function saveIGRHistory($hist){
$field = $hist['key'];

View File

@ -1200,7 +1200,7 @@ class Inwardgateregister_model extends Model
return $query->getResult();
}
public function getDetailsforEmail($userId)
public function getDetailsforEmail($userId,$roleId = 2)
{
$query0 = $this->db->query("
SELECT CompanyName,EmailAddress
@ -1217,7 +1217,7 @@ class Inwardgateregister_model extends Model
$query2 = $this->db->query("
SELECT email FROM tbl_users
WHERE isDeleted = 0 AND roleId = 2" // hardcoded because auditor role only. refer with gwm 29/01/2025
WHERE isDeleted = 0 AND roleId =".$roleId // hardcoded because auditor role only. refer with gwm 29/01/2025
);
$emails = $query2->getResult();

View File

@ -850,9 +850,6 @@ $(document).ready(function () {
if (is_management_team == 1) {
var dayWorkPaid = dayWorks + paidLeave + lopDay;
} else {
@ -883,14 +880,13 @@ $(document).ready(function () {
var currentDaySalary = daySalary * dayWorkPaid;
var currentDaySalary = daySalary * dayWorkPaid;
if (isNaN(currentDaySalary)) { currentDaySalary = 0; }
var currentDayHra = dayHra * dayWorkPaid;
var currentDayHra = dayHra * dayWorkPaid;
if (isNaN(currentDayHra)) { currentDayHra = 0; }
var current_loan_amt = 0;
var autoLoan = parseFloat(monthDue);
@ -949,7 +945,6 @@ $(document).ready(function () {
var employeeSalary = Math.round(empMonthSalary);
//console.log( employeeSalary);
var cals = (employeeSalary).toFixed(0);

View File

@ -219,6 +219,9 @@
<!-- Rec qty changed to invoice qty -->
<th>Invoice Qty</th>
<th>Net weight</th>
<th>Taxable Amt</th>
<th>Tax Amt</th>
<th>Total Amt</th>
<th>Vechicle No</th>
<th>Driver</th>
<th>Transporter</th>
@ -257,6 +260,9 @@
<td align="right"><?php echo (int)$record->ReceivedQuantity ?></td>
<td align="right"><?php echo (int)$record->NetWeight ?></td>
<td align="right"><?php echo (int)$record->taxable_value ?></td>
<td align="right"><?php echo (int)$record->gst_amount ?></td>
<td align="right"><?php echo ((int)$record->gst_amount + (int)$record->gst_amount) ?></td>
<td><?php echo $record->VehicleNo ?></td>
<td><?php echo $record->DriverName ?></td>