PaperCut device scripting - auto charge to shared account

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cadkins
    Technician
    • Apr 2010
    • 34

    #1

    PaperCut device scripting - auto charge to shared account

    Good afternoon!

    I am working on a couple scripts but I am having a bit of an issue when it comes to device scripting and copying.
    Here is what I need to accomplish.

    Customer has students that are set to restricted and carries a balance. During part of the day, they use devices in a teachers area and when they use these devices, their account should not be debited. I was just going to alter the charges for these devices for these students and set the cost of the job at a $0 amount but the customer does need to show a cost. So, I moved to using "Shared Accounts". This works great for printing and I can just call the function "actions.job.chargeToSharedAccount(accountName )".

    However, it doesn't seem that this is available for device functions with copying! Anyone have an idea on how I can make it so that if one of these students use a certain device, that all copies are charged automatically to the shared account. I do not want to enable shared accounts for their login because most of the time, they will be using their personal account and we don't want to install the client on a 100+ computers for this.

    Thanks in advance!
  • diedux
    Trusted Tech

    Site Contributor
    100+ Posts
    • Jan 2017
    • 124

    #2
    Hey,
    Account selection is available for copying and scanning. It's also available for a print jobs AFTER you print - before release. But you don't want to use it.


    If you don't use a shared account, it means you should alter the way user is charged. So give a discount (100%). You even have a complete script ready for you. Just change a group discount ant whatever you need.

    /*
    * Give teachers/students a 50% discount for copying and scanning.
    */
    function deviceJobLogHook(inputs, actions) {

    var DISCOUNT_GROUP = "Staff";
    var DISCOUNT_AMOUNT = 50; // 50% off

    // Check if user is a staff member and that this was a copy job
    if (inputs.user.isInGroup(DISCOUNT_GROUP) && (inputs.job.isCopy || inputs.job.isScan)) {

    actions.log.debug("Cost before discount: " + inputs.job.cost);
    var discountedCost = inputs.job.cost - (inputs.job.cost * (DISCOUNT_AMOUNT / 100));

    actions.job.setCost(discountedCost);
    actions.job.addComment(DISCOUNT_AMOUNT + "% discount applied.");
    actions.log.debug("Cost after discount is applied: " + discountedCost);
    }

    Print jobs could also be handled with scripting but it's done from the "printer" side.
    BR.

    Comment

    Working...