diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 4795365d..899d0cba 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -443,4 +443,9 @@ $routes->post('updateIncomingSilicaSandDetails', 'StockController::updateIncomin //Bag stock details $routes->match(['GET','POST'],'bagStockDetails', 'StockController::loadView_bagStockDetails'); -$routes->post('updateBagStockDetails', 'StockController::updateBagStockDetails'); \ No newline at end of file +$routes->post('updateBagStockDetails', 'StockController::updateBagStockDetails'); + +//Dust And Rough Stock Details +$routes->match(['GET','POST'],'dustAndRoughStockDetails', 'StockController::loadView_dustAndRoughStockDetails'); +$routes->post('updateDustAndRoughStockDetails', 'StockController::updateDustAndRoughStockDetails'); + diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php index 6852a264..d640aee9 100644 --- a/app/Controllers/StockController.php +++ b/app/Controllers/StockController.php @@ -12,6 +12,7 @@ use App\Models\IncomingSilicaSandDetailsModel; use App\Models\Inwardgateregister_model; use App\Models\Rawmaterialdetails_model; use App\Models\BagStockDetailsModel; +use App\Models\DustAndRoughModel; use CodeIgniter\HTTP\ResponseInterface; use DateTime; @@ -29,6 +30,7 @@ class StockController extends BaseController protected $rawmaterialdetails_model; protected $bagStockDetails_model; protected $Rawmaterialdetails_model; + protected $dustAndRoughStockDetails_model; /** * This is default constructor of the class @@ -46,6 +48,7 @@ class StockController extends BaseController $this->incomingSilicaSandDetails_model = new IncomingSilicaSandDetailsModel(); $this->inwardGateRegister_model = new Inwardgateregister_model(); $this->bagStockDetails_model = new BagStockDetailsModel(); + $this->dustAndRoughStockDetails_model = new DustAndRoughModel(); $this->session = session(); @@ -405,6 +408,88 @@ class StockController extends BaseController echo "Data Saved Successfully"; } + + + //Dust And Rough Stock Details + + public function loadView_dustAndRoughStockDetails(){ + + 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'); + } + + $data=[]; + + $data['month']=$month; + + $this->global['pageTitle']='Dust And Rough Stock Details'; + + $startDate = "$month-01"; + $endDate = date("Y-m-t", strtotime($startDate)); + $data['dustAndRoughStockDetails'] = $this->dustAndRoughStockDetails_model + ->where('date >=', $startDate) + ->where('date <=', $endDate) + ->orderBy('date','asc') + ->findAll(); + + + + $date = DateTime::createFromFormat('Y-m', $month); + + $formattedDate = $date->format('M-Y'); + + $data['month']=$formattedDate; + + return $this->loadViews("dustAndRoughStockDetails", $this->global, $data, NULL); + + } + + public function updateDustAndRoughStockDetails(){ + + $postData = $this->request->getPost(); + + $updateDustAndRoughStockDetailsData = json_decode($postData['updateDustAndRoughStockDetails'], true); + + foreach($updateDustAndRoughStockDetailsData as $data){ + + $date = $data['date']; + + $dbData= [ + 'date' => $data['date'], + 'finalRough' => $data['finalRough'], + 'dust' => $data['dust'], + 'total' => $data['total'] + + ]; + + $resultExists=$this->dustAndRoughStockDetails_model + ->where('date',$date) + ->first(); + + + if(empty($resultExists)){ + $inserted = $this->dustAndRoughStockDetails_model->insert($dbData); + }else{ + $updated=$this->dustAndRoughStockDetails_model + ->where('date',$date) + ->set($dbData) + ->update(); + } + + } + + echo "Data Saved Successfully"; + + } diff --git a/app/Models/DustAndRoughModel.php b/app/Models/DustAndRoughModel.php new file mode 100644 index 00000000..a59b1757 --- /dev/null +++ b/app/Models/DustAndRoughModel.php @@ -0,0 +1,46 @@ + + .num { + text-align: right; + } + + .fht-table, + .fht-table thead, + .fht-table tfoot, + .fht-table tbody, + .fht-table tr, + .fht-table th, + .fht-table td { + margin: 0; + } + + .fht-table td { + text-align: center; + } + + .fht-table td:hover { + background-color: #00a65a; + color: #ffffff; + } + + .fht-table { + border: 0 none; + height: auto; + width: auto; + border-collapse: collapse; + border-spacing: 0; + /*table-layout: fixed; Algoritmo de distribucion fijo */ + white-space: nowrap; + } + + .fht-table th, + .fht-table td { + overflow: hidden; + } + + .fht-table-wrapper, + .fht-table-wrapper .fht-thead, + .fht-table-wrapper .fht-tfoot, + .fht-table-wrapper .fht-fixed-column .fht-tbody, + .fht-table-wrapper .fht-fixed-body .fht-tbody, + .fht-table-wrapper .fht-tbody { + overflow: hidden; + position: relative; + } + + .fht-table-wrapper .fht-fixed-body .fht-tbody, + .fht-table-wrapper .fht-tbody { + overflow: auto; + } + + .fht-table-wrapper .fht-table .fht-cell { + overflow: hidden; + height: 1px; + } + + .fht-table-wrapper .fht-fixed-column, + .fht-table-wrapper .fht-fixed-body { + top: 0; + left: 0; + position: absolute; + } + + .fht-table-wrapper .fht-fixed-column { + z-index: 1; + } + + .fht-fixed-body .fht-thead table { + margin-right: 20px; + border: 0 none; + } + + /*For Examples*/ + + .ContenedorTabla { + height: 500px; + margin: 0 auto; + overflow: auto; + width: auto; + position: relative; + } + + .header, + .main { + display: inline-block; + height: auto; + width: 100%; + } + + .titulosHeader { + border-bottom: 1px solid #e8bb25; + height: auto; + margin-bottom: 10px; + padding-bottom: 8px; + padding-top: 8px; + width: 100%; + } + + + .celda_encabezado_general { + background-color: #00a65a; + border: 1px solid #ccc; + color: #ffffff; + font-weight: bold; + padding: 6px 10px;; + text-align: center; + } + + + ._Separador { + background-color: #fff; + height: 12px; + border-left: 1px solid #ccc; + border-right: 1px solid #ccc; + width: 7px; + } + + ._Separador div { + width: 4px; + } + + .celda_normal { + /*background-color: #fff;*/ + /* */ + text-align: center; + border: 1px solid #ccc; + padding: 2px 4px; + } + + /*style excel*/ + .excel_cell { + border: 1px solid #CCC; + color: #222; + text-align: center; + font-size: 13px; + font-weight: normal; + padding: 4px; + white-space: pre-line; + empty-cells: show; + } + + ._cell_header { + background-color: #EEE; + } + + ._cell_Default { + background-color: #FFF; + text-align: left; + } + + .excel_cell div { + width: 30px; + height: 20px; + } + + .modal { + padding-right: 30% ! important; + } + +
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+
+ + + +
+
+
+
+ + +
+
+ +
+ " + class="form-control mt-2" data-provide="datepicker" + data-date-format="M-yyyy" data-date-min-view-mode="1"> +
+
+ +
+
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + $dustAndRoughStockDetail){ + ?> + + + + + + + + + + + modify('first day of this month')->format('Y-m-d'); + $endDate = $date->modify('last day of this month')->format('Y-m-d'); + + $datesInMonth = []; + + + $period = new DatePeriod( + new DateTime($startDate), + new DateInterval('P1D'), + (new DateTime($endDate))->modify('+1 day') + ); + + foreach ($period as $day) { + $datesInMonth[] = $day->format('Y-m-d'); + } + + foreach($datesInMonth as $datesInMonthIndex => $dateInMonth){ + ?> + + + + + + + + + + + + + + +
Date Final Rough Dust Total
+16 Mesh 10 Ton Dryer
+
+ +
+
+ +
+
+ +
+ +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + diff --git a/app/Views/includes/new_header.php b/app/Views/includes/new_header.php index 20f02474..d41faae6 100755 --- a/app/Views/includes/new_header.php +++ b/app/Views/includes/new_header.php @@ -776,6 +776,8 @@ Diesel - Factory Vehicle Bag Stock Details + + Dust And Rough Stock Details