private void AddSundryAmountIfNotNull(XcelleratorClient.SundryAmount sundryAmount) { if (sundryAmount == null) { return; } var responseSundryAmount = new SundryAmount(); responseSundryAmount.name = sundryAmount.name; responseSundryAmount.Amount = sundryAmount.Amount; responseSundryAmount.Currency = sundryAmount.Currency; Sundries.Add(responseSundryAmount); }
public string ToFormattedString() { var sb = new StringBuilder(); sb.Append("Calulations for id:" + this.Id + "\n"); sb.Append("\n"); sb.Append("Amazon" + "\n"); sb.Append("\t " + "Sales Fee " + this.AmazonFees.SalesFee.Currency + " " + this.AmazonFees.SalesFee.Amount); sb.Append("\t " + "FBA Fee " + this.AmazonFees.FbaFee.Currency + " " + this.AmazonFees.FbaFee.Amount); sb.Append("\t " + "EFN Fee " + this.AmazonFees.EfnFee.Currency + " " + this.AmazonFees.EfnFee.Amount); sb.Append("\t " + "Hub to FC " + this.HubToFacility.Currency + " " + this.HubToFacility.Amount); sb.Append("\n"); sb.Append("Dimensions" + "\n"); sb.Append("\t " + "Length " + this.Dimensions.ProductLength + " " + this.Dimensions.Measurement); sb.Append("\t " + "Width " + this.Dimensions.ProductWidth + " " + this.Dimensions.Measurement); sb.Append("\t " + "Height " + this.Dimensions.ProductHeight + " " + this.Dimensions.Measurement); sb.Append("\t " + "CBM " + this.Dimensions.CBM + "m (cubed)"); sb.Append("\n"); sb.Append("Duties" + "\n"); sb.Append("\t " + "via air " + this.Duties.Air.Currency + " " + this.Duties.Air.Amount); sb.Append("\t " + "via sea " + this.Duties.Sea.Currency + " " + this.Duties.Sea.Amount); sb.Append("\t " + "via shf " + this.Duties.SuperheroFreight.Currency + " " + this.Duties.SuperheroFreight.Amount); sb.Append("\t " + "totals " + this.Duty.Currency + " " + this.Duty.Amount); sb.Append("\n"); sb.Append("\n"); sb.Append("Factory to Hub Costs (via air)" + "\n"); // sb.Append("\t " + "best option " + this.factory_to_hub);//TODO: where is best option facToHubCosts? sb.Append("\t " + "option #1 " + this.FactoryToHub.Air.Option0.Name + " " + this.FactoryToHub.Air.Option0.PriceCurrency + " " + this.FactoryToHub.Air.Option0.Price + " " + string.Format("Minimum {0} Unit Order\n", this.FactoryToHub.Air.Option0.RequiredProducts)); sb.Append("\t " + "option #2 " + this.FactoryToHub.Air.Option1.Name + " " + this.FactoryToHub.Air.Option1.PriceCurrency + " " + this.FactoryToHub.Air.Option1.Price + " " + string.Format("Minimum {0} Unit Order\n", this.FactoryToHub.Air.Option1.RequiredProducts)); sb.Append("\t " + "option #3 " + this.FactoryToHub.Air.Option2.Name + " " + this.FactoryToHub.Air.Option2.PriceCurrency + " " + this.FactoryToHub.Air.Option2.Price + " " + string.Format("Minimum {0} Unit Order\n", this.FactoryToHub.Air.Option2.RequiredProducts)); sb.Append("\t " + "option #4 " + this.FactoryToHub.Air.Option3.Name + " " + this.FactoryToHub.Air.Option3.PriceCurrency + " " + this.FactoryToHub.Air.Option3.Price + " " + string.Format("Minimum {0} Unit Order\n", this.FactoryToHub.Air.Option3.RequiredProducts)); sb.Append("\n"); sb.Append("Factory to Hub Costs (via sea)" + "\n"); sb.Append("\t " + "option #1 " + this.FactoryToHub.Sea.Option0.Name + " " + this.FactoryToHub.Sea.Option0.PriceCurrency + " " + this.FactoryToHub.Sea.Option0.Price + " " + string.Format("Minimum {0} Unit Order\n", this.FactoryToHub.Sea.Option0.RequiredProducts)); sb.Append("\t " + "option #2 " + this.FactoryToHub.Sea.Option1.Name + " " + this.FactoryToHub.Sea.Option1.PriceCurrency + " " + this.FactoryToHub.Sea.Option1.Price + " " + string.Format("Minimum {0} Unit Order\n", this.FactoryToHub.Sea.Option1.RequiredProducts)); sb.Append("\t " + "option #3 " + this.FactoryToHub.Sea.Option2.Name + " " + this.FactoryToHub.Sea.Option2.PriceCurrency + " " + this.FactoryToHub.Sea.Option2.Price + " " + string.Format("Minimum {0} Unit Order\n", this.FactoryToHub.Sea.Option2.RequiredProducts)); sb.Append("\t " + "option #4 " + this.FactoryToHub.Sea.Option3.Name + " " + this.FactoryToHub.Sea.Option3.PriceCurrency + " " + this.FactoryToHub.Sea.Option3.Price + " " + string.Format("Minimum {0} Unit Order\n", this.FactoryToHub.Sea.Option3.RequiredProducts)); sb.Append("\n"); sb.Append("Factory to Hub Costs (via Superhero Freight)" + "\n"); sb.Append("\t " + "option #1 " + this.FactoryToHub.SuperheroFrieght.Option0.Name + " " + this.FactoryToHub.SuperheroFrieght.Option0.PriceCurrency + " " + this.FactoryToHub.SuperheroFrieght.Option0.Price + " " + string.Format("Minimum {0} Unit Order\n", this.FactoryToHub.SuperheroFrieght.Option0.RequiredProducts)); sb.Append("\t " + "option #2 " + this.FactoryToHub.SuperheroFrieght.Option1.Name + " " + this.FactoryToHub.SuperheroFrieght.Option1.PriceCurrency + " " + this.FactoryToHub.SuperheroFrieght.Option1.Price + " " + string.Format("Minimum {0} Unit Order\n", this.FactoryToHub.SuperheroFrieght.Option1.RequiredProducts)); sb.Append("\t " + "option #3 " + this.FactoryToHub.SuperheroFrieght.Option2.Name + " " + this.FactoryToHub.SuperheroFrieght.Option2.PriceCurrency + " " + this.FactoryToHub.SuperheroFrieght.Option2.Price + " " + string.Format("Minimum {0} Unit Order\n", this.FactoryToHub.SuperheroFrieght.Option2.RequiredProducts)); sb.Append("\t " + "option #4 " + this.FactoryToHub.SuperheroFrieght.Option3.Name + " " + this.FactoryToHub.SuperheroFrieght.Option3.PriceCurrency + " " + this.FactoryToHub.SuperheroFrieght.Option3.Price + " " + string.Format("Minimum {0} Unit Order\n", this.FactoryToHub.SuperheroFrieght.Option3.RequiredProducts)); sb.Append("\n"); sb.Append("Misc. Data" + "\n"); sb.Append("\t " + "Cost " + this.FOB.Currency + " " + this.FOB.Amount); sb.Append("\t " + "Fulfilment " + this.Fulfilment); sb.Append("\t " + "Origin " + this.Product.Origin.Name); sb.Append("\t " + "Category " + this.Product.Category.Name); sb.Append("\n"); sb.Append("Landed Cost" + "\n"); sb.Append("\t " + "via air " + this.LandedCost.Air.Currency + " " + this.LandedCost.Air.Amount); sb.Append("\t " + "via sea " + this.LandedCost.Sea.Currency + " " + this.LandedCost.Sea.Amount); sb.Append("\t " + "via shf " + this.LandedCost.SuperheroFreight.Currency + " " + this.LandedCost.SuperheroFreight.Amount); sb.Append("\n"); sb.Append("POI" + "\n"); sb.Append("\t " + "via air " + this.POI.Air.Currency + " " + String.Format("Value: {0:P2}.", this.POI.Air.Amount)); sb.Append("\t " + "via sea " + this.POI.Sea.Currency + " " + String.Format("Value: {0:P2}.", this.POI.Sea.Amount)); sb.Append("\t " + "via shf " + this.POI.SuperheroFreight.Currency + " " + String.Format("Value: {0:P2}.", this.POI.SuperheroFreight.Amount)); sb.Append("\n"); sb.Append("POR" + "\n"); sb.Append("\t " + "via air " + this.POR.Air.Currency + " " + String.Format("Value: {0:P2}.", this.POR.Air.Amount)); sb.Append("\t " + "via sea " + this.POR.Sea.Currency + " " + String.Format("Value: {0:P2}.", this.POR.Sea.Amount)); sb.Append("\t " + "via shf " + this.POR.SuperheroFreight.Currency + " " + String.Format("Value: {0:P2}.", this.POR.SuperheroFreight.Amount)); sb.Append("\n"); sb.Append("Product Info" + "\n"); sb.Append("\t " + "Origin " + this.Product.Origin.Name + "\n"); sb.Append("\t " + "Category " + this.Product.Category.Name + "\n"); sb.Append("\t " + "Selling Price " + this.Product.SellingPrice.Currency + " " + this.Product.SellingPrice.Amount + "\n"); sb.Append("\t " + "Pre-Tax " + this.Product.SellingPrice.Taxless.Currency + " " + this.Product.SellingPrice.Taxless.Amount + "\n"); sb.Append("\t " + "RVF " + this.RVF.Currency + " " + this.RVF.Amount + "\n"); sb.Append("\t " + "Sales Country " + this.SalesCountry.Name + "\n"); sb.Append("\t " + "Sales Tax " + String.Format("Value: {0:P2}.", this.SalesTax.CountryTax.Amount) + "\n"); sb.Append("\t " + "Sales Tax Charged " + this.SalesTax.Currency + " " + this.SalesTax.Amount + "\n"); sb.Append("\n"); sb.Append("Profit" + "\n"); sb.Append("\t " + "via air " + this.Profit.Air.Currency + " " + this.Profit.Air.Amount); sb.Append("\t " + "via air " + this.Profit.Sea.Currency + " " + this.Profit.Sea.Amount); sb.Append("\t " + "via air " + this.Profit.SuperheroFreight.Currency + " " + this.Profit.SuperheroFreight.Amount); sb.Append("\n"); sb.Append("Suggested Selling Price" + "\n"); sb.Append("\t " + "via air " + this.SuggestedSalesPrice.Air.Currency + " " + this.SuggestedSalesPrice.Air.Amount); sb.Append("\t " + "via sea " + this.SuggestedSalesPrice.Sea.Currency + " " + this.SuggestedSalesPrice.Sea.Amount); sb.Append("\t " + "via shf " + this.SuggestedSalesPrice.SuperheroFreight.Currency + " " + this.SuggestedSalesPrice.SuperheroFreight.Amount); sb.Append("\n"); if (Sundries.Any()) { sb.Append("Sundries" + "\n"); var sundryIndex = 0; foreach (var sundryLine in Sundries) { sb.Append(String.Format("\t {0}: \t{1} \t{2} \t{3}\n", sundryIndex, sundryLine.name.PadLeft(20, ' '), sundryLine.Amount.ToString().PadLeft(8, ' '), sundryLine.Currency)); sundryIndex++; } if (SundriesTotal != null) { sb.Append(String.Format("\t {0} \t{1} \t{2} \t{3}\n", " ", "Totals".PadLeft(20, ' '), SundriesTotal.Amount.ToString().PadLeft(8, ' '), SundriesTotal.Currency)); } } return(sb.ToString()); }