private void btnExportExcel_Click(object sender, EventArgs e) { if (dtLocal.Rows.Count > 0) { TextUtils.ExportExcel(grvCheck); } }
private void btnExecl_Click(object sender, EventArgs e) { if (grvData.RowCount > 0) { TextUtils.ExportExcel(grvData); } }
private void btnExportExcel_Click(object sender, EventArgs e) { if (gridView2.RowCount > 0) { TextUtils.ExportExcel(gridView2); } }
private void grvData_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == (Keys.Control | Keys.S)) { if (MessageBox.Show("Bạn có muốn xuất dữ liệu ra file excel?", TextUtils.Caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (exportPath != "") { TextUtils.ExportExcel(grvData, exportPath, Module.Code, false); } else { FolderBrowserDialog fbd = new FolderBrowserDialog(); if (fbd.ShowDialog() == DialogResult.OK) { exportPath = fbd.SelectedPath; TextUtils.ExportExcel(grvData, fbd.SelectedPath, Module.Code, false); } } } } if (e.KeyCode == (Keys.C)) { try { string text = TextUtils.ToString(grvData.GetFocusedRowCellValue(grvData.FocusedColumn)); Clipboard.SetText(text); } catch (Exception) { } } }
private void btnDNNKthanhPham_Click(object sender, EventArgs e) { if (grvData.RowCount == 0) { return; } TextUtils.ExportExcel(grvData); }
private void btnExeclGroup_Click(object sender, EventArgs e) { if (grvData.RowCount == 0) { return; } TextUtils.ExportExcel(grvData); }
private void btnDNNKthanhPham_Click(object sender, EventArgs e) { try { TextUtils.ExportExcel(grvYCMVT); } catch { } }
private void btnExcel_Click(object sender, EventArgs e) { try { TextUtils.ExportExcel(grvData); } catch { } }
private void btnExecl_Click(object sender, EventArgs e) { //grvData.ShowPrintPreview(); FolderBrowserDialog fbd = new FolderBrowserDialog(); if (fbd.ShowDialog() == DialogResult.OK) { TextUtils.ExportExcel(grvData, fbd.SelectedPath, Module.Code, true); } }
private void btnExcel_Click(object sender, EventArgs e) { try { TextUtils.ExportExcel(grvData); } catch (Exception ex) { MessageBox.Show(ex.Message, TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnExcel_Click(object sender, EventArgs e) { try { if (grvVersion.RowCount > 0) { TextUtils.ExportExcel(grvVersion); } } catch { } }
private void btnExcel_Click(object sender, EventArgs e) { try { if (grvData.RowCount > 0) { TextUtils.ExportExcel(grvData); } } catch (Exception) { } }
private void btnExcel_Click(object sender, EventArgs e) { try { if (grvData.RowCount > 0) { FolderBrowserDialog od = new FolderBrowserDialog(); if (od.ShowDialog() == DialogResult.OK) { TextUtils.ExportExcel(grvData, od.SelectedPath, string.Format("DanhSachSanPham_{0}", DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss"))); } } } catch (Exception) { } }
private void btnExeclGroup_Click(object sender, EventArgs e) { try { if (grvData.RowCount > 0) { string code = TextUtils.ToString(grvYCMVT.GetFocusedRowCellValue(colCodeYC)); FolderBrowserDialog fbd = new FolderBrowserDialog(); fbd.SelectedPath = Settings.Default.VT_PriceChenhLech; if (fbd.ShowDialog() == DialogResult.OK) { Settings.Default.VT_PriceChenhLech = fbd.SelectedPath; Settings.Default.Save(); TextUtils.ExportExcel(grvData, fbd.SelectedPath, "G_" + code); } } } catch (Exception) { } }
private void btnExport_Click(object sender, EventArgs e) { string folderPath = ""; FolderBrowserDialog fbd = new FolderBrowserDialog(); if (fbd.ShowDialog() == DialogResult.OK) { folderPath = fbd.SelectedPath; } else { return; } string fullName = TextUtils.ToString(grvCboUser.GetFocusedRowCellValue(colFullName)); TextUtils.ExportExcel(grvData, folderPath, fullName, false); string filepath = folderPath + "//" + fullName + ".xls"; DataTable dtFile = new DataTable(); dtFile.Columns.Add("ID"); dtFile.Columns.Add("FileName"); dtFile.Columns.Add("Path"); dtFile.Rows.Add(0, Path.GetFileName(filepath), filepath); string content = " Dear " + fullName + "!<br>" + "Phòng dự án gửi anh/chị các vấn đề mà anh/chị phụ trách.<br> Đề nghị anh/chị thực hiện theo đúng kế hoạch.<br>Xin chân thành cảm ơn."; string subject = "VẤN ĐỀ TỒN ĐỌNG DỰ ÁN"; frmSendEmailAttach frm = new frmSendEmailAttach(); frm.To = TextUtils.ToString(grvCboUser.GetFocusedRowCellValue(colAccount)) + "@tpa.com.vn"; frm.Content = content; frm.Subject = subject; frm.dtFile = dtFile; frm.IsClosed = true; frm.CC = "[email protected];[email protected];[email protected];[email protected];[email protected]"; TextUtils.OpenForm(frm); }
private void btnExeclReport_Click(object sender, EventArgs e) { //string path = ""; //FolderBrowserDialog fbd = new FolderBrowserDialog(); //if (fbd.ShowDialog() == DialogResult.OK) //{ // path = fbd.SelectedPath; //} //else //{ // return; //} //string filePath = Application.StartupPath + "\\Templates\\PhongKeToan\\BangTheoDoiChungTu.xlsx"; //string currentPath = path + "\\BangTheoDoiChungTu.xlsx"; //try //{ // File.Copy(filePath, currentPath, true); //} //catch (Exception ex) //{ // MessageBox.Show("Có lỗi khi tạo báo cáo!" + Environment.NewLine + ex.Message, // TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); // return; //} //using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang tạo báo cáo...")) //{ // System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); // Excel.Application app = default(Excel.Application); // Excel.Workbook workBoook = default(Excel.Workbook); // Excel.Worksheet workSheet = default(Excel.Worksheet); // try // { // app = new Excel.Application(); // app.Workbooks.Open(currentPath); // workBoook = app.Workbooks[1]; // workSheet = (Excel.Worksheet)workBoook.Worksheets[1]; // for (int i = grvData.RowCount - 1; i >= 0; i--) // { // string number = TextUtils.ToString(grvData.GetRowCellValue(i, colNumber)); // workSheet.Cells[6, 1] = i + 1; // workSheet.Cells[6, 2] = number; // workSheet.Cells[6, 3] = TextUtils.ToString(grvData.GetRowCellValue(i, colItemCode)); // workSheet.Cells[6, 4] = TextUtils.ToString(grvData.GetRowCellValue(i, colItemName)); // workSheet.Cells[6, 5] = TextUtils.ToString(grvData.GetRowCellValue(i, colVoucherName)); // workSheet.Cells[6, 6] = TextUtils.ToString(grvData.GetRowCellValue(i, colUserName)); // workSheet.Cells[6, 7] = TextUtils.ToString(grvData.GetRowCellDisplayText(i, colCreatedDate)); // workSheet.Cells[6, 8] = TextUtils.ToString(grvData.GetRowCellDisplayText(i, colCompletedDateDK)); // if (number != "") // { // ((Excel.Range)workSheet.Rows[6]).Insert(); // } // } // ((Excel.Range)workSheet.Rows[5]).Delete(); // ((Excel.Range)workSheet.Rows[5]).Delete(); // } // catch (Exception ex) // { // MessageBox.Show(ex.Message); // } // finally // { // if (app != null) // { // app.ActiveWorkbook.Save(); // app.Workbooks.Close(); // app.Quit(); // } // } // Process.Start(currentPath); //} TextUtils.ExportExcel(grvData); }
private void btnXuatExcel_Click(object sender, EventArgs e) { TextUtils.ExportExcel(grvData); }
private void toolStripButton1_Click(object sender, EventArgs e) { TextUtils.ExportExcel(grvData); }
private void btnExeclGroup_Click(object sender, EventArgs e) { TextUtils.ExportExcel(grvLink); }
private void btnExecl_Click(object sender, EventArgs e) { //string path = ""; //FolderBrowserDialog fbd = new FolderBrowserDialog(); //if (fbd.ShowDialog() == DialogResult.OK) //{ // path = fbd.SelectedPath; //} //else //{ // return; //} //string filePath = Application.StartupPath + "\\Templates\\PhongKeToan\\MauChungTu.xlsx"; //string currentPath = path + "\\" + TextUtils.ToString(cboPhongBan.EditValue) // + "-" + TextUtils.ToString(grvCboProject.GetFocusedRowCellValue(colPhanXuongName)) // + "-" + TextUtils.ToString(cboYear.SelectedItem) + "-DT_CP.xlsx"; //try //{ // File.Copy(filePath, currentPath, true); //} //catch (Exception ex) //{ // MessageBox.Show("Có lỗi: " + Environment.NewLine + ex.Message, TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); // return; //} //using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang xuất báo cáo...")) //{ // System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); // Excel.Application app = default(Excel.Application); // Excel.Workbook workBoook = default(Excel.Workbook); // Excel.Worksheet workSheet = default(Excel.Worksheet); // try // { // app = new Excel.Application(); // app.Workbooks.Open(currentPath); // workBoook = app.Workbooks[1]; // workSheet = (Excel.Worksheet)workBoook.Worksheets[1]; // DataTable dtItem = (DataTable)grdData.DataSource; // DataTable dtGroup = LibIE.Select("select * from T_DM_KMP_GROUP with(nolock)"); // for (int i = 0; i < dtItem.Rows.Count; i++) // { // string orderCode = TextUtils.ToString(dtItem.Rows[i]["Code"]); // string listProjects = TextUtils.ToString(dtItem.Rows[i]["Target"]); // decimal vat = TextUtils.ToDecimal(dtItem.Rows[i]["VAT"]); // decimal delivery = TextUtils.ToDecimal(dtItem.Rows[i]["DeliveryCost"]); // decimal percentPay = TextUtils.ToDecimal(dtItem.Rows[i]["PercentPay"]); // decimal totalTH = TextUtils.ToDecimal(dtItem.Rows[i]["TotalTH"]); // string[] arrProject = listProjects.Split(','); // if (arrProject.Length == 1) // { // //workSheet.Cells[8, 1] = i + 1; // workSheet.Cells[8, 5] = orderCode.Length > 7 ? orderCode.Substring(0, 7) : orderCode; // workSheet.Cells[8, 19] = // (TextUtils.ToDecimal(dtItem.Rows[i]["TotalCash"]) + // TextUtils.ToDecimal(dtItem.Rows[i]["TotalCK"])).ToString(); // workSheet.Cells[8, 7] = TextUtils.ToString(dtItem.Rows[i]["Name"]); // workSheet.Cells[8, 20] = TextUtils.ToString(dtItem.Rows[i]["DCode"]); // workSheet.Cells[8, 21] = TextUtils.ToString(dtItem.Rows[i]["CostCode"]); // workSheet.Cells[8, 22] = TextUtils.ToString(dtItem.Rows[i]["Target"]); // workSheet.Cells[8, 23] = orderCode; // ((Excel.Range)workSheet.Rows[8]).Insert(); // } // else if (arrProject.Length > 1) // { // //arrProject = arrProject.OrderByDescending(c => c).ToArray(); // foreach (string projectCode in arrProject) // { // decimal total = 0; // if (orderCode.Length > 7) // { // string sql = ""; // //bool isSXC = false; // if (!projectCode.Trim().StartsWith("Mua")) // { // sql = "select sum(TotalPrice) as total from vGetPartWithOrder where OrderCode = '" + orderCode + // "' and ProjectCode = '" + projectCode.Trim() + "'"; // //isSXC = true; // } // else // { // sql = "select sum(TotalPrice) as total from vGetPartWithOrder where OrderCode = '" + orderCode + // "' and (ProjectCode is null or ProjectCode = '')"; // } // DataTable dtSum = LibQLSX.Select(sql); // decimal totalTHp = TextUtils.ToDecimal(dtSum.Rows[0][0]); // decimal total_TH_D = totalTHp + totalTHp / (totalTH == 0 ? 1 : totalTH) * delivery; // total = Math.Round((total_TH_D + total_TH_D * vat / 100) * percentPay / 100); // } // else // { // total = TextUtils.ToDecimal(dtItem.Rows[i]["TotalCash"]) + TextUtils.ToDecimal(dtItem.Rows[i]["TotalCK"]); // } // workSheet.Cells[8, 5] = orderCode.Length > 7 ? orderCode.Substring(0, 7) : orderCode; // workSheet.Cells[8, 19] = total; // workSheet.Cells[8, 7] = TextUtils.ToString(dtItem.Rows[i]["Name"]); // workSheet.Cells[8, 20] = TextUtils.ToString(dtItem.Rows[i]["DCode"]); // workSheet.Cells[8, 21] = TextUtils.ToString(dtItem.Rows[i]["CostCode"]); // workSheet.Cells[8, 22] = projectCode.Trim(); // workSheet.Cells[8, 23] = orderCode; // ((Excel.Range)workSheet.Rows[8]).Insert(); // } // } // } // ((Excel.Range)workSheet.Rows[7]).Delete(); // ((Excel.Range)workSheet.Rows[7]).Delete(); // } // catch (Exception ex) // { // MessageBox.Show(ex.Message); // } // finally // { // if (app != null) // { // app.ActiveWorkbook.Save(); // app.Workbooks.Close(); // app.Quit(); // } // } // Process.Start(currentPath); //} TextUtils.ExportExcel(grvData); }