• vijay jillella 9
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
please help me withthe below
My concern is while i am generating an invoice and returning page i am able to see the invoice number in the page and when i am attaching it invoice number is missing.
here is the code
public SpecialInvoicesGST_vijay(){
//wrapObj = new list<ContactWrapper>();
appointment1 = new SCSCHAMPS__Appointment__c();
appde= new SCSCHAMPS__Appointment__c();
invBill=new Invoice__c();
invfp = new Invoice__c();//
totall = 0;
contactList  = new List<ContactWrapper>();
// cb=false;
// flag='false';
 AppList = new List<AppWrap>();//
 addMore();//
 selectedRowIndex = '0';//
 System.debug('rrrrrr'+val);
 inv = [SELECT id,Name,Invoice_Date__c  FROM Invoice__c ORDER BY Name DESC LIMIT 1]; //
  String s1= inv.Name;//
   invNo = Long.valueOf( s1.substring(3));//
  system.debug('&&invNo&&'+invNo);
}  
public void attachPdfToAccount(String  invBillCalendar, String appointmentEmployer, id invId){
     
Billing_Calendar__c bc=new Billing_Calendar__c(); 
bc=[select id,Name, Invoicing_Start_Date__c,Invoicing_End_Date__c from Billing_Calendar__c where Billing_Calendar__c.id=:invBillCalendar limit 1];            
Account acc = [select id,Name from Account where ID=:appointmentEmployer];    
if(ep=='None'&& desp==null)
{this.ep=desp;}
else{this.ep=ep;}
finalAcc = getAcc();
pagereference ref1;

//=================================main part to work===================================================//
   
Attachment myAttach1 = new Attachment();
flag = 'attach';
myAttach1.ParentId = invid;
inm3= [SELECT id,Name,invoiceNamecopy__C,invcopyno__C,Invoice_Date__c  FROM Invoice__c Where Id =: invId];
//myAttach1.name =bc.Invoicing_Start_Date__c+'To'+bc.Invoicing_End_Date__c +'.pdf';
myAttach1.name =inm3.name+'.pdf';
    
//myAttach1.body= ref.getContentAsPdf();

//myattach1.Id=inm1.id;
                       
if(appointment1.SCSCHAMPS__Employer__c=='0016F00001tJirW')
{
//ref=page.Tesco_Special_Invoice_GST1;
   // ref=page.Tesco_Invoice;
     ref1=page.Tesco_Special_Invoice_GST_vijay;
}
else if(appointment1.SCSCHAMPS__Employer__c=='0016F00001tJirY') 
{
//ref=page.Wipro_Special_Invoice_GST;
ref1=page.Wipro_Special_Invoice_GST_vijay;
system.debug('wipro special invoice');
}
else if( (appointment1.SCSCHAMPS__Employer__c=='0016F00001tJira') )
{
//ref=page.IBM_Special_Invoice_GST1;
ref1=page.IBM_Special_Invoice_GST1_vijay; 
}
else if (appointment1.SCSCHAMPS__Employer__c=='0010k00000T2XXC')
{
ref1=page.testspecial;
}
/*else if( (appointment1.SCSCHAMPS__Employer__c=='0016F00001tJirY') && (toi=='Allowances'))
{
ref=page.Wipro_Invoice_Allowances;
 }*/
else if (appointment1.SCSCHAMPS__Employer__c=='0016F00001tJPRC')
{

ref1=page.First_American_Special_Invoice_GST;

}
else if (appointment1.SCSCHAMPS__Employer__c=='0016F00001tJirS')
{
//ref=page.SAP_Labs_Special_Invoice_GST;
ref1=page.SAP_Labs_Special_Invoice_GST_vijay;
}
else if (appointment1.SCSCHAMPS__Employer__c=='0016F00001tJPLG')
{
//ref=page.BNP_SIGST_Production;
ref1=page.BNP_SIGST_Production_vijay;    
}
else if (appointment1.SCSCHAMPS__Employer__c=='0016F00001tJPKh')
{
//ref=page.Amdocs_Special_Invoice_GST;
ref1=page.Amdocs_Special_Invoice_GST_vijay;
}
else if (appointment1.SCSCHAMPS__Employer__c=='0016F00001tJirU')
{
//ref=page.True_Blue_Special_Invoice_GST;
    ref1=page.True_Blue_Special_Invoice_GST_vijay;
}
else if( (appointment1.SCSCHAMPS__Employer__c=='0016F00001tJPSe') )
{
//ref=page.GenpactSpecialInvoiceGST;
ref1=page.GenpactSpecialInvoiceGST_vijay;             
}
else if( (appointment1.SCSCHAMPS__Employer__c=='0016F00001sbvvM') )
{
//ref=page.Special_Invoice_GSTAccenture_updated;  
ref1=page.Special_Invoice_GSTAccenture_vijay;           
}
else if( (appointment1.SCSCHAMPS__Employer__c=='0016F00001yyxQS') )
{
//ref=page.Experis_IT_Special_invoice;   
ref1=page.Experis_IT_Special_invoice_vijay;          
}
else if( (appointment1.SCSCHAMPS__Employer__c=='0016F00002Ca81c') )
{
//ref=page.SAP_Premium_special_invoice_GST; 
 ref1=page.SAP_Premium_special_invoice_GST_vijay;             
}
else
{
ref1 = page.Consolidated_Special_Invoice_GST;
}
          
                
ref1.getParameters().put('inm3.name',inm3.name);

               
ref1.getParameters().put('accId',invId);
ref1.getParameters().put('flag1',String.valueOf(flag));
ref1.getParameters().put('ep1',ep);
ref1.getParameters().put('toi1',toi);
ref1.getParameters().put('stax1',stax);
ref1.getParameters().put('scurr1',scurr);
ref1.getParameters().put('pos',pos);
ref1.getParameters().put('sop1',sop);
ref1.getParameters().put('ids',strids);
                
                //GST Implementation
ref1.getParameters().put('taxa1',taxa);
ref1.getParameters().put('addG1',addG);
ref1.getParameters().put('gst1',gst);
            
ref1.getParameters().put('startDate',string.valueOf(bc.Invoicing_Start_Date__c));
ref1.getParameters().put('endDate',string.valueOf(bc.Invoicing_End_Date__c));
             
if(edate!=null)
ref1.getParameters().put('edt',string.valueOf(edate));
else 
ref1.getParameters().put('edt',string.valueOf(Date.Today())); 
if(bdate!=null)
ref1.getParameters().put('bdt',string.valueOf(bdate));
else 
ref1.getParameters().put('bdt',string.valueOf(Date.Today())); 
//ref1.getParameters().put('','print');  
   // ref1.getParameters().put('flag1','print');  
 myAttach1.body = ref1.getContentAsPdf();    
insert myAttach1;
attach();
}


