function view_link($trans)
{
    if (!isset($trans['type'])) {
        $trans['type'] = $_POST['filterType'];
    }
    return get_trans_view_str($trans["type"], $trans["trans_no"]);
}
 function render($id, $title)
 {
     global $path_to_root, $systypes_array;
     include_once $path_to_root . "/includes/ui.inc";
     $start_date = add_days(Today(), -$this->days_past);
     $end_date = add_days(Today(), $this->days_future);
     $result = get_bank_trans_for_bank_account($this->bank_act, $start_date, $end_date);
     start_table(TABLESTYLE, 'width=98%');
     $th = array(_("#"), _("Date"), _("Receipt"), _("Payment"), _("Balance"), _("Person/Item"), _("Memo"), "");
     table_header($th);
     $bfw = get_balance_before_for_bank_account($this->bank_act, $start_date);
     $credit = $debit = 0;
     start_row("class='inquirybg' style='font-weight:bold'");
     label_cell(_("Opening Balance") . " - " . $start_date, "colspan=4");
     display_debit_or_credit_cells($bfw);
     label_cell("");
     label_cell("", "colspan=2");
     end_row();
     $running_total = $bfw;
     if ($bfw > 0) {
         $debit += $bfw;
     } else {
         $credit += $bfw;
     }
     $j = 1;
     $k = 0;
     //row colour counter
     while ($myrow = db_fetch($result)) {
         alt_table_row_color($k);
         $running_total += $myrow["amount"];
         label_cell(get_trans_view_str($myrow["type"], $myrow["trans_no"]));
         $trandate = sql2date($myrow["trans_date"]);
         label_cell($trandate);
         display_debit_or_credit_cells($myrow["amount"]);
         amount_cell($running_total);
         label_cell(payment_person_name($myrow["person_type_id"], $myrow["person_id"]));
         label_cell(get_comments_string($myrow["type"], $myrow["trans_no"]));
         label_cell(get_gl_view_str($myrow["type"], $myrow["trans_no"]));
         end_row();
         if ($myrow["amount"] > 0) {
             $debit += $myrow["amount"];
         } else {
             $credit += $myrow["amount"];
         }
         if ($j == 12) {
             $j = 1;
             table_header($th);
         }
         $j++;
     }
     //end of while loop
     start_row("class='inquirybg' style='font-weight:bold'");
     label_cell(_("Ending Balance") . " - " . $end_date, "colspan=4");
     amount_cell($debit + $credit);
     label_cell("");
     label_cell("", "colspan=2");
     end_row();
     end_table(2);
 }
