10.06.2017 13:41
АндрейСупермаг
 
Добрый день.
Люди добрые залейте пожалуйста в хранилище файл RepExample_ReadMe.doc. Пытаюсь написать простенький отчет на fastreport и не могу понять как передать данные из диалога отчета в запрос.
Пример как указать что в " AND CMSCGROUP.ID = '1153' "+ должны попадать данные из формы отчета (по выбранной группе товара) . Я так понимаю в RepExample_ReadMe.doc это расписано?

Или может кто в двух словах опишет на примере :

<?xml version="1.0" encoding="utf-8"?>
<ScriptText>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing;
using System.Data;
using FastReport;
using FastReport.Data;
using FastReport.Dialog;
using FastReport.Table;
using FastReport.Utils;
using FastReport.Format;

using Sm.FastReports;
using Sm.FastReports.Link;
using Sm.Interfaces;
using Sm.Objects;
using Sm.Core;

namespace FastReport
{
public class ReportScript
{
RepHost host;

// название отчета
private string sRepName = &quot;Какой то отчет&quot;;
// подзаголовок отчета: места хранения
private string sLocName;
// подзаголовок отчета: группы товаров
private string sGroupName;


private void _StartReport(object sender, EventArgs e)
{
// Хост отчёта даёт доступ к полезным сервисам
host = new RepHost(Report);
// Стартуем транзакцию
RepTransaction transaction = new RepTransaction(host.Connection);

// код выбранного в диалоге МХ???
string sOfficeID = SqlFormat(&quot;{0:N}&quot;, ToInt32(Report.GetParameterValue(&quot;P_STORED_ALL&quot;)));

// данные отчета
string sSQL =
SqlFormat(&quot;SELECT&quot;+
&quot; crd.ARTICLE&quot;+
&quot;, crd.NAME&quot;+
&quot;, smloc.NAME NameLoc&quot;+
&quot;, CQsms.DOCID&quot;+
&quot; FROM &quot;+
&quot; supermag.SMSpecCQ CQsms&quot;+
&quot;, supermag.SMDOCUMENTS DOCsms&quot;+
&quot;, supermag.smstorelocations smloc&quot;+
&quot;, supermag.SVCardName crd&quot;+
&quot;, supermag.SACARDCLASS CmsCGroup&quot;+
&quot; where crd.IDclass = CmsCGroup.ID&quot;+
( 2 != ToInt32(Report.GetParameterValue(&quot;P_STORED_ALL&quot;))
? &quot; and SMLOC.ID=&quot;+sOfficeID : &quot; &quot;
)+
&quot; and CmsCGroup.ID = '1123' &quot;+
&quot; and DOCsms.LOCATION = SMLOC.ID&quot;+
&quot; and DOCsms.id = CQsms.DOCID&quot;+
&quot; and CQsms.ARTICLE =crd.ARTICLE&quot;

);
host.TableDataSourcePreInit(&quot;RepData&quot;, sSQL);
}
}
}
</ScriptText>
<Dictionary>
<SupermagFastReportConnection Name="Connection" LoginPrompt="true">
<TableDataSource Name="Table2" Alias="RepData" DataType="System.Int32" Enabled="true" SelectCommand="SELECT
'' ARTICLE
,'' NAME
,0 NameLoc
,0 DOCID
">
<Column Name="ARTICLE" DataType="System.String"/>
<Column Name="NAME" DataType="System.String"/>
<Column Name="NameLoc" DataType="System.String"/>
<Column Name="DOCID" DataType="System.String"/>
</TableDataSource>
</SupermagFastReportConnection>
<Relation Name="DocSpec_DocSpecScale" ParentDataSource="Table2" ChildDataSource="null" ParentColumns="SPECITEM" ChildColumns="SPECITEM" Enabled="true"/>
<Parameter Name="P_ARTICLE" DataType="System.String"/>
<Parameter Name="P_NAME" DataType="System.String"/>
<Parameter Name="P_NameLoc" DataType="System.String"/>
<Parameter Name="P_DOCID" DataType="System.String"/>
<Parameter Name="P_STORED_ALL" DataType="System.Int32"/>
<Parameter Name="P_STORED_NAME" DataType="System.String"/>
<Parameter Name="P_PARTNER" DataType="System.Int32"/>
</Dictionary>
<ReportPage Name="Page1" RawPaperSize="9" FirstPageSource="15" OtherPagesSource="15" Fill.Color="White" TitleBeforeHeader="false">
<PageHeaderBand Name="PageHeader" Width="718.2" Height="15.12" CanGrow="true">
<TextObject Name="txtPrintDate" Left="321.3" Width="189" Height="15.12" Text="Соглашения" Padding="0, 0, 2, 0" Font="Arial, 8pt"/>
<ChildBand Name="BandFormTitle" Top="18.15" Width="718.2" Height="26.46" CanGrow="true" CanShrink="true" PrintOn="LastPage, OddPages, EvenPages, RepeatedBand">
<TextObject Name="txtPage" Width="94.5" Height="15.12" CanBreak="false" Text="Лист из " WordWrap="false" Font="Arial, 8pt"/>
</ChildBand>
</PageHeaderBand>
<ReportTitleBand Name="ReportTitle" Top="47.64" Width="718.2" Height="68.04" CanGrow="true">
<TextObject Name="Text83" Top="30.24" Width="714.42" Height="37.8" CanGrow="true" CanBreak="false" Text="TITLE1" Padding="2, 2, 2, 0" HorzAlign="Center" VertAlign="Bottom"/>
<TextObject Name="Text96" Top="3.78" Width="714.42" Height="26.46" CanBreak="false" Text="TITLE2" Padding="2, 2, 2, 0" HorzAlign="Center" Font="Arial, 12pt, style=Bold"/>

