Exemplo n.º 1
0
function print_check_voucher()
{
    global $path_to_root, $systypes_array;
    $trans_no = $_POST['PARAM_0'];
    $trans_num = $_POST['PARAM_1'];
    $orientation = $_POST['PARAM_2'];
    $destination = $_POST['PARAM_3'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report2.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    $rep = new FrontReport(_('JOURNAL VOUCHER'), "JournalVoucher", user_pagesize(), 9, $orientation);
    $dec = user_price_dec();
    $cols = array(0, 65, 105, 125, 175, 210, 250, 300, 360, 370);
    $aligns = array('left', 'left', 'left', 'center', 'right', 'right', 'right', 'right', 'right');
    $rep->SetHeaderType(0);
    $rep->Font();
    $rep->Info(null, $cols, null, $aligns);
    $rep->NewPage();
    $res = get_transaction($trans_no);
    $myrow = db_fetch($res);
    $credit = $debit = 0;
    $res2 = get_gl_trans(0, $trans_num);
    $res3 = get_gl_trans(0, $trans_num);
    $fiscal = get_year();
    //to be use
    $year_no = substr(sql2date($fiscal['begin']), 8);
    //to be use
    $transtype = ST_JOURNAL;
    $ser = db_fetch(get_used_series($year_no, $transtype));
    $num = substr($ser['year'], 2);
    $rep->Font('bold');
    //$rep->TextCol(7,11, _("ST. MATTHEW'S PUBLISHING CORPORATION"));
    $rep->Font();
    $rep->NewLine();
    // $rep->TextCol(7,11, _("Tel. Nos. 426-5611 * 433-5385 Telefax: 426-1274"));
    $rep->NewLine(3);
    //$rep->Font('bold');
    //$rep->SetFontSize(14);
    //$rep->TextCol(3,8, _("JOURNAL VOUCHER"));
    $rep->NewLine(5);
    $rep->SetFontSize(10);
    $rep->TextCol(0, 2, $myrow['tranDate']);
    $rep->SetFontSize(12);
    $rep->TextCol(6, 8, $num . "-" . str_pad($myrow['customized_no'], 4, 0, STR_PAD_LEFT));
    $rep->NewLine(2);
    //$rep->Line($rep->row  - -10);
    // $rep->TextCol(7,8, _("DEBIT"));
    //$rep->TextCol(9,10, _("CREDIT"));
    //$rep->TextCol(5,7, _("ACCOUNT CODE"));
    $rep->SetFontSize(10);
    $rep->Font();
    //$rep->Line($rep->row  - 4);
    $rep->NewLine(2);
    while ($myrow3 = db_fetch($res3)) {
        $accounts = get_gl_accounts($myrow3['account']);
        $account = db_fetch($accounts);
        if ($myrow3['amount'] > 0) {
            $rep->TextCol(0, 3, $account['account_name']);
            $rep->TextCol(4, 5, $account['account_code']);
            $rep->AmountCol(5, 7, $myrow3['amount'], 2);
            $rep->NewLine();
            $debit += $myrow3['amount'];
        } else {
            $rep->TextCol(0, 3, $account['account_name']);
            $rep->TextCol(4, 5, $account['account_code']);
            $rep->AmountCol(7, 9, abs($myrow3['amount']), 2);
            $rep->NewLine();
            $credit += abs($myrow3['amount']);
        }
    }
    // $rep->Line($rep->row  - -4);
    $rep->NewLine(17);
    $rep->Font('bold');
    //$rep->TextCol(0,4, _("Total"));
    $rep->AmountCol(5, 7, $debit, 2);
    $rep->AmountCol(7, 9, $credit, 2);
    $rep->NewLine(2);
    $rep->Font();
    $comment = get_comments_string($transtype, $trans_num);
    $rep->TextCol(0, 9, $comment);
    // $rep->Line($rep->row  - 4);
    $rep->End();
}
Exemplo n.º 2
0
function print_voucher()
{
    global $path_to_root, $systypes_array;
    $dim = get_company_pref('use_dimension');
    $dimension = $dimension2 = 0;
    $voucher_no = $_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_report2.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    $rep = new FrontReport(_('COMMISSION VOUCHER'), "CommissionVoucherReport", user_pagesize(), 9, $orientation);
    $dec = user_price_dec();
    $cols = array(-15, 20, 40, 60, 90, 150, 200, 225, 220, 465, 525);
    //------------0--1---2---3----4----5----6----7----8----9----10-------
    //-----------------------dim1-dim2-----------------------------------
    //-----------------------dim1----------------------------------------
    //-------------------------------------------------------------------
    $aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right', 'right', 'right', 'right', 'right');
    $headers = array('', _('Commission Voucher'), '', '', '', '', '');
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->SetHeaderType(0);
    $rep->Font();
    $rep->Info(null, $cols, null, $aligns);
    $rep->NewPage();
    $res = get_transaction($voucher_no);
    $myrow = db_fetch($res);
    $salesman = get_salesman_name($myrow['imc']);
    $client = get_customer_name($myrow['client']);
    $rep->Font('bold');
    // $rep->TextCol(4,8, _("ST. MATTHEW'S PUBLISHING CORPORATION"));
    $rep->Font();
    $rep->NewLine();
    // $rep->TextCol(4,8, _("Tel. Nos. 426-5611 * 433-5385 Telefax: 426-1274"));
    $rep->NewLine(5);
    $rep->Font('bold');
    $rep->SetFontSize(14);
    //$rep->TextCol(0,3, _("COMMISSION VOUCHER"));
    $rep->Font();
    $rep->SetFontSize(10);
    $rep->NewLine(4);
    $netgross = $myrow['gross'] * ($myrow['commission'] / 100);
    //$rep->TextCol(8,9, _("Date:"));
    $rep->TextCol(5, 6, $myrow['Dated']);
    $year = substr($myrow['dateYear'], 2);
    $rep->TextCol(6, 7, $year);
    $rep->NewLine(1);
    $rep->TextCol(1, 4, $salesman);
    $rep->NewLine(3);
    //$rep->Line($rep->row  - -10);
    //$rep->TextCol(2,5, _("EXPLANATION"));
    //$rep->TextCol(8,9, _("AMOUNT"));
    // $rep->Line($rep->row  - 4);
    $rep->NewLine(2);
    $rep->SetFontSize('8');
    $oldrow = $rep->row;
    $rep->TextColLines(2, 5, $client);
    $newrow = $rep->row;
    $rep->row = $oldrow;
    $rep->NewLine(3);
    $rep->SetFontSize('10');
    //$rep->TextCol(8,9, _("Gross: "));
    $rep->AmountCol(5, 7, $netgross, 2);
    $rep->NewLine(1);
    $rep->TextCol(2, 4, $myrow['commission']);
    $rep->AmountCol(5, 7, $myrow['with_tax'], 2);
    $rep->NewLine(2);
    $rep->TextCol(2, 4, $myrow['invoice_no']);
    $rep->NewLine(4);
    $rep->Font('bold');
    $rep->AmountCol(5, 7, $myrow['net_commission'], 2);
    $rep->NewLine();
    // $rep->Line($rep->row  - 4);
    // $rep->Line($rep->row  - 8);
    $rep->NewLine(3);
    $rep->Font();
    $rep->SetFontSize('9');
    //$rep->TextCol(1,4, _("Approved by:"));
    // $rep->TextCol(5,8, _("Received payment by:"));
    $rep->NewLine(2);
    $rep->TextCol(2, 4, _("Checked by:"));
    $rep->End();
}
Exemplo n.º 3
0
function print_check_voucher()
{
    global $path_to_root, $systypes_array;
    $trans_no = $_POST['PARAM_0'];
    $trans_num = $_POST['PARAM_1'];
    $cv_no = $_POST['PARAM_2'];
    $account = $_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_report2.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    $rep = new FrontReport(_('CHECK VOUCHER'), "CheckVoucher", user_pagesize(), '', $orientation);
    $dec = user_price_dec();
    $cols = array(0, 30, 50, 125, 175, 200, 265, 285, 360, 425, 460, 542, 550);
    $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'left', 'left', 'right', 'right', 'right');
    $rep->SetHeaderType(0);
    $rep->Font();
    $rep->Info(null, $cols, null, $aligns);
    $rep->NewPage();
    $ty = explode("-", $trans_no);
    $t_type = $ty[1];
    if ($t_type != 0) {
        $res = get_transaction($trans_no, $t_type);
        $res1 = get_heading($trans_no, $t_type);
    } else {
        $res = get_transaction($trans_no, ST_DISBURSEMENT);
        $res1 = get_heading($trans_no, ST_DISBURSEMENT);
    }
    $myrow = db_fetch($res);
    $myrow1 = db_fetch($res1);
    $credit = $debit = 0;
    //$transtype = ST_DISBURSEMENT;
    if ($t_type != 0 || $t_type != '') {
        $res2 = get_gl_trans($t_type, $trans_num);
        $res3 = get_gl_trans($t_type, $trans_num);
    } else {
        $res2 = get_gl_trans(ST_DISBURSEMENT, $trans_num);
        $res3 = get_gl_trans(ST_DISBURSEMENT, $trans_num);
    }
    $new_ret = 0;
    $return = 0;
    //$fiscal = get_year(); //to be use
    // $year_no = substr(sql2date($fiscal['begin']), 8); //to be use
    // $ser = db_fetch(get_used_series($year_no, $transtype));
    // $num = substr($ser['year'], 2);
    /* $rep->Font('bold');
       $rep->TextCol(7,11, _("ST. MATTHEW'S PUBLISHING CORPORATION"));
       $rep->Font();
       $rep->NewLine();
       $rep->TextCol(7,11, _("Tel. Nos. 426-5611 * 433-5385 Telefax: 426-1274"));
       $rep->NewLine(3);
       $rep->Font('bold');
       $rep->SetFontSize(14);
       $rep->TextCol(5,8, _("CHECK VOUCHER"));*/
    $rep->NewLine(7);
    $rep->SetFontSize(12);
    $num = substr($myrow['yearDate'], 2);
    $name = payment_person_name($myrow["person_type_id"], $myrow["person_id"]);
    $rep->TextCol(2, 6, $name);
    $rep->TextCol(9, 11, $num . "-" . str_pad($myrow1['customized_no'], 4, 0, STR_PAD_LEFT));
    $rep->NewLine();
    if ($myrow1['customized_field'] != 0 || $myrow1['customized_field'] != '') {
        $rep->TextCol(0, 4, $myrow1['customized_field']);
    } else {
        $rep->TextCol(0, 4, _(""));
    }
    $rep->NewLine(1);
    $rep->TextCol(8, 10, $myrow['sqldate']);
    $rep->NewLine(5);
    // $rep->Line($rep->row  - -10);
    //  $rep->TextCol(4,6, _("PARTICULARS"));
    // $rep->TextCol(9,10, _("AMOUNT"));
    //  $rep->Line($rep->row  - 4);
    $var = array();
    $pos = array();
    $neg = array();
    $pos_amt = array();
    $neg_amt = array();
    $tots = 0;
    $comment = get_comments_string($cv_no, $trans_num);
    while ($myrow2 = db_fetch($res2)) {
        $tots = 0;
        if (is_bank_account($myrow2['account'])) {
            $var = array($myrow2['account']);
            $rep->TextCol(1, 8, $comment);
            $tots += abs($myrow2['amount']);
        }
    }
    $rep->AmountCol(9, 11, $tots, 2);
    $rep->NewLine(2);
    // $rep->Line($rep->row  - -10);
    // $rep->TextCol(1,3, _("DEBIT"));
    // $rep->TextCol(7,8, _("CREDIT"));
    // $rep->Line($rep->row  - 4);
    $rep->NewLine(5);
    $rep->SetFontSize(12);
    while ($myrow3 = db_fetch($res3)) {
        $accounts = get_gl_accounts($myrow3['account']);
        $account = db_fetch($accounts);
        if ($myrow3['amount'] > 0) {
            // $rep->Line($rep->row  - -10);
            //$rep->TextCol(0,4, $account['account_name']);
            //  $rep->AmountCol(5,6, $myrow3['amount'],2);
            //  $rep->NewLine();
            //  $rep->Line($rep->row  + 8);
            array_push($pos, $account['account_name']);
            array_push($pos_amt, $myrow3['amount']);
            $debit += $myrow3['amount'];
        } else {
            array_push($neg, $account['account_name']);
            array_push($neg_amt, $myrow3['amount']);
            //  $rep->Line($rep->row  - 4);
            //  $rep->TextCol(6,8, $account['account_name']);
            //  $rep->AmountCol(9,11, abs($myrow3['amount']), 2);
            //  $rep->NewLine();
            // $rep->Line($rep->row  - 4);
        }
    }
    $result = array_merge($pos, $neg);
    $new = array();
    for ($i = 0; $i < count($result); $i++) {
        $new[] = $pos[$i];
        $new[] = $neg[$i];
    }
    $result2 = array_merge($pos_amt, $neg_amt);
    $new2 = array();
    for ($j = 0; $j < count($result2); $j++) {
        $new2[] = $pos_amt[$j];
        $new2[] = $neg_amt[$j];
    }
    $final_res = array_merge($new, $new2);
    $final_array = array();
    $final = array();
    for ($k = 0; $k < count($final_res); $k++) {
        $final[] = $new[$k];
        $final[] = $new2[$k];
    }
    $enter = 0;
    for ($i = 0; $i <= count($final_res); $i++) {
        //if ($final[$i] != 0)
        //{
        $rep->TextCol(0, 4, $pos[$i]);
        if ($pos_amt[$i] != 0) {
            $rep->AmountCol(4, 6, $pos_amt[$i], 2);
        }
        $rep->TextCol(7, 9, $neg[$i]);
        if ($neg_amt[$i] != 0) {
            $rep->AmountCol(9, 11, abs($neg_amt[$i]), 2);
        }
        if ($pos[$i] != "") {
            $rep->NewLine();
            $enter++;
        }
        // }
    }
    $return = 11 - $enter;
    //$rep->Line($rep->row  - 4);
    $rep->NewLine($return);
    //$rep->TextCol(0,2, count($final_res));
    //$rep->TextCol(4,5, $enter);
    //else
    //  $rep->NewLine($return);
    $rep->SetFontSize(10);
    // $rep->TextCol(0,2, _("Cash"));
    $words = price_in_words($tots, ST_CHEQUE);
    $_word = strlen($words);
    $first_word = substr($words, 0, 34);
    $second_word = substr($words, 34);
    // if ($words != "")
    // {
    //$rep->TextCol(5,7, _("Received the sum of :"));
    // $oldrow = $rep->row;
    $rep->TextColLines(8, 11, $first_word . "-", -2);
    //$newrow = $rep->row;
    // $rep->row = $oldrow;
    // }
    $rep->SetFontSize(10);
    $rep->TextCol(1, 3, $myrow1['check_num']);
    $tots_dec = price_format($tots);
    $rep->TextCol(3, 7, "                       " . $tots_dec);
    $rep->SetFontSize(10);
    $rep->TextCol(7, 11, $second_word);
    //$rep->TextCol(7,10, _("as payment of the above particulars."));
    $rep->NewLine();
    $rep->SetFontSize(10);
    //$rep->TextCol(0,10, _("Bank/Branch: "));
    foreach ($var as $vars) {
        // $bank_name = get_bank_name($vars);
        $rep->TextCol(2, 10, get_bank_name($vars) . " ");
    }
    //  $rep->TextCol(1,5, $myrow['bank_address']);
    $rep->TextCol(7, 9, "     " . $tots_dec);
    $rep->End();
}