Dear Rebol Users,
I am a very very beginner of programming. Unfortunately, some people expected of me too much very soon. I live in a hostel where the superintendent collects around 100 bucks each month from each of the boarders. Initially, he did it manually by putting the data in an excel file by marking 'Paid' correspondingly to whoever paid. Just like one would do with pen and paper. Now he wants an automated solution. He wants me to write a program that would take inputs- name, month, and fees and would submit the info. He wants the data to be appended to excel like file. Though I guess comma separated file would do. The name of the file should be according to the month. Lastly, a generated receipt should pop out. Text or image anything, and he would print that receipt and give to us after payment. Luckily enough I found Rebol and I believe only Rebol can help me create such a thing quickly. Please guide me how to do it. My Appologies for such a nonsense thing. I believe this forum is for discussing Rebol programming in depth. But could not find some other place or person to ask. Please help me. Thanks in advance.
posted by: Himangshu 27-Feb-2018/13:08:53-8:00
There are some specific examples which explain how to do exactly this sort of thing in my business programming tutorial, for example:
Here's a very simple example adjusted to your basic needs, but without any error checking, etc.:
R E B O L 
save-file: does [
csv-file: to-file rejoin [
%./csv/ get-face year "-" get-face month "-" get-face name ".txt"
write/append csv-file rejoin [
mold get-face name ", "
mold get-face amount ", "
mold get-face month ", "
mold get-face year ", "
mold get-face date "^/"
receipt-file: to-file rejoin [
%./receipt/ get-face year "-" get-face month "-" get-face name ".txt"
write/append receipt-file rejoin [
"^/Name: " get-face name
"^/Amount: " get-face amount
"^/Month: " get-face month
"^/Year: " get-face year
"^/Date: " get-face date
call/show join "notepad " to-local-file receipt-file
view layout [
text 50 right "Name:" name: field return
text 50 right "Amount:" amount: field return
text 50 right "Month:" month: field return
text 50 right "Year:" year: field return
text 50 right "Date:" date: field return
text 200 "" btn "Submit" [save-file]
set-face month form pick system/locale/months now/month
set-face year form now/year
set-face date form now
Since you're a beginner, be very careful writing anything which records financial records for others. You're probably not yet prepared to handle the sorts of errors and real life problems which can result in the use of any code you write. The code above is released with a GPL licence (free, so use it at your own risk).
posted by: Nick 28-Feb-2018/7:01:51-8:00
The tutorial at http://business-programming.com is long. You may want to take a look at the shorter tutorial here:
There are links to other shorter tutorials at the top of the home page of this forum.
posted by: Nick 28-Feb-2018/7:09:38-8:00
I knew I could not get here before Nick with a reply, but I do have one small thing I could add. It is something that has been helpful for me.
When you get your program operating, look for ways to package the code so that parts of it can be used again. If you write a program that produces a receipt, you might later write another program that produces a receipt, and if you could use the code from the first program, that re-use would make it faster to write the second program.
As an example, I borrowed Nick's idea from his business programming page and made an example which I put at the link below. You are welcome to it if it could be helpful. You should be able to right-click-download the link, or else view the code in a browser and then copy it out and paste it into a text editor.
By the way, I think that my coding style is not so REBOL-like. It took me a long time to understand REBOL and I have had to plod along carefully in order to understand what I was doing. That plodding style has stayed with me.
posted by: Steven White 2-Mar-2018/11:55:28-8:00