latest commit 17-05-2025

This commit is contained in:
vadivelJ96 2025-05-17 10:15:59 +05:30
parent 0783b55a56
commit 1014337b37
7 changed files with 127 additions and 32 deletions

View File

@ -140,9 +140,9 @@ class Login extends BaseController
*/ */
public function resetPasswordUser() public function resetPasswordUser()
{ {
$mobileno = $this->request->getPost('phno');
$emailid = $this->request->getPost('email'); $emailid = $this->request->getPost('email');
$result = $this->login_model->getuserid($mobileno, $emailid); $result = $this->login_model->getuserid($emailid);
if (!empty($result)) { if (!empty($result)) {
@ -169,13 +169,13 @@ class Login extends BaseController
$this->login_model->updatepassword($result[0]->userId, $resetpassword); $this->login_model->updatepassword($result[0]->userId, $resetpassword);
session()->setFlashdata('success', 'Password sent successfully. Please check your mobile .'); session()->setFlashdata('success', 'Password sent successfully. Please check your E-mail .');
return redirect()->to('/login'); return redirect()->to('/login');
} else { } else {
session()->setFlashdata('error', 'Given Mobile Number or Email is not registered with us.'); session()->setFlashdata('error', 'Given Email is not registered with us.');
return redirect()->to('login'); return redirect()->to('login');
} }
} }

View File

@ -90,6 +90,7 @@ class Sales extends BaseController
$stock = $this->request->getVar('stock')??"none"; // maybe any thing like bag or resin or power or diesel or gas $stock = $this->request->getVar('stock')??"none"; // maybe any thing like bag or resin or power or diesel or gas
$data['stock'] = $this->ipinvoice_model->getClosingStock($stock); $data['stock'] = $this->ipinvoice_model->getClosingStock($stock);
$data['givenStock'] = $stock ?? 'resin';

View File

@ -672,17 +672,25 @@ class Ipinvoice_model extends Model
default: default:
$result [] = ['header' => 'Gas Final Closing']; $builder = $this->db->table('t_resinStockDetails trd')
->select('trd.balanceStock, tmm.MaterialName ,tmm.MaterialCode')
->join('t_materialmaster tmm', 'tmm.MaterialCode = trd.materialCode')
->where('trd.date', $lastDateOfCurrentMonth)
->get()
->getResultArray();
$header =array_column($builder,'MaterialName');
$materialCode =array_column($builder,'MaterialCode');
$body =array_column($builder,'balanceStock');
$builder = $this->db $result [] = ['header' => $header];
->table('t_gasstockdetails')
->select('balanceStock')
->where('date',$lastDateOfCurrentMonth)
->get()
->getResultArray();
$result[] =['body' => $builder[0]['balanceStock']] ; $result [] = ['materialCode' => $materialCode];
$result [] = ['body' => $body ?? "Not Opened Yet" ] ;
} }

View File

