Just Commodores Forum Community

It takes just a moment to join our fantastic community

Register

Sql

Discussion in 'The Pub' started by Not_An_Abba_Fan, Jun 26, 2008.

  1. Not_An_Abba_Fan

    Not_An_Abba_Fan Exhaust Guru

    Messages:
    13,813
    Likes Received:
    422
    Trophy Points:
    83
    Joined:
    Aug 18, 2006
    Location:
    Bunbury, WA
    Members Ride:
    Strange Rover
    Who knows SQL and can help me?

    I am running a program that tracks fleet vehicles, part of it is billing that uses SQL. I need to show a tax component in my invoices that has the GST included amount. So what I need to do is have a field that shows a figure of 9.09% of another field. I know where the SQL function needs to go, but I am having difficulty in writing the correct function so it works.
     
  2. stocky

    stocky New Member

    Messages:
    5,036
    Likes Received:
    79
    Trophy Points:
    0
    Joined:
    Jun 14, 2005
    Location:
    Melbourne
    Members Ride:
    1995 HSV Clubsport T5, 1991 VN Berlina
    Well at the moment I'm writing Java and SQL programs that deal with electricity meter billing. Perhaps i could help.

    What are you writing the program in?
     
  3. VN_Luke

    VN_Luke ƃuoɹʍ ʇsnɾ sı sıɥʇ

    Messages:
    1,498
    Likes Received:
    54
    Trophy Points:
    48
    Joined:
    Mar 17, 2005
    Location:
    Mexico
    Members Ride:
    Get in the ute
    SELECT <<price_col>> * X as `gst`, <<price_col>> as `price` FROM <<whatever table>>

    price_col is the name of the colum that contains your price......
    X is the number by which you want to multiply the price in order to get the GST value
    whatever table is the name of the table you're getting this data from
     
  4. Not_An_Abba_Fan

    Not_An_Abba_Fan Exhaust Guru

    Messages:
    13,813
    Likes Received:
    422
    Trophy Points:
    83
    Joined:
    Aug 18, 2006
    Location:
    Bunbury, WA
    Members Ride:
    Strange Rover
    It's not really a table that i need to get the information from. It is SQL embedded in the program I think. Here is a screen shot of the SQL part and the bit i need to change.
     

    Attached Files:

  5. Not_An_Abba_Fan

    Not_An_Abba_Fan Exhaust Guru

    Messages:
    13,813
    Likes Received:
    422
    Trophy Points:
    83
    Joined:
    Aug 18, 2006
    Location:
    Bunbury, WA
    Members Ride:
    Strange Rover
    The txtTax is the bit that the operation in the lower pane describes, at the moment it just reads $0.00. what I need to do is make it show a value calculated from another field. The other field name is DBText15.
     
  6. Not_An_Abba_Fan

    Not_An_Abba_Fan Exhaust Guru

    Messages:
    13,813
    Likes Received:
    422
    Trophy Points:
    83
    Joined:
    Aug 18, 2006
    Location:
    Bunbury, WA
    Members Ride:
    Strange Rover
    I don't think that would work anyway, because I need to calculate the value from another field in the same document. You need to see the program I think to see how it works.

    If anyone wants to download the trial version and look at it, it's called Fleet Maintenance Pro.
     
  7. stocky

    stocky New Member

    Messages:
    5,036
    Likes Received:
    79
    Trophy Points:
    0
    Joined:
    Jun 14, 2005
    Location:
    Melbourne
    Members Ride:
    1995 HSV Clubsport T5, 1991 VN Berlina
    still want help with this? downloaded that program but have no idea how to get to the screen in the picture above
     
  8. Not_An_Abba_Fan

    Not_An_Abba_Fan Exhaust Guru

    Messages:
    13,813
    Likes Received:
    422
    Trophy Points:
    83
    Joined:
    Aug 18, 2006
    Location:
    Bunbury, WA
    Members Ride:
    Strange Rover
    You need to create an invoice first.

    On the tool bar there is 'Billing', click that, then 'generate invoice'. Click the 'misc items' tab and click add. Type something there and put in a price, doesn't matter what. Make the quantity 1. Then click save. There is a check box that says print upon saving, check that and click save. A 'Report Filtering Options' screen appears, click the 'customize' button bottom left. It will bring up the 'Maintenance Report Designer'. Top left is a 'calc' tab, click that. On the menu in the left pane, scroll down until you see 'txtTax', it will be highlighted in green, that shows that there are event handlers for that option. Click on it and in the right pane will appear the 'OnGetText' with a green page next to it, click that and you will see the SQL statement.

    Bit of messing around I know.
     
  9. ProphetVX

    ProphetVX New Member

    Messages:
    228
    Likes Received:
    10
    Trophy Points:
    0
    Joined:
    Mar 28, 2006
    Location:
    Cronulla, NSW
    Members Ride:
    A Pushie
    Thats not sql.

    Whats the actual program you're running, it looks like a derivative of PASCAL to extrapolate the data.

    It would be something like
    Begin
    if Text = '' then Text = '$0.00';
    var temp : Float;
    temp = (StrToFloat(Text) * 0.0909);
    End


    temp would be where the result is stored. I haven't used delphi/pascal for 10 years now, and I can't remember how StrToFloat handles the $ symbol.
     
    Last edited: Jun 27, 2008
  10. Not_An_Abba_Fan

    Not_An_Abba_Fan Exhaust Guru

    Messages:
    13,813
    Likes Received:
    422
    Trophy Points:
    83
    Joined:
    Aug 18, 2006
    Location:
    Bunbury, WA
    Members Ride:
    Strange Rover
    I've been in contact with their support and they tell me I need to know SQL to be able to do what I need it to do. Fleet Maintenance Pro is the program.

    After looking at it a bit more, it looks like each part of the invoice is a separate table.
     
  11. stocky

    stocky New Member

    Messages:
    5,036
    Likes Received:
    79
    Trophy Points:
    0
    Joined:
    Jun 14, 2005
    Location:
    Melbourne
    Members Ride:
    1995 HSV Clubsport T5, 1991 VN Berlina
    i was about to say that. i havent done pascal before but might be able to try learn it to do this
     
  12. ProphetVX

    ProphetVX New Member

    Messages:
    228
    Likes Received:
    10
    Trophy Points:
    0
    Joined:
    Mar 28, 2006
    Location:
    Cronulla, NSW
    Members Ride:
    A Pushie
    What you're toying around with isn't sql though. Thats real code, to help render the information or process the information once it's already been retrieved from the table.

    If you need more information from the tables, there must be somewhere else that you can edit the sql statements. Refer to my edited post above for a likely close solution.
     
  13. Not_An_Abba_Fan

    Not_An_Abba_Fan Exhaust Guru

    Messages:
    13,813
    Likes Received:
    422
    Trophy Points:
    83
    Joined:
    Aug 18, 2006
    Location:
    Bunbury, WA
    Members Ride:
    Strange Rover
    There is a data tab as well, it shows how the data is handled and where it is stored, but there is no place to write and save new code.

    Screen shot of that.
     

    Attached Files:

  14. ProphetVX

    ProphetVX New Member

    Messages:
    228
    Likes Received:
    10
    Trophy Points:
    0
    Joined:
    Mar 28, 2006
    Location:
    Cronulla, NSW
    Members Ride:
    A Pushie
    Just did a bit of research it seems to use the ODBC connector, which no doubt means it's using a msaccess database in the backend, so all queries are actually stored inside the database, then probably defined and called somehow within the application elsewhere.

    You should be able to access the database file in the root of the application folder, or somewhere in that folder. It will have the extension MDB, you should be able to double click it and it'll open access (provided you have office professional). You should be able to create a query in the design view, just finding the way the program accesses that information is the tricky bit.

    Without it infront of me, there isn't really much else I can help you with. That seems like the most logical pathway that the program works however.
     
  15. Not_An_Abba_Fan

    Not_An_Abba_Fan Exhaust Guru

    Messages:
    13,813
    Likes Received:
    422
    Trophy Points:
    83
    Joined:
    Aug 18, 2006
    Location:
    Bunbury, WA
    Members Ride:
    Strange Rover
    Can't access anything through the root folder, there are a heap of IDX and BPL files. In the Data screen, I can right-click the pane and 'edit sql' is an option, but when I click it, all it does is allow me to change what is on the screen, not really any of the actual code.

    In the design view I can change text fields and add images but not any of the data fields. It's only when I generate an invoice that isn't attached to a workorder though, there is a tax value field for workorders but not in invoicing, a bit of an oversight from the developers I think, they mustn't have allowed parts to be charged that aren't attached to a vehicle. Maybe I can create a bogus vehicle just so I can charge miscellaneous parts out.

    I'm waiting on a reply from the support guy, but as he is in the US it's two days turn around.

    Screenshot of the edit sql screen.
     

    Attached Files:

  16. Not_An_Abba_Fan

    Not_An_Abba_Fan Exhaust Guru

    Messages:
    13,813
    Likes Received:
    422
    Trophy Points:
    83
    Joined:
    Aug 18, 2006
    Location:
    Bunbury, WA
    Members Ride:
    Strange Rover
    OK, found another part that is editable, but I still don't know the correct statement to make it work.
     

    Attached Files:

  17. Not_An_Abba_Fan

    Not_An_Abba_Fan Exhaust Guru

    Messages:
    13,813
    Likes Received:
    422
    Trophy Points:
    83
    Joined:
    Aug 18, 2006
    Location:
    Bunbury, WA
    Members Ride:
    Strange Rover
    It gets more interesting, after a bit of googling, apparently it is Delphi, doing a bit of a crash course now, hopefully I can figure it out.
     
  18. pleitch

    pleitch New Member

    Messages:
    0
    Likes Received:
    0
    Trophy Points:
    0
    Joined:
    Jun 16, 2009
    Members Ride:
    None
    SQL for Tax component

    I realise this thread is now very old - but I think this is the script that they were after:

    PRL Software - Tax Component

    It calculates the GST component based on the invoice total (or invoiced lines if you want);).
     
  19. Not_An_Abba_Fan

    Not_An_Abba_Fan Exhaust Guru

    Messages:
    13,813
    Likes Received:
    422
    Trophy Points:
    83
    Joined:
    Aug 18, 2006
    Location:
    Bunbury, WA
    Members Ride:
    Strange Rover
    Thanks for that.

    I can find out what to do, but it is the where to do it that is the problem. Everything I try doesn't seem to work.

    Borland Delphi is the program, I have a book here, but it goes through different concepts.
     

Share This Page