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

Printer Select Dialog Box

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

    Printer Select Dialog Box

    Hi guys, I recall having this conversation before but didn't get anywhere with it.

    I would like to have a better control over which printer each report get send to. So far I have to set the desired printer in the report. But I would like the end user to have control over that.

    I found a code from Jerry Brightbill in the documentation entitled "Printer Select Dialog Box", but it produces a blank dialog box. Please have a look the attached screen shot, it shows the result of that code and what I get from Notepad when I select File/Print.

    I'm using Windows 8 64Bit, but the server and all the stations are XP Pro.

    Any pointers anyone?

    Printer Select Dialog Box.jpg

    #2
    Re: Printer Select Dialog Box

    Nigel, if you don't set a printer, don't you get a print box to choose the printer?
    would that solve the problem?
    Dave Mason
    [email protected]
    Skype is dave.mason46

    Comment


      #3
      Re: Printer Select Dialog Box

      Yes that is the case, but in this POS software, I'd like the receipt to print without any dialog at all, While at the same time, the average customer get the 3 inch wide receipt, while larger customers get the letter size receipt, I already have that part figured out and functioning well, know what size receipt to print I mean.

      Comment


        #4
        Re: Printer Select Dialog Box

        I have never had to do this, but would it be possible to print them to a pdf and then create a choice of where to print the pdf? Maybe this won't make sense to you.

        I have to use crystal reports for a certain job due to extreme length and for that, I have to send the report generated to a different printer. I understand there is a difference in a pdf and a cr report. but should be similar?? at least in thought.

        The printer is set to the default in my case and no choices, but when sending the cr report it goes to a specific dot matrix.

        edit: actually I have 3 dealers(small) that actually do deliveries with my crm software and they are set up with the dot matrix okidata as their main printer for their main printer and all the other forms are sent to defined ink jets. explained: all the multi-copy forms are done on dot matrix.
        Last edited by DaveM; 05-06-2014, 12:11 AM.
        Dave Mason
        [email protected]
        Skype is dave.mason46

        Comment


          #5
          Re: Printer Select Dialog Box

          Thanks for the suggestion Dave. But, I've been battling an up hill battle, trying to make this software a fast as Quickbooks POS which is what was being used before, so far I'm loosing, everything about it, is significantly slower. So because of that I want to get rid of as many extra tasks as possible, and going to PDFs 1st would be increasing the process time. If I can just retrieve a list of installed printers for the end user to select from, I'd be good to go.
          Below is the code from the Documentation that is supposed to create a printer select box. But It doesn't work for me.

          I'd really love if someone could point out why it returns an empty box. Or if someone could tell me.

          'Date Created: 19-Feb-2004 09:57:40 PM
          'Last Updated: 19-Feb-2004 09:57:40 PM
          'Created By : Jerry Brightbill
          'Updated By : Jerry Brightbill
          prt_str = ui_printers_get()
          temp_count = w_count(prt_str,crlf())
          DELETE a_prt
          DIM a_prt[temp_count] as P
          prt_format = "printer|display"
          a_prt.initialize_properties(prt_format,prt_str)
          for i = 1 to temp_count
          if at("Driver",a_prt[i].printer) > 0
          a_prt[i].display = ""
          else
          a_prt[i].display = "$a5_print~ "+ substr(a_prt[i].printer,1,at(" on ",a_prt[i].printer)-1)
          end if
          next
          prt_str = a_prt.dump_properties(prt_format,"display<>''")
          temp_count = w_count(prt_str,crlf())
          DELETE a_prt
          DIM a_prt[temp_count] as P
          a_prt.initialize_properties(prt_format,prt_str)
          prt = ui_printer_default_get()
          prt = "$a5_print~ "+ substr(prt,1,at(" on ",prt)-1)
          ok_button_label = "&OK"
          cancel_button_label = "&Cancel"
          sel_Printer_code = <<%dlg%
          {stretch=width,height}
          [%O={I=:1,$(~)-1}{@$(~)+1};c=30%.90,6prt^#a_prt[[[\].display] ;
          {stretch=}
          {stickto=bottom,left};;
          <%T= Select Printer;O={J=C}{I:'$a5_print'} Select %12,1!Select_button_click >
          {sp=1}<%T= Cancel Printing;O={J=C}{I:'$a5_delete'} Cancel %12,1!Cancel_button_click >
          {sp=88};{ymargin=.5,0}{xmargin=1,0}{stickto=bottom,right}{image=$sys_btsize}
          %dlg%
          sel_printer_event = <<%code%
          if a_dlg_button = "select_button_click"
          temp_count = a_prt.find(prt,"display")
          if temp_count = 0
          end
          else
          printer = a_prt[temp_count].printer
          end if
          end if
          %code%
          printer = ""
          ui_dlg_box("Select Printer", sel_Printer_code, sel_Printer_event)
          ui_msg_box("",printer)

          Comment


            #6
            Re: Printer Select Dialog Box

            Because this image inserted codes

            Code:
            DELETE a_prt
            DIM a_prt[temp_count] as P
            prt_format = "printer|display"
            a_prt.initialize_properties(prt_format,prt_str)
            for i = 1 to temp_count
            	if at("Driver",a_prt[i].printer) > 0
            		a_prt[i].display = ""
            	else
            		a_prt[i].display = "$a5_print~ "+ substr(a_prt[i].printer,1,at(" on ",a_prt[i].printer)-1)
            	end if
            next
            prt_str = a_prt.dump_properties(prt_format,"display<>''")
            temp_count = w_count(prt_str,crlf())
            DELETE a_prt
            DIM a_prt[temp_count] as P
            a_prt.initialize_properties(prt_format,prt_str)
            prt = ui_printer_default_get()
            prt = "$a5_print~ "+ substr(prt,1,at(" on ",prt)-1)

            1) You can try without the image
            Code:
            printers= ui_printers_get() 
            
            ui_dlg_box("choose",<<%dlg%
            [.90,15prname^#printers];
            <ok>;
            %dlg%)
            2) or Replace with it.
            Code:
            list = ui_printers_get()
            list =sortsubstr(alltrim(list),crlf())
            'showvar(prt_str)
            
            nCount = *count(list)
            dim a_list[nCount] as C
            a_list.initialize(list)
            a_list.sort("ab")
            
            'create with Image
            image1 = "{I:'$a5_print'}" 
            
            DIM Display[nCount] as c  'set with image
            cWord =""
            for i = 1 to nCount
                cWord = word(List, i, crlf())
                Display[i] = word(cWord, 1,crlf())+"~ $a5_print"
            next i
            
            'Replaced the inside box, variable section;  and event 
            ' [%O={I=:$(~)+1} {@1,$(~)-1}  %.75,10Selected^#display];

            Comment


              #7
              Re: Printer Select Dialog Box

              Nigel.
              Do you want a printer selection dialog or not?
              If you do, and that was not what you required in the first post, placing a Print button on the Form or on the Report - In Preview mode will allow you to select the printer.
              Only trouble with putting the Print button on the receipt is that it will print that too! But it is liveable with.

              Another option would be to get the installed printers into a table, display the table and print select from that.
              This means that the users can only see the printers you want them to - and not the Alpha Printers or the MS Printers which you can exclude.

              This is my printer list, so you may have the same in a user environment.
              ? ui_printers_get()
              = Microsoft XPS Document Writer on Ne01:
              Fax on Ne02:
              Brother PC-FAX v.2 on LPT1:
              Brother PC-FAX v.2 #2 on LPT1:
              Brother MFC-465CN Printer on Ne06:
              Brother PC-FAX v.2.1 on Ne04:
              Canon Inkjet Writer for Easy-WebPrint EX on NUL:
              PaperPort Image Printer on Ne00:
              Brother MFC-J4510DW Printer on Ne05:
              Brother PC-FAX v.3 on Ne03:
              AlphaFivePrinterV4p5 on NUL:
              \\EXAMPLE\Brother MFC-J4510DW Printer on Ne07:
              AlphaFivePrinterV4 on NUL:
              See our Hybrid Option here;
              https://hybridapps.example-software.com/


              Apologies to anyone I haven't managed to upset yet.
              You are held in a queue and I will get to you soon.

              Comment


                #8
                Re: Printer Select Dialog Box

                Using same I get this
                Fax on Ne02:
                Epson Stylus NX410 on Ne03:
                OKIDATA ML320/1 TURBO on Ne00:
                Broderbund PDF Converter on NUL:
                Lightning PDF on VSP1:
                EPSON NX410 Series on Ne03:
                AlphaFivePrinterV4p5 on NUL:
                Dave Mason
                [email protected]
                Skype is dave.mason46

                Comment


                  #9
                  Re: Printer Select Dialog Box

                  Nigel,

                  I am not sure what you want here. In your 1st post you said:
                  �I would like to have a better control over which printer each report get send to. So far I have to set the desired printer in the report. But I would like the end user to have control over that.�

                  Then in post 3 you say:
                  �I'd like the receipt to print without any dialog at all�

                  Then in post 5 you say: �If I can just retrieve a list of installed printers for the end user to select from, I'd be good to go.�

                  One problem with the above is that printing to a specified printer without any dialog and allowing the end user to select a printer from a list is contradictory. Either one can be done but you need to decide which one you want.

                  Also, you have suggested that 2 different users might select a different printers for the same print job. Based on what? Are the printers in different work areas? Or is it that only the user would know that she is about to print some special case and needs to use a different printer from the one usually used? Or does the printer used depend on which computer is being used in a network or perhaps which user has logged on to a particular computer?

                  Trust me, anything can be done in regard to any of the above, but I certainly can't point you in the right direction without a clearer understanding of exactly what you really want and what the issues are.

                  Ray Lyons

                  Comment


                    #10
                    Re: Printer Select Dialog Box

                    Nigel,

                    I don't know if this will help, but we have specific reports that must go to specific printers. They are requests for case folders, and they are printed in either of our file rooms. We use the "report.printer_override" to force printing to a specific printer. Then when done, reset the default back to what it should be. Since you only want specific receipts printed on a specific printer, this may help. "vcprinter" is the actual printer name that the system recognizes.

                    Code:
                    DIM vcprinter as C = ""
                    'vcprinter should never be blank Code makes sure we dont send of a blank request
                    IF FLOR="3" .and. close3<>"X" THEN
                    	vcprinter = "FileRoom3"
                      elseif FLOR="4"
                    	vcprinter = "FileRoom4"
                      elseif FLOR ="3" .and. close3 = "X"
                      	vcprinter = "FileRoom4"  'print 3rd floor requests to 4th floor when 3 is closed
                      else
                    	ui_msg_box(aa.bcbss.agency+" File Room System","No Valid File Room Printer Specified, "+chr(13)+"File Room "+FLOR +" Specified - Cannot Print Request")
                      	end
                    end if
                    a5_previous_printer_name=ui_printer_default_get()
                    delete options
                    dim options as p
                    options.dummy=1
                    options_text=<<%str%
                    <papersize="Letter 8 1/2 x 11 in">
                    
                    %str%
                    property_from_string(options,options_text)
                    delete options.dummy
                    delete oldOptions
                    dim oldOptions as p
                    oldOptions.dummy = 1
                    old_printer_name = report.Printer_override(a5_previous_printer_name,options,oldOptions)
                    delete oldOptions.dummy
                    
                    on error goto errors2 'if they cannot communicate with the printer will error, and this restores the default if so
                    temp=ui_printers_get()
                    'Select the correct printer name this should work for any OS
                    ans = alltrim(*for_each(foo,if((vcprinter $ word(temp,*counter(),crlf())),word(temp,*counter(),crlf()),""),temp))
                    if ans =""
                    ui_msg_box("ERROR","No printer named")
                    end
                    end if 
                    if w_count(ans,crlf())>1
                    ui_msg_box("ERROR","Duplicate printer names print job will be canceled")
                    end
                    end if
                    :report.printer_override(ans)
                    
                    ':Report.Print("case Request [email protected]",query.filter,query.order)
                    'after printing we must reset the printer back to the way it was when we started
                    :Report.Print("case Request [email protected]",query.filter,query.order)
                    :report.printer_override("")
                    Tom

                    Comment


                      #11
                      Re: Printer Select Dialog Box

                      Hi guys!
                      I appreciate everyone's contribution very much, With the suggestions from you all I managed to accomplish what i needed.
                      The image below shows my "Default Printer Setup" form. Its based on a table that holds the selected printer name, the assigned ID, the report name that printer is assigned to and a description.
                      Printer Setup.jpg

                      At the bottom left of the form is a Combo Box that is filled with the currently installed printers, This was accomplished by putting the following code in the form's Oninit:

                      DIM pObj AS P
                      pObj = topparent:Printer.this
                      pObj.settings.dynamic_list = UI_PRINTERS_GET()


                      In the above code, "Printer" is the name of the Combo Box on the form. Its attached to the same field as the "Printer" column in the browse. So selecting a printer with the Combo Box set it as the printer in the browse.

                      When a cashier log in and open the POS form, 2 variables get created:

                      'Get 40 column printer (Get the name of the printer that has the ID "00")
                      dim Global Printer_40Column AS C
                      Printer_40Column = dbmin("tools_printer","Printer_Id","00","Printer")


                      'Get Letter size printer (Get the name of the printer that has the ID "01")
                      dim Global Printer_Letter AS C
                      Printer_Letter = dbmin("tools_printer","Printer_Id","01","Printer")



                      The following code is at the end of the cash out process. I first used the Print report action script and afterwards converted it to Xbasic, then i removed the printer name from it which was hard coded and I replaced it with the variable defined earlier. the lines in Brown color.

                      'Check to see if the cashier has temporarily disabled printing by unticking the check box "Print ON" which is attached to the variable Var->Print_On, afterwards, check to see if the receipt to be printed was set to use the 3" wide printer with the roll paper
                      IF a5_eval_expression("=Var->Print_On=.T. .AND. Customer->Receiptsiz=\"Default\"") THEN
                      record_number = current_record_number()
                      query.filter = "recno() = " + record_number
                      query.order = ""
                      'This script will override certain of the printer properties that are specified in the saved layout.
                      delete options
                      dim options as p
                      'before you can initialize 'options' using the property_from_string() function at least one dot variable must exist. therefore, create a dummy variable.
                      options.dummy = 1
                      options_text = <<%str%
                      <copies=2>
                      %str%
                      'create a dot variable from options_text. the dot variable contains the printer properties to be overriden
                      property_from_string(options,options_text)
                      'now you can delete the dummy variable
                      delete option.dummy
                      'oldOptions will store the current printer options, so that we can restore them.
                      delete oldOptions
                      dim oldOptions as p
                      oldOptions.dummy = 1
                      'set the printer override settings.
                      old_printer_name = report.Printer_override(a5_eval_expression(Var->Printer_40Column),options,oldOptions)
                      'delete the dummy variable
                      delete oldOptions.dummy
                      :Report.Print("40C_Sales_Reciept",query.filter,query.order)
                      'Now restore the original printer settings
                      report.printer_override(old_printer_name,oldOptions)

                      'Check to see if the cashier has temporarily disabled printing by unticking the check box "Print ON" which is attached to the variable Var->Print_On, afterwards, check to see if the invoice to be printed is set to use the letter size printer
                      else if a5_eval_expression("=Var->Print_On=.T. .AND. Customer->Receiptsiz=\"Letter\"") THEN
                      record_number = current_record_number()
                      query.filter = "recno() = " + record_number
                      query.order = ""
                      'This script will override certain of the printer properties that are specified in the saved layout.
                      delete options
                      dim options as p
                      'before you can initialize 'options' using the property_from_string() function at least one dot variable must exist. therefore, create a dummy variable.
                      options.dummy = 1
                      options_text = <<%str%
                      <papersize="Letter">
                      <copies=2>
                      %str%
                      'create a dot variable from options_text. the dot variable contains the printer properties to be overriden
                      property_from_string(options,options_text)
                      'now you can delete the dummy variable
                      delete option.dummy
                      'oldOptions will store the current printer options, so that we can restore them.
                      delete oldOptions
                      dim oldOptions as p
                      oldOptions.dummy = 1
                      'set the printer override settings.
                      old_printer_name = report.Printer_override(a5_eval_expression(Var->Printer_Letter),options,oldOptions)
                      'delete the dummy variable
                      delete oldOptions.dummy
                      :Report.Print("Sales_Reciept",query.filter,query.order)
                      'Now restore the original printer settings
                      report.printer_override(old_printer_name,oldOptions)
                      end if

                      I don't know if there's another option to getting this done, or an easier way, but it does accomplish the task which is:
                      allow the end user to set 2 printers that will each print a specific report without the windows printer dialog, then having a condition deciding which of the 2 reports to print at a particular moment.

                      Thanks again for all the suggestions guys.

                      Comment


                        #12
                        Re: Printer Select Dialog Box

                        And thank you Nigel for taking the trouble to post an elegant solution!
                        See our Hybrid Option here;
                        https://hybridapps.example-software.com/


                        Apologies to anyone I haven't managed to upset yet.
                        You are held in a queue and I will get to you soon.

                        Comment


                          #13
                          Re: Printer Select Dialog Box

                          My pleasure!

                          Comment


                            #14
                            Re: Printer Select Dialog Box

                            Hi Nigel,

                            At my dentist's office they have the choice of giving me a regular tape receipt or a 'full' receipt. The tape receipt is always produced, but they have the option of whether to produce the other for me. Is this at all similar to what you are trying to accomplish, or am I missing the purpose of this scenario altogether?
                            Robin

                            Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                            Comment


                              #15
                              Re: Printer Select Dialog Box

                              Not really Robin, that sounds like 2 reports with the usual printer setup. The small receipt is set to be printed on the default printrer, then the large one is set to display the windows print dialogue.

                              In my setup, the cashier never sees the windows print dialog and is at no time prompted for which report to print or which printer to use.

                              For the average customer buying a quart of oil or a chips and soda, the small receipt is printed, but for the larger customers buying hundreds of dollars worth of fuel and buckets of oils, the large one is printed.
                              of course the cashier does he the option of switching if they need to, but unless they instruct the software to do otherwise, it folows the rules which is small receipt for john, large for tom, a single receipt for those paying on the spot, 2 copies for credit.

                              Comment

                              Working...
                              X