Exemplo n.º 1
0
        private void InventoryAdjustmentXtraForm_Load(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;

            CheckPermissions();

            //Dim fullLPN As String


            //fullLPN = CustomersBLL.GetLPNPrefix(7) & Strings.Right("0000000000" & "", Len(CustomersBLL.GetCustomer(7, Session.DefaultSession).LastLPNNumber.ToString))

            //lpnLookUpEdit.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric
            //lpnLookUpEdit.Properties.DisplayFormat.FormatString = CustomersBLL.GetLPNPrefix(7) & "{0:D" & Len(CustomersBLL.GetCustomer(7, Session.DefaultSession).LastLPNNumber.ToString) & "}"
            //lpnXpView.Properties.Add(New ViewProperty("LPN", SortDirection.None, "'" & CustomersBLL.GetLPNPrefix(7) & "' + RIGHT(CONCAT('0000000000',LPNNumber)," & Len(CustomersBLL.GetCustomer(7, Session.DefaultSession).LastLPNNumber.ToString) & ")", True, True))
            m_Items      = new ItemsBLL();
            m_Customers  = new CustomersBLL();
            m_Adjustment = new InventoryAdjustmentBLL();

            PrepareNewRecord();

            SetDefaultViewFilter();
            FillAdjustmentView();

            FilterLpns();

            Cursor = Cursors.Default;
        }
Exemplo n.º 2
0
        public static ICollection <Inventory> GetLPNInventoryRecords(Session session, string fullLPNNumber, int customerID)
        {
            //Dim LPNNumber As Integer = Integer.Parse(fullLPNNumber.Replace(CustomersBLL.GetLPNPrefix(customerID), ""))

            ICollection <Inventory> result = new Collection <Inventory>();

            result = new XPCollection <Inventory>(session, new BinaryOperator(Inventory.Fields.InventoryItemID.ItemCustomerID.CustomerID.PropertyName, customerID, BinaryOperatorType.Equal) & new BinaryOperator("FullLPNNumber", fullLPNNumber, BinaryOperatorType.Equal));

            if (result.Count() == 0 && !fullLPNNumber.StartsWith(CustomersBLL.GetLPNPrefix(7)))
            {
                //If customerID = 7 Then
                //    Dim locationInventorys As XPCollection(Of LocationInventoryByLot) = New XPCollection(Of LocationInventoryByLot)(session,
                //                                                          New BinaryOperator(LocationInventoryByLot.Fields.LPNNumber.PropertyName, Integer.Parse(fullLPNNumber.Replace(CustomersBLL.GetLPNPrefix(customerID), "")), BinaryOperatorType.Equal))
                //    If locationInventorys.Count < 1 Then Return result
                //    Dim locationInventory As LocationInventoryByLot = locationInventorys(0)
                //    Dim convertToInventory As Inventory = New Inventory(session) With {.InventoryItemID = locationInventory.LocationInventoryItem, .InventoryQuantity = CInt(locationInventory.QuantityOnHand),
                //                                                                .Lot = locationInventory.LocationInventoryLot, .FullLPNNumber = fullLPNNumber, .ExpirationDate = locationInventory.ExpirationDate}
                //    result = New Collection(Of Inventory)
                //    result.Add(convertToInventory)
                //Else
                result = new XPCollection <Inventory>(session, new BinaryOperator(Inventory.Fields.InventoryItemID.ItemCustomerID.CustomerID.PropertyName, customerID, BinaryOperatorType.Equal) & new BinaryOperator("LPNNumber", int.Parse(fullLPNNumber.Replace(CustomersBLL.GetLPNPrefix(customerID), "")), BinaryOperatorType.Equal));
                //End If
            }

            return(result);
        }
Exemplo n.º 3
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.º 4
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.º 5
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.º 6
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.º 7
0
        private void CustomersXtraForm_Load(object sender, EventArgs e)
        {
            Cursor             = Cursors.WaitCursor;
            m_Customer         = new CustomersBLL();
            m_CustomersItems   = new ItemsBLL();
            m_Receiving        = new ReceivingsBLL();
            m_ReceivingDetails = new ReceivingDetailsBLL();
            m_Production       = new ProductionBLL();
            m_Shippings        = new ShippingsBLL();
            m_UserPermissions  = new UserPermissionsBLL();

            m_CustomersSession = new Session(MyDataLayers.SPGDataLayer);
            m_CustomersSession.TrackPropertiesModifications  = true;
            m_CustomersSession.OptimisticLockingReadBehavior = OptimisticLockingReadBehavior.MergeCollisionThrowException;

            CheckPermissions();

            for (int i = 0; i < components.Components.Count; i++)
            {
                if ((components.Components[i]) is XPView)
                {
                    ((XPView)components.Components[i]).Session = m_CustomersSession;
                }
                else if ((components.Components[i]) is XPCollection)
                {
                    ((XPCollection)components.Components[i]).Session = m_CustomersSession;
                }
            }

            BindCustomerSearch();
            customerShiftsXpCollection.Criteria = new BinaryOperator(CustomerShifts.Fields.Customer, null, BinaryOperatorType.Equal);
            customerPlantsXpCollection.Criteria = new BinaryOperator(CustomerPlants.Fields.Customer, null, BinaryOperatorType.Equal);

            Utilities.MakeFormReadOnly(generalXtraTabPage, true);
            addRelatedCustomerGroupControl.Enabled          = false;
            customerPlantsGridView.OptionsBehavior.Editable = false;
            customerShiftsGridView.OptionsBehavior.Editable = false;
            deleteGridColumn.Visible = false;
            deleteCustomerPlantGridColumn.Visible = false;
            deleteCustomerShiftGridColumn.Visible = false;
            customerSearchGridControl.Enabled     = true;

            Cursor = Cursors.Default;
        }
