! -> Note
$ -> Affected files
+26-Jun-2009 Joe Hunt
++ Added Bank Charge field to Customer Payment and Supplier Payment and a new default bank charge account in gl_setup.
+$ /admin/gl_setup.php
+ /admin/db/company_db.inc
+ /purchasing/supplier_payment.php
+ /purchasing/includes/db/supp_payment_db.inc
+ /sales/customer_payment.php
+ /sales/includes/db/payment_db.inc
+ /sql/alter2.2.sql
+ /sql/en_US-demo.sql
+ /sql/en_US-new.sql
+
25-Jun-2009 Joe Hunt
! Changed balance_sheet field in account class to ctype and fixed class editing.
# Parse error in ui_lists.inc. Masked include_once(/validation.inc) in main.inc.
function update_company_gl_setup($retained_act, $profit_loss_act, $debtors_act, $pyt_discount_act, $creditors_act,
$freight_act,
$exchange_diff_act,
+ $bank_charge_act,
$default_sales_act,
$default_sales_discount_act,
$default_prompt_payment_act,
creditors_act=".db_escape($creditors_act).",
freight_act=".db_escape($freight_act).",
exchange_diff_act=".db_escape($exchange_diff_act).",
+ bank_charge_act=".db_escape($bank_charge_act).",
default_sales_act=".db_escape($default_sales_act).",
default_sales_discount_act=".db_escape($default_sales_discount_act).",
default_prompt_payment_act=".db_escape($default_prompt_payment_act).",
update_company_gl_setup($_POST['retained_earnings_act'], $_POST['profit_loss_year_act'],
$_POST['debtors_act'], $_POST['pyt_discount_act'],
$_POST['creditors_act'], $_POST['freight_act'],
- $_POST['exchange_diff_act'],
+ $_POST['exchange_diff_act'], $_POST['bank_charge_act'],
$_POST['default_sales_act'],
$_POST['default_sales_discount_act'],
$_POST['default_prompt_payment_act'],
$_POST['pyt_discount_act'] = $myrow["pyt_discount_act"];
$_POST['exchange_diff_act'] = $myrow["exchange_diff_act"];
+$_POST['bank_charge_act'] = $myrow["bank_charge_act"];
$_POST['default_sales_act'] = $myrow["default_sales_act"];
$_POST['default_sales_discount_act'] = $myrow["default_sales_discount_act"];
$_POST['default_prompt_payment_act'] = $myrow["default_prompt_payment_act"];
gl_all_accounts_list_row(_("Exchange Variances Account:"), 'exchange_diff_act', $_POST['exchange_diff_act']);
+gl_all_accounts_list_row(_("Bank Charges Account:"), 'bank_charge_act', $_POST['bank_charge_act']);
+
//---------------
table_section_title(_("Customers and Sales"));
percent_row(_("Invoice Over-Charge Allowance:"), 'po_over_charge');
-// Not used in FA2.0.
-//gl_all_accounts_list_row(_("Purchases Exchange Variances Account:"), 'purch_exchange_diff_act', $_POST['purch_exchange_diff_act']);
-// Not used in FA2.0.
-//gl_all_accounts_list_row(_("Goods Received Clearing Account:"), 'grn_act', $_POST['grn_act']);
-
table_section_title(_("Suppliers and Purchasing Defaults"));
gl_all_accounts_list_row(_("Payable Account:"), 'creditors_act', $_POST['creditors_act']);
See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
function add_supp_payment($supplier_id, $date_, $bank_account,
- $amount, $discount, $ref, $memo_, $rate=0)
+ $amount, $discount, $ref, $memo_, $rate=0, $charge=0)
{
begin_transaction();
{
$supp_amount = exchange_from_to($amount, $bank_account_currency, $supplier_currency, $date_);
$supp_discount = exchange_from_to($discount, $bank_account_currency, $supplier_currency, $date_);
+ $supp_charge = exchange_from_to($charge, $bank_account_currency, $supplier_currency, $date_);
}
else
{
$supp_amount = round($amount / $rate, user_price_dec());
$supp_discount = round($discount / $rate, user_price_dec());
+ $supp_charge = round($charge / $rate, user_price_dec());
}
-$supp_discount, $supplier_id, "", $rate);
}
+ if ($supp_charge != 0)
+ {
+ $charge_act = get_company_pref('bank_charge_act');
+ $total += add_gl_trans_supplier($trans_type, $payment_id, $date_, $charge_act, 0, 0,
+ $supp_charge, $supplier_id, "", $rate);
+ }
+
if ($supp_amount != 0)
{
$total += add_gl_trans_supplier($trans_type, $payment_id, $date_, $bank_gl_account, 0, 0,
- -$supp_amount, $supplier_id, "", $rate);
+ -($supp_amount + $supp_charge), $supplier_id, "", $rate);
}
/*Post a balance post if $total != 0 */
amount_row(_("Amount of Payment:"), 'amount');
amount_row(_("Amount of Discount:"), 'discount');
+ amount_row(_("Bank Charge:"), 'charge');
date_row(_("Date Paid") . ":", 'DatePaid', '', true, 0, 0, 0, null, true);
table_section(2);
- //echo "</table>";
- //echo "</td><td valign=top class='tableseparator'>"; // outer table
- //echo "<table>";
supplier_list_row(_("Payment To:"), 'supplier_id', null, false, true);
ref_row(_("Reference:"), 'ref', '', references::get_next(22));
- text_row(_("Memo:"), 'memo_', null, 52,50);
-
- //echo "</table>";
+ textarea_row(_("Memo:"), 'memo_', null, 22, 4);
- //echo "</td></tr>";
end_outer_table(1); // outer table
submit_center('ProcessSuppPayment',_("Enter Payment"), true, '', 'default');
return false;
}
+ if (isset($_POST['charge']) && !check_num('charge', 0)) {
+ display_error(_("The entered amount is invalid or less than zero."));
+ set_focus('charge');
+ return false;
+ }
+
if (isset($_POST['_ex_rate']) && !check_num('_ex_rate', 0.000001))
{
display_error(_("The exchange rate must be numeric and greater than zero."));
$payment_id = add_supp_payment($_POST['supplier_id'], $_POST['DatePaid'],
$_POST['bank_account'], input_num('amount'), input_num('discount'),
- $_POST['ref'], $_POST['memo_'], $rate);
+ $_POST['ref'], $_POST['memo_'], $rate, input_num('charge'));
new_doc_date($_POST['DatePaid']);
//unset($_POST['supplier_id']);
unset($_POST['bank_account']);
return false;
}
+ if (isset($_POST['charge']) && !check_num('charge', 0)) {
+ display_error(_("The entered amount is invalid or negative and cannot be processed."));
+ set_focus('charge');
+ return false;
+ }
+
if (isset($_POST['_ex_rate']) && !check_num('_ex_rate', 0.000001))
{
display_error(_("The exchange rate must be numeric and greater than zero."));
$payment_no = write_customer_payment(0, $_POST['customer_id'], $_POST['BranchID'],
$_POST['bank_account'], $_POST['DateBanked'], $_POST['ref'],
- input_num('amount'), input_num('discount'), $_POST['memo_'], $rate);
+ input_num('amount'), input_num('discount'), $_POST['memo_'], $rate, input_num('charge'));
meta_forward($_SERVER['PHP_SELF'], "AddedID=$payment_no");
}
label_row(_("Customer prompt payment discount :"), $display_discount_percent);
- date_row(_("Date of Deposit:"), 'DateBanked', '', true, 0, 0, 0, null, true);
+ amount_row(_("Bank Charge:"), 'charge');
table_section(2);
+ date_row(_("Date of Deposit:"), 'DateBanked', '', true, 0, 0, 0, null, true);
+
bank_accounts_list_row(_("Into Bank Account:"), 'bank_account', null, true);
$cust_currency = get_customer_currency($_POST['customer_id']);
if ($cust_currency != $bank_currency)
display_note(_("Amount and discount are in customer's currency."));
- echo"<br>";
+ br();
submit_center('AddPaymentItem', _("Add Payment"), true, '', 'default');
}
- echo "<br>";
+ br();
}
//----------------------------------------------------------------------------------------------
Write/update customer payment.
*/
function write_customer_payment($trans_no, $customer_id, $branch_id, $bank_account,
- $date_, $ref, $amount, $discount, $memo_, $rate=0)
+ $date_, $ref, $amount, $discount, $memo_, $rate=0, $charge=0)
{
begin_transaction();
$total = 0;
/* Bank account entry first */
$total += add_gl_trans_customer(12, $payment_no, $date_,
- $bank_gl_account, 0, 0, $amount, $customer_id,
+ $bank_gl_account, 0, 0, $amount - $charge, $customer_id,
"Cannot insert a GL transaction for the bank account debit", $rate);
if ($branch_id != reserved_words::get_any_numeric()) {
"Cannot insert a GL transaction for the payment discount debit", $rate);
}
+ if ($charge != 0) {
+ /* Now Debit bank charge account with charges */
+ $charge_act = get_company_pref('bank_charge_act');
+ $total += add_gl_trans_customer(12, $payment_no, $date_,
+ $charge_act, 0, 0, $charge, $customer_id,
+ "Cannot insert a GL transaction for the payment bank charge debit", $rate);
+ }
/*Post a balance post if $total != 0 */
add_gl_balance(12, $payment_no, $date_, -$total, payment_person_types::customer(), $customer_id);
ALTER TABLE `0_company` DROP COLUMN `purch_exchange_diff_act`;
ALTER TABLE `0_company` ADD COLUMN`profit_loss_year_act` VARCHAR(11) NOT NULL DEFAULT '' AFTER `exchange_diff_act`;
ALTER TABLE `0_company` ADD COLUMN `time_zone` TINYINT(1) NOT NULL DEFAULT '0';
+ALTER TABLE `0_company` CHANGE `grn_act` `bank_charge_act` VARCHAR(11) NOT NULL DEFAULT '';
#INSERT INTO `0_chart_master` VALUES ('8900', '', 'Profit and Loss this year', '52', '0');
-UPDATE `0_company` SET `profit_loss_year_act`='8900', `version_id`='2.2' WHERE `coy_code`=1;
+UPDATE `0_company` SET `profit_loss_year_act`='9990', `version_id`='2.2' WHERE `coy_code`=1;
ALTER TABLE `0_stock_category` DROP COLUMN `stock_act`;
ALTER TABLE `0_stock_category` DROP COLUMN `cogs_act`;
`debtors_act` varchar(11) NOT NULL default '',
`pyt_discount_act` varchar(11) NOT NULL default '',
`creditors_act` varchar(11) NOT NULL default '',
- `grn_act` varchar(11) NOT NULL default '',
+ `bank_charge_act` varchar(11) NOT NULL default '',
`exchange_diff_act` varchar(11) NOT NULL default '',
`profit_loss_year_act` varchar(11) NOT NULL default '',
`retained_earnings_act` varchar(11) NOT NULL default '',
### Data of table `0_company` ###
-INSERT INTO `0_company` VALUES ('1', 'Training Co.', '9876543', '123456789', '1', '1', 'Address 1\r\nAddress 2\r\nAddress 3', '(222) 111.222.333', '', 'delta@delta.com', 'logo_frontaccounting.jpg', '', 'USD', '1200', '5060', '2100', '1430', '4450', '9990', '3590', '4430', '4010', '4510', '4500', '1510', '5010', '5040', '4010', '1530', '5000', '0', '10', '10', '1000', '20', '20', '30', '1', '2', '0', '0', '0', '1', '0', '0', '', '1', '2.2', '0');
+INSERT INTO `0_company` VALUES ('1', 'Training Co.', '9876543', '123456789', '1', '1', 'Address 1\r\nAddress 2\r\nAddress 3', '(222) 111.222.333', '', 'delta@delta.com', 'logo_frontaccounting.jpg', '', 'USD', '1200', '5060', '2100', '5690', '4450', '9990', '3590', '4430', '4010', '4510', '4500', '1510', '5010', '5040', '4010', '1530', '5000', '0', '10', '10', '1000', '20', '20', '30', '1', '2', '0', '0', '0', '1', '0', '0', '', '1', '2.2', '0');
### Structure of table `0_credit_status` ###
`debtors_act` varchar(11) NOT NULL default '',
`pyt_discount_act` varchar(11) NOT NULL default '',
`creditors_act` varchar(11) NOT NULL default '',
- `grn_act` varchar(11) NOT NULL default '',
+ `bank_charge_act` varchar(11) NOT NULL default '',
`exchange_diff_act` varchar(11) NOT NULL default '',
`profit_loss_year_act` varchar(11) NOT NULL default '',
`retained_earnings_act` varchar(11) NOT NULL default '',
### Data of table `0_company` ###
-INSERT INTO `0_company` VALUES ('1', 'Company name', '', '', '1', '1', 'N/A', '', '', '', '', '', 'USD', '1200', '5060', '2100', '1430', '4450', '9990', '3590', '4430', '4010', '4510', '4500', '1510', '5010', '5040', '4010', '1530', '5000', '0', '10', '10', '1000', '20', '20', '30', '1', '1', '0', '0', '0', '1', '0', '0', '', '1', '2.2', '0');
+INSERT INTO `0_company` VALUES ('1', 'Company name', '', '', '1', '1', 'N/A', '', '', '', '', '', 'USD', '1200', '5060', '2100', '5690', '4450', '9990', '3590', '4430', '4010', '4510', '4500', '1510', '5010', '5040', '4010', '1530', '5000', '0', '10', '10', '1000', '20', '20', '30', '1', '1', '0', '0', '0', '1', '0', '0', '', '1', '2.2', '0');
### Structure of table `0_credit_status` ###