private void getSelectedTransactions()
        {
            _selectedTransactions = new List <HoldData>();
            _selectedLoanNumbers  = new List <int>();
            List <Item> transactionItems = new List <Item>();
            var         dateMade         = string.Empty;

            foreach (DataGridViewRow dgvr in customDataGridViewTransactions.Rows)
            {
                if (dgvr.Cells[1].Value != null && dgvr.Cells[1].Value.ToString() == "true")
                {
                    HoldData customerHoldData     = new HoldData();
                    int      selectedTicketNumber = Utilities.GetIntegerValue(dgvr.Cells[4].Value);
                    string   origTicketNumber     = dgvr.Cells[8].Value.ToString();
                    customerHoldData.StatusCode   = dgvr.Cells[5].Value.ToString().Substring(0, dgvr.Cells[5].Value.ToString().IndexOf("-"));
                    customerHoldData.TicketNumber = selectedTicketNumber;
                    customerHoldData.RefType      = "1";
                    dateMade = dgvr.Cells[2].Value.ToString();
                    customerHoldData.CustomerNumber   = _customerNumber;
                    customerHoldData.OrgShopNumber    = _storeNumber;
                    customerHoldData.HoldType         = HoldTypes.CUSTHOLD.ToString();
                    customerHoldData.UserId           = _userId;
                    customerHoldData.TransactionDate  = Utilities.GetDateTimeValue(dateMade, DateTime.MaxValue);
                    customerHoldData.Amount           = Utilities.GetDecimalValue(dgvr.Cells[7].Value, 0);
                    customerHoldData.PrevTicketNumber = Utilities.GetIntegerValue(dgvr.Cells[9].Value, 0);
                    customerHoldData.OrigTicketNumber = Utilities.GetIntegerValue(dgvr.Cells[8].Value);
                    customerHoldData.TempStatus       = (StateStatus)Enum.Parse(typeof(StateStatus),
                                                                                Utilities.GetStringValue(dgvr.Cells[6].Value) != string.Empty
                                                                          ? Utilities.GetStringValue(dgvr.Cells[6].Value)
                                                                          : StateStatus.BLNK.ToString());
                    _selectedLoanNumbers.Add(Utilities.GetIntegerValue(selectedTicketNumber));
                    transactionItems = new List <Item>();
                    if (_merchandiseTable != null)
                    {
                        DataRow[] merchandiseRows     = _merchandiseTable.Select(string.Format("{0}='{1}'", holdsmdsecursor.ICNDOC, origTicketNumber));
                        int       merchandiseRowCount = merchandiseRows.Length;
                        for (int j = 0; j < merchandiseRowCount; j++)
                        {
                            Item newItem = new Item();
                            newItem.TicketDescription = merchandiseRows[j][holdsmdsecursor.ITEMDESCRIPTION].ToString();
                            newItem.Icn            = merchandiseRows[j][holdsmdsecursor.ICN].ToString();
                            newItem.Location_Aisle = merchandiseRows[j][holdsmdsecursor.AISLE].ToString();
                            newItem.Location_Shelf = merchandiseRows[j][holdsmdsecursor.SHELF].ToString();
                            newItem.Location       = merchandiseRows[j][holdsmdsecursor.OTHERLOCATION].ToString();
                            newItem.mDocNumber     = Utilities.GetIntegerValue(origTicketNumber, 0);
                            transactionItems.Add(newItem);
                        }
                        customerHoldData.Items = transactionItems;
                    }
                    _selectedTransactions.Add(customerHoldData);
                }
            }

            GlobalDataAccessor.Instance.DesktopSession.HoldsData = _selectedTransactions;
        }
