From e007d6a299bcfb205804a9917c2e2e4659332426 Mon Sep 17 00:00:00 2001 From: vadivel J Date: Thu, 7 Nov 2024 12:12:42 +0530 Subject: [PATCH 1/5] bag stock changes --- app/Controllers/StockController.php | 32 ++++-- app/Views/bagStockDetails.php | 166 +++++++++++++++------------- 2 files changed, 116 insertions(+), 82 deletions(-) diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php index 1a9278c8..ea126722 100644 --- a/app/Controllers/StockController.php +++ b/app/Controllers/StockController.php @@ -281,6 +281,22 @@ class StockController extends BaseController $this->global['pageTitle']='Bag Stock Details'; + + $previousMonth = DateTime::createFromFormat('Y-m', $month)->modify('-1 month')->format('Y-m'); + $previousMonthStartDate = "$previousMonth-01"; + $previousMonthEndDate = date("Y-m-t", strtotime($previousMonthStartDate)); + $data['previousMonthBagStockDetails'] = $this->bagStockDetails_model + ->select(['materialCode', 'date' ,'balanceStock']) + ->distinct() + ->where('date =', $previousMonthEndDate) + ->groupBy(['materialCode','date']) + ->orderBy('date','desc') + ->orderBy('materialCode','asc') + ->findAll(); + + + + $startDate = "$month-01"; $endDate = date("Y-m-t", strtotime($startDate)); $data['bagStockDetails'] = $this->bagStockDetails_model @@ -322,16 +338,16 @@ class StockController extends BaseController foreach($bagMaterials as $key => $bagMaterial){ $materialCode = $bagMaterial['MaterialCode']; $bagMaterials[$key]['customers'] = $this->bagStockDetails_model - ->select('customer') + ->select('customer') ->where('date >=', $startDate) ->where('date <=', $endDate) - ->where('materialCode', $materialCode) - ->first()['customer'] ?? ''; - } - - $bagMaterialcount = count($bagMaterials); - - $data['bagMaterialcount'] = $bagMaterialcount; + ->where('materialCode', $materialCode) + ->first()['customer'] ?? ''; + } + + $bagMaterialcount = count($bagMaterials); + + $data['bagMaterialcount'] = $bagMaterialcount; $data['bagMaterials'] = $bagMaterials; $date = DateTime::createFromFormat('Y-m', $month); diff --git a/app/Views/bagStockDetails.php b/app/Views/bagStockDetails.php index ff8bd25c..620639f7 100644 --- a/app/Views/bagStockDetails.php +++ b/app/Views/bagStockDetails.php @@ -217,9 +217,7 @@ material - - - + @@ -230,11 +228,12 @@ - Customer - + Customer - + @@ -268,11 +267,7 @@ //dd($groupedBagStockDetails); foreach($groupedBagStockDetails as $groupedBagStockDetailsIndex => $bagStockDetails){ ?> - - - - - + $bagStock){ ?> - + + + - + - + + - modify('first day of this month')->format('Y-m-d'); - $endDate = $date->modify('last day of this month')->format('Y-m-d'); + $startDate = $date->modify('first day of this month')->format('Y-m-d'); + $endDate = $date->modify('last day of this month')->format('Y-m-d'); - $datesInMonth = []; + $datesInMonth = []; - $period = new DatePeriod( - new DateTime($startDate), - new DateInterval('P1D'), - (new DateTime($endDate))->modify('+1 day') - ); + $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 ($period as $day) { + $datesInMonth[] = $day->format('Y-m-d'); + } - ?> + ?> - $dateInMonth){ ?> - - $bagMaterial){ ?> - + $dateInMonth){ ?> + + $bagMaterial){ ?> + - - format('d-m-Y'); - ?> - - + + format('d-m-Y'); + ?> + + + + + + + - - - - - - - - + + + - - - + + + - - - oninput="openingStockChange(this)" - contenteditable="true" + + + oninput="openingStockChange(this)" + contenteditable="true" - - >0 + + > - 0 + 0 - 0 + 0 - 0 + 0 + + - - @@ -490,13 +493,15 @@ const table = $('#bagStockDetailsTableId'); const rows = []; - + //this table to json is customized for bagstock not for all + table.find('tbody tr').each(function() { const rowCells = $(this).find('td'); const date = rowCells.eq(0).text().trim(); - + /** we get eight entries against a material so we loop from 1 to 7 and so on + in a single row **/ for (let i = 1; i < rowCells.length; i += 7) { const rowData = { date: rowCells.eq(i).text().trim(), @@ -620,6 +625,19 @@ } }) } + + function updateCustomerForMaterial(){ + return + } + + function customerChange(thElement){ + let materialCode = thElement.getAttribute('data-materialCode'); + let newCustomerValue = thElement.innerText; + let matchingCustomerData = document.querySelectorAll(`td.customer[data-materialCode="${materialCode}"]`); + matchingCustomerData.forEach((element,index)=>{ + element.innerText=newCustomerValue; + }) + } From 5860aae8632b40f5a4a9875bf51bde8397d45b5f Mon Sep 17 00:00:00 2001 From: vadivel J Date: Thu, 7 Nov 2024 12:25:25 +0530 Subject: [PATCH 2/5] finished bag stock completely --- app/Views/bagStockDetails.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Views/bagStockDetails.php b/app/Views/bagStockDetails.php index 620639f7..f1c50511 100644 --- a/app/Views/bagStockDetails.php +++ b/app/Views/bagStockDetails.php @@ -390,7 +390,7 @@ contenteditable="true" - > + > 0 + > From c6821967d61291b00485b2ebbf420f1381cf70b2 Mon Sep 17 00:00:00 2001 From: vadivel J Date: Thu, 7 Nov 2024 17:25:48 +0530 Subject: [PATCH 3/5] finished dust and rough module --- app/Config/Routes.php | 7 +- app/Controllers/StockController.php | 85 +++++ app/Models/DustAndRoughModel.php | 46 +++ app/Views/bagStockDetails.php | 4 - app/Views/dustAndRoughStockDetails.php | 458 +++++++++++++++++++++++++ app/Views/includes/new_header.php | 2 + 6 files changed, 597 insertions(+), 5 deletions(-) create mode 100644 app/Models/DustAndRoughModel.php create mode 100644 app/Views/dustAndRoughStockDetails.php 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 From 8653ea2889937e1b2e596f0b1371ccce9351949a Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Thu, 7 Nov 2024 20:23:45 +0530 Subject: [PATCH 4/5] changes in stock controller --- app/Controllers/StockController.php | 39 +++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php index d640aee9..0232b05a 100644 --- a/app/Controllers/StockController.php +++ b/app/Controllers/StockController.php @@ -459,6 +459,10 @@ class StockController extends BaseController $updateDustAndRoughStockDetailsData = json_decode($postData['updateDustAndRoughStockDetails'], true); + $updates = []; + + $inserts = []; + foreach($updateDustAndRoughStockDetailsData as $data){ $date = $data['date']; @@ -474,18 +478,31 @@ class StockController extends BaseController $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(); - } - + + + if (empty($resultExists)) { + $inserts[] = $dbData; + + } else { + $updates[] = $dbData; + } } + + if (!empty($inserts)) { + $this->dustAndRoughStockDetails_model->insertBatch($inserts); + } + + if (!empty($updates)) { + + $updateResult = $this->dustAndRoughStockDetails_model->updateBatch($updates, 'date'); + + if ($updateResult === FALSE) { + echo "Error during update"; + } else { + echo "Data Updated Successfully"; + return; + } + } echo "Data Saved Successfully"; From 590e2fd1ecfd3e0c3af9854fa1665e313a6a8812 Mon Sep 17 00:00:00 2001 From: vadivel J Date: Fri, 8 Nov 2024 11:10:04 +0530 Subject: [PATCH 5/5] resin stock changes -vadivel J --- app/Config/Routes.php | 3 + app/Controllers/StockController.php | 180 ++++++- app/Models/Rawmaterialdetails_model.php | 14 + app/Models/ResinStockModel.php | 48 ++ app/Views/dustAndRoughStockDetails.php | 12 +- app/Views/includes/new_header.php | 3 + app/Views/resinStockDetails.php | 640 ++++++++++++++++++++++++ 7 files changed, 887 insertions(+), 13 deletions(-) create mode 100644 app/Models/ResinStockModel.php create mode 100644 app/Views/resinStockDetails.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 899d0cba..f4eb2bdf 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -449,3 +449,6 @@ $routes->post('updateBagStockDetails', 'StockController::updateBagStockDetails') $routes->match(['GET','POST'],'dustAndRoughStockDetails', 'StockController::loadView_dustAndRoughStockDetails'); $routes->post('updateDustAndRoughStockDetails', 'StockController::updateDustAndRoughStockDetails'); +//Resin stock details +$routes->match(['GET','POST'],'resinStockDetails', 'StockController::loadView_resinStockDetails'); +$routes->post('updateResinStockDetails', 'StockController::updateResinStockDetails'); \ No newline at end of file diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php index d640aee9..63ddd1e9 100644 --- a/app/Controllers/StockController.php +++ b/app/Controllers/StockController.php @@ -13,6 +13,7 @@ use App\Models\Inwardgateregister_model; use App\Models\Rawmaterialdetails_model; use App\Models\BagStockDetailsModel; use App\Models\DustAndRoughModel; +use App\Models\ResinStockModel; use CodeIgniter\HTTP\ResponseInterface; use DateTime; @@ -31,6 +32,7 @@ class StockController extends BaseController protected $bagStockDetails_model; protected $Rawmaterialdetails_model; protected $dustAndRoughStockDetails_model; + protected $resinStockDetails_model; /** * This is default constructor of the class @@ -39,16 +41,27 @@ class StockController extends BaseController { $this->db = \Config\Database::connect(); parent::__construct(); - $this->coatingMachineDetails_model = new CoatingMachineDetailsModel(); - $this->drierMachineDetails_model = new DrierMachineDetailsModel(); - $this->factoryMachine_model = new FactoryMachineModel(); - $this->factoryVehicleDieselDetails_model = new FactoryVehicleDieselDetailsModel(); + $this->coatingMachineDetails_model = new CoatingMachineDetailsModel(); + + $this->drierMachineDetails_model = new DrierMachineDetailsModel(); + + $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->bagStockDetails_model = new BagStockDetailsModel(); - $this->dustAndRoughStockDetails_model = new DustAndRoughModel(); + + $this->rawmaterialdetails_model = new Rawmaterialdetails_model(); + + $this->incomingSilicaSandDetails_model = new IncomingSilicaSandDetailsModel(); + + $this->inwardGateRegister_model = new Inwardgateregister_model(); + + $this->bagStockDetails_model = new BagStockDetailsModel(); + + $this->dustAndRoughStockDetails_model = new DustAndRoughModel(); + + $this->resinStockDetails_model = new ResinStockModel() ; $this->session = session(); @@ -441,8 +454,6 @@ class StockController extends BaseController ->orderBy('date','asc') ->findAll(); - - $date = DateTime::createFromFormat('Y-m', $month); $formattedDate = $date->format('M-Y'); @@ -492,6 +503,153 @@ class StockController extends BaseController } + //Resin Stock Details + + public function loadView_resinStockDetails(){ + + 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']='Resin Stock Details'; + + + $previousMonth = DateTime::createFromFormat('Y-m', $month)->modify('-1 month')->format('Y-m'); + $previousMonthStartDate = "$previousMonth-01"; + $previousMonthEndDate = date("Y-m-t", strtotime($previousMonthStartDate)); + $data['previousMonthResinStockDetails'] = $this->resinStockDetails_model + ->select(['materialCode', 'date' ,'balanceStock']) + ->distinct() + ->where('date =', $previousMonthEndDate) + ->groupBy(['materialCode','date']) + ->orderBy('date','desc') + ->orderBy('materialCode','asc') + ->findAll(); + + + + + $startDate = "$month-01"; + $endDate = date("Y-m-t", strtotime($startDate)); + $data['resinStockDetails'] = $this->resinStockDetails_model + ->where('date >=', $startDate) + ->where('date <=', $endDate) + ->groupBy(['materialCode','date']) + ->orderBy('date','asc') + ->orderBy('materialCode','asc') + ->findAll(); + + // Initialize an empty array to hold the grouped data + $data['groupedResinStockDetails'] = []; + + // Temporary array to store grouped data by date + $groupedByDate = []; + + // Group by 'date' + foreach ($data['resinStockDetails'] as $detail) { + $date = $detail['date']; + + // Initialize the array for this date if it doesn't exist + if (!isset($groupedByDate[$date])) { + $groupedByDate[$date] = []; + } + + // Append the detail to the sub-array for this date + $groupedByDate[$date][] = $detail; + } + + // Reset the structure to have indexed arrays without the date keys + $data['groupedResinStockDetails'] = array_values($groupedByDate); + + + + $resinMaterials= $this->rawmaterialdetails_model->getAllResinMaterialCode(); + + foreach($resinMaterials as $key => $resinMaterial){ + $materialCode = $resinMaterial['MaterialCode']; + $resinMaterials[$key]['customers'] = $this->bagStockDetails_model + ->select('customer') + ->where('date >=', $startDate) + ->where('date <=', $endDate) + ->where('materialCode', $materialCode) + ->first()['customer'] ?? ''; + } + + $resinMaterialCount = count($resinMaterials); + + $data['resinMaterialCount'] = $resinMaterialCount; + $data['resinMaterials'] = $resinMaterials; + + $date = DateTime::createFromFormat('Y-m', $month); + + $formattedDate = $date->format('M-Y'); + + $data['month']=$formattedDate; + + return $this->loadViews("resinStockDetails", $this->global, $data, NULL); + + } + + public function updateResinStockDetails(){ + + + $postData = $this->request->getPost(); + + $updateResinStockDetailsData = json_decode($postData['updateResinStockDetails'], true); + + foreach($updateResinStockDetailsData as $data){ + + $date = $data['date']; + $materialCode = $data['materialCode']; + + + $dbData= [ + 'date' =>$data['date'], + 'materialCode' =>$data['materialCode'], + 'customer' =>$data['customer'], + 'opening' =>$data['opening'], + 'receipt' =>$data['receipt'], + 'used' =>$data['used'], + 'balanceStock' =>$data['balanceStock'], + ]; + + $resultExists = $this->resinStockDetails_model + ->where('date',$date) + ->where('materialCode',$materialCode) + ->first(); + + + if(!empty($resultExists)){ + + $updated = $this->resinStockDetails_model + ->where('date',$date) + ->where('materialCode',$materialCode) + ->set($dbData) + ->update(); + + }else{ + $inserted = $this->resinStockDetails_model->insert($dbData); + } + + } + + echo "Data Saved Successfully"; + + } diff --git a/app/Models/Rawmaterialdetails_model.php b/app/Models/Rawmaterialdetails_model.php index 45981afe..0a0cb488 100755 --- a/app/Models/Rawmaterialdetails_model.php +++ b/app/Models/Rawmaterialdetails_model.php @@ -150,6 +150,20 @@ class Rawmaterialdetails_model extends Model } + function getAllResinMaterialCode(){ + + $builder = $this->db->table('t_materialmaster') + ->select('MaterialCode , MaterialName') + ->where('IsActive', 1) + ->where('Category', 'plastic_chemicals') + ->orderBy('MaterialCode', 'asc'); + $query = $builder->get(); + $materialResults = $query->getResultArray(); + + return $materialResults; + + } + function getMaterialstock($MaterialCode, $currentdate) diff --git a/app/Models/ResinStockModel.php b/app/Models/ResinStockModel.php new file mode 100644 index 00000000..22b6efca --- /dev/null +++ b/app/Models/ResinStockModel.php @@ -0,0 +1,48 @@ + $dustAndRoughStockDetail){ ?> - + + + $dateInMonth){ ?> - + + + Bag Stock Details Dust And Rough Stock Details + + Resin Stock Details + diff --git a/app/Views/resinStockDetails.php b/app/Views/resinStockDetails.php new file mode 100644 index 00000000..6a9787dd --- /dev/null +++ b/app/Views/resinStockDetails.php @@ -0,0 +1,640 @@ + +
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+
+ + + +
+
+
+
+ + +
+
+ +
+ " + class="form-control mt-2" data-provide="datepicker" + data-date-format="M-yyyy" data-date-min-view-mode="1"> +
+
+ +
+
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $bagStockDetails){ + ?> + + $bagStock){ ?> + + format('d-m-Y'); + ?> + + + + + + + + + + + + + + + + + + + + + + + + + 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'); + } + + ?> + + $dateInMonth){ ?> + + $bagMaterial){ ?> + + + + format('d-m-Y'); + ?> + + + + + + + + + + + + + + + + + + + + + + + +
material + + +
Customer + +
Date Opening StockReceiptUsedBalance Stock
+ + + + + oninput="openingStockChange(this)" + contenteditable="true" + + + > + + + + + +
+ + + + oninput="openingStockChange(this)" + contenteditable="true" + + + >00
+
+ +
+
+ +
+
+ +
+ +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + +