776

(48 replies, posted in General)

Great stuff as usual EHW... Thanks a lot..................


I wanted to add inv notes (memo field) content to invoice group footer using same method you have used with inv totals.
Added notes field to group header
defined notes field on group header dataset to report, datafield to notes
added text object to group footer and defined onafterdata event


I tried the following script without success:

procedure Memo24OnAfterData(Sender: TfrxComponent);
begin
   Memo24.text := ReportNotes.value;       
end;

777

(48 replies, posted in General)

Hi EHW,


These are the steps causing the error message at my end:
https://s24.postimg.org/3s57rrmbp/zzz_Test6.png

778

(48 replies, posted in General)

Nice one EHW..
Thanks a lot.......


Straight to preview works fine.. However going to report designer and clicking preview produces some error dialog.. Looking for coLogo_filename field.


With trial and error I found the way to display two fields together. In my case I wanted to display customer name and surname in one line without extra spaces. The following script seems to work:

[<Report."Name">] [<Report."Surname">]

779

(48 replies, posted in General)

Cool stuff EHW..........
Thank you very much for your patience and time...............................................


I see that for image object on Fast Reports, images must be stored in DB not linked.


I think your images provides very valuable information for beginners like me amongst MVD lovers. Therefore, I put together and hot linked your images so that others can see bigger image within allocated forum post width here:


https://s23.postimg.org/8gvqvxqh7/zzzz_Reports.png

780

(48 replies, posted in General)

Once again thanks a million EHW.........


We are almost there I think...
Only first company logo image on the list is shown, in this case penguin corp.
When I try another company report their logo image is not shown.


On image display on a post, I couldn't find a way to display an image in a post, only a link, on this forum. Instead I use PostImg. They allow hot linking and provides all kind of hot links including for forums: https://postimage.io


I also use Lightshot at http://prnt.sc
It's a small free screen capture, upload and hosting utility. It also provides online edit of your captured image. I found it very handy for screen capture and sharing. They don't allow hot linking tho.


I'd be very interested to see your screen cap for how you did place those inv totals in group footer band.

781

(48 replies, posted in General)

ehwagner wrote:

Since multiple companies can share customers, I removed the relationship between customers and companies. I fixed your ReportSql and put in the report bands for the invoice. I did not format anything in the report bands. Just wanted to show you the placement of the data in the bands.


Thank you soooooooooooooooo much EHW.............................
Great stuff...


There are two things I noticed.
1. Couldn't get coLogo image displayed
2. On group footer band you have calculated net, tax and total from master data band.
On my actual project inv totals are calculated on inv form as there are discount and delivery cost calcs for the whole invoice.  What I like to do is to copy already calculated values of
sub total
tax total
gross total
less discount
plus delivery
inv total
fields to group footer or suitable band.

782

(48 replies, posted in General)

Post #17

One solution I found is that just using header for names labels, master data band for inv items data and inserting inv totals below master data band on the page. Visually (preview) it seems ok. However, I'm not sure if it's right way to do tho.


I thought the above was the solution for for Report not ReportSQL
However, it's not. When there is more than few entries inv totals put on report designer page without band doesn't move downwards. I tried footer but  report data is not displayed. Please see the reference images below:
http://prnt.sc/dx7zj1
http://prnt.sc/dx81km


Also page numbering issue on image 2


Report file refered on above images "Test_MultiCo2.fr3" is saved in Reports with attached sample project below:

783

(48 replies, posted in General)

Hi EHW,


Thanks a lot for the info...


I was thinking in practical terms. I agree that multiple companies cannot share same invoice/s but shouldn't they be able to share same customer/s?


SELECT
    Company.coLogo,
    Company.coName,
 Company.coAddress,
 Company.coPhone,
    SaleInv.invDate,
    SaleInv.invCode,
    SaleInv.subTotal,
    SaleInv.taxTotal,
    SaleInv.grossTotal,
    SaleInv.discount,
    SaleInv.delivery,
    SaleInv.InvTotal,
    Customer.name,
    Customer.surname,
    Customer.street,
    Customer.city,
    SaleProduct.name,
    SaleInvItem.Qty,
    SaleInvItem.unitPrice,
    SaleInvItem.netPrice,
    SaleInvItem.taxAmt,
    SaleInvItem.totalAmt
