diff --git a/AIMS/AIMS.csproj b/AIMS/AIMS.csproj
index 1a0de67..f84957d 100644
--- a/AIMS/AIMS.csproj
+++ b/AIMS/AIMS.csproj
@@ -58,9 +58,6 @@
False
..\..\..\..\..\..\..\Program Files (x86)\DotNetBar for Windows Forms\DevComponents.DotNetBar2.dll
-
- Extensions\GoldPrinter.dll
-
False
True
@@ -82,11 +79,6 @@
False
Extensions\Newtonsoft.Json.dll
-
- False
- True
- Extensions\office.dll
-
@@ -1324,7 +1316,6 @@
Settings.settings
True
-
diff --git a/AIMS/OperationDoing/oldSystemCode/FormUseDrugsReport.cs b/AIMS/OperationDoing/oldSystemCode/FormUseDrugsReport.cs
index de5b24c..c1b6c40 100644
--- a/AIMS/OperationDoing/oldSystemCode/FormUseDrugsReport.cs
+++ b/AIMS/OperationDoing/oldSystemCode/FormUseDrugsReport.cs
@@ -370,56 +370,56 @@ namespace AIMS.OperationDoing.AnasRecordBill
}
private void tsbLead_Click(object sender, EventArgs e)
{
- GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();
- string strFileName = "精一药品使用记录单.xlt"; //模板文件名
- string strExcelTemplateFile = AppDomain.CurrentDomain.BaseDirectory;
- strExcelTemplateFile += @"\printTemplate\" + strFileName;
- excel.Open(strExcelTemplateFile); //用模板文件
- int rowNum = 4;
- string Letters = "A B C D E F G H I J K L M N O P Q R";
- string[] letter = Letters.Split(' ');
- DateTime dtBegin = reBeginTime(dtpBegin.Value, "begin");
- DateTime dtEnd = reBeginTime(dtpEnd.Value, "end");
- if (_record != null)
- {
- dtBegin = reBeginTime(_record.InRoomTime.Value, "begin");
- dtEnd = reBeginTime(_record.InRoomTime.Value, "end");
- lists = BUseDrugsReportManager.GetListByDateTimeWork(dtBegin.ToString(), dtEnd.ToString(), _record.Id.Value);
- }
- else
- {
- lists = BUseDrugsReportManager.GetListByDateTime(dtBegin.ToString(), dtEnd.ToString());
- }
- for (int j = 0; j < lists.Count; j++)
- {
- rowNum++;
- UseDrugsReport temp = lists[j];
- string enter = temp.Enter == 1 ? "√" : "";
- excel.GetRange(rowNum, "A", rowNum, "R").RowHeight = 24.75;
- excel.GetRange(rowNum, "A", rowNum, "R").Borders.LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
- excel.GetRange(rowNum, "A", rowNum, "P").Value = new string[]{
- (j+1).ToString(),
- temp.使用日期,
- temp.术间,
- temp.患者姓名,
- temp.住院号 ,
- temp.药品名称,
- temp.处方剂量,
- temp.批号,
- temp.用量,
- temp.残留剂量,
- temp.残液处理方式,
- temp.镇痛泵使用量,
- temp.镇痛泵余量,
- temp.处方医师,
- temp.医生签名2,
- enter
- };
+ //GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();
+ //string strFileName = "精一药品使用记录单.xlt"; //模板文件名
+ //string strExcelTemplateFile = AppDomain.CurrentDomain.BaseDirectory;
+ //strExcelTemplateFile += @"\printTemplate\" + strFileName;
+ //excel.Open(strExcelTemplateFile); //用模板文件
+ //int rowNum = 4;
+ //string Letters = "A B C D E F G H I J K L M N O P Q R";
+ //string[] letter = Letters.Split(' ');
+ //DateTime dtBegin = reBeginTime(dtpBegin.Value, "begin");
+ //DateTime dtEnd = reBeginTime(dtpEnd.Value, "end");
+ //if (_record != null)
+ //{
+ // dtBegin = reBeginTime(_record.InRoomTime.Value, "begin");
+ // dtEnd = reBeginTime(_record.InRoomTime.Value, "end");
+ // lists = BUseDrugsReportManager.GetListByDateTimeWork(dtBegin.ToString(), dtEnd.ToString(), _record.Id.Value);
+ //}
+ //else
+ //{
+ // lists = BUseDrugsReportManager.GetListByDateTime(dtBegin.ToString(), dtEnd.ToString());
+ //}
+ //for (int j = 0; j < lists.Count; j++)
+ //{
+ // rowNum++;
+ // UseDrugsReport temp = lists[j];
+ // string enter = temp.Enter == 1 ? "√" : "";
+ // excel.GetRange(rowNum, "A", rowNum, "R").RowHeight = 24.75;
+ // excel.GetRange(rowNum, "A", rowNum, "R").Borders.LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
+ // excel.GetRange(rowNum, "A", rowNum, "P").Value = new string[]{
+ // (j+1).ToString(),
+ // temp.使用日期,
+ // temp.术间,
+ // temp.患者姓名,
+ // temp.住院号 ,
+ // temp.药品名称,
+ // temp.处方剂量,
+ // temp.批号,
+ // temp.用量,
+ // temp.残留剂量,
+ // temp.残液处理方式,
+ // temp.镇痛泵使用量,
+ // temp.镇痛泵余量,
+ // temp.处方医师,
+ // temp.医生签名2,
+ // enter
+ // };
- }
- excel.PrintPreview();
- this.Focus();
- excel.Close();
+ //}
+ //excel.PrintPreview();
+ //this.Focus();
+ //excel.Close();
}
Object cellTempValue = null;
diff --git a/AIMS/OperationDoing/oldSystemCode/PublicToDoument.cs b/AIMS/OperationDoing/oldSystemCode/PublicToDoument.cs
index 6b0c81e..a9ae8ac 100644
--- a/AIMS/OperationDoing/oldSystemCode/PublicToDoument.cs
+++ b/AIMS/OperationDoing/oldSystemCode/PublicToDoument.cs
@@ -7,8 +7,7 @@ using System.Linq;
using System.Windows.Forms;
using AIMSExtension;
using DevComponents.Editors.DateTimeAdv;
-using DrawGraph;
-using Microsoft.Office.Core;
+using DrawGraph;
using Newtonsoft.Json;
namespace AIMS.OperationDoing.AnasRecordBill
@@ -173,153 +172,7 @@ namespace AIMS.OperationDoing.AnasRecordBill
MemoryStream ms = new MemoryStream(buffer);
Image image = Image.FromStream(ms);
return image;
- }
-
- //public static void SavePrintDocStatic(Dictionary dicList, int modelId, int ApplyId)
- //{
- // try
- // {
- // if (modelId != 0) BDocumentManager.DeleteStatic(modelId, ApplyId);
- // List modelStatics = new List();
- // foreach (var key in dicList.Keys)
- // {
- // PrintDocStatic modelStatic = new PrintDocStatic
- // {
- // PrintDocId = modelId,
- // OperationApplyId = ApplyId,
- // Key = key,
- // Value = dicList[key],
- // OperatorId = PublicMethod.Operator.Id
- // };
- // modelStatics.Add(modelStatic);
- // }
- // BDocumentManager.InsertStatic(modelStatics);
- // }
- // catch (Exception ex)
- // {
- // }
- //}
- public static void InsertPicture(GoldPrinter.ExcelAccess excel, FileInfo Img, float PictuteWidth, float PictureHeight)
- {
- try
- {
- string imgname = Img.Name.Split('.')[0];
- Microsoft.Office.Interop.Excel.Worksheet xSheet = (Microsoft.Office.Interop.Excel.Worksheet)excel.Workbooks.Sheets[1];
- Microsoft.Office.Interop.Excel.Range m_objRange = xSheet.Range[imgname, System.Reflection.Missing.Value];
- m_objRange.Select();
- float PicLeft, PicTop;
- PicLeft = Convert.ToSingle(m_objRange.Left);
- PicTop = Convert.ToSingle(m_objRange.Top);// + 460;
-
- //参数含义:
- //图片路径
- //是否链接到文件
- //图片插入时是否随文档一起保存
- //图片在文档中的坐标位置(单位:points)
- //图片显示的宽度和高度(单位:points)
- //参数详细信息参见:http://msdn2.microsoft.com/zh-cn/library/aa221765(office.11).aspx
- //xSheet.Shapes.AddPicture(Img.Attributes.ToString(), MsoTriState.msoFalse,
- //MsoTriState.msoTrue, PicLeft, PicTop, PictuteWidth, PictureHeight);
- xSheet.Shapes.AddPicture(Img.FullName, MsoTriState.msoFalse,
- MsoTriState.msoTrue, PicLeft, PicTop, PictuteWidth, PictureHeight);
- }
- catch (Exception)
- {
- }
- }
-
- public static void SetExcelValue(Control cons, GoldPrinter.ExcelAccess excel, bool addHospitalName = true)
- {
- try
- {
- SetExcelValues(cons, excel);
- }
- catch (Exception ex)
- {
- PublicMethod.WriteLog(ex);
- }
- }
-
- ///
- /// 循环控件值写入excel
- ///
- ///
- ///
- public static void SetExcelValues(Control cons, GoldPrinter.ExcelAccess excel)
- {
- try
- {
- foreach (Control c in cons.Controls)
- {
- if (c.Controls.Count > 0)
- {
- SetExcelValues(c, excel);
- }
- if (c.Tag != null && !c.Tag.Equals(string.Empty))
- {
- string excelValue = c.Tag.ToString().Split('|')[0];
- if (excelValue.Length <= 0 || excelValue == "")
- continue;
- if (!(char.IsLower(excelValue[0]) || char.IsUpper(excelValue[0])))
- {
- continue;
- }
- for (int k = 0; k < excelValue.Length; k++)
- {
- if (char.IsNumber(excelValue[k]))
- {
- int p_rowIndex = int.Parse(excelValue.Substring(k, excelValue.Length - k));
- string p_colChars = excelValue.Substring(0, excelValue.IndexOf(excelValue[k]));
- if (c is TextBox || c is RichTextBox || c is System.Windows.Forms.Label)
- {
- excel.SetCellText(p_rowIndex, p_colChars, c.Text);
- }
- else if (c is DateTimePicker)
- {
- if (((DateTimePicker)c).Enabled == true && ((DateTimePicker)c).Visible == true)
- {
- string text = c.Text;
- if (text == "")
- {
- try
- {
- text = ((DateTimePicker)c).Value.ToString("yyyy-MM-dd");
- }
- catch (Exception) { }
- }
- excel.SetCellText(p_rowIndex, p_colChars, text);
- }
- else
- {
- excel.SetCellText(p_rowIndex, p_colChars, "");
- }
-
- }
- else if (c is CheckBox)
- {
- string value = ((CheckBox)c).Checked == true ? "☑" : "□";
- excel.SetCellText(p_rowIndex, p_colChars, value);
- }
- else if (c is ComboBox)
- {
- excel.SetCellText(p_rowIndex, p_colChars, c.Text);
- }
- else if (c is RadioButton)
- {
- string value = ((RadioButton)c).Checked == true ? "☑" : "□";
- excel.SetCellText(p_rowIndex, p_colChars, value);
- }
- break;
- }
- }
- }
- }
- }
- catch (Exception ex)
- {
- PublicMethod.WriteLog(ex);
- }
- }
+ }
}
public class JsonTextForDoc
diff --git a/AIMS/OperationDoing/oldSystemCode/frmGoodsBillRecord.cs b/AIMS/OperationDoing/oldSystemCode/frmGoodsBillRecord.cs
index 6687e41..2f1840c 100644
--- a/AIMS/OperationDoing/oldSystemCode/frmGoodsBillRecord.cs
+++ b/AIMS/OperationDoing/oldSystemCode/frmGoodsBillRecord.cs
@@ -361,18 +361,7 @@ namespace AIMS.OperationDoing.AnasRecordBill
#region 预览
public void toolStripButton2_Click(object sender, EventArgs e)
{
- SaveReport(false);
- try
- {
- GoldPrinter.ExcelAccess excel = GetExcel();
- excel.PrintPreview();
- excel.Close();
- }
- catch (Exception exp)
- {
- //MessageBox.Show("请安装2007版office,在进行打印!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- PublicMethod.WriteLog(exp);
- }
+ SaveReport(false);
}
public void setLine(Excel.Range m_objRange)
{
@@ -387,124 +376,9 @@ namespace AIMS.OperationDoing.AnasRecordBill
#region 打印并保存
public void tsbSaveOperationApply_Click(object sender, EventArgs e)
{
- SaveReport(false);
- try
- {
- GoldPrinter.ExcelAccess excel = GetExcel();
- excel.Print();
- excel.Close();
- }
- catch (Exception exp)
- {
- MessageBox.Show("请安装2007版office,在进行打印!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- PublicMethod.WriteLog(exp);
- }
- }
-
- public GoldPrinter.ExcelAccess GetExcel()
- {
- //调用第三方操作EXCEL打印插件GoldPrinter实现打印
- GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();
- string strExcelTemplateFile = Application.StartupPath;
- strExcelTemplateFile += @"\Template\" + strFileName;
- excel.Open(strExcelTemplateFile); //调用模板文件
- excel.IsVisibledExcel = false;
- PublicToDoument.SetExcelValue(panel1, excel);
- List ApplianceRecordList = new List();
- if (instrumentList.ApplianceRecordList != null && instrumentList.ApplianceRecordList.Count > 0)
- {
- ApplianceRecordList = instrumentList.ApplianceRecordList;
- }
- else
- {
- ApplianceRecordList = GetApplianceRecord();
- }
- #region 新打印
- #region 患者手术信息
- string name1 = PublicMethod.GetHospitalName();
- Excel.Range range = excel.GetRange(1, 1, 55, 55);
- { excel.SetCellText(6, "C", this.TxtName.Text.Trim()); }//患者
- { excel.SetCellText(6, "L", this.TxtSex.Text.Trim()); }//性别
- { excel.SetCellText(6, "R", this.TxtAge.Text.Trim()); }//年龄
- { excel.SetCellText(6, "X", this.TxtDepartment.Text.Trim()); }//科室
- { excel.SetCellText(6, "AE", this.txtEndemicArea.Text.Trim()); }//病区
- { excel.SetCellText(6, "AL", this.TxtBed.Text.Trim()); }//床号
- { excel.SetCellText(7, "AE", this.TxtInHospitalNo.Text.Trim()); }//住院号
- { excel.SetCellText(7, "F", this.txtOpeRoom.Text.Trim()); }//手术日期
- { excel.SetCellText(8, "F", this.txtOperation.Text.Trim()); }//实施手术
-
- FileInfo img = new FileInfo(@"C:\temp\" + rangname + ".png");
- PublicToDoument.InsertPicture(excel, img, 170, 160);
-
- #endregion
-
- #region 物品清点单信息
- int index = 0;
- for (int i = 25; i < 39; i++)
- {
- if (ApplianceRecordList.Count > 0 && index < ApplianceRecordList.Count)
- {
- { excel.SetCellText(i, "A", ApplianceRecordList[index].ApplianceName); }//器械名称
- if (ApplianceRecordList[index].OpeFront != null && ApplianceRecordList[index].OpeFront != "" && ApplianceRecordList[index].OpeFront != @"\")
- { excel.SetCellText(i, "F", ApplianceRecordList[index].OpeFront.ToString()); }//术前
- else setLine(excel.GetRange(i, "H"));
-
- if (ApplianceRecordList[index].OpeDoing != null && ApplianceRecordList[index].OpeDoing != "" && ApplianceRecordList[index].OpeDoing != @"\")
- { excel.SetCellText(i, "J", ApplianceRecordList[index].OpeDoing.ToString()); }//术中
- else setLine(excel.GetRange(i, "L"));
-
- if (ApplianceRecordList[index].CloseFront != null && ApplianceRecordList[index].CloseFront != "" && ApplianceRecordList[index].CloseFront != @"\")
- { excel.SetCellText(i, "N", ApplianceRecordList[index].CloseFront.ToString()); }//关闭腔体前
- else setLine(excel.GetRange(i, "P"));
-
- if (ApplianceRecordList[index].CloseLast != null && ApplianceRecordList[index].CloseLast != "" && ApplianceRecordList[index].CloseLast != @"\")
- { excel.SetCellText(i, "R", ApplianceRecordList[index].CloseLast.ToString()); }//关闭腔体后
- else setLine(excel.GetRange(i, "S"));
-
- index++;
- continue;
- }
- { excel.SetCellText(i, "A", ""); }//器械名称
- { excel.SetCellText(i, "F", ""); }//术前
- { excel.SetCellText(i, "J", ""); }//术中
- { excel.SetCellText(i, "N", ""); }//关闭腔体前
- { excel.SetCellText(i, "R", ""); }//关闭腔体后
- }
- for (int i = 25; i < 39; i++)
- {
- if (ApplianceRecordList.Count > 0 && index < ApplianceRecordList.Count)
- {
- { excel.SetCellText(i, "V", ApplianceRecordList[index].ApplianceName); }//器械名称
- if (ApplianceRecordList[index].OpeFront != null && ApplianceRecordList[index].OpeFront != "" && ApplianceRecordList[index].OpeFront != @"\")
- { excel.SetCellText(i, "AA", ApplianceRecordList[index].OpeFront.ToString()); }//术前
- else setLine(excel.GetRange(i, "AC"));
-
- if (ApplianceRecordList[index].OpeDoing != null && ApplianceRecordList[index].OpeDoing != "" && ApplianceRecordList[index].OpeDoing != @"\")
- { excel.SetCellText(i, "AE", ApplianceRecordList[index].OpeDoing.ToString()); }//术中
- else setLine(excel.GetRange(i, "AG"));
-
- if (ApplianceRecordList[index].CloseFront != null && ApplianceRecordList[index].CloseFront != "" && ApplianceRecordList[index].CloseFront != @"\")
- { excel.SetCellText(i, "AI", ApplianceRecordList[index].CloseFront.ToString()); }//关闭腔体前
- else setLine(excel.GetRange(i, "AK"));
-
- if (ApplianceRecordList[index].CloseLast != null && ApplianceRecordList[index].CloseLast != "" && ApplianceRecordList[index].CloseLast != @"\")
- { excel.SetCellText(i, "AM", ApplianceRecordList[index].CloseLast.ToString()); }//关闭腔体后
- else setLine(excel.GetRange(i, "AN"));
-
- index++;
- continue;
- }
- { excel.SetCellText(i, "V", ""); }//器械名称
- { excel.SetCellText(i, "AA", ""); }//术前
- { excel.SetCellText(i, "AE", ""); }//术中
- { excel.SetCellText(i, "AI", ""); }//关闭腔体前
- { excel.SetCellText(i, "AM", ""); }//关闭腔体后
- }
- #endregion
-
- #endregion
- return excel;
+ SaveReport(false);
}
+
public void toolStripButton3_Click(object sender, EventArgs e)
{
Initial();
diff --git a/AIMS/OperationFront/FrmScheduling2.cs b/AIMS/OperationFront/FrmScheduling2.cs
index 19c183b..06e309d 100644
--- a/AIMS/OperationFront/FrmScheduling2.cs
+++ b/AIMS/OperationFront/FrmScheduling2.cs
@@ -7,7 +7,6 @@ using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
-using GoldPrinter;
namespace AIMS.OperationFront.UI
{
@@ -247,7 +246,7 @@ namespace AIMS.OperationFront.UI
{
hm.minute = int.Parse(arr[1]);
}
- hm.hour =int.Parse( arr[0]);
+ hm.hour = int.Parse(arr[0]);
return hm;
}
@@ -388,7 +387,7 @@ namespace AIMS.OperationFront.UI
{
DataRow dr = dataTable.Rows[i];
string strTypeId = dr["ScheduleTypeId"].ToString();
- string[] ids =strTypeId.Split('|');
+ string[] ids = strTypeId.Split('|');
int m = ids.Length;
for (int j = 1; j <= m; j++)
{
@@ -640,7 +639,7 @@ namespace AIMS.OperationFront.UI
private void FrmScheduling2_Load(object sender, EventArgs e)
- {
+ {
DataGridView dgv = this.dataGridView1;
dgv.EditMode = DataGridViewEditMode.EditOnEnter;
@@ -1195,7 +1194,7 @@ namespace AIMS.OperationFront.UI
for (int i = n - 1; i >= 0; i--)
{
DataGridViewRow dr = dgv.Rows[i];
- string name =dr.Cells["ShiftName"].Value.ToString();
+ string name = dr.Cells["ShiftName"].Value.ToString();
if (!string.IsNullOrEmpty(name))
{
if (!dic.ContainsKey(name))
@@ -1495,242 +1494,242 @@ namespace AIMS.OperationFront.UI
{
//FrmDeptAttendance form = new FrmDeptAttendance();
//form.Show();
- }
+ }
private void btnPrint_Click(object sender, EventArgs e)
{
- try
- {
- /*打印排班表*/
- bool oldChecked = chxOnlyShiftPlan.Checked;
- chxOnlyShiftPlan.Checked = true;
+ //try
+ //{
+ // /*打印排班表*/
+ // bool oldChecked = chxOnlyShiftPlan.Checked;
+ // chxOnlyShiftPlan.Checked = true;
- DateTime dateTime = this.dateTimePicker1.Value;
- int year = dateTime.Year;
- int month = dateTime.Month;
- DateTime monthFirstDay = new DateTime(year, month, 1);
- DateTime monthLastDay = (new DateTime(year, month, 1)).AddMonths(1).AddDays(-1);
- int dayMax = monthLastDay.Day;
+ // DateTime dateTime = this.dateTimePicker1.Value;
+ // int year = dateTime.Year;
+ // int month = dateTime.Month;
+ // DateTime monthFirstDay = new DateTime(year, month, 1);
+ // DateTime monthLastDay = (new DateTime(year, month, 1)).AddMonths(1).AddDays(-1);
+ // int dayMax = monthLastDay.Day;
- DataGridView dgv = this.dataGridView1;
- int rowsCount = dgv.Rows.Count;
- string filepath = string.Format("{0}\\Template\\排班按月.xlt", AppDomain.CurrentDomain.BaseDirectory);
+ //DataGridView dgv = this.dataGridView1;
+ //int rowsCount = dgv.Rows.Count;
+ //string filepath = string.Format("{0}\\Template\\排班按月.xlt", AppDomain.CurrentDomain.BaseDirectory);
- GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();
- excel.IsVisibledExcel = false;
- excel.Open(filepath);
- Microsoft.Office.Interop.Excel.Worksheet xlSheet = (Microsoft.Office.Interop.Excel.Worksheet)excel.Workbooks.ActiveSheet;
- string strTitle;
- strTitle = PublicMethod.GetHospitalName();
- excel.SetCellText(1, "A", strTitle);
+ //GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();
+ //excel.IsVisibledExcel = false;
+ //excel.Open(filepath);
+ //Microsoft.Office.Interop.Excel.Worksheet xlSheet = (Microsoft.Office.Interop.Excel.Worksheet)excel.Workbooks.ActiveSheet;
+ //string strTitle;
+ // strTitle = PublicMethod.GetHospitalName();
+ //excel.SetCellText(1, "A", strTitle);
- /*标题*/
- strTitle = (radioDoctor.Checked) ? "麻醉医生" : "护士";
- excel.SetCellText(2, "A", string.Format("{0}年{1}月 {2}", year, month, strTitle));
- Microsoft.Office.Interop.Excel.Range range;
- DataGridViewRow drv;
+ ///*标题*/
+ //strTitle = (radioDoctor.Checked) ? "麻醉医生" : "护士";
+ //excel.SetCellText(2, "A", string.Format("{0}年{1}月 {2}", year, month, strTitle));
+ //Microsoft.Office.Interop.Excel.Range range;
+ //DataGridViewRow drv;
- /*填写16-31日的姓名标题,合并姓名单元格*/
- range = xlSheet.Range[xlSheet.Cells[6 + rowsCount, 1], xlSheet.Cells[8 + rowsCount, 1]];
- range.Merge(System.Reflection.Missing.Value);
+ ///*填写16-31日的姓名标题,合并姓名单元格*/
+ //range = xlSheet.Range[xlSheet.Cells[6 + rowsCount, 1], xlSheet.Cells[8 + rowsCount, 1]];
+ //range.Merge(System.Reflection.Missing.Value);
- range.Font.Color = Color.Red; //红色
- xlSheet.Cells[6 + rowsCount, 1] = "姓名";
- xlSheet.Cells[6 + rowsCount, 2] = "阴历";
- xlSheet.Cells[7 + rowsCount, 2] = "阳历";
- xlSheet.Cells[8 + rowsCount, 2] = "星期";
+ //range.Font.Color = Color.Red; //红色
+ //xlSheet.Cells[6 + rowsCount, 1] = "姓名";
+ //xlSheet.Cells[6 + rowsCount, 2] = "阴历";
+ //xlSheet.Cells[7 + rowsCount, 2] = "阳历";
+ //xlSheet.Cells[8 + rowsCount, 2] = "星期";
- /*设置标题栏红色*/
- range = xlSheet.Range[xlSheet.Cells[3, 2], xlSheet.Cells[5, 20]];
- range.Font.Color = Color.Red; //红色
- range = xlSheet.Range[xlSheet.Cells[6 + rowsCount, 2], xlSheet.Cells[8 + rowsCount, 20]];
- range.Font.Color = Color.Red; //红色
+ ///*设置标题栏红色*/
+ //range = xlSheet.Range[xlSheet.Cells[3, 2], xlSheet.Cells[5, 20]];
+ //range.Font.Color = Color.Red; //红色
+ //range = xlSheet.Range[xlSheet.Cells[6 + rowsCount, 2], xlSheet.Cells[8 + rowsCount, 20]];
+ //range.Font.Color = Color.Red; //红色
- /*填写姓名*/
- for (int j = 0; j < rowsCount; j++)
- {
- drv = dgv.Rows[j];
- string name = drv.Cells["colName"].FormattedValue.ToString();
- range = xlSheet.Range[xlSheet.Cells[j + 6, 1], xlSheet.Cells[j + 6, 2]];
- range.Merge(System.Reflection.Missing.Value);
- xlSheet.Cells[j + 6, 1] = name;
+ ///*填写姓名*/
+ //for (int j = 0; j < rowsCount; j++)
+ //{
+ // drv = dgv.Rows[j];
+ // string name = drv.Cells["colName"].FormattedValue.ToString();
+ // range = xlSheet.Range[xlSheet.Cells[j + 6, 1], xlSheet.Cells[j + 6, 2]];
+ // range.Merge(System.Reflection.Missing.Value);
+ // xlSheet.Cells[j + 6, 1] = name;
- range = xlSheet.Range[xlSheet.Cells[j + 9 + rowsCount, 1], xlSheet.Cells[j + 9 + rowsCount, 2]];
- range.Merge(System.Reflection.Missing.Value);
- xlSheet.Cells[j + 9 + rowsCount, 1] = name;
- }
+ // range = xlSheet.Range[xlSheet.Cells[j + 9 + rowsCount, 1], xlSheet.Cells[j + 9 + rowsCount, 2]];
+ // range.Merge(System.Reflection.Missing.Value);
+ // xlSheet.Cells[j + 9 + rowsCount, 1] = name;
+ //}
- /*填写日期中的班次*/
- for (int i = 1; i <= dayMax; i++)
- {
- int colIndex;
- if (i <= 16)
- {
- colIndex = i + 2;
- /*填充日期表头*/
- xlSheet.Cells[3, colIndex] = listHeaderDays[i - 1];
- xlSheet.Cells[4, colIndex] = listHeaderChinese[i - 1];
- xlSheet.Cells[5, colIndex] = listHeaderWeek[i - 1];
- for (int j = 0; j < rowsCount; j++)
- {
- xlSheet.Cells[j + 6, colIndex] = dgv.Rows[j].Cells["Date" + i.ToString()].FormattedValue.ToString();
- }
- }
- else
- {
- colIndex = i - 14;
- xlSheet.Cells[6 + rowsCount, colIndex] = listHeaderDays[i - 1];
- xlSheet.Cells[7 + rowsCount, colIndex] = listHeaderChinese[i - 1];
- xlSheet.Cells[8 + rowsCount, colIndex] = listHeaderWeek[i - 1];
- for (int j = 0; j < rowsCount; j++)
- {
- xlSheet.Cells[j + 9 + rowsCount, colIndex] = dgv.Rows[j].Cells["Date" + i.ToString()].FormattedValue;
- }
- }
- Application.DoEvents();
- }
+ ///*填写日期中的班次*/
+ //for (int i = 1; i <= dayMax; i++)
+ //{
+ // int colIndex;
+ // if (i <= 16)
+ // {
+ // colIndex = i + 2;
+ // /*填充日期表头*/
+ // xlSheet.Cells[3, colIndex] = listHeaderDays[i - 1];
+ // xlSheet.Cells[4, colIndex] = listHeaderChinese[i - 1];
+ // xlSheet.Cells[5, colIndex] = listHeaderWeek[i - 1];
+ // for (int j = 0; j < rowsCount; j++)
+ // {
+ // xlSheet.Cells[j + 6, colIndex] = dgv.Rows[j].Cells["Date" + i.ToString()].FormattedValue.ToString();
+ // }
+ // }
+ // else
+ // {
+ // colIndex = i - 14;
+ // xlSheet.Cells[6 + rowsCount, colIndex] = listHeaderDays[i - 1];
+ // xlSheet.Cells[7 + rowsCount, colIndex] = listHeaderChinese[i - 1];
+ // xlSheet.Cells[8 + rowsCount, colIndex] = listHeaderWeek[i - 1];
+ // for (int j = 0; j < rowsCount; j++)
+ // {
+ // xlSheet.Cells[j + 9 + rowsCount, colIndex] = dgv.Rows[j].Cells["Date" + i.ToString()].FormattedValue;
+ // }
+ // }
+ // Application.DoEvents();
+ //}
- ///*删除模板中多余的整行*/
- string rowstr = string.Format("{0}:500", rowsCount * 2 + 9);
- range = (Microsoft.Office.Interop.Excel.Range)xlSheet.Rows[rowstr, Type.Missing];
- range.Rows.Delete(Microsoft.Office.Interop.Excel.XlDeleteShiftDirection.xlShiftUp);
+ /////*删除模板中多余的整行*/
+ //string rowstr = string.Format("{0}:500", rowsCount * 2 + 9);
+ //range = (Microsoft.Office.Interop.Excel.Range)xlSheet.Rows[rowstr, Type.Missing];
+ //range.Rows.Delete(Microsoft.Office.Interop.Excel.XlDeleteShiftDirection.xlShiftUp);
- /*设置打印为1页宽*/
- xlSheet.PageSetup.FitToPagesWide = 1;
- excel.PrintPreview();
- excel.Close();
- chxOnlyShiftPlan.Checked = oldChecked;
- }
- catch (Exception exp)
- {
- MessageBox.Show(exp.Message);
- PublicMethod.WriteLog(exp, "");
- }
+ ///*设置打印为1页宽*/
+ //xlSheet.PageSetup.FitToPagesWide = 1;
+ //excel.PrintPreview();
+ //excel.Close();
+ //chxOnlyShiftPlan.Checked = oldChecked;
+ //}
+ //catch (Exception exp)
+ //{
+ // MessageBox.Show(exp.Message);
+ // PublicMethod.WriteLog(exp, "");
+ //}
}
private void btnPrintAttendance_Click(object sender, EventArgs e)
{
- /*打印出缺勤表*/
- DateTime dateTime = this.dateTimePicker1.Value;
- int year = dateTime.Year;
- int month = dateTime.Month;
- DateTime monthFirstDay = new DateTime(year, month, 1);
- DateTime nextMonthFirstDay = monthFirstDay.AddMonths(1);
- int dayMax = nextMonthFirstDay.AddDays(-1).Day;
+ ///*打印出缺勤表*/
+ //DateTime dateTime = this.dateTimePicker1.Value;
+ //int year = dateTime.Year;
+ //int month = dateTime.Month;
+ //DateTime monthFirstDay = new DateTime(year, month, 1);
+ //DateTime nextMonthFirstDay = monthFirstDay.AddMonths(1);
+ //int dayMax = nextMonthFirstDay.AddDays(-1).Day;
- string sql = string.Format("SELECT a.WorkerId, w.[Name], Day(a.SchedulingDate) as [Day], a.WorkersType, a.OverHours, a.LackHours FROM ScheduleOverLackHours a inner join Workers w on a.WorkerId = w.id WHERE SchedulingDate >= '{0}' AND SchedulingDate<'{1}' order by WorkersType desc, w.OrderBy, [Day]", Convert.ToDateTime(monthFirstDay),Convert.ToDateTime(nextMonthFirstDay));
- DataTable dataTable = dbHelper.GetDataTable(sql);
+ //string sql = string.Format("SELECT a.WorkerId, w.[Name], Day(a.SchedulingDate) as [Day], a.WorkersType, a.OverHours, a.LackHours FROM ScheduleOverLackHours a inner join Workers w on a.WorkerId = w.id WHERE SchedulingDate >= '{0}' AND SchedulingDate<'{1}' order by WorkersType desc, w.OrderBy, [Day]", Convert.ToDateTime(monthFirstDay),Convert.ToDateTime(nextMonthFirstDay));
+ //DataTable dataTable = dbHelper.GetDataTable(sql);
- GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();
- excel.IsVisibledExcel = false;
- string filepath = string.Format("{0}\\printTemplate\\职工出缺勤表.xlt", Application.StartupPath);
- excel.Open(filepath);
- Microsoft.Office.Interop.Excel.Worksheet xlSheet = (Microsoft.Office.Interop.Excel.Worksheet)excel.Workbooks.ActiveSheet;
- string strTitle = "职工出(缺)勤表";
- excel.SetCellText(1, "A", strTitle);
- excel.SetCellText(2, "E", string.Format("{0} 年 {1} 月", year, month));
- int rowsCount = dataTable.Rows.Count;
- decimal sumOverHours = 0, sumLackHours = 0;
- int prewWorkId = 0;
- int workerNumber = 0;
- int rowsNumber = 0;
- Microsoft.Office.Interop.Excel.Range range;
- switch (dayMax)
- {
- case 30:
- ((Microsoft.Office.Interop.Excel.Range)xlSheet.Cells[1, 33]).EntireColumn.ColumnWidth = 0;
- break;
- case 29:
- ((Microsoft.Office.Interop.Excel.Range)xlSheet.Cells[1, 33]).EntireColumn.ColumnWidth = 0;
- ((Microsoft.Office.Interop.Excel.Range)xlSheet.Cells[1, 32]).EntireColumn.ColumnWidth = 0;
- break;
- case 28:
- ((Microsoft.Office.Interop.Excel.Range)xlSheet.Cells[1, 33]).EntireColumn.ColumnWidth = 0;
- ((Microsoft.Office.Interop.Excel.Range)xlSheet.Cells[1, 32]).EntireColumn.ColumnWidth = 0;
- ((Microsoft.Office.Interop.Excel.Range)xlSheet.Cells[1, 31]).EntireColumn.ColumnWidth = 0;
- break;
- default:
- break;
- }
+ //GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();
+ //excel.IsVisibledExcel = false;
+ //string filepath = string.Format("{0}\\printTemplate\\职工出缺勤表.xlt", Application.StartupPath);
+ //excel.Open(filepath);
+ //Microsoft.Office.Interop.Excel.Worksheet xlSheet = (Microsoft.Office.Interop.Excel.Worksheet)excel.Workbooks.ActiveSheet;
+ //string strTitle = "职工出(缺)勤表";
+ //excel.SetCellText(1, "A", strTitle);
+ //excel.SetCellText(2, "E", string.Format("{0} 年 {1} 月", year, month));
+ //int rowsCount = dataTable.Rows.Count;
+ //decimal sumOverHours = 0, sumLackHours = 0;
+ //int prewWorkId = 0;
+ //int workerNumber = 0;
+ //int rowsNumber = 0;
+ //Microsoft.Office.Interop.Excel.Range range;
+ //switch (dayMax)
+ //{
+ // case 30:
+ // ((Microsoft.Office.Interop.Excel.Range)xlSheet.Cells[1, 33]).EntireColumn.ColumnWidth = 0;
+ // break;
+ // case 29:
+ // ((Microsoft.Office.Interop.Excel.Range)xlSheet.Cells[1, 33]).EntireColumn.ColumnWidth = 0;
+ // ((Microsoft.Office.Interop.Excel.Range)xlSheet.Cells[1, 32]).EntireColumn.ColumnWidth = 0;
+ // break;
+ // case 28:
+ // ((Microsoft.Office.Interop.Excel.Range)xlSheet.Cells[1, 33]).EntireColumn.ColumnWidth = 0;
+ // ((Microsoft.Office.Interop.Excel.Range)xlSheet.Cells[1, 32]).EntireColumn.ColumnWidth = 0;
+ // ((Microsoft.Office.Interop.Excel.Range)xlSheet.Cells[1, 31]).EntireColumn.ColumnWidth = 0;
+ // break;
+ // default:
+ // break;
+ //}
- for (int i = 0; i < rowsCount; i++)
- {
- decimal overHours, lackHours;
- DataRow dr = dataTable.Rows[i];
+ //for (int i = 0; i < rowsCount; i++)
+ //{
+ // decimal overHours, lackHours;
+ // DataRow dr = dataTable.Rows[i];
- int workerId = Convert.ToInt32(dr["WorkerId"]);
- int day = Convert.ToInt32(dr["Day"]);
- overHours = GPFunctions.CDecimal(dr["OverHours"]);
- lackHours = GPFunctions.CDecimal(dr["LackHours"]);
+ // int workerId = Convert.ToInt32(dr["WorkerId"]);
+ // int day = Convert.ToInt32(dr["Day"]);
+ // overHours = GPFunctions.CDecimal(dr["OverHours"]);
+ // lackHours = GPFunctions.CDecimal(dr["LackHours"]);
- if (workerId == prewWorkId)
- {
- sumOverHours += overHours;
- sumLackHours += lackHours;
- }
- else
- {
- /*合并姓名单元格, 填入名称*/
- workerNumber++;
- rowsNumber = 4 + (workerNumber - 1) * 2;
- range = xlSheet.Range[xlSheet.Cells[rowsNumber, 1], xlSheet.Cells[rowsNumber + 1, 1]];
- range.Merge(System.Reflection.Missing.Value);
- xlSheet.Cells[rowsNumber, 1] = dr["Name"].ToString();
+ // if (workerId == prewWorkId)
+ // {
+ // sumOverHours += overHours;
+ // sumLackHours += lackHours;
+ // }
+ // else
+ // {
+ // /*合并姓名单元格, 填入名称*/
+ // workerNumber++;
+ // rowsNumber = 4 + (workerNumber - 1) * 2;
+ // range = xlSheet.Range[xlSheet.Cells[rowsNumber, 1], xlSheet.Cells[rowsNumber + 1, 1]];
+ // range.Merge(System.Reflection.Missing.Value);
+ // xlSheet.Cells[rowsNumber, 1] = dr["Name"].ToString();
- xlSheet.Cells[rowsNumber, 2] = "加班";
- xlSheet.Cells[rowsNumber + 1, 2] = "缺勤";
+ // xlSheet.Cells[rowsNumber, 2] = "加班";
+ // xlSheet.Cells[rowsNumber + 1, 2] = "缺勤";
- range = xlSheet.Range[xlSheet.Cells[rowsNumber, "AI"], xlSheet.Cells[rowsNumber + 1, "AI"]];
- range.Merge(System.Reflection.Missing.Value);
+ // range = xlSheet.Range[xlSheet.Cells[rowsNumber, "AI"], xlSheet.Cells[rowsNumber + 1, "AI"]];
+ // range.Merge(System.Reflection.Missing.Value);
- /*设置缺勤行字体颜色*/
- rowsNumber = rowsNumber + 1;
- range = xlSheet.Range[xlSheet.Cells[rowsNumber, 2], xlSheet.Cells[rowsNumber, 34]];
- range.Font.Color = Color.Red; //红色
+ // /*设置缺勤行字体颜色*/
+ // rowsNumber = rowsNumber + 1;
+ // range = xlSheet.Range[xlSheet.Cells[rowsNumber, 2], xlSheet.Cells[rowsNumber, 34]];
+ // range.Font.Color = Color.Red; //红色
- if (workerNumber > 1)
- {
- /*填写上一个职工行的合计数*/
- rowsNumber = 4 + (workerNumber - 2) * 2;
- if (sumOverHours > 0) xlSheet.Cells[rowsNumber, "AH"] = sumOverHours;
- if (sumLackHours > 0) xlSheet.Cells[rowsNumber + 1, "AH"] = sumLackHours;
+ // if (workerNumber > 1)
+ // {
+ // /*填写上一个职工行的合计数*/
+ // rowsNumber = 4 + (workerNumber - 2) * 2;
+ // if (sumOverHours > 0) xlSheet.Cells[rowsNumber, "AH"] = sumOverHours;
+ // if (sumLackHours > 0) xlSheet.Cells[rowsNumber + 1, "AH"] = sumLackHours;
- /*合并累计单元格*/
- xlSheet.Cells[rowsNumber, "AI"] = sumOverHours - sumLackHours;
- if (sumOverHours - sumLackHours < 0)
- {
- /*累计小于0,红色显示*/
- range.Font.Color = Color.Red; //红色
- }
- }
- sumOverHours = overHours;
- sumLackHours = lackHours;
+ // /*合并累计单元格*/
+ // xlSheet.Cells[rowsNumber, "AI"] = sumOverHours - sumLackHours;
+ // if (sumOverHours - sumLackHours < 0)
+ // {
+ // /*累计小于0,红色显示*/
+ // range.Font.Color = Color.Red; //红色
+ // }
+ // }
+ // sumOverHours = overHours;
+ // sumLackHours = lackHours;
- prewWorkId = workerId;
- }
- /*填入加班和缺勤缺勤小时数*/
- rowsNumber = 4 + (workerNumber - 1) * 2;
- if (overHours > 0) xlSheet.Cells[rowsNumber, 2 + day] = overHours;
- if (lackHours > 0) xlSheet.Cells[rowsNumber + 1, 2 + day] = lackHours;
+ // prewWorkId = workerId;
+ // }
+ // /*填入加班和缺勤缺勤小时数*/
+ // rowsNumber = 4 + (workerNumber - 1) * 2;
+ // if (overHours > 0) xlSheet.Cells[rowsNumber, 2 + day] = overHours;
+ // if (lackHours > 0) xlSheet.Cells[rowsNumber + 1, 2 + day] = lackHours;
- Application.DoEvents();
- }
+ // Application.DoEvents();
+ //}
- if (workerNumber > 0)
- {
- /*填写最后一个职工行的合计数*/
- rowsNumber = 4 + (workerNumber - 1) * 2;
- if (sumOverHours > 0) xlSheet.Cells[rowsNumber, "AH"] = sumOverHours;
- if (sumLackHours > 0) xlSheet.Cells[rowsNumber + 1, "AH"] = sumLackHours;
- xlSheet.Cells[rowsNumber, "AI"] = sumOverHours - sumLackHours;
- if (sumOverHours - sumLackHours < 0)
- {
- /*累计小于0,红色显示*/
- range = xlSheet.Range[xlSheet.Cells[rowsNumber, "AI"], xlSheet.Cells[rowsNumber, "AI"]];
- range.Font.Color = Color.Red; //红色
- }
- }
- excel.PrintPreview();
- excel.Close();
+ //if (workerNumber > 0)
+ //{
+ // /*填写最后一个职工行的合计数*/
+ // rowsNumber = 4 + (workerNumber - 1) * 2;
+ // if (sumOverHours > 0) xlSheet.Cells[rowsNumber, "AH"] = sumOverHours;
+ // if (sumLackHours > 0) xlSheet.Cells[rowsNumber + 1, "AH"] = sumLackHours;
+ // xlSheet.Cells[rowsNumber, "AI"] = sumOverHours - sumLackHours;
+ // if (sumOverHours - sumLackHours < 0)
+ // {
+ // /*累计小于0,红色显示*/
+ // range = xlSheet.Range[xlSheet.Cells[rowsNumber, "AI"], xlSheet.Cells[rowsNumber, "AI"]];
+ // range.Font.Color = Color.Red; //红色
+ // }
+ //}
+ //excel.PrintPreview();
+ //excel.Close();
}
private void btnUp_Click(object sender, EventArgs e)
diff --git a/AIMS/Template/手术清点记录单.xlsx b/AIMS/Template/手术清点记录单.xlsx
deleted file mode 100644
index 76ce52f..0000000
Binary files a/AIMS/Template/手术清点记录单.xlsx and /dev/null differ