$regex = '';
$regexmessage = '';
$regextype = '';
$control = array();
foreach ($editFields as $fName) {
    $gfName = GoodFieldName($fName);
    $controls = array('controls' => array());
    if (!$detailKeys || !in_array($fName, $detailKeys)) {
        $control[$gfName] = array();
        $control[$gfName]["func"] = "xt_buildeditcontrol";
        $control[$gfName]["params"] = array();
        $control[$gfName]["params"]["id"] = $id;
        $control[$gfName]["params"]["field"] = $fName;
        $control[$gfName]["params"]["value"] = @$data[$fName];
        //	Begin Add validation
        $arrValidate = getValidation($fName, $strTableName);
        $control[$gfName]["params"]["validate"] = $arrValidate;
        //	End Add validation
        $additionalCtrlParams = array();
        $additionalCtrlParams["disabled"] = !$enableCtrlsForEditing;
        $control[$gfName]["params"]["additionalCtrlParams"] = $additionalCtrlParams;
    }
    $controls["controls"]['ctrlInd'] = 0;
    $controls["controls"]['id'] = $id;
    $controls["controls"]['fieldName'] = $fName;
    if ($inlineedit == EDIT_INLINE) {
        if (!$detailKeys || !in_array($fName, $detailKeys)) {
            $control[$gfName]["params"]["mode"] = "inline_edit";
        }
        $controls["controls"]['mode'] = "inline_edit";
    } else {
Ejemplo n.º 2
0
function form()
{
    global $s, $inp, $par, $tab, $arrTitle, $fFile, $dFile, $arrParameter, $menuAccess;
    $sql = "select * from dta_supplier where kodeSupplier='{$par['kodeSupplier']}'";
    $res = db($sql);
    $r = mysql_fetch_array($res);
    if (empty($r[kodeTipe])) {
        $r[kodeTipe] = $par[kodeTipe];
    }
    $false = $r[statusSupplier] == "f" ? "checked=\"checked\"" : "";
    $true = empty($false) ? "checked=\"checked\"" : "";
    setValidation("is_null", "inp[nomorSupplier]", "you must fill no. akun");
    setValidation("is_null", "inp[namaSupplier]", "you must fill nama supplier");
    setValidation("is_null", "inp[alamatSupplier]", "you must fill alamat");
    $text = getValidation();
    $dAddress = " style=\"display: none;\"";
    $dProduct = " style=\"display: none;\"";
    $dIdentity = " style=\"display: none;\"";
    $dContact = " style=\"display: none;\"";
    $dBanking = " style=\"display: none;\"";
    $dNote = " style=\"display: none;\"";
    $dGeneral = " style=\"display: none;\"";
    if ($tab == 1) {
        $tAddress = "class=\"current\"";
        $dAddress = " style=\"display: block;\"";
    } else {
        if ($tab == 2) {
            $tProduct = "class=\"current\"";
            $dProduct = " style=\"display: block;\"";
        } else {
            if ($tab == 3) {
                $tIdentity = "class=\"current\"";
                $dIdentity = " style=\"display: block;\"";
            } else {
                if ($tab == 4) {
                    $tContact = "class=\"current\"";
                    $dContact = " style=\"display: block;\"";
                } else {
                    if ($tab == 5) {
                        $tBanking = "class=\"current\"";
                        $dBanking = " style=\"display: block;\"";
                    } else {
                        if ($tab == 6) {
                            $tNote = "class=\"current\"";
                            $dNote = " style=\"display: block;\"";
                        } else {
                            $tGeneral = "class=\"current\"";
                            $dGeneral = " style=\"display: block;\"";
                        }
                    }
                }
            }
        }
    }
    $mode = empty($r[nomorSupplier]) ? "add" : "edit";
    $text .= "\n\t\t<script>\n\t\t\tjQuery(document).ready(function(){ jQuery(\".togglemenu\").click(); });\n\t\t</script>\n\t\t<div class=\"pageheader\">\n\t\t\t<h1 class=\"pagetitle\">" . $arrTitle[$s] . "</h1>\n\t\t\t" . getBread(ucwords($mode . " data")) . "\n\t\t\t<ul class=\"hornav\">\n\t\t\t\t<li {$tGeneral}><a href=\"#general\">Umum</a></li>\n\t\t\t\t<li {$tAddress}><a href=\"#address\">Alamat</a></li>\n\t\t\t\t<li {$tProduct}><a href=\"#product\">Produk</a></li>\n\t\t\t\t<li {$tIdentity}><a href=\"#identity\">Identitas</a></li>\n\t\t\t\t<li {$tContact}><a href=\"#contact\">Kontak</a></li>\n\t\t\t\t<li {$tBanking}><a href=\"#banking\">Bank</a></li>\n\t\t\t\t<li {$tNote}><a href=\"#note\">Note</a></li>\n\t\t\t</ul>\n\t\t</div>\n\t\t<div id=\"contentwrapper\" class=\"contentwrapper\">\n\t\t\t<form id=\"form\" name=\"form\" method=\"post\" class=\"stdform\" action=\"?_submit=1" . getPar($par) . "\" onsubmit=\"return validation(document.form);\" enctype=\"multipart/form-data\">\n\t\t\t\t<div style=\"top:70px; right:35px; position:absolute\">\n\t\t\t\t\t<input type=\"submit\" class=\"submit radius2\" name=\"btnSave\" value=\"Save\" onclick=\"return chk('" . getPar($par, "mode") . "');\"/>\n\t\t\t\t\t<input type=\"button\" class=\"cancel radius2\" value=\"Cancel\" onclick=\"window.location='?" . getPar($par, "mode, kodeSupplier") . "';\"/>\n\t\t\t\t</div>";
    # TAB GENERAL
    $text .= "<div id=\"general\" class=\"subcontent\" {$dGeneral} >\t\t\t\t\t\n\t\t\t\t<p>\n\t\t\t\t\t<label class=\"l-input-small\">No Akun</label>\n\t\t\t\t\t<div class=\"fieldB\">\n\t\t\t\t\t\t<input type=\"text\" id=\"inp[nomorSupplier]\" name=\"inp[nomorSupplier]\"  value=\"{$r['nomorSupplier']}\" class=\"mediuminput\" style=\"width:150px;\" maxlength=\"30\"/>\n\t\t\t\t\t</div>\n\t\t\t\t</p>\n\t\t\t\t<p>\n\t\t\t\t\t<label class=\"l-input-small\">Nama Supplier</label>\n\t\t\t\t\t<div class=\"fieldB\">\n\t\t\t\t\t\t<input type=\"text\" id=\"inp[namaSupplier]\" name=\"inp[namaSupplier]\"  value=\"{$r['namaSupplier']}\" class=\"mediuminput\" style=\"width:400px;\" maxlength=\"150\"/>\n\t\t\t\t\t</div>\n\t\t\t\t</p>\n\t\t\t\t<p>\n\t\t\t\t\t<label class=\"l-input-small\">Alias</label>\n\t\t\t\t\t<div class=\"fieldB\">\n\t\t\t\t\t\t<input type=\"text\" id=\"inp[aliasSupplier]\" name=\"inp[aliasSupplier]\"  value=\"{$r['aliasSupplier']}\" class=\"mediuminput\" style=\"width:250px;\" maxlength=\"150\"/>\n\t\t\t\t\t</div>\n\t\t\t\t</p>\n\t\t\t\t<p>\n\t\t\t\t\t<label class=\"l-input-small\">Logo</label>\n\t\t\t\t\t<div class=\"fieldB\">";
    $text .= empty($r[logoSupplier]) ? "<input type=\"text\" id=\"fileTemp\" name=\"fileTemp\" class=\"input\" style=\"width:250px;\" maxlength=\"100\" />\n\t\t\t\t\t\t<div class=\"fakeupload\" style=\"width:300px;\">\n\t\t\t\t\t\t\t<input type=\"file\" id=\"logoSupplier\" name=\"logoSupplier\" class=\"realupload\" size=\"50\" onchange=\"this.form.fileTemp.value = this.value;\" />\n\t\t\t\t\t\t</div>" : "<img src=\"" . $fFile . "/" . $r[logoSupplier] . "\" align=\"left\" style=\"padding-right:5px; padding-bottom:5px; max-width:50px; max-height:50px;\">\n\t\t\t\t\t\t<input type=\"file\" id=\"logoSupplier\" name=\"logoSupplier\" style=\"display:none;\" />\n\t\t\t\t\t\t<a href=\"?par[mode]=delLogo" . getPar($par, "mode") . "\" onclick=\"return confirm('are you sure to delete this logo?')\" class=\"action delete\"><span>Delete</span></a>\n\t\t\t\t\t\t<br clear=\"all\">";
    $text .= "</div>\n\t\t\t\t\t</p>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t<label class=\"l-input-small\">Alamat</label>\n\t\t\t\t\t\t<div class=\"fieldB\">\n\t\t\t\t\t\t\t<textarea id=\"inp[alamatSupplier]\" name=\"inp[alamatSupplier]\" rows=\"3\" cols=\"50\" class=\"longinput\" style=\"height:50px; width:400px;\">{$r['alamatSupplier']}</textarea>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</p>\n\t\t\t\t\t<table style=\"width:100%\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td style=\"width:50%\">\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t<label class=\"l-input-small2\">Propinsi</label>\n\t\t\t\t\t\t\t\t\t<div class=\"fieldA\">\n\t\t\t\t\t\t\t\t\t\t" . comboData("select * from mst_data where statusData='t' and kodeCategory='" . $arrParameter[15] . "' order by namaData", "kodeData", "namaData", "inp[kodePropinsi]", " ", $r[kodePropinsi], "onchange=\"getKota('" . getPar($par, "mode,kodePropinsi") . "');\"", "260px") . "\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</p>\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t<label class=\"l-input-small2\">Telepon</label>\n\t\t\t\t\t\t\t\t\t<div class=\"fieldA\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"text\" id=\"inp[teleponSupplier]\" name=\"inp[teleponSupplier]\"  value=\"{$r['teleponSupplier']}\" class=\"mediuminput\"  maxlength=\"50\" onkeyup=\"cekPhone(this);\"/>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t<label class=\"l-input-small2\">Email</label>\n\t\t\t\t\t\t\t\t\t<div class=\"fieldA\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"text\" id=\"inp[emailSupplier]\" name=\"inp[emailSupplier]\"  value=\"{$r['emailSupplier']}\" class=\"mediuminput\"  maxlength=\"50\"/>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t<label class=\"l-input-small2\">Status</label>\n\t\t\t\t\t\t\t\t\t<div class=\"fieldA\" style='width:100%;'>\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t<input type=\"radio\" id=\"true\" name=\"inp[statusSupplier]\" value=\"t\" {$true} /> <span class=\"sradio\">Active</span>\n\t\t\t\t\t\t\t\t\t\t<input type=\"radio\" id=\"false\" name=\"inp[statusSupplier]\" value=\"f\" {$false} /> <span class=\"sradio\">Not Active</span>\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td style=\"width:50%\">\n\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t<label class=\"l-input-small3\">Kota</label>\n\t\t\t\t\t\t\t\t\t<div class=\"fieldC\">\n\t\t\t\t\t\t\t\t\t\t" . comboData("select * from mst_data where statusData='t' and kodeCategory='" . $arrParameter[16] . "' and kodeInduk='{$r['kodePropinsi']}' order by namaData", "kodeData", "namaData", "inp[kodeKota]", " ", $r[kodeKota], "", "260px") . "\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t<label class=\"l-input-small3\">Fax</label>\n\t\t\t\t\t\t\t\t\t<div class=\"fieldC\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"text\" id=\"inp[faxSupplier]\" name=\"inp[faxSupplier]\"  value=\"{$r['faxSupplier']}\" class=\"mediuminput\"  maxlength=\"50\" onkeyup=\"cekPhone(this);\"/>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</p>\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t<label class=\"l-input-small3\">Website</label>\n\t\t\t\t\t\t\t\t\t<div class=\"fieldC\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"text\" id=\"inp[webSupplier]\" name=\"inp[webSupplier]\" value=\"{$r['webSupplier']}\" class=\"mediuminput\"  maxlength=\"50\"/>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</p>\t\t\t\t\t\t\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t</div>";
    # TAB ADDRESS
    $text .= "<div id=\"address\" class=\"subcontent\" {$dAddress} >";
    if (isset($menuAccess[$s]["add"])) {
        $text .= "<a href=\"#Add\" class=\"btn btn1 btn_document\" onclick=\"update('" . getPar($par, "mode") . "'); openBox('popup.php?par[mode]=addAddress" . getPar($par, "mode,kodeAddress") . "',825,550);\" style=\"float:right; margin-bottom:10px;\"><span>Add Alamat</span></a>";
    }
    $text .= "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"stdtable stdtablequick\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th width=\"20\">No.</th>\n\t\t\t\t\t\t<th width=\"200\">Kategori</th>\t\n\t\t\t\t\t\t<th>Alamat</th>\n\t\t\t\t\t\t<th width=\"200\">Kota</th>\t\n\t\t\t\t\t\t<th width=\"150\">Telepon</th>";
    if (isset($menuAccess[$s]["edit"]) || isset($menuAccess[$s]["delete"])) {
        $text .= "<th width=\"50\">Kontrol</th>";
    }
    $text .= "</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tbody>";
    $sql = "select * from dta_supplier_address t1 join mst_data t2 on (t1.kodeKota=t2.kodeData) where t1.kodeSupplier='{$par['kodeSupplier']}' order by t1.kodeAddress";
    $res = db($sql);
    $no = 1;
    while ($r = mysql_fetch_array($res)) {
        $text .= "<tr>\n\t\t\t\t\t\t\t<td>{$no}.</td>\n\t\t\t\t\t\t\t<td>{$r['kategoriAddress']}</td>\n\t\t\t\t\t\t\t<td>{$r['alamatAddress']}</td>\n\t\t\t\t\t\t\t<td>{$r['namaData']}</td>\n\t\t\t\t\t\t\t<td>{$r['teleponAddress']}</td>";
        if (isset($menuAccess[$s]["edit"]) || isset($menuAccess[$s]["delete"])) {
            $text .= "<td align=\"center\">";
            if (isset($menuAccess[$s]["edit"])) {
                $text .= "<a href=\"#Edit\" title=\"Edit Data\" class=\"edit\"  onclick=\"update('" . getPar($par, "mode") . "'); openBox('popup.php?par[mode]=editAddress&par[kodeAddress]={$r['kodeAddress']}" . getPar($par, "mode,kodeAddress") . "',825,550);\"><span>Edit</span></a>";
            }
            if (isset($menuAccess[$s]["delete"])) {
                $text .= "<a href=\"?par[mode]=delAddress&par[kodeAddress]={$r['kodeAddress']}" . getPar($par, "mode,kodeAddress") . "\" onclick=\"update('" . getPar($par, "mode") . "'); return confirm('anda yakin akan menghapus data ini ?');\" title=\"Delete Data\" class=\"delete\"><span>Delete</span></a>";
            }
            $text .= "</td>";
        }
        $text .= "</tr>";
        $no++;
    }
    if ($no == 1) {
        $text .= "<tr>\n\t\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t\t<td>&nbsp;</td>";
        if (isset($menuAccess[$s]["edit"]) || isset($menuAccess[$s]["delete"])) {
            $text .= "<td>&nbsp;</td>";
        }
        $text .= "</tr>";
    }
    $text .= "</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t</div>";
    # TAB PRODUCT
    $text .= "\n\t\t\t\t<div id=\"product\" class=\"subcontent\" {$dProduct} >";
    if (isset($menuAccess[$s]["add"])) {
        $text .= "\n\t\t\t\t\t<input type=\"button\" class=\"add\" id=\"btnAddProduct\" value=\"Tambah Produk\" style=\"float:right; margin-top: -20px;\"/>";
    }
    $text .= "\n\t\t\t\t\t<br class=\"all\">\n\t\t\t\t\t<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"stdtable stdtablequick\" id=\"dtProduct\">\n\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<th style=\"width: 20px;\">NO</th>\n\t\t\t\t\t\t\t\t<th style=\"width: 50px;\">TIPE</th>\n\t\t\t\t\t\t\t\t<th>PRODUK</th>\n\t\t\t\t\t\t\t\t<th>KETERANGAN</th>\n\t\t\t\t\t\t\t\t<th>FILE</th>\n\t\t\t\t\t\t\t\t<th style=\"width: 50px;\">Harga</th>\n\t\t\t\t\t\t\t\t<th style=\"width: 80px;\">KONTROL</th>\n\t\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t\t<tbody>";
    $sql = "select t1.*, t3.namaProduk, t2.namaKategori, t2.tipeKategori from dta_supplier_produk t1 join dta_produk_kategori t2 on (t1.kodeProduk=t2.kodeProduk and t1.kodeKategori=t2.kodeKategori) JOIN dta_produk t3 ON t3.kodeProduk = t2.kodeProduk where t1.kodeSupplier='{$par['kodeSupplier']}' order by t1.kodeProduk, t1.kodeKategori";
    $res = db($sql);
    $kodeProdukS = -99;
    $namaProdukS = "";
    $subTotalS = 0;
    $no = 1;
    $ctd = 1;
    $totalProdukQty = 0;
    $totalProduk = 0;
    $totalHppProduk = 0;
    while ($r = mysql_fetch_array($res)) {
        if ($kodeProdukS != $r[kodeProduk]) {
            $kodeProdukS = $r[kodeProduk];
            $namaProdukS = $r[namaProduk];
            $no = 1;
            $subTotalS = 0;
            //HEADER
            $text .= "<tr class='trProdukHeader'><td colspan='7' style='font-weight:bolder'>" . $namaProdukS . "</td></tr>";
        }
        $tmplRow = "<tr id='trProduct_" . $ctd . "'>";
        $tmplRow .= "<input type='hidden' id='dtlProdukArray_" . $ctd . "' value='" . $r[kodeProduk] . "~" . $ctd . "~" . $r[namaProduk] . "~" . $r[namaKategori] . "' />";
        $tmplRow .= "<input type='hidden' id='dtlProdukId_" . $ctd . "' name='dtlProdukId[]' value='" . $ctd . "'  />";
        $tmplRow .= "<input type='hidden' id='dtlProdukKodeProduk_" . $ctd . "' name='dtlProdukKode[]' value='" . $r[kodeProduk] . "'  />";
        $tmplRow .= "<input type='hidden' id='dtlProdukKodeKategori_" . $ctd . "' name='dtlProdukKategori[]' value='" . $r[kodeKategori] . "'  />";
        $tmplRow .= "<input type='hidden' id='dtlProdukTipeKategori_" . $ctd . "' name='dtlProdukTipeKategori[]' value='" . $r[tipeKategori] . "'  />";
        $tmplRow .= "<input type='hidden' class='mnumdp' id='dtlProdukHargaDasar_" . $ctd . "' name='dtlProdukHargaDasar[]' value='" . $r[dasarDetail] . "'  />";
        //                $tmplRow .= "<input type='hidden' class='mnumdp' id='dtlProdukDepresiasi_" . $ctd . "' name='dtlProdukDepresiasi[]' value='$r[depresiasiDetail]'  />";
        $tmplRow .= "<input type='hidden' id='dtlProdukNamaProduk_" . $ctd . "' name='dtlProdukNamaProduk[]' value='" . $r[namaProduk] . "'  />";
        $tmplRow .= "<td style='width: 20px;'>" . $no . "</td>";
        $tmplRow .= "<td>" . $r[tipeKategori] . "</td>";
        $tmplRow .= "<td>" . $r[namaKategori] . "</td>";
        $tmplRow .= "<td style='width: 200px;'><input type='text' style='width:200px;' id='dtlProdukKtr_" . $ctd . "' name='dtlProdukKtr[]' value='{$r['keteranganProduk']}'/></td>";
        if (empty($r[fileProduk])) {
            $tmplRow .= "\n\t\t\t\t\t\t\t\t\t\t<td style='width: 200px;'>\n\t\t\t\t\t\t\t\t\t\t\t<input type=\"text\" id=\"fileTemp_" . $ctd . "\" name=\"fileTemp_" . $ctd . "\" class=\"input\" style=\"width:150px;\" maxlength=\"100\" />\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"fakeupload\" style=\"width: 195px\">\n\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"file\" id=\"dtlProdukFile_" . $ctd . "\" name=\"dtlProdukFile_" . $ctd . "\" class=\"realupload\" style=\"width: 200px\" size=\"50\" onchange=\"this.form.fileTemp_" . $ctd . ".value = this.value;\" multiple=\"multiple\" />\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t</td>";
        } else {
            $tmplRow .= "\n\t\t\t\t\t\t\t\t\t\t<td style='width: 200px; vertical-align: middle' align=\"center\">\n\t\t\t\t\t\t\t\t\t\t\t<a href=\"download.php?d=supp&f=" . $r[kodeSupplier] . "." . $r[kodeProduk] . "." . $r[kodeKategori] . "\" title=\"Download File\"><img src=\"" . getIcon($r[fileProduk]) . "\"></a>\n\t\t\t\t\t\t\t\t\t\t</td>";
        }
        $tmplRow .= "<td style='width: 90px;'><input type='text' class='mnumdp' style='text-align:right;width:90px;' id='dtlProdukHrg_" . $ctd . "' name='dtlProdukHrg[]' value='" . getAngka($r[hargaProduk], 2) . "'/></td>";
        $tmplRow .= "<td style='width: 60px;text-align:center;'>";
        $tmplRow .= "<a class='delete delRow' href='#deProduk' title='Hapus Data' onclick=\"if(confirm('Are you sure to delete this data ?')) { jQuery(this).parent().parent().remove(); }\"><span>Remove</span></a>";
        $tmplRow .= "</td>";
        $tmplRow .= "</tr>";
        $text .= $tmplRow;
        $ctd++;
        $no++;
        $subTotalS += $r[qtyProduk];
        $totalProdukQty += $r[qtyProduk];
    }
    $text .= "\n\t\t\t\t\t\t\t</tbody>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t<input type=\"hidden\" id=\"getPar\" value=\"" . getPar($par, "mode,kodeSupplier") . "\">\n\t\t\t\t\t</div>";
    # TAB IDENTITY
    $sql = "select * from dta_supplier_identity where kodeSupplier='{$par['kodeSupplier']}'";
    $res = db($sql);
    $r = mysql_fetch_array($res);
    $text .= "<div id=\"identity\" class=\"subcontent\" {$dIdentity} >\n\t\t\t\t\t<table width=\"100%\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width=\"50%\" nowrap=\"nowrap\" style=\"vertical-align:top\">\n\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t<label class=\"l-input-small\">SIUP</label>\n\t\t\t\t\t\t\t\t\t<div class=\"field\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"text\" id=\"inp[siupIdentity]\" name=\"inp[siupIdentity]\"  value=\"{$r['siupIdentity']}\" class=\"mediuminput\" style=\"width:250px;\" maxlength=\"50\"/>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t<label class=\"l-input-small\">TDP</label>\n\t\t\t\t\t\t\t\t\t<div class=\"field\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"text\" id=\"inp[tdpIdentity]\" name=\"inp[tdpIdentity]\"  value=\"{$r['tdpIdentity']}\" class=\"mediuminput\" style=\"width:250px;\" maxlength=\"50\"/>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t<label class=\"l-input-small\">ID</label>\n\t\t\t\t\t\t\t\t\t<div class=\"field\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"text\" id=\"inp[idIdentity]\" name=\"inp[idIdentity]\"  value=\"{$r['idIdentity']}\" class=\"mediuminput\" style=\"width:250px;\" maxlength=\"50\"/>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t<label class=\"l-input-small\">NPWP</label>\n\t\t\t\t\t\t\t\t\t<div class=\"field\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"text\" id=\"inp[npwpIdentity]\" name=\"inp[npwpIdentity]\"  value=\"{$r['npwpIdentity']}\" class=\"mediuminput\" style=\"width:250px;\" maxlength=\"50\"/>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t<label class=\"l-input-small\">Alamat</label>\n\t\t\t\t\t\t\t\t\t<div class=\"field\">\n\t\t\t\t\t\t\t\t\t\t<textarea id=\"inp[alamatIdentity]\" name=\"inp[alamatIdentity]\" rows=\"3\" cols=\"50\" class=\"longinput\" style=\"height:50px; width:400px;\">{$r['alamatIdentity']}</textarea>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td width=\"50%\" nowrap=\"nowrap\" style=\"vertical-align:top\">\n\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t<label class=\"l-input-small\">File</label>\n\t\t\t\t\t\t\t\t\t<div class=\"fieldB\">";
    $text .= empty($r[siupIdentity_file]) ? "<input type=\"text\" id=\"fileTemp_siup\" name=\"fileTemp_siup\" class=\"input\" style=\"width:235px;\" maxlength=\"100\" />\n\t\t\t\t\t\t\t\t\t\t<div class=\"fakeupload\" style=\"width:300px;\">\n\t\t\t\t\t\t\t\t\t\t\t<input type=\"file\" id=\"siupIdentity_file\" name=\"siupIdentity_file\" class=\"realupload\" size=\"50\" onchange=\"this.form.fileTemp_siup.value = this.value;\" />\n\t\t\t\t\t\t\t\t\t\t</div>" : "<a href=\"download.php?d=sup&f=siup.{$r['kodeSupplier']}\"><img src=\"" . getIcon($dFile . "/" . $r[siupIdentity_file]) . "\" align=\"left\" style=\"padding-right:5px; padding-bottom:5px; max-width:50px; max-height:50px;\"></a>\n\t\t\t\t\t\t\t\t\t\t<input type=\"file\" id=\"siupIdentity_file\" name=\"siupIdentity_file\" style=\"display:none;\" />\n\t\t\t\t\t\t\t\t\t\t<a href=\"?par[mode]=delSiup" . getPar($par, "mode") . "\" onclick=\"return confirm('are you sure to delete this file?')\" class=\"action delete\"><span>Delete</span></a>\n\t\t\t\t\t\t\t\t\t\t<br clear=\"all\">";
    $text .= "</div>\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t\t<label class=\"l-input-small\">File</label>\n\t\t\t\t\t\t\t\t\t\t<div class=\"fieldB\">";
    $text .= empty($r[tdpIdentity_file]) ? "<input type=\"text\" id=\"fileTemp_tdp\" name=\"fileTemp_tdp\" class=\"input\" style=\"width:235px;\" maxlength=\"100\" />\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"fakeupload\" style=\"width:300px;\">\n\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"file\" id=\"tdpIdentity_file\" name=\"tdpIdentity_file\" class=\"realupload\" size=\"50\" onchange=\"this.form.fileTemp_tdp.value = this.value;\" />\n\t\t\t\t\t\t\t\t\t\t\t</div>" : "<a href=\"download.php?d=sup&f=tdp.{$r['kodeSupplier']}\"><img src=\"" . getIcon($dFile . "/" . $r[tdpIdentity_file]) . "\" align=\"left\" style=\"padding-right:5px; padding-bottom:5px; max-width:50px; max-height:50px;\"></a>\n\t\t\t\t\t\t\t\t\t\t\t<input type=\"file\" id=\"tdpIdentity_file\" name=\"tdpIdentity_file\" style=\"display:none;\" />\n\t\t\t\t\t\t\t\t\t\t\t<a href=\"?par[mode]=delTdp" . getPar($par, "mode") . "\" onclick=\"return confirm('are you sure to delete this file?')\" class=\"action delete\"><span>Delete</span></a>\n\t\t\t\t\t\t\t\t\t\t\t<br clear=\"all\">";
    $text .= "</div>\n\t\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t\t\t<label class=\"l-input-small\">File</label>\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"fieldB\">";
    $text .= empty($r[idIdentity_file]) ? "<input type=\"text\" id=\"fileTemp_id\" name=\"fileTemp_id\" class=\"input\" style=\"width:235px;\" maxlength=\"100\" />\n\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"fakeupload\" style=\"width:300px;\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"file\" id=\"idIdentity_file\" name=\"idIdentity_file\" class=\"realupload\" size=\"50\" onchange=\"this.form.fileTemp_id.value = this.value;\" />\n\t\t\t\t\t\t\t\t\t\t\t\t</div>" : "<a href=\"download.php?d=sup&f=id.{$r['kodeSupplier']}\"><img src=\"" . getIcon($dFile . "/" . $r[idIdentity_file]) . "\" align=\"left\" style=\"padding-right:5px; padding-bottom:5px; max-width:50px; max-height:50px;\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"file\" id=\"idIdentity_file\" name=\"idIdentity_file\" style=\"display:none;\" />\n\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"?par[mode]=delId" . getPar($par, "mode") . "\" onclick=\"return confirm('are you sure to delete this file?')\" class=\"action delete\"><span>Delete</span></a>\n\t\t\t\t\t\t\t\t\t\t\t\t<br clear=\"all\">";
    $text .= "</div>\n\t\t\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t\t\t\t<label class=\"l-input-small\">File</label>\n\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"fieldB\">";
    $text .= empty($r[npwpIdentity_file]) ? "<input type=\"text\" id=\"fileTemp_npwp\" name=\"fileTemp_npwp\" class=\"input\" style=\"width:235px;\" maxlength=\"100\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"fakeupload\" style=\"width:300px;\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"file\" id=\"npwpIdentity_file\" name=\"npwpIdentity_file\" class=\"realupload\" size=\"50\" onchange=\"this.form.fileTemp_npwp.value = this.value;\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>" : "<a href=\"download.php?d=sup&f=npwp.{$r['kodeSupplier']}\"><img src=\"" . getIcon($dFile . "/" . $r[npwpIdentity_file]) . "\" align=\"left\" style=\"padding-right:5px; padding-bottom:5px; max-width:50px; max-height:50px;\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"file\" id=\"npwpIdentity_file\" name=\"npwpIdentity_file\" style=\"display:none;\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"?par[mode]=delNpwp" . getPar($par, "mode") . "\" onclick=\"return confirm('are you sure to delete this file?')\" class=\"action delete\"><span>Delete</span></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<br clear=\"all\">";
    $text .= "</div>\n\t\t\t\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t\t</div>";
    # TAB CONTACT
    $text .= "<div id=\"contact\" class=\"subcontent\" {$dContact} >";
    if (isset($menuAccess[$s]["add"])) {
        $text .= "<a href=\"#Add\" class=\"btn btn1 btn_document\" onclick=\"update('" . getPar($par, "mode") . "'); openBox('popup.php?par[mode]=addContact" . getPar($par, "mode,kodeCatatan") . "',725,500);\" style=\"float:right; margin-bottom:10px;\"><span>Add Kontak</span></a>";
    }
    $text .= "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"stdtable stdtablequick\">\n\t\t\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<th width=\"20\">No.</th>\n\t\t\t\t\t\t\t\t\t\t<th style=\"min-width:175px;\">Jabatan</th>\n\t\t\t\t\t\t\t\t\t\t<th style=\"min-width:175px;\">Nama</th>\n\t\t\t\t\t\t\t\t\t\t<th width=\"150\">Email</th>\n\t\t\t\t\t\t\t\t\t\t<th width=\"100\">Handphone</th>\n\t\t\t\t\t\t\t\t\t\t<th width=\"100\">Tlp. Kantor</th>";
    if (isset($menuAccess[$s]["edit"]) || isset($menuAccess[$s]["delete"])) {
        $text .= "<th width=\"50\">Kontrol</th>";
    }
    $text .= "</tr>\n\t\t\t\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t\t\t\t<tbody>";
    $sql = "select * from dta_supplier_contact where kodeSupplier='{$par['kodeSupplier']}' order by kodeContact";
    $res = db($sql);
    $no = 1;
    while ($r = mysql_fetch_array($res)) {
        $text .= "<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>{$no}.</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>{$r['jabatanContact']}</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>{$r['namaContact']}</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>{$r['emailContact']}</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>{$r['teleponContact']}</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>{$r['kantorContact']}</td>";
        if (isset($menuAccess[$s]["edit"]) || isset($menuAccess[$s]["delete"])) {
            $text .= "<td align=\"center\">";
            if (isset($menuAccess[$s]["edit"])) {
                $text .= "<a href=\"#Edit\" title=\"Edit Data\" class=\"edit\" onclick=\"update('" . getPar($par, "mode") . "'); openBox('popup.php?par[mode]=editContact&par[kodeContact]={$r['kodeContact']}" . getPar($par, "mode,kodeContact") . "',725,500);\"><span>Edit</span></a>";
            }
            if (isset($menuAccess[$s]["delete"])) {
                $text .= "<a href=\"?par[mode]=delContact&par[kodeContact]={$r['kodeContact']}" . getPar($par, "mode,kodeContact") . "\" onclick=\"update('" . getPar($par, "mode") . "'); return confirm('anda yakin akan menghapus data ini ?');\" title=\"Delete Data\" class=\"delete\"><span>Delete</span></a>";
            }
            $text .= "</td>";
        }
        $text .= "</tr>";
        $no++;
    }
    if ($no == 1) {
        $text .= "<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>&nbsp;</td>\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>&nbsp;</td>\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>&nbsp;</td>";
        if (isset($menuAccess[$s]["edit"]) || isset($menuAccess[$s]["delete"])) {
            $text .= "<td>&nbsp;</td>";
        }
        $text .= "</tr>";
    }
    $text .= "</tbody>\n\t\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t\t</div>";
    # TAB BANKING
    $text .= "<div id=\"banking\" class=\"subcontent\" {$dBanking} >";
    if (isset($menuAccess[$s]["add"])) {
        $text .= "<a href=\"#Add\" class=\"btn btn1 btn_document\" onclick=\"update('" . getPar($par, "mode") . "'); openBox('popup.php?par[mode]=addBank" . getPar($par, "mode,kodeBank") . "',725,300);\" style=\"float:right; margin-bottom:10px;\"><span>Add Bank</span></a>";
    }
    $text .= "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"stdtable stdtablequick\">\n\t\t\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<th width=\"20\">No.</th>\n\t\t\t\t\t\t\t\t\t\t<th>Nama Bank</th>\n\t\t\t\t\t\t\t\t\t\t<th width=\"150\">No Akun</th>\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t<th>Nama Akun</th>";
    if (isset($menuAccess[$s]["edit"]) || isset($menuAccess[$s]["delete"])) {
        $text .= "<th width=\"50\">Kontrol</th>";
    }
    $text .= "</tr>\n\t\t\t\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t\t\t\t<tbody>";
    $sql = "select * from dta_supplier_bank where kodeSupplier='{$par['kodeSupplier']}' order by kodeBank";
    $res = db($sql);
    $no = 1;
    while ($r = mysql_fetch_array($res)) {
        $text .= "<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>{$no}.</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>{$r['namaBank']}</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>{$r['rekeningBank']}</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>{$r['pemilikBank']}</td>";
        if (isset($menuAccess[$s]["edit"]) || isset($menuAccess[$s]["delete"])) {
            $text .= "<td align=\"center\">";
            if (isset($menuAccess[$s]["edit"])) {
                $text .= "<a href=\"#Edit\" title=\"Edit Data\" class=\"edit\"  onclick=\"update('" . getPar($par, "mode") . "'); openBox('popup.php?par[mode]=editBank&par[kodeBank]={$r['kodeBank']}" . getPar($par, "mode,kodeBank") . "',725,300);\"><span>Edit</span></a>";
            }
            if (isset($menuAccess[$s]["delete"])) {
                $text .= "<a href=\"?par[mode]=delBank&par[kodeBank]={$r['kodeBank']}" . getPar($par, "mode,kodeBank") . "\" onclick=\"update('" . getPar($par, "mode") . "'); return confirm('anda yakin akan menghapus data ini ?');\" title=\"Delete Data\" class=\"delete\"><span>Delete</span></a>";
            }
            $text .= "</td>";
        }
        $text .= "</tr>";
        $no++;
    }
    if ($no == 1) {
        $text .= "<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>&nbsp;</td>";
        if (isset($menuAccess[$s]["edit"]) || isset($menuAccess[$s]["delete"])) {
            $text .= "<td>&nbsp;</td>";
        }
        $text .= "</tr>";
    }
    $text .= "</tbody>\n\t\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t\t</div>";
    # TAB NOTE
    $text .= "<div id=\"note\" class=\"subcontent\" {$dNote} >";
    if (isset($menuAccess[$s]["add"])) {
        $text .= "<a href=\"#Add\" class=\"btn btn1 btn_document\" onclick=\"update('" . getPar($par, "mode") . "'); openBox('popup.php?par[mode]=addNote" . getPar($par, "mode,kodeNote") . "',725,300);\" style=\"float:right; margin-bottom:10px;\"><span>Add Note</span></a>";
    }
    $text .= "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"stdtable stdtablequick\">\n\t\t\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<th width=\"20\">No.</th>\n\t\t\t\t\t\t\t\t\t\t<th>Kategori</th>\n\t\t\t\t\t\t\t\t\t\t<th>Catatan</th>";
    if (isset($menuAccess[$s]["edit"]) || isset($menuAccess[$s]["delete"])) {
        $text .= "<th width=\"50\">Kontrol</th>";
    }
    $text .= "</tr>\n\t\t\t\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t\t\t\t<tbody>";
    $sql = "select * from dta_supplier_note where kodeSupplier='{$par['kodeSupplier']}' order by kodeNote";
    $res = db($sql);
    $no = 1;
    while ($r = mysql_fetch_array($res)) {
        $text .= "<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>{$no}.</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>{$r['namaNote']}</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>" . nl2br($r[keteranganNote]) . "</td>";
        if (isset($menuAccess[$s]["edit"]) || isset($menuAccess[$s]["delete"])) {
            $text .= "<td align=\"center\">";
            if (isset($menuAccess[$s]["edit"])) {
                $text .= "<a href=\"#Edit\" title=\"Edit Data\" class=\"edit\"  onclick=\"update('" . getPar($par, "mode") . "'); openBox('popup.php?par[mode]=editNote&par[kodeNote]={$r['kodeNote']}" . getPar($par, "mode,kodeNote") . "',725,300);\"><span>Edit</span></a>";
            }
            if (isset($menuAccess[$s]["delete"])) {
                $text .= "<a href=\"?par[mode]=delNote&par[kodeNote]={$r['kodeNote']}" . getPar($par, "mode,kodeNote") . "\" onclick=\"update('" . getPar($par, "mode") . "'); return confirm('anda yakin akan menghapus data ini ?');\" title=\"Delete Data\" class=\"delete\"><span>Delete</span></a>";
            }
            $text .= "</td>";
        }
        $text .= "</tr>";
        $no++;
    }
    if ($no == 1) {
        $text .= "<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>&nbsp;</td>\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>&nbsp;</td>";
        if (isset($menuAccess[$s]["edit"]) || isset($menuAccess[$s]["delete"])) {
            $text .= "<td>&nbsp;</td>";
        }
        $text .= "</tr>";
    }
    $text .= "</tbody>\n\t\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t\t</div>\t\t\n\t\t\t\t\t\t\t</form>";
    return $text;
}