public InvoiceItem(InvoiceItem copy, Invoice parent) { this.BuyingPrice = copy.BuyingPrice; this.Datetime = copy.Datetime; //this.FromDB = copy.FromDB; this.invSKU = copy.invSKU; this.ItemDiscount = copy.ItemDiscount; this.ItemName = copy.ItemName; this.ItemOptions = copy.ItemOptions; this.ItemOrigPrice = copy.ItemOrigPrice; this.ItemPrice = copy.ItemPrice; this.ItemQtyCanceled = copy.ItemQtyCanceled; this.ItemQtyInvoiced = copy.ItemQtyInvoiced; this.ItemQtyOrdered = copy.ItemQtyOrdered; this.ItemQtyRefunded = copy.ItemQtyRefunded; this.ItemQtyShipped = copy.ItemQtyShipped; this.ItemStatus = copy.ItemStatus; this.ItemTax = copy.ItemTax; this.ItemTotal = copy.ItemTotal; this.MSG_SKU = copy.MSG_SKU; this.OrderItemIncrement = copy.OrderItemIncrement; // dopravu parujeme if (copy.PairCode != null && copy.PairCode == Properties.Settings.Default.ShippingCode) { //this.PairCode = copy.PairCode; this.PairProduct = copy.PairProduct.Clone() as StockItem; } this.PairProductStack = copy.PairProductStack; this.itemStorage = copy.itemStorage; this.Parent = parent; this.PredajnaCena = copy.PredajnaCena; }
public Invoice(Invoice copy) : this() { this.id = copy.id; this.BillingCity = copy.BillingCity; this.BillingCompany = copy.BillingCompany; this.BillingCountry = copy.BillingCountry; this.BillingCountryName = copy.BillingCountryName; this.BillingName = copy.BillingName; this.BillingPhoneNumber = copy.BillingPhoneNumber; this.BillingState = copy.BillingState; this.BillingStateName = copy.BillingStateName; this.BillingStreet = copy.BillingStreet; this.BillingZip = copy.BillingZip; this.icoNumber = copy.icoNumber; this.dicNumber = copy.dicNumber; // this.company = copy.company; this.Cancelled = copy.Cancelled; this.Country = copy.Country; this.CustomerEmail = copy.CustomerEmail; this.CustomerName = copy.CustomerName; this.Equipped = copy.Equipped; //this.Icon = copy.Icon; //this.InvoiceItems = copy.InvoiceItems; foreach (var item in copy.InvoiceItems) this.InvoiceItems.Add(new InvoiceItem(item, this)); // nakopirovanie poloziek bez parovania this.InvoiceStatus = copy.InvoiceStatus; this.OrderDate = copy.OrderDate; this.OrderDiscount = copy.OrderDiscount; this.OrderDue = copy.OrderDue; this.OrderGrandTotal = copy.OrderGrandTotal; this.OrderNumber = copy.OrderNumber; this.OrderPaid = copy.OrderPaid; this.OrderPaymentMethod = copy.OrderPaymentMethod; this.OrderPurchasedFrom = copy.OrderPurchasedFrom; this.OrderRefunded = copy.OrderRefunded; this.OrderShipping = copy.OrderShipping; this.OrderShippingMethod = copy.OrderShippingMethod; this.OrderStatus = copy.OrderStatus; this.OrderSubtotal = copy.OrderSubtotal; this.OrderTax = copy.OrderTax; this.ShippingCity = copy.ShippingCity; this.ShippingCompany = copy.ShippingCompany; this.ShippingCountry = copy.ShippingCountry; this.ShippingCountryName = copy.ShippingCountryName; this.ShippingName = copy.ShippingName; this.ShippingPhoneNumber = copy.ShippingPhoneNumber; this.ShippingState = copy.ShippingState; this.ShippingStateName = copy.ShippingStateName; this.ShippingStreet = copy.ShippingStreet; this.ShippingZip = copy.ShippingZip; this.TotQtyOrdered = copy.TotQtyOrdered; this.fromFile = copy.fromFile; // this.TestValues = copy.TestValues; }
public InvoiceItem(Invoice parent) { Parent = parent; }
public static bool IsEquipped(Invoice inv) { return inv != null && inv.InvoiceItems != null && inv.InvoiceItems.All(i => IsItemPaired(i)); }
internal void CreateInvoice(List<CSVFile> allOrders) { AllInvoices = new List<Invoice>(); Invoice inv = null; foreach (var order in allOrders) { string actualOrderNumber = string.Empty; foreach (var item in order.Items) { // vytvorenie novej objednavky if (item.OrderNumber != actualOrderNumber) { actualOrderNumber = item.OrderNumber; if (inv != null) AllInvoices.Add(inv); inv = new Invoice(); inv.OrderPurchasedFrom = item.OrderPurchasedFrom; if (inv.OrderPurchasedFrom.Contains(".sk")) inv.Country = Country.Slovakia; else if (inv.OrderPurchasedFrom.Contains(".hu")) inv.Country = Country.Hungary; else if (inv.OrderPurchasedFrom.Contains(".pl")) inv.Country = Country.Poland; else if (inv.OrderPurchasedFrom.Contains(".cz")) inv.Country = Country.CzechRepublic; else inv.Country = Country.Unknown; inv.fromFile = order.File; inv.TotQtyOrdered = item.TotQtyOrdered; inv.BillingCity = item.BillingCity; inv.BillingCompany = item.BillingCompany; inv.BillingCountry = item.BillingCountry; inv.BillingCountryName = item.BillingCountryName; inv.BillingName = item.BillingName; inv.BillingPhoneNumber = Common.ModifyPhoneNr(item.BillingPhoneNumber, inv.Country); inv.BillingState = item.BillingState; inv.BillingStateName = item.BillingStateName; inv.BillingStreet = item.BillingStreet; inv.BillingZip = item.BillingZip; inv.CustomerEmail = item.CustomerEmail; inv.CustomerName = item.CustomerName; inv.OrderDate = item.OrderDate; inv.OrderDiscount = item.OrderDiscount; inv.OrderDue = item.OrderDue; inv.OrderGrandTotal = item.OrderGrandTotal; inv.OrderNumber = item.OrderNumber; inv.OrderPaid = item.OrderPaid; inv.OrderPaymentMethod = item.OrderPaymentMethod; inv.OrderRefunded = item.OrderRefunded; inv.OrderShipping = item.OrderShipping; inv.OrderShippingMethod = item.OrderShippingMethod; inv.OrderStatus = item.OrderStatus; // ak je stav objednavky zrusena v CSV, nastavime tento stav ak objednavke if (inv.OrderStatus.ToLower().Contains("cancel")) inv.Cancelled = true; inv.OrderSubtotal = item.OrderSubtotal; inv.OrderTax = item.OrderTax; inv.ShippingCity = item.ShippingCity; inv.ShippingCompany = item.ShippingCompany; inv.ShippingCountry = item.ShippingCountry; inv.ShippingCountryName = item.ShippingCountryName; inv.ShippingName = item.ShippingName; inv.ShippingPhoneNumber = Common.ModifyPhoneNr(item.ShippingPhoneNumber, inv.Country); inv.ShippingState = item.ShippingState; inv.ShippingStateName = item.ShippingStateName; inv.ShippingStreet = item.ShippingStreet; inv.ShippingZip = item.ShippingZip; if (inv.CustomerName.Trim().ToUpper() == "GUEST") { inv.CustomerName = item.ShippingName; if (inv.Country == Country.Slovakia) inv.CustomerEmail = "*****@*****.**"; if (inv.Country == Country.Hungary) inv.CustomerEmail = "*****@*****.**"; } /*IČO,DIČ,Company*/ // inv.company = item. // inv.TestValues = item.TestValues; } if (inv != null) { InvoiceItem newItem = new InvoiceItem(inv); newItem.ItemDiscount = item.ItemDiscount; newItem.ItemName = item.ItemName; newItem.ItemOptions = item.ItemOptions; newItem.ItemOrigPrice = item.ItemOrigPrice; newItem.ItemPrice = item.ItemPrice; newItem.ItemQtyCanceled = item.ItemQtyCanceled; newItem.ItemQtyInvoiced = item.ItemQtyInvoiced; newItem.ItemQtyOrdered = item.ItemQtyOrdered; newItem.ItemQtyRefunded = item.ItemQtyRefunded; newItem.ItemQtyShipped = item.ItemQtyShipped; newItem.invSKU = item.ItemSKU; newItem.ItemStatus = item.ItemStatus; newItem.ItemTax = item.ItemTax; newItem.ItemTotal = item.ItemTotal; newItem.OrderItemIncrement = item.OrderItemIncrement; if (inv.InvoiceItems == null) inv.InvoiceItems = new List<InvoiceItem>(); inv.InvoiceItems.Add(newItem); } } if (inv != null) AllInvoices.Add(inv); inv = null; } CurrentWaitingLoaded = new List<WaitingProductEntity>(); foreach (var item in AllInvoices) { var waiting = DBProvider.ReadWaitingInvoices(item.OrderNumber); CurrentWaitingLoaded.AddRange(waiting); var toAdd = waiting.Select(e => new InvoiceItem(e)).ToList(); toAdd.ForEach(it => it.Parent = item); item.InvoiceItems.AddRange(toAdd); } }
internal void CheckEqipped(Invoice inv) { if (inv == null) return; // objednavka je vybavena ak ma vsetky produkty priradene inv.Equipped = Common.IsEquipped(inv); }
private void SpracujZasielku(ephType xml, Invoice invoice, string prefix, string postfix, ref long code) { if (!IsPostaShipping(invoice)) return; var zasielka = new ephTypeZasielka(); zasielka.Adresat = new ephTypeZasielkaAdresat(); zasielka.Adresat.Email = invoice.CustomerEmail; zasielka.Adresat.Krajina = invoice.ShippingCountry; zasielka.Adresat.Meno = invoice.ShippingName; zasielka.Adresat.Mesto = invoice.ShippingCity; zasielka.Adresat.Organizacia = ""; zasielka.Adresat.PSC = invoice.ShippingZip; zasielka.Adresat.Telefon = invoice.ShippingPhoneNumber; zasielka.Adresat.Ulica = invoice.ShippingStreet; zasielka.Info = new ephTypeZasielkaInfo(); zasielka.Info.ZasielkaID = invoice.OrderNumber; zasielka.Info.Hmotnost = "0.000"; zasielka.Info.CenaDobierky = invoice.OrderGrandTotal;//VratCenuDopravy(invoice.InvoiceItems); //zasielka.Info.Trieda = "1"; zasielka.Info.CisloUctu = "2800328484/8330"; zasielka.Info.SymbolPrevodu = zasielka.Info.ZasielkaID; // VS ako zasielkaID zasielka.Info.Poznamka = zasielka.Info.SymbolPrevodu + "_Activestyle.sk"; zasielka.Info.DruhPPP = "5"; zasielka.Info.CiarovyKod = string.Format("{0}{1}{2}", prefix, code++, postfix); // "ER89069766SK"; zasielka.PouziteSluzby = new List<string>(); zasielka.PouziteSluzby.Add(""); zasielka.Spat = null; zasielka.DalsieUdaje = null; xml.Zasielky.Add(zasielka); }
bool IsPostaShipping(Invoice inv) { var method = inv.OrderShippingMethod.ToLower(); return method.Contains("flatrate3") || method.Contains("flatrate4"); }