private bool RemoveTempStatusOnLoans() { List <int> _selectedLoanNumbers = new List <int>(); List <string> _selectedRefTypes = new List <string>(); foreach (var custHold in custHolds) { _selectedLoanNumbers.Add(Utilities.GetIntegerValue(custHold.TicketNumber)); _selectedRefTypes.Add(Utilities.GetStringValue(custHold.RefType)); } string strStoreNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber; string errorCode; string errorMsg; bool retVal = StoreLoans.UpdateTempStatus(_selectedLoanNumbers, StateStatus.BLNK, strStoreNumber, true, _selectedRefTypes, out errorCode, out errorMsg); return(retVal); }
private void continueButton_Click(object sender, EventArgs e) { string sErrorCode = "0"; var sErrorText = string.Empty; if (refurbNumber.Text == "") { MessageBox.Show("A Refurb Number is required to be entered before continuing.", "Refurb Number Validation", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } int iRefurbNumber = Convert.ToInt32(refurbNumber.Text); //TODO: The -60 days should be a rule!!! StoreLoans.CheckStoreRefurbNumber(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, ShopDateTime.Instance.ShopDate.AddDays(-60), iRefurbNumber, out sErrorCode, out sErrorText); if (sErrorCode != "0") { refurbNumber.Text = ""; refurbNumber.Focus(); inputLabel.Text = "The number entered is already in use.\n Please enter another number."; } else { bool exists = false; if (CurrentRefurbNumbers != null) { if (CurrentRefurbNumbers.Any(i => i == iRefurbNumber)) { inputLabel.Text = "The number entered is already in use.\n Please enter another number."; exists = true; } } if (!exists) { Item.RefurbNumber = iRefurbNumber; MessageBox.Show("Refurb Number available and updated to Pawn Item.", "Refurb Number Validation", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } }
//---- //---- private void dateFindButton_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; string sErrorCode; string sErrorText; //Removed for defect to another location -- TLR 6/1/2010 //StoreLoans.CheckForPriorPFI( // GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, // out refNumbers, // out sErrorCode, // out sErrorText); //if(refNumbers.Count > 0) //{ // string sMsg = "The following loans need to be PFI posted before continuing." + Environment.NewLine + Environment.NewLine; // sMsg += "Pending Loans: "; // foreach (int i in refNumbers) // { // sMsg += i.ToString() + ", "; // } // sMsg = sMsg.Substring(0, sMsg.Length - 2) + "."; // MessageBox.Show(sMsg, "PFI Posting Validation", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} if (dateCalendarSearchDate.SelectedDate == "mm/dd/yyyy") { MessageBox.Show("You need to provide a date before continuing.", "PFI Posting Validation", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } backButton.Enabled = false; printButton.Enabled = false; continueButton.Enabled = false; selectAllButton.Enabled = false; deselectAllButton.Enabled = false; selectAllButton.Visible = false; deselectAllButton.Visible = false; asOfLabel.Text = dateCalendarSearchDate.SelectedDate; DateTime dt = Convert.ToDateTime(dateCalendarSearchDate.SelectedDate); //dt = dt.AddDays(-1); bool noDataFound = false; if (StoreLoans.GetPFIableItems(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, dt, out _ItemsToPFI, out sErrorCode, out sErrorText)) //if (StoreLoans.GetStoreLoans(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, // ProductStatus.IP, StateStatus.BLNK, dt, true, out _PawnLoans, out _PawnApplications, out _CustomerVOs, out sErrorCode, out sErrorText)) { gvLoans.Rows.Clear(); /* * _PawnLoans.Sort(delegate(PawnLoan p, PawnLoan p2) * { * return p.PfiEligible.CompareTo(p2.PfiEligible); * }); */ for (int i = 0; i < _ItemsToPFI.Rows.Count; i++) { int gvIdx = gvLoans.Rows.Add(); DataGridViewRow myRow = gvLoans.Rows[gvIdx]; // VERIFY WHAT COMES BACK TO POPULATE DATAGRIDVIEW myRow.Cells[colPfiDate.Name].Value = String.Format("{0:MM/dd/yyyy}", _ItemsToPFI.Rows[i]["PFI_ELIG"]); myRow.Cells[colType.Name].Value = _ItemsToPFI.Rows[i]["TYPE"]; myRow.Cells[colNumber.Name].Value = Utilities.GetIntegerValue(_ItemsToPFI.Rows[i]["TICKET_NUMBER"], 0); myRow.Cells[colCustomerName.Name].Value = _ItemsToPFI.Rows[i]["NAME"]; myRow.Cells[colMDSE.Name].Value = _ItemsToPFI.Rows[i]["MDSE_TYPE"]; myRow.Cells[colAmount.Name].Value = String.Format("{0:c2}", Utilities.GetDecimalValue(_ItemsToPFI.Rows[i]["AMOUNT"], 0.00M)); myRow.Cells[colPaidIn.Name].Value = String.Format("{0:c2}", Utilities.GetDecimalValue(_ItemsToPFI.Rows[i]["PAID_IN"], 0.00M)); myRow.Cells[colSelect.Name].ReadOnly = false; if (Utilities.GetDateTimeValue(_ItemsToPFI.Rows[i]["PFI_ELIG"]).Ticks > dt.Ticks) { myRow.Cells[colSelect.Name].ReadOnly = true; } else { myRow.Cells[colSelect.Name].ReadOnly = false; } } asOfLabel.Visible = true; totalPanel.Visible = true; if (dt.Ticks > ShopDateTime.Instance.ShopDate.Ticks) { gvLoans.Columns[colSelect.Name].Visible = false; totalSelectedPfiLabelLabel.Visible = false; totalSelectedPfiLabel.Visible = false; } else { gvLoans.Columns[colSelect.Name].Visible = true; totalSelectedPfiLabelLabel.Visible = true; totalSelectedPfiLabel.Visible = true; selectAllButton.Enabled = (gvLoans.Rows.Count > 0); deselectAllButton.Enabled = (gvLoans.Rows.Count > 0); selectAllButton.Visible = (gvLoans.Rows.Count > 0); deselectAllButton.Visible = (gvLoans.Rows.Count > 0); if (selectAllButton.Enabled) { selectAllButton.PerformClick(); } } UpdateCounts(); this.Cursor = Cursors.Default; } else { noDataFound = true; } /* * if (PurchaseProcedures.GetStorePurchases(CashlinxDesktopSession.Instance.OracleDA, * GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, * ProductStatus.PUR, StateStatus.BLNK, "",dt, true, out _Purchases, out _CustomerVOs, out sErrorCode, out sErrorText)) * { * * _Purchases.Sort((p, p2) => p.PfiEligible.CompareTo(p2.PfiEligible)); * * for (int i = 0; i < _Purchases.Count; i++) * { * int gvIdx = gvLoans.Rows.Add(); * DataGridViewRow myRow = gvLoans.Rows[gvIdx]; * CustomerVO customerVO = _CustomerVOs.Find(c => c.CustomerNumber == _Purchases[i].CustomerNumber); * string sCustomerName = ""; * if (customerVO != null) * { * sCustomerName = customerVO.LastName + ", "; * if (customerVO.FirstName != "") * sCustomerName += customerVO.FirstName + " "; * if (customerVO.MiddleInitial != "") * sCustomerName += customerVO.MiddleInitial; * sCustomerName = sCustomerName.Replace(" ", " "); * } * * // VERIFY WHAT COMES BACK TO POPULATE DATAGRIDVIEW * myRow.Cells[colPfiDate.Name].Value = String.Format("{0:MM/dd/yyyy}", _Purchases[i].PfiEligible); * myRow.Cells[colType.Name].Value = "PURCHASE"; // Utilities.GetStringValue("", ""); * myRow.Cells[colNumber.Name].Value = Utilities.GetIntegerValue(_Purchases[i].TicketNumber, 0); * myRow.Cells[colCustomerName.Name].Value = sCustomerName; * myRow.Cells[colMDSE.Name].Value = MerchandiseType(_Purchases[i]); * myRow.Cells[colAmount.Name].Value = String.Format("{0:c2}", Utilities.GetDecimalValue(_Purchases[i].Amount, 0.00M)); * myRow.Cells[colPaidIn.Name].Value = String.Format("{0:c2}", GetPaidInAmount(_Purchases[i])); * * if (_Purchases[i].PfiEligible.Ticks > dt.Ticks) * myRow.Cells[colSelect.Name].ReadOnly = true; * else * { * myRow.Cells[colSelect.Name].ReadOnly = false; * } * } * * asOfLabel.Visible = true; * totalPanel.Visible = true; * * if (dt.Ticks > CashlinxDesktop.Desktop.ShopDateTime.Instance.ShopDate.Ticks) * { * gvLoans.Columns[colSelect.Name].Visible = false; * totalSelectedPfiLabelLabel.Visible = false; * totalSelectedPfiLabel.Visible = false; * } * else * { * gvLoans.Columns[colSelect.Name].Visible = true; * totalSelectedPfiLabelLabel.Visible = true; * totalSelectedPfiLabel.Visible = true; * * selectAllButton.Enabled = (gvLoans.Rows.Count > 0); * deselectAllButton.Enabled = (gvLoans.Rows.Count > 0); * selectAllButton.Visible = (gvLoans.Rows.Count > 0); * deselectAllButton.Visible = (gvLoans.Rows.Count > 0); * * if (selectAllButton.Enabled) * selectAllButton.PerformClick(); * } * * UpdateCounts(); * _FoundRecords = true; * this.Cursor = Cursors.Default; * } * else * { * noPURDataFound = true; * } * */ if (noDataFound) { MessageBox.Show(@"No Data Found", "PFI Search", MessageBoxButtons.OK, MessageBoxIcon.Warning); } this.Cursor = Cursors.Default; }
private void printButton_Click(object sender, EventArgs e) { // Have extra enumeration to go ProKnow with only ONE call List <CustomerProductDataVO> productObjects = new List <CustomerProductDataVO>(); List <String> customerNames = new List <String>(); List <int> tickets = new List <int>(gvLoans.Rows.Count); Cursor = Cursors.WaitCursor; try { // improve efficiency -- only return new numbers if these have been previously loaded foreach (DataGridViewRow myRow in gvLoans.Rows) { if (Convert.ToBoolean(myRow.Cells[colSelect.Name].Value) && !myRow.Cells[colSelect.Name].ReadOnly) { int iTktNumber = Utilities.GetIntegerValue(myRow.Cells[colNumber.Name].Value, 0); if (iTktNumber != 0) { tickets.Add(iTktNumber); } } } string errorCode; string errorTxt; DateTime dt = Convert.ToDateTime(dateCalendarSearchDate.SelectedDate); StoreLoans.Get_PFI_Details(CashlinxDesktopSession.Instance.CurrentSiteId.StoreNumber, dt, tickets, out _PawnLoans, out _PawnApplications, out _CustomerVOs, out _Purchases, out errorCode, out errorTxt); foreach (DataGridViewRow myRow in gvLoans.Rows) { if (Convert.ToBoolean(myRow.Cells[colSelect.Name].Value) && !myRow.Cells[colSelect.Name].ReadOnly) { int iTktNumber = Utilities.GetIntegerValue(myRow.Cells[colNumber.Name].Value, 0); string customer = (string)myRow.Cells[4].Value; PawnLoan pawnLoan = null; if (myRow.Cells[colType.Name].Value.Equals("LOAN")) { if (_PawnLoans != null) { pawnLoan = (from ploan in _PawnLoans where ploan.TicketNumber == iTktNumber && ploan.ProductType == ProductType.PAWN.ToString() select ploan).FirstOrDefault(); } if (pawnLoan != null) { LoanPrinted loanPrinted = _PrintedLoans.Find( l => l.LoanNumber == iTktNumber && l.RefType == 1); loanPrinted.bPrinted = true; _PrintedLoans.RemoveAll( l => l.LoanNumber == iTktNumber && l.RefType == 1); _PrintedLoans.Add(loanPrinted); productObjects.Add(pawnLoan); customerNames.Add(customer); } } else { PurchaseVO purchaseObj = null; if (_Purchases != null) { purchaseObj = (from purchase in _Purchases where purchase.TicketNumber == iTktNumber select purchase).FirstOrDefault(); } if (purchaseObj != null) { LoanPrinted loanPrinted = _PrintedLoans.Find(l => l.LoanNumber == iTktNumber && l.RefType == 2); loanPrinted.bPrinted = true; _PrintedLoans.RemoveAll(l => l.LoanNumber == iTktNumber && l.RefType == 2); _PrintedLoans.Add(loanPrinted); productObjects.Add(purchaseObj); customerNames.Add(customer); } } } } if (productObjects.Count() > 0) { ProcessingMessage processingForm = new ProcessingMessage("Please wait while we generate report."); try { processingForm.Show(); this.Cursor = Cursors.WaitCursor; //----- Tracy 12/15/2010 List <int> lstTicketNumbers = new List <int>(); List <string> lstRefTypes = new List <string>(); string sErrorCode; string sErrorText; foreach (CustomerProductDataVO o in productObjects) { lstTicketNumbers.Add(o.TicketNumber); lstRefTypes.Add(o.ProductType == "PAWN" ? "1" : "2"); } if (lstTicketNumbers.Count > 0 && !StoreLoans.UpdateTempStatus( lstTicketNumbers, StateStatus.PFIW, CashlinxDesktopSession.Instance.CurrentSiteId.StoreNumber, true, lstRefTypes, out sErrorCode, out sErrorText)) { MessageBox.Show("Error updating PFI Verify. " + sErrorText, "PFI Verification Update", MessageBoxButtons.OK, MessageBoxIcon.Warning); } //------- Tracy 12/15/2010 var context = new PickingSlipHelper().GetPickingSlipReportContext(productObjects, customerNames, true); var reportObject = new ReportObject(); reportObject.ReportTempFile = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath; reportObject.CreateTemporaryFullName(); context.ReportObject = reportObject; var pickingSlip = new PickingSlip(context); if (!pickingSlip.CreateReport()) { processingForm.Close(); processingForm.Dispose(); this.Cursor = Cursors.Default; MessageBox.Show("Failed to generate report", "Picking Slip", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Dictionary<string, string> eDeviceData = new PrintUtilities().GetPrintDeviceData("pfipickslip"); if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled && GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IsValid) { if (FileLogger.Instance.IsLogInfo) { FileLogger.Instance.logMessage(LogLevel.INFO, "PFI_SelectLoan", "Printing PFI picking slip on {0}", GlobalDataAccessor.Instance.DesktopSession.LaserPrinter); } string strReturnMessage = PrintingUtilities.printDocument(reportObject.ReportTempFileFullName, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port, 1); if (!strReturnMessage.Contains("SUCCESS")) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Cannot print picking slip : " + strReturnMessage); } } processingForm.Close(); processingForm.Dispose(); this.Cursor = Cursors.Default; MessageBox.Show("Printing Complete", "Picking Slip", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception exc) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, exc.Message); processingForm.Close(); processingForm.Dispose(); this.Cursor = Cursors.Default; MessageBox.Show(exc.Message); } } //else //{ // continueButton.Enabled = false; //} continueButton.Enabled = true; } catch (Exception exp) { MessageBox.Show("Error in printing. Retry. (" + exp.Message + ")", "PFI Printing"); } Cursor = Cursors.Default; }