Ejemplo n.º 1
0
 private void FilterAssignedCustomers()
 {
     productionXPView.Filter    = new InOperator("CustomerID", UsersCustomerBLL.GetAssignedCustomerIDs(m_ProductionSession));
     customersXPView.Criteria   = CriteriaOperator.And(new BinaryOperator(Customers.Fields.Inactive.PropertyName, false), new InOperator(Customers.Fields.CustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomers(m_ProductionSession)));
     itemsFilterXPView.Criteria = CriteriaOperator.And(new InOperator(Items.Fields.ItemCustomerID.CustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomers(m_ProductionSession)), new InOperator(Items.Fields.ItemType.PropertyName, new string[] { "FG", "IG" }), new BinaryOperator(Items.Fields.Inactive.PropertyName, false, BinaryOperatorType.Equal));
     itemsXPView.Criteria       = CriteriaOperator.And(new InOperator(Items.Fields.ItemCustomerID.CustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomers(m_ProductionSession)), new InOperator(Items.Fields.ItemType.PropertyName, new string[] { "FG", "IG" }), new BinaryOperator(Items.Fields.Inactive.PropertyName, false, BinaryOperatorType.Equal));
 }
Ejemplo n.º 2
0
 private void FilterAssignedCustomers()
 {
     inventoryXPView.Filter         = new InOperator("CustomerID", UsersCustomerBLL.GetAssignedCustomerIDs(XpoDefault.Session));
     customersXPView.Criteria       = CriteriaOperator.And(new BinaryOperator(Customers.Fields.Inactive.PropertyName, false), new InOperator(Customers.Fields.CustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomers(XpoDefault.Session)));
     customersFilterXPView.Criteria = CriteriaOperator.And(new BinaryOperator(Customers.Fields.Inactive.PropertyName, false), new InOperator(Customers.Fields.CustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomers(XpoDefault.Session)));
     itemsFilterXPView.Criteria     = new InOperator(Items.Fields.ItemCustomerID.CustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomers(XpoDefault.Session));
     itemsXPView.Criteria           = CriteriaOperator.And(new BinaryOperator(Items.Fields.Inactive.PropertyName, false), new InOperator(Items.Fields.ItemCustomerID.CustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomers(XpoDefault.Session)));
 }
Ejemplo n.º 3
0
        public static XPView GetCurrentInventoryReport(int?customerID, string itemType, string items, bool?inactiveItems, bool?inactiveCustomers, bool?outOfStockItems, bool onlyAssignedCustomers, int?locationID)
        {
            XPView CurrentInventoryReportXPView    = new XPView(Session.DefaultSession, typeof(LocationInventory));
            CriteriaOperatorCollection theCriteria = new CriteriaOperatorCollection();

            if (customerID.HasValue)
            {
                theCriteria.Add(new BinaryOperator(LocationInventory.Fields.LocationInventoryItem.ItemCustomerID.CustomerID.PropertyName, customerID.Value, BinaryOperatorType.Equal));
            }
            if (string.IsNullOrEmpty(itemType) == false)
            {
                theCriteria.Add(new BinaryOperator(LocationInventory.Fields.LocationInventoryItem.ItemType.PropertyName, itemType, BinaryOperatorType.Equal));
            }
            if (inactiveCustomers.Value == false)
            {
                theCriteria.Add(new BinaryOperator(LocationInventory.Fields.LocationInventoryItem.ItemCustomerID.Inactive.PropertyName, false));
            }
            if (inactiveItems.Value == false)
            {
                theCriteria.Add(new BinaryOperator(LocationInventory.Fields.LocationInventoryItem.Inactive.PropertyName, false));
            }
            if (string.IsNullOrEmpty(items) == false)
            {
                theCriteria.Add(new InOperator(LocationInventory.Fields.LocationInventoryItem.ItemID.PropertyName, items.Split('|')));
            }
            if (outOfStockItems.HasValue == false || outOfStockItems == false)
            {
                theCriteria.Add(new BinaryOperator(LocationInventory.Fields.QuantityOnHand.PropertyName, 1, BinaryOperatorType.GreaterOrEqual));
            }
            if (onlyAssignedCustomers == true)
            {
                theCriteria.Add(new InOperator(LocationInventory.Fields.LocationInventoryItem.ItemCustomerID.CustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomerIDs(XpoDefault.Session)));
            }
            if (locationID.HasValue)
            {
                theCriteria.Add(new BinaryOperator(LocationInventory.Fields.Location.Oid.PropertyName, locationID.Value, BinaryOperatorType.Equal));
            }

            try
            {
                CurrentInventoryReportXPView.Criteria = CriteriaOperator.And(theCriteria);
                CurrentInventoryReportXPView.Properties.AddRange(new ViewProperty[]
                {
                    new ViewProperty("CustomerName", SortDirection.Ascending, LocationInventory.Fields.LocationInventoryItem.ItemCustomerID.CustomerName.PropertyName, false, true),
                    new ViewProperty("ItemCode", SortDirection.Ascending, LocationInventory.Fields.LocationInventoryItem.ItemCode.PropertyName, false, true),
                    new ViewProperty("ItemDescription", SortDirection.None, LocationInventory.Fields.LocationInventoryItem.ItemDescription.PropertyName, false, true),
                    new ViewProperty("ItemType", SortDirection.None, CriteriaOperator.Parse(string.Format("IIF({0} = 'RM', 'Raw Material', IIF({0} = 'IG', 'Intermediate Goods', 'Finished Goods'))", LocationInventory.Fields.LocationInventoryItem.ItemType.PropertyName)), false, true),
                    new ViewProperty("QuantityOnHand", SortDirection.None, LocationInventory.Fields.QuantityOnHand.PropertyName, false, true),
                    new ViewProperty("InventoryByPallets", SortDirection.None, CriteriaOperator.Parse(string.Format("IIF({1} = 0, 0, {0} / {1})", LocationInventory.Fields.QuantityOnHand.PropertyName, LocationInventory.Fields.LocationInventoryItem.intUnitsPerPallet.PropertyName)), false, true),
                    new ViewProperty("UOM", SortDirection.None, LocationInventory.Fields.LocationInventoryItem.strUnitOfMeasure.PropertyName, false, true),
                    new ViewProperty("Location", SortDirection.None, LocationInventory.Fields.Location.LocationCode.PropertyName, false, true),
                    new ViewProperty("InactiveCustomer", SortDirection.None, LocationInventory.Fields.LocationInventoryItem.ItemCustomerID.Inactive.PropertyName, false, true),
                    new ViewProperty("InactiveItem", SortDirection.None, LocationInventory.Fields.LocationInventoryItem.Inactive.PropertyName, false, true)
                });
                return(CurrentInventoryReportXPView);
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(string.Format("There was an error while trying to retrieve the data for the report.{0}{1}", Environment.NewLine, ex.Message));
            }

            return(null);
        }
