diff --git a/app/Controllers/Login.php b/app/Controllers/Login.php index 683ac74c..f3609bfe 100755 --- a/app/Controllers/Login.php +++ b/app/Controllers/Login.php @@ -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'); } } } diff --git a/app/Controllers/Sales.php b/app/Controllers/Sales.php index a0f8ccb5..093a2564 100755 --- a/app/Controllers/Sales.php +++ b/app/Controllers/Sales.php @@ -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 "
";
// print_r($data);
diff --git a/app/Models/Ipinvoice_model.php b/app/Models/Ipinvoice_model.php
index 0e7e645c..0cd6c2b0 100755
--- a/app/Models/Ipinvoice_model.php
+++ b/app/Models/Ipinvoice_model.php
@@ -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;
+
+
+
+ }
+
+
+
+
}
\ No newline at end of file
diff --git a/app/Models/Login_model.php b/app/Models/Login_model.php
index 0f55ed5a..122ffd63 100755
--- a/app/Models/Login_model.php
+++ b/app/Models/Login_model.php
@@ -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();
}
diff --git a/app/Views/login.php b/app/Views/login.php
index 7b0ee679..8c2380b3 100755
--- a/app/Views/login.php
+++ b/app/Views/login.php
@@ -84,13 +84,18 @@
-
-
-
-
+ has('success')): ?>
+
+ = session('success') ?>
+
+
- has('error')): ?>
+ has('error')): ?>
= session('error') ?>
@@ -105,7 +110,7 @@
required="" />
- Forgot your
+ Forgot your
password?
diff --git a/app/Views/sales_dashboard.php b/app/Views/sales_dashboard.php
index ce62ea2b..94e68a82 100755
--- a/app/Views/sales_dashboard.php
+++ b/app/Views/sales_dashboard.php
@@ -71,7 +71,7 @@
Sales in Rs.
- Sales; ?>
+ Sales; ?>
@@ -101,7 +101,7 @@
Sales in Rs.
- Sales; ?>
+ Sales; ?>
@@ -109,7 +109,78 @@
-
+
+
+
+
+
+
@@ -169,20 +240,24 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -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: '', // Next button icon
@@ -214,6 +292,32 @@
});
+
+
+
+