示例#1
0
 private void butLabels_Click(object sender, System.EventArgs e)
 {
     if (table.Rows.Count == 0)
     {
         MessageBox.Show(Lan.g(this, "There are no appointments in the list.  Must have at least one to print."));
         return;
     }
     if (grid.SelectedIndices.Length == 0)
     {
         for (int i = 0; i < table.Rows.Count; i++)
         {
             grid.SetSelected(i, true);
         }
     }
     int[] aptNums = new int[grid.SelectedIndices.Length];
     for (int i = 0; i < aptNums.Length; i++)
     {
         aptNums[i] = PIn.PInt(table.Rows[grid.SelectedIndices[i]]["AptNum"].ToString());
     }
     AddrTable       = Appointments.GetAddrTable(aptNums);
     pagesPrinted    = 0;
     patientsPrinted = 0;
     pd                             = new PrintDocument();
     pd.PrintPage                  += new PrintPageEventHandler(this.pdLabels_PrintPage);
     pd.OriginAtMargins             = true;
     pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
     printPreview                   = new OpenDental.UI.PrintPreview(PrintSituation.LabelSheet
                                                                     , pd, (int)Math.Ceiling((double)AddrTable.Rows.Count / 30));
     printPreview.ShowDialog();
 }
示例#2
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
 }
 private void butLabels_Click(object sender, System.EventArgs e)
 {
     if (gridMain.Rows.Count < 1)
     {
         MessageBox.Show(Lan.g(this, "There are no Patients in the Recall table.  Must have at least one to print."));
         return;
     }
     if (gridMain.SelectedIndices.Length == 0)
     {
         gridMain.SetSelected(true);
     }
     int[] PatNums;
     PatNums = new int[gridMain.SelectedIndices.Length];
     for (int i = 0; i < PatNums.Length; i++)
     {
         PatNums[i] = PIn.PInt(table.Rows[gridMain.SelectedIndices[i]]["PatNum"].ToString());
         //((RecallItem)gridMain.Rows[gridMain.SelectedIndices[i]].Tag).PatNum;
     }
     AddrTable       = Recalls.GetAddrTable(PatNums, false);   //can never group by family because there's no room to display the list.
     pagesPrinted    = 0;
     patientsPrinted = 0;
     pd                             = new PrintDocument();
     pd.PrintPage                  += new PrintPageEventHandler(this.pdLabels_PrintPage);
     pd.OriginAtMargins             = true;
     pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
     printPreview                   = new OpenDental.UI.PrintPreview(PrintSituation.LabelSheet
                                                                     , pd, (int)Math.Ceiling((double)AddrTable.Rows.Count / 30));
     //printPreview.Document=pd;
     //printPreview.TotalPages=;
     printPreview.ShowDialog();
 }
示例#4
0
 private void but3A_Click(object sender,EventArgs e)
 {
     if(!DateIsValid()) {
         return;
     }
     Cursor.Current=Cursors.WaitCursor;
     PrintDocument pd=new PrintDocument();
     pd.PrintPage+=new PrintPageEventHandler(this.pdAgeGender_PrintPage);
     PrintPreview printPreview=new PrintPreview(PrintSituation.Default,pd,1);
     printPreview.ShowDialog();
 }
        private void butPostcards_Click(object sender, System.EventArgs e)
        {
            if (gridMain.Rows.Count < 1)
            {
                MessageBox.Show(Lan.g(this, "There are no Patients in the Recall table.  Must have at least one to print."));
                return;
            }
            if (gridMain.SelectedIndices.Length == 0)
            {
                gridMain.SetSelected(true);
            }
            int[] PatNums;
            PatNums = new int[gridMain.SelectedIndices.Length];
            for (int i = 0; i < PatNums.Length; i++)
            {
                PatNums[i] = PIn.PInt(table.Rows[gridMain.SelectedIndices[i]]["PatNum"].ToString());
                //((RecallItem)gridMain.Rows[gridMain.SelectedIndices[i]].Tag).PatNum;
            }
            if (MsgBox.Show(this, true, "Make a commlog entry of 'postcard sent' for all of the selected patients?"))
            {
                for (int i = 0; i < PatNums.Length; i++)
                {
                    //make commlog entries for each patient
                    Commlogs.InsertForRecallPostcard(PatNums[i]);
                }
            }
            AddrTable       = Recalls.GetAddrTable(PatNums, checkGroupFamilies.Checked);
            pagesPrinted    = 0;
            patientsPrinted = 0;
            pd                             = new PrintDocument();
            pd.PrintPage                  += new PrintPageEventHandler(this.pdCards_PrintPage);
            pd.OriginAtMargins             = true;
            pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
            if (PrefB.GetInt("RecallPostcardsPerSheet") == 1)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("Postcard", 400, 600);
                pd.DefaultPageSettings.Landscape = true;
            }
            else if (PrefB.GetInt("RecallPostcardsPerSheet") == 3)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("Postcard", 850, 1100);
            }
            else             //4
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("Postcard", 850, 1100);
                pd.DefaultPageSettings.Landscape = true;
            }
            int totalPages = (int)Math.Ceiling((double)AddrTable.Rows.Count / (double)PrefB.GetInt("RecallPostcardsPerSheet"));

            printPreview = new OpenDental.UI.PrintPreview(PrintSituation.Postcard, pd, totalPages);
            printPreview.ShowDialog();
        }
