From e4847e4918a8b223a4d56eb6c128b79b1f4b9d4e Mon Sep 17 00:00:00 2001 From: venbatechnologies Date: Fri, 3 Aug 2018 17:09:16 +0530 Subject: [PATCH] reorder and link creation for suppler --- application/config/routes.php | 2 +- application/controllers/batchcard.php | 217 +- application/controllers/cashbook.php | 32 + .../controllers/emergencypurchaseorder.php | 19 +- .../controllers/inwardgateregister.php | 45 +- application/controllers/purchaseorder.php | 28 +- .../controllers/rawmaterialdetails.php | 98 +- application/helpers/cias_helper.php | 15 + .../models/inwardgateregister_model.php | 19 +- .../models/rawmaterialdetails_model.php | 14 +- application/views/FinalProduct.php | 4 +- application/views/addRawMaterial.php | 61 +- application/views/addnewIncomeExpense.php | 317 +- application/views/bankcashnew.php | 329 +++ application/views/editFinalProduct.php | 16 +- application/views/editincomeexpenses.php | 317 +- application/views/includes/header.php | 2605 +++++++++-------- application/views/shortagematerialListing.php | 90 + 18 files changed, 2867 insertions(+), 1361 deletions(-) create mode 100644 application/views/shortagematerialListing.php diff --git a/application/config/routes.php b/application/config/routes.php index af00fe81..61b98200 100755 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -331,5 +331,5 @@ $route['qualityreportlistinward'] = "quality/reportListInward"; /* End of file routes.php */ /* Location: ./application/config/routes.php */ - +$route['shortagematerialListing'] = 'rawmaterialdetails/shortagematerialListing'; diff --git a/application/controllers/batchcard.php b/application/controllers/batchcard.php index 83793281..eda7c00b 100755 --- a/application/controllers/batchcard.php +++ b/application/controllers/batchcard.php @@ -17,7 +17,8 @@ class batchcard extends BaseController public function __construct() { parent::__construct(); - $this->load->model('batchcard_model'); + $this->load->model('batchcard_model'); + $this->load->model('inwardgateregister_model'); $this->isLoggedIn(); $this->load->helper(array('form','url')); date_default_timezone_set('Asia/Kolkata'); @@ -217,8 +218,44 @@ class batchcard extends BaseController $historyadd = $this->batchcard_model->AddMaterialHistory($historytable); + $get_pre_qty= $this->inwardgateregister_model->get_CurrentQty($materialcode); + $av_qty=0; + if(!empty($get_pre_qty)) + { + foreach($get_pre_qty as $gt) + { + $av_qty=$gt->Current_stock; + } + } - if((count($materialadjust)>0) &&(count($historyadd))) + + + if($status == 'Add') + { + $currentav_qty=$av_qty+$absaluteQty; + + } + + else if($status == 'Reduce') + { + + $currentav_qty=$av_qty-$absaluteQty; + + } + + + + + $current_qty= array('Current_stock'=>$currentav_qty); + + $this->inwardgateregister_model->addmaterialmaster($current_qty,$materialcode); + + + + + + +if((count($materialadjust)>0) &&(count($historyadd))) { echo "Material Details Added Successfully"; } @@ -288,10 +325,29 @@ class batchcard extends BaseController $rawarray =array('FPId'=>$final_product_id,'MaterialCode'=>$rawmaterial,'SupplierID'=>$rawsupplier,'Quantity'=>$rawqty,'Price'=>$rawvalue,'CreatedBy'=>$createdby,'CreatedDate'=>$createddt); $rawmaterialhistory= array('MaterialCode'=>$rawmaterial,'Transaction_type'=>'Reduce','Ref_Type'=>'Final Product','Ref_No'=>$final_product_id,'SupplierID'=>$rawsupplier,'Quantity'=>$rawqty,'ItemValue'=>$rawvalue,'CreatedBy'=>$createdby,'CreatedOn'=>$createddt); + //$rawmaterialhistory= array('MaterialCode'=>$rawmaterial,'Transaction_type'=>'Reduce','Ref_Type'=>'Final Product','Ref_No'=>$final_product_id,'SupplierID'=>$rawsupplier,'Quantity'=>$rawqty,'ItemValue'=>$rawvalue,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt); $this->batchcard_model->save_rawmaterialto_materialHistory($rawmaterialhistory); - // print_r($rawarray); + + $rawget_pre_qty= $this->inwardgateregister_model->get_CurrentQty($rawmaterial); + $av_qty=0; + if(!empty($rawget_pre_qty)) + { + foreach($rawget_pre_qty as $gt) + { + $av_qty=$gt->Current_stock; + } + } + + $currentav_qty=$av_qty-$rawqty; + + + $current_qty= array('Current_stock'=>$currentav_qty); + + $this->inwardgateregister_model->addmaterialmaster($current_qty,$rawmaterial); + //print_r($rawarray); // print_r($rawarray); + // print_r($rawmaterialhistory); $this->batchcard_model->save_finalraw($rawarray); @@ -310,6 +366,22 @@ class batchcard extends BaseController $consuhistory= array('MaterialCode'=>$conmaterial,'Transaction_type'=>'Reduce','Ref_Type'=>'Final Product','Ref_No'=>$final_product_id,'SupplierID'=>$consupplier,'Quantity'=>$conqty,'ItemValue'=>$convalue,'CreatedBy'=>$createdby,'CreatedOn'=>$createddt); $this->batchcard_model->save_rawmaterialto_materialHistory($consuhistory); + $conget_pre_qty= $this->inwardgateregister_model->get_CurrentQty($conmaterial); + $conav_qty=0; + if(!empty($conget_pre_qty)) + { + foreach($conget_pre_qty as $gt) + { + $conav_qty=$gt->Current_stock; + } + } + + $concurrentav_qty=$conav_qty-$conqty; + + + $concurrent_qty= array('Current_stock'=>$concurrentav_qty); + + $this->inwardgateregister_model->addmaterialmaster($concurrent_qty,$conmaterial); $this->batchcard_model->save_finalcon($conarray); } @@ -327,6 +399,23 @@ class batchcard extends BaseController $packmathistory= array('MaterialCode'=>$packmaterial,'Transaction_type'=>'Reduce','Ref_Type'=>'Final Product','Ref_No'=>$final_product_id,'SupplierID'=>$packsupplier,'Quantity'=>$packqty,'ItemValue'=>$packvalue,'CreatedBy'=>$createdby,'CreatedOn'=>$createddt); $this->batchcard_model->save_rawmaterialto_materialHistory($packmathistory); + $pacget_pre_qty= $this->inwardgateregister_model->get_CurrentQty($packmaterial); + $pacav_qty=0; + if(!empty($pacget_pre_qty)) + { + foreach($pacget_pre_qty as $gt) + { + $pacav_qty=$gt->Current_stock; + } + } + + $paccurrentav_qty=$pacav_qty-$packqty; + + + $paccurrent_qty= array('Current_stock'=>$paccurrentav_qty); + + $this->inwardgateregister_model->addmaterialmaster($paccurrent_qty,$packmaterial); + $this->batchcard_model->save_finalpacking($packarray); } @@ -407,7 +496,7 @@ class batchcard extends BaseController $rawqty = $this->input->post('rawQty'.$i); $rawvalue = $this->input->post('rawprice'.$i); $rawilneno = $this->input->post('RawId'.$i); - //echo $rawilneno; + $beforawqty = $this->input->post('beforerawQty'.$i); //echo $rawilneno; if($rawmaterial == '' && $rawsupplier == '' & $rawqty == '') { @@ -417,16 +506,55 @@ class batchcard extends BaseController { $rawarray =array('FPId'=>$FPID,'MaterialCode'=>$rawmaterial,'SupplierID'=>$rawsupplier,'Quantity'=>$rawqty,'Price'=>$rawvalue,'CreatedBy'=>$createdby,'CreatedDate'=>$createddt); + $rawmaterialhistory= array('MaterialCode'=>$rawmaterial,'Transaction_type'=>'Reduce','Ref_Type'=>'Final Product','Ref_No'=>$FPID,'SupplierID'=>$rawsupplier,'Quantity'=>$rawqty,'ItemValue'=>$rawvalue,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt); + $checkrawid=$this->batchcard_model->GetRawid($rawilneno); + + $checkrawhistory = $this->batchcard_model->GetRawCheck($rawmaterial,$FPID); + + + $rawget_pre_qty= $this->inwardgateregister_model->get_CurrentQty($rawmaterial); + $av_qty=0; + if(!empty($rawget_pre_qty)) + { + foreach($rawget_pre_qty as $gt) + { + $av_qty=$gt->Current_stock; + } + } + + // echo $av_qty; + // die(); + $qty_dif= $rawqty - $beforawqty; + //echo $qty_dif; + + // if($qty_dif >0) + // { + // echo 'if'; + // $currentav_qty=$av_qty+$qty_dif; + // } + + // else + // { + // echo 'else'; + $currentav_qty=$av_qty-$qty_dif; + // } + + //echo $currentav_qty; + //die(); + + + + + $current_qty= array('Current_stock'=>$currentav_qty); - - $rawmaterialhistory= array('MaterialCode'=>$rawmaterial,'Transaction_type'=>'Reduce','Ref_Type'=>'Final Product','Ref_No'=>$FPID,'SupplierID'=>$rawsupplier,'Quantity'=>$rawqty,'ItemValue'=>$rawvalue,'CreatedBy'=>$createdby,'CreatedOn'=>$createddt); + //print($current_qty); + $this->inwardgateregister_model->addmaterialmaster($current_qty,$rawmaterial); + // $checkrawid=$this->batchcard_model->GetRawid($rawilneno); - $checkrawid=$this->batchcard_model->GetRawid($rawilneno); - - $checkrawhistory = $this->batchcard_model->GetRawCheck($rawmaterial,$FPID); + // $checkrawhistory = $this->batchcard_model->GetRawCheck($rawmaterial,$FPID); // echo $checkrawhistory; @@ -458,7 +586,7 @@ class batchcard extends BaseController $conqty = $this->input->post('consumeQty'.$i); $convalue = $this->input->post('consumeprice'.$i); $consuline = $this->input->post('Consumable'.$i); - + $beforeconqty = $this->input->post('beforeconsumeQty'.$i); if($conmaterial == '' && $consupplier == '' & $conqty == '') { @@ -473,6 +601,39 @@ class batchcard extends BaseController $checkconsuid=$this->batchcard_model->Getconsuid($consuline); + $conget_pre_qty= $this->inwardgateregister_model->get_CurrentQty($conmaterial); + $conav_qty=0; + if(!empty($conget_pre_qty)) + { + foreach($conget_pre_qty as $gt) + { + $conav_qty=$gt->Current_stock; + } + } + + + + $conqty_dif= $conqty - $beforeconqty; + + // if($conqty_dif >0) + // { + // $concurrentav_qty=$conav_qty+$conqty_dif; + // } + + // else + // { + $concurrentav_qty=$conav_qty-$conqty_dif; + //} + + + // $concurrentav_qty=$conav_qty-$conqty; + + + $concurrent_qty= array('Current_stock'=>$concurrentav_qty); + + $this->inwardgateregister_model->addmaterialmaster($concurrent_qty,$conmaterial); + + if(count($checkconsuid)>0) { @@ -500,7 +661,7 @@ class batchcard extends BaseController $packqty = $this->input->post('packQty'.$i); $packvalue = $this->input->post('packprice'.$i); $packlineId = $this->input->post('packId'.$i); - + $beforepacqty = $this->input->post('beforepackQty'.$i); if($packmaterial == '' && $packsupplier == '' & $packqty == '') { @@ -514,7 +675,39 @@ class batchcard extends BaseController $packmathistory= array('MaterialCode'=>$packmaterial,'Transaction_type'=>'Reduce','Ref_Type'=>'Final Product','Ref_No'=>$FPID,'SupplierID'=>$packsupplier,'Quantity'=>$packqty,'ItemValue'=>$packvalue,'CreatedBy'=>$createdby,'CreatedOn'=>$createddt); $checkpackid=$this->batchcard_model->Getpackid($packlineId); - + $pacget_pre_qty= $this->inwardgateregister_model->get_CurrentQty($packmaterial); + $pacav_qty=0; + if(!empty($pacget_pre_qty)) + { + foreach($pacget_pre_qty as $gt) + { + $pacav_qty=$gt->Current_stock; + } + } + + $pacqty_dif= $packqty - $beforepacqty; + + // if($pacqty_dif >0) + // { + // $paccurrentav_qty=$pacav_qty+$pacqty_dif; + // } + + // else + // { + $paccurrentav_qty=$pacav_qty-$pacqty_dif; + //} + + + + // $paccurrentav_qty=$pacav_qty-$packqty; + + + $paccurrent_qty= array('Current_stock'=>$paccurrentav_qty); + + $this->inwardgateregister_model->addmaterialmaster($paccurrent_qty,$packmaterial); + + + if(count($checkpackid)>0) { $this->batchcard_model->update_finalpacking($packarray,$packlineId); diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index 72371caa..42cc14ec 100644 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -2285,7 +2285,39 @@ class cashbook extends BaseController } + public function addNewSupplierCash() + { + $this->load->model('supplier_model'); + $suppliername = $this->input->post('suppliername'); + $contact = $this->input->post('contact'); + $alternatecont = $this->input->post('alternatecont'); + $email = $this->input->post('email'); + $Address = $this->input->post('Address'); + $suparray = array('suppliername'=>$suppliername,'Address'=>$Address,'ContactNumber'=>$contact,'AlternateContactNumber'=>$alternatecont,'EmailAddress'=>$email ); + + $result = $this->supplier_model->addNewsupplier($suparray); + if($result > 0) + { + + echo "New Supplier Created successfully!"; + redirect('addnewIncomeExpense','refresh'); + } + + else + { + + echo "Supplier Record Not Created!"; + redirect('addnewIncomeExpense','refresh'); + } + } + + +public function getAllSupplier() + { + $suplist = $this->cashbook_model->getsupplier(); + echo json_encode($suplist); + } } ?> \ No newline at end of file diff --git a/application/controllers/emergencypurchaseorder.php b/application/controllers/emergencypurchaseorder.php index 5d28b3da..ef08dcac 100755 --- a/application/controllers/emergencypurchaseorder.php +++ b/application/controllers/emergencypurchaseorder.php @@ -612,7 +612,24 @@ $RequestedBy = $this->input->post('drpDepartment'); $MaterialstockHistoryadd= array('Ref_No'=>$IGRItemNo,'MaterialCode'=>$MaterialCode,'Transaction_type'=>'Add','Ref_Type'=>'IGR','SupplierID'=>$SupplierID,'Quantity'=>$QuantityAsPerInvoice,'ItemValue'=>$itemRate,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt); $this->inwardgateregister_model->addMaterialStockHistory($MaterialstockHistoryadd); - + $get_pre_qty= $this->inwardgateregister_model->get_CurrentQty($MaterialCode); + $av_qty=0; + if(!empty($get_pre_qty)) + { + foreach($get_pre_qty as $gt) + { + $av_qty=$gt->Current_stock; + } + } + + $currentav_qty= $QuantityAsPerInvoice+$av_qty; + + + $current_qty= array('Current_stock'=>$currentav_qty); + + $this->inwardgateregister_model->addmaterialmaster($current_qty,$MaterialCode); + + $Recqty = $this->inwardgateregister_model->getPOLineItemReceivedQty($PONO,$MaterialCode); $ReceivedQuantity = 0.00; if(count($Recqty)>0) diff --git a/application/controllers/inwardgateregister.php b/application/controllers/inwardgateregister.php index d9ca0fbf..94c921c6 100755 --- a/application/controllers/inwardgateregister.php +++ b/application/controllers/inwardgateregister.php @@ -470,22 +470,22 @@ $prefile =array(); $this->inwardgateregister_model->addmaterialhistory($historydetails); - // $get_pre_qty= $this->inwardgateregister_model->get_CurrentQty($MaterialCode); - // $av_qty=0; - // if(!empty($get_pre_qty)) - // { - // foreach($get_pre_qty as $gt) - // { - // $av_qty=$gt->Current_stock; - // } - // } + $get_pre_qty= $this->inwardgateregister_model->get_CurrentQty($MaterialCode); + $av_qty=0; + if(!empty($get_pre_qty)) + { + foreach($get_pre_qty as $gt) + { + $av_qty=$gt->Current_stock; + } + } - // $currentav_qty= $QuantityAsPerInvoice+$av_qty; + $currentav_qty= $QuantityAsPerInvoice+$av_qty; - // $current_qty= array('Current_stock'=>$currentav_qty); + $current_qty= array('Current_stock'=>$currentav_qty); - // $this->inwardgateregister_model->addmaterialmaster($current_qty,$MaterialCode); + $this->inwardgateregister_model->addmaterialmaster($current_qty,$MaterialCode); $Recqty = $this->inwardgateregister_model->getPOLineItemReceivedQty($PONO,$MaterialCode); $ReceivedQuantity = 0.00; @@ -805,7 +805,7 @@ $prefile =array(); if(count($addogrmaster)>0) { - $ogrlinearray= $this->inwardgateregister_model->getlastogrline(); + $ogrlinearray= $this->inwardgateregister_model->getlastogrline(); foreach($ogrlinearray as $og) { @@ -830,6 +830,25 @@ $prefile =array(); $this->inwardgateregister_model->addmaterialhistory($historydetails); + $get_pre_qty= $this->inwardgateregister_model->get_CurrentQty($MaterialCode); + $av_qty=0; + if(!empty($get_pre_qty)) + { + foreach($get_pre_qty as $gt) + { + $av_qty=$gt->Current_stock; + } + } + + $currentav_qty=$av_qty-$Outwardtotal; + + + $current_qty= array('Current_stock'=>$currentav_qty); + + $this->inwardgateregister_model->addmaterialmaster($current_qty,$MaterialCode); + + + $this->inwardgateregister_model->UpdateOGRMasterOGRStatus($OGRNO); diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index c6abbc49..dc22e56f 100755 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -1310,7 +1310,33 @@ class purchaseorder extends BaseController - + $rawget_pre_qty= $this->inwardgateregister_model->get_CurrentQty($MaterialCode); + $av_qty=0; + if(!empty($rawget_pre_qty)) + { + foreach($rawget_pre_qty as $gt) + { + $av_qty=$gt->Current_stock; + } + } + + // echo $av_qty; + // die(); + $qty_dif= $Quantity - $b4qty; + + $currentav_qty=$av_qty-$qty_dif; + + + //echo $currentav_qty; + //die(); + + $current_qty= array('Current_stock'=>$currentav_qty); + + + //echo $current_qty; + + $this->inwardgateregister_model->addmaterialmaster($current_qty,$rawmaterial); + } if($SkipInsert == "False") diff --git a/application/controllers/rawmaterialdetails.php b/application/controllers/rawmaterialdetails.php index b6372369..60ec2de7 100755 --- a/application/controllers/rawmaterialdetails.php +++ b/application/controllers/rawmaterialdetails.php @@ -53,7 +53,18 @@ class rawmaterialdetails extends BaseController $this->loadViews("rawmaterialListing", $this->global, $data, NULL); } - + function shortagematerialListing() + { + + $this->load->model('rawmaterialdetails_model'); + + + $data['Records'] = $this->rawmaterialdetails_model->reOrderListing(); + $this->global['pageTitle'] = $this->CompanyName.': ReOrderLevel Listing'; + + $this->loadViews("shortagematerialListing", $this->global, $data, NULL); + + } /** * To load the add new material details */ @@ -130,7 +141,7 @@ class rawmaterialdetails extends BaseController $TempArr = []; $this->form_validation->set_rules('MaterialName','Material Name','trim|required|'); $this->form_validation->set_rules('MaterialType','MaterialType','trim|callback_MaterialType_validate'); - // $this->form_validation->set_rules('MaterialCategory','MaterialCategory','trim|callback_materialcategory_validate'); + $this->form_validation->set_rules('MaterialCategory','MaterialCategory','trim|callback_materialcategory_validate'); $this->form_validation->set_rules('UOM','UOM','trim|callback_UOM_validate'); if($this->form_validation->run() == FALSE) @@ -170,17 +181,58 @@ else $HSN = $this->input->post('HSNcode');//print_r($HSNcode); $stock = $this->input->post('openstock'); $reorder = $this->input->post('reorder'); - $stockdate = $this->input->post('Date'); - if (empty($stockdate)) + $stockdate = $this->input->post('Date'); + + $currentstock = ''; + $today_dt = date('Y-m-d'); + + if (empty($stockdate)) { - $stockdate = NULL; + //$stockdate = NULL; + $stockdate = date("Y-m-d"); + $currentstock = $stock; } else { $stockdate = strtotime( $stockdate); $stockdate = date("Y-m-d ", $stockdate); - } + // } + $todaydateyear = date('Y', strtotime($today_dt)); + $todaydatemonth = date('m', strtotime($today_dt)); + $todaydatedate = date('d', strtotime($today_dt)); + $openstockdateyear = date('Y', strtotime($stockdate)); + $parts = explode('-',$stockdate); + $openstockdatemonth = $parts[1]; + $openstockdatedate = $parts[2]; + + if($openstockdateyear==$todaydateyear) + { + if($openstockdatemonth<=03) + { + $currentstock= 0; + } + + else + { + $currentstock = $stock; + } + + } + + else if($openstockdateyear<$todaydateyear) + { + //$total= $y; + $currentstock= 0; + } + + else if($openstockdateyear>$todaydateyear) + { + $currentstock = $stock; + } + + + } $CreatedBy = $this->session->userdata('userId'); $chked = $this->input->post('isactive'); @@ -227,7 +279,7 @@ else $IsActive = '0'; } - $RawMaterial = array('MaterialName'=>$MaterialName, 'MaterialType'=>$MaterialType, 'UOM'=>$UOM,'Category'=>$MaterialCategory, 'CreatedBy'=>$CreatedBy,'IsActive' => $IsActive,'assetcode'=>$AssetCode,'CostCenterCode'=>$CostCenterCode,'ConversionFactorUnit'=>$ConversionFactor,'ConversionFactorUOM'=>$ConversionFactorUOM,'Remarks'=>$Remarks,'HSNCODE'=>$HSNcode ,'stock'=>$stock,'stockdate'=>$stockdate,'reorder'=>$reorder); + $RawMaterial = array('MaterialName'=>$MaterialName, 'MaterialType'=>$MaterialType, 'UOM'=>$UOM,'Category'=>$MaterialCategory, 'CreatedBy'=>$CreatedBy,'IsActive' => $IsActive,'assetcode'=>$AssetCode,'CostCenterCode'=>$CostCenterCode,'ConversionFactorUnit'=>$ConversionFactor,'ConversionFactorUOM'=>$ConversionFactorUOM,'Remarks'=>$Remarks,'HSNCODE'=>$HSNcode ,'stock'=>$stock,'stockdate'=>$stockdate,'reorder'=>$reorder,'Current_stock'=>$currentstock); $result = $this->rawmaterialdetails_model->addNewRawMaterial($RawMaterial); if($result > 0) @@ -391,7 +443,7 @@ else } $RawMaterial = array(); - $RawMaterial = array('MaterialName'=>$MaterialName,'MaterialType'=>$MaterialType,'UpdatedBy'=>$UpdatedBy, 'UOM'=>$UOM,'IsActive' => $IsActive,'Category'=>$MaterialCategory,'ConversionFactorUnit'=>$ConversionFactor,'ConversionFactorUOM'=>$ConversionFactorUOM,'Remarks'=>$Remarks,'assetcode'=>$AssetCode,'CostCenterCode'=>$CostCenterCode,'HSNCODE'=>$HSNcode); + //$RawMaterial = array('MaterialName'=>$MaterialName,'MaterialType'=>$MaterialType,'UpdatedBy'=>$UpdatedBy, 'UOM'=>$UOM,'IsActive' => $IsActive,'Category'=>$MaterialCategory,'ConversionFactorUnit'=>$ConversionFactor,'ConversionFactorUOM'=>$ConversionFactorUOM,'Remarks'=>$Remarks,'assetcode'=>$AssetCode,'CostCenterCode'=>$CostCenterCode,'HSNCODE'=>$HSNcode); $RawMaterial = array('MaterialName'=>$MaterialName,'MaterialType'=>$MaterialType,'UpdatedBy'=>$UpdatedBy, 'UOM'=>$UOM,'IsActive' => $IsActive,'Category'=>$MaterialCategory,'ConversionFactorUnit'=>$ConversionFactor,'ConversionFactorUOM'=>$ConversionFactorUOM,'Remarks'=>$Remarks,'assetcode'=>$AssetCode,'CostCenterCode'=>$CostCenterCode,'HSNCODE'=>$HSNcode,'stock'=>$stock,'stockdate'=>$stockdate,'reorder'=>$reorder);//,'RMCode'=>$rmcode); $result = $this->rawmaterialdetails_model->editRawmaterial($RawMaterial, $MaterialCode); @@ -434,20 +486,7 @@ function insertvalueintoconfig(){ } - /** - * To Check and display the already existing material list - */ - function checkmaterial() - { - $material = $this->input->post('id'); - $this->load->model('rawmaterialdetails_model'); - $query = $this->rawmaterialdetails_model->checkMaterialExists($material); - echo json_encode($query); - } - - /** - * To export report of material details in excel - */ + function export_material(){ @@ -562,6 +601,21 @@ function insertvalueintoconfig(){ $this->loadViews("404", $this->global, NULL, NULL); } + /** + * To Check and display the already existing material list + */ + function checkmaterial() + { + $material = $this->input->post('id'); + $this->load->model('rawmaterialdetails_model'); + $query = $this->rawmaterialdetails_model->checkMaterialExists($material); + //print_r($query); + echo json_encode($query); + } + + /** + * To export report of material details in excel + */ } ?> \ No newline at end of file diff --git a/application/helpers/cias_helper.php b/application/helpers/cias_helper.php index 52f533db..c7a4e7c4 100755 --- a/application/helpers/cias_helper.php +++ b/application/helpers/cias_helper.php @@ -60,4 +60,19 @@ function get_fav($user) } + function reOrderListing() + { + $CI = &get_instance(); + $CI->load->database(); + + $CI->db->reconnect(); + $subQuery='SELECT * from T_MaterialMaster where Current_stock < reorder?'; + + $query=$CI->db->query($subQuery,array()); + //print_r($this->db->last_query()); + + return $query->result(); + } + + ?> \ No newline at end of file diff --git a/application/models/inwardgateregister_model.php b/application/models/inwardgateregister_model.php index 3617193b..7d2275bb 100755 --- a/application/models/inwardgateregister_model.php +++ b/application/models/inwardgateregister_model.php @@ -269,7 +269,24 @@ class inwardgateregister_model extends CI_Model return true; } - + function addmaterialmaster($current_qty,$MaterialCode) + { + $this->db->where('MaterialCode',$MaterialCode); + $this->db->update('T_MaterialMaster',$current_qty); + return TRUE; + } + + + function get_CurrentQty($MaterialCode) + { + $this->db->select('Current_stock'); + $this->db->from('T_MaterialMaster'); + $this->db->where('T_MaterialMaster.MaterialCode',$MaterialCode); + $query = $this->db->get(); + // print_r( $this->db->last_query()); + $result = $query->result(); + return $result; + } function getitemvalue($pono,$MaterialCode) { $this->db->select('Rate,SupplierID'); diff --git a/application/models/rawmaterialdetails_model.php b/application/models/rawmaterialdetails_model.php index 6d3c8796..c2667012 100755 --- a/application/models/rawmaterialdetails_model.php +++ b/application/models/rawmaterialdetails_model.php @@ -97,7 +97,7 @@ class rawmaterialdetails_model extends CI_Model $this->db->insert('T_MaterialMaster', $RawMaterial); return TRUE; } - + /** * This function used to get user information by id * @param number $userId : This is user id @@ -196,7 +196,7 @@ class rawmaterialdetails_model extends CI_Model $this->db->join('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid','left'); return $this->db->get('T_MaterialMaster as det')->result_array(); } - + function checkMaterialExists($material) { @@ -246,5 +246,15 @@ class rawmaterialdetails_model extends CI_Model $temp['suggestions'] = $temparr; return $temp; } + function reOrderListing() + { + + $subQuery='SELECT * from T_MaterialMaster where Current_stock < reorder?'; + + $query=$this->db->query($subQuery,array()); + //print_r($this->db->last_query()); + + return $query->result(); + } } ?> \ No newline at end of file diff --git a/application/views/FinalProduct.php b/application/views/FinalProduct.php index 663810b5..a12ff5f3 100755 --- a/application/views/FinalProduct.php +++ b/application/views/FinalProduct.php @@ -2052,7 +2052,7 @@ var stock_date_date = ''; stock_date_date = split[2]; } - }); + }) if(((materialcode != 0)&&(supplier != 0))) { @@ -2198,7 +2198,7 @@ var stock_date_date = ''; stock_date_date = split[2]; } - }); + }) if(((materialcode != 0)&&(supplier != 0))) { diff --git a/application/views/addRawMaterial.php b/application/views/addRawMaterial.php index 52b46f90..35f8b5b8 100755 --- a/application/views/addRawMaterial.php +++ b/application/views/addRawMaterial.php @@ -227,7 +227,7 @@ $(function() { - + - +
+ load->helper('form'); + $error = $this->session->flashdata('error'); + if($error) + { + ?> +
+ + session->flashdata('error'); ?> +
+ + session->flashdata('success'); + if($success) + { + ?> +
+ + session->flashdata('success'); ?> +
+ + +
+
+ ', '
'); ?> +
+
+ + @@ -417,4 +446,32 @@ $('#content').loader('show'); }); }); +function Validate() +{ + if($("#MaterialName").val().length < 1) + { + alert('Please Enter MaterialName'); + $("#MaterialName").focus(); + return false; + } + + if($("option:selected", $("#UOM")).val() == "") + { + alert('Please Select UOM '); + $("#UOM").focus(); + return false; + } + if($("option:selected", $("#MaterialCategory")).val() == "") + { + alert('Please Select Material Category'); + $("#MaterialCategory").focus(); + return false; + } + if($("option:selected", $("#MaterialType")).val() == "") + { + alert('Please Select Material Type'); + $("#MaterialType").focus(); + return false; + } +} \ No newline at end of file diff --git a/application/views/addnewIncomeExpense.php b/application/views/addnewIncomeExpense.php index 41598f75..fa4d7f34 100644 --- a/application/views/addnewIncomeExpense.php +++ b/application/views/addnewIncomeExpense.php @@ -8,7 +8,10 @@ background-color:#A1887F; } - +.modalfooter +{ + background-color:white; !important +} /* Style the buttons inside the tab */ .tab button { background-color: inherit; @@ -43,6 +46,29 @@ background-color:skyblue; /* background-color: darkgrey; */ outline: 1px solid slategrey; +} + .modal +{ + padding-right:25% ! important; +} +.dataTables_paginate +{ + margin-top: -5%; +} +.dataTables_wrapper { + padding-bottom: 0px; +} +.badge + { + color:red; background-color:#fff; + } + + legend{ + color:#00c0ef ! important; + } + + .content { + Padding:0% ! important; }
@@ -101,15 +127,24 @@
-
+
+
Select Supplier: *