FROM
    SaleInv
INNER JOIN Customer ON Customer.id = SaleInv.id_Customer,
 SaleProduct
INNER JOIN SaleInvItem ON SaleInvItem.id_SaleInv = SaleInv.id
    AND SaleProduct.id = SaleInvItem.id_SaleProduct
INNER JOIN Company ON Customer.id_Company = Company.id
WHERE SaleInv.invCode = '{edSaleInvCode}'
INNER JOIN Company ON SaleInv.id_Company =Company.id
WHERE SaleInv.invCode = '{edSaleInvCode}'

The above produces syntax error.
If I add semicolon after customer lines like below it doesn't produce error but it doesn't display correct company on report preview. I'm thinking script lines I added are wrong.

FROM
    SaleInv
INNER JOIN Customer ON Customer.id = SaleInv.id_Customer,
 SaleProduct
INNER JOIN SaleInvItem ON SaleInvItem.id_SaleInv = SaleInv.id
    AND SaleProduct.id = SaleInvItem.id_SaleProduct
INNER JOIN Company ON Customer.id_Company = Company.id
WHERE SaleInv.invCode = '{edSaleInvCode}';  
INNER JOIN Company ON SaleInv.id_Company =Company.id
WHERE SaleInv.invCode = '{edSaleInvCode}'

Sample project attached:

784

(48 replies, posted in General)

Hi Math,


Lets assume user operates more than one business and wants to assign each sale to one of his company.
For this I linked SaleInv db table to Company db table. It seems to be working OK with Report but I couldn't get the SQL script right to make it work with with ReportSQL.


Script I've tried and didn't work:

INNER JOIN Company ON SaleInv.id_Company =Company.id
WHERE SaleInv.invCode = '{edSaleInvCode}'

Please see reference images below:
DB Schema
http://prnt.sc/dwq5os


SaleInv Form
http://prnt.sc/dwq7nb

785

(48 replies, posted in General)

The following refers to Report designer.


I delve into report designer... I must say it's one of those awkward app to learn... It seems to me that they took approach of showing left ear with right hand.


I needed to use two data levels - master/details.
In FR help, it states "In the report designer, enable the data sources in the “Report>Data...” dialogue." However, I cannot find it. If MVD report designer is a different version and doesn't have this feature, is there a work around?


I like to insert inv item details into master band and inv totals into details band that details band doesn't repeat after every master band data lines.
https://s30.postimg.org/kspybx22p/zzz_Test5.png


Edit:
-----------------------
One solution I found is that just using header for names labels, master data band for inv items data and inserting inv totals below master data band on the page. Visually (preview) it seems ok. However, I'm not sure if it's right way to do tho.

786

(48 replies, posted in General)

Thanks a lot Dmitry...............


iT works fine now..
I was also making mistake of setting sExt cell number to 2 like below:
Form1.tgCompany.Cell[2, i].ObjectReference := G;

787

(48 replies, posted in General)

No, I get file path instead of image itself


https://s28.postimg.org/e5xx1cjbh/test.png

788

(48 replies, posted in General)

In your project you using method "StoreFile", please check settings of component "dbiCoLogo" on form "frmCo"

Hi Dmitry,


Please see sample project "ReportTest2.zip" on post #3 where LinkFile type used.

http://myvisualdatabase.com/forum/misc. … download=1

789

(48 replies, posted in General)

Unfortunately the example, which you use don't work when you store images in database.


Images are using "LinkFile" type.
What's causing the issue of not working on my example?
Perhaps there is a workaround...

790

(48 replies, posted in General)

Great stuff Mathias.... Thank you so much......................


Now, I need to get down to learn using report designer.


At this point only thing is remaining on this topic is displaying image in a tGrid cell. Please see form1 company tab.
Perhaps Dmitry could offer solution for it.

791

(48 replies, posted in General)

Hi Math,


Thanks a lot for the generous amount of info....


I have deleted the link from Company and tried the following on ReportSQL but I still couldn't get it working tho

