예제 #1
0
function edit_allocations_for_transaction($type, $trans_no)
{
    global $systypes_array;
    $cart = $_SESSION['alloc'];
    display_heading(sprintf(_("Allocation of %s # %d"), $systypes_array[$cart->type], $cart->trans_no));
    display_heading($cart->person_name);
    display_heading2(_("Date:") . " <b>" . $cart->date_ . "</b>");
    display_heading2(_("Total:") . " <b>" . price_format($cart->bank_amount) . ' ' . $cart->currency . "</b>");
    if ($cart->currency != $cart->person_curr) {
        $total = _("Total in clearing currency:") . " <b>" . price_format($cart->amount) . "</b>" . sprintf(" %s (%s %s/%s)", $cart->person_curr, exrate_format($cart->bank_amount / $cart->amount), $cart->currency, $cart->person_curr);
        display_heading2($total);
    }
    echo "<br>";
    start_form();
    div_start('alloc_tbl');
    if (count($cart->allocs) > 0) {
        show_allocatable(true);
        submit_center_first('UpdateDisplay', _("Refresh"), _('Start again allocation of selected amount'), true);
        submit('Process', _("Process"), true, _('Process allocations'), 'default');
        submit_center_last('Cancel', _("Back to Allocations"), _('Abandon allocations and return to selection of allocatable amounts'), 'cancel');
    } else {
        display_note(_("There are no unsettled transactions to allocate."), 0, 1);
        submit_center('Cancel', _("Back to Allocations"), true, _('Abandon allocations and return to selection of allocatable amounts'), 'cancel');
    }
    div_end();
    end_form();
}
예제 #2
0
 public function show()
 {
     $list_div = array('id' => $this->name . '_div', 'class' => 'list');
     $list = array('id' => $this->name . '_list', 'class' => 'list');
     echo div_start($list_div);
     echo table($this->items, $list);
     echo div_end();
 }
