diff --git a/application/controllers/inwardgateregister.php b/application/controllers/inwardgateregister.php index 947da6e9..335d6c77 100755 --- a/application/controllers/inwardgateregister.php +++ b/application/controllers/inwardgateregister.php @@ -39,24 +39,20 @@ class inwardgateregister extends BaseController $this->load->model('inwardgateregister_model'); $this->global['pageTitle'] = 'Siddharth : Inward Gate Register'; $data['IGR']= $this->inwardgateregister_model->igrListing(); - //print_r($data['IGR']);//print_r statement is used to get the values + $this->loadViews("viewinwardgateregister",$this->global,$data,NULL); } - function addinwardgateregister($pono='',$IGRNO='',$IGR='') + function addinwardgateregister() { $this->load->model('inwardgateregister_model'); $this->global['pageTitle'] = 'Siddharth : Add Inward Gate Register'; - //$data['IGR']=$this->inwardgateregister_model->igrListing($IGRNO,$IGR); + - $data['PO_NO'] = $this->inwardgateregister_model->getpurchaseorder($pono); - - - //print_r($data); - - - + $data['PO_NO'] = $this->inwardgateregister_model->getpurchaseorder(); + //print_r($data['PO_NO']); + $this->loadViews("inwardgateregister", $this->global, $data, NULL); } @@ -68,53 +64,27 @@ class inwardgateregister extends BaseController return $retDate; } - function IGRITEM($PO='') + function IGRITEM() { $PO = $this->input->post('id'); $data = $this->inwardgateregister_model->viewpurchaseorder($PO); - //$result = $this->inwardgateregister_model->viewpurchaseorder($PO); - /*$HTML=""; - for ($i = 0; $i < count($data); $i++) - { - $SNo = $i + 1; - $MaterialCode = $result[$i]['MaterialCode']; - $MaterialName = $result[$i]['MaterialName']; - $UOM = $result[$i]['UOM']; - $Quantity = $result[$i]['Quantity']; - $HTML.=" - ".$SNo." - ". $MaterialCode." - - ".$MaterialName." - - ".$UOM." - ".$Quantity." - "; - - //$index = $index + 1; - - }*/ - echo json_encode($data); - //$this->load->view('sample',$data,NULL); + //print_r($data); + echo json_encode($data); + } function addNewigr() { - - + - $PONO = $this->input->post('PONO'); - //$igr = $this->input->post('igr'); - - + $PONO = $this->input->post('PONO'); $DeliveryChellanOrInvoiceNo = $this->input->post('InvoiceNo'); $DeliveryChellan = $this->input->post('InvoiceDate'); - $DeliveryChellanDate = $this->getDateformat($DeliveryChellan); - + $DeliveryChellanDate = $this->getDateformat($DeliveryChellan); $VehicleNo = $this->input->post('VehicleNo'); $CourierNo = $this->input->post('CourierNo'); @@ -126,7 +96,8 @@ class inwardgateregister extends BaseController //echo $RowCount; $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $createddt = $dt->format('Y-m-d H:i:s'); - $IGRStatus = IGR_CREATED; + + $IGRStatus = IGR_CREATED; //echo $RowCount; @@ -134,8 +105,7 @@ class inwardgateregister extends BaseController $igr = array(); $igr = array('PONO'=>$PONO,'VehicleNo'=>$VehicleNo,'DeliveryChellanOrInvoiceNo'=>$DeliveryChellanOrInvoiceNo,'DeliveryChellanDate'=>$DeliveryChellanDate,'CourierNo'=>$CourierNo,'IGRStatus'=>$IGRStatus,'CreatedBy'=>$CreatedBy,'CreatedDate' =>$createddt); - //print_r($IGRNO); - //die(); + $igrM = $this->inwardgateregister_model->addigrM($igr); @@ -150,38 +120,51 @@ class inwardgateregister extends BaseController echo $IGRNO; $IGRItemStatus = REQITEM_NEW; - //echo ("success"); - //print_r($RowCount); + for ($i = 1; $i <= $RowCount; $i++) { - //echo i; - - //echo $IGRNO ; + $MaterialCode = $this->input->post('MaterialCode'.$i); $QuantityAsPerInvoice = $this->input->post('ReceivedQuantity'.$i); - $Remarks = $this->input->post('Remarks'.$i); - //$Remarks = $this->input->post('Remarks'); - $CreatedBy = $this->session->userdata('userId'); + $OrderedQuantity = $this->input->post('OrderedQuantity'.$i); + + //echo 'OrderedQunatity'.$OrderedQuantity; + //echo 'QuantityAsPerInvoice'.$QuantityAsPerInvoice; + + if(strlen($QuantityAsPerInvoice)>0) + { + $Remarks = $this->input->post('txtRemarks'.$i); + $ItemStatus = ''; + if($QuantityAsPerInvoice == $OrderedQuantity) + { + $ItemStatus = IGR_CREATED; + } + else + { + $ItemStatus = POLINEITEM_IGRPARTIAL_CREATED; + } + + $CreatedBy = $this->session->userdata('userId'); $igrDetails = array('IGRNO'=>$IGRNO,'MaterialCode'=>$MaterialCode,'QuantityAsPerInvoice'=>$QuantityAsPerInvoice,'Remarks'=>$Remarks,'IGRItemStatus'=>$IGRItemStatus,'CreatedBy'=>$CreatedBy,'CreatedDate'=>$createddt); - //print_r($igrDetails); + $igrD = $this->inwardgateregister_model->addigrD($igrDetails); - + + $POLineItem = array('Status'=>$ItemStatus,'UpdateBY'=>$CreatedBy,'UpdatedOn'=>$createddt ); + + $this->inwardgateregister_model->UpdatePOLineItem($POLineItem,$PONO,$MaterialCode); + } + echo $IGRNO; } - //print_r($IGRNO); - - - - - } + } - function ViewIGR($IGRNO='') + function ViewIGR() { $IGRNO= $this->input->post('id'); diff --git a/application/controllers/storestatus.php b/application/controllers/storestatus.php index 84762d80..6dfbdbd6 100755 --- a/application/controllers/storestatus.php +++ b/application/controllers/storestatus.php @@ -17,7 +17,7 @@ class storestatus extends BaseController public function __construct() { parent::__construct(); - $this->load->model('assetdetails_model'); + $this->load->model('store_model'); $this->load->library('form_validation'); @@ -45,8 +45,9 @@ class storestatus extends BaseController //$data['userRecords'] = $this->supplier_model->supplierListing(); $this->global['pageTitle'] = 'Siddharth Industries : Store Status'; - - $this->loadViews("storestatus", $this->global, NULL); + //viewStock + $data['Stock'] $this->store_model->viewStock(); + $this->loadViews("storestatus", $this->global, $data,null); }