private void butOK_Click(object sender, System.EventArgs e) { //validate user input if (textDate.errorProvider1.GetError(textDate) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (textDate.Text.Length == 0) { MessageBox.Show(Lan.g(this, "Date is required.")); return; } date = PIn.PDate(textDate.Text); if (listProv.SelectedIndices.Count == 0) { MessageBox.Show(Lan.g(this, "You must select at least one provider.")); return; } int[] provNums = new int[listProv.SelectedIndices.Count]; for (int i = 0; i < provNums.Length; i++) { provNums[i] = Providers.List[listProv.SelectedIndices[i]].ProvNum; } Appts = Appointments.GetRouting(date, provNums); if (Appts.Length == 0) { MsgBox.Show(this, "There are no appointments scheduled for that date."); return; } pagesPrinted = 0; pd = new PrintDocument(); pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage); pd.OriginAtMargins = true; pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0); printPreview = new OpenDental.UI.PrintPreview(PrintSituation.Default, pd, Appts.Length); printPreview.ShowDialog(); if (printPreview.DialogResult != DialogResult.OK) { return; } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { //validate user input if (textDate.errorProvider1.GetError(textDate) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (textDate.Text.Length == 0) { MessageBox.Show(Lan.g(this, "Date is required.")); return; } date = PIn.Date(textDate.Text); if (listProv.SelectedIndices.Count == 0) { MessageBox.Show(Lan.g(this, "You must select at least one provider.")); return; } List <long> provNums = new List <long>(); for (int i = 0; i < listProv.SelectedIndices.Count; i++) { provNums.Add(ProviderC.ListShort[listProv.SelectedIndices[i]].ProvNum); } List <long> aptNums = Appointments.GetRouting(date, provNums); SheetDef sheetDef; List <SheetDef> customSheetDefs = SheetDefs.GetCustomForType(SheetTypeEnum.RoutingSlip); if (customSheetDefs.Count == 0) { sheetDef = SheetsInternal.GetSheetDef(SheetInternalType.RoutingSlip); } else { sheetDef = customSheetDefs[0]; //Instead of doing this, we could give the user a list to pick from on this form. //SheetDefs.GetFieldsAndParameters(sheetDef); } PrintRoutingSlips(aptNums, sheetDef.SheetDefNum); DialogResult = DialogResult.OK; }