From 41fc9df7d83eb9a673a9b8c2838d69f96032865c Mon Sep 17 00:00:00 2001 From: venbatechnologies Date: Tue, 15 May 2018 14:18:02 +0530 Subject: [PATCH] poedit --- .../controllers/emergencypurchaseorder.php | 398 +- application/controllers/purchaseorder.php | 1519 ++--- .../controllers/servicepurchaseorder.php | 10 + application/models/purchaseorder_model.php | 13 +- .../views/EditservicePurchaseorder.php | 8 +- application/views/alterpurchaseorder.php | 5828 ++++++++--------- application/views/editCapitalPo.php | 8 +- .../views/editRevenuepurchaseorder.php | 10 +- application/views/editimportpo.php | 8 +- 9 files changed, 3920 insertions(+), 3882 deletions(-) diff --git a/application/controllers/emergencypurchaseorder.php b/application/controllers/emergencypurchaseorder.php index ba6023a1..ccd53a4a 100755 --- a/application/controllers/emergencypurchaseorder.php +++ b/application/controllers/emergencypurchaseorder.php @@ -189,7 +189,7 @@ function addfile1() function addNewServicePurchaseOrder() { - //echo "t54"; + //echo "t54"; //die(); @@ -290,12 +290,12 @@ function addfile1() $DescriptionOfPo = $this->input->post('emergdescofpo'); //create T_Requestion_Master - $Request = array('ReqType'=>$POType, 'RequestedDept'=>$RequestedBy,'CostCenterCode'=>$CostCenterName,'Status'=>$ReqStatus,'Comments'=>$RequistionComments,'ReqDate'=>$createddt,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy,'Schedule_Type'=>$ServiceScheduleType,'NumberOfService'=>$ServiceServiceNo,'Service_Period'=>$ServiceScheduleOptions); - - $Req = $this->requistion_model->addRequistion($Request); - - $RegNo=''; - if(count($Req)>0) + $Request = array('ReqType'=>$POType, 'RequestedDept'=>$RequestedBy,'CostCenterCode'=>$CostCenterName,'Status'=>$ReqStatus,'Comments'=>$RequistionComments,'ReqDate'=>$createddt,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy,'Schedule_Type'=>$ServiceScheduleType,'NumberOfService'=>$ServiceServiceNo,'Service_Period'=>$ServiceScheduleOptions); + + $Req = $this->requistion_model->addRequistion($Request); + + $RegNo=''; + if(count($Req)>0) { $RegNo = $Req[0]['ReqNo']; } @@ -330,7 +330,7 @@ function addfile1() $AfterSgst = $this->input->post('AfterSgst'.$i); $AfterIgst = $this->input->post('AfterIgst'.$i); $OtherAmt = $this->input->post('OtherAmt'.$i); - $CostCenter = $this->input->post('costCode'.$i); + $CostCenter = $this->input->post('costCode'.$i); $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); $ServiceFrequency=$this->input->post('Frequency'.$i).' - '.$this->input->post('FrequencyValue'.$i); @@ -340,7 +340,7 @@ function addfile1() { for($j = 1; $j < count($comma_separated); $j++) { - $deletedRow = $comma_separated[$j]; + $deletedRow = $comma_separated[$j]; if($deletedRow == $i ) { @@ -353,22 +353,22 @@ function addfile1() if($SkipInsert == "False") { - //add requistion details - $ReqDetails = array('ReqNo'=>$RegNo, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Status'=>$RegDetailsStatus,'UpdatedBy'=>$CreateBy,'UpdatedOn'=>$createddt); - - - $ReqDetQuery = $this->requistion_model->addRequistionDetails($ReqDetails,$RegNo); - - - $ItemNo = ''; - if(count($ReqDetQuery)>0) - { - $ItemNo = $ReqDetQuery[0]['ItemNo']; - } - - $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$RegNo,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'ServiceMaterialDescription'=>$ServiceMaterialDescription,'ServiceFrequency'=>$ServiceFrequency,'Per'=>$Per,'ItemNo'=>$ItemNo); - - + //add requistion details + $ReqDetails = array('ReqNo'=>$RegNo, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Status'=>$RegDetailsStatus,'UpdatedBy'=>$CreateBy,'UpdatedOn'=>$createddt); + + + $ReqDetQuery = $this->requistion_model->addRequistionDetails($ReqDetails,$RegNo); + + + $ItemNo = ''; + if(count($ReqDetQuery)>0) + { + $ItemNo = $ReqDetQuery[0]['ItemNo']; + } + + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$RegNo,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'ServiceMaterialDescription'=>$ServiceMaterialDescription,'ServiceFrequency'=>$ServiceFrequency,'Per'=>$Per,'ItemNo'=>$ItemNo); + + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); $LineItemNo = ''; if(count($POLineItem)>0) @@ -413,22 +413,22 @@ if($POStatus==SPECIAL_PO){ if($POStatus == REQ_DRAFT) - { - // echo 'Emergency Service Purchase Order Saved Successfully!The PO NO Is: '.$PONO; + { + // echo 'Emergency Service Purchase Order Saved Successfully!The PO NO Is: '.$PONO; echo ""; redirect('purchaseorder/PurchaseOrderList','refresh'); - - } - else - { - // echo 'Emergency Service Purchase Order Created Successfully!The PO NO Is: '.$PONO; + + } + else + { + // echo 'Emergency Service Purchase Order Created Successfully!The PO NO Is: '.$PONO; echo ""; redirect('purchaseorder/PurchaseOrderList','refresh'); - - } + + } } @@ -436,19 +436,19 @@ if($POStatus==SPECIAL_PO){ //This used to Create Revenue Emergency Purchase Order - function addNewRevenuePurchaseOrder() - { + function addNewRevenuePurchaseOrder() + { $txtspl=$this->input->post('txtSpecial'); - - //echo "Emergency Revenue PO"; - $POdt =$this->input->post('PODate'); - $PODate = $this->getDateformat($POdt); + + //echo "Emergency Revenue PO"; + $POdt =$this->input->post('PODate'); + $PODate = $this->getDateformat($POdt); $SupplierID = $this->input->post('drpSupplier'); - $DeliveryAddr = $this->input->post('DeliveryAddr'); - $dt = $this->input->post('Deliverydt'); - $DeliveryOption = $this->input->post('DateRange'); + $DeliveryAddr = $this->input->post('DeliveryAddr'); + $dt = $this->input->post('Deliverydt'); + $DeliveryOption = $this->input->post('DateRange'); if($DeliveryOption==1){ $Deliverydt = ''; $DeliverySchedule = $this->input->post('Scheduleby'); @@ -457,26 +457,26 @@ if($POStatus==SPECIAL_PO){ $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){ - $insuranceno=$this->input->post('insuranceNo'); - }else{ - $insuranceno=""; - } - $CostCenterName = $this->input->post('CostCenterName'); - $POType = $this->input->post('POType'); - $PoRange = $this->input->post('txtPoRange'); - - $SpcialInstruction = $this->input->post('txtSpcialInstruction'); + + $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{ + $insuranceno=""; + } + $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'); + $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); if($txtspl==0) { @@ -487,17 +487,17 @@ if($POStatus==SPECIAL_PO){ $POStatus=SPECIAL_PO; } - //$POStatus = $this->input->post('TextStatus'); + //$POStatus = $this->input->post('TextStatus'); $RequestedBy = $this->input->post('drpDepartment'); $CreateBy = $this->session->userdata ( 'userId' ); - // $RowCount = $this->input->post('TextRowCount'); + // $RowCount = $this->input->post('TextRowCount'); $RowCount=$this->input->post('txtRowCount1'); $BudgetType = $this->input->post('Budget'); - //echo $RowCount; - // $DeletedRow = $this->input->post('TextDeletedRowCount'); + //echo $RowCount; + // $DeletedRow = $this->input->post('TextDeletedRowCount'); $DeletedRow = $this->input->post('txtDeletedRow1'); @@ -506,15 +506,15 @@ $RequestedBy = $this->input->post('drpDepartment'); $splRow = $this->input->post('splrow'); // echo $DeletedRow; - + $ReqStatus = REQITEM_Emergency_PO_CREATED; $Local_Interstate=$this->input->post('Range'); - - $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'); + + $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'); if($POStatus==SPECIAL_PO) @@ -529,95 +529,95 @@ $RequestedBy = $this->input->post('drpDepartment'); - //add requistion - $Request = array('ReqType'=>$POType, 'RequestedDept'=>$RequestedBy,'CostCenterCode'=>$CostCenterName,'Status'=>$ReqStatus,'Comments'=>$RequistionComments,'ReqDate'=>$createddt,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy); - - $Req = $this->requistion_model->addRequistion($Request); - - $RegNo=''; - if(count($Req)>0) + //add requistion + $Request = array('ReqType'=>$POType, 'RequestedDept'=>$RequestedBy,'CostCenterCode'=>$CostCenterName,'Status'=>$ReqStatus,'Comments'=>$RequistionComments,'ReqDate'=>$createddt,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy); + + $Req = $this->requistion_model->addRequistion($Request); + + $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,'BudgetType'=>$BudgetType); - //print_r($POList); - $POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$revenuetype); - - $PONO = ''; - if(count($POMaster)>0) - { - $PONO = $POMaster[0]['PONO']; - } - //echo $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); + // 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,'BudgetType'=>$BudgetType); + //print_r($POList); + $POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$revenuetype); + + $PONO = ''; + if(count($POMaster)>0) + { + $PONO = $POMaster[0]['PONO']; + } + //echo $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); + $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") - { - //add requistion details - $ReqDetails = array('ReqNo'=>$RegNo, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Status'=>$RegDetailsStatus,'UpdatedBy'=>$CreateBy,'UpdatedOn'=>$createddt); - - - $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); - //print_r($POLineItemList); - $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - - $LineItemNo = ''; - if(count($POLineItem)>0) - { - $LineItemNo = $POLineItem[0]['LineItemNo']; - } - //echo $LineItemNo; + $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") + { + //add requistion details + $ReqDetails = array('ReqNo'=>$RegNo, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Status'=>$RegDetailsStatus,'UpdatedBy'=>$CreateBy,'UpdatedOn'=>$createddt); + + + $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); + //print_r($POLineItemList); + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + + $LineItemNo = ''; + if(count($POLineItem)>0) + { + $LineItemNo = $POLineItem[0]['LineItemNo']; + } + //echo $LineItemNo; /*----------------------------*/ $logpo =array('PONO'=>$PONO,'Date'=>$PODate,'POType'=>$POType,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'SupplierID'=>$SupplierID,'LineItemNos'=>$LineItemNo); @@ -628,18 +628,18 @@ $RequestedBy = $this->input->post('drpDepartment'); /*----------------------------*/ - - if(trim($POType) == REVENUE ) - { - // echo 'Success'; - $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); - //print_r($RevenueTaxList); - $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); - //echo 'Revenue tax Success'; - } - } - - } + + if(trim($POType) == REVENUE ) + { + // echo 'Success'; + $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); + //print_r($RevenueTaxList); + $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); + //echo 'Revenue tax Success'; + } + } + + } if($txtspl==1 || $txtspl==2) @@ -857,15 +857,15 @@ $RequestedBy = $this->input->post('drpDepartment'); } - //if($result > 0) + //if($result > 0) // { - - + + echo ""; - redirect('purchaseorder/PurchaseOrderList','refresh'); + redirect('purchaseorder/PurchaseOrderList','refresh'); // } - - } + + } /** @@ -939,7 +939,7 @@ $RequestedBy = $this->input->post('drpDepartment'); $result = array(); foreach ($Req as $SID): - $ReqArray[] = $SID->ReqNo ; + $ReqArray[] = $SID->ReqNo ; $result[] = $this->purchaseorder_model->getRawPOMaterialList($SID->ReqNo); $ReqType = $SID->ReqType; //echo $SID->ReqNo; @@ -997,7 +997,7 @@ $RequestedBy = $this->input->post('drpDepartment'); $result = array(); $ReqArray = array(); foreach ($Req as $SID): - $ReqArray[] = $SID->ReqNo ; + $ReqArray[] = $SID->ReqNo ; $result[] = $this->purchaseorder_model->getRawPOMaterialList($SID->ReqNo); endforeach; $data['MaterialList'] = $result;//$this->purchaseorder_model->getRawMaterialList($ReqType,$ReqArray); @@ -1164,17 +1164,17 @@ $RequestedBy = $this->input->post('drpDepartment'); $Designation = $result[$i]['Designation']; $HTML.=" - - ". $ReqNo." - - ".$ReqType." - - ".$Reqedby." - ".$ReqDate." - ".$Status." - ".$Department." - ".$Designation." - "; + + ". $ReqNo." + + ".$ReqType." + + ".$Reqedby." + ".$ReqDate." + ".$Status." + ".$Department." + ".$Designation." + "; } //print_r( $HTML); die(json_encode(array('ReqList' =>$HTML))); @@ -1198,14 +1198,14 @@ $RequestedBy = $this->input->post('drpDepartment'); $UOM = $result[$i]['UOM']; $Quantity = $result[$i]['Quantity']; $HTML.=" - ".$SNo." - ". $MaterialCode." - - ".$MaterialName." - - ".$UOM." - ".$Quantity." - "; + ".$SNo." + ". $MaterialCode." + + ".$MaterialName." + + ".$UOM." + ".$Quantity." + "; //$index = $index + 1; @@ -1250,7 +1250,7 @@ $RequestedBy = $this->input->post('drpDepartment'); $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $createddt = $dt->format('Y-m-d H:i:s'); - $Local_Interstate=$this->input->post('Range'); + $Local_Interstate=$this->input->post('Range'); // PO Master $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus,'PORange'=>$PoRange,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt ,'CapitalRange'=>$Local_Interstate ); @@ -1300,14 +1300,14 @@ $RequestedBy = $this->input->post('drpDepartment'); $AfterFreightValue = $this->input->post('AfterFreightVal'.$i); $InsuranceValue = $this->input->post('Insval'.$i); $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); - $CostCenter = $this->input->post('costCode'.$i); + $CostCenter = $this->input->post('costCode'.$i); $SkipInsert = "False"; if( count($comma_separated) > 0) { for($j = 1; $j < count($comma_separated); $j++) { - $deletedRow = $comma_separated[$j] ; + $deletedRow = $comma_separated[$j] ; if($deletedRow == $i ) { @@ -1336,7 +1336,7 @@ $RequestedBy = $this->input->post('drpDepartment'); /*--------------*/ if(trim($POType) == REVENUE ) { - // echo 'Success'; + // echo 'Success'; $RevenueTaxList = array('LineItemNo'=>$LineItemNo, 'DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'ExciseDuty'=>$ExciseValue,'ExciseDutyCalulatedOn'=>$ExciseOption,'AfterExciseDuty'=>$AfterExciseValue,'Vat'=>$VatValue,'AfterVAT'=>$AfterVatValue,'VatCalulatedOn'=>$VatOption, 'CST'=>$CSTValue,'AfterCST'=>$AfterCSTValue,'CSTCalulatedOn'=>$CSTOption,'GST'=>$GSTValue,'AfterGST'=>$AfterGSTValue,'OtherTaxes'=>$OtherTaxValue,'AfterOtherTaxes'=>$AfterOtherTaxValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt); $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); @@ -1379,7 +1379,7 @@ $RequestedBy = $this->input->post('drpDepartment'); $comma_separated = explode(':', $DeletedRow); $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $updateddt = $dt->format('Y-m-d H:i:s'); - $Local_Interstate=$this->input->post('Range'); + $Local_Interstate=$this->input->post('Range'); // PO Master // PO Master $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'Status'=>$POStatus,'ServiceDescription'=>$SpcialInstruction,'UpdateBY'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt,'CapitalRange'=>$Local_Interstate ); @@ -1429,7 +1429,7 @@ $RequestedBy = $this->input->post('drpDepartment'); $InsuranceValue = $this->input->post('Insval'.$i); $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); $POLineItemNo = $this->input->post('LineItemNo'.$i); - $CostCenter = $this->input->post('costCode'.$i); + $CostCenter = $this->input->post('costCode'.$i); $LineItemNo = ''; @@ -1453,7 +1453,7 @@ $RequestedBy = $this->input->post('drpDepartment'); { for($j = 1; $j < count($comma_separated); $j++) { - $deletedRow = $comma_separated[$j] ; + $deletedRow = $comma_separated[$j] ; if($deletedRow == $i ) { @@ -1547,7 +1547,7 @@ $RequestedBy = $this->input->post('drpDepartment'); public function servicepoprint($PONO) { - // $this->load->view('includes/pdfheader'); + // $this->load->view('includes/pdfheader'); // Load the pdf page with multiviews $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformation(); diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index 17c30fb2..c7e3ecd1 100755 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -20,10 +20,10 @@ class purchaseorder extends BaseController { parent::__construct(); $this->load->model('purchaseorder_model'); - - $this->load->library('session'); - $this->load->library('form_validation'); - $this->load->model('requistion_model'); + + $this->load->library('session'); + $this->load->library('form_validation'); + $this->load->model('requistion_model'); $this->isLoggedIn(); } @@ -127,17 +127,17 @@ function edited(){ */ public function index() { - $this->global['pageTitle'] = 'Siddharth : AddPO'; + $this->global['pageTitle'] = 'Siddharth : AddPO'; $this->loadViews("addPO", $this->global, NULL , NULL); } - function viewfullpurchaseorder() - { - $this->global['pageTitle'] = 'Siddharth : View Purchase Order'; + function viewfullpurchaseorder() + { + $this->global['pageTitle'] = 'Siddharth : View Purchase Order'; $this->loadViews("viewfullpurchaseorder", $this->global,Null); - - } + + } function advancerequest() { $this->global['pageTitle'] = 'Siddharth : Advance Request'; @@ -152,18 +152,18 @@ function edited(){ } - function requisition() - { - $data['DeptList'] = $this->purchaseorder_model->getDepartmentListForAllReq(); - - $data['stList'] = $this->purchaseorder_model->getStatusListforAllReq(); - /* Cost code from Requisition - Client Review Fix - Start here */ - // $data['ReqList'] = $this->purchaseorder_model->getRequistionListbySearch(); - - $data['ReqList'] = $this->purchaseorder_model->getAllRequistionListToCreatePO(); - /* End Here */ - $this->global['pageTitle'] = 'Siddharth : Create PO from Requisition List'; + function requisition() + { + $data['DeptList'] = $this->purchaseorder_model->getDepartmentListForAllReq(); + + $data['stList'] = $this->purchaseorder_model->getStatusListforAllReq(); + /* Cost code from Requisition - Client Review Fix + Start here */ + // $data['ReqList'] = $this->purchaseorder_model->getRequistionListbySearch(); + + $data['ReqList'] = $this->purchaseorder_model->getAllRequistionListToCreatePO(); + /* End Here */ + $this->global['pageTitle'] = 'Siddharth : Create PO from Requisition List'; @@ -171,10 +171,10 @@ function edited(){ - } - - - /** + } + + + /** * This function is used to load the purchaseorder list */ function PurchaseOrderList() @@ -184,11 +184,11 @@ function edited(){ // $count = $this->purchaseorder_model->purchaseorderListingCount(''); - //$returns = $this->paginationCompress ( "purchaseorderListing/", $count, 10 ); + //$returns = $this->paginationCompress ( "purchaseorderListing/", $count, 10 ); - $this->purchaseorder_model->UpdateRequistionStatus(); - - $data['POData'] = $this->purchaseorder_model->purchaseorderListing(); + $this->purchaseorder_model->UpdateRequistionStatus(); + + $data['POData'] = $this->purchaseorder_model->purchaseorderListing(); $this->global['pageTitle'] = 'Siddharth : Purchase Orders'; @@ -202,9 +202,9 @@ function edited(){ - function Req_validate($selectValue) + function Req_validate($selectValue) { - //echo 'select_validate method called'; + //echo 'select_validate method called'; // 'none' is the first option and the text says something like "-Choose one-" if(strlen($selectValue) == 0) { @@ -217,7 +217,7 @@ function edited(){ } } - /** + /** * This function used to show the Purchase Order Screen */ function CreatePurchaseOrder() @@ -243,7 +243,7 @@ function edited(){ $data['Suplist'] = $this->purchaseorder_model->getSupplierName(); $data['Payment']=$this->purchaseorder_model->getPaymentTermsDetails(); // print_r($data['Payment']); - + $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); @@ -277,23 +277,23 @@ function edited(){ $data['RequistionDetails'] = $ReqDetails; $CostCode = ''; - - $this->load->model('costcenter_model'); + + $this->load->model('costcenter_model'); $FYStart = ''; - $FYEnd = ''; - $FiscalYear = $this->costcenter_model->getFiscalYear(); - if(!empty($FiscalYear)) - { - foreach ($FiscalYear as $Fy) - { - $FYStart =$Fy->StartYear; - $FYEnd =$Fy->EndYear; + $FYEnd = ''; + $FiscalYear = $this->costcenter_model->getFiscalYear(); + if(!empty($FiscalYear)) + { + foreach ($FiscalYear as $Fy) + { + $FYStart =$Fy->StartYear; + $FYEnd =$Fy->EndYear; //$FYEnd=$FYStart+1; - } - - } - - $FYdt = $FYStart." - ".$FYEnd ; + } + + } + + $FYdt = $FYStart." - ".$FYEnd ; //echo $FYEnd; @@ -362,11 +362,11 @@ function edited(){ } else if($ReqType == CAPITAL) { - $data['staticspecialinstruction']=$this->purchaseorder_model->getConfigValue('C027'); - $CapitalAvlBudget = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode,$FYdt,$ReqType); - - - if(count($CapitalAvlBudget)>0) + $data['staticspecialinstruction']=$this->purchaseorder_model->getConfigValue('C027'); + $CapitalAvlBudget = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode,$FYdt,$ReqType); + + + if(count($CapitalAvlBudget)>0) { @@ -382,59 +382,59 @@ function edited(){ } - function CreatePOPrint() - { - $PONO = $_GET['PONO']; - $ReqType = $_GET['ReqType']; + function CreatePOPrint() + { + $PONO = $_GET['PONO']; + $ReqType = $_GET['ReqType']; - - if($ReqType == SERVICE) - { - $this ->servicepoprint($PONO); - - } + + if($ReqType == SERVICE) + { + $this ->servicepoprint($PONO); + + } - else if($ReqType == REVENUE) - { - $this ->revenuepoprint($PONO); - - } + else if($ReqType == REVENUE) + { + $this ->revenuepoprint($PONO); + + } - else if($ReqType == IMPORT) - { - $this ->importpoprint($PONO); - - } - else if($ReqType == CAPITAL) - { - $this ->CapitalPoPrint($PONO); - - } - } + else if($ReqType == IMPORT) + { + $this ->importpoprint($PONO); + + } + else if($ReqType == CAPITAL) + { + $this ->CapitalPoPrint($PONO); + + } + } - function CreaterevenuePOPrint() - { - $this->load->View("revenuepopdf", NULL); - } - function CreateservicePOPrint() - { - $this->load->View("servicepopdf", NULL); - } - function CreateimportPOPrint() - { - $this->load->View("importpopdf", NULL); - } - function CreatecapitalPOPrint() - { - $this->load->View("capitalpopdf", NULL); - } - //To View/Update Purchase Order - + function CreaterevenuePOPrint() + { + $this->load->View("revenuepopdf", NULL); + } + function CreateservicePOPrint() + { + $this->load->View("servicepopdf", NULL); + } + function CreateimportPOPrint() + { + $this->load->View("importpopdf", NULL); + } + function CreatecapitalPOPrint() + { + $this->load->View("capitalpopdf", NULL); + } + //To View/Update Purchase Order + function EditPurchaseOrder() { $PONO = $_GET['PONO']; @@ -480,19 +480,19 @@ function edited(){ $CostCode = ''; $this->load->model('costcenter_model'); $FYStart = ''; - $FYEnd = ''; - $FiscalYear = $this->costcenter_model->getFiscalYear(); - if(!empty($FiscalYear)) - { - foreach ($FiscalYear as $Fy) - { - $FYStart =$Fy->StartYear; - $FYEnd =$Fy->EndYear; - } - - } - - $FYdt = $FYStart." - ".$FYEnd ; + $FYEnd = ''; + $FiscalYear = $this->costcenter_model->getFiscalYear(); + if(!empty($FiscalYear)) + { + foreach ($FiscalYear as $Fy) + { + $FYStart =$Fy->StartYear; + $FYEnd =$Fy->EndYear; + } + + } + + $FYdt = $FYStart." - ".$FYEnd ; foreach ($ReqDetails as $Rs): $CostCode = $Rs->CostCenterCode; endforeach; @@ -534,8 +534,9 @@ function edited(){ $data['PaymentTerms']=$this->purchaseorder_model->GetPaymentTerms($PONO); //$data['WorkStatus']=$this->purchaseorder_model->GetWorkStatus('C019'); - + $data['WorkStatus']=$this->purchaseorder_model->getStatus(7); + //print_r($data);die; $this->global['pageTitle'] = 'Siddharth : Edit Service Purchase order form'; $this->loadViews("EditservicePurchaseorder", $this->global, $data, NULL); } @@ -594,10 +595,10 @@ function edited(){ { $CapitalRange = $_GET['CapitalRange']; - $CapitalAvlBudget = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode,$FYdt,$ReqType); - - - if(count($CapitalAvlBudget)>0) + $CapitalAvlBudget = $this->purchaseorder_model->GetAvailableCapitalBudgetAmount($CostCode,$FYdt,$ReqType); + + + if(count($CapitalAvlBudget)>0) { @@ -830,217 +831,217 @@ function edited(){ } - - // To get the Material value based on the MaterialCode - function getDetailsforReq() - { - - - $SearchFilter= $this->input->post('id'); - // $reqDate= $this->input->post('ReqDate'); - $DeptCode = $SearchFilter[0]; - $MatType = $SearchFilter[1]; - $ReqNo = $SearchFilter[2]; - // $ReqDetai = $this->purchaseorder_model->getRequistDetails( $EmpID ); - - $CostList = $this->requistion_model->GetCostCenterByDept( $DeptCode); - - $HTML = ""; - $BudAmount = ""; - if(count($CostList) > 0) - { - for ($j = 0; $j < count($CostList); $j++) - { - $Code = $CostList[$j]['CostCenterCode']; - $Name = $CostList[$j]['CostCenterName']; - $HTML .=""; - } - } - $MaterialDetails = $this->purchaseorder_model->getRawMaterialListForPO($MatType,$ReqNo); - - $HTML1 = ""; - - if(count($MaterialDetails) > 0) - { - for ($j = 0; $j < count($MaterialDetails); $j++) - { - $Code = $MaterialDetails[$j]['MaterialCode']; - $Name = $MaterialDetails[$j]['MaterialName']; - $HTML1 .=""; - - } - - } - // print_r($HTML1); - - die(json_encode(array('MatDetail' =>$HTML1,'Cost'=> $HTML))); - } - /* This method to get the status based on the Department selection in th - */ - function getStatusByDepartment() - { - $DepId = $this->input->post('id'); - - $data = $this->purchaseorder_model->getStatusByDepartment($DepId); - - $HTML = ""; - if(count($data) > 0) - { - for ($j = 0; $j < count($data); $j++) - { - $Code = $data[$j]['StatusCode']; - $Name = $data[$j]['StatusName']; - $HTML .=""; - } - } - //echo $HTML; - die(json_encode(array('depStaus' => $HTML))); - } - - // To get the available Budget Amount - function AvilBudgetAmount() - { - $SearchFilter= $this->input->post('id'); - // $reqDate= $this->input->post('ReqDate'); - $CostCode = $SearchFilter[0]; - $ReqType = $SearchFilter[1]; - print_r($SearchFilter); - $CostCode= $this->input->post('id'); - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - - $Year = $dt->format('Y'); - $this->load->model('purchaseorder_model'); - $result = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$Year,$ReqType); - //print_r($result); - $AvilBudAmt = ''; - if(count($result)>0) - { - $AvilBudAmt = $result[0]['BudgetAmount'] - $result[0]['Totalvalue']; - } - - print_r($AvilBudAmt); - - } - - - function getDateformat($Val) - { - $date = new DateTime($Val,new DateTimeZone('Asia/Kolkata')); - $retDate = $date->format('Y-m-d H:i:s'); - return $retDate; - } - /* Method to get the Requistion list based on the search filter*/ - - function SearchListofRequistion() - { - $SearchFilter= $this->input->post('id'); - - $DEPCode = $SearchFilter[0]; - $Status = $SearchFilter[1]; - $rng = $SearchFilter[2];; - - $FromDate =''; - $ToDate = ''; - - $Dt = explode("-",$rng); - - if(count( $Dt)>1) - { - $FDate = $Dt[0]; - $TDate = $Dt[1]; - $FromDate = $this->getDateformat($FDate); - $ToDate = $this->getDateformat($TDate); - } - - $result = $this->purchaseorder_model->getRequistionListbySearch($DEPCode,$Status,$FromDate,$ToDate); - - - $HTML=""; - for ($i = 0; $i < count($result); $i++) - { - $SNo = $i + 1; - $ReqNo = $result[$i]['ReqNo']; - $ReqType = $result[$i]['ReqType']; - $Reqedby = $result[$i]['FirstName']; - $ReqDate = $result[$i]['ReqDate']; - $Status = $result[$i]['StatusName']; - $Department = $result[$i]['DepartmentName']; - $Designation = $result[$i]['Designation']; - - $HTML.=" - - ". $ReqNo." - - ".$ReqType." - - ".$Reqedby." - ".$ReqDate." - ".$Status." - ".$Department." - ".$Designation." - "; - } - die(json_encode(array('ReqList' =>$HTML))); - } - - - /* To View the request details*/ - function ListPORequistion() - { - $ReqNo= $this->input->post('id'); - $result = $this->requistion_model->getRequistItemList($ReqNo); - $ReqList = $this->requistion_model->getRequistDetails($ReqNo); - $DepNo = $ReqList[0]['DEPCode']; - $CostList = $this->requistion_model->GetCostCenterByDept($DepNo); - $HTML=""; - for ($i = 0; $i < count($result); $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; - } - - $CostCenter = ""; - if(count($CostList) > 0) - { + // To get the Material value based on the MaterialCode + function getDetailsforReq() + { + + + $SearchFilter= $this->input->post('id'); + // $reqDate= $this->input->post('ReqDate'); + $DeptCode = $SearchFilter[0]; + $MatType = $SearchFilter[1]; + $ReqNo = $SearchFilter[2]; + // $ReqDetai = $this->purchaseorder_model->getRequistDetails( $EmpID ); + + $CostList = $this->requistion_model->GetCostCenterByDept( $DeptCode); + + $HTML = ""; + $BudAmount = ""; + if(count($CostList) > 0) + { for ($j = 0; $j < count($CostList); $j++) - { - $Code = $CostList[$j]['CostCenterCode']; - $Name = $CostList[$j]['CostCenterName']; - $CostCenter .=""; - } - } - - die(json_encode(array('Items' =>$HTML,'Requist'=>$ReqList,'Cost'=>$CostCenter))); + { + $Code = $CostList[$j]['CostCenterCode']; + $Name = $CostList[$j]['CostCenterName']; + $HTML .=""; + } + } + $MaterialDetails = $this->purchaseorder_model->getRawMaterialListForPO($MatType,$ReqNo); + + $HTML1 = ""; + + if(count($MaterialDetails) > 0) + { + for ($j = 0; $j < count($MaterialDetails); $j++) + { + $Code = $MaterialDetails[$j]['MaterialCode']; + $Name = $MaterialDetails[$j]['MaterialName']; + $HTML1 .=""; + + } + + } + // print_r($HTML1); + + die(json_encode(array('MatDetail' =>$HTML1,'Cost'=> $HTML))); + } + /* This method to get the status based on the Department selection in th + */ + function getStatusByDepartment() + { + $DepId = $this->input->post('id'); + + $data = $this->purchaseorder_model->getStatusByDepartment($DepId); + + $HTML = ""; + if(count($data) > 0) + { + for ($j = 0; $j < count($data); $j++) + { + $Code = $data[$j]['StatusCode']; + $Name = $data[$j]['StatusName']; + $HTML .=""; + } + } + //echo $HTML; + die(json_encode(array('depStaus' => $HTML))); + } + + // To get the available Budget Amount + function AvilBudgetAmount() + { + $SearchFilter= $this->input->post('id'); + // $reqDate= $this->input->post('ReqDate'); + $CostCode = $SearchFilter[0]; + $ReqType = $SearchFilter[1]; + print_r($SearchFilter); + $CostCode= $this->input->post('id'); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + + $Year = $dt->format('Y'); + $this->load->model('purchaseorder_model'); + $result = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode,$Year,$ReqType); + //print_r($result); + $AvilBudAmt = ''; + if(count($result)>0) + { + $AvilBudAmt = $result[0]['BudgetAmount'] - $result[0]['Totalvalue']; + } + + print_r($AvilBudAmt); + + } + + + function getDateformat($Val) + { + $date = new DateTime($Val,new DateTimeZone('Asia/Kolkata')); + $retDate = $date->format('Y-m-d H:i:s'); + return $retDate; + } + /* Method to get the Requistion list based on the search filter*/ + + function SearchListofRequistion() + { + $SearchFilter= $this->input->post('id'); + + $DEPCode = $SearchFilter[0]; + $Status = $SearchFilter[1]; + $rng = $SearchFilter[2];; + + $FromDate =''; + $ToDate = ''; + + $Dt = explode("-",$rng); + + if(count( $Dt)>1) + { + $FDate = $Dt[0]; + $TDate = $Dt[1]; + $FromDate = $this->getDateformat($FDate); + $ToDate = $this->getDateformat($TDate); + } + + $result = $this->purchaseorder_model->getRequistionListbySearch($DEPCode,$Status,$FromDate,$ToDate); + + + $HTML=""; + for ($i = 0; $i < count($result); $i++) + { + $SNo = $i + 1; + $ReqNo = $result[$i]['ReqNo']; + $ReqType = $result[$i]['ReqType']; + $Reqedby = $result[$i]['FirstName']; + $ReqDate = $result[$i]['ReqDate']; + $Status = $result[$i]['StatusName']; + $Department = $result[$i]['DepartmentName']; + $Designation = $result[$i]['Designation']; + + $HTML.=" + + ". $ReqNo." + + ".$ReqType." + + ".$Reqedby." + ".$ReqDate." + ".$Status." + ".$Department." + ".$Designation." + "; + } + die(json_encode(array('ReqList' =>$HTML))); } - + + + /* To View the request details*/ + function ListPORequistion() + { + $ReqNo= $this->input->post('id'); + $result = $this->requistion_model->getRequistItemList($ReqNo); + $ReqList = $this->requistion_model->getRequistDetails($ReqNo); + $DepNo = $ReqList[0]['DEPCode']; + $CostList = $this->requistion_model->GetCostCenterByDept($DepNo); + $HTML=""; + for ($i = 0; $i < count($result); $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; + + } + + $CostCenter = ""; + if(count($CostList) > 0) + { + for ($j = 0; $j < count($CostList); $j++) + { + $Code = $CostList[$j]['CostCenterCode']; + $Name = $CostList[$j]['CostCenterName']; + $CostCenter .=""; + } + } + + die(json_encode(array('Items' =>$HTML,'Requist'=>$ReqList,'Cost'=>$CostCenter))); + } + //This used to Create Revenue Purchase Order - - function addNewPurchaseOrder() - { + + function addNewPurchaseOrder() + { - $POdt =$this->input->post('PODate'); - $PODate = $this->getDateformat($POdt); + $POdt =$this->input->post('PODate'); + $PODate = $this->getDateformat($POdt); $SupplierID = $this->input->post('drpSupplier'); - $DeliveryAddr = $this->input->post('DeliveryAddr'); - $dt = $this->input->post('Deliverydt'); - $POType = $this->input->post('POType'); + $DeliveryAddr = $this->input->post('DeliveryAddr'); + $dt = $this->input->post('Deliverydt'); + $POType = $this->input->post('POType'); $DeliveryOption = $this->input->post('DateRange'); if($DeliveryOption==1){ $Deliverydt = ''; @@ -1052,150 +1053,150 @@ function edited(){ } - $POType = $this->input->post('POType'); + $POType = $this->input->post('POType'); $BudgetType = $this->input->post('Budget'); - //$PoRange = $this->input->post('txtPoRange'); - - $Modeofshipment=$this->input->post('addmodeofshipment'); - $supplierreference=$this->input->post('addsupplierreference'); - $supplieroffno=$this->input->post('addsupplierofferno'); - $otherreference=$this->input->post('addotherreference'); - $fincap=$this->input->post('addfincap'); - $revenuetype=$this->input->post('PoTypeOptions'); - $insurancestatus=$this->input->post('insurance'); - if($insurancestatus == 1){ - $insuranceno=$this->input->post('insuranceno'); - }else{ - $insuranceno=$this->input->post('insuranceno'); - } - $SpcialInstruction = $this->input->post('SpcialInstruction'); - $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); + //$PoRange = $this->input->post('txtPoRange'); + + $Modeofshipment=$this->input->post('addmodeofshipment'); + $supplierreference=$this->input->post('addsupplierreference'); + $supplieroffno=$this->input->post('addsupplierofferno'); + $otherreference=$this->input->post('addotherreference'); + $fincap=$this->input->post('addfincap'); + $revenuetype=$this->input->post('PoTypeOptions'); + $insurancestatus=$this->input->post('insurance'); + if($insurancestatus == 1){ + $insuranceno=$this->input->post('insuranceno'); + }else{ + $insuranceno=$this->input->post('insuranceno'); + } + $SpcialInstruction = $this->input->post('SpcialInstruction'); + $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); $POStatus = $this->input->post('txtStatus'); $CreateBy = $this->session->userdata ( 'userId' ); - $RowCount = $this->input->post('txtRowCount'); - $DeletedRow = $this->input->post('txtDeletedRow'); - - $comma_separated = explode(':', $DeletedRow); - - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $createddt = $dt->format('Y-m-d H:i:s'); + $RowCount = $this->input->post('txtRowCount'); + $DeletedRow = $this->input->post('txtDeletedRow'); + + $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('PaymentTerms'); + $PaymentTerms=$this->input->post('PaymentTerms'); $OtherPayment=$this->input->post('Otherpayment'); - $Local_Interstate=$this->input->post('Range'); + $Local_Interstate=$this->input->post('Range'); $Qualitycheck=1; - // PO Master - $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'Status'=>$POStatus,'PORange'=>$Local_Interstate,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'CapitalRange'=>$Local_Interstate,'PaymentOtherDescription'=>$OtherPayment,'Supplier_Reference'=>$supplierreference,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Offer_No'=>$supplieroffno,'Other_Reference'=>$otherreference,'Fincap'=>$fincap,'InsuranceStatus'=>$insurancestatus,'POSubType'=>$revenuetype,'InsuranceNumber'=>$insuranceno,'IsQualityChkReqired'=>$Qualitycheck,'BudgetType'=>$BudgetType); + // PO Master + $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'Status'=>$POStatus,'PORange'=>$Local_Interstate,'ServiceDescription'=>$SpcialInstruction,'CreatedBy'=>$CreateBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'CreatedDate'=>$createddt,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'CapitalRange'=>$Local_Interstate,'PaymentOtherDescription'=>$OtherPayment,'Supplier_Reference'=>$supplierreference,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Offer_No'=>$supplieroffno,'Other_Reference'=>$otherreference,'Fincap'=>$fincap,'InsuranceStatus'=>$insurancestatus,'POSubType'=>$revenuetype,'InsuranceNumber'=>$insuranceno,'IsQualityChkReqired'=>$Qualitycheck,'BudgetType'=>$BudgetType); // print_r($POList); // die(); - - $POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$revenuetype); - - $PONO = ''; - if(count($POMaster)>0) - { - $PONO = $POMaster[0]['PONO']; - } - - // PO Line Items - $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); + + $POMaster = $this->purchaseorder_model->addPOMaster($POList,$POType,$revenuetype); + + $PONO = ''; + if(count($POMaster)>0) + { + $PONO = $POMaster[0]['PONO']; + } + + // PO Line Items + $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); + $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); + $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") - { - $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Per'=>$per,'ServiceMaterialDescription'=>$revenuedescription,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter); - //print_r($POLineItemList); - $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - - $LineItemNo = ''; - if(count($POLineItem)>0) - { - $LineItemNo = $POLineItem[0]['LineItemNo']; - } - //echo $LineItemNo; + $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") + { + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Per'=>$per,'ServiceMaterialDescription'=>$revenuedescription,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter); + //print_r($POLineItemList); + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + + $LineItemNo = ''; + if(count($POLineItem)>0) + { + $LineItemNo = $POLineItem[0]['LineItemNo']; + } + //echo $LineItemNo; /*---------*/ - $logpo =array('PONO'=>$PONO,'Date'=>$PODate,'POType'=>$POType,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$Rate,'SupplierID'=>$SupplierID,'LineItemNos'=>$LineItemNo); + $logpo =array('PONO'=>$PONO,'Date'=>$PODate,'POType'=>$POType,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'SupplierID'=>$SupplierID,'LineItemNos'=>$LineItemNo); $addlog= $this->purchaseorder_model->newlogpo($logpo); /*---------*/ - if(trim($POType) == REVENUE ) - { - // echo 'Success'; - $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); - //print_r($RevenueTaxList); - $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); - //echo 'Revenue tax Success'; - } - } - - } - echo 'Purchase Order Created Successfully! PO Number Is: '.$PONO ; - - } - //This used to Edit the Revenue Purchase Order - function EditRevenuePurchaseOrder() - { - //echo "EDIT REBEIE"; - //die(); - $PONO =$this->input->post('txtPONO'); - $POdt =$this->input->post('PODate'); - $PODate = $this->getDateformat($POdt); + if(trim($POType) == REVENUE ) + { + // echo 'Success'; + $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); + //print_r($RevenueTaxList); + $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); + //echo 'Revenue tax Success'; + } + } + + } + echo 'Purchase Order Created Successfully! PO Number Is: '.$PONO ; + + } + //This used to Edit the Revenue Purchase Order + function EditRevenuePurchaseOrder() + { + //echo "EDIT REBEIE"; + //die(); + $PONO =$this->input->post('txtPONO'); + $POdt =$this->input->post('PODate'); + $PODate = $this->getDateformat($POdt); $SupplierID = $this->input->post('drpSupplier'); - $DeliveryAddr = $this->input->post('txtDeliveryAddress'); - $dt = $this->input->post('Deliverydt'); - //$Deliverydt = $this->getDateformat($dt); - $DeliveryOption = $this->input->post('DateRange'); + $DeliveryAddr = $this->input->post('txtDeliveryAddress'); + $dt = $this->input->post('Deliverydt'); + //$Deliverydt = $this->getDateformat($dt); + $DeliveryOption = $this->input->post('DateRange'); if($DeliveryOption==1){ $Deliverydt = ''; $DeliverySchedule = $this->input->post('Scheduleby'); @@ -1209,89 +1210,89 @@ function edited(){ $b4date=$this->input->post('b4podate'); $b4podate = $this->getDateformat($b4date); /*-----------------------------------*/ - $Modeofshipment=$this->input->post('editmodeofshipment'); - $supplierreference=$this->input->post('editsupplierreference'); - $supplieroffno=$this->input->post('editsupplierofferno'); - $otherreference=$this->input->post('editotherreference'); - $fincap=$this->input->post('editfincap'); - $revenuetype=$this->input->post('PoTypeOptions'); - $insurancestatus=$this->input->post('insurancestatus'); - if($insurancestatus == 1){ - $insuranceno=$this->input->post('insuranceno'); - }else{ - $insuranceno=""; - } + $Modeofshipment=$this->input->post('editmodeofshipment'); + $supplierreference=$this->input->post('editsupplierreference'); + $supplieroffno=$this->input->post('editsupplierofferno'); + $otherreference=$this->input->post('editotherreference'); + $fincap=$this->input->post('editfincap'); + $revenuetype=$this->input->post('PoTypeOptions'); + $insurancestatus=$this->input->post('insurancestatus'); + if($insurancestatus == 1){ + $insuranceno=$this->input->post('insuranceno'); + }else{ + $insuranceno=""; + } - $POType = $this->input->post('POType'); - $PoRange = $this->input->post('txtPoRange'); + $POType = $this->input->post('POType'); + $PoRange = $this->input->post('txtPoRange'); $BudgetType = $this->input->post('Budget'); - - $SpcialInstruction = $this->input->post('SpcialInstruction'); - $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); - $POStatus = $this->input->post('txtStatus'); + + $SpcialInstruction = $this->input->post('SpcialInstruction'); + $TotalOrderValueSummary = $this->input->post('txtTotalOrderValueSummary'); + $POStatus = $this->input->post('txtStatus'); $updatedBy = $this->session->userdata('userId'); //echo($updatedBy); - $RowCount = $this->input->post('txtRowCount'); - $DeletedRow = $this->input->post('txtDeletedRow'); - //echo $RowCount . "-" . $DeletedRow; - //die(); - $comma_separated = explode(':', $DeletedRow); - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $updateddt = $dt->format('Y-m-d H:i:s'); + $RowCount = $this->input->post('txtRowCount'); + $DeletedRow = $this->input->post('txtDeletedRow'); + //echo $RowCount . "-" . $DeletedRow; + //die(); + $comma_separated = explode(':', $DeletedRow); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $updateddt = $dt->format('Y-m-d H:i:s'); - $PaymentTerms=$this->input->post('PaymentTerms'); + $PaymentTerms=$this->input->post('PaymentTerms'); $OtherPayment=$this->input->post('Otherpayment'); - $Local_Interstate=$this->input->post('Range'); + $Local_Interstate=$this->input->post('Range'); $Qualitycheck=1; - // PO Master - // PO Master - $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'Status'=>$POStatus,'PORange'=>$Local_Interstate,'ServiceDescription'=>$SpcialInstruction,'UpdateBY'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'CapitalRange'=>$Local_Interstate,'PaymentOtherDescription'=>$OtherPayment,'Supplier_Reference'=>$supplierreference,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Offer_No'=>$supplieroffno,'Other_Reference'=>$otherreference,'Fincap'=>$fincap,'InsuranceStatus'=>$insurancestatus,'POSubType'=>$revenuetype,'InsuranceNumber'=>$insuranceno,'IsQualityChkReqired'=>$Qualitycheck,'BudgetType'=>$BudgetType); - //print_r($POList); - //die(); - $POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList); - - - $LineItemStatus = REQITEM_NEW; - - //echo "OUT"; - for ($i = 1; $i <= $RowCount; $i++) - { - //echo "IN"; - $MaterialCode = $this->input->post('materialCode'.$i); - $Quantity = $this->input->post('quantity'.$i); - $Reqnumber = $this->input->post('Reqnumber'.$i); + // PO Master + // PO Master + $POList = array('SupplierID'=>$SupplierID, 'TotalOrderValue'=>$TotalOrderValueSummary,'PODate'=>$PODate,'DeliverySchedule'=>$DeliverySchedule,'DeliveryOption'=>$DeliveryOption,'Status'=>$POStatus,'PORange'=>$Local_Interstate,'ServiceDescription'=>$SpcialInstruction,'UpdateBY'=>$updatedBy,'DeliveryAddress'=>$DeliveryAddr,'DeliveryDate'=>$Deliverydt,'UpdatedOn'=>$updateddt,'PaymentTerms'=>$PaymentTerms,'POType'=>$POType,'CapitalRange'=>$Local_Interstate,'PaymentOtherDescription'=>$OtherPayment,'Supplier_Reference'=>$supplierreference,'Mode_Of_Shipment'=>$Modeofshipment,'Supplier_Offer_No'=>$supplieroffno,'Other_Reference'=>$otherreference,'Fincap'=>$fincap,'InsuranceStatus'=>$insurancestatus,'POSubType'=>$revenuetype,'InsuranceNumber'=>$insuranceno,'IsQualityChkReqired'=>$Qualitycheck,'BudgetType'=>$BudgetType); + //print_r($POList); + //die(); + $POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList); + + + $LineItemStatus = REQITEM_NEW; + + //echo "OUT"; + for ($i = 1; $i <= $RowCount; $i++) + { + //echo "IN"; + $MaterialCode = $this->input->post('materialCode'.$i); + $Quantity = $this->input->post('quantity'.$i); + $Reqnumber = $this->input->post('Reqnumber'.$i); /*-----------------------------------*/ $b4qty=$this->input->post('b4qty'.$i); $b4rate=$this->input->post('b4rate'.$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); - $Cgst = $this->input->post('RevenueCgst'.$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); + $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); - $FreightType = $this->input->post('FreightType'.$i); - $FreightValue = $this->input->post('FreightVal'.$i); - $AfterFreightValue = $this->input->post('AfterFreightVal'.$i); - $NOOfTrip = $this->input->post('NoOfTrip'.$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); $revenuedescription = $this->input->post('service_description'.$i); $InsuranceValue = $this->input->post('Insval'.$i); - $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); - $POLineItemNo = $this->input->post('LineItemNo'.$i); - $CostCenter = $this->input->post('costCode'.$i); - $LineItemNo = ''; + $TotalOrderValue = $this->input->post('TotalOrderValue'.$i); + $POLineItemNo = $this->input->post('LineItemNo'.$i); + $CostCenter = $this->input->post('costCode'.$i); + $LineItemNo = ''; /*---------start---------------------*/ @@ -1305,23 +1306,23 @@ function edited(){ } - /*----------end--------------------*/ - - $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; - } - - } - } + /*----------end--------------------*/ + + $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; + } + + } + } /*-------------start-----------------*/ //if($MaterialCode!= ''){ @@ -1385,64 +1386,64 @@ function edited(){ if($SkipInsert == "False") - { + { - if(strlen($POLineItemNo) == 0) - { - $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Per'=>$per,'ServiceMaterialDescription'=>$revenuedescription,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter); - //print_r($POLineItemList); - $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); - if(count($POLineItem)>0) - { - $LineItemNo = $POLineItem[0]['LineItemNo']; - } - - } - else - { + if(strlen($POLineItemNo) == 0) + { + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Per'=>$per,'ServiceMaterialDescription'=>$revenuedescription,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt,'CostCenterCode'=>$CostCenter); + //print_r($POLineItemList); + $POLineItem = $this->purchaseorder_model->addPOLineItem($POLineItemList); + if(count($POLineItem)>0) + { + $LineItemNo = $POLineItem[0]['LineItemNo']; + } + + } + else + { - $LineItemNo = $POLineItemNo; - - $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'CostCenterCode'=>$CostCenter); + $LineItemNo = $POLineItemNo; + + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'CostCenterCode'=>$CostCenter); - //print_r($POLineItemList); - $POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$POLineItemNo,$POLineItemList); - - } - $isExists = $this->purchaseorder_model->LineItemExistsinRevenueTax($LineItemNo); - if(count($isExists) == 0) - { - $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'=>$updatedBy,'CreatedDate'=>$updateddt,'CGST'=>$Cgst,'AfterCGST'=>$AfterCgst,'SGST'=>$Sgst,'AfterSGST'=>$AfterSgst,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'NoOfTrip'=>$NOOfTrip); - //print_r($RevenueTaxList); - $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); - - } - else - { + //print_r($POLineItemList); + $POLineItem = $this->purchaseorder_model->updatePOLineItem($PONO,$POLineItemNo,$POLineItemList); + + } + $isExists = $this->purchaseorder_model->LineItemExistsinRevenueTax($LineItemNo); + if(count($isExists) == 0) + { + $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'=>$updatedBy,'CreatedDate'=>$updateddt,'CGST'=>$Cgst,'AfterCGST'=>$AfterCgst,'SGST'=>$Sgst,'AfterSGST'=>$AfterSgst,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'NoOfTrip'=>$NOOfTrip); + //print_r($RevenueTaxList); + $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); + + } + else + { - $RevenueTaxList = array('DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'CGST'=>$Cgst,'AfterCGST'=>$AfterCgst,'SGST'=>$Sgst,'AfterSGST'=>$AfterSgst,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'CreatedBy'=>$updatedBy,'NoOfTrip'=>$NOOfTrip); - //print_r($RevenueTaxList); - $this->purchaseorder_model->updateRevenueTax($LineItemNo,$RevenueTaxList); - - } - } + $RevenueTaxList = array('DiscountType'=>$DiscountType,'DiscountValue'=>$DiscountValue,'AfterDiscount'=>$AfterDiscount,'PackagingType'=>$PackagingType,'PackagingValue'=>$PackagingValue,'PackagingCalulatedOn'=>$PackagingOption,'AfterPackagingValue'=>$AfterPackagingValue,'FreightType'=>$FreightType, 'FreightValue'=>$FreightValue,'AfterFreightValue'=>$AfterFreightValue,'Insurance'=>$InsuranceValue,'TotalValue'=>$TotalOrderValue, 'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt,'CGST'=>$Cgst,'AfterCGST'=>$AfterCgst,'SGST'=>$Sgst,'AfterSGST'=>$AfterSgst,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'CreatedBy'=>$updatedBy,'NoOfTrip'=>$NOOfTrip); + //print_r($RevenueTaxList); + $this->purchaseorder_model->updateRevenueTax($LineItemNo,$RevenueTaxList); + + } + } - - - } - - echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO ; - } + + + } + + echo 'Purchase Order Updated Successfully! PO Number Is: '.$PONO ; + } function pageNotFound() { $this->global['pageTitle'] = 'CodeInsect : 404 - Page Not Found'; $this->loadViews("404", $this->global, NULL, NULL); } - - public function revenuepoprint($PONO) + + public function revenuepoprint($PONO) { // Load all views as normal @@ -1452,12 +1453,12 @@ function edited(){ $PoStatus=''; $data['AmendmentPDF'] = $this->purchaseorder_model->amendpdf($PONO); $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformationforPDF(); - $data['GetPoFormat'] = $this->purchaseorder_model->GetPoFormat($PONO); + $data['GetPoFormat'] = $this->purchaseorder_model->GetPoFormat($PONO); $data['POItem'] = $this->purchaseorder_model->GetRevenuePurchaseOrderDetailsForPDF($PONO); $data['releasedetails'] = $this->purchaseorder_model->GetReleasedDetails($PONO); $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName('INR'); $data['reveuetax']=$this->purchaseorder_model->getRevenueTaxinforforpdf($PONO); - $data['AmendmentPDF'] = $this->purchaseorder_model->amendpdf($PONO); + $data['AmendmentPDF'] = $this->purchaseorder_model->amendpdf($PONO); $Currencycode=''; $TotalOrderValue=$data['POItem'][0]->TotalOrderValue; @@ -1469,9 +1470,9 @@ $AdvanceAmount=0.00; } - $TotaltoPay=0.00; + $TotaltoPay=0.00; $TotaltoPay=$TotalOrderValue-$AdvanceAmount; - $totalAmt=sprintf("%.2f", $TotalOrderValue); + $totalAmt=sprintf("%.2f", $TotalOrderValue); @@ -1491,9 +1492,9 @@ $AdvanceAmount=0.00; // // Load library // $this->load->library('dompdf_gen'); - // $paper_orientation = 'portrait'; - // $customPaper = array(0,0,750,950); - // $this->dompdf->set_paper($customPaper,$paper_orientation); + // $paper_orientation = 'portrait'; + // $customPaper = array(0,0,750,950); + // $this->dompdf->set_paper($customPaper,$paper_orientation); // // Convert to PDF // $this->dompdf->load_html($php); @@ -1555,14 +1556,14 @@ $AdvanceAmount=0.00; // Load the pdf page with multiviews $PoStatus=''; - $data['AmendmentPDF'] = $this->purchaseorder_model->amendpdf($PONO); + $data['AmendmentPDF'] = $this->purchaseorder_model->amendpdf($PONO); $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformationforPDF(); - $data['GetPoFormat'] = $this->purchaseorder_model->GetPoFormat($PONO); + $data['GetPoFormat'] = $this->purchaseorder_model->GetPoFormat($PONO); $data['POItem'] = $this->purchaseorder_model->GetServicePurchaseOrderDetailsForpdf($PONO); $data['AmendmentPDF'] = $this->purchaseorder_model->amendpdf($PONO); $data['releasedetails'] = $this->purchaseorder_model->GetReleasedDetails($PONO); - $data['serviceTaxList'] = $this->purchaseorder_model->GetServiceTaxDetails($PONO); + $data['serviceTaxList'] = $this->purchaseorder_model->GetServiceTaxDetails($PONO); $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName('INR'); @@ -1577,13 +1578,13 @@ $AdvanceAmount=0.00; } - $Advance=0.00; + $Advance=0.00; foreach ($data['POItem'] as $PO) { $Advance=$PO->AdvanceAmount; $PoStatus=$PO->Status; } - $TotaltoPay=0.00; + $TotaltoPay=0.00; $TotaltoPay=$TotalOrderValue-$Advance; @@ -1604,9 +1605,9 @@ $AdvanceAmount=0.00; // // Load library // $this->load->library('dompdf_gen'); - // $paper_orientation = 'portrait'; - // $customPaper = array(0,0,750,950); - // $this->dompdf->set_paper($customPaper,$paper_orientation); + // $paper_orientation = 'portrait'; + // $customPaper = array(0,0,750,950); + // $this->dompdf->set_paper($customPaper,$paper_orientation); // // Convert to PDF // $this->dompdf->load_html($php); @@ -1666,11 +1667,11 @@ public function importpoprint($PONO) //$this->load->view('includes/pdfheader'); // Load the pdf page with multiviews - $Requester=''; - $Depcode=''; - $Currencycode=''; + $Requester=''; + $Depcode=''; + $Currencycode=''; $PoStatus=''; - $data['AmendmentPDF'] = $this->purchaseorder_model->amendpdf($PONO); + $data['AmendmentPDF'] = $this->purchaseorder_model->amendpdf($PONO); $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformationforPDF(); $data['GetPoFormat'] = $this->purchaseorder_model->GetPoFormat($PONO); $data['POItem'] = $this->purchaseorder_model->GetImportPurchaseOrderDetailsForPDF($PONO); @@ -1702,18 +1703,18 @@ public function importpoprint($PONO) //print_r($data['Requestername']); $data['Currencytype']=$this->purchaseorder_model->GerCurrencyCodeName($Currencycode); $ProductPrice=''; - $TotalOrderValue = 0.0; + $TotalOrderValue = 0.0; foreach ($data['POItem'] as $PO ) { $TotalOrderValue=$PO->TotalOrderValue; } - $AdvanceAmount=0.0; - foreach ($data['POItem'] as $POI) + $AdvanceAmount=0.0; + foreach ($data['POItem'] as $POI) { $AdvanceAmount=$POI->AdvanceAmount; } - - $TotaltoPay=0.00; + + $TotaltoPay=0.00; $TotaltoPay=$TotalOrderValue-$AdvanceAmount; //$totalAmt=sprintf("%.2f", $ProductPrice); @@ -1730,14 +1731,14 @@ public function importpoprint($PONO) //echo $CurrencyType; if($CurrencyType=='') - { + { $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName('INR'); - } - else - { - $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName($CurrencyType); - } - + } + else + { + $data['CurrencySymbol']=$this->purchaseorder_model->GerCurrencyCodeName($CurrencyType); + } + // $TotalOrderValue=$data['POItem'][0]->$TotalOrderValue; //print_r($data['POItem'][0]); @@ -1748,15 +1749,15 @@ public function importpoprint($PONO) - $SymbolCurrency = ''; - $SymbolCurrencyName =''; - $PaiseVal = ''; - if(!empty($data['CurrencySymbol']) >0) - { + $SymbolCurrency = ''; + $SymbolCurrencyName =''; + $PaiseVal = ''; + if(!empty($data['CurrencySymbol']) >0) + { $SymbolCurrency=$data['CurrencySymbol'][0]->FontCode2000; $SymbolCurrencyName=$data['CurrencySymbol'][0]->Currency; $PaiseVal=$data['CurrencySymbol'][0]->PaiseVal; - } + } $TotalOrderValue=$data['POItem'][0]->TotalOrderValue; $totalAmt=sprintf("%.2f", $TotaltoPay); @@ -1777,9 +1778,9 @@ public function importpoprint($PONO) // Load library // $this->load->library('dompdf_gen'); - // $paper_orientation = 'portrait'; - // $customPaper = array(0,0,750,950); - // $this->dompdf->set_paper($customPaper,$paper_orientation); + // $paper_orientation = 'portrait'; + // $customPaper = array(0,0,750,950); + // $this->dompdf->set_paper($customPaper,$paper_orientation); // Convert to PDF //$this->dompdf->set_paper(array(0, 0, 841.89, 1190.55), 'landscape'); @@ -1836,43 +1837,43 @@ public function importpoprint($PONO) /** * This function used to load the Delete the Requistion Items - */ + */ function DeletePODetails() { - + - $ReqList= $this->input->post('id'); - $LineItemNo = ''; - $ReqNo =''; - $MaterialCode = ''; - $POType = ''; - if(count($ReqList) > 0) - { - $LineItemNo = $ReqList[0]; - $ReqNo = $ReqList[1]; - $MaterialCode = $ReqList[2]; - $POType = $ReqList[3]; - } - - If($POType == REVENUE) - { - $this->purchaseorder_model->DeletePORevenueTax($LineItemNo); - } - else If($POType == SERVICE) - { - $this->purchaseorder_model->DeletePOServiceTax($LineItemNo); - } - else If($POType == IMPORT) - { - $this->purchaseorder_model->DeletePOImportTax($LineItemNo); - } - else If($POType == CAPITAL) - { - $this->purchaseorder_model->DeletePOImportTax($LineItemNo); + $ReqList= $this->input->post('id'); + $LineItemNo = ''; + $ReqNo =''; + $MaterialCode = ''; + $POType = ''; + if(count($ReqList) > 0) + { + $LineItemNo = $ReqList[0]; + $ReqNo = $ReqList[1]; + $MaterialCode = $ReqList[2]; + $POType = $ReqList[3]; + } + + If($POType == REVENUE) + { + $this->purchaseorder_model->DeletePORevenueTax($LineItemNo); + } + else If($POType == SERVICE) + { $this->purchaseorder_model->DeletePOServiceTax($LineItemNo); - } - $this->purchaseorder_model->DeletePOLineItem($LineItemNo , $ReqNo,$MaterialCode); - echo "Successfully Deleted the Line item".$LineItemNo; + } + else If($POType == IMPORT) + { + $this->purchaseorder_model->DeletePOImportTax($LineItemNo); + } + else If($POType == CAPITAL) + { + $this->purchaseorder_model->DeletePOImportTax($LineItemNo); + $this->purchaseorder_model->DeletePOServiceTax($LineItemNo); + } + $this->purchaseorder_model->DeletePOLineItem($LineItemNo , $ReqNo,$MaterialCode); + echo "Successfully Deleted the Line item".$LineItemNo; } @@ -2418,104 +2419,104 @@ function addNewImportPurchaseOrder() } - - - /* All Function following This command for FINANCE TEAM PO APPROVAL SCREEN*/ - function poapproval(){ - $q="APPROVAL"; - $this->global['pageTitle'] = 'Siddharth : Purchase Order Approval'; - // $data['Status']= $this->purchaseorder_model->getStatus(); - $userID = $this->session->userdata ( 'userId' ); - //print_r($data['Status']);echo "CON"; - $data['AppList'] = $this->purchaseorder_model->getPOList($q); - - $this->loadViews("poapproval_view", $this->global,$data, NULL); + + + /* All Function following This command for FINANCE TEAM PO APPROVAL SCREEN*/ + function poapproval(){ + $q="APPROVAL"; + $this->global['pageTitle'] = 'Siddharth : Purchase Order Approval'; + // $data['Status']= $this->purchaseorder_model->getStatus(); + $userID = $this->session->userdata ( 'userId' ); + //print_r($data['Status']);echo "CON"; + $data['AppList'] = $this->purchaseorder_model->getPOList($q); + + $this->loadViews("poapproval_view", $this->global,$data, NULL); - - } - - function getDateformat2($Val) - { - $date = new DateTime($Val); - $retDate = $date->format('Y-m-d H:i:s'); - return $retDate; - } - - - function ApprovePO() - { - $StatusCode= Trim($_POST['SCode']); - - $PONO= Trim($_POST['PONO']); - $Remarks= Trim($_POST['NewRemarks']); - - $ApprovedBy = $this->session->userdata ( 'userId' ); - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $ApprovedDate = $dt->format('Y-m-d H:i:s'); - - if($StatusCode == 'ST025') - { - - $store = array('Status'=>$StatusCode,'ApprovedOn'=>$ApprovedDate,'Approvedby'=>$ApprovedBy,'Remarks'=>$Remarks); - $this->purchaseorder_model->UpdatePO($store,$PONO); - echo "Successfully Approve the Purchase Order No: ".$PONO; - } - else{ - $store = array('Status'=>$StatusCode,'OnHoldOn'=>$ApprovedDate,'OnHoldBy'=>$ApprovedBy,'Remarks'=>$Remarks); - $this->purchaseorder_model->UpdatePO($store,$PONO); - echo "The Purchase Order No: ".$PONO ."is On Hold"; - - } - - - - - } - - - - - /* FOLLOWING CODES FOR PO RELEASE SCREEN FUNCTIONALITIES*/ - - - function porelease(){ - - $q="RELEASE"; - $this->global['pageTitle'] = 'Siddharth : Purchase Order Release'; - // $data['Status']= $this->purchaseorder_model->getStatus(); - $userID = $this->session->userdata ( 'userId' ); - //print_r($data['Status']);echo "CON"; - $data['AppList'] = $this->purchaseorder_model->getPOList($q); - - $this->loadViews("porelease_view", $this->global,$data, NULL); - } - - - function ReleasePO() - { - $StatusCode= Trim($_POST['SCode']); - - $PONO= Trim($_POST['PONO']); - $Remarks= Trim($_POST['NewRemarks']); - - $ReleasedBy = $this->session->userdata ( 'userId' ); - $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); - $ReleasedDate = $dt->format('Y-m-d H:i:s'); - - if($StatusCode == 'ST026') - { - - $store = array('Status'=>$StatusCode,'ReleasedOn'=>$ReleasedDate,'ReleasedBy'=>$ReleasedBy,'Remarks'=>$Remarks); - $this->purchaseorder_model->UpdatePO($store,$PONO); - echo "Successfully Released the Purchase Order No: ".$PONO; - } - else{ - $store = array('Status'=>$StatusCode,'OnHoldOn'=>$ReleasedDate,'OnHoldBy'=>$ReleasedBy,'Remarks'=>$Remarks); - $this->purchaseorder_model->UpdatePO($store,$PONO); - echo "The Purchase Order No: ".$PONO ."is On Hold"; - - } + } + + function getDateformat2($Val) + { + $date = new DateTime($Val); + $retDate = $date->format('Y-m-d H:i:s'); + return $retDate; + } + + + function ApprovePO() + { + $StatusCode= Trim($_POST['SCode']); + + $PONO= Trim($_POST['PONO']); + $Remarks= Trim($_POST['NewRemarks']); + + $ApprovedBy = $this->session->userdata ( 'userId' ); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $ApprovedDate = $dt->format('Y-m-d H:i:s'); + + if($StatusCode == 'ST025') + { + + $store = array('Status'=>$StatusCode,'ApprovedOn'=>$ApprovedDate,'Approvedby'=>$ApprovedBy,'Remarks'=>$Remarks); + $this->purchaseorder_model->UpdatePO($store,$PONO); + echo "Successfully Approve the Purchase Order No: ".$PONO; + } + else{ + $store = array('Status'=>$StatusCode,'OnHoldOn'=>$ApprovedDate,'OnHoldBy'=>$ApprovedBy,'Remarks'=>$Remarks); + $this->purchaseorder_model->UpdatePO($store,$PONO); + echo "The Purchase Order No: ".$PONO ."is On Hold"; + + } + + + + + } + + + + + /* FOLLOWING CODES FOR PO RELEASE SCREEN FUNCTIONALITIES*/ + + + function porelease(){ + + $q="RELEASE"; + $this->global['pageTitle'] = 'Siddharth : Purchase Order Release'; + // $data['Status']= $this->purchaseorder_model->getStatus(); + $userID = $this->session->userdata ( 'userId' ); + //print_r($data['Status']);echo "CON"; + $data['AppList'] = $this->purchaseorder_model->getPOList($q); + + $this->loadViews("porelease_view", $this->global,$data, NULL); + + } + + + function ReleasePO() + { + $StatusCode= Trim($_POST['SCode']); + + $PONO= Trim($_POST['PONO']); + $Remarks= Trim($_POST['NewRemarks']); + + $ReleasedBy = $this->session->userdata ( 'userId' ); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $ReleasedDate = $dt->format('Y-m-d H:i:s'); + + if($StatusCode == 'ST026') + { + + $store = array('Status'=>$StatusCode,'ReleasedOn'=>$ReleasedDate,'ReleasedBy'=>$ReleasedBy,'Remarks'=>$Remarks); + $this->purchaseorder_model->UpdatePO($store,$PONO); + echo "Successfully Released the Purchase Order No: ".$PONO; + } + else{ + $store = array('Status'=>$StatusCode,'OnHoldOn'=>$ReleasedDate,'OnHoldBy'=>$ReleasedBy,'Remarks'=>$Remarks); + $this->purchaseorder_model->UpdatePO($store,$PONO); + echo "The Purchase Order No: ".$PONO ."is On Hold"; + + } } /* Add capital Po*/ function addNewCapitalPurchaseOrder() @@ -3110,7 +3111,7 @@ function addNewImportPurchaseOrder() { $PoStatus=''; - $data['AmendmentPDF'] = $this->purchaseorder_model->amendpdf($PONO); + $data['AmendmentPDF'] = $this->purchaseorder_model->amendpdf($PONO); // Load the pdf page with multiviews $data['CompanyDetails'] = $this->purchaseorder_model->getCompanyInformationforPDF(); $data['GetPoFormat'] = $this->purchaseorder_model->GetPoFormat($PONO); @@ -3137,17 +3138,17 @@ function addNewImportPurchaseOrder() // $data['TotalAmountInWords']= $this->convertNumber($totalAmt); // } - $AdvanceAmount=0.0; + $AdvanceAmount=0.0; - foreach ($data['POItem'] as $POI) + foreach ($data['POItem'] as $POI) { $AdvanceAmount=$POI->AdvanceAmount; } - - $TotaltoPay=$TotalOrderValue-$AdvanceAmount; - $totalAmt=sprintf("%.2f", $TotalOrderValue); - $data['TotalAmountInWords']= $this->convertNumber($totalAmt); + + $TotaltoPay=$TotalOrderValue-$AdvanceAmount; + $totalAmt=sprintf("%.2f", $TotalOrderValue); + $data['TotalAmountInWords']= $this->convertNumber($totalAmt); } else{ @@ -3157,7 +3158,7 @@ function addNewImportPurchaseOrder() $PaiseVal=$data['CurrencySymbol'][0]->PaiseVal; $TotalOrderValue=$data['POItem'][0]->TotalOrderValue; - foreach ($data['POItem'] as $POI) + foreach ($data['POItem'] as $POI) { $AdvanceAmount=$POI->AdvanceAmount; } @@ -3189,9 +3190,9 @@ function addNewImportPurchaseOrder() // Load library // $this->load->library('dompdf_gen'); - // $paper_orientation = 'portrait'; - // $customPaper = array(0,0,750,950); - // $this->dompdf->set_paper($customPaper,$paper_orientation); + // $paper_orientation = 'portrait'; + // $customPaper = array(0,0,750,950); + // $this->dompdf->set_paper($customPaper,$paper_orientation); // Convert to PDF // $this->dompdf->load_html($php); @@ -3253,20 +3254,20 @@ function addNewImportPurchaseOrder() /*This function is used to convert amount(digit) into words*/ public function convertNumber($amt){ - //echo $amt;die(); + //echo $amt;die(); $ShowPaise='0'; $totalAmt=explode(".",$amt); $number = $totalAmt[0]; $no = $number; - + if(!empty($totalAmt[1]) && $totalAmt[1]!=0){ $point = $totalAmt[1]; - $ShowPaise='1'; + $ShowPaise='1'; } else{ $point=0; - $ShowPaise='0'; + $ShowPaise='0'; } @@ -3286,11 +3287,11 @@ $point=0; '60' => 'sixty', '70' => 'seventy', '80' => 'eighty', '90' => 'ninety','06'=>'Zero Six','01'=>'Zero One','02'=>'Zero Two' ,'03'=>'Zero Three','04'=>'Zero Four','05'=>'Zero Five','07'=>'Zero Seven','08'=>'Zero Eight','09'=>'Zero Nine'); - $words1 = array('2' => 'twenty', + $words1 = array('2' => 'twenty', '3' => 'thirty', '4' => 'fourty', '5' => 'fifty', '6' => 'sixty', '7' => 'seventy', '8' => 'eighty', '9' =>'ninety'); - $words12 = array('11' => 'eleven', + $words12 = array('11' => 'eleven', '12' => 'twelve', '13' => 'thirteen', '14' => 'fourteen', '15' => 'fifteen', '16' => 'sixteen', '17' => 'seventeen', '18' => 'eighteen', '19' =>'nineteen', '20' => 'twenty',); @@ -3302,9 +3303,9 @@ $point=0; $i += ($divider == 10) ? 1 : 2; if ($number) { $plural = (($counter = count($str)) && $number > 1) ? 's' : null; - //print_r($plural); + //print_r($plural); $hundred = ($counter == 1 && $str[0]) ? ' and ' : null; - //print_r($hundred); + //print_r($hundred); $str [] = ($number < 21) ? $words[$number] . " " . $digits[$counter] . $plural . " " . $hundred : @@ -3317,7 +3318,7 @@ $point=0; $result = implode('', $str); if($point>=1 && $point<=10) { - $points = ($point) ? + $points = ($point) ? " " . $words[$point] : " "; } else if($point>=11 && $point<=20) @@ -3327,7 +3328,7 @@ $point=0; } else { - $points = ($point) ? + $points = ($point) ? " " . $words1[$point / 10] . " " . $words[$point = $point % 10] : ''; } @@ -3352,11 +3353,11 @@ $number = $totalAmt[0]; $no = $number; if(!empty($totalAmt[1]) && $totalAmt[1]!=0){ $point = $totalAmt[1]; - $ShowPaise='1'; + $ShowPaise='1'; } else{ $point=0; - $ShowPaise='0'; + $ShowPaise='0'; } $hundred = null; @@ -3374,11 +3375,11 @@ $point=0; '30' => 'thirty', '40' => 'fourty', '50' => 'fifty', '60' => 'sixty', '70' => 'seventy', '80' => 'eighty', '90' => 'ninety'); - $words1 = array('2' => 'twenty', + $words1 = array('2' => 'twenty', '3' => 'thirty', '4' => 'fourty', '5' => 'fifty', '6' => 'sixty', '7' => 'seventy', '8' => 'eighty', '9' =>'ninety'); - $words12 = array('11' => 'eleven', + $words12 = array('11' => 'eleven', '12' => 'twelve', '13' => 'thirteen', '14' => 'fourteen', '15' => 'fifteen', '16' => 'sixteen', '17' => 'seventeen', '18' => 'eighteen', '19' =>'nineteen', '20' => 'twenty',); @@ -3390,9 +3391,9 @@ $point=0; $i += ($divider == 10) ? 1 : 2; if ($number) { $plural = (($counter = count($str)) && $number > 1) ? 's' : null; - //print_r($plural); + //print_r($plural); $hundred = ($counter == 1 && $str[0]) ? ' and ' : null; - //print_r($hundred); + //print_r($hundred); $str [] = ($number < 21) ? $words[$number] . " " . $digits[$counter] . $plural . " " . $hundred : @@ -3405,7 +3406,7 @@ $point=0; $result = implode('', $str); if($point>=1 && $point<=10) { - $points = ($point) ? + $points = ($point) ? " " . $words[$point] : " "; } else if($point>=11 && $point<=20) @@ -3415,7 +3416,7 @@ $point=0; } else { - $points = ($point) ? + $points = ($point) ? " " . $words1[$point / 10] . " " . $words[$point = $point % 10] : ''; } diff --git a/application/controllers/servicepurchaseorder.php b/application/controllers/servicepurchaseorder.php index a5ba5a07..6e76770b 100755 --- a/application/controllers/servicepurchaseorder.php +++ b/application/controllers/servicepurchaseorder.php @@ -308,6 +308,9 @@ $result = $this->purchaseorder_model->GetPODetailforBillingServicePO($PO); { $ItemNo = $RetItemNo[0]['ItemNo']; } + + + $POLineItemList = array('PONO'=>$PONO, 'ReqNo'=>$Reqnumber,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'Status'=>$LineItemStatus,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'CostCenterCode'=>$CostCenter,'ServiceFrequency'=>$ServiceFrequency,'ServiceMaterialDescription'=>$ItemDescription,'Per'=>$Per,'ItemNo'=>$ItemNo); @@ -320,6 +323,13 @@ $result = $this->purchaseorder_model->GetPODetailforBillingServicePO($PO); $LineItemNo = $POLineItem[0]['LineItemNo']; } //echo $LineItemNo; + + +/*---------*/ + $logpo =array('PONO'=>$PONO,'Date'=>$PODate,'POType'=>$POType,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'Rate'=>$itemRate,'SupplierID'=>$SupplierID,'LineItemNos'=>$LineItemNo); + + $addlog= $this->purchaseorder_model->newlogpo($logpo); +/*---------*/ if(trim($POType) == SERVICE ) { diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php index bf456cfa..aecfa00d 100755 --- a/application/models/purchaseorder_model.php +++ b/application/models/purchaseorder_model.php @@ -28,8 +28,8 @@ class purchaseorder_model extends CI_Model function updateReqDetails($Reqnumber,$MaterialCode,$ReqDetail){ //echo'hi'; - $this->db->where('ReqNo',$Reqnumber,'MaterialCode',$MaterialCode); - //$this->db->where('MaterialCode',$MaterialCode); + $this->db->where('ReqNo',$Reqnumber); + $this->db->where('MaterialCode',$MaterialCode); // $this->db->where('Quantity',$Quantity); $this->db->update('T_Requestion_Details',$ReqDetail); @@ -63,9 +63,9 @@ Where IGRM.PONO = ? '; // echo $IGRItemNo; // echo $IGRNO; // die(); - $this->db->where('IGRItemNo',$IGRItemNo,'IGRNO',$IGRNO,'MaterialCode',$MaterialCode); - - + $this->db->where('IGRItemNo',$IGRItemNo); + $this->db->where('IGRNO',$IGRNO); + $this->db->where('MaterialCode',$MaterialCode); $this->db->update('T_IGR_Details',$IGRDs); $r = $this->db->affected_rows(); @@ -76,6 +76,9 @@ Where IGRM.PONO = ? '; + + + } diff --git a/application/views/EditservicePurchaseorder.php b/application/views/EditservicePurchaseorder.php index 434f0a62..41b88746 100755 --- a/application/views/EditservicePurchaseorder.php +++ b/application/views/EditservicePurchaseorder.php @@ -2350,7 +2350,13 @@ $(document).ready(function () { - logDate)?"-":date('d-m-Y',strtotime($oldpo->logDate)); ?> + logDate !='-'){ + $logdate = date('d-m-Y',strtotime($oldpo->logDate)); + }else{ + $logdate = '-'; + }?> + + Lqty;?> logRate?> LSuppid?> diff --git a/application/views/alterpurchaseorder.php b/application/views/alterpurchaseorder.php index 028639fd..765367b7 100755 --- a/application/views/alterpurchaseorder.php +++ b/application/views/alterpurchaseorder.php @@ -25,11 +25,11 @@ if(!empty($CompanyDetails)) if(!empty($INRSYMBOL)) { - foreach($INRSYMBOL as $INRS) - { + foreach($INRSYMBOL as $INRS) + { $INRSYM=$INRS->FontCode2000; - } + } } ?> @@ -41,11 +41,11 @@ if(!empty($INRSYMBOL)) margin-top:200px; z-index: 1080 !important; } - #submitmodel { + #submitmodel { margin-top:200px; z-index: 1080 !important; } - #freightmodel { + #freightmodel { margin-top:200px; z-index: 1080 !important; } @@ -69,12 +69,12 @@ if(!empty($INRSYMBOL)) { text-align:left; } - .nopad { - padding:0px; - } - .select2 { - width:100% ! important; - } + .nopad { + padding:0px; + } + .select2 { + width:100% ! important; + } @@ -116,14 +116,14 @@ if(!empty($INRSYMBOL)) statusbar: false, toolbar: false }); - tinymce.init({ + tinymce.init({ selector: "textarea#Add_Service_Description", //service Edit model description service menubar: false, statusbar: false, toolbar: false }); - tinymce.init({ + tinymce.init({ selector: "textarea#Edit_Service_Description", //service Edit model description service menubar: false, @@ -147,7 +147,7 @@ if(!empty($INRSYMBOL)) <%=TotalValue%> -     +     @@ -287,7 +287,7 @@ var SelectedMaterialList = { $("#ItemName").val(obj.MaterialName); $("#UOM").val(obj.UOM); $("#Quantity").val(obj.Quantity); - RequistQuantity = obj.Quantity; + RequistQuantity = obj.Quantity; } }); } @@ -322,7 +322,7 @@ var SelectedMaterialList = { return false; } - }); */ + }); */ /* Revenue Tax calcualation */ $('#DiscountType').change(function() { @@ -335,7 +335,7 @@ var SelectedMaterialList = { $('#txtDiscount').attr('readonly', 'true'); $('#txtDiscount').val('0.00'); $('#txtAfterDiscount').val('0.00'); - change(); + change(); } else @@ -348,34 +348,34 @@ var SelectedMaterialList = { }); $('#EditDiscountType').change(function() { - if($('#EditRevenueRate').val() != '' && $('#EditRevenueMaterialCode').val() != "0" ) - { + if($('#EditRevenueRate').val() != '' && $('#EditRevenueMaterialCode').val() != "0" ) + { selValue = $("#EditDiscountType").val(); - $('#txtEditDiscount').val(''); - $('#txtEditAfterDiscount').val(''); - if (selValue == NilType) - { + $('#txtEditDiscount').val(''); + $('#txtEditAfterDiscount').val(''); + if (selValue == NilType) + { - $('#txtEditDiscount').attr('readonly', 'true'); - $('#txtEditDiscount').val('0.00'); - $('#txtEditAfterDiscount').val('0.00'); - change(); - - } - else - { - $('#txtEditDiscount').removeAttr( 'readonly','true' ); - $('#txtEditDiscount').val(''); - $('#txtEditAfterDiscount').val(''); - change(); - } - } + $('#txtEditDiscount').attr('readonly', 'true'); + $('#txtEditDiscount').val('0.00'); + $('#txtEditAfterDiscount').val('0.00'); + change(); + + } + else + { + $('#txtEditDiscount').removeAttr( 'readonly','true' ); + $('#txtEditDiscount').val(''); + $('#txtEditAfterDiscount').val(''); + change(); + } + } else - { - alert('Please Select MaterialCode and Rate Field Value'); - $('#EditDiscountType').val("0"); - $('#EditRate').focus(); - } + { + alert('Please Select MaterialCode and Rate Field Value'); + $('#EditDiscountType').val("0"); + $('#EditRate').focus(); + } Editchange(); }); @@ -397,7 +397,7 @@ var SelectedMaterialList = { $('#txtPackaging').attr('readonly', 'true'); $('#txtPackaging').val('0.00'); $('#txtAfterPackaging').val('0.00'); - change(); + change(); } else { @@ -407,30 +407,30 @@ var SelectedMaterialList = { //change(); }); $('#EditPackagingType').change(function() { - $('#txtEditPackaging').val(''); - $('#txtEditAfterPackaging').val(''); + $('#txtEditPackaging').val(''); + $('#txtEditAfterPackaging').val(''); selValue = $("#EditPackagingType").val() ; - if(selValue == PercentageType) - { + if(selValue == PercentageType) + { var PackagingCalculation = ''; - $('#packagingcalmodel').modal('show'); - $('#txtEditPackaging').removeAttr( 'readonly','true' ); - } - else - { - if (selValue == NilType) - { + $('#packagingcalmodel').modal('show'); + $('#txtEditPackaging').removeAttr( 'readonly','true' ); + } + else + { + if (selValue == NilType) + { - $('#txtEditPackaging').attr('readonly', 'true'); - $('#txtEditPackaging').val('0.00'); - $('#txtEditAfterPackaging').val('0.00'); - Editchange(); - } - else - { - $('#txtEditPackaging').removeAttr( 'readonly','true' ); - } - } + $('#txtEditPackaging').attr('readonly', 'true'); + $('#txtEditPackaging').val('0.00'); + $('#txtEditAfterPackaging').val('0.00'); + Editchange(); + } + else + { + $('#txtEditPackaging').removeAttr( 'readonly','true' ); + } + } //change(); }); @@ -460,33 +460,33 @@ var SelectedMaterialList = { }); $('#drpEditFreight').change(function() { - $('#txtEditFreight').val(''); - $('#txtEditAfterFreight').val(''); - var FreightType =$("#drpEditFreight").val(); - // selValue = $("#drpFreight").val() ; + $('#txtEditFreight').val(''); + $('#txtEditAfterFreight').val(''); + var FreightType =$("#drpEditFreight").val(); + // selValue = $("#drpFreight").val() ; - if (FreightType == "PER TRIP") - { - - $('#EditTripsValue').show(); - } - else { - - $('#EditTripsValue').hide(); - } - if(FreightType == PercentageType) - { + if (FreightType == "PER TRIP") + { + + $('#EditTripsValue').show(); + } + else { + + $('#EditTripsValue').hide(); + } + if(FreightType == PercentageType) + { var freightCalculation = ''; - $('#freightmodel').modal('show'); - $('#txtEditFreight').removeAttr( 'readonly','true'); - } - else if (selValue == NilType) + $('#freightmodel').modal('show'); + $('#txtEditFreight').removeAttr( 'readonly','true'); + } + else if (selValue == NilType) { $('#txtEditFreight').attr('readonly', 'true'); $('#txtEditFreight').val('0.00'); $('#txtEditAfterFreight').val('0.00'); - Editchange(); + Editchange(); } else { @@ -495,37 +495,37 @@ var SelectedMaterialList = { } - // selValue = $("#drpEditFreight").val() ; + // selValue = $("#drpEditFreight").val() ; - }); - //add // + }); + //add // $('#drpFreight').change(function() { - var FreightType =$("#drpFreight").val(); - - if (FreightType == "PER TRIP") - { - - $('#TripsValue').show(); - } - else { - - $('#TripsValue').hide(); - } + var FreightType =$("#drpFreight").val(); + + if (FreightType == "PER TRIP") + { + + $('#TripsValue').show(); + } + else { + + $('#TripsValue').hide(); + } selValue = $("#drpFreight").val() ; if(selValue == PercentageType) - { + { var freightCalculation = ''; - $('#freightmodel').modal('show'); - $('#txtFreight').removeAttr( 'readonly','true' ); - } + $('#freightmodel').modal('show'); + $('#txtFreight').removeAttr( 'readonly','true' ); + } else if (selValue == NilType) { $('#txtFreight').attr('readonly', 'true'); $('#txtFreight').val('0.00'); $('#txtAfterFreight').val('0.00'); - change(); + change(); } else { @@ -544,1058 +544,1058 @@ var SelectedMaterialList = { function calculateDiscount(isEdit) { - if(isEdit == '0') - { + if(isEdit == '0') + { if($('#MaterialCode').val() == "0") - { - alert('Please Select the Material Code'); - $('#MaterialCode').focus(); - $('#txtDiscount').val(''); - return false; - } - else if($('#Rate').val() == '') - { - alert('Please Enter the Rate value'); - $('#Rate').focus(); - $('#txtDiscount').val(''); - return false; - } + { + alert('Please Select the Material Code'); + $('#MaterialCode').focus(); + $('#txtDiscount').val(''); + return false; + } + else if($('#Rate').val() == '') + { + alert('Please Enter the Rate value'); + $('#Rate').focus(); + $('#txtDiscount').val(''); + return false; + } if($('#Rate').val() != '' && $('#MaterialCode').val() != "0" ) - { - - var basicValue = parseFloat($('#txtBasicValue').val()); - var DiscountType =$("#DiscountType").val(); + { + + var basicValue = parseFloat($('#txtBasicValue').val()); + var DiscountType =$("#DiscountType").val(); - if(DiscountType == "0") - { - alert('Please Select the discount Type'); - $('#txtDiscount').val(''); - $("#DiscountType").focus(); - } - else if ($('#txtDiscount').val() != '' && $('#txtDiscount').val() != '0') - { - var AfterDiscount = 0.0; - var Discountval = parseFloat($('#txtDiscount').val()); - if(DiscountType == PercentageType) - { - - AfterDiscount = ; - - } - else if(DiscountType == NilType ) - { - AfterDiscount = "0.00"; - - } - else - { - AfterDiscount = ; - } - var discount = parseFloat(AfterDiscount).toFixed(2); - $('#txtAfterDiscount').val(discount); - } - else - { - $('#txtAfterDiscount').val("0.00"); - } - } - - calculateTotalValue(); - } - else - { - if($('#EditRevenueMaterialCode').val() == "0") - { - alert('Please Select the Material Code'); - $('#EditRevenueMaterialCode').focus(); - $('#txtEditDiscount').val(''); - return false; - } - else if($('#EditRevenueRate').val() == '') - { - alert('Please Enter the Rate value'); - $('#EditRevenueRate').focus(); - $('#txtEditDiscount').val(''); - return false; - } - if($('#EditRevenueRate').val() != '' && $('#EditRevenueMaterialCode').val() != "0" ) - { - - var basicValue = parseFloat($('#txtEditRevenueBasicValue').val()); - var DiscountType =$("#EditDiscountType").val(); - - if(DiscountType == "0") - { - alert('Please Select the discount Type'); - $('#txtEditDiscount').val(''); - $("#EditDiscountType").focus(); - } - else if ($('#txtEditDiscount').val() != '' && $('#txtEditDiscount').val() != '0') - { - var AfterDiscount = 0.0; - var Discountval = parseFloat($('#txtEditDiscount').val()); - if(DiscountType == PercentageType) - { - - AfterDiscount = ; - - } - else if(DiscountType == NilType ) - { - AfterDiscount = "0.00"; - } - else - { - AfterDiscount = ; - } - var discount = parseFloat(AfterDiscount).toFixed(2); - - $('#txtEditAfterDiscount').val(discount); - } - else - { - $('#txtEditAfterDiscount').val("0.00"); - } - } + if(DiscountType == "0") + { + alert('Please Select the discount Type'); + $('#txtDiscount').val(''); + $("#DiscountType").focus(); + } + else if ($('#txtDiscount').val() != '' && $('#txtDiscount').val() != '0') + { + var AfterDiscount = 0.0; + var Discountval = parseFloat($('#txtDiscount').val()); + if(DiscountType == PercentageType) + { + + AfterDiscount = ; + + } + else if(DiscountType == NilType ) + { + AfterDiscount = "0.00"; + + } + else + { + AfterDiscount = ; + } + var discount = parseFloat(AfterDiscount).toFixed(2); + $('#txtAfterDiscount').val(discount); + } + else + { + $('#txtAfterDiscount').val("0.00"); + } + } + + calculateTotalValue(); + } + else + { + if($('#EditRevenueMaterialCode').val() == "0") + { + alert('Please Select the Material Code'); + $('#EditRevenueMaterialCode').focus(); + $('#txtEditDiscount').val(''); + return false; + } + else if($('#EditRevenueRate').val() == '') + { + alert('Please Enter the Rate value'); + $('#EditRevenueRate').focus(); + $('#txtEditDiscount').val(''); + return false; + } + if($('#EditRevenueRate').val() != '' && $('#EditRevenueMaterialCode').val() != "0" ) + { + + var basicValue = parseFloat($('#txtEditRevenueBasicValue').val()); + var DiscountType =$("#EditDiscountType").val(); + + if(DiscountType == "0") + { + alert('Please Select the discount Type'); + $('#txtEditDiscount').val(''); + $("#EditDiscountType").focus(); + } + else if ($('#txtEditDiscount').val() != '' && $('#txtEditDiscount').val() != '0') + { + var AfterDiscount = 0.0; + var Discountval = parseFloat($('#txtEditDiscount').val()); + if(DiscountType == PercentageType) + { + + AfterDiscount = ; + + } + else if(DiscountType == NilType ) + { + AfterDiscount = "0.00"; + } + else + { + AfterDiscount = ; + } + var discount = parseFloat(AfterDiscount).toFixed(2); + + $('#txtEditAfterDiscount').val(discount); + } + else + { + $('#txtEditAfterDiscount').val("0.00"); + } + } calculateEditVatValue(); - calculateEditTotalValue(); - } + calculateEditTotalValue(); + } } /* * To calcuate the Packaging */ function calculatePackaging(isEdit) { - if(isEdit == '0') - { - if($('#MaterialCode').val() == "0") - { - alert('Please Select the Material Code'); - $('#MaterialCode').focus(); - $('#txtPackaging').val(''); - return false; - } - else if($('#Rate').val() == '') - { - alert('Please Enter the Rate value'); - $('#Rate').focus(); - $('#txtPackaging').val(''); - return false; - } - else - { - - var basicValue = parseFloat($('#txtBasicValue').val()); - - var PackagingType =$("#PackagingType").val(); - - if(PackagingType == "0") - { - alert('Please select the Packaging Type'); - $('#txtPackaging').val(''); - $("#PackagingType").focus(); - } - - else if($('#txtPackaging').val() != '' && $('#txtPackaging').val() !='0') - { - var Packagingvalue = parseFloat($('#txtPackaging').val()); - var AfterPackaging = 0.0; - - if(PackagingType == PercentageType) - { - if($(PackagingCalculation != 0 && '#txtAfterDiscount').val() == '') - { - alert('Please Enter the Discount value'); - $('#txtPackaging').val(''); - $('#DiscountType').focus(); - - return false; - } - else - { - var AfterDiscount =parseFloat($('#txtAfterDiscount').val()); - AfterPackaging = PackagingCalculation == 0 ? : ; - } - - } - else if(PackagingType == NilType ) - { - AfterPackaging = 0.00; - //Change(); - - } - else - { - - - AfterPackaging = PackagingCalculation == 0 ? : ; - - } - var Packaging = parseFloat(AfterPackaging).toFixed(2); - - $('#txtAfterPackaging').val(Packaging); - //RevenueChangeSgst(); - } - else - { - $('#txtAfterPackaging').val("0.00"); - } - } - - calculateTotalValue(); - } - else - { - if($('#EditRevenueMaterialCode').val() == "0") - { - alert('Please Select the Material Code'); - $('#EditRevenueMaterialCode').focus(); - $('#txtEditPackaging').val(''); - return false; - } - else if($('#EditRevenueRate').val() == '') - { - alert('Please Enter the Rate value'); - $('#EditRate').focus(); - $('#txtEditPackaging').val(''); - return false; - } - - else - { - - var basicValue = parseFloat($('#txtEditRevenueBasicValue').val()); - - var PackagingType =$("#EditPackagingType").val(); - - if(PackagingType == "0") - { - alert('Please select the Packaging Type'); - $('#txtEditPackaging').val(''); - $("#EditPackagingType").focus(); - } - - else if($('#txtEditPackaging').val() != '' && $('#txtEditPackaging').val() !='0') - { - var Packagingvalue = parseFloat($('#txtEditPackaging').val()); - var AfterPackaging = 0.0; - - if(PackagingType == PercentageType) - { - if(PackagingCalculation != 0 &&$('#txtEditAfterDiscount').val() == '') - { - alert('Please Enter the Discount value'); - $('#EditDiscountType').focus(); - $('#txtEditPackaging').val(''); - return false; - } - else - { - var AfterDiscount =parseFloat($('#txtEditAfterDiscount').val()); - AfterPackaging = PackagingCalculation == 0 ? : ; - } - - } - else if(PackagingType == NilType ) - { - AfterPackaging = "0.00"; - // $('#txtEditAfterPackaging').val(AfterPackaging); - //RevenueChangeSgst(); - } - else - { - - AfterPackaging = PackagingCalculation == 0 ? : ; - - } - var Packaging = parseFloat(AfterPackaging).toFixed(2); - - $('#txtEditAfterPackaging').val(Packaging); - //RevenueChangeEditSgst(); - } - else - { - $('#txtEditAfterPackaging').val("0.00"); - } - } - calculateEditVatValue(); - calculateEditTotalValue(); - } + if(isEdit == '0') + { + if($('#MaterialCode').val() == "0") + { + alert('Please Select the Material Code'); + $('#MaterialCode').focus(); + $('#txtPackaging').val(''); + return false; + } + else if($('#Rate').val() == '') + { + alert('Please Enter the Rate value'); + $('#Rate').focus(); + $('#txtPackaging').val(''); + return false; + } + else + { + + var basicValue = parseFloat($('#txtBasicValue').val()); + + var PackagingType =$("#PackagingType").val(); + + if(PackagingType == "0") + { + alert('Please select the Packaging Type'); + $('#txtPackaging').val(''); + $("#PackagingType").focus(); + } + + else if($('#txtPackaging').val() != '' && $('#txtPackaging').val() !='0') + { + var Packagingvalue = parseFloat($('#txtPackaging').val()); + var AfterPackaging = 0.0; + + if(PackagingType == PercentageType) + { + if($(PackagingCalculation != 0 && '#txtAfterDiscount').val() == '') + { + alert('Please Enter the Discount value'); + $('#txtPackaging').val(''); + $('#DiscountType').focus(); + + return false; + } + else + { + var AfterDiscount =parseFloat($('#txtAfterDiscount').val()); + AfterPackaging = PackagingCalculation == 0 ? : ; + } + + } + else if(PackagingType == NilType ) + { + AfterPackaging = 0.00; + //Change(); + + } + else + { + + + AfterPackaging = PackagingCalculation == 0 ? : ; + + } + var Packaging = parseFloat(AfterPackaging).toFixed(2); + + $('#txtAfterPackaging').val(Packaging); + //RevenueChangeSgst(); + } + else + { + $('#txtAfterPackaging').val("0.00"); + } + } + + calculateTotalValue(); + } + else + { + if($('#EditRevenueMaterialCode').val() == "0") + { + alert('Please Select the Material Code'); + $('#EditRevenueMaterialCode').focus(); + $('#txtEditPackaging').val(''); + return false; + } + else if($('#EditRevenueRate').val() == '') + { + alert('Please Enter the Rate value'); + $('#EditRate').focus(); + $('#txtEditPackaging').val(''); + return false; + } + + else + { + + var basicValue = parseFloat($('#txtEditRevenueBasicValue').val()); + + var PackagingType =$("#EditPackagingType").val(); + + if(PackagingType == "0") + { + alert('Please select the Packaging Type'); + $('#txtEditPackaging').val(''); + $("#EditPackagingType").focus(); + } + + else if($('#txtEditPackaging').val() != '' && $('#txtEditPackaging').val() !='0') + { + var Packagingvalue = parseFloat($('#txtEditPackaging').val()); + var AfterPackaging = 0.0; + + if(PackagingType == PercentageType) + { + if(PackagingCalculation != 0 &&$('#txtEditAfterDiscount').val() == '') + { + alert('Please Enter the Discount value'); + $('#EditDiscountType').focus(); + $('#txtEditPackaging').val(''); + return false; + } + else + { + var AfterDiscount =parseFloat($('#txtEditAfterDiscount').val()); + AfterPackaging = PackagingCalculation == 0 ? : ; + } + + } + else if(PackagingType == NilType ) + { + AfterPackaging = "0.00"; + // $('#txtEditAfterPackaging').val(AfterPackaging); + //RevenueChangeSgst(); + } + else + { + + AfterPackaging = PackagingCalculation == 0 ? : ; + + } + var Packaging = parseFloat(AfterPackaging).toFixed(2); + + $('#txtEditAfterPackaging').val(Packaging); + //RevenueChangeEditSgst(); + } + else + { + $('#txtEditAfterPackaging').val("0.00"); + } + } + calculateEditVatValue(); + calculateEditTotalValue(); + } } function calculateExcise(isEdit) { - if(isEdit == '0') - { - - - if($('#MaterialCode').val() == "0") - { - - alert('Please Select the Material Code'); - $('#MaterialCode').focus(); - $('#txtExciseDuty').val(''); - return false; - } - else if($('#Rate').val() == '') - { - alert('Please Enter the Rate value'); - $('#txtExciseDuty').val(''); - $('#Rate').focus(); - return false; - } - - else - { - - var basicValue = parseFloat($('#txtBasicValue').val()); - - - if($('#txtExciseDuty').val() != '' && $('#txtExciseDuty').val() != '0' && ExciseCalculation!='') - { - var AfterExciseDuty = 0.0; - var ExciseDuty = parseFloat($('#txtExciseDuty').val()); - - if(ExciseCalculation == '0') - { - AfterExciseDuty = ; - } - else if(ExciseCalculation == '1') - { - if($('#txtAfterDiscount').val() == '') - { - alert('Please Enter the Discount value'); - $('#DiscountType').focus(); - $('#txtExciseDuty').val(''); - return false; - } - else - { - var AfterDiscount =parseFloat($('#txtAfterDiscount').val()); - AfterExciseDuty = ; - } - } - else if(ExciseCalculation == '2') - { - if($('#txtAfterDiscount').val() == '') - { - alert('Please Enter the Discount value'); - $('#DiscountType').focus(); - $('#txtExciseDuty').val(''); - return false; - } - else if($('#txtAfterPackaging').val() == '') - { - alert('Please Enter the Packaging value'); - $('#PackagingType').focus(); - $('#txtExciseDuty').val(''); - return false; - - } - else - { - var AfterDiscount =parseFloat($('#txtAfterDiscount').val()); - var AfterPackaging = parseFloat($('#txtAfterPackaging').val()); - AfterExciseDuty = ; - } - } - else - { - if($('#txtAfterPackaging').val() == '') - { - alert('Please Enter the Packaging value'); - $('#PackagingType').focus(); - $('#txtExciseDuty').val(''); - return false; - } - else - { - AfterExciseDuty = ; - var AfterPackaging = parseFloat($('#txtAfterPackaging').val()); - } - } - var ExciseVal = parseFloat(AfterExciseDuty).toFixed(2); - - $('#txtAfterExciseDuty').val(ExciseVal); - } - else - { - $('#txtAfterExciseDuty').val("0.00"); - } - - } + if(isEdit == '0') + { + + + if($('#MaterialCode').val() == "0") + { + + alert('Please Select the Material Code'); + $('#MaterialCode').focus(); + $('#txtExciseDuty').val(''); + return false; + } + else if($('#Rate').val() == '') + { + alert('Please Enter the Rate value'); + $('#txtExciseDuty').val(''); + $('#Rate').focus(); + return false; + } + + else + { + + var basicValue = parseFloat($('#txtBasicValue').val()); + + + if($('#txtExciseDuty').val() != '' && $('#txtExciseDuty').val() != '0' && ExciseCalculation!='') + { + var AfterExciseDuty = 0.0; + var ExciseDuty = parseFloat($('#txtExciseDuty').val()); + + if(ExciseCalculation == '0') + { + AfterExciseDuty = ; + } + else if(ExciseCalculation == '1') + { + if($('#txtAfterDiscount').val() == '') + { + alert('Please Enter the Discount value'); + $('#DiscountType').focus(); + $('#txtExciseDuty').val(''); + return false; + } + else + { + var AfterDiscount =parseFloat($('#txtAfterDiscount').val()); + AfterExciseDuty = ; + } + } + else if(ExciseCalculation == '2') + { + if($('#txtAfterDiscount').val() == '') + { + alert('Please Enter the Discount value'); + $('#DiscountType').focus(); + $('#txtExciseDuty').val(''); + return false; + } + else if($('#txtAfterPackaging').val() == '') + { + alert('Please Enter the Packaging value'); + $('#PackagingType').focus(); + $('#txtExciseDuty').val(''); + return false; + + } + else + { + var AfterDiscount =parseFloat($('#txtAfterDiscount').val()); + var AfterPackaging = parseFloat($('#txtAfterPackaging').val()); + AfterExciseDuty = ; + } + } + else + { + if($('#txtAfterPackaging').val() == '') + { + alert('Please Enter the Packaging value'); + $('#PackagingType').focus(); + $('#txtExciseDuty').val(''); + return false; + } + else + { + AfterExciseDuty = ; + var AfterPackaging = parseFloat($('#txtAfterPackaging').val()); + } + } + var ExciseVal = parseFloat(AfterExciseDuty).toFixed(2); + + $('#txtAfterExciseDuty').val(ExciseVal); + } + else + { + $('#txtAfterExciseDuty').val("0.00"); + } + + } - calculateTotalValue(); - } - else - { - if($('#EditRevenueMaterialCode').val() == "0") - { - alert('Please Select the Material Code'); - $('#EditRevenueMaterialCode').focus(); - return false; - } - else if($('#EditRevenueRate').val() == '') - { - alert('Please Enter the Rate value'); - $('#EditRevenueRate').focus(); - return false; - } - - else - { - - var basicValue = parseFloat($('#txtEditRevenueBasicValue').val()); - - - - if($('#txtEditExciseDuty').val() != '' && $('#txtEditExciseDuty').val() != '0') - { - var AfterExciseDuty = 0.0; - var ExciseDuty = parseFloat($('#txtEditExciseDuty').val()); - if(ExciseCalculation == '0') - { - AfterExciseDuty = ; - } - else if(ExciseCalculation == '1') - { - if($('#txtEditAfterDiscount').val() == '') - { - alert('Please Enter the Discount value'); - $('#EditDiscountType').focus(); - $('#txtEditExciseDuty').val(''); - return false; - } - else - { - var AfterDiscount =parseFloat($('#txtEditAfterDiscount').val()); - AfterExciseDuty = ; - } - } - else if(ExciseCalculation == '2') - { - if($('#txtEditAfterDiscount').val() == '') - { - alert('Please Enter the Discount value'); - $('#EditDiscountType').focus(); - $('#txtEditExciseDuty').val(''); - return false; - } - else if($('#txtEditAfterPackaging').val() == '') - { - alert('Please Enter the Packaging value'); - $('#EditPackagingType').focus(); - $('#txtEditExciseDuty').val(''); - return false; - } - else - { - var AfterDiscount =parseFloat($('#txtEditAfterDiscount').val()); - var AfterPackaging = parseFloat($('#txtEditAfterPackaging').val()); - AfterExciseDuty = ; - } - } - else - { - if($('#txtEditAfterPackaging').val() == '') - { - alert('Please Enter the Packaging value'); - $('#EditPackagingType').focus(); - $('#txtEditExciseDuty').val(''); - return false; - } - else - { - var AfterPackaging = parseFloat($('#txtEditAfterPackaging').val()); - AfterExciseDuty = ; - } - } - var ExciseVal = parseFloat(AfterExciseDuty).toFixed(2); - - $('#txtEditAfterExciseDuty').val(ExciseVal); - } - else - { - $('#txtEditAfterExciseDuty').val("0.00"); - } - - } - - calculateEditTotalValue(); - } - + calculateTotalValue(); + } + else + { + if($('#EditRevenueMaterialCode').val() == "0") + { + alert('Please Select the Material Code'); + $('#EditRevenueMaterialCode').focus(); + return false; + } + else if($('#EditRevenueRate').val() == '') + { + alert('Please Enter the Rate value'); + $('#EditRevenueRate').focus(); + return false; + } + + else + { + + var basicValue = parseFloat($('#txtEditRevenueBasicValue').val()); + + + + if($('#txtEditExciseDuty').val() != '' && $('#txtEditExciseDuty').val() != '0') + { + var AfterExciseDuty = 0.0; + var ExciseDuty = parseFloat($('#txtEditExciseDuty').val()); + if(ExciseCalculation == '0') + { + AfterExciseDuty = ; + } + else if(ExciseCalculation == '1') + { + if($('#txtEditAfterDiscount').val() == '') + { + alert('Please Enter the Discount value'); + $('#EditDiscountType').focus(); + $('#txtEditExciseDuty').val(''); + return false; + } + else + { + var AfterDiscount =parseFloat($('#txtEditAfterDiscount').val()); + AfterExciseDuty = ; + } + } + else if(ExciseCalculation == '2') + { + if($('#txtEditAfterDiscount').val() == '') + { + alert('Please Enter the Discount value'); + $('#EditDiscountType').focus(); + $('#txtEditExciseDuty').val(''); + return false; + } + else if($('#txtEditAfterPackaging').val() == '') + { + alert('Please Enter the Packaging value'); + $('#EditPackagingType').focus(); + $('#txtEditExciseDuty').val(''); + return false; + } + else + { + var AfterDiscount =parseFloat($('#txtEditAfterDiscount').val()); + var AfterPackaging = parseFloat($('#txtEditAfterPackaging').val()); + AfterExciseDuty = ; + } + } + else + { + if($('#txtEditAfterPackaging').val() == '') + { + alert('Please Enter the Packaging value'); + $('#EditPackagingType').focus(); + $('#txtEditExciseDuty').val(''); + return false; + } + else + { + var AfterPackaging = parseFloat($('#txtEditAfterPackaging').val()); + AfterExciseDuty = ; + } + } + var ExciseVal = parseFloat(AfterExciseDuty).toFixed(2); + + $('#txtEditAfterExciseDuty').val(ExciseVal); + } + else + { + $('#txtEditAfterExciseDuty').val("0.00"); + } + + } + + calculateEditTotalValue(); + } + } function calculateVat(isEdit) { - if(isEdit == '0') - { - if($('#MaterialCode').val() == "0") - { - alert('Please Select the Material Code'); - $('#MaterialCode').focus(); - $('#txtVat').val(''); - return false; - } - else if($('#Rate').val() == '') - { - - alert('Please Enter the Rate value'); - $('#Rate').focus(); - $('#txtVat').val(''); - return false; - } + if(isEdit == '0') + { + if($('#MaterialCode').val() == "0") + { + alert('Please Select the Material Code'); + $('#MaterialCode').focus(); + $('#txtVat').val(''); + return false; + } + else if($('#Rate').val() == '') + { + + alert('Please Enter the Rate value'); + $('#Rate').focus(); + $('#txtVat').val(''); + return false; + } else if($('#txtAfterDiscount').val() == '') - { - - // alert('Please Enter the Rate value'); - $('#txtDiscount').focus(); - $('#txtVat').val(''); - return false; - } + { + + // alert('Please Enter the Rate value'); + $('#txtDiscount').focus(); + $('#txtVat').val(''); + return false; + } else if($('#txtAfterPackaging').val() == '') - { - - //alert('Please Enter the Rate value'); - $('#txtPackaging').focus(); - $('#txtVat').val(''); - return false; - } + { + + //alert('Please Enter the Rate value'); + $('#txtPackaging').focus(); + $('#txtVat').val(''); + return false; + } else if($('#txtAfterExciseDuty').val() == '') - { - - //alert('Please Enter the Rate value'); - $('#txtExciseDuty').focus(); - $('#txtVat').val(''); - return false; - } + { + + //alert('Please Enter the Rate value'); + $('#txtExciseDuty').focus(); + $('#txtVat').val(''); + return false; + } - - - else - { - - var basicValue = parseFloat($('#txtBasicValue').val()); - var AfterVat = 0.0; - - if(VatCalculation != 0 && $('#txtVat').val() != '' ) - { - - if($('#txtAfterExciseDuty').val() == '') - { - - alert('Please Enter the Excise value'); - $('#txtExciseDuty').focus(); - $('#txtVat').val(''); - return false; - } - else - { - - var ExciseDuty = parseFloat($('#txtAfterExciseDuty').val()); - vatValue = parseFloat($('#txtVat').val()); + + + else + { + + var basicValue = parseFloat($('#txtBasicValue').val()); + var AfterVat = 0.0; + + if(VatCalculation != 0 && $('#txtVat').val() != '' ) + { + + if($('#txtAfterExciseDuty').val() == '') + { + + alert('Please Enter the Excise value'); + $('#txtExciseDuty').focus(); + $('#txtVat').val(''); + return false; + } + else + { + + var ExciseDuty = parseFloat($('#txtAfterExciseDuty').val()); + vatValue = parseFloat($('#txtVat').val()); - var discountValue = parseFloat($('#txtAfterDiscount').val()); + var discountValue = parseFloat($('#txtAfterDiscount').val()); var packageValue = parseFloat($('#txtAfterPackaging').val()); - AfterVat = ; - - var Vatval = parseFloat(AfterVat).toFixed(2); - - $('#txtAfterVat').val(Vatval); - } - } - else if(VatCalculation == 0 && $('#txtVat').val() != '') - { - - var ExciseDuty = parseFloat($('#txtAfterExciseDuty').val()); - vatValue = parseFloat($('#txtVat').val()); - - var discountValue = parseFloat($('#txtAfterDiscount').val()); + AfterVat = ; + + var Vatval = parseFloat(AfterVat).toFixed(2); + + $('#txtAfterVat').val(Vatval); + } + } + else if(VatCalculation == 0 && $('#txtVat').val() != '') + { + + var ExciseDuty = parseFloat($('#txtAfterExciseDuty').val()); + vatValue = parseFloat($('#txtVat').val()); + + var discountValue = parseFloat($('#txtAfterDiscount').val()); var packageValue = parseFloat($('#txtAfterPackaging').val()); - AfterVat = ; - - - var Vatval = parseFloat(AfterVat).toFixed(2); - - $('#txtAfterVat').val(Vatval); - } - - else - { - - $('#txtAfterVat').val("0.00"); - } - - calculateTotalValue(); - } - - } - else - { - if($('#EditRevenueMaterialCode').val() == "0") - { - alert('Please Select the Material Code'); - $('#EditRevenueMaterialCode').focus(); - $('#txtEditVat').val(''); - return false; - } - else if($('#EditRevenueRate').val() == '') - { - alert('Please Enter the Rate value'); - $('#EditRevenueRate').focus(); - $('#txtEditVat').val(''); - return false; - } - - else - { - var basicValue = parseFloat($('#txtEditRevenueBasicValue').val()); - - var discountValue = parseFloat($('#txtEditAfterDiscount').val()); - var packageValue = parseFloat($('#txtEditAfterPackaging').val()); - - var AfterVat = 0.0; - if(VatCalculation != 0 && $('#txtEditVat').val() != '' ) - { - - if($('#txtEditAfterExciseDuty').val() == '') - { - alert('Please Enter the Excise value'); - $('#txtEditAfterExciseDuty').focus(); - $('#txtEditVat').val(''); - return false; - } - else - { - var ExciseDuty = parseFloat($('#txtEditAfterExciseDuty').val()); - vatValue = parseFloat($('#txtEditVat').val()); - AfterVat = ; - var Vatval = parseFloat(AfterVat).toFixed(2); - - $('#txtEditAfterVat').val(Vatval); - } - } - else if(VatCalculation == 0 && $('#txtEditVat').val() != '') - { - var ExciseDuty = parseFloat($('#txtEditAfterExciseDuty').val()); - vatValue = parseFloat($('#txtEditVat').val()); - AfterVat = ; - var Vatval = parseFloat(AfterVat).toFixed(2); - - $('#txtEditAfterVat').val(Vatval); - } - - else - { - $('#txtEditAfterVat').val("0.00"); - } - - calculateEditTotalValue(); - } - - } + AfterVat = ; + + + var Vatval = parseFloat(AfterVat).toFixed(2); + + $('#txtAfterVat').val(Vatval); + } + + else + { + + $('#txtAfterVat').val("0.00"); + } + + calculateTotalValue(); + } + + } + else + { + if($('#EditRevenueMaterialCode').val() == "0") + { + alert('Please Select the Material Code'); + $('#EditRevenueMaterialCode').focus(); + $('#txtEditVat').val(''); + return false; + } + else if($('#EditRevenueRate').val() == '') + { + alert('Please Enter the Rate value'); + $('#EditRevenueRate').focus(); + $('#txtEditVat').val(''); + return false; + } + + else + { + var basicValue = parseFloat($('#txtEditRevenueBasicValue').val()); + + var discountValue = parseFloat($('#txtEditAfterDiscount').val()); + var packageValue = parseFloat($('#txtEditAfterPackaging').val()); + + var AfterVat = 0.0; + if(VatCalculation != 0 && $('#txtEditVat').val() != '' ) + { + + if($('#txtEditAfterExciseDuty').val() == '') + { + alert('Please Enter the Excise value'); + $('#txtEditAfterExciseDuty').focus(); + $('#txtEditVat').val(''); + return false; + } + else + { + var ExciseDuty = parseFloat($('#txtEditAfterExciseDuty').val()); + vatValue = parseFloat($('#txtEditVat').val()); + AfterVat = ; + var Vatval = parseFloat(AfterVat).toFixed(2); + + $('#txtEditAfterVat').val(Vatval); + } + } + else if(VatCalculation == 0 && $('#txtEditVat').val() != '') + { + var ExciseDuty = parseFloat($('#txtEditAfterExciseDuty').val()); + vatValue = parseFloat($('#txtEditVat').val()); + AfterVat = ; + var Vatval = parseFloat(AfterVat).toFixed(2); + + $('#txtEditAfterVat').val(Vatval); + } + + else + { + $('#txtEditAfterVat').val("0.00"); + } + + calculateEditTotalValue(); + } + + } } function calculateCST(isEdit) { - if(isEdit == '0') - { - - if($('#MaterialCode').val() == "0") - { - alert('Please Select the Material Code'); - $('#MaterialCode').focus(); - $('#txtCST').val(''); - return false; - } - else if($('#Rate').val() == '') - { - alert('Please Enter the Rate value'); - $('#Rate').focus(); - $('#txtCST').val(''); - return false; - } + if(isEdit == '0') + { + + if($('#MaterialCode').val() == "0") + { + alert('Please Select the Material Code'); + $('#MaterialCode').focus(); + $('#txtCST').val(''); + return false; + } + else if($('#Rate').val() == '') + { + alert('Please Enter the Rate value'); + $('#Rate').focus(); + $('#txtCST').val(''); + return false; + } else if($('#txtAfterDiscount').val() == '') - { - - // alert('Please Enter the Rate value'); - $('#txtDiscount').focus(); - $('#txtCST').val(''); - return false; - } + { + + // alert('Please Enter the Rate value'); + $('#txtDiscount').focus(); + $('#txtCST').val(''); + return false; + } else if($('#txtAfterPackaging').val() == '') - { - - //alert('Please Enter the Rate value'); - $('#txtPackaging').focus(); - $('#txtCST').val(''); - return false; - } + { + + //alert('Please Enter the Rate value'); + $('#txtPackaging').focus(); + $('#txtCST').val(''); + return false; + } else if($('#txtAfterExciseDuty').val() == '') - { - - //alert('Please Enter the Rate value'); - $('#txtExciseDuty').focus(); - $('#txtCST').val(''); - return false; - } - - else - { - var basicValue = parseFloat($('#txtBasicValue').val()); - var discountValue = parseFloat($('#txtAfterDiscount').val()); + { + + //alert('Please Enter the Rate value'); + $('#txtExciseDuty').focus(); + $('#txtCST').val(''); + return false; + } + + else + { + var basicValue = parseFloat($('#txtBasicValue').val()); + var discountValue = parseFloat($('#txtAfterDiscount').val()); var packageValue = parseFloat($('#txtAfterPackaging').val()); - var AfterCST = 0.0; - if(CSTCalculation != 0 && $('#txtCST').val() != '' ) - { - - if($('#txtAfterExciseDuty').val() == '') - { - alert('Please Enter the Excise value'); - $('#txtExciseDuty').focus(); - $('#txtAfterCST').val(''); - return false; - } - else - { - var ExciseDuty = parseFloat($('#txtAfterExciseDuty').val()); - var CSTValue= parseFloat($('#txtCST').val()); - AfterCST = ; - - var Vatval = parseFloat(AfterCST).toFixed(2); - - $('#txtAfterCST').val(Vatval); - } - } - else if(CSTCalculation == 0 && $('#txtCST').val() != '') - { - + var AfterCST = 0.0; + if(CSTCalculation != 0 && $('#txtCST').val() != '' ) + { + + if($('#txtAfterExciseDuty').val() == '') + { + alert('Please Enter the Excise value'); + $('#txtExciseDuty').focus(); + $('#txtAfterCST').val(''); + return false; + } + else + { + var ExciseDuty = parseFloat($('#txtAfterExciseDuty').val()); + var CSTValue= parseFloat($('#txtCST').val()); + AfterCST = ; + + var Vatval = parseFloat(AfterCST).toFixed(2); + + $('#txtAfterCST').val(Vatval); + } + } + else if(CSTCalculation == 0 && $('#txtCST').val() != '') + { + var ExciseDuty = parseFloat($('#txtAfterExciseDuty').val()); - var CSTValue= parseFloat($('#txtCST').val()); - - AfterCST = ; - var Vatval = parseFloat(AfterCST).toFixed(2); - - $('#txtAfterCST').val(Vatval); - } - - else - { - $('#txtAfterCST').val("0.00"); - } - calculateTotalValue(); - } - - } - else - { - if($('#EditRevenueMaterialCode').val() == "0") - { - alert('Please Select the Material Code'); - $('#EditRevenueMaterialCode').focus(); - $('#txtEditCST').val(''); - return false; - } - else if($('#EditRevenueRate').val() == '') - { - alert('Please Enter the Rate value'); - $('#EditRevenueRate').focus(); - $('#txtEditCST').val(''); - return false; - } - - else - { - - var basicValue = parseFloat($('#txtEditRevenueBasicValue').val()); - var discountValue = parseFloat($('#txtEditAfterDiscount').val()); - var packageValue = parseFloat($('#txtEditAfterPackaging').val()); - var AfterCST = 0.0; - if(CSTCalculation != 0 && $('#txtEditCST').val() != '' ) - { - - if($('#txtEditAfterExciseDuty').val() == '') - { - alert('Please Enter the Excise value'); - $('#txtEditAfterExciseDuty').focus(); - $('#txtEditCST').val(''); - return false; - } - else - { - var ExciseDuty = parseFloat($('#txtEditAfterExciseDuty').val()); - var CSTValue= parseFloat($('#txtEditCST').val()); - AfterCST = ; - var Vatval = parseFloat(AfterCST).toFixed(2); - - $('#txtEditAfterCST').val(Vatval); - } - } - else if(CSTCalculation == 0 && $('#txtEditCST').val() != '') - { - var ExciseDuty = parseFloat($('#txtEditAfterExciseDuty').val()); - var CSTValue= parseFloat($('#txtEditCST').val()); - AfterCST = ; - var Vatval = parseFloat(AfterCST).toFixed(2); - - $('#txtEditAfterCST').val(Vatval); - } - - else - { - $('#txtEditAfterCST').val("0.00"); - } - - calculateEditTotalValue(); - } - - } + var CSTValue= parseFloat($('#txtCST').val()); + + AfterCST = ; + var Vatval = parseFloat(AfterCST).toFixed(2); + + $('#txtAfterCST').val(Vatval); + } + + else + { + $('#txtAfterCST').val("0.00"); + } + calculateTotalValue(); + } + + } + else + { + if($('#EditRevenueMaterialCode').val() == "0") + { + alert('Please Select the Material Code'); + $('#EditRevenueMaterialCode').focus(); + $('#txtEditCST').val(''); + return false; + } + else if($('#EditRevenueRate').val() == '') + { + alert('Please Enter the Rate value'); + $('#EditRevenueRate').focus(); + $('#txtEditCST').val(''); + return false; + } + + else + { + + var basicValue = parseFloat($('#txtEditRevenueBasicValue').val()); + var discountValue = parseFloat($('#txtEditAfterDiscount').val()); + var packageValue = parseFloat($('#txtEditAfterPackaging').val()); + var AfterCST = 0.0; + if(CSTCalculation != 0 && $('#txtEditCST').val() != '' ) + { + + if($('#txtEditAfterExciseDuty').val() == '') + { + alert('Please Enter the Excise value'); + $('#txtEditAfterExciseDuty').focus(); + $('#txtEditCST').val(''); + return false; + } + else + { + var ExciseDuty = parseFloat($('#txtEditAfterExciseDuty').val()); + var CSTValue= parseFloat($('#txtEditCST').val()); + AfterCST = ; + var Vatval = parseFloat(AfterCST).toFixed(2); + + $('#txtEditAfterCST').val(Vatval); + } + } + else if(CSTCalculation == 0 && $('#txtEditCST').val() != '') + { + var ExciseDuty = parseFloat($('#txtEditAfterExciseDuty').val()); + var CSTValue= parseFloat($('#txtEditCST').val()); + AfterCST = ; + var Vatval = parseFloat(AfterCST).toFixed(2); + + $('#txtEditAfterCST').val(Vatval); + } + + else + { + $('#txtEditAfterCST').val("0.00"); + } + + calculateEditTotalValue(); + } + + } } function calculateGST(isEdit) { - if(isEdit == '0') - { - if($('#MaterialCode').val() == "0") - { - alert('Please Select the Material Code'); - $('#MaterialCode').focus(); - $('#txtGST').val(''); - return false; - } - else if($('#Rate').val() == '') - { - alert('Please Enter the Rate value'); - $('#Rate').focus(); - $('#txtGST').val(''); - return false; - } - else - { - var basicValue = parseFloat($('#txtBasicValue').val()); - - if($('#txtGST').val() != "0" && $('#txtGST').val() != '') - { - var GSTValue = parseFloat($('#txtGST').val()); - - var AfterGST = 0.0; - AfterGST = ; - - var GSTval = parseFloat(AfterGST).toFixed(2); - - $('#txtAfterGST').val(GSTval); - } - else - { - $('#txtAfterGST').val("0.00"); - } - - } - calculateTotalValue(); - } - else - { - if($('#EditRevenueMaterialCode').val() == "0") - { - alert('Please Select the Material Code'); - $('#EditRevenueMaterialCode').focus(); - $('#txtEditGST').val(''); - return false; - } - else if($('#EditRevenueRate').val() == '') - { - alert('Please Enter the Rate value'); - $('#EditRevenueRate').focus(); - $('#txtEditGST').val(''); - return false; - } - else - { - var basicValue = parseFloat($('#txtEditRevenueBasicValue').val()); - - if($('#txtEditGST').val() != "0" && $('#txtEditGST').val() != '') - { - var GSTValue = parseFloat($('#txtEditGST').val()); - - var AfterGST = 0.0; - AfterGST = ; - - var GSTval = parseFloat(AfterGST).toFixed(2); - - $('#txtEditAfterGST').val(GSTval); - } - else - { - $('#txtEditAfterGST').val("0.00"); - } - - } - calculateEditTotalValue(); - - } + if(isEdit == '0') + { + if($('#MaterialCode').val() == "0") + { + alert('Please Select the Material Code'); + $('#MaterialCode').focus(); + $('#txtGST').val(''); + return false; + } + else if($('#Rate').val() == '') + { + alert('Please Enter the Rate value'); + $('#Rate').focus(); + $('#txtGST').val(''); + return false; + } + else + { + var basicValue = parseFloat($('#txtBasicValue').val()); + + if($('#txtGST').val() != "0" && $('#txtGST').val() != '') + { + var GSTValue = parseFloat($('#txtGST').val()); + + var AfterGST = 0.0; + AfterGST = ; + + var GSTval = parseFloat(AfterGST).toFixed(2); + + $('#txtAfterGST').val(GSTval); + } + else + { + $('#txtAfterGST').val("0.00"); + } + + } + calculateTotalValue(); + } + else + { + if($('#EditRevenueMaterialCode').val() == "0") + { + alert('Please Select the Material Code'); + $('#EditRevenueMaterialCode').focus(); + $('#txtEditGST').val(''); + return false; + } + else if($('#EditRevenueRate').val() == '') + { + alert('Please Enter the Rate value'); + $('#EditRevenueRate').focus(); + $('#txtEditGST').val(''); + return false; + } + else + { + var basicValue = parseFloat($('#txtEditRevenueBasicValue').val()); + + if($('#txtEditGST').val() != "0" && $('#txtEditGST').val() != '') + { + var GSTValue = parseFloat($('#txtEditGST').val()); + + var AfterGST = 0.0; + AfterGST = ; + + var GSTval = parseFloat(AfterGST).toFixed(2); + + $('#txtEditAfterGST').val(GSTval); + } + else + { + $('#txtEditAfterGST').val("0.00"); + } + + } + calculateEditTotalValue(); + + } } function calculateOtherTaxes(isEdit) { - if(isEdit == '0') - { - if($('#MaterialCode').val() == "0") - { - alert('Please Select the Material Code'); - $('#MaterialCode').focus(); - $('#txtOtherTax').val(''); - return false; - } - else if($('#Rate').val() == '') - { - alert('Please Enter the Rate value'); - $('#Rate').focus(); - $('#txtOtherTax').val(''); - return false; - } - else - { - var basicValue = parseFloat($('#txtBasicValue').val()); - - - if($('#txtOtherTax').val() != "0" && $('#txtOtherTax').val() != '') - { - var OtherTaxValue = parseFloat($('#txtOtherTax').val()); - - var AfterOtherTaxes = 0.0; - AfterOtherTaxes = ; - - var Otherval = parseFloat(AfterOtherTaxes).toFixed(2); - - $('#txtAfterOtherTax').val(Otherval); - } - else - { - $('#txtAfterOtherTax').val("0.00"); - } - calculateTotalValue(); - - } - } - else - { - if($('#EditRevenueMaterialCode').val() == "0") - { - alert('Please Select the Material Code'); - $('#EditRevenueMaterialCode').focus(); - $('#txtEditOtherTax').val(''); - return false; - } - else if($('#EditRevenueRate').val() == '') - { - alert('Please Enter the Rate value'); - $('#EditRevenueRate').focus(); - $('#txtEditOtherTax').val(''); - return false; - } - else - { - var basicValue = parseFloat($('#txtEditRevenueBasicValue').val()); - - - if($('#txtEditOtherTax').val() != "0" && $('#txtEditOtherTax').val() != '') - { - var OtherTaxValue = parseFloat($('#txtEditOtherTax').val()); - - var AfterOtherTaxes = 0.0; - AfterOtherTaxes = ; - - var Otherval = parseFloat(AfterOtherTaxes).toFixed(2); - - $('#txtEditAfterOtherTax').val(Otherval); - } - else - { - $('#txtEditAfterOtherTax').val("0.00"); - } - calculateEditTotalValue(); - - } - - } + if(isEdit == '0') + { + if($('#MaterialCode').val() == "0") + { + alert('Please Select the Material Code'); + $('#MaterialCode').focus(); + $('#txtOtherTax').val(''); + return false; + } + else if($('#Rate').val() == '') + { + alert('Please Enter the Rate value'); + $('#Rate').focus(); + $('#txtOtherTax').val(''); + return false; + } + else + { + var basicValue = parseFloat($('#txtBasicValue').val()); + + + if($('#txtOtherTax').val() != "0" && $('#txtOtherTax').val() != '') + { + var OtherTaxValue = parseFloat($('#txtOtherTax').val()); + + var AfterOtherTaxes = 0.0; + AfterOtherTaxes = ; + + var Otherval = parseFloat(AfterOtherTaxes).toFixed(2); + + $('#txtAfterOtherTax').val(Otherval); + } + else + { + $('#txtAfterOtherTax').val("0.00"); + } + calculateTotalValue(); + + } + } + else + { + if($('#EditRevenueMaterialCode').val() == "0") + { + alert('Please Select the Material Code'); + $('#EditRevenueMaterialCode').focus(); + $('#txtEditOtherTax').val(''); + return false; + } + else if($('#EditRevenueRate').val() == '') + { + alert('Please Enter the Rate value'); + $('#EditRevenueRate').focus(); + $('#txtEditOtherTax').val(''); + return false; + } + else + { + var basicValue = parseFloat($('#txtEditRevenueBasicValue').val()); + + + if($('#txtEditOtherTax').val() != "0" && $('#txtEditOtherTax').val() != '') + { + var OtherTaxValue = parseFloat($('#txtEditOtherTax').val()); + + var AfterOtherTaxes = 0.0; + AfterOtherTaxes = ; + + var Otherval = parseFloat(AfterOtherTaxes).toFixed(2); + + $('#txtEditAfterOtherTax').val(Otherval); + } + else + { + $('#txtEditAfterOtherTax').val("0.00"); + } + calculateEditTotalValue(); + + } + + } } function calculateFreight(isEdit) { - if(isEdit == '0') - { - if($('#MaterialCode').val() == "0") - { - alert('Please Select the Material Code'); - $('#MaterialCode').focus(); - $('#txtFreight').val('') ; - return false; - } - else if($('#Rate').val() == '') - { - alert('Please Enter the Rate value'); - $('#Rate').focus(); - $('#txtFreight').val(''); - return false; - } - else - { - var basicValue = parseFloat($('#txtBasicValue').val()); - var FreightType =$("#drpFreight").val(); - - if(FreightType == "0") - { - alert('Please select Freight Type'); - $('#txtFreight').val(''); - $("#drpFreight").focus(); - } - else if( $('#txtFreight').val() != "0" && $('#txtFreight').val() != '') - { - var FreightValue = parseFloat($('#txtFreight').val()); - var UOM = parseFloat($('#UOM').val()); - var Quantity = parseFloat($('#Quantity').val()); - //alert(FreightType); - var AfterFreight = 0.0; - // if(FreightType == PercentageType) - // { - // AfterFreight = ; - // } - if(FreightType == PercentageType) - { - if($(freightCalculation != 0 && '#txtAfterDiscount').val() == '') - { - alert('Please Enter the Discount value'); - $('#txtFreight').val(''); - $('#DiscountType').focus(); - - return false; - } - else - { - var AfterDiscount =parseFloat($('#txtAfterDiscount').val()); - AfterFreight = freightCalculation == 0 ? : ; - } - } - else if(FreightType == NilType) - { - AfterFreight = 0.0; - - } - else if(FreightType == '') - { - AfterFreight = ; - } - else if(FreightType == '') - { - AfterFreight = ; - } - else if(FreightType == '') - { + if(isEdit == '0') + { + if($('#MaterialCode').val() == "0") + { + alert('Please Select the Material Code'); + $('#MaterialCode').focus(); + $('#txtFreight').val('') ; + return false; + } + else if($('#Rate').val() == '') + { + alert('Please Enter the Rate value'); + $('#Rate').focus(); + $('#txtFreight').val(''); + return false; + } + else + { + var basicValue = parseFloat($('#txtBasicValue').val()); + var FreightType =$("#drpFreight").val(); + + if(FreightType == "0") + { + alert('Please select Freight Type'); + $('#txtFreight').val(''); + $("#drpFreight").focus(); + } + else if( $('#txtFreight').val() != "0" && $('#txtFreight').val() != '') + { + var FreightValue = parseFloat($('#txtFreight').val()); + var UOM = parseFloat($('#UOM').val()); + var Quantity = parseFloat($('#Quantity').val()); + //alert(FreightType); + var AfterFreight = 0.0; + // if(FreightType == PercentageType) + // { + // AfterFreight = ; + // } + if(FreightType == PercentageType) + { + if($(freightCalculation != 0 && '#txtAfterDiscount').val() == '') + { + alert('Please Enter the Discount value'); + $('#txtFreight').val(''); + $('#DiscountType').focus(); + + return false; + } + else + { + var AfterDiscount =parseFloat($('#txtAfterDiscount').val()); + AfterFreight = freightCalculation == 0 ? : ; + } + } + else if(FreightType == NilType) + { + AfterFreight = 0.0; + + } + else if(FreightType == '') + { + AfterFreight = ; + } + else if(FreightType == '') + { + AfterFreight = ; + } + else if(FreightType == '') + { if($('#NOOfTrips').val()==''){ alert('Please Enter No of Trip'); - - $("#NOOfTrips").focus(); + + $("#NOOfTrips").focus(); $('#txtFreight').val(0) AfterFreight=0; $('#txtAfterFreight').val("0.00"); @@ -1607,97 +1607,97 @@ function calculatePackaging(isEdit) AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2); } - - } - else { - AfterFreight = $("#txtFreight").val(); - } - var AfterFreightval = parseFloat(AfterFreight).toFixed(2); - - $('#txtAfterFreight').val(AfterFreightval); - - } - else - { - $('#txtAfterFreight').val("0.00"); - } - - } - - - calculateTotalValue(); - } - else - { - if($('#EditRevenueMaterialCode').val() == "0") - { - alert('Please Select the Material Code'); - $('#EditRevenueMaterialCode').focus(); - $('#txtEditFreight').val(''); - return false; - } - else if($('#EditRevenueRate').val() == '') - { - alert('Please Enter the Rate value'); - $('#EditRevenueRate').focus(); - $('#txtEditFreight').val(''); - return false; - } - else - { - var basicValue = parseFloat($('#txtEditRevenueBasicValue').val()); - var FreightType =$("#drpEditFreight").val(); - if(FreightType == "0") - { - alert('Please select Freight Type'); - $('#txtEditFreight').val(''); - $("#drpEditFreight").focus(); - } - else if( $('#txtEditFreight').val() != "0" && $('#txtEditFreight').val() != '') - { - var FreightValue = parseFloat($('#txtEditFreight').val()); - var UOM = parseFloat($('#EditRevenueUOM').val()); - var Quantity = parseFloat($('#EditRevenueQuantity').val()); - //alert(FreightType); - var AfterFreight = 0.0; - // if(FreightType == PercentageType) - // { - // AfterFreight = ; - // } - if(FreightType == PercentageType) - { - if($(freightCalculation != 0 && '#txtEditAfterDiscount').val() == '') - { - alert('Please Enter the Discount value'); - $('#txtEditFreight').val(''); - $('#DiscountType').focus(); - - return false; - } - else - { - var AfterDiscount =parseFloat($('#txtEditAfterDiscount').val()); - AfterFreight = freightCalculation == 0 ? : ; - } - } - else if(FreightType == NilType) - { - AfterFreight = 0.0; - } - else if(FreightType == '') - { - AfterFreight = ; - } - else if(FreightType == '') - { - AfterFreight = ; - } - else if(FreightType == '') - { - if($('#EditNOOfTrips').val()==''){ + + } + else { + AfterFreight = $("#txtFreight").val(); + } + var AfterFreightval = parseFloat(AfterFreight).toFixed(2); + + $('#txtAfterFreight').val(AfterFreightval); + + } + else + { + $('#txtAfterFreight').val("0.00"); + } + + } + + + calculateTotalValue(); + } + else + { + if($('#EditRevenueMaterialCode').val() == "0") + { + alert('Please Select the Material Code'); + $('#EditRevenueMaterialCode').focus(); + $('#txtEditFreight').val(''); + return false; + } + else if($('#EditRevenueRate').val() == '') + { + alert('Please Enter the Rate value'); + $('#EditRevenueRate').focus(); + $('#txtEditFreight').val(''); + return false; + } + else + { + var basicValue = parseFloat($('#txtEditRevenueBasicValue').val()); + var FreightType =$("#drpEditFreight").val(); + if(FreightType == "0") + { + alert('Please select Freight Type'); + $('#txtEditFreight').val(''); + $("#drpEditFreight").focus(); + } + else if( $('#txtEditFreight').val() != "0" && $('#txtEditFreight').val() != '') + { + var FreightValue = parseFloat($('#txtEditFreight').val()); + var UOM = parseFloat($('#EditRevenueUOM').val()); + var Quantity = parseFloat($('#EditRevenueQuantity').val()); + //alert(FreightType); + var AfterFreight = 0.0; + // if(FreightType == PercentageType) + // { + // AfterFreight = ; + // } + if(FreightType == PercentageType) + { + if($(freightCalculation != 0 && '#txtEditAfterDiscount').val() == '') + { + alert('Please Enter the Discount value'); + $('#txtEditFreight').val(''); + $('#DiscountType').focus(); + + return false; + } + else + { + var AfterDiscount =parseFloat($('#txtEditAfterDiscount').val()); + AfterFreight = freightCalculation == 0 ? : ; + } + } + else if(FreightType == NilType) + { + AfterFreight = 0.0; + } + else if(FreightType == '') + { + AfterFreight = ; + } + else if(FreightType == '') + { + AfterFreight = ; + } + else if(FreightType == '') + { + if($('#EditNOOfTrips').val()==''){ alert('Please Enter No of Trip'); - - $("#EditNOOfTrips").focus(); + + $("#EditNOOfTrips").focus(); $('#txtEditFreight').val(0) AfterFreight=0; $('#txtEditAfterFreight').val("0.00"); @@ -1707,38 +1707,38 @@ function calculatePackaging(isEdit) var noOftrip = $("#EditNOOfTrips").val(); AfterFreight = ; AfterFreight = parseFloat(AfterFreight * noOftrip).toFixed(2); - } - } - else { - AfterFreight = $("#txtEditFreight").val(); - } - var AfterFreightval = parseFloat(AfterFreight).toFixed(2); - - $('#txtEditAfterFreight').val(AfterFreightval); - //Editchange(); - } - else - { - $('#txtEditAfterFreight').val("0.00"); - } - - } - calculateEditTotalValue(); + } + } + else { + AfterFreight = $("#txtEditFreight").val(); + } + var AfterFreightval = parseFloat(AfterFreight).toFixed(2); + + $('#txtEditAfterFreight').val(AfterFreightval); + //Editchange(); + } + else + { + $('#txtEditAfterFreight').val("0.00"); + } + + } + calculateEditTotalValue(); - } + } } function rfilealert() { var file = $('#imag').val(); if (file=='') - { - alert('File not found'); - SpecialPOcheck(); - } - else{ - SpecialPOcheck(); - } + { + alert('File not found'); + SpecialPOcheck(); + } + else{ + SpecialPOcheck(); + } } function sfilealert() @@ -1746,21 +1746,21 @@ function sfilealert() var file1 = $('#images1').val(); if (file1=='') - { - alert('File not found'); - SpecialPOcheck(); - } - else{ - SpecialPOcheck(); - } + { + alert('File not found'); + SpecialPOcheck(); + } + else{ + SpecialPOcheck(); + } } - + function SpecialPOcheck() { // alert('splpo') - //$('#content').loader('show'); + //$('#content').loader('show'); POcheck=$("input:radio[name='Quality']:checked").val(); console.log(POcheck); @@ -1820,10 +1820,10 @@ function SpecialPOcheck() } /* Set the Packaging calculation option for calculating Packaging */ - function submitoption() + function submitoption() { submitoptionvalue = $("input:radio[name='optsubmit']:checked").val(); - //alert(submitoptionvalue); + //alert(submitoptionvalue); var PO=$('#POType').val(); @@ -1833,19 +1833,19 @@ function SpecialPOcheck() { $('#submitmodel').modal('hide'); - if(submitoptionvalue==0) - { - - //alert('normalemergency'); + if(submitoptionvalue==0) + { + + //alert('normalemergency'); $('#txtSpecial').val(0); $('#content').loader('show'); RevenueSave(1) - } - else - { - //window.location.href ="purchaseorder/addNewPurchaseOrder"; - $('#filemodel').modal('show'); - } + } + else + { + //window.location.href ="purchaseorder/addNewPurchaseOrder"; + $('#filemodel').modal('show'); + } } @@ -1897,29 +1897,29 @@ function SpecialPOcheck() // } - - function qualitycheckoption() + + function qualitycheckoption() { qualityoptionvalue = $("input:radio[name='Quality']:checked").val(); - //alert(submitoptionvalue); + //alert(submitoptionvalue); $('#submitmodel').modal('hide'); - if(qualityoptionvalue==0) - { - - alert('Igr'); - } - else - { - //window.location.href ="purchaseorder/addNewPurchaseOrder"; - alert('Billing'); - } + if(qualityoptionvalue==0) + { + + alert('Igr'); + } + else + { + //window.location.href ="purchaseorder/addNewPurchaseOrder"; + alert('Billing'); + } } function SetPackagingOption() { PackagingCalculation = $("input:radio[name='optPackaging']:checked").val(); $('#packagingcalmodel').modal('hide'); } - function setfreightOption() + function setfreightOption() { freightCalculation = $("input:radio[name='optfreight']:checked").val(); $('#freightmodel').modal('hide'); @@ -1927,19 +1927,19 @@ function SpecialPOcheck() /* Set the Packaging calculation option for calculating Packaging */ function SetExciseCalculation() { - ExciseCalculation = $("input:radio[name='optExcise']:checked").val(); + ExciseCalculation = $("input:radio[name='optExcise']:checked").val(); - $('#ExciseDutyCalModel').modal('hide'); - - calculateExcise($('#isEdit').val()); + $('#ExciseDutyCalModel').modal('hide'); + + calculateExcise($('#isEdit').val()); } function SetExciseCalculationCancel() { - + - $('#txtExciseDuty').val(''); + $('#txtExciseDuty').val(''); $('#txtAfterExciseDuty').val(''); - + } /* Set the Packaging calculation option for calculating Packaging */ function SetVatorCST() @@ -1968,84 +1968,84 @@ function SetExciseCalculationCancel() function SetVatCalculation() { - VatCalculation = $("input:radio[name='optVat']:checked").val(); - $('#VatCalModel').modal('hide'); - calculateVat($('#isEdit').val()); + VatCalculation = $("input:radio[name='optVat']:checked").val(); + $('#VatCalModel').modal('hide'); + calculateVat($('#isEdit').val()); } function SetCSTCalculation() { - CSTCalculation = $("input:radio[name='optCST']:checked").val(); - $('#CSTCalModel').modal('hide'); - calculateCST($('#isEdit').val()); + CSTCalculation = $("input:radio[name='optCST']:checked").val(); + $('#CSTCalModel').modal('hide'); + calculateCST($('#isEdit').val()); } function Editchange(){ - var isEdit=1; - // ExceedEditQuantityCheck(); - if($('#EditRevenueQuantity').val() != '' && $('#EditRevenueRate').val() != '') - { - var txtQuantity = parseFloat( $('#EditRevenueQuantity').val()); - var txtUnitPrice = parseFloat($('#EditRevenueRate').val()); - var Tot = txtQuantity * txtUnitPrice - $('#txtEditRevenueBasicValue').val(Tot); + var isEdit=1; + // ExceedEditQuantityCheck(); + if($('#EditRevenueQuantity').val() != '' && $('#EditRevenueRate').val() != '') + { + var txtQuantity = parseFloat( $('#EditRevenueQuantity').val()); + var txtUnitPrice = parseFloat($('#EditRevenueRate').val()); + var Tot = txtQuantity * txtUnitPrice + $('#txtEditRevenueBasicValue').val(Tot); if($("#EditDiscountType").val()!=0){ - calculateDiscount(isEdit); + calculateDiscount(isEdit); } - + - if ($("#EditPackagingType").val()!=0) { - calculatePackaging(1); - } + if ($("#EditPackagingType").val()!=0) { + calculatePackaging(1); + } if ($("#drpEditFreight").val()!=0) { - calculateFreight(1); - } - var discount = $('#txtEditAfterDiscount').val() == '' ? '0.00' : $('#txtEditAfterDiscount').val(); + calculateFreight(1); + } + var discount = $('#txtEditAfterDiscount').val() == '' ? '0.00' : $('#txtEditAfterDiscount').val(); var basic = $('#txtEditRevenueBasicValue').val() == '' ? '0.00' : $('#txtEditRevenueBasicValue').val(); var basicValue1 = parseFloat(basic-discount); - //alert(basicValue1); - var packaging = $('#txtEditAfterPackaging').val() == '' ? '0.00' : $('#txtEditAfterPackaging').val(); - //alert(packaging); - var freight =$('#txtEditAfterFreight').val() == '' ? '0.00' : $('#txtEditAfterFreight').val(); - //alert(freight); - var packfreight = parseFloat(packaging)+parseFloat(freight); - var basicValue = parseFloat(basicValue1+packfreight); - //alert(basicValue); - - if($("#RevenueEditCgst").val()!=''){ - - $('#RevenueEditAfterCgst').val(calculateCgstTax(basicValue,$('#RevenueEditCgst').val())); - } + //alert(basicValue1); + var packaging = $('#txtEditAfterPackaging').val() == '' ? '0.00' : $('#txtEditAfterPackaging').val(); + //alert(packaging); + var freight =$('#txtEditAfterFreight').val() == '' ? '0.00' : $('#txtEditAfterFreight').val(); + //alert(freight); + var packfreight = parseFloat(packaging)+parseFloat(freight); + var basicValue = parseFloat(basicValue1+packfreight); + //alert(basicValue); + + if($("#RevenueEditCgst").val()!=''){ + + $('#RevenueEditAfterCgst').val(calculateCgstTax(basicValue,$('#RevenueEditCgst').val())); + } else{ $('#RevenueEditAfterCgst').val(0.00); } - if($("#RevenueEditSgst").val()!=''){ - - $('#RevenueEditAfterSgst').val(calculateSgstTax(basicValue,$('#RevenueEditSgst').val())); - } + if($("#RevenueEditSgst").val()!=''){ + + $('#RevenueEditAfterSgst').val(calculateSgstTax(basicValue,$('#RevenueEditSgst').val())); + } else{ $('#RevenueEditAfterSgst').val(0.00); } if($("#RevenueEditIgst").val()!=''){ - - $('#RevenueEditAfterIgst').val(calculateIgstTax(basicValue,$('#RevenueEditIgst').val())); - } - else{ + + $('#RevenueEditAfterIgst').val(calculateIgstTax(basicValue,$('#RevenueEditIgst').val())); + } + else{ $('#RevenueEditAfterIgst').val(0.00); } - - calculateEditTotalValue(); + + calculateEditTotalValue(); - } - + } + } function RevenueChangeSgst() { - + var getTypeOfTax= $("input:radio[name='Range']:checked").val(); if(getTypeOfTax==0){ - + $('#RevenueSgst').val($('#RevenueCgst').val()); change(); } @@ -2060,61 +2060,61 @@ Editchange(); } function change(){ - var isEdit=0; - //ExceedEditQuantityCheck(); - if($('#Quantity').val() != '' && $('#Rate').val() != '') - { - var txtQuantity = parseFloat( $('#Quantity').val()); - var txtUnitPrice = parseFloat($('#Rate').val()); - var Tot = txtQuantity * txtUnitPrice - $('#txtBasicValue').val(parseFloat(Tot).toFixed(2)); + var isEdit=0; + //ExceedEditQuantityCheck(); + if($('#Quantity').val() != '' && $('#Rate').val() != '') + { + var txtQuantity = parseFloat( $('#Quantity').val()); + var txtUnitPrice = parseFloat($('#Rate').val()); + var Tot = txtQuantity * txtUnitPrice + $('#txtBasicValue').val(parseFloat(Tot).toFixed(2)); - if ($("#DiscountType").val()!=0) { - calculateDiscount(isEdit); - } - if ($("#PackagingType").val()!=0) { - calculatePackaging(isEdit); - } - if($("#drpFreight").val()!=0){ - calculateFreight(isEdit); - - - } + if ($("#DiscountType").val()!=0) { + calculateDiscount(isEdit); + } + if ($("#PackagingType").val()!=0) { + calculatePackaging(isEdit); + } + if($("#drpFreight").val()!=0){ + calculateFreight(isEdit); + + + } - var discount = $('#txtAfterDiscount').val() == '' ? '0.00' : $('#txtAfterDiscount').val(); + var discount = $('#txtAfterDiscount').val() == '' ? '0.00' : $('#txtAfterDiscount').val(); var basic = $('#txtBasicValue').val() == '' ? '0.00' : $('#txtBasicValue').val(); var basicValue1 = parseFloat(basic-discount); - var packaging = $('#txtAfterPackaging').val()== '' ? '0.00' : $('#txtAfterPackaging').val(); - var freight =$('#txtAfterFreight').val()== '' ? '0.00' : $('#txtAfterFreight').val(); - var packfreight = parseFloat(packaging)+parseFloat(freight); - var basicValue = parseFloat(basicValue1+packfreight); - //alert(basicValue); - if($("#RevenueCgst").val()!=''){ + var packaging = $('#txtAfterPackaging').val()== '' ? '0.00' : $('#txtAfterPackaging').val(); + var freight =$('#txtAfterFreight').val()== '' ? '0.00' : $('#txtAfterFreight').val(); + var packfreight = parseFloat(packaging)+parseFloat(freight); + var basicValue = parseFloat(basicValue1+packfreight); + //alert(basicValue); + if($("#RevenueCgst").val()!=''){ - $('#RevenueAfterCgst').val(calculateCgstTax(basicValue,$('#RevenueCgst').val())); - } + $('#RevenueAfterCgst').val(calculateCgstTax(basicValue,$('#RevenueCgst').val())); + } else{ $('#RevenueAfterCgst').val(0.00); } - if($("#RevenueSgst").val()!=''){ - - $('#RevenueAfterSgst').val(calculateSgstTax(basicValue,$('#RevenueSgst').val())); - } + if($("#RevenueSgst").val()!=''){ + + $('#RevenueAfterSgst').val(calculateSgstTax(basicValue,$('#RevenueSgst').val())); + } else{ $('#RevenueAfterSgst').val(0.00); } if($("#RevenueIgst").val()!=''){ - - $('#RevenueAfterIgst').val(calculateIgstTax(basicValue,$('#RevenueIgst').val())); - } + + $('#RevenueAfterIgst').val(calculateIgstTax(basicValue,$('#RevenueIgst').val())); + } else{ $('#RevenueAfterIgst').val(0.00); } - calculateTotalValue($('#isEdit').val()); + calculateTotalValue($('#isEdit').val()); - } - + } + } @@ -2134,42 +2134,42 @@ Editchange(); function calculateEditTotalValue() { - var Packaging = $('#txtEditAfterPackaging').val() == '' ? '0.00' : $('#txtEditAfterPackaging').val(); - var Cgst = $('#RevenueEditAfterCgst').val() == '' ? '0.00' : $('#RevenueEditAfterCgst').val(); - var Sgst = $('#RevenueEditAfterSgst').val() == '' ? '0.00' : $('#RevenueEditAfterSgst').val(); - var Igst = $('#RevenueEditAfterIgst').val() == '' ? '0.00' : $('#RevenueEditAfterIgst').val(); + var Packaging = $('#txtEditAfterPackaging').val() == '' ? '0.00' : $('#txtEditAfterPackaging').val(); + var Cgst = $('#RevenueEditAfterCgst').val() == '' ? '0.00' : $('#RevenueEditAfterCgst').val(); + var Sgst = $('#RevenueEditAfterSgst').val() == '' ? '0.00' : $('#RevenueEditAfterSgst').val(); + var Igst = $('#RevenueEditAfterIgst').val() == '' ? '0.00' : $('#RevenueEditAfterIgst').val(); - var Freight = $('#txtEditAfterFreight').val() == '' ? '0.00' : $('#txtEditAfterFreight').val(); - var Insurance = $('#txtEditInsurance').val() == '' ? '0.00' : $('#txtEditInsurance').val(); - var Discount = $('#txtEditAfterDiscount').val() == '' ? '0.00' : $('#txtEditAfterDiscount').val(); - var BasicVal = $('#txtEditRevenueBasicValue').val() == '' ? '0.00' : $('#txtEditRevenueBasicValue').val(); + var Freight = $('#txtEditAfterFreight').val() == '' ? '0.00' : $('#txtEditAfterFreight').val(); + var Insurance = $('#txtEditInsurance').val() == '' ? '0.00' : $('#txtEditInsurance').val(); + var Discount = $('#txtEditAfterDiscount').val() == '' ? '0.00' : $('#txtEditAfterDiscount').val(); + var BasicVal = $('#txtEditRevenueBasicValue').val() == '' ? '0.00' : $('#txtEditRevenueBasicValue').val(); - var totvalue = ( parseFloat(BasicVal) + parseFloat(Packaging) + parseFloat(Cgst) + parseFloat(Sgst)+ parseFloat(Igst) + parseFloat(Freight) + parseFloat(Insurance)) - parseFloat(Discount); - - var tot = parseFloat(totvalue).toFixed(2); - - $('#txtEditRevenueTotalOrderValue').val(tot); - // validateEditExceedLimit(); + var totvalue = ( parseFloat(BasicVal) + parseFloat(Packaging) + parseFloat(Cgst) + parseFloat(Sgst)+ parseFloat(Igst) + parseFloat(Freight) + parseFloat(Insurance)) - parseFloat(Discount); + + var tot = parseFloat(totvalue).toFixed(2); + + $('#txtEditRevenueTotalOrderValue').val(tot); + // validateEditExceedLimit(); } // calculate vat rate function calculateEditVatValue() { - var basicValue = parseFloat($('#txtEditRevenueBasicValue').val()); - - var discountValue = parseFloat($('#txtEditAfterDiscount').val()); - var packageValue = parseFloat($('#txtEditAfterPackaging').val()); - - - var ExciseDuty = parseFloat($('#txtEditAfterExciseDuty').val()); - vatValue = parseFloat($('#txtEditVat').val()); - AfterVat = ; - var Vatval = parseFloat(AfterVat).toFixed(2); - - $('#txtEditAfterVat').val(Vatval); - - + var basicValue = parseFloat($('#txtEditRevenueBasicValue').val()); + + var discountValue = parseFloat($('#txtEditAfterDiscount').val()); + var packageValue = parseFloat($('#txtEditAfterPackaging').val()); + + + var ExciseDuty = parseFloat($('#txtEditAfterExciseDuty').val()); + vatValue = parseFloat($('#txtEditVat').val()); + AfterVat = ; + var Vatval = parseFloat(AfterVat).toFixed(2); + + $('#txtEditAfterVat').val(Vatval); + + } // To Reset the Tax calculation function resetTaxField() @@ -2202,19 +2202,19 @@ Editchange(); $('#txtTotalOrderValue').val(''); ExciseCalculation = ''; PackagingCalculation = ''; - freightCalculation=''; + freightCalculation=''; VatCalculation = ''; CSTCalculation = ''; } - function showsubmit() - { - - $('#submitmodel').modal('show'); + function showsubmit() + { + + $('#submitmodel').modal('show'); - - } + + } function showmodel() { @@ -2234,12 +2234,12 @@ Editchange(); else if(avaBud==''){ alert ("Select Cost Center Name"); } - else if($('#drpSupplier').val() == "0") - { - alert('Please Select the Supplier details'); - $('#drpSupplier').focus(); - return false; - } + else if($('#drpSupplier').val() == "0") + { + alert('Please Select the Supplier details'); + $('#drpSupplier').focus(); + return false; + } else if($('#PoTypeOptions').val()== "0") { @@ -2259,16 +2259,16 @@ Editchange(); - else if(input=='REVENUE' && $('#Deliverydate').val()=='' && radioValue==0){ - alert('Please Select the Delivery Date'); - $('#Deliverydate').focus(); - return false; - } - else if(input=='REVENUE' && $('#Scheduleby').val().trim()=='' && radioValue==1){ - alert('Please Enter the Schedule By'); - $('#Scheduleby').focus(); - return false; - } + else if(input=='REVENUE' && $('#Deliverydate').val()=='' && radioValue==0){ + alert('Please Select the Delivery Date'); + $('#Deliverydate').focus(); + return false; + } + else if(input=='REVENUE' && $('#Scheduleby').val().trim()=='' && radioValue==1){ + alert('Please Enter the Schedule By'); + $('#Scheduleby').focus(); + return false; + } else { $("#" + input ).modal('show'); @@ -2297,14 +2297,14 @@ Editchange(); } } $(document).ready(function(){ - - $("#PaymentMethod").select2(); - + + $("#PaymentMethod").select2(); + //Initialize Select2 Elements $("#purpose").select2(); $("#DepartmentName").select2(); $("#CostCenterName").select2(); - + $("#EditMaterialCode").select2(); $("#EditRevenueMaterialCode").select2(); $("#MaterialCode").select2(); @@ -2321,109 +2321,109 @@ Editchange(); function DeleteRevenueRow(rowid) { - var DelRows = $('#txtDeletedRow1').val(); - - //alertMaterialListrowid); - - var answer = confirm(" Do you want to delete the Item from the List?") - if (answer) - { - var td = document.getElementById(rowid); - td.parentNode.removeChild(td); - var materialCode = $('#materialCode'+rowid).val(); - var removeItem = $('#materialCode'+rowid).val(); - - + var DelRows = $('#txtDeletedRow1').val(); + + //alertMaterialListrowid); + + var answer = confirm(" Do you want to delete the Item from the List?") + if (answer) + { + var td = document.getElementById(rowid); + td.parentNode.removeChild(td); + var materialCode = $('#materialCode'+rowid).val(); + var removeItem = $('#materialCode'+rowid).val(); + + //This function is used to add material list after delete $.each(JSON.parse(materialData), function (index, value) { - if (value.MaterialCode==materialCode) { - $("#MaterialCode").append( $('').val(value.MaterialCode).html(value.MaterialCode + "-" + value.MaterialName) ); - } - }); + if (value.MaterialCode==materialCode) { + $("#MaterialCode").append( $('').val(value.MaterialCode).html(value.MaterialCode + "-" + value.MaterialName) ); + } + }); SelectedMaterialCode.splice( SelectedMaterialCode.indexOf('removeItem'), 1 ); - - - if(DelRows != '') - { - DelRows = DelRows + ":" + rowid; - } - else - { - DelRows= "0" + ":" + rowid; - } - - $('#txtDeletedRow1').val(DelRows); - populateValueMainFormForDeleteItem(rowid); - - } - + + + if(DelRows != '') + { + DelRows = DelRows + ":" + rowid; + } + else + { + DelRows= "0" + ":" + rowid; + } + + $('#txtDeletedRow1').val(DelRows); + populateValueMainFormForDeleteItem(rowid); + + } + } function populateValueMainFormForDeleteItem(rowid) { - - + + // alert(rows); - var totBasicAmt = $('#txtTotBasicAmountRevenue').val(); - var totDiscountAmt = $('#txtTotalDiscount').val(); - var totPackagingAmt = $('#txtTotalPackaing').val(); - - var totCgst = $('#txtTotalCGST').val(); - var totSgst = $('#txtTotalSGST').val(); - var totIgst = $('#txtTotalIGST').val(); - - var totFreightAmt = $('#txtTotalFreight').val(); - var totInsuranceAmt = $('#txtTotalInsurance').val(); - var totOrderSummaryAmt = $('#txtTotalOrderValueSummary').val(); - - - var Packaging = $('#AfterPackVal'+rowid).val() == '' ? '0.00' : $('#AfterPackVal'+rowid).val(); - - var Cgst = $('#RevenueAfterCgst'+rowid).val() == '' ? '0.00' : $('#RevenueAfterCgst'+rowid).val(); - var Sgst =$('#RevenueAfterSgst'+rowid).val() == '' ? '0.00' : $('#RevenueAfterSgst'+rowid).val(); - var Igst = $('#RevenueAfterIgst'+rowid).val() == '' ? '0.00' : $('#RevenueAfterIgst'+rowid).val(); - - var Freight = $('#AfterFreightVal'+rowid).val() == '' ? '0.00' : $('#AfterFreightVal'+rowid).val(); - var Insurance = $('#Insval'+rowid).val() == '' ? '0.00' : $('#Insval'+rowid).val(); - var Discount =$('#AfterDisVal'+rowid).val() == '' ? '0.00' : $('#AfterDisVal'+rowid).val(); - var BasicVal = $('#basicval'+rowid).val() == '' ? '0.00' : $('#basicval'+rowid).val(); - var TotalVal =$('#TotalOrderValue'+rowid).val() == '' ? '0.00' : $('#TotalOrderValue'+rowid).val(); - //alert(TotalVal); - - - totBasicAmt = parseFloat(totBasicAmt ) - parseFloat(BasicVal); - totDiscountAmt = parseFloat(totDiscountAmt ) - parseFloat(Discount); - totPackagingAmt = parseFloat(totPackagingAmt) - parseFloat(Packaging); - - totCgst = parseFloat(totCgst ) - parseFloat(Cgst); - totSgst = parseFloat(totSgst ) - parseFloat(Sgst); - totIgst = parseFloat(totIgst ) - parseFloat(Igst); - - totFreightAmt = parseFloat(totFreightAmt ) - parseFloat(Freight); - totInsuranceAmt = parseFloat(totInsuranceAmt ) - parseFloat(Insurance); - totOrderSummaryAmt = parseFloat(totOrderSummaryAmt ) - parseFloat(TotalVal); - - - + var totBasicAmt = $('#txtTotBasicAmountRevenue').val(); + var totDiscountAmt = $('#txtTotalDiscount').val(); + var totPackagingAmt = $('#txtTotalPackaing').val(); + + var totCgst = $('#txtTotalCGST').val(); + var totSgst = $('#txtTotalSGST').val(); + var totIgst = $('#txtTotalIGST').val(); + + var totFreightAmt = $('#txtTotalFreight').val(); + var totInsuranceAmt = $('#txtTotalInsurance').val(); + var totOrderSummaryAmt = $('#txtTotalOrderValueSummary').val(); + + + var Packaging = $('#AfterPackVal'+rowid).val() == '' ? '0.00' : $('#AfterPackVal'+rowid).val(); + + var Cgst = $('#RevenueAfterCgst'+rowid).val() == '' ? '0.00' : $('#RevenueAfterCgst'+rowid).val(); + var Sgst =$('#RevenueAfterSgst'+rowid).val() == '' ? '0.00' : $('#RevenueAfterSgst'+rowid).val(); + var Igst = $('#RevenueAfterIgst'+rowid).val() == '' ? '0.00' : $('#RevenueAfterIgst'+rowid).val(); + + var Freight = $('#AfterFreightVal'+rowid).val() == '' ? '0.00' : $('#AfterFreightVal'+rowid).val(); + var Insurance = $('#Insval'+rowid).val() == '' ? '0.00' : $('#Insval'+rowid).val(); + var Discount =$('#AfterDisVal'+rowid).val() == '' ? '0.00' : $('#AfterDisVal'+rowid).val(); + var BasicVal = $('#basicval'+rowid).val() == '' ? '0.00' : $('#basicval'+rowid).val(); + var TotalVal =$('#TotalOrderValue'+rowid).val() == '' ? '0.00' : $('#TotalOrderValue'+rowid).val(); + //alert(TotalVal); + + + totBasicAmt = parseFloat(totBasicAmt ) - parseFloat(BasicVal); + totDiscountAmt = parseFloat(totDiscountAmt ) - parseFloat(Discount); + totPackagingAmt = parseFloat(totPackagingAmt) - parseFloat(Packaging); + + totCgst = parseFloat(totCgst ) - parseFloat(Cgst); + totSgst = parseFloat(totSgst ) - parseFloat(Sgst); + totIgst = parseFloat(totIgst ) - parseFloat(Igst); + + totFreightAmt = parseFloat(totFreightAmt ) - parseFloat(Freight); + totInsuranceAmt = parseFloat(totInsuranceAmt ) - parseFloat(Insurance); + totOrderSummaryAmt = parseFloat(totOrderSummaryAmt ) - parseFloat(TotalVal); + + + - $('#txtTotBasicAmountRevenue').val(parseFloat(totBasicAmt).toFixed(2) ); - $('#txtTotalDiscount').val(parseFloat(totDiscountAmt).toFixed(2) ); - $('#txtTotalPackaing').val(parseFloat(totPackagingAmt).toFixed(2) ); - - $('#txtTotalCGST').val(parseFloat(totCgst).toFixed(2) ); - $('#txtTotalSGST').val(parseFloat(totSgst).toFixed(2) ); - $('#txtTotalIGST').val(parseFloat(totIgst).toFixed(2) ); - - $('#txtTotalFreight').val(parseFloat(totFreightAmt).toFixed(2) ); - $('#txtTotalInsurance').val(parseFloat(totInsuranceAmt).toFixed(2) ); - $('#txtTotalOrderValueSummary').val(parseFloat(totOrderSummaryAmt).toFixed(2) ); - + $('#txtTotBasicAmountRevenue').val(parseFloat(totBasicAmt).toFixed(2) ); + $('#txtTotalDiscount').val(parseFloat(totDiscountAmt).toFixed(2) ); + $('#txtTotalPackaing').val(parseFloat(totPackagingAmt).toFixed(2) ); + + $('#txtTotalCGST').val(parseFloat(totCgst).toFixed(2) ); + $('#txtTotalSGST').val(parseFloat(totSgst).toFixed(2) ); + $('#txtTotalIGST').val(parseFloat(totIgst).toFixed(2) ); + + $('#txtTotalFreight').val(parseFloat(totFreightAmt).toFixed(2) ); + $('#txtTotalInsurance').val(parseFloat(totInsuranceAmt).toFixed(2) ); + $('#txtTotalOrderValueSummary').val(parseFloat(totOrderSummaryAmt).toFixed(2) ); + } @@ -2434,7 +2434,7 @@ function populateValueMainFormForDeleteItem(rowid) echo form_open($this->config->base_url().'/purchaseorder/addalterPO/',$attributes); ?>
-
+

Siddharth Industries - Emergency Purchase Order

@@ -2466,7 +2466,7 @@ function populateValueMainFormForDeleteItem(rowid)
- +
'PODate','value' => set_value('PODate',$CurrentDate),'id'=>'PODate', 'class' => 'form-control num' ,'required' => 'true'); @@ -2486,7 +2486,7 @@ function populateValueMainFormForDeleteItem(rowid)
- -
+
@@ -2569,18 +2569,18 @@ function populateValueMainFormForDeleteItem(rowid)
- +
-
+
@@ -3207,7 +3207,7 @@ function populateValueMainFormForDeleteItem(rowid) - -
-
+
+
-
- -
- - + +
+ + 'EditFrequencyChange','value' => set_value('EditFrequencyChange'),'id'=>'EditFrequencyChange', 'class' => 'form-control','readonly' => 'true'); echo form_input($data); ?> -
-
- -
+
+
+ +
- + ?> + + + + -->
- +
@@ -3524,91 +3524,91 @@ function populateValueMainFormForDeleteItem(rowid)
-
- - CGST In % -
- -
-
- - 'EditCgst','value' => set_value('EditCgst',0),'id'=>'EditCgst', 'class' => 'form-control num' ,'placeholder' => 'CGST TAX PERCENTAGE','onchange'=>'EditRatechange();ChangeEditSgst();','onkeypress'=>'return isNumberKey(event);'); - echo form_input($data); - ?> -
- -
-
-
- - 'EditAfterCgst','value' => set_value('EditAfterCgst',0),'id'=>'EditAfterCgst', 'class' => 'form-control num' ,'placeholder' => 'After CGST','readonly' => 'true'); - echo form_input($data); - ?> -
- -
- -
-
-
- - SGST In % -
- -
-
- - 'EditSgst','value' => set_value('EditSgst',0),'id'=>'EditSgst', 'class' => 'form-control num' ,'placeholder' => 'SGST TAX PERCENTAGE','onchange'=>'EditRatechange()','onkeypress'=>'return isNumberKey(event);'); - echo form_input($data); - ?> -
- -
-
-
- - 'EditAfterSgst','value' => set_value('EditAfterSgst',0),'id'=>'EditAfterSgst', 'class' => 'form-control num' ,'placeholder' => 'After SGST','readonly' => 'true'); - echo form_input($data); - ?> -
- -
- -
-
-
- - IGST In % -
- -
-
- - 'EditIgst','value' => set_value('EditIgst',0),'id'=>'EditIgst', 'class' => 'form-control num' ,'placeholder' => 'IGST TAX PERCENTAGE','onchange'=>'EditRatechange()','onkeypress'=>'return isNumberKey(event);'); - echo form_input($data); - ?> -
- -
-
-
- - 'EditAfterIgst','value' => set_value('EditAfterIgst',0),'id'=>'EditAfterIgst', 'class' => 'form-control num' ,'placeholder' => 'After IGST','readonly' => 'true'); - echo form_input($data); - ?> +
+ + CGST In % +
+ +
+
+ + 'EditCgst','value' => set_value('EditCgst',0),'id'=>'EditCgst', 'class' => 'form-control num' ,'placeholder' => 'CGST TAX PERCENTAGE','onchange'=>'EditRatechange();ChangeEditSgst();','onkeypress'=>'return isNumberKey(event);'); + echo form_input($data); + ?> +
+ +
+
+
+ + 'EditAfterCgst','value' => set_value('EditAfterCgst',0),'id'=>'EditAfterCgst', 'class' => 'form-control num' ,'placeholder' => 'After CGST','readonly' => 'true'); + echo form_input($data); + ?> +
+ +
+ +
+
+
+ + SGST In % +
+ +
+
+ + 'EditSgst','value' => set_value('EditSgst',0),'id'=>'EditSgst', 'class' => 'form-control num' ,'placeholder' => 'SGST TAX PERCENTAGE','onchange'=>'EditRatechange()','onkeypress'=>'return isNumberKey(event);'); + echo form_input($data); + ?> +
+ +
+
+
+ + 'EditAfterSgst','value' => set_value('EditAfterSgst',0),'id'=>'EditAfterSgst', 'class' => 'form-control num' ,'placeholder' => 'After SGST','readonly' => 'true'); + echo form_input($data); + ?> +
+ +
+ +
+
+
+ + IGST In % +
+ +
+
+ + 'EditIgst','value' => set_value('EditIgst',0),'id'=>'EditIgst', 'class' => 'form-control num' ,'placeholder' => 'IGST TAX PERCENTAGE','onchange'=>'EditRatechange()','onkeypress'=>'return isNumberKey(event);'); + echo form_input($data); + ?> +
+ +
+
+
+ + 'EditAfterIgst','value' => set_value('EditAfterIgst',0),'id'=>'EditAfterIgst', 'class' => 'form-control num' ,'placeholder' => 'After IGST','readonly' => 'true'); + echo form_input($data); + ?> -
- -
- -
-
+
+ +
+ +
+
@@ -3639,15 +3639,15 @@ function populateValueMainFormForDeleteItem(rowid) $data = array('name' => 'EdittxtSpcialInstructionSingle','value' => set_value('EdittxtSpcialInstructionSingle'),'id'=>'EdittxtSpcialInstructionSingle', 'class' => 'form-control' ,'rows' => '3', 'cols' => '40'); echo form_textarea($data); ?>
- +
@@ -3655,168 +3655,168 @@ function populateValueMainFormForDeleteItem(rowid) - -
diff --git a/application/views/editCapitalPo.php b/application/views/editCapitalPo.php index 748af9bf..2768ca3f 100755 --- a/application/views/editCapitalPo.php +++ b/application/views/editCapitalPo.php @@ -3836,7 +3836,13 @@ $("#PaymentMethod").select2(); - logDate)?"-":date('d-m-Y',strtotime($oldpo->logDate)); ?> + logDate !='-'){ + $logdate = date('d-m-Y',strtotime($oldpo->logDate)); + }else{ + $logdate = '-'; + }?> + + Lqty;?> logRate?> LSuppid?> diff --git a/application/views/editRevenuepurchaseorder.php b/application/views/editRevenuepurchaseorder.php index 1e90f573..c58577f4 100755 --- a/application/views/editRevenuepurchaseorder.php +++ b/application/views/editRevenuepurchaseorder.php @@ -4205,6 +4205,7 @@ function calculateEditTaxValue() +
@@ -4236,9 +4237,14 @@ function calculateEditTaxValue() - - + logDate !='-'){ + $logdate = date('d-m-Y',strtotime($oldpo->logDate)); + }else{ + $logdate = '-'; + }?> + + diff --git a/application/views/editimportpo.php b/application/views/editimportpo.php index dcf9430c..c1e13e52 100755 --- a/application/views/editimportpo.php +++ b/application/views/editimportpo.php @@ -3104,7 +3104,13 @@ echo form_textarea($data); - + logDate !='-'){ + $logdate = date('d-m-Y',strtotime($oldpo->logDate)); + }else{ + $logdate = '-'; + }?> + +
logDate)?"-":date('d-m-Y',strtotime($oldpo->logDate)); ?> Lqty;?> logRate?> LSuppid?>logDate)?"-":date('d-m-Y',strtotime($oldpo->logDate)); ?> Lqty;?> logRate?> LSuppid?>