latest commit 15-05-2025

This commit is contained in:
vadivelJ96 2025-05-15 13:54:00 +05:30
parent aee115c545
commit 00f4428680
6 changed files with 327 additions and 33 deletions

View File

@ -130,7 +130,7 @@ class Login extends BaseController
*/
function forgotPassword()
{
view('forgotPassword');
return view('forgotPassword');
}
@ -167,11 +167,11 @@ class Login extends BaseController
$updatepassword = $this->login_model->updatepassword($result[0]->userId, $resetpassword);
session()->setFlashdata('success', 'Password sent successfully. Please check your mobile.');
return redirect()->to('/loginMe');
session()->setFlashdata('success', 'Password sent successfully. Please check your mobile .');
return redirect()->to('/login');
} else {
session()->setFlashdata('error', 'This Mobile Number is not registered with us.');
return redirect()->to('/loginMe');
session()->setFlashdata('error', 'Given Mobile Number or Email is not registered with us.');
return redirect()->to('login');
}
}
}

View File

@ -86,6 +86,14 @@ class Sales extends BaseController
// Assign to data array
$data['currentYearSales'] = $currentYearSales;
$data['lastYearSales'] = $lastYearSales;
$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);
// echo "<pre>";
// print_r($data);

View File

@ -509,4 +509,182 @@ class Ipinvoice_model extends Model
return $query->getResultArray();
}
function getClosingStock($stock){
$date = date('Y-m-d');
$firstDateOfCurrentMonth = date('Y-m-01', strtotime($date));
$lastDateOfCurrentMonth = date('Y-m-t', strtotime($date));
$firstDateOfPreviousMonth = date('Y-m-01', strtotime($date . ' -1 month'));
$lastDateOfPreviousMonth = date('Y-m-t', strtotime($date . ' -1 month'));
$result = [];
switch ($stock) {
/************************************************************* GAS ****************************************************************/
case "gas":
$builder = $this->db
->table('t_gasstockdetails')
->select('balanceStock')
->where('date',$lastDateOfCurrentMonth)
->get()
->getResultArray();
if(empty($builder)){
$builder = $this->db
->table('t_gasstockdetails')
->select('balanceStock')
->where('date',$lastDateOfPreviousMonth)
->get()
->getResultArray();
}
$result [] = ['header' => 'Gas Final Closing'];
$result[] = ['body' => $builder[0]['balanceStock'] ?? "Not Opened Yet" ] ;
break;
/************************************************************* DIESEL ****************************************************************/
case "diesel":
$builder = $this->db
->table('t_factoryvehicledieselstocksummary')
->select('balance_stock')
->where('date',$lastDateOfCurrentMonth)
->get()
->getResultArray();
if(empty($builder)){
$builder = $this->db
->table('t_factoryvehicledieselstocksummary')
->select('balance_stock')
->where('date',$lastDateOfPreviousMonth)
->get()
->getResultArray();
}
$result [] = ['header' => 'Diesel Final Closing'];
$result[] = ['body' => $builder[0]['balance_stock'] ?? "Not Opened Yet" ] ;
break;
/************************************************************* POWER ****************************************************************/
case "power":
$builder = $this->db
->table('t_powerconsumptionsummary')
->selectSum('total_units')
->where('date >=', $firstDateOfCurrentMonth)
->where('date <=', $lastDateOfCurrentMonth)
->get()
->getResultArray();
$result [] = ['header' => 'Power Total Units'];
$result[] = ['body' => $builder[0]['total_units'] ?? "Not Opened Yet" ] ;
break;
/************************************************************* Bag ****************************************************************/
case "bag":
$builder = $this->db->table('t_bagstockdetails tbd')
->select('tbd.balanceStock, tmm.MaterialName')
->join('t_materialmaster tmm', 'tmm.MaterialCode = tbd.materialCode')
->where('tbd.date', $lastDateOfCurrentMonth)
->get()
->getResultArray();
$header =array_column($builder,'MaterialName');
$body =array_column($builder,'balanceStock');
$result [] = ['header' => $header];
$result[] = ['body' => $body ?? "Not Opened Yet" ] ;
break;
/************************************************************* Resin ****************************************************************/
case "resin":
$builder = $this->db->table('t_resinStockDetails trd')
->select('trd.balanceStock, tmm.MaterialName')
->join('t_materialmaster tmm', 'tmm.MaterialCode = trd.materialCode')
->where('trd.date', $lastDateOfCurrentMonth)
->get()
->getResultArray();
$header =array_column($builder,'MaterialName');
$body =array_column($builder,'balanceStock');
$result [] = ['header' => $header];
$result[] = ['body' => $body ?? "Not Opened Yet" ] ;
break;
/************************************************************* Default ****************************************************************/
default:
$result [] = ['header' => 'Gas Final Closing'];
$builder = $this->db
->table('t_gasstockdetails')
->select('balanceStock')
->where('date',$lastDateOfCurrentMonth)
->get()
->getResultArray();
$result[] =['body' => $builder[0]['balanceStock']] ;
}
return $result;
}
}