- + Add New Supplier
+ +
+ + + + + +
@@ -218,7 +253,7 @@
@@ -258,7 +293,7 @@
- + Add New Supplier @@ -381,6 +416,70 @@ + +
+
+ + +
+
\ No newline at end of file diff --git a/application/views/bankcashnew.php b/application/views/bankcashnew.php index d37cfa06..2a6e8493 100644 --- a/application/views/bankcashnew.php +++ b/application/views/bankcashnew.php @@ -286,10 +286,35 @@ $('#Paymentmerchant').autocomplete({ /* background-color: darkgrey; */ outline: 1px solid slategrey; } + +.modal +{ + padding-right:25% ! important; +} +.dataTables_paginate +{ + margin-top: -5%; +} +.dataTables_wrapper { + padding-bottom: 0px; +} +.badge + { + color:red; background-color:#fff; + } + + legend{ + color:#00c0ef ! important; + } + + .content { + Padding:0% ! important; +}
+
Back
@@ -360,6 +385,7 @@ $('#Paymentmerchant').autocomplete({ Account Name Select: *

@@ -375,8 +401,100 @@ $('#Paymentmerchant').autocomplete({ Select Supplier: *

+ + + + Add New Supplier + + + + + + +
+
+Add Line Item + +
+
+ + + + + +
+
+ Total Amount:*

+ + +
+
+
+ Description:

+ + +
@@ -541,6 +659,7 @@ $('#Paymentmerchant').autocomplete({ Select Supplier: *

@@ -1174,6 +1293,216 @@ $('#addPayment').submit(); } +$('#supplier').change(function() { + + var drpval = $('#supplier').val(); + if(drpval == 1) + { + //alert() + $('#Addsup').modal('show'); + } + +}); +function onlyAlphabets(evt) +{ + var charCode; + if (window.event) + charCode = window.event.keyCode; //for IE + else + charCode = evt.which; //for firefox + if (charCode == 32) //for <space> symbol + return true; + if (charCode > 31 && charCode < 65) //for characters before 'A' in ASCII Table + return false; + if (charCode > 90 && charCode < 97) //for characters between 'Z' and 'a' in ASCII Table + return false; + if (charCode > 122) //for characters beyond 'z' in ASCII Table + return false; + return true; +} + +function getContactNumberValidation() +{ + + var contactNumber = $('#ContactNumber').val(); + var telephone =/^[0-9]{3,4}\s[0-9]{8,9}$/.test(contactNumber); + var regex = /^[0-9]{4,6}\s[0-9]{5,7}$/.test(contactNumber); + var mobilephone = /^[0-9]{10,12}$/.test(contactNumber); + + if(contactNumber!='') + { + + if(telephone) + { + + return true; + } + + else if(regex) + { + + return true; + } + else if(mobilephone) + { + + return true; + } + + else + { + alert('Please Enter valid Contact Number ex: 044 12345678 , 0444 1234567,04444 123456 and 9876543210'); + return false; + } + } + else + { + + alert('please correct format of contact number'); + return false; + } + } + + + + function isNumberKey(evt) + { + var charCode = (evt.which) ? evt.which : evt.keyCode; + if (charCode != 46 && charCode != 32 && charCode >= 33 + && (charCode < 48 || charCode > 57)) + return false; + + return true; + } + + function validateEmail() { + var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; + + var email = $('#emailid').val(); + + if(email != '') + { + if (reg.test(email) == false) + { + alert('Please Enter Valid Email Address'); + return (false); + } + else + { + return true; + } + } + else + { + alert('Please Enter email id'); + } + +} + + +function validatesup() +{ + // var a= $('#supplierName').val(); + // alert(a); + + if($("#supplierName").val().length < 1) + { + alert('Please Enter Supplier Name'); + $("#supplierName").focus(); + return false; + } + + if(!getContactNumberValidation()) + { + $("#ContactNumber").focus(); + return false; + } + + if(!validateEmail()) + { + $('#emailid').focus(); + return false; + } + + if($("#Address").val().length < 1) + { + alert('Please Enter Address'); + $("#Address").focus(); + return false; + } + + else + { + return true; + } +} + + +$('.AddSupplier').click(function() +{ + if(validatesup()) + { + var suppliername = $('#supplierName').val(); + var contact = $('#ContactNumber').val(); + var alternatecont = $('#AlternateContactNumber').val(); + var email = $('#emailid').val(); + var Address = $('#Address').val(); + $('#content').loader('show'); + $.ajax({ + + data:{suppliername:suppliername,contact:contact,alternatecont:alternatecont,email:email,Address:Address}, + type:"POST", + url:"cashbook/addNewSupplierCash", + + success:function(data) + { + // $('#content').loader('hide'); + // alert(data); + // location.reload(); + + + var alertdata=data; + + $.ajax({ + + type:"POST", + url:"cashbook/getAllSupplier", + success:function(data) + { + var html = ''; + $('#supplier').find('option:not(:first)').remove(); + + $.each(JSON.parse(data), function (supDet, supobj) + { + + // html +=""; + + $("#supplier").append( $('').val(supobj.SupplierID).html(supobj.SupplierID+' - '+supobj.SupplierName)); + + }); + + //$("#supplier").append(html); + alert(alertdata); + // $('#supplier option[value=""]').prop('selected', true); + $('#content').loader('hide'); + $('#Addsup').modal('hide'); + + + + } + + + }); + + } + + }); + + + } +}); + + diff --git a/application/views/editFinalProduct.php b/application/views/editFinalProduct.php index a0f176f4..d0d42b10 100755 --- a/application/views/editFinalProduct.php +++ b/application/views/editFinalProduct.php @@ -434,6 +434,8 @@ $(function() { + + @@ -698,8 +700,10 @@ $(function() { + + - + @@ -950,7 +954,7 @@ $(function() { - + @@ -1914,7 +1918,7 @@ function ResultantQty(materialtype) //console.log(openqty); } - }); + }) // alert("add"+materialcode); // alert("add"+supplier); @@ -2071,7 +2075,7 @@ var stock_date = ''; stock_date_date = split[2]; } - }); + }) if(((materialcode != 0)&&(supplier != 0))) { @@ -2134,7 +2138,7 @@ var stock_date = ''; } }); - var resultantqty = parseFloat(addqty)- parseFloat(reduceqty); + // var resultantqty = parseFloat(addqty)- parseFloat(reduceqty); if(stock_date_year==today_year) { @@ -2217,7 +2221,7 @@ var stock_date_date = ''; stock_date_date = split[2]; } -}); +}) if(((materialcode != 0)&&(supplier != 0))) { diff --git a/application/views/editincomeexpenses.php b/application/views/editincomeexpenses.php index 160ab911..5bf68209 100644 --- a/application/views/editincomeexpenses.php +++ b/application/views/editincomeexpenses.php @@ -93,6 +93,35 @@ if(!empty($PaymentMultiple)) }} ?> +
@@ -170,11 +199,16 @@ if(!empty($PaymentMultiple)) Select Supplier: *

-
- + + + Add New Supplier + + +
> GST @@ -325,6 +359,7 @@ if(!empty($PaymentMultiple))
+ Add New Supplier
@@ -539,6 +574,72 @@ if(!empty($PaymentMultiple)) + +
+
+Add Line Item + +
+
+ + \ No newline at end of file diff --git a/application/views/includes/header.php b/application/views/includes/header.php index df225cb1..ba494245 100755 --- a/application/views/includes/header.php +++ b/application/views/includes/header.php @@ -165,1347 +165,1370 @@
-
- -
+ - - -
+ + +
+ + + + - - - + + + +
  • + + View Inward Gate Register + +
  • + +
  • + + View Material Inspection Report + +
  • + +
  • + + + Outward Gate Register Entry + +
  • + +
  • + + + View Outward Gate Register + +
  • + + + + + + + + + + + + + + AssDep; + + //echo $assd; + + if($assd == STORE || $DEPCode == QUALITY || $assd == QUALITY || $DEPCode == STORE || $DEPCode == SECURITY || $assd == SECURITY){ $check = $check+1;?> + +
  • + + + Inspection + + + + + +
  • + + + + + + + + + +
  • + + + Payslip + + + + + +
  • + + + + AssDep; + if($assd == HR || $DEPCode == HR){ $check = $check+1;?> +
  • + + + Payslip + + + + + +
  • + + + + + + + + + + +
  • + + + Attendance + + + + + +
  • + + + + + AssDep;?> + +
  • + + + Attendance + + + + + +
  • + + + + + + + + + + +
  • + + + Stock Details + + + + +
  • + + + + AssDep;?> + +
  • + + + Stock Details + + + + +
  • + + + + + + + + + + + +
  • + + + Report List + + + + +
  • + + + + + AssDep;?> + +
  • + + + Report List + + + + +
  • + + + + + + + + + + + +
    - + \ No newline at end of file diff --git a/application/views/shortagematerialListing.php b/application/views/shortagematerialListing.php new file mode 100644 index 00000000..d51039a5 --- /dev/null +++ b/application/views/shortagematerialListing.php @@ -0,0 +1,90 @@ + + +
    + + + +
    +
    +
    +
    +
    + + +

    +
    + +
    + + + + + + + + + + + + $re) + { + $index = $index + 1; + ?> + + + + + + + + + + +
    #Material CodeMaterial NameAvailable QuantityReorder Level
    MaterialCode;?>MaterialName;?>Current_stock;?>reorder;?>
    +
    + +
    + + +
    + +
    + +
    + +
    + + + + +