• Nishant Shrivastava 30
  • NEWBIE
  • 25 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 16
    Replies
Hi, Please check, there is a wireMethod which returned the value from apex
@wire(fetchRecord, {searchKey:'$searchKey', selectedLabel:'$selectedLabel'})recorddetails;

There is an Id value in recorddetails. I need to pass this value of Id in another variable for another invocation.
Could you please mention, how can i retrieve the value of recorddetails.Id

I shall be grateful to you for your kind cooperation.

Thanks and regards
@wire(fetchRecord, {searchKey:'$searchKey', selectedLabel:'$selectedLabel'})recorddetails;

 
Please check the screenshot as well. while searching for record it shows record available as string not as record. I want to retrieve it as standard record and want it to be clickable. You are kindly requested to assist me thereto. 

HTML Code
 
</lightning-card>
<lightning-card title="Record Details" icon-name="custom:custom63">
    <div class="slds-m-around_medium">
        <lightning-input type="search" onchange={handleKeyChange} class="slds-m-bottom_small" label="Search" value={searchKey}></lightning-input>
        <template if:true={recorddetails.data}>
            <template for:each={recorddetails.data} for:item="datas">
                <p key={datas.Id}>{datas.Name}</p>
            </template>
        </template>
    </div>
</lightning-card>


Javascript Code :

 

import { LightningElement, api, wire, track } from 'lwc'; 
import methodName from '@salesforce/apex/MoveAttachment.methodName';
import fetchRecord from '@salesforce/apex/MoveAttachment.fetchRecord';

handleChange(event) {
        this.selectedLabel = event.detail.value;
    }
    //@wire(fetchRecord, {CustomWrapper:'$parameterObject'})recorddetails;
    
    @wire(fetchRecord, {searchKey:'$searchKey', selectedLabel:'$selectedLabel'})recorddetails;
    @wire(fetchRecord)
    wiredRecordDetails({errors, datas}){
        if(datas){
            if(datas.length>0){
                for(let i=0;i<datas.length;i++)
            {
                this.records.push ({label: datas[i].Name, value: datas[i].Id });
                console.log('check=====>', this.records[i]);
            }
        }
            this.results = this.records;
        } else if (errors){
            this.errors = errors;
            this.results = undefined;
        }
    }
    handleKeyChange(event) {
        // Debouncing this method: Do not update the reactive property as long as this function is
        // being called within a delay of 500ms. This is to avoid a very large number of Apex method calls.
        
        window.clearTimeout(this.delayTimeout);
        const searchKey = event.target.value;//this.template.querySelector('lightning-input').value;
        this.delayTimeout = setTimeout(() => {
            this.searchKey = searchKey;
        }, 
        );
        this.results;
    }
I shall be grateful to you for your kind assistance.

​​​​​​​Thanks and regards

Hi,
I am trying to create a lightening web component combobox but it's not working. Please check the code

Javascript:
import { LightningElement, api, wire, track } from 'lwc';
import methodName from '@salesforce/apex/MoveAttachment.methodName';
export default class attachmentMove extends LightningElement {
    @track record;
    @track result;
    @track error;
    @wire(methodName)sobjectName;
    wiredsobjectName({error, data}){
        if(data){
            if(data.length>0){
            this.arrays.array.forEach(element => {
            this.record.push ({label: record[i].Id, value: record[i].Name });
            console.log('check=====>', this.result);
            });
        }
            this.result = record;
            this.error = undefined;
           
        } else if (error){
            this.error = error;
            this.result = undefined;
        }
    }
    get options() {
        console.log('option--->', this.sobjectName.data);
        return this.sobjectName.data;
    }
    get values(){
        return this.result;
    }
    handleChange(event) {
        this.value = event.detail.value;
    }
}
/*
    */
 

HTML:


<template>
    <lightning-card title="Combo Box_Type Values" icon-name="custom:custom67">
    <template  if:true={sobjectName.data}>
    <lightning-combobox
            name="List of Object"
            label="List of Object"
            value={result}
            placeholder="Select Object"
            options = {options}
            onchange={handleChange} >
        </lightning-combobox>
    <p>Selected value is: {options}</p>
</template>
</lightning-card>
</template>


If use get option then it shows blank value in dropdown, if i use this.result. then it does not work. say this.result is undefined and also this.result. Please help me to fix it.
Thanks and regards
Nishant Shrivastava

Hi Everyone,
I need variable value geturl from the end of flow but I am not getting the variable value from the end of flow. Please suggest.

VF page :

<apex:page standardController="Case" extensions="GetListViewUrl">
    <flow:interview name="MediaServiceListView" interview="{!TeamView}" finishLocation="{!NewListView}">
    </flow:interview>
</apex:page>

Apex Controller :

public class GetListViewUrl {
    Public case objAcc ;
    public Flow.Interview.MediaServiceListView TeamView { get; set; }
    //Constructor for Controller extension
     public GetListViewUrl(ApexPages.StandardController controller){
     }
    
    public PageReference getNewListView(){
        string listId;
        if(TeamView!=null){
            listId = Teamview.getUrl;
            system.debug(listId);
        }
        Pagereference pg = new Pagereference('https://--uat.lightning.force.com/lightning/o/Case/list?filterName=' + listId);
        pg.setRedirect(true);
        return pg;
    }
    
}
Public class  Invoice_details {
        Public List<VoiceWrapper> InvoiceList {get;set;}
        Public kognoz1__Invoice2__c InvoiceInfo { get;set;}
           Public static Date StartDate {get;set;}
        Public static Date EndDate {get;set;}
        Public static string querystr;
        Public integer counter = 0; 
        Public integer list_size=100;
        Static set<Id> ids = New set<Id>();
        
         
                Public Invoice_details() { 
                InvoiceInfo = new kognoz1__Invoice2__c();
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c , kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c ORDER BY kognoz1__Invoice_Date__c  DESC limit: List_size ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                } 
            
                Public void display() {
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
                //string Query = 'SELECT kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__c,(select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE kognoz1__Invoice_Date__c = '+startDate+' AND kognoz1__Invoice_Date__c= '+EndDate+' ';
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
               }
                Public class VoiceWrapper {
                Public kognoz1__Invoice2__c KI {get;set;}
                Public boolean selected {get;set;}
                Public VoiceWrapper (kognoz1__Invoice2__c K) {
                    KI = k;
                    selected = false;
                    system.debug(KI);
                 }
                }
        
        Public Pagereference Previous() { 
         
           counter = counter-list_size;
           display();
           return null;
          }
    
           Public pagereference Next() {
            
           counter = counter + list_size;
           display();
           system.debug( InvoiceList);
           return null;
          }
    
        Public boolean getDisablePrevious() { 
            if (counter<=0) {
           return True;
         }
           else return false;
         }
    
       Public Boolean getDisableNext() {
          if (counter > = InvoiceList.size()-list_size) { 
           return true;
           }
           else return false;
        }
    
    
}

My test class---------------------

@isTest(seeAllData=true)

public class Invoice_detailsTestClass {
        public List<VoiceWrapper> InvoiceList {get;set;}
        public kognoz1__Invoice2__c InvoiceInfo { get;set;}
           public static Date StartDate {get;set;}
        public static Date EndDate {get;set;}
        public boolean selected{get;set;}
        public static integer counter = 0; 
        Public static integer list_size=20;
        Public integer total_size ;
        
                 
    
    
    
         static testMethod void Invoice_details() {
          list<kognoz1__Invoice2__c> InvoiceList = [SELECT id, kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c];
        Account testAcco = TestData.createAccounts(1, 'Publisher', 'Horst')[0];
        insert testAcco;
        
        Opportunity opp = TestData.createOpportunity();
        opp.AccountId = testAcco.Id;
        opp.StageName = 'New';
        insert opp;
        
        
         Test.StartTest();
         ApexPages.currentPage().getParameters().put('id', String.valueOf(TestAcco.Id));
         Invoice_details  testAccPlan = new Invoice_details();
         testAccplan.display();
         testAccplan.Previous();
         testAccplan.Next();
         testAccplan.getDisablePrevious();
         testAccplan.getDisableNext();
         kognoz1__Invoice2__c K = new kognoz1__Invoice2__c();
         Invoice_details.VoiceWrapper TV = new Invoice_details.VoiceWrapper( k);
         Test.StopTest();
        
            
            
}
   
