[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

Programming error in Delphi - Exception class EConvertError with message  is not a valid integer value.

Asked by dylciara in Delphi Database, Algorithms

Tags: Exception class EConvertError with message  is not a valid integer value, Delphi, Programming, database

I have created a database like program in the language pascal / delphi. The program has been working yesterday, until today, when I started it, an error message appeared .  is not a valid integer value. The program then continues to work.

I have not altered the code and the only thing that I can think might have triggered the problem is that certain algorithms begin on the first day of the month - mainly transferring completed records into another table. These algorithms have been working on previous months.

Please help. I have included the code on the opening form - the form in which the problem occurs every time the form is activated.
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:
434:
435:
436:
437:
438:
439:
440:
441:
442:
443:
444:
445:
446:
447:
448:
449:
450:
451:
452:
453:
454:
455:
456:
457:
458:
459:
460:
461:
462:
463:
464:
465:
466:
467:
468:
469:
470:
471:
472:
473:
474:
475:
476:
477:
478:
479:
480:
481:
482:
483:
484:
485:
486:
487:
488:
489:
490:
491:
492:
493:
494:
495:
496:
497:
498:
499:
500:
501:
502:
503:
504:
505:
506:
507:
508:
509:
510:
511:
512:
513:
514:
515:
516:
517:
518:
519:
520:
521:
522:
523:
524:
525:
526:
527:
528:
529:
530:
531:
532:
533:
534:
535:
536:
537:
538:
539:
540:
541:
542:
543:
544:
545:
546:
547:
548:
549:
550:
551:
552:
553:
554:
555:
556:
557:
558:
559:
560:
561:
562:
563:
564:
565:
566:
567:
568:
569:
570:
571:
572:
573:
574:
575:
576:
577:
578:
579:
580:
581:
582:
583:
584:
585:
586:
587:
588:
589:
590:
591:
592:
593:
594:
595:
596:
597:
598:
599:
600:
601:
602:
603:
604:
605:
606:
607:
608:
609:
610:
611:
612:
613:
614:
615:
616:
617:
618:
619:
620:
621:
622:
623:
624:
625:
626:
627:
628:
629:
630:
631:
632:
633:
634:
635:
636:
637:
638:
639:
640:
641:
642:
643:
644:
645:
646:
647:
648:
649:
650:
651:
652:
653:
654:
655:
656:
657:
658:
659:
660:
661:
662:
663:
664:
665:
666:
667:
668:
669:
670:
671:
672:
673:
674:
675:
676:
677:
678:
679:
680:
681:
682:
683:
684:
685:
686:
687:
688:
689:
690:
691:
692:
693:
694:
695:
696:
697:
698:
699:
700:
701:
702:
703:
704:
705:
706:
707:
708:
709:
710:
711:
712:
unit EtempaMain;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, jpeg, ExtCtrls;
 
type
  TfrmEtempaMain = class(TForm)
    ecommercebanner: TImage;
    webdesignbanner: TImage;
    imgButtonCloseDown: TImage;
    imgButtonClose: TImage;
    procedure imgButtonCloseMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure imgButtonCloseClick(Sender: TObject);
    procedure ecommercebannerClick(Sender: TObject);
    procedure webdesignbannerClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure imgButtonCloseMouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  end;
 
  EcommerceClientRecord = record {Declare EcommerceClient record}
    ClientID : string[6];
    FirstName, Surname, Address1, Address2, Town, County, Email : string[40];
    Postcode : string[9];           {Declare field names}
    PhoneNumber : string[12];
    CommissionRate : integer;
  end;
 
  EcommerceItemsRecord = record   {Declare EcommerceItems record}
    ClientID, ItemID : string[6];
    ItemName : string[40];
    TimesListed, Weight : integer; {Declare field names}
    DateListed : string[10];
    Picture, Invoiced, Finished : boolean;
    ListingFee, SalePrice, Postage, ActualPostage, FinalAmount, EtempaFee,
    ClientsAmount : real;
  end;
 
  EcommerceSalesRecord = record       {Declare EcommerceSales record}
    ClientID, ItemID : string[6];
    ItemName : string[40];
    DateListed : string[10];   {Declare field names}
    TimesListed : integer;
    FinalAmount, EtempaFee : real;
  end;
 
  EcommerceTakingsRecord = record   {Declare EcommerceTakings record}
    April, May, June, July, August, September, October, November, December,
    January, February, March, YearlyTotal : real;  {Declare field names}
    Year : integer;
  end;
 
  EcommerceExpensesRecord = record   {Declare EcommerceExpenses record}
    Date : TDateTime;
    ExpenseType : string [12];
    ExpenseName : string [20];
    ExpenseAmount : real;        {Declare field names}
  end;
 
  WebDesignClientRecord = record    {Declare WebDesignClient record}
    ClientID : string[6];
    FirstName, Surname, Address1, Address2, Town, County, Email : string[40];
    Postcode : string[9];         {Declare field names}
    PhoneNumber : string[12];
  end;
 
  WebDesignWebsiteRecord = record       {Declare WebDesignWebsite record}
    ClientID, WebsiteID : string[6];
    WebAddress, WebsiteName : string[40];
    BeginDate : TDateTime;
    WebsitePrice, DepositAmount : real;{Declare field names}
    WebsiteStatus : string[30];
    DepositReceived, PaymentReceived, Completed, EtempaFamily : boolean;
    WebPackage : string[15];
  end;
 
  WebDesignServerRecord = record      {Declare WebDesignServer record}
    WebsiteID, ServerID : string[6];
    DomainName, DomainPassword, UserName, Password, DomainHoster : string[20];
    HostingPrice, DomainPrice, TotalPrice : real;  {Declare field names}
    HomeHosted, TransferComplete : boolean;
    OpenAccountDate : string[10];
    WebHoster : string[40];
  end;
 
  WebDesignFamilyRecord = record       {Declare WebDesignFamily record}
    ClientID, WebsiteID, ServerID : string[6];
    WebAddress, WebHoster,WebsiteName : string[40];
    Claims : integer;
    DateJoined, PaymentDue : TDateTime;    {Declare field names}
    PaymentReceived : boolean;
  end;
 
  WebDesignOldSitesRecord = record      {Declare WebDesignOldSites record}
    ClientID, WebsiteID : string[6];
    WebAddress, WebHoster,WebsiteName : string[40];
    BeginDate, DateAdded : TDateTime;           {Declare field names}
    WebsitePrice : real;
    WebPackage : string[15];
  end;
 
  WebDesignTakingsRecord = record    {Declare WebDesignTakings record}
    April, May, June, July, August, September, October, November, December,
    January, February, March, YearlyTotal : real;  {Declare field names}
    Year : integer;
  end;
 
var
  frmEtempaMain: TfrmEtempaMain;
  EClient : EcommerceClientRecord;
  EClientFile : file of EcommerceClientRecord;
  EItems : EcommerceItemsRecord;
  EItemsFile : file of EcommerceItemsRecord;
  ESales : EcommerceSalesRecord;
  ESalesFile : file of EcommerceSalesRecord;
  ETakings : EcommerceTakingsRecord;
  ETakingsFile : file of EcommerceTakingsRecord;
  EExpenses : EcommerceExpensesRecord;
  EExpensesFile : file of EcommerceExpensesRecord;
  WDClient : WebDesignClientRecord;
  WDClientFile : file of WebDesignClientRecord;
  WDWebsite : WebDesignWebsiteRecord;
  WDWebsiteFile : file of WebDesignWebsiteRecord;
  WDServer : WebDesignServerRecord;
  WDServerFile : file of WebDesignServerRecord;
  WDFamily : WebDesignFamilyRecord;
  WDFamilyFile : file of WebDesignFamilyRecord;
  WDOldSites : WebDesignOldSitesRecord;
  WDOldSitesFile : file of WebDesignOldSitesRecord;
  WDTakings : WebDesignTakingsRecord;
  WDTakingsFile : file of WebDesignTakingsRecord;
  EClientIDIntFile : file of integer;
  EClientInt : integer;
  EItemIDIntFile : file of integer;
  EItemInt : integer;
  WDClientIDIntFile : file of integer;
  WDClientInt : integer;
  WDWebsiteIDIntFile : file of integer;
  WDWebsiteInt : integer;
  WDServerIDIntFile : file of integer;
  WDServerInt : integer;
  LastDateFile : file of TDateTime;
  LastDate : TDateTime;
  StartDir : string;
  FolderDir : string;
  Year : word;
 
implementation
 
uses Ecommerce, WebDesign;
 
{$R *.dfm}
 
procedure TfrmEtempaMain.ecommercebannerClick(Sender: TObject);
begin
  frmEtempaMain.visible := false;  {Close EtempaMain form}
  frmEcommerce.show;       {Go to Ecommerce form}
end;
 
procedure TfrmEtempaMain.FormActivate(Sender: TObject);
var
  RecordPosition, TransferNumber, TakingsRecordPosition, YearInt,
  SalesRecordPosition, SalesMonthInt, SalesYearInt, DeleteNumber,
  SitesDeleteNumber, OldSitesRecordPosition, OldSitesYearInt, OldSitesMonthInt,
  MonthInt : integer;
  DateListedYear, DateListedMonth, SalesMonth, SalesYear, OldSitesYear,
  OldSitesMonth, DateAddedString, WebsiteNotesFileName : string;
  Profit, TempProfit, YearlyTotalAmount : real;
  Year, Month, Day, LastYear, LastMonth, LastDay : Word;
begin
  reset (LastDateFile);
  read (LastDateFile, LastDate);
  decodedate (LastDate, LastYear, LastMonth,LastDay);{Get LastDate and split up}
  closefile (LastDateFile);
 
  decodedate (Date, Year, Month, Day); {Get Today's Date and split up}
 
  if (Month > LastMonth) or (Year > LastYear) then {If it is next month}
    begin
      TransferNumber := 0;   {Set initial values}
      RecordPosition := -1;
 
      reset(EItemsFile);
 
      while (not EOF(EItemsFile)) do
        begin
          read(EItemsFile, EItems); {Read EItems record}
          inc(RecordPosition);        {Increase RecordPosition by 1}
 
          if EItems.Invoiced = true then     {If it has been invoiced}
            begin
             inc (Transfernumber); {Increase TransferNumber by 1}
 
             ESales.ClientID := EItems.ClientID;
             ESales.ItemID := EItems.ItemID;  {Assign values to ESalesFile}
             ESales.ItemName := EItems.ItemName;
             ESales.DateListed := EItems.DateListed;
             ESales.TimesListed := EItems.TimesListed;
             ESales.FinalAmount := EItems.FinalAmount;
             ESales.EtempaFee := EItems.EtempaFee;
 
             Profit := EItems.EtempaFee;   {Get Profit value from EItems file}
 
             reset (ESalesFile);
             seek (ESalesFile, FileSize(ESalesFile));
             write (ESalesFile, ESales);  {Write a new record to ESalesFile}
             closefile(ESalesFile);
 
             DateListedYear:=copy(EItems.DateListed,7,4);
             YearInt := strtoint(DateListedYear);     {Get DateListed Year}
 
             DateListedMonth:=copy(EItems.DateListed,4,2);{Get DateListed Month}
             MonthInt := strtoint(DateListedMonth);     {Get DateListed Month}
 
             TakingsRecordPosition := -1; {Set initial value}
 
             reset (ETakingsFile);
             while (not EOF(ETakingsFile)) do
               begin
                 read(ETakingsFile, ETakings); {Read ETakings file record}
                 inc(TakingsRecordPosition);{Increase TakingsRcordPosition by 1}
 
                 if ETakings.Year = YearInt then {If it is the same year}
                   begin
                     YearlyTotalAmount := ETakings.YearlyTotal
                     + Profit;{Recalculate YearlTotalAmount}
 
                     ETakings.YearlyTotal :=
                     YearlyTotalAmount;{Assign YearlyTotalAmount to TakingsFile}
 
                     case MonthInt of
                       1 : begin      {If Month is Jan}
                             TempProfit := Profit + ETakings.January;
                             ETakings.January :=
                             TempProfit;{Assign Jan's Profit to TakingsFile}
                           end;
 
                       2 : begin {If Month is Feb}
                             TempProfit := Profit + ETakings.February;
                             ETakings.February :=
                             TempProfit; {Assign Feb's Profit to TakingsFile}
                           end;
 
                       3 : begin {If Month is Mar}
                             TempProfit := Profit + ETakings.March;
                             ETakings.March :=
                             TempProfit; {Assign Mar's Profit to TakingsFile}
                           end;
 
                       4 : begin {If Month is Apr}
                            TempProfit := Profit + ETakings.April;
                            ETakings.April :=
                            TempProfit; {Assign Apr's Profit to TakingsFile}
                           end;
 
                       5 : begin {If Month is May}
                             TempProfit := Profit + ETakings.May;
                             ETakings.May :=
                             TempProfit; {Assign May's Profit to TakingsFile}
                           end;
 
                       6 : begin {If Month is Jun}
                             TempProfit := Profit + ETakings.June;
                             ETakings.June :=
                             TempProfit; {Assign Jun's Profit to TakingsFile}
                           end;
 
                       7 : begin {If Month is Jul}
                             TempProfit := Profit + ETakings.July;
                             ETakings.July :=
                             TempProfit; {Assign Jul's Profit to TakingsFile}
                           end;
 
                       8 : begin {If Month is Aug}
                             TempProfit := Profit + ETakings.August;
                             ETakings.August :=
                             TempProfit; {Assign Aug's Profit to TakingsFile}
                           end;
 
                       9 : begin {If Month is Sep}
                             TempProfit := Profit + ETakings.September;
                             ETakings.September :=
                             TempProfit; {Assign Sep's Profit to TakingsFile}
                           end;
 
                       10 : begin {If Month is Oct}
                              TempProfit := Profit + ETakings.October;
                              ETakings.October :=
                              TempProfit; {Assign Oct's Profit to TakingsFile}
                            end;
 
                       11 : begin {If Month is Nov}
                              TempProfit := Profit + ETakings.November;
                              ETakings.November :=
                              TempProfit; {Assign Nov's Profit to TakingsFile}
                            end;
 
                       12 : begin {If Month is Dec}
                              TempProfit := Profit + ETakings.December;
                              ETakings.December :=
                              TempProfit; {Assign Dec's Profit to TakingsFile}
                            end;
                     end;  {case}
 
                     seek (ETakingsFile, TakingsRecordPosition);
                     write(ETakingsFile, ETakings);{Rewrite record to ETakings}
                   end;
                 {end if}
               end;
             {end while}
             closefile(ETakingsFile);
 
             seek (EItemsFile, FileSize(EItemsFile) - 1);
             read (EItemsFile, EItems);
             seek (EItemsFile, RecordPosition);
             write (EItemsFile, EItems);
             seek (EItemsFile, FileSize(EItemsFile) - 1);
             truncate (EItemsFile); {Replace deleted record with last record}
 
             seek (EItemsFile, RecordPosition); {Go back to last record}
             dec (RecordPosition); {Decrease recordposition}
            end;
          {end if}
        end;
      {end while}
 
      if TransferNumber > 0 then   {If any records have been transfered}
        messagedlg ('You Have Transferred ' + inttostr(TransferNumber) +
        ' Records From the Items Table.', mtInformation, [mbOK],
        0);   {Send an information message to confirm transfer}
      {end if}
 
      closefile(EItemsFile);
    end;
  {end if}
 
  DeleteNumber := 0; {Set initial values}
  SalesRecordPosition := -1;
 
  reset (ESalesFile);
  while not EOF (ESalesFile) do
    begin
      read (ESalesFile, ESales); {Read EItems record}
      inc (SalesRecordPosition);  {Increase SalesRecordPosition by 1}
 
      SalesMonth := copy(ESales.DateListed,4,2);
      SalesMonthInt := strtoint(SalesMonth); {Get DateListed Month}
 
      SalesYear := copy(ESales.DateListed,7,4);
      SalesYearInt := strtoint(SalesYear);   {Get DateListed Year}
 
      if (SalesMonthInt = 11)or(SalesMonthInt =12)then {If  Month is Nov or Dec}
        begin
          SalesMonthInt := 0;         {Month is 0}
          SalesYearInt := SalesYearInt + 1;  {Year Becomes Next Year}
        end;
      {end if};
 
      if (Month > SalesMonthInt + 1) and (Year > SalesYearInt)
      then {If it's a year and 3 months later}
        begin
          reset (ESalesFile);
          seek (ESalesFile, FileSize(ESalesFile) - 1);
          read (ESalesFile, ESales);
          seek (ESalesFile, SalesRecordPosition);
          write (ESalesFile, ESales);
          seek (ESalesFile, FileSize(ESalesFile) - 1);
          truncate (ESalesFile); {Replace deleted record with last record}
 
          seek (ESalesFile, SalesRecordPosition);  {Go back to last record}
          dec (SalesRecordPosition); {Decrease Salesrecordposition}
 
          inc (DeleteNumber);    {Increase DeleteNumber by 1}
        end;
      {end if}
    end;
  {end while}
  closefile (ESalesFile);
 
  if DeleteNumber > 0 then  {If records have been deleted}
    messagedlg (inttostr(DeleteNumber) + ' Old Sales Records Have Been Deleted!'
    , mtInformation, [mbOK], 0);{Send an information message to confirm delete}
  {end if}
 
  SitesDeleteNumber := 0;  {Set Initial Values}
  OldSitesRecordPosition := -1;
 
  reset (WDOldSitesFile);
  while not EOF (WDOldSitesFile) do
    begin
      read (WDOldSitesFile, WDOldSites); {Read WDOldSites record}
      inc (OldSitesRecordPosition);   {Increase OldSitesRecordPosition by 1}
 
      DateAddedString := datetostr(WDOldSites.DateAdded); {Get DateAdded}
 
      OldSitesMonth := copy(DateAddedString,4,2);
      OldSitesMonthInt := strtoint(OldSitesMonth);{Get DateAdded Month}
 
      if OldSitesMonth = '11' then     {If the Month is November}
        OldSitesMonth := '0'         {Month is 0}
      {end if};
 
      if OldSitesMonth = '12' then     {If the Month is December}
        OldSitesMonth := '-1'         {Month is -1}
      {end if};
 
      OldSitesYear := copy(DateAddedString,7,4);
      OldSitesYearInt := strtoint(OldSitesYear); {Get DateAdded Year}
 
      if (Month > OldSitesMonthInt + 1) and (Year > OldSitesYearInt)
      then      {If it's a year and 2 months later}
        begin
          WebsiteNotesFileName := FolderDir + WDOldSites.WebsiteID +
          '.txt'; {Create WebsiteNotesFileName}
 
          if FileExists(WebsiteNotesFileName) then  {If it exists}
            DeleteFile(WebsiteNotesFileName);    {Delete the file}
          {end if}
 
          reset (WDOldSitesFile);
          seek (WDOldSitesFile, FileSize(WDOldSitesFile) - 1);
          read (WDOldSitesFile, WDOldSites);
          seek (WDOldSitesFile, OldSitesRecordPosition);
          write (WDOldSitesFile, WDOldSites);
          seek (WDOldSitesFile, FileSize(WDOldSitesFile) - 1);
          truncate (WDOldSitesFile);{Replace deleted record with last record}
 
          seek (WDOldSitesFile, OldSitesRecordPosition);{Go back to last record}
          dec (OldSitesRecordPosition); {Decrease OldSitesrecordposition}
 
          inc (SitesDeleteNumber); {Increase SitesDeleteNumber by 1}
        end;
      {end if}
    end;
  {end while}
  closefile (WDOldSitesFile);
 
  if SitesDeleteNumber > 0 then     {If records have been deleted}
    messagedlg (inttostr(SitesDeleteNumber) +
    ' Old Site Records Have Been Deleted!' , mtInformation, [mbOK],
    0); {Send an information message to confirm delete}
  {end if}
 
  reset(LastDateFile);
  LastDate := Date;   {Get today's date}
  write(LastDateFile, LastDate);  {Save today's date}
  closefile(LastDateFile);
end;
 
procedure ETakingsFileSetUp;
begin
  ETakings.Year := Year;
  ETakings.January := 0.00;
  ETakings.February := 0.00;
  ETakings.March := 0.00;
  ETakings.April := 0.00;
  ETakings.May := 0.00;    {Assign value to ETakingsFile}
  ETakings.June := 0.00;
  ETakings.July := 0.00;
  ETakings.August := 0.00;
  ETakings.September := 0.00;
  ETakings.October := 0.00;
  ETakings.November := 0.00;
  ETakings.December := 0.00;
  ETakings.YearlyTotal := 0.00;
 
  seek (ETakingsFile, FileSize(ETakingsFile));
  write (ETakingsFile, ETakings);  {Write a new record to ETakingsFile}
end;
 
procedure WDTakingsFileSetUp;
begin
  WDTakings.Year := Year;
  WDTakings.January := 0.00;
  WDTakings.February := 0.00;
  WDTakings.March := 0.00;
  WDTakings.April := 0.00;
  WDTakings.May := 0.00;
  WDTakings.June := 0.00;
  WDTakings.July := 0.00;
  WDTakings.August := 0.00;
  WDTakings.September := 0.00;
  WDTakings.October := 0.00;
  WDTakings.November := 0.00;
  WDTakings.December := 0.00;
  WDTakings.YearlyTotal := 0.00;
  seek (WDTakingsFile, FileSize(WDTakingsFile));
  write (WDTakingsFile, WDTakings);
end;
 
procedure TfrmEtempaMain.FormCreate(Sender: TObject);
var
  Month, Day : word;
begin
  StartDir := GetCurrentDir;    {Get location of program}
  FolderDir := StartDir + '\WebsiteNotes\';  {Create WebsiteNotes address}
 
  assignfile(LastDateFile, 'lastdatefile.dat'); {Assign variable to file name}
  if not fileexists ('lastdatefile.dat')then  {If the file doesn't exist}
    begin
      LastDate := Date;     {Get today's date}
 
      rewrite (LastDateFile); {Create file}
      write(LastDateFile, LastDate);    {Write variable to file}
      closefile (LastDateFile);
    end
  {end if};
 
  assignfile (EClientFile, 'eclientfile.dat'); {Assign variable to file name}
  if not fileexists ('eclientfile.dat') then      {If the file doesn't exist}
    begin
      rewrite (EClientFile);  {Create file}
      closefile (EClientFile)
    end
  {endif};
 
  assignfile(EClientIDIntFile,'eclientidint.dat');{Assign variable to file name}
  if not fileexists ('eclientidint.dat') then       {If the file doesn't exist}
    begin
      EClientInt := 0;    {Set initial value}
 
      rewrite (EClientIDIntFile);  {Create file}
      write (EClientIDIntFile, EClientInt); {Write variable to file}
      closefile (EClientIDIntFile);
    end
  {endif};
 
  assignfile (EItemsFile, 'eitemsfile.dat'); {Assign variable to file name}
  if not fileexists ('eitemsfile.dat') then  {If the file doesn't exist}
    begin
      rewrite (EItemsFile);    {Create file}
      closefile (EItemsFile)
    end
  {endif};
 
  assignfile (EItemIDIntFile, 'eitemidint.dat');  {Assign variable to file name}
  if not fileexists ('eitemidint.dat') then   {If the file doesn't exist}
    begin
      EItemInt := 0;     {Set initial value}
 
      rewrite (EItemIDIntFile); {Create file}
      write (EItemIDIntFile, EItemInt);   {Write variable to file}
      closefile (EItemIDIntFile);
    end
  {endif};
 
  assignfile (ESalesFile, 'esalesfile.dat');  {Assign variable to file name}
  if not fileexists ('esalesfile.dat') then    {If the file doesn't exist}
    begin
      rewrite (ESalesFile); {Create file}
      closefile (ESalesFile)
    end
  {endif};
 
  assignfile (ETakingsFile, 'etakingsfile.dat');  {Assign variable to file name}
  if not fileexists ('etakingsfile.dat') then {If the file doesn't exist}
    begin
      rewrite (ETakingsFile);  {Create file}
      closefile (ETakingsFile)
    end
  {endif};
 
  decodedate (Date, Year, Month, Day); {Get Today's Date and split up}
 
  reset (ETakingsFile);
  if FileSize(ETakingsFile) = 0 then  {If ETakingsFile is empty}
    ETakingsFileSetUp;
  {end if}
 
  seek (ETakingsFile, FileSize(ETakingsFile) - 1); {Locate the last record}
  read (ETakingsFile, ETakings); {Read ETakings record}
 
  if Year > ETakings.Year then {If year is after the last year in ETakings file}
    ETakingsFileSetUp;
  {end if}
 
  assignfile (EExpensesFile, 'eexpensesfile.dat');  {Assign variable to file name}
  if not fileexists ('eexpensesfile.dat') then {If the file doesn't exist}
    begin
      rewrite (EExpensesFile);  {Create file}
      closefile (EExpensesFile)
    end
  {endif};
 
  assignfile (WDClientFile, 'wdclientfile.dat');{Assign variable to file name}
  if not fileexists ('wdclientfile.dat') then {If the file doesn't exist}
    begin
      rewrite (WDClientFile);  {Create file}
      closefile (WDClientFile)
    end
  {endif};
 
  assignfile(WDClientIDIntFile,'wclientidint.dat');{Assign variable to filename}
  if not fileexists ('wclientidint.dat') then {If the file doesn't exist}
    begin
      WDClientInt := 0;     {Set initial value}
 
      rewrite (WDClientIDIntFile);    {Create file}
      write (WDClientIDIntFile, WDClientInt);   {Write variable to file}
      closefile (WDClientIDIntFile);
    end
  {endif};
 
  assignfile (WDWebsiteFile, 'wdwebsitefile.dat');{Assign variable to file name}
  if not fileexists ('wdwebsitefile.dat') then {If the file doesn't exist}
    begin
      rewrite (WDWebsiteFile);    {Create file}
      closefile (WDWebsiteFile)
    end
  {endif};
 
  assignfile (WDWebsiteIDIntFile,'wdwebsiteidint.dat');{Assign var to file name}
  if not fileexists ('wdwebsiteidint.dat') then {If the file doesn't exist}
    begin
      WDWebsiteInt := 0;   {Set initial value}
 
      rewrite (WDWebsiteIDIntFile); {Create file}
      write (WDWebsiteIDIntFile, WDWebsiteInt);  {Write variable to file}
      closefile (WDWebsiteIDIntFile);
    end
  {endif};
 
  assignfile (WDServerFile, 'wdserverfile.dat');  {Assign variable to file name}
  if not fileexists ('wdserverfile.dat') then   {If the file doesn't exist}
    begin
      rewrite (WDServerFile);   {Create file}
      closefile (WDServerFile)
    end
  {endif};
 
  assignfile (WDServerIDIntFile, 'wdserveridint.dat');{Assign var to file name}
  if not fileexists ('wdserveridint.dat') then {If the file doesn't exist}
    begin
      WDServerInt := 0;  {Set initial value}
 
      rewrite (WDServerIDIntFile);   {Create file}
      write (WDServerIDIntFile, WDServerInt);   {Write variable to file}
      closefile (WDServerIDIntFile);
    end
  {endif};
 
  assignfile (WDFamilyFile, 'wdfamilyfile.dat'); {Assign variable to file name}
  if not fileexists ('wdfamilyfile.dat') then{If the file doesn't exist}
    begin
      rewrite (WDFamilyFile); {Create file}
      closefile (WDFamilyFile)
    end
  {endif};
 
  assignfile(WDOldSitesFile,'wdoldsitesfile.dat');{Assign variable to file name}
  if not fileexists ('wdoldsitesfile.dat') then{If the file doesn't exist}
    begin
      rewrite (WDOldSitesFile);  {Create file}
      closefile (WDOldSitesFile)
    end
  {endif};
 
  assignfile (WDTakingsFile, 'wdtakingsfile.dat');{Assign variable to file name}
  if not fileexists ('wdtakingsfile.dat') {If the file doesn't exist}
  then
    begin
      rewrite (WDTakingsFile); {Create file}
      closefile (WDTakingsFile)
    end
  {endif};
 
  reset (WDTakingsFile);
  if FileSize(WDTakingsFile) = 0 then  {If WDTakings file is empty}
    WDTakingsFileSetUp;
  {end if}
 
  seek (WDTakingsFile, FileSize(WDTakingsFile) - 1);  {Locate the last record}
  read (WDTakingsFile, WDTakings); {Read WDTakings record}
 
  if Year >WDTakings.Year then{If year is after the last year in WDTakings file}
    WDTakingsFileSetUp;
  {end if}
end;
 
procedure TfrmEtempaMain.imgButtonCloseClick(Sender: TObject);
begin
  close;     {Close program}
end;
 
procedure TfrmEtempaMain.imgButtonCloseMouseDown(Sender: TObject; Button:
TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  imgButtonClose.Visible := False;   {Switch images when hold button close down}
  imgButtonCloseDown.Visible := True;
end;
 
procedure TfrmEtempaMain.imgButtonCloseMouseUp(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  imgButtonClose.Visible := True;  {Switch images when release button close}
  imgButtonCloseDown.Visible := False;
end;
 
procedure TfrmEtempaMain.webdesignbannerClick(Sender: TObject);
begin
  frmWebDesign.show;   {Go to WebDesign form}
  frmEtempaMain.visible := false; {Close EtempaMain form}
end;
 
 
end.
 
Loading Advertisement...
 
[+][-]09/01/09 11:50 AM, ID: 25234696Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/01/09 12:26 PM, ID: 25235023Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/01/09 12:43 PM, ID: 25235175Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Delphi Database, Algorithms
Tags: Exception class EConvertError with message  is not a valid integer value, Delphi, Programming, database
Sign Up Now!
Solution Provided By: 8080_Diver
Participating Experts: 1
Solution Grade: A
 
[+][-]09/01/09 01:03 PM, ID: 25235370Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/01/09 01:08 PM, ID: 25235432Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/01/09 01:26 PM, ID: 25235637Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20080625