diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 2c7bf9ce..32115265 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -420,7 +420,8 @@ $routes->post('getSilicaIGR', 'Supplier::getSilicaIGR'); //Stock Module -$routes->get('coatingMachineDetails' , 'StockController::loadView_coatingMachineDetails'); +//coatingMachineDetails +$routes->match(['GET','POST'],'coatingMachineDetails' , 'StockController::loadView_coatingMachineDetails'); $routes->post('addNewCoatingMachineDetails' , 'StockController::addNewCoatingMachineDetails'); $routes->post('updateCoatingMachineDetails','StockController::updateCoatingMachineDetails'); $routes->get('deleteCoatingMachineDetails' , 'StockController::deleteCoatingMachineDetails'); @@ -430,7 +431,12 @@ $routes->get('deleteCoatingMachineDetails' , 'StockController::deleteCoatingMach $routes->match(['GET', 'POST', 'PUT', 'DELETE'],'drierMachineDetails', 'StockController::drierMachineDetails'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'],'addOrEditdrierMachineDetails', 'StockController::addOrEditdrierMachineDetails'); - $routes->match(['GET', 'POST', 'PUT', 'DELETE'],'factoryVehicleDieselDetails', 'StockController::factoryVehicleDieselDetails'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'],'addOrEditfactoryVehicleDieselDetails', 'StockController::addOrEditfactoryVehicleDieselDetails'); + +//incomingSilicaSandDetaails +$routes->match(['GET','POST'],'incomingSilicaSandDetails', 'StockController::loadView_incomingSilicaSandDetails'); +$routes->post('updateIncomingSilicaSandDetails', 'StockController::updateIncomingSilicaSandDetails'); +$routes->get('deleteIncomingSilicaSandDetails', 'StockController::deleteIncomingSilicaSandDetails'); + diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php index 257cfb3e..0afd4edf 100644 --- a/app/Controllers/StockController.php +++ b/app/Controllers/StockController.php @@ -8,6 +8,9 @@ use App\Models\DrierMachineDetailsModel; use App\Models\FactoryMachineModel; use App\Models\FactoryVehicleDieselDetailsModel; use App\Models\FactoryVehicleDieselStockSummaryModel; +use App\Models\IncomingSilicaSandDetailsModel; +use App\Models\Inwardgateregister_model; +use App\Models\Rawmaterialdetails_model; use CodeIgniter\HTTP\ResponseInterface; use DateTime; @@ -20,6 +23,10 @@ class StockController extends BaseController protected $factoryVehicleDieselDetails_model; protected $factoryVehicleDieselStockSummary_model; protected $session; + protected $incomingSilicaSandDetails_model; + protected $inwardGateRegister_model; + protected $rawmaterialdetails_model; + protected $session; /** * This is default constructor of the class @@ -32,6 +39,9 @@ class StockController extends BaseController $this->factoryMachine_model = new FactoryMachineModel(); $this->factoryVehicleDieselDetails_model = new FactoryVehicleDieselDetailsModel(); $this->factoryVehicleDieselStockSummary_model = new FactoryVehicleDieselStockSummaryModel(); + $this->rawmaterialdetails_model = new Rawmaterialdetails_model(); + $this->incomingSilicaSandDetails_model = new IncomingSilicaSandDetailsModel(); + $this->inwardGateRegister_model = new Inwardgateregister_model(); $this->session = session(); helper('form'); @@ -46,13 +56,33 @@ class StockController extends BaseController public function loadView_coatingMachineDetails(){ + if ($this->request->getMethod() === 'POST'){ + $month = $this->request->getPost('month'); + + $date = DateTime::createFromFormat('M-Y', $month); + + $formattedDate = $date->format('Y-m'); + + $month=$formattedDate; + } + else{ + $month = date('Y-m'); + } + $this->global['pageTitle'] = 'Coating Machine Details '; $data['coatingMachineDetails']= $this->coatingMachineDetails_model ->where('is_active', 1) ->orderBy('created_at','DESC') + ->like('created_at', $month, 'after') ->findAll(); + $date = DateTime::createFromFormat('Y-m', $month); + + $formattedDate = $date->format('M-Y'); + + $data['month']=$formattedDate; + return $this->loadViews("CoatingMachineDetail", $this->global, $data, NULL); } @@ -113,6 +143,33 @@ class StockController extends BaseController + public function loadView_incomingSilicaSandDetails(){ + + $month='2024-09'; + $data['month']=$month; + + $this->global['pageTitle']='Incoming Silica Sand Details'; + + $materialCodes = $this->rawmaterialdetails_model->getAllSilicaRawMaterialCode(); + + if (!empty($materialCodes)) { + $data['igrDetails'] = $this->inwardGateRegister_model->findIgrForSilicaSand($materialCodes,$month); + + } else { + $data['igrDetails'] = []; + } + + return $this->loadViews("incomingSilicaSandDetails", $this->global, $data, NULL); + + } + + public function updateIncomingSilicaSandDetails(){ + + } + + public function deleteIncomingSilicaSandDetails(){ + + } diff --git a/app/Models/IncomingSilicaSandDetailsModel.php b/app/Models/IncomingSilicaSandDetailsModel.php new file mode 100644 index 00000000..90df8f2b --- /dev/null +++ b/app/Models/IncomingSilicaSandDetailsModel.php @@ -0,0 +1,50 @@ +getResult(); return $result; } + + public function findIgrForSilicaSand($materialCodes, $month) + { + $builder = $this->db->table('t_igr_details') + ->select( + 't_igr_details.IGRNO, + t_igr_details.Remarks, + t_igr_details.MaterialCode, + igrMast.DeliveryChellanOrInvoiceNo as invoiceNo, + igrMast.DeliveryChellanDate as invoiceDate, + igrMast.MaterialRcvdDate as materialRecievedDate, + igrMast.VehicleNo, + supplierDetails.SupplierName, + SUM(t_igr_details.QuantityAsPerInvoice) as Qty, + issd.* ') + ->whereIn('t_igr_details.MaterialCode', $materialCodes) + ->like('t_igr_details.CreatedDate', $month, 'after') + ->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_purchaseorder_master poMaster', 'poMaster.PONO = igrMast.PONO', 'left') + ->join('t_supplierdetailsn supplierDetails', 'supplierDetails.SupplierID = poMaster.SupplierID', 'left') + ->orderBy('t_igr_details.CreatedDate', 'DESC'); -} \ No newline at end of file + $query = $builder->get(); + $result = $query->getResultArray(); + return $result; + } + + + +} \ No newline at end of file diff --git a/app/Models/Rawmaterialdetails_model.php b/app/Models/Rawmaterialdetails_model.php index c13d89d6..f5d792f3 100755 --- a/app/Models/Rawmaterialdetails_model.php +++ b/app/Models/Rawmaterialdetails_model.php @@ -123,6 +123,19 @@ class Rawmaterialdetails_model extends Model return $query->getResult(); } + function getAllSilicaRawMaterialCode(){ + + $builder = $this->db->table('t_materialmaster') + ->select('MaterialCode') + ->where('IsActive', 1) + ->like('LOWER(MaterialName)', 'silica sand') + ->orderBy('CreatedDate', 'desc'); + $query = $builder->get(); + $materialResults = $query->getResultArray(); + + return $materialCodes = array_column($materialResults, 'MaterialCode'); + } + function getMaterialstock($MaterialCode, $currentdate) diff --git a/app/Views/CoatingMachineDetail.php b/app/Views/CoatingMachineDetail.php index af5ab65d..c89ec637 100644 --- a/app/Views/CoatingMachineDetail.php +++ b/app/Views/CoatingMachineDetail.php @@ -64,10 +64,6 @@ } - - - -
@@ -75,20 +71,6 @@
- -
@@ -113,8 +95,27 @@
+
+
-
+
+
+ + + + + +
+ +
+ +
+ +
+ + @@ -126,12 +127,12 @@ - + - + - - + @@ -231,9 +232,9 @@
* - - + - - + + * - @@ -292,7 +293,7 @@ ' . $formattedHour . ':00 PM'; @@ -412,10 +413,10 @@
* - - - + + - - + + * - - - + + - - + + - function calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOnTimeAmOrPm, machineOffTimeHr, machineOffTimeAmOrPm) { + function calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr) { - let machineOnTime12 = machineOnTimeHr + " " + machineOnTimeAmOrPm; //07:00 PM - let machineOffTime12 = machineOffTimeHr + " " + machineOffTimeAmOrPm; //03:00 PM + let machineOnTime12 = machineOnTimeHr; + let machineOffTime12 = machineOffTimeHr; - let machineOnTime24 = convertTo24HrFormat(machineOnTime12) + ":00"; //19:00:00 - let machineOffTime24 = convertTo24HrFormat(machineOffTime12) + ":00"; //15:00:00 + let machineOnTime24 = convertTo24Hr(machineOnTime12); + let machineOffTime24 = convertTo24Hr(machineOffTime12); + const startDate = new Date(`${machineOnDate}T${machineOnTime24}`); + const endDate = new Date(`${machineOnDate}T${machineOffTime24}`); - let machineOnDateAndTime; - let machineOffDateAndTime; - - if (machineOnTimeAmOrPm == 'PM' && machineOffTimeAmOrPm == 'AM') { - machineOnDateAndTime = machineOnDate + "T" + machineOnTime24; - machineOffDateAndTime = getNextDay(machineOnDate) + "T" + machineOffTime24; - } else { - machineOnDateAndTime = machineOnDate + "T" + machineOnTime24; - machineOffDateAndTime = machineOnDate + "T" + machineOffTime24; - - } - - - let startTime = new Date(machineOnDateAndTime); - let endTime = new Date(machineOffDateAndTime); - - console.log(startTime); //Thu Oct 17 2024 01:00:00 GMT+0530 (India Standard Time) - - console.log(endTime); //Thu Oct 17 2024 05:30:00 GMT+0530 (India Standard Time) - - let startDate = machineOnDateAndTime.split('T')[0]; - let endDate = machineOffDateAndTime.split('T')[0]; - - let timeDifferenceInMs = endTime - startTime; - - - let timeDifferenceInMinutes = Math.floor(timeDifferenceInMs / (1000 * 60)); - let hours = Math.floor(timeDifferenceInMinutes / 60); - let minutes = timeDifferenceInMinutes % 60; - - let timeDifferenceFormatted = `${hours}.${minutes >= 30 ? 5 : 0}`; - - return Math.abs(timeDifferenceFormatted).toFixed(1); + // Handle the case where end time is on the next day + if (endDate < startDate) { + endDate.setDate(endDate.getDate() + 1); } + + // Calculate the difference in milliseconds + const diffInMs = endDate - startDate; + + // Convert milliseconds to hours and minutes + const hours = Math.floor(diffInMs / (1000 * 60 * 60)); + const minutes = Math.floor((diffInMs % (1000 * 60 * 60)) / (1000 * 60)); + + return `${hours}.${minutes >= 30 ? 5 : 0}`; // Return in HH.MM format +} - } + \ No newline at end of file diff --git a/app/Views/includes/new_header.php b/app/Views/includes/new_header.php index e3b8003e..75b91194 100755 --- a/app/Views/includes/new_header.php +++ b/app/Views/includes/new_header.php @@ -67,6 +67,11 @@ + + + + + @@ -762,6 +767,8 @@ 10 TON Drier Details Coating Machine Details + + incoming silica sand Details
diff --git a/app/Views/incomingSilicaSandDetails.php b/app/Views/incomingSilicaSandDetails.php new file mode 100644 index 00000000..f8f521b5 --- /dev/null +++ b/app/Views/incomingSilicaSandDetails.php @@ -0,0 +1,615 @@ + + +
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+
+ + + +
+
+
+
+ + +
+
+ +
+ + " class="form-control" data-provide="datepicker" data-date-format="M-yyyy" data-date-min-view-mode="1"> + +
+
+ +
+
+ + + + + +
+
Shift Machine On Time Machine Off TimeMachine Running (hr)Machine Running(hr) Total CoatingTotal Coating Sand (kg)Total Coating Sand(kg) Total Gas ConsumptionPer Hour Gas ConsumptionPer Hour Coating Sand QTY (kg) + Hour GasHour QTY(kg) Customer Name Action
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
S.NO IGR No Invoice NoInvoice DateReceived DateSupplier NameGrade Grade ConditionVehicle NoQty___10______20______30______40______50______70______100______140______200______300___PANTotalAFS SpecAFS ActualPlus 20 loss%Plus 30 Loss %Moisture % SpecMoisture ActualMoisture LossMoisture loss Qty Sieve Loss Qty Salable Qty Remark
+ + + + + format('d-m-Y'); + ?> + + + format('d-m-Y'); + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+ +
+
+ +
+ +
+
+
+
+
+
+
+
+ + + + + + + + + + + \ No newline at end of file