function can_process() { if (!check_num('po_over_receive', 0, 100)) { display_error(_("The delivery over-receive allowance must be between 0 and 100.")); set_focus('po_over_receive'); return false; } if (!check_num('po_over_charge', 0, 100)) { display_error(_("The invoice over-charge allowance must be between 0 and 100.")); set_focus('po_over_charge'); return false; } if (!check_num('past_due_days', 0, 100)) { display_error(_("The past due days interval allowance must be between 0 and 100.")); set_focus('past_due_days'); return false; } $grn_act = get_company_pref('grn_clearing_act'); if (get_post('grn_clearing_act') != $grn_act && db_num_rows(get_grn_items(0, '', true))) { display_error(_("Before GRN Clearing Account can be changed all GRNs have to be invoiced")); $_POST['grn_clearing_act'] = $grn_act; set_focus('grn_clearing_account'); return false; } if (!is_account_balancesheet(get_post('retained_earnings_act')) || is_account_balancesheet(get_post('profit_loss_year_act'))) { display_error(_("The Retained Earnings Account should be a Balance Account or the Profit and Loss Year Account should be an Expense Account (preferred the last one in the Expense Class)")); return false; } return true; }
function display_grn_items_for_selection() { global $table_style; $result = get_grn_items(0, $_SESSION['supp_trans']->supplier_id, true); if (db_num_rows($result) == 0) { display_note(tr("There are no outstanding items received from this supplier that have not been invoiced by them."), 0, 1); end_page(); exit; } /*Set up a table to show the outstanding GRN items for selection */ start_form(false, true); display_heading2(tr("Items Received Yet to be Invoiced")); start_table("{$table_style} colspan=7 width=95%"); $th = array(tr("Delivery"), tr("Sequence #"), tr("P.O."), tr("Item"), tr("Description"), tr("Received On"), tr("Quantity Received"), tr("Quantity Invoiced"), tr("Uninvoiced Quantity"), tr("Order Price"), tr("Total")); table_header($th); $i = $k = 0; while ($myrow = db_fetch($result)) { $grn_already_on_invoice = False; foreach ($_SESSION['supp_trans']->grn_items as $entered_grn) { if ($entered_grn->id == $myrow["id"]) { $grn_already_on_invoice = True; } } if ($grn_already_on_invoice == False) { alt_table_row_color($k); label_cell(get_trans_view_str(25, $myrow["grn_batch_id"])); //text_cells(null, 'grn_item_id', $myrow["id"]); submit_cells('grn_item_id', $myrow["id"]); 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"]); amount_cell($myrow["unit_price"]); amount_cell(round($myrow["unit_price"] * ($myrow["qty_recd"] - $myrow["quantity_inv"]), user_price_dec())); end_row(); $i++; if ($i > 15) { $i = 0; table_header($th); } } } end_table(); }
// $_POST['std_cost_unit'], $_POST['gl_code']); $_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'], input_num('This_QuantityCredited'), $_POST['order_price'], input_num('ChgPrice'), $complete, $_POST['std_cost_unit'], ""); } } //----------------------------------------------------------------------------------------- if (isset($_GET['Delete'])) { $_SESSION['supp_trans']->remove_grn_from_trans($_GET['Delete']); } //----------------------------------------------------------------------------------------- display_grn_items($_SESSION['supp_trans'], 1); echo "<br>"; hyperlink_no_params("{$path_to_root}/purchasing/supplier_credit.php", tr("Return to Credit Note Entry")); echo "<hr>"; //----------------------------------------------------------------------------------------- // get the supplier grns that have been invoiced $result = get_grn_items(0, $_SESSION['supp_trans']->supplier_id, false, true); if (db_num_rows($result) == 0) { display_note(tr("There are no received items for the selected supplier that have been invoiced.")); display_note(tr("Credits can only be applied to invoiced items.")); echo "<br>"; end_page(); exit; } /*Set up a table to show the GRN items outstanding for selection */ start_form(false, true); start_table("{$table_style} width=95%"); $th = array(tr("Delivery"), tr("Sequence #"), tr("Order"), tr("Item Code"), tr("Description"), tr("Delivered"), tr("Total Qty Received"), tr("Qty Already Invoiced"), tr("Qty Yet To Invoice"), tr("Order Price"), tr("Line Value")); table_header($th); $i = $k = 0; while ($myrow = db_fetch($result)) { $grn_already_on_credit = False;