Dabase form button to save to PDF&Email

Creating and using forms
Post Reply
wardr21@gmail.com
Posts: 3
Joined: Sun Aug 26, 2018 2:23 am

Dabase form button to save to PDF&Email

Post by wardr21@gmail.com »

I am REALLY new to databasing, but must since my boss is cheap and I have way too many duties and must automate as much as possible. It gives me a chance to learn.
Problem: I need to have the invoice form saved in a PDF and emailed for approval before saving.
I am also having an issue creating a service charge drop down list that will auto implement a price list.
Last edited by robleyd on Sun Aug 26, 2018 2:40 am, edited 1 time in total.
Reason: Remove Known Issues icon [robleyd, Moderator]
OpenOffice 4.1.1
Windows8
UnklDonald418
Volunteer
Posts: 1544
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Dabase form button to save to PDF&Email

Post by UnklDonald418 »

That sounds like an ambitious project for a beginner.
Section 13.15.4. of Andrew Pitonyak's book "OpenOffice.org Macros Explained"
has a macro Sub ExportAsPdfAndSendEmail
http://www.pitonyak.org/oo.php
I am also having an issue creating a service charge drop down list that will auto implement a price list.
that is awfully vague, we would need to know more details about your database to privide any specific help with that.

Have you looked at
[Example] Invoice Forms (without macros)

LibreOffice has a "Base Handbook" that can also be helpful to beginners.
https://documentation.libreoffice.org/e ... mentation/
Look in the Base Books area.
It has a chapter on Forms and information on list boxes and combo boxes.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
User avatar
RoryOF
Moderator
Posts: 34585
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Dabase form button to save to PDF&Email

Post by RoryOF »

I'd do this in separate stages - I'd save the file (Export as PDF) then manually email it by attachment to the normal email program. I wouldn't even think about automating it.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Dabase form button to save to PDF&Email

Post by Villeroy »

A form document is just an ordinary Writer document.
menu:File>Send>Document as PDF converts the current document to PDF and attaches it to a new mail. This requires an adequate mail client such as Thunderbird.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
wardr21@gmail.com
Posts: 3
Joined: Sun Aug 26, 2018 2:23 am

Re: Dabase form button to save to PDF&Email

Post by wardr21@gmail.com »

Thank all of you!
I will read the pages suggested, then get back to you if I need help.
I am the only employee so making things as easy, and automated as possible can save me time. With only 2 hands it is difficult, and with so much noise programs like dragon will not help with multitasking!

I am new to this, so I am gathering info to figure out what I can do and how before starting on making even tables again. Another issue is price tables. I imported our Embroidery pricing table which prices by stitch count and quantity for one of the services. Any ideas on the best method to set up this table or make into multiple tables ? I am guessing the easiest method is to

1. make a table for quantity range and a table for stitch count to use as a list (sql)so that I can choose from a drop down list for the range of quantity or stitch count to get the price for that service. or

2. Set up tables so that by typing in a number for each factor in a form it will automatically set the price by finding the correct ranges and price?

I tend to complicate things!
I am thankful for this community of knowledge!
Last edited by RoryOF on Mon Aug 27, 2018 4:07 pm, edited 1 time in total.
Reason: Changed layout to help readability [RoryOF, Moderator]
OpenOffice 4.1.1
Windows8
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Dabase form button to save to PDF&Email

Post by Villeroy »

If it has to be a button on a form:
Button property "Action" = Open document or URL
URL = .uno:SendMailDocAsPDF
This URL points to the same internal command as menu:File>Send>Document as PDF, so it does exactly the same.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
UnklDonald418
Volunteer
Posts: 1544
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Dabase form button to save to PDF&Email

Post by UnklDonald418 »

It isn't uncommon for some college students to struggle with database design even after completing a semester or two on the subject. Experience is the best teacher, so don't be surprised if you need to scrap and restart your design more than once.
It is best to start database design by collecting as much information as possible before considering what information goes into which table.
In my experience a good starting point can be to use pencil and paper to lay out a rough idea of what information you think you might need on a form. Don't worry about implementation details at this point, just write down all information you need on the form. When your form(s) are complete you can make a list of data items you might need to store and which can be calculated from other items. Then begin looking at how items on the list might be related and put them in groups. Armed with that knowledge you can begin assigning groups of data items to table(s). A good deal of database design is done away from the keyboard.
Here is a tutorial that gives a quick overview of database design
https://wiki.documentfoundation.org/ima ... torial.pdf

As to your most recent question. With the limited information you provided, option 2 sounds like a reasonable approach, however additional information could point to a different solution.

Also, if you have looked at the book on macros I referenced earlier, you will have noticed that macro writing is very complicated. Macros are difficult to write and even a slight change to a form can cause them to fail. Experienced designers generally avoid them whenever possible.
Villeroy has pointed out two good solutions to emailing your document, eliminating the many hours of frustration often needed to debug a macro.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
wardr21@gmail.com
Posts: 3
Joined: Sun Aug 26, 2018 2:23 am

Re: Dabase form button to save to PDF&Email

Post by wardr21@gmail.com »

Thank you for the button idea. I will test it out once I get all the info together and begin building the forms that need it.
I printed out the macro information, but figured reading the other database book should be first. I should then avoid macros, if I can, and learn it later. It seems complex but fun!
Your ideas on the start process is what I am working on now. I will check out that tutorial as well.
My introduction and complete knowledge of this from school was a very quick run through using quantitative methods and survey data in a class focused around a product/service we created for the class. That included many other aspects like web creation. which was done from a program. It should have been 2 classes with more instruction and practice.
As for pricing we price on:
1. Embroidery charge ( Ex/ design has 2582 stitch count and placed on 20 items then it is priced by finding both aspects in range. 6-2999 stitch count and 6-23 items = $3.25 each item.
2. Orders less than 6:
1-2 pieces= double the 6-23 piece price
3-5 pieces= Add 50% to 6-23 piece price
3. Additional Incremental Cost
Add .50 per garment for jackets,leather,vinyl, collars, blankets, towels
Add .25 per garment for special thread
There is more but this kinda shows that our pricing seems confusing to create tables for.
If I choose option 2 I must then be able to edit the price in a way that the invoice report will show a different amount if needed. I can, I guess, add a label field for adding that alternate amount in and deleting the option 2 information from the report.
You guys are great! Now if I just get it together!
OpenOffice 4.1.1
Windows8
User avatar
RoryOF
Moderator
Posts: 34585
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Dabase form button to save to PDF&Email

Post by RoryOF »

My suggestion is that you should find some working database that approaches your requirement - there may be some on the OO Extensions site at https://extensions.openoffice.org. After reading as much as you can, play with that database, then start to tweak it to suit your needs.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Post Reply