大连药品登记本 导出pdf
This commit is contained in:
parent
242d4bea53
commit
d81bff33f9
@ -1317,6 +1317,7 @@
|
||||
<Content Include="Extensions\DevComponents.DotNetBar.Schedule.dll" />
|
||||
<Content Include="Extensions\DevComponents.DotNetBar.SuperGrid.dll" />
|
||||
<Content Include="Extensions\DevComponents.DotNetBar2.dll" />
|
||||
<Content Include="Extensions\itextsharp.dll" />
|
||||
<Content Include="Extensions\Microsoft.Office.Interop.Excel.dll" />
|
||||
<Content Include="Extensions\Mono.Security.dll" />
|
||||
<Content Include="Extensions\Npgsql.dll" />
|
||||
|
||||
BIN
AIMS/Extensions/itextsharp.dll
Normal file
BIN
AIMS/Extensions/itextsharp.dll
Normal file
Binary file not shown.
@ -872,8 +872,8 @@
|
||||
this.superTabMain.ControlBox.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] {
|
||||
this.superTabMain.ControlBox.MenuBox,
|
||||
this.superTabMain.ControlBox.CloseBox});
|
||||
this.superTabMain.Controls.Add(this.superTabControlPanel1);
|
||||
this.superTabMain.Controls.Add(this.superTabControlPanel2);
|
||||
this.superTabMain.Controls.Add(this.superTabControlPanel1);
|
||||
this.superTabMain.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.superTabMain.Location = new System.Drawing.Point(0, 58);
|
||||
this.superTabMain.Name = "superTabMain";
|
||||
@ -984,7 +984,7 @@
|
||||
this.superTabControlPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.superTabControlPanel2.Location = new System.Drawing.Point(0, 28);
|
||||
this.superTabControlPanel2.Name = "superTabControlPanel2";
|
||||
this.superTabControlPanel2.Size = new System.Drawing.Size(1760, 904);
|
||||
this.superTabControlPanel2.Size = new System.Drawing.Size(1389, 803);
|
||||
this.superTabControlPanel2.TabIndex = 0;
|
||||
this.superTabControlPanel2.TabItem = this.spTabBM;
|
||||
//
|
||||
@ -997,7 +997,7 @@
|
||||
this.panelExBLSJ.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panelExBLSJ.Location = new System.Drawing.Point(0, 0);
|
||||
this.panelExBLSJ.Name = "panelExBLSJ";
|
||||
this.panelExBLSJ.Size = new System.Drawing.Size(1760, 904);
|
||||
this.panelExBLSJ.Size = new System.Drawing.Size(1389, 803);
|
||||
this.panelExBLSJ.Style.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.panelExBLSJ.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
|
||||
this.panelExBLSJ.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
|
||||
@ -1016,7 +1016,7 @@
|
||||
this.panel82.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel82.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel82.Name = "panel82";
|
||||
this.panel82.Size = new System.Drawing.Size(1760, 904);
|
||||
this.panel82.Size = new System.Drawing.Size(1389, 803);
|
||||
this.panel82.TabIndex = 3;
|
||||
this.panel82.Scroll += new System.Windows.Forms.ScrollEventHandler(this.panel82_Scroll);
|
||||
//
|
||||
|
||||
@ -1215,7 +1215,6 @@ namespace AIMS.OperationAanesthesia
|
||||
zgcAnaesRecord2.Visible = true;
|
||||
|
||||
}
|
||||
|
||||
private void _record_SpeedyDrugsParam(List<FactDrug> factDrugs)
|
||||
{
|
||||
frmFactSpeedyDrug frmFact = new frmFactSpeedyDrug();
|
||||
@ -1312,14 +1311,12 @@ namespace AIMS.OperationAanesthesia
|
||||
MessageBox.Show("请选择患者");
|
||||
}
|
||||
}
|
||||
|
||||
private void FrmFactOutputLiquids_OutParam()
|
||||
{
|
||||
templateManage.Bind("OutputManage");
|
||||
templateManage.Bind("RemarkManage");
|
||||
zgcAnaesRecord.Refresh();
|
||||
}
|
||||
|
||||
private void button6_Click(object sender, EventArgs e)
|
||||
{
|
||||
frmAanesthesiaQuality frmAnaseDataQuality = new frmAanesthesiaQuality();
|
||||
@ -2254,6 +2251,13 @@ namespace AIMS.OperationAanesthesia
|
||||
{
|
||||
bool isTrue = true;
|
||||
|
||||
if (PublicMethod.HospitalName.Contains("秦皇岛"))
|
||||
if (_record.AnesthesiaDoctor == null || _record.AnesthesiaDoctor.Trim() == "")
|
||||
{
|
||||
message = "请填写麻醉医生";
|
||||
isTrue = false;
|
||||
}
|
||||
|
||||
if (_record.AnesthesiaDoctor != null && _record.AnesthesiaDoctor.Trim() != "")
|
||||
{
|
||||
if (_record.AnaseDataQualityRecordList == null || _record.AnaseDataQualityRecordList.Count <= 0)
|
||||
|
||||
@ -86,7 +86,7 @@ namespace AIMS
|
||||
{
|
||||
record.Content6 = dr.Cells[7].EditedFormattedValue.ToString();
|
||||
record.Content7 = dr.Cells[8].EditedFormattedValue.ToString();
|
||||
record.Content8 = dr.Cells[9].EditedFormattedValue.ToString();
|
||||
record.Content8 = dr.Cells[9].EditedFormattedValue.ToString();
|
||||
record.ExecWork = dr.Cells[10].EditedFormattedValue.ToString();
|
||||
}
|
||||
else if (selectdgv.Columns.Count == 9)
|
||||
@ -270,7 +270,7 @@ namespace AIMS
|
||||
{
|
||||
record.Content6 = dr.Cells[7].EditedFormattedValue.ToString();
|
||||
record.Content7 = dr.Cells[8].EditedFormattedValue.ToString();
|
||||
record.Content8 = dr.Cells[9].EditedFormattedValue.ToString();
|
||||
record.Content8 = dr.Cells[9].EditedFormattedValue.ToString();
|
||||
record.ExecWork = dr.Cells[10].EditedFormattedValue.ToString();
|
||||
}
|
||||
else if (selectdgv.Columns.Count == 9)
|
||||
@ -318,7 +318,7 @@ namespace AIMS
|
||||
record.Content5,
|
||||
record.Content6,
|
||||
record.Content7,
|
||||
record.Content8,
|
||||
record.Content8,
|
||||
record.ExecWork
|
||||
};
|
||||
rowNum++;
|
||||
@ -360,12 +360,13 @@ namespace AIMS
|
||||
rowNum++;
|
||||
}
|
||||
}
|
||||
if (isprintview==true)
|
||||
excel.PrintPreview();
|
||||
if (isprintview == true)
|
||||
excel.PrintPreview();
|
||||
else
|
||||
excel.Print();
|
||||
excel.Close();
|
||||
break;
|
||||
if (isprintview == true)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -411,11 +411,11 @@ namespace AIMS.OperationAfter.UI
|
||||
{
|
||||
string feerid = item.Cells[0].EditedFormattedValue.ToString();
|
||||
FeesRecord report = BFeesRecord.SelectSingle(Convert.ToInt32(feerid));
|
||||
report.InsureNO = item.Cells[10].EditedFormattedValue.ToString();
|
||||
report.Extend5 = item.Cells[13].EditedFormattedValue.ToString();
|
||||
report.Conclusion = item.Cells[14].EditedFormattedValue.ToString();
|
||||
report.IsInsure = item.Cells[15].EditedFormattedValue.ToString();
|
||||
report.LimitDrug = item.Cells[2].EditedFormattedValue.ToString();
|
||||
report.InsureNO = item.Cells[6].EditedFormattedValue.ToString();
|
||||
report.Extend5 = item.Cells[12].EditedFormattedValue.ToString();
|
||||
report.Conclusion = item.Cells[10].EditedFormattedValue.ToString();
|
||||
report.IsInsure = item.Cells[9].EditedFormattedValue.ToString();
|
||||
//report.LimitDrug = item.Cells[2].EditedFormattedValue.ToString();
|
||||
BFeesRecord.Update(report);
|
||||
}
|
||||
MessageBox.Show("保存成功!", "系统提示");
|
||||
@ -466,5 +466,208 @@ namespace AIMS.OperationAfter.UI
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void toolStripButton3_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
KillAllExcel();
|
||||
if (dgvDrugs.Rows.Count <= 0) return;
|
||||
List<DataGridViewRow> groupedList = new List<DataGridViewRow>();
|
||||
foreach (DataGridViewRow item in dgvDrugs.Rows)
|
||||
{
|
||||
groupedList.Add(item);
|
||||
}
|
||||
int n = 21;
|
||||
List<List<DataGridViewRow>> groupedLists = new List<List<DataGridViewRow>>();
|
||||
for (int i = 0; i < groupedList.Count; i += n)
|
||||
{
|
||||
List<DataGridViewRow> group = groupedList.GetRange(i, Math.Min(n, groupedList.Count - i));
|
||||
groupedLists.Add(group);
|
||||
}
|
||||
|
||||
foreach (List<DataGridViewRow> item in groupedLists)
|
||||
{
|
||||
ExprotExcel3(item, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void ExprotExcel3(List<DataGridViewRow> itemlist, bool isPrint = false)
|
||||
{
|
||||
//自定义表头
|
||||
string title = "麻醉、精一药品注射剂使用、及残余液处理登记表";
|
||||
|
||||
//是否横向
|
||||
bool xlLandscape = true;
|
||||
if (dataGridViewSetting != null && dataGridViewSetting.Landscape == false) xlLandscape = false;
|
||||
//主体字体大小
|
||||
int BodySize = 9;
|
||||
if (dataGridViewSetting != null && dataGridViewSetting.FontSize > 0) BodySize = dataGridViewSetting.FontSize;
|
||||
|
||||
myExcel = new Microsoft.Office.Interop.Excel.Application();
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
//保存文化环境
|
||||
System.Globalization.CultureInfo CurrentCI = System.Threading.Thread.CurrentThread.CurrentCulture;
|
||||
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
|
||||
|
||||
Workbook workbookData = myExcel.Workbooks.Add(Missing.Value);
|
||||
Worksheet xlSheet = (Microsoft.Office.Interop.Excel.Worksheet)workbookData.Worksheets[1];
|
||||
|
||||
xlSheet.Name = title;
|
||||
|
||||
if (isPrint == false)
|
||||
myExcel.Visible = true;
|
||||
|
||||
myExcel.Cells[1, 1] = title;//默认的就是在sheet1里面的。
|
||||
string DrugName = "科室:麻醉科";
|
||||
myExcel.Cells[2, 1] = DrugName;//默认的就是在sheet1里面的。
|
||||
int startIndex = 3;
|
||||
|
||||
WorksheetClass wsClass = new WorksheetClass();
|
||||
|
||||
Dictionary<int, string> Columns = new Dictionary<int, string>();
|
||||
//填充标题
|
||||
for (int i = 0; i < dgvDrugs.Columns.Count; i++)
|
||||
{
|
||||
if (dataGridViewSetting != null)
|
||||
{
|
||||
foreach (var item in dataGridViewSetting.Exports)
|
||||
{
|
||||
if (dgvDrugs.Columns[i].Name == item.Name)
|
||||
{
|
||||
if (item.IsPrint == true)
|
||||
{
|
||||
Columns.Add(i, dgvDrugs.Columns[i].HeaderText);
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dgvDrugs.Columns[i].Visible == true)
|
||||
Columns.Add(i, dgvDrugs.Columns[i].HeaderText);
|
||||
}
|
||||
}
|
||||
|
||||
List<KeyValuePair<int, string>> ColumnsStr = Columns.ToList();
|
||||
|
||||
for (int i = 0; i < ColumnsStr.Count; i++)
|
||||
{
|
||||
myExcel.Cells[startIndex, i + 1] = ColumnsStr[i].Value;
|
||||
if (dataGridViewSetting != null)
|
||||
{
|
||||
foreach (var item in dataGridViewSetting.Exports)
|
||||
{
|
||||
if (ColumnsStr[i].Value == item.Text)
|
||||
{
|
||||
xlSheet.get_Range(xlSheet.Cells[startIndex, i + 1], xlSheet.Cells[startIndex, i + 1]).ColumnWidth = item.PrintWidth;//列宽
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xlSheet.get_Range(xlSheet.Cells[startIndex, i + 1], xlSheet.Cells[startIndex, i + 1]).ColumnWidth = 5;//列宽
|
||||
}
|
||||
}
|
||||
//获得数据表的值
|
||||
int RowCount = itemlist.Count;
|
||||
int colCount = ColumnsStr.Count;
|
||||
//设置填充单元格样式
|
||||
xlSheet.get_Range(xlSheet.Cells[startIndex, 1], xlSheet.Cells[RowCount + startIndex, colCount]).Borders.LineStyle = XlLineStyle.xlContinuous;//边框的样式
|
||||
object[,] objData = new object[RowCount, colCount];
|
||||
|
||||
//将DataTable里的值填充到对象数组中
|
||||
for (int i = 0; i < RowCount; i++)
|
||||
{
|
||||
for (int j = 0; j < colCount; j++)
|
||||
{
|
||||
if (dgvDrugs.Columns[ColumnsStr[j].Key].Name == "序号" || dgvDrugs.Columns[ColumnsStr[j].Key].Name == "ApplyId")
|
||||
objData[i, j] = i + 1;
|
||||
else if (itemlist[i].Cells[ColumnsStr[j].Key].Value != null)
|
||||
objData[i, j] = itemlist[i].Cells[ColumnsStr[j].Key].Value.ToString().Trim();
|
||||
}
|
||||
System.Windows.Forms.Application.DoEvents();
|
||||
}
|
||||
|
||||
//将对象数组的值赋值给Excel
|
||||
Range range = xlSheet.get_Range(xlSheet.Cells[4, 1], xlSheet.Cells[RowCount + startIndex, colCount]);
|
||||
range.NumberFormat = "@";
|
||||
range.Value2 = objData;
|
||||
range.RowHeight = 19;
|
||||
//xlSheet.get_Range(xlSheet.Cells[2, 1], xlSheet.Cells[RowCount + 2, colCount]).Font.Size = BodySize;//字体大小
|
||||
|
||||
//设置主标题单元格的样式
|
||||
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).MergeCells = true;//合并单元格
|
||||
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).HorizontalAlignment = XlHAlign.xlHAlignCenter;//水平对齐方式
|
||||
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).VerticalAlignment = XlVAlign.xlVAlignCenter;//垂直对齐方式
|
||||
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).Font.Bold = true;//字体加粗
|
||||
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).Font.ColorIndex = 0;//字体颜色
|
||||
//xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).Font.Italic = true;//是否斜体
|
||||
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).Font.Size = 20;//字体大小
|
||||
//xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[2, colCount]).Borders.LineStyle = XlLineStyle.xlContinuous;//边框样式
|
||||
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).RowHeight = 33.75;//行高
|
||||
|
||||
xlSheet.get_Range(xlSheet.Cells[2, 1], xlSheet.Cells[2, colCount]).MergeCells = true;//合并单元格
|
||||
|
||||
//设置标题单元格样式
|
||||
xlSheet.get_Range(xlSheet.Cells[2, 1], xlSheet.Cells[startIndex, colCount]).RowHeight = 21;//行高
|
||||
|
||||
if (xlLandscape == true)
|
||||
xlSheet.PageSetup.Orientation = XlPageOrientation.xlLandscape;//页面方向为横向
|
||||
//复苏文化环境
|
||||
System.Threading.Thread.CurrentThread.CurrentCulture = CurrentCI;
|
||||
try
|
||||
{
|
||||
if (isPrint == true)
|
||||
xlSheet.PrintOutEx();
|
||||
//myExcel.Save(@"D:a.xls");
|
||||
//myExcel.Quit();
|
||||
this.Cursor = Cursors.Default;
|
||||
//MessageBox.Show("导出成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (isPrint == true)
|
||||
{
|
||||
//释放资源
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlSheet);
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(workbookData);
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(range);
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(myExcel);
|
||||
GC.Collect();
|
||||
range = null;
|
||||
xlSheet = null;
|
||||
workbookData = null;
|
||||
myExcel = null;
|
||||
KillAllExcel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void toolStripButton4_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (comboBoxExType.Text == "") return;
|
||||
if (cnoDrugName.Text == "") return;
|
||||
string beginTime = Convert.ToDateTime(dtpOpeTime.Value).ToString("yyyy-MM-dd 00:00:00");
|
||||
string endTime = Convert.ToDateTime(dtpEnd.Value).ToString("yyyy-MM-dd 23:59:59");
|
||||
string sql = string.Format(" ExecTime>='{0}' and ExecTime<'{1}'", beginTime, endTime);
|
||||
if (comboBoxExType.SelectedItem != null)
|
||||
{
|
||||
ComboItem chargitem = comboBoxExType.SelectedItem as ComboItem;
|
||||
sql += " and (FeeTypeId = '" + chargitem.Value + "' ) ";
|
||||
}
|
||||
if (cnoDrugName.SelectedItem != null)
|
||||
{
|
||||
ComboItem chargitem = cnoDrugName.SelectedItem as ComboItem;
|
||||
sql += " and (ChargName = '" + chargitem.Value + "' ) ";
|
||||
}
|
||||
if (FeeType != "")
|
||||
{
|
||||
sql += " and (FeeType = '" + FeeType + "' ) ";
|
||||
}
|
||||
BFeesRecordReport.UpdateChargcyl(sql);
|
||||
btnOK_Click(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
141
AIMS/OperationAfter/frmOperationCharg3.designer.cs
generated
141
AIMS/OperationAfter/frmOperationCharg3.designer.cs
generated
@ -28,16 +28,18 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
|
||||
this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripButton3 = new System.Windows.Forms.ToolStripButton();
|
||||
this.cboRoom = new DevComponents.DotNetBar.Controls.ComboBoxEx();
|
||||
this.label22 = new System.Windows.Forms.Label();
|
||||
this.tsbSettingDGV = new System.Windows.Forms.Button();
|
||||
@ -101,7 +103,7 @@
|
||||
this.dataGridViewTextBoxColumn31 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.dgvDrugs = new DevComponents.DotNetBar.Controls.DataGridViewX();
|
||||
this.dataGridViewTextBoxColumn21 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripButton4 = new System.Windows.Forms.ToolStripButton();
|
||||
this.panel1.SuspendLayout();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
@ -134,13 +136,26 @@
|
||||
this.toolStrip1.ImageScalingSize = new System.Drawing.Size(25, 25);
|
||||
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripButton2,
|
||||
this.toolStripButton1});
|
||||
this.toolStripButton1,
|
||||
this.toolStripButton3,
|
||||
this.toolStripButton4});
|
||||
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStrip1.Name = "toolStrip1";
|
||||
this.toolStrip1.Size = new System.Drawing.Size(1350, 49);
|
||||
this.toolStrip1.TabIndex = 36;
|
||||
this.toolStrip1.Text = "toolStrip1";
|
||||
//
|
||||
// toolStripButton2
|
||||
//
|
||||
this.toolStripButton2.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.toolStripButton2.Image = global::AIMS.Properties.Resources.图标_设置;
|
||||
this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButton2.Name = "toolStripButton2";
|
||||
this.toolStripButton2.Size = new System.Drawing.Size(60, 46);
|
||||
this.toolStripButton2.Text = "导出设置";
|
||||
this.toolStripButton2.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
|
||||
this.toolStripButton2.Click += new System.EventHandler(this.toolStripButton2_Click);
|
||||
//
|
||||
// toolStripButton1
|
||||
//
|
||||
this.toolStripButton1.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
@ -152,6 +167,17 @@
|
||||
this.toolStripButton1.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
|
||||
this.toolStripButton1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// toolStripButton3
|
||||
//
|
||||
this.toolStripButton3.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.toolStripButton3.Image = global::AIMS.Properties.Resources.图标_手术排程;
|
||||
this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButton3.Name = "toolStripButton3";
|
||||
this.toolStripButton3.Size = new System.Drawing.Size(65, 46);
|
||||
this.toolStripButton3.Text = "打印Excel";
|
||||
this.toolStripButton3.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
|
||||
this.toolStripButton3.Click += new System.EventHandler(this.toolStripButton3_Click);
|
||||
//
|
||||
// cboRoom
|
||||
//
|
||||
this.cboRoom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
@ -490,19 +516,19 @@
|
||||
// dgvOperation
|
||||
//
|
||||
this.dgvOperation.AllowUserToAddRows = false;
|
||||
dataGridViewCellStyle15.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(239)))), ((int)(((byte)(247)))), ((int)(((byte)(255)))));
|
||||
this.dgvOperation.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle15;
|
||||
dataGridViewCellStyle8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(239)))), ((int)(((byte)(247)))), ((int)(((byte)(255)))));
|
||||
this.dgvOperation.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle8;
|
||||
this.dgvOperation.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||
this.dgvOperation.BackgroundColor = System.Drawing.Color.Snow;
|
||||
this.dgvOperation.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
dataGridViewCellStyle16.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle16.Font = new System.Drawing.Font("微软雅黑", 10F);
|
||||
dataGridViewCellStyle16.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle16.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle16.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle16.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.dgvOperation.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle16;
|
||||
dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle9.Font = new System.Drawing.Font("微软雅黑", 10F);
|
||||
dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.dgvOperation.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle9;
|
||||
this.dgvOperation.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvOperation.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.Id,
|
||||
@ -833,29 +859,29 @@
|
||||
this.dgvDrugs.AllowUserToAddRows = false;
|
||||
this.dgvDrugs.AllowUserToResizeColumns = false;
|
||||
this.dgvDrugs.AllowUserToResizeRows = false;
|
||||
dataGridViewCellStyle17.BackColor = System.Drawing.Color.MintCream;
|
||||
this.dgvDrugs.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle17;
|
||||
dataGridViewCellStyle10.BackColor = System.Drawing.Color.MintCream;
|
||||
this.dgvDrugs.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle10;
|
||||
this.dgvDrugs.BackgroundColor = System.Drawing.Color.White;
|
||||
this.dgvDrugs.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
dataGridViewCellStyle18.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle18.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle18.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle18.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle18.SelectionForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle18.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.dgvDrugs.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle18;
|
||||
dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.dgvDrugs.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11;
|
||||
this.dgvDrugs.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvDrugs.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.dataGridViewTextBoxColumn21});
|
||||
dataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle20.BackColor = System.Drawing.SystemColors.Window;
|
||||
dataGridViewCellStyle20.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle20.ForeColor = System.Drawing.Color.Black;
|
||||
dataGridViewCellStyle20.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle20.SelectionForeColor = System.Drawing.Color.Black;
|
||||
dataGridViewCellStyle20.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dgvDrugs.DefaultCellStyle = dataGridViewCellStyle20;
|
||||
dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle13.BackColor = System.Drawing.SystemColors.Window;
|
||||
dataGridViewCellStyle13.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle13.ForeColor = System.Drawing.Color.Black;
|
||||
dataGridViewCellStyle13.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle13.SelectionForeColor = System.Drawing.Color.Black;
|
||||
dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dgvDrugs.DefaultCellStyle = dataGridViewCellStyle13;
|
||||
this.dgvDrugs.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.dgvDrugs.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
|
||||
this.dgvDrugs.EnableHeadersVisualStyles = false;
|
||||
@ -864,14 +890,14 @@
|
||||
this.dgvDrugs.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.dgvDrugs.MultiSelect = false;
|
||||
this.dgvDrugs.Name = "dgvDrugs";
|
||||
dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle21.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle21.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle21.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle21.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle21.SelectionForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle21.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.dgvDrugs.RowHeadersDefaultCellStyle = dataGridViewCellStyle21;
|
||||
dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.dgvDrugs.RowHeadersDefaultCellStyle = dataGridViewCellStyle14;
|
||||
this.dgvDrugs.RowHeadersVisible = false;
|
||||
this.dgvDrugs.RowTemplate.Height = 25;
|
||||
this.dgvDrugs.ShowCellErrors = false;
|
||||
@ -884,23 +910,24 @@
|
||||
// dataGridViewTextBoxColumn21
|
||||
//
|
||||
this.dataGridViewTextBoxColumn21.DataPropertyName = "id";
|
||||
dataGridViewCellStyle19.ForeColor = System.Drawing.Color.Red;
|
||||
this.dataGridViewTextBoxColumn21.DefaultCellStyle = dataGridViewCellStyle19;
|
||||
dataGridViewCellStyle12.ForeColor = System.Drawing.Color.Red;
|
||||
this.dataGridViewTextBoxColumn21.DefaultCellStyle = dataGridViewCellStyle12;
|
||||
this.dataGridViewTextBoxColumn21.HeaderText = "ID";
|
||||
this.dataGridViewTextBoxColumn21.Name = "dataGridViewTextBoxColumn21";
|
||||
this.dataGridViewTextBoxColumn21.Visible = false;
|
||||
this.dataGridViewTextBoxColumn21.Width = 30;
|
||||
//
|
||||
// toolStripButton2
|
||||
// toolStripButton4
|
||||
//
|
||||
this.toolStripButton2.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.toolStripButton2.Image = global::AIMS.Properties.Resources.图标_设置;
|
||||
this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButton2.Name = "toolStripButton2";
|
||||
this.toolStripButton2.Size = new System.Drawing.Size(60, 46);
|
||||
this.toolStripButton2.Text = "导出设置";
|
||||
this.toolStripButton2.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
|
||||
this.toolStripButton2.Click += new System.EventHandler(this.toolStripButton2_Click);
|
||||
this.toolStripButton4.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
|
||||
this.toolStripButton4.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.toolStripButton4.Image = global::AIMS.Properties.Resources.图标_刷新;
|
||||
this.toolStripButton4.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButton4.Name = "toolStripButton4";
|
||||
this.toolStripButton4.Size = new System.Drawing.Size(72, 46);
|
||||
this.toolStripButton4.Text = "更新残余量";
|
||||
this.toolStripButton4.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
|
||||
this.toolStripButton4.Click += new System.EventHandler(this.toolStripButton4_Click);
|
||||
//
|
||||
// frmOperationCharg3
|
||||
//
|
||||
@ -1001,5 +1028,7 @@
|
||||
private System.Windows.Forms.ToolStrip toolStrip1;
|
||||
private System.Windows.Forms.ToolStripButton toolStripButton1;
|
||||
private System.Windows.Forms.ToolStripButton toolStripButton2;
|
||||
private System.Windows.Forms.ToolStripButton toolStripButton3;
|
||||
private System.Windows.Forms.ToolStripButton toolStripButton4;
|
||||
}
|
||||
}
|
||||
@ -38,10 +38,10 @@ namespace AIMS.OperationAfter.UI
|
||||
try
|
||||
{
|
||||
dtpOpeTime.Value = DateTime.Now;
|
||||
dtpEnd.Value = dtpOpeTime.Value;
|
||||
dtpEnd.Value = dtpOpeTime.Value;
|
||||
DataGridViewPath = GetControlPath(dgvDrugs);
|
||||
exportConfig = BSysConfig.SelectSingle(" Note='" + DataGridViewPath + "'", null, RecursiveType.None, 0);
|
||||
|
||||
|
||||
if (exportConfig != null)
|
||||
ConfigDataGridView(exportConfig);
|
||||
|
||||
@ -55,7 +55,7 @@ namespace AIMS.OperationAfter.UI
|
||||
PublicMethod.WriteLog(exp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void btnOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
//if (comboBoxExType.Text == "") return;
|
||||
@ -136,7 +136,7 @@ namespace AIMS.OperationAfter.UI
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
{
|
||||
KillAllExcel();
|
||||
ExprotExcel2();
|
||||
}
|
||||
@ -144,7 +144,7 @@ namespace AIMS.OperationAfter.UI
|
||||
private void ExprotExcel2(bool isPrint = false)
|
||||
{
|
||||
//自定义表头
|
||||
string title = "麻醉、精一药品注射剂使用、及残余液处理登记表";
|
||||
string title = "麻醉、精一药品注射剂使用、及残余液处理登记表";
|
||||
|
||||
//是否横向
|
||||
bool xlLandscape = true;
|
||||
@ -168,7 +168,7 @@ namespace AIMS.OperationAfter.UI
|
||||
myExcel.Visible = true;
|
||||
|
||||
myExcel.Cells[1, 1] = title;//默认的就是在sheet1里面的。
|
||||
string DrugName = "科室:麻醉科";
|
||||
string DrugName = "科室:麻醉科";
|
||||
myExcel.Cells[2, 1] = DrugName;//默认的就是在sheet1里面的。
|
||||
int startIndex = 3;
|
||||
|
||||
@ -327,11 +327,11 @@ namespace AIMS.OperationAfter.UI
|
||||
item.Value = table.Rows[i][0].ToString();
|
||||
cnoDrugName.Items.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (comboBoxExType.Text == "") return;
|
||||
if (cnoDrugName.Text == "") return;
|
||||
if (cnoDrugName.Text == "") return;
|
||||
foreach (DataGridViewRow item in dgvDrugs.Rows)
|
||||
{
|
||||
string feerid = item.Cells[0].EditedFormattedValue.ToString();
|
||||
@ -343,7 +343,7 @@ namespace AIMS.OperationAfter.UI
|
||||
//report.LimitDrug = item.Cells[2].EditedFormattedValue.ToString();
|
||||
BFeesRecord.Update(report);
|
||||
}
|
||||
MessageBox.Show("保存成功!", "系统提示");
|
||||
MessageBox.Show("保存成功!", "系统提示");
|
||||
}
|
||||
|
||||
private void dgvDrugs_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
|
||||
@ -352,7 +352,7 @@ namespace AIMS.OperationAfter.UI
|
||||
this.dgvDrugs.RowsDefaultCellStyle.BackColor = Color.White;//设置背景为白色
|
||||
this.dgvDrugs.AlternatingRowsDefaultCellStyle.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(222)))), (((int)(((byte)242)))));//青色
|
||||
}
|
||||
|
||||
|
||||
private void dgvDrugs_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
DialogResult dialog = MessageBox.Show("是否批量填写数据?", "系统提示", MessageBoxButtons.YesNo);
|
||||
@ -376,5 +376,205 @@ namespace AIMS.OperationAfter.UI
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void toolStripButton3_Click(object sender, EventArgs e)
|
||||
{
|
||||
KillAllExcel();
|
||||
if (dgvDrugs.Rows.Count <= 0) return;
|
||||
List<DataGridViewRow> groupedList = new List<DataGridViewRow>();
|
||||
foreach (DataGridViewRow item in dgvDrugs.Rows)
|
||||
{
|
||||
groupedList.Add(item);
|
||||
}
|
||||
int n = 21;
|
||||
List<List<DataGridViewRow>> groupedLists = new List<List<DataGridViewRow>>();
|
||||
for (int i = 0; i < groupedList.Count; i += n)
|
||||
{
|
||||
List<DataGridViewRow> group = groupedList.GetRange(i, Math.Min(n, groupedList.Count - i));
|
||||
groupedLists.Add(group);
|
||||
}
|
||||
|
||||
foreach (List<DataGridViewRow> item in groupedLists)
|
||||
{
|
||||
ExprotExcel3(item, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void ExprotExcel3(List<DataGridViewRow> itemlist, bool isPrint = false)
|
||||
{
|
||||
//自定义表头
|
||||
string title = "麻醉、精一药品注射剂使用、及残余液处理登记表";
|
||||
|
||||
//是否横向
|
||||
bool xlLandscape = true;
|
||||
if (dataGridViewSetting != null && dataGridViewSetting.Landscape == false) xlLandscape = false;
|
||||
//主体字体大小
|
||||
int BodySize = 9;
|
||||
if (dataGridViewSetting != null && dataGridViewSetting.FontSize > 0) BodySize = dataGridViewSetting.FontSize;
|
||||
|
||||
myExcel = new Microsoft.Office.Interop.Excel.Application();
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
//保存文化环境
|
||||
System.Globalization.CultureInfo CurrentCI = System.Threading.Thread.CurrentThread.CurrentCulture;
|
||||
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
|
||||
|
||||
Workbook workbookData = myExcel.Workbooks.Add(Missing.Value);
|
||||
Worksheet xlSheet = (Microsoft.Office.Interop.Excel.Worksheet)workbookData.Worksheets[1];
|
||||
|
||||
xlSheet.Name = title;
|
||||
|
||||
if (isPrint == false)
|
||||
myExcel.Visible = true;
|
||||
|
||||
myExcel.Cells[1, 1] = title;//默认的就是在sheet1里面的。
|
||||
string DrugName = "科室:麻醉科";
|
||||
myExcel.Cells[2, 1] = DrugName;//默认的就是在sheet1里面的。
|
||||
int startIndex = 3;
|
||||
|
||||
WorksheetClass wsClass = new WorksheetClass();
|
||||
|
||||
Dictionary<int, string> Columns = new Dictionary<int, string>();
|
||||
//填充标题
|
||||
for (int i = 0; i < dgvDrugs.Columns.Count; i++)
|
||||
{
|
||||
if (dataGridViewSetting != null)
|
||||
{
|
||||
foreach (var item in dataGridViewSetting.Exports)
|
||||
{
|
||||
if (dgvDrugs.Columns[i].Name == item.Name)
|
||||
{
|
||||
if (item.IsPrint == true)
|
||||
{
|
||||
Columns.Add(i, dgvDrugs.Columns[i].HeaderText);
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dgvDrugs.Columns[i].Visible == true)
|
||||
Columns.Add(i, dgvDrugs.Columns[i].HeaderText);
|
||||
}
|
||||
}
|
||||
|
||||
List<KeyValuePair<int, string>> ColumnsStr = Columns.ToList();
|
||||
|
||||
for (int i = 0; i < ColumnsStr.Count; i++)
|
||||
{
|
||||
myExcel.Cells[startIndex, i + 1] = ColumnsStr[i].Value;
|
||||
if (dataGridViewSetting != null)
|
||||
{
|
||||
foreach (var item in dataGridViewSetting.Exports)
|
||||
{
|
||||
if (ColumnsStr[i].Value == item.Text)
|
||||
{
|
||||
xlSheet.get_Range(xlSheet.Cells[startIndex, i + 1], xlSheet.Cells[startIndex, i + 1]).ColumnWidth = item.PrintWidth;//列宽
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xlSheet.get_Range(xlSheet.Cells[startIndex, i + 1], xlSheet.Cells[startIndex, i + 1]).ColumnWidth = 5;//列宽
|
||||
}
|
||||
}
|
||||
//获得数据表的值
|
||||
int RowCount = itemlist.Count;
|
||||
int colCount = ColumnsStr.Count;
|
||||
//设置填充单元格样式
|
||||
xlSheet.get_Range(xlSheet.Cells[startIndex, 1], xlSheet.Cells[RowCount + startIndex, colCount]).Borders.LineStyle = XlLineStyle.xlContinuous;//边框的样式
|
||||
object[,] objData = new object[RowCount, colCount];
|
||||
|
||||
//将DataTable里的值填充到对象数组中
|
||||
for (int i = 0; i < RowCount; i++)
|
||||
{
|
||||
for (int j = 0; j < colCount; j++)
|
||||
{
|
||||
if (dgvDrugs.Columns[ColumnsStr[j].Key].Name == "序号" || dgvDrugs.Columns[ColumnsStr[j].Key].Name == "ApplyId")
|
||||
objData[i, j] = i + 1;
|
||||
else if (itemlist[i].Cells[ColumnsStr[j].Key].Value != null)
|
||||
objData[i, j] = itemlist[i].Cells[ColumnsStr[j].Key].Value.ToString().Trim();
|
||||
}
|
||||
System.Windows.Forms.Application.DoEvents();
|
||||
}
|
||||
|
||||
//将对象数组的值赋值给Excel
|
||||
Range range = xlSheet.get_Range(xlSheet.Cells[4, 1], xlSheet.Cells[RowCount + startIndex, colCount]);
|
||||
range.NumberFormat = "@";
|
||||
range.Value2 = objData;
|
||||
range.RowHeight = 19;
|
||||
//xlSheet.get_Range(xlSheet.Cells[2, 1], xlSheet.Cells[RowCount + 2, colCount]).Font.Size = BodySize;//字体大小
|
||||
|
||||
//设置主标题单元格的样式
|
||||
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).MergeCells = true;//合并单元格
|
||||
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).HorizontalAlignment = XlHAlign.xlHAlignCenter;//水平对齐方式
|
||||
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).VerticalAlignment = XlVAlign.xlVAlignCenter;//垂直对齐方式
|
||||
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).Font.Bold = true;//字体加粗
|
||||
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).Font.ColorIndex = 0;//字体颜色
|
||||
//xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).Font.Italic = true;//是否斜体
|
||||
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).Font.Size = 20;//字体大小
|
||||
//xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[2, colCount]).Borders.LineStyle = XlLineStyle.xlContinuous;//边框样式
|
||||
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).RowHeight = 33.75;//行高
|
||||
|
||||
xlSheet.get_Range(xlSheet.Cells[2, 1], xlSheet.Cells[2, colCount]).MergeCells = true;//合并单元格
|
||||
|
||||
//设置标题单元格样式
|
||||
xlSheet.get_Range(xlSheet.Cells[2, 1], xlSheet.Cells[startIndex, colCount]).RowHeight = 21;//行高
|
||||
|
||||
if (xlLandscape == true)
|
||||
xlSheet.PageSetup.Orientation = XlPageOrientation.xlLandscape;//页面方向为横向
|
||||
//复苏文化环境
|
||||
System.Threading.Thread.CurrentThread.CurrentCulture = CurrentCI;
|
||||
try
|
||||
{
|
||||
if (isPrint == true)
|
||||
xlSheet.PrintOutEx();
|
||||
//myExcel.Save(@"D:a.xls");
|
||||
//myExcel.Quit();
|
||||
this.Cursor = Cursors.Default;
|
||||
//MessageBox.Show("导出成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (isPrint == true)
|
||||
{
|
||||
//释放资源
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlSheet);
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(workbookData);
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(range);
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(myExcel);
|
||||
GC.Collect();
|
||||
range = null;
|
||||
xlSheet = null;
|
||||
workbookData = null;
|
||||
myExcel = null;
|
||||
KillAllExcel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void toolStripButton4_Click(object sender, EventArgs e)
|
||||
{
|
||||
string beginTime = Convert.ToDateTime(dtpOpeTime.Value).ToString("yyyy-MM-dd 00:00:00");
|
||||
string endTime = Convert.ToDateTime(dtpEnd.Value).ToString("yyyy-MM-dd 23:59:59");
|
||||
string sql = string.Format(" ExecTime>='{0}' and ExecTime<'{1}'", beginTime, endTime);
|
||||
if (comboBoxExType.SelectedItem != null)
|
||||
{
|
||||
ComboItem chargitem = comboBoxExType.SelectedItem as ComboItem;
|
||||
sql += " and (FeeTypeId = '" + chargitem.Value + "' ) ";
|
||||
}
|
||||
if (cnoDrugName.SelectedItem != null)
|
||||
{
|
||||
ComboItem chargitem = cnoDrugName.SelectedItem as ComboItem;
|
||||
sql += " and (ChargName = '" + chargitem.Value + "' ) ";
|
||||
}
|
||||
if (FeeType != "")
|
||||
{
|
||||
sql += " and (FeeType = '" + FeeType + "' ) ";
|
||||
}
|
||||
BFeesRecordReport.UpdateChargcyl(sql);
|
||||
btnOK_Click(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
31
AIMS/OperationAfter/frmOperationCharg5.designer.cs
generated
31
AIMS/OperationAfter/frmOperationCharg5.designer.cs
generated
@ -37,6 +37,7 @@
|
||||
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
|
||||
this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripButton3 = new System.Windows.Forms.ToolStripButton();
|
||||
this.cboRoom = new DevComponents.DotNetBar.Controls.ComboBoxEx();
|
||||
this.label22 = new System.Windows.Forms.Label();
|
||||
this.tsbSettingDGV = new System.Windows.Forms.Button();
|
||||
@ -90,6 +91,7 @@
|
||||
this.dataGridViewTextBoxColumn31 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.dgvDrugs = new DevComponents.DotNetBar.Controls.DataGridViewX();
|
||||
this.dataGridViewTextBoxColumn21 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.toolStripButton4 = new System.Windows.Forms.ToolStripButton();
|
||||
this.panel1.SuspendLayout();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
@ -120,7 +122,9 @@
|
||||
this.toolStrip1.ImageScalingSize = new System.Drawing.Size(25, 25);
|
||||
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripButton2,
|
||||
this.toolStripButton1});
|
||||
this.toolStripButton1,
|
||||
this.toolStripButton3,
|
||||
this.toolStripButton4});
|
||||
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStrip1.Name = "toolStrip1";
|
||||
this.toolStrip1.Size = new System.Drawing.Size(1350, 49);
|
||||
@ -149,6 +153,17 @@
|
||||
this.toolStripButton1.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
|
||||
this.toolStripButton1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// toolStripButton3
|
||||
//
|
||||
this.toolStripButton3.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.toolStripButton3.Image = global::AIMS.Properties.Resources.图标_手术排程;
|
||||
this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButton3.Name = "toolStripButton3";
|
||||
this.toolStripButton3.Size = new System.Drawing.Size(65, 46);
|
||||
this.toolStripButton3.Text = "打印Excel";
|
||||
this.toolStripButton3.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
|
||||
this.toolStripButton3.Click += new System.EventHandler(this.toolStripButton3_Click);
|
||||
//
|
||||
// cboRoom
|
||||
//
|
||||
this.cboRoom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
@ -762,6 +777,18 @@
|
||||
this.dataGridViewTextBoxColumn21.Visible = false;
|
||||
this.dataGridViewTextBoxColumn21.Width = 30;
|
||||
//
|
||||
// toolStripButton4
|
||||
//
|
||||
this.toolStripButton4.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
|
||||
this.toolStripButton4.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.toolStripButton4.Image = global::AIMS.Properties.Resources.图标_刷新;
|
||||
this.toolStripButton4.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButton4.Name = "toolStripButton4";
|
||||
this.toolStripButton4.Size = new System.Drawing.Size(72, 46);
|
||||
this.toolStripButton4.Text = "更新残余量";
|
||||
this.toolStripButton4.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
|
||||
this.toolStripButton4.Click += new System.EventHandler(this.toolStripButton4_Click);
|
||||
//
|
||||
// frmOperationCharg5
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
@ -848,5 +875,7 @@
|
||||
private System.Windows.Forms.ToolStrip toolStrip1;
|
||||
private System.Windows.Forms.ToolStripButton toolStripButton1;
|
||||
private System.Windows.Forms.ToolStripButton toolStripButton2;
|
||||
private System.Windows.Forms.ToolStripButton toolStripButton3;
|
||||
private System.Windows.Forms.ToolStripButton toolStripButton4;
|
||||
}
|
||||
}
|
||||
@ -101,5 +101,23 @@ LEFT JOIN V_OperationRecordInfo voi on voi.RecoredId=FeesRecord.OperationRecordI
|
||||
DataTable dt = DBHelper.GetDataTable(sql);
|
||||
return dt;
|
||||
}
|
||||
public static void UpdateChargcyl(string where)
|
||||
{
|
||||
string sql = string.Format(@"
|
||||
Update [FeesRecord] set IsInsure=(select convert(nvarchar(10),(num*Qty)-Qty2 )+ unitt from (
|
||||
SELECT fr.Id
|
||||
,[FeeNum] num
|
||||
,[Extend1] unitt
|
||||
, CASE WHEN ISNUMERIC( fr.[Extend2] )=1 AND fr.[Extend2] not LIKE '%[^0-9.]%'
|
||||
THEN CAST( fr.[Extend2] AS DECIMAL(19,6))
|
||||
ELSE 0.0 END AS Qty2
|
||||
, CASE WHEN ISNUMERIC(Drugs.Dosage )=1 AND Drugs.Dosage not LIKE '%[^0-9.]%'
|
||||
THEN CAST( Drugs.Dosage AS DECIMAL(19,6))
|
||||
ELSE 0.0 END AS Qty
|
||||
FROM [dbo].[FeesRecord] fr
|
||||
left join Drugs on fr.FeeId =Drugs.Id where fr.Id= [FeesRecord].Id) temp)
|
||||
where FeeIsDrug=1 and FeesRecord.Extend4<>'' and {0}", where);
|
||||
DBHelper.ExecuteScalar(sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
4
DrawGraphManagement/AreaManageForm.Designer.cs
generated
4
DrawGraphManagement/AreaManageForm.Designer.cs
generated
@ -72,7 +72,7 @@
|
||||
this.txtInstanceName = new System.Windows.Forms.ComboBox();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.panel4 = new System.Windows.Forms.Panel();
|
||||
this.panelzgc = new DrawGraphManagement.MyPanel();
|
||||
this.panelzgc = new System.Windows.Forms.Panel();
|
||||
this.alignCmdOfPackPnl = new System.Windows.Forms.Panel();
|
||||
this.btnAlignCmd = new System.Windows.Forms.Button();
|
||||
this.cmbPackAlignType = new System.Windows.Forms.ComboBox();
|
||||
@ -1086,7 +1086,7 @@
|
||||
private System.Windows.Forms.TreeView treeView1;
|
||||
private System.Windows.Forms.Panel panel3;
|
||||
private System.Windows.Forms.Panel panel4;
|
||||
private MyPanel panelzgc;
|
||||
private System.Windows.Forms.Panel panelzgc;
|
||||
public DrawGraph.ZedGraphControl zedGraphControl1;
|
||||
private System.Windows.Forms.ColorDialog colorDialog1;
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
|
||||
@ -77,8 +77,16 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\AIMS\Extensions\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PdfiumViewer, Version=2.13.0.0, Culture=neutral, PublicKeyToken=91e4789cfb0609e0, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>.\PdfiumViewer.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="ReachFramework" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Printing" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@ -87,6 +95,7 @@
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AreaManageForm.cs">
|
||||
@ -102,18 +111,18 @@
|
||||
<Compile Include="frmTemplateD.designer.cs">
|
||||
<DependentUpon>frmTemplateD.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainUp.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainUp.Designer.cs">
|
||||
<DependentUpon>MainUp.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Main.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Main.Designer.cs">
|
||||
<DependentUpon>Main.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MyPanel.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MyPanel.Designer.cs">
|
||||
<DependentUpon>MyPanel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MyUserControl\ConvertModeForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -124,6 +133,7 @@
|
||||
<Compile Include="MyUserControl\UCBase.cs" />
|
||||
<Compile Include="MyUserControl\UCColor.cs" />
|
||||
<Compile Include="MyUserControl\UCSelect.cs" />
|
||||
<Compile Include="PdfFilePrinter.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="AreaManageForm.resx">
|
||||
@ -132,12 +142,12 @@
|
||||
<EmbeddedResource Include="frmTemplateD.resx">
|
||||
<DependentUpon>frmTemplateD.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MainUp.resx">
|
||||
<DependentUpon>MainUp.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Main.resx">
|
||||
<DependentUpon>Main.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MyPanel.resx">
|
||||
<DependentUpon>MyPanel.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MyUserControl\ConvertModeForm.resx">
|
||||
<DependentUpon>ConvertModeForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@ -151,6 +161,7 @@
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
@ -166,6 +177,9 @@
|
||||
<Content Include="AIMS.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="PdfiumViewer.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
|
||||
17
DrawGraphManagement/Main.Designer.cs
generated
17
DrawGraphManagement/Main.Designer.cs
generated
@ -72,9 +72,8 @@
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.txtAreaX = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.myPanel1 = new DrawGraphManagement.MyPanel();
|
||||
this.myPanel1 = new System.Windows.Forms.Panel();
|
||||
this.zedGraphMain = new DrawGraph.ZedGraphControl();
|
||||
this.btnPrint = new System.Windows.Forms.Button();
|
||||
this.panel1.SuspendLayout();
|
||||
this.panel4.SuspendLayout();
|
||||
this.pnlManageList.SuspendLayout();
|
||||
@ -179,7 +178,6 @@
|
||||
this.panel4.Controls.Add(this.button10);
|
||||
this.panel4.Controls.Add(this.button2);
|
||||
this.panel4.Controls.Add(this.btnCreate);
|
||||
this.panel4.Controls.Add(this.btnPrint);
|
||||
this.panel4.Controls.Add(this.btnSave);
|
||||
this.panel4.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.panel4.Location = new System.Drawing.Point(0, 4);
|
||||
@ -545,16 +543,6 @@
|
||||
this.zedGraphMain.KeyUp += new System.Windows.Forms.KeyEventHandler(this.zedGraphMain_KeyUp);
|
||||
this.zedGraphMain.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.zedGraphMain_MouseDoubleClick);
|
||||
//
|
||||
// btnPrint
|
||||
//
|
||||
this.btnPrint.Location = new System.Drawing.Point(1067, 7);
|
||||
this.btnPrint.Name = "btnPrint";
|
||||
this.btnPrint.Size = new System.Drawing.Size(59, 23);
|
||||
this.btnPrint.TabIndex = 5;
|
||||
this.btnPrint.Text = "打印";
|
||||
this.btnPrint.UseVisualStyleBackColor = true;
|
||||
this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
|
||||
//
|
||||
// Main
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
@ -609,7 +597,7 @@
|
||||
private System.Windows.Forms.Button BtnBind;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private MyPanel myPanel1;
|
||||
private System.Windows.Forms.Panel myPanel1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.TextBox txtHospitalName;
|
||||
@ -629,6 +617,5 @@
|
||||
private System.Windows.Forms.Button button10;
|
||||
private System.Windows.Forms.Button button11;
|
||||
private System.Windows.Forms.Button button12;
|
||||
private System.Windows.Forms.Button btnPrint;
|
||||
}
|
||||
}
|
||||
@ -815,174 +815,6 @@ namespace DrawGraphManagement
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void btnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (textBox1.Text == "") return;
|
||||
try
|
||||
{
|
||||
mPanes = new List<MasterPane>();
|
||||
UpPanes = new List<MasterPane>();
|
||||
|
||||
PrintDocPage(null, null);
|
||||
|
||||
count = 0;
|
||||
int pylWidth = 3;
|
||||
System.Drawing.Printing.PrintDocument pDoc = new System.Drawing.Printing.PrintDocument();
|
||||
pDoc.DefaultPageSettings.Landscape = false;
|
||||
pDoc.OriginAtMargins = true;
|
||||
pDoc.DefaultPageSettings.PrinterResolution.Kind = PrinterResolutionKind.High;
|
||||
pDoc.DefaultPageSettings.Margins = new Margins(pylWidth, 0, 0, 0);
|
||||
pDoc.PrintPage -= new PrintPageEventHandler(pDoc_PrintPage);
|
||||
pDoc.PrintPage += new PrintPageEventHandler(pDoc_PrintPage);
|
||||
|
||||
System.Windows.Forms.PrintDialog pDlg = new System.Windows.Forms.PrintDialog();
|
||||
pDlg.Document = pDoc;
|
||||
if (pDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
pDoc.Print();
|
||||
}
|
||||
count = 0;
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
PublicMethod.WriteLog(exp, "");
|
||||
}
|
||||
}
|
||||
public List<MasterPane> mPanes = new List<MasterPane>();
|
||||
public List<MasterPane> UpPanes = new List<MasterPane>();
|
||||
int m_startPrintPage;// 打印的起始页码
|
||||
int m_endPrintPage;//打印的终止页码
|
||||
int count = 0;
|
||||
private void pDoc_PrintPage(object sender, PrintPageEventArgs e)
|
||||
{
|
||||
System.Drawing.Printing.PrintDocument pDoc = sender as System.Drawing.Printing.PrintDocument;
|
||||
m_startPrintPage = pDoc.PrinterSettings.FromPage;
|
||||
m_endPrintPage = pDoc.PrinterSettings.ToPage;
|
||||
|
||||
int printCount = mPanes.Count;
|
||||
if (mPanes.Count > 0 && count < printCount)
|
||||
{
|
||||
mPanes[count].Draw(e.Graphics);
|
||||
count++;
|
||||
if (count < printCount)
|
||||
{
|
||||
e.HasMorePages = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
e.HasMorePages = false;
|
||||
}
|
||||
}
|
||||
private void PrintDocPage(object sender, PrintPageEventArgs e)
|
||||
{
|
||||
OperationRecord _record = operationRecor as OperationRecord;
|
||||
if (_record.currentPage == 1)
|
||||
{
|
||||
PrintDocPane(e, zedGraphMain, templateManage, true);
|
||||
//PrintDocPane(e, zgcAnaesRecord2, templateManage2, false);
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// for (int i = 1; i <= _record.pageCount; i++)
|
||||
// {
|
||||
// PrintDocPane(e, zgcAnaesRecord, templateManage, true);
|
||||
// if (i == 1)
|
||||
// {
|
||||
// PrintDocPane(e, zgcAnaesRecord2, templateManage2, false);
|
||||
// }
|
||||
// btnNextPage_Click(null, null);
|
||||
// if (i != 1)
|
||||
// {
|
||||
// MasterPane mPane = new MasterPane();
|
||||
// mPane.Border.IsVisible = false;
|
||||
// mPanes.Add(mPane);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void PrintDocPane(PrintPageEventArgs e, ZedGraphControl zedGraph, TemplateManage template, bool InitChart)
|
||||
{
|
||||
OperationRecord _record = operationRecor as OperationRecord;
|
||||
foreach (AreaManageBase area in template.ManageList)
|
||||
{
|
||||
area.setPrint(false);
|
||||
area.BindTempData();
|
||||
}
|
||||
int zedGraphMainWidth = zedGraph.Size.Width;
|
||||
int zedGraphMainHeight = zedGraph.Size.Height;
|
||||
|
||||
int width = 825;
|
||||
int height = Convert.ToInt32(width * 1.414) + 2;
|
||||
zedGraph.Size = new Size(width, height);
|
||||
zedGraph.Width = width;
|
||||
zedGraph.Height = height;
|
||||
|
||||
if (InitChart == true)
|
||||
foreach (PhysioDataConfig pp in _record.PhysioConfigList)
|
||||
{
|
||||
if (pp.ShowText == true)
|
||||
{
|
||||
pp.IsValid = false;
|
||||
///重新设置曲线属性
|
||||
pp.reSetCurveSpo2();
|
||||
}
|
||||
}
|
||||
TipBox.Hidden();
|
||||
|
||||
MasterPane mPane = zedGraph.MasterPane; //this.MasterPane;
|
||||
mPane.Border.IsVisible = false;
|
||||
//当前窗体中的矩形区域大小
|
||||
RectangleF saveRect = mPane.Rect;
|
||||
if (InitChart == true)
|
||||
template.initChart();
|
||||
mPanes.Add(mPane.Clone());
|
||||
if (e != null)
|
||||
mPane.Draw(e.Graphics); //在打印文档中画出MasterPane内容
|
||||
using (Graphics g = zedGraph.CreateGraphics())
|
||||
{
|
||||
mPane.ReSize(g, saveRect);
|
||||
}
|
||||
|
||||
zedGraph.Size = new Size(zedGraphMainWidth, zedGraphMainHeight);
|
||||
if (InitChart == true)
|
||||
template.initChart();
|
||||
UpPanes.Add(mPane.Clone());
|
||||
|
||||
if (InitChart == true)
|
||||
foreach (PhysioDataConfig pp in _record.PhysioConfigList)
|
||||
{
|
||||
if (pp.ShowText == true)
|
||||
{
|
||||
pp.IsValid = true;
|
||||
///重新设置曲线属性
|
||||
pp.reSetCurveSpo2();
|
||||
}
|
||||
}
|
||||
//if (InitChart == false)
|
||||
//{
|
||||
// int LocationY = Convert.ToInt32(templateManage2.ZedControl.Height * 0.065);
|
||||
// templateManage2.LocationY = LocationY;
|
||||
// templateManage2.SetPYL();
|
||||
// foreach (AreaManageBase area in template.ManageList)
|
||||
// {
|
||||
// area.setPrint(true);
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
int LocationY = Convert.ToInt32(templateManage.ZedControl.Height * 0.04);
|
||||
templateManage.LocationY = LocationY;
|
||||
templateManage.SetPYL();
|
||||
foreach (AreaManageBase area in template.ManageList)
|
||||
{
|
||||
area.setPrint(true);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
440
DrawGraphManagement/MainUp.Designer.cs
generated
Normal file
440
DrawGraphManagement/MainUp.Designer.cs
generated
Normal file
@ -0,0 +1,440 @@
|
||||
namespace DrawGraphManagement
|
||||
{
|
||||
partial class MainUp
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainUp));
|
||||
this.cmbManageList = new System.Windows.Forms.ComboBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.txtManageName = new System.Windows.Forms.TextBox();
|
||||
this.btnCreate = new System.Windows.Forms.Button();
|
||||
this.btnSave = new System.Windows.Forms.Button();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.panel4 = new System.Windows.Forms.Panel();
|
||||
this.button5 = new System.Windows.Forms.Button();
|
||||
this.button4 = new System.Windows.Forms.Button();
|
||||
this.button11 = new System.Windows.Forms.Button();
|
||||
this.BtnBind = new System.Windows.Forms.Button();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.button9 = new System.Windows.Forms.Button();
|
||||
this.button8 = new System.Windows.Forms.Button();
|
||||
this.button12 = new System.Windows.Forms.Button();
|
||||
this.button7 = new System.Windows.Forms.Button();
|
||||
this.button6 = new System.Windows.Forms.Button();
|
||||
this.button10 = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.btnPrint = new System.Windows.Forms.Button();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.txtProjectName = new System.Windows.Forms.TextBox();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.txtHospitalName = new System.Windows.Forms.TextBox();
|
||||
this.myPanel1 = new System.Windows.Forms.Panel();
|
||||
this.zgcAnaesRecord2 = new DrawGraph.ZedGraphControl();
|
||||
this.zgcAnaesRecord = new DrawGraph.ZedGraphControl();
|
||||
this.panel1.SuspendLayout();
|
||||
this.panel4.SuspendLayout();
|
||||
this.myPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// cmbManageList
|
||||
//
|
||||
this.cmbManageList.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
|
||||
this.cmbManageList.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
|
||||
this.cmbManageList.FormattingEnabled = true;
|
||||
this.cmbManageList.Location = new System.Drawing.Point(771, 10);
|
||||
this.cmbManageList.Name = "cmbManageList";
|
||||
this.cmbManageList.Size = new System.Drawing.Size(155, 20);
|
||||
this.cmbManageList.TabIndex = 0;
|
||||
this.cmbManageList.Visible = false;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(664, 14);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(101, 12);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "区域管理器类型:";
|
||||
this.label1.Visible = false;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(932, 14);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(101, 12);
|
||||
this.label2.TabIndex = 2;
|
||||
this.label2.Text = "区域管理器名称:";
|
||||
this.label2.Visible = false;
|
||||
//
|
||||
// txtManageName
|
||||
//
|
||||
this.txtManageName.Location = new System.Drawing.Point(1039, 10);
|
||||
this.txtManageName.Name = "txtManageName";
|
||||
this.txtManageName.Size = new System.Drawing.Size(180, 21);
|
||||
this.txtManageName.TabIndex = 3;
|
||||
this.txtManageName.Visible = false;
|
||||
//
|
||||
// btnCreate
|
||||
//
|
||||
this.btnCreate.Location = new System.Drawing.Point(1302, 8);
|
||||
this.btnCreate.Name = "btnCreate";
|
||||
this.btnCreate.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnCreate.TabIndex = 4;
|
||||
this.btnCreate.Text = "新建";
|
||||
this.btnCreate.UseVisualStyleBackColor = true;
|
||||
this.btnCreate.Visible = false;
|
||||
//
|
||||
// btnSave
|
||||
//
|
||||
this.btnSave.Location = new System.Drawing.Point(895, 7);
|
||||
this.btnSave.Name = "btnSave";
|
||||
this.btnSave.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnSave.TabIndex = 5;
|
||||
this.btnSave.Text = "保存";
|
||||
this.btnSave.UseVisualStyleBackColor = true;
|
||||
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.panel4);
|
||||
this.panel1.Controls.Add(this.label3);
|
||||
this.panel1.Controls.Add(this.txtProjectName);
|
||||
this.panel1.Controls.Add(this.cmbManageList);
|
||||
this.panel1.Controls.Add(this.label1);
|
||||
this.panel1.Controls.Add(this.label2);
|
||||
this.panel1.Controls.Add(this.txtManageName);
|
||||
this.panel1.Controls.Add(this.label7);
|
||||
this.panel1.Controls.Add(this.txtHospitalName);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(1350, 46);
|
||||
this.panel1.TabIndex = 6;
|
||||
//
|
||||
// panel4
|
||||
//
|
||||
this.panel4.Controls.Add(this.button5);
|
||||
this.panel4.Controls.Add(this.button4);
|
||||
this.panel4.Controls.Add(this.button11);
|
||||
this.panel4.Controls.Add(this.BtnBind);
|
||||
this.panel4.Controls.Add(this.label6);
|
||||
this.panel4.Controls.Add(this.textBox1);
|
||||
this.panel4.Controls.Add(this.button9);
|
||||
this.panel4.Controls.Add(this.button8);
|
||||
this.panel4.Controls.Add(this.button12);
|
||||
this.panel4.Controls.Add(this.button7);
|
||||
this.panel4.Controls.Add(this.button6);
|
||||
this.panel4.Controls.Add(this.button10);
|
||||
this.panel4.Controls.Add(this.button2);
|
||||
this.panel4.Controls.Add(this.btnCreate);
|
||||
this.panel4.Controls.Add(this.btnPrint);
|
||||
this.panel4.Controls.Add(this.btnSave);
|
||||
this.panel4.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.panel4.Location = new System.Drawing.Point(0, 4);
|
||||
this.panel4.Name = "panel4";
|
||||
this.panel4.Size = new System.Drawing.Size(1350, 42);
|
||||
this.panel4.TabIndex = 9;
|
||||
//
|
||||
// button5
|
||||
//
|
||||
this.button5.Location = new System.Drawing.Point(1394, 15);
|
||||
this.button5.Name = "button5";
|
||||
this.button5.Size = new System.Drawing.Size(75, 23);
|
||||
this.button5.TabIndex = 16;
|
||||
this.button5.Text = "清空";
|
||||
this.button5.UseVisualStyleBackColor = true;
|
||||
this.button5.Visible = false;
|
||||
this.button5.Click += new System.EventHandler(this.button5_Click);
|
||||
//
|
||||
// button4
|
||||
//
|
||||
this.button4.Location = new System.Drawing.Point(1313, 15);
|
||||
this.button4.Name = "button4";
|
||||
this.button4.Size = new System.Drawing.Size(75, 23);
|
||||
this.button4.TabIndex = 15;
|
||||
this.button4.Text = "默认";
|
||||
this.button4.UseVisualStyleBackColor = true;
|
||||
this.button4.Visible = false;
|
||||
this.button4.Click += new System.EventHandler(this.button4_Click);
|
||||
//
|
||||
// button11
|
||||
//
|
||||
this.button11.Location = new System.Drawing.Point(981, 6);
|
||||
this.button11.Name = "button11";
|
||||
this.button11.Size = new System.Drawing.Size(75, 23);
|
||||
this.button11.TabIndex = 12;
|
||||
this.button11.Text = "文书加载";
|
||||
this.button11.UseVisualStyleBackColor = true;
|
||||
this.button11.Click += new System.EventHandler(this.button11_Click);
|
||||
//
|
||||
// BtnBind
|
||||
//
|
||||
this.BtnBind.Location = new System.Drawing.Point(809, 7);
|
||||
this.BtnBind.Name = "BtnBind";
|
||||
this.BtnBind.Size = new System.Drawing.Size(75, 23);
|
||||
this.BtnBind.TabIndex = 11;
|
||||
this.BtnBind.Text = "加载数据";
|
||||
this.BtnBind.UseVisualStyleBackColor = true;
|
||||
this.BtnBind.Click += new System.EventHandler(this.BtnBind_Click);
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(20, 13);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(53, 12);
|
||||
this.label6.TabIndex = 9;
|
||||
this.label6.Text = "患者ID:";
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(81, 9);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(59, 21);
|
||||
this.textBox1.TabIndex = 10;
|
||||
this.textBox1.Text = "786";
|
||||
//
|
||||
// button9
|
||||
//
|
||||
this.button9.Location = new System.Drawing.Point(321, 7);
|
||||
this.button9.Name = "button9";
|
||||
this.button9.Size = new System.Drawing.Size(107, 23);
|
||||
this.button9.TabIndex = 6;
|
||||
this.button9.Text = "麻醉记录单2背面";
|
||||
this.button9.UseVisualStyleBackColor = true;
|
||||
this.button9.Click += new System.EventHandler(this.button9_Click);
|
||||
//
|
||||
// button8
|
||||
//
|
||||
this.button8.Location = new System.Drawing.Point(609, 7);
|
||||
this.button8.Name = "button8";
|
||||
this.button8.Size = new System.Drawing.Size(102, 23);
|
||||
this.button8.TabIndex = 6;
|
||||
this.button8.Text = "器械清点单背面";
|
||||
this.button8.UseVisualStyleBackColor = true;
|
||||
this.button8.Click += new System.EventHandler(this.button8_Click);
|
||||
//
|
||||
// button12
|
||||
//
|
||||
this.button12.Location = new System.Drawing.Point(722, 7);
|
||||
this.button12.Name = "button12";
|
||||
this.button12.Size = new System.Drawing.Size(76, 23);
|
||||
this.button12.TabIndex = 6;
|
||||
this.button12.Text = "镇静记录单";
|
||||
this.button12.UseVisualStyleBackColor = true;
|
||||
this.button12.Click += new System.EventHandler(this.button12_Click);
|
||||
//
|
||||
// button7
|
||||
//
|
||||
this.button7.Location = new System.Drawing.Point(523, 7);
|
||||
this.button7.Name = "button7";
|
||||
this.button7.Size = new System.Drawing.Size(75, 23);
|
||||
this.button7.TabIndex = 6;
|
||||
this.button7.Text = "器械清点单";
|
||||
this.button7.UseVisualStyleBackColor = true;
|
||||
this.button7.Click += new System.EventHandler(this.button7_Click);
|
||||
//
|
||||
// button6
|
||||
//
|
||||
this.button6.Location = new System.Drawing.Point(439, 7);
|
||||
this.button6.Name = "button6";
|
||||
this.button6.Size = new System.Drawing.Size(73, 23);
|
||||
this.button6.TabIndex = 6;
|
||||
this.button6.Text = "恢复记录单";
|
||||
this.button6.UseVisualStyleBackColor = true;
|
||||
this.button6.Click += new System.EventHandler(this.button6_Click);
|
||||
//
|
||||
// button10
|
||||
//
|
||||
this.button10.Location = new System.Drawing.Point(230, 7);
|
||||
this.button10.Name = "button10";
|
||||
this.button10.Size = new System.Drawing.Size(80, 23);
|
||||
this.button10.TabIndex = 6;
|
||||
this.button10.Text = "麻醉记录单2";
|
||||
this.button10.UseVisualStyleBackColor = true;
|
||||
this.button10.Click += new System.EventHandler(this.button10_Click);
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(146, 7);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(73, 23);
|
||||
this.button2.TabIndex = 6;
|
||||
this.button2.Text = "麻醉记录单";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// btnPrint
|
||||
//
|
||||
this.btnPrint.Location = new System.Drawing.Point(1067, 7);
|
||||
this.btnPrint.Name = "btnPrint";
|
||||
this.btnPrint.Size = new System.Drawing.Size(59, 23);
|
||||
this.btnPrint.TabIndex = 5;
|
||||
this.btnPrint.Text = "打印";
|
||||
this.btnPrint.UseVisualStyleBackColor = true;
|
||||
this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(347, 14);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(65, 12);
|
||||
this.label3.TabIndex = 7;
|
||||
this.label3.Text = "项目名称:";
|
||||
this.label3.Visible = false;
|
||||
//
|
||||
// txtProjectName
|
||||
//
|
||||
this.txtProjectName.Location = new System.Drawing.Point(418, 10);
|
||||
this.txtProjectName.Name = "txtProjectName";
|
||||
this.txtProjectName.Size = new System.Drawing.Size(225, 21);
|
||||
this.txtProjectName.TabIndex = 8;
|
||||
this.txtProjectName.Visible = false;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(28, 14);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(65, 12);
|
||||
this.label7.TabIndex = 10;
|
||||
this.label7.Text = "医院名称:";
|
||||
//
|
||||
// txtHospitalName
|
||||
//
|
||||
this.txtHospitalName.Location = new System.Drawing.Point(99, 10);
|
||||
this.txtHospitalName.Name = "txtHospitalName";
|
||||
this.txtHospitalName.Size = new System.Drawing.Size(213, 21);
|
||||
this.txtHospitalName.TabIndex = 11;
|
||||
//
|
||||
// myPanel1
|
||||
//
|
||||
this.myPanel1.AutoScroll = true;
|
||||
this.myPanel1.Controls.Add(this.zgcAnaesRecord2);
|
||||
this.myPanel1.Controls.Add(this.zgcAnaesRecord);
|
||||
this.myPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.myPanel1.Location = new System.Drawing.Point(0, 46);
|
||||
this.myPanel1.Name = "myPanel1";
|
||||
this.myPanel1.Size = new System.Drawing.Size(1350, 683);
|
||||
this.myPanel1.TabIndex = 10;
|
||||
this.myPanel1.Scroll += new System.Windows.Forms.ScrollEventHandler(this.myPanel1_Scroll);
|
||||
//
|
||||
// zgcAnaesRecord2
|
||||
//
|
||||
this.zgcAnaesRecord2.Location = new System.Drawing.Point(266, -159);
|
||||
this.zgcAnaesRecord2.Name = "zgcAnaesRecord2";
|
||||
this.zgcAnaesRecord2.ScrollGrace = 0D;
|
||||
this.zgcAnaesRecord2.ScrollMaxX = 0D;
|
||||
this.zgcAnaesRecord2.ScrollMaxY = 0D;
|
||||
this.zgcAnaesRecord2.ScrollMaxY2 = 0D;
|
||||
this.zgcAnaesRecord2.ScrollMinX = 0D;
|
||||
this.zgcAnaesRecord2.ScrollMinY = 0D;
|
||||
this.zgcAnaesRecord2.ScrollMinY2 = 0D;
|
||||
this.zgcAnaesRecord2.Size = new System.Drawing.Size(800, 1000);
|
||||
this.zgcAnaesRecord2.TabIndex = 2;
|
||||
this.zgcAnaesRecord2.Visible = false;
|
||||
//
|
||||
// zgcAnaesRecord
|
||||
//
|
||||
this.zgcAnaesRecord.Location = new System.Drawing.Point(3, 3);
|
||||
this.zgcAnaesRecord.Name = "zgcAnaesRecord";
|
||||
this.zgcAnaesRecord.ScrollGrace = 0D;
|
||||
this.zgcAnaesRecord.ScrollMaxX = 0D;
|
||||
this.zgcAnaesRecord.ScrollMaxY = 0D;
|
||||
this.zgcAnaesRecord.ScrollMaxY2 = 0D;
|
||||
this.zgcAnaesRecord.ScrollMinX = 0D;
|
||||
this.zgcAnaesRecord.ScrollMinY = 0D;
|
||||
this.zgcAnaesRecord.ScrollMinY2 = 0D;
|
||||
this.zgcAnaesRecord.Size = new System.Drawing.Size(225, 304);
|
||||
this.zgcAnaesRecord.TabIndex = 1;
|
||||
this.zgcAnaesRecord.MouseDownEvent += new DrawGraph.ZedGraphControl.ZedMouseEventHandler(this.zgcAnaesRecord_MouseDownEvent);
|
||||
this.zgcAnaesRecord.MouseUpEvent += new DrawGraph.ZedGraphControl.ZedMouseEventHandler(this.zgcAnaesRecord_MouseUpEvent);
|
||||
this.zgcAnaesRecord.MouseMoveEvent += new DrawGraph.ZedGraphControl.ZedMouseEventHandler(this.zgcAnaesRecord_MouseMoveEvent);
|
||||
this.zgcAnaesRecord.KeyUp += new System.Windows.Forms.KeyEventHandler(this.zgcAnaesRecord_KeyUp);
|
||||
this.zgcAnaesRecord.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.zgcAnaesRecord_MouseDoubleClick);
|
||||
//
|
||||
// MainUp
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoScroll = true;
|
||||
this.ClientSize = new System.Drawing.Size(1350, 729);
|
||||
this.Controls.Add(this.myPanel1);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "MainUp";
|
||||
this.Text = "记录单制作工具";
|
||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
this.Load += new System.EventHandler(this.MainUp_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.panel4.ResumeLayout(false);
|
||||
this.panel4.PerformLayout();
|
||||
this.myPanel1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ComboBox cmbManageList;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TextBox txtManageName;
|
||||
private System.Windows.Forms.Button btnCreate;
|
||||
private System.Windows.Forms.Button btnSave;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private DrawGraph.ZedGraphControl zgcAnaesRecord;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.TextBox txtProjectName;
|
||||
private System.Windows.Forms.Panel panel4;
|
||||
private System.Windows.Forms.Button BtnBind;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Panel myPanel1;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.TextBox txtHospitalName;
|
||||
private System.Windows.Forms.Button button4;
|
||||
private System.Windows.Forms.Button button5;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.Button button6;
|
||||
private System.Windows.Forms.Button button7;
|
||||
private System.Windows.Forms.Button button8;
|
||||
private System.Windows.Forms.Button button9;
|
||||
private System.Windows.Forms.Button button10;
|
||||
private System.Windows.Forms.Button button11;
|
||||
private System.Windows.Forms.Button button12;
|
||||
private System.Windows.Forms.Button btnPrint;
|
||||
private DrawGraph.ZedGraphControl zgcAnaesRecord2;
|
||||
}
|
||||
}
|
||||
866
DrawGraphManagement/MainUp.cs
Normal file
866
DrawGraphManagement/MainUp.cs
Normal file
@ -0,0 +1,866 @@
|
||||
using AIMSBLL;
|
||||
using AIMSExtension;
|
||||
using AIMSModel;
|
||||
using DrawGraph;
|
||||
using HelperDB;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Printing;
|
||||
using System.IO;
|
||||
using System.IO.Packaging;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Xps;
|
||||
using System.Windows.Xps.Packaging;
|
||||
|
||||
namespace DrawGraphManagement
|
||||
{
|
||||
public partial class MainUp : Form
|
||||
{
|
||||
TemplateManage templateManage = new TemplateManage();
|
||||
TemplateManage templateManage2 = new TemplateManage();
|
||||
object operationRecor = new DrawGraph.OperationRecord();
|
||||
|
||||
public MainUp()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void MainUp_Load(object sender, EventArgs e)
|
||||
{
|
||||
HospitalInfo hospital = BHospitalInfo.SelectSingle(1);
|
||||
txtHospitalName.Text = hospital.HospitalName;
|
||||
Person PersonObj = BPerson.GetModelByNo("admin");
|
||||
AIMSExtension.PublicMethod.OperatorId = PersonObj.Id.Value;
|
||||
AIMSExtension.PublicMethod.OperatorNo = PersonObj.No;
|
||||
AIMSExtension.PublicMethod.OperatorName = PersonObj.Name;
|
||||
AIMSExtension.PublicMethod.RoleId = PersonObj.RoleId.Value;
|
||||
AIMSExtension.PublicMethod.DepId = PersonObj.DepId.Value;
|
||||
AIMSExtension.PublicMethod.DeptName = BDepartment.GetModel(PersonObj.DepId.Value).Name;
|
||||
Role role = BRole.GetModel(PersonObj.RoleId.Value);
|
||||
AIMSExtension.PublicMethod.PermissionLevel = role.PermissionLevel == null ? 0 : role.PermissionLevel.Value;
|
||||
AIMSExtension.PublicMethod.RoleName = BMenu.GetMenuRootListManageStr(AIMSExtension.PublicMethod.RoleId, "功能权限");
|
||||
myPanel1.MouseWheel += new System.Windows.Forms.MouseEventHandler(panel1_MouseWheel);
|
||||
LoadManageList();
|
||||
|
||||
button10_Click(null, null);
|
||||
BtnBind_Click(null, null);
|
||||
}
|
||||
/// <summary>
|
||||
/// 加载管理器列表
|
||||
/// </summary>
|
||||
private void LoadManageList()
|
||||
{
|
||||
Assembly assembly = Assembly.LoadFile(AppDomain.CurrentDomain.BaseDirectory + "DrawGraph.dll");//你的loadfile
|
||||
Type baseType = typeof(AreaManageBase);
|
||||
List<Type> types = assembly.GetTypes().Where<Type>(t => t.IsSubclassOf(baseType)).ToList<Type>();
|
||||
List<Type> viewTypes = types.Where<Type>(s => s.FullName.IndexOf(".document.") < 0).ToList<Type>();
|
||||
List<Type> wsTypes = types.Where<Type>(s => s.FullName.IndexOf(".document.") >= 0).ToList<Type>();
|
||||
|
||||
cmbManageList.Items.Clear();
|
||||
foreach (Type t in viewTypes)
|
||||
{
|
||||
cmbManageList.Items.Add(t.Name);
|
||||
}
|
||||
cmbManageList.Items.Add("-------------------");
|
||||
foreach (Type t in wsTypes)
|
||||
{
|
||||
cmbManageList.Items.Add(t.Name);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置界面自适应
|
||||
/// </summary>
|
||||
private void AutoSizeF()
|
||||
{
|
||||
#region 设置界面自适应
|
||||
if (templateManage.ZedControl == null) return;
|
||||
|
||||
if (templateManage.Typesetting == TypesettingEnum.Horizontal)
|
||||
{
|
||||
//在此处可随时设置板子的属性
|
||||
templateManage.ZedControl.Height = templateManage.GetPageWidth();
|
||||
templateManage.ZedControl.Width = Convert.ToInt32(templateManage.ZedControl.Height * 1.414) + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
//在此处可随时设置板子的属性
|
||||
templateManage.ZedControl.Width = templateManage.GetPageWidth();// templateManage.ZedControl.Parent.Width - 54;
|
||||
templateManage.ZedControl.Height = Convert.ToInt32(templateManage.ZedControl.Width * 1.414) + 2;
|
||||
}
|
||||
templateManage.ZedControl.AxisChange();
|
||||
templateManage.ZedControl.Refresh();
|
||||
//最后还要调整图表进行自适应
|
||||
PackObjBase pack = templateManage.GetPackObjectOTag<PackObjBase>("PhysioDataManage_ChartPackObj_6");
|
||||
if (pack != null)
|
||||
pack.Draw();
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 全部刷新
|
||||
/// </summary>
|
||||
private void AllRefresh()
|
||||
{
|
||||
foreach (AreaManageBase area in templateManage.ManageList)
|
||||
{
|
||||
List<PackObjBase> ables = area.PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
|
||||
foreach (PackObjBase pack in ables)
|
||||
{
|
||||
AbleEditPackObj ableEdit = pack as AbleEditPackObj;
|
||||
if (ableEdit != null) ableEdit.IsVisible = false;
|
||||
}
|
||||
}
|
||||
//画区域
|
||||
drawArea();
|
||||
}
|
||||
|
||||
private void drawArea()
|
||||
{
|
||||
templateManage.ZedControl = zgcAnaesRecord;
|
||||
templateManage.DrawArea();
|
||||
}
|
||||
|
||||
private void AllRefresh2()
|
||||
{
|
||||
foreach (AreaManageBase area in templateManage2.ManageList)
|
||||
{
|
||||
List<PackObjBase> ables = area.PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
|
||||
foreach (PackObjBase pack in ables)
|
||||
{
|
||||
AbleEditPackObj ableEdit = pack as AbleEditPackObj;
|
||||
if (ableEdit != null) ableEdit.IsVisible = false;
|
||||
}
|
||||
}
|
||||
//画区域
|
||||
drawArea2();
|
||||
}
|
||||
|
||||
private void drawArea2()
|
||||
{
|
||||
templateManage2.ZedControl = zgcAnaesRecord2;
|
||||
templateManage2.DrawArea();
|
||||
}
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool reVal = templateManage.Save();
|
||||
if (reVal)
|
||||
{
|
||||
new frmMessageBox().Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(templateManage.MsgStr);
|
||||
}
|
||||
}
|
||||
|
||||
private bool zgcAnaesRecord_MouseDownEvent(ZedGraphControl sender, MouseEventArgs e)
|
||||
{
|
||||
if (templateManage != null)
|
||||
{
|
||||
templateManage.zedControl_MouseDownEvent(sender, e);
|
||||
}
|
||||
return default(bool);
|
||||
}
|
||||
|
||||
private bool zgcAnaesRecord_MouseMoveEvent(ZedGraphControl sender, MouseEventArgs e)
|
||||
{
|
||||
if (templateManage != null)
|
||||
{
|
||||
templateManage.zedControl_MouseMoveEvent(sender, e);
|
||||
}
|
||||
return default(bool);
|
||||
}
|
||||
|
||||
private bool zgcAnaesRecord_MouseUpEvent(ZedGraphControl sender, MouseEventArgs e)
|
||||
{
|
||||
if (templateManage != null)
|
||||
{
|
||||
templateManage.zedControl_MouseUpEvent(sender, e);
|
||||
}
|
||||
return default(bool);
|
||||
}
|
||||
|
||||
private void zgcAnaesRecord_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (templateManage != null)
|
||||
{
|
||||
ZedGraphControl send = sender as ZedGraphControl;
|
||||
templateManage.zedControl_MouseDoubleClick(send, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void zgcAnaesRecord_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (templateManage != null)
|
||||
{
|
||||
ZedGraphControl send = sender as ZedGraphControl;
|
||||
templateManage.zedControl_KeyUp(send, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnBind_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (textBox1.Text == "") return;
|
||||
#region 绑定所有手术记录的值
|
||||
int id = 14;
|
||||
if (textBox1.Text != "") id = int.Parse(textBox1.Text);
|
||||
operationRecor = BOperationRecord.getRecord(new OperationRecord(), id, 1);
|
||||
templateManage.OpeRecord = operationRecor;
|
||||
|
||||
//指定对象的所有值属性的绑定
|
||||
templateManage.BindOperationRecordValueAll(templateManage.OpeRecord);
|
||||
//非值对象的数据绑定
|
||||
templateManage.Bind();
|
||||
|
||||
templateManage2.OpeRecord = operationRecor;
|
||||
|
||||
//指定对象的所有值属性的绑定
|
||||
templateManage2.BindOperationRecordValueAll(templateManage2.OpeRecord);
|
||||
//非值对象的数据绑定
|
||||
templateManage2.Bind();
|
||||
#endregion
|
||||
|
||||
foreach (AreaManageBase area in templateManage.ManageList)
|
||||
{
|
||||
area.setPrint(true);
|
||||
}
|
||||
foreach (AreaManageBase area in templateManage2.ManageList)
|
||||
{
|
||||
area.setPrint(true);
|
||||
}
|
||||
|
||||
zgcAnaesRecord.Refresh();
|
||||
zgcAnaesRecord2.Refresh();
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.Close();
|
||||
this.Close();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
private void panel1_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
templateManage.SetPYL();
|
||||
}
|
||||
private void myPanel1_Scroll(object sender, ScrollEventArgs e)
|
||||
{
|
||||
templateManage.SetPYL();
|
||||
}
|
||||
|
||||
private void button1_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
if (templateManage != null && templateManage.ManageList.Count > 0)
|
||||
{
|
||||
int OperationApplyId = 10;
|
||||
if (textBox1.Text.Trim() != "") OperationApplyId = int.Parse(textBox1.Text.Trim());
|
||||
DocumentParent documentParent = new DocumentParent();
|
||||
documentParent.OperationApplyId = OperationApplyId;
|
||||
//documentParent.OpeRecord = BOperationRecord.SelectSingle("OperationApplyId=@OperationApplyId", new ParameterList("@OperationApplyId", OperationApplyId), RecursiveType.Parent, 3);
|
||||
|
||||
if (templateManage.OpeRecord == null) return;
|
||||
//指定对象的所有值属性的绑定
|
||||
templateManage.BindOperationRecordValueAll(templateManage.OpeRecord);
|
||||
templateManage.SetPYL(); //得设置一下偏移量
|
||||
//非值对象的数据绑定
|
||||
templateManage.Bind();
|
||||
}
|
||||
}
|
||||
|
||||
private void button4_Click(object sender, EventArgs e)
|
||||
{
|
||||
templateManage.BindDefaultValue();
|
||||
}
|
||||
|
||||
private void button5_Click(object sender, EventArgs e)
|
||||
{
|
||||
templateManage.ClearEdit();
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (templateManage != null)
|
||||
{
|
||||
templateManage.ControlClear();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
string jsonStr = DBHelper.ExecuteScalar("SELECT [JsonDate] FROM [dbo].[OperationRecordTemplate] where id=1").ToString();
|
||||
if (jsonStr != null && jsonStr != "")
|
||||
{
|
||||
templateManage = JsonConvert.DeserializeObject<TemplateManage>(jsonStr);
|
||||
templateManage.ZedControl = zgcAnaesRecord;
|
||||
templateManage.OpeRecord = operationRecor;
|
||||
templateManage.Id = 1;
|
||||
bool reVal = templateManage.Load();
|
||||
if (reVal)
|
||||
{
|
||||
AllRefresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(templateManage.MsgStr);
|
||||
}
|
||||
AutoSizeF();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
private void button6_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (templateManage != null)
|
||||
{
|
||||
templateManage.ControlClear();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
string jsonStr = DBHelper.ExecuteScalar("SELECT [JsonDate] FROM [dbo].[OperationRecordTemplate] where id=10").ToString();
|
||||
if (jsonStr != null && jsonStr != "")
|
||||
{
|
||||
templateManage = JsonConvert.DeserializeObject<TemplateManage>(jsonStr);
|
||||
templateManage.ZedControl = zgcAnaesRecord;
|
||||
templateManage.OpeRecord = operationRecor;
|
||||
templateManage.Id = 10;
|
||||
bool reVal = templateManage.Load();
|
||||
if (reVal)
|
||||
{
|
||||
AllRefresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(templateManage.MsgStr);
|
||||
}
|
||||
AutoSizeF();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
private void button7_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (templateManage != null)
|
||||
{
|
||||
templateManage.ControlClear();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
string jsonStr = DBHelper.ExecuteScalar("SELECT [JsonDate] FROM [dbo].[OperationRecordTemplate] where id=20").ToString();
|
||||
if (jsonStr != null && jsonStr != "")
|
||||
{
|
||||
templateManage = JsonConvert.DeserializeObject<TemplateManage>(jsonStr);
|
||||
templateManage.ZedControl = zgcAnaesRecord;
|
||||
templateManage.OpeRecord = operationRecor;
|
||||
templateManage.Id = 20;
|
||||
bool reVal = templateManage.Load();
|
||||
if (reVal)
|
||||
{
|
||||
AllRefresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(templateManage.MsgStr);
|
||||
}
|
||||
AutoSizeF();
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void button9_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (templateManage != null)
|
||||
{
|
||||
templateManage.ControlClear();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
string jsonStr = DBHelper.ExecuteScalar("SELECT [JsonDate] FROM [dbo].[OperationRecordTemplate] where id=50").ToString();
|
||||
if (jsonStr != null && jsonStr != "")
|
||||
{
|
||||
templateManage = JsonConvert.DeserializeObject<TemplateManage>(jsonStr);
|
||||
templateManage.ZedControl = zgcAnaesRecord;
|
||||
templateManage.OpeRecord = operationRecor;
|
||||
templateManage.Id = 50;
|
||||
bool reVal = templateManage.Load();
|
||||
if (reVal)
|
||||
{
|
||||
AllRefresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(templateManage.MsgStr);
|
||||
}
|
||||
AutoSizeF();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void button8_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (templateManage != null)
|
||||
{
|
||||
templateManage.ControlClear();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
string jsonStr = DBHelper.ExecuteScalar("SELECT [JsonDate] FROM [dbo].[OperationRecordTemplate] where id=30").ToString();
|
||||
if (jsonStr != null && jsonStr != "")
|
||||
{
|
||||
templateManage = JsonConvert.DeserializeObject<TemplateManage>(jsonStr);
|
||||
templateManage.ZedControl = zgcAnaesRecord;
|
||||
templateManage.OpeRecord = operationRecor;
|
||||
templateManage.Id = 30;
|
||||
bool reVal = templateManage.Load();
|
||||
if (reVal)
|
||||
{
|
||||
AllRefresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(templateManage.MsgStr);
|
||||
}
|
||||
AutoSizeF();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void button10_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (templateManage != null)
|
||||
{
|
||||
templateManage.ControlClear();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
string jsonStr = DBHelper.ExecuteScalar("SELECT [JsonDate] FROM [dbo].[OperationRecordTemplate] where id=40").ToString();
|
||||
if (jsonStr != null && jsonStr != "")
|
||||
{
|
||||
templateManage = JsonConvert.DeserializeObject<TemplateManage>(jsonStr);
|
||||
templateManage.ZedControl = zgcAnaesRecord;
|
||||
templateManage.OpeRecord = operationRecor;
|
||||
templateManage.Id = 40;
|
||||
bool reVal = templateManage.Load();
|
||||
if (reVal)
|
||||
{
|
||||
AllRefresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(templateManage.MsgStr);
|
||||
}
|
||||
AutoSizeF();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
string jsonStr = DBHelper.ExecuteScalar("SELECT [JsonDate] FROM [dbo].[OperationRecordTemplate] where id=50").ToString();
|
||||
if (jsonStr != null && jsonStr != "")
|
||||
{
|
||||
templateManage2 = JsonConvert.DeserializeObject<TemplateManage>(jsonStr);
|
||||
templateManage2.ZedControl = zgcAnaesRecord2;
|
||||
templateManage2.OpeRecord = operationRecor;
|
||||
templateManage2.Id = 50;
|
||||
bool reVal = templateManage2.Load();
|
||||
if (reVal)
|
||||
{
|
||||
AllRefresh2();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(templateManage2.MsgStr);
|
||||
}
|
||||
AutoSizeF();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void button11_Click(object sender, EventArgs e)
|
||||
{
|
||||
frmTemplateD frmTemplateD = new frmTemplateD();
|
||||
frmTemplateD.Show();
|
||||
}
|
||||
|
||||
private void button12_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (templateManage != null)
|
||||
{
|
||||
templateManage.ControlClear();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
string jsonStr = DBHelper.ExecuteScalar("SELECT [JsonDate] FROM [dbo].[OperationRecordTemplate] where id=60").ToString();
|
||||
if (jsonStr != null && jsonStr != "")
|
||||
{
|
||||
templateManage = JsonConvert.DeserializeObject<TemplateManage>(jsonStr);
|
||||
templateManage.ZedControl = zgcAnaesRecord;
|
||||
templateManage.OpeRecord = operationRecor;
|
||||
templateManage.Id = 60;
|
||||
bool reVal = templateManage.Load();
|
||||
if (reVal)
|
||||
{
|
||||
AllRefresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(templateManage.MsgStr);
|
||||
}
|
||||
AutoSizeF();
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void btnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (textBox1.Text == "") return;
|
||||
try
|
||||
{
|
||||
mPanes = new List<MasterPane>();
|
||||
UpPanes = new List<MasterPane>();
|
||||
|
||||
PrintDocPage(null, null);
|
||||
|
||||
System.Drawing.Printing.PrintDocument pDoc = new System.Drawing.Printing.PrintDocument();
|
||||
pDoc.DefaultPageSettings.Landscape = false;
|
||||
pDoc.OriginAtMargins = true;
|
||||
pDoc.DefaultPageSettings.PrinterResolution.Kind = PrinterResolutionKind.High;
|
||||
pDoc.DefaultPageSettings.Margins = new Margins(33, 0, 35, 0);
|
||||
pDoc.PrintPage -= new PrintPageEventHandler(pDoc_PrintPage);
|
||||
pDoc.PrintPage += new PrintPageEventHandler(pDoc_PrintPage);
|
||||
pDoc.PrinterSettings.PrintFileName =
|
||||
Application.StartupPath + "\\backup.xps";
|
||||
pDoc.PrinterSettings.PrintToFile = true;
|
||||
pDoc.PrinterSettings.PrinterName = "XPS";
|
||||
pDoc.DefaultPageSettings.PrinterSettings.PrinterName = "Microsoft XPS Document Writer";
|
||||
pDoc.Print();
|
||||
|
||||
FixedDocument2Pdf();
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
PublicMethod.WriteLog(exp, "");
|
||||
}
|
||||
}
|
||||
public static void FixedDocument2Pdf( )
|
||||
{
|
||||
//// Convert FixedDocument to XPS file in memory
|
||||
//var ms = new MemoryStream();
|
||||
//var package = Package.Open(ms, FileMode.Create);
|
||||
//var doc = new XpsDocument(package);
|
||||
//var writer = XpsDocument.CreateXpsDocumentWriter(doc);
|
||||
//writer.Write(fd.DocumentPaginator);
|
||||
//doc.Close();
|
||||
//package.Close();
|
||||
|
||||
//// Get XPS file bytes
|
||||
//var bytes = ms.ToArray();
|
||||
//ms.Dispose();
|
||||
|
||||
byte[] bytes = File.ReadAllBytes( Application.StartupPath + "\\backup.xps");
|
||||
|
||||
// Print to PDF
|
||||
var outputFilePath = @"D:\test.pdf";
|
||||
PdfFilePrinter.PrintXpsToPdf(bytes, outputFilePath, "Document Title");
|
||||
}
|
||||
|
||||
int m_startPrintPage;// 打印的起始页码
|
||||
int m_endPrintPage;//打印的终止页码
|
||||
//int m_PageIndex;// 当前打印页码
|
||||
int count = 0;
|
||||
private void pDoc_PrintPage(object sender, PrintPageEventArgs e)
|
||||
{
|
||||
System.Drawing.Printing.PrintDocument pDoc = sender as System.Drawing.Printing.PrintDocument;
|
||||
m_startPrintPage = pDoc.PrinterSettings.FromPage;
|
||||
m_endPrintPage = pDoc.PrinterSettings.ToPage;
|
||||
|
||||
int printCount = mPanes.Count;
|
||||
if (mPanes.Count > 0 && count < printCount)
|
||||
{
|
||||
mPanes[count].Draw(e.Graphics);
|
||||
count++;
|
||||
if (count < printCount)
|
||||
{
|
||||
e.HasMorePages = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
e.HasMorePages = false;
|
||||
}
|
||||
}
|
||||
|
||||
//public static void ImageConvertToPdfAnes(List<System.Drawing.Image> Images, string SvaePath = @"D:\Temp.pdf")
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// System.Drawing.Image pic = Images[0];//strFilePath是该图片的绝对路径
|
||||
// int intWidth = pic.Width;//长度像素值
|
||||
// int intHeight = pic.Height;//高度像素值
|
||||
// //pic.Dispose();
|
||||
// iTextSharp.text.Rectangle pagesize = new iTextSharp.text.Rectangle(intWidth, intHeight);
|
||||
// Document pdfdoc = new Document(pagesize);//建立Document对象的实例,并设置Document的大小与边距。
|
||||
|
||||
// PdfWriter writer = PdfWriter.GetInstance(pdfdoc, new FileStream(SvaePath, FileMode.Create)); //建立一个PdWf riter对象Writer与document对象关联,通过Writer可以将文档写入到磁盘中。
|
||||
// pdfdoc.Open(); //打开文档。
|
||||
// PdfContentByte cb = writer.DirectContent;
|
||||
// foreach (System.Drawing.Image image in Images)
|
||||
// {
|
||||
// image.Save(@"D:\temp.Jpeg", ImageFormat.Jpeg);
|
||||
// iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(@"D:\temp.Jpeg");
|
||||
// img.SetAbsolutePosition(0, 0);
|
||||
// cb.AddImage(img); //向文档中添加图像数据。
|
||||
// pdfdoc.NewPage();
|
||||
// }
|
||||
// pdfdoc.Close(); //关闭文档,将缓冲区的内容写入磁盘以保存文件。
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// }
|
||||
//}
|
||||
//public void ImageConvertToPdfAnes2(string SvaePath = @"D:\Temp.pdf")
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// int intWidth = zgcAnaesRecord.Width;//长度像素值
|
||||
// int intHeight = zgcAnaesRecord.Height;//高度像素值
|
||||
// //pic.Dispose();
|
||||
// iTextSharp.text.Rectangle pagesize = new iTextSharp.text.Rectangle(intWidth, intHeight);
|
||||
// Document pdfdoc = new Document(pagesize);//建立Document对象的实例,并设置Document的大小与边距。
|
||||
|
||||
// PdfWriter writer = PdfWriter.GetInstance(pdfdoc, new FileStream(SvaePath, FileMode.Create)); //建立一个PdWf riter对象Writer与document对象关联,通过Writer可以将文档写入到磁盘中。
|
||||
// pdfdoc.Open(); //打开文档。
|
||||
// PdfContentByte cb = writer.DirectContent;
|
||||
// foreach (MasterPane image in mPanes)
|
||||
// {
|
||||
// // 创建一个位图对象
|
||||
// Bitmap bitmap = new Bitmap(intWidth, intHeight);
|
||||
// // 创建一个画布对象
|
||||
// Graphics g = Graphics.FromImage(bitmap);
|
||||
// g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
|
||||
// g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
|
||||
// g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
|
||||
// // 清除画布表面,填充指定的颜色
|
||||
// //g.Clear(Color.White);
|
||||
// image.Draw(g);
|
||||
// // 释放资源
|
||||
// g.Dispose();
|
||||
// bitmap.Save(@"D:\temp.Jpeg", ImageFormat.Png);
|
||||
// iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(@"D:\temp.Jpeg");
|
||||
// img.SetAbsolutePosition(0, 0);
|
||||
// cb.AddImage(img); //向文档中添加图像数据。
|
||||
// pdfdoc.NewPage();
|
||||
// }
|
||||
// pdfdoc.Close(); //关闭文档,将缓冲区的内容写入磁盘以保存文件。
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// }
|
||||
//}
|
||||
public List<MasterPane> mPanes = new List<MasterPane>();
|
||||
public List<MasterPane> UpPanes = new List<MasterPane>();
|
||||
private void PrintDocPage(object sender, PrintPageEventArgs e)
|
||||
{
|
||||
OperationRecord _record = operationRecor as OperationRecord;
|
||||
if (_record.currentPage == 1)
|
||||
{
|
||||
PrintDocPane(e, zgcAnaesRecord, templateManage, true);
|
||||
PrintDocPane(e, zgcAnaesRecord2, templateManage2, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 1; i <= _record.pageCount; i++)
|
||||
{
|
||||
PrintDocPane(e, zgcAnaesRecord, templateManage, true);
|
||||
if (i == 1)
|
||||
{
|
||||
PrintDocPane(e, zgcAnaesRecord2, templateManage2, false);
|
||||
}
|
||||
btnNextPage_Click(_record.PatientId.Value);
|
||||
if (i != 1)
|
||||
{
|
||||
MasterPane mPane = new MasterPane();
|
||||
mPane.Border.IsVisible = false;
|
||||
mPanes.Add(mPane);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void SetNextPageTime()
|
||||
{
|
||||
OperationRecord _record = operationRecor as OperationRecord;
|
||||
//当下一页的开始时间,小于当前最大时间
|
||||
DateTime curTimeTemp = OperationRecord.getOpeMaxTime(_record);
|
||||
if (_record.lastPageBegin > curTimeTemp) return;
|
||||
//先设置新页的开始时间
|
||||
_record.PageBegin = _record.lastPageBegin;
|
||||
_record.lastPageBegin = _record.PageBegin.AddMinutes(240);
|
||||
_record.pageCount++;
|
||||
if (_record.pageCount > _record.currentPage) _record.pageCount = _record.currentPage;
|
||||
|
||||
}
|
||||
|
||||
private void btnNextPage_Click(int PatientId)
|
||||
{
|
||||
OperationRecord _record = operationRecor as OperationRecord;
|
||||
if (PatientId == 0) return;
|
||||
if (_record.pageCount == _record.currentPage) return;
|
||||
SetNextPageTime();
|
||||
|
||||
try
|
||||
{
|
||||
if (PatientId != 0)
|
||||
{
|
||||
templateManage.OpeRecord = BOperationRecord.getRecord(_record, PatientId, 1);
|
||||
templateManage2.OpeRecord = templateManage.OpeRecord;
|
||||
templateManage.BindOperationRecordValueAll(templateManage.OpeRecord);
|
||||
templateManage2.BindOperationRecordValueAll(templateManage2.OpeRecord);
|
||||
|
||||
templateManage.Bind();
|
||||
templateManage2.Bind();
|
||||
|
||||
zgcAnaesRecord.Refresh();
|
||||
zgcAnaesRecord2.Refresh();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PublicMethod.WriteLog(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void PrintDocPane(PrintPageEventArgs e, ZedGraphControl zedGraph, TemplateManage template, bool InitChart)
|
||||
{
|
||||
OperationRecord _record = operationRecor as OperationRecord;
|
||||
foreach (AreaManageBase area in template.ManageList)
|
||||
{
|
||||
area.setPrint(false);
|
||||
area.BindTempData();
|
||||
}
|
||||
int zedGraphMainWidth = zedGraph.Size.Width;
|
||||
int zedGraphMainHeight = zedGraph.Size.Height;
|
||||
|
||||
int width = 765;
|
||||
int height = Convert.ToInt32(width * 1.414) + 2;
|
||||
zedGraph.Size = new Size(width, height);
|
||||
zedGraph.Width = width;
|
||||
zedGraph.Height = height;
|
||||
|
||||
if (InitChart == true)
|
||||
foreach (PhysioDataConfig pp in _record.PhysioConfigList)
|
||||
{
|
||||
if (pp.ShowText == true)
|
||||
{
|
||||
pp.IsValid = false;
|
||||
///重新设置曲线属性
|
||||
pp.reSetCurveSpo2();
|
||||
}
|
||||
}
|
||||
TipBox.Hidden();
|
||||
|
||||
MasterPane mPane = zedGraph.MasterPane; //this.MasterPane;
|
||||
mPane.Border.IsVisible = false;
|
||||
//当前窗体中的矩形区域大小
|
||||
RectangleF saveRect = mPane.Rect;
|
||||
if (InitChart == true)
|
||||
template.initChart();
|
||||
mPanes.Add(mPane.Clone());
|
||||
if (e != null)
|
||||
mPane.Draw(e.Graphics); //在打印文档中画出MasterPane内容
|
||||
using (Graphics g = zedGraph.CreateGraphics())
|
||||
{
|
||||
mPane.ReSize(g, saveRect);
|
||||
}
|
||||
UpPanes.Add(mPane.Clone());
|
||||
|
||||
|
||||
zedGraph.Size = new Size(zedGraphMainWidth, zedGraphMainHeight);
|
||||
if (InitChart == true)
|
||||
template.initChart();
|
||||
|
||||
if (InitChart == true)
|
||||
foreach (PhysioDataConfig pp in _record.PhysioConfigList)
|
||||
{
|
||||
if (pp.ShowText == true)
|
||||
{
|
||||
pp.IsValid = true;
|
||||
///重新设置曲线属性
|
||||
pp.reSetCurveSpo2();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1253
DrawGraphManagement/MainUp.resx
Normal file
1253
DrawGraphManagement/MainUp.resx
Normal file
File diff suppressed because it is too large
Load Diff
42
DrawGraphManagement/MyPanel.Designer.cs
generated
42
DrawGraphManagement/MyPanel.Designer.cs
generated
@ -1,42 +0,0 @@
|
||||
namespace DrawGraphManagement
|
||||
{
|
||||
partial class MyPanel
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// MyPanel
|
||||
//
|
||||
this.Name = "MyPanel";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DrawGraphManagement
|
||||
{
|
||||
public partial class MyPanel : Panel
|
||||
{
|
||||
public MyPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override Point ScrollToControl(Control activeControl)
|
||||
{
|
||||
return this.AutoScrollPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
180
DrawGraphManagement/PdfFilePrinter.cs
Normal file
180
DrawGraphManagement/PdfFilePrinter.cs
Normal file
@ -0,0 +1,180 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Printing;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace DrawGraphManagement
|
||||
{
|
||||
public class PdfFilePrinter
|
||||
{
|
||||
private const string PdfPrinterDriveName = "Microsoft Print To PDF";
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||
private class DOCINFOA
|
||||
{
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string pDocName;
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string pOutputFile;
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string pDataType;
|
||||
}
|
||||
|
||||
[DllImport("winspool.drv", EntryPoint = "OpenPrinterA", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
||||
private static extern bool OpenPrinter([MarshalAs(UnmanagedType.LPStr)] string szPrinter, out IntPtr hPrinter, IntPtr pd);
|
||||
|
||||
[DllImport("winspool.drv", EntryPoint = "ClosePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
||||
private static extern bool ClosePrinter(IntPtr hPrinter);
|
||||
|
||||
[DllImport("winspool.drv", EntryPoint = "StartDocPrinterA", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
||||
private static extern int StartDocPrinter(IntPtr hPrinter, int level, [In, MarshalAs(UnmanagedType.LPStruct)] DOCINFOA di);
|
||||
|
||||
[DllImport("winspool.drv", EntryPoint = "EndDocPrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
||||
private static extern bool EndDocPrinter(IntPtr hPrinter);
|
||||
|
||||
[DllImport("winspool.drv", EntryPoint = "StartPagePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
||||
private static extern bool StartPagePrinter(IntPtr hPrinter);
|
||||
|
||||
[DllImport("winspool.drv", EntryPoint = "EndPagePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
||||
private static extern bool EndPagePrinter(IntPtr hPrinter);
|
||||
|
||||
[DllImport("winspool.drv", EntryPoint = "WritePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
||||
private static extern bool WritePrinter(IntPtr hPrinter, IntPtr pBytes, int dwCount, out int dwWritten);
|
||||
|
||||
public static void PrintXpsToPdf(byte[] bytes, string outputFilePath, string documentTitle)
|
||||
{
|
||||
// Get Microsoft Print to PDF print queue
|
||||
var pdfPrintQueue = GetMicrosoftPdfPrintQueue();
|
||||
|
||||
// Copy byte array to unmanaged pointer
|
||||
var ptrUnmanagedBytes = Marshal.AllocCoTaskMem(bytes.Length);
|
||||
Marshal.Copy(bytes, 0, ptrUnmanagedBytes, bytes.Length);
|
||||
|
||||
// Prepare document info
|
||||
var di = new DOCINFOA
|
||||
{
|
||||
pDocName = documentTitle,
|
||||
pOutputFile = outputFilePath,
|
||||
pDataType = "RAW"
|
||||
};
|
||||
|
||||
// Print to PDF
|
||||
var errorCode = SendBytesToPrinter(pdfPrintQueue.Name, ptrUnmanagedBytes, bytes.Length, di, out var jobId);
|
||||
|
||||
// Free unmanaged memory
|
||||
Marshal.FreeCoTaskMem(ptrUnmanagedBytes);
|
||||
|
||||
// Check if job in error state (for example not enough disk space)
|
||||
var jobFailed = false;
|
||||
try
|
||||
{
|
||||
var pdfPrintJob = pdfPrintQueue.GetJob(jobId);
|
||||
if (pdfPrintJob.IsInError)
|
||||
{
|
||||
jobFailed = true;
|
||||
pdfPrintJob.Cancel();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// If job succeeds, GetJob will throw an exception. Ignore it.
|
||||
}
|
||||
finally
|
||||
{
|
||||
pdfPrintQueue.Dispose();
|
||||
}
|
||||
|
||||
if (errorCode > 0 || jobFailed)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(outputFilePath))
|
||||
{
|
||||
File.Delete(outputFilePath);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
if (errorCode > 0)
|
||||
{
|
||||
throw new Exception($"Printing to PDF failed. Error code: {errorCode}.");
|
||||
}
|
||||
|
||||
if (jobFailed)
|
||||
{
|
||||
throw new Exception("PDF Print job failed.");
|
||||
}
|
||||
}
|
||||
|
||||
private static int SendBytesToPrinter(string szPrinterName, IntPtr pBytes, int dwCount, DOCINFOA documentInfo, out int jobId)
|
||||
{
|
||||
jobId = 0;
|
||||
var dwWritten = 0;
|
||||
var success = false;
|
||||
|
||||
if (OpenPrinter(szPrinterName.Normalize(), out var hPrinter, IntPtr.Zero))
|
||||
{
|
||||
jobId = StartDocPrinter(hPrinter, 1, documentInfo);
|
||||
if (jobId > 0)
|
||||
{
|
||||
if (StartPagePrinter(hPrinter))
|
||||
{
|
||||
success = WritePrinter(hPrinter, pBytes, dwCount, out dwWritten);
|
||||
EndPagePrinter(hPrinter);
|
||||
}
|
||||
|
||||
EndDocPrinter(hPrinter);
|
||||
}
|
||||
|
||||
ClosePrinter(hPrinter);
|
||||
}
|
||||
|
||||
// TODO: The other methods such as OpenPrinter also have return values. Check those?
|
||||
|
||||
if (success == false)
|
||||
{
|
||||
return Marshal.GetLastWin32Error();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static PrintQueue GetMicrosoftPdfPrintQueue()
|
||||
{
|
||||
PrintQueue pdfPrintQueue = null;
|
||||
|
||||
try
|
||||
{
|
||||
using (var printServer = new PrintServer())
|
||||
{
|
||||
var flags = new[] { EnumeratedPrintQueueTypes.Local };
|
||||
// FirstOrDefault because it's possible for there to be multiple PDF printers with the same driver name (though unusual)
|
||||
// To get a specific printer, search by FullName property instead (note that in Windows, queue name can be changed)
|
||||
pdfPrintQueue = printServer.GetPrintQueues(flags).FirstOrDefault(lq => lq.QueueDriver.Name == PdfPrinterDriveName);
|
||||
}
|
||||
|
||||
if (pdfPrintQueue == null)
|
||||
{
|
||||
throw new Exception($"Could not find printer with driver name: {PdfPrinterDriveName}");
|
||||
}
|
||||
|
||||
if (!pdfPrintQueue.IsXpsDevice)
|
||||
{
|
||||
throw new Exception($"PrintQueue '{pdfPrintQueue.Name}' does not understand XPS page description language.");
|
||||
}
|
||||
|
||||
return pdfPrintQueue;
|
||||
}
|
||||
catch
|
||||
{
|
||||
pdfPrintQueue?.Dispose();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
DrawGraphManagement/PdfiumViewer.dll
Normal file
BIN
DrawGraphManagement/PdfiumViewer.dll
Normal file
Binary file not shown.
@ -15,7 +15,7 @@ namespace DrawGraphManagement
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
PreLoad();
|
||||
Application.Run(new Main());
|
||||
Application.Run(new MainUp());
|
||||
}
|
||||
static void PreLoad()
|
||||
{
|
||||
|
||||
4
DrawGraphManagement/packages.config
Normal file
4
DrawGraphManagement/packages.config
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="PdfiumViewer" version="2.13.0.0" targetFramework="net40" />
|
||||
</packages>
|
||||
Loading…
x
Reference in New Issue
Block a user