public function actionView()
 {
     global $systypes_array;
     //require_once(Yii::app()->basePath . '/vendors/frontaccounting/ui.inc');
     $bfw = Pe::get_balance_before_for_bank_account($_POST['from_date'], $_POST['bank_act']);
     $arr['data'][] = array('type' => 'Saldo Awal - ' . sql2date($_POST['from_date']), 'ref' => '', 'tgl' => '', 'debit' => $bfw >= 0 ? number_format($bfw, 2) : '', 'kredit' => $bfw < 0 ? number_format($bfw, 2) : '', 'neraca' => '', 'person' => '');
     $credit = $debit = 0;
     $running_total = $bfw;
     if ($bfw > 0) {
         $debit += $bfw;
     } else {
         $credit += $bfw;
     }
     $result = Pe::get_bank_trans_for_bank_account($_POST['bank_act'], $_POST['from_date'], $_POST['to_date']);
     foreach ($result as $myrow) {
         $running_total += $myrow->amount;
         $jemaat = get_jemaat_from_user_id($myrow->users_id);
         $arr['data'][] = array('type' => $systypes_array[$myrow->type], 'ref' => $myrow->ref, 'tgl' => sql2date($myrow->trans_date), 'debit' => $myrow->amount >= 0 ? number_format($myrow->amount, 2) : '', 'kredit' => $myrow->amount < 0 ? number_format(-$myrow->amount, 2) : '', 'neraca' => number_format($running_total, 2), 'person' => $jemaat->real_name);
         if ($myrow->amount > 0) {
             $debit += $myrow->amount;
         } else {
             $credit += $myrow->amount;
         }
     }
     $arr['data'][] = array('type' => 'Saldo Akhir - ' . sql2date($_POST['to_date']), 'ref' => '', 'tgl' => '', 'debit' => number_format($debit, 2), 'kredit' => number_format(-$credit, 2), 'neraca' => number_format($debit + $credit, 2), 'person' => '');
     echo CJSON::encode($arr);
     Yii::app()->end();
 }
function display_rate_edit()
{
    global $selected_id, $Ajax, $xr_providers, $dflt_xr_provider;
    $xchg_rate_provider = isset($xr_providers) && isset($dflt_xr_provider) ? $xr_providers[$dflt_xr_provider] : 'ECB';
    start_table(TABLESTYLE2);
    if ($selected_id != "") {
        //editing an existing exchange rate
        $myrow = get_exchange_rate($selected_id);
        $_POST['date_'] = sql2date($myrow["date_"]);
        $_POST['BuyRate'] = maxprec_format($myrow["rate_buy"]);
        hidden('selected_id', $selected_id);
        hidden('date_', $_POST['date_']);
        label_row(_("Date to Use From:"), $_POST['date_']);
    } else {
        $_POST['date_'] = Today();
        $_POST['BuyRate'] = '';
        date_row(_("Date to Use From:"), 'date_');
    }
    if (isset($_POST['get_rate'])) {
        $_POST['BuyRate'] = maxprec_format(retrieve_exrate($_POST['curr_abrev'], $_POST['date_']));
        $Ajax->activate('BuyRate');
    }
    amount_row(_("Exchange Rate:"), 'BuyRate', null, '', submit('get_rate', _("Get"), false, _('Get current rate from') . ' ' . $xchg_rate_provider, true), 'max');
    end_table(1);
    submit_add_or_update_center($selected_id == '', '', 'both');
    display_note(_("Exchange rates are entered against the company currency."), 1);
}
Example #3
0
function get_domestic_price($myrow, $stock_id, $qty, $old_std_cost, $old_qty)
{
    if ($myrow['type'] == ST_SUPPRECEIVE || $myrow['type'] == ST_SUPPCREDIT) {
        $price = $myrow['price'];
        if ($myrow['type'] == ST_SUPPRECEIVE) {
            // Has the supplier invoice increased the receival price?
            $sql = "SELECT DISTINCT act_price FROM " . TB_PREF . "purch_order_details pod INNER JOIN " . TB_PREF . "grn_batch grn ON pod.order_no =\n\t\t\t\tgrn.purch_order_no WHERE grn.id = " . $myrow['trans_no'] . " AND pod.item_code = '{$stock_id}'";
            $result = db_query($sql, "Could not retrieve act_price from purch_order_details");
            $row = db_fetch_row($result);
            if ($row[0] > 0 and $row[0] != $myrow['price']) {
                $price = $row[0];
            }
        }
        if ($myrow['person_id'] > 0) {
            // Do we have foreign currency?
            $supp = get_supplier($myrow['person_id']);
            $currency = $supp['curr_code'];
            $ex_rate = get_exchange_rate_to_home_currency($currency, sql2date($myrow['tran_date']));
            $price /= $ex_rate;
        }
    } elseif ($myrow['type'] != ST_INVADJUST) {
        // calcutale the price from avg. price
        $price = ($myrow['standard_cost'] * $qty - $old_std_cost * $old_qty) / $myrow['qty'];
    } else {
        $price = $myrow['standard_cost'];
    }
    // Item Adjustments just have the real cost
    return $price;
}
Example #4
0
 static function get_bank_trans_view()
 {
     global $systypes_array;
     $bfw = Mt::get_balance_before_for_bank_account($_POST['trans_date_mulai'], $_POST['bank_act']);
     $arr['data'][] = array('type' => 'Saldo Awal - ' . sql2date($_POST['trans_date_mulai']), 'ref' => '', 'tgl' => '', 'debit' => $bfw >= 0 ? number_format($bfw, 2) : '', 'kredit' => $bfw < 0 ? number_format($bfw, 2) : '', 'neraca' => '', 'person' => '');
     $credit = $debit = 0;
     $running_total = $bfw;
     if ($bfw > 0) {
         $debit += $bfw;
     } else {
         $credit += $bfw;
     }
     $result = Mt::get_bank_trans_for_bank_account($_POST['bank_act'], $_POST['trans_date_mulai'], $_POST['trans_date_sampai']);
     foreach ($result as $myrow) {
         $running_total += $myrow->amount;
         $jemaat = get_jemaat_from_user_id($myrow->users_id);
         $arr['data'][] = array('type' => $systypes_array[$myrow->type], 'ref' => $myrow->ref, 'tgl' => sql2date($myrow->trans_date), 'debit' => $myrow->amount >= 0 ? number_format($myrow->amount, 2) : '', 'kredit' => $myrow->amount < 0 ? number_format(-$myrow->amount, 2) : '', 'neraca' => number_format($running_total, 2), 'person' => $jemaat->real_name);
         if ($myrow->amount > 0) {
             $debit += $myrow->amount;
         } else {
             $credit += $myrow->amount;
         }
     }
     $arr['data'][] = array('type' => 'Saldo Akhir - ' . sql2date($_POST['trans_date_sampai']), 'ref' => '', 'tgl' => '', 'debit' => $running_total >= 0 ? number_format($running_total, 2) : '', 'kredit' => $running_total < 0 ? number_format(-$running_total, 2) : '', 'neraca' => '', 'person' => '');
     return $arr;
 }
