if (isset($_POST['AddGRNToTrans'])) { if (check_data()) { if (input_num('this_quantity_inv') >= $_POST['qty_recd'] - $_POST['prev_quantity_inv']) { $complete = True; } else { $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'], input_num('this_quantity_inv'), $_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_invoice.php", tr("Back to Supplier Invoice Entry")); echo "<hr>"; //----------------------------------------------------------------------------------------- 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);
read_supp_invoice($trans_no, ST_SUPPCREDIT, $supp_trans); display_heading("<font color=red>" . _("SUPPLIER CREDIT NOTE") . " # " . $trans_no . "</font>"); echo "<br>"; start_table(TABLESTYLE, "width=95%"); start_row(); label_cells(_("Supplier"), $supp_trans->supplier_name, "class='tableheader2'"); label_cells(_("Reference"), $supp_trans->reference, "class='tableheader2'"); label_cells(_("Supplier's Reference"), $supp_trans->supp_reference, "class='tableheader2'"); end_row(); start_row(); label_cells(_("Invoice Date"), $supp_trans->tran_date, "class='tableheader2'"); label_cells(_("Due Date"), $supp_trans->due_date, "class='tableheader2'"); label_cells(_("Currency"), get_supplier_currency($supp_trans->supplier_id), "class='tableheader2'"); end_row(); comments_display_row(ST_SUPPCREDIT, $trans_no); end_table(1); $total_gl = display_gl_items($supp_trans, 3); $total_grn = display_grn_items($supp_trans, 2); $display_sub_tot = number_format2($total_gl + $total_grn, user_price_dec()); start_table(TABLESTYLE, "width=95%"); label_row(_("Sub Total"), $display_sub_tot, "align=right", "nowrap align=right width=17%"); $tax_items = get_trans_tax_details(ST_SUPPCREDIT, $trans_no); display_supp_trans_tax_details($tax_items, 1); $display_total = number_format2(-($supp_trans->ov_amount + $supp_trans->ov_gst), user_price_dec()); label_row("<font color=red>" . _("TOTAL CREDIT NOTE") . "</font", "<font color=red>{$display_total}</font>", "colspan=1 align=right", "nowrap align=right"); end_table(1); $voided = is_voided_display(ST_SUPPCREDIT, $trans_no, _("This credit note has been voided.")); if (!$voided) { display_allocations_from(PT_SUPPLIER, $supp_trans->supplier_id, ST_SUPPCREDIT, $trans_no, -($supp_trans->ov_amount + $supp_trans->ov_gst)); } end_page(true, false, false, ST_SUPPCREDIT, $trans_no);
} $invoice_no = add_supp_invoice($_SESSION['supp_trans']); $_SESSION['supp_trans']->clear_items(); unset($_SESSION['supp_trans']); meta_forward($_SERVER['PHP_SELF'], "AddedID={$invoice_no}"); } //-------------------------------------------------------------------------------------------------- if (isset($_POST['PostCreditNote'])) { handle_commit_credit_note(); } //-------------------------------------------------------------------------------------------------- start_form(false, true); start_table("{$table_style} width=80%", 8); echo "<tr><td valign=center>"; // outer table echo "<center>"; invoice_header($_SESSION['supp_trans']); echo "</td></tr><tr><td valign=center>"; // outer table $total_grn_value = display_grn_items($_SESSION['supp_trans']); $total_gl_value = display_gl_items($_SESSION['supp_trans']); echo "</td></tr><tr><td align=center colspan=2>"; // outer table invoice_totals($_SESSION['supp_trans']); echo "</td></tr>"; end_table(1); // outer table submit_center('PostCreditNote', tr("Enter Credit Note")); echo "<br><br>"; end_form(); end_page();