public static void PrintWpfPreview(FrameworkElement element) { string printFileName = "print_preview.xps"; if (File.Exists(printFileName)) { File.Delete(printFileName); } //System.Printing.PrintDocumentImageableArea ia = null; using XpsDocument doc = new XpsDocument(printFileName, FileAccess.ReadWrite); XpsDocumentWriter writer = XpsDocument.CreateXpsDocumentWriter(doc); SerializerWriterCollator outputDocument = writer.CreateVisualsCollator(); outputDocument.BeginBatchWrite(); outputDocument.Write(element); outputDocument.EndBatchWrite(); FixedDocumentSequence preview = doc.GetFixedDocumentSequence(); DocumentPaginator paginator = preview.DocumentPaginator; preview.DocumentPaginator.PageSize = new Size(200, 100); var a = preview.DocumentPaginator.PageCount; PrintWindow printWindow = new PrintWindow(preview); printWindow.Show(); doc.Close(); writer = null; outputDocument = null; }
private void btnPrintWindow_Click(object sender, RoutedEventArgs e) { PrintWindow print = new PrintWindow(); print.Show(); this.Hide(); }
private async void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if ((e.ColumnIndex == 7) && (e.RowIndex > -1)) { int id_doc = Convert.ToInt32(dataGridView1[2, e.RowIndex].Value); DateTime date = Convert.ToDateTime(dataGridView1[1, e.RowIndex].Value); //Вызов сервиса печати талона byte[] byte_array = null; getTalonResponse response = await Program.patient.getTalonAsync(date, id_doc, number_polis); byte_array = response.Body.getTalonResult; if (byte_array != null) { File.WriteAllBytes(@"C:\Temp\temp.pdf", byte_array); PrintWindow pw = new PrintWindow(); pw.webBrowser1.Navigate(@"C:\Temp\temp.pdf"); pw.Show(); } else { MessageBox.Show("Ошибка!"); } } }
protected void OnbtnPrint_Click(object sender, DirectEventArgs e) { string floor, timetype, area; floor = Common.GetComboBoxValue(cboFLOOR); if (floor == "") { floor = sFLOOR.Text; } area = Common.GetComboBoxValue(cboArea); if (area == "") { area = sAREA.Text; } timetype = Common.GetComboBoxValue(cboTIME); if (timetype == "") { timetype = sTIME.Text; } else { sTIME.Text = timetype; } PrintWindow.Show(); PrintWindow.Loader.SuspendScripting(); PrintWindow.Loader.Url = "../report/Report_Dialysis_h.aspx?_REPORT_NAME=weeksch" + "&_REPORT_sQM=" + sFLOOR.Text + "&_REPORT_P=" + timetype; PrintWindow.Loader.DisableCaching = true; PrintWindow.LoadContent(); }
private void OnExecuteFilePrintCommand() { FlowDocument flowDocument = new FlowDocument(); Image image = new Image() { Source = CurrentImageContainer.Image.GetBitmapImage() }; flowDocument.Blocks.Add(new BlockUIContainer(image)); if (File.Exists("printPreview.xps")) { File.Delete("printPreview.xps"); } var xpsDocument = new XpsDocument("printPreview.xps", FileAccess.ReadWrite); XpsDocumentWriter writer = XpsDocument.CreateXpsDocumentWriter(xpsDocument); writer.Write(((IDocumentPaginatorSource)flowDocument).DocumentPaginator); FixedDocumentSequence document = xpsDocument.GetFixedDocumentSequence(); xpsDocument.Close(); PrintWindow printWindow = new PrintWindow(document); printWindow.Show(); }
protected void OnbtnPrint_Click(object sender, DirectEventArgs e) { PrintWindow.Show(); PrintWindow.Loader.SuspendScripting(); PrintWindow.Loader.Url = "../report/Report_Dialysis_h.aspx?_PAT_ID=" + _PAT_ID + "&_INFO_DATE=" + sel_date.Text + "&_REPORT_NAME=f6a"; PrintWindow.Loader.DisableCaching = true; PrintWindow.LoadContent(); }
protected void btnPrint_Click(object sender, DirectEventArgs e) { PrintWindow.Show(); PrintWindow.Loader.SuspendScripting(); PrintWindow.Loader.Url = "../report/Report_Dialysis_h.aspx?_REPORT_NAME=s01&_INFO_DATE=" + _Get_YMD2(DateField1.Text) + "&_REPORT_P=" + sTIME.Text; PrintWindow.Loader.DisableCaching = true; PrintWindow.LoadContent(); }
protected void Btn_Print_Click(object Sender, DirectEventArgs e) { PrintWindow.Show(); PrintWindow.Loader.SuspendScripting(); PrintWindow.Loader.Url = "../report/Report_Dialysis_h.aspx?_PAT_ID=" + _PAT_ID + "&_REPORT_NAME=A09"; PrintWindow.Loader.DisableCaching = true; PrintWindow.LoadContent(); }
protected void OnbtnPrintS_Click(object sender, DirectEventArgs e) { PrintWindow.Show(); PrintWindow.Loader.SuspendScripting(); PrintWindow.Loader.Url = "../report/Report_Dialysis_h.aspx?_REPORT_NAME=drug_term&_PAT_IC=" + Patient_ID.Text + "&_REPORT_P=short"; PrintWindow.Loader.DisableCaching = true; PrintWindow.LoadContent(); }
protected void OnbtnPrint_Click(object sender, DirectEventArgs e) { GetWeek(); PrintWindow.Show(); PrintWindow.Loader.SuspendScripting(); PrintWindow.Loader.Url = "report/Report_Dialysis_h.aspx?_REPORT_NAME=checkin&_INFO_DATE=" + sDATE.Text + "&_REPORT_P=" + sWEEK.Text + "&_REPORT_sQM=" + sFLOOR.Text; PrintWindow.Loader.DisableCaching = true; PrintWindow.LoadContent(); }
protected void BtnPrint_Click(object sender, DirectEventArgs e) { string Url = "../report/Report_Dialysis_h.aspx?_PAT_IC=" + _PAT_IC + "&_BEG_DATE=" + _Get_YMD(start_date.Text) + "&_END_DATE=" + _Get_YMD(end_date.Text) + "&_REPORT_NAME=100"; PrintWindow.Show(); PrintWindow.Loader.SuspendScripting(); PrintWindow.Loader.Url = Url; PrintWindow.Loader.DisableCaching = true; PrintWindow.LoadContent(); }
/// <summary> /// 点击贴签系统菜单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void miPrint_Click(object sender, System.Windows.RoutedEventArgs e) { if (!this.ToString().Contains("PrintWindow") && !this.ToString().Contains("LoginWindow")) { PrintWindow printWindow = new PrintWindow(); printWindow.Show(); this.needCloseWindowConfirm = false; CloseCurrentWindow(); } }
public void PrintOffer(Offer offer) { ReportDocument report = new ReportDocument(); report.Load("../../OfferReport.rpt"); report.SetDataSource(_offerViewModel.OfferServices); PrintWindow print = new PrintWindow(); print.LinkReport(report); print.Show(); }
private async void button1_Click(object sender, EventArgs e) { if (comboBox2.Text != "") { DataBase.Insert("fun_ins_records", dateTimePicker1.Value, Convert.ToInt32(comboBox1.SelectedValue), number_polis, Convert.ToDateTime(comboBox2.Text).TimeOfDay); if (!DataBase.HasError) { try { await Program.patient.generateTalonAsync(dateTimePicker1.Value, Convert.ToInt32(comboBox1.SelectedValue), number_polis); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (MessageBox.Show("Запись прошла успешно! \nРаспечатать талон?", "Талон", MessageBoxButtons.OKCancel) == DialogResult.OK) { //Вызов сервиса печати талона byte[] byte_array = null; getTalonResponse response = await Program.patient.getTalonAsync( dateTimePicker1.Value, Convert.ToInt32(comboBox1.SelectedValue), number_polis); byte_array = response.Body.getTalonResult; if (byte_array != null) { File.WriteAllBytes(@"C:\Temp\temp.pdf", byte_array); PrintWindow pw = new PrintWindow(); pw.webBrowser1.Navigate(@"C:\Temp\temp.pdf"); pw.Show(); } else { MessageBox.Show("Ошибка!"); } } dateTimePicker1_ValueChanged(sender, e); } else { MessageBox.Show(DataBase.ErrorMessage); } } else { MessageBox.Show("Выберите время!"); } }
private void button1_Click(object sender, EventArgs e) { if (maskedTextBox1.Text.Replace(" ", "").Length != 16) { MessageBox.Show("Некорректно задан номер медецинского полиса!"); } else { DataTable table = DataBase.Select("fun_sel_login_pacient", maskedTextBox1.Text); DataRow[] rows = table.Select(); if (!DataBase.HasError && rows.Count() != 0) { Patient.NumberPolicy = Convert.ToString(rows[0][0]); Patient.LastName = Convert.ToString(rows[0][1]); Patient.FirstName = Convert.ToString(rows[0][2]); Patient.MiddLeName = Convert.ToString(rows[0][3]); maskedTextBox1.Text = ""; if (Info.Page != 100) { History.Values.Push(1); ((UserForm)this.Parent).NextPage(Info.Page); this.Hide(); } else { byte[] byte_array = null; byte_array = Program.patient.getMedCard(Patient.NumberPolicy); if (byte_array != null) { File.WriteAllBytes(@"C:\Temp\temp.pdf", byte_array); PrintWindow pw = new PrintWindow(); pw.webBrowser1.Navigate(@"C:\Temp\temp.pdf"); pw.Show(); } else { MessageBox.Show("Ошибка!"); } } } } }
private void Content3_VisibleChanged(object sender, EventArgs e) { if (this.Visible) { byte[] byte_array = null; byte_array = Program.patient.getMedCard(number_polis); if (byte_array != null) { File.WriteAllBytes(@"C:\Temp\temp.pdf", byte_array); PrintWindow pw = new PrintWindow(); pw.webBrowser1.Navigate(@"C:\Temp\temp.pdf"); pw.Show(); } else { MessageBox.Show("Ошибка!"); } } }
protected void btnPrint_Click(object sender, DirectEventArgs e) { btnDetail_Click(sender, e); toDay = DateTime.Now.ToString("yyyy-MM-dd"); string seldate = _Get_YMD2(this.DateField1.Text); string sSQL2 = "SELECT * FROM drug_itemlist "; sSQL2 += "WHERE dyivl_ivdate='" + toDay + "' "; DataTable dt2 = db.Query(sSQL2); string SerialNo = ""; if (dt2.Rows.Count > 0) { SerialNo = dt2.Rows[0]["dyivl_serialno"].ToString(); } PrintWindow.Show(); PrintWindow.Loader.SuspendScripting(); PrintWindow.Loader.Url = "../report/Report_Dialysis_h.aspx?_INFO_DATE=" + seldate + "&_REPORT_NAME=s05&_REPORT_P=" + SerialNo; PrintWindow.Loader.DisableCaching = true; PrintWindow.LoadContent(); }
private void Validate() { try { var newExamVm = SimpleIoc.Default.GetInstance<NewExamViewModel>(); var newMaladeVm = SimpleIoc.Default.GetInstance<NewMaladeViewModel>(); Examen.Malade = newMaladeVm.SelectedMalade; newExamVm.ExamensRepository.Add(Examen); // var printvm = SimpleIoc.Default.GetInstance<PrintViewModel>(); var exam = newExamVm.ExamensRepository.Get().ToList().FirstOrDefault(n => n.Moment == Examen.Moment); printvm.Examen = exam; var printwin = new PrintWindow(); printwin.Show(); SelectedEye = "(vide)"; LastEye = string.Empty; //Thread.Sleep(1000); //ResetForms(); } catch (Exception e) { e.SaveException(); ResetForms(); } }
private async void button1_Click(object sender, EventArgs e) { if (comboBox2.Text != "") { DataBase.Insert("fun_ins_records", dateTimePicker1.Value, Info.Doctor, Patient.NumberPolicy, Convert.ToDateTime(comboBox2.Text).TimeOfDay); if (!DataBase.HasError) { //Генерация талона try { //Program.patient.generateTalon(dateTimePicker1.Value, Info.doctor, Pacient.number_policy); await Program.patient.generateTalonAsync(dateTimePicker1.Value, Info.Doctor, Patient.NumberPolicy); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (MessageBox.Show("Запись прошла успешно! \nРаспечатать талон?", "Талон", MessageBoxButtons.OKCancel) == DialogResult.OK) { //Вызов сервиса печати талона byte[] byte_array = null; //byte_array = Program.patient.getTalon(dateTimePicker1.Value, Info.doctor, Pacient.number_policy); PatientServiceSoap.getTalonResponse response = await Program.patient.getTalonAsync(dateTimePicker1.Value, Info.Doctor, Patient.NumberPolicy); byte_array = response.Body.getTalonResult; if (byte_array != null) { try { File.WriteAllBytes(@"C:\Temp\temp.pdf", byte_array); } catch (Exception) { MessageBox.Show("Файл " + @"C:\Temp\temp.pdf" + " уже открыт!"); return; } PrintWindow pw = new PrintWindow(); pw.webBrowser1.Navigate(@"C:\Temp\temp.pdf"); pw.Show(); } else { MessageBox.Show("Ошибка!"); } } History.Values.Clear(); ((UserForm)this.Parent).NextPage(0); this.Hide(); } else { MessageBox.Show(DataBase.ErrorMessage); } } else { MessageBox.Show("Выберите время!"); } }
protected void BtnPrint_Click(object sender, DirectEventArgs e) { string json = e.ExtraParams["SelectedRow"]; Dictionary <string, string>[] selRow = JSON.Deserialize <Dictionary <string, string>[]>(json); ChangeRecords <InvReturnModel> recs = new StoreDataHandler(e.ExtraParams["data"]).BatchObjectData <InvReturnModel>(); string dateString = DateTime.Now.ToString("yyyy-MM-dd"); if (selRow.Count() > 0) { dateString = selRow[0]["dyiv_ivdate"]; } // 原则上这样的行为只会有 insert. string SQLT_INV_RETURN_UPDATE = @" UPDATE inv_return SET invr_rtnamt='{0}', invr_datereturn='{1}' WHERE invr_id = '{2}'; "; string SQLT_INV_RETURN_INSERT = @" INSERT INTO inv_return (invr_no, invr_name, invr_preamt, invr_rtnamt, invr_serialno, invr_datereturn) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}'); "; // inserting or update? try { if (recs.Updated.Count > 0) { int id; string sql = ""; if (int.TryParse(recs.Updated[0].Id, out id)) { foreach (InvReturnModel curItem in recs.Updated) { sql += string.Format(SQLT_INV_RETURN_UPDATE, curItem.RetAmt, dateString, curItem.Id); } } else { foreach (InvReturnModel curItem in recs.Updated) { sql += string.Format(SQLT_INV_RETURN_INSERT, curItem.No, curItem.Name, curItem.PreAmt, curItem.RetAmt, curItem.SerialNo, dateString); } db.Excute(sql); } } if (selRow.Count() > 0) { string serialno = selRow[0]["dyiv_serialno"].ToString(); string usrnm = selRow[0]["dyiv_usrnm"].ToString(); string printdate = selRow[0]["dyiv_printdate"]; string ivdate = selRow[0]["dyiv_ivdate"]; PrintWindow.Show(); PrintWindow.Loader.SuspendScripting(); PrintWindow.Loader.Url = "../report/Report_Dialysis_h.aspx?_INFO_DATE=" + ivdate + "&_REPORT_NAME=s04&_REPORT_P=" + serialno; PrintWindow.Loader.DisableCaching = true; PrintWindow.LoadContent(); //入庫存 string sSQL = "SELECT * FROM inv_return "; sSQL += "WHERE invr_serialno='" + serialno + "' AND invr_rtnamt<>'0' "; DataTable dt = db.Query(sSQL); int inamt = 0; int invamt = 0; foreach (DataRow row in dt.Rows) { string item = row["invr_name"].ToString(); int qty = int.Parse(row["invr_preamt"].ToString()); string sql = "SELECT invs_inamt, invs_invamt FROM inventory_stock "; sql += "WHERE invs_name='" + item + "'"; DataTable dt1 = db.Query(sql); if (dt1.Rows.Count > 0) { inamt = int.Parse(dt1.Rows[0]["invs_inamt"].ToString()) - qty; invamt = int.Parse(dt1.Rows[0]["invs_invamt"].ToString()) + qty; try { sql = "UPDATE inventory_stock SET "; sql += "invs_inamt='" + inamt + "',"; sql += "invs_invamt='" + invamt + "',"; sql += "invs_lastupdate='" + printdate + "' "; sql += "WHERE invs_name='" + item + "'; "; sql += "UPDATE inv_return SET invr_rec='Y' "; sql += "WHERE invr_serialno='" + serialno + "';"; db.Excute(sql); } catch (Exception ex) { _NotificationShow("储存失败!"); } } } //入庫存 } else { _NotificationShow("请选择要列印的项目。"); } } catch (Exception ex) { Common._ErrorMsgShow(ex.Message.ToString()); } }
private void PrintPreview_Click(object sender, System.Windows.RoutedEventArgs e) { PrintWindow pwin = new PrintWindow(fixeddoc); pwin.Show(); }
/// <summary> /// 将DATAGRID 内容保存为XPS打印文件 /// </summary> /// <param name="PageSize">每页显示数据条数</param> /// <param name="PageData">DATAGRID数据集合</param> /// <param name="FixedPageAddress">FIXEDPAGE文件路径</param> /// <param name="EffectiveTime">参数生效时间</param> public static void PrintDataPage(int PageSize, PrintCtrls PageData, string FixedPageAddress, string EffectiveTime, object Jkdx) { ICollectionView paraCollection; int iCount = PageData.Count; if (iCount == 0) { MessageBox.Show(string.Format("未查询到相应数据,无法打印!")); return; } int CacheIndex = 0;//记录索引 int iPageCount = PageBarXPS.getPageCount(PageSize, iCount)[0]; int iPageCount1 = iPageCount; int PageAmount = PageBarXPS.getPageCount(PageSize, iCount)[1]; FixedPage[] tt = new FixedPage[iPageCount]; if (PageAmount != 0) { iPageCount = iPageCount - 1; PrintCtrls paraCache = new PrintCtrls(); Uri printViewUri = new Uri(FixedPageAddress, UriKind.Relative); tt[iPageCount] = (FixedPage)Application.LoadComponent(printViewUri); for (int i = iPageCount * PageSize; i < iCount; i++) { paraCache.Add(PageData[i]); } DataGrid dg = tt[iPageCount].FindName("dg") as DataGrid; TextBlock tb1 = tt[iPageCount].FindName("tb") as TextBlock; tb1.Text = EffectiveTime; //TextBlock tb2 = tt[iPageCount].FindName("currentTime") as TextBlock; //tb2.Text = DateTime.Now.ToString(); Label l1 = tt[iPageCount].FindName("StrPageBar") as Label; l1.Content = PageBarXPS.createPageBar(PageSize, iCount, iPageCount1); paraCollection = new CollectionView(paraCache); dg.ItemsSource = paraCollection; } for (int i = 0; i < iPageCount; i++) { PrintCtrls paraCache = new PrintCtrls(); Uri printViewUri = new Uri(FixedPageAddress, UriKind.Relative); tt[i] = (FixedPage)Application.LoadComponent(printViewUri); for (; CacheIndex < PageSize * (i + 1); CacheIndex++) { paraCache.Add(PageData[CacheIndex]); } Image logo = tt[i].FindName("logo") as Image; DataGrid dg = tt[i].FindName("dg") as DataGrid; TextBlock tb1 = tt[i].FindName("tb") as TextBlock; tb1.Text = "医疗设备管理系统定位记录表"; //TextBlock tb2 = tt[i].FindName("currentTime") as TextBlock; //TextBlock sbmc = tt[i].FindName("sbmc") as TextBlock; //sbmc.Text = Jkdx.DXMC.ToString(); //TextBlock lx = tt[i].FindName("lx") as TextBlock; //lx.Text = Jkdx.DXLX.ToString(); //TextBlock rfid = tt[i].FindName("rfid") as TextBlock; //rfid.Text = Jkdx.RFID.ToString(); //TextBlock cjdw = tt[i].FindName("cjdw") as TextBlock; //cjdw.Text = Jkdx.CJDW.ToString(); //TextBlock lxfs = tt[i].FindName("lxfs") as TextBlock; //lxfs.Text = Jkdx.LXFS.ToString(); //TextBlock lksj = tt[i].FindName("lksj") as TextBlock; //lksj.Text = Jkdx.LKSJ.ToShortDateString(); //TextBlock tksj = tt[i].FindName("tksj") as TextBlock; //tksj.Text = Jkdx.TKSJ.ToString(); //tb2.Text = DateTime.Now.ToString(); Label l1 = tt[i].FindName("StrPageBar") as Label; l1.Content = PageBarXPS.createPageBar(PageSize, iCount, i + 1); paraCollection = new CollectionView(paraCache); dg.ItemsSource = paraCollection; } FileHelper.SaveXPS(tt, false, iPageCount1); string xpsFileName = FileHelper.GetXPSFromDialog(false); //得到临时的文件存储 PrintWindow window = new PrintWindow(); //调用显示容器 window.fixedDocFile = xpsFileName; window.Show(); }
protected void btnPrint_Click(object sender, DirectEventArgs e) { BtnSaveRight_Click(sender, e); string sno = SNO.Text; string date = RPT_DATE.Text; if (sno != null && sno.Length > 0) { PrintWindow.Show(); PrintWindow.Loader.SuspendScripting(); PrintWindow.Loader.Url = "../report/Report_Dialysis_h.aspx?_INFO_DATE=" + date + "&_REPORT_NAME=s03&_REPORT_P=" + sno; PrintWindow.Loader.DisableCaching = true; PrintWindow.LoadContent(); // update the print log string dateString = DateTime.Now.ToString("yyyy-MM-dd"); string SQLT_IV_UPDATE = "UPDATE dailyiv_list SET dyiv_printdate = '{0}' WHERE dyiv_serialno = '{1}'; "; string sqlUpdate = string.Format(SQLT_IV_UPDATE, dateString, sno); db.Excute(sqlUpdate); //扣庫存 string sSQL = "SELECT * FROM dailyiv_itemlist "; sSQL += "WHERE dyivl_serialno='" + sno + "' AND dyivl_rec='N'"; DataTable dt = db.Query(sSQL); int outamt = 0; int invamt = 0; foreach (DataRow row in dt.Rows) { string item = row["dyivl_item"].ToString(); int qty = int.Parse(row["right_qty"].ToString()); //正確的領用數量 string sql = "SELECT invs_outamt, invs_invamt FROM inventory_stock "; sql += "WHERE invs_name='" + item + "'"; DataTable dt1 = db.Query(sql); if (dt1.Rows.Count > 0) { outamt = int.Parse(dt1.Rows[0]["invs_outamt"].ToString()) + qty; invamt = int.Parse(dt1.Rows[0]["invs_invamt"].ToString()) - qty; try { sql = "UPDATE inventory_stock SET "; sql += "invs_outamt='" + outamt + "',"; sql += "invs_invamt='" + invamt + "',"; sql += "invs_lastupdate='" + date + "' "; sql += "WHERE invs_name='" + item + "'; "; sql += "UPDATE dailyiv_itemlist SET "; sql += "dyivl_rec='Y', "; sql += "dyivl_qty=right_qty "; sql += "WHERE dyivl_serialno='" + sno + "'; "; db.Excute(sql); } catch (Exception ex) { _NotificationShow("储存失败!"); } } } //扣庫存 } else { _NotificationShow("请选择要列印的项目。"); } }
private void Print_Button_Click(object sender, RoutedEventArgs e) { PrintWindow printWindow = new PrintWindow(this.Project); printWindow.Show(); }