<?php
+/**********************************************************************
+ Copyright (C) FrontAccounting, LLC.
+ Released under the terms of the GNU General Public License, GPL,
+ as published by the Free Software Foundation, either version 3
+ of the License, or (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
class BoxReports
{
var $ar_classes;
function getDisplay($class=null)
{
- global $table_style2, $comp_path, $path_to_root;
+ global $table_style2, $comp_path, $path_to_root, $pdf_debug, $Ajax;
$temp = array_values($this->ar_classes);
$display_class = $class==null ? $temp[0] : $this->ar_classes[$class];
$st_classes = "<b>" . _("Report Classes:") . "</b><br>";
foreach($this->ar_classes as $key=>$value)
{
- $style = $class_counter==0 ? '' : $style = "style='display:none'";
+ $style = $class_counter==$_REQUEST['Class'] ? '' : "style='display:none'";
$acc = access_string($key);
- $st_classes .= "<a href='javascript:showClass($class_counter)'$acc[1]>$acc[0]</a> <br>";
- $st_reports .= "<table id='TAB_" . $class_counter++ ."' $style cellpadding=0 cellspacing=0 border=0 width='100%'><tr><td><b>" . _("Reports For Class: ") . " $key</b></td></tr>";
+ $st_classes .= "<a href='"
+ .$_SERVER['PHP_SELF']."?Class=$class_counter'"
+ ." class='menu_option' id='".default_focus()."'"
+ ." onclick='return showClass($class_counter);'$acc[1]>$acc[0]</a> <br>";
+ $st_reports .= "<table id='TAB_" . $class_counter ."' $style cellpadding=0 cellspacing=0 border=0 width='100%'><tr><td><b>" . _("Reports For Class: ") . " $key</b></td></tr>\n";
foreach($value as $report)
- { $acc = access_string($report->name);
- $st_reports .= "<tr><td><a href='javascript:showReport($rep_counter)'$acc[1]>$acc[0]</a></td></tr>";
-
- $action = $path_to_root.'/reporting/prn_redirect.php';
-
- $st_params .= "<div id='REP_" . $rep_counter++ . "' style='display:none'>";
- $st_params .= "<table border=0><tr><td>\n"
- . "<form method='POST' action='$action'>\n"
- . $report->getDisplay()
- . "\n</form>\n"
- . "</td></tr></table></div>";
-
+ {
+ $acc = access_string($report->name);
+ $st_reports .= "<tr><td><a class='printlink' href='"
+ .$_SERVER['PHP_SELF']."?Class=$class_counter&rep_id=$report->id'"
+ ." id='".default_focus()."'"
+ ."$acc[1]>$acc[0]</a><tr><td>\n";
+ if (isset($_REQUEST['rep_id']) && $_REQUEST['rep_id']==$report->id) {
+
+ $action = $path_to_root.'/reporting/prn_redirect.php';
+
+ $st_params = "<table border=0><tr><td>\n"
+ . "<form method='POST' action='$action' target='_blank'>\n";
+ $st_params .= hidden('REP_ID', $report->id, false);
+ $st_params .= submit('Rep'.$report->id,
+ _("Display: ") . access_string($report->name, true),
+ false, '', $pdf_debug ? false : 'default') . '<br><br>';
+ $st_params .= $report->getDisplay()
+ . "\n</form></td></tr></table>\n";
+ set_focus('Rep'.$report->id);
+ $Ajax->addUpdate(true, 'rep_form', $st_params);
+ }
}
$st_reports .= "</table>";
+ $class_counter++;
}
+ $st_params = "<div id='rep_form'>".
+ "$st_params</div>";
+
+
$st = "<script language='javascript'>
function showClass(pClass) {
for(i=0; i<$class_counter; i++) {
- eval('document.getElementById(\"TAB_\" + i).style.display=\"none\"')
+ document.getElementById(\"TAB_\" + i).style.display=
+ i==pClass ? \"block\" : \"none\";
}
- eval('document.getElementById(\"TAB_\" + pClass).style.display=\"block\"')
- for (i=0; i<$rep_counter; i++) {
- eval('document.getElementById(\"REP_\" + i).style.display=\"none\"')
- }
- }
- function showReport(pId) {
-// JsHttpRequest.request('Rep'+pId);
- var tab;
- for(i=0; i<$rep_counter; i++) {
- eval('document.getElementById(\"REP_\" + i).style.display=\"none\"')
- }
- eval('document.getElementById(\"REP_\" + pId).style.display=\"block\"')
+ document.getElementById('rep_form').innerHTML = '';
+// document.getElementById('rep_form').style.display = 'none';
+ return false;
}
function checkDate(pObj) {
var re = /^(3[01]|0[1-9]|[12]\d)\/(0[1-9]|1[012])\/\d{4}/;
function getDisplay()
{
- global $path_to_root, $use_date_picker;
+ global $path_to_root, $use_date_picker, $pdf_debug, $print_invoice_no;
- $st = hidden('REP_ID', $this->id, false);
- $st .= submit('Rep'.$this->id,
- _("Display: ") . access_string($this->name,true),
- false, '', true) . '<br><br>';
+ $st = '';
$dummy = "";
if ($this->ar_params==null)
return "";
$date = $edate;
else
{
- $bdate = add_months($edate, -$row['tax_prd'] + 1);
- $date = begin_month($bdate);
+ $bdate = begin_month($edate);
+ $bdate = add_months($bdate, -$row['tax_prd'] + 1);
+ $date = $bdate;
}
}
$name = "PARAM_$index";
$sel = array(_("No Payment Link"), "PayPal");
$st .= dup_simple_name_list("PARAM_$index", $sel);
break;
+ case 'DESTINATION':
+ $sel = array(_("PDF/Printer"), "Excel");
+ $st .= dup_simple_name_list("PARAM_$index", $sel);
+ break;
case 'COMPARE':
$sel = array(_("Accumulated"), _("Period Y-1"), _("Budget"));
$st .= dup_simple_name_list("PARAM_$index", $sel);
$st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy);
break;
case 'BANK_ACCOUNTS':
- $sql = "SELECT ".TB_PREF."bank_accounts.account_code, concat(bank_account_name, if (bank_curr_code=curr_default,'', concat(' - ', bank_curr_code))) FROM ".TB_PREF."bank_accounts, ".TB_PREF."chart_master, ".TB_PREF."company
- WHERE ".TB_PREF."bank_accounts.account_code=".TB_PREF."chart_master.account_code";
+ $sql = "SELECT ".TB_PREF."bank_accounts.id, concat(bank_account_name, if (bank_curr_code=curr_default,'', concat(' - ', bank_curr_code))) FROM ".TB_PREF."bank_accounts, ".TB_PREF."company";
$st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy);
break;
case 'DIMENSION':
- $sql = "SELECT reference, concat(reference, ' - ', name) AS DimName FROM ".TB_PREF."dimensions ORDER BY reference";
+ $sql = "SELECT id, concat(reference, ' - ', name) AS DimName FROM ".TB_PREF."dimensions ORDER BY reference";
$st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy);
break;
case 'DIMENSIONS':
- $sql = "SELECT reference, concat(reference, ' - ', name) as DimName FROM ".TB_PREF."dimensions ORDER BY reference";
+ $sql = "SELECT id, concat(reference, ' - ', name) as DimName FROM ".TB_PREF."dimensions ORDER BY reference";
$st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy, true, _("No Dimension Filter"), true);
break;
case 'DIMENSION1':
- $sql = "SELECT reference, concat(reference, ' - ', name) AS DimName FROM ".TB_PREF."dimensions WHERE type_=1 ORDER BY reference";
+ $sql = "SELECT id, concat(reference, ' - ', name) AS DimName FROM ".TB_PREF."dimensions WHERE type_=1 ORDER BY reference";
$st .= dup_simple_codeandname_list($sql, "PARAM_$index". "_$index", $dummy);
break;
case 'DIMENSIONS1':
- $sql = "SELECT reference, concat(reference, ' - ', name) as DimName FROM ".TB_PREF."dimensions WHERE type_=1 ORDER BY reference";
+ $sql = "SELECT id, concat(reference, ' - ', name) as DimName FROM ".TB_PREF."dimensions WHERE type_=1 ORDER BY reference";
$st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy, true, _("No Dimension Filter"), true);
break;
case 'DIMENSION2':
- $sql = "SELECT reference, concat(reference, ' - ', name) AS DimName FROM ".TB_PREF."dimensions WHERE type_=2 ORDER BY reference";
+ $sql = "SELECT id, concat(reference, ' - ', name) AS DimName FROM ".TB_PREF."dimensions WHERE type_=2 ORDER BY reference";
$st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy);
break;
case 'DIMENSIONS2':
- $sql = "SELECT reference, concat(reference, ' - ', name) as DimName FROM ".TB_PREF."dimensions WHERE type_=2 ORDER BY reference";
+ $sql = "SELECT id, concat(reference, ' - ', name) as DimName FROM ".TB_PREF."dimensions WHERE type_=2 ORDER BY reference";
$st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy, true, _("No Dimension Filter"), true);
break;
case 'CUSTOMERS_NO_FILTER':
case 'INVOICE':
$IV = _("IV");
$CN = _("CN");
- $sql = "SELECT concat(".TB_PREF."debtor_trans.trans_no, '-',
- ".TB_PREF."debtor_trans.type) AS TNO, concat(".TB_PREF."debtor_trans.trans_no, if (type=10, ' $IV ', ' $CN '), ".TB_PREF."debtors_master.name) as IName
- FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE (type=10 OR type=11) AND ".TB_PREF."debtors_master.debtor_no=".TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC";
+ if ($print_invoice_no == 1)
+ $sql = "SELECT concat(".TB_PREF."debtor_trans.trans_no, '-',
+ ".TB_PREF."debtor_trans.type) AS TNO, concat(".TB_PREF."debtor_trans.trans_no, if (type=10, ' $IV ', ' $CN '), ".TB_PREF."debtors_master.name) as IName
+ FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE (type=10 OR type=11) AND ".TB_PREF."debtors_master.debtor_no=".TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC";
+ else
+ $sql = "SELECT concat(".TB_PREF."debtor_trans.trans_no, '-',
+ ".TB_PREF."debtor_trans.type) AS TNO, concat(".TB_PREF."debtor_trans.reference, if (type=10, ' $IV ', ' $CN '), ".TB_PREF."debtors_master.name) as IName
+ FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE (type=10 OR type=11) AND ".TB_PREF."debtors_master.debtor_no=".TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC";
$st .= dup_simple_codeandname_list($sql, "PARAM_$index", $dummy);
break;
case 'DELIVERY':