Społeczność Comarch ERP | Użytkownicy Klienci Partnerzy Comarch

Profil użytkownika

avatar

Mateusz Wielocha

0 pkt
 
klient
0 Podziękowań
0 0%

4 pytań

1 odpowiedzi

0 0%

0 pomysłów

0 komentarzy

Aktywność

  • Wartościowy użytkownik
  • Wysoko notowany
  • Lider rankingu
  • Aktywny użytkownik
  • Pomysłodawca
  • Uczynny użytkownik
  • Znawca tematu
  • Specjalista kategorii Chmura
  • Specjalista kategori ERP Altum
  • Specjalista kategorii ERP Optima
  • Specjalista kategorii ERP XL
  • Specjalista kategorii ERP XT
  • Specjalista kategorii ERP esklep
  • Specjalista kategorii ERP mobile
  • Specjalista kategorii ERP Produkcja
  • Specjalista kategorii IBARD
  • Specjalista kategorii wszystko.pl
  • Specjalista kategorii ERP Klasyka
  • Specjalista kategorii ERP iKsięgowośc 24
  • Specjalista kategorii ERP Retail
  • Specjalista kategorii Workflow
  • Specjalista kategorii Techniczne
  • Specjalista kategorii Handel
  • Specjalista kategorii Logistyka
  • Specjalista kategorii Księgowość
  • Specjalista kategorii BI
  • Specjalista kategorii Kadry płace

Rankingi

Miejsce W tym
miesiącu
Punktów
Ranking główny 2807 103 0 pkt
W tym miesiącu 103 103 0 pkt
Pytania i odpowiedzi 2214 76 0 pkt
Pomysły i komentarze 797 34 0 pkt
Najbardziej pomocni - - -

O firmie

Wpisy użytkownika

User Avatar
klient
Mateusz Wielocha
0 pkt
4 pytań
1 odpowiedzi
0 pomysłów
0 komentarzy
0 0%
Mateusz Wielocha zapytał/a o
Handel
Handel pytań: 901 | odpowiedzi: 3450

Handel

Przemysław ParusGrzegorz DurakRoman MozolaRafał Łopuszyński-ucz.RSO!-IIedycjaTomasz BerezaDaniel PargiełaBeata Golmento-EnferBłażej Runowski
Comarch ERP Optima
Comarch ERP Optima pytań: 5044 | odpowiedzi: 20039

Optima

Radosław OlesińskiPrzemysław ParusAgnieszka KęsikGrzegorz MasternakTomasz TadeuszewskiPaweł ProtasiukDominik WajdaPiotr Nowak

Wydruk tekstowy na OKI 3320 - zmiana PKWIU na EAN ?

Zaktualizowano rok temu

Witam,

Chciałbym aby na wydruku tekstowym zamiast PKWiU był kod Ean. Czy jest szansa zmiany tego w wydruku tekstowym XML?

Poniżej kod wydruku:

[SQL]
---- ?@Hs200_NQ|Filtr:''@?
---- ?@Hs200_NQ|CDN_PrintDevice:''@?
---- ?@Hs200_NQ|CDN_PrinterType:''@?
---- ?@Hs200_NQ|CDN_PrinterCodePage:''@?
---- ?@Hs200_NQ|CDN_PrinterBuffer:''@?
---- ?@Hs200_NQ|CDN_Urzadzenie:''@?
---- ?@Hs200_NQ|Identyfikator:''@?


Select
'NIP: ' + Max(Case When Fir_Numer=1167 Then + Fir_Wartosc Else '' End) +
Max(Case When Fir_Numer=1101 Then + ' ' +replace(Fir_Wartosc,'-','') Else '' End)As Fir_Nip,
'NIP: ' + Max(Case When Fir_Numer=1101 Then + ' ' +Fir_Wartosc Else '' End)As Fir_NipE,
Max(Case When Fir_Numer=1156 Then Fir_Wartosc Else '' End) As Fir_Nazwa1,
Max(Case When Fir_Numer=1157 Then Fir_Wartosc Else '' End) As Fir_Nazwa2,
Max(Case When Fir_Numer=1149 Then Fir_Wartosc+' ' Else '' End) + Max(Case When Fir_Numer=1150 Then Fir_Wartosc Else '' End) + Max(Case When Fir_Numer=1151 And Fir_Wartosc<>'' Then '/' + Fir_Wartosc Else '' End) As Fir_Adres,
Max(Case When Fir_Numer=1153 And Fir_Wartosc Not In ('', '00-000') Then Fir_Wartosc + ' ' Else '' End) + Max(Case When Fir_Numer=1152 Then Fir_Wartosc Else '' End) As Fir_Miasto,
Max(Case When Fir_Numer=1664 Then Fir_Wartosc Else '' End) As Fir_FaWe, Substring (Max(Case When Fir_Numer = 1992 Then Fir_Wartosc Else '' End), 1,127) As Fir_Opis1, Substring (Max(Case When Fir_Numer = 1992 Then Fir_Wartosc Else '' End), 128,127) As Fir_Opis2,
'Tel: '+ Max(Case When Fir_Numer=1155 Then + Fir_Wartosc Else '' End) as Fir_Tel
From CDN.Firma

-- Parametry
declare @D_ID int
declare @Rodzaj int
declare @FaId int
select @D_ID = trn_trnId ,@Rodzaj = Trn_Rodzaj , @FaID = TrN_FaId from cdn.TraNag where ??_NQFiltr

declare @sa_pa int

SELECT @sa_pa = count(*) FROM CDN.TRAnAG WHERE TrN_TrNID=@FaId AND Trn_TypDokumentu=305


Select
(select Fir_wartosc from cdn.firma where fir_numer = 1993) as Czy_ListaWZ,
(select Fir_wartosc from cdn.firma where fir_numer = 1721) as Czy_ListaWKA,

(SELECT count(*) FROM CDN.TraNag
left outer join CDN.BnkZdarzenia on BZD_DokumentTyp = 1 and Bzd_DokumentID = trn_trnId
WHERE ( TrN_FAID = @D_ID
and @Rodzaj <> 302004 or TrN_RelTRNID = @D_ID )
and TrN_TypDokumentu = 314) as IloscWKA,

case when A.TrN_Rodzaj >=302100 then A.TrN_NumerPelnyPrw else A.TrN_NumerPelny end as TrN_NumerPelny,
(SELECT 'Do paragonu: '+ B.TrN_NumerPelny FROM CDN.TraNag B where B.Trn_typDokumentu = 305 and B.Trn_TrnID = A.TrN_FaID ) as PA_POWIAZANY,
Convert(Char(10), A.TrN_DataWys, 120) As TrN_DataWys,
Convert(Char(10), A.TrN_DataOpe, 120) As TrN_DataOpe,
A.TrN_Opis as TrN_Opis,
Case A.TrN_TypNB When 1 Then 'netto' Else 'brutto' End As TrN_TypNB,
Case A.TrN_TypNB When 1 Then 'brutto' Else 'netto' End As TrN_TypNB2,
A.TrN_Odebral as TrN_Odebral,
Case When A.TrN_RazemBrutto>=0 Then 'zapłaty' Else 'zwrotu' End As TrN_Znak,
( Select Abs(SUM(ISNULL (BzD_KwotaSys,0.00)))
From CDN.TraNag as A
join CDN.TraNag as B on
-- Dla AF z PA
(B.TrN_TrnID = A.TrN_FaId or @sa_pa=0 )
AND (B.TrN_TrnID = A.TrN_TrnID or @sa_pa>0)
Join CDN.BnkZdarzenia On BZd_DokumentTyp=1 And BZd_DokumentId=B.TrN_TrNId
Where A.??_NQFiltr
)As TrN_Razem,

A.TrN_PodNazwa1,
A.TrN_PodNazwa2,
A.TrN_PodNazwa3,
(select fpl_typ from cdn.formyplatnosci where fpl_fplid = A.TrN_FplId) as TrN_FplId,

case when len ( A.TrN_PodNazwa1) > 40 or len ( A.TrN_OdbNazwa1)> 40 then 1 else 0 end as LenLinia1,
case when len ( A.TrN_PodNazwa2) > 40 or len ( A.TrN_OdbNazwa2)> 40 then 1 else 0 end as LenLinia2,
case when len ( A.TrN_PodNazwa3) > 40 or len ( A.TrN_OdbNazwa3)> 40 then 1 else 0 end as LenLinia3,

A.TrN_PodUlica + ' ' + A.TrN_PodNrDomu + Case When A.TrN_PodNrLokalu<>'' Then '/'+ A.TrN_PodNrLokalu Else '' End + case when RTRIM(A.TrN_PodPoczta)<>'' then ', '+A.TrN_PodMiasto else '' end As TrN_PodAdres,
Case When A.TrN_PodKodPocztowy Not In ('', '00-000') Then A.TrN_PodKodPocztowy + ' ' Else '' End + CASE WHEN RTRIM(LTRIM(UPPER (A.TrN_PodMiasto )))like RTRIM(LTRIM(UPPER( A.TrN_PodPoczta))) or RTRIM(A.TrN_PodPoczta) = '' then A.TrN_PodMiasto else A.TrN_PodPoczta end As TrN_PodMiasto,

Case When A.TrN_PodNipE<>'' Then 'NIP: '+Case When A.TrN_PodNipKraj<>'' then A.TrN_PodNipKraj +' ' else ''end + A.TrN_PodNipE Else '' End As TrN_PodNip,
case when A.TrN_OdbNazwa1=A.TrN_PodNazwa1 then '' else A.TrN_OdbNazwa1 end TrN_OdbNazwa1,
case when A.TrN_OdbNazwa2=A.TrN_PodNazwa2 then '' else A.TrN_OdbNazwa2 end TrN_OdbNazwa2,
case when A.TrN_OdbNazwa3=A.TrN_OdbNazwa3 then '' else A.TrN_OdbNazwa3 end TrN_OdbNazwa3,
A.TrN_PodAdres2,
case when trn_podid = trn_odbid then 1 else 0 end as tensamknt,

case when A.trn_podid=A.trn_odbid then '' else A.TrN_OdbUlica + ' ' + A.TrN_OdbNrDomu + Case When A.TrN_OdbNrLokalu<>'' Then '/'+ A.TrN_OdbNrLokalu Else '' End + case when RTRIM(A.TrN_OdbPoczta)<>'' then ', '+A.TrN_OdbMiasto else '' end end As TrN_OdbAdres,
case when A.trn_podid=A.trn_odbid then '' else Case When A.TrN_OdbKodPocztowy Not In ('', '00-000') Then A.TrN_OdbKodPocztowy + ' ' Else '' End + CASE WHEN RTRIM(LTRIM(UPPER (A.TrN_OdbMiasto )))like RTRIM(LTRIM(UPPER( A.TrN_OdbPoczta))) or RTRIM(A.TrN_OdbPoczta) = '' then A.TrN_OdbMiasto else A.TrN_OdbPoczta end end As TrN_OdbMiasto,

'' As TrN_OdbNip,
(select top 1 'Bank: ' + BNa_Nazwa1 + ' Nr rachunku: ' + BRa_RachunekNr
from CDN.BnkZdarzenia X JOIN Cdn.BnkRachunki Y ON X.bzd_bRAid = Y.bRA_bRAid
JOIN Cdn.BnkNazwy Z ON Y.BRa_BNaID=Z.Bna_BnaID
join Cdn.FormyPlatnosci Q on X.bzd_Fplid = Q.Fpl_FplID
where X.Bzd_DokumentTyp = 1 and Y.BRa_Typ = 2 and
((X.BZd_DokumentID = A.TrN_TrnID and ISNULL(( select top 1 S.Trn_TypDokumentu from CDN.TraNag S where S.TrN_TrNID= A.TrN_FaId ),0) <> 305)
or
(X.BZd_DokumentID = A.TrN_FaId and ISNULL(( select top 1 S.Trn_TypDokumentu from CDN.TraNag S where S.TrN_TrNID= A.TrN_FaId ),0) = 305))
order by X.bzd_bzdID asc)
As TrN_Bank,

Ope_Nazwisko ,
A.TrN_Export as TrN_Export,
(select top 1 CDN.IstniejaFaZal( ( select trn_trnId from cdn.TraNag where ??_NQFiltr
)) ) As CzySaZal,

case (select Fir_Wartosc from cdn.firma where fir_numer = 1996)
when 1 then ' Brutto '
when 2 then ' Brutto '
when 3 then ' Vat '
when 4 then ' Vat '
when 5 then ' Netto '
when 6 then ' Netto '
end As KOL1
,case (select Fir_Wartosc from cdn.firma where fir_numer = 1996)
when 1 then ' Vat '
when 2 then ' Netto '
when 3 then ' Brutto '
when 4 then ' Netto '
when 5 then ' Vat '
when 6 then ' Brutto '
end As KOL2
,case (select Fir_Wartosc from cdn.firma where fir_numer = 1996)
when 1 then ' Netto '
when 2 then ' Vat '
when 3 then ' Netto '
when 4 then ' Brutto '
when 5 then ' Brutto '
when 6 then ' Vat '
end As KOL3

From CDN.TraNag A
Join CDN.FormyPlatnosci On A.TrN_FPlId=FPl_FPlId
Left Outer Join CDN.BnkRachunki On FPl_BRaId=BRa_BRaId
Left Outer Join CDN.BnkNazwy On BRa_BNaId=BNa_BNaId
Left Outer Join CDN.BnkZdarzenia On A.TrN_TrNID = BzD_DokumentID
Left Outer Join ?@HS50_NQ|BazaK|&BazaK:{opBK()} @?.[CDN].[Operatorzy] On Ope_OpeId=TrN_OpeModID
Where A.??_NQFiltr
GROUP BY A.TrN_NumerPelnyPrw, A.TrN_Rodzaj, A.TrN_NumerPelny, A.TrN_FaID, A.TrN_DataWys,
A.TrN_DataOpe, A.TrN_Opis, A.TrN_TypNB, A.TrN_Odebral, A.TrN_RazemBrutto, A.TrN_PodNazwa1,
A.TrN_PodNazwa2,A.TrN_PodNazwa3,A.TrN_PodUlica, A.TrN_PodNrDomu, A.TrN_PodNrLokalu,
A.TrN_PodKodPocztowy, A.TrN_PodMiasto, A.TrN_PodNipKraj, A.TrN_POdNIpE,
A.TrN_OdbNazwa1,A.TrN_OdbNazwa2,A.TrN_OdbNazwa3, A.TrN_OdbUlica, A.TrN_OdbNrDomu,
A.TrN_OdbNrLokalu, A.TrN_OdbKodPocztowy, A.TrN_OdbMiasto, A.TrN_OdbNipKraj, A.TrN_OdbNipE,
A.TrN_TrNID, A.TrN_Export, Ope_Nazwisko, A.TrN_PodPoczta, A.TrN_OdbPoczta , A.TrN_PodId, A.TrN_OdbId, A.TrN_PodAdres2 , A.Trn_Fplid
option ( maxdop 1 )

