Re: Need Help

unforgettable wrote:

Hi brain
         How re you? Today I would like to ask some things about combo box in project last you attached. From combobox2 on form2, how can we display its datas on No_Sale_2 form's tablegrid1?

It'll depend on how are you going to represent the data. As far as I know, Report on No_Sales_2 Form is distinct by Date. So you will have 2 options there to display the flat rates.
Option 1: Is to show flat rates for each category (books, pens, etc.) but this will add fields (7 fields on the current categories) on qtable
Option 2: Is to show total flat rates given for the date. In this case, you only need 1 field to handle the data.

brian

Re: Need Help

Thank you brain. I want to use option one. Add seven fields but how it will populate and how get value from combobox2. I am trying to get result as shown in attached pic. How it will be?

Post's attachments

Attachment icon unforgettable.jpg 8.89 kb, 121 downloads since 2020-10-29 

Re: Need Help

unforgettable wrote:

Thank you brain. I want to use option one. Add seven fields but how it will populate and how get value from combobox2. I am trying to get result as shown in attached pic. How it will be?

In that case, I think it is better for you to just use the sales table and display or group it by category.

Post's attachments

Attachment icon Income_Expenses_New_8.zip 524.19 kb, 264 downloads since 2020-10-29 

brian

Re: Need Help

hi brain
          Look at attached project. I am trying to get what I want but it is not working properly. There is some mistake or I could not enter codes correctly. On form2 I got text from combobox2 to EI madedit1 and save it to table sales's field sitem. I made Edit1 enable.Now on form No_Sales by pressing Query button I am not getting desired result. Help plz.

Post's attachments

Attachment icon Income_Expenses_New_9.zip 353.3 kb, 257 downloads since 2020-10-29 

55 (edited by brian.zaballa 2020-10-30 05:21:02)

Re: Need Help

unforgettable wrote:

hi brain
          Look at attached project. I am trying to get what I want but it is not working properly. There is some mistake or I could not enter codes correctly. On form2 I got text from combobox2 to EI madedit1 and save it to table sales's field sitem. I made Edit1 enable.Now on form No_Sales by pressing Query button I am not getting desired result. Help plz.

Again, I would not suggest the report you are trying to obtain. It is a little messy and difficult or let's say impossible to obtain. I would suggest you go with the detailed report. As I can recall, the report on No_Sales form is displaying the count of items per category(which we redesign/recode in No_Sales_2) and not in detailed. The problem on the report you are trying to obtain like in this image http://myvisualdatabase.com/forum/misc. … mp;preview is not possible with the database structure and in my opinion, I really won't suggest it. The problem with that kind of report is Having multiple items with the same category in a Sales_ticket or with the same date. Other explanation to it is that you don't or cannot align 2 items with different categories in one row for they are in separate record(sales table).

brian

56 (edited by brian.zaballa 2020-10-30 05:22:17)

Re: Need Help

You can try to group it by date and category.

Post's attachments

Attachment icon Income_Expenses_New_10.zip 526.29 kb, 296 downloads since 2020-10-30 

brian

57 (edited by unforgettable 2020-10-30 12:17:10)

Re: Need Help

Hi brain
       In fact I want to get result same as pic on form No_Sales. Run this project and on form1  click button 'No of Sales'. See what is wrong to display with it.
Thanks to guide.

Re: Need Help

unforgettable wrote:

Hi brain
       In fact I want to get result same as pic on form No_Sales. Run this project and on form1  click button 'No of Sales'. See what is wrong to display with it.
Thanks to guide.

I already gave you my side on that kind of report you are trying to display. I'll reiterate it, the previous report with that kind of display is the count of items per category. and that is very obtainable. But to display item names instead of the item count in a row with different categories is a No No. I cannot help you with that. Sorry.

brian

Re: Need Help

Thank you brain to reply. I am sorry  about limitation of database. In fact I dont need report but want to display data in this manner as shown in pic. Any way thank you a lot.

60 (edited by unforgettable 2020-11-10 08:45:43)

Re: Need Help

Hi Brain and every one,
                on the attached income _ expenses 10, I want to get display as in attached pic. Is it possible? If we can get  (Select count(b.id_category) From sales b Where b.id_category = 2 and b.sdate = a.sdate), on form No_Sales_2, why we can't get  (Select (b.sitem) From sales b Where b.id_category = 1
  and b.sdate = a.sdate) on form No_Sales by pressing query button? as attached pic. Why it is creating problem by more than one entry?

Post's attachments

Attachment icon Screenshot.png 31.03 kb, 117 downloads since 2020-11-10 

61 (edited by unforgettable 2020-11-10 08:49:03)

Re: Need Help

Hi Brain and every one,
                on the attached income _ expenses 10, I want to get display as in attached pic. Is it possible? If we can get  (Select count(b.id_category) From sales b Where b.id_category = 2 and b.sdate = a.sdate), on form No_Sales_2, why we can't get  (Select (b.sitem) From sales b Where b.id_category = 1
  and b.sdate = a.sdate) on form No_Sales by pressing query button? as attached pic. Why it is creating problem by more than one entry?

