private void OnExportReportButtonClick(object sender, RoutedEventArgs e) { if (_workerRequest == null) { return; } if (FactoryComboBox.SelectedItem == null || WorkerProfessionsListBox.SelectedItem == null || MainWorkerProfessionsListBox.SelectedItem == null) { return; } var factoryId = Convert.ToInt32(FactoryComboBox.SelectedValue); var directoryName = factoryId == 1 ? "Авдей Ф.А." : factoryId == 2 ? "Авдей М.А." : string.Empty; var reportStruct = new WorkerRequestMicrosoftWordReportStruct() { FactoryId = factoryId, DirectoryName = directoryName, ProfessionId = Convert.ToInt64(WorkerProfessionsListBox.SelectedValue), WorkerId = Convert.ToInt32(_workerRequest["WorkerID"]), SalarySaveType = (SalarySaveType)_workerRequest["SalarySaveTypeID"], IntervalType = (IntervalType)_workerRequest["IntervalTypeID"], RequestDate = Convert.ToDateTime(_workerRequest["RequestDate"]), RequestFinishDate = Convert.ToDateTime(_workerRequest["RequestFinishDate"]), WorkingOffType = (WorkingOffType)_workerRequest["WorkingOffTypeID"], WorkerNotes = _workerRequest["RequestNotes"].ToString(), MainWorkerProfessionId = Convert.ToInt64(MainWorkerProfessionsListBox.SelectedValue), MainWorkerId = Convert.ToInt32(_workerRequest["MainWorkerID"]) }; ExportToWord.CreateWorkerRequestReport(reportStruct); AdministrationClass.AddNewAction(84); }
// 生成单据表格---订单打印,还没有存入数据库 private void materialRaisedButton7_Click(object sender, EventArgs e) { DataTable dt = GetDgvToTable(dataGridView2); if (dt.Rows.Count == 0) { MessageBox.Show("请先添加数据"); } else { double sum = 0.0; for (int i = 0; i < dt.Rows.Count; i++) { sum += Convert.ToDouble(dt.Rows[i]["Column8"]); } DialogResult dr = MessageBox.Show("是否导出 " + dt.Rows.Count + " 条数据 ?", "是否导出", MessageBoxButtons.YesNo); ; if (dr == DialogResult.Yes) { //ExportToExcel export = new ExportToExcel(); //export.ExportToExcelFun(dt, dt.Rows[0]["Column2"].ToString(), sum); ExportToWord word = new ExportToWord(); word.ExportToWordFun(dt, dt.Rows[0]["Column2"].ToString(), sum); //utils.Test t = new utils.Test(); //t.fun(); //orderprint o = new orderprint(); //Bitmap b = new Bitmap(o.Bounds.Width, o.Bounds.Height); //this.DrawToBitmap(b, new Rectangle(0, 0, o.Width, o.Height)); //b.Save("C:\\Users\\answer\\Desktop\\a.jpg"); } } }
private void ButtonExportToText_Click(object sender, RoutedEventArgs e) { PDFDocument pdf_document = GetPDFDocument(); ASSERT.Test(pdf_document != null); if (pdf_document != null) { //ExportToText.ExportToTextAndLaunch(pdf_document); ExportToWord.ExportToTextAndLaunch(pdf_document); } e.Handled = true; }
public void HtmlAnchor_Click(Object sender, EventArgs e) { HtmlAnchor objSender = (HtmlAnchor)sender; //object filename = Server.MapPath("temp/Temp1.doc"); //Microsoft.Office.Interop.ApplicationClass mswordappcls = new Microsoft.Office.Interop.Word.ApplicationClass(); //Microsoft.Office.Interop.Word.Document msworddoc = new Microsoft.Office.Interop.Word.Document(); //object readOnly = false; //object isVisible = true; //object missing = System.Reflection.Missing.Value; //msworddoc = mswordappcls.Documents.Open(ref filename, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible); //string strContent = msworddoc.Content.Text; //mswordappcls.Documents.Close(); List <string> lstInput = new List <string>(); lstInput.Add("TenLD"); List <string> lstOutput = new List <string>(); lstOutput.Add("Nguyễn Văn A"); ExportToWord objExportToWord = new ExportToWord(); byte[] temp = objExportToWord.Export(Server.MapPath("../WordForm/PhieuDeNghiHuongTCTN.docx"), lstInput, lstOutput); //string strBody = "<html>"; //strBody += "<body>"; //strBody += "<div>Your name is: <b>" + objSender.Name + "</b></div>"; //strBody += "<table width=\"100%\" style=\"background-color:#cfcfcf;\"><tr><td>1st Cell body data</td><td>2nd cell body data</td></tr></table>"; //strBody += "Ms Word document generated successfully."; //strBody += "</body>"; //strBody += "</html>"; //string fileName = sẻ "MsWordSample.docx"; Response.AppendHeader("Content-Type", "application/msword"); Response.AppendHeader("Content-disposition", "inline; filename=PhieuDeNghiHuong.docx"); //Response.Write(strBody); Response.BinaryWrite(temp); HttpContext.Current.Response.End(); HttpContext.Current.Response.Flush(); }
private void ButtonExportToText_Click(object sender, RoutedEventArgs e) { //ExportToText.ExportToTextAndLaunch(this.pdf_renderer_control_stats.pdf_document); ExportToWord.ExportToTextAndLaunch(pdf_renderer_control_stats.pdf_document); e.Handled = true; }
protected void InQuyetDinhHuongTroCap_ServerClick(object sender, EventArgs e) { if (itemId != 0) { TinhHuong objTinhHuong = new TinhHuong(); DataTable tblTinhHuong = new TinhHuong().getDataById(itemId); DataTable TblNguoiLaoDong = new NguoiLaoDong().getDataById(itemId); DataRow RowTroCapThatNghiep = new NLDTroCapThatNghiep().getItem(itemId); if (TblNguoiLaoDong == null || TblNguoiLaoDong.Rows.Count == 0) { _msg = "Người lao động chưa được khởi tạo"; return; } if (tblTinhHuong == null || tblTinhHuong.Rows.Count == 0) { _msg = "Chưa có bẳng tỉnh nào được cập nhật"; return; } List <string> lstInput = new List <string>(); List <string> lstOutput = new List <string>(); lstInput.Add("[NgayKy]"); try { DateTime NgayDangKy = (DateTime)RowTroCapThatNghiep["NgayNopHoSo"]; DateTime NgayQuyetDinh = new DateTime(); NgayQuyetDinh = objTinhHuong.TinhNgayNghiLe(NgayDangKy, 20); lstOutput.Add(NgayQuyetDinh.ToString("dd/MM/yyyy")); } catch { lstOutput.Add(".../.../....."); } lstInput.Add("[TenLD]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["HoVaTen"].ToString()); lstInput.Add("[NgaySinh]"); lstOutput.Add(((DateTime)TblNguoiLaoDong.Rows[0]["NgaySinh"]).ToString("dd/MM/yyyy")); lstInput.Add("[CMTND]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["CMND"].ToString()); lstInput.Add("[NgayCapCMTND]"); lstOutput.Add(((DateTime)TblNguoiLaoDong.Rows[0]["NgayCapCMND"]).ToString("dd/MM/yyyy")); lstInput.Add("[NoiCapCMTND]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["NoiCap"].ToString()); lstInput.Add("[SoBHXH]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["BHXH"].ToString()); lstInput.Add("[DiaChiThuongTru]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["NoiThuongTru"].ToString()); lstInput.Add("[DiaChiHienTai]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["DiaChi"].ToString()); lstInput.Add("[SoThangDong]"); lstOutput.Add(tblTinhHuong.Rows[0]["SoThangDongBHXH"].ToString()); lstInput.Add("[MucHuong]"); lstOutput.Add(tblTinhHuong.Rows[0]["MucHuong"].ToString()); lstInput.Add("[SoThangHuong]"); int SoThangHuong = (int)tblTinhHuong.Rows[0]["SoThangHuongBHXH"]; lstOutput.Add(SoThangHuong.ToString()); lstInput.Add("[HuongTuNgay]"); DateTime HuongTuNgay = (DateTime)tblTinhHuong.Rows[0]["HuongTuNgay"]; DateTime HuongDenNgay = objTinhHuong.TinhNgayNghiLe(HuongTuNgay, 16); for (int i = 0; i < SoThangHuong; i++) { HuongDenNgay = HuongDenNgay.AddMonths(1); } lstOutput.Add(HuongTuNgay.ToString("dd/MM/yyyy")); lstInput.Add("[HuongDenNgay]"); lstOutput.Add(HuongDenNgay.ToString("dd/MM/yyyy")); ExportToWord objExportToWord = new ExportToWord(); byte[] temp = objExportToWord.Export(Server.MapPath("../WordForm/QuyetDinhHuongTCTN.docx"), lstInput, lstOutput); Response.AppendHeader("Content-Type", "application/msword"); Response.AppendHeader("Content-disposition", "inline; filename=QuyetDinhHuongTCTN.docx"); Response.BinaryWrite(temp); HttpContext.Current.Response.End(); HttpContext.Current.Response.Flush(); } }
protected void Unnamed_ServerClick(object sender, EventArgs e) { if (itemId != 0) { DataTable tblTinhHuong = new TinhHuong().getDataById(itemId); DataTable TblNguoiLaoDong = new NguoiLaoDong().getDataById(int.Parse(hdIDNguoiLaoDong.Value)); DataRow rowTroCapThatNghiep = new NLDTroCapThatNghiep().getItem(itemId); if (TblNguoiLaoDong == null || TblNguoiLaoDong.Rows.Count == 0) { _msg = "Người lao động chưa được khởi tạo"; return; } if (tblTinhHuong == null || tblTinhHuong.Rows.Count == 0) { _msg = "Chưa có bẳng tỉnh nào được cập nhật"; return; } List <string> lstInput = new List <string>(); List <string> lstOutput = new List <string>(); lstInput.Add("[TenNLD]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["HoVaTen"].ToString()); lstInput.Add("[NgaySinh]"); lstOutput.Add(((DateTime)TblNguoiLaoDong.Rows[0]["NgaySinh"]).ToString("dd/MM/yyyy")); lstInput.Add("[SoBHXH]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["BHXH"].ToString()); lstInput.Add("[SoThangDong]"); lstOutput.Add(rowTroCapThatNghiep["SoThangDongBHXH"].ToString()); lstInput.Add("[DongTuThang]"); lstOutput.Add(tblTinhHuong.Rows[0]["HuongTungay"].ToString()); lstInput.Add("[DongDenThang]"); lstOutput.Add(tblTinhHuong.Rows[0]["HuongDenNgay"].ToString()); for (int i = 1; i <= 6; i++) { lstInput.Add("[Thang" + i.ToString() + "]"); lstOutput.Add(i.ToString()); lstInput.Add("[TienThang" + i.ToString() + "]"); lstOutput.Add(tblTinhHuong.Rows[0]["MucDong" + i.ToString()].ToString()); } lstInput.Add("[MucDongTB]"); lstOutput.Add(tblTinhHuong.Rows[0]["LuongTrungBinh"].ToString()); lstInput.Add("[MucHuong]"); lstOutput.Add(tblTinhHuong.Rows[0]["MucHuong"].ToString()); lstInput.Add("[SoThangHuong]"); lstOutput.Add(tblTinhHuong.Rows[0]["SoThangHuongBHXH"].ToString()); lstInput.Add("[TongTienHuong]"); decimal MucHuong = 0, SoThangHuong = 0, TongTienHuong = 0; MucHuong = decimal.Parse(tblTinhHuong.Rows[0]["MucHuong"].ToString()); SoThangHuong = decimal.Parse(tblTinhHuong.Rows[0]["SoThangHuongBHXH"].ToString()); TongTienHuong = MucHuong * SoThangHuong; lstOutput.Add(TongTienHuong.ToString()); lstInput.Add("[SoThangBaoLuu]"); lstOutput.Add(tblTinhHuong.Rows[0]["SoThangBaoLuuBHXH"].ToString()); lstInput.Add("[NgayTinhHuong]"); lstOutput.Add(((DateTime)tblTinhHuong.Rows[0]["HuongTuNgay"]).ToString("dd/MM/yyyy")); ExportToWord objExportToWord = new ExportToWord(); byte[] temp = objExportToWord.Export(Server.MapPath("../WordForm/PhieuTinhHuong.docx"), lstInput, lstOutput); Response.AppendHeader("Content-Type", "application/msword"); Response.AppendHeader("Content-disposition", "inline; filename=PhieuTinhHuong.docx"); Response.BinaryWrite(temp); HttpContext.Current.Response.End(); HttpContext.Current.Response.Flush(); } }
private void TaiQuyetDinhTCTN(int IDNLDTCTN, string FileName) { TinhHuong objTinhHuong = new TinhHuong(); DataTable tblTinhHuong = new TinhHuong().getDataById(IDNLDTCTN); DataRow RowTroCapThatNghiep = new NLDTroCapThatNghiep().getItem(IDNLDTCTN); DataTable TblNguoiLaoDong = new NguoiLaoDong().getDataById((int)RowTroCapThatNghiep["IDNguoiLaoDong"]); DataTable tblQuyetDinh = new CapSo().GetByID(IDNLDTCTN, 30); DataTable tblLichThongBao = new LichThongBao().GetDataByID((int)tblTinhHuong.Rows[0]["IDTinhHuong"]); if (TblNguoiLaoDong == null || TblNguoiLaoDong.Rows.Count == 0) { _msg = "Người lao động chưa được khởi tạo"; return; } if (tblTinhHuong == null || tblTinhHuong.Rows.Count == 0) { _msg = "Chưa có bẳng tỉnh nào được cập nhật"; return; } List <string> lstInput = new List <string>(); List <string> lstOutput = new List <string>(); lstInput.Add("[NgayKy]"); try { lstOutput.Add(".../.../....."); //DateTime NgayDangKy = (DateTime)RowTroCapThatNghiep["NgayNopHoSo"]; //DateTime NgayQuyetDinh = new DateTime(); //NgayQuyetDinh = objTinhHuong.TinhNgayNghiLe(NgayDangKy, 20); //lstOutput.Add(NgayQuyetDinh.ToString("dd/MM/yyyy")); } catch { lstOutput.Add(".../.../....."); } lstInput.Add("[SoQD]"); if (tblQuyetDinh.Rows.Count == 0) { lstOutput.Add("......................"); } else { lstOutput.Add(tblQuyetDinh.Rows[0]["SoVanBan"].ToString()); } lstInput.Add("[TenLD]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["HoVaTen"].ToString()); lstInput.Add("[NgaySinh]"); lstOutput.Add(((DateTime)TblNguoiLaoDong.Rows[0]["NgaySinh"]).ToString("dd/MM/yyyy")); lstInput.Add("[CMTND]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["CMND"].ToString()); lstInput.Add("[NgayCapCMTND]"); lstOutput.Add(((DateTime)TblNguoiLaoDong.Rows[0]["NgayCapCMND"]).ToString("dd/MM/yyyy")); lstInput.Add("[NoiCapCMTND]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["NoiCap"].ToString()); lstInput.Add("[SoBHXH]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["BHXH"].ToString()); lstInput.Add("[DiaChiThuongTru]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["NoiThuongTru"].ToString()); lstInput.Add("[DiaChiHienTai]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["DiaChi"].ToString()); lstInput.Add("[SoThangDong]"); lstOutput.Add(RowTroCapThatNghiep["SoThangDongBHXH"].ToString()); lstInput.Add("[MucHuong]"); lstOutput.Add(tblTinhHuong.Rows[0]["MucHuong"].ToString()); lstInput.Add("[SoThangHuong]"); int SoThangHuong = (int)tblTinhHuong.Rows[0]["SoThangHuongBHXH"]; lstOutput.Add(SoThangHuong.ToString()); lstInput.Add("[SoThangBaoLuu]"); lstOutput.Add(tblTinhHuong.Rows[0]["SoThangBaoLuuBHXH"].ToString()); lstInput.Add("[HuongTuNgay]"); lstOutput.Add(((DateTime)tblTinhHuong.Rows[0]["HuongTuNgay"]).ToString("dd/MM/yyyy")); lstInput.Add("[HuongDenNgay]"); lstOutput.Add(((DateTime)tblTinhHuong.Rows[0]["HuongDenNgay"]).ToString("dd/MM/yyyy")); //----- chen phan lich thong bao viec lam if (tblLichThongBao.Rows.Count == 0) { _msg = "Hồ sơ chưa có lịch thông báo"; return; } lstInput.Add("[Thang1]"); lstOutput.Add(((DateTime)tblLichThongBao.Rows[0]["KhaiBaoThang1TuNgay"]).ToString("dd/MM/yyyy")); for (int i = 2; i <= 12; i++) { lstInput.Add("[Thang" + i.ToString() + "Tu]"); if (((DateTime)tblLichThongBao.Rows[0]["KhaiBaoThang" + i.ToString() + "TuNgay"]).ToString("yyyy") != "1900") { lstOutput.Add(((DateTime)tblLichThongBao.Rows[0]["KhaiBaoThang" + i.ToString() + "TuNgay"]).ToString("dd/MM/yyyy")); } else { lstOutput.Add("../../...."); } lstInput.Add("[Thang" + i.ToString() + "Den]"); if (((DateTime)tblLichThongBao.Rows[0]["KhaiBaoThang" + i.ToString() + "DenNgay"]).ToString("yyyy") != "1900") { lstOutput.Add(((DateTime)tblLichThongBao.Rows[0]["KhaiBaoThang" + i.ToString() + "DenNgay"]).ToString("dd/MM/yyyy")); } else { lstOutput.Add("../../...."); } } ExportToWord objExportToWord = new ExportToWord(); byte[] temp = objExportToWord.Export(Server.MapPath("../WordForm/QuyetDinhHuongTCTN.docx"), lstInput, lstOutput); Response.AppendHeader("Content-Type", "application/msword"); Response.AppendHeader("Content-disposition", "inline; filename=QuyetDinhHuongTCTN" + FileName + ".docx"); Response.BinaryWrite(temp); HttpContext.Current.Response.End(); HttpContext.Current.Response.Flush(); }
public string TaiQuyetDinhChamDut(int IDNLDTCTN, string FileName) { string _msg = ""; TinhHuong objTinhHuong = new TinhHuong(); DataTable tblTinhHuong = new TinhHuong().getDataById(IDNLDTCTN); DataRow RowTroCapThatNghiep = new NLDTroCapThatNghiep().getItem(IDNLDTCTN); DataTable tblQuyetDinhChamDut = new CapSo().GetByID(IDNLDTCTN, 81); DataTable tblQuyetDinhTCTN = new CapSo().GetByID(IDNLDTCTN, 30); DataTable tblNguoiLaoDong = new NguoiLaoDong().getDataById((int)RowTroCapThatNghiep["IDNguoiLaoDong"]); List <string> lstInput = new List <string>(); List <string> lstOutput = new List <string>(); lstInput.Add("[SoQD]"); lstOutput.Add(tblQuyetDinhChamDut.Rows[0]["SoVanBan"].ToString()); lstInput.Add("[NgayKy]"); lstOutput.Add(((DateTime)tblQuyetDinhChamDut.Rows[0]["NgayKy"]).ToString("dd/MM/yyyy")); lstInput.Add("[SoQDTCTN]"); lstOutput.Add(tblQuyetDinhTCTN.Rows[0]["SoVanBan"].ToString()); lstInput.Add("[NgayKyTCTN]"); lstOutput.Add(((DateTime)tblQuyetDinhTCTN.Rows[0]["NgayKy"]).ToString("dd/MM/yyyy")); lstInput.Add("[TenLD]"); lstOutput.Add(tblNguoiLaoDong.Rows[0]["HoVaTen"].ToString()); lstInput.Add("[NgayChamDut]"); lstOutput.Add(((DateTime)tblTinhHuong.Rows[0]["NgayDeXuatChamDut"]).ToString("dd/MM/yyyy")); lstInput.Add("[NgaySinh]"); lstOutput.Add(tblNguoiLaoDong.Rows[0]["NgaySinh"].ToString()); lstInput.Add("[CMTND]"); lstOutput.Add(tblNguoiLaoDong.Rows[0]["CMND"].ToString()); lstInput.Add("[NgayCapCMTND]"); lstOutput.Add(((DateTime)tblNguoiLaoDong.Rows[0]["NgayCapCMND"]).ToString("dd/MM/yyyy")); lstInput.Add("[NoiCapCMTND]"); lstOutput.Add(tblNguoiLaoDong.Rows[0]["NoiCap"].ToString()); lstInput.Add("[SoBHXH]"); lstOutput.Add(tblNguoiLaoDong.Rows[0]["BHXH"].ToString()); lstInput.Add("[DiaChiThuongTru]"); string diachithuongtru = ""; if (tblNguoiLaoDong.Rows[0]["Xom_TT"].ToString().Trim() != "") { diachithuongtru += tblNguoiLaoDong.Rows[0]["Xom_TT"].ToString().Trim(); } if (tblNguoiLaoDong.Rows[0]["Xa_TT"].ToString().Trim() != "") { diachithuongtru += ", " + tblNguoiLaoDong.Rows[0]["Xa_TT"].ToString().Trim(); } if (tblNguoiLaoDong.Rows[0]["Huyen_TT"].ToString().Trim() != "") { diachithuongtru += ", " + tblNguoiLaoDong.Rows[0]["Huyen_TT"].ToString().Trim(); } if (tblNguoiLaoDong.Rows[0]["Tinh_TT"].ToString().Trim() != "") { diachithuongtru += ", " + tblNguoiLaoDong.Rows[0]["Tinh_TT"].ToString().Trim(); } lstOutput.Add(diachithuongtru); lstInput.Add("[DiaChiHienTai]"); string diachi = ""; if (tblNguoiLaoDong.Rows[0]["Xom_DC"].ToString().Trim() != "") { diachi += tblNguoiLaoDong.Rows[0]["Xom_DC"].ToString().Trim(); } if (tblNguoiLaoDong.Rows[0]["Xa_DC"].ToString().Trim() != "") { diachi += ", " + tblNguoiLaoDong.Rows[0]["Xa_DC"].ToString().Trim(); } if (tblNguoiLaoDong.Rows[0]["Huyen_DC"].ToString().Trim() != "") { diachi += ", " + tblNguoiLaoDong.Rows[0]["Huyen_DC"].ToString().Trim(); } if (tblNguoiLaoDong.Rows[0]["Tinh_DC"].ToString().Trim() != "") { diachi += ", " + tblNguoiLaoDong.Rows[0]["Tinh_DC"].ToString().Trim(); } lstOutput.Add(diachi); lstInput.Add("[LyDoChamDut]"); lstOutput.Add("..........................."); lstInput.Add("[SoThangDong]"); lstOutput.Add(RowTroCapThatNghiep["SoThangDongBHXH"].ToString()); lstInput.Add("[SoThangHuong]"); lstOutput.Add(tblTinhHuong.Rows[0]["SoThangHuongBHXH"].ToString()); lstInput.Add("[SoThangDaHuong]"); lstOutput.Add(tblTinhHuong.Rows[0]["SoThangDaHuongBHXH"].ToString()); lstInput.Add("[SoThangBaoLuu]"); lstOutput.Add(tblTinhHuong.Rows[0]["SoThangBaoLuuSauHuong"].ToString()); ExportToWord objExportToWord = new ExportToWord(); byte[] temp = objExportToWord.Export(HttpContext.Current.Server.MapPath("../WordForm/QuyetDinhChamDutHuong.docx"), lstInput, lstOutput); HttpContext.Current.Response.AppendHeader("Content-Type", "application/msword"); HttpContext.Current.Response.AppendHeader("Content-disposition", "inline; filename=QuyetDinhChamDutHuong" + FileName + ".docx"); HttpContext.Current.Response.BinaryWrite(temp); HttpContext.Current.Response.End(); HttpContext.Current.Response.Flush(); return(_msg); }
public string InPhieuChuyenHuong(int IDNLDTCTN, string FileName) { string _msg = ""; TinhHuong objTinhHuong = new TinhHuong(); DataTable tblTinhHuong = new TinhHuong().getDataById(IDNLDTCTN); DataRow RowTroCapThatNghiep = new NLDTroCapThatNghiep().getItem(IDNLDTCTN); DataTable TblNguoiLaoDong = new NguoiLaoDong().getDataById((int)RowTroCapThatNghiep["IDNguoiLaoDong"]); DataTable tblQuyetDinhTCTN = new CapSo().GetByID(IDNLDTCTN, 30); if (TblNguoiLaoDong == null || TblNguoiLaoDong.Rows.Count == 0) { _msg = "Người lao động chưa được khởi tạo"; return(_msg); } DataTable tblChuyenHuong = new ChuyenHuong().GetByMaxIDNLDTCTN(IDNLDTCTN); if (tblChuyenHuong.Rows.Count == 0) { _msg = "Chưa có thông tin chuyển hưởng"; return(_msg); } List <string> lstInput = new List <string>(); List <string> lstOutput = new List <string>(); lstInput.Add("[SoQD]"); lstOutput.Add(tblChuyenHuong.Rows[0]["SoGiayGioiThieu"].ToString()); lstInput.Add("[NgayDeNghi]"); try { lstOutput.Add(((DateTime)tblChuyenHuong.Rows[0]["NgayDeNghi"]).ToString("dd/MM/yyyy")); } catch { lstOutput.Add("../../...."); } lstInput.Add("[NoiChuyenDen]"); DataRow NoiChuyenDen = new DanhMuc().getItem(int.Parse(tblChuyenHuong.Rows[0]["IDNoiChuyen"].ToString())); lstOutput.Add(NoiChuyenDen["NameDanhMuc"].ToString()); lstInput.Add("[TenLD]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["HoVaTen"].ToString()); lstInput.Add("[NgayDeNghi]"); try { lstOutput.Add(((DateTime)tblChuyenHuong.Rows[0]["NgayDeNghi"]).ToString("dd/MM/yyyy")); } catch { lstOutput.Add("../../...."); } lstInput.Add("[TenLD]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["HoVaTen"].ToString()); lstInput.Add("[SoQDTCTN]"); lstOutput.Add(tblQuyetDinhTCTN.Rows[0]["SoVanBan"].ToString()); lstInput.Add("[NgayKyTCTN]"); try { lstOutput.Add(((DateTime)tblQuyetDinhTCTN.Rows[0]["NgayKy"]).ToString("dd/MM/yyyy")); } catch { lstOutput.Add("../../...."); } lstInput.Add("[SoThangDaHuong]"); int SoThangDaHuong = 0; int.TryParse(tblTinhHuong.Rows[0]["SoThangDaHuongBHXH"].ToString(), out SoThangDaHuong); lstOutput.Add(SoThangDaHuong.ToString()); lstInput.Add("[HuongTuNgay]"); lstOutput.Add(((DateTime)tblTinhHuong.Rows[0]["HuongTuNgay"]).ToString("dd/MM/yyyy")); lstInput.Add("[HuongDenNgay]"); lstOutput.Add(((DateTime)tblTinhHuong.Rows[0]["HuongDenNgay"]).ToString("dd/MM/yyyy")); lstInput.Add("[MucHuong]"); lstOutput.Add(((decimal)tblTinhHuong.Rows[0]["MucHuong"]).ToString("0.##")); ExportToWord objExportToWord = new ExportToWord(); byte[] temp = objExportToWord.Export(HttpContext.Current.Server.MapPath("../WordForm/GiayGioiThieuChuyenHuong.docx"), lstInput, lstOutput); HttpContext.Current.Response.AppendHeader("Content-Type", "application/msword"); HttpContext.Current.Response.AppendHeader("Content-disposition", "inline; filename=GiayGioiThieuChuyenHuong" + FileName + ".docx"); HttpContext.Current.Response.BinaryWrite(temp); HttpContext.Current.Response.End(); HttpContext.Current.Response.Flush(); return(_msg); }
public string TaiPhieuHenTraKQ(int IDNLDTCTN, string FileName) { string _msg = ""; TinhHuong objTinhHuong = new TinhHuong(); DataRow RowTroCapThatNghiep = new NLDTroCapThatNghiep().getItem(IDNLDTCTN); DataTable TblNguoiLaoDong = new NguoiLaoDong().getDataById((int)RowTroCapThatNghiep["IDNguoiLaoDong"]); if (TblNguoiLaoDong == null || TblNguoiLaoDong.Rows.Count == 0) { _msg = "Người lao động chưa được khởi tạo"; return(_msg); } List <string> lstInput = new List <string>(); List <string> lstOutput = new List <string>(); lstInput.Add("[NgayNopHS]"); lstOutput.Add(((DateTime)RowTroCapThatNghiep["NgayNopHoSo"]).ToString("dd/MM/yyyy")); lstInput.Add("[TenLD]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["HoVaTen"].ToString()); lstInput.Add("[NgaySinh]"); try { lstOutput.Add(((DateTime)TblNguoiLaoDong.Rows[0]["NgaySinh"]).ToString("dd/MM/yyyy")); } catch { lstOutput.Add("../../...."); } lstInput.Add("[CMTND]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["CMND"].ToString()); lstInput.Add("[NgayCapCMTND]"); try { lstOutput.Add(((DateTime)TblNguoiLaoDong.Rows[0]["NgayCapCMND"]).ToString("dd/MM/yyyy")); } catch { lstOutput.Add("../../...."); } lstInput.Add("[NoiCapCMTND]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["NoiCap"].ToString()); lstInput.Add("[NgayHenTra]"); try { lstOutput.Add(((DateTime)RowTroCapThatNghiep["NgayHenTraKQ"]).ToString("dd/MM/yyyy")); } catch { lstOutput.Add("../../...."); } ExportToWord objExportToWord = new ExportToWord(); byte[] temp = objExportToWord.Export(HttpContext.Current.Server.MapPath("../WordForm/PhieuHenTraTiepNhan.docx"), lstInput, lstOutput); HttpContext.Current.Response.AppendHeader("Content-Type", "application/msword"); HttpContext.Current.Response.AppendHeader("Content-disposition", "inline; filename=PhieuHenTraTiepNhan" + FileName + ".docx"); HttpContext.Current.Response.BinaryWrite(temp); HttpContext.Current.Response.End(); HttpContext.Current.Response.Flush(); return(_msg); }
public string TaiQuyetDinhTiepTuc(int IDNLDTCTN, string FileName) { string _msg = ""; TinhHuong objTinhHuong = new TinhHuong(); DataRow RowTroCapThatNghiep = new NLDTroCapThatNghiep().getItem(IDNLDTCTN); DataTable TblNguoiLaoDong = new NguoiLaoDong().getDataById((int)RowTroCapThatNghiep["IDNguoiLaoDong"]); DataTable tblQuyetDinhTCTN = new CapSo().GetByID(IDNLDTCTN, 30); DataTable tblQuyetDinhTiepTuc = new CapSo().GetByID(IDNLDTCTN, 51); DataTable tblTinhHuong = objTinhHuong.getDataById(IDNLDTCTN); if (TblNguoiLaoDong == null || TblNguoiLaoDong.Rows.Count == 0) { _msg = "Người lao động chưa được khởi tạo"; return(_msg); } if (tblTinhHuong.Rows.Count == 0) { _msg = "Tính hưởng chưa được khởi tạo"; return(_msg); } List <string> lstInput = new List <string>(); List <string> lstOutput = new List <string>(); lstInput.Add("[NgayKy]"); try { lstOutput.Add(((DateTime)tblQuyetDinhTiepTuc.Rows[0]["NgayKy"]).ToString("dd/MM/yyyy")); } catch { lstOutput.Add(".../.../....."); } lstInput.Add("[SoQD]"); if (tblQuyetDinhTiepTuc.Rows.Count == 0) { lstOutput.Add("......................"); } else { lstOutput.Add(tblQuyetDinhTiepTuc.Rows[0]["SoVanBan"].ToString()); } lstInput.Add("[SoQDTCTN]"); lstOutput.Add(tblQuyetDinhTCTN.Rows[0]["SoVanBan"].ToString()); lstInput.Add("[NgayKyTCTN]"); try { lstOutput.Add(((DateTime)tblQuyetDinhTCTN.Rows[0]["NgayKy"]).ToString("dd/MM/yyyy")); } catch { lstOutput.Add(".../.../....."); } lstInput.Add("[TenLD]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["HoVaTen"].ToString()); lstInput.Add("[NgaySinh]"); try { lstOutput.Add(((DateTime)TblNguoiLaoDong.Rows[0]["NgaySinh"]).ToString("dd/MM/yyyy")); } catch { lstOutput.Add("../../...."); } lstInput.Add("[CMTND]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["CMND"].ToString()); lstInput.Add("[NgayCapCMTND]"); try { lstOutput.Add(((DateTime)TblNguoiLaoDong.Rows[0]["NgayCapCMND"]).ToString("dd/MM/yyyy")); } catch { lstOutput.Add("../../...."); } lstInput.Add("[NoiCapCMTND]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["NoiCap"].ToString()); lstInput.Add("[SoBHXH]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["BHXH"].ToString()); lstInput.Add("[DiaChiThuongTru]"); string diachithuongtru = ""; if (TblNguoiLaoDong.Rows[0]["Xom_TT"].ToString().Trim() != "") { diachithuongtru += TblNguoiLaoDong.Rows[0]["Xom_TT"].ToString().Trim(); } if (TblNguoiLaoDong.Rows[0]["Xa_TT"].ToString().Trim() != "") { diachithuongtru += ", " + TblNguoiLaoDong.Rows[0]["Xa_TT"].ToString().Trim(); } if (TblNguoiLaoDong.Rows[0]["Huyen_TT"].ToString().Trim() != "") { diachithuongtru += ", " + TblNguoiLaoDong.Rows[0]["Huyen_TT"].ToString().Trim(); } if (TblNguoiLaoDong.Rows[0]["Tinh_TT"].ToString().Trim() != "") { diachithuongtru += ", " + TblNguoiLaoDong.Rows[0]["Tinh_TT"].ToString().Trim(); } lstOutput.Add(diachithuongtru); lstInput.Add("[DiaChiHienTai]"); string diachi = ""; if (TblNguoiLaoDong.Rows[0]["Xom_DC"].ToString().Trim() != "") { diachi += TblNguoiLaoDong.Rows[0]["Xom_DC"].ToString().Trim(); } if (TblNguoiLaoDong.Rows[0]["Xa_DC"].ToString().Trim() != "") { diachi += ", " + TblNguoiLaoDong.Rows[0]["Xa_DC"].ToString().Trim(); } if (TblNguoiLaoDong.Rows[0]["Huyen_DC"].ToString().Trim() != "") { diachi += ", " + TblNguoiLaoDong.Rows[0]["Huyen_DC"].ToString().Trim(); } if (TblNguoiLaoDong.Rows[0]["Tinh_DC"].ToString().Trim() != "") { diachi += ", " + TblNguoiLaoDong.Rows[0]["Tinh_DC"].ToString().Trim(); } lstOutput.Add(diachi); lstInput.Add("[STD]"); lstOutput.Add(RowTroCapThatNghiep["SoThangDongBHXH"].ToString()); lstInput.Add("[STH]"); lstOutput.Add(tblTinhHuong.Rows[0]["SoThangHuongBHXH"].ToString()); lstInput.Add("[STCL]"); lstOutput.Add(tblTinhHuong.Rows[0]["SoThangDuocHuongConLaiBHXH"].ToString()); ExportToWord objExportToWord = new ExportToWord(); byte[] temp = objExportToWord.Export(HttpContext.Current.Server.MapPath("../WordForm/QuyetDinhTiepTucHuong.docx"), lstInput, lstOutput); HttpContext.Current.Response.AppendHeader("Content-Type", "application/msword"); HttpContext.Current.Response.AppendHeader("Content-disposition", "inline; filename=QuyetDinhTiepTucHuong" + FileName + ".docx"); HttpContext.Current.Response.BinaryWrite(temp); HttpContext.Current.Response.End(); HttpContext.Current.Response.Flush(); return(_msg); }
public string TaiQuyetDinhHuyHuong(int IDNLDTCTN, string FileName) { string _msg = ""; TinhHuong objTinhHuong = new TinhHuong(); DataRow RowTroCapThatNghiep = new NLDTroCapThatNghiep().getItem(IDNLDTCTN); DataTable TblNguoiLaoDong = new NguoiLaoDong().getDataById((int)RowTroCapThatNghiep["IDNguoiLaoDong"]); DataTable tblQuyetDinhTCTN = new CapSo().GetByID(IDNLDTCTN, 30); DataTable tblQuyetDinhHuyHuong = new CapSo().GetByID(IDNLDTCTN, 49); if (TblNguoiLaoDong == null || TblNguoiLaoDong.Rows.Count == 0) { _msg = "Người lao động chưa được khởi tạo"; return(_msg); } List <string> lstInput = new List <string>(); List <string> lstOutput = new List <string>(); lstInput.Add("[NgayKy]"); try { lstOutput.Add(((DateTime)tblQuyetDinhHuyHuong.Rows[0]["NgayKy"]).ToString("dd/MM/yyyy")); } catch { lstOutput.Add(".../.../....."); } lstInput.Add("[SoQD]"); if (tblQuyetDinhHuyHuong.Rows.Count == 0) { lstOutput.Add("......................"); } else { lstOutput.Add(tblQuyetDinhHuyHuong.Rows[0]["SoVanBan"].ToString()); } lstInput.Add("[SoQDTCTN]"); lstOutput.Add(tblQuyetDinhTCTN.Rows[0]["SoVanBan"].ToString()); lstInput.Add("[NgayKyTCTN]"); try { lstOutput.Add(((DateTime)tblQuyetDinhTCTN.Rows[0]["NgayKy"]).ToString("dd/MM/yyyy")); } catch { lstOutput.Add(".../.../....."); } lstInput.Add("[TenLD]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["HoVaTen"].ToString()); lstInput.Add("[Lydo]"); lstOutput.Add("................."); lstInput.Add("[QDTCTN]"); lstOutput.Add(tblQuyetDinhTCTN.Rows[0]["SoVanBan"].ToString()); ExportToWord objExportToWord = new ExportToWord(); byte[] temp = objExportToWord.Export(HttpContext.Current.Server.MapPath("../WordForm/QuyetDinhHuyHuong.docx"), lstInput, lstOutput); HttpContext.Current.Response.AppendHeader("Content-Type", "application/msword"); HttpContext.Current.Response.AppendHeader("Content-disposition", "inline; filename=QuyetDinhHuyHuong" + FileName + ".docx"); HttpContext.Current.Response.BinaryWrite(temp); HttpContext.Current.Response.End(); HttpContext.Current.Response.Flush(); return(_msg); }
public string TaiPhieuTinhHuong(int INLDTCTN, string FileName) { string _msg = ""; DataTable tblTinhHuong = new TinhHuong().getDataById(INLDTCTN); DataRow rowTroCapThatNghiep = new NLDTroCapThatNghiep().getItem(INLDTCTN); DataTable TblNguoiLaoDong = new NguoiLaoDong().getDataById((int)rowTroCapThatNghiep["IDNguoiLaoDong"]); if (TblNguoiLaoDong == null || TblNguoiLaoDong.Rows.Count == 0) { _msg = "Người lao động chưa được khởi tạo"; return(_msg); } if (tblTinhHuong == null || tblTinhHuong.Rows.Count == 0) { _msg = "Chưa có bẳng tỉnh nào được cập nhật"; return(_msg); } List <string> lstInput = new List <string>(); List <string> lstOutput = new List <string>(); lstInput.Add("[TenNLD]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["HoVaTen"].ToString()); lstInput.Add("[NgaySinh]"); lstOutput.Add(((DateTime)TblNguoiLaoDong.Rows[0]["NgaySinh"]).ToString("dd/MM/yyyy")); lstInput.Add("[SoBHXH]"); lstOutput.Add(TblNguoiLaoDong.Rows[0]["BHXH"].ToString()); lstInput.Add("[SoThangDong]"); lstOutput.Add(rowTroCapThatNghiep["SoThangDongBHXH"].ToString()); lstInput.Add("[DongTuThang]"); lstOutput.Add(tblTinhHuong.Rows[0]["HuongTungay"].ToString()); lstInput.Add("[DongDenThang]"); lstOutput.Add(tblTinhHuong.Rows[0]["HuongDenNgay"].ToString()); for (int i = 1; i <= 6; i++) { lstInput.Add("[Thang" + i.ToString() + "]"); lstOutput.Add(i.ToString()); lstInput.Add("[TienThang" + i.ToString() + "]"); lstOutput.Add(((decimal)tblTinhHuong.Rows[0]["MucDong" + i.ToString()]).ToString("0.##")); } lstInput.Add("[MucDongTB]"); lstOutput.Add(((decimal)tblTinhHuong.Rows[0]["LuongTrungBinh"]).ToString("0.##")); lstInput.Add("[MucHuong]"); lstOutput.Add(((decimal)tblTinhHuong.Rows[0]["MucHuong"]).ToString("0.##")); lstInput.Add("[SoThangHuong]"); lstOutput.Add(tblTinhHuong.Rows[0]["SoThangHuongBHXH"].ToString()); lstInput.Add("[TongTienHuong]"); decimal MucHuong = 0, SoThangHuong = 0, TongTienHuong = 0; MucHuong = decimal.Parse(tblTinhHuong.Rows[0]["MucHuong"].ToString()); SoThangHuong = decimal.Parse(tblTinhHuong.Rows[0]["SoThangHuongBHXH"].ToString()); TongTienHuong = MucHuong * SoThangHuong; lstOutput.Add(TongTienHuong.ToString("0.##")); lstInput.Add("[SoThangBaoLuu]"); lstOutput.Add(tblTinhHuong.Rows[0]["SoThangBaoLuuBHXH"].ToString()); lstInput.Add("[NgayTinhHuong]"); lstOutput.Add(((DateTime)tblTinhHuong.Rows[0]["HuongTuNgay"]).ToString("dd/MM/yyyy")); lstInput.Add("[TienBangChu]"); string SoTienChu = ChuyenSo(Math.Round(TongTienHuong, MidpointRounding.AwayFromZero).ToString()); lstOutput.Add(SoTienChu); ExportToWord objExportToWord = new ExportToWord(); byte[] temp = objExportToWord.Export(HttpContext.Current.Server.MapPath("../WordForm/PhieuTinhHuong.docx"), lstInput, lstOutput); HttpContext.Current.Response.AppendHeader("Content-Type", "application/msword"); HttpContext.Current.Response.AppendHeader("Content-disposition", "inline; filename=PhieuTinhHuong.docx"); HttpContext.Current.Response.BinaryWrite(temp); HttpContext.Current.Response.End(); HttpContext.Current.Response.Flush(); return(_msg); }