private void OnLabels_Click()
        {
            if (gridMain.SelectedIndices.Length == 0)
            {
                MessageBox.Show(Lan.g(this, "Please select an item first."));
                return;
            }
            PrintDocument pd = new PrintDocument();          //only used to pass printerName

            if (!Printers.SetPrinter(pd, PrintSituation.LabelSingle))
            {
                return;
            }
            Carrier carrier;
            Claim   claim;
            InsPlan plan;

            for (int i = 0; i < gridMain.SelectedIndices.Length; i++)
            {
                claim   = Claims.GetClaim(listQueue[gridMain.SelectedIndices[i]].ClaimNum);
                plan    = InsPlans.GetPlan(claim.PlanNum, new InsPlan[] {});
                carrier = Carriers.GetCarrier(plan.CarrierNum);
                LabelSingle label = new LabelSingle();
                if (!label.PrintIns(carrier, pd.PrinterSettings.PrinterName))
                {
                    return;
                }
            }
        }
示例#2
0
 ///<summary></summary>
 public void PrintReport()
 {
     pd2            = new PrintDocument();
     pd2.PrintPage += new PrintPageEventHandler(this.pd2_PrintPage);
     pd2.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
     pd2.OriginAtMargins             = true;
     if (!PrefB.GetBool("RxOrientVert"))
     {
         pd2.DefaultPageSettings.Landscape = true;
     }
                 #if DEBUG
     pd2.DefaultPageSettings.PaperSize   = new PaperSize("default", 850, 1100);
     pView.printPreviewControl2.Document = pd2;
     pView.ShowDialog();
                 #else
     if (!Printers.SetPrinter(pd2, PrintSituation.Rx))
     {
         return;
     }
     try{
         pd2.Print();
     }
     catch {
         MessageBox.Show(Lan.g(this, "Printer not available"));
     }
                 #endif
 }
示例#3
0
 private void butPrint_Click(object sender, EventArgs e)
 {
     linesPrinted  = 0;
     pd            = new PrintDocument();
     pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
     pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
     pd.OriginAtMargins             = true;
     if (pd.DefaultPageSettings.PaperSize.Height == 0)
     {
         pd.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
     }
                 #if DEBUG
     printPreview = new PrintPreview(PrintSituation.Default, pd, 1);
     printPreview.ShowDialog();
                 #else
     try {
         if (Printers.SetPrinter(pd, PrintSituation.Default))
         {
             pd.Print();
         }
     }
     catch {
         MessageBox.Show(Lan.g(this, "Printer not available"));
     }
                 #endif
 }
