public static void SetBackgroundCheckFee(LayawayVO layaway, decimal backgroundCheckFee) { if (layaway.Fees != null) { int idx = layaway.Fees.FindIndex(feeData => feeData.FeeType == FeeTypes.BACKGROUND_CHECK_FEE); if (idx >= 0) { layaway.Fees.RemoveAt(idx); } } else { layaway.Fees = new List <Fee>(); } if (backgroundCheckFee <= 0) { return; } Fee fee = new Fee() { FeeType = FeeTypes.BACKGROUND_CHECK_FEE, Value = backgroundCheckFee, OriginalAmount = backgroundCheckFee, FeeState = FeeStates.ASSESSED, FeeDate = Utilities.GetDateTimeValue(ShopDateTime.Instance.ShopTransactionTime, DateTime.Now) }; layaway.Fees.Add(fee); }
private void SetCustomerInfo(LayawayReportObject rptObj, LayawayVO layaway) { if (GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer != null) { rptObj.CustomerName = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.LastName + ", " + GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.FirstName; rptObj.CustomerFirstName = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.FirstName; rptObj.CustomerLastName = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.LastName; ContactVO cVo = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.getPrimaryContact(); if (cVo != null) { rptObj.ContactNumber = Commons.Format10And11CharacterPhoneNumberForUI(cVo.ContactAreaCode + cVo.ContactPhoneNumber); } else { rptObj.ContactNumber = ""; } } else { CustomerVO customerObject = CustomerProcedures.getCustomerDataByCustomerNumber(GlobalDataAccessor.Instance.DesktopSession, layaway.CustomerNumber); rptObj.CustomerFirstName = customerObject.FirstName; rptObj.CustomerLastName = customerObject.LastName; ContactVO cVo = customerObject.getPrimaryContact(); if (cVo != null) { rptObj.ContactNumber = Commons.Format10And11CharacterPhoneNumberForUI(cVo.ContactAreaCode + cVo.ContactPhoneNumber); } else { rptObj.ContactNumber = ""; } } }
private void gvPayments_Paint(object sender, PaintEventArgs e) { if (!setRedColor) { foreach (DataGridViewRow row in gvPayments.Rows) { if (row.Index == -1) { continue; } LayawayVO layaway = row.Tag as LayawayVO; if (layaway.NextPayment < ShopDateTime.Instance.ShopDate) { row.Cells[colDueDate.Index].Style = new DataGridViewCellStyle() { ForeColor = Color.Red }; } } if (gvPayments.Rows.Count > 0) { setRedColor = true; } } }
private void WriteDetail(PdfPTable detailTable, LayawayVO layaway) { WriteCell(detailTable, string.Empty, ReportFontUnderlined, 7, (int)Element.ALIGN_CENTER, (int)Rectangle.NO_BORDER); WriteCell(detailTable, "ICN", ReportFontUnderlined, 2, (int)Element.ALIGN_LEFT, (int)Rectangle.NO_BORDER); WriteCell(detailTable, "Description", ReportFontUnderlined, 3, (int)Element.ALIGN_CENTER, (int)Rectangle.NO_BORDER); WriteCell(detailTable, "Qty", ReportFontUnderlined, 1, (int)Element.ALIGN_CENTER, (int)Rectangle.NO_BORDER); WriteCell(detailTable, "Aisle/Shelf Location", ReportFontUnderlined, 1, (int)Element.ALIGN_CENTER, (int)Rectangle.NO_BORDER); foreach (var item in layaway.RetailItems) { //WriteCell(detailTable, item.Icn, ReportFontSmall, 2, (int)Element.ALIGN_LEFT, (int)Rectangle.NO_BORDER); PdfPCell cell = new PdfPCell(); cell = GetFormattedICNCellSmallFont(item.Icn); cell.Colspan = 2; detailTable.AddCell(cell); WriteCell(detailTable, item.TicketDescription, ReportFontSmall, 3, (int)Element.ALIGN_CENTER, (int)Rectangle.NO_BORDER); WriteCell(detailTable, item.Quantity.ToString(), ReportFontSmall, 1, (int)Element.ALIGN_CENTER, (int)Rectangle.NO_BORDER); if (!string.IsNullOrEmpty(item.Location_Aisle)) { WriteCell(detailTable, item.Location_Aisle, ReportFontSmall, 1, (int)Element.ALIGN_CENTER, (int)Rectangle.NO_BORDER); } else if (!string.IsNullOrEmpty(item.Location_Shelf)) { WriteCell(detailTable, item.Location_Shelf, ReportFontSmall, 1, (int)Element.ALIGN_CENTER, (int)Rectangle.NO_BORDER); } else { WriteCell(detailTable, string.Empty, ReportFontSmall, 1, (int)Element.ALIGN_CENTER, (int)Rectangle.NO_BORDER); } } }
public Layaway_dialog(LayawayVO data, Receipt r) { InitializeComponent(); dataToShow = data; receiptToShow = r; LoadData(); }
private void continueButton_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in gvPayments.Rows) { LayawayVO layawaySrc = row.Tag as LayawayVO; LayawayVO layaway; int index = GlobalDataAccessor.Instance.DesktopSession.ServiceLayaways.FindIndex(sl => sl.TicketNumber == layawaySrc.TicketNumber); if (index >= 0) { layaway = GlobalDataAccessor.Instance.DesktopSession.ServiceLayaways[index]; } else { layaway = new LayawayVO(layawaySrc); if (layawaySrc != null) { layaway.SalesTaxAmount = layawaySrc.SalesTaxAmount; } GlobalDataAccessor.Instance.DesktopSession.ServiceLayaways.Add(layaway); } decimal paymentAmount = Convert.ToDecimal(row.Cells["colPayment"].Value); LayawayServiceAmount += paymentAmount; layaway.Payments.Add(new LayawayPayment() { Amount = paymentAmount }); } this.Close(); }
private void gvPayments_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.RowIndex >= 0 && e.ColumnIndex == colDueDate.Index) { LayawayVO layaway = gvPayments.Rows[e.RowIndex].Tag as LayawayVO; if (layaway.NextPayment < ShopDateTime.Instance.ShopDate) { e.CellStyle.ForeColor = Color.Red; gvPayments[e.ColumnIndex, e.RowIndex].Style.ForeColor = Color.Red; } } }
public void Setup() { Layaway = new LayawayVO(); Layaway.TicketNumber = 227; Layaway.DownPayment = 19.49M; Layaway.DateMade = new DateTime(2011, 2, 8); Layaway.MonthlyPayment = 25.05M; Layaway.NumberOfPayments = 7; Layaway.FirstPayment = new DateTime(2011, 3, 8); Layaway.Receipts = new List <Receipt>(); AddReceipt(21.49M, Layaway.DateMade, ReceiptEventTypes.LAY, "98580", "97906", new DateTime(2011, 2, 8, 14, 37, 1)); }
public static bool CustomerPassesFirearmAgeCheckForItems(LayawayVO layaway, CustomerVO currentCustomer) { bool firearmAgeCheckPassed = true; var item = (from itemData in layaway.RetailItems where itemData.IsGun select itemData).FirstOrDefault(); if (item != null) { return(true); // no guns } if (currentCustomer == null) { return(false); } if (string.IsNullOrEmpty(currentCustomer.CustomerNumber)) { return(true); //This is a vendor sale so no background check form needed } var handGunItem = (from itemData in layaway.RetailItems where itemData.IsHandGun() select itemData).FirstOrDefault(); var lGunItem = (from itemData in layaway.RetailItems where itemData.IsLongGun() select itemData).FirstOrDefault(); if (lGunItem != null) { if (currentCustomer.Age < Convert.ToInt16(CustomerProcedures.getLongGunValidAge(GlobalDataAccessor.Instance.DesktopSession))) { firearmAgeCheckPassed = false; } } if (firearmAgeCheckPassed && handGunItem != null) { if (currentCustomer.Age < Convert.ToInt16(CustomerProcedures.getHandGunValidAge(GlobalDataAccessor.Instance.DesktopSession))) { firearmAgeCheckPassed = false; } } return(firearmAgeCheckPassed); }
private void submitButton_Click(object sender, EventArgs e) { string errorCode; string errorText; CustomerVO customerObj = null; LayawayVO layawayObj = null; bool retVal = RetailProcedures.GetLayawayData(GlobalDataAccessor.Instance.DesktopSession, GlobalDataAccessor.Instance.OracleDA, Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0), Utilities.GetIntegerValue(txtLayawayNumber.Text, 0), "0", StateStatus.BLNK, "LAY", true, out layawayObj, out customerObj, out errorCode, out errorText); if (!retVal || layawayObj == null) { MessageBox.Show("No records found or not the originating shop of the number entered."); txtLayawayNumber.Focus(); return; } //Check if the layaway has a status of PAID in which case only the sale can be refunded and not the layaway payment if (layawayObj.LoanStatus == ProductStatus.PAID) { MessageBox.Show("Layaway has been paid out. Can only refund sale at this point."); txtLayawayNumber.Focus(); return; } //SR 07/01/2011 Check if the layaway has a status of LAY. Any other status cannot be refunded. if (layawayObj.LoanStatus != ProductStatus.ACT) { MessageBox.Show("Layaway is in " + layawayObj.LoanStatus.ToString() + " status. Cannot be refunded."); txtLayawayNumber.Focus(); return; } /*int maxDaysForRefundEligibility = BusinessRulesProcedures.GetMaxDaysForRefundEligibility(CDS.CurrentSiteId); * if (ShopDateTime.Instance.FullShopDateTime > layawayObj.DateMade.AddDays(maxDaysForRefundEligibility)) * { * MessageBox.Show("The number of days eligible for refund has expired for the MSR number entered"); * return; * }?*/ GlobalDataAccessor.Instance.DesktopSession.Layaways = new List <LayawayVO>(); GlobalDataAccessor.Instance.DesktopSession.Layaways.Add(layawayObj); GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj; NavControlBox.IsCustom = true; NavControlBox.CustomDetail = "SHOWITEMS"; NavControlBox.Action = NavBox.NavAction.BACKANDSUBMIT; }
private void WritePaymentList(PdfPTable listTable, LayawayVO layaway) { int paymentsCount = 1; //loop thru all payments var paymentReceipts = (from r in layaway.Receipts where r.Event == ReceiptEventTypes.LAY.ToString() || r.Event == ReceiptEventTypes.LAYPMT.ToString() select r).OrderBy(rn => rn.ReceiptNumber).ThenBy(rt => rt.RefTime).ToList(); WriteCell(listTable, "Payment List", ReportFontUnderlined, 7, (int)Rectangle.ALIGN_CENTER, (int)Rectangle.NO_BORDER); foreach (Receipt receipt in paymentReceipts) { WriteCell(listTable, "[" + paymentsCount + "] " + receipt.Date.ToString("d") + " " + receipt.Amount.ToString("c"), ReportFontSmall, 1, (int)Rectangle.ALIGN_LEFT, (int)Rectangle.NO_BORDER); paymentsCount++; } int cellsToAdd = paymentReceipts.Count % 7; WriteCell(listTable, string.Empty, ReportFontUnderlined, 7 - cellsToAdd, (int)Rectangle.ALIGN_CENTER, (int)Rectangle.NO_BORDER); }
private void gvPayments_CellLeave(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex != 2) { return; } DataGridViewCell paymentAmountCell = gvPayments[2, e.RowIndex]; LayawayVO layaway = gvPayments.Rows[e.RowIndex].Tag as LayawayVO; decimal currentValue = Utilities.GetDecimalValue(paymentAmountCell.EditedFormattedValue, -1); if (currentValue <= 0) { MessageBox.Show("Invalid payment amount."); gvPayments.CancelEdit(); return; } LayawayPaymentHistoryBuilder builder; try { builder = new LayawayPaymentHistoryBuilder(layaway); } catch (Exception exc) { MessageBox.Show("Error building the payment schedule"); FileLogger.Instance.logMessage(LogLevel.ERROR, this, "gvPayments_CellLeave errored: " + exc.Message); return; } if (currentValue > builder.GetBalanceOwed()) { MessageBox.Show("Payment Cannot Exceed Total Owed"); gvPayments.CancelEdit(); return; } gvPayments.CommitEdit(DataGridViewDataErrorContexts.Commit); }
private void WriteInfo(PdfPTable infoTable, LayawayVO layaway) { //row Customer Name string customerName = string.Empty; if (!string.IsNullOrEmpty(ReportObject.CustomerFirstName) && !string.IsNullOrEmpty(ReportObject.CustomerLastName)) { customerName = ReportObject.CustomerLastName + "," + ReportObject.CustomerFirstName; } if (!string.IsNullOrEmpty(customerName)) { WriteCell(infoTable, "Customer: " + customerName, ReportFont, 2, (int)Element.ALIGN_LEFT, (int)Element.ALIGN_TOP, (int)Rectangle.NO_BORDER); } else { WriteCell(infoTable, string.Empty, ReportFont, 2, (int)Element.ALIGN_LEFT, (int)Element.ALIGN_TOP, (int)Rectangle.NO_BORDER); } WriteCell(infoTable, string.Empty, ReportFont, 3, (int)Element.ALIGN_CENTER, (int)Element.ALIGN_TOP, (int)Rectangle.NO_BORDER); WriteCell(infoTable, "Amount of Sale:", ReportFont, 1, (int)Element.ALIGN_RIGHT, (int)Rectangle.NO_BORDER); WriteCell(infoTable, layaway.Amount.ToString("C"), ReportFont, 1, (int)Element.ALIGN_RIGHT, (int)Rectangle.NO_BORDER); //row empty WriteCell(infoTable, string.Empty, ReportFont, 7, (int)Element.ALIGN_CENTER, (int)Element.ALIGN_TOP, (int)Rectangle.NO_BORDER); //row customer phone if (!string.IsNullOrEmpty(ReportObject.ContactNumber)) { WriteCell(infoTable, "Customer Phone: " + ReportObject.ContactNumber, ReportFont, 2, (int)Element.ALIGN_LEFT, (int)Element.ALIGN_TOP, (int)Rectangle.NO_BORDER); } else { WriteCell(infoTable, string.Empty, ReportFont, 2, (int)Element.ALIGN_LEFT, (int)Element.ALIGN_TOP, (int)Rectangle.NO_BORDER); } WriteCell(infoTable, string.Empty, ReportFont, 3, (int)Element.ALIGN_CENTER, (int)Element.ALIGN_TOP, (int)Rectangle.NO_BORDER); WriteCell(infoTable, "Sales Tax: ", ReportFont, 1, (int)Element.ALIGN_RIGHT, (int)Element.ALIGN_TOP, (int)Rectangle.NO_BORDER); decimal salesTax = layaway.SalesTaxAmount; WriteCell(infoTable, salesTax.ToString("C"), ReportFont, 1, (int)Element.ALIGN_RIGHT, (int)Rectangle.NO_BORDER); //row empty WriteCell(infoTable, string.Empty, ReportFont, 7, (int)Element.ALIGN_CENTER, (int)Element.ALIGN_TOP, (int)Rectangle.NO_BORDER); //row Layaway Amount WriteCell(infoTable, string.Empty, ReportFont, 5, (int)Element.ALIGN_CENTER, (int)Element.ALIGN_TOP, (int)Rectangle.NO_BORDER); WriteCell(infoTable, "Layaway Amount: ", ReportFont, 1, (int)Element.ALIGN_RIGHT, (int)Rectangle.NO_BORDER); decimal layawayAmount = 0.0m; layawayAmount = salesTax + layaway.Amount; WriteCell(infoTable, layawayAmount.ToString("C"), ReportFont, 1, (int)Element.ALIGN_RIGHT, (int)Rectangle.NO_BORDER); //row empty WriteCell(infoTable, string.Empty, ReportFont, 7, (int)Element.ALIGN_CENTER, (int)Element.ALIGN_TOP, (int)Rectangle.NO_BORDER); //row Payment Due Date WriteCell(infoTable, "Payment Due Date: " + layaway.NextPayment.ToShortDateString(), ReportFont, 2, (int)Element.ALIGN_LEFT, (int)Element.ALIGN_TOP, (int)Rectangle.NO_BORDER); WriteCell(infoTable, string.Empty, ReportFont, 2, (int)Element.ALIGN_CENTER, (int)Element.ALIGN_TOP, (int)Rectangle.NO_BORDER); WriteCell(infoTable, "Total of Payments Forfeited:", ReportFont, 2, (int)Element.ALIGN_RIGHT, (int)Rectangle.NO_BORDER); WriteCell(infoTable, layaway.GetAmountPaid().ToString("C"), ReportFont, 1, (int)Element.ALIGN_RIGHT, (int)Rectangle.NO_BORDER); //row empty WriteCell(infoTable, string.Empty, ReportFont, 7, (int)Element.ALIGN_CENTER, (int)Element.ALIGN_TOP, (int)Rectangle.NO_BORDER); }
private void customButtonOK_Click(object sender, EventArgs e) { labelErrorMessage.Visible = false; noDataFound = false; PurchaseVO purchaseObj = null; CustomerVO customerObj = null; SaleVO saleObj = null; LayawayVO layawayObj = null; CashTransferVO bankTransferObj = null; CashTransferVO shopCashTransferObj = null; DataSet mdseInfo = null; string errorCode; string errorText; getCustomerInfo = true; string tenderType; GlobalDataAccessor.Instance.DesktopSession.Purchases = new List <PurchaseVO>(); GlobalDataAccessor.Instance.DesktopSession.Sales = new List <SaleVO>(); GlobalDataAccessor.Instance.DesktopSession.Layaways = new List <LayawayVO>(); ReleaseFingerprintsInfo releaseFingerprintsequest = null; bool retValue = false; if (voidBuyReturn) { retValue = PurchaseProcedures.GetPurchaseData(Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0), Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "2", StateStatus.BLNK, "RET", true, out purchaseObj, out customerObj, out tenderType, out errorCode, out errorText); } else if (voidBuy) { retValue = PurchaseProcedures.GetPurchaseData(Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0), Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "2", StateStatus.BLNK, "", true, out purchaseObj, out customerObj, out tenderType, out errorCode, out errorText); } else if (voidSale) { retValue = RetailProcedures.GetSaleData(GlobalDataAccessor.Instance.DesktopSession, GlobalDataAccessor.Instance.OracleDA, Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0), Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "3", StateStatus.BLNK, "SALE", false, out saleObj, out customerObj, out errorCode, out errorText); } else if (voidLayaway) { retValue = RetailProcedures.GetLayawayData(GlobalDataAccessor.Instance.DesktopSession, GlobalDataAccessor.Instance.OracleDA, Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0), Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "4", StateStatus.BLNK, "ALL", false, out layawayObj, out customerObj, out errorCode, out errorText); } else if (voidSaleRefund) { retValue = RetailProcedures.GetSaleData(GlobalDataAccessor.Instance.DesktopSession, GlobalDataAccessor.Instance.OracleDA, Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0), Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "3", StateStatus.BLNK, "REFUND", false, out saleObj, out customerObj, out errorCode, out errorText); } //BZ # 419 else if (voidBanktoShopCashTransfer) { retValue = ShopCashProcedures.GetBankTransferDetails(customTextBoxTranNo.Text, "BANKTOSHOP", GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, GlobalDataAccessor.Instance.DesktopSession, out bankTransferObj, out errorCode, out errorText); } else if (voidShopToBankCashTransfer) { retValue = ShopCashProcedures.GetBankTransferDetails(customTextBoxTranNo.Text, "SHOPTOBANK", GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, GlobalDataAccessor.Instance.DesktopSession, out bankTransferObj, out errorCode, out errorText); }//BZ # 419 end else if (voidStoreCashTransfer) { string storeNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber; retValue = ShopCashProcedures.GetShopCashTransferData(customTextBoxTranNo.Text, "", storeNumber, GlobalDataAccessor.Instance.DesktopSession, out shopCashTransferObj, out errorCode, out errorText); } else if (voidMerchandiseTransfer) { string storeNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber; string tranNo = customTextBoxTranNo.Text; if (customTextBoxTranNo.Text.Length > 6) { tranNo = tranNo.Substring(5); } retValue = VoidProcedures.getTransferToVoid(Utilities.GetIntegerValue(tranNo, 0), storeNumber, out mdseInfo, out errorCode, out errorText); // retValue = VoidProcedures.GetEligibleToScrapItems(Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), // storeNumber, out mdse , out errorCode, out errorText); } else if (voidReleaseFingerprints) { string storeNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber; string tranNo = customTextBoxTranNo.Text; if (tranNo.Length > 6) { tranNo = tranNo.Substring(5); } // Add procedure to VoidsProcedurees to Locate the Release Fingerprint Authorization GlobalDataAccessor.Instance.FingerPrintRelaseAuthorizationInfo = HoldsProcedures.GetReleaseFingerprintAuthorization(tranNo, storeNumber, out errorCode, out errorText); } if (voidBuy || voidBuyReturn) { if (retValue && purchaseObj != null) { GlobalDataAccessor.Instance.DesktopSession.Purchases.Add(purchaseObj); if (purchaseObj.EntityType != "V" && customerObj != null) { GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj; } GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); } else { noDataFound = true; } } else if (voidSale || voidSaleRefund) { if (retValue && saleObj != null) { if (saleObj.RefType == "4") { MessageBox.Show("This sale originated from a layaway. You have to void the last layaway payment and not the sale"); return; } GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj; GlobalDataAccessor.Instance.DesktopSession.Sales.Add(saleObj); GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); } else { noDataFound = true; } } else if (voidLayaway) { if (retValue && layawayObj != null) { GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj; GlobalDataAccessor.Instance.DesktopSession.Layaways.Add(layawayObj); GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); } else { noDataFound = true; } } //BZ # 419 //else if (voidCashTransfer) else if (voidBanktoShopCashTransfer || voidShopToBankCashTransfer) { //BZ # 419 end if (retValue && bankTransferObj != null) { GlobalDataAccessor.Instance.DesktopSession.CashTransferData = bankTransferObj; GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); } else { noDataFound = true; } } else if (voidStoreCashTransfer) { if (retValue && shopCashTransferObj != null) { GlobalDataAccessor.Instance.DesktopSession.CashTransferData = shopCashTransferObj; GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); } else { noDataFound = true; } } else if (voidMerchandiseTransfer) { if (retValue && mdseInfo != null && mdseInfo.Tables.Count > 0) { if (isFaultyTransferINOUT(mdseInfo)) { noDataFound = true; } else { GlobalDataAccessor.Instance.DesktopSession.MdseTransferData = mdseInfo; GlobalDataAccessor.Instance.DesktopSession.SelectedTransferNumber = customTextBoxTranNo.Text; GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); } } else { noDataFound = true; } } else if (voidReleaseFingerprints && GlobalDataAccessor.Instance.FingerPrintRelaseAuthorizationInfo != null) { this.DialogResult = DialogResult.OK; //GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); } if (noDataFound) { labelErrorMessage.Text = "The number entered is not valid. Please enter another number"; labelErrorMessage.Visible = true; return; } }
public void CreateHistoryAndScheduleReport(LayawayPaymentHistoryBuilder layawayPaymentHistoryBuilder, LayawayVO layaway) { //First get Report Object reportObject = GetReportObject("Layaway History And Schedule", (int)LayawayReportIDs.LayawayHistoryAndSchedule, "LayawayHistoryAndSchedule", "LayawayHistoryAndSchedule.PDF"); //then load the Data to be displayed into the reportObject reportObject.LayawayHistoryAndScheduleMainData = GetHistoryAndScheduleReportData(layawayPaymentHistoryBuilder, layaway); reportObject.CurrentLayaway = layaway; //with the data loaded, now call to create the report and pass the reportObject with the loaded data if (reportObject.LayawayHistoryAndScheduleMainData.LayawayScheduleList.Count > 0) { LayawayReportProcessing.DoReport(reportObject, true, PdfLauncher.Instance); } //PrintAndStoreReport(layaway); }
private void VoidLayawayActivity_Load(object sender, EventArgs e) { currentLayaway = GlobalDataAccessor.Instance.DesktopSession.ActiveLayaway; labelDate.Text = currentLayaway.MadeTime.ToString(); labelUserID.Text = currentLayaway.CreatedBy; gvTransactions.Columns[colStatusDate.Index].DefaultCellStyle.Format = "d"; gvTransactions.Columns[colAmount.Index].DefaultCellStyle.Format = "c"; DataGridViewRow row = gvTransactions.Rows.AddNew(); row.Cells[colTransactionNumber.Index].Value = currentLayaway.TicketNumber; row.Cells[colTransactionType.Index].Value = "Layaway"; row.Cells[colTenderType.Index].Value = string.Empty; row.Cells[colStatus.Index].Value = "Layaway"; row.Cells[colStatusDate.Index].Value = currentLayaway.StatusDate; row.Cells[colAmount.Index].Value = currentLayaway.Amount; row.Tag = currentLayaway; maxVoidDays = 0L; if (!new BusinessRulesProcedures(GlobalDataAccessor.Instance.DesktopSession).GetMaxVoidDays(GlobalDataAccessor.Instance.CurrentSiteId, out maxVoidDays)) { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Cannot retrieve maximum void days. Defaulting to {0}", maxVoidDays); } } voidRow = row; mode = ProcessTenderProcedures.ProcessTenderMode.LAYAWAYVOID; var receiptsToProcess = (from rcpt in currentLayaway.Receipts where string.IsNullOrWhiteSpace(rcpt.ReferenceReceiptNumber) && !rcpt.Event.Contains("VLAY") && !rcpt.Event.Contains("REF") && !rcpt.Event.Contains("VFORF") select rcpt).OrderBy(r => r.RefTime); foreach (var rdVo in receiptsToProcess) { if (rdVo.Event == ReceiptEventTypes.LAY.ToString()) { continue; } int index = 1; DataGridViewRow paymentRow = gvTransactions.Rows.AddNew(); paymentRow.Cells[colTransactionNumber.Index].Value = rdVo.ReceiptDetailNumber; paymentRow.Cells[colTransactionType.Index].Value = rdVo.TypeDescription; paymentRow.Cells[colStatus.Index].Value = "ACT"; paymentRow.Cells[colStatusDate.Index].Value = rdVo.Date; paymentRow.Tag = rdVo; voidRow = paymentRow; if (rdVo.Event == ReceiptEventTypes.LAYPMT.ToString()) { mode = ProcessTenderProcedures.ProcessTenderMode.LAYPAYMENTVOID; } else if (rdVo.Event == ReceiptEventTypes.FORF.ToString()) { mode = ProcessTenderProcedures.ProcessTenderMode.LAYFORFVOID; } foreach (TenderData tdVo in currentLayaway.TenderDataDetails) { if (tdVo.ReceiptNumber == rdVo.ReceiptNumber && rdVo.RefNumber == currentLayaway.TicketNumber.ToString()) { if (index > 1) { paymentRow = gvTransactions.Rows.AddNew(); } paymentRow.Cells[colTenderType.Index].Value = tdVo.MethodOfPmt; paymentRow.Cells[colAmount.Index].Value = tdVo.TenderAmount; index++; } } } voidRow.Cells[colStatus.Index].Value = currentLayaway.LoanStatus.ToString(); voidRow.DefaultCellStyle.BackColor = Color.LightGray; if (currentLayaway.RetailItems != null && currentLayaway.RetailItems.Count > 0) { var _bindingSource1 = new BindingSource { DataSource = currentLayaway.RetailItems }; dataGridViewMdse.AutoGenerateColumns = false; this.dataGridViewMdse.DataSource = _bindingSource1; this.dataGridViewMdse.Columns[0].DataPropertyName = "icn"; this.dataGridViewMdse.Columns[1].DataPropertyName = "gunnumber"; this.dataGridViewMdse.Columns[2].DataPropertyName = "ticketdescription"; this.dataGridViewMdse.Columns[3].DataPropertyName = "retailprice"; this.dataGridViewMdse.Columns[3].DefaultCellStyle.Format = "c"; this.dataGridViewMdse.AutoGenerateColumns = false; } else { MessageBox.Show("Error in void transaction processing"); FileLogger.Instance.logMessage(LogLevel.ERROR, this, "No items found for the transaction " + currentLayaway.TicketNumber + " to void."); Close(); } //SR 07/28/2011 Disable void if the layaway has been terminated if (currentLayaway.LoanStatus == ProductStatus.TERM || currentLayaway.LoanStatus == ProductStatus.REF) { customButtonVoid.Enabled = false; } }
private LayawayReportObject GetReportObject(string reportTitle, int reportNumber, string pathVariable, string formName, LayawayVO layaway) { var rptObj = new LayawayReportObject(); try { rptObj.ReportTitle = reportTitle; rptObj.ReportNumber = reportNumber; rptObj.FormName = formName; //reportObject.LayawayNumber = 101; rptObj.LayawayNumber = layaway.TicketNumber; rptObj.ReportTempFileFullName = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath + "\\" + pathVariable + DateTime.Now.ToString("MMddyyyyhhmmssFFFFFFF") + ".pdf"; rptObj.ReportTempFile = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath; rptObj.ReportStore = GlobalDataAccessor.Instance.CurrentSiteId.StoreName + "-" + GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber.ToString(); rptObj.ReportStoreDesc1 = GlobalDataAccessor.Instance.CurrentSiteId.StoreAddress1;//"CASH AMERICA PAWN OF DFW"; rptObj.ReportStoreDesc2 = GlobalDataAccessor.Instance.CurrentSiteId.StoreCityName + ", " + GlobalDataAccessor.Instance.CurrentSiteId.State + ", " + GlobalDataAccessor.Instance.CurrentSiteId.StoreZipCode; rptObj.CustomerName = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.FirstName + " " + GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.MiddleInitial + " " + GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.LastName; rptObj.ReportError = string.Empty; rptObj.ReportErrorLevel = 0; rptObj.ReportEmployee = GlobalDataAccessor.Instance.DesktopSession.UserName; SetCustomerInfo(rptObj, layaway); } catch (Exception eX) { return(null); } return(rptObj); }
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 PrintAndStoreReport(LayawayVO layaway) { var cds = GlobalDataAccessor.Instance.DesktopSession; var dA = GlobalDataAccessor.Instance.OracleDA; var cC = GlobalDataAccessor.Instance.CouchDBConnector; if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled && GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IsValid) { if (FileLogger.Instance.IsLogInfo) { FileLogger.Instance.logMessage(LogLevel.INFO, "LayawayCreateReportObject", "Printing layaway contract on printer {0}", GlobalDataAccessor.Instance.DesktopSession.LaserPrinter); } string errMsg = PrintingUtilities.printDocument( reportObject.ReportTempFileFullName, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port, 1); if (errMsg.IndexOf("SUCCESS", StringComparison.OrdinalIgnoreCase) == -1) { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Cannot print Layaway Contract on {0}", GlobalDataAccessor.Instance.DesktopSession.LaserPrinter); } } } var pDoc = new CouchDbUtils.PawnDocInfo(); //Set document add calls pDoc.UseCurrentShopDateTime = true; pDoc.StoreNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber; pDoc.CustomerNumber = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerNumber; pDoc.DocumentType = Document.DocTypeNames.PDF; pDoc.DocFileName = reportObject.ReportTempFileFullName; //pDoc.TicketNumber = cds.ActiveCustomer.c //pDoc.DocumentSearchType = CouchDbUtils.DocSearchType.STORE_TICKET; pDoc.TicketNumber = layaway.TicketNumber; long recNumL = 0L; //if (long.TryParse(receiptDetailsVO.ReceiptNumber, out recNumL)) // { // pDoc.ReceiptNumber = recNumL; // } //Add this document to the pawn document registry and document storage string errText; if (!CouchDbUtils.AddPawnDocument(dA, cC, cds.UserName, ref pDoc, out errText)) { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Could not store Layaway Contract in document storage: {0} - FileName: {1}", errText, reportObject.ReportTempFileFullName); } BasicExceptionHandler.Instance.AddException( "Could not store Layaway Contract in document storage", new ApplicationException("Could not store receipt in document storage: " + errText)); } }
private void VoidLayaway(out bool retValue, out int receiptNumber, out string receiptID) { string errorCode; string errorText; retValue = false; receiptNumber = 0; receiptID = string.Empty; List <string> tenderTypes = new List <string>(); List <string> tenderAmount = new List <string>(); List <string> tenderAuth = new List <string>(); LayawayVO layaway = voidRow.Tag as LayawayVO; if (layaway == null) { return; } string rcptId = (from receipt in currentLayaway.Receipts where (receipt.Event == ReceiptEventTypes.LAY.ToString() && receipt.RefNumber == currentLayaway.TicketNumber.ToString()) select receipt).First().ReceiptDetailNumber; var selectedReceipt = currentLayaway.Receipts.Find(r => r.ReceiptDetailNumber == rcptId); receiptID = selectedReceipt.ReceiptNumber; if (Utilities.GetDateTimeValue(selectedReceipt.Date).AddDays(maxVoidDays) < ShopDateTime.Instance.ShopDate) { MessageBox.Show("The maximum number of days to void has passed for this transaction"); maxVoidPassed = true; return; } decimal layawayVoidAmount = (from receipt in currentLayaway.Receipts where (receipt.Event == ReceiptEventTypes.LAY.ToString() && receipt.RefNumber == currentLayaway.TicketNumber.ToString()) select receipt).First().Amount; foreach (TenderData tdvo in currentLayaway.TenderDataDetails) { if (tdvo.ReceiptNumber == rcptId) { tenderTypes.Add(tdvo.TenderType); tenderAmount.Add(tdvo.TenderAmount.ToString()); tenderAuth.Add(tdvo.TenderAuth); } } GlobalDataAccessor.Instance.beginTransactionBlock(); retValue = VoidProcedures.VoidLayaway(GlobalDataAccessor.Instance.OracleDA, currentLayaway.TicketNumber, GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, GlobalDataAccessor.Instance.CurrentSiteId.TerminalId, GlobalDataAccessor.Instance.DesktopSession.CashDrawerId, "", "", currentLayaway.TicketNumber, layawayVoidAmount.ToString(), 1, Utilities.GetIntegerValue(rcptId), ShopDateTime.Instance.ShopDate.ToShortDateString(), ShopDateTime.Instance.ShopTransactionTime.ToString(), GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile.UserName, out receiptNumber, out errorCode, out errorText); GlobalDataAccessor.Instance.endTransactionBlock(!retValue ? EndTransactionType.ROLLBACK : EndTransactionType.COMMIT); }
private LayawayReportObject.LayawayHistoryAndScheduleMain GetHistoryAndScheduleReportData(LayawayPaymentHistoryBuilder layawayPaymentHistoryBuilder, LayawayVO layaway) { var main = new LayawayReportObject.LayawayHistoryAndScheduleMain(); var historyList = new List <LayawayReportObject.LayawaySchedule>(); main.AmountOutstanding = layawayPaymentHistoryBuilder.GetBalanceOwed(); foreach (var history in layawayPaymentHistoryBuilder.ScheduledPayments) { var paymentHistory = new LayawayReportObject.LayawaySchedule(); var detailsList = new List <LayawayReportObject.LayawayScheduleDetails>(); var historyDetail = new LayawayReportObject.LayawayScheduleDetails(); if (history.Payments.Count == 0) { historyDetail.PaymentDateDue = history.PaymentDueDate; historyDetail.PaymentAmountDue = history.PaymentAmountDue; detailsList.Add(historyDetail); } else { for (int i = 0; i < history.Payments.Count; i++) { if (i > 0) { historyDetail = new LayawayReportObject.LayawayScheduleDetails(); } var paymentInfo = history.Payments.OrderBy(p => p.PaymentMadeOn).ToArray()[i]; if (i == 0) { historyDetail.PaymentDateDue = history.PaymentDueDate; historyDetail.PaymentAmountDue = history.PaymentAmountDue; } historyDetail.PaymentMadeOn = paymentInfo.PaymentMadeOn; historyDetail.PaymentAmountMade = paymentInfo.PaymentAmountMade; historyDetail.BalanceDue = paymentInfo.BalanceDue; //historyDetail.PaymentType = paymentInfo.PaymentType; historyDetail.ReceiptNumber = paymentInfo.ReceiptNumber; historyDetail.Status = paymentInfo.Status; detailsList.Add(historyDetail); } } paymentHistory.LayawayScheduleDetailsList = detailsList; historyList.Add(paymentHistory); } //layawayPaymentHistoryBuilder. main.LayawayScheduleList = historyList; main.Layaway = layaway; return(main); }
public LayawayPaymentHistory(LayawayVO layaway) { Layaway = layaway; InitializeComponent(); }
/*__________________________________________________________________________________________*/ private void IH_ItemHistoryDataGridView_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e) { bool enableAddItem = true; if (e.ColumnIndex >= 0 && e.RowIndex >= 0) { _ActiveTicketNumber = Utilities.GetIntegerValue(IH_ItemHistoryDataGridView.Rows[e.RowIndex].Cells[IH_History_TktNo.Name].Value, 0); int docType = int.Parse(((string)IH_ItemHistoryDataGridView.Rows[e.RowIndex].Cells[0].Value).Substring(12, 1)); string selectedICN = Utilities.GetStringValue(IH_ItemHistoryDataGridView.Rows[e.RowIndex].Cells[0].Value); string status = IH_ItemHistoryDataGridView.Rows[e.RowIndex].Cells[ IH_History_ItemStatusColumn.Name].Value.ToString(); if (e.ColumnIndex == 0) { // string docType = // IH_ItemHistoryDataGridView.Rows[e.RowIndex].Cells[IH_History_DocType.Name]. // Value.ToString(); switch (status) { case "SOLD": if (GlobalDataAccessor.Instance.DesktopSession.CustomerHistorySales != null) { Sale_dialog sd = new Sale_dialog(GlobalDataAccessor.Instance.DesktopSession.CustomerHistorySales.Find (l => l.TicketNumber == _ActiveTicketNumber)); sd.ShowDialog(); } break; case "On Layaway": if (GlobalDataAccessor.Instance.DesktopSession.CustomerHistoryLayaways != null) { LayawayVO ly = GlobalDataAccessor.Instance.DesktopSession.CustomerHistoryLayaways.Find (l => l.TicketNumber == _ActiveTicketNumber); Receipt r; if (ly.Receipts.Count > 0) { r = ly.Receipts[0]; } else { r = new Receipt(); } Layaway_dialog ld = new Layaway_dialog(ly, r); ld.ShowDialog(); } break; case "REF": SaleRefund_Dialog srd = new SaleRefund_Dialog(GlobalDataAccessor.Instance.DesktopSession.CustomerHistorySales.Find (l => l.TicketNumber == _ActiveTicketNumber)); srd.ShowDialog(); break; default: if (GlobalDataAccessor.Instance.DesktopSession.CustomerHistoryPurchases != null && docType == 2) { PurchaseHistory_Dialog d = new PurchaseHistory_Dialog(GlobalDataAccessor.Instance.DesktopSession.CustomerHistoryPurchases.Find(l => l.TicketNumber == _ActiveTicketNumber), 0, status); if (d.isSetup) { d.ShowDialog(); } } else if (status.ToUpper() == "VOID") { if (docType == 1) { PawnLoan pawnLoan = Utilities.CloneObject(GlobalDataAccessor.Instance.DesktopSession.CustomerHistoryLoans.Find(l => l.TicketNumber == _ActiveTicketNumber)); ProductHistory_Dialog productHistory = new ProductHistory_Dialog(pawnLoan, 0); productHistory.ShowDialog(); } else if (docType == 2) { PurchaseHistory_Dialog d = new PurchaseHistory_Dialog( GlobalDataAccessor.Instance.DesktopSession.CustomerHistoryPurchases.Find( l => l.TicketNumber == _ActiveTicketNumber), 0, status); d.ShowDialog(); } } else { var pawnLoan = Utilities.CloneObject(GlobalDataAccessor.Instance.DesktopSession.CustomerHistoryLoans.Find(l => l.TicketNumber == _ActiveTicketNumber)); var productHistory = new ProductHistory_Dialog(pawnLoan, 0); productHistory.ShowDialog(); } break; } } if (docType == 1) { PawnLoan pawnLoan = Utilities.CloneObject(GlobalDataAccessor.Instance.DesktopSession.CustomerHistoryLoans.Find(l => l.TicketNumber == _ActiveTicketNumber)); var gunItems = pawnLoan.Items.Find(i => i.GunNumber > 0 && i.Icn == selectedICN); if (gunItems != null) { enableAddItem = false; } } _ActiveICN = Utilities.GetStringValue(IH_ItemHistoryDataGridView.Rows[e.RowIndex].Cells[IH_History_TransactionNumberColumn.Name].Value, ""); string sLoanStatus = Utilities.GetStringValue(IH_ItemHistoryDataGridView.Rows[e.RowIndex].Cells[IH_History_ItemStatusColumn.Name].Value, ""); PairType <ProductStatus, string> pairType = GlobalDataAccessor.Instance.DesktopSession.LoanStatus .First(pt => pt.Right == sLoanStatus); if (pairType.Left == ProductStatus.PU) { const string resName = "NEWPAWNLOAN"; UserVO currUser = GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile; IH_AddItemToNewPawnLoan.Enabled = SecurityProfileProcedures.CanUserViewResource(resName, currUser, GlobalDataAccessor.Instance.DesktopSession); IH_AddItemToNewPawnLoan.Enabled = enableAddItem; } else { IH_AddItemToNewPawnLoan.Enabled = false; } } }