        static testMethod void testdisplay() {
        
        DAte StartDate = Date.newInstance(2016, 12, 9);
        Date endDate = Date.newInstance(2016, 12, 9);
        //list<kognoz1__Invoice2__c> InvoiceList = [SELECT id, kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c  WHERE kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter];        
        Account testAcco = TestData.createAccounts(1, 'Publisher', 'Horst')[0];
        insert testAcco;
        
        Opportunity opp = TestData.createOpportunity();
        opp.AccountId = testAcco.Id;
        opp.StageName = 'New';
        opp.rechnung_per_email__c = 'abv@gmail.com';
        insert opp;
        
        kognoz1__Invoice2__c KI = [SELECT id, kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c  WHERE kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter];        
        KI.kognoz1__Opportunity__c = opp.Id;
        KI.kognoz1__Account__c = testAcco.Id;
        KI.kognoz1__Opportunity__r.rechnung_per_email__c = 'post';
        KI.kognoz1__Invoice_Date__c = StartDate;
        KI.kognoz1__Invoice_Due_Date__c = EndDate;
        insert KI;
        system.debug(KI);
             KI.kognoz1__Invoice_Date__c = StartDate+15;
            update KI;
            
            Test.StartTest();
        user u = [select id from user where username = 'finance@softgarden.de' limit 1]; 
        System.runAs(u) {
            Invoice_details Id = New Invoice_details();
            id.display();
            Invoice_details.VoiceWrapper IV = new Invoice_details.VoiceWrapper(KI);
            }
         Test.StopTest();
                
         
    }



I shall be grateful to you for your kind consideration and input

I shall be grateful to you if you take time and could help me in finding problem. i am not able to get the code coverage for my soql query in test class....

My Apex Class

Public class  Invoice_details {
        Public List<VoiceWrapper> InvoiceList {get;set;}
        Public kognoz1__Invoice2__c InvoiceInfo { get;set;}
           Public static Date StartDate {get;set;}
        Public static Date EndDate {get;set;}
        Public static string querystr;
        Public integer counter = 0; 
        Public integer list_size=100;
        Static set<Id> ids = New set<Id>();
        
         
                Public Invoice_details() { 
                InvoiceInfo = new kognoz1__Invoice2__c();
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c , kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c ORDER BY kognoz1__Invoice_Date__c  DESC limit: List_size ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                } 
            
                Public void display() {
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
               }
                
                Public void emailLists() {
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate AND kognoz1__Opportunity__r.rechnung_per_email__c like '%' ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
               }
    
                Public void emailListsStatus() {
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c  WHERE Downloaded__c=false AND kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate AND kognoz1__Opportunity__r.rechnung_per_email__c like '%' ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
               }
    
                Public void emailListsStatustrue() {
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c  WHERE Downloaded__c=true AND kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate AND kognoz1__Opportunity__r.rechnung_per_email__c like '%' ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
               }

                Public void PostLists() {
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate AND kognoz1__Opportunity__r.rechnung_per_email__c = null ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
               }
    
                Public void PostListsStauts() {
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE Downloaded__c=false AND kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate AND kognoz1__Opportunity__r.rechnung_per_email__c = null ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
               }
   
                Public void PostListsStautstrue() {
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
               InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE Downloaded__c=true AND kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate AND kognoz1__Opportunity__r.rechnung_per_email__c = null ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
               }
                Public void displayDownload(){
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
                    InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE Downloaded__c=false AND kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
                }
    
                Public class VoiceWrapper {
                Public kognoz1__Invoice2__c KI {get;set;}
                Public boolean selected {get;set;}
                Public VoiceWrapper (kognoz1__Invoice2__c K) {
                    KI = k;
                    selected = false;
                    system.debug(KI);
                 }
                }
    
           Public Pagereference Previous() { 
         
           counter = counter-list_size;
           display();
           return null;
          }
    
           Public pagereference Next() {
            
           counter = counter + list_size;
           display();
           system.debug( InvoiceList);
           return null;
          }
     Public boolean getDisablePrevious() { 
            if (counter<=0) {
           return True;
         }
           else return false;
         }
    
       Public Boolean getDisableNext() {
          if (counter > = InvoiceList.size()-list_size) { 
           return true;
           }
           else return false;
        }
    
    
}

test class

@isTest(seeAllData=true)

public class Invoice_detailsTestClass {
        public List<VoiceWrapper> InvoiceList {get;set;}
        public kognoz1__Invoice2__c InvoiceInfo { get;set;}
           public static Date StartDate {get;set;}
        public static Date EndDate {get;set;}
        public boolean selected{get;set;}
        public static integer counter = 0; 
        Public static integer list_size=20;
        Public integer total_size ;
        
                 
    
    
    
         static testMethod void Invoice_details() {
          list<kognoz1__Invoice2__c> InvoiceList = [SELECT id, kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c];
        Account testAcco = TestData.createAccounts(1, 'Publisher', 'Horst')[0];
        insert testAcco;
        
        Opportunity opp = TestData.createOpportunity();
        opp.AccountId = testAcco.Id;
        opp.StageName = 'New';
        insert opp;
        
        
         Test.StartTest();
         ApexPages.currentPage().getParameters().put('id', String.valueOf(TestAcco.Id));
         Invoice_details  testAccPlan = new Invoice_details();
         testAccplan.display();
         testAccplan.Previous();
         testAccplan.Next();
         testAccplan.getDisablePrevious();
         testAccplan.getDisableNext();
         kognoz1__Invoice2__c K = new kognoz1__Invoice2__c();
         Invoice_details.VoiceWrapper TV = new Invoice_details.VoiceWrapper( k);
         Test.StopTest();
        
            
            
}
   
        static testMethod void testdisplay() {
        
        DAte StartDate = Date.newInstance(2016, 12, 9);
        Date endDate = Date.newInstance(2016, 12, 9);
        list<kognoz1__Invoice2__c> InvoiceList = [SELECT id, kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c  WHERE kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter];        
        Account testAcco = TestData.createAccounts(1, 'Publisher', 'Horst')[0];
        insert testAcco;
        
        Opportunity opp = TestData.createOpportunity();
        opp.AccountId = testAcco.Id;
        opp.StageName = 'New';
        opp.rechnung_per_email__c = 'abv@gmail.com';
        insert opp;
        
        kognoz1__Invoice2__c KI = new kognoz1__Invoice2__c();
        KI.kognoz1__Opportunity__c = opp.Id;
        KI.kognoz1__Account__c = testAcco.Id;
        KI.kognoz1__Invoice_Date__c = StartDate;
        KI.kognoz1__Invoice_Due_Date__c = EndDate;
        insert KI;
        system.debug(KI);
         
         Test.StartTest();
         ApexPages.currentPage().getParameters().put('id', String.valueOf(TestAcco.Id));
         Invoice_details  AccPlan = new Invoice_details();
         Accplan.display();
         Accplan.Previous();
         Accplan.Next();
         Accplan.getDisablePrevious();
         Accplan.getDisableNext();
         kognoz1__Invoice2__c K = new kognoz1__Invoice2__c();
         Invoice_details.VoiceWrapper TV = new Invoice_details.VoiceWrapper(k);
         Test.StopTest();
         
    }
    
     static testMethod void testdisplayDownload(){
         list<kognoz1__Invoice2__c> InvoiceList = [SELECT id, kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c];
         Account testAcco = TestData.createAccounts(1, 'Publisher', 'Horst')[0];
        insert testAcco;
        
        Opportunity opp = TestData.createOpportunity();
        opp.AccountId = testAcco.Id;
        opp.StageName = 'New';
        insert opp;
         
         kognoz1__Invoice2__c ki = new kognoz1__Invoice2__c();
         KI.kognoz1__Opportunity__c = opp.Id;
         ki.kognoz1__Invoice_Date__c = Date.newInstance(2016, 12, 9);
         
         ki.Downloaded__c=true;
        insert KI;
         Ki.Downloaded__c=false;
        update KI;
        Test.StartTest();
       //  ApexPages.currentPage().getParameters().put('id', String.valueOf(Ki.Id));
               Invoice_details ID = new Invoice_details();
         
         ID.displayDownload();
         kognoz1__Invoice2__c K = new kognoz1__Invoice2__c();
        // Invoice_details.VoiceWrapper TV = new Invoice_details.VoiceWrapper(k);
         Test.StopTest();
    }
    
    static testMethod void testemailLists(){
         list<kognoz1__Invoice2__c> InvoiceList = [SELECT id, kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c];
         Account testAcco = TestData.createAccounts(1, 'Publisher', 'Horst')[0];
        insert testAcco;
        
        Opportunity opp = TestData.createOpportunity();
        opp.AccountId = testAcco.Id;
        opp.StageName = 'New';
        insert opp;
         
         kognoz1__Invoice2__c ki = new kognoz1__Invoice2__c();
         KI.kognoz1__Opportunity__c = opp.Id;
         ki.kognoz1__Invoice_Date__c = Date.newInstance(2016, 12, 9);
         
         ki.Downloaded__c=true;
        insert KI;
        Ki.Downloaded__c=false;
        update KI;
        Test.StartTest();
       //  ApexPages.currentPage().getParameters().put('id', String.valueOf(Ki.Id));
               Invoice_details ID = new Invoice_details();
         kognoz1__Invoice2__c K = new kognoz1__Invoice2__c();
         ID.emailLists();
         Invoice_details.VoiceWrapper TV = new Invoice_details.VoiceWrapper(k);
         Test.StopTest();
    }
    
    static testMethod void testPostLists(){
         list<kognoz1__Invoice2__c> InvoiceList = [SELECT id, kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c];
         Account testAcco = TestData.createAccounts(1, 'Publisher', 'Horst')[0];
        insert testAcco;
        
        Opportunity opp = TestData.createOpportunity();
        opp.AccountId = testAcco.Id;
        opp.StageName = 'New';
        insert opp;
         
         kognoz1__Invoice2__c ki = new kognoz1__Invoice2__c();
         KI.kognoz1__Opportunity__c = opp.Id;
         ki.kognoz1__Invoice_Date__c = Date.newInstance(2016, 12, 9);
         
         ki.Downloaded__c=true;
        insert KI;
        Ki.Downloaded__c=false;
        update KI;
        Test.StartTest();
       //  ApexPages.currentPage().getParameters().put('id', String.valueOf(Ki.Id));
               Invoice_details ID = new Invoice_details();
         
         ID.PostLists();
         Test.StopTest();
    }
    
    
    private class VoiceWrapper{
        Public kognoz1__Invoice2__c KI {get;set;}
        Public boolean selected {get;set;}
        Public VoiceWrapper (kognoz1__Invoice2__c K) {
            KI = k;
            selected = false;
            system.debug(KI);
        }

}
}


for the constructor i got complete coverage but i am not getting soql coverage for the methods. I shall be grateful to you for your kind cooperation. Thanks :)

 

thanks in advance

My class 

Public class  Invoice_details {
        Public List<VoiceWrapper> InvoiceList {get;set;}
        Public kognoz1__Invoice2__c InvoiceInfo { get;set;}
           Public static Date StartDate {get;set;}
        Public static Date EndDate {get;set;}
        Public static string querystr;
        Public integer counter = 0; 
        Public integer list_size=100;
        Static set<Id> ids = New set<Id>();
        
         
                Public Invoice_details() { 
                InvoiceInfo = new kognoz1__Invoice2__c();
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c , kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c ORDER BY kognoz1__Invoice_Date__c  DESC limit: List_size ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                } 
            
                Public void display() {
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
                //string Query = 'SELECT kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__c,(select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE kognoz1__Invoice_Date__c = '+startDate+' AND kognoz1__Invoice_Date__c= '+EndDate+' ';
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
               }
                
   
    
                Public void emailLists() {
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
                //string Query = 'SELECT kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__c,(select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE kognoz1__Invoice_Date__c = '+startDate+' AND kognoz1__Invoice_Date__c= '+EndDate+' ';
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate AND kognoz1__Opportunity__r.rechnung_per_email__c like '%' ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
               }

                Public void PostLists() {
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
                //string Query = 'SELECT kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__c,(select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE kognoz1__Invoice_Date__c = '+startDate+' AND kognoz1__Invoice_Date__c= '+EndDate+' ';
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate AND kognoz1__Opportunity__r.rechnung_per_email__c = null ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
               }
    
   
    
                Public void displayDownload(){
                InvoiceList.clear();
                /*
                 * InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c where Downloaded__c =true AND kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate ORDER BY kognoz1__Invoice_Date__c  DESC limit: List_size ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }  
                */
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
                //string Query = 'SELECT kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__c,(select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE kognoz1__Invoice_Date__c = '+startDate+' AND kognoz1__Invoice_Date__c= '+EndDate+' ';
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE Downloaded__c=false AND kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
                }
    
                Public class VoiceWrapper {
                Public kognoz1__Invoice2__c KI {get;set;}
                Public boolean selected {get;set;}
                Public VoiceWrapper (kognoz1__Invoice2__c K) {
                    KI = k;
                    selected = false;
                    system.debug(KI);
                 }
                }
        
        
    
    
           Public Pagereference Previous() { 
         
           counter = counter-list_size;
           display();
           return null;
          }
    
           Public pagereference Next() {
            
           counter = counter + list_size;
           display();
           system.debug( InvoiceList);
           return null;
          }
    
        
    
     
    
    
       Public boolean getDisablePrevious() { 
            if (counter<=0) {
           return True;
         }
           else return false;
         }
    
       Public Boolean getDisableNext() {
          if (counter > = InvoiceList.size()-list_size) { 
           return true;
           }
           else return false;
        }
    
    
}




my test class


 
here is my code, kindly provide input, i am taking invoice id from checkbox and comparing it in my query and trying to update the field downloaded__c = true but it is not working. any help will be appreciable and thanks in advance


 function updateRecords() {
             const checkboxes = document.querySelectorAll('input[type=checkbox].invoiceCheckBox:checked');
             var recordsData = []; 
       
             for (let i = 0, l = checkboxes.length; i < l; i++) {
                recordsData.push({id: checkboxes[i].dataset.id,}); 
                 console.log("nnnnn",recordsData);
                 let query = `SELECT id, Downloaded__c FROM kognoz1__Invoice2__c where id='${recordsData[i].id}'`;
                 let result = sforce.connection.query(query);
                 result.Downloaded__c = true;
                 var result1 = sforce.connection.update([result]);
                 }
                                     
}


i shall be grateful to you for your kind consideration.
<apex:page sidebar="false" Controller="Invoice_details" showHeader="False" docType="html-5.0" readOnly="true">
<apex:includeScript value="/soap/ajax/47.0/connection.js"/>
<apex:includeScript value="/soap/ajax/47.0/apex.js"/>
<apex:includeScript value="{!$Resource.jszip}"/>
<apex:includeScript value="{!$Resource.FileSaver2}"/>

<html xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink">
<head>
  <apex:slds />
  <style>
    
    
    .displayBlock {
      display: block;
    }
    
    .placeHolder {
      
      margin-left: 50px;
      margin-top:  50px;
      Width:       50rem;
      
    }
    
    .Showall {
      font-style: bold;
      
      margin-top: 120px;
      width:      100%;
      
    }
    
    .space {
      font-style:  italic;
      font-size:   25px;
      margin-left: 50px;
      margin-top:  20px;
    }
    
    .slds-form-element__label slds-m-bottom_none {
      font-size: 2rem;
    }
    
    .nishant {
      font .
      size: 1rem;
    }
    
    input.date {
      cursor:     pointer;
      font-size:  18px;
      margin:     12px;
      padding:    4px;
      width:      auto;
      text-align: center;
    }
  </style>
</head>
<body>
  <apex:form title="form" styleClass="Showall" forceSSL="true" id="A">
  <div class="slds-form-element">
    <div class="slds-p-left_xx-large">
      <label class="slds-checkbox_toggle slds-grid">
        <span class="slds-form-element__label slds-m-bottom_none" style="font-size:.90rem"> Show All </span>
        <input type="checkbox" name="checkbox-toggle-15" value="checkbox-toggle-15" aria-describedby="checkbox-toggle-15" onclick="getdata()" checked=""/>
        <span id="checkbox-toggle-15" class="slds-checkbox_faux_container" aria-live="assertive" style="margin-left:15px">
          <span class="slds-checkbox_faux"></span>
          <span class="slds-checkbox_on">Enabled</span>
          <span class="slds-checkbox_off">Disabled</span>
        </span>
      </label>
    </div>
  </div>
  <div class="slds-grid slds-grid_align-space">
    <div class="slds-p-top_xx-large">
      <span>Date From
        <apex:inputfield value="{!InvoiceInfo.kognoz1__Invoice_Date__c}" label="Start Date" id="datefrom"/>
      </span>
    </div>
    <div class="slds-p-top_xx-large">
      <span>Date To 
        <apex:inputfield value="{!InvoiceInfo.kognoz1__Invoice_Due_Date__c}" label="End Date"/>
      </span>
    </div>
    <div class="slds-p-top_xx-large">
      <apex:commandButton value="Search" action="{!display}" reRender="B"/>
    </div>
  </div>
  <div class="slds-p-top_xx-large">
    <apex:pageBlock >
    <apex:pageBlockSection showHeader="false" id="B" columns="1" >
    <apex:pageblocktable value="{!InvoiceList}" var="rs" id="A">
    <apex:column >
    <apex:facet name="header">
    <input type="checkbox" id="selectAllCheckbox" onclick="selectAllCheckboxes(this)"  />
    <!--
    <apex:inputcheckbox>
    <apex:actionSupport event="onclick" onSubmit="return selectAllCheckboxes(this)" />
  </apex:inputcheckbox>
-->
</apex:facet>
<apex:repeat value="{!rs.KI.attachments}" var="C">
<input type="checkbox" value="{!C.Id}" data-date="{!rs.KI.kognoz1__Invoice_Date__c}" data-account="{!rs.KI.kognoz1__Account__c}" data-opportunity="{!rs.KI.kognoz1__Opportunity__c}" data-Status="{!rs.KI.Downloaded__c}" Id="inputId"  class="invoiceCheckBox" onClick="unselectSelectAllCheckboxes(this)" />
</apex:repeat>
</apex:column>
<apex:column value="{!rs.KI.kognoz1__Invoice_Date__c}" headerValue="DATE"/>
<apex:column value="{!rs.KI.kognoz1__Account__c}" headerValue="Account"/>
<apex:column value="{!rs.KI.kognoz1__Opportunity__c}" headerValue="Opportunity"/>
<apex:column headerValue="Files">
<apex:repeat value="{!rs.KI.attachments}" var="C">
<apex:outputLink value="https://c.cs101.content.force.com/servlet/servlet.FileDownload?file={!C.Id}&operationContext=S1" target="_blank" rel="nofollow">
{!C.name}
</apex:outputLink>
</apex:repeat>
</apex:column>
        <apex:column value="{!rs.KI.Downloaded__c}" headerValue="Status"/>
</apex:pageblocktable>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:panelGrid columns="5" cellspacing="1" cellpadding="1">
<div class="slds-p-left_xx-large">
  <apex:commandbutton value="Download" onclick="return downloadZip(this)" />
  <apex:commandbutton value="Previous" action="{!previous}" disabled="{!DisablePrevious}" reRender="A,B"/>
  <apex:commandbutton value="Next" action="{!next}" reRender="A,B"/>
</div>
<apex:actionStatus id="status" startText="Loading"/>
</apex:panelGrid>
</div>
</apex:form>
<script>
  
  // select / unselect All
  function selectAllCheckboxes(checkbox) {
    var invoiceCheckBoxes = document.getElementsByClassName('invoiceCheckBox');                  
    for(var i=0; i<invoiceCheckBoxes.length; i++){          
      invoiceCheckBoxes[i].checked = checkbox.checked;
    }
  } 
  
  // unselect selectAll-checkbox
  function unselectSelectAllCheckboxes(checkbox) {
    if(!checkbox.checked) {
      var selectAllCheckBox = document.getElementById('selectAllCheckbox');
      selectAllCheckBox.checked = false;  
    }        
  } 
  
  //Get the attachment ids of all selected checkboxes/records
  function getCheckedRecordsData() {
    const checkboxes = document.querySelectorAll('input[type=checkbox].invoiceCheckBox:checked');
    let recordsData = [];
    for (let i = 0, l = checkboxes.length; i < l; i++) {
      recordsData.push({date: checkboxes[i].dataset.date, account: checkboxes[i].dataset.account, opportunity: checkboxes[i].dataset.opportunity, attachmentId: checkboxes[i].value, Status : checkboxes[i].Downloaded__c,});
    }
    return recordsData;
  }
  
  //Generating and download the zip files with all attachments
  function downloadZip(btnElement) {
    
    //Make btn disabled while generating zip with all attachments
    btnElement.disabled = true;
    
    const zip = new JSZip();
    let promises = [];
    let checkedRecordsData = this.getCheckedRecordsData();
    
    if(!checkedRecordsData.length) {
      btnElement.disabled = false;
      return;
    };
    
    console.log('CHECK DATA', checkedRecordsData);
    
    for (let i = 0, l = checkedRecordsData.length; i < l; i++) {
      
      promises.push(new Promise((resolve, reject) => {
        
        try {
          //Get attachment id and set salesforce sessionId
          const recordData = checkedRecordsData[i];  //Change it to Account Id
          sforce.connection.sessionId = '{!$Api.Session_ID}';
          
          //Call webservice and get the base64 coded attachment data
          const response = sforce.apex.execute("WS_ZipUtil", "getAttachmentById", {sfdcId: recordData.attachmentId});
          const respObj = JSON.parse(response);

          // If an error occures, break
          if (respObj['status'] !== '200') {
            reject(respObj ['error']);
            
            return;
          }

          // If status is 200, mark this record as downloaded
        // markAsDownloaded(recordData.q);
          
          const fileData = respObj['data'];
          
          //Add all attachments to the zip
          for (let j = 0, l2 = fileData.length; j < l2; j++) {
            zip.file(fileData[j]['Name'] + ' - ' + recordData.account + ' - ' + recordData.opportunity, fileData[j]['Body'].toString(), {base64: true});
          }
        
          resolve();
        } catch (e) {
          reject(e);
          return;
        }
      }));
    }
    
    //Wait for all async calls and zip is finally generated and download it
    Promise.all(promises).then(values => {
      zip.generateAsync({type: "blob"}).then(function (content) {
        saveAs(content, "download.zip");
        btnElement.disabled = false;
      });
    });
    
    let checkedRecords = this.getCheckedRecordsData();
    sforce.connection.sessionId = '{!$Api.Session_ID}';
    result = sforce.connection.query("select Downloaded__c from kognoz1__Invoice2__c");
    records = result.getArray("records");
    for (let i = 0, l = checkedRecords.length; i < l; i++){
        records = true;
   }
   }
    
  