示例#4
0
        private void FillCombo(ComboBox combo)
        {
            PrintSituation sit           = GetSit(combo);
            Printer        printerForSit = Printers.GetForSit(sit);
            string         printerName   = "";

            if (printerForSit != null)
            {
                printerName = printerForSit.PrinterName;
            }
            combo.Items.Clear();
            if (combo == comboDefault)
            {
                combo.Items.Add(Lan.g(this, "Windows default"));
            }
            else
            {
                combo.Items.Add(Lan.g(this, "default"));
            }
            for (int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++)
            {
                combo.Items.Add(PrinterSettings.InstalledPrinters[i]);
                if (printerName == PrinterSettings.InstalledPrinters[i])
                {
                    combo.SelectedIndex = i + 1;
                }
            }
            if (combo.SelectedIndex == -1)
            {
                combo.SelectedIndex = 0;
            }
        }
 ///<summary>Preview is only used for debugging.</summary>
 public void PrintReport(bool justPreview)
 {
     pd2            = new PrintDocument();
     pd2.PrintPage += new PrintPageEventHandler(this.pd2_PrintPage);
     pd2.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
     pd2.OriginAtMargins             = true;
     if (pd2.DefaultPageSettings.PaperSize.Height == 0)
     {
         pd2.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
     }
     headingPrinted = false;
     //isPrinting=true;
     //FillGrid();
     try {
         if (justPreview)
         {
             FormRpPrintPreview pView = new FormRpPrintPreview();
             pView.printPreviewControl2.Document = pd2;
             pView.ShowDialog();
         }
         else
         {
             if (Printers.SetPrinter(pd2, PrintSituation.Default))
             {
                 pd2.Print();
             }
         }
     }
     catch {
         MessageBox.Show(Lan.g(this, "Printer not available"));
     }
     //isPrinting=false;
 }
        /*private void butSave_Click(object sender, System.EventArgs e) {
         *      if(  textDateStart.errorProvider1.GetError(textDateStart)!=""
         || textDateEnd.errorProvider1.GetError(textDateEnd)!="")
         ||     {
         ||             MessageBox.Show(Lan.g(this,"Please fix data entry errors first."));
         ||             return;
         ||     }
         ||     int daysPast=((TimeSpan)(DateTime.Today-PIn.PDate(textDateStart.Text))).Days;//can be neg
         ||     int daysFuture=((TimeSpan)(PIn.PDate(textDateEnd.Text)-DateTime.Today)).Days;//can be neg
         ||     if(Prefs.UpdateBool("RecallGroupByFamily",checkGroupFamilies.Checked)
         | Prefs.UpdateInt("RecallDaysPast",daysPast)
         | Prefs.UpdateInt("RecallDaysFuture",daysFuture))
         |      {
         |              DataValid.SetInvalid(InvalidTypes.Prefs);
         |      }
         | }*/

        private void butPrint_Click(object sender, EventArgs e)
        {
            pagesPrinted  = 0;
            pd            = new PrintDocument();
            pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
            pd.DefaultPageSettings.Margins = new Margins(25, 25, 40, 40);
            //pd.OriginAtMargins=true;
            if (pd.DefaultPageSettings.PaperSize.Height == 0)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
            }
            headingPrinted = false;
            try {
                                #if DEBUG
                FormRpPrintPreview pView = new FormRpPrintPreview();
                pView.printPreviewControl2.Document = pd;
                pView.ShowDialog();
                                #else
                if (Printers.SetPrinter(pd, PrintSituation.Default))
                {
                    pd.Print();
                }
                                #endif
            }
            catch {
                MessageBox.Show(Lan.g(this, "Printer not available"));
            }
        }
示例#7
0
        private void FillCheck(CheckBox check)
        {
            PrintSituation sit           = GetSit(check);
            Printer        printerForSit = Printers.GetForSit(sit);

            if (printerForSit == null)
            {
                check.Checked = false;
                return;
            }
            check.Checked = printerForSit.DisplayPrompt;
        }
        private void OnBlank_Click()
        {
            PrintDocument pd = new PrintDocument();

            if (!Printers.SetPrinter(pd, PrintSituation.Claim))
            {
                return;
            }
            FormClaimPrint FormCP = new FormClaimPrint();

            FormCP.PrintBlank = true;
            FormCP.PrintImmediate(pd.PrinterSettings.PrinterName, pd.PrinterSettings.Copies);
        }
示例#9
0
        ///<summary></summary>
        public void PrintReport(bool justPreview)
        {
            pd2            = new PrintDocument();
            pd2.PrintPage += new PrintPageEventHandler(this.pd2_PrintPage);
//			pd2.DefaultPageSettings.Margins= new Margins(10,40,40,60);
            try {
                if (justPreview)
                {
                    printPreviewControl2.Document = pd2;
                }
                else if (Printers.SetPrinter(pd2, PrintSituation.Default))
                {
                    pd2.Print();
                }
            }
            catch {
                MessageBox.Show(Lan.g(this, "Printer not available"));
            }
        }
示例#10
0
 ///<summary></summary>
 public void PrintPat(Patient pat)
 {
     Pat           = pat.Copy();
     pd            = new PrintDocument();
     pd.PrintPage += new PrintPageEventHandler(pd_PrintPagePat);
     pd.DefaultPageSettings.Margins   = new Margins(0, 0, 0, 0);
     pd.OriginAtMargins               = true;
     pd.DefaultPageSettings.Landscape = false;
     if (!Printers.SetPrinter(pd, PrintSituation.LabelSingle))
     {
         return;
     }
     try{
         pd.Print();
     }
     catch {
         MessageBox.Show(Lan.g("Label", "Printer not available"));
     }
 }
