Solved

Procedure DateScan  Turbo Pascal 7

Posted on 2000-03-08
22
287 Views
Last Modified: 2010-04-16
To the guys at 'EE'

I'm getting a moderate amount of success with the last procedure in my project, but it is proving tricky. In the program there is a procedure that when the user initiates the program for the the first time the procedure 'DateScan' reads '0' The date is taken from dos which is then compared to the transaction dates in the direct debit file, thereafter, this date is the start date each time the program is run. The transactions in the direct debit file are active on the same date each month. So the procedure must do the following-->:

1)READ DATE FROM DOS-
2) COMPARE THIS DATE TO DATES IN THE DD FILE-
3)COPY THE TRANSACTIONS INTO THE EXPENDITURE FILE AT BOOT UP READY TO BE USED IN THE CALCULATIONS RUNNING IN THE PROGRAM-
4) STORE THE DATE SO WHEN THE PROGRAM IS RUN NEXT TIME THE NEW TRANSACTIONS ARE COPIED FROM THAT DATE.

I have had a modicum of success but I have to try and stop transfers of the same data each time the prog is run. Also, I need to introduce a method of determining the 'day'  'month' 'year' in the code.

If the prog is run between months ie: at the end of a month and beginning of the next, the program needs to be able to catch up on the previous month before starting the transfers on the next to keep an accurate balance going. This is the point I have got to.

There is quite a bit of code involved so I am willing to email it together with the declarations to anyone interested in helping me to solve the problem.

Thanks in anticipation....chrisbee.
0
Comment
Question by:chrisbee
  • 12
  • 8
  • 2
22 Comments
 
LVL 2

Expert Comment

by:VIBESPRO
ID: 2608553
I'll make a sample program for you.  But give me some time about 3-4 days.
0
 

Author Comment

by:chrisbee
ID: 2609548
To Vibespro,

Thanks for your interest Vibespro It may help you if you know the declarations which are as follows-

Program HomeBugetManager;

Uses crt,dos,printer,Graph;

TYPE   TTColor = RECORD
          Active
          InActive  :WORD;
       END;

CONST  TColor : TTColor = (Active:10; InActive:10);

CONST  MONTHS : ARRAY[1..12] OF STRING[3] = ('JAN','FEB','MAR','APR','MAY','JUN','
JUL','AUG','SEP','OCT','NOV','DEC');

TYPE    DATESTRING = STRING[10];

TYPE    TExpend = RECORD
          Date  : DATESTRING;
         Month  : STRING[3];
        Amount  : REAL;
         Ttype  : STRING[12];
         Payer  : STRING[12];
          WkNo  : INTEGER;
        TranNo  : LONGINT;
          InDel : BOOLEAN;
       END;

TYPE    TUpDate = RECORD
           DateIn  : DATESTRING;
        END;
    Tsordeb = ARRAY[1..8] OF TExpend;

VAR
        InCo,Incbak : File Of TExpend;
        ExPen,Exbak : File Of TExpend;
 Exdebs,Fdebs,Debak : File Of TExpend;
            DebDate : File Of TUpDate;

       reply,choice : CHAR;
           prompt,P : STRING[10];
              M,X,Y : INTEGER;
             Date,D : DATESTRING;
          Maxlength : INTEGER;

These are the decs for my prog. All the files are of type Texpend as data has to be passed to and from them during the progs runtime, accept the date-file that just gets the date from the system.
You can reach me on chrisby_1@hotmail.com or chrisby@classicfm.net

Thanks again for your help, If you want the whole prog to date I can email it to you. I keep my system's virus scan up to date and run the MCAfee 4x engine.

Thanks again for your interest and offer of help.
Best wishes.........chrisbee.
0
 
LVL 2

Expert Comment

by:VIBESPRO
ID: 2631079
ok got it

sorry man.  had alot of work in the week

but I'll work on it now
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:chrisbee
ID: 2631354
To Vibespro!

Don't worry- plenty of time. I look forward to any ideas of help you can offer. Hope the decs were of help. My prog is plain Pascal- no pointers and the files are serial as is usual for finance.
Thanks for your help.
0
 
LVL 2

Expert Comment

by:VIBESPRO
ID: 2677752
ok All done.  Check you eamil..
0
 

Author Comment

by:chrisbee
ID: 2753291
To Vibespro!

Yippee! I've found my password. Would you send the email again please as It was lost when My Comp crashed.  I am looking forward to seeing the procedure and have more questions to ask you all out there.

Best wishes and thanks......chrisbee.
0
 
LVL 2

Expert Comment

by:VIBESPRO
ID: 2757125
ok
0
 

Author Comment

by:chrisbee
ID: 2772057
Hi Vibespro!
I'm being pushed By 'EE' who have put time limit on my question. I have had problems with my computer which has put me off line for weeks. I have five days left before my question is deleted.

Best wishes and thanks.......chrisbee
0
 
LVL 2

Expert Comment

by:VIBESPRO
ID: 2878795
ok Chrisbee.  I have a few problems with you code.   Just to name a few.

1st your code needs a better format.  that will correct that datescan procedure you have.

2nd in many of your procedures you read and write to the same file in one run.
that will repeat the files' contents.

3rd  the code needs to be optimized and a few things you have are not needed in the code.


anyway check your email
0
 

Author Comment

by:chrisbee
ID: 2879148
Adjusted points from 100 to 200
0
 

Author Comment

by:chrisbee
ID: 2879149
Thanks Vibespro!
I'll give my email a look in this week end and study your comments and I take your points. I have not validated the prog yet as I wanted to get it up and running.

Thanks for your help.

Best wishes..........chrisbee
0
 

Author Comment

by:chrisbee
ID: 2925371
Adjusted points from 200 to 300
0
 

Author Comment

by:chrisbee
ID: 2925372
Hi Vibespro!
I have sent you my latest effort on the datescan in my prog though I am continually getting errors- in particular where I have commented in the latest email I have sent you of the procedure. I have also raised the points as I feel this quite a job I have given you. Thanks again for your help and hope to hear from you soon.

Best wishes..........chrisbee.
0
 
LVL 2

Expert Comment

by:VIBESPRO
ID: 2938583
ok Chrisbee I got it and I sent you the correct procedure to use for the date scan.  I had to remove some unneccessary code from the it though.  

I sent it to both accounts you mentioned.
0
 

Expert Comment

by:W_Fox
ID: 3124990
chrisbee: maybe it would be easier to convert all dates to Integer (count of days from 1900-01-01) and manipulate with these integers? if so, I can take a look at archives to find formulas and code for that, worked fine for me :)