</script>
</body>
</html>


last 4 lines of javascript codes, i tried to update the field in backend if downloaded function is called. I am completely out of idea. i shall be grateful to you for any input. Thanks :)
I have two classes and i am quite puzzle to write their test class and not getting any coverage for them

first Apex Class

global class WS_ZipUtil {

  /**
   * Receive Attachments info from Attachment ParentId
   */
  webService static String getAttachmentById( String sfdcId ){

    if( String.isEmpty( sfdcId ) ) return WS_Util.errorJson('Parameter sfdcId is required.');
    
    List<Attachment> attachmentList =  [SELECT Id, Name, Body, ContentType FROM Attachment WHERE Id = :sfdcId];
    if( attachmentList == null || attachmentList.size() == 0 ) return WS_Util.errorJson('Attachment not found.');
    return wrapAttachmentList( attachmentList );
  }

  //Format JSON String from AttachmentList
  private static String wrapAttachmentList( List<Attachment> attachmentList ){

    List<Object> dataList = new List<Object>();
    for( Attachment at : attachmentList ){
      Map<String, String> atMap = new Map<String, String>();
      //atMap.put( 'Id', at.Id );
      atMap.put( 'Name', at.Name );
      atMap.put( 'Body', EncodingUtil.base64Encode( at.Body ) );
      //atMap.put( 'ContentType', at.ContentType );
      dataList.add( atMap );
    }
    return WS_Util.normalJson( dataList );
  }


}


Second Apex Class

public class WS_Util {

  //Normal Status Code
  private static String API_STATUS_NORMAL = '200';
  //Error Status Code
  private static String API_STATUS_ERROR  = '400';

  /**
   * Normal JSON Response
   */
  public static String normalJson( Object respData ) {
    Map<String, Object> response = new Map<String, Object>();
    response.put('status', API_STATUS_NORMAL);
    if( respData != null ) response.put('data', respData);
    return JSON.serialize( response );
  }

  /**
   * Error JSON Response
   */
  public static String errorJson( String message ) {
    Map<String, Object> response = new Map<String, Object>();
    response.put('status', API_STATUS_ERROR);
    if( message != null ) response.put('error', message);
    return JSON.serialize( response );
  }

}
i am trying to do pagination in my records but not happening, i don't what is wrong i am doing. kindly help asap

my visualforce page codes are 

<apex:page sidebar="false" Controller="Invoice_details" showHeader="False" docType="html-5.0" readOnly = "true">
    <html xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink">
  <head> 
      <body>
          
      
      <apex:slds />
      <style>
             .ui-corner-all{
             z-index: 1;
            top: 34px;
            left: 200px;
            display: block;
            width: 403px;
             background-color: lightgray;
             }
             .displayNone { 
        display:none; 
    }
          
    .displayBlock {
        display:block;
    }
    .ui-autocomplete-loading { 
        background: white url(/img/loading32.gif) right center no-repeat;
        background-size:15px 15px; 
    }
    .placeHolder {
        font-style: italic;
          margin-left : 50px;
          margin-top : 20px;
          Width : 50rem;
          
    }
          .Showall {
          font-style: bold;
          
          margin-left : 160px;
          margin-top : 120px;
          
          width : 50rem;
          }
          .space {
          font-style: italic;
          font-size : 25px;
          margin-left : 50px;
          margin-top : 20px;
          }
          .slds-form-element__label slds-m-bottom_none{
          font-size : 2 rem;
          }
          .nishant{
          font.size : 1 rem;
          }
         .formelement{
          <div class="slds-form-element">
  <label class="slds-form-element__label" for="checkbox-id-01">Form Element Label</label>
  <div class="slds-form-element__control">
    <span class="slds-checkbox slds-checkbox_standalone">
      <input type="checkbox" id="checkbox-id-01" name="label" value="option" disabled="" checked="" />
      <span class="slds-checkbox_faux"></span>
    </span>
  </div>
</div>
          }
          
          .Outputpanel{
          margin-bottom : 50px;
          margin-top : 20px;
          margin-left :20px;
          }
          
          
          
         </style>
     <apex:form styleClass="Showall" >
         <div class="slds-form-element" >
           <label class="slds-checkbox_toggle slds-grid" >
         <span class="slds-form-element__label slds-m-bottom_none" style = "font-size:.90rem" > Show All </span>
         <input type="checkbox" name="checkbox-toggle-15" value="checkbox-toggle-15" aria-describedby="checkbox-toggle-15" checked=""  />
         <span id="checkbox-toggle-15" class="slds-checkbox_faux_container" aria-live="assertive" style="margin-left:15px" >
           <span class="slds-checkbox_faux"></span>
           <span class="slds-checkbox_on">Enabled</span>
           <span class="slds-checkbox_off">Disabled</span>
    </span>
  </label>
</div>
      </apex:form>
      <apex:form id="frm" styleClass="placeHolder" >
          <div class="slds-grid slds-grid_align-space">
              <div class="slds-col">
            <span >Date From
          <apex:inputfield value="{!InvoiceInfo.kognoz1__Invoice_Date__c}" id="datefrom"/>
                </span>
              </div>
              <div class="slds-col" >
               <span >Date To 
                <apex:inputfield value="{!InvoiceInfo.kognoz1__Invoice_Date__c}" id="dateto" onSelect="display()" />
            </span>
            </div>
  </div>
       </apex:form>
          <apex:form styleClass="Outputpanel" >
        <apex:pageBlock id="display1" >
          <apex:pageBlockSection showHeader="false"  >
          <apex:pageBlockTable value="{!InvoiceList}" var="rs"  >
              <apex:selectCheckboxes value="{!rs.attachments}">
                  <selectoptions value="{!rs.attachments}"/>
                             </apex:selectCheckboxes>
              <apex:column style="formelement" />
              <apex:column value="{!rs.kognoz1__Invoice_Date__c }" headerValue="DATE"/>
              <apex:column value="{!rs.kognoz1__Account__c}" headerValue="Account"/>
                  <apex:column value="{!rs.kognoz1__Opportunity__c}" headerValue="Opportunity"/>
               
                      </apex:pageBlockTable>
              </apex:pageBlockSection>
                                              
            <apex:panelGrid columns="4" >
            <apex:commandLink action="{!Beginning}" reRender="getinvoicedetails">FIRST</apex:commandLink>
            <apex:commandLink action="{!Next}" reRender="getDisablePrevious" >NEXT</apex:commandLink>
            <apex:commandLink action="{!Previous}" reRender="getDisableNext" >PREVIOUS</apex:commandLink>
            <apex:commandLink action="{!End}" reRender="getTotalPages" >LAST</apex:commandLink>
            </apex:panelGrid>
                
            </apex:pageBlock>
          </apex:form>
          </body>
    </head>
 
    
        <script type="text/javascript">
    function changeValue(radioButton) {
        var chk = document.getElementsByClassName('selection');

        for (var i=0; i<chk.length; i++) {
            if(radioButton.value == chk[i].value) {
                chk[i].checked = true;
            } else {
                chk[i].checked = false;
            }
        }
    }
        </script>
    </html>


Controller class

Public without sharing class  Invoice_details {
    
    public List<kognoz1__Invoice2__c> InvoiceList {get;set;}
    public kognoz1__Invoice2__c InvoiceInfo { get;set;}
        public static String StartDate {get;set;}
    public List<kognoz1__Invoice2__c> getKognozdetails { get;set;}
    public static String EndDate {get;set;}
       public static string querystr;
        private integer counter = 0; 
        private integer list_size=20;
        private integer total_size = 20;
        
    public Invoice_details(){ 
        InvoiceInfo = new kognoz1__Invoice2__c ();
       InvoiceList = [SELECT Id,kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__c FROM kognoz1__Invoice2__c limit 1000];
        //InvoiceList = Database.query(querystr);
        //List<kognoz1__Invoice2__c> KI = [SELECT Id,kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__c FROM kognoz1__Invoice2__c ]; 
        
    }
    
    
    
       /* public PageReference runSearch(){
        InvoiceList.clear();
        if(InvoiceInfo.kognoz1__Invoice_Date__c != null & InvoiceInfo.kognoz1__Invoice_Date__c != null ){
        startDate=String.valueOf(InvoiceInfo.kognoz1__Invoice_Date__c).left(10);
         endDate=String.valueOf(InvoiceInfo.kognoz1__Invoice_Date__c).left(10);
        String querystr='SELECT Id,kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__c FROM kognoz1__Invoice2__c WHERE kognoz1__Invoice_Date__c ='+startDate+' AND kognoz1__Invoice_Date__c='+ endDate;
        InvoiceList = Database.query(querystr);
        }
        return null;
    } */ 
    
           /*public void Invoicedetails () {
        if(InvoiceInfo.kognoz1__Invoice_Date__c != null & InvoiceInfo.kognoz1__Invoice_Date__c != null ){
        String startDate=String.valueOf(InvoiceInfo.kognoz1__Invoice_Date__c).left(10);
        String endDate=String.valueOf(InvoiceInfo.kognoz1__Invoice_Date__c).left(10);
        String querystr='SELECT Id,kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__c FROM kognoz1__Invoice2__c WHERE kognoz1__Invoice_Date__c ='+startDate+' AND kognoz1__Invoice_Date__c='+ endDate;
        InvoiceList = Database.query(querystr); 
        }
        }
*/


        Public List <kognoz1__Invoice2__c> getinvoicedetails()
        {
           /*String querystr='SELECT Id,kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__c FROM kognoz1__Invoice2__c';
            InvoiceList = Database.query(querystr);
            system.debug(InvoiceList); */
            list<kognoz1__Invoice2__c> KON = [select Id,kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__c from kognoz1__Invoice2__c order by kognoz1__Invoice_Date__c limit : list_size offset : total_size ];
            return null;
            
        }
    
          public integer Beginning() { 
          counter = 0;
              List_size = 20;
          
          return null;
       }
    
       public integer Previous() { 
          counter -= list_size;
          
          return null;
       }
    
       public integer Next() { 
          counter += list_size;
          
          return null;
       }
    
     
       public integer End() { 
          counter = total_size - math.mod(total_size, list_size);
          if(counter==total_size){
              counter=counter-list_size;
          }
         
          return null;
       }
    
       public Boolean getDisablePrevious() { 
         if (counter>0) {
          return false;
          } else return true;
       }
    
       public Boolean getDisableNext() {
        if (counter + list_size < total_size){ 
            
            return false;} else return true;
        }
    
       public Integer getTotal_size() {
          return total_size;
       }
    
       public Integer getPageNumber() {
          return counter/list_size + 1;
       }
    
       public Integer getTotalPages() {
               if(total_size==null)
                   total_size=0;
               
            if (math.mod(total_size, list_size) > 0) {
             return total_size/list_size + 1;
            } else {
             return (total_size/list_size);
         }
       }
    }

