update DB and finish P&L