Print Roll Formatted



  • Looked into printing vouchers by roll. Dived into coding and the result is not bad.  :D







  • Banned

    Looks somewhat like this reasonably intergrated: http://sourceforge.net/projects/vouchergen/

    Perhaps someone could finally submit some patches, instead of showing off some random screenshots of unknown code that gets lost again and never gets integrated. Sigh.



  • @doktornotor:

    Looks somewhat like this reasonably intergrated: http://sourceforge.net/projects/vouchergen/

    Perhaps someone could finally submit some patches, instead of showing off some random screenshots of unknown code that gets lost again and never gets integrated. Sigh.

    I agree. But a client paid me to have this feature in their Pf, and sharing it here for free is somehow unethical for the client. At least not for now.

    I am posting this partly as an attempt to show to the Pf devs or whoever contributor to this great system, that this simple button to print the roll with proper format using few lines of CSS is very possible and simple - considering PHP is not my main job.

    Also I am posting this to show an alternative to the "voucher manager" or "voucher generator" systems, that other devs put great efforts on making(ie. the link you posted).

    I too hope that Pf Captive Portal will evolve into a fully featured Hotspot manager system like Unifi Controller or Tanaza does. Until then people will keep on showing few patches and get lost in the wind.


  • Rebel Alliance Developer Netgate

    Those do look pretty good. I love the idea of having a means to print them out formatted, but the problem becomes a bit of a bikeshed formatting discussion when people want many different things (X labels per row/column, Y size labels, Z type of printer, etc). It quickly becomes a lot more complicated to code up a proper GUI.

    As for the client, on the one hand I can understand where they are coming from, but on the other hand it's an open source platform and it would be nice if something (code, hardware sales, etc) made its way back into the project since their business benefits from it.


  • Banned

    Well, the vouchergen thing linked above prints into PDF on itself, using fPDF. That doesn't work with unicode chars. So, I replaced that with tFPDF. What you mentioned is actually configurable via GUI (also paper formats, like the US letter vs A4 etc.), but…

    • the level of integration with pfSense is exactly zero (beyond importing of the voucher rolls).
    • the code is buggy like hell (I made only the very essential fixes to make it run on actually maitained PHP versions.)
    • all the comments are in German;
    • it uses MySQL as storage.

    Don't have time for that, certainly not unless someone produces a reasonable bounty. Plus, until the 2.3 code gets stabilized, it's just a waste of time.


  • Rebel Alliance Developer Netgate

    Indeed. I'd rather see a CSS solution than PDF, but that's probably not as printer-friendly. Less overhead in terms of requirements to install, implementation size, etc.


  • Banned

    Kinda convinced it could be shrinked into ~2 files, (one with some GUI code, one include), plus the tFTPD thing (which is basically one PHP class plus Dejavu fonts. All the authentication crap could go to /dev/null, there's also some Germany-only SMS nonsense bundled.

    Still, nontrivial amount of work, and time consuming.

    If someone wants to start a bounty - the primary prerequisite is that the code goes to pfSense itself, BSD-licensed. Definitely not another round of "client paid me to have this feature, look - it's nice…"



  • @doktornotor:

    Well, the vouchergen thing linked above prints into PDF on itself, using fPDF. That doesn't work with unicode chars. So, I replaced that with tFPDF. What you mentioned is actually configurable via GUI (also paper formats, like the US letter vs A4 etc.), but…

    • the level of integration with pfSense is exactly zero (beyond importing of the voucher rolls).
    • the code is buggy like hell (I made only the very essential fixes to make it run on actually maitained PHP versions.)
    • all the comments are in German;
    • it uses MySQL as storage.

    Don't have time for that, certainly not unless someone produces a reasonable bounty. Plus, until the 2.3 code gets stabilized, it's just a waste of time.

    Hi everyone,

    I'm the guy who developed the vouchergen thing ;). I'm well aware of the current problems, and will fix at least some stuff since it seems to be somewhat popular in Germany (it was initially developed just for a single use case and I decided to share it afterwards…). Someone actually built something based on some code of my script which integrates into pfSense: http://sourceforge.net/projects/captiveportalplus/

    Still not integrated as package or something, but probably closer than my "integration"...



  • it would be nice if something (code, hardware sales, etc) made its way back into the project since their business benefits from it.

    Instructions:

    Copy everything inside 2.2.4 or 2.0.3 folder to "/usr/local/www" of your PF. It will create a new folder "voucherfiles", and a new file " services_captiveportal_vouchers_print.php", and will also replace your "services_captiveportal_vouchers.php", so backup the original. Everything else is new, which can be deleted whenever you want.

    Replace the background image to your company logo, or adjust table layout to whatever suits you.

    cp_print_roll.zip



  • thanks dude it was exactly what i'm looking for, can i customize it little more :D :D



  • @dpa:

    it would be nice if something (code, hardware sales, etc) made its way back into the project since their business benefits from it.

    Instructions:

    Copy everything inside 2.2.4 or 2.0.3 folder to "/usr/local/www" of your PF. It will create a new folder "voucherfiles", and a new file " services_captiveportal_vouchers_print.php", and will also replace your "services_captiveportal_vouchers.php", so backup the original. Everything else is new, which can be deleted whenever you want.

    Replace the background image to your company logo, or adjust table layout to whatever suits you.

    dear what about 2.2.6. same procedure for it.



  • @kiwienka:

    thanks dude it was exactly what i'm looking for, can i customize it little more :D :D

    Yeah you can customize it, it's only html/css.

    I added color coding (different background images) based on number of minutes. You can change the settings-number of minutes in services_captiveportal_vouchers_print.php lines 121-156. See attached

    2.2.4.zip



  • @ishtiaqaj:

    @dpa:

    it would be nice if something (code, hardware sales, etc) made its way back into the project since their business benefits from it.

    Instructions:

    Copy everything inside 2.2.4 or 2.0.3 folder to "/usr/local/www" of your PF. It will create a new folder "voucherfiles", and a new file " services_captiveportal_vouchers_print.php", and will also replace your "services_captiveportal_vouchers.php", so backup the original. Everything else is new, which can be deleted whenever you want.

    Replace the background image to your company logo, or adjust table layout to whatever suits you.

    dear what about 2.2.6. same procedure for it.

    I have not looked into 2.2.6, some reported it isn't working on the latest release.



  • Hi Dpa,
    I'd like to let you know that I've just posted a roll print mod based on your code!
    I've added some extra options, fixed some bugs, and rewrote all the HTML/CSS part using divs.

    Here's the link to the post:
    https://forum.pfsense.org/index.php?topic=108846.0

    Let me know what do you think  :)

    Daniele



  • Will it be possible for you to update "services_captiveportal_vouchers.php" to run smoothly with pfSense 2.3 ?