• Amit Chaudhary
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 1
    Replies
User-added image

first page
<apex:page controller="SaveInvoice">
<apex:commandbutton action={!calculate_n_refer_2_another_page}/>

that  contain command button and controller class conCls ( that class have a mehod for creating data tabel and return new page reference of second apex class )

second page
<apex:page controller="SaveInvoice" renderas="pdf">
<apex:datatabel>


so when command button refer control to the second vf page in new tab , all things working but that Save button is not working .Why ?
Thanks in advance .
On my vf page i am genrtaing values for data tabel in pdf . so is it possible that it can be send to anyone using e-mail or i can mail a zip that contain all pdf's collectively .
User-added image
first page
<apex:page controller="printInvoice">
<apex:commandbutton action={!calculate_n_refer_2_another_page}/>

that  contain command button and controller class conCls ( that class have a mehod for creating data tabel and return new page reference of second apex class )

second page
<apex:page controller="printInvoice" renderas="pdf">
<apex:datatabel>


so when command button refer control to the second vf page in new tab , all things working but that print button is not working .Why ?
Thanks in advance .

<apex:pageBlock title="Invoice">
          
         <apex:datatable var="bill" value="{!invoices}" border="4" cellpadding="2" cellspacing="3" >
          
           <apex:column headerValue="Paper Plan">
                   <apex:outputText value="{!bill.Paper_Plan__c}"/>
           </apex:column>
          
           <apex:column headerValue="Sales">
                   <apex:outputText value="{!bill.Sales__c}"/>       
           </apex:column>
          
           <apex:column headerValue="CBs">
                   <apex:outputText value="{!bill.CBs__c}"/>   
           </apex:column>
          
           <apex:column headerValue="Net Sales">
                   <apex:outputText value="{!bill.Sales__c + bill.CBs__c}"/>   
           </apex:column>
          
                 
        </apex:datatable>           
          
   </apex:pageBlock>
  ---------------------------------------------------------------------------------------------------------------------------------------------------------

above code same in 2 diffrent vf page . and have following common controller class .which have this method .
------------------------------------------------------------------------------------------------------------------------------------------------------------

  public list<invoice__c> invoices { get; set; }

    public PageReference genrate() {
       
        invoices = [select CBs__c,CBs_Commision__c,Sales__c,Sales_Commission__c,Paper_Plan__c from invoice__c where (News_Paper__c = :selectval AND (from_Date__c < :dt or from_Date__c = :dt)  AND (End_Date__c > :dt or End_Date__c = :dt))];
       
         
         PageReference pr = new PageReference('https://c.ap1.visual.force.com/apex/printable_view');
             pr.setRedirect(false);
             
      
        return Pr;
      
      
    }


this code not shows value , what changes i have to made ?
I have created a page block and  it contain data table and i want to print it in PDF formate .  
This is the error . I have check field name correct , values are correct . then what would be reason ?

System.DmlException: Insert failed. First exception on row 0 with id a0E9000000pZuMyEAK; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]
Error is in expression '{!genrate}' in component <apex:commandButton> in page genrate_invoice .
And how can i access that record using Query editor .
User-added image    select name , Cust_Detail__r.News_Paper__r.name from Converted_Customer__c
select name,Paper_Plan__r.name from Converted_Customer__c

this query print       paper_plan__r.name     value .

  but same query giving Id when i am writing in apex class . why   and how i can access related value in apex class .
1.<apex:page controller="exampleCon4">
2.    <apex:form >
       
3.        <apex:actionPoller action="{!incrementCounter}" rerender="counter" status="counterStatus" interval="500"/>
         
4.        <apex:outputText value="Watch this counter: {!count}" id="counter"/>
      
5.        <apex:actionStatus startText=" (incrementing...)" stopText=" (done)" id="counterStatus"/>
    
     
6.    </apex:form>
7.     </apex:page>

     after execution of 3rd statement ,execution control where goes , on 4th statement or on 5th statement or on controller class.
and is there any other way to check this flow ?  
User-added image
first page
<apex:page controller="printInvoice">
<apex:commandbutton action={!calculate_n_refer_2_another_page}/>

that  contain command button and controller class conCls ( that class have a mehod for creating data tabel and return new page reference of second apex class )

second page
<apex:page controller="printInvoice" renderas="pdf">
<apex:datatabel>


so when command button refer control to the second vf page in new tab , all things working but that print button is not working .Why ?
Thanks in advance .