function print_purchases_cost()
{
    global $path_to_root;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $destination = $_POST['PARAM_2'];
    $orientation = $_POST['PARAM_3'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $dec = user_price_dec();
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    $cols = array(0, 20, 55, 85, 125, 200, 230, 260, 290, 325, 350, 375, 425, 475);
    //14 headers + 1 lagi dapat for cols
    //todo: format date paid to 2 digits representation only i.e. 12/12/12
    $headers = array(_('CV#'), _('Date Paid'), _('OR #'), _('Supplier'), _('Title of Book'), _('Quantity'), _('Unit Cost'), _('Amount'), _('With Tax'), _('Net'), _('PO #'), _('Stock Supplied'), _('Stock Amount'), _('Total Amount'));
    //todo: Date Paid, OR(official receipt number) Amount, w/tax, net, Stock supplied, stock amount and total amount
    // Possible tables to read on:  grn_batch and grn_items
    $aligns = array('left', 'left', 'left', 'left', 'left', 'left', 'left', 'left', 'left', 'left', 'left', 'left', 'left', 'left');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''));
    $rep = new FrontReport(_('Summary of Purchases at Cost Report'), "SummaryPurchasesCostReport", user_pagesize(), 8, 'L');
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $res = getTransactions($from, $to);
    $total = $grandtotal = 0.0;
    $total1 = $grandtotal1 = 0.0;
    $total2 = $grandtotal2 = 0.0;
    $catt = '';
    while ($trans = db_fetch($res)) {
        $rep->NewLine();
        $rep->fontSize -= 2;
        $rep->TextCol(3, 4, $trans['supp_name']);
        $rep->TextCol(4, 5, $trans['description']);
        $rep->AmountCol(5, 6, $trans['quantity_ordered']);
        $rep->AmountCol(6, 7, $trans['unit_price']);
        $rep->AmountCol(10, 11, $trans['order_no']);
    }
    $rep->NewLine(2, 3);
    $rep->TextCol(0, 4, _('Total'));
    $rep->AmountCol(4, 5, $total, $dec);
    $rep->Line($rep->row - 2);
    $rep->NewLine();
    $rep->NewLine(2, 1);
    $rep->TextCol(0, 4, _('Grand Total'));
    $rep->AmountCol(4, 5, $grandtotal, $dec);
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
function print_inventory_sales()
{
    global $path_to_root;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $destination = $_POST['PARAM_2'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $dec = user_price_dec();
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    $cols = array(0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1050, 1100, 1150, 1200);
    $headers = array(_('DATE'), _('PAYEES'), _('PARTICULARS'), _('GV NO'), _('CHECK NO'), _('CASH IN'), _('PURCHASES'), _('SALARIES &'), _('SUPPLIES'), _('GASOLINE &'), _('LIGHT &'), _('TELECOMS'), _('REPAIRS'), _('REPRESENTATION'), _('TRANSPORTATION'), _('POSTAGE'), _('AD &'), _('PROF.'), _('INSURANCE'), _('CASH'), _('SUNDRY'), _('DEBIT'), _('CREDIT'));
    $header2 = array(_(''), '', '', '', _(''), _('BANK'), _(''), _('WAGES'), _(''), _('OIL'), _('WATER'), _(''), _('& MAINT.'), _('EXPENSE'), _('EXPENSE'), _('& COURIER'), _('PROMO'), _('FEES'), _(''), _('ADVANCE'), _('ACCOUNTS'));
    $aligns = array('left', 'center', 'center', 'center', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''));
    $rep = new FrontReport(_('Cash Disbursement Summary'), "CashDisbursementSummary", user_pagesize(), 8, 'L');
    $rep->Font();
    $rep->Info($params, $cols, $header2, $aligns, $cols, $headers, $aligns);
    $rep->NewPage();
    $salary = '6-1010';
    $purchase = '5-1010';
    $supplies = '6-1175';
    $gas_oil = '6-1110';
    $light_water = '6-1075';
    $tel = '6-1080';
    $repair = '6-1085';
    $representation = '6-1055';
    $transport = '6-1070';
    $postage = '6-1155';
    $ad_promo = '6-1230';
    $prof_fee = '6-1185';
    $insurance = '6-1105';
    $cash_advance = '1-2045';
    $petty_cash = '1-1010';
    $res = getTransactions($from, $to);
    $previous = '';
    $var = array($salary, $purchase, $gas_oil, $light_water, $tel, $repair, $representation, $transport, $postage, $ad_promo, $prof_fee, $insurance, $cash_advance);
    $total = 0;
    $purchase_total = 0;
    $sal_total = 0;
    $sup_total = 0;
    $gas_total = 0;
    $light_total = 0;
    $tel_total = 0;
    $repair_total = 0;
    $rep_total = 0;
    $trans_total = 0;
    $post_total = 0;
    $ad_total = 0;
    $prof_total = 0;
    $ins_total = 0;
    $adv_total = 0;
    $dr = 0;
    $cr = 0;
    $sun_bank_name = '';
    $sun_bank_amount = '';
    while ($myrow = db_fetch($res)) {
        $check = $myrow['customized_no'];
        $current = $check;
        $name = payment_person_name($myrow["person_type_id"], $myrow["person_id"]);
        $comment = get_comments_string($myrow['type'], $myrow['type_no']);
        $account_name = get_gl_account_name($myrow['account']);
        //$rep->NewLine();
        if ($current != '') {
            if ($previous == $current) {
                if ($myrow['type'] == '') {
                    if (is_bank_account($myrow['account'])) {
                        if ($myrow['account'] != $petty_cash) {
                            $rep->AmountCol(5, 6, abs($myrow['amount']), 2);
                            $total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $purchase) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(6, 7, abs($myrow['amount']), 2);
                            $purchase_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $salary) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(7, 8, abs($myrow['amount']), 2);
                            $sal_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $supplies) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(8, 9, abs($myrow['amount']), 2);
                            $sup_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $gas_oil) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(9, 10, abs($myrow['amount']), 2);
                            $gas_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $light_water) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(10, 11, abs($myrow['amount']), 2);
                            $light_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $tel) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(11, 12, abs($myrow['amount']), 2);
                            $tel_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $repair) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(12, 13, abs($myrow['amount']), 2);
                            $repair_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $representation) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(13, 14, abs($myrow['amount']), 2);
                            $rep_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $transport) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(14, 15, abs($myrow['amount']), 2);
                            $trans_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $postage) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(15, 16, abs($myrow['amount']), 2);
                            $post_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $ad_promo) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(16, 17, abs($myrow['amount']), 2);
                            $ad_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $prof_fee) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(17, 18, abs($myrow['amount']), 2);
                            $prof_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $insurance) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(18, 19, abs($myrow['amount']), 2);
                            $ins_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $cash_advance) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(19, 20, abs($myrow['amount']), 2);
                            $adv_total += abs($myrow['amount']);
                        }
                    }
                }
            } else {
                if ($sun_bank_amount != 0 && $sun_bank_name != '') {
                    $rep->TextCol(20, 21, $account_name);
                    $rep->AmountCol(21, 22, $myrow['amount'], 2);
                    $rep->NewLine();
                }
                $result = get_sundry($previous);
                $ctr = 0;
                while ($row = db_fetch($result)) {
                    if ($row['type'] == "") {
                        if (!is_bank_account($row['account'])) {
                            $yes = check_account($row['account'], $row['amount']);
                            if ($yes) {
                                // $rep->TextCol(22, 23, $check_account($row['account']));
                                $ctr++;
                                if ($ctr > 1) {
                                    $rep->NewLine();
                                }
                                $account_name2 = get_gl_account_name($row['account']);
                                $rep->TextCol(20, 21, $account_name2);
                                if ($row['amount'] > 0) {
                                    $rep->AmountCol(21, 22, $row['amount'], 2);
                                    $dr += abs($myrow['amount']);
                                } else {
                                    $rep->AmountCol(22, 23, abs($row['amount']), 2);
                                    $cr += abs($myrow['amount']);
                                }
                            }
                        }
                    }
                }
                $rep->NewLine();
                if ($myrow['type'] == '') {
                    $rep->TextCol(0, 1, $myrow['tranDate']);
                    $rep->TextCol(1, 2, $name);
                    $rep->TextCol(2, 3, $comment);
                    $rep->TextCol(3, 4, $myrow['customized_no']);
                    $rep->TextCol(4, 5, $myrow['check_num']);
                    if (is_bank_account($myrow['account'])) {
                        if ($myrow['account'] != $petty_cash) {
                            $rep->AmountCol(5, 6, abs($myrow['amount']), 2);
                            $total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $purchase) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(6, 7, abs($myrow['amount']), 2);
                            $purchase_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $salary) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(7, 8, abs($myrow['amount']), 2);
                            $sal_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $supplies) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(8, 9, abs($myrow['amount']), 2);
                            $sup_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $gas_oil) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(9, 10, abs($myrow['amount']), 2);
                            $gas_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $light_water) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(10, 11, abs($myrow['amount']), 2);
                            $light_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $tel) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(11, 12, abs($myrow['amount']), 2);
                            $tel_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $repair) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(12, 13, abs($myrow['amount']), 2);
                            $repair_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $representation) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(13, 14, abs($myrow['amount']), 2);
                            $rep_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $transport) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(14, 15, abs($myrow['amount']), 2);
                            $trans_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $postage) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(15, 16, abs($myrow['amount']), 2);
                            $post_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $ad_promo) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(16, 17, abs($myrow['amount']), 2);
                            $ad_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $prof_fee) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(17, 18, abs($myrow['amount']), 2);
                            $prof_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $insurance) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(18, 19, abs($myrow['amount']), 2);
                            $ins_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $cash_advance) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(19, 20, abs($myrow['amount']), 2);
                            $adv_total += abs($myrow['amount']);
                        }
                    }
                } else {
                    $rep->TextCol(0, 1, $myrow['tranDate']);
                    $rep->TextCol(1, 2, "Cancelled");
                    $rep->TextCol(2, 3, "");
                    $rep->TextCol(3, 4, $myrow['customized_no']);
                    $rep->TextCol(4, 5, $myrow['check_num']);
                }
            }
            $previous = $current;
        }
    }
    $rep->NewLine();
    $rep->Font('bold');
    $rep->AmountCol(5, 6, $total, 2);
    $rep->AmountCol(6, 7, $purchase_total, 2);
    $rep->AmountCol(7, 8, $sal_total, 2);
    $rep->AmountCol(8, 9, $sup_total, 2);
    $rep->AmountCol(9, 10, $gas_total, 2);
    $rep->AmountCol(10, 11, $light_total, 2);
    $rep->AmountCol(11, 12, $tel_total, 2);
    $rep->AmountCol(12, 13, $repair_total, 2);
    $rep->AmountCol(13, 14, $rep_total, 2);
    $rep->AmountCol(14, 15, $trans_total, 2);
    $rep->AmountCol(15, 16, $post_total, 2);
    $rep->AmountCol(16, 17, $ad_total, 2);
    $rep->AmountCol(17, 18, $prof_total, 2);
    $rep->AmountCol(18, 19, $ins_total, 2);
    $rep->AmountCol(19, 20, $adv_total, 2);
    $rep->AmountCol(21, 22, $dr, 2);
    $rep->AmountCol(22, 23, $cr, 2);
    /* $i = 0;
       $k = 1;
       foreach($var as $vars)
       {
           $tots = getTotal($vars);
           $rep->AmountCol($i, $k, $tots, 2);
           $i++;
           $j++;
       }*/
    $rep->End();
}
示例#3
0
function inventory_movements()
{
    global $path_to_root;
    $from_date = $_POST['PARAM_0'];
    $to_date = $_POST['PARAM_1'];
    $category = $_POST['PARAM_2'];
    $location = $_POST['PARAM_3'];
    $comments = $_POST['PARAM_4'];
    $orientation = $_POST['PARAM_5'];
    $destination = $_POST['PARAM_6'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($location == '') {
        $loc = _('All');
    } else {
        $loc = get_location_name($location);
    }
    $cols = array(0, 60, 130, 160, 185, 215, 250, 275, 305, 340, 365, 395, 430, 455, 485, 520);
    $headers = array(_('Category'), _('Description'), _('UOM'), '', '', _('OpeningStock'), '', '', _('StockIn'), '', '', _('Delivery'), '', '', _('ClosingStock'));
    $headers2 = array("", "", "", _("QTY"), _("Rate"), _("Value"), _("QTY"), _("Rate"), _("Value"), _("QTY"), _("Rate"), _("Value"), _("QTY"), _("Rate"), _("Value"));
    $aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from_date, 'to' => $to_date), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 3 => array('text' => _('Location'), 'from' => $loc, 'to' => ''));
    $rep = new FrontReport(_('Costed Inventory Movements'), "CostedInventoryMovements", user_pagesize(), 8, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers2, $aligns, $cols, $headers, $aligns);
    $rep->NewPage();
    $totval_open = $totval_in = $totval_out = $totval_close = 0;
    $result = fetch_items($category);
    $dec = user_price_dec();
    $catgor = '';
    while ($myrow = db_fetch($result)) {
        if ($catgor != $myrow['description']) {
            $rep->NewLine(2);
            $rep->fontSize += 2;
            $rep->TextCol(0, 3, $myrow['category_id'] . " - " . $myrow['description']);
            $catgor = $myrow['description'];
            $rep->fontSize -= 2;
            $rep->NewLine();
        }
        $rep->NewLine();
        $rep->TextCol(0, 1, $myrow['stock_id']);
        $rep->TextCol(1, 2, $myrow['name']);
        $rep->TextCol(2, 3, $myrow['units']);
        $qoh_start = get_qoh_on_date($myrow['stock_id'], $location, add_days($from_date, -1));
        $qoh_end = get_qoh_on_date($myrow['stock_id'], $location, $to_date);
        $inward = trans_qty($myrow['stock_id'], $location, $from_date, $to_date);
        $outward = trans_qty($myrow['stock_id'], $location, $from_date, $to_date, false);
        $openCost = avg_unit_cost($myrow['stock_id'], $location, $from_date);
        $unitCost = avg_unit_cost($myrow['stock_id'], $location, add_days($to_date, 1));
        $rep->AmountCol(3, 4, $qoh_start, get_qty_dec($myrow['stock_id']));
        $rep->AmountCol(4, 5, $openCost, $dec);
        $openCost *= $qoh_start;
        $totval_open += $openCost;
        $rep->AmountCol(5, 6, $openCost);
        if ($inward > 0) {
            $rep->AmountCol(6, 7, $inward, get_qty_dec($myrow['stock_id']));
            $unitCost_in = trans_qty_unit_cost($myrow['stock_id'], $location, $from_date, $to_date);
            $rep->AmountCol(7, 8, $unitCost_in, $dec);
            $unitCost_in *= $inward;
            $totval_in += $unitCost_in;
            $rep->AmountCol(8, 9, $unitCost_in);
        }
        if ($outward > 0) {
            $rep->AmountCol(9, 10, $outward, get_qty_dec($myrow['stock_id']));
            $unitCost_out = trans_qty_unit_cost($myrow['stock_id'], $location, $from_date, $to_date, false);
            $rep->AmountCol(10, 11, $unitCost_out, $dec);
            $unitCost_out *= $outward;
            $totval_out += $unitCost_out;
            $rep->AmountCol(11, 12, $unitCost_out);
        }
        $rep->AmountCol(12, 13, $qoh_end, get_qty_dec($myrow['stock_id']));
        $rep->AmountCol(13, 14, $unitCost, $dec);
        $unitCost *= $qoh_end;
        $totval_close += $unitCost;
        $rep->AmountCol(14, 15, $unitCost);
        $rep->NewLine(0, 1);
    }
    $rep->Line($rep->row - 4);
    $rep->NewLine(2);
    $rep->TextCol(0, 1, _("Total"));
    $rep->AmountCol(5, 6, $totval_open);
    $rep->AmountCol(8, 9, $totval_in);
    $rep->AmountCol(11, 12, $totval_out);
    $rep->AmountCol(14, 15, $totval_close);
    $rep->Line($rep->row - 4);
    $rep->End();
}
示例#4
0
function print_stock_check()
{
    global $path_to_root, $pic_height;
    $category = $_POST['PARAM_0'];
    $location = $_POST['PARAM_1'];
    $pictures = $_POST['PARAM_2'];
    $check = $_POST['PARAM_3'];
    $shortage = $_POST['PARAM_4'];
    $no_zeros = $_POST['PARAM_5'];
    $like = $_POST['PARAM_6'];
    $comments = $_POST['PARAM_7'];
    $orientation = $_POST['PARAM_8'];
    $destination = $_POST['PARAM_9'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($location == ALL_TEXT) {
        $location = 'all';
    }
    if ($location == 'all') {
        $loc = _('All');
    } else {
        $loc = get_location_name($location);
    }
    if ($shortage) {
        $short = _('Yes');
        $available = _('Shortage');
    } else {
        $short = _('No');
        $available = _('Available');
    }
    if ($no_zeros) {
        $nozeros = _('Yes');
    } else {
        $nozeros = _('No');
    }
    if ($check) {
        $cols = array(0, 75, 225, 250, 295, 345, 390, 445, 515);
        $headers = array(_('Stock ID'), _('Description'), _('UOM'), _('Quantity'), _('Check'), _('Demand'), $available, _('On Order'));
        $aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right', 'right');
    } else {
        $cols = array(0, 75, 225, 250, 315, 380, 445, 515);
        $headers = array(_('Stock ID'), _('Description'), _('UOM'), _('Quantity'), _('Demand'), $available, _('On Order'));
        $aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right');
    }
    $params = array(0 => $comments, 1 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 2 => array('text' => _('Location'), 'from' => $loc, 'to' => ''), 3 => array('text' => _('Only Shortage'), 'from' => $short, 'to' => ''), 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => ''));
    if ($pictures) {
        $user_comp = user_company();
    } else {
        $user_comp = "";
    }
    $rep = new FrontReport(_('Stock Check Sheets'), "StockCheckSheet", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $res = getTransactions($category, $location, $like);
    $catt = '';
    while ($trans = db_fetch($res)) {
        if ($location == 'all') {
            $loc_code = "";
        } else {
            $loc_code = $location;
        }
        $demandqty = get_demand_qty($trans['stock_id'], $loc_code);
        $demandqty += get_demand_asm_qty($trans['stock_id'], $loc_code);
        $onorder = get_on_porder_qty($trans['stock_id'], $loc_code);
        $flag = get_mb_flag($trans['stock_id']);
        if ($flag == 'M') {
            $onorder += get_on_worder_qty($trans['stock_id'], $loc_code);
        }
        if ($no_zeros && $trans['QtyOnHand'] == 0 && $demandqty == 0 && $onorder == 0) {
            continue;
        }
        if ($shortage && $trans['QtyOnHand'] - $demandqty >= 0) {
            continue;
        }
        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();
        }
        $rep->NewLine();
        $dec = get_qty_dec($trans['stock_id']);
        $rep->TextCol(0, 1, $trans['stock_id']);
        $rep->TextCol(1, 2, $trans['description'] . ($trans['inactive'] == 1 ? " (" . _("Inactive") . ")" : ""), -1);
        $rep->TextCol(2, 3, $trans['units']);
        $rep->AmountCol(3, 4, $trans['QtyOnHand'], $dec);
        if ($check) {
            $rep->TextCol(4, 5, "_________");
            $rep->AmountCol(5, 6, $demandqty, $dec);
            $rep->AmountCol(6, 7, $trans['QtyOnHand'] - $demandqty, $dec);
            $rep->AmountCol(7, 8, $onorder, $dec);
        } else {
            $rep->AmountCol(4, 5, $demandqty, $dec);
            $rep->AmountCol(5, 6, $trans['QtyOnHand'] - $demandqty, $dec);
            $rep->AmountCol(6, 7, $onorder, $dec);
        }
        if ($pictures) {
            $image = company_path() . '/images/' . item_img_name($trans['stock_id']) . '.jpg';
            if (file_exists($image)) {
                $rep->NewLine();
                if ($rep->row - $pic_height < $rep->bottomMargin) {
                    $rep->NewPage();
                }
                $rep->AddImage($image, $rep->cols[1], $rep->row - $pic_height, 0, $pic_height);
                $rep->row -= $pic_height;
                $rep->NewLine();
            }
        }
    }
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
示例#5
0
$action = 'list_products';
// $action = strtolower(filter_input(INPUT_POST, 'action'));
// if ($action == NULL) {
//     $action = strtolower(filter_input(INPUT_GET, 'action'));
//     if ($action == NULL) {
//         $action = 'list_categories';
//     }
// }
switch ($action) {
    case 'list_products':
        $category_id = filter_input(INPUT_GET, 'category_id', FILTER_VALIDATE_INT);
        if ($category_id == NULL || $category_id == FALSE) {
            $category_id = 1;
        }
        $categories = get_categories();
        $category_name = get_category_name($category_id);
        include 'category_list.php';
        break;
    case 'delete_category':
        $category_id = filter_input(INPUT_POST, 'category_id', FILTER_VALIDATE_INT);
        delete_category($category_id);
        header("Location: .");
        break;
    case 'add_category':
        $name = filter_input(INPUT_POST, 'name');
        // Validate inputs
        if (empty($name)) {
            display_error('You must include a name for the category.
                           Please try again.');
        } else {
            $category_id = add_category($name);
    if ($top_item == null || empty($top_item)) {
    } else {
        $primary_id = (int) $top_item[0]['fk_i_item_id'];
        $item = Item::newInstance()->findByPrimaryKey($primary_id);
        View::newInstance()->_exportVariableToView('item', $item);
    }
}
?>
            <?php 
foreach ($sliced_array as $sa) {
    ?>
            <?php 
    $top_item = select_top_item($sa['cat_id']);
    if ($top_item == null || empty($top_item)) {
        $no_item = false;
        $category_name = get_category_name($sa['cat_id']);
    } else {
        $no_item = true;
        $primary_id = (int) $top_item[0]['fk_i_item_id'];
        $item = Item::newInstance()->findByPrimaryKey($primary_id);
        View::newInstance()->_exportVariableToView('item', $item);
        $category_name = get_parent_category_name(osc_item_category_id());
    }
    ?>
                <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
                    <div class="automobile">
                        <h5 class="auto"><?php 
    echo $category_name;
    ?>
</h5>
                        <?php 
示例#7
0
         $catid = 0;
         if (isset($_GET['cat']) && ctype_digit($_GET['cat'])) {
             $catid = clean($_GET['cat']);
         } else {
             if (isset($show)) {
                 $catid = $show;
             }
         }
         if ($ancestors = array_reverse(get_ancestors($catid))) {
             // get ancestors
             $text = '';
             foreach ($ancestors as $a) {
                 $text .= get_category_name($a) . ' > ';
             }
         } else {
             $text = get_category_name($catid);
         }
         echo '<p class="show_owned_where_you_are">Showing fanlistings ' . 'under the <i>' . str_replace('>', '&raquo;', rtrim($text, ' > ')) . '</i> category...</p>';
         if ($status == 'pending') {
             $ids = get_owned_by_category($catid, '0');
         } else {
             if ($status == 'upcoming') {
                 $ids = get_owned_by_category($catid, 1);
             } else {
                 $ids = get_owned_by_category($catid, 2);
             }
         }
     }
 }
 if ((!isset($show_subcats_in_main_list) || !$show_subcats_in_main_list) && isset($_GET['cat'])) {
     // we then have to show the children of this category, if there are
示例#8
0
function print_inventory_sales()
{
    global $path_to_root;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $category = $_POST['PARAM_2'];
    $location = $_POST['PARAM_3'];
    $fromcust = $_POST['PARAM_4'];
    $comments = $_POST['PARAM_5'];
    $orientation = $_POST['PARAM_6'];
    $destination = $_POST['PARAM_7'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    $dec = user_price_dec();
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($location == '') {
        $loc = _('All');
    } else {
        $loc = get_location_name($location);
    }
    if ($fromcust == '') {
        $fromc = _('All');
    } else {
        $fromc = get_customer_name($fromcust);
    }
    $cols = array(0, 75, 175, 250, 300, 375, 450, 515);
    $headers = array(_('Category'), _('Description'), _('Customer'), _('Qty'), _('Sales'), _('Cost'), _('Contribution'));
    if ($fromcust != '') {
        $headers[2] = '';
    }
    $aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 3 => array('text' => _('Location'), 'from' => $loc, 'to' => ''), 4 => array('text' => _('Customer'), 'from' => $fromc, 'to' => ''));
    $rep = new FrontReport(_('Inventory Sales Report'), "InventorySalesReport", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $res = getTransactions($category, $location, $fromcust, $from, $to);
    $total = $grandtotal = 0.0;
    $total1 = $grandtotal1 = 0.0;
    $total2 = $grandtotal2 = 0.0;
    $catt = '';
    while ($trans = db_fetch($res)) {
        if ($catt != $trans['cat_description']) {
            if ($catt != '') {
                $rep->NewLine(2, 3);
                $rep->TextCol(0, 4, _('Total'));
                $rep->AmountCol(4, 5, $total, $dec);
                $rep->AmountCol(5, 6, $total1, $dec);
                $rep->AmountCol(6, 7, $total2, $dec);
                $rep->Line($rep->row - 2);
                $rep->NewLine();
                $rep->NewLine();
                $total = $total1 = $total2 = 0.0;
            }
            $rep->TextCol(0, 1, $trans['category_id']);
            $rep->TextCol(1, 6, $trans['cat_description']);
            $catt = $trans['cat_description'];
            $rep->NewLine();
        }
        $curr = get_customer_currency($trans['debtor_no']);
        $rate = get_exchange_rate_from_home_currency($curr, sql2date($trans['tran_date']));
        $trans['amt'] *= $rate;
        $cb = $trans['amt'] - $trans['cost'];
        $rep->NewLine();
        $rep->fontSize -= 2;
        $rep->TextCol(0, 1, $trans['stock_id']);
        if ($fromcust == ALL_TEXT) {
            $rep->TextCol(1, 2, $trans['description'] . ($trans['inactive'] == 1 ? " (" . _("Inactive") . ")" : ""), -1);
            $rep->TextCol(2, 3, $trans['debtor_name']);
        } else {
            $rep->TextCol(1, 3, $trans['description'] . ($trans['inactive'] == 1 ? " (" . _("Inactive") . ")" : ""), -1);
        }
        $rep->AmountCol(3, 4, $trans['qty'], get_qty_dec($trans['stock_id']));
        $rep->AmountCol(4, 5, $trans['amt'], $dec);
        $rep->AmountCol(5, 6, $trans['cost'], $dec);
        $rep->AmountCol(6, 7, $cb, $dec);
        $rep->fontSize += 2;
        $total += $trans['amt'];
        $total1 += $trans['cost'];
        $total2 += $cb;
        $grandtotal += $trans['amt'];
        $grandtotal1 += $trans['cost'];
        $grandtotal2 += $cb;
    }
    $rep->NewLine(2, 3);
    $rep->TextCol(0, 4, _('Total'));
    $rep->AmountCol(4, 5, $total, $dec);
    $rep->AmountCol(5, 6, $total1, $dec);
    $rep->AmountCol(6, 7, $total2, $dec);
    $rep->Line($rep->row - 2);
    $rep->NewLine();
    $rep->NewLine(2, 1);
    $rep->TextCol(0, 4, _('Grand Total'));
    $rep->AmountCol(4, 5, $grandtotal, $dec);
    $rep->AmountCol(5, 6, $grandtotal1, $dec);
    $rep->AmountCol(6, 7, $grandtotal2, $dec);
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
示例#9
0
}
// show listings
if (isset($_GET['cat']) && $_GET['cat'] != '') {
    // "where you are" text
    if ($_GET['cat'] == 'all' || $_GET['cat'] == 'pending') {
        echo '<p class="show_joined_where_you_are">Showing ' . clean($_GET['cat']) . ' listings...</p>';
    } else {
        $getcat = clean($_GET['cat']);
        if ($ancestors = array_reverse(get_ancestors($getcat))) {
            // get ancestors
            $text = '';
            foreach ($ancestors as $a) {
                $text .= get_category_name($a) . ' > ';
            }
        } else {
            $text = get_category_name($getcat);
        }
        echo '<p class="show_joined_where_you_are">Showing listings ' . 'under the <i>' . str_replace('>', '&raquo;', rtrim($text, ' > ')) . '</i> category...</p>';
    }
    if (!isset($show_subcats_in_main_list) || !$show_subcats_in_main_list) {
        // we then have to show the children of this category, if there are
        $children = get_enth_category_children(clean($_GET['cat']));
        $cats = array();
        foreach ($children as $cat) {
            $cats[] = array('catid' => $cat['catid'], 'text' => $cat['catname'], 'parent' => get_category_parent($cat['catid']), 'qty' => count(get_joined_by_category($cat['catid'])));
        }
        // check for empty categories!
        foreach ($cats as $index => $cat) {
            if ($cat['qty'] == 0) {
                unset($cats[$index]);
            }
示例#10
0
<?php

// include function files for this application
require_once 'book_sc_fns.php';
session_start();
do_html_header("Edit category");
if (check_admin_user()) {
    if ($catname = get_category_name($_GET['catid'])) {
        $catid = $_GET['catid'];
        $cat = compact('catname', 'catid');
        display_category_form($cat);
    } else {
        echo "<p>Could not retrieve category details.</p>";
    }
    do_html_url("admin.php", "Back to administration menu");
} else {
    echo "<p>You are not authorized to enter the administration area.</p>";
}
do_html_footer();
示例#11
0
<?php

// include function files for this application
require_once 'book_sc_fns.php';
session_start();
do_html_header('Edit category');
if (check_admin_user()) {
    if ($catname = get_category_name($HTTP_GET_VARS['catid'])) {
        $catid = $HTTP_GET_VARS['catid'];
        $cat = compact('catname', 'catid');
        display_category_form($cat);
    } else {
        echo 'Could not retrieve category details.<br />';
    }
    do_html_url('admin.php', 'Back to administration menu');
} else {
    echo 'You are not authorized to enter the administration area.';
}
do_html_footer();
示例#12
0
<?php 
    $shade = false;
    foreach ($cats as $cat) {
        $class = $shade ? ' class="rowshade"' : '';
        $shade = !$shade;
        echo "<tr{$class}><td>" . $cat['catid'] . '</td><td>';
        $catstring = '';
        if ($ancestors = array_reverse(get_ancestors($cat['catid']))) {
            // get ancestors
            $text = '';
            foreach ($ancestors as $a) {
                $text .= strlen($text) > 0 ? ' &raquo; ' . get_category_name($a) : get_category_name($a);
            }
            $catstring .= $text;
        } else {
            $catstring = get_category_name($cat['catid']);
        }
        echo $catstring . '</td><td class="center">';
        echo '<a href="?action=edit&id=' . $cat['catid'] . '">' . '<img src="edit.gif" width="42" height="19" alt=" edit" />' . '</a><a href="?action=delete&id=' . $cat['catid'] . '" onclick="go=confirm( \'Are you sure you want to delete category ' . $catstring . '?\' ); return go;"><img src="delete.gif" ' . 'width="42" height="19" alt=" delete" /></a></td></tr>';
    }
    echo '</table>';
    $page_qty = $total / get_setting('per_page');
    $url = $_SERVER['REQUEST_URI'];
    $url = 'categories.php';
    $connector = '?';
    foreach ($_GET as $key => $value) {
        if ($key != 'start' && $key != 'PHPSESSID') {
            $url .= $connector . $key . '=' . $value;
            $connector = '&amp;';
        }
    }
function print_inventory_sales()
{
    global $path_to_root;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $destination = $_POST['PARAM_2'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $dec = user_price_dec();
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    $cols = array(0, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1050, 1100, 1150, 1200, 1250, 1300, 1350, 1400, 1450, 1500, 1550, 1600, 1650, 1700, 1750, 1800);
    $headers = array(_('Account'), _('JANUARY'), _(''), _('FEBRUARY'), _(''), _('MARCH'), _(''), _('APRIL'), _(''), _('MAY'), _(''), _('JUNE'), _(''), _('JULY'), _(''), _('AUGUST'), _(''), _('SEPTEMBER'), _(''), _('OCTOBER'), _(''), _('NOVEMBER'), _(''), _('DECEMBER'));
    $headers2 = array(_(''), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'));
    $aligns = array('left', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''));
    $rep = new FrontReport(_('Recapitulation'), "CashDisbursementSummary", user_pagesize(), 8, 'L');
    $rep->Font();
    $rep->Info($params, $cols, $headers2, $aligns, $cols, $headers, $aligns);
    $rep->NewPage();
    $acc = getExpenseAccount();
    $account = array();
    while ($accs = db_fetch($acc)) {
        array_push($account, $accs['account_code']);
    }
    $year = substr(date2sql($from), 0, 4);
    //$res = getTransactions($from, $to);
    $previous = '';
    $dr = 0;
    $cr = 0;
    // $monthfr = date("n",strtotime($from));
    // $monthto = date("n",strtotime($to));
    $date_from = date2sql($from);
    $date_to = date2sql($to);
    $monthfr = date("n", strtotime($date_from));
    $monthto = date("n", strtotime($date_to));
    //$myrow = 0;
    //$row = 0;
    $row = getTransactions($monthfr, $monthto, $year, $account);
    // $myrow = db_fetch($row);
    foreach ($row as $myrow) {
        $acc_name = get_gl_account_name($myrow[0]);
        $rep->TextCol(0, 1, $acc_name);
        $rep->AmountCol(1, 2, $myrow[1], 2);
        $rep->AmountCol(2, 3, abs($myrow[2]), 2);
        $rep->AmountCol(3, 4, $myrow[3], 2);
        $rep->AmountCol(4, 5, abs($myrow[4]), 2);
        $rep->AmountCol(5, 6, $myrow[5], 2);
        $rep->AmountCol(6, 7, abs($myrow[6]), 2);
        $rep->AmountCol(7, 8, $myrow[7], 2);
        $rep->AmountCol(8, 9, abs($myrow[8]), 2);
        $rep->AmountCol(9, 10, $myrow[9], 2);
        $rep->AmountCol(10, 11, abs($myrow[10]), 2);
        $rep->AmountCol(11, 12, $myrow[11], 2);
        $rep->AmountCol(12, 13, abs($myrow[12]), 2);
        $rep->AmountCol(13, 14, $myrow[13], 2);
        $rep->AmountCol(14, 15, abs($myrow[14]), 2);
        $rep->AmountCol(15, 16, $myrow[15], 2);
        $rep->AmountCol(16, 17, abs($myrow[16]), 2);
        $rep->AmountCol(17, 18, $myrow[17], 2);
        $rep->AmountCol(18, 19, abs($myrow[18]), 2);
        $rep->AmountCol(19, 20, $myrow[19], 2);
        $rep->AmountCol(20, 21, abs($myrow[20]), 2);
        $rep->AmountCol(21, 22, $myrow[21], 2);
        $rep->AmountCol(22, 23, abs($myrow[22]), 2);
        $rep->AmountCol(23, 24, $myrow[23], 2);
        $rep->AmountCol(24, 25, abs($myrow[24]), 2);
        $rep->NewLine();
    }
    $rep->End();
}
示例#14
0
function print_price_listing()
{
    global $comp_path, $path_to_root, $pic_height, $pic_width;
    include_once $path_to_root . "reporting/includes/pdf_report.inc";
    $category = $_REQUEST['PARAM_0'];
    $salestype = $_REQUEST['PARAM_1'];
    $pictures = $_REQUEST['PARAM_2'];
    $showGP = $_REQUEST['PARAM_3'];
    $comments = $_REQUEST['PARAM_4'];
    $dec = user_price_dec();
    if ($category == reserved_words::get_all_numeric()) {
        $category = 0;
    }
    if ($salestype == reserved_words::get_all_numeric()) {
        $salestype = 0;
    }
    if ($category == 0) {
        $cat = tr('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($salestype == 0) {
        $stype = tr('All');
    } else {
        $stype = get_sales_type_name($salestype);
    }
    if ($showGP == 0) {
        $GP = tr('No');
    } else {
        $GP = tr('Yes');
    }
    $cols = array(0, 100, 385, 450, 515);
    $headers = array(tr('Category/Items'), tr('Description'), tr('Price'), tr('GP %'));
    $aligns = array('left', 'left', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => tr('Category'), 'from' => $cat, 'to' => ''), 2 => array('text' => tr('Sales Type'), 'from' => $stype, 'to' => ''), 3 => array('text' => tr('Show GP %'), 'from' => $GP, 'to' => ''));
    if ($pictures) {
        $user_comp = user_company();
    } else {
        $user_comp = "";
    }
    $rep = new FrontReport(tr('Price Listing'), "PriceListing.pdf", user_pagesize());
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->Header();
    $result = fetch_prices($category, $salestype);
    $currcode = '';
    $catgor = '';
    while ($myrow = db_fetch($result)) {
        if ($currcode != $myrow['curr_abrev']) {
            $rep->NewLine(2);
            $rep->fontSize += 2;
            $rep->TextCol(0, 3, $myrow['curr_abrev'] . " " . tr('Prices'));
            $currcode = $myrow['curr_abrev'];
            $rep->fontSize -= 2;
            $rep->NewLine();
        }
        if ($catgor != $myrow['description']) {
            $rep->Line($rep->row - $rep->lineHeight);
            $rep->NewLine(2);
            $rep->fontSize += 2;
            $rep->TextCol(0, 3, $myrow['category_id'] . " - " . $myrow['description']);
            $catgor = $myrow['description'];
            $rep->fontSize -= 2;
            $rep->NewLine();
        }
        $rep->NewLine();
        $rep->TextCol(0, 1, $myrow['stock_id']);
        $rep->TextCol(1, 2, $myrow['name']);
        $rep->TextCol(2, 3, number_format2($myrow['price'], $dec));
        if ($showGP) {
            if ($myrow['price'] != 0.0) {
                $disp = ($myrow['price'] - $myrow['Standardcost']) * 100 / $myrow['price'];
            } else {
                $disp = 0.0;
            }
            $rep->TextCol(3, 4, number_format2($disp, user_percent_dec()) . " %");
        }
        if ($pictures) {
            $image = $comp_path . '/' . $user_comp . "/images/" . $myrow['stock_id'] . ".jpg";
            if (file_exists($image)) {
                $rep->NewLine();
                if ($rep->row - $pic_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();
            }
        } else {
            $rep->NewLine(0, 1);
        }
    }
    $rep->Line($rep->row - 4);
    $rep->End();
}
示例#15
0
        echo $link2;
        ?>
		    <?php 
    }
    ?>


    </td>
    <td><?php 
    echo '<a href="' . url_rewrite('bounce.php?course=' . $row['course_id']) . '"> ' . htmlentities_utf8($row['title']) . '</a>';
    ?>
    <br /><small><?php 
    echo _AT('category');
    ?>
: <?php 
    echo get_category_name($row['cat_id']);
    ?>
</small>
    </td>
    <td><small><?php 
    echo '<a href="' . AT_BASE_HREF . 'inbox/send_message.php?id=' . $row['member_id'] . '">' . get_display_name($row['member_id']) . '</a>';
    ?>
</small></td>
    <td><small>
    <?php 
    if ($_SESSION['member_id'] == $row['member_id']) {
        //if instructor
        echo _AT('instructor');
    } else {
        if ($row['approved'] == 'a') {
            //if alumni
示例#16
0
文件: rep309.php 项目: M-Shahbaz/FA
function print_inventory_sales()
{
    global $path_to_root;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $category = $_POST['PARAM_2'];
    $comments = $_POST['PARAM_3'];
    $orientation = $_POST['PARAM_4'];
    $destination = $_POST['PARAM_5'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    $dec = user_price_dec();
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    $cols = array(0, 100, 260, 300, 350, 425, 430, 515);
    $headers = array(_('Item/Category'), _('Description'), _('Qty'), _('Unit Price'), _('Sales'), '', _('Remark'));
    $aligns = array('left', 'left', 'right', 'right', 'right', 'right', 'left');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''));
    $rep = new FrontReport(_('Item Sales Summary Report'), "ItemSalesSummaryReport", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $res = getTransactions($category, $from, $to);
    $total = $grandtotal = 0.0;
    $total1 = $grandtotal1 = 0.0;
    $total2 = $grandtotal2 = 0.0;
    $catt = '';
    while ($trans = db_fetch($res)) {
        if ($catt != $trans['cat_description']) {
            if ($catt != '') {
                $rep->NewLine(2, 3);
                $rep->TextCol(0, 4, _('Total'));
                $rep->AmountCol(4, 5, $total, $dec);
                $rep->Line($rep->row - 2);
                $rep->NewLine();
                $rep->NewLine();
                $total = $total1 = $total2 = 0.0;
            }
            $rep->TextCol(0, 1, $trans['category_id']);
            $rep->TextCol(1, 7, $trans['cat_description']);
            $catt = $trans['cat_description'];
            $rep->NewLine();
        }
        $rep->NewLine();
        $rep->fontSize -= 2;
        $rep->TextCol(0, 1, $trans['stock_id']);
        $rep->TextCol(1, 2, $trans['description']);
        $rep->AmountCol(2, 3, $trans['quantity'], get_qty_dec($trans['stock_id']));
        $rep->AmountCol(3, 4, $trans['unit_price'], $dec);
        $rep->AmountCol(4, 5, $trans['quantity'] * $trans['unit_price'], $dec);
        if ($trans['unit_price'] == 0) {
            $rep->TextCol(6, 7, _('Gift'));
        }
        $rep->fontSize += 2;
        $total += $trans['quantity'] * $trans['unit_price'];
        $grandtotal += $trans['quantity'] * $trans['unit_price'];
    }
    $rep->NewLine(2, 3);
    $rep->TextCol(0, 4, _('Total'));
    $rep->AmountCol(4, 5, $total, $dec);
    $rep->Line($rep->row - 2);
    $rep->NewLine();
    $rep->NewLine(2, 1);
    $rep->TextCol(0, 4, _('Grand Total'));
    $rep->AmountCol(4, 5, $grandtotal, $dec);
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
示例#17
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();
}
示例#18
0
$cats = '';
$i = 0;
$catsarray = explode('|', $info['catid']);
foreach ($catsarray as $index => $c) {
    if ($c == '') {
        $i++;
        continue;
    }
    // blank
    if ($i == count($catsarray) - 1 && count($catsarray) != 1) {
        $cats .= 'and ';
    }
    $cat = '';
    $aline = get_ancestors($c);
    foreach ($aline as $a) {
        $cat = get_category_name($a) . ' > ' . $cat;
    }
    $cat = rtrim($cat, '> ');
    $cat = str_replace('>', '&raquo;', $cat);
    $cats .= "{$cat}, ";
    $i++;
}
$cats = rtrim($cats, ', ');
// customize template
$template = $info['statstemplate'];
$template = str_replace('$$stat_updated$$', $stats['lastupdated'], $template);
$template = str_replace('$$stat_approved$$', $stats['total'], $template);
$template = str_replace('$$stat_pending$$', $stats['pending'], $template);
$template = str_replace('$$stat_newmembers$$', $stats['new_members'], $template);
// deprecated!
$template = str_replace('$$stat_new_members$$', $stats['new_members'], $template);
示例#19
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();
}
示例#20
0
function inventory_movements()
{
    global $path_to_root;
    $from_date = $_POST['PARAM_0'];
    $to_date = $_POST['PARAM_1'];
    $category = $_POST['PARAM_2'];
    $location = $_POST['PARAM_3'];
    $comments = $_POST['PARAM_4'];
    $orientation = $_POST['PARAM_5'];
    $destination = $_POST['PARAM_6'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    //	if ($location == ALL_TEXT)
    //		$location = '';
    if ($location == '') {
        $loc = _('All');
    } else {
        $loc = get_location_name($location);
    }
    //$cols = array(0, 100, 300, 365, 440, 540, 640, 715);
    $cols = array(0, 60, 220, 240, 310, 380, 450, 520);
    $headers = array(_('Category'), _('Description'), _('UOM'), _('Opening'), _('Quantity In'), _('Quantity Out'), _('Balance'));
    $aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from_date, 'to' => $to_date), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 3 => array('text' => _('Location'), 'from' => $loc, 'to' => ''));
    $rep = new FrontReport(_('Inventory Movements'), "InventoryMovements", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $result = fetch_items($category);
    $catgor = '';
    while ($myrow = db_fetch($result)) {
        if ($catgor != $myrow['description']) {
            $rep->Line($rep->row - $rep->lineHeight);
            $rep->NewLine(2);
            $rep->fontSize += 2;
            $rep->TextCol(0, 3, $myrow['category_id'] . " - " . $myrow['description']);
            $catgor = $myrow['description'];
            $rep->fontSize -= 2;
            $rep->NewLine();
        }
        $rep->NewLine();
        $rep->TextCol(0, 1, $myrow['stock_id']);
        $rep->TextCol(1, 2, $myrow['name']);
        $rep->TextCol(2, 3, $myrow['units']);
        $qoh_start = $inward = $outward = $qoh_end = 0;
        $qoh_start += get_qoh_on_date($myrow['stock_id'], $location, add_days($from_date, -1));
        $qoh_end += get_qoh_on_date($myrow['stock_id'], $location, $to_date);
        $inward += trans_qty($myrow['stock_id'], $location, $from_date, $to_date);
        $outward += trans_qty($myrow['stock_id'], $location, $from_date, $to_date, false);
        $rep->AmountCol(3, 4, $qoh_start, get_qty_dec($myrow['stock_id']));
        $rep->AmountCol(4, 5, $inward, get_qty_dec($myrow['stock_id']));
        $rep->AmountCol(5, 6, $outward, get_qty_dec($myrow['stock_id']));
        $rep->AmountCol(6, 7, $qoh_end, get_qty_dec($myrow['stock_id']));
        $rep->NewLine(0, 1);
    }
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
function print_inventory_sales()
{
    global $path_to_root;
    $from = $_POST['PARAM_0'];
    $destination = $_POST['PARAM_1'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $dec = user_price_dec();
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    $cols = array(0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1050, 1100, 1150, 1200);
    $headers = array(_('Date'), _('Client Name'), _('IMC'), _('Charge'), _('Sales'), _('Date'), _('CM#'), _('Returns'), _(''), _('Discount'), _('Balance'), _('Date'), _('PR/OR#'), _('Date'), _('OR #'), _('Partial'), _('Net'), _('Balance'), _('Date'), _(''), _('Commission'), _('w/tax'), _('Net Commission'));
    $header2 = array(_(''), '', '', _('Invoice'), _('Amount'), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), '', _(''), _(''));
    $aligns = array('left', 'center', 'center', 'center', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''));
    $rep = new FrontReport(_('Series Report'), "Series Report", user_pagesize(), 8, 'L');
    $rep->Font();
    $rep->Info($params, $cols, $header2, $aligns, $cols, $headers, $aligns);
    $rep->NewPage();
    $total = $grandtotal = 0.0;
    $total1 = $grandtotal1 = 0.0;
    $total2 = $grandtotal2 = 0.0;
    $catt = '';
    $res = getTransactions($imc, $from);
    while ($myrow = db_fetch($res)) {
        $company_data = get_company_prefs();
        $branch = get_branch($myrow["branch_code"]);
        $branch_data = get_branch_accounts($myrow['branch_code']);
        $dt = get_discount($branch_data['sales_discount_account'], $myrow['type'], $myrow['trans_no']);
        $salesman = get_imc_code($myrow['branch_code']);
        $res2 = get_return_details($myrow['order_']);
        $returns = 0;
        $rtn_dt = 0;
        while ($myrow2 = db_fetch($res2)) {
            $returns += $myrow2['ov_amount'];
            $credit_num = $myrow2['customized_no'];
            $cm_date = $myrow2['tran_date'];
            $res2 = get_return_discount($branch_data['sales_discount_account'], $myrow2['type'], $myrow2['trans_no']);
            while ($myrow3 = db_fetch($res2)) {
                $rtn_dt += abs($myrow3['amount']);
            }
        }
        $total_returns = $returns + $rtn_dt;
        $return_discount = $rtn_dt / $total_returns * 100;
        $discount = $myrow['discount'];
        $invoicetot = $myrow['ov_amount'] + $dt;
        $sales_discount = ($invoicetot - $total_returns) * ($return_discount / 100);
        $net_sales = $invoicetot - $total_returns - $sales_discount;
        $gross_commission = ($invoicetot - $total_returns) * ($myrow['commission'] / 100);
        $rep->TextCol(0, 1, $myrow['tran_date']);
        $rep->TextCol(1, 2, $myrow['br_name']);
        $rep->TextCol(2, 3, $salesman);
        $rep->TextCol(3, 4, $myrow['customized_no']);
        $rep->AmountCol(4, 5, $invoicetot, 2);
        $rep->TextCol(5, 6, $cm_date);
        $rep->TextCol(6, 7, $credit_num);
        $rep->AmountCol(7, 8, $total_returns, 2);
        $rep->TextCol(8, 9, $return_discount . "%");
        $rep->AmountCol(9, 10, $sales_discount, 2);
        $rep->AmountCol(10, 11, $net_sales, 2);
        $rep->TextCol(18, 19, $myrow['date']);
        $rep->TextCol(19, 20, $myrow['commission'] . "%");
        $rep->AmountCol(20, 21, $gross_commission, 2);
        $rep->AmountCol(21, 22, $myrow['with_tax'], 2);
        $rep->AmountCol(22, 23, $myrow['net_commission'], 2);
        $or = get_pr_details($myrow['type'], $myrow['trans_no']);
        while ($pr = db_fetch($or)) {
            $net_remittance = $net_sales - $pr['amt'];
            $rep->TextCol(11, 12, $pr['date_alloc']);
            $rep->TextCol(12, 13, $pr['customized_no']);
            $rep->TextCol(13, 14, _("DATE"));
            $rep->TextCol(14, 15, _("OR#"));
            $rep->TextCol(15, 16, "");
            $rep->AmountCol(17, 18, '', 2);
        }
        $rep->NewLine();
        //
    }
    $rep->NewLine();
    $rep->End();
}
示例#22
0
        echo $target;
        ?>
"><?php 
        echo $info['subject'];
        ?>
</a></td>
<?php 
        $catstring = '';
        $cats = explode('|', $info['catid']);
        foreach ($cats as $c) {
            if ($c != '') {
                if ($ancestors = array_reverse(get_ancestors($c))) {
                    // get ancestors
                    $text = '';
                    foreach ($ancestors as $a) {
                        $text .= get_category_name($a) . ' > ';
                    }
                    $catstring .= str_replace('>', '&raquo;', rtrim($text, ' > ')) . ', ';
                }
            }
        }
        $catstring = rtrim($catstring, ', ');
        ?>
      <td><?php 
        echo $catstring;
        ?>
</td>
<?php 
        $dir = str_replace('\\', '/', $dir);
        if ($info['imagefile'] != '' && count($image)) {
            echo '<td class="center"><img src="' . $dir . $info['imagefile'] . '" ' . $image[3] . 'border="0" alt="" /></td>';
示例#23
0
function print_inventory_planning()
{
    global $path_to_root;
    $category = $_POST['PARAM_0'];
    $location = $_POST['PARAM_1'];
    $comments = $_POST['PARAM_2'];
    $orientation = $_POST['PARAM_3'];
    $destination = $_POST['PARAM_4'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($location == ALL_TEXT) {
        $location = 'all';
    }
    if ($location == 'all') {
        $loc = _('All');
    } else {
        $loc = get_location_name($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'), 1, date('Y')));
    $per1 = strftime('%b', mktime(0, 0, 0, date('m') - 1, 1, date('Y')));
    $per2 = strftime('%b', mktime(0, 0, 0, date('m') - 2, 1, date('Y')));
    $per3 = strftime('%b', mktime(0, 0, 0, date('m') - 3, 1, date('Y')));
    $per4 = strftime('%b', mktime(0, 0, 0, date('m') - 4, 1, date('Y')));
    $headers = array(_('Category'), '', $per4, $per3, $per2, $per1, $per0, '3*M', _('QOH'), _('Cust Ord'), _('Supp Ord'), _('Sugg Ord'));
    $aligns = array('left', 'left', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 2 => array('text' => _('Location'), 'from' => $loc, 'to' => ''));
    $rep = new FrontReport(_('Inventory Planning Report'), "InventoryPlanning", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $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();
        }
        if ($location == 'all') {
            $loc_code = "";
        } else {
            $loc_code = $location;
        }
        $custqty = get_demand_qty($trans['stock_id'], $loc_code);
        $custqty += get_demand_asm_qty($trans['stock_id'], $loc_code);
        $suppqty = get_on_porder_qty($trans['stock_id'], $loc_code);
        $suppqty += get_on_worder_qty($trans['stock_id'], $loc_code);
        $period = getPeriods($trans['stock_id'], $trans['loc_code']);
        $rep->NewLine();
        $dec = get_qty_dec($trans['stock_id']);
        $rep->TextCol(0, 1, $trans['stock_id']);
        $rep->TextCol(1, 2, $trans['description'] . ($trans['inactive'] == 1 ? " (" . _("Inactive") . ")" : ""), -1);
        $rep->AmountCol(2, 3, $period['prd0'], $dec);
        $rep->AmountCol(3, 4, $period['prd1'], $dec);
        $rep->AmountCol(4, 5, $period['prd2'], $dec);
        $rep->AmountCol(5, 6, $period['prd3'], $dec);
        $rep->AmountCol(6, 7, $period['prd4'], $dec);
        $MaxMthSales = Max($period['prd0'], $period['prd1'], $period['prd2'], $period['prd3']);
        $IdealStockHolding = $MaxMthSales * 3;
        $rep->AmountCol(7, 8, $IdealStockHolding, $dec);
        $rep->AmountCol(8, 9, $trans['qty_on_hand'], $dec);
        $rep->AmountCol(9, 10, $custqty, $dec);
        $rep->AmountCol(10, 11, $suppqty, $dec);
        $SuggestedTopUpOrder = $IdealStockHolding - $trans['qty_on_hand'] + $custqty - $suppqty;
        if ($SuggestedTopUpOrder < 0.0) {
            $SuggestedTopUpOrder = 0.0;
        }
        $rep->AmountCol(11, 12, $SuggestedTopUpOrder, $dec);
    }
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
示例#24
0
function print_price_listing()
{
    global $path_to_root, $pic_height, $pic_width;
    $currency = $_POST['PARAM_0'];
    $category = $_POST['PARAM_1'];
    $salestype = $_POST['PARAM_2'];
    $pictures = $_POST['PARAM_3'];
    $showGP = $_POST['PARAM_4'];
    $comments = $_POST['PARAM_5'];
    $orientation = $_POST['PARAM_6'];
    $destination = $_POST['PARAM_7'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    $dec = user_price_dec();
    $home_curr = get_company_pref('curr_default');
    if ($currency == ALL_TEXT) {
        $currency = $home_curr;
    }
    $curr = get_currency($currency);
    $curr_sel = $currency . " - " . $curr['currency'];
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($salestype == ALL_NUMERIC) {
        $salestype = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($salestype == 0) {
        $stype = _('All');
    } else {
        $stype = get_sales_type_name($salestype);
    }
    if ($showGP == 0) {
        $GP = _('No');
    } else {
        $GP = _('Yes');
    }
    $cols = array(0, 100, 360, 385, 450, 515);
    $headers = array(_('Category/Items'), _('Description'), _('UOM'), _('Price'), _('GP %'));
    $aligns = array('left', 'left', 'left', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Currency'), 'from' => $curr_sel, 'to' => ''), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 3 => array('text' => _('Sales Type'), 'from' => $stype, 'to' => ''), 4 => array('text' => _('Show GP %'), 'from' => $GP, 'to' => ''));
    if ($pictures) {
        $user_comp = user_company();
    } else {
        $user_comp = "";
    }
    $rep = new FrontReport(_('Price Listing'), "PriceListing", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $result = fetch_items($category);
    $catgor = '';
    $_POST['sales_type_id'] = $salestype;
    while ($myrow = db_fetch($result)) {
        if ($catgor != $myrow['description']) {
            $rep->Line($rep->row - $rep->lineHeight);
            $rep->NewLine(2);
            $rep->fontSize += 2;
            $rep->TextCol(0, 3, $myrow['category_id'] . " - " . $myrow['description']);
            $catgor = $myrow['description'];
            $rep->fontSize -= 2;
            $rep->NewLine();
        }
        $rep->NewLine();
        $rep->TextCol(0, 1, $myrow['stock_id']);
        $rep->TextCol(1, 2, $myrow['name']);
        $rep->TextCol(2, 3, $myrow['units']);
        $price = get_price($myrow['stock_id'], $currency, $salestype);
        $rep->AmountCol(3, 4, $price, $dec);
        if ($showGP) {
            $price2 = get_price($myrow['stock_id'], $home_curr, $salestype);
            if ($price2 != 0.0) {
                $disp = ($price2 - $myrow['Standardcost']) * 100 / $price2;
            } else {
                $disp = 0.0;
            }
            $rep->TextCol(4, 5, number_format2($disp, user_percent_dec()) . " %");
        }
        if ($pictures) {
            $image = company_path() . "/images/" . item_img_name($myrow['stock_id']) . ".jpg";
            if (file_exists($image)) {
                $rep->NewLine();
                if ($rep->row - $pic_height < $rep->bottomMargin) {
                    $rep->NewPage();
                }
                $rep->AddImage($image, $rep->cols[1], $rep->row - $pic_height, 0, $pic_height);
                $rep->row -= $pic_height;
                $rep->NewLine();
            }
        } else {
            $rep->NewLine(0, 1);
        }
    }
    $rep->Line($rep->row - 4);
    $result = get_kits($category);
    $catgor = '';
    while ($myrow = db_fetch($result)) {
        if ($catgor != $myrow['cat_name']) {
            if ($catgor == '') {
                $rep->NewLine(2);
                $rep->fontSize += 2;
                $rep->TextCol(0, 3, _("Sales Kits"));
                $rep->fontSize -= 2;
            }
            $rep->Line($rep->row - $rep->lineHeight);
            $rep->NewLine(2);
            $rep->fontSize += 2;
            $rep->TextCol(0, 3, $myrow['cat_id'] . " - " . $myrow['cat_name']);
            $catgor = $myrow['cat_name'];
            $rep->fontSize -= 2;
            $rep->NewLine();
        }
        $rep->NewLine();
        $rep->TextCol(0, 1, $myrow['kit_code']);
        $rep->TextCol(1, 3, $myrow['kit_name']);
        $price = get_kit_price($myrow['kit_code'], $currency, $salestype);
        $rep->AmountCol(3, 4, $price, $dec);
        $rep->NewLine(0, 1);
    }
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
                <div>
                    <span><a href="<?php 
            echo U('Article/detail?id=' . $list['id']);
            ?>
">查看全文</a></span>
                    <span class="pull-right">
                        <span class="author"><?php 
            echo get_username($list["uid"]);
            ?>
</span>
                        <span>于 <?php 
            echo date('Y-m-d H:i', $list["create_time"]);
            ?>
</span> 发表在 <span>
                        <a href="<?php 
            echo U('Article/lists?category=' . get_category_name($list['category_id']));
            ?>
"><?php 
            echo get_category_title($list["category_id"]);
            ?>
</a></span> 
                        <span>阅读(<?php 
            echo $list["view"];
            ?>
)</span>&nbsp;&nbsp;
                    </span>
                </div>
                <hr/><?php 
        }
    }
} else {
示例#26
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();
}
function print_inventory_sales()
{
    global $path_to_root;
    $from = $_POST['PARAM_0'];
    $destination = $_POST['PARAM_1'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $dec = user_price_dec();
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    $cols = array(0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1050, 1100, 1150, 1200);
    $headers = array(_('Date'), _('Client Name'), _('IMC'), _('Charge'), _('Sales'), _('Date'), _('CM#'), _('Returns'), _(''), _('Discount'), _('Balance'), _('Date'), _('PR/OR#'), _('Date'), _('OR #'), _('Amount'), _('Partial'), _('Balance'), _('Date'), _(''), _('Commission'), _('w/tax'), _('Net Commission'));
    $header2 = array(_(''), '', '', _('Invoice'), _('Amount'), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), '', _(''), _(''));
    $aligns = array('left', 'center', 'center', 'center', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''));
    $rep = new FrontReport(_('Series Report'), "SeriesReport", user_pagesize(), 8, 'L');
    $rep->Font();
    $rep->Info($params, $cols, $header2, $aligns, $cols, $headers, $aligns);
    $rep->NewPage();
    $total = $grandtotal = 0.0;
    $total1 = $grandtotal1 = 0.0;
    $total2 = $grandtotal2 = 0.0;
    $catt = '';
    $res = getTransactions($imc, $from);
    while ($myrow = db_fetch($res)) {
        $company_data = get_company_prefs();
        $branch = get_branch($myrow["branch_code"]);
        $branch_data = get_branch_accounts($myrow['branch_code']);
        $dt = get_discount($branch_data['sales_discount_account'], $myrow['type'], $myrow['trans_no']);
        $salesman = get_imc_code($myrow['branch_code']);
        $res2 = get_return_details($myrow['order_']);
        $returns = 0;
        $rtn_dt = 0;
        $credit_num = "";
        $cm_date = "";
        $num = db_num_rows($res2);
        $var = array();
        while ($myrow2 = db_fetch($res2)) {
            $returns += $myrow2['ov_amount'];
            if ($num > 1) {
                $credit_num .= $myrow2['customized_no'] . "/";
                $cm_date = $myrow2['tran_date'] . "/";
            } else {
                $credit_num .= $myrow2['customized_no'];
                $cm_date = $myrow2['tran_date'];
            }
            $var = array($myrow2['trans_no']);
            //$res2 = get_return_discount($branch_data['sales_discount_account'], $myrow2['type'], $myrow2['trans_no']);
            //	while ($myrow3 = db_fetch($res2)){
            //		$rtn_dt += abs($myrow3['amount']);
            //	}
        }
        foreach ($var as $vars) {
            $res2 = get_return_discount($branch_data['sales_discount_account'], ST_CUSTCREDIT, $vars);
            while ($myrow3 = db_fetch($res2)) {
                $rtn_dt += abs($myrow3['amount']);
            }
        }
        $total_returns = $returns + $rtn_dt;
        $return_discount = $rtn_dt / $total_returns * 100;
        //$discount = $myrow['discount'];
        $invoicetot = $myrow['ov_amount'] + $dt;
        $invoice_discount = $dt / $invoicetot * 100;
        $sales_discount = ($invoicetot - $total_returns) * ($invoice_discount / 100);
        $net_sales = $invoicetot - $total_returns - $sales_discount;
        $gross_commission = ($invoicetot - $total_returns) * ($myrow['commission'] / 100);
        $tot_invoice = $invoicetot - $invoicetot * ($invoice_discount / 100);
        $sample = $invoicetot - $total_returns;
        $rep->TextCol(0, 1, $myrow['tranDate']);
        $rep->TextCol(1, 2, $myrow['br_name']);
        $rep->TextCol(2, 3, $salesman);
        $rep->TextCol(3, 4, $myrow['customized_no']);
        if ($myrow['IsVoid'] == '') {
            $rep->AmountCol(4, 5, $invoicetot, 2);
            $rep->TextCol(5, 6, $cm_date);
            $rep->TextCol(6, 7, $credit_num);
            if ($total_returns != 0) {
                $rep->AmountCol(7, 8, $total_returns, 2);
            }
            if ($invoice_discount < 0) {
                $rep->TextCol(8, 9, "CLIENT SALES/SALES DISCOUNT NOT DEFINED.");
            } else {
                $rep->TextCol(8, 9, $invoice_discount . "%");
            }
            if ($sales_discount < 0) {
                $rep->TextCol(9, 10, "ERROR.");
            } else {
                if ($sales_discount != 0) {
                    $rep->AmountCol(9, 10, $sales_discount, 2);
                }
            }
            if ($net_sales != 0) {
                $rep->AmountCol(10, 11, $net_sales, 2);
            }
            $partial_payment = 0;
            $or = get_pr_details($myrow['type'], $myrow['trans_no']);
            $ref = '';
            $num2 = db_num_rows($or);
            $date_alloc = '';
            while ($pr = db_fetch($or)) {
                $partial_payment += $pr['amt'];
                $date_alloc = $pr['prDate'] . " ";
                $pr_number = $pr['customized_no'] . " ";
                if ($num2 > 1) {
                    $ref .= $pr['reference'] . "/";
                } else {
                    $ref = $pr['reference'];
                }
            }
            $net_remittance = $net_sales - $partial_payment;
            $rep->TextCol(11, 12, $date_alloc);
            $rep->TextCol(12, 13, $ref);
            $rep->TextCol(13, 14, $date_alloc);
            $rep->TextCol(14, 15, _(""));
            if ($partial_payment == $tot_invoice) {
                $rep->AmountCol(15, 16, $partial_payment, 2);
            }
            if ($partial_payment != 0) {
                if ($partial_payment < $tot_invoice) {
                    $bal = $tot_invoice - $partial_payment;
                    $rep->AmountCol(16, 17, $partial_payment, 2);
                    $rep->AmountCol(17, 18, $bal, 2);
                }
            }
            //$rep->AmountCol(15,16, $partial_payment, 2);
            //$rep->AmountCol(17,18, $net_remittance, 2);
            $myrow4 = db_fetch(get_commission_details($myrow['type'], $myrow['trans_no']));
            $comm = ($invoicetot - $total_returns) * ($myrow4['commission'] / 100);
            $rep->TextCol(18, 19, $myrow4['tranDate']);
            if ($myrow4['commission'] != 0) {
                $rep->TextCol(19, 20, $myrow4['commission'] . "%");
            }
            if ($comm != 0) {
                $rep->AmountCol(20, 21, $comm, 2);
            }
            if ($myrow4['with_tax'] != 0) {
                $rep->AmountCol(21, 22, $myrow4['with_tax'], 2);
            }
            if ($myrow4['net_commission'] != 0) {
                $rep->AmountCol(22, 23, $myrow4['net_commission'], 2);
            }
            $net_invoice += $invoicetot;
            $net_discount += $sales_discount;
            $net_returns += $total_returns;
            $sale_amount += $net_sales;
            $net_partial += $partial_payment;
            $net_rem += $net_remittance;
            $net_bal += $bal;
            $net_balance = $net_rem + $net_bal;
            $net_comm += $comm;
            $net_tax += $myrow4['with_tax'];
            $net_net_comm += $myrow4['net_commission'];
        } else {
            $rep->TextCol(4, 5, "Voided");
        }
        $rep->NewLine();
    }
    $rep->Font('bold');
    $rep->NewLine();
    $rep->TextCol(1, 2, "TOTAL");
    $rep->AmountCol(4, 5, $net_invoice, 2);
    $rep->AmountCol(7, 8, $net_returns, 2);
    $rep->AmountCol(9, 10, $net_discount, 2);
    $rep->AmountCol(10, 11, $sale_amount, 2);
    $rep->AmountCol(16, 17, $net_partial, 2);
    //$rep->AmountCol(17,18, $net_balance, 2);
    $rep->AmountCol(20, 21, $net_comm, 2);
    $rep->AmountCol(21, 22, $net_tax, 2);
    $rep->AmountCol(22, 23, $net_net_comm, 2);
    $rep->NewLine();
    $rep->End();
}
示例#28
0
function print_inventory_purchase()
{
    global $path_to_root;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $category = $_POST['PARAM_2'];
    $location = $_POST['PARAM_3'];
    $fromsupp = $_POST['PARAM_4'];
    $item = $_POST['PARAM_5'];
    $comments = $_POST['PARAM_6'];
    $orientation = $_POST['PARAM_7'];
    $destination = $_POST['PARAM_8'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    $dec = user_price_dec();
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($location == '') {
        $loc = _('All');
    } else {
        $loc = get_location_name($location);
    }
    if ($fromsupp == '') {
        $froms = _('All');
    } else {
        $froms = get_supplier_name($fromsupp);
    }
    if ($item == '') {
        $itm = _('All');
    } else {
        $itm = $item;
    }
    $cols = array(0, 60, 180, 225, 275, 400, 420, 465, 520);
    $headers = array(_('Category'), _('Description'), _('Date'), _('#'), _('Supplier'), _('Qty'), _('Unit Price'), _('Total'));
    if ($fromsupp != '') {
        $headers[4] = '';
    }
    $aligns = array('left', 'left', 'left', 'left', 'left', 'left', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 3 => array('text' => _('Location'), 'from' => $loc, 'to' => ''), 4 => array('text' => _('Supplier'), 'from' => $froms, 'to' => ''), 5 => array('text' => _('Item'), 'from' => $itm, 'to' => ''));
    $rep = new FrontReport(_('Inventory Purchasing Report'), "InventoryPurchasingReport", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $res = getTransactions($category, $location, $fromsupp, $item, $from, $to);
    $total = $total_supp = $grandtotal = 0.0;
    $total_qty = 0.0;
    $catt = $stock_description = $stock_id = $supplier_name = '';
    while ($trans = db_fetch($res)) {
        if ($stock_description != $trans['description']) {
            if ($stock_description != '') {
                if ($supplier_name != '') {
                    $rep->NewLine(2, 3);
                    $rep->TextCol(0, 1, _('Total'));
                    $rep->TextCol(1, 4, $stock_description);
                    $rep->TextCol(4, 5, $supplier_name);
                    $rep->AmountCol(5, 7, $total_qty, get_qty_dec($stock_id));
                    $rep->AmountCol(7, 8, $total_supp, $dec);
                    $rep->Line($rep->row - 2);
                    $rep->NewLine();
                    $total_supp = $total_qty = 0.0;
                    $supplier_name = $trans['supplier_name'];
                }
            }
            $stock_id = $trans['stock_id'];
            $stock_description = $trans['description'];
        }
        if ($supplier_name != $trans['supplier_name']) {
            if ($supplier_name != '') {
                $rep->NewLine(2, 3);
                $rep->TextCol(0, 1, _('Total'));
                $rep->TextCol(1, 4, $stock_description);
                $rep->TextCol(4, 5, $supplier_name);
                $rep->AmountCol(5, 7, $total_qty, get_qty_dec($stock_id));
                $rep->AmountCol(7, 8, $total_supp, $dec);
                $rep->Line($rep->row - 2);
                $rep->NewLine();
                $total_supp = $total_qty = 0.0;
            }
            $supplier_name = $trans['supplier_name'];
        }
        if ($catt != $trans['cat_description']) {
            if ($catt != '') {
                $rep->NewLine(2, 3);
                $rep->TextCol(0, 1, _('Total'));
                $rep->TextCol(1, 7, $catt);
                $rep->AmountCol(7, 8, $total, $dec);
                $rep->Line($rep->row - 2);
                $rep->NewLine();
                $rep->NewLine();
                $total = 0.0;
            }
            $rep->TextCol(0, 1, $trans['category_id']);
            $rep->TextCol(1, 6, $trans['cat_description']);
            $catt = $trans['cat_description'];
            $rep->NewLine();
        }
        $curr = get_supplier_currency($trans['supplier_id']);
        $rate = get_exchange_rate_from_home_currency($curr, sql2date($trans['tran_date']));
        $trans['price'] *= $rate;
        $rep->NewLine();
        $trans['supp_reference'] = get_supp_inv_reference($trans['supplier_id'], $trans['stock_id'], $trans['tran_date']);
        $rep->fontSize -= 2;
        $rep->TextCol(0, 1, $trans['stock_id']);
        if ($fromsupp == ALL_TEXT) {
            $rep->TextCol(1, 2, $trans['description'] . ($trans['inactive'] == 1 ? " (" . _("Inactive") . ")" : ""), -1);
            $rep->TextCol(2, 3, sql2date($trans['tran_date']));
            $rep->TextCol(3, 4, $trans['supp_reference']);
            $rep->TextCol(4, 5, $trans['supplier_name']);
        } else {
            $rep->TextCol(1, 2, $trans['description'] . ($trans['inactive'] == 1 ? " (" . _("Inactive") . ")" : ""), -1);
            $rep->TextCol(2, 3, sql2date($trans['tran_date']));
            $rep->TextCol(3, 4, $trans['supp_reference']);
        }
        $rep->AmountCol(5, 6, $trans['qty'], get_qty_dec($trans['stock_id']));
        $rep->AmountCol(6, 7, $trans['price'], $dec);
        $amt = $trans['qty'] * $trans['price'];
        $rep->AmountCol(7, 8, $amt, $dec);
        $rep->fontSize += 2;
        $total += $amt;
        $total_supp += $amt;
        $grandtotal += $amt;
        $total_qty += $trans['qty'];
    }
    if ($stock_description != '') {
        if ($supplier_name != '') {
            $rep->NewLine(2, 3);
            $rep->TextCol(0, 1, _('Total'));
            $rep->TextCol(1, 4, $stock_description);
            $rep->TextCol(4, 5, $supplier_name);
            $rep->AmountCol(5, 7, $total_qty, get_qty_dec($stock_id));
            $rep->AmountCol(7, 8, $total_supp, $dec);
            $rep->Line($rep->row - 2);
            $rep->NewLine();
            $rep->NewLine();
            $total_supp = $total_qty = 0.0;
            $supplier_name = $trans['supplier_name'];
        }
    }
    if ($supplier_name != '') {
        $rep->NewLine(2, 3);
        $rep->TextCol(0, 1, _('Total'));
        $rep->TextCol(1, 4, $stock_description);
        $rep->TextCol(4, 5, $supplier_name);
        $rep->AmountCol(5, 7, $total_qty, get_qty_dec($stock_id));
        $rep->AmountCol(7, 8, $total_supp, $dec);
        $rep->Line($rep->row - 2);
        $rep->NewLine();
        $rep->NewLine();
    }
    $rep->NewLine(2, 3);
    $rep->TextCol(0, 1, _('Total'));
    $rep->TextCol(1, 7, $catt);
    $rep->AmountCol(7, 8, $total, $dec);
    $rep->Line($rep->row - 2);
    $rep->NewLine();
    $rep->NewLine(2, 1);
    $rep->TextCol(0, 7, _('Grand Total'));
    $rep->AmountCol(7, 8, $grandtotal, $dec);
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
function print_purchases_cost()
{
    global $path_to_root;
    $from = $_POST['PARAM_0'];
    $destination = $_POST['PARAM_1'];
    $orientation = $_POST['PARAM_2'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $dec = user_price_dec();
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    $cols = array(0, 50, 100, 150, 200, 250, 300, 350);
    $headers = array(_('Invoice'), _('Client Name'), _('IMC'), _('Charge'), _('Sales'), _('Date of'));
    //$header2 = array(_('Date'), '', '', _('Invoice'), _('Amount'), _('Credit  Memo'), _('Memo No.'), _(' Return'), _('%'), _('%'), _('Sales'), _('Provisional Receipt'), _('Receipt No.'), _('Payment'), _('Remittance'), _('Commission'), _('Percentage'), '', _('W/holding Tax'), _('Commission'));
    $aligns = array('left', 'left', 'left', 'left');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''));
    $rep = new FrontReport(_('Summary of Purchases at Cost Report'), "SummaryPurchasesCostReport", user_pagesize(), 8, 'L');
    $rep->Font();
    $rep->Info($params, $cols, $header2, $aligns);
    $rep->NewPage();
    $res = getTransactions($category, $from, $to);
    $total = $grandtotal = 0.0;
    $total1 = $grandtotal1 = 0.0;
    $total2 = $grandtotal2 = 0.0;
    $catt = '';
    while ($trans = db_fetch($res)) {
        if ($catt != $trans['cat_description']) {
            if ($catt != '') {
                $rep->NewLine(2, 3);
                $rep->TextCol(0, 4, _('Total'));
                $rep->AmountCol(4, 5, $total, $dec);
                $rep->Line($rep->row - 2);
                $rep->NewLine();
                $rep->NewLine();
                $total = $total1 = $total2 = 0.0;
            }
            $rep->TextCol(0, 1, $trans['category_id']);
            $rep->TextCol(1, 7, $trans['cat_description']);
            $catt = $trans['cat_description'];
            $rep->NewLine();
        }
        $rep->NewLine();
        $rep->fontSize -= 2;
        $rep->TextCol(0, 1, $trans['stock_id']);
        $rep->TextCol(1, 2, $trans['description']);
        $rep->AmountCol(2, 3, $trans['quantity'], get_qty_dec($trans['stock_id']));
        $rep->AmountCol(3, 4, $trans['unit_price'], $dec);
        $rep->AmountCol(4, 5, $trans['quantity'] * $trans['unit_price'], $dec);
        if ($trans['unit_price'] == 0) {
            $rep->TextCol(6, 7, _('Gift'));
        }
        $rep->fontSize += 2;
        $total += $trans['quantity'] * $trans['unit_price'];
        $grandtotal += $trans['quantity'] * $trans['unit_price'];
    }
    $rep->NewLine(2, 3);
    $rep->TextCol(0, 4, _('Total'));
    $rep->AmountCol(4, 5, $total, $dec);
    $rep->Line($rep->row - 2);
    $rep->NewLine();
    $rep->NewLine(2, 1);
    $rep->TextCol(0, 4, _('Grand Total'));
    $rep->AmountCol(4, 5, $grandtotal, $dec);
    $rep->Line($rep->row - 4);
    $rep->NewLine();
    $rep->End();
}
示例#30
0
文件: rep105.php 项目: M-Shahbaz/FA
function print_order_status_list()
{
    global $path_to_root;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $category = $_POST['PARAM_2'];
    $location = $_POST['PARAM_3'];
    $backorder = $_POST['PARAM_4'];
    $comments = $_POST['PARAM_5'];
    $orientation = $_POST['PARAM_6'];
    $destination = $_POST['PARAM_7'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($location == ALL_TEXT) {
        $location = null;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    if ($location == null) {
        $loc = _('All');
    } else {
        $loc = get_location_name($location);
    }
    if ($backorder == 0) {
        $back = _('All Orders');
    } else {
        $back = _('Back Orders Only');
    }
    $cols = array(0, 60, 150, 260, 325, 385, 450, 515);
    $headers2 = array(_('Order'), _('Customer'), _('Branch'), _('Customer Ref'), _('Ord Date'), _('Del Date'), _('Loc'));
    $aligns = array('left', 'left', 'right', 'right', 'right', 'right', 'right');
    $headers = array(_('Code'), _('Description'), _('Ordered'), _('Delivered'), _('Outstanding'), '');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 3 => array('text' => _('Location'), 'from' => $loc, 'to' => ''), 4 => array('text' => _('Selection'), 'from' => $back, 'to' => ''));
    $aligns2 = $aligns;
    $rep = new FrontReport(_('Order Status Listing'), "OrderStatusListing", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $cols2 = $cols;
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2);
    $rep->NewPage();
    $orderno = 0;
    $result = GetSalesOrders($from, $to, $category, $location, $backorder);
    while ($myrow = db_fetch($result)) {
        $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->DateCol(4, 5, $myrow['ord_date'], true);
            $rep->DateCol(5, 6, $myrow['delivery_date'], true);
            $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']);
        $dec = get_qty_dec($myrow['stk_code']);
        $rep->AmountCol(2, 3, $myrow['quantity'], $dec);
        $rep->AmountCol(3, 4, $myrow['qty_sent'], $dec);
        $rep->AmountCol(4, 5, $myrow['quantity'] - $myrow['qty_sent'], $dec);
        if ($myrow['quantity'] - $myrow['qty_sent'] > 0) {
            $rep->Font('italic');
            $rep->TextCol(5, 6, _('Outstanding'));
            $rep->Font();
        }
        $rep->NewLine();
    }
    $rep->Line($rep->row);
    $rep->End();
}