mojaSymfonia FORUM
https://forum.mix-soft.pl/

Raport: Wydruk nalepek do dokumentów
https://forum.mix-soft.pl/viewtopic.php?f=15&t=460
Strona 1 z 1

Autor:  gregor [ 2008-12-14, 19:48 ]
Tytuł:  Raport: Wydruk nalepek do dokumentów


Są na form takie tęgie głowy. Może znajdę pomoc
Na bazie raportu Handel Premium "Wydruk naklejek do dokumentu" np zam. obcego, chcę uzyskać naklejkę, na której są: nazwa towaru, producenta,odbiorcy,ilość, opis z dokumentu, nr dok mag. oraz możliwość dodania własnego opisu np. z formatki do druku.
Pięknie było by dodać kod paskowy, na który mamy licencję i dodatkowy raport (na towary), ale nie da się podpatrzeć, gdyż jest kodowany.

Oto przeróbka-- może coś wymyślicie wg mojej sugestii. Dodam że naklejki te są na kartony z zapakowanym towarem wg zamówienia.

KOD:

//"nalepkid1.sc","Wydruk nalepek dla dokumentów",12301,0,1.0.0,SYSTEM
//"Sprzedaż ",12002,14,16
/////////////////////////////
// Wydruk nalepek dla dokumentów własne
/////////////////////////////
#include "Wydruki - include"

int GRAF = !Val ( Arg0 )
str.wydruk ( !GRAF, -1, -1 )

#define OK 2
#define ANULUJ -1

int Poprawnie, max, k
string sPom
string sBledy(1)
string stri(1)
int fon(1)
int count
float fKurs
long id
int dk

if SetTaggedPos(FS) then
if GetLineId() > 65535 then
dk = Open KatalogFirmy()+"51dk.dat" For base "DK"
BaseError ( dk,4 )
else
dk = Open KatalogFirmy()+"51bd.dat" For base "BD"
BaseError ( dk,4 )
endif
endif

int sub IsDigit()
if buf && !find regular "[~0-9]" then IsDigit = 1
endsub

string sSekcja = GetReportName()
string sCol = GetIni ( sSekcja, "Ilosc kolumn" )
string sRow = GetIni ( sSekcja, "Ilosc wierszy" )
string sLeft = GetIni ( sSekcja, "Lewy margines" )
string sRight = GetIni ( sSekcja, "Prawy margines" )
string sTop = GetIni ( sSekcja, "Gorny margines" )
string sBottom = GetIni ( sSekcja, "Dolny margines" )
int bSiatka = Val( GetIni ( sSekcja, "Siatka" ) )
int bNumer = Val(GetIni( sSekcja, "Numer") )
int bData = Val(GetIni( sSekcja, "Data") )
int bWartosc = Val(GetIni( sSekcja, "Wartosc") )
int bOpis = Val(GetIni( sSekcja, "Opis") )
int bPokaz = Val( GetIni( sSekcja, "Nie pokazuj dialogu") )
int iRazy = Val( GetIni( sSekcja, "Ilosc powtorzen") )

if !sCol then sCol = "5"
if !sRow then sRow = "10"
if !sLeft then sLeft = "0"
if !sRight then sRight = "0"
if !sTop then sTop = "0"
if !sBottom then sBottom = "0"
if !iRazy then iRazy = 1

int rv

bPokaz = !Val ( Arg7 )

if !bPokaz then

Form "Drukowanie nalepek ze specyfikacją",415,450

Group "Nalepki",5,5,400,40
Edit "Ilość powtórzeń nalepki",iRazy,180,20,25,20,IsDigit()
ChkBox "Rysuj siatkę",bSiatka,250,20,150,20

Group "Układ strony",5,50,220,40
Edit "Ilość kolumn",sCol,80,65,25,20,IsDigit()
Edit "Ilość wierszy",sRow,180,65,25,20,IsDigit()



Group "Marginesy",5,95,220,65
Edit "Lewy",sLeft,80,110,25,20,IsDigit()
Edit "Prawy",sRight,180,110,25,20,IsDigit()
Edit "Górny",sTop,80,135,25,20,IsDigit()
Edit "Dolny",sBottom,180,135,25,20,IsDigit()

Group "Informacje dodatkowe",240,50,165,110
ChkBox "Numer dokumentu",bNumer,250,65,150,20
ChkBox "Data wystawienia",bData,250,85,150,20
ChkBox "Opis",bOpis,250,105,150,20
ChkBox "Wartość",bWartosc,250,125,150,20

Group "Raport ",5,170,220,120
Text "Grzegorz ",50,190,220,18
Text " Sp.z o.o.",50,210,220,18
Text "Kąty Duże",28,230,220,18
Text "______________________________" , 20,250,220,18


ChkBox "Nie pokazuj tego okna ponownie",bPokaz,20,300,200,20






Button "&OK",220,300,80,25,OK
Button "&Anuluj",310,300,80,25,ANULUJ
rv = ExecForm
if (rv==ANULUJ)||(!rv) then Error ""

PutIni ( sSekcja, "Ilosc kolumn", sCol )

PutIni ( sSekcja, "Ilosc wierszy", sRow )
PutIni ( sSekcja, "Lewy margines", sLeft )
PutIni ( sSekcja, "Prawy margines", sRight )
PutIni ( sSekcja, "Gorny margines", sTop )
PutIni ( sSekcja, "Dolny margines", sBottom )
PutIni ( sSekcja, "Siatka", using "%d", bSiatka )

