[IMP] Improved the code in sps_sale and sps_stock.