示例#6
0
        ///<summary>Surround with try/catch.</summary>
        public static void PrintBatch(List <Sheet> sheetBatch)
        {
            //currently no validation for parameters in a batch because of the way it was created.
            //could validate field names here later.
            SheetList     = sheetBatch;
            sheetsPrinted = 0;
            PrintDocument pd = new PrintDocument();

            pd.OriginAtMargins = true;
            pd.PrintPage      += new PrintPageEventHandler(pd_PrintPage);
            if (sheetBatch[0].Width > 0 && sheetBatch[0].Height > 0)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("Default", sheetBatch[0].Width, sheetBatch[0].Height);
            }
            PrintSituation sit = PrintSituation.Default;

            pd.DefaultPageSettings.Landscape = sheetBatch[0].IsLandscape;
            switch (sheetBatch[0].SheetType)
            {
            case SheetTypeEnum.LabelPatient:
            case SheetTypeEnum.LabelCarrier:
            case SheetTypeEnum.LabelReferral:
                sit = PrintSituation.LabelSingle;
                break;

            case SheetTypeEnum.ReferralSlip:
                sit = PrintSituation.Default;
                break;
            }
            //later: add a check here for print preview.
                        #if DEBUG
            pd.DefaultPageSettings.Margins = new Margins(20, 20, 0, 0);
            UI.PrintPreview printPreview = new UI.PrintPreview(sit, pd, SheetList.Count);
            printPreview.ShowDialog();
                        #else
            try {
                if (!PrinterL.SetPrinter(pd, sit))
                {
                    return;
                }
                pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
                pd.Print();
            }
            catch (Exception ex) {
                throw ex;
                //MessageBox.Show(Lan.g("Sheet","Printer not available"));
            }
                        #endif
        }
示例#7
0
        private void butLabelPreview_Click(object sender, EventArgs e)
        {
            if (gridMain.SelectedIndices.Length == 0)
            {
                MsgBox.Show(this, "Please select patient(s) first.");
                return;
            }
            pagesPrinted    = 0;
            patientsPrinted = 0;
            pd                             = new PrintDocument();
            pd.PrintPage                  += new PrintPageEventHandler(this.pdLabels_PrintPage);
            pd.OriginAtMargins             = true;
            pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
            PrintPreview printPreview = new OpenDental.UI.PrintPreview(PrintSituation.LabelSheet
                                                                       , pd, (int)Math.Ceiling((double)gridMain.SelectedIndices.Length / 30));

            printPreview.ShowDialog();
        }
