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() function forgotPassword()
{ {
view('forgotPassword'); return view('forgotPassword');
} }
@ -168,10 +168,10 @@ class Login extends BaseController
$updatepassword = $this->login_model->updatepassword($result[0]->userId, $resetpassword); $updatepassword = $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 mobile .');
return redirect()->to('/loginMe'); return redirect()->to('/login');
} else { } else {
session()->setFlashdata('error', 'This Mobile Number is not registered with us.'); session()->setFlashdata('error', 'Given Mobile Number or Email is not registered with us.');
return redirect()->to('/loginMe'); return redirect()->to('login');
} }
} }
} }

View File

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

View File

@ -509,4 +509,182 @@ class Ipinvoice_model extends Model
return $query->getResultArray(); 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,7 +155,6 @@ class Login_model extends Model
{ {
$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')
->from('tbl_users as UsrTbl')
->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('EmpTbl.ContactNumber', $mobileno)
->where('UsrTbl.email', $emailid) ->where('UsrTbl.email', $emailid)

View File

@ -84,13 +84,18 @@
</div> </div>
</div> </div>
<!-- title-->
<!-- <h4 class="mt-0">Sign In</h4> -->
<!-- development-change-02/09/2024 --> <?php
<!-- displaying error message in the form -->
<?php if (session()->has('error')): ?> if (session()->has('success')): ?>
<div class="alert alert-success">
<?= session('success') ?>
</div>
<?php endif; ?>
<?php
if (session()->has('error')): ?>
<div class="alert alert-danger"> <div class="alert alert-danger">
<?= session('error') ?> <?= session('error') ?>
</div> </div>
@ -105,7 +110,7 @@
required="" /> required="" />
</div> </div>
<div class="form-group"> <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> password?</small></a>
<label for="password">Password</label> <label for="password">Password</label>
<div class="input-group input-group-merge"> <div class="input-group input-group-merge">

View File

@ -111,6 +111,77 @@
</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"> <div class="row">
<div class="col-xl-12 col-md-12"> <div class="col-xl-12 col-md-12">
@ -183,6 +254,10 @@
</tbody> </tbody>
</table> </table>
<br>
</div> <!-- end card body--> </div> <!-- end card body-->
</div> <!-- end card --> </div> <!-- end card -->
</div><!-- end col--> </div><!-- end col-->
@ -201,7 +276,10 @@
'excel', 'pdf' 'excel', 'pdf'
], ],
pageLength: 10, pageLength: 10,
lengthMenu: [[10, 20, 30, 50, -1],[10, 20, 30, 50, "All"] ], lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
],
responsive: false, responsive: false,
order: false, order: false,
language: { language: {
@ -214,6 +292,32 @@
}); });
</script> </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> <script>
const currentYearSales = <?php echo json_encode($currentYearSales); ?>; const currentYearSales = <?php echo json_encode($currentYearSales); ?>;