2,176

(2 replies, posted in General)

Hi Knobby,
It depends on how you have defined the 'complete' field in your database - is it a simple text field where the user types something in, is it boolean (ie just a check box) or is it a dropdown (the user picks from a list).
Attached are 3 versions of the same thing with the 3 different filter types shown;  one of these should be okay for you.
Note that with the 'text' filter, you need to allow for users entering their response in upper or lower case (or a mix) - although you can always force the case to be upper or lower.  Personally, I tend to go with a dropdown (yes or no) as it's less ambiguous.
Regards,
Derek.

2,177

(26 replies, posted in General)

Hi Adam,
I was able to recreate the problem you found.
I think it was when a deletion was done from the 'all refunds' list rather than having first selected a PI or SI and then deleting. 
So the easiest fix is, when you're in 'all refunds' mode, to hide the 'delete' button and only re-show it when a specific PI or SI has been clicked.
I've done this and given it a good test and it seems to be fine now.
Apologies for missing that (school boy error - or in my case school grandad error - LOL!).
Derek.

2,178

(5 replies, posted in Russian)

Здравствуйте Bullet.
Попробуй это.
Derek.

2,179

(15 replies, posted in General)

Hi Manixs,
I ran out of time yesterday to finish this off.
Here is the version with formatting (but the principle of how to keep a running balance is the same as the old version).
Regards,
Derek.

2,180

(15 replies, posted in General)