示例#8
0
 private void butPostcards_Click(object sender, System.EventArgs e)
 {
     if (table.Rows.Count == 0)
     {
         MessageBox.Show(Lan.g(this, "There are no appointments in the list.  Must have at least one to print."));
         return;
     }
     if (grid.SelectedIndices.Length == 0)
     {
         for (int i = 0; i < table.Rows.Count; i++)
         {
             grid.SetSelected(i, true);
         }
     }
     int[] aptNums = new int[grid.SelectedIndices.Length];
     for (int i = 0; i < aptNums.Length; i++)
     {
         aptNums[i] = PIn.PInt(table.Rows[grid.SelectedIndices[i]]["AptNum"].ToString());
     }
     AddrTable       = Appointments.GetAddrTable(aptNums);
     pagesPrinted    = 0;
     patientsPrinted = 0;
     pd                             = new PrintDocument();
     pd.PrintPage                  += new PrintPageEventHandler(this.pdCards_PrintPage);
     pd.OriginAtMargins             = true;
     pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
     if (PrefB.GetInt("RecallPostcardsPerSheet") == 1)
     {
         pd.DefaultPageSettings.PaperSize = new PaperSize("Postcard", 400, 600);
         pd.DefaultPageSettings.Landscape = true;
     }
     else if (PrefB.GetInt("RecallPostcardsPerSheet") == 3)
     {
         pd.DefaultPageSettings.PaperSize = new PaperSize("Postcard", 850, 1100);
     }
     else             //4
     {
         pd.DefaultPageSettings.PaperSize = new PaperSize("Postcard", 850, 1100);
         pd.DefaultPageSettings.Landscape = true;
     }
     printPreview = new OpenDental.UI.PrintPreview(PrintSituation.Postcard, pd,
                                                   (int)Math.Ceiling((double)AddrTable.Rows.Count / (double)PrefB.GetInt("RecallPostcardsPerSheet")));
     printPreview.ShowDialog();
 }
示例#9
0
        private void butPostcards_Click(object sender, EventArgs e)
        {
            if (errorProvider1.GetError(textDateFrom) != "" ||
                errorProvider1.GetError(textDateTo) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            DateTime dateFrom = DateTime.ParseExact(textDateFrom.Text, Lan.g(this, "MM/dd"), CultureInfo.CurrentCulture);
            DateTime dateTo   = DateTime.ParseExact(textDateTo.Text, Lan.g(this, "MM/dd"), CultureInfo.CurrentCulture);

            //DateTime dateFrom=PIn.PDate(textDateFrom.Text);
            //DateTime dateTo=PIn.PDate(textDateTo.Text);
            if (dateTo < dateFrom)
            {
                MsgBox.Show(this, "To date cannot be before From date.");
                return;
            }
            BirthdayTable   = Patients.GetBirthdayList(dateFrom, dateTo);
            pagesPrinted    = 0;
            patientsPrinted = 0;
            pd                             = new PrintDocument();
            pd.PrintPage                  += new PrintPageEventHandler(this.pdCards_PrintPage);
            pd.OriginAtMargins             = true;
            pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
            if (PrefC.GetLong(PrefName.RecallPostcardsPerSheet) == 1)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("Postcard", 400, 600);
                pd.DefaultPageSettings.Landscape = true;
            }
            else if (PrefC.GetLong(PrefName.RecallPostcardsPerSheet) == 3)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("Postcard", 850, 1100);
            }
            else              //4
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("Postcard", 850, 1100);
                pd.DefaultPageSettings.Landscape = true;
            }
            printPreview = new OpenDental.UI.PrintPreview(PrintSituation.Postcard, pd,
                                                          (int)Math.Ceiling((double)BirthdayTable.Rows.Count / (double)PrefC.GetLong(PrefName.RecallPostcardsPerSheet)));
            printPreview.ShowDialog();
        }