Post's attachments

Attachment icon Screenshot.png 31.03 kb, 109 downloads since 2020-11-10 

Re: Need Help

Hi Friends,
         I am sure all of you will be fine. Today I was to know how to add a button on a form which delete all records of all tables or selected table but before deleting a message box should appear for confirmation and after deleting"all records have been deleted" message appears. Can anyone help?
Thanks

63 (edited by CDB 2021-02-03 09:40:53)

Re: Need Help

Unforgettable,


I think to keep things simple you should have two buttons for delete. One for a selected table and the other for all tables.


Are you sure that you want to actually delete tables and not just records?  Deleting a table cannot be undone.



You could have a check box which decides which button is visible or have the check box select two different forms one for each type of deletion.


As far as displaying messages this is what I do to delete an entry in a table. Note this is not deleting table but you can use the idea.


procedure frmEditOrderQty_btnFrmAmendDeleteRecord_OnClick (Sender: TObject; var Cancel: boolean);
 var
 text : string;
 btn :integer;
begin
    
  //Make a message string - from edit boxes of item selected
   text := 'ORDER ITEM '+#13#13 + frmEditOrderQty.edtfrmAmendDescription.Text +'  x '+ frmEditOrderQty.edtNewQty.Text;

//First warning message with a cancel and OK button showing. Click cancel allows you to not delete in case of making a mistake.
   btn := messageDlg('CONFIRM DELETION OF '+text,mtWarning, mbCancel+mbOK, 0);


//What to do if Cancel is selected - exit out of the code and close the form (in this case).
   if  btn  = mrCancel then
      Exit
   else
     begin
       SQLExecute('DELETE FROM orders WHERE orders.id =  "'+ intToStr(frmMain.tgOrders.dbItemID) +'"');

//Information message advising the record has been deleted.
       ShowMessage(#13#13 + text + ' has been DELETED' );
       frmMain.tgOrders.dbupdate
      end;
 

  frmEditOrderQty.Close;

end;

The SQL code needed to delete a table is SQLExecute('DROP your_table_name IF EXISTS');


The SQL code to delete all tables is more complicated, you actually might be better off by just issuing a command to delete the complete database file.


I'd recommend having a copy of your database file while you experiment with deleting tables. Also the above code needs to be changed slightly if your tables have foreign keys in them.

On a clear disk you can seek forever

Re: Need Help

Thank you FEB to reply. Actually I want to add a button which reset table/tables which delete all records of table. Would you like to attach a project for example?

65

Re: Need Help

unforgettable wrote:

Actually I want to add a button which reset table/tables which delete all records of table.


In that case you can use the above code for selecting individual records and below to delete all records from a table. The SQL is  :

if  btn  = mrCancel then
      Exit
   else
     begin
       SQLExecute('DELETE  *  FROM your_table_name');
On a clear disk you can seek forever

Re: Need Help

Thank you CDB. What is #13#13? Would you like to explain?

67 (edited by CDB 2021-02-04 18:49:19)

Re: Need Help

#13  =  the ASCII instruction to return the printing position to the beginning of the typed line.  This is what was known as a Carriage Return when using typewriters, and for programming can be seen  abbreviated as CR  in some texts.


Remove them from the code and see the difference in text positioning.

On a clear disk you can seek forever

Re: Need Help

Any one can tell how do we create trigger in attached project. In fact as data increase system takes time to load form have tablegrid. A trigger speeds up to load?

69 (edited by brian.zaballa 2022-02-25 03:34:31)

Re: Need Help

unforgettable wrote:

Any one can tell how do we create trigger in attached project. In fact as data increase system takes time to load form have tablegrid. A trigger speeds up to load?

You haven't attached your project. I used the last attachment from my replies.

Well, trigger will help but in my opinion, if you aren't that familiar with trigger, then you study it first. There are other method to avoid the calculated fields(Most probably, this are the ones responsible in slowing your application). All you can do is just edit that calculated field (In this example the Sales_Ticket.sTotal) to a regular field(Currency in this case). Then handle the calculation in your code.

Post's attachments

Attachment icon Income_Expenses_New_11.zip 580.66 kb, 181 downloads since 2022-02-25 

brian

70 (edited by unforgettable 2022-02-25 18:45:47)

Re: Need Help

Thank you brain zaballa. I could not understand highlighted lines in these two pics attached. Can you tell some detail about them? Are these executable?

Post's attachments

Attachment icon pic1.PNG 10.15 kb, 61 downloads since 2022-02-25 

Re: Need Help

unforgettable wrote:

Thank you brain zaballa. I could not understand highlighted lines in these two pics attached. Can you tell some detail about them? Are these executable?

It is to compute for the receivable, deducting discount from sTotal.

brian

Re: Need Help

These lines are executable? because I read  that after // are comments lines which are not executable.

Re: Need Help

Hello unforgettable, hello Biran

if you want the ComputeReceivable() procedure to do the job, remove the // in front of the last four lines.
In Pascal (Delphi, the // are comments that will not be executed)

the first line preceded by // is simply the explanation of the role that this procedure will play

JB