private void buttonReloadPrintFormats_Click(object sender, EventArgs e) { string msg; if (GlobalDataAccessor.Instance.DesktopSession.BarcodePrinter.IsValid && PrintingUtilities.SendASCIIStringToPrinter( GlobalDataAccessor.Instance.DesktopSession.BarcodePrinter.IPAddress, (uint)GlobalDataAccessor.Instance.DesktopSession.BarcodePrinter.Port, Common.Properties.Resources.IPL_Print_Formats, out msg)) { MessageBox.Show( "Intermec EasyCoder PM4i formats loaded to: " + Environment.NewLine + GlobalDataAccessor.Instance.DesktopSession.BarcodePrinter + ".", "Intermec EasyCoder PM4i Setup", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show( "Intermec EasyCoder PM4i formats failed to load to " + Environment.NewLine + GlobalDataAccessor.Instance.DesktopSession.BarcodePrinter + ".", "Intermec EasyCoder PM4i Setup", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
//public static readonly string DEFAULTTMPDIR = @"C:\tmp\"; public static string PrintReceipt(Dictionary <string, string> data, bool displayOnly, out string convertedFullFileName) { string rt = PrintingUtilities.PrintReceipt(data, displayOnly, out convertedFullFileName); MessageBox.Show("Print utilities for PrintReceipt returned : " + rt); return(rt); }
private void Print() { Bitmap bitMap = new Bitmap(ClientRectangle.Width, ClientRectangle.Height); DrawToBitmap(bitMap, new Rectangle(0, 0, ClientRectangle.Width, ClientRectangle.Height)); PrintingUtilities.PrintBitmapDocument(bitMap, GlobalDataAccessor.Instance.DesktopSession); }
public void Print() { if (SiteId.State.Equals(States.Indiana)) { var lostTicketAffidavitContext = new LostTicketAffidavitContext(); var indianaLostTicketAffidavit = new IndianaLostTicketAffidavit(lostTicketAffidavitContext); var customer = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer; var address = customer.getHomeAddress(); lostTicketAffidavitContext.CustomerName = customer.CustomerName; lostTicketAffidavitContext.StoreName = SiteId.StoreName; lostTicketAffidavitContext.StoreNumber = SiteId.StoreNumber; lostTicketAffidavitContext.LoanDateMade = PawnLoan.DateMade; lostTicketAffidavitContext.TicketNumber = PawnLoan.TicketNumber; lostTicketAffidavitContext.ReasonMissing = Commons.GetLostTicketType(PawnLoan.LostTicketInfo.LSDTicket); var descriptions = new StringBuilder(); foreach (var item in PawnLoan.Items) { descriptions.AppendLine(item.TicketDescription); } lostTicketAffidavitContext.MerchandiseDescription = descriptions.ToString(); lostTicketAffidavitContext.OutputPath = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath + "\\LostTicketAffidavit_" + DateTime.Now.ToString("MMddyyyyhhmmssFFFFFFF") + ".pdf"; if (!indianaLostTicketAffidavit.Print()) { return; } if (!SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled || !GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IsValid) { return; } if (FileLogger.Instance.IsLogInfo) { FileLogger.Instance.logMessage(LogLevel.INFO, this, "Printing Lost Ticket Affidavit on: {0}", GlobalDataAccessor.Instance.DesktopSession.LaserPrinter); } var strReturnMessage = PrintingUtilities.printDocument( lostTicketAffidavitContext.OutputPath, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port, 2); if (!strReturnMessage.Contains("SUCCESS")) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Lost Ticket Affidavit : " + strReturnMessage); } } else { var lstPrint = new LostTicketStatementPrint(); lstPrint.Print(PawnLoan); } }
private void Print() { for (int i = 0; i < 2; i++) { bitMap = new Bitmap(this.ClientRectangle.Width, this.ClientRectangle.Height); this.DrawToBitmap(bitMap, new Rectangle(0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height)); PrintingUtilities.PrintBitmapDocument(bitMap, GlobalDataAccessor.Instance.DesktopSession); } }
private void Print() { for (int i = 0; i < 2; i++) { Bitmap bitMap = new Bitmap(ClientRectangle.Width, ClientRectangle.Height); DrawToBitmap(bitMap, new Rectangle(0, 0, ClientRectangle.Width, ClientRectangle.Height)); PrintingUtilities.PrintBitmapDocument(bitMap, CashlinxDesktopSession.Instance); } }
private void PrintAndStoreReport(int ticketNumber, string reportName, bool store, int numCopies) { var cds = GlobalDataAccessor.Instance.DesktopSession; var dA = GlobalDataAccessor.Instance.OracleDA; var cC = GlobalDataAccessor.Instance.CouchDBConnector; if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled && cds.LaserPrinter.IsValid) { if (FileLogger.Instance.IsLogInfo) { FileLogger.Instance.logMessage(LogLevel.INFO, "CreateReportObject", "Printing {0} on printer {1}", reportName, cds.LaserPrinter); } string errMsg = PrintingUtilities.printDocument( reportObject.ReportTempFileFullName, cds.LaserPrinter.IPAddress, cds.LaserPrinter.Port, numCopies); if (errMsg.IndexOf("SUCCESS", StringComparison.OrdinalIgnoreCase) == -1) { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Cannot print {0} on {1}", reportName, cds.LaserPrinter); } } } if (store) { 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 = ticketNumber; long recNumL = 0L; 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 _btnAddNewPrinter_Click(object sender, EventArgs e) { try { FrmInstallPrinter frmInstallPrinter = new FrmInstallPrinter(); DialogResult dialogResult = frmInstallPrinter.ShowDialog(); if (dialogResult == DialogResult.OK) { Cursor = Cursors.WaitCursor; string newPrinterName = _currentPrinterName = frmInstallPrinter.PrinterName; string newPrinterPassword = ""; PrintingUtilities.InstallNewPrinter(newPrinterName, newPrinterPassword); _currentPrinterName = newPrinterName; _EnableNetworkPrinting = frmInstallPrinter.EnableNetwork; FillLeadtoolsPrintersList(_currentPrinterName, _EnableNetworkPrinting); if (_cmbNetworkPrinters.Items.Count == 0) { _cmbNetworkPrinters.Enabled = false; _ckNetworkEnabled.Enabled = false; _ckSharePrinter.Enabled = false; _grpPrinterSettings.Enabled = false; _btnUninstall.Enabled = false; } else { _cmbNetworkPrinters.Enabled = true; _ckNetworkEnabled.Enabled = true; _ckSharePrinter.Enabled = true; _grpPrinterSettings.Enabled = true; _btnUninstall.Enabled = true; _EnableNetworkPrinting = _printer.EnableNetworkPrinting; _ckNetworkEnabled_CheckedChanged(null, null); _ckSharePrinter.Checked = true; PrinterConfiguration.SharePrinter(_cmbNetworkPrinters.SelectedItem.ToString(), _ckSharePrinter.Checked); } } } catch (Exception Ex) { MessageBox.Show(Ex.ToString(), "LEADTOOLS Printer Demo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } finally { Cursor = Cursors.Default; } }
private void printButton_Click(object sender, EventArgs e) { var data = new Dictionary <string, string>(); data.Add("store_short_name", this.store_short_name); data.Add("store_street_address", this.store_street_address); data.Add("store_city_state_zip", this.store_city_state_zip); data.Add("store_phone", this.store_phone); data.Add("f_date_and_time", this.f_date_and_time); data.Add("f_cust_name", this.f_cust_name); data.Add("receipt_number", this.receipt_number); data.Add("emp_number", this.emp_number); data.Add("_BARDATA_H_02", this.receipt_number); if (this.pwnLoan.LoanStatus == ProductStatus.IP) { data.Add("DETAIL001", "<B>1 New Pawn Loan: " + ticketNumber + " " + ticketAmount); data.Add("DETAIL002", "<L>"); data.Add("DETAIL003", "<S>"); data.Add("DETAIL004", "<R>Grand Total " + ticketAmount); data.Add("DETAIL005", "<R>Amount Received From Customer " + " $0.00"); data.Add("DETAIL006", "<R>Cash Paid To Customer " + ticketAmount); } else if (this.pwnLoan.LoanStatus == ProductStatus.PU) { data.Add("DETAIL001", "<B>1 Pickup Pawn Loan: " + ticketNumber + " " + ticketAmount); data.Add("DETAIL002", "<L>"); data.Add("DETAIL003", "<S>"); data.Add("DETAIL004", "<R>Grand Total " + ticketAmount); data.Add("DETAIL005", "<R>Amount Received From Customer " + this.pwnLoan.PickupAmount.ToString("C")); data.Add("DETAIL006", "<R>Cash Paid To Customer " + " $0.00"); } //string s9 = "123456789A123456789B123456789C123456789D"; data.Add("##TEMPLATEFILENAME##", "receiptTemplate.tpl"); bool printEnabled = SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled; if (printEnabled && GlobalDataAccessor.Instance.DesktopSession.ReceiptPrinter.IsValid) { data.Add("##IPADDRESS01##", GlobalDataAccessor.Instance.DesktopSession.ReceiptPrinter.IPAddress); data.Add("##PORTNUMBER01##", GlobalDataAccessor.Instance.DesktopSession.ReceiptPrinter.Port.ToString()); //-- TODO: Changed to two for pilot data.Add("##HOWMANYCOPIES##", "2"); string fullFileName; #if (!__MULTI__) PrintingUtilities.PrintReceipt(data, false, out fullFileName); #endif } //this.NavControlBox.Action = NavBox.NavAction.SUBMIT; }
public void PrintQueue() { Cursor = Cursors.WaitCursor; Application.DoEvents(); string sStoreNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber; string sRunDate = String.Format("{0:MM/dd/yyyy HH:mm}", ShopDateTime.Instance.ShopDate); string sAsOfDate = _AsOf; int iRecordNumber = 0; int iRecords = _Records.Count; storeValueLabel.Text = sStoreNumber; runValueLabel.Text = sRunDate; asOfValueLabel.Text = sAsOfDate; totalAmountValueLabel.Text = _TotalCost; tagsValueLabel.Text = _Tags; for (int i = 0; i < iRecords; i++) { if (iRecordNumber == 0) { iRecordNumber = i + 1; } DataRow dataRow = _Records[i]; CreatePrintRow(dataRow, i + 1); if (tlpRecords.Height >= 870 || (i + 1) == iRecords) { pageLabel.Text = String.Format("{0} thru {1} of {2}", iRecordNumber, i + 1, iRecords); this.Height = _FormOriginalRowY + tlpRecords.Height + 5; Application.DoEvents(); if ((i + 1) == iRecords) { Height = Height < 875 ? 875 : Height; } Bitmap bitMap = new Bitmap(ClientRectangle.Width, ClientRectangle.Height); DrawToBitmap(bitMap, new Rectangle(0, 0, ClientRectangle.Width, ClientRectangle.Height)); PrintingUtilities.PrintBitmapDocument(bitMap, GlobalDataAccessor.Instance.DesktopSession); tlpRecords.Controls.Clear(); iRecordNumber = 0; } } Cursor = Cursors.Default; Application.DoEvents(); }
private void PrintDocument() { const string formName = "manualcheck"; //Default print success flag var fLog = FileLogger.Instance; //Print manual check if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled && GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IsValid) { string res = PrintingUtilities.printDocument( rptFileName, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port, 1); if (string.IsNullOrEmpty(res) || res.IndexOf("SUCCESS") == -1) { if (fLog.IsLogError) { fLog.logMessage(LogLevel.ERROR, this, "Could not print {0} document.", MCDSlipReportTitle); } } else if (res.IndexOf("SUCCESS") != -1) { if (fLog.IsLogInfo) { fLog.logMessage(LogLevel.INFO, this, "Successfully printed {0} document.", MCDSlipReportTitle); } } } else { if (fLog.IsLogWarn) { fLog.logMessage(LogLevel.WARN, this, "Did not print lost ticket. Printing is disabled or printer is invalid: {0}", GlobalDataAccessor.Instance.DesktopSession.LaserPrinter); } } //TODO: Ensure report is stored prior to deletion File.Delete(rptFileName); }
private void buttonReloadPrintFormats_Click(object sender, EventArgs e) { var cds = GlobalDataAccessor.Instance.DesktopSession; var intermecPrinterIp = cds.BarcodePrinter.IPAddress; var intermecPrinterPort = cds.BarcodePrinter.Port; const IntermecBarcodeTagPrint.PrinterModel intermecPrinter = IntermecBarcodeTagPrint.PrinterModel.Intermec_PM4i; if (!cds.BarcodePrinter.IsValid) { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, "Thermal Security Tag", "Cannot determine thermal printer ip address"); } MessageBox.Show("Unable to find Intermec printer. Cannot load printer formats.", "Pawn Application Message", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } string msg; if (PrintingUtilities.SendASCIIStringToPrinter( intermecPrinterIp, (uint)intermecPrinterPort, Common.Properties.Resources.IPL_Print_Formats, out msg)) { MessageBox.Show( "Intermec EasyCoder PM4i formats loaded to: " + Environment.NewLine + intermecPrinter + ".", "Intermec EasyCoder PM4i Setup", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show( "Intermec EasyCoder PM4i formats failed to load to " + Environment.NewLine + intermecPrinter + ".", "Intermec EasyCoder PM4i Setup", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public bool Print(string ipAddress, uint port) { string retValue = null; return(PrintingUtilities.SendASCIIStringToPrinter(ipAddress, port, GetDocumentValue(), out retValue, true)); }
private void printAuthorizationToReleaseFingerprints(ReleaseFingerprintsInfo releaseFingerprintsInfo, CustomerVO currentCustomer, int seizeNumber) { //Call print Police seize form if print is enabled if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled) { var address = currentCustomer.getHomeAddress(); var releaseFingerprintsContext = new Reports.AuthorizationToReleaseFingerprints. ReleaseFingerprintsContext() { EmployeeNumber = GlobalDataAccessor.Instance.DesktopSession. UserName, ShopName = GlobalDataAccessor.Instance.CurrentSiteId. StoreName, ShopAddress = GlobalDataAccessor.Instance.CurrentSiteId. StoreAddress1 + " " + GlobalDataAccessor.Instance.CurrentSiteId. StoreAddress2, ShopCity = GlobalDataAccessor.Instance.CurrentSiteId. StoreCityName, ShopState = GlobalDataAccessor.Instance.CurrentSiteId.State, ShopZipCode = GlobalDataAccessor.Instance.CurrentSiteId. StoreZipCode, CustomerName = currentCustomer.CustomerName, CustomerAddress1 = address.Address1, CustomerAddress2 = address.Address2, CustomerCity = address.City, CustomerState = address.State_Code, CustomerAddressUnit = address.UnitNum, CustomerZipCode = address.ZipCode, TicketNumber = releaseFingerprintsInfo.RefNumber, Agency = releaseFingerprintsInfo.Agency, CaseNumber = releaseFingerprintsInfo.CaseNumber, SubpoenaNumber = releaseFingerprintsInfo.SubpoenaNumber, OfficerName = releaseFingerprintsInfo.OfficerFirstName + " " + releaseFingerprintsInfo.OfficerLastName, BadgeNumber = releaseFingerprintsInfo.BadgeNumber, TransactionDate = releaseFingerprintsInfo.TransactionDate, OutputPath = SecurityAccessor.Instance.EncryptConfig. ClientConfig.GlobalConfiguration. BaseLogPath + "\\AuthorizationToReleaseFingerprints_" + DateTime.Now.ToString("MMddyyyyhhmmssFFFFFFF") + ".pdf" }; var authorizationToReleaseFingerprints = new AuthorizationToReleaseFingerprints( seizeNumber, GlobalDataAccessor.Instance.DesktopSession.TicketTypeLookedUp, releaseFingerprintsContext, null); authorizationToReleaseFingerprints.Print(); string strReturnMessage = PrintingUtilities.printDocument( releaseFingerprintsContext.OutputPath, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port, 2); if (!strReturnMessage.Contains("SUCCESS")) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Authorization to release fingerprints : " + strReturnMessage); } //--------------------------------------------------- // Place document into couch var filePath = releaseFingerprintsContext.OutputPath; //authorizationToReleaseFingerprints.Save(policeCardFilePath); var pDoc = new CouchDbUtils.PawnDocInfo(); var dA = GlobalDataAccessor.Instance.OracleDA; var cC = GlobalDataAccessor.Instance.CouchDBConnector; //Set document add calls pDoc.UseCurrentShopDateTime = true; pDoc.SetDocumentSearchType(CouchDbUtils.DocSearchType.POLICE_CARD); pDoc.StoreNumber = GlobalDataAccessor.Instance.DesktopSession.CurrentSiteId.StoreNumber; pDoc.CustomerNumber = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerNumber; pDoc.TicketNumber = seizeNumber; pDoc.DocumentType = Common.Libraries.Objects.Doc.Document.DocTypeNames.PDF; pDoc.DocFileName = filePath; //Add this document to the pawn document registry and document storage string errText; if (!CouchDbUtils.AddPawnDocument(dA, cC, GlobalDataAccessor.Instance.DesktopSession.UserName, ref pDoc, out errText)) { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Could not store release authorization to release fingerprints document in document storage: {0} - FileName: {1}", errText, filePath); } BasicExceptionHandler.Instance.AddException( "Could not store police card document in document storage", new ApplicationException("Could not store authorization to release fingerprints document in document storage: " + errText)); } } }
public static bool ExecuteVendorPFI ( int ticketNumber, PurchaseVO vendorPurchaseObj, VendorVO vendor, out string sErrorCode, out string sErrorText ) { List <TransferItemVO> _mdseToTransfer = new List <TransferItemVO>(); int pawnItemIdx = 1; sErrorCode = "0"; sErrorText = ""; bool itemsPfid = false; try { //Start transaction block GlobalDataAccessor.Instance.beginTransactionBlock(); //Step 1 Update Gun book if the item has a gun foreach (Item purchaseItem in vendorPurchaseObj.Items) { if (purchaseItem.IsExpenseItem) { pawnItemIdx = pawnItemIdx + purchaseItem.Quantity; continue; } for (int i = 1; i <= purchaseItem.Quantity; i++) { if (!purchaseItem.IsJewelry && purchaseItem.Quantity > 1 && purchaseItem.SerialNumber != null && purchaseItem.SerialNumber.Count > 0) { Item itemCopy = Utilities.CloneObject(purchaseItem); string sItemPrefix; string sDescription; //Get updated mdse description for each serial number Item.RemoveSerialNumberFromDescription(ref itemCopy, out sItemPrefix, out sDescription); purchaseItem.Attributes = itemCopy.Attributes; purchaseItem.TicketDescription = sDescription; } purchaseItem.mDocNumber = ticketNumber; purchaseItem.mItemOrder = i; int qty = purchaseItem.QuickInformation.Quantity < 1 ? 1 : purchaseItem.QuickInformation.Quantity; if (purchaseItem.CaccLevel == 0) { // Call Update_Cacc_Info() MerchandiseProcedures.UpdateCaccInfo(GlobalDataAccessor.Instance.DesktopSession, GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0, purchaseItem.mDocNumber, "7", 1, 0, qty, purchaseItem.ItemAmount * qty, purchaseItem.CategoryCode, ShopDateTime.Instance.ShopDate, out sErrorCode, out sErrorText ); } if (purchaseItem.IsGun) { ProcessTenderProcedures.ExecuteUpdateGunBookRecord( ticketNumber.ToString(), GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, ProductStatus.PFI.ToString(), "", vendor.Name, "", "", vendor.Address1, vendor.City, vendor.State, vendor.ZipCode, vendor.Ffl, "", "", "P", GlobalDataAccessor.Instance.DesktopSession.UserName, ShopDateTime.Instance.ShopDate.ToShortDateString(), ShopDateTime.Instance.ShopTransactionTime, "", purchaseItem.QuickInformation.Caliber, purchaseItem.QuickInformation.Importer, purchaseItem.QuickInformation.SerialNumber, purchaseItem.QuickInformation.Model, purchaseItem.QuickInformation.Manufacturer, purchaseItem.mStore, purchaseItem.mYear, purchaseItem.mDocNumber, purchaseItem.mDocType, pawnItemIdx, 0, vendorPurchaseObj.GunNumbers[i - 1], out sErrorCode, out sErrorText ); } //Step 2 Insert mdse revision record bool mdseRevVal = MerchandiseProcedures.InsertMerchandiseRevision(GlobalDataAccessor.Instance.DesktopSession, GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, purchaseItem.mYear, ticketNumber, purchaseItem.mDocType, pawnItemIdx, 0, purchaseItem.mStore, ticketNumber.ToString(), purchaseItem.mDocType, "", 0, purchaseItem.ItemReason == ItemReason.CACC ? "PFC" : "PFI", "", "", GlobalDataAccessor.Instance.DesktopSession.FullUserName, out sErrorCode, out sErrorText ); purchaseItem.Icn = Utilities.IcnGenerator(purchaseItem.mStore, purchaseItem.mYear, ticketNumber, "2", pawnItemIdx, 0); TransferItemVO transferData = new TransferItemVO(); transferData.ICN = purchaseItem.Icn.ToString(); transferData.StoreNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber; transferData.ICNQty = purchaseItem.QuickInformation.Quantity > 0 ? purchaseItem.QuickInformation.Quantity.ToString() : "1"; transferData.CustomerNumber = ""; transferData.TransactionDate = ShopDateTime.Instance.ShopDate; transferData.MdseRecordDate = ShopDateTime.Instance.ShopDate; transferData.MdseRecordTime = ShopDateTime.Instance.ShopTransactionTime; transferData.MdseRecordUser = GlobalDataAccessor.Instance.DesktopSession.UserName; transferData.MdseRecordDesc = ""; transferData.MdseRecordChange = 0; transferData.MdseRecordType = ""; transferData.ClassCode = ""; transferData.AcctNumber = ""; transferData.CreatedBy = GlobalDataAccessor.Instance.DesktopSession.UserName; transferData.GunNumber = vendorPurchaseObj.GunNumbers[i - 1] > 0 ? vendorPurchaseObj.GunNumbers[i - 1].ToString() : null; transferData.GunType = purchaseItem.QuickInformation.GunType; transferData.ItemDescription = purchaseItem.TicketDescription; transferData.ItemCost = purchaseItem.ItemAmount; _mdseToTransfer.Add(transferData); itemsPfid = true; pawnItemIdx++; } } //Step 3 Insert receipt for PFI if (itemsPfid) { ReceiptDetailsVO receiptDetailsVO = new ReceiptDetailsVO(); receiptDetailsVO.ReceiptDate = ShopDateTime.Instance.ShopDate; receiptDetailsVO.RefDates = new List <string>() { ShopDateTime.Instance.ShopDate.ToShortDateString() }; receiptDetailsVO.RefTimes = new List <string>() { ShopDateTime.Instance.ShopDate.ToShortDateString() + " " + ShopDateTime.Instance.ShopTime.ToString() }; receiptDetailsVO.UserId = GlobalDataAccessor.Instance.DesktopSession.UserName; receiptDetailsVO.RefNumbers = new List <string>() { ticketNumber.ToString() }; receiptDetailsVO.RefTypes = new List <string>() { "2" }; receiptDetailsVO.RefEvents = new List <string>() { "PFI" }; receiptDetailsVO.RefAmounts = new List <string>() { vendorPurchaseObj.Amount.ToString() }; receiptDetailsVO.RefStores = new List <string>() { GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber }; ProcessTenderProcedures.ExecuteInsertReceiptDetails( GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, GlobalDataAccessor.Instance.DesktopSession.UserName, ShopDateTime.Instance.ShopDate.ToShortDateString(), GlobalDataAccessor.Instance.DesktopSession.UserName, ref receiptDetailsVO, out sErrorCode, out sErrorText); } GlobalDataAccessor.Instance.endTransactionBlock(EndTransactionType.COMMIT); } catch (Exception ex) { GlobalDataAccessor.Instance.endTransactionBlock(EndTransactionType.ROLLBACK); FileLogger.Instance.logMessage(LogLevel.ERROR, null, "Error in vendor purchase pfi process while processing PFI " + ex.Message); sErrorCode = "1"; sErrorText = ex.Message; return(false); } //Step 4 Invoke transfer process int transferNumber = 0; var errorMessage = string.Empty; if (_mdseToTransfer.Count > 0 && GlobalDataAccessor.Instance.CurrentSiteId.IsTopsExist) { bool retValue = TransferProcedures.TransferItemsOutOfStore(_mdseToTransfer, out transferNumber, "", out errorMessage, false, GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber); if (!retValue) { MessageBox.Show("Error:" + errorMessage); sErrorText = errorMessage; return(false); } foreach (TransferItemVO transfer in _mdseToTransfer) { transfer.TransferNumber = transferNumber; } } if (transferNumber > 0) { try { GlobalDataAccessor.Instance.beginTransactionBlock(); //Step 5 Insert receipt for transfer ReceiptDetailsVO receiptDetailsVO = new ReceiptDetailsVO(); receiptDetailsVO.ReceiptDate = ShopDateTime.Instance.ShopDate; receiptDetailsVO.RefDates = new List <string>() { ShopDateTime.Instance.ShopDate.ToShortDateString() }; receiptDetailsVO.RefTimes = new List <string>() { ShopDateTime.Instance.ShopDate.ToShortDateString() + " " + ShopDateTime.Instance.ShopTime.ToString() }; receiptDetailsVO.UserId = GlobalDataAccessor.Instance.DesktopSession.UserName; receiptDetailsVO.RefNumbers = new List <string>() { ticketNumber.ToString() }; receiptDetailsVO.RefTypes = new List <string>() { "2" }; receiptDetailsVO.RefEvents = new List <string>() { "TO" }; receiptDetailsVO.RefAmounts = new List <string>() { vendorPurchaseObj.Amount.ToString() }; receiptDetailsVO.RefStores = new List <string>() { GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber }; ProcessTenderProcedures.ExecuteInsertReceiptDetails( GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, GlobalDataAccessor.Instance.DesktopSession.UserName, ShopDateTime.Instance.ShopDate.ToShortDateString(), GlobalDataAccessor.Instance.DesktopSession.UserName, ref receiptDetailsVO, out sErrorCode, out sErrorText); GlobalDataAccessor.Instance.DesktopSession.endTransactionBlock(EndTransactionType.COMMIT); //Step 6 Print transfer report /*TransferOutReport trnsfrRpt = new TransferOutReport(); * trnsfrRpt.MdseTransfer = _mdseToTransfer; */ string logPath = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration .BaseLogPath; TransferOutReport trnsfrRpt = new TransferOutReport(_mdseToTransfer, ShopDateTime.Instance.ShopDateCurTime, GlobalDataAccessor.Instance.CurrentSiteId.StoreName, Convert.ToString(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber), GlobalDataAccessor.Instance.DesktopSession.UserName, Convert.ToString(transferNumber), logPath, "PFIProc", new ReportObject.TransferReport(), PdfLauncher.Instance); trnsfrRpt.CreateReport(); //TODO: Store report in couch db if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled && GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IsValid) { string laserPrinterIp = GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress; int laserPrinterPort = GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port; PrintingUtilities.printDocument(trnsfrRpt.getReportWithPath(), laserPrinterIp, laserPrinterPort, 1); } //trnsfrRpt.ShowDialog(); return(true); } catch (Exception ex) { GlobalDataAccessor.Instance.DesktopSession.endTransactionBlock(EndTransactionType.ROLLBACK); FileLogger.Instance.logMessage(LogLevel.ERROR, null, "Error in vendor purchase pfi process while entering receipt for transfer and printing transfer report " + ex.Message); sErrorCode = "1"; sErrorText = ex.Message; return(false); } } return(true); }
private void FillLeadtoolsPrintersList(string strDefault, bool bDefaultEnable) { string setupPrinter = string.Empty; #if LTV20_CONFIG if (Is64Bit()) { setupPrinter = "LEADTOOLS 20 .NET Network Printer 64-bit"; } else { setupPrinter = "LEADTOOLS 20 .NET Network Printer 32-bit"; } #endif if (!string.IsNullOrEmpty(strDefault)) { setupPrinter = strDefault; } try { _cmbNetworkPrinters.Items.Clear(); _cmbNetworkPrinters.Items.AddRange(PrintingUtilities.GetLeadtoolsPrintersList()); if (_cmbNetworkPrinters.Items.Count > 0) { _cmbNetworkPrinters.SelectedIndex = 0; for (int i = 0; i < _cmbNetworkPrinters.Items.Count; i++) { if ((_cmbNetworkPrinters.Items[i] as string).ToLower() == setupPrinter.ToLower()) { _cmbNetworkPrinters.SelectedIndex = i; } } _printer = new Printer(_cmbNetworkPrinters.SelectedItem.ToString()); if (bDefaultEnable) { _printer.EnableNetworkPrinting = true; _ckNetworkEnabled.Checked = true; } else { _ckNetworkEnabled.Checked = _printer.EnableNetworkPrinting; _ckSharePrinter.Checked = PrinterConfiguration.IsPrinterShared(_printer.PrinterName); } } else { string errorMessage = "No printers are available."; MessageBox.Show(errorMessage, _strTittle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception Ex) { MessageBox.Show(Ex.ToString(), _strTittle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void PrintPFIMailers(PFIMailerOption pfiMailerOption) { //Create output variables string errorCode; string errorText; var businessRulesProcedures = new BusinessRulesProcedures(GlobalDataAccessor.Instance.DesktopSession); var pfiMailerAdjustmentDays = businessRulesProcedures.GetNumberOfDaysToAddForPFIMailer(GlobalDataAccessor.Instance.CurrentSiteId); var pfiMailerList = new List <ReportObject.PFIMailer>(); var pfiMailerFilesToDeleteList = new List <String>(); var retVal = false; switch (pfiMailerOption) { case PFIMailerOption.PrintPFIMailers: retVal = PawnProcedures.ExecuteGetPFIMailerData(GlobalDataAccessor.Instance.OracleDA, pfiMailerOption, out pfiMailerList, out errorCode, out errorText, pfiMailerAdjustmentDays, pfiDate: ShopDateTime.Instance.ShopDate); break; case PFIMailerOption.ReprintMailbook: retVal = PawnProcedures.ExecuteGetPFIMailerData(GlobalDataAccessor.Instance.OracleDA, pfiMailerOption, out pfiMailerList, out errorCode, out errorText, pfiDate: Utilities.GetDateTimeValue(this.dateReprintMailbook.SelectedDate)); break; case PFIMailerOption.ReprintPFIMailersByDate: retVal = PawnProcedures.ExecuteGetPFIMailerData(GlobalDataAccessor.Instance.OracleDA, pfiMailerOption, out pfiMailerList, out errorCode, out errorText, pfiDate: Utilities.GetDateTimeValue(this.dateReprintMailers.SelectedDate)); break; case PFIMailerOption.ReprintPFIMailersByTicket: retVal = PawnProcedures.ExecuteGetPFIMailerData(GlobalDataAccessor.Instance.OracleDA, pfiMailerOption, out pfiMailerList, out errorCode, out errorText, startTicketNumber: Utilities.GetIntegerValue(this.txtBeginTicket.Text), endTicketNumber: Utilities.GetIntegerValue(this.txtEndTicket.Text), pfiDate: Utilities.GetDateTimeValue(this.dateTicketRange.SelectedDate)); break; case PFIMailerOption.GetTodaysPrintedPFIMailerTickets: retVal = PawnProcedures.ExecuteGetPFIMailerData( GlobalDataAccessor.Instance.OracleDA, pfiMailerOption, out pfiMailerList, out errorCode, out errorText, pfiDate: Utilities.GetDateTimeValue(this.dateTicketRange.SelectedDate)); break; default: System.Diagnostics.Debug.Assert(false, "Unexpected Default case. Forget to add handler?"); break; } if (retVal) { if (pfiMailerOption == PFIMailerOption.GetTodaysPrintedPFIMailerTickets) { if (pfiMailerList.Count > 0) { txtBeginTicket.Text = pfiMailerList[0].ticketNumber.ToString(); txtEndTicket.Text = pfiMailerList[pfiMailerList.Count - 1].ticketNumber.ToString(); } } else if (pfiMailerOption == PFIMailerOption.ReprintMailbook) { PrintMailingBook(pfiMailerFilesToDeleteList, pfiMailerList); MessageBox.Show(@"PFI Mailbook Printing Complete"); } else { if (DisplayPrintPFIMailersConfirmationBox(pfiMailerList.Count, PFIMailerOption.ReprintPFIMailersByTicket == pfiMailerOption)) { if (pfiMailerList.Count > 0) { var mailFee = businessRulesProcedures.GetPFIMailerFee(GlobalDataAccessor.Instance.CurrentSiteId); var ticketNumberList = new List <int>(); var originalPFINoteList = new List <DateTime>(); var pfiEligibleDateList = new List <DateTime>(); var pfiMailerFileNamesToMerge = new List <String>(); var recordCount = 1; foreach (var pfiMailer in pfiMailerList) { var pfiMailerLocal = pfiMailer; if (pfiMailerOption == PFIMailerOption.PrintPFIMailers) // Spec Change //pfiMailerOption == PFIMailerOption.ReprintPFIMailersByTicket || //pfiMailerOption == PFIMailerOption.ReprintPFIMailersByDate) { // pfiMailerLocal.pfiEligibleDate = GetPFIEligibleDate(); //process pfi eligible date adjustment if (ShopDateTime.Instance.ShopDate > pfiMailerLocal.originalPFINote) { // Special Rule PWN_BR-33 Adjustment pfiMailerLocal.pfiEligibleDate = GetPFIDateAdjustmentRule33(pfiMailerLocal.pfiEligibleDate); } //PawnProcedures.ExecuteUpdatePFIMailerData( // GlobalDataAccessor.Instance.OracleDA, // out errorCode, // out errorText, // pfiMailerLocal.storeNumber, // pfiMailerLocal.ticketNumber, // mailFee, // pfiMailerLocal.originalPFINote, // "Y", // pfiEligibleDate); ticketNumberList.Add(pfiMailerLocal.ticketNumber); originalPFINoteList.Add(pfiMailerLocal.originalPFINote); pfiEligibleDateList.Add(pfiMailerLocal.pfiEligibleDate); } var pfiMailerDocument = new PFIMailerDocument(PdfLauncher.Instance); var pfiMailerFileName = "PFIMailer" + recordCount + ".pdf"; var reportObject = new ReportObject { ReportTempFileFullName = Path.Combine( SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath, pfiMailerFileName) }; pfiMailerDocument.ReportObject = reportObject; pfiMailerDocument.CreateReport(pfiMailerLocal); if (FileLogger.Instance.IsLogInfo) { FileLogger.Instance.logMessage( LogLevel.INFO, "PFI_Mailers", "Creating PFI Mailer {0}, Ticket Number {1}", pfiMailerFileName, pfiMailer.ticketNumber); } //var 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, "PFI Mailer : " + strReturnMessage); //} pfiMailerFileNamesToMerge.Add(Path.Combine(SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath, pfiMailerFileName)); recordCount++; } // foreach (var pfiMailer in pfiMailerList) // Merge PFIMailerX.pdf doc's var mergedOutputFile = Path.Combine(SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath, "PFIMailer.pdf"); var wasPDFMergeSuccessful = PDFITextSharpUtilities.MergePDFFiles(mergedOutputFile, pfiMailerFileNamesToMerge.ToArray()); if (wasPDFMergeSuccessful) { var strReturnMessage = PrintingUtilities.printDocument( mergedOutputFile, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port, 1); if (FileLogger.Instance.IsLogInfo) { FileLogger.Instance.logMessage( LogLevel.INFO, "PFI_Mailers", "Printing PFI Mailer {0}", mergedOutputFile); } if (!strReturnMessage.Contains("SUCCESS")) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "PFI Mailer : " + strReturnMessage); } } if (pfiMailerOption == PFIMailerOption.PrintPFIMailers) { PawnProcedures.ExecuteAddPFIMailerDataArray( GlobalDataAccessor.Instance.OracleDA, out errorCode, out errorText, int.Parse(GlobalDataAccessor.Instance.DesktopSession.CurrentSiteId.StoreNumber), ticketNumberList, originalPFINoteList, pfiEligibleDateList, mailFee); } // Spec Change //else if (pfiMailerOption == PFIMailerOption.ReprintPFIMailersByDate || // pfiMailerOption == PFIMailerOption.ReprintPFIMailersByTicket) //{ // PawnProcedures.ExecuteAddPFIMailerDataArray( // GlobalDataAccessor.Instance.OracleDA, // out errorCode, // out errorText, // int.Parse(GlobalDataAccessor.Instance.DesktopSession.CurrentSiteId.StoreNumber), // ticketNumberList, // originalPFINoteList, // pfiEligibleDateList, // mailFee); //} // Spec Change //if (pfiMailerOption != PFIMailerOption.ReprintPFIMailersByTicket) { PrintMailingBook(pfiMailerFilesToDeleteList, pfiMailerList); } } } } } else { if (pfiMailerOption == PFIMailerOption.ReprintMailbook) { MessageBox.Show(@"There is no Mail Book for this date."); } //else if (pfiMailerOption == PFIMailerOption.GetTodaysPrintedPFIMailerTickets) //{ // MessageBox.Show(@"There are no PFI Mailers to be printed for this ticket range."); //} else { MessageBox.Show(@"There are no PFI Mailers to be printed for this date."); } } }
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)); } }
public void PrintAndStoreReport(AuditReportsObject ro, string report) { OracleDataAccessor dA = GlobalDataAccessor.Instance.OracleDA; SecuredCouchConnector cC = GlobalDataAccessor.Instance.CouchDBConnector; try { if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled && ADS.LaserPrinter.IsValid) { if (FileLogger.Instance.IsLogInfo) { FileLogger.Instance.logMessage(LogLevel.INFO, "CallAuditReport", "Printing " + report + " on printer {0}", ADS.LaserPrinter); } string errMsg = PrintingUtilities.printDocument( ro.ReportTempFileFullName, ADS.LaserPrinter.IPAddress, ADS.LaserPrinter.Port, 1); if (errMsg.IndexOf("SUCCESS", StringComparison.OrdinalIgnoreCase) == -1) { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Cannot print " + report + " on {0}", ADS.LaserPrinter); } } } var pDoc = new CouchDbUtils.PawnDocInfo(); //Set document add calls pDoc.UseCurrentShopDateTime = true; pDoc.StoreNumber = ADS.ActiveAudit.StoreNumber; pDoc.CustomerNumber = "0"; pDoc.DocumentType = Document.DocTypeNames.PDF; pDoc.DocFileName = ro.ReportTempFileFullName; pDoc.TicketNumber = ADS.ActiveAudit.AuditId; pDoc.AuxInfo = report; //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, ADS.UserName, ref pDoc, out errText)) { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Could not store " + report + " in document storage: {0} - FileName: {1}", errText, ro.ReportTempFileFullName); } BasicExceptionHandler.Instance.AddException( "Could not store " + report + " in document storage", new ApplicationException("Could not store " + report + " in document storage: " + errText)); } } catch (Exception ex) { } }
private void buttonSubmit_Click(object sender, EventArgs e) { bool returnValue = false; DialogResult dgr = DialogResult.Retry; //Release police hold if (!PoliceSeize && !ReleaseToClaimant) { do { if (!customTextBoxAgency.isValid || !customTextBoxBadgeNumber.isValid || !customTextBoxOfficerFirstName.isValid || !customTextBoxOfficerLastName.isValid || !customTextBoxPhoneAreaCode.isValid || !customTextBoxPhoneNumber.isValid || richTextBoxReason.Text.Trim().Length <= 0) { MessageBox.Show("Please enter all the required fields and submit"); return; } returnValue = HoldsProcedures.RemovePoliceHolds(policeHolds, this.richTextBoxReason.Text, customTextBoxOfficerFirstName.Text, customTextBoxOfficerLastName.Text, customTextBoxBadgeNumber.Text, customTextBoxAgency.Text, customTextBoxCaseNumber.Text, customTextBoxPhoneAreaCode.Text, customTextBoxPhoneNumber.Text, customTextBoxPhoneExt.Text); if (returnValue) { MessageBox.Show("selected transactions released from police hold successfully"); break; } else { dgr = MessageBox.Show(Commons.GetMessageString("ProcessingError"), "Error", MessageBoxButtons.RetryCancel); } }while (dgr == DialogResult.Retry); } //Process police seize if (PoliceSeize) { if (!customTextBoxAgency.isValid || !customTextBoxBadgeNumber.isValid || !customTextBoxOfficerFirstName.isValid || !customTextBoxOfficerLastName.isValid || !customTextBoxPhoneAreaCode.isValid || !customTextBoxPhoneNumber.isValid || richTextBoxReason.Text.Trim().Length <= 0 || !customTextBoxCaseNumber.isValid) { MessageBox.Show("Please enter all the required fields and submit"); return; } CustomerVO currentCustomer = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer; foreach (HoldData policeHold in policeHolds) { policeHold.HoldComment = richTextBoxReason.Text; } PoliceInfo policeInfo = new PoliceInfo { Agency = customTextBoxAgency.Text, BadgeNumber = customTextBoxBadgeNumber.Text, CaseNumber = customTextBoxCaseNumber.Text, OfficerFirstName = customTextBoxOfficerFirstName.Text, OfficerLastName = customTextBoxOfficerLastName.Text, PhoneAreaCode = customTextBoxPhoneAreaCode.Text, PhoneExtension = customTextBoxPhoneExt.Text, PhoneNumber = customTextBoxPhoneNumber.Text, RequestType = "" }; do { int seizeNumber = 0; returnValue = HoldsProcedures.AddPoliceSeize( policeHolds, policeHolds[0].HoldComment, policeInfo, currentCustomer, out seizeNumber); if (returnValue && seizeNumber > 0) { policeInfo.SeizeNumber = seizeNumber; ReceiptDetailsVO rDVO = new ReceiptDetailsVO(); if (!HoldsProcedures.insertPoliceReceipt(policeHolds, ref rDVO)) { FileLogger.Instance.logMessage(LogLevel.ERROR, null, "Receipt details could not be entered for police seize " + seizeNumber); } MessageBox.Show("Selected items police seized successfully"); //Print police seize document foreach (HoldData policehold in policeHolds) { policehold.PoliceInformation = policeInfo; } //Call print Police seize form if print is enabled if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled) { //PoliceSeizeform seizeFrm = new PoliceSeizeform(); //seizeFrm.PoliceSeizeLoans = policeHolds; //seizeFrm.ShowDialog(); //Calling policeseizereport(Itextsharp) instead of bitmap(policeseizeform) calling var policeseizereport = new Reports.PoliceSeizeReport(); var reportObject = new ReportObject(); reportObject.ReportTempFileFullName = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath + "\\Police Seize" + DateTime.Now.ToString("MMddyyyyhhmmssFFFFFFF") + ".pdf"; policeseizereport.reportObject = reportObject; policeseizereport.ReportTempFileFullName = reportObject.ReportTempFileFullName; policeseizereport.STORE_NAME = GlobalDataAccessor.Instance.CurrentSiteId.StoreName; policeseizereport.STORE_ADDRESS = GlobalDataAccessor.Instance.CurrentSiteId.StoreAddress1; policeseizereport.STORE_CITY = GlobalDataAccessor.Instance.CurrentSiteId.StoreCityName; policeseizereport.STORE_STATE = GlobalDataAccessor.Instance.CurrentSiteId.State; policeseizereport.STORE_ZIP = GlobalDataAccessor.Instance.CurrentSiteId.StoreZipCode; policeseizereport.CurrentCust = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer; policeseizereport.EmpNo = GlobalDataAccessor.Instance.DesktopSession.UserName.ToLowerInvariant(); policeseizereport.TransactionDate = ShopDateTime.Instance.ShopDate.FormatDate(); policeseizereport.HoldData = policeHolds[0]; policeseizereport.CustHomeAddr = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerAddress[0]; policeseizereport.CreateReport(); string strReturnMessage; if (GlobalDataAccessor.Instance.DesktopSession.PDALaserPrinter.IsValid) { if (FileLogger.Instance.IsLogInfo) { FileLogger.Instance.logMessage(LogLevel.INFO, this, "Printing PoliceSeize report on PDA Laser printer: {0}", GlobalDataAccessor.Instance.DesktopSession.PDALaserPrinter); } strReturnMessage = PrintingUtilities.printDocument( reportObject.ReportTempFileFullName, GlobalDataAccessor.Instance.DesktopSession.PDALaserPrinter.IPAddress, GlobalDataAccessor.Instance.DesktopSession.PDALaserPrinter.Port, 2); } else if (GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IsValid) { if (FileLogger.Instance.IsLogWarn) { FileLogger.Instance.logMessage(LogLevel.WARN, this, "Could not find valid PDA laser printer to print the PoliceSeize report." + Environment.NewLine + " Printing on default pawn laser printer: {0}", GlobalDataAccessor.Instance.DesktopSession.LaserPrinter); } strReturnMessage = PrintingUtilities.printDocument( reportObject.ReportTempFileFullName, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port, 2); } else { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Could not find a valid laser printer to print the PoliceSeize report"); } strReturnMessage = "FAIL - NO PRINTER FOUND"; } if (strReturnMessage.IndexOf("SUCCESS", StringComparison.OrdinalIgnoreCase) == -1) { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Cannot print the PoliceSeize report: " + strReturnMessage); } } } break; } dgr = MessageBox.Show(Commons.GetMessageString("ProcessingError"), "Error", MessageBoxButtons.RetryCancel); }while (dgr == DialogResult.Retry); } //Process Release to claimant if (ReleaseToClaimant) { //Store the police info in session if (GlobalDataAccessor.Instance.DesktopSession.PoliceInformation == null) { if (!customTextBoxAgency.isValid || !customTextBoxBadgeNumber.isValid || !customTextBoxOfficerFirstName.isValid || !customTextBoxOfficerLastName.isValid || !customTextBoxPhoneAreaCode.isValid || !customTextBoxPhoneNumber.isValid || richTextBoxReason.Text.Trim().Length <= 0) { MessageBox.Show("Please enter all the required fields and submit"); return; } foreach (HoldData policeHold in policeHolds) { policeHold.HoldComment = richTextBoxReason.Text; } PoliceInfo policeInfo = new PoliceInfo { Agency = customTextBoxAgency.Text, BadgeNumber = customTextBoxBadgeNumber.Text, CaseNumber = customTextBoxCaseNumber.Text, OfficerFirstName = customTextBoxOfficerFirstName.Text, OfficerLastName = customTextBoxOfficerLastName.Text, PhoneAreaCode = customTextBoxPhoneAreaCode.Text, PhoneExtension = customTextBoxPhoneExt.Text, PhoneNumber = customTextBoxPhoneNumber.Text }; GlobalDataAccessor.Instance.DesktopSession.PoliceInformation = policeInfo; GlobalDataAccessor.Instance.DesktopSession.ReleaseToClaimant = true; NavControlBox.IsCustom = true; NavControlBox.CustomDetail = "FindClaimant"; this.NavControlBox.Action = NavBox.NavAction.BACKANDSUBMIT; } else { bool gunInvolved = false; CustomerVO currentCustomer = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer; //Check if any of the loans being released has a gun foreach (HoldData pl in policeHolds) { var gunItems = from pItem in pl.Items where pItem.GunNumber > 0 select pItem; if (gunItems.Any()) { gunInvolved = true; break; } } //if gun involved check for cwp bool backgroundCheck = false; if (gunInvolved) { /*DateTime currentDate = ShopDateTime.Instance.ShopDate; * string strStoreState = GlobalDataAccessor.Instance.CurrentSiteId.State; * if (currentCustomer.HasValidConcealedWeaponsPermitInState(strStoreState, currentDate)) * { * if (CustomerProcedures.IsBackgroundCheckRequired()) * { * FirearmsBackgroundCheck backgroundcheckFrm = new FirearmsBackgroundCheck(); * backgroundcheckFrm.ShowDialog(this); * } * else //If the background check is not needed * CashlinxDesktopSession.Instance.BackgroundCheckCompleted = true; * } * //else if they do not have CWP or not a CWP in the store state or expired * //then show the background check form * else * { * FirearmsBackgroundCheck backgroundcheckFrm = new FirearmsBackgroundCheck(); * backgroundcheckFrm.ShowDialog(this); * }*/ FirearmsBackgroundCheck backgroundcheckFrm = new FirearmsBackgroundCheck(); backgroundcheckFrm.ShowDialog(this); if (GlobalDataAccessor.Instance.DesktopSession.BackgroundCheckCompleted) { backgroundCheck = true; } } else { backgroundCheck = true; } if (backgroundCheck) { do { returnValue = HoldsProcedures.AddReleaseToClaimant(policeHolds, policeHolds[0].HoldComment, GlobalDataAccessor.Instance.DesktopSession.PoliceInformation, currentCustomer); if (returnValue) { MessageBox.Show("selected transactions released to claimant successfully"); //Print RTC form foreach (var policeHold in policeHolds) { policeHold.PoliceInformation = GlobalDataAccessor.Instance.DesktopSession.PoliceInformation; policeHold.RestitutionPaid = radioButtonYes.Checked; if (panelRestitution.Visible == true && radioButtonYes.Checked == true) { // there was restitution paid if (customTextBoxResAmount.Text.Trim() == "") { // Probably should have caught this before policeHold.RestitutionAmount = 0; MessageBox.Show("Please enter the restitution amount!", "Restitution amount missing"); customTextBoxResAmount.Focus(); return; } } else { // No restitution paid policeHold.RestitutionPaid = false; policeHold.RestitutionAmount = 0; } } //Call print RTC if print is enabled if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled) { var rtcprintFrm = new RTCform(); rtcprintFrm.RTCLoans = policeHolds; rtcprintFrm.ShowDialog(); } break; } dgr = MessageBox.Show(Commons.GetMessageString("ProcessingError"), "Error", MessageBoxButtons.RetryCancel); }while (dgr == DialogResult.Retry); } else { MessageBox.Show("Background check not completed. selected transactions not released to claimant"); RemoveTempStatusOnLoans(); } GlobalDataAccessor.Instance.DesktopSession.PoliceInformation = null; GlobalDataAccessor.Instance.DesktopSession.ReleaseToClaimant = false; } } this.NavControlBox.Action = NavBox.NavAction.BACKANDSUBMIT; }
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; }
private void printButton_Click(object sender, EventArgs e) { int printOption = -1; int startPage = -1; int endPage = -1; if (radioButton1.Checked) { printOption = 1; } else if (radioButton2.Checked) { printOption = 2; } else if (radioButton3.Checked) { if (!validate()) { MessageBox.Show(message, "Errors", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } startPage = Int32.Parse(startPageTextBox.Text); endPage = Int32.Parse(endPageTextBox.Text); printOption = 3; } else if (radioButton4.Checked) { printOption = 4; } else if (radioButton5.Checked) { printOption = 5; } else if (radioButton6.Checked) { printOption = 6; } DataTable data = null; var errorCode = string.Empty; var errorMessage = string.Empty; String reportTitle = "Gun Book"; var reportType = string.Empty; bool reprintGunRecords = false; String userName = GlobalDataAccessor.Instance.DesktopSession.UserName; string storeNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber; switch (printOption) { case 1: GunBookUtilities.getGunbookRecords(NEW, -1, -1, "", storeNumber, userName, out data, out errorCode, out errorMessage); break; case 2: GunBookUtilities.getGunbookRecords(REPRINT, -1, -1, "", storeNumber, userName, out data, out errorCode, out errorMessage); //reprintGunRecords = true; break; case 3: GunBookUtilities.getGunbookRecords("", startPage, endPage, "", storeNumber, userName, out data, out errorCode, out errorMessage); break; case 4: GunBookUtilities.getGunbookRecords("", -1, -1, ALL, storeNumber, userName, out data, out errorCode, out errorMessage); break; case 5: reportTitle = "Report of All Open Gun Records as of " + ShopDateTime.Instance.ShopDateCurTime; GunBookUtilities.getGunbookRecords("", -1, -1, OPEN, storeNumber, userName, out data, out errorCode, out errorMessage); reportType = "Open"; break; case 6: reportTitle = "Report of All Closed Gun Records as of " + ShopDateTime.Instance.ShopDateCurTime; GunBookUtilities.getGunbookRecords("", -1, -1, CLOSE, storeNumber, userName, out data, out errorCode, out errorMessage); reportType = "Closed"; break; default: MessageBox.Show("Please select one option", "Message", MessageBoxButtons.OK); return; } if (data == null || data.Rows.Count == 0) { if (printOption == 3) { MessageBox.Show("The page range indicated does not exist."); } else { MessageBox.Show("There are no new or updated records since the last print date"); } } else { Cursor = Cursors.WaitCursor; //PrintGunBook myForm = new PrintGunBook(data, reportTitle); //myForm.ShowDialog(); GunBookUtility gunBookPrinting = new GunBookUtility(PdfLauncher.Instance); ReportObject rptObj = new ReportObject(); rptObj.ReportTitle = reportTitle; rptObj.ReportTempFileFullName = string.Format("{0}\\GunBook{1}.pdf", SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath, DateTime.Now.ToString("MMddyyyyhhmmssFFFFFFF")); rptObj.ReportStore = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber; rptObj.ReportStoreDesc = GlobalDataAccessor.Instance.CurrentSiteId.StoreName; rptObj.ReportError = string.Empty; rptObj.ReportErrorLevel = 0; rptObj.ReportParms.Add(reportType); gunBookPrinting.GunBookData = data; gunBookPrinting.RptObject = rptObj; if (gunBookPrinting.Print()) { //Print the Gun Book if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled) { string strReturnMessage; if (GlobalDataAccessor.Instance.DesktopSession.PDALaserPrinter.IsValid) { if (FileLogger.Instance.IsLogInfo) { FileLogger.Instance.logMessage(LogLevel.INFO, this, "Printing gunbook report on PDA Laser printer: {0}", GlobalDataAccessor.Instance.DesktopSession.PDALaserPrinter); } strReturnMessage = PrintingUtilities.printDocument( rptObj.ReportTempFileFullName, GlobalDataAccessor.Instance.DesktopSession.PDALaserPrinter.IPAddress, GlobalDataAccessor.Instance.DesktopSession.PDALaserPrinter.Port, 1); } else if (GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IsValid) { if (FileLogger.Instance.IsLogWarn) { FileLogger.Instance.logMessage(LogLevel.WARN, this, "Could not find valid PDA laser printer to print the gunbook report." + Environment.NewLine + " Printing on default pawn laser printer: {0}", GlobalDataAccessor.Instance.DesktopSession.LaserPrinter); } strReturnMessage = PrintingUtilities.printDocument( rptObj.ReportTempFileFullName, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port, 1); } else { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Could not find a valid laser printer to print the gunbook report"); } strReturnMessage = "FAIL - NO PRINTER FOUND"; } if (strReturnMessage.IndexOf("SUCCESS", StringComparison.OrdinalIgnoreCase) == -1) { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Cannot print Gun Book utility report: " + strReturnMessage); } } //Store Gun Book report var cds = GlobalDataAccessor.Instance.DesktopSession; if (cds != null) { var pDoc = new CouchDbUtils.PawnDocInfo { UseCurrentShopDateTime = true, StoreNumber = cds.CurrentSiteId.StoreNumber, DocumentType = Document.DocTypeNames.PDF, DocFileName = rptObj.ReportTempFileFullName }; //Set document add calls //Add this document to the pawn document registry and document storage string errText; if (!CouchDbUtils.AddPawnDocument(GlobalDataAccessor.Instance.OracleDA, GlobalDataAccessor.Instance.CouchDBConnector, cds.UserName, ref pDoc, out errText)) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Cannot store Gun Book utility report!"); } } // File.Delete(rptObj.ReportTempFileFullName); MessageBox.Show(@"Gun Book Utility Printing Complete"); } } else { MessageBox.Show(@"Failed to generate gun book document"); } } Cursor = Cursors.Default; }
private void PrintMailingBook(List <string> pfiMailerFilesToDeleteList, List <ReportObject.PFIMailer> pfiMailerList) { if (pfiMailerList.Count > 0) { PDFITextSharpUtilities.PdfSharpTools tools; var pageCount = 1; if (pfiMailerList.Count > 8) { pageCount++; var remainder = 0; pageCount = Math.DivRem(pfiMailerList.Count, 8, out remainder); if (remainder > 0) { pageCount++; } } pageCount++; var rowCount = 1; var outputFilePageThree = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath + "\\ps3877_output_main_page1_" + rowCount + ".pdf"; var outputFilePageFour = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath + "\\ps3877_output_last_page_" + rowCount + ".pdf"; var mergedOutputFile = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath + "\\PFIMailerMailbook_ps3877_output_" + rowCount + ".pdf"; var pfiData = new Dictionary <string, string> { { "page_x_of_x_1", "(page 1 of " + pageCount + ")" }, { "#_mailers_printed", pfiMailerList.Count.ToString() }, { "shop_name_shop_no", pfiMailerList[0].storeName }, { "shop_address", pfiMailerList[0].storeAddress }, { "shop_city_state_zip", pfiMailerList[0].storeCity + ", " + pfiMailerList[0].storeState + " " + pfiMailerList[0].storeZipCode } }; var pfiOutputFileList = new List <string> { this.pfiMailerTemplateOneTwo }; for (var index = 0; index < pfiMailerList.Count; index++) { pfiData.Add("row" + rowCount + "_num", (index + 1).ToString()); pfiData.Add("row" + rowCount + "_address1", pfiMailerList[index].customerName); pfiData.Add("row" + rowCount + "_address2", pfiMailerList[index].customerAddress); pfiData.Add( "row" + rowCount + "_address3", pfiMailerList[index].customerCity + ", " + pfiMailerList[index].customerState + " " + pfiMailerList[index].customerZipCode); if (index == (pfiMailerList.Count - 1)) { PDFITextSharpUtilities.OpenPDFFile(this.pfiMailerTemplateThree, out tools); PDFITextSharpUtilities.StampSimplePDFWithFormFields(tools, outputFilePageThree, true, pfiData); pfiOutputFileList.Add(outputFilePageThree); pfiMailerFilesToDeleteList.Add(outputFilePageThree); break; } else if (rowCount % 8 == 0) { var pageNumber = GetPageNumberByRowNumber(index + 1).ToString(); PDFITextSharpUtilities.OpenPDFFile(this.pfiMailerTemplateThree, out tools); PDFITextSharpUtilities.StampSimplePDFWithFormFields(tools, outputFilePageThree, true, pfiData); pfiOutputFileList.Add(outputFilePageThree); pfiMailerFilesToDeleteList.Add(outputFilePageThree); outputFilePageThree = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath + "\\ps3877_output_main_page" + pageNumber + ".pdf"; pfiData = new Dictionary <string, string> { { "page_x_of_x_1", "(page " + pageNumber + " of " + pageCount + ")" }, { "#_mailers_printed", pfiMailerList.Count.ToString() }, { "shop_name_shop_no", pfiMailerList[index].storeNumber.ToString() }, { "shop_address", pfiMailerList[index].storeAddress }, { "shop_city_state_zip", pfiMailerList[index].storeCity + ", " + pfiMailerList[index].storeState + " " + pfiMailerList[index].storeZipCode } }; rowCount = 1; } else { rowCount++; } } pfiData.Add("page_x_of_x_2", "(page " + pageCount + " of " + pageCount + ")"); PDFITextSharpUtilities.OpenPDFFile(this.pfiMailerTemplateFour, out tools); PDFITextSharpUtilities.StampSimplePDFWithFormFields(tools, outputFilePageFour, true, pfiData); pfiOutputFileList.Add(outputFilePageFour); pfiMailerFilesToDeleteList.Add(outputFilePageFour); var wasPDFMergeSuccessful = PDFITextSharpUtilities.MergePDFFiles(mergedOutputFile, pfiOutputFileList.ToArray()); if (wasPDFMergeSuccessful) { var strReturnMessage = PrintingUtilities.printDocument( mergedOutputFile, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port, 1); if (!strReturnMessage.Contains("SUCCESS")) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "PFI Mailer : " + strReturnMessage); } } else { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "PFI Mailer Merge Failed: " + mergedOutputFile); } } }
public void Print(string totalCost, string totalTags, bool showMsg = true) { if (ReportData == null || ReportData.Rows.Count == 0) { if (showMsg) { MessageBox.Show("No records available to print", ReportTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); } return; } ControllerForm.Cursor = Cursors.WaitCursor; ProcessingMessage processingForm = new ProcessingMessage("Please wait while we generate report."); processingForm.Show(); ReportObject reportObject = new ReportObject(); reportObject.ReportTitle = ReportTitle; reportObject.ReportStore = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber; reportObject.ReportTempFile = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath; reportObject.CreateTemporaryFullName(); PfiPostReport report = new PfiPostReport(ReportData, totalCost, totalTags, ShopDateTime.Instance.ShopDate.ToShortDateString(), Convert.ToDateTime(ShopDateTime.Instance.ShopTime.ToString()), reportObject, PdfLauncher.Instance); if (!report.CreateReport()) { processingForm.Close(); processingForm.Dispose(); ControllerForm.Cursor = Cursors.Default; MessageBox.Show("Failed to generate report", "PFI POST", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Dictionary<string, string> eDeviceData = GetPrintDeviceData(); if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled && GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IsValid) { if (FileLogger.Instance.IsLogInfo) { FileLogger.Instance.logMessage(LogLevel.INFO, "PrintPFIUtilities", "Printing {0} on {1}", ReportTitle, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter); } string strReturnMessage = PrintingUtilities.printDocument( reportObject.ReportTempFileFullName, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress, GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port, 1); if (strReturnMessage.IndexOf("SUCCESS", StringComparison.OrdinalIgnoreCase) == -1) { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Cannot print " + ReportTitle + " report " + strReturnMessage); } } } processingForm.Close(); processingForm.Dispose(); ControllerForm.Cursor = Cursors.Default; if (showMsg) { MessageBox.Show("Printing Complete", ReportTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void selectTransferInItemsFormAction(object sender, object data) { NavBox selectTransferInItemsNavBox = (NavBox)sender; NavBox.NavAction action = selectTransferInItemsNavBox.Action; if (action == NavBox.NavAction.BACKANDSUBMIT) { GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); action = NavBox.NavAction.SUBMIT; } var dSession = GlobalDataAccessor.Instance.DesktopSession; switch (action) { case NavBox.NavAction.SUBMIT: //Default happy path next state string errorCode, errorText; int ticketNumber; GlobalDataAccessor.Instance.beginTransactionBlock(); bool retValue = TransferProcedures.ProcessTransferIn( dSession, dSession.ActiveTransferIn, out ticketNumber, out errorCode, out errorText); if (!retValue || ticketNumber == 0) { GlobalDataAccessor.Instance.endTransactionBlock(EndTransactionType.ROLLBACK); MessageBox.Show("An error occured while completing the transfer. Please contact Shop Systems Support."); } else { GlobalDataAccessor.Instance.endTransactionBlock(EndTransactionType.COMMIT); //----------- //MessageBox.Show("report"); var transferList = new List <TransferItemVO>(); var reportObj = new ReportObject.TransferINReportStruct(); reportObj.transDate = ShopDateTime.Instance.ShopDate.ToString(); reportObj.userID = dSession.FullUserName; reportObj.ToStoreName = GlobalDataAccessor.Instance.CurrentSiteId.StoreNickName; reportObj.ToStoreNo = string.Empty; reportObj.FromShopName = string.Format("Shop # - {0}", dSession.ActiveTransferIn.StoreInfo.StoreNickName); reportObj.FromShopNo = string.Empty; reportObj.FromStoreAddrLine1 = string.Empty; reportObj.FromStoreAddrLine2 = string.Empty; reportObj.storeMgrPhone = string.Empty; reportObj.storeMgrName = string.Empty; reportObj.transNum = string.Format("{0}", ticketNumber); reportObj.Carrier = dSession.ActiveTransferIn.Carrier; reportObj.DateReceived = dSession.ActiveTransferIn.StatusDate.ToString(); reportObj.TransferReference = dSession.ActiveTransferIn.TransferTicketNumber.ToString(); reportObj.ReceivedBy = string.Empty; reportObj.logPath = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath; var transreport = new Reports.TransferIN.SummaryReport(GlobalDataAccessor.Instance.DesktopSession.ActiveTransferIn.Items, reportObj, PdfLauncher.Instance); transreport.CreateReport(); //TODO: Store report in couch db if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled && dSession.LaserPrinter.IsValid) { string laserPrinterIp = dSession.LaserPrinter.IPAddress; int laserPrinterPort = dSession.LaserPrinter.Port; PrintingUtilities.printDocument(transreport.getReportFileName(), laserPrinterIp, laserPrinterPort, 1); } //end if (PrintEnabled) //------------ } this.nextState = TransferInFlowState.ManageTransfer; break; case NavBox.NavAction.CANCEL: this.nextState = TransferInFlowState.CancelFlow; break; default: throw new ApplicationException("" + action + " is not a valid state for SelectTransferInItems"); } this.executeNextState(); }