Exemplo n.º 1
0
function print_bill_of_material()
{
    global $path_to_root;
    include_once $path_to_root . "reporting/includes/pdf_report.inc";
    $frompart = $_REQUEST['PARAM_0'];
    $topart = $_REQUEST['PARAM_1'];
    $comments = $_REQUEST['PARAM_2'];
    $dec = user_qty_dec();
    $cols = array(0, 50, 305, 375, 445, 515);
    $headers = array(tr('Component'), tr('Description'), tr('Loc'), tr('Wrk Ctr'), tr('Quantity'));
    $aligns = array('left', 'left', 'left', 'left', 'right');
    $params = array(0 => $comments, 1 => array('text' => tr('Component'), 'from' => $frompart, 'to' => $topart));
    $rep = new FrontReport(tr('Bill of Material Listing'), "BillOfMaterial.pdf", user_pagesize());
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->Header();
    $res = getTransactions($frompart, $topart);
    $parent = '';
    while ($trans = db_fetch($res)) {
        if ($parent != $trans['parent']) {
            if ($parent != '') {
                $rep->Line($rep->row - 2);
                $rep->NewLine(2, 3);
            }
            $rep->TextCol(0, 1, $trans['parent']);
            $desc = get_item($trans['parent']);
            $rep->TextCol(1, 2, $desc['description']);
            $parent = $trans['parent'];
            $rep->NewLine();
        }
        $rep->NewLine();
        $rep->TextCol(0, 1, $trans['component']);
        $rep->TextCol(1, 2, $trans['CompDescription']);
        $rep->TextCol(2, 3, $trans['loc_code']);
        $rep->TextCol(3, 4, $trans['workcentre_added']);
        $rep->TextCol(4, 5, number_format2($trans['quantity'], $dec));
    }
    $rep->Line($rep->row - 4);
    $rep->End();
}
Exemplo n.º 2
0
function print_po()
{
    global $path_to_root, $show_po_item_codes;
    include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $currency = $_POST['PARAM_2'];
    $email = $_POST['PARAM_3'];
    $comments = $_POST['PARAM_4'];
    $orientation = $_POST['PARAM_5'];
    if (!$from || !$to) {
        return;
    }
    $orientation = $orientation ? 'L' : 'P';
    $dec = user_price_dec();
    $cols = array(4, 60, 225, 300, 340, 385, 450, 515);
    // $headers in doctext.inc
    $aligns = array('left', 'left', 'left', 'right', 'left', 'right', 'right');
    $params = array('comments' => $comments);
    $cur = get_company_Pref('curr_default');
    if ($email == 0) {
        $rep = new FrontReport(_('PURCHASE ORDER'), "PurchaseOrderBulk", user_pagesize(), 9, $orientation);
    }
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    for ($i = $from; $i <= $to; $i++) {
        $myrow = get_po($i);
        $baccount = get_default_bank_account($myrow['curr_code']);
        $params['bankaccount'] = $baccount['id'];
        if ($email == 1) {
            $rep = new FrontReport("", "", user_pagesize(), 9, $orientation);
            $rep->title = _('PURCHASE ORDER');
            $rep->filename = "PurchaseOrder" . $i . ".pdf";
        }
        $rep->SetHeaderType('Header2');
        $rep->currency = $cur;
        $rep->Font();
        $rep->Info($params, $cols, null, $aligns);
        $contacts = get_supplier_contacts($myrow['supplier_id'], 'order');
        $rep->SetCommonData($myrow, null, $myrow, $baccount, ST_PURCHORDER, $contacts);
        $rep->NewPage();
        $result = get_po_details($i);
        $SubTotal = 0;
        $items = $prices = array();
        while ($myrow2 = db_fetch($result)) {
            $data = get_purchase_data($myrow['supplier_id'], $myrow2['item_code']);
            if ($data !== false) {
                if ($data['supplier_description'] != "") {
                    $myrow2['description'] = $data['supplier_description'];
                }
                if ($data['suppliers_uom'] != "") {
                    $myrow2['units'] = $data['suppliers_uom'];
                }
                if ($data['conversion_factor'] != 1) {
                    $myrow2['unit_price'] = round2($myrow2['unit_price'] * $data['conversion_factor'], user_price_dec());
                    $myrow2['quantity_ordered'] = round2($myrow2['quantity_ordered'] / $data['conversion_factor'], user_qty_dec());
                }
            }
            $Net = round2($myrow2["unit_price"] * $myrow2["quantity_ordered"], user_price_dec());
            $prices[] = $Net;
            $items[] = $myrow2['item_code'];
            $SubTotal += $Net;
            $dec2 = 0;
            $DisplayPrice = price_decimal_format($myrow2["unit_price"], $dec2);
            $DisplayQty = number_format2($myrow2["quantity_ordered"], get_qty_dec($myrow2['item_code']));
            $DisplayNet = number_format2($Net, $dec);
            if ($show_po_item_codes) {
                $rep->TextCol(0, 1, $myrow2['item_code'], -2);
                $rep->TextCol(1, 2, $myrow2['description'], -2);
            } else {
                $rep->TextCol(0, 2, $myrow2['description'], -2);
            }
            $rep->TextCol(2, 3, sql2date($myrow2['delivery_date']), -2);
            $rep->TextCol(3, 4, $DisplayQty, -2);
            $rep->TextCol(4, 5, $myrow2['units'], -2);
            $rep->TextCol(5, 6, $DisplayPrice, -2);
            $rep->TextCol(6, 7, $DisplayNet, -2);
            $rep->NewLine(1);
            if ($rep->row < $rep->bottomMargin + 15 * $rep->lineHeight) {
                $rep->NewPage();
            }
        }
        if ($myrow['comments'] != "") {
            $rep->NewLine();
            $rep->TextColLines(1, 5, $myrow['comments'], -2);
        }
        $DisplaySubTot = number_format2($SubTotal, $dec);
        $rep->row = $rep->bottomMargin + 15 * $rep->lineHeight;
        $doctype = ST_PURCHORDER;
        $rep->TextCol(3, 6, _("Sub-total"), -2);
        $rep->TextCol(6, 7, $DisplaySubTot, -2);
        $rep->NewLine();
        $tax_items = get_tax_for_items($items, $prices, 0, $myrow['tax_group_id'], $myrow['tax_included'], null);
        $first = true;
        foreach ($tax_items as $tax_item) {
            if ($tax_item['Value'] == 0) {
                continue;
            }
            $DisplayTax = number_format2($tax_item['Value'], $dec);
            $tax_type_name = $tax_item['tax_type_name'];
            if ($myrow['tax_included']) {
                if (isset($alternative_tax_include_on_docs) && $alternative_tax_include_on_docs == 1) {
                    if ($first) {
                        $rep->TextCol(3, 6, _("Total Tax Excluded"), -2);
                        $rep->TextCol(6, 7, number_format2($sign * $tax_item['net_amount'], $dec), -2);
                        $rep->NewLine();
                    }
                    $rep->TextCol(3, 6, $tax_type_name, -2);
                    $rep->TextCol(6, 7, $DisplayTax, -2);
                    $first = false;
                } else {
                    $rep->TextCol(3, 7, _("Included") . " " . $tax_type_name . _("Amount") . ": " . $DisplayTax, -2);
                }
            } else {
                $SubTotal += $tax_item['Value'];
                $rep->TextCol(3, 6, $tax_type_name, -2);
                $rep->TextCol(6, 7, $DisplayTax, -2);
            }
            $rep->NewLine();
        }
        $rep->NewLine();
        $DisplayTotal = number_format2($SubTotal, $dec);
        $rep->Font('bold');
        $rep->TextCol(3, 6, _("TOTAL PO"), -2);
        $rep->TextCol(6, 7, $DisplayTotal, -2);
        $words = price_in_words($SubTotal, ST_PURCHORDER);
        if ($words != "") {
            $rep->NewLine(1);
            $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, -2);
        }
        $rep->Font();
        if ($email == 1) {
            $myrow['DebtorName'] = $myrow['supp_name'];
            if ($myrow['reference'] == "") {
                $myrow['reference'] = $myrow['order_no'];
            }
            $rep->End($email);
        }
    }
    if ($email == 0) {
        $rep->End();
    }
}
Exemplo n.º 3
0
function print_inventory_planning()
{
    global $path_to_root;
    include_once $path_to_root . "reporting/includes/pdf_report.inc";
    $category = $_REQUEST['PARAM_0'];
    $location = $_REQUEST['PARAM_1'];
    $comments = $_REQUEST['PARAM_2'];
    $dec = user_qty_dec();
    if ($category == reserved_words::get_all_numeric()) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = tr('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($location == reserved_words::get_all()) {
        $location = 'all';
    }
    if ($location == 'all') {
        $loc = tr('All');
    } else {
        $loc = $location;
    }
    $cols = array(0, 50, 150, 180, 210, 240, 270, 300, 330, 390, 435, 480, 525);
    $per0 = strftime('%b', mktime(0, 0, 0, date('m'), date('d'), date('Y')));
    $per1 = strftime('%b', mktime(0, 0, 0, date('m') - 1, date('d'), date('Y')));
    $per2 = strftime('%b', mktime(0, 0, 0, date('m') - 2, date('d'), date('Y')));
    $per3 = strftime('%b', mktime(0, 0, 0, date('m') - 3, date('d'), date('Y')));
    $per4 = strftime('%b', mktime(0, 0, 0, date('m') - 4, date('d'), date('Y')));
    $headers = array(tr('Category'), '', $per4, $per3, $per2, $per1, $per0, '3*M', tr('QOH'), tr('Cust Ord'), tr('Supp Ord'), tr('Sugg Ord'));
    $aligns = array('left', 'left', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => tr('Category'), 'from' => $cat, 'to' => ''), 2 => array('text' => tr('Location'), 'from' => $loc, 'to' => ''));
    $rep = new FrontReport(tr('Inventory Planning Report'), "InventoryPlanning.pdf", user_pagesize());
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->Header();
    $res = getTransactions($category, $location);
    $catt = '';
    while ($trans = db_fetch($res)) {
        if ($catt != $trans['cat_description']) {
            if ($catt != '') {
                $rep->Line($rep->row - 2);
                $rep->NewLine(2, 3);
            }
            $rep->TextCol(0, 1, $trans['category_id']);
            $rep->TextCol(1, 2, $trans['cat_description']);
            $catt = $trans['cat_description'];
            $rep->NewLine();
        }
        $custqty = getCustQty($trans['stock_id'], $trans['loc_code']);
        $custqty += getCustAsmQty($trans['stock_id'], $trans['loc_code']);
        $suppqty = getSuppQty($trans['stock_id'], $trans['loc_code']);
        $period = getPeriods($trans['stock_id'], $trans['loc_code']);
        $rep->NewLine();
        $rep->TextCol(0, 1, $trans['stock_id']);
        $rep->TextCol(1, 2, $trans['description']);
        $rep->TextCol(2, 3, number_format2($period['prd0'], $dec));
        $rep->TextCol(3, 4, number_format2($period['prd1'], $dec));
        $rep->TextCol(4, 5, number_format2($period['prd2'], $dec));
        $rep->TextCol(5, 6, number_format2($period['prd3'], $dec));
        $rep->TextCol(6, 7, number_format2($period['prd4'], $dec));
        $MaxMthSales = Max($period['prd0'], $period['prd1'], $period['prd2'], $period['prd3']);
        $IdealStockHolding = $MaxMthSales * 3;
        $rep->TextCol(7, 8, number_format2($IdealStockHolding, $dec));
        $rep->TextCol(8, 9, number_format2($trans['qty_on_hand'], $dec));
        $rep->TextCol(9, 10, number_format2($custqty, $dec));
        $rep->TextCol(10, 11, number_format2($suppqty, $dec));
        $SuggestedTopUpOrder = $IdealStockHolding - $trans['qty_on_hand'] + $custqty - $suppqty;
        if ($SuggestedTopUpOrder < 0.0) {
            $SuggestedTopUpOrder = 0.0;
        }
        $rep->TextCol(11, 12, number_format2($SuggestedTopUpOrder, $dec));
    }
    $rep->Line($rep->row - 4);
    $rep->End();
}
Exemplo n.º 4
0
        if ($chg_theme || $chg_lang || $chg_date_format || $chg_date_sep) {
            meta_forward($_SERVER['PHP_SELF']);
        }
        if ($allow_demo_mode) {
            display_warning(_("Display settings have been updated. Keep in mind that changed settings are restored on every login in demo mode."));
        } else {
            display_notification_centered(_("Display settings have been updated."));
        }
    }
}
start_form();
start_outer_table(TABLESTYLE2);
table_section(1);
table_section_title(_("Decimal Places"));
number_list_row(_("Prices/Amounts:"), 'prices_dec', user_price_dec(), 0, 10);
number_list_row(_("Quantities:"), 'qty_dec', user_qty_dec(), 0, 10);
number_list_row(_("Exchange Rates:"), 'rates_dec', user_exrate_dec(), 0, 10);
number_list_row(_("Percentages:"), 'percent_dec', user_percent_dec(), 0, 10);
table_section_title(_("Dateformat and Separators"));
dateformats_list_row(_("Dateformat:"), "date_format", user_date_format());
dateseps_list_row(_("Date Separator:"), "date_sep", user_date_sep());
/* The array $dateseps is set up in config.php for modifications
possible separators can be added by modifying the array definition by editing that file */
thoseps_list_row(_("Thousand Separator:"), "tho_sep", user_tho_sep());
/* The array $thoseps is set up in config.php for modifications
possible separators can be added by modifying the array definition by editing that file */
decseps_list_row(_("Decimal Separator:"), "dec_sep", user_dec_sep());
/* The array $decseps is set up in config.php for modifications
possible separators can be added by modifying the array definition by editing that file */
if (!isset($_POST['language'])) {
    $_POST['language'] = $_SESSION['language']->code;
Exemplo n.º 5
0
function print_salesman_list()
{
    global $path_to_root;
    include_once $path_to_root . "reporting/includes/pdf_report.inc";
    $from = $_REQUEST['PARAM_0'];
    $to = $_REQUEST['PARAM_1'];
    $summary = $_REQUEST['PARAM_2'];
    $comments = $_REQUEST['PARAM_3'];
    if ($summary == 0) {
        $sum = tr("No");
    } else {
        $sum = tr("Yes");
    }
    $dec = user_qty_dec();
    $cols = array(0, 60, 150, 220, 325, 385, 450, 515);
    $headers = array(tr('Invoice'), tr('Customer'), tr('Branch'), tr('Customer Ref'), tr('Inv Date'), tr('Total'), tr('Provision'));
    $aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right');
    $headers2 = array(tr('Salesman'), " ", tr('Phone'), tr('Email'), tr('Provision'), tr('Break Pt.'), tr('Provision') . " 2");
    $params = array(0 => $comments, 1 => array('text' => tr('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => tr('Summary Only'), 'from' => $sum, 'to' => ''));
    $cols2 = $cols;
    $aligns2 = $aligns;
    $rep = new FrontReport(tr('Salesman Listing'), "SalesmanListing.pdf", user_pagesize());
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2);
    $rep->Header();
    $salesman = 0;
    $subtotal = $total = $subprov = $provtotal = 0;
    $result = GetSalesmanTrans($from, $to);
    while ($myrow = db_fetch($result)) {
        if ($rep->row < $rep->bottomMargin + 2 * $rep->lineHeight) {
            $salesman = 0;
            $rep->Header();
        }
        $rep->NewLine(0, 2, false, $salesman);
        if ($salesman != $myrow['salesman_code']) {
            if ($salesman != 0) {
                $rep->Line($rep->row - 8);
                $rep->NewLine(2);
                $rep->TextCol(0, 3, tr('Total'));
                $rep->TextCol(5, 6, number_format2($subtotal, $dec));
                $rep->TextCol(6, 7, number_format2($subprov, $dec));
                $rep->Line($rep->row - 4);
                $rep->NewLine(2);
                //$rep->Line($rep->row);
            }
            $rep->TextCol(0, 2, $myrow['salesman_code'] . " " . $myrow['salesman_name']);
            $rep->TextCol(2, 3, $myrow['salesman_phone']);
            $rep->TextCol(3, 4, $myrow['salesman_email']);
            $rep->TextCol(4, 5, number_format2($myrow['provision'], user_percent_dec()) . " %");
            $rep->TextCol(5, 6, number_format2($myrow['break_pt'], $dec));
            $rep->TextCol(6, 7, number_format2($myrow['provision2'], user_percent_dec()) . " %");
            $rep->NewLine(2);
            $salesman = $myrow['salesman_code'];
            $total += $subtotal;
            $provtotal += $subprov;
            $subtotal = 0;
            $subprov = 0;
        }
        $date = sql2date($myrow['tran_date']);
        $rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $date);
        $amt = $myrow['InvoiceTotal'] * $rate;
        if ($subprov > $myrow['break_pt'] && $myrow['provision2'] != 0) {
            $prov = $myrow['provision2'] * $amt / 100;
        } else {
            $prov = $myrow['provision'] * $amt / 100;
        }
        if (!$summary) {
            $rep->TextCol(0, 1, $myrow['trans_no']);
            $rep->TextCol(1, 2, $myrow['DebtorName']);
            $rep->TextCol(2, 3, $myrow['br_name']);
            $rep->TextCol(3, 4, $myrow['contact_name']);
            $rep->TextCol(4, 5, $date);
            $rep->TextCol(5, 6, number_format2($amt, $dec));
            $rep->TextCol(6, 7, number_format2($prov, $dec));
            $rep->NewLine();
            if ($rep->row < $rep->bottomMargin + 2 * $rep->lineHeight) {
                $salesman = 0;
                $rep->Header();
            }
        }
        $subtotal += $amt;
        $subprov += $prov;
    }
    if ($salesman != 0) {
        $rep->Line($rep->row - 4);
        $rep->NewLine(2);
        $rep->TextCol(0, 3, tr('Total'));
        $rep->TextCol(5, 6, number_format2($subtotal, $dec));
        $rep->TextCol(6, 7, number_format2($subprov, $dec));
        $rep->Line($rep->row - 4);
        $rep->NewLine(2);
        //$rep->Line($rep->row);
        $total += $subtotal;
        $provtotal += $subprov;
    }
    $rep->fontSize += 2;
    $rep->TextCol(0, 3, tr('Grand Total'));
    $rep->fontSize -= 2;
    $rep->TextCol(5, 6, number_format2($total, $dec));
    $rep->TextCol(6, 7, number_format2($provtotal, $dec));
    $rep->Line($rep->row - 4);
    $rep->End();
}
Exemplo n.º 6
0
        if ($chg_theme || $chg_lang || $chg_date_format || $chg_date_sep) {
            meta_forward($_SERVER['PHP_SELF']);
        }
        if ($allow_demo_mode) {
            display_warning(_("Display settings have been updated. Keep in mind that changed settings are restored on every login in demo mode."));
        } else {
            display_notification_centered(_("Display settings have been updated."));
        }
    }
}
start_form();
start_outer_table(TABLESTYLE2);
table_section(1);
table_section_title(_("Decimal Places"));
text_row_ex(_("Prices/Amounts:"), 'prices_dec', 5, 5, '', user_price_dec());
text_row_ex(_("Quantities:"), 'qty_dec', 5, 5, '', user_qty_dec());
text_row_ex(_("Exchange Rates:"), 'rates_dec', 5, 5, '', user_exrate_dec());
text_row_ex(_("Percentages:"), 'percent_dec', 5, 5, '', user_percent_dec());
table_section_title(_("Dateformat and Separators"));
dateformats_list_row(_("Dateformat:"), "date_format", user_date_format());
dateseps_list_row(_("Date Separator:"), "date_sep", user_date_sep());
/* The array $dateseps is set up in config.php for modifications
possible separators can be added by modifying the array definition by editing that file */
thoseps_list_row(_("Thousand Separator:"), "tho_sep", user_tho_sep());
/* The array $thoseps is set up in config.php for modifications
possible separators can be added by modifying the array definition by editing that file */
decseps_list_row(_("Decimal Separator:"), "dec_sep", user_dec_sep());
/* The array $decseps is set up in config.php for modifications
possible separators can be added by modifying the array definition by editing that file */
if (!isset($_POST['language'])) {
    $_POST['language'] = $_SESSION['language']->code;
Exemplo n.º 7
0
function print_po()
{
    global $path_to_root;
    include_once $path_to_root . "reporting/includes/pdf_report.inc";
    $from = $_REQUEST['PARAM_0'];
    $to = $_REQUEST['PARAM_1'];
    $currency = $_REQUEST['PARAM_2'];
    $bankaccount = $_REQUEST['PARAM_3'];
    $email = $_REQUEST['PARAM_4'];
    $comments = $_REQUEST['PARAM_5'];
    if ($from == null) {
        $from = 0;
    }
    if ($to == null) {
        $to = 0;
    }
    $dec = user_price_dec();
    $cols = array(4, 60, 225, 300, 325, 385, 450, 515);
    // $headers in doctext.inc
    $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right');
    $params = array('comments' => $comments, 'bankaccount' => $bankaccount);
    $baccount = get_bank_account($params['bankaccount']);
    $cur = get_company_Pref('curr_default');
    if ($email == 0) {
        $rep = new FrontReport(tr('PURCHASE ORDER'), "PurchaseOrderBulk.pdf", user_pagesize());
        $rep->currency = $cur;
        $rep->Font();
        $rep->Info($params, $cols, null, $aligns);
    }
    for ($i = $from; $i <= $to; $i++) {
        $myrow = get_po($i);
        if ($email == 1) {
            $rep = new FrontReport("", "", user_pagesize());
            $rep->currency = $cur;
            $rep->Font();
            $rep->title = tr('PURCHASE ORDER');
            $rep->filename = "PurchaseOrder" . $i . ".pdf";
            $rep->Info($params, $cols, null, $aligns);
        } else {
            $rep->title = tr('PURCHASE ORDER');
        }
        $rep->Header2($myrow, null, $myrow, $baccount, 8);
        $result = get_po_details($i);
        $SubTotal = 0;
        while ($myrow2 = db_fetch($result)) {
            $Net = round($myrow2["unit_price"] * $myrow2["quantity_ordered"], user_price_dec());
            $SubTotal += $Net;
            $DisplayPrice = number_format2($myrow2["unit_price"], $dec);
            $DisplayQty = number_format2($myrow2["quantity_ordered"], user_qty_dec());
            $DisplayNet = number_format2($Net, $dec);
            //$rep->TextCol(0, 1,	$myrow2['item_code'], -2);
            $rep->TextCol(0, 2, $myrow2['description'], -2);
            $rep->TextCol(2, 3, $myrow2['delivery_date'], -2);
            $rep->TextCol(3, 4, $DisplayQty, -2);
            $rep->TextCol(4, 5, $myrow2['units'], -2);
            $rep->TextCol(5, 6, $DisplayPrice, -2);
            $rep->TextCol(6, 7, $DisplayNet, -2);
            $rep->NewLine(1);
            if ($rep->row < $rep->bottomMargin + 15 * $rep->lineHeight) {
                $rep->Header2($myrow, $branch, $sales_order, $baccount);
            }
        }
        if ($myrow['comments'] != "") {
            $rep->NewLine();
            $rep->TextColLines(1, 5, $myrow['comments'], -2);
        }
        $DisplaySubTot = number_format2($SubTotal, $dec);
        $rep->row = $rep->bottomMargin + 15 * $rep->lineHeight;
        $linetype = true;
        $doctype = 8;
        if ($rep->currency != $myrow['curr_code']) {
            include $path_to_root . "reporting/includes/doctext2.inc";
        } else {
            include $path_to_root . "reporting/includes/doctext.inc";
        }
        $rep->TextCol(3, 6, $doc_Sub_total, -2);
        $rep->TextCol(6, 7, $DisplaySubTot, -2);
        $rep->NewLine();
        $DisplayTotal = number_format2($SubTotal, $dec);
        $rep->Font('bold');
        $rep->TextCol(3, 6, $doc_TOTAL_PO, -2);
        $rep->TextCol(6, 7, $DisplayTotal, -2);
        $rep->Font();
        if ($email == 1) {
            $myrow['contact_email'] = $myrow['email'];
            $myrow['DebtorName'] = $myrow['supp_name'];
            $myrow['reference'] = $myrow['order_no'];
            $rep->End($email, $doc_Order_no . " " . $myrow['reference'], $myrow);
        }
    }
    if ($email == 0) {
        $rep->End();
    }
}
Exemplo n.º 8
0
function print_order_status_list()
{
    global $path_to_root;
    include_once $path_to_root . "reporting/includes/pdf_report.inc";
    $from = $_REQUEST['PARAM_0'];
    $to = $_REQUEST['PARAM_1'];
    $category = $_REQUEST['PARAM_2'];
    $location = $_REQUEST['PARAM_3'];
    $backorder = $_REQUEST['PARAM_4'];
    $comments = $_REQUEST['PARAM_5'];
    $dec = user_qty_dec();
    if ($category == reserved_words::get_all_numeric()) {
        $category = 0;
    }
    if ($location == reserved_words::get_all()) {
        $location = null;
    }
    if ($category == 0) {
        $cat = tr('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($location == null) {
        $loc = tr('All');
    } else {
        $loc = $location;
    }
    if ($backorder == 0) {
        $back = tr('All Orders');
    } else {
        $back = tr('Back Orders Only');
    }
    $cols = array(0, 60, 150, 260, 325, 385, 450, 515);
    $headers2 = array(tr('Order'), tr('Customer'), tr('Branch'), tr('Customer Ref'), tr('Ord Date'), tr('Del Date'), tr('Loc'));
    $aligns = array('left', 'left', 'right', 'right', 'right', 'right', 'right');
    $headers = array(tr('Code'), tr('Description'), tr('Ordered'), tr('Invoiced'), tr('Outstanding'), '');
    $params = array(0 => $comments, 1 => array('text' => tr('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => tr('Category'), 'from' => $cat, 'to' => ''), 3 => array('text' => tr('Location'), 'from' => $loc, 'to' => ''), 4 => array('text' => tr('Selection'), 'from' => $back, 'to' => ''));
    $cols2 = $cols;
    $aligns2 = $aligns;
    $rep = new FrontReport(tr('Order Status Listing'), "OrderStatusListing.pdf", user_pagesize());
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2);
    $rep->Header();
    $orderno = 0;
    $result = GetSalesOrders($from, $to, $category, $location, $backorder);
    while ($myrow = db_fetch($result)) {
        if ($rep->row < $rep->bottomMargin + 2 * $rep->lineHeight) {
            $orderno = 0;
            $rep->Header();
        }
        $rep->NewLine(0, 2, false, $orderno);
        if ($orderno != $myrow['order_no']) {
            if ($orderno != 0) {
                $rep->Line($rep->row);
                $rep->NewLine();
            }
            $rep->TextCol(0, 1, $myrow['order_no']);
            $rep->TextCol(1, 2, get_customer_name($myrow['debtor_no']));
            $rep->TextCol(2, 3, get_branch_name($myrow['branch_code']));
            $rep->TextCol(3, 4, $myrow['customer_ref']);
            $rep->TextCol(4, 5, sql2date($myrow['ord_date']));
            $rep->TextCol(5, 6, sql2date($myrow['delivery_date']));
            $rep->TextCol(6, 7, $myrow['from_stk_loc']);
            $rep->NewLine(2);
            $orderno = $myrow['order_no'];
        }
        $rep->TextCol(0, 1, $myrow['stk_code']);
        $rep->TextCol(1, 2, $myrow['description']);
        $rep->TextCol(2, 3, number_format2($myrow['quantity'], $dec));
        $rep->TextCol(3, 4, number_format2($myrow['qty_sent'], $dec));
        $rep->TextCol(4, 5, number_format2($myrow['quantity'] - $myrow['qty_sent'], $dec));
        if ($myrow['quantity'] - $myrow['qty_sent'] > 0) {
            $rep->Font('italic');
            $rep->TextCol(5, 6, tr('Outstanding'));
            $rep->Font();
        }
        $rep->NewLine();
        if ($rep->row < $rep->bottomMargin + 2 * $rep->lineHeight) {
            $orderno = 0;
            $rep->Header();
        }
    }
    $rep->Line($rep->row);
    $rep->End();
}
Exemplo n.º 9
0
function print_inventory_valuation_report()
{
    global $path_to_root;
    include_once $path_to_root . "reporting/includes/pdf_report.inc";
    $category = $_REQUEST['PARAM_0'];
    $location = $_REQUEST['PARAM_1'];
    $detail = $_REQUEST['PARAM_2'];
    $comments = $_REQUEST['PARAM_3'];
    $dec = user_price_dec();
    if ($category == reserved_words::get_all_numeric()) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = tr('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($location == reserved_words::get_all()) {
        $location = 'all';
    }
    if ($location == 'all') {
        $loc = tr('All');
    } else {
        $loc = $location;
    }
    $cols = array(0, 100, 250, 350, 450, 515);
    $headers = array(tr('Category'), '', tr('Quantity'), tr('Unit Cost'), tr('Value'));
    $aligns = array('left', 'left', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => tr('Category'), 'from' => $cat, 'to' => ''), 2 => array('text' => tr('Location'), 'from' => $loc, 'to' => ''));
    $rep = new FrontReport(tr('Inventory Valuation Report'), "InventoryValReport.pdf", user_pagesize());
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->Header();
    $res = getTransactions($category, $location);
    $total = $grandtotal = 0.0;
    $catt = '';
    while ($trans = db_fetch($res)) {
        if ($catt != $trans['cat_description']) {
            if ($catt != '') {
                if ($detail) {
                    $rep->NewLine(2, 3);
                    $rep->TextCol(0, 4, tr('Total'));
                }
                $rep->Textcol(4, 5, number_format2($total, $dec));
                if ($detail) {
                    $rep->Line($rep->row - 2);
                    $rep->NewLine();
                }
                $rep->NewLine();
                $total = 0.0;
            }
            $rep->TextCol(0, 1, $trans['category_id']);
            $rep->TextCol(1, 2, $trans['cat_description']);
            $catt = $trans['cat_description'];
            if ($detail) {
                $rep->NewLine();
            }
        }
        if ($detail) {
            $rep->NewLine();
            $rep->fontsize -= 2;
            $rep->TextCol(0, 1, $trans['stock_id']);
            $rep->TextCol(1, 2, $trans['description']);
            $rep->TextCol(2, 3, number_format2($trans['QtyOnHand'], user_qty_dec()));
            $rep->TextCol(3, 4, number_format2($trans['UnitCost'], $dec));
            $rep->TextCol(4, 5, number_format2($trans['ItemTotal'], $dec));
            $rep->fontsize += 2;
        }
        $total += $trans['ItemTotal'];
        $grandtotal += $trans['ItemTotal'];
    }
    if ($detail) {
        $rep->NewLine(2, 3);
        $rep->TextCol(0, 4, tr('Total'));
    }
    $rep->Textcol(4, 5, number_format2($total, $dec));
    if ($detail) {
        $rep->Line($rep->row - 2);
        $rep->NewLine();
    }
    $rep->NewLine(2, 1);
    $rep->TextCol(0, 4, tr('Grand Total'));
    $rep->TextCol(4, 5, number_format2($grandtotal, $dec));
    $rep->Line($rep->row - 4);
    $rep->End();
}
Exemplo n.º 10
0
        $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
if ($total_in != 0 || $total_out != 0) {
    start_row("class='inquirybg'");
    label_cell("<b>" . tr("Quantity on hand after") . " " . $_POST['BeforeDate'] . "</b>", "align=center colspan=7");
    qty_cell($after_qty);
    end_row();
}
Exemplo n.º 11
0
function print_deliveries()
{
    global $path_to_root;
    include_once $path_to_root . "reporting/includes/pdf_report.inc";
    $from = $_REQUEST['PARAM_0'];
    $to = $_REQUEST['PARAM_1'];
    $email = $_REQUEST['PARAM_2'];
    $comments = $_REQUEST['PARAM_3'];
    if ($from == null) {
        $from = 0;
    }
    if ($to == null) {
        $to = 0;
    }
    $dec = user_price_dec();
    $fno = explode("-", $from);
    $tno = explode("-", $to);
    $cols = array(5, 70, 260, 340, 365, 420, 470, 520);
    // $headers in doctext.inc
    $aligns = array('left', 'left', 'right', 'left', 'right', 'right', 'right');
    $params = array('comments' => $comments);
    $cur = get_company_Pref('curr_default');
    if ($email == 0) {
        $rep = new FrontReport(tr('DELIVERY'), "DeliveryNoteBulk.pdf", user_pagesize());
        $rep->currency = $cur;
        $rep->fontSize = 10;
        $rep->Font();
        $rep->Info($params, $cols, null, $aligns);
    }
    for ($i = $fno[0]; $i <= $tno[0]; $i++) {
        if (!exists_customer_trans(13, $i)) {
            continue;
        }
        $myrow = get_customer_trans($i, 13);
        $sales_order = get_sales_order_header($myrow["order_"]);
        // ?
        $branch = get_branch($myrow["branch_code"]);
        $lang = $branch["lang_code"];
        // get language from customer
        readstrings($lang);
        $tax_group_id = $branch['tax_group_id'];
        $tax_rate = 0;
        $tax_name = '';
        $msg = "Error retrieving tax values";
        $sql = "select rate from tax_group_items ";
        $sql = $sql . "where tax_group_id=" . $tax_group_id . " limit 1";
        $result1 = db_query($sql, $msg);
        if (db_num_rows($result1) != 0) {
            $myrow1 = db_fetch_row($result1);
            $tax_rate = $myrow1[0];
        }
        $sql = "select name from tax_groups ";
        $sql = $sql . "where id=" . $tax_group_id . " limit 1";
        $result1 = db_query($sql, $msg);
        if (db_num_rows($result1) != 0) {
            $myrow1 = db_fetch_row($result1);
            $tax_name = $myrow1[0];
        }
        $tax_included = 0;
        if ($email == 1) {
            $rep = new FrontReport("", "", user_pagesize());
            $rep->currency = $cur;
            $rep->Font();
            $rep->title = tr('DELIVERY NOTE');
            $rep->filename = "Delivery" . $myrow['reference'] . ".pdf";
            $rep->Info($params, $cols, null, $aligns);
        } else {
            $rep->title = tr('DELIVERY NOTE');
        }
        $rep->Header2($myrow, $branch, $sales_order, '', 13);
        $result = get_customer_trans_details(13, $i);
        $SubTotal = 0;
        while ($myrow2 = db_fetch($result)) {
            $Net = round((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"], user_price_dec());
            $SubTotal += $Net;
            $DisplayPrice = number_format2($myrow2["unit_price"], $dec, 1);
            $DisplayQty = number_format2($myrow2["quantity"], user_qty_dec(), 1);
            $DisplayNet = number_format2($Net, $dec, 1);
            $DisplayDate = sql2date($myrow2["date_from"], 1);
            if ($myrow2["discount_percent"] == 0) {
                $DisplayDiscount = "";
            } else {
                $DisplayDiscount = number_format2($myrow2["discount_percent"] * 100, user_percent_dec(), 1) . "%";
            }
            $rep->TextCol(0, 1, $myrow2['stock_id'], -2);
            $rep->TextCol(1, 2, $DisplayDate . " " . $myrow2['description'], -2);
            $rep->TextCol(2, 3, $DisplayQty, -2);
            $rep->TextCol(3, 4, $myrow2['units'], -2);
            $rep->TextCol(4, 5, $DisplayPrice, -2);
            $rep->TextCol(5, 6, $DisplayDiscount, -2);
            $rep->TextCol(6, 7, $DisplayNet, -2);
            $rep->NewLine(1);
            if ($rep->row < $rep->bottomMargin + 15 * $rep->lineHeight) {
                $rep->Header2($myrow, $branch, $sales_order, '', 13);
            }
        }
        $comments = get_comments(13, $i);
        if ($comments && db_num_rows($comments)) {
            $rep->NewLine();
            while ($comment = db_fetch($comments)) {
                $rep->TextColLines(0, 6, $comment['memo_'], -2);
            }
        }
        $DisplaySubTot = number_format2($SubTotal, $dec, 1);
        $DisplayFreight = number_format2($myrow["ov_freight"], $dec, 1);
        $rep->row = $rep->bottomMargin + 15 * $rep->lineHeight;
        $linetype = true;
        $doctype = 13;
        if ($rep->currency != $myrow['curr_code']) {
            include $path_to_root . "reporting/includes/doctext.inc";
        } else {
            include $path_to_root . "reporting/includes/doctext.inc";
        }
        $amount = $myrow["ov_freight"] + $SubTotal;
        $subtotal3 = number_format2($amount, $dec, 1);
        $rep->TextCol(3, 6, $doc_Sub_total, -2);
        $rep->TextCol(6, 7, $DisplaySubTot, -2);
        $rep->NewLine();
        $rep->TextCol(3, 6, $doc_Shipping, -2);
        $rep->TextCol(6, 7, $DisplayFreight, -2);
        $rep->NewLine();
        $rep->TextCol(3, 6, $doc_Sub_total, -2);
        $rep->TextCol(6, 7, $subtotal3, -2);
        $rep->NewLine();
        $amount_tax = $amount / 100 * $tax_rate;
        if ($rep->currency == 'CHF') {
            $val = $amount_tax;
            $val1 = floatval(intval(round($val * 20, 0)) / 20);
            $amount_tax = $val1;
        }
        $amount_tot = $amount + $amount_tax;
        $DisplayTax = number_format2($amount_tax, $dec, 1);
        $DisplayTotal = number_format2($amount_tot, $dec, 1);
        if ($tax_included) {
            $rep->TextCol(3, 7, $doc_Included . " " . $tax_nmae . " (" . $tax_rate . "%) " . $doc_Amount . ":" . $DisplayTax, -2);
        } else {
            $rep->TextCol(3, 6, $tax_name . " (" . $tax_rate . "%)", -2);
            $rep->TextCol(6, 7, $DisplayTax, -2);
        }
        $rep->NewLine();
        $rep->Font('bold');
        $rep->TextCol(3, 6, $doc_TOTAL_DELIVERY, -2);
        $rep->TextCol(6, 7, $DisplayTotal, -2);
        $rep->Font();
        /*
        			$tax_items = get_customer_trans_tax_details(13, $i);
            		while ($tax_item = db_fetch($tax_items)) 
            		{
            			$DisplayTax = number_format2($tax_item['amount'], $dec,1);
            			if ($tax_item['included_in_price'])
            			{
        					$rep->TextCol(3, 7, $doc_Included . " " . $tax_item['tax_type_name'] . 
        						" (" . $tax_item['rate'] . "%) " . $doc_Amount . ":" . $DisplayTax, -2);
        				}		
            			else
            			{
        					$rep->TextCol(3, 6, $tax_item['tax_type_name'] . " (" . 
        						$tax_item['rate'] . "%)", -2);
        					$rep->TextCol(6, 7,	$DisplayTax, -2);
        				}    			
        				$rep->NewLine();
            		}
            		//$rep->NewLine();
        			$DisplayTotal = number_format2($myrow["ov_freight"] +$myrow["ov_freight_tax"] + $myrow["ov_gst"] +
        				$myrow["ov_amount"],$dec,1);
        			$rep->Font('bold');	
        			$rep->TextCol(3, 6, $doc_TOTAL_DELIVERY, - 2); 
        			$rep->TextCol(6, 7,	$DisplayTotal, -2);
        			$rep->Font();	
        */
        if ($email == 1) {
            $myrow['dimension_id'] = $paylink;
            // helper for pmt link
            if ($myrow['email'] == '') {
                $myrow['email'] = $branch['email'];
                $myrow['DebtorName'] = $branch['br_name'];
            }
            $rep->End($email, $doc_Delivery_no . " " . $myrow['reference'], $myrow, 13);
        }
    }
    if ($email == 0) {
        $rep->End();
    }
}
Exemplo n.º 12
0
//-------------------------------------------------------------------------------------------------
if (isset($_POST['setprefs'])) {
    $theme = user_theme();
    set_user_prefs($_POST['prices'], $_POST['Quantities'], $_POST['Rates'], $_POST['Percent'], check_value('show_gl'), check_value('show_codes'), $_POST['date_format'], $_POST['date_sep'], $_POST['tho_sep'], $_POST['dec_sep'], $_POST['theme'], $_POST['page_size']);
    language::set_language($_POST['language']);
    flush_dir($comp_path . '/' . user_company() . '/js_cache');
    if (user_theme() != $theme) {
        reload_page("");
    }
    display_notification_centered(tr("Display settings have been updated."));
}
start_form();
start_table($table_style2);
table_section_title(tr("Decimal Places"));
text_row_ex(tr("Prices/Amounts:"), 'prices', 5, 5, user_price_dec());
text_row_ex(tr("Quantities:"), 'Quantities', 5, 5, user_qty_dec());
text_row_ex(tr("Exchange Rates:"), 'Rates', 5, 5, user_exrate_dec());
text_row_ex(tr("Percentages:"), 'Percent', 5, 5, user_percent_dec());
table_section_title(tr("Dateformat and Separators"));
dateformats_list_row(tr("Dateformat:"), "date_format", user_date_format());
dateseps_list_row(tr("Date Separator:"), "date_sep", user_date_sep());
/* The array $dateseps is set up in config.php for modifications
possible separators can be added by modifying the array definition by editing that file */
thoseps_list_row(tr("Thousand Separator:"), "tho_sep", user_tho_sep());
/* The array $thoseps is set up in config.php for modifications
possible separators can be added by modifying the array definition by editing that file */
decseps_list_row(tr("Decimal Separator:"), "dec_sep", user_dec_sep());
/* The array $decseps is set up in config.php for modifications
possible separators can be added by modifying the array definition by editing that file */
table_section_title(tr("Miscellaneous"));
check_row(tr("Show GL Information:"), 'show_gl', user_show_gl_info());
 function small_qty_cells($label, $name, $init = null, $params = null, $post_label = null, $dec = null)
 {
     if (!isset($dec)) {
         $dec = user_qty_dec();
     }
     $this->amount_cells_ex($label, $name, 7, 12, $init, $params, $post_label, $dec);
 }
Exemplo n.º 14
0
function printit($from, $to, $currency, $bank, $email, $quote, $comments, $file)
{
    global $path_to_root;
    global $print_as_quote;
    include_once $path_to_root . "reporting/includes/pdf_report.inc";
    $dec = user_price_dec();
    $cols = array(5, 70, 260, 340, 365, 420, 470, 520);
    // $headers in doctext.inc
    $aligns = array('left', 'left', 'right', 'left', 'right', 'right', 'right');
    $params = array('comments' => $comments, 'bankaccount' => $bankaccount);
    $baccount = get_bank_account($params['bankaccount']);
    $cur = get_company_Pref('curr_default');
    if ($quote == 1) {
        $print_as_quote = 1;
    }
    if ($email == 0) {
        if ($quote == 1) {
            $rep = new FrontReport(tr("QUOTE"), "QuoteBulk.pdf", user_pagesize());
        } else {
            $rep = new FrontReport(tr("SALES ORDER"), "SalesOrderBulk.pdf", user_pagesize());
        }
        $rep->currency = $cur;
        $rep->fontSize = 10;
        $rep->Font();
        $rep->Info($params, $cols, null, $aligns);
    }
    for ($i = $from; $i <= $to; $i++) {
        $myrow = get_sales_order_header($i);
        $branch = get_branch($myrow["branch_code"]);
        $lang = $branch["lang_code"];
        // get language from customer
        readstrings($lang);
        $tax_group_id = $branch['tax_group_id'];
        $tax_rate = 0;
        $tax_name = '';
        $msg = "Error retrieving tax values";
        $sql = "select rate from tax_group_items ";
        $sql = $sql . "where tax_group_id=" . $tax_group_id . " limit 1";
        $result1 = db_query($sql, $msg);
        if (db_num_rows($result1) != 0) {
            $myrow1 = db_fetch_row($result1);
            $tax_rate = $myrow1[0];
        }
        $sql = "select name from tax_groups ";
        $sql = $sql . "where id=" . $tax_group_id . " limit 1";
        $result1 = db_query($sql, $msg);
        if (db_num_rows($result1) != 0) {
            $myrow1 = db_fetch_row($result1);
            $tax_name = $myrow1[0];
        }
        $tax_included = 0;
        if ($email == 1) {
            $rep = new FrontReport("", "", user_pagesize());
            $rep->currency = $cur;
            $rep->Font();
            if ($quote == 1) {
                $rep->title = tr("QUOTE");
                $rep->filename = "Quote" . $i . ".pdf";
            } else {
                $rep->title = tr("SALES ORDER");
                $rep->filename = "SalesOrder" . $i . ".pdf";
            }
            $rep->Info($params, $cols, null, $aligns);
        } else {
            $rep->title = $quote == 1 ? tr("QUOTE") : tr("SALES ORDER");
        }
        $rep->Header2($myrow, $branch, $myrow, $baccount, 9);
        $result = get_sales_order_details($i);
        $SubTotal = 0;
        while ($myrow2 = db_fetch($result)) {
            $Net = round((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"], user_price_dec());
            $SubTotal += $Net;
            $DisplayPrice = number_format2($myrow2["unit_price"], $dec, 1);
            $DisplayQty = number_format2($myrow2["quantity"], user_qty_dec(), 1);
            $DisplayNet = number_format2($Net, $dec, 1);
            $DisplayDate = sql2date($myrow2["date_from"], 1);
            if ($myrow2["discount_percent"] == 0) {
                $DisplayDiscount = "";
            } else {
                $DisplayDiscount = number_format2($myrow2["discount_percent"] * 100, user_percent_dec(), 1) . "%";
            }
            $rep->TextCol(0, 1, $myrow2['stk_code'], -2);
            $rep->TextCol(1, 2, $DisplayDate . " " . $myrow2['description'], -2);
            $rep->TextCol(2, 3, $DisplayQty, -2);
            $rep->TextCol(3, 4, $myrow2['units'], -2);
            $rep->TextCol(4, 5, $DisplayPrice, -2);
            $rep->TextCol(5, 6, $DisplayDiscount, -2);
            $rep->TextCol(6, 7, $DisplayNet, -2);
            $rep->NewLine(1);
            if ($rep->row < $rep->bottomMargin + 15 * $rep->lineHeight) {
                $rep->Header2($myrow, $branch, $sales_order, $baccount);
            }
            if ($myrow2['notes'] != "") {
                $rep->TextColLines(1, 2, $myrow2['notes'], -2);
            }
        }
        if ($myrow['comments'] != "") {
            $rep->NewLine();
            $rep->TextColLines(1, 5, $myrow['comments'], -2);
        }
        $DisplaySubTot = number_format2($SubTotal, $dec, 1);
        $DisplayFreight = number_format2($myrow["freight_cost"], $dec, 1);
        $rep->row = $rep->bottomMargin + 15 * $rep->lineHeight;
        $linetype = true;
        $doctype = 9;
        if ($rep->currency != $myrow['curr_code']) {
            include $path_to_root . "reporting/includes/doctext.inc";
        } else {
            include $path_to_root . "reporting/includes/doctext.inc";
        }
        $amount = $myrow["freight_cost"] + $SubTotal;
        $subtotal3 = number_format2($amount, $dec, 1);
        $rep->TextCol(3, 6, $doc_Sub_total, -4);
        $rep->TextCol(6, 7, $DisplaySubTot, -4);
        $rep->NewLine();
        $rep->TextCol(3, 6, $doc_Shipping, -3);
        $rep->TextCol(6, 7, $DisplayFreight, -3);
        $rep->NewLine();
        $rep->TextCol(3, 6, $doc_Sub_total, -2);
        $rep->TextCol(6, 7, $subtotal3, -2);
        $rep->NewLine();
        $amount_tax = $amount / 100 * $tax_rate;
        if ($rep->currency == 'CHF') {
            $val = $amount_tax;
            $val1 = floatval(intval(round($val * 20, 0)) / 20);
            $amount_tax = $val1;
        }
        $amount_tot = $amount + $amount_tax;
        $DisplayTax = number_format2($amount_tax, $dec, 1);
        $DisplayTotal = number_format2($amount_tot, $dec, 1);
        if ($tax_included) {
            $rep->TextCol(3, 7, $doc_Included . " " . $tax_nmae . " (" . $tax_rate . "%) " . $doc_Amount . ":" . $DisplayTax, -2);
        } else {
            $rep->TextCol(3, 6, $tax_name . " (" . $tax_rate . "%)", -2);
            $rep->TextCol(6, 7, $DisplayTax, -2);
        }
        $rep->NewLine();
        $rep->Font('bold');
        $rep->TextCol(3, 6, $doc_TOTAL_ORDER_INCL, -2);
        $rep->TextCol(6, 7, $DisplayTotal, -2);
        $rep->Font();
        if ($email == 1) {
            if ($myrow['contact_email'] == '') {
                $myrow['contact_email'] = $branch['email'];
                $myrow['DebtorName'] = $branch['br_name'];
            }
            $rep->End($file);
        }
    }
    if ($email == 0) {
        $rep->End($file);
    }
}
Exemplo n.º 15
0
function print_stock_check()
{
    global $comp_path, $path_to_root, $pic_height, $pic_width;
    include_once $path_to_root . "reporting/includes/pdf_report.inc";
    $category = $_REQUEST['PARAM_0'];
    $location = $_REQUEST['PARAM_1'];
    $pictures = $_REQUEST['PARAM_2'];
    $comments = $_REQUEST['PARAM_3'];
    $dec = user_qty_dec();
    if ($category == reserved_words::get_all_numeric()) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = tr('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($location == reserved_words::get_all()) {
        $location = 'all';
    }
    if ($location == 'all') {
        $loc = tr('All');
    } else {
        $loc = $location;
    }
    $cols = array(0, 100, 305, 375, 445, 515);
    $headers = array(tr('Category'), tr('Description'), tr('Quantity'), tr('Demand'), tr('Difference'));
    $aligns = array('left', 'left', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => tr('Category'), 'from' => $cat, 'to' => ''), 2 => array('text' => tr('Location'), 'from' => $loc, 'to' => ''));
    if ($pictures) {
        $user_comp = user_company();
    } else {
        $user_comp = "";
    }
    $rep = new FrontReport(tr('Stock Check Sheets'), "StockCheckSheet.pdf", user_pagesize());
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->Header();
    $res = getTransactions($category, $location);
    $catt = '';
    while ($trans = db_fetch($res)) {
        if ($catt != $trans['cat_description']) {
            if ($catt != '') {
                $rep->Line($rep->row - 2);
                $rep->NewLine(2, 3);
            }
            $rep->TextCol(0, 1, $trans['category_id']);
            $rep->TextCol(1, 2, $trans['cat_description']);
            $catt = $trans['cat_description'];
            $rep->NewLine();
        }
        $demandqty = getDemandQty($trans['stock_id'], $trans['loc_code']);
        $demandqty += getDemandAsmQty($trans['stock_id'], $trans['loc_code']);
        $rep->NewLine();
        $rep->TextCol(0, 1, $trans['stock_id']);
        $rep->TextCol(1, 2, $trans['description']);
        $rep->TextCol(2, 3, number_format2($trans['QtyOnHand'], $dec));
        $rep->TextCol(3, 4, number_format2($demandqty, $dec));
        $rep->TextCol(4, 5, number_format2($trans['QtyOnHand'] - $demandqty, $dec));
        if ($pictures) {
            $image = $comp_path . '/' . $user_comp . '/images/' . $trans['stock_id'] . '.jpg';
            if (file_exists($image)) {
                $rep->NewLine();
                if ($rep->row - $height < $rep->bottomMargin) {
                    $rep->Header();
                }
                $rep->AddImage($image, $rep->cols[1], $rep->row - $pic_height, $pic_width, $pic_height);
                $rep->row -= $pic_height;
                $rep->NewLine();
            }
        }
    }
    $rep->Line($rep->row - 4);
    $rep->End();
}
Exemplo n.º 16
0
stock_item_heading($_POST['stock_id']);
set_global_stock_item($_POST['stock_id']);
start_table("{$table_style} width=30%");
$th = array(tr("Location"), tr("Quantity On Hand"), tr("Re-Order Level"));
table_header($th);
$j = 1;
$k = 0;
//row colour counter
$result = get_loc_details($_POST['stock_id']);
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    if (isset($_POST['UpdateData']) && check_num($myrow["loc_code"])) {
        $myrow["reorder_level"] = input_num($myrow["loc_code"]);
        set_reorder_level($_POST['stock_id'], $myrow["loc_code"], input_num($myrow["loc_code"]));
    }
    $qoh = get_qoh_on_date($_POST['stock_id'], $myrow["loc_code"]);
    label_cell($myrow["location_name"]);
    $_POST[$myrow["loc_code"]] = qty_format($myrow["reorder_level"]);
    label_cell(number_format2($qoh, user_qty_dec()), "nowrap align='right'");
    qty_cells(null, $myrow["loc_code"]);
    end_row();
    $j++;
    if ($j == 12) {
        $j = 1;
        table_header($th);
    }
}
end_table(1);
submit('UpdateData', tr("Update"));
end_form();
end_page();