View File

@ -155,11 +155,10 @@ class Login_model extends Model
{
$builder = $this->db->table('tbl_users as UsrTbl');
$builder->select('UsrTbl.userId,UsrTbl.email,EmpTbl.ContactNumber,EmpTbl.FirstName')
->from('tbl_users as UsrTbl')
->join('t_employee_details as EmpTbl', 'UsrTbl.EmpID = EmpTbl.EmpID')
->where('EmpTbl.ContactNumber', $mobileno)
->where('UsrTbl.email', $emailid)
->where('UsrTbl.isDeleted', 0);
->join('t_employee_details as EmpTbl', 'UsrTbl.EmpID = EmpTbl.EmpID')
->where('EmpTbl.ContactNumber', $mobileno)
->where('UsrTbl.email', $emailid)
->where('UsrTbl.isDeleted', 0);
$res = $builder->get();
return $res->getResult();
}

View File

@ -84,13 +84,18 @@
</div>
</div>
<!-- title-->
<!-- <h4 class="mt-0">Sign In</h4> -->
<!-- development-change-02/09/2024 -->
<!-- displaying error message in the form -->
<?php
if (session()->has('success')): ?>
<div class="alert alert-success">
<?= session('success') ?>
</div>
<?php endif; ?>
<?php if (session()->has('error')): ?>
<?php
if (session()->has('error')): ?>
<div class="alert alert-danger">
<?= session('error') ?>
</div>
@ -105,7 +110,7 @@
required="" />
</div>
<div class="form-group">
<a href="auth-recoverpw-2.html" class="text-muted float-right"><small>Forgot your
<a href="forgotPassword" class="text-muted float-right"><small>Forgot your
password?</small></a>
<label for="password">Password</label>
<div class="input-group input-group-merge">

View File