示例#10
0
 ///<Summary></Summary>
 public static void Print(Sheet sheet,int copies,bool isRxControlled)
 {
     //parameter null check moved to SheetFiller.
     //could validate field names here later.
     SheetList=new List<Sheet>();
     for(int i=0;i<copies;i++){
         SheetList.Add(sheet.Copy());
     }
     sheetsPrinted=0;
     PrintDocument pd=new PrintDocument();
     pd.OriginAtMargins=true;
     pd.PrintPage+=new PrintPageEventHandler(pd_PrintPage);
     if(pd.DefaultPageSettings.PrintableArea.Width==0) {
         //prevents bug in some printers that do not specify paper size
         pd.DefaultPageSettings.PaperSize=new PaperSize("paper",850,1100);
     }
     if(sheet.SheetType==SheetTypeEnum.LabelPatient
         || sheet.SheetType==SheetTypeEnum.LabelCarrier
         || sheet.SheetType==SheetTypeEnum.LabelAppointment
         || sheet.SheetType==SheetTypeEnum.LabelReferral)
     {//I think this causes problems for non-label sheet types.
         if(sheet.Width>0 && sheet.Height>0) {
             pd.DefaultPageSettings.PaperSize=new PaperSize("Default",sheet.Width,sheet.Height);
         }
     }
     PrintSituation sit=PrintSituation.Default;
     pd.DefaultPageSettings.Landscape=sheet.IsLandscape;
     switch(sheet.SheetType){
         case SheetTypeEnum.LabelPatient:
         case SheetTypeEnum.LabelCarrier:
         case SheetTypeEnum.LabelReferral:
         case SheetTypeEnum.LabelAppointment:
             sit=PrintSituation.LabelSingle;
             break;
         case SheetTypeEnum.ReferralSlip:
             sit=PrintSituation.Default;
             break;
         case SheetTypeEnum.Rx:
             if(isRxControlled){
                 sit=PrintSituation.RxControlled;
             }
             else{
                 sit=PrintSituation.Rx;
             }
             break;
     }
     //later: add a check here for print preview.
     #if DEBUG
         pd.DefaultPageSettings.Margins=new Margins(20,20,0,0);
         UI.PrintPreview printPreview=new UI.PrintPreview(sit,pd,SheetList.Count);
         printPreview.ShowDialog();
     #else
         try {
             if(!PrinterL.SetPrinter(pd,sit)) {
                 return;
             }
             pd.DefaultPageSettings.Margins=new Margins(0,0,0,0);
             pd.Print();
         }
         catch(Exception ex){
             throw ex;
             //MessageBox.Show(Lan.g("Sheet","Printer not available"));
         }
     #endif
 }
示例#11
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 DEBUG
     PrintPreview printPreview=new PrintPreview(PrintSituation.Default,pd,1);
     printPreview.ShowDialog();
     #else
         try {
             if(PrinterL.SetPrinter(pd,PrintSituation.Default)) {
                 pd.Print();
             }
         }
         catch {
             MessageBox.Show(Lan.g(this,"Printer not available"));
         }
     #endif
 }
示例#12
0
 private void buildLabels()
 {
     if(AddrTable.Rows.Count > 0) {
         if(iLabelStart > 0) {
             addBlankLabels();
         }
         pagesPrinted = 0;
         labelsPrinted = 0;
         pd = new PrintDocument();
         pd.PrintPage += new PrintPageEventHandler(this.pdLabels_PrintPage);
         pd.OriginAtMargins = true;
         pd.DefaultPageSettings.Margins = new Margins(0,0,0,0);
         printPreview = new OpenDental.UI.PrintPreview(PrintSituation.LabelSheet
                 ,pd,(int)Math.Ceiling((double)AddrTable.Rows.Count / 30));
         printPreview.ShowDialog();
     }
     else {
         MessageBox.Show("No Labels to Print for Selected Criteria");
     }
 }