vf page:
<apex:page Controller="SpecialInvoicesGST_vijay"  showHeader="false"  applyHtmlTag="false" renderAs="pdf" applyBodyTag="false" >
<html style="margin-top: 0px;font-size:10px;page-break-inside:avoid">
<head>
<style type="text/css" media="print">
@page {
 margin-top: 35mm;
  margin-bottom: 15mm;
@top-center {
content: element(header);
}
@bottom-left {
 content: element(footer);
}
}
</style>
</head>
 
<div class="header">
<div></div>
</div>
 
<div class="footer">
<div></div>
</div>
<body>
<div class="content">        
<table width="100%" cellspacing="0" cellpading="0" border="1" style="font-size:10px;page-break-inside:avoid" >
<tr><th colspan="9" bgcolor="#D3D3D3" align="center" ><h><span style="font-size:13px"><B>INVOICE---{!record.name}</B><br/> </span></h></th></tr>
<tr><apex:panelGroup rendered="{!taxa!='GST'}"><td height="50%" colspan="4"><h>To</h><br/><br/>
{!acc.BillingStreet}<br/>{!acc.BillingCity}<br/>{!acc.BillingState}&nbsp;{!acc.BillingPostalCode}<br/>{!acc.BillingCountry}&nbsp;{!acc.BillingLatitude}&nbsp;{!acc.BillingLongitude}                   

    </td>
</apex:panelGroup>
<apex:panelGroup rendered="{!taxa=='GST'}">
<td height="50%" colspan="4" style="display:{!if(addG=='GST1','','none')}" >To,
<br/>{!acc.GST1_Address__c}
<br/>{!acc.GST1_Street__c}
<br/>{!acc.GST1_City__c}
<br/>{!acc.GST1_State_Province__c}
<br/>{!acc.GST1_Zip_Postal_Code__c}
<br/>{!acc.GST1_Country__c}
<br/>GSTIN - {!acc.Client_GST1_Number__c}

