X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=inline;f=purchasing%2Fsupplier_credit_grns.php;h=b9bfbe3369a3e2273f2e492b728d807c4617bfde;hb=c2dd0246dfc1625b90f4212767fbac3706796a08;hp=15ea083045bad55fd36608e2bfdfdc5e4efa0d57;hpb=de3a75773afa86df1739d14f24399d6f7a46f809;p=fa-stable.git
diff --git a/purchasing/supplier_credit_grns.php b/purchasing/supplier_credit_grns.php
index 15ea0830..b9bfbe33 100644
--- a/purchasing/supplier_credit_grns.php
+++ b/purchasing/supplier_credit_grns.php
@@ -1,13 +1,13 @@
";
function check_data()
{
- if (!check_num('This_QuantityCredited', 0))
+ if (!check_num('This_QuantityCredited', 0))
{
display_error(_("The quantity to credit must be numeric and greater than zero."));
+ set_focus('This_QuantityCredited');
return false;
}
if (!check_num('ChgPrice', 0))
{
display_error(_("The price is either not numeric or negative."));
+ set_focus('ChgPrice');
return false;
}
@@ -69,16 +71,18 @@ if (isset($_POST['AddGRNToTrans']))
}
//-----------------------------------------------------------------------------------------
-
-if (isset($_GET['Delete']))
+$id = find_submit('Delete');
+if ($id != -1)
{
- $_SESSION['supp_trans']->remove_grn_from_trans($_GET['Delete']);
+ $_SESSION['supp_trans']->remove_grn_from_trans($id);
+ $Ajax->activate('grn_items');
+ $Ajax->activate('grn_table');
}
//-----------------------------------------------------------------------------------------
-
+start_form(false,true);
display_grn_items($_SESSION['supp_trans'], 1);
-
+end_form();
echo "
";
hyperlink_no_params("$path_to_root/purchasing/supplier_credit.php", _("Return to Credit Note Entry"));
@@ -102,6 +106,7 @@ if (db_num_rows($result) == 0)
/*Set up a table to show the GRN items outstanding for selection */
start_form(false, true);
+div_start('grn_table');
start_table("$table_style width=95%");
$th = array(_("Delivery"), _("Sequence #"), _("Order"), _("Item Code"), _("Description"),
_("Delivered"), _("Total Qty Received"), _("Qty Already Invoiced"),
@@ -115,7 +120,7 @@ while ($myrow = db_fetch($result))
foreach ($_SESSION['supp_trans']->grn_items as $entered_grn)
{
- if ($entered_grn->id == $myrow["id"])
+ if ($entered_grn->id == $myrow["id"])
{
$grn_already_on_credit = True;
}
@@ -126,16 +131,17 @@ while ($myrow = db_fetch($result))
alt_table_row_color($k);
label_cell(get_trans_view_str(25, $myrow["grn_batch_id"]));
- submit_cells('grn_item_id', $myrow["id"]);
+ submit_cells('grn_item_id'.$myrow["id"], $myrow["id"], '', '', true);
label_cell(get_trans_view_str(systypes::po(), $myrow["purch_order_no"]));
label_cell($myrow["item_code"]);
label_cell($myrow["description"]);
label_cell(sql2date($myrow["delivery_date"]));
- qty_cell($myrow["qty_recd"]);
- qty_cell($myrow["quantity_inv"]);
- qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"]);
+ $dec = get_qty_dec($myrow["item_code"]);
+ qty_cell($myrow["qty_recd"], false, $dec);
+ qty_cell($myrow["quantity_inv"], false, $dec);
+ qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"], false, $dec);
amount_cell($myrow["unit_price"]);
- amount_cell($myrow["unit_price"] * $myrow["quantity_inv"]);
+ amount_cell(round($myrow["unit_price"] * $myrow["quantity_inv"], user_price_dec()));
end_row();
$i++;
if ($i > 15)
@@ -147,34 +153,49 @@ while ($myrow = db_fetch($result))
}
end_table();
+div_end();
//-----------------------------------------------------------------------------------------
+$id = find_submit('grn_item_id');
+if ($id || get_post('AddGRNToTrans'))
+{
+ $Ajax->activate('grn_selector');
+}
+if (get_post('AddGRNToTrans'))
+{
+ $Ajax->activate('grn_table');
+ $Ajax->activate('grn_items');
+}
+
-if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "")
+div_start('grn_selector');
+$id = find_submit('grn_item_id');
+if ($id != -1)
{
- $myrow = get_grn_item_detail($_POST['grn_item_id']);
+ $myrow = get_grn_item_detail($id);
echo "
";
display_heading2(_("Delivery Item Selected For Adding To A Supplier Credit Note"));
start_table("$table_style width=80%");
$th = array(_("Sequence #"), _("Item"), _("Qty Already Invoiced"),
_("Quantity to Credit"), _("Order Price"), _("Credit Price"));
- table_header($th);
+ table_header($th);
start_row();
- label_cell($_POST['grn_item_id']);
+ label_cell($id);
label_cell($myrow['item_code'] . " " . $myrow['description']);
- qty_cell($myrow["quantity_inv"]);
- qty_cells(null, 'This_QuantityCredited', qty_format(max($myrow['quantity_inv'],0)));
+ $dec = get_qty_dec($myrow['item_code']);
+ qty_cell($myrow["quantity_inv"], false, $dec);
+ qty_cells(null, 'This_QuantityCredited', number_format2(max($myrow['quantity_inv'],0), $dec), null, null, $dec);
amount_cell($myrow['unit_price']);
amount_cells(null, 'ChgPrice', price_format($myrow['unit_price']));
end_row();
end_table(1);
- submit_center('AddGRNToTrans', _("Add to Credit Note"));
+ submit_center('AddGRNToTrans', _("Add to Credit Note"), true, '', true);
- hidden('GRNNumber', $_POST['grn_item_id']);
+ hidden('GRNNumber', $id);
hidden('item_code', $myrow['item_code']);;
hidden('item_description', $myrow['description']);
hidden('qty_recd', $myrow['qty_recd']);
@@ -184,7 +205,9 @@ if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "")
hidden('po_detail_item', $myrow['po_detail_item']);
}
+div_end();
end_form();
-end_page();
+echo '
';
+end_page(false, true);
?>