示例#13
0
 ///<summary>Changes made to printing recall postcards need to be made in FormConfirmList.butPostcards_Click() as well.</summary>
 private void butPostcards_Click(object sender,System.EventArgs e)
 {
     if(gridMain.Rows.Count < 1) {
         MessageBox.Show(Lan.g(this,"There are no Patients in the Recall table.  Must have at least one to print."));
         return;
     }
     if(PrefC.GetLong(PrefName.RecallStatusMailed)==0) {
         MsgBox.Show(this,"You need to set a status first in the Recall Setup window.");
         return;
     }
     if(gridMain.SelectedIndices.Length==0) {
         ContactMethod cmeth;
         for(int i=0;i<table.Rows.Count;i++) {
             //if(table.Rows[i]["status"].ToString()!=""){//we only want rows without a status
             //	continue;
             //}
             cmeth=(ContactMethod)PIn.Long(table.Rows[i]["PreferRecallMethod"].ToString());
             if(cmeth!=ContactMethod.Mail && cmeth!=ContactMethod.None) {
                 continue;
             }
             gridMain.SetSelected(i,true);
         }
         if(gridMain.SelectedIndices.Length==0) {
             MsgBox.Show(this,"No patients of mail type.");
             return;
         }
         if(!MsgBox.Show(this,MsgBoxButtons.OKCancel,"Preview postcards for all of the selected patients?")) {
             return;
         }
     }
     List<long> recallNums=new List<long>();
     for(int i=0;i<gridMain.SelectedIndices.Length;i++) {
         recallNums.Add(PIn.Long(table.Rows[gridMain.SelectedIndices[i]]["RecallNum"].ToString()));
     }
     RecallListSort sortBy=(RecallListSort)comboSort.SelectedIndex;
     AddrTable=Recalls.GetAddrTable(recallNums,checkGroupFamilies.Checked,sortBy);
     pagesPrinted=0;
     patientsPrinted=0;
     pd=new PrintDocument();
     pd.PrintPage+=new PrintPageEventHandler(this.pdCards_PrintPage);
     pd.OriginAtMargins=true;
     pd.DefaultPageSettings.Margins=new Margins(0,0,0,0);
     if(PrefC.GetLong(PrefName.RecallPostcardsPerSheet)==1) {
         pd.DefaultPageSettings.PaperSize=new PaperSize("Postcard",500,700);
         pd.DefaultPageSettings.Landscape=true;
     }
     else if(PrefC.GetLong(PrefName.RecallPostcardsPerSheet)==3) {
         pd.DefaultPageSettings.PaperSize=new PaperSize("Postcard",850,1100);
     }
     else {//4
         pd.DefaultPageSettings.PaperSize=new PaperSize("Postcard",850,1100);
         pd.DefaultPageSettings.Landscape=true;
     }
     int totalPages=(int)Math.Ceiling((double)AddrTable.Rows.Count/(double)PrefC.GetLong(PrefName.RecallPostcardsPerSheet));
     printPreview=new OpenDental.UI.PrintPreview(PrintSituation.Postcard,pd,totalPages);
     printPreview.ShowDialog();
     if(MsgBox.Show(this,MsgBoxButtons.YesNo,"Did all the postcards finish printing correctly?  Statuses will be changed and commlog entries made for all of the selected patients.  Click Yes only if postcards printed successfully.")) {
         Cursor=Cursors.WaitCursor;
         for(int i=0;i<gridMain.SelectedIndices.Length;i++) {
             //make commlog entries for each patient
             Commlogs.InsertForRecall(PIn.Long(table.Rows[gridMain.SelectedIndices[i]]["PatNum"].ToString()),CommItemMode.Mail,
                 PIn.Int(table.Rows[gridMain.SelectedIndices[i]]["numberOfReminders"].ToString()),PrefC.GetLong(PrefName.RecallStatusMailed));
         }
         for(int i=0;i<gridMain.SelectedIndices.Length;i++) {
             Recalls.UpdateStatus(
                 PIn.Long(table.Rows[gridMain.SelectedIndices[i]]["RecallNum"].ToString()),PrefC.GetLong(PrefName.RecallStatusMailed));
         }
     }
     FillMain(null);
     Cursor=Cursors.Default;
 }
示例#14
0
        ///<Summary></Summary>
        public static void Print(Sheet sheet, int copies, bool isRxControlled)
        {
            //parameter null check moved to SheetFiller.
            //could validate field names here later.
            SheetList = new List <Sheet>();
            for (int i = 0; i < copies; i++)
            {
                SheetList.Add(sheet.Copy());
            }
            sheetsPrinted = 0;
            PrintDocument pd = new PrintDocument();

            pd.OriginAtMargins = true;
            pd.PrintPage      += new PrintPageEventHandler(pd_PrintPage);
            if (pd.DefaultPageSettings.PrintableArea.Width == 0)
            {
                //prevents bug in some printers that do not specify paper size
                pd.DefaultPageSettings.PaperSize = new PaperSize("paper", 850, 1100);
            }
            if (sheet.SheetType == SheetTypeEnum.LabelPatient ||
                sheet.SheetType == SheetTypeEnum.LabelCarrier ||
                sheet.SheetType == SheetTypeEnum.LabelAppointment ||
                sheet.SheetType == SheetTypeEnum.LabelReferral)
            {            //I think this causes problems for non-label sheet types.
                if (sheet.Width > 0 && sheet.Height > 0)
                {
                    pd.DefaultPageSettings.PaperSize = new PaperSize("Default", sheet.Width, sheet.Height);
                }
            }
            PrintSituation sit = PrintSituation.Default;

            pd.DefaultPageSettings.Landscape = sheet.IsLandscape;
            switch (sheet.SheetType)
            {
            case SheetTypeEnum.LabelPatient:
            case SheetTypeEnum.LabelCarrier:
            case SheetTypeEnum.LabelReferral:
            case SheetTypeEnum.LabelAppointment:
                sit = PrintSituation.LabelSingle;
                break;

            case SheetTypeEnum.ReferralSlip:
                sit = PrintSituation.Default;
                break;

            case SheetTypeEnum.Rx:
                if (isRxControlled)
                {
                    sit = PrintSituation.RxControlled;
                }
                else
                {
                    sit = PrintSituation.Rx;
                }
                break;
            }
            //later: add a check here for print preview.
                        #if DEBUG
            pd.DefaultPageSettings.Margins = new Margins(20, 20, 0, 0);
            UI.PrintPreview printPreview = new UI.PrintPreview(sit, pd, SheetList.Count);
            printPreview.ShowDialog();
                        #else
            try {
                if (!PrinterL.SetPrinter(pd, sit))
                {
                    return;
                }
                pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
                pd.Print();
            }
            catch (Exception ex) {
                throw ex;
                //MessageBox.Show(Lan.g("Sheet","Printer not available"));
            }
                        #endif
        }