Select IsNull(Sum(case when Bzd_BzdId = Brk_LDokID then brk_KwotaSysL else brk_KwotaSysP end ),0) As TrN_Zaplacono,
(
Select max(FPl_Typ)
From CDN.TraNag as A
join CDN.TraNag as B on
-- Dla AF z PA
(B.TrN_TrnID = A.TrN_FaId or @sa_pa=0 )
AND (B.TrN_TrnID = A.TrN_TrnID or @sa_pa>0 )
Join CDN.BnkZdarzenia On BZd_DokumentTyp=1 And BZd_DokumentId=B.TrN_TrNId
join CDN.FormyPlatnosci on FPl_FPlId = BZd_FPlId
where FPl_Typ =1 and
A.??_NQFiltr
) as Gotowka

From CDN.TraNag as A
join CDN.TraNag as B on
-- Dla AF z PA
(B.TrN_TrnID = A.TrN_FaId or @sa_pa=0 )
AND (B.TrN_TrnID = A.TrN_TrnID or @sa_pa>0)
Join CDN.BnkZdarzenia On BZd_DokumentTyp=1 And BZd_DokumentId=B.TrN_TrNId
Join CDN.BnkRozRelacje On BRR_ZDokTyp=1 And BRR_ZDokId=BZd_BZdId
Join CDN.BnkRozKwoty On BRK_BRKId=BRR_BRKId
Join CDN.BnkZapisy On 2=BRR_DDokTyp And BZp_BZpId=BRR_DDokId
Where A.??_NQFiltr
option ( maxdop 1 )

Select
TrE_Lp,
replace( replace( replace( TrE_TwrNazwa ,char(13)+char(10),' ' ),char(13),' ' ),char(10),' ' ) + ' ' + TrE_TwrOpis As TrE_TwrNazwa,
TrE_TwrSWW as Twr_SWW,
TrE_IloscJM,
TrE_JM,
Case When TrE_Flaga=1 Then 'ZW.' When TrE_Flaga In (2,3) Then Str(TrE_Stawka,2)+'%' When TrE_Flaga=4 Then 'NP.' End As TrE_Vat,
TrE_CenaT,
Case TrN_TypNB When 1 Then TrE_WartoscBrutto/Tre_iloscjm Else TrE_WartoscNetto/Tre_iloscjm End as TrE_CenaT2,
Case TrN_TypNB When 1 Then TrE_WartoscNetto Else TrE_WartoscBrutto End As TrE_Wartosc
From CDN.TraNag
Join CDN.TraElem On TrN_TrNId=TrE_TrNId
Join CDN.Towary On TrE_TwrId=Twr_TwrId
Where TrE_Kaucja = 0 AND ??_NQFiltr
Order By TrE_TrNId, TrE_Lp

Select
Case When BZd_Lp Is Not Null Then BZd_Lp Else TrV_Lp End As Lp,
Case TrV_Lp When 0 Then 'Razem:' When 1 Then 'W tym:' Else '' End As TrV_Opis,
*
From
(
Select
0 As TrV_Lp,
'' As TrV_StawkaVat,

case (select Fir_Wartosc from cdn.firma where fir_numer = 1996)
when 1 then Sum(TrV_Netto+TrV_Vat)
when 2 then Sum(TrV_Netto+TrV_Vat)
when 3 then Sum(TrV_Vat)
when 4 then Sum(TrV_Vat)
when 5 then Sum(TrV_Netto)
when 6 then Sum(TrV_Netto)
end As TrV_Netto
,case (select Fir_Wartosc from cdn.firma where fir_numer = 1996)
when 1 then Sum(TrV_Vat)
when 2 then Sum(TrV_Netto)
when 3 then Sum(TrV_Netto+TrV_Vat)
when 4 then Sum(TrV_Netto)
when 5 then Sum(TrV_Vat)
when 6 then Sum(TrV_Netto+TrV_Vat)
end As TrV_Vat
,case (select Fir_Wartosc from cdn.firma where fir_numer = 1996)
when 1 then Sum(TrV_Netto)
when 2 then Sum(TrV_Vat)
when 3 then Sum(TrV_Netto)
when 4 then Sum(TrV_Netto+TrV_Vat)
when 5 then Sum(TrV_Netto+TrV_Vat)
when 6 then Sum(TrV_Vat)
end As TrV_Brutto

From CDN.TraVat Join CDN.TraNag On TrN_TrNId=TrV_TrNId
Where ??_NQFiltr
Union All
Select
(Select Count(*) From CDN.TraVat b Where b.TrV_TrNId=a.TrV_TrNId And (b.TrV_Flaga<a.TrV_Flaga Or b.TrV_Flaga=a.TrV_Flaga And b.TrV_Stawka<a.TrV_Stawka))+1 As TrV_Lp,
Case When TrV_Flaga=1 Then 'ZW.' When TrV_Flaga In (2,3) Then Str(TrV_Stawka,2)+'%' When TrV_Flaga=4 Then 'NP.' End As TrV_StawkaVat,

case (select Fir_Wartosc from cdn.firma where fir_numer = 1996)
when 1 then TrV_Netto+TrV_Vat
when 2 then TrV_Netto+TrV_Vat
when 3 then TrV_Vat
when 4 then TrV_Vat
when 5 then TrV_Netto
when 6 then TrV_Netto
end As TrV_Netto
,case (select Fir_Wartosc from cdn.firma where fir_numer = 1996)
when 1 then TrV_Vat
when 2 then TrV_Netto
when 3 then TrV_Netto+TrV_Vat
when 4 then TrV_Netto
when 5 then TrV_Vat
when 6 then TrV_Netto+TrV_Vat
end As TrV_Vat
,case (select Fir_Wartosc from cdn.firma where fir_numer = 1996)
when 1 then TrV_Netto
when 2 then TrV_Vat
when 3 then TrV_Netto
when 4 then TrV_Netto+TrV_Vat
when 5 then TrV_Netto+TrV_Vat
when 6 then TrV_Vat
end As TrV_Brutto

From CDN.TraVat a Join CDN.TraNag On TrN_TrNId=TrV_TrNId
Where ??_NQFiltr
) As TrVTbl
Full Outer Join
(
select
Case When BZd_Lp1 Is Null Then BZd_Lp2 Else BZd_Lp1 End As BZd_Lp,
Case When FPL_Nazwa1 Is Null Then FPL_Nazwa2 Else FPL_Nazwa1 End As FPl_Nazwa,
Case When BZd_Termin1 Is Null Then BZd_Termin2 Else BZd_Termin1 End As BZd_Termin,
Case When BZd_Kwota1 Is Null Then BZd_Kwota2 Else BZd_Kwota1 End As BZd_Kwota,
Case When BZd_Waluta1 Is Null Then BZd_Waluta2 Else BZd_Waluta1 End As BZd_Waluta,
Case When Trn_NumerPelny1 Is Null Then Trn_NumerPelny2 Else Trn_NumerPelny1 End As Trn_NumerPelny,
Case When Trn_TypDokumentu1 Is Null Then Trn_TypDokumentu2 Else Trn_TypDokumentu1 End As Trn_TypDokumentu
from
(
-- Platnosci skojazone z dok nie opdpiete do niego np. Dla FA z PA
Select
T.Trn_NumerPelny as Trn_NumerPelny1,
T.Trn_TypDokumentu as Trn_TypDokumentu1,
(Select Count(*) From CDN.BnkZdarzenia b
Where b.BZd_DokumentTyp=a.BZd_DokumentTyp And b.BZd_DokumentId=a.BZd_DokumentId
And (b.BZd_Termin<a.BZd_Termin Or b.BZd_Termin=a.BZd_Termin And b.BZd_BZdId<a.BZd_BZdId)) As BZd_Lp1,
FPl_Nazwa as FPl_Nazwa1,
Convert(Char(10), BZd_Termin, 120) As BZd_Termin1,
BZd_Kwota as BZd_Kwota1,
case when BzD_Waluta = '' then 'PLN' else BzD_Waluta end as BzD_Waluta1
From CDN.TraNag X
join CDN.TraNag T on T.TrN_TrnID = X.TrN_FaId
Join CDN.BnkZdarzenia a On T.TrN_TrNId=BZd_DokumentId And 1=BZd_DokumentTyp
Join CDN.FormyPlatnosci On BZd_FPlId = FPl_FPlId
Where T.Trn_TypDokumentu= 305 and X.??_NQFiltr
) as T1

Full Outer Join

(
Select
NULL as Trn_NumerPelny2,
NULL as Trn_TypDokumentu2,
(Select Count(*) From CDN.BnkZdarzenia b
Where b.BZd_DokumentTyp=a.BZd_DokumentTyp And b.BZd_DokumentId=a.BZd_DokumentId
And (b.BZd_Termin<a.BZd_Termin Or b.BZd_Termin=a.BZd_Termin And b.BZd_BZdId<a.BZd_BZdId)) As BZd_Lp2,
FPl_Nazwa as FPl_Nazwa2,
Convert(Char(10), BZd_Termin, 120) As BZd_Termin2,
BZd_Kwota as BZd_Kwota2,
case when BzD_Waluta = '' then 'PLN' else BzD_Waluta end as BzD_Waluta2
From CDN.BnkZdarzenia a
Join CDN.TraNag On TrN_TrNId=BZd_DokumentId And 1=BZd_DokumentTyp
Join CDN.FormyPlatnosci On BZd_FPlId = FPl_FPlId
Where ??_NQFiltr
) as T2
on T2.BZd_Lp2 = T1.BZd_Lp1

) As BZdTbl
On TrV_Lp=BZd_Lp
Order By 1
option ( maxdop 1 )

