--fixed for CRM-11467

used case clause if entity_id pointing to financial_item is present then use entity_financial_trxn.amount pointing to financial_item else financial_trxn.