2 Replies Latest reply on Jan 30, 2015 7:45 AM by Mark Robertson

    Using area costing for Plotter printing.  It appears if the patron adds a custom size, I get a cost with an extended decimal

    Mark Robertson Ranger

      IE.  24.6901 cents

       

      Is there a way in the cost set up to either round up or round down to the closest whole cent?

       

      thanks

       

      Mark

        • Re: Using area costing for Plotter printing.  It appears if the patron adds a custom size, I get a cost with an extended decimal
          Nic Meadows Ranger

          Mark,

           

          Pharos use the SQL money data type for all the job cost calculations in the stored procedures. This has a 4 decimal place precision. The job cost is usually rounded based upon the regional settings of the print server. Not sure why on area costing it is not rounded, maybe by design? (Question for Pharos!) but it isn't.

           

          The way we've overcome this in the past is with a small script. Example below, this just truncates to 2dp but you can easily add a rounding routine. Also the script below will apply to all queues, again this can be easily modified to only apply to specific queues by checking the PlugIn.Queue value.

           

           

          import "IO";

          import "List";

          import "String";

           

          new iDecimalPlaces = 2;

          new iListCounter =0;

          new bTruncate = false;

          new sJobCost = "" + PlugIn.JobCost;

           

          // Check to see if job has custom page size, if not use standard JCM instead

          IO.PrintLine(PlugIn.JobAttrs);

          while (iListCounter < List.Length(PlugIn.JobAttrs))

          {

              if(PlugIn.JobAttrs[iListCounter] == "Custom")

              {

                  // Custome attribute found exit loop.

                  bTruncate = true;

                  iListCounter = List.Length(PlugIn.JobAttrs);

              }

              else

              {

                  iListCounter+=1;

              }

          }

           

          if(bTruncate)

          {

              // Truncate required

              // Find the decimal point and truncate. NB no rounding here, just a truncate!

              String.Left(sJobCost, String.Find(sJobCost, ".") + iDecimalPlaces + 1 );

            

              // Assign the truncated JobCost for the script to return  

              PlugIn.JobCost = sJobCost;

              IO.PrintLine("New JobCost: " + PlugIn.JobCost);

          }

          else

          {

              IO.PrintLine("Not Custom Page Size. No Action Required.");

          }

          2 of 2 people found this helpful