function enter($_GET, $errors = "")
{
    extract($_REQUEST);
    extract($_GET);
    //	$fields =
    $id += 0;
    db_connect();
    $Sl = "SELECT * FROM assets WHERE id='{$id}' LIMIT 1";
    $Ri = db_exec($Sl);
    $data = pg_fetch_array($Ri);
    extract($data);
    #process date
    $date_arr = explode("-", $date);
    $date_year = $date_arr[0];
    $date_month = $date_arr[1];
    $date_day = $date_arr[2];
    $qty = $serial2;
    $seryn = "yes";
    if ($nonserial == "1") {
        $seryn = "no";
    }
    $fields = array();
    //	$fields["grpid"] = 0;
    //	$fields["seryn"] = "yes";
    //	$fields["qty"] = "1";
    //	$fields["serial"] = "";
    //	$fields["serial2"] = "";
    //	$fields["locat"] = "";
    //	$fields["des"] = "";
    //	$fields["method"] = "add";
    //	$fields["date_day"] = date("d");
    //	$fields["date_month"] = date("m");
    //	$fields["date_year"] = date("Y");
    //	$fields["amount"] = "0.00";
    //	$fields["dep_perc"] = 0;
    //	$fields["dep_month"] = "no";
    $fields["svdate_day"] = date("d");
    $fields["svdate_month"] = date("m");
    $fields["svdate_year"] = date("Y");
    $fields["sv_desc"] = "";
    $fields["details"] = "";
    //	$fields["type_id"] = 0;
    $fields["units"] = "0";
    extract($fields, EXTR_SKIP);
    if ($dep_month == "yes") {
        $dm_yes = "checked";
        $dm_no = "";
    } else {
        $dm_yes = "";
        $dm_no = "checked";
    }
    if (isset($method) && $method == "purch") {
        $meth_purch = "checked";
        $meth_add = "";
    } else {
        $meth_purch = "";
        $meth_add = "checked";
    }
    db_connect();
    $grps = "<select name='grpid' style='width: 135'>";
    $sql = "SELECT * FROM assetgrp WHERE div = '" . USER_DIV . "' ORDER BY grpname ASC";
    $grpRslt = db_exec($sql);
    if (pg_numrows($grpRslt) < 1) {
        return "\r\n\t\t\t\t<li>There are no Asset Groups in Cubit.</li><br>" . mkQuickLinks(ql("assetgrp-new.php", "Add Asset Group"), ql("assetgrp-view.php", "View Asset Groups"));
    } else {
        while ($grp = pg_fetch_array($grpRslt)) {
            $sel = fsel($grpid == $grp["grpid"]);
            $grps .= "<option {$sel} value='{$grp['grpid']}'>{$grp['grpname']}</option>";
        }
    }
    $grps .= "</select>";
    $sql = "SELECT * FROM cubit.asset_types ORDER BY name ASC";
    $type_rslt = db_exec($sql) or errDie("Unable to retrieve asset type.");
    $type_sel = "<select name='type_id' style='width: 135'>";
    $type_sel .= "<option value='0'>[None]</option>";
    while ($type_data = pg_fetch_array($type_rslt)) {
        $sel = fsel($type_id == $type_data["id"]);
        $type_sel .= "<option value='{$type_data['id']}' {$sel}>{$type_data['name']}</option>";
    }
    $type_sel .= "</select>";
    if ($seryn == "yes") {
        $div_qty_style = "visibility: hidden;";
        $div_serial_style = "";
    } else {
        $div_serial_style = "visibility: hidden;";
        $div_qty_style = "";
    }
    $display_piclist = "";
    $display_iframe = "";
    #check if this cust has any pics ...
    if (isset($id) and strlen($id) > 0) {
        #editing customer ... show frame if we have pics
        $get_pics = "SELECT * FROM display_images WHERE type = 'asset' AND ident_id = '{$id}' LIMIT 1";
        $run_pics = db_exec($get_pics) or errDie("Unable to get customer images information.");
        if (pg_numrows($run_pics) < 1) {
            #no pics for this customer
            $display_iframe = "";
        } else {
            #compile listing for customer
            $get_piclist = "SELECT * FROM display_images WHERE type = 'asset' AND ident_id = '{$id}'";
            $run_piclist = db_exec($get_piclist) or errDie("Unable to get customer images information.");
            if (pg_numrows($run_piclist) < 1) {
                #wth .. pic went missing somewhere ...
                #so nothing
            } else {
                $display_piclist = "\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td colspan='2'>\r\n\t\t\t\t\t\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t<th>Picture Name</th>\r\n\t\t\t\t\t\t\t\t\t<th>View</th>\r\n\t\t\t\t\t\t\t\t\t<th>Remove</th>\r\n\t\t\t\t\t\t\t\t</tr>";
                while ($arr = pg_fetch_array($run_piclist)) {
                    $display_piclist .= "\r\n\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t\t\t<td>{$arr['image_name']}</td>\r\n\t\t\t\t\t\t\t\t\t<td><a target='iframe1' href='view_image.php?picid={$arr['id']}'>View</a></td>\r\n\t\t\t\t\t\t\t\t\t<td><input type='checkbox' name='rempicid[{$arr['id']}]' value='yes'></td>\r\n\t\t\t\t\t\t\t\t</tr>";
                    #at least 1 picture for this customer
                    $display_iframe = "<tr><td colspan='2'><iframe name='iframe1' width='200' height='260' scrolling='false' marginwidth='0' marginheight='0' frameborder='0' src='view_image.php?picid={$arr['id']}'></iframe></td></tr>";
                }
                $display_piclist .= "\r\n\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>";
            }
        }
    }
    $OUT = "\r\n\t\t<script>\r\n\t\t\tfunction seryn_update(obj) {\r\n\t\t\t\tif (obj.value == 'yes') {\r\n\t\t\t\t\tgetObject('div_serial').style.visibility = 'visible';\r\n\t\t\t\t\tgetObject('div_qty').style.visibility = 'hidden';\r\n\t\t\t\t} else {\r\n\t\t\t\t\tgetObject('div_serial').style.visibility = 'hidden';\r\n\t\t\t\t\tgetObject('div_qty').style.visibility = 'visible';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t</script>\r\n\t\t<h3>New Asset</h3>\r\n\t\t<form action='" . SELF . "' method='POST'>\r\n\t\t<table cellpadding='0' cellspacing='0'>\r\n\t\t\t<tr valign='top'>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td colspan='2'>{$errors}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<input type='hidden' name='key' value='confirm'>\r\n\t\t\t\t\t\t<input type='hidden' name='id' value='{$id}'>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<th colspan='2'>Asset Details</th>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>" . REQ . "Select Group</td>\r\n\t\t\t\t\t\t\t<td>{$grps}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Select Type</td>\r\n\t\t\t\t\t\t\t<td>{$type_sel}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>" . REQ . "Location</td>\r\n\t\t\t\t\t\t\t<td><input type='text' size='20' name='locat' value='{$locat}'></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>" . REQ . "Description</td>\r\n\t\t\t\t\t\t\t<td><input type='text' size='20' name='des' value='{$des}'></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Details</td>\r\n\t\t\t\t\t\t\t<td><textarea name='details' cols='30' rows='4'>{$details}</textarea></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Billing Requirement Ratio (Units)</td>\r\n\t\t\t\t\t\t\t<td><input type='text' name='units' value='{$units}' /></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Percentage of Yearly Depreciation</td>\r\n\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t<input type='text' size='2' name='dep_perc' value='{$dep_perc}' maxlength='2' />%\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Auto Monthly Depreciation</td>\r\n\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\tYes <input type='radio' name='dep_month' value='yes' {$dm_yes} />\r\n\t\t\t\t\t\t\t\tNo <input type='radio' name='dep_month' value='no' {$dm_no} />\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<th colspan=2>Bought</th>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t \t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t \t\t<td>" . REQ . "Date</td>\r\n\t\t\t\t\t \t\t<td>" . mkDateSelect("date", $date_year, $date_month, $date_day) . "</td>\r\n\t\t\t\t\t \t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>" . REQ . "Amount</td>\r\n\t\t\t\t\t\t\t<td>" . CUR . "<input type='text' size='20' name='amount' value='{$amount}'></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<th colspan='2'>Servicing</th>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Add New Service</td>\r\n\t\t\t\t\t\t\t<td><input type='checkbox' name='set_service' value='yes'></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Service Date</td>\r\n\t\t\t\t\t\t\t<td>" . mkDateSelect("svdate", $svdate_year, $svdate_month, $svdate_day) . "</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Service Description</td>\r\n\t\t\t\t\t\t\t<td><input type='text' name='sv_desc' value='{$sv_desc}' /></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<th colspan='2'>Serial Number/Quantity</th>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Has Serial Number?</td>\r\n\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t<input onclick='seryn_update(this);' type='radio' name='seryn' value='yes' " . fcheck($seryn != "no") . "> Yes\r\n\t\t\t\t\t\t\t\t<input onclick='seryn_update(this);' type='radio' name='seryn' value='no' " . fcheck($seryn == "no") . "> No\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td colspan='2' style='margin: 0px; padding: 0px;'>\r\n\t\t\t\t\t\t\t\t<div id='div_qty' style='{$div_qty_style}'>\r\n\t\t\t\t\t\t\t\t\t<table " . TMPL_tblDflts . " width='100%'>\r\n\t\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t\t\t\t\t<td>Quantity</td>\r\n\t\t\t\t\t\t\t\t\t\t\t<td><input type='text' name='qty' value='{$serial2}'></td>\r\n\t\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t<div id='div_serial' style='{$div_serial_style}'>\r\n\t\t\t\t\t\t\t\t\t<table " . TMPL_tblDflts . " width='100%'>\r\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t\t\t\t<td>" . REQ . " Serial Number</td>\r\n\t\t\t\t\t\t\t\t\t\t<td><input type='text' size='20' name='serial' value='{$serial}'></td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t\t\t\t<td>2nd Serial Number</td>\r\n\t\t\t\t\t\t\t\t\t\t<td><input type='text' size='20' name='serial2' value='{$serial2}'></td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t<table " . TMPL_tblDfts . ">\r\n\t\t\t\t\t\t{$display_iframe}\r\n\t\t\t\t\t</table>\r\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t\t\t\t{$display_piclist}\r\n\t\t\t\t\t</table>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td valign='bottom' colspan='2' align='right'>\r\n\t\t\t\t\t<input type='submit' value='Confirm &raquo;'>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t</table>\r\n\t\t<p>\r\n\t\t<table border='0' cellpadding='2' cellspacing='1'>\r\n\t\t\t<tr>\r\n\t\t\t\t<th>Quick Links</th>\r\n\t\t\t</tr>\r\n\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td><a href='asset-view.php'>View Assets</a></td>\r\n\t\t\t</tr>\r\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\r\n\t\t</table>";
    return $OUT;
}
<p align='right'><input type='submit'  value='<?php 
    echo _SALVA;
    ?>
