Ejemplo n.º 1
0
function can_process()
{
    if (!references::is_valid($_POST['ref'])) {
        display_error(tr("You must enter a reference."));
        set_focus('ref');
        return false;
    }
    if (!is_new_reference($_POST['ref'], systypes::inventory_adjustment())) {
        display_error(tr("The entered reference is already in use."));
        set_focus('ref');
        return false;
    }
    if (!is_date($_POST['AdjDate'])) {
        display_error(tr("The entered date for the adjustment is invalid."));
        set_focus('AdjDate');
        return false;
    } elseif (!is_date_in_fiscalyear($_POST['AdjDate'])) {
        display_error(tr("The entered date is not in fiscal year."));
        set_focus('AdjDate');
        return false;
    }
    $failed_item = $_SESSION['adj_items']->check_qoh($_POST['StockLocation'], $_POST['AdjDate'], !$_POST['Increase']);
    if ($failed_item != null) {
        display_error(tr("The adjustment cannot be processed because an adjustment item would cause a negative inventory balance :") . " " . $failed_item->stock_id . " - " . $failed_item->item_description);
        return false;
    }
    return true;
}
function get_transactions()
{
    $data_after = date2sql($_POST['TransAfterDate']);
    $date_to = date2sql($_POST['TransToDate']);
    $sql = "SELECT debtor_trans.*,\n\t\tdebtors_master.name AS CustName, debtors_master.curr_code AS CustCurrCode,\n    \t(debtor_trans.ov_amount + debtor_trans.ov_gst + " . "debtor_trans.ov_freight + debtor_trans.ov_freight_tax + debtor_trans.ov_discount)\n\t\tAS TotalAmount,\n\t\tdebtor_trans.alloc AS Allocated,\n\t\t((debtor_trans.type = 10)\n\t\tAND debtor_trans.due_date < '" . date2sql(Today()) . "') AS OverDue\n    \tFROM debtor_trans, debtors_master\n    \tWHERE debtors_master.debtor_no = debtor_trans.debtor_no\n\t\t\tAND (debtor_trans.ov_amount + debtor_trans.ov_gst + " . "debtor_trans.ov_freight + debtor_trans.ov_freight_tax + debtor_trans.ov_discount != 0)\n    \t\tAND debtor_trans.tran_date >= '{$data_after}'\n    \t\tAND debtor_trans.tran_date <= '{$date_to}'";
    if ($_POST['customer_id'] != reserved_words::get_all()) {
        $sql .= " AND debtor_trans.debtor_no = '" . $_POST['customer_id'] . "'";
    }
    if (isset($_POST['filterType']) && $_POST['filterType'] != reserved_words::get_all()) {
        if ($_POST['filterType'] == '1' || $_POST['filterType'] == '2') {
            $sql .= " AND debtor_trans.type = 10 ";
        } elseif ($_POST['filterType'] == '3') {
            $sql .= " AND debtor_trans.type = " . systypes::cust_payment();
        } elseif ($_POST['filterType'] == '4') {
            $sql .= " AND debtor_trans.type = 11 ";
        }
        if ($_POST['filterType'] == '2') {
            $today = date2sql(Today());
            $sql .= " AND debtor_trans.due_date < '{$today}'\n\t\t\t\tAND (round(abs(debtor_trans.ov_amount + " . "debtor_trans.ov_gst + debtor_trans.ov_freight + " . "debtor_trans.ov_freight_tax + debtor_trans.ov_discount) - debtor_trans.alloc,6) > 0) ";
        }
    } else {
        $sql .= " AND debtor_trans.type != 13 ";
    }
    if (!check_value('showSettled')) {
        $sql .= " AND (round(abs(debtor_trans.ov_amount + debtor_trans.ov_gst + " . "debtor_trans.ov_freight + debtor_trans.ov_freight_tax + " . "debtor_trans.ov_discount) - debtor_trans.alloc,6) != 0) ";
    }
    $sql .= " ORDER BY debtor_trans.tran_date";
    return db_query($sql, "No transactions were returned");
}
Ejemplo n.º 3
0
function can_process()
{
    global $selected_id;
    if ($selected_id == -1) {
        if (!references::is_valid($_POST['ref'])) {
            display_error(tr("The dimension reference must be entered."));
            set_focus('ref');
            return false;
        }
        if (!is_new_reference($_POST['ref'], systypes::dimension())) {
            display_error(tr("The entered reference is already in use."));
            set_focus('ref');
            return false;
        }
    }
    if (strlen($_POST['name']) == 0) {
        display_error(tr("The dimension name must be entered."));
        set_focus('name');
        return false;
    }
    if (!is_date($_POST['date_'])) {
        display_error(tr("The date entered is in an invalid format."));
        set_focus('date_');
        return false;
    }
    if (!is_date($_POST['due_date'])) {
        display_error(tr("The required by date entered is in an invalid format."));
        set_focus('due_date');
        return false;
    }
    return true;
}
Ejemplo n.º 4
0
function get_transactions()
{
    $date_after = date2sql($_POST['TransAfterDate']);
    $date_to = date2sql($_POST['TransToDate']);
    $sql = "SELECT debtor_trans.*,debtors_master.name AS CustName," . "debtors_master.curr_code AS CustCurrCode," . "(debtor_trans.ov_amount + debtor_trans.ov_gst + " . "debtor_trans.ov_freight + debtor_trans.ov_freight_tax + " . "debtor_trans.ov_discount) AS " . "TotalAmount, debtor_trans.alloc AS Allocated, " . "((debtor_trans.type = 10) " . "AND debtor_trans.due_date < '" . date2sql(Today()) . "') AS OverDue " . "FROM debtor_trans, debtors_master " . "WHERE debtors_master.debtor_no = debtor_trans.debtor_no " . "AND debtor_trans.tran_date >= '{$date_after}' " . "AND debtor_trans.tran_date <= '{$date_to}'";
    if ($_POST['customer_id'] != reserved_words::get_all()) {
        $sql .= " AND debtor_trans.debtor_no = '" . $_POST['customer_id'] . "'";
    }
    if ($_POST['filterType'] != reserved_words::get_all()) {
        if ($_POST['filterType'] == '1') {
            $sql .= " AND (debtor_trans.type = 10 OR debtor_trans.type = 1) ";
        } elseif ($_POST['filterType'] == '2') {
            $sql .= " AND (debtor_trans.type = 10) ";
        } elseif ($_POST['filterType'] == '3') {
            $sql .= " AND (debtor_trans.type = " . systypes::cust_payment() . " OR debtor_trans.type = 2) ";
        } elseif ($_POST['filterType'] == '4') {
            $sql .= " AND debtor_trans.type = 11 ";
        } elseif ($_POST['filterType'] == '5') {
            $sql .= " AND debtor_trans.type = 13 ";
        }
        if ($_POST['filterType'] == '2') {
            $today = date2sql(Today());
            $sql .= " AND debtor_trans.due_date < '{$today}' " . "AND (debtor_trans.ov_amount + debtor_trans.ov_gst + " . "debtor_trans.ov_freight_tax + debtor_trans.ov_freight + " . "debtor_trans.ov_discount - debtor_trans.alloc > 0) ";
        }
    }
    $sql .= " ORDER BY debtor_trans.tran_date DESC,debtor_trans.type," . "debtor_trans.trans_no ";
    return db_query($sql, "No transactions were returned");
}
Ejemplo n.º 5
0
function print_list_of_journal_entries()
{
    global $path_to_root;
    include_once $path_to_root . "reporting/includes/pdf_report.inc";
    $from = $_REQUEST['PARAM_0'];
    $to = $_REQUEST['PARAM_1'];
    $systype = $_REQUEST['PARAM_2'];
    $comments = $_REQUEST['PARAM_3'];
    $dec = user_price_dec();
    $cols = array(0, 100, 240, 300, 400, 460, 520, 580);
    $headers = array(tr('Type/Account'), tr('Account Name'), tr('Date/Dim.'), tr('Person/Item/Memo'), tr('Debit'), tr('Credit'));
    $aligns = array('left', 'left', 'left', 'left', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => tr('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => tr('Type'), 'from' => systypes::name($systype), 'to' => ''));
    $rep = new FrontReport(tr('List of Journal Entries'), "JournalEntries.pdf", user_pagesize());
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->Header();
    if ($systype == -1) {
        $systype = null;
    }
    $trans = get_gl_transactions($from, $to, -1, null, 0, $systype);
    $typeno = 0;
    while ($myrow = db_fetch($trans)) {
        if ($typeno != $myrow['type_no']) {
            if ($typeno != 0) {
                $rep->Line($rep->row + 4);
                $rep->NewLine();
            }
            $typeno = $myrow['type_no'];
            $TransName = systypes::name($myrow['type']);
            $rep->TextCol(0, 2, $TransName . " # " . $myrow['type_no']);
            $rep->TextCol(2, 3, sql2date($myrow['tran_date']));
            $coms = payment_person_types::person_name($myrow["person_type_id"], $myrow["person_id"]);
            $memo = get_comments_string($myrow['type'], $myrow['type_no']);
            if ($memo != '') {
                $coms .= $coms != "" ? "/" : "" . $memo;
            }
            $rep->TextCol(3, 6, $coms);
            $rep->NewLine(2);
        }
        $rep->TextCol(0, 1, $myrow['account']);
        $rep->TextCol(1, 2, $myrow['account_name']);
        $dim_str = get_dimension_string($myrow['dimension_id']);
        $dim_str2 = get_dimension_string($myrow['dimension2_id']);
        if ($dim_str2 != "") {
            $dim_str .= "/" . $dim_str2;
        }
        $rep->TextCol(2, 3, $dim_str);
        $rep->TextCol(3, 4, $myrow['memo_']);
        if ($myrow['amount'] > 0.0) {
            $rep->TextCol(4, 5, number_format2(abs($myrow['amount']), $dec));
        } else {
            $rep->TextCol(5, 6, number_format2(abs($myrow['amount']), $dec));
        }
        $rep->NewLine(1, 2);
    }
    $rep->Line($rep->row + 4);
    $rep->End();
}
Ejemplo n.º 6
0
function can_delete($selected_id)
{
    $sql = "SELECT COUNT(*) FROM stock_moves \n\t\tWHERE type=" . systypes::inventory_adjustment() . " AND person_id={$selected_id}";
    $result = db_query($sql, "could not query stock moves");
    $myrow = db_fetch_row($result);
    if ($myrow[0] > 0) {
        display_error(tr("Cannot delete this inventory movement type because item transactions have been created referring to it."));
        return false;
    }
    return true;
}
Ejemplo n.º 7
0
function display_gl_heading($myrow)
{
    global $table_style;
    $trans_name = systypes::name($_GET['type_id']);
    start_table("{$table_style} width=95%");
    $th = array(tr("General Ledger Transaction Details"), tr("Date"), tr("Person/Item"));
    table_header($th);
    start_row();
    label_cell("{$trans_name} #" . $_GET['trans_no']);
    label_cell(sql2date($myrow["tran_date"]));
    label_cell(payment_person_types::person_name($myrow["person_type_id"], $myrow["person_id"]));
    end_row();
    comments_display_row($_GET['type_id'], $_GET['trans_no']);
    end_table(1);
}
Ejemplo n.º 8
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."));
}
Ejemplo n.º 9
0
function display_wo_issue($issue_no)
{
    global $table_style;
    $myrow = get_work_order_issue($issue_no);
    start_table($table_style);
    $th = array(tr("Issue #"), tr("Reference"), tr("For Work Order #"), tr("Item"), tr("From Location"), tr("To Work Centre"), tr("Date of Issue"));
    table_header($th);
    start_row();
    label_cell($myrow["issue_no"]);
    label_cell($myrow["reference"]);
    label_cell(get_trans_view_str(systypes::work_order(), $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, tr("This issue has been voided."));
}
Ejemplo n.º 10
0
 $row = db_fetch_row($res);
 if ($k == 1) {
     $row_text = "class='oddrow'";
     $k = 0;
 } else {
     $row_text = "class='evenrow'";
     $k++;
 }
 // check if it's an overdue work order
 if (date_diff(Today(), sql2date($myrow["due_date"]), "d") > 0) {
     $row_text = "class='overduebg'";
 }
 start_row($row_text);
 $mpage = $path_to_root . "/dimensions/dimension_entry.php?" . SID . "trans_no=" . $myrow["id"];
 label_cell(get_dimensions_trans_view_str(systypes::dimension(), $myrow["id"]));
 label_cell(get_dimensions_trans_view_str(systypes::dimension(), $myrow["id"], $myrow["reference"]));
 label_cell($myrow["name"]);
 label_cell($myrow["type_"]);
 label_cell(sql2date($myrow["date_"]));
 label_cell(sql2date($myrow["due_date"]));
 if (!$outstanding_only) {
     label_cell($myrow["closed"] ? tr("Yes") : tr("No"));
 }
 amount_cell($row[0]);
 if ($myrow["closed"] == 0) {
     label_cell("<a href='{$mpage}'>" . tr("Edit") . "</a>");
 }
 end_row();
 $j++;
 if ($j == 12) {
     $j = 1;
Ejemplo n.º 11
0
start_row();
label_cells(tr("Item"), $from_trans['stock_id'] . " - " . $from_trans['description'], "class='tableheader2'");
label_cells(tr("From Location"), $from_trans['location_name'], "class='tableheader2'");
label_cells(tr("To Location"), $to_trans['location_name'], "class='tableheader2'");
end_row();
start_row();
label_cells(tr("Reference"), $from_trans['reference'], "class='tableheader2'");
$adjustment_type = get_movement_type($from_trans['person_id']);
label_cells(tr("Adjustment Type"), $adjustment_type['name'], "class='tableheader2'");
label_cells(tr("Date"), sql2date($from_trans['tran_date']), "class='tableheader2'");
end_row();
comments_display_row(systypes::location_transfer(), $trans_no);
end_table(1);
echo "<br>";
start_table("{$table_style} width=90%");
$th = array(tr("Item"), tr("Description"), tr("Quantity"), tr("Units"));
table_header($th);
$transfer_items = get_stock_moves(systypes::location_transfer(), $trans_no);
while ($item = db_fetch($transfer_items)) {
    if ($item['loc_code'] == $to_trans['loc_code']) {
        alt_table_row_color($k);
        label_cell($item['stock_id']);
        label_cell($item['description']);
        qty_cell($item['qty']);
        label_cell($item['units']);
        end_row();
    }
}
end_table(1);
is_voided_display(systypes::location_transfer(), $trans_no, tr("This transfer has been voided."));
end_page(true);
Ejemplo n.º 12
0
//-----------------------------------------------------------------------------------------------
if (isset($_POST['Process'])) {
    $input_error = 0;
    if (!is_date($_POST['date_'])) {
        display_error(tr("The entered date is invalid."));
        set_focus('date_');
        $input_error = 1;
    } elseif (!is_date_in_fiscalyear($_POST['date_'])) {
        display_error(tr("The entered date is not in fiscal year."));
        set_focus('date_');
        $input_error = 1;
    } elseif (!references::is_valid($_POST['ref'])) {
        display_error(tr("You must enter a reference."));
        set_focus('ref');
        $input_error = 1;
    } elseif (references::exists(systypes::journal_entry(), $_POST['ref'])) {
        display_error(tr("The entered reference is already in use."));
        set_focus('ref');
        $input_error = 1;
    }
    if ($input_error == 1) {
        unset($_POST['Process']);
    }
}
if (isset($_POST['Process'])) {
    $trans_no = add_journal_entries($_SESSION['journal_items']->gl_items, $_POST['date_'], $_POST['ref'], check_value('Reverse'), $_POST['memo_']);
    $_SESSION['journal_items']->clear_items();
    unset($_SESSION['journal_items']);
    meta_forward($_SERVER['PHP_SELF'], "AddedID={$trans_no}");
}
/*end of process credit note */
Ejemplo n.º 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();
}
Ejemplo n.º 14
0
function print_GL_transactions()
{
    global $path_to_root;
    include_once $path_to_root . "reporting/includes/pdf_report.inc";
    $rep = new FrontReport(tr('GL Account Transactions'), "GLAccountTransactions.pdf", user_pagesize());
    $dim = get_company_pref('use_dimension');
    $dimension = $dimension2 = 0;
    $from = $_REQUEST['PARAM_0'];
    $to = $_REQUEST['PARAM_1'];
    $fromacc = $_REQUEST['PARAM_2'];
    $toacc = $_REQUEST['PARAM_3'];
    if ($dim == 2) {
        $dimension = $_REQUEST['PARAM_4'];
        $dimension2 = $_REQUEST['PARAM_5'];
        $comments = $_REQUEST['PARAM_6'];
    } else {
        if ($dim == 1) {
            $dimension = $_REQUEST['PARAM_4'];
            $comments = $_REQUEST['PARAM_5'];
        } else {
            $comments = $_REQUEST['PARAM_4'];
        }
    }
    $dec = user_price_dec();
    $cols = array(0, 70, 90, 140, 210, 280, 340, 400, 450, 510, 570);
    //------------0--1---2---3----4----5----6----7----8----9----10-------
    //-----------------------dim1-dim2-----------------------------------
    //-----------------------dim1----------------------------------------
    //-------------------------------------------------------------------
    $aligns = array('left', 'left', 'left', 'left', 'left', 'left', 'right', 'right', 'right');
    if ($dim == 2) {
        $headers = array(tr('Type'), tr('#'), tr('Date'), tr('Dimension') . " 1", tr('Dimension') . " 2", tr('Person/Item'), tr('Debit'), tr('Credit'), tr('Balance'));
    } else {
        if ($dim == 1) {
            $headers = array(tr('Type'), tr('#'), tr('Date'), tr('Dimension'), "", tr('Person/Item'), tr('Debit'), tr('Credit'), tr('Balance'));
        } else {
            $headers = array(tr('Type'), tr('#'), tr('Date'), "", "", tr('Person/Item'), tr('Debit'), tr('Credit'), tr('Balance'));
        }
    }
    if ($dim == 2) {
        $params = array(0 => $comments, 1 => array('text' => tr('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => tr('Accounts'), 'from' => $fromacc, 'to' => $toacc), 3 => array('text' => tr('Dimension') . " 1", 'from' => get_dimension_string($dimension), 'to' => ''), 4 => array('text' => tr('Dimension') . " 2", 'from' => get_dimension_string($dimension2), 'to' => ''));
    } else {
        if ($dim == 1) {
            $params = array(0 => $comments, 1 => array('text' => tr('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => tr('Accounts'), 'from' => $fromacc, 'to' => $toacc), 3 => array('text' => tr('Dimension'), 'from' => get_dimension_string($dimension), 'to' => ''));
        } else {
            $params = array(0 => $comments, 1 => array('text' => tr('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => tr('Accounts'), 'from' => $fromacc, 'to' => $toacc));
        }
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->Header();
    $accounts = get_gl_accounts($fromacc, $toacc);
    while ($account = db_fetch($accounts)) {
        if (is_account_balancesheet($account["account_code"])) {
            $begin = "";
        } else {
            if ($from < $begin) {
                $begin = add_days($from, -1);
            } else {
                $begin = add_days(begin_fiscalyear(), -1);
            }
        }
        $prev_balance = get_gl_balance_from_to($begin, $from, $account["account_code"], $dimension, $dimension2);
        $trans = get_gl_transactions($from, $to, -1, $account['account_code'], $dimension, $dimension2);
        $rows = db_num_rows($trans);
        if ($prev_balance == 0.0 && $rows == 0) {
            continue;
        }
        $rep->Font('bold');
        $rep->TextCol(0, 3, $account['account_code'] . " " . $account['account_name']);
        $rep->TextCol(3, 5, tr('Opening Balance'));
        if ($prev_balance > 0.0) {
            $rep->TextCol(6, 7, number_format2(abs($prev_balance), $dec));
        } else {
            $rep->TextCol(7, 8, number_format2(abs($prev_balance), $dec));
        }
        $rep->Font();
        $total = $prev_balance;
        $rep->NewLine(2);
        if ($rows > 0) {
            while ($myrow = db_fetch($trans)) {
                $total += $myrow['amount'];
                $rep->TextCol(0, 1, systypes::name($myrow["type"]));
                $rep->TextCol(1, 2, $myrow['type_no']);
                $rep->TextCol(2, 3, sql2date($myrow["tran_date"]));
                if ($dim >= 1) {
                    $rep->TextCol(3, 4, get_dimension_string($myrow['dimension_id']));
                }
                if ($dim > 1) {
                    $rep->TextCol(4, 5, get_dimension_string($myrow['dimension2_id']));
                }
                $rep->TextCol(5, 6, payment_person_types::person_name($myrow["person_type_id"], $myrow["person_id"], false));
                if ($myrow['amount'] > 0.0) {
                    $rep->TextCol(6, 7, number_format2(abs($myrow['amount']), $dec));
                } else {
                    $rep->TextCol(7, 8, number_format2(abs($myrow['amount']), $dec));
                }
                $rep->TextCol(8, 9, number_format2($total, $dec));
                $rep->NewLine();
                if ($rep->row < $rep->bottomMargin + $rep->lineHeight) {
                    $rep->Line($rep->row - 2);
                    $rep->Header();
                }
            }
            $rep->NewLine();
        }
        $rep->Font('bold');
        $rep->TextCol(3, 5, tr("Ending Balance"));
        if ($total > 0.0) {
            $rep->TextCol(6, 7, number_format2(abs($total), $dec));
        } else {
            $rep->TextCol(7, 8, number_format2(abs($total), $dec));
        }
        $rep->Font();
        $rep->Line($rep->row - $rep->lineHeight + 4);
        $rep->NewLine(2, 1);
    }
    $rep->End();
}
Ejemplo n.º 15
0
    label_cells(tr("Currency"), $from_trans['bank_curr_code'], "class='tableheader2'");
}
label_cells(tr("Amount"), number_format2(-$from_trans['amount'], user_price_dec()), "class='tableheader2'", "align=right");
label_cells(tr("Date"), sql2date($from_trans['trans_date']), "class='tableheader2'");
end_row();
start_row();
label_cells(tr("Pay To"), payment_person_types::person_name($from_trans['person_type_id'], $from_trans['person_id']), "class='tableheader2'", "colspan={$colspan1}");
label_cells(tr("Payment Type"), $from_trans['BankTransType'], "class='tableheader2'");
end_row();
start_row();
label_cells(tr("Reference"), $from_trans['ref'], "class='tableheader2'", "colspan={$colspan2}");
end_row();
comments_display_row(systypes::bank_payment(), $trans_no);
end_table(1);
$voided = is_voided_display(systypes::bank_payment(), $trans_no, tr("This payment has been voided."));
$items = get_gl_trans(systypes::bank_payment(), $trans_no);
if (db_num_rows($items) == 0) {
    echo "<br>" . tr("There are no items for this payment.");
} else {
    display_heading2(tr("Items for this Payment"));
    if ($show_currencies) {
        display_heading2(tr("Item Amounts are Shown in :") . " " . $company_currency);
    }
    echo "<br>";
    start_table("{$table_style} width=80%");
    $th = array(tr("Account Code"), tr("Account Description"), tr("Amount"), tr("Memo"));
    table_header($th);
    $k = 0;
    //row colour counter
    $totalAmount = 0;
    while ($item = db_fetch($items)) {
Ejemplo n.º 16
0
    session_register("transfer_items");
    $_SESSION['transfer_items'] = new items_cart();
    $_POST['AdjDate'] = Today();
    if (!is_date_in_fiscalyear($_POST['AdjDate'])) {
        $_POST['AdjDate'] = end_fiscalyear();
    }
    $_SESSION['transfer_items']->tran_date = $_POST['AdjDate'];
}
//-----------------------------------------------------------------------------------------------
if (isset($_POST['Process'])) {
    $input_error = 0;
    if (!references::is_valid($_POST['ref'])) {
        display_error(tr("You must enter a reference."));
        set_focus('ref');
        $input_error = 1;
    } elseif (!is_new_reference($_POST['ref'], systypes::location_transfer())) {
        display_error(tr("The entered reference is already in use."));
        set_focus('ref');
        $input_error = 1;
    } elseif (!is_date($_POST['AdjDate'])) {
        display_error(tr("The entered date for the adjustment is invalid."));
        set_focus('AdjDate');
        $input_error = 1;
    } elseif (!is_date_in_fiscalyear($_POST['AdjDate'])) {
        display_error(tr("The entered date is not in fiscal year."));
        set_focus('AdjDate');
        $input_error = 1;
    } elseif ($_POST['FromStockLocation'] == $_POST['ToStockLocation']) {
        display_error(tr("The locations to transfer from and to must be different."));
        set_focus('FromStockLocation');
        $input_error = 1;
Ejemplo n.º 17
0
include_once $path_to_root . "/dimensions/includes/dimensions_db.inc";
include_once $path_to_root . "/dimensions/includes/dimensions_ui.inc";
//-------------------------------------------------------------------------------------------------
if ($_GET['trans_no'] != "") {
    $id = $_GET['trans_no'];
}
display_heading(systypes::name(systypes::dimension()) . " # " . $id);
$myrow = get_dimension($id);
if (strlen($myrow[0]) == 0) {
    echo tr("The work order number sent is not valid.");
    exit;
}
start_table($table_style);
$th = array(tr("#"), tr("Reference"), tr("Name"), tr("Type"), tr("Date"), tr("Due Date"));
table_header($th);
start_row();
label_cell($myrow["id"]);
label_cell($myrow["reference"]);
label_cell($myrow["name"]);
label_cell($myrow["type_"]);
label_cell(sql2date($myrow["date_"]));
label_cell(sql2date($myrow["due_date"]));
end_row();
comments_display_row(systypes::dimension(), $id);
end_table();
if ($myrow["closed"] == true) {
    echo "<br>" . tr("This dimension is closed.") . "<br>";
}
display_dimension_payments($id);
br(1);
end_page(true);
Ejemplo n.º 18
0
function can_commit()
{
    if (!is_date($_POST['OrderDate'])) {
        display_error(tr("The entered order date is invalid."));
        set_focus('OrderDate');
        return false;
    }
    if (!$_SESSION['PO']->order_no) {
        if (!references::is_valid($_SESSION['PO']->reference)) {
            display_error(tr("There is no reference entered for this purchase order."));
            set_focus('ref');
            return false;
        }
        if (!is_new_reference($_SESSION['PO']->reference, systypes::po())) {
            display_error(tr("The entered reference is already in use."));
            set_focus('ref');
            return false;
        }
    }
    if ($_SESSION['PO']->delivery_address == "") {
        display_error(tr("There is no delivery address specified."));
        set_focus('delivery_address');
        return false;
    }
    if (!isset($_SESSION['PO']->Location) || $_SESSION['PO']->Location == "") {
        display_error(tr("There is no location specified to move any items into."));
        set_focus('StkLocation');
        return false;
    }
    if ($_SESSION['PO']->order_has_items() == false) {
        display_error(tr("The order cannot be placed because there are no lines entered on this order."));
        return false;
    }
    return true;
}
Ejemplo n.º 19
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);
Ejemplo n.º 20
0
$myrow = get_work_order($woid);
if ($myrow["type"] == wo_types::advanced()) {
    display_wo_details($woid, true);
} else {
    display_wo_details_quick($woid, true);
}
echo "<center>";
// display the WO requirements
echo "<br>";
if ($myrow["released"] == false) {
    display_heading2(tr("BOM for item:") . " " . $myrow["StockItemName"]);
    display_bom($myrow["stock_id"]);
} else {
    display_heading2(tr("Work Order Requirements"));
    display_wo_requirements($woid, $myrow["units_reqd"]);
    if ($myrow["type"] == wo_types::advanced()) {
        echo "<br><table cellspacing=7><tr valign=top><td>";
        display_heading2(tr("Issues"));
        display_wo_issues($woid);
        echo "</td><td>";
        display_heading2(tr("Productions"));
        display_wo_productions($woid);
        echo "</td><td>";
        display_heading2(tr("Payments"));
        display_wo_payments($woid);
        echo "</td></tr></table>";
    }
}
echo "<br>";
is_voided_display(systypes::work_order(), $woid, tr("This work order has been voided."));
end_page(true);
Ejemplo n.º 21
0
$k = 0;
$header_shown = false;
while ($adjustment = db_fetch($adjustment_items)) {
    if (!$header_shown) {
        $adjustment_type = get_movement_type($adjustment['person_id']);
        start_table("{$table_style2} width=90%");
        start_row();
        label_cells(tr("At Location"), $adjustment['location_name'], "class='tableheader2'");
        label_cells(tr("Reference"), $adjustment['reference'], "class='tableheader2'", "colspan=6");
        label_cells(tr("Date"), sql2date($adjustment['tran_date']), "class='tableheader2'");
        label_cells(tr("Adjustment Type"), $adjustment_type['name'], "class='tableheader2'");
        end_row();
        comments_display_row(systypes::inventory_adjustment(), $trans_no);
        end_table();
        $header_shown = true;
        echo "<br>";
        start_table("{$table_style} width=90%");
        $th = array(tr("Item"), tr("Description"), tr("Quantity"), tr("Units"), tr("Unit Cost"));
        table_header($th);
    }
    alt_table_row_color($k);
    label_cell($adjustment['stock_id']);
    label_cell($adjustment['description']);
    qty_cell($adjustment['qty']);
    label_cell($adjustment['units']);
    amount_cell($adjustment['standard_cost']);
    end_row();
}
end_table(1);
is_voided_display(systypes::inventory_adjustment(), $trans_no, tr("This adjustment has been voided."));
end_page(true);
Ejemplo n.º 22
0
function check_valid_entries()
{
    if (!is_date($_POST['DatePaid'])) {
        display_error(tr("The entered date is invalid."));
        set_focus('DatePaid');
        return false;
    }
    if (!is_date_in_fiscalyear($_POST['DatePaid'])) {
        display_error(tr("The entered date is not in fiscal year."));
        set_focus('DatePaid');
        return false;
    }
    if (!check_num('amount', 0)) {
        display_error(tr("The entered amount is invalid or less than zero."));
        set_focus('amount');
        return false;
    }
    if (!references::is_valid($_POST['ref'])) {
        display_error(tr("You must enter a reference."));
        set_focus('ref');
        return false;
    }
    if (!is_new_reference($_POST['ref'], systypes::bank_transfer())) {
        display_error(tr("The entered reference is already in use."));
        set_focus('ref');
        return false;
    }
    if ($_POST['FromBankAccount'] == $_POST['ToBankAccount']) {
        display_error(tr("The source and destination bank accouts cannot be the same."));
        set_focus('ToBankAccount');
        return false;
    }
    return true;
}
Ejemplo n.º 23
0
}
table_header($th);
$j = 1;
$k = 0;
//row colour counter
$over_due = false;
while ($myrow = db_fetch($result)) {
    if ($myrow['OverDue'] == 1) {
        start_row("class='overduebg'");
        $over_due = true;
    } else {
        alt_table_row_color($k);
    }
    $date = sql2date($myrow["tran_date"]);
    $duedate = $myrow["type"] == 20 || $myrow["type"] == 21 ? sql2date($myrow["due_date"]) : "";
    label_cell(systypes::name($myrow["type"]));
    label_cell(get_trans_view_str($myrow["type"], $myrow["trans_no"]));
    label_cell(get_trans_view_str($myrow["type"], $myrow["trans_no"], $myrow["reference"]));
    if ($_POST['supplier_id'] == reserved_words::get_all()) {
        label_cell($myrow["supp_name"]);
    }
    label_cell($myrow["supp_reference"]);
    label_cell($date);
    label_cell($duedate);
    if ($_POST['supplier_id'] == reserved_words::get_all()) {
        label_cell($myrow["curr_code"]);
    }
    if ($myrow["TotalAmount"] >= 0) {
        label_cell("");
    }
    amount_cell(abs($myrow["TotalAmount"]));
Ejemplo n.º 24
0
function show_results()
{
    global $path_to_root, $table_style;
    if (!isset($_POST["account"]) || $_POST["account"] == "") {
        return;
    }
    $act_name = get_gl_account_name($_POST["account"]);
    $dim = get_company_pref('use_dimension');
    /*Now get the transactions  */
    if (!isset($_POST['Dimension'])) {
        $_POST['Dimension'] = 0;
    }
    if (!isset($_POST['Dimension2'])) {
        $_POST['Dimension2'] = 0;
    }
    $result = get_gl_transactions($_POST['TransFromDate'], $_POST['TransToDate'], -1, $_POST["account"], $_POST['Dimension'], $_POST['Dimension2']);
    $colspan = $dim == 2 ? "6" : ($dim == 1 ? "5" : "4");
    //echo "\nDimension =". $_POST['Dimension'];
    display_heading($_POST["account"] . "&nbsp;&nbsp;&nbsp;" . $act_name);
    start_table($table_style);
    if ($dim == 2) {
        $th = array(tr("Type"), tr("#"), tr("Date"), tr("Dimension") . " 1", tr("Dimension") . " 2", tr("Person/Item"), tr("Debit"), tr("Credit"), tr("Balance"), tr("Memo"));
    } else {
        if ($dim == 1) {
            $th = array(tr("Type"), tr("#"), tr("Date"), tr("Dimension"), tr("Person/Item"), tr("Debit"), tr("Credit"), tr("Balance"), tr("Memo"));
        } else {
            $th = array(tr("Type"), tr("#"), tr("Date"), tr("Person/Item"), tr("Debit"), tr("Credit"), tr("Balance"), tr("Memo"));
        }
    }
    table_header($th);
    if (is_account_balancesheet($_POST["account"])) {
        $begin = "";
    } else {
        $begin = begin_fiscalyear();
        if ($_POST['TransFromDate'] < $begin) {
            $begin = $_POST['TransFromDate'];
        }
        $begin = add_days($begin, -1);
    }
    $bfw = get_gl_balance_from_to($begin, $_POST['TransFromDate'], $_POST["account"], $_POST['Dimension'], $_POST['Dimension2']);
    start_row("class='inquirybg'");
    label_cell("<b>" . tr("Opening Balance") . " - " . $_POST['TransFromDate'] . "</b>", "colspan={$colspan}");
    display_debit_or_credit_cells($bfw);
    label_cell("");
    end_row();
    //$running_total =0;
    $running_total = $bfw;
    $j = 1;
    $k = 0;
    //row colour counter
    while ($myrow = db_fetch($result)) {
        alt_table_row_color($k);
        $running_total += $myrow["amount"];
        $trandate = sql2date($myrow["tran_date"]);
        label_cell(systypes::name($myrow["type"]));
        label_cell(get_gl_view_str($myrow["type"], $myrow["type_no"], $myrow["type_no"], true));
        label_cell($trandate);
        if ($dim >= 1) {
            label_cell(get_dimension_string($myrow['dimension_id'], true));
        }
        if ($dim > 1) {
            label_cell(get_dimension_string($myrow['dimension2_id'], true));
        }
        label_cell(payment_person_types::person_name($myrow["person_type_id"], $myrow["person_id"]));
        display_debit_or_credit_cells($myrow["amount"]);
        amount_cell($running_total);
        label_cell($myrow['memo_']);
        end_row();
        $j++;
        if ($j == 12) {
            $j = 1;
            table_header($th);
        }
    }
    //end of while loop
    start_row("class='inquirybg'");
    label_cell("<b>" . tr("Ending Balance") . " - " . $_POST['TransToDate'] . "</b>", "colspan={$colspan}");
    display_debit_or_credit_cells($running_total);
    label_cell("");
    end_row();
    end_table(2);
    if (db_num_rows($result) == 0) {
        display_note(tr("No general ledger transactions have been created for this account on the selected dates."), 0, 1);
    }
}
Ejemplo n.º 25
0
include_once $path_to_root . "/includes/date_functions.inc";
include_once $path_to_root . "/includes/ui.inc";
include_once $path_to_root . "/sales/includes/sales_db.inc";
if (isset($_GET["trans_no"])) {
    $trans_id = $_GET["trans_no"];
}
$receipt = get_customer_trans($trans_id, systypes::cust_payment());
display_heading(sprintf(tr("Customer Payment #%d"), $trans_id));
echo "<br>";
start_table("{$table_style} width=80%");
start_row();
label_cells(tr("From Customer"), $receipt['DebtorName'], "class='tableheader2'");
label_cells(tr("Into Bank Account"), $receipt['bank_account_name'], "class='tableheader2'");
label_cells(tr("Date of Deposit"), sql2date($receipt['tran_date']), "class='tableheader2'");
end_row();
start_row();
label_cells(tr("Payment Currency"), $receipt['curr_code'], "class='tableheader2'");
label_cells(tr("Amount"), price_format($receipt['ov_amount']), "class='tableheader2'");
label_cells(tr("Discount"), price_format($receipt['ov_discount']), "class='tableheader2'");
end_row();
start_row();
label_cells(tr("Payment Type"), $receipt['BankTransType'], "class='tableheader2'");
label_cells(tr("Reference"), $receipt['reference'], "class='tableheader2'", "colspan=4");
end_row();
comments_display_row(systypes::cust_payment(), $trans_id);
end_table(1);
$voided = is_voided_display(systypes::cust_payment(), $trans_id, tr("This customer payment has been voided."));
if (!$voided) {
    display_allocations_from(payment_person_types::customer(), $receipt['debtor_no'], systypes::cust_payment(), $trans_id, -$receipt['Total']);
}
end_page(true);
Ejemplo n.º 26
0
<?php

$page_security = 10;
$path_to_root = "..";
include $path_to_root . "/includes/session.inc";
page(tr("Forms Setup"));
include $path_to_root . "/includes/ui.inc";
//-------------------------------------------------------------------------------------------------
if (isset($_POST['setprefs'])) {
    $systypes = get_systypes();
    begin_transaction();
    while ($type = db_fetch($systypes)) {
        save_next_reference($type["type_id"], $_POST['id' . $type["type_id"]]);
    }
    commit_transaction();
    display_notification_centered(tr("Forms settings have been updated."));
}
start_form();
start_table("class='tablestyle'");
$systypes = get_systypes();
$th = array(tr("Form"), tr("Next Reference"));
table_header($th);
while ($type = db_fetch($systypes)) {
    ref_row(systypes::name($type["type_id"]), 'id' . $type["type_id"], $type["next_reference"]);
}
end_table(1);
submit_center('setprefs', tr("Update"));
end_form(2);
//-------------------------------------------------------------------------------------------------
end_page();
Ejemplo n.º 27
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();
}
Ejemplo n.º 28
0
    session_register("deposit_items");
    $_SESSION['deposit_items'] = new items_cart();
    $_POST['date_'] = Today();
    if (!is_date_in_fiscalyear($_POST['date_'])) {
        $_POST['date_'] = end_fiscalyear();
    }
    $_SESSION['deposit_items']->tran_date = $_POST['date_'];
}
//-----------------------------------------------------------------------------------------------
if (isset($_POST['Process'])) {
    $input_error = 0;
    if (!references::is_valid($_POST['ref'])) {
        display_error(tr("You must enter a reference."));
        set_focus('ref');
        $input_error = 1;
    } elseif (!is_new_reference($_POST['ref'], systypes::bank_deposit())) {
        display_error(tr("The entered reference is already in use."));
        set_focus('ref');
        $input_error = 1;
    }
    if (!is_date($_POST['date_'])) {
        display_error(tr("The entered date for the deposit is invalid."));
        set_focus('date_');
        $input_error = 1;
    }
    if (!is_date_in_fiscalyear($_POST['date_'])) {
        display_error(tr("The entered date is not in fiscal year."));
        set_focus('date_');
        $input_error = 1;
    }
    if ($input_error == 1) {
Ejemplo n.º 29
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();
}
Ejemplo n.º 30
0
        if (strlen($cust_row['name']) > 0) {
            $person = $cust_row['name'] . " (" . $cust_row['br_name'] . ")";
        }
    } elseif ($myrow["type"] == 25) {
        // get the supplier name
        $sql = "SELECT supp_name FROM suppliers WHERE supplier_id = '" . $myrow["person_id"] . "'";
        $supp_result = db_query($sql, "check failed");
        $supp_row = db_fetch($supp_result);
        if (strlen($supp_row['supp_name']) > 0) {
            $person = $supp_row['supp_name'];
        }
    } elseif ($myrow["type"] == systypes::location_transfer() || $myrow["type"] == systypes::inventory_adjustment()) {
        // get the adjustment type
        $movement_type = get_movement_type($myrow["person_id"]);
        $person = $movement_type["name"];
    } elseif ($myrow["type"] == systypes::work_order() || $myrow["type"] == 28 || $myrow["type"] == 29) {
        $person = "";
    }
    label_cell($person);
    label_cell($myrow["qty"] >= 0 ? $quantity_formatted : "", "nowrap align=right");
    label_cell($myrow["qty"] < 0 ? $quantity_formatted : "", "nowrap align=right");
    label_cell(number_format2($after_qty, user_qty_dec()), "nowrap align=right");
    end_row();
    $j++;
    if ($j == 12) {
        $j = 1;
        table_header($th);
    }
    //end of page full new headings if
}
//end of while loop