function jsFunction() { this.srcAjax = 'libs/actions.php'; this.method = 'POST'; this.makce = null; this.sakce = null; this.rowSelect = null; this.res = Array(); this.sortAktiv = null; this.interv = null; this.searchZakaznik_id = null; this.psani = null; } jsFunction.prototype.resultKategorie = function(cId, input, makce, sakce, hlaska) { var val = ''; var next = true; delArrayKategorie(); if(input && input != '') val = input.value; if(hlaska && hlaska != '') { if(!confirm(hlaska)) next = false; } if(next) { var req = new aObj(this.srcAjax); req.callback = function(responseTxt, responseStat) { if( responseStat == 200 ) { //alert(responseTxt); eval(responseTxt); if(dgShow.res['text-menu'] != undefined) { var nadpisText = document.getElementById('nadpis-text'); if(nadpisText) nadpisText.innerHTML = dgShow.res['text-menu']; } if(dgShow.res['del-aktiv'] == 1) { window.location.reload(); } else if(sakce == 'setKategorie') { dg.kategorie = dgShow.res; dg.createKategorie(); searRow._filter(); dg.endSave(); } else { dg.kategorie = dgShow.res; dg.createKategorie(); } } } req.update('makce='+makce+'&sakce='+sakce+'&value='+val+'&id='+cId, 'POST'); } } jsFunction.prototype.saveData = function(makce, sakce, cId, hlaska) { fn.displayLoading(true); var frm = document.getElementById(cId); var pom_makce, pom_sakce, n_id_obj; if(frm) { var el = frm.getElementsByTagName('INPUT'); var el2 = frm.getElementsByTagName('SELECT'); var el3 = frm.getElementsByTagName('TEXTAREA'); var oEditor = ''; var str = ''; for( i=0;i 0 ) { if(cena_typ == 1) { cena_get = (Number(cena_s_dph) * 100) / (Number(dph) + 100); } else { cena_get = Number(cena_s_dph); } if(doplnek != 1) { if(zbozi == 1 || zbozi == 2 || zbozi == 3 || zbozi == 7 || zbozi == 8 || zbozi == 25 || zbozi == 26 || zbozi == 27) { // 3000 4000 6000 if(pocet > 0) { cena_get = cena_get - (pocet * 4000); } } else if(zbozi == 4) { // 4000 if(pocet > 0) { cena_get = cena_get - (pocet * 6000); } } else if(zbozi == 13 || zbozi == 14 || zbozi == 15) { // 4000 if(pocet > 0) { cena_get = cena_get - (pocet * 4000); } } else if(zbozi == 5 || zbozi == 6) { // 3000 if(pocet > 0) { cena_get = cena_get - (pocet * 3000); } } else if(zbozi == 16 || zbozi == 17 || zbozi == 18 || zbozi == 21 || zbozi == 22 || zbozi == 23) { // 700 if(pocet > 0) { cena_get = cena_get - (pocet * 700); } } else if(zbozi == 9 || zbozi == 10 || zbozi == 11 || zbozi == 12) { // 700 if(pocet > 0) { cena_get = cena_get - (pocet * 700); } } } } cena_bez_dph.value = Math.floor(cena_get); } // TODO: funkce pro reklamace jsFunction.prototype.getZakaznikReklamace = function(value) { fn.displayLoading(true); var req = new aObj('libs/actions-ajax.php'); req.callback = function(responseTxt, responseStat) { if( responseStat == 200 ) { //alert(responseTxt); eval(responseTxt); document.getElementById('resObjednavky').innerHTML = dgShow.res['select']; document.getElementById('set_zakaznici').value = dgShow.res['select_name']; if(dgShow.res['select_id'] == 0) { fn.doplnitObjednavku(value, 'noObj'); } else { fn.doplnitObjednavku(dgShow.res['select_id'], 'obj'); } if(document.getElementById('polozky_zobraz').style.display == 'block') { document.getElementById('polozky_zobraz').style.display = 'none'; } fn.displayLoading(false); } } req.update('makce=reklamace&sakce=getObjednavka&zakaznik='+value, 'POST'); } jsFunction.prototype.doplnitObjednavku = function(cId, typ) { fn.displayLoading(true); var req = new aObj('libs/actions-ajax.php'); req.callback = function(responseTxt, responseStat) { if( responseStat == 200 ) { //alert(responseTxt); eval(responseTxt); if(typ != 'noObj') document.getElementById('id_objednavka').value = cId; else document.getElementById('id_objednavka').value = 0; document.getElementById('id_zakaznik').value = dgShow.res['id_zakaznik']; document.getElementById('objednavka-data-kontakt').innerHTML = dgShow.res['kontakt']; selectItem(document.getElementById('objednavka-data-zbozi'),dgShow.res['druh_zbozi']); selectItem(document.getElementById('objednavka-data-zastupce'),dgShow.res['obch_zastupce']); document.getElementById('objednavka-data-plan').innerHTML = dgShow.res['montaz']; //fn.doplnitCisloObj(cId); fn.displayLoading(false); } } req.update('makce=reklamace&sakce=setObjednavka&edit='+cId+'&typ='+typ, 'POST'); } jsFunction.prototype.doplnitCisloObj = function(cId) { fn.displayLoading(true); var req = new aObj('libs/actions-ajax.php'); req.callback = function(responseTxt, responseStat) { if( responseStat == 200 ) { //alert(responseTxt); //document.getElementById('id_objednavka').value = cId; document.getElementById('objednavka_cislo').value = responseTxt; fn.displayLoading(false); } } req.update('makce=reklamace&sakce=setObjednavkaCislo&edit='+cId, 'POST'); } jsFunction.prototype.showZakaznikReklamace = function(search) { fn.displayLoading(true); if(document.getElementById('polozky_zobraz').style.display == 'none') { document.getElementById('polozky_zobraz').style.display = 'block'; fn.setZakaznikReklamace(search); } //var serch = document.getElementById('search_polozky').value; /* if(this.tablePolozky == null ) { this.tablePolozky = 1; var req = new aObj('libs/ajax.nabidky.php'); req.callback = function(responseTxt, responseStat) { if( responseStat == 200 ) { //alert(responseTxt); var tmp = document.getElementById('polozky_seznam'); if( tmp ) tmp.innerHTML = responseTxt; fn.displayLoading(false); } } req.update('reloadPolozky=1&search='+serch, 'POST'); } else */ fn.displayLoading(false); } jsFunction.prototype.setZakaznikReklamace = function(search) { var req = new aObj('libs/actions-ajax.php'); req.callback = function(responseTxt, responseStat) { if( responseStat == 200 ) { //alert(responseTxt); document.getElementById('polozky_zobraz').innerHTML = responseTxt; } } req.update('makce=reklamace&sakce=setZakaznikReklamace&search='+search, 'POST'); } // TODO: funkce pro montazni plan jsFunction.prototype.setMontazniPlan = function(cId) { fn.displayLoading(true); var req = new aObj('libs/actions-ajax.php'); req.callback = function(responseTxt, responseStat) { if( responseStat == 200 ) { //alert(responseTxt); document.getElementById('montazniPlanPrehled').innerHTML = responseTxt; fn.displayLoading(false); } } req.update('makce=montazni_plan&sakce=setMontazniPlan&edit='+cId, 'POST'); } jsFunction.prototype.delMontazniPlan = function(cId) { fn.displayLoading(true); var pom = cId.split("-"); if(confirm('Opravdu chcete smazat montážní plán?')) { var req = new aObj('libs/actions.php'); req.callback = function(responseTxt, responseStat) { if( responseStat == 200 ) { //alert(responseTxt); fn.setMontazniPlan(pom[1]); fn.displayLoading(false); } } req.update('makce=montazni_plan&sakce=del&id='+pom[0]); } else { fn.displayLoading(false); } } jsFunction.prototype.delMontazniPlan_ = function(cId) { fn.displayLoading(true); var pom = cId.split("-"); if(confirm('Opravdu chcete smazat montážní plán?')) { var req = new aObj('libs/actions.php'); req.callback = function(responseTxt, responseStat) { if( responseStat == 200 ) { //alert(responseTxt); window.location.reload(); fn.displayLoading(false); } } req.update('makce=montazni_plan&sakce=del&id='+pom[0]); } else { fn.displayLoading(false); } } jsFunction.prototype.showZakaznikMontazniPlan = function(search) { fn.displayLoading(true); if(document.getElementById('polozky_zobraz').style.display == 'none') { document.getElementById('polozky_zobraz').style.display = 'block'; fn.setZakaznikMontazniPlan(search); } //var serch = document.getElementById('search_polozky').value; /* if(this.tablePolozky == null ) { this.tablePolozky = 1; var req = new aObj('libs/ajax.nabidky.php'); req.callback = function(responseTxt, responseStat) { if( responseStat == 200 ) { //alert(responseTxt); var tmp = document.getElementById('polozky_seznam'); if( tmp ) tmp.innerHTML = responseTxt; fn.displayLoading(false); } } req.update('reloadPolozky=1&search='+serch, 'POST'); } else */ fn.displayLoading(false); } jsFunction.prototype.setZakaznikMontazniPlan = function(search) { var req = new aObj('libs/actions-ajax.php'); req.callback = function(responseTxt, responseStat) { if( responseStat == 200 ) { //alert(responseTxt); document.getElementById('polozky_zobraz').innerHTML = responseTxt; } } req.update('makce=montazni_plan&sakce=setZakaznikMontazniPlan&search='+search, 'POST'); } jsFunction.prototype.getZakaznikMontazniPlan = function(value) { fn.displayLoading(true); var req = new aObj('libs/actions-ajax.php'); req.callback = function(responseTxt, responseStat) { if( responseStat == 200 ) { //alert(responseTxt); eval(responseTxt); document.getElementById('resObjednavky').innerHTML = dgShow.res['select']; document.getElementById('set_zakaznici').value = dgShow.res['select_name']; fn.doplnitObjednavkuPlan(dgShow.res['select_id']); if(document.getElementById('polozky_zobraz').style.display == 'block') { document.getElementById('polozky_zobraz').style.display = 'none'; } fn.displayLoading(false); } } req.update('makce=montazni_plan&sakce=getObjednavka&zakaznik='+value, 'POST'); } jsFunction.prototype.doplnitObjednavkuPlan = function(cId) { fn.displayLoading(true); var req = new aObj('libs/actions-ajax.php'); req.callback = function(responseTxt, responseStat) { if( responseStat == 200 ) { //alert(responseTxt); document.getElementById('id_objednavka').value = cId; document.getElementById('objednavka-data').innerHTML = responseTxt; //fn.doplnitCisloObjPlan(cId); fn.displayLoading(false); } } req.update('makce=montazni_plan&sakce=setObjednavka&edit='+cId, 'POST'); } jsFunction.prototype.doplnitCisloObjPlan = function(cId) { fn.displayLoading(true); var req = new aObj('libs/actions-ajax.php'); req.callback = function(responseTxt, responseStat) { if( responseStat == 200 ) { //alert(responseTxt); //document.getElementById('id_objednavka').value = cId; document.getElementById('objednavka_cislo').value = responseTxt; fn.displayLoading(false); } } req.update('makce=montazni_plan&sakce=setObjednavkaCislo&edit='+cId, 'POST'); } //TODO: funkce pro montazni vozy jsFunction.prototype.setMontazniVozyPHM = function(cId) { fn.displayLoading(true); var req = new aObj('libs/actions-ajax.php'); req.callback = function(responseTxt, responseStat) { if( responseStat == 200 ) { //alert(responseTxt); document.getElementById('montazniVozyPrehledPHM').innerHTML = responseTxt; fn.displayLoading(false); } } req.update('makce=montazni_vozy&sakce=setMontazniVozyPHM&edit='+cId, 'POST'); } jsFunction.prototype.delPHM = function(cId) { fn.displayLoading(true); var pom = cId.split("-"); if(confirm('Opravdu chcete smazat pohonné hmoty?')) { var req = new aObj('libs/actions.php'); req.callback = function(responseTxt, responseStat) { if( responseStat == 200 ) { //alert(responseTxt); fn.setMontazniVozyPHM(pom[1]); fn.displayLoading(false); } } req.update('makce=montazni_vozy&sakce=delPHM&id='+pom[0]); } } jsFunction.prototype.setMontazniVozyTrasa = function(cId) { fn.displayLoading(true); var req = new aObj('libs/actions-ajax.php'); req.callback = function(responseTxt, responseStat) { if( responseStat == 200 ) { //alert(responseTxt); document.getElementById('montazniVozyTrasy').innerHTML = responseTxt; fn.displayLoading(false); } } req.update('makce=montazni_vozy&sakce=setMontazniVozyTrasa&edit='+cId, 'POST'); } jsFunction.prototype.delTrasa = function(cId) { fn.displayLoading(true); var pom = cId.split("-"); if(confirm('Opravdu chcete smazat trasu?')) { var req = new aObj('libs/actions.php'); req.callback = function(responseTxt, responseStat) { if( responseStat == 200 ) { //alert(responseTxt); fn.setMontazniVozyTrasy(pom[1]); fn.displayLoading(false); } } req.update('makce=montazni_vozy&sakce=delTrasa&id='+pom[0]); } } // TODO: funkce pro obchodní zástupce /*jsFunction.prototype.prodejVypln = function(policko, cId) { fn.displayLoading(true); var req = new aObj('libs/actions-ajax.php'); req.callback = function(responseTxt, responseStat) { if( responseStat == 200 ) { //alert(responseTxt); hodnota = policko.value fn.displayLoading(false); } } req.update('makce=sales&sakce=setStats&id='+cId+'&typ='+typ, 'POST'); } }*/