$YPos -= 2 * $line_height;
}
$YPos -= 2 * $line_height;
/*Print out the grand totals */
$LeftOvers = $pdf->addTextWrap(80, $YPos, 260 - $Left_Margin, $FontSize, _('Grand Total Value'), 'right');
$DisplayTotalVal = locale_money_format($Tot_Val, $_SESSION['CompanyRecord']['currencydefault']);
$LeftOvers = $pdf->addTextWrap(500, $YPos, 60, $FontSize, $DisplayTotalVal, 'right');
if ($_POST['DetailedReport'] == 'Yes') {
    $pdf->line($Left_Margin, $YPos + $line_height - 2, $Page_Width - $Right_Margin, $YPos + $line_height - 2);
    $YPos -= 2 * $line_height;
}
if ($ListCount == 0) {
    $title = _('Print Inventory Valuation Error');
    include 'includes/header.inc';
    echo '<br />' . _('There were no items with any value to print out for the location specified');
    echo '<br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>';
    include 'includes/footer.inc';
    exit;
    // Javier: needs check
} else {
    include 'includes/htmlMimeMail.php';
    $pdf->Output($_SESSION['reports_dir'] . '/InventoryReport.pdf', 'F');
    $pdf->__destruct();
    $mail = new htmlMimeMail();
    $attachment = $mail->getFile($_SESSION['reports_dir'] . '/InventoryReport.pdf');
    $mail->setText(_('Please find herewith the stock valuation report'));
    $mail->setSubject(_('Inventory Valuation Report'));
    $mail->addAttachment($attachment, 'InventoryReport.pdf', 'application/pdf');
    $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . "<" . $_SESSION['CompanyRecord']['email'] . ">");
    $result = $mail->send($Recipients);
}