select Trn_NumerPelny=CONVERT ( VARCHAR(30) , trz_NumerPelny )
from CDN.TraFakZaliczkowe
join cdn.TraNag on TrZ_FZID=trn_trnid
where TrZ_Uwzgledniac = 1 and Trz_TrNID= @D_ID
group by TrZ_FZID , trz_NumerPelny ,Trn_DataDok, Trn_DataWys order by Trn_DataWys
option ( maxdop 1 )


-- Lista WZ
select
bzd_numerpelny + right(' ' + cast(bzd_kwota-bzd_kwotaroz as varchar(100)),10) as WZNrPelny,
convert(char(10),bzd_termin,120) as Data,
bzd_kwota-bzd_kwotaroz as TrN_RazemBrutto,
bzd_kwota as TrN_RazemBruttoWal,
'PLN' as WZWaluta
from cdn.bnkzdarzenia
where
bzd_podmiotid = (select trn_podid from cdn.tranag where trn_trnid = ??Identyfikator)
and bzd_podmiottyp = (select trn_podmiottyp from cdn.tranag where trn_trnid = ??Identyfikator)
and bzd_kwotaroz<>bzd_kwota
and (bzd_numerpelny like 'fa%' or bzd_numerpelny like 'fkor%')
and bzd_dokumentid <> ??Identyfikator
order by bzd_termin


/*
SELECT
TrN_NumerPelny as WZNrPelny, Convert (Char(10), TrN_DataDok, 120) as Data,
TrN_RazemBrutto ,
TrN_RazemBruttoWal,
ISNULL (sum(Bzd_Kwota),0) as WZKwota ,max(Bzd_waluta) as WZWaluta
FROM CDN.TraNag
left outer join CDN.BnkZdarzenia on BZD_DokumentTyp = 1 and Bzd_DokumentID = trn_trnId
WHERE TrN_FAID = (select trn_trnId from cdn.TraNag where ??_NQFiltr )
and TrN_TypDokumentu = 306
group by TrN_NumerPelny,TrN_DataDok, TrN_RazemBrutto, TrN_RazemBruttoWal
*/


-- Lista WKA


SELECT
TrN_NumerPelny as WKANrPelny, Convert (Char(10), TrN_DataDok, 120) as WKAData,
TrN_RazemBrutto ,TrN_RazemBruttoWal
,ISNULL (sum(Bzd_Kwota),0) as WKAPlatnosci, max(Bzd_waluta) as WKAWaluta
FROM CDN.TraNag
left outer join CDN.BnkZdarzenia on BZD_DokumentTyp = 1 and Bzd_DokumentID = trn_trnId
WHERE ( TrN_FAID = @D_ID
and @Rodzaj <> 302004 or TrN_RelTRNID = @D_ID )
and TrN_TypDokumentu = 314
group by TrN_NumerPelny,TrN_DataDok, TrN_RazemBrutto, TrN_RazemBruttoWal
option ( maxdop 1 )

select lp=1

[XSL]
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method = "xml" omit-xml-declaration="yes"/>
<xsl:preserve-space elements="*"/>
<xsl:template match="/">
<xsl:for-each select="ROOT">
<xsl:value-of disable-output-escaping="yes" select="string('&lt;?xml version=&quot;1.0&quot; encoding=&quot;windows-1250&quot;?&gt;')"/>

<ROOT>
<RAPORT>
<PARAM type="number" name="@PAGELENGTH" value="999"/>
<PARAM type="text" name="@PRINTER" value="{??_QCDN_PrintDevice}"/>
<PARAM type="text" name="@PRINTERTYPE" value="{??_QCDN_PrinterType}"/>
<PARAM type="text" name="@CODEPAGE" value="{??_QCDN_PrinterCodePage}"/>
<PARAM type="text" name="@BUFERING" value="{??_QCDN_PrinterBuffer}"/>
<PARAM type="text" name="@VIEW" value="{??_QCDN_Urzadzenie}"/>

<xsl:apply-templates select="RECORDSET1"/>
<xsl:apply-templates select="RECORDSET2"/>
<xsl:apply-templates select="RECORDSET3"/>

