$js .= get_js_date_picker();
//----------------------------------------------------------------------------------------
-check_db_has_suppliers(_("There are no suppliers defined in the system."));
-
-//--------------------------------------------------------------------------------------------------
-
if (isset($_GET['New']))
{
if (isset( $_SESSION['supp_trans']))
if (isset($_GET['ModifyInvoice']))
check_is_editable(ST_SUPPINVOICE, $_GET['ModifyInvoice']);
+check_db_has_suppliers(_("There are no suppliers defined in the system."));
+
//---------------------------------------------------------------------------------------------------------------
if (isset($_GET['AddedID']))
{
global $Refs;
+ if (!get_post('supplier_id'))
+ {
+ display_error(_("There is no supplier selected."));
+ set_focus('supplier_id');
+ return false;
+ }
+
if (!$_SESSION['supp_trans']->is_valid_trans_to_post())
{
display_error(_("The invoice cannot be processed because the there are no items or values on the invoice. Invoices are expected to have a charge."));
}
}
- if ($SysPrefs->check_qty_charged_vs_del_qty == true && ($_POST['qty_recd'.$n] != $_POST['prev_quantity_inv'.$n]))
+ if ($SysPrefs->check_qty_charged_vs_del_qty == true && ($_POST['qty_recd'.$n] != $_POST['prev_quantity_inv'.$n])
+ && !empty($_POST['prev_quantity_inv'.$n]))
{
if (input_num('this_quantity_inv'.$n) / ($_POST['qty_recd'.$n] - $_POST['prev_quantity_inv'.$n]) >
(1+ ($margin / 100)))
{
if (check_item_data($n))
{
- if (input_num('this_quantity_inv'.$n) >= ($_POST['qty_recd'.$n] - $_POST['prev_quantity_inv'.$n]))
- {
- $complete = true;
- }
- else
- {
- $complete = false;
- }
-
$_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], "");
+ $_POST['order_price'.$n], input_num('ChgPrice'.$n));
reset_tax_input();
}
}
$Ajax->activate('gl_items');
}
+$id5 = find_submit('Edit');
+if ($id5 != -1)
+{
+ $_POST['gl_code'] = $_SESSION['supp_trans']->gl_codes[$id5]->gl_code;
+ $_POST['dimension_id'] = $_SESSION['supp_trans']->gl_codes[$id5]->gl_dim;
+ $_POST['dimension2_id'] = $_SESSION['supp_trans']->gl_codes[$id5]->gl_dim2;
+ $_POST['amount'] = $_SESSION['supp_trans']->gl_codes[$id5]->amount;
+ $_POST['memo_'] = $_SESSION['supp_trans']->gl_codes[$id5]->memo_;
+
+ $_SESSION['supp_trans']->remove_gl_codes_from_trans($id5);
+ reset_tax_input();
+ $Ajax->activate('gl_items');
+}
+
$id2 = -1;
if ($_SESSION["wa_current_user"]->can_access('SA_GRNDELETE'))
{
$Ajax->activate('inv_tot');
}
-if (get_post('AddGLCodeToTrans'))
+if (get_post('AddGLCodeToTrans') || get_post('update'))
$Ajax->activate('inv_tot');
br();