public void GeneratePO(Product prod, int week, int year, PurchaseOrderType pot, int repositionpoint)
        {
            PurchaseOrderStatus pos = 0;
            PurchaseOrder       po  = GetPurchaseOrder(prod.Provider, pot, pos);

            PurchaseOrderItem poi = new PurchaseOrderItem();

            poi.PurchaseOrder = po;
            poi.Product       = prod;
            if (pot == (PurchaseOrderType)1)
            {
                poi.Forecast          = ControllerManager.Forecast.GetProductInfo(prod, Config.CurrentWeek + 1, Config.CurrentDate.Year);
                poi.QuantitySuggested = poi.Forecast.QuantitySuggested;
                poi.Quantity          = poi.Forecast.QuantitySuggested;
            }
            else if (pot == (PurchaseOrderType)2)
            {
                poi.Forecast          = ControllerManager.Forecast.GetProductInfo(prod, Config.CurrentWeek + 1, Config.CurrentDate.Year);
                poi.QuantitySuggested = repositionpoint;
                poi.Quantity          = repositionpoint;
            }

            po.PurchaseOrderItems.Add(poi);

            this.Save(po);
        }
Esempio n. 2
0
        public void Add(PurchaseOrderType order)
        {
            var id = orders.Count + 1;

            order.id = id.ToString();
            orders.Add(order.id, order);
        }