Ejemplo n.º 4
0
 private void FilterAssignedCustomers()
 {
     poolSearchXpView.Criteria = new InOperator(ItemPool.Fields.PoolCustomerID.CustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomers(m_ItemPoolSession));
 }
Ejemplo n.º 5
0
        public static XPView GetShippingReturnsReport(DateTime?fromDate, DateTime?toDate, int?shiftID, int?customerID, string lot, string BOL, int?destinationID, int?carrierID, string items, bool?inactiveItems, bool?inactiveCustomers, bool onlyAssignedCustomers)
        {
            XPView ShippingReturnsReportXPView     = new XPView(Session.DefaultSession, typeof(ShippedReturns));
            CriteriaOperatorCollection theCriteria = new CriteriaOperatorCollection();

            if (fromDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ShipMainID.ShipMainDate", fromDate.Value, BinaryOperatorType.GreaterOrEqual));
            }
            if (toDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ShipMainID.ShipMainDate", toDate.Value, BinaryOperatorType.LessOrEqual));
            }
            if (string.IsNullOrEmpty(BOL) == false)
            {
                theCriteria.Add(new BinaryOperator("ShipMainID.ShipMainBOL", BOL, BinaryOperatorType.Equal));
            }
            //If String.IsNullOrEmpty(po) = False Then
            //    theCriteria.Add(New BinaryOperator("ShipMainID.strPO", po, BinaryOperatorType.Equal))
            //End If
            //If String.IsNullOrEmpty(deliveryNoteNumber) = False Then
            //    theCriteria.Add(New BinaryOperator("ShipMainID.DeliveryNoteNumber", deliveryNoteNumber, BinaryOperatorType.Equal))
            //End If
            if (shiftID.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ShipMainID.Shift", shiftID.Value, BinaryOperatorType.Equal));
            }
            if (customerID.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ShipMainID.ShipMainCustID", customerID.Value, BinaryOperatorType.Equal));
            }
            if (carrierID.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ShipMainID.ShipMainCarrierID", carrierID.Value, BinaryOperatorType.Equal));
            }
            if (destinationID.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ShipMainID.intDestination", destinationID.Value, BinaryOperatorType.Equal));
            }
            if (string.IsNullOrEmpty(lot) == false)
            {
                theCriteria.Add(new BinaryOperator("ReturnDetLot", lot, BinaryOperatorType.Equal));
            }
            if (inactiveCustomers.Value == false)
            {
                theCriteria.Add(new BinaryOperator("ShipMainID.ShipMainCustID.Inactive", false));
            }
            if (inactiveItems.Value == false)
            {
                theCriteria.Add(new BinaryOperator("ReturnDetItemID.Inactive", false));
            }
            if (string.IsNullOrEmpty(items) == false)
            {
                theCriteria.Add(new InOperator("ReturnDetItemID", items.Split('|')));
            }
            if (onlyAssignedCustomers == true)
            {
                theCriteria.Add(new InOperator("ShipMainID.ShipMainCustID", UsersCustomerBLL.GetAssignedCustomerIDs(XpoDefault.Session)));
            }

            try
            {
                ShippingReturnsReportXPView.Criteria = CriteriaOperator.And(theCriteria);
                ShippingReturnsReportXPView.Properties.AddRange(new ViewProperty[]
                {
                    new ViewProperty("ShipMainDate", SortDirection.Ascending, "[ShipMainID].[ShipMainDate]", false, true),
                    new ViewProperty("ShiftName", SortDirection.None, "[ShipMainID].[Shift].[ShiftName]", false, true),
                    new ViewProperty("CustomerName", SortDirection.Ascending, "[ShipMainID].[ShipMainCustID].[CustomerName]", false, true),
                    new ViewProperty("ShipMainBOL", SortDirection.None, "[ShipMainID].[ShipMainBOL]", false, true),
                    new ViewProperty("strPO", SortDirection.None, "[ShipMainID].[strPO]", false, true),
                    new ViewProperty("DeliveryNoteNumber", SortDirection.None, "[ShipMainID].[DeliveryNoteNumber]", false, true),
                    new ViewProperty("ShippingName", SortDirection.None, "[ShipMainID].[intDestination].[ShippingName]", false, true),
                    new ViewProperty("ReturnDetLot", SortDirection.None, "[ReturnDetLot]", false, true),
                    new ViewProperty("ItemCode", SortDirection.Ascending, "[ReturnDetItemID].[ItemCode]", false, true),
                    new ViewProperty("ItemDescription", SortDirection.None, "[ReturnDetItemID].[ItemDescription]", false, true),
                    new ViewProperty("intUnits", SortDirection.None, "[intUnits]", false, true),
                    new ViewProperty("CarrierName", SortDirection.None, "[ShipMainID].[ShipMainCarrierID].[CarrierName]", false, true),
                    new ViewProperty("strTrailer", SortDirection.None, "[ShipMainID].[strTrailer]", false, true),
                    new ViewProperty("strSeal", SortDirection.None, "[ShipMainID].[strSeal]", false, true),
                    new ViewProperty("ExpirationDate", SortDirection.None, "[ExpirationDate]", false, true),
                    new ViewProperty("ExpirationDateFormat", SortDirection.None, "[ShipMainID].[ShipMainCustID].[ExpirationDateFormat]", false, true)
                });
                return(ShippingReturnsReportXPView);
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(string.Format("There was an error while trying to retrieve the data for the report.{0}{1}", Environment.NewLine, ex.Message));
            }

            return(null);
        }