示例#15
0
 private void butLabels_Click(object sender, System.EventArgs e)
 {
     if(gridMain.Rows.Count < 1){
     MessageBox.Show(Lan.g(this,"There are no Patients in the Recall table.  Must have at least one to print."));
     return;
       }
     if(PrefC.GetLong(PrefName.RecallStatusMailed)==0){
         MsgBox.Show(this,"You need to set a status first in the Recall Setup window.");
         return;
     }
     if(gridMain.SelectedIndices.Length==0){
         ContactMethod cmeth;
         for(int i=0;i<table.Rows.Count;i++){
             if(table.Rows[i]["status"].ToString()!=""){//we only want rows without a status
                 continue;
             }
             cmeth=(ContactMethod)PIn.Long(table.Rows[i]["PreferRecallMethod"].ToString());
             if(cmeth!=ContactMethod.Mail && cmeth!=ContactMethod.None){
                 continue;
             }
             gridMain.SetSelected(i,true);
         }
         if(gridMain.SelectedIndices.Length==0){
             MsgBox.Show(this,"No patients of mail type.");
             return;
         }
         if(!MsgBox.Show(this,true,"Preview labels for all of the selected patients?")) {
             return;
         }
     }
     List<long> recallNums=new List<long>();
       for(int i=0;i<gridMain.SelectedIndices.Length;i++){
     recallNums.Add(PIn.Long(table.Rows[gridMain.SelectedIndices[i]]["RecallNum"].ToString()));
       }
     RecallListSort sortBy=(RecallListSort)comboSort.SelectedIndex;
     AddrTable=Recalls.GetAddrTable(recallNums,checkGroupFamilies.Checked,sortBy);
     pagesPrinted=0;
     patientsPrinted=0;
     pd=new PrintDocument();
     pd.PrintPage+=new PrintPageEventHandler(this.pdLabels_PrintPage);
     pd.OriginAtMargins=true;
     pd.DefaultPageSettings.Margins=new Margins(0,0,0,0);
     printPreview=new OpenDental.UI.PrintPreview(PrintSituation.LabelSheet
         ,pd,(int)Math.Ceiling((double)AddrTable.Rows.Count/30));
     //printPreview.Document=pd;
     //printPreview.TotalPages=;
     printPreview.ShowDialog();
     if(MsgBox.Show(this,MsgBoxButtons.YesNo,"Change statuses and make commlog entries for all of the selected patients?")) {
         Cursor=Cursors.WaitCursor;
         for(int i=0;i<gridMain.SelectedIndices.Length;i++) {
             //make commlog entries for each patient
             Commlogs.InsertForRecall(PIn.Long(table.Rows[gridMain.SelectedIndices[i]]["PatNum"].ToString()),CommItemMode.Mail,
                 PIn.Int(table.Rows[gridMain.SelectedIndices[i]]["numberOfReminders"].ToString()),PrefC.GetLong(PrefName.RecallStatusMailed));
         }
         for(int i=0;i<gridMain.SelectedIndices.Length;i++) {
             Recalls.UpdateStatus(
                 PIn.Long(table.Rows[gridMain.SelectedIndices[i]]["RecallNum"].ToString()),PrefC.GetLong(PrefName.RecallStatusMailed));
         }
     }
     FillMain(null);
     Cursor=Cursors.Default;
 }
