Exemple #1
0
 function render($id, $title)
 {
     global $path_to_root;
     include_once $path_to_root . "/reporting/includes/class.graphic.inc";
     $begin = begin_fiscalyear();
     $today = Today();
     $begin1 = date2sql($begin);
     $today1 = date2sql($today);
     $sql = "SELECT SUM(amount) AS total, c.class_name, c.ctype FROM\n            " . TB_PREF . "gl_trans," . TB_PREF . "chart_master AS a, " . TB_PREF . "chart_types AS t,\n            " . TB_PREF . "chart_class AS c WHERE\n            account = a.account_code AND a.account_type = t.id AND t.class_id = c.cid\n            AND IF(c.ctype > 3, tran_date >= '{$begin1}', tran_date >= '0000-00-00')\n            AND tran_date <= '{$today1}' ";
     if ($this->data_filter != '') {
         $sql .= ' AND ' . $this->data_filter;
     }
     $sql .= " GROUP BY c.cid ORDER BY c.cid";
     $result = db_query($sql, "Transactions could not be calculated");
     $calculated = _("Calculated Return");
     if ($this->graph_type == 'Table') {
         start_table(TABLESTYLE2, "width=98%");
         $total = 0;
         while ($myrow = db_fetch($result)) {
             if ($myrow['ctype'] > 3) {
                 $total += $myrow['total'];
                 $myrow['total'] = -$myrow['total'];
             }
             label_row($myrow['class_name'], number_format2($myrow['total'], user_price_dec()), "class='label' style='font-weight:bold;'", "style='font-weight:bold;' align=right");
         }
         label_row("&nbsp;", "");
         label_row($calculated, number_format2(-$total, user_price_dec()), "class='label' style='font-weight:bold;'", "style='font-weight:bold;' align=right");
         end_table(1);
     } else {
         $pg = new graph();
         $i = 0;
         $total = 0;
         while ($myrow = db_fetch($result)) {
             if ($myrow['ctype'] > 3) {
                 $total += $myrow['total'];
                 $myrow['total'] = -$myrow['total'];
                 $pg->x[$i] = $myrow['class_name'];
                 $pg->y[$i] = abs($myrow['total']);
                 $i++;
             }
         }
         $pg->x[$i] = $calculated;
         $pg->y[$i] = -$total;
         $pg->title = $title;
         $pg->axis_x = _("Class");
         $pg->axis_y = _("Amount");
         $pg->graphic_1 = $today;
         $pg->type = 5;
         $pg->skin = 1;
         $pg->built_in = false;
         $filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
         $pg->display($filename, true);
         echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
     }
 }
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();
}
function display_po_receive_items()
{
    global $table_style;
    start_table("colspan=7 {$table_style} width=90%");
    $th = array(tr("Item Code"), tr("Description"), tr("Ordered"), tr("Units"), tr("Received"), tr("Outstanding"), tr("This Delivery"), tr("Price"), tr("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 ($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);
            }
            qty_cell($ln_itm->quantity);
            label_cell($ln_itm->units);
            qty_cell($ln_itm->qty_received);
            qty_cell($qty_outstanding);
            if ($qty_outstanding > 0) {
                qty_cells(null, $ln_itm->line_no, qty_format($ln_itm->receive_qty), "align=right");
            } else {
                qty_cells(null, $ln_itm->line_no, qty_format($ln_itm->receive_qty), "align=right", "disabled");
            }
            amount_cell($ln_itm->price);
            amount_cell($line_total);
            end_row();
        }
    }
    $display_total = number_format2($total, user_price_dec());
    label_row(tr("Total value of items received"), $display_total, "colspan=8 align=right", "nowrap align=right");
    end_table();
}
function voiding_controls()
{
    global $selected_id;
    $not_implemented = array(ST_PURCHORDER, ST_SALESORDER, ST_SALESQUOTE, ST_COSTUPDATE);
    start_form();
    start_table(TABLESTYLE_NOBORDER);
    start_row();
    systypes_list_cells(_("Type:"), 'filterType', null, true, $not_implemented);
    if (list_updated('filterType')) {
        $selected_id = -1;
    }
    if (!isset($_POST['FromTransNo'])) {
        $_POST['FromTransNo'] = "1";
    }
    if (!isset($_POST['ToTransNo'])) {
        $_POST['ToTransNo'] = "999999";
    }
    ref_cells(_("from #:"), 'FromTransNo');
    ref_cells(_("to #:"), 'ToTransNo');
    submit_cells('ProcessSearch', _("Search"), '', '', 'default');
    end_row();
    end_table(1);
    $trans_ref = false;
    $sql = get_sql_for_view_transactions($_POST['filterType'], $_POST['FromTransNo'], $_POST['ToTransNo'], $trans_ref);
    if ($sql == "") {
        return;
    }
    $cols = array(_("#") => array('insert' => true, 'fun' => 'view_link'), _("Reference") => array('fun' => 'ref_view'), _("Date") => array('type' => 'date', 'fun' => 'date_view'), _("GL") => array('insert' => true, 'fun' => 'gl_view'), _("Select") => array('insert' => true, 'fun' => 'select_link'));
    $table =& new_db_pager('transactions', $sql, $cols);
    $table->width = "40%";
    display_db_pager($table);
    start_table(TABLESTYLE2);
    if ($selected_id != -1) {
        hidden('trans_no', $selected_id);
        hidden('selected_id', $selected_id);
    } else {
        hidden('trans_no', '');
        $_POST['memo_'] = '';
    }
    label_row(_("Transaction #:"), $selected_id == -1 ? '' : $selected_id);
    date_row(_("Voiding Date:"), 'date_');
    textarea_row(_("Memo:"), 'memo_', null, 30, 4);
    end_table(1);
    if (!isset($_POST['ProcessVoiding'])) {
        submit_center('ProcessVoiding', _("Void Transaction"), true, '', 'default');
    } else {
        if (!exist_transaction($_POST['filterType'], $_POST['trans_no'])) {
            display_error(_("The entered transaction does not exist or cannot be voided."));
            unset($_POST['trans_no']);
            unset($_POST['memo_']);
            unset($_POST['date_']);
            submit_center('ProcessVoiding', _("Void Transaction"), true, '', 'default');
        } else {
            display_warning(_("Are you sure you want to void this transaction ? This action cannot be undone."), 0, 1);
            br();
            submit_center_first('ConfirmVoiding', _("Proceed"), '', true);
            submit_center_last('CancelVoiding', _("Cancel"), '', 'cancel');
        }
    }
    end_form();
}
Exemple #5
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();
}
Exemple #6
0
$th = array(_("ID"), _("Group Name"), "", "");
inactive_control_column($th);
table_header($th);
$k = 0;
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    label_cell($myrow["id"]);
    label_cell($myrow["description"]);
    inactive_control_cell($myrow["id"], $myrow["inactive"], 'groups', 'id');
    edit_button_cell("Edit" . $myrow["id"], _("Edit"));
    delete_button_cell("Delete" . $myrow["id"], _("Delete"));
    end_row();
}
inactive_control_row($th);
end_table(1);
//-------------------------------------------------------------------------------------------------
start_table(TABLESTYLE2);
if ($selected_id != -1) {
    if ($Mode == 'Edit') {
        //editing an existing group
        $myrow = get_sales_group($selected_id);
        $_POST['description'] = $myrow["description"];
    }
    hidden("selected_id", $selected_id);
    label_row(_("ID"), $myrow["id"]);
}
text_row_ex(_("Group Name:"), 'description', 30);
end_table(1);
submit_add_or_update_center($selected_id == -1, '', 'both');
end_form();
end_page();
read_supp_invoice($trans_no, ST_SUPPCREDIT, $supp_trans);
display_heading("<font color=red>" . _("SUPPLIER CREDIT NOTE") . " # " . $trans_no . "</font>");
echo "<br>";
start_table(TABLESTYLE, "width=95%");
start_row();
label_cells(_("Supplier"), $supp_trans->supplier_name, "class='tableheader2'");
label_cells(_("Reference"), $supp_trans->reference, "class='tableheader2'");
label_cells(_("Supplier's Reference"), $supp_trans->supp_reference, "class='tableheader2'");
end_row();
start_row();
label_cells(_("Invoice Date"), $supp_trans->tran_date, "class='tableheader2'");
label_cells(_("Due Date"), $supp_trans->due_date, "class='tableheader2'");
label_cells(_("Currency"), get_supplier_currency($supp_trans->supplier_id), "class='tableheader2'");
end_row();
comments_display_row(ST_SUPPCREDIT, $trans_no);
end_table(1);
$total_gl = display_gl_items($supp_trans, 3);
$total_grn = display_grn_items($supp_trans, 2);
$display_sub_tot = number_format2($total_gl + $total_grn, user_price_dec());
start_table(TABLESTYLE, "width=95%");
label_row(_("Sub Total"), $display_sub_tot, "align=right", "nowrap align=right width=17%");
$tax_items = get_trans_tax_details(ST_SUPPCREDIT, $trans_no);
display_supp_trans_tax_details($tax_items, 1);
$display_total = number_format2(-($supp_trans->ov_amount + $supp_trans->ov_gst), user_price_dec());
label_row("<font color=red>" . _("TOTAL CREDIT NOTE") . "</font", "<font color=red>{$display_total}</font>", "colspan=1 align=right", "nowrap align=right");
end_table(1);
$voided = is_voided_display(ST_SUPPCREDIT, $trans_no, _("This credit note has been voided."));
if (!$voided) {
    display_allocations_from(PT_SUPPLIER, $supp_trans->supplier_id, ST_SUPPCREDIT, $trans_no, -($supp_trans->ov_amount + $supp_trans->ov_gst));
}
end_page(true, false, false, ST_SUPPCREDIT, $trans_no);
    amount_cell($line_total);
    end_row();
}
$_POST['ChargeFreightCost'] = get_post('ChargeFreightCost', price_format($_SESSION['Items']->freight_cost));
$colspan = 9;
start_row();
label_cell(_("Shipping Cost"), "colspan={$colspan} align=right");
small_amount_cells(null, 'ChargeFreightCost', $_SESSION['Items']->freight_cost);
end_row();
$inv_items_total = $_SESSION['Items']->get_items_total_dispatch();
$display_sub_total = price_format($inv_items_total + input_num('ChargeFreightCost'));
label_row(_("Sub-total"), $display_sub_total, "colspan={$colspan} align=right", "align=right");
$taxes = $_SESSION['Items']->get_taxes(input_num('ChargeFreightCost'));
$tax_total = display_edit_tax_items($taxes, $colspan, $_SESSION['Items']->tax_included);
$display_total = price_format($inv_items_total + input_num('ChargeFreightCost') + $tax_total);
label_row(_("Amount Total"), $display_total, "colspan={$colspan} align=right", "align=right");
end_table(1);
if ($has_marked) {
    display_note(_("Marked items have insufficient quantities in stock as on day of delivery."), 0, 1, "class='stockmankofg'");
}
start_table(TABLESTYLE2);
policy_list_row(_("Action For Balance"), "bo_policy", null);
textarea_row(_("Memo"), 'Comments', null, 50, 4);
end_table(1);
div_end();
submit_center_first('Update', _("Update"), _('Refresh document page'), true);
if (isset($_POST['clear_quantity'])) {
    submit('reset_quantity', _('Reset quantity'), true, _('Refresh document page'));
} else {
    submit('clear_quantity', _('Clear quantity'), true, _('Refresh document page'));
}
Exemple #9
0
            foreach ($db_connections as $id => $conn) {
                $conn['dbuser'] = $_POST['user'];
                $conn['dbpassword'] = $_POST['passwd'];
                if (!($db = db_open($conn))) {
                    display_error("Wrong user name or password - " . mysql_error());
                } else {
                    if (!db_import($_FILES['uploadfile']['tmp_name'], $conn)) {
                        display_error("Bad SQL file or you have already updated the company: " . $id . " " . $conn['name'] . " - " . mysql_error());
                    } else {
                        display_notification("Database has been updated for company: " . $id . " " . $conn['name']);
                    }
                }
            }
        }
    }
}
if (!isset($_POST['passwd'])) {
    $_POST['passwd'] = "";
}
echo "<form enctype='multipart/form-data' method='post' action='" . $_SERVER['PHP_SELF'] . "'>\n";
echo "<table align='center' width='50%' cellpadding=3 border=1 bordercolor='#cccccc' style='border-collapse: collapse'>\n";
text_row_ex("Database User", "user", 20);
label_row("Password", "<input name='passwd' type='password' value='" . $_POST['passwd'] . "' />");
label_row("Upload Script", "<input name='uploadfile' type='file'>");
submit_row("submit", "Update");
echo "</table>\n";
echo "<br><br>";
echo "<center><span>Choose from Database update scripts in SQL folder. No Datase is updated without a script.</span></center>\n";
echo "<br>";
echo "</form>\n";
echo "</body></html>\n";
Exemple #10
0
$purchase_order = new purch_order();
read_grn($_GET["trans_no"], $purchase_order);
display_heading(tr("Purchase Order Delivery") . " #" . $_GET['trans_no']);
echo "<BR>";
display_grn_summary($purchase_order);
display_heading2(tr("Line Details"));
start_table("colspan=9 {$table_style} width=90%");
$th = array(tr("Item Code"), tr("Item Description"), tr("Delivery Date"), tr("Quantity"), tr("Unit"), tr("Price"), tr("Line Total"), tr("Quantity Invoiced"));
table_header($th);
$total = 0;
$k = 0;
//row colour counter
foreach ($purchase_order->line_items as $stock_item) {
    $line_total = $stock_item->qty_received * $stock_item->price;
    alt_table_row_color($k);
    label_cell($stock_item->stock_id);
    label_cell($stock_item->item_description);
    label_cell($stock_item->req_del_date, "nowrap align=right");
    qty_cell($stock_item->qty_received);
    label_cell($stock_item->units);
    amount_cell($stock_item->price);
    amount_cell($line_total);
    qty_cell($stock_item->qty_inv);
    end_row();
    $total += $line_total;
}
$display_total = number_format2($total, user_price_dec());
label_row(tr("Total Excluding Tax/Shipping"), $display_total, "colspan=6", "nowrap align=right");
end_table(1);
is_voided_display(25, $_GET['trans_no'], tr("This delivery has been voided."));
end_page(true);
date_row(_("Date of Deposit:"), 'DateBanked', '', true, 0, 0, 0, null, true);
$comp_currency = get_company_currency();
$cust_currency = get_customer_currency($_POST['customer_id']);
$bank_currency = get_bank_account_currency($_POST['bank_account']);
if ($cust_currency != $bank_currency) {
    exchange_rate_display($bank_currency, $cust_currency, $_POST['DateBanked'], $bank_currency == $comp_currency);
}
amount_row(_("Bank Charge:"), 'charge');
end_outer_table(1);
if ($cust_currency == $bank_currency) {
    div_start('alloc_tbl');
    show_allocatable(false);
    div_end();
}
start_table(TABLESTYLE, "width=60%");
label_row(_("Customer prompt payment discount :"), $display_discount_percent);
amount_row(_("Amount of Discount:"), 'discount');
amount_row(_("Amount:"), 'amount');
textarea_row(_("Memo:"), 'memo_', null, 22, 4);
end_table(1);
if ($cust_currency != $bank_currency) {
    display_note(_("Amount and discount are in customer's currency."));
}
br();
if ($new) {
    submit_center('AddPaymentItem', _("Update Payment"), true, '', 'default');
} else {
    submit_center('AddPaymentItem', _("Add Payment"), true, '', 'default');
}
br();
end_form();
Exemple #12
0
if ($selected_id != -1) {
    //editing an existing Location
    if ($Mode == 'Edit') {
        $myrow = get_item_location($selected_id);
        $_POST['loc_code'] = $myrow["loc_code"];
        $_POST['location_name'] = $myrow["location_name"];
        $_POST['delivery_address'] = $myrow["delivery_address"];
        $_POST['contact'] = $myrow["contact"];
        $_POST['phone'] = $myrow["phone"];
        $_POST['phone2'] = $myrow["phone2"];
        $_POST['fax'] = $myrow["fax"];
        $_POST['email'] = $myrow["email"];
    }
    hidden("selected_id", $selected_id);
    hidden("loc_code");
    label_row(_("Location Code:"), $_POST['loc_code']);
} else {
    //end of if $selected_id only do the else when a new record is being entered
    text_row(_("Location Code:"), 'loc_code', null, 5, 5);
}
text_row_ex(_("Location Name:"), 'location_name', 50, 50);
text_row_ex(_("Contact for deliveries:"), 'contact', 30, 30);
textarea_row(_("Address:"), 'delivery_address', null, 35, 5);
text_row_ex(_("Telephone No:"), 'phone', 32, 30);
text_row_ex(_("Secondary Phone Number:"), 'phone2', 32, 30);
text_row_ex(_("Facsimile No:"), 'fax', 32, 30);
email_row_ex(_("E-mail:"), 'email', 30);
end_table(1);
submit_add_or_update_center($selected_id == -1, '', 'both');
end_form();
end_page();
Exemple #13
0
        $myrow = get_user($selected_id);
        $_POST['id'] = $myrow["id"];
        $_POST['user_id'] = $myrow["user_id"];
        $_POST['real_name'] = $myrow["real_name"];
        $_POST['phone'] = $myrow["phone"];
        $_POST['email'] = $myrow["email"];
        $_POST['role_id'] = $myrow["role_id"];
        $_POST['language'] = $myrow["language"];
        $_POST['print_profile'] = $myrow["print_profile"];
        $_POST['rep_popup'] = $myrow["rep_popup"];
        $_POST['pos'] = $myrow["pos"];
    }
    hidden('selected_id', $selected_id);
    hidden('user_id');
    start_row();
    label_row(_("User login:"******"User Login:"******"user_id", null, 22, 20);
    $_POST['language'] = user_language();
    $_POST['print_profile'] = user_print_profile();
    $_POST['rep_popup'] = user_rep_popup();
    $_POST['pos'] = user_pos();
}
$_POST['password'] = "";
password_row(_("Password:"******"Enter a new password to change, leave empty to keep current."));
}
text_row_ex(_("Full Name") . ":", 'real_name', 50);
text_row_ex(_("Telephone No.:"), 'phone', 30);
function display_item_form()
{
    global $table_style2;
    start_table($table_style2, 5, 7);
    echo "<tr><td valign=top>";
    // outer table
    echo "<table>";
    if (!isset($_POST['customer_id'])) {
        $_POST['customer_id'] = get_global_customer(false);
    }
    if (!isset($_POST['DateBanked'])) {
        $_POST['DateBanked'] = Today();
        if (!is_date_in_fiscalyear($_POST['DateBanked'])) {
            $_POST['DateBanked'] = end_fiscalyear();
        }
    }
    customer_list_row(tr("From Customer:"), 'customer_id', null, false, true);
    if (db_customer_has_branches($_POST['customer_id'])) {
        customer_branches_list_row(tr("Branch:"), $_POST['customer_id'], 'BranchID', null, false, true, true);
    } else {
        hidden('BranchID', reserved_words::get_any_numeric());
    }
    read_customer_data();
    set_global_customer($_POST['customer_id']);
    if (isset($_POST['HoldAccount']) && $_POST['HoldAccount'] != 0) {
        echo "</table></table>";
        display_note(tr("This customer account is on hold."), 0, 0, "class='redfb'");
    } else {
        $display_discount_percent = percent_format($_POST['pymt_discount'] * 100) . "%";
        amount_row(tr("Amount:"), 'amount');
        amount_row(tr("Amount of Discount:"), 'discount');
        label_row(tr("Customer prompt payment discount :"), $display_discount_percent);
        date_row(tr("Date of Deposit:"), 'DateBanked');
        echo "</table>";
        echo "</td><td valign=top class='tableseparator'>";
        // outer table
        echo "<table>";
        bank_accounts_list_row(tr("Into Bank Account:"), 'bank_account', null, true);
        $cust_currency = get_customer_currency($_POST['customer_id']);
        $bank_currency = get_bank_account_currency($_POST['bank_account']);
        if ($cust_currency != $bank_currency) {
            exchange_rate_display($cust_currency, $bank_currency, $_POST['DateBanked']);
        }
        bank_trans_types_list_row(tr("Type:"), 'ReceiptType', null);
        text_row(tr("Reference:"), 'ref', null, 20, 40);
        textarea_row(tr("Memo:"), 'memo_', null, 22, 4);
        echo "</table>";
        echo "</td></tr>";
        end_table();
        // outer table
        if ($cust_currency != $bank_currency) {
            display_note(tr("Amount and discount are in customer's currency."));
        }
        echo "<br>";
        submit_center('AddPaymentItem', tr("Add Payment"));
    }
    echo "<br>";
}
        $_POST['ChargeFreightCost'] = price_format(0);
    }
}
$accumulate_shipping = get_company_pref('accumulate_shipping');
if ($is_batch_invoice && $accumulate_shipping) {
    set_delivery_shipping_sum(array_keys($_SESSION['Items']->src_docs));
}
$colspan = 9;
start_row();
label_cell(_("Shipping Cost"), "colspan={$colspan} align=right");
small_amount_cells(null, 'ChargeFreightCost', null);
if ($is_batch_invoice) {
    label_cell('', 'colspan=2');
}
end_row();
$inv_items_total = $_SESSION['Items']->get_items_total_dispatch();
$display_sub_total = price_format($inv_items_total + input_num('ChargeFreightCost'));
label_row(_("Sub-total"), $display_sub_total, "colspan={$colspan} align=right", "align=right", $is_batch_invoice ? 2 : 0);
$taxes = $_SESSION['Items']->get_taxes(input_num('ChargeFreightCost'));
$tax_total = display_edit_tax_items($taxes, $colspan, $_SESSION['Items']->tax_included, $is_batch_invoice ? 2 : 0);
$display_total = price_format($inv_items_total + input_num('ChargeFreightCost') + $tax_total);
label_row(_("Invoice Total"), $display_total, "colspan={$colspan} align=right", "align=right", $is_batch_invoice ? 2 : 0);
end_table(1);
div_end();
start_table(TABLESTYLE2);
textarea_row(_("Memo"), 'Comments', null, 50, 4);
end_table(1);
submit_center_first('Update', _("Update"), _('Refresh document page'), true);
submit_center_last('process_invoice', _("Process Invoice"), _('Check entered data and save document'), 'default');
end_form();
end_page();
    if ($_POST['password'] != $_POST['passwordConfirm']) {
        display_error(_("The passwords entered are not the same."));
        set_focus('password');
        return false;
    }
    return true;
}
if (isset($_POST['UPDATE_ITEM']) && check_csrf_token()) {
    if (can_process()) {
        if ($allow_demo_mode) {
            display_warning(_("Password cannot be changed in demo mode."));
        } else {
            update_user_password($_SESSION["wa_current_user"]->user, $_SESSION["wa_current_user"]->username, md5($_POST['password']));
            display_notification(_("Your password has been updated."));
        }
        $Ajax->activate('_page_body');
    }
}
start_form();
start_table(TABLESTYLE);
$myrow = get_user($_SESSION["wa_current_user"]->user);
label_row(_("User login:"******"";
$_POST['passwordConfirm'] = "";
password_row(_("Password:"******"Repeat password:"******"Enter your new password in the fields."));
end_table(1);
submit_center('UPDATE_ITEM', _('Change password'), true, '', 'default');
end_form();
end_page();
function edit_allocations_for_transaction($type, $trans_no)
{
    global $table_style;
    start_form(false, true);
    display_heading(sprintf(tr("Allocation of %s # %d"), systypes::name($_SESSION['alloc']->type), $_SESSION['alloc']->trans_no));
    display_heading($_SESSION['alloc']->person_name);
    display_heading2(tr("Date:") . " <b>" . $_SESSION['alloc']->date_ . "</b>");
    display_heading2(tr("Total:") . " <b>" . price_format($_SESSION['alloc']->amount) . "</b>");
    echo "<br>";
    if (count($_SESSION['alloc']->allocs) > 0) {
        start_table($table_style);
        $th = array(tr("Transaction Type"), tr("#"), tr("Date"), tr("Due Date"), tr("Amount"), tr("Other Allocations"), tr("This Allocation"), tr("Left to Allocate"), "", "");
        table_header($th);
        $k = $counter = $total_allocated = 0;
        foreach ($_SESSION['alloc']->allocs as $allocn_item) {
            alt_table_row_color($k);
            label_cell(systypes::name($allocn_item->type));
            label_cell(get_trans_view_str($allocn_item->type, $allocn_item->type_no));
            label_cell($allocn_item->date_, "align=right");
            label_cell($allocn_item->due_date, "align=right");
            amount_cell($allocn_item->amount);
            amount_cell($allocn_item->amount_allocated);
            if (!check_num('amount' . $counter)) {
                $_POST['amount' . $counter] = price_format($allocn_item->current_allocated);
            }
            amount_cells(null, 'amount' . $counter, $_POST['amount' . $counter]);
            $un_allocated = round($allocn_item->amount - $allocn_item->amount_allocated, 6);
            hidden("un_allocated" . $counter, $un_allocated);
            amount_cell($un_allocated);
            label_cell("<a href='#' name=Alloc{$counter} onclick='allocate_all(this.name.substr(5));return true;'>" . tr("All") . "</a>");
            label_cell("<a href='#' name=DeAll{$counter} onclick='allocate_none(this.name.substr(5));return true;'>" . tr("None") . "</a>");
            end_row();
            $total_allocated += input_num('amount' . $counter);
            $counter++;
        }
        label_row(tr("Total Allocated"), price_format($total_allocated), "colspan=6 align=right", "nowrap align=right id='total_allocated'");
        if ($_SESSION['alloc']->amount - $total_allocated < 0) {
            $font1 = "<font color=red>";
            $font2 = "</font>";
        } else {
            $font1 = $font2 = "";
        }
        $left_to_allocate = $_SESSION['alloc']->amount - $total_allocated;
        $left_to_allocate = price_format($left_to_allocate);
        label_row(tr("Left to Allocate"), $font1 . $left_to_allocate . $font2, "colspan=6 align=right ", "nowrap align=right id='left_to_allocate'");
        end_table(1);
        hidden('TotalNumberOfAllocs', $counter);
        //		hidden('left_to_allocate', $left_to_allocate);
        submit_center_first('UpdateDisplay', tr("Update"));
        submit('Process', tr("Process"));
    } else {
        display_note(tr("There are no unsettled transactions to allocate."), 0, 1);
    }
    submit_center_last('Cancel', tr("Back to Allocations"));
    end_form();
}
function display_credit_items()
{
    start_form();
    hidden('cart_id');
    start_table(TABLESTYLE2, "width=80%", 5);
    echo "<tr><td>";
    // outer table
    start_table(TABLESTYLE, "width=100%");
    start_row();
    label_cells(_("Customer"), $_SESSION['Items']->customer_name, "class='tableheader2'");
    label_cells(_("Branch"), get_branch_name($_SESSION['Items']->Branch), "class='tableheader2'");
    label_cells(_("Currency"), $_SESSION['Items']->customer_currency, "class='tableheader2'");
    end_row();
    start_row();
    //	if (!isset($_POST['ref']))
    //		$_POST['ref'] = $Refs->get_next(11);
    if ($_SESSION['Items']->trans_no == 0) {
        ref_cells(_("Reference"), 'ref', '', null, "class='tableheader2'");
    } else {
        label_cells(_("Reference"), $_SESSION['Items']->reference, "class='tableheader2'");
    }
    label_cells(_("Crediting Invoice"), get_customer_trans_view_str(ST_SALESINVOICE, array_keys($_SESSION['Items']->src_docs)), "class='tableheader2'");
    if (!isset($_POST['ShipperID'])) {
        $_POST['ShipperID'] = $_SESSION['Items']->ship_via;
    }
    label_cell(_("Shipping Company"), "class='tableheader2'");
    shippers_list_cells(null, 'ShipperID', $_POST['ShipperID']);
    //	if (!isset($_POST['sales_type_id']))
    //	  $_POST['sales_type_id'] = $_SESSION['Items']->sales_type;
    //	label_cell(_("Sales Type"), "class='tableheader2'");
    //	sales_types_list_cells(null, 'sales_type_id', $_POST['sales_type_id']);
    end_row();
    end_table();
    echo "</td><td>";
    // outer table
    start_table(TABLESTYLE, "width=100%");
    if ($_SESSION['Items']->custom_num != '') {
        text_row(_("Credit Memo No."), 'custom_num', $_SESSION['Items']->custom_num, null, "class='tableheader2'");
    } else {
        text_row(_("Credit Memo No."), 'custom_num', '', null, "class='tableheader2'");
    }
    //moodlearning
    label_row(_("Invoice Date"), $_SESSION['Items']->src_date, "class='tableheader2'");
    date_row(_("Credit Note Date"), 'CreditDate', '', $_SESSION['Items']->trans_no == 0, 0, 0, 0, "class='tableheader2'");
    end_table();
    echo "</td></tr>";
    end_table(1);
    // outer table
    div_start('credit_items');
    start_table(TABLESTYLE, "width=80%");
    $th = array(_("Item Code"), _("Item Description"), _("Invoiced Quantity"), _("Units"), _("Credited"), _("Credit Quantity"), _("Price"), _("Discount %"), _("Total"));
    //Karen edited Credited
    table_header($th);
    $k = 0;
    //row colour counter
    foreach ($_SESSION['Items']->line_items as $line_no => $ln_itm) {
        if ($ln_itm->quantity == $ln_itm->qty_done) {
            continue;
            // this line was fully credited/removed
        }
        alt_table_row_color($k);
        //	view_stock_status_cell($ln_itm->stock_id); alternative view
        label_cell($ln_itm->stock_id);
        text_cells(null, 'Line' . $line_no . 'Desc', $ln_itm->item_description, 30, 50);
        $dec = get_qty_dec($ln_itm->stock_id);
        qty_cell($ln_itm->quantity, false, $dec);
        label_cell($ln_itm->units);
        label_cell($ln_itm->qty_done);
        //Karen edited
        amount_cells(null, 'Line' . $line_no, number_format2($ln_itm->qty_dispatched, $dec), null, null, $dec);
        $line_total = $ln_itm->qty_dispatched * $ln_itm->price * (1 - $ln_itm->discount_percent);
        amount_cell($ln_itm->price);
        percent_cell($ln_itm->discount_percent * 100);
        amount_cell($line_total);
        end_row();
    }
    if (!check_num('ChargeFreightCost')) {
        $_POST['ChargeFreightCost'] = price_format($_SESSION['Items']->freight_cost);
    }
    $colspan = 8;
    //Karen edited 7
    start_row();
    label_cell(_("Credit Shipping Cost"), "colspan={$colspan} align=right");
    small_amount_cells(null, "ChargeFreightCost", price_format(get_post('ChargeFreightCost', 0)));
    end_row();
    /*moodlearning*/
    start_row();
    label_cell(_("Bulk Discount"), "colspan={$colspan} align=right");
    small_amount_cells(null, "bulk_dis", $_SESSION['Items']->bulk_discount);
    end_row();
    /*           */
    $inv_items_total = $_SESSION['Items']->get_items_total_dispatch();
    $discount = input_num('bulk_dis') / 100;
    $display_sub_total = price_format($inv_items_total + input_num($_POST['ChargeFreightCost']));
    label_row(_("Sub-total"), $display_sub_total, "colspan={$colspan} align=right", "align=right");
    $taxes = $_SESSION['Items']->get_taxes(input_num($_POST['ChargeFreightCost']));
    $tax_total = display_edit_tax_items($taxes, $colspan, $_SESSION['Items']->tax_included);
    /*moodlearning*/
    $total = $inv_items_total + input_num('ChargeFreightCost') + $tax_total;
    $tot = price_format($total - $total * $discount);
    /*             */
    $display_total = price_format($inv_items_total + input_num('ChargeFreightCost') + $tax_total);
    label_row(_("Credit Note Total"), $tot, "colspan={$colspan} align=right", "align=right");
    //moodlearning edit $tot
    end_table();
    div_end();
}
$th = array(_("Item Code"), _("Item Description"), _("Quantity"), _("Unit"), _("Price"), _("Discount"), _("Total"), _("Quantity Delivered"));
table_header($th);
$k = 0;
//row colour counter
foreach ($_SESSION['View']->line_items as $stock_item) {
    $line_total = round2($stock_item->quantity * $stock_item->price * (1 - $stock_item->discount_percent), user_price_dec());
    alt_table_row_color($k);
    label_cell($stock_item->stock_id);
    label_cell($stock_item->item_description);
    $dec = get_qty_dec($stock_item->stock_id);
    qty_cell($stock_item->quantity, false, $dec);
    label_cell($stock_item->units);
    amount_cell($stock_item->price);
    amount_cell($stock_item->discount_percent * 100);
    amount_cell($line_total);
    qty_cell($stock_item->qty_done, false, $dec);
    end_row();
}
label_row(_("Shipping"), price_format($_SESSION['View']->freight_cost), "align=right colspan=6", "nowrap align=right", 1);
$sub_tot = $_SESSION['View']->get_items_total() + $_SESSION['View']->freight_cost;
$display_sub_tot = price_format($sub_tot);
label_row(_("Sub Total"), $display_sub_tot, "align=right colspan=6", "nowrap align=right", 1);
$taxes = $_SESSION['View']->get_taxes();
$tax_total = display_edit_tax_items($taxes, 6, $_SESSION['View']->tax_included, 2);
$display_total = price_format($sub_tot + $tax_total);
start_row();
label_cells(_("Amount Total"), $display_total, "colspan=6 align='right'", "align='right'");
label_cell('', "colspan=2");
end_row();
end_table(2);
end_page(true, false, false, $_GET['trans_type'], $_GET['trans_no']);
    $supp_name = $myrow["supp_name"];
    $_POST['price'] = price_decimal_format($myrow["price"], $dec2);
    $_POST['suppliers_uom'] = $myrow["suppliers_uom"];
    $_POST['supplier_description'] = $myrow["supplier_description"];
    $_POST['conversion_factor'] = maxprec_format($myrow["conversion_factor"]);
}
br();
hidden('selected_id', $selected_id);
if (@$_GET['popup']) {
    hidden('_tabs_sel', get_post('_tabs_sel'));
    hidden('popup', @$_GET['popup']);
}
start_table(TABLESTYLE2);
if ($Mode == 'Edit') {
    hidden('supplier_id');
    label_row(_("Supplier:"), $supp_name);
} else {
    supplier_list_row(_("Supplier:"), 'supplier_id', null, false, true);
    $_POST['price'] = $_POST['suppliers_uom'] = $_POST['conversion_factor'] = $_POST['supplier_description'] = "";
}
amount_row(_("Price:"), 'price', null, '', get_supplier_currency($selected_id), $dec2);
text_row(_("Suppliers Unit of Measure:"), 'suppliers_uom', null, 50, 51);
if (!isset($_POST['conversion_factor']) || $_POST['conversion_factor'] == "") {
    $_POST['conversion_factor'] = maxprec_format(1);
}
amount_row(_("Conversion Factor (to our UOM):"), 'conversion_factor', maxprec_format($_POST['conversion_factor']), null, null, 'max');
text_row(_("Supplier's Code or Description:"), 'supplier_description', null, 50, 51);
end_table(1);
submit_add_or_update_center($selected_id == -1, '', 'both');
if (!@$_GET['popup']) {
    end_form();
Exemple #21
0
    $_POST['payment_discount_account'] = $myrow["payment_discount_account"];
} else {
    // its a new supplier being added
    hidden('New', 'Yes');
    $company_record = get_company_prefs();
    $_POST['payable_account'] = $company_record["creditors_act"];
    $_POST['purchase_account'] = $company_record["default_cogs_act"];
    $_POST['payment_discount_account'] = $company_record['pyt_discount_act'];
}
text_row(tr("Supplier Name:"), 'supp_name', null, 42, 40);
textarea_row(tr("Address:"), 'address', null, 35, 5);
text_row(tr("Email:"), 'email', null, 42, 40);
text_row(tr("Bank Account:"), 'bank_account', null, 42, 40);
// Sherifoz 23.09.03 currency can't be changed if editing
if (isset($_POST['supplier_id']) && !isset($_POST['New'])) {
    label_row(tr("Supplier's Currency:"), $_POST['curr_code']);
    hidden('curr_code', $_POST['curr_code']);
} else {
    currencies_list_row(tr("Supplier's Currency:"), 'curr_code', null);
}
tax_groups_list_row(tr("Tax Group:"), 'tax_group_id', null);
payment_terms_list_row(tr("Payment Terms:"), 'payment_terms', null);
table_section_title(tr("Accounts"));
gl_all_accounts_list_row(tr("Accounts Payable Account:"), 'payable_account', $_POST['payable_account']);
gl_all_accounts_list_row(tr("Purchase Account:"), 'purchase_account', $_POST['purchase_account']);
gl_all_accounts_list_row(tr("Purchase Discount Account:"), 'payment_discount_account', $_POST['payment_discount_account']);
$dim = get_company_pref('use_dimension');
if ($dim >= 1) {
    table_section_title(tr("Dimension"));
    dimensions_list_row(tr("Dimension") . " 1:", 'dimension_id', null, true, " ", false, 1);
    if ($dim > 1) {
Exemple #22
0
    $r = db_fetch_row($rs);
    if (!isset($_POST['Labour'])) {
        $_POST['Labour'] = price_format(0);
        $_POST['cr_lab_acc'] = $r[0];
    }
    amount_row($wo_cost_types[WO_LABOUR], 'Labour');
    gl_all_accounts_list_row(_("Credit Labour Account"), 'cr_lab_acc', null);
    if (!isset($_POST['Costs'])) {
        $_POST['Costs'] = price_format(0);
        $_POST['cr_acc'] = $r[0];
    }
    amount_row($wo_cost_types[WO_OVERHEAD], 'Costs');
    gl_all_accounts_list_row(_("Credit Overhead Account"), 'cr_acc', null);
}
if (get_post('released')) {
    label_row(_("Released On:"), $_POST['released_date']);
}
textarea_row(_("Memo:"), 'memo_', null, 40, 5);
end_table(1);
if (isset($selected_id)) {
    echo "<table align=center><tr>";
    submit_cells('UPDATE_ITEM', _("Update"), '', _('Save changes to work order'), 'default');
    if (get_post('released')) {
        submit_cells('close', _("Close This Work Order"), '', '', true);
    }
    submit_cells('delete', _("Delete This Work Order"), '', '', true);
    echo "</tr></table>";
} else {
    submit_center('ADD_ITEM', _("Add Workorder"), true, '', 'default');
}
end_form();
    end_row();
}
inactive_control_row($th);
end_table(1);
//-------------------------------------------------------------------------------------------------
start_table(TABLESTYLE2);
if ($selected_id != -1) {
    if ($Mode == 'Edit') {
        //editing an existing area
        $myrow = get_crm_category($selected_id);
        $_POST['name'] = $myrow["name"];
        $_POST['type'] = $myrow["type"];
        $_POST['subtype'] = $myrow["action"];
        $_POST['description'] = $myrow["description"];
    }
    hidden("selected_id", $selected_id);
}
if ($Mode == 'Edit' && $myrow['system']) {
    label_row(_("Contact Category Type:"), $_POST['type']);
    label_row(_("Contact Category Subtype:"), $_POST['subtype']);
} else {
    //	crm_category_type_list_row(_("Contact Category Type:"), 'type', null, _('Other'));
    text_row_ex(_("Contact Category Type:"), 'type', 30);
    text_row_ex(_("Contact Category Subtype:"), 'subtype', 30);
}
text_row_ex(_("Category Short Name:"), 'name', 30);
textarea_row(_("Category Description:"), 'description', null, 60, 4);
end_table(1);
submit_add_or_update_center($selected_id == -1, '', 'both');
end_form();
end_page();
Exemple #24
0
text_row(_("Delivery Required By:"), 'default_delivery_required', $_POST['default_delivery_required'], 6, 6, '', "", _("days"));
//----------------
table_section(2);
table_section_title(_("Dimension Defaults"));
text_row(_("Dimension Required By After:"), 'default_dim_required', $_POST['default_dim_required'], 6, 6, '', "", _("days"));
//---------------
table_section_title(_("Suppliers and Purchasing"));
percent_row(_("Delivery Over-Receive Allowance:"), 'po_over_receive');
percent_row(_("Invoice Over-Charge Allowance:"), 'po_over_charge');
table_section_title(_("Suppliers and Purchasing Defaults"));
gl_all_accounts_list_row(_("Payable Account:"), 'creditors_act', $_POST['creditors_act']);
gl_all_accounts_list_row(_("Purchase Discount Account:"), 'pyt_discount_act', $_POST['pyt_discount_act']);
gl_all_accounts_list_row(_("GRN Clearing Account:"), 'grn_clearing_act', get_post('grn_clearing_act'), true, false, _("No postings on GRN"));
table_section_title(_("Inventory"));
check_row(_("Allow Negative Inventory:"), 'allow_negative_stock', null);
label_row(null, _("Warning:  This may cause a delay in GL postings"), "", "class='stockmankofg' colspan=2");
table_section_title(_("Items Defaults"));
gl_all_accounts_list_row(_("Sales Account:"), 'default_inv_sales_act', $_POST['default_inv_sales_act']);
gl_all_accounts_list_row(_("Inventory Account:"), 'default_inventory_act', $_POST['default_inventory_act']);
// this one is default for items and suppliers (purchase account)
gl_all_accounts_list_row(_("C.O.G.S. Account:"), 'default_cogs_act', $_POST['default_cogs_act']);
gl_all_accounts_list_row(_("Inventory Adjustments Account:"), 'default_adj_act', $_POST['default_adj_act']);
gl_all_accounts_list_row(_("Item Assembly Costs Account:"), 'default_assembly_act', $_POST['default_assembly_act']);
//----------------
table_section_title(_("Manufacturing Defaults"));
text_row(_("Work Order Required By After:"), 'default_workorder_required', $_POST['default_workorder_required'], 6, 6, '', "", _("days"));
//----------------
end_outer_table(1);
submit_center('submit', _("Update"), true, '', 'default');
end_form(2);
//-------------------------------------------------------------------------------------------------
 label_row(_(" Basic:"), $basic_pay, null, 30, 30);
 label_row(_(" DA:"), $da_pay, null, 30, 30);
 label_row(_(" HRA:"), $hra_pay, null, 30, 30);
 label_row(_(" Conveyance:"), $convey_allow, null, 30, 30);
 label_row(_(" Education/ Other Allowance:"), $edu_other_allow, null, 30, 30);
 table_section_title(_(""));
 label_row(_(" Gross Earning"), $gross, 'style="color:#A86A0B; background-color:#F2F6D5;"', 'style="color:#A86A0B; background-color:#F2F6D5;"');
 table_section(2);
 table_section_title(_("Deduction"));
 label_row(_(" Provident Fund:"), $pf, null, 30, 30);
 label_row(_(" LOP Amount:"), $lop_amount, null, 30, 30);
 label_row(_(" Monthly Amount:"), $staff_loan, null, 30, 30);
 label_row(_(" Other Deduction:"), $tds, null, 30, 30);
 label_row(_(" Total Deductions"), $total_ded, 'style="color:#f55; background-color:#fed;"', 'style="color:#f55; background-color:#fed;"');
 label_row(_(" "), '', null, 30, 30);
 label_row(_(" Net Salary Payable:"), $total_net, 'style="color:#107B0F; background-color:#B7DBC1;"', 'style="color:#107B0F; background-color:#B7DBC1;"');
 end_outer_table(1);
 if (!db_has_employee_payslip($_POST['year'], $_POST['month'], $_POST['empl_id'])) {
     start_table(TABLESTYLE2);
     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();
//-----------------------------------------------------------------------------------
start_table(TABLESTYLE2);
if ($selected_id != "") {
    if ($Mode == 'Edit') {
        //editing an existing status code
        $myrow = get_account_class($selected_id);
        $_POST['id'] = $myrow["cid"];
        $_POST['name'] = $myrow["class_name"];
        if (isset($use_oldstyle_convert) && $use_oldstyle_convert == 1) {
            $_POST['ctype'] = $myrow["ctype"] >= CL_ASSETS && $myrow["ctype"] < CL_INCOME ? 1 : 0;
        } else {
            $_POST['ctype'] = $myrow["ctype"];
        }
        hidden('selected_id', $selected_id);
    }
    hidden('id');
    label_row(_("Class ID:"), $_POST['id']);
} else {
    text_row_ex(_("Class ID:"), 'id', 3);
}
text_row_ex(_("Class Name:"), 'name', 50, 60);
if (isset($use_oldstyle_convert) && $use_oldstyle_convert == 1) {
    check_row(_("Balance Sheet"), 'ctype', null);
} else {
    class_types_list_row(_("Class Type:"), 'ctype', null);
}
end_table(1);
submit_add_or_update_center($selected_id == "", '', 'both');
end_form();
//------------------------------------------------------------------------------------
end_page();
Exemple #27
0
 //--------------------------------------------------------------------------------------
 start_form();
 display_bom_items($selected_parent);
 //--------------------------------------------------------------------------------------
 echo '<br>';
 start_table(TABLESTYLE2);
 if ($selected_id != -1) {
     if ($Mode == 'Edit') {
         //editing a selected component from the link to the line item
         $myrow = get_component_from_bom($selected_id);
         $_POST['loc_code'] = $myrow["loc_code"];
         $_POST['component'] = $myrow["component"];
         // by Tom Moulton
         $_POST['workcentre_added'] = $myrow["workcentre_added"];
         $_POST['quantity'] = number_format2($myrow["quantity"], get_qty_dec($myrow["component"]));
         label_row(_("Component:"), $myrow["component"] . " - " . $myrow["description"]);
     }
     hidden('selected_id', $selected_id);
 } else {
     start_row();
     label_cell(_("Component:"), "class='label'");
     echo "<td>";
     echo stock_component_items_list('component', $selected_parent, null, false, true);
     if (get_post('_component_update')) {
         $Ajax->activate('quantity');
     }
     echo "</td>";
     end_row();
 }
 hidden('stock_id', $selected_parent);
 locations_list_row(_("Location to Draw From:"), 'loc_code', null);
function display_company_edit($selected_id)
{
    global $def_coy, $db_connections, $tb_pref_counter;
    start_form();
    start_table(TABLESTYLE2);
    if ($selected_id != -1) {
        $conn = $db_connections[$selected_id];
        $_POST['name'] = $conn['name'];
        $_POST['host'] = $conn['host'];
        $_POST['dbuser'] = $conn['dbuser'];
        $_POST['dbpassword'] = $conn['dbpassword'];
        $_POST['dbname'] = $conn['dbname'];
        $_POST['tbpref'] = $conn['tbpref'];
        if ($selected_id == $def_coy) {
            $_POST['def'] = true;
        } else {
            $_POST['def'] = false;
        }
        $_POST['dbcreate'] = false;
        hidden('selected_id', $selected_id);
        hidden('tbpref', $_POST['tbpref']);
        hidden('dbpassword', $_POST['dbpassword']);
    } else {
        $_POST['tbpref'] = $tb_pref_counter . "_";
        // Insert the current settings as default
        $conn = $db_connections[user_company()];
        $_POST['name'] = '';
        $_POST['host'] = $conn['host'];
        $_POST['dbuser'] = $conn['dbuser'];
        $_POST['dbpassword'] = $conn['dbpassword'];
        $_POST['dbname'] = $conn['dbname'];
    }
    text_row_ex(_("Company"), 'name', 50);
    if ($selected_id == -1) {
        text_row_ex(_("Host"), 'host', 30, 60);
        text_row_ex(_("Database User"), 'dbuser', 30);
        text_row_ex(_("Database Password"), 'dbpassword', 30);
        text_row_ex(_("Database Name"), 'dbname', 30);
        yesno_list_row(_("Table Pref"), 'tbpref', 1, $_POST['tbpref'], _("None"), false);
    } else {
        label_row(_("Host"), $_POST['host']);
        label_row(_("Database User"), $_POST['dbuser']);
        label_row(_("Database Name"), $_POST['dbname']);
        label_row(_("Table Pref"), $_POST['tbpref']);
    }
    yesno_list_row(_("Default"), 'def', null, "", "", false);
    if ($selected_id == -1) {
        coa_list_row(_("Database Script"), 'coa');
        text_row_ex(_("New script Admin Password"), 'admpassword', 20);
    }
    end_table(1);
    submit_center('save', _("Save"));
    end_form();
}
            $th = array(_("Account Code"), _("Account Description"), _("Dimension"), _("Amount"), _("Memo"));
        } else {
            $th = array(_("Account Code"), _("Account Description"), _("Amount"), _("Memo"));
        }
    }
    table_header($th);
    $k = 0;
    //row colour counter
    $total_amount = 0;
    while ($item = db_fetch($items)) {
        if ($item["account"] != $to_trans["account_code"]) {
            alt_table_row_color($k);
            label_cell($item["account"]);
            label_cell($item["account_name"]);
            if ($dim >= 1) {
                label_cell(get_dimension_string($item['dimension_id'], true));
            }
            if ($dim > 1) {
                label_cell(get_dimension_string($item['dimension2_id'], true));
            }
            amount_cell(-$item["amount"]);
            label_cell($item["memo_"]);
            end_row();
            $total_amount += $item["amount"];
        }
    }
    label_row(_("Total"), number_format2(-$total_amount, user_price_dec()), "colspan=" . (2 + $dim) . " align=right", "align=right");
    end_table(1);
    display_allocations_from($to_trans['person_type_id'], $to_trans['person_id'], 2, $trans_no, $to_trans['settled_amount']);
}
end_page(true, false, false, ST_BANKDEPOSIT, $trans_no);
Exemple #30
0
function display_currency_edit($selected_id)
{
    global $Mode;
    start_table(TABLESTYLE2);
    if ($selected_id != '') {
        if ($Mode == 'Edit') {
            //editing an existing currency
            $myrow = get_currency($selected_id);
            $_POST['Abbreviation'] = $myrow["curr_abrev"];
            $_POST['Symbol'] = $myrow["curr_symbol"];
            $_POST['CurrencyName'] = $myrow["currency"];
            $_POST['country'] = $myrow["country"];
            $_POST['hundreds_name'] = $myrow["hundreds_name"];
            $_POST['auto_update'] = $myrow["auto_update"];
        }
        hidden('Abbreviation');
        hidden('selected_id', $selected_id);
        label_row(_("Currency Abbreviation:"), $_POST['Abbreviation']);
    } else {
        $_POST['auto_update'] = 1;
        text_row_ex(_("Currency Abbreviation:"), 'Abbreviation', 4, 3);
    }
    text_row_ex(_("Currency Symbol:"), 'Symbol', 10);
    text_row_ex(_("Currency Name:"), 'CurrencyName', 20);
    text_row_ex(_("Hundredths Name:"), 'hundreds_name', 15);
    text_row_ex(_("Country:"), 'country', 40);
    check_row(_("Automatic exchange rate update:"), 'auto_update', get_post('auto_update'));
    end_table(1);
    submit_add_or_update_center($selected_id == '', '', 'both');
}