Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

XDialog Box - Header and Detail

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    XDialog Box - Header and Detail

    Hi Everyone.. need further advice again.

    I have a table invoice_header and invoice detail.

    This is my Plan:
    Created XDialog 2 Tab Page - Header and Detail. In the Header Page show the fields for the Invoice Header.

    On the Detail Page should show the listing of the the Invoice Detail with the filter of Header ID.

    On the Detail Page there is a Button "Add New Detail" -> Detail XDialog Page open for user to enter the detail information. After submit the detail information, the Tab - Detail (Record Listing) should be able to refresh and only filter related to the Header ID.

    1. How do I write the code for the Detail Page?
    2. Additional of that, when the user double click the Tab-Detail "Record Listing" - should able to popup the Detail XDialog Page for user to edit.

    Please advice further... million Thanks.
    Many Thanks.

    Jack Lim

    #2
    Re: XDialog Box - Header and Detail

    Jack,

    I have created this code by simply copying and pasting from code written in the Learning Xdialog sample database that is provided in the alpha five install. If I have understood you correctly then this should provide the foundation of what you desire. I don't know how experienced you are with xbasic but some is required to change relevant fields to fit your tables in the invoice set.

    Tip - Any problems when using xdialog look at the many examples in the Learning Xdialog database for code to use/modify.

    Code:
    dim setname as c 
    'path to invoice set
    setname = "c:\a5v9\samples\alphasports\invoice.set"
    
    dim vl as p 
    vl = local_variables()
    dim s as p 
    s = set.open_session(setname)
     
    'get pointer to invoice_header table
    tih = s.invoice_header 
    
    tih.index_primary_put("")
    tih.fetch_first()
    
    'get pointer to invoice_items table
    tii = s.invoice_items 
    
    dim line_number as n 
    line_number = 1 
    
    dim invoice_number as c 
    dim invoice_date as d
    dim customer as c 
    dim lastname as c 
    dim firstname as c 
    dim address1 as c 
    dim address2 as c 
    dim city as c 
    dim state as c 
    dim zip as c 
    
    dim items as c 
    items = ""
    
    dim direction as c 
    direction = ""
    
    invoice_number = ""
    
    dim title_bar as c 
    title_bar = "{F=Arial,8}{C=Dark Blue,White,Dark Blue}{B=White,Dark Blue,Blue White}#{T=0.25}Quantity{T=0.75}Description{T=3.25}Price{T=4.00}Total"
    
    page = "Header"
    ui_modeless_dlg_box("Invoice",<<%dlg%
    {can_exit=close}
    {startup=init}
    {tab=page}
    {pane=Header}
    {region0}
    <%B=T;T=First;I=$a5_record_first;%!first>
    <%B=T;T=Previous;I=$a5_record_previous;%!prev>
    <%B=T;T=Next;I=$a5_record_next;%!next>
    <%B=T;T=Last;I=$a5_record_last;%!last>
    <%B=T;T=Find;I=$a5_find_by_key;%!find>
    ;
    {endregion0};
    {line=1,0};
    {region}
    Invoice Number: |[.20invoice_number];
    
    Date: |[.20invoice_date];
    Customer:|[.55customer];
    Name:|[.20firstname] [.32lastname];;
    Address1:|[.55address1];
    Address2:|[.55address2];
    City, ST Zip: |[.31city] [.5state] [.12zip];
    
    {endregion};
    
    {pane=Details}
    {region}
    [%O={@@};D%.90,1^#title_bar?.f.];
    [%O={@@};D%.90,10line_number^#items];
    {endregion};
    
    {endtab}
    %dlg%,<<%code%
    if a_dlg_button = "init" then 
    	get_header_variables(vl)
    	line_number = 1
    end if 
    
    if a_dlg_button = "find" then 
    	find_invoice(vl)
    	line_number = 1 
    end if 
    
    if a_dlg_button = "close" then 
    	s.close()
    	ui_modeless_dlg_close("invoice")
    end if 
    
    if inlist(a_dlg_button,"first","next","prev","last") then 
    	if a_dlg_button = "first" then 
    		direction = "first"
    	else if a_dlg_button = "prev" then 
    		direction = "prev"		
    		
    	else if a_dlg_button = "next" then 
    		direction = "next"
    	else if	a_dlg_button = "last" then 
    		direction = "last"		
    	end if 
    	fetch_next(vl)
    	line_number = 1 
    end if 
    
    %code%)
    
    function fetch_next as  c (vars as p)
    with vars 	
    if direction = "next" then 
    	tih.fetch_next(1)
    else if direction = "prev" then 
    	tih.fetch_prev(1)
    else if direction = "last" then 
    	tih.fetch_last(1)
    else if direction = "first" then 
    	tih.fetch_first(1)
    end if 
    	get_header_variables(vl)
    end with 	
    end function 
    
    function get_header_variables as v (vars as p)
    with vars 	
    	invoice_number = tih.eval("invoice_number")
    	invoice_date = tih.eval("Date")
    	lastname = tih.eval("customer->lastname")
    	firstname = tih.eval("customer->firstname")
    	company = tih.eval("customer->company")
    	address1 = tih.eval("customer->Bill_Address_1")
    	address2 = tih.eval("customer->Bill_Address_2")
    	
    	city = tih.eval("customer->Bill_City")
    	state = tih.eval("customer->Bill_State_Region")
    	zip = tih.eval("customer->Bill_Postal_Code")
    	get_items(vl)
    end with 	
    end function 
    
    
    
    function get_items as c (vars as p)
    with vars 
    
    items = ""
    tii.fetch_first()
    while .not. tii.fetch_eof()
    	items = items + tii.eval("quantity + '|'+product->description+'|'+ price + '|' + alltrim(str((quantity*price),12,2,'$'))")+ crlf()
    	
    	tii.fetch_next()
    end while 
    
    Dim format as p 
    Format.tab_stops=".5,3,3.75"
    Format.odd_row_color="White"
    Format.even_row_color="Blue White"
    Format.odd_selected_color="Dark Blue"
    Format.even_selected_color="Dark Blue"
    Format.font="Arial,8"
    Format.font_color_unselected="Black"
    Format.font_color_selected="White"
    Format.lastbutton="OK"
    Format.group_size=1
    Format.number_rows=.t.
    Format.alternating_bands=.t.
    
    'Apply 'owner draw' formatting information to the list
    items = a5_owner_draw_list_fmt(items,Format)
    
    end with 
    end function 
    
    
    
    function find_invoice as c (vars as p)
    with vars
    
    menu_choices = <<%list%
    Record Number
    Invoice Number
    Lastname
    %list%
     
     
    result = ui_popup_menu(menu_choices) 
    text_prompt = alltrim(result) + ":"
    find_what = ""
    if result = "" then 
    	exit function 
    end if 
    	
    find_result = ui_dlg_box("Find Invoice by " + result,<<%dlg%
    {on_key=enter}
    {lf};
    {text=25,1:text_prompt} [.20find_what] {sp};;
    {lf};
    {line=1,0};
    <10&Find!find?.not.(find_what="")> <10&Cancel!cancel>;
    %dlg%)
    
    if find_result = "find" .or. find_result = "enter" then 
    	if find_what <>"" then 
    		if result = "record number" then 
    			tih.index_primary_put("")
    			tih.fetch_goto(val(find_what))
    			get_header_variables(vl)
    		else if result = "invoice number" then 
    			tih.order("invoice_number")
    			tih.fetch_find(find_what)
    			get_header_variables(vl)
    		else if result = "lastname" then 
    			tih.order("customer->lastname")
    			tih.fetch_find(find_what)
    			get_header_variables(vl)
    		end if 
    	end if 
    end if 
    end with 
    end function

    Comment


      #3
      Re: XDialog Box - Header and Detail

      Many thanks.. I will study that...
      Many Thanks.

      Jack Lim

      Comment

      Working...
      X