Solved

Procedure DateScan  Turbo Pascal 7

Posted on 2000-03-08
22
277 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
Comment Utility
I'll make a sample program for you.  But give me some time about 3-4 days.
0
 

Author Comment

by:chrisbee
Comment Utility
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
Comment Utility
ok got it

sorry man.  had alot of work in the week

but I'll work on it now
0
 

Author Comment

by:chrisbee
Comment Utility
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
Comment Utility
ok All done.  Check you eamil..
0
 

Author Comment

by:chrisbee
Comment Utility
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
Comment Utility
ok
0
 

Author Comment

by:chrisbee
Comment Utility
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
Comment Utility
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
Comment Utility
Adjusted points from 100 to 200
0
 

Author Comment

by:chrisbee
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:chrisbee
Comment Utility
Adjusted points from 200 to 300
0
 

Author Comment

by:chrisbee
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Comment accepted as answer
0
 
LVL 2

Expert Comment

by:VIBESPRO
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Returning BSTR from a Delphi COM .DLL 2 1,803
printers log data 3 355
Utf8 encode 2 560
Virtuailstring tree compare node issue 14 89
This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
Veeam Backup & Replication has added a new integration – Veeam Backup for Microsoft Office 365.  In this blog, we will discuss how you can benefit from Office 365 email backup with the Veeam’s new product and try to shed some light on the needs and …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

728 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now