public VoidReceiptSummary(PawnLoan pLoan, PawnAppVO pApp) { InitializeComponent(); //this.NavControlBox = new NavBox(); this.pwnApp = pApp; this.pwnLoan = pLoan; }
private void LookupTicketResults_Load(object sender, EventArgs e) { _ownerfrm = Owner; NavControlBox.Owner = this; //Show customer data using the customer object stored in session CustomerVO custdata = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer; if (custdata != null) { customDataGridViewTicketResults.Rows.Add(1); customDataGridViewTicketResults.Rows[0].Cells["custlastname"].Value = custdata.LastName; customDataGridViewTicketResults.Rows[0].Cells["custfirstname"].Value = custdata.FirstName; customDataGridViewTicketResults.Rows[0].Cells["dob"].Value = custdata.DateOfBirth.FormatDate(); AddressVO custAddr = custdata.getHomeAddress(); if (custAddr != null) { customDataGridViewTicketResults.Rows[0].Cells["address"].Value = custAddr.Address1 + " " + custAddr.UnitNum + " " + custAddr.City + "," + custAddr.State_Code + " " + custAddr.ZipCode; } IdentificationVO currentId = custdata.getIdentity(0); if (GlobalDataAccessor.Instance.DesktopSession.TicketTypeLookedUp == ProductType.LAYAWAY) { customDataGridViewTicketResults.Rows[0].Cells["IDData"].Value = currentId.IdType + "-" + currentId.IdIssuer + "-" + currentId.IdValue; //Get the layaway from session to get the ticket number List <LayawayVO> layaway = GlobalDataAccessor.Instance.DesktopSession.Layaways; var tktNumber = string.Empty; if (layaway != null) { LayawayVO layawayObj = layaway.First(); if (layawayObj != null) { tktNumber = layawayObj.TicketNumber.ToString(); } } tktNumberLabel.Text = tktNumber; } else { //Get ID data from the pawn app object List <PawnAppVO> pawnApplications = GlobalDataAccessor.Instance.DesktopSession.PawnApplications; long pawnAppId; try { pawnAppId = Convert.ToInt64(GlobalDataAccessor.Instance.DesktopSession.CurPawnAppId); } catch (Exception) { pawnAppId = 0; } if (pawnAppId != 0 && pawnApplications != null) { PawnAppVO pawnApplication = pawnApplications.First (papp => papp.PawnAppID == pawnAppId); if (pawnApplication != null) { customDataGridViewTicketResults.Rows[0].Cells["IDData"].Value = pawnApplication.PawnAppCustIDType + "-" + pawnApplication.PawnAppCustIDIssuer + "-" + pawnApplication.PawnAppCustIDNumber; } //Get the pawn loan from session to get the ticket number //Only 1 pawn loan for this application id List <PawnLoan> pawnLoans = GlobalDataAccessor.Instance.DesktopSession.PawnLoans; var tktNumber = string.Empty; if (pawnLoans != null) { PawnLoan pawnLoanObj = pawnLoans.First (ploan => ploan.PawnAppId == pawnAppId.ToString()); if (pawnLoanObj != null) { tktNumber = pawnLoanObj.TicketNumber.ToString(); } } tktNumberLabel.Text = tktNumber; } else { BasicExceptionHandler.Instance.AddException("Pawn Application Data is not found in Lookup Ticket Results ", new ApplicationException()); NavControlBox.Action = NavBox.NavAction.CANCEL; } } } else { BasicExceptionHandler.Instance.AddException("Customer object is missing in session ", new ApplicationException()); //NavControlBox.Action = NavBox.NavAction.CANCEL; } }
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); } } }
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(); } } }