Example #1
0
function display_wo_issue_details($issue_no)
{
    $result = get_work_order_issue_details($issue_no);
    if (db_num_rows($result) == 0) {
        display_note(_("There are no items for this issue."));
    } else {
        start_table(TABLESTYLE);
        $th = array(_("Component"), _("Quantity"), _("Units"));
        table_header($th);
        $j = 1;
        $k = 0;
        //row colour counter
        $total_cost = 0;
        while ($myrow = db_fetch($result)) {
            alt_table_row_color($k);
            label_cell($myrow["stock_id"] . " - " . $myrow["description"]);
            qty_cell($myrow["qty_issued"], false, get_qty_dec($myrow["stock_id"]));
            label_cell($myrow["units"]);
            end_row();
            $j++;
            if ($j == 12) {
                $j = 1;
                table_header($th);
            }
            //end of page full new headings if
        }
        //end of while
        end_table();
    }
}
Example #2
0
function display_customer_summary($customer_record)
{
    global $table_style;
    $past1 = get_company_pref('past_due_days');
    $past2 = 2 * $past1;
    if ($customer_record["dissallow_invoices"] != 0) {
        echo "<center><font color=red size=4><b>" . tr("CUSTOMER ACCOUNT IS ON HOLD") . "</font></b></center>";
    }
    $nowdue = "1-" . $past1 . " " . tr('Days');
    $pastdue1 = $past1 + 1 . "-" . $past2 . " " . tr('Days');
    $pastdue2 = tr('Over') . " " . $past2 . " " . tr('Days');
    start_table("width=80% {$table_style}");
    $th = array(tr("Currency"), tr("Terms"), tr("Current"), $nowdue, $pastdue1, $pastdue2, tr("Total Balance"));
    table_header($th);
    start_row();
    label_cell($customer_record["curr_code"]);
    label_cell($customer_record["terms"]);
    amount_cell($customer_record["Balance"] - $customer_record["Due"]);
    amount_cell($customer_record["Due"] - $customer_record["Overdue1"]);
    amount_cell($customer_record["Overdue1"] - $customer_record["Overdue2"]);
    amount_cell($customer_record["Overdue2"]);
    amount_cell($customer_record["Balance"]);
    end_row();
    end_table();
}
Example #3
0
 function render($id, $title)
 {
     global $path_to_root;
     include_once $path_to_root . "/includes/ui.inc";
     $today = date2sql(Today());
     $sql = "SELECT bank_act, bank_account_name, SUM(amount) balance FROM " . TB_PREF . "bank_trans bt" . " INNER JOIN " . TB_PREF . "bank_accounts ba ON bt.bank_act = ba.id" . " WHERE trans_date < '{$today}'" . " AND inactive <> 1";
     if ($this->data_filter != '') {
         $sql .= ' AND ' . $this->data_filter;
     }
     $sql .= " GROUP BY bank_act, bank_account_name" . " ORDER BY bank_account_name";
     $result = db_query($sql);
     br();
     $th = array(_("Account"), _("Balance"));
     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($myrow["bank_account_name"]);
         amount_cell($myrow['balance']);
         end_row();
     }
     end_table(1);
 }
