finish main saleledger function.