651

(9 replies, posted in General)

Thank you very much Dmitry........................


Please see images below:

https://s29.postimg.org/41oo1zuhj/zzzzz_Temp20.png

652

(9 replies, posted in General)

DriveSoft wrote:
AD1408 wrote:

Thank you very much Dmitry...............


What about remaining two sides (top and bottom) of cells - Rows?

Unfortunately there is no a property for vertical padding.


Hi Dmitry,


Could there be a workaround?
Is it possible to have X pixels space before and after the value in the cell or even inserting blank line before and after?

653

(9 replies, posted in General)

Thank you very much Dmitry...............


What about remaining two sides (top and bottom) of cells - Rows?

654

(9 replies, posted in General)

Hi Dmitry,


I got one of your sample help project about wrapping text in tGrid cells. Is it possible to apply cell padding too?
When wrapped text displayed  in cells they are visually difficult to differentiate as to which text belongs to which cell at first look. I tried row coloring but that also didn't help much.


Please see the sample project attached if needed.

655

(10 replies, posted in General)

Thank you very much Derek...................
All works fine now.
Great stuff from you as usual..........

656

(37 replies, posted in General)

ehwagner wrote:

Adam, I went ahead and put in a timer so if the app is still running over midnight, then the recurring process will run and you'll see the new recurring expenses populated in the tablegrid. The timer checks every minute so if you are watching and it does not populate right at midnight, wait a minute and it will.


Thank you very much.... Truly appreciated.......

657

(37 replies, posted in General)

Perhaps shortcoming at my end with explanation... What I meant is:
1. I add a daily recurring expense today.
2. Added recurring daily expense with todays date shows on tGrid as normal and doesn't show recurred one as it it's not due till tomorrow as it should be since recurrd expenses only need to be displayed on their recur date and thereafter.
3. Left app running. Tomorrow (after midnight) it doesn't show recurred expense. Still showing only recurring expense. However, if I restart the  app it shows recurred one too..

658

(10 replies, posted in General)

Derek provided boolean filter and correct footer count. Once again Thanks a lot Derek.....


Now, I tried but failed to add another filter to tGrids. I wanted tGrid under Organization 1 tabPage display only Organization 1 records and Organization 2, Organization 3 etc would use same filter to display peoples records belonging to selected Organization. Please see the ref image below:
https://s23.postimg.org/nrwscb95n/zzzzz_Temp19.png


Derek,
I also tried showing details next to tGrids without SQL, by using fake edit button. However, couldn't get it working.


Updated Sample project attached:

659

(9 replies, posted in General)

Thank you very much Dmitry.........................

660

(37 replies, posted in General)

Hi EHW,


Looks like you got there.
Thank you very much for your truly appreciated help..................................................


Only item left out is to show recurred items without restarting the app. For this I'm trying the following:

procedure Form1_btnRefresh_OnClick (Sender: string; var Cancel: boolean);
begin
  Form1.tgExpenses.dbUpdate;
end;

I'll have to wait till end of the day to see if refresh button will work or not.

661

(9 replies, posted in General)

Hi Guys,


Thanks a lot for your help and advise......
I'm not trying to delete records having dependent records... In any case they shouldn't be deleted for the sake of db integrity beside anything else.
I just want to replace "FOREIGN KEY constraint failed..." system message dialog with a custom one.


Dmitry,
I tried the following with sample project on post #1 but couldn't catch it:

function OnSQLException(Sender: TObject; Msg: string; SQL: string): boolean;
begin
    // exception from functions SQLExecute or SQLQuery
    if Sender=nil  then
    begin
        result := true; // to prevent system message
        ShowMessage(Msg); // your message
        MessageBox('Selected record contains...', 'Error', MB_OK+MB_ICONWARNING);
    end;
end;

662

(9 replies, posted in General)

I like to replace the following Error dialog message with custom info dialog. Is it possible, if so how please?


https://s21.postimg.org/jlw53kyo7/zzzzz_Temp17.png


Situation I'm trying to find solution for as follows:


1. I have customer records on customers tGrid.