Example #4
0
function display_trial_balance()
{
    global $table_style, $path_to_root;
    start_table($table_style);
    $tableheader = "<tr>\n        <td rowspan=2 class='tableheader'>" . tr("Account") . "</td>\n        <td rowspan=2 class='tableheader'>" . tr("Account Name") . "</td>\n\t\t<td colspan=2 class='tableheader'>" . tr("Brought Forward") . "</td>\n\t\t<td colspan=2 class='tableheader'>" . tr("This Period") . "</td>\n\t\t<td colspan=2 class='tableheader'>" . tr("Balance") . "</td>\n\t\t</tr><tr>\n\t\t<td class='tableheader'>" . tr("Debit") . "</td>\n        <td class='tableheader'>" . tr("Credit") . "</td>\n\t\t<td class='tableheader'>" . tr("Debit") . "</td>\n\t\t<td class='tableheader'>" . tr("Credit") . "</td>\n        <td class='tableheader'>" . tr("Debit") . "</td>\n        <td class='tableheader'>" . tr("Credit") . "</td>\n        </tr>";
    echo $tableheader;
    $k = 0;
    $accounts = get_gl_accounts();
    while ($account = db_fetch($accounts)) {
        if (is_account_balancesheet($account["account_code"])) {
            $begin = null;
        } else {
            $begin = begin_fiscalyear();
            if ($_POST['TransFromDate'] < $begin) {
                $begin = $_POST['TransFromDate'];
            }
            $begin = add_days($begin, -1);
        }
        $prev_balance = get_balance($account["account_code"], $begin, $_POST['TransFromDate'], false, false);
        $curr_balance = get_balance($account["account_code"], $_POST['TransFromDate'], $_POST['TransToDate']);
        if (check_value("NoZero") && !$prev_balance && !$curr_balance) {
            continue;
        }
        alt_table_row_color($k);
        $url = "<a href='{$path_to_root}/gl/inquiry/gl_account_inquiry.php?" . SID . "TransFromDate=" . $_POST["TransFromDate"] . "&TransToDate=" . $_POST["TransToDate"] . "&account=" . $account["account_code"] . "'>" . $account["account_code"] . "</a>";
        label_cell($url);
        label_cell($account["account_name"]);
        display_debit_or_credit_cells($prev_balance);
        display_debit_or_credit_cells($curr_balance);
        display_debit_or_credit_cells($prev_balance + $curr_balance);
        end_row();
    }
    end_table(1);
}
 function render($id, $title)
 {
     global $path_to_root;
     include_once $path_to_root . "/includes/ui.inc";
     include_once $path_to_root . "/reporting/includes/class.graphic.inc";
     if (!defined('FLOAT_COMP_DELTA')) {
         define('FLOAT_COMP_DELTA', 0.004);
     }
     if (!isset($this->top)) {
         $this->top = 10;
     }
     $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            " . TB_PREF . "supp_trans AS trans, " . TB_PREF . "suppliers AS s WHERE trans.supplier_id=s.supplier_id\n            AND (trans.type = " . ST_SUPPINVOICE . " OR trans.type = " . ST_SUPPCREDIT . ")\n            AND tran_date >= '{$begin1}' AND tran_date <= '{$today1}' ";
     if ($this->data_filter != '') {
         $sql .= ' AND ' . $this->data_filter;
     }
     $sql .= "GROUP by s.supplier_id ORDER BY total DESC, s.supplier_id " . " LIMIT " . $this->top;
     $result = db_query($sql);
     if ($this->graph_type == 'Table') {
         $th = array(_("Supplier"), _("Amount"));
         start_table(TABLESTYLE, "width=98%");
         table_header($th);
         $k = 0;
         //row colour counter
         while ($myrow = db_fetch($result)) {
             alt_table_row_color($k);
             $name = $myrow["supplier_id"] . " " . $myrow["supp_name"];
             label_cell($name);
             amount_cell($myrow['total']);
             end_row();
         }
         end_table(1);
     } else {
         $pg = new graph();
         $i = 0;
         while ($myrow = db_fetch($result)) {
             $name = $myrow["supplier_id"] . " " . $myrow["supp_name"];
             $pg->x[$i] = $name;
             $pg->y[$i] = $myrow['total'];
             $i++;
         }
         $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);
         echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
     }
 }