SELECT
Company.coLogo,
Company.coName,
Company.coAddress,
Company.coPhone,
SaleInv.invDate,
SaleInv.invCode,
SaleInv.subTotal,
SaleInv.taxTotal,
SaleInv.grossTotal,
SaleInv.discount,
SaleInv.delivery,
SaleInv.InvTotal,
Customer.name,
Customer.surname,
SaleProduct.name,
SaleInvItem.Qty,
SaleInvItem.unitPrice,
SaleInvItem.netPrice,
SaleInvItem.taxAmt,
SaleInvItem.totalAmt

FROM
Company
INNER JOIN Company ON Company.id = SaleInv.id_Company,

SaleInv
INNER JOIN Customer ON Customer.id = SaleInv.id_Customer,

SaleProduct
INNER JOIN SaleInvItem ON SaleInvItem.id_SaleInv = SaleInv.id
AND SaleProduct.id = SaleInvItem.id_SaleProduct

Concerning  "SaleTransHist" report, you don't see company fields because the link from and to this table are NULL : the link exists, it is referenced in both SaleInv and Company tables, but has no value on either sides.

Not clear on this one.


Now, before modifying you database structure, what do you mean by Company ?

It's user business-company, where they keep some company info such as tax and company registrations numbers etc beside co logo name address etc to use in reports and prints. i.e. if an invoice printed it'd have user's company logo, address, etc beside what's on inv form. It's not for recording any financial activity. It's mainly getting user company details on reports.


Project is a sample project, you can edit, change as you see fit to make it work.

792

(48 replies, posted in General)

Hi Math,


Thanks a lot for the info... The above mentioned error cause gone.


With Report SQL on "frmSaleInv" form button I get only first block DB table (Company) of the script on report on report designer while I need all of them. Additionally, report designer preview displays coLogo image field as %PNG instead of logo image itself.


With Report on "SaleTransHist" form button I get all except Company db fields values.


Please see updated attached sample project file

793

(48 replies, posted in General)

How do I get data from multiple db tables on report designer. It didn't display company db table data on report designer preview. Please see "SaleTransHist"  form Report button in the sample project attached.


edit:
Tried Report (SQL) option following the tutorial on Reports forum thread "How to create report"  but it produces an error "near FROM syntax error"

SELECT
Company.coLogo,
Company.coName,
Company.coAddress,
Company.coPhone,
FROM Company;

SELECT
SaleInv.invDate,
SaleInv.invCode,
SaleInv.subTotal,
SaleInv.taxTotal,
SaleInv.grossTotal,
SaleInv.discount,
SaleInv.delivery,
SaleInv.InvTotal,
FROM SaleInv;

SELECT
Customer.name,
Customer.surname,
FROM Customer;

SELECT
SaleProduct.name,
FROM SaleProduct;

SELECT
SaleInvItem.Qty,
SaleInvItem.unitPrice,
SaleInvItem.netPrice,
SaleInvItem.taxAmt,
SaleInvItem.totalAmt,
FROM SaleInvItem;

Example project file on same thread may be out of date as it says it's for older MVD and requires some changes.


Also, I used script from a project in these forums to display an image on tGrid cells but couldn't get it working. Please see form1 company tab.

794

(23 replies, posted in General)

Than you so much Dmitry.....


Now, we have 2 backup options simple one using save as and comprehensive one kindly coded by ehwagner.


Once again, thank you very much guys

795

(23 replies, posted in General)

Hi EHW,

Once again, thank you soooooooooooooooooo much.... Appreciated very much........

796

(23 replies, posted in General)

ehwagner wrote:

Adam, I updated your BackupEmployees project with your database backup setting form. I'm a little confused as to the two options for backup destinations (radio buttons). Theoretically a user could backup one time into the app folder and the next time into another folder and so on. You could have mixed backups in different folders, which potentially could be cumbersome to determine the most current backup for a restore. Since MVD does not have radio buttons I used checkboxes. And yes, a user could potentially backup in two places at the same time, which isn't necessarily a bad thing to have double protection. It's totally controlled by the user though. The other options for app start backup and app exit backup as well as the automatic backups and Max count are all functioning. Hope it' meets your requirements. If not, maybe at least it will get you further along in the process.


