Method used to produce final figures for deductions. This information is used to produce the output<br>
shown on the checkout pages
485355
function process() {
    global $order, $currencies;
    $order_total = $this->get_order_total(isset($_SESSION['cc_id']) ? $_SESSION['cc_id'] : '');
    $od_amount = $this->calculate_deductions($order_total['total']);
    $this->deduction = $od_amount['total'];
    if ($od_amount['total'] > 0) {
      reset($order->info['tax_groups']);
      $tax = 0;
      while (list($key, $value) = each($order->info['tax_groups'])) {
        if ($od_amount['tax_groups'][$key]) {
          $order->info['tax_groups'][$key] -= $od_amount['tax_groups'][$key];
          $order->info['tax_groups'][$key] = zen_round($order->info['tax_groups'][$key], $currencies->get_decimal_places($_SESSION['currency']));
          $tax += $od_amount['tax_groups'][$key];
        }
      }
      // free shipping for free shipping 'S' or percentage off and free shipping 'E' or amount off and free shipping 'O'
      if ($od_amount['type'] == 'S' || $od_amount['type'] == 'E' || $od_amount['type'] == 'O') $order->info['shipping_cost'] = 0;
      $order->info['total'] = $order->info['total'] - $od_amount['total'];
      if (DISPLAY_PRICE_WITH_TAX != 'true') {
        $order->info['total'] -= $tax;
      }
      $order->info['tax'] = $order->info['tax'] - $tax;
      //      if ($this->calculate_tax == "Standard") $order->info['total'] -= $tax;
      if ($order->info['total'] < 0) $order->info['total'] = 0;
      $this->output[] = array('title' => $this->title . ': ' . $this->coupon_code . ' :',
                              'text' => '-' . $currencies->format($od_amount['total']),
                              'value' => $od_amount['total']);
    }
  }
1064997
def finalize(self):
        """"""
        # Merge all the out_DDB files found in work.outdir.
        ddb_files = list(filter(None, [work.outdir.has_abiext("DDB") for work in self]))

        # Final DDB file will be produced in the outdir of the work.
        out_ddb = self.outdir.path_in("out_DDB")
        desc = "DDB file merged by %s on %s" % (self.__class__.__name__, time.asctime())

        mrgddb = wrappers.Mrgddb(manager=self.manager, verbose=0)
        mrgddb.merge(self.outdir.path, ddb_files, out_ddb=out_ddb, description=desc)
        print("Final DDB file available at %s" % out_ddb)

        # Call the method of the super class.
        retcode = super().finalize()
        return retcode
367394
def finalize
      @transactions.sort! { |a, b| a.date <=> b.date }
      balance = Value.new(0)
      @balances = @transactions.map do |act_txn|
        balance += act_txn.value
        {
          date: act_txn.date,
          value: balance,
        }
      end
    end
1108257
private function calculateLastItemOnPage()
    {
        // When no limit, the last item is the total amount of items
        if (! $this->hasLimit()) {
            $this->setLastItemOnPage($this->getTotalItems());
            return;
        }

        // Determine the last item on the page
        $lastItem = $this->getOffset() + $this->getLimit();
        if ($this->getTotalItems() !== 0 && $lastItem > $this->getTotalItems()) {
            $lastItem = $this->getTotalItems();
        }

        $this->setLastItemOnPage((int)$lastItem);
    }
757747
public function debug_summary() {
        $summary = '';
        $summary .= 'General type: ' . $this->pagelayout . '. ';
        if (!during_initial_install()) {
            $summary .= 'Context ' . $this->context->get_context_name() . ' (context id ' . $this->_context->id . '). ';
        }
        $summary .= 'Page type ' . $this->pagetype .  '. ';
        if ($this->subpage) {
            $summary .= 'Sub-page ' . $this->subpage .  '. ';
        }
        return $summary;
    }
416487
public OptionalInt getLastPage() {
        if(total.isPresent()) {
            return of(calcLastPage(total.getAsInt(), pageSize));
        } else {
            return empty();
        }
    }
40020
public function parseOrderDetails()
    {
        // remove previous OrderDetails and OrderOptions so we don't end up with duplicates
        foreach ($this->Details() as $detail) {
            /** @var OrderOption $orderOption */
            foreach ($detail->OrderOptions() as $orderOption) {
                $orderOption->delete();
            }
            $detail->delete();
        }

        $transaction = $this->getTransaction()->getTransaction();

        // Associate ProductPages, Options, Quantity with Order
        foreach ($transaction->transaction_details->transaction_detail as $detail) {
            $OrderDetail = OrderDetail::create();

            $OrderDetail->Quantity = (int)$detail->product_quantity;
            $OrderDetail->ProductName = (string)$detail->product_name;
            $OrderDetail->ProductCode = (string)$detail->product_code;
            $OrderDetail->ProductImage = (string)$detail->image;
            $OrderDetail->ProductCategory = (string)$detail->category_code;
            $priceModifier = 0;

            // parse OrderOptions
            foreach ($detail->transaction_detail_options->transaction_detail_option as $option) {
                // Find product via product_id custom variable
                if ($option->product_option_name == 'product_id') {
                    // if product is found, set relation to OrderDetail
                    $OrderProduct = ProductPage::get()->byID((int)$option->product_option_value);
                    if ($OrderProduct) {
                        $OrderDetail->ProductID = $OrderProduct->ID;
                    }
                } else {
                    $OrderOption = OrderOption::create();
                    $OrderOption->Name = (string)$option->product_option_name;
                    $OrderOption->Value = (string)$option->product_option_value;
                    $OrderOption->write();
                    $OrderDetail->OrderOptions()->add($OrderOption);

                    $priceModifier += $option->price_mod;
                }
            }

            $OrderDetail->Price = (float)$detail->product_price + (float)$priceModifier;

            // extend OrderDetail parsing, allowing for recording custom fields from FoxyCart
            $this->extend('handleOrderItem', $order, $response, $OrderDetail);

            // write
            $OrderDetail->write();

            // associate with this order
            $this->Details()->add($OrderDetail);
        }
    }