Example #6
0
 function render($id, $title)
 {
     global $path_to_root;
     include_once $path_to_root . "/reporting/includes/class.graphic.inc";
     if (!defined('FLOAT_COMP_DELTA')) {
         define('FLOAT_COMP_DELTA', 0.004);
     }
     if (!isset($this->top)) {
         $this->top = 10;
     }
     $begin = begin_fiscalyear();
     $today = Today();
     $begin1 = date2sql($begin);
     $today1 = date2sql($today);
     $sql = "SELECT SUM((ov_amount + ov_discount) * rate * IF(trans.type = " . ST_CUSTCREDIT . ", -1, 1)) AS total,d.debtor_no, d.name" . " FROM " . TB_PREF . "debtor_trans AS trans, " . TB_PREF . "debtors_master AS d" . " WHERE trans.debtor_no=d.debtor_no" . " AND (trans.type = " . ST_SALESINVOICE . " OR trans.type = " . ST_CUSTCREDIT . ")" . " AND tran_date >= '{$begin1}' AND tran_date <= '{$today1}'";
     if ($this->data_filter != '') {
         $sql .= ' AND ' . $this->data_filter;
     }
     $sql .= " GROUP by d.debtor_no ORDER BY total DESC, d.debtor_no " . " LIMIT " . $this->top;
     $result = db_query($sql);
     if ($this->graph_type == 'Table') {
         $th = array(null, _("Customer"), _("Amount"));
         start_table(TABLESTYLE, "width=98%");
         table_header($th);
         $k = 0;
         //row colour counter
         $i = 0;
         while ($myrow = db_fetch($result)) {
             alt_table_row_color($k);
             label_cell(viewer_link($myrow["debtor_no"], 'sales/inquiry/customer_inquiry.php?customer_id=' . $myrow["debtor_no"]));
             label_cell(viewer_link($myrow["name"], 'sales/inquiry/customer_inquiry.php?customer_id=' . $myrow["debtor_no"]));
             amount_cell($myrow['total']);
             end_row();
         }
         end_table(1);
     } else {
         $pg = new graph();
         $i = 0;
         while ($myrow = db_fetch($result)) {
             $pg->x[$i] = $myrow["debtor_no"] . " " . $myrow["name"];
             $pg->y[$i] = $myrow['total'];
             $i++;
         }
         $pg->title = $title;
         $pg->axis_x = _("Customer");
         $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);
         echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
     }
 }
Example #7
0
 function render($id, $title)
 {
     global $path_to_root;
     if (!isset($this->top)) {
         $this->top = 10;
     }
     global $path_to_root;
     $pg = new graph();
     $begin = begin_fiscalyear();
     $today = Today();
     $begin1 = date2sql($begin);
     $today1 = date2sql($today);
     $sql = "SELECT SUM(-t.amount) AS total, d.reference, d.name FROM\n            " . TB_PREF . "gl_trans AS t," . TB_PREF . "dimensions AS d WHERE\n            (t.dimension_id = d.id OR t.dimension2_id = d.id) AND\n            t.tran_date >= '{$begin1}' AND t.tran_date <= '{$today1}' ";
     if ($this->data_filter != '') {
         $sql .= ' AND ' . $this->data_filter;
     }
     $sql .= "GROUP BY d.id ORDER BY total DESC LIMIT " . $this->top;
     $result = db_query($sql, "Transactions could not be calculated");
     if ($this->graph_type == 'Table') {
         $title = _("Top 10 Dimensions in fiscal year");
         br(2);
         display_heading($title);
         br();
         $th = array(_("Dimension"), _("Amount"));
         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($myrow['reference'] . " " . $myrow["name"]);
             amount_cell($myrow['total']);
             end_row();
         }
         end_table(2);
     } else {
         $pg = new graph();
         $i = 0;
         while ($myrow = db_fetch($result)) {
             $pg->x[$i] = $myrow['reference'] . " " . $myrow["name"];
             $pg->y[$i] = abs($myrow['total']);
             $i++;
         }
         $pg->title = $title;
         $pg->axis_x = _("Dimension");
         $pg->axis_y = _("Amount");
         $pg->graphic_1 = $today;
         $pg->type = 5;
         $pg->skin = 1;
         $pg->built_in = false;
         $filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
         $pg->display($filename, true);
         echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
     }
 }