PutIni ( sSekcja, "Numer", using "%d", bNumer )
PutIni ( sSekcja, "Data", using "%d", bData )
PutIni ( sSekcja, "Wartosc", using "%d", bWartosc )
PutIni ( sSekcja, "Opis", using "%d", bOpis )
PutIni ( sSekcja, "Nie pokazuj dialogu", using "%d", bPokaz )
PutIni ( sSekcja, "Ilosc powtorzen", using "%d", iRazy )


endif

strona Val( sLeft ),val ( sTop ),val ( sRight ),val ( sBottom )

int tekst, bold, italic, underline
int TxtHt, y, i, j, nLine
int nCol = Val( sCol ), nRow = Val( sRow )
int KolTab(nCol), StlTab(nCol), KolTab2(1), StlTab2(1)

if GRAF then
bold = CopyFont ( "tekst",1 )
tekst = CopyFont ( "tekst", -1 )
italic = CopyFont ( "tekst", 2)
underline = CopyFont ("tekst", 3 )
else
italic = bold = tekst = underline = CopyFont ( "13cpi", -1 )
endif
int bc = styl ( bold, 0 )
int tn = styl (tekst, 0)
int bh = TextHeight ( "X",bold )
int th = TextHeight ( "X",tekst )
int ih = TextHeight ( "X",italic )
int uh = TextHeight ( "X",underline )


For i = 1 To i > nCol
KolTab(i) = str.szer/nCol
StlTab(i) = bc
Next i

string sub CreateString( string s )
String temp, temp2
int pos
nLine = 0
while s
nLine += 1
pos = BreakLine (str.szer/nCol-40, 0, 1, s )
trace(using "%dn",pos)
temp2 = mid ( s, 1, pos )+lf
CreateString += temp2
temp = s
s = mid ( s, pos+1 )
If temp == s || str.szer/nCol < Textwidth(temp2) then CreateString = "BŁĄD" : exit
wend
endsub

int tbl = tabela bSiatka*(!GRAF * 30 + GRAF),20,KolTab,StlTab

int sub AddString( string txt, int stl , int height)
SetFont(stl)
count+=1
if count > size(stri) then grow stri,1 : grow fon,1
stri(count) = CreateString ( txt )
If stri(count) == "BŁĄD" then
sBledy( size(sBledy) ) = GetField(dk,"kod")
grow sBledy, 1
AddString = 0
else
AddString = 1
endif
fon(count) = stl
TxtHt += (height * nLine)
endsub


int err = SetTaggedPos(FS)

while err

tabela #tbl

i = 1
while err && ( i <= nCol )

id = GetLineId()
SetKey ( dk,"id" )
SetKeySeg( dk,"id",id )
if GetRec( dk,EQ ) then Error "Błąd wewnętrzny programu"
fKurs = GetField(dk,"kurs")

// s1 = GetField( dk,"khnazwa" )
// s2 = GetField( dk,"khadres" )
// s3 = GetField( dk,"khkodpocz" )+" "+GetField( dk,"khmiasto"

shrink stri, -1
shrink fon, -1
count = 0
TxtHt=0
Poprawnie = AddString( GetField(dk, "khnazwa"), bold, bh )
if Poprawnie then Poprawnie = AddString( BuildAdresKh(dk), tekst, th )
if Poprawnie then Poprawnie = AddString( GetField( dk,"khkodpocz" )+" "+GetField( dk,"khmiasto" ), tekst, th )

if bOpis && Poprawnie then Poprawnie = AddString( "opis: "+GetField(dk,"Opis"), underline, uh)
if bNumer && Poprawnie then Poprawnie = AddString( "nr dok. mag.: "+GetField(dk,"kod"), italic, ih)


if bData && Poprawnie then Poprawnie = AddString( "data: "+GetField(dk,"data"), italic, ih)
if bWartosc && Poprawnie then



buf = "zł."
if GetField(dk,"waluta") then buf = GetField(dk,"waluta")
Poprawnie = AddString( "wart.: "+Kwota( (GetField(dk,"netto") + GetField(dk,"vat")) / fKurs)+" "+buf, italic, ih)
endif

y = (str.wys/nRow-TxtHt-10)/2

for k = 1 to k > iRazy
if ( i > nCol ) then : koniec : tabela #tbl : i =1
kolumna i
if Poprawnie then
SetFont ( fon(1) )
print at #X,y;stri(1)
for j=2 to j>size(stri)
SetFont ( fon(j) )
print stri(j)
next j
if TxtHt<(str.wys/nRow-15) then print at #X,#Y+y-th;" "
i += 1
endif
next k
err = SetTaggedPos(NX)
wend
koniec
wend

If size(sBledy) > 1 Then
setfont(bold)
Print LF+ "UWAGA"
setfont(tekst)
Print "\tNie zmieściły się dane na nalepekach dla dokumentów o numerach:" +LF+LF
i = 1
While i <= size(sBledy)
if max < Textwidth(sBledy(i)) then max = Textwidth(sBledy(i))
i += 1
Wend
max += 40
if size(KolTab2) < str.szer/max then grow KolTab2, (str.szer/max)-1 : grow StlTab2, (str.szer/max)-1
For i = 1 To i > str.szer/max
KolTab2(i) = max
StlTab2(i) = tn
Next i

tbl = tabela 0,0,KolTab2,StlTab2

tabela #tbl
k = 1
while k < size(sBledy)
i = 1
while k < size(sBledy) && i <= str.szer/max
kolumna i, sBledy(k)+LF
k += 1
i += 1
wend
wend
koniec
EndIf

close

Strona 1 z 1 Strefa czasowa UTC+1godz. [letni]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/