From b24a58b44b41dc0e5a5d348a56066825b03f1c77 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Tue, 17 Jul 2018 18:45:14 +0530 Subject: [PATCH] reorder level --- application/config/routes.php | 3 + application/controllers/batchcard.php | 236 +++++++++++++++++- .../controllers/emergencypurchaseorder.php | 27 +- .../controllers/inwardgateregister.php | 63 +++-- application/controllers/purchaseorder.php | 32 +++ .../controllers/rawmaterialdetails.php | 63 ++++- application/helpers/cias_helper.php | 12 + .../models/inwardgateregister_model.php | 69 ++--- .../models/rawmaterialdetails_model.php | 14 ++ application/views/FinalProduct.php | 2 +- application/views/addRawMaterial.php | 2 + application/views/editFinalProduct.php | 12 +- application/views/includes/header.php | 69 ++++- application/views/shortagematerialListing.php | 85 +++++++ 14 files changed, 607 insertions(+), 82 deletions(-) create mode 100644 application/views/shortagematerialListing.php diff --git a/application/config/routes.php b/application/config/routes.php index fd0f41c9..05f76592 100755 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -358,3 +358,6 @@ $route['MaterialHistory'] = "batchcard/material_history"; $route['EditFinalProduct'] = "batchcard/EditFinalProduct"; + +$route['shortagematerialListing'] = 'rawmaterialdetails/shortagematerialListing'; + diff --git a/application/controllers/batchcard.php b/application/controllers/batchcard.php index 249ca1aa..8d868b83 100755 --- a/application/controllers/batchcard.php +++ b/application/controllers/batchcard.php @@ -18,6 +18,7 @@ class batchcard extends BaseController { parent::__construct(); $this->load->model('batchcard_model'); + $this->load->model('inwardgateregister_model'); $this->isLoggedIn(); $this->load->helper(array('form','url')); date_default_timezone_set('Asia/Kolkata'); @@ -1468,6 +1469,45 @@ 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($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"; @@ -1496,7 +1536,7 @@ class batchcard extends BaseController - // $final_product_id= $final_master_save[0]['PId']; + //$final_product_id= $final_master_save[0]['PId']; $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $createddt = $dt->format('Y-m-d H:i:s'); @@ -1530,13 +1570,32 @@ class batchcard extends BaseController $rawqty = $this->input->post('rawQty'.$i); $rawvalue = $this->input->post('rawprice'.$i); + + $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); - $this->batchcard_model->save_rawmaterialto_materialHistory($rawmaterialhistory); + $this->batchcard_model->save_rawmaterialto_materialHistory($rawmaterialhistory); + + $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); $this->batchcard_model->save_finalraw($rawarray); @@ -1550,12 +1609,32 @@ class batchcard extends BaseController $conqty = $this->input->post('consumeQty'.$i); $convalue = $this->input->post('consumeprice'.$i); + + $conarray =array('FPId'=>$final_product_id,'MaterialCode'=>$conmaterial,'SupplierID'=>$consupplier,'Quantity'=>$conqty,'Price'=>$convalue,'CreatedBy'=>$createdby,'CreatedDate'=>$createddt); $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); } @@ -1567,12 +1646,34 @@ class batchcard extends BaseController $packqty = $this->input->post('packQty'.$i); $packvalue = $this->input->post('packprice'.$i); + + $packarray =array('FPId'=>$final_product_id,'MaterialCode'=>$packmaterial,'SupplierID'=>$packsupplier,'Quantity'=>$packqty,'Price'=>$packvalue,'CreatedBy'=>$createdby,'CreatedDate'=>$createddt); $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); } @@ -1594,7 +1695,7 @@ class batchcard extends BaseController $copfinal_history = array('RefID'=>$final_product_id,'ProductCode'=>$copmaterial,'Quantity'=>$copqty,'Price'=>$copvalue,'Transactiondate'=>$createddt,'TransactionType'=>'Inward'); - $final_cophistory_save= $this->batchcard_model->SaveFinalHistory($copfinal_history); + $final_cophistory_save= $this->batchcard_model->SaveFinalHistory($copfinal_history); } echo "Details Saved Successfully"; @@ -1652,6 +1753,12 @@ class batchcard extends BaseController $rawqty = $this->input->post('rawQty'.$i); $rawvalue = $this->input->post('rawprice'.$i); $rawilneno = $this->input->post('RawId'.$i); + + $beforawqty = $this->input->post('beforerawQty'.$i); + + // echo $beforawqty; + // die(); + //echo $rawilneno; if($rawmaterial == '' && $rawsupplier == '' & $rawqty == '') { @@ -1662,9 +1769,6 @@ 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); @@ -1672,9 +1776,47 @@ class batchcard extends BaseController $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); + + //print($current_qty); + + $this->inwardgateregister_model->addmaterialmaster($current_qty,$rawmaterial); + - // echo $checkrawhistory; - if(count($checkrawid)==0) { @@ -1704,6 +1846,9 @@ class batchcard extends BaseController $convalue = $this->input->post('consumeprice'.$i); $consuline = $this->input->post('Consumable'.$i); + $beforeconqty = $this->input->post('beforeconsumeQty'.$i); + + if($conmaterial == '' && $consupplier == '' & $conqty == '') { @@ -1719,6 +1864,41 @@ 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) { $this->batchcard_model->update_finalconsu($conarray,$consuline); @@ -1746,6 +1926,9 @@ class batchcard extends BaseController $packvalue = $this->input->post('packprice'.$i); $packlineId = $this->input->post('packId'.$i); + $beforepacqty = $this->input->post('beforepackQty'.$i); + + if($packmaterial == '' && $packsupplier == '' & $packqty == '') { @@ -1759,6 +1942,43 @@ 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) { diff --git a/application/controllers/emergencypurchaseorder.php b/application/controllers/emergencypurchaseorder.php index 6dc40404..3a8ef067 100644 --- a/application/controllers/emergencypurchaseorder.php +++ b/application/controllers/emergencypurchaseorder.php @@ -997,7 +997,32 @@ $RequestedBy = $this->input->post('drpDepartment'); $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); + + + + + //*==================================================*/ diff --git a/application/controllers/inwardgateregister.php b/application/controllers/inwardgateregister.php index d179429a..8a835f3c 100644 --- a/application/controllers/inwardgateregister.php +++ b/application/controllers/inwardgateregister.php @@ -37,7 +37,7 @@ class inwardgateregister extends BaseController function viewIGRDetails() { - + $this->load->model('inwardgateregister_model'); $this->global['pageTitle'] = 'Siddharth : Inward Gate Register Details'; $data['IGR']= $this->inwardgateregister_model->igrListing(); @@ -280,7 +280,7 @@ class inwardgateregister extends BaseController function addloadfile() { - $upfiles = ''; + $pono= $this->input->post('PONO'); $igr= $this->input->post('igr'); @@ -573,7 +573,7 @@ $prefile =array(); //echo $IGRNO; $IGRItemStatus = REQITEM_NEW; - $TotalPendingQty = ''; + for ($i = 1; $i <= $RowCount; $i++) { @@ -590,7 +590,6 @@ $prefile =array(); //echo $QuantityAsPerInvoice; //echo $PendingQty.'ReceivedQty'.$ReceivedQty; //echo ' '; - $TotalPendingQty = $TotalPendingQty + $PendingQty; if(strlen($QuantityAsPerInvoice)>0 && $QuantityAsPerInvoice != '0') { @@ -643,10 +642,26 @@ $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= $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) { @@ -665,16 +680,7 @@ $prefile =array(); } - - $this->inwardgateregister_model->UpdatePOMaster($PONO,$CreatedBy); - if($TotalPendingQty == 0.00){ - - $Newstatus = array('Status'=>IGR_CREATED); - - $this->inwardgateregister_model->POLineItemsupdatestatus($PONO,$Newstatus); - $this->inwardgateregister_model->pomasterupdatestatus($PONO,$Newstatus); - } - else{ /*echo 'error' ;*/ } + $this->inwardgateregister_model->UpdatePOMaster($PONO,$CreatedBy); echo ""; //echo 'Successfully Created IGR Number:'. $IGRNO; } @@ -693,10 +699,7 @@ $prefile =array(); function ViewIGRfile() { $IGRNO= $this->input->post('id'); - $PO =$this->input->post('id1'); - $igrfile = $this->inwardgateregister_model->viewIGRFile($IGRNO); - $billfile = $this->inwardgateregister_model->viewIGRFile1($IGRNO); - $data = array_merge($igrfile,$billfile); + $data = $this->inwardgateregister_model->viewIGRFile($IGRNO); echo json_encode($data); } @@ -902,6 +905,28 @@ $prefile =array(); + $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); $this->inwardgateregister_model->UpdateMRIRMasterOGRStatus($MRIRNO,$OGRNO); diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index 14a8cd04..231e2bbe 100644 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -1395,6 +1395,38 @@ function edited(){ $this->purchaseorder_model->updateMatStock($itemNo, $MaterialstockHistoryupdate); + + + + + $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); + + diff --git a/application/controllers/rawmaterialdetails.php b/application/controllers/rawmaterialdetails.php index f3681e27..83cbf5cb 100755 --- a/application/controllers/rawmaterialdetails.php +++ b/application/controllers/rawmaterialdetails.php @@ -49,6 +49,21 @@ 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'] = 'Siddharth : ReOrderLevel Listing'; + + $this->loadViews("shortagematerialListing", $this->global, $data, NULL); + + } + /** * This function is used to load the add new cost */ function addRawMaterial() @@ -162,15 +177,57 @@ else $CreatedBy = $this->session->userdata('userId'); $stock = $this->input->post('openstock'); $reorder = $this->input->post('reorder'); - $stockdate = $this->input->post('Date'); + $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; + } + + } @@ -218,7 +275,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); //print_r($RawMaterial);die(); $result = $this->rawmaterialdetails_model->addNewRawMaterial($RawMaterial); diff --git a/application/helpers/cias_helper.php b/application/helpers/cias_helper.php index 180666bb..7e1b6a62 100755 --- a/application/helpers/cias_helper.php +++ b/application/helpers/cias_helper.php @@ -58,6 +58,18 @@ if(!function_exists('verifyHashedPassword')) return $CI->db->get('T_fav_add')->result(); } + 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 b99d5e91..db56f4e7 100755 --- a/application/models/inwardgateregister_model.php +++ b/application/models/inwardgateregister_model.php @@ -119,25 +119,6 @@ return $afftectedRows; $this->db->from('T_Inwardgateregister_fileupload'); $this->db->where('IGRNO',$IGRNO); - $query = $this->db->get(); - - $result = $query->result(); - - return $result; - - - - } - function viewIGRFile1($IGRNO) - { - $this->db->distinct(); - $this->db->select('igrm.file,igrm.PONO as pono'); //BillNo,IGRNO,FilePath,PONO - $this->db->from('T_IGR_Master igrm'); - //$this->db->join('T_Inwardgateregister_fileupload igrf','igrm.IGRNO = igrf.IGRNO','left'); - //$this->db->join('T_IGR_Details igrd','igrm.IGRNO = igrd.IGRNO','left'); - - $this->db->where('igrm.IGRNO',$IGRNO); - $query = $this->db->get(); $result = $query->result(); @@ -256,6 +237,27 @@ return $afftectedRows; } + + 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'); @@ -803,33 +805,4 @@ function getPOmaterial($PONO) return $r; } - - function getpolineqty($NewPO) -{ - $this->db->select('sum(Quantity)as Qty,sum(ReceivedQuantity)as rec'); - $this->db->from('T_PurchaseOrder_LineItem'); - $this->db->where('PONO',$NewPO); - - $query = $this->db->get(); - return $query->result(); -} - - -function POLineItemsupdatestatus($PONO,$Newstatus) -{ - $this->db->where('PONO',$PONO); - $this->db->update('T_PurchaseOrder_LineItem',$Newstatus); - $update = $this->db->affected_rows(); - return $update; - -} - -function pomasterupdatestatus($PONO,$Newstatus) -{ - $this->db->where('PONO',$PONO); - $this->db->update('T_PurchaseOrder_Master',$Newstatus); - $update = $this->db->affected_rows(); - return $update; -} - } \ No newline at end of file diff --git a/application/models/rawmaterialdetails_model.php b/application/models/rawmaterialdetails_model.php index 6dae6a3b..507cd066 100755 --- a/application/models/rawmaterialdetails_model.php +++ b/application/models/rawmaterialdetails_model.php @@ -271,5 +271,19 @@ WHERE MaterialCode=? AND CreatedOn >=? AND CreatedOn <=? "; 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 13b2e561..13351d39 100644 --- a/application/views/FinalProduct.php +++ b/application/views/FinalProduct.php @@ -536,7 +536,7 @@ $(function() { diff --git a/application/views/addRawMaterial.php b/application/views/addRawMaterial.php index 05754346..7985d9da 100755 --- a/application/views/addRawMaterial.php +++ b/application/views/addRawMaterial.php @@ -403,4 +403,6 @@ function Validate() return false; } } + + \ No newline at end of file diff --git a/application/views/editFinalProduct.php b/application/views/editFinalProduct.php index e5d1b30e..5835c1e3 100644 --- a/application/views/editFinalProduct.php +++ b/application/views/editFinalProduct.php @@ -434,6 +434,8 @@ $(function() { + + @@ -672,7 +674,9 @@ $(function() { MaterialCode."-".$cou->MaterialName?> SupplierID."-".$cou->SupplierName?> - Quantity?> + Quantity?> + + Price?> @@ -697,6 +701,9 @@ $(function() { + + + @@ -950,6 +957,9 @@ $(function() { + + + diff --git a/application/views/includes/header.php b/application/views/includes/header.php index 0b1d50d7..6072fb6f 100755 --- a/application/views/includes/header.php +++ b/application/views/includes/header.php @@ -167,7 +167,44 @@ display: none; - --> + --> + + + + + + +
  • @@ -1102,6 +1159,16 @@ else{
  • + + + + +
  • diff --git a/application/views/shortagematerialListing.php b/application/views/shortagematerialListing.php new file mode 100644 index 00000000..b6fd055f --- /dev/null +++ b/application/views/shortagematerialListing.php @@ -0,0 +1,85 @@ + + +
    + + + +
    +
    +
    +
    +
    +

    Siddharth Industries - ReOrder Level List

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