示例#16
0
 private void butPostcards_Click(object sender,EventArgs e)
 {
     if(errorProvider1.GetError(textDateFrom) != ""
         || errorProvider1.GetError(textDateTo) != "") {
         MsgBox.Show(this,"Please fix data entry errors first.");
         return;
     }
     DateTime dateFrom=DateTime.ParseExact(textDateFrom.Text,Lan.g(this,"MM/dd"),CultureInfo.CurrentCulture);
     DateTime dateTo=DateTime.ParseExact(textDateTo.Text,Lan.g(this,"MM/dd"),CultureInfo.CurrentCulture);
     //DateTime dateFrom=PIn.PDate(textDateFrom.Text);
     //DateTime dateTo=PIn.PDate(textDateTo.Text);
     if(dateTo < dateFrom) {
         MsgBox.Show(this,"To date cannot be before From date.");
         return;
     }
     BirthdayTable=Patients.GetBirthdayList(dateFrom,dateTo);
     pagesPrinted=0;
     patientsPrinted=0;
     pd=new PrintDocument();
     pd.PrintPage+=new PrintPageEventHandler(this.pdCards_PrintPage);
     pd.OriginAtMargins=true;
     pd.DefaultPageSettings.Margins=new Margins(0,0,0,0);
     if(PrefC.GetLong(PrefName.RecallPostcardsPerSheet)==1) {
         pd.DefaultPageSettings.PaperSize=new PaperSize("Postcard",400,600);
         pd.DefaultPageSettings.Landscape=true;
     }
     else if(PrefC.GetLong(PrefName.RecallPostcardsPerSheet)==3) {
         pd.DefaultPageSettings.PaperSize=new PaperSize("Postcard",850,1100);
     }
     else {//4
         pd.DefaultPageSettings.PaperSize=new PaperSize("Postcard",850,1100);
         pd.DefaultPageSettings.Landscape=true;
     }
     printPreview=new OpenDental.UI.PrintPreview(PrintSituation.Postcard,pd,
         (int)Math.Ceiling((double)BirthdayTable.Rows.Count/(double)PrefC.GetLong(PrefName.RecallPostcardsPerSheet)));
     printPreview.ShowDialog();
 }
示例#17
0
 private void butLabelPreview_Click(object sender,EventArgs e)
 {
     if(gridMain.SelectedIndices.Length==0){
         MsgBox.Show(this,"Please select patient(s) first.");
     return;
     }
     pagesPrinted=0;
     patientsPrinted=0;
     pd=new PrintDocument();
     pd.PrintPage+=new PrintPageEventHandler(this.pdLabels_PrintPage);
     pd.OriginAtMargins=true;
     pd.DefaultPageSettings.Margins=new Margins(0,0,0,0);
     PrintPreview printPreview=new OpenDental.UI.PrintPreview(PrintSituation.LabelSheet
       ,pd,(int)Math.Ceiling((double)gridMain.SelectedIndices.Length/30));
     printPreview.ShowDialog();
 }
示例#18
0
 ///<summary>Changes made to printing confirmation postcards need to be made in FormRecallList.butPostcards_Click() as well.</summary>
 private void butPostcards_Click(object sender,System.EventArgs e)
 {
     if(table.Rows.Count==0) {
         MessageBox.Show(Lan.g(this,"There are no appointments in the list.  Must have at least one to print."));
         return;
     }
     if(grid.SelectedIndices.Length==0) {
         for(int i=0;i<table.Rows.Count;i++) {
             grid.SetSelected(i,true);
         }
     }
     List<long> aptNums=new List<long>();
     for(int i=0;i<grid.SelectedIndices.Length;i++) {
         aptNums.Add(PIn.Long(table.Rows[grid.SelectedIndices[i]]["AptNum"].ToString()));
     }
     AddrTable=Appointments.GetAddrTable(aptNums);
     pagesPrinted=0;
     patientsPrinted=0;
     pd=new PrintDocument();
     pd.PrintPage+=new PrintPageEventHandler(this.pdCards_PrintPage);
     pd.OriginAtMargins=true;
     pd.DefaultPageSettings.Margins=new Margins(0,0,0,0);
     if(PrefC.GetLong(PrefName.RecallPostcardsPerSheet)==1) {
         pd.DefaultPageSettings.PaperSize=new PaperSize("Postcard",500,700);
         pd.DefaultPageSettings.Landscape=true;
     }
     else if(PrefC.GetLong(PrefName.RecallPostcardsPerSheet)==3) {
         pd.DefaultPageSettings.PaperSize=new PaperSize("Postcard",850,1100);
     }
     else {//4
         pd.DefaultPageSettings.PaperSize=new PaperSize("Postcard",850,1100);
         pd.DefaultPageSettings.Landscape=true;
     }
     printPreview=new OpenDental.UI.PrintPreview(PrintSituation.Postcard,pd,
         (int)Math.Ceiling((double)AddrTable.Rows.Count/(double)PrefC.GetLong(PrefName.RecallPostcardsPerSheet)));
     printPreview.ShowDialog();
 }