Example #8
0
function display_po_receive_items()
{
    div_start('grn_items');
    start_table(TABLESTYLE, "colspan=7 width='90%'");
    $th = array(_("Item Code"), _("Description"), _("Ordered"), _("Units"), _("Received"), _("Outstanding"), _("This Delivery"), _("Price"), _("Total"));
    table_header($th);
    /*show the line items on the order with the quantity being received for modification */
    $total = 0;
    $k = 0;
    //row colour counter
    if (count($_SESSION['PO']->line_items) > 0) {
        foreach ($_SESSION['PO']->line_items as $ln_itm) {
            alt_table_row_color($k);
            $qty_outstanding = $ln_itm->quantity - $ln_itm->qty_received;
            if (!isset($_POST['Update']) && !isset($_POST['ProcessGoodsReceived']) && $ln_itm->receive_qty == 0) {
                //If no quantites yet input default the balance to be received
                $ln_itm->receive_qty = $qty_outstanding;
            }
            $line_total = $ln_itm->receive_qty * $ln_itm->price;
            $total += $line_total;
            label_cell($ln_itm->stock_id);
            if ($qty_outstanding > 0) {
                text_cells(null, $ln_itm->stock_id . "Desc", $ln_itm->item_description, 30, 50);
            } else {
                label_cell($ln_itm->item_description);
            }
            $dec = get_qty_dec($ln_itm->stock_id);
            qty_cell($ln_itm->quantity, false, $dec);
            label_cell($ln_itm->units);
            qty_cell($ln_itm->qty_received, false, $dec);
            qty_cell($qty_outstanding, false, $dec);
            if ($qty_outstanding > 0) {
                qty_cells(null, $ln_itm->line_no, number_format2($ln_itm->receive_qty, $dec), "align=right", null, $dec);
            } else {
                label_cell(number_format2($ln_itm->receive_qty, $dec), "align=right");
            }
            amount_decimal_cell($ln_itm->price);
            amount_cell($line_total);
            end_row();
        }
    }
    $colspan = count($th) - 1;
    $display_sub_total = price_format($total);
    label_row(_("Sub-total"), $display_sub_total, "colspan={$colspan} align=right", "align=right");
    $taxes = $_SESSION['PO']->get_taxes(input_num('freight_cost'), true);
    $tax_total = display_edit_tax_items($taxes, $colspan, $_SESSION['PO']->tax_included);
    $display_total = price_format($total + input_num('freight_cost') + $tax_total);
    start_row();
    label_cells(_("Amount Total"), $display_total, "colspan={$colspan} align='right'", "align='right'");
    end_row();
    end_table();
    div_end();
}
Example #9
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);
}
Example #10
0
function display_gl_heading($myrow)
{
    global $systypes_array;
    $trans_name = $systypes_array[$_GET['type_id']];
    start_table(TABLESTYLE, "width='95%'");
    $th = array(_("General Ledger Transaction Details"), _("Reference"), _("Date"), _("Person/Item"));
    table_header($th);
    start_row();
    label_cell("{$trans_name} #" . $_GET['trans_no']);
    label_cell($myrow["reference"]);
    label_cell(sql2date($myrow["tran_date"]));
    label_cell(payment_person_name($myrow["person_type_id"], $myrow["person_id"]));
    end_row();
    comments_display_row($_GET['type_id'], $_GET['trans_no']);
    end_table(1);
}
Example #11
0
function display_po_receive_items()
{
    global $table_style;
    start_table("colspan=7 {$table_style} width=90%");
    $th = array(tr("Item Code"), tr("Description"), tr("Ordered"), tr("Units"), tr("Received"), tr("Outstanding"), tr("This Delivery"), tr("Price"), tr("Total"));
    table_header($th);
    /*show the line items on the order with the quantity being received for modification */
    $total = 0;
    $k = 0;
    //row colour counter
    if (count($_SESSION['PO']->line_items) > 0) {
        foreach ($_SESSION['PO']->line_items as $ln_itm) {
            alt_table_row_color($k);
            $qty_outstanding = $ln_itm->quantity - $ln_itm->qty_received;
            if ($ln_itm->receive_qty == 0) {
                //If no quantites yet input default the balance to be received
                $ln_itm->receive_qty = $qty_outstanding;
            }
            $line_total = $ln_itm->receive_qty * $ln_itm->price;
            $total += $line_total;
            label_cell($ln_itm->stock_id);
            if ($qty_outstanding > 0) {
                text_cells(null, $ln_itm->stock_id . "Desc", $ln_itm->item_description, 30, 50);
            } else {
                label_cell($ln_itm->item_description);
            }
            qty_cell($ln_itm->quantity);
            label_cell($ln_itm->units);
            qty_cell($ln_itm->qty_received);
            qty_cell($qty_outstanding);
            if ($qty_outstanding > 0) {
                qty_cells(null, $ln_itm->line_no, qty_format($ln_itm->receive_qty), "align=right");
            } else {
                qty_cells(null, $ln_itm->line_no, qty_format($ln_itm->receive_qty), "align=right", "disabled");
            }
            amount_cell($ln_itm->price);
            amount_cell($line_total);
            end_row();
        }
    }
    $display_total = number_format2($total, user_price_dec());
    label_row(tr("Total value of items received"), $display_total, "colspan=8 align=right", "nowrap align=right");
    end_table();
}
Example #12
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."));
}
Example #13
0
function display_gl_heading($myrow)
{
    global $systypes_array;
    $title = "";
    //moodlearning
    if ($myrow['type'] == 55 || $myrow['type'] == 1) {
        if ($myrow['type'] == 0) {
            $title = "JV No.";
            $num = substr($ser['year'], 2);
        }
        if ($myrow['type'] == 55) {
            $voucher_type = "Check Voucher";
            $title = "CV No.";
            $myDateTime = DateTime::createFromFormat('Y-m-d', $myrow['tran_date']);
            $newDateString = $myDateTime->format('d-m-Y');
            $year = substr($newDateString, 8) . "-";
        }
    }
    $trans_name = $systypes_array[$_GET['type_id']];
    start_table(TABLESTYLE, "width=95%");
    if ($myrow['type'] == 0 || $myrow['type'] == 1 || $myrow['type'] == 55) {
        $th = array(_("General Ledger Transaction Details"), _("Reference"), _("Date"), _("Person/Item"), $title);
    } else {
        $th = array(_("General Ledger Transaction Details"), _("Reference"), _("Date"), _("Person/Item"));
    }
    table_header($th);
    start_row();
    if ($custom == 0) {
        label_cell("{$trans_name} #" . $_GET['type_id']);
    } else {
        label_cell("{$trans_name} #" . get_customized_no($myrow['type'], $myrow['type_no']));
    }
    label_cell($myrow["reference"]);
    label_cell(sql2date($myrow["tran_date"]));
    label_cell(payment_person_name($myrow["person_type_id"], $myrow["person_id"]));
    if ($myrow['type'] == 0 || $myrow['type'] == 1 || $myrow['type'] == 55) {
        label_cell($year . str_pad(get_customized_no($myrow['type'], $myrow['type_no']), 4, 0, STR_PAD_LEFT));
    }
    //moodlearning
    end_row();
    comments_display_row($_GET['type_id'], $_GET['trans_no']);
    end_table(1);
}
Example #14
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."));
}
Example #15
0
function display_supplier_summary($supplier_record)
{
    $past1 = get_company_pref('past_due_days');
    $past2 = 2 * $past1;
    $nowdue = "1-" . $past1 . " " . _('Days');
    $pastdue1 = $past1 + 1 . "-" . $past2 . " " . _('Days');
    $pastdue2 = _('Over') . " " . $past2 . " " . _('Days');
    start_table(TABLESTYLE, "width='80%'");
    $th = array(_("Currency"), _("Terms"), _("Current"), $nowdue, $pastdue1, $pastdue2, _("Total Balance"));
    table_header($th);
    start_row();
    label_cell($supplier_record["curr_code"]);
    label_cell($supplier_record["terms"]);
    amount_cell($supplier_record["Balance"] - $supplier_record["Due"]);
    amount_cell($supplier_record["Due"] - $supplier_record["Overdue1"]);
    amount_cell($supplier_record["Overdue1"] - $supplier_record["Overdue2"]);
    amount_cell($supplier_record["Overdue2"]);
    amount_cell($supplier_record["Balance"]);
    end_row();
    end_table(1);
}
Example #16
0
function display_rates($curr_code)
{
    global $table_style;
    $result = get_exchange_rates($curr_code);
    br(2);
    start_table($table_style);
    $th = array(tr("Date to Use From"), tr("Exchange Rate"), "", "");
    table_header($th);
    $k = 0;
    //row colour counter
    while ($myrow = db_fetch($result)) {
        alt_table_row_color($k);
        label_cell(sql2date($myrow["date_"]));
        label_cell(number_format2($myrow["rate_buy"], user_exrate_dec()), "nowrap align=right");
        edit_link_cell("selected_id=" . $myrow["id"]);
        delete_link_cell("selected_id=" . $myrow["id"] . "&delete=1");
        end_row();
    }
    //END WHILE LIST LOOP
    end_table();
}
Example #17
0
function display_kit_items($selected_kit)
{
    $result = get_item_kit($selected_kit);
    div_start('bom');
    start_table(TABLESTYLE, "width='60%'");
    $th = array(_("Stock Item"), _("Description"), _("Quantity"), _("Units"), '', '');
    table_header($th);
    $k = 0;
    while ($myrow = db_fetch($result)) {
        alt_table_row_color($k);
        label_cell($myrow["stock_id"]);
        label_cell($myrow["comp_name"]);
        qty_cell($myrow["quantity"], false, $myrow["units"] == '' ? 0 : get_qty_dec($myrow["comp_name"]));
        label_cell($myrow["units"] == '' ? _('kit') : $myrow["units"]);
        edit_button_cell("Edit" . $myrow['id'], _("Edit"));
        delete_button_cell("Delete" . $myrow['id'], _("Delete"));
        end_row();
    }
    //END WHILE LIST LOOP
    end_table();
    div_end();
}
Example #18
0
function display_langs()
{
    start_table(TABLESTYLE);
    $th = array(_("Language"), _("Encoding"), _("Description"), _("Install"));
    table_header($th);
    $k = 0;
    $langs = get_languages_list();
    foreach ($langs as $pkg_name => $lang) {
        $available = @$lang['available'];
        $installed = @$lang['version'];
        $id = @$lang['local_id'];
        if (!$available) {
            continue;
        }
        alt_table_row_color($k);
        label_cell($lang['name']);
        label_cell($lang['encoding']);
        label_cell(is_array($lang['Descr']) ? implode('<br>', $lang['Descr']) : $lang['Descr']);
        label_cell($installed ? _("Installed") : checkbox(null, 'langs[' . $lang['package'] . ']'), "align='center'");
        end_row();
    }
    end_table(1);
}
Example #19
0
function display_bom_items($selected_parent)
{
    global $table_style;
    $result = get_bom($selected_parent);
    start_table("{$table_style} width=60%");
    $th = array(tr("Code"), tr("Description"), tr("Location"), tr("Work Centre"), tr("Quantity"), tr("Units"), '', '');
    table_header($th);
    $k = 0;
    while ($myrow = db_fetch($result)) {
        alt_table_row_color($k);
        label_cell($myrow["component"]);
        label_cell($myrow["description"]);
        label_cell($myrow["location_name"]);
        label_cell($myrow["WorkCentreDescription"]);
        label_cell(qty_format($myrow["quantity"]));
        label_cell($myrow["units"]);
        edit_link_cell(SID . "NewItem={$selected_parent}&selected_component=" . $myrow["id"]);
        delete_link_cell(SID . "delete=" . $myrow["id"] . "&stock_id=" . $_POST['stock_id']);
        end_row();
    }
    //END WHILE LIST LOOP
    end_table();
}
Example #20
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);
 }
