diff --git a/app/Controllers/Rawmaterialdetails.php b/app/Controllers/Rawmaterialdetails.php index 0d3ebff8..990f37ef 100755 --- a/app/Controllers/Rawmaterialdetails.php +++ b/app/Controllers/Rawmaterialdetails.php @@ -289,6 +289,7 @@ class Rawmaterialdetails extends BaseController $data['assetcode'] = $this->rawmaterialdetails_model->getAssetcode(); $data['avg_price'] = $this->rawmaterialdetails_model->getMaterialAvg($RawMaterialID); $data['materialRateHistory'] = $this->rawmaterialdetails_model->getMaterialRateHistory($RawMaterialID); + $data['materialListPage'] = $_GET['page']; //print_r($data['avg_price']);die(); $this->global['pageTitle'] = 'Edit Material Master'; @@ -317,6 +318,7 @@ class Rawmaterialdetails extends BaseController $stock = $this->request->getPost('openstock'); $reorder = $this->request->getPost('reorder'); $stockdate = $this->request->getPost('Date'); + $materialListPage = $this->request->getPost('materialListPage'); $stockdate = (empty($stockdate)) ? NULL : get_date_time_dynamical_format('d-m-Y','Y-m-d',"$stockdate"); $chked = $this->request->getPost('isactive'); @@ -329,11 +331,15 @@ class Rawmaterialdetails extends BaseController $result = $this->rawmaterialdetails_model->editRawmaterial($RawMaterial, $MaterialCode); - if ($result == true) { + if ($result == true) { $this->session->setFlashdata('success', 'RawMaterial Updated successfully!'); + $this->session->setFlashdata('materialListPage', "$materialListPage"); + } else { echo ""; $this->session->setFlashdata('error', 'RawMaterial Record Not updated!'); + $this->session->setFlashdata('materialListPage', "$materialListPage"); + } return redirect()->route('rawmaterialListing'); diff --git a/app/Models/Inwardgateregister_model.php b/app/Models/Inwardgateregister_model.php index dfda37a3..c162bb3a 100755 --- a/app/Models/Inwardgateregister_model.php +++ b/app/Models/Inwardgateregister_model.php @@ -6,7 +6,7 @@ use CodeIgniter\Model; class Inwardgateregister_model extends Model { - + function updatefile($bill, $Picture, $oldfile) { @@ -21,9 +21,10 @@ class Inwardgateregister_model extends Model $afftectedRows = $this->db->affectedRows(); return $afftectedRows; } - function getAdditionalIGRFile($igr){ + function getAdditionalIGRFile($igr) + { $builder = $this->db->table('t_inwardgateregister_fileupload')->select('*') - ->where('IGRNO', $igr); + ->where('IGRNO', $igr); $query = $builder->get(); return $query->getResult(); } @@ -40,12 +41,12 @@ class Inwardgateregister_model extends Model { $arr = array('Isactive' => 0); $this->db->table('t_inwardgateregister_fileupload') - ->where('BillNo', $fileid) - ->update($arr); + ->where('BillNo', $fileid) + ->update($arr); $aff = $this->db->affectedRows(); return $aff > 0 ? true : false; } - + /*------------------------------------------------------------*/ function addMaterialStockHistory($MaterialstockHistoryadd) @@ -86,7 +87,7 @@ class Inwardgateregister_model extends Model ->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO') ->join('t_inwardgateregister_fileupload fileup', ' igr.IGRNO = fileup.IGRNO', 'left') ->join('t_supplierdetailsn` sup', 'PO.SupplierID = sup.SupplierID') - ->orderBy('igr.IGRID','desc') + ->orderBy('igr.IGRID', 'desc') ->groupBy('igr.IGRNO', 'desc'); $query = $builder->get(); $result = $query->getResult(); @@ -136,10 +137,10 @@ class Inwardgateregister_model extends Model ->join('t_ogr_master OGM ', 'POM.PONO = OGM.PONO_INV', 'left') // ->where('POM.POType !=', SERVICE) // due to client requirements - he wants to remove the conidition. ->where('POM.Status', PO_RELEASED) - ->orWhere('POM.Status',REQITEM_Emergency_PO_CREATED) - ->orWhere('POM.Status',IGR_CREATED) - ->orWhere('POM.Status', IGR_DRAFT ) - ->where( 'POM.IsOpenOrder', 1) + ->orWhere('POM.Status', REQITEM_Emergency_PO_CREATED) + ->orWhere('POM.Status', IGR_CREATED) + ->orWhere('POM.Status', IGR_DRAFT) + ->where('POM.IsOpenOrder', 1) ->orWhere('POM.Status', MRIR_CREATED) ->orWhere('POM.Status', MRIR_APPROVED) ->orWhere('POM.Status', OGR_COMPLETE) @@ -169,25 +170,26 @@ class Inwardgateregister_model extends Model return $temp; } - public function checkdriverMobile($mobile,$driverName) { + public function checkdriverMobile($mobile, $driverName) + { $builder = $this->db->table('t_igr_master') ->distinct() ->select('DriverMobileNumber') ->like('DriverMobileNumber', $mobile); - if($driverName){ - $builder->where('DriverName', $driverName); - } - + if ($driverName) { + $builder->where('DriverName', $driverName); + } - $query = $builder->get(); - $temparr[] = ''; - foreach ($query->getResult() as $arr) { - $temparr[] = $arr->DriverMobileNumber; - } - // echo $this->db->getLastQuery()->getQuery();die; - $temp['suggestions'] = $temparr; - - return $temp; + + $query = $builder->get(); + $temparr[] = ''; + foreach ($query->getResult() as $arr) { + $temparr[] = $arr->DriverMobileNumber; + } + // echo $this->db->getLastQuery()->getQuery();die; + $temp['suggestions'] = $temparr; + + return $temp; } function viewpurchaseorder($PO) @@ -205,7 +207,7 @@ class Inwardgateregister_model extends Model $query = $this->db->query($subQuery, [$PO]); - + return $query->getResult(); /* @@ -219,49 +221,52 @@ class Inwardgateregister_model extends Model $result = $query->getResult(); return $result; */ } - - public function igr_history($hsty_arr) { - - $keysToRemove = ["UpdateBY","UpdateBy", "MaterialRcvdDate", "DeliveryChellanDate"]; - + + public function igr_history($hsty_arr) + { + + $keysToRemove = ["UpdateBY", "UpdateBy", "MaterialRcvdDate", "DeliveryChellanDate"]; + foreach ($keysToRemove as $key) { if (isset($hsty_arr[$key])) { unset($hsty_arr[$key]); } } - + $builder = $this->db->table('t_igr_history'); $builder->insert($hsty_arr); return $this->db->insertID(); } - function get_igr_history($col,$IGR,$IGRITEM = null) + function get_igr_history($col, $IGR, $IGRITEM = null) { $builder = $this->db->table('t_igr_history Hist') - ->select("Hist.*") - ->where('Hist.field', $col); + ->select("Hist.*") + ->where('Hist.field', $col); - if ($IGR) { - $builder->where('Hist.IGR_No', $IGR); - } + if ($IGR) { + $builder->where('Hist.IGR_No', $IGR); + } - if ($IGRITEM !== null) { - $builder->where('Hist.IGRItem_No', $IGRITEM); - } + if ($IGRITEM !== null) { + $builder->where('Hist.IGRItem_No', $IGRITEM); + } - $builder->orderBy('Hist.history_dated', 'DESC'); - $builder->limit(1); - $query = $builder->get(); - $result = $query->getRow(); - return $result; + $builder->orderBy('Hist.history_dated', 'DESC'); + $builder->limit(1); + $query = $builder->get(); + $result = $query->getRow(); + return $result; } - function get_igr_master_for_history($igr_no) { + function get_igr_master_for_history($igr_no) + { return $this->db->table('t_igr_master Master')->where('Master.IGRNO', $igr_no)->get()->getRow(); } - - function get_igr_child_for_history($igr_no, $igr_item_no) { + + function get_igr_child_for_history($igr_no, $igr_item_no) + { $builder = $this->db->table('t_igr_details Child'); // Select only the required field if ($igr_no) { $builder->where('Child.IGRNO', $igr_no); @@ -293,34 +298,34 @@ class Inwardgateregister_model extends Model $result = []; if ($YesIAmAffected > 0) { $result = $this->db->table('t_igr_master') - ->select('IGRNO') - ->orderBy('CreatedDate', 'desc') - ->get() - ->getRow(); + ->select('IGRNO') + ->orderBy('CreatedDate', 'desc') + ->get() + ->getRow(); // $result->IGRNO; } $igrno = ($YesIAmAffected && !empty($result)) ? $result->IGRNO : ''; - return $igrno; - } + return $igrno; + } function addigrD($igrD) { $this->db->transStart(); - $builder = $this->db->table('t_igr_details'); + $builder = $this->db->table('t_igr_details'); $builder->insert($igrD); - $aff_row = $this->db->affectedRows(); - log_message('error', 'addigrD Query: ' . $this->db->getLastQuery()->getQuery()); - $this->db->transComplete(); - + $aff_row = $this->db->affectedRows(); + log_message('error', 'addigrD Query: ' . $this->db->getLastQuery()->getQuery()); + $this->db->transComplete(); + $result = $this->db->table('t_igr_details') - ->select('IGRItemNo') - ->orderBy('CreatedDate', 'desc') - ->get() - ->getRow(); + ->select('IGRItemNo') + ->orderBy('CreatedDate', 'desc') + ->get() + ->getRow(); $res = ($aff_row > 0) ? $result->IGRItemNo : 0; - return $res; + return $res; } @@ -371,40 +376,40 @@ class Inwardgateregister_model extends Model return $result; } function ViewigrListing_old() - { + { - // $builder = $this->db->table('t_igr_master igr') - // ->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName') - // ->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO') - // ->join('t_supplierdetailsn` sup', 'PO.SupplierID = sup.SupplierID') + // $builder = $this->db->table('t_igr_master igr') + // ->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName') + // ->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO') + // ->join('t_supplierdetailsn` sup', 'PO.SupplierID = sup.SupplierID') // ->join('t_transporter` trans', 'igr.TransporterId = trans.id' , 'left') - // ->where('igr.IGRStatus !=', MRIR_CREATED) + // ->where('igr.IGRStatus !=', MRIR_CREATED) // ->orderBy('igr.CreatedDate', 'desc'); $builder = $this->db->table('t_igr_details igr_details') - ->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName,item.MaterialName, igr_details.QuantityAsPerInvoice as ReceivedQuantity , igr_details.NetWeight as NetWeight') + ->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName,item.MaterialName, igr_details.QuantityAsPerInvoice as ReceivedQuantity , igr_details.NetWeight as NetWeight') ->join('t_igr_master igr', 'igr_details.IGRNo = igr.IGRNo') - ->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO') - ->join('t_supplierdetailsn` sup', 'PO.SupplierID = sup.SupplierID') - ->join('t_transporter` trans', 'igr.TransporterId = trans.id' , 'left') - ->join('t_materialmaster` item', 'igr_details.MaterialCode = item.MaterialCode' , 'left') - ->where('igr.IGRStatus !=', MRIR_CREATED) + ->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO') + ->join('t_supplierdetailsn` sup', 'PO.SupplierID = sup.SupplierID') + ->join('t_transporter` trans', 'igr.TransporterId = trans.id', 'left') + ->join('t_materialmaster` item', 'igr_details.MaterialCode = item.MaterialCode', 'left') + ->where('igr.IGRStatus !=', MRIR_CREATED) ->orderBy('igr.CreatedDate', 'desc'); - $query = $builder->get(); - $result = $query->getResult(); + $query = $builder->get(); + $result = $query->getResult(); + - // echo $this->db->getLastQuery()->getQuery();die; - return $result; - } + return $result; + } - function ViewigrListing($fromDate,$toDate) - { + function ViewigrListing($fromDate, $toDate) + { $subQuery1 = $this->db->table('t_igr_remarkes') - ->select('COUNT(id)') - ->where('igr_no = igr.IGRNo') - ->getCompiledSelect(); + ->select('COUNT(id)') + ->where('igr_no = igr.IGRNo') + ->getCompiledSelect(); // Build subQuery2 dynamically for rate and tax based on POType $subQuery2 = "(CASE @@ -453,31 +458,30 @@ class Inwardgateregister_model extends Model ->join('t_igr_details IGRD', 'igr.IGRNo = IGRD.IGRNo') ->where('igr.IGRStatus !=', MRIR_CREATED) ->groupBy('IGRD.IGRNo'); - if(session()->get('roleText') == 'Auditor'){ + if (session()->get('roleText') == 'Auditor') { - $builder->where('Date(igr.DeliveryChellanDate) >=', "$fromDate") - ->where('Date(igr.DeliveryChellanDate) <=', "$toDate") - ->orderBy('igr.DeliveryChellanDate', 'desc'); - }else{ - $builder->where('Date(igr.CreatedDate) >=', "$fromDate") - ->where('Date(igr.CreatedDate) <=', "$toDate") - ->orderBy('igr.CreatedDate', 'desc'); + $builder->where('Date(igr.DeliveryChellanDate) >=', "$fromDate") + ->where('Date(igr.DeliveryChellanDate) <=', "$toDate") + ->orderBy('igr.DeliveryChellanDate', 'desc'); + } else { + $builder->where('Date(igr.CreatedDate) >=', "$fromDate") + ->where('Date(igr.CreatedDate) <=', "$toDate") + ->orderBy('igr.CreatedDate', 'desc'); + } - } - - - - $query = $builder->get(); + + + $query = $builder->get(); $result = $query->getResult(); - // echo $this->db->getLastQuery()->getQuery();die; - // dd($result); + // echo $this->db->getLastQuery()->getQuery();die; + // dd($result); - // old - issue in t_igr_remarkes join + // old - issue in t_igr_remarkes join // $builder = $this->db->table('t_igr_master igr') // ->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName , SUM(IGRD.QuantityAsPerInvoice) as ReceivedQuantity, SUM(IGRD.NetWeight) as NetWeight , count(IGRD.IGRNo) as itemCount , count(remark.id) as remark_count') // ->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO') @@ -498,59 +502,59 @@ class Inwardgateregister_model extends Model // $builder2 = $this->db->table('t_igr_details igr_details') - // ->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName,item.MaterialName, igr_details.QuantityAsPerInvoice as ReceivedQuantity , igr_details.NetWeight as NetWeight') + // ->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName,item.MaterialName, igr_details.QuantityAsPerInvoice as ReceivedQuantity , igr_details.NetWeight as NetWeight') // ->join('t_igr_master igr', 'igr_details.IGRNo = igr.IGRNo') - // ->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO') - // ->join('t_supplierdetailsn sup', 'PO.SupplierID = sup.SupplierID') + // ->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO') + // ->join('t_supplierdetailsn sup', 'PO.SupplierID = sup.SupplierID') // ->join('t_transporter trans', 'igr.TransporterId = trans.id' , 'left') // ->join('t_materialmaster` item', 'igr_details.MaterialCode = item.MaterialCode' , 'left') - // ->where('igr.IGRStatus !=', MRIR_CREATED) + // ->where('igr.IGRStatus !=', MRIR_CREATED) // ->orderBy('igr.CreatedDate', 'desc'); // $query2 = $builder2->get(); // $result2 = $query2->getResult(); // echo $this->db->getLastQuery()->getQuery();die; - return [$result,[]]; - } + return [$result, []]; + } - function customViewigrListing($fromDate,$toDate) - { + function customViewigrListing($fromDate, $toDate) + { - $builder = $this->db->table('t_igr_master igr') - ->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName , SUM(IGRD.QuantityAsPerInvoice) as ReceivedQuantity, SUM(IGRD.NetWeight) as NetWeight , count(IGRD.IGRNo) as itemCount') - ->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO') - ->join('t_supplierdetailsn sup', 'PO.SupplierID = sup.SupplierID') - ->join('t_transporter trans', 'igr.TransporterId = trans.id' , 'left') + $builder = $this->db->table('t_igr_master igr') + ->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName , SUM(IGRD.QuantityAsPerInvoice) as ReceivedQuantity, SUM(IGRD.NetWeight) as NetWeight , count(IGRD.IGRNo) as itemCount') + ->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO') + ->join('t_supplierdetailsn sup', 'PO.SupplierID = sup.SupplierID') + ->join('t_transporter trans', 'igr.TransporterId = trans.id', 'left') ->join('t_igr_details IGRD', 'igr.IGRNo = IGRD.IGRNo') - ->where('igr.IGRStatus !=', MRIR_CREATED) + ->where('igr.IGRStatus !=', MRIR_CREATED) ->groupStart() ->where('Date(igr.CreatedDate) >=', $fromDate) ->orWhere('Date(igr.UpdatedOn) >=', $fromDate) ->groupEnd() ->groupStart() - ->where('Date(igr.CreatedDate) <=', $toDate) - ->orWhere('Date(igr.UpdatedOn) <=', $toDate) + ->where('Date(igr.CreatedDate) <=', $toDate) + ->orWhere('Date(igr.UpdatedOn) <=', $toDate) ->groupEnd() ->groupBy('igr.IGRNo') - ->orderBy('igr.CreatedDate', 'desc'); - $query = $builder->get(); - $result = $query->getResult(); + ->orderBy('igr.CreatedDate', 'desc'); + $query = $builder->get(); + $result = $query->getResult(); $builder2 = $this->db->table('t_igr_details igr_details') - ->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName,item.MaterialName, igr_details.QuantityAsPerInvoice as ReceivedQuantity , igr_details.NetWeight as NetWeight') + ->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName,item.MaterialName, igr_details.QuantityAsPerInvoice as ReceivedQuantity , igr_details.NetWeight as NetWeight') ->join('t_igr_master igr', 'igr_details.IGRNo = igr.IGRNo') - ->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO') - ->join('t_supplierdetailsn sup', 'PO.SupplierID = sup.SupplierID') - ->join('t_transporter trans', 'igr.TransporterId = trans.id' , 'left') - ->join('t_materialmaster` item', 'igr_details.MaterialCode = item.MaterialCode' , 'left') - ->where('igr.IGRStatus !=', MRIR_CREATED) + ->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO') + ->join('t_supplierdetailsn sup', 'PO.SupplierID = sup.SupplierID') + ->join('t_transporter trans', 'igr.TransporterId = trans.id', 'left') + ->join('t_materialmaster` item', 'igr_details.MaterialCode = item.MaterialCode', 'left') + ->where('igr.IGRStatus !=', MRIR_CREATED) ->orderBy('igr.CreatedDate', 'desc'); - $query2 = $builder2->get(); - $result2 = $query2->getResult(); + $query2 = $builder2->get(); + $result2 = $query2->getResult(); // echo $this->db->getLastQuery()->getQuery();die; - return [$result,$result2]; - } - + return [$result, $result2]; + } + function viewigr($IGRNO) @@ -559,7 +563,7 @@ class Inwardgateregister_model extends Model // ->select('igrd.IGRItemNo','igrd.IGRNO','igrd.MaterialCode','igrd.QuantityAsPerInvoice') // ->select('igrd.Remarks','igrd.IGRItemStatus','igrd.CancelNote','igrd.BankStatus') // ->select('MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity,POM.POType') - + $builder = $this->db->table('t_igr_master igr') ->distinct() ->select(" @@ -579,10 +583,10 @@ class Inwardgateregister_model extends Model ->join('t_purchaseorder_lineitem POL', 'igr.PONO = POL.PONO and POL.MaterialCode=igrd.MaterialCode ') ->join('t_supplierdetailsn sup', 'sup.SupplierID = POM.SupplierID') ->join('t_materialmaster MM', 'MM.MaterialCode = igrd.MaterialCode') - ->join('t_service_tax st', 'st.LineItemNo = POL.LineItemNo' , 'left') - ->join('t_revenue_tax rt', 'rt.LineItemNo = POL.LineItemNo' , 'left') - ->join('t_import_tax it', 'it.LineItemNo = POL.LineItemNo' , 'left') - ->join('t_configdetails cd','cd.key = MM.Category','left') + ->join('t_service_tax st', 'st.LineItemNo = POL.LineItemNo', 'left') + ->join('t_revenue_tax rt', 'rt.LineItemNo = POL.LineItemNo', 'left') + ->join('t_import_tax it', 'it.LineItemNo = POL.LineItemNo', 'left') + ->join('t_configdetails cd', 'cd.key = MM.Category', 'left') ->where('igr.IGRNO', $IGRNO); $query = $builder->get(); @@ -637,7 +641,7 @@ class Inwardgateregister_model extends Model } } - function UpdatePOMaster($PONO, $updatedBy,$IGRStatus) + function UpdatePOMaster($PONO, $updatedBy, $IGRStatus) { $builder = $this->db->table('t_purchaseorder_lineitem')->select('*') @@ -969,16 +973,16 @@ class Inwardgateregister_model extends Model // $query = $this->db->query($subQuery); // return $query->getResult(); $result = $this->db->table('t_ogr_master') - ->select('OGRNO') - ->orderBy('CreatedOn', 'desc') - ->get() - ->getRow(); + ->select('OGRNO') + ->orderBy('CreatedOn', 'desc') + ->get() + ->getRow(); $OGRNO = ($aff_row && $result !== null) ? $result->OGRNO : 0; - return $OGRNO; + return $OGRNO; } } - + @@ -1073,7 +1077,8 @@ class Inwardgateregister_model extends Model $r = $this->db->affectedRows(); return $r; } - function updateIGRLineItem($igrlineitemarr, $IGRitemNo){ + function updateIGRLineItem($igrlineitemarr, $IGRitemNo) + { $this->db->table('t_igr_details') ->where('IGRItemNo', $IGRitemNo) ->update($igrlineitemarr); @@ -1112,133 +1117,144 @@ class Inwardgateregister_model extends Model } public function ViewIGRHistory($igr) - { - $builder = $this->db->table('t_igr_history'); - - $builder->select('t_igr_history.*, DATE_FORMAT(t_igr_history.history_dated, "%d-%m-%Y") AS indian_date, DATE_FORMAT(t_igr_history.history_dated, "%h:%i:%s %p") AS indian_time, CONCAT_WS(" ", t_employee_details.FirstName, t_employee_details.LastName) AS FullName,t_materialmaster.MaterialName,t_materialmaster.MaterialName,t_materialmaster.MaterialCode'); - $builder->join('tbl_users', 'tbl_users.userId = t_igr_history.by', 'left'); - $builder->join('t_employee_details', 'tbl_users.EmpID = t_employee_details.EmpID', 'left'); + { + $builder = $this->db->table('t_igr_history'); + + $builder->select('t_igr_history.*, DATE_FORMAT(t_igr_history.history_dated, "%d-%m-%Y") AS indian_date, DATE_FORMAT(t_igr_history.history_dated, "%h:%i:%s %p") AS indian_time, CONCAT_WS(" ", t_employee_details.FirstName, t_employee_details.LastName) AS FullName,t_materialmaster.MaterialName,t_materialmaster.MaterialName,t_materialmaster.MaterialCode'); + $builder->join('tbl_users', 'tbl_users.userId = t_igr_history.by', 'left'); + $builder->join('t_employee_details', 'tbl_users.EmpID = t_employee_details.EmpID', 'left'); $builder->join('t_igr_details', 'CONVERT(t_igr_history.IGRItem_No USING utf8) = CONVERT(t_igr_details.IGRItemNo USING utf8)', 'left'); $builder->join('t_materialmaster', 'CONVERT(t_materialmaster.MaterialCode USING utf8) = CONVERT(t_igr_details.MaterialCode USING utf8)', 'left'); $builder->where('CONVERT(IGR_No USING utf8)', $igr); - $builder->orderBy('t_igr_history.history_dated', 'asc'); - // $builder->where('IGR_No', $igr); + $builder->orderBy('t_igr_history.history_dated', 'asc'); + // $builder->where('IGR_No', $igr); - $query = $builder->get(); - $result = $query->getResult(); + $query = $builder->get(); + $result = $query->getResult(); return $result; - - } + } public function isFileExistsInIGRmaster($filename) - { + { $result = $this->db->table('t_igr_master')->where('MasterFile', $filename); $query = $result->get(); return $query->getResult(); - } + } public function isFileExistsInIGRdetails($filename) - { + { $result = $this->db->table('t_igr_details')->where('WeightFile', $filename); $query = $result->get(); return $query->getResult(); - } + } public function getCostCenterData($pono) - { - $builder = $this->db->table('t_purchaseorder_lineitem'); - - $builder->select('t_purchaseorder_lineitem.ReqNo,reqMaster.CostCenterCode,CSMaster.CostCenterName'); + { + $builder = $this->db->table('t_purchaseorder_lineitem'); + + $builder->select('t_purchaseorder_lineitem.ReqNo,reqMaster.CostCenterCode,CSMaster.CostCenterName'); $builder->join('t_requestion_master reqMaster', 't_purchaseorder_lineitem.ReqNo = reqMaster.ReqNo', 'left'); $builder->join('t_costcenter_master CSMaster', 'reqMaster.CostCenterCode = CSMaster.CostCenterCode', 'left'); - $builder->where('PONO', $pono); + $builder->where('PONO', $pono); $builder->groupBy('t_purchaseorder_lineitem.ReqNo'); - $query = $builder->get(); - $result = $query->getResult(); + $query = $builder->get(); + $result = $query->getResult(); return $result; - - - } + } public function getAllIgrFileDetails($igrno) - { - - // Query 1: Get FilePath and Remarks from t_inwardgateregister_fileupload + { + + // Query 1: Get FilePath and Remarks from t_inwardgateregister_fileupload $builder1 = $this->db->table('t_inwardgateregister_fileupload IFU'); - $query1 = $builder1->select('IFU.FilePath as file, IFU.Remarks as filename') - ->where('IFU.IGRNO', $igrno) - ->where('IFU.Isactive', 1) - ->get(); - $result1 = $query1->getResult(); + $query1 = $builder1->select('IFU.FilePath as file, IFU.Remarks as filename') + ->where('IFU.IGRNO', $igrno) + ->where('IFU.Isactive', 1) + ->get(); + $result1 = $query1->getResult(); - // Query 2: Get MasterFile from t_igr_master - $builder2 = $this->db->table('t_igr_master IM'); - $query2 = $builder2->select('IM.MasterFile as file, IM.MasterFile as filename') - ->where('IM.IGRNO', $igrno) - ->where('IM.MasterFile IS NOT NULL') - ->get(); - $result2 = $query2->getResult(); + // Query 2: Get MasterFile from t_igr_master + $builder2 = $this->db->table('t_igr_master IM'); + $query2 = $builder2->select('IM.MasterFile as file, IM.MasterFile as filename') + ->where('IM.IGRNO', $igrno) + ->where('IM.MasterFile IS NOT NULL') + ->get(); + $result2 = $query2->getResult(); - // Query 3: Get WeightFile from t_igr_details - $builder3 = $this->db->table('t_igr_details ID'); - $query3 = $builder3->select('ID.WeightFile as file, ID.WeightFile as filename') - ->where('ID.IGRNO', $igrno) - ->where('ID.WeightFile IS NOT NULL') - ->get(); - $result3 = $query3->getResult(); + // Query 3: Get WeightFile from t_igr_details + $builder3 = $this->db->table('t_igr_details ID'); + $query3 = $builder3->select('ID.WeightFile as file, ID.WeightFile as filename') + ->where('ID.IGRNO', $igrno) + ->where('ID.WeightFile IS NOT NULL') + ->get(); + $result3 = $query3->getResult(); - // Merging results into a single array - $results = array_merge($result1, $result2, $result3); + // Merging results into a single array + $results = array_merge($result1, $result2, $result3); - return $results; - } + return $results; + } public function transporter() - { + { $builder = $this->db->table('t_transporter t'); - $query = $builder->select('t.*')->get(); - $result = $query->getResult(); + $query = $builder->select('t.*')->get(); + $result = $query->getResult(); return $result; } - public function findIgrDetailsForIncomingSilicaSand($materialCodes, $month ,$remark) - { - $builder = $this->db->table('t_igr_details') - ->select( - 't_igr_details.IGRNO, - t_igr_details.MaterialCode, - igrMast.DeliveryChellanOrInvoiceNo as invoiceNo, - igrMast.DeliveryChellanDate as invoiceDate, - igrMast.MaterialRcvdDate as materialRecievedDate, - igrMast.VehicleNo, - supplierDetails.SupplierName, - cd.ConfigValue as sandType , - t_igr_details.QuantityAsPerInvoice as Qty, - issd.*') - ->whereIn('t_igr_details.MaterialCode', $materialCodes) - ->where('t_igr_details.QuantityAsPerInvoice <>', 0) - ->like('t_igr_details.CreatedDate', $month, 'after'); - - // remark needed for those who selected any remark. - if ($remark != "noRemark") { - $builder->where('issd.remark', $remark); - } - - $builder->groupBy('t_igr_details.IGRNO, t_igr_details.MaterialCode') - ->join('t_igr_master igrMast', 'igrMast.IGRNO = t_igr_details.IGRNO') - ->join('t_incomingsilicasanddetails issd','issd.igrNo_fk = t_igr_details.IGRNO AND issd.materialCode = t_igr_details.MaterialCode','left') - ->join('t_materialmaster materialMaster', 'materialMaster.MaterialCode = t_igr_details.MaterialCode') - ->join('t_configdetails cd','cd.key = materialMaster.Category','left') - ->join('t_purchaseorder_master poMaster', 'poMaster.PONO = igrMast.PONO', 'left') - ->join('t_supplierdetailsn supplierDetails', 'supplierDetails.SupplierID = poMaster.SupplierID', 'left') - ->orderBy('t_igr_details.CreatedDate', 'asc '); + public function findIgrDetailsForIncomingSilicaSand($materialCodes, $month, $remark) + { - $query = $builder->get(); - $result = $query->getResultArray(); - - return $result; + $month = new \DateTime($month . "-01"); // Create DateTime for the first day of the month + + + $builder = $this->db->table('t_igr_details'); + + + $builder->select( + 't_igr_details.IGRNO, + t_igr_details.MaterialCode, + igrMast.DeliveryChellanOrInvoiceNo as invoiceNo, + igrMast.DeliveryChellanDate as invoiceDate, + igrMast.MaterialRcvdDate as materialRecievedDate, + igrMast.VehicleNo, + supplierDetails.SupplierName, + cd.ConfigValue as sandType, + t_igr_details.QuantityAsPerInvoice as Qty, + issd.*' + ); + + + $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) >=', $month->format('Y-m-01 00:00:00')); + $builder->where('Date(t_igr_details.CreatedDate) <=', $month->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('t_igr_details.IGRNO, t_igr_details.MaterialCode'); + + $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'); + public function getHistoryDetailsforEmail($igr) + { + $date = date('Y-m-d H:i:s'); $to = date('Y-m-d H:i:s', strtotime($date . ' +30 seconds')); $from = date('Y-m-d H:i:s', strtotime($date . ' -30 seconds')); @@ -1247,13 +1263,13 @@ class Inwardgateregister_model extends Model from t_igr_history LEFT JOIN tbl_users ON tbl_users.userId = t_igr_history.by LEFT JOIN t_employee_details ON tbl_users.EmpID = t_employee_details.EmpID - where is_add = 1 and IGR_No = '".$igr."'"); - $first_line = $query3->getRow(); - - // 392 po + where is_add = 1 and IGR_No = '" . $igr . "'"); + $first_line = $query3->getRow(); -$builder = $this->db->table('t_igr_history') - ->select(' + // 392 po + + $builder = $this->db->table('t_igr_history') + ->select(' t_igr_history.id, t_igr_history.field, t_igr_history.is_add, @@ -1288,118 +1304,126 @@ $builder = $this->db->table('t_igr_history') END AS old_data, t_igr_history.old_data as original_old_data,t_materialmaster.MaterialName,t_materialmaster.MaterialCode ') - // ->join('t_igr_details IGRD', 'IGRD.IGRItemNo = t_igr_history.IGRItem_No','left') - // ->join('t_materialmaster MM','MM.MaterialCode = IGRD.MaterialCode','left') - ->join('tbl_users', 'tbl_users.userId = t_igr_history.by','left') - ->join('t_employee_details','tbl_users.EmpID = t_employee_details.EmpID','left') - ->join('t_igr_details', 'CONVERT(t_igr_history.IGRItem_No USING utf8) = CONVERT(t_igr_details.IGRItemNo USING utf8)', 'left') - ->join('t_materialmaster', 'CONVERT(t_materialmaster.MaterialCode USING utf8) = CONVERT(t_igr_details.MaterialCode USING utf8)', 'left') - ->where('CONVERT(t_igr_history.IGR_No USING utf8)', $igr) - ->where('t_igr_history.is_edit', 1) - ->where('t_igr_history.history_dated BETWEEN "'.$from.'" AND "'.$to.'"'); + // ->join('t_igr_details IGRD', 'IGRD.IGRItemNo = t_igr_history.IGRItem_No','left') + // ->join('t_materialmaster MM','MM.MaterialCode = IGRD.MaterialCode','left') + ->join('tbl_users', 'tbl_users.userId = t_igr_history.by', 'left') + ->join('t_employee_details', 'tbl_users.EmpID = t_employee_details.EmpID', 'left') + ->join('t_igr_details', 'CONVERT(t_igr_history.IGRItem_No USING utf8) = CONVERT(t_igr_details.IGRItemNo USING utf8)', 'left') + ->join('t_materialmaster', 'CONVERT(t_materialmaster.MaterialCode USING utf8) = CONVERT(t_igr_details.MaterialCode USING utf8)', 'left') + ->where('CONVERT(t_igr_history.IGR_No USING utf8)', $igr) + ->where('t_igr_history.is_edit', 1) + ->where('t_igr_history.history_dated BETWEEN "' . $from . '" AND "' . $to . '"'); - $query = $builder->get(); - $result = $query->getResult(); + $query = $builder->get(); + $result = $query->getResult(); // echo $this->db->getLastQuery()->getQuery(); die; return [ 'history' => $result, - 'first_line' => $first_line ? $first_line->IGR_No ." was Created by ". $first_line->history_by ." on ". $first_line->indian_date ." at ". $first_line->indian_time : null, - ]; + 'first_line' => $first_line ? $first_line->IGR_No . " was Created by " . $first_line->history_by . " on " . $first_line->indian_date . " at " . $first_line->indian_time : null, + ]; } - public function getDetailsforEmail($userId,$roleId) - { + public function getDetailsforEmail($userId, $roleId) + { $query0 = $this->db->query(" SELECT CompanyName,EmailAddress FROM t_company_details"); - $company = $query0->getRow(); + $company = $query0->getRow(); - $query1 = $this->db->query(" + $query1 = $this->db->query( + " SELECT CONCAT_WS(' ', t_employee_details.FirstName, t_employee_details.LastName) AS FullName FROM tbl_users LEFT JOIN t_employee_details ON tbl_users.EmpID = t_employee_details.EmpID - WHERE tbl_users.userId = ?", [$userId] - ); - $fullName = $query1->getRow(); - - $query2 = $this->db->query(" - SELECT email FROM tbl_users - WHERE isDeleted = 0 AND roleId =".$roleId - ); - $to_mails = $query2->getResult(); + WHERE tbl_users.userId = ?", + [$userId] + ); + $fullName = $query1->getRow(); - $query3 = $this->db->query(" + $query2 = $this->db->query( + " SELECT email FROM tbl_users - WHERE isDeleted = 0 AND userId =".$userId - ); - $from_mails = $query3->getRow(); + WHERE isDeleted = 0 AND roleId =" . $roleId + ); + $to_mails = $query2->getResult(); - return [ + $query3 = $this->db->query( + " + SELECT email FROM tbl_users + WHERE isDeleted = 0 AND userId =" . $userId + ); + $from_mails = $query3->getRow(); + + return [ 'company' => $company ? $company->CompanyName : null, 'company_mail' => $company ? $company->EmailAddress : null, - 'full_name' => $fullName ? $fullName->FullName : null, - 'from_mails' => $from_mails ? $from_mails->email : null , + 'full_name' => $fullName ? $fullName->FullName : null, + 'from_mails' => $from_mails ? $from_mails->email : null, 'to_mails' => $to_mails, - ]; - } + ]; + } public function getdriverlist() - { + { - $query = $this->db->query('SELECT DriverName,DriverMobileNumber + $query = $this->db->query('SELECT DriverName,DriverMobileNumber FROM t_igr_master WHERE DriverName != "" GROUP BY DriverName,DriverMobileNumber'); - $result = $query->getResultArray(); - return $result; + $result = $query->getResultArray(); + return $result; } - public function getigrstatus($IGRNo){ + public function getigrstatus($IGRNo) + { $builder = $this->db->table('t_igr_master') - ->select('IGRStatus') - ->where('IGRNO',$IGRNo) - ->get(); - $result = $builder->getRow(); - return $result; + ->select('IGRStatus') + ->where('IGRNO', $IGRNo) + ->get(); + $result = $builder->getRow(); + return $result; } - public function get_status($value){ + public function get_status($value) + { $builder = $this->db->table('t_status') - ->select('StatusCode,StatusName') - ->where('StatusCode', $value); + ->select('StatusCode,StatusName') + ->where('StatusCode', $value); - $query = $builder->get()->getRow(); + $query = $builder->get()->getRow(); - $StatusName = $query ? $query->StatusName : null; - return $StatusName; + $StatusName = $query ? $query->StatusName : null; + return $StatusName; } - public function get_TransporterId($value){ + public function get_TransporterId($value) + { $builder = $this->db->table('t_transporter') - ->select('id,name') - ->where('id', $value); + ->select('id,name') + ->where('id', $value); - $query = $builder->get()->getRow(); + $query = $builder->get()->getRow(); - $transportername = $query ? $query->name : null; - return $transportername; + $transportername = $query ? $query->name : null; + return $transportername; } //Mcat -materialCategory - public function getIgrDetailsListByMcatGas($gasMaterialCodes,$gas_status){ + public function getIgrDetailsListByMcatGas($gasMaterialCodes, $gas_status) + { - switch ($gas_status) { + switch ($gas_status) { - case "gas_entered": + case "gas_entered": - $builder = $this->db->table('t_igr_details as t_igrd') - ->select(" + $builder = $this->db->table('t_igr_details as t_igrd') + ->select(" t_igrd.IGRNO as IGRNO-, (t_igrd.QuantityAsPerInvoice) as gasCylinderCount, t_sd.SupplierName, @@ -1407,25 +1431,25 @@ $builder = $this->db->table('t_igr_history') t_mm.MaterialName, t_gsd.* ") - ->join('t_igr_master t_igrm', 't_igrm.IGRNO = t_igrd.IGRNO') - ->join('t_purchaseorder_master t_pom', 't_igrm.PONO = t_pom.PONO', 'left') - ->join('t_supplierdetailsn t_sd', 't_sd.SupplierID = t_pom.SupplierID') + ->join('t_igr_master t_igrm', 't_igrm.IGRNO = t_igrd.IGRNO') + ->join('t_purchaseorder_master t_pom', 't_igrm.PONO = t_pom.PONO', 'left') + ->join('t_supplierdetailsn t_sd', 't_sd.SupplierID = t_pom.SupplierID') - ->join('t_gasshortagedetails t_gsd', 't_gsd.IGRNO = t_igrm.IGRNO', 'left') + ->join('t_gasshortagedetails t_gsd', 't_gsd.IGRNO = t_igrm.IGRNO', 'left') - ->join('t_materialmaster t_mm','t_mm.MaterialCode = t_igrd.MaterialCode','left') - ->whereIn('t_igrd.MaterialCode', $gasMaterialCodes) - ->where("DATE(t_igrd.CreatedDate) >= '2025-04-01' ") + ->join('t_materialmaster t_mm', 't_mm.MaterialCode = t_igrd.MaterialCode', 'left') + ->whereIn('t_igrd.MaterialCode', $gasMaterialCodes) + ->where("DATE(t_igrd.CreatedDate) >= '2025-04-01' ") - ->where('t_gsd.gas_cylinder_status IS NULL'); + ->where('t_gsd.gas_cylinder_status IS NULL'); - break; + break; - case "gas_pending": + case "gas_pending": - $builder = $this->db->table('t_igr_details as t_igrd') - ->select(" + $builder = $this->db->table('t_igr_details as t_igrd') + ->select(" t_igrd.IGRNO as IGRNO-, (t_igrd.QuantityAsPerInvoice) as gasCylinderCount, t_sd.SupplierName, @@ -1433,26 +1457,26 @@ $builder = $this->db->table('t_igr_history') t_mm.MaterialName, t_gsd.* ") - ->join('t_igr_master t_igrm', 't_igrm.IGRNO = t_igrd.IGRNO') - ->join('t_purchaseorder_master t_pom', 't_igrm.PONO = t_pom.PONO', 'left') - ->join('t_supplierdetailsn t_sd', 't_sd.SupplierID = t_pom.SupplierID') - - ->join('t_gasshortagedetails t_gsd', 't_gsd.IGRNO = t_igrm.IGRNO', 'left') + ->join('t_igr_master t_igrm', 't_igrm.IGRNO = t_igrd.IGRNO') + ->join('t_purchaseorder_master t_pom', 't_igrm.PONO = t_pom.PONO', 'left') + ->join('t_supplierdetailsn t_sd', 't_sd.SupplierID = t_pom.SupplierID') - ->join('t_materialmaster t_mm','t_mm.MaterialCode = t_igrd.MaterialCode','left') - ->whereIn('t_igrd.MaterialCode', $gasMaterialCodes) - ->where("DATE(t_igrd.CreatedDate) >= '2025-04-01' ") + ->join('t_gasshortagedetails t_gsd', 't_gsd.IGRNO = t_igrm.IGRNO', 'left') - ->where('t_gsd.gas_cylinder_status','gas_pending'); + ->join('t_materialmaster t_mm', 't_mm.MaterialCode = t_igrd.MaterialCode', 'left') + ->whereIn('t_igrd.MaterialCode', $gasMaterialCodes) + ->where("DATE(t_igrd.CreatedDate) >= '2025-04-01' ") - break; + ->where('t_gsd.gas_cylinder_status', 'gas_pending'); + + break; - case "gas_returned": + case "gas_returned": - $builder = $this->db->table('t_igr_details as t_igrd') - ->select(" + $builder = $this->db->table('t_igr_details as t_igrd') + ->select(" t_igrd.IGRNO as IGRNO-, (t_igrd.QuantityAsPerInvoice) as gasCylinderCount, t_sd.SupplierName, @@ -1467,34 +1491,28 @@ $builder = $this->db->table('t_igr_history') Count(t_gsd.gas_cylinder_status) as gasCylinderCompletedCount, (t_igrd.QuantityAsPerInvoice - Count(t_gsd.gas_cylinder_status)) as gasCylinderPendingCount ") - ->join('t_igr_master t_igrm', 't_igrm.IGRNO = t_igrd.IGRNO') - ->join('t_purchaseorder_master t_pom', 't_igrm.PONO = t_pom.PONO', 'left') - ->join('t_supplierdetailsn t_sd', 't_sd.SupplierID = t_pom.SupplierID') + ->join('t_igr_master t_igrm', 't_igrm.IGRNO = t_igrd.IGRNO') + ->join('t_purchaseorder_master t_pom', 't_igrm.PONO = t_pom.PONO', 'left') + ->join('t_supplierdetailsn t_sd', 't_sd.SupplierID = t_pom.SupplierID') - ->join('t_gasshortagedetails t_gsd', 't_gsd.IGRNO = t_igrm.IGRNO', 'left') + ->join('t_gasshortagedetails t_gsd', 't_gsd.IGRNO = t_igrm.IGRNO', 'left') - ->join('t_materialmaster t_mm','t_mm.MaterialCode = t_igrd.MaterialCode','left') - ->whereIn('t_igrd.MaterialCode', $gasMaterialCodes) - ->where("DATE(t_igrd.CreatedDate) >= '2025-04-01' ") + ->join('t_materialmaster t_mm', 't_mm.MaterialCode = t_igrd.MaterialCode', 'left') + ->whereIn('t_igrd.MaterialCode', $gasMaterialCodes) + ->where("DATE(t_igrd.CreatedDate) >= '2025-04-01' ") - ->where('t_gsd.gas_cylinder_status','gas_returned') - - ->groupBy('t_igrd.IGRNO'); - - break; - - } + ->where('t_gsd.gas_cylinder_status', 'gas_returned') - - $result = $builder->get()->getResultArray(); + ->groupBy('t_igrd.IGRNO'); + + break; + } + + + $result = $builder->get()->getResultArray(); - return $result; - + return $result; } - - - - -} \ No newline at end of file +} diff --git a/app/Views/attendance.php b/app/Views/attendance.php index cbc48d02..8d32e346 100755 --- a/app/Views/attendance.php +++ b/app/Views/attendance.php @@ -234,28 +234,41 @@ $currentday = date('d');
-
+
+
+ 'atten'); echo form_open('attendance', $attributes); ?> -
- -
- - + +
+ +
+ +
-
- -
-
- + +
+ + + + + + + + + + + +
+
@@ -279,7 +292,7 @@ $currentday = date('d'); ?> -
+
@@ -541,11 +554,7 @@ $currentday = date('d'); - + @@ -563,7 +572,7 @@ $currentday = date('d'); - + @@ -695,10 +701,7 @@ $(document).ready(function () { $(document).ready(function() { - // $("#attendance").CongelarFilaColumna({ - // lboHoverTr: true - // }); - $('html').bind('keypress', function(e) { + $('table').bind('keypress', function(e) { if (((e.which || e.keyCode) == 8) || ((e.which || e.keyCode) == 9) || ((e.which || e.keyCode) == @@ -1044,4 +1047,60 @@ $(document).ready(function () { } } + + function toggleDivFullscreen() { + let div = document.getElementById("fullscreenDiv"); + let tableResponsive = document.getElementById("table-responsive"); // Select the table container inside div + + + + if (!document.fullscreenElement) { + div.requestFullscreen().then(() => { + div.style.width = "100vw"; // Full viewport width + div.style.height = "100vh"; // Full viewport height + + // If .table-responsive exists, set its height to 90vh + if (tableResponsive) { + tableResponsive.style.maxHeight = "90vh"; + tableResponsive.style.overflowY = "auto"; // Allow scrolling if needed + } + }).catch(err => console.log("Error enabling fullscreen:", err)); + } else { + document.exitFullscreen().then(() => { + div.style.width = "100%"; + div.style.height = "100%"; + + // Reset .table-responsive height when exiting fullscreen + if (tableResponsive) { + tableResponsive.style.height = "auto"; + } + }).catch(err => console.log("Error exiting fullscreen:", err)); + } +} + + +function showMessage(msg) { + let msgBox = document.getElementById("successMessage"); + msgBox.innerText = msg; // Set API message + msgBox.style.display = "block"; + + // Hide message after 3 seconds + setTimeout(() => { + msgBox.style.display = "none"; + }, 3000); +} +$(document).ready(function() { + document.getElementById("searchInput").addEventListener("input", function () { + this.value = this.value.replace(/[^a-zA-Z0-9 ]/g, ''); // Allows letters, numbers, and spaces + }); +}); + +$("#searchInput").on("keyup", function () { + let value = $(this).val().toLowerCase(); // Convert input to lowercase for case-insensitive search + + $("#table-responsive tbody tr").filter(function () { + $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1); + }); +}); + \ No newline at end of file diff --git a/app/Views/editRawmaterial.php b/app/Views/editRawmaterial.php index e29874fd..e142d4b3 100755 --- a/app/Views/editRawmaterial.php +++ b/app/Views/editRawmaterial.php @@ -113,7 +113,7 @@ if ($total <= $reorder) {

Edit Material - Details

-
@@ -361,10 +361,12 @@ if ($total <= $reorder) {
diff --git a/app/Views/monthlypayinputs.php b/app/Views/monthlypayinputs.php index 3871ffc5..1cb5f9e8 100755 --- a/app/Views/monthlypayinputs.php +++ b/app/Views/monthlypayinputs.php @@ -127,22 +127,7 @@
- -
-
- -
- - -
- - -
-
+

Material Master Details

+
+ +
getFlashdata('materialListPage') ?? $_GET['materialListPage'] ?? 1; + ?>
@@ -74,7 +86,7 @@
-
+
@@ -116,12 +128,10 @@
- +
-
+
@@ -200,6 +210,7 @@ ; // Default to 1 if not set + + savedPage = savedPage -1 ; + + + if (!isNaN(savedPage)) { + // Check if the DataTable is initialized + if ($.fn.DataTable.isDataTable('#raw_material_list_table')) { + var dataTable = $('#raw_material_list_table').DataTable(); + + // Get the total number of pages in DataTable + var totalPages = dataTable.page.info().pages; + + // Ensure the page number is within range + if (savedPage >= totalPages) { + savedPage = totalPages > 0 ? totalPages - 1 : 0; + } + + // Set DataTable to the saved page + dataTable.page(savedPage).draw(false); + } + } + // Date range filter function // $.fn.dataTable.ext.search.push( // function (settings, data, dataIndex) { @@ -535,10 +570,31 @@ $(document).ready(function () { }); }); + + + + diff --git a/app/Views/stock/bagStockDetails.php b/app/Views/stock/bagStockDetails.php index f819e15e..13341b9f 100644 --- a/app/Views/stock/bagStockDetails.php +++ b/app/Views/stock/bagStockDetails.php @@ -212,7 +212,7 @@ background-color: #50bbd9; /* Green background */ color: #ffffff; - border: 1px solid #ddd; + border: 2px solid ; padding: 10px; white-space: normal; /* Allows text to wrap */ @@ -349,7 +349,7 @@ foreach ($period as $day) { @@ -358,7 +358,7 @@ foreach ($period as $day) { if ($month == date('M-Y')) { ?> @@ -373,25 +373,25 @@ foreach ($period as $day) { title="Navigation" data-toggle="modal" data-target="#bs-example-modal-lg" - style="font-size: x-large; cursor:pointer;"> + style="font-size: x-large; cursor:pointer; color: #bd0906"> @@ -1364,13 +1364,15 @@ foreach ($period as $day) { }).catch(err => console.log("Error enabling fullscreen:", err)); } else { document.exitFullscreen().then(() => { + div.style.width = "100%"; + div.style.height = "100%"; // Reset .table-responsive height when exiting fullscreen - if (tableResponsive) { - tableResponsive.style.height = "auto"; + // If .table-responsive exists, set its height to 90vh + if (tableResponsive) { + tableResponsive.style.maxHeight = "450px"; + tableResponsive.style.overflowY = "auto"; // Allow scrolling if needed } - - }).catch(err => console.log("Error exiting fullscreen:", err)); } diff --git a/app/Views/stock/dieselStockDetails.php b/app/Views/stock/dieselStockDetails.php index 08e5781a..5adc25eb 100644 --- a/app/Views/stock/dieselStockDetails.php +++ b/app/Views/stock/dieselStockDetails.php @@ -213,7 +213,7 @@ background-color: #50bbd9; /* Green background */ color: #ffffff; - border: 1px solid #ddd; + border: 2px solid ; padding: 10px; } @@ -337,8 +337,8 @@ foreach ($period as $day) { + style=" padding: 8px;margin-bottom: 10px;width: 250px;border: 2px solid rgb(123, 11, 214); + border-radius: 5px;margin-right:15px;"> @@ -361,25 +361,26 @@ foreach ($period as $day) { title="Navigation" data-toggle="modal" data-target="#bs-example-modal-lg" - style="font-size: x-large; cursor:pointer;"> + style="font-size: x-large; cursor:pointer; color: #bd0906"> + + style="font-size: x-large; cursor:pointer; color: #0b7cba" + id="bagStockExport"> @@ -1733,8 +1734,10 @@ foreach ($period as $day) { div.style.height = "100%"; // Reset .table-responsive height when exiting fullscreen - if (tableResponsive) { - tableResponsive.style.height = "auto"; + // If .table-responsive exists, set its height to 90vh + if (tableResponsive) { + tableResponsive.style.maxHeight = "450px"; + tableResponsive.style.overflowY = "auto"; // Allow scrolling if needed } }).catch(err => console.log("Error exiting fullscreen:", err)); } diff --git a/app/Views/stock/drierMachineDetails.php b/app/Views/stock/drierMachineDetails.php index 3e2976ef..79ac5c1f 100644 --- a/app/Views/stock/drierMachineDetails.php +++ b/app/Views/stock/drierMachineDetails.php @@ -339,13 +339,13 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); + style="padding: 8px;margin-bottom: 10px;width: 250px;border: 2px solid rgb(123, 11, 214); + border-radius: 5px;margin-right:15px; "> @@ -353,13 +353,13 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); @@ -368,7 +368,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); title="Add Entry" data-target="#additionalEntriesModalId" data-toggle="modal" - style="font-size: x-large; cursor:pointer;"> + style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"> @@ -462,14 +462,16 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
@@ -752,7 +754,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
- + @@ -867,22 +869,22 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
@@ -942,7 +944,10 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); $summary['input_sand_qty'] += $a['input_sand_qty'] == "-" ? 0 : (float) $a['input_sand_qty']; $summary['moisture_loss_qty'] += $a['moisture_loss_qty'] == "-" ? 0 : (float) $a['moisture_loss_qty']; $summary['sand_dried_qty'] += $a['sand_dried_qty'] == "-" ? 0 : (float) $a['sand_dried_qty']; + $summary['gas_per_ton'] = round(($summary['total_gas_consumption'] / $summary['sand_dried_qty'])); + $summary['qty_per_hrs'] = round( ($summary['sand_dried_qty'] / $summary['drier_running_hours']) ); $summary['dust_qty'] += $a['dust_qty'] == "-" ? 0 : (float) $a['dust_qty']; + } ?> @@ -962,8 +967,8 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); - - + + @@ -979,7 +984,12 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');

- + +
+

Note :- (A) -> Average

+ + + @@ -1471,8 +1481,10 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); div.style.height = "100%"; // Reset .table-responsive height when exiting fullscreen - if (tableResponsive) { - tableResponsive.style.height = "auto"; + // If .table-responsive exists, set its height to 90vh + if (tableResponsive) { + tableResponsive.style.maxHeight = "450px"; + tableResponsive.style.overflowY = "auto"; // Allow scrolling if needed } }).catch(err => console.log("Error exiting fullscreen:", err)); } @@ -1543,4 +1555,27 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); + + + \ No newline at end of file diff --git a/app/Views/stock/dustAndRoughStockDetails.php b/app/Views/stock/dustAndRoughStockDetails.php index 331eb25e..4f14fd9a 100644 --- a/app/Views/stock/dustAndRoughStockDetails.php +++ b/app/Views/stock/dustAndRoughStockDetails.php @@ -217,7 +217,7 @@ background-color: #50bbd9; /* Green background */ color: #ffffff; - border: 1px solid #ddd; + border: 2px solid ; padding: 10px; } @@ -342,7 +342,7 @@
-
+
" class="form-control " @@ -359,13 +359,13 @@ @@ -373,20 +373,20 @@ @@ -394,7 +394,7 @@
-
+
@@ -967,8 +967,10 @@ div.style.height = "100%"; // Reset .table-responsive height when exiting fullscreen - if (tableResponsive) { - tableResponsive.style.height = "auto"; + // If .table-responsive exists, set its height to 90vh + if (tableResponsive) { + tableResponsive.style.maxHeight = "450px"; + tableResponsive.style.overflowY = "auto"; // Allow scrolling if needed } }).catch(err => console.log("Error exiting fullscreen:", err)); } diff --git a/app/Views/stock/gasStockDetails.php b/app/Views/stock/gasStockDetails.php index 029b2079..b4110044 100644 --- a/app/Views/stock/gasStockDetails.php +++ b/app/Views/stock/gasStockDetails.php @@ -202,7 +202,7 @@ background-color: #50bbd9; /* Green background */ color: #ffffff; - border: 1px solid #ddd; + border: 2px solid ; padding: 10px; } @@ -222,7 +222,7 @@ .table-responsive { overflow-x: auto; overflow-y: auto; - max-height: 500px; + max-height: 450px; max-width: 100%; position: relative; } @@ -335,13 +335,13 @@ @@ -349,20 +349,20 @@ @@ -453,16 +453,15 @@
- - - - - + + + + @@ -470,10 +469,12 @@ + + - + - + @@ -1272,8 +1273,10 @@ div.style.height = "100%"; // Reset .table-responsive height when exiting fullscreen - if (tableResponsive) { - tableResponsive.style.height = "auto"; + // If .table-responsive exists, set its height to 90vh + if (tableResponsive) { + tableResponsive.style.maxHeight = "450px"; + tableResponsive.style.overflowY = "auto"; // Allow scrolling if needed } }).catch(err => console.log("Error exiting fullscreen:", err)); } diff --git a/app/Views/stock/incomingSilicaSandDetails.php b/app/Views/stock/incomingSilicaSandDetails.php index 7a015ea9..8c1ac54f 100644 --- a/app/Views/stock/incomingSilicaSandDetails.php +++ b/app/Views/stock/incomingSilicaSandDetails.php @@ -340,27 +340,27 @@ @@ -1448,7 +1448,7 @@ + \ No newline at end of file diff --git a/app/Views/stock/resinStockDetails.php b/app/Views/stock/resinStockDetails.php index e06bc111..bd304af1 100644 --- a/app/Views/stock/resinStockDetails.php +++ b/app/Views/stock/resinStockDetails.php @@ -18,23 +18,27 @@ } .fht-table td:hover { - background-color: rgb(170, 222, 167); - color:rgb(2, 2, 2); - transform: scale(1.25); /* Increases size by 25% */ - transition: transform 0.5s ease-in-out; /* Smooth scaling effect */ + background-color: rgb(170, 222, 167); + color: rgb(2, 2, 2); + transform: scale(1.25); + /* Increases size by 25% */ + transition: transform 0.5s ease-in-out; + /* Smooth scaling effect */ } .fht-table tr:hover { - background-color: rgb(170, 222, 167); - color:rgb(2, 2, 2); + background-color: rgb(170, 222, 167); + color: rgb(2, 2, 2); } .grab { - cursor: grab; /* Default open-hand cursor */ + cursor: grab; + /* Default open-hand cursor */ } .grab:active { - cursor: grabbing; /* Closed-hand cursor when dragging */ + cursor: grabbing; + /* Closed-hand cursor when dragging */ } /* @@ -213,7 +217,7 @@ background-color: #50bbd9; /* Green background */ color: #ffffff; - border: 1px solid #ddd; + border: 2px solid; padding: 10px; } @@ -245,21 +249,22 @@ } tfoot tr { - background-color:rgb(235, 236, 203); + background-color: rgb(235, 236, 203); } - body[data-layout-mode = horizontal] .container-fluid{ + body[data-layout-mode=horizontal] .container-fluid { max-width: 100%; } - .card-body{ - padding-top : 0; - padding-bottom : 0; + .card-body { + padding-top: 0; + padding-bottom: 0; } - .card{ margin-bottom: 5px;} - + .card { + margin-bottom: 5px; + } @@ -321,160 +326,160 @@ foreach ($period as $day) {
- + -
+
-
- " - class="form-control mt-2" - style="z-index:30;" readonly> -
+
+ " + class="form-control mt-2" + style="z-index:30;" readonly> +
-
+
- + - - - - - - - - - + - + if ($month == date('M-Y')) { + ?> + - - + - - - - -
+ + + + + + + + + + + + + +
- - +
+ + +
- - + -
-
+
- - " - class="form-control mt-2" data-provide="datepicker" - data-date-format="M-yyyy" data-date-min-view-mode="1"> + + " + class="form-control mt-2" data-provide="datepicker" + data-date-format="M-yyyy" data-date-min-view-mode="1"> @@ -524,7 +529,7 @@ foreach ($period as $day) {
- + @@ -583,7 +588,7 @@ foreach ($period as $day) { $currentDate = date('d-m-Y'); $dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $resinStockDetails[0]['date'])->format('d-m-Y'); if ($dateInMonthDmYFormat === $currentDate) { - echo 'style="background: rgb(232, 245, 231);"'; + echo 'style="background: #cef0ad;"'; } ?>> $resinStock) { @@ -671,126 +676,122 @@ foreach ($period as $day) { -
- + + - + - + - - - - + + + + - - - - - - - - - - - $dateInMonth) { ?> - format('d-m-Y'); - if ($dateInMonthDmYFormat === $currentDate) { - echo 'style="background: rgb(232, 245, 231);"'; - } - ?>> - $resinMaterial) { ?> - - - - format('d-m-Y'); - ?> - - - - - - - - - - - - - - - - - - - + + + - + + + + + $dateInMonth) { ?> + format('d-m-Y'); + if ($dateInMonthDmYFormat === $currentDate) { + echo 'style="background: #cef0ad ;"'; + } + ?>> + $resinMaterial) { ?> + + + + format('d-m-Y'); + ?> + + + + + + + + + + + + + + + + + + + + + + +
- + - + - + - + - (A)(A)
RIPL Gas Stock FBD 10 Ton DryerSand DriedCoating MachineSand CoatedTRP FBD 10 Ton DryerCoating MachineTRP Sand TRP Rotary Drier
Date Opening Stock Purchase(Bharath)Total Consumption Balance StockConsumption Ton Sand Dried Qty ConsumptionTon Sand Coated Qty Panel Consumption Physical Consumption Ton
- Total - + Total +
- - - - oninput="openingStockChange(this)" - contenteditable="true" - - > - - $previousMonthResinStockDetail) - { - if($previousMonthResinStockDetail['materialCode'] == $resinMaterial['MaterialCode']){ - echo $previousMonthResinStockDetail['balanceStock'] ; - break; - } - - } - ?> - - - - $previousMonthResinStockDetail) - { - if($previousMonthResinStockDetail['materialCode'] == $resinMaterial['MaterialCode']){ - echo $previousMonthResinStockDetail['balanceStock'] ; - break; - } - - } - ?> - -
+ + + + oninput="openingStockChange(this)" + contenteditable="true" + + > + + $previousMonthResinStockDetail) { + if ($previousMonthResinStockDetail['materialCode'] == $resinMaterial['MaterialCode']) { + echo $previousMonthResinStockDetail['balanceStock']; + break; + } + } + ?> + + + + $previousMonthResinStockDetail) { + if ($previousMonthResinStockDetail['materialCode'] == $resinMaterial['MaterialCode']) { + echo $previousMonthResinStockDetail['balanceStock']; + break; + } + } + ?> + +
@@ -812,7 +813,7 @@ foreach ($period as $day) { @@ -867,9 +868,9 @@ foreach ($period as $day) { targetColumnIndex = targetColumnIndex * 7; targetRow.cells[targetColumnIndex].scrollIntoView({ - behavior: 'smooth', - inline: 'center', - block: 'center' + behavior: 'smooth', + inline: 'center', + block: 'center' }); const highlightDuration = 10000; @@ -1099,24 +1100,24 @@ foreach ($period as $day) { $(document).ready(function() { function exportTableToExcel(tableID, filename = '') { - let table = document.getElementById(tableID); - + let table = document.getElementById(tableID); + let cloneTable = table.cloneNode(true); // Clone the table to modify - + // Remove hidden rows - $(cloneTable).find('tr').filter(function () { + $(cloneTable).find('tr').filter(function() { return $(this).css('display') === 'none'; }).remove(); - + // Remove hidden columns - $(cloneTable).find('th, td').each(function () { + $(cloneTable).find('th, td').each(function() { if ($(this).css('display') === 'none') { $(this).remove(); } }); $(cloneTable).find('tbody tr').each(function() { let firstTd = $(this).find('td').eq(0); // Get the first column (Date) - + // Convert Date Format (Assuming it's in YYYY-MM-DD format) let originalDate = firstTd.text().trim(); // Get the text value let parts = originalDate.split('-'); // Split into [YYYY, MM, DD] @@ -1189,72 +1190,77 @@ foreach ($period as $day) { - + \ No newline at end of file diff --git a/app/Views/stock/trpProductionStockDetails.php b/app/Views/stock/trpProductionStockDetails.php index 194b1364..2e3892e3 100644 --- a/app/Views/stock/trpProductionStockDetails.php +++ b/app/Views/stock/trpProductionStockDetails.php @@ -210,7 +210,7 @@ background-color: #50bbd9; /* Green background */ color: #ffffff; - border: 1px solid #ddd; + border: 2px solid ; white-space: normal; /* Allows text to wrap */ word-wrap: break-word; @@ -305,6 +305,12 @@ .card { margin-bottom: 5px; } + + #trpProductionStockDetailsTableId { /* Replace with your table's actual ID or selector */ + border-collapse: collapse; + } + + @@ -399,10 +405,7 @@ $timeOtions[] = "12:00 AM";
" - class="form-control " - data-provide="datepicker" - data-date-format="M-yyyy" - data-date-min-view-mode="1" readonly + class="form-control " readonly style="max-width: 175px;">
@@ -413,13 +416,13 @@ $timeOtions[] = "12:00 AM"; @@ -427,20 +430,20 @@ $timeOtions[] = "12:00 AM"; @@ -1498,16 +1501,18 @@ $timeOtions[] = "12:00 AM";
- - - - + + + + -
@@ -1703,36 +1708,36 @@ $timeOtions[] = "12:00 AM"; 'absRunningHrs' => "", 'absPerHour' => "", 'absOpeningStock' => '', - 'absReceipt' => $totalWcsReceived, - 'absTotal' => $totalWcsReceived, - 'absConsumption' => $summary['edProduction'], - 'absClosingStock' => ($totalWcsReceived) - $summary['edProduction'], + 'absReceipt' => $totalWcsReceived == 0 ? " " : $totalWcsReceived, + 'absTotal' => $totalWcsReceived == 0 ? " " : $totalWcsReceived, + 'absConsumption' => $summary['edProduction'] == 0 ? " " : $summary['edProduction'] , + 'absClosingStock' => ($totalWcsReceived) - $summary['edProduction'] == 0 ? " " : $totalWcsReceived - $summary['edProduction'], 'absPhysicalStock' => '', 'absRemarks' => '', ], [ 'absParticulars' => "ED Details", - 'absRunningHrs' => $summary['edRunningHours'], - 'absPerHour' => number_format($summary['edProduction'] / ($summary['edRunningHours'] == 0 ? 1 : $summary['edRunningHours']), 2), + 'absRunningHrs' => $summary['edRunningHours'] == 0 ? " " : $summary['edRunningHours'], + 'absPerHour' => number_format($summary['edProduction'] / ($summary['edRunningHours'] == 0 ? 1 : $summary['edRunningHours']), 2) == 0 ? " " : number_format($summary['edProduction'] / ($summary['edRunningHours'] == 0 ? 1 : $summary['edRunningHours']), 2), 'absOpeningStock' => '', - 'absReceipt' => $summary['edProduction'], - 'absTotal' => $summary['edProduction'], - 'absConsumption' => $summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250), - 'absClosingStock' => $summary['edProduction'] - $summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250), + 'absReceipt' => $summary['edProduction'] == 0 ? " " : $summary['edProduction'], + 'absTotal' => $summary['edProduction'] == 0 ? " " : $summary['edProduction'], + 'absConsumption' => $summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250) == 0 ? " " : $summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250), + 'absClosingStock' => $summary['edProduction'] - $summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250) == 0 ? " " : $summary['edProduction'] - ($summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250)), 'absPhysicalStock' => '', 'absRemarks' => '', ], [ 'absParticulars' => "TRP Total Sand", - 'absRunningHrs' => $summary['sandFeedingHours'], - 'absPerHour' => $summary['trpProductionPerHour'], + 'absRunningHrs' => $summary['sandFeedingHours'] == 0 ? " " : $summary['sandFeedingHours'], + 'absPerHour' => $summary['trpProductionPerHour'] == 0 ? " " : $summary['trpProductionPerHour'], 'absOpeningStock' => '', - 'absReceipt' => $summary['trpProduction'], - 'absTotal' => $summary['trpProduction'], - 'absConsumption' => $totalCrsReceived, - 'absClosingStock' => $summary['trpProduction'] - $totalCrsReceived, + 'absReceipt' => $summary['trpProduction'] == 0 ? " " : $summary['trpProduction'], + 'absTotal' => $summary['trpProduction'] == 0 ? " " : $summary['trpProduction'], + 'absConsumption' => $totalCrsReceived == 0 ? " " : $totalCrsReceived, + 'absClosingStock' => $summary['trpProduction'] - $totalCrsReceived == 0 ? " " : $summary['trpProduction'] - $totalCrsReceived, 'absPhysicalStock' => '', 'absRemarks' => '', ], @@ -1740,12 +1745,12 @@ $timeOtions[] = "12:00 AM"; 'absParticulars' => "Trp Physical Gas Consumption", 'absRunningHrs' => "", - 'absPerHour' => number_format(($summary['trpPlusDrierGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2, '.', ''), + 'absPerHour' => number_format(($summary['trpPlusDrierGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2, '.', '') == 0 ? " " : number_format(($summary['trpPlusDrierGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2, '.', ''), 'absOpeningStock' => '', - 'absReceipt' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'], - 'absTotal' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'], - 'absConsumption' => $summary['physicalGasConsumption'], - 'absClosingStock' => ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['physicalGasConsumption'], + 'absReceipt' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'] == 0 ? " " : $summary['gasReceiptBg'] + $summary['gasReceiptPg'], + 'absTotal' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'] == 0 ? " " : $summary['gasReceiptBg'] + $summary['gasReceiptPg'], + 'absConsumption' => $summary['physicalGasConsumption'] == 0 ? " " : $summary['physicalGasConsumption'], + 'absClosingStock' => ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['physicalGasConsumption'] == 0 ? " " : ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['physicalGasConsumption'], 'absPhysicalStock' => '', 'absRemarks' => '', ], @@ -1753,12 +1758,12 @@ $timeOtions[] = "12:00 AM"; 'absParticulars' => "Trp Panel Gas Consumption", 'absRunningHrs' => "", - 'absPerHour' => number_format(($summary['panelGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2), + 'absPerHour' => number_format(($summary['panelGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2) == 0 ? " " : number_format(($summary['panelGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2), 'absOpeningStock' => '', - 'absReceipt' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'], - 'absTotal' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'], - 'absConsumption' => $summary['panelGasConsumption'], - 'absClosingStock' => ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['panelGasConsumption'], + 'absReceipt' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'] == 0 ? " " : $summary['gasReceiptBg'] + $summary['gasReceiptPg'], + 'absTotal' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'] == 0 ? " " : $summary['gasReceiptBg'] + $summary['gasReceiptPg'], + 'absConsumption' => $summary['panelGasConsumption'] == 0 ? " " : $summary['panelGasConsumption'] , + 'absClosingStock' => ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['panelGasConsumption'] == 0 ? " " : ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['panelGasConsumption'], 'absPhysicalStock' => '', 'absRemarks' => '', ], @@ -1768,9 +1773,9 @@ $timeOtions[] = "12:00 AM"; 'absRunningHrs' => "", 'absPerHour' => "", 'absOpeningStock' => '', - 'absReceipt' => $summary['waterReceipt'], - 'absTotal' => $summary['waterReceipt'], - 'absConsumption' => $summary['waterReceipt'] - $summary['waterConsumption'], + 'absReceipt' => $summary['waterReceipt'] == 0 ? " " : $summary['waterReceipt'], + 'absTotal' => $summary['waterReceipt'] == 0 ? " " : $summary['waterReceipt'], + 'absConsumption' => $summary['waterReceipt'] - $summary['waterConsumption'] == 0 ? " " : $summary['waterReceipt'] - $summary['waterConsumption'], 'absClosingStock' => '', 'absPhysicalStock' => '', 'absRemarks' => '', @@ -1778,12 +1783,12 @@ $timeOtions[] = "12:00 AM"; [ 'absParticulars' => "Power Consumption", - 'absRunningHrs' => $summary['ebReadingPerUnitTon'], + 'absRunningHrs' => $summary['ebReadingPerUnitTon'] == 0 ? " " : $summary['ebReadingPerUnitTon'], 'absPerHour' => "", 'absOpeningStock' => '', 'absReceipt' => '', 'absTotal' => '', - 'absConsumption' => $summary['ebReading'], + 'absConsumption' => $summary['ebReading'] == 0 ? " " : $summary['ebReading'], 'absClosingStock' => '', 'absPhysicalStock' => '', 'absRemarks' => '', @@ -2325,8 +2330,8 @@ $timeOtions[] = "12:00 AM"; // Convert to numbers for calculations let openingStock = validateInput(openingStockTd) || 0; - let receipt = validateInput(receiptTd) || 0; - let consumption = validateInput(consumptionTd) || 0; + let receipt = validateInput(receiptTd) || 0; + let consumption = validateInput(consumptionTd) || 0; // Calculate values let totalStock = parseFloat(openingStock) + parseFloat(receipt); @@ -2528,8 +2533,6 @@ $timeOtions[] = "12:00 AM"; }) - -