<PG_HEADER>
<LINE>
<FIELD calc="true" value="FONT_BOLD_ + FONT_NARROW_ + CR"/>
<FIELD value="+-Sprzedawca:" width="42" fill="-"/>
<FIELD value="+" width="5"/>

<FIELD calc="true" value="FONT_BOLD"/>
<FIELD value="Faktura VAT"/>
<FIELD calc="true" value="FONT_BOLD_"/>

</LINE>
<LINE>
<FIELD value="|" width="2"/>
<FIELD calc="true" value="@FIR_NAZWA1" width="40"/>
<FIELD value="|"/>
</LINE>
<LINE>
<FIELD value="|" width="2"/>
<FIELD calc="true" value="@FIR_NAZWA2" width="40"/>
<FIELD value="|" width="5"/>
<FIELD value="Numer:" width="7"/>
<FIELD calc="true" value="@TRN_NUMER"/>
</LINE>
<LINE>
<FIELD value="|" width="2"/>
<FIELD calc="true" value="@FIR_MIASTO" width="40"/>
<FIELD value="|" width="5"/>
<FIELD calc="true" value="@PA_POWIAZANY"/>
</LINE>
<LINE>
<FIELD value="|" width="2"/>
<FIELD calc="true" value="@FIR_ADRES" width="40"/>
<FIELD value="|" width="5"/>
<FIELD value="Data wystawienia:" width="18"/>
<FIELD calc="true" value="@TRN_DATAW"/>

</LINE>
<LINE>
<FIELD value="|" width="2"/>
<FIELD calc="true" value="if (@TrN_Export== 3 || @TrN_Export== 4) @FIR_NIP; else @FIR_NIPE;" width="20"/>
<FIELD calc="true" value="@Fir_Tel" width="20"/>
<FIELD value="|" width="5"/>
<FIELD value="Data sprzedaży:" width="18"/>
<FIELD calc="true" value="@TRN_DATAS"/>
</LINE>
<LINE>
<FIELD value="+" width="42" fill="-"/>
<FIELD value="+" width="5"/>
<FIELD value="Strona:" width="18"/>
<FIELD calc="true" value="PAGENO" width="3" type="number"/>
<FIELD value="/"/>
<FIELD calc="true" value="PAGETOT" width="3" type="number"/>

</LINE>
<LINE>
<FIELD calc="true" value="FONT_NARROW"/>
<FIELD calc="true" value="@TRN_BANK"/>
<FIELD calc="true" value="FONT_NARROW_"/>
</LINE>


<xsl:apply-templates mode="r9"/>


<LINE>
<FIELD calc="true" value="@POD_NIP" width="40"/>
<FIELD calc="true" value="@ODB_NIP" width="40"/>
</LINE>

<LINE/>

<LINE>
<FIELD value="Opis:" width="7"/>
<FIELD calc="true" value="FONT_NARROW"/>
<FIELD calc="true" value="@TRN_OPIS" width="70"/>
</LINE>
<LINE>
</LINE>

<LINE>
<FIELD value="+----+----------------------------------------------------+-----------+----------------+---+-----------+-------------+--------------+"/>
</LINE>
<LINE>
<FIELD value="| Lp |Nazwa towaru/usługi |"/>
<FIELD calc="true" width="11" align="right" value="'Cena '+@TRN_TYPNB2"/>


<FIELD value="| Ilość J.m. |VAT|"/>
<FIELD calc="true" width="11" align="right" value="'Cena '+@TRN_TYPNB"/>
<FIELD value="|" width="2" align="left"/>
<FIELD calc="true" width="12" align="right" value="'Wart.'+@TRN_TYPNB"/>
<FIELD width="16" value="| PKWiU |"/>

</LINE>
<LINE>
<FIELD value="+----+----------------------------------------------------+-----------+----------------+---+-----------+-------------+--------------+"/>
</LINE>

</PG_HEADER>

<DETAIL>
<xsl:apply-templates select="RECORDSET4"/>

</DETAIL>

<RPT_FOOTER>
<LINE>
<FIELD value="+----+-----------------+------------+------------------+--+-----------+----------+-----+---+----------++-------------+--------------+"/>
</LINE>
<LINE>
<FIELD calc="true" value="'| Forma płatności | Termin | Kwota | | St. |'+@KOL1+' |'+@KOL2+' |'+@KOL3+' |'"/>
</LINE>
<LINE>
<FIELD value="+----------------------+------------+------------------+ +-----+--------------+--------------+--------------+"/>

</LINE>

<xsl:apply-templates select="RECORDSET5"/>


</RPT_FOOTER>

<PG_FOOTER>
<LINE>
<FIELD value="+----+-----------------------------------------------------+---------------+--------------------+-----+--------------+--------------+" hide="PAGENO==PAGETOT"/>
<FIELD value="+----------------------+------------+------------------+ +-----+--------------+--------------+--------------+" hide="PAGENO!=PAGETOT"/>
</LINE>

<LINE>
<FIELD value="+---------------------------+" hide="@CzySaZal!=1"/>
</LINE>

<LINE>
<FIELD value="| Faktury VAT zaliczkowe |" hide="@CzySaZal!=1"/>
</LINE>

<LINE>
<FIELD value="+---------------------------+" hide="@CzySaZal!=1"/>
</LINE>

<xsl:apply-templates select="RECORDSET6"/>

<LINE>
<FIELD value="+---------------------------+" hide="@CzySaZal!=1"/>
</LINE>

<LINE hide ="@Czy_ListaWKA!=1 || @IloscWKA==0">
<FIELD value="Lista dok. WKA: +-------------+---------------------------+--------------+" width="133" align="right"/>
</LINE >

<LINE hide ="@Czy_ListaWKA!=1 || @IloscWKA==0">
<FIELD width="75" />
<FIELD value="|" width="2" />
<FIELD value=" Data " width="12"/>
<FIELD value="|" width="2" />
<FIELD value=" Numer dokumentu WKA " width="26"/>
<FIELD value="|" width="2" />
<FIELD value="Płatn. z WKA " width="13"/>
<FIELD value="|" width="2" />
</LINE>

<LINE hide ="@Czy_ListaWKA!=1 || @IloscWKA==0">
<FIELD value="+-------------+---------------------------+--------------+" width="133" align="right"/>
</LINE >

<xsl:apply-templates select="RECORDSET8"/>

<LINE hide ="@Czy_ListaWKA!=1 || @IloscWKA==0">
<FIELD value="+-------------+---------------------------+--------------+" width="133" align="right"/>
</LINE >

<LINE hide ="@Czy_ListaWKA!=1 || @IloscWKA==0">
</LINE >

<LINE>
<FIELD calc="true" value="FONT_BOLD"/>
<FIELD calc="true" value="'Razem do ' + @TRN_ZNAK + ': ' + FormatNumber(@TRN_RAZEM,13,2)" width="67" align="right"/>
<FIELD calc="true" value="FONT_BOLD_"/>
</LINE>


