Crystal generates the Where clause based on the information in the Record Selection formula (Report -> Edit Selection Formula -> Record menu). You don't need the If statement just the following

{lancamentos.livro}="Venda de Mercadorias"

As for the Sum, the easiest way is to add the database field onto the report. Then Right-Click on that object, select the Insert menu item and then the required summary that you want to perform.