$_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',
if ($chg_theme && $allow_demo_mode)
$_SESSION["wa_current_user"]->prefs->theme = $_POST['theme'];
-
- if ($chg_theme || $chg_lang)
+ if ($chg_theme || $chg_lang || $chg_date_format || $chg_date_sep)
meta_forward($_SERVER['PHP_SELF']);
/* allow reopening closed transactions */
$allow_gl_reopen = 0;
- $dateformats = array("MMDDYYYY", "DDMMYYYY", "YYYYMMDD");
+ $dateformats = array("MMDDYYYY", "DDMMYYYY", "YYYYMMDD","MmmDDYYYY", "DDMmmYYYY", "YYYYMmmDD");
$dateseps = array("/", ".", "-", " ");
$thoseps = array(",", ".", " ");
$decseps = array(".", ",");
*/
$login_delay = 30;
$login_max_attempts = 10;
+
+/*
+ Choose Exchange Rate Provider
+ Default is ECB for backwards compatibility
+*/
+$xr_providers = array("ECB", "YAHOO", "GOOGLE", "BLOOMBERG");
+$dflt_xr_provider = 0;
+
+?>
\ No newline at end of file
//
function retrieve_exrate($curr_b, $date)
{
+ global $xr_providers, $dflt_xr_provider;
+ $xchg_rate_provider = ((isset($xr_providers) && isset($dflt_xr_provider)) ? $xr_providers[$dflt_xr_provider] : 'ECB');
+
$rate = hook_retrieve_exrate($curr_b, $date);
if (is_numeric($rate))
return $rate;
- return get_extern_rate($curr_b, 'ECB', $date);
+ return get_extern_rate($curr_b, $xchg_rate_provider, $date);
}
//-----------------------------------------------------------------------------
}
elseif ($provider == 'YAHOO')
{
- $filename = "/q?s={$curr_a}{$curr_b}=X";
- $site = "finance.yahoo.com";
+ $filename = "/d/quotes.csv?s={$curr_a}{$curr_b}=X&f=sl1d1t1ba&e=.csv"; // new URL's for YAHOO
+ $site = "download.finance.yahoo.com";
+ //$filename = "/q?s={$curr_a}{$curr_b}=X"; // Let old code be here for a while, Joe.
+ //$site = "finance.yahoo.com";
}
elseif ($provider == 'GOOGLE')
{
$filename = "/finance/converter?a=1&from={$curr_a}&to={$curr_b}";
- $site = "finance.google.com";
+ $site = "www.google.com";
+ }
+ elseif ($provider == 'BLOOMBERG')
+ {
+ $filename = "/quote/{$curr_b}{$curr_a}:CUR";
+ $site = "www.bloomberg.com";
}
$contents = '';
-
if (function_exists('curl_init'))
{ // first check with curl as we can set short timeout;
$retry = 1;
}
elseif ($provider == 'YAHOO')
{
- $val = '';
- if (preg_match('/Last\sTrade:(.*?)Trade\sTime/s', $contents, $matches)) {
+ $val = '';
+ $array = explode(',',$contents); // New operations for YAHOO. Safer.
+ $val = $array[1];
+ if ($val != 0)
+ $val = 1 / $val;
+ /* Let old code be here for a while, Joe.
+ //if (preg_match('/Last\sTrade:(.*?)Trade\sTime/s', $contents, $matches)) {
$val = strip_tags($matches[1]);
$val = str_replace(',', '', $val);
if ($val != 0)
$val = 1 / $val;
}
+ */
}
elseif ($provider == 'GOOGLE')
{
$val = '';
+
$regexp = "%([\d|.]+)\s+{$curr_a}\s+=\s+<span\sclass=(.*)>([\d|.]+)\s+{$curr_b}\s*</span>%s";
if (preg_match($regexp, $contents, $matches))
{
if ($val != 0)
$val = 1 / $val;
}
+ }
+ elseif ($provider == 'BLOOMBERG')
+ {
+ $val = '';
+ $stmask = '<span class=" price">';
+ $val = trim(strstr($contents, $stmask));
+ $stmask = chr(10);
+ $val = trim(strstr($val, $stmask));
+ $val = trim(strtok($val, $stmask));
}
return $val;
} /* end function get_extern_rate */
start_table(TABLESTYLE);
$th = array(_("Type"), _("#"), _("Reference"), _("Date"),
- _("Debit"), _("Credit"), _("Balance"), _("Person/Item"), "");
+ _("Debit"), _("Credit"), _("Balance"), _("Person/Item"), _("Memo"), "");
table_header($th);
$bfw = get_balance_before_for_bank_account($_POST['bank_account'], $_POST['TransAfterDate']);
display_debit_or_credit_cells($myrow["amount"]);
amount_cell($running_total);
label_cell(get_counterparty_name($myrow["type"], $myrow["trans_no"]));
+ label_cell(get_comments_string($myrow["type"], $myrow["trans_no"]));
label_cell(get_gl_view_str($myrow["type"], $myrow["trans_no"]));
end_row();
if ($myrow["amount"] > 0 )
function display_rate_edit()
{
- global $selected_id, $Ajax;
-
+ global $selected_id, $Ajax, $xr_providers, $dflt_xr_provider;
+ $xchg_rate_provider = ((isset($xr_providers) && isset($dflt_xr_provider)) ? $xr_providers[$dflt_xr_provider] : 'ECB');
start_table(TABLESTYLE2);
if ($selected_id != "")
$Ajax->activate('BuyRate');
}
amount_row(_("Exchange Rate:"), 'BuyRate', null, '',
- submit('get_rate',_("Get"), false, _('Get current ECB rate') , true), 'max');
+ submit('get_rate',_("Get"), false, _('Get current rate from') . ' ' . $xchg_rate_provider , true), 'max');
end_table(1);
start_form();
start_table(TABLESTYLE);
-$th = array(_("Group ID"), _("Group Name"), _("Subgroup Of"), _("Class Type"), "", "");
+$th = array(_("Group ID"), _("Group Name"), _("Subgroup Of"), _("Class"), "", "");
inactive_control_column($th);
table_header($th);
gl_account_types_list_row(_("Subgroup Of:"), 'parent', null, _("None"), true);
-class_list_row(_("Class Type:"), 'class_id', null);
+class_list_row(_("Class:"), 'class_id', null);
end_table(1);
return $this->can_access($page_level);
}
+ function check_application_access($waapp)
+ {
+ if (!$this->hide_inaccessible_menu_items())
+ {
+ return true;
+ }
+
+ foreach ($waapp->modules as $module)
+ {
+ if ($this->check_module_access($module))
+ {
+ return true;
+ }
+ }
+
+ return false;
+
+ }
+
+ function check_module_access($module)
+ {
+
+ if (!$this->hide_inaccessible_menu_items())
+ {
+ return true;
+ }
+
+ if (sizeof($module->lappfunctions) > 0)
+ {
+ foreach ($module->lappfunctions as $appfunction)
+ {
+ if ($appfunction->label != "" && $this->can_access_page($appfunction->access))
+ {
+ return true;
+ }
+ }
+ }
+
+ if (sizeof($module->rappfunctions) > 0)
+ {
+ foreach ($module->rappfunctions as $appfunction)
+ {
+ if ($appfunction->label != "" && $this->can_access_page($appfunction->access))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+
+ }
+
+ function hide_inaccessible_menu_items()
+ {
+ global $hide_inaccessible_menu_items;
+
+ if (!isset($hide_inaccessible_menu_items) || $hide_inaccessible_menu_items == 0)
+ {
+ return false;
+ }
+
+ else
+ {
+ return true;
+ }
+ }
+
function set_db_connection($id = -1)
{
return set_global_connection($id);
function __date($year, $month, $day)
{
- global $dateseps;
+ global $dateseps, $tmonths;
$how = user_date_format();
$sep = $dateseps[user_date_sep()];
$day = (int)$day;
$month = (int)$month;
- if ($day < 10)
- $day = "0".$day;
- if ($month < 10)
- $month = "0".$month;
+ if ($how < 3)
+ {
+ if ($day < 10)
+ $day = "0".$day;
+ if ($month < 10)
+ $month = "0".$month;
+ }
if ($how == 0)
return $month.$sep.$day.$sep.$year;
elseif ($how == 1)
return $day.$sep.$month.$sep.$year;
- else
+ elseif ($how == 2)
return $year.$sep.$month.$sep.$day;
+ elseif ($how == 3)
+ return $tmonths[$month].$sep.$day.$sep.$year;
+ elseif ($how == 4)
+ return $day.$sep.$tmonths[$month].$sep.$year;
+ else
+ return $year.$sep.$tmonths[$month].$sep.$day;
}
function is_date($date_)
$sep = $dateseps[user_date_sep()];
$date_ = trim($date_);
- $date_ = str_replace($sep, "", $date_);
- if (strlen($date_) == 6)
+ $date = str_replace($sep, "", $date_);
+
+ if ($how > 2)
+ {
+ global $tmonths;
+ $dd = explode($sep, $date_);
+ if ($how == 3)
+ {
+ $day = $dd[1];
+ $month = array_search($dd[0], $tmonths);
+ $year = $dd[2];
+ }
+ elseif ($how == 4)
+ {
+ $day = $dd[0];
+ $month = array_search($dd[1], $tmonths);
+ $year = $dd[2];
+ }
+ else
+ {
+ $day = $dd[2];
+ $month = array_search($dd[1], $tmonths);
+ $year = $dd[0];
+ }
+ if ($year < 1000)
+ return 0;
+ }
+ elseif (strlen($date) == 6)
{
if ($how == 0)
{
- $day = substr($date_,2,2);
- $month = substr($date_,0,2);
- $year = substr($date_,4,2);
+ $day = substr($date,2,2);
+ $month = substr($date,0,2);
+ $year = substr($date,4,2);
}
elseif ($how == 1)
{
- $day = substr($date_,0,2);
- $month = substr($date_,2,2);
- $year = substr($date_,4,2);
+ $day = substr($date,0,2);
+ $month = substr($date,2,2);
+ $year = substr($date,4,2);
}
else
{
- $day = substr($date_,4,2);
- $month = substr($date_,2,2);
- $year = substr($date_,0,2);
+ $day = substr($date,4,2);
+ $month = substr($date,2,2);
+ $year = substr($date,0,2);
}
}
- elseif (strlen($date_) == 8)
+ elseif (strlen($date) == 8)
{
if ($how == 0)
{
- $day = substr($date_,2,2);
- $month = substr($date_,0,2);
- $year = substr($date_,4,4);
+ $day = substr($date,2,2);
+ $month = substr($date,0,2);
+ $year = substr($date,4,4);
}
elseif ($how == 1)
{
- $day = substr($date_,0,2);
- $month = substr($date_,2,2);
- $year = substr($date_,4,4);
+ $day = substr($date,0,2);
+ $month = substr($date,2,2);
+ $year = substr($date,4,4);
}
else
{
- $day = substr($date_,6,2);
- $month = substr($date_,4,2);
- $year = substr($date_,0,4);
+ $day = substr($date,6,2);
+ $month = substr($date,4,2);
+ $year = substr($date,0,4);
}
}
if (!isset($year)|| (int)$year > 9999)
return 0;
}
-
if (is_long((int)$day) && is_long((int)$month) && is_long((int)$year))
{
global $date_system;
list($year, $month, $day) = gregorian_to_islamic(date("Y", $timet), date("n", $timet), date("j", $timet));
return __date($year, $month, $day);
}
- return date(user_date_display(), $timet);
+ list($year, $month, $day) = explode("-", date("Y-m-d", $timet));
+ return __date($year, $month, $day);
}
function add_months($date, $months) // accepts negative values as well
list($year, $month, $day) = gregorian_to_islamic(date("Y", $timet), date("n", $timet), date("j", $timet));
return __date($year, $month, $day);
}
- return date(user_date_display(), $timet);
+ list($year, $month, $day) = explode("-", date("Y-m-d", $timet));
+ return __date($year, $month, $day);
}
function add_years($date, $years) // accepts negative values as well
list($year, $month, $day) = gregorian_to_islamic(date("Y", $timet), date("n", $timet), date("j", $timet));
return __date($year, $month, $day);
}
- return date(user_date_display(), $timet);
+ list($year, $month, $day) = explode("-", date("Y-m-d", $timet));
+ return __date($year, $month, $day);
}
//_______________________________________________________________
function date2sql($date_)
{
- global $dateseps, $date_system;
+ global $dateseps, $date_system, $tmonths;
/* takes a date in a the format specified in $DefaultDateFormat
and converts to a yyyy/mm/dd format */
$date_ = trim($date_);
$year = $month = $day = 0;
// Split up the date by the separator based on "how" to split it
- if ($how == 0) // MMDDYYYY
+ if ($how == 0 || $how == 3) // MMDDYYYY or MmmDDYYYY
list($month, $day, $year) = explode($sep, $date_);
- elseif ($how == 1) // DDMMYYYY
+ elseif ($how == 1 || $how == 4) // DDMMYYYY or DDMmYYYY
list($day, $month, $year) = explode($sep, $date_);
- else // $how == 2, YYYYMMDD
+ else // $how == 2 || $how == 5, YYYYMMDD or YYYYMmmDD
list($year, $month, $day) = explode($sep, $date_);
-
+ if ($how > 2)
+ {
+ global $tmonths;
+ $month = array_search($month, $tmonths);
+ }
//to modify assumption in 2030
if ($date_system == 0 || $date_system == 3)
{
function void_stock_move($type, $type_no)
{
- $sql = "SELECT stock_id, standard_cost, loc_code, tran_date, reference, person_id, visible, discount_percent, price,
- sum(qty) qty FROM ".TB_PREF."stock_moves WHERE type=".db_escape($type)." AND trans_no=".db_escape($type_no)."
- GROUP BY stock_id, standard_cost, loc_code, tran_date, reference, person_id, visible, discount_percent, price HAVING sum(qty) <> 0";
+ $sql = "SELECT * from ".TB_PREF."stock_moves WHERE type=".db_escape($type)." AND trans_no=".db_escape($type_no);
$result = db_query($sql, "Could not void stock moves");
while ($row = db_fetch($result))
$trans_rate, -$row["qty"], sql2date($row["tran_date"]));
}
- //Post stock move for service items also
- add_stock_move($type, $row["stock_id"], $type_no, $row["loc_code"],
- sql2date($row["tran_date"]), $row["reference"], -$row["qty"]
- , $row["standard_cost"], $row["person_id"], $row["visible"],
- $row["price"], $row["discount_percent"]);
}
+ $sql = "DELETE FROM ".TB_PREF."stock_moves WHERE type=".db_escape($type)
+ ." AND trans_no=".db_escape($type_no);
+ db_query($sql, "The stock movement cannot be delated");
}
//--------------------------------------------------------------------------------------------------
return "m".$sep."d".$sep."Y";
elseif ($this->date_format == 1)
return "d".$sep."m".$sep."Y";
- else
+ elseif ($this->date_format == 2)
return "Y".$sep."m".$sep."d";
+ elseif ($this->date_format == 3)
+ return "M".$sep."j".$sep."Y";
+ elseif ($this->date_format == 4)
+ return "j".$sep."M".$sep."Y";
+ else
+ return "Y".$sep."M".$sep."j";
}
function tho_sep()
$user = $_SESSION["wa_current_user"]->user;
- if (@$login_delay && ($login_faillog[$user][$_SERVER['REMOTE_ADDR']] >= @$login_max_attempts) && (time() < $login_faillog[$user]['last'] + $login_delay))
+ if (@$login_delay && (@$login_faillog[$user][$_SERVER['REMOTE_ADDR']] >= @$login_max_attempts) && (time() < $login_faillog[$user]['last'] + $login_delay))
return true;
return false;
BO_SUPPLIER => _("Supplier")
);
+// This month array is for use with the last 3 dateformats.
+$tmonths = array("", _("Jan"),_("Feb"),_("Mar"),_("Apr"),_("May"),_("Jun"),_("Jul"),_("Aug"),_("Sep"),_("Oct"),_("Nov"),_("Dec"));
+
?>
\ No newline at end of file
$aspect .= ' style="color:#FF0000"';
default_focus($name);
- echo "<input type=\"text\" name=\"$name\" class=\"$class\" $aspect size=\"10\" maxlength=\"12\" value=\""
+ $size = (user_date_format()>3)?11:10;
+ echo "<input type=\"text\" name=\"$name\" class=\"$class\" $aspect size=\"$size\" maxlength=\"12\" value=\""
. $_POST[$name]. "\""
.($title ? " title='$title'": '')." > $post_label";
echo "</td>\n";
if (!file_exists($fpath) || $go_debug) {
- global $dateseps, $date_system;
+ global $dateseps, $date_system, $tmonths;
$how = user_date_format(); // 0 = us/ca, 1 = eu, au, nz, 2 = jp, sw
$sep = $dateseps[user_date_sep()]; // date separator
- $wstart = (($date_system == 1 || $date_system == 2 || $date_system == 3) ? 6 : ($how == 0 ? 0 : 1)); // weekstart (sun = 0, mon = 1)
+ $wstart = (($date_system == 1 || $date_system == 2 || $date_system == 3) ? 6 : ($how == 0 || $how == 3 ? 0 : 1)); // weekstart (sun = 0, mon = 1)
$months = array(_("January"),_("February"),_("March"),_("April"),_("May"),_("June"),_("July"),_("August"),_("September"),_("October"),_("November"),_("December"));
$wdays = array(_("Su"),_("Mo"),_("Tu"),_("We"),_("Th"),_("Fr"),_("Sa"));
$wno = _("W"); // week no
var selectedDay = 0;
var months = ['$months[0]','$months[1]','$months[2]','$months[3]','$months[4]','$months[5]','$months[6]','$months[7]','$months[8]','$months[9]','$months[10]','$months[11]'];
var wdays = ['$wdays[0]', '$wdays[1]', '$wdays[2]', '$wdays[3]', '$wdays[4]', '$wdays[5]', '$wdays[6]'];
+ var tmonths = ['$tmonths[0]','$tmonths[1]','$tmonths[2]','$tmonths[3]','$tmonths[4]','$tmonths[5]','$tmonths[6]','$tmonths[7]','$tmonths[8]','$tmonths[9]','$tmonths[10]','$tmonths[11]','$tmonths[12]'];
var dateField = null;
function getProperty(p_property){
var p_elm = calendarId;
this.getWeek = getWeek;
function getWeek(year, month, day) {
";
- if ($how == 0)
+ if ($how == 0 || $how == 3)
$js .= " day++;";
$js .= "
var date = new Date(year,month-1,day);
}
this.setDate = setDate;
function setDate(year, month, day) {
- if (dateField) {
+ if (dateField){
+";
+ if ($how < 3)
+ $js .= "
if (month < 10) {month = '0' + month;}
if (day < 10) {day = '0' + day;}
";
- if ($how == 0)
+ else
+ $js .= "
+ month = tmonths[month];
+";
+ if ($how == 0 || $how == 3)
$js .= "
var dateString = month+'$sep'+day+'$sep'+year;
";
- else if ($how == 1)
+ else if ($how == 1 || $how == 4)
$js .= "
var dateString = day+'$sep'+month+'$sep'+year;
";
- else
+ else if ($how == 2 || $how == 5)
$js .= "
var dateString = year+'$sep'+month+'$sep'+day;
";
selectedMonth = parseInt(dateParts[1],10);
selectedYear = parseInt(dateParts[2],10);
";
- else
+ else if ($how == 2)
$js .= "
selectedYear = parseInt(dateParts[0],10);
selectedMonth = parseInt(dateParts[1],10);
selectedDay = parseInt(dateParts[2],10);
+";
+ else if ($how == 3)
+ $js .= "
+ selectedDay = parseInt(dateParts[1],10);
+ selectedMonth = parseInt(tmonths.indexOf(dateParts[0]),10);
+ selectedYear = parseInt(dateParts[2],10);
+";
+ else if ($how == 4)
+ $js .= "
+ selectedDay = parseInt(dateParts[0],10);
+ selectedMonth = parseInt(tmonths.indexOf(dateParts[1]),10);
+ selectedYear = parseInt(dateParts[2],10);
+";
+ else
+ $js .= "
+ selectedYear = parseInt(dateParts[0],10);
+ selectedMonth = parseInt(tmonths.indexOf(dateParts[1]),10);
+ selectedDay = parseInt(dateParts[2],10);
";
$js .= "
} catch(e) {}
*/
function fix_date(date, last)
{
- var regex = /(\d+)[^\d]*(\d+)*[^\d]*(\d+)*/;
- var dat = regex.exec(last);
- var cur = regex.exec(date);
+ var dat = last.split(user.datesep);
+ var cur = date.split(user.datesep);
var day, month, year;
+ var day1, month1, year1;
// TODO: user.date as default?
// TODO: user.datesys
- if (!dat || !cur) return date;
-
- if (cur[3] != undefined) // full date entered
- dat = cur;
-
- if (user.datefmt == 0) // set defaults
+ if (date == "" || date == last) // should we return an empty date or should we return last?
+ return date;
+ if (user.datefmt == 0 || user.datefmt == 3) // set defaults
{
- day = dat[2]; month = dat[1]; year = dat[3];
- } else if (user.datefmt == 1)
- {
- day = dat[1]; month = dat[2]; year = dat[3];
+ day = dat[1]; month = dat[0]; year = dat[2];
+ day1 = cur[1]; month1 = cur[0]; year1 = cur[2];
+ } else if (user.datefmt == 1 || user.datefmt == 4){
+ day = dat[0]; month = dat[1]; year = dat[2];
+ day1 = cur[0]; month1 = cur[1]; year1 = cur[2];
} else {
- day = dat[3]; month = dat[2]; year = dat[1];
- }
-
- if (cur[2] == undefined) // only day entred
- day = cur[1];
- else // day + month
- if (cur[2] != undefined)
- {
- if (user.datefmt==1)
- { day = cur[1]; month = cur[2] }
- else
- { day = cur[2]; month = cur[1] }
- }
-
- if (day<10) day = '0'+parseInt(day, 10);
- if (month<10) month = '0'+parseInt(month, 10);
+ day = dat[2]; month = dat[1]; year = dat[0];
+ day1 = cur[2]; month1 = cur[1]; year1 = cur[0];
+ }
+ if (day1 != undefined && day1 != "") // day entered
+ day = day1;
+ if (month1 != undefined && month1 != "") // month entered
+ month = month1;
+ if (year1 != undefined && year1 != "") // year entered
+ year = year1;
+ if (user.datefmt<3 && day<10) day = '0'+parseInt(day, 10);
+ if (user.datefmt<3 && month<10) month = '0'+parseInt(month, 10);
if (year<100) year = year<60 ? (2000+parseInt(year,10)) : (1900+parseInt(year,10));
// console.info(day,month,year)
- if (user.datefmt == 0)
+ if (user.datefmt == 0 || user.datefmt==3)
return month+user.datesep+day+user.datesep+year;
- if (user.datefmt == 1)
+ if (user.datefmt == 1 || user.datefmt==4)
return day+user.datesep+month+user.datesep+year;
return year+user.datesep+month+user.datesep+day;
}
$this->formData['document_number'] = $print_invoice_no == 0 && isset($this->formData['reference'])
? $this->formData['reference'] : $this->formData['order_no'];
$aux_info = array(
- _("Customers Reference") => $this->formData["customer_ref"],
+ _("Customer's Reference") => $this->formData["customer_ref"],
_("Sales Person") => get_salesman_name($this->formData['salesman']),
_("Your VAT no.") => $this->formData['tax_id'],
_("Our Quotation No") => $this->formData['order_no'],
$this->formData['document_amount'] = $this->formData['order_no'];
$aux_info = array(
- _("Customers Reference") => $this->formData["customer_ref"],
+ _("Customer's Reference") => $this->formData["customer_ref"],
_("Sales Person") => get_salesman_name($this->formData['salesman']),
_("Your VAT no.") => $this->formData['tax_id'],
_("Our Order No") => $this->formData['order_no'],
$ref = $this->formData['order_'];
}
$aux_info = array(
- _("Customers Reference") => $this->formData["customer_ref"],
+ _("Customer's Reference") => $this->formData["customer_ref"],
_("Sales Person") => get_salesman_name($this->formData['salesman']),
_("Your VAT no.") => $this->formData['tax_id'],
_("Our Order No") => $ref,
$Footer[0] = _("Please quote Credit no. when paying. All amounts stated in") . " - " . $this->formData['curr_code'];
$aux_info = array(
- _("Customers Reference") => @$this->formData["customer_ref"],
+ _("Customer's Reference") => @$this->formData["customer_ref"],
_("Sales Person") => get_salesman_name($this->formData['salesman']),
_("Your VAT no.") => $this->formData['tax_id'],
_("Our Order No") => $this->formData['order_'],
}
}
$aux_info = array(
- _("Customers Reference") => $this->formData["customer_ref"],
+ _("Customer's Reference") => $this->formData["customer_ref"],
_("Sales Person") => get_salesman_name($this->formData['salesman']),
_("Your VAT no.") => $this->formData['tax_id'],
);
$Addr2['address'] = '';
$aux_info = array(
- _("Customers Reference") => $this->formData['supp_account_no'],
+ _("Customer's Reference") => $this->formData['supp_account_no'],
_("Type") =>$systypes_array[$this->formData["type"]],
_("Your VAT no.") => $this->formData['tax_id'],
- _("Our Order No") => '',
+ _("Supplier's Reference") => '',
_("Due Date") => sql2date($this->formData['tran_date']),
);
$this->headers = array(_("Trans Type"), _("#"), _("Date"), _("Due Date"), _("Total Amount"), _("Left to Allocate"), _("This Allocation"));
? $this->formData['reference'] : $this->formData['order_no'];
$aux_info = array(
- _("Customers Reference") => $this->formData['supp_account_no'],
- _("Sales Person") => '',
- _("Your VAT no.") => '',
- _("Our Order No") => '',
- _("Due Date") => '',
+ _("Customer's Reference") => $this->formData['supp_account_no'],
+ _("Sales Person") => $this->formData['contact'],
+ _("Your VAT no.") => $this->formData['tax_id'],
+ _("Supplier's Reference") => $this->formData['requisition_no'],
+ _("Order Date") => sql2date($this->formData['document_date']),
);
$this->headers = array(_("Item Code"), _("Item Description"),
$this->formData['document_name'] =_("Receipt No.");
$Addr1['title'] = _("With thanks from");
$aux_info = array(
- _("Customers Reference") => $this->formData["debtor_ref"],
+ _("Customer's Reference") => $this->formData["debtor_ref"],
_("Type") =>$systypes_array[$this->formData["type"]],
_("Your VAT no.") => $this->formData['tax_id'],
_("Our Order No") => $this->formData['order_'],
$Payment_Terms = '';
$this->title = _("STATEMENT");
$aux_info = array(
- _("Customers Reference") => '',
+ _("Customer's Reference") => '',
_("Sales Person") => '',
_("Your VAT no.") => $this->formData['tax_id'],
_("Our Order No") => '',
'DebtorName', 'supp_account_no', 'wo_ref', 'debtor_ref','type', 'trans_no',
'StockItemName', 'tax_id', 'order_', 'delivery_date', 'units_issued',
'due_date', 'required_by', 'payment_terms', 'curr_code',
- 'ov_freight', 'ov_gst', 'ov_amount', 'prepaid'),
+ 'ov_freight', 'ov_gst', 'ov_amount', 'prepaid', 'requisition_no', 'contact'),
'branch' => array('br_address', 'br_name', 'salesman', 'disable_branch'),
'sales_order' => array('deliver_to', 'delivery_address', 'customer_ref'),
'bankaccount' => array('bank_name', 'bank_account_number', 'payment_service')
function get_po($order_no)
{
$sql = "SELECT ".TB_PREF."purch_orders.*, ".TB_PREF."suppliers.supp_name, "
- .TB_PREF."suppliers.supp_account_no,".TB_PREF."suppliers.tax_included,".TB_PREF."suppliers.tax_algorithm,
+ .TB_PREF."suppliers.supp_account_no,".TB_PREF."suppliers.tax_included,".TB_PREF."suppliers.tax_algorithm,".TB_PREF."suppliers.gst_no AS tax_id,
".TB_PREF."suppliers.curr_code, ".TB_PREF."suppliers.payment_terms, ".TB_PREF."locations.location_name,
".TB_PREF."suppliers.address, ".TB_PREF."suppliers.contact, ".TB_PREF."suppliers.tax_group_id
FROM ".TB_PREF."purch_orders, ".TB_PREF."suppliers, ".TB_PREF."locations
echo "<div class=tabs>";
foreach($applications as $app)
{
- if ($this->check_application_access($app))
+ if ($_SESSION["wa_current_user"]->check_application_access($app))
{
$acc = access_string($app->name);
echo "<a class='".($sel_app == $app->id ? 'selected' : 'menu_tab')
global $path_to_root;
$selected_app = $waapp->get_selected_application();
- if (!$this->check_application_access($selected_app))
+ if (!$_SESSION["wa_current_user"]->check_application_access($selected_app))
return;
foreach ($selected_app->modules as $module)
{
- if (!$this->check_module_access($module))
+ if (!$_SESSION["wa_current_user"]->check_module_access($module))
continue;
// image
echo "<tr>";
{
echo $img.menu_link($appfunction->link, $appfunction->label)."<br>\n";
}
- elseif (!$this->hide_inaccessible_menu_items())
+ elseif (!$_SESSION["wa_current_user"]->hide_inaccessible_menu_items())
{
echo $img.'<span class="inactive">'
.access_string($appfunction->label, true)
{
echo $img.menu_link($appfunction->link, $appfunction->label)."<br>\n";
}
- elseif (!$this->hide_inaccessible_menu_items())
+ elseif (!$_SESSION["wa_current_user"]->hide_inaccessible_menu_items())
{
echo $img.'<span class="inactive">'
.access_string($appfunction->label, true)
echo "</table>";
}
-
- function check_application_access($waapp)
- {
- if (!$this->hide_inaccessible_menu_items())
- {
- return true;
- }
-
- foreach ($waapp->modules as $module)
- {
- if ($this->check_module_access($module))
- {
- return true;
- }
- }
-
- return false;
-
- }
-
- function check_module_access($module)
- {
-
- if (!$this->hide_inaccessible_menu_items())
- {
- return true;
- }
-
- if (sizeof($module->lappfunctions) > 0)
- {
- foreach ($module->lappfunctions as $appfunction)
- {
- if ($appfunction->label != "" && $_SESSION["wa_current_user"]->can_access_page($appfunction->access))
- {
- return true;
- }
- }
- }
-
- if (sizeof($module->rappfunctions) > 0)
- {
- foreach ($module->rappfunctions as $appfunction)
- {
- if ($appfunction->label != "" && $_SESSION["wa_current_user"]->can_access_page($appfunction->access))
- {
- return true;
- }
- }
- }
-
- return false;
-
- }
-
- function hide_inaccessible_menu_items()
- {
- global $hide_inaccessible_menu_items;
-
- if (!isset($hide_inaccessible_menu_items) || $hide_inaccessible_menu_items == 0)
- {
- return false;
- }
-
- else
- {
- return true;
- }
- }
}
?>
\ No newline at end of file
echo "<div class=tabs>";
foreach($applications as $app)
{
- if ($this->check_application_access($app))
+ if ($_SESSION["wa_current_user"]->check_application_access($app))
{
$acc = access_string($app->name);
echo "<a class='".($sel_app == $app->id ? 'selected' : 'menu_tab')
{
global $path_to_root;
$selected_app = $waapp->get_selected_application();
- if (!$this->check_application_access($selected_app))
+ if (!$_SESSION["wa_current_user"]->check_application_access($selected_app))
return;
foreach ($selected_app->modules as $module)
{
- if (!$this->check_module_access($module))
+ if (!$_SESSION["wa_current_user"]->check_module_access($module))
continue;
// image
echo "<tr>";
{
echo $img.menu_link($appfunction->link, $appfunction->label)."<br>\n";
}
- elseif (!$this->hide_inaccessible_menu_items())
+ elseif (!$_SESSION["wa_current_user"]->hide_inaccessible_menu_items())
{
echo $img.'<span class="inactive">'
.access_string($appfunction->label, true)
{
echo $img.menu_link($appfunction->link, $appfunction->label)."<br>\n";
}
- elseif (!$this->hide_inaccessible_menu_items())
+ elseif (!$_SESSION["wa_current_user"]->hide_inaccessible_menu_items())
{
echo $img.'<span class="inactive">'
.access_string($appfunction->label, true)
echo "</table>";
}
-
- function check_application_access($waapp)
- {
- if (!$this->hide_inaccessible_menu_items())
- {
- return true;
- }
-
- foreach ($waapp->modules as $module)
- {
- if ($this->check_module_access($module))
- {
- return true;
- }
- }
-
- return false;
-
- }
-
- function check_module_access($module)
- {
-
- if (!$this->hide_inaccessible_menu_items())
- {
- return true;
- }
-
- if (sizeof($module->lappfunctions) > 0)
- {
- foreach ($module->lappfunctions as $appfunction)
- {
- if ($appfunction->label != "" && $_SESSION["wa_current_user"]->can_access_page($appfunction->access))
- {
- return true;
- }
- }
- }
-
- if (sizeof($module->rappfunctions) > 0)
- {
- foreach ($module->rappfunctions as $appfunction)
- {
- if ($appfunction->label != "" && $_SESSION["wa_current_user"]->can_access_page($appfunction->access))
- {
- return true;
- }
- }
- }
-
- return false;
-
- }
-
- function hide_inaccessible_menu_items()
- {
- global $hide_inaccessible_menu_items;
-
- if (!isset($hide_inaccessible_menu_items) || $hide_inaccessible_menu_items == 0)
- {
- return false;
- }
-
- else
- {
- return true;
- }
- }
}
?>
\ No newline at end of file
function menu_header($title, $no_menu, $is_index)
{
- global $path_to_root, $help_base_url, $db_connections, $show_inaccessible_menu_items;
+ global $path_to_root, $help_base_url, $db_connections;
echo "<table class='callout_main' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td colspan='2' rowspan='2'>\n";
echo "<div class=tabs>";
foreach($applications as $app)
{
- if ($this->check_application_access($app))
+ if ($_SESSION["wa_current_user"]->check_application_access($app))
{
$acc = access_string($app->name);
echo "<a class='".($sel_app == $app->id ? 'selected' : 'menu_tab')
global $path_to_root;
$selected_app = $waapp->get_selected_application();
- if (!$this->check_application_access($selected_app))
+ if (!$_SESSION["wa_current_user"]->check_application_access($selected_app))
return;
foreach ($selected_app->modules as $module)
{
- if (!$this->check_module_access($module))
+ if (!$_SESSION["wa_current_user"]->check_module_access($module))
continue;
// image
echo "<tr>";
{
echo $img.menu_link($appfunction->link, $appfunction->label)."<br>\n";
}
- elseif (!$this->hide_inaccessible_menu_items())
+ elseif (!$_SESSION["wa_current_user"]->hide_inaccessible_menu_items())
{
echo $img.'<span class="inactive">'
.access_string($appfunction->label, true)
{
echo $img.menu_link($appfunction->link, $appfunction->label)."<br>\n";
}
- elseif (!$this->hide_inaccessible_menu_items())
+ elseif (!$_SESSION["wa_current_user"]->hide_inaccessible_menu_items())
{
echo $img.'<span class="inactive">'
.access_string($appfunction->label, true)
}
echo "</table>";
}
-
- function check_application_access($waapp)
- {
- if (!$this->hide_inaccessible_menu_items())
- {
- return true;
- }
-
- foreach ($waapp->modules as $module)
- {
- if ($this->check_module_access($module))
- {
- return true;
- }
- }
-
- return false;
-
- }
-
- function check_module_access($module)
- {
-
- if (!$this->hide_inaccessible_menu_items())
- {
- return true;
- }
-
- if (sizeof($module->lappfunctions) > 0)
- {
- foreach ($module->lappfunctions as $appfunction)
- {
- if ($appfunction->label != "" && $_SESSION["wa_current_user"]->can_access_page($appfunction->access))
- {
- return true;
- }
- }
- }
-
- if (sizeof($module->rappfunctions) > 0)
- {
- foreach ($module->rappfunctions as $appfunction)
- {
- if ($appfunction->label != "" && $_SESSION["wa_current_user"]->can_access_page($appfunction->access))
- {
- return true;
- }
- }
- }
-
- return false;
-
- }
-
- function hide_inaccessible_menu_items()
- {
- global $hide_inaccessible_menu_items;
-
- if (!isset($hide_inaccessible_menu_items) || $hide_inaccessible_menu_items == 0)
- {
- return false;
- }
-
- else
- {
- return true;
- }
- }
}