public frmReportPreview(string name) { InitializeComponent(); internalname = name; printReport = new PrintReport(printDoc); LoadReportProps(); }
private void Btnxuatbaocao_Click(object sender, EventArgs e) { using (PrintReport f = new PrintReport(this)) { f.ShowDialog(); } }
/// <summary> /// 打印报检单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PrintTestReport_Click(object sender, EventArgs e) { PrintReport report = new PrintReport(); report.UserAcount = userInfo.Id.ToString(); ShowForm(report); }
private void btnReportPaid_Click(object sender, EventArgs e) { try { List <TransitionData> arrTD = new List <TransitionData>(); for (int i = 0; i < dataGridView2.Rows.Count; i++) { TransitionData item = new TransitionData(); item.ID = Convert.ToInt16(dataGridView2.Rows[i].Cells[5].Value.ToString()); item.Operation_Type = dataGridView2.Rows[i].Cells[2].Value.ToString(); if (txtClientID.Text == "") { item.Client = dataGridView2.Rows[i].Cells[4].Value.ToString(); item.ClientCode = dataGridView2.Rows[i].Cells[3].Value.ToString(); } item.Paid = Convert.ToDouble(dataGridView2.Rows[i].Cells[7].Value.ToString()); item.Date = dataGridView2.Rows[i].Cells[0].Value.ToString(); item.Returned = Convert.ToDouble(dataGridView2.Rows[i].Cells[6].Value.ToString()); arrTD.Add(item); } PrintReport pr = new PrintReport(arrTD, comClient.Text + " " + txtClientID.Text, 1, Convert.ToDouble(labBeforPaid.Text), Convert.ToDouble(labTotalPaid.Text), Convert.ToDouble(labTotalReturn2.Text), Convert.ToDouble(labRest2.Text) + Convert.ToDouble(labBeforPaid.Text), dateTimeFrom.Text, dateTimeTo.Text); pr.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public async void PrinList() { try { decimal totSaldoReporte = 0; var fechaOperacion = SelectedDate.ToString("dd/MM/yyyy HH:mm:ss"); String dataToPrint = "$big$Cooperativa de Ahorro y Credito$intro$ Indigena SAC Pelileo Ltda.$intro$$intro$"; dataToPrint += "$small$Usuario: " + CodigoUsuario + "$intro$"; dataToPrint += "$small$Fecha: " + fechaOperacion + "$intro$"; foreach (var item in TransacccionCollection.ToList()) { totSaldoReporte += item.Monto; dataToPrint += "$small$" + item.NombreCliente + " " + item.Monto.ToString("N2") + "$intro$"; } dataToPrint += "$intro$Total Operacion: " + totSaldoReporte.ToString("N2"); dataToPrint += "$intro$$intro$$cut$$intro$"; printReport = new PrintReport(); printReport.Print(dataToPrint); } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { PrintReport ReportDoc = new PrintReport(); ReportDoc.Parameters["IdDoc"].Value = Convert.ToInt32(Request.Params["IdDoc"].ToString()); ASPxDocumentViewer1.Report = ReportDoc; }
private void PrintModel(CreditViewModel model) { if (model == null) { MessageBoxWPF.Show("Выберите кредит!", "Сообщение.", MessageBoxButton.OK, MessageBoxImage.Information); return; } PrintReport.PrintCredit(model, repository); }
private void FormingReport(Document doc, PrintReport printReport) { Paste(doc, false); WordReplace(doc, "{HSS}", printReport.HeatingStateStart); WordReplace(doc, "{WSS}", printReport.WerStateStart); WordReplace(doc, "{FH}", printReport.ForHeating); WordReplace(doc, "{FWR}", printReport.ForWer); WordReplace(doc, "{FWT}", printReport.ForWater); WordReplace(doc, "{HP}", printReport.HeatingPayment); WordReplace(doc, "{WRP}", printReport.WerPayment); WordReplace(doc, "{WTP}", printReport.WaterPayment); WordReplace(doc, "{HSE}", printReport.HeatingStateEnd); WordReplace(doc, "{WSE}", printReport.WerStateEnd); WordReplace(doc, "{DT}", printReport.MonthAndYear); }
private void AutoPrintReports(DateTime now) { MemIniFile mif = new MemIniFile(String.Empty); mif.FromString(Properties.Settings.Default.ReportsConfig); // выбор автозапускаемых отчётов на текущее время в список list List <string> list = new List <string>(); foreach (string section in mif.ReadSections()) { bool auto = mif.ReadBool(section, "PrintAuto", false); if (auto) { string name = mif.ReadString(section, "ReportName", section); DateTime time = mif.ReadDate(section, "PrintTime", DateTime.Parse("08:05:00")); int period = mif.ReadInteger(section, "PrintPeriod", 0); if (period == 0) // ежедневно { if (time.Hour == now.Hour && time.Minute == now.Minute) { list.Add(name); } } else if (period == 1) // ежемесячно 1 числа { if (now.Day == 1 && time.Hour == now.Hour && time.Minute == now.Minute) { list.Add(name); } } } } // отправка на печать отчётов, печатаемых в настоящий момент foreach (string name in list) { using (PrintDocument printDoc = new PrintDocument()) { printDoc.PrintPage += printDoc_PrintPage; printReport = new PrintReport(printDoc); printReport.LoadReport(name, Properties.Settings.Default.ReportsConfig); printDoc.Print(); printDoc.PrintPage -= printDoc_PrintPage; } } }
public static void ImportReportsFrom(string path, Action <string> updateMessage) { if (Directory.Exists(path)) { Data.EmptyReports(); string[] files = Directory.GetFiles(path, "*.ini"); foreach (string filename in files) { updateMessage("Импорт отчёта из файла \"" + filename.ToUpper() + "\"..."); using (PrintDocument pd = new PrintDocument()) { PrinterSettings ps = pd.PrinterSettings; string[] lines = System.IO.File.ReadAllLines(filename); PrintReport printReport = new PrintReport(pd); printReport.ImportLines(ref ps, lines); printReport.SaveToBase(); } } } }
public bool AM_Fot13(int iParam) { try { // フッター印刷内容セット PrintReport.SetValue("**フッター情報", 0, "[ 作成 " + CommonFunction.SetDateMask(PFILE.s作成日付, "yyyy/MM/dd") + " " + CommonFunction.SetStrMask(PFILE.s作成時間, "!!:!!:!!") + " " + CommonFunction.NumLPad((Number)SPLiスプール番号, 9, 0) + " ]", false); PrintReport.SetValue("**法人名", 0, PFILE.s法人名称, false); // 改ページ時の罫線処理 PrintReport.SetTLine("B10:Y10", SPLi行位置, PrintReport.LINE.Normal); // 改ページ処理 PrintReport.EndPage(); return(true); } catch { return(false); } }
private void btPrint_Click(object sender, EventArgs e) { var ds = new Dataset.yakkumdbTableAdapters.data_pasienTableAdapter(); ds.ClearBeforeFill = true; ds.Fill(yakkumdb.data_pasien, _noresep); var ds2 = new Dataset.yakkumdbTableAdapters.data_resepTableAdapter(); ds2.ClearBeforeFill = true; ds2.Fill(yakkumdb.data_resep, _noresep); //this.rvResep.LocalReport.DataSources.Clear(); ReportDataSource _rds = new ReportDataSource(); _rds.Name = "dsPasien"; _rds.Value = ds.GetData(_noresep); //this.rvResep.LocalReport.DataSources.Add(_rds); ReportDataSource _rds2 = new ReportDataSource(); _rds2.Name = "dsResep"; _rds2.Value = ds2.GetData(_noresep); //this.rvResep.LocalReport.DataSources.Add(_rds2); //this.rvResep.ZoomMode = ZoomMode.PageWidth; //this.rvResep.RefreshReport(); LocalReport report = new LocalReport(); string path = Path.GetDirectoryName(Application.ExecutablePath); string fullpath = Path.GetDirectoryName(Application.ExecutablePath).Remove(path.Length - 10) + @"\Reports\reportResep.rdlc"; report.ReportPath = fullpath; MessageBox.Show(fullpath); report.DataSources.Add(_rds); report.DataSources.Add(_rds2); PrintReport.PrintToPrinter(report, _numofcopies); }
public static void ExportReportsAs(string path, Action <string> updateMessage, string pathtoconfig) { // pathtoconfig - путь для хранения "reports.ini", с настройками по автозапуску и времени выполнения if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } IDictionary <string, string> reportlist = Data.GetReportsList(); foreach (KeyValuePair <string, string> name in reportlist) { updateMessage("Экспорт отчёта: " + name.Key); using (PrintDocument pd = new PrintDocument()) { PrintReport printReport = new PrintReport(pd); printReport.LoadReport(name.Key, pathtoconfig); string FileName = path + "\\" + name.Key.ToLower() + ".ini"; List <string> lines = printReport.ExportLines(); System.IO.File.WriteAllLines(FileName, lines.ToArray()); } } }
private void printResep() { var ds = new Dataset.yakkumdbTableAdapters.data_pasienTableAdapter(); ds.ClearBeforeFill = true; ds.Fill(yakkumdb.data_pasien, _noresep); var ds2 = new Dataset.yakkumdbTableAdapters.data_resepTableAdapter(); ds2.ClearBeforeFill = true; ds2.Fill(yakkumdb.data_resep, _noresep); var ds3 = new Dataset.rmdbTableAdapters.diagnosa_utamaTableAdapter(); ds3.ClearBeforeFill = true; ds3.Fill(rmdb.diagnosa_utama, _noreg); var ds4 = new Dataset.rmdbTableAdapters.RMIcdSekunderRalanTableAdapter(); ds4.ClearBeforeFill = true; ds4.Fill(rmdb.RMIcdSekunderRalan, _noreg); var ds5 = new Dataset.yakkumdbTableAdapters.fa_rx_tindakanTableAdapter(); ds5.ClearBeforeFill = true; ds5.Fill(yakkumdb.fa_rx_tindakan, _noresep); var ds6 = new Dataset.yakkumdbTableAdapters.fa_rx_prosedurTableAdapter(); ds6.ClearBeforeFill = true; ds6.Fill(yakkumdb.fa_rx_prosedur, _noreg); var ds7 = new Dataset.yakkumdbTableAdapters.fa_rx_resep_hTableAdapter(); ds7.ClearBeforeFill = true; ds7.FillByKdResep(yakkumdb.fa_rx_resep_h, _noresep); //this.rvResep.LocalReport.DataSources.Clear(); ReportDataSource _rds = new ReportDataSource(); _rds.Name = "dsPasien"; _rds.Value = ds.GetData(_noresep); //this.rvResep.LocalReport.DataSources.Add(_rds); ReportDataSource _rds2 = new ReportDataSource(); _rds2.Name = "dsResep"; _rds2.Value = ds2.GetData(_noresep); //this.rvResep.LocalReport.DataSources.Add(_rds2); ReportDataSource _rds3 = new ReportDataSource(); _rds3.Name = "dsDiagnosa"; _rds3.Value = ds3.GetData(_noreg); ReportDataSource _rds4 = new ReportDataSource(); _rds4.Name = "dsDiagSec"; _rds4.Value = ds4.GetData(_noreg); ReportDataSource _rds5 = new ReportDataSource(); _rds5.Name = "dsTindakanPer"; _rds5.Value = ds5.GetData(_noresep); ReportDataSource _rds6 = new ReportDataSource(); _rds6.Name = "dsProcedure"; _rds6.Value = ds6.GetData(_noreg); ReportDataSource _rds7 = new ReportDataSource(); _rds7.Name = "dsResepH"; _rds7.Value = ds6.GetData(_noreg); //this.rvResep.ZoomMode = ZoomMode.PageWidth; //this.rvResep.RefreshReport(); LocalReport report = new LocalReport(); //string path = Path.GetDirectoryName(Application.ExecutablePath); //string fullpath = @"C:\rse.app.resource\Reports\reportResep.rdlc"; //report.ReportPath = fullpath; report.ReportEmbeddedResource = "rse.app.desk.rx.pharmacist.Reports.reportResep.rdlc"; report.DataSources.Add(_rds); report.DataSources.Add(_rds2); report.DataSources.Add(_rds3); report.DataSources.Add(_rds4); report.DataSources.Add(_rds5); report.DataSources.Add(_rds6); report.DataSources.Add(_rds7); for (int q = 1; q <= _numofcopies; q++) { PrintReport.PrintToPrinter(report, _numofcopies); } var _year = DateTime.Now.ToString("yyyy"); var _month = DateTime.Now.ToString("MM"); var _day = DateTime.Now.ToString("dd"); var _datepath = _year + @"\" + _month + @"\" + _day; var _filename = _sep + "_resep.Pdf"; //string _path = @"\\192.168.2.222\Sharing Is Caring\ResepFarmasiSementara\" + _datepath + @"\" + _filename; string _path = @"\\192.168.10.11\Data SEP\Casemix RJ\FARMASI RJ\" + _datepath + @"\" + _filename; Functions.SavePDF.SavedPDF(report, _path); }
public bool AM_Dtl13(int iParam) { try { if (PFILE.s行区分 != "H1") { // ディテール印刷内容セット switch (PFILE.s行区分) { case "B1": if (PFILE.nB1エラーフラグ != 0) { PrintReport.SetValue("**B1エラーフラグ", SPLi行位置, "*", true); } else { PrintReport.SetValue("**B1エラーフラグ", SPLi行位置, string.Empty, true); } PrintReport.SetValue("**B1SKU", SPLi行位置, CommonFunction.SetStrMask(PFILE.sB1SKU, SYSsSKU制御マスク), true); PrintReport.SetValue("**B1品番", SPLi行位置, CommonFunction.SetStrMask(PFILE.sB1品番, SYSs品番制御マスク), true); PrintReport.SetValue("**B1サブ1", SPLi行位置, PFILE.sB1サブ1, true); PrintReport.SetValue("**B1サブ2", SPLi行位置, PFILE.sB1サブ2, true); PrintReport.SetValue("**B1サブ3", SPLi行位置, PFILE.sB1サブ3, true); PrintReport.SetValue("**B1品名1", SPLi行位置, PFILE.sB1品名1, true); PrintReport.SetValue("**B1品名2", SPLi行位置, PFILE.sB1品名2, true); PrintReport.SetValue("**B1実棚数", SPLi行位置, CommonFunction.NumEdit(PFILE.nB1実棚数, SYSi帳票数量小数以下桁数), true); if (PFILE.nH1棚卸方式区分 == 2) { PrintReport.SetValue("**B1入出荷数", SPLi行位置, CommonFunction.NumEdit(PFILE.nB1入出荷数, SYSi帳票数量小数以下桁数), true); } else { PrintReport.SetValue("**B1入出荷数", SPLi行位置, string.Empty, true); } if (SYSi単位入力制御区分 == 0) { PrintReport.SetValue("**B1単位", SPLi行位置, string.Empty, true); } else { PrintReport.SetValue("**B1単位", SPLi行位置, PFILE.sB1単位名, true); } PrintReport.SetValue("**B1売価単価", SPLi行位置, CommonFunction.NumEdit(PFILE.nB1売価単価, SYSi単価小数以下桁数), true); PrintReport.SetValue("**B1作成日付", SPLi行位置, CommonFunction.SetDateMask(PFILE.sB1作成日付, "yyyy/MM/dd"), true); PrintReport.SetValue("**B1作成時間", SPLi行位置, CommonFunction.SetStrMask(PFILE.sB1作成時間, "!!:!!:!!"), true); PrintReport.SetValue("**B1備考", SPLi行位置, PFILE.sB1エラーメッセージ, true); break; case "T0": PrintReport.SetValue("**B1品名1", SPLi行位置, " * * * 実棚担当者計 * * * ", true); PrintReport.SetPosHorz("**B1品名1", SPLi行位置, PrintReport.HOLZ.Center); PrintReport.SetValue("**B1実棚数", SPLi行位置, CommonFunction.NumEdit(PFILE.nB1実棚数, SYSi帳票数量小数以下桁数), true); if (PFILE.nH1棚卸方式区分 == 2) { PrintReport.SetValue("**B1入出荷数", SPLi行位置, CommonFunction.NumEdit(PFILE.nB1入出荷数, SYSi帳票数量小数以下桁数), true); } else { PrintReport.SetValue("**B1入出荷数", SPLi行位置, string.Empty, true); } break; case "T1": PrintReport.SetValue("**B1品名1", SPLi行位置, " * * * ブロック計 * * * ", true); PrintReport.SetPosHorz("**B1品名1", SPLi行位置, PrintReport.HOLZ.Center); PrintReport.SetValue("**B1実棚数", SPLi行位置, CommonFunction.NumEdit(PFILE.nB1実棚数, SYSi帳票数量小数以下桁数), true); if (PFILE.nH1棚卸方式区分 == 2) { PrintReport.SetValue("**B1入出荷数", SPLi行位置, CommonFunction.NumEdit(PFILE.nB1入出荷数, SYSi帳票数量小数以下桁数), true); } else { PrintReport.SetValue("**B1入出荷数", SPLi行位置, string.Empty, true); } break; case "T2": PrintReport.SetValue("**B1品名1", SPLi行位置, " * * * セクション計 * * * ", true); PrintReport.SetPosHorz("**B1品名1", SPLi行位置, PrintReport.HOLZ.Center); PrintReport.SetValue("**B1実棚数", SPLi行位置, CommonFunction.NumEdit(PFILE.nB1実棚数, SYSi帳票数量小数以下桁数), true); if (PFILE.nH1棚卸方式区分 == 2) { PrintReport.SetValue("**B1入出荷数", SPLi行位置, CommonFunction.NumEdit(PFILE.nB1入出荷数, SYSi帳票数量小数以下桁数), true); } else { PrintReport.SetValue("**B1入出荷数", SPLi行位置, string.Empty, true); } break; case "T3": PrintReport.SetValue("**B1品名1", SPLi行位置, " * * * 店舗計 * * * ", true); PrintReport.SetPosHorz("**B1品名1", SPLi行位置, PrintReport.HOLZ.Center); PrintReport.SetValue("**B1実棚数", SPLi行位置, CommonFunction.NumEdit(PFILE.nB1実棚数, SYSi帳票数量小数以下桁数), true); if (PFILE.nH1棚卸方式区分 == 2) { PrintReport.SetValue("**B1入出荷数", SPLi行位置, CommonFunction.NumEdit(PFILE.nB1入出荷数, SYSi帳票数量小数以下桁数), true); } else { PrintReport.SetValue("**B1入出荷数", SPLi行位置, string.Empty, true); } break; } // 罫線 PrintReport.SetLLine("B10,Z10", SPLi行位置, PrintReport.LINE.Normal); PrintReport.SetLLine("C10:W10", SPLi行位置, PrintReport.LINE.Slender); PrintReport.SetBLine("B10:Y10", SPLi行位置, PrintReport.LINE.Slender); // 色制御 if (PFILE.s行区分 == "T0" || PFILE.s行区分 == "T1" || PFILE.s行区分 == "T2" || PFILE.s行区分 == "T3") { PrintReport.SetColor("B10:Y10", SPLi行位置, PrintReport.COLOR.Light); } // 次の行に移動 SPLi行位置++; } return(true); } catch { return(false); } }
private void InitData(int index) { PageSettings ps = Config.GetPageSettings(); MyReportViewer.SetPageSettings(ps); MyReportViewer.LocalReport.ReportPath = Config.TemplateLocation(PrintData.PrintTemplate.FileName); Dictionary <string, object> item = new Dictionary <string, object>(); if (PrintData != null && PrintData.Data.Count > 0) { item = PrintData.Data[index]; } else { XMessageBox.Warning("未加载到数据"); return; } MyReportViewer.LocalReport.DataSources.Clear(); MyReportViewer.LocalReport.DataSources.Add(new ReportDataSource(PrintData.PrintTemplate.DataSetName, item.ToDataTable())); var printParams = PrintData.PrintTemplate.PrintParams; if (printParams.Count > 0) { int j = 0; foreach (var parameter in MyReportViewer.LocalReport.GetParameters()) { var db_param = PrintData.PrintTemplate.PrintParams.Find(p => p.PrintParamName == parameter.Name); string fileName = $"{PrintData.PrintTemplate.PrintTemplateID}_{db_param.Value}{index}{j++}"; switch (db_param.ParamType) { case ParamType.BarCode: //创建条形码文件 fileName += "1D"; string value = CanCreateCode(db_param, item, out bool isCreate); if (isCreate == false) { XMessageBox.Error($"值({value})不能生成条形码"); } PrintReport.CreateBarCode(value, fileName, Config.TempleAddress); break; case ParamType.QRCode: //创建二维码 fileName += "2D"; value = CanCreateCode(db_param, item, out isCreate); if (isCreate == false) { XMessageBox.Error($"值({value})不能生成条形码"); } PrintReport.CreateQRCode(value, fileName, Config.TempleAddress); break; case ParamType.Other: MyReportViewer.LocalReport.SetParameters(new ReportParameter (parameter.Name, Convert.ToString(item[db_param.Value]))); continue; case ParamType.SQL: value = "0"; if (item.ContainsKey(db_param.Value)) { value = Convert.ToString(item[db_param.Value]); } MyReportViewer.LocalReport.SetParameters(new ReportParameter (parameter.Name, value)); continue; } var file = Path.Combine(Config.TempleAddress, fileName + ".bmp"); MyReportViewer.LocalReport.SetParameters(new ReportParameter(parameter.Name, "file://" + file)); } } MyReportViewer.SetDisplayMode(DisplayMode.PrintLayout); MyReportViewer.ZoomMode = ZoomMode.Percent; MyReportViewer.ZoomPercent = 100; }
public void BatchExportReport(int type, string date, string deviceIds = "") { //居民不能批量倒 if (AuthUser.UserTypeId == 4) { return; } var dAndU = DeviceLogic.GetDeviceList(AuthUser.UserTypeId.Value, AuthUser.Id, 1, 10000); if (string.IsNullOrWhiteSpace(deviceIds)) { foreach (var v in dAndU) { deviceIds += v.DeviceId + ","; } deviceIds.TrimEnd(','); } string[] strs = deviceIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); StringBuilder sHtml = new StringBuilder(); //打印表头 sHtml.Append("<table border=\"1\" width=\"90%\">"); sHtml.Append("<tr><td colspan=\"7\" style='font-size:16px;'>时间段:<b>" + date + "</b></td></tr>"); foreach (string str in strs) { int _dId = Convert.ToInt32(str); var _u = dAndU.FirstOrDefault(p => p.DeviceId == _dId); //不在名下不能倒 if (_u == null) { continue; } var _d = DeviceLogic.GetDeviceById(_dId); if (_d == null) { continue; } HealthReportModel _model = getReport(type, date, _d); sHtml.Append("<tr height=\"30\"><td colspan=\"7\" align=\"left\" style='font-size:16px;font-weight:600;'><b>" + (!string.IsNullOrWhiteSpace(_u.UserName) ? _u.UserName : "") + " 设备号:" + _u.Imei + "</b></td></tr>"); sHtml.Append(PrintReport.PrintHealtReport(_model)); } sHtml.Append("</table>"); Response.ContentType = "application/ms-excel"; Response.ContentEncoding = Encoding.UTF8; Response.Charset = "utf-8"; Response.AppendHeader("Content-Disposition", "attachment;filename=" + AuthUser.UserName + " 管辖居民健康报表.xls"); System.IO.StringWriter tw = new System.IO.StringWriter(); // Response.Output.Write(sHtml.ToString()); Response.Write("<meta http-equiv=\"content-type\" content=\"application/ms-excel; charset=utf-8\"/>" + sHtml.ToString()); /*乱码BUG修改 20140505*/ //如果采用以上代码导出时出现内容乱码,可将以下所注释的代码覆盖掉上面【System.Web.HttpContext.Current.Response.Output.Write(ExcelContent.ToString());】即可实现。 //System.Web.HttpContext.Current.Response.Write("<meta http-equiv=\"content-type\" content=\"application/ms-excel; charset=utf-8\"/>" + ExcelContent.ToString()); Response.Flush(); Response.End(); }
private void btnPrint_Click(object sender, EventArgs e) { try { List <customerAccount> arrTD = new List <customerAccount>(); for (int i = 0; i < dataGridView1.Rows.Count; i++) { customerAccount item = new customerAccount(); item.ClientCode = dataGridView1.Rows[i].Cells[0].Value.ToString(); item.CustomerCode = dataGridView1.Rows[i].Cells[1].Value.ToString(); item.Client = dataGridView1.Rows[i].Cells[2].Value.ToString(); item.CustomerName = dataGridView1.Rows[i].Cells[3].Value.ToString(); if (dataGridView1.Rows[i].Cells[4].Value != null) { item.Returned = Convert.ToDouble(dataGridView1.Rows[i].Cells[4].Value.ToString()); } else { item.Returned = 0; } if (dataGridView1.Rows[i].Cells[5].Value != null) { item.Paid = Convert.ToDouble(dataGridView1.Rows[i].Cells[5].Value.ToString()); } else { item.Paid = 0; } if (dataGridView1.Rows[i].Cells[6].Value != null) { item.ReturnedBill = Convert.ToDouble(dataGridView1.Rows[i].Cells[6].Value.ToString()); } else { item.ReturnedBill = 0; } if (dataGridView1.Rows[i].Cells[7].Value != null) { item.Bill = Convert.ToDouble(dataGridView1.Rows[i].Cells[7].Value.ToString()); } else { item.Bill = 0; } arrTD.Add(item); } double TotalBefor = 0, TotalBillCost = 0, TotalPaid = 0, Rest = 0; if (labTotalBefor.Text != "") { TotalBefor = Convert.ToDouble(labTotalBefor.Text); } if (labBills.Text != "") { TotalBillCost = Convert.ToDouble(labBills.Text); } if (labpaid.Text != "") { TotalPaid = Convert.ToDouble(labpaid.Text); } if (labRest.Text != "") { Rest = Convert.ToDouble(labRest.Text); } PrintReport pr = new PrintReport(arrTD, 3, TotalBefor, TotalBillCost, TotalPaid, Rest, dateTimeFrom.Text, dateTimeTo.Text); pr.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 打印 /// </summary> /// <param name="startIndex"></param> /// <returns></returns> private string Print(int startIndex = 0) { try { if (PrintData != null && PrintData.Data.Count > 0) { var item = PrintData.Data[startIndex]; m_currentPageIndex = 0; m_streams = null; reportViewer1.LocalReport.DataSources.Clear(); reportViewer1.LocalReport.DataSources.Add(new ReportDataSource(PrintData.PrintTemplate.DataSetName, item.ToDataTable())); var printParams = PrintData.PrintTemplate.PrintParams; if (printParams.Count > 0) { int j = 0; foreach (var parameter in reportViewer1.LocalReport.GetParameters()) { var db_param = PrintData.PrintTemplate.PrintParams.Find(p => p.PrintParamName == parameter.Name); string fileName = $"{PrintData.PrintTemplate.PrintTemplateID}_{db_param.Value}{startIndex}{j++}"; switch (db_param.ParamType) { case ParamType.BarCode: //创建条形码文件 fileName += "1D"; string value = CanCreateCode(db_param, item, out bool isCreate); if (isCreate == false) { return($"值({value})不能生成条形码"); } PrintReport.CreateBarCode(value, fileName, Config.TempleAddress); break; case ParamType.QRCode: //创建二维码 fileName += "2D"; value = CanCreateCode(db_param, item, out isCreate); if (isCreate == false) { return($"值({value})不能生成条形码"); } PrintReport.CreateQRCode(value, fileName, Config.TempleAddress); break; case ParamType.Other: reportViewer1.LocalReport.SetParameters(new ReportParameter (parameter.Name, Convert.ToString(item[db_param.Value]))); continue; case ParamType.SQL: value = "0"; if (item.ContainsKey(db_param.Value)) { value = Convert.ToString(item[db_param.Value]); } reportViewer1.LocalReport.SetParameters(new ReportParameter (parameter.Name, value)); continue; } var file = Path.Combine(Config.TempleAddress, fileName + ".bmp"); reportViewer1.LocalReport.SetParameters(new ReportParameter(parameter.Name, "file://" + file)); } reportViewer1.SetDisplayMode(DisplayMode.PrintLayout); reportViewer1.ZoomMode = ZoomMode.Percent; reportViewer1.ZoomPercent = 100; } } else { return("未找到需要打印的数据,请检查SQL或是条件或是著录信息"); } return("已打印"); } catch (Exception ex) { return(ex.Message); } }
public int LoadPrintProccess() { // システム値の取得 SYSi単位入力制御区分 = Convert.ToInt16(CommonFunction.GetSysValue(SYSsCorporation, "単位入力制御区分")); SYSi単価小数以下桁数 = Convert.ToInt16(CommonFunction.GetSysValue(SYSsCorporation, "単価小数以下桁数")); SYSi帳票数量小数以下桁数 = 0; SYSsサブ1名称 = CommonFunction.GetSysValue(SYSsCorporation, "サブ1名称"); SYSsサブ2名称 = CommonFunction.GetSysValue(SYSsCorporation, "サブ2名称"); SYSsサブ3名称 = CommonFunction.GetSysValue(SYSsCorporation, "サブ3名称"); SYSs品名1名称 = CommonFunction.GetSysValue(SYSsCorporation, "品名1名称"); SYSs品名2名称 = CommonFunction.GetSysValue(SYSsCorporation, "品名2名称"); SYSs品番制御マスク = CommonFunction.GetSysValue(SYSsCorporation, "品番制御マスク"); SYSs品番名称 = CommonFunction.GetSysValue(SYSsCorporation, "品番名称"); SYSs小売単価名称 = CommonFunction.GetSysValue(SYSsCorporation, "小売単価名称"); SYSsSKU制御マスク = CommonFunction.GetSysValue(SYSsCorporation, "SKU制御マスク"); SYSsSKU名称 = CommonFunction.GetSysValue(SYSsCorporation, "SKU名称"); // フェッチコマンド定義 #region sSQL string sSQL = "SELECT /*+ INDEX (A FC300I01) */ " + " A.法人名称, A.作成日付, A.作成時間, " + " A.ページ, A.行区分, A.設定数量小数以下桁数, " + " A.H1棚卸日付, A.H1店舗セクション, A.H1店舗セク名, " + " A.H1店舗取引先, A.H1店舗取引先店, A.H1店舗取引先名, " + " A.H1ブロック番号, A.H1実棚担当者, A.H1実棚担当者名, " + " A.H1処理日付, A.H1出力区分, A.H1棚卸方式区分, " + " A.B1エラーフラグ, A.B1SKU, A.B1品番, " + " A.B1サブ1, A.B1サブ2, A.B1サブ3, " + " A.B1品名1, A.B1品名2, A.B1実棚数, " + " A.B1入出荷数, A.B1単位名, A.B1売価単価, " + " A.B1作成日付, A.B1作成時間, A.B1エラーメッセージ " + " FROM FC300P A " + " WHERE A.法人 = '" + SYSsCorporation + "'" + " AND A.スプール番号 = " + SPLiスプール番号.ToString() + " AND A.ページ BETWEEN " + REPi開始頁.ToString() + " AND " + REPi終了頁.ToString() + " ORDER BY ページ, 行番号 "; #endregion // データリーダー作成 DataTable dt = PrintReport.GetDataTable(sSQL); // フェッチ処理 #region for (int j = 0; dt.Rows.Count > j; j++) for (int j = 0; dt.Rows.Count > j; j++) { PFILE.s法人名称 = dt.Rows[j][0].ToString(); PFILE.s作成日付 = dt.Rows[j][1].ToString(); PFILE.s作成時間 = dt.Rows[j][2].ToString(); REPiページ = Convert.ToInt32(dt.Rows[j][3].ToString()); PFILE.s行区分 = dt.Rows[j][4].ToString(); PFILE.sH1棚卸日付 = dt.Rows[j][6].ToString(); PFILE.sH1店舗セクション = dt.Rows[j][7].ToString(); PFILE.sH1店舗セク名 = dt.Rows[j][8].ToString(); PFILE.sH1店舗取引先 = dt.Rows[j][9].ToString(); PFILE.sH1店舗取引先店 = dt.Rows[j][10].ToString(); PFILE.sH1店舗取引先名 = dt.Rows[j][11].ToString(); PFILE.sH1ブロック番号 = dt.Rows[j][12].ToString(); PFILE.sH1実棚担当者 = dt.Rows[j][13].ToString(); PFILE.sH1実棚担当者名 = dt.Rows[j][14].ToString(); PFILE.sH1処理日付 = dt.Rows[j][15].ToString(); PFILE.nH1出力区分 = (Number)(dt.Rows[j][16].ToString()); PFILE.nH1棚卸方式区分 = (Number)(dt.Rows[j][17].ToString()); PFILE.nB1エラーフラグ = (Number)(dt.Rows[j][18].ToString()); PFILE.sB1SKU = dt.Rows[j][19].ToString(); PFILE.sB1品番 = dt.Rows[j][20].ToString(); PFILE.sB1サブ1 = dt.Rows[j][21].ToString(); PFILE.sB1サブ2 = dt.Rows[j][22].ToString(); PFILE.sB1サブ3 = dt.Rows[j][23].ToString(); PFILE.sB1品名1 = dt.Rows[j][24].ToString(); PFILE.sB1品名2 = dt.Rows[j][25].ToString(); PFILE.nB1実棚数 = (Number)(dt.Rows[j][26].ToString()); PFILE.nB1入出荷数 = (Number)(dt.Rows[j][27].ToString()); PFILE.sB1単位名 = dt.Rows[j][28].ToString(); PFILE.nB1売価単価 = (Number)(dt.Rows[j][29].ToString()); PFILE.sB1作成日付 = dt.Rows[j][30].ToString(); PFILE.sB1作成時間 = dt.Rows[j][31].ToString(); PFILE.sB1エラーメッセージ = dt.Rows[j][32].ToString(); // 初回・改頁処理 if (REPiページ != SPLiページ) { // 初回処理 if (SPLiページ == 0) { SYSi帳票数量小数以下桁数 = Convert.ToInt16(dt.Rows[j][5].ToString()); // ファイルオープン if (PrintReport.OpenXls("NFC300L.XLSX") != true) { return(32760); } // 初回ヘッダー内容セット if (AM_Hed13(0) == false) { return(32770); } } // 改頁処理 else { // フッター内容セット if (AM_Fot13(0) == false) { return(32772); } // ヘッダー内容セット if (AM_Hed13(0) == false) { return(32770); } } } // 明細処理 if (AM_Dtl13(0) == false) { return(32771); } } dt.Dispose(); #endregion // 最終フッター内容セット if (AM_Fot13(0) == false) { return(32772); } // PDF作成 PrintReport.OutputPDF(sファイル名, "店舗棚卸チェックリスト"); return(0); }
public bool AM_Hed13(int iParam) { SPLiページ = REPiページ; SPLi行位置 = 0; try { // 帳票出力処理 PrintReport.BeginPage("NFC300L"); // ヘッダー印刷内容セット PrintReport.SetValue("**帳票名", 0, CommonFunction.SetTitle("店舗棚卸チェックリスト", string.Empty, 40), false); PrintReport.SetValue("**ページ", 0, REPiページ.ToString(), false); PrintReport.SetValue("**H1棚卸日付", 0, CommonFunction.SetDateMask(PFILE.sH1棚卸日付, "yyyy/MM/dd"), false); PrintReport.SetValue("**店舗セクション", 0, "店舗セクション", false); PrintReport.SetValue("**H1店舗セクション", 0, PFILE.sH1店舗セクション, false); PrintReport.SetValue("**H1店舗セクション名", 0, PFILE.sH1店舗セク名, false); PrintReport.SetValue("**H1店舗取引先", 0, PFILE.sH1店舗取引先, false); PrintReport.SetValue("**H1店舗取引先店", 0, PFILE.sH1店舗取引先店, false); PrintReport.SetValue("**H1店舗取引先名", 0, PFILE.sH1店舗取引先名, false); PrintReport.SetValue("**H1棚卸ブロック", 0, PFILE.sH1ブロック番号, false); PrintReport.SetValue("**H1担当者", 0, PFILE.sH1実棚担当者, false); PrintReport.SetValue("**H1担当者名", 0, PFILE.sH1実棚担当者名, false); if (PFILE.nH1棚卸方式区分 != 1) { PrintReport.SetValue("**H1処理日付", 0, CommonFunction.SetDateMask(PFILE.sH1処理日付, "yyyy/MM/dd"), false); } else { PrintReport.SetValue("**H1処理日付", 0, string.Empty, false); } if (PFILE.nH1出力区分 == 0) { PrintReport.SetValue("**H1出力区分", 0, "( 出力区分:全て )", false); } else { PrintReport.SetValue("**H1出力区分", 0, "( 出力区分:エラーのみ )", false); } if (PFILE.nH1棚卸方式区分 == 2) { PrintReport.SetValue("**コメント", 0, "( 入出荷数:棚卸日付から処理日付までの入出荷数 )", false); } else { PrintReport.SetValue("**コメント", 0, string.Empty, false); } PrintReport.SetValue("**品番名称", 0, SYSs品番名称, false); PrintReport.SetValue("**サブ1名称", 0, SYSsサブ1名称, false); PrintReport.SetValue("**サブ2名称", 0, SYSsサブ2名称, false); PrintReport.SetValue("**サブ3名称", 0, SYSsサブ3名称, false); PrintReport.SetValue("**品名1名称", 0, SYSs品名1名称, false); PrintReport.SetValue("**品名2名称", 0, SYSs品名2名称, false); if (SYSi単位入力制御区分 == 0) { PrintReport.SetValue("**単位", 0, string.Empty, false); } else { PrintReport.SetValue("**単位", 0, "単位", false); } PrintReport.SetValue("**SKU名称", 0, SYSsSKU名称, false); PrintReport.SetValue("**売価単価", 0, SYSs小売単価名称, false); return(true); } catch { return(false); } }
public PrintResult Send(PrintReportData data, PrintConfigData configData) { return(PrintReport.Send(data, configData)); }