2. When customer has an sale invoice record (Sale invoice table is linked to customer table, id_Customer), clicking on delete button on customers tGrid returns the above error message after standard delete confirmation dialog. It's fine  in respect of database integrity which prevents user having invoice record without a customer, but not a user friendly one. I wanted to replace foreign key constraint error dialog with a friendly info dialog box.


Other solution I thought adding cascade delete on sale invoice table but it doesn't seems an attractive in this case. User may delete a customer by mistake which may cause considerable problem for the user, especially if deleted customer had many invoices etc.


Please see attached sample project. First 3 customer has invoice, clicking on delete for any of those customer with invoice brings the above unfriendly foreign key error dialog

663

(37 replies, posted in General)

ehwagner wrote:

Alright Adam, we are going to get you through this yet. The reason for the foreign constraint was that your category and group comboboxes were empty. I updated the project so you shouldn't get the error now. The database in the attached is empty so you can start fresh. Try it again.


Thank you very much EHW...................


1. Yes, it runs fine now, as long as I don't delete the db file you have supplied with v8. Once it's deleted, compiling and running fails then crashes instead of creating new db file and run. It seems some of the sql script db specific, I may be wrong tho.
https://s1.postimg.org/i8ztz21rz/zzzzz_Temp16.png


2. I tried an update button to show recurred items but didn't work:

procedure Form1_Button2_OnClick (Sender: string; var Cancel: boolean);
begin
   Form1.tgExpenses.dbUpdate
end;

I came a cross Dmitry's script below, perhaps something like that may be used so that recurred items can be saved and displayed on date and time, but it's beyond me currently in this case:

SQLExecute('update entries set date = "'+FormatDateTime('yyyy-MM-DD hh:nn:ss.000', form1.datetimepicker.datetime)+'"' ); 

3. Expenses tGrid data display would be more clearer as on the image 2 below:
https://s15.postimg.org/dbsly9cij/zzzzz_Temp15.png

Original record marked and saved as recurring needs to be always first record with recurring recur every.. columns filled, i.e. Yes | Month
Recurred items recurring column needs to empty but recurring every column filled with the period selected on first record.
Non-recurring, one of items recurring column needs to displays No
This way user can differentiate better recurring, recurred and non recurring items.

664

(37 replies, posted in General)

Hi Dmitry,


Thank you very much for the fix...............
Now it runs without any issue that I could notice.
I added backdated monthly recurring expense and it saved and displayed on the tGrid.
I then added daily recurring expense yesterday and it didn't show it on the tGrid today? Please see image below:
https://s3.postimg.org/bqlfer48j/zzzzz_Temp14.png


____________________________


Hi EHW,

Thank you very much for the update v7.........
However, I still couldn't get it working. When adding new recurring expense produces an foreign key restrain error:
https://s17.postimg.org/nm4zn2trz/zzzzz_Temp13.png
I deleted db file and run again to start with clear db file but it didn't run. It crashes.

665

(37 replies, posted in General)

DriveSoft wrote:

Please describe the issue in the one post or create a new topic for the issue.


Hi Dmitry,


EHW did a great work on  recurring events - in this case recurring expenses. Two items need your kind attention. Please see the attached sample project EHW coded.


1. Date format is need to be taken from the user OS rather than hard coding in the app (Like MVD date and time component does); so that app runs on different machines with different date formats.


2. As recurring expense entered and saved automatically when they are due, it should be displayed on form1 expenses tgrid without the need of restarting the app. Currently, app needs to be restarted in order to saved recurring expenses to be displayed on form1 tGrid. Perhaps adding refresh button (kind of forced on show event) on form1 / expenses tGrid  may eliminate the need of restart..

666

(4 replies, posted in General)

What about multi monitors use situation?


App always opens on default monitor. This, I like as monitors count can change you still get it on the default monitor.


However, let say in two monitor situation, if I move the app from default monitor [1] to second monitor [2];
is it possible to make app  to open sub forms on second monitor too?

667

(37 replies, posted in General)

Thanks a lot EHW...............
Still crashes but I think it's irrelevant at this point as date issue needs to be sorted out.


Dmitry,
Could you please help us sorting date issue on this project, so that date format can be read from the user system (OS) rather than trying to manipulate it as EHW explained on the post above #22