Exemplo n.º 8
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);
            }
        }
Exemplo n.º 9
0
        private void lpnNumberTextEdit_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (fromLocationLookUpEdit.EditValue != null && lpnNumberTextEdit.Text.Length > 0)
            {
                int LocationID = Convert.ToInt32(fromLocationLookUpEdit.EditValue);

                try
                {
                    int LPN = int.Parse(lpnNumberTextEdit.Text.Replace(CustomersBLL.GetLPNPrefix(7), ""));

                    for (int i = 0; i < transferDetailsGridView.RowCount; i++)
                    {
                        if (transferDetailsGridView.GetDataRow(i) != null && transferDetailsGridView.GetDataRow(i)["FullLpnNumber"].Equals(LPN))
                        {
                            MessageBox.Show("This LPN is already entered.");
                            lpnNumberTextEdit.EditValue = null;
                            return;
                        }
                    }

                    foreach (LocationInventoryByLot record in new XPCollection <LocationInventoryByLot>(m_TransfersSession, new GroupOperator(new BinaryOperator(LocationInventoryByLot.Fields.LPNNumber, LPN, BinaryOperatorType.Equal) & new BinaryOperator(LocationInventoryByLot.Fields.Location.Oid.PropertyName, LocationID, BinaryOperatorType.Equal))))
                    {
                        transferDetailsGridView.AddNewRow();
                        transferDetailsGridView.SetRowCellValue(transferDetailsGridView.FocusedRowHandle, transferItemGridColumn, record.LocationInventoryItem.ItemID);
                        transferDetailsGridView.SetRowCellValue(transferDetailsGridView.FocusedRowHandle, colTransferQuantity, record.QuantityOnHand);
                        transferDetailsGridView.SetRowCellValue(transferDetailsGridView.FocusedRowHandle, colTransferLot, record.LocationInventoryLot);
                        transferDetailsGridView.SetRowCellValue(transferDetailsGridView.FocusedRowHandle, colItemExpirationDate, record.ExpirationDate);
                        transferDetailsGridView.SetRowCellValue(transferDetailsGridView.FocusedRowHandle, fullLpnNumberGridColumn, LPN);
                        transferDetailsGridView.UpdateCurrentRow();
                    }
                }
                catch
                {
                }
                lpnNumberTextEdit.EditValue = null;
            }
        }
Exemplo n.º 10
0
        public bool DeleteShippingDetail(Session session, int detailID)
        {
            SPG.ShippingDetailsDataTable details = Adapter.GetDetailsByDetailID(detailID);
            int    rowsAffected  = 0;
            int    itemID        = 0;
            int    quantity      = 0;
            int    locationID    = 0;
            string lot           = null;
            string fullLPNNumber = null;

            if (details.Count() == 1)
            {
                SPG.ShippingDetailsRow shippingDetail = (SPG.ShippingDetailsRow)details.Rows[0];
                itemID        = shippingDetail.ShipDetItemID;
                quantity      = shippingDetail.ShipDetDetQty;
                lot           = shippingDetail.ShipDetLot;
                fullLPNNumber = shippingDetail.FullLPNNumber;
                locationID    = session.GetObjectByKey <Shipping>(shippingDetail.ShipDetMainID).ShippingLocation.Oid;
                rowsAffected  = Adapter.Delete(detailID, shippingDetail.ts);
            }

            if (rowsAffected == 1)
            {
                ItemsBLL items = new ItemsBLL();
                if (fullLPNNumber.StartsWith(CustomersBLL.GetLPNPrefix(7)))
                {
                    items.UpdateStock(session, itemID, quantity, false, locationID, lot, int.Parse(fullLPNNumber.Replace(CustomersBLL.GetLPNPrefix(7), "")));
                }
                else
                {
                    items.UpdateStock(session, itemID, quantity, false, locationID);
                }
            }

            //Return true if precisely one row was deleted, otherwise return false.
            return(rowsAffected == 1);
        }
