private void butPrint_Click(object sender, System.EventArgs e) { //only visible if sheet==null. if (comboSendStatus.SelectedIndex == (int)RxSendStatus.InElectQueue || comboSendStatus.SelectedIndex == (int)RxSendStatus.SentElect) { //do not change status } else { comboSendStatus.SelectedIndex = (int)RxSendStatus.Printed; } if (!SaveRx()) { return; } SheetDef sheetDef; List <SheetDef> customSheetDefs = SheetDefs.GetCustomForType(SheetTypeEnum.Rx); if (customSheetDefs.Count == 0) { sheetDef = SheetsInternal.GetSheetDef(SheetInternalType.Rx); } else { sheetDef = customSheetDefs[0]; SheetDefs.GetFieldsAndParameters(sheetDef); } sheet = SheetUtil.CreateSheet(sheetDef, PatCur.PatNum); SheetParameter.SetParameter(sheet, "RxNum", RxPatCur.RxNum); SheetFiller.FillFields(sheet); SheetUtil.CalculateHeights(sheet, this.CreateGraphics()); SheetPrinting.PrintRx(sheet, RxPatCur.IsControlled); DialogResult = DialogResult.OK; }
private void butPrint_Click(object sender, System.EventArgs e) { if (PrinterSettings.InstalledPrinters.Count == 0) { MsgBox.Show(this, "Error: No Printers Installed\r\n" + "If you do have a printer installed, restarting the workstation may solve the problem." ); return; } //only visible if sheet==null. if (comboSendStatus.SelectedIndex == (int)RxSendStatus.InElectQueue || comboSendStatus.SelectedIndex == (int)RxSendStatus.SentElect) { //do not change status } else { comboSendStatus.SelectedIndex = (int)RxSendStatus.Printed; } if (!SaveRx()) { return; } //This logic is an exact copy of FormRxManage.butPrintSelect_Click()'s logic when 1 Rx is selected. //If this is updated, that method needs to be updated as well. SheetDef sheetDef = SheetDefs.GetSheetsDefault(SheetTypeEnum.Rx, Clinics.ClinicNum); sheet = SheetUtil.CreateSheet(sheetDef, PatCur.PatNum); SheetParameter.SetParameter(sheet, "RxNum", RxPatCur.RxNum); SheetFiller.FillFields(sheet); SheetUtil.CalculateHeights(sheet); if (!SheetPrinting.PrintRx(sheet, RxPatCur)) { return; } if (RxPatCur.IsNew) { AutomationL.Trigger(AutomationTrigger.RxCreate, new List <string>(), PatCur.PatNum, 0, new List <RxPat>() { RxPatCur }); } DialogResult = DialogResult.OK; }
///<summary>Prints the selected rx's. If one rx is selected, uses single rx sheet. If more than one is selected, uses multirx sheet</summary> private void butPrintSelect_Click(object sender, EventArgs e) { List <RxPat> listSelectRx = new List <RxPat>(); SheetDef sheetDef; Sheet sheet; for (int i = 0; i < gridMain.SelectedIndices.Length; i++) { listSelectRx.Add(_listRx[gridMain.SelectedIndices[i]]); } if (listSelectRx.Count == 0) { MsgBox.Show(this, "At least one prescription must be selected"); return; } if (PrinterSettings.InstalledPrinters.Count == 0) { MsgBox.Show(this, "Error: No Printers Installed\r\n" + "If you do have a printer installed, restarting the workstation may solve the problem." ); return; } if (listSelectRx.Count == 1) //old way of printing one rx //This logic is an exact copy of FormRxEdit.butPrint_Click()'s logic. If this is updated, that method needs to be updated as well. { sheetDef = SheetDefs.GetSheetsDefault(SheetTypeEnum.Rx, Clinics.ClinicNum); sheet = SheetUtil.CreateSheet(sheetDef, _patCur.PatNum); SheetParameter.SetParameter(sheet, "RxNum", listSelectRx[0].RxNum); SheetFiller.FillFields(sheet); SheetUtil.CalculateHeights(sheet); SheetPrinting.PrintRx(sheet, listSelectRx[0]); } else //multiple rx selected //Print batch list of rx { SheetPrinting.PrintMultiRx(listSelectRx); } }