Ejemplo n.º 6
0
        public ItemTransactionSummaryList GetItemTransactionSummaryReport(DateTime?fromDate, DateTime?toDate, int?itemCustomerID, string items, string itemType, bool onlyAssigned)
        {
            if (fromDate.HasValue == false && toDate.HasValue == false && itemCustomerID.HasValue == false && string.IsNullOrEmpty(items))
            {
                return(null);
            }

            ItemTransactionSummaryList transactionsSummaryList = new ItemTransactionSummaryList();

            try
            {
                XPView itemsXPView = null;
                CriteriaOperatorCollection theCriteria = new CriteriaOperatorCollection();

                if (itemCustomerID.HasValue)
                {
                    theCriteria.Add(new BinaryOperator("ItemCustomerID", itemCustomerID.Value, BinaryOperatorType.Equal));
                }
                if (onlyAssigned)
                {
                    theCriteria.Add(new InOperator("ItemCustomerID", UsersCustomerBLL.GetAssignedCustomerIDs(XpoDefault.Session)));
                }
                if (string.IsNullOrEmpty(itemType) == false)
                {
                    theCriteria.Add(new BinaryOperator("ItemType", itemType, BinaryOperatorType.Equal));
                }
                if (string.IsNullOrEmpty(items) == false)
                {
                    theCriteria.Add(new InOperator("ItemID", items.Split('|')));
                }

                itemsXPView = new XPView(Session.DefaultSession, typeof(Items))
                {
                    Criteria = CriteriaOperator.And(theCriteria)
                };
                itemsXPView.Properties.Add(new ViewProperty("ItemID", SortDirection.None, "ItemID", false, true));

                foreach (ViewRecord item in itemsXPView)
                {
                    transactionSummary = new ItemTransactionSummary();
                    Items currentItem = Session.DefaultSession.GetObjectByKey <Items>(item["ItemID"]);
                    transactionSummary.CustomerName    = currentItem.ItemCustomerID.CustomerName;
                    transactionSummary.ItemCode        = currentItem.ItemCode;
                    transactionSummary.ItemDescription = currentItem.ItemDescription;
                    transactionSummary.ItemType        = ((currentItem.ItemType == "RM") ? "Raw Material" : ((currentItem.ItemType == "IG") ? "Intermediate Goods" : "Finished Goods")).ToString();
                    AddReceivingsToSumary(fromDate, toDate, currentItem.ItemID);
                    AddShippingsToSummary(fromDate, toDate, currentItem.ItemID);
                    AddAdjustmentsToSummary(fromDate, toDate, currentItem.ItemID);
                    AddProductionToSummary(fromDate, toDate, currentItem.ItemID);
                    AddUsedInProductiontoSummary(fromDate, toDate, currentItem.ItemID);
                    if (transactionSummary.Received != 0 || transactionSummary.Produced != 0 || transactionSummary.Adjusted != 0 || transactionSummary.Shipped != 0 || transactionSummary.UsedInProduction != 0)
                    {
                        transactionsSummaryList.Add(transactionSummary);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("There was an error while trying to retrieve the data for the report.{0}{1}", Environment.NewLine, ex.Message));
                return(null);
            }

            return(transactionsSummaryList);
        }
Ejemplo n.º 7
0
        public static XPView GetProductionBillingReportView(bool onlyAssigned)
        {
            XPView productionBillingReportXPView = new XPView(Session.DefaultSession, typeof(Inventory));

            try
            {
                if (onlyAssigned)
                {
                    productionBillingReportXPView.Criteria = new InOperator(Inventory.Fields.InventoryItemID.ItemCustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomerIDs(XpoDefault.Session));
                }
                productionBillingReportXPView.Properties.AddRange(new ViewProperty[]
                {
                    new ViewProperty("Production Date", SortDirection.Ascending, Inventory.Fields.InventoryDate, true, true),
                    new ViewProperty("Customer Name", SortDirection.Ascending, Inventory.Fields.InventoryItemID.ItemCustomerID.CustomerName, true, true),
                    new ViewProperty("Item #", SortDirection.Ascending, Inventory.Fields.InventoryItemID.ItemCode, true, true),
                    new ViewProperty("Item Description", SortDirection.None, Inventory.Fields.InventoryItemID.ItemDescription, true, true),
                    new ViewProperty("Item Type", SortDirection.None, CriteriaOperator.Parse(string.Format("IIF({0} = 'RM', 'Raw Material', IIF({0} = 'IG', 'Intermediate Goods', 'Finished Goods'))", Inventory.Fields.InventoryItemID.ItemType.PropertyName)), true, true),
                    new ViewProperty("Shift", SortDirection.Ascending, Inventory.Fields.Shift.ShiftName, true, true),
                    new ViewProperty("PO #", SortDirection.Ascending, Inventory.Fields.PO, true, true),
                    new ViewProperty("UOM", SortDirection.Ascending, Inventory.Fields.InventoryItemID.strUnitOfMeasure, true, true),
                    new ViewProperty("Quantity", SortDirection.None, CriteriaOperator.Parse(string.Format("Sum({0})", Inventory.Fields.InventoryQuantity.PropertyName)), false, true),
                    new ViewProperty("Cases", SortDirection.Ascending, CriteriaOperator.Parse(string.Format("Sum({0}/{1})", Inventory.Fields.InventoryQuantity.PropertyName, Inventory.Fields.InventoryItemID.intUnitsPerCase.PropertyName)), false, true),
                    new ViewProperty("Price", SortDirection.Ascending, CriteriaOperator.Parse(string.Format("Sum({0}*{1})", Inventory.Fields.InventoryQuantity.PropertyName, Inventory.Fields.InventoryItemID.dblPrice.PropertyName)), false, true)
                });
                return(productionBillingReportXPView);
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(string.Format("There was an error while trying to retrieve the data for the report.{0}{1}", Environment.NewLine, ex.Message));
            }

            return(null);
        }
Ejemplo n.º 8
0
 private void FilterAssignedCustomers()
 {
     customerSearchXPView.Criteria = new InOperator(Customers.Fields.CustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomers(m_CustomersSession));
     customersXpView.Criteria      = new InOperator(Customers.Fields.CustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomers(m_CustomersSession));
 }
Ejemplo n.º 9
0
        private static void AddRMItems(Session ReportSession, bool OnlyAssignedCustomers)
        {
            XPCollection <LocationInventory> itemCollection = null;
            CriteriaOperatorCollection       theCriteria    = new CriteriaOperatorCollection();
            VRMItemKey VRMKey = new VRMItemKey();

            theCriteria.Add(new BinaryOperator(LocationInventory.Fields.LocationInventoryItem.ItemType.PropertyName, "RM", BinaryOperatorType.Equal));

            if (OnlyAssignedCustomers)
            {
                theCriteria.Add(new InOperator(LocationInventory.Fields.LocationInventoryItem.ItemCustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomerIDs(ReportSession)));
            }

            itemCollection = new XPCollection <LocationInventory>(ReportSession, new GroupOperator(GroupOperatorType.And, theCriteria));

            foreach (LocationInventory item in itemCollection)
            {
                VRMKey.ItemCode = item.LocationInventoryItem.ItemCode;
                VRMKey.Location = item.Location.LocationCode;

                if (CurrentRMInventoryDictionary.ContainsKey(VRMKey))
                {
                    CurrentRMInventoryDictionary[VRMKey].QuantityOnHand += item.QuantityOnHand;
                }
                else
                {
                    CurrentRMInventoryDictionary.Add(VRMKey, new VRMItem()
                    {
                        Item = item
                    });
                }
            }
        }
Ejemplo n.º 10
0
        private static void AddIGStockAsRM(Session ReportSession, bool OnlyAssignedCustomers)
        {
            XPCollection <LocationInventory> igCollection = null;
            CriteriaOperatorCollection       theCriteria  = new CriteriaOperatorCollection();
            VRMItemKey VRMKey = new VRMItemKey();

            theCriteria.Add(new BinaryOperator(LocationInventory.Fields.LocationInventoryItem.ItemType.PropertyName, "IG", BinaryOperatorType.Equal));

            if (OnlyAssignedCustomers)
            {
                theCriteria.Add(new InOperator(LocationInventory.Fields.LocationInventoryItem.ItemCustomerID.CustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomerIDs(ReportSession)));
            }

            igCollection = new XPCollection <LocationInventory>(ReportSession, new GroupOperator(GroupOperatorType.And, theCriteria));

            foreach (LocationInventory item in igCollection)
            {
                foreach (BOMs bom in item.LocationInventoryItem.ItemBOM)
                {
                    VRMKey.ItemCode = bom.BOMRawMatID.ItemCode;
                    VRMKey.Location = item.Location.LocationCode;

                    if (CurrentRMInventoryDictionary.ContainsKey(VRMKey))
                    {
                        CurrentRMInventoryDictionary[VRMKey].QuantityOnHand += Convert.ToSingle(item.QuantityOnHand * (bom.BOMQuantity + (bom.BOMQuantity * (bom.ScrapFactor / 100))));
                    }
                    else
                    {
                        if (bom.BOMRawMatID.ItemType == "RM")
                        {
                            CurrentRMInventoryDictionary.Add(VRMKey, new VRMItem()
                            {
                                Item = ReportSession.FindObject <LocationInventory>(new BinaryOperator(LocationInventory.Fields.LocationInventoryItem.PropertyName, bom.BOMRawMatID, BinaryOperatorType.Equal) & new BinaryOperator(LocationInventory.Fields.Location.PropertyName, item.Location, BinaryOperatorType.Equal))
                            });
                            CurrentRMInventoryDictionary[VRMKey].QuantityOnHand += Convert.ToSingle(item.QuantityOnHand * (bom.BOMQuantity + (bom.BOMQuantity * (bom.ScrapFactor / 100))));
                        }
                        else
                        {
                            foreach (BOMs IGbom in bom.BOMRawMatID.ItemBOM)
                            {
                                VRMKey.ItemCode = IGbom.BOMRawMatID.ItemCode;
                                if (CurrentRMInventoryDictionary.ContainsKey(VRMKey))
                                {
                                    CurrentRMInventoryDictionary[VRMKey].QuantityOnHand += Convert.ToSingle((item.QuantityOnHand * (bom.BOMQuantity + (bom.BOMQuantity * (bom.ScrapFactor / 100)))) * (IGbom.BOMQuantity + (IGbom.BOMQuantity * (IGbom.ScrapFactor / 100))));
                                }
                                else
                                {
                                    if (IGbom.BOMRawMatID.ItemType == "RM")
                                    {
                                        CurrentRMInventoryDictionary.Add(VRMKey, new VRMItem()
                                        {
                                            Item = ReportSession.FindObject <LocationInventory>(new BinaryOperator(LocationInventory.Fields.LocationInventoryItem.PropertyName, IGbom.BOMRawMatID, BinaryOperatorType.Equal) & new BinaryOperator(LocationInventory.Fields.Location.PropertyName, item.Location, BinaryOperatorType.Equal))
                                        });
                                        CurrentRMInventoryDictionary[VRMKey].QuantityOnHand += Convert.ToSingle((item.QuantityOnHand * (bom.BOMQuantity + (bom.BOMQuantity * (bom.ScrapFactor / 100)))) * (IGbom.BOMQuantity + (IGbom.BOMQuantity * (IGbom.ScrapFactor / 100))));
                                    }
                                }
                            }
                        }
                    }
                }

                foreach (PoolBom pool in item.LocationInventoryItem.ItemPoolBom)
                {
                    VRMKey.ItemCode = pool.ItemPoolID.PoolCode;
                    VRMKey.Location = item.Location.LocationCode;


                    if (CurrentRMInventoryDictionary.ContainsKey(VRMKey))
                    {
                        //this should always be true, the else is not needed.
                        CurrentRMInventoryDictionary[VRMKey].QuantityOnHand += Convert.ToSingle(item.QuantityOnHand * (pool.PoolBomQuantity + (pool.PoolBomQuantity * (pool.ScrapFactor / 100))));
                        //Else
                        //    CurrentRMInventoryDictionary.Add(VRMKey, New VRMItem() With {.Customer = pool.ItemPoolID.PoolCustomerID, .ItemCode = pool.ItemPoolID.PoolCode, .ItemDescription = pool.ItemPoolID.PoolDescription,
                        //                                                                                   .QuantityOnHand = CSng(pool.ItemPoolID.QuantityOnHand), .ItemId = pool.ItemPoolID.Oid})
                        //    CurrentRMInventoryDictionary(VRMKey).QuantityOnHand += Convert.ToSingle(item.QuantityOnHand * (pool.PoolBomQuantity + (pool.PoolBomQuantity * (pool.ScrapFactor / 100))))
                    }
                }
            }
        }
Ejemplo n.º 11
0
        private static void AddPoolItems(Session ReportSession, bool OnlyAssignedCustomers)
        {
            XPCollection <ItemPool> poolCollection = null;
            VRMItemKey VRMKey   = new VRMItemKey();
            float      Quantity = 0;

            if (OnlyAssignedCustomers)
            {
                poolCollection = new XPCollection <ItemPool>(ReportSession, new InOperator(ItemPool.Fields.PoolCustomerID.CustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomerIDs(ReportSession)));
            }
            else
            {
                poolCollection = new XPCollection <ItemPool>(ReportSession);
            }

            foreach (ItemPool pool in poolCollection)
            {
                foreach (Locations location in new XPCollection <Locations>(ReportSession))
                {
                    VRMKey.Location = location.LocationCode;

                    foreach (ItemPoolDetails poolDetail in pool.Details)
                    {
                        VRMKey.ItemCode = poolDetail.ItemID.ItemCode;

                        if (CurrentRMInventoryDictionary.ContainsKey(VRMKey))
                        {
                            Quantity = (float)(Quantity + (CurrentRMInventoryDictionary[VRMKey].QuantityOnHand * poolDetail.ItemPoolRatio));
                            CurrentRMInventoryDictionary.Remove(VRMKey);
                        }
                    }

                    VRMKey.ItemCode = pool.PoolCode;

                    if (CurrentRMInventoryDictionary.ContainsKey(VRMKey))
                    {
                        //CurrentRMInventoryDictionary(VRMKey).QuantityOnHand = CSng(CurrentRMInventoryDictionary(pool.PoolCode).QuantityOnHand + pool.QuantityOnHand)
                    }
                    else
                    {
                        CurrentRMInventoryDictionary.Add(VRMKey, new VRMItem()
                        {
                            Customer        = pool.PoolCustomerID,
                            ItemCode        = pool.PoolCode,
                            ItemDescription = pool.PoolDescription,
                            QuantityOnHand  = Quantity,
                            ItemId          = pool.Oid
                        });
                    }
                    Quantity = 0;
                }
            }
        }
Ejemplo n.º 12
0
        public static XPView GetReceivingReturnsReport(DateTime?fromDate, DateTime?toDate, int?shiftID, int?customerID, string lot, string BOL, int?vendor, int?carrierID, string items, bool?inactiveItems, bool?inactiveCustomers, bool onlyAssignedCustomers)
        {
            XPView ReceivingReturnsReportXPView    = new XPView(Session.DefaultSession, typeof(ReceivedReturns));
            CriteriaOperatorCollection theCriteria = new CriteriaOperatorCollection();

            if (fromDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ReceiveMainID.ReceivDate", fromDate.Value, BinaryOperatorType.GreaterOrEqual));
            }
            if (toDate.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ReceiveMainID.ReceivDate", toDate.Value, BinaryOperatorType.LessOrEqual));
            }
            if (string.IsNullOrEmpty(BOL) == false)
            {
                theCriteria.Add(new BinaryOperator("ReceiveMainID.ReceivBOL", BOL, BinaryOperatorType.Equal));
            }
            if (shiftID.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ReceiveMainID.intShiftID", shiftID.Value, BinaryOperatorType.Equal));
            }
            if (customerID.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ReceiveMainID.ReceivCustID", customerID.Value, BinaryOperatorType.Equal));
            }
            if (carrierID.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ReceiveMainID.ReceivCarrierID", carrierID.Value, BinaryOperatorType.Equal));
            }
            if (vendor.HasValue)
            {
                theCriteria.Add(new BinaryOperator("ReceiveMainID.strVendor", vendor.Value, BinaryOperatorType.Equal));
            }
            if (string.IsNullOrEmpty(lot) == false)
            {
                theCriteria.Add(new BinaryOperator("ReturnDetLot", lot, BinaryOperatorType.Equal));
            }
            if (inactiveCustomers.Value == false)
            {
                theCriteria.Add(new BinaryOperator("ReceiveMainID.ReceivCustID.Inactive", false));
            }
            if (inactiveItems.Value == false)
            {
                theCriteria.Add(new BinaryOperator("ReturnDetItemID.Inactive", false));
            }
            if (string.IsNullOrEmpty(items) == false)
            {
                theCriteria.Add(new InOperator("ReturnDetItemID", items.Split('|')));
            }
            if (onlyAssignedCustomers == true)
            {
                theCriteria.Add(new InOperator("ReceiveMainID.ReceivCustID", UsersCustomerBLL.GetAssignedCustomerIDs(XpoDefault.Session)));
            }

            try
            {
                ReceivingReturnsReportXPView.Criteria = CriteriaOperator.And(theCriteria);
                ReceivingReturnsReportXPView.Properties.AddRange(new ViewProperty[]
                {
                    new ViewProperty("ReceivDate", SortDirection.Ascending, "[ReceiveMainID].[ReceivDate]", false, true),
                    new ViewProperty("ShiftName", SortDirection.None, "[ReceiveMainID].[intShiftID].[ShiftName]", false, true),
                    new ViewProperty("CustomerName", SortDirection.Ascending, "[ReceiveMainID].[ReceivCustID].[CustomerName]", false, true),
                    new ViewProperty("ReceivBOL", SortDirection.None, "[ReceiveMainID].[ReceivBOL]", false, true),
                    new ViewProperty("strPO", SortDirection.None, "[ReceiveMainID].[strPO]", false, true),
                    new ViewProperty("VendorName", SortDirection.None, "[ReceiveMainID].[strVendor].[VendorName]", false, true),
                    new ViewProperty("ReturnDetLot", SortDirection.None, "[ReturnDetLot]", false, true),
                    new ViewProperty("ItemCode", SortDirection.Ascending, "[ReturnDetItemID].[ItemCode]", false, true),
                    new ViewProperty("ItemDescription", SortDirection.None, "[ReturnDetItemID].[ItemDescription]", false, true),
                    new ViewProperty("ReturnDetQty", SortDirection.None, "[ReturnDetQty]", false, true),
                    new ViewProperty("CarrierName", SortDirection.None, "[ReceiveMainID].[ReceivCarrierID].[CarrierName]", false, true),
                    new ViewProperty("strTrailer", SortDirection.None, "[ReceiveMainID].[strTrailer]", false, true),
                    new ViewProperty("strSeal", SortDirection.None, "[ReceiveMainID].[strSeal]", false, true),
                    new ViewProperty("ExpirationDate", SortDirection.None, "[ExpirationDate]", false, true),
                    new ViewProperty("ExpirationDateFormat", SortDirection.None, "[ReceiveMainID].[ReceivCustID].[ExpirationDateFormat]", false, true)
                });
                return(ReceivingReturnsReportXPView);
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("There was an error while trying to retrieve the data for the report.{0}{1}", Environment.NewLine, ex.Message));
            }

            return(null);
        }