示例#11
0
		private void Print_Click(){
			PrintDocument pd=new PrintDocument();
			pd.DocumentName=viewer.SourceFile;
			pd.PrinterSettings.FromPage=1;
			pd.PrinterSettings.ToPage=viewer.PageCount;
			pd.PrinterSettings.MaximumPage=viewer.PageCount;
			pd.PrinterSettings.MinimumPage=1;
			pd.DefaultPageSettings.Landscape=viewer.PageWidth>viewer.PageHeight;
			try{
				if(Printers.SetPrinter(pd,PrintSituation.Default)){
					if(pd.PrinterSettings.PrintRange==PrintRange.Selection) {
						pd.PrinterSettings.FromPage=viewer.PageCurrent;
					}
					viewer.Print(pd);
				}
			}
			catch{
				MessageBox.Show(Lan.g(this,"Printer not available"));
			}
		}
示例#12
0
        private void OnPrint_Click()
        {
            FormClaimPrint FormCP = new FormClaimPrint();

            if (gridMain.SelectedIndices.Length == 0)
            {
                for (int i = 0; i < listQueue.Length; i++)
                {
                    if ((listQueue[i].ClaimStatus == "W" || listQueue[i].ClaimStatus == "P") &&
                        listQueue[i].NoSendElect)
                    {
                        gridMain.SetSelected(i, true);
                    }
                }
                if (MessageBox.Show(Lan.g(this, "No items were selected.  Print all selected paper claims?"), ""
                                    , MessageBoxButtons.OKCancel) != DialogResult.OK)
                {
                    return;
                }
            }
            PrintDocument pd = new PrintDocument();

            if (!Printers.SetPrinter(pd, PrintSituation.Claim))
            {
                return;
            }
            for (int i = 0; i < gridMain.SelectedIndices.Length; i++)
            {
                FormCP.ThisPatNum   = listQueue[gridMain.SelectedIndices[i]].PatNum;
                FormCP.ThisClaimNum = listQueue[gridMain.SelectedIndices[i]].ClaimNum;
                if (!FormCP.PrintImmediate(pd.PrinterSettings.PrinterName, 1))
                {
                    return;
                }
                Etranss.SetClaimSentOrPrinted(listQueue[gridMain.SelectedIndices[i]].ClaimNum,
                                              listQueue[gridMain.SelectedIndices[i]].PatNum, 0, EtransType.ClaimPrinted);
            }
            FillGrid();
            FillHistory();
        }
示例#13
0
        private void butPrint_Click(object sender, System.EventArgs e)
        {
            if (textBody.Text == "")
            {
                MsgBox.Show(this, "Letter not allowed to be blank.");
                return;
            }
            pd2                 = new PrintDocument();
            pd2.PrintPage      += new PrintPageEventHandler(this.pd2_PrintPage);
            pd2.OriginAtMargins = true;
            if (!Printers.SetPrinter(pd2, PrintSituation.Default))
            {
                return;
            }
            try{
                pd2.Print();
            }
            catch {
                MessageBox.Show(Lan.g(this, "Printer not available"));
            }
            Commlog CommlogCur = new Commlog();

            CommlogCur.CommDateTime = DateTime.Now;
            CommlogCur.CommType     = CommItemType.Misc;
            CommlogCur.PatNum       = PatCur.PatNum;
            CommlogCur.Note         = "Letter sent";
            if (LetterCur != null)
            {
                CommlogCur.Note += ": " + LetterCur.Description + ". ";
            }
            FormCommItem FormCI = new FormCommItem(CommlogCur);

            FormCI.IsNew = true;
            FormCI.ShowDialog();
            //this window now closes regardless of whether the user saved the comm item.
            DialogResult = DialogResult.OK;
        }