Esempio n. 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Purchase_type_id,Purchase_type_name")] PurchaseOrderType purchaseOrderType)
        {
            if (id != purchaseOrderType.Purchase_type_id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(purchaseOrderType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PurchaseOrderTypeExists(purchaseOrderType.Purchase_type_id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(purchaseOrderType));
        }
        public void GeneratePO(Product prod, int week, int year, PurchaseOrderType pot, int repositionpoint)
        {
            PurchaseOrderStatus pos = PurchaseOrderStatus.Open;

            // Busco si ya existe una orden de compra abierta para este proveedor
            PurchaseOrder po = GetPurchaseOrder(prod.Provider, pot, pos);

            PurchaseOrderItem poi = new PurchaseOrderItem();

            poi.PurchaseOrder = po;
            poi.Product       = prod;
            poi.Forecast      = ControllerManager.Forecast.GetProductInfo(prod, Config.CurrentWeek + 1, Config.CurrentDate.Year);
            if (pot == PurchaseOrderType.Forecast)
            {
                poi.QuantitySuggested = poi.Forecast.QuantitySuggested;
                poi.Quantity          = poi.Forecast.QuantitySuggested;
            }
            else if (pot == PurchaseOrderType.Manual)
            {
                poi.QuantitySuggested = repositionpoint;
                poi.Quantity          = repositionpoint;
            }

            po.PurchaseOrderItems.Add(poi);
            this.Save(po);
        }
Esempio n. 5
0
        public void Comment()
        {
            XDocument doc = XDocument.Parse(File.ReadAllText("XmlExamples/po.xml"));

            PurchaseOrderType po = new PurchaseOrderType(null, doc.Root);
            XElement          el = po.Comment.GetTarget();

            Assert.AreEqual("Hurry, my lawn is going wild!", el.Value);
        }
Esempio n. 6
0
 public PurchaseOrderProductsMaintain(string poStockName, PurchaseOrderItemInfoVM itemVM, PurchaseOrderType poType)
 {
     InitializeComponent();
     this.ucProduct.IsEnabled = false;
     this.itemVM           = UtilityHelper.DeepClone <PurchaseOrderItemInfoVM>(itemVM);
     this.itemVM.StockName = poStockName;
     currentPOType         = poType;
     this.Loaded          += new RoutedEventHandler(PurchaseOrderProductsMaintain_Loaded);
 }
Esempio n. 7
0
        public void OrderDate()
        {
            XDocument doc = XDocument.Parse(File.ReadAllText("XmlExamples/po.xml"));

            PurchaseOrderType po = new PurchaseOrderType(null, doc.Root);
            XAttribute        at = po.OrderDate.GetTarget();

            Assert.AreEqual("1999-10-20", at.Value);
        }
Esempio n. 8
0
 public static void DoWork(JobContext currentContext)
 {
     CurrentContext = currentContext;
     Begin          = DateTime.Today.AddDays(-1);
     End            = DateTime.Today;
     POType         = PurchaseOrderType.Normal;
     ProcessSO();
     POType = PurchaseOrderType.Negative;
     ProcessRO();
 }
Esempio n. 9
0
 public static OrderEditModel MapToEditModel(PurchaseOrderType purchaseOrderType)
 {
     return(new OrderEditModel
     {
         Id = purchaseOrderType.id,
         Date = purchaseOrderType.orderDate,
         Products = Mappers.Map(purchaseOrderType.items.item).ToList(),
         BillTo = GetAddressType(purchaseOrderType, ItemsChoiceType.billTo),
         ShipTo = GetAddressType(purchaseOrderType, ItemsChoiceType.shipTo)
     });
 }
Esempio n. 10
0
 private static int FindIndex(PurchaseOrderType purchaseOrderType, ItemsChoiceType itemsChoiceType)
 {
     for (var i = 0; i < purchaseOrderType.ItemsElementName.Length; i++)
     {
         if (purchaseOrderType.ItemsElementName[i] == itemsChoiceType)
         {
             return(i);
         }
     }
     return(-1);
 }
Esempio n. 11
0
        public async Task <IActionResult> Create([Bind("Purchase_type_id,Purchase_type_name")] PurchaseOrderType purchaseOrderType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(purchaseOrderType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(purchaseOrderType));
        }
Esempio n. 12
0
 public PurchaseOrderProductsNew(string poStockName, PurchaseOrderType poType)
 {
     InitializeComponent();
     //默认为上海仓:
     this.newVM = new PurchaseOrderItemInfoVM()
     {
         StockName = poStockName
     };
     currentPOType    = poType;
     this.DataContext = newVM;
 }
 public PurchaseOrderInformation(int id, string provider, DateTime orderdate, PurchaseOrderType type, WayOfDelivery wod, double amount, double quantity, string currency, double leadtime)
 {
     this.id         = id;
     this.orderdate  = orderdate;
     this.provider   = provider;
     this.type       = type.ToString();
     this.wOD        = wod;
     this.amount     = amount;
     this.totalcount = Convert.ToInt32(quantity);
     this.currency   = currency;
     this.leadtime   = Convert.ToInt32(leadtime);
 }
Esempio n. 14
0
        public static OrderViewModel Map(PurchaseOrderType order)
        {
            var vm = new OrderViewModel
            {
                Id        = order.id,
                Date      = order.orderDate,
                Shipped   = order.shipped,
                Addresses = Map(order.Items),
                Products  = Map(order.items.item)
            };

            return(vm);
        }
        public void GenerateFullPO(int week, int year, PurchaseOrderType orderType)
        {
            PurchaseOrderStatus orderStatus = PurchaseOrderStatus.Open;

            IList <Forecast>     lst            = ControllerManager.Forecast.GetPOList((Config.CurrentWeek == 53) ? 1 : Config.CurrentWeek + 1, (Config.CurrentWeek == 53) ? Config.CurrentDate.Year + 1 : Config.CurrentDate.Year);
            List <PurchaseOrder> purchaseOrders = GetByCriteria(new EqExpression("PurchaseOrderType", orderType), new EqExpression("PurchaseOrderStatus", orderStatus), new EqExpression("Date", Config.CurrentDate)) as List <PurchaseOrder>;

            foreach (Forecast forecast in lst)
            {
                PurchaseOrder po = purchaseOrders.Find(delegate(PartnerNet.Domain.PurchaseOrder record)
                {
                    if (record.Provider == forecast.Product.Provider)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                });

                if (po == null)
                {
                    po                     = new PurchaseOrder();
                    po.Provider            = forecast.Product.Provider;
                    po.Date                = Config.CurrentDate;
                    po.PurchaseOrderStatus = orderStatus;
                    po.PurchaseOrderType   = orderType;
                    po.WOD                 = WayOfDelivery.Maritimo;
                    purchaseOrders.Add(po);
                }

                PurchaseOrderItem poi = new PurchaseOrderItem();
                poi.PurchaseOrder = po;
                poi.Product       = forecast.Product;
                poi.Forecast      = forecast;

                if (orderType == PurchaseOrderType.Forecast)
                {
                    poi.QuantitySuggested = poi.Forecast.QuantitySuggested;
                    poi.Quantity          = poi.Forecast.QuantitySuggested;
                }

                po.PurchaseOrderItems.Add(poi);

                Save(po);
            }

            NHibernateSession.Flush();
        }
Esempio n. 16
0
        public PurchaseOrdersType GetNotShipped()
        {
            var collection       = new PurchaseOrderType[orders.Values.Count(o => !o.shipped)];
            var notShippedOrders = orders.Values.Where(o => !o.shipped);
            var i = 0;

            foreach (var order in notShippedOrders)
            {
                collection[i] = order;
                i++;
            }

            return(new PurchaseOrdersType {
                orders = collection
            });
        }
Esempio n. 17
0
        private static AddressType GetAddressType(PurchaseOrderType purchaseOrderType, ItemsChoiceType itemsChoiceType)
        {
            if (!purchaseOrderType.ItemsElementName.Any(i => i == itemsChoiceType))
            {
                return(new AddressType());
            }

            var index = FindIndex(purchaseOrderType, itemsChoiceType);

            if (index == -1)
            {
                return(new AddressType());
            }

            return(purchaseOrderType.Items[index]);
        }
Esempio n. 18
0
        public PurchaseOrder GetPurchaseOrder(Provider provider, PurchaseOrderType pot, PurchaseOrderStatus pos)
        {
            ICriteria crit = GetCriteria();

            crit.Add(new EqExpression("Provider", provider));
            crit.Add(new EqExpression("Date", Config.CurrentDate));
            crit.Add(new EqExpression("PurchaseOrderType", pot));
            crit.Add(new EqExpression("PurchaseOrderStatus", pos));

            PurchaseOrder po = crit.UniqueResult <PurchaseOrder>();

            if (po == null)
            {
                po                     = new PurchaseOrder();
                po.Provider            = provider;
                po.Date                = Config.CurrentDate;
                po.PurchaseOrderStatus = 0;
                po.PurchaseOrderType   = pot;
            }
            return(po);
        }
Esempio n. 19
0
        public PurchaseOrderType GetOrders()
        {
            PurchaseOrderType order = new PurchaseOrderType
            {
                ShipTo = new USAddress[]
                {
                    new USAddress
                    {
                        name    = "John",
                        street  = "WolfStreet",
                        city    = "LA",
                        state   = "WhoKnows",
                        country = "US",
                        zip     = "4444"
                    },
                    new USAddress
                    {
                        name    = "Bryan",
                        street  = "WolfStreet",
                        city    = "LA",
                        state   = "WhoKnows",
                        country = "US",
                        zip     = "4444"
                    }
                },
                BillTo = new USAddress
                {
                    name    = "John",
                    street  = "WolfStreet",
                    city    = "LA",
                    state   = "WhoKnows",
                    country = "US",
                    zip     = "4444"
                },
                OrderDate          = DateTime.Now,
                OrderDateSpecified = true
            };

            return(order);
        }
        private void gridOrderView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            if (e != null && e.PrevFocusedRowHandle < -1)
            {
                return;
            }

            if (gridOrderView.GetFocusedDataRow() != null)
            {
                var dr = gridOrderView.GetFocusedDataRow();

                int    OrderID = Convert.ToInt32(dr["ID"]);
                string sharps  = Helpers.FormattingHelpers.GetNumberFormatting();
                Order = new PO(OrderID);
                RefreshInvoice();
                RefreshPoDetail();
                // Layout  ... Show the damn correct layout

                // Hide the empty layout
                LayoutEmptyDetails.Visibility        = LayoutVisibility.Never;
                LayoutSelectedOrderDetail.Visibility = LayoutVisibility.Always;

                int Currency = 0x0409;
                if (!Order.IsColumnNull("LCID"))
                {
                    Currency = Order.LCID;
                }

                if (!string.IsNullOrEmpty(Order.s_PurchaseType))
                {
                    PurchaseTypes = POType.GetAllPOTypes().Find(t => t.ID == Order.PurchaseType);
                }
                string  space = "";
                DataRow dar   = gridInvoiceView.GetFocusedDataRow();
                HeaderGroup.Text = "PO No: " + dr["OrderNumber"].ToString();
                if (dar != null)
                {
                    HeaderGroup.Text = HeaderGroup.Text + space.PadRight(160) + "Invoice No: " + gridInvoiceView.GetFocusedDataRow()["STVOrInvoiceNo"];
                }

                // lblOrderType.Text = PurchaseTypes != null ?  string.Format("{0} : {1}" ,PurchaseTypes.Group , PurchaseTypes.Name) : "";
                lblPONumber.Text   = Order.PONumber;
                lblTotalValue.Text = Order.TotalValue.ToString(Helpers.FormattingHelpers.GetCurrencyFormatByLCID(Currency));
                lblInsurance.Text  = Order.Insurance.ToString(Helpers.FormattingHelpers.GetBirrFormatting());
                lblNBE.Text        = Order.NBE.ToString(Helpers.FormattingHelpers.GetBirrFormatting());
                lblSupplier.Text   = Order.Supplier.CompanyName;
                lblShipper.Text    = String.IsNullOrEmpty(Order.ShippingSite) ? "-" : Order.ShippingSite;
                lblLetterNo.Text   = String.IsNullOrEmpty(Order.LetterNo) ? "-" : Order.LetterNo;
                lblPOType.Text     = dr["Name"].ToString();

                var PaymentType = new PaymentType();
                PaymentType.LoadByPrimaryKey(Order.PaymentTypeID);
                lblPaymentType.Text = String.IsNullOrEmpty(PaymentType.Name) ? "-" : PaymentType.Name;

                var User = new User();
                User.LoadByPrimaryKey(Order.SavedbyUserID);
                lblPOBy.Text = String.IsNullOrEmpty(User.FullName) ? "-" : User.FullName;

                if (!Order.IsColumnNull("ModeID"))
                {
                    var Mode = new Mode();
                    Mode.LoadByPrimaryKey(Order.ModeID);
                    lblMode.Text = Mode.TypeName;
                }
                else
                {
                    lblMode.Text = "-";
                }



                if (!Order.IsColumnNull("PurchaseOrderStatusID"))
                {
                    var poStatus = new PurchaseOrderStatus();
                    poStatus.LoadByPrimaryKey(Order.PurchaseOrderStatusID);
                    lblPOStatus.Text = poStatus.Name;
                }


                chkboxIsElectronic.Checked = Order.IsElectronic;
                lblOrderDate.Text          = Order.PODate.ToShortDateString();
                lblSyncDate.Text           = Order.ModifiedDate == DateTime.MinValue ? "NA" :  Order.ModifiedDate.ToString(CultureInfo.InvariantCulture);

                if (!Order.IsColumnNull("StoreID"))
                {
                    Activity act = new Activity();
                    act.LoadByPrimaryKey(Order.StoreID);
                    lblAccount.Text    = act.AccountName;
                    lblSubAccount.Text = act.SubAccountName;
                    lblActivity.Text   = act.Name;
                }
                else
                {
                    lblAccount.Text = lblSubAccount.Text = lblActivity.Text = "-";
                }

                lblRefNo.Text          = String.IsNullOrEmpty(Order.RefNo) ? "-" : Order.RefNo;
                lblRemainingValue.Text = Order.Remaining.ToString(Helpers.FormattingHelpers.GetCurrencyFormatByLCID(Currency));
                if (BLL.Settings.UseNewUserManagement && this.HasPermission("Add-Invoice"))
                {
                    btnAddInvoice.Enabled = true;
                }
                else if (BLL.Settings.UseNewUserManagement)
                {
                    btnAddInvoice.Enabled = false;
                }

                btnAddInvoice.Enabled = btnEditOrder.Enabled = btnAddOrderDetail.Enabled = !Order.IsElectronic;

                if (Order.IsElectronic)
                {
                    grdPoDetail.Enabled = false;
                    gridInvoice.Enabled = false;
                }
                else
                {
                    grdPoDetail.Enabled = true;
                    gridInvoice.Enabled = true;
                }

                //purchse order details
                grdPoDetail.DataSource = Order.PurchaseOrderDetail.DefaultView;
            }
            else
            {
                // Hide the empty layout
                LayoutEmptyDetails.Visibility        = LayoutVisibility.Always;
                LayoutSelectedOrderDetail.Visibility = LayoutVisibility.Never;
            }
        }
Esempio n. 21
0
        public PurchaseOrderType Post([ModelBinder(typeof(PurchaseOrderTypeModelBinder))] PurchaseOrderType request)
        {
            request.comment = "a comment";

            return(request);
        }
Esempio n. 22
0
 public void Update(PurchaseOrderType order)
 {
     orders[order.id] = order;
 }
Esempio n. 23
0
 public PurchaseOrderInformation(int id, Provider provider, DateTime orderdate, PurchaseOrderType type)
 {
     this.id        = id;
     this.orderdate = orderdate;
     this.provider  = provider.Name;
     this.type      = type.ToString();
 }
        public static void InitializeRepository()
        {
            var ordersRepository = new OrdersRepository();

            var order = new PurchaseOrderType();

            order.shipped            = false;
            order.orderDateSpecified = true;
            order.orderDate          = DateTime.Now;
            order.items = new ItemsType();

            var items = new Collection <ItemsTypeItem>();

            items.Add(new ItemsTypeItem
            {
                productName = "XBOX One",
                partNum     = "5465653",
                quantity    = "1",
                USPrice     = 400
            });
            order.items.item = items.ToArray();

            var addresses = new Collection <AddressType>();

            addresses.Add(new AddressType
            {
                name   = "John Doe",
                city   = "LA",
                street = "35, Rodeo Dr"
            });
            order.Items            = addresses.ToArray();
            order.ItemsElementName = new[] { ItemsChoiceType.shipTo };
            ordersRepository.Add(order);

            var order2 = new PurchaseOrderType();

            order2.shipped            = true;
            order2.orderDateSpecified = true;
            order2.orderDate          = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0));
            order2.items = new ItemsType();
            var items2 = new Collection <ItemsTypeItem>();

            items2.Add(new ItemsTypeItem
            {
                productName = "iPod Nano",
                partNum     = "32312312",
                quantity    = "2",
                USPrice     = 200
            });
            order2.items.item = items2.ToArray();
            var addresses2 = new Collection <AddressType>();

            addresses2.Add(new AddressType
            {
                name   = "Jack Smith",
                city   = "NY",
                street = "433, Fith Av."
            });
            order2.ItemsElementName = new[] { ItemsChoiceType.shipTo };
            order2.Items            = addresses2.ToArray();

            ordersRepository.Add(order2);

            var order3 = new PurchaseOrderType();

            order3.shipped            = true;
            order3.orderDateSpecified = true;
            order3.orderDate          = DateTime.Now.Subtract(new TimeSpan(5, 0, 0, 0));
            order3.items = new ItemsType();

            var items3 = new Collection <ItemsTypeItem>();

            items3.Add(new ItemsTypeItem
            {
                productName = "iPod Nano Touch",
                partNum     = "32312888",
                quantity    = "1",
                USPrice     = 250,
                shipDate    = DateTime.Now,
                weightKg    = 1
            });
            order3.items.item = items3.ToArray();

            var addresses3 = new Collection <AddressType>();

            addresses3.Add(new AddressType
            {
                name   = "Will Jackson",
                city   = "NY",
                street = "433, Fith Av."
            });
            addresses3.Add(new AddressType
            {
                name   = "Mary Jackson",
                city   = "NY",
                street = "433, Fith Av."
            });
            order3.ItemsElementName = new[] { ItemsChoiceType.shipTo, ItemsChoiceType.billTo };
            order3.Items            = addresses3.ToArray();

            ordersRepository.Add(order3);
        }
