amount_row(_("Amount:"), 'amount', null, null, $from_currency);
amount_row(_("Bank Charge:"), 'charge', null, null, $from_currency);
- amount_row("Incomming Amount:", 'target_amount', null, '', $to_currency, 2);
+ amount_row(_("Incomming Amount:"), 'target_amount', null, '', $to_currency, 2);
}
else
{
}
$amount = get_gl_trans_from_to("", $date_, $account);
$diff = $amount - $for_amount;
- if ($diff != 0)
+ if (floatcmp($diff,0))
{
if ($trans_no == null)
$trans_no = get_next_trans_no(ST_JOURNAL);
-$diff, null, $person_type_id, $person_id);
add_gl_trans(ST_JOURNAL, $trans_no, $date_, get_company_pref('exchange_diff_act'), 0, 0,
_("Exchange Variance"), $diff, null, $person_type_id, $person_id);
+ return true;
}
- return ($diff != 0);
+ return false;
}
//------------- New helper functions for revaluation of customer/supplier currencies 2011-05-08 Joe Hunt.
}
}
-// if (isset($_POST['_ex_rate']) && !check_num('_ex_rate', 0.000001))
-// {
-// display_error(_("The exchange rate must be numeric and greater than zero."));
-// set_focus('_ex_rate');
-// return false;
-// }
-
if ($_POST['discount'] == "")
{
$_POST['discount'] = 0;
return false;
}
- //if (input_num('amount') - input_num('discount') <= 0)
if (input_num('amount') <= 0)
{
display_error(_("The total of the amount and the discount is zero or negative. Please enter positive values."));
function handle_add_payment()
{
- $supp_currency = get_supplier_currency($_POST['supplier_id']);
- $bank_currency = get_bank_account_currency($_POST['bank_account']);
- $comp_currency = get_company_currency();
-
- if ($comp_currency != $bank_currency && $bank_currency != $supp_currency)
- $rate = 0;
- else
- {
- $rate = input_num('_ex_rate');
- $supplier_amount = input_num('bank_amount');
- if($supplier_amount) $rate = input_num('amount')/$supplier_amount;
- }
-
$payment_id = write_supp_payment(0, $_POST['supplier_id'], $_POST['bank_account'],
$_POST['DatePaid'], $_POST['ref'], input_num('amount'), input_num('discount'), $_POST['memo_'],
input_num('charge'), input_num('bank_amount', input_num('amount')));
//----------------------------------------------------------------------------------------------
if (get_post('AddPaymentItem') && can_process()) {
-
- $cust_currency = get_customer_currency($_POST['customer_id']);
- $bank_currency = get_bank_account_currency($_POST['bank_account']);
- $comp_currency = get_company_currency();
-// if ($comp_currency != $bank_currency && $bank_currency != $cust_currency)
-// $rate = 0;
-// else
-// $rate = input_num('_ex_rate');
new_doc_date($_POST['DateBanked']);
function edit_link($row)
{
- $str = '';
-
- if (@$_GET['popup'])
+ if (@$_GET['popup'] || get_voided_entry($row['type'], $row["trans_no"]) || is_closed_trans($row['type'], $row["trans_no"]))
return '';
+
+ $str = '';
switch($row['type']) {
- case ST_SALESINVOICE:
- if (get_voided_entry(ST_SALESINVOICE, $row["trans_no"]) === false && $row['Allocated'] == 0)
+ case ST_SALESINVOICE:
$str = "/sales/customer_invoice.php?ModifyInvoice=".$row['trans_no'];
break;
- case ST_CUSTCREDIT:
- if (get_voided_entry(ST_CUSTCREDIT, $row["trans_no"]) === false && $row['Allocated'] == 0) // 2008-11-19 Joe Hunt
- {
+ case ST_CUSTCREDIT:
if ($row['order_']==0) // free-hand credit note
$str = "/sales/credit_note_entry.php?ModifyCredit=".$row['trans_no'];
else // credit invoice
$str = "/sales/customer_credit_invoice.php?ModifyCredit=".$row['trans_no'];
- }
break;
- case ST_CUSTDELIVERY:
- if (get_voided_entry(ST_CUSTDELIVERY, $row["trans_no"]) === false)
+ case ST_CUSTDELIVERY:
$str = "/sales/customer_delivery.php?ModifyDelivery=".$row['trans_no'];
break;
- case ST_CUSTPAYMENT:
- if (get_voided_entry(ST_CUSTPAYMENT, $row["trans_no"]) === false)
+ case ST_CUSTPAYMENT:
$str = "/sales/customer_payments.php?trans_no=".$row['trans_no'];
break;
- }
- if ($str != "" && !is_closed_trans($row['type'], $row["trans_no"]))
- return pager_link(_('Edit'), $str, ICON_EDIT);
- return '';
+ }
+
+ return $str ? pager_link(_('Edit'), $str, ICON_EDIT) : '';
}
function prt_link($row)