! -> Note
$ -> Affected files
+20-Jan-2010 Merged changes from main trunk 2.2.4-2.2.5 as follows
+------------------------------- Release 2.2.5 ----------------------------------
+02-Feb-2010 Joe Hunt
+! Release 2.2.5
+$ $config.default.php
+ update.html
+# Bug in direct invoice when cash sales and no cash account defined in sales pos.
+$ /sales/sales_order_entry.php
+
+01-Feb-2010 Janusz Dobrowolski
+# Fixed error display hidden during ajax call in some situations
+$ /includes/errors.inc
+! Ajax timeout changed to 6/60s without retries, otherwise multiply
+ errors are generated on fatal failure.
+$ /js/utils.js
+ /js/inserts.js
+
+01-Feb-2010 Joe Hunt
+# [0000198] Bug ignoring shipping cost in Direct Invoice (cash).
+$ /sales/sales_order_entry.php
+# [0000197] Bug in closing some special balance sheet levels.
+$ /gl/inquiry/balance_sheet.php
+ /reporting/rep705.php
+ /reporting/rep706.php
+ /reporting/rep707.php
+
+31-Jan-2010 Joe Hunt
+# Bug in Quick Entries with Tax added.
+$ /includes/ui/ui_view.inc
+
+30-Jan-2010 Joe Hunt/Chaitanya
++ Added a Balance Sheet drilldown inquiry in Banking and GL.
+ Contributed by Chatanya. Magnificient!
+$ /applications/generalledger.php
+ /gl/inquiry/balance_sheet.php (new file)
+ /gl/inquiry/gl_account_inquiry.php
++ Added Purchase tax account in en_US-new.sql and en_US-demo.sql
+$ /sql/en_US-demo.sql
+ /sql/en_US_new.sql
+# Fixed bug in gl accounts checks
+ /taxes/tax_types.php
+
+30-Jan-2010 Janusz Dobrowolski
+# [0000194] Fixed tax records from journal entry (voiding problem)
+$ /gl/includes/db/gl_db_trans.inc
+ /reporting/rep709.php
+
+25-Jan-2010 Joe Hunt
+# [0000195] Bug not deleting refs record when deleting Sales Order, Quotation
+# A couple of redirecting bugs
+$ /sales/sales_order_entry.php
+ /sales/includes/db/sales_order_db.inc
+# Bug in the sequence in sales price pickup
+$ /sales/includes/sales_db.inc
++ Added document Receipt and small rearrangements and bugfixes
+$ /includes/types.inc
+ /includes/ui/ui_view.inc
+ /reporting/rep107.php
+ /reporting/rep108.php
+ /reporting/rep109.php
+ /reporting/rep110.php
+ /reporting/rep111.php
+ /reporting/rep112.php (new document file)
+ /reporting/rep209.php
+ /reporting/rep210.php
+ /reporting/reports_main.php
+ /reporting/includes/doctext.inc
+ /reporting/includes/doctext2.inc
+ /reporting/includes/header2.inc
+ /reporting/includes/reporting.inc
+ /reporting/includes/reports_classes.inc
+ /sales/customer_payments.php
+ /sales/sales_order_entry.php
+ /sales/inquiry/customer_inquiry.php
+
+22-Jan-2010 Tom Hallman/Joe Hunt
+# Exchange rate doesn't update table when adding new or deleting rate
+$ /gl/manage/exchange_rates.php
+! Small adjustments to Bank Statement and GL Transactions Reports
+$ /reporting/rep601.php
+ /reporting/rep704.php
+! Layout fix for Report Selectors in when running in Windows OS.
+$ /reporting/includes/reports_classes.inc
+
+20-Jan-2010 Joe Hunt
+! Put a heavy warning on marking the checkbox 'Allow Negative Inventory'.
+$ /admin/gl_setup.php
+
+18-Jan-2010 Joe Hunt
+# Demand was calculated double from Sales Quotation. Should be 0.
+$ /includes/db/manufacturing_db.inc
+# A back link was still in Bank Transfer.
+$ /gl/bank_transfer.php
+
+---------- End of changes from main trunk 2.2.4-2.2.5
+
26-Jan-2010 Janusz Dobrowolski
+ Editable sales terms in sales orders and invoices, default terms from customer record.
$ /admin/db/company_db.inc
$ /js/utils.js
20-Jan-2010 Merged changes from main trunk 2.2.3-2.2.4 as follows
+
------------------------------- Release 2.2.4 ----------------------------------
17-Jan-2010 Joe Hunt
! Release 2.2.4
table_section_title(_("Inventory"));
check_row(_("Allow Negative Inventory:"), 'allow_negative_stock', null);
+label_row(null, _("Warning: Checking this will result in incorrect values in General Ledger"), "", "class='stockmankofg' colspan=2");
table_section_title(_("Items Defaults"));
gl_all_accounts_list_row(_("Sales Account:"), 'default_inv_sales_act', $_POST['default_inv_sales_act']);
$this->add_rapp_function(1, _("Trial &Balance"),
"gl/inquiry/gl_trial_balance.php?", 'SA_GLANALYTIC');
+ $this->add_rapp_function(1, _("Balance &Sheet"),
+ "gl/inquiry/balance_sheet.php?", 'SA_GLANALYTIC');
$this->add_rapp_function(1, _("Banking &Reports"),
"reporting/reports_main.php?Class=5", 'SA_BANKREP');
$this->add_rapp_function(1, _("General Ledger &Reports"),
// Main Title
$app_title = "FrontAccounting";
// application version
- $version = "2.3 CVS (m4)";
+ $version = "2.3 CVS (m5)";
// src-data compatibility check. Do not change.
$core_version = "2.3";
hyperlink_no_params($_SERVER['PHP_SELF'], _("Enter &Another Transfer"));
- safeExit();
+ display_footer_exit();
}
if (isset($_POST['_DatePaid_changed'])) {
//----------------------------------------------------------------------------------------
-function safeExit()
-{
- echo "<br><br>";
- end_page();
- exit;
-}
-
-//----------------------------------------------------------------------------------------
-
if (isset($_POST['AddPayment']))
{
if (check_valid_entries() == true)
{
handle_add_deposit();
- safeExit();
}
}
if(!$tax_type) return; // $gl_code is not tax account
$tax = get_tax_type($tax_type);
- //if ($gl_code == $tax['sales_gl_code'])
- // $amount = -$amount;
+ if ($gl_code == $tax['sales_gl_code'])
+ $amount = -$amount;
// we have to restore net amount as we cannot know the base amount
if ($tax['rate'] == 0) {
// display_warning(_("You should not post gl transactions
$todate = date2sql($to);
$sql = "SELECT
+ SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE
+ ." || trans_type=".ST_JOURNAL.",-1,1)*
+ IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE
+ ." || (trans_type=".ST_JOURNAL ." AND amount<0)"
+ ." || trans_type=".ST_CUSTCREDIT.", net_amount*ex_rate,0)) net_output,
+
+ SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE
+ ." || trans_type=".ST_JOURNAL.",-1,1)*
+ IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE
+ ." || (trans_type=".ST_JOURNAL ." AND amount<0)"
+ ." || trans_type=".ST_CUSTCREDIT.", amount*ex_rate,0)) payable,
+
SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE.",-1,1)*
- IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE." || trans_type=".ST_CUSTCREDIT.", net_amount*ex_rate,0)) net_output,
- SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE.",-1,1)*
- IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE." || trans_type=".ST_CUSTCREDIT.", amount*ex_rate,0)) payable,
- SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE.",-1,1)*
- IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE." || trans_type=".ST_CUSTCREDIT.", 0, net_amount*ex_rate)) net_input,
+ IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE
+ ." || (trans_type=".ST_JOURNAL ." AND amount<0)"
+ ." || trans_type=".ST_CUSTCREDIT.", 0, net_amount*ex_rate)) net_input,
+
SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE.",-1,1)*
- IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE." || trans_type=".ST_CUSTCREDIT.", 0, amount*ex_rate)) collectible,
+ IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE
+ ." || (trans_type=".ST_JOURNAL ." AND amount<0)"
+ ." || trans_type=".ST_CUSTCREDIT.", 0, amount*ex_rate)) collectible,
taxrec.rate,
ttype.id,
ttype.name
}
// store tax details if the gl account is a tax account
add_gl_tax_details($journal_item->code_id,
- ($journal_item->amount < 0.0 ? ST_BANKDEPOSIT : ST_BANKPAYMENT), $trans_id, -$journal_item->amount, 1, $date_, $memo_);
+ ST_JOURNAL, $trans_id, $journal_item->amount, 1, $date_, $memo_);
}
if ($new) {
}
// store tax details if the gl account is a tax account
add_gl_tax_details($journal_item->code_id,
- ($journal_item->amount < 0.0 ? ST_BANKDEPOSIT : ST_BANKPAYMENT), $trans_id, $journal_item->amount, 1, $reversingDate, $memo_);
+ ST_JOURNAL, $trans_id, $journal_item->amount, 1, $reversingDate, $memo_);
}
add_comments($trans_type, $trans_id_reverse, $reversingDate, $memo_);
--- /dev/null
+<?php
+/**********************************************************************
+ Copyright (C) FrontAccounting, LLC.
+ Released under the terms of the GNU General Public License, GPL,
+ as published by the Free Software Foundation, either version 3
+ of the License, or (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
+$page_security = 'SA_GLANALYTIC';
+$path_to_root="../..";
+
+include_once($path_to_root . "/includes/session.inc");
+
+include_once($path_to_root . "/includes/date_functions.inc");
+include_once($path_to_root . "/includes/ui.inc");
+include_once($path_to_root . "/includes/data_checks.inc");
+
+include_once($path_to_root . "/gl/includes/gl_db.inc");
+
+$js = "";
+if ($use_date_picker)
+ $js = get_js_date_picker();
+
+page(_($help_context = "Balance Sheet"), false, false, "", $js);
+
+//----------------------------------------------------------------------------------------------------
+// Ajax updates
+
+if (get_post('Show'))
+{
+ $Ajax->activate('balance_tbl');
+}
+
+if (isset($_GET["TransFromDate"]))
+ $_POST["TransFromDate"] = $_GET["TransFromDate"];
+if (isset($_GET["TransToDate"]))
+ $_POST["TransToDate"] = $_GET["TransToDate"];
+if (isset($_GET["AccGrp"]))
+ $_POST["AccGrp"] = $_GET["AccGrp"];
+
+//----------------------------------------------------------------------------------------------------
+
+function is_of_account_type($accttype,$typeslist)
+{
+ return in_array($accttype, $typeslist);
+}
+
+function get_child_account_types($acctype)
+{
+ global $parentsarr;
+ $parentsarr = array();
+ $childernsarr = array();
+ $list = '';
+ array_push($parentsarr, $acctype);
+ while (sizeof($parentsarr)>0)
+ {
+ $parent = array_pop($parentsarr);
+ array_push($childernsarr,$parent);
+ pushchilds($parent);
+ }
+ $list = substr($list,0,-1);
+ return $childernsarr;
+}
+
+function pushchilds($parent)
+{
+ global $parentsarr;
+
+ $sql = "SELECT id FROM ".TB_PREF."chart_types WHERE parent=".$parent;
+ $result = db_query($sql,"Query failed");
+ while ($myrow=db_fetch($result))
+ {
+ array_push($parentsarr, $myrow['id']);
+ }
+}
+
+function inquiry_controls()
+{
+
+ start_table("class='tablestyle_noborder'");
+ date_cells(_("As at:"), 'TransToDate');
+ submit_cells('Show',_("Show"),'','', 'default');
+ end_table();
+
+ hidden('TransFromDate');
+ hidden('AccGrp');
+
+}
+
+function print_balance_sheet()
+{
+ global $comp_path, $path_to_root, $table_style;
+
+ $from = begin_fiscalyear();
+ $to = $_POST['TransToDate'];
+
+ $dim = get_company_pref('use_dimension');
+ $dimension = $dimension2 = 0;
+
+ $classname = '';
+ $classopen = 0.0;
+ $classperiod = 0.0;
+ $classclose = 0.0;
+ $assetsopen = 0.0;
+ $assetsperiod = 0.0;
+ $assetsclose = 0.0;
+ $equityopen = 0.0;
+ $equityperiod = 0.0;
+ $equityclose = 0.0;
+ $lopen = 0.0;
+ $lperiod = 0.0;
+ $lclose = 0.0;
+
+ $typeopen = array(0,0,0,0,0,0,0,0,0,0);
+ $typeperiod = array(0,0,0,0,0,0,0,0,0,0);
+ $typeclose = array(0,0,0,0,0,0,0,0,0,0);
+ $typename = array('','','','','','','','','','');
+ $acctype = array('','','','','','','','','','');
+ $closing = array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1);
+ //$parent = array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1);
+ $level = 0;
+ $last = -1;
+
+ $closeclass = false;
+ $ctype = 0;
+ $convert = 1;
+
+ $accounts = get_gl_accounts_all(1);
+
+ div_start('balance_tbl');
+
+ start_table("width=30% $table_style");
+
+ while ($account=db_fetch($accounts))
+ {
+ if ($account['account_code'] == null && $account['parent'] > 0)
+ continue;
+
+ //Check for confirming the account type
+ if (isset($_POST['AccGrp']) && (strlen($_POST['AccGrp']) > 0) )
+ {
+ $sub_types_arr = get_child_account_types($_POST['AccGrp']);
+ if (!is_of_account_type($account['AccountType'], $sub_types_arr))
+ continue;
+ }
+
+ if ($account['account_code'] != null)
+ {
+ $prev_balance = get_gl_balance_from_to("", $from, $account["account_code"], $dimension, $dimension2);
+
+ $curr_balance = get_gl_trans_from_to($from, $to, $account["account_code"], $dimension, $dimension2);
+
+ if (!$prev_balance && !$curr_balance)
+ continue;
+ }
+ if ($account['AccountClassName'] != $classname)
+ {
+ if ($classname != '')
+ {
+ $closeclass = true;
+ }
+ }
+ if ($account['AccountTypeName'] != $typename[$level])
+ {
+ if ($typename[$level] != '')
+ {
+ for ( ; $level >= 0, $typename[$level] != ''; $level--)
+ {
+ if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0 || $closeclass)
+ {
+
+ $url = "<a href='$path_to_root/gl/inquiry/balance_sheet.php?TransFromDate="
+ . $from . "&TransToDate=" . $to
+ . "&AccGrp=" . $acctype[$level] . "'>" . $typename[$level] . "</a>";
+
+ alt_table_row_color($k);
+ label_cell($url);
+ amount_cell($typeclose[$level] * $convert);
+ end_row();
+
+ $typeopen[$level] = $typeperiod[$level] = $typeclose[$level] = 0.0;
+ }
+ else
+ break;
+ }
+
+ if ($closeclass)
+ {
+ start_row("class='inquirybg' style='font-weight:bold'");
+ label_cell(_('Total') . " " . $classname);
+ amount_cell($classclose * $convert, true);
+ end_row();
+
+ if ($ctype == CL_EQUITY)
+ {
+ $equityopen += $classopen;
+ $equityperiod += $classperiod;
+ $equityclose += $classclose;
+ }
+ if ($ctype == CL_LIABILITIES)
+ {
+ $lopen += $classopen;
+ $lperiod += $classperiod;
+ $lclose += $classclose;
+ }
+ $assetsopen += $classopen;
+ $assetsperiod += $classperiod;
+ $assetsclose += $classclose;
+ $classopen = $classperiod = $classclose = 0.0;
+
+ $closeclass = false;
+ }
+ }
+ if ($account['AccountClassName'] != $classname)
+ {
+ if (isset($_POST['AccGrp']) && (strlen($_POST['AccGrp']) > 0))
+ table_section_title($account['AccountTypeName']);
+ else
+ table_section_title($account['AccountClassName']);
+ }
+ $level++;
+ if ($account['parent'] != $last)
+ $last = $account['parent'];
+ $typename[$level] = $account['AccountTypeName'];
+
+ $acctype[$level] = $account['AccountType'];
+
+ $closing[$level] = $account['parent'];
+
+ }
+ $classname = $account['AccountClassName'];
+ $classtype = $account['AccountType'];
+ $ctype = $account['ClassType'];
+ $convert = get_class_type_convert($ctype);
+
+ if ($account['account_code'] != null)
+ {
+ for ($i = 0; $i <= $level; $i++)
+ {
+ $typeopen[$i] += $prev_balance;
+ $typeperiod[$i] += $curr_balance;
+ $typeclose[$i] = $typeopen[$i] + $typeperiod[$i];
+ }
+ $classopen += $prev_balance;
+ $classperiod += $curr_balance;
+ $classclose = $classopen + $classperiod;
+
+ //Show accounts details only for drill down and direct child of Account Group
+ if ( isset($_POST['AccGrp']) && ($account['AccountType'] == $_POST['AccGrp']))
+ {
+ $url = "<a href='$path_to_root/gl/inquiry/gl_account_inquiry.php?TransFromDate="
+ . $from . "&TransToDate=" . $to
+ . "&account=" . $account['account_code'] . "'>" . $account['account_code']
+ ." ". $account['account_name'] ."</a>";
+
+ start_row("class='stockmankobg'");
+ label_cell($url);
+ amount_cell(($curr_balance + $prev_balance) * $convert);
+ end_row();
+ }
+ }
+ }
+
+ if ($account['AccountClassName'] != $classname)
+ {
+ if ($classname != '')
+ {
+ $closeclass = true;
+ }
+ }
+ if ($account['AccountTypeName'] != $typename[$level])
+ {
+
+ if ($typename[$level] != '')
+ {
+ for ( ; $level >= 0, $typename[$level] != ''; $level--)
+ {
+ if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0 || $closeclass)
+ {
+ //Inside drill down, no hyperlink
+ if (isset($_POST['AccGrp']) && (strlen($_POST['AccGrp']) > 0) && ($acctype[$level] == $_POST['AccGrp']))
+ {
+ start_row("class='inquirybg' style='font-weight:bold'");
+ label_cell(_('Total') . " " .$typename[$level]);
+ amount_cell($typeclose[$level] * $convert);
+ end_row();
+ }
+ else
+ {
+ $url = "<a href='$path_to_root/gl/inquiry/balance_sheet.php?TransFromDate="
+ . $from . "&TransToDate=" . $to
+ . "&AccGrp=" . $acctype[$level] . "'>" . $typename[$level] . "</a>";
+
+ alt_table_row_color($k);
+ label_cell($url);
+ amount_cell($typeclose[$level] * $convert);
+ end_row();
+ }
+
+ $typeopen[$level] = $typeperiod[$level] = $typeclose[$level] = 0.0;
+
+ }
+ else
+ break;
+
+ }
+
+ if (($closeclass) && !(isset($_POST['AccGrp']) && (strlen($_POST['AccGrp']) > 0)) )
+ {
+ $calculateopen = -$assetsopen - $classopen;
+ $calculateperiod = -$assetsperiod - $classperiod;
+ $calculateclose = -$assetsclose - $classclose;
+ if ($ctype == CL_EQUITY)
+ {
+ $equityopen += $classopen;
+ $equityperiod += $classperiod;
+ $equityclose += $classclose;
+ }
+
+ alt_table_row_color($k);
+ label_cell(_('Calculated Return'));
+ amount_cell($calculateclose * $convert);
+ end_row();
+
+ start_row("class='inquirybg' style='font-weight:bold'");
+ label_cell(_('Total') . " " . $classname);
+ amount_cell(-$assetsclose * $convert);
+ end_row();
+
+ if ($equityopen != 0.0 || $equityperiod != 0.0 || $equityclose != 0.0 ||
+ $lopen != 0.0 || $lperiod != 0.0 || $lclose != 0.0)
+ {
+ alt_table_row_color($k);
+ label_cell(_('Total') . " " . _('Liabilities') . _(' and ') . _('Equities'));
+ amount_cell(($lclose + $equityclose + $calculateclose) * -1);
+ end_row();
+ }
+ }
+ }
+ }
+ end_table(1); // outer table
+ div_end();
+}
+
+//----------------------------------------------------------------------------------------------------
+
+start_form();
+
+inquiry_controls();
+
+print_balance_sheet();
+
+end_form();
+
+end_page();
+
+?>
+
div_start('trans_tbl');
-if (get_post('Show'))
+if (get_post('Show') || get_post('account'))
show_results();
div_end();
}
$selected_id = '';
+ clear_data();
}
//---------------------------------------------------------------------------------------------
return;
delete_exchange_rate($selected_id);
$selected_id = '';
+ clear_data();
}
//---------------------------------------------------------------------------------------------
FROM ".TB_PREF."sales_order_details,
".TB_PREF."sales_orders
WHERE ".TB_PREF."sales_order_details.order_no="
- .TB_PREF."sales_orders.order_no AND ";
+ .TB_PREF."sales_orders.order_no AND ".TB_PREF."sales_orders.trans_type=".ST_SALESORDER." AND
+ ".TB_PREF."sales_orders.trans_type=".TB_PREF."sales_order_details.trans_type AND ";
if ($location != "")
$sql .= TB_PREF."sales_orders.from_stk_loc =".db_escape($location)." AND ";
$sql .= TB_PREF."sales_order_details.stk_code = ".db_escape($stock_id);
FROM ".TB_PREF."sales_order_details,
".TB_PREF."sales_orders,
".TB_PREF."stock_master
- WHERE ".TB_PREF."sales_orders.order_no = ".TB_PREF."sales_order_details.order_no AND ";
+ WHERE ".TB_PREF."sales_orders.order_no = ".TB_PREF."sales_order_details.order_no AND
+ ".TB_PREF."sales_orders.trans_type=".ST_SALESORDER." AND
+ ".TB_PREF."sales_orders.trans_type=".TB_PREF."sales_order_details.trans_type AND ";
if ($location != "")
$sql .= TB_PREF."sales_orders.from_stk_loc =".db_escape($location)." AND ";
$sql .= TB_PREF."sales_order_details.quantity-".TB_PREF."sales_order_details.qty_sent > 0 AND
global $before_box;
echo "<div id='msgbox'>";
- $before_box = ob_get_clean(); // save html content before error box
+
// Necessary restart instead of get_contents/clean calls due to a bug in php 4.3.2
- register_shutdown_function('end_flush');
+ $before_box = ob_get_clean(); // save html content before error box
ob_start('output_html');
echo "</div>";
}
if (isset($Ajax))
$Ajax->run();
-
- if (ob_get_level()) ob_end_flush();
+ // flush all output buffers (works also with exit inside any div levels)
+ while(ob_get_level()) ob_end_flush();
}
function display_db_error($msg, $sql_statement=null, $exit=true)
define('ST_COSTUPDATE', 35);
define('ST_DIMENSION', 40);
+// Don't include these defines in the $systypes_array.
+// They are used for documents only.
+define ('ST_STATEMENT', 91);
+define ('ST_CHEQUE', 92);
+
$systypes_array = array (
ST_JOURNAL => _("Journal Entry"),
ST_BANKPAYMENT => _("Bank Payment"),
if (substr($qe_line['action'],0,1) != 'T')
$part = $taxbase;
else
- $part = $base;
+ $part = $base/100;
$item_tax = get_tax_type($qe_line['dest_id']);
- if ($type == QE_SUPPINV && substr($qe_line['action'],0,1) != 'T')
+ //if ($type == QE_SUPPINV && substr($qe_line['action'],0,1) != 'T')
+ if ($type == QE_SUPPINV)
{
$taxgroup = $cart->tax_group_id;
$rates = 0;
return $bank_amount;
}
+//--------------------------------------------------------------------------------------
+//
+// Simple English version of number to words conversion.
+//
+function _number_to_words($number)
+{
+ $Bn = floor($number / 1000000000); /* Billions (giga) */
+ $number -= $Bn * 1000000000;
+ $Gn = floor($number / 1000000); /* Millions (mega) */
+ $number -= $Gn * 1000000;
+ $kn = floor($number / 1000); /* Thousands (kilo) */
+ $number -= $kn * 1000;
+ $Hn = floor($number / 100); /* Hundreds (hecto) */
+ $number -= $Hn * 100;
+ $Dn = floor($number / 10); /* Tens (deca) */
+ $n = $number % 10; /* Ones */
+
+ $res = "";
+
+ if ($Bn)
+ $res .= _number_to_words($Bn) . " Billion";
+ if ($Gn)
+ $res .= (empty($res) ? "" : " ") . _number_to_words($Gn) . " Million";
+ if ($kn)
+ $res .= (empty($res) ? "" : " ") . _number_to_words($kn) . " Thousand";
+ if ($Hn)
+ $res .= (empty($res) ? "" : " ") . _number_to_words($Hn) . " Hundred";
+
+ $ones = array("", "One", "Two", "Three", "Four", "Five", "Six",
+ "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen",
+ "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eightteen",
+ "Nineteen");
+ $tens = array("", "", "Twenty", "Thirty", "Fourty", "Fifty", "Sixty",
+ "Seventy", "Eigthy", "Ninety");
+
+ if ($Dn || $n)
+ {
+ if (!empty($res))
+ $res .= " and ";
+ if ($Dn < 2)
+ $res .= $ones[$Dn * 10 + $n];
+ else
+ {
+ $res .= $tens[$Dn];
+ if ($n)
+ $res .= "-" . $ones[$n];
+ }
+ }
+
+ if (empty($res))
+ $res = "zero";
+ return $res;
+}
+
+function price_in_words($amount, $document=0)
+{
+ global $Hooks;
+ // use local price_in_words() if the hook is defined
+ if (method_exists($Hooks, 'price_in_words'))
+ {
+ return $Hooks->price_in_words($amount, $document);
+ }
+ // Only usefor Remittance and Receipts as default
+ if (!($document == ST_SUPPAYMENT || $document == ST_CUSTPAYMENT || $document == ST_CHEQUE))
+ return "";
+ if ($amount < 0 || $amount > 999999999999)
+ return "";
+ $dec = user_price_dec();
+ if ($dec > 0)
+ {
+ $divisor = pow(10, $dec);
+ $frac = round2($amount - floor($amount), $dec) * $divisor;
+ $frac = sprintf("%0{$dec}d", $frac);
+ $and = _("and");
+ $frac = " $and $frac/$divisor";
+ }
+ else
+ $frac = "";
+ return _number_to_words(intval($amount)) . $frac;
+}
function get_js_open_window($width, $height)
{
e.onclick = function() {
save_focus(e);
if (e.getAttribute('aspect') == 'process')
- JsHttpRequest.request(this, null, 30000);
+ JsHttpRequest.request(this, null, 60000);
else
JsHttpRequest.request(this);
return false;
//
JsHttpRequest.request= function(trigger, form, tout) {
// if (trigger.type=='submit' && !validate(trigger)) return false;
- tout = tout | 3000; // default timeout value
+ tout = tout | 6000; // default timeout value
document.getElementById('msgbox').innerHTML='';
- set_mark(tout>5000 ? 'progressbar.gif' : 'ajax-loader.gif');
- JsHttpRequest._request(trigger, form, tout, 2);
+ set_mark(tout>10000 ? 'progressbar.gif' : 'ajax-loader.gif');
+ JsHttpRequest._request(trigger, form, tout, 0);
}
JsHttpRequest._request = function(trigger, form, tout, retry) {
submenu_print(_("&Print This Remittance"), ST_SUPPAYMENT, $payment_id."-".ST_SUPPAYMENT, 'prtopt');
submenu_print(_("&Email This Remittance"), ST_SUPPAYMENT, $payment_id."-".ST_SUPPAYMENT, null, 1);
- display_note(get_gl_view_str(22, $payment_id, _("View the GL &Journal Entries for this Payment")));
+ display_note(get_gl_view_str(ST_SUPPAYMENT, $payment_id, _("View the GL &Journal Entries for this Payment")));
// hyperlink_params($path_to_root . "/purchasing/allocations/supplier_allocate.php", _("&Allocate this Payment"), "trans_no=$payment_id&trans_type=22");
}
else
{
- $doc_Charge_To = _("Charge To");
+ if ($doctype == ST_CUSTPAYMENT)
+ $doc_Charge_To = _("With thanks from");
+ else
+ $doc_Charge_To = _("Charge To");
$doc_Delivered_To = _("Delivered To");
}
$doc_Shipping_Company = _("Shipping Company");
}
else
{
- if ($doctype == ST_SUPPAYMENT)
+ if ($doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT)
$doc_Our_Ref = _("Type");
else
$doc_Our_Ref = _("Sales Person");
}
$doc_Our_VAT_no = _("Our VAT No.");
$doc_Domicile = _("Domicile");
+ $doc_Extra = "";
if($doctype == ST_CUSTDELIVERY || $doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER ||
- $doctype == ST_SUPPAYMENT) {
- $doc_Bank_Account = '';
- $doc_Please_Quote = _("All amounts stated in");
+ $doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT) {
+ if ($doctype == ST_CUSTPAYMENT)
+ $doc_Extra = _("* Subject to Realisation of the Cheque.");
+ $doc_Bank_Account = '';
+ $doc_Please_Quote = _("All amounts stated in");
} else {
$doc_Bank_Account = _("Bank Account");
$doc_Please_Quote = $doctype==ST_SALESINVOICE ?
$doc_Bank = _("Bank");
$doc_Payment_Link = _("You can pay through");
if ($doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER || $doctype == ST_SALESINVOICE ||
- $doctype == ST_CUSTCREDIT || $doctype == ST_CUSTDELIVERY || $doctype == ST_WORKORDER || $doctype == ST_SUPPAYMENT)
+ $doctype == ST_CUSTCREDIT || $doctype == ST_CUSTDELIVERY || $doctype == ST_WORKORDER || $doctype == ST_SUPPAYMENT ||
+ $doctype == ST_CUSTPAYMENT)
{
if ($doctype == ST_SALESQUOTE)
$this->title = _("SALES QUOTATION");
$this->title = _("WORK ORDER");
elseif ($doctype == ST_SUPPAYMENT)
$this->title = _("REMITTANCE");
+ elseif ($doctype == ST_CUSTPAYMENT)
+ $this->title = _("RECEIPT");
else
$this->title = _("CREDIT NOTE");
if ($doctype == ST_PURCHORDER)
elseif ($doctype == ST_WORKORDER)
$this->headers = array(_("Item Code"), _("Item Description"),
_("From Location"), _("Work Centre"), _("Unit Quantity"), _("Total Quantity"), _("Units Issued"));
- elseif ($doctype == ST_SUPPAYMENT)
+ elseif ($doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT)
$this->headers = array(_("Trans Type"), _("#"), _("Date"), _("Due Date"), _("Total Amount"), _("Left to Allocate"), _("This Allocation"));
else
$this->headers = array(_("Item Code"), _("Item Description"), _("Quantity"),
_("Unit"), _("Price"), _("Discount %"), _("Total"));
}
- else if ($doctype == ST_CUSTPAYMENT)
+ else if ($doctype == ST_STATEMENT)
{
$this->title = _("STATEMENT");
$this->headers = array(_("Trans Type"), _("#"), _("Date"), _("DueDate"), _("Charges"),
if (isset($header2type) || isset($linetype))
{
$doc_Invoice_no = ($doctype==ST_CUSTDELIVERY ? _("Delivery Note No.") :
+ ($doctype == ST_CUSTPAYMENT ? _("Receipt No.") :
($doctype == ST_SUPPAYMENT ? _("Remittance No.") :
(($doctype==ST_SALESQUOTE || $doctype==ST_PURCHORDER || $doctype==ST_SALESORDER) ? _("Order no.") :
- ($doctype==ST_SALESINVOICE ? _("Invoice No.") : ($doctype==ST_WORKORDER ? _("Word Order No") : _("Credit No."))))));
+ ($doctype==ST_SALESINVOICE ? _("Invoice No.") : ($doctype==ST_WORKORDER ? _("Word Order No") : _("Credit No.")))))));
$doc_Delivery_no = _("Delivery Note No.");
$doc_Order_no = _("Order no.");
}
$doc_TOTAL_PO = _("TOTAL PO EX VAT");
$doc_TOTAL_DELIVERY = _("TOTAL DELIVERY INCL. VAT");
}
- elseif ($doctype == ST_SUPPAYMENT)
+ elseif ($doctype == ST_SUPPAYMENT || ST_CUSTPAYMENT)
{
+ $doc_Towards = _("As advance / full / part / payment towards:");
+ $doc_by_Cheque = _("By Cash / Cheque* / Draft No.");
+ $doc_Dated = _("Dated");
+ $doc_Drawn = _("Drawn on Bank");
+ $doc_Drawn_Branch = _("Branch");
+ $doc_Received = _("Received / Sign");
$doc_Total_Allocated = _("Total Allocated");
$doc_Left_To_Allocate = _("Left to Allocate");
- $doc_Total_Payment = _("TOTAL REMITTANCE");
+ if ($doctype == ST_CUSTPAYMENT)
+ $doc_Total_Payment = _("TOTAL RECEIPT");
+ else
+ $doc_Total_Payment = _("TOTAL REMITTANCE");
}
- elseif ($doctype == ST_CUSTPAYMENT)
+ elseif ($doctype == ST_STATEMENT)
{
$doc_Outstanding = _("Outstanding Transactions");
$doc_Current = _("Current");
}
else
{
- $doc_Charge_To = "Charge To";
+ if ($doctype == ST_CUSTPAYMENT)
+ $doc_Charge_To = "With thanks from";
+ else
+ $doc_Charge_To = "Charge To";
$doc_Delivered_To = "Delivered To";
}
$doc_Shipping_Company = "Shipping Company";
}
else
{
- if ($doctype == ST_SUPPAYMENT)
+ if ($doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT)
$doc_Our_Ref = "Type";
else
$doc_Our_Ref = "Sales Person";
$doc_Customers_Ref = "Customers Reference";
$doc_Our_Order_No = "Our Order No";
}
+ $doc_Extra = "";
$doc_Our_VAT_no = "Our VAT No.";
$doc_Domicile = "Domicile";
if($doctype == ST_CUSTDELIVERY || $doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER ||
- $doctype == ST_SUPPAYMENT) {
- $doc_Bank_Account = '';
- $doc_Please_Quote = "All amounts stated in";
+ $doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT) {
+ if ($doctype == ST_CUSTPAYMENT)
+ $doc_Extra = "* Subject to Realisation of the Cheque.";
+ $doc_Bank_Account = '';
+ $doc_Please_Quote = "All amounts stated in";
} else {
$doc_Please_Quote = "Please quote ".($doctype==ST_SALESINVOICE ? "Invoice" : "Credit")
." no. when paying. All amounts stated in";
$doc_Bank = "Bank";
$doc_Payment_Link = "You can pay through";
if ($doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER || $doctype == ST_SALESINVOICE ||
- $doctype == ST_CUSTCREDIT || $doctype == ST_CUSTDELIVERY || $doctype == ST_WORKORDER || $doctype == ST_SUPPAYMENT)
+ $doctype == ST_CUSTCREDIT || $doctype == ST_CUSTDELIVERY || $doctype == ST_WORKORDER || $doctype == ST_SUPPAYMENT ||
+ $doctype == ST_CUSTPAYMENT)
{
if ($doctype == ST_SALESQUOTE)
$this->title = "SALES QUOTATION";
$this->title = "WORK ORDER";
elseif ($doctype == ST_SUPPAYMENT)
$this->title = "REMITTANCE";
+ elseif ($doctype == ST_CUSTPAYMENT)
+ $this->title = "RECEIPT";
else
$this->title = "CREDIT NOTE";
if ($doctype == ST_PURCHORDER)
elseif ($doctype == ST_WORKORDER)
$this->headers = array("Item Code", "Item Description",
"From Location", "Work Centre", "Unit Quantity", "Total Quantity", "Units Issued");
- elseif ($doctype == ST_SUPPAYMENT)
+ elseif ($doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT)
$this->headers = array('Trans Type', '#', 'Date', 'Due Date', 'Total Amount', 'Left to Allocate', 'This Allocation');
else
$this->headers = array('Item Code', 'Item Description', 'Quantity', 'Unit',
'Price', 'Discount %', 'Total');
}
- elseif ($doctype == ST_CUSTPAYMENT)
+ elseif ($doctype == ST_STATEMENT)
{
$this->title = "STATEMENT";
$this->headers = array('Trans Type', '#', 'Date', 'Due Date', 'Charges',
if (isset($header2type) || isset($linetype))
{
$doc_Invoice_no = ($doctype==ST_CUSTDELIVERY ? "Delivery Note No." :
+ ($doctype == ST_CUSTPAYMENT ? "Receipt No." :
($doctype == ST_SUPPAYMENT ? "Remittance No." :
(($doctype == ST_SALESQUOTE || $doctype==ST_PURCHORDER || $doctype==ST_SALESORDER) ? "Order no." :
- ($doctype==ST_SALESINVOICE ? "Invoice No." : ($doctype == ST_WORKORDER ? "Work Order No" : "Credit No.")))));
+ ($doctype==ST_SALESINVOICE ? "Invoice No." : ($doctype == ST_WORKORDER ? "Work Order No" : "Credit No."))))));
$doc_Delivery_no = "Delivery Note No.";
$doc_Order_no = "Order no.";
}
$doc_TOTAL_PO = "TOTAL PO EX VAT";
$doc_TOTAL_DELIVERY = "TOTAL DELIVERY INCL. VAT";
}
- elseif ($doctype == ST_SUPPAYMENT)
+ elseif ($doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT)
{
+ $doc_Towards = "As advance / full / part / payment towards:";
+ $doc_by_Cheque = "By Cash / Cheque* / Draft No.";
+ $doc_Dated = "Dated";
+ $doc_Drawn = "Drawn on Bank";
+ $doc_Drawn_Branch = "Branch";
+ $doc_Received = "Received / Sign";
$doc_Total_Allocated = "Total Allocated";
$doc_Left_To_Allocate = "Left to Allocate";
- $doc_Total_Payment = "TOTAL REMITTANCE";
+ if ($doctype == ST_CUSTPAYMENT)
+ $doc_Total_Payment = "TOTAL RECEIPT";
+ else
+ $doc_Total_Payment = "TOTAL REMITTANCE";
}
- elseif ($doctype == ST_CUSTPAYMENT)
+ elseif ($doctype == ST_STATEMENT)
{
$doc_Outstanding = "Outstanding Transactions";
$doc_Current = "Current";
$this->Text($c2col, $this->company['gst_no'], $mcol);
$this->NewLine();
}
- if (($doctype == ST_SALESINVOICE || $doctype == ST_CUSTPAYMENT) && $this->company['domicile'] != "")
+ if (($doctype == ST_SALESINVOICE || $doctype == ST_STATEMENT) && $this->company['domicile'] != "")
{
$this->Text($ccol, $doc_Domicile, $c2col);
$this->Text($c2col, $this->company['domicile'], $mcol);
$this->row = $temp;
if ($doctype == ST_PURCHORDER)
$this->Text($mcol, $this->company['coy_name']);
- elseif ($doctype != ST_SUPPAYMENT)
+ elseif ($doctype != ST_SUPPAYMENT && isset($sales_order['deliver_to']))
$this->Text($mcol, $sales_order['deliver_to']);
$this->NewLine();
- if ($doctype != ST_SUPPAYMENT)
+ if ($doctype != ST_SUPPAYMENT && isset($sales_order['deliver_to']))
$this->TextWrapLines($mcol, $this->rightMargin - $mcol, $sales_order['delivery_address']);
}
$this->row = $iline2 - $this->lineHeight - 1;
$this->TextWrap($col, $this->row, $width, $myrow['wo_ref'], 'C');
elseif (isset($sales_order["customer_ref"]))
$this->TextWrap($col, $this->row, $width, $sales_order["customer_ref"], 'C');
+ elseif (isset($myrow["debtor_ref"]))
+ $this->TextWrap($col, $this->row, $width, $myrow["debtor_ref"], 'C');
$col += $width;
if ($branch != null)
{
//$this->TextWrap($col, $this->row, $width, $row['salesman_name'], 'C');
$this->TextWrap($col, $this->row, $width, get_salesman_name($id), 'C');
}
- elseif ($doctype == ST_SUPPAYMENT)
+ elseif ($doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT)
$this->TextWrap($col, $this->row, $width, $systypes_array[$myrow["type"]], 'C');
elseif ($doctype == ST_WORKORDER)
$this->TextWrap($col, $this->row, $width, $wo_types_array[$myrow["type"]], 'C');
}
elseif ($doctype == ST_WORKORDER)
$this->TextWrap($col, $this->row, $width, $myrow["location_name"], 'C');
- elseif (isset($myrow['order_']))
+ elseif (isset($myrow['order_']) && $myrow['order_'] != 0)
$this->TextWrap($col, $this->row, $width, $myrow['order_'], 'C');
$col += $width;
if ($doctype == ST_SALESORDER || $doctype == ST_SALESQUOTE)
$this->TextWrap($col, $this->row, $width, sql2date($myrow['delivery_date']), 'C');
elseif ($doctype == ST_WORKORDER)
$this->TextWrap($col, $this->row, $width, $myrow["units_issued"], 'C');
- elseif ($doctype != ST_PURCHORDER && $doctype != ST_CUSTCREDIT && isset($myrow['due_date']))
+ elseif ($doctype != ST_PURCHORDER && $doctype != ST_CUSTCREDIT && $doctype != ST_CUSTPAYMENT &&
+ $doctype != ST_SUPPAYMENT && isset($myrow['due_date']))
$this->TextWrap($col, $this->row, $width, sql2date($myrow['due_date']), 'C');
if (!isset($packing_slip) || $packing_slip == 0)
{
$this->row -= $this->lineHeight;
}
}
+ if ($doc_Extra != "")
+ {
+ $this->TextWrap($ccol, $this->row, $right - $ccol, $doc_Extra, 'C');
+ $this->row -= $this->lineHeight;
+ }
if ($this->params['comments'] != '')
{
$this->TextWrap($ccol, $this->row, $right - $ccol, $this->params['comments'], 'C');
$this->row -= $this->lineHeight;
}
- if (($doctype == ST_SALESINVOICE || $doctype == ST_CUSTPAYMENT) && $this->company['legal_text'] != "")
+ if (($doctype == ST_SALESINVOICE || $doctype == ST_STATEMENT) && $this->company['legal_text'] != "")
{
$this->TextWrapLines($ccol, $right - $ccol, $this->company['legal_text'], 'C');
}
'PARAM_3' => $email,
'PARAM_4' => '');
break;
+ case ST_CUSTPAYMENT :
+ $rep = 112;
+ // from, to, currency, bank acc, email, comments
+ $ar = array(
+ 'PARAM_0' => $doc_no,
+ 'PARAM_1' => $doc_no,
+ 'PARAM_2' => '',
+ 'PARAM_4' => '');
+ break;
case ST_SUPPAYMENT :
$rep = 210;
// from, to, currency, bank acc, email, comments
$st_params = "<table border=0><tr><td>\n"
. "<form method='POST' action='$action' target='_blank'>\n";
- $st_params .= hidden('REP_ID', $report->id, false);
$st_params .= submit('Rep'.$report->id,
_("Display: ") . access_string($report->name, true),
- false, '', $pdf_debug ? false : 'default') . '<br><br>';
+ false, '', $pdf_debug ? false : 'default') . hidden('REP_ID', $report->id, false).'<br><br>';
$st_params .= $this->getOptions($report->get_controls());
$st_params .= "\n</form></td></tr></table>\n";
set_focus('Rep'.$report->id);
FROM ".TB_PREF."suppliers, ".TB_PREF."supp_trans WHERE (type=".ST_BANKPAYMENT." OR type=".ST_SUPPAYMENT." OR type=".ST_SUPPCREDIT.") AND ".TB_PREF."suppliers.supplier_id=".TB_PREF."supp_trans.supplier_id ORDER BY ".TB_PREF."supp_trans.trans_no DESC";
return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false));
+ case 'RECEIPT':
+ $BD = _("BD");
+ $CP = _("CP");
+ $CN = _("CN");
+ $ref = ($print_invoice_no == 1 ? "trans_no" : "reference");
+ $sql = "SELECT concat(".TB_PREF."debtor_trans.trans_no, '-',
+ ".TB_PREF."debtor_trans.type) AS TNO, concat(".TB_PREF."debtor_trans.$ref, if (type=".ST_BANKDEPOSIT.", ' $BD ', if (type=".ST_CUSTPAYMENT.", ' $CP ', ' $CN ')), ".TB_PREF."debtors_master.name) as IName
+ FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE (type=".ST_BANKDEPOSIT." OR type=".ST_CUSTPAYMENT." OR type=".ST_CUSTCREDIT.") AND ".TB_PREF."debtors_master.debtor_no=".TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC";
+ return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false));
+
case 'ITEMS':
return stock_manufactured_items_list($name);
$rep->Font('bold');
$rep->TextCol(3, 6, $doc_TOTAL_INVOICE, - 2);
$rep->TextCol(6, 7, $DisplayTotal, -2);
+ $words = price_in_words($myrow['Total'], $j);
+ if ($words != "")
+ {
+ $rep->NewLine(1);
+ $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2);
+ }
$rep->Font();
if ($email == 1)
{
$rep->filename = "Statement" . $myrow['debtor_no'] . ".pdf";
$rep->Info($params, $cols, null, $aligns);
}
- $rep->Header2($myrow, null, null, $baccount, ST_CUSTPAYMENT);
+ $rep->Header2($myrow, null, null, $baccount, ST_STATEMENT);
$rep->NewLine();
$linetype = true;
- $doctype = ST_CUSTPAYMENT;
+ $doctype = ST_STATEMENT;
if ($rep->currency != $myrow['curr_code'])
{
include($path_to_root . "/reporting/includes/doctext2.inc");
$rep->TextCol(7, 8, $DisplayNet, -2);
$rep->NewLine();
if ($rep->row < $rep->bottomMargin + (10 * $rep->lineHeight))
- $rep->Header2($myrow, null, null, $baccount, ST_CUSTPAYMENT);
+ $rep->Header2($myrow, null, null, $baccount, ST_STATEMENT);
}
$nowdue = "1-" . $PastDueDays1 . " " . $doc_Days;
$pastdue1 = $PastDueDays1 + 1 . "-" . $PastDueDays2 . " " . $doc_Days;
for ($i = 0; $i < 5; $i++)
$rep->TextWrap($col[$i], $rep->row, $col[$i + 1] - $col[$i], $str2[$i], 'right');
if ($email == 1)
- $rep->End($email, $doc_Statement . " " . $doc_as_of . " " . sql2date($date), $myrow, ST_CUSTPAYMENT);
+ $rep->End($email, $doc_Statement . " " . $doc_as_of . " " . sql2date($date), $myrow, ST_STATEMENT);
}
if ($email == 0)
else
$rep->TextCol(3, 6, $doc_TOTAL_ORDER2, - 2);
$rep->TextCol(6, 7, $DisplayTotal, -2);
+ $words = price_in_words($myrow["freight_cost"] + $SubTotal, ST_SALESORDER);
+ if ($words != "")
+ {
+ $rep->NewLine(1);
+ $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2);
+ }
$rep->Font();
if ($email == 1)
{
$rep->Font('bold');
$rep->TextCol(3, 6, $doc_TOTAL_DELIVERY, - 2);
$rep->TextCol(6, 7, $DisplayTotal, -2);
+ $words = price_in_words($myrow['Total'], ST_CUSTDELIVERY);
+ if ($words != "")
+ {
+ $rep->NewLine(1);
+ $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2);
+ }
$rep->Font();
}
if ($email == 1)
else
$rep->TextCol(3, 6, $doc_TOTAL_ORDER2, - 2);
$rep->TextCol(6, 7, $DisplayTotal, -2);
+ $words = price_in_words($myrow["freight_cost"] + $SubTotal, ST_SALESQUOTE);
+ if ($words != "")
+ {
+ $rep->NewLine(1);
+ $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2);
+ }
$rep->Font();
if ($email == 1)
{
--- /dev/null
+<?php
+/**********************************************************************
+ Copyright (C) FrontAccounting, LLC.
+ Released under the terms of the GNU General Public License, GPL,
+ as published by the Free Software Foundation, either version 3
+ of the License, or (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
+
+$page_security = $_POST['PARAM_0'] == $_POST['PARAM_1'] ?
+ 'SA_SALESTRANSVIEW' : 'SA_SALESBULKREP';
+// ----------------------------------------------------------------
+// $ Revision: 2.0 $
+// Creator: Joe Hunt
+// date_: 2005-05-19
+// Title: Purchase Orders
+// ----------------------------------------------------------------
+$path_to_root="..";
+
+include_once($path_to_root . "/includes/session.inc");
+include_once($path_to_root . "/includes/date_functions.inc");
+include_once($path_to_root . "/includes/data_checks.inc");
+
+//----------------------------------------------------------------------------------------------------
+
+print_receipts();
+
+//----------------------------------------------------------------------------------------------------
+function get_receipt($type, $trans_no)
+{
+ $sql = "SELECT ".TB_PREF."debtor_trans.*,
+ (".TB_PREF."debtor_trans.ov_amount + ".TB_PREF."debtor_trans.ov_gst + ".TB_PREF."debtor_trans.ov_freight +
+ ".TB_PREF."debtor_trans.ov_freight_tax + ".TB_PREF."debtor_trans.ov_discount) AS Total,
+ ".TB_PREF."debtors_master.name AS DebtorName, ".TB_PREF."debtors_master.debtor_ref,
+ ".TB_PREF."debtors_master.curr_code, ".TB_PREF."debtors_master.payment_terms, ".TB_PREF."debtors_master.tax_id AS tax_id,
+ ".TB_PREF."debtors_master.email, ".TB_PREF."debtors_master.address
+ FROM ".TB_PREF."debtor_trans, ".TB_PREF."debtors_master
+ WHERE ".TB_PREF."debtor_trans.debtor_no = ".TB_PREF."debtors_master.debtor_no
+ AND ".TB_PREF."debtor_trans.type = ".db_escape($type)."
+ AND ".TB_PREF."debtor_trans.trans_no = ".db_escape($trans_no);
+ $result = db_query($sql, "The remittance cannot be retrieved");
+ if (db_num_rows($result) == 0)
+ return false;
+ return db_fetch($result);
+}
+
+function get_allocations_for_receipt($debtor_id, $type, $trans_no)
+{
+ $sql = get_alloc_trans_sql("amt, trans.reference, trans.alloc", "trans.trans_no = alloc.trans_no_to
+ AND trans.type = alloc.trans_type_to
+ AND alloc.trans_no_from=$trans_no
+ AND alloc.trans_type_from=$type
+ AND trans.debtor_no=".db_escape($debtor_id),
+ TB_PREF."cust_allocations as alloc");
+ $sql .= " ORDER BY trans_no";
+ return db_query($sql, "Cannot retreive alloc to transactions");
+}
+
+function print_receipts()
+{
+ global $path_to_root, $systypes_array;
+
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+
+ $from = $_POST['PARAM_0'];
+ $to = $_POST['PARAM_1'];
+ $currency = $_POST['PARAM_2'];
+ $comments = $_POST['PARAM_3'];
+
+ if ($from == null)
+ $from = 0;
+ if ($to == null)
+ $to = 0;
+ $dec = user_price_dec();
+
+ $fno = explode("-", $from);
+ $tno = explode("-", $to);
+
+ $cols = array(4, 85, 150, 225, 275, 360, 450, 515);
+
+ // $headers in doctext.inc
+ $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right');
+
+ $params = array('comments' => $comments);
+
+ $cur = get_company_Pref('curr_default');
+
+ $rep = new FrontReport(_('RECEIPT'), "ReceiptBulk", user_pagesize());
+ $rep->currency = $cur;
+ $rep->Font();
+ $rep->Info($params, $cols, null, $aligns);
+
+ for ($i = $fno[0]; $i <= $tno[0]; $i++)
+ {
+ if ($fno[0] == $tno[0])
+ $types = array($fno[1]);
+ else
+ $types = array(ST_BANKDEPOSIT, ST_CUSTPAYMENT, ST_CUSTCREDIT);
+ foreach ($types as $j)
+ {
+ $myrow = get_receipt($j, $i);
+ if (!$myrow)
+ continue;
+ $baccount = get_default_bank_account($myrow['curr_code']);
+ $params['bankaccount'] = $baccount['id'];
+
+ $rep->title = _('RECEIPT');
+ $rep->Header2($myrow, null, $myrow, $baccount, ST_CUSTPAYMENT);
+ $result = get_allocations_for_receipt($myrow['debtor_no'], $myrow['type'], $myrow['trans_no']);
+
+ $linetype = true;
+ $doctype = ST_CUSTPAYMENT;
+ if ($rep->currency != $myrow['curr_code'])
+ {
+ include($path_to_root . "/reporting/includes/doctext2.inc");
+ }
+ else
+ {
+ include($path_to_root . "/reporting/includes/doctext.inc");
+ }
+
+ $total_allocated = 0;
+ $rep->TextCol(0, 4, $doc_Towards, -2);
+ $rep->NewLine(2);
+
+ while ($myrow2=db_fetch($result))
+ {
+ $rep->TextCol(0, 1, $systypes_array[$myrow2['type']], -2);
+ $rep->TextCol(1, 2, $myrow2['reference'], -2);
+ $rep->TextCol(2, 3, sql2date($myrow2['tran_date']), -2);
+ $rep->TextCol(3, 4, sql2date($myrow2['due_date']), -2);
+ $rep->AmountCol(4, 5, $myrow2['Total'], $dec, -2);
+ $rep->AmountCol(5, 6, $myrow2['Total'] - $myrow2['alloc'], $dec, -2);
+ $rep->AmountCol(6, 7, $myrow2['amt'], $dec, -2);
+
+ $total_allocated += $myrow2['amt'];
+ $rep->NewLine(1);
+ if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
+ $rep->Header2($myrow, null, $myrow, $baccount, ST_CUSTPAYMENT);
+ }
+
+ $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
+
+ $rep->TextCol(3, 6, $doc_Total_Allocated, -2);
+ $rep->AmountCol(6, 7, $total_allocated, $dec, -2);
+ $rep->NewLine();
+ $rep->TextCol(3, 6, $doc_Left_To_Allocate, -2);
+ $rep->AmountCol(6, 7, $myrow['Total'] - $total_allocated, $dec, -2);
+ $rep->NewLine();
+ $rep->Font('bold');
+ $rep->TextCol(3, 6, $doc_Total_Payment, - 2);
+ $rep->AmountCol(6, 7, $myrow['Total'], $dec, -2);
+ $words = price_in_words($myrow['Total'], ST_CUSTPAYMENT);
+ if ($words != "")
+ {
+ $rep->NewLine(1);
+ $rep->TextCol(0, 7, $myrow['curr_code'] . ": " . $words, - 2);
+ }
+ $rep->Font();
+ $rep->NewLine();
+ $rep->TextCol(6, 7, $doc_Received, - 2);
+ $rep->NewLine();
+ $rep->TextCol(0, 2, $doc_by_Cheque, - 2);
+ $rep->TextCol(2, 4, "______________________________", - 2);
+ $rep->TextCol(4, 5, $doc_Dated, - 2);
+ $rep->TextCol(5, 6, "__________________", - 2);
+ $rep->NewLine(1);
+ $rep->TextCol(0, 2, $doc_Drawn, - 2);
+ $rep->TextCol(2, 4, "______________________________", - 2);
+ $rep->TextCol(4, 5, $doc_Drawn_Branch, - 2);
+ $rep->TextCol(5, 6, "__________________", - 2);
+ $rep->TextCol(6, 7, "__________________");
+ }
+ }
+ $rep->End();
+}
+
+?>
\ No newline at end of file
$rep->Font('bold');
$rep->TextCol(3, 6, $doc_TOTAL_PO, - 2);
$rep->TextCol(6, 7, $DisplayTotal, -2);
+ $words = price_in_words($SubTotal, ST_PURCHORDER);
+ if ($words != "")
+ {
+ $rep->NewLine(1);
+ $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2);
+ }
$rep->Font();
if ($email == 1)
{
if ($email == 0)
{
- $rep = new FrontReport(_('PURCHASE ORDER'), "PurchaseOrderBulk", user_pagesize());
+ $rep = new FrontReport(_('REMITTANCE'), "RemittanceBulk", user_pagesize());
$rep->currency = $cur;
$rep->Font();
$rep->Info($params, $cols, null, $aligns);
else
$types = array(ST_BANKPAYMENT, ST_SUPPAYMENT, ST_SUPPCREDIT);
foreach ($types as $j)
- //for ($j = ST_BANKPAYMENT; $j <= ST_SUPPAYMENT; $j = ($j == ST_BANKPAYMENT ? ST_SUPPAYMENT : 999))
- //for ($j = $ft; $j <= $tt; $j = ($j == ST_BANKPAYMENT ? ST_SUPPAYMENT : 999))
{
$myrow = get_remittance($j, $i);
if (!$myrow)
$rep->Header2($myrow, null, $myrow, $baccount, ST_SUPPAYMENT);
$result = get_allocations_for_remittance($myrow['supplier_id'], $myrow['type'], $myrow['trans_no']);
+ $linetype = true;
+ $doctype = ST_SUPPAYMENT;
+ if ($rep->currency != $myrow['curr_code'])
+ {
+ include($path_to_root . "/reporting/includes/doctext2.inc");
+ }
+ else
+ {
+ include($path_to_root . "/reporting/includes/doctext.inc");
+ }
+
$total_allocated = 0;
+ $rep->TextCol(0, 4, $doc_Towards, -2);
+ $rep->NewLine(2);
+
while ($myrow2=db_fetch($result))
{
$rep->TextCol(0, 1, $systypes_array[$myrow2['type']], -2);
}
$rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
- $linetype = true;
- $doctype = ST_SUPPAYMENT;
- if ($rep->currency != $myrow['curr_code'])
- {
- include($path_to_root . "/reporting/includes/doctext2.inc");
- }
- else
- {
- include($path_to_root . "/reporting/includes/doctext.inc");
- }
$rep->TextCol(3, 6, $doc_Total_Allocated, -2);
$rep->AmountCol(6, 7, $total_allocated, $dec, -2);
$rep->Font('bold');
$rep->TextCol(3, 6, $doc_Total_Payment, - 2);
$rep->AmountCol(6, 7, $myrow['Total'], $dec, -2);
+ $words = price_in_words($myrow['Total'], ST_SUPPAYMENT);
+ if ($words != "")
+ {
+ $rep->NewLine(2);
+ $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2);
+ }
$rep->Font();
if ($email == 1)
{
$rep->NewLine(2);
if ($rows > 0)
{
+ // Keep a running total as we loop through
+ // the transactions.
+ $total_debit = $total_credit = 0;
+
while ($myrow=db_fetch($trans))
{
$total += $myrow['amount'];
$rep->DateCol(3, 4, $myrow["trans_date"], true);
$rep->TextCol(4, 5, payment_person_name($myrow["person_type_id"],$myrow["person_id"], false));
if ($myrow['amount'] > 0.0)
+ {
$rep->AmountCol(5, 6, abs($myrow['amount']), $dec);
+ $total_debit += abs($myrow['amount']);
+ }
else
+ {
$rep->AmountCol(6, 7, abs($myrow['amount']), $dec);
+ $total_credit += abs($myrow['amount']);
+ }
$rep->AmountCol(7, 8, $total, $dec);
$rep->NewLine();
if ($rep->row < $rep->bottomMargin + $rep->lineHeight)
}
$rep->NewLine();
}
+
+ // Print totals for the debit and credit columns.
+ $rep->TextCol(3, 5, _("Total Debit / Credit"));
+ $rep->AmountCol(5, 6, $total_debit, $dec);
+ $rep->AmountCol(6, 7, $total_credit, $dec);
+ $rep->NewLine(2);
+
$rep->Font('bold');
$rep->TextCol(3, 5, _("Ending Balance"));
if ($total > 0.0)
$rep->Font();
$rep->Line($rep->row - $rep->lineHeight + 4);
$rep->NewLine(2, 1);
+
+ // Print the difference between starting and ending balances.
+ $net_change = ($total - $prev_balance);
+ $rep->TextCol(3, 5, _("Net Change"));
+ if ($total > 0.0)
+ $rep->AmountCol(5, 6, $net_change, $dec, 0, 0, 0, 0, null, 1, True);
+ else
+ $rep->AmountCol(6, 7, $net_change, $dec, 0, 0, 0, 0, null, 1, True);
}
$rep->End();
}
$rep = new FrontReport(_('GL Account Transactions'), "GLAccountTransactions", user_pagesize());
$dec = user_price_dec();
- $cols = array(0, 80, 100, 150, 210, 280, 340, 400, 450, 510, 570);
+ //$cols = array(0, 80, 100, 150, 210, 280, 340, 400, 450, 510, 570);
+ $cols = array(0, 65, 105, 125, 175, 230, 290, 345, 405, 465, 525);
//------------0--1---2---3----4----5----6----7----8----9----10-------
//-----------------------dim1-dim2-----------------------------------
//-----------------------dim1----------------------------------------
//-------------------------------------------------------------------
- $aligns = array('left', 'left', 'left', 'left', 'left', 'left', 'right', 'right', 'right');
+ $aligns = array('left', 'left', 'left', 'left', 'left', 'left', 'left', 'right', 'right', 'right');
if ($dim == 2)
- $headers = array(_('Type'), _('#'), _('Date'), _('Dimension')." 1", _('Dimension')." 2",
+ $headers = array(_('Type'), _('Ref'), _('#'), _('Date'), _('Dimension')." 1", _('Dimension')." 2",
_('Person/Item'), _('Debit'), _('Credit'), _('Balance'));
elseif ($dim == 1)
- $headers = array(_('Type'), _('#'), _('Date'), _('Dimension'), "", _('Person/Item'),
+ $headers = array(_('Type'), _('Ref'), _('#'), _('Date'), _('Dimension'), "", _('Person/Item'),
_('Debit'), _('Credit'), _('Balance'));
else
- $headers = array(_('Type'), _('#'), _('Date'), "", "", _('Person/Item'),
+ $headers = array(_('Type'), _('Ref'), _('#'), _('Date'), "", "", _('Person/Item'),
_('Debit'), _('Credit'), _('Balance'));
if ($dim == 2)
if ($prev_balance == 0.0 && $rows == 0)
continue;
$rep->Font('bold');
- $rep->TextCol(0, 3, $account['account_code'] . " " . $account['account_name']);
- $rep->TextCol(3, 5, _('Opening Balance'));
+ $rep->TextCol(0, 4, $account['account_code'] . " " . $account['account_name'], -2);
+ $rep->TextCol(4, 6, _('Opening Balance'));
if ($prev_balance > 0.0)
- $rep->AmountCol(6, 7, abs($prev_balance), $dec);
- else
$rep->AmountCol(7, 8, abs($prev_balance), $dec);
+ else
+ $rep->AmountCol(8, 9, abs($prev_balance), $dec);
$rep->Font();
$total = $prev_balance;
$rep->NewLine(2);
{
$total += $myrow['amount'];
- $rep->TextCol(0, 1, $systypes_array[$myrow["type"]]);
- $rep->TextCol(1, 2, $myrow['type_no']);
- $rep->DateCol(2, 3, $myrow["tran_date"], true);
+ $rep->TextCol(0, 1, $systypes_array[$myrow["type"]], -2);
+ $reference = get_reference($myrow["type"], $myrow["type_no"]);
+ $rep->TextCol(1, 2, $reference);
+ $rep->TextCol(2, 3, $myrow['type_no'], -2);
+ $rep->DateCol(3, 4, $myrow["tran_date"], true);
if ($dim >= 1)
- $rep->TextCol(3, 4, get_dimension_string($myrow['dimension_id']));
+ $rep->TextCol(4, 5, get_dimension_string($myrow['dimension_id']));
if ($dim > 1)
- $rep->TextCol(4, 5, get_dimension_string($myrow['dimension2_id']));
- $rep->TextCol(5, 6, payment_person_name($myrow["person_type_id"],$myrow["person_id"], false));
+ $rep->TextCol(5, 6, get_dimension_string($myrow['dimension2_id']));
+ $rep->TextCol(6, 7, payment_person_name($myrow["person_type_id"],$myrow["person_id"], false));
if ($myrow['amount'] > 0.0)
- $rep->AmountCol(6, 7, abs($myrow['amount']), $dec);
- else
$rep->AmountCol(7, 8, abs($myrow['amount']), $dec);
- $rep->TextCol(8, 9, number_format2($total, $dec));
+ else
+ $rep->AmountCol(8, 9, abs($myrow['amount']), $dec);
+ $rep->TextCol(9, 10, number_format2($total, $dec));
$rep->NewLine();
if ($rep->row < $rep->bottomMargin + $rep->lineHeight)
{
$rep->NewLine();
}
$rep->Font('bold');
- $rep->TextCol(3, 5, _("Ending Balance"));
+ $rep->TextCol(4, 6, _("Ending Balance"));
if ($total > 0.0)
- $rep->AmountCol(6, 7, abs($total), $dec);
- else
$rep->AmountCol(7, 8, abs($total), $dec);
+ else
+ $rep->AmountCol(8, 9, abs($total), $dec);
$rep->Font();
$rep->Line($rep->row - $rep->lineHeight + 4);
$rep->NewLine(2, 1);
{
for ( ; $level >= 0, $typename[$level] != ''; $level--)
{
- if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0)
+ if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0 || $closeclass)
{
$rep->row += 6;
$rep->Line($rep->row);
{
for ( ; $level >= 0, $typename[$level] != ''; $level--)
{
- if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0)
+ if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0 || $closeclass)
{
$rep->row += 6;
$rep->Line($rep->row);
{
for ( ; $level >= 0, $typename[$level] != ''; $level--)
{
- if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0)
+ if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0 || $closeclass)
{
$rep->row += 6;
$rep->Line($rep->row);
{
for ( ; $level >= 0, $typename[$level] != ''; $level--)
{
- if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0)
+ if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0 || $closeclass)
{
$rep->row += 6;
$rep->Line($rep->row);
{
for ( ; $level >= 0, $typename[$level] != ''; $level--)
{
- if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0)
+ if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0 || $closeclass)
{
$rep->row += 6;
$rep->Line($rep->row);
{
for ( ; $level >= 0, $typename[$level] != ''; $level--)
{
- if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0)
+ if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0 || $closeclass)
{
$rep->row += 6;
$rep->Line($rep->row);
$rep->Header();
}
}
- if (in_array($trans['trans_type'], array(ST_BANKDEPOSIT,ST_SALESINVOICE,ST_CUSTCREDIT))) {
+ if ($trans['trans_type']==ST_JOURNAL && $trans['amount']<0) {
+ $taxes[$trans['tax_type_id']]['taxout'] -= $trans['amount'];
+ $taxes[$trans['tax_type_id']]['out'] -= $trans['net_amount'];
+ }
+ elseif (in_array($trans['trans_type'], array(ST_BANKDEPOSIT,ST_SALESINVOICE,ST_CUSTCREDIT))) {
$taxes[$trans['tax_type_id']]['taxout'] += $trans['amount'];
$taxes[$trans['tax_type_id']]['out'] += $trans['net_amount'];
} else {
_('Currency Filter') => 'CURRENCY',
_('Email Customers') => 'YES_NO',
_('Comments') => 'TEXTBOX'));
+$reports->addReport(_('Customer'),111,_('&Print Sales Quotations'),
+ array( _('From') => 'QUOTATIONS',
+ _('To') => 'QUOTATIONS',
+ _('Currency Filter') => 'CURRENCY',
+ _('Email Customers') => 'YES_NO',
+ _('Comments') => 'TEXTBOX'));
+$reports->addReport(_('Customer'),112,_('Print Receipts'),
+ array( _('From') => 'RECEIPT',
+ _('To') => 'RECEIPT',
+ _('Currency Filter') => 'CURRENCY',
+ _('Comments') => 'TEXTBOX'));
$reports->addReportClass(_('Supplier'));
$reports->addReport(_('Supplier'),201,_('Supplier &Balances'),
include_once($path_to_root . "/includes/data_checks.inc");
include_once($path_to_root . "/sales/includes/sales_db.inc");
//include_once($path_to_root . "/sales/includes/ui/cust_alloc_ui.inc");
+include_once($path_to_root . "/reporting/includes/reporting.inc");
$js = "";
if ($use_popup_windows) {
display_notification_centered(_("The customer payment has been successfully entered."));
+ submenu_print(_("&Print This Receipt"), ST_CUSTPAYMENT, $payment_no."-".ST_CUSTPAYMENT, 'prtopt');
+
display_note(get_gl_view_str(ST_CUSTPAYMENT, $payment_no, _("&View the GL Journal Entries for this Customer Payment")));
// hyperlink_params($path_to_root . "/sales/allocations/customer_allocate.php", _("&Allocate this Customer Payment"), "trans_no=$payment_no&trans_type=12");
hyperlink_no_params($path_to_root . "/sales/customer_payments.php", _("Enter Another &Customer Payment"));
- br(1);
- end_page();
- exit;
+
+ display_footer_exit();
}
//----------------------------------------------------------------------------------------------
.db_escape($order_no) . " AND trans_type=".db_escape($trans_type);
db_query($sql, "order Detail Delete");
+ delete_reference($trans_type, $order_no);
+
add_audit_trail($trans_type, $order_no, Today(), _("Deleted."));
commit_transaction();
}
$prices[$myrow['sales_type_id']][$myrow['curr_abrev']] = $myrow['price'];
}
$price = false;
+ if (isset($prices[$sales_type_id][$currency]))
+ {
+ $price = $prices[$sales_type_id][$currency];
+ }
+ elseif (isset($prices[$base_id][$currency]))
+ {
+ $price = $prices[$base_id][$currency] * $factor;
+ }
+ elseif (isset($prices[$sales_type_id][$home_curr]))
+ {
+ $price = $prices[$sales_type_id][$home_curr] / $rate;
+ }
+ elseif (isset($prices[$base_id][$home_curr]))
+ {
+ $price = $prices[$base_id][$home_curr] * $factor / $rate;
+ }
+/*
if (isset($prices[$sales_type_id][$home_curr]))
{
$price = $prices[$sales_type_id][$home_curr] / $rate;
{
$price = $prices[$base_id][$home_curr] * $factor / $rate;
}
+*/
elseif ($num_rows == 0 && $add_pct != -1)
{
$price = get_calculated_price($stock_id, $add_pct);
function prt_link($row)
{
if ($row['type'] != ST_CUSTPAYMENT && $row['type'] != ST_BANKDEPOSIT) // customer payment or bank deposit printout not defined yet.
- return print_document_link($row['trans_no'], _("Print"), true, $row['type'], ICON_PRINT);
+ return print_document_link($row['trans_no']."-".$row['type'], _("Print"), true, $row['type'], ICON_PRINT);
+ else
+ return print_document_link($row['trans_no']."-".$row['type'], _("Print Receipt"), true, ST_CUSTPAYMENT, ICON_PRINT);
}
function check_overdue($row)
submenu_view(_("&View This Invoice"), ST_SALESINVOICE, $invoice);
- submenu_print(_("&Print Sales Invoice"), ST_SALESINVOICE, $invoice, 'prtopt');
- submenu_print(_("&Email Sales Invoice"), ST_SALESINVOICE, $invoice, null, 1);
+ submenu_print(_("&Print Sales Invoice"), ST_SALESINVOICE, $invoice."-".ST_SALESINVOICE, 'prtopt');
+ submenu_print(_("&Email Sales Invoice"), ST_SALESINVOICE, $invoice."-".ST_SALESINVOICE, null, 1);
set_focus('prtopt');
+
+ $sql = "SELECT trans_type_from, trans_no_from FROM ".TB_PREF."cust_allocations
+ WHERE trans_type_to=".ST_SALESINVOICE." AND trans_no_to=".db_escape($invoice);
+ $result = db_query($sql, "could not retrieve customer allocation");
+ $row = db_fetch($result);
+ if ($row !== false)
+ submenu_print(_("Print &Receipt"), $row['trans_type_from'], $row['trans_no_from']."-".$row['trans_type_from'], 'prtopt');
display_note(get_gl_view_str(ST_SALESINVOICE, $invoice, _("View the GL &Journal Entries for this Invoice")),0, 1);
if ($cart->cash) {
$cart->due_date = $cart->document_date;
$cart->phone = $cart->cust_ref = $cart->delivery_address = '';
- $cart->freight_cost = 0;
+ $cart->freight_cost = input_num('freight_cost');
$cart->ship_via = 1;
$cart->deliver_to = '';//$_POST['deliver_to'];
} else {
return false;
}
+
if (strlen($_POST['delivery_address']) <= 1) {
display_error( _("You should enter the street address in the box provided. Orders cannot be accepted without a valid street address."));
set_focus('delivery_address');
return false;
}
}
+ else
+ {
+ if (!db_has_cash_accounts())
+ {
+ display_error(_("You need to define a cash account for your Sales Point."));
+ return false;
+ }
+ }
if (!$Refs->is_valid($_POST['ref'])) {
display_error(_("You must enter a reference."));
set_focus('ref');
if ($_SESSION['Items']->trans_type == ST_CUSTDELIVERY) {
- display_note(_("Direct delivery entry has been cancelled as requested."), 1);
- submenu_option(_("Enter a New Sales Delivery"), $_SERVER['PHP_SELF']."?NewDelivery=0");
+ display_notification(_("Direct delivery entry has been cancelled as requested."), 1);
+ submenu_option(_("Enter a New Sales Delivery"), "/sales/sales_order_entry.php?NewDelivery=1");
} elseif ($_SESSION['Items']->trans_type == ST_SALESINVOICE) {
- display_note(_("Direct invoice entry has been cancelled as requested."), 1);
- submenu_option(_("Enter a New Sales Invoice"), $_SERVER['PHP_SELF']."?NewInvoice=0");
+ display_notification(_("Direct invoice entry has been cancelled as requested."), 1);
+ submenu_option(_("Enter a New Sales Invoice"), "/sales/sales_order_entry.php?NewInvoice=1");
} else {
if ($_SESSION['Items']->trans_no != 0) {
- if (sales_order_has_deliveries(key($_SESSION['Items']->trans_no)))
+ if ($_SESSION['Items']->trans_type == ST_SALESORDER &&
+ sales_order_has_deliveries(key($_SESSION['Items']->trans_no)))
display_error(_("This order cannot be cancelled because some of it has already been invoiced or dispatched. However, the line item quantities may be modified."));
else {
delete_sales_order(key($_SESSION['Items']->trans_no), $_SESSION['Items']->trans_type);
if ($_SESSION['Items']->trans_type == ST_SALESQUOTE)
{
- display_note(_("This sales quotation has been cancelled as requested."), 1);
- submenu_option(_("Enter a New Sales Quotation"), $_SERVER['PHP_SELF']."?NewQuotation=Yes");
+ display_notification(_("This sales quotation has been cancelled as requested."), 1);
+ submenu_option(_("Enter a New Sales Quotation"), "/sales/sales_order_entry.php?NewQuotation=Yes");
}
else
{
- display_note(_("This sales order has been cancelled as requested."), 1);
- submenu_option(_("Enter a New Sales Order"), $_SERVER['PHP_SELF']."?NewOrder=Yes");
+ display_notification(_("This sales order has been cancelled as requested."), 1);
+ submenu_option(_("Enter a New Sales Order"), "/sales/sales_order_entry.php?NewOrder=Yes");
}
}
} else {
}
$Ajax->activate('_page_body');
processing_end();
- br(1);
- end_page();
- exit;
+ display_footer_exit();
}
//--------------------------------------------------------------------------------
start_form();
hidden('cart_id');
-
$customer_error = display_order_header($_SESSION['Items'],
($_SESSION['Items']->any_already_delivered() == 0), $idate);
INSERT INTO `0_chart_master` VALUES ('2120', '', 'Accrued Income Tax - State', '4', '0');
INSERT INTO `0_chart_master` VALUES ('2130', '', 'Accrued Franchise Tax', '4', '0');
INSERT INTO `0_chart_master` VALUES ('2140', '', 'Accrued Real & Personal Prop Tax', '4', '0');
+INSERT INTO `0_chart_master` VALUES ('2145', '', 'Purchase Tax', '4', '0');
INSERT INTO `0_chart_master` VALUES ('2150', '', 'Sales Tax', '4', '0');
INSERT INTO `0_chart_master` VALUES ('2160', '', 'Accrued Use Tax Payable', '4', '0');
INSERT INTO `0_chart_master` VALUES ('2210', '', 'Accrued Wages', '4', '0');
### Data of table `0_tax_types` ###
-INSERT INTO `0_tax_types` VALUES ('1', '5', '2150', '2150', 'Tax', '0');
+INSERT INTO `0_tax_types` VALUES ('1', '5', '2150', '2145', 'Tax', '0');
### Structure of table `0_trans_tax_details` ###
INSERT INTO `0_chart_master` VALUES ('2120', '', 'Accrued Income Tax - State', '4', '0');
INSERT INTO `0_chart_master` VALUES ('2130', '', 'Accrued Franchise Tax', '4', '0');
INSERT INTO `0_chart_master` VALUES ('2140', '', 'Accrued Real & Personal Prop Tax', '4', '0');
+INSERT INTO `0_chart_master` VALUES ('2145', '', 'Purchase Tax', '4', '0');
INSERT INTO `0_chart_master` VALUES ('2150', '', 'Sales Tax', '4', '0');
INSERT INTO `0_chart_master` VALUES ('2160', '', 'Accrued Use Tax Payable', '4', '0');
INSERT INTO `0_chart_master` VALUES ('2210', '', 'Accrued Wages', '4', '0');
### Data of table `0_tax_types` ###
-INSERT INTO `0_tax_types` VALUES ('1', '5', '2150', '2150', 'Tax', '0');
+INSERT INTO `0_tax_types` VALUES ('1', '5', '2150', '2145', 'Tax', '0');
### Structure of table `0_trans_tax_details` ###
return false;
}
- if (!is_tax_gl_unique(get_post('sales_gl_code', 'purchasing_gl_code', $selected_id))) {
+ if (!is_tax_gl_unique(get_post('sales_gl_code'), get_post('purchasing_gl_code'), $selected_id)) {
display_error( _("Selected GL Accounts cannot be used by another tax type."));
set_focus('sales_gl_code');
return false;
<li>You can easily upload all the files to your installation folder on the
server overwriting the existing files. From 2.2 RC, your existing configuration files, - <span style="font-weight: bold;">config_db.php, config.php, /lang/installed_languages.inc and installed_extensions.php</span> - will nolonger be installed. They are created the first time you install FrontAccounting and don't need further updates.<br /><ol>
</ol><ul><li>Backup (download) the following files to another folder:
- <ul><li>if you have made <em>changes to other files</em>, like themes or so, backup
+ <ul><li>if you have made <em>changes to other files than above mentioned</em>, like themes or so, backup
these files. </li></ul><ol>
</ol>
</li><li>Upload all the new files.
- </li><li>Look into the file, <span style="font-weight: bold; font-style: italic;">config.default.php and compare with your own config.php</span> file. You should update the the following in your config.php:<br /><br /></li><ul><li><small>Change the $version in your <span style="font-weight: bold;">config.php</span> file, about line 59, from "2.X.X" to "2.2.4".</small></li><li><small>If this is an update from 2.2.3 to 2.2.4 </small><small>you are<span style="font-weight: bold;"> </span><span style="font-style: italic; font-weight: bold;">done and should ignore the the rest of the items in this note</span>.</small></li><li><small>Copy these 2 lines from <span style="font-weight: bold;">config.default.php</span> at the bottom into <span style="font-weight: bold;">config.php</span> at the bottom:<br /><span style="font-family: monospace;"><br />/* allow using of multi level sub-types when digits are of same length in account types */</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$use_new_account_types = 0;</span><br style="font-family: monospace;" /><span style="font-family: monospace;">Change this to 1 if you want to use new multi level sup-types.</span><br style="font-family: monospace;" /></small></li><li><small>If this is an update from "2.2.X" to "2.2.3" you are<span style="font-weight: bold;"> </span><span style="font-style: italic; font-weight: bold;">done and should ignore the the rest of the items in this note</span>.<br /></small></li><li><small>Copy these 2 lines from <span style="font-weight: bold;">config.default.php</span> about line 80-82 into <span style="font-weight: bold;">config.php</span> about line 80:<br /><br /><span style="font-family: monospace;">/* Show users online discretetely in the footer */</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$show_users_online = 0;</span><br style="font-family: monospace;" /><span style="font-family: monospace;">Change this to 1 if you want to show users online.</span><br style="font-family: monospace;" /></small></li><li><small>Replace the 2 lines about line 110-111 in <span style="font-weight: bold;">config.php</span>:<br /><br /><span style="font-family: monospace;">$table_style = "cellpadding=3 border=1 bordercolor='#8cacbb' style='border-collapse: collapse'";</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$table_style2 = "cellpadding=3 border=1 bordercolor='#cccccc' style='border-collapse: collapse'";</span><br style="font-family: monospace;" /></small></li><li><small>With these 4 lines from <span style="font-weight: bold;">config.default.php</span>:<br /><br /><span style="font-family: monospace;">if (!isset($_SESSION['bordercolor']))</span><br style="font-family: monospace;" /><span style="font-family: monospace;"> $_SESSION['bordercolor'] = "#8cacbb";</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$table_style = "cellpadding=3 border=1 bordercolor='".$_SESSION['bordercolor']."' class='tablestyle'";</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$table_style2 = "cellpadding=3 border=1 bordercolor='#cccccc' class='tablestyle2'";</span><br style="font-family: monospace;" /></small></li><li><small>Remove these 2 lines from <span style="font-weight: bold;">config.php</span> about line 176-177:<br /><br /><span style="font-family: monospace;">/* default start-up tab (orders/AP/stock/manuf/proj/GL/system) */</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$def_app = "orders";</span><br style="font-family: monospace;" /></small></li><li><small>Copy these 3 lines from config.default.php about line 113-115<br /><br /><span style="font-family: monospace;">// defalt dateformats and dateseps indexes used before user login</span></small><br style="font-family: monospace;" /><small style="font-family: monospace;">$dflt_date_fmt = 0;</small><br style="font-family: monospace;" /><small><span style="font-family: monospace;">$dflt_date_sep = 0;</span><br style="font-family: monospace;" /></small></li><li><small>Copy these 2 lines from <span style="font-weight: bold;">config.default.php</span> about line 211-212:<br /><br /><span style="font-family: monospace;">define("ICON_SUBMIT", "ok.gif"); // new in 2.2</span><br style="font-family: monospace;" /><span style="font-family: monospace;">define("ICON_ESCAPE", "escape.png"); // new in 2.2</span><br style="font-family: monospace;" /></small></li><li><small>And paste them into <span style="font-weight: bold;">config.php</span> about line 209</small></li><li><small>If you use gregorian calendar and have non-workdays on Friday and first day of week = Saturday<br />then you should set this line in <span style="font-weight: bold;">config.php</span> about line 95.<br /></small><pre><small>$date_system = 3;</small></pre></li><li><small>If you want to use FrontAccounting help wiki then set this line in config.php about line 85<br /></small><pre><small>$help_base_url = "http://frontaccounting.net/fawiki?n=Help.";<br /></small></pre></li></ul><li>Rename or remove the /install folder (you have already performed the install
+ </li><li>Look into the file, <span style="font-weight: bold; font-style: italic;">config.default.php and compare with your own config.php</span> file. You should update the the following in your config.php:<br /><br /></li><ul><li><small>Change the $version in your <span style="font-weight: bold;">config.php</span> file, about line 59, from "2.X.X" to "2.2.5".</small></li><li><small>If this is an update from 2.2.3, 2.2.4 to 2.2.5 </small><small>you are<span style="font-weight: bold;"> </span><span style="font-style: italic; font-weight: bold;">done and should ignore the the rest of the items in this note</span>.</small></li><li><small>Copy these 2 lines from <span style="font-weight: bold;">config.default.php</span> at the bottom into <span style="font-weight: bold;">config.php</span> at the bottom:<br /><span style="font-family: monospace;"><br />/* allow using of multi level sub-types when digits are of same length in account types */</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$use_new_account_types = 0;</span><br style="font-family: monospace;" /><span style="font-family: monospace;">Change this to 1 if you want to use new multi level sup-types.</span><br style="font-family: monospace;" /></small></li><li><small>If this is an update from "2.2.X" to "2.2.5" you are<span style="font-weight: bold;"> </span><span style="font-style: italic; font-weight: bold;">done and should ignore the the rest of the items in this note</span>.<br /></small></li><li><small>Copy these 2 lines from <span style="font-weight: bold;">config.default.php</span> about line 80-82 into <span style="font-weight: bold;">config.php</span> about line 80:<br /><br /><span style="font-family: monospace;">/* Show users online discretetely in the footer */</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$show_users_online = 0;</span><br style="font-family: monospace;" /><span style="font-family: monospace;">Change this to 1 if you want to show users online.</span><br style="font-family: monospace;" /></small></li><li><small>Replace the 2 lines about line 110-111 in <span style="font-weight: bold;">config.php</span>:<br /><br /><span style="font-family: monospace;">$table_style = "cellpadding=3 border=1 bordercolor='#8cacbb' style='border-collapse: collapse'";</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$table_style2 = "cellpadding=3 border=1 bordercolor='#cccccc' style='border-collapse: collapse'";</span><br style="font-family: monospace;" /></small></li><li><small>With these 4 lines from <span style="font-weight: bold;">config.default.php</span>:<br /><br /><span style="font-family: monospace;">if (!isset($_SESSION['bordercolor']))</span><br style="font-family: monospace;" /><span style="font-family: monospace;"> $_SESSION['bordercolor'] = "#8cacbb";</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$table_style = "cellpadding=3 border=1 bordercolor='".$_SESSION['bordercolor']."' class='tablestyle'";</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$table_style2 = "cellpadding=3 border=1 bordercolor='#cccccc' class='tablestyle2'";</span><br style="font-family: monospace;" /></small></li><li><small>Remove these 2 lines from <span style="font-weight: bold;">config.php</span> about line 176-177:<br /><br /><span style="font-family: monospace;">/* default start-up tab (orders/AP/stock/manuf/proj/GL/system) */</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$def_app = "orders";</span><br style="font-family: monospace;" /></small></li><li><small>Copy these 3 lines from config.default.php about line 113-115<br /><br /><span style="font-family: monospace;">// defalt dateformats and dateseps indexes used before user login</span></small><br style="font-family: monospace;" /><small style="font-family: monospace;">$dflt_date_fmt = 0;</small><br style="font-family: monospace;" /><small><span style="font-family: monospace;">$dflt_date_sep = 0;</span><br style="font-family: monospace;" /></small></li><li><small>Copy these 2 lines from <span style="font-weight: bold;">config.default.php</span> about line 211-212:<br /><br /><span style="font-family: monospace;">define("ICON_SUBMIT", "ok.gif"); // new in 2.2</span><br style="font-family: monospace;" /><span style="font-family: monospace;">define("ICON_ESCAPE", "escape.png"); // new in 2.2</span><br style="font-family: monospace;" /></small></li><li><small>And paste them into <span style="font-weight: bold;">config.php</span> about line 209</small></li><li><small>If you use gregorian calendar and have non-workdays on Friday and first day of week = Saturday<br />then you should set this line in <span style="font-weight: bold;">config.php</span> about line 95.<br /></small><pre><small>$date_system = 3;</small></pre></li><li><small>If you want to use FrontAccounting help wiki then set this line in config.php about line 85<br /></small><pre><small>$help_base_url = "http://frontaccounting.net/fawiki?n=Help.";<br /></small></pre></li></ul><li>Rename or remove the /install folder (you have already performed the install
process earlier).<br /></li></ul><ol>