Example #5
0
function print_list_of_journal_entries()
{
    global $path_to_root;
    include_once $path_to_root . "reporting/includes/pdf_report.inc";
    $from = $_REQUEST['PARAM_0'];
    $to = $_REQUEST['PARAM_1'];
    $systype = $_REQUEST['PARAM_2'];
    $comments = $_REQUEST['PARAM_3'];
    $dec = user_price_dec();
    $cols = array(0, 100, 240, 300, 400, 460, 520, 580);
    $headers = array(tr('Type/Account'), tr('Account Name'), tr('Date/Dim.'), tr('Person/Item/Memo'), tr('Debit'), tr('Credit'));
    $aligns = array('left', 'left', 'left', 'left', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => tr('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => tr('Type'), 'from' => systypes::name($systype), 'to' => ''));
    $rep = new FrontReport(tr('List of Journal Entries'), "JournalEntries.pdf", user_pagesize());
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->Header();
    if ($systype == -1) {
        $systype = null;
    }
    $trans = get_gl_transactions($from, $to, -1, null, 0, $systype);
    $typeno = 0;
    while ($myrow = db_fetch($trans)) {
        if ($typeno != $myrow['type_no']) {
            if ($typeno != 0) {
                $rep->Line($rep->row + 4);
                $rep->NewLine();
            }
            $typeno = $myrow['type_no'];
            $TransName = systypes::name($myrow['type']);
            $rep->TextCol(0, 2, $TransName . " # " . $myrow['type_no']);
            $rep->TextCol(2, 3, sql2date($myrow['tran_date']));
            $coms = payment_person_types::person_name($myrow["person_type_id"], $myrow["person_id"]);
            $memo = get_comments_string($myrow['type'], $myrow['type_no']);
            if ($memo != '') {
                $coms .= $coms != "" ? "/" : "" . $memo;
            }
            $rep->TextCol(3, 6, $coms);
            $rep->NewLine(2);
        }
        $rep->TextCol(0, 1, $myrow['account']);
        $rep->TextCol(1, 2, $myrow['account_name']);
        $dim_str = get_dimension_string($myrow['dimension_id']);
        $dim_str2 = get_dimension_string($myrow['dimension2_id']);
        if ($dim_str2 != "") {
            $dim_str .= "/" . $dim_str2;
        }
        $rep->TextCol(2, 3, $dim_str);
        $rep->TextCol(3, 4, $myrow['memo_']);
        if ($myrow['amount'] > 0.0) {
            $rep->TextCol(4, 5, number_format2(abs($myrow['amount']), $dec));
        } else {
            $rep->TextCol(5, 6, number_format2(abs($myrow['amount']), $dec));
        }
        $rep->NewLine(1, 2);
    }
    $rep->Line($rep->row + 4);
    $rep->End();
}
 function render($id, $title)
 {
     global $path_to_root, $systypes_array;
     include_once $path_to_root . "/includes/ui.inc";
     $start_date = add_days(Today(), -$this->days_past);
     $end_date = add_days(Today(), $this->days_future);
     $result = get_bank_trans_for_bank_account($this->bank_act, $start_date, $end_date);
     start_table(TABLESTYLE, 'width=98%');
     $th = array(_("#"), _("Date"), _("Receipt"), _("Payment"), _("Balance"), _("Person/Item"), _("Memo"), "");
     table_header($th);
     $bfw = get_balance_before_for_bank_account($this->bank_act, $start_date);
     $credit = $debit = 0;
     start_row("class='inquirybg' style='font-weight:bold'");
     label_cell(_("Opening Balance") . " - " . $start_date, "colspan=4");
     display_debit_or_credit_cells($bfw);
     label_cell("");
     label_cell("", "colspan=2");
     end_row();
     $running_total = $bfw;
     if ($bfw > 0) {
         $debit += $bfw;
     } else {
         $credit += $bfw;
     }
     $j = 1;
     $k = 0;
     //row colour counter
     while ($myrow = db_fetch($result)) {
         alt_table_row_color($k);
         $running_total += $myrow["amount"];
         label_cell(get_trans_view_str($myrow["type"], $myrow["trans_no"]));
         $trandate = sql2date($myrow["trans_date"]);
         label_cell($trandate);
         display_debit_or_credit_cells($myrow["amount"]);
         amount_cell($running_total);
         label_cell(payment_person_name($myrow["person_type_id"], $myrow["person_id"]));
         label_cell(get_comments_string($myrow["type"], $myrow["trans_no"]));
         label_cell(get_gl_view_str($myrow["type"], $myrow["trans_no"]));
         end_row();
         if ($myrow["amount"] > 0) {
             $debit += $myrow["amount"];
         } else {
             $credit += $myrow["amount"];
         }
         if ($j == 12) {
             $j = 1;
             table_header($th);
         }
         $j++;
     }
     //end of while loop
     start_row("class='inquirybg' style='font-weight:bold'");
     label_cell(_("Ending Balance") . " - " . $end_date, "colspan=4");
     amount_cell($debit + $credit);
     label_cell("");
     label_cell("", "colspan=2");
     end_row();
     end_table(2);
 }
Example #7
0
function check_overdue($row)
{
    global $trans_type;
    if ($trans_type == ST_SALESQUOTE) {
        return date1_greater_date2(Today(), sql2date($row['delivery_date']));
    } else {
        return $row['type'] == 0 && date1_greater_date2(Today(), sql2date($row['ord_date'])) && $row['TotDelivered'] < $row['TotQuantity'];
    }
}
function calculate_from($myrow)
{
    if ($myrow["last_sent"] == '0000-00-00') {
        $from = sql2date($myrow["begin"]);
    } else {
        $from = sql2date($myrow["last_sent"]);
    }
    return $from;
}
Example #9
0
function print_audit_trail()
{
    global $path_to_root, $systypes_array;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $systype = $_POST['PARAM_2'];
    $user = $_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';
    $dec = user_price_dec();
    $cols = array(0, 60, 120, 180, 240, 340, 400, 460, 520);
    $headers = array(_('Date'), _('Time'), _('User'), _('Trans Date'), _('Type'), _('#'), _('Action'), _('Amount'));
    $aligns = array('left', 'left', 'left', 'left', 'left', 'left', 'left', 'right');
    $usr = get_user($user);
    $user_id = $usr['user_id'];
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Type'), 'from' => $systype != -1 ? $systypes_array[$systype] : _('All'), 'to' => ''), 3 => array('text' => _('User'), 'from' => $user != -1 ? $user_id : _('All'), 'to' => ''));
    $rep = new FrontReport(_('Audit Trail'), "AuditTrail", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $trans = getTransactions($from, $to, $systype, $user);
    while ($myrow = db_fetch($trans)) {
        $rep->TextCol(0, 1, sql2date(date("Y-m-d", $myrow['unix_stamp'])));
        if (user_date_format() == 0) {
            $rep->TextCol(1, 2, date("h:i:s a", $myrow['unix_stamp']));
        } else {
            $rep->TextCol(1, 2, date("H:i:s", $myrow['unix_stamp']));
        }
        $rep->TextCol(2, 3, $myrow['user_id']);
        $rep->TextCol(3, 4, sql2date($myrow['gl_date']));
        $rep->TextCol(4, 5, $systypes_array[$myrow['type']]);
        $rep->TextCol(5, 6, $myrow['trans_no']);
        if ($myrow['gl_seq'] == null) {
            $action = _('Changed');
        } else {
            $action = _('Closed');
        }
        $rep->TextCol(6, 7, $action);
        if ($myrow['amount'] != null) {
            $rep->AmountCol(7, 8, $myrow['amount'], $dec);
        }
        $rep->NewLine(1, 2);
    }
    $rep->Line($rep->row + 4);
    $rep->End();
}
 public function actionViewJurnalUmum()
 {
     global $systypes_array;
     $from = $_POST['from_date'];
     $to = $_POST['to_date'];
     $row = Mt::get_general_ledger_trans($from, $to);
     foreach ($row as $myrow) {
         $arr['data'][] = array('type' => $systypes_array[$myrow['type']], 'type_no' => $myrow['type_no'], 'tgl' => sql2date($myrow['tran_date']), 'account' => $myrow['account'], 'debit' => $myrow['amount'] >= 0 ? number_format($myrow['amount'], 2) : '', 'kredit' => $myrow['amount'] < 0 ? number_format(-$myrow['amount'], 2) : '');
     }
     echo CJSON::encode($arr);
     Yii::app()->end();
 }
Example #11
0
function display_gl_heading($myrow)
{
    global $table_style;
    $trans_name = systypes::name($_GET['type_id']);
    start_table("{$table_style} width=95%");
    $th = array(tr("General Ledger Transaction Details"), tr("Date"), tr("Person/Item"));
    table_header($th);
    start_row();
    label_cell("{$trans_name} #" . $_GET['trans_no']);
    label_cell(sql2date($myrow["tran_date"]));
    label_cell(payment_person_types::person_name($myrow["person_type_id"], $myrow["person_id"]));
    end_row();
    comments_display_row($_GET['type_id'], $_GET['trans_no']);
    end_table(1);
}
Example #12
0
function display_gl_heading($myrow)
{
    global $systypes_array;
    $trans_name = $systypes_array[$_GET['type_id']];
    start_table(TABLESTYLE, "width='95%'");
    $th = array(_("General Ledger Transaction Details"), _("Reference"), _("Date"), _("Person/Item"));
    table_header($th);
    start_row();
    label_cell("{$trans_name} #" . $_GET['trans_no']);
    label_cell($myrow["reference"]);
    label_cell(sql2date($myrow["tran_date"]));
    label_cell(payment_person_name($myrow["person_type_id"], $myrow["person_id"]));
    end_row();
    comments_display_row($_GET['type_id'], $_GET['trans_no']);
    end_table(1);
}
function can_process()
{
    global $wo_details;
    if (!references::is_valid($_POST['ref'])) {
        display_error(tr("You must enter a reference."));
        set_focus('ref');
        return false;
    }
    if (!is_new_reference($_POST['ref'], 29)) {
        display_error(tr("The entered reference is already in use."));
        set_focus('ref');
        return false;
    }
    if (!check_num('quantity', 0)) {
        display_error(tr("The quantity entered is not a valid number or less then zero."));
        set_focus('quantity');
        return false;
    }
    if (!is_date($_POST['date_'])) {
        display_error(tr("The entered date is invalid."));
        set_focus('date_');
        return false;
    } elseif (!is_date_in_fiscalyear($_POST['date_'])) {
        display_error(tr("The entered date is not in fiscal year."));
        set_focus('date_');
        return false;
    }
    if (date_diff(sql2date($wo_details["released_date"]), $_POST['date_'], "d") > 0) {
        display_error(tr("The production date cannot be before the release date of the work order."));
        set_focus('date_');
        return false;
    }
    // if unassembling we need to check the qoh
    if ($_POST['ProductionType'] == 0 && !sys_prefs::allow_negative_stock()) {
        $wo_details = get_work_order($_POST['selected_id']);
        $qoh = get_qoh_on_date($wo_details["stock_id"], $wo_details["loc_code"], $date_);
        if (-$_POST['quantity'] + $qoh < 0) {
            display_error(tr("The unassembling cannot be processed because there is insufficient stock."));
            set_focus('quantity');
            return false;
        }
    }
    return true;
}
Example #14
0
function display_gl_heading($myrow)
{
    global $systypes_array;
    $title = "";
    //moodlearning
    if ($myrow['type'] == 55 || $myrow['type'] == 1) {
        if ($myrow['type'] == 0) {
            $title = "JV No.";
            $num = substr($ser['year'], 2);
        }
        if ($myrow['type'] == 55) {
            $voucher_type = "Check Voucher";
            $title = "CV No.";
            $myDateTime = DateTime::createFromFormat('Y-m-d', $myrow['tran_date']);
            $newDateString = $myDateTime->format('d-m-Y');
            $year = substr($newDateString, 8) . "-";
        }
    }
    $trans_name = $systypes_array[$_GET['type_id']];
    start_table(TABLESTYLE, "width=95%");
    if ($myrow['type'] == 0 || $myrow['type'] == 1 || $myrow['type'] == 55) {
        $th = array(_("General Ledger Transaction Details"), _("Reference"), _("Date"), _("Person/Item"), $title);
    } else {
        $th = array(_("General Ledger Transaction Details"), _("Reference"), _("Date"), _("Person/Item"));
    }
    table_header($th);
    start_row();
    if ($custom == 0) {
        label_cell("{$trans_name} #" . $_GET['type_id']);
    } else {
        label_cell("{$trans_name} #" . get_customized_no($myrow['type'], $myrow['type_no']));
    }
    label_cell($myrow["reference"]);
    label_cell(sql2date($myrow["tran_date"]));
    label_cell(payment_person_name($myrow["person_type_id"], $myrow["person_id"]));
    if ($myrow['type'] == 0 || $myrow['type'] == 1 || $myrow['type'] == 55) {
        label_cell($year . str_pad(get_customized_no($myrow['type'], $myrow['type_no']), 4, 0, STR_PAD_LEFT));
    }
    //moodlearning
    end_row();
    comments_display_row($_GET['type_id'], $_GET['trans_no']);
    end_table(1);
}
Example #15
0
function display_wo_production($prod_id)
{
    $myrow = get_work_order_produce($prod_id);
    br(1);
    start_table(TABLESTYLE);
    $th = array(_("Production #"), _("Reference"), _("For Work Order #"), _("Item"), _("Quantity Manufactured"), _("Date"));
    table_header($th);
    start_row();
    label_cell($myrow["id"]);
    label_cell($myrow["reference"]);
    label_cell(get_trans_view_str(ST_WORKORDER, $myrow["workorder_id"]));
    label_cell($myrow["stock_id"] . " - " . $myrow["StockDescription"]);
    qty_cell($myrow["quantity"], false, get_qty_dec($myrow["stock_id"]));
    label_cell(sql2date($myrow["date_"]));
    end_row();
    comments_display_row(ST_MANURECEIVE, $prod_id);
    end_table(1);
    is_voided_display(ST_MANURECEIVE, $prod_id, _("This production has been voided."));
}
Example #16
0
function display_wo_production($prod_id)
{
    global $table_style;
    $myrow = get_work_order_produce($prod_id);
    start_table($table_style);
    $th = array(tr("Production #"), tr("Reference"), tr("For Work Order #"), tr("Item"), tr("Quantity Manufactured"), tr("Date"));
    table_header($th);
    start_row();
    label_cell($myrow["id"]);
    label_cell($myrow["reference"]);
    label_cell(get_trans_view_str(systypes::work_order(), $myrow["workorder_id"]));
    label_cell($myrow["stock_id"] . " - " . $myrow["StockDescription"]);
    qty_cell($myrow["quantity"]);
    label_cell(sql2date($myrow["date_"]));
    end_row();
    comments_display_row(29, $prod_id);
    end_table(1);
    is_voided_display(29, $prod_id, tr("This production has been voided."));
}
Example #17
0
function display_wo_issue($issue_no)
{
    $myrow = get_work_order_issue($issue_no);
    br(1);
    start_table(TABLESTYLE);
    $th = array(_("Issue #"), _("Reference"), _("For Work Order #"), _("Item"), _("From Location"), _("To Work Centre"), _("Date of Issue"));
    table_header($th);
    start_row();
    label_cell($myrow["issue_no"]);
    label_cell($myrow["reference"]);
    label_cell(get_trans_view_str(ST_WORKORDER, $myrow["workorder_id"]));
    label_cell($myrow["stock_id"] . " - " . $myrow["description"]);
    label_cell($myrow["location_name"]);
    label_cell($myrow["WorkCentreName"]);
    label_cell(sql2date($myrow["issue_date"]));
    end_row();
    comments_display_row(28, $issue_no);
    end_table(1);
    is_voided_display(28, $issue_no, _("This issue has been voided."));
}
Example #18
0
 function render($id, $title)
 {
     $sql = '';
     if (isset($this->orderby)) {
         $sql .= 'SELECT  `Week End`, `Week no`, `Gross Sales`, `Net Sales`, `Tax` ' . 'FROM (';
     }
     $sql .= 'SELECT max(bt.trans_date) `Week End`, ' . 'weekofyear(bt.trans_date) `Week no`, ' . 'sum((ttd.net_amount+ttd.amount)*ex_rate) `Gross Sales`, ' . 'sum(ttd.net_amount*ex_rate) `Net Sales`, ' . 'sum(ttd.amount*ex_rate) `Tax` ' . 'FROM ' . TB_PREF . 'bank_trans bt ' . 'INNER JOIN ' . TB_PREF . 'cust_allocations ca ' . 'ON bt.type = ca.trans_type_from ' . 'AND bt.trans_no = ca.trans_no_from ' . 'INNER JOIN ' . TB_PREF . 'debtor_trans dt ' . 'ON dt.type = ca.trans_type_from ' . 'AND dt.trans_no = ca.trans_no_from ' . 'INNER JOIN ' . TB_PREF . 'debtors_master dm ' . 'ON dt.debtor_no = dm.debtor_no ' . 'INNER JOIN ' . TB_PREF . 'trans_tax_details ttd ' . 'ON ttd.trans_type = ca.trans_type_to ' . 'AND ttd.trans_no = ca.trans_no_to ' . 'INNER JOIN ' . TB_PREF . 'tax_types tt ' . 'ON tt.id = ttd.tax_type_id ';
     if ($this->data_filter != '') {
         $sql .= ' WHERE ' . $this->data_filter;
     }
     $sql .= ' GROUP BY weekofyear(bt.trans_date) ';
     if (isset($this->orderby)) {
         $sql .= ') items order by `' . $this->orderby . '` ' . $this->orderby_seq;
     }
     if (isset($this->top)) {
         $sql .= ' limit ' . $this->top;
     }
     $result = db_query($sql) or die(_('Error getting weekly sales data'));
     $rows = array();
     //flag is not needed
     $flag = true;
     $table = array();
     $table['cols'] = array(array('label' => 'Week End', 'type' => 'string'), array('label' => 'Gross Sales', 'type' => 'number'));
     $rows = array();
     while ($r = db_fetch_assoc($result)) {
         $temp = array();
         // the following line will used to slice the Pie chart
         $temp[] = array('v' => (string) $r['Week End'], 'f' => sql2date($r['Week End']));
         $temp[] = array('v' => (double) $r['Gross Sales'], 'f' => number_format2($r['Gross Sales'], user_price_dec()));
         $rows[] = array('c' => $temp);
     }
     $table['rows'] = $rows;
     $jsonTable = json_encode($table);
     $js = "google.load('visualization', '1', {'packages':['corechart','table']});\ngoogle.setOnLoadCallback(drawChart" . $id . ");\nfunction drawChart" . $id . "() {\n  var data = new google.visualization.DataTable(" . $jsonTable . ");\n  var options = {";
     if ($this->graph_type != 'Table') {
         $js .= "height: 300, ";
     }
     $js .= "title: '" . $title . "'\n    };\n  var chart" . $id . " = new google.visualization." . $this->graph_type . "(document.getElementById('widget_div_" . $id . "'));\n  chart" . $id . ".draw(data, options);\n}";
     add_js_source($js);
 }
 function render($id, $title)
 {
     $sql = 'SELECT * FROM (SELECT max(trans_date) `Week End`, ' . 'concat(cast(case when weekofyear(trans_date) = 1 and month(trans_date)=12 then year(trans_date) + 1 else year(trans_date) end as char),cast(weekofyear(trans_date) as char)) `Week No`, ' . 'sum(case when weekday(trans_date)=0 then gross_output else 0 end) Monday, ' . 'sum(case when weekday(trans_date)=1 then gross_output else 0 end) Tuesday, ' . 'sum(case when weekday(trans_date)=2 then gross_output else 0 end) Wednesday, ' . 'sum(case when weekday(trans_date)=3 then gross_output else 0 end) Thursday, ' . 'sum(case when weekday(trans_date)=4 then gross_output else 0 end) Friday, ' . 'sum(case when weekday(trans_date)=5 then gross_output else 0 end) Saturday, ' . 'sum(case when weekday(trans_date)=6 then gross_output else 0 end) Sunday ' . 'FROM (SELECT bt.trans_date trans_date, ' . 'sum((ttd.net_amount+ttd.amount)*ex_rate) gross_output, ' . 'sum(ttd.net_amount*ex_rate) net_output, ' . 'sum(ttd.amount*ex_rate) payable  ' . 'FROM ' . TB_PREF . 'bank_trans bt  ' . 'INNER JOIN ' . TB_PREF . 'cust_allocations ca  ' . 'ON bt.type = ca.trans_type_from  ' . 'AND bt.trans_no = ca.trans_no_from  ' . 'INNER JOIN ' . TB_PREF . 'debtor_trans dt  ' . 'ON dt.type = ca.trans_type_from  ' . 'AND dt.trans_no = ca.trans_no_from  ' . 'INNER JOIN ' . TB_PREF . 'debtors_master dm ' . 'ON dt.debtor_no = dm.debtor_no ' . 'INNER JOIN ' . TB_PREF . 'trans_tax_details ttd  ' . 'ON ttd.trans_type = ca.trans_type_to  ' . 'AND ttd.trans_no = ca.trans_no_to  ' . 'INNER JOIN ' . TB_PREF . 'tax_types tt  ' . 'ON tt.id = ttd.tax_type_id  ';
     if ($this->data_filter != '') {
         $sql .= ' WHERE ' . $this->data_filter;
     }
     $sql .= ' GROUP BY bt.trans_date  ' . ') days ' . 'GROUP BY concat(cast(case when weekofyear(trans_date) = 1 and month(trans_date)=12 then year(trans_date) + 1 else year(trans_date) end as char),cast(weekofyear(trans_date) as char)) ' . 'ORDER BY max(trans_date) desc ';
     if (isset($this->top)) {
         $sql .= ' limit ' . $this->top;
     }
     $sql .= ") weeks ORDER BY `Week End`";
     $result = db_query($sql) or die(_('Error getting daily sales data'));
     $rows = array();
     //flag is not needed
     $flag = true;
     $table = array();
     $table['cols'] = array(array('label' => 'Week End', 'type' => 'string'), array('label' => 'Monday', 'type' => 'number'), array('label' => 'Tuesday', 'type' => 'number'), array('label' => 'Wednesday', 'type' => 'number'), array('label' => 'Thursday', 'type' => 'number'), array('label' => 'Friday', 'type' => 'number'), array('label' => 'Saturday', 'type' => 'number'), array('label' => 'Sunday', 'type' => 'number'));
     $rows = array();
     while ($r = db_fetch_assoc($result)) {
         $temp = array();
         // the following line will used to slice the Pie chart
         $temp[] = array('v' => (string) $r['Week End'], 'f' => sql2date($r['Week End']));
         $temp[] = array('v' => (double) $r['Monday'], 'f' => number_format2($r['Monday'], user_price_dec()));
         $temp[] = array('v' => (double) $r['Tuesday'], 'f' => number_format2($r['Tuesday'], user_price_dec()));
         $temp[] = array('v' => (double) $r['Wednesday'], 'f' => number_format2($r['Wednesday'], user_price_dec()));
         $temp[] = array('v' => (double) $r['Thursday'], 'f' => number_format2($r['Thursday'], user_price_dec()));
         $temp[] = array('v' => (double) $r['Friday'], 'f' => number_format2($r['Friday'], user_price_dec()));
         $temp[] = array('v' => (double) $r['Saturday'], 'f' => number_format2($r['Saturday'], user_price_dec()));
         $temp[] = array('v' => (double) $r['Sunday'], 'f' => number_format2($r['Sunday'], user_price_dec()));
         $rows[] = array('c' => $temp);
     }
     $table['rows'] = $rows;
     $jsonTable = json_encode($table);
     $js = "google.load('visualization', '1', {'packages':['corechart','table']});\ngoogle.setOnLoadCallback(drawChart" . $id . ");\nfunction drawChart" . $id . "() {\n  var data = new google.visualization.DataTable(" . $jsonTable . ");\n  var options = {";
     if ($this->graph_type != 'Table') {
         $js .= "height: 300, ";
     }
     $js .= "title: '" . $title . "'\n      };\n  var chart" . $id . " = new google.visualization." . $this->graph_type . "(document.getElementById('widget_div_" . $id . "'));\n  chart" . $id . ".draw(data, options);\n}";
     add_js_source($js);
 }
Example #20
0
 function render($id, $title)
 {
     global $path_to_root;
     include_once $path_to_root . "/includes/ui.inc";
     if (!defined('FLOAT_COMP_DELTA')) {
         define('FLOAT_COMP_DELTA', 0.004);
     }
     $today = date2sql(Today());
     $sql = "SELECT trans.trans_no, trans.reference, trans.tran_date, trans.due_date, debtor.debtor_no,\n            debtor.name, branch.br_name, debtor.curr_code,\n            (trans.ov_amount + trans.ov_gst + trans.ov_freight\n                + trans.ov_freight_tax + trans.ov_discount) AS total,\n            (trans.ov_amount + trans.ov_gst + trans.ov_freight\n                + trans.ov_freight_tax + trans.ov_discount - trans.alloc) AS remainder,\n            DATEDIFF('{$today}', trans.due_date) AS days\n            FROM " . TB_PREF . "debtor_trans as trans, " . TB_PREF . "debtors_master as debtor,\n                " . TB_PREF . "cust_branch as branch\n            WHERE debtor.debtor_no = trans.debtor_no AND trans.branch_code = branch.branch_code\n                AND trans.type = " . ST_SALESINVOICE . " AND (trans.ov_amount + trans.ov_gst + trans.ov_freight\n                + trans.ov_freight_tax + trans.ov_discount - trans.alloc) > " . FLOAT_COMP_DELTA . "\n                AND DATEDIFF('{$today}', trans.due_date) > 0 ORDER BY days DESC";
     if ($this->data_filter != '') {
         $sql .= ' AND ' . $this->data_filter;
     }
     $result = db_query($sql);
     $title = db_num_rows($result) . _(" Overdue Sales Invoices");
     br(1);
     display_heading($title);
     br();
     $th = array("#", _("Date"), _("Due Date"), _("Customer"), _("Currency"), _("Total"), _("Remainder"), _("Days"));
     start_table(TABLESTYLE, "width=98%");
     table_header($th);
     $k = 0;
     //row colour counter
     while ($myrow = db_fetch($result)) {
         alt_table_row_color($k);
         label_cell(get_trans_view_str(ST_SALESINVOICE, $myrow["trans_no"]));
         label_cell(sql2date($myrow['tran_date']));
         label_cell(sql2date($myrow['due_date']));
         $name = $myrow["debtor_no"] . " " . $myrow["name"];
         label_cell($name);
         label_cell($myrow['curr_code']);
         amount_cell($myrow['total']);
         amount_cell($myrow['remainder']);
         label_cell($myrow['days'], "align='right'");
         end_row();
     }
     end_table(1);
 }
Example #21
0
 function render($id, $title)
 {
     global $path_to_root;
     include_once $path_to_root . "/includes/ui.inc";
     $end_date = date2sql(add_days(Today(), $this->days_future));
     $role_id = $_SESSION["wa_current_user"]->access;
     $sql = "SELECT id, description, next_date FROM " . TB_PREF . "dashboard_reminders " . " WHERE next_date < '{$end_date}'" . " AND role_id = '{$role_id}'";
     if ($this->data_filter != '') {
         $sql .= ' AND ' . $this->data_filter;
     }
     $sql .= " ORDER BY next_date";
     $result = db_query($sql);
     br();
     $th = array(_("Actioned"), _("Date"), _("Description"));
     start_table(TABLESTYLE, "id='reminder' width=98%");
     table_header($th);
     $k = 0;
     //row colour counter
     while ($myrow = db_fetch($result)) {
         $nextdate = sql2date($myrow["next_date"]);
         if (date1_greater_date2(Today(), $nextdate)) {
             $extra = "class='reminder_overdue'";
         } elseif (Today() == $nextdate) {
             $extra = "class='reminder_due'";
         } else {
             $extra = "class='reminder'";
         }
         alt_table_row_color($k);
         $js = 'setTimeout(function(){updateToDoData(' . $myrow["id"] . ');}, 0);';
         check_cells(null, null, null, $js);
         label_cell($nextdate, $extra);
         label_cell("<pre>" . $myrow["description"] . "</pre>", $extra);
         end_row();
     }
     end_table(1);
 }
function can_process()
{
    global $wo_details;
    if (!check_num('costs', 0)) {
        display_error(_("The amount entered is not a valid number or less then zero."));
        set_focus('costs');
        return false;
    }
    if (!is_date($_POST['date_'])) {
        display_error(_("The entered date is invalid."));
        set_focus('date_');
        return false;
    } elseif (!is_date_in_fiscalyear($_POST['date_'])) {
        display_error(_("The entered date is not in fiscal year."));
        set_focus('date_');
        return false;
    }
    if (date_diff2(sql2date($wo_details["released_date"]), $_POST['date_'], "d") > 0) {
        display_error(_("The additional cost date cannot be before the release date of the work order."));
        set_focus('date_');
        return false;
    }
    return true;
}
}
$result = get_year_assets($_POST['year']);
start_form();
start_table(TABLESTYLE, "width=75%");
$th = array(_("Asset Type"), _("Asset Name"), _("Serial Number"), _("Purchase Date"), _("Purchase Price"), _("Disposal Date"), _("Disposal Amount"));
inactive_control_column($th);
table_header($th);
$k = 0;
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    label_cell($myrow["asset_type_name"]);
    label_cell($myrow["asset_name"]);
    label_cell($myrow["asset_serial"]);
    label_cell(sql2date($myrow["purchase_date"]));
    amount_cell($myrow["purchase_value"]);
    label_cell(sql2date($myrow["disposal_date"]));
    amount_cell($myrow["disposal_amount"]);
    end_row();
}
end_table(1);
//-------------------------------------------------------------------------------------------------------------------
$vresult = get_year_asset_valuations($_POST['year']);
start_form();
start_table(TABLESTYLE, "width=75%");
$th = array(_("Name"), _("Serial Number"), _("Valuation Year"), _("Asset Value"), _("Value Change"));
inactive_control_column($th);
table_header($th);
$k = 0;
while ($myrow = db_fetch($vresult)) {
    alt_table_row_color($k);
    label_cell($myrow["asset_name"]);
echo "<br>";
start_table(TABLESTYLE, "width=80%");
if ($show_currencies) {
    $colspan1 = 1;
    $colspan2 = 7;
} else {
    $colspan1 = 3;
    $colspan2 = 5;
}
start_row();
label_cells(_("To Bank Account"), $to_trans['bank_account_name'], "class='tableheader2'");
if ($show_currencies) {
    label_cells(_("Currency"), $to_trans['bank_curr_code'], "class='tableheader2'");
}
label_cells(_("Amount"), number_format2($to_trans['amount'], user_price_dec()), "class='tableheader2'", "align=right");
label_cells(_("Date"), sql2date($to_trans['trans_date']), "class='tableheader2'");
end_row();
start_row();
label_cells(_("From"), payment_person_name($to_trans['person_type_id'], $to_trans['person_id']), "class='tableheader2'", "colspan={$colspan1}");
if ($show_currencies) {
    label_cells(_("Settle currency"), $to_trans['settle_curr'], "class='tableheader2'");
    label_cells(_("Settled amount"), number_format2($to_trans['settled_amount'], user_price_dec()), "class='tableheader2'");
}
label_cells(_("Deposit Type"), $bank_transfer_types[$to_trans['account_type']], "class='tableheader2'");
end_row();
start_row();
label_cells(_("Reference"), $to_trans['ref'], "class='tableheader2'", "colspan={$colspan2}");
end_row();
comments_display_row(ST_BANKDEPOSIT, $trans_no);
end_table(1);
is_voided_display(ST_BANKDEPOSIT, $trans_no, _("This deposit has been voided."));
function display_grn_items_for_selection()
{
    global $table_style;
    $result = get_grn_items(0, $_SESSION['supp_trans']->supplier_id, true);
    if (db_num_rows($result) == 0) {
        display_note(tr("There are no outstanding items received from this supplier that have not been invoiced by them."), 0, 1);
        end_page();
        exit;
    }
    /*Set up a table to show the outstanding GRN items for selection */
    start_form(false, true);
    display_heading2(tr("Items Received Yet to be Invoiced"));
    start_table("{$table_style} colspan=7 width=95%");
    $th = array(tr("Delivery"), tr("Sequence #"), tr("P.O."), tr("Item"), tr("Description"), tr("Received On"), tr("Quantity Received"), tr("Quantity Invoiced"), tr("Uninvoiced Quantity"), tr("Order Price"), tr("Total"));
    table_header($th);
    $i = $k = 0;
    while ($myrow = db_fetch($result)) {
        $grn_already_on_invoice = False;
        foreach ($_SESSION['supp_trans']->grn_items as $entered_grn) {
            if ($entered_grn->id == $myrow["id"]) {
                $grn_already_on_invoice = True;
            }
        }
        if ($grn_already_on_invoice == False) {
            alt_table_row_color($k);
            label_cell(get_trans_view_str(25, $myrow["grn_batch_id"]));
            //text_cells(null, 'grn_item_id', $myrow["id"]);
            submit_cells('grn_item_id', $myrow["id"]);
            label_cell(get_trans_view_str(systypes::po(), $myrow["purch_order_no"]));
            label_cell($myrow["item_code"]);
            label_cell($myrow["description"]);
            label_cell(sql2date($myrow["delivery_date"]));
            qty_cell($myrow["qty_recd"]);
            qty_cell($myrow["quantity_inv"]);
            qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"]);
            amount_cell($myrow["unit_price"]);
            amount_cell(round($myrow["unit_price"] * ($myrow["qty_recd"] - $myrow["quantity_inv"]), user_price_dec()));
            end_row();
            $i++;
            if ($i > 15) {
                $i = 0;
                table_header($th);
            }
        }
    }
    end_table();
}
 $gross = $_POST['gross_salary'];
 //display_notification( $_POST['leave_days'].$_POST['monthly_loan']);
 $employee_leave_record = isset($_POST['leave_days']) ? $_POST['leave_days'] : 0;
 $staff_loan = isset($_POST['monthly_loan']) ? $_POST['monthly_loan'] : 0;
 if (db_has_employee_payslip($_POST['year'], $_POST['month'], $_POST['empl_id'])) {
     $existing_payslip = get_current_payslip($_POST['year'], $_POST['month'], $_POST['empl_id']);
     $basic_pay = $existing_payslip['basic'];
     $da_pay = $existing_payslip['da'];
     $hra_pay = $existing_payslip['hra'];
     $convey_allow = $existing_payslip['convey_allow'];
     $edu_other_allow = $existing_payslip['edu_other_allow'];
     $pf = $existing_payslip['pf'];
     $lop_amount = $existing_payslip['lop_amount'];
     $adv_sal = $tds = 0;
     $total_ded = $existing_payslip['total_ded'];
     $date_of_paid = sql2date($existing_payslip['date_of_pay']);
     $total_net = $existing_payslip['total_net'];
 } else {
     $basic_pay = $gross * 0.3;
     $da_pay = $gross * 0.2;
     $hra_pay = $gross * 0.2;
     $convey_allow = $gross * 0.1;
     $edu_other_allow = $gross * 0.2;
     $pf = ($basic_pay + $da_pay) * 0.12;
     $lop_amount = $employee_leave_record * $gross / 25;
     $adv_sal = $tds = 0;
     $total_ded = $pf + $staff_loan + $adv_sal + $tds + $lop_amount;
     $net_sal = $gross - $total_ded;
     $total_net = $net_sal;
 }
 //hidden('pay_array', implode(', ', array_map(function ($v, $k) { return $k . '=' . $v; }, $pay_array, array_keys($pay_array))));
Example #27
0
function check_trans()
{
    global $Refs;
    $input_error = 0;
    if ($_SESSION['pay_items']->count_gl_items() < 1) {
        display_error(_("You must enter at least one payment line."));
        set_focus('code_id');
        $input_error = 1;
    }
    if ($_SESSION['pay_items']->gl_items_total() == 0.0) {
        display_error(_("The total bank amount cannot be 0."));
        set_focus('code_id');
        $input_error = 1;
    }
    $limit = get_bank_account_limit($_POST['bank_account'], $_POST['date_']);
    $amnt_chg = -$_SESSION['pay_items']->gl_items_total() - $_SESSION['pay_items']->original_amount;
    if ($limit !== null && floatcmp($limit, -$amnt_chg) < 0) {
        display_error(sprintf(_("The total bank amount exceeds allowed limit (%s)."), price_format($limit - $_SESSION['pay_items']->original_amount)));
        set_focus('code_id');
        $input_error = 1;
    }
    if ($trans = check_bank_account_history($amnt_chg, $_POST['bank_account'], $_POST['date_'])) {
        display_error(sprintf(_("The bank transaction would result in exceed of authorized overdraft limit for transaction: %s #%s on %s."), $systypes_array[$trans['type']], $trans['trans_no'], sql2date($trans['trans_date'])));
        set_focus('amount');
        $input_error = 1;
    }
    if (!$Refs->is_valid($_POST['ref'])) {
        display_error(_("You must enter a reference."));
        set_focus('ref');
        $input_error = 1;
    } elseif ($_POST['ref'] != $_SESSION['pay_items']->reference && !is_new_reference($_POST['ref'], $_SESSION['pay_items']->trans_type)) {
        display_error(_("The entered reference is already in use."));
        set_focus('ref');
        $input_error = 1;
    }
    if (!is_date($_POST['date_'])) {
        display_error(_("The entered date for the payment is invalid."));
        set_focus('date_');
        $input_error = 1;
    } elseif (!is_date_in_fiscalyear($_POST['date_'])) {
        display_error(_("The entered date is not in fiscal year."));
        set_focus('date_');
        $input_error = 1;
    }
    if (get_post('PayType') == PT_CUSTOMER && (!get_post('person_id') || !get_post('PersonDetailID'))) {
        display_error(_("You have to select customer and customer branch."));
        set_focus('person_id');
        $input_error = 1;
    } elseif (get_post('PayType') == PT_SUPPLIER && !get_post('person_id')) {
        display_error(_("You have to select supplier."));
        set_focus('person_id');
        $input_error = 1;
    }
    if (!db_has_currency_rates(get_bank_account_currency($_POST['bank_account']), $_POST['date_'], true)) {
        $input_error = 1;
    }
    if (isset($_POST['settled_amount']) && in_array(get_post('PayType'), array(PT_SUPPLIER, PT_CUSTOMER)) && input_num('settled_amount') <= 0) {
        display_error(_("Settled amount have to be positive number."));
        set_focus('person_id');
        $input_error = 1;
    }
    return $input_error;
}
//-------------------------------------------------------------------------------------------------
start_form();
start_table(TABLESTYLE2);
if ($selected_id != -1) {
    if ($Mode == 'Edit') {
        //editing an existing area
        $myrow = get_recurrent_invoice($selected_id);
        $_POST['description'] = $myrow["description"];
        $_POST['order_no'] = $myrow["order_no"];
        $_POST['debtor_no'] = $myrow["debtor_no"];
        $_POST['group_no'] = $myrow["group_no"];
        $_POST['days'] = $myrow["days"];
        $_POST['monthly'] = $myrow["monthly"];
        $_POST['begin'] = sql2date($myrow["begin"]);
        $_POST['end'] = sql2date($myrow["end"]);
        $_POST['last_sent'] = $myrow['last_sent'] == "0000-00-00" ? "" : sql2date($myrow["last_sent"]);
    }
    hidden("selected_id", $selected_id);
}
text_row_ex(_("Description:"), 'description', 50);
templates_list_row(_("Template:"), 'order_no');
customer_list_row(_("Customer:"), 'debtor_no', null, " ", true);
if ($_POST['debtor_no'] > 0) {
    customer_branches_list_row(_("Branch:"), $_POST['debtor_no'], 'group_no', null, false);
} else {
    sales_groups_list_row(_("Sales Group:"), 'group_no', null, " ");
}
small_amount_row(_("Days:"), 'days', 0, null, null, 0);
small_amount_row(_("Monthly:"), 'monthly', 0, null, null, 0);
date_row(_("Begin:"), 'begin');
date_row(_("End:"), 'end', null, null, 0, 0, 5);
Example #29
0
 submit_row('submit', tr("Get"));
 end_table(1);
 start_table($table_style2);
 $showdims = $dim == 1 && $_POST['dim1'] == 0 || $dim == 2 && $_POST['dim1'] == 0 && $_POST['dim2'] == 0;
 if ($showdims) {
     $th = array(tr("Period"), tr("Amount"), tr("Dim. incl."), tr("Last Year"));
 } else {
     $th = array(tr("Period"), tr("Amount"), tr("Last Year"));
 }
 table_header($th);
 $year = $_POST['fyear'];
 $sql = "SELECT * FROM fiscal_year WHERE id={$year}";
 $result = db_query($sql, "could not get current fiscal year");
 $fyear = db_fetch($result);
 $begin = sql2date($fyear['begin']);
 $end = sql2date($fyear['end']);
 hidden('begin', $begin);
 hidden('end', $end);
 $total = $btotal = $ltotal = 0;
 for ($i = 0, $date_ = $begin; date1_greater_date2($end, $date_); $i++) {
     start_row();
     $_POST['amount' . $i] = number_format2(get_only_budget_trans_from_to($date_, $date_, $_POST['account'], $_POST['dim1'], $_POST['dim2']), 0);
     label_cell($date_);
     if (!isset($_POST['amount' . $i])) {
         $_POST['amount' . $i] = '0';
     }
     amount_cells(null, 'amount' . $i, null, 15, null, 0);
     if ($showdims) {
         $d = get_budget_trans_from_to($date_, $date_, $_POST['account'], $_POST['dim1'], $_POST['dim2']);
         label_cell(number_format2($d, 0), "nowrap align=right");
         $btotal += $d;
    $requisitionid = $_POST['requisitionid'];
    unset($_POST);
    $_POST['requisitionid'] = $requisitionid;
}
//-----------------------------------------------------------------------------------
$result = get_one_requisition(get_post('requisitionid'));
start_table(TABLESTYLE, "width=50%");
$th = array(_("Point of use"), _("Narrative"), _("Application Date"), _("Completation"));
inactive_control_column($th);
table_header($th);
$k = 0;
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    label_cell($myrow["point_of_use"]);
    label_cell($myrow["narrative"]);
    label_cell(sql2date($myrow["application_date"]));
    echo "<td><a href='requisition_details.php?complete=yes&requisitionid=" . $myrow['requisition_id'] . "'>" . _("Complete") . "</a></td>\n";
    end_row();
}
end_table(1);
//-----------------------------------------------------------------------------------
echo "<hr/>\n";
$result = get_all_requisition_details(get_post('requisitionid'));
start_form();
start_table(TABLESTYLE, "width=50%");
$th = array(_("Item Code"), _("Item Name"), _("Purpose"), _("Qrder Quantity"), _("Estimate Price"), "", "");
table_header($th);
$k = 0;
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    label_cell($myrow["item_code"]);