function display()
{
    extract($_REQUEST);
    $reports = array("acid_test", "customers_turnover", "daily_sales_in_receivables", "inventory_turnover", "days_cost_of_sales_in_inventory", "accounts_receivable_turnover", "accounts_payable_turnover", "days_cost_of_sales_in_accounts_payable", "assets_turnover", "debt_ratio", "depreciation_expense_gross_depreciable_property", "current_ratio", "working_captial", "accounts_receivable_working_capital", "inventory_working_capital", "long_term_liabilities_working_capital", "sales_working_capital", "gross_profit_turnover", "net_profit_turnover", "return_on_assets", "return_on_investment", "repairs_and_maintenance_gross_depreciation_of_property", "owners_equity", "debt_equity", "financial_leverage", "interest_net_income_excluding_interest", "operating_cycle_days");
    $not_percentage = array("daily_sales_in_receivables", "days_cost_of_sales_in_inventory", "days_cost_of_sales_in_accounts_payable", "working_capital", "operating_cycle_days");
    $i = 1;
    $reports_out = "";
    foreach ($reports as $name) {
        if ($i == 1) {
            $reports_out .= "<tr><td width='20%' valign='top'>";
        } else {
            $reports_out .= "<td width='20%' valign='top'>";
        }
        if (function_exists($name)) {
            list($description, $calculation) = call_user_func($name);
        } else {
            $description = "Not implemented.";
        }
        $calculation = sprint($calculation);
        if (!in_array($name, $not_percentage)) {
            $calculation .= "%";
        }
        $reports_out .= "\n\t\t<table " . TMPL_tblDflts . " width='100%' style='border: 1px solid #fff'>\n\t\t\t<tr><th>" . nice_name($name) . "</th></tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>\n\t\t\t\t\t<span style='font-size: 0.9em; letter-spacing: -0.065em'>\n\t\t\t\t\t\t{$description}\n\t\t\t\t\t</span>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr bgcolor='#ffffff'>\n\t\t\t\t<td align='center'>\n\t\t\t\t\t<span style='font-size: 1.2em; color: #f00; font-weight:bold'>\n\t\t\t\t\t\t{$calculation}\n\t\t\t\t\t</span>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>";
        if ($i == 5) {
            $reports_out .= "</td></tr>";
            $i = 0;
        } else {
            $reports_out .= "</td>";
        }
        $i++;
    }
    if (!isset($heart)) {
        $sql = "SELECT value FROM cubit.settings WHERE constant='HEART'";
        $heart_rslt = db_exec($sql) or errDie("Unable to retrieve heart display value.");
        $heart = pg_fetch_result($heart_rslt, 0);
    } else {
        $sql = "UPDATE cubit.settings SET value='{$heart}' WHERE constant='HEART'";
        db_exec($sql) or errDie("Unable to update heart status");
    }
    if ($heart) {
        $heart_yes = "checked";
        $heart_no = "";
    } else {
        $heart_yes = "";
        $heart_no = "checked";
    }
    $bgcolor = bgcolorg();
    $ql = mkQuickLinks(ql("ratio_settings.php", "Link Accounts to Ratios"));
    $OUTPUT = "\n\t<table cellpadding='5' cellspacing='2'>{$reports_out}</table>\n\t<center>\n\t<form method='post' action='" . SELF . "' name='form'>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr><th colspan='2'>Display Heart on Main Menu</th></tr>\n\t\t<tr>\n\t\t\t<td class='" . bg_class() . "' align='center'>\n\t\t\t\tYes <input type='radio' name='heart' value='1'\n\t\t\t\tonchange='javascript:document.form.submit()' {$heart_yes} />\n\t\t\t</td>\n\t\t\t<td class='" . bg_class() . "' align='center'>\n\t\t\t\tNo <input type='radio' name='heart' value='0'\n\t\t\t\tonchange='javascript:document.form.submit()' {$heart_no} />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr><td colspan='2' align='center'>{$ql}</td></tr>\n\t</table>\n\t</form>\n\t</center>";
    return $OUTPUT;
}
Ejemplo n.º 2
0
 public static function show_templates($website_id, $start_record, $category_id, $action = NULL)
 {
     $templates_per_page = sz_config('items_per_page');
     $end_record = $templates_per_page;
     $website_template = '';
     $checked = '';
     //$list = itemsPerPageLinks().'<br>';
     $list = '';
     $db = Database::obtain();
     if ($website_id > 0 && $action == 'select') {
         $sql = "SELECT `website_template` FROM " . TABLE_WEBSITES . "\n\t\t\t\t\tWHERE `id` =" . $website_id . "";
         $websitedata = $db->query_first($sql);
         $website_template = $websitedata['website_template'];
     }
     $templates = self::template_generate_list();
     $totaltemplates = sizeof($templates) - 1;
     $lastpage = $totaltemplates - $templates_per_page;
     if ($lastpage < 0) {
         $lastpage = 0;
     }
     if ($start_record > $totaltemplates) {
         $start_record = $totaltemplates - $templates_per_page;
     }
     $ep = $start_record + $templates_per_page;
     $tlist = array();
     foreach ($templates as $i => $t) {
         if ($i >= $start_record && $i < $ep) {
             $tlist[] = $t;
         }
     }
     $templates = $tlist;
     if ($action == 'select') {
         $list .= '<form action="template.php?website=' . $website_id . '&action=save&tview=' . $start_record . '" method="post">';
     }
     $list .= '<table cellspacing="5" cellpadding="0" border="0" align="center"><tr>';
     foreach ($templates as $i => $t) {
         $list .= '<td align="center" id="templatebox" width="160px" heigh="160px">';
         $list .= '<span id="templatename">' . nice_name($t) . '</span><a href="templates/' . $t . '/preview.jpg" target="_blank" onclick="window.open(\'' . sz_config('url') . 'templates/' . $t . '/preview.jpg\',\'popup\',\'scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0\'); return false"><img src="templates/' . $t . '/preview.jpg" width="140px" height="90px"></a>';
         if ($action != NULL) {
             if ($t == $website_template) {
                 $checked = 'checked="checked"';
             } else {
                 $checked = '';
             }
             $list .= '<span id="templateselect">' . translate('Select Template', sz_config('language')) . '</span><input name="website_template" value="' . $t . '" type="radio" ' . $checked . '/></td>';
         } else {
             $list .= '<span id="author">' . translate('Template Author', sz_config('language')) . ': </span><span id="authorname">' . self::get_author($t) . '</span></td>';
         }
         if (($i + 1) % 5 == 0) {
             $list .= '<tr></tr>';
         }
     }
     $list .= '</tr>';
     if ($action == 'select') {
         $list .= '<tr><td colspan="5"><span class="button-wrapper">';
         $list .= '<span class="button-l"> </span>';
         $list .= '<span class="button-r"> </span>';
         $list .= '<input class="button" type="submit" value="' . translate('Save', sz_config('language')) . '">';
         $list .= '</span> ' . help_icon('Save the selected template. You can select the template that you want to use by clicking on the radio button below \'Select Template\' of the desired template. To get a bigger preview of the template click on the template image.', sz_config('language'));
         $list .= link_button('settings.php?website=' . $website_id, translate('Next Step', sz_config('language'))) . ' ' . help_icon(translate('Go to the next step. Do not forget to save your template selection with the save button first. You can also go to any editing step in the Website Menu at the top of this window.', sz_config('language')));
         $list .= '</form></td></tr>';
     }
     $list .= '<tr><td colspan="5" id="pagnat">' . help_icon(translate('Select the next page number to view more templates.', sz_config('language'))) . ' ';
     $prev = $start_record - $templates_per_page;
     if ($prev < 0) {
         $prev = $start_record;
     }
     if ($action == 'select') {
         $list .= '<a href="template.php?website=' . $website_id . '&tview=0">' . icon('first', '22px') . '</a> ';
         $list .= '<a href="template.php?website=' . $website_id . '&tview=' . $prev . '">' . icon('previous', '22px') . '</a> ';
     } else {
         $list .= '<a href="index.php?templates&tview=0">' . icon('first', '22px') . '</a> ';
         $list .= '<a href="index.php?templates&tview=' . $prev . '">' . icon('previous', '22px') . '</a> ';
     }
     $x = 0;
     $y = 1;
     while ($x < $totaltemplates) {
         if ($x == $start_record) {
             $navclass = 'id="pactive"';
             $ncls = true;
         } else {
             $navclass = '';
             $ncls = false;
         }
         if ($action == 'select') {
             $list .= ' <span ' . $navclass . '><a href="template.php?website=' . $website_id . '&tview=' . $x . '">' . icon($y, '22px', $ncls) . '</a>' . icon('space', '22px') . '</span> ';
         } else {
             $list .= ' <span ' . $navclass . '><a href="index.php?templates&tview=' . $x . '">' . icon($y, '22px', $ncls) . '</a>' . icon('space', '22px') . '</span> ';
         }
         $x = $x + $templates_per_page;
         $y++;
     }
     $lastpage = $x - $templates_per_page;
     $next = $start_record + $templates_per_page;
     if ($next > $lastpage) {
         $next = $lastpage;
     }
     if ($action == 'select') {
         $list .= '<a href="template.php?website=' . $website_id . '&tview=' . $next . '">' . icon('next', '22px') . '</a> ';
         $list .= '<a href="template.php?website=' . $website_id . '&tview=' . $lastpage . '">' . icon('last', '22px') . '</a>';
     } else {
         $list .= '<a href="index.php?templates&tview=' . $next . '">' . icon('next', '22px') . '</a> ';
         $list .= ' <a href="index.php?templates&tview=' . $lastpage . '">' . icon('last', '22px') . '</a>';
     }
     $list .= '</td><tr></table>';
     echo $list;
 }
