Ejemplo n.º 1
0
        private bool getLoanData()
        {
            bool       retValue = false;
            string     errorCode;
            string     errorText;
            PawnLoan   pawnLoan;
            PawnAppVO  pawnApplication;
            CustomerVO customerObj;

            retValue = CustomerLoans.GetPawnLoan(GlobalDataAccessor.Instance.DesktopSession,
                                                 Utilities.GetIntegerValue(BuyStoreText.Text, 0), Utilities.GetIntegerValue(LoanNumberText.Text, 0),
                                                 "0", StateStatus.BLNK, true, out pawnLoan,
                                                 out pawnApplication, out customerObj,
                                                 out errorCode, out errorText);

            if (retValue && pawnLoan != null)
            {
                GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj;

                GlobalDataAccessor.Instance.DesktopSession.CurrentPawnLoan = pawnLoan;

                GlobalDataAccessor.Instance.DesktopSession.TicketTypeLookedUp = ProductType.PAWN;
                GlobalDataAccessor.Instance.DesktopSession.TicketLookedUp     = Utilities.GetIntegerValue(LoanNumberText.Text, 0);
                this.NavControlBox.Action = NavBox.NavAction.SUBMIT;
            }

            return(retValue);
        }
        /// <summary>
        /// Sets the storage id from the lookup data.
        /// </summary>
        /// <returns>True upon success.</returns>
        private bool SetStorageIDFromLookup()
        {
            var productsList =
                (System.Windows.Forms.ComboBox)productTypeList1.Controls[0];
            var ticketNumber = -1;

            if (productsList.SelectedIndex == 0 ||
                !int.TryParse(txtTicketNumber.Text.Trim(), out ticketNumber))
            {
                System.Windows.Forms.MessageBox.Show(
                    "Please ensure you have selected a product and ticket number.");
                return(false);
            }

            var docInfo = new CouchDbUtils.PawnDocInfo();

            string errString;

            docInfo.StoreNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
            if (productsList.SelectedValue.ToString() == DocumentHelper.RECIEPT)
            {
                docInfo.ReceiptNumber = ticketNumber;
                docInfo.SetDocumentSearchType(CouchDbUtils.DocSearchType.RECEIPT);
            }
            else if (productsList.SelectedValue.ToString() == DocumentHelper.POLICE_CARD)
            {
                docInfo.ReceiptNumber = ticketNumber;
                docInfo.TicketNumber  = ticketNumber;
                docInfo.SetDocumentSearchType(CouchDbUtils.DocSearchType.POLICE_CARD);
            }
            else if (productsList.SelectedValue.ToString() == DocumentHelper.RELEASE_FINGERPRINTS)
            {
                docInfo.TicketNumber = ticketNumber;
                docInfo.SetDocumentSearchType(CouchDbUtils.DocSearchType.RELEASE_FINGERPRINTS);
            }
            else
            {
                docInfo.TicketNumber = ticketNumber;
                docInfo.SetDocumentSearchType(CouchDbUtils.DocSearchType.STORE_TICKET);
            }

            //Also set the meta tag here as well as search type.
            if (productsList.SelectedValue.Equals(DocumentHelper.CUSTOMER_BUY) ||
                productsList.SelectedValue.Equals(DocumentHelper.PURCHASE_RETURN))
            {
                if (GlobalDataAccessor.Instance.CurrentSiteId.State == States.Indiana)
                {
                    docInfo.AuxInfo = PurchaseDocumentIndiana.PURCHASE_AUXINFOTAG;
                }
                else
                {
                    docInfo.AuxInfo = PurchaseDocumentGenerator.PURCHASE_AUXINFOTAG;
                }
            }
            else if (productsList.SelectedValue.Equals(DocumentHelper.PAWN_LOAN))
            {
                PawnLoan   pawnLoan;
                PawnAppVO  pApp;
                CustomerVO customerVO;
                string     errorCode;
                string     errorText;

                if (!CustomerLoans.GetPawnLoan(GlobalDataAccessor.Instance.DesktopSession, Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber), ticketNumber, "0", StateStatus.BLNK, true,
                                               out pawnLoan, out pApp, out customerVO, out errorCode, out errorText))
                {
                    FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Error trying to get loan data" + errorText);
                    MessageBox.Show("Error trying to get loan details for the number entered.");
                    return(false);
                }

                if (pawnLoan.DateMade.Date != ShopDateTime.Instance.FullShopDateTime.Date)
                {
                    FileLogger.Instance.logMessage(LogLevel.WARN, this, "Cannot reprint loan documents for " + ticketNumber.ToString() + " on a previous date");
                    MessageBox.Show("This document is not eligible for reprint after the loan date.");
                    return(false);
                }
            }
            else if (productsList.SelectedValue.Equals(DocumentHelper.POLICE_CARD))
            {
                this.DocumentType = Document.DocTypeNames.TEXT;
            }
            else if (productsList.SelectedValue.Equals(DocumentHelper.RECIEPT))
            {
                this.DocumentType = Document.DocTypeNames.RECEIPT;
            }
            else if (productsList.SelectedValue.Equals(DocumentHelper.RELEASE_FINGERPRINTS))
            {
                this.DocumentType = Document.DocTypeNames.PDF;
            }
            else
            {
                throw new NotImplementedException("This product has not been implemented yet.");
            }

            var lastStorageId = documentHelper.GetStorageId(Utilities.GetStringValue(productsList.SelectedValue, null), docInfo, out errString);

            if (!string.IsNullOrEmpty(lastStorageId))
            {
                this.StorageId = lastStorageId;
            }
            else
            {
                MessageBox.Show("Could not find the document.");
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
        private void loadReceiptData()
        {
            //this.receiptDataTextBox.Text;
            DesktopSession cds = GlobalDataAccessor.Instance.DesktopSession;
            StringBuilder  sb  = new StringBuilder();

            sb.AppendLine(StringUtilities.centerString(CASHAMERICATXT, TXTBOXWIDTH));
            sb.AppendLine(StringUtilities.centerString(ProcessTenderController.STORE_NAME, TXTBOXWIDTH));
            this.store_short_name     = ProcessTenderController.STORE_NAME;
            this.store_street_address = ProcessTenderController.STORE_ADDRESS;
            this.store_city_state_zip = ProcessTenderController.STORE_CITY + ", " +
                                        ProcessTenderController.STORE_STATE + ProcessTenderController.STORE_ZIP;
            this.store_phone = ProcessTenderController.STORE_PHONE;
            sb.AppendLine(StringUtilities.centerString(ProcessTenderController.STORE_ADDRESS, TXTBOXWIDTH));
            sb.AppendLine(StringUtilities.centerString(ProcessTenderController.STORE_CITY
                                                       + ", "
                                                       + ProcessTenderController.STORE_STATE
                                                       + " "
                                                       + ProcessTenderController.STORE_ZIP, TXTBOXWIDTH));

            sb.AppendLine();
            sb.AppendLine(StringUtilities.centerString(ProcessTenderController.STORE_PHONE, TXTBOXWIDTH));
            if (CollectionUtilities.isNotEmpty(cds.PawnReceipt))
            {
                Common.Libraries.Utility.Shared.Receipt pReceipt = cds.PawnReceipt[0];
                DateTime receiptDt = pReceipt.Date;

                //Load loan
                PawnLoan   pLoan;
                PawnAppVO  pApp;
                CustomerVO custVO;
                string     errorCode;
                string     errorText;
                try
                {
                    int receiptStore = Int32.Parse(pReceipt.StoreNumber);
                    int ticketNum    = Int32.Parse(pReceipt.RefNumber);
                    if (!CustomerLoans.GetPawnLoan(GlobalDataAccessor.Instance.DesktopSession, receiptStore, ticketNum, "0", StateStatus.BLNK, true,
                                                   out pLoan, out pApp, out custVO, out errorCode, out errorText))
                    {
                        //Do something about the error here
                        MessageBox.Show("Cannot find loan associated with receipt.");
                        NavControlBox.Action = NavBox.NavAction.CANCEL;
                        return;
                    }
                    this.pwnLoan = pLoan;
                    this.pwnApp  = pApp;

                    if (custVO == null)
                    {
                        //Do something about the error here
                        MessageBox.Show("Cannot find customer associated with receipt");
                        NavControlBox.Action = NavBox.NavAction.CANCEL;
                        return;
                    }

                    /* this.voidReceiptButton.Enabled =
                     * (this.pwnLoan.LoanStatus == PawnLoanStatus.IP);*/
                    this.printButton.Enabled = true;
                    this.f_date_and_time     = receiptDt.ToString("d", DateTimeFormatInfo.InvariantInfo) + " " +
                                               this.pwnLoan.MadeTime.ToShortTimeString();
                    sb.AppendLine(StringUtilities.centerString(this.f_date_and_time, TXTBOXWIDTH));
                    this.receipt_number = "" + pReceipt.ReceiptNumber;
                    sb.AppendLine(StringUtilities.centerString(RECEIPTNUM + pReceipt.ReceiptNumber, TXTBOXWIDTH));
                    sb.AppendLine();
                    sb.AppendLine(StringUtilities.centerString(CUSTOMERLABEL +
                                                               custVO.LastName + ", " + custVO.FirstName, TXTBOXWIDTH));
                    this.f_cust_name = custVO.LastName + ", " + custVO.FirstName.Substring(0, 1);
                    sb.AppendLine(StringUtilities.centerString(LOANLABEL +
                                                               pLoan.OrgShopNumber + pLoan.TicketNumber, TXTBOXWIDTH));
                    sb.AppendLine();
                    this.ticketAmount = this.pwnLoan.Amount.ToString("C");
                    this.ticketNumber = this.pwnLoan.TicketNumber.ToString();
                    if (this.pwnLoan.LoanStatus == ProductStatus.IP)
                    {
                        sb.AppendLine("1 Pawn Loan");
                        sb.AppendLine(BARDATA);
                        sb.AppendLine("Cash Paid TO Customer          " + pReceipt.Amount.ToString("C"));
                    }
                    else if (this.pwnLoan.LoanStatus == ProductStatus.PU)
                    {
                        sb.AppendLine("Pickup Pawn Loan");
                        sb.AppendLine(BARDATA);
                        sb.AppendLine("Cash Received FROM Customer    " + pReceipt.Amount.ToString("C"));
                    }
                    sb.AppendLine();
                    sb.AppendLine();
                    sb.AppendLine(StringUtilities.centerString(EMPLOYEELABEL + pReceipt.EntID, 40));
                    this.emp_number = pReceipt.EntID;
                    sb.AppendLine(TBARDATA);

                    //Add receipt information to text box
                    this.receiptDataTextBox.Text = sb.ToString();
                    this.receiptDataTextBox.Update();
                }
                catch (Exception)
                {
                    MessageBox.Show("Cannot find receipt.");
                    this.NavControlBox.Action = NavBox.NavAction.CANCEL;
                    this.Close();
                }
            }
        }
Ejemplo n.º 4
0
        private void TicketsDataGridView_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.ColumnIndex == TicketsDataGridView.Columns["FindColumn"].Index && e.RowIndex >= 0)
            {
                if (TicketsDataGridView["FindColumn", e.RowIndex].ReadOnly)
                {
                    return;
                }

                string sStoreNumber  = Utilities.GetStringValue(TicketsDataGridView["StoreColumn", e.RowIndex].Value, string.Empty);
                int    iTicketNumber = Utilities.GetIntegerValue(TicketsDataGridView["TicketColumn", e.RowIndex].Value, 0);

                //Duplicate check -- Madhu - BZ # 147 - prevent adding if it already exists in the grid
                bool exists            = false;
                int  existingTicketNum = 0;
                foreach (DataGridViewRow dr in TicketsDataGridView.Rows)
                {
                    existingTicketNum = Utilities.GetIntegerValue(dr.Cells["TicketColumn"].Value, 0);
                    if (dr.Index != e.RowIndex && existingTicketNum != 0 && iTicketNumber != 0 &&
                        existingTicketNum == iTicketNumber)
                    {
                        MessageBox.Show("Loan Number " + existingTicketNum + " has already been added in this list.");
                        exists = true;
                        break;
                    }
                }
                if (!exists)
                {
                    if (!string.IsNullOrEmpty(iTicketNumber.ToString()))
                    {
                        exists = parentWindow.SearchGrid(iTicketNumber.ToString());
                        if (exists)
                        {
                            MessageBox.Show("Loan Number " + iTicketNumber + " has already been added.");
                        }
                    }
                }

                if (exists)
                {
                    return;
                }
                //duplicate check end

                //no ticket - S. Murphy need store to default to current store if none is entered
                if (string.IsNullOrEmpty(sStoreNumber))
                {
                    sStoreNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
                }

                // Place Holder for Stored Proc call
                PawnLoan   pawnLoan   = new PawnLoan();
                PawnAppVO  pawnAppVO  = new PawnAppVO();
                CustomerVO customerVO = new CustomerVO();
                var        sErrorCode = string.Empty;
                var        sErrorText = string.Empty;

                if (CustomerLoans.GetPawnLoan(GlobalDataAccessor.Instance.DesktopSession, Convert.ToInt32(sStoreNumber), iTicketNumber, "0", StateStatus.BLNK, true,
                                              out pawnLoan, out pawnAppVO, out customerVO, out sErrorCode, out sErrorText))
                {
                    if (pawnLoan != null && pawnLoan.LoanStatus != ProductStatus.IP)
                    {
                        //TicketsDataGridView["NameColumn", e.RowIndex].Style.ForeColor = Color.Red;
                        DataGridViewCellStyle style = new DataGridViewCellStyle();
                        style.ForeColor = Color.Red;
                        TicketsDataGridView["NameColumn", e.RowIndex].Style.ApplyStyle(style);

                        TicketsDataGridView["NameColumn", e.RowIndex].Value = "Invalid Ticket";
                        //Madhu fix for BZ # 147
                        addButton.Enabled = false;
                    }
                    else
                    {
                        //Madhu fix for BZ # 147
                        EnableAddButton();
                        //addButton.Enabled = true;

                        if (customerVO.LastName != "")
                        {
                            TicketsDataGridView["NameColumn", e.RowIndex].Value = (
                                customerVO.FirstName
                                + " "
                                + customerVO.MiddleInitial + " "
                                + customerVO.LastName
                                ).Replace("  ", " ");
                            if (pawnLoan != null)
                            {
                                if (_AddedPawnLoans.FindIndex(delegate(PawnLoan pl)
                                {
                                    return(pl.TicketNumber == pawnLoan.TicketNumber);
                                }) < 0)
                                {
                                    _AddedPawnLoans.Add(pawnLoan);
                                }
                            }
                        }
                    }
                    if (TicketsDataGridView.CurrentRow != null)
                    {
                        //no ticket - S. Murphy need store to default to current store if none is entered
                        if (string.IsNullOrEmpty(sStoreNumber))
                        {
                            sStoreNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
                        }
                    }

                    if (TicketsDataGridView.CurrentRow.Index == e.RowIndex &&
                        TicketsDataGridView.Rows.Count - 1 == e.RowIndex &&
                        sStoreNumber != "" && iTicketNumber != 0)
                    {
                        TicketsDataGridView.Rows.Add();
                        //Madhu BZ # 147
                        TicketsDataGridView.EditingControlShowing += new DataGridViewEditingControlShowingEventHandler(TicketsDataGridView_EditingControlShowing);
                        foreach (DataGridViewRow dr in TicketsDataGridView.Rows)
                        {
                            string sStoreNum  = Utilities.GetStringValue(dr.Cells["StoreColumn"].Value);
                            int    iTicketNum = Utilities.GetIntegerValue(dr.Cells["TicketColumn"].Value);

                            if (string.IsNullOrEmpty(sStoreNum) || iTicketNum == 0)
                            {
                                dr.Cells["FindColumn"].ReadOnly = true;
                            }
                        }
                    }
                }
                else
                {
                    //Madhu fix for BZ # 147
                    if (TicketsDataGridView != null && TicketsDataGridView.Rows.Count <= 1)
                    {
                        addButton.Enabled = false;
                    }

                    MessageBox.Show("A Ticket Number was not found using the Store Number entered.", "Lookup Ticket Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Ejemplo n.º 5
0
 void bwLookupPawnTicket_DoWork(object sender, DoWorkEventArgs e)
 {
     _retValue = CustomerLoans.GetPawnLoan(GlobalDataAccessor.Instance.DesktopSession, _storeNumber, _ticketNumber, idType, StateStatus.BLNK, true, out _pawnLoan,
                                           out _pawnApplication, out _custObject, out _errorCode, out _errorText);
 }