latest commit 16-05-2025

This commit is contained in:
vadivelJ96 2025-05-16 18:21:25 +05:30
parent 02946be654
commit 9fc6f50a6d
3 changed files with 63 additions and 62 deletions

View File

@ -2,6 +2,7 @@
namespace App\Controllers; namespace App\Controllers;
use App\Helpers\Notification;
use App\Models\Login_model; use App\Models\Login_model;
/** /**
@ -150,43 +151,29 @@ class Login extends BaseController
$passcode = substr($string_shuffled, 1, 6); $passcode = substr($string_shuffled, 1, 6);
$password = "RESICO@" . $passcode; $password = "RESICO@" . $passcode;
$mobile = "91" . $result[0]->ContactNumber;
$msg = "Hi " . $result[0]->FirstName . ", $msg = "Hi " . $result[0]->FirstName . ",
\n Your password has been reset successfully. \n Your password has been reset successfully.
\n Please login with your new password '" . $password . "'"; \n Please login with your new password '" . $password . "'";
$message = urlencode($msg); $notification = new Notification();
$ch = curl_init(); $notification->sendEmail([
'recipient_email' => $emailid,
$url = "https://smsapi.24x7sms.com/api_2.0/SendSMS.aspx?APIKEY=xegCdYUIMf3" 'subject' => 'Password Reset',
. "&MobileNo=" . urlencode($mobile) 'description' => $msg,
. "&SenderID=VNBAIT" 'from_mail'=> 'admin@resicoindustries.com'
. "&Message=" . urlencode($message) ]);
. "&ServiceName=PROMOTIONAL_HIGH";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch); $resetpassword = password_hash($password, PASSWORD_DEFAULT);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curlError = curl_error($ch);
curl_close($ch); $this->login_model->updatepassword($result[0]->userId, $resetpassword);
// Debug output session()->setFlashdata('success', 'Password sent successfully. Please check your mobile .');
// echo "HTTP Code: " . $httpCode . "<br>";
// echo "cURL Error: " . ($curlError ? $curlError : 'None') . "<br>"; return redirect()->to('/login');
// echo "Response: " . htmlentities($output);
$resetpassword = password_hash($password, PASSWORD_DEFAULT);
$this->login_model->updatepassword($result[0]->userId, $resetpassword);
session()->setFlashdata('success', 'Password sent successfully. Please check your mobile .');
return redirect()->to('/login');
} else { } else {
session()->setFlashdata('error', 'Given Mobile Number or Email is not registered with us.'); session()->setFlashdata('error', 'Given Mobile Number or Email is not registered with us.');
return redirect()->to('login'); return redirect()->to('login');

View File

@ -616,7 +616,7 @@ class Ipinvoice_model extends Model
$builder = $this->db->table('t_bagstockdetails tbd') $builder = $this->db->table('t_bagstockdetails tbd')
->select('tbd.balanceStock, tmm.MaterialName') ->select('tbd.balanceStock, tmm.MaterialName ,tmm.MaterialCode')
->join('t_materialmaster tmm', 'tmm.MaterialCode = tbd.materialCode') ->join('t_materialmaster tmm', 'tmm.MaterialCode = tbd.materialCode')
->where('tbd.date', $lastDateOfCurrentMonth) ->where('tbd.date', $lastDateOfCurrentMonth)
->get() ->get()
@ -624,12 +624,16 @@ class Ipinvoice_model extends Model
$header =array_column($builder,'MaterialName'); $header =array_column($builder,'MaterialName');
$materialCode =array_column($builder,'MaterialCode');
$body =array_column($builder,'balanceStock'); $body =array_column($builder,'balanceStock');
$result [] = ['header' => $header]; $result [] = ['header' => $header];
$result[] = ['body' => $body ?? "Not Opened Yet" ] ; $result [] = ['materialCode' => $materialCode];
$result [] = ['body' => $body ?? "Not Opened Yet" ] ;
break; break;
@ -639,7 +643,7 @@ class Ipinvoice_model extends Model
case "resin": case "resin":
$builder = $this->db->table('t_resinStockDetails trd') $builder = $this->db->table('t_resinStockDetails trd')
->select('trd.balanceStock, tmm.MaterialName') ->select('trd.balanceStock, tmm.MaterialName ,tmm.MaterialCode')
->join('t_materialmaster tmm', 'tmm.MaterialCode = trd.materialCode') ->join('t_materialmaster tmm', 'tmm.MaterialCode = trd.materialCode')
->where('trd.date', $lastDateOfCurrentMonth) ->where('trd.date', $lastDateOfCurrentMonth)
->get() ->get()
@ -647,12 +651,16 @@ class Ipinvoice_model extends Model
$header =array_column($builder,'MaterialName'); $header =array_column($builder,'MaterialName');
$materialCode =array_column($builder,'MaterialCode');
$body =array_column($builder,'balanceStock'); $body =array_column($builder,'balanceStock');
$result [] = ['header' => $header]; $result [] = ['header' => $header];
$result[] = ['body' => $body ?? "Not Opened Yet" ] ; $result [] = ['materialCode' => $materialCode];
$result [] = ['body' => $body ?? "Not Opened Yet" ] ;

View File

@ -119,55 +119,62 @@
<div align="left"> <div align="left">
<a class="btn btn-success btn-sm px-2" href="<?php echo base_url(); ?>sales_dashboard?stock=gas">Gas</a> <a class="btn btn-success btn-sm px-2" href="<?php echo base_url(); ?>sales_dashboard?stock=gas">Gas</a>
<a class="btn btn-primary btn-sm px-2" href="<?php echo base_url(); ?>sales_dashboard?stock=diesel">Diesel</a> <a class="btn btn-danger btn-sm px-2" href="<?php echo base_url(); ?>sales_dashboard?stock=diesel">Diesel</a>
<a class="btn btn-danger btn-sm px-2" href="<?php echo base_url(); ?>sales_dashboard?stock=power">Power</a>
<a class="btn btn-primary btn-sm px-2" href="<?php echo base_url(); ?>sales_dashboard?stock=resin">Resin</a> <a class="btn btn-primary btn-sm px-2" href="<?php echo base_url(); ?>sales_dashboard?stock=resin">Resin</a>
<a class="btn btn-secondary btn-sm px-2" href="<?php echo base_url(); ?>sales_dashboard?stock=bag">Bag</a> <a class="btn btn-secondary btn-sm px-2" href="<?php echo base_url(); ?>sales_dashboard?stock=bag">Bag</a>
</div> </div>
<table id="stockClosing" class="table dt-responsive nowrap w-100"> <table id="stockClosing" class="table dt-responsive nowrap w-100">
<thead> <thead>
<?php if (is_array($stock[0]['header'])) { ?> <?php if (is_array($stock[0]['header'])) { ?>
<tr> <tr>
<?php foreach ($stock[0]['header'] as $header) { ?> <th>S.NO</th>
<th>Material Code</th>
<th><?php echo $header ?></th> <th>Material Description</th>
<th>Closing Stock</th>
<?php } ?>
</tr> </tr>
<?php } else { ?> <?php } else { ?>
<tr> <tr>
<th><?php echo $stock[0]['header'] ?></th> <th>S.NO</th>
<th>Stock</th>
<th>Closing Stock</th>
</tr> </tr>
<?php } ?> <?php } ?>
</thead> </thead>
<tbody> <tbody>
<?php if (is_array($stock[1]['body'])) { ?>
<tr> <?php if (is_array($stock[0]['header'])) { ?>
<?php foreach ($stock[2]['body'] as $index => $body) { ?>
<tr>
<td> <?php echo $index + 1 ?></td>
<td> <?php echo $stock[1]['materialCode'][$index] ?> </td>
<td> <?php echo $stock[0]['header'][$index] ?></td>
<td> <?php echo $body ?></td>
</tr>
<?php foreach ($stock[1]['body'] as $body) { ?>
<th><?php echo $body ?></th>
<?php } ?> <?php } ?>
</tr>
<?php } else { ?> <?php } else { ?>
<tr> <tr>
<td> <td> 1 </td>
<?php echo $stock[1]['body'] ?> <td><?php echo $stock[0]['header'] ?></td>
</td> <td><?php echo $stock[1]['body'] ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
@ -294,31 +301,30 @@
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('#stockClosing').DataTable({ var table = $('#stockClosing').DataTable({
dom: 'Blfrtip', dom: 'Brtip', // Remove length and search inputs
buttons: [ lengthChange: false,
'excel' searching: false,
], buttons: ['excel'],
pageLength: 10, responsive: true,
lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
],
responsive: false,
order: false, order: false,
language: { language: {
paginate: { paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon next: '<i class="fas fa-angle-right"></i>',
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon previous: '<i class="fas fa-angle-left"></i>'
} }
} }
}); });
// Move Excel button to custom div
// table.buttons().container().appendTo('#exportExcelBtn');
}); });
</script> </script>
<script> <script>
const currentYearSales = <?php echo json_encode($currentYearSales); ?>; const currentYearSales = <?php echo json_encode($currentYearSales); ?>;
const lastYearSales = <?php echo json_encode($lastYearSales); ?>; const lastYearSales = <?php echo json_encode($lastYearSales); ?>;