示例#14
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            string compName = SystemInformation.ComputerName;

            if (checkSimple.Checked && !PrefC.GetBool(PrefName.EasyHidePrinters))
            {
                //if user clicked the simple option
                if (!MsgBox.Show(this, true, "Warning! You have selected the easy view option.  This will clear all printing preferences for all computers.  Are you sure you wish to continue?"))
                {
                    return;
                }
                Printers.ClearAll();
                Printers.RefreshCache();
                string printerName = "";
                if (comboDefault.SelectedIndex == 0)
                {
                    printerName = "";
                }
                else
                {
                    printerName = PrinterSettings.InstalledPrinters[comboDefault.SelectedIndex - 1];
                }
                Printers.PutForSit(PrintSituation.Default, compName, printerName, true);
            }
            else
            {
                for (int i = 0; i < Enum.GetValues(typeof(PrintSituation)).Length; i++)
                {
                    //loop through each printSituation
                    string printerName = "";
                    bool   isChecked   = false;
                    //PrintSituation sit=PrintSituation.Default;
                    //first: main Default, since not in panel Simple
                    if (i == 0)          //printSituation.Default
                    {
                        if (comboDefault.SelectedIndex == 0)
                        {
                            printerName = "";
                        }
                        else
                        {
                            printerName = PrinterSettings.InstalledPrinters[comboDefault.SelectedIndex - 1];
                        }
                    }
                    foreach (Control control in panelSimple.Controls)
                    {
                        if (control.GetType() != typeof(ComboBox) &&          //skip anything but comboBoxes and CheckBoxes
                            control.GetType() != typeof(CheckBox))
                        {
                            continue;
                        }
                        //so only two controls out of all will be used in each Enum loop
                        if (GetSit(control) != (PrintSituation)i)
                        {
                            continue;
                        }
                        if (control.GetType() == typeof(ComboBox))
                        {
                            if (((ComboBox)control).SelectedIndex == 0)
                            {
                                printerName = "";
                            }
                            else
                            {
                                printerName = PrinterSettings.InstalledPrinters[((ComboBox)control).SelectedIndex - 1];
                            }
                        }
                        else                 //checkBox
                        {
                            isChecked = ((CheckBox)control).Checked;
                        }
                    }
                    Printers.PutForSit((PrintSituation)i, compName, printerName, isChecked);
                }
            }
            DataValid.SetInvalid(InvalidType.Computers);
            if (checkSimple.Checked != PrefC.GetBool(PrefName.EasyHidePrinters))
            {
                Prefs.UpdateBool(PrefName.EasyHidePrinters, checkSimple.Checked);
                DataValid.SetInvalid(InvalidType.Prefs);
            }
            Printers.RefreshCache();            //the other computers don't care
            DialogResult = DialogResult.OK;
        }
示例#15
0
        ///<summary>Called from many places in the program.  Every single time we print, this function is used to figure out which printer to use.  It also handles displaying the dialog if necessary.  Tests to see if the selected printer is valid, and if not, then it gives user the option to print to an available printer.</summary>
        public static bool SetPrinter(PrintDocument pd, PrintSituation sit)
        {
            PrinterSettings pSet = pd.PrinterSettings;
            //pSet will always be new when this function is called
            //0.5. Get the name of the Windows default printer.
            //This method only works when the pSet is still new.
            //string winDefault=pSet.PrinterName;
            //1. If a default printer is set in OD,
            //and it is in the list of installed printers, use it.
            bool    doPrompt      = false;
            Printer printerForSit = Printers.GetForSit(PrintSituation.Default);          //warning: this changes
            string  printerName   = "";

            if (printerForSit != null)
            {
                printerName = printerForSit.PrinterName;
                doPrompt    = printerForSit.DisplayPrompt;
                if (Printers.PrinterIsInstalled(printerName))
                {
                    pSet.PrinterName = printerName;
                }
            }
            //2. If a printer is set for this situation,
            //and it is in the list of installed printers, use it.
            if (sit != PrintSituation.Default)
            {
                printerForSit = Printers.GetForSit(sit);
                printerName   = "";
                if (printerForSit != null)
                {
                    printerName = printerForSit.PrinterName;
                    doPrompt    = printerForSit.DisplayPrompt;
                    if (Printers.PrinterIsInstalled(printerName))
                    {
                        pSet.PrinterName = printerName;
                    }
                }
            }
            //4. Present the dialog
            if (!doPrompt)
            {
                return(true);
            }
            PrintDialog dialog = new PrintDialog();

            //pSet.Collate is true here
            dialog.PrinterSettings = pSet;
            dialog.UseEXDialog     = true;
                        #if DEBUG
            return(true);
                        #else
            DialogResult result = dialog.ShowDialog();
            //but dialog.PrinterSettings.Collate is false here.  I don't know what triggers the change.
            pSet.Collate = true;                  //force it back to true.
            if (result != DialogResult.OK)
            {
                return(false);
            }
            //if(!dialog.PrinterSettings.IsValid){//not needed since we have already checked each name.
            //pd2.PrinterSettings=printDialog2.PrinterSettings;
            //}
            return(true);
                        #endif
        }