694773
private void printReport() {
		System.out.println("Processed " + this.countItems + " items:");
		System.out.println(" * Properties encountered: "
				+ this.propertyRecords.size());
		System.out.println(" * Property documents: " + this.countProperties);
		System.out.println(" * Classes encountered: "
				+ this.classRecords.size());
		System.out.println(" * Class documents: " + this.countClasses);
	}
692162
private int calcLastPage(int total, int pageSize) {
        if (total == 0) {
            return firstPage;
        } else {
            final int zeroBasedPageNo = total % pageSize > 0
                    ? total / pageSize
                    : total / pageSize - 1;
            return firstPage + zeroBasedPageNo;
        }
    }
941383
def finalize(self):
        """"""
        for name, count in sorted(self.blocks.items(), key=lambda x: x[1]):
            print('{:3} {}'.format(count, name))
        print('{:3} total'.format(sum(self.blocks.values())))
370417
def summary(images, max)
      return <<-EOF

        Creating a sprite from following images:
        \n#{images.map{|i| "        #{report_path(i[:filename])} (#{i[:width]}x#{i[:height]})" }.join("\n")}

        Output files:
          #{report_path(output_image_file)}
          #{report_path(output_style_file)}

        Output size:
          #{max[:width]}x#{max[:height]}

      EOF
    end
375995
public void printDataEndForm(PrintWriter out, int iPrintOptions)
    {
        out.println("</tr>\n</table>");
        if ((iPrintOptions & HtmlConstants.DETAIL_SCREEN) != 0)
            out.println("</td>\n</tr>");
    }
18498
public function output()
    {
        $data = [
            'classes' => [],
            'files'   => [],
        ];
        foreach ($this->processed as $type => $classes) {
            foreach ($classes as $name => $values) {
                $covered = $values['covered'];
                $total   = $values['total'];
                $pct     = (((int) $covered / (int) $total) * 100);

                $covered    = str_pad((string) $covered, 7, ' ', STR_PAD_LEFT);
                $total      = str_pad((string) $total, 5, ' ', STR_PAD_LEFT);
                $percentage = number_format($pct, 2).'%';
                $percentage = str_pad((string) $percentage, 10, ' ', STR_PAD_LEFT);

                if ($pct < 25) {
                    $covered    = $this->output->red($covered);
                    $total      = $this->output->red($total);
                    $percentage = $this->output->red($percentage);
                }

                if ($pct < 75) {
                    $covered    = $this->output->black->yellow($covered);
                    $total      = $this->output->black->yellow($total);
                    $percentage = $this->output->black->yellow($percentage);
                }

                if ($pct >= 75) {
                    $covered    = $this->output->green($covered);
                    $total      = $this->output->green($total);
                    $percentage = $this->output->green($percentage);
                }

                $data[$type][] = [$name, $covered, $total, $percentage];
            }
        }

        $out = [];
        if (count($data['classes']) > 0) {
            array_unshift($data['classes'], ['Class', 'Covered', 'Lines', 'Percentage']);

            $out[] = new Table($data['classes'], [
                'headerColor'     => Graphite::YELLOW,
                'columnSeparator' => '',
                'headerSeparator' => '',
                'cellPadding'     => 1,
            ]);
        }

        if (count($data['files']) > 0) {
            array_unshift($data['files'], ['File', 'Covered', 'Lines', 'Percentage']);

            $out[] = new Table($data['files'], [
                'headerColor'     => Graphite::YELLOW,
                'columnSeparator' => '',
                'headerSeparator' => '',
                'cellPadding'     => 1,
            ]);
        }

        return $this->output->render(implode("\n\n", $out));
    }
259094
def export
      print "Exporting: #{@name} (#{pages} pages)" if verbose

      rows_exported = 0
      @exporter.output.execute("CREATE TABLE #{@name.underscore} ( data TEXT )")
      0.upto(pages - 1).each do |page|
        records_for_page(page).each_slice(Exporter::INSERT_BATCH_SIZE) do |rows|
          data = rows.map { |x| @exporter.sanitize_row(@name, x) }.map(&:to_json)

          @exporter.output.execute("INSERT INTO #{@name.underscore} (data) VALUES #{Array.new(rows.size) { '(?)' }.join(',')}", data)
          rows_exported += rows.size
        end

        print '.' if verbose
      end
      puts '' if verbose
      columns = ActiveRecord::Base.connection.columns(@name).map(&:name)
      @exporter.output.execute('INSERT INTO tables VALUES (?, ?, ?)', [@name, rows_exported, columns.to_json])
    end