<LINE>
<FIELD calc="true" value="FONT_BOLD"/>
<FIELD calc="true" width="67" align="right" value="'Pozostaje do ' + @TRN_ZNAK + ': ' + FormatNumber(@TRN_RAZEM-@TRN_ZAPLACONO,13,2)" hide="@TRN_FPLID!=2"/>
<FIELD calc="true" value="FONT_BOLD"/>
<FIELD calc="false" width="67" align="right" value="Zapłacono gotówką" hide="@TRN_FPLID==2"/>
<FIELD calc="true" value="FONT_BOLD_"/>
</LINE>

<LINE>
<FIELD calc="true" value="'Słownie: ' + Slownie(@TRN_RAZEM)" width="133" align="right"/>
</LINE>

<LINE>
<FIELD calc="true" value="FONT_NARROW"/>
<FIELD value=" " fill=" " width="133" />
</LINE>

<LINE>
<FIELD calc="true" value="if ( @TrN_Export == '4' ) @Fir_FaWe; else ''" align="left" width="58"/>
<FIELD value="Niniejsza faktura stanowi wezwanie dłużnika do zapłaty (art. 455 K.C.)" align="right" width="75"/>
<FIELD calc="true" value="FONT_NARROW"/>
</LINE>

<LINE>
</LINE>
<LINE>
<FIELD calc="true" value="@Fir_Opis1" align="left" width="130"/>
</LINE>
<LINE>
<FIELD calc="true" value="@Fir_Opis2" align="left" width="130" />
</LINE>


<LINE>
</LINE>

<LINE>
<FIELD calc="true" value="@OPE_NAZWISKO" width="53" align="center"/>
<FIELD value="" width="27"/>
<FIELD calc="true" value="@TRN_ODEBRAL" width="53" align="center"/>
</LINE>
<LINE>
<FIELD value="___________________________________________________" width="53" align="center"/>
<FIELD value="_____________________" width="27" align="center"/>
<FIELD value="___________________________________________________" width="53" align="center"/>
</LINE>

<LINE>
<FIELD value="Podpis osoby uprawnionej do wystawienia faktury" width="53" align="center"/>
<FIELD value="Data odbioru" width="27" align="center"/>
<FIELD value="Podpis osoby uprawnionej do odbioru faktury" width="53" align="center"/>
</LINE>
<LINE>
</LINE>
<LINE>
<FIELD value="Lista faktur nierozliczonych: +------------+----------------------------+" width="133" align="right"/>
</LINE >

<LINE>
<FIELD width="90" />
<FIELD value="|" width="2" />
<FIELD value=" Termin " width="11"/>
<FIELD value="|" width="2" />
<FIELD value=" Numer dokumentu Pozostaje " width="27"/>
<FIELD value="|" width="2" />
</LINE>

<LINE>
<FIELD value="+------------+----------------------------+" width="133" align="right"/>
</LINE >

<xsl:apply-templates select="RECORDSET7"/>

<LINE>
<FIELD value="+------------+----------------------------+" width="133" align="right"/>
</LINE >


</PG_FOOTER>

</RAPORT>
</ROOT>
</xsl:for-each>
</xsl:template>

<xsl:template match="RECORDSET1">
<xsl:apply-templates select="RECORD" mode="r1"/>
</xsl:template>

<xsl:template match="RECORDSET2">
<xsl:apply-templates select="RECORD" mode="r2"/>
</xsl:template>

<xsl:template match="RECORDSET3">
<xsl:apply-templates select="RECORD" mode="r3"/>
</xsl:template>

<xsl:template match="RECORDSET4">
<xsl:apply-templates select="RECORD" mode="r4"/>
</xsl:template>

<xsl:template match="RECORDSET5">
<xsl:apply-templates select="RECORD" mode="r5"/>
</xsl:template>

<xsl:template match="RECORDSET6">
<xsl:apply-templates select="RECORD" mode="r6"/>
</xsl:template>

<xsl:template match="RECORDSET7">
<xsl:apply-templates select="RECORD" mode="r7"/>
</xsl:template>

<xsl:template match="RECORDSET8">
<xsl:apply-templates select="RECORD" mode="r8"/>
</xsl:template>


<xsl:template match="RECORDSET9">
<xsl:apply-templates select="RECORD" mode="r9"/>
</xsl:template>


<xsl:template match="RECORD" mode="r1">
<PARAM type="text" name="FIR_NAZWA1"><xsl:attribute name="value"><xsl:value-of select="@Fir_Nazwa1" /></xsl:attribute></PARAM>
<PARAM type="text" name="FIR_NAZWA2"><xsl:attribute name="value"><xsl:value-of select="@Fir_Nazwa2" /></xsl:attribute></PARAM>
<PARAM type="text" name="FIR_ADRES" ><xsl:attribute name="value"><xsl:value-of select="@Fir_Adres" /></xsl:attribute></PARAM>
<PARAM type="text" name="FIR_MIASTO"><xsl:attribute name="value"><xsl:value-of select="@Fir_Miasto" /></xsl:attribute></PARAM>
<PARAM type="text" name="FIR_NIP" ><xsl:attribute name="value"><xsl:value-of select="@Fir_Nip" /></xsl:attribute></PARAM>
<PARAM type="text" name="FIR_NIPE" ><xsl:attribute name="value"><xsl:value-of select="@Fir_NipE" /></xsl:attribute></PARAM>
<PARAM type="text" name="Fir_FaWe" ><xsl:attribute name="value"><xsl:value-of select="@Fir_FaWe" /></xsl:attribute></PARAM>
<PARAM type="text" name="Fir_Opis1" ><xsl:attribute name="value"><xsl:value-of select="@Fir_Opis1" /></xsl:attribute></PARAM>
<PARAM type="text" name="Fir_Opis2" ><xsl:attribute name="value"><xsl:value-of select="@Fir_Opis2" /></xsl:attribute></PARAM>
<PARAM type="text" name="Fir_Tel" ><xsl:attribute name="value"><xsl:value-of select="@Fir_Tel" /></xsl:attribute></PARAM>
</xsl:template>