@ -71,7 +71,7 @@
<div class="text-left">
<p class="text-muted mb-0">Sales in Rs.</p>
<h4 class="mb-1 mt-0">
<span class="card_font_colorset_bule"><?php echo $this_month_sales->Sales; ?></span>
<span class="card_font_colorset_bule"><?php echo $this_month_sales->Sales; ?></span>
</h4>
</div>
</div>
@ -101,7 +101,7 @@
<div class="text-left">
<p class="text-muted mb-0">Sales in Rs.</p>
<h4 class="mb-1 mt-0">
<span class="card_font_colorset_red"><?php echo $this_year_sales->Sales; ?></span>
<span class="card_font_colorset_red"><?php echo $this_year_sales->Sales; ?></span>
</h4>
</div>
</div>
@ -109,7 +109,78 @@
</div>
</div>
</div>
<div class="row">
<div class="col-xl-12 col-md-12">
<div class="card">
<div class="card-body">
<h4 class="header-title">Stock Dashboard</h4>
<div align="center">
<a class="btn btn-success px-3" href="<?php echo base_url(); ?>sales_dashboard?stock=gas">Gas</a> &nbsp;
<a class="btn btn-warning px-3" href="<?php echo base_url(); ?>sales_dashboard?stock=diesel">Diesel</a> &nbsp;
<a class="btn btn-danger px-3" href="<?php echo base_url(); ?>sales_dashboard?stock=power">Power</a> &nbsp;
<a class="btn btn-primary px-3" href="<?php echo base_url(); ?>sales_dashboard?stock=resin">Resin</a> &nbsp;
<a class="btn btn-secondary px-3" href="<?php echo base_url(); ?>sales_dashboard?stock=bag">Bag</a> &nbsp;
</div>
<table id="stockClosing" class="table dt-responsive nowrap w-100">
<thead>
<?php if (is_array($stock[0]['header'])) { ?>
<tr>
<?php foreach ($stock[0]['header'] as $header) { ?>
<th><?php echo $header ?></th>
<?php } ?>
</tr>
<?php } else { ?>
<tr>
<th><?php echo $stock[0]['header'] ?></th>
</tr>
<?php } ?>
</thead>
<tbody>
<?php if (is_array($stock[1]['body'])) { ?>
<tr>
<?php foreach ($stock[1]['body'] as $body) { ?>
<th><?php echo $body ?></th>
<?php } ?>
</tr>
<?php } else { ?>
<tr>
<td>
<?php echo $stock[1]['body'] ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="row">
@ -169,20 +240,24 @@
<td><?php echo $invoice['Vehicle No.']; ?></td>
<td><?php echo $invoice['Product']; ?></td>
<td><?php echo $invoice['Client']; ?></td>
<td align="right"> <?php echo number_format($invoice['Quantity'], 2, '.', ',') ?></td>
<td align="right"> <?php echo number_format($invoice['Rate'], 2, '.', ',') ?></td>
<td align="right"> <?php echo number_format($invoice['Value'], 2, '.', ',') ?></td>
<td align="right"> <?php echo number_format($invoice['CGST'], 2, '.', ',') ?></td>
<td align="right"> <?php echo number_format($invoice['SGST'], 2, '.', ',') ?></td>
<td align="right"> <?php echo number_format($invoice['IGST'], 2, '.', ',') ?></td>
<td align="right"> <?php echo number_format($invoice['TCS'], 2, '.', ',') ?></td>
<td align="right"> <?php echo number_format($invoice['Total'], 2, '.', ',') ?></td>
<td align="right"> <?php echo number_format($invoice['Quantity'], 2, '.', ',') ?></td>
<td align="right"> <?php echo number_format($invoice['Rate'], 2, '.', ',') ?></td>
<td align="right"> <?php echo number_format($invoice['Value'], 2, '.', ',') ?></td>
<td align="right"> <?php echo number_format($invoice['CGST'], 2, '.', ',') ?></td>
<td align="right"> <?php echo number_format($invoice['SGST'], 2, '.', ',') ?></td>
<td align="right"> <?php echo number_format($invoice['IGST'], 2, '.', ',') ?></td>
<td align="right"> <?php echo number_format($invoice['TCS'], 2, '.', ',') ?></td>
<td align="right"> <?php echo number_format($invoice['Total'], 2, '.', ',') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<br>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
@ -200,10 +275,13 @@
buttons: [
'excel', 'pdf'
],
pageLength: 10,
lengthMenu: [[10, 20, 30, 50, -1],[10, 20, 30, 50, "All"] ],
responsive: false,
order:false,
pageLength: 10,
lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
],
responsive: false,
order: false,
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
@ -214,6 +292,32 @@
});
</script>
<script>
$(document).ready(function() {
$('#stockClosing').DataTable({
dom: 'Blfrtip',
buttons: [
'excel'
],
pageLength: 10,
lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
],
responsive: false,
order: false,
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
}
}
});
});
</script>
<script>
const currentYearSales = <?php echo json_encode($currentYearSales); ?>;
@ -242,7 +346,7 @@
},
options: {
scales: {
y: {
beginAtZero: true, // Ensures the y-axis starts at zero
ticks: {