示例#16
0
        ///<summary>Called from many places in the program.  Every single time we print, this function is used to figure out which printer to use.
        ///It also handles displaying the dialog if necessary.  Tests to see if the selected printer is valid, and if not, then it gives user the
        ///option to print to an available printer.  PatNum and AuditDescription used to make audit log entry.  PatNum can be 0.  Audit Log Text will
        ///show AuditDescription exactly.</summary>
        public static bool SetPrinter(PrintDocument pd, PrintSituation sit, long patNum, string auditDescription)
        {
            PrinterSettings pSet = pd.PrinterSettings;

            //pSet will always be new when this function is called
            //0.5. Get the name of the Windows default printer.
            //This method only works when the pSet is still new.
            //string winDefault=pSet.PrinterName;
            //1. If a default printer is set in OD,
            //and it is in the list of installed printers, use it.
            if (pSet.PrinterName == null)
            {
                MessageBox.Show("Error: " +
                                "\r\nYou may not have a printer installed\r\n" +
                                "If you do have a printer installed, restarting the workstation may resolve the problem."
                                );
                return(false);
            }
            bool    doPrompt      = false;
            Printer printerForSit = Printers.GetForSit(PrintSituation.Default);          //warning: this changes
            string  printerName   = "";

            if (printerForSit != null)
            {
                printerName = printerForSit.PrinterName;
                doPrompt    = printerForSit.DisplayPrompt;
                if (Printers.PrinterIsInstalled(printerName))
                {
                    pSet.PrinterName = printerName;
                }
            }
            //2. If a printer is set for this situation,
            //and it is in the list of installed printers, use it.
            if (sit != PrintSituation.Default)
            {
                printerForSit = Printers.GetForSit(sit);
                printerName   = "";
                if (printerForSit != null)
                {
                    printerName = printerForSit.PrinterName;
                    doPrompt    = printerForSit.DisplayPrompt;
                    if (Printers.PrinterIsInstalled(printerName))
                    {
                        pSet.PrinterName = printerName;
                    }
                }
            }
            //4. Present the dialog
            if (!doPrompt)
            {
                //Create audit log entry for printing.  PatNum can be 0.
                SecurityLogs.MakeLogEntry(Permissions.Printing, patNum, auditDescription);
                return(true);
            }
            PrintDialog dialog = new PrintDialog();

            //pSet.Collate is true here
            dialog.AllowSomePages  = true;
            dialog.PrinterSettings = pSet;
            dialog.UseEXDialog     = true;
                        #if DEBUG
            //just use defaults
                        #else
            DialogResult result = dialog.ShowDialog();
            //but dialog.PrinterSettings.Collate is false here.  I don't know what triggers the change.
            pSet.Collate = true;                  //force it back to true.
            if (result != DialogResult.OK)
            {
                return(false);
            }
            //if(!dialog.PrinterSettings.IsValid){//not needed since we have already checked each name.
            //pd2.PrinterSettings=printDialog2.PrinterSettings;
            //}
                        #endif
            //Create audit log entry for printing.  PatNum can be 0.
            SecurityLogs.MakeLogEntry(Permissions.Printing, patNum, auditDescription);
            return(true);
        }
