Exemplo n.º 1
0
        private void addBothWaysSimpleButton_Click(System.Object sender, EventArgs e)
        {
            if (RelatedCustomerBLL.AddRelatedCustomer(CustomersBLL.GetCustomer(m_CurrentCustomer.Value, m_CustomersSession), CustomersBLL.GetCustomer(Convert.ToInt32(relatedCustomerLookUpEdit.EditValue), m_CustomersSession), true) == false)
            {
                MessageBox.Show("There was a problem while adding the related customer");
            }

            relatedCustomerXpCollection.Reload();
        }
Exemplo n.º 2
0
 private void resetLPNSimpleButton_Click(object sender, EventArgs e)
 {
     try
     {
         Customers customer = CustomersBLL.GetCustomer(m_CurrentCustomer.Value, m_CustomersSession);
         customer.NextLPNNumber = Convert.ToInt32(firstLPNNumberTextEdit.EditValue);
         customer.Save();
     }
     catch
     {
         MessageBox.Show("The LPN labels were not reset.");
     }
 }
Exemplo n.º 3
0
        private bool SaveChanges()
        {
            int selectedID = -1;

            if (m_CurrentPoolID.Oid == -1)
            {
            }
            else
            {
                selectedID = poolSearchGridView.FocusedRowHandle;
            }

            if (ItemPoolBLL.ValidateRecord(codeTextEdit.Text, (int?)customerLookUpEdit.EditValue))
            {
                m_CurrentPoolID.PoolCode        = codeTextEdit.Text;
                m_CurrentPoolID.PoolDescription = descriptionMemoEdit.Text;
                m_CurrentPoolID.PoolCustomerID  = CustomersBLL.GetCustomer(Convert.ToInt32(customerLookUpEdit.EditValue), m_ItemPoolSession);
                m_CurrentPoolID.PoolType        = "BP";
            }
            else
            {
                MessageBox.Show("You must provide a Pool Code, and Customer name before saving the record.");
                return(false);
            }

            try
            {
                m_CurrentPoolID.Save();
            }
            catch (ApplicationException ex)
            {
                MessageBox.Show(ex.Message, "Error Encountered", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            //Save the details here
            foreach (ItemPoolDetails poolDetail in poolDetailsXpCollection)
            {
                if (poolDetail.ItemPoolID == null || poolDetail.ItemPoolID.Oid == -1)
                {
                    poolDetail.ItemPoolID = m_CurrentPoolID;
                }
                poolDetail.Save();
            }

            BindPoolSearch();
            BindPoolControls(m_CurrentPoolID.Oid);
            poolSearchGridView.FocusedRowHandle = selectedID;
            return(true);
        }
Exemplo n.º 4
0
        public void BindCustomersControls(int customerID)
        {
            m_CustomersSession.DropIdentityMap();

            Customers customer = CustomersBLL.GetCustomer(customerID, m_CustomersSession);

            m_CurrentCustomer                      = customer.CustomerID;
            nameTextEdit.Text                      = customer.CustomerName;
            contactTextEdit.Text                   = customer.CustomerContact;
            phoneTextEdit.Text                     = customer.CustomerPhone;
            emailTextEdit.Text                     = customer.CustomerEmail;
            faxTextEdit.Text                       = customer.CustomerFax;
            noteMemoEdit.Text                      = customer.CustomerNote;
            addressTextEdit.Text                   = customer.Address;
            cityTextEdit.Text                      = customer.City;
            stateTextEdit.Text                     = customer.State;
            postalTextEdit.Text                    = customer.ZipCode;
            inactiveCheckEdit.Checked              = customer.Inactive;
            lpnPrefixTextEdit.Text                 = customer.LPNPrefix;
            firstLPNNumberTextEdit.EditValue       = customer.FirstLPNNumber;
            lastLPNNumberTextEdit.EditValue        = customer.LastLPNNumber;
            beforeItemCodetextEdit.EditValue       = customer.BeforeItemCode;
            beforeLotCodetextEdit.EditValue        = customer.BeforeLotCode;
            beforeQtyCodetextEdit.EditValue        = customer.BeforeQtyCode;
            endCodeTextEdit.EditValue              = customer.EndCode;
            plantCodeTextEdit.EditValue            = customer.PlantCode;
            lpnGroupControl.Text                   = string.Format("LPN Settings - Next LPN Number: {0}", customer.NextLPNNumber);
            expirationDateFormatComboBox.EditValue = customer.ExpirationDateFormat;
            if (customer.DefaultLotCodeFormat != null)
            {
                lotCodeFormatLookUpEdit.EditValue = customer.DefaultLotCodeFormat.Oid;
            }
            else
            {
                lotCodeFormatLookUpEdit.EditValue = null;
            }

            customerItemsXpCollection.Criteria   = new GroupOperator(GroupOperatorType.And, new BinaryOperator(Items.Fields.ItemCustomerID.CustomerID.PropertyName, m_CurrentCustomer.Value, BinaryOperatorType.Equal), new BinaryOperator(Items.Fields.ItemType.PropertyName, "FG", BinaryOperatorType.Equal), new BinaryOperator(Items.Fields.Inactive.PropertyName, false, BinaryOperatorType.Equal));
            relatedCustomerXpCollection.Criteria = new BinaryOperator(RelatedCustomer.Fields.MainCustomer.PropertyName, CustomersBLL.GetCustomer(m_CurrentCustomer.Value, m_CustomersSession), BinaryOperatorType.Equal);
            customerPlantsXpCollection.Criteria  = new BinaryOperator(CustomerPlants.Fields.Customer.CustomerID.PropertyName, m_CurrentCustomer.Value, BinaryOperatorType.Equal);
            customerShiftsXpCollection.Criteria  = new BinaryOperator(CustomerShifts.Fields.Customer.CustomerID.PropertyName, m_CurrentCustomer.Value, BinaryOperatorType.Equal);

            customerItemsXpCollection.Reload();
            relatedCustomerXpCollection.Reload();
            customerPlantsXpCollection.Reload();
            customerShiftsXpCollection.Reload();
        }
Exemplo n.º 5
0
        private void printLpn()
        {
            int    digits    = CustomersBLL.GetCustomer(7, Session.DefaultSession).LastLPNNumber.ToString().Length;
            XPView lpnXPview = null;
            CriteriaOperatorCollection critaria = new CriteriaOperatorCollection();

            lpnXPview          = new XPView(Session.DefaultSession, typeof(LocationInventoryByLot));
            lpnXPview.Criteria = CriteriaOperator.And(new BinaryOperator("LPNNumber", (object)Utilities.ChangeType <int?>(lpnLookUpEdit.EditValue), BinaryOperatorType.Equal), new BinaryOperator("QuantityOnHand", 0, BinaryOperatorType.Greater));

            lpnXPview.Properties.AddRange(new ViewProperty[]
            {
                new ViewProperty("Item", SortDirection.None, "[LocationInventoryItem.ItemCode]", false, true),
                new ViewProperty("ItemDesc", SortDirection.None, "[LocationInventoryItem.ItemDescription]", false, true),
                new ViewProperty("Allergens", SortDirection.None, "[LocationInventoryItem.Allergens]", false, true),
                new ViewProperty("Qty", SortDirection.None, "[QuantityOnHand]", false, true),
                new ViewProperty("Expr", SortDirection.None, "[ExpirationDate]", false, true),
                new ViewProperty("Lot", SortDirection.None, "[LocationInventoryLot]", false, true),
                new ViewProperty("LPN", SortDirection.Ascending, "[LPNNumber]", false, true)
            });

            LPNLabelsXtraReport labels = new LPNLabelsXtraReport();

            labels.DataSource = lpnXPview;
            labels.lpnGroupHeader.GroupFields.Add(new GroupField("LPN", XRColumnSortOrder.Ascending));
            labels.itemCodeXrLabel.DataBindings.Add("Text", lpnXPview, "Item");
            labels.itemDescXrLabel.DataBindings.Add("Text", lpnXPview, "ItemDesc");
            labels.AllergensXrLabel.ExpressionBindings.Add(new ExpressionBinding("BeforePrint", "Text", "Iif(Len(Trim([Allergens]))>0,'Allergens: ' + [Allergens],'Allergens: None')"));
            labels.exprXrLabel.DataBindings.Add("Text", lpnXPview, "Expr", "{0:MM/dd/yyyy}");
            labels.qtyXrLabel.DataBindings.Add("Text", lpnXPview, "Qty");
            labels.lotXrLabel.DataBindings.Add("Text", lpnXPview, "Lot");
            labels.LPNXrBarCode.DataBindings.Add("Text", lpnXPview, "LPN", "SPG{0:D" + digits + "}");
            labels.SumQtyXrLabel.ExpressionBindings.Add(new ExpressionBinding("BeforePrint", "Text", "sumSum([Qty])"));
            labels.ReprintXrLabel.Visible = !m_newLpn;
            labels.CreateDocument();
            labels.ShowPreviewDialog();
        }
Exemplo n.º 6
0
        private void deleteBarButtonItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to delete this customer.", "Delete Customer", MessageBoxButtons.YesNo, MessageBoxIcon.Hand) == DialogResult.No)
            {
                return;
            }

            try
            {
                if (m_Customer.DeleteCustomer(m_CurrentCustomer.Value, m_CustomersSession) == true)
                {
                    RelatedCustomerBLL.DeleteRelatedCustomers(CustomersBLL.GetCustomer(m_CurrentCustomer.Value, m_CustomersSession));
                    BindCustomerSearch();
                }
                else
                {
                    MessageBox.Show("The customer was not deleted.");
                }
            }
            catch (ApplicationException ex)
            {
                MessageBox.Show(ex.Message, "Error Encountered", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 7
0
        private void PrintLpnSimpleButton_Click(object sender, EventArgs e)
        {
            int    digits    = CustomersBLL.GetCustomer(7, m_LocationSession).LastLPNNumber.ToString().Length;
            XPView lpnXPview = null;
            CriteriaOperatorCollection critaria = new CriteriaOperatorCollection();

            lpnXPview = new XPView(m_LocationSession, typeof(LocationInventoryByLot));


            if (inventoryByLotGridView.GroupCount > 0)
            {
                int i = -1;
                while (inventoryByLotGridView.IsValidRowHandle(i))
                {
                    if (inventoryByLotGridView.GetChildRowHandle(i, 0) > -1)
                    {
//INSTANT C# NOTE: The ending condition of VB 'For' loops is tested only on entry to the loop. Instant C# has created a temporary variable in order to use the initial value of inventoryByLotGridView.GetChildRowCount(i) + inventoryByLotGridView.GetChildRowHandle(i, 0) for every iteration:
                        int tempVar = inventoryByLotGridView.GetChildRowCount(i) + inventoryByLotGridView.GetChildRowHandle(i, 0);
                        for (int ci = inventoryByLotGridView.GetChildRowHandle(i, 0); ci < tempVar; ci++)
                        {
                            if (inventoryByLotGridView.IsRowVisible(ci) == RowVisibleState.Visible)
                            {
                                int?   lpn = Utilities.ChangeType <int?>(inventoryByLotGridView.GetRowCellValue(ci, colLPNNumber));
                                string lot = inventoryByLotGridView.GetRowCellValue(ci, colLot).ToString();
                                if (lpn.HasValue && lot.Length > 0)
                                {
                                    critaria.Add(new GroupOperator(GroupOperatorType.And, new BinaryOperator("LPNNumber", lpn.Value, BinaryOperatorType.Equal), new BinaryOperator("LocationInventoryLot", lot, BinaryOperatorType.Equal)));
                                }
                            }
                        }
                    }
                    i -= 1;
                }
            }
            else
            {
                for (int ci = 0; ci < inventoryByLotGridView.RowCount; ci++)
                {
                    if (inventoryByLotGridView.IsRowVisible(ci) == RowVisibleState.Visible)
                    {
                        int?   lpn = Utilities.ChangeType <int?>(inventoryByLotGridView.GetRowCellValue(ci, colLPNNumber));
                        string lot = inventoryByLotGridView.GetRowCellValue(ci, colLot).ToString();
                        if (lpn.HasValue && lot.Length > 0)
                        {
                            critaria.Add(new GroupOperator(GroupOperatorType.And, new BinaryOperator("LPNNumber", lpn.Value, BinaryOperatorType.Equal), new BinaryOperator("LocationInventoryLot", lot, BinaryOperatorType.Equal)));
                        }
                    }
                }
            }

            lpnXPview.Criteria = CriteriaOperator.Or(critaria);

            lpnXPview.Properties.AddRange(new ViewProperty[]
            {
                new ViewProperty("Item", SortDirection.None, "[LocationInventoryItem.ItemCode]", false, true),
                new ViewProperty("ItemDesc", SortDirection.None, "[LocationInventoryItem.ItemDescription]", false, true),
                new ViewProperty("Allergens", SortDirection.None, "[LocationInventoryItem.Allergens]", false, true),
                new ViewProperty("Qty", SortDirection.None, "[QuantityOnHand]", false, true),
                new ViewProperty("Expr", SortDirection.None, "[ExpirationDate]", false, true),
                new ViewProperty("Lot", SortDirection.None, "[LocationInventoryLot]", false, true),
                new ViewProperty("LPN", SortDirection.Ascending, "[LPNNumber]", false, true)
            });

            LPNLabelsXtraReport labels = new LPNLabelsXtraReport();

            labels.DataSource = lpnXPview;
            labels.lpnGroupHeader.GroupFields.Add(new GroupField("LPN", XRColumnSortOrder.Ascending));
            labels.itemCodeXrLabel.DataBindings.Add("Text", lpnXPview, "Item");
            labels.itemDescXrLabel.DataBindings.Add("Text", lpnXPview, "ItemDesc");
            labels.AllergensXrLabel.ExpressionBindings.Add(new ExpressionBinding("BeforePrint", "Text", "Iif(Len(Trim([Allergens]))>0,'Allergens: ' + [Allergens],'Allergens: None')"));
            labels.exprXrLabel.DataBindings.Add("Text", lpnXPview, "Expr", "{0:MM/dd/yyyy}");
            labels.qtyXrLabel.DataBindings.Add("Text", lpnXPview, "Qty");
            labels.lotXrLabel.DataBindings.Add("Text", lpnXPview, "Lot");
            labels.LPNXrBarCode.DataBindings.Add("Text", lpnXPview, "LPN", "SPG{0:D" + digits + "}");
            labels.SumQtyXrLabel.ExpressionBindings.Add(new ExpressionBinding("BeforePrint", "Text", "sumSum([Qty])"));
            labels.ReprintXrLabel.Visible = true;
            labels.CreateDocument();
            labels.ShowPreviewDialog();
        }
Exemplo n.º 8
0
        public static XPView GetItemCodeAndIDsByTypesAndCustomerID(int?customerID, string types, bool universal, Session DXSession)
        {
            XPView ItemCodesXPView = new XPView(Session.DefaultSession, typeof(Items));

            ItemCodesXPView.Properties.AddRange(new ViewProperty[]
            {
                new ViewProperty("ItemID", SortDirection.None, "[ItemID]", false, true),
                new ViewProperty("ItemCode", SortDirection.Ascending, "[ItemCode]", false, true),
                new ViewProperty("ItemCustomerID", SortDirection.None, "[ItemCustomerID]", false, true),
                new ViewProperty("ItemType", SortDirection.None, "[ItemType]", false, true)
            });
            if (universal == true)
            {
                int universalCustomer = CompanySettingsBLL.GetUniversalCustomer();
                if (customerID.HasValue)
                {
                    ItemCodesXPView.Criteria = CriteriaOperator.And(CriteriaOperator.Or(new BinaryOperator(Items.Fields.ItemCustomerID.PropertyName, customerID.Value, BinaryOperatorType.Equal), new BinaryOperator(Items.Fields.ItemCustomerID.PropertyName, universalCustomer, BinaryOperatorType.Equal), new InOperator(Items.Fields.ItemCustomerID.PropertyName, CustomersBLL.GetRelatedCustomerIDs(CustomersBLL.GetCustomer(customerID.Value, DXSession)))), new InOperator(Items.Fields.ItemType.PropertyName, types.Split('|')));
                }
                else
                {
                    ItemCodesXPView.Criteria = new InOperator(Items.Fields.ItemType.PropertyName, types.Split('|'));
                }
            }
            else
            {
                if (customerID.HasValue)
                {
                    ItemCodesXPView.Criteria = CriteriaOperator.And(new BinaryOperator(Items.Fields.ItemCustomerID.PropertyName, customerID.Value, BinaryOperatorType.Equal), new InOperator(Items.Fields.ItemType.PropertyName, types.Split('|')));
                }
                else
                {
                    ItemCodesXPView.Criteria = new InOperator(Items.Fields.ItemType.PropertyName, types.Split('|'));
                }
            }

            return(ItemCodesXPView);
        }
Exemplo n.º 9
0
        public static bool IsLPNShipped(string fullLPNNumber, int customerID, Session DXSession)
        {
            if (!fullLPNNumber.StartsWith(CustomersBLL.GetLPNPrefix(customerID)))
            {
                fullLPNNumber = CustomersBLL.GetLPNPrefix(customerID) + ("0000000000" + fullLPNNumber).Substring(("0000000000" + fullLPNNumber).Length - CustomersBLL.GetCustomer(customerID, DXSession).LastLPNNumber.ToString().Length);
            }

            CriteriaOperatorCollection filter = new CriteriaOperatorCollection();

            filter.Add(new BinaryOperator(ShipDet.Fields.ShipDetMainID.ShipMainCustID.CustomerID.PropertyName, customerID, BinaryOperatorType.Equal));
            filter.Add(new BinaryOperator(ShipDet.Fields.FullLPNNumber.PropertyName, fullLPNNumber, BinaryOperatorType.Equal));

            int?LPNCount = (int?)XpoDefault.Session.Evaluate <ShipDet>(new AggregateOperand("", "FullLPNNumber", Aggregate.Count), new GroupOperator(GroupOperatorType.And, filter));

            if (LPNCount.HasValue && LPNCount.Value >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }