/// <summary> /// Re print STV. /// </summary> /// <param name="dv">The dv.</param> /// <param name="orderId">The order id.</param> /// <param name="pl">The pl.</param> /// <param name="stvLogID">The STV log ID.</param> /// <param name="isConversion">if set to <c>true</c> [is conversion].</param> /// <param name="generateNewPrintID">if set to <c>true</c> [generate new print ID].</param> //public XtraReport RePrintSTV(DataView dv,int orderId, PickList pl,int? stvLogID, bool isConversion, bool generateNewPrintID = true) //{ // var includeInsurance =XtraMessageBox.Show("Include insurance?", "Insurance",MessageBoxButtons.YesNo,MessageBoxIcon.Question)== DialogResult.Yes; // var ord = new Order(); // ord.LoadByPrimaryKey(orderId); // var order = new Order(); // order.LoadByPrimaryKey(orderId); // if (!order.IsPaymentTypeValid()) // { // //TODO: This needs to be handled well. // throw new Exception( // string.Format("PaymentTypeID has a problem. The order has a payment type id of {0}", // ord.PaymentTypeID)); // } // var stores = new Activity(); // stores.LoadByPrimaryKey(order.FromStore); // var textDeliveryNote = ""; // var sendToString = GetReceivingUnitName(order); // if (stvLogID != null) // { // var stvLog = new Issue(); // stvLog.LoadByPrimaryKey(stvLogID.Value); // if (!stvLog.IsColumnNull("IsDeliveryNote") && stvLog.IsDeliveryNote && isConversion) // { // textDeliveryNote = stvLog.IDPrinted.ToString("00000"); // } // } // if (PaymentType.Constants.CASH == ord.PaymentTypeID) // { // var rus = new Institution(); // rus.LoadByPrimaryKey(order.RequestedBy); // var stvReport = new HCMIS.Desktop.Reports.CashInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // stvReport.TIN.Text = rus.TinNo; // stvReport.VAT.Text = rus.VATNo; // stvReport.Town.Text = rus.Town; // stvReport.Woreda.Text = rus.WoredaText; // stvReport.Zone.Text = rus.ZoneText; // stvReport.Region.Text = rus.Region; // stvReport.License.Text = (!rus.IsColumnNull("Ownership") && rus.IsPrivatelyOwned) ? rus.LicenseNo : (!ord.IsColumnNull("LetterNo")) ? ord.LetterNo : ""; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // return stvReport; // } // else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID) // { // var rus = new Institution(); // rus.LoadByPrimaryKey(order.RequestedBy); // HCMIS.Desktop.Reports.CreditInvoice stvReport = // new HCMIS.Desktop.Reports.CreditInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, // CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // //stvReport.Region.Text = rus.Woreda; // stvReport.Zone.Text = rus.Town; // stvReport.Letter.Text = ord.LetterNo; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // } //} /// <summary> /// Re print STV. /// </summary> /// <param name="dv">The dv.</param> /// <param name="orderId">The order id.</param> /// <param name="pl">The pl.</param> /// <param name="stvLogID">The STV log ID.</param> /// <param name="isConversion">if set to <c>true</c> [is conversion].</param> /// <param name="generateNewPrintID">if set to <c>true</c> [generate new print ID].</param> public XtraReport RePrintSTV(DataView dv, int orderId, PickList pl, int? stvLogID, bool isConversion, bool generateNewPrintID = true) { HCMIS.Core.Distribution.Services.PrintLogService pLogService = new HCMIS.Core.Distribution.Services.PrintLogService(); pLogService.StartPrintingSession(); includeInsurance = XtraMessageBox.Show("Include insurance?", "Insurance", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes; var ord = new Order(); ord.LoadByPrimaryKey(orderId); //loading two times var order = new Order(); order.LoadByPrimaryKey(orderId); if (!order.IsPaymentTypeValid()) { //TODO: This needs to be handled well. throw new Exception( string.Format("PaymentTypeID has a problem. The order has a payment type id of {0}", ord.PaymentTypeID)); } var rus = new Institution(); if (ord.PaymentTypeID == PaymentType.Constants.CASH || ord.PaymentTypeID == PaymentType.Constants.CREDIT) { rus.LoadByPrimaryKey(order.RequestedBy); } var stores = new Activity(); stores.LoadByPrimaryKey(order.FromStore); var textDeliveryNote = ""; var sendToString = GetReceivingUnitName(order); if (stvLogID != null) { var stvLog = new Issue(); stvLog.LoadByPrimaryKey(stvLogID.Value); if (!stvLog.IsColumnNull("IsDeliveryNote") && stvLog.IsDeliveryNote && isConversion) { textDeliveryNote = stvLog.IDPrinted.ToString("00000"); } } var xtraReport = new XtraReport(); string stvPrinterName = ""; if (PaymentType.Constants.CASH == ord.PaymentTypeID && !chkDeliveryNotes.Checked) { xtraReport = FormatCashRePrintInvoice(ord, dv.Table, rus, pl, false, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return xtraReport; } else if (PaymentType.Constants.CASH == ord.PaymentTypeID && chkDeliveryNotes.Checked) { xtraReport = FormatCashRePrintInvoice(ord, pl.DefaultView.ToTable(), rus, pl, true, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return xtraReport; } else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID && !chkDeliveryNotes.Checked) { xtraReport = FormatCreditRePrintInvoice(ord, pl.DefaultView.ToTable(), rus, pl, false, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return xtraReport; } else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID && chkDeliveryNotes.Checked) { xtraReport = FormatCreditRePrintInvoice(ord, pl.DefaultView.ToTable(), rus, pl, true, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return xtraReport; } //if (PaymentType.Constants.CASH == ord.PaymentTypeID) //{ // var stvReport = new HCMIS.Desktop.Reports.CashInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // stvReport.TIN.Text = rus.TinNo; // stvReport.VAT.Text = rus.VATNo; // stvReport.Town.Text = rus.Town; // stvReport.Woreda.Text = rus.WoredaText; // stvReport.Zone.Text = rus.ZoneText; // stvReport.Region.Text = rus.Region; // stvReport.License.Text = (!rus.IsColumnNull("Ownership") && rus.IsPrivatelyOwned) ? rus.LicenseNo : (!ord.IsColumnNull("LetterNo")) ? ord.LetterNo : ""; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // return stvReport; //} //else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID) //{ // HCMIS.Desktop.Reports.CreditInvoice stvReport = new HCMIS.Desktop.Reports.CreditInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // //stvReport.Region.Text = rus.Woreda; // stvReport.Zone.Text = rus.Town; // stvReport.Letter.Text = ord.LetterNo; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // return stvReport; //} else if (PaymentType.Constants.STV == ord.PaymentTypeID && generateNewPrintID) { pl.LoadByOrderID(orderId); // check if this is a delivery note Issue sl = new Issue(); sl.LoadByPrimaryKey(stvLogID.Value); if (!sl.IsColumnNull("IsDeliveryNote") && sl.IsDeliveryNote && !isConversion) { var stvReport = new HCMIS.Desktop.Reports.DeliveryNoteForIssue(ord.ID, includeInsurance, CurrentContext.LoggedInUserName); PrepareTheReport(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); stvReport.From.Text = GeneralInfo.Current.HospitalName; stvReport.To.Text = sendToString; stvReport.STVNO.Text = Issue.GetLogFor(ord.RefNo); //stvReport.Date.Text = @"(Reprint) " + Convert.ToDateTime(dv[0]["IssueDate"]).ToString("MM/dd/yyyy"); DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; stvReport.Date.Text = dtDate.Text; //stvReport.ShowPreview(); return stvReport; } else { var stvReport = new HCMIS.Desktop.Reports.STVonHeadedPaper(ord.ID, includeInsurance, CurrentContext.LoggedInUserName); stvReport.DeliveryNoteNo.Text = textDeliveryNote; PrepareTheReport(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); stvReport.From.Text = GeneralInfo.Current.HospitalName; stvReport.To.Text = sendToString; stvReport.STVNO.Text = Issue.GetLogFor(ord.RefNo); //stvReport.Date.Text = @"(Reprint) " + Convert.ToDateTime(dv[0]["IssueDate"]).ToString("MM/dd/yyyy"); DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; stvReport.Date.Text = dtDate.Text; //stvReport.ShowPreview(); return stvReport; } } else if (PaymentType.Constants.STV == ord.PaymentTypeID && !generateNewPrintID) { pl.LoadByOrderID(orderId); //System.Windows.Forms.DialogResult result = XtraMessageBox.Show("Include insurance?", "Insurance", //MessageBoxButtons.YesNo, //MessageBoxIcon.Question); Issue log = new Issue(); log.LoadByPrimaryKey((_reprintId != null) ? _reprintId.Value : stvLogID.Value); if (log.IsColumnNull("HasInsurance") || BLL.Settings.IsCenter) //If it is null, we have no idea about what the insurance status was. So let's ask the user. { System.Windows.Forms.DialogResult result = XtraMessageBox.Show("Include insurance?", "Insurance", MessageBoxButtons.YesNo, MessageBoxIcon.Question); includeInsurance = result == DialogResult.Yes ? true : false; log.HasInsurance = includeInsurance; log.Save(); } else { includeInsurance = log.HasInsurance; } //bool includeInsurance = (!log.IsColumnNull("HasInsurance"))? log.HasInsurance : false; var stvReport = new HCMIS.Desktop.Reports.STVonA4(ord.ID, includeInsurance, CurrentContext.LoggedInUserName); stvReport.DeliveryNoteNo.Text = textDeliveryNote; PrepareTheReport(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, (_reprintId != null) ? _reprintId : stvLogID, isConversion, generateNewPrintID, includeInsurance); stvReport.From.Text = GeneralInfo.Current.HospitalName; stvReport.To.Text = sendToString; //stvReport.STVNO.Text = //STVLog.GetLogFor(ord.RefNo); //stvReport.Date.Text = @"(Reprint) " + Convert.ToDateTime(dv[0]["IssueDate"]).ToString("MM/dd/yyyy"); DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; stvReport.Date.Text = dtDate.Text; return stvReport; } return null; }
private XtraReport FormatCreditRePrintInvoice_Larger(DataTable dvPriced, Order ord, PickList pl, Institution rus, bool deliveryNote, string printerName, HCMIS.Core.Distribution.Services.PrintLogService pLogService, int?stvLogID) { string activityName = ""; bool hasInsurance = includeInsurance; return(WorkflowReportFactory.CreateCreditRePrintInvoiceLarger(dvPriced, ord, pl, rus, deliveryNote, hasInsurance, activityName, true, _stvLogIdChosen)); }
private XtraReport FormatCashRePrintInvoice_Smaller(Order ord, DataTable dvPriced, BLL.Institution rus, PickList pl, bool deliveryNote, string printerName, HCMIS.Core.Distribution.Services.PrintLogService pLogService, int?stvLogID) { string activityName = ""; bool hasInsurnance = includeInsurance; return(WorkflowReportFactory.CreateCashReprintInvoiceSmaller(ord, dvPriced, rus, pl, deliveryNote, hasInsurnance, activityName, _stvLogIdChosen)); }
private XtraReport FormatCreditRePrintInvoice(Order ord, DataTable dvPriced, BLL.Institution rus, PickList pl, bool deliveryNote, string printerName, HCMIS.Core.Distribution.Services.PrintLogService pLogService, int?stvLogID) { if (BLL.Settings.UseSmallerCreditPrintout) { return(FormatCreditRePrintInvoice_Smaller(dvPriced, ord, pl, rus, deliveryNote, printerName, pLogService, _stvLogIdChosen)); } return(FormatCreditRePrintInvoice_Larger(dvPriced, ord, pl, rus, deliveryNote, printerName, pLogService, _stvLogIdChosen)); }
/// <summary> /// Re print STV. /// </summary> /// <param name="dv">The dv.</param> /// <param name="orderId">The order id.</param> /// <param name="pl">The pl.</param> /// <param name="stvLogID">The STV log ID.</param> /// <param name="isConversion">if set to <c>true</c> [is conversion].</param> /// <param name="generateNewPrintID">if set to <c>true</c> [generate new print ID].</param> //public XtraReport RePrintSTV(DataView dv,int orderId, PickList pl,int? stvLogID, bool isConversion, bool generateNewPrintID = true) //{ // var includeInsurance =XtraMessageBox.Show("Include insurance?", "Insurance",MessageBoxButtons.YesNo,MessageBoxIcon.Question)== DialogResult.Yes; // var ord = new Order(); // ord.LoadByPrimaryKey(orderId); // var order = new Order(); // order.LoadByPrimaryKey(orderId); // if (!order.IsPaymentTypeValid()) // { // //TODO: This needs to be handled well. // throw new Exception( // string.Format("PaymentTypeID has a problem. The order has a payment type id of {0}", // ord.PaymentTypeID)); // } // var stores = new Activity(); // stores.LoadByPrimaryKey(order.FromStore); // var textDeliveryNote = ""; // var sendToString = GetReceivingUnitName(order); // if (stvLogID != null) // { // var stvLog = new Issue(); // stvLog.LoadByPrimaryKey(stvLogID.Value); // if (!stvLog.IsColumnNull("IsDeliveryNote") && stvLog.IsDeliveryNote && isConversion) // { // textDeliveryNote = stvLog.IDPrinted.ToString("00000"); // } // } // if (PaymentType.Constants.CASH == ord.PaymentTypeID) // { // var rus = new Institution(); // rus.LoadByPrimaryKey(order.RequestedBy); // var stvReport = new HCMIS.Desktop.Reports.CashInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // stvReport.TIN.Text = rus.TinNo; // stvReport.VAT.Text = rus.VATNo; // stvReport.Town.Text = rus.Town; // stvReport.Woreda.Text = rus.WoredaText; // stvReport.Zone.Text = rus.ZoneText; // stvReport.Region.Text = rus.Region; // stvReport.License.Text = (!rus.IsColumnNull("Ownership") && rus.IsPrivatelyOwned) ? rus.LicenseNo : (!ord.IsColumnNull("LetterNo")) ? ord.LetterNo : ""; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // return stvReport; // } // else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID) // { // var rus = new Institution(); // rus.LoadByPrimaryKey(order.RequestedBy); // HCMIS.Desktop.Reports.CreditInvoice stvReport = // new HCMIS.Desktop.Reports.CreditInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, // CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // //stvReport.Region.Text = rus.Woreda; // stvReport.Zone.Text = rus.Town; // stvReport.Letter.Text = ord.LetterNo; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // } //} /// <summary> /// Re print STV. /// </summary> /// <param name="dv">The dv.</param> /// <param name="orderId">The order id.</param> /// <param name="pl">The pl.</param> /// <param name="stvLogID">The STV log ID.</param> /// <param name="isConversion">if set to <c>true</c> [is conversion].</param> /// <param name="generateNewPrintID">if set to <c>true</c> [generate new print ID].</param> public XtraReport RePrintSTV(DataView dv, int orderId, PickList pl, int?stvLogID, bool isConversion, bool generateNewPrintID = true) { HCMIS.Core.Distribution.Services.PrintLogService pLogService = new HCMIS.Core.Distribution.Services.PrintLogService(); pLogService.StartPrintingSession(); includeInsurance = XtraMessageBox.Show("Include insurance?", "Insurance", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes; var ord = new Order(); ord.LoadByPrimaryKey(orderId); //loading two times var order = new Order(); order.LoadByPrimaryKey(orderId); if (!order.IsPaymentTypeValid()) { //TODO: This needs to be handled well. throw new Exception( string.Format("PaymentTypeID has a problem. The order has a payment type id of {0}", ord.PaymentTypeID)); } var rus = new Institution(); if (ord.PaymentTypeID == PaymentType.Constants.CASH || ord.PaymentTypeID == PaymentType.Constants.CREDIT) { rus.LoadByPrimaryKey(order.RequestedBy); } var stores = new Activity(); stores.LoadByPrimaryKey(order.FromStore); var textDeliveryNote = ""; var sendToString = GetReceivingUnitName(order); if (stvLogID != null) { var stvLog = new Issue(); stvLog.LoadByPrimaryKey(stvLogID.Value); if (!stvLog.IsColumnNull("IsDeliveryNote") && stvLog.IsDeliveryNote && isConversion) { textDeliveryNote = stvLog.IDPrinted.ToString("00000"); } } var xtraReport = new XtraReport(); string stvPrinterName = ""; if (PaymentType.Constants.CASH == ord.PaymentTypeID && !chkDeliveryNotes.Checked) { xtraReport = FormatCashRePrintInvoice(ord, dv.Table, rus, pl, false, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return(xtraReport); } else if (PaymentType.Constants.CASH == ord.PaymentTypeID && chkDeliveryNotes.Checked) { xtraReport = FormatCashRePrintInvoice(ord, pl.DefaultView.ToTable(), rus, pl, true, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return(xtraReport); } else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID && !chkDeliveryNotes.Checked) { xtraReport = FormatCreditRePrintInvoice(ord, pl.DefaultView.ToTable(), rus, pl, false, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return(xtraReport); } else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID && chkDeliveryNotes.Checked) { xtraReport = FormatCreditRePrintInvoice(ord, pl.DefaultView.ToTable(), rus, pl, true, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return(xtraReport); } //if (PaymentType.Constants.CASH == ord.PaymentTypeID) //{ // var stvReport = new HCMIS.Desktop.Reports.CashInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // stvReport.TIN.Text = rus.TinNo; // stvReport.VAT.Text = rus.VATNo; // stvReport.Town.Text = rus.Town; // stvReport.Woreda.Text = rus.WoredaText; // stvReport.Zone.Text = rus.ZoneText; // stvReport.Region.Text = rus.Region; // stvReport.License.Text = (!rus.IsColumnNull("Ownership") && rus.IsPrivatelyOwned) ? rus.LicenseNo : (!ord.IsColumnNull("LetterNo")) ? ord.LetterNo : ""; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // return stvReport; //} //else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID) //{ // HCMIS.Desktop.Reports.CreditInvoice stvReport = new HCMIS.Desktop.Reports.CreditInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // //stvReport.Region.Text = rus.Woreda; // stvReport.Zone.Text = rus.Town; // stvReport.Letter.Text = ord.LetterNo; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // return stvReport; //} else if (PaymentType.Constants.STV == ord.PaymentTypeID && generateNewPrintID) { pl.LoadByOrderID(orderId); // check if this is a delivery note Issue sl = new Issue(); sl.LoadByPrimaryKey(stvLogID.Value); if (!sl.IsColumnNull("IsDeliveryNote") && sl.IsDeliveryNote && !isConversion) { var stvReport = new HCMIS.Desktop.Reports.DeliveryNoteForIssue(ord.ID, includeInsurance, CurrentContext.LoggedInUserName); PrepareTheReport(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); stvReport.From.Text = GeneralInfo.Current.HospitalName; stvReport.To.Text = sendToString; stvReport.STVNO.Text = Issue.GetLogFor(ord.RefNo); //stvReport.Date.Text = @"(Reprint) " + Convert.ToDateTime(dv[0]["IssueDate"]).ToString("MM/dd/yyyy"); DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; stvReport.Date.Text = dtDate.Text; //stvReport.ShowPreview(); return(stvReport); } else { var stvReport = new HCMIS.Desktop.Reports.STVonHeadedPaper(ord.ID, includeInsurance, CurrentContext.LoggedInUserName); stvReport.DeliveryNoteNo.Text = textDeliveryNote; PrepareTheReport(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); stvReport.From.Text = GeneralInfo.Current.HospitalName; stvReport.To.Text = sendToString; stvReport.STVNO.Text = Issue.GetLogFor(ord.RefNo); //stvReport.Date.Text = @"(Reprint) " + Convert.ToDateTime(dv[0]["IssueDate"]).ToString("MM/dd/yyyy"); DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; stvReport.Date.Text = dtDate.Text; //stvReport.ShowPreview(); return(stvReport); } } else if (PaymentType.Constants.STV == ord.PaymentTypeID && !generateNewPrintID) { pl.LoadByOrderID(orderId); //System.Windows.Forms.DialogResult result = XtraMessageBox.Show("Include insurance?", "Insurance", //MessageBoxButtons.YesNo, //MessageBoxIcon.Question); Issue log = new Issue(); log.LoadByPrimaryKey((_reprintId != null) ? _reprintId.Value : stvLogID.Value); if (log.IsColumnNull("HasInsurance") || BLL.Settings.IsCenter) //If it is null, we have no idea about what the insurance status was. So let's ask the user. { System.Windows.Forms.DialogResult result = XtraMessageBox.Show("Include insurance?", "Insurance", MessageBoxButtons.YesNo, MessageBoxIcon.Question); includeInsurance = result == DialogResult.Yes ? true : false; log.HasInsurance = includeInsurance; log.Save(); } else { includeInsurance = log.HasInsurance; } //bool includeInsurance = (!log.IsColumnNull("HasInsurance"))? log.HasInsurance : false; var stvReport = new HCMIS.Desktop.Reports.STVonA4(ord.ID, includeInsurance, CurrentContext.LoggedInUserName); stvReport.DeliveryNoteNo.Text = textDeliveryNote; PrepareTheReport(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, (_reprintId != null) ? _reprintId : stvLogID, isConversion, generateNewPrintID, includeInsurance); stvReport.From.Text = GeneralInfo.Current.HospitalName; stvReport.To.Text = sendToString; //stvReport.STVNO.Text = //STVLog.GetLogFor(ord.RefNo); //stvReport.Date.Text = @"(Reprint) " + Convert.ToDateTime(dv[0]["IssueDate"]).ToString("MM/dd/yyyy"); DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; stvReport.Date.Text = dtDate.Text; return(stvReport); } return(null); }