/// <summary> /// Saves the and print STV. /// </summary> /// <param name="pickListDetail">The pick list detail.</param> /// <param name="deliveryNotePrinter">The delivery note printer.</param> /// <param name="stvPrinterName">Name of the STV printer.</param> /// <param name="dtDate">The dt date.</param> /// <param name="dtCurrent">The dt current.</param> /// <exception cref="System.Exception"></exception> private XtraReport SaveAndPrintSTV(DataView pickListDetail, bool isDeliveryNote, string printerName, DateTimePickerEx dtDate, DateTime dtCurrent) { HCMIS.Core.Distribution.Services.PrintLogService pLogService = new HCMIS.Core.Distribution.Services.PrintLogService(); pLogService.StartPrintingSession(); Order ord = IssueDoc.SaveIssueTransaction(_orderID, ref pickListDetail, txtRemarks.Text, CurrentContext.LoggedInUserName, dtCurrent); if (pickListDetail.Count == 0) { throw new Exception("An error occurred during saving the issue. Please contact your administrator."); } string sendToString = ""; BLL.Order ordr = new BLL.Order(); ordr.LoadByPrimaryKey(_orderID); BLL.Institution rus = new Institution(); if (!ordr.IsColumnNull("RequestedBy")) { rus.LoadByPrimaryKey(ordr.RequestedBy); sendToString = rus.Name; } else if (!ordr.IsColumnNull("OrderTypeID") && ordr.OrderTypeID == BLL.OrderType.CONSTANTS.ACCOUNT_TO_ACCOUNT_TRANSFER) { BLL.Transfer transfer = new Transfer(); transfer.LoadByOrderID(_orderID); var activity = new Activity(); activity.LoadByPrimaryKey(transfer.ToStoreID); sendToString = activity.FullActivityName; } PickList pl = new PickList(); pl.LoadByOrderID(ord.ID); var xtraReport = new XtraReport(); if (ord.PaymentTypeID == PaymentType.Constants.CASH) { xtraReport = FormatCashInvoice(ord, pickListDetail.Table, rus, pl, isDeliveryNote, printerName, pLogService); } else if (ord.PaymentTypeID == PaymentType.Constants.CREDIT) { xtraReport = FormatCreditInvoice(ord, pickListDetail.Table, rus, pl, isDeliveryNote, printerName, pLogService); } else if (ord.PaymentTypeID == PaymentType.Constants.STV) { xtraReport = FormatSTV(ord, pickListDetail.Table, sendToString, pl, isDeliveryNote, printerName, pLogService, _orderID); } SavePdfReport(pLogService, xtraReport); pLogService.CommitPrintLog(); return(xtraReport); }