diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index dc80c492..b355669b 100755
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -460,6 +460,16 @@ $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Report_Material_inward_Registe
$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'DeliveryPerformance', 'User::deliver_perform');
$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'Empperform', 'Report::per');
+//stock reports
+$routes->match(['GET', 'POST'],'smrySilicaSandReport','Report::smrySilicaSandReport');
+$routes->match(['GET', 'POST'],'smryWasteCoreSandReport','Report::smryWasteCoreSandReport');
+$routes->match(['GET', 'POST'],'smryDustQtyReport','Report::smryDustQtyReport');
+$routes->match(['GET', 'POST'],'smryCoatedSandReport','Report::smryCoatedSandReport');
+$routes->match(['GET', 'POST'],'smryPackingMaterialReport','Report::smryPackingMaterialReport');
+$routes->match(['GET', 'POST'],'smryDieselReport','Report::smryDieselReport');
+$routes->match(['GET', 'POST'],'smryGasReport','Report::smryGasReport');
+$routes->match(['GET', 'POST'],'smryResinReport','Report::smryResinReport');
+
$routes->get('quality', 'Quality::index');
$routes->get('qualityreportlist', 'Quality::reportList');
$routes->get('qualityreportlistinward', 'Quality::reportListInward');
diff --git a/app/Controllers/Report.php b/app/Controllers/Report.php
index 6575f62f..6632f41b 100755
--- a/app/Controllers/Report.php
+++ b/app/Controllers/Report.php
@@ -1626,4 +1626,148 @@ class Report extends BaseController
$this->loadviews("cashbook_cumulative_month_report", $this->global, $data, NULL);
}
+
+
+
+
+
+ //stock reports section
+
+
+ public function smrySilicaSandReport(){
+ $this->global['pageTitle'] = 'Summary-Silica Sand Report';
+ $data = [];
+
+ if ($this->request->getPost('month')) {
+ $month = $this->request->getPost('month') ;
+ $year = $this->request->getPost('financialyear');
+
+ $data['smrySilicaSandReport'] = $this->dahsboard_Model->smrySilicaSandReport($month,$year);
+ }
+
+ $data['finyear'] = $this->dahsboard_Model->stockFinancialYear();
+
+
+ $this->loadviews("Report_smrySilicaSandReport", $this->global, $data, NULL);
+ }
+
+ public function smryWasteCoreSandReport(){
+ $this->global['pageTitle'] = 'Summary-Waste Core Sand Report';
+ $data = [];
+
+ if ($this->request->getPost('month')) {
+ $month = $this->request->getPost('month') ;
+ $year = $this->request->getPost('financialyear');
+ $data['smryWasteCoreSandReport'] = $this->dahsboard_Model->smryWasteCoreSandReport($month,$year);
+
+ }
+ $data['finyear'] = $this->dahsboard_Model->stockFinancialYear();
+
+ $this->loadviews("Report_smryWasteCoreSandReport", $this->global, $data, NULL);
+ }
+
+ public function smryDustQtyReport(){
+ $this->global['pageTitle'] = 'Summary-Dust Qty Report';
+ $data = [];
+
+ if ($this->request->getPost('month')) {
+ $month = $this->request->getPost('month') ;
+ $year = $this->request->getPost('financialyear');
+ $data['smryDustQtyReport'] = $this->dahsboard_Model->smryDustQtyReport($month,$year);
+
+ }
+ $data['finyear'] = $this->dahsboard_Model->stockFinancialYear();
+
+ $this->loadviews("Report_smryDustQtyReport", $this->global, $data, NULL);
+ }
+
+ public function smryCoatedSandReport(){
+ $this->global['pageTitle'] = 'Summary-Coated Sand Report';
+ $data = [];
+
+ if ($this->request->getPost('month')) {
+ $month = $this->request->getPost('month') ;
+ $year = $this->request->getPost('financialyear');
+ $data['smryCoatedSandReport'] = $this->dahsboard_Model->smryCoatedSandReport($month,$year);
+
+ }
+ $data['finyear'] = $this->dahsboard_Model->stockFinancialYear();
+
+ $this->loadviews("Report_smryCoatedSandReport", $this->global, $data, NULL);
+ }
+
+ public function smryPackingMaterialReport(){
+ $this->global['pageTitle'] = 'Summary- Packing Material Report';
+ $data = [];
+
+ if ($this->request->getPost('month')) {
+ $month = $this->request->getPost('month') ;
+ $year = $this->request->getPost('financialyear');
+ $data['smryPackingMaterialReport'] = $this->dahsboard_Model->smryPackingMaterialReport($month,$year);
+ $data['givenMonth'] = $month;
+ $data['givenYear'] = $year;
+
+ }
+ $data['finyear'] = $this->dahsboard_Model->stockFinancialYear();
+
+ $this->loadviews("Report_smryPackingMaterialReport", $this->global, $data, NULL);
+ }
+
+ public function smryDieselReport(){
+ $this->global['pageTitle'] = 'Summary-Diesel Report';
+ $data = [];
+
+ if ($this->request->getPost('month')) {
+ $month = $this->request->getPost('month') ;
+ $year = $this->request->getPost('financialyear');
+ $data['smryDieselReport'] = $this->dahsboard_Model->smryDieselReport($month,$year);
+
+ }
+ $data['finyear'] = $this->dahsboard_Model->stockFinancialYear();
+
+ $this->loadviews("Report_smryDieselReport", $this->global, $data, NULL);
+ }
+
+ public function smryGasReport(){
+ $this->global['pageTitle'] = 'Summary- Gas Report';
+ $data = [];
+
+ if ($this->request->getPost('month')) {
+ $month = $this->request->getPost('month') ;
+ $year = $this->request->getPost('financialyear');
+ $data['smryGasReport'] = $this->dahsboard_Model->smryGasReport($month,$year);
+
+ }
+ $data['finyear'] = $this->dahsboard_Model->stockFinancialYear();
+
+ $this->loadviews("Report_smryGasReport", $this->global, $data, NULL);
+ }
+
+ public function smryResinReport(){
+ $this->global['pageTitle'] = 'Summary- Resin Report';
+ $data = [];
+
+ if ($this->request->getPost('month')) {
+ $month = $this->request->getPost('month') ;
+ $year = $this->request->getPost('financialyear');
+ $data['smryResinReport'] = $this->dahsboard_Model->smryResinReport($month,$year);
+ $data['givenMonth'] = $month;
+ $data['givenYear'] = $year;
+
+ }
+ $data['finyear'] = $this->dahsboard_Model->stockFinancialYear();
+
+ $this->loadviews("Report_smryResinReport", $this->global, $data, NULL);
+ }
+
+
+
+
+
+
+
+
+
+
+
}
diff --git a/app/Models/Dashboard_model.php b/app/Models/Dashboard_model.php
index 191deca4..0e9fb889 100755
--- a/app/Models/Dashboard_model.php
+++ b/app/Models/Dashboard_model.php
@@ -2,10 +2,27 @@
namespace App\Models;
+use App\Models\Rawmaterialdetails_model;
+
+use App\Models\Inwardgateregister_model;
+
use CodeIgniter\Model;
class Dashboard_model extends Model
{
+
+
+ protected $rawMaterialDetails;
+
+ protected $inwardgateregister;
+
+ public function __construct(){
+ parent::__construct();
+ $this->rawMaterialDetails = new Rawmaterialdetails_model();
+ $this->inwardgateregister = new Inwardgateregister_model();
+ }
+
+
function getUserCount()
{
@@ -3058,4 +3075,168 @@ function daybeforetotal($yesterday){
$query = $this->db->query($sql);
return $query->getResult();
}
+
+ function stockFinancialYear(){
+
+ $financialYear = ['2025','2026'];
+ return $financialYear;
+ }
+
+ function smrySilicaSandReport($month,$year){
+
+ $monthNum = date('m', strtotime($month));
+ $startDate = $year . "-" . $monthNum . "-01";
+ $endDate = $year . "-" . $monthNum . "-" . date('t', strtotime($startDate));
+
+ $sql = "";
+
+ $materialCodes = $this->rawMaterialDetails->getAllSilicaRawMaterialCode();
+
+ $supplierWiseSilicaSand = $this->inwardgateregister->findIgrDetailsForSandReport($materialCodes, $startDate, "noRemark");
+
+ dd($supplierWiseSilicaSand);
+
+ $query = $this->db->query($sql);
+
+ $result = $query->getResult();
+
+ dd($this->db->getLastQuery());
+
+ return $result;
+
+ }
+
+ function smryWasteCoreSandReport($month,$year){
+
+ $sql = "";
+
+ $query = $this->db->query($sql);
+
+ $result = $query->getResult();
+
+ dd($this->db->getLastQuery());
+
+ return $result;
+
+ }
+
+ function smryDustQtyReport($month,$year){
+
+ $sql = "";
+
+ $query = $this->db->query($sql);
+
+ $result = $query->getResult();
+
+ dd($this->db->getLastQuery());
+
+ return $result;
+
+ }
+
+ function smryCoatedSandReport($month,$year){
+
+ $sql = "";
+
+ $query = $this->db->query($sql);
+
+ $result = $query->getResult();
+
+ dd($this->db->getLastQuery());
+
+ return $result;
+
+ }
+
+
+ function smryPackingMaterialReport($month, $year) {
+
+ $monthNum = date('m', strtotime($month));
+ $startDate = $year . "-" . $monthNum . "-01";
+ $endDate = $year . "-" . $monthNum . "-" . date('t', strtotime($startDate));
+
+ $sql = "SELECT
+ GROUP_CONCAT(DISTINCT ts.SupplierName) as supplierName,
+ tmm.MaterialName,
+ tbg.customer,
+ SUM(CASE WHEN date = '$startDate' THEN opening ELSE 0 END) as opening,
+ SUM(receipt) as purchase,
+ SUM(CASE WHEN date = '$startDate' THEN opening ELSE 0 END) + SUM(receipt) as total,
+ SUM(used) as used,
+ SUM(CASE WHEN date = '$startDate' THEN opening ELSE 0 END) + SUM(receipt) - SUM(used) as closing
+ FROM t_bagstockdetails tbg
+ INNER JOIN t_materialmaster tmm ON tmm.MaterialCode = tbg.materialCode
+ INNER JOIN t_igr_details tigrd ON tigrd.MaterialCode = tbg.materialCode AND Date(tigrd.CreatedDate) >= '$startDate' AND Date(tigrd.CreatedDate) <= '$endDate'
+ INNER JOIN t_igr_master tigrm ON tigrd.IGRNO = tigrm.IGRNO
+ INNER JOIN t_purchaseorder_master tpom ON tpom.PONO = tigrm.PONO
+ INNER JOIN t_supplierdetailsn ts ON ts.SupplierID = tpom.SupplierID
+ WHERE date >= '$startDate' AND date <= '$endDate'
+ GROUP BY tbg.materialCode, tmm.MaterialName, tbg.customer";
+
+ $query = $this->db->query($sql);
+ $result = $query->getResultArray();
+
+ return $result;
+ }
+
+
+ function smryDieselReport($month,$year){
+
+ $sql = "";
+
+ $query = $this->db->query($sql);
+
+ $result = $query->getResult();
+
+ dd($this->db->getLastQuery());
+
+ return $result;
+ }
+
+ function smryGasReport($month,$year){
+
+ $sql = "";
+
+ $query = $this->db->query($sql);
+
+ $result = $query->getResult();
+
+ dd($result);
+
+ return $result;
+ }
+
+ function smryResinReport($month,$year){
+ $monthNum = date('m', strtotime($month));
+ $startDate = $year . "-" . $monthNum . "-01";
+ $endDate = $year . "-" . $monthNum . "-" . date('t', strtotime($startDate));
+
+ $sql = "SELECT
+ GROUP_CONCAT(DISTINCT ts.SupplierName) as supplierName,
+ tmm.MaterialName,
+ SUM(CASE WHEN date = '$startDate' THEN opening ELSE 0 END) as opening,
+ SUM(receipt) as purchase,
+ SUM(CASE WHEN date = '$startDate' THEN opening ELSE 0 END) + SUM(receipt) as total,
+ SUM(used) as used,
+ SUM(CASE WHEN date = '$startDate' THEN opening ELSE 0 END) + SUM(receipt) - SUM(used) as closing
+ FROM t_resinStockDetails tbg
+ INNER JOIN t_materialmaster tmm ON tmm.MaterialCode = tbg.materialCode
+ INNER JOIN t_igr_details tigrd ON tigrd.MaterialCode = tbg.materialCode AND Date(tigrd.CreatedDate) >= '$startDate' AND Date(tigrd.CreatedDate) <= '$endDate'
+ INNER JOIN t_igr_master tigrm ON tigrd.IGRNO = tigrm.IGRNO
+ INNER JOIN t_purchaseorder_master tpom ON tpom.PONO = tigrm.PONO
+ INNER JOIN t_supplierdetailsn ts ON ts.SupplierID = tpom.SupplierID
+ WHERE tbg.date >= '$startDate' AND tbg.date <= '$endDate'
+ GROUP BY tbg.materialCode, tmm.MaterialName, tbg.customer";
+
+ $query = $this->db->query($sql);
+ $result = $query->getResultArray();
+
+
+ return $result;
+
+ }
+
+
+
+
}
\ No newline at end of file
diff --git a/app/Models/Inwardgateregister_model.php b/app/Models/Inwardgateregister_model.php
index b42b979c..2a37d7b7 100755
--- a/app/Models/Inwardgateregister_model.php
+++ b/app/Models/Inwardgateregister_model.php
@@ -1229,8 +1229,10 @@ class Inwardgateregister_model extends Model
public function findIgrDetailsForIncomingSilicaSand($materialCodes, $month, $remark)
{
+
+ // dd($month); //2025-03
- $month = new \DateTime($month . "-01"); // Create DateTime for the first day of the month
+ $date = new \DateTime($month . "-01"); // Create DateTime for the first day of the month
$builder = $this->db->table('t_igr_details');
@@ -1257,8 +1259,8 @@ class Inwardgateregister_model extends Model
$builder->join('t_purchaseorder_master poMaster', 'poMaster.PONO = igrMast.PONO', 'left');
$builder->join('t_supplierdetailsn supplierDetails', 'supplierDetails.SupplierID = poMaster.SupplierID', 'left');
- $builder->where('Date(t_igr_details.CreatedDate) >=', $month->format('Y-m-01 00:00:00'));
- $builder->where('Date(t_igr_details.CreatedDate) <=', $month->format('Y-m-t 23:59:59'));
+ $builder->where('Date(t_igr_details.CreatedDate) >=', $date->format('Y-m-01 00:00:00'));
+ $builder->where('Date(t_igr_details.CreatedDate) <=', $date->format('Y-m-t 23:59:59'));
$builder->whereIn('t_igr_details.MaterialCode', $materialCodes);
$builder->where('t_igr_details.QuantityAsPerInvoice <>', 0);
@@ -1278,6 +1280,56 @@ class Inwardgateregister_model extends Model
}
+ public function findIgrDetailsForSandReport($materialCodes, $date, $remark)
+ {
+
+ $date = new \DateTime('2025-02-01');
+
+
+
+ $builder = $this->db->table('t_igr_details');
+
+
+ $builder->select(
+ '
+ supplierDetails.SupplierName,
+ cd.ConfigValue as sandType,
+ FORMAT(SUM(t_igr_details.QuantityAsPerInvoice), 2) as Qty,
+ FORMAT(SUM(issd.sieveLossQty), 2) as SieveLossQty,
+ FORMAT(SUM(issd.salableQty), 2) as salableQty
+ '
+ );
+
+
+
+ $builder->join('t_igr_master igrMast', 'igrMast.IGRNO = t_igr_details.IGRNO');
+ $builder->join('t_incomingsilicasanddetails issd', 'issd.igrNo_fk = t_igr_details.IGRNO AND issd.materialCode = t_igr_details.MaterialCode', 'left');
+ $builder->join('t_materialmaster materialMaster', 'materialMaster.MaterialCode = t_igr_details.MaterialCode');
+ $builder->join('t_configdetails cd', 'cd.key = materialMaster.Category', 'left');
+ $builder->join('t_purchaseorder_master poMaster', 'poMaster.PONO = igrMast.PONO', 'left');
+ $builder->join('t_supplierdetailsn supplierDetails', 'supplierDetails.SupplierID = poMaster.SupplierID', 'left');
+
+ $builder->where('Date(t_igr_details.CreatedDate) >=', $date->format('Y-m-01 00:00:00'));
+ $builder->where('Date(t_igr_details.CreatedDate) <=', $date->format('Y-m-t 23:59:59'));
+ $builder->whereIn('t_igr_details.MaterialCode', $materialCodes);
+ $builder->where('t_igr_details.QuantityAsPerInvoice <>', 0);
+
+ // Conditional WHERE clause for remark
+ if ($remark != "noRemark") {
+ $builder->where('issd.remark', $remark);
+ }
+
+
+ $builder->groupBy('supplierDetails.SupplierName');
+
+ $builder->orderBy('t_igr_details.CreatedDate', 'asc ');
+
+ $query = $builder->get();
+
+ return $query->getResultArray();
+
+ }
+
public function getHistoryDetailsforEmail($igr)
{
$date = date('Y-m-d H:i:s');
diff --git a/app/Views/Report_smryCoatedSandReport.php b/app/Views/Report_smryCoatedSandReport.php
new file mode 100644
index 00000000..09851c4e
--- /dev/null
+++ b/app/Views/Report_smryCoatedSandReport.php
@@ -0,0 +1,201 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | S.No |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Report_smryDieselReport.php b/app/Views/Report_smryDieselReport.php
new file mode 100644
index 00000000..b43982a7
--- /dev/null
+++ b/app/Views/Report_smryDieselReport.php
@@ -0,0 +1,201 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | S.No |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Report_smryDustQtyReport.php b/app/Views/Report_smryDustQtyReport.php
new file mode 100644
index 00000000..cfa6a34b
--- /dev/null
+++ b/app/Views/Report_smryDustQtyReport.php
@@ -0,0 +1,201 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | S.No |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Report_smryGasReport.php b/app/Views/Report_smryGasReport.php
new file mode 100644
index 00000000..38088783
--- /dev/null
+++ b/app/Views/Report_smryGasReport.php
@@ -0,0 +1,201 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | S.No |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Report_smryPackingMaterialReport.php b/app/Views/Report_smryPackingMaterialReport.php
new file mode 100644
index 00000000..738b424a
--- /dev/null
+++ b/app/Views/Report_smryPackingMaterialReport.php
@@ -0,0 +1,225 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | SupplierName |
+ MaterialName |
+ Customer |
+ Opening Qty(No's) |
+ Purchase Qty(No's) |
+ Total Qty(No's) |
+ Used Qty(No's) |
+ Closing Qty(No's) |
+
+
+
+
+
+ | = $report['supplierName'] ?> |
+ = $report['MaterialName'] ?> |
+ = $report['customer'] ?> |
+ = $report['opening'] ?> |
+ = $report['purchase'] ?> |
+ = $report['total'] ?> |
+ = $report['used'] ?> |
+ = $report['closing'] ?> |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Report_smryResinReport.php b/app/Views/Report_smryResinReport.php
new file mode 100644
index 00000000..3e3bc175
--- /dev/null
+++ b/app/Views/Report_smryResinReport.php
@@ -0,0 +1,220 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | SupplierName |
+ Type |
+ Opening Qty(Kgs) |
+ Purchase Qty(Kgs) |
+ Total Qty(Kgs) |
+ Used Qty(Kgs) |
+ Closing Qty(Kgs) |
+
+
+
+
+
+ | = $report['supplierName'] ?> |
+ = $report['MaterialName'] ?> |
+ = $report['opening'] ?> |
+ = $report['purchase'] ?> |
+ = $report['total'] ?> |
+ = $report['used'] ?> |
+ = $report['closing'] ?> |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Report_smrySilicaSandReport.php b/app/Views/Report_smrySilicaSandReport.php
new file mode 100644
index 00000000..725d60dc
--- /dev/null
+++ b/app/Views/Report_smrySilicaSandReport.php
@@ -0,0 +1,201 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | S.No |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Report_smryWasteCoreSandReport.php b/app/Views/Report_smryWasteCoreSandReport.php
new file mode 100644
index 00000000..68a3d699
--- /dev/null
+++ b/app/Views/Report_smryWasteCoreSandReport.php
@@ -0,0 +1,201 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | S.No |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/employeeListing.php b/app/Views/employeeListing.php
index bdf32fc3..81d5111b 100755
--- a/app/Views/employeeListing.php
+++ b/app/Views/employeeListing.php
@@ -139,7 +139,7 @@
$cdate = date('d-m-Y', strtotime($record->Created_date));
} ?>
- EmpID ?>
+ EmpID ?>
@@ -238,6 +238,17 @@
}
});
+ $('#datatable').on('click', '.edit-btn', function () {
+ const pageInfo = table.page.info(); // Now this works
+ sessionStorage.setItem("datatablePage", pageInfo.page);
+ });
+
+ // Restore page
+ let startPage = sessionStorage.getItem("datatablePage");
+ if (startPage !== null) {
+ table.page(parseInt(startPage)).draw('page');
+ sessionStorage.removeItem("datatablePage");
+ }
// Handle form submission
$("#DateRangeFilter").submit(function(e) {
diff --git a/app/Views/reportslink.php b/app/Views/reportslink.php
index ca030c4e..49dbf006 100644
--- a/app/Views/reportslink.php
+++ b/app/Views/reportslink.php
@@ -92,6 +92,22 @@
Leave Report
+
+
+
|