570881
function summariser(results) {
    var response = [],
        callback = function(output) {
            response.push(output);
        };

    var passed = 0;
    if (results.hasOwnProperty('passed')) {
        passed = countSpecs(results.passed);
    }
    var failed = 0;
    if (results.hasOwnProperty('failed')) {
        failed = countSpecs(results.failed);
    }
    var pending = 0;

    if (results.hasOwnProperty('pending')) {
        pending = countSpecs(results.pending);
    }
    var total = passed + failed + pending;

    coloriseOutput(total + ' Specs defined', 'bold', callback);
    if (total > 0) {
        coloriseOutput(passed + ' Passed' + displayPercentage(total, passed), 'green', callback);
        coloriseOutput(failed + ' Failed' + displayPercentage(total, failed), 'red', callback);
        coloriseOutput(pending + ' Pending' + displayPercentage(total, pending), 'yellow', callback);
    }
    return response;
}
694963
def esr_recipe(invoice, account, sender, print_payment_for)
      bounding_box [cm2pt(0.4), cm2pt(9.6)], :width => cm2pt(5) do
        indent cm2pt(0.4) do
          draw_account_detail(account.bank, sender, print_payment_for)
        end
        draw_account(account)
        draw_amount(invoice.balance.currency_round)

        bounding_box [cm2pt(0.4), bounds.top - cm2pt(5.2)], :width => cm2pt(5) do
          text esr9_reference(invoice, account), :size => 7

          text " "

          draw_address invoice.customer.vcard
        end
      end

      bounding_box [cm2pt(6.4), cm2pt(9.6)], :width => cm2pt(5) do
        draw_account_detail(account.bank, sender, print_payment_for)
        draw_account(account)
        draw_amount(invoice.balance.currency_round)
      end

      font_size 10 do
        character_spacing 1.1 do
          draw_text esr9_reference(invoice, account), :at => [cm2pt(12.7), cm2pt(6.8)]
        end
      end

      bounding_box [cm2pt(12.7), cm2pt(5.5)], :width => cm2pt(7.5) do
        draw_address(invoice.customer.vcard)
      end

      # ESR-Reference
      if ::Rails.root.join('data/ocrb10.ttf').exist?
        ocr_font = ::Rails.root.join('data/ocrb10.ttf')
      else
        ocr_font = "Helvetica"
        ::Rails.logger.warn("No ocrb10.ttf found for ESR reference in #{::Rails.root.join('data')}!")
      end

      font ocr_font, :size => 11 do
        character_spacing 0.5 do
          draw_text esr9(invoice, account), :at => [cm2pt(6.7), cm2pt(1.7)]
        end
      end
    end
680906
private void createTransactionSummary(FilePath reportFolder,
                                          String testFolderPath,
                                          File artifactsDir,
                                          List<String> reportNames,
                                          TestResult testResult) throws IOException, InterruptedException {

        File testFolderPathFile = new File(testFolderPath);
        String subFolder = HTML_REPORT_FOLDER + File.separator + IE_REPORT_FOLDER + File.separator + HTML_REPORT_FOLDER;
        FilePath htmlReportPath = new FilePath(reportFolder, subFolder);
        if (htmlReportPath.exists()) {
            File reportDirectory = new File(artifactsDir.getParent(), TRANSACTION_SUMMARY_FOLDER);
            if (!reportDirectory.exists()) {
                reportDirectory.mkdir();
            }
            String newFolderName = org.apache.commons.io.FilenameUtils.getName(testFolderPathFile.getPath());
            File testDirectory = new File(reportDirectory, newFolderName);
            if (!testDirectory.exists()) {
                testDirectory.mkdir();
            }

            FilePath dstReportPath = new FilePath(testDirectory);
            FileFilter reportFileFilter = new WildcardFileFilter(TRANSACTION_REPORT_NAME + ".*");
            List<FilePath> reporFiles = htmlReportPath.list(reportFileFilter);
            for (FilePath fileToCopy : reporFiles) {
                FilePath dstFilePath = new FilePath(dstReportPath, fileToCopy.getName());
                fileToCopy.copyTo(dstFilePath);
            }
            FilePath cssFilePath = new FilePath(htmlReportPath, "Properties.css");
            if (cssFilePath.exists()) {
                FilePath dstFilePath = new FilePath(dstReportPath, cssFilePath.getName());
                cssFilePath.copyTo(dstFilePath);
            }
            FilePath pngFilePath = new FilePath(htmlReportPath, "tbic_toexcel.png");
            if (pngFilePath.exists()) {
                FilePath dstFilePath = new FilePath(dstReportPath, pngFilePath.getName());
                pngFilePath.copyTo(dstFilePath);
            }

            outputReportFiles(reportNames, reportDirectory, testResult, true);

        }

    }