Hi Manixs, Adam,
I'm not sure that you would actually ever have both a deposit and a withdrawal against the same transaction (as per both layouts)
But as far as a running balance is concerned, maybe you could do it something like this (bit untested as I'm in a hurry!).
Hopefully it helps,
Derek.

2,181

(5 replies, posted in General)

Hi David,
Nice to hear from you again too.  New Zealand - very nice!  UK here, for my sins - LOL!
Thanks for the link;  I remember seeing the post ages ago but only thought it could be used as some sort of 'countdown' to trigger a one-off event.  There a couple of  programs I've got where it will come in very handy.
Best Wishes,
Derek.

2,182

(26 replies, posted in General)

Hi Adam,
The script looks okay to me (but that's not to say that it is - LOL!).
What I actually suspect is that it's because the condition where 'PR' or 'SR' is shown or removed was only coded to work on mouse clicks rather than for the keyboard as well.  I've added the appropriate lines so that it fires off on 'key-ups' as well as 'mouse-clicks' and I think that should now prevent it from happening.  But if you manage to re-create the problem, please let me know and I'll dig a little deeper
Derek.

2,183

(2 replies, posted in General)

Hi Knobby,
You are 95% there.
By default, when you set up searches in MVD, it wants you to enter an exact match.
However, you can change this in the object properties of the search edit field (please see attached screen shot).
For example, set the filter to be s% to match from the start of what you type, %s% to match a character string anywhere in what you type etc etc.
Also note that you could have typed your search with the '%' wildcards yourself and it would have worked but it's not very user-friendly.
Hope this helps.
Derek.

2,184

(5 replies, posted in General)

Hi David,
Any chance you could show me how you approached it;  it'd be useful for a couple of things I'm working on.
Thanks,
Derek.

2,185

(26 replies, posted in General)

Hi Adam,
So something like a visual prompt on the purchase and sales invoice grids that there are refunds?
Adding this has also enabled me to simplify the orphaned refund problem - no need for messages or anything now so it's reduced the size of the script by a few lines - LOL!
Please find attached.
Derek.

2,186

(11 replies, posted in General)

Hi Knobby,
Once you've done all your testing and are ready to start using it 'for real', the easiest way is to go into the directory where your program is stored, locate the file where your actual data is held (typically sqlite.db) and delete it.  The next time you run your program, sqlite.db will be recreated and the record numbers will have been reset (please note that ALL your data will be deleted).
Regards,
Derek.

2,187

(4 replies, posted in General)

Hello Bo,
It works fine for me (unless you're meaning something else).  Please see attached project and screenshot..
Perhaps it's a Version issue (I've tried it back as far as MVD3.2 and it's still okay).
Regards,
Derek.

2,188

(26 replies, posted in General)

Hi Adam,
Attached is the program with warning messages to prevent you from creating orphan refunds. 
Deleting invoices or refunds is not really something that would happen over here (UK) - for audit reasons you wouldn't be allowed to.  I'd probably ending up 'logically deleting' them with a flag and then add filters to exclude flagged transactions from the grids.
The reason for the different filters on the PR and SR grids that you spotted is that I was trying different ways and simply forgot to make them all consistent - me bad!.  But you're right - either way will work.
Derek.

2,189

(26 replies, posted in General)

Hi Adam,
No problem - it's an straightforward fix.
If you change the name of the 'Show Refunds' button you need to change it in the script (which you have found and done) but you also need to change form1.edit1.  This uses the 'Show Refunds' button to do an incremental search so have a look at the object properties for form1.edit1  (Increm.Search) and make the same change there (click the drop down on the Increm.Search property and you should see your renamed button in there.
Fingers crossed, you should be working again.
Derek.

2,190

(26 replies, posted in General)

Hi Adam, EHW,
Had a couple of spare hours so I thought I'd have a go at the single table approach that I suggested a while ago.
It's a bit rough and ready and doesn't do all the things that yours does (mainly because I ran out of time) but I think the core functionality is much the same.  But quite a different approach with a self-imposed brief to keep it simple, use as much basic MVD functionality and really cut down on the amount of scripting and see how close I could get it.
Anyway, it's attached if you want to have a look and maybe it will throw up a few ideas.
Regards,
Derek.

2,191

(1 replies, posted in General)

Hi Benjamin,
If you have relationships set up between tables, this shouldn't happen.
If, however, you only have one table or you have tables with no relationships, you can still populate your own combobox with distinct values from the column you are interested in.
However, doing it this way, I've found that you need to add a small extra step which is to then copy the distinct value you have selected from your combobox into an edit field.  You then use the contents of the edit field in your search.   Maybe others know of a different way to do it.
Anyway, please have a look at the attached example and hopefully this helps,
Regards,
Derek.

2,192

(11 replies, posted in General)

Hi Knobby,
Attached are two versions of your project.
Version 1 has no script and uses a calculated field to display the ID on frmclient and is the most straightforward way to do it.
Version 2 uses a script;  with this version, you can also see what the next available ID is when you are adding a record.
Your script didn't work  for 2 main reasons
1.  it was missing a final 'begin end.'.  have a look at the script in Version 2 and you'll see.
2.  every procedure in a script needs to be associated with an 'event'.  If you look at the attached screenshot (knobby1.jpg) for frmclient, you will see the object inspector has 2 tabs - 'properties' and 'events' (if scripting is turned off, you will only see 'properties').  In your example, an 'on show' event has been created (frmclient_onshow) and this is how the association is made to the frmclient_onshow procedure in the script.
I appreciate it probably sounds like a lot of work but once you are familiar with it, it's very straightforward.
But there's a lot you can do with basic MVD and I'm sure there are some of us who never bother with scripting at all.
Regards,
Derek.

2,193

(11 replies, posted in General)

Hi Knobby,
Is there any chance you can upload your project and then someone will no doubt take a look at it (that's when you end up with 5 different solutions because we all have our own ways of doing things!).
But from what you've described, it sounds like you're missing an 'end;' at the end of one of your procedures;  just putting a ';' on its own will simply move the error down to the next line.  Typically, the format for any procedure is
procedure xyz;
begin
  abc
  abc
end;
This would account for both the error message you get and the grey box showing.
Derek.

2,194

(3 replies, posted in General)

Hi Manixs2013,
I'm not sure at what stage your are running your query filter but have a look at the attached and see if it gives you some ideas.
Basically, from whatever point (filtered results on form1 or selected record on form2) you return to form1, the datetimepicker always resets to the current date.
Hope this helps,
Derek.

2,195

(2 replies, posted in General)

Hi Knobby,
Yes, you can change all of that - you can even replace it totally with your own menu structure. 
But it requires a script which, having read another of your posts, you're not at the stage of wanting to get into (which is perfectly understandable if you're quite new to MVD).
In the meantime, if you just want to remove the 'menu bar' completely, there is an option in the form properties called 'border style';  set this to 'bsdialog' (see attached screenshot).  Please note that you do this for the main form (ie the first form that is opened when running your project) and all other forms then take the same style.
Hope this helps,
Derek.

2,196

(11 replies, posted in General)

Hi Knobby, EHW,
If you don't want to use a script to show the record id on an edit form, the only other way I can think of is to use a calculated field (however, this doesn't let you see what the record id WOULD be when adding a record unlike my previous example - so this is only going to be for existing records).
Please have a look at the attached project, specifically at the data structure and how I've set up the calculated field.
Regards,
Derek.

2,197

(11 replies, posted in General)

Hi Knobby,
You could try something like this (see attached).  It's pretty basic but might give you some ideas.
Regards,
Derek.

2,198

(2 replies, posted in General)

Hi Manixs
If you are using tablegrid editing, then you could try something like
procedure Form1_TableGrid1_OnChange (Sender: string);
begin
  form1.tablegrid1.columns[0].enabled := false;
  form1.tablegrid1.columns[1].enabled := false;
  form1.tablegrid1.columns[2].enabled := false;
end;      etc etc for which ever columns you want to protect.
If you are not using tablegrid editing and want to prevent access to a specific edit field, you can set the object property of that field to 'readonly'.
Derek.

2,199

(26 replies, posted in General)

Hi Adam,
Two things stood out when looking at the 'tgrid field display' project you attached in your latest post:
1.  I'm not sure why you need a separate 'refunds' table - isn't a refund just another transaction type (you already have purchase and sales transaction types on your 'invoices' table). 
Also, as the structure of the 2 tables is basically the same.  I think storing your different transaction types in 1 table would simplify things a lot;  I would probably rename 'invoice' to 'transaction' and create a related 'transactiontype' table (with fields 'type' and 'dbcr') and see if that approach streamlined things.
2.  I noticed that in your script, if you create more than 1 refund transaction against the same purchase or sales invoice, this actually creates a duplicate purchase or sales invoice record;  maybe you are already know this.
I am aware that you are probably just 'trying things out' at the moment so maybe that is why you are doing some things in a certain way.  At the end of the day, we all take different approaches;  hopefully, this might give you a couple of alternatives.
Derek.

2,200

(26 replies, posted in General)

Hi Adam,
I've added the bit that fills in the missing SIR information and it seems to work.
With regard to showing refund prices with minus(-), I don't believe it would ever work using your approach;  it looks like you perform a (0-value) instruction every time the refund record is edited - therefore every time you edit it, the value flips between positive and negative. Pretty confusing!
The way I'd do it is to simply put a message up to tell the user they have to enter a negative value;  trying to automate it seems overly complicated, at least within your current script.
In my opinion (for what it's worth - LOL!), I think there are things wrong, both from the data structure and from the coding.  But maybe this isn't a proper project and you're just trying various things out in which case, no problem.
Derek.