Example #21
0
function display_bom_items($selected_parent)
{
    $result = get_bom($selected_parent);
    div_start('bom');
    start_table(TABLESTYLE, "width=60%");
    $th = array(_("Code"), _("Description"), _("Location"), _("Work Centre"), _("Quantity"), _("Units"), '', '');
    table_header($th);
    $k = 0;
    while ($myrow = db_fetch($result)) {
        alt_table_row_color($k);
        label_cell($myrow["component"]);
        label_cell($myrow["description"]);
        label_cell($myrow["location_name"]);
        label_cell($myrow["WorkCentreDescription"]);
        qty_cell($myrow["quantity"], false, get_qty_dec($myrow["component"]));
        label_cell($myrow["units"]);
        edit_button_cell("Edit" . $myrow['id'], _("Edit"));
        delete_button_cell("Delete" . $myrow['id'], _("Delete"));
        end_row();
    }
    //END WHILE LIST LOOP
    end_table();
    div_end();
}
Example #22
0
 function render($id, $title)
 {
     global $path_to_root;
     include_once $path_to_root . "/includes/ui.inc";
     $end_date = date2sql(add_days(Today(), $this->days_future));
     $role_id = $_SESSION["wa_current_user"]->access;
     $sql = "SELECT id, description, next_date FROM " . TB_PREF . "dashboard_reminders " . " WHERE next_date < '{$end_date}'" . " AND role_id = '{$role_id}'";
     if ($this->data_filter != '') {
         $sql .= ' AND ' . $this->data_filter;
     }
     $sql .= " ORDER BY next_date";
     $result = db_query($sql);
     br();
     $th = array(_("Actioned"), _("Date"), _("Description"));
     start_table(TABLESTYLE, "id='reminder' width=98%");
     table_header($th);
     $k = 0;
     //row colour counter
     while ($myrow = db_fetch($result)) {
         $nextdate = sql2date($myrow["next_date"]);
         if (date1_greater_date2(Today(), $nextdate)) {
             $extra = "class='reminder_overdue'";
         } elseif (Today() == $nextdate) {
             $extra = "class='reminder_due'";
         } else {
             $extra = "class='reminder'";
         }
         alt_table_row_color($k);
         $js = 'setTimeout(function(){updateToDoData(' . $myrow["id"] . ');}, 0);';
         check_cells(null, null, null, $js);
         label_cell($nextdate, $extra);
         label_cell("<pre>" . $myrow["description"] . "</pre>", $extra);
         end_row();
     }
     end_table(1);
 }
            $th = array(_("Account Code"), _("Account Description"), _("Dimension"), _("Amount"), _("Memo"));
        } else {
            $th = array(_("Account Code"), _("Account Description"), _("Amount"), _("Memo"));
        }
    }
    table_header($th);
    $k = 0;
    //row colour counter
    $total_amount = 0;
    while ($item = db_fetch($items)) {
        if ($item["account"] != $to_trans["account_code"]) {
            alt_table_row_color($k);
            label_cell($item["account"]);
            label_cell($item["account_name"]);
            if ($dim >= 1) {
                label_cell(get_dimension_string($item['dimension_id'], true));
            }
            if ($dim > 1) {
                label_cell(get_dimension_string($item['dimension2_id'], true));
            }
            amount_cell(-$item["amount"]);
            label_cell($item["memo_"]);
            end_row();
            $total_amount += $item["amount"];
        }
    }
    label_row(_("Total"), number_format2(-$total_amount, user_price_dec()), "colspan=" . (2 + $dim) . " align=right", "align=right");
    end_table(1);
    display_allocations_from($to_trans['person_type_id'], $to_trans['person_id'], 2, $trans_no, $to_trans['settled_amount']);
}
end_page(true, false, false, ST_BANKDEPOSIT, $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);
 }
