-
Notifications
You must be signed in to change notification settings - Fork 9
/
fakturareportForm.pas
433 lines (385 loc) · 12.9 KB
/
fakturareportForm.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
unit fakturareportForm;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, reportclientForm, ImgList, ActnList, RzPanel, ppViewr,
StdCtrls, RzLabel, ExtCtrls, DBCtrls, RzDBNav, RzButton, RzBckgnd,
Menus, globalvalues, ppMemo, ppBands, ppCtrls, ppReport, ppStrtch,
ppSubRpt, ppPrnabl, ppClass, ppCache, ppProd, ppDB, ppComm, ppRelatv,
ppDBPipe, data, RzCommon, RzForms, RzSndMsg, RzDlgBtn, ppModule, raCodMod;
Type
TfrmFakturaReport = class(TfrmReportClient)
FakturaDataPipe: TppDBPipeline;
FakturaReport: TppReport;
ppHeaderBand1: TppHeaderBand;
ppLabel1: TppLabel;
ppDBText5: TppDBText;
ppLabel6: TppLabel;
ppDBText7: TppDBText;
ppLabel8: TppLabel;
ppLabel9: TppLabel;
nFirmaNavn: TppLabel;
nFirmaTelefon: TppLabel;
nFirmaFaks: TppLabel;
nFirmaEPost: TppLabel;
nFirmaInternett: TppLabel;
nKundeNavn: TppDBText;
nKundeAdresse: TppDBText;
nKundePostNr: TppDBText;
nKundePostSted: TppDBText;
ppDBText21: TppDBText;
nMerk: TppDBText;
ppLabel35: TppLabel;
ppLabel13: TppLabel;
ppLabel14: TppLabel;
ppLabel15: TppLabel;
ppLabel16: TppLabel;
nKundeAdresse2: TppDBText;
ppDetailBand1: TppDetailBand;
ppShape4: TppShape;
ppSubReport1: TppSubReport;
ppChildReport1: TppChildReport;
ppDetailBand3: TppDetailBand;
ppDBText12: TppDBText;
ppDBText13: TppDBText;
ppDBText14: TppDBText;
ppDBText15: TppDBText;
ppDBText16: TppDBText;
ppLine4: TppLine;
ppDBText17: TppDBText;
ppFooterBand2: TppFooterBand;
ppLabel39: TppLabel;
ppLine1: TppLine;
ppLabel40: TppLabel;
ppLabel42: TppLabel;
ppLabel45: TppLabel;
ppLabel47: TppLabel;
ppLabel48: TppLabel;
ppLabel49: TppLabel;
ppLabel50: TppLabel;
ppLabel51: TppLabel;
ppFooterBand1: TppFooterBand;
ppDBText1: TppDBText;
ppLine3: TppLine;
ppDBMemo1: TppDBMemo;
ppDBText2: TppDBText;
ppDBText3: TppDBText;
ppDBText4: TppDBText;
ppLabel17: TppLabel;
ppLabel18: TppLabel;
ppLabel19: TppLabel;
ppLabel20: TppLabel;
ppLabel3: TppLabel;
ppLabel36: TppLabel;
ppLabel37: TppLabel;
ppLabel10: TppLabel;
ppLabel38: TppLabel;
ppDBText6: TppDBText;
ppLabel4: TppLabel;
ppLabel12: TppLabel;
ppDBText8: TppDBText;
RzFormState1: TRzFormState;
RzRegIniFile1: TRzRegIniFile;
ppLabel2: TppLabel;
ppLabel7: TppLabel;
ppLabel11: TppLabel;
ppLabel21: TppLabel;
ppLabel22: TppLabel;
ppLabel23: TppLabel;
ppLabel24: TppLabel;
lbPurreGebyr: TppLabel;
nPurregebyr: TppLabel;
lbRenter: TppLabel;
nRenter: TppLabel;
raCodeModule2: TraCodeModule;
ppDBText9: TppDBText;
ppDBText10: TppDBText;
ppDBText11: TppDBText;
ppDBText18: TppDBText;
ppDBText19: TppDBText;
FakturaPipe: TppDBPipeline;
ppLabel5: TppLabel;
ppLabel25: TppLabel;
procedure nFirmaNavnGetText(Sender: TObject; var Text: String);
procedure ppLabel13GetText(Sender: TObject; var Text: String);
procedure ppLabel14GetText(Sender: TObject; var Text: String);
procedure ppLabel15GetText(Sender: TObject; var Text: String);
procedure ppLabel16GetText(Sender: TObject; var Text: String);
procedure ppLabel42GetText(Sender: TObject; var Text: String);
procedure ppLabel40GetText(Sender: TObject; var Text: String);
procedure nKundeAdresse2GetText(Sender: TObject; var Text: String);
procedure ppLabel38GetText(Sender: TObject; var Text: String);
procedure ppLabel3GetText(Sender: TObject; var Text: String);
procedure ppLabel37GetText(Sender: TObject; var Text: String);
procedure ppLabel36GetText(Sender: TObject; var Text: String);
procedure ppLabel10GetText(Sender: TObject; var Text: String);
procedure ppDBText21GetText(Sender: TObject; var Text: String);
procedure ppLabel4GetText(Sender: TObject; var Text: String);
procedure ppDBText6GetText(Sender: TObject; var Text: String);
procedure ppLabel17GetText(Sender: TObject; var Text: String);
procedure ppLabel18GetText(Sender: TObject; var Text: String);
procedure ppLabel19GetText(Sender: TObject; var Text: String);
procedure ppLabel20GetText(Sender: TObject; var Text: String);
procedure ppDBText15GetText(Sender: TObject; var Text: String);
procedure ppDBText17GetText(Sender: TObject; var Text: String);
procedure ppLabel1GetText(Sender: TObject; var Text: String);
procedure ppDBText16GetText(Sender: TObject; var Text: String);
procedure ppDBText14GetText(Sender: TObject; var Text: String);
procedure ppDBText8GetText(Sender: TObject; var Text: String);
procedure nMerkGetText(Sender: TObject; var Text: String);
procedure ppLabel2GetText(Sender: TObject; var Text: String);
procedure ppLabel11GetText(Sender: TObject; var Text: String);
procedure ppLabel24GetText(Sender: TObject; var Text: String);
procedure ppLabel23GetText(Sender: TObject; var Text: String);
procedure nPurregebyrGetText(Sender: TObject; var Text: String);
procedure nRenterGetText(Sender: TObject; var Text: String);
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
Function RemoveKr(Value:String):String;
public
{ Public declarations }
end;
implementation
{$R *.DFM}
procedure TfrmFakturaReport.FormShow(Sender: TObject);
begin
If appdata.GetPurringer=0 then
Begin
lbPurreGebyr.Visible:=False;
lbRenter.Visible:=False;
nPurreGebyr.Visible:=False;
nRenter.Visible:=False;
end;
inherited;
end;
procedure TfrmFakturaReport.nFirmaNavnGetText(Sender: TObject;var Text: String);
begin
Text:=AppData.Prefs.ReadString(PREFS_FIRMA);
end;
procedure TfrmFakturaReport.ppLabel13GetText(Sender: TObject;var Text: String);
begin
Text:=AppData.Prefs.ReadString(PREFS_TELEFON);
end;
procedure TfrmFakturaReport.ppLabel14GetText(Sender: TObject;var Text: String);
begin
Text:=AppData.Prefs.ReadString(PREFS_FAX);
end;
procedure TfrmFakturaReport.ppLabel15GetText(Sender: TObject;var Text: String);
begin
Text:=AppData.Prefs.ReadString(PREFS_EMAIL);
end;
procedure TfrmFakturaReport.ppLabel16GetText(Sender: TObject;var Text: String);
begin
Text:=AppData.Prefs.ReadString(PREFS_WWW);
end;
procedure TfrmFakturaReport.ppLabel42GetText(Sender: TObject;var Text: String);
var
FValue: Currency;
begin
FValue:=Appdata.FakturaPris.AsCurrency - AppData.FakturaData.GetSum('eksmva');
Text:=CurrToStrF(FValue,ffFixed,2);
end;
procedure TfrmFakturaReport.nKundeAdresse2GetText(Sender: TObject;var Text: String);
begin
Text:=AppData.Faktura.FieldByName('Adresse2').AsString;
if length(Text)=0 then
text:='-';
end;
procedure TfrmFakturaReport.ppLabel38GetText(Sender: TObject;var Text: String);
var
FEnd: TDateTime;
FDager: Integer;
begin
{ Regne ut forfallsdato }
FEnd :=AppData.FakturaDato.AsDateTime;
FDager:=AppData.FakturaBetalingsfrist.asInteger;
FEnd:=(FEnd + FDager);
Text:=DateToStr(FEnd);
end;
procedure TfrmFakturaReport.ppLabel3GetText(Sender: TObject;var Text: String);
begin
Text:=AppData.Prefs.ReadString(PREFS_KONTIE);
end;
procedure TfrmFakturaReport.ppDBText21GetText(Sender: TObject;var Text: String);
begin
If (appdata.GetPurringer>0)
or (Appdata.FakturaForfallt.asBoolean=True) then
Text:='** Omgående' else
Text:=(Text + ' ' + 'dager');
end;
procedure TfrmFakturaReport.ppLabel4GetText(Sender: TObject;var Text: String);
begin
Text:=AppData.Prefs.ReadString(PREFS_ADRESSE_B);
end;
procedure TfrmFakturaReport.ppDBText6GetText(Sender: TObject;var Text: String);
begin
if length(Text)=0 then
Text:='-';
end;
procedure TfrmFakturaReport.ppLabel17GetText(Sender: TObject;var Text: String);
begin
Text:=AppData.Prefs.ReadString(PREFS_FIRMA);
end;
procedure TfrmFakturaReport.ppLabel18GetText(Sender: TObject;var Text: String);
begin
Text:=AppData.Prefs.ReadString(PREFS_ADRESSE_A);
end;
procedure TfrmFakturaReport.ppLabel19GetText(Sender: TObject;var Text: String);
begin
Text:=IntToStr(AppData.Prefs.ReadInteger(PREFS_POSTNR));
end;
procedure TfrmFakturaReport.ppLabel20GetText(Sender: TObject;var Text: String);
begin
Text:=AppData.Prefs.ReadString(PREFS_STED);
end;
procedure TfrmFakturaReport.ppDBText15GetText(Sender: TObject;var Text: String);
begin
text:=Text+'%';
end;
procedure TfrmFakturaReport.ppDBText17GetText(Sender: TObject;var Text: String);
begin
text:=Text + '%';
end;
procedure TfrmFakturaReport.ppLabel1GetText(Sender: TObject;var Text: String);
begin
Case Appdata.FakturaStatus.asInteger of
FAKTURA_BETALT,FAKTURA_KREDITNOTA:
Begin
Text:=StatusToPrintStr(AppData.FakturaStatus.asInteger);
end;
else
Begin
if (appdata.fakturaVarsel.asInteger>0) then
Text:='Inkassovarsel' else
If (appdata.fakturapurringer.asInteger>0) then
Text:='Purring' else
Text:=StatusToPrintStr(AppData.FakturaStatus.asInteger);
end;
end;
end;
procedure TfrmFakturaReport.ppDBText16GetText(Sender: TObject;var Text: String);
begin
text:=RemoveKr(text);
end;
Function TfrmFakturaReport.RemoveKr(Value:String):String;
var
xpos: Integer;
begin
xpos:=pos('kr ',lowercase(value));
if xpos>0 then
Delete(value,1,xpos + 2);
result:=Value;
end;
procedure TfrmFakturaReport.ppDBText14GetText(Sender: TObject;var Text: String);
begin
text:=removeKr(Text);
end;
procedure TfrmFakturaReport.ppDBText8GetText(Sender: TObject;var Text: String);
begin
text:=removeKr(Text);
end;
procedure TfrmFakturaReport.nMerkGetText(Sender: TObject;var Text: String);
begin
If appdata.fakturastatus.AsInteger=FAKTURA_KREDITNOTA then
text:='Refereres til faktura nummer: ' +
Appdata.fakturaFakturaRef.AsString;
end;
procedure TfrmFakturaReport.ppLabel11GetText(Sender: TObject;var Text: String);
begin
Text:=AppData.Prefs.ReadString(PREFS_ORGID);
end;
procedure TfrmFakturaReport.ppLabel24GetText(Sender: TObject;var Text: String);
begin
Text:=AppData.Faktura.FieldbyName('dinref').asString;
end;
procedure TfrmFakturaReport.ppLabel23GetText(Sender: TObject;var Text: String);
begin
Text:=AppData.Faktura.FieldbyName('minref').asString;
end;
procedure TfrmFakturaReport.ppLabel40GetText(Sender: TObject;var Text: String);
var
FValue: Currency;
begin
FValue:=AppData.FakturaData.GetSum('eksmva');
Text:=CurrToStrF(FValue,ffFixed,2);
end;
procedure TfrmFakturaReport.nPurregebyrGetText(Sender: TObject;var Text: String);
begin
If appdata.GetPurringer>0 then
Text:='Kr. ' + CurrToStrF(appdata.GetGebyrValue,ffFixed,2) else
Text:='Kr. 0,0';
end;
procedure TfrmFakturaReport.nRenterGetText(Sender: TObject;var Text: String);
begin
If appdata.GetPurringer>0 then
Text:='Kr. ' + CurrToStrF(appdata.GetRentervalue,ffFixed,2) else
Text:='Kr. 0,0';
end;
procedure TfrmFakturaReport.ppLabel2GetText(Sender: TObject;var Text: String);
var
FValue: Currency;
begin
FValue:=AppData.FakturaPris.Value;
Text:=CurrToStrF(FValue,ffFixed,2);
end;
procedure TfrmFakturaReport.ppLabel36GetText(Sender: TObject;var Text: String);
var
FText: String;
xpos: Integer;
FValue: Currency;
begin
{FValue:=AppData.FakturaPris.Value;
If GetPurringer>0 then
Begin
//FValue:=FValue + (FValue - AppData.FakturaData.GetSum('eksmva'));
FValue:=FValue + GetGebyrValue;
FValue:=FValue + GetRenterValue;
end;}
FValue:=Appdata.FakturaTotal.asCurrency;
FText:=CurrToStrF(FValue,ffFixed,2);
xpos:=pos(',',FText);
if xpos>0 then
Delete(FText,xpos,length(FText));
Text:=FText;
end;
procedure TfrmFakturaReport.ppLabel10GetText(Sender: TObject;var Text: String);
var
FValue: Currency;
begin
{FValue:=AppData.FakturaPris.Value;
If GetPurringer>0 then
Begin
//FValue:=FValue + (FValue - AppData.FakturaData.GetSum('eksmva'));
FValue:=FValue + GetGebyrValue;
FValue:=FValue + GetRenterValue;
end;}
FValue:=Appdata.FakturaTotal.asCurrency;
Text:=CurrToStrF(FValue,ffFixed,2);
end;
procedure TfrmFakturaReport.ppLabel37GetText(Sender: TObject;var Text: String);
var
FText: String;
xpos: Integer;
FValue: Currency;
begin
{FValue:=AppData.FakturaPris.Value;
If GetPurringer>0 then
Begin
//FValue:=FValue + (FValue - AppData.FakturaData.GetSum('eksmva'));
FValue:=FValue + GetGebyrValue;
FValue:=FValue + GetRenterValue;
end;}
FValue:=Appdata.FakturaTotal.asCurrency;
FText:=CurrToStrF(FValue,ffFixed,2);
xpos:=pos(',',FText);
if xpos>0 then
Delete(FText,1,xpos);
Ftext:=trim(FText);
Text:=FText;
end;
procedure TfrmFakturaReport.FormClose(Sender: TObject;var Action: TCloseAction);
begin
fakturaPipe.close;
FakturaDataPipe.close;
end;
end.