break; //根据小区获取所有业务 //根据小区获取所有业务 case "getBusinessByDesigner": $res = getBusinessByDesigner($_REQUEST); break; //新增业务 //新增业务 case "addBusiness": $res = addBusiness($_REQUEST); break; case "getBusinessById": $res = getBusinessById($_REQUEST['businessId']); break; case "getBusiness": $res = getBusiness($_REQUEST); break; case "getBusinessListForBudget": $res = getBusinessListForBudget(); break; //修改业务 //修改业务 case "editBusiness": $res = editBusiness($_REQUEST); break; //删除业务 //删除业务 case "deleteBusiness": $res = deleteBusiness($_REQUEST["id"]); break; //获取业务详细信息
function vartpl(&$t, $daten, $typ, $msg, $btn1, $btn2, $tpl, $suchmaske = false, $ui = false) { $jscal = "<style type='text/css'>@import url(../js/jscalendar/calendar-win2k-1.css);</style>\n"; $jscal .= "<script type='text/javascript' src='../js/jscalendar/calendar.js'></script>\n"; $jscal .= "<script type='text/javascript' src='../js/jscalendar/lang/calendar-de.js'></script>\n"; $jscal .= "<script type='text/javascript' src='../js/jscalendar/calendar-setup.js'></script>\n"; if (isset($daten["grafik"])) { if ($typ == "C") { $DIR = "C" . $daten["customernumber"]; } else { $DIR = "V" . $daten["vendornumber"]; } if (file_exists("dokumente/" . $_SESSION["dbname"] . "/{$DIR}/logo." . $daten["grafik"])) { $Image = "<img src='dokumente/" . $_SESSION["dbname"] . "/{$DIR}/logo." . $daten["grafik"] . "' " . $daten["icon"] . ">"; } else { $Image = "Bild ({$DIR}/logo." . $daten["grafik"] . ") nicht<br>im Verzeichnis"; } } else { $Image = ''; } $tmp = false; if (!$suchmaske) { $tmp = getVariablen($daten["id"]); } $varablen = $tmp > 0 ? count($tmp) . " Variablen" : ""; if ($ui) { $t->set_file(array("fa1" => "companies" . $tpl . ".tpl")); } else { $t->set_file(array("fa1" => "firmen" . $tpl . ".tpl")); } if (isset($daten["employee"]) and $daten['employee'] > 0) { $employee = $daten["employee"]; } else { if (isset($daten["modemployee"])) { $employee = "ERP " . $daten["modemployee"]; } else { $employee = ''; } } $t->set_var(array('FAART' => $typ == "C" ? ".:Customer:." : ".:Vendor:.", 'FAART2' => $typ == "C" ? ".:Customer Name:." : ".:Vendor Name:.", 'mtime' => isset($daten["mtime"]) ? $daten['mtime'] : '', 'Q' => $typ, 'Btn1' => $btn1, 'Btn2' => $btn2, 'Msg' => $msg, 'preon' => isset($daten["pre"]) ? "checked" : '', 'action' => $ui ? "" : "firmen" . $tpl . ".php?Q={$typ}", 'id' => isset($daten["id"]) ? $daten['id'] : '', 'customernumber' => isset($daten["customernumber"]) ? $daten["customernumber"] : '', 'vendornumber' => isset($daten["vendornumber"]) ? $daten["vendornumber"] : '', 'kdnr' => isset($daten["nummer"]) ? $daten["nummer"] : '', 'v_customer_id' => isset($daten["v_customer_id"]) ? $daten["v_customer_id"] : '', 'name' => isset($daten["name"]) ? $daten["name"] : '', 'greeting_' => isset($daten["greeting_"]) ? $daten["greeting_"] : '', 'department_1' => isset($daten["department_1"]) ? $daten["department_1"] : '', 'department_2' => isset($daten["department_2"]) ? $daten["department_2"] : '', 'street' => isset($daten["street"]) ? $daten["street"] : '', 'country' => isset($daten["country"]) ? $daten["country"] : '', 'zipcode' => isset($daten["zipcode"]) ? $daten["zipcode"] : '', 'city' => isset($daten["city"]) ? $daten["city"] : '', 'phone' => isset($daten["phone"]) ? $daten["phone"] : '', 'fax' => isset($daten["fax"]) ? $daten["fax"] : '', 'email' => isset($daten["email"]) ? $daten["email"] : '', 'homepage' => isset($daten["homepage"]) ? $daten["homepage"] : '', 'sw' => isset($daten["sw"]) ? $daten["sw"] : '', 'konzern' => isset($daten["konzern"]) ? $daten["konzern"] : '', 'konzernname' => isset($daten["konzernname"]) ? $daten["konzernname"] : '', 'branche_' => isset($daten["branche_"]) ? $daten["branche_"] : '', 'ustid' => isset($daten["ustid"]) ? $daten["ustid"] : '', 'taxnumber' => isset($daten["taxnumber"]) ? $daten["taxnumber"] : '', 'contact' => isset($daten["contact"]) ? $daten["contact"] : '', 'leadsrc' => isset($daten["leadsrc"]) ? $daten["leadsrc"] : '', 'notes' => isset($daten["notes"]) ? $daten["notes"] : '', 'bank' => isset($daten["bank"]) ? $daten["bank"] : '', 'bank_code' => isset($daten["bank_code"]) ? $daten["bank_code"] : '', 'iban' => isset($daten["iban"]) ? $daten["iban"] : '', 'bic' => isset($daten["bic"]) ? $daten["bic"] : '', 'headcount' => isset($daten["headcount"]) ? $daten["headcount"] : '', 'direct_debit' . (isset($daten['direct_debit']) ? $daten['direct_debit'] : '') => "checked", 'account_number' => isset($daten["account_number"]) ? $daten["account_number"] : '', 'terms' => isset($daten["terms"]) ? $daten["terms"] : '', 'kreditlim' => isset($daten["creditlimit"]) ? $daten["creditlimit"] : '', 'umsatz' => isset($daten["umsatz"]) ? $daten["umsatz"] : '', 'op' => isset($daten["op"]) ? $daten["op"] : '', 'preisgrp' => isset($daten["preisgroup"]) ? $daten["preisgroup"] : '', 'IMG' => $Image, 'grafik' => isset($daten["grafik"]) ? $daten["grafik"] : '', 'init' => $employee, 'login' => $_SESSION["login"], 'employee' => $_SESSION["loginCRM"], 'password' => isset($_SESSION["password"]) ? $_SESSION["password"] : '', 'txid' . (isset($daten["taxzone_id"]) ? $daten["taxzone_id"] : '') => "selected", 'GEODB' => $_SESSION['GEODB'] == 't' ? '1==1' : '1>2', 'GEOS' => $_SESSION['GEODB'] == 't' ? "visible" : "hidden", 'GEO1' => $_SESSION['GEODB'] == 't' ? '' : "!--", 'GEO2' => $_SESSION['GEODB'] == 't' ? '' : "--", 'BLZ1' => $_SESSION['BLZDB'] == 't' ? '' : "!--", 'BLZ2' => $_SESSION['BLZDB'] == 't' ? '' : "--", 'cvars' => isset($daten['id']) ? cvar_edit($daten["id"]) : '', 'variablen' => $varablen)); $jahre = getUmsatzJahre($typ == "C" ? "ar" : "ap"); doBlock($t, "fa1", "YearListe", "YL", $jahre, "year", "year", $daten["year"]); $lang = getLanguage(); doBlock($t, "fa1", "LAnguage", "LA", $lang, "id", "description", $daten["language_id"]); $kdtyp = getBusiness(); doBlock($t, "fa1", "TypListe", "BT", $kdtyp, "id", "description", $daten["business_id"]); $lead = getLeads(); doBlock($t, "fa1", "LeadListe", "LL", $lead, "id", "lead", $daten["lead"]); if (isset($daten['id'])) { $shiptos = getAllShipto($daten["id"], $typ); doBlock($t, "fa1", "shiptos", "ST", $shiptos, "shipto_id", array("shiptoname", "shiptostreet", "shiptocity"), false); } $anreden = getAnreden(); doBlock($t, "fa1", "anreden", "A", $anreden, "greeting", "greeting", isset($daten["greeting"]) ? $daten["greeting"] : ''); $payment = getPayment(); doBlock($t, "fa1", "payment", "P", $payment, "id", "description", isset($daten["payment_id"]) ? $daten["payment_id"] : ''); $branchen = getBranchen(); doBlock($t, "fa1", "branchen", "BR", $branchen, "branche", "branche", isset($daten["branche"]) ? $daten["branche"] : ''); $bundesland = getBundesland(strtoupper($daten["country"])); doBlock($t, "fa1", "buland", "BL", $bundesland, "id", "bundesland", isset($daten["bland"]) ? $daten["bland"] : ''); $curr = getCurrencies(); doBlock($t, "fa1", "currency", "C", $curr, "id", "name", isset($daten["currency_id"]) ? $daten["currency_id"] : ''); $cvars = getCvars(); $t->set_block('fa1', 'cvarListe', 'BlockCV'); if ($cvars) { $i = 1; foreach ($cvars as $cvar) { switch ($cvar["type"]) { case "bool": $fld = "<input type='checkbox' name='vc_cvar_" . $cvar["name"] . "' value='t'"; if (isset($daten["vc_cvar_" . $cvar["name"]]) and $daten["vc_cvar_" . $cvar["name"]] == "t") { $fld .= " checked"; } $fld .= ">"; break; case "date": $fld = "<input type='text' name='vc_cvar_" . $cvar["name"] . "' size='10' value='"; $fld .= db2date($daten["vc_cvar_" . $cvar["name"]]) . "' id='cvar_" . $cvar["name"] . "'>"; $fld .= "<input name='cvar_" . $cvar["name"] . "_button' id='cvar_" . $cvar["name"] . "_trigger' type='button' value='?'>"; $fld .= '<script type="text/javascript"><!-- ' . "\n"; $fld .= 'Calendar.setup({ inputField : "cvar_' . $cvar["name"] . '",'; $fld .= 'ifFormat : "%d.%m.%Y",'; $fld .= 'align : "BL",'; $fld .= 'button : "cvar_' . $cvar["name"] . '_trigger"});'; $fld .= "\n" . '--></script>' . "\n"; break; case "select": $o = explode("##", $cvar["options"]); $fld = "<select name='vc_cvar_" . $cvar["name"] . "'>\n<option value=''>---------\n"; foreach ($o as $tmp) { $fld .= "<option value='{$tmp}'"; if ($daten["vc_cvar_" . $cvar["name"]] == $tmp) { $fld .= " selected"; } $fld .= ">{$tmp}\n"; } $fld .= "</select>"; break; case "customer": $name = getCvarName($daten['vc_cvar_' . $cvar['name']]); $fld = "<input type='hidden' name='vc_cvar_" . $cvar["name"] . "' value='"; $fld .= $daten['vc_cvar_' . $cvar['name']] . "'>"; $fld .= $name . ' (' . $daten['vc_cvar_' . $cvar['name']] . ')'; break; default: $fld = '<input type="text" name="vc_cvar_' . $cvar['name'] . '" value="'; $fld .= $daten['vc_cvar_' . $cvar['name']] . '">'; } $t->set_var(array('varlable' . $i => $cvar["description"], 'varfld' . $i => $fld)); if ($i == 1) { $i = 2; } else { $i = 1; $t->parse('BlockCV', 'cvarListe', true); } } if ($i == 2) { $t->set_var(array('varlable2' => "", 'varfld2' => "")); $t->parse('BlockCV', 'cvarListe', true); } } if (!$suchmaske) { $bundesland = getBundesland(strtoupper($daten["shiptocountry"])); doBlock($t, "fa1", "buland2", "BS", $bundesland, "id", "bundesland", $daten["shiptobland"]); $employees = getAllUser(array(0 => true, 1 => "%")); doBlock($t, "fa1", "SalesmanListe", "SM", $employees, "id", "name", $daten["salesman_id"]); /* Check if the user is allowed to change the access group - Behaviour changed by DO: Let (all) users change the group if none is set yet */ if (!isset($daten["employee"]) || $daten["employee"] == $_SESSION["loginCRM"] || $daten["modemployee"] == $_SESSION["loginCRM"]) { $first[] = array("grpid" => "", "rechte" => "w", "grpname" => ".:public:."); $first[] = array("grpid" => $_SESSION["loginCRM"], "rechte" => "w", "grpname" => ".:personal:."); $grps = getGruppen(); if ($grps) { $user = array_merge($first, $grps); } else { $user = $first; } doBlock($t, "fa1", "OwenerListe", "OL", $user, "grpid", "grpname", $daten["owener"]); } else { $user[0] = array("grpid" => $daten["owener"], "grpname" => $daten["owener"] ? getOneGrp($daten["owener"]) : ".:public:."); doBlock($t, "fa1", "OwenerListe", "OL", $user, "grpid", "grpname", $daten["owener"]); /*$t->set_var(array( grpid => $daten["owener"], Gsel => "selected", Gname => ($daten["owener"])?getOneGrp($daten["owener"]):".:public:.", )); $t->parse("Block","OwenerListe",true);*/ } } //if (!$suchmaske) }