MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
-/* Author Rob Mallon */
$page_security = 'SA_RECONCILE';
$path_to_root = "..";
include($path_to_root . "/includes/db_pager.inc");
$_POST['amount'] = 0;
}
}
- $home_currency = get_company_currency();
start_form();
// so we have to restore it from original gl amounts
$ex_rate = $bank_trans['amount']/$row['amount'];
} else {
- $date = $row['tran_date'];
$cart->add_gl_item( $row['account'], $row['dimension_id'],
$row['dimension2_id'], $row['amount'], $row['memo_']);
}
else
display_notification_centered(_("The Budget has been deleted."));
- //meta_forward($_SERVER['PHP_SELF']);
$Ajax->activate('budget_tbl');
}
if (isset($_POST['submit']) || isset($_POST['update']))
dimensions_list_row(_("Dimension")." 1", 'dim1', $_POST['dim1'], true, null, false, 1);
dimensions_list_row(_("Dimension")." 2", 'dim2', $_POST['dim2'], true, null, false, 2);
}
- else if ($dim == 1)
+ elseif ($dim == 1)
{
dimensions_list_row(_("Dimension"), 'dim1', $_POST['dim1'], true, null, false, 1);
hidden('dim2', 0);
//---------------------------------------------------------------------------------------------
function check_data()
{
- global $Refs, $SysPrefs;
+ global $SysPrefs;
if (!is_date($_POST['date']) || date1_greater_date2($_POST['date'], Today()))
{
$k = 0;
while ($myrow = db_fetch($result))
{
-
alt_table_row_color($k);
label_cell($myrow["cid"]);
return false;
}
- //if (strcmp($_POST['id'], $_POST['parent']) == 0)
if ($_POST['id'] === $_POST['parent'])
{
display_error(_("You cannot set an account group to be a subgroup of itself."));
//---------------------------------------------------------------------------------------------
function check_data()
{
- global $Refs;
-
if (!is_date($_POST['date']))
{
display_error( _("The entered date is invalid."));
$first_cols = array(_("Type"), "#", _("Date"));
if ($dim == 2)
$dim_cols = array(_("Dimension")." 1", _("Dimension")." 2");
-else if ($dim == 1)
+elseif ($dim == 1)
$dim_cols = array(_("Dimension"));
else
$dim_cols = array();
if ($dim == 2)
$th = array(_("Account Code"), _("Account Description"), _("Dimension")." 1", _("Dimension")." 2",
_("Amount"), _("Memo"));
- else if ($dim == 1)
+ elseif ($dim == 1)
$th = array(_("Account Code"), _("Account Description"), _("Dimension"),
_("Amount"), _("Memo"));
else
if ($dim == 2)
$th = array(_("Account Code"), _("Account Description"), _("Dimension")." 1", _("Dimension")." 2",
_("Amount"), _("Memo"));
- else if ($dim == 1)
+ elseif ($dim == 1)
$th = array(_("Account Code"), _("Account Description"), _("Dimension"),
_("Amount"), _("Memo"));
else
if ($dim == 2)
$th = array(_("Journal Date"), _("Account Code"), _("Account Name"), _("Dimension")." 1", _("Dimension")." 2",
_("Debit"), _("Credit"), _("Memo"));
-else if ($dim == 1)
+elseif ($dim == 1)
$th = array(_("Journal Date"), _("Account Code"), _("Account Name"), _("Dimension"),
_("Debit"), _("Credit"), _("Memo"));
else
define('SS_GL_A', 63<<8);
$security_sections = array(
- SS_SADMIN => _("System administration"),
- SS_SETUP => _("Company setup"),
- SS_SPEC => _("Special maintenance"),
- SS_SALES_C => _("Sales configuration"),
- SS_SALES => _("Sales transactions"),
- SS_SALES_A => _("Sales related reports"),
- SS_PURCH_C => _("Purchase configuration"),
- SS_PURCH => _("Purchase transactions"),
- SS_PURCH_A => _("Purchase analytics"),
- SS_ITEMS_C => _("Inventory configuration"),
- SS_ITEMS => _("Inventory operations"),
- SS_ITEMS_A => _("Inventory analytics"),
- SS_MANUF_C => _("Manufacturing configuration"),
- SS_MANUF => _("Manufacturing transactions"),
- SS_MANUF_A => _("Manufacturing analytics"),
- SS_DIM_C => _("Dimensions configuration"),
- SS_DIM => _("Dimensions"),
- SS_GL_C => _("Banking & GL configuration"),
- SS_GL => _("Banking & GL transactions"),
- SS_GL_A => _("Banking & GL analytics")
+ SS_SADMIN => _("System administration"),
+ SS_SETUP => _("Company setup"),
+ SS_SPEC => _("Special maintenance"),
+ SS_SALES_C => _("Sales configuration"),
+ SS_SALES => _("Sales transactions"),
+ SS_SALES_A => _("Sales related reports"),
+ SS_PURCH_C => _("Purchase configuration"),
+ SS_PURCH => _("Purchase transactions"),
+ SS_PURCH_A => _("Purchase analytics"),
+ SS_ITEMS_C => _("Inventory configuration"),
+ SS_ITEMS => _("Inventory operations"),
+ SS_ITEMS_A => _("Inventory analytics"),
+ SS_MANUF_C => _("Manufacturing configuration"),
+ SS_MANUF => _("Manufacturing transactions"),
+ SS_MANUF_A => _("Manufacturing analytics"),
+ SS_DIM_C => _("Dimensions configuration"),
+ SS_DIM => _("Dimensions"),
+ SS_GL_C => _("Banking & GL configuration"),
+ SS_GL => _("Banking & GL transactions"),
+ SS_GL_A => _("Banking & GL analytics")
);
/*
}
}
}
-/*
- Helper function to retrieve extension access definitions in isolated environment.
-*/
-/*
-function get_access_extensions($id) {
- global $path_to_root, $installed_extensions;
-
- $ext = $installed_extensions[$id];
-
- $security_sections = $security_areas = array();
-
- if (isset($ext['acc_file']))
- include_once($path_to_root.'/'.$ext['path'].'/'.$ext['acc_file']);
-
- return array($security_areas, $security_sections);
-}
-*/
function check_edit_access($name)
{
//
function _addCommand($trigger, $aAttributes, $mData)
{
- if ($this->isActive() && ($trigger !== false)) {
-// display_error('adding '.$trigger.':'.htmlentities($mData));
+ if ($this->isActive() && ($trigger !== false)) {
- $aAttributes['why'] = $trigger;
- $aAttributes['data'] = $mData;
- $this->aCommands[] = $aAttributes;
- }
+ $aAttributes['why'] = $trigger;
+ $aAttributes['data'] = $mData;
+ $this->aCommands[] = $aAttributes;
+ }
}
- /*
- * Register binds function with ajax call parameter
-
- function register($trigger, $function)
+
+ function run()
{
- if (isset($_REQUEST[$trigger])) {
- $function(&$this);
- }
- }
- */
- function run() {
-
if (!$this->isActive()) return;
// remove not active commands
foreach ($this->aCommands as $idx => $com) {
// If we should reload whole page content ignore all commands but the update.
// This is page repost equivalent, although header and footer are not reloaded.
- if ($com['why'] !== true && !isset($this->triggers[$com['why']])) {
- unset($this->aCommands[$idx]);
-// display_error('unset '.$com['t']);
- }
- else
- if($com['n'] == 'up' && $com['t'] == '_page_body') {
- $cmds = array($com);
- foreach( $this->aCommands as $k=> $cmd) {
- if ($cmd['n'] == 'fc' || $cmd['n'] == 'js') { // save focus
- $cmds[] = $cmd; //break;
- }
- }
- $this->aCommands = $cmds;
- break;
- }
+ if ($com['why'] !== true && !isset($this->triggers[$com['why']])) {
+ unset($this->aCommands[$idx]);
+ }
+ elseif($com['n'] == 'up' && $com['t'] == '_page_body') {
+ $cmds = array($com);
+ foreach( $this->aCommands as $k=> $cmd) {
+ if ($cmd['n'] == 'fc' || $cmd['n'] == 'js') { // save focus
+ $cmds[] = $cmd; //break;
+ }
+ }
+ $this->aCommands = $cmds;
+ break;
+ }
}
-// display_error('Activate:'.htmlentities(print_r($this->triggers, true)));
-// display_error('Commands :'.htmlentities(print_r($this->aCommands, true)));
$GLOBALS['_RESULT'] = $this->aCommands;
-// exit();
}
}
global $SysPrefs;
$tsep = $SysPrefs->thoseps[user_dec_sep()];
$dsep = $SysPrefs->decseps[user_dec_sep()];
- //return number_format($number, $decimals, $dsep, $tsep);
+
if($decimals==='max')
$dec = 15 - floor(log10(abs($number)));
else {
$num = str_replace( $sep, '.', $num);
if (!is_numeric($num))
- return false;
+ return false;
$num = (float)$num;
if ($num == (int)$num)
- return (int)$num;
+ return (int)$num;
else
- return $num;
+ return $num;
}
function user_company()
///// This non empty sql_mode values can interphere with FA, so all is set empty during
///// our sessions.
///// We are, however, investigating the existing code to be compatible in the future.
- db_query("SET sql_mode = '".SQL_MODE."'");
+ db_query("SET sql_mode = '".SQL_MODE."'");
/////
$SysPrefs->refresh();
return $db;
///// This non empty sql_mode values can interphere with FA, so all is set empty during
///// our sessions.
///// We are, however, investigating the existing code to be compatible in the future.
- db_query("SET sql_mode = '".SQL_MODE."'");
+ db_query("SET sql_mode = '".SQL_MODE."'");
/////
$SysPrefs->refresh();
return $db;
return $qoh_stock;
}
-// recursion fixed by Tom Moulton. Max 10 recursion levels.
+// recursion fixed. Max 10 recursion levels.
function stock_demand_manufacture($stock_id, $qty, $demand_id, $location, $level=0)
{
global $bom_list, $qoh_stock;
}
}
}
- //_vd($this->select);
- //_vd($this->from);
- //_vd($this->where);
- //_vd($this->group);
- //_vd($this->order);
}
//
// Set additional constraint on record set
if ($result) {
// setting field names for subsequent queries
$c = 0;
- // add result field names to column defs for
- // col value retrieve and sort purposes
- $cnt = min(db_num_fields($result), count($this->columns));
+ // add result field names to column defs for
+ // col value retrieve and sort purposes
+ $cnt = min(db_num_fields($result), count($this->columns));
for ($c = $i = 0; $c < $cnt; $c++) {
if (!(isset($this->columns[$c]['insert']) && $this->columns[$c]['insert'])) {
// if (!@($this->columns[$c]['type']=='skip'))
$this->columns[$c]['name']= db_field_name($result, $i);
if (!@($this->columns[$c]['type']=='insert'))
- $i++;
- }
+ $i++;
+ }
}
while ($row = db_fetch_assoc($result)) {
$this->data[] = $row;
}
} else
- return false;
+ return false;
return true;
}
//
function set_page($to)
{
switch($to) {
- case 'next':
- $page = $this->curr_page+1; break;
- case 'prev':
- $page = $this->curr_page-1; break;
- case 'last':
- $page = $this->last_page; break;
- default:
- if (is_numeric($to)) {
- $page = $to; break;
- }
- case 'first':
- $page = 1; break;
+ case 'next':
+ $page = $this->curr_page+1; break;
+ case 'prev':
+ $page = $this->curr_page-1; break;
+ case 'last':
+ $page = $this->last_page; break;
+ default:
+ if (is_numeric($to)) {
+ $page = $to; break;
+ }
+ case 'first':
+ $page = 1; break;
}
- if ($page < 1)
- $page = 1;
- $max = $this->max_page;
- if ($page > $max)
- $page = $max;
- $this->curr_page = $page;
- $this->next_page = ($page < $max) ? $page+1 : null;
- $this->prev_page = ($page > 1) ? ($page-1) : null;
- $this->last_page = ($page < $max) ? $max : null;
- $this->first_page = ($page != 1) ? 1: null;
+ if ($page < 1)
+ $page = 1;
+ $max = $this->max_page;
+ if ($page > $max)
+ $page = $max;
+ $this->curr_page = $page;
+ $this->next_page = ($page < $max) ? $page+1 : null;
+ $this->prev_page = ($page > 1) ? ($page-1) : null;
+ $this->last_page = ($page < $max) ? $max : null;
+ $this->first_page = ($page != 1) ? 1: null;
}
//
// Set column definitions
}
foreach ($flds as $colnum=>$coldef) {
if (is_string($colnum)) { // 'colname'=>params
- $h = $colnum;
- $c = $coldef;
+ $h = $colnum;
+ $c = $coldef;
} else { // n=>params
if (is_array($coldef)) {
$h = '';
}
}
if (is_string($c)) // params is simple column type
- $c = array('type'=>$c);
+ $c = array('type'=>$c);
if (!isset($c['type']))
- $c['type'] = 'text';
+ $c['type'] = 'text';
switch($c['type']) {
case 'inactive':
if ($group) $sql.= " GROUP BY $group";
$ord = array();
- // sort order column by priority instead of table order.
- $columns = array();
+ // sort order column by priority instead of table order.
+ $columns = array();
foreach ($this->columns as $col) {
- if(isset($col['ord_priority'])) {
- $columns[$col['ord_priority']] = $col;
- }
+ if(isset($col['ord_priority'])) {
+ $columns[$col['ord_priority']] = $col;
+ }
}
krsort($columns);
function inactive_control_cell(&$row)
{
if ($this->inactive_ctrl) {
-// return inactive_control_cell($row[$this->inactive_ctrl['key']],
-// $row['inactive'], $this->inactive_ctrl['table'],
-// $this->inactive_ctrl['key']);
global $Ajax;
function fmt_errors($center=false) {
global $messages, $path_to_root, $SysPrefs;
- $msg_class = array(
- E_USER_ERROR => 'err_msg',
- E_USER_WARNING =>'warn_msg',
- E_USER_NOTICE => 'note_msg');
-
- $type = E_USER_NOTICE;
- $content = '';
-// $class = 'no_msg';
- if (count($messages)) {
- foreach($messages as $cnt=>$msg) {
- if ($SysPrefs->go_debug && $msg[0]>E_USER_NOTICE)
- $msg[0] = E_ERROR;
-
- if ($msg[0]>$type) continue;
-
- if ($msg[0]<$type) {
- if ($msg[0] == E_USER_WARNING) {
- $type = E_USER_WARNING; // user warnings
- $content = ''; // clean notices when we have errors
- } else {
- $type = E_USER_ERROR; // php or user errors
- if($type == E_USER_WARNING)
- $content = ''; // clean other messages
+ $msg_class = array(
+ E_USER_ERROR => 'err_msg',
+ E_USER_WARNING =>'warn_msg',
+ E_USER_NOTICE => 'note_msg');
+
+ $type = E_USER_NOTICE;
+ $content = '';
+
+ if (count($messages)) {
+ foreach($messages as $cnt=>$msg) {
+ if ($SysPrefs->go_debug && $msg[0]>E_USER_NOTICE)
+ $msg[0] = E_ERROR;
+
+ if ($msg[0]>$type) continue;
+
+ if ($msg[0]<$type) {
+ if ($msg[0] == E_USER_WARNING) {
+ $type = E_USER_WARNING; // user warnings
+ $content = ''; // clean notices when we have errors
+ } else {
+ $type = E_USER_ERROR; // php or user errors
+ if($type == E_USER_WARNING)
+ $content = ''; // clean other messages
+ }
}
- }
- $str = $msg[1];
- if (!in_array($msg[0], array(E_USER_NOTICE, E_USER_ERROR, E_USER_WARNING)) && $msg[2] != null)
- $str .= ' '._('in file').': '.$msg[2].' '._('at line ').$msg[3];
+ $str = $msg[1];
+ if (!in_array($msg[0], array(E_USER_NOTICE, E_USER_ERROR, E_USER_WARNING)) && $msg[2] != null)
+ $str .= ' '._('in file').': '.$msg[2].' '._('at line ').$msg[3];
- if ($SysPrefs->go_debug>1 && $type!=E_USER_NOTICE && $type!=E_USER_WARNING)
- $str .= '<br>'.$msg[4];
- $content .= ($cnt ? '<hr>' : '').$str;
- }
- $class = $msg_class[$type];
- $content = "<div class='$class'>$content</div>";
- } else
- if ($path_to_root=='.')
- return '';
- return $content;
+ if ($SysPrefs->go_debug>1 && $type!=E_USER_NOTICE && $type!=E_USER_WARNING)
+ $str .= '<br>'.$msg[4];
+ $content .= ($cnt ? '<hr>' : '').$str;
+ }
+ $class = $msg_class[$type];
+ $content = "<div class='$class'>$content</div>";
+ } elseif ($path_to_root=='.')
+ return '';
+ return $content;
}
//-----------------------------------------------------------------------------
// Error box <div> element.
echo "<div id='msgbox'>";
-// Necessary restart instead of get_contents/clean calls due to a bug in php 4.3.2
+ // Necessary restart instead of get_contents/clean calls due to a bug in php 4.3.2
$before_box = ob_get_clean(); // save html content before error box
ob_start('output_html');
echo "</div>";
$warning = $msg==null;
$db_error = db_error_no();
-// $str = "<span class='errortext'><b>" . _("DATABASE ERROR :") . "</b> $msg</span><br>";
if($warning)
$str = "<b>" . _("Debug mode database warning:") . "</b><br>";
else
$cur_prefix = $db_connections[$_SESSION["wa_current_user"]->cur_con]['tbpref'];
$str .= "sql that failed was : ".str_replace(TB_PREF, $cur_prefix, $sql_statement)."<br>";
-// if ($SysPrefs->go_debug > 1) display_backtrace();
}
$str .= "<br><br>";
{
if ($SysPrefs->go_debug || !frindly_db_error($db_error)) {
- display_db_error($msg, $sql_statement, false);
+ display_db_error($msg, $sql_statement, false);
}
if ($rollback_if_error)
{
- $rollback_result = db_query("rollback");
+ $rollback_result = db_query("rollback");
}
if ($exit_if_error)
* more than one in the cart.
*/
/* Default behavior check if there is enough quantity on hand and change the css
- * class if needed */
+ * class if needed */
static function default_get_dispatchable_quantity($line_item, $location, $date, $qoh) {
- global $SysPrefs;
+ global $SysPrefs;
if ($SysPrefs->allow_negative_stock() || ($line_item->qty_dispatched <= $qoh)) {
return true;
}
// install hooks provided by active extensions
foreach($installed_extensions as $ext) {
- $hook_class = 'hooks_'.$ext['package'];
- if ($ext['active'] && class_exists($hook_class)) {
- $Hooks[$ext['package']] = new $hook_class;
- }
+ $hook_class = 'hooks_'.$ext['package'];
+ if ($ext['active'] && class_exists($hook_class)) {
+ $Hooks[$ext['package']] = new $hook_class;
+ }
}
}
/*
// Authors: Laurent Bedubourg <laurent.bedubourg@free.fr>
//
-//require_once "PEAR.php";
-
define('GETTEXT_NATIVE', 1);
define('GETTEXT_PHP', 2);
putenv("LC_ALL=$lang_code");
putenv("LANGUAGE=$lang_code");
- //$set = setlocale(LC_ALL, "$lang_code");
- //$set = setlocale(LC_ALL, "$encoding");
-
// cover a couple of country/encoding variants
$up = strtoupper($encoding);
$low = strtolower($encoding);
return 0;
$str = sprintf('language code "%s", encoding "%s" not supported by your system',
$lang_code, $encoding);
- //$err = new GetText_Error($str);
- //return PEAR::raise_error($err);
return raise_error("1 " . $str);
}
- //return 0;
}
/**
* Check system support for given language nedded for gettext.
$value = $this->_get_translation($key);
if ($value === false) {
$str = sprintf('Unable to locate gettext key "%s"', $key);
- //$err = new GetText_Error($str);
- //return PEAR::raise_error($err);
return raise_error("2 " . $str);
}
list($domain, $path) = array_shift($this->_jobs);
$err = $this->add_domain($domain, $path);
// error raised, break jobs
- /*if (PEAR::is_error($err)) {
- return $err;
- }*/
if (is_error($err))
{
return $err;
if (!file_exists($src_domain))
{
$str = sprintf('Domain file "%s" not found.', $src_domain);
- //$err = new GetText_Error($str);
- //return PEAR::raise_error($err);
return raise_error("4 " . $str);
}
{
$comp = new gettext_php_support_compiler();
$err = $comp->compile($hash, $src_domain);
- /*if (PEAR::is_error($err)) {
- return $err;
- }*/
if (is_error($err))
{
return $err;
if (!file_exists($file))
{
$str = sprintf('Unable to locate file "%s"', $file);
- //$err = new GetText_Error($str);
- //return PEAR::raise_error($err);
return raise_error($str);
}
$i = 0;
if (!$fp)
{
$str = sprintf('Unable to open "%s" in write mode.', $dest_path);
- //$err = new GetText_Error($str);
- //return PEAR::raise_error($err);
return raise_error($str);
}
fwrite($fp, '<?php' . "\n");
'active' => @$pkg['DefaultStatus'] == 'active' ? true : false,
'path' => $pkg['InstallPath'],
);
-// if (isset($pkg['MenuTabs']))
-// $ext['tabs'] = $pkg['MenuTabs'];
-// if (isset($pkg['MenuEntries']))
-// $ext['entries'] = $pkg['MenuEntries'];
-// if (isset($pkg['AccessExtensions']))
-// $ext['acc_file'] = $pkg['AccessExtensions'];
if (isset($pkg['SqlScript']))
$ext['sql'] = $pkg['SqlScript'];
if (in_ajax())
return; // just for speed up
-// $jsext = substr_replace($_SERVER['PHP_SELF'], '.js', -4);
-
-// if (file_exists($_SERVER['DOCUMENT_ROOT'].$jsext))
-// add_js_ufile($jsext);
-
$theme = user_theme();
if ($SysPrefs->help_base_url != null && $SysPrefs->use_popup_windows && $js == '')
add_js_source(get_js_open_window(900, 500));
}
if ($js!='')
- add_js_source($js);
+ add_js_source($js);
if (!isset($no_menu))
{
{
global $path_to_root;
- echo "<center><br><br><font size='5' color='red'><b>" . _("Incorrect Email") . "<b></font><br><br>";
- echo "<b>" . _("The email address does not exist in the system, or is used by more than one user.") . "<b><br><br>";
+ echo "<center><br><br><font size='5' color='red'><b>" . _("Incorrect Email") . "<b></font><br><br>";
+ echo "<b>" . _("The email address does not exist in the system, or is used by more than one user.") . "<b><br><br>";
- echo _("Plase try again or contact your system administrator to obtain new password.");
- echo "<br><a href='$path_to_root/index.php?reset=1'>" . _("Try again") . "</a>";
- echo "</center>";
+ echo _("Plase try again or contact your system administrator to obtain new password.");
+ echo "<br><a href='$path_to_root/index.php?reset=1'>" . _("Try again") . "</a>";
+ echo "</center>";
kill_login();
die();
{
global $path_to_root;
- echo "<center><br><br><font size='5' color='green'><b>" . _("New password sent") . "<b></font><br><br>";
- echo "<b>" . _("A new password has been sent to your mailbox.") . "<b><br><br>";
+ echo "<center><br><br><font size='5' color='green'><b>" . _("New password sent") . "<b></font><br><br>";
+ echo "<b>" . _("A new password has been sent to your mailbox.") . "<b><br><br>";
- echo "<br><a href='$path_to_root/index.php'>" . _("Login here") . "</a>";
- echo "</center>";
+ echo "<br><a href='$path_to_root/index.php'>" . _("Login here") . "</a>";
+ echo "</center>";
kill_login();
die();
case PT_SUPPLIER :
return ($full ? $payment_person_types[$type] . " ":"") . sprintf("[%05s] %s", $person_id, get_supplier_name($person_id));
default :
- //DisplayDBerror("Invalid type sent to person_name");
- //return;
return '';
}
}
global $systypes_array;
- $k = $counter = $total_allocated = 0;
+ $k = $total_allocated = 0;
$cart = $_SESSION['alloc'];
$supp_ref = in_array($cart->type, array(ST_SUPPCREDIT, ST_SUPPAYMENT, ST_BANKPAYMENT));
if (count($cart->allocs))
{
-// if ($cart->currency != $cart->person_curr)
- display_heading(sprintf(_("Allocated amounts in %s:"), $cart->person_curr));
+ display_heading(sprintf(_("Allocated amounts in %s:"), $cart->person_curr));
start_table(TABLESTYLE, "width='60%'");
$th = array(_("Transaction Type"), _("#"), $supp_ref ? _("Supplier Ref"): _("Ref"), _("Date"), _("Due Date"), _("Amount"),
_("Other Allocations"), _("Left to Allocate"), _("This Allocation"),'','');
if ($show_totals) {
label_row(_("Total Allocated"), price_format($total_allocated),
"colspan=8 align=right", "align=right id='total_allocated'", 3);
-/*
- $amount = $_SESSION['alloc']->amount;
- if ($_SESSION['alloc']->type == ST_SUPPCREDIT
- || $_SESSION['alloc']->type == ST_SUPPAYMENT
- || $_SESSION['alloc']->type == ST_BANKPAYMENT ||
- ($_SESSION['alloc']->type == ST_JOURNAL && $_SESSION['alloc']->person_type == PT_SUPPLIER))
- $amount = -$amount;
-*/
$amount = abs($cart->amount);
if (floatcmp($amount, $total_allocated) < 0)
$total_allocated += input_num('amount' . $counter);
}
-/*
- $amount = $_SESSION['alloc']->amount;
- if (in_array($_SESSION['alloc']->type, array(ST_BANKPAYMENT, ST_SUPPCREDIT, ST_SUPPAYMENT)) ||
- ($_SESSION['alloc']->type==ST_JOURNAL && $_SESSION['alloc']->person_type == PT_SUPPLIER))
- $amount = -$amount;
-*/
$amount = abs($_SESSION['alloc']->amount);
if ($total_allocated - ($amount + input_num('discount')) > $SysPrefs->allocation_settled_allowance())
function list_view($Mode)
{
- global $Ajax, $systypes_array;
+ global $systypes_array;
start_table(TABLESTYLE);
br();
$contacts = get_crm_persons($this->class, $this->subclass, $this->entity);
-// check_value('show_inactive'));
start_table(TABLESTYLE, "width='80%'");
$th = array(_('Assignment'), _("Reference"), _("Full Name"), _("Phone"), _("Sec Phone"), _("Fax"),
_("email"), '',
" ");
- // inactive_control_column($th);
table_header($th);
$k = 0;
label_cell($last["phone2"]);
label_cell($last["fax"]);
email_cell($last["email"]);
- // inactive_control_cell($myrow["id"], $myrow["inactive"], 'crm_contacts', 'id');
edit_button_cell("{$this->name}Edit[{$last['id']}]", _("Edit"));
- // delete button removes only category unless this is the last contact for this person
+ // delete button removes only category unless this is the last contact for this person
delete_button_cell("{$this->name}Delete[{$last['id']}]", _("Delete"));
end_row();
$description = array();
}
}
-//inactive_control_row($th);
+ //inactive_control_row($th);
end_table(1);
}
if(get_post('show_inactive'))
$pager->inactive_control_cell($row); break;
default:
-// case 'text':
if (isset( $col['align']))
label_cell($cell, "align='" . $col['align'] . "'");
else
echo $inact;
echo "</td>";
} else {
- label_cell( _('No records') . $inact, "colspan=$colspan class='navibar'");
+ label_cell( _('No records') . $inact, "colspan=$colspan class='navibar'");
}
end_row();
// do not post exchange variations to AR/AP (journal in not customer/supplier currency)
if ($gl->person_type_id==PT_SUPPLIER && (get_supplier_currency($gl->person_id) == $this->currency || $this->currency != $home_currency))
$supp_trans[$gl->person_id] = @$supp_trans[$gl->person_id] + $gl->amount;
- else
- if ($gl->person_type_id==PT_CUSTOMER && (get_customer_currency(null, $gl->branch_id) == $this->currency || $this->currency != $home_currency))
+ elseif ($gl->person_type_id==PT_CUSTOMER && (get_customer_currency(null, $gl->branch_id) == $this->currency || $this->currency != $home_currency))
$cust_trans[$gl->branch_id] = @$cust_trans[$gl->branch_id] + $gl->amount;
}
{
global $Ajax;
- $sel_name = $this->name.'_id';
-
// list controls lookup
foreach (array_keys($this->pre_handlers) as $m) {
if (isset($_POST[$this->name.$m])) {
if ($async === 'both') {
$async = 'default'; $cancel = 'cancel';
}
- else if ($async === 'default')
+ elseif ($async === 'default')
$cancel = true;
- else if ($async === 'cancel')
+ elseif ($async === 'cancel')
$async = true;
echo "<center>";
echo "</table>\n";
output_hidden();
$width = ($width ? "width='$width'" : "");
- //echo "</td><td class='tableseparator' $width>\n"; // outer table
echo "</td><td style='border-left:1px solid #cccccc;' $width>\n"; // outer table
}
echo "<table class='tablestyle_inner'>\n";
elseif ($async === 'upgrade') {
$async = 'default nonajax process'; $cancel = 'cancel';
}
- else if ($async === 'default')
+ elseif ($async === 'default')
$cancel = true;
- else if ($async === 'cancel')
+ elseif ($async === 'cancel')
$async = true;
if ($add)
echo "</tr>\n";
}
-//-----------------------------------------------------------------------------------
-/*
-function text_row_with_submit($label, $name, $value, $size, $max, $input_name, $input_value)
-{
- global $Ajax;
-
- default_focus($name);
- echo "<tr><td>$label</td>\n";
- echo "<td>";
-
- if ($value == null)
- $value = (!isset($_POST[$name]) ? "" : $_POST[$name]);
- echo "<input type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"$value\"> ";
-
- submit($input_name, $input_value);
-
- echo "</td></tr>\n";
- $Ajax->addUpdate($name, $name, $value);
-}
-*/
//-----------------------------------------------------------------------------------
//
// When show_inactive page option is set
$found = false;
$lastcat = null;
$edit = false;
-//if($name=='stock_id') display_notification('<pre>'.print_r($_POST, true).'</pre>');
-//if($name=='curr_default') display_notification($opts['search_submit']);
if($result = db_query($sql)) {
while ($contact_row = db_fetch($result)) {
$value = $contact_row[0];
if ($spec_option !== false) { // if special option used - add it
$first_id = $spec_id;
$first_opt = $spec_option;
-// }
-// if($first_id !== false) {
$sel = $found===false ? 'selected' : '';
$optclass = @$contact_row['inactive'] ? "class='inactive'" : '';
$selector = "<option $sel value='$first_id'>$first_opt</option>\n"
$selector = $first_opt = '';
$first_id = false;
$found = false;
-//if($name=='SelectStockFromList') display_error($sql);
- foreach($items as $value=>$descr) {
- $sel = '';
- if (in_array((string)$value, $selected_id, true)) {
- $sel = 'selected';
- $found = $value;
- }
- if ($first_id === false) {
- $first_id = $value;
- $first_opt = $descr;
- }
- $selector .= "<option $sel value='$value'>$descr</option>\n";
+ foreach($items as $value=>$descr) {
+ $sel = '';
+ if (in_array((string)$value, $selected_id, true)) {
+ $sel = 'selected';
+ $found = $value;
+ }
+ if ($first_id === false) {
+ $first_id = $value;
+ $first_opt = $descr;
}
+ $selector .= "<option $sel value='$value'>$descr</option>\n";
+ }
if ($first_id!==false) {
$sel = ($found===$first_id) || ($found===false && ($spec_option===false)) ? "selected='selected'" : '';
$sql = "SELECT loc_code, location_name, inactive FROM ".TB_PREF."locations";
-return combo_input($name, $selected_id, $sql, 'loc_code', 'location_name',
- array(
- 'spec_option' => $all_option === true ? _("All Locations") : $all_option,
- 'spec_id' => ALL_TEXT,
- 'select_submit'=> $submit_on_change
- ) );
+ return combo_input($name, $selected_id, $sql, 'loc_code', 'location_name',
+ array(
+ 'spec_option' => $all_option === true ? _("All Locations") : $all_option,
+ 'spec_id' => ALL_TEXT,
+ 'select_submit'=> $submit_on_change
+ ) );
}
function locations_list_cells($label, $name, $selected_id=null, $all_option=false, $submit_on_change=false)
{
$sql = "SELECT curr_abrev, currency, inactive FROM ".TB_PREF."currencies";
-// default to the company currency
-return combo_input($name, $selected_id, $sql, 'curr_abrev', 'currency',
- array(
- 'select_submit'=> $submit_on_change,
- 'default' => get_company_currency(),
- 'async' => false
- ) );
+ // default to the company currency
+ return combo_input($name, $selected_id, $sql, 'curr_abrev', 'currency',
+ array(
+ 'select_submit'=> $submit_on_change,
+ 'default' => get_company_currency(),
+ 'async' => false
+ ) );
}
function currencies_list_cells($label, $name, $selected_id=null, $submit_on_change=false)
$sql = "SELECT * FROM ".TB_PREF."fiscal_year";
-// default to the company current fiscal year
+ // default to the company current fiscal year
-return combo_input($name, $selected_id, $sql, 'id', '',
- array(
- 'order' => 'begin',
- 'default' => get_company_pref('f_year'),
- 'format' => '_format_fiscalyears',
- 'select_submit'=> $submit_on_change,
- 'async' => false
- ) );
+ return combo_input($name, $selected_id, $sql, 'id', '',
+ array(
+ 'order' => 'begin',
+ 'default' => get_company_pref('f_year'),
+ 'format' => '_format_fiscalyears',
+ 'select_submit'=> $submit_on_change,
+ 'async' => false
+ ) );
}
function _format_fiscalyears($row)
function dimensions_list($name, $selected_id=null, $no_option=false, $showname=' ',
$submit_on_change=false, $showclosed=false, $showtype=1)
{
-$sql = "SELECT id, CONCAT(reference,' ',name) as ref FROM ".TB_PREF."dimensions";
+ $sql = "SELECT id, CONCAT(reference,' ',name) as ref FROM ".TB_PREF."dimensions";
-$options = array(
- 'order' => 'reference',
- 'spec_option'=>$no_option ? $showname : false,
- 'spec_id' => 0,
- 'select_submit'=> $submit_on_change,
- 'async' => false,
+ $options = array(
+ 'order' => 'reference',
+ 'spec_option'=>$no_option ? $showname : false,
+ 'spec_id' => 0,
+ 'select_submit'=> $submit_on_change,
+ 'async' => false,
);
if (!$showclosed)
set_editor('item', $name, $editkey);
$ret = combo_input($name, $selected_id, $sql, 'stock_id', 's.description',
- array_merge(
- array(
- 'format' => '_format_stock_items',
- 'spec_option' => $all_option===true ? _("All Items") : $all_option,
- 'spec_id' => ALL_TEXT,
- 'search_box' => true,
- 'search' => array("stock_id", "c.description","s.description"),
- 'search_submit' => get_company_pref('no_item_list')!=0,
- 'size'=>10,
- 'select_submit'=> $submit_on_change,
- 'category' => 2,
- 'order' => array('c.description','stock_id'),
- 'editlink' => $editkey ? add_edit_combo('item') : false,
- 'editable' => false,
- 'max' => 255
- ), $opts) );
+ array_merge(
+ array(
+ 'format' => '_format_stock_items',
+ 'spec_option' => $all_option===true ? _("All Items") : $all_option,
+ 'spec_id' => ALL_TEXT,
+ 'search_box' => true,
+ 'search' => array("stock_id", "c.description","s.description"),
+ 'search_submit' => get_company_pref('no_item_list')!=0,
+ 'size'=>10,
+ 'select_submit'=> $submit_on_change,
+ 'category' => 2,
+ 'order' => array('c.description','stock_id'),
+ 'editlink' => $editkey ? add_edit_combo('item') : false,
+ 'editable' => false,
+ 'max' => 255
+ ), $opts) );
return $ret;
}
$sql .= " GROUP BY i.item_code";
return combo_input($name, $selected_id, $sql, 'i.item_code', 'c.description',
- array_merge(
- array(
- 'format' => '_format_stock_items',
- 'spec_option' => $all_option===true ? _("All Items") : $all_option,
- 'spec_id' => ALL_TEXT,
- 'search_box' => true,
- 'search' => array("i.item_code", "c.description", "i.description"),
- 'search_submit' => get_company_pref('no_item_list')!=0,
- 'size'=>15,
- 'select_submit'=> $submit_on_change,
- 'category' => 2,
- 'order' => array('c.description','i.item_code'),
- 'editable' => 30,
- 'max' => 255
- ), $opts) );
+ array_merge(
+ array(
+ 'format' => '_format_stock_items',
+ 'spec_option' => $all_option===true ? _("All Items") : $all_option,
+ 'spec_id' => ALL_TEXT,
+ 'search_box' => true,
+ 'search' => array("i.item_code", "c.description", "i.description"),
+ 'search_submit' => get_company_pref('no_item_list')!=0,
+ 'size'=>15,
+ 'select_submit'=> $submit_on_change,
+ 'category' => 2,
+ 'order' => array('c.description','i.item_code'),
+ 'editable' => 30,
+ 'max' => 255
+ ), $opts) );
}
function sales_items_list_cells($label, $name, $selected_id=null, $all_option=false, $submit_on_change=false, $editkey=false)
'editable' => 30,
'cells'=>true), $editkey);
}
-/*
-function stock_purchasable_items_list_row($label, $name, $selected_id=null,
- $all_option=false, $submit_on_change=false, $editkey=false)
-{
- echo "<tr><td class='label'>$label</td>";
- stock_purchasable_items_list_cells(null, $name, $selected_id=null,
- $all_option, $submit_on_change, $editkey);
- echo "</tr>\n";
-}
-*/
+
//------------------------------------------------------------------------------------
function stock_item_types_list_row($label, $name, $selected_id=null, $enabled=true)
$sql = "SELECT id, CONCAT(name, ' (',rate,'%)') as name FROM ".TB_PREF."tax_types";
return combo_input($name, $selected_id, $sql, 'id', 'name',
- array(
- 'spec_option' => $none_option,
- 'spec_id' => ALL_NUMERIC,
- 'select_submit'=> $submit_on_change,
- 'async' => false,
- ) );
+ array(
+ 'spec_option' => $none_option,
+ 'spec_id' => ALL_NUMERIC,
+ 'select_submit'=> $submit_on_change,
+ 'async' => false,
+ ) );
}
function tax_types_list_cells($label, $name, $selected_id=null, $none_option=false,
$sql = "SELECT id, name FROM ".TB_PREF."tax_groups";
return combo_input($name, $selected_id, $sql, 'id', 'name',
- array(
- 'order' => 'id',
- 'spec_option' => $none_option,
- 'spec_id' => ALL_NUMERIC,
- 'select_submit'=> $submit_on_change,
- 'async' => false,
- ) );
+ array(
+ 'order' => 'id',
+ 'spec_option' => $none_option,
+ 'spec_id' => ALL_NUMERIC,
+ 'select_submit'=> $submit_on_change,
+ 'async' => false,
+ ) );
}
function tax_groups_list_cells($label, $name, $selected_id=null, $none_option=false, $submit_on_change=false)
'spec_option' => $special_option===true ? _("All Sales Types") : $special_option,
'spec_id' => 0,
'select_submit'=> $submit_on_change,
- // 'async' => false,
) );
}
WHERE bank_act=".db_escape($account)." AND reconciled IS NOT NULL
GROUP BY reconciled";
return combo_input($name, $selected_id, $sql, 'id', 'reconciled',
- array(
- 'spec_option' => $special_option,
- 'format' => '_format_date',
- 'spec_id' => '',
- 'select_submit'=> $submit_on_change
- ) );
+ array(
+ 'spec_option' => $special_option,
+ 'format' => '_format_date',
+ 'spec_id' => '',
+ 'select_submit'=> $submit_on_change
+ ) );
}
function bank_reconciliation_list_cells($label,$account, $name, $selected_id=null, $submit_on_change=false, $special_option=false)
$sql = "SELECT id, name, inactive FROM ".TB_PREF."workcentres";
return combo_input($name, $selected_id, $sql, 'id', 'name',
- array(
- 'spec_option' =>$all_option===true ? _("All Suppliers") : $all_option,
- 'spec_id' => ALL_TEXT,
- ) );
+ array(
+ 'spec_option' =>$all_option===true ? _("All Suppliers") : $all_option,
+ 'spec_id' => ALL_TEXT,
+ ) );
}
function workcenter_list_cells($label, $name, $selected_id=null, $all_option=false)
FROM ".TB_PREF."bank_accounts";
return combo_input($name, $selected_id, $sql, 'id', 'bank_account_name',
- array(
- 'format' => '_format_add_curr',
- 'select_submit'=> $submit_on_change,
- 'spec_option' => $spec_option,
- 'spec_id' => '',
- 'async' => false
- ) );
+ array(
+ 'format' => '_format_add_curr',
+ 'select_submit'=> $submit_on_change,
+ 'spec_option' => $spec_option,
+ 'spec_id' => '',
+ 'async' => false
+ ) );
}
function bank_accounts_list_cells($label, $name, $selected_id=null, $submit_on_change=false)
echo "<tr><td class='label'>$label</td>\n";
echo "<td>";
echo combo_input($name, $selected_id, $sql, 'id', 'bank_account_name',
- array(
- 'spec_option' => $all_option,
- 'spec_id' => ALL_TEXT,
- 'format' => '_format_add_curr',
- 'select_submit'=> $submit_on_change,
- 'async' => true
- ) );
+ array(
+ 'spec_option' => $all_option,
+ 'spec_id' => ALL_TEXT,
+ 'format' => '_format_add_curr',
+ 'select_submit'=> $submit_on_change,
+ 'async' => true
+ ) );
echo "</td></tr>\n";
}
//-----------------------------------------------------------------------------------------------
echo "<td>";
echo combo_input($name, $selected_id, $sql, 'id', 'pos_name',
- array(
- 'select_submit'=> $submit_on_change,
- 'async' => true,
- 'spec_option' =>$spec_option,
- 'spec_id' => -1,
- 'order'=> array('pos_name')
- ) );
+ array(
+ 'select_submit'=> $submit_on_change,
+ 'async' => true,
+ 'spec_option' =>$spec_option,
+ 'spec_id' => -1,
+ 'order'=> array('pos_name')
+ ) );
echo "</td></tr>\n";
}
$sql .= " WHERE days_before_due>=0";
return combo_input($name, $selected_id, $sql, 'terms_indicator', 'terms',
- array(
- 'select_submit'=> $submit_on_change,
- 'async' => true
- ) );
+ array(
+ 'select_submit'=> $submit_on_change,
+ 'async' => true
+ ) );
}
$sql = "SELECT cid, class_name FROM ".TB_PREF."chart_class";
return combo_input($name, $selected_id, $sql, 'cid', 'class_name',
- array(
- 'select_submit'=> $submit_on_change,
- 'async' => false
- ) );
+ array(
+ 'select_submit'=> $submit_on_change,
+ 'async' => false
+ ) );
}
{
$sql = "SELECT category_id, description, inactive FROM ".TB_PREF."stock_category";
return combo_input($name, $selected_id, $sql, 'category_id', 'description',
- array('order'=>'category_id',
- 'spec_option' => $spec_opt,
- 'spec_id' => -1,
- 'select_submit'=> $submit_on_change,
- 'async' => true
- ));
+ array('order'=>'category_id',
+ 'spec_option' => $spec_opt,
+ 'spec_id' => -1,
+ 'select_submit'=> $submit_on_change,
+ 'async' => true
+ ));
}
function stock_categories_list_cells($label, $name, $selected_id=null, $spec_opt=false, $submit_on_change=false)
$sql = "SELECT id, name FROM ".TB_PREF."chart_types";
return combo_input($name, $selected_id, $sql, 'id', 'name',
- array(
- 'format' => '_format_account',
- 'order' => array('class_id', 'id', 'parent'),
- 'spec_option' =>$all_option,
- 'spec_id' => ALL_TEXT
- ) );
+ array(
+ 'format' => '_format_account',
+ 'order' => array('class_id', 'id', 'parent'),
+ 'spec_option' =>$all_option,
+ 'spec_id' => ALL_TEXT
+ ) );
}
function gl_account_types_list_cells($label, $name, $selected_id=null, $all_option=false, $all=false)
WHERE chart.account_type=type.id";
return combo_input($name, $selected_id, $sql, 'chart.account_code', 'chart.account_name',
- array(
- 'format' => '_format_account',
- 'spec_option' => $all_option===true ? _("Use Item Sales Accounts") : $all_option,
- 'spec_id' => '',
- 'type' => 2,
- 'order' => array('type.class_id','type.id','account_code'),
- 'search_box' => $cells,
+ array(
+ 'format' => '_format_account',
+ 'spec_option' => $all_option===true ? _("Use Item Sales Accounts") : $all_option,
+ 'spec_id' => '',
+ 'type' => 2,
+ 'order' => array('type.class_id','type.id','account_code'),
+ 'search_box' => $cells,
'search_submit' => false,
'size' => 12,
'max' => 10,
'cells' => true,
- 'select_submit'=> $submit_on_change,
- 'async' => false,
- 'category' => 2,
- 'show_inactive' => $all
- ) );
-
+ 'select_submit'=> $submit_on_change,
+ 'async' => false,
+ 'category' => 2,
+ 'show_inactive' => $all
+ ) );
}
function _format_account($row)
{
- return $row[0] . " " . $row[1];
+ return $row[0] . " " . $row[1];
}
function gl_all_accounts_list_cells($label, $name, $selected_id=null,
label_cell($label);
echo "<td>\n";
echo array_selector($name, $selected,
- array( 'Return' => _("Items Returned to Inventory Location"),
- 'WriteOff' => _("Items Written Off")),
- array( 'select_submit'=> $submit_on_change ) );
+ array( 'Return' => _("Items Returned to Inventory Location"),
+ 'WriteOff' => _("Items Written Off")),
+ array( 'select_submit'=> $submit_on_change ) );
echo "</td>\n";
}
$items[$i] = "$i";
return array_selector($name, $selected, $items,
- array( 'spec_option' => $no_option,
- 'spec_id' => ALL_NUMERIC) );
+ array( 'spec_option' => $no_option,
+ 'spec_id' => ALL_NUMERIC) );
}
function number_list_cells($label, $name, $selected, $from, $to, $no_option=false)
$sql = "SELECT id, role, inactive FROM ".TB_PREF."security_roles";
-return combo_input($name, $selected_id, $sql, 'id', 'description',
- array(
- 'spec_option'=>$new_item ? _("New role") : false,
- 'spec_id' => '',
- 'select_submit'=> $submit_on_change,
- 'show_inactive' => $show_inactive
- ) );
+ return combo_input($name, $selected_id, $sql, 'id', 'description',
+ array(
+ 'spec_option'=>$new_item ? _("New role") : false,
+ 'spec_id' => '',
+ 'select_submit'=> $submit_on_change,
+ 'show_inactive' => $show_inactive
+ ) );
}
function security_roles_list_cells($label, $name, $selected_id=null, $new_item=false, $submit_on_change=false,
{
global $path_to_root;
if ($description)
- //hyperlink_params_separate($path_to_root . "/inventory/inquiry/stock_status.php", (user_show_codes()?$stock_id . " - ":"") . $description, "stock_id=$stock_id");
$preview_str = "<a target='_blank' href='$path_to_root/inventory/inquiry/stock_status.php?stock_id=$stock_id&popup=1' onclick=\"javascript:openWindow(this.href,this.target); return false;\" >". (user_show_codes()?$stock_id . " - ":"") . $description."</a>";
else
- //hyperlink_params_separate($path_to_root . "/inventory/inquiry/stock_status.php", $stock_id, "stock_id=$stock_id");
$preview_str = "<a target='_blank' href='$path_to_root/inventory/inquiry/stock_status.php?stock_id=$stock_id&popup=1' onclick=\"javascript:openWindow(this.href,this.target); return false;\" >$stock_id</a>";
if($echo)
echo $preview_str;