示例#19
0
 private void butLabels_Click(object sender, System.EventArgs e)
 {
     if(table.Rows.Count==0){
     MessageBox.Show(Lan.g(this,"There are no appointments in the list.  Must have at least one to print."));
     return;
       }
     if(grid.SelectedIndices.Length==0){
         for(int i=0;i<table.Rows.Count;i++){
             grid.SetSelected(i,true);
         }
     }
     List<long> aptNums=new List<long>();
     for(int i=0;i<grid.SelectedIndices.Length;i++) {
     aptNums.Add(PIn.Long(table.Rows[grid.SelectedIndices[i]]["AptNum"].ToString()));
       }
     AddrTable=Appointments.GetAddrTable(aptNums);
     pagesPrinted=0;
     patientsPrinted=0;
     pd=new PrintDocument();
     pd.PrintPage+=new PrintPageEventHandler(this.pdLabels_PrintPage);
     pd.OriginAtMargins=true;
     pd.DefaultPageSettings.Margins=new Margins(0,0,0,0);
     printPreview=new OpenDental.UI.PrintPreview(PrintSituation.LabelSheet
         ,pd,(int)Math.Ceiling((double)AddrTable.Rows.Count/30));
     printPreview.ShowDialog();
 }
示例#20
0
 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;
     pd.DefaultPageSettings.Landscape=true;
     if(pd.DefaultPageSettings.PrintableArea.Height==0) {
         pd.DefaultPageSettings.PaperSize=new PaperSize("default",850,1100);
     }
     headingPrinted=false;
     #if DEBUG
     PrintPreview printPreview=new PrintPreview(PrintSituation.Default,pd,1);
     printPreview.ShowDialog();
     #else
         try {
             if(PrinterL.SetPrinter(pd,PrintSituation.Default)) {
                 pd.Print();
             }
         }
         catch {
             MessageBox.Show(Lan.g(this,"Printer not available"));
         }
     #endif
 }
示例#21
0
 ///<summary>Surround with try/catch.</summary>
 public static void PrintBatch(List<Sheet> sheetBatch)
 {
     //currently no validation for parameters in a batch because of the way it was created.
     //could validate field names here later.
     SheetList=sheetBatch;
     sheetsPrinted=0;
     PrintDocument pd=new PrintDocument();
     pd.OriginAtMargins=true;
     pd.PrintPage+=new PrintPageEventHandler(pd_PrintPage);
     if(sheetBatch[0].Width>0 && sheetBatch[0].Height>0){
         pd.DefaultPageSettings.PaperSize=new PaperSize("Default",sheetBatch[0].Width,sheetBatch[0].Height);
     }
     PrintSituation sit=PrintSituation.Default;
     pd.DefaultPageSettings.Landscape=sheetBatch[0].IsLandscape;
     switch(sheetBatch[0].SheetType){
         case SheetTypeEnum.LabelPatient:
         case SheetTypeEnum.LabelCarrier:
         case SheetTypeEnum.LabelReferral:
             sit=PrintSituation.LabelSingle;
             break;
         case SheetTypeEnum.ReferralSlip:
             sit=PrintSituation.Default;
             break;
     }
     //later: add a check here for print preview.
     #if DEBUG
         pd.DefaultPageSettings.Margins=new Margins(20,20,0,0);
         UI.PrintPreview printPreview=new UI.PrintPreview(sit,pd,SheetList.Count);
         printPreview.ShowDialog();
     #else
         try {
             if(!PrinterL.SetPrinter(pd,sit)) {
                 return;
             }
             pd.DefaultPageSettings.Margins=new Margins(0,0,0,0);
             pd.Print();
         }
         catch(Exception ex){
             throw ex;
             //MessageBox.Show(Lan.g("Sheet","Printer not available"));
         }
     #endif
 }