Exemplo n.º 11
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.º 12
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.º 13
0
        public bool InsertDetails(Session session, int shippingID, int?itemID, string lot, int?quantity, float?pallets, string note, DateTime?expirationDate, string fullLPNNumber)
        {
            SPG.ShippingDetailsDataTable details        = new SPG.ShippingDetailsDataTable();
            SPG.ShippingDetailsRow       shippingDetail = details.NewShippingDetailsRow();

            shippingDetail.ShipDetMainID = shippingID;
            shippingDetail.ShipDetItemID = itemID.Value;
            if (string.IsNullOrEmpty(lot))
            {
                shippingDetail.SetShipDetLotNull();
            }
            else
            {
                shippingDetail.ShipDetLot = lot;
            }
            shippingDetail.ShipDetDetQty = quantity.Value;
            shippingDetail.SetsngPackagesNull();
            if (!pallets.HasValue)
            {
                shippingDetail.SetsngPalletsNull();
            }
            else
            {
                shippingDetail.sngPallets = pallets.Value;
            }
            if (string.IsNullOrEmpty(note))
            {
                shippingDetail.SetNoteNull();
            }
            else
            {
                shippingDetail.Note = note;
            }
            if (expirationDate.HasValue)
            {
                shippingDetail.ExpirationDate = expirationDate.Value;
            }
            else
            {
                shippingDetail.SetExpirationDateNull();
            }
            if (string.IsNullOrEmpty(fullLPNNumber))
            {
                shippingDetail.SetFullLPNNumberNull();
            }
            else
            {
                shippingDetail.FullLPNNumber = fullLPNNumber;
            }

            details.AddShippingDetailsRow(shippingDetail);
            int rowsAffected = Adapter.Update(details);

            if (rowsAffected == 1)
            {
                ItemsBLL items = new ItemsBLL();
                if (fullLPNNumber.StartsWith(CustomersBLL.GetLPNPrefix(7)))
                {
                    items.UpdateStock(session, itemID.Value, quantity.Value * -1, false, session.GetObjectByKey <Shipping>(shippingID).ShippingLocation.Oid, lot, int.Parse(fullLPNNumber.Replace(CustomersBLL.GetLPNPrefix(7), "")));
                }
                else
                {
                    items.UpdateStock(session, itemID.Value, quantity.Value * -1, false, session.GetObjectByKey <Shipping>(shippingID).ShippingLocation.Oid);
                }
            }

            return(rowsAffected == 1);
        }
Exemplo n.º 14
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.º 15
0
        public bool UpdateShippingDetails(Session session, int?detailID, int shippingID, int?itemID, string lot, int?quantity, float?pallets, string note, DateTime?expirationDate, string fullLPNNumber)
        {
            if (!itemID.HasValue)
            {
                throw new ApplicationException("You must provide shipping item.");
            }

            if (!quantity.HasValue)
            {
                throw new ApplicationException("You must provide the Quantity shipped.");
            }

            SPG.ShippingDetailsDataTable details = Adapter.GetDetailsByDetailID(detailID.Value);

            if (details.Count() == 0)
            {
                //It is a new Detail
                return(InsertDetails(session, shippingID, itemID, lot, quantity, pallets, note, expirationDate, fullLPNNumber));
            }

            SPG.ShippingDetailsRow shippingDetail = details[0];
            int  originalItem     = 0;
            int  originalQuantity = 0;
            int  newQuantity      = 0;
            bool itemChanged      = false;

            object[] originalRecord = shippingDetail.ItemArray;

            SPG.ShippingDetailsRow originalDetail = details.NewShippingDetailsRow();
            originalDetail.ItemArray = (object[])originalRecord.Clone();

            originalItem = shippingDetail.ShipDetItemID;
            if (itemID.HasValue && originalItem != itemID.Value)
            {
                itemChanged = true;
            }
            shippingDetail.ShipDetItemID = itemID.Value;
            if (string.IsNullOrEmpty(lot))
            {
                shippingDetail.SetShipDetLotNull();
            }
            else
            {
                shippingDetail.ShipDetLot = lot;
            }
            originalQuantity             = shippingDetail.ShipDetDetQty;
            newQuantity                  = quantity.Value - shippingDetail.ShipDetDetQty;
            shippingDetail.ShipDetDetQty = quantity.Value;
            shippingDetail.SetsngPackagesNull();
            if (!pallets.HasValue)
            {
                shippingDetail.SetsngPalletsNull();
            }
            else
            {
                shippingDetail.sngPallets = pallets.Value;
            }
            if (string.IsNullOrEmpty(note))
            {
                shippingDetail.SetNoteNull();
            }
            else
            {
                shippingDetail.Note = note;
            }
            if (expirationDate.HasValue)
            {
                shippingDetail.ExpirationDate = expirationDate.Value;
            }
            else
            {
                shippingDetail.SetExpirationDateNull();
            }
            if (string.IsNullOrEmpty(fullLPNNumber))
            {
                shippingDetail.SetFullLPNNumberNull();
            }
            else
            {
                shippingDetail.FullLPNNumber = fullLPNNumber;
            }

            if (!(originalRecord == null))
            {
                UpdateAuditTrail(shippingDetail, originalRecord);
            }

            int rowsAffected = Adapter.Update(shippingDetail);

            if (rowsAffected == 1)
            {
                ItemsBLL items      = new ItemsBLL();
                int      locationID = session.GetObjectByKey <Shipping>(shippingID).ShippingLocation.Oid;
                //If itemChanged = True Then
                if (originalDetail.FullLPNNumber.StartsWith(CustomersBLL.GetLPNPrefix(7)))
                {
                    items.UpdateStock(session, originalItem, originalQuantity, false, locationID, originalDetail.ShipDetLot, int.Parse(originalDetail.FullLPNNumber.Replace(CustomersBLL.GetLPNPrefix(7), "")));
                }
                else
                {
                    items.UpdateStock(session, originalItem, originalQuantity, false, locationID);
                }
                if (fullLPNNumber.StartsWith(CustomersBLL.GetLPNPrefix(7)))
                {
                    items.UpdateStock(session, itemID.Value, quantity.Value * -1, false, locationID, lot, int.Parse(fullLPNNumber.Replace(CustomersBLL.GetLPNPrefix(7), "")));
                }
                else
                {
                    items.UpdateStock(session, itemID.Value, quantity.Value * -1, false, locationID);
                }
                //Else
                //    If newQuantity <> 0 Then
                //        items.UpdateStock(session, itemID.Value, newQuantity * -1, False, locationID)
                //    End If
                //End If
            }

            return(rowsAffected == 1);
        }