Ejemplo n.º 13
0
        public static XPView GetLocationTransfersReportView(bool onlyAssigned)
        {
            XPView locationTransfersReportView = new XPView(Session.DefaultSession, typeof(LocationTransferDetails));

            try
            {
                if (onlyAssigned)
                {
                    locationTransfersReportView.Criteria = new InOperator(LocationTransferDetails.Fields.TransferItem.ItemCustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomerIDs(XpoDefault.Session));
                }

                locationTransfersReportView.Properties.AddRange(new ViewProperty[]
                {
                    new ViewProperty("TransferDate", SortDirection.None, LocationTransferDetails.Fields.Transfer.TransferDate.PropertyName, false, true),
                    new ViewProperty("FromLocation", SortDirection.None, LocationTransferDetails.Fields.Transfer.FromLocation.LocationCode.PropertyName, false, true),
                    new ViewProperty("ToLocation", SortDirection.None, LocationTransferDetails.Fields.Transfer.ToLocation.LocationCode.PropertyName, false, true),
                    new ViewProperty("ItemCode", SortDirection.None, LocationTransferDetails.Fields.TransferItem.ItemCode.PropertyName, false, true),
                    new ViewProperty("ItemDescription", SortDirection.None, LocationTransferDetails.Fields.TransferItem.ItemDescription.PropertyName, false, true),
                    new ViewProperty("TransferNumber", SortDirection.None, LocationTransferDetails.Fields.Transfer.TransferNumber.PropertyName, false, true),
                    new ViewProperty("ItemLot", SortDirection.None, LocationTransferDetails.Fields.TransferLot.PropertyName, false, true),
                    new ViewProperty("ExpirationDate", SortDirection.None, LocationTransferDetails.Fields.ItemExpirationDate.PropertyName, false, true),
                    new ViewProperty("TransferQuantity", SortDirection.None, LocationTransferDetails.Fields.TransferQuantity.PropertyName, false, true),
                    new ViewProperty("ExpirationDateFormat", SortDirection.None, LocationTransferDetails.Fields.TransferItem.ItemCustomerID.ExpirationDateFormat.PropertyName, false, true),
                    new ViewProperty("TransferUnits", SortDirection.None, LocationTransferDetails.Fields.TransferUnits.PropertyName, false, true),
                    new ViewProperty("TransferPallets", SortDirection.None, LocationTransferDetails.Fields.TransferPallets.PropertyName, false, true),
                    new ViewProperty("Carrier", SortDirection.None, LocationTransferDetails.Fields.Transfer.TransferCarrier.CarrierName.PropertyName, false, true)
                });
                return(locationTransfersReportView);
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(string.Format("There was an error while trying to retrieve the data for the report.{0}{1}", Environment.NewLine, ex.Message));
            }

            return(null);
        }