Ejemplo n.º 3
0
function icon($action, $size = NULL, $alt = false)
{
    $img_folder = sz_config('url') . 'themes' . DS . sz_config('theme') . DS . 'images' . DS;
    if ($size == NULL) {
        $size = '16px';
    }
    if (is_numeric($action)) {
        settype($action, "string");
        $icon = '';
        if ($alt == true) {
            for ($i = 0; $i < strlen($action); $i++) {
                $imgnum = substr($action, $i, 1);
                if ($i == 0) {
                    $options = 'alt="' . nice_name($action) . '" title="' . nice_name($action) . '"';
                } else {
                    $options = '';
                }
                $icon .= '<img src="' . $img_folder . $imgnum . '_alt.png" height="' . $size . '" ' . $options . '>';
            }
        } else {
            for ($i = 0; $i < strlen($action); $i++) {
                $imgnum = substr($action, $i, 1);
                if ($i == 0) {
                    $options = 'alt="' . nice_name($action) . '" title="' . nice_name($action) . '"';
                } else {
                    $options = '';
                }
                $icon .= '<img src="' . $img_folder . $imgnum . '.png" height="' . $size . '" ' . $options . '>';
            }
        }
        return $icon;
    } else {
        switch ($action) {
            case 'space':
                $icon = '<img src="' . $img_folder . 'space.png" height="' . $size . '" alt="&nbsp;">';
                return $icon;
                break;
            case '.':
                $icon = '<img src="' . $img_folder . 'point.png" height="' . $size . '"">';
                return $icon;
                break;
            case 'down':
                $icon = '<img src="' . $img_folder . 'down.png" height="' . $size . '" width="' . $size . '" alt="' . translate('Down', sz_config('language')) . '" title="' . translate('Down', sz_config('language')) . '">';
                return $icon;
                break;
            case 'up':
                $icon = '<img src="' . $img_folder . 'up.png" height="' . $size . '" width="' . $size . '" alt="' . translate('Up', sz_config('language')) . '" title="' . translate('Up', sz_config('language')) . '">';
                return $icon;
                break;
            case 'first':
                $icon = '<img src="' . $img_folder . 'first.png" height="' . $size . '" width="' . $size . '" alt="[' . translate('First', sz_config('language')) . ']" title="' . translate('First', sz_config('language')) . '">';
                return $icon;
                break;
            case 'last':
                $icon = '<img src="' . $img_folder . 'last.png" height="' . $size . '" width="' . $size . '" alt="[' . translate('Last', sz_config('language')) . ']" title="' . translate('Last', sz_config('language')) . '">';
                return $icon;
                break;
            case 'previous':
                $icon = '<img src="' . $img_folder . 'previous.png" height="' . $size . '" width="' . $size . '" alt="[' . translate('Previous', sz_config('language')) . ']" title="' . translate('Previous', sz_config('language')) . '">';
                return $icon;
                break;
            case 'next':
                $icon = '<img src="' . $img_folder . 'next.png" height="' . $size . '" width="' . $size . '" alt="[' . translate('Next', sz_config('language')) . ']" title="' . translate('Next', sz_config('language')) . '">';
                return $icon;
                break;
            case 'left':
                $icon = '<img src="' . $img_folder . 'left.png" height="' . $size . '" width="' . $size . '" alt="' . translate('Left', sz_config('language')) . '" title="' . translate('Left', sz_config('language')) . '">';
                return $icon;
                break;
            case 'right':
                $icon = '<img src="' . $img_folder . 'right.png" height="' . $size . '" width="' . $size . '" alt="' . translate('Right', sz_config('language')) . '" title="' . translate('Right', sz_config('language')) . '">';
                return $icon;
                break;
            default:
                $icon = '<img src="' . $img_folder . '' . $action . '.png" height="' . $size . '" alt="' . nice_name($action) . '" title="' . nice_name($action) . '">';
                return $icon;
        }
    }
}