示例#17
0
 private static bool SetPrinter(PrinterSettings pSet, PrintSituation printSit, long patNum, string auditDescription)
 {
     #region 1 - Set default printer if available from this computer.
     //pSet will always be new when this function is called.
     //Get the name of the Windows default printer.
     //This method only works when the pSet is still new.
     //string winDefault=pSet.PrinterName;
     //1. If a default printer is set in OD,
     //and it is in the list of installed printers, use it.
     bool    doPrompt      = false;
     Printer printerForSit = Printers.GetForSit(PrintSituation.Default);          //warning: this changes
     string  printerName   = "";
     if (printerForSit != null)
     {
         printerName = printerForSit.PrinterName;
         doPrompt    = printerForSit.DisplayPrompt;
         if (Printers.PrinterIsInstalled(printerName))
         {
             pSet.PrinterName = printerName;
         }
     }
     #endregion 1
     #region 2 - If a printer is set for this situation, and it is in the list of installed printers, use it.
     if (printSit != PrintSituation.Default)
     {
         printerForSit = Printers.GetForSit(printSit);
         printerName   = "";
         if (printerForSit != null)
         {
             printerName = printerForSit.PrinterName;
             doPrompt    = printerForSit.DisplayPrompt;
             if (Printers.PrinterIsInstalled(printerName))
             {
                 pSet.PrinterName = printerName;
             }
         }
     }
     #endregion 2
     #region 3 - Present the dialog
     if (doPrompt)
     {
         PrintDialog dialog = new PrintDialog();
         dialog.AllowSomePages  = true;
         dialog.PrinterSettings = pSet;
         dialog.UseEXDialog     = true;
         DialogResult result = dialog.ShowDialog();
         pSet.Collate = true;
         if (result != DialogResult.OK)
         {
             return(false);
         }
         if (pSet.PrintRange != PrintRange.AllPages && pSet.ToPage < 1)
         {
             //User set the range to not print any pages.
             return(false);
         }
     }
     #endregion 3
     //Create audit log entry for printing.  PatNum can be 0.
     if (!string.IsNullOrEmpty(auditDescription))
     {
         SecurityLogs.MakeLogEntry(Permissions.Printing, patNum, auditDescription);
     }
     return(true);
 }
示例#18
0
        private void butPrint_Click(object sender, System.EventArgs e)
        {
            if (listLetters.SelectedIndex == -1)
            {
                MsgBox.Show(this, "Please select a letter first.");
                return;
            }
            LetterMerge letterCur    = ListForCat[listLetters.SelectedIndex];
            string      templateFile = PrefB.GetString("LetterMergePath") + letterCur.TemplateName;
            string      dataFile     = PrefB.GetString("LetterMergePath") + letterCur.DataFileName;

            if (!File.Exists(templateFile))
            {
                MsgBox.Show(this, "Template file does not exist.");
                return;
            }
            PrintDocument pd = new PrintDocument();

            if (!Printers.SetPrinter(pd, PrintSituation.Default))
            {
                return;
            }
            if (!CreateDataFile(dataFile, letterCur))
            {
                return;
            }
            Word.MailMerge wrdMailMerge;
            //Create an instance of Word.
            Word.Application WrdApp = LetterMerges.WordApp;
            //Open a document.
            Object oName = templateFile;

            wrdDoc = WrdApp.Documents.Open(ref oName, ref oMissing, ref oMissing,
                                           ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                                           ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
            wrdDoc.Select();
            wrdMailMerge = wrdDoc.MailMerge;
            //Attach the data file.
            wrdDoc.MailMerge.OpenDataSource(dataFile, ref oMissing, ref oMissing, ref oMissing,
                                            ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                                            ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
            wrdMailMerge.Destination = Word.WdMailMergeDestination.wdSendToPrinter;
            WrdApp.ActivePrinter     = pd.PrinterSettings.PrinterName;
            wrdMailMerge.Execute(ref oFalse);
            //Close the original form document since just one record.
            wrdDoc.Saved = true;
            wrdDoc.Close(ref oFalse, ref oMissing, ref oMissing);
            //At this point, Word remains open with no documents.
            WrdApp.WindowState = Word.WdWindowState.wdWindowStateMinimize;
            wrdMailMerge       = null;
            wrdDoc             = null;
            Commlog CommlogCur = new Commlog();

            CommlogCur.CommDateTime   = DateTime.Now;
            CommlogCur.CommType       = CommItemType.Misc;
            CommlogCur.Mode_          = CommItemMode.Mail;
            CommlogCur.SentOrReceived = CommSentOrReceived.Sent;
            CommlogCur.PatNum         = PatCur.PatNum;
            CommlogCur.Note           = "Letter sent: " + letterCur.Description + ". ";
            Commlogs.Insert(CommlogCur);
            DialogResult = DialogResult.OK;
        }