Ejemplo n.º 1
0
function print_audit_trail()
{
    global $path_to_root, $systypes_array;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $systype = $_POST['PARAM_2'];
    $user = $_POST['PARAM_3'];
    $comments = $_POST['PARAM_4'];
    $orientation = $_POST['PARAM_5'];
    $destination = $_POST['PARAM_6'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    $dec = user_price_dec();
    $cols = array(0, 60, 120, 180, 240, 340, 400, 460, 520);
    $headers = array(_('Date'), _('Time'), _('User'), _('Trans Date'), _('Type'), _('#'), _('Action'), _('Amount'));
    $aligns = array('left', 'left', 'left', 'left', 'left', 'left', 'left', 'right');
    $usr = get_user($user);
    $user_id = $usr['user_id'];
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Type'), 'from' => $systype != -1 ? $systypes_array[$systype] : _('All'), 'to' => ''), 3 => array('text' => _('User'), 'from' => $user != -1 ? $user_id : _('All'), 'to' => ''));
    $rep = new FrontReport(_('Audit Trail'), "AuditTrail", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $trans = getTransactions($from, $to, $systype, $user);
    while ($myrow = db_fetch($trans)) {
        $rep->TextCol(0, 1, sql2date(date("Y-m-d", $myrow['unix_stamp'])));
        if (user_date_format() == 0) {
            $rep->TextCol(1, 2, date("h:i:s a", $myrow['unix_stamp']));
        } else {
            $rep->TextCol(1, 2, date("H:i:s", $myrow['unix_stamp']));
        }
        $rep->TextCol(2, 3, $myrow['user_id']);
        $rep->TextCol(3, 4, sql2date($myrow['gl_date']));
        $rep->TextCol(4, 5, $systypes_array[$myrow['type']]);
        $rep->TextCol(5, 6, $myrow['trans_no']);
        if ($myrow['gl_seq'] == null) {
            $action = _('Changed');
        } else {
            $action = _('Closed');
        }
        $rep->TextCol(6, 7, $action);
        if ($myrow['amount'] != null) {
            $rep->AmountCol(7, 8, $myrow['amount'], $dec);
        }
        $rep->NewLine(1, 2);
    }
    $rep->Line($rep->row + 4);
    $rep->End();
}
Ejemplo n.º 2
0
            display_warning(_("Display settings have been updated. Keep in mind that changed settings are restored on every login in demo mode."));
        } else {
            display_notification_centered(_("Display settings have been updated."));
        }
    }
}
start_form();
start_outer_table(TABLESTYLE2);
table_section(1);
table_section_title(_("Decimal Places"));
number_list_row(_("Prices/Amounts:"), 'prices_dec', user_price_dec(), 0, 10);
number_list_row(_("Quantities:"), 'qty_dec', user_qty_dec(), 0, 10);
number_list_row(_("Exchange Rates:"), 'rates_dec', user_exrate_dec(), 0, 10);
number_list_row(_("Percentages:"), 'percent_dec', user_percent_dec(), 0, 10);
table_section_title(_("Dateformat and Separators"));
dateformats_list_row(_("Dateformat:"), "date_format", user_date_format());
dateseps_list_row(_("Date Separator:"), "date_sep", user_date_sep());
/* The array $dateseps is set up in config.php for modifications
possible separators can be added by modifying the array definition by editing that file */
thoseps_list_row(_("Thousand Separator:"), "tho_sep", user_tho_sep());
/* The array $thoseps is set up in config.php for modifications
possible separators can be added by modifying the array definition by editing that file */
decseps_list_row(_("Decimal Separator:"), "dec_sep", user_dec_sep());
/* The array $decseps is set up in config.php for modifications
possible separators can be added by modifying the array definition by editing that file */
if (!isset($_POST['language'])) {
    $_POST['language'] = $_SESSION['language']->code;
}
table_section_title(_("Language"));
languages_list_row(_("Language:"), 'language', $_POST['language']);
table_section(2);
 function date_cells($label, $name, $title = null, $check = null, $inc_days = 0, $inc_months = 0, $inc_years = 0, $params = null, $submit_on_change = false)
 {
     global $use_date_picker, $path_to_root, $Ajax;
     if (!isset($_POST[$name]) || $_POST[$name] == "") {
         if ($inc_years == 1001) {
             $_POST[$name] = null;
         } else {
             $dd = Today();
             if ($inc_days != 0) {
                 $dd = add_days($dd, $inc_days);
             }
             if ($inc_months != 0) {
                 $dd = add_months($dd, $inc_months);
             }
             if ($inc_years != 0) {
                 $dd = add_years($dd, $inc_years);
             }
             $_POST[$name] = $dd;
         }
     }
     if ($use_date_picker) {
         $calc_image = file_exists("{$path_to_root}/themes/" . user_theme() . "/images/cal.gif") ? "{$path_to_root}/themes/" . user_theme() . "/images/cal.gif" : "{$path_to_root}/themes/default/images/cal.gif";
         $post_label = "<a tabindex='-1' href=\"javascript:date_picker(document.getElementsByName('{$name}')[0]);\">" . "\t<img src='{$calc_image}' width='15' height='15' border='0' alt='" . _('Click Here to Pick up the date') . "'></a>\n";
     } else {
         $post_label = "";
     }
     $class = $submit_on_change ? 'date active form-control' : 'date form-control';
     $aspect = $check ? 'aspect="cdate"' : '';
     if ($check && get_post($name) != Today()) {
         $aspect .= ' style="color:#FF0000"';
     }
     default_focus($name);
     $size = user_date_format() > 3 ? 11 : 10;
     $controlAsString = "<div class=\"input-group\">" . "<input type=\"text\" name=\"{$name}\" class=\"{$class}\" {$aspect} size=\"{$size}\" maxlength=\"12\" value=\"" . $_POST[$name] . "\"" . ($title ? " title='{$title}'" : '') . " > " . "<span class=\"input-group-addon\">{$post_label}</span>" . "</div>";
     View::get()->addControl(View::controlFromRenderedString(View::CONTROL_DATE, $label, $controlAsString));
     // CONTROL_DATE? CP 2014-11
     $Ajax->addUpdate($name, $name, $_POST[$name]);
 }