root/trunk/RaportySQL/SredniaCenaModulow.rdl @ 575

Wersja 575, 19.6 KB (wprowadzona przez marek, 17 years temu)

re #152

Line 
1<?xml version="1.0" encoding="utf-8"?>
2<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
3  <DataSources>
4    <DataSource Name="BAZA_REKLAM">
5      <rd:DataSourceID>7a3117ba-2e48-4045-91d5-12c8618a9930</rd:DataSourceID>
6      <DataSourceReference>BAZA_REKLAM</DataSourceReference>
7    </DataSource>
8  </DataSources>
9  <InteractiveHeight>11in</InteractiveHeight>
10  <ReportParameters>
11    <ReportParameter Name="year">
12      <DataType>String</DataType>
13      <DefaultValue>
14        <Values>
15          <Value>=Year(Today)</Value>
16        </Values>
17      </DefaultValue>
18      <AllowBlank>true</AllowBlank>
19      <Prompt>Rok:</Prompt>
20      <ValidValues>
21        <DataSetReference>
22          <DataSetName>ListaLat</DataSetName>
23          <ValueField>rok</ValueField>
24          <LabelField>rok</LabelField>
25        </DataSetReference>
26      </ValidValues>
27    </ReportParameter>
28    <ReportParameter Name="month">
29      <DataType>String</DataType>
30      <DefaultValue>
31        <Values>
32          <Value>=Month(Today)</Value>
33        </Values>
34      </DefaultValue>
35      <Prompt>Miesiąc:</Prompt>
36      <ValidValues>
37        <ParameterValues>
38          <ParameterValue>
39            <Value>1</Value>
40          </ParameterValue>
41          <ParameterValue>
42            <Value>2</Value>
43          </ParameterValue>
44          <ParameterValue>
45            <Value>3</Value>
46          </ParameterValue>
47          <ParameterValue>
48            <Value>4</Value>
49          </ParameterValue>
50          <ParameterValue>
51            <Value>5</Value>
52          </ParameterValue>
53          <ParameterValue>
54            <Value>6</Value>
55          </ParameterValue>
56          <ParameterValue>
57            <Value>7</Value>
58          </ParameterValue>
59          <ParameterValue>
60            <Value>8</Value>
61          </ParameterValue>
62          <ParameterValue>
63            <Value>9</Value>
64          </ParameterValue>
65          <ParameterValue>
66            <Value>10</Value>
67          </ParameterValue>
68          <ParameterValue>
69            <Value>11</Value>
70          </ParameterValue>
71          <ParameterValue>
72            <Value>12</Value>
73          </ParameterValue>
74        </ParameterValues>
75      </ValidValues>
76      <MultiValue>true</MultiValue>
77    </ReportParameter>
78    <ReportParameter Name="title">
79      <DataType>String</DataType>
80      <DefaultValue>
81        <Values>
82          <Value>AMT</Value>
83          <Value>GS</Value>
84          <Value>adMot</Value>
85        </Values>
86      </DefaultValue>
87      <Prompt>Tytuł:</Prompt>
88      <ValidValues>
89        <ParameterValues>
90          <ParameterValue>
91            <Value>AMT</Value>
92          </ParameterValue>
93          <ParameterValue>
94            <Value>GS</Value>
95          </ParameterValue>
96          <ParameterValue>
97            <Value>adMot</Value>
98          </ParameterValue>
99        </ParameterValues>
100      </ValidValues>
101      <MultiValue>true</MultiValue>
102    </ReportParameter>
103  </ReportParameters>
104  <rd:DrawGrid>true</rd:DrawGrid>
105  <InteractiveWidth>8.5in</InteractiveWidth>
106  <rd:GridSpacing>0.25cm</rd:GridSpacing>
107  <rd:SnapToGrid>true</rd:SnapToGrid>
108  <RightMargin>2.5cm</RightMargin>
109  <LeftMargin>2.5cm</LeftMargin>
110  <BottomMargin>2.5cm</BottomMargin>
111  <rd:ReportID>cddaaabe-22d1-4745-812e-083e6fb21360</rd:ReportID>
112  <PageWidth>21cm</PageWidth>
113  <DataSets>
114    <DataSet Name="Moduly">
115      <Fields>
116        <Field Name="Agent">
117          <DataField>Agent</DataField>
118          <rd:TypeName>System.String</rd:TypeName>
119        </Field>
120        <Field Name="Modul">
121          <DataField>Modul</DataField>
122          <rd:TypeName>System.String</rd:TypeName>
123        </Field>
124        <Field Name="Sprzedano">
125          <DataField>Sprzedano</DataField>
126          <rd:TypeName>System.Decimal</rd:TypeName>
127        </Field>
128        <Field Name="Cennik">
129          <DataField>Cennik</DataField>
130          <rd:TypeName>System.Decimal</rd:TypeName>
131        </Field>
132      </Fields>
133      <Query>
134        <DataSourceName>BAZA_REKLAM</DataSourceName>
135        <CommandText>SELECT
136LOWER(A.Symbol) AS Agent,
137M.Mod_Typ AS Modul,
138CAST(SUM(((R.[Cena Jedn] - R.[Rabat Wartość]) * R.[Krotność]) / (R.Szer * R.Wys * R.[Krotność]))/Count(R.ReklamaId) AS DECIMAL(9,2)) AS Sprzedano,
139CAST(SUM(M.Cena)/Count(R.ReklamaId) AS DECIMAL(9,2)) AS Cennik
140FROM [ukaże się w nr] U
141INNER JOIN Reklama R ON R.ReklamaID = U.ReklamaID
142INNER JOIN [Nazwy Modułów] M ON M.Mod_Typ=R.Mod_Typ
143INNER JOIN [Nr] N ON N.TYT=R.[TYTUŁ] AND N.NRW=U.[Nr Wydania]
144INNER JOIN Faktury F ON F.ID_Faktury = U.idFaktury
145INNER JOIN Agenci A ON F.Numer_Roz=A.F_Roz
146WHERE R.[TYTUŁ] IN (@title)
147AND R.Typ='PŁATNA'
148AND YEAR(F.[DATA_SPRZEDAZY])=@year
149AND MONTH(F.[DATA_SPRZEDAZY]) IN (@month)
150AND U.idFaktury IS NOT NULL
151GROUP BY A.Symbol, M.Mod_Typ
152ORDER BY A.Symbol, M.Mod_Typ</CommandText>
153        <QueryParameters>
154          <QueryParameter Name="@title">
155            <Value>=Parameters!title.Value</Value>
156          </QueryParameter>
157          <QueryParameter Name="@year">
158            <Value>=Parameters!year.Value</Value>
159          </QueryParameter>
160          <QueryParameter Name="@month">
161            <Value>=Parameters!month.Value</Value>
162          </QueryParameter>
163        </QueryParameters>
164        <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
165      </Query>
166    </DataSet>
167    <DataSet Name="ListaLat">
168      <Fields>
169        <Field Name="rok">
170          <DataField>rok</DataField>
171          <rd:TypeName>System.Int32</rd:TypeName>
172        </Field>
173      </Fields>
174      <Query>
175        <DataSourceName>BAZA_REKLAM</DataSourceName>
176        <CommandText>select distinct year(DATA_W) as rok from dbo.NR where DATA_W is not null AND year(DATA_W)&gt;2008 order by year(DATA_W) desc</CommandText>
177        <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
178      </Query>
179    </DataSet>
180  </DataSets>
181  <Code>Public Function GetMonths(P as Parameter) as String
182  Dim i As Integer
183  Dim s As String
184  s = p.value(0)               
185  For i = 1 to Ubound(P.Value)
186    s = s &amp; ", " &amp; p.Value(i) 
187  Next i
188  Return s
189End Function</Code>
190  <Width>13.45cm</Width>
191  <Body>
192    <ColumnSpacing>1cm</ColumnSpacing>
193    <ReportItems>
194      <Textbox Name="textbox8">
195        <Top>0.75cm</Top>
196        <Width>13.25cm</Width>
197        <Style>
198          <FontSize>12pt</FontSize>
199          <FontWeight>700</FontWeight>
200          <TextAlign>Center</TextAlign>
201          <PaddingLeft>2pt</PaddingLeft>
202          <PaddingRight>2pt</PaddingRight>
203          <PaddingTop>2pt</PaddingTop>
204          <PaddingBottom>2pt</PaddingBottom>
205        </Style>
206        <ZIndex>2</ZIndex>
207        <CanGrow>true</CanGrow>
208        <Height>0.75cm</Height>
209        <Value>="Tytuł(y): " + Code.GetMonths(Parameters!title)</Value>
210      </Textbox>
211      <Textbox Name="textbox1">
212        <rd:DefaultName>textbox1</rd:DefaultName>
213        <Width>13.25cm</Width>
214        <Style>
215          <FontSize>12pt</FontSize>
216          <FontWeight>700</FontWeight>
217          <TextAlign>Center</TextAlign>
218          <PaddingLeft>2pt</PaddingLeft>
219          <PaddingRight>2pt</PaddingRight>
220          <PaddingTop>2pt</PaddingTop>
221          <PaddingBottom>2pt</PaddingBottom>
222        </Style>
223        <ZIndex>1</ZIndex>
224        <CanGrow>true</CanGrow>
225        <Height>0.75cm</Height>
226        <Value>="Średnia cena modułów sprzedanych w " + CStr(Parameters!year.Value) + " - " + Code.GetMonths(Parameters!month)</Value>
227      </Textbox>
228      <Table Name="table1">
229        <DataSetName>Moduly</DataSetName>
230        <Top>1.75cm</Top>
231        <Details>
232          <TableRows>
233            <TableRow>
234              <TableCells>
235                <TableCell>
236                  <ReportItems>
237                    <Textbox Name="Agent">
238                      <rd:DefaultName>Agent</rd:DefaultName>
239                      <Style>
240                        <BorderColor>
241                          <Default>LightGrey</Default>
242                        </BorderColor>
243                        <BorderStyle>
244                          <Default>Solid</Default>
245                        </BorderStyle>
246                        <TextAlign>Center</TextAlign>
247                        <PaddingLeft>2pt</PaddingLeft>
248                        <PaddingRight>2pt</PaddingRight>
249                        <PaddingTop>2pt</PaddingTop>
250                        <PaddingBottom>2pt</PaddingBottom>
251                      </Style>
252                      <ZIndex>4</ZIndex>
253                      <CanGrow>true</CanGrow>
254                      <Value>=Fields!Agent.Value</Value>
255                    </Textbox>
256                  </ReportItems>
257                </TableCell>
258                <TableCell>
259                  <ReportItems>
260                    <Textbox Name="Modul">
261                      <rd:DefaultName>Modul</rd:DefaultName>
262                      <Style>
263                        <BorderColor>
264                          <Default>LightGrey</Default>
265                        </BorderColor>
266                        <BorderStyle>
267                          <Default>Solid</Default>
268                        </BorderStyle>
269                        <TextAlign>Center</TextAlign>
270                        <PaddingLeft>2pt</PaddingLeft>
271                        <PaddingRight>2pt</PaddingRight>
272                        <PaddingTop>2pt</PaddingTop>
273                        <PaddingBottom>2pt</PaddingBottom>
274                      </Style>
275                      <ZIndex>3</ZIndex>
276                      <CanGrow>true</CanGrow>
277                      <Value>=Fields!Modul.Value</Value>
278                    </Textbox>
279                  </ReportItems>
280                </TableCell>
281                <TableCell>
282                  <ReportItems>
283                    <Textbox Name="Sprzedano">
284                      <rd:DefaultName>Sprzedano</rd:DefaultName>
285                      <Style>
286                        <BorderColor>
287                          <Default>LightGrey</Default>
288                        </BorderColor>
289                        <BorderStyle>
290                          <Default>Solid</Default>
291                        </BorderStyle>
292                        <Format>C</Format>
293                        <TextAlign>Center</TextAlign>
294                        <PaddingLeft>2pt</PaddingLeft>
295                        <PaddingRight>2pt</PaddingRight>
296                        <PaddingTop>2pt</PaddingTop>
297                        <PaddingBottom>2pt</PaddingBottom>
298                      </Style>
299                      <ZIndex>2</ZIndex>
300                      <CanGrow>true</CanGrow>
301                      <Value>=Fields!Sprzedano.Value</Value>
302                    </Textbox>
303                  </ReportItems>
304                </TableCell>
305                <TableCell>
306                  <ReportItems>
307                    <Textbox Name="Cennik">
308                      <rd:DefaultName>Cennik</rd:DefaultName>
309                      <Style>
310                        <BorderColor>
311                          <Default>LightGrey</Default>
312                        </BorderColor>
313                        <BorderStyle>
314                          <Default>Solid</Default>
315                        </BorderStyle>
316                        <Format>C</Format>
317                        <TextAlign>Center</TextAlign>
318                        <PaddingLeft>2pt</PaddingLeft>
319                        <PaddingRight>2pt</PaddingRight>
320                        <PaddingTop>2pt</PaddingTop>
321                        <PaddingBottom>2pt</PaddingBottom>
322                      </Style>
323                      <ZIndex>1</ZIndex>
324                      <CanGrow>true</CanGrow>
325                      <Value>=Fields!Cennik.Value</Value>
326                    </Textbox>
327                  </ReportItems>
328                </TableCell>
329                <TableCell>
330                  <ReportItems>
331                    <Textbox Name="textbox7">
332                      <rd:DefaultName>textbox7</rd:DefaultName>
333                      <Style>
334                        <BorderColor>
335                          <Default>LightGrey</Default>
336                        </BorderColor>
337                        <BorderStyle>
338                          <Default>Solid</Default>
339                        </BorderStyle>
340                        <Format>P</Format>
341                        <TextAlign>Center</TextAlign>
342                        <PaddingLeft>2pt</PaddingLeft>
343                        <PaddingRight>2pt</PaddingRight>
344                        <PaddingTop>2pt</PaddingTop>
345                        <PaddingBottom>2pt</PaddingBottom>
346                      </Style>
347                      <CanGrow>true</CanGrow>
348                      <Value>=(1 - (Fields!Sprzedano.Value/Fields!Cennik.Value))</Value>
349                    </Textbox>
350                  </ReportItems>
351                </TableCell>
352              </TableCells>
353              <Height>0.53333cm</Height>
354            </TableRow>
355          </TableRows>
356        </Details>
357        <Header>
358          <TableRows>
359            <TableRow>
360              <TableCells>
361                <TableCell>
362                  <ReportItems>
363                    <Textbox Name="textbox2">
364                      <rd:DefaultName>textbox2</rd:DefaultName>
365                      <Style>
366                        <BackgroundColor>WhiteSmoke</BackgroundColor>
367                        <BorderColor>
368                          <Default>LightGrey</Default>
369                        </BorderColor>
370                        <BorderStyle>
371                          <Default>Solid</Default>
372                        </BorderStyle>
373                        <FontWeight>700</FontWeight>
374                        <TextAlign>Center</TextAlign>
375                        <PaddingLeft>2pt</PaddingLeft>
376                        <PaddingRight>2pt</PaddingRight>
377                        <PaddingTop>2pt</PaddingTop>
378                        <PaddingBottom>2pt</PaddingBottom>
379                      </Style>
380                      <ZIndex>9</ZIndex>
381                      <CanGrow>true</CanGrow>
382                      <Value>Agent</Value>
383                    </Textbox>
384                  </ReportItems>
385                </TableCell>
386                <TableCell>
387                  <ReportItems>
388                    <Textbox Name="textbox3">
389                      <rd:DefaultName>textbox3</rd:DefaultName>
390                      <Style>
391                        <BackgroundColor>WhiteSmoke</BackgroundColor>
392                        <BorderColor>
393                          <Default>LightGrey</Default>
394                        </BorderColor>
395                        <BorderStyle>
396                          <Default>Solid</Default>
397                        </BorderStyle>
398                        <FontWeight>700</FontWeight>
399                        <TextAlign>Center</TextAlign>
400                        <PaddingLeft>2pt</PaddingLeft>
401                        <PaddingRight>2pt</PaddingRight>
402                        <PaddingTop>2pt</PaddingTop>
403                        <PaddingBottom>2pt</PaddingBottom>
404                      </Style>
405                      <ZIndex>8</ZIndex>
406                      <CanGrow>true</CanGrow>
407                      <Value>Moduł</Value>
408                    </Textbox>
409                  </ReportItems>
410                </TableCell>
411                <TableCell>
412                  <ReportItems>
413                    <Textbox Name="textbox4">
414                      <rd:DefaultName>textbox4</rd:DefaultName>
415                      <Style>
416                        <BackgroundColor>WhiteSmoke</BackgroundColor>
417                        <BorderColor>
418                          <Default>LightGrey</Default>
419                        </BorderColor>
420                        <BorderStyle>
421                          <Default>Solid</Default>
422                        </BorderStyle>
423                        <FontWeight>700</FontWeight>
424                        <TextAlign>Center</TextAlign>
425                        <PaddingLeft>2pt</PaddingLeft>
426                        <PaddingRight>2pt</PaddingRight>
427                        <PaddingTop>2pt</PaddingTop>
428                        <PaddingBottom>2pt</PaddingBottom>
429                      </Style>
430                      <ZIndex>7</ZIndex>
431                      <CanGrow>true</CanGrow>
432                      <Value>Cena sprzedaży</Value>
433                    </Textbox>
434                  </ReportItems>
435                </TableCell>
436                <TableCell>
437                  <ReportItems>
438                    <Textbox Name="textbox5">
439                      <rd:DefaultName>textbox5</rd:DefaultName>
440                      <Style>
441                        <BackgroundColor>WhiteSmoke</BackgroundColor>
442                        <BorderColor>
443                          <Default>LightGrey</Default>
444                        </BorderColor>
445                        <BorderStyle>
446                          <Default>Solid</Default>
447                        </BorderStyle>
448                        <FontWeight>700</FontWeight>
449                        <TextAlign>Center</TextAlign>
450                        <PaddingLeft>2pt</PaddingLeft>
451                        <PaddingRight>2pt</PaddingRight>
452                        <PaddingTop>2pt</PaddingTop>
453                        <PaddingBottom>2pt</PaddingBottom>
454                      </Style>
455                      <ZIndex>6</ZIndex>
456                      <CanGrow>true</CanGrow>
457                      <Value>Cena w cenniku</Value>
458                    </Textbox>
459                  </ReportItems>
460                </TableCell>
461                <TableCell>
462                  <ReportItems>
463                    <Textbox Name="textbox6">
464                      <rd:DefaultName>textbox6</rd:DefaultName>
465                      <Style>
466                        <BackgroundColor>WhiteSmoke</BackgroundColor>
467                        <BorderColor>
468                          <Default>LightGrey</Default>
469                        </BorderColor>
470                        <BorderStyle>
471                          <Default>Solid</Default>
472                        </BorderStyle>
473                        <FontWeight>700</FontWeight>
474                        <TextAlign>Center</TextAlign>
475                        <PaddingLeft>2pt</PaddingLeft>
476                        <PaddingRight>2pt</PaddingRight>
477                        <PaddingTop>2pt</PaddingTop>
478                        <PaddingBottom>2pt</PaddingBottom>
479                      </Style>
480                      <ZIndex>5</ZIndex>
481                      <CanGrow>true</CanGrow>
482                      <Value>Procent rabatu</Value>
483                    </Textbox>
484                  </ReportItems>
485                </TableCell>
486              </TableCells>
487              <Height>0.53333cm</Height>
488            </TableRow>
489          </TableRows>
490          <RepeatOnNewPage>true</RepeatOnNewPage>
491        </Header>
492        <TableColumns>
493          <TableColumn>
494            <Width>2.55cm</Width>
495          </TableColumn>
496          <TableColumn>
497            <Width>2.55cm</Width>
498          </TableColumn>
499          <TableColumn>
500            <Width>2.55cm</Width>
501          </TableColumn>
502          <TableColumn>
503            <Width>2.55cm</Width>
504          </TableColumn>
505          <TableColumn>
506            <Width>3.25cm</Width>
507          </TableColumn>
508        </TableColumns>
509      </Table>
510    </ReportItems>
511    <Height>2.81666cm</Height>
512  </Body>
513  <Language>pl-PL</Language>
514  <TopMargin>2.5cm</TopMargin>
515  <PageHeight>29.7cm</PageHeight>
516</Report>
Notatka: Zobacz TracBrowser aby uzyskać więcej informacji.