private void ExportData() { NZString SlipNo = new NZString(null, shtDelivery.GetValue(shtDelivery.ActiveRowIndex, (int)eColView.SLIP_NO)); string strFileName = GenerateFileName("INV_" + SlipNo.StrongValue); string strTemplateFileName = @"Report\TRN090_Invoice_Template.xls"; string strTemplatePath = Path.Combine(Application.StartupPath, strTemplateFileName); string strExportPath = SaveDialogUtil.GetBrowseFileDialogForExport(strFileName); if (!"".Equals(strExportPath)) { DeliveryController ctrl = new DeliveryController(); DataSet ds = new DataSet(); ds.Tables.Add(ctrl.Load_Invoice(SlipNo)); ExportUtil.Export(ds, strTemplatePath, strExportPath); MessageDialog.ShowInformation(this, null, new EVOFramework.Message(Messages.eInformation.INF9003.ToString()).MessageDescription); if (File.Exists(strExportPath)) { System.Diagnostics.Process.Start(strExportPath); } } }
private void ExportData() { string strFileName = GenerateFileName("StockTaking"); string strTemplateFileName = @"Report\STR030_StockTaking.xls"; string strTemplatePath = Path.Combine(Application.StartupPath, strTemplateFileName); string strExportPath = SaveDialogUtil.GetBrowseFileDialogForExport(strFileName); if (!"".Equals(strExportPath)) { StockTakingDTO dto = new StockTakingDTO(); dto.STOCK_TAKING_DATE = Convert.ToDateTime(dtStockTakingDate.DateValue); dto.LOCATION_CODE = cboProcess.SelectedValue == null ? string.Empty : cboProcess.SelectedValue.ToString();//txtLocation.Text; dto.PART_NO = txtMasterNo.Text; dto.PART_TYPE = Convert.ToString(cboItemType.SelectedValue); dto.PART_SUB_TYPE = Convert.ToString(cboItemClassMinor04.SelectedValue); if (chkIncomplete.Checked) { dto.SEARCH_INCOMPLETE = 1; } else { dto.SEARCH_INCOMPLETE = 0; } if (chkDiff.Checked) { dto.SEARCH_DIFF = 1; } else { dto.SEARCH_DIFF = 0; } if (chkNoMaster.Checked) { dto.NO_MASTER = 1; } else { dto.NO_MASTER = 0; } DataSet ds = GetExportTable(dto); ExportUtil.Export(ds, strTemplatePath, strExportPath); MessageDialog.ShowInformation(this, null, new EVOFramework.Message(Messages.eInformation.INF9003.ToString()).MessageDescription); if (File.Exists(strExportPath)) { System.Diagnostics.Process.Start(strExportPath); } } }
public override void OnExport() { if (shtQueryList.ActiveRowIndex == -1) { return; } if (m_dtAllData == null) { MessageBox.Show("ให้ทำการค้นหาข้อมูลก่อน export"); return; } string strReportID = ""; strReportID = shtQueryList.Cells[shtQueryList.ActiveRowIndex, (int)eColQueryList.ID].Text; string strFileName = GenerateFileName(strReportID); string strTemplateFileName = @"Report\" + this.txtTemplate.Text; string strTemplatePath = Path.Combine(Application.StartupPath, strTemplateFileName); string strExportPath = SaveDialogUtil.GetBrowseFileDialogForExport(strFileName); if (!"".Equals(strExportPath)) { DataSet ds = new DataSet(); ds.Tables.Add(this.m_dtAllData.Copy()); //ExportUtil.Export(ds, @"c:\testExport0.xls"); if (File.Exists(strTemplatePath)) { ExportUtil.Export(ds, strTemplatePath, strExportPath, ExportUtil.Format, Convert.ToInt32(txtStartColumn.Text), Convert.ToInt32(txtStartRow.Text)); } else { ExportUtil.Export(ds, strExportPath, ExportUtil.Format, Convert.ToInt32(txtStartColumn.Text), Convert.ToInt32(txtStartRow.Text)); } MessageDialogResult mdr = MessageDialog.ShowConfirmation(this, "บันทึกเสร็จแล้ว ต้องการเปิดไฟล์หรือไม่", EVOFramework.Windows.Forms.MessageDialogButtons.YesNo); if (mdr == MessageDialogResult.Yes) { System.Diagnostics.Process.Start(strExportPath); } } }
private void btnGetTemplate_Click(object sender, EventArgs e) { try { string strFilePath = SaveDialogUtil.GetBrowseFileDialogForExport(); if (string.Empty.Equals(strFilePath)) { return; } string strReportPath = @"Report\STK060_ImportStockTakingTemplate.xls"; File.Copy(Path.Combine(Application.StartupPath, strReportPath), strFilePath); MessageDialog.ShowInformation(this, null, Message.LoadMessage(Messages.eInformation.INF0006.ToString()).MessageDescription); } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message, ex.StackTrace); } }
private void ExportOnHandForAccounting() { string strFileName = GenerateFileName("IVR010"); string strTemplateFileName = @"Report\IVR010_InventorySheet.xls"; string strTemplatePath = Path.Combine(Application.StartupPath, strTemplateFileName); string strExportPath = SaveDialogUtil.GetBrowseFileDialogForExport(strFileName); if (!"".Equals(strExportPath)) { ReportBIZ bizReport = new ReportBIZ(); ReportCriteriaDTO.IVR010 objCriteria = new ReportCriteriaDTO.IVR010(); if (this.dtPeriodBegin.Value.HasValue) { objCriteria.YearMonth = this.dtPeriodBegin.Value.Value.ToString("yyyyMM"); } else { objCriteria.YearMonth = DateTime.Today.ToString("yyyyMM"); } DataSet dsIVR010 = bizReport.LoadIVR010_InventorySheet(objCriteria); ExportUtil.Export(dsIVR010, strTemplatePath, strExportPath); MessageDialog.ShowInformation(this, null, new EVOFramework.Message(Messages.eInformation.INF9003.ToString()).MessageDescription); if (File.Exists(strExportPath)) { System.Diagnostics.Process.Start(strExportPath); } } }