</ReportTitleBand>
<ColumnHeaderBand Name="ColumnHeader1" Top="118.71" Width="718.2" Height="45.36">
<TableObject Name="TableHeaderSpec" Width="714.42" Height="45.36" Border.Lines="All" Border.Width="0.3" GrowToBottom="true">
<TableColumn Name="ColumnHeadArticle" Width="100.06"/>
<TableColumn Name="Column2" Width="355.16"/>
<TableColumn Name="Column1" Width="100.6"/>
<TableColumn Name="Column3" Width="175.6"/>
<TableRow Name="RowHeaderSpec1" Height="22.68">
<TableCell Name="CellHeadArticle" Border.Lines="Right, Bottom" Border.Width="0.3" Text="Артикул" HorzAlign="Center" VertAlign="Center" Font="Arial, 8pt, style=Bold" RowSpan="2"/>
<TableCell Name="Cell7" Border.Lines="Right" Border.Width="0.3" Text="Наименование товара" HorzAlign="Center" VertAlign="Center" Font="Arial, 8pt, style=Bold" RowSpan="2"/>
<TableCell Name="Cell6" Border.Lines="Right" Border.Width="0.3" Text="Номер соглашения" HorzAlign="Center" VertAlign="Center" Font="Arial, 8pt, style=Bold" RowSpan="2"/>
<TableCell Name="Cell6" Border.Lines="Right" Border.Width="0.3" Text="Место хранения" HorzAlign="Center" VertAlign="Center" Font="Arial, 8pt, style=Bold" RowSpan="2"/>
</TableRow>
<TableRow Name="Row1" Height="22.68">
<TableCell Name="Cell8" HorzAlign="Center" VertAlign="Center" Font="Arial, 8pt, style=Bold"/>
<TableCell Name="Cell10" Border.Lines="Right" Border.Width="0.3" HorzAlign="Center" VertAlign="Center" Font="Arial, 8pt, style=Bold"/>
<TableCell Name="Cell11" Border.Lines="Right" Border.Width="0.3" Text="мин." HorzAlign="Center" VertAlign="Center" Font="Arial, 8pt, style=Bold"/>
<TableCell Name="Cell12" Text="макс." HorzAlign="Center" VertAlign="Center" Font="Arial, 8pt, style=Bold"/>
</TableRow>
</TableObject>
</ColumnHeaderBand>
<DataBand Name="DataSpec" Top="167.1" Width="718.2" Height="18.9" CanGrow="true" DataSource="Table2" PrintIfDetailEmpty="true" PrintIfDatasourceEmpty="true">
<TextObject Name="txtArticle" VertAlign="Left" Width="90.12" Height="15.12" CanGrow="true" CanBreak="false" Text="[RepData.ARTICLE]" HorzAlign="Left" Font="Arial, 8pt"/>
<TextObject Name="txtNAME" Left="100.13" Width="350.3" Height="15.12" CanGrow="true" CanBreak="false" Text="[RepData.NAME]" Font="Arial, 8pt"/>
<TextObject Name="txtDOCID" Left="456.3" Width="100.3" Height="15.12" CanGrow="true" CanBreak="false" Text="[RepData.DOCID]" Font="Arial, 8pt"/>
<TextObject Name="txtNameLoc" Left="557.3" Width="170.3" Height="15.12" CanGrow="true" CanBreak="false" Text="[RepData.NameLoc]" Font="Arial, 8pt"/>
</DataBand>
</ReportPage>
</Report>
Часовой пояс GMT +3, время: 23:07.

Форум на базе vBulletin®
Copyright © Jelsoft Enterprises Ltd.
В случае заимствования информации гипертекстовая индексируемая ссылка на Форум обязательна.