i know, i click on next button, it does not take me anywhere..i messed up a lot out of frustation but your input will be helpful and valuable for me. Thanks in advance.
<apex:page sidebar="false" controller="Search_Account_Controller" showHeader="false" docType="html-5.0">
  <html xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink">  
    <head>
    <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" />
    <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js" />
    <apex:styleSheet value="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/smoothness/jquery-ui.css" />
        
    <apex:slds />
         <style>
             .ui-corner-all{
             z-index: 1;
            top: 34px;
            left: 0px;
            display: block;
            width: 403px;
             background-color: lightgray;
             }
             .displayNone { 
        display:none; 
    }
    .displayBlock {
        display:block;
    }
    .ui-autocomplete-loading { 
        background: white url(/img/loading32.gif) right center no-repeat;
        background-size:15px 15px; 
    }
    .placeHolder {
        font-style: italic;
    }
         </style> 
    </head>
    <body>    
      <apex:form > 
          <apex:actionFunction name="updateLineItem"  action="{!getLineItemDetails}"  rerender="serviceDetails" >
              <apex:param name="OppId" value="" />
          </apex:actionFunction>
           <apex:actionFunction name="getAccDetails"  action="{!getAccountDetails}"  rerender="accountDetails,opportunityDetails,serviceDetails,accountCheckId" oncomplete="checkAccount()">
              <apex:param name="accId" value="" />
          </apex:actionFunction>
                <div class="slds" id="pageBody">
                     <div class="slds-form-element__control" >
                         <apex:inputText style="margin-left: 20px;height: 34px;width: 30%;background-color: grey;color:white" id="accSearchBox" value="{!searchTerm}" styleClass="placeHolder" >
                             </apex:inputText>
                         <apex:inputHidden id="searchAccId" value="{!searchedRecordId}" >
                          
                         </apex:inputHidden>
                     </div>
                     
                     <apex:outputPanel id="accountDetails">
                         <form >
                             <fieldset style="width: 35%;border: 2px solid black;margin-left:20px;">
                                <legend style="margin-left: 34px;" >Account Details</legend>
                               
                               <div style="margin-left: 12px;padding:5px"> 
                                <div class="slds-text-body--regular" title="Planning Id"><b>Account Id</b></div>
                                 <div class="slds-form-element__control">
                                    <apex:inputText Styleclass="slds-input" style="width: 90%;background-color:white" value="{!accObj.Id}" disabled="true">
                                    </apex:inputText>
                                </div>
                              </div> 
                               
                              <div style="margin-left: 12px;padding:5px">     
                                <label class="slds-text-body--regular" title="Account Name"><b>Account Name</b></label>
                                <div class="slds-form-element__control">
                                    <apex:inputText Styleclass="slds-input" style="width: 90%;background-color:white" value="{!accObj.Name}" disabled="true">
                                    </apex:inputText>
                                </div>
                            </div>
                            
                            <div style="margin-left: 12px;padding:5px">    
                                <label class="slds-text-body--regular" title="Account Type"><b>Account Type</b></label>
                                <div class="slds-form-element__control" >
                                    <apex:inputText Styleclass="slds-input" style="width: 90%;background-color:white" value="{!accObj.Account_Type__c}" disabled="true">
                                    </apex:inputText>
                                </div>
                            </div>    
                            </fieldset> 
                         </form>
                      </apex:outputPanel>
                      
                      <apex:outputPanel id="opportunityDetails">
                          <form >
                             <fieldset style="border: 2px solid black;width: 59.5%;margin-top: -205px;margin-left: 950px;">
                               <legend style="margin-left: 24px;" >Opportunities</legend>
                               <table>
                                <tr><th>Opp. Nr.</th><th>Opportunity Name</th> <th>Opportunity Case</th><th>Stage</th><th>Creation Date</th><th>Close Date</th></tr>
                                <apex:repeat value="{!oppList}" var="oppObj" >
                                <tr><th>{!oppObj.OppNumber__c}</th><th id="{!oppObj.Id}" onclick="updateLineItem(this.id)"><a href="#">{!oppObj.Name}</a></th> <th>{!oppObj.FC_Opportunity_Status__c}</th><th>{!oppObj.StageName}</th>
                                
                                <th>
                                    <apex:outputText value="{0,date,dd'.'MM'.'yyyy}" >  
                                      <apex:param value="{!oppObj.CreatedDate}"/>  
                                    </apex:outputText>  
                                </th>
                                <th>
                                    <apex:outputText value="{0,date,dd'.'MM'.'yyyy}" >  
                                      <apex:param value="{!oppObj.CloseDate}"/>  
                                    </apex:outputText>  
                                </th>
                                </tr>
                                </apex:repeat>
                               </table>
                             </fieldset>
                             
                         </form>
                      </apex:outputPanel>
                    <div style="margin-top: 167px;">  
                      <apex:outputPanel id="serviceDetails">
                          <form style="width: 93%;    margin-top: 210px;">
                             <fieldset style="border: 2px solid black;    margin-left: 20px;">
                               <legend style="margin-left: 24px;" >Services</legend>
                               
                               <table>
                                <tr><th>Service Id</th><th>Service Name</th> <th>Product Id</th><th>Product Name</th><th>Publisher</th></tr>
                                <apex:repeat value="{!serviceList}" var="serObj" >
                                <tr><th>{!serObj.Id}</th><th >{!serObj.Name}</th> <th>{!serObj.Product__c}</th><th>{!serObj.Product__r.Name}</th><th>{!serObj.Publisher__c}</th><th>
                                    <button id="ButtonId" class="slds-button slds-float--right slds-button--icon-border slds-not-selected" Style="background-color:grey;height: 34px;width:100%;color: white; border-radius: 21px;"  name="Text" type="button" onclick="window.location.href='https://{!serObj.externallink__c}' , '_blank'"> publisher </button>
                                </th> </tr>
                                </apex:repeat>
                               </table>
                             </fieldset>
                         </form>
                      </apex:outputPanel>
                    </div>
                </div>
        </apex:form>
        
        <script>
            function updateVal(Id){
               
                updateLineItem(Id);
            }
        </script>
        <apex:outputPanel id="accountCheckId">
            
            <script>
               function checkAccount(){
                   if('{!recTypeCheck}'=='false'){
                       alert('Selected Account is not Customer Account');
                       }
                   }
            </script>
        </apex:outputPanel>
        <script type="text/javascript">
        var PLACEHOLDER = 'Search for Account(Type Customer)'; 
        var movieObjects;
        var queryTerm;
        
        $('[id$=accSearchBox]').autocomplete({
            minLength: 2,
            source: function(request, response) {
                        queryTerm = request.term;
                        Search_Account_Controller.searchAccount(request.term, function(result, event){
                            if(event.type == 'exception') {
                                  alert(event.message);
                            } else {
                                 movieObjects = result;
                                 response(movieObjects);
                            }
                        });
                   },
            focus: function( event, ui ) {
                    $('[id$=accSearchBox]').val( ui.item.Name );
                    return false;
                    },
            select: function( event, ui ) {
                        $('[id$=accSearchBox]').val( ui.item.Name );
                        $('[id$=searchAccId]').val( ui.item.Id );
                        getAccDetails($('[id$=searchAccId]').val());
                        return false;
                    },
         })
         .data( "autocomplete" )._renderItem = function( ul, item ) {
            var entry = "<a>" + item.Name;
           
            entry = entry + "</a>";
            entry = entry.replace(queryTerm, "<b>" + queryTerm + "</b>");
            return $( "<li></li>" )
                .data( "item.autocomplete", item )
                .append( entry )
                .appendTo( ul );
        };
            
        // Add or remove placeholder values
        $('[id$=accSearchBox]').val(PLACEHOLDER);
        $('[id$=accSearchBox]').style="color:white";
        $('[id$=accSearchBox]').on("focus",  function(event){
            $tgt = $(event.target);
            if($tgt.val() === PLACEHOLDER ){
                $tgt.val('');
                $tgt.removeClass('placeHolder');
            }
        });
        $('[id$=accSearchBox]').on( "blur",  function(event){
            $tgt = $(event.target);
            if($tgt.val() === '' ){
                $tgt.val(PLACEHOLDER);
                $tgt.addClass('placeHolder');
            }
        });
    </script>
    </body>
   </html>
vfpage controller