<xsl:template match="RECORD" mode="r2">
<PARAM type="text" name="Czy_ListaWKA"><xsl:attribute name="value"><xsl:value-of select="@Czy_ListaWKA" /></xsl:attribute></PARAM>
<PARAM type="text" name="Czy_ListaWZ" ><xsl:attribute name="value"><xsl:value-of select="@Czy_ListaWZ" /></xsl:attribute></PARAM>
<PARAM type="text" name="IloscWKA" ><xsl:attribute name="value"><xsl:value-of select="@IloscWKA" /></xsl:attribute></PARAM>
<PARAM type="text" name="TRN_NUMER" ><xsl:attribute name="value"><xsl:value-of select="@TrN_NumerPelny"/></xsl:attribute></PARAM>
<PARAM type="text" name="TRN_DATAW" ><xsl:attribute name="value"><xsl:value-of select="@TrN_DataWys" /></xsl:attribute></PARAM>
<PARAM type="text" name="TRN_DATAS" ><xsl:attribute name="value"><xsl:value-of select="@TrN_DataOpe" /></xsl:attribute></PARAM>
<PARAM type="text" name="TRN_OPIS" ><xsl:attribute name="value"><xsl:value-of select="@TrN_Opis" /></xsl:attribute></PARAM>
<PARAM type="text" name="TRN_TYPNB" ><xsl:attribute name="value"><xsl:value-of select="@TrN_TypNB" /></xsl:attribute></PARAM>
<PARAM type="text" name="TRN_FPLID" ><xsl:attribute name="value"><xsl:value-of select="@TrN_FplId" /></xsl:attribute></PARAM>
<PARAM type="text" name="TRN_TYPNB2" ><xsl:attribute name="value"><xsl:value-of select="@TrN_TypNB2" /></xsl:attribute></PARAM>
<PARAM type="text" name="TRN_ODEBRAL"><xsl:attribute name="value"><xsl:value-of select="@TrN_Odebral" /></xsl:attribute></PARAM>
<PARAM type="text" name="TRN_ZNAK" ><xsl:attribute name="value"><xsl:value-of select="@TrN_Znak" /></xsl:attribute></PARAM>
<PARAM type="number" name="TRN_RAZEM" ><xsl:attribute name="value"><xsl:value-of select="@TrN_Razem" /></xsl:attribute></PARAM>
<PARAM type="text" name="TENSAMKNT"><xsl:attribute name="value"><xsl:value-of select="@tensamknt" /></xsl:attribute></PARAM>
<PARAM type="text" name="POD_NAZWA1"><xsl:attribute name="value"><xsl:value-of select="@TrN_PodNazwa1" /></xsl:attribute></PARAM>
<PARAM type="text" name="POD_NAZWA2"><xsl:attribute name="value"><xsl:value-of select="@TrN_PodNazwa2" /></xsl:attribute></PARAM>
<PARAM type="text" name="POD_NAZWA3"><xsl:attribute name="value"><xsl:value-of select="@TrN_PodNazwa3" /></xsl:attribute></PARAM>
<PARAM type="text" name="POD_ADRES" ><xsl:attribute name="value"><xsl:value-of select="@TrN_PodAdres" /></xsl:attribute></PARAM>
<PARAM type="text" name="POD_ADRES2" ><xsl:attribute name="value"><xsl:value-of select="@TrN_PodAdres2" /></xsl:attribute></PARAM>
<PARAM type="text" name="POD_MIASTO"><xsl:attribute name="value"><xsl:value-of select="@TrN_PodMiasto" /></xsl:attribute></PARAM>
<PARAM type="text" name="POD_NIP" ><xsl:attribute name="value"><xsl:value-of select="@TrN_PodNip" /></xsl:attribute></PARAM>
<PARAM type="text" name="ODB_NAZWA1"><xsl:attribute name="value"><xsl:value-of select="@TrN_OdbNazwa1" /></xsl:attribute></PARAM>
<PARAM type="text" name="ODB_NAZWA2"><xsl:attribute name="value"><xsl:value-of select="@TrN_OdbNazwa2" /></xsl:attribute></PARAM>
<PARAM type="text" name="ODB_NAZWA3"><xsl:attribute name="value"><xsl:value-of select="@TrN_OdbNazwa3" /></xsl:attribute></PARAM>
<PARAM type="text" name="ODB_ADRES" ><xsl:attribute name="value"><xsl:value-of select="@TrN_OdbAdres" /></xsl:attribute></PARAM>
<PARAM type="text" name="ODB_MIASTO"><xsl:attribute name="value"><xsl:value-of select="@TrN_OdbMiasto" /></xsl:attribute></PARAM>
<PARAM type="text" name="ODB_NIP" ><xsl:attribute name="value"><xsl:value-of select="@TrN_OdbNip" /></xsl:attribute></PARAM>
<PARAM type="text" name="TRN_BANK" ><xsl:attribute name="value"><xsl:value-of select="@TrN_Bank" /></xsl:attribute></PARAM>
<PARAM type="text" name="OPE_NAZWISKO"><xsl:attribute name="value"><xsl:value-of select="@Ope_Nazwisko"/></xsl:attribute></PARAM>
<PARAM type="text" name="PA_POWIAZANY"><xsl:attribute name="value"><xsl:value-of select="@PA_POWIAZANY"/></xsl:attribute></PARAM>
<PARAM type="text" name="TrN_Export"><xsl:attribute name="value"><xsl:value-of select="@TrN_Export" /></xsl:attribute></PARAM>
<PARAM type="text" name="CzySaZal"><xsl:attribute name="value"><xsl:value-of select="@CzySaZal" /></xsl:attribute></PARAM>
<PARAM type="text" name="KOL1"><xsl:attribute name="value"><xsl:value-of select="@KOL1" /></xsl:attribute></PARAM>
<PARAM type="text" name="KOL2"><xsl:attribute name="value"><xsl:value-of select="@KOL2" /></xsl:attribute></PARAM>
<PARAM type="text" name="KOL3"><xsl:attribute name="value"><xsl:value-of select="@KOL3" /></xsl:attribute></PARAM>

</xsl:template>

<xsl:template match="RECORD" mode="r3">
<PARAM type="number" name="TRN_ZAPLACONO"><xsl:attribute name="value"><xsl:value-of select="@TrN_Zaplacono"/></xsl:attribute></PARAM>
<PARAM type="number" name="Gotowka"><xsl:attribute name="value"><xsl:value-of select="@Gotowka"/></xsl:attribute></PARAM>
</xsl:template>

<xsl:template match="RECORD" mode="r4">
<LINE>
<FIELD value="|"/>
<FIELD width="3" align="right"><xsl:attribute name="value"><xsl:value-of select="@TrE_Lp" /></xsl:attribute></FIELD>
<FIELD width="2" value="|" align="center"/>
<FIELD width="52"><xsl:attribute name="value"><xsl:value-of select="@TrE_TwrNazwa"/></xsl:attribute></FIELD>
<FIELD width="1" value="|" />
<FIELD width="11" type="number" prec="2"><xsl:attribute name="value"><xsl:value-of select="@TrE_CenaT2"/></xsl:attribute></FIELD>
<FIELD width="1" align="right" value="|" />
<FIELD width="10" type="number" prec="2" hidezero="true"><xsl:attribute name="value"><xsl:value-of select="@TrE_IloscJM"/></xsl:attribute></FIELD>
<FIELD value=" " width="1" />
<FIELD width="5"><xsl:attribute name="value"><xsl:value-of select="@TrE_JM"/></xsl:attribute></FIELD>
<FIELD width="1" value="|" />
<FIELD width="3"><xsl:attribute name="value"><xsl:value-of select="@TrE_Vat"/></xsl:attribute></FIELD>
<FIELD value="|" />
<FIELD width="11" type="number" prec="2"><xsl:attribute name="value"><xsl:value-of select="@TrE_CenaT"/></xsl:attribute></FIELD>
<FIELD width="1" align="right" value="|" />
<FIELD width="13" type="number" prec="2"><xsl:attribute name="value"><xsl:value-of select="@TrE_Wartosc"/></xsl:attribute></FIELD>
<FIELD width="1" align="right" value="|" />
<FIELD width="14"><xsl:attribute name="value"><xsl:value-of select="@Twr_SWW"/></xsl:attribute></FIELD>
<FIELD value="|" />

</LINE>
</xsl:template>