Exemplo n.º 16
0
        private void ProductionXtraForm_Load(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;

            m_ProductionSession = new Session(MyDataLayers.SPGDataLayer)
            {
                TrackPropertiesModifications  = true,
                OptimisticLockingReadBehavior = OptimisticLockingReadBehavior.MergeCollisionThrowException
            };

            CheckPermissions();

            for (int i = 0; i < components.Components.Count; i++)
            {
                if ((components.Components[i]) is XPView)
                {
                    ((XPView)components.Components[i]).Session = m_ProductionSession;
                }
                else if ((components.Components[i]) is XPCollection)
                {
                    ((XPCollection)components.Components[i]).Session = m_ProductionSession;
                }
            }

            m_Items      = new ItemsBLL();
            m_Production = new ProductionBLL();
            m_Shift      = new ShiftsBLL();
            m_Machines   = new MachinesLinesBLL();
            m_Customers  = new CustomersBLL();

            LookUpColumnInfo shiftNameColumn = new LookUpColumnInfo()
            {
                Caption   = "Shift",
                FieldName = "ShiftName"
            };

            shiftLookUpEdit.Properties.Columns.Add(shiftNameColumn);
            shiftLookUpEdit.Properties.DisplayMember = "ShiftName";
            shiftLookUpEdit.Properties.ValueMember   = "ShiftID";

            shiftFilterLookUpEdit.Properties.Columns.Add(shiftNameColumn);
            shiftFilterLookUpEdit.Properties.DisplayMember = "ShiftName";
            shiftFilterLookUpEdit.Properties.ValueMember   = "ShiftID";

            //Dim machineNameColumn As Controls.LookUpColumnInfo = New Controls.LookUpColumnInfo() With {.Caption = "Machine Line", .FieldName = "MachineLineName"}

            //Me.machineLookUpEdit.Properties.Columns.Add(machineNameColumn)
            //Me.machineLookUpEdit.Properties.DisplayMember = "MachineLineName"
            //Me.machineLookUpEdit.Properties.ValueMember = "MachineLineID"

            //Me.machineFilterLookUpEdit.Properties.Columns.Add(machineNameColumn)
            //Me.machineFilterLookUpEdit.Properties.DisplayMember = "MachineLineName"
            //Me.machineFilterLookUpEdit.Properties.ValueMember = "MachineLineID"

            FillDropDowns();

            PrepareNewRecord();
            if (DateTime.Now.TimeOfDay < new TimeSpan(9, 0, 0))
            {
                productionDateEdit.DateTime = DateTime.Today.AddDays(-1);
            }
            else
            {
                productionDateEdit.DateTime = DateTime.Today;
            }

            SetDefaultViewFilter();
            FillProductionView();

            Cursor = Cursors.Default;
        }
Exemplo n.º 17
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);
        }