Esempio n. 25
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            UnityConfig.RegisterComponents();

            var ordersRepository = new OrdersRepository();

            var order = new PurchaseOrderType();

            order.shipped            = false;
            order.orderDateSpecified = true;
            order.orderDate          = DateTime.Now;
            order.items = new ItemsType();

            var items = new Collection <ItemsTypeItem>();

            items.Add(new ItemsTypeItem
            {
                productName = "XBOX One",
                partNum     = "5465653",
                quantity    = "1",
                USPrice     = 400
            });
            order.items.item = items.ToArray();

            var addresses = new Collection <AddressType>();

            addresses.Add(new AddressType
            {
                city   = "LA",
                street = "35, Rodeo Dr"
            });
            order.Items            = addresses.ToArray();
            order.ItemsElementName = new[] { ItemsChoiceType.shipTo };
            ordersRepository.Add(order);

            var order2 = new PurchaseOrderType();

            order2.shipped            = true;
            order2.orderDateSpecified = true;
            order2.orderDate          = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0));
            order2.items = new ItemsType();
            var items2 = new Collection <ItemsTypeItem>();

            items2.Add(new ItemsTypeItem
            {
                productName = "iPod Nano",
                partNum     = "32312312",
                quantity    = "2",
                USPrice     = 200
            });
            order2.items.item = items2.ToArray();
            var addresses2 = new Collection <AddressType>();

            addresses2.Add(new AddressType
            {
                city   = "NY",
                street = "433, Fith Av."
            });
            order2.ItemsElementName = new[] { ItemsChoiceType.shipTo };
            order2.Items            = addresses2.ToArray();

            ordersRepository.Add(order2);

            var order3 = new PurchaseOrderType();

            order3.shipped            = true;
            order3.orderDateSpecified = true;
            order3.orderDate          = DateTime.Now.Subtract(new TimeSpan(5, 0, 0, 0));
            order3.items = new ItemsType();

            var items3 = new Collection <ItemsTypeItem>();

            items3.Add(new ItemsTypeItem
            {
                productName = "iPod Nano Touch",
                partNum     = "32312888",
                quantity    = "1",
                USPrice     = 250,
                shipDate    = DateTime.Now,
                weightKg    = 1
            });
            order3.items.item = items3.ToArray();

            ordersRepository.Add(order3);
        }