Ejemplo n.º 14
0
        public static XPView GetLpnStatusrReportView(bool onlyAssigned)
        {
            XPView lpnStatusReportView = new XPView(Session.DefaultSession, typeof(Inventory));

            try
            {
                if (onlyAssigned)
                {
                    lpnStatusReportView.GroupCriteria = CriteriaOperator.And(new InOperator(Inventory.Fields.InventoryItemID.ItemCustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomerIDs(XpoDefault.Session)), new BinaryOperator(Inventory.Fields.InventoryDate.PropertyName, DateTime.Parse("Aug/4/2013"), BinaryOperatorType.GreaterOrEqual), CriteriaOperator.Parse("[FullLPNNumber] Is Not NULL"));
                }
                else
                {
                    lpnStatusReportView.GroupCriteria = CriteriaOperator.And(new BinaryOperator(Inventory.Fields.InventoryDate.PropertyName, DateTime.Parse("Aug/4/2013"), BinaryOperatorType.GreaterOrEqual), CriteriaOperator.Parse("[FullLPNNumber] Is Not NULL"));
                }

                lpnStatusReportView.Properties.AddRange(new ViewProperty[]
                {
                    new ViewProperty("Full LPN Number", SortDirection.Ascending, Inventory.Fields.FullLPNNumber, true, true),
                    new ViewProperty("Item #", SortDirection.Ascending, Inventory.Fields.InventoryItemID.ItemCode, true, true),
                    new ViewProperty("Quantity", SortDirection.None, "Sum([InventoryQuantity])", false, true),
                    new ViewProperty("Production Date", SortDirection.Ascending, Inventory.Fields.InventoryDate, true, true),
                    new ViewProperty("Shipping Date", SortDirection.Ascending, Inventory.Fields.Shipment.ShipMainDate, true, true),
                    new ViewProperty("BOL #", SortDirection.Ascending, Inventory.Fields.Shipment.ShipMainBOL, true, true),
                    new ViewProperty("Customer Name", SortDirection.None, Inventory.Fields.InventoryItemID.ItemCustomerID.CustomerName, true, true),
                    new ViewProperty("ShippingID", SortDirection.None, Inventory.Fields.Shipment.ShipMainID, true, true)
                });
                return(lpnStatusReportView);
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(string.Format("There was an error while trying to retrieve the data for the report.{0}{1}", Environment.NewLine, ex.Message));
            }

            return(null);
        }
