! -> Note
$ -> Affected files
+03-Mar-2009 Joe Hunt/Janusz Dobrowolski
++ Preparation for Excel Writer continued
+$ /reporting/includes/ExcelWriterXML.php
+ /reporting/includes/ExcelWriterXML_Sheet.php
+ /reporting/includes/ExcelWriterXML_Style.php
+ /reporting/includes/excel_report.inc
+ /reporting all repXXX.php that are not documents
+
02-Mar-2009 Joe Hunt
+ Preparation for report destination PDF/Printer and Excel (and Open Office Calc)
$ /reporting/includes/reports_classes.inc
function ExcelWriterXML($fileName = 'file.xml')
{
// Add default style
- $style = $this->addStyle('Default');
+ $style =& $this->addStyle('Default');
$style->name('Normal');
$style->alignVertical('Bottom');
* will default to "CustomStyle" + n (e.g. "CustomStyle1")
* @return ExcelWriterXML_Style Reference to a new style class
*/
- function addStyle($id = null)
+ function &addStyle($id = null)
{
static $styleNum = 1;
if (trim($id) == '')
}
$style =& new ExcelWriterXML_Style($id);
- $this->styles[] = $style;
- return ($style);
+ $this->styles[$id] = &$style;
+ return $style;
}
/**
* will default to "Sheet" + n (e.g. "Sheet1")
* @return ExcelWriterXML_Sheet Reference to a new sheet class
*/
- function addSheet($id = null)
+ function &addSheet($id = null)
{
static $sheetNum = 1;
if (trim($id) == '')
}
$sheet =& new ExcelWriterXML_Sheet($id);
- $this->sheets[] = $sheet;
- return ($sheet);
+ $this->sheets[$id] = &$sheet;
+ return $sheet;
}
/**
* @param string $id The sheet id to be checked
* @return boolean True if the id is unique, false otherwise
*/
- function _checkSheetID($id){
- foreach($this->sheets as $sheet)
- {
- $sheetID = $sheet->getID();
- if ($id == $sheetID)
+ function _checkSheetID($id)
{
- return false;
- }
- }
- return true;
+ return !isset($this->sheets[$id]);
}
/**
*/
function _checkStyleID($id)
{
- foreach($this->styles as $style)
- {
- $styleID = $style->getID();
- if ($id == $styleID)
- {
- return false;
- }
- }
- return true;
+ return !isset($this->styles[$id]);
}
// 2009-02-28 Added by Joe Hunt, FA
if ($this->showErrorSheet == true)
{
- $format = $this->addStyle('formatErrorsHeader');
+ $format =& $this->addStyle('formatErrorsHeader');
$format->fontBold();
$format->bgColor('red');
}
-
if (!empty($this->docTitle))
$docTitle = '<Title>'.htmlspecialchars($this->docTitle).'</Title>'."\r";
if (!empty($this->docSubject))
if ($errors == true && $this->showErrorSheet == true)
{
- $sheet = $this->addSheet('formatErrors');
+ $sheet =& $this->addSheet('formatErrors');
$sheet->cellMerge(1,1,3,0); // Merge the first three cells across in row 1
$sheet->writeString(1,1,'Formatting Errors');
$sheet->writeString(2,1,'Type','formatErrorsHeader');
{
if ($style != null)
{
- if (gettype($style) == 'object')
+/* if (gettype($style) == 'object')
{
if (get_class($style) == 'ExcelWriterXML_Style')
{
}
}
else
- {
+*/ {
$styleID = $style;
}
}
function getSheetXML()
{
ksort($this->cells);
-
$displayRightToLeft = ($this->displayRightToLeft) ? 'ss:RightToLeft="1"' : '';
$xml = '<Worksheet ss:Name="'.$this->id.'" '.$displayRightToLeft.'>'."\r";
$numberFormat = '';
- //if (empty($this->id))
+ //if (empty($this->id)) //***
// throw new exception;
if (!empty($this->name)){$name = 'ss:Name="'.$this->name.'"';}
include_once($path_to_root . "/admin/db/company_db.inc");
include_once($path_to_root . "/config.php");
-//class FrontReport extends ExcelWriterXML
-class FrontReport
+class FrontReport extends ExcelWriterXML
{
var $xml;
var $size;
var $title;
var $filename;
var $path;
- var $lineHeight;
var $rtl;
var $code;
var $bottomMargin = 0;
+ var $lineHeight;
+ var $leftMargin = 0;
var $cols;
var $params;
var $currency;
var $row = 9999999;
var $y;
+ var $numcols;
var $sheet;
- var $formatTitle;
- var $formatDateTime;
- var $formatDate;
- var $formatRight;
- var $formatHeaderLeft;
- var $formatHeaderRight;
- var $formatAmount = array();
- var $formatFooter;
function FrontReport($title, $filename, $size = 'A4', $fontsize = 9)
{
$this->code = $_SESSION['language']->encoding;
$this->filename = $filename;
$this->path = $comp_path.'/'.user_company(). '/pdf_files/';
- //$this->ExcelWriterXML($this->filename);
- $this->xml = new ExcelWriterXML($this->filename);
- $this->xml->setCharSet($this->code);
- $this->xml->overwriteFile();
- $this->xml->showErrorSheet(true);
- $this->sheet = $this->xml->addSheet($this->title);
+ $this->ExcelWriterXML($this->filename);
+ $this->setCharSet($this->code);
+ $this->overwriteFile();
+ $this->showErrorSheet(true);
+
+ $this->sheet =& $this->addSheet($this->title);
if ($this->rtl === 'rtl')
$this->sheet->displayRightToLeft();
- $this->formatTitle = $this->xml->addStyle('formatTitle');
- $this->formatTitle->fontSize('18');
- $this->formatTitle->fontBold();
- $this->formatTitle->border('Top', '2', 'darkgray');
+ $formatTitle =& $this->addStyle('formatTitle');
+ $formatTitle->fontSize('16');
+ $formatTitle->fontBold();
+ $formatTitle->border('Top', '2', 'darkgray');
$how = user_date_format();
$sep = $dateseps[user_date_sep()];
$dateformat_long = "yyyy{$sep}mm{$sep}dd\ \ hh:mm";
$dateformat = "yyyy{$sep}mm{$sep}dd";
}
- $this->formatDateTime = $this->xml->addStyle('formatDateTime');
- $this->formatDateTime->numberFormatDateTime($dateformat_long);
- $this->formatDateTime->alignHorizontal('Left');
- $this->formatDate = $this->xml->addStyle('formatDate');
- $this->formatDate->numberFormatDateTime($dateformat);
- $this->formatDate->alignHorizontal('Left');
- $this->formatRight = $this->xml->addStyle('formatRight');
- $this->formatRight->alignHorizontal('Right');
+ $formatDateTime =& $this->addStyle('formatDateTime');
+ $formatDateTime->numberFormatDateTime($dateformat_long);
+ $formatDateTime->alignHorizontal('Left');
+ $formatDate =& $this->addStyle('formatDate');
+ $formatDate->numberFormatDateTime($dateformat);
+ $formatDate->alignHorizontal('Left');
+ $formatRight =& $this->addStyle('formatRight');
+ $formatRight->alignHorizontal('Right');
- $this->formatHeaderLeft = $this->xml->addStyle("formatHeaderLeft");
- $this->formatHeaderLeft->fontItalic();
- $this->formatHeaderLeft->border('Top', '2', 'darkgray');
- $this->formatHeaderLeft->border('Bottom', '2', 'darkgray');
- $this->formatHeaderLeft->alignVertical('Center');
- $this->formatHeaderRight = $this->xml->addStyle("formatHeaderRight");
- $this->formatHeaderRight->fontItalic();
- $this->formatHeaderRight->alignHorizontal('Right');
- $this->formatHeaderRight->border('Top', '2', 'darkgray');
- $this->formatHeaderRight->border('Bottom', '2', 'darkgray');
- $this->formatHeaderRight->alignVertical('Center');
- $tsep = $thoseps[user_tho_sep()];
- $dsep = $decseps[user_dec_sep()];
- $amountformat = "###{$tsep}###{$tsep}###{$tsep}##0";
- $this->formatAmount[0] = $this->xml->addStyle("formatAmount0");
- $this->formatAmount[0]->numberFormat($amountformat);
- $this->formatAmount[0]->alignHorizontal('Right');
- $this->formatAmount[1] = $this->xml->addStyle("formatAmount1");
- $this->formatAmount[1]->numberFormat("$amountformat{$dsep}0");
- $this->formatAmount[1]->alignHorizontal('Right');
- $this->formatAmount[2] = $this->xml->addStyle("formatAmount2");
- $this->formatAmount[2]->numberFormat("$amountformat{$dsep}00");
- $this->formatAmount[2]->alignHorizontal('Right');
- $this->formatAmount[3] = $this->xml->addStyle("formatAmount3");
- $this->formatAmount[3]->numberFormat("$amountformat{$dsep}000");
- $this->formatAmount[3]->alignHorizontal('Right');
- $this->formatAmount[4] = $this->xml->addStyle("formatAmount4");
- $this->formatAmount[4]->numberFormat("$amountformat{$dsep}0000");
- $this->formatAmount[4]->alignHorizontal('Right');
- $this->formatFooter = $this->xml->addStyle("formatFooter");
- $this->formatFooter->border('Top', '2', 'darkgray');
+ $formatHeaderLeft =& $this->addStyle("formatHeaderLeft");
+ $formatHeaderLeft->fontItalic();
+ $formatHeaderLeft->border('Top', '2', 'darkgray');
+ $formatHeaderLeft->border('Bottom', '2', 'darkgray');
+ $formatHeaderLeft->alignVertical('Center');
+ $formatHeaderRight =& $this->addStyle("formatHeaderRight");
+ $formatHeaderRight->fontItalic();
+ $formatHeaderRight->alignHorizontal('Right');
+ $formatHeaderRight->border('Top', '2', 'darkgray');
+ $formatHeaderRight->border('Bottom', '2', 'darkgray');
+ $formatHeaderRight->alignVertical('Center');
+ $formatFooter =& $this->addStyle("formatFooter");
+ $formatFooter->border('Top', '2', 'darkgray');
+ }
+
+ function NumFormat($dec)
+ {
+ global $thoseps,$decseps;
+
+ $dec = (int)$dec;
+ $stylename = 'formatAmount'.$dec;
+ if (!isset($this->styles[$stylename]))
+ {
+ $tsep = $thoseps[user_tho_sep()];
+ $dsep = $decseps[user_dec_sep()];
+ $format = "###{$tsep}###{$tsep}###{$tsep}##0";
+ if ($dec>0)
+ $format .= "{$dsep}".str_repeat('0',$dec);
+ $style =& $this->addStyle($stylename);
+ $style->numberFormat($format);
+ $style->alignHorizontal('Right');
+ }
+ return $stylename;
}
function Font($style = 'normal')
$cols2 = null, $headers2 = null, $aligns2 = null)
{
global $app_title, $version, $power_by, $power_url;
-
$this->company = get_company_prefs();
- $this->xml->docTitle($this->title);
- $this->xml->docAuthor($app_title . ' ' . $version);
- $this->xml->docCompany($this->company['coy_name']);
- $this->xml->docManager($power_by . ' - ' . $power_url);
+ $this->docTitle($this->title);
+ $this->docAuthor($app_title . ' ' . $version);
+ $this->docCompany($this->company['coy_name']);
+ $this->docManager($power_by . ' - ' . $power_url);
$year = get_current_fiscalyear();
if ($year['closed'] == 0)
$how = _("Active");
$this->cols2 = $cols2;
$this->headers2 = $headers2;
$this->aligns2 = $aligns2;
- for ($i = 0; $i < count($this->headers); $i++)
+ $this->numcols = count($this->headers);
+ $tcols = count($this->headers2);
+ if ($tcols > $this->numcols)
+ $this->numcols = $tcols;
+ for ($i = 0; $i < $this->numcols; $i++)
$this->sheet->columnWidth($i+1, $this->cols[$i + 1] - $this->cols[$i]);
}
function Header()
{
$this->y = 0;
+ $tcol = $this->numcols - 1;
$this->NewLine();
- $this->sheet->rowHeight($this->y, 22);
- $this->sheet->writeString($this->y, 1, $this->title, $this->formatTitle);
- $this->sheet->cellMerge($this->y, 1, count($this->headers)-1, 0);
+ $this->sheet->rowHeight($this->y, 20);
+ $this->sheet->writeString($this->y, 1, $this->title, 'formatTitle');
+ $this->sheet->cellMerge($this->y, 1, $tcol, 0);
$this->NewLine();
$str = _("Print Out Date") . ':';
$this->sheet->writeString($this->y, 1, $str);
$date = $this->sheet->convertMysqlDateTime(date('Y-m-d H:i:s'));
- $this->sheet->writeDateTime($this->y, 2, $date, $this->formatDateTime);
- $this->sheet->writeString($this->y, 4, $this->company['coy_name']);
- $this->sheet->cellMerge($this->y, 4, 1, 0);
+ $this->sheet->writeDateTime($this->y, 2, $date, 'formatDateTime');
+ $this->sheet->writeString($this->y, $tcol, $this->company['coy_name']);
+ $this->sheet->cellMerge($this->y, $tcol, 1, 0);
$this->NewLine();
$str = _("Fiscal Year") . ':';
$this->sheet->writeString($this->y, 1, $str);
$str = $this->fiscal_year;
$this->sheet->writeString($this->y, 2, $str);
- $this->sheet->writeString($this->y, 4, $this->host);
- $this->sheet->cellMerge($this->y, 4, 1, 0);
+ $this->sheet->writeString($this->y, $tcol, $this->host);
+ $this->sheet->cellMerge($this->y, $tcol, 1, 0);
for ($i = 1; $i < count($this->params); $i++)
{
if ($this->params[$i]['from'] != '')
$this->sheet->writeString($this->y, 2, $str);
if ($i == 1)
{
- $this->sheet->writeString($this->y, 4, $this->user);
- $this->sheet->cellMerge($this->y, 4, 1, 0);
+ $this->sheet->writeString($this->y, $tcol, $this->user);
+ $this->sheet->cellMerge($this->y, $tcol, 1, 0);
}
}
}
$this->NewLine();
if ($this->headers2 != null)
{
- $count = count($this->headers2);
- for ($i = 0; $i < $count; $i++)
+ for ($i = 0, $j = 0; $i < $this->numcols; $i++)
{
- if ($this->aligns2[$i] == "right")
- $this->sheet->writeString($this->y, $i + 1, $this->headers2[$i], $this->formatHeaderRight);
- else
- $this->sheet->writeString($this->y, $i + 1, $this->headers2[$i], $this->formatHeaderLeft);
+ if ($this->cols2[$j] >= $this->cols[$i] && $this->cols2[$j] <= $this->cols[$i + 1])
+ {
+ if ($this->aligns2[$j] == "right")
+ $this->sheet->writeString($this->y, $i + 1, $this->headers2[$j], 'formatHeaderRight');
+ else
+ $this->sheet->writeString($this->y, $i + 1, $this->headers2[$j], 'formatHeaderLeft');
+ $j++;
+ }
+ else
+ $this->sheet->writeString($this->y, $i + 1, "", 'formatHeaderLeft');
}
$this->NewLine();
}
- $count = count($this->headers);
- for ($i = 0; $i < $count; $i++)
+ for ($i = 0; $i < $this->numcols; $i++)
{
+ if (!isset($this->headers[$i]))
+ $header = "";
+ else
+ $header = $this->headers[$i];
if ($this->aligns[$i] == "right")
- $this->sheet->writeString($this->y, $i + 1, $this->headers[$i], $this->formatHeaderRight);
+ $this->sheet->writeString($this->y, $i + 1, $header, 'formatHeaderRight');
else
- $this->sheet->writeString($this->y, $i + 1, $this->headers[$i], $this->formatHeaderLeft);
+ $this->sheet->writeString($this->y, $i + 1, $header, 'formatHeaderLeft');
}
$this->NewLine();
}
function TextCol($c, $n, $txt, $corr=0, $r=0)
{
if ($this->aligns[$c] == 'right')
- $this->sheet->writeString($this->y, $c + 1, $txt, $this->formatRight);
+ $this->sheet->writeString($this->y, $c + 1, $txt, 'formatRight');
else
$this->sheet->writeString($this->y, $c + 1, $txt);
if ($n - $c > 1)
{
if (!is_numeric($txt))
$txt = 0;
- $this->sheet->writeNumber($this->y, $c + 1, $txt, $this->formatAmount[$dec]);
+ $this->sheet->writeNumber($this->y, $c + 1, $txt, $this->NumFormat($dec));
}
function DateCol($c, $n, $txt, $conv=false, $corr=0, $r=0)
if (!$conv)
$txt = date2sql($txt);
$date = $this->sheet->convertMysqlDate($txt);
- $this->sheet->writeDate($this->y, $c + 1, $date, $this->formatDate);
+ $this->sheet->writeDateTime($this->y, $c + 1, $date, 'formatDate');
}
function TextCol2($c, $n, $txt, $corr=0, $r=0)
function End($email=0, $subject=null, $myrow=null, $doctype = 0)
{
global $comp_path;
- $this->sheet->cellMerge($this->y, 1, count($this->headers) - 1, 0);
- $this->sheet->writeString($this->y, 1, "", $this->formatFooter);
+ $this->sheet->cellMerge($this->y, 1, $this->numcols - 1, 0);
+ $this->sheet->writeString($this->y, 1, "", 'formatFooter');
$dir = $comp_path.'/'.user_company(). '/pdf_files';
//save the file
{
mkdir ($dir,0777);
}
- // do not use standard filenames or your sensitive company data
- // are world readable
- //$fname = $dir.'/'.uniqid('').'.xml';
- $fname = $dir.'/'."test".'.xml';
- $this->xml->writeData($fname);
if(in_ajax())
{
global $Ajax;
+ // do not use standard filenames or your sensitive company data
+ // are world readable
+ //$fname = $dir.'/'.uniqid('').'.xml';
+ $fname = $dir.'/'."test".'.xml';
+ $this->writeData($fname);
if (user_rep_popup())
$Ajax->popup($fname); // when embeded pdf viewer used
else
}
else
{
- $this->xml->sendHeaders();
- $this->xml->writeData();
+ $this->sendHeaders();
+ $this->writeData();
}
// first have a look through the directory,
// and remove old temporary pdfs
{
global $path_to_root;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
$to = $_POST['PARAM_0'];
$fromcust = $_POST['PARAM_1'];
$currency = $_POST['PARAM_2'];
$comments = $_POST['PARAM_3'];
+ $destination = $_POST['PARAM_4'];
+ if ($destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "CustomerBalances.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "CustomerBalances.pdf";
+ }
if ($fromcust == reserved_words::get_all_numeric())
$from = _('All');
2 => array('text' => _('Customer'), 'from' => $from, 'to' => ''),
3 => array('text' => _('Currency'), 'from' => $currency, 'to' => ''));
- $rep = new FrontReport(_('Customer Balances'), "CustomerBalances.pdf", user_pagesize());
+ $rep = new FrontReport(_('Customer Balances'), $filename, user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
$rep->NewLine(1, 2);
$rep->TextCol(0, 1, $trans['type_name']);
$rep->TextCol(1, 2, $trans['reference']);
- $date = sql2date($trans['tran_date']);
- $rep->TextCol(2, 3, $date);
+ $rep->DateCol(2, 3, $trans['tran_date'], true);
if ($trans['type'] == 10)
- $rep->TextCol(3, 4, sql2date($trans['due_date']));
+ $rep->DateCol(3, 4, $trans['due_date'], true);
$item[0] = $item[1] = 0.0;
if ($convert)
$rate = $trans['rate'];
if ($trans['TotalAmount'] > 0.0)
{
$item[0] = round2(abs($trans['TotalAmount']) * $rate, $dec);
- $rep->TextCol(4, 5, number_format2($item[0], $dec));
+ $rep->AmountCol(4, 5, $item[0], $dec);
}
else
{
$item[1] = round2(Abs($trans['TotalAmount']) * $rate, $dec);
- $rep->TextCol(5, 6, number_format2($item[1], $dec));
+ $rep->AmountCol(5, 6, $item[1], $dec);
}
$item[2] = round2($trans['Allocated'] * $rate, $dec);
- $rep->TextCol(6, 7, number_format2($item[2], $dec));
+ $rep->AmountCol(6, 7, $item[2], $dec);
/*
if ($trans['type'] == 10)
$item[3] = ($trans['TotalAmount'] - $trans['Allocated']) * $rate;
$item[3] = $item[0] + $item[1] - $item[2];
else
$item[3] = $item[0] - $item[1] + $item[2];
- $rep->TextCol(7, 8, number_format2($item[3], $dec));
+ $rep->AmountCol(7, 8, $item[3], $dec);
for ($i = 0; $i < 4; $i++)
{
$total[$i] += $item[$i];
$rep->NewLine(2);
$rep->TextCol(0, 3, _('Total'));
for ($i = 0; $i < 4; $i++)
- $rep->TextCol($i + 4, $i + 5, number_format2($total[$i], $dec));
+ $rep->AmountCol($i + 4, $i + 5, $total[$i], $dec);
$rep->Line($rep->row - 4);
$rep->NewLine(2);
}
$rep->TextCol(0, 3, _('Grand Total'));
$rep->fontSize -= 2;
for ($i = 0; $i < 4; $i++)
- $rep->TextCol($i + 4, $i + 5, number_format2($grandtotal[$i], $dec));
+ $rep->AmountCol($i + 4, $i + 5, $grandtotal[$i], $dec);
$rep->Line($rep->row - 4);
+ $rep->NewLine();
$rep->End();
}
//----------------------------------------------------------------------------------------------------
-// trial_inquiry_controls();
print_aged_customer_analysis();
function get_invoices($costomer_id, $to)
{
global $comp_path, $path_to_root;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
$to = $_POST['PARAM_0'];
$fromcust = $_POST['PARAM_1'];
$currency = $_POST['PARAM_2'];
$summaryOnly = $_POST['PARAM_3'];
$graphics = $_POST['PARAM_4'];
$comments = $_POST['PARAM_5'];
+ $destination = $_POST['PARAM_6'];
+ if ($destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "AgedCustomerAnalysis.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "AgedCustomerAnalysis.pdf";
+ }
if ($graphics)
{
include_once($path_to_root . "/reporting/includes/class.graphic.inc");
if ($convert)
$headers[2] = _('Currency');
- $rep = new FrontReport(_('Aged Customer Analysis'), "AgedCustomerAnalysis.pdf", user_pagesize());
+ $rep = new FrontReport(_('Aged Customer Analysis'), $filename, user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
if (!$convert && $currency != $myrow['curr_code'])
continue;
$rep->fontSize += 2;
- $rep->TextCol(0, 3, $myrow['name']);
+ $rep->TextCol(0, 2, $myrow['name']);
if ($convert)
{
$rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $to);
- $rep->TextCol(2, 4, $myrow['curr_code']);
+ $rep->TextCol(2, 3, $myrow['curr_code']);
}
else
$rate = 1.0;
$total[2] += ($custrec["Overdue1"]-$custrec["Overdue2"]);
$total[3] += $custrec["Overdue2"];
$total[4] += $custrec["Balance"];
- $str = array(number_format2(($custrec["Balance"] - $custrec["Due"]),$dec),
- number_format2(($custrec["Due"]-$custrec["Overdue1"]),$dec),
- number_format2(($custrec["Overdue1"]-$custrec["Overdue2"]) ,$dec),
- number_format2($custrec["Overdue2"],$dec),
- number_format2($custrec["Balance"],$dec));
+ $str = array($custrec["Balance"] - $custrec["Due"],
+ $custrec["Due"]-$custrec["Overdue1"],
+ $custrec["Overdue1"]-$custrec["Overdue2"],
+ $custrec["Overdue2"],
+ $custrec["Balance"]);
for ($i = 0; $i < count($str); $i++)
- $rep->TextCol($i + 3, $i + 4, $str[$i]);
+ $rep->AmountCol($i + 3, $i + 4, $str[$i], $dec);
$rep->NewLine(1, 2);
if (!$summaryOnly)
{
$rep->NewLine(1, 2);
$rep->TextCol(0, 1, $trans['type_name'], -2);
$rep->TextCol(1, 2, $trans['reference'], -2);
- $rep->TextCol(2, 3, sql2date($trans['tran_date']), -2);
+ $rep->DateCol(2, 3, $trans['tran_date'], true, -2);
if ($trans['type'] == 11 || $trans['type'] == 12 || $trans['type'] == 2)
{
$trans['Balance'] *= -1;
}
foreach ($trans as $i => $value)
$trans[$i] *= $rate;
- $str = array(number_format2(($trans["Balance"] - $trans["Due"]),$dec),
- number_format2(($trans["Due"]-$trans["Overdue1"]),$dec),
- number_format2(($trans["Overdue1"]-$trans["Overdue2"]) ,$dec),
- number_format2($trans["Overdue2"],$dec),
- number_format2($trans["Balance"],$dec));
+ $str = array($trans["Balance"] - $trans["Due"],
+ $trans["Due"]-$trans["Overdue1"],
+ $trans["Overdue1"]-$trans["Overdue2"],
+ $trans["Overdue2"],
+ $trans["Balance"]);
for ($i = 0; $i < count($str); $i++)
- $rep->TextCol($i + 3, $i + 4, $str[$i]);
+ $rep->AmountCol($i + 3, $i + 4, $str[$i], $dec);
}
$rep->Line($rep->row - 8);
$rep->NewLine(2);
$rep->fontSize -= 2;
for ($i = 0; $i < count($total); $i++)
{
- $rep->TextCol($i + 3, $i + 4, number_format2($total[$i], $dec));
+ $rep->AmountCol($i + 3, $i + 4, $total[$i], $dec);
if ($graphics && $i < count($total) - 1)
{
$pg->y[$i] = abs($total[$i]);
$rep->Header();
$rep->AddImage($filename, $x, $rep->row - $h, $w, $h);
}
+ $rep->NewLine();
$rep->End();
}
//----------------------------------------------------------------------------------------------------
-// trial_inquiry_controls();
print_customer_details_listing();
function get_customer_details_for_report($area=0, $salesid=0)
{
global $path_to_root;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
$from = $_POST['PARAM_0'];
$area = $_POST['PARAM_1'];
$folk = $_POST['PARAM_2'];
$more = $_POST['PARAM_3'];
$less = $_POST['PARAM_4'];
$comments = $_POST['PARAM_5'];
+ $destination = $_POST['PARAM_6'];
+ if ($destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "CustomerDetailsListing.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "CustomerDetailsListing.pdf";
+ }
$dec = 0;
3 => array('text' => _('Sales Folk'), 'from' => $salesfolk, 'to' => ''),
4 => array('text' => _('Activity'), 'from' => $morestr, 'to' => $lessstr));
- $rep = new FrontReport(_('Customer Details Listing'), "CustomerDetailsListing.pdf", user_pagesize());
+ $rep = new FrontReport(_('Customer Details Listing'), $filename, user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
{
global $comp_path, $path_to_root, $pic_height, $pic_width;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
$currency = $_POST['PARAM_0'];
$category = $_POST['PARAM_1'];
$salestype = $_POST['PARAM_2'];
$pictures = $_POST['PARAM_3'];
$showGP = $_POST['PARAM_4'];
$comments = $_POST['PARAM_5'];
+ $destination = $_POST['PARAM_6'];
+ if ($destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "PriceListing.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "PriceListing.pdf";
+ }
$dec = user_price_dec();
$rep->TextCol(0, 1, $myrow['stock_id']);
$rep->TextCol(1, 2, $myrow['name']);
$price = get_price($myrow['stock_id'], $currency, $salestype);
- $rep->TextCol(2, 3, number_format2($price, $dec));
+ $rep->AmountCol(2, 3, $price, $dec);
if ($showGP)
{
$price2 = get_price($myrow['stock_id'], $home_curr, $salestype);
$rep->TextCol(0, 1, $myrow['kit_code']);
$rep->TextCol(1, 2, $myrow['kit_name']);
$price = get_kit_price($myrow['kit_code'], $currency, $salestype);
- $rep->TextCol(2, 3, number_format2($price, $dec));
+ $rep->AmountCol(2, 3, $price, $dec);
$rep->NewLine(0, 1);
}
$rep->Line($rep->row - 4);
-
+ $rep->NewLine();
$rep->End();
}
//----------------------------------------------------------------------------------------------------
-// trial_inquiry_controls();
print_order_status_list();
//----------------------------------------------------------------------------------------------------
{
global $path_to_root;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
$category = $_POST['PARAM_2'];
$location = $_POST['PARAM_3'];
$backorder = $_POST['PARAM_4'];
$comments = $_POST['PARAM_5'];
+ $destination = $_POST['PARAM_6'];
+ if ($destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "OrderStatusListing.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "OrderStatusListing.pdf";
+ }
if ($category == reserved_words::get_all_numeric())
$category = 0;
$cols2 = $cols;
$aligns2 = $aligns;
- $rep = new FrontReport(_('Order Status Listing'), "OrderStatusListing.pdf", user_pagesize());
+ $rep = new FrontReport(_('Order Status Listing'), $filename, user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2);
$rep->TextCol(1, 2, get_customer_name($myrow['debtor_no']));
$rep->TextCol(2, 3, get_branch_name($myrow['branch_code']));
$rep->TextCol(3, 4, $myrow['customer_ref']);
- $rep->TextCol(4, 5, sql2date($myrow['ord_date']));
- $rep->TextCol(5, 6, sql2date($myrow['delivery_date']));
+ $rep->DateCol(4, 5, $myrow['ord_date'], true);
+ $rep->DateCol(5, 6, $myrow['delivery_date'], true);
$rep->TextCol(6, 7, $myrow['from_stk_loc']);
$rep->NewLine(2);
$orderno = $myrow['order_no'];
$rep->TextCol(0, 1, $myrow['stk_code']);
$rep->TextCol(1, 2, $myrow['description']);
$dec = get_qty_dec($myrow['stk_code']);
- $rep->TextCol(2, 3, number_format2($myrow['quantity'], $dec));
- $rep->TextCol(3, 4, number_format2($myrow['qty_sent'], $dec));
- $rep->TextCol(4, 5, number_format2($myrow['quantity'] - $myrow['qty_sent'], $dec));
+ $rep->AmountCol(2, 3, $myrow['quantity'], $dec);
+ $rep->AmountCol(3, 4, $myrow['qty_sent'], $dec);
+ $rep->AmountCol(4, 5, $myrow['quantity'] - $myrow['qty_sent'], $dec);
if ($myrow['quantity'] - $myrow['qty_sent'] > 0)
{
$rep->Font('italic');
{
global $path_to_root;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
$summary = $_POST['PARAM_2'];
$comments = $_POST['PARAM_3'];
+ $destination = $_POST['PARAM_4'];
+ if ($destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "SalesmanListing.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "SalesmanListing.pdf";
+ }
if ($summary == 0)
$sum = _("No");
$cols2 = $cols;
$aligns2 = $aligns;
- $rep = new FrontReport(_('Salesman Listing'), "SalesmanListing.pdf", user_pagesize());
+ $rep = new FrontReport(_('Salesman Listing'), $filename, user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2);
$rep->Line($rep->row - 8);
$rep->NewLine(2);
$rep->TextCol(0, 3, _('Total'));
- $rep->TextCol(5, 6, number_format2($subtotal, $dec));
- $rep->TextCol(6, 7, number_format2($subprov, $dec));
+ $rep->AmountCol(5, 6, $subtotal, $dec);
+ $rep->AmountCol(6, 7, $subprov, $dec);
$rep->Line($rep->row - 4);
$rep->NewLine(2);
- //$rep->Line($rep->row);
}
$rep->TextCol(0, 2, $myrow['salesman_code']." ".$myrow['salesman_name']);
$rep->TextCol(2, 3, $myrow['salesman_phone']);
$rep->TextCol(3, 4, $myrow['salesman_email']);
$rep->TextCol(4, 5, number_format2($myrow['provision'], user_percent_dec()) ." %");
- $rep->TextCol(5, 6, number_format2($myrow['break_pt'], $dec));
+ $rep->AmountCol(5, 6, $myrow['break_pt'], $dec);
$rep->TextCol(6, 7, number_format2($myrow['provision2'], user_percent_dec()) ." %");
$rep->NewLine(2);
$salesman = $myrow['salesman_code'];
$subtotal = 0;
$subprov = 0;
}
- $date = sql2date($myrow['tran_date']);
$rate = $myrow['rate'];
$amt = $myrow['InvoiceTotal'] * $rate;
if ($subprov > $myrow['break_pt'] && $myrow['provision2'] != 0)
$rep->TextCol(1, 2, $myrow['DebtorName']);
$rep->TextCol(2, 3, $myrow['br_name']);
$rep->TextCol(3, 4, $myrow['contact_name']);
- $rep->TextCol(4, 5, $date);
- $rep->TextCol(5, 6, number_format2($amt, $dec));
- $rep->TextCol(6, 7, number_format2($prov, $dec));
+ $rep->DateCol(4, 5, $myrow['tran_date'], true);
+ $rep->AmountCol(5, 6, $amt, $dec);
+ $rep->AmountCol(6, 7, $prov, $dec);
$rep->NewLine();
if ($rep->row < $rep->bottomMargin + (2 * $rep->lineHeight))
{
$rep->Line($rep->row - 4);
$rep->NewLine(2);
$rep->TextCol(0, 3, _('Total'));
- $rep->TextCol(5, 6, number_format2($subtotal, $dec));
- $rep->TextCol(6, 7, number_format2($subprov, $dec));
+ $rep->AmountCol(5, 6, $subtotal, $dec);
+ $rep->AmountCol(6, 7, $subprov, $dec);
$rep->Line($rep->row - 4);
$rep->NewLine(2);
- //$rep->Line($rep->row);
$total += $subtotal;
$provtotal += $subprov;
}
$rep->fontSize += 2;
$rep->TextCol(0, 3, _('Grand Total'));
$rep->fontSize -= 2;
- $rep->TextCol(5, 6, number_format2($total, $dec));
- $rep->TextCol(6, 7, number_format2($provtotal, $dec));
+ $rep->AmountCol(5, 6, $total, $dec);
+ $rep->AmountCol(6, 7, $provtotal, $dec);
$rep->Line($rep->row - 4);
+ $rep->NewLine();
$rep->End();
}
{
global $path_to_root;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
$to = $_POST['PARAM_0'];
$fromsupp = $_POST['PARAM_1'];
$currency = $_POST['PARAM_2'];
$comments = $_POST['PARAM_3'];
+ $destination = $_POST['PARAM_4'];
+ if ($destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "SupplierBalances.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "SupplierBalances.pdf";
+ }
if ($fromsupp == reserved_words::get_all_numeric())
$from = _('All');
2 => array('text' => _('Supplier'), 'from' => $from, 'to' => ''),
3 => array( 'text' => _('Currency'),'from' => $currency, 'to' => ''));
- $rep = new FrontReport(_('Supplier Balances'), "SupplierBalances.pdf", user_pagesize());
+ $rep = new FrontReport(_('Supplier Balances'), $filename, user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
$rep->NewLine(1, 2);
$rep->TextCol(0, 1, $trans['type_name']);
$rep->TextCol(1, 2, $trans['reference']);
- $date = sql2date($trans['tran_date']);
- $rep->TextCol(2, 3, $date);
+ $rep->DateCol(2, 3, $trans['tran_date'], true);
if ($trans['type'] == 20)
- $rep->TextCol(3, 4, sql2date($trans['due_date']));
+ $rep->DateCol(3, 4, $trans['due_date'], true);
$item[0] = $item[1] = 0.0;
if ($convert)
- //$rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $date);
$rate = $trans['rate'];
else
$rate = 1.0;
if ($trans['TotalAmount'] > 0.0)
{
$item[0] = round2(abs($trans['TotalAmount']) * $rate, $dec);
- $rep->TextCol(4, 5, number_format2($item[0], $dec));
+ $rep->AmountCol(4, 5, $item[0], $dec);
}
else
{
$item[1] = round2(abs($trans['TotalAmount']) * $rate, $dec);
- $rep->TextCol(5, 6, number_format2($item[1], $dec));
+ $rep->AmountCol(5, 6, $item[1], $dec);
}
$item[2] = round2($trans['Allocated'] * $rate, $dec);
- $rep->TextCol(6, 7, number_format2($item[2], $dec));
+ $rep->AmountCol(6, 7, $item[2], $dec);
/*
if ($trans['type'] == 20)
$item[3] = ($trans['TotalAmount'] - $trans['Allocated']) * $rate;
$item[3] = $item[0] + $item[1] - $item[2];
else
$item[3] = $item[0] - $item[1] + $item[2];
- $rep->TextCol(7, 8, number_format2($item[3], $dec));
+ $rep->AmountCol(7, 8, $item[3], $dec);
for ($i = 0; $i < 4; $i++)
{
$total[$i] += $item[$i];
$rep->TextCol(0, 3, _('Total'));
for ($i = 0; $i < 4; $i++)
{
- $rep->TextCol($i + 4, $i + 5, number_format2($total[$i], $dec));
+ $rep->AmountCol($i + 4, $i + 5, $total[$i], $dec);
$total[$i] = 0.0;
}
$rep->Line($rep->row - 4);
$rep->TextCol(0, 3, _('Grand Total'));
$rep->fontSize -= 2;
for ($i = 0; $i < 4; $i++)
- $rep->TextCol($i + 4, $i + 5,number_format2($grandtotal[$i], $dec));
+ $rep->AmountCol($i + 4, $i + 5,$grandtotal[$i], $dec);
$rep->Line($rep->row - 4);
+ $rep->NewLine();
$rep->End();
}
{
global $comp_path, $path_to_root;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
$to = $_POST['PARAM_0'];
$fromsupp = $_POST['PARAM_1'];
$currency = $_POST['PARAM_2'];
$summaryOnly = $_POST['PARAM_3'];
$graphics = $_POST['PARAM_4'];
$comments = $_POST['PARAM_5'];
+ $destination = $_POST['PARAM_6'];
+ if ($destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "AgedSupplierAnalysis.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "AgedSupplierAnalysis.pdf";
+ }
if ($graphics)
{
include_once($path_to_root . "/reporting/includes/class.graphic.inc");
if ($convert)
$headers[2] = _('currency');
- $rep = new FrontReport(_('Aged Supplier Analysis'), "AgedSupplierAnalysis.pdf", user_pagesize());
+ $rep = new FrontReport(_('Aged Supplier Analysis'), $filename, user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
if (!$convert && $currency != $myrow['curr_code'])
continue;
$rep->fontSize += 2;
- $rep->TextCol(0, 3, $myrow['name']);
+ $rep->TextCol(0, 2, $myrow['name']);
if ($convert)
{
$rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $to);
- $rep->TextCol(2, 4, $myrow['curr_code']);
+ $rep->TextCol(2, 3, $myrow['curr_code']);
}
else
$rate = 1.0;
$total[2] += ($supprec["Overdue1"]-$supprec["Overdue2"]);
$total[3] += $supprec["Overdue2"];
$total[4] += $supprec["Balance"];
- $str = array(number_format2(($supprec["Balance"] - $supprec["Due"]),$dec),
- number_format2(($supprec["Due"]-$supprec["Overdue1"]),$dec),
- number_format2(($supprec["Overdue1"]-$supprec["Overdue2"]) ,$dec),
- number_format2($supprec["Overdue2"],$dec),
- number_format2($supprec["Balance"],$dec));
+ $str = array($supprec["Balance"] - $supprec["Due"],
+ $supprec["Due"]-$supprec["Overdue1"],
+ $supprec["Overdue1"]-$supprec["Overdue2"],
+ $supprec["Overdue2"],
+ $supprec["Balance"]);
for ($i = 0; $i < count($str); $i++)
- $rep->TextCol($i + 3, $i + 4, $str[$i]);
+ $rep->AmountCol($i + 3, $i + 4, $str[$i], $dec);
$rep->NewLine(1, 2);
if (!$summaryOnly)
{
$rep->TextCol(2, 3, sql2date($trans['tran_date']), -2);
foreach ($trans as $i => $value)
$trans[$i] *= $rate;
- $str = array(number_format2(($trans["Balance"] - $trans["Due"]),$dec),
- number_format2(($trans["Due"]-$trans["Overdue1"]),$dec),
- number_format2(($trans["Overdue1"]-$trans["Overdue2"]) ,$dec),
- number_format2($trans["Overdue2"],$dec),
- number_format2($trans["Balance"],$dec));
+ $str = array($trans["Balance"] - $trans["Due"],
+ $trans["Due"]-$trans["Overdue1"],
+ $trans["Overdue1"]-$trans["Overdue2"],
+ $trans["Overdue2"],
+ $trans["Balance"]);
for ($i = 0; $i < count($str); $i++)
- $rep->TextCol($i + 3, $i + 4, $str[$i]);
+ $rep->AmountCol($i + 3, $i + 4, $str[$i], $dec);
}
$rep->Line($rep->row - 8);
$rep->NewLine(2);
$rep->fontSize -= 2;
for ($i = 0; $i < count($total); $i++)
{
- $rep->TextCol($i + 3, $i + 4, number_format2($total[$i], $dec));
+ $rep->AmountCol($i + 3, $i + 4, $total[$i], $dec);
if ($graphics && $i < count($total) - 1)
{
$pg->y[$i] = abs($total[$i]);
}
}
$rep->Line($rep->row - 8);
+ $rep->NewLine();
if ($graphics)
{
global $decseps, $graph_skin;
{
global $path_to_root;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
$to = $_POST['PARAM_0'];
$fromsupp = $_POST['PARAM_1'];
$currency = $_POST['PARAM_2'];
$comments = $_POST['PARAM_3'];
+ $destination = $_POST['PARAM_4'];
+ if ($destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "PaymentReport.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "PaymentReport.pdf";
+ }
if ($fromsupp == reserved_words::get_all_numeric())
$from = _('All');
$rep->TextCol(0, 1, $trans['type_name']);
$rep->TextCol(1, 2, $trans['supp_reference']);
if ($trans['type'] == 20)
- $rep->TextCol(2, 3, sql2date($trans['due_date']));
+ $rep->DateCol(2, 3, $trans['due_date'], true);
else
- $rep->TextCol(2, 3, sql2date($trans['tran_date']));
+ $rep->DateCol(2, 3, $trans['tran_date'], true);
if ($trans['type'] != 20)
{
$trans['TranTotal'] = -$trans['TranTotal'];
$trans['Balance'] = -$trans['Balance'];
}
$item[0] = $trans['TranTotal'] * $rate;
- $rep->TextCol(6, 7, number_format2($item[0], $dec));
+ $rep->AmountCol(6, 7, $item[0], $dec);
$item[1] = $trans['Balance'] * $rate;
- $rep->TextCol(7, 8, number_format2($item[1], $dec));
+ $rep->AmountCol(7, 8, $item[1], $dec);
for ($i = 0; $i < 2; $i++)
{
$total[$i] += $item[$i];
$rep->TextCol(0, 3, _('Total'));
for ($i = 0; $i < 2; $i++)
{
- $rep->TextCol($i + 6, $i + 7, number_format2($total[$i], $dec));
+ $rep->AmountCol($i + 6, $i + 7, $total[$i], $dec);
$total[$i] = 0.0;
}
$rep->Line($rep->row - 4);
$rep->TextCol(0, 3, _('Grand Total'));
$rep->fontSize -= 2;
for ($i = 0; $i < 2; $i++)
- $rep->TextCol($i + 6, $i + 7,number_format2($grandtotal[$i], $dec));
+ $rep->AmountCol($i + 6, $i + 7,$grandtotal[$i], $dec);
$rep->Line($rep->row - 4);
+ $rep->NewLine();
$rep->End();
}
{
global $path_to_root;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
$fromsupp = $_POST['PARAM_0'];
$comments = $_POST['PARAM_1'];
+ $destination = $_POST['PARAM_2'];
+ if ($destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "OutstandingGRN.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "OutstandingGRN.pdf";
+ }
if ($fromsupp == reserved_words::get_all_numeric())
$from = _('All');
$params = array( 0 => $comments,
1 => array('text' => _('Supplier'), 'from' => $from, 'to' => ''));
- $rep = new FrontReport(_('Outstanding GRNs Report'), "OutstandingGRN.pdf", user_pagesize());
+ $rep = new FrontReport(_('Outstanding GRNs Report'), $filename, user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
{
$rep->NewLine(2);
$rep->TextCol(0, 7, _('Total'));
- $rep->TextCol(7, 8, number_format2($SuppTot_Val, $dec));
+ $rep->AmountCol(7, 8, $SuppTot_Val, $dec);
$rep->Line($rep->row - 2);
$rep->NewLine(3);
$SuppTot_Val = 0;
$rep->TextCol(0, 1, $GRNs['id']);
$rep->TextCol(1, 2, $GRNs['order_no']);
$rep->TextCol(2, 3, $GRNs['item_code'] . '-' . $GRNs['description']);
- $rep->TextCol(3, 4, number_format2($GRNs['qty_recd'], $dec2));
- $rep->TextCol(4, 5, number_format2($GRNs['quantity_inv'], $dec2));
+ $rep->AmountCol(3, 4, $GRNs['qty_recd'], $dec2);
+ $rep->AmountCol(4, 5, $GRNs['quantity_inv'], $dec2);
$QtyOstg = $GRNs['qty_recd'] - $GRNs['quantity_inv'];
$Value = ($GRNs['qty_recd'] - $GRNs['quantity_inv']) * $GRNs['std_cost_unit'];
- $rep->TextCol(5, 6, number_format2($QtyOstg, $dec2));
- $rep->TextCol(6, 7, number_format2($GRNs['std_cost_unit'], $dec));
- $rep->TextCol(7, 8, number_format2($Value, $dec));
+ $rep->AmountCol(5, 6, $QtyOstg, $dec2);
+ $rep->AmountCol(6, 7, $GRNs['std_cost_unit'], $dec);
+ $rep->AmountCol(7, 8, $Value, $dec);
$Tot_Val += $Value;
$SuppTot_Val += $Value;
{
$rep->NewLine();
$rep->TextCol(0, 7, _('Total'));
- $rep->TextCol(7, 8, number_format2($SuppTot_Val, $dec));
+ $rep->AmountCol(7, 8, $SuppTot_Val, $dec);
$rep->Line($rep->row - 2);
$rep->NewLine(3);
$SuppTot_Val = 0;
}
$rep->NewLine(2);
$rep->TextCol(0, 7, _('Grand Total'));
- $rep->TextCol(7, 8, number_format2($Tot_Val, $dec));
+ $rep->AmountCol(7, 8, $Tot_Val, $dec);
$rep->Line($rep->row - 2);
+ $rep->NewLine();
$rep->End();
}
{
global $path_to_root;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
$category = $_POST['PARAM_0'];
$location = $_POST['PARAM_1'];
$detail = $_POST['PARAM_2'];
$comments = $_POST['PARAM_3'];
+ $destination = $_POST['PARAM_4'];
+ if ($destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "InventoryValReport.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "InventoryValReport.pdf";
+ }
$dec = user_price_dec();
1 => array('text' => _('Category'), 'from' => $cat, 'to' => ''),
2 => array('text' => _('Location'), 'from' => $loc, 'to' => ''));
- $rep = new FrontReport(_('Inventory Valuation Report'), "InventoryValReport.pdf", user_pagesize());
+ $rep = new FrontReport(_('Inventory Valuation Report'), $filename, user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
$rep->NewLine(2, 3);
$rep->TextCol(0, 4, _('Total'));
}
- $rep->Textcol(4, 5, number_format2($total, $dec));
+ $rep->AmountCol(4, 5, $total, $dec);
if ($detail)
{
$rep->Line($rep->row - 2);
$rep->fontsize -= 2;
$rep->TextCol(0, 1, $trans['stock_id']);
$rep->TextCol(1, 2, $trans['description']);
- $rep->TextCol(2, 3, number_format2($trans['QtyOnHand'], get_qty_dec($trans['stock_id'])));
- $rep->TextCol(3, 4, number_format2($trans['UnitCost'], $dec));
- $rep->TextCol(4, 5, number_format2($trans['ItemTotal'], $dec));
+ $rep->AmountCol(2, 3, $trans['QtyOnHand'], get_qty_dec($trans['stock_id']));
+ $rep->AmountCol(3, 4, $trans['UnitCost'], $dec);
+ $rep->AmountCol(4, 5, $trans['ItemTotal'], $dec);
$rep->fontsize += 2;
}
$total += $trans['ItemTotal'];
$rep->NewLine(2, 3);
$rep->TextCol(0, 4, _('Total'));
}
- $rep->Textcol(4, 5, number_format2($total, $dec));
+ $rep->Amountcol(4, 5, $total, $dec);
if ($detail)
{
$rep->Line($rep->row - 2);
}
$rep->NewLine(2, 1);
$rep->TextCol(0, 4, _('Grand Total'));
- $rep->TextCol(4, 5, number_format2($grandtotal, $dec));
+ $rep->AmountCol(4, 5, $grandtotal, $dec);
$rep->Line($rep->row - 4);
+ $rep->NewLine();
$rep->End();
}
{
global $path_to_root;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
$category = $_POST['PARAM_0'];
$location = $_POST['PARAM_1'];
$comments = $_POST['PARAM_2'];
+ $destination = $_POST['PARAM_3'];
+ if ($destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "InventoryPlanning.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "InventoryPlanning.pdf";
+ }
if ($category == reserved_words::get_all_numeric())
$category = 0;
1 => array('text' => _('Category'), 'from' => $cat, 'to' => ''),
2 => array('text' => _('Location'), 'from' => $loc, 'to' => ''));
- $rep = new FrontReport(_('Inventory Planning Report'), "InventoryPlanning.pdf", user_pagesize());
+ $rep = new FrontReport(_('Inventory Planning Report'), $filename, user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
$dec = get_qty_dec($trans['stock_id']);
$rep->TextCol(0, 1, $trans['stock_id']);
$rep->TextCol(1, 2, $trans['description']);
- $rep->TextCol(2, 3, number_format2($period['prd0'], $dec));
- $rep->TextCol(3, 4, number_format2($period['prd1'], $dec));
- $rep->TextCol(4, 5, number_format2($period['prd2'], $dec));
- $rep->TextCol(5, 6, number_format2($period['prd3'], $dec));
- $rep->TextCol(6, 7, number_format2($period['prd4'], $dec));
+ $rep->AmountCol(2, 3, $period['prd0'], $dec);
+ $rep->AmountCol(3, 4, $period['prd1'], $dec);
+ $rep->AmountCol(4, 5, $period['prd2'], $dec);
+ $rep->AmountCol(5, 6, $period['prd3'], $dec);
+ $rep->AmountCol(6, 7, $period['prd4'], $dec);
$MaxMthSales = Max($period['prd0'], $period['prd1'], $period['prd2'], $period['prd3']);
$IdealStockHolding = $MaxMthSales * 3;
- $rep->TextCol(7, 8, number_format2($IdealStockHolding, $dec));
+ $rep->AmountCol(7, 8, $IdealStockHolding, $dec);
- $rep->TextCol(8, 9, number_format2($trans['qty_on_hand'], $dec));
- $rep->TextCol(9, 10, number_format2($custqty, $dec));
- $rep->TextCol(10, 11, number_format2($suppqty, $dec));
+ $rep->AmountCol(8, 9, $trans['qty_on_hand'], $dec);
+ $rep->AmountCol(9, 10, $custqty, $dec);
+ $rep->AmountCol(10, 11, $suppqty, $dec);
$SuggestedTopUpOrder = $IdealStockHolding - $trans['qty_on_hand'] + $custqty - $suppqty;
if ($SuggestedTopUpOrder < 0.0)
$SuggestedTopUpOrder = 0.0;
- $rep->TextCol(11, 12, number_format2($SuggestedTopUpOrder, $dec));
+ $rep->AmountCol(11, 12, $SuggestedTopUpOrder, $dec);
}
$rep->Line($rep->row - 4);
+ $rep->NewLine();
$rep->End();
}
{
global $comp_path, $path_to_root, $pic_height, $pic_width;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
$category = $_POST['PARAM_0'];
$location = $_POST['PARAM_1'];
$pictures = $_POST['PARAM_2'];
$check = $_POST['PARAM_3'];
$comments = $_POST['PARAM_4'];
+ $destination = $_POST['PARAM_5'];
+ if ($destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "StockCheckSheet.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "StockCheckSheet.pdf";
+ }
if ($category == reserved_words::get_all_numeric())
$category = 0;
else
$user_comp = "";
- $rep = new FrontReport(_('Stock Check Sheets'), "StockCheckSheet.pdf", user_pagesize());
+ $rep = new FrontReport(_('Stock Check Sheets'), $filename, user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
$dec = get_qty_dec($trans['stock_id']);
$rep->TextCol(0, 1, $trans['stock_id']);
$rep->TextCol(1, 2, $trans['description']);
- $rep->TextCol(2, 3, number_format2($trans['QtyOnHand'], $dec));
+ $rep->AmountCol(2, 3, $trans['QtyOnHand'], $dec);
if ($check)
{
$rep->TextCol(3, 4, "_________");
- $rep->TextCol(4, 5, number_format2($demandqty, $dec));
- $rep->TextCol(5, 6, number_format2($trans['QtyOnHand'] - $demandqty, $dec));
+ $rep->AmountCol(4, 5, $demandqty, $dec);
+ $rep->AmountCol(5, 6, $trans['QtyOnHand'] - $demandqty, $dec);
}
else
{
- $rep->TextCol(3, 4, number_format2($demandqty, $dec));
- $rep->TextCol(4, 5, number_format2($trans['QtyOnHand'] - $demandqty, $dec));
+ $rep->AmountCol(3, 4, $demandqty, $dec);
+ $rep->AmountCol(4, 5, $trans['QtyOnHand'] - $demandqty, $dec);
}
if ($pictures)
{
}
}
$rep->Line($rep->row - 4);
+ $rep->NewLine();
$rep->End();
}
{
global $path_to_root;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
$category = $_POST['PARAM_2'];
$location = $_POST['PARAM_3'];
$detail = $_POST['PARAM_4'];
$comments = $_POST['PARAM_5'];
+ $destination = $_POST['PARAM_6'];
+ if ($destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "InventorySalesReport.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "InventorySalesReport.pdf";
+ }
$dec = user_price_dec();
$rep->NewLine(2, 3);
$rep->TextCol(0, 2, _('Total'));
}
- $rep->TextCol(2, 3, number_format2($total, $dec));
- $rep->TextCol(3, 4, number_format2($total1, $dec));
- $rep->Textcol(4, 5, number_format2($total2, $dec));
+ $rep->AmountCol(2, 3, $total, $dec);
+ $rep->AmountCol(3, 4, $total1, $dec);
+ $rep->AmountCol(4, 5, $total2, $dec);
if ($detail)
{
$rep->Line($rep->row - 2);
$rep->fontsize -= 2;
$rep->TextCol(0, 1, $stock_id);
$rep->TextCol(1, 2, $stock_desc);
- $rep->TextCol(2, 3, number_format2($amt, $dec));
- $rep->TextCol(3, 4, number_format2($cost, $dec));
- $rep->TextCol(4, 5, number_format2($cb, $dec));
+ $rep->AmountCol(2, 3, $amt, $dec);
+ $rep->AmountCol(3, 4, $cost, $dec);
+ $rep->AmountCol(4, 5, $cb, $dec);
$rep->fontsize += 2;
}
$amt = $cost = $cb = 0;
$rep->fontsize -= 2;
$rep->TextCol(0, 1, $stock_id);
$rep->TextCol(1, 2, $stock_desc);
- $rep->TextCol(2, 3, number_format2($amt, $dec));
- $rep->TextCol(3, 4, number_format2($cost, $dec));
- $rep->TextCol(4, 5, number_format2($cb, $dec));
+ $rep->AmountCol(2, 3, $amt, $dec);
+ $rep->AmountCol(3, 4, $cost, $dec);
+ $rep->AmountCol(4, 5, $cb, $dec);
$rep->fontsize += 2;
$rep->NewLine(2, 3);
$rep->TextCol(0, 2, _('Total'));
}
- $rep->TextCol(2, 3, number_format2($total, $dec));
- $rep->TextCol(3, 4, number_format2($total1, $dec));
- $rep->Textcol(4, 5, number_format2($total2, $dec));
+ $rep->AmountCol(2, 3, $total, $dec);
+ $rep->AmountCol(3, 4, $total1, $dec);
+ $rep->AmountCol(4, 5, $total2, $dec);
if ($detail)
{
$rep->Line($rep->row - 2);
}
$rep->NewLine(2, 1);
$rep->TextCol(0, 2, _('Grand Total'));
- $rep->TextCol(2, 3, number_format2($grandtotal, $dec));
- $rep->TextCol(3, 4, number_format2($grandtotal1, $dec));
- $rep->Textcol(4, 5, number_format2($grandtotal2, $dec));
+ $rep->AmountCol(2, 3, $grandtotal, $dec);
+ $rep->AmountCol(3, 4, $grandtotal1, $dec);
+ $rep->AmountCol(4, 5, $grandtotal2, $dec);
$rep->Line($rep->row - 4);
+ $rep->NewLine();
$rep->End();
}
{
global $path_to_root;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
$frompart = $_POST['PARAM_0'];
$topart = $_POST['PARAM_1'];
$comments = $_POST['PARAM_2'];
+ $destination = $_POST['PARAM_3'];
+ if ($destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "BillOfMaterial.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "BillOfMaterial.pdf";
+ }
$cols = array(0, 50, 305, 375, 445, 515);
$params = array( 0 => $comments,
1 => array('text' => _('Component'), 'from' => $frompart, 'to' => $topart));
- $rep = new FrontReport(_('Bill of Material Listing'), "BillOfMaterial.pdf", user_pagesize());
+ $rep = new FrontReport(_('Bill of Material Listing'), $filename, user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
$wc = get_work_centre($trans['workcentre_added']);
$rep->TextCol(2, 3, get_location_name($trans['loc_code']));
$rep->TextCol(3, 4, $wc['name']);
- $rep->TextCol(4, 5, number_format2($trans['quantity'], $dec));
+ $rep->AmountCol(4, 5, $trans['quantity'], $dec);
}
$rep->Line($rep->row - 4);
+ $rep->NewLine();
$rep->End();
}
{
global $path_to_root;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
$fromdim = $_POST['PARAM_0'];
$todim = $_POST['PARAM_1'];
$showbal = $_POST['PARAM_2'];
$comments = $_POST['PARAM_3'];
-
+ $destination = $_POST['PARAM_4'];
+ if ($destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "DimensionSummary.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "DimensionSummary.pdf";
+ }
$cols = array(0, 50, 210, 250, 320, 395, 465, 515);
$params = array( 0 => $comments,
1 => array('text' => _('Dimension'), 'from' => $fromdim, 'to' => $todim));
- $rep = new FrontReport(_('Dimension Summary'), "DimensionSummary.pdf", user_pagesize());
+ $rep = new FrontReport(_('Dimension Summary'), $filename, user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
$rep->TextCol(0, 1, $trans['reference']);
$rep->TextCol(1, 2, $trans['name']);
$rep->TextCol(2, 3, $trans['type_']);
- $rep->TextCol(3, 4, $trans['date_']);
- $rep->TextCol(4, 5, $trans['due_date']);
+ $rep->DateCol(3, 4, $trans['date_'], true);
+ $rep->DateCol(4, 5, $trans['due_date'], true);
if ($trans['closed'])
$str = _('Yes');
else
if ($showbal)
{
$balance = getYTD($trans['id']);
- $rep->TextCol(6, 7, number_format2($balance, 0));
+ $rep->AmountCol(6, 7, $balance, 0);
}
$rep->NewLine(1, 2);
}
{
global $path_to_root;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
- $rep = new FrontReport(_('Bank Statement'), "BankStatement.pdf", user_pagesize());
-
$acc = $_POST['PARAM_0'];
$from = $_POST['PARAM_1'];
$to = $_POST['PARAM_2'];
$comments = $_POST['PARAM_3'];
+ $destination = $_POST['PARAM_4'];
+
+ if ($destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "BankStatement.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "BankStatement.pdf";
+ }
+ $rep = new FrontReport(_('Bank Statement'), $filename, user_pagesize());
$dec = user_price_dec();
$cols = array(0, 90, 110, 170, 225, 350, 400, 460, 520);
$rep->TextCol(0, 3, $act);
$rep->TextCol(3, 5, _('Opening Balance'));
if ($prev_balance > 0.0)
- $rep->TextCol(5, 6, number_format2(abs($prev_balance), $dec));
+ $rep->AmountCol(5, 6, abs($prev_balance), $dec);
else
- $rep->TextCol(6, 7, number_format2(abs($prev_balance), $dec));
+ $rep->AmountCol(6, 7, abs($prev_balance), $dec);
$rep->Font();
$total = $prev_balance;
$rep->NewLine(2);
$rep->TextCol(0, 1, systypes::name($myrow["type"]));
$rep->TextCol(1, 2, $myrow['trans_no']);
$rep->TextCol(2, 3, $myrow['ref']);
- $rep->TextCol(3, 4, sql2date($myrow["trans_date"]));
+ $rep->DateCol(3, 4, $myrow["trans_date"], true);
$rep->TextCol(4, 5, payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"], false));
if ($myrow['amount'] > 0.0)
- $rep->TextCol(5, 6, number_format2(abs($myrow['amount']), $dec));
+ $rep->AmountCol(5, 6, abs($myrow['amount']), $dec);
else
- $rep->TextCol(6, 7, number_format2(abs($myrow['amount']), $dec));
- $rep->TextCol(7, 8, number_format2($total, $dec));
+ $rep->AmountCol(6, 7, abs($myrow['amount']), $dec);
+ $rep->AmountCol(7, 8, $total, $dec);
$rep->NewLine();
if ($rep->row < $rep->bottomMargin + $rep->lineHeight)
{
$rep->Font('bold');
$rep->TextCol(3, 5, _("Ending Balance"));
if ($total > 0.0)
- $rep->TextCol(5, 6, number_format2(abs($total), $dec));
+ $rep->AmountCol(5, 6, abs($total), $dec);
else
- $rep->TextCol(6, 7, number_format2(abs($total), $dec));
+ $rep->AmountCol(6, 7, abs($total), $dec);
$rep->Font();
$rep->Line($rep->row - $rep->lineHeight + 4);
$rep->NewLine(2, 1);
{
global $path_to_root;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
$systype = $_POST['PARAM_2'];
$comments = $_POST['PARAM_3'];
+ $destination = $_POST['PARAM_4'];
+ if (isset($destination) && $destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "JournalEntries.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "JournalEntries.pdf";
+ }
+
$dec = user_price_dec();
$cols = array(0, 100, 240, 300, 400, 460, 520, 580);
2 => array('text' => _('Type'), 'from' => systypes::name($systype),
'to' => ''));
- $rep = new FrontReport(_('List of Journal Entries'), "JournalEntries.pdf", user_pagesize());
+ $rep = new FrontReport(_('List of Journal Entries'), $filename, user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
$typeno = $myrow['type_no'];
$TransName = systypes::name($myrow['type']);
$rep->TextCol(0, 2, $TransName . " # " . $myrow['type_no']);
- $rep->TextCol(2, 3, sql2date($myrow['tran_date']));
+ $rep->DateCol(2, 3, $myrow['tran_date'], true);
$coms = payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"]);
$memo = get_comments_string($myrow['type'], $myrow['type_no']);
if ($memo != '')
$rep->TextCol(2, 3, $dim_str);
$rep->TextCol(3, 4, $myrow['memo_']);
if ($myrow['amount'] > 0.0)
- $rep->TextCol(4, 5, number_format2(abs($myrow['amount']), $dec));
+ $rep->AmountCol(4, 5, abs($myrow['amount']), $dec);
else
- $rep->TextCol(5, 6, number_format2(abs($myrow['amount']), $dec));
+ $rep->AmountCol(5, 6, abs($myrow['amount']), $dec);
$rep->NewLine(1, 2);
}
$rep->Line($rep->row + 4);
{
global $path_to_root;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
- $rep = new FrontReport(_('GL Account Transactions'), "GLAccountTransactions.pdf", user_pagesize());
$dim = get_company_pref('use_dimension');
$dimension = $dimension2 = 0;
$dimension = $_POST['PARAM_4'];
$dimension2 = $_POST['PARAM_5'];
$comments = $_POST['PARAM_6'];
+ $destination = $_POST['PARAM_7'];
}
else if ($dim == 1)
{
$dimension = $_POST['PARAM_4'];
$comments = $_POST['PARAM_5'];
+ $destination = $_POST['PARAM_6'];
}
else
{
$comments = $_POST['PARAM_4'];
+ $destination = $_POST['PARAM_5'];
+ }
+ if (isset($destination) && $destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "GLAccountTransactions.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "GLAccountTransactions.pdf";
}
+ $rep = new FrontReport(_('GL Account Transactions'), $filename, user_pagesize());
$dec = user_price_dec();
$cols = array(0, 70, 90, 140, 210, 280, 340, 400, 450, 510, 570);
if ($dim == 2)
$headers = array(_('Type'), _('#'), _('Date'), _('Dimension')." 1", _('Dimension')." 2",
_('Person/Item'), _('Debit'), _('Credit'), _('Balance'));
- else if ($dim == 1)
+ elseif ($dim == 1)
$headers = array(_('Type'), _('#'), _('Date'), _('Dimension'), "", _('Person/Item'),
_('Debit'), _('Credit'), _('Balance'));
else
$rep->TextCol(0, 3, $account['account_code'] . " " . $account['account_name']);
$rep->TextCol(3, 5, _('Opening Balance'));
if ($prev_balance > 0.0)
- $rep->TextCol(6, 7, number_format2(abs($prev_balance), $dec));
+ $rep->AmountCol(6, 7, abs($prev_balance), $dec);
else
- $rep->TextCol(7, 8, number_format2(abs($prev_balance), $dec));
+ $rep->AmountCol(7, 8, abs($prev_balance), $dec);
$rep->Font();
$total = $prev_balance;
$rep->NewLine(2);
$rep->TextCol(0, 1, systypes::name($myrow["type"]));
$rep->TextCol(1, 2, $myrow['type_no']);
- $rep->TextCol(2, 3, sql2date($myrow["tran_date"]));
+ $rep->DateCol(2, 3, $myrow["tran_date"], true);
if ($dim >= 1)
$rep->TextCol(3, 4, get_dimension_string($myrow['dimension_id']));
if ($dim > 1)
$rep->TextCol(4, 5, get_dimension_string($myrow['dimension2_id']));
$rep->TextCol(5, 6, payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"], false));
if ($myrow['amount'] > 0.0)
- $rep->TextCol(6, 7, number_format2(abs($myrow['amount']), $dec));
+ $rep->AmountCol(6, 7, abs($myrow['amount']), $dec);
else
- $rep->TextCol(7, 8, number_format2(abs($myrow['amount']), $dec));
+ $rep->AmountCol(7, 8, abs($myrow['amount']), $dec);
$rep->TextCol(8, 9, number_format2($total, $dec));
$rep->NewLine();
if ($rep->row < $rep->bottomMargin + $rep->lineHeight)
$rep->Font('bold');
$rep->TextCol(3, 5, _("Ending Balance"));
if ($total > 0.0)
- $rep->TextCol(6, 7, number_format2(abs($total), $dec));
+ $rep->AmountCol(6, 7, abs($total), $dec);
else
- $rep->TextCol(7, 8, number_format2(abs($total), $dec));
+ $rep->AmountCol(7, 8, abs($total), $dec);
$rep->Font();
$rep->Line($rep->row - $rep->lineHeight + 4);
$rep->NewLine(2, 1);
$comments = $_POST['PARAM_3'];
$destination = $_POST['PARAM_4'];
}
- if (isset($destination) && $destination)
+ if ($destination)
{
include_once($path_to_root . "/reporting/includes/excel_report.inc");
$filename = "BalanceSheet.xml";
{
global $path_to_root;
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
$dim = get_company_pref('use_dimension');
$dimension = $dimension2 = 0;
$dimension = $_POST['PARAM_4'];
$dimension2 = $_POST['PARAM_5'];
$comments = $_POST['PARAM_6'];
+ $destination = $_POST['PARAM_7'];
}
else if ($dim == 1)
{
$dimension = $_POST['PARAM_4'];
$comments = $_POST['PARAM_5'];
+ $destination = $_POST['PARAM_6'];
}
else
{
$comments = $_POST['PARAM_4'];
+ $destination = $_POST['PARAM_5'];
+ }
+ if ($destination)
+ {
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ $filename = "TrialBalance.xml";
+ }
+ else
+ {
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "TrialBalance.pdf";
}
$dec = user_price_dec();
1 => array('text' => _('Period'),'from' => $from, 'to' => $to));
}
- $rep = new FrontReport(_('Trial Balance'), "TrialBalance.pdf", user_pagesize());
+ $rep = new FrontReport(_('Trial Balance'), $filename, user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2);
if ($balances != 0)
{
if ($prev['balance'] >= 0.0)
- $rep->TextCol(2, 3, number_format2($prev['balance'], $dec));
+ $rep->AmountCol(2, 3, $prev['balance'], $dec);
else
- $rep->TextCol(3, 4, number_format2(abs($prev['balance']), $dec));
+ $rep->AmountCol(3, 4, abs($prev['balance']), $dec);
if ($curr['balance'] >= 0.0)
- $rep->TextCol(4, 5, number_format2($curr['balance'], $dec));
+ $rep->AmountCol(4, 5, $curr['balance'], $dec);
else
- $rep->TextCol(5, 6, number_format2(abs($curr['balance']), $dec));
+ $rep->AmountCol(5, 6, abs($curr['balance']), $dec);
if ($tot['balance'] >= 0.0)
- $rep->TextCol(6, 7, number_format2($tot['balance'], $dec));
+ $rep->AmountCol(6, 7, $tot['balance'], $dec);
else
- $rep->TextCol(7, 8, number_format2(abs($tot['balance']), $dec));
+ $rep->AmountCol(7, 8, abs($tot['balance']), $dec);
}
else
{
- $rep->TextCol(2, 3, number_format2($prev['debit'], $dec));
- $rep->TextCol(3, 4, number_format2($prev['credit'], $dec));
- $rep->TextCol(4, 5, number_format2($curr['debit'], $dec));
- $rep->TextCol(5, 6, number_format2($curr['credit'], $dec));
- $rep->TextCol(6, 7, number_format2($tot['debit'], $dec));
- $rep->TextCol(7, 8, number_format2($tot['credit'], $dec));
+ $rep->AmountCol(2, 3, $prev['debit'], $dec);
+ $rep->AmountCol(3, 4, $prev['credit'], $dec);
+ $rep->AmountCol(4, 5, $curr['debit'], $dec);
+ $rep->AmountCol(5, 6, $curr['credit'], $dec);
+ $rep->AmountCol(6, 7, $tot['debit'], $dec);
+ $rep->AmountCol(7, 8, $tot['credit'], $dec);
$pdeb += $prev['debit'];
$pcre += $prev['credit'];
$cdeb += $curr['debit'];
if ($balances == 0)
{
$rep->TextCol(0, 2, _("Total"));
- $rep->TextCol(2, 3, number_format2($pdeb, $dec));
- $rep->TextCol(3, 4, number_format2($pcre, $dec));
- $rep->TextCol(4, 5, number_format2($cdeb, $dec));
- $rep->TextCol(5, 6, number_format2($ccre, $dec));
- $rep->TextCol(6, 7, number_format2($tdeb, $dec));
- $rep->TextCol(7, 8, number_format2($tcre, $dec));
+ $rep->AmountCol(2, 3, $pdeb, $dec);
+ $rep->AmountCol(3, 4, $pcre, $dec);
+ $rep->AmountCol(4, 5, $cdeb, $dec);
+ $rep->AmountCol(5, 6, $ccre, $dec);
+ $rep->AmountCol(6, 7, $tdeb, $dec);
+ $rep->AmountCol(7, 8, $tcre, $dec);
$rep->NewLine();
}
$rep->TextCol(0, 2, _("Ending Balance"));
if ($pbal >= 0.0)
- $rep->TextCol(2, 3, number_format2($pbal, $dec));
+ $rep->AmountCol(2, 3, $pbal, $dec);
else
- $rep->TextCol(3, 4, number_format2(abs($pbal), $dec));
+ $rep->AmountCol(3, 4, abs($pbal), $dec);
if ($cbal >= 0.0)
- $rep->TextCol(4, 5, number_format2($cbal, $dec));
+ $rep->AmountCol(4, 5, $cbal, $dec);
else
- $rep->TextCol(5, 6, number_format2(abs($cbal), $dec));
+ $rep->AmountCol(5, 6, abs($cbal), $dec);
if ($tbal >= 0.0)
- $rep->TextCol(6, 7, number_format2($tbal, $dec));
+ $rep->AmountCol(6, 7, $tbal, $dec);
else
- $rep->TextCol(7, 8, number_format2(abs($tbal), $dec));
+ $rep->AmountCol(7, 8, abs($tbal), $dec);
+ $rep->NewLine();
- $rep->Line($rep->row - 6);
+ $rep->Line($rep->row);
$rep->End();
}
{
global $path_to_root, $trans_dir;
-
- include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
- $rep = new FrontReport(_('Tax Report'), "TaxReport.pdf", user_pagesize());
-
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
$summaryOnly = $_POST['PARAM_2'];
$comments = $_POST['PARAM_3'];
+
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+ $filename = "TaxReport.pdf";
+
$dec = user_price_dec();
+ $rep = new FrontReport(_('Tax Report'), $filename, user_pagesize());
if ($summaryOnly == 1)
$summary = _('Summary Only');
else
{
$rep->TextCol(0, 1, $trans['type_name']);
$rep->TextCol(1, 2, $trans['memo']);
- $rep->TextCol(2, 3, sql2date($trans['tran_date']));
+ $rep->DateCol(2, 3, $trans['tran_date'], true);
$rep->TextCol(3, 4, $trans['name']);
$rep->TextCol(4, 5, $trans['br_name']);
- $rep->TextCol(5, 6, number_format2($trans['net_amount'], $dec));
- $rep->TextCol(6, 7, number_format2($trans['rate'], $dec));
- $rep->TextCol(7, 8, number_format2($trans['amount'], $dec));
+ $rep->AmountCol(5, 6, $trans['net_amount'], $dec);
+ $rep->AmountCol(6, 7, $trans['rate'], $dec);
+ $rep->AmountCol(7, 8, $trans['amount'], $dec);
$rep->NewLine();
$tx = getTaxInfo($id);
$rep->TextCol(0, 1, $tx['name'] . " " . number_format2($tx['rate'], $dec) . "%");
- $rep->TextCol(1, 2, number_format2($sum['out'], $dec));
- $rep->TextCol(2, 3,number_format2($sum['taxout'], $dec));
- $rep->TextCol(3, 4, number_format2($sum['in'], $dec));
- $rep->TextCol(4, 5,number_format2($sum['taxin'], $dec));
- $rep->TextCol(5, 6, number_format2($sum['taxout']+$sum['taxin'], $dec));
+ $rep->AmountCol(1, 2, $sum['out'], $dec);
+ $rep->AmountCol(2, 3, $sum['taxout'], $dec);
+ $rep->AmountCol(3, 4, $sum['in'], $dec);
+ $rep->AmountCol(4, 5, $sum['taxin'], $dec);
+ $rep->AmountCol(5, 6, $sum['taxout']+$sum['taxin'], $dec);
$taxtotal += $sum['taxout']+$sum['taxin'];
$rep->NewLine();
}
$rep->NewLine();
$rep->Line($rep->row + $rep->lineHeight);
$rep->TextCol(3, 5, _("Total payable or refund"));
- $rep->TextCol(5, 6, number_format2($taxtotal, $dec));
+ $rep->AmountCol(5, 6, $taxtotal, $dec);
$rep->Line($rep->row - 5);
$rep->Font();
$rep->NewLine();
array( new ReportParam(_('Start Date'),'DATEBEGINTAX'),
new ReportParam(_('End Date'),'DATEENDTAX'),
new ReportParam(_('Summary Only'),'YES_NO'),
- new ReportParam(_('Comments'),'TEXTBOX'),
- new ReportParam(_('Destination'),'DESTINATION')));
+ new ReportParam(_('Comments'),'TEXTBOX')));
echo "<script language='javascript'>
function onWindowLoad() {