本文整理汇总了PHP中company_path函数的典型用法代码示例。如果您正苦于以下问题:PHP company_path函数的具体用法?PHP company_path怎么用?PHP company_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了company_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_language
function set_language($code)
{
global $path_to_root, $installed_languages, $GetText;
$lang = array_search_value($code, $installed_languages, 'code');
$changed = $this->code != $code || $this->version != @$lang['version'];
if ($lang && $changed) {
// flush cache as we can use several languages in one account
flush_dir(company_path() . '/js_cache');
$this->name = $lang['name'];
$this->code = $lang['code'];
$this->encoding = $lang['encoding'];
$this->version = @$lang['version'];
$this->dir = isset($lang['rtl']) && $lang['rtl'] === true ? 'rtl' : 'ltr';
$locale = $path_to_root . "/lang/" . $this->code . "/locale.inc";
$this->is_locale_file = file_exists($locale);
}
$GetText->set_language($this->code, $this->encoding);
$GetText->add_domain($this->code, $path_to_root . "/lang", $this->version);
// Necessary for ajax calls. Due to bug in php 4.3.10 for this
// version set globally in php.ini
ini_set('default_charset', $this->encoding);
if (isset($_SESSION['App']) && $changed) {
$_SESSION['App']->init();
}
// refresh menu
}
示例2: get_reports
function get_reports()
{
global $path_to_root, $go_debug;
if ($go_debug || !isset($_SESSION['reports'])) {
// to save time, store in session.
$paths = array($path_to_root . '/reporting/', company_path() . '/reporting/');
$reports = array('' => _('Default printing destination'));
foreach ($paths as $dirno => $path) {
$repdir = opendir($path);
while (false !== ($fname = readdir($repdir))) {
// reports have filenames in form rep(repid).php
// where repid must contain at least one digit (reports_main.php is not ;)
if (is_file($path . $fname) && preg_match('/rep(.*[0-9]+.*)[.]php/', $fname, $match)) {
$repno = $match[1];
$title = '';
$line = file_get_contents($path . $fname);
if (preg_match('/.*(FrontReport\\()\\s*_\\([\'"]([^\'"]*)/', $line, $match)) {
$title = trim($match[2]);
} else {
// for any 3rd party printouts without FrontReport() class use
if (preg_match('/.*(\\$Title).*[\'"](.*)[\'"].+/', $line, $match)) {
$title = trim($match[2]);
}
}
$reports[$repno] = $title;
}
}
closedir();
}
ksort($reports);
$_SESSION['reports'] = $reports;
}
return $_SESSION['reports'];
}
示例3: render
function render($id, $title)
{
global $path_to_root;
include_once $path_to_root . "/includes/ui.inc";
include_once $path_to_root . "/reporting/includes/class.graphic.inc";
if (!defined('FLOAT_COMP_DELTA')) {
define('FLOAT_COMP_DELTA', 0.004);
}
if (!isset($this->top)) {
$this->top = 10;
}
$begin = begin_fiscalyear();
$today = Today();
$begin1 = date2sql($begin);
$today1 = date2sql($today);
$sql = "SELECT SUM((trans.ov_amount + trans.ov_discount) * rate) AS total, s.supplier_id, s.supp_name FROM\n " . TB_PREF . "supp_trans AS trans, " . TB_PREF . "suppliers AS s WHERE trans.supplier_id=s.supplier_id\n AND (trans.type = " . ST_SUPPINVOICE . " OR trans.type = " . ST_SUPPCREDIT . ")\n AND tran_date >= '{$begin1}' AND tran_date <= '{$today1}' ";
if ($this->data_filter != '') {
$sql .= ' AND ' . $this->data_filter;
}
$sql .= "GROUP by s.supplier_id ORDER BY total DESC, s.supplier_id " . " LIMIT " . $this->top;
$result = db_query($sql);
if ($this->graph_type == 'Table') {
$th = array(_("Supplier"), _("Amount"));
start_table(TABLESTYLE, "width=98%");
table_header($th);
$k = 0;
//row colour counter
while ($myrow = db_fetch($result)) {
alt_table_row_color($k);
$name = $myrow["supplier_id"] . " " . $myrow["supp_name"];
label_cell($name);
amount_cell($myrow['total']);
end_row();
}
end_table(1);
} else {
$pg = new graph();
$i = 0;
while ($myrow = db_fetch($result)) {
$name = $myrow["supplier_id"] . " " . $myrow["supp_name"];
$pg->x[$i] = $name;
$pg->y[$i] = $myrow['total'];
$i++;
}
$pg->title = $title;
$pg->axis_x = _("Supplier");
$pg->axis_y = _("Amount");
$pg->graphic_1 = $today;
$pg->type = 2;
$pg->skin = 1;
$pg->built_in = false;
$filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
$pg->display($filename, true);
echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
}
}
示例4: render
function render($id, $title)
{
global $path_to_root;
include_once $path_to_root . "/reporting/includes/class.graphic.inc";
if (!defined('FLOAT_COMP_DELTA')) {
define('FLOAT_COMP_DELTA', 0.004);
}
if (!isset($this->top)) {
$this->top = 10;
}
$begin = begin_fiscalyear();
$today = Today();
$begin1 = date2sql($begin);
$today1 = date2sql($today);
$sql = "SELECT SUM((ov_amount + ov_discount) * rate * IF(trans.type = " . ST_CUSTCREDIT . ", -1, 1)) AS total,d.debtor_no, d.name" . " FROM " . TB_PREF . "debtor_trans AS trans, " . TB_PREF . "debtors_master AS d" . " WHERE trans.debtor_no=d.debtor_no" . " AND (trans.type = " . ST_SALESINVOICE . " OR trans.type = " . ST_CUSTCREDIT . ")" . " AND tran_date >= '{$begin1}' AND tran_date <= '{$today1}'";
if ($this->data_filter != '') {
$sql .= ' AND ' . $this->data_filter;
}
$sql .= " GROUP by d.debtor_no ORDER BY total DESC, d.debtor_no " . " LIMIT " . $this->top;
$result = db_query($sql);
if ($this->graph_type == 'Table') {
$th = array(null, _("Customer"), _("Amount"));
start_table(TABLESTYLE, "width=98%");
table_header($th);
$k = 0;
//row colour counter
$i = 0;
while ($myrow = db_fetch($result)) {
alt_table_row_color($k);
label_cell(viewer_link($myrow["debtor_no"], 'sales/inquiry/customer_inquiry.php?customer_id=' . $myrow["debtor_no"]));
label_cell(viewer_link($myrow["name"], 'sales/inquiry/customer_inquiry.php?customer_id=' . $myrow["debtor_no"]));
amount_cell($myrow['total']);
end_row();
}
end_table(1);
} else {
$pg = new graph();
$i = 0;
while ($myrow = db_fetch($result)) {
$pg->x[$i] = $myrow["debtor_no"] . " " . $myrow["name"];
$pg->y[$i] = $myrow['total'];
$i++;
}
$pg->title = $title;
$pg->axis_x = _("Customer");
$pg->axis_y = _("Amount");
$pg->graphic_1 = $today;
$pg->type = 2;
$pg->skin = 1;
$pg->built_in = false;
$filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
$pg->display($filename, true);
echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
}
}
示例5: render
function render($id, $title)
{
global $path_to_root;
include_once $path_to_root . "/reporting/includes/class.graphic.inc";
$begin = begin_fiscalyear();
$today = Today();
$begin1 = date2sql($begin);
$today1 = date2sql($today);
$sql = "SELECT SUM(amount) AS total, c.class_name, c.ctype FROM\n " . TB_PREF . "gl_trans," . TB_PREF . "chart_master AS a, " . TB_PREF . "chart_types AS t,\n " . TB_PREF . "chart_class AS c WHERE\n account = a.account_code AND a.account_type = t.id AND t.class_id = c.cid\n AND IF(c.ctype > 3, tran_date >= '{$begin1}', tran_date >= '0000-00-00')\n AND tran_date <= '{$today1}' ";
if ($this->data_filter != '') {
$sql .= ' AND ' . $this->data_filter;
}
$sql .= " GROUP BY c.cid ORDER BY c.cid";
$result = db_query($sql, "Transactions could not be calculated");
$calculated = _("Calculated Return");
if ($this->graph_type == 'Table') {
start_table(TABLESTYLE2, "width=98%");
$total = 0;
while ($myrow = db_fetch($result)) {
if ($myrow['ctype'] > 3) {
$total += $myrow['total'];
$myrow['total'] = -$myrow['total'];
}
label_row($myrow['class_name'], number_format2($myrow['total'], user_price_dec()), "class='label' style='font-weight:bold;'", "style='font-weight:bold;' align=right");
}
label_row(" ", "");
label_row($calculated, number_format2(-$total, user_price_dec()), "class='label' style='font-weight:bold;'", "style='font-weight:bold;' align=right");
end_table(1);
} else {
$pg = new graph();
$i = 0;
$total = 0;
while ($myrow = db_fetch($result)) {
if ($myrow['ctype'] > 3) {
$total += $myrow['total'];
$myrow['total'] = -$myrow['total'];
$pg->x[$i] = $myrow['class_name'];
$pg->y[$i] = abs($myrow['total']);
$i++;
}
}
$pg->x[$i] = $calculated;
$pg->y[$i] = -$total;
$pg->title = $title;
$pg->axis_x = _("Class");
$pg->axis_y = _("Amount");
$pg->graphic_1 = $today;
$pg->type = 5;
$pg->skin = 1;
$pg->built_in = false;
$filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
$pg->display($filename, true);
echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
}
}
示例6: render
function render($id, $title)
{
global $path_to_root;
if (!isset($this->top)) {
$this->top = 10;
}
global $path_to_root;
$pg = new graph();
$begin = begin_fiscalyear();
$today = Today();
$begin1 = date2sql($begin);
$today1 = date2sql($today);
$sql = "SELECT SUM(-t.amount) AS total, d.reference, d.name FROM\n " . TB_PREF . "gl_trans AS t," . TB_PREF . "dimensions AS d WHERE\n (t.dimension_id = d.id OR t.dimension2_id = d.id) AND\n t.tran_date >= '{$begin1}' AND t.tran_date <= '{$today1}' ";
if ($this->data_filter != '') {
$sql .= ' AND ' . $this->data_filter;
}
$sql .= "GROUP BY d.id ORDER BY total DESC LIMIT " . $this->top;
$result = db_query($sql, "Transactions could not be calculated");
if ($this->graph_type == 'Table') {
$title = _("Top 10 Dimensions in fiscal year");
br(2);
display_heading($title);
br();
$th = array(_("Dimension"), _("Amount"));
start_table(TABLESTYLE, "width=98%");
table_header($th);
$k = 0;
//row colour counter
while ($myrow = db_fetch($result)) {
alt_table_row_color($k);
label_cell($myrow['reference'] . " " . $myrow["name"]);
amount_cell($myrow['total']);
end_row();
}
end_table(2);
} else {
$pg = new graph();
$i = 0;
while ($myrow = db_fetch($result)) {
$pg->x[$i] = $myrow['reference'] . " " . $myrow["name"];
$pg->y[$i] = abs($myrow['total']);
$i++;
}
$pg->title = $title;
$pg->axis_x = _("Dimension");
$pg->axis_y = _("Amount");
$pg->graphic_1 = $today;
$pg->type = 5;
$pg->skin = 1;
$pg->built_in = false;
$filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
$pg->display($filename, true);
echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
}
}
示例7: handle_delete
function handle_delete()
{
global $def_coy, $db_connections, $comp_subdirs, $path_to_root;
$id = (int) $_GET['id'];
// First make sure all company directories from the one under removal are writable.
// Without this after operation we end up with changed per-company owners!
for ($i = $id; $i < count($db_connections); $i++) {
$comp_path = company_path($i);
if (!is_dir($comp_path) || !is_writable($comp_path)) {
display_error(_('Broken company subdirectories system. You have to remove this company manually.'));
return;
}
}
// make sure config file is writable
if (!is_writeable($path_to_root . "/config_db.php")) {
display_error(_("The configuration file ") . $path_to_root . "/config_db.php" . _(" is not writable. Change its permissions so it is, then re-run the operation."));
return;
}
// rename directory to temporary name to ensure all
// other subdirectories will have right owners even after
// unsuccessfull removal.
$cdir = company_path($id);
$tmpname = company_path('/old_' . $id);
if (!@rename($cdir, $tmpname)) {
display_error(_('Cannot rename subdirectory to temporary name.'));
return;
}
// 'shift' company directories names
for ($i = $id + 1; $i < count($db_connections); $i++) {
if (!rename(company_path($i), company_path($i - 1))) {
display_error(_("Cannot rename company subdirectory"));
return;
}
}
$err = remove_connection($id);
if ($err == 0) {
display_error(_("Error removing Database: ") . $dbase . _(", please remove it manually"));
}
if ($def_coy == $id) {
$def_coy = 0;
}
$error = write_config_db();
if ($error == -1) {
display_error(_("Cannot open the configuration file - ") . $path_to_root . "/config_db.php");
} else {
if ($error == -2) {
display_error(_("Cannot write to the configuration file - ") . $path_to_root . "/config_db.php");
} else {
if ($error == -3) {
display_error(_("The configuration file ") . $path_to_root . "/config_db.php" . _(" is not writable. Change its permissions so it is, then re-run the operation."));
}
}
}
if ($error != 0) {
@rename($tmpname, $cdir);
return;
}
// finally remove renamed company directory
@flush_dir($tmpname, true);
if (!@rmdir($tmpname)) {
display_error(_("Cannot remove temporary renamed company data directory ") . $tmpname);
return;
}
display_notification(_("Selected company has been deleted"));
}
示例8: display_error
if (!is_numeric($_POST['query_size']) || $_POST['query_size'] < 1) {
display_error($_POST['query_size']);
display_error(_("Query size must be integer and greater than zero."));
set_focus('query_size');
} else {
$_POST['theme'] = clean_file_name($_POST['theme']);
$chg_theme = user_theme() != $_POST['theme'];
$chg_lang = $_SESSION['language']->code != $_POST['language'];
$chg_date_format = user_date_format() != $_POST['date_format'];
$chg_date_sep = user_date_sep() != $_POST['date_sep'];
set_user_prefs(get_post(array('prices_dec', 'qty_dec', 'rates_dec', 'percent_dec', 'date_format', 'date_sep', 'tho_sep', 'dec_sep', 'print_profile', 'theme', 'page_size', 'language', 'startup_tab', 'show_gl' => 0, 'show_codes' => 0, 'show_hints' => 0, 'rep_popup' => 0, 'graphic_links' => 0, 'sticky_doc_date' => 0, 'query_size' => 10.0)));
if ($chg_lang) {
$_SESSION['language']->set_language($_POST['language']);
}
// refresh main menu
flush_dir(company_path() . '/js_cache');
if ($chg_theme && $allow_demo_mode) {
$_SESSION["wa_current_user"]->prefs->theme = $_POST['theme'];
}
if ($chg_theme || $chg_lang || $chg_date_format || $chg_date_sep) {
meta_forward($_SERVER['PHP_SELF']);
}
if ($allow_demo_mode) {
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);
示例9: move_uploaded_file
move_uploaded_file($tmpname, $dir . "/" . $unique_name);
if ($Mode == 'ADD_ITEM') {
add_attachment($_POST['filterType'], $_POST['trans_no'], $_POST['description'], $filename, $unique_name, $filesize, $filetype);
display_notification(_("Attachment has been inserted."));
} else {
update_attachment($selected_id, $_POST['filterType'], $_POST['trans_no'], $_POST['description'], $filename, $unique_name, $filesize, $filetype);
display_notification(_("Attachment has been updated."));
}
}
refresh_pager('trans_tbl');
$Ajax->activate('_page_body');
$Mode = 'RESET';
}
if ($Mode == 'Delete') {
$row = get_attachment($selected_id);
$dir = company_path() . "/attachments";
if (file_exists($dir . "/" . $row['unique_name'])) {
unlink($dir . "/" . $row['unique_name']);
}
delete_attachment($selected_id);
display_notification(_("Attachment has been deleted."));
$Mode = 'RESET';
}
if ($Mode == 'RESET') {
unset($_POST['trans_no']);
unset($_POST['description']);
$selected_id = -1;
}
function viewing_controls()
{
global $selected_id;
示例10: display_applications
function display_applications(&$waapp)
{
global $path_to_root, $use_popup_windows;
include_once "{$path_to_root}/includes/ui.inc";
include_once $path_to_root . "/reporting/includes/class.graphic.inc";
$selected_app = $waapp->get_selected_application();
if (!$_SESSION["wa_current_user"]->check_application_access($selected_app)) {
return;
}
if (method_exists($selected_app, 'render_index')) {
$selected_app->render_index();
return;
}
// first have a look through the directory,
// and remove old temporary pdfs and pngs
$dir = company_path() . '/pdf_files';
if ($d = @opendir($dir)) {
while (($file = readdir($d)) !== false) {
if (!is_file($dir . '/' . $file) || $file == 'index.php') {
continue;
}
// then check to see if this one is too old
$ftime = filemtime($dir . '/' . $file);
// seems 3 min is enough for any report download, isn't it?
if (time() - $ftime > 180) {
unlink($dir . '/' . $file);
}
}
closedir($d);
}
//if ($selected_app->id == 'system') {
// include($path_to_root . "/includes/system_tests.inc");
// $title = "Display System Diagnostics";
// br(2);
// display_heading($title);
// br();
// display_system_tests();
// return;
//}
$dashboard_app = $waapp->get_application("Dashboard");
echo '<div id="console" ></div>';
$userid = $_SESSION["wa_current_user"]->user;
$sql = "SELECT DISTINCT column_id FROM " . TB_PREF . "dashboard_widgets" . " WHERE user_id =" . db_escape($userid) . " AND app=" . db_escape($selected_app->id) . " ORDER BY column_id";
$columns = db_query($sql);
while ($column = db_fetch($columns)) {
echo '<div class="column" id="column' . $column['column_id'] . '" >';
$sql = "SELECT * FROM " . TB_PREF . "dashboard_widgets" . " WHERE column_id=" . db_escape($column['column_id']) . " AND user_id = " . db_escape($userid) . " AND app=" . db_escape($selected_app->id) . " ORDER BY sort_no";
$items = db_query($sql);
while ($item = db_fetch($items)) {
$widgetData = $dashboard_app->get_widget($item['widget']);
echo '
<div class="dragbox" id="item' . $item['id'] . '">
<h2>' . $item['description'] . '</h2>
<div id="widget_div_' . $item['id'] . '" class="dragbox-content" ';
if ($item['collapsed'] == 1) {
echo 'style="display:none;" ';
}
echo '>';
if ($widgetData != null) {
if ($_SESSION["wa_current_user"]->can_access_page($widgetData->access)) {
include_once $path_to_root . $widgetData->path;
$className = $widgetData->name;
$widgetObject = new $className($item['param']);
$widgetObject->render($item['id'], $item['description']);
} else {
echo "<center><br><br><br><b>";
echo _("The security settings on your account do not permit you to access this function");
echo "</b>";
echo "<br><br><br><br></center>";
}
}
echo '</div></div>';
}
echo '</div>';
}
}
示例11: display_applications
function display_applications(&$waapp)
{
global $path_to_root, $use_popup_windows;
include_once "{$path_to_root}/includes/ui.inc";
include_once $path_to_root . "/reporting/includes/class.graphic.inc";
include $path_to_root . "/includes/system_tests.inc";
if ($use_popup_windows) {
echo "<script language='javascript'>\n";
echo get_js_open_window(900, 500);
echo "</script>\n";
}
$selected_app = $waapp->get_selected_application();
// first have a look through the directory,
// and remove old temporary pdfs and pngs
$dir = company_path() . '/pdf_files';
if ($d = @opendir($dir)) {
while (($file = readdir($d)) !== false) {
if (!is_file($dir . '/' . $file) || $file == 'index.php') {
continue;
}
// then check to see if this one is too old
$ftime = filemtime($dir . '/' . $file);
// seems 3 min is enough for any report download, isn't it?
if (time() - $ftime > 180) {
unlink($dir . '/' . $file);
}
}
closedir($d);
}
if ($selected_app->id == "orders") {
display_customer_topten();
} elseif ($selected_app->id == "AP") {
display_supplier_topten();
} elseif ($selected_app->id == "stock") {
display_stock_topten();
} elseif ($selected_app->id == "manuf") {
display_stock_topten(true);
} elseif ($selected_app->id == "proj") {
display_dimension_topten();
} elseif ($selected_app->id == "GL") {
display_gl_info();
} else {
$title = "Display System Diagnostics";
br(2);
display_heading($title);
br();
display_system_tests();
}
}
示例12: print_aged_supplier_analysis
//.........这里部分代码省略.........
$sql .= " ORDER BY supp_name";
$result = db_query($sql, "The suppliers could not be retrieved");
while ($myrow = db_fetch($result)) {
if (!$convert && $currency != $myrow['curr_code']) {
continue;
}
if ($convert) {
$rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $to);
} else {
$rate = 1.0;
}
$supprec = get_supplier_details($myrow['supplier_id'], $to, $show_all);
if (!$supprec) {
continue;
}
$supprec['Balance'] *= $rate;
$supprec['Due'] *= $rate;
$supprec['Overdue1'] *= $rate;
$supprec['Overdue2'] *= $rate;
$str = array($supprec["Balance"] - $supprec["Due"], $supprec["Due"] - $supprec["Overdue1"], $supprec["Overdue1"] - $supprec["Overdue2"], $supprec["Overdue2"], $supprec["Balance"]);
if ($no_zeros && floatcmp(array_sum($str), 0) == 0) {
continue;
}
$rep->fontSize += 2;
$rep->TextCol(0, 2, $myrow['name']);
if ($convert) {
$rep->TextCol(2, 3, $myrow['curr_code']);
}
$rep->fontSize -= 2;
$total[0] += $supprec["Balance"] - $supprec["Due"];
$total[1] += $supprec["Due"] - $supprec["Overdue1"];
$total[2] += $supprec["Overdue1"] - $supprec["Overdue2"];
$total[3] += $supprec["Overdue2"];
$total[4] += $supprec["Balance"];
for ($i = 0; $i < count($str); $i++) {
$rep->AmountCol($i + 3, $i + 4, $str[$i], $dec);
}
$rep->NewLine(1, 2);
if (!$summaryOnly) {
$res = get_invoices($myrow['supplier_id'], $to, $show_all);
if (db_num_rows($res) == 0) {
continue;
}
$rep->Line($rep->row + 4);
while ($trans = db_fetch($res)) {
$rep->NewLine(1, 2);
$rep->TextCol(0, 1, $systypes_array[$trans['type']], -2);
$rep->TextCol(1, 2, $trans['reference'], -2);
$rep->TextCol(2, 3, sql2date($trans['tran_date']), -2);
foreach ($trans as $i => $value) {
$trans[$i] *= $rate;
}
$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->AmountCol($i + 3, $i + 4, $str[$i], $dec);
}
}
$rep->Line($rep->row - 8);
$rep->NewLine(2);
}
}
if ($summaryOnly) {
$rep->Line($rep->row + 4);
$rep->NewLine();
}
$rep->fontSize += 2;
$rep->TextCol(0, 3, _('Grand Total'));
$rep->fontSize -= 2;
for ($i = 0; $i < count($total); $i++) {
$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;
$pg->x = array(_('Current'), $nowdue, $pastdue1, $pastdue2);
$pg->title = $rep->title;
$pg->axis_x = _("Days");
$pg->axis_y = _("Amount");
$pg->graphic_1 = $to;
$pg->type = $graphics;
$pg->skin = $graph_skin;
$pg->built_in = false;
$pg->latin_notation = $decseps[$_SESSION["wa_current_user"]->prefs->dec_sep()] != ".";
$filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
$pg->display($filename, true);
$w = $pg->width / 1.5;
$h = $pg->height / 1.5;
$x = ($rep->pageWidth - $w) / 2;
$rep->NewLine(2);
if ($rep->row - $h < $rep->bottomMargin) {
$rep->NewPage();
}
$rep->AddImage($filename, $x, $rep->row - $h, $w, $h);
}
$rep->End();
}
示例13: render
function render($id, $title)
{
global $path_to_root;
if (!isset($this->top)) {
$this->top = 10;
}
$begin = begin_fiscalyear();
$today = Today();
$begin1 = date2sql($begin);
$today1 = date2sql($today);
$sql = "SELECT SUM((trans.unit_price * trans.quantity) * d.rate) AS total, s.stock_id, s.description,\n SUM(trans.quantity) AS qty FROM\n " . TB_PREF . "debtor_trans_details AS trans, " . TB_PREF . "stock_master AS s, " . TB_PREF . "debtor_trans AS d\n WHERE trans.stock_id=s.stock_id AND trans.debtor_trans_type=d.type AND trans.debtor_trans_no=d.trans_no\n AND (d.type = " . ST_SALESINVOICE . " OR d.type = " . ST_CUSTCREDIT . ") ";
if ($this->item_type == 'manuf') {
$sql .= "AND s.mb_flag='M' ";
}
if ($this->data_filter != '') {
$sql .= ' AND ' . $this->data_filter;
}
$sql .= "AND d.tran_date >= '{$begin1}' AND d.tran_date <= '{$today1}' GROUP by s.stock_id ORDER BY total DESC, s.stock_id " . " LIMIT " . $this->top;
$result = db_query($sql);
if ($this->graph_type == 'Table') {
if ($this->item_type == 'manuf') {
$title = _("Top 10 Manufactured Items in fiscal year");
} else {
$title = _("Top 10 Sold Items in fiscal year");
}
display_heading($title);
br();
$th = array(_("Item"), _("Amount"), _("Quantity"));
start_table(TABLESTYLE, "width=98%");
table_header($th);
$k = 0;
//row colour counter
while ($myrow = db_fetch($result)) {
alt_table_row_color($k);
$name = $myrow["description"];
label_cell($name);
amount_cell($myrow['total']);
qty_cell($myrow['qty']);
end_row();
}
end_table(1);
} else {
$pg = new graph();
$i = 0;
while ($myrow = db_fetch($result)) {
$pg->x[$i] = $myrow["description"];
$pg->y[$i] = $myrow['total'];
$i++;
}
$pg->title = $title;
$pg->axis_x = _("Item");
$pg->axis_y = _("Amount");
$pg->graphic_1 = $today;
$pg->type = 2;
$pg->skin = 1;
$pg->built_in = false;
$filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
$pg->display($filename, true);
echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
}
}
示例14: print_price_listing
function print_price_listing()
{
global $path_to_root, $pic_height, $pic_width;
$currency = $_POST['PARAM_0'];
$category = $_POST['PARAM_1'];
$salestype = $_POST['PARAM_2'];
$pictures = $_POST['PARAM_3'];
$showGP = $_POST['PARAM_4'];
$comments = $_POST['PARAM_5'];
$orientation = $_POST['PARAM_6'];
$destination = $_POST['PARAM_7'];
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();
$home_curr = get_company_pref('curr_default');
if ($currency == ALL_TEXT) {
$currency = $home_curr;
}
$curr = get_currency($currency);
$curr_sel = $currency . " - " . $curr['currency'];
if ($category == ALL_NUMERIC) {
$category = 0;
}
if ($salestype == ALL_NUMERIC) {
$salestype = 0;
}
if ($category == 0) {
$cat = _('All');
} else {
$cat = get_category_name($category);
}
if ($salestype == 0) {
$stype = _('All');
} else {
$stype = get_sales_type_name($salestype);
}
if ($showGP == 0) {
$GP = _('No');
} else {
$GP = _('Yes');
}
$cols = array(0, 100, 360, 385, 450, 515);
$headers = array(_('Category/Items'), _('Description'), _('UOM'), _('Price'), _('GP %'));
$aligns = array('left', 'left', 'left', 'right', 'right');
$params = array(0 => $comments, 1 => array('text' => _('Currency'), 'from' => $curr_sel, 'to' => ''), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 3 => array('text' => _('Sales Type'), 'from' => $stype, 'to' => ''), 4 => array('text' => _('Show GP %'), 'from' => $GP, 'to' => ''));
if ($pictures) {
$user_comp = user_company();
} else {
$user_comp = "";
}
$rep = new FrontReport(_('Price Listing'), "PriceListing", user_pagesize(), 9, $orientation);
if ($orientation == 'L') {
recalculate_cols($cols);
}
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
$rep->NewPage();
$result = fetch_items($category);
$catgor = '';
$_POST['sales_type_id'] = $salestype;
while ($myrow = db_fetch($result)) {
if ($catgor != $myrow['description']) {
$rep->Line($rep->row - $rep->lineHeight);
$rep->NewLine(2);
$rep->fontSize += 2;
$rep->TextCol(0, 3, $myrow['category_id'] . " - " . $myrow['description']);
$catgor = $myrow['description'];
$rep->fontSize -= 2;
$rep->NewLine();
}
$rep->NewLine();
$rep->TextCol(0, 1, $myrow['stock_id']);
$rep->TextCol(1, 2, $myrow['name']);
$rep->TextCol(2, 3, $myrow['units']);
$price = get_price($myrow['stock_id'], $currency, $salestype);
$rep->AmountCol(3, 4, $price, $dec);
if ($showGP) {
$price2 = get_price($myrow['stock_id'], $home_curr, $salestype);
if ($price2 != 0.0) {
$disp = ($price2 - $myrow['Standardcost']) * 100 / $price2;
} else {
$disp = 0.0;
}
$rep->TextCol(4, 5, number_format2($disp, user_percent_dec()) . " %");
}
if ($pictures) {
$image = company_path() . "/images/" . item_img_name($myrow['stock_id']) . ".jpg";
if (file_exists($image)) {
$rep->NewLine();
if ($rep->row - $pic_height < $rep->bottomMargin) {
$rep->NewPage();
}
$rep->AddImage($image, $rep->cols[1], $rep->row - $pic_height, 0, $pic_height);
$rep->row -= $pic_height;
$rep->NewLine();
}
//.........这里部分代码省略.........
示例15: print_sales_quotations
function print_sales_quotations()
{
global $path_to_root, $print_as_quote, $print_invoice_no, $no_zero_lines_amount, $print_item_images_on_quote, $pic_height;
include_once $path_to_root . "/reporting/includes/pdf_report.inc";
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
$currency = $_POST['PARAM_2'];
$email = $_POST['PARAM_3'];
$comments = $_POST['PARAM_4'];
$orientation = $_POST['PARAM_5'];
if (!$from || !$to) {
return;
}
$orientation = $orientation ? 'L' : 'P';
$dec = user_price_dec();
$pictures = isset($print_item_images_on_quote) && $print_item_images_on_quote == 1;
// If you want a larger image, then increase $pic_height f.i.
// $pic_height += 25;
$cols = array(4, 60, 225, 300, 325, 385, 450, 515);
// $headers in doctext.inc
$aligns = array('left', 'left', 'right', 'left', 'right', 'right', 'right');
$params = array('comments' => $comments);
$cur = get_company_Pref('curr_default');
if ($email == 0) {
$rep = new FrontReport(_("SALES QUOTATION"), "SalesQuotationBulk", user_pagesize(), 9, $orientation);
}
if ($orientation == 'L') {
recalculate_cols($cols);
}
for ($i = $from; $i <= $to; $i++) {
$myrow = get_sales_order_header($i, ST_SALESQUOTE);
$baccount = get_default_bank_account($myrow['curr_code']);
$params['bankaccount'] = $baccount['id'];
$branch = get_branch($myrow["branch_code"]);
if ($email == 1) {
$rep = new FrontReport("", "", user_pagesize(), 9, $orientation);
if ($print_invoice_no == 1) {
$rep->filename = "SalesQuotation" . $i . ".pdf";
} else {
$rep->filename = "SalesQuotation" . $myrow['reference'] . ".pdf";
}
}
$rep->SetHeaderType('Header2');
$rep->currency = $cur;
$rep->Font();
$rep->Info($params, $cols, null, $aligns);
$contacts = get_branch_contacts($branch['branch_code'], 'order', $branch['debtor_no'], true);
$rep->SetCommonData($myrow, $branch, $myrow, $baccount, ST_SALESQUOTE, $contacts);
//$rep->headerFunc = 'Header2';
$rep->NewPage();
$result = get_sales_order_details($i, ST_SALESQUOTE);
$SubTotal = 0;
$items = $prices = array();
while ($myrow2 = db_fetch($result)) {
$Net = round2((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"], user_price_dec());
$prices[] = $Net;
$items[] = $myrow2['stk_code'];
$SubTotal += $Net;
$DisplayPrice = number_format2($myrow2["unit_price"], $dec);
$DisplayQty = number_format2($myrow2["quantity"], get_qty_dec($myrow2['stk_code']));
$DisplayNet = number_format2($Net, $dec);
if ($myrow2["discount_percent"] == 0) {
$DisplayDiscount = "";
} else {
$DisplayDiscount = number_format2($myrow2["discount_percent"] * 100, user_percent_dec()) . "%";
}
$rep->TextCol(0, 1, $myrow2['stk_code'], -2);
$oldrow = $rep->row;
$rep->TextColLines(1, 2, $myrow2['description'], -2);
$newrow = $rep->row;
$rep->row = $oldrow;
if ($Net != 0.0 || !is_service($myrow2['mb_flag']) || !isset($no_zero_lines_amount) || $no_zero_lines_amount == 0) {
$rep->TextCol(2, 3, $DisplayQty, -2);
$rep->TextCol(3, 4, $myrow2['units'], -2);
$rep->TextCol(4, 5, $DisplayPrice, -2);
$rep->TextCol(5, 6, $DisplayDiscount, -2);
$rep->TextCol(6, 7, $DisplayNet, -2);
}
$rep->row = $newrow;
if ($pictures) {
$image = company_path() . "/images/" . item_img_name($myrow2['stk_code']) . ".jpg";
if (file_exists($image)) {
//$rep->NewLine();
if ($rep->row - $pic_height < $rep->bottomMargin) {
$rep->NewPage();
}
$rep->AddImage($image, $rep->cols[1], $rep->row - $pic_height, 0, $pic_height);
$rep->row -= $pic_height;
$rep->NewLine();
}
}
//$rep->NewLine(1);
if ($rep->row < $rep->bottomMargin + 15 * $rep->lineHeight) {
$rep->NewPage();
}
}
if ($myrow['comments'] != "") {
$rep->NewLine();
$rep->TextColLines(1, 5, $myrow['comments'], -2);
}
//.........这里部分代码省略.........