diff --git a/application/controllers/emergencypurchaseorder.php b/application/controllers/emergencypurchaseorder.php index fb908394..56370ad7 100644 --- a/application/controllers/emergencypurchaseorder.php +++ b/application/controllers/emergencypurchaseorder.php @@ -363,7 +363,7 @@ class emergencypurchaseorder extends BaseController /** * To Create Revenue Emergency Purchase Order **/ - function addNewRevenuePurchaseOrder() + function addNewRevenuePurchaseOrder() { @@ -375,241 +375,237 @@ class emergencypurchaseorder extends BaseController $dt = $this->input->post('Deliverydt'); $DeliveryOption = $this->input->post('DateRange'); if($DeliveryOption==1){ - $Deliverydt = ''; - $DeliverySchedule = $this->input->post('Scheduleby'); + $Deliverydt = ''; + $DeliverySchedule = $this->input->post('Scheduleby'); } - else{ - $Deliverydt = $this->getDateformat($dt); - $DeliverySchedule = ''; + else{ + $Deliverydt = $this->getDateformat($dt); + $DeliverySchedule = ''; } - $Modeofshipment=$this->input->post('emergmodeofshipment'); - $supplierreference=$this->input->post('emergsupplierreference'); - $supplieroffno=$this->input->post('emergsupplierofferno'); - $otherreference=$this->input->post('emergotherreference'); - $fincap=$this->input->post('emergfincap'); - $revenuetype=$this->input->post('PoTypeOptions'); - $insurancestatus=$this->input->post('insuranceStatus'); - if($insurancestatus == 1){ + $Modeofshipment=$this->input->post('emergmodeofshipment'); + $supplierreference=$this->input->post('emergsupplierreference'); + $supplieroffno=$this->input->post('emergsupplierofferno'); + $otherreference=$this->input->post('emergotherreference'); + $fincap=$this->input->post('emergfincap'); + $revenuetype=$this->input->post('PoTypeOptions'); + $insurancestatus=$this->input->post('insuranceStatus'); + if($insurancestatus == 1){ $insuranceno=$this->input->post('insuranceNo'); - }else{ + }else{ $insuranceno=""; - } - $CostCenterName = $this->input->post('CostCenterName'); - $POType = $this->input->post('POType'); - $PoRange = $this->input->post('txtPoRange'); + } + $CostCenterName = $this->input->post('CostCenterName'); + $POType = $this->input->post('POType'); + $PoRange = $this->input->post('txtPoRange'); - $SpcialInstruction = $this->input->post('txtSpcialInstruction'); - $RequistionComments = "Created Emergency Revenue PO"; - $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); + $SpcialInstruction = $this->input->post('txtSpcialInstruction'); + $RequistionComments = "Created Emergency Revenue PO"; + $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); - if($txtspl==0) - { + if($txtspl==0) + { $POStatus=REQITEM_Emergency_PO_CREATED; - } - else - { + } + else + { $POStatus=SPECIAL_PO; - } + } - $RequestedBy = $this->input->post('drpDepartment'); - $CreateBy = $this->session->userdata ( 'userId' ); - $RowCount=$this->input->post('txtRowCount1'); - $DeletedRow = $this->input->post('txtDeletedRow1'); - $splRow = $this->input->post('splrow'); - - $ReqStatus = REQITEM_Emergency_PO_CREATED; - $Local_Interstate=$this->input->post('Range'); + $RequestedBy = $this->input->post('drpDepartment'); + $CreateBy = $this->session->userdata ( 'userId' ); + $RowCount=$this->input->post('txtRowCount1'); + $DeletedRow = $this->input->post('txtDeletedRow1'); + $splRow = $this->input->post('splrow'); + + $ReqStatus = REQITEM_Emergency_PO_CREATED; + $Local_Interstate=$this->input->post('Range'); - $comma_separated = explode(':', $DeletedRow); + $comma_separated = explode(':', $DeletedRow); - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $createddt = $dt->format('Y-m-d H:i:s'); - $PaymentTerms=$this->input->post('PaymentMethod'); - $OtherPayment=$this->input->post('Otherpayment'); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $createddt = $dt->format('Y-m-d H:i:s'); + $PaymentTerms=$this->input->post('PaymentMethod'); + $OtherPayment=$this->input->post('Otherpayment'); - if($POStatus==SPECIAL_PO) - { + if($POStatus==SPECIAL_PO) + { $Qualitycheck=$this->input->post('txtQuality'); - } - else - { + } + else + { $Qualitycheck=1; - } + } - - $Request = array('ReqType'=>$POType, 'RequestedDept'=>$RequestedBy,'CostCenterCode'=>$CostCenterName,'Status'=>$ReqStatus,'Comments'=>$RequistionComments,'ReqDate'=>$createddt,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy); + + $Request = array('ReqType'=>$POType, 'RequestedDept'=>$RequestedBy,'CostCenterCode'=>$CostCenterName,'Status'=>$ReqStatus,'Comments'=>$RequistionComments,'ReqDate'=>$createddt,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy); - $Req = $this->requistion_model->addRequistion($Request); + $Req = $this->requistion_model->addRequistion($Request); - $RegNo=''; - if(count($Req)>0) + $RegNo=''; + if(count($Req)>0) { $RegNo = $Req[0]['ReqNo']; } - // PO Master - $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'PORange'=>$Local_Interstate,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'CapitalRange'=>$Local_Interstate,'PaymentOtherDescription'=>$OtherPayment,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Offer_No'=>$supplieroffno,'Supplier_Reference'=>$supplierreference,'Other_Reference'=>$otherreference,'InsuranceNumber'=>$insuranceno,'InsuranceStatus'=>$insurancestatus,'Fincap'=>$fincap,'POSubType'=>$revenuetype,'IsQualityChkReqired'=>$Qualitycheck); - - $POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$revenuetype); + $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'PORange'=>$Local_Interstate,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'CapitalRange'=>$Local_Interstate,'PaymentOtherDescription'=>$OtherPayment,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Offer_No'=>$supplieroffno,'Supplier_Reference'=>$supplierreference,'Other_Reference'=>$otherreference,'InsuranceNumber'=>$insuranceno,'InsuranceStatus'=>$insurancestatus,'Fincap'=>$fincap,'POSubType'=>$revenuetype,'IsQualityChkReqired'=>$Qualitycheck); + + $POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$revenuetype); - $PONO = ''; - if(count($POMaster)>0) - { - $PONO = $POMaster[0]['PONO']; - } - - // PO Line Items - $RegDetailsStatus=REQITEM_POCREATED; - $LineItemStatus = REQITEM_NEW; - - for ($i = 1; $i <= $RowCount; $i++) - { - - $MaterialCode = $this->input->post('materialCode'.$i); - $Quantity = $this->input->post('quantity'.$i); - $Reqnumber = $this->input->post('Reqnumber'.$i); - $itemRate = $this->input->post('itemRate'.$i); - $per = $this->input->post('per'.$i); - - $DiscountType = $this->input->post('DisType'.$i); - $DiscountValue = $this->input->post('DisVal'.$i); - $AfterDiscount = $this->input->post('AfterDisVal'.$i); - $PackagingOption = $this->input->post('PackOption'.$i); - $PackagingType = $this->input->post('PackType'.$i); - $PackagingValue = $this->input->post('PackVal'.$i); - $AfterPackagingValue = $this->input->post('AfterPackVal'.$i); - - $FreightType = $this->input->post('FreightType'.$i); - $FreightValue = $this->input->post('FreightVal'.$i); - $AfterFreightValue = $this->input->post('AfterFreightVal'.$i); - $NOOfTrip = $this->input->post('NoOfTrip'.$i); - $InsuranceValue = $this->input->post('Insval'.$i); - $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); - $revenuedescription = $this->input->post('service_description'.$i); - $CostCenter = $this->input->post('costCode'.$i); - $Cgst = $this->input->post('RevenueCgst'.$i); - $Sgst = $this->input->post('RevenueSgst'.$i); - $Igst = $this->input->post('RevenueIgst'.$i); - $AfterCgst = $this->input->post('RevenueAfterCgst'.$i); - $AfterSgst = $this->input->post('RevenueAfterSgst'.$i); - $AfterIgst = $this->input->post('RevenueAfterIgst'.$i); - $SkipInsert = "False"; - if( count($comma_separated) > 0) - { - for($j = 1; $j < count($comma_separated); $j++) - { - $deletedRow = $comma_separated[$j] ; - - if($deletedRow == $i ) - { - $SkipInsert = "True"; - break; - } + $PONO = ''; + if(count($POMaster)>0) + { + $PONO = $POMaster[0]['PONO']; } - } - if($SkipInsert == "False") - { - //add requistion details + $RegDetailsStatus=REQITEM_POCREATED; + $LineItemStatus = REQITEM_NEW; + + for ($i = 1; $i <= $RowCount; $i++) + { + + $MaterialCode = $this->input->post('materialCode'.$i); + $Quantity = $this->input->post('quantity'.$i); + $Reqnumber = $this->input->post('Reqnumber'.$i); + $itemRate = $this->input->post('itemRate'.$i); + $per = $this->input->post('per'.$i); + + $DiscountType = $this->input->post('DisType'.$i); + $DiscountValue = $this->input->post('DisVal'.$i); + $AfterDiscount = $this->input->post('AfterDisVal'.$i); + $PackagingOption = $this->input->post('PackOption'.$i); + $PackagingType = $this->input->post('PackType'.$i); + $PackagingValue = $this->input->post('PackVal'.$i); + $AfterPackagingValue = $this->input->post('AfterPackVal'.$i); + + $FreightType = $this->input->post('FreightType'.$i); + $FreightValue = $this->input->post('FreightVal'.$i); + $AfterFreightValue = $this->input->post('AfterFreightVal'.$i); + $NOOfTrip = $this->input->post('NoOfTrip'.$i); + $InsuranceValue = $this->input->post('Insval'.$i); + $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); + $revenuedescription = $this->input->post('service_description'.$i); + $CostCenter = $this->input->post('costCode'.$i); + $Cgst = $this->input->post('RevenueCgst'.$i); + $Sgst = $this->input->post('RevenueSgst'.$i); + $Igst = $this->input->post('RevenueIgst'.$i); + $AfterCgst = $this->input->post('RevenueAfterCgst'.$i); + $AfterSgst = $this->input->post('RevenueAfterSgst'.$i); + $AfterIgst = $this->input->post('RevenueAfterIgst'.$i); + $SkipInsert = "False"; + if( count($comma_separated) > 0) + { + for($j = 1; $j < count($comma_separated); $j++) + { + $deletedRow = $comma_separated[$j] ; + + if($deletedRow == $i ) + { + $SkipInsert = "True"; + break; + } + } + } + if($SkipInsert == "False") + { $ReqDetails = array('ReqNo'=>$RegNo, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Status'=>$RegDetailsStatus,'UpdatedBy'=>$CreateBy,'UpdatedOn'=>$createddt); - $ReqDetQuery = $this->requistion_model->addRequistionDetails($ReqDetails); + $ReqDetQuery = $this->requistion_model->addRequistionDetails($ReqDetails); - $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$RegNo,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'Per'=>$per,'ServiceMaterialDescription'=>$revenuedescription); - - $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$RegNo,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'Per'=>$per,'ServiceMaterialDescription'=>$revenuedescription); + + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - $LineItemNo = ''; - if(count($POLineItem)>0) - { - $LineItemNo = $POLineItem[0]['LineItemNo']; - } - + $LineItemNo = ''; + if(count($POLineItem)>0) + { + $LineItemNo = $POLineItem[0]['LineItemNo']; + } - if(trim($POType) == REVENUE ) - { - $RevenueTaxList = array('LineItemNo'=>$LineItemNo, 'DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt, 'CGST'=>$Cgst,'AfterCGST'=>$AfterCgst,'SGST'=>$Sgst,'AfterSGST'=>$AfterSgst,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'NoOfTrip'=>$NOOfTrip); - $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); - - } - } - } + + if(trim($POType) == REVENUE ) + { + $RevenueTaxList = array('LineItemNo'=>$LineItemNo, 'DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt, 'CGST'=>$Cgst,'AfterCGST'=>$AfterCgst,'SGST'=>$Sgst,'AfterSGST'=>$AfterSgst,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'NoOfTrip'=>$NOOfTrip); + $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); + + } + } + } if($txtspl==1 || $txtspl==2) { - $PONOigr = $PONO; + $PONOigr = $PONO; - $DeliveryChellanInvoiceNo=$this->input->post('ChallanInvNo'); + $DeliveryChellanInvoiceNo=$this->input->post('ChallanInvNo'); - $DeliveryChellan = $this->input->post('ChallanInvDate'); - $DeliveryChellanDate = $this->getDateformat($DeliveryChellan); + $DeliveryChellan = $this->input->post('ChallanInvDate'); + $DeliveryChellanDate = $this->getDateformat($DeliveryChellan); - $Vehicle = $this->input->post('VehicleNo'); - $Courier = $this->input->post('CourierNo'); + $Vehicle = $this->input->post('VehicleNo'); + $Courier = $this->input->post('CourierNo'); - $CreatedBy = $this->session->userdata('userId'); + $CreatedBy = $this->session->userdata('userId'); - $Remarksmrir='Emergency PO without Quality Check'; - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $createddt = $dt->format('Y-m-d H:i:s'); + $Remarksmrir='Emergency PO without Quality Check'; + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $createddt = $dt->format('Y-m-d H:i:s'); - $IGRStatus = IGR_CREATED; - $igr = array(); + $IGRStatus = IGR_CREATED; + $igr = array(); - $igr = array('PONO'=>$PONO,'VehicleNo'=>$Vehicle,'DeliveryChellanOrInvoiceNo'=>$DeliveryChellanInvoiceNo,'DeliveryChellanDate'=>$DeliveryChellanDate,'CourierNo'=>$Courier,'IGRStatus'=>$IGRStatus,'CreatedBy'=>$CreatedBy,'CreatedDate' =>$createddt); - $igrM = $this->inwardgateregister_model->addigrM($igr); - $IGRNO = ''; - if(count($igrM)>0) - { - foreach ($igrM as $key ) - { - $IGRNO=$key->IGRNO; - } - } + $igr = array('PONO'=>$PONO,'VehicleNo'=>$Vehicle,'DeliveryChellanOrInvoiceNo'=>$DeliveryChellanInvoiceNo,'DeliveryChellanDate'=>$DeliveryChellanDate,'CourierNo'=>$Courier,'IGRStatus'=>$IGRStatus,'CreatedBy'=>$CreatedBy,'CreatedDate' =>$createddt); + $igrM = $this->inwardgateregister_model->addigrM($igr); + $IGRNO = ''; + if(count($igrM)>0) + { + foreach ($igrM as $key ) + { + $IGRNO=$key->IGRNO; + } + } if($Qualitycheck==0) - { - $mrirmastervalues = array('MRIRStatus'=>MRIR_APPROVED,'IGRNO'=>$IGRNO,'PONO'=>$PONO,'CreatedBy'=>$CreatedBy,'Createdon'=>$createddt,'Remarks'=>$Remarksmrir); - $mrirmaster = $this->mrir_model->master_mrir($mrirmastervalues); - $MRIRNO = ''; + { + $mrirmastervalues = array('MRIRStatus'=>MRIR_APPROVED,'IGRNO'=>$IGRNO,'PONO'=>$PONO,'CreatedBy'=>$CreatedBy,'Createdon'=>$createddt,'Remarks'=>$Remarksmrir); + $mrirmaster = $this->mrir_model->master_mrir($mrirmastervalues); + $MRIRNO = ''; - if(count($mrirmaster)>0) - { - foreach ($mrirmaster as $key ) { - $MRIRNO=$key->MRIRNo; } - } + if(count($mrirmaster)>0) + { + foreach ($mrirmaster as $key ) { + $MRIRNO=$key->MRIRNo; + } + } - for ($i = 1; $i <= $RowCount; $i++) - { - $MaterialCode = $this->input->post('materialCode'.$i); - $Quantity = $this->input->post('quantity'.$i); + for ($i = 1; $i <= $RowCount; $i++) + { + $MaterialCode = $this->input->post('materialCode'.$i); + $Quantity = $this->input->post('quantity'.$i); - $Remarked = "Special PO Without Quality Check"; + $Remarked = "Special PO Without Quality Check"; - $MRIRStatus=MRIR_APPROVED; - + $MRIRStatus=MRIR_APPROVED; //this array to store the value in child table.. $mrirdetailvalues = array('MRIRNO'=>$MRIRNO,'MaterialCode'=>$MaterialCode,'ActualQuantityReceived'=>$Quantity,'Remarks'=>$Remarked,'MRIRStatus'=>$MRIRStatus); $mrirdetails = $this->mrir_model->detail_mrir($mrirdetailvalues); - $getAvailableqty = $this->mrir_model->getItemQuantityFromStock(trim($MaterialCode)); + $getAvailableqty = $this->mrir_model->getItemQuantityFromStock(trim($MaterialCode)); if(count($getAvailableqty)>0) { $avlQty = $getAvailableqty[0]['Quantity']; } - $updatStock = array('Quantity'=>($Quantity+$avlQty),'Status'=>'0','UpdatedOn'=>$createddt,'UpdatedBy'=>$CreatedBy,'Remarks'=>'Stock added for '. $MRIRNO); + $updatStock = array('Quantity'=>($Quantity+$avlQty),'Status'=>'0','UpdatedOn'=>$createddt,'UpdatedBy'=>$CreatedBy,'Remarks'=>'Stock added for '. $MRIRNO); - $this->mrir_model->UpdateStock($updatStock,trim($MaterialCode)); + $this->mrir_model->UpdateStock($updatStock,trim($MaterialCode)); - } + } - } - $IGRItemStatus = REQITEM_NEW; - for ($i = 1; $i <= $RowCount; $i++) - { + } + $IGRItemStatus = REQITEM_NEW; + for ($i = 1; $i <= $RowCount; $i++) + { $MaterialCode = trim($this->input->post('materialCode'.$i)); @@ -619,7 +615,7 @@ class emergencypurchaseorder extends BaseController $ReceivedQty = $this->input->post('AQuantity'.$i); - $emergencyitemcode = $this->input->post('emergencyitemcode'); + $emergencyitemcode = $this->input->post('emergencyitemcode'); $PendingQty = 0; @@ -629,7 +625,7 @@ class emergencypurchaseorder extends BaseController $ItemStatus = ''; if($PendingQty == 0.00 ) - { + { $ItemStatus = IGR_CREATED; } else @@ -640,38 +636,36 @@ class emergencypurchaseorder extends BaseController $CreatedBy = $this->session->userdata('userId'); - $igrDetails = array('IGRNO'=>$IGRNO,'MaterialCode'=>$MaterialCode,'QuantityAsPerInvoice'=>$QuantityAsPerInvoice,'Remarks'=>$Remarks,'IGRItemStatus'=>$IGRItemStatus,'CreatedBy'=>$CreatedBy,'CreatedDate'=>$createddt); - $igrD = $this->inwardgateregister_model->addigrD($igrDetails); + $igrDetails = array('IGRNO'=>$IGRNO,'MaterialCode'=>$MaterialCode,'QuantityAsPerInvoice'=>$QuantityAsPerInvoice,'Remarks'=>$Remarks,'IGRItemStatus'=>$IGRItemStatus,'CreatedBy'=>$CreatedBy,'CreatedDate'=>$createddt); + $igrD = $this->inwardgateregister_model->addigrD($igrDetails); - $Recqty = $this->inwardgateregister_model->getPOLineItemReceivedQty($PONO,$MaterialCode); - $ReceivedQuantity = 0.00; - if(count($Recqty)>0) - { + $Recqty = $this->inwardgateregister_model->getPOLineItemReceivedQty($PONO,$MaterialCode); + $ReceivedQuantity = 0.00; + if(count($Recqty)>0) + { foreach ($Recqty as $key ) { $ReceivedQuantity=$key->ReceivedQuantity; } - } - $totalReceivedqty = $ReceivedQuantity + $QuantityAsPerInvoice; - - $POLineItem = array('ReceivedQuantity'=>$totalReceivedqty,'Status'=>$ItemStatus,'UpdateBY'=>$CreatedBy,'UpdatedOn'=>$createddt ); + } + $totalReceivedqty = $ReceivedQuantity + $QuantityAsPerInvoice; + + $POLineItem = array('ReceivedQuantity'=>$totalReceivedqty,'Status'=>$ItemStatus,'UpdateBY'=>$CreatedBy,'UpdatedOn'=>$createddt ); $this->inwardgateregister_model->UpdatePOLineItem($POLineItem,$PONO,$MaterialCode); } - - } + + } $file =$this->addfile(); $emergencyitemcode = $this->input->post('materialCode'.$i); $myfile = array('FilePath'=>$file,'MaterialCode'=>$emergencyitemcode,'PONO'=>$PONO,'IGRNO'=>$IGRNO); $result= $this->purchaseorder_model->fileupload($myfile); } - echo ""; redirect('purchaseorder/PurchaseOrderList','refresh'); } - /** * To load the purchaseorder list */ diff --git a/application/controllers/report.php b/application/controllers/report.php index 28ec4eed..81ff5b37 100755 --- a/application/controllers/report.php +++ b/application/controllers/report.php @@ -54,15 +54,9 @@ class report extends BaseController $data['finyear']=$this->dahsboard_Model->report_finyear(); - - - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("report_pendingreqst",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } + } @@ -100,13 +94,9 @@ class report extends BaseController //$data['rel_po']=$this->dahsboard_Model->report_relpo(); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("Report_POreleased",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } + } @@ -151,15 +141,9 @@ class report extends BaseController //$data['open_po']=$this->dahsboard_Model->report_openpending(); - if($this->DEPCode == MANAGEMENT) - { - - + $this->loadviews("Report_openorder",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } + } @@ -176,13 +160,8 @@ class report extends BaseController $data['Total']=$this->dahsboard_Model->report_total($fa,$aa); } $data['finyear']=$this->dahsboard_Model->report_finyear(); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("Report_totalorders",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } } @@ -202,13 +181,7 @@ class report extends BaseController } $data['finyear']=$this->dahsboard_Model->report_finyear(); - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("Report_costcenter",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } } @@ -223,13 +196,8 @@ class report extends BaseController $data['mms']=$this->dahsboard_Model->report_MMSupplier(); - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("Report_Material_Master_SupplierWise",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } + } public function MM_Item() @@ -242,13 +210,9 @@ class report extends BaseController $data['mmi']=$this->dahsboard_Model->report_MMItem(); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("Report_Material_Master_ItemWise",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } + } public function MM_ReceiptValue() @@ -277,13 +241,9 @@ class report extends BaseController $data['finyear']=$this->dahsboard_Model->report_finyear(); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("Report_Material_Master_ReceiptValue",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } + } @@ -312,13 +272,9 @@ class report extends BaseController $data['finyear']=$this->dahsboard_Model->report_finyear(); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("Report_purchase",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } + } public function link_purchase() @@ -364,13 +320,8 @@ class report extends BaseController $data['purchase']=$this->dahsboard_Model->report_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d); } - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("Report_purchase",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } + } public function year_wise() @@ -390,13 +341,8 @@ class report extends BaseController } $data['finyear']=$this->dahsboard_Model->report_finyear(); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("Report_year_wise",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } } public function month_wise() @@ -410,13 +356,8 @@ class report extends BaseController //print_r($month); $data['mont']=$mon; $data['month']=$this->dahsboard_Model->report_month_wise($month); - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("Report_month_wise",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } + } public function year_wise_total() @@ -431,14 +372,9 @@ class report extends BaseController //print_r($month); $data['year']=$month; $data['ytotal']=$this->dahsboard_Model->report_year_wise_total($a,$b); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("Report_year_wise_total",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } - + } public function purchase_supplier() @@ -463,14 +399,9 @@ class report extends BaseController $data['cust']=$this->dahsboard_Model->customer_name(); $data['finyear']=$this->dahsboard_Model->report_finyear(); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("Report_supplier",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } - + } public function consolidate() { @@ -493,13 +424,8 @@ class report extends BaseController $data['finyear']=$this->dahsboard_Model->report_finyear(); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("Report_consolidate",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } } @@ -521,14 +447,8 @@ class report extends BaseController $data['cust']=$this->dahsboard_Model->customer_name(); $data['finyear']=$this->dahsboard_Model->report_finyear(); $data['spurchse']=$this->dahsboard_Model->consolidate_month($m,$sid,$mid,$fa,$aa); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("Report_consolidate_m",$this->global,$data, NULL); - } - else - { - $this->loadViews("access", $this->global, $data, NULL); - } } public function consolidate_year() @@ -546,14 +466,8 @@ class report extends BaseController $data['cust']=$this->dahsboard_Model->customer_name(); $data['finyear']=$this->dahsboard_Model->report_finyear(); $data['spurchse']=$this->dahsboard_Model->consolidate_year($sid,$mid,$fa,$aa); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("Report_consolidate_y",$this->global,$data, NULL); - } - else - { - $this->loadViews("access", $this->global, $data, NULL); - } } @@ -565,13 +479,8 @@ class report extends BaseController //print_r($prod); $data['cum']=$this->dahsboard_Model->report_cumulative(); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("Report_cumulative",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } } public function cum_month() @@ -585,13 +494,9 @@ class report extends BaseController //print_r($prod); $data['cum_month']=$this->dahsboard_Model->report_cum_month($sup,$mat); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("Report_cumulative_month",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } + } public function cum_year() @@ -606,13 +511,8 @@ class report extends BaseController //print_r($sup); $data['cum_year']=$this->dahsboard_Model->report_cum_year($sup,$mat); - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("Report_cumulative_year",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } + } public function cum_day() @@ -626,14 +526,9 @@ class report extends BaseController //print_r($prod); $data['cum_day']=$this->dahsboard_Model->report_cum_day($sup,$mat); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("Report_cumulative_day",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } - + } public function ipurchase() { @@ -662,17 +557,9 @@ class report extends BaseController $data['cust']=$this->dahsboard_Model->customer_name(); $data['finyear']=$this->dahsboard_Model->report_finyear(); - - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("Report_purchase_inward",$this->global,$data, NULL); - } - - else - { - $this->loadViews("access", $this->global, $data, NULL); - } - + } @@ -720,13 +607,7 @@ class report extends BaseController $data['purchase']=$this->dahsboard_Model->ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d,$cat); } - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("Report_purchase_inward",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } } public function iyear_wise() @@ -745,16 +626,8 @@ class report extends BaseController } $data['finyear']=$this->dahsboard_Model->report_finyear(); - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("Report_year_wise_inward",$this->global,$data, NULL); - } - - else - { - $this->loadViews("access", $this->global, $data, NULL); - } } public function imonth_wise() @@ -768,13 +641,7 @@ class report extends BaseController //print_r($month); $data['mont']=$mon; $data['month']=$this->dahsboard_Model->ireport_month_wise($month); - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("Report_month_wise_inward",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } } public function iyear_wise_total() @@ -789,13 +656,7 @@ class report extends BaseController //print_r($month); $data['year']=$month; $data['ytotal']=$this->dahsboard_Model->ireport_year_wise_total($a,$b); - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("Report_year_wise_total_inward",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } } @@ -823,17 +684,9 @@ class report extends BaseController - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("Report_supplier_inward",$this->global,$data, NULL); - } - - else - { - $this->loadViews("access", $this->global, $data, NULL); - } @@ -858,14 +711,7 @@ class report extends BaseController $data['finyear']=$this->dahsboard_Model->report_finyear(); - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("Report_consolidate_inward",$this->global,$data, NULL); - } - else - { - $this->loadViews("access", $this->global, $data, NULL); - } } public function i_consolidate_month() @@ -890,14 +736,7 @@ class report extends BaseController $data['finyear']=$this->dahsboard_Model->report_finyear(); $data['spurchse']=$this->dahsboard_Model->i_consolidate_month($m,$sid,$prod,$fa,$aa); // print_r( $data['spurchse']); - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("Report_consolidate_month_inward",$this->global,$data, NULL); - } - else - { - $this->loadViews("access", $this->global, $data, NULL); - } } public function i_consolidate_year() @@ -919,14 +758,7 @@ class report extends BaseController $data['finyear']=$this->dahsboard_Model->report_finyear(); $data['spurchse']=$this->dahsboard_Model->i_consolidate_year($sid,$mid,$fa,$aa); // print_r( $data['spurchse']); - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("Report_consolidate_year_inward",$this->global,$data, NULL); - } - else - { - $this->loadViews("access", $this->global, $data, NULL); - } } @@ -939,15 +771,7 @@ class report extends BaseController $data['cum']=$this->dahsboard_Model->ireport_cumulative(); - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("Report_cumulative_inward",$this->global,$data, NULL); - } - - else - { - $this->loadViews("access", $this->global, $data, NULL); - } } @@ -962,15 +786,8 @@ class report extends BaseController //print_r($prod); $data['cum_month']=$this->dahsboard_Model->ireport_cum_month($sup,$mat); - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("Report_cumulative_month_inward",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } - } public function icum_year() { @@ -984,13 +801,7 @@ class report extends BaseController //print_r($sup); $data['cum_year']=$this->dahsboard_Model->ireport_cum_year($sup,$mat); - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("Report_cumulative_year_inward",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } } public function icum_day() @@ -1004,13 +815,7 @@ class report extends BaseController //print_r($prod); $data['cum_day']=$this->dahsboard_Model->ireport_cum_day($sup,$mat); - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("Report_cumulative_day_inward",$this->global,$data, NULL); - } - else{ - $this->loadViews("access", $this->global, $data, NULL); - } } @@ -1023,17 +828,7 @@ class report extends BaseController $data['cum']=$this->dahsboard_Model->rawi_report_cumulative(); - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("Report_cumulative_raw",$this->global,$data, NULL); - } - - else - { - $this->loadViews("access", $this->global, $data, NULL); - } - - } public function rawi_cum_year() { @@ -1092,14 +887,9 @@ class report extends BaseController $data['cust']=$this->dahsboard_Model->customer_name(); $data['finyear']=$this->dahsboard_Model->report_finyear(); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("Report_consolidate_raw",$this->global,$data, NULL); - } - else - { - $this->loadViews("access", $this->global, $data, NULL); - } + } public function rawi_consolidate_month() @@ -1120,15 +910,9 @@ class report extends BaseController $data['finyear']=$this->dahsboard_Model->report_finyear(); $data['spurchse']=$this->dahsboard_Model->rawi_consolidate_month($m,$cat,$sup,$fa,$aa); // print_r( $data['spurchse']); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("Report_consolidate_month",$this->global,$data, NULL); - } - else - { - $this->loadViews("access", $this->global, $data, NULL); - } - + } public function rawi_consolidate_year() { @@ -1147,14 +931,9 @@ class report extends BaseController $data['finyear']=$this->dahsboard_Model->report_finyear(); $data['spurchse']=$this->dahsboard_Model->rawi_consolidate_year($cat,$sup,$fa,$aa); // print_r( $data['spurchse']); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("Report_consolidate_year",$this->global,$data, NULL); - } - else - { - $this->loadViews("access", $this->global, $data, NULL); - } + } public function pending_purchase() @@ -1198,15 +977,9 @@ class report extends BaseController $data['finyear']=$this->dahsboard_Model->report_finyear(); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("Report_pending_purchase",$this->global,$data, NULL); - } - else - { - $this->loadViews("access", $this->global, $data, NULL); - } - + } public function per() @@ -1226,14 +999,9 @@ class report extends BaseController $data['fy']=$this->dahsboard_Model->fy(); $data['per']=$this->dahsboard_Model->per($fa,$aa,$m); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("report_emp",$this->global,$data, NULL); - } - else - { - $this->loadViews("access", $this->global, $data, NULL); - } + } public function cashbook() @@ -1264,16 +1032,9 @@ class report extends BaseController // $data['todayincome']=$this->dahsboard_Model->today_data_income(); // $data['todayexpense']=$this->dahsboard_Model->today_data_expense(); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("reportcashbook",$this->global,$data, NULL); - } - - else - { - $this->loadViews("access", $this->global, $data, NULL); - } - + } public function monthexpenses() @@ -1287,16 +1048,9 @@ class report extends BaseController $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("cashbookmonthlyexpenses",$this->global,$data, NULL); - } - - else - { - $this->loadViews("access", $this->global, $data, NULL); - } - + } public function yearexpenses() @@ -1309,15 +1063,8 @@ class report extends BaseController $data['yearlyreport']=$this->dahsboard_Model->yearexpensereport(); $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); - if($this->DEPCode == MANAGEMENT) - { - $this->loadviews("cashbookyearlyexpenses",$this->global,$data, NULL); - } - else - { - $this->loadViews("access", $this->global, $data, NULL); - } + $this->loadviews("cashbookyearlyexpenses",$this->global,$data, NULL); } public function cashbookdepartment() @@ -1328,15 +1075,8 @@ class report extends BaseController $data['departmentwise']=$this->dahsboard_Model->departmentwise($sid,$d); $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); - if($this->DEPCode == MANAGEMENT) - { + $this->loadviews("cashbookmonthlydep",$this->global,$data, NULL); -} - - else - { - $this->loadViews("access", $this->global, $data, NULL); - } } //for cashbook menu link// public function cashbookmonthmenu() @@ -1346,15 +1086,7 @@ class report extends BaseController $data['yearmonthwise']=$this->dahsboard_Model->yearmonthwise(); $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); //print_r($data['departmentwise']); - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("cashbookyearmonthwise",$this->global,$data, NULL); -} - - else - { - $this->loadViews("access", $this->global, $data, NULL); - } } public function yearmonthwise() { @@ -1363,30 +1095,14 @@ class report extends BaseController $data['yearmonthwise']=$this->dahsboard_Model->yearmonthwise($sid); $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); //print_r($data['departmentwise']); - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("cashbookyearmonthwise",$this->global,$data, NULL); -} - - else - { - $this->loadViews("access", $this->global, $data, NULL); - } } public function Viewtoday() { $this->global['pageTitle'] = 'Cashbook - viewtoday '; $data['tdy']=$this->dahsboard_Model->today(); $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); - if($this->DEPCode == MANAGEMENT) - { $this->loadviews("cashbooktoday",$this->global,$data, NULL); -} - - else - { - $this->loadViews("access", $this->global, $data, NULL); - } } public function depmenu() diff --git a/application/models/inwardgateregister_model.php b/application/models/inwardgateregister_model.php index 02fe0cbc..c0be934f 100644 --- a/application/models/inwardgateregister_model.php +++ b/application/models/inwardgateregister_model.php @@ -10,7 +10,7 @@ class inwardgateregister_model extends CI_Model function igrListing() { - $this->db->select('igr.*,PO.DeliveryDate,sup.SupplierName,igr.file,igrdetail.QuantityAsPerInvoice,POL.Quantity,MM.MaterialName'); + $this->db->select('igr.*,PO.DeliveryDate,sup.SupplierName,igr.file,igrdetail.*,POL.Quantity,MM.MaterialName'); $this->db->from('T_IGR_Master igr'); $this->db->join('T_PurchaseOrder_Master PO','igr.PONO = PO.PONO'); $this->db->join('T_SupplierDetailsN` sup','PO.SupplierID = sup.SupplierID'); @@ -132,7 +132,8 @@ class inwardgateregister_model extends CI_Model $this->db->join('T_PurchaseOrder_LineItem POL','igr.PONO = POL.PONO and POL.MaterialCode=igrd.MaterialCode '); $this->db->join('T_SupplierDetailsN sup', 'sup.SupplierID = POM.SupplierID'); $this->db->join('T_MaterialMaster MM', 'MM.MaterialCode = igrd.MaterialCode'); - $this->db->where('igr.IGRNO',$IGRNO); + $this->db->where('igrd.IGRItemNo',$IGRNO);//here not a igr no , igrlineitem no + //$this->db->where('igr.IGRNO',$IGRNO);//this where igno old flow $query = $this->db->get(); diff --git a/application/views/Mrirprintpdf.php b/application/views/Mrirprintpdf.php index 447d789c..dd606b64 100644 --- a/application/views/Mrirprintpdf.php +++ b/application/views/Mrirprintpdf.php @@ -168,6 +168,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
| Slip for Outward | +||||
|
+ SUPPLIER NAME : + |
+MRIR DATE | +MRIR CREATED BY | +COST CENTER CODE - NAME | +|||||||
|
+
|
++ | ||||||||
| IGRNO | +IGR CREATED BY | +IGR DATE | +PO NO | +PO DATE | +PO CREATED BY | +DC/ INV NO | +INVOICE DATE | +VECHICLE NO / COURIER NO | +||
| + + | ++ | + | + | + | + | + | + | + | ||
| SNO | +ITEM CODE | +DESCRIPTION | +UOM | +QUANTITY AS PER CHELLAN | +ACTUAL QUANTITY RECEIVED | +QUANTITY ACCEPTED | +QUANTITY REJECTED | +REMARKS | +||
| + | MaterialCode;?> | +MaterialName;?> | +UOM;?> | +QuantityAsPerInvoice;?> | +ActualQuantityReceived;?> | +QuantityAccepted;?> | +QuantityRejected;?> | +Remarks;?> | +||