var $formatHeaderRight;
var $formatFooter;
var $formatAmount = array();
+ var $headerFunc;
var $sheet;
$this->formatFooter =& $this->addFormat();
$this->formatFooter->setTop(2);
$this->formatFooter->setTopColor('gray');
+ $this->SetHeaderType("header");
}
+ /*
+ Set header handler
+ */
+ function SetHeaderType($name) {
+ $this->headerFunc = $name;
+ }
// Check a given name to see if it's a valid Excel worksheet name,
// and fix if necessary
function worksheetNameGenerator($name)
function NewPage()
{
- return;
+ if (method_exists($this, $this->headerFunc)) // draw predefined page layout if any
+ $this->{$this->headerFunc}();
}
function ymd2Date($year, $mon, $day) // XLS internal date representation is a number between 1900-01-01 and 2078-12-31
function End($email=0, $subject=null, $myrow=null, $doctype = 0)
{
+ ++$this->y;
for ($i = 0; $i < $this->numcols; $i++)
$this->sheet->writeBlank($this->y, $i, $this->formatFooter);
$this->sheet->mergeCells($this->y, 0, $this->y, $this->numcols - 1);
$st_params .= submit('Rep'.$report->id,
_("Display: ") . access_string($report->name, true),
false, '', $pdf_debug ? false : 'default process') . hidden('REP_ID', $report->id, false).'<br><br>';
- $st_params .= $this->getOptions($report->get_controls());
+ $st_params .= $this->getOptions($report->get_controls(), $report->id);
$st_params .= "\n</form></td></tr></table>\n";
set_focus('Rep'.$report->id);
$Ajax->addUpdate(true, 'rep_form', $st_params);
return $st;
}
- function getOptions($controls)
+ function getOptions($controls, $id = 0)
{
$st = '';
if ($controls == null)
if ($ctrl) break;
}
if ($ctrl == '') {
+ if (isset($_COOKIE['select'][$id][$cnt])) // saved parameters 2010-10-06 Joe Hunt
+ $_POST['PARAM_'.$cnt] = $_COOKIE['select'][$id][$cnt];
$ctrl = $this->get_ctrl('PARAM_'.$cnt, $type);
}
if ($ctrl != '') {
case 'DATEENDM':
case 'DATEBEGINTAX':
case 'DATEENDTAX':
- if ($type == 'DATEBEGIN')
- $date = begin_fiscalyear();
- elseif ($type == 'DATEEND')
- $date = end_fiscalyear();
- else
- $date = Today();
- if ($type == 'DATEBEGINM')
- $date = begin_month($date);
- elseif ($type == 'DATEENDM')
- $date = end_month($date);
- elseif ($type == 'DATEBEGINTAX' || $type == 'DATEENDTAX')
+ if (!isset($_POST[$name]))
{
- $row = get_company_prefs();
- $edate = add_months($date, -$row['tax_last']);
- $edate = end_month($edate);
- if ($type == 'DATEENDTAX')
- $date = $edate;
+ if ($type == 'DATEBEGIN')
+ $date = begin_fiscalyear();
+ elseif ($type == 'DATEEND')
+ $date = end_fiscalyear();
else
+ $date = Today();
+ if ($type == 'DATEBEGINM')
+ $date = begin_month($date);
+ elseif ($type == 'DATEENDM')
+ $date = end_month($date);
+ elseif ($type == 'DATEBEGINTAX' || $type == 'DATEENDTAX')
{
- $bdate = begin_month($edate);
- $bdate = add_months($bdate, -$row['tax_prd'] + 1);
- $date = $bdate;
+ $row = get_company_prefs();
+ $edate = add_months($date, -$row['tax_last']);
+ $edate = end_month($edate);
+ if ($type == 'DATEENDTAX')
+ $date = $edate;
+ else
+ {
+ $bdate = begin_month($edate);
+ $bdate = add_months($bdate, -$row['tax_prd'] + 1);
+ $date = $bdate;
+ }
}
}
-
+ else // saved parameters 2010-10-16 Joe Hunt
+ $date = $_POST[$name];
$st = "<input type='text' name='$name' value='$date'>";
if ($use_date_picker)
$st .= "<a href=\"javascript:date_picker(document.forms[0].$name);\">"
return "<input type='text' name='$name'>";
case 'TEXTBOX':
- return "<textarea rows=4 cols=30 name='$name'></textarea>";
+ $value = (isset($_POST[$name]) ? $_POST[$name] : "");
+ return "<textarea rows=4 cols=30 name='$name'>$value</textarea>";
case 'ACCOUNTS': // not used
return gl_account_types_list($name, null, _("No Account Group Filter"), true);
$page_security = 'SA_OPEN'; // this level is later overriden in rep file
include_once($path_to_root . "/includes/session.inc");
+if (isset($save_report_selections) && $save_report_selections > 0 && isset($_POST['REP_ID'])) { // save parameters from Report Center
+ for($i=0; $i<10; $i++) { // 2010-10-06 Joe Hunt
+ if (isset($_POST['PARAM_'.$i]) && !is_array($_POST['PARAM_'.$i])) {
+ $rep = $_POST['REP_ID'];
+ setcookie("select[$rep][$i]", $_POST['PARAM_'.$i], time()+60*60*24*$save_report_selections); // days from $save_report_selections
+ }
+ }
+}
+
if (isset($_GET['xls']))
{
$filename = $_GET['filename'];
? $_GET['PARAM_'.$i] : $def_pars[$i];
}
}
-
$rep = $_POST['REP_ID'];
$rep_file = find_custom_file("/reporting/rep$rep.php");