Multi-functional packaging machine