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(); }
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(); }