From bf00f0e16df5974ecba17b59be8bc660bdf6b8a8 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Tue, 25 Nov 2008 10:26:54 +0000 Subject: [PATCH] Merged all main trunk bugfixes up to release 2.0.5 --- CHANGELOG.txt | 129 +++++++++++++++++ admin/db/voiding_db.inc | 4 +- admin/void_transaction.php | 97 ++++++++++++- gl/includes/db/gl_db_trans.inc | 9 +- gl/inquiry/gl_trial_balance.php | 127 ++++++++++------- includes/banking.inc | 8 +- includes/ui/ui_input.inc | 2 +- includes/ui/ui_view.inc | 17 +-- manufacturing/manage/bom_edit.php | 16 +-- purchasing/includes/db/invoice_db.inc | 2 +- purchasing/includes/db/supp_payment_db.inc | 23 ++- purchasing/includes/db/supp_trans_db.inc | 6 +- purchasing/includes/purchasing_db.inc | 4 +- purchasing/includes/ui/invoice_ui.inc | 71 +++++----- purchasing/po_receive_items.php | 26 ++-- purchasing/supplier_credit.php | 64 +++++---- purchasing/supplier_invoice.php | 127 ++++++++++------- purchasing/supplier_payment.php | 21 ++- reporting/includes/class.pdf.inc | 4 +- reporting/rep101.php | 2 +- reporting/rep106.php | 2 +- reporting/rep201.php | 3 +- reporting/rep203.php | 31 +++-- reporting/rep209.php | 2 +- reporting/rep708.php | 155 ++++++++++++++------- reporting/reports_main.php | 3 + sales/allocations/customer_allocate.php | 4 +- sales/customer_payments.php | 25 +++- sales/includes/db/cust_trans_db.inc | 3 +- sales/includes/db/payment_db.inc | 12 +- sales/includes/sales_db.inc | 8 +- sales/view/view_receipt.php | 8 +- update.html | 2 +- 33 files changed, 716 insertions(+), 301 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index f90bd180..d853edd1 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,135 @@ Legend: ! -> Note $ -> Affected files +25-Nov-2008 Janusz Dobrowolski +! Merged all changes from main trunk up to 2.0.5 (see details below) +$ /CHANGELOG.txt + /update.html + /admin/void_transaction.php + /admin/db/voiding_db.inc + /gl/includes/db/gl_db_trans.inc + /gl/inquiry/gl_trial_balance.php + /includes/banking.inc + /includes/ui/ui_input.inc + /includes/ui/ui_view.inc + /manufacturing/manage/bom_edit.php + /purchasing/po_receive_items.php + /purchasing/supplier_credit.php + /purchasing/supplier_invoice.php + /purchasing/supplier_payment.php + /purchasing/includes/purchasing_db.inc + /purchasing/includes/db/invoice_db.inc + /purchasing/includes/db/supp_payment_db.inc + /purchasing/includes/db/supp_trans_db.inc + /purchasing/includes/ui/invoice_ui.inc + /reporting/rep101.php + /reporting/rep106.php + /reporting/rep201.php + /reporting/rep203.php + /reporting/rep209.php + /reporting/rep708.php + /reporting/reports_main.php + /reporting/includes/class.pdf.inc + /sales/customer_payments.php + /sales/allocations/customer_allocate.php + /sales/includes/sales_db.inc + /sales/includes/db/cust_trans_db.inc + /sales/includes/db/payment_db.inc + /sales/view/view_receipt.php +------------------------------- Release 2.0.5 -------------------------------------------- +24-Nov.2008 Joe Hunt +! Release 2.0.5 +$ config.php +! Changed update.html +$ update.html +# Small bug fixes +$ /reporting/includes/header2.inc + /sales/view/view_receipt.php + +20-Nov-2008 Janusz Dobrowolski +# [0000082] Bad js allocation on All/None button press. +$ /sales/allocations/customer_allocate.php + +20-Nov-2008 Joe Hunt +# Do not allow editing invoice if allocated > 0 +$ /sales/inquiry/customer_inquiry.php + +19-Nov-2008 Joe Hunt ++ Possibility to view a transaction before final voiding. +$ /admin/void_transaction.php + +11-Nov-2008 Janusz Dobrowolski +# Fixed right alignment of amount cells. +$ /includes/ui/ui_input.inc +# Fixed display bug for fully received items and false modify conflicts. +$ /purchasing/po_receive_items.php + +10-Nov-2008 Joe Hunt +! [0000081] Trial Balance again minor changes. +$ /gl/inquiry/gl_trial_balance.php + /reporting/rep708.php + +07-Nov-2008 Joe Hunt +! [0000081] Changed Trial Balance to show all debits and credits (option to only show balances) +$ /gl/inquiry/gl_trial_balance.php + /reporting/reports_main.php + /reporting/rep708.php + +03-Nov-2008 Janusz Dobrowolski +# Fixed price priority in automatic calculations. +$ sales/includes/sales_db.inc + +30-Oct-2008 Janusz Dobrowolski +# [0000080] BOM elements was not editable after entry. +$ /manufacturing/manage/bom_edit.php + +29-Oct-2008 Joe Hunt +# Voiding a supplier invoice/credit note with GL Postings creates a database error +$ /purchasing/includes/db/invoice_db.inc + +28-Oct-2008 Joe Hunt +# [0000079] Delivery Note/Sales Invoice should not be editable after it has been voided. +$ /admin/db/voiding_db.inc + /sales/inquiry/sales_deliveries_view.php + /sales/inquiry/customer_inquiry.php + +27-Oct-2008 Joe Hunt +! [0000078] Opened Exchange rate for editing (without storing) in sales/purchasing module payment +# Fixed exchange rate display bugs in Supplier Payment (earlier dates). +$ /gl/includes/db/gl_db_trans.inc + /includes/banking.inc + /includes/ui/ui_view.inc + /purchasing/supplier_payment.php + /purchasing/includes/purchasing_db.inc + /purchasing/includes/db/supp_payment_db.inc + /purchasing/includes/db/supp_trans_db.inc + /sales/customer_payments.php + /sales/includes/sales_db.inc + /sales/includes/db/cust_trans_db.inc + /sales/includes/db/payment_db.inc +# [0000078] Fixed some reports with wrong exchange rates. +$ /reporting/rep101.php + /reporting/rep106.php + /reporting/rep201.php + /reporting/rep203.php + /reporting/rep209.php ++ Added confirm box when admins are about to remove PO GRNs from Supplier Invoice +$ /purchasing/supplier_invoice.php + +24-Oct-2008 Joe Hunt +! [0000077] Added a total before ending balance in trial balance (also in report) +$ /gl/inquiry/gl_trial_balance.php + /reporting/rep708.php +! Increased memory limit if reports in unicode (48M) as suggested in forum. + /reporting/includes/class.pdf.inc +! Improved layout of Supplier Invoice/Credit. All Items can now be added in one sweep. +$ /purchasing/supplier_invoice.php + /purchasing/supplier_credit.php + /purchasing/includes/ui/invoice_ui.inc + +------------------------------- Release 2.0.4 -------------------------------------------- +23-Oct-2008 Joe Hunt +! Release 2.0.4 25-Nov-2008 Joe Hunt ! Inserted Copyright Notice and fixed graphic items $ /access/login.php diff --git a/admin/db/voiding_db.inc b/admin/db/voiding_db.inc index 96e46a26..0f77cb20 100644 --- a/admin/db/voiding_db.inc +++ b/admin/db/voiding_db.inc @@ -49,9 +49,7 @@ function void_transaction($type, $type_no, $date_, $memo_) $delivery = get_customer_trans($type_no, $type); if ($delivery['trans_link'] != 0) { - $inv = get_customer_trans($delivery['trans_link'], 10); - if ($inv['ov_amount'] != 0 || $inv['ov_discount'] != 0 || $inv['ov_gst'] != 0 || - $inv['ov_freight'] != 0 || $inv['ov_freight_tax'] != 0 || $inv['alloc'] != 0) + if (get_voided_entry(10, $delivery['trans_link']) === false) return false; } } diff --git a/admin/void_transaction.php b/admin/void_transaction.php index 0e116ab9..e93af71a 100644 --- a/admin/void_transaction.php +++ b/admin/void_transaction.php @@ -21,9 +21,82 @@ include_once($path_to_root . "/admin/db/voiding_db.inc"); $js = ""; if ($use_date_picker) $js .= get_js_date_picker(); +if ($use_popup_windows) + $js .= get_js_open_window(800, 500); + page(_("Void a Transaction"), false, false, "", $js); //---------------------------------------------------------------------------------------- +function exist_transaction($type, $type_no) +{ + $void_entry = get_voided_entry($type, $type_no); + + if ($void_entry != null) + return false; + + switch ($type) + { + case 0 : // it's a journal entry + if (!exists_gl_trans($type, $type_no)) + return false; + break; + + case 1 : // it's a payment + case 2 : // it's a deposit + case 4 : // it's a transfer + if (!exists_bank_trans($type, $type_no)) + return false; + break; + + case 10 : // it's a customer invoice + case 11 : // it's a customer credit note + case 12 : // it's a customer payment + case 13 : // it's a customer dispatch + if (!exists_customer_trans($type, $type_no)) + return false; + break; + + case systypes::location_transfer() : // it's a stock transfer + if (get_stock_transfer_items($type_no) == null) + return false; + break; + + case systypes::inventory_adjustment() : // it's a stock adjustment + if (get_stock_adjustment_items($type_no) == null) + return false; + break; + + case 25 : // it's a GRN + return false; + case 20 : // it's a suppler invoice + case 21 : // it's a supplier credit note + case 22 : // it's a supplier payment + if (!exists_supp_trans($type, $type_no)) + return false; + break; + + case systypes::work_order() : // it's a work order + if (!get_work_order($type_no, true)) + return false; + break; + + case 28 : // it's a work order issue + if (!exists_work_order_issue($type_no)) + return false; + break; + + case 29 : // it's a work order production + if (!exists_work_order_produce($type_no)) + return false; + break; + + case systypes::cost_update() : // it's a stock cost update + return false; + break; + } + + return true; +} function voiding_controls() { @@ -47,10 +120,26 @@ function voiding_controls() submit_center('ProcessVoiding', _("Void Transaction"), true, '', true); else { - - display_note(_("Are you sure you want to void this transaction ? This action cannot be undone."), 0, 1); - submit_center_first('ConfirmVoiding', _("Proceed"), '', true); - submit_center_last('CancelVoiding', _("Cancel"), '', true); + if (!exist_transaction($_POST['filterType'],$_POST['trans_no'])) + { + display_error(_("The entered transaction does not exist or cannot be voided.")); + unset($_POST['trans_no']); + unset($_POST['memo_']); + unset($_POST['date_']); + submit_center('ProcessVoiding', _("Void Transaction"), true, '', true); + } + else + { + display_notification_centered(_("Are you sure you want to void this transaction ? This action cannot be undone."), 0, 1); + if ($_POST['filterType'] == 0) // GL transaction are not included in get_trans_view_str + $view_str = get_gl_view_str($_POST['filterType'],$_POST['trans_no'], _("View Transaction")); + else + $view_str = get_trans_view_str($_POST['filterType'],$_POST['trans_no'], _("View Transaction")); + display_note($view_str); + br(); + submit_center_first('ConfirmVoiding', _("Proceed"), '', true); + submit_center_last('CancelVoiding', _("Cancel"), '', true); + } } end_form(); diff --git a/gl/includes/db/gl_db_trans.inc b/gl/includes/db/gl_db_trans.inc index d44e8eac..30750bbb 100644 --- a/gl/includes/db/gl_db_trans.inc +++ b/gl/includes/db/gl_db_trans.inc @@ -8,13 +8,18 @@ // if $currency is not set, then defaults to no conversion function add_gl_trans($type, $trans_id, $date_, $account, $dimension, $dimension2, $memo_, - $amount, $currency=null, $person_type_id=null, $person_id=null, $err_msg="") + $amount, $currency=null, $person_type_id=null, $person_id=null, $err_msg="", $rate=0) { global $use_audit_trail; $date = date2sql($date_); if ($currency != null) - $amount_in_home_currency = to_home_currency($amount, $currency, $date_); + { + if ($rate == 0) + $amount_in_home_currency = to_home_currency($amount, $currency, $date_); + else + $amount_in_home_currency = round($amount * $rate, user_price_dec()); + } else $amount_in_home_currency = $amount; if ($dimension == null || $dimension < 0) diff --git a/gl/inquiry/gl_trial_balance.php b/gl/inquiry/gl_trial_balance.php index 969cfcca..8d1ad8bc 100644 --- a/gl/inquiry/gl_trial_balance.php +++ b/gl/inquiry/gl_trial_balance.php @@ -35,6 +35,7 @@ function gl_inquiry_controls() date_cells(_("From:"), 'TransFromDate', '', null, -30); date_cells(_("To:"), 'TransToDate'); check_cells(_("No zero values"), 'NoZero', null); + check_cells(_("Only balances"), 'Balance', null); submit_cells('Show',_("Show"),'','', true); end_table(); @@ -43,33 +44,29 @@ function gl_inquiry_controls() //---------------------------------------------------------------------------------------------------- -function get_balance($account, $from, $to, $from_incl=true, $to_incl=true) { - - $sql = "SELECT SUM(amount) As TransactionSum FROM ".TB_PREF."gl_trans - WHERE account='$account'"; - - if ($from) - { - $from_date = date2sql($from); - if ($from_incl) - $sql .= " AND tran_date >= '$from_date'"; - else - $sql .= " AND tran_date > '$from_date'"; - } - - if ($to) - { - $to_date = date2sql($to); - if ($to_incl) - $sql .= " AND tran_date <= '$to_date' "; - else - $sql .= " AND tran_date < '$to_date' "; - } +function get_balance($account, $from, $to, $from_incl=true, $to_incl=true) +{ + $sql = "SELECT SUM(IF(amount >= 0, amount, 0)) as debit, SUM(IF(amount < 0, -amount, 0)) as credit, SUM(amount) as balance + FROM ".TB_PREF."gl_trans,".TB_PREF."chart_master,".TB_PREF."chart_types, ".TB_PREF."chart_class + WHERE ".TB_PREF."gl_trans.account=".TB_PREF."chart_master.account_code AND ".TB_PREF."chart_master.account_type=".TB_PREF."chart_types.id + AND ".TB_PREF."chart_types.class_id=".TB_PREF."chart_class.cid AND"; + + if ($account != null) + $sql .= " account='$account' AND"; + $from_date = date2sql($from); + if ($from_incl) + $sql .= " tran_date >= '$from_date' AND"; + else + $sql .= " tran_date > IF(".TB_PREF."chart_class.balance_sheet=1, '0000-00-00', '$from_date') AND"; + $to_date = date2sql($to); + if ($to_incl) + $sql .= " tran_date <= '$to_date' "; + else + $sql .= " tran_date < '$to_date' "; $result = db_query($sql,"No general ledger accounts were returned"); - $row = db_fetch_row($result); - return $row[0]; + return db_fetch($result); } //---------------------------------------------------------------------------------------------------- @@ -99,44 +96,74 @@ function display_trial_balance() $k = 0; - $totprev = $totcurr = 0.0; $accounts = get_gl_accounts(); - + $pdeb = $pcre = $cdeb = $ccre = $tdeb = $tcre = $pbal = $cbal = $tbal = 0; + $begin = begin_fiscalyear(); + if (date1_greater_date2($begin, $_POST['TransFromDate'])) + $begin = $_POST['TransFromDate']; + $begin = add_days($begin, -1); + while ($account = db_fetch($accounts)) { - if (is_account_balancesheet($account["account_code"])) - $begin = null; - else - { - $begin = begin_fiscalyear(); - if (date1_greater_date2($begin, $_POST['TransFromDate'])) - $begin = $_POST['TransFromDate']; - $begin = add_days($begin, -1); - } - $prev_balance = get_balance($account["account_code"], $begin, $_POST['TransFromDate'], false, false); - - $curr_balance = get_balance($account["account_code"], $_POST['TransFromDate'], $_POST['TransToDate']); - if (check_value("NoZero") && !$prev_balance && !$curr_balance) + $prev = get_balance($account["account_code"], $begin, $_POST['TransFromDate'], false, false); + $curr = get_balance($account["account_code"], $_POST['TransFromDate'], $_POST['TransToDate'], true, true); + $tot = get_balance($account["account_code"], $begin, $_POST['TransToDate'], false, true); + if (check_value("NoZero") && !$prev['balance'] && !$curr['balance'] && !$tot['balance']) continue; - $totprev += $prev_balance; - $totcurr += $curr_balance; alt_table_row_color($k); $url = "" . $account["account_code"] . ""; label_cell($url); label_cell($account["account_name"]); - - display_debit_or_credit_cells($prev_balance); - display_debit_or_credit_cells($curr_balance); - display_debit_or_credit_cells($prev_balance + $curr_balance); + if (check_value('Balance')) + { + display_debit_or_credit_cells($prev['balance']); + display_debit_or_credit_cells($curr['balance']); + display_debit_or_credit_cells($tot['balance']); + + } + else + { + amount_cell($prev['debit']); + amount_cell($prev['credit']); + amount_cell($curr['debit']); + amount_cell($curr['credit']); + amount_cell($tot['debit']); + amount_cell($tot['credit']); + $pdeb += $prev['debit']; + $pcre += $prev['credit']; + $cdeb += $curr['debit']; + $ccre += $curr['credit']; + $tdeb += $tot['debit']; + $tcre += $tot['credit']; + } + $pbal += $prev['balance']; + $cbal += $curr['balance']; + $tbal += $tot['balance']; end_row(); } - start_row("class='inquirybg'"); - label_cell("" . _("Ending Balance") ." - ".$_POST['TransToDate']. "", "colspan=2"); - display_debit_or_credit_cells($totprev); - display_debit_or_credit_cells($totcurr); - display_debit_or_credit_cells($totprev + $totcurr); + + //$prev = get_balance(null, $begin, $_POST['TransFromDate'], false, false); + //$curr = get_balance(null, $_POST['TransFromDate'], $_POST['TransToDate'], true, true); + //$tot = get_balance(null, $begin, $_POST['TransToDate'], false, true); + if (!check_value('Balance')) + { + start_row("class='inquirybg' style='font-weight:bold'"); + label_cell(_("Total") ." - ".$_POST['TransToDate'], "colspan=2"); + amount_cell($pdeb); + amount_cell($pcre); + amount_cell($cdeb); + amount_cell($ccre); + amount_cell($tdeb); + amount_cell($tcre); + end_row(); + } + start_row("class='inquirybg' style='font-weight:bold'"); + label_cell(_("Ending Balance") ." - ".$_POST['TransToDate'], "colspan=2"); + display_debit_or_credit_cells($pbal); + display_debit_or_credit_cells($cbal); + display_debit_or_credit_cells($tbal); end_row(); end_table(1); diff --git a/includes/banking.inc b/includes/banking.inc index 54345259..39b904c8 100644 --- a/includes/banking.inc +++ b/includes/banking.inc @@ -158,6 +158,7 @@ function exchange_variation($pyt_type, $pyt_no, $type, $trans_no, $pyt_date, $am if ($person_type == payment_person_types::customer()) { $trans = get_customer_trans($trans_no, $type); + $pyt_trans = get_customer_trans($pyt_no, $pyt_type); $ar_ap_act = $trans['receivables_account']; $person_id = $trans['debtor_no']; $curr = $trans['curr_code']; @@ -165,6 +166,7 @@ function exchange_variation($pyt_type, $pyt_no, $type, $trans_no, $pyt_date, $am else { $trans = get_supp_trans($trans_no, $type); + $pyt_trans = get_supp_trans($pyt_no, $pyt_type); $supp_accs = get_supplier_accounts($trans['supplier_id']); $ar_ap_act = $supp_accs['payable_account']; $person_id = $trans['supplier_id']; @@ -172,9 +174,8 @@ function exchange_variation($pyt_type, $pyt_no, $type, $trans_no, $pyt_date, $am } if (is_company_currency($curr)) return; - $exc_var_act = get_company_pref('exchange_diff_act'); - $inv_amt = to_home_currency($amount, $curr, sql2date($trans['tran_date'])); - $pay_amt = to_home_currency($amount, $curr, $pyt_date); + $inv_amt = round($amount * $trans['rate'], user_price_dec()); + $pay_amt = round($amount * $pyt_trans['rate'], user_price_dec()); if ($inv_amt != $pay_amt) { $diff = $inv_amt - $pay_amt; @@ -182,6 +183,7 @@ function exchange_variation($pyt_type, $pyt_no, $type, $trans_no, $pyt_date, $am $diff = -$diff; if ($neg) $diff = -$diff; + $exc_var_act = get_company_pref('exchange_diff_act'); $memo = systypes::name($type)." ".$trans_no; add_gl_trans($pyt_type, $pyt_no, $pyt_date, $ar_ap_act, 0, 0, $memo, -$diff, null, $person_type, $person_id); add_gl_trans($pyt_type, $pyt_no, $pyt_date, $exc_var_act, 0, 0, $memo, $diff, null, $person_type, $person_id); diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc index 59064f82..951bbccd 100644 --- a/includes/ui/ui_input.inc +++ b/includes/ui/ui_input.inc @@ -494,7 +494,7 @@ function amount_cells_ex($label, $name, $size, $max=null, $init=null, $params=nu if (!isset($max)) $max = $size; - echo ""; + echo ""; echo ""; diff --git a/includes/ui/ui_view.inc b/includes/ui/ui_view.inc index 221ba624..a757bacc 100644 --- a/includes/ui/ui_view.inc +++ b/includes/ui/ui_view.inc @@ -288,7 +288,7 @@ function get_trans_view_str($type, $trans_no, $label="", $icon=false) // When there is no exrate for today, // gets it form ECB and stores in local database. // -function exchange_rate_display($from_currency, $to_currency, $date_) +function exchange_rate_display($from_currency, $to_currency, $date_, $edit_rate=false) { global $Ajax; @@ -309,15 +309,16 @@ function exchange_rate_display($from_currency, $to_currency, $date_) } } if (!$rate) - $rate = get_exchange_rate_from_to($to_currency, $from_currency, $date_); - - if ($from_currency == $comp_currency) - $rate = 1 / $rate; + $rate = get_exchange_rate_from_home_currency($currency, $date_); + if ($from_currency != $comp_currency) + $rate = 1 / ($rate / get_exchange_rate_from_home_currency($to_currency, $date_)); $rate = number_format2($rate, user_exrate_dec()); - label_row(_("Exchange Rate:"),"1 " . $from_currency - . " = " . $rate . " " . $to_currency ); - $Ajax->addUpdate('_ex_rate','_ex_rate', $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" ); + $Ajax->addUpdate('_ex_rate','_ex_rate', $rate); } } diff --git a/manufacturing/manage/bom_edit.php b/manufacturing/manage/bom_edit.php index 8b978c7d..2ffb0b5f 100644 --- a/manufacturing/manage/bom_edit.php +++ b/manufacturing/manage/bom_edit.php @@ -189,7 +189,7 @@ function on_submit($selected_parent, $selected_component=-1) if ($Mode == 'Delete') { - $sql = "DELETE FROM ".TB_PREF."bom WHERE id='" . $selected_component. "'"; + $sql = "DELETE FROM ".TB_PREF."bom WHERE id='" . $selected_id. "'"; db_query($sql,"Could not delete this bom components"); display_notification(_("The component item has been deleted from this bom")); @@ -198,7 +198,7 @@ if ($Mode == 'Delete') if ($Mode == 'RESET') { - $selected_component = -1; + $selected_id = -1; unset($_POST['quantity']); } @@ -219,7 +219,7 @@ if (get_post('stock_id') != '') { //Parent Item selected so display bom or edit component $selected_parent = $_POST['stock_id']; if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') - on_submit($selected_parent, $selected_component); + on_submit($selected_parent, $selected_id); //-------------------------------------------------------------------------------------- start_form(); @@ -231,12 +231,12 @@ start_form(); start_table($table_style2); - if ($selected_component != -1) + if ($selected_id != -1) { if ($Mode == 'Edit') { //editing a selected component from the link to the line item $sql = "SELECT ".TB_PREF."bom.*,".TB_PREF."stock_master.description FROM ".TB_PREF."bom,".TB_PREF."stock_master - WHERE id='$selected_component' + WHERE id='$selected_id' AND ".TB_PREF."stock_master.stock_id=".TB_PREF."bom.component"; $result = db_query($sql, "could not get bom"); @@ -245,9 +245,9 @@ start_form(); $_POST['loc_code'] = $myrow["loc_code"]; $_POST['workcentre_added'] = $myrow["workcentre_added"]; $_POST['quantity'] = number_format2($myrow["quantity"], get_qty_dec($myrow["component"])); - } - hidden('component', $selected_component); label_row(_("Component:"), $myrow["component"] . " - " . $myrow["description"]); + } + hidden('selected_id', $selected_id); } else { @@ -272,7 +272,7 @@ start_form(); qty_row(_("Quantity:"), 'quantity', null, null, null, $dec); end_table(1); - submit_add_or_update_center($selected_component == -1, '', true); + submit_add_or_update_center($selected_id == -1, '', true); end_form(); } // ---------------------------------------------------------------------------------- diff --git a/purchasing/includes/db/invoice_db.inc b/purchasing/includes/db/invoice_db.inc index 33ec2b57..ec22b1cb 100644 --- a/purchasing/includes/db/invoice_db.inc +++ b/purchasing/includes/db/invoice_db.inc @@ -362,7 +362,7 @@ function void_supp_invoice($type, $type_no) $date_ = Today(); while ($details_row = db_fetch($result)) { - if (strlen($details_row["grn_item_id"]) > 0) // it can be empty for GL items + if ((int)$details_row["grn_item_id"] > 0) // it can be empty for GL items { // Changed 2008-10-17 by Joe Hunt to get the avg. material cost updated $old = update_supp_received_items_for_invoice($details_row["grn_item_id"], diff --git a/purchasing/includes/db/supp_payment_db.inc b/purchasing/includes/db/supp_payment_db.inc index b82ab888..d15deb80 100644 --- a/purchasing/includes/db/supp_payment_db.inc +++ b/purchasing/includes/db/supp_payment_db.inc @@ -1,7 +1,7 @@ ov_amount + $tax_total); if ($supp_trans->is_invoice) - label_row(_("Invoice Total:"), $display_total, "align=right", "align=right"); + label_row(_("Invoice Total:"), $display_total, "align=right style='font-weight:bold;'", "align=right style='font-weight:bold;'"); else - label_row("" . _("Credit Note Total:") . "", - "$display_total", "align=right", "nowrap align=right"); + label_row(_("Credit Note Total"), + $display_total, "align=right style='font-weight:bold;color:red;'", "nowrap align=right style='font-weight:bold;color:red;'"); end_table(); br(1); @@ -152,15 +152,13 @@ function invoice_totals(&$supp_trans) } //-------------------------------------------------------------------------------------------------- -function display_gl_controls(&$supp_trans) +function display_gl_controls(&$supp_trans, $k) { - global $table_style, $Ajax; - - div_start('gl_ctrls'); // 2008-10-18 Joe Hunt Moved up a bit to compute num-rows = 0 + global $table_style; $accs = get_supplier_accounts($supp_trans->supplier_id); $_POST['gl_code'] = $accs['purchase_account']; - $k = 0; + alt_table_row_color($k); gl_all_accounts_list('gl_code', null, true, false, true); $dim = get_company_pref('use_dimension'); @@ -180,7 +178,6 @@ function display_gl_controls(&$supp_trans) submit_cells('ClearFields', _("Reset"), "", _("Clear all GL entry fields"), true); end_row(); - div_end(); } // $mode = 0 none at the moment @@ -251,7 +248,7 @@ function display_gl_items(&$supp_trans, $mode=0) if ($dim > 1) label_cell(get_dimension_string($entered_gl_code->gl_dim2, true)); - amount_cell($entered_gl_code->amount); + amount_cell($entered_gl_code->amount, true); label_cell($entered_gl_code->memo_); if ($mode == 1) @@ -274,7 +271,7 @@ function display_gl_items(&$supp_trans, $mode=0) } if ($mode == 1) - display_gl_controls($supp_trans); + display_gl_controls($supp_trans, $k); $colspan = ($dim == 2 ? 4 : ($dim == 1 ? 3 : 2)); label_row(_("Total"), price_format($total_gl_value), "colspan=".$colspan." align=right", "nowrap align=right"); @@ -290,11 +287,10 @@ function display_gl_items(&$supp_trans, $mode=0) //--------------//----------------------------------------------------------------------------------------- -function display_grn_items_for_selection(&$supp_trans) +function display_grn_items_for_selection(&$supp_trans, $k) { global $table_style; - div_start('grn_table'); // 2008-10-18 Joe Hunt Moved up a bit to compute num-rows = 0 if ($supp_trans->is_invoice) $result = get_grn_items(0, $supp_trans->supplier_id, true); else @@ -302,21 +298,11 @@ function display_grn_items_for_selection(&$supp_trans) if (db_num_rows($result) == 0) { - if ($supp_trans->is_invoice) - display_note(_("There are no outstanding items received from this supplier that have not been invoiced by them."), 0, 1); - else - { - display_note(_("There are no received items for the selected supplier that have been invoiced.")); - display_note(_("Credits can only be applied to invoiced items."), 0, 1); - } - div_end(); // Changed 2008-10-18 Joe Hunt - return; + return false; } /*Set up a table to show the outstanding GRN items for selection */ - $k = 0; - while ($myrow = db_fetch($result)) { $grn_already_on_invoice = false; @@ -370,8 +356,7 @@ function display_grn_items_for_selection(&$supp_trans) end_row(); } } - - div_end(); + return true; } //------------------------------------------------------------------------------------ @@ -385,6 +370,7 @@ function display_grn_items(&$supp_trans, $mode=0) { global $table_style, $path_to_root; + $ret = true; // if displaying in form, and no items, exit if (($mode == 2 || $mode == 3) && count($supp_trans->grn_items) == 0) return 0; @@ -412,11 +398,15 @@ function display_grn_items(&$supp_trans, $mode=0) } echo ""; echo ""; - if ($mode == 1 && $heading2 != "") + if ($mode == 1) { - echo "\n"; + submit_cells('InvGRNAll', _("Add All Items"), "align=right",false,true); + if ($heading2 != "") + { + echo "\n"; + } } echo "
$heading
"; - display_note($heading2, 0, 0, "class='overduefg'"); - echo "
"; + display_note($heading2, 0, 0, "class='overduefg'"); + echo "
"; @@ -468,14 +458,13 @@ function display_grn_items(&$supp_trans, $mode=0) qty_cell($entered_grn->qty_recd, false, $dec); qty_cell($entered_grn->prev_quantity_inv, false, $dec); } - qty_cell(abs($entered_grn->this_quantity_inv), false, $dec); + qty_cell(abs($entered_grn->this_quantity_inv), true, $dec); amount_cell($entered_grn->chg_price); - amount_cell( round($entered_grn->chg_price * abs($entered_grn->this_quantity_inv)), user_price_dec()); + amount_cell( round($entered_grn->chg_price * abs($entered_grn->this_quantity_inv), user_price_dec()), true); if ($mode == 1) { - edit_button_cell("Delete" . $entered_grn->id, _("Delete"), - _('Remove item from document')); + edit_button_cell("Delete" . $entered_grn->id, _("Edit"), _('Edit document line')); if ($supp_trans->is_invoice && $_SESSION["wa_current_user"]->access == 2) label_cell(""); } @@ -494,14 +483,24 @@ function display_grn_items(&$supp_trans, $mode=0) } if ($mode == 1) { - display_grn_items_for_selection($supp_trans); - $colspan = 10; + $ret = display_grn_items_for_selection($supp_trans, $k); + $colspan = 10; } else $colspan = 5; label_row(_("Total"), price_format($total_grn_value), "colspan=$colspan align=right", "nowrap align=right"); echo ""; + if (!$ret) + { + if ($supp_trans->is_invoice) + display_note(_("There are no outstanding items received from this supplier that have not been invoiced by them."), 0, 1); + else + { + display_note(_("There are no received items for the selected supplier that have been invoiced.")); + display_note(_("Credits can only be applied to invoiced items."), 0, 1); + } + } div_end(); echo ""; diff --git a/purchasing/po_receive_items.php b/purchasing/po_receive_items.php index d58e2aab..14a017be 100644 --- a/purchasing/po_receive_items.php +++ b/purchasing/po_receive_items.php @@ -90,8 +90,7 @@ function display_po_receive_items() if ($qty_outstanding > 0) qty_cells(null, $ln_itm->line_no, number_format2($ln_itm->receive_qty, $dec), "align=right", null, $dec); else - qty_cells(null, $ln_itm->line_no, number_format2($ln_itm->receive_qty, $dec), "align=right", - "disabled", $dec); + label_cell(number_format2($ln_itm->receive_qty, $dec), "align=right"); amount_cell($ln_itm->price); amount_cell($line_total); @@ -115,9 +114,8 @@ function check_po_changed() // Otherwise if you try to fullfill item quantities separately will give error. $sql = "SELECT item_code, quantity_ordered, quantity_received, qty_invoiced FROM ".TB_PREF."purch_order_details - WHERE order_no=" . $_SESSION['PO']->order_no . " - AND (quantity_ordered > quantity_received) - ORDER BY po_detail_item"; + WHERE order_no=" . $_SESSION['PO']->order_no + ." ORDER BY po_detail_item"; $result = db_query($sql, "could not query purch order details"); check_db_error("Could not check that the details of the purchase order had not been changed by another user ", $sql); @@ -126,7 +124,6 @@ function check_po_changed() while ($myrow = db_fetch($result)) { $ln_item = $_SESSION['PO']->line_items[$line_no]; - // only compare against items that are outstanding $qty_outstanding = $ln_item->quantity - $ln_item->qty_received; if ($qty_outstanding > 0) @@ -139,7 +136,7 @@ function check_po_changed() return true; } } - $line_no++; + $line_no++; } /*loop through all line items of the order to ensure none have been invoiced */ return false; @@ -225,15 +222,17 @@ function process_receive_po() if (check_po_changed()) { - echo "
" . _("This order has been changed or invoiced since this delivery was started to be actioned. Processing halted. To enter a delivery against this purchase order, it must be re-selected and re-read again to update the changes made by the other user.") . "
"; - - echo "
" . _("Select a different purchase order for receiving goods against") . "
"; - echo "
OrderNumber . "'>" . _("Re-Read the updated purchase order for receiving goods against") . "
"; + display_error(_("This order has been changed or invoiced since this delivery was started to be actioned. Processing halted. To enter a delivery against this purchase order, it must be re-selected and re-read again to update the changes made by the other user.")); + hyperlink_no_params("$path_to_root/purchasing/inquiry/po_search.php", + _("Select a different purchase order for receiving goods against")); + hyperlink_params("$path_to_root/purchasing/po_receive_items.php", + _("Re-Read the updated purchase order for receiving goods against"), + "PONumber=" . $_SESSION['PO']->order_no); unset($_SESSION['PO']->line_items); unset($_SESSION['PO']); unset($_POST['ProcessGoodsReceived']); $Ajax->activate('_page_body'); - exit; + display_footer_exit(); } $grn = add_grn($_SESSION['PO'], $_POST['DefaultReceivedDate'], @@ -265,7 +264,7 @@ if (isset($_POST['Update']) || isset($_POST['ProcessGoodsReceived'])) set from the post to the quantity to be received in this receival*/ foreach ($_SESSION['PO']->line_items as $line) { - + if( ($line->quantity - $line->qty_received)>0) { $_POST[$line->line_no] = max($_POST[$line->line_no], 0); if (!check_num($line->line_no)) $_POST[$line->line_no] = number_format2(0, get_qty_dec($line->stock_id)); @@ -279,6 +278,7 @@ if (isset($_POST['Update']) || isset($_POST['ProcessGoodsReceived'])) { $_SESSION['PO']->line_items[$line->line_no]->item_description = $_POST[$line->stock_id . "Desc"]; } + } } $Ajax->activate('grn_items'); } diff --git a/purchasing/supplier_credit.php b/purchasing/supplier_credit.php index e7ddde07..3854b5ae 100644 --- a/purchasing/supplier_credit.php +++ b/purchasing/supplier_credit.php @@ -80,7 +80,7 @@ function clear_fields() unset($_POST['amount']); unset($_POST['memo_']); unset($_POST['AddGLCodeToTrans']); - $Ajax->activate('gl_ctrls'); + $Ajax->activate('gl_items'); set_focus('gl_code'); } //------------------------------------------------------------------------------------------------ @@ -232,44 +232,56 @@ function check_item_data($n) return true; } -//----------------------------------------------------------------------------------------- - -$id = find_submit('grn_item_id'); -if ($id != -1) +function commit_item_data($n) { - if (check_item_data($id)) + if (check_item_data($n)) { $complete = False; - //$_SESSION['supp_trans']->add_grn_to_trans($_POST['GRNNumber'], - // $_POST['po_detail_item'], $_POST['item_code'], - // $_POST['item_description'], $_POST['qty_recd'], - // $_POST['prev_quantity_inv'], $_POST['This_QuantityCredited'], - // $_POST['order_price'], $_POST['ChgPrice'], $complete, - // $_POST['std_cost_unit'], $_POST['gl_code']); - $_SESSION['supp_trans']->add_grn_to_trans($id, - $_POST['po_detail_item'.$id], $_POST['item_code'.$id], - $_POST['item_description'.$id], $_POST['qty_recd'.$id], - $_POST['prev_quantity_inv'.$id], input_num('This_QuantityCredited'.$id), - $_POST['order_price'.$id], input_num('ChgPrice'.$id), $complete, - $_POST['std_cost_unit'.$id], ""); + $_SESSION['supp_trans']->add_grn_to_trans($n, + $_POST['po_detail_item'.$n], $_POST['item_code'.$n], + $_POST['item_description'.$n], $_POST['qty_recd'.$n], + $_POST['prev_quantity_inv'.$n], input_num('This_QuantityCredited'.$n), + $_POST['order_price'.$n], input_num('ChgPrice'.$n), $complete, + $_POST['std_cost_unit'.$n], ""); } } -//-------------------------------------------------------------------------------------------------- -$id = find_submit('Delete'); +//----------------------------------------------------------------------------------------- + +$id = find_submit('grn_item_id'); if ($id != -1) { - $_SESSION['supp_trans']->remove_grn_from_trans($id); + commit_item_data($id); +} + +if (isset($_POST['InvGRNAll'])) +{ + foreach($_POST as $postkey=>$postval ) + { + if (strpos($postkey, "qty_recd") === 0) + { + $id = substr($postkey, strlen("qty_recd")); + $id = (int)$id; + commit_item_data($id); + } + } +} + + +//-------------------------------------------------------------------------------------------------- +$id3 = find_submit('Delete'); +if ($id3 != -1) +{ + $_SESSION['supp_trans']->remove_grn_from_trans($id3); $Ajax->activate('grn_items'); - $Ajax->activate('grn_table'); $Ajax->activate('inv_tot'); } -$id = find_submit('Delete2'); -if ($id != -1) +$id4 = find_submit('Delete2'); +if ($id4 != -1) { - $_SESSION['supp_trans']->remove_gl_codes_from_trans($id); + $_SESSION['supp_trans']->remove_gl_codes_from_trans($id4); clear_fields(); $Ajax->activate('gl_items'); $Ajax->activate('inv_tot'); @@ -304,10 +316,8 @@ echo ""; end_table(1); // outer table -$id = find_submit('grn_item_id'); if ($id != -1) { - $Ajax->activate('grn_table'); $Ajax->activate('grn_items'); $Ajax->activate('inv_tot'); } diff --git a/purchasing/supplier_invoice.php b/purchasing/supplier_invoice.php index 28f7f33b..b7850518 100644 --- a/purchasing/supplier_invoice.php +++ b/purchasing/supplier_invoice.php @@ -84,7 +84,7 @@ function clear_fields() unset($_POST['amount']); unset($_POST['memo_']); unset($_POST['AddGLCodeToTrans']); - $Ajax->activate('gl_ctrls'); + $Ajax->activate('gl_items'); set_focus('gl_code'); } //------------------------------------------------------------------------------------------------ @@ -265,12 +265,11 @@ function check_item_data($n) return true; } -$id = find_submit('grn_item_id'); -if ($id != -1) +function commit_item_data($n) { - if (check_item_data($id)) + if (check_item_data($n)) { - if (input_num('this_quantity_inv'.$id) >= ($_POST['qty_recd'.$id] - $_POST['prev_quantity_inv'.$id])) + if (input_num('this_quantity_inv'.$n) >= ($_POST['qty_recd'.$n] - $_POST['prev_quantity_inv'.$n])) { $complete = true; } @@ -279,33 +278,94 @@ if ($id != -1) $complete = false; } - $_SESSION['supp_trans']->add_grn_to_trans($id, $_POST['po_detail_item'.$id], - $_POST['item_code'.$id], $_POST['item_description'.$id], $_POST['qty_recd'.$id], - $_POST['prev_quantity_inv'.$id], input_num('this_quantity_inv'.$id), - $_POST['order_price'.$id], input_num('ChgPrice'.$id), $complete, - $_POST['std_cost_unit'.$id], ""); + $_SESSION['supp_trans']->add_grn_to_trans($n, $_POST['po_detail_item'.$n], + $_POST['item_code'.$n], $_POST['item_description'.$n], $_POST['qty_recd'.$n], + $_POST['prev_quantity_inv'.$n], input_num('this_quantity_inv'.$n), + $_POST['order_price'.$n], input_num('ChgPrice'.$n), $complete, + $_POST['std_cost_unit'.$n], ""); } } -//-------------------------------------------------------------------------------------------------- -$id = find_submit('Delete'); +//----------------------------------------------------------------------------------------- + +$id = find_submit('grn_item_id'); if ($id != -1) { - $_SESSION['supp_trans']->remove_grn_from_trans($id); + commit_item_data($id); +} + +if (isset($_POST['InvGRNAll'])) +{ + foreach($_POST as $postkey=>$postval ) + { + if (strpos($postkey, "qty_recd") === 0) + { + $id = substr($postkey, strlen("qty_recd")); + $id = (int)$id; + commit_item_data($id); + } + } +} + +//-------------------------------------------------------------------------------------------------- +$id3 = find_submit('Delete'); +if ($id3 != -1) +{ + $_SESSION['supp_trans']->remove_grn_from_trans($id3); $Ajax->activate('grn_items'); - $Ajax->activate('grn_table'); $Ajax->activate('inv_tot'); } -$id = find_submit('Delete2'); -if ($id != -1) +$id4 = find_submit('Delete2'); +if ($id4 != -1) { - $_SESSION['supp_trans']->remove_gl_codes_from_trans($id); + $_SESSION['supp_trans']->remove_gl_codes_from_trans($id4); clear_fields(); $Ajax->activate('gl_items'); $Ajax->activate('inv_tot'); } +if ($_SESSION["wa_current_user"]->access == 2) +{ + $id3 = find_submit('void_item_id'); + if ($id3 != -1) + { + $js = "if(confirm(\"" + .sprintf(_('You are about to remove all yet non-invoiced items from delivery line #%d. This operation also irreversibly changes related order line. Do you want to continue ?'), $id3) + ."\")) { + JsHttpRequest.request(\"void_confirm".$id3."\"); + }"; + $Ajax->addScript(true,$js); + } + $id2 = find_submit('void_confirm'); + if ($id2 != -1) // Added section 2008-10-18 Joe Hunt for voiding delivery lines + { + begin_transaction(); + + $myrow = get_grn_item_detail($id2); + + $grn = get_grn_batch($myrow['grn_batch_id']); + + $sql = "UPDATE ".TB_PREF."purch_order_details + SET quantity_received = qty_invoiced, quantity_ordered = qty_invoiced WHERE po_detail_item = ".$myrow["po_detail_item"]; + db_query($sql, "The quantity invoiced of the purchase order line could not be updated"); + + $sql = "UPDATE ".TB_PREF."grn_items + SET qty_recd = quantity_inv WHERE id = ".$myrow["id"]; + db_query($sql, "The quantity invoiced off the items received record could not be updated"); + + update_average_material_cost($grn["supplier_id"], $myrow["item_code"], + $myrow["unit_price"], -$myrow["QtyOstdg"], Today()); + + add_stock_move(25, $myrow["item_code"], $myrow['grn_batch_id'], $grn['loc_code'], sql2date($grn["delivery_date"]), "", + -$myrow["QtyOstdg"], $myrow['std_cost_unit'], $grn["supplier_id"], 1, $myrow['unit_price']); + + commit_transaction(); + display_notification(sprintf(_('All yet non-invoiced items on delivery line # %d has been removed.'), $id2)); + + } +} + start_form(false, true); start_table("$table_style2 width=98%", 8); @@ -337,11 +397,10 @@ echo ""; end_table(); // outer table //----------------------------------------------------------------------------------------- -$id = find_submit('grn_item_id'); -$id2 = find_submit('void_item_id'); + + if ($id != -1 || $id2 != -1) { - $Ajax->activate('grn_table'); $Ajax->activate('grn_items'); $Ajax->activate('inv_tot'); } @@ -349,34 +408,6 @@ if ($id != -1 || $id2 != -1) if (get_post('AddGLCodeToTrans')) $Ajax->activate('inv_tot'); -if ($_SESSION["wa_current_user"]->access == 2) -{ - if ($id2 != -1) // Added section 2008-10-18 Joe Hunt for voiding delivery lines - { - begin_transaction(); - - $myrow = get_grn_item_detail($id2); - - $grn = get_grn_batch($myrow['grn_batch_id']); - - $sql = "UPDATE ".TB_PREF."purch_order_details - SET quantity_received = qty_invoiced, quantity_ordered = qty_invoiced WHERE po_detail_item = ".$myrow["po_detail_item"]; - db_query($sql, "The quantity invoiced of the purchase order line could not be updated"); - - $sql = "UPDATE ".TB_PREF."grn_items - SET qty_recd = quantity_inv WHERE id = ".$myrow["id"]; - db_query($sql, "The quantity invoiced off the items received record could not be updated"); - - update_average_material_cost($grn["supplier_id"], $myrow["item_code"], - $myrow["unit_price"], -$myrow["QtyOstdg"], Today()); - - add_stock_move(25, $myrow["item_code"], $myrow['grn_batch_id'], $grn['loc_code'], sql2date($grn["delivery_date"]), "", - -$myrow["QtyOstdg"], $myrow['std_cost_unit'], $grn["supplier_id"], 1, $myrow['unit_price']); - - commit_transaction(); - } -} - echo "
"; submit_center('PostInvoice', _("Enter Invoice"), true, '', true); echo "
"; diff --git a/purchasing/supplier_payment.php b/purchasing/supplier_payment.php index a530ecb4..8f997c88 100644 --- a/purchasing/supplier_payment.php +++ b/purchasing/supplier_payment.php @@ -98,7 +98,7 @@ function display_controls() $bank_currency = get_bank_account_currency($_POST['bank_account']); if ($bank_currency != $supplier_currency) { - exchange_rate_display($bank_currency, $supplier_currency, $_POST['DatePaid']); + exchange_rate_display($bank_currency, $supplier_currency, $_POST['DatePaid'], true); } ref_row(_("Reference:"), 'ref', '', references::get_next(22)); @@ -136,6 +136,13 @@ function check_inputs() 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.")); + set_focus('_ex_rate'); + return false; + } + if ($_POST['discount'] == "") { $_POST['discount'] = 0; @@ -150,7 +157,7 @@ function check_inputs() if (input_num('amount') - input_num('discount') <= 0) { - display_error(_("The total of the amount and the discount negative. Please enter positive values.")); + display_error(_("The total of the amount and the discount is zero or negative. Please enter positive values.")); set_focus('amount'); return false; } @@ -188,9 +195,17 @@ function check_inputs() 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'); + $payment_id = add_supp_payment($_POST['supplier_id'], $_POST['DatePaid'], $_POST['bank_account'], input_num('amount'), input_num('discount'), - $_POST['ref'], $_POST['memo_']); + $_POST['ref'], $_POST['memo_'], $rate); //unset($_POST['supplier_id']); unset($_POST['bank_account']); diff --git a/reporting/includes/class.pdf.inc b/reporting/includes/class.pdf.inc index fe6011e1..856a7994 100644 --- a/reporting/includes/class.pdf.inc +++ b/reporting/includes/class.pdf.inc @@ -58,8 +58,8 @@ class Cpdf extends TCPDF { $l = array('a_meta_charset' => 'ISO-8859-1', 'a_meta_dir' => 'ltr', 'a_meta_language' => 'en_GB', 'w_page' => 'page'); $enc = $l['a_meta_charset']; $uni = ($enc == 'UTF-8' || $enc == 'GB2312' ? true : false); - if ($enc == "GB2312") - ini_set("memory_limit", "25M"); + if ($uni) + ini_set("memory_limit", "48M"); $this->TCPDF('P', 'pt', $pageSize, $uni, $enc); $this->setLanguageArray($l); $this->setPrintHeader(false); diff --git a/reporting/rep101.php b/reporting/rep101.php index c98253f2..a206239a 100644 --- a/reporting/rep101.php +++ b/reporting/rep101.php @@ -118,7 +118,7 @@ function print_customer_balances() $rep->TextCol(3, 4, sql2date($trans['due_date'])); $item[0] = $item[1] = 0.0; if ($convert) - $rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $date); + $rate = $trans['rate']; else $rate = 1.0; if ($trans['type'] == 11 || $trans['type'] == 12 || $trans['type'] == 2) diff --git a/reporting/rep106.php b/reporting/rep106.php index 00e40461..ad26d7dd 100644 --- a/reporting/rep106.php +++ b/reporting/rep106.php @@ -127,7 +127,7 @@ function print_salesman_list() $subprov = 0; } $date = sql2date($myrow['tran_date']); - $rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $date); + $rate = $myrow['rate']; $amt = $myrow['InvoiceTotal'] * $rate; if ($subprov > $myrow['break_pt'] && $myrow['provision2'] != 0) $prov = $myrow['provision2'] * $amt / 100; diff --git a/reporting/rep201.php b/reporting/rep201.php index 92e85c04..89169ce0 100644 --- a/reporting/rep201.php +++ b/reporting/rep201.php @@ -118,7 +118,8 @@ function print_supplier_balances() $rep->TextCol(3, 4, sql2date($trans['due_date'])); $item[0] = $item[1] = 0.0; if ($convert) - $rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $date); + //$rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $date); + $rate = $trans['rate']; else $rate = 1.0; if ($trans['TotalAmount'] > 0.0) diff --git a/reporting/rep203.php b/reporting/rep203.php index 625e3ce1..d69bf519 100644 --- a/reporting/rep203.php +++ b/reporting/rep203.php @@ -25,17 +25,19 @@ function getTransactions($supplier, $date) $sql = "SELECT ".TB_PREF."sys_types.type_name, ".TB_PREF."supp_trans.supp_reference, + ".TB_PREF."supp_trans.tran_date, ".TB_PREF."supp_trans.due_date, ".TB_PREF."supp_trans.trans_no, ".TB_PREF."supp_trans.type, - (".TB_PREF."supp_trans.ov_amount + ".TB_PREF."supp_trans.ov_gst - ".TB_PREF."supp_trans.alloc) AS Balance, - (".TB_PREF."supp_trans.ov_amount + ".TB_PREF."supp_trans.ov_gst ) AS TranTotal + ".TB_PREF."supp_trans.rate, + (ABS(".TB_PREF."supp_trans.ov_amount) + ABS(".TB_PREF."supp_trans.ov_gst) - ".TB_PREF."supp_trans.alloc) AS Balance, + (ABS(".TB_PREF."supp_trans.ov_amount) + ABS(".TB_PREF."supp_trans.ov_gst) ) AS TranTotal FROM ".TB_PREF."supp_trans, ".TB_PREF."sys_types WHERE ".TB_PREF."sys_types.type_id = ".TB_PREF."supp_trans.type AND ".TB_PREF."supp_trans.supplier_id = '" . $supplier . "' - AND ".TB_PREF."supp_trans.ov_amount + ".TB_PREF."supp_trans.ov_gst - ".TB_PREF."supp_trans.alloc != 0 - AND ".TB_PREF."supp_trans.due_date <='" . $date . "' + AND ABS(".TB_PREF."supp_trans.ov_amount) + ABS(".TB_PREF."supp_trans.ov_gst) - ".TB_PREF."supp_trans.alloc != 0 + AND ".TB_PREF."supp_trans.tran_date <='" . $date . "' ORDER BY ".TB_PREF."supp_trans.type, ".TB_PREF."supp_trans.trans_no"; @@ -106,12 +108,7 @@ function print_payment_report() $rep->fontSize += 2; $rep->TextCol(0, 6, $myrow['name'] . " - " . $myrow['terms']); if ($convert) - { - $rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $to); $rep->TextCol(6, 7, $myrow['curr_code']); - } - else - $rate = 1.0; $rep->fontSize -= 2; $rep->NewLine(1, 2); $res = getTransactions($myrow['supplier_id'], $to); @@ -121,11 +118,23 @@ function print_payment_report() $total[0] = $total[1] = 0.0; while ($trans=db_fetch($res)) { + if ($convert) + $rate = $trans['rate']; + else + $rate = 1.0; $rep->NewLine(1, 2); $rep->TextCol(0, 1, $trans['type_name']); $rep->TextCol(1, 2, $trans['supp_reference']); - $rep->TextCol(2, 3, sql2date($trans['due_date'])); - $item[0] = Abs($trans['TranTotal']) * $rate; + if ($trans['type'] == 20) + $rep->TextCol(2, 3, sql2date($trans['due_date'])); + else + $rep->TextCol(2, 3, sql2date($trans['tran_date'])); + if ($trans['type'] != 20) + { + $trans['TranTotal'] = -$trans['TranTotal']; + $trans['Balance'] = -$trans['Balance']; + } + $item[0] = $trans['TranTotal'] * $rate; $rep->TextCol(6, 7, number_format2($item[0], $dec)); $item[1] = $trans['Balance'] * $rate; $rep->TextCol(7, 8, number_format2($item[1], $dec)); diff --git a/reporting/rep209.php b/reporting/rep209.php index 6ae25830..c6e0240f 100644 --- a/reporting/rep209.php +++ b/reporting/rep209.php @@ -111,7 +111,7 @@ function print_po() $DisplayNet = number_format2($Net,$dec); //$rep->TextCol(0, 1, $myrow2['item_code'], -2); $rep->TextCol(0, 2, $myrow2['description'], -2); - $rep->TextCol(2, 3, $myrow2['delivery_date'], -2); + $rep->TextCol(2, 3, sql2date($myrow2['delivery_date']), -2); $rep->TextCol(3, 4, $DisplayQty, -2); $rep->TextCol(4, 5, $myrow2['units'], -2); $rep->TextCol(5, 6, $DisplayPrice, -2); diff --git a/reporting/rep708.php b/reporting/rep708.php index fc71d673..97d2d95d 100644 --- a/reporting/rep708.php +++ b/reporting/rep708.php @@ -19,6 +19,36 @@ include_once($path_to_root . "gl/includes/gl_db.inc"); // trial_inquiry_controls(); print_trial_balance(); +//---------------------------------------------------------------------------------------------------- +function get_balance($account, $dimension, $dimension2, $from, $to, $from_incl=true, $to_incl=true) +{ + $sql = "SELECT SUM(IF(amount >= 0, amount, 0)) as debit, SUM(IF(amount < 0, -amount, 0)) as credit, SUM(amount) as balance + FROM ".TB_PREF."gl_trans,".TB_PREF."chart_master,".TB_PREF."chart_types, ".TB_PREF."chart_class + WHERE ".TB_PREF."gl_trans.account=".TB_PREF."chart_master.account_code AND ".TB_PREF."chart_master.account_type=".TB_PREF."chart_types.id + AND ".TB_PREF."chart_types.class_id=".TB_PREF."chart_class.cid AND"; + + if ($account != null) + $sql .= " account='$account' AND"; + if ($dimension > 0) + $sql .= " dimension_id=$dimension AND"; + if ($dimension2 > 0) + $sql .= " dimension2_id=$dimension2 AND"; + $from_date = date2sql($from); + if ($from_incl) + $sql .= " tran_date >= '$from_date' AND"; + else + $sql .= " tran_date > IF(".TB_PREF."chart_class.balance_sheet=1, '0000-00-00', '$from_date') AND"; + $to_date = date2sql($to); + if ($to_incl) + $sql .= " tran_date <= '$to_date' "; + else + $sql .= " tran_date < '$to_date' "; + + $result = db_query($sql,"No general ledger accounts were returned"); + + return db_fetch($result); +} + //---------------------------------------------------------------------------------------------------- function print_trial_balance() @@ -32,31 +62,34 @@ function print_trial_balance() $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; $zero = $_POST['PARAM_2']; + $balances = $_POST['PARAM_3']; if ($dim == 2) { - $dimension = $_POST['PARAM_3']; - $dimension2 = $_POST['PARAM_4']; - $comments = $_POST['PARAM_5']; + $dimension = $_POST['PARAM_4']; + $dimension2 = $_POST['PARAM_5']; + $comments = $_POST['PARAM_6']; } else if ($dim == 1) { - $dimension = $_POST['PARAM_3']; - $comments = $_POST['PARAM_4']; + $dimension = $_POST['PARAM_4']; + $comments = $_POST['PARAM_5']; } else { - $comments = $_POST['PARAM_3']; + $comments = $_POST['PARAM_4']; } $dec = user_price_dec(); - $cols2 = array(0, 50, 230, 330, 430, 530); + //$cols2 = array(0, 50, 230, 330, 430, 530); + $cols2 = array(0, 50, 190, 310, 430, 530); //-------------0--1---2----3----4----5-- $headers2 = array('', '', _('Brought Forward'), _('This Period'), _('Balance')); $aligns2 = array('left', 'left', 'left', 'left', 'left'); - $cols = array(0, 50, 200, 250, 300, 350, 400, 450, 500, 550); + //$cols = array(0, 50, 200, 250, 300, 350, 400, 450, 500, 550); + $cols = array(0, 50, 150, 210, 270, 330, 390, 450, 510, 570); //------------0--1---2----3----4----5----6----7----8----9-- $headers = array(_('Account'), _('Account Name'), _('Debit'), _('Credit'), _('Debit'), @@ -91,47 +124,58 @@ function print_trial_balance() $rep->Font(); $rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2); $rep->Header(); - $totprev = $totcurr = 0.0; $accounts = get_gl_accounts(); + $pdeb = $pcre = $cdeb = $ccre = $tdeb = $tcre = $pbal = $cbal = $tbal = 0; + $begin = begin_fiscalyear(); + if (date1_greater_date2($begin, $from)) + $begin = $from; + $begin = add_days($begin, -1); while ($account=db_fetch($accounts)) { + $prev = get_balance($account["account_code"], $dimension, $dimension2, $begin, $from, false, false); + $curr = get_balance($account["account_code"], $dimension, $dimension2, $from, $to, true, true); + $tot = get_balance($account["account_code"], $dimension, $dimension2, $begin, $to, false, true); - if (is_account_balancesheet($account["account_code"])) - $begin = ""; - else - { - $begin = begin_fiscalyear(); - if (date1_greater_date2($begin, $from)) - $begin = $from; - $begin = add_days($begin, -1); - } - - $prev_balance = get_gl_balance_from_to($begin, $from, $account["account_code"], $dimension, $dimension2); - - $curr_balance = get_gl_trans_from_to($from, $to, $account["account_code"], $dimension, $dimension2); - - if ($zero == 0 && !$prev_balance && !$curr_balance) + if ($zero == 0 && !$prev['balance'] && !$curr['balance'] && !$tot['balance']) continue; - $totprev += $prev_balance; - $totcurr += $curr_balance; $rep->TextCol(0, 1, $account['account_code']); $rep->TextCol(1, 2, $account['account_name']); - - if ($prev_balance >= 0.0) - $rep->TextCol(2, 3, number_format2(abs($prev_balance), $dec)); - else - $rep->TextCol(3, 4, number_format2(abs($prev_balance), $dec)); - if ($curr_balance >= 0.0) - $rep->TextCol(4, 5, number_format2(abs($curr_balance), $dec)); - else - $rep->TextCol(5, 6, number_format2(abs($curr_balance), $dec)); - if ($curr_balance + $prev_balance >= 0.0) - $rep->TextCol(6, 7, number_format2(abs($curr_balance + $prev_balance), $dec)); + if ($balances != 0) + { + if ($prev['balance'] >= 0.0) + $rep->TextCol(2, 3, number_format2($prev['balance'], $dec)); + else + $rep->TextCol(3, 4, number_format2(abs($prev['balance']), $dec)); + if ($curr['balance'] >= 0.0) + $rep->TextCol(4, 5, number_format2($curr['balance'], $dec)); + else + $rep->TextCol(5, 6, number_format2(abs($curr['balance']), $dec)); + if ($tot['balance'] >= 0.0) + $rep->TextCol(6, 7, number_format2($tot['balance'], $dec)); + else + $rep->TextCol(7, 8, number_format2(abs($tot['balance']), $dec)); + } else - $rep->TextCol(7, 8, number_format2(abs($curr_balance + $prev_balance), $dec)); - + { + $rep->TextCol(2, 3, number_format2($prev['debit'], $dec)); + $rep->TextCol(3, 4, number_format2($prev['credit'], $dec)); + $rep->TextCol(4, 5, number_format2($curr['debit'], $dec)); + $rep->TextCol(5, 6, number_format2($curr['credit'], $dec)); + $rep->TextCol(6, 7, number_format2($tot['debit'], $dec)); + $rep->TextCol(7, 8, number_format2($tot['credit'], $dec)); + $pdeb += $prev['debit']; + $pcre += $prev['credit']; + $cdeb += $curr['debit']; + $ccre += $curr['credit']; + $tdeb += $tot['debit']; + $tcre += $tot['credit']; + + } + $pbal += $prev['balance']; + $cbal += $curr['balance']; + $tbal += $tot['balance']; $rep->NewLine(); if ($rep->row < $rep->bottomMargin + $rep->lineHeight) @@ -144,20 +188,35 @@ function print_trial_balance() $rep->NewLine(); $rep->Font('bold'); + //$prev = get_balance(null, $dimension, $dimension2, $begin, $from, false, false); + //$curr = get_balance(null, $dimension, $dimension2, $from, $to, true, true); + //$tot = get_balance(null, $dimension, $dimension2, $begin, $to, false, true); + + if ($balances == 0) + { + $rep->TextCol(0, 2, _("Total")); + $rep->TextCol(2, 3, number_format2($pdeb, $dec)); + $rep->TextCol(3, 4, number_format2($pcre, $dec)); + $rep->TextCol(4, 5, number_format2($cdeb, $dec)); + $rep->TextCol(5, 6, number_format2($ccre, $dec)); + $rep->TextCol(6, 7, number_format2($tdeb, $dec)); + $rep->TextCol(7, 8, number_format2($tcre, $dec)); + $rep->NewLine(); + } $rep->TextCol(0, 2, _("Ending Balance")); - if ($totprev >= 0.0) - $rep->TextCol(2, 3, number_format2(abs($totprev), $dec)); + if ($pbal >= 0.0) + $rep->TextCol(2, 3, number_format2($pbal, $dec)); else - $rep->TextCol(3, 4, number_format2(abs($totprev), $dec)); - if ($totcurr >= 0.0) - $rep->TextCol(4, 5, number_format2(abs($totcurr), $dec)); + $rep->TextCol(3, 4, number_format2(abs($pbal), $dec)); + if ($cbal >= 0.0) + $rep->TextCol(4, 5, number_format2($cbal, $dec)); else - $rep->TextCol(5, 6, number_format2(abs($totcurr), $dec)); - if ($totcurr + $totprev >= 0.0) - $rep->TextCol(6, 7, number_format2(abs($totcurr + $totprev), $dec)); + $rep->TextCol(5, 6, number_format2(abs($cbal), $dec)); + if ($tbal >= 0.0) + $rep->TextCol(6, 7, number_format2($tbal, $dec)); else - $rep->TextCol(7, 8, number_format2(abs($totcurr + $totprev), $dec)); + $rep->TextCol(7, 8, number_format2(abs($tbal), $dec)); $rep->Line($rep->row - 6); diff --git a/reporting/reports_main.php b/reporting/reports_main.php index 42b1ad59..6e215c46 100644 --- a/reporting/reports_main.php +++ b/reporting/reports_main.php @@ -203,6 +203,7 @@ if ($dim == 2) array( new ReportParam(_('Start Date'),'DATEBEGINM'), new ReportParam(_('End Date'),'DATEENDM'), new ReportParam(_('Zero values'),'YES_NO'), + new ReportParam(_('Only balances'),'YES_NO'), new ReportParam(_('Dimension')." 1", 'DIMENSIONS1'), new ReportParam(_('Dimension')." 2", 'DIMENSIONS2'), new ReportParam(_('Comments'),'TEXTBOX'))); @@ -237,6 +238,7 @@ else if ($dim == 1) array( new ReportParam(_('Start Date'),'DATEBEGINM'), new ReportParam(_('End Date'),'DATEENDM'), new ReportParam(_('Zero values'),'YES_NO'), + new ReportParam(_('Only balances'),'YES_NO'), new ReportParam(_('Dimension'), 'DIMENSIONS1'), new ReportParam(_('Comments'),'TEXTBOX'))); } @@ -266,6 +268,7 @@ else array( new ReportParam(_('Start Date'),'DATEBEGINM'), new ReportParam(_('End Date'),'DATEENDM'), new ReportParam(_('Zero values'),'YES_NO'), + new ReportParam(_('Only balances'),'YES_NO'), new ReportParam(_('Comments'),'TEXTBOX'))); } $reports->addReport(_('General Ledger'),709,_('Ta&x Report'), diff --git a/sales/allocations/customer_allocate.php b/sales/allocations/customer_allocate.php index 39076ec1..5f30f66c 100644 --- a/sales/allocations/customer_allocate.php +++ b/sales/allocations/customer_allocate.php @@ -54,7 +54,7 @@ function check_data() /*Now check to see that the AllocAmt is no greater than the amount left to be allocated against the transaction under review */ - if (input_num('amount' . $counter) > $_POST['un_allocated' . $counter]) + if (input_num('amount' . $counter) > input_num('un_allocated' . $counter)) { //$_POST['amount' . $counter] = $_POST['un_allocated' . $counter]; } @@ -219,7 +219,7 @@ function edit_allocations_for_transaction($type, $trans_no) label_cell("" . _("All") . ""); label_cell("" - . _("None") . "".hidden("un_allocated" . $counter, $un_allocated, false)); + . _("None") . "".hidden("un_allocated" . $counter, price_format($un_allocated), false)); end_row(); $total_allocated += input_num('amount' . $counter); diff --git a/sales/customer_payments.php b/sales/customer_payments.php index 03639e75..9f8b7902 100644 --- a/sales/customer_payments.php +++ b/sales/customer_payments.php @@ -84,6 +84,18 @@ function can_process() 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.")); + set_focus('_ex_rate'); + return false; + } + + if ($_POST['discount'] == "") + { + $_POST['discount'] = 0; + } + if (!check_num('discount')) { display_error(_("The entered discount is not a valid number.")); set_focus('discount'); @@ -118,9 +130,18 @@ if (isset($_POST['_DateBanked_changed'])) { //---------------------------------------------------------------------------------------------- if (isset($_POST['AddPaymentItem'])) { + + $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'); + $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_']); + input_num('amount'), input_num('discount'), $_POST['memo_'], $rate); meta_forward($_SERVER['PHP_SELF'], "AddedID=$payment_no"); } @@ -195,7 +216,7 @@ function display_item_form() $bank_currency = get_bank_account_currency($_POST['bank_account']); if ($cust_currency != $bank_currency) { - exchange_rate_display($cust_currency, $bank_currency, $_POST['DateBanked']); + exchange_rate_display($bank_currency, $cust_currency, $_POST['DateBanked'], true); } text_row(_("Reference:"), 'ref', null, 20, 40); diff --git a/sales/includes/db/cust_trans_db.inc b/sales/includes/db/cust_trans_db.inc index 709657d4..6f536ca0 100644 --- a/sales/includes/db/cust_trans_db.inc +++ b/sales/includes/db/cust_trans_db.inc @@ -83,7 +83,8 @@ function write_customer_trans($trans_type, $trans_no, $debtor_no, $BranchNo, { $curr = get_customer_currency($debtor_no); - $rate = get_exchange_rate_from_home_currency($curr, $date_); + if ($rate == 0) + $rate = get_exchange_rate_from_home_currency($curr, $date_); $SQLDate = date2sql($date_); if ($due_date == "") diff --git a/sales/includes/db/payment_db.inc b/sales/includes/db/payment_db.inc index e1147b1c..15ec3584 100644 --- a/sales/includes/db/payment_db.inc +++ b/sales/includes/db/payment_db.inc @@ -3,14 +3,14 @@ Write/update customer payment. */ function write_customer_payment($trans_no, $customer_id, $branch_id, $bank_account, - $date_, $ref, $amount, $discount, $memo_) + $date_, $ref, $amount, $discount, $memo_, $rate=0) { begin_transaction(); $company_record = get_company_prefs(); - $payment_no = write_customer_trans(12, $trans_no, - $customer_id, $branch_id, $date_, $ref, $amount, $discount); + $payment_no = write_customer_trans(12, $trans_no, $customer_id, $branch_id, + $date_, $ref, $amount, $discount, 0, 0, 0, 0, 0, 0, 0, "", 0, $rate); $bank_gl_account = get_bank_gl_account($bank_account); @@ -24,7 +24,7 @@ function write_customer_payment($trans_no, $customer_id, $branch_id, $bank_accou /* Bank account entry first */ add_gl_trans_customer(12, $payment_no, $date_, $bank_gl_account, 0, 0, $amount, $customer_id, - "Cannot insert a GL transaction for the bank account debit"); + "Cannot insert a GL transaction for the bank account debit", $rate); if ($branch_id != reserved_words::get_any_numeric()) { @@ -42,14 +42,14 @@ function write_customer_payment($trans_no, $customer_id, $branch_id, $bank_accou /* Now Credit Debtors account with receipts + discounts */ add_gl_trans_customer(12, $payment_no, $date_, $debtors_account, 0, 0, -($discount + $amount), $customer_id, - "Cannot insert a GL transaction for the debtors account credit"); + "Cannot insert a GL transaction for the debtors account credit", $rate); } if ($discount != 0) { /* Now Debit discount account with discounts allowed*/ add_gl_trans_customer(12, $payment_no, $date_, $discount_account, 0, 0, $discount, $customer_id, - "Cannot insert a GL transaction for the payment discount debit"); + "Cannot insert a GL transaction for the payment discount debit", $rate); } /*now enter the bank_trans entry */ diff --git a/sales/includes/sales_db.inc b/sales/includes/sales_db.inc index 8c74c9bf..a537894b 100644 --- a/sales/includes/sales_db.inc +++ b/sales/includes/sales_db.inc @@ -36,14 +36,14 @@ function add_stock_move_customer($type, $stock_id, $trans_id, $location, $date_, // $amount is in CUSTOMER'S currency function add_gl_trans_customer($type, $type_no, $date_, $account, $dimension, $dimension2, - $amount, $customer_id, $err_msg="") + $amount, $customer_id, $err_msg="", $rate=0) { if ($err_msg == "") $err_msg = "The customer GL transaction could not be inserted"; return add_gl_trans($type, $type_no, $date_, $account, $dimension, $dimension2, "", $amount, get_customer_currency($customer_id), - payment_person_types::customer(), $customer_id, $err_msg); + payment_person_types::customer(), $customer_id, $err_msg, $rate); } //---------------------------------------------------------------------------------------- @@ -104,11 +104,11 @@ function get_price ($stock_id, $currency, $sales_type_id, $factor=null, $date=nu { $price = $prices[$sales_type_id][$home_curr] / $rate; } - if (isset($prices[$base_id][$currency])) + elseif (isset($prices[$base_id][$currency])) { $price = $prices[$base_id][$currency] * $factor; } - if (isset($prices[$base_id][$home_curr])) + elseif (isset($prices[$base_id][$home_curr])) { $price = $prices[$base_id][$home_curr] * $factor / $rate; } diff --git a/sales/view/view_receipt.php b/sales/view/view_receipt.php index cf0ae3f8..51e79dc7 100644 --- a/sales/view/view_receipt.php +++ b/sales/view/view_receipt.php @@ -4,12 +4,16 @@ $page_security = 1; $path_to_root="../.."; include_once($path_to_root . "/includes/session.inc"); -page(_("View Customer Payment"), true); - include_once($path_to_root . "/includes/date_functions.inc"); include_once($path_to_root . "/includes/ui.inc"); include_once($path_to_root . "/sales/includes/sales_db.inc"); +$js = ""; +if ($use_popup_windows) + $js .= get_js_open_window(900, 600); + +page(_("View Customer Payment"), true, false, "", $js); + if (isset($_GET["trans_no"])) { $trans_id = $_GET["trans_no"]; diff --git a/update.html b/update.html index 2c070204..cc0bb64d 100644 --- a/update.html +++ b/update.html @@ -53,7 +53,7 @@ password and choose the update script from the local harddisk. do this, before entering FrontAccounting! Enter the database user and the password and choose the alter.sql script.  Do the same for the alter2.sql script. If you have -already updated release 2.0 Beta, you can just run the alter2.sql script.
You must also manuelly ensure that you have write permission to the new folder /company/0. +already updated release 2.0 Beta, you can just run the alter2.sql script.
You must also manuelly ensure that you have write permission to the new folder /company/0.
There are no database changes during a major and minor release. Like from 2.0 to 2.0.1 - 2.0.5 .

 

-- 2.30.2