diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 949b564f..f2f7e9fa 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -66,6 +66,7 @@ $routes->post('rawmaterialdetails/editRawmaterial', 'Rawmaterialdetails::editRaw $routes->get('exportmaterial', 'Rawmaterialdetails::exportmaterial'); $routes->post('deleteMaterial', 'Rawmaterialdetails::deleteMaterial'); $routes->post('reActivateMaterial', 'Rawmaterialdetails::reActivateMaterial'); +$routes->post('materialCodesConfigCategory', 'Rawmaterialdetails::materialCodesConfigCategory'); // Cost Center Routes $routes->match(['GET','POST'],'costListing', 'CostCenter::index'); @@ -145,12 +146,13 @@ $routes->post('configurationctrl/configValueCheck', 'Configurationctrl::configVa $routes->get('configurationctrl/deleteConfigValue', 'Configurationctrl::deleteConfigValue'); $routes->get('configurationctrl/reActivateConfigValue', 'Configurationctrl::reActivateConfigValue'); $routes->get('activeInactiveConfigValue', 'Configurationctrl::activeInactiveConfigValue'); -$routes->post('getPONOcreatedBasedOnConfig', 'Configurationctrl::getPONOcreatedBasedOnConfig'); $routes->get('configurationctrl/editconfig', 'Configurationctrl::editconfig'); +$routes->post('configurationctrl/editconfig', 'Configurationctrl::editconfig'); $routes->post('configurationctrl/updateconfig', 'Configurationctrl::updateconfig'); $routes->post('configurationctrl/configNameCheck', 'Configurationctrl::configNameCheck'); $routes->get('configurationctrl/deleteConfig', 'Configurationctrl::deleteConfig'); $routes->get('configurationctrl/reActivateConfig', 'Configurationctrl::reActivateConfig'); +$routes->post('configurationctrl/saveConfigValue', 'Configurationctrl::saveConfigValue'); // Department Master Routes $routes->match(["GET","POST"],'departmentListing', 'Department::index'); diff --git a/app/Controllers/Configurationctrl.php b/app/Controllers/Configurationctrl.php index 2ca8e311..e98aa1f4 100755 --- a/app/Controllers/Configurationctrl.php +++ b/app/Controllers/Configurationctrl.php @@ -84,13 +84,32 @@ class Configurationctrl extends BaseController function editconfig($ConfigID = '') { - $ConfigID = $this->request->getVar('ConfigID'); + + $isActiveFilter = 1 ; // default flag for active data + $showArchive = 0 ; // default flag for inactive data + + if ($this->request->getMethod() === 'POST') { + + $ConfigID = $this->request->getPost('ConfigID'); + $showArchive = $this->request->getPost('showArchive'); + //reversing condition that when user wants deleted data (archived)to be shown , then we are making active filter 0 + if($showArchive){ + $isActiveFilter = 0; + } + } + + if ($this->request->getMethod() === 'GET') { + $ConfigID = $this->request->getVar('ConfigID'); + } + + $data['showArchive'] = $showArchive; + $data['master'] = $this->configmodel->GetConfigCenterMaster($ConfigID); - $data['child'] = $this->configmodel->GetConfigCenterDetails($ConfigID); + + $data['child'] = $this->configmodel->GetConfigCenterDetails($ConfigID,$isActiveFilter); + $data['ConfigID'] = $ConfigID; $this->global['pageTitle'] = 'Edit Config'; - // echo "
";
- // print_r($data);die;
$this->loadViews("editconfig", $this->global, $data, NULL);
}
@@ -175,7 +194,7 @@ class Configurationctrl extends BaseController
$data = $this->request->getPost();
$configId = $data['configId'];
- $configValue = $data['ConfigValue'];
+ $configValue = str_replace(" ","",$data['configValue']);
$result = $this->configmodel->configValueCheck($configId, $configValue);
@@ -187,9 +206,13 @@ class Configurationctrl extends BaseController
$key = $this->request->getVar('key');
$value = $this->request->getVar('value');
+ $ConfigID = $this->request->getVar('ConfigID');
$where = ['isActive'=> $value];
$result = $this->configmodel->activeInactiveConfigValue($key, $where);
- return redirect()->back();
+
+ return redirect()->to(base_url('configurationctrl/editconfig?ConfigID=' . $ConfigID));
+
+
}
public function getPONOcreatedBasedOnConfig(){
$data = $this->request->getPost();
@@ -223,6 +246,24 @@ class Configurationctrl extends BaseController
return redirect()->back();
}
+ public function saveConfigValue(){
+
+ $data = $this->request->getPost();
+ $configId = $data['ConfigID'];
+ $configValue = $data['ConfigValue'];
+ $key = $data['key']??'';
+
+ $result = $this->configmodel->saveConfigValue($key,$configId, $configValue);
+
+ if($result){
+ return $this->response->setJSON(['status'=>true]);
+ }else{
+ return $this->response->setJSON(['status'=>true]);
+ }
+ }
+
+
+
}
diff --git a/app/Controllers/Rawmaterialdetails.php b/app/Controllers/Rawmaterialdetails.php
index ef947deb..c18cd0a4 100755
--- a/app/Controllers/Rawmaterialdetails.php
+++ b/app/Controllers/Rawmaterialdetails.php
@@ -66,14 +66,14 @@ class Rawmaterialdetails extends BaseController
function rawmaterialListing()
{
- $isActiveFilter = 1 ; // default showing active data
- $showArchive = 0 ; //
+ $isActiveFilter = 1 ; // default flag for active data
+ $showArchive = 0 ; // default flag for inactive data
if ($this->request->getMethod() === 'POST') {
$showArchive = $this->request->getPost('showArchive');
- //reversing condition that when user wants deleted data to be shown we are making active filter
- if($showArchive){
+ //reversing condition that when user wants deleted data (archived)to be shown , then we are making active filter 0
+ if($showArchive){
$isActiveFilter = 0;
}
}
@@ -144,7 +144,7 @@ class Rawmaterialdetails extends BaseController
function addRawMaterial()
{
- $this->rawmaterialdetails_model = new rawmaterialdetails_model();;
+ $this->rawmaterialdetails_model = new rawmaterialdetails_model();
$data['material'] = $this->rawmaterialdetails_model->getmaterialType();
$data['materialcategory'] = $this->rawmaterialdetails_model->getmaterialCategory();
// $data['materialCategoryList']= $this->materialCategories_model->where('is_active',1)->findAll();
@@ -303,6 +303,7 @@ class Rawmaterialdetails extends BaseController
$data['cfUOM'] = $this->rawmaterialdetails_model->getConversionfactorUOM();
$data['assetcode'] = $this->rawmaterialdetails_model->getAssetcode();
$data['avg_price'] = $this->rawmaterialdetails_model->getMaterialAvg($RawMaterialID);
+
//print_r($data['avg_price']);die();
$this->global['pageTitle'] = 'Edit Material Master';
$this->loadViews("editRawmaterial", $this->global, $data, NULL);
@@ -492,5 +493,31 @@ class Rawmaterialdetails extends BaseController
}
+
+
+ function materialCodesConfigCategory (){
+
+ $configKey = $this->request->getPost('configKey');
+
+ //need to get the config key from the post data
+
+ $result = $this->rawmaterialdetails_model->materialCodesConfigCategory($configKey);
+
+ return $this->response->setJSON($result);
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
}
diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php
index dbc2587b..bf26151b 100644
--- a/app/Controllers/StockController.php
+++ b/app/Controllers/StockController.php
@@ -2329,317 +2329,288 @@ class StockController extends BaseController
// Bag Stock details starts
+ public function loadView_bagStockDetails()
+ {
- //custom filterMaterialCode given by user
+ if ($this->request->getMethod() === 'POST') {
+ $month = $this->request->getPost('month');
- //two types of custom filter
+ $date = DateTime::createFromFormat('M-Y', $month);
- //1) fliter for no data present in db - active and is active is not a concern ..!!(for current month)
- // + adding new material in packing material category is not a concern ..!!
- // - deleting existing material in packing material category is not a concern ..!!
+ $formattedDate = $date->format('Y-m');
- //fetch all active material in bag stock then ,
- // i) if no custom filter option given , all active material code going to be present in filterMaterialCode .
- // ii)if custom filter option given , what are all the materials active is going to be filtered among given filterMaterialCode..
+ $month = $formattedDate;
+
+ $session = session ();
+
+ $session->set('stock_month',$month);
- //----------------1st part finished----//
+ } else {
+ $session = session();
- //2) filter for data present in db -- active and is active is a concern ..!!
- // + adding new material category in packing material is a concern ..!!
- // - deleting existing material category in packing material is a concern ..!!
+ $month = $session->get('stock_month');
- //for second case if already material present in db but deleted in material master means
- // i) we need to show the deleted one too for that month .
- // ii)check If they add another material in packing material for current month,
- // we need to put dummy entry(empty string) and show that as well.
-
- //wild scenario if user wants to add an new material and its entry in previous month
- //i) Hard code database entry after consultation can be entertained..!!
-
- //-------------- 2nd part finished -----//
-
-
- // Action
-
-
- public function loadView_bagStockDetails()
- {
-
- if ($this->request->getMethod() === 'POST') {
- $month = $this->request->getPost('month');
-
- $date = DateTime::createFromFormat('M-Y', $month);
-
- $formattedDate = $date->format('Y-m');
-
- $month = $formattedDate;
-
- $session = session ();
-
- $session->set('stock_month',$month);
-
-
- } else {
-
- $session = session();
-
- $month = $session->get('stock_month');
-
- if (empty($month)) {
- $month = date('Y-m'); // Default to the current month
- }
-
- }
-
- $data = [];
-
- $data['month'] = $month;
-
- $this->global['pageTitle'] = 'Bag Stock Details';
-
-
- $startDate = "$month-01";
- $endDate = date("Y-m-t", strtotime($startDate));
-
-
-
- $customisedMaterialCodes = $this->request->getPost('customisedMaterialCodes') ?? [];
-
- $existingCustomMaterialCodes = $this->monthWiseMaterialInStockModel
- ->select('materialCode')
- ->where('date',"$month-01")
- ->where('stock_category','packing_material')
- ->findAll();
-
-
- //check user applies for filter currently
- if(!empty($customisedMaterialCodes)){
-
- //user applied filter,
-
- //check already filter existing , if exists remove that ,
- if(!empty($existingCustomMaterialCodes)){
-
- //hard delete done..!!
- $existingCustomMaterialCodes = $this->monthWiseMaterialInStockModel
- ->where('date',"$month-01")
- ->where('stock_category','packing_material')
- ->delete();
-
- }
-
-
- //if no filter already exists or removed current one , just add current filter for that month ....!!
- $inserts = [];
-
- foreach($customisedMaterialCodes as $index => $customisedMaterialCode){
-
- $inserts [] = [
- 'date' => "$month-01",
- 'stock_category' => "packing_material",
- 'materialCode' => $customisedMaterialCode
- ];
-
- //checking filtered material code present in table , if not create dummy one for whole month
- $findMaterialCode = $this->bagStockDetails_model
- ->where('date >=', $startDate)
- ->where('date <=', $endDate)
- ->where('materialCode',$customisedMaterialCode)
- ->findAll();
-
- //check any material code is not present in stock table but applied in filter
- if(empty($findMaterialCode)){
- //create dummy entry for that
- $this->createDummyEntryForBag($customisedMaterialCode,$startDate,$endDate);
- }
-
+ if (empty($month)) {
+ $month = date('Y-m'); // Default to the current month
}
+
+ }
- if(!empty($inserts)){
- //insert all the latest applied filter
- $this->monthWiseMaterialInStockModel->insertBatch($inserts);
+ $data = [];
- //get the currently applied filter
- $existingCustomMaterialCodes = $this->monthWiseMaterialInStockModel
+ $data['month'] = $month;
+
+ $this->global['pageTitle'] = 'Bag Stock Details';
+
+
+ $startDate = "$month-01";
+ $endDate = date("Y-m-t", strtotime($startDate));
+
+
+
+ ///////////////////////////filter part starts//////////////////////////
+
+
+ $customisedMaterialCodes = $this->request->getPost('customisedMaterialCodes') ?? [];
+
+ $existingCustomMaterialCodes = $this->monthWiseMaterialInStockModel
->select('materialCode')
->where('date',"$month-01")
->where('stock_category','packing_material')
- ->get()->getResultArray();
-
+ ->findAll();
+
+
+ //check user applies for filter currently
+ if(!empty($customisedMaterialCodes)){
+
+ //user applied filter,
+
+ //check already filter existing , if exists remove that ,
+ if(!empty($existingCustomMaterialCodes)){
+
+ //hard delete done..!!
+ $existingCustomMaterialCodes = $this->monthWiseMaterialInStockModel
+ ->where('date',"$month-01")
+ ->where('stock_category','packing_material')
+ ->delete();
+
}
+
+
+ //if no filter already exists or removed current one , just add current filter for that month ....!!
+ $inserts = [];
+
+ foreach($customisedMaterialCodes as $index => $customisedMaterialCode){
+
+ $inserts [] = [
+ 'date' => "$month-01",
+ 'stock_category' => "packing_material",
+ 'materialCode' => $customisedMaterialCode
+ ];
+
+ //checking filtered material code present in table , if not create dummy one for whole month
+ $findMaterialCode = $this->bagStockDetails_model
+ ->where('date >=', $startDate)
+ ->where('date <=', $endDate)
+ ->where('materialCode',$customisedMaterialCode)
+ ->findAll();
+
+ //check any material code is not present in stock table but applied in filter
+ if(empty($findMaterialCode)){
+ //create dummy entry for that
+ $this->createDummyEntryForBag($customisedMaterialCode,$startDate,$endDate);
+ }
+
+ }
+
+ if(!empty($inserts)){
+ //insert all the latest applied filter
+ $this->monthWiseMaterialInStockModel->insertBatch($inserts);
+
+ //get the currently applied filter
+ $existingCustomMaterialCodes = $this->monthWiseMaterialInStockModel
+ ->select('materialCode')
+ ->where('date',"$month-01")
+ ->where('stock_category','packing_material')
+ ->get()->getResultArray();
+
+ }
+
+ }
+
- }
-
-
- //possible if no filter applied at all...!!!
- if(empty($existingCustomMaterialCodes)){
- //no filter applied at all just present all active material codes
- $existingCustomMaterialCodes = $this->rawmaterialdetails_model
- ->getAllBagMaterialCode();
- }else{
- //if filter present,get that material codes
- $existingCustomMaterialCodes = $this->rawmaterialdetails_model
- ->getSelectedBagMaterialCode(array_column($existingCustomMaterialCodes, 'materialCode'));
- }
-
-
- $materialCodeList = array_column($existingCustomMaterialCodes, 'MaterialCode');
-
- $bagMaterials = $existingCustomMaterialCodes ;
-
- $data['activeBagMaterials'] = $this->rawmaterialdetails_model->getAllBagMaterialCode();
-
-
- // 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');
- $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();
-
-
-
- // checking in database if the data is available for the month
-
- $data['bagStockDetails'] = $this->bagStockDetails_model
- ->where('date >=', $startDate)
- ->where('date <=', $endDate)
- ->whereIn('materialCode',$materialCodeList)
- ->groupBy(['materialCode', 'date'])
- ->orderBy('date', 'asc')
- ->orderBy('materialCode', 'asc')
- ->findAll();
-
- // Initialize an empty array to hold the grouped data
- $data['groupedBagStockDetails'] = [];
-
- // Temporary array to store grouped data by date
- $groupedByDate = [];
-
- // Group by 'date'
- foreach ($data['bagStockDetails'] as $detail) {
- $date = $detail['date'];
-
- // Initialize the array for this date if it doesn't exist
- if (!isset($groupedByDate[$date])) {
- $groupedByDate[$date] = [];
+ //possible if no filter applied at all...!!!
+ if(empty($existingCustomMaterialCodes)){
+ //no filter applied at all just present all active material codes
+ $existingCustomMaterialCodes = $this->rawmaterialdetails_model
+ ->getAllBagMaterialCode();
+ }else{
+ //if filter present,get that material codes
+ $existingCustomMaterialCodes = $this->rawmaterialdetails_model
+ ->getSelectedBagMaterialCode(array_column($existingCustomMaterialCodes, 'materialCode'));
}
- /*******************************************************************************************************************
- creating an sub array (inner array) for date wise and append the detail into an array as sub-array
+ $materialCodeList = array_column($existingCustomMaterialCodes, 'MaterialCode');
- $groupedByDate[] outer array
+ $bagMaterials = $existingCustomMaterialCodes ;
- $groupedByDate[$date]
- will look like [[bag1],[bag2],[bag3],[bag4],[bag5]] inner array
-
- the above process is done for single row (date wise) and the same process is repeated for all the rows
- *******************************************************************************************************************/
+ $data['activeBagMaterials'] = $this->rawmaterialdetails_model->getAllBagMaterialCode();
- // Append the detail to the sub-array for this date
- $groupedByDate[$date][] = $detail;
- }
+ ///////////////////////////filter part ends//////////////////////////
- // Reset the structure to have indexed arrays without the date keys
- $data['groupedBagStockDetails'] = array_values($groupedByDate);
-
-
- // getting customer for creating table headers
- // checking already existing stock if yes then get customer from the existing stock
- // if not set customer as '' empty string
-
- foreach ($bagMaterials as $key => $bagMaterial) {
- $materialCode = $bagMaterial['MaterialCode'];
- $bagMaterials[$key]['customers'] = $this->bagStockDetails_model
- ->select('customer')
+
+ // 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');
+ $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();
+
+
+
+ // checking in database if the data is available for the month
+
+ $data['bagStockDetails'] = $this->bagStockDetails_model
->where('date >=', $startDate)
->where('date <=', $endDate)
- ->where('materialCode', $materialCode)
- ->first()['customer'] ?? '';
- }
+ ->whereIn('materialCode',$materialCodeList)
+ ->groupBy(['materialCode', 'date'])
+ ->orderBy('date', 'asc')
+ ->orderBy('materialCode', 'asc')
+ ->findAll();
- $bagMaterialcount = count($bagMaterials);
+ // Initialize an empty array to hold the grouped data
+ $data['groupedBagStockDetails'] = [];
- $data['bagMaterialcount'] = $bagMaterialcount;
- $data['bagMaterials'] = $bagMaterials;
+ // Temporary array to store grouped data by date
+ $groupedByDate = [];
- $date = DateTime::createFromFormat('Y-m', $month);
+ // Group by 'date'
+ foreach ($data['bagStockDetails'] as $detail) {
+ $date = $detail['date'];
- $formattedDate = $date->format('M-Y');
-
- $data['month'] = $formattedDate;
-
- return $this->loadViews("stock/bagStockDetails", $this->global, $data, NULL);
- }
-
- public function updateBagStockDetails()
- {
-
- $postData = $this->request->getPost();
-
- $updateBagStockDetailsData = json_decode($postData['updateBagStockDetails'], true);
-
- $inserts = [];
- $updates = [];
-
- foreach ($updateBagStockDetailsData as $data) {
-
- $date = $data['date'];
- $materialCode = $data['materialCode'];
+ // Initialize the array for this date if it doesn't exist
+ if (!isset($groupedByDate[$date])) {
+ $groupedByDate[$date] = [];
+ }
- $dbData = [
- 'date' => $data['date'],
- 'materialCode' => $data['materialCode'],
- 'customer' => $data['customer'],
- 'opening' => $data['opening'],
- 'receipt' => $data['receipt'],
- 'used' => $data['used'],
- 'balanceStock' => $data['balanceStock'],
- ];
+ /*******************************************************************************************************************
+ creating an sub array (inner array) for date wise and append the detail into an array as sub-array
- $resultExists = $this->bagStockDetails_model
- ->where('date', $date)
- ->where('materialCode', $materialCode)
- ->first();
+ $groupedByDate[] outer array
+
+ $groupedByDate[$date]
+ will look like [[bag1],[bag2],[bag3],[bag4],[bag5]] inner array
+
+ the above process is done for single row (date wise) and the same process is repeated for all the rows
+ *******************************************************************************************************************/
- if (empty($resultExists)) {
- $inserts[] = $dbData;
- } else {
- $dbData['id'] = $resultExists['id'];
- $updates[] = $dbData;
+ // Append the detail to the sub-array for this date
+ $groupedByDate[$date][] = $detail;
}
- }
- if (!empty($inserts)) {
- $inserted = $this->bagStockDetails_model->insertBatch($inserts);
- }
- if (!empty($updates)) {
-
- $updateResult = $this->bagStockDetails_model->updateBatch($updates, 'id');
-
- if ($updateResult === FALSE) {
- echo "Error during update";
- } else {
- echo "Data Updated Successfully";
- return;
+ // Reset the structure to have indexed arrays without the date keys
+ $data['groupedBagStockDetails'] = array_values($groupedByDate);
+
+
+ // getting customer for creating table headers
+ // checking already existing stock if yes then get customer from the existing stock
+ // if not set customer as '' empty string
+
+ foreach ($bagMaterials as $key => $bagMaterial) {
+ $materialCode = $bagMaterial['MaterialCode'];
+ $bagMaterials[$key]['customers'] = $this->bagStockDetails_model
+ ->select('customer')
+ ->where('date >=', $startDate)
+ ->where('date <=', $endDate)
+ ->where('materialCode', $materialCode)
+ ->first()['customer'] ?? '';
}
+
+ $bagMaterialcount = count($bagMaterials);
+
+ $data['bagMaterialcount'] = $bagMaterialcount;
+ $data['bagMaterials'] = $bagMaterials;
+
+ $date = DateTime::createFromFormat('Y-m', $month);
+
+ $formattedDate = $date->format('M-Y');
+
+ $data['month'] = $formattedDate;
+
+ return $this->loadViews("stock/bagStockDetails", $this->global, $data, NULL);
}
- echo "Data Saved Successfully";
- }
+ public function updateBagStockDetails()
+ {
+
+ $postData = $this->request->getPost();
+
+ $updateBagStockDetailsData = json_decode($postData['updateBagStockDetails'], true);
+
+ $inserts = [];
+ $updates = [];
+
+ foreach ($updateBagStockDetailsData 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->bagStockDetails_model
+ ->where('date', $date)
+ ->where('materialCode', $materialCode)
+ ->first();
+
+
+ if (empty($resultExists)) {
+ $inserts[] = $dbData;
+ } else {
+ $dbData['id'] = $resultExists['id'];
+ $updates[] = $dbData;
+ }
+ }
+
+ if (!empty($inserts)) {
+ $inserted = $this->bagStockDetails_model->insertBatch($inserts);
+ }
+ if (!empty($updates)) {
+
+ $updateResult = $this->bagStockDetails_model->updateBatch($updates, 'id');
+
+ if ($updateResult === FALSE) {
+ echo "Error during update";
+ } else {
+ echo "Data Updated Successfully";
+ return;
+ }
+ }
+
+ echo "Data Saved Successfully";
+ }
@@ -2796,7 +2767,7 @@ class StockController extends BaseController
$inserts = [];
- $inserts = $this->generateDummyData($startDate, $endDate);
+ $inserts = $this->createDummyDataForTrp($startDate, $endDate);
$freshEntry = true ;
@@ -3013,70 +2984,6 @@ class StockController extends BaseController
-
- public function generateDummyData($startDate, $endDate)
- {
- $datesInMonth = [];
- $inserts = [];
- $trpAbstract = [] ;
-
- $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) {
-
-
- $inserts[] = [
- 'Date' => $dateInMonth,
- 'openingTime' => " ",
- 'closingTime' => " ",
- 'totalHours' => " ",
- 'coldStart' => " ",
- 'breakdownHours' => " ",
- 'burnerFiringHours' => " ",
- 'sandFeedingHours' => " ",
- 'workingPersonEngineers' => " ",
- 'workingPersonSupervisiors' => " ",
- 'workingPersonOperators' => " ",
- 'rollerDrivers' => " ",
- 'natureOfMaintenance' => '',
- 'location' => '',
- 'description' => '',
- 'gasReceiptBg' => " ",
- 'gasReceiptPg' => " ",
- 'physicalGasConsumption' => " ",
- 'trpPlusDrierGasConsumption' => " ",
- 'trpPhysicalGasPerTon' => " ",
- 'panelGasConsumption' => " ",
- 'panelGasPerTon' => " ",
- 'edRunningHours' => " ",
- 'edProduction' => " ",
- 'edUsage' => " ",
- 'trpProduction' => " ",
- 'trpProductionPerHour' => " ",
- 'waterReceipt' => " ",
- 'waterConsumption' => " ",
- 'ebReading' =>" ",
- 'ebReadingPerUnitTon' =>" ",
- 'msSeperation' => " ",
- 'edWaste' => " ",
- 'coolerBags' =>" ",
- 'edPlus20Waste' => " ",
- 'cycloneWaste' => " "
- ];
- }
-
- return $inserts;
- }
-
-
public function updateAbstractDetails() {
$updateAbstractDetails = json_decode($this->request->getPost('updateAbstractDetails'), true);
@@ -3299,6 +3206,67 @@ class StockController extends BaseController
}
+ public function createDummyDataForTrp($startDate, $endDate)
+ {
+ $datesInMonth = [];
+ $inserts = [];
+ $trpAbstract = [] ;
+
+ $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) {
+
+
+ $inserts[] = [
+ 'Date' => $dateInMonth,
+ 'openingTime' => " ",
+ 'closingTime' => " ",
+ 'totalHours' => " ",
+ 'coldStart' => " ",
+ 'breakdownHours' => " ",
+ 'burnerFiringHours' => " ",
+ 'sandFeedingHours' => " ",
+ 'workingPersonEngineers' => " ",
+ 'workingPersonSupervisiors' => " ",
+ 'workingPersonOperators' => " ",
+ 'rollerDrivers' => " ",
+ 'natureOfMaintenance' => '',
+ 'location' => '',
+ 'description' => '',
+ 'gasReceiptBg' => " ",
+ 'gasReceiptPg' => " ",
+ 'physicalGasConsumption' => " ",
+ 'trpPlusDrierGasConsumption' => " ",
+ 'trpPhysicalGasPerTon' => " ",
+ 'panelGasConsumption' => " ",
+ 'panelGasPerTon' => " ",
+ 'edRunningHours' => " ",
+ 'edProduction' => " ",
+ 'edUsage' => " ",
+ 'trpProduction' => " ",
+ 'trpProductionPerHour' => " ",
+ 'waterReceipt' => " ",
+ 'waterConsumption' => " ",
+ 'ebReading' =>" ",
+ 'ebReadingPerUnitTon' =>" ",
+ 'msSeperation' => " ",
+ 'edWaste' => " ",
+ 'coolerBags' =>" ",
+ 'edPlus20Waste' => " ",
+ 'cycloneWaste' => " "
+ ];
+ }
+
+ return $inserts;
+ }
diff --git a/app/Models/Config_model.php b/app/Models/Config_model.php
index 0bc2af59..cfa08f74 100755
--- a/app/Models/Config_model.php
+++ b/app/Models/Config_model.php
@@ -85,7 +85,6 @@ class Config_model extends Model
$builder = $this->db->table('t_configmaster')
->select('*')
- //->join('t_configdetails con','con.Config_ID = COM.Config_ID','left')
->where('Config_ID', $ConfigID);
$query = $builder->get();
@@ -93,13 +92,14 @@ class Config_model extends Model
return $query->getResult();
}
- function GetConfigCenterDetails($ConfigID = '')
+ function GetConfigCenterDetails($ConfigID = '',$isActiveFilter)
{
//echo $ConfigID ;die();
$builder = $this->db->table('t_configmaster COM')
->select('*')
->join('t_configdetails con', 'con.Config_ID = COM.Config_ID', 'left')
- ->where('COM.Config_ID', $ConfigID);
+ ->where('COM.Config_ID', $ConfigID)
+ ->where('con.isActive', $isActiveFilter);
$query = $builder->get();
return $query->getResult();
@@ -193,13 +193,11 @@ class Config_model extends Model
public function configValueCheck($configId , $configValue){
$builder = $this->db->table('t_configdetails')
- ->where('Config_ID',$configId)
- ->where('configValue ', $configValue);
- $query = $builder->get();
+ ->where('Config_ID',$configId);
+ $builder = $builder->where('REPLACE(configValue , " ", "") ',$configValue);
+ $query = $builder->get();
- // dd( $this->db->getLastQuery());
-
- return $query->getResultArray();
+ return $query->getResultArray();
}
public function activeInactiveConfigValue($key, $value){
@@ -289,4 +287,32 @@ return $result;
// 'PO_RELEASED','ST026'
}
+
+ public function saveConfigValue($key,$configId, $configValue){
+
+
+
+ if(!empty($key)){
+ $builder = $this->db->table('t_configdetails')
+ ->where('Config_ID', $configId)
+ ->where('key',$key)
+ ->update([
+ 'ConfigValue'=> $configValue
+ ]);
+ $res = $this->db->affectedRows();
+ return $res;
+
+ }else{
+ $builder = $this->db->table('t_configdetails');
+ $builder->insert(
+ [
+ 'ConfigValue'=>$configValue,
+ 'Config_ID'=>$configId,
+ 'isActive'=> 1]);
+ $res = $this->db->affectedRows();
+ return $res;
+ }
+
+ }
+
}
\ No newline at end of file
diff --git a/app/Models/Rawmaterialdetails_model.php b/app/Models/Rawmaterialdetails_model.php
index 0cb2b2f8..db3a4132 100755
--- a/app/Models/Rawmaterialdetails_model.php
+++ b/app/Models/Rawmaterialdetails_model.php
@@ -426,4 +426,24 @@ where (CurrentStock+OpeningStock)getResultArray();
}
+
+
+ function materialCodesConfigCategory($configKey){
+
+
+ $builder = $this->db->table('t_materialmaster MM')
+ ->select('MM.MaterialCode,MM.MaterialName,MM.MaterialType,MM.Category,MM.IsActive,MM.UOM')
+ ->where('MM.Category' , $configKey);
+
+ $query = $builder->get();
+ if ($query->getNumRows() > 0) {
+ //return $this->db->getLastQuery();
+ return $query->getResultArray();
+ } else {
+ return [];
+ }
+
+ }
+
+
}
diff --git a/app/Views/configlisting.php b/app/Views/configlisting.php
index 692f8580..0fbe7f95 100755
--- a/app/Views/configlisting.php
+++ b/app/Views/configlisting.php
@@ -123,11 +123,7 @@
-
-
+
@@ -172,34 +168,11 @@
= $record->isActive == 1 ? 'Active' : 'InActive'; ?>
- isActive == 0) { ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
@@ -317,42 +290,3 @@
-
\ No newline at end of file
diff --git a/app/Views/editconfig.php b/app/Views/editconfig.php
index 002f9f9f..af880666 100755
--- a/app/Views/editconfig.php
+++ b/app/Views/editconfig.php
@@ -1,5 +1,5 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/rawmaterialListing.php b/app/Views/rawmaterialListing.php
index fc5811b2..ce32ed3a 100755
--- a/app/Views/rawmaterialListing.php
+++ b/app/Views/rawmaterialListing.php
@@ -34,6 +34,11 @@
.icon-button:hover {
color: #0056b3;
}
+
+ .category-search{
+ width: 20px !important;
+ }
+
@@ -80,8 +85,9 @@
placeholder="Select To Date" autocomplete="off">
-
-