'  /></p>  
</form>
</fieldset>
<br/>
<fieldset>
<legend><b> <?php 
    echo _PERMESSI;
    ?>
</b></legend>
<br/>
<?php 
    if (fcheck("pages")) {
        echo "" . _CARTELLA_SCRIVIBILE;
    } else {
        echo "" . _CARTELLA_NON_SCRIVIBILE;
    }
    echo "<br/><br/>\n";
    echo "<table>";
    echo "<tr><td><b>" . _PAGE . "</b></td><td><b>" . _DATE . "</b><td><b>" . _SIZE . "</b></td><td><b>" . _VEDI . "</b></td><td><b>" . _ELIMINA . "</b></td><td><b>" . _STATO . "</b></td></tr>";
    $fd = opendir("pages/");
    while (false !== ($nf = readdir($fd))) {
        if (substr_count($nf, ".") == 0) {
            echo "<tr><td>{$nf}</td>";
            echo "<td><i>" . date("j/m/y h:i", filemtime("pages/{$nf}")) . "<i></td>\n";
            echo "<td><i>" . filesize("pages/{$nf}") . "<i></td>\n";
            echo "<td>[<a href='pages/{$nf}' target='new'>" . _VEDI . "</a>]</td>";
            echo "<td>[<a href='?op=delete&page={$nf}'  onclick=\"if (confirm('cancellare'))return true; else return false;\">" . _ELIMINA . "</a>]</td>";
function enter($errors = "")
{
    extract($_REQUEST);
    $sql = "SELECT value FROM cubit.settings WHERE constant='ASSET_COST_ACCOUNT'";
    $cost_acc_rslt = db_exec($sql) or errDie("Unable to retrieve account.");
    $default_cost_acc = pg_fetch_result($cost_acc_rslt, 0);
    $sql = "SELECT value FROM cubit.settings WHERE constant='ASSET_ACCDEP_ACCOUNT'";
    $accdep_acc_rslt = db_exec($sql) or errDie("Unable to retrieve account.");
    $default_accdep_acc = pg_fetch_result($accdep_acc_rslt, 0);
    $sql = "SELECT value FROM cubit.settings WHERE constant='ASSET_DEP_ACCOUNT'";
    $dep_acc_rslt = db_exec($sql) or errDie("Unable to retrieve account.");
    $default_dep_acc = pg_fetch_result($dep_acc_rslt, 0);
    $fields = array();
    $fields["grpid"] = 0;
    $fields["seryn"] = "yes";
    $fields["qty"] = "1";
    $fields["serial"] = "";
    $fields["serial2"] = "";
    $fields["locat"] = "";
    $fields["des"] = "";
    $fields["details"] = "";
    $fields["units"] = "0";
    $fields["method"] = "add";
    $fields["date_day"] = date("d");
    $fields["date_month"] = date("m");
    $fields["date_year"] = date("Y");
    $fields["amount"] = "0.00";
    $fields["dep_perc"] = 0;
    $fields["dep_month"] = "no";
    $fields["svdate_day"] = date("d");
    $fields["svdate_month"] = date("m");
    $fields["svdate_year"] = date("Y");
    $fields["type_id"] = 0;
    $fields["sv_desc"] = "";
    $fields["cost_acc"] = $default_cost_acc;
    $fields["accdep_acc"] = $default_accdep_acc;
    $fields["dep_acc"] = $default_dep_acc;
    extract($fields, EXTR_SKIP);
    if ($dep_month == "yes") {
        $dm_yes = "checked";
        $dm_no = "";
    } else {
        $dm_yes = "";
        $dm_no = "checked";
    }
    if ($method == "purch") {
        $meth_purch = "checked";
        $meth_add = "";
    } else {
        $meth_purch = "";
        $meth_add = "checked";
    }
    db_connect();
    $grps = "<select name='grpid' style='width: 135'>";
    $sql = "SELECT * FROM assetgrp WHERE div = '" . USER_DIV . "' ORDER BY grpname ASC";
    $grpRslt = db_exec($sql);
    if (pg_numrows($grpRslt) < 1) {
        return "\r\n\t\t\t<li>There are no Asset Groups in Cubit.</li><br>" . mkQuickLinks(ql("assetgrp-new.php", "Add Asset Group"), ql("assetgrp-view.php", "View Asset Groups"));
    } else {
        while ($grp = pg_fetch_array($grpRslt)) {
            $sel = fcheck($grpid == $grp["grpid"]);
            $grps .= "<option {$sel} value='{$grp['grpid']}'>{$grp['grpname']}</option>";
        }
    }
    $grps .= "</select>";
    $sql = "SELECT * FROM cubit.asset_types ORDER BY name ASC";
    $type_rslt = db_exec($sql) or errDie("Unable to retrieve asset type.");
    $type_sel = "<select name='type_id' style='width: 135'>";
    $type_sel .= "<option value='0'>[None]</option>";
    while ($type_data = pg_fetch_array($type_rslt)) {
        $sel = fcheck($typeid == $type_data["id"]);
        $type_sel .= "<option value='{$type_data['id']}' {$sel}>{$type_data['name']}</option>";
    }
    $type_sel .= "</select>";
    if ($seryn == "yes") {
        $div_qty_style = "visibility: hidden;";
        $div_serial_style = "";
    } else {
        $div_serial_style = "visibility: hidden;";
        $div_qty_style = "";
    }
    // Cost Account
    $sql = "SELECT accid, topacc, accnum, accname FROM core.accounts";
    $cost_acc_rslt = db_exec($sql) or errDie("Unable to retrieve accounts.");
    $cost_acc_sel = "<select name='cost_acc' style='width: 100%'>";
    while ($cost_acc_data = pg_fetch_array($cost_acc_rslt)) {
        $sel = $cost_acc == $cost_acc_data["accid"] ? "selected='t'" : "";
        $cost_acc_sel .= "\r\n\t\t\t<option value='{$cost_acc_data['accid']}' {$sel}>\r\n\t\t\t\t{$cost_acc_data['topacc']}/{$cost_acc_data['accnum']} {$cost_acc_data['accname']}\r\n\t\t\t</option>";
    }
    $cost_acc_sel .= "</select>";
    // Accumulated Deprecation
    $sql = "SELECT accid, topacc, accnum, accname FROM core.accounts";
    $accdep_acc_rslt = db_exec($sql) or errDie("Unable to retrieve accounts.");
    $accdep_acc_sel = "<select name='accdep_acc' style='width: 100%'>";
    while ($accdep_acc_data = pg_fetch_array($accdep_acc_rslt)) {
        $sel = $accdep_acc == $accdep_acc_data["accid"] ? "selected='t'" : "";
        $accdep_acc_sel .= "\r\n\t\t\t<option value='{$accdep_acc_data['accid']}' {$sel}>\r\n\t\t\t\t{$accdep_acc_data['topacc']}/{$accdep_acc_data['accnum']} {$accdep_acc_data['accname']}\r\n\t\t\t</option>";
    }
    $accdep_acc_sel .= "</select>";
    // Deprecation
    $sql = "SELECT accid, topacc, accnum, accname FROM core.accounts";
    $dep_acc_rslt = db_exec($sql) or errDie("Unable to retrieve accounts.");
    $dep_acc_sel = "<select name='dep_acc' style='width: 100%'>";
    while ($dep_acc_data = pg_fetch_array($dep_acc_rslt)) {
        $sel = $dep_acc == $dep_acc_data["accid"] ? "selected='t'" : "";
        $dep_acc_sel .= "\r\n\t\t\t<option value='{$dep_acc_data['accid']}' {$sel}>\r\n\t\t\t\t{$dep_acc_data['topacc']}/{$dep_acc_data['accnum']} {$dep_acc_data['accname']}\r\n\t\t\t</option>";
    }
    $dep_acc_sel .= "</select>";
    $OUT = "\r\n\t\t<script>\r\n\t\t\tfunction seryn_update(obj) {\r\n\t\t\t\tif (obj.value == 'yes') {\r\n\t\t\t\t\tgetObject('div_serial').style.visibility = 'visible';\r\n\t\t\t\t\tgetObject('div_qty').style.visibility = 'hidden';\r\n\t\t\t\t} else {\r\n\t\t\t\t\tgetObject('div_serial').style.visibility = 'hidden';\r\n\t\t\t\t\tgetObject('div_qty').style.visibility = 'visible';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t</script>\r\n\t\t<h3>New Asset</h3>\r\n\t\t<form action='" . SELF . "' method='POST'>\r\n\t\t<table cellpadding='0' cellspacing='0'>\r\n\t\t\t<tr valign='top'>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td colspan='2'>{$errors}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<input type='hidden' name='key' value='confirm'>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<th colspan='2'>Asset Details</th>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>" . REQ . "Select Group</td>\r\n\t\t\t\t\t\t\t<td>{$grps}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Select Type</td>\r\n\t\t\t\t\t\t\t<td>{$type_sel}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>" . REQ . "Location</td>\r\n\t\t\t\t\t\t\t<td><input type='text' size='20' name='locat' value='{$locat}'></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>" . REQ . "Description</td>\r\n\t\t\t\t\t\t\t<td><input type='text' size='20' name='des' value='{$des}'></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Details</td>\r\n\t\t\t\t\t\t\t<td><textarea name='details' cols='30' rows='4'>{$details}</textarea></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Billing Requirement Ratio (Units)</td>\r\n\t\t\t\t\t\t\t<td><input type='text' name='units' value='{$units}' /></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Percentage of Yearly Depreciation</td>\r\n\t\t\t\t\t\t\t<td><input type='text' size='2' name='dep_perc' value='{$dep_perc}' maxlength='2' />%</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Auto Monthly Depreciation</td>\r\n\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\tYes <input type='radio' name='dep_month' value='yes' {$dm_yes} />\r\n\t\t\t\t\t\t\t\tNo <input type='radio' name='dep_month' value='no' {$dm_no} />\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>" . REQ . "Method</td>\r\n\t\t\t\t\t\t\t<td valign='center'>\r\n\t\t\t\t\t\t\t\tAdd Asset <input type='radio' name='method' value='add' {$meth_add}>\r\n\t\t\t\t\t\t\t\tPurchase Asset <input type='radio' name='method' value='purch' {$meth_purch}>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<th colspan='2'>Bought</th>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t \t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t \t\t<td>" . REQ . "Date</td>\r\n\t\t\t\t\t \t\t<td>" . mkDateSelect("date", $date_year, $date_month, $date_day) . "</td>\r\n\t\t\t\t\t \t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>" . REQ . "Amount</td>\r\n\t\t\t\t\t\t\t<td>" . CUR . "<input type='text' size='20' name='amount' value='{$amount}'></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<!--\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Cost Account</td>\r\n\t\t\t\t\t\t\t<td>{$cost_acc_sel}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Accumulated Depreciation Account</td>\r\n\t\t\t\t\t\t\t<td>{$accdep_acc_sel}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Depreciation Account</td>\r\n\t\t\t\t\t\t\t<td>{$dep_acc_sel}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t-->\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<th colspan='2'>Servicing</th>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Next Service Date</td>\r\n\t\t\t\t\t\t\t<td>" . mkDateSelect("svdate", $svdate_year, $svdate_month, $svdate_day) . "</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Service Description</td>\r\n\t\t\t\t\t\t\t<td><input type='text' name='sv_desc' value='{$sv_desc}' /></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<th colspan='2'>Serial Number/Quantity</th>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Has Serial Number?</td>\r\n\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\t<input onclick='seryn_update(this);' type='radio' name='seryn' value='yes' " . fcheck($seryn != "no") . "> Yes\r\n\t\t\t\t\t\t\t\t<input onclick='seryn_update(this);' type='radio' name='seryn' value='no' " . fcheck($seryn == "no") . "> No\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td colspan='2' style='margin: 0px; padding: 0px;'>\r\n\t\t\t\t\t\t\t\t<div id='div_qty' style='height: 0px; {$div_qty_style}'>\r\n\t\t\t\t\t\t\t\t\t<table " . TMPL_tblDflts . " width='100%'>\r\n\t\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t\t\t\t\t<td>" . REQ . " Quantity</td>\r\n\t\t\t\t\t\t\t\t\t\t\t<td><input type='text' size='20' name='qty' value='{$qty}'></td>\r\n\t\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t<div id='div_serial' style='{$div_serial_style}'>\r\n\t\t\t\t\t\t\t\t\t<table " . TMPL_tblDflts . " width='100%'>\r\n\t\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t\t\t\t\t<td>" . REQ . " Serial Number</td>\r\n\t\t\t\t\t\t\t\t\t\t\t<td><input type='text' size='20' name='serial' value='{$serial}'></td>\r\n\t\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t\t\t\t\t<td>2nd Serial Number</td>\r\n\t\t\t\t\t\t\t\t\t\t\t<td><input type='text' size='20' name='serial2' value='{$serial2}'></td>\r\n\t\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td valign='bottom' colspan='2' align='right'><input type='submit' value='Confirm &raquo;'></td>\r\n\t\t\t</tr>\r\n\t\t</table>\r\n\t\t<p>\r\n\t\t<table border='0' cellpadding='2' cellspacing='1'>\r\n\t\t\t<tr>\r\n\t\t\t\t<th>Quick Links</th>\r\n\t\t\t</tr>\r\n\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td><a href='asset-view.php'>View Assets</a></td>\r\n\t\t\t</tr>\r\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\r\n\t\t</table>";
    return $OUT;
}
function enter($err = "")
{
    extract($_REQUEST);
    $fields = array();
    $fields["price"] = "0.00";
    $fields["cust_id"] = 0;
    $fields["vatcode"] = "2";
    $fields["vatinc"] = "inc";
    if (!isset($date_year)) {
        explodeDate(DATE_STD, $date_year, $date_month, $date_day);
    }
    extract($fields, EXTR_SKIP);
    db_connect();
    // Retrieve asset
    $sql = "SELECT * FROM cubit.assets WHERE id='{$asset_id}'";
    $asset_rslt = db_exec($sql) or errDie("Unable to retrieve asset.");
    $asset_data = pg_fetch_array($asset_rslt);
    // Retrieve asset group
    $sql = "SELECT * FROM cubit.assetgrp WHERE grpid='{$asset_data['grpid']}'";
    $asgrp_rslt = db_exec($sql) or errDie("Unable to retrieve asset group.");
    $asgrp_data = pg_fetch_array($asgrp_rslt);
    // Retrieve customer
    $sql = "SELECT * FROM cubit.customers ORDER BY surname ASC";
    $cust_rslt = db_exec($sql) or errDie("Unable to retrieve customers.");
    $cust_sel = "<select name='cust_id' style='width: 100%'>";
    $cust_sel .= "<option " . fsel($cust_id == "-1") . " value='-1'>Cash Sale</option>";
    //$cust_sel.= "<option ".fsel($cust_id == "-2")." value='-2'>Ledger Account Sale</option>";
    $cust_sel .= "<optgroup label='Customer Sale'>";
    while ($cust_data = pg_fetch_array($cust_rslt)) {
        $sel = fsel($cust_id == $cust_data["cusnum"]);
        $cust_sel .= "\r\n\t\t<option {$sel} value='{$cust_data['cusnum']}'>\r\n\t\t\t{$cust_data['cusname']} {$cust_data['surname']}\r\n\t\t</option>";
    }
    $cust_sel .= "</optgroup>";
    $cust_sel .= "</select>";
    $cds = qryVatcode();
    $sel_vatcode = db_mksel($cds, "vatcode", $vatcode, "#id", "#code");
    if ($asset_data["nonserial"] == "1") {
        if (!isset($qty)) {
            $qty = $asset_data["serial2"];
        }
        $qtyinput = "\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Sell Units</td>\r\n\t\t\t\t\t\t\t<td><input type='text' size='4' name='qty' value='{$qty}' /></td>\r\n\t\t\t\t\t\t</tr>";
    } else {
        $qtyinput = "<input type='hidden' name='qty' value='1' />";
    }
    $OUTPUT = "\r\n\t\t\t\t<center>\r\n\t\t\t\t<h3>Asset Sale</h3>\r\n\t\t\t\t{$err}\r\n\t\t\t\t<form method='POST' action='" . SELF . "'>\r\n\t\t\t\t\t<input type='hidden' name='key' value='confirm' />\r\n\t\t\t\t\t<input type='hidden' name='asset_id' value='{$asset_id}' />\r\n\t\t\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th colspan='2'>Details</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Group</td>\r\n\t\t\t\t\t\t<td>{$asgrp_data['grpname']}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Serial Number</td>\r\n\t\t\t\t\t\t<td>{$asset_data['serial']}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>2nd Serial Number/Qty</td>\r\n\t\t\t\t\t\t<td>{$asset_data['serial2']}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Description</td>\r\n\t\t\t\t\t\t<td>{$asset_data['des']}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Customer</td>\r\n\t\t\t\t\t\t<td>{$cust_sel}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Date</td>\r\n\t\t\t\t\t\t<td>" . mkDateSelect("date", $date_year, $date_month, $date_day) . "</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Vat</td>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t<input type='radio' name='vatinc' value='inc' " . fcheck($vatinc != "exc") . " /> Including\r\n\t\t\t\t\t\t\t<input type='radio' name='vatinc' value='exc' " . fcheck($vatinc == "exc") . " /> Excluding\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Vatcode</td>\r\n\t\t\t\t\t\t<td>{$sel_vatcode}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t{$qtyinput}\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Selling Price/Asset Unit</td>\r\n\t\t\t\t\t\t<td nowrap='t'>\r\n\t\t\t\t\t\t\t" . CUR . " <input type='text' size='10' name='price' value='{$price}'>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td colspan='2' align='right'>\r\n\t\t\t\t\t\t\t<input type='submit' value='Confirm &raquo' />\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</table>\r\n\t\t\t\t</form>\r\n\t\t\t\t</center>";
    return $OUTPUT;
}
	<a href="http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=YahooDemo&url=<?php 
    echo substr($URL, 0, -9);
    ?>
Sitemap.xml" target="yahoo">Yahoo</a>
</fieldset>
<br/>

<!-- Pannello gestione pagine e files -->
<fieldset>
<legend><b> <?php 
    echo _PERMESSI;
    ?>
</b></legend>
<br/>
<?php 
    if (fcheck("datas")) {
        echo "" . _CARTELLA_DATAS_SCRIVIBILE;
    } else {
        echo "" . _CARTELLA_DATAS_NON_SCRIVIBILE;
    }
    echo "<br/><br/>\n";
    echo "<table>";
    echo "<tr><td><b>" . _PAGE . "</b></td><td><b>" . _DATE . "</b><td><b>" . _SIZE . "</b></td><td><b>" . _VEDI . "</b></td><td><b>" . _ELIMINA . "</b></td><td><b>" . _STATO . "</b></td></tr>";
    $fd = opendir("datas/");
    while (false !== ($nf = readdir($fd))) {
        if ($nf != '.' && $nf != '..') {
            echo "<tr><td>{$nf}</td>";
            echo "<td><i>" . date("j/m/y h:i", filemtime("datas/{$nf}")) . "<i></td>\n";
            echo "<td><i>" . filesize("datas/{$nf}") . "<i></td>\n";
            echo "<td>[<a href='datas/{$nf}' target='new'>" . _VEDI . "</a>]</td>";
            echo "<td>[<a href='?op=deletepage&file={$nf}'  onclick=\"if (confirm('cancellare'))return true; else return false;\">" . _ELIMINA . "</a>]</td>";