Using CH376 module with PIC 18f520
You cannot use RCREG in this way. You must read-it into a buffer then use the buffer for other tests. 

I see you use:

function_int(RCREG);
lcd_string("==");
lcd_data(RCREG);    


On the second usage RCREG will be the next byte received or the uart unit will show an error because there is no data in the RCREG register.

Also , pic 16f4520 does not have a receive FIFO, long delays you use lead to buffer overflow and all bytes received are lost. 

Use a temporary buffer to read all bytes without delay then process the data 

The right way is to:


read the RCIF flag to see if there is data available in RCREG
read RCREG into a buffer and again to first step until you read all bytes expected. 
process the received data. 


Or use a software UART buffer, if you use MPLABX then use mplab code configurator and functions generated , do not read the RCREG directly 

Update. 
As you use SerialTransmit that waits for the TX buffer to be empty before sending a character use also SerialReceive which waits for a character to be received. 

You have a combination of faults here, in the code shown above you are reading twice and the second byte read is faulty leading to a receive overrun 

Then, even at my advice you buffered the RCREG , after that you have a long delay but the receive buffer of UART can hold only one byte and all other bytes are lost. 

Use SerialReceive (which waits for a byte to be available before returning as you see above) and buffer all expected data before making any processing:

for(i=0;i&lt;number_of_bytes_expected;i++)
  {
   buffer[i] = SerialReceive();
  }
// do whatever you need with the data