stock module - 31-04-2025
This commit is contained in:
parent
8028fb5c26
commit
5e6f769624
@ -162,7 +162,7 @@ class StockController extends BaseController
|
||||
$month = $this->request->getPost('month');
|
||||
|
||||
//formatting the date format of Jan-2025 to 2025-01
|
||||
$date = DateTime::createFromFormat('M-Y', $month);
|
||||
$date = DateTime::createFromFormat('d-M-Y', '01-'.$month);
|
||||
|
||||
$formattedDate = $date->format('Y-m');
|
||||
|
||||
@ -227,8 +227,7 @@ class StockController extends BaseController
|
||||
//['factory manager', 'lab head']
|
||||
$data['approvedBy'] = $this->employeedetails_model->incomingSilicaSandApprovedBy();
|
||||
|
||||
|
||||
$date = DateTime::createFromFormat('Y-m', $month);
|
||||
$date = DateTime::createFromFormat('Y-m-d', $month.'-01');
|
||||
|
||||
$formattedDate = $date->format('M-Y');
|
||||
|
||||
@ -394,6 +393,7 @@ class StockController extends BaseController
|
||||
|
||||
// Convert the month format from "M-Y" (Jan-2025) to "Y-m" (2025-01) for database processing
|
||||
$date = DateTime::createFromFormat('M-Y', $currentMonth);
|
||||
|
||||
$formattedDate = $date->format('Y-m');
|
||||
|
||||
|
||||
@ -554,8 +554,10 @@ class StockController extends BaseController
|
||||
$month = $this->request->getPost('month');
|
||||
|
||||
// Convert month format from "M-Y" to "Y-m"
|
||||
$date = DateTime::createFromFormat('M-Y', $month);
|
||||
$date = DateTime::createFromFormat('d-M-Y', '01-'.$month);
|
||||
|
||||
$formattedDate = $date->format('Y-m');
|
||||
|
||||
$month = $formattedDate;
|
||||
|
||||
// Store selected month in session
|
||||
@ -598,8 +600,10 @@ class StockController extends BaseController
|
||||
->findAll();
|
||||
|
||||
// Convert month format from "Y-m" to "M-Y" for display
|
||||
$date = DateTime::createFromFormat('Y-m', $month);
|
||||
$date = DateTime::createFromFormat('Y-m-d', $month.'-01');
|
||||
|
||||
$formattedDate = $date->format('M-Y');
|
||||
|
||||
$data['month'] = $formattedDate;
|
||||
|
||||
// Load the view with the required data
|
||||
@ -953,7 +957,7 @@ class StockController extends BaseController
|
||||
|
||||
$month = $this->request->getPost('month');
|
||||
|
||||
$date = DateTime::createFromFormat('M-Y', $month);
|
||||
$date = DateTime::createFromFormat('d-M-Y', '01-'.$month);
|
||||
|
||||
$formattedDate = $date->format('Y-m');
|
||||
|
||||
@ -980,7 +984,7 @@ class StockController extends BaseController
|
||||
$this->global['pageTitle'] = "Gas Stock Details";
|
||||
|
||||
|
||||
$previousMonth = DateTime::createFromFormat('Y-m', $month)->modify('-1 month')->format('Y-m');
|
||||
$previousMonth = DateTime::createFromFormat('Y-m-d', $month.'-01')->modify('-1 month')->format('Y-m');
|
||||
$previousMonthStartDate = "$previousMonth-01";
|
||||
$previousMonthEndDate = date("Y-m-t", strtotime($previousMonthStartDate));
|
||||
$data['previousMonthGasStockDetails'] = $this->gasStockDetails_model
|
||||
@ -1034,7 +1038,11 @@ class StockController extends BaseController
|
||||
|
||||
|
||||
|
||||
$data['month'] = DateTime::createFromFormat('Y-m', $month)->format('M-Y');
|
||||
$date = DateTime::createFromFormat('Y-m-d', $month.'-01');
|
||||
|
||||
$formattedDate = $date->format('M-Y');
|
||||
|
||||
$data['month'] = $formattedDate;
|
||||
|
||||
return $this->loadViews("stock/gasStockDetails", $this->global, $data, NULL);
|
||||
}
|
||||
@ -1253,7 +1261,7 @@ class StockController extends BaseController
|
||||
|
||||
$month = $this->request->getPost('month');
|
||||
|
||||
$date = DateTime::createFromFormat('M-Y', $month);
|
||||
$date = DateTime::createFromFormat('d-M-Y', '01-'.$month);
|
||||
|
||||
$formattedDate = $date->format('Y-m');
|
||||
|
||||
@ -1397,7 +1405,7 @@ class StockController extends BaseController
|
||||
|
||||
// Get the previous month's last date diesel stock details for next month updation
|
||||
|
||||
$previousMonth = DateTime::createFromFormat('Y-m', $month)->modify('-1 month')->format('Y-m');
|
||||
$previousMonth = DateTime::createFromFormat('Y-m-d', $month.'-01')->modify('-1 month')->format('Y-m');
|
||||
$previousMonthStartDate = "$previousMonth-01";
|
||||
$previousMonthEndDate = date("Y-m-t", strtotime($previousMonthStartDate));
|
||||
|
||||
@ -1533,7 +1541,7 @@ class StockController extends BaseController
|
||||
$data['dieselMachinesCount'] = $dieselMachinesCount;
|
||||
$data['dieselMachines'] = $dieselMachines;
|
||||
|
||||
$date = DateTime::createFromFormat('Y-m', $month);
|
||||
$date = DateTime::createFromFormat('Y-m-d', $month.'-01');
|
||||
|
||||
$formattedDate = $date->format('M-Y');
|
||||
|
||||
@ -1667,7 +1675,7 @@ class StockController extends BaseController
|
||||
|
||||
$month = $this->request->getPost('month');
|
||||
|
||||
$date = DateTime::createFromFormat('M-Y', $month); //in M-Y format
|
||||
$date = DateTime::createFromFormat('d-M-Y', '01-'.$month); //in M-Y format
|
||||
|
||||
$formattedDate = $date->format('Y-m'); //in Y-m format
|
||||
|
||||
@ -1821,7 +1829,7 @@ class StockController extends BaseController
|
||||
|
||||
// Get the previous month's last date power consumption stock details for next month updation
|
||||
|
||||
$previousMonth = DateTime::createFromFormat('Y-m', $month)->modify('-1 month')->format('Y-m');
|
||||
$previousMonth = DateTime::createFromFormat('Y-m-d', $month.'-01')->modify('-1 month')->format('Y-m');
|
||||
$previousMonthStartDate = "$previousMonth-01";
|
||||
$previousMonthEndDate = date("Y-m-t", strtotime($previousMonthStartDate));
|
||||
|
||||
@ -1954,7 +1962,7 @@ class StockController extends BaseController
|
||||
$data['electricMachinesCount'] = $electricMachinesCount;
|
||||
$data['electricMachines'] = $electricMachines;
|
||||
|
||||
$date = DateTime::createFromFormat('Y-m', $month);
|
||||
$date = DateTime::createFromFormat('Y-m-d', $month.'-01');
|
||||
|
||||
$formattedDate = $date->format('M-Y');
|
||||
|
||||
@ -2093,7 +2101,7 @@ class StockController extends BaseController
|
||||
if ($this->request->getMethod() === 'POST') {
|
||||
$month = $this->request->getPost('month');
|
||||
|
||||
$date = DateTime::createFromFormat('M-Y', $month);
|
||||
$date = DateTime::createFromFormat('d-M-Y', '01-'.$month);
|
||||
|
||||
$formattedDate = $date->format('Y-m');
|
||||
|
||||
@ -2127,7 +2135,7 @@ class StockController extends BaseController
|
||||
->orderBy('date', 'asc')
|
||||
->findAll();
|
||||
|
||||
$date = DateTime::createFromFormat('Y-m', $month);
|
||||
$date = DateTime::createFromFormat('Y-m-d', $month.'-01');
|
||||
|
||||
$formattedDate = $date->format('M-Y');
|
||||
|
||||
@ -2201,7 +2209,7 @@ class StockController extends BaseController
|
||||
|
||||
$month = $this->request->getPost('month');
|
||||
|
||||
$date = DateTime::createFromFormat('M-Y', $month);
|
||||
$date = DateTime::createFromFormat('d-M-Y', '01-'.$month);
|
||||
|
||||
$formattedDate = $date->format('Y-m');
|
||||
|
||||
@ -2329,7 +2337,7 @@ class StockController extends BaseController
|
||||
|
||||
// Get the previous month's last date resin stock details for next month updation
|
||||
|
||||
$previousMonth = DateTime::createFromFormat('Y-m', $month)->modify('-1 month')->format('Y-m');
|
||||
$previousMonth = DateTime::createFromFormat('Y-m-d', $month.'-01')->modify('-1 month')->format('Y-m');
|
||||
$previousMonthStartDate = "$previousMonth-01";
|
||||
$previousMonthEndDate = date("Y-m-t", strtotime($previousMonthStartDate));
|
||||
$data['previousMonthResinStockDetails'] = $this->resinStockDetails_model
|
||||
@ -2460,7 +2468,7 @@ class StockController extends BaseController
|
||||
$data['resinMaterialCount'] = $resinMaterialCount;
|
||||
$data['resinMaterials'] = $resinMaterials;
|
||||
|
||||
$date = DateTime::createFromFormat('Y-m', $month);
|
||||
$date = DateTime::createFromFormat('Y-m-d', $month.'-01');
|
||||
|
||||
$formattedDate = $date->format('M-Y');
|
||||
|
||||
@ -2573,7 +2581,7 @@ class StockController extends BaseController
|
||||
if ($this->request->getMethod() === 'POST') {
|
||||
$month = $this->request->getPost('month');
|
||||
|
||||
$date = DateTime::createFromFormat('M-Y', $month);
|
||||
$date = DateTime::createFromFormat('d-M-Y', '01-'.$month);
|
||||
|
||||
$formattedDate = $date->format('Y-m');
|
||||
|
||||
@ -2711,7 +2719,7 @@ class StockController extends BaseController
|
||||
|
||||
// Get the previous month's last date bag stock details for next month updation
|
||||
|
||||
$previousMonth = DateTime::createFromFormat('Y-m', $month)->modify('-1 month')->format('Y-m');
|
||||
$previousMonth = DateTime::createFromFormat('Y-m-d', $month.'-01')->modify('-1 month')->format('Y-m');
|
||||
$previousMonthStartDate = "$previousMonth-01";
|
||||
$previousMonthEndDate = date("Y-m-t", strtotime($previousMonthStartDate));
|
||||
$data['previousMonthBagStockDetails'] = $this->bagStockDetails_model
|
||||
@ -2844,7 +2852,7 @@ class StockController extends BaseController
|
||||
$data['bagMaterialcount'] = $bagMaterialcount;
|
||||
$data['bagMaterials'] = $bagMaterials;
|
||||
|
||||
$date = DateTime::createFromFormat('Y-m', $month);
|
||||
$date = DateTime::createFromFormat('Y-m-d', $month.'-01');
|
||||
|
||||
$formattedDate = $date->format('M-Y');
|
||||
|
||||
@ -2933,7 +2941,7 @@ class StockController extends BaseController
|
||||
if ($this->request->getMethod() === 'POST') {
|
||||
$month = $this->request->getPost('month');
|
||||
|
||||
$date = DateTime::createFromFormat('M-Y', $month);
|
||||
$date = DateTime::createFromFormat('d-M-Y', '01-'.$month);
|
||||
|
||||
$formattedDate = $date->format('Y-m');
|
||||
|
||||
@ -2962,7 +2970,7 @@ class StockController extends BaseController
|
||||
->orderBy('date', 'asc')
|
||||
->findAll();
|
||||
|
||||
$date = DateTime::createFromFormat('Y-m', $month);
|
||||
$date = DateTime::createFromFormat('Y-m-d', $month.'-01');
|
||||
|
||||
$formattedDate = $date->format('M-Y');
|
||||
|
||||
@ -3038,7 +3046,7 @@ class StockController extends BaseController
|
||||
if ($this->request->getMethod() === 'POST') {
|
||||
$month = $this->request->getPost('month');
|
||||
|
||||
$date = DateTime::createFromFormat('M-Y', $month);
|
||||
$date = DateTime::createFromFormat('d-M-Y', '01-'.$month);
|
||||
|
||||
$formattedDate = $date->format('Y-m');
|
||||
|
||||
@ -3133,7 +3141,7 @@ class StockController extends BaseController
|
||||
|
||||
// dd((int)$trpAbstract["Incoming Raw Sand Details"]['opening_stock']);
|
||||
|
||||
$date = DateTime::createFromFormat('Y-m', $month);
|
||||
$date = DateTime::createFromFormat('Y-m-d', $month.'-01');
|
||||
|
||||
$formattedDate = $date->format('M-Y');
|
||||
|
||||
@ -3393,7 +3401,7 @@ class StockController extends BaseController
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------- in class helpers----------------------------------------------
|
||||
// -------------------------------------------- in class helpers ----------------------------------------------
|
||||
|
||||
|
||||
public function getMonthDatesFromInput($monthYear)
|
||||
|
||||
@ -322,8 +322,16 @@
|
||||
|
||||
<div class="col-2">
|
||||
<?php $today = date('M-Y'); ?>
|
||||
<input type="text" name="month" id="month" value="<?php echo "$month" ?>" class="form-control " data-provide="datepicker" data-date-format="M-yyyy" data-date-min-view-mode="1" readonly>
|
||||
|
||||
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
|
||||
class="form-control "
|
||||
data-provide="datepicker"
|
||||
data-date-format="M-yyyy"
|
||||
data-date-min-view-mode="1"
|
||||
readonly>
|
||||
|
||||
<input type="hidden" name="remark" id="remark" value="<?php echo $remark ?>">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@ -400,6 +400,7 @@ foreach ($period as $day) {
|
||||
2)choose which material/machines you want
|
||||
------------------------------------------------------------>
|
||||
|
||||
|
||||
<div>
|
||||
<div class="modal fade" id="customizeModalId" tabindex="-1" role="dialog" aria-labelledby="customizeModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-md">
|
||||
@ -414,7 +415,7 @@ foreach ($period as $day) {
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label for="customizeHeader"> Add For This Month </label>
|
||||
<select id="customizeHeader" class="form-control" onchange="addBackToList()">
|
||||
<select id="customizeHeader" class="form-control select2" onchange="addBackToList()">
|
||||
<option value="">Select</option>
|
||||
<?php
|
||||
foreach ($activeElectricMachines as $index => $activeElectricMachine) { ?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user