Excess contribution to Traditional IRA

Hello,

Hoping someone can help me finish my taxes, thank you in advance for your help.

From turbotax, it says that I can only deduct 6316 of my 7000 IRA contribution. I did not have enough earned income this year as I lost a job. How is this number calculated? Because of this, I now have a non-deductible excess contribution of 648. Is this the amount I should withdraw from investment company or do I need to calculate and add earnings to that before withdraw request? Now after that, how do I go about filling out a 1099R if I don’t receive it this year?