Hi EHW,


Great work....  Thank you soooooooooooooooooo much.... Appreciated very much........


Unless I'm missing something there is one small glitch I could notice so far.
When only "Backup the database file in to a specified folder:" checkbox checked and location defined, Maximum backup count doesn't seems to be working. It writes more than specified max count like no max.


For two location checkboxes, I used the following code from Mathias so that they act as radio buttons and it seems to be working OK:

procedure frmBDFSettings_CheckBox1_OnClick (Sender: string);
begin
    if frmBDFSettings.CheckBox1.Checked = true then frmBDFSettings.CheckBox2.Checked := False;
end;

procedure frmBDFSettings_CheckBox2_OnClick (Sender: string);
begin
    if frmBDFSettings.CheckBox2.Checked = true then frmBDFSettings.CheckBox1.Checked := False;
end;

797

(23 replies, posted in General)

Hi Dmitry,


True, it saves...
I was naming the file for instance abcd and when I click on backup database menu item to get save as dialog window, saved abcd file wasn't on the list. However, when I change Save as type combo and choose Any file they are shown on the list with Type as File while files saved with default name type were DB File.
Shouldn't files saved with custom name such as abcd automatically be assigned to DB File type?

798

(23 replies, posted in General)

Hi Dmitry,


Currently the following script works via save as dialog.. Thanks to your kind help......


procedure MenuClick1 (Sender: string);
var
    SaveDialog: TSaveDialog;
    sFileName: string;
begin
    sFileName := 'Sqlite-' + FormatDateTime('dd-mm-yyyy hh-nn-ss', now)+'.db';

    SaveDialog := TSaveDialog.Create(Form1);
    SaveDialog.FileName := sFileName;
    SaveDialog.Filter := 'Database|*.db|Any file|*.*';
    SaveDialog.Options := ofOverwritePrompt+ofHideReadOnly+ofEnableSizing;

    if SaveDialog.Execute then
    begin
        CopyFile(ExtractFilePath(Application.ExeName)+'sqlite.db', SaveDialog.FileName);
        ShowMessage('Database file saved in to the specified folder');
    end;

    SaveDialog.Free;
end;

I found that it only saves/copies with hard coded file name. It's fine but user also should be able to save under the name they type in.
Is this possible?
At present it give the impression of saving with custom file name but it doesn't.

799

(23 replies, posted in General)

Hi EHW,


I see and understand your points. Please see the updated project file attached.


If user clicks on "Backup the database file" button on form1, backup folder within app folder automatically and copies the file there, if user clicks on "Set backup location" button on form1 then frmBDFSettings launched. If user changes backup location thereafter backups stored in newly defined location.


My above explanation from previous post doesn't seems to be clear enough. What I meant is;
If user clicks on "Backup the database file" button on form1 without changing backup location on frmBDFSettings application uses default backup settings as on frmBDFSettings and creates backup folder within application folder and backs up into backup folder created.


It'd also be nice to include backup location on "Backup completed" dialog win such as:
"Backup completed.
The File saved to:
D:\Application folder\backup "


-------------------

800

(23 replies, posted in General)

Hi EHW,


Thank you so much for the alternative solution. It's great...............
It's in the direction of proper solution to backup imho.


This is the backup solution I'd love to have:
https://s24.postimg.org/qiw552c2d/zzz_Test4.png


Maximum backup count: When specified backups count reached the oldest backup removed.


Attached MVD employees project for clean start. I used a button for accessing backup form but it can also be a menu item.
I have used image for radio buttons on backup form as a placeholders since there is no radio button component in MVD yet.


If user clicks on "Backup the database file" button on form1, backup folder within app folder automatically and copies the file there, if user clicks on "Set backup location" button on form1 then frmBDFSettings launched. If user changes backup location thereafter backups stored in newly defined location.


Perhaps, it's too much to ask you but hopefully Dmitry codes it and offers as a proper backup solution. Even it may also be added to MVD Settings as a new tab so that we don't need to deal with additional script and forms.