global class Search_Account_Controller {
   public Set<string> accountSet{get;set;}
   public string accName{get;set;}
   public Account accObj{get;set;}
   public List<Opportunity> oppList{get;set;}
   public boolean recTypeCheck{get;set;}
   public List<Service__c> serviceList{get;set;} 
   
    public Search_Account_Controller() {
         recTypeCheck=true;
        accountSet = new Set<String>();
        List<Account> accList = [Select id, Name, Account_Type__c from Account LIMIT 30000];
        if(accList!=null && accList.size()>0){
            for(Account acc :accList){
                accountSet.add(acc.Name);
            }
        }
    }
    
     public void getAccountDetails(){
        oppList = new List<Opportunity>();
        serviceList= new List<Service__c>();
         List<Account> accList= [Select Name, Id, Account_Type__c from Account where Name=:accName LIMIT 1];
         
         if(accList!=null && accList.size()>0)
         accObj=accList[0];
         
        if(accObj.Account_Type__c!='Client')  {
             recTypeCheck=false;
         }
         else{
            oppList=[Select Id, OppNumber__c, FC_Opportunity_Status__c, Name, StageName, CloseDate, CreationDateTime__c from Opportunity where AccountId=:accObj.Id];    
         }
     }
     
     public void getLineItemDetails()  {
         String oppIdval = apexpages.currentpage().getparameters().get('OppId');
         serviceList=[Select Id, Product__c, Produkt_ID__c , Product__r.Name, Name from Service__c where Opportunity__c=:oppIdval];    
         
     }
}
component


<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="SingleRelatedListController">
    <aura:attribute name="sobjectApiName" type="String" required="true" />    
    <aura:attribute name="relatedFieldApiName" type="String" required="true"/>    
    <aura:attribute name="numberOfRecords" type="Integer" default="6"/>    
    <aura:attribute name="sortedBy" type="String" required="true"/>
    <aura:attribute name="sortedDirection" type="String" default="ASC"/>    
    <aura:attribute name="onRowActionHandler" type="Aura.Action"/>    
    <aura:attribute name="customActions" type="List"/>    
    <aura:attribute name="columns" type="List" />
    <aura:attribute name="columnsWithActions" type="List" access="private"/>
    <aura:attribute name="fields" type="String" required="true"/>
    <aura:attribute name="records" type="Object" access="private"/>
    <aura:attribute name="parentRelationshipApiName" type="String" access="private"/>    
    <aura:attribute name="sobjectLabel" type="String" access="private"/>    
    <aura:attribute name="sobjectLabelPlural" type="String" access="private"/>    
    <aura:attribute name="numberOfRecordsForTitle" type="String" access="private"/>    
    <aura:attribute name="iconName" type="String" access="private"/>    

    <aura:handler name="init" value="{!this}" action="{!c.init}"/>
    <aura:handler name="change" value="{!v.columns}" action="{! c.handleColumnsChange }"/>
    <aura:handler event="force:showToast" action="{!c.handleToastEvent}"/>  
    <lightning:overlayLibrary aura:id="overlayLib"/>
    
    <div class="c-container">
        <lightning:card class="slds-card_boundary" iconName="{!v.iconName}">
            <aura:set attribute="actions">
                <lightning:button label="New" onclick="{!c.handleCreateRecord}"/>
            </aura:set>     
            <aura:set attribute="title">
                <b><a class="slds-card__header-link" onclick="{!c.handleGotoRelatedList}">{!(v.sobjectLabelPlural) + ' (' + (v.numberOfRecordsForTitle) + ')'}</a></b>
            </aura:set>             
            <aura:set attribute="footer">
                <aura:if isTrue="{!not(empty(v.records))}">  
                    <a onclick="{!c.handleGotoRelatedList}">View All</a>
                </aura:if>
            </aura:set>                
            <aura:if isTrue="{!not(empty(v.records))}">    
                <p class="slds-p-horizontal_small">                  
                    <lightning:datatable class="related-list"
                                         columns="{! v.columnsWithActions }"
                                         data="{! v.records }"
                                         keyField="id"
                                         onrowaction="{! c.handleRowAction }"
                                         hideCheckboxColumn="false"
                                         resizeColumnDisabled="true"
                                         maxRowSelection="1"
                                         onrowselection="{! c.selectionAction }"/>                     
                </p>               
            </aura:if>
            
        </lightning:card>
    </div>

</aura:component>


controller


({
    init: function (cmp, event, helper) {
        helper.fetchData(cmp, event, helper);
        helper.initColumnsWithActions(cmp, event, helper)
    },
    
    selectionAction: function (cmp, event, helper) 
    {
        var selectedRows = event.getParam('selectedRows'); // fetches the records which are selected by the user
        selectedRows ="1"{}
    },
     

    handleColumnsChange: function (cmp, event, helper) {
        helper.initColumnsWithActions(cmp, event, helper)
    },
    
    handleRowAction: function (cmp, event, helper) {
        var action = event.getParam('action');
        var row = event.getParam('row');
        var onRowActionHandler = cmp.get('v.onRowActionHandler');

        if(onRowActionHandler){
            $A.enqueueAction(onRowActionHandler)                       
        }else{            
            switch (action.name) {
                case 'edit':
                    helper.editRecord(cmp, row)
                    break;
                case 'delete':
                    helper.removeRecord(cmp, row)
                    break;
            }
        }
    },
    
    handleGotoRelatedList : function (cmp, event, helper) {
        var relatedListEvent = $A.get("e.force:navigateToRelatedList");
        relatedListEvent.setParams({
            "relatedListId": cmp.get("v.parentRelationshipApiName"),
            "parentRecordId": cmp.get("v.recordId")
        });
        relatedListEvent.fire();
    },
       
    handleCreateRecord : function (cmp, event, helper) {
        var createRecordEvent = $A.get("e.force:createRecord");
        createRecordEvent.setParams({
            "entityApiName": cmp.get("v.sobjectApiName"),
            "defaultFieldValues": {
                [cmp.get("v.relatedFieldApiName")] : cmp.get("v.recordId")
            }
        });
        createRecordEvent.fire();
    },   
        
    handleToastEvent  : function (cmp, event, helper) {
        var eventType = event.getParam('type');
        var eventMessage= event.getParam('message');
        if(eventType == 'SUCCESS' && eventMessage.includes(cmp.get('v.sobjectLabel'))){
            helper.fetchData(cmp, event, helper)
            event.stopPropagation();            
        }        
    },   
    
})


helper


({
    fetchData: function (cmp, event, helper) {
         var action = cmp.get("c.initData")
         var relatedFieldApiName = cmp.get("v.relatedFieldApiName")
        var numberOfRecords = cmp.get("v.numberOfRecords")
        var jsonData = JSON.stringify({fields:cmp.get("v.fields"),
                                       relatedFieldApiName:cmp.get("v.relatedFieldApiName"),
                                       recordId:cmp.get("v.recordId"),
                                       numberOfRecords:numberOfRecords + 1,
                                       sobjectApiName: cmp.get("v.sobjectApiName"),
                                       sortedBy: cmp.get("v.sortedBy"),
                                       sortedDirection: cmp.get("v.sortedDirection")
        });
        action.setParams({jsonData : jsonData});

        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var jsonData = JSON.parse(response.getReturnValue())
                var records = jsonData.records
                if(records.length > numberOfRecords){
                    records.pop()
                    cmp.set('v.numberOfRecordsForTitle', numberOfRecords + "+")
                }else{
                    cmp.set('v.numberOfRecordsForTitle', Math.min(numberOfRecords,records.length))
                }
                records.forEach(record => {
                  record.LinkName = '/'+record.Id
                  for (const col in record) {
                    const curCol = record[col];
                    if (typeof curCol === 'object') {
                      const newVal = curCol.Id ? ('/' + curCol.Id) : null;
                      helper.flattenStructure(helper,record, col + '_', curCol);
                      if (newVal !== null) {
                        record[col+ '_LinkName'] = newVal;
                      }
                    }
                  }
                });                
                cmp.set('v.records', records)
                cmp.set('v.iconName', jsonData.iconName)
                cmp.set('v.sobjectLabel', jsonData.sobjectLabel)
                cmp.set('v.sobjectLabelPlural', jsonData.sobjectLabelPlural)
                cmp.set('v.parentRelationshipApiName', jsonData.parentRelationshipApiName)
            }else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + errors[0].message);
                    }
                } else {
                    console.log("Unknown error");
                }
            }
        });

        $A.enqueueAction(action);        
    },
    flattenStructure : function (helper,topObject, prefix, toBeFlattened) {
      for (const prop in toBeFlattened) {
        const curVal = toBeFlattened[prop];
        if (typeof curVal === 'object') {
          helper.flattenStructure(helper, topObject, prefix + prop + '_', curVal);
        } else {
          topObject[prefix + prop] = curVal;
        }
      }
    },    
    
   initColumnsWithActions: function (cmp, event, helper) {
        var customActions = cmp.get('v.customActions')
        if( !customActions.length){
            customActions = [
                { label: 'Edit', name: 'edit' },
                { label: 'Delete', name: 'delete' }
            ]         
        }
        
        var columns = cmp.get('v.columns')        
        var columnsWithActions = []
        columnsWithActions.push(...columns)
        columnsWithActions.push({ type: 'action', typeAttributes: { rowActions: customActions } })
        cmp.set('v.columnsWithActions',  columnsWithActions)
    },    
    
    removeRecord: function (cmp, row) {
        var modalBody;
        var modalFooter;
        var sobjectLabel = cmp.get('v.sobjectLabel')
        $A.createComponents([
            ["c:deleteRecordContent",{sobjectLabel:sobjectLabel}],
            ["c:deleteRecordFooter",{record: row, sobjectLabel:sobjectLabel}]
        ],
        function(components, status){
            if (status === "SUCCESS") {
                modalBody = components[0];
                modalFooter = components[1];
                cmp.find('overlayLib').showCustomModal({
                   header: "Delete " + sobjectLabel,
                   body: modalBody, 
                   footer: modalFooter,
                   showCloseButton: true
               })
            }
        }
       );
        
    },
    
    editRecord : function (cmp, row) {
        var createRecordEvent = $A.get("e.force:editRecord");
        createRecordEvent.setParams({
            "recordId": row.Id
        });
        createRecordEvent.fire();
    }, 
})
Hi, Please check, there is a wireMethod which returned the value from apex
@wire(fetchRecord, {searchKey:'$searchKey', selectedLabel:'$selectedLabel'})recorddetails;

There is an Id value in recorddetails. I need to pass this value of Id in another variable for another invocation.
Could you please mention, how can i retrieve the value of recorddetails.Id

I shall be grateful to you for your kind cooperation.

Thanks and regards
@wire(fetchRecord, {searchKey:'$searchKey', selectedLabel:'$selectedLabel'})recorddetails;

 

I shall be grateful to you if you take time and could help me in finding problem. i am not able to get the code coverage for my soql query in test class....

My Apex Class