@ -151,12 +151,11 @@ class Login_model extends Model
/** /**
* get the user dtl * get the user dtl
*/ */
function getuserid($mobileno, $emailid) function getuserid($emailid)
{ {
$builder = $this->db->table('tbl_users as UsrTbl'); $builder = $this->db->table('tbl_users as UsrTbl');
$builder->select('UsrTbl.userId,UsrTbl.email,EmpTbl.ContactNumber,EmpTbl.FirstName') $builder->select('UsrTbl.userId,UsrTbl.email,EmpTbl.ContactNumber,EmpTbl.FirstName')
->join('t_employee_details as EmpTbl', 'UsrTbl.EmpID = EmpTbl.EmpID') ->join('t_employee_details as EmpTbl', 'UsrTbl.EmpID = EmpTbl.EmpID')
->where('EmpTbl.ContactNumber', $mobileno)
->where('UsrTbl.email', $emailid) ->where('UsrTbl.email', $emailid)
->where('UsrTbl.isDeleted', 0); ->where('UsrTbl.isDeleted', 0);
$res = $builder->get(); $res = $builder->get();

View File

@ -24,10 +24,6 @@
<p class="login-box-msg">Forgot Password</p> <p class="login-box-msg">Forgot Password</p>
<!-- <form action="<?php echo base_url(); ?>resetPasswordConfirmUser" method="post"> // this form action for OTP --> <!-- <form action="<?php echo base_url(); ?>resetPasswordConfirmUser" method="post"> // this form action for OTP -->
<form action="<?php echo base_url(); ?>resetPasswordUser" method="post"> <form action="<?php echo base_url(); ?>resetPasswordUser" method="post">
<div class="form-group has-feedback">
<input type="text" class="form-control" placeholder="Mobile Number" name ="phno" id= "phno" maxlength="10" onkeypress="return isNumber(event)">
<span class="glyphicon glyphicon glyphicon-phone form-control-feedback"></span>
</div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<input type="text" class="form-control" placeholder="Email" name="email" required /> <input type="text" class="form-control" placeholder="Email" name="email" required />
<span class="glyphicon glyphicon-envelope form-control-feedback"></span> <span class="glyphicon glyphicon-envelope form-control-feedback"></span>

View File

@ -235,7 +235,7 @@ if (!empty($Status)) {
var table = $('#requisition_listing').DataTable({ var table = $('#requisition_listing').DataTable({
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
buttons: [ buttons: [
'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons 'excel', 'pdf' // Export buttons
], ],
pageLength: 10, // Default rows per page pageLength: 10, // Default rows per page
lengthMenu: [ lengthMenu: [

View File

@ -115,16 +115,42 @@
<div class="col-xl-12 col-md-12"> <div class="col-xl-12 col-md-12">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<h4 class="header-title">Stock Dashboard</h4> <h4 class="header-title">This Month Stock Closing</h4>
<div align="left"> <div class="d-flex justify-content-between align-items-center">
<a class="btn btn-success btn-sm px-2" href="<?php echo base_url(); ?>sales_dashboard?stock=gas">Gas</a> <div>
<a class="btn btn-danger btn-sm px-2" href="<?php echo base_url(); ?>sales_dashboard?stock=diesel">Diesel</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> <a class="btn btn-danger btn-sm px-2" href="<?php echo base_url(); ?>sales_dashboard?stock=diesel">Diesel</a>
<a class="btn btn-success btn-sm px-2" href="<?php echo base_url(); ?>sales_dashboard?stock=gas">Gas</a>
</div>
<div>
<button class="btn btn-primary btn-sm px-2" id="xldwnldStockDbd">Excel</button>
</div>
</div> </div>
<?php if(isset($givenStock)){
switch ($givenStock) {
case 'gas':
$href = base_url('gasStockDetails');
break;
case 'diesel':
$href = base_url('dieselMachineDetails');
break;
case 'resin':
$href = base_url('resinStockDetails');
break;
case 'bag':
$href = base_url('bagStockDetails');
break;
default:
$href = base_url('resinStockDetails');
}
}?>
<table id="stockClosing" class="table dt-responsive nowrap w-100"> <table id="stockClosing" class="table dt-responsive nowrap w-100">
<thead> <thead>
@ -157,9 +183,12 @@
<tr> <tr>
<td> <?php echo $index + 1 ?></td> <td> <?php echo $index + 1 ?></td>
<td> <?php echo $stock[1]['materialCode'][$index] ?> </td> <td> <?php echo $stock[1]['materialCode'][$index] ?> </td>
<td> <?php echo $stock[0]['header'][$index] ?></td> <td> <a href="<?=$href?>">
<?php echo $stock[0]['header'][$index] ?>
</a>
</td>
<td> <?php echo $body ?></td> <td> <?php echo $body ?></td>
</tr> </tr>
@ -173,8 +202,12 @@
<tr> <tr>
<td> 1 </td> <td> 1 </td>
<td><?php echo $stock[0]['header'] ?></td> <td>
<td><?php echo $stock[1]['body'] ?></td> <a href="<?=$href?>">
<?php echo $stock[0]['header'] ?>
</a>
</td>
<td> <?php echo $stock[1]['body'] ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
@ -305,7 +338,7 @@
dom: 'Brtip', // Remove length and search inputs dom: 'Brtip', // Remove length and search inputs
lengthChange: false, lengthChange: false,
searching: false, searching: false,
buttons: ['excel'], buttons: [''],
responsive: true, responsive: true,
order: false, order: false,
language: { language: {
@ -376,3 +409,61 @@
} }
}); });
</script> </script>
<script>
$(document).ready(function() {
function exportTableToExcel(tableID, filename = '') {
let table = document.getElementById(tableID);
let cloneTable = table.cloneNode(true); // Clone the table to modify
// Remove hidden rows
$(cloneTable).find('tr').filter(function() {
return $(this).css('display') === 'none';
}).remove();
// Remove hidden columns
$(cloneTable).find('th, td').each(function() {
if ($(this).css('display') === 'none') {
$(this).remove();
}
});
let ws = XLSX.utils.table_to_sheet(cloneTable);
// Set column width to 10 for all columns
let colCount = 0;
$(cloneTable).find('tr').each(function() {
let count = $(this).find('th, td').length;
if (count > colCount) colCount = count;
});
let wscols = [];
for (let i = 0; i < colCount; i++) {
wscols.push({ wch: 10 }); // Set width of 10 for all columns
}
ws['!cols'] = wscols;
let wb = XLSX.utils.book_new(); // Create a new workbook
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
}
let tableId = 'stockClosing';
document.getElementById('xldwnldStockDbd').addEventListener('click', function() {
<?php $month = date('d-m-Y'); ?>
exportTableToExcel(tableId, 'Stock Closing-<?= $month ?>.xlsx');
})
})
</script>