<xsl:template match="RECORD" mode="r5">
<LINE>
<FIELD value="|" width="2" />
<FIELD width="21"><xsl:attribute name="value"><xsl:value-of select="@FPl_Nazwa"/></xsl:attribute></FIELD>
<FIELD value="|" width="2" />
<FIELD width="11"><xsl:attribute name="value"><xsl:value-of select="@BZd_Termin"/></xsl:attribute></FIELD>
<FIELD value="|"/>
<FIELD width="13" type="number" prec="2" blankzero="true"><xsl:attribute name="value"><xsl:value-of select="@BZd_Kwota"/></xsl:attribute></FIELD>
<FIELD width="4" align="right"><xsl:attribute name="value"><xsl:value-of select="@BZd_Waluta"/></xsl:attribute></FIELD>
<FIELD value="|" width="2" align="right"/>
<FIELD width="24" align="right"><xsl:attribute name="value"><xsl:value-of select="@TrV_Opis"/></xsl:attribute></FIELD>
<FIELD value="|" width="3" align="center"/>
<FIELD width="3" ><xsl:attribute name="value"><xsl:value-of select="@TrV_StawkaVat"/></xsl:attribute></FIELD>
<FIELD value="|" width="2" align="right"/>
<FIELD width="13" type="number" prec="2" blankzero="true"><xsl:attribute name="value"><xsl:value-of select="@TrV_Netto"/></xsl:attribute></FIELD>
<FIELD value="|" width="2" align="right"/>
<FIELD width="13" type="number" prec="2" blankzero="true"><xsl:attribute name="value"><xsl:value-of select="@TrV_Vat"/></xsl:attribute></FIELD>
<FIELD value="|" width="2" align="right"/>
<FIELD width="13" type="number" prec="2" blankzero="true"><xsl:attribute name="value"><xsl:value-of select="@TrV_Brutto"/></xsl:attribute></FIELD>
<FIELD value="|" width="2" align="right"/>
</LINE>
</xsl:template>

<xsl:template match="RECORD" mode="r6">
<LINE>
<FIELD value="|" width="2" />
<FIELD width="26"><xsl:attribute name="value"><xsl:value-of select="@Trn_NumerPelny"/></xsl:attribute></FIELD>
<FIELD value="|" width="2" />
</LINE>
</xsl:template>

<xsl:template match="RECORD" mode="r7">
<LINE>
<FIELD width="90" />
<FIELD value="|" width="2" />
<FIELD width="11"><xsl:attribute name="value"><xsl:value-of select="@Data"/></xsl:attribute></FIELD>
<FIELD value="|" width="2" />
<FIELD width="27"><xsl:attribute name="value"><xsl:value-of select="@WZNrPelny"/></xsl:attribute></FIELD>
<FIELD value="|" width="2" />
</LINE>
</xsl:template>

<xsl:template match="RECORD" mode="r8">
<LINE hide="@Czy_ListaWKA!=1">
<FIELD width="75" />
<FIELD value="|" width="2" />
<FIELD width="12"><xsl:attribute name="value"><xsl:value-of select="@WKAData"/></xsl:attribute></FIELD>
<FIELD value="|" width="2" />
<FIELD width="26"><xsl:attribute name="value"><xsl:value-of select="@WKANrPelny"/></xsl:attribute></FIELD>
<FIELD value="|" width="2" />
<FIELD width="13" type="number" prec="2" blankzero="true"><xsl:attribute name="value"><xsl:value-of select="@WKAPlatnosci"/></xsl:attribute></FIELD>
<FIELD value="|" width="2" />
</LINE>
</xsl:template>

<xsl:template match="/ROOT/RECORDSET2" mode="r9">

<LINE>
<FIELD value=" Nabywca:" width="41" fill=" "/>

<FIELD hide="@TENSAMKNT!=0" value=" Dostawa do:" width="39" fill=" "/>
</LINE>

<xsl:if test="/ROOT/RECORDSET2/RECORD/@LenLinia1=0 and /ROOT/RECORDSET2/RECORD/@LenLinia2=0 and /ROOT/RECORDSET2/RECORD/@LenLinia3=0">

<LINE>
<FIELD calc="true" value="@POD_NAZWA1" width="40"/>
<FIELD value=" " width="1"/>
<FIELD calc="true" value="@ODB_NAZWA1" width="39"/>

</LINE>
<LINE>
<FIELD calc="true" value="@POD_NAZWA2" width="40"/>
<FIELD value=" " width="1"/>
<FIELD calc="true" value="@ODB_NAZWA2" width="39"/>
</LINE>
<LINE>
<FIELD calc="true" value="@POD_NAZWA3" width="40"/>
<FIELD value=" " width="1"/>
<FIELD calc="true" value="@ODB_NAZWA3" width="39"/>
</LINE>


</xsl:if>

<xsl:if test="/ROOT/RECORDSET2/RECORD/@LenLinia1!=0 or /ROOT/RECORDSET2/RECORD/@LenLinia2!=0 or /ROOT/RECORDSET2/RECORD/@LenLinia3!=0">
<LINE>
<FIELD calc="true" value="FONT_NARROW"/>
<FIELD calc="true" value="@POD_NAZWA1" width="67"/>
<FIELD value=" " width="1"/>
<FIELD calc="true" value="@ODB_NAZWA1" width="65"/>

</LINE>
<LINE>
<FIELD calc="true" value="@POD_NAZWA2" width="67"/>
<FIELD value=" " width="1"/>
<FIELD calc="true" value="@ODB_NAZWA2" width="65"/>
</LINE>
<LINE>
<FIELD calc="true" value="@POD_NAZWA3" width="67"/>
<FIELD value=" " width="1"/>
<FIELD calc="true" value="@ODB_NAZWA3" width="65"/>
<FIELD calc="true" value="FONT_NARROW_"/>
</LINE>


</xsl:if>


<xsl:choose>
<xsl:when test="string-length(/ROOT/RECORDSET2/RECORD/@TrN_PodAdres)>40 or string-length(/ROOT/RECORDSET2/RECORD/@TrN_PodMiasto)>40 or string-length(/ROOT/RECORDSET2/RECORD/@TrN_OdbMiasto)>40 or string-length(/ROOT/RECORDSET2/RECORD/@TrN_OdbAdres)>40">
<LINE>
<FIELD calc="true" value="FONT_NARROW"/>
<FIELD calc="true" value="@POD_ADRES" width="67"/>
<FIELD value=" " width="1"/>
<FIELD calc="true" value="@ODB_ADRES" width="65"/>
</LINE>
<LINE>
<FIELD calc="true" value="@POD_MIASTO" width="67"/>
<FIELD value=" " width="1"/>
<FIELD calc="true" value="@ODB_MIASTO" width="65"/>
<FIELD calc="true" value="FONT_NARROW_"/>
</LINE>
</xsl:when>
<xsl:otherwise>
<LINE>
<FIELD calc="true" value="@POD_ADRES" width="40"/>
<FIELD value=" " width="1"/>
<FIELD calc="true" value="@ODB_ADRES" width="39"/>
</LINE>
<LINE>
<FIELD calc="true" value="@POD_MIASTO" width="40"/>
<FIELD value=" " width="1"/>
<FIELD calc="true" value="@ODB_MIASTO" width="39"/>
</LINE>
</xsl:otherwise>
</xsl:choose>


</xsl:template>

</xsl:stylesheet>

[RUN]
PrintTxt.EXE