OR clauses are always difficult.
Maybe you can build the statement dynamically or make two cases out of it (untested, just to give you an idea what I am talking about):
//Run the script to test the issue
DECLARE@InputAccountNumber integer;
DECLARE@InputPostingDate date;
@InputPostingDate =null;
@InputAccountNumber = 1;
if @InputAccountNumber isnull then
select*
from#TEMP
where(@InputPostingDate isnullor PostingDate <=@InputPostingDate )
else
select*
from#TEMP
where(AccountNumber = @InputAccountNumber)
and(@InputPostingDate isnullor PostingDate <=@InputPostingDate )
end if