668

(4 replies, posted in General)

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

669

(4 replies, posted in General)

DriveSoft wrote:

Hello.


Print button also save record, because use data from database, not from form.


You can prevent it, example:

procedure Form2_Button2_OnClick (Sender: string; var Cancel: boolean);
begin
    if Form2.Button1.dbGeneralTableId = -1 then Cancel := true;
end;

Thanks a lot Dmitry.....
The above stops saving onClick of print button. However, print button appears as active button, clicking on it doesn't do anything. I tried to add info message

procedure Form2_Button2_OnClick (Sender: string; var Cancel: boolean);
var
buttonSelected : Integer;
begin
  buttonSelected :=MessageDlg('Only saved records can be printed.', mtInformation,mbOK,0);
    begin
    if Form2.Button1.dbGeneralTableId = -1 then Cancel := true;
    end;
end;

Unfortunately, info message is displayed on show record too beside showing print preview. I couldn't get it right to stop info message showing on show record / print.


Then I used disable print button on new record, and enable on show record.

procedure Form1_Button2_OnClick (Sender: string; var Cancel: boolean);
begin
    Form2.Button2.enabled := false;
end;

procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
begin
    Form2.Button2.enabled := true;
end;

I'm not sure if this is the correct approach tho.

670

(37 replies, posted in General)

Hi Derek,


Thank you very much for your kind contribution........ Appreciated....


While your approach have some nice points but the solution I was looking for is in line of EHW's approach. He has done great work on this. Only missing parts IMHO are:


1. Date format is need to be taken from the user OS rather than hard coding in the app; so that app runs on different machines with different date formats.
2. As recurring expense entered and saved automatically should be displayed on form1 expenses tgrid without the need of restarting the app. Perhaps adding refresh button on form1 where expenses tGrid is may eliminate the need of restart..

671

(37 replies, posted in General)

Great stuff EHW...........


I think it works now. I tested back dated 5 days. It display recurring items not after save but after restarting the application. I assume it's due to using back date?


It'd be great if date format read from windows date settings rather than hard coding. I changed my windows7 date format from dd/MM//YYYY to YYYY/MM/DD and it crashed on run.

672

(37 replies, posted in General)

Thanks EHW,

Cleared old data within app and added new recurring item backdated only for few days as seen on the screen cap below. This time no crash. However, there are no recurring items displayed. I didn't touch the script or any settings.

Either I'm doing something wrong or your latest upload is not the same as one you are testing.


https://s17.postimg.org/8dn0dd99r/zzzzz_Temp11.png

673

(37 replies, posted in General)

Hi EHW,


Thank you very much................
Truly appreciated.........


Indeed, in this case time is not needed. It was intended for defining what time of the selected period and date recurring expense should be created, but I can do without it.


However, application crashes and refuses to re-start.
Steps:
1. Added a backdated expense and marked as recurring on daily basis to test recurrence.
2. Closed the app.
3. Tried to run .exe again and app didn't start. I got windows ... has stopped working. message
4. Deleted database file and re-run but same, app cannot start.


I put this for your info, without any expectation of you correcting it.  Already, you have been very kind with your help on this and many other ones. So, please don't feel under any obligation whatsoever to put any further time into this project. Perhaps others may offer help on this and we can have a working recurring event script.

674

(4 replies, posted in General)

1. Form1 click on ADD button to add a new record.
2. On Form2 click on PRINT button with or without entering any data.
3. After clicking on PRINT button it saves the record blank or with entered values without clicking on SAVE button.
4. Clicking on CANCEL button on Form2 doesn't make any difference as it seems save triggered once PRINT button clicked.


How to avoid saving a record without clicking on save button in this circumstance?


Sample project is attached:

675

(37 replies, posted in General)

Thanks a lot EHW.....
You are right, setting Qty default value to zero fixes the error.


You have done a great work on this EHW... Appreciated very much....


Now if only you or anybody else could use combination of
Recurring expense checkbox
Recurrence Date
Recurrence Time
as a trigger, instead of paid label/button and show recurring expense records on the grid when they recur!!!!