Ejemplo n.º 2
0
        private void PickSlipPrint_Load(object sender, EventArgs e)
        {
            //Get all the data to print from the desktop session
            CustomerVO      currentCust   = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer;
            List <HoldData> custHoldsData = GlobalDataAccessor.Instance.DesktopSession.HoldsData;

            userName = GlobalDataAccessor.Instance.DesktopSession.UserName.ToLowerInvariant();
            labelTransactionType.Text = PickSlipType + @" Picking Slip";
            labelEmployeeNo.Text      = userName;
            //set up the data
            if (currentCust != null && custHoldsData.Count > 0)
            {
                foreach (HoldData holdTransaction in custHoldsData)
                {
                    pageNo           = 1;
                    itemCount        = 0;
                    transactionDate  = DateTime.Now.ToString("g");//holdTransaction.TransactionDate.ToShortDateString();
                    labelPageNo.Text = "Page " + pageNo.ToString();
                    labelDate.Text   = transactionDate;
                    if (!string.IsNullOrEmpty(currentCust.MiddleInitial))
                    {
                        labelCustName.Text = currentCust.LastName + "," + currentCust.FirstName + "," + currentCust.MiddleInitial;
                    }
                    else
                    {
                        labelCustName.Text = currentCust.LastName + "," + currentCust.FirstName;
                    }

                    labelCurrentLoanNo.Text = holdTransaction.TicketNumber.ToString();
                    labelLoanAmt.Text       = String.Format("{0:C}", holdTransaction.Amount);

                    if (new BusinessRulesProcedures(GlobalDataAccessor.Instance.DesktopSession).IsPartialPaymentAllowed(GlobalDataAccessor.Instance.CurrentSiteId))
                    {
                        labelCurrentPrincipal.Text = String.Format("{0:C}", holdTransaction.CurrentPrincipalAmount);
                    }
                    else
                    {
                        labelCurrentPrincipalHeading.Visible = false;
                        labelCurrentPrincipal.Visible        = false;
                    }

                    labelorigLoanNo.Text     = holdTransaction.OrigTicketNumber.ToString();
                    labelPreviousLoanNo.Text = holdTransaction.PrevTicketNumber.ToString();

                    //item description of all items for this ticket
                    int      rowNum      = 0;
                    HoldData transaction = holdTransaction;
                    var      items       =
                        holdTransaction.Items.Where(
                            itemdata => itemdata.mDocNumber == transaction.OrigTicketNumber);
                    int pageNumberCount = 0;
                    if (items.Count() > 0)
                    {
                        tableLayoutPanelItemData.Controls.Clear();
                        tableLayoutPanelItemData.Height = 0;

                        foreach (Item transactionItem in items)
                        {
                            PickSlipPrintControl slipControl = new PickSlipPrintControl();
                            itemCount = itemCount + 1;
                            slipControl.ItemNumber      = itemCount;
                            slipControl.ItemDescription = transactionItem.TicketDescription.ToString();
                            if (transactionItem.GunNumber > 0)
                            {
                                slipControl.GunNumber = transactionItem.GunNumber.ToString();
                            }
                            if (transactionItem.Location_Aisle != string.Empty)
                            {
                                slipControl.ItemLocationAisle = transactionItem.Location_Aisle.ToString();
                            }
                            if (transactionItem.Location_Shelf != string.Empty)
                            {
                                slipControl.ItemLocationShelf = transactionItem.Location_Shelf.ToString();
                            }
                            if (transactionItem.Location != string.Empty)
                            {
                                slipControl.ItemLocationOther = transactionItem.Location.ToString();
                            }

                            //tableLayoutPanelItemData.Controls.Add(slipControl, 0, rowNum);
                            int gapDifference = pageFooterMarkerLabel.Top - tableLayoutPanelItemData.Bottom;
                            if (gapDifference < slipControl.Height)
                            {
                                //tableLayoutPanelItemData.Controls.Remove(slipControl);
                                rowNum = 0;
                                pageNumberCount++;
                                labelPageNo.Text = "Page " + pageNumberCount;
                                Print();
                                tableLayoutPanelItemData.Controls.Clear();
                                tableLayoutPanelItemData.Controls.Add(slipControl, 0, rowNum);
                                rowNum++;
                            }
                            else
                            {
                                tableLayoutPanelItemData.Controls.Add(slipControl, 0, rowNum);
                                rowNum++;
                            }
                        }
                    }
                    if (rowNum > 0)
                    {
                        pageNumberCount++;
                        labelPageNo.Text = "Page " + pageNumberCount;
                        Print();
                        tableLayoutPanelItemData.Controls.Clear();
                    }
                }
                Application.DoEvents();
            }
            this.Close();
        }
        private void GetSelectedTransactions()
        {
            _selectedTransactions = new List <HoldData>();
            List <Item> transactionItems = new List <Item>();
            var         dateMade         = string.Empty;

            foreach (DataGridViewRow dgvr in customDataGridViewTransactions.Rows)
            {
                if (dgvr.Cells[1].Value != null && dgvr.Cells[1].Value.ToString() == "true")
                {
                    int    selectedTicketNumber = Utilities.GetIntegerValue(dgvr.Cells[4].Value);
                    string origTicketNumber     = dgvr.Cells[12].Value.ToString();
                    dateMade = dgvr.Cells[2].Value.ToString();
                    HoldData customerHoldData = new HoldData
                    {
                        StatusCode =
                            dgvr.Cells[5].Value.ToString().Substring(0,
                                                                     dgvr.Cells[5].Value
                                                                     .ToString().IndexOf("-", System.StringComparison.Ordinal)),
                        TicketNumber    = selectedTicketNumber,
                        RefType         = "1",
                        CustomerNumber  = _customerNumber,
                        OrgShopNumber   = _storeNumber,
                        TransactionDate =
                            Utilities.GetDateTimeValue(dateMade, DateTime.MaxValue),
                        Amount   = Utilities.GetDecimalValue(dgvr.Cells[8].Value, 0),
                        HoldDate =
                            Utilities.GetDateTimeValue(dgvr.Cells[9].Value.ToString(),
                                                       DateTime.MaxValue),
                        UserId      = GlobalDataAccessor.Instance.DesktopSession.UserName,
                        HoldComment = dgvr.Cells[11].Value != null ? dgvr.Cells[11].Value.ToString() : string.Empty,
                        HoldType    = HoldTypes.CUSTHOLD.ToString(),
                        ReleaseDate =
                            Utilities.GetDateTimeValue(
                                dgvr.Cells[7].Value.ToString().FormatStringAsDate())
                    };
                    transactionItems = new List <Item>();
                    if (_merchandiseTable != null)
                    {
                        DataRow[] merchandiseRows     = _merchandiseTable.Select(holdsmdsecursor.ICNDOC + "='" + origTicketNumber + "'");
                        int       merchandiseRowCount = merchandiseRows.Length;
                        for (int j = 0; j < merchandiseRowCount; j++)
                        {
                            ProductStatus itemStatus = new ProductStatus();
                            string        locStatus  = merchandiseRows[j][holdsmdsecursor.STATUS].ToString();
                            if (locStatus.StartsWith("PFI"))
                            {
                                itemStatus = ProductStatus.PFI;
                            }
                            else
                            {
                                itemStatus = ProductStatus.ALL;
                            }
                            Item newItem = new Item
                            {
                                TicketDescription =
                                    merchandiseRows[j][holdsmdsecursor.ITEMDESCRIPTION].
                                    ToString(),
                                Icn            = merchandiseRows[j][holdsmdsecursor.ICN].ToString(),
                                Location_Aisle = merchandiseRows[j][holdsmdsecursor.AISLE].ToString(),
                                Location_Shelf = merchandiseRows[j][holdsmdsecursor.SHELF].ToString(),
                                Location       =
                                    merchandiseRows[j][holdsmdsecursor.OTHERLOCATION].
                                    ToString(),
                                ItemStatus = itemStatus,
                                IsJewelry  = Utilities.IsJewelry(Convert.ToInt32(merchandiseRows[j][holdsmdsecursor.CATCODE]))
                            };
                            transactionItems.Add(newItem);
                        }
                        customerHoldData.Items = transactionItems;
                    }

                    _selectedTransactions.Add(customerHoldData);
                }
            }

            GlobalDataAccessor.Instance.DesktopSession.HoldsData = _selectedTransactions;
        }