Ejemplo n.º 15
0
        public static XPView GetProductionEntriesReportView(bool onlyAssigned)
        {
            XPView productionEntriesReportXPView = new XPView(Session.DefaultSession, typeof(Inventory));

            //Dim theCriteria As New CriteriaOperatorCollection

            //If customerID.HasValue Then
            //    theCriteria.Add(New BinaryOperator("ItemCustomerID", customerID.Value, BinaryOperatorType.Equal))
            //End If
            //If String.IsNullOrEmpty(itemType) = False Then
            //    theCriteria.Add(New BinaryOperator("ItemType", itemType, BinaryOperatorType.Equal))
            //End If
            //If inactiveCustomers.Value = False Then
            //    theCriteria.Add(New BinaryOperator("ItemCustomerID.Inactive", False))
            //End If
            //If inactiveItems.Value = False Then
            //    theCriteria.Add(New BinaryOperator("Inactive", False))
            //End If
            //If String.IsNullOrEmpty(Items) = False Then
            //    theCriteria.Add(New InOperator("ItemID", Items.Split("|"c)))
            //End If
            //If outOfStockItems.HasValue = False OrElse outOfStockItems.Value = False Then
            //    theCriteria.Add(New BinaryOperator("sngQuantityOnHand", 1, BinaryOperatorType.GreaterOrEqual))
            //End If
            //If onlyAssignedCustomers = True Then
            //    theCriteria.Add(New InOperator("ItemCustomerID", UsersCustomerBLL.GetAssignedCustomerIDs))
            //End If

            try
            {
                if (onlyAssigned)
                {
                    productionEntriesReportXPView.Criteria = new InOperator(Inventory.Fields.InventoryItemID.ItemCustomerID.PropertyName, UsersCustomerBLL.GetAssignedCustomerIDs(XpoDefault.Session));
                }
                //productionEntriesReportXPView.Criteria = GroupOperator.And(theCriteria)
                productionEntriesReportXPView.Properties.AddRange(new ViewProperty[]
                {
                    new ViewProperty("Production Date", SortDirection.Ascending, Inventory.Fields.InventoryDate, false, true),
                    new ViewProperty("Customer Name", SortDirection.Ascending, Inventory.Fields.InventoryItemID.ItemCustomerID.CustomerName, false, true),
                    new ViewProperty("Item #", SortDirection.Ascending, Inventory.Fields.InventoryItemID.ItemCode, false, true),
                    new ViewProperty("Item Description", SortDirection.None, Inventory.Fields.InventoryItemID.ItemDescription, false, true),
                    new ViewProperty("Item Type", SortDirection.None, CriteriaOperator.Parse(string.Format("IIF({0} = 'RM', 'Raw Material', IIF({0} = 'IG', 'Intermediate Goods', 'Finished Goods'))", Inventory.Fields.InventoryItemID.ItemType.PropertyName)), false, true),
                    new ViewProperty("Shift", SortDirection.Ascending, Inventory.Fields.Shift.ShiftName, false, true),
                    new ViewProperty("Quantity", SortDirection.None, Inventory.Fields.InventoryQuantity, false, true),
                    new ViewProperty("PO #", SortDirection.Ascending, Inventory.Fields.PO, false, true),
                    new ViewProperty("Lot #", SortDirection.Ascending, Inventory.Fields.Lot, false, true),
                    new ViewProperty("Pallet #", SortDirection.None, Inventory.Fields.Pallet, false, true),
                    new ViewProperty("LPN #", SortDirection.Ascending, Inventory.Fields.LPNNumber, false, true),
                    new ViewProperty("Expiration Date", SortDirection.None, Inventory.Fields.ExpirationDate, false, true),
                    new ViewProperty("ExpirationDateFormat", SortDirection.None, Inventory.Fields.InventoryItemID.ItemCustomerID.ExpirationDateFormat, false, true),
                    new ViewProperty("Note", SortDirection.None, Inventory.Fields.Note, false, true)
                });
                return(productionEntriesReportXPView);
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(string.Format("There was an error while trying to retrieve the data for the report.{0}{1}", Environment.NewLine, ex.Message));
            }

            return(null);
        }