</td>
<td height="50%" colspan="4" style="display:{!if(addG=='GST2','','none')}">To,
<br/>{!acc.GST2_Address__c}
<br/>{!acc.GST2_Street__c}
<br/>{!acc.GST2_City__c}
<br/>{!acc.GST2_State_Province__c}
<br/>{!acc.GST2_Zip_Postal_Code__c}
<br/>{!acc.GST2_Country__c}
<br/>GSTIN - {!acc.Client_GST2_Number__c}
</td>
<td height="50%" colspan="4" style="display:{!if(addG=='GST3','','none')}">To,
<br/>{!acc.GST3_Address__c}
<br/>{!acc.GST3_Street__c}
<br/>{!acc.GST3_City__c}
<br/>{!acc.GST3_State_Province__c}
<br/>{!acc.GST3_Zip_Postal_Code__c}
<br/>{!acc.GST3_Country__c}
<br/>GSTIN - {!acc.Client_GST3_Number__c}
</td>
</apex:panelGroup>
    
    <td height="50%" colspan="5">
<apex:variable value="{!Inm3.name}" var="inm"/> 


<apex:panelGroup >    
<h align="right" style="display:{!if(flag=='attach','{!inm}','{!inm}')}">
Invoice&nbsp;No&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;11===={!record.name}<br/></h> 
<h align="right" style="display:{!if(flag=='false','','{!inm}')}">  
Invoice&nbsp;No&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;21===={!inm}<br/></h>
<h align="right" style="display:{!if(flag=='print','','none')}">
Invoice&nbsp;No&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;31===={!inm1}<br/></h>
<h align="right" style="display:{!if(flag=='view','','none')}">
Invoice&nbsp;No&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;41===={!inm1}<br/></h>
</apex:panelGroup>
  <apex:pageBlock>
      <apex:pageBlockTable value="{!record}" var="a">
          <apex:column value="{!record.name}" title="iiiiiiiiiiiii"/>
      
      </apex:pageBlockTable>
        
        </apex:pageBlock
public class IndeedTestervijay {  
   // String jobXML{get;set;}       
     public void createAndSendJob()         
    {
       String access_token = '9999e3bb3112cfa022da0f864850d13c8a9387d6f336830b5d74c7bff67d7499';
       String xmlBody = 'indeed-apply-jobUrl="http://Jill-Gaba.SFAgentJobs.com/j/0b0yx"&indeed-apply-jobId="514473"&indeed-apply-jobTitle="Account Associate - State Farm Agent Team Member"&indeed-apply-jobCompanyName="Jill Gaba - State Farm Agent"&indeed-apply-jobLocation="Macedonia, OH 44056" &indeed-apply-apiToken="9999e3bb3112cfa022da0f864850d13c8a9387d6f336830b5d74c7bff67d7499"&indeed-apply-postUrl="http://app.careerplug.com/jobs/1928/apps.json"&indeed-apply-phone="required"&indeed-apply-questions="http://app.careerplug.com/jobs/1928/questions.json"&indeed-apply-continueUrl="http://ProsigoExecutiveSearch.hiringhook.com/JobSeeker/Thank_You.aspx?jobid=02168140"&indeed-apply-jobMeta="?jid=02168140 and siteid=1342 and mobile=0"&indeed-apply-name="firstlastname"';
       XmlStreamWriter w = new XmlStreamWriter();
       w.writeStartDocument('utf-8', '1.0');        
       w.writeStartElement(null, 'indeed-apply-data', null);
       w.writeCData(xmlBody); 
       w.writeEndElement(); 
       w.writeEndDocument();
       String xmlOutput = w.getXmlString();
    //   jobXML = w.getXmlString();
       w.close();
     //  system.debug('-------------------------jobXML ' +jobXML);       
       system.debug('---------------------------xmlOutput'+xmlOutput);
       system.debug('-----------------------xmlBody'+xmlBody);
        http ht = new http();
        HttpRequest request=new HttpRequest(); 
        request.setEndpoint('https://app.careerplug.com/jobs/1928/application/json');   
        request.setMethod('POST');
        request.setHeader('Content-Type', 'text/xml;charset=UTF-8');
        //request.setHeader('Authorization','OAuth '+access_token);
        request.setBody(xmlOutput);
        HttpResponse response=ht.send(request);
        //string finalResultPOST=response.getBody();
      
        system.debug('---------------------------Response From Indeed-------------'+response.getBody()); 
        system.debug('----------+++++++++-----------------Response From Indeed-------------'+response.getXmlStreamReader());
      system.debug('---------------------------Response From Indeed-------------'+response.getHeaderKeys());
        system.debug('---------------------------Response From Indeed-------------'+response.getHeader('access_token'));
    }   
    }
