; verze z 25.1.2019 ; Autor: Milan Slíva Name('Adresář dle PSČ') ; pod tímto názvem bude sestava v menu FileName('Adr2.WNS') ; pod tímto názvem bude sestava uložena na disku Designed('Adrman') ; sestava bude dostupná z okna Adrman Author('Milan Slíva','sliva@fi.cz') DeclareRec('Program') DeclareRec('Adresar') ; přiřadí a definuje větu z adresáře DeclareRec('KeyAdresar1') ; přiřazení a definice třídícího klíče DeclareRec('SkladFirmy') DeclareRec('KeySkladFirmy3') WNSType(1); Record Klic Length:Byte; PSC :LongInt; Nazev :Array[0..35] of Char; end Veta:LongInt VetaF:LongInt Pozice:LongInt ActDate:Word=GetDate(); OK:Boolean BylaPo:Boolean LastDate:Word LocL:LongInt TempStr:String MakeTempFile(,Klic,true,false) InitStatus(UsedKeys(KeyAdresar1),'Třídím data') NewWns('AdrSlevy.WNS'); SetDescr(0,0,TA_Right|descr_PageNum,'Strana: '); SetDescr(1,1,TA_Center,'Výpis firem dle PSČ'); SetDescr(2,0,TA_Left|descr_Date,'Datum: '); SetDescr(3,2,TA_Left|descr_UserDescr,''); pokud je pouzit descr_UserDescr, tak si program vyzada dodatecny popis if(IsFilter(Adresar)) ; dotaz, zda je aktivní filtr do sestav begin SetDescr(4,2,TA_Right,'Aktívní filtr'); end SetColumn(0,ta_Right,5); {pořadové číslo} SetColumn(1,ta_Right,10); {IČ} SetColumn(2,ta_Left,35); {Nazev} SetColumn(3,ta_Left,35); {Mesto} SetColumn(4,ta_Right,6); {PSC} SetHead('\tIČ\tnázev\tměsto\tPSČ'); ClearKey(KeyAdresar1); While(NextKey(KeyAdresar1,Veta)) begin ReadRec(Adresar,Veta) if(InFilter(Adresar)) begin Klic.Length=SizeOf(Klic)-1 Klic.PSC=SwapL(Val(NTrim(Adresar.PSC))) StrToChars(Klic.Nazev,XTransStr(Adresar.Nazev)) AddKey(Klic,Veta) end Inc(Pozice); SetStatus(Pozice); end; InitStatus(UsedKeys(Klic),'Vytvářím sestavu') Pozice=0 ClearKey(Klic); While(NextKey(Klic,Veta)) begin Inc(Pozice); ReadRec(Adresar,Veta) TempStr='' if((Program.Sklady) and (Program.UserFlags&$2000<>0)) then begin LastDate=0; KeySkladFirmy3.Length=4; KeySkladFirmy3.ICO=SwapL(Adresar.ICO); BylaPo=False OK=SearchKey(KeySkladFirmy3,VetaF); While((OK) and (KeySkladFirmy3.ICO=SwapL(Adresar.ICO)) and (not BylaPo)) do begin ReadRec(SkladFirmy,VetaF); if(SkladFirmy.LastDateV>LastDate) begin LastDate=SkladFirmy.LastDateV; BylaPo=CountDay(LastDate,ActDate)<=Program.DayLimit[1]; end; OK=NextKey(KeySkladFirmy3,VetaF); end; if(LastDate<>0) begin LocL=CountDay(LastDate,ActDate); if(LocL>Program.DayLimit[2]) then begin TempStr=#28+#$0D+#$01; end else if(LocL>Program.DayLimit[1]) then begin TempStr=#28+#$0F+#$03; end else begin TempStr=#28+#$0E+#$02; end; end; end; AddLine(Str(Pozice),TempStr+Str(Adresar.ICO),Adresar.Nazev,Adresar.Mesto,NTrim(Adresar.PSC)); SetStatus(Pozice); end; END ; konec programu