Example #25
0
    if ($sav) {
        $_POST['show_inactive'] = 1;
    }
}
//-------------------------------------------------------------------------------------------------
$result = get_sales_groups(check_value('show_inactive'));
start_form();
start_table(TABLESTYLE, "width=30%");
$th = array(_("ID"), _("Group Name"), "", "");
inactive_control_column($th);
table_header($th);
$k = 0;
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    label_cell($myrow["id"]);
    label_cell($myrow["description"]);
    inactive_control_cell($myrow["id"], $myrow["inactive"], 'groups', 'id');
    edit_button_cell("Edit" . $myrow["id"], _("Edit"));
    delete_button_cell("Delete" . $myrow["id"], _("Delete"));
    end_row();
}
inactive_control_row($th);
end_table(1);
//-------------------------------------------------------------------------------------------------
start_table(TABLESTYLE2);
if ($selected_id != -1) {
    if ($Mode == 'Edit') {
        //editing an existing group
        $myrow = get_sales_group($selected_id);
        $_POST['description'] = $myrow["description"];
    }
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();
}
Example #27
0
$mods = get_charts_list();
foreach ($mods as $pkg_name => $ext) {
    $available = @$ext['available'];
    $installed = @$ext['version'];
    $id = @$ext['local_id'];
    $encoding = @$ext['encoding'];
    alt_table_row_color($k);
    //		label_cell(is_array($ext['Descr']) ? $ext['Descr'][0] : $ext['Descr']);
    label_cell($available ? get_package_view_str($pkg_name, $ext['name']) : $ext['name']);
    label_cell($id === null ? _("None") : ($available && $installed ? $installed : _("Unknown")));
    label_cell($available ? $available : _("None"));
    label_cell($encoding ? $encoding : _("Unknown"));
    if ($available && check_pkg_upgrade($installed, $available)) {
        // outdated or not installed theme in repo
        button_cell('Update' . $pkg_name, $installed ? _("Update") : _("Install"), _('Upload and install latest extension package'), ICON_DOWN);
    } else {
        label_cell('');
    }
    if ($id !== null) {
        delete_button_cell('Delete' . $id, _('Delete'));
        submit_js_confirm('Delete' . $id, sprintf(_("You are about to remove package \\'%s\\'.\nDo you want to continue ?"), $ext['name']));
    } else {
        label_cell('');
    }
    end_row();
}
end_table(1);
div_end();
//---------------------------------------------------------------------------------------------
end_form();
end_page();
Example #28
0
//------------------------------------------------------------------------------------------------
$sql = "SELECT * FROM salesman";
$result = db_query($sql, "could not get sales persons");
start_table("{$table_style} width=60%");
$th = array(tr("Name"), tr("Phone"), tr("Fax"), tr("Email"), tr("Provision"), tr("Break Pt."), tr("Provision") . " 2", "", "");
table_header($th);
$k = 0;
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    label_cell($myrow["salesman_name"]);
    label_cell($myrow["salesman_phone"]);
    label_cell($myrow["salesman_fax"]);
    label_cell($myrow["salesman_email"]);
    label_cell(percent_format($myrow["provision"]) . " %", "nowrap align=right");
    amount_cell($myrow["break_pt"]);
    label_cell(percent_format($myrow["provision2"]) . " %", "nowrap align=right");
    edit_link_cell(SID . "selected_id=" . $myrow["salesman_code"]);
    delete_link_cell(SID . "selected_id=" . $myrow["salesman_code"] . "&delete=1");
    end_row();
}
//END WHILE LIST LOOP
end_table();
//------------------------------------------------------------------------------------------------
hyperlink_no_params($_SERVER['PHP_SELF'], tr("New Sales Person"));
//------------------------------------------------------------------------------------------------
start_form();
if (isset($selected_id)) {
    //editing an existing Sales-person
    $sql = "SELECT *  FROM salesman WHERE salesman_code='{$selected_id}'";
    $result = db_query($sql, "could not get sales person");
    $myrow = db_fetch($result);
    $last_sent = $myrow["last_sent"] == '0000-00-00' ? '' : sql2date($myrow["last_sent"]);
    alt_table_row_color($k);
    label_cell($myrow["description"]);
    label_cell(get_customer_trans_view_str(ST_SALESORDER, $myrow["order_no"]));
    if ($myrow["debtor_no"] == 0) {
        label_cell("");
        label_cell(get_sales_group_name($myrow["group_no"]));
    } else {
        label_cell(get_customer_name($myrow["debtor_no"]));
        label_cell(get_branch_name($myrow['group_no']));
    }
    label_cell($myrow["days"]);
    label_cell($myrow['monthly']);
    label_cell($begin);
    label_cell($end);
    label_cell($last_sent);
    edit_button_cell("Edit" . $myrow["id"], _("Edit"));
    delete_button_cell("Delete" . $myrow["id"], _("Delete"));
    end_row();
}
end_table();
end_form();
echo '<br>';
//-------------------------------------------------------------------------------------------------
start_form();
start_table(TABLESTYLE2);
if ($selected_id != -1) {
    if ($Mode == 'Edit') {
        //editing an existing area
        $myrow = get_recurrent_invoice($selected_id);
        $_POST['description'] = $myrow["description"];
Example #30
0
        label_cell($date_);
        if (!isset($_POST['amount' . $i])) {
            $_POST['amount' . $i] = '0';
        }
        amount_cells(null, 'amount' . $i, null, 15, null, 0);
        if ($showdims) {
            $d = get_budget_trans_from_to($date_, $date_, $_POST['account'], $_POST['dim1'], $_POST['dim2']);
            label_cell(number_format2($d, 0), "nowrap align=right");
            $btotal += $d;
        }
        $lamount = get_gl_trans_from_to(add_years($date_, -1), add_years(end_month($date_), -1), $_POST['account'], $_POST['dim1'], $_POST['dim2']);
        $total += input_num('amount' . $i);
        $ltotal += $lamount;
        label_cell(number_format2($lamount, 0), "nowrap align=right");
        $date_ = add_months($date_, 1);
        end_row();
    }
    start_row();
    label_cell("<b>" . tr("Total") . "</b>");
    label_cell("<b>" . number_format2($total, 0) . "</b>", 'align=right');
    if ($showdims) {
        label_cell("<b>" . number_format2($btotal, 0) . "</b>", "nowrap align=right");
    }
    label_cell("<b>" . number_format2($ltotal, 0) . "</b>", "nowrap align=right");
    end_row();
    end_table(1);
    submit_center_first('add', tr("Save"));
    submit_center_last('delete', tr("Delete"));
}
end_form();
end_page();