X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fui_view.inc;h=d9a33af98cedd1cc61b6107f5116aab659e4a763;hb=31c79a2d7cc29c18ac1bfa92cf070857a5b9fe98;hp=1d4f1fc1788ac6b6416e42b2ef72a2f40cb31b8c;hpb=d567a10b7925c8bb97c734e213d6651a979af29d;p=fa-stable.git
diff --git a/includes/ui/ui_view.inc b/includes/ui/ui_view.inc
index 1d4f1fc1..d9a33af9 100644
--- a/includes/ui/ui_view.inc
+++ b/includes/ui/ui_view.inc
@@ -317,7 +317,7 @@ function exchange_rate_display($from_currency, $to_currency, $date_, $edit_rate=
if ($edit_rate)
text_row(_("Exchange Rate:"), '_ex_rate', $rate, 8, 8, null, "", " $from_currency = 1 $to_currency");
else
- label_row(_("Exchange Rate:"),"$rate $from_currency = 1 $to_currency" );
+ label_row(_("Exchange Rate:"),"$rate $from_currency = 1 $to_currency" );
$Ajax->addUpdate('_ex_rate','_ex_rate', $rate);
}
}
@@ -401,7 +401,7 @@ function view_stock_status_cell($stock_id, $description=null)
function display_debit_or_credit_cells($value)
{
- if ($value > 0)
+ if ($value >= 0)
{
amount_cell($value);
label_cell("");
@@ -411,12 +411,6 @@ function display_debit_or_credit_cells($value)
label_cell("");
amount_cell(abs($value));
}
- else
- {
- //label_cell("");
- amount_cell(0);
- label_cell("");
- }
}
//--------------------------------------------------------------------------------------
@@ -602,18 +596,30 @@ function display_quick_entries(&$cart, $id, $base, $type, $descr='')
case "t": // post taxes calculated on base amount
case "t+": // ditto & increase base amount
case "t-": // ditto & reduce base amount
- $taxes = get_taxes_for_item_tax($qe_line['dest_id']);
+ //$taxes = get_taxes_for_item_tax($qe_line['dest_id']);
+ $taxes = array();
+ $res = get_tax_group_items($qe_line['dest_id']);
+ while ($row = db_fetch($res))
+ $taxes[] = $row;
$tax_total = 0;
+ $totrate = 0;
+ // find total tax
+ if (substr($qe_line['action'],0,1) != 'T') {
+ foreach ($taxes as $index => $item_tax) {
+ $totrate += $item_tax['rate'];
+ }
+ }
+ $taxbase = $base/($totrate+100);
foreach ($taxes as $index => $item_tax) {
- if(substr($qe_line['action'],0,1) != 'T')
- $tax = round2($base * $item_tax['rate']
- / ($item_tax['rate'] + 100), user_price_dec());
- else
- $tax = round2($base * $item_tax['rate'] / 100, user_price_dec());
-
+ $tax = round2($taxbase * $item_tax['rate'], user_price_dec());
$gl_code = ($type == QE_DEPOSIT || ($type == QE_JOURNAL && $base < 0))
? $item_tax['sales_gl_code'] : $item_tax['purchasing_gl_code'];
$tax_total += $tax;
+ if ($tax==0) continue;
+ if (!is_tax_gl_unique($gl_code)) {
+ display_error(_("Cannot post to GL account used by more than one tax type."));
+ break 3;
+ }
if ($type != QE_SUPPINV)
$cart->add_gl_item($gl_code,
$qe_line['dimension_id'], $qe_line['dimension2_id'],
@@ -650,16 +656,12 @@ function display_quick_entries(&$cart, $id, $base, $type, $descr='')
function get_js_open_window($width, $height)
{
- $js = "\n\n";
+ . "}\n";
return $js;
}
@@ -683,8 +685,7 @@ function default_focus($name, $form_no=0) {
function get_js_png_fix()
{
- $js = "\n";
+ . "}\n";
return $js;
}