To add to Halcyon&on's excellent writeup above:
The gallbladder contracts, releasing bile into the bile duct when stimulated by the hormone cholecystokinin. Cholecystokinin is released by cells in the duodenum, with food and especially with fatty food. This bile travels down the bile duct into the head of the pancreas and joins with the pancreatic duct before emptying into the second part of the duodenum at the ampulla of Vater (a.k.a. the sphincter of Oddi).
The presence of a greenish tinge in vomitus is a good indication that the vomitus has come from below the level of the duodenum (i.e. past the stomach).
Any obstruction to the passage of bile can result in obstructive jaundice as the bilirubin that is normally excreted through the bile ends up building up in the body.