urgent salesforce integration with indeed job board with rest api
urgent salesforce integration with indeed job board with rest api
Hi Team, I need to encrypt email address in the apex.

Here is sample Java code. Pls, help me how to generate this?
 
String email = "jobs@example.com";
String api_secret = "your api secret key".getBytes(new Charset("UTF-8"));
byte[] keydata = new byte[16];
// get the first 16 bytes of the api secret
System.arraycopy(api_secret, 0, keydata, 0, keydata.length);
byte[] email_bytes = email.getBytes(Charsets.UTF_8);
// Create a SecretKeySpec using the shared api secret
SecretKeySpec key = SecretKeySpec(keydata, "AES");
// Encrypt the email
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
IvParameterSpec ivspec = new IvParameterSpec(new byte[]{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
cipher.init(Cipher.ENCRYPT_MODE, key, ivspec);
byte[] email_encrypted = cipher.doFinal(email_bytes);
// convert encrypted email to hex
StringBuilder buf = new StringBuilder(email_encrypted.length * 2);
for (byte b : email_encrypted) {
    String hexDigits = Integer.toHexString((int) b & 0x00ff);
    if (hexDigits.length() == 1)
        buf.append('0');
    buf.append(hexDigits);
}
String encrypted_email = buf.toString();

When using Indeed Apply through email, you must encrypt the email to which Indeed sends the applications. Indeed expects the email to be encrypted using the AES algorithm with your 128-bit secret key. The cipher mode is CBC with PKCS5 padding. The initialization vector is 16 bytes of 00.
Using your secret key, generate a 128-bit secret key using the first 16 bytes.
Read the bytes of the plain-text email encoded in "UTF-8".
Encrypt the email using the AES algorithm and your 128-bit key. Be sure to use CBC mode and PKCS5 padding.
Convert the encrypted bytes to hex string.
Use this hex string as your data-indeed-apply-email attribute.

Thanks in advance 

I have created list of events in different dates. After the creation of the Events, I need to display those events in the site.com VF Page. But, when I was trying to show the account details, It is working fine. But, when I was trying to display the events. the events are not displaying in the site VF Page.

I need help for you to solve this issue.

Here I will put my code.


Controller Class:
public with sharing class EventController {
    private Datetime eventStartDateTime {get; set;}
    private Datetime eventEndDateTime {get; set;}
    private Datetime agentStartDateTime {get; set;}
    private DateTime agentEndDateTime {get; set;}
    private List<Event> listOfEvents {get; set;}

    public EventController(){ 
    }
    
   public List<Event> getListOfEvents(){
         listOfEvents = [SELECT  OwnerId, CreatedById, ActivityDate, StartDateTime, EndDateTime, Location FROM EVENT];
        return listOfEvents;
    }


VF Page Code:

<apex:page Controller="EventController">
    <apex:form >
   <apex:pageBlock title="Events Block">
       
      <apex:pageBlockTable value="{!listOfEvents}" var="event" id="table">
          <apex:column headerValue="Activity Id" value="{!event.Id}"/>
          <apex:column headerValue="Assigned To" value="{!event.OwnerId}"/>
          <apex:column headerValue="Created By" value="{!event.CreatedById}"/>
          <apex:column headerValue="Activity Date" value="{!event.ActivityDate}"/>
          <apex:column headerValue="StartDateTime" value="{!event.StartDateTime}"/>
          <apex:column headerValue="EndDateTime" value="{!event.EndDateTime}"/>
          <apex:column headerValue="Location" value="{!event.Location}"/>
      </apex:pageBlockTable>
   </apex:pageBlock>
    </apex:form>
</apex:page>