Public class  Invoice_details {
        Public List<VoiceWrapper> InvoiceList {get;set;}
        Public kognoz1__Invoice2__c InvoiceInfo { get;set;}
           Public static Date StartDate {get;set;}
        Public static Date EndDate {get;set;}
        Public static string querystr;
        Public integer counter = 0; 
        Public integer list_size=100;
        Static set<Id> ids = New set<Id>();
        
         
                Public Invoice_details() { 
                InvoiceInfo = new kognoz1__Invoice2__c();
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c , kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c ORDER BY kognoz1__Invoice_Date__c  DESC limit: List_size ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                } 
            
                Public void display() {
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
               }
                
                Public void emailLists() {
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate AND kognoz1__Opportunity__r.rechnung_per_email__c like '%' ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
               }
    
                Public void emailListsStatus() {
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c  WHERE Downloaded__c=false AND kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate AND kognoz1__Opportunity__r.rechnung_per_email__c like '%' ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
               }
    
                Public void emailListsStatustrue() {
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c  WHERE Downloaded__c=true AND kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate AND kognoz1__Opportunity__r.rechnung_per_email__c like '%' ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
               }

                Public void PostLists() {
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate AND kognoz1__Opportunity__r.rechnung_per_email__c = null ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
               }
    
                Public void PostListsStauts() {
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
                InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE Downloaded__c=false AND kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate AND kognoz1__Opportunity__r.rechnung_per_email__c = null ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
               }
   
                Public void PostListsStautstrue() {
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
               InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE Downloaded__c=true AND kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate AND kognoz1__Opportunity__r.rechnung_per_email__c = null ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
               }
                Public void displayDownload(){
                InvoiceList.clear();
                Date startDate = InvoiceInfo.kognoz1__Invoice_Date__c;
                Date endDate = InvoiceInfo.kognoz1__Invoice_Due_Date__c;
                if(InvoiceInfo.kognoz1__Invoice_Date__c != null ) {
                    InvoiceList = New List<VoiceWrapper>();
                for(kognoz1__Invoice2__c k : [SELECT Id, kognoz1__Invoice_Date__c, kognoz1__Account__c, Downloaded__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c WHERE Downloaded__c=false AND kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter ])
                {
                    InvoiceList.add(new VoiceWrapper(K));
                }
                }
                }
    
                Public class VoiceWrapper {
                Public kognoz1__Invoice2__c KI {get;set;}
                Public boolean selected {get;set;}
                Public VoiceWrapper (kognoz1__Invoice2__c K) {
                    KI = k;
                    selected = false;
                    system.debug(KI);
                 }
                }
    
           Public Pagereference Previous() { 
         
           counter = counter-list_size;
           display();
           return null;
          }
    
           Public pagereference Next() {
            
           counter = counter + list_size;
           display();
           system.debug( InvoiceList);
           return null;
          }
     Public boolean getDisablePrevious() { 
            if (counter<=0) {
           return True;
         }
           else return false;
         }
    
       Public Boolean getDisableNext() {
          if (counter > = InvoiceList.size()-list_size) { 
           return true;
           }
           else return false;
        }
    
    
}

test class

@isTest(seeAllData=true)

public class Invoice_detailsTestClass {
        public List<VoiceWrapper> InvoiceList {get;set;}
        public kognoz1__Invoice2__c InvoiceInfo { get;set;}
           public static Date StartDate {get;set;}
        public static Date EndDate {get;set;}
        public boolean selected{get;set;}
        public static integer counter = 0; 
        Public static integer list_size=20;
        Public integer total_size ;
        
                 
    
    
    
         static testMethod void Invoice_details() {
          list<kognoz1__Invoice2__c> InvoiceList = [SELECT id, kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c];
        Account testAcco = TestData.createAccounts(1, 'Publisher', 'Horst')[0];
        insert testAcco;
        
        Opportunity opp = TestData.createOpportunity();
        opp.AccountId = testAcco.Id;
        opp.StageName = 'New';
        insert opp;
        
        
         Test.StartTest();
         ApexPages.currentPage().getParameters().put('id', String.valueOf(TestAcco.Id));
         Invoice_details  testAccPlan = new Invoice_details();
         testAccplan.display();
         testAccplan.Previous();
         testAccplan.Next();
         testAccplan.getDisablePrevious();
         testAccplan.getDisableNext();
         kognoz1__Invoice2__c K = new kognoz1__Invoice2__c();
         Invoice_details.VoiceWrapper TV = new Invoice_details.VoiceWrapper( k);
         Test.StopTest();
        
            
            
}
   
        static testMethod void testdisplay() {
        
        DAte StartDate = Date.newInstance(2016, 12, 9);
        Date endDate = Date.newInstance(2016, 12, 9);
        list<kognoz1__Invoice2__c> InvoiceList = [SELECT id, kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c  WHERE kognoz1__Invoice_Date__c >=: startDate AND kognoz1__Invoice_Date__c <=: EndDate ORDER BY kognoz1__Invoice_Date__c  DESC  limit: list_size offset: counter];        
        Account testAcco = TestData.createAccounts(1, 'Publisher', 'Horst')[0];
        insert testAcco;
        
        Opportunity opp = TestData.createOpportunity();
        opp.AccountId = testAcco.Id;
        opp.StageName = 'New';
        opp.rechnung_per_email__c = 'abv@gmail.com';
        insert opp;
        
        kognoz1__Invoice2__c KI = new kognoz1__Invoice2__c();
        KI.kognoz1__Opportunity__c = opp.Id;
        KI.kognoz1__Account__c = testAcco.Id;
        KI.kognoz1__Invoice_Date__c = StartDate;
        KI.kognoz1__Invoice_Due_Date__c = EndDate;
        insert KI;
        system.debug(KI);
         
         Test.StartTest();
         ApexPages.currentPage().getParameters().put('id', String.valueOf(TestAcco.Id));
         Invoice_details  AccPlan = new Invoice_details();
         Accplan.display();
         Accplan.Previous();
         Accplan.Next();
         Accplan.getDisablePrevious();
         Accplan.getDisableNext();
         kognoz1__Invoice2__c K = new kognoz1__Invoice2__c();
         Invoice_details.VoiceWrapper TV = new Invoice_details.VoiceWrapper(k);
         Test.StopTest();
         
    }
    
     static testMethod void testdisplayDownload(){
         list<kognoz1__Invoice2__c> InvoiceList = [SELECT id, kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c];
         Account testAcco = TestData.createAccounts(1, 'Publisher', 'Horst')[0];
        insert testAcco;
        
        Opportunity opp = TestData.createOpportunity();
        opp.AccountId = testAcco.Id;
        opp.StageName = 'New';
        insert opp;
         
         kognoz1__Invoice2__c ki = new kognoz1__Invoice2__c();
         KI.kognoz1__Opportunity__c = opp.Id;
         ki.kognoz1__Invoice_Date__c = Date.newInstance(2016, 12, 9);
         
         ki.Downloaded__c=true;
        insert KI;
         Ki.Downloaded__c=false;
        update KI;
        Test.StartTest();
       //  ApexPages.currentPage().getParameters().put('id', String.valueOf(Ki.Id));
               Invoice_details ID = new Invoice_details();
         
         ID.displayDownload();
         kognoz1__Invoice2__c K = new kognoz1__Invoice2__c();
        // Invoice_details.VoiceWrapper TV = new Invoice_details.VoiceWrapper(k);
         Test.StopTest();
    }
    
    static testMethod void testemailLists(){
         list<kognoz1__Invoice2__c> InvoiceList = [SELECT id, kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c];
         Account testAcco = TestData.createAccounts(1, 'Publisher', 'Horst')[0];
        insert testAcco;
        
        Opportunity opp = TestData.createOpportunity();
        opp.AccountId = testAcco.Id;
        opp.StageName = 'New';
        insert opp;
         
         kognoz1__Invoice2__c ki = new kognoz1__Invoice2__c();
         KI.kognoz1__Opportunity__c = opp.Id;
         ki.kognoz1__Invoice_Date__c = Date.newInstance(2016, 12, 9);
         
         ki.Downloaded__c=true;
        insert KI;
        Ki.Downloaded__c=false;
        update KI;
        Test.StartTest();
       //  ApexPages.currentPage().getParameters().put('id', String.valueOf(Ki.Id));
               Invoice_details ID = new Invoice_details();
         kognoz1__Invoice2__c K = new kognoz1__Invoice2__c();
         ID.emailLists();
         Invoice_details.VoiceWrapper TV = new Invoice_details.VoiceWrapper(k);
         Test.StopTest();
    }
    
    static testMethod void testPostLists(){
         list<kognoz1__Invoice2__c> InvoiceList = [SELECT id, kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__r.rechnung_per_email__c, kognoz1__Opportunity__c, (select id, name from Attachments) FROM kognoz1__Invoice2__c];
         Account testAcco = TestData.createAccounts(1, 'Publisher', 'Horst')[0];
        insert testAcco;
        
        Opportunity opp = TestData.createOpportunity();
        opp.AccountId = testAcco.Id;
        opp.StageName = 'New';
        insert opp;
         
         kognoz1__Invoice2__c ki = new kognoz1__Invoice2__c();
         KI.kognoz1__Opportunity__c = opp.Id;
         ki.kognoz1__Invoice_Date__c = Date.newInstance(2016, 12, 9);
         
         ki.Downloaded__c=true;
        insert KI;
        Ki.Downloaded__c=false;
        update KI;
        Test.StartTest();
       //  ApexPages.currentPage().getParameters().put('id', String.valueOf(Ki.Id));
               Invoice_details ID = new Invoice_details();
         
         ID.PostLists();
         Test.StopTest();
    }
    
    
    private class VoiceWrapper{
        Public kognoz1__Invoice2__c KI {get;set;}
        Public boolean selected {get;set;}
        Public VoiceWrapper (kognoz1__Invoice2__c K) {
            KI = k;
            selected = false;
            system.debug(KI);
        }

}
}


for the constructor i got complete coverage but i am not getting soql coverage for the methods. I shall be grateful to you for your kind cooperation. Thanks :)

 

i am trying to do pagination in my records but not happening, i don't what is wrong i am doing. kindly help asap

my visualforce page codes are 