예제 #3
0
function edit_allocations_for_transaction($type, $trans_no)
{
    global $systypes_array;
    start_form();
    display_heading(_("Allocation of") . " " . $systypes_array[$_SESSION['alloc']->type] . " # " . $_SESSION['alloc']->trans_no);
    display_heading($_SESSION['alloc']->person_name);
    display_heading2(_("Date:") . " <b>" . $_SESSION['alloc']->date_ . "</b>");
    display_heading2(_("Total:") . " <b>" . price_format(-$_SESSION['alloc']->amount) . "</b>");
    echo "<br>";
    div_start('alloc_tbl');
    if (count($_SESSION['alloc']->allocs) > 0) {
        show_allocatable(true);
        submit_center_first('UpdateDisplay', _("Refresh"), _('Start again allocation of selected amount'), true);
        submit('Process', _("Process"), true, _('Process allocations'), 'default');
        submit_center_last('Cancel', _("Back to Allocations"), _('Abandon allocations and return to selection of allocatable amounts'), 'cancel');
    } else {
        display_note(_("There are no unsettled transactions to allocate."), 0, 1);
        submit_center('Cancel', _("Back to Allocations"), true, _('Abandon allocations and return to selection of allocatable amounts'), 'cancel');
    }
    div_end();
    end_form();
}
예제 #4
0
파일: sales_kits.php 프로젝트: M-Shahbaz/FA
function display_kit_items($selected_kit)
{
    $result = get_item_kit($selected_kit);
    div_start('bom');
    start_table(TABLESTYLE, "width='60%'");
    $th = array(_("Stock Item"), _("Description"), _("Quantity"), _("Units"), '', '');
    table_header($th);
    $k = 0;
    while ($myrow = db_fetch($result)) {
        alt_table_row_color($k);
        label_cell($myrow["stock_id"]);
        label_cell($myrow["comp_name"]);
        qty_cell($myrow["quantity"], false, $myrow["units"] == '' ? 0 : get_qty_dec($myrow["comp_name"]));
        label_cell($myrow["units"] == '' ? _('kit') : $myrow["units"]);
        edit_button_cell("Edit" . $myrow['id'], _("Edit"));
        delete_button_cell("Delete" . $myrow['id'], _("Delete"));
        end_row();
    }
    //END WHILE LIST LOOP
    end_table();
    div_end();
}
예제 #5
0
function display_bom_items($selected_parent)
{
    $result = get_bom($selected_parent);
    div_start('bom');
    start_table(TABLESTYLE, "width=60%");
    $th = array(_("Code"), _("Description"), _("Location"), _("Work Centre"), _("Quantity"), _("Units"), '', '');
    table_header($th);
    $k = 0;
    while ($myrow = db_fetch($result)) {
        alt_table_row_color($k);
        label_cell($myrow["component"]);
        label_cell($myrow["description"]);
        label_cell($myrow["location_name"]);
        label_cell($myrow["WorkCentreDescription"]);
        qty_cell($myrow["quantity"], false, get_qty_dec($myrow["component"]));
        label_cell($myrow["units"]);
        edit_button_cell("Edit" . $myrow['id'], _("Edit"));
        delete_button_cell("Delete" . $myrow['id'], _("Delete"));
        end_row();
    }
    //END WHILE LIST LOOP
    end_table();
    div_end();
}
예제 #6
0
function customer_settings($selected_id)
{
    global $SysPrefs, $path_to_root, $auto_create_branch;
    if (!$selected_id) {
        if (list_updated('customer_id') || !isset($_POST['CustName'])) {
            $_POST['CustName'] = $_POST['cust_ref'] = $_POST['address'] = $_POST['tax_id'] = '';
            $_POST['dimension_id'] = 0;
            $_POST['dimension2_id'] = 0;
            $_POST['sales_type'] = -1;
            $_POST['curr_code'] = get_company_currency();
            $_POST['credit_status'] = -1;
            $_POST['payment_terms'] = $_POST['notes'] = '';
            $_POST['discount'] = $_POST['pymt_discount'] = percent_format(0);
            $_POST['credit_limit'] = price_format($SysPrefs->default_credit_limit());
        }
    } else {
        $myrow = get_customer($selected_id);
        $_POST['CustName'] = $myrow["name"];
        $_POST['cust_ref'] = $myrow["debtor_ref"];
        $_POST['address'] = $myrow["address"];
        $_POST['tax_id'] = $myrow["tax_id"];
        $_POST['dimension_id'] = $myrow["dimension_id"];
        $_POST['dimension2_id'] = $myrow["dimension2_id"];
        $_POST['sales_type'] = $myrow["sales_type"];
        $_POST['curr_code'] = $myrow["curr_code"];
        $_POST['credit_status'] = $myrow["credit_status"];
        $_POST['payment_terms'] = $myrow["payment_terms"];
        $_POST['discount'] = percent_format($myrow["discount"] * 100);
        $_POST['pymt_discount'] = percent_format($myrow["pymt_discount"] * 100);
        $_POST['credit_limit'] = price_format($myrow["credit_limit"]);
        $_POST['notes'] = $myrow["notes"];
        $_POST['inactive'] = $myrow["inactive"];
    }
    start_outer_table(TABLESTYLE2);
    table_section(1);
    table_section_title(_("Name and Address"));
    text_row(_("Customer Name:"), 'CustName', $_POST['CustName'], 40, 80);
    text_row(_("Customer Short Name:"), 'cust_ref', null, 30, 30);
    textarea_row(_("Address:"), 'address', $_POST['address'], 35, 5);
    text_row(_("GSTNo:"), 'tax_id', null, 40, 40);
    if (!$selected_id || is_new_customer($selected_id)) {
        currencies_list_row(_("Customer's Currency:"), 'curr_code', $_POST['curr_code']);
    } else {
        label_row(_("Customer's Currency:"), $_POST['curr_code']);
        hidden('curr_code', $_POST['curr_code']);
    }
    sales_types_list_row(_("Sales Type/Price List:"), 'sales_type', $_POST['sales_type']);
    if ($selected_id) {
        record_status_list_row(_("Customer status:"), 'inactive');
    } elseif (isset($auto_create_branch) && $auto_create_branch == 1) {
        table_section_title(_("Branch"));
        text_row(_("Phone:"), 'phone', null, 32, 30);
        text_row(_("Secondary Phone Number:"), 'phone2', null, 32, 30);
        text_row(_("Fax Number:"), 'fax', null, 32, 30);
        email_row(_("E-mail:"), 'email', null, 35, 55);
        sales_persons_list_row(_("Sales Person:"), 'salesman', null);
    }
    table_section(2);
    table_section_title(_("Sales"));
    percent_row(_("Discount Percent:"), 'discount', $_POST['discount']);
    percent_row(_("Prompt Payment Discount Percent:"), 'pymt_discount', $_POST['pymt_discount']);
    amount_row(_("Credit Limit:"), 'credit_limit', $_POST['credit_limit']);
    payment_terms_list_row(_("Payment Terms:"), 'payment_terms', $_POST['payment_terms']);
    credit_status_list_row(_("Credit Status:"), 'credit_status', $_POST['credit_status']);
    $dim = get_company_pref('use_dimension');
    if ($dim >= 1) {
        dimensions_list_row(_("Dimension") . " 1:", 'dimension_id', $_POST['dimension_id'], true, " ", false, 1);
    }
    if ($dim > 1) {
        dimensions_list_row(_("Dimension") . " 2:", 'dimension2_id', $_POST['dimension2_id'], true, " ", false, 2);
    }
    if ($dim < 1) {
        hidden('dimension_id', 0);
    }
    if ($dim < 2) {
        hidden('dimension2_id', 0);
    }
    if ($selected_id) {
        start_row();
        echo '<td class="label">' . _('Customer branches') . ':</td>';
        hyperlink_params_td($path_to_root . "/sales/manage/customer_branches.php", '<b>' . (@$_REQUEST['popup'] ? _("Select or &Add") : _("&Add or Edit ")) . '</b>', "debtor_no=" . $selected_id . (@$_REQUEST['popup'] ? '&popup=1' : ''));
        end_row();
    }
    textarea_row(_("General Notes:"), 'notes', null, 35, 5);
    if (!$selected_id && isset($auto_create_branch) && $auto_create_branch == 1) {
        table_section_title(_("Branch"));
        locations_list_row(_("Default Inventory Location:"), 'location');
        shippers_list_row(_("Default Shipping Company:"), 'ship_via');
        sales_areas_list_row(_("Sales Area:"), 'area', null);
        tax_groups_list_row(_("Tax Group:"), 'tax_group_id', null);
    }
    end_outer_table(1);
    div_start('controls');
    if (!$selected_id) {
        submit_center('submit', _("Add New Customer"), true, '', 'default');
    } else {
        submit_center_first('submit', _("Update Customer"), _('Update customer data'), @$_REQUEST['popup'] ? true : 'default');
        submit_return('select', $selected_id, _("Select this customer and return to document entry."));
        submit_center_last('delete', _("Delete Customer"), _('Delete customer data if have been never used'), true);
    }
    div_end();
}
예제 #7
0
function show_results()
{
    global $path_to_root;
    /*Now get the transactions  */
    div_start('trans_tbl');
    start_table(TABLESTYLE);
    $netAmounts = check_value('NetAmounts');
    if ($netAmounts) {
        $net = _("Net");
    } else {
        $net = _("Gross");
    }
    $th = array(_("Type"), _("Description"), _("Tax") . "<br>" . _("Amount"), $net . "<br>" . _("Outputs") . "/" . _("Inputs"));
    table_header($th);
    $k = 0;
    $total = 0;
    $bdate = date2sql($_POST['TransFromDate']);
    $edate = date2sql($_POST['TransToDate']);
    $taxes = get_tax_cash_summary($_POST['TransFromDate'], $_POST['TransToDate']);
    while ($tx = db_fetch($taxes)) {
        $payable = $tx['payable'];
        $collectible = $tx['collectible'];
        $net = $collectible + $payable;
        $total += $net;
        alt_table_row_color($k);
        label_cell($tx['name'] . " " . $tx['rate'] . "%");
        label_cell(_("Charged on sales") . " (" . _("Output Tax") . "):");
        amount_cell($payable);
        if ($netAmounts) {
            amount_cell($tx['net_output']);
        } else {
            amount_cell($tx['gross_output']);
        }
        end_row();
        alt_table_row_color($k);
        label_cell($tx['name'] . " " . $tx['rate'] . "%");
        label_cell(_("Paid on purchases") . " (" . _("Input Tax") . "):");
        amount_cell($collectible);
        if ($netAmounts) {
            amount_cell($tx['net_input']);
        } else {
            amount_cell($tx['gross_input']);
        }
        end_row();
        alt_table_row_color($k);
        label_cell("<b>" . $tx['name'] . " " . $tx['rate'] . "%</b>");
        label_cell("<b>" . _("Net payable or collectible") . ":</b>");
        amount_cell($net, true);
        label_cell("");
        end_row();
    }
    alt_table_row_color($k);
    label_cell("");
    label_cell("<b>" . _("Total payable or refund") . ":</b>");
    amount_cell($total, true);
    label_cell("");
    end_row();
    end_table(2);
    div_end();
}
예제 #8
0
function display_profit_and_loss()
{
    global $path_to_root, $sel;
    if (!isset($_POST['Dimension'])) {
        $_POST['Dimension'] = 0;
    }
    if (!isset($_POST['Dimension2'])) {
        $_POST['Dimension2'] = 0;
    }
    $dimension = $_POST['Dimension'];
    $dimension2 = $_POST['Dimension2'];
    $from = $_POST['TransFromDate'];
    $to = $_POST['TransToDate'];
    $compare = $_POST['Compare'];
    if (isset($_POST["AccGrp"]) && strlen($_POST['AccGrp']) > 0) {
        $drilldown = 1;
    } else {
        $drilldown = 0;
    }
    // Root level
    $dec = 0;
    $pdec = user_percent_dec();
    if ($compare == 0 || $compare == 2) {
        $end = $to;
        if ($compare == 2) {
            $begin = $from;
        } else {
            $begin = begin_fiscalyear();
        }
    } elseif ($compare == 1) {
        $begin = add_months($from, -12);
        $end = add_months($to, -12);
    }
    div_start('pl_tbl');
    start_table(TABLESTYLE, "width=50%");
    $tableheader = "<tr>\n        <td class='tableheader'>" . _("Group/Account Name") . "</td>\n        <td class='tableheader'>" . _("Period") . "</td>\n\t\t<td class='tableheader'>" . $sel[$compare] . "</td>\n\t\t<td class='tableheader'>" . _("Achieved %") . "</td>\n        </tr>";
    if (!$drilldown) {
        $parent = -1;
        $classper = 0.0;
        $classacc = 0.0;
        $salesper = 0.0;
        $salesacc = 0.0;
        //Get classes for PL
        $classresult = get_account_classes(false, 0);
        while ($class = db_fetch($classresult)) {
            $class_per_total = 0;
            $class_acc_total = 0;
            $convert = get_class_type_convert($class["ctype"]);
            //Print Class Name
            table_section_title($class["class_name"], 4);
            echo $tableheader;
            //Get Account groups/types under this group/type
            $typeresult = get_account_types(false, $class['cid'], -1);
            while ($accounttype = db_fetch($typeresult)) {
                $TypeTotal = display_type($accounttype["id"], $accounttype["name"], $from, $to, $begin, $end, $compare, $convert, $dec, $pdec, $rep, $dimension, $dimension2, $drilldown, $path_to_root);
                $class_per_total += $TypeTotal[0];
                $class_acc_total += $TypeTotal[1];
                if ($TypeTotal[0] != 0 || $TypeTotal[1] != 0) {
                    $url = "<a href='{$path_to_root}/gl/inquiry/profit_loss.php?TransFromDate=" . $from . "&TransToDate=" . $to . "&Compare=" . $compare . "&Dimension=" . $dimension . "&Dimension2=" . $dimension2 . "&AccGrp=" . $accounttype['id'] . "'>" . $accounttype['id'] . " " . $accounttype['name'] . "</a>";
                    alt_table_row_color($k);
                    label_cell($url);
                    amount_cell($TypeTotal[0] * $convert);
                    amount_cell($TypeTotal[1] * $convert);
                    amount_cell(Achieve($TypeTotal[0], $TypeTotal[1]));
                    end_row();
                }
            }
            //Print Class Summary
            start_row("class='inquirybg' style='font-weight:bold'");
            label_cell(_('Total') . " " . $class["class_name"]);
            amount_cell($class_per_total * $convert);
            amount_cell($class_acc_total * $convert);
            amount_cell(Achieve($class_per_total, $class_acc_total));
            end_row();
            $salesper += $class_per_total;
            $salesacc += $class_acc_total;
        }
        start_row("class='inquirybg' style='font-weight:bold'");
        label_cell(_('Calculated Return'));
        amount_cell($salesper * -1);
        amount_cell($salesacc * -1);
        amount_cell(achieve($salesper, $salesacc));
        end_row();
    } else {
        //Level Pointer : Global variable defined in order to control display of root
        global $levelptr;
        $levelptr = 0;
        $accounttype = get_account_type($_POST["AccGrp"]);
        $classid = $accounttype["class_id"];
        $class = get_account_class($classid);
        $convert = get_class_type_convert($class["ctype"]);
        //Print Class Name
        table_section_title($_POST["AccGrp"] . " " . get_account_type_name($_POST["AccGrp"]), 4);
        echo $tableheader;
        $classtotal = display_type($accounttype["id"], $accounttype["name"], $from, $to, $begin, $end, $compare, $convert, $dec, $pdec, $rep, $dimension, $dimension2, $drilldown, $path_to_root);
    }
    end_table(1);
    // outer table
    div_end();
}
function display_credit_options()
{
    global $Ajax;
    br();
    if (isset($_POST['_CreditType_update'])) {
        $Ajax->activate('options');
    }
    div_start('options');
    start_table(TABLESTYLE2);
    credit_type_list_row(_("Credit Note Type"), 'CreditType', null, true);
    if ($_POST['CreditType'] == "Return") {
        /*if the credit note is a return of goods then need to know which location to receive them into */
        if (!isset($_POST['Location'])) {
            $_POST['Location'] = $_SESSION['Items']->Location;
        }
        locations_list_row(_("Items Returned to Location"), 'Location', $_POST['Location']);
    } else {
        /* the goods are to be written off to somewhere */
        gl_all_accounts_list_row(_("Write off the cost of the items to"), 'WriteOffGLCode', null);
    }
    textarea_row(_("Memo"), "CreditText", null, 51, 3);
    echo "</table>";
    div_end();
}
 function pager(&$pager)
 {
     global $use_popup_windows, $use_date_picker, $path_to_root;
     $pager->select_records();
     div_start("_{$pager->name}_span");
     $headers = array();
     foreach ($pager->columns as $num_col => $col) {
         // record status control column is displayed only when control checkbox is on
         if (isset($col['head']) && ($col['type'] != 'inactive' || get_post('show_inactive'))) {
             if (!isset($col['ord'])) {
                 $headers[] = $col['head'];
             } else {
                 $icon = $col['ord'] == 'desc' ? 'sort_desc.gif' : ($col['ord'] == 'asc' ? 'sort_asc.gif' : 'sort_none.gif');
                 $headers[] = navi_button($pager->name . '_sort_' . $num_col, $col['head'], true, $icon);
             }
         }
     }
     /* show a table of records returned by the sql */
     start_table(TABLESTYLE, "width={$pager->width}");
     table_header($headers);
     if ($pager->header_fun) {
         // if set header handler
         start_row("class='{$pager->header_class}'");
         $fun = $pager->header_fun;
         if (method_exists($pager, $fun)) {
             $h = $pager->{$fun}($pager);
         } elseif (function_exists($fun)) {
             $h = $fun($pager);
         }
         foreach ($h as $c) {
             // draw header columns
             $pars = isset($c[1]) ? $c[1] : '';
             label_cell($c[0], $pars);
         }
         end_row();
     }
     $cc = 0;
     // row colour counter
     foreach ($pager->data as $line_no => $row) {
         $marker = $pager->marker;
         if ($marker && $marker($row)) {
             start_row("class='{$pager->marker_class}'");
         } else {
             alt_table_row_color($cc);
         }
         foreach ($pager->columns as $k => $col) {
             $coltype = $col['type'];
             $cell = isset($col['name']) ? $row[$col['name']] : '';
             if (isset($col['fun'])) {
                 // use data input function if defined
                 $fun = $col['fun'];
                 if (method_exists($pager, $fun)) {
                     $cell = $pager->{$fun}($row, $cell);
                 } elseif (function_exists($fun)) {
                     $cell = $fun($row, $cell);
                 } else {
                     $cell = '';
                 }
             }
             switch ($coltype) {
                 // format column
                 case 'time':
                     label_cell($cell, "width=40");
                     break;
                 case 'date':
                     label_cell(sql2date($cell), "align='center' nowrap");
                     break;
                 case 'dstamp':
                     // time stamp displayed as date
                     label_cell(sql2date(substr($cell, 0, 10)), "align='center' nowrap");
                     break;
                 case 'tstamp':
                     // time stamp - FIX user format
                     label_cell(sql2date(substr($cell, 0, 10)) . ' ' . substr($cell, 10), "align='center'");
                     break;
                 case 'percent':
                     percent_cell($cell);
                     break;
                 case 'amount':
                     if ($cell == '') {
                         label_cell('');
                     } else {
                         amount_cell($cell, false);
                     }
                     break;
                 case 'qty':
                     if ($cell == '') {
                         label_cell('');
                     } else {
                         qty_cell($cell, false, isset($col['dec']) ? $col['dec'] : null);
                     }
                     break;
                 case 'email':
                     email_cell($cell, isset($col['align']) ? "align='" . $col['align'] . "'" : null);
                     break;
                 case 'rate':
                     label_cell(number_format2($cell, user_exrate_dec()), "align=center");
                     break;
                 case 'inactive':
                     if (get_post('show_inactive')) {
                         $pager->inactive_control_cell($row);
                     }
                     break;
                 default:
                     // case 'text':
                     if (isset($col['align'])) {
                         label_cell($cell, "align='" . $col['align'] . "'");
                     } else {
                         label_cell($cell);
                     }
                 case 'skip':
                     // column not displayed
             }
         }
         end_row();
     }
     // end of while loop
     if ($pager->footer_fun) {
         // if set footer handler
         start_row("class='{$pager->footer_class}'");
         $fun = $pager->footer_fun;
         if (method_exists($pager, $fun)) {
             $h = $pager->{$fun}($pager);
         } elseif (function_exists($fun)) {
             $h = $fun($pager);
         }
         foreach ($h as $c) {
             // draw footer columns
             $pars = isset($c[1]) ? $c[1] : '';
             label_cell($c[0], $pars);
         }
         end_row();
     }
     start_row("class='navibar'");
     $colspan = count($pager->columns);
     $inact = @$pager->inactive_ctrl == true ? ' ' . checkbox(null, 'show_inactive', null, true) . _("Show also Inactive") : '';
     end_row();
     end_table();
     $but_pref = $pager->name . '_page_';
     // 			if (@$pager->inactive_ctrl)
     // 				submit('Update', _('Update'), true, '', null); // inactive update
     $context = array('first' => $this->pager_button($but_pref . 'first', _('&laquo;'), $pager->first_page), 'previous' => $this->pager_button($but_pref . 'prev', _('&lsaquo;'), $pager->prev_page), 'next' => $this->pager_button($but_pref . 'next', _('&rsaquo;'), $pager->next_page), 'last' => $this->pager_button($but_pref . 'last', _('&raquo;'), $pager->last_page));
     $from = ($pager->curr_page - 1) * $pager->page_len + 1;
     $to = $from + $pager->page_len - 1;
     if ($to > $pager->rec_count) {
         $to = $pager->rec_count;
     }
     $all = $pager->rec_count;
     // 			echo sprintf(_('Records %d-%d of %d'), $from, $to, $all);
     // 			echo $inact;
     // 			echo "</td>";
     echo ThemeBootstrap::get()->renderBlock('controls.twig.html', 'pager', $context);
     /*
     		if ($pager->rec_count) {
     			echo "<td colspan=$colspan class='navibar' style='border:none;padding:3px;'>";
     			echo "<div style='float:right;'>";
     			$but_pref = $pager->name . '_page_';
     			start_table();
     			start_row();
     			if (@$pager->inactive_ctrl)
     				submit('Update', _('Update'), true, '', null); // inactive update
     			echo navi_button_cell($but_pref . 'first', _('First'), $pager->first_page, 'right');
     			echo navi_button_cell($but_pref . 'prev', _('Prev'), $pager->prev_page, 'right');
     			echo navi_button_cell($but_pref . 'next', _('Next'), $pager->next_page, 'right');
     			echo navi_button_cell($but_pref . 'last', _('Last'), $pager->last_page, 'right');
     			end_row();
     			end_table();
     			echo "</div>";
     			$from = ($pager->curr_page - 1) * $pager->page_len + 1;
     			$to = $from + $pager->page_len - 1;
     			if ($to > $pager->rec_count)
     				$to = $pager->rec_count;
     			$all = $pager->rec_count;
     			echo sprintf(_('Records %d-%d of %d'), $from, $to, $all);
     			echo $inact;
     			echo "</td>";
     		} else {
     			label_cell(_('No records') . $inact, "colspan=$colspan class='navibar'");
     		}
     */
     if (isset($pager->marker_txt)) {
         display_note($pager->marker_txt, 0, 1, "class='{$pager->notice_class}'");
     }
     div_end();
     return true;
 }
        echo '<tr>';
        $from = Today();
        $from = add_days($from, 1);
        $bal = get_balance_before_for_bank_account(1, $from);
        //echo $trans_no = kv_get_next_trans_no(99) + 1;
        if ($total_net <= $bal) {
            submit_cells('pay_salary', _("Process Payout"), '', _('Show Results'), 'default');
        } else {
            display_warning(" Your Current Account Balance is lower than the payout!.");
        }
        echo '</tr>';
        end_table();
    } else {
        display_warning(" Paid Already!.");
    }
    div_end();
}
end_form();
if (get_post('RefreshInquiry')) {
    $Ajax->activate('gross_salary');
    $Ajax->activate('leave_days');
    $Ajax->activate('monthly_loan');
    $Ajax->activate('totals_tbl');
}
if (get_post('pay_salary')) {
    global $Refs;
    $pay_slip_id = add_payslip($_POST['year'], $_POST['month'], $_POST['empl_id'], $_POST['basic'], $_POST['da'], $_POST['hra'], $_POST['convey_allow'], $_POST['edu_other_allow'], $_POST['pf'], $_POST['lop_amount'], $_POST['tds'], $_POST['total_ded'], $_POST['total_net'], $_POST['date_of_pay']);
    add_gl_trans(99, $pay_slip_id, $_POST['date_of_pay'], 5410, 0, 0, 'employee Salary #' . $_POST['empl_id'], $_POST['total_net']);
    add_gl_trans(99, $pay_slip_id, $_POST['date_of_pay'], 1060, 0, 0, 'employee Salary #' . $_POST['empl_id'], -$_POST['total_net']);
    $trans_no = kv_get_next_trans_no(99) + 1;
    $ref = get_next_reference(99);
예제 #12
0
파일: suppliers.php 프로젝트: M-Shahbaz/FA
function supplier_settings(&$supplier_id)
{
    start_outer_table(TABLESTYLE2);
    table_section(1);
    if ($supplier_id) {
        //SupplierID exists - either passed when calling the form or from the form itself
        $myrow = get_supplier($_POST['supplier_id']);
        $_POST['supp_name'] = $myrow["supp_name"];
        $_POST['supp_ref'] = $myrow["supp_ref"];
        $_POST['address'] = $myrow["address"];
        $_POST['supp_address'] = $myrow["supp_address"];
        $_POST['gst_no'] = $myrow["gst_no"];
        $_POST['website'] = $myrow["website"];
        $_POST['supp_account_no'] = $myrow["supp_account_no"];
        $_POST['bank_account'] = $myrow["bank_account"];
        $_POST['dimension_id'] = $myrow["dimension_id"];
        $_POST['dimension2_id'] = $myrow["dimension2_id"];
        $_POST['curr_code'] = $myrow["curr_code"];
        $_POST['payment_terms'] = $myrow["payment_terms"];
        $_POST['credit_limit'] = price_format($myrow["credit_limit"]);
        $_POST['tax_group_id'] = $myrow["tax_group_id"];
        $_POST['tax_included'] = $myrow["tax_included"];
        $_POST['payable_account'] = $myrow["payable_account"];
        $_POST['purchase_account'] = $myrow["purchase_account"];
        $_POST['payment_discount_account'] = $myrow["payment_discount_account"];
        $_POST['notes'] = $myrow["notes"];
        $_POST['inactive'] = $myrow["inactive"];
    } else {
        $_POST['supp_name'] = $_POST['supp_ref'] = $_POST['address'] = $_POST['supp_address'] = $_POST['tax_group_id'] = $_POST['website'] = $_POST['supp_account_no'] = $_POST['notes'] = '';
        $_POST['dimension_id'] = 0;
        $_POST['dimension2_id'] = 0;
        $_POST['tax_included'] = 0;
        $_POST['sales_type'] = -1;
        $_POST['gst_no'] = $_POST['bank_account'] = '';
        $_POST['payment_terms'] = '';
        $_POST['credit_limit'] = price_format(0);
        $company_record = get_company_prefs();
        $_POST['curr_code'] = $company_record["curr_default"];
        $_POST['payable_account'] = $company_record["creditors_act"];
        $_POST['purchase_account'] = '';
        // default/item's cogs account
        $_POST['payment_discount_account'] = $company_record['pyt_discount_act'];
    }
    table_section_title(_("Basic Data"));
    text_row(_("Supplier Name:"), 'supp_name', null, 42, 40);
    text_row(_("Supplier Short Name:"), 'supp_ref', null, 30, 30);
    text_row(_("GSTNo:"), 'gst_no', null, 42, 40);
    link_row(_("Website:"), 'website', null, 35, 55);
    if ($supplier_id && !is_new_supplier($supplier_id) && (key_in_foreign_table($_POST['supplier_id'], 'supp_trans', 'supplier_id') || key_in_foreign_table($_POST['supplier_id'], 'purch_orders', 'supplier_id'))) {
        label_row(_("Supplier's Currency:"), $_POST['curr_code']);
        hidden('curr_code', $_POST['curr_code']);
    } else {
        currencies_list_row(_("Supplier's Currency:"), 'curr_code', null);
    }
    tax_groups_list_row(_("Tax Group:"), 'tax_group_id', null);
    text_row(_("Our Customer No:"), 'supp_account_no', null, 42, 40);
    table_section_title(_("Purchasing"));
    text_row(_("Bank Name/Account:"), 'bank_account', null, 42, 40);
    amount_row(_("Credit Limit:"), 'credit_limit', null);
    payment_terms_list_row(_("Payment Terms:"), 'payment_terms', null);
    //
    // tax_included option from supplier record is used directly in update_average_cost() function,
    // therefore we can't edit the option after any transaction waas done for the supplier.
    //
    if (is_new_supplier($supplier_id)) {
        check_row(_("Prices contain tax included:"), 'tax_included');
    } else {
        hidden('tax_included');
        label_row(_("Prices contain tax included:"), $_POST['tax_included'] ? _('Yes') : _('No'));
    }
    table_section_title(_("Accounts"));
    gl_all_accounts_list_row(_("Accounts Payable Account:"), 'payable_account', $_POST['payable_account']);
    gl_all_accounts_list_row(_("Purchase Account:"), 'purchase_account', $_POST['purchase_account'], false, false, _("Use Item Inventory/COGS Account"));
    gl_all_accounts_list_row(_("Purchase Discount Account:"), 'payment_discount_account', $_POST['payment_discount_account']);
    if (!$supplier_id) {
        table_section_title(_("Contact Data"));
        text_row(_("Phone Number:"), 'phone', null, 32, 30);
        text_row(_("Secondary Phone Number:"), 'phone2', null, 32, 30);
    }
    table_section(2);
    $dim = get_company_pref('use_dimension');
    if ($dim >= 1) {
        table_section_title(_("Dimension"));
        dimensions_list_row(_("Dimension") . " 1:", 'dimension_id', null, true, " ", false, 1);
        if ($dim > 1) {
            dimensions_list_row(_("Dimension") . " 2:", 'dimension2_id', null, true, " ", false, 2);
        }
    }
    if ($dim < 1) {
        hidden('dimension_id', 0);
    }
    if ($dim < 2) {
        hidden('dimension2_id', 0);
    }
    table_section_title(_("Addresses"));
    textarea_row(_("Mailing Address:"), 'address', null, 35, 5);
    textarea_row(_("Physical Address:"), 'supp_address', null, 35, 5);
    table_section_title(_("General"));
    textarea_row(_("General Notes:"), 'notes', null, 35, 5);
    if ($supplier_id) {
        record_status_list_row(_("Supplier status:"), 'inactive');
    } else {
        table_section_title(_("Contact Data"));
        text_row(_("Contact Person:"), 'contact', null, 42, 40);
        text_row(_("Fax Number:"), 'fax', null, 32, 30);
        email_row(_("E-mail:"), 'email', null, 35, 55);
        languages_list_row(_("Document Language:"), 'rep_lang', null, _('System default'));
    }
    end_outer_table(1);
    div_start('controls');
    if ($supplier_id) {
        submit_center_first('submit', _("Update Supplier"), _('Update supplier data'), @$_REQUEST['popup'] ? true : 'default');
        submit_return('select', get_post('supplier_id'), _("Select this supplier and return to document entry."));
        submit_center_last('delete', _("Delete Supplier"), _('Delete supplier data if have been never used'), true);
    } else {
        submit_center('submit', _("Add New Supplier Details"), true, '', 'default');
    }
    div_end();
}
예제 #13
0
if ($this->the_user->level < 3) {
    $menu = array($this->lang->line('system') => array('id' => 'system_tab', 'name' => 'system', 'class' => 'settings_tab', 'onclick' => "window.location.href='/settings?tab=system'"), $this->lang->line('users') => array('id' => 'users_tab', 'name' => 'users', 'class' => 'settings_tab', 'onclick' => "window.location.href='/settings?tab=users'"), $this->lang->line('products') => array('id' => 'products_tab', 'name' => 'products', 'class' => 'settings_tab', 'onclick' => "window.location.href='/settings?tab=products'"), $this->lang->line('clients') => array('id' => 'clients_tab', 'name' => 'clients', 'class' => 'settings_tab', 'onclick' => "window.location.href='/settings?tab=clients'"));
} else {
    $menu = array($this->lang->line('system') => array('id' => 'system_tab', 'name' => 'system', 'class' => 'settings_tab', 'onclick' => "window.location.href='/settings?tab=system'"));
}
echo div_start($settings_wrapper);
foreach ($menu as $item => $attr) {
    echo div_start($attr);
    echo $item;
    echo div_end();
}
echo div_start($settings_container);
switch ($tab) {
    case 'system':
    default:
        $this->load->view('settings/system');
        break;
    case 'users':
        $this->load->view('settings/users');
        break;
    case 'products':
        $this->load->view('settings/products');
        break;
    case 'clients':
        $this->load->view('settings/clients');
        break;
}
echo div_end();
//Container
echo div_end();
//Wrapper
예제 #14
0
function display_languages()
{
    global $table_style, $installed_languages, $dflt_lang, $GetText;
    $th = array(_("Language"), _("Name"), _("Encoding"), _("Right To Left"), _("Installed"), _("Available"), _("Default"), "", "");
    $currlang = $_SESSION["language"]->code;
    div_start('lang_tbl');
    start_form();
    //
    // select/display system locales support for sites using native gettext
    //
    if (function_exists('gettext')) {
        if (check_value('DisplayAll')) {
            array_insert($th, 7, _("Supported"));
        }
        start_table();
        check_row(_('Display also languages not supported by server locales'), 'DisplayAll', null, true);
        end_table();
    }
    start_table(TABLESTYLE);
    table_header($th);
    $k = 0;
    // get list of all (available and installed) langauges
    $langs = get_languages_list();
    foreach ($langs as $pkg_name => $lng) {
        if ($lng == 'C') {
            // skip default locale (aka no translation)
            continue;
        }
        $lang = $lng['code'];
        $lang_name = $lng['name'];
        $charset = $lng['encoding'];
        $rtl = @$lng['rtl'] == 'yes' || @$lng['rtl'] === true;
        $available = @$lng['available'];
        $installed = @$lng['version'];
        $id = @$lng['local_id'];
        if ($lang == $currlang) {
            start_row("class='stockmankobg'");
        } else {
            alt_table_row_color($k);
        }
        $support = $GetText->check_support($lang, $charset);
        if (function_exists('gettext') && !$support && !get_post('DisplayAll')) {
            continue;
        }
        label_cell($lang);
        label_cell($available ? get_package_view_str($lang, $lang_name) : $lang_name);
        label_cell($charset);
        label_cell($rtl ? _("Yes") : _("No"));
        label_cell($id === null ? _("None") : ($available && $installed ? $installed : _("Unknown")));
        label_cell($available ? $available : _("None"));
        label_cell($id === null ? '' : radio(null, 'CurDflt', $id, $dflt_lang == $lang, true), "align='center'");
        if (function_exists('gettext') && check_value('DisplayAll')) {
            label_cell($support ? _("Yes") : _("No"));
        }
        if (!$available && $lang != 'C') {
            // manually installed language
            button_cell('Edit' . $id, _("Edit"), _('Edit non standard language configuration'), ICON_EDIT);
        } elseif (check_pkg_upgrade($installed, $available)) {
            // outdated or not installed language in repo
            button_cell('Update' . $pkg_name, $installed ? _("Update") : _("Install"), _('Upload and install latest language package'), ICON_DOWN);
        } else {
            label_cell('');
        }
        if ($id !== null && $lang != $currlang && $lang != 'C') {
            delete_button_cell('Delete' . $id, _('Delete'));
            submit_js_confirm('Delete' . $id, sprintf(_("You are about to remove language \\'%s\\'.\nDo you want to continue ?"), $lang_name));
        } else {
            label_cell('');
        }
        end_row();
    }
    end_table();
    display_note(_("The marked language is the current language which cannot be deleted."), 0, 0, "class='currentfg'");
    br();
    submit_center_first('Refresh', _("Update default"), '', null);
    submit_center_last('Add', _("Add new language manually"), '', false);
    end_form();
    div_end();
}
예제 #15
0
function item_settings(&$stock_id)
{
    global $SysPrefs, $path_to_root, $new_item, $pic_height;
    start_outer_table(TABLESTYLE2);
    table_section(1);
    table_section_title(_("Item"));
    //------------------------------------------------------------------------------------
    if ($new_item) {
        text_row(_("Item Code/ISBN:"), 'NewStockID', null, 21, 20);
        $_POST['inactive'] = 0;
    } else {
        // Must be modifying an existing item
        if (get_post('NewStockID') != get_post('stock_id') || get_post('addupdate')) {
            // first item display
            $_POST['NewStockID'] = $_POST['stock_id'];
            $myrow = get_item($_POST['NewStockID']);
            $_POST['long_description'] = $myrow["long_description"];
            $_POST['description'] = $myrow["description"];
            $_POST['category_id'] = $myrow["category_id"];
            /*==============MOODLEARNING=============*/
            $_POST['level_id'] = $myrow["level_id"];
            /*=======================================*/
            $_POST['tax_type_id'] = $myrow["tax_type_id"];
            $_POST['units'] = $myrow["units"];
            $_POST['mb_flag'] = $myrow["mb_flag"];
            $_POST['sales_account'] = $myrow['sales_account'];
            $_POST['inventory_account'] = $myrow['inventory_account'];
            $_POST['cogs_account'] = $myrow['cogs_account'];
            $_POST['adjustment_account'] = $myrow['adjustment_account'];
            $_POST['assembly_account'] = $myrow['assembly_account'];
            $_POST['dimension_id'] = $myrow['dimension_id'];
            $_POST['dimension2_id'] = $myrow['dimension2_id'];
            $_POST['no_sale'] = $myrow['no_sale'];
            $_POST['del_image'] = 0;
            $_POST['inactive'] = $myrow["inactive"];
            $_POST['editable'] = $myrow["editable"];
        }
        label_row(_("Item Code/ISBN:"), $_POST['NewStockID']);
        hidden('NewStockID', $_POST['NewStockID']);
        set_focus('description');
    }
    /*=================MOODLEARNING====================*/
    level_list_row(_("Level:"), 'level_id', null);
    /*=================================================*/
    text_row(_("Name:"), 'description', null, 52, 200);
    textarea_row(_('Description:'), 'long_description', null, 42, 3);
    stock_categories_list_row(_("Category/Subject:"), 'category_id', null, false, $new_item);
    if ($new_item && (list_updated('category_id') || !isset($_POST['units']))) {
        $category_record = get_item_category($_POST['category_id']);
        $_POST['level_id'] = $category_record["level_id"];
        // moodlearning edit
        $_POST['subject_id'] = $category_record["level_id"];
        $_POST['tax_type_id'] = $category_record["dflt_tax_type"];
        $_POST['units'] = $category_record["dflt_units"];
        $_POST['mb_flag'] = $category_record["dflt_mb_flag"];
        $_POST['inventory_account'] = $category_record["dflt_inventory_act"];
        $_POST['cogs_account'] = $category_record["dflt_cogs_act"];
        $_POST['sales_account'] = $category_record["dflt_sales_act"];
        $_POST['adjustment_account'] = $category_record["dflt_adjustment_act"];
        $_POST['assembly_account'] = $category_record["dflt_assembly_act"];
        $_POST['dimension_id'] = $category_record["dflt_dim1"];
        $_POST['dimension2_id'] = $category_record["dflt_dim2"];
        $_POST['no_sale'] = $category_record["dflt_no_sale"];
        $_POST['editable'] = 0;
    }
    $fresh_item = !isset($_POST['NewStockID']) || $new_item || check_usage($_POST['stock_id'], false);
    item_tax_types_list_row(_("Item Tax Type:"), 'tax_type_id', null);
    stock_item_types_list_row(_("Item Type:"), 'mb_flag', null, $fresh_item);
    stock_units_list_row(_('Units of Measure:'), 'units', null, $fresh_item);
    check_row(_("Editable description:"), 'editable');
    check_row(_("Exclude from sales:"), 'no_sale');
    table_section(2);
    $dim = get_company_pref('use_dimension');
    if ($dim >= 1) {
        table_section_title(_("Dimensions"));
        dimensions_list_row(_("Dimension") . " 1", 'dimension_id', null, true, " ", false, 1);
        if ($dim > 1) {
            dimensions_list_row(_("Dimension") . " 2", 'dimension2_id', null, true, " ", false, 2);
        }
    }
    if ($dim < 1) {
        hidden('dimension_id', 0);
    }
    if ($dim < 2) {
        hidden('dimension2_id', 0);
    }
    table_section_title(_("GL Accounts"));
    gl_all_accounts_list_row(_("Sales Account:"), 'sales_account', $_POST['sales_account']);
    if (!is_service($_POST['mb_flag'])) {
        gl_all_accounts_list_row(_("Inventory Account:"), 'inventory_account', $_POST['inventory_account']);
        gl_all_accounts_list_row(_("C.O.G.S. Account:"), 'cogs_account', $_POST['cogs_account']);
        gl_all_accounts_list_row(_("Inventory Adjustments Account:"), 'adjustment_account', $_POST['adjustment_account']);
    } else {
        gl_all_accounts_list_row(_("C.O.G.S. Account:"), 'cogs_account', $_POST['cogs_account']);
        hidden('inventory_account', $_POST['inventory_account']);
        hidden('adjustment_account', $_POST['adjustment_account']);
    }
    if (is_manufactured($_POST['mb_flag'])) {
        gl_all_accounts_list_row(_("Item Assembly Costs Account:"), 'assembly_account', $_POST['assembly_account']);
    } else {
        hidden('assembly_account', $_POST['assembly_account']);
    }
    table_section_title(_("Other"));
    // Add image upload for New Item  - by Joe
    file_row(_("Image File (.jpg)") . ":", 'pic', 'pic');
    // Add Image upload for New Item  - by Joe
    $stock_img_link = "";
    $check_remove_image = false;
    if (isset($_POST['NewStockID']) && file_exists(company_path() . '/images/' . item_img_name($_POST['NewStockID']) . ".jpg")) {
        // 31/08/08 - rand() call is necessary here to avoid caching problems. Thanks to Peter D.
        $stock_img_link .= "<img id='item_img' alt = '[" . $_POST['NewStockID'] . ".jpg" . "]' src='" . company_path() . '/images/' . item_img_name($_POST['NewStockID']) . ".jpg?nocache=" . rand() . "'" . " height='{$pic_height}' border='0'>";
        $check_remove_image = true;
    } else {
        $stock_img_link .= _("No image");
    }
    label_row("&nbsp;", $stock_img_link);
    if ($check_remove_image) {
        check_row(_("Delete Image:"), 'del_image');
    }
    record_status_list_row(_("Item status:"), 'inactive');
    end_outer_table(1);
    div_start('controls');
    if (!isset($_POST['NewStockID']) || $new_item) {
        submit_center('addupdate', _("Insert New Item"), true, '', 'default');
    } else {
        submit_center_first('addupdate', _("Update Item"), '', @$_REQUEST['popup'] ? true : 'default');
        submit_return('select', get_post('stock_id'), _("Select this items and return to document entry."), 'default');
        submit('clone', _("Clone This Item"), true, '', true);
        submit('delete', _("Delete This Item"), true, '', true);
        submit_center_last('cancel', _("Cancel"), _("Cancel Edition"), 'cancel');
    }
    div_end();
}
                }
            }
            $errCnt = 0;
        }
        // if (!$fp)
    }
    // if (isset($_FILES['imp']) && $_FILES['imp']['name'] != '')
    @fclose($fp);
}
// if (isset($_POST['type']))
// User Interface
start_form(true);
div_start('_main_table');
initialize_controls();
start_table(TABLESTYLE2, "width=95%");
//inner table
$type = show_table_section_import_settings();
if ($type == ST_JOURNAL || $type == ST_BANKDEPOSIT || $type == ST_BANKPAYMENT) {
    show_table_section_control_accounts();
}
show_table_section_display($type);
if ($type == ST_BANKDEPOSIT || $type == ST_BANKPAYMENT) {
    $stateformat = show_table_section_bankstatement_checkbox();
}
show_table_section_csv_separator();
show_table_section_trial_or_final();
end_table(1);
div_end('_main_table');
submit_center('import', "Process", $echo = true, $title = false, $async = true, $icon = ICON_OK);
end_form();
end_page();
예제 #17
0
function display_extensions()
{
    global $installed_extensions;
    div_start('ext_tbl');
    start_table(TABLESTYLE);
    $th = array(_("Extension"), _("Modules provided"), _("Options provided"), _("Installed"), _("Available"), "", "");
    table_header($th);
    $k = 0;
    $mods = get_extensions_list('extension');
    foreach ($mods as $pkg_name => $ext) {
        $available = @$ext['available'];
        $installed = @$ext['version'];
        $id = @$ext['local_id'];
        $entries = fmt_titles(@$ext['entries']);
        $tabs = fmt_titles(@$ext['tabs']);
        alt_table_row_color($k);
        label_cell($available ? get_package_view_str($pkg_name, $ext['name']) : $ext['name']);
        label_cell($tabs);
        label_cell($entries);
        label_cell($id === null ? _("None") : ($available && $installed ? $installed : _("Unknown")));
        label_cell($available ? $available : _("Unknown"));
        if (!$available && $ext['type'] == 'extension') {
            // third-party plugin
            if (!$installed) {
                button_cell('Local' . $ext['package'], _("Install"), _('Install third-party extension.'), ICON_DOWN);
            } else {
                label_cell('');
            }
        } elseif (check_pkg_upgrade($installed, $available)) {
            // outdated or not installed extension in repo
            button_cell('Update' . $pkg_name, $installed ? _("Update") : _("Install"), _('Upload and install latest extension package'), ICON_DOWN);
        } else {
            label_cell('');
        }
        if ($id !== null) {
            delete_button_cell('Delete' . $id, _('Delete'));
            submit_js_confirm('Delete' . $id, sprintf(_("You are about to remove package \\'%s\\'.\nDo you want to continue ?"), $ext['name']));
        } else {
            label_cell('');
        }
        end_row();
    }
    end_table(1);
    submit_center_first('Refresh', _("Update"), '', null);
    div_end();
}
예제 #18
0
function display_po_receive_items()
{
    div_start('grn_items');
    start_table(TABLESTYLE, "colspan=7 width='90%'");
    $th = array(_("Item Code"), _("Description"), _("Ordered"), _("Units"), _("Received"), _("Outstanding"), _("This Delivery"), _("Price"), _("Total"));
    table_header($th);
    /*show the line items on the order with the quantity being received for modification */
    $total = 0;
    $k = 0;
    //row colour counter
    if (count($_SESSION['PO']->line_items) > 0) {
        foreach ($_SESSION['PO']->line_items as $ln_itm) {
            alt_table_row_color($k);
            $qty_outstanding = $ln_itm->quantity - $ln_itm->qty_received;
            if (!isset($_POST['Update']) && !isset($_POST['ProcessGoodsReceived']) && $ln_itm->receive_qty == 0) {
                //If no quantites yet input default the balance to be received
                $ln_itm->receive_qty = $qty_outstanding;
            }
            $line_total = $ln_itm->receive_qty * $ln_itm->price;
            $total += $line_total;
            label_cell($ln_itm->stock_id);
            if ($qty_outstanding > 0) {
                text_cells(null, $ln_itm->stock_id . "Desc", $ln_itm->item_description, 30, 50);
            } else {
                label_cell($ln_itm->item_description);
            }
            $dec = get_qty_dec($ln_itm->stock_id);
            qty_cell($ln_itm->quantity, false, $dec);
            label_cell($ln_itm->units);
            qty_cell($ln_itm->qty_received, false, $dec);
            qty_cell($qty_outstanding, false, $dec);
            if ($qty_outstanding > 0) {
                qty_cells(null, $ln_itm->line_no, number_format2($ln_itm->receive_qty, $dec), "align=right", null, $dec);
            } else {
                label_cell(number_format2($ln_itm->receive_qty, $dec), "align=right");
            }
            amount_decimal_cell($ln_itm->price);
            amount_cell($line_total);
            end_row();
        }
    }
    $colspan = count($th) - 1;
    $display_sub_total = price_format($total);
    label_row(_("Sub-total"), $display_sub_total, "colspan={$colspan} align=right", "align=right");
    $taxes = $_SESSION['PO']->get_taxes(input_num('freight_cost'), true);
    $tax_total = display_edit_tax_items($taxes, $colspan, $_SESSION['PO']->tax_included);
    $display_total = price_format($total + input_num('freight_cost') + $tax_total);
    start_row();
    label_cells(_("Amount Total"), $display_total, "colspan={$colspan} align='right'", "align='right'");
    end_row();
    end_table();
    div_end();
}
예제 #19
0
function display_balance_sheet()
{
    global $path_to_root;
    $from = begin_fiscalyear();
    $to = $_POST['TransToDate'];
    if (!isset($_POST['Dimension'])) {
        $_POST['Dimension'] = 0;
    }
    if (!isset($_POST['Dimension2'])) {
        $_POST['Dimension2'] = 0;
    }
    $dimension = $_POST['Dimension'];
    $dimension2 = $_POST['Dimension2'];
    $lconvert = $econvert = 1;
    if (isset($_POST["AccGrp"]) && strlen($_POST['AccGrp']) > 0) {
        $drilldown = 1;
    } else {
        $drilldown = 0;
    }
    // Root level
    div_start('balance_tbl');
    start_table(TABLESTYLE, "width='30%'");
    if (!$drilldown) {
        $equityclose = 0.0;
        $lclose = 0.0;
        $calculateclose = 0.0;
        $parent = -1;
        //Get classes for BS
        $classresult = get_account_classes(false, 1);
        while ($class = db_fetch($classresult)) {
            $classclose = 0.0;
            $convert = get_class_type_convert($class["ctype"]);
            $ctype = $class["ctype"];
            $classname = $class["class_name"];
            //Print Class Name
            table_section_title($class["class_name"]);
            //Get Account groups/types under this group/type
            $typeresult = get_account_types(false, $class['cid'], -1);
            while ($accounttype = db_fetch($typeresult)) {
                $TypeTotal = display_type($accounttype["id"], $accounttype["name"], $from, $to, $convert, $dimension, $dimension2, $drilldown, $path_to_root);
                //Print Summary
                if ($TypeTotal != 0) {
                    $url = "<a href='{$path_to_root}/gl/inquiry/balance_sheet.php?TransFromDate=" . $from . "&TransToDate=" . $to . "&Dimension=" . $dimension . "&Dimension2=" . $dimension2 . "&AccGrp=" . $accounttype['id'] . "'>" . $accounttype['id'] . " " . $accounttype['name'] . "</a>";
                    alt_table_row_color($k);
                    label_cell($url);
                    amount_cell($TypeTotal * $convert);
                    end_row();
                }
                $classclose += $TypeTotal;
            }
            //Print Class Summary
            start_row("class='inquirybg' style='font-weight:bold'");
            label_cell(_('Total') . " " . $class["class_name"]);
            amount_cell($classclose * $convert);
            end_row();
            if ($ctype == CL_EQUITY) {
                $equityclose += $classclose;
                $econvert = $convert;
            }
            if ($ctype == CL_LIABILITIES) {
                $lclose += $classclose;
                $lconvert = $convert;
            }
            $calculateclose += $classclose;
        }
        if ($lconvert == 1) {
            $calculateclose *= -1;
        }
        //Final Report Summary
        $url = "<a href='{$path_to_root}/gl/inquiry/profit_loss.php?TransFromDate=" . $from . "&TransToDate=" . $to . "&Dimension=" . $dimension . "&Dimension2=" . $dimension2 . "&Compare=0'>" . _('Calculated Return') . "</a>";
        start_row("class='inquirybg' style='font-weight:bold'");
        label_cell($url);
        amount_cell($calculateclose);
        end_row();
        start_row("class='inquirybg' style='font-weight:bold'");
        label_cell(_('Total') . " " . _('Liabilities') . _(' and ') . _('Equities'));
        amount_cell($lclose * $lconvert + $equityclose * $econvert + $calculateclose);
        end_row();
    } else {
        //Level Pointer : Global variable defined in order to control display of root
        global $levelptr;
        $levelptr = 0;
        $accounttype = get_account_type($_POST["AccGrp"]);
        $classid = $accounttype["class_id"];
        $class = get_account_class($classid);
        $convert = get_class_type_convert($class["ctype"]);
        //Print Class Name
        table_section_title($_POST["AccGrp"] . " " . get_account_type_name($_POST["AccGrp"]));
        $classclose = display_type($accounttype["id"], $accounttype["name"], $from, $to, $convert, $dimension, $dimension2, $drilldown, $path_to_root);
    }
    end_table(1);
    // outer table
    div_end();
}
예제 #20
0
function voucher_details($id)
{
    div_start('voucher_table');
    br();
    if (!isset($_POST['imc']) || list_updated($_POST['imc'])) {
        $imc = get_post('imc');
        $row = get_salesman_trans($imc);
        $_POST['sales'] = $row['salesman_name'];
        $_POST['invoice_no'] = $row['customized_no'];
        $_POST['client'] = $row['br_name'];
        $_POST['provision'] = $row['provision'];
        $_POST['total'] = $row['InvoiceTotal'];
    }
    div_start('detail_table');
    start_outer_table(TABLESTYLE2);
    table_section(1);
    date_row(_("Date:"), 'date');
    text_row(_("IMC: "), 'sales');
    text_row(_("Invoice No."), 'invoice_no');
    text_row(_("Client: "), 'client');
    hidden('gross', $_POST['gross']);
    table_section(2);
    amount_row(_("Commission %: "), 'provision');
    label_row(_("Gross Commission: "), price_format($_POST['netsales']));
    label_row(_("W/Tax: "), price_format($_POST['tax']));
    label_row(_("Net Commission: "), price_format($_POST['total']));
    hidden('netsales', $_POST['netsales']);
    hidden('tax', $_POST['tax']);
    hidden('total', $_POST['total']);
    submit_row('Compute', _("Compute"), '', 'default');
    hidden('br_id', $_POST['br_id']);
    hidden('discount', $_POST['discount']);
    hidden('returns', $_POST['returns']);
    end_outer_table(1);
    div_start('controls');
    if (isset($_POST['Compute'])) {
        submit_center_first('Submit', _("Create Commission Voucher"), '', 'default');
    }
    div_end();
    br();
    start_table(TABLESTYLE, "width=90%");
    $th = array(_('IMC'), _('Invoice #'), _('Date'), _('Client'), '');
    table_header($th);
    $k = 0;
    $res = get_salesman_trans($_POST['imc'], $_POST['customNum']);
    while ($myrow = db_fetch($res)) {
        alt_table_row_color($k);
        if (checkvouchexists($myrow['customized_no']) == 0) {
            if ($myrow['Voided'] == '') {
                label_cell($myrow['salesman_name']);
                label_cell($myrow['customized_no']);
                label_cell($myrow['tran_date']);
                label_cell($myrow['br_name']);
                edit_button_cell("Edit" . $myrow['customized_no'], _("Select"));
            }
        }
        end_row();
    }
    end_table(1);
    div_end();
    div_end();
    br();
}