private void gridViewFiles_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { try { string mensaje = ""; tb_Comprobante_Info InfoCbteT = new tb_Comprobante_Info(); switch (e.Column.Name) { case "colEliminar": tb_Comprobante_Info Info = new tb_Comprobante_Info(); string msg = ""; Info = (tb_Comprobante_Info)gridViewFiles.GetFocusedRow(); if (MessageBox.Show("Esta seguro que desear anular el comprobante #:" + Info.IdComprobante, "Efirm confirmacion", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (buscomp.Eliminar_Cbte(Info.IdEmpresa, Info.IdComprobante, "", "", ref msg)) { MessageBox.Show("Eliminacion de comprobante Ok", "Efirm", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case "ColRide": XtraReport Reporte = new XtraReport(); string msj = ""; Rpt_Ride_Bus = new Rpt_Ride_bus(busEmpresa.GetEmpresas(ref mensajeError)); InfoCbteT = (tb_Comprobante_Info)gridViewFiles.GetFocusedRow(); Reporte = Rpt_Ride_Bus.Optener_reporte(InfoCbteT, ref msj); //FAct Imporpoint Reporte.ShowPreview(); break; default: mensaje = (string)gridViewFiles.GetFocusedRowCellValue(e.Column); if (mensaje != "") { frmMensaje frmsg = new frmMensaje(); frmsg.richTextBoxMensaje.Text = mensaje; frmsg.WindowState = FormWindowState.Maximized; frmsg.ShowDialog(); } break; } } catch (Exception ex) { BusSisLog.Log_Error(ex.Message.ToString(), eTipoError.ERROR, this.ToString()); } }
public void Yazdirr(string DosyaAdi, Nasil NasilAcsin) { try { Rapor = new XtraReport(); Rapor.LoadLayout(DosyaAdi); Rapor.DataSource = ds; switch (NasilAcsin) { case Nasil.dizayn: XRDesignFormEx XrDesigner = new XRDesignFormEx() { FileName = DosyaAdi }; XrDesigner.OpenReport(Rapor); XrDesigner.Show(); break; case Nasil.Goster: Rapor.ShowPreview(); break; case Nasil.Yazdir: Rapor.Print(); break; } } catch (Exception hata) { frmHataBildir frmHataBildir = new frmHataBildir(hata.Message, hata.StackTrace); frmHataBildir.ShowDialog(); } }
private void gridView_Files_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { try { tb_Comprobante_Info InfoCbteT = new tb_Comprobante_Info(); string MensajeError = ""; switch (e.Column.Name) { case "col_Ride": XtraReport Reporte = new XtraReport(); string msg = ""; InfoCbteT = (tb_Comprobante_Info)gridView_Files.GetFocusedRow(); Reporte = Rpt_Ride_Bus.Optener_reporte(InfoCbteT, ref msg); //FAct Imporpoint Reporte.ShowPreview(); break; case "col_Xml": InfoCbteT = (tb_Comprobante_Info)gridView_Files.GetFocusedRow(); tb_Comprobante_Bus BusCbte = new tb_Comprobante_Bus(); string sXML = ""; sXML = BusCbte.Get_XML(InfoCbteT.IdEmpresa, InfoCbteT.IdComprobante, ref MensajeError); XmlDocument xmlOrigen = new XmlDocument(); xmlOrigen.Load(new StringReader(sXML)); Stream myStream; SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "xml files (*.xml)|*.xml"; saveFileDialog1.FilterIndex = 2; saveFileDialog1.RestoreDirectory = true; saveFileDialog1.FileName = "SRI_" + InfoCbteT.Nombre_file; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { if ((myStream = saveFileDialog1.OpenFile()) != null) { xmlOrigen.Save(myStream); myStream.Close(); } } break; default: string mensaje = (string)gridViewFiles.GetFocusedRowCellValue(e.Column); if (mensaje != "") { frmMensaje frmsg = new frmMensaje(); frmsg.richTextBoxMensaje.Text = mensaje; frmsg.WindowState = FormWindowState.Maximized; frmsg.ShowDialog(); } break; } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); BusSisLog.Log_Error(ex.Message.ToString(), eTipoError.ERROR, this.ToString()); } }
/// <summary> /// 打印操作 /// </summary> /// <param name="operation"></param> public void PrintDialog(string operation) { //当修改原数据是要进行保存后才能去打印 if (biSave.Enabled == true) { MessageBox.Show("在原数据上进行修改时请先保存后再进行打印!!!"); } var xtreport = new XtraReport(); // _btApp = new BarTender.Application(); //判断当前打印模版路径是否存在 var temPath = _cTempletFileName; //_cTempletFileName; //Application.StartupPath + @"\Label\" + _cTempletFileName; if (!File.Exists(temPath)) { MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); xtreport.ShowDesigner(); return; } xtreport.LoadLayout(temPath); xtreport.PrinterName = _cPrinter; xtreport.PrintingSystem.StartPrint += PrintingSystem_StartPrint; xtreport.RequestParameters = false; xtreport.ShowPrintStatusDialog = false; xtreport.ShowPrintMarginsWarning = false; //模板赋值 DllWorkPrintLabel.SetParametersValue(xtreport, "cSerialNumber", lblTitleMain.lblcSerialNumber.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cBarCode", "R*" + _FitemId + "*L*" + txtcLotNo.Text + "*S*" + lblTitleMain.lblcSerialNumber.Text + ";" + dtpcDefine2.Value.ToShortDateString()); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvCode", txtcInvCode.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvName", utecInvName.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "dDate", dtpdDate.Value.ToShortDateString()); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvStd", txtcInvStd.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cFullName", txtcFullName.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cVendor", txtcVendor.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cLotNo", txtcLotNo.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "iQuantity", uneiQuantity.Value); DllWorkPrintLabel.SetParametersValue(xtreport, "cMemo", txtcMemo.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cDefine1", txtcDefine1.Text); if (dtpdDate.Checked) { DllWorkPrintLabel.SetParametersValue(xtreport, "cVendorDate", dtpdDate.Value); } //模板赋值 switch (operation) { case "print": xtreport.Print(); break; case "design": xtreport.ShowDesigner(); break; case "preview": xtreport.ShowPreview(); break; } }
private void button1_Click(object sender, EventArgs e) { // Create an empty report. XtraReport report = new XtraReport(); // Create a new Excel data source. ExcelDataSource excelDataSource = new ExcelDataSource(); excelDataSource.FileName = "..//..//Northwind.csv"; // Specify import settings. CsvSourceOptions csvSourceOptions = new CsvSourceOptions(); csvSourceOptions.DetectEncoding = true; csvSourceOptions.DetectNewlineType = true; csvSourceOptions.DetectValueSeparator = true; excelDataSource.SourceOptions = csvSourceOptions; // Define the data source schema. FieldInfo fieldCategoryID = new FieldInfo { Name = "CategoryID", Type = typeof(double), Selected = false }; FieldInfo fieldCategoryName = new FieldInfo { Name = "CategoryName", Type = typeof(string) }; FieldInfo fieldDescription = new FieldInfo { Name = "Description", Type = typeof(string) }; // Add the created fields to the data source schema in the order that matches the column order in the source file. excelDataSource.Schema.AddRange(new FieldInfo[] { fieldCategoryID, fieldCategoryName, fieldDescription }); // Assign the data source to the report. report.DataSource = excelDataSource; // Add a detail band to the report. DetailBand detailBand = new DetailBand(); detailBand.Height = 50; report.Bands.Add(detailBand); // Create a new label. XRLabel label = new XRLabel(); // Specify the label's binding depending on the data binding mode. if (Settings.Default.UserDesignerOptions.DataBindingMode == DataBindingMode.Bindings) { label.DataBindings.Add("Text", null, "CategoryName"); } else { label.ExpressionBindings.Add(new ExpressionBinding("BeforePrint", "Text", "[CategoryName]")); } // Add the label to the detail band. detailBand.Controls.Add(label); // Show the report's print preview. report.ShowPreview(); }
private void button1_Click(object sender, EventArgs e) { // Create a report grouped by days of week, // and show its print preview. XtraReport report = CreateDataGroupingReport(); report.ShowPreview(); }
private void btnPreview_Click(object sender, EventArgs e) { if (File.Exists("Report.repx")) { XtraReport report = XtraReport.FromFile("Report.repx", true); report.ShowPreview(); } }
private void btnRestore_Click(object sender, EventArgs e) { string modifiedLayout = cleanupReportLayout(File.ReadAllText("TestLayout.repx")); File.WriteAllText("ModifiedLayout.repx", modifiedLayout); XtraReport report = XtraReport.FromFile("ModifiedLayout.repx", true); report.ShowPreview(); }
void FisYazdir(bool Disigner, string pkSatislar, string SatisFisTipi, string YaziciAdi) { ArrayList list = new ArrayList(); list.Add(new SqlParameter("@ilkTarih", ilktarih.DateTime.AddMinutes(-1))); list.Add(new SqlParameter("@sonTarih", ilktarih.DateTime)); try { string fisid = pkSatislar; System.Data.DataSet ds = new DataSet("Test"); DataTable FisDetay = DB.GetData(@"SELECT Personeller.pkpersoneller,Firmalar.pkFirma,StokKarti.Stokadi, Firmalar.Firmaadi, Firmalar.Tel, Firmalar.Adres, (Firmalar.Alacak-Firmalar.Borc) as Bakiye, Firmalar.OzelKod, Personeller.adi,Personeller.soyadi,SatisDetay.Adet,SatisDetay.SatisFiyati,(SatisDetay.Adet*SatisDetay.SatisFiyati-SatisDetay.iskontotutar) as Tutar, Satislar.OdemeSekli FROM Satislar INNER JOIN SatisDetay ON Satislar.pkSatislar = SatisDetay.fkSatislar INNER JOIN StokKarti ON SatisDetay.fkStokKarti = StokKarti.pkStokKarti INNER JOIN Firmalar ON Satislar.fkFirma = Firmalar.pkFirma INNER JOIN Personeller ON Personeller.pkpersoneller=Satislar.fkPerTeslimEden WHERE Satislar.Siparis = 0 and Satislar.fkSatisDurumu=10 and Satislar.TeslimTarihi between @ilkTarih and @sonTarih and Satislar.fkPerTeslimEden=@fkPerTeslimEden order by Personeller.pkpersoneller,Firmalar.pkFirma", list); FisDetay.TableName = "FisDetay"; ds.Tables.Add(FisDetay); //MÜŞTERİNİN SORUMLU OLDUĞU PERSONEL DataTable Fis = DB.GetData(@"SELECT TOP 1 * FROM PERSONELLER"); Fis.TableName = "Fis"; ds.Tables.Add(Fis); string exedizini = Path.GetDirectoryName(Application.ExecutablePath); string RaporDosyasi = exedizini + "\\Raporlar\\" + SatisFisTipi + ".repx"; if (!File.Exists(RaporDosyasi)) { MessageBox.Show("Dosya Bulunamadı"); return; } //string RaporDosyasi = exedizini + "\\Raporlar\\MusteriSatis.repx"; XtraReport rapor = new XtraReport(); rapor.DataSource = ds; rapor.LoadLayout(RaporDosyasi); if (Disigner) { rapor.ShowDesigner(); } else { rapor.ShowPreview();//.Print(YaziciAdi);//.ShowPreview(); } } catch (Exception exp) { MessageBox.Show("Hata Oluştu " + exp.Message); } }
private void btnPrint_Click(object sender, EventArgs e) { XtraReport rp = new XtraReport(); rp.DataSource = nccControl.getAllData(); // rp.ShowDesignerDialog(); rp.LoadLayout(Application.StartupPath + @"\ReportDanhSachNhaCungCap.repx"); //rp.ShowDesignerDialog(); rp.ShowPreview(); }
public virtual void LoadReport(string packlistId) { m_report = CreateReport(); Parameter param = m_report.Parameters["packlistId"]; param.Value = packlistId; m_report.ShowPreview(); }
private void button1_Click(object sender, EventArgs e) { // Create a report and handle its BeforPrint event. XtraReport report = new XtraReport(); report.BeforePrint += report_BeforePrint; // Show the report's preview. report.ShowPreview(); }
private void button1_Click(object sender, EventArgs e) { XtraReport report = new XtraReport(); XtraReport subreport = new XtraReport(); report.LoadLayout(Application.StartupPath + "\\MainReport.repx"); subreport.LoadLayout(Application.StartupPath + "\\SubReport.repx"); ((XRSubreport)report.FindControl("xrSubreport1", true)).ReportSource = subreport; ((XRSubreport)report.FindControl("xrSubreport1", true)).BeforePrint += new System.Drawing.Printing.PrintEventHandler(Form1_BeforePrint); report.ShowPreview(); }
public virtual void Preview(string doc) { if (!string.IsNullOrEmpty(doc)) { XtraReport rpt = InitializeReport(doc); if (rpt != null) { rpt.ShowPreview(); } } }
/// <summary> /// 打印操作 /// </summary> /// <param name="operation"></param> public void PrintDialog(string operation) { var xtreport = new XtraReport(); // _btApp = new BarTender.Application(); //判断当前打印模版路径是否存在 var temPath = Application.StartupPath + @"\Stencil\ProOemOrder.repx"; if (!File.Exists(temPath)) { MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); xtreport.ShowDesigner(); return; } xtreport.LoadLayout(temPath); xtreport.RequestParameters = false; xtreport.ShowPrintStatusDialog = false; xtreport.ShowPrintMarginsWarning = false; xtreport.DataSource = uGridChecks.DataSource; //模板赋值 for (var i = 0; i < uGridCheck.DisplayLayout.Bands[0].Columns.Count; i++) { var cKey = uGridCheck.DisplayLayout.Bands[0].Columns[i].Key; string cValue; if (uGridCheck.Rows.Count > _iRowNo) { cValue = uGridCheck.Rows[_iRowNo].Cells[i].Value.ToString(); } else { cValue = ""; } DLL.DllWorkPrintLabel.SetParametersValue(xtreport, cKey, cValue); } //模板赋值 switch (operation) { case "print": xtreport.Print(); break; case "design": xtreport.ShowDesigner(); break; case "preview": xtreport.ShowPreview(); break; } }
public static void GetFaturaByNo(long FaturaNo) { string path = System.IO.Path.GetFullPath(@"Reporting\GjeneroFaturen.txt"); XtraReport report = new XtraReport(); report = XtraReport.FromFile(path, true); ReportPrintTool pt = new ReportPrintTool(report); PrintingSystemBase ps = pt.PrintingSystem; report.PrintingSystem.SetCommandVisibility(DevExpress.XtraPrinting.PrintingSystemCommand.Parameters, DevExpress.XtraPrinting.CommandVisibility.None); report.DataSource = GetAll.GetFaturaByNr(FaturaNo); report.DataMember = "CustomSqlQuery"; report.DisplayName = "Invoice"; report.ShowPreview(); }
public static void GetShpenzimet(DateTime start, DateTime end) { string path = System.IO.Path.GetFullPath(@"Reporting\Raport Shpenzimesh.txt"); XtraReport report = new XtraReport(); report = XtraReport.FromFile(path, true); ReportPrintTool pt = new ReportPrintTool(report); PrintingSystemBase ps = pt.PrintingSystem; report.PrintingSystem.SetCommandVisibility(DevExpress.XtraPrinting.PrintingSystemCommand.Parameters, DevExpress.XtraPrinting.CommandVisibility.None); report.DataSource = GetAll.GetShpenzimet(start, end); report.DataMember = "CustomSqlQuery"; report.DisplayName = "Invoice"; report.ShowPreview(); }
public static void GetSales(DateTime start, DateTime end, Klienti klienti) { string path = System.IO.Path.GetFullPath(@"Reporting\Shitjet.txt"); XtraReport report = new XtraReport(); report = XtraReport.FromFile(path, true); report.FindControl("lbInvoice", true).Text = "Raport Shitjesh " + klienti.Emri; ReportPrintTool pt = new ReportPrintTool(report); PrintingSystemBase ps = pt.PrintingSystem; report.PrintingSystem.SetCommandVisibility(DevExpress.XtraPrinting.PrintingSystemCommand.Parameters, DevExpress.XtraPrinting.CommandVisibility.None); report.DataSource = GetAll.GetSales(start, end, klienti.ID); report.DataMember = "CustomSqlQuery"; report.DisplayName = "Invoice"; report.ShowPreview(); }
void YazdirTaksitlerExtra(bool dizayn) { XtraReport rapor = new XtraReport(); //rapor.FindControl("label15", true).Text = DB.PersonellerBaslik; try { System.Data.DataSet ds = new DataSet("Test"); string sql = @"select *,dbo.fnc_ParayiYaziyaCevir(Odenecek,2) as rakamoku,Odenecek-Odenen as Kalan from Taksit T with(nolock) left join Taksitler TL with(nolock) on T.taksit_id=TL.taksit_id where Kaydet=0"; //if(checkEdit1.Checked) sql = sql + " and Odenecek<>Odenen"; sql = sql + " and T.fkFirma=" + pkFirma_id; DataTable dtTaksitler = DB.GetData(sql); dtTaksitler.TableName = "Taksitler"; ds.Tables.Add(dtTaksitler); // DataTable Cari = DB.GetData("select *,dbo.fon_MusteriBakiyesi(pkFirma) as Bakiye from Firmalar with(nolock) where pkFirma=" + pkFirma_id); Cari.TableName = "Cari"; ds.Tables.Add(Cari); //şirket DataTable Sirket = DB.GetData("select top 1 * from Sirketler with(nolock)"); Sirket.TableName = "Sirket"; ds.Tables.Add(Sirket); rapor.DataSource = ds; rapor.LoadLayout(DB.exeDizini + "\\Raporlar\\TaksitlerExtra.repx"); rapor.Name = "TaksitlerExtra"; rapor.Report.Name = "TaksitlerExtra"; } catch (Exception ex) { MessageBox.Show(ex.Message); } if (dizayn) { rapor.ShowDesigner(); } else { rapor.ShowPreview(); } }
public void PrintDialog(string operation) { var xtreport = new XtraReport(); // _btApp = new BarTender.Application(); //判断当前打印模版路径是否存在 var temPath = _cTempletFileName; //_cTempletFileName; //Application.StartupPath + @"\Label\" + _cTempletFileName; if (!File.Exists(temPath)) { MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); xtreport.ShowDesigner(); return; } xtreport.LoadLayout(temPath); xtreport.PrinterName = _cPrinter; xtreport.RequestParameters = false; xtreport.ShowPrintStatusDialog = false; xtreport.ShowPrintMarginsWarning = false; //模板赋值 DllWorkPrintLabel.SetParametersValue(xtreport, "cSerialNumber", lblTitleMain.lblcSerialNumber.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cBarCode", "P*" + _FitemId + "*L*" + txtFBatchNo.Text + "*S*"); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvCode", txtcInvCode.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvName", utecInvName.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvStd", txtcInvStd.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cFullName", txtcFullName.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "iQuantity", uneiQuantity.Value); DllWorkPrintLabel.SetParametersValue(xtreport, "cMemo", txtcMemo.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "dDate", dtpdDate.Value.ToShortDateString()); DllWorkPrintLabel.SetParametersValue(xtreport, "cOrderNumber", txtcOrderNumber.Text); xtreport.DataSource = GetPrintData(); //模板赋值 switch (operation) { case "print": xtreport.Print(); break; case "design": xtreport.ShowDesigner(); break; case "preview": xtreport.ShowPreview(); break; } }
void FisYazdir(bool Disigner) { string sql = @"exec sp_TedarikcilereGenelBakis"; try { System.Data.DataSet ds = new DataSet("Test"); DataTable dtliste = DB.GetData(sql); //DataTable dtliste = (DataTable)gridControl1.DataSource; dtliste.TableName = "dtliste"; ds.Tables.Add(dtliste); //şirket bilgileri DataTable Sirket = DB.GetData(@"select * from Sirketler with(nolock)"); Sirket.TableName = "Sirket"; ds.Tables.Add(Sirket); string exedizini = Path.GetDirectoryName(Application.ExecutablePath); string RaporDosyasi = exedizini + "\\Raporlar\\TedarikciBorcListesi.repx"; if (!File.Exists(RaporDosyasi)) { MessageBox.Show("Dosya Bulunamadı"); return; } XtraReport rapor = new XtraReport(); rapor.LoadLayout(RaporDosyasi); rapor.Name = "TedarikciBorcListesi"; rapor.Report.Name = "TedarikciBorcListesi"; rapor.DataSource = ds; if (Disigner) { rapor.ShowDesigner(); } else { rapor.ShowPreview(); } ds.Dispose(); } catch (Exception exp) { MessageBox.Show("Hata Oluştu " + exp.Message); } }
/// <summary> /// Exibe o relatório informado. /// </summary> /// <param name="xreport"></param> /// <param name="ribbon"></param> public static void ShowPreviewReport(XtraReport xreport, bool ribbon = false) { //call progressbar XFrmWait.ShowSplashScreen("Gerando relatório..."); //chama a tela de parametros xreport.CreateDocument(); //close a progressbar XFrmWait.CloseSplashScreen(); if (ribbon) { xreport.ShowRibbonPreview(); } xreport.ShowPreview(); }
/// <summary> /// 打印操作 /// </summary> /// <param name="p"></param> private void PrintDialog(string p) { var xtreport = new XtraReport(); // _btApp = new BarTender.Application(); //判断当前打印模版路径是否存在 var temPath = Application.StartupPath + @"\Stencil\TrackDeliveryOrder.repx"; if (!File.Exists(temPath)) { MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); xtreport.Name = "TrackDeliveryOrder"; xtreport.ShowDesigner(); return; } xtreport.LoadLayout(temPath); xtreport.RequestParameters = false; DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "cCode", txtcCode.Text); DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "cOrderType", cbxcOrderType.Text); DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "cCusName", utxtcCusName.Text); DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "dDate", dtpdDate.Text); DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "OrderDate", dtpOrderDate.Text); DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "DeliveryDate", dtpDeliveryDate.Text); DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "cDepName", utecDepName.Text); //模板赋值 switch (p) { case "print": xtreport.Print(); break; case "design": xtreport.ShowDesigner(); break; case "preview": xtreport.ShowPreview(); break; } }
void YazdirTaksitler_(bool dizayn) { XtraReport rapor = new XtraReport(); try { string fkFirma = teMusteri.Tag.ToString(); System.Data.DataSet ds = new DataSet("Test"); DataTable dtTaksitler = DB.GetData("select *,dbo.fnc_ParayiYaziyaCevir(Odenecek,2) as rakamoku from Taksitler with(nolock) where Odenecek<>Odenen and isnull(Kaydet,0)=0 and fkFirma=" + fkFirma); //DataTable FisDetay = DB.GetData(sql); dtTaksitler.TableName = "Taksitler"; ds.Tables.Add(dtTaksitler); // DataTable Cari = DB.GetData("select *,dbo.fon_MusteriBakiyesi(pkFirma) as Bakiye from Firmalar with(nolock) where pkFirma=" + fkFirma); Cari.TableName = "Cari"; ds.Tables.Add(Cari); //şirket DataTable Sirket = DB.GetData("select top 1 * from Sirketler with(nolock)"); Sirket.TableName = "Sirket"; ds.Tables.Add(Sirket); rapor.DataSource = ds; rapor.LoadLayout(DB.exeDizini + "\\Raporlar\\Taksitler.repx"); rapor.Name = "Taksitler"; rapor.Report.Name = "Taksitler"; } catch (Exception ex) { } if (dizayn) { rapor.ShowDesigner(); } else { rapor.ShowPreview(); } }
private void simpleButton3_Click(object sender, EventArgs e) { var report = CreateReport(); byte[] buffer = null; using (var stream = new MemoryStream()) { report.PrintingSystem.SaveDocument(stream); buffer = stream.ToArray(); } // Создаем новый отчет из сохраненного массива байт var rpt = new XtraReport(); using (var stream = new MemoryStream(buffer)) { rpt.PrintingSystem.LoadDocument(stream); } // Отображаем новый отчет rpt.ShowPreview(); }
private void button3_Click(object sender, EventArgs e) { try { tb_Empresa_Bus busEmpresa = new tb_Empresa_Bus(); tb_Comprobante_Info InfoCbteT = new tb_Comprobante_Info(); tb_Comprobante_Bus BusCbteT = new tb_Comprobante_Bus(); XtraReport Reporte = new XtraReport(); string msj = ""; Rpt_Ride_bus Rpt_Ride_Bus = new Rpt_Ride_bus(busEmpresa.GetEmpresas(ref msj)); InfoCbteT = BusCbteT.consultar(1, "FA-001-002-000004078", "01", "VALI", ref msj); Reporte = Rpt_Ride_Bus.Optener_reporte(InfoCbteT, ref msj); //FAct Imporpoint Reporte.ShowPreview(); //object ds = Reporte.DataSource; //xRpt_Ride_Factura_Gen_Forma_Pago reporte = new xRpt_Ride_Factura_Gen_Forma_Pago(); //reporte.DataSource = ds; //reporte.ShowPreview(); ////XtraReport1 repor = new XtraReport1(); ////repor.DataSource = ds; ////repor.ShowPreview(); } catch (Exception ex) { LoggingManager.Logger.Log(LoggingCategory.Error, ex.Message); throw new DalException(string.Format(Resource_Mensajes_Error.RetrieveError, "PricingRule", ex.Message), ex) { EntityType = typeof(Form1) }; } }
/// <summary> /// 打印操作 /// </summary> /// <param name="operation"></param> /// <param name="cTemplet"></param> /// <param name="dSource"></param> public void PrintDialog(string operation, string cTemplet, DataTable dSource) { var xtreport = new XtraReport(); // _btApp = new BarTender.Application(); //判断当前打印模版路径是否存在 var temPath = string.Format("{0}\\Stencil\\{1}.repx", Application.StartupPath, cTemplet); if (!File.Exists(temPath)) { MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); xtreport.ShowDesigner(); return; } xtreport.LoadLayout(temPath); xtreport.RequestParameters = false; xtreport.ShowPrintStatusDialog = false; xtreport.ShowPrintMarginsWarning = false; xtreport.DataSource = dSource; //模板赋值 switch (operation) { case "print": xtreport.Print(); break; case "design": xtreport.ShowDesigner(); break; case "preview": xtreport.ShowPreview(); break; } }
/// <summary> /// 打印操作 /// </summary> /// <param name="operation"></param> public void PrintDialog(string operation) { var xtreport = new XtraReport(); // _btApp = new BarTender.Application(); //判断当前打印模版路径是否存在 var temPath = Application.StartupPath + @"\Stencil\DeliveryOrder.repx"; if (!File.Exists(temPath)) { MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); xtreport.Name = "DeliveryOrder"; xtreport.ShowDesigner(); return; } xtreport.LoadLayout(temPath); xtreport.RequestParameters = false; xtreport.ShowPrintStatusDialog = false; xtreport.ShowPrintMarginsWarning = false; xtreport.DataSource = uGridChecks.DataSource; //模板赋值 string cKey, cValue; for (var i = 0; i < uGridCheck.DisplayLayout.Bands[0].Columns.Count; i++) { cKey = uGridCheck.DisplayLayout.Bands[0].Columns[i].Key; cValue = uGridCheck.Rows[_iRowNo].Cells[i].Value.ToString(); DLL.DllWorkPrintLabel.SetParametersValue(xtreport, cKey, cValue); } //模板赋值 switch (operation) { case "print": xtreport.Print(); break; case "design": xtreport.ShowDesigner(); break; case "preview": xtreport.ShowPreview(); break; } }
private void button1_Click(object sender, EventArgs e) { // Create a report, and specify its data source. XtraReport report = new XtraReport(); nwindDataSet ds = new nwindDataSet(); new nwindDataSetTableAdapters.CategoryProductsTableAdapter().Fill(ds.CategoryProducts); report.DataSource = ds; report.DataMember = "CategoryProducts"; // Add a detail band and define its contents. DetailBand detailBand = new DetailBand(); detailBand.Height = 100; report.Bands.Add(detailBand); XRLabel detailLabel = new XRLabel(); detailLabel.DataBindings.Add("Text", report.DataSource, "ProductName"); detailLabel.Width = 200; detailBand.Controls.Add(detailLabel); // Add a group header band and define its contents. GroupHeaderBand ghBand = new GroupHeaderBand(); ghBand.Height = 20; report.Bands.Add(ghBand); XRLabel ghLabel = new XRLabel(); ghLabel.DataBindings.Add("Text", report.DataSource, "CategoryName"); ghLabel.Width = 200; ghLabel.BackColor = Color.LightBlue; ghBand.Controls.Add(ghLabel); // Define a grouping criteria for the group header band. GroupField groupField = new GroupField(); groupField.FieldName = "CategoryName"; ghBand.GroupFields.Add(groupField); // Create a group footer band. GroupFooterBand gfBand = new GroupFooterBand(); gfBand.Height = 20; // You can force the group header to be repeated on each page. gfBand.RepeatEveryPage = true; // It's important to set its Band.PageBreak property to AfterBand, // because the page numbers are displayed for the last group on a page. // So, if there are two distinct groups appearing on the same page, // this will result in improper page numbering. gfBand.PageBreak = PageBreak.AfterBand; report.Bands.Add(gfBand); // Create an instance of the XRPageInfo control. XRPageInfo pageInfo = new XRPageInfo(); // Set the group header band as the running band for this control. pageInfo.RunningBand = ghBand; // Adjust other properties of XRPageInfo. pageInfo.Width = 200; pageInfo.BackColor = Color.LightBlue; pageInfo.PageInfo = PageInfo.NumberOfTotal; pageInfo.Format = "Pages in this Group: {0} of {1}"; gfBand.Controls.Add(pageInfo); // Show the report's print preview. report.ShowPreview(); }
public void PrintDialogRm(string operation,Infragistics.Win.UltraWinGrid.UltraGridRow uRow,DataTable dt) { var xtreport = new XtraReport(); // _btApp = new BarTender.Application(); //判断当前打印模版路径是否存在 //var _RmcTempletFileName = Application.StartupPath + @"\Label\班次制令单.repx"; var temPath = _RmcTempletFileName; //_cTempletFileName; //Application.StartupPath + @"\Label\" + _cTempletFileName; if (!File.Exists(temPath)) { MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); xtreport.ShowDesigner(); return; } xtreport.LoadLayout(temPath); xtreport.PrinterName = _cPrinter; xtreport.RequestParameters = false; xtreport.ShowPrintStatusDialog = false; xtreport.ShowPrintMarginsWarning = false; var cFitemID = uRow.Cells["cFitemID"].Value.ToString(); var cLotNo = uRow.Cells["FBatchNo"].Value.ToString(); var cDefine2 = dt.Rows[0]["cDefine2"].ToString(); var cSerialNumber = dt.Rows[0]["cSerialNumber"].ToString(); var cInvCode = dt.Rows[0]["cInvCode"].ToString(); var cInvName = dt.Rows[0]["cInvName"].ToString(); var dDate= dt.Rows[0]["dDate"].ToString(); var cInvStd = dt.Rows[0]["cInvStd"].ToString(); var cFullName = dt.Rows[0]["cFullName"].ToString(); var iQuantity = uRow.Cells["iQuantity"].Value.ToString(); var cMemo = dt.Rows[0]["cMemo"].ToString(); var cDefine1 = dt.Rows[0]["cDefine1"].ToString(); //模板赋值 DllWorkPrintLabel.SetParametersValue(xtreport, "cSerialNumber", lblTitleMain.lblcSerialNumber.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cBarCode", "R*" + cFitemID + "*L*" + cLotNo + "*S*" + cSerialNumber + ";" + cDefine2); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvCode", cInvCode); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvName", cInvName); DllWorkPrintLabel.SetParametersValue(xtreport, "dDate", dDate); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvStd", cInvStd); DllWorkPrintLabel.SetParametersValue(xtreport, "cFullName", txtcFullName.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cVendor", cFullName); DllWorkPrintLabel.SetParametersValue(xtreport, "cLotNo", cLotNo); DllWorkPrintLabel.SetParametersValue(xtreport, "iQuantity", iQuantity); DllWorkPrintLabel.SetParametersValue(xtreport, "cMemo", cMemo); DllWorkPrintLabel.SetParametersValue(xtreport, "cDefine1", cDefine1); if (dtpdDate.Checked) DllWorkPrintLabel.SetParametersValue(xtreport, "cVendorDate", dtpdDate.Value); //模板赋值 switch (operation) { case "print": xtreport.Print(); break; case "design": xtreport.ShowDesigner(); break; case "preview": xtreport.ShowPreview(); break; } }
private void simpleButton1_Click(object sender, EventArgs e) { XtraReport mainReport = CreateMainReport(); mainReport.ShowPreview(); }
public void PrintDialog(string operation) { var xtreport = new XtraReport(); // _btApp = new BarTender.Application(); //判断当前打印模版路径是否存在 var temPath = _cTempletFileName; //_cTempletFileName; //Application.StartupPath + @"\Label\" + _cTempletFileName; if (!File.Exists(temPath)) { MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); xtreport.ShowDesigner(); return; } xtreport.LoadLayout(temPath); xtreport.PrinterName = _cPrinter; xtreport.RequestParameters = false; xtreport.ShowPrintStatusDialog = false; xtreport.ShowPrintMarginsWarning = false; //模板赋值 DllWorkPrintLabel.SetParametersValue(xtreport, "cSerialNumber", lblTitleMain.lblcSerialNumber.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cBarCode", "P*" + _FitemId + "*L*" + txtFBatchNo.Text + "*S*" ); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvCode", txtcInvCode.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvName", utecInvName.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvStd", txtcInvStd.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cFullName", txtcFullName.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "iQuantity", uneiQuantity.Value); DllWorkPrintLabel.SetParametersValue(xtreport, "cMemo", txtcMemo.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "dDate", dtpdDate.Value.ToShortDateString()); DllWorkPrintLabel.SetParametersValue(xtreport, "cOrderNumber", txtcOrderNumber.Text); xtreport.DataSource = GetPrintData(); //模板赋值 switch (operation) { case "print": xtreport.Print(); break; case "design": xtreport.ShowDesigner(); break; case "preview": xtreport.ShowPreview(); break; } }
public void PrintDialog(string operation) { if (string.IsNullOrEmpty(biEditTemplet.Caption)) { MessageBox.Show(@"请先在 维护中心-模板管理,添加仓位标签项,再打开此界面!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } var dt = new DataKis.StockPlacePrintDataTable(); foreach (var uRow in uGridCheck.Rows.GetFilteredInNonGroupByRows()) { var nRow = dt.NewStockPlacePrintRow(); nRow.FSPID = int.Parse(uRow.Cells["FSPID"].Value.ToString()); nRow.FNumber = uRow.Cells["FNumber"].Value.ToString(); nRow.FName = uRow.Cells["FName"].Value.ToString(); nRow.FFullName = uRow.Cells["FFullName"].Value.ToString(); dt.Rows.Add(nRow); } if (dt.Rows.Count < 1) { MessageBox.Show(@"请先筛选要打印的数据!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } var xtreport = new XtraReport(); // _btApp = new BarTender.Application(); //判断当前打印模版路径是否存在 var temPath = _cTempletFileName; //_cTempletFileName; //Application.StartupPath + @"\Label\" + _cTempletFileName; if (!File.Exists(temPath)) { MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); xtreport.ShowDesigner(); return; } xtreport.LoadLayout(temPath); xtreport.PrinterName = _cPrinter; xtreport.RequestParameters = false; xtreport.ShowPrintStatusDialog = false; xtreport.ShowPrintMarginsWarning = false; //模板赋值 xtreport.DataSource = dt; //模板赋值 switch (operation) { case "print": xtreport.Print(); break; case "design": xtreport.ShowDesigner(); break; case "preview": xtreport.ShowPreview(); break; } }
/// <summary> /// 打印操作 /// </summary> /// <param name="p"></param> private void PrintDialog(string p) { var xtreport = new XtraReport(); // _btApp = new BarTender.Application(); //判断当前打印模版路径是否存在 var temPath = Application.StartupPath + @"\Stencil\TrackDeliveryOrder.repx"; if (!File.Exists(temPath)) { MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); xtreport.Name = "TrackDeliveryOrder"; xtreport.ShowDesigner(); return; } xtreport.LoadLayout(temPath); xtreport.RequestParameters = false; DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "cCode", txtcCode.Text); DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "cOrderType", cbxcOrderType.Text); DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "cCusName", utxtcCusName.Text); DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "dDate", dtpdDate.Text); DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "OrderDate", dtpOrderDate.Text); DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "DeliveryDate", dtpDeliveryDate.Text); DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "cDepName", utecDepName.Text); //模板赋值 switch (p) { case "print": xtreport.Print(); break; case "design": xtreport.ShowDesigner(); break; case "preview": xtreport.ShowPreview(); break; } }
private void DoStdPrint(bool PrtPreView) { var proces = gcOrder.GetDataSource<V_ERP_PrintOrderPrd>().Where(k => k.Num > 0) .Select(k => new { k.ProceName, k.Guid, k.ProceUser }).ToList(); var odrs = SerNoCaller.Calr_V_ERP_PrintOrderProce.Get(" where printsession=@0", PrintSession); //var proces = SerNoCaller.Calr_V_ERP_PrintOrderProceDetail.Get(" where printsession=@0", PrintSession); var pordrs = odrs.MapTo<List<V_ERP_PrintOrderProce>, List<PrtOrder>>(); var prts = new List<ProcePrtInfo>(); pordrs.ForEach(k => { prts.Add(new ProcePrtInfo() { PrtOrder = k, Detail = proces.Where(j => k.Guid == j.Guid && !j.ProceName.Equals("木工")).Select(j => new T_ERP_OrderProce { ProceName = j.ProceName, ProceUser = j.ProceUser }).ToList() }); var mg = proces.FirstOrDefault(j => k.Guid == j.Guid && j.ProceName.Equals("木工")); if (mg != null) { prts.Add(new ProcePrtInfo() { PrtOrder = k, Detail = new List<T_ERP_OrderProce> { new T_ERP_OrderProce { ProceName = mg.ProceName, ProceUser = mg.ProceUser } } }); } }); var prtsys = new XtraReport(); var rpt = new NewRptSub(prts); rpt.BindData(); rpt.CreateDocument(); prtsys.Pages.AddRange(rpt.Pages); SetPrintToolsVisible(prtsys); prtsys.PrintingSystem.ShowMarginsWarning = false; if (PrtPreView) { prtsys.ShowPreview(); } else { prtsys.Print(); } }
private void gridViewFiles_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { try { tb_Comprobante_Info InfoCbteT = new tb_Comprobante_Info(); string msg = ""; switch (e.Column.Name) { case "colRide": XtraReport Reporte = new XtraReport(); InfoCbteT = (tb_Comprobante_Info)gridViewFiles.GetFocusedRow(); Reporte = Rpt_Ride_Bus.Optener_reporte(InfoCbteT, ref msg); //FAct Imporpoint Reporte.ShowPreview(); break; case "colXml": InfoCbteT = (tb_Comprobante_Info)gridViewFiles.GetFocusedRow(); XmlDocument xmlOrigen = new XmlDocument(); xmlOrigen.Load(new StringReader(InfoCbteT.s_XML)); Stream myStream; SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "xml files (*.xml)|*.xml"; saveFileDialog1.FilterIndex = 2; saveFileDialog1.RestoreDirectory = true; saveFileDialog1.FileName = "SRI_" + InfoCbteT.Nombre_file; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { if ((myStream = saveFileDialog1.OpenFile()) != null) { xmlOrigen.Save(myStream); myStream.Close(); } } break; case "colIconoGuardar": InfoCbteT = (tb_Comprobante_Info)gridViewFiles.GetFocusedRow(); if (BusCbte_exte.GrabarDB(InfoCbteT, ref msg)) { MessageBox.Show("Proceso de exportacion OK...", "efirm", MessageBoxButtons.OK, MessageBoxIcon.Information); listComprobanteRecixSRI.Remove(InfoCbteT); } else { MessageBox.Show("No se pudo procesar el Proceso de exportacion..." + msg, "efirm", MessageBoxButtons.OK, MessageBoxIcon.Error); } break; default: string mensaje = (string)gridViewFiles.GetFocusedRowCellValue(e.Column); if (mensaje != "") { frmMensaje frmsg = new frmMensaje(); frmsg.richTextBoxMensaje.Text = mensaje; frmsg.WindowState = FormWindowState.Maximized; frmsg.ShowDialog(); } break; } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); BusSisLog.Log_Error(ex.Message.ToString(), eTipoError.ERROR, this.ToString()); } }
/// <summary> /// 打印操作 /// </summary> /// <param name="operation"></param> public void PrintDialog(string operation) { //当修改原数据是要进行保存后才能去打印 if (biSave.Enabled == true) { MessageBox.Show("在原数据上进行修改时请先保存后再进行打印!!!"); } var xtreport = new XtraReport(); // _btApp = new BarTender.Application(); //判断当前打印模版路径是否存在 var temPath = _cTempletFileName; //_cTempletFileName; //Application.StartupPath + @"\Label\" + _cTempletFileName; if (!File.Exists(temPath)) { MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); xtreport.ShowDesigner(); return; } xtreport.LoadLayout(temPath); xtreport.PrinterName = _cPrinter; xtreport.PrintingSystem.StartPrint += PrintingSystem_StartPrint; xtreport.RequestParameters = false; xtreport.ShowPrintStatusDialog = false; xtreport.ShowPrintMarginsWarning = false; //模板赋值 DllWorkPrintLabel.SetParametersValue(xtreport, "cSerialNumber", lblTitleMain.lblcSerialNumber.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cBarCode", "R*" + _FitemId + "*L*" + txtcLotNo.Text + "*S*" + lblTitleMain.lblcSerialNumber.Text+";"+dtpcDefine2.Value.ToShortDateString()); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvCode", txtcInvCode.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvName", utecInvName.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "dDate", dtpdDate.Value.ToShortDateString()); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvStd", txtcInvStd.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cFullName", txtcFullName.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cVendor", txtcVendor.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cLotNo", txtcLotNo.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "iQuantity", uneiQuantity.Value); DllWorkPrintLabel.SetParametersValue(xtreport, "cMemo", txtcMemo.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cDefine1", txtcDefine1.Text); if (dtpdDate.Checked) DllWorkPrintLabel.SetParametersValue(xtreport, "cVendorDate", dtpdDate.Value); //模板赋值 switch (operation) { case "print": xtreport.Print(); break; case "design": xtreport.ShowDesigner(); break; case "preview": xtreport.ShowPreview(); break; } }
public void PrintDialog(string operation) { var xtreport = new XtraReport(); // _btApp = new BarTender.Application(); //判断当前打印模版路径是否存在 var _cTempletFileName = Application.StartupPath + @"\Label\班次制令单.repx"; var temPath = _cTempletFileName; //Application.StartupPath + @"\Label\" + _cTempletFileName; if (!File.Exists(temPath)) { MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); xtreport.ShowDesigner(); return; } xtreport.LoadLayout(temPath); xtreport.PrinterName = _cPrinter; xtreport.RequestParameters = false; xtreport.ShowPrintStatusDialog = false; xtreport.ShowPrintMarginsWarning = false; //模板赋值 DllWorkPrintLabel.SetParametersValue(xtreport, "cSerialNumber", lblTitleMain.lblcSerialNumber.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvCode", txtcInvCode.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvName", utecInvName.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvStd", txtcInvStd.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cFullName", txtcFullName.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cOrderNuber", txtcOrderNumber.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "FBatchNo", txtFBatchNo.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "iQuantity", uneiQuantity.Value); DllWorkPrintLabel.SetParametersValue(xtreport, "cDepartment", txtcDept.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "dDate", dtpdDate.Value.ToShortDateString()); DllWorkPrintLabel.SetParametersValue(xtreport, "cMemo", txtcMemo.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "批次", txtcMemo.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "库位", txtcMemo.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "库存", txtcMemo.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "发货数", txtcMemo.Text); //xtreport.DataSource = dataInventory.BomDetail; DataSet ds = new DataSet(); using (var con = new SqlConnection(BaseStructure.WmsCon)) { using (var cmd = new SqlCommand { CommandType = CommandType.StoredProcedure, Connection = con }) { cmd.CommandText = "proc_Bomdetail"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@BomID", bomID); using (SqlDataAdapter dataAdapter = new SqlDataAdapter(cmd)) { dataAdapter.Fill(ds); } cmd.Parameters.Clear(); } } int count = 0; if(!int.TryParse(uneiQuantity.Value.ToString(), out count)) { count = 0; } DataTable dt = null; if (ds != null && ds.Tables[0].Rows.Count > 0) { dt = ds.Tables[0].Clone(); dt.Columns.Add("发货数", typeof(int)); //DataTable dt = ds.Tables[0]; var dtE = ds.Tables[0].AsEnumerable(); foreach (DataRow dr in GetBomDetail()) { var iquantity = Convert.ToDecimal(dr["iQuantity"]) * count; var drs = dtE.Where(w => w.Field<string>("cInvCode") == dr["cInvCode"].ToString()).OrderBy(o => o.Field<string>("批次")).ToList(); //DataRow[] drs = dtE.Select(" cInvCode = '"+dr["cInvCode"].ToString()+"'").OrderBy(""); foreach (DataRow dr1 in drs) { if (iquantity >= 0) { var kc = Convert.ToDecimal(dr1["库存"]); var fhs = kc > iquantity ? iquantity : kc; //假如库存大于发货数,直接当前库位发货,如果小于发货数,当前库位发完当前数,并到下一个库位发剩余数量 iquantity = kc >= iquantity ? -1 : iquantity - kc; DataRow drNew = dt.NewRow(); drNew["AutoID"] = dr1["AutoID"]; drNew["BomID"] = dr1["BomID"]; drNew["cInvCode"] = dr1["cInvCode"]; drNew["cInvName"] = dr1["cInvName"]; drNew["iQuantity"] = dr1["iQuantity"]; drNew["cUnitID"] = dr1["cUnitID"]; drNew["cUnitName"] = dr1["cUnitName"]; drNew["cInvStd"] = dr1["cInvStd"]; drNew["cFullName"] = dr1["cFullName"]; drNew["cMemo"] = dr1["cMemo"]; drNew["dAddTime"] = dr1["dAddTime"]; drNew["cFitemID"] = dr1["cFitemID"]; drNew["批次"] = dr1["批次"]; drNew["库位"] = dr1["库位"]; drNew["库存"] = dr1["库存"]; drNew["发货数"] = fhs; dt.Rows.Add(drNew); } } } } xtreport.DataSource = dt; //模板赋值 switch (operation) { case "print": xtreport.Print(); break; case "design": xtreport.ShowDesigner(); break; case "preview": xtreport.ShowPreview(); break; } }