public ActionResult DoAddPurchaseOrder(int si, string pos)
        {
            var model = new ShipmentListModel();

            try {
                var shipment = ShipmentService.FindShipmentModel(si, CurrentCompany, false);
                ShipmentService.AddPurchaseOrders(CurrentCompany, CurrentUser, shipment, pos);
            } catch (Exception e1) {
                this.WriteLog(e1);
                model.Error.SetError(e1);
            }
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
        public ActionResult DoAddToShipment(AddToShipmentPopupViewModel model, string command)
        {
            if (command.ToLower() == "add")
            {
                // Find the shipment or create a new one
                var shipmentModel = ShipmentService.FindShipmentModel(model.ShipmentId, CurrentCompany, false);
                if (shipmentModel == null)
                {
                    // Create a new Shipment
                    shipmentModel = ShipmentService.CreateShipment(CurrentCompany, CurrentUser);
                }

                // Add the PO's to the shipment
                ShipmentService.AddPurchaseOrders(CurrentCompany, CurrentUser, shipmentModel, model.SelectedPOs);

                return(RedirectToAction("Edit", "Shipments", new { area = "Shipments", id = shipmentModel.Id }));
            }
            else
            {
                return(Purchases());
            }
        }