WBR,
 W_Fox
0
 

Author Comment

by:chrisbee
ID: 3133934
To W_Fox,
I cannot understand how this question got back in as I have already accepted vibespro's answer.  But I do take your point.  The problem is that the whole of my procedure is based on a string date system, which pascal, unlike other languages, supports, and to change to an interger would mean writing the whole of the program or using the 'STR' and 'VAL' procedures where necessary.  However, if you would like to see my program, and could offer any advice I will send it to you. I shall be posting another question soon on it which will attract some high points as the project is proving difficult.  Thanks for your interest.
My  Contact-  chrisby_1@hotmail.com
or
chrisby_2@breathemail.com
Best wishes.........chrisbee.
0
 

Expert Comment

by:W_Fox
ID: 3135613
OK. It was just hint how to work with dates easier (at least I think so :)) ) and maybe this will help in the future projects. If you have any questions about this converting, then feel free to email me: atvars@swh-t.lv

WBR,
 W_Fox
0
 
LVL 2

Accepted Solution

by:
VIBESPRO earned 300 total points
ID: 3136756
sorry W Fox but it does not matter what form the stored info is in.  The MAIN thing is that it is set up the right way so ready and writting is simple for the program.  Making it very difficult for errors to pop up. What Chisbee really needs is a properly structure heading for his code.


and Chribee:  no you did not except the comment as an answer
0
 

Author Comment

by:chrisbee
ID: 3146476
To Vibespro!
Thanks for the comment. I have been working on your ideas and have nearly cracked it. Datescan is now writing what I want it to, however it overwrites the last record in the target file but it is now making the comparisons correctly. I run a watch on the code and it will scan all the code but will only write to file those dates in range. It stores the new date ready for the next time the program is run. You deserve the points and I'm only keeping this running for your comments on the above.

Thanks to W Fox for your input, although vibespro has answered the question I look forward to any ideas you may wish to put forward on my future questions.

Best wishes to Vibespro and thanks, the next time I go in to 'EE' I shall read your comments to this entry then accept- In actual fact I have already accepted your comments to this question. Never mind the points are yours.
......chrisbee.
0
 

Author Comment

by:chrisbee
ID: 3146480
Comment accepted as answer
0
 
LVL 2

Expert Comment

by:VIBESPRO
ID: 6846047
hello Chrisbee.  this is VibesPro.  long time no c

I want to send you the completed version of the home budget manager to you

please reply and I'll send it if your still interested!

peace out
0
 

Author Comment

by:chrisbee
ID: 6846827
Hi Vibespro!
Nice to hear from you again- how are you, well I hope.  Your advice was a great help and I have passed my 'A' level with a grade 'C' overall. I got Two 'A',s for my project work so I'm over the moon and have written the homeBudgetManager in Delphi.  I am now writing in C++ on the Linux compilor (or learning to rather) I just love programming. Would love to see your code for the HBM prog send it to chrisby_1@hotmail.com. I still write in Pascal as it was my first language. I currently have a question on EE regarding Delphi no one has come forward yet and it has been up a long time- have a look.....chrisbee.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Compare of Excelsheets 41 383
1 paragraph C code to translate into Delphi code 3 232
loading dll from external path 1 250
Wininet read php file from internet issue 6 98
This article describes how to reset your Windows 10 password when you've forgotten it.
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question