<apex:page sidebar="false" Controller="Invoice_details" showHeader="False" docType="html-5.0" readOnly = "true">
    <html xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink">
  <head> 
      <body>
          
      
      <apex:slds />
      <style>
             .ui-corner-all{
             z-index: 1;
            top: 34px;
            left: 200px;
            display: block;
            width: 403px;
             background-color: lightgray;
             }
             .displayNone { 
        display:none; 
    }
          
    .displayBlock {
        display:block;
    }
    .ui-autocomplete-loading { 
        background: white url(/img/loading32.gif) right center no-repeat;
        background-size:15px 15px; 
    }
    .placeHolder {
        font-style: italic;
          margin-left : 50px;
          margin-top : 20px;
          Width : 50rem;
          
    }
          .Showall {
          font-style: bold;
          
          margin-left : 160px;
          margin-top : 120px;
          
          width : 50rem;
          }
          .space {
          font-style: italic;
          font-size : 25px;
          margin-left : 50px;
          margin-top : 20px;
          }
          .slds-form-element__label slds-m-bottom_none{
          font-size : 2 rem;
          }
          .nishant{
          font.size : 1 rem;
          }
         .formelement{
          <div class="slds-form-element">
  <label class="slds-form-element__label" for="checkbox-id-01">Form Element Label</label>
  <div class="slds-form-element__control">
    <span class="slds-checkbox slds-checkbox_standalone">
      <input type="checkbox" id="checkbox-id-01" name="label" value="option" disabled="" checked="" />
      <span class="slds-checkbox_faux"></span>
    </span>
  </div>
</div>
          }
          
          .Outputpanel{
          margin-bottom : 50px;
          margin-top : 20px;
          margin-left :20px;
          }
          
          
          
         </style>
     <apex:form styleClass="Showall" >
         <div class="slds-form-element" >
           <label class="slds-checkbox_toggle slds-grid" >
         <span class="slds-form-element__label slds-m-bottom_none" style = "font-size:.90rem" > Show All </span>
         <input type="checkbox" name="checkbox-toggle-15" value="checkbox-toggle-15" aria-describedby="checkbox-toggle-15" checked=""  />
         <span id="checkbox-toggle-15" class="slds-checkbox_faux_container" aria-live="assertive" style="margin-left:15px" >
           <span class="slds-checkbox_faux"></span>
           <span class="slds-checkbox_on">Enabled</span>
           <span class="slds-checkbox_off">Disabled</span>
    </span>
  </label>
</div>
      </apex:form>
      <apex:form id="frm" styleClass="placeHolder" >
          <div class="slds-grid slds-grid_align-space">
              <div class="slds-col">
            <span >Date From
          <apex:inputfield value="{!InvoiceInfo.kognoz1__Invoice_Date__c}" id="datefrom"/>
                </span>
              </div>
              <div class="slds-col" >
               <span >Date To 
                <apex:inputfield value="{!InvoiceInfo.kognoz1__Invoice_Date__c}" id="dateto" onSelect="display()" />
            </span>
            </div>
  </div>
       </apex:form>
          <apex:form styleClass="Outputpanel" >
        <apex:pageBlock id="display1" >
          <apex:pageBlockSection showHeader="false"  >
          <apex:pageBlockTable value="{!InvoiceList}" var="rs"  >
              <apex:selectCheckboxes value="{!rs.attachments}">
                  <selectoptions value="{!rs.attachments}"/>
                             </apex:selectCheckboxes>
              <apex:column style="formelement" />
              <apex:column value="{!rs.kognoz1__Invoice_Date__c }" headerValue="DATE"/>
              <apex:column value="{!rs.kognoz1__Account__c}" headerValue="Account"/>
                  <apex:column value="{!rs.kognoz1__Opportunity__c}" headerValue="Opportunity"/>
               
                      </apex:pageBlockTable>
              </apex:pageBlockSection>
                                              
            <apex:panelGrid columns="4" >
            <apex:commandLink action="{!Beginning}" reRender="getinvoicedetails">FIRST</apex:commandLink>
            <apex:commandLink action="{!Next}" reRender="getDisablePrevious" >NEXT</apex:commandLink>
            <apex:commandLink action="{!Previous}" reRender="getDisableNext" >PREVIOUS</apex:commandLink>
            <apex:commandLink action="{!End}" reRender="getTotalPages" >LAST</apex:commandLink>
            </apex:panelGrid>
                
            </apex:pageBlock>
          </apex:form>
          </body>
    </head>
 
    
        <script type="text/javascript">
    function changeValue(radioButton) {
        var chk = document.getElementsByClassName('selection');

        for (var i=0; i<chk.length; i++) {
            if(radioButton.value == chk[i].value) {
                chk[i].checked = true;
            } else {
                chk[i].checked = false;
            }
        }
    }
        </script>
    </html>


Controller class

Public without sharing class  Invoice_details {
    
    public List<kognoz1__Invoice2__c> InvoiceList {get;set;}
    public kognoz1__Invoice2__c InvoiceInfo { get;set;}
        public static String StartDate {get;set;}
    public List<kognoz1__Invoice2__c> getKognozdetails { get;set;}
    public static String EndDate {get;set;}
       public static string querystr;
        private integer counter = 0; 
        private integer list_size=20;
        private integer total_size = 20;
        
    public Invoice_details(){ 
        InvoiceInfo = new kognoz1__Invoice2__c ();
       InvoiceList = [SELECT Id,kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__c FROM kognoz1__Invoice2__c limit 1000];
        //InvoiceList = Database.query(querystr);
        //List<kognoz1__Invoice2__c> KI = [SELECT Id,kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__c FROM kognoz1__Invoice2__c ]; 
        
    }
    
    
    
       /* public PageReference runSearch(){
        InvoiceList.clear();
        if(InvoiceInfo.kognoz1__Invoice_Date__c != null & InvoiceInfo.kognoz1__Invoice_Date__c != null ){
        startDate=String.valueOf(InvoiceInfo.kognoz1__Invoice_Date__c).left(10);
         endDate=String.valueOf(InvoiceInfo.kognoz1__Invoice_Date__c).left(10);
        String querystr='SELECT Id,kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__c FROM kognoz1__Invoice2__c WHERE kognoz1__Invoice_Date__c ='+startDate+' AND kognoz1__Invoice_Date__c='+ endDate;
        InvoiceList = Database.query(querystr);
        }
        return null;
    } */ 
    
           /*public void Invoicedetails () {
        if(InvoiceInfo.kognoz1__Invoice_Date__c != null & InvoiceInfo.kognoz1__Invoice_Date__c != null ){
        String startDate=String.valueOf(InvoiceInfo.kognoz1__Invoice_Date__c).left(10);
        String endDate=String.valueOf(InvoiceInfo.kognoz1__Invoice_Date__c).left(10);
        String querystr='SELECT Id,kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__c FROM kognoz1__Invoice2__c WHERE kognoz1__Invoice_Date__c ='+startDate+' AND kognoz1__Invoice_Date__c='+ endDate;
        InvoiceList = Database.query(querystr); 
        }
        }
*/


        Public List <kognoz1__Invoice2__c> getinvoicedetails()
        {
           /*String querystr='SELECT Id,kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__c FROM kognoz1__Invoice2__c';
            InvoiceList = Database.query(querystr);
            system.debug(InvoiceList); */
            list<kognoz1__Invoice2__c> KON = [select Id,kognoz1__Invoice_Date__c, kognoz1__Account__c, kognoz1__Opportunity__c from kognoz1__Invoice2__c order by kognoz1__Invoice_Date__c limit : list_size offset : total_size ];
            return null;
            
        }
    
          public integer Beginning() { 
          counter = 0;
              List_size = 20;
          
          return null;
       }
    
       public integer Previous() { 
          counter -= list_size;
          
          return null;
       }
    
       public integer Next() { 
          counter += list_size;
          
          return null;
       }
    
     
       public integer End() { 
          counter = total_size - math.mod(total_size, list_size);
          if(counter==total_size){
              counter=counter-list_size;
          }
         
          return null;
       }
    
       public Boolean getDisablePrevious() { 
         if (counter>0) {
          return false;
          } else return true;
       }
    
       public Boolean getDisableNext() {
        if (counter + list_size < total_size){ 
            
            return false;} else return true;
        }
    
       public Integer getTotal_size() {
          return total_size;
       }
    
       public Integer getPageNumber() {
          return counter/list_size + 1;
       }
    
       public Integer getTotalPages() {
               if(total_size==null)
                   total_size=0;
               
            if (math.mod(total_size, list_size) > 0) {
             return total_size/list_size + 1;
            } else {
             return (total_size/list_size);
         }
       }
    }

i know, i click on next button, it does not take me anywhere..i messed up a lot out of frustation but your input will be helpful and valuable for me. Thanks in advance.
vfpage controller


global class Search_Account_Controller {
   public Set<string> accountSet{get;set;}
   public string accName{get;set;}
   public Account accObj{get;set;}
   public List<Opportunity> oppList{get;set;}
   public boolean recTypeCheck{get;set;}
   public List<Service__c> serviceList{get;set;} 
   
    public Search_Account_Controller() {
         recTypeCheck=true;
        accountSet = new Set<String>();
        List<Account> accList = [Select id, Name, Account_Type__c from Account LIMIT 30000];
        if(accList!=null && accList.size()>0){
            for(Account acc :accList){
                accountSet.add(acc.Name);
            }
        }
    }
    
     public void getAccountDetails(){
        oppList = new List<Opportunity>();
        serviceList= new List<Service__c>();
         List<Account> accList= [Select Name, Id, Account_Type__c from Account where Name=:accName LIMIT 1];
         
         if(accList!=null && accList.size()>0)
         accObj=accList[0];
         
        if(accObj.Account_Type__c!='Client')  {
             recTypeCheck=false;
         }
         else{
            oppList=[Select Id, OppNumber__c, FC_Opportunity_Status__c, Name, StageName, CloseDate, CreationDateTime__c from Opportunity where AccountId=:accObj.Id];    
         }
     }
     
     public void getLineItemDetails()  {
         String oppIdval = apexpages.currentpage().getparameters().get('OppId');
         serviceList=[Select Id, Product__c, Produkt_ID__c , Product__r.Name, Name from Service__c where Opportunity__c=:oppIdval];    
         
     }
}