清除Office Excel使用
This commit is contained in:
parent
c3e02df981
commit
7131eb6d11
@ -58,9 +58,6 @@
|
|||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\DotNetBar for Windows Forms\DevComponents.DotNetBar2.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\DotNetBar for Windows Forms\DevComponents.DotNetBar2.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="GoldPrinter">
|
|
||||||
<HintPath>Extensions\GoldPrinter.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||||
@ -82,11 +79,6 @@
|
|||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>Extensions\Newtonsoft.Json.dll</HintPath>
|
<HintPath>Extensions\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
|
||||||
<HintPath>Extensions\office.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Windows.Forms.DataVisualization" />
|
<Reference Include="System.Windows.Forms.DataVisualization" />
|
||||||
@ -1324,7 +1316,6 @@
|
|||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
<None Include="Template\手术清点记录单.xlsx" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="aims.ico" />
|
<Content Include="aims.ico" />
|
||||||
|
|||||||
@ -370,56 +370,56 @@ namespace AIMS.OperationDoing.AnasRecordBill
|
|||||||
}
|
}
|
||||||
private void tsbLead_Click(object sender, EventArgs e)
|
private void tsbLead_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();
|
//GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();
|
||||||
string strFileName = "精一药品使用记录单.xlt"; //模板文件名
|
//string strFileName = "精一药品使用记录单.xlt"; //模板文件名
|
||||||
string strExcelTemplateFile = AppDomain.CurrentDomain.BaseDirectory;
|
//string strExcelTemplateFile = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
strExcelTemplateFile += @"\printTemplate\" + strFileName;
|
//strExcelTemplateFile += @"\printTemplate\" + strFileName;
|
||||||
excel.Open(strExcelTemplateFile); //用模板文件
|
//excel.Open(strExcelTemplateFile); //用模板文件
|
||||||
int rowNum = 4;
|
//int rowNum = 4;
|
||||||
string Letters = "A B C D E F G H I J K L M N O P Q R";
|
//string Letters = "A B C D E F G H I J K L M N O P Q R";
|
||||||
string[] letter = Letters.Split(' ');
|
//string[] letter = Letters.Split(' ');
|
||||||
DateTime dtBegin = reBeginTime(dtpBegin.Value, "begin");
|
//DateTime dtBegin = reBeginTime(dtpBegin.Value, "begin");
|
||||||
DateTime dtEnd = reBeginTime(dtpEnd.Value, "end");
|
//DateTime dtEnd = reBeginTime(dtpEnd.Value, "end");
|
||||||
if (_record != null)
|
//if (_record != null)
|
||||||
{
|
//{
|
||||||
dtBegin = reBeginTime(_record.InRoomTime.Value, "begin");
|
// dtBegin = reBeginTime(_record.InRoomTime.Value, "begin");
|
||||||
dtEnd = reBeginTime(_record.InRoomTime.Value, "end");
|
// dtEnd = reBeginTime(_record.InRoomTime.Value, "end");
|
||||||
lists = BUseDrugsReportManager.GetListByDateTimeWork(dtBegin.ToString(), dtEnd.ToString(), _record.Id.Value);
|
// lists = BUseDrugsReportManager.GetListByDateTimeWork(dtBegin.ToString(), dtEnd.ToString(), _record.Id.Value);
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
lists = BUseDrugsReportManager.GetListByDateTime(dtBegin.ToString(), dtEnd.ToString());
|
// lists = BUseDrugsReportManager.GetListByDateTime(dtBegin.ToString(), dtEnd.ToString());
|
||||||
}
|
//}
|
||||||
for (int j = 0; j < lists.Count; j++)
|
//for (int j = 0; j < lists.Count; j++)
|
||||||
{
|
//{
|
||||||
rowNum++;
|
// rowNum++;
|
||||||
UseDrugsReport temp = lists[j];
|
// UseDrugsReport temp = lists[j];
|
||||||
string enter = temp.Enter == 1 ? "√" : "";
|
// string enter = temp.Enter == 1 ? "√" : "";
|
||||||
excel.GetRange(rowNum, "A", rowNum, "R").RowHeight = 24.75;
|
// 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, "R").Borders.LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
|
||||||
excel.GetRange(rowNum, "A", rowNum, "P").Value = new string[]{
|
// excel.GetRange(rowNum, "A", rowNum, "P").Value = new string[]{
|
||||||
(j+1).ToString(),
|
// (j+1).ToString(),
|
||||||
temp.使用日期,
|
// temp.使用日期,
|
||||||
temp.术间,
|
// temp.术间,
|
||||||
temp.患者姓名,
|
// temp.患者姓名,
|
||||||
temp.住院号 ,
|
// temp.住院号 ,
|
||||||
temp.药品名称,
|
// temp.药品名称,
|
||||||
temp.处方剂量,
|
// temp.处方剂量,
|
||||||
temp.批号,
|
// temp.批号,
|
||||||
temp.用量,
|
// temp.用量,
|
||||||
temp.残留剂量,
|
// temp.残留剂量,
|
||||||
temp.残液处理方式,
|
// temp.残液处理方式,
|
||||||
temp.镇痛泵使用量,
|
// temp.镇痛泵使用量,
|
||||||
temp.镇痛泵余量,
|
// temp.镇痛泵余量,
|
||||||
temp.处方医师,
|
// temp.处方医师,
|
||||||
temp.医生签名2,
|
// temp.医生签名2,
|
||||||
enter
|
// enter
|
||||||
};
|
// };
|
||||||
|
|
||||||
}
|
//}
|
||||||
excel.PrintPreview();
|
//excel.PrintPreview();
|
||||||
this.Focus();
|
//this.Focus();
|
||||||
excel.Close();
|
//excel.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
Object cellTempValue = null;
|
Object cellTempValue = null;
|
||||||
|
|||||||
@ -8,7 +8,6 @@ using System.Windows.Forms;
|
|||||||
using AIMSExtension;
|
using AIMSExtension;
|
||||||
using DevComponents.Editors.DateTimeAdv;
|
using DevComponents.Editors.DateTimeAdv;
|
||||||
using DrawGraph;
|
using DrawGraph;
|
||||||
using Microsoft.Office.Core;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace AIMS.OperationDoing.AnasRecordBill
|
namespace AIMS.OperationDoing.AnasRecordBill
|
||||||
@ -174,152 +173,6 @@ namespace AIMS.OperationDoing.AnasRecordBill
|
|||||||
Image image = Image.FromStream(ms);
|
Image image = Image.FromStream(ms);
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
//public static void SavePrintDocStatic(Dictionary<string, string> dicList, int modelId, int ApplyId)
|
|
||||||
//{
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// if (modelId != 0) BDocumentManager.DeleteStatic(modelId, ApplyId);
|
|
||||||
// List<PrintDocStatic> modelStatics = new List<PrintDocStatic>();
|
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 循环控件值写入excel
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="cons"></param>
|
|
||||||
/// <param name="excel"></param>
|
|
||||||
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
|
public class JsonTextForDoc
|
||||||
|
|||||||
@ -362,17 +362,6 @@ namespace AIMS.OperationDoing.AnasRecordBill
|
|||||||
public void toolStripButton2_Click(object sender, EventArgs e)
|
public void toolStripButton2_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
SaveReport(false);
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public void setLine(Excel.Range m_objRange)
|
public void setLine(Excel.Range m_objRange)
|
||||||
{
|
{
|
||||||
@ -388,123 +377,8 @@ namespace AIMS.OperationDoing.AnasRecordBill
|
|||||||
public void tsbSaveOperationApply_Click(object sender, EventArgs e)
|
public void tsbSaveOperationApply_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
SaveReport(false);
|
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<ApplianceRecord> ApplianceRecordList = new List<ApplianceRecord>();
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
public void toolStripButton3_Click(object sender, EventArgs e)
|
public void toolStripButton3_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Initial();
|
Initial();
|
||||||
|
|||||||
@ -7,7 +7,6 @@ using System.Drawing;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using GoldPrinter;
|
|
||||||
|
|
||||||
namespace AIMS.OperationFront.UI
|
namespace AIMS.OperationFront.UI
|
||||||
{
|
{
|
||||||
@ -1498,239 +1497,239 @@ namespace AIMS.OperationFront.UI
|
|||||||
}
|
}
|
||||||
private void btnPrint_Click(object sender, EventArgs e)
|
private void btnPrint_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
//try
|
||||||
{
|
//{
|
||||||
/*打印排班表*/
|
// /*打印排班表*/
|
||||||
bool oldChecked = chxOnlyShiftPlan.Checked;
|
// bool oldChecked = chxOnlyShiftPlan.Checked;
|
||||||
chxOnlyShiftPlan.Checked = true;
|
// chxOnlyShiftPlan.Checked = true;
|
||||||
|
|
||||||
DateTime dateTime = this.dateTimePicker1.Value;
|
// DateTime dateTime = this.dateTimePicker1.Value;
|
||||||
int year = dateTime.Year;
|
// int year = dateTime.Year;
|
||||||
int month = dateTime.Month;
|
// int month = dateTime.Month;
|
||||||
DateTime monthFirstDay = new DateTime(year, month, 1);
|
// DateTime monthFirstDay = new DateTime(year, month, 1);
|
||||||
DateTime monthLastDay = (new DateTime(year, month, 1)).AddMonths(1).AddDays(-1);
|
// DateTime monthLastDay = (new DateTime(year, month, 1)).AddMonths(1).AddDays(-1);
|
||||||
int dayMax = monthLastDay.Day;
|
// int dayMax = monthLastDay.Day;
|
||||||
|
|
||||||
DataGridView dgv = this.dataGridView1;
|
//DataGridView dgv = this.dataGridView1;
|
||||||
int rowsCount = dgv.Rows.Count;
|
//int rowsCount = dgv.Rows.Count;
|
||||||
string filepath = string.Format("{0}\\Template\\排班按月.xlt", AppDomain.CurrentDomain.BaseDirectory);
|
//string filepath = string.Format("{0}\\Template\\排班按月.xlt", AppDomain.CurrentDomain.BaseDirectory);
|
||||||
|
|
||||||
GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();
|
//GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();
|
||||||
excel.IsVisibledExcel = false;
|
//excel.IsVisibledExcel = false;
|
||||||
excel.Open(filepath);
|
//excel.Open(filepath);
|
||||||
Microsoft.Office.Interop.Excel.Worksheet xlSheet = (Microsoft.Office.Interop.Excel.Worksheet)excel.Workbooks.ActiveSheet;
|
//Microsoft.Office.Interop.Excel.Worksheet xlSheet = (Microsoft.Office.Interop.Excel.Worksheet)excel.Workbooks.ActiveSheet;
|
||||||
string strTitle;
|
//string strTitle;
|
||||||
strTitle = PublicMethod.GetHospitalName();
|
// strTitle = PublicMethod.GetHospitalName();
|
||||||
excel.SetCellText(1, "A", strTitle);
|
//excel.SetCellText(1, "A", strTitle);
|
||||||
|
|
||||||
/*标题*/
|
///*标题*/
|
||||||
strTitle = (radioDoctor.Checked) ? "麻醉医生" : "护士";
|
//strTitle = (radioDoctor.Checked) ? "麻醉医生" : "护士";
|
||||||
excel.SetCellText(2, "A", string.Format("{0}年{1}月 {2}", year, month, strTitle));
|
//excel.SetCellText(2, "A", string.Format("{0}年{1}月 {2}", year, month, strTitle));
|
||||||
Microsoft.Office.Interop.Excel.Range range;
|
//Microsoft.Office.Interop.Excel.Range range;
|
||||||
DataGridViewRow drv;
|
//DataGridViewRow drv;
|
||||||
|
|
||||||
/*填写16-31日的姓名标题,合并姓名单元格*/
|
///*填写16-31日的姓名标题,合并姓名单元格*/
|
||||||
range = xlSheet.Range[xlSheet.Cells[6 + rowsCount, 1], xlSheet.Cells[8 + rowsCount, 1]];
|
//range = xlSheet.Range[xlSheet.Cells[6 + rowsCount, 1], xlSheet.Cells[8 + rowsCount, 1]];
|
||||||
range.Merge(System.Reflection.Missing.Value);
|
//range.Merge(System.Reflection.Missing.Value);
|
||||||
|
|
||||||
range.Font.Color = Color.Red; //红色
|
//range.Font.Color = Color.Red; //红色
|
||||||
xlSheet.Cells[6 + rowsCount, 1] = "姓名";
|
//xlSheet.Cells[6 + rowsCount, 1] = "姓名";
|
||||||
xlSheet.Cells[6 + rowsCount, 2] = "阴历";
|
//xlSheet.Cells[6 + rowsCount, 2] = "阴历";
|
||||||
xlSheet.Cells[7 + rowsCount, 2] = "阳历";
|
//xlSheet.Cells[7 + rowsCount, 2] = "阳历";
|
||||||
xlSheet.Cells[8 + rowsCount, 2] = "星期";
|
//xlSheet.Cells[8 + rowsCount, 2] = "星期";
|
||||||
|
|
||||||
/*设置标题栏红色*/
|
///*设置标题栏红色*/
|
||||||
range = xlSheet.Range[xlSheet.Cells[3, 2], xlSheet.Cells[5, 20]];
|
//range = xlSheet.Range[xlSheet.Cells[3, 2], xlSheet.Cells[5, 20]];
|
||||||
range.Font.Color = Color.Red; //红色
|
//range.Font.Color = Color.Red; //红色
|
||||||
range = xlSheet.Range[xlSheet.Cells[6 + rowsCount, 2], xlSheet.Cells[8 + rowsCount, 20]];
|
//range = xlSheet.Range[xlSheet.Cells[6 + rowsCount, 2], xlSheet.Cells[8 + rowsCount, 20]];
|
||||||
range.Font.Color = Color.Red; //红色
|
//range.Font.Color = Color.Red; //红色
|
||||||
|
|
||||||
/*填写姓名*/
|
///*填写姓名*/
|
||||||
for (int j = 0; j < rowsCount; j++)
|
//for (int j = 0; j < rowsCount; j++)
|
||||||
{
|
//{
|
||||||
drv = dgv.Rows[j];
|
// drv = dgv.Rows[j];
|
||||||
string name = drv.Cells["colName"].FormattedValue.ToString();
|
// string name = drv.Cells["colName"].FormattedValue.ToString();
|
||||||
range = xlSheet.Range[xlSheet.Cells[j + 6, 1], xlSheet.Cells[j + 6, 2]];
|
// range = xlSheet.Range[xlSheet.Cells[j + 6, 1], xlSheet.Cells[j + 6, 2]];
|
||||||
range.Merge(System.Reflection.Missing.Value);
|
// range.Merge(System.Reflection.Missing.Value);
|
||||||
xlSheet.Cells[j + 6, 1] = name;
|
// xlSheet.Cells[j + 6, 1] = name;
|
||||||
|
|
||||||
range = xlSheet.Range[xlSheet.Cells[j + 9 + rowsCount, 1], xlSheet.Cells[j + 9 + rowsCount, 2]];
|
// range = xlSheet.Range[xlSheet.Cells[j + 9 + rowsCount, 1], xlSheet.Cells[j + 9 + rowsCount, 2]];
|
||||||
range.Merge(System.Reflection.Missing.Value);
|
// range.Merge(System.Reflection.Missing.Value);
|
||||||
xlSheet.Cells[j + 9 + rowsCount, 1] = name;
|
// xlSheet.Cells[j + 9 + rowsCount, 1] = name;
|
||||||
}
|
//}
|
||||||
|
|
||||||
/*填写日期中的班次*/
|
///*填写日期中的班次*/
|
||||||
for (int i = 1; i <= dayMax; i++)
|
//for (int i = 1; i <= dayMax; i++)
|
||||||
{
|
//{
|
||||||
int colIndex;
|
// int colIndex;
|
||||||
if (i <= 16)
|
// if (i <= 16)
|
||||||
{
|
// {
|
||||||
colIndex = i + 2;
|
// colIndex = i + 2;
|
||||||
/*填充日期表头*/
|
// /*填充日期表头*/
|
||||||
xlSheet.Cells[3, colIndex] = listHeaderDays[i - 1];
|
// xlSheet.Cells[3, colIndex] = listHeaderDays[i - 1];
|
||||||
xlSheet.Cells[4, colIndex] = listHeaderChinese[i - 1];
|
// xlSheet.Cells[4, colIndex] = listHeaderChinese[i - 1];
|
||||||
xlSheet.Cells[5, colIndex] = listHeaderWeek[i - 1];
|
// xlSheet.Cells[5, colIndex] = listHeaderWeek[i - 1];
|
||||||
for (int j = 0; j < rowsCount; j++)
|
// for (int j = 0; j < rowsCount; j++)
|
||||||
{
|
// {
|
||||||
xlSheet.Cells[j + 6, colIndex] = dgv.Rows[j].Cells["Date" + i.ToString()].FormattedValue.ToString();
|
// xlSheet.Cells[j + 6, colIndex] = dgv.Rows[j].Cells["Date" + i.ToString()].FormattedValue.ToString();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
colIndex = i - 14;
|
// colIndex = i - 14;
|
||||||
xlSheet.Cells[6 + rowsCount, colIndex] = listHeaderDays[i - 1];
|
// xlSheet.Cells[6 + rowsCount, colIndex] = listHeaderDays[i - 1];
|
||||||
xlSheet.Cells[7 + rowsCount, colIndex] = listHeaderChinese[i - 1];
|
// xlSheet.Cells[7 + rowsCount, colIndex] = listHeaderChinese[i - 1];
|
||||||
xlSheet.Cells[8 + rowsCount, colIndex] = listHeaderWeek[i - 1];
|
// xlSheet.Cells[8 + rowsCount, colIndex] = listHeaderWeek[i - 1];
|
||||||
for (int j = 0; j < rowsCount; j++)
|
// for (int j = 0; j < rowsCount; j++)
|
||||||
{
|
// {
|
||||||
xlSheet.Cells[j + 9 + rowsCount, colIndex] = dgv.Rows[j].Cells["Date" + i.ToString()].FormattedValue;
|
// xlSheet.Cells[j + 9 + rowsCount, colIndex] = dgv.Rows[j].Cells["Date" + i.ToString()].FormattedValue;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
Application.DoEvents();
|
// Application.DoEvents();
|
||||||
}
|
//}
|
||||||
|
|
||||||
///*删除模板中多余的整行*/
|
/////*删除模板中多余的整行*/
|
||||||
string rowstr = string.Format("{0}:500", rowsCount * 2 + 9);
|
//string rowstr = string.Format("{0}:500", rowsCount * 2 + 9);
|
||||||
range = (Microsoft.Office.Interop.Excel.Range)xlSheet.Rows[rowstr, Type.Missing];
|
//range = (Microsoft.Office.Interop.Excel.Range)xlSheet.Rows[rowstr, Type.Missing];
|
||||||
range.Rows.Delete(Microsoft.Office.Interop.Excel.XlDeleteShiftDirection.xlShiftUp);
|
//range.Rows.Delete(Microsoft.Office.Interop.Excel.XlDeleteShiftDirection.xlShiftUp);
|
||||||
|
|
||||||
/*设置打印为1页宽*/
|
///*设置打印为1页宽*/
|
||||||
xlSheet.PageSetup.FitToPagesWide = 1;
|
//xlSheet.PageSetup.FitToPagesWide = 1;
|
||||||
excel.PrintPreview();
|
//excel.PrintPreview();
|
||||||
excel.Close();
|
//excel.Close();
|
||||||
chxOnlyShiftPlan.Checked = oldChecked;
|
//chxOnlyShiftPlan.Checked = oldChecked;
|
||||||
}
|
//}
|
||||||
catch (Exception exp)
|
//catch (Exception exp)
|
||||||
{
|
//{
|
||||||
MessageBox.Show(exp.Message);
|
// MessageBox.Show(exp.Message);
|
||||||
PublicMethod.WriteLog(exp, "");
|
// PublicMethod.WriteLog(exp, "");
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnPrintAttendance_Click(object sender, EventArgs e)
|
private void btnPrintAttendance_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
/*打印出缺勤表*/
|
///*打印出缺勤表*/
|
||||||
DateTime dateTime = this.dateTimePicker1.Value;
|
//DateTime dateTime = this.dateTimePicker1.Value;
|
||||||
int year = dateTime.Year;
|
//int year = dateTime.Year;
|
||||||
int month = dateTime.Month;
|
//int month = dateTime.Month;
|
||||||
DateTime monthFirstDay = new DateTime(year, month, 1);
|
//DateTime monthFirstDay = new DateTime(year, month, 1);
|
||||||
DateTime nextMonthFirstDay = monthFirstDay.AddMonths(1);
|
//DateTime nextMonthFirstDay = monthFirstDay.AddMonths(1);
|
||||||
int dayMax = nextMonthFirstDay.AddDays(-1).Day;
|
//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));
|
//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);
|
//DataTable dataTable = dbHelper.GetDataTable(sql);
|
||||||
|
|
||||||
GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();
|
//GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();
|
||||||
excel.IsVisibledExcel = false;
|
//excel.IsVisibledExcel = false;
|
||||||
string filepath = string.Format("{0}\\printTemplate\\职工出缺勤表.xlt", Application.StartupPath);
|
//string filepath = string.Format("{0}\\printTemplate\\职工出缺勤表.xlt", Application.StartupPath);
|
||||||
excel.Open(filepath);
|
//excel.Open(filepath);
|
||||||
Microsoft.Office.Interop.Excel.Worksheet xlSheet = (Microsoft.Office.Interop.Excel.Worksheet)excel.Workbooks.ActiveSheet;
|
//Microsoft.Office.Interop.Excel.Worksheet xlSheet = (Microsoft.Office.Interop.Excel.Worksheet)excel.Workbooks.ActiveSheet;
|
||||||
string strTitle = "职工出(缺)勤表";
|
//string strTitle = "职工出(缺)勤表";
|
||||||
excel.SetCellText(1, "A", strTitle);
|
//excel.SetCellText(1, "A", strTitle);
|
||||||
excel.SetCellText(2, "E", string.Format("{0} 年 {1} 月", year, month));
|
//excel.SetCellText(2, "E", string.Format("{0} 年 {1} 月", year, month));
|
||||||
int rowsCount = dataTable.Rows.Count;
|
//int rowsCount = dataTable.Rows.Count;
|
||||||
decimal sumOverHours = 0, sumLackHours = 0;
|
//decimal sumOverHours = 0, sumLackHours = 0;
|
||||||
int prewWorkId = 0;
|
//int prewWorkId = 0;
|
||||||
int workerNumber = 0;
|
//int workerNumber = 0;
|
||||||
int rowsNumber = 0;
|
//int rowsNumber = 0;
|
||||||
Microsoft.Office.Interop.Excel.Range range;
|
//Microsoft.Office.Interop.Excel.Range range;
|
||||||
switch (dayMax)
|
//switch (dayMax)
|
||||||
{
|
//{
|
||||||
case 30:
|
// case 30:
|
||||||
((Microsoft.Office.Interop.Excel.Range)xlSheet.Cells[1, 33]).EntireColumn.ColumnWidth = 0;
|
// ((Microsoft.Office.Interop.Excel.Range)xlSheet.Cells[1, 33]).EntireColumn.ColumnWidth = 0;
|
||||||
break;
|
// break;
|
||||||
case 29:
|
// case 29:
|
||||||
((Microsoft.Office.Interop.Excel.Range)xlSheet.Cells[1, 33]).EntireColumn.ColumnWidth = 0;
|
// ((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, 32]).EntireColumn.ColumnWidth = 0;
|
||||||
break;
|
// break;
|
||||||
case 28:
|
// case 28:
|
||||||
((Microsoft.Office.Interop.Excel.Range)xlSheet.Cells[1, 33]).EntireColumn.ColumnWidth = 0;
|
// ((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, 32]).EntireColumn.ColumnWidth = 0;
|
||||||
((Microsoft.Office.Interop.Excel.Range)xlSheet.Cells[1, 31]).EntireColumn.ColumnWidth = 0;
|
// ((Microsoft.Office.Interop.Excel.Range)xlSheet.Cells[1, 31]).EntireColumn.ColumnWidth = 0;
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
break;
|
// break;
|
||||||
}
|
//}
|
||||||
|
|
||||||
for (int i = 0; i < rowsCount; i++)
|
//for (int i = 0; i < rowsCount; i++)
|
||||||
{
|
//{
|
||||||
decimal overHours, lackHours;
|
// decimal overHours, lackHours;
|
||||||
DataRow dr = dataTable.Rows[i];
|
// DataRow dr = dataTable.Rows[i];
|
||||||
|
|
||||||
int workerId = Convert.ToInt32(dr["WorkerId"]);
|
// int workerId = Convert.ToInt32(dr["WorkerId"]);
|
||||||
int day = Convert.ToInt32(dr["Day"]);
|
// int day = Convert.ToInt32(dr["Day"]);
|
||||||
overHours = GPFunctions.CDecimal(dr["OverHours"]);
|
// overHours = GPFunctions.CDecimal(dr["OverHours"]);
|
||||||
lackHours = GPFunctions.CDecimal(dr["LackHours"]);
|
// lackHours = GPFunctions.CDecimal(dr["LackHours"]);
|
||||||
|
|
||||||
if (workerId == prewWorkId)
|
// if (workerId == prewWorkId)
|
||||||
{
|
// {
|
||||||
sumOverHours += overHours;
|
// sumOverHours += overHours;
|
||||||
sumLackHours += lackHours;
|
// sumLackHours += lackHours;
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
/*合并姓名单元格, 填入名称*/
|
// /*合并姓名单元格, 填入名称*/
|
||||||
workerNumber++;
|
// workerNumber++;
|
||||||
rowsNumber = 4 + (workerNumber - 1) * 2;
|
// rowsNumber = 4 + (workerNumber - 1) * 2;
|
||||||
range = xlSheet.Range[xlSheet.Cells[rowsNumber, 1], xlSheet.Cells[rowsNumber + 1, 1]];
|
// range = xlSheet.Range[xlSheet.Cells[rowsNumber, 1], xlSheet.Cells[rowsNumber + 1, 1]];
|
||||||
range.Merge(System.Reflection.Missing.Value);
|
// range.Merge(System.Reflection.Missing.Value);
|
||||||
xlSheet.Cells[rowsNumber, 1] = dr["Name"].ToString();
|
// xlSheet.Cells[rowsNumber, 1] = dr["Name"].ToString();
|
||||||
|
|
||||||
xlSheet.Cells[rowsNumber, 2] = "加班";
|
// xlSheet.Cells[rowsNumber, 2] = "加班";
|
||||||
xlSheet.Cells[rowsNumber + 1, 2] = "缺勤";
|
// xlSheet.Cells[rowsNumber + 1, 2] = "缺勤";
|
||||||
|
|
||||||
range = xlSheet.Range[xlSheet.Cells[rowsNumber, "AI"], xlSheet.Cells[rowsNumber + 1, "AI"]];
|
// range = xlSheet.Range[xlSheet.Cells[rowsNumber, "AI"], xlSheet.Cells[rowsNumber + 1, "AI"]];
|
||||||
range.Merge(System.Reflection.Missing.Value);
|
// range.Merge(System.Reflection.Missing.Value);
|
||||||
|
|
||||||
/*设置缺勤行字体颜色*/
|
// /*设置缺勤行字体颜色*/
|
||||||
rowsNumber = rowsNumber + 1;
|
// rowsNumber = rowsNumber + 1;
|
||||||
range = xlSheet.Range[xlSheet.Cells[rowsNumber, 2], xlSheet.Cells[rowsNumber, 34]];
|
// range = xlSheet.Range[xlSheet.Cells[rowsNumber, 2], xlSheet.Cells[rowsNumber, 34]];
|
||||||
range.Font.Color = Color.Red; //红色
|
// range.Font.Color = Color.Red; //红色
|
||||||
|
|
||||||
if (workerNumber > 1)
|
// if (workerNumber > 1)
|
||||||
{
|
// {
|
||||||
/*填写上一个职工行的合计数*/
|
// /*填写上一个职工行的合计数*/
|
||||||
rowsNumber = 4 + (workerNumber - 2) * 2;
|
// rowsNumber = 4 + (workerNumber - 2) * 2;
|
||||||
if (sumOverHours > 0) xlSheet.Cells[rowsNumber, "AH"] = sumOverHours;
|
// if (sumOverHours > 0) xlSheet.Cells[rowsNumber, "AH"] = sumOverHours;
|
||||||
if (sumLackHours > 0) xlSheet.Cells[rowsNumber + 1, "AH"] = sumLackHours;
|
// if (sumLackHours > 0) xlSheet.Cells[rowsNumber + 1, "AH"] = sumLackHours;
|
||||||
|
|
||||||
/*合并累计单元格*/
|
// /*合并累计单元格*/
|
||||||
xlSheet.Cells[rowsNumber, "AI"] = sumOverHours - sumLackHours;
|
// xlSheet.Cells[rowsNumber, "AI"] = sumOverHours - sumLackHours;
|
||||||
if (sumOverHours - sumLackHours < 0)
|
// if (sumOverHours - sumLackHours < 0)
|
||||||
{
|
// {
|
||||||
/*累计小于0,红色显示*/
|
// /*累计小于0,红色显示*/
|
||||||
range.Font.Color = Color.Red; //红色
|
// range.Font.Color = Color.Red; //红色
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
sumOverHours = overHours;
|
// sumOverHours = overHours;
|
||||||
sumLackHours = lackHours;
|
// sumLackHours = lackHours;
|
||||||
|
|
||||||
prewWorkId = workerId;
|
// prewWorkId = workerId;
|
||||||
}
|
// }
|
||||||
/*填入加班和缺勤缺勤小时数*/
|
// /*填入加班和缺勤缺勤小时数*/
|
||||||
rowsNumber = 4 + (workerNumber - 1) * 2;
|
// rowsNumber = 4 + (workerNumber - 1) * 2;
|
||||||
if (overHours > 0) xlSheet.Cells[rowsNumber, 2 + day] = overHours;
|
// if (overHours > 0) xlSheet.Cells[rowsNumber, 2 + day] = overHours;
|
||||||
if (lackHours > 0) xlSheet.Cells[rowsNumber + 1, 2 + day] = lackHours;
|
// if (lackHours > 0) xlSheet.Cells[rowsNumber + 1, 2 + day] = lackHours;
|
||||||
|
|
||||||
Application.DoEvents();
|
// Application.DoEvents();
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (workerNumber > 0)
|
//if (workerNumber > 0)
|
||||||
{
|
//{
|
||||||
/*填写最后一个职工行的合计数*/
|
// /*填写最后一个职工行的合计数*/
|
||||||
rowsNumber = 4 + (workerNumber - 1) * 2;
|
// rowsNumber = 4 + (workerNumber - 1) * 2;
|
||||||
if (sumOverHours > 0) xlSheet.Cells[rowsNumber, "AH"] = sumOverHours;
|
// if (sumOverHours > 0) xlSheet.Cells[rowsNumber, "AH"] = sumOverHours;
|
||||||
if (sumLackHours > 0) xlSheet.Cells[rowsNumber + 1, "AH"] = sumLackHours;
|
// if (sumLackHours > 0) xlSheet.Cells[rowsNumber + 1, "AH"] = sumLackHours;
|
||||||
xlSheet.Cells[rowsNumber, "AI"] = sumOverHours - sumLackHours;
|
// xlSheet.Cells[rowsNumber, "AI"] = sumOverHours - sumLackHours;
|
||||||
if (sumOverHours - sumLackHours < 0)
|
// if (sumOverHours - sumLackHours < 0)
|
||||||
{
|
// {
|
||||||
/*累计小于0,红色显示*/
|
// /*累计小于0,红色显示*/
|
||||||
range = xlSheet.Range[xlSheet.Cells[rowsNumber, "AI"], xlSheet.Cells[rowsNumber, "AI"]];
|
// range = xlSheet.Range[xlSheet.Cells[rowsNumber, "AI"], xlSheet.Cells[rowsNumber, "AI"]];
|
||||||
range.Font.Color = Color.Red; //红色
|
// range.Font.Color = Color.Red; //红色
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
excel.PrintPreview();
|
//excel.PrintPreview();
|
||||||
excel.Close();
|
//excel.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnUp_Click(object sender, EventArgs e)
|
private void btnUp_Click(object sender, EventArgs e)
|
||||||
|
|||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user