Пример #3
0
function display_wo_production($prod_id)
{
    $myrow = get_work_order_produce($prod_id);
    br(1);
    start_table(TABLESTYLE);
    $th = array(_("Production #"), _("Reference"), _("For Work Order #"), _("Item"), _("Quantity Manufactured"), _("Date"));
    table_header($th);
    start_row();
    label_cell($myrow["id"]);
    label_cell($myrow["reference"]);
    label_cell(get_trans_view_str(ST_WORKORDER, $myrow["workorder_id"]));
    label_cell($myrow["stock_id"] . " - " . $myrow["StockDescription"]);
    qty_cell($myrow["quantity"], false, get_qty_dec($myrow["stock_id"]));
    label_cell(sql2date($myrow["date_"]));
    end_row();
    comments_display_row(ST_MANURECEIVE, $prod_id);
    end_table(1);
    is_voided_display(ST_MANURECEIVE, $prod_id, _("This production has been voided."));
}
Пример #4
0
function display_wo_production($prod_id)
{
    global $table_style;
    $myrow = get_work_order_produce($prod_id);
    start_table($table_style);
    $th = array(tr("Production #"), tr("Reference"), tr("For Work Order #"), tr("Item"), tr("Quantity Manufactured"), tr("Date"));
    table_header($th);
    start_row();
    label_cell($myrow["id"]);
    label_cell($myrow["reference"]);
    label_cell(get_trans_view_str(systypes::work_order(), $myrow["workorder_id"]));
    label_cell($myrow["stock_id"] . " - " . $myrow["StockDescription"]);
    qty_cell($myrow["quantity"]);
    label_cell(sql2date($myrow["date_"]));
    end_row();
    comments_display_row(29, $prod_id);
    end_table(1);
    is_voided_display(29, $prod_id, tr("This production has been voided."));
}
Пример #5
0
function display_wo_issue($issue_no)
{
    $myrow = get_work_order_issue($issue_no);
    br(1);
    start_table(TABLESTYLE);
    $th = array(_("Issue #"), _("Reference"), _("For Work Order #"), _("Item"), _("From Location"), _("To Work Centre"), _("Date of Issue"));
    table_header($th);
    start_row();
    label_cell($myrow["issue_no"]);
    label_cell($myrow["reference"]);
    label_cell(get_trans_view_str(ST_WORKORDER, $myrow["workorder_id"]));
    label_cell($myrow["stock_id"] . " - " . $myrow["description"]);
    label_cell($myrow["location_name"]);
    label_cell($myrow["WorkCentreName"]);
    label_cell(sql2date($myrow["issue_date"]));
    end_row();
    comments_display_row(28, $issue_no);
    end_table(1);
    is_voided_display(28, $issue_no, _("This issue has been voided."));
}
Пример #6
0
 function render($id, $title)
 {
     global $path_to_root;
     include_once $path_to_root . "/includes/ui.inc";
     if (!defined('FLOAT_COMP_DELTA')) {
         define('FLOAT_COMP_DELTA', 0.004);
     }
     $today = date2sql(Today());
     $sql = "SELECT trans.trans_no, trans.reference, trans.tran_date, trans.due_date, debtor.debtor_no,\n            debtor.name, branch.br_name, debtor.curr_code,\n            (trans.ov_amount + trans.ov_gst + trans.ov_freight\n                + trans.ov_freight_tax + trans.ov_discount) AS total,\n            (trans.ov_amount + trans.ov_gst + trans.ov_freight\n                + trans.ov_freight_tax + trans.ov_discount - trans.alloc) AS remainder,\n            DATEDIFF('{$today}', trans.due_date) AS days\n            FROM " . TB_PREF . "debtor_trans as trans, " . TB_PREF . "debtors_master as debtor,\n                " . TB_PREF . "cust_branch as branch\n            WHERE debtor.debtor_no = trans.debtor_no AND trans.branch_code = branch.branch_code\n                AND trans.type = " . ST_SALESINVOICE . " AND (trans.ov_amount + trans.ov_gst + trans.ov_freight\n                + trans.ov_freight_tax + trans.ov_discount - trans.alloc) > " . FLOAT_COMP_DELTA . "\n                AND DATEDIFF('{$today}', trans.due_date) > 0 ORDER BY days DESC";
     if ($this->data_filter != '') {
         $sql .= ' AND ' . $this->data_filter;
     }
     $result = db_query($sql);
     $title = db_num_rows($result) . _(" Overdue Sales Invoices");
     br(1);
     display_heading($title);
     br();
     $th = array("#", _("Date"), _("Due Date"), _("Customer"), _("Currency"), _("Total"), _("Remainder"), _("Days"));
     start_table(TABLESTYLE, "width=98%");
     table_header($th);
     $k = 0;
     //row colour counter
     while ($myrow = db_fetch($result)) {
         alt_table_row_color($k);
         label_cell(get_trans_view_str(ST_SALESINVOICE, $myrow["trans_no"]));
         label_cell(sql2date($myrow['tran_date']));
         label_cell(sql2date($myrow['due_date']));
         $name = $myrow["debtor_no"] . " " . $myrow["name"];
         label_cell($name);
         label_cell($myrow['curr_code']);
         amount_cell($myrow['total']);
         amount_cell($myrow['remainder']);
         label_cell($myrow['days'], "align='right'");
         end_row();
     }
     end_table(1);
 }
    $js .= get_js_open_window(900, 500);
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(_($help_context = "Produce or Unassemble Finished Items From Work Order"), false, false, "", $js);
if (isset($_GET['trans_no']) && $_GET['trans_no'] != "") {
    $_POST['selected_id'] = $_GET['trans_no'];
}
//--------------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    include_once $path_to_root . "/reporting/includes/reporting.inc";
    $id = $_GET['AddedID'];
    $stype = ST_WORKORDER;
    display_notification(_("The manufacturing process has been entered."));
    display_note(get_trans_view_str($stype, $id, _("View this Work Order")));
    display_note(get_gl_view_str($stype, $id, _("View the GL Journal Entries for this Work Order")), 1);
    $ar = array('PARAM_0' => $_GET['date'], 'PARAM_1' => $_GET['date'], 'PARAM_2' => $stype);
    display_note(print_link(_("Print the GL Journal Entries for this Work Order"), 702, $ar), 1);
    hyperlink_no_params("search_work_orders.php", _("Select another &Work Order to Process"));
    br();
    end_page();
    exit;
}
//--------------------------------------------------------------------------------------------------
$wo_details = get_work_order($_POST['selected_id']);
if (strlen($wo_details[0]) == 0) {
    display_error(_("The order number sent is not valid."));
    exit;
}
//--------------------------------------------------------------------------------------------------
Пример #8
0
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();
}
Пример #9
0
if ($use_popup_windows) {
    $js .= get_js_open_window(900, 500);
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(tr("Enter Supplier Invoice"), false, false, "", $js);
//----------------------------------------------------------------------------------------
check_db_has_suppliers(tr("There are no suppliers defined in the system."));
//---------------------------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $invoice_no = $_GET['AddedID'];
    $trans_type = 20;
    echo "<center>";
    display_notification_centered(tr("Supplier invoice has been processed."));
    display_note(get_trans_view_str($trans_type, $invoice_no, tr("View this Invoice")));
    display_note(get_gl_view_str($trans_type, $invoice_no, tr("View the GL Journal Entries for this Invoice")), 1);
    hyperlink_params($_SERVER['PHP_SELF'], tr("Enter Another Invoice"), "New=1");
    display_footer_exit();
}
//--------------------------------------------------------------------------------------------------
if (isset($_GET['New'])) {
    if (isset($_SESSION['supp_trans'])) {
        unset($_SESSION['supp_trans']->grn_items);
        unset($_SESSION['supp_trans']->gl_codes);
        unset($_SESSION['supp_trans']);
    }
    //session_register("SuppInv");
    session_register("supp_trans");
    $_SESSION['supp_trans'] = new supp_trans();
    $_SESSION['supp_trans']->is_invoice = true;
Пример #10
0
function trans_view($trans)
{
    return get_trans_view_str(ST_PURCHORDER, $trans["order_no"]);
}
Пример #11
0
function view_link($dummy, $order_no)
{
    return get_trans_view_str(ST_WORKORDER, $order_no);
}
Пример #12
0
function edit_allocations_for_transaction($type, $trans_no)
{
    global $table_style;
    start_form(false, true);
    display_heading(sprintf(tr("Allocation of %s # %d"), systypes::name($_SESSION['alloc']->type), $_SESSION['alloc']->trans_no));
    display_heading($_SESSION['alloc']->person_name);
    display_heading2(tr("Date:") . " <b>" . $_SESSION['alloc']->date_ . "</b>");
    display_heading2(tr("Total:") . " <b>" . price_format($_SESSION['alloc']->amount) . "</b>");
    echo "<br>";
    if (count($_SESSION['alloc']->allocs) > 0) {
        start_table($table_style);
        $th = array(tr("Transaction Type"), tr("#"), tr("Date"), tr("Due Date"), tr("Amount"), tr("Other Allocations"), tr("This Allocation"), tr("Left to Allocate"), "", "");
        table_header($th);
        $k = $counter = $total_allocated = 0;
        foreach ($_SESSION['alloc']->allocs as $allocn_item) {
            alt_table_row_color($k);
            label_cell(systypes::name($allocn_item->type));
            label_cell(get_trans_view_str($allocn_item->type, $allocn_item->type_no));
            label_cell($allocn_item->date_, "align=right");
            label_cell($allocn_item->due_date, "align=right");
            amount_cell($allocn_item->amount);
            amount_cell($allocn_item->amount_allocated);
            if (!check_num('amount' . $counter)) {
                $_POST['amount' . $counter] = price_format($allocn_item->current_allocated);
            }
            amount_cells(null, 'amount' . $counter, $_POST['amount' . $counter]);
            $un_allocated = round($allocn_item->amount - $allocn_item->amount_allocated, 6);
            hidden("un_allocated" . $counter, $un_allocated);
            amount_cell($un_allocated);
            label_cell("<a href='#' name=Alloc{$counter} onclick='allocate_all(this.name.substr(5));return true;'>" . tr("All") . "</a>");
            label_cell("<a href='#' name=DeAll{$counter} onclick='allocate_none(this.name.substr(5));return true;'>" . tr("None") . "</a>");
            end_row();
            $total_allocated += input_num('amount' . $counter);
            $counter++;
        }
        label_row(tr("Total Allocated"), price_format($total_allocated), "colspan=6 align=right", "nowrap align=right id='total_allocated'");
        if ($_SESSION['alloc']->amount - $total_allocated < 0) {
            $font1 = "<font color=red>";
            $font2 = "</font>";
        } else {
            $font1 = $font2 = "";
        }
        $left_to_allocate = $_SESSION['alloc']->amount - $total_allocated;
        $left_to_allocate = price_format($left_to_allocate);
        label_row(tr("Left to Allocate"), $font1 . $left_to_allocate . $font2, "colspan=6 align=right ", "nowrap align=right id='left_to_allocate'");
        end_table(1);
        hidden('TotalNumberOfAllocs', $counter);
        //		hidden('left_to_allocate', $left_to_allocate);
        submit_center_first('UpdateDisplay', tr("Update"));
        submit('Process', tr("Process"));
    } else {
        display_note(tr("There are no unsettled transactions to allocate."), 0, 1);
    }
    submit_center_last('Cancel', tr("Back to Allocations"));
    end_form();
}
Пример #13
0
function display_allocatable_transactions()
{
    global $table_style, $path_to_root;
    start_form();
    /* show all outstanding receipts and credits to be allocated */
    /*Clear any previous allocation records */
    if (isset($_SESSION['alloc'])) {
        unset($_SESSION['alloc']->allocs);
        unset($_SESSION['alloc']);
    }
    if (!isset($_POST['supplier_id'])) {
        $_POST['supplier_id'] = get_global_supplier();
    }
    echo "<center>" . tr("Select a Supplier: ") . "&nbsp;&nbsp;";
    supplier_list('supplier_id', $_POST['supplier_id'], true, true);
    echo "<br>";
    check(tr("Show Settled Items:"), 'ShowSettled', null, true);
    echo "</center><br><br>";
    set_global_supplier($_POST['supplier_id']);
    if (isset($_POST['supplier_id']) && $_POST['supplier_id'] == reserved_words::get_all()) {
        unset($_POST['supplier_id']);
    }
    $settled = false;
    if (check_value('ShowSettled')) {
        $settled = true;
    }
    $supplier_id = null;
    if (isset($_POST['supplier_id'])) {
        $supplier_id = $_POST['supplier_id'];
    }
    $trans_items = get_allocatable_from_supp_transactions($supplier_id, $settled);
    start_table($table_style);
    if (!isset($_POST['supplier_id'])) {
        $th = array(tr("Transaction Type"), tr("#"), tr("Reference"), tr("Date"), tr("Supplier"), tr("Currency"), tr("Total"), tr("Left To Allocate"));
    } else {
        $th = array(tr("Transaction Type"), tr("#"), tr("Reference"), tr("Date"), tr("Total"), tr("Left To Allocate"));
    }
    table_header($th);
    $k = 0;
    //row colour counter
    $has_settled_items = false;
    while ($myrow = db_fetch($trans_items)) {
        if ($myrow["settled"] == 1) {
            start_row("class='settledbg'");
            $has_settled_items = true;
        } else {
            alt_table_row_color($k);
        }
        label_cell(systypes::name($myrow["type"]));
        label_cell(get_trans_view_str($myrow["type"], $myrow["trans_no"]));
        label_cell($myrow["reference"]);
        label_cell(sql2date($myrow["tran_date"]));
        if (!isset($_POST['supplier_id'])) {
            label_cell($myrow["supp_name"]);
            label_cell($myrow["curr_code"]);
        }
        amount_cell(-$myrow["Total"]);
        amount_cell(-$myrow["Total"] - $myrow["alloc"]);
        label_cell("<a href='{$path_to_root}/purchasing/allocations/supplier_allocate.php?trans_no=" . $myrow["trans_no"] . "&trans_type=" . $myrow["type"] . "'>" . tr("Allocate") . "</a>");
        end_row();
    }
    end_table();
    if ($has_settled_items) {
        display_note(tr("Marked items are settled."), 0, 1, "class='settledfg'");
    }
    if (db_num_rows($trans_items) == 0) {
        display_note(tr("There are no allocations to be done."), 1, 2);
    }
    end_form();
}
Пример #14
0
function display_supplier_topten()
{
    global $path_to_root;
    $pg = new graph();
    if (!defined('FLOAT_COMP_DELTA')) {
        define('FLOAT_COMP_DELTA', 0.004);
    }
    $begin = begin_fiscalyear();
    $today = Today();
    $begin1 = date2sql($begin);
    $today1 = date2sql($today);
    $sql = "SELECT SUM((trans.ov_amount + trans.ov_discount) * rate) AS total, s.supplier_id, s.supp_name FROM\n\t\t\t" . TB_PREF . "supp_trans AS trans, " . TB_PREF . "suppliers AS s WHERE trans.supplier_id=s.supplier_id\n\t\t\tAND (trans.type = " . ST_SUPPINVOICE . " OR trans.type = " . ST_SUPPCREDIT . ")\n\t\t\tAND tran_date >= '{$begin1}' AND tran_date <= '{$today1}' GROUP by s.supplier_id ORDER BY total DESC, s.supplier_id \n\t\t\tLIMIT 10";
    $result = db_query($sql);
    $title = _("Top 10 suppliers in fiscal year");
    br(2);
    display_heading($title);
    br();
    $th = array(_("Supplier"), _("Amount"));
    start_table(TABLESTYLE, "width=30%");
    table_header($th);
    $k = 0;
    //row colour counter
    $i = 0;
    while ($myrow = db_fetch($result)) {
        alt_table_row_color($k);
        $name = $myrow["supplier_id"] . " " . $myrow["supp_name"];
        label_cell($name);
        amount_cell($myrow['total']);
        $pg->x[$i] = $name;
        $pg->y[$i] = $myrow['total'];
        $i++;
        end_row();
    }
    end_table(2);
    $pg->title = $title;
    $pg->axis_x = _("Supplier");
    $pg->axis_y = _("Amount");
    $pg->graphic_1 = $today;
    $pg->type = 2;
    $pg->skin = 1;
    $pg->built_in = false;
    $filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
    $pg->display($filename, true);
    start_table(TABLESTYLE);
    start_row();
    echo "<td>";
    echo "<img src='{$filename}' border='0' alt='{$title}'>";
    echo "</td>";
    end_row();
    end_table(1);
    $today = date2sql(Today());
    $sql = "SELECT trans.trans_no, trans.reference, trans.tran_date, trans.due_date, s.supplier_id, \n\t\t\ts.supp_name, s.curr_code,\n\t\t\t(trans.ov_amount + trans.ov_gst + trans.ov_discount) AS total,  \n\t\t\t(trans.ov_amount + trans.ov_gst + trans.ov_discount - trans.alloc) AS remainder,\n\t\t\tDATEDIFF('{$today}', trans.due_date) AS days \t\n\t\t\tFROM " . TB_PREF . "supp_trans as trans, " . TB_PREF . "suppliers as s \n\t\t\tWHERE s.supplier_id = trans.supplier_id\n\t\t\t\tAND trans.type = " . ST_SUPPINVOICE . " AND (ABS(trans.ov_amount + trans.ov_gst + \n\t\t\t\t\ttrans.ov_discount) - trans.alloc) > " . FLOAT_COMP_DELTA . "\n\t\t\t\tAND DATEDIFF('{$today}', trans.due_date) > 0 ORDER BY days DESC";
    $result = db_query($sql);
    $title = db_num_rows($result) . _(" overdue Purchase Invoices");
    br(1);
    display_heading($title);
    br();
    $th = array("#", _("Ref."), _("Date"), _("Due Date"), _("Supplier"), _("Currency"), _("Total"), _("Remainder"), _("Days"));
    start_table(TABLESTYLE);
    table_header($th);
    $k = 0;
    //row colour counter
    while ($myrow = db_fetch($result)) {
        alt_table_row_color($k);
        label_cell(get_trans_view_str(ST_SUPPINVOICE, $myrow["trans_no"]));
        label_cell($myrow['reference']);
        label_cell(sql2date($myrow['tran_date']));
        label_cell(sql2date($myrow['due_date']));
        $name = $myrow["supplier_id"] . " " . $myrow["supp_name"];
        label_cell($name);
        label_cell($myrow['curr_code']);
        amount_cell($myrow['total']);
        amount_cell($myrow['remainder']);
        label_cell($myrow['days'], "align='right'");
        end_row();
    }
    end_table(2);
}
if ($use_popup_windows) {
    $js .= get_js_open_window(900, 500);
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(_($help_context = "Supplier Credit Note"), false, false, "", $js);
//----------------------------------------------------------------------------------------
check_db_has_suppliers(_("There are no suppliers defined in the system."));
//---------------------------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $invoice_no = $_GET['AddedID'];
    $trans_type = ST_SUPPCREDIT;
    echo "<center>";
    display_notification_centered(_("Supplier credit note has been processed."));
    display_note(get_trans_view_str($trans_type, $invoice_no, _("View this Credit Note")));
    display_note(get_gl_view_str($trans_type, $invoice_no, _("View the GL Journal Entries for this Credit Note")), 1);
    hyperlink_params($_SERVER['PHP_SELF'], _("Enter Another Credit Note"), "New=1");
    hyperlink_params("{$path_to_root}/admin/attachments.php", _("Add an Attachment"), "filterType={$trans_type}&trans_no={$invoice_no}");
    display_footer_exit();
}
//---------------------------------------------------------------------------------------------------
if (isset($_GET['New'])) {
    if (isset($_SESSION['supp_trans'])) {
        unset($_SESSION['supp_trans']->grn_items);
        unset($_SESSION['supp_trans']->gl_codes);
        unset($_SESSION['supp_trans']);
    }
    $_SESSION['supp_trans'] = new supp_trans(ST_SUPPCREDIT);
    if (isset($_GET['invoice_no'])) {
        $_SESSION['supp_trans']->supp_reference = $_POST['invoice_no'] = $_GET['invoice_no'];
Пример #16
0
$result = db_query($sql, "No orders were returned");
print_hidden_script(18);
start_table("{$table_style} colspan=7 width=80%");
if (isset($_POST['StockLocation']) && $_POST['StockLocation'] == reserved_words::get_all()) {
    $th = array(tr("#"), tr("Reference"), tr("Supplier"), tr("Location"), tr("Supplier's Reference"), tr("Order Date"), tr("Currency"), tr("Order Total"), "");
} else {
    $th = array(tr("#"), tr("Reference"), tr("Supplier"), tr("Supplier's Reference"), tr("Order Date"), tr("Currency"), tr("Order Total"), "");
}
table_header($th);
$j = 1;
$k = 0;
//row colour counter
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    $date = sql2date($myrow["ord_date"]);
    label_cell(get_trans_view_str(systypes::po(), $myrow["order_no"]));
    label_cell($myrow["reference"]);
    label_cell($myrow["supp_name"]);
    if (isset($_POST['StockLocation']) && $_POST['StockLocation'] == reserved_words::get_all()) {
        label_cell($myrow["location_name"]);
    }
    label_cell($myrow["requisition_no"]);
    label_cell($date);
    label_cell($myrow["curr_code"]);
    amount_cell($myrow["OrderValue"]);
    label_cell(print_document_link($myrow['order_no'], tr("Print")));
    end_row();
    $j++;
    if ($j == 12) {
        $j = 1;
        table_header($th);
Пример #17
0
include_once $path_to_root . "/purchasing/includes/purchasing_db.inc";
include_once $path_to_root . "/purchasing/includes/purchasing_ui.inc";
$js = "";
if ($use_popup_windows) {
    $js .= get_js_open_window(900, 500);
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(tr("Receive Purchase Order Items"), false, false, "", $js);
//---------------------------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $grn = $_GET['AddedID'];
    $trans_type = 25;
    display_notification_centered(tr("Purchase Order Delivery has been processed"));
    display_note(get_trans_view_str($trans_type, $grn, tr("View this Delivery")));
    //echo "<BR>";
    //echo get_gl_view_str(25, $grn, tr("View the GL Journal Entries for this Delivery"));
    //	echo "<br>";
    hyperlink_no_params("{$path_to_root}/purchasing/inquiry/po_search.php", tr("Select a different purchase order for receiving items against"));
    display_footer_exit();
}
//--------------------------------------------------------------------------------------------------
if ((!isset($_GET['PONumber']) || $_GET['PONumber'] == 0) && !isset($_SESSION['PO'])) {
    die(tr("This page can only be opened if a purchase order has been selected. Please select a purchase order first."));
}
//--------------------------------------------------------------------------------------------------
function display_po_receive_items()
{
    global $table_style;
    start_table("colspan=7 {$table_style} width=90%");
Пример #18
0
include_once $path_to_root . "/manufacturing/includes/manufacturing_db.inc";
include_once $path_to_root . "/manufacturing/includes/manufacturing_ui.inc";
include_once $path_to_root . "/manufacturing/includes/work_order_issue_ui.inc";
$js = "";
if ($use_popup_windows) {
    $js .= get_js_open_window(800, 500);
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(_($help_context = "Issue Items to Work Order"), false, false, "", $js);
//-----------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $id = $_GET['AddedID'];
    display_notification(_("The work order issue has been entered."));
    display_note(get_trans_view_str(ST_WORKORDER, $id, _("View this Work Order")));
    display_note(get_gl_view_str(ST_WORKORDER, $id, _("View the GL Journal Entries for this Work Order")), 1);
    hyperlink_no_params("search_work_orders.php", _("Select another &Work Order to Process"));
    display_footer_exit();
}
//--------------------------------------------------------------------------------------------------
function line_start_focus()
{
    global $Ajax;
    $Ajax->activate('items_table');
    set_focus('_stock_id_edit');
}
//--------------------------------------------------------------------------------------------------
function handle_new_order()
{
    if (isset($_SESSION['issue_items'])) {
Пример #19
0
        alt_table_row_color($k);
        label_cell(get_trans_view_str(ST_SUPPRECEIVE, $myrow["id"]));
        label_cell($myrow["reference"]);
        label_cell(sql2date($myrow["delivery_date"]));
        end_row();
    }
    end_table();
}
$invoice_result = get_po_invoices_credits($_GET['trans_no']);
$k = 0;
if (db_num_rows($invoice_result) > 0) {
    echo "</td><td valign=top>";
    // outer table
    display_heading2(_("Invoices/Credits"));
    start_table(TABLESTYLE);
    $th = array(_("#"), _("Date"), _("Total"));
    table_header($th);
    while ($myrow = db_fetch($invoice_result)) {
        alt_table_row_color($k);
        label_cell(get_trans_view_str($myrow["type"], $myrow["trans_no"]));
        label_cell(sql2date($myrow["tran_date"]));
        amount_cell($myrow["Total"]);
        end_row();
    }
    end_table();
}
echo "</td></tr>";
end_table(1);
// outer table
//----------------------------------------------------------------------------------------------------
end_page(true, false, false, ST_PURCHORDER, $_GET['trans_no']);
Пример #20
0
    display_note(get_gl_view_str($trans_type, $invoice_no, _("View the GL &Journal Entries for this Invoice")), 1);
    hyperlink_params("{$path_to_root}/sales/inquiry/sales_deliveries_view.php", _("Select Another &Delivery For Invoicing"), "OutstandingOnly=1");
    hyperlink_no_params("{$path_to_root}/sales/inquiry/customer_allocation_inquiry.php?customer_id=", _("Go to Allocation Inquiry"));
    $sql = "SELECT trans_type_from, trans_no_from FROM " . TB_PREF . "cust_allocations\n\t\t\tWHERE trans_type_to=" . ST_SALESINVOICE . " AND trans_no_to=" . db_escape($invoice_no);
    $result = db_query($sql, "could not retrieve customer allocation");
    $row = db_fetch($result);
    if ($row === false) {
        hyperlink_params("{$path_to_root}/sales/customer_payments.php", _("Entry &customer payment for this invoice"), "SInvoice=" . $invoice_no);
    }
    hyperlink_params("{$path_to_root}/admin/attachments.php", _("Add an Attachment"), "filterType={$trans_type}&trans_no={$invoice_no}");
    display_footer_exit();
} elseif (isset($_GET['UpdatedID'])) {
    $invoice_no = $_GET['UpdatedID'];
    $trans_type = ST_SALESINVOICE;
    display_notification_centered(sprintf(_('Sales Invoice # %d has been updated.'), $invoice_no));
    display_note(get_trans_view_str(ST_SALESINVOICE, $invoice_no, _("&View This Invoice")));
    echo '<br>';
    display_note(print_document_link($invoice_no . "-" . $trans_type, _("&Print This Invoice"), true, ST_SALESINVOICE));
    display_note(print_document_link($invoice_no . "-" . $trans_type, _("&Email This Invoice"), true, ST_SALESINVOICE, false, "printlink", "", 1), 1);
    hyperlink_no_params($path_to_root . "/sales/inquiry/customer_inquiry.php", _("Select Another &Invoice to Modify"));
    display_footer_exit();
} elseif (isset($_GET['RemoveDN'])) {
    for ($line_no = 0; $line_no < count($_SESSION['Items']->line_items); $line_no++) {
        $line =& $_SESSION['Items']->line_items[$line_no];
        if ($line->src_no == $_GET['RemoveDN']) {
            $line->quantity = $line->qty_done;
            $line->qty_dispatched = 0;
        }
    }
    unset($line);
    // Remove also src_doc delivery note
Пример #21
0
if ($use_popup_windows) {
    $js .= get_js_open_window(800, 500);
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(_($help_context = "Inventory Location Transfers"), false, false, "", $js);
//-----------------------------------------------------------------------------------------------
check_db_has_costable_items(_("There are no inventory items defined in the system (Purchased or manufactured items)."));
check_db_has_movement_types(_("There are no inventory movement types defined in the system. Please define at least one inventory adjustment type."));
//-----------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $trans_no = $_GET['AddedID'];
    $trans_type = ST_LOCTRANSFER;
    display_notification_centered(_("Inventory transfer has been processed"));
    display_note(get_trans_view_str($trans_type, $trans_no, _("&View this transfer")));
    hyperlink_no_params($_SERVER['PHP_SELF'], _("Enter &Another Inventory Transfer"));
    display_footer_exit();
}
//--------------------------------------------------------------------------------------------------
function line_start_focus()
{
    global $Ajax;
    $Ajax->activate('items_table');
    set_focus('_stock_id_edit');
}
//-----------------------------------------------------------------------------------------------
function handle_new_order()
{
    if (isset($_SESSION['transfer_items'])) {
        $_SESSION['transfer_items']->clear_items();
Пример #22
0
     case 13:
         $edit_page = $path_to_root . '/sales/customer_delivery.php?ModifyDelivery=' . $myrow['trans_no'];
         break;
 }
 $date = sql2date($myrow["tran_date"]);
 if ($myrow["order_"] > 0) {
     $preview_order_str = get_customer_trans_view_str(systypes::sales_order(), $myrow["order_"]);
 } else {
     $preview_order_str = "";
 }
 $gl_trans_str = get_gl_view_str_cell($myrow["type"], $myrow["trans_no"]);
 $branch_name = "";
 if ($myrow["branch_code"] > 0) {
     $branch_name = get_branch_name($myrow["branch_code"]);
 }
 $preview_trans_str = get_trans_view_str($myrow["type"], $myrow["trans_no"]);
 label_cell(systypes::name($myrow["type"]));
 label_cell($preview_trans_str);
 label_cell($preview_order_str);
 label_cell($myrow["reference"]);
 label_cell($date, "nowrap");
 label_cell($due_date_str, "nowrap");
 if ($_POST['customer_id'] == reserved_words::get_all()) {
     label_cell($myrow["CustName"]);
 }
 label_cell($branch_name);
 if ($_POST['customer_id'] == reserved_words::get_all()) {
     label_cell($myrow["CustCurrCode"]);
 }
 display_debit_or_credit_cells($myrow['type'] == 11 || $myrow['type'] == 12 || $myrow['type'] == 2 ? -$myrow["TotalAmount"] : $myrow["TotalAmount"]);
 echo $gl_trans_str;
function view_link($trans)
{
    return get_trans_view_str($trans["type"], $trans["trans_no"]);
}
 function submenu_view($title, $type, $number, $id = null)
 {
     display_note(get_trans_view_str($type, $number, $title, false, 'viewlink', $id), 0, 1);
 }
Пример #25
0
if (isset($_GET['AddedID'])) {
    $dispatch_no = $_GET['AddedID'];
    display_notification_centered(sprintf(_("Delivery # %d has been entered."), $dispatch_no));
    display_note(get_customer_trans_view_str(ST_CUSTDELIVERY, $dispatch_no, _("&View This Delivery")), 0, 1);
    display_note(print_document_link($dispatch_no, _("&Print Delivery Note"), true, ST_CUSTDELIVERY));
    display_note(print_document_link($dispatch_no, _("&Email Delivery Note"), true, ST_CUSTDELIVERY, false, "printlink", "", 1), 1, 1);
    display_note(print_document_link($dispatch_no, _("P&rint as Packing Slip"), true, ST_CUSTDELIVERY, false, "printlink", "", 0, 1));
    display_note(print_document_link($dispatch_no, _("E&mail as Packing Slip"), true, ST_CUSTDELIVERY, false, "printlink", "", 1, 1), 1);
    display_note(get_gl_view_str(13, $dispatch_no, _("View the GL Journal Entries for this Dispatch")), 1);
    hyperlink_params("{$path_to_root}/sales/customer_invoice.php", _("Invoice This Delivery"), "DeliveryNumber={$dispatch_no}");
    hyperlink_params("{$path_to_root}/sales/inquiry/sales_orders_view.php", _("Select Another Order For Dispatch"), "OutstandingOnly=1");
    display_footer_exit();
} elseif (isset($_GET['UpdatedID'])) {
    $delivery_no = $_GET['UpdatedID'];
    display_notification_centered(sprintf(_('Delivery Note # %d has been updated.'), $delivery_no));
    display_note(get_trans_view_str(ST_CUSTDELIVERY, $delivery_no, _("View this delivery")), 0, 1);
    display_note(print_document_link($delivery_no, _("&Print Delivery Note"), true, ST_CUSTDELIVERY));
    display_note(print_document_link($delivery_no, _("&Email Delivery Note"), true, ST_CUSTDELIVERY, false, "printlink", "", 1), 1, 1);
    display_note(print_document_link($delivery_no, _("P&rint as Packing Slip"), true, ST_CUSTDELIVERY, false, "printlink", "", 0, 1));
    display_note(print_document_link($delivery_no, _("E&mail as Packing Slip"), true, ST_CUSTDELIVERY, false, "printlink", "", 1, 1), 1);
    hyperlink_params($path_to_root . "/sales/customer_invoice.php", _("Confirm Delivery and Invoice"), "DeliveryNumber={$delivery_no}");
    hyperlink_params($path_to_root . "/sales/inquiry/sales_deliveries_view.php", _("Select A Different Delivery"), "OutstandingOnly=1");
    display_footer_exit();
}
//-----------------------------------------------------------------------------
if (isset($_GET['OrderNumber']) && $_GET['OrderNumber'] > 0) {
    $ord = new Cart(ST_SALESORDER, $_GET['OrderNumber'], true);
    if ($ord->count_items() == 0) {
        hyperlink_params($path_to_root . "/sales/inquiry/sales_orders_view.php", _("Select a different sales order to delivery"), "OutstandingOnly=1");
        die("<br><b>" . _("This order has no items. There is nothing to delivery.") . "</b>");
    }
Пример #26
0
function trans_view($trans)
{
    return get_trans_view_str($trans["type_no"], $trans["trans_no"]);
}
Пример #27
0
} else {
    page(tr("Purchase Order Entry"), false, false, "", $js);
}
//---------------------------------------------------------------------------------------------------
check_db_has_suppliers(tr("There are no suppliers defined in the system."));
check_db_has_purchasable_items(tr("There are no purchasable inventory items defined in the system."));
//---------------------------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $order_no = $_GET['AddedID'];
    $trans_type = systypes::po();
    if (!isset($_GET['Updated'])) {
        display_notification_centered(tr("Purchase Order has been entered"));
    } else {
        display_notification_centered(tr("Purchase Order has been updated") . " #{$order_no}");
    }
    display_note(get_trans_view_str($trans_type, $order_no, tr("View this order")));
    hyperlink_params($path_to_root . "/purchasing/po_receive_items.php", tr("Receive Items on this Purchase Order"), "PONumber={$order_no}");
    hyperlink_params($_SERVER['PHP_SELF'], tr("Enter Another Purchase Order"), "NewOrder=yes");
    hyperlink_no_params($path_to_root . "/purchasing/inquiry/po_search.php", tr("Select An Outstanding Purchase Order"));
    display_footer_exit();
}
//--------------------------------------------------------------------------------------------------
function copy_to_po()
{
    $_SESSION['PO']->supplier_id = $_POST['supplier_id'];
    $_SESSION['PO']->orig_order_date = $_POST['OrderDate'];
    $_SESSION['PO']->reference = $_POST['ref'];
    $_SESSION['PO']->requisition_no = $_POST['Requisition'];
    $_SESSION['PO']->Comments = $_POST['Comments'];
    $_SESSION['PO']->Location = $_POST['StkLocation'];
    $_SESSION['PO']->delivery_address = $_POST['delivery_address'];
Пример #28
0
    display_note(get_trans_view_str($trans_type, $trans_no, _("&View this GRN")), 0);
    $clearing_act = get_company_pref('grn_clearing_act');
    if ($clearing_act) {
        display_note(get_gl_view_str($trans_type, $trans_no, _("View the GL Journal Entries for this Delivery")), 1);
    }
    // not yet
    //	display_note(print_document_link($trans_no, _("&Print This GRN"), true, $trans_type), 0, 1);
    hyperlink_params("{$path_to_root}/purchasing/supplier_invoice.php", _("Entry purchase &invoice for this receival"), "New=1");
    hyperlink_params("{$path_to_root}/admin/attachments.php", _("Add an Attachment"), "filterType={$trans_type}&trans_no={$trans_no}");
    hyperlink_params($_SERVER['PHP_SELF'], _("Enter &Another GRN"), "NewGRN=Yes");
    display_footer_exit();
} elseif (isset($_GET['AddedPI'])) {
    $trans_no = $_GET['AddedPI'];
    $trans_type = ST_SUPPINVOICE;
    display_notification_centered(_("Direct Purchase Invoice has been entered"));
    display_note(get_trans_view_str($trans_type, $trans_no, _("&View this Invoice")), 0);
    // not yet
    //	display_note(print_document_link($trans_no, _("&Print This Invoice"), true, $trans_type), 0, 1);
    display_note(get_gl_view_str($trans_type, $trans_no, _("View the GL Journal Entries for this Invoice")), 1);
    hyperlink_params("{$path_to_root}/purchasing/supplier_payment.php", _("Entry supplier &payment for this invoice"), "PInvoice=" . $trans_no);
    hyperlink_params("{$path_to_root}/admin/attachments.php", _("Add an Attachment"), "filterType={$trans_type}&trans_no={$trans_no}");
    hyperlink_params($_SERVER['PHP_SELF'], _("Enter &Another Direct Invoice"), "NewInvoice=Yes");
    display_footer_exit();
}
//--------------------------------------------------------------------------------------------------
function line_start_focus()
{
    global $Ajax;
    $Ajax->activate('items_table');
    set_focus('_stock_id_edit');
}
Пример #29
0
if ($use_popup_windows) {
    $js .= get_js_open_window(800, 500);
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(_($help_context = "Item Adjustments Note"), false, false, "", $js);
//-----------------------------------------------------------------------------------------------
check_db_has_costable_items(_("There are no inventory items defined in the system which can be adjusted (Purchased or Manufactured)."));
check_db_has_movement_types(_("There are no inventory movement types defined in the system. Please define at least one inventory adjustment type."));
//-----------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $trans_no = $_GET['AddedID'];
    $trans_type = ST_INVADJUST;
    display_notification_centered(_("Items adjustment has been processed"));
    display_note(get_trans_view_str($trans_type, $trans_no, _("&View this adjustment")));
    display_note(get_gl_view_str($trans_type, $trans_no, _("View the GL &Postings for this Adjustment")), 1, 0);
    hyperlink_no_params($_SERVER['PHP_SELF'], _("Enter &Another Adjustment"));
    hyperlink_params("{$path_to_root}/admin/attachments.php", _("Add an Attachment"), "filterType={$trans_type}&trans_no={$trans_no}");
    display_footer_exit();
}
//--------------------------------------------------------------------------------------------------
function line_start_focus()
{
    global $Ajax;
    $Ajax->activate('items_table');
    set_focus('_stock_id_edit');
}
//-----------------------------------------------------------------------------------------------
function handle_new_order()
{
Пример #30
0
function view_link($row)
{
    return get_trans_view_str($row["type"], $row["type_no"]);
}