diff --git a/wawi/bestellung.php b/wawi/bestellung.php index 0b16f6023..30fad1845 100644 --- a/wawi/bestellung.php +++ b/wawi/bestellung.php @@ -26,10 +26,12 @@ require_once '../include/firma.class.php'; require_once '../include/organisationseinheit.class.php'; require_once '../include/mitarbeiter.class.php'; require_once '../include/datum.class.php'; +require_once '../include/benutzerberechtigung.class.php'; require_once '../include/wawi_konto.class.php'; require_once '../include/wawi_bestellung.class.php'; require_once '../include/wawi_kostenstelle.class.php'; -require_once '../include/benutzerberechtigung.class.php'; +require_once '../include/wawi_bestelldetails.class.php'; + $aktion =''; if(isset($_POST['getKonto'])) @@ -59,17 +61,35 @@ if(isset($_POST['getFirma'])) $id = $_POST['id']; if(isset($_POST['id'])) { - $firma = new firma(); - $firma->get_firmaorganisationseinheit(null,$id); - if(count($firma->result)>0) + if($_POST['id'] == 'opt_auswahl') { - foreach($firma->result as $fi) + // anzeige aller Firmen + $firmaAll = new firma(); + $firmaAll->getAll(); + + echo "\n"; + foreach ($firmaAll->result as $fi) { - echo '\n"; + echo "\n"; } + + } + else + { + // anzeige der Firmen die oe zugeordnet sind + $firma = new firma(); + $firma->get_firmaorganisationseinheit(null,$id); + if(count($firma->result)>0) + { + echo "\n"; + foreach($firma->result as $fi) + { + echo '\n"; + } + } + else + echo ""; } - else - echo ""; } else echo ""; @@ -81,17 +101,34 @@ if(isset($_POST['getSearchKonto'])) $id = $_POST['id']; if(isset($_POST['id'])) { - $konto = new wawi_konto(); - $konto->getKontoFromOE($id); - if(count($konto->result)>0) + if($_POST['id'] == 'opt_auswahl') { + $konto = new wawi_konto(); + $konto->getAll(); + // anzeige aller Konten + echo "\n"; foreach($konto->result as $ko) { - echo '\n"; + echo '\n"; + } } else - echo ""; + { + // anzeige aller Konten die der Kostenstelle zugeordnet sind + $konto = new wawi_konto(); + $konto->getKontoFromOE($id); + if(count($konto->result)>0) + { + echo "\n"; + foreach($konto->result as $ko) + { + echo '\n"; + } + } + else + echo ""; + } } else echo ""; @@ -150,36 +187,7 @@ if(isset($_POST['getSearchKonto'])) function formatItem(row) { return row[0] + "
  • " + row[1] + "
  • "; - } - - $(document).ready(function() - { - $('#firmenname').autocomplete('wawi_autocomplete.php', - { - minChars:2, - matchSubset:1,matchContains:1, - width:500, - formatItem:formatItem, - extraParams:{'work':'wawi_firma_search' } - }).result(function(event, item) { - $('#firma_id').val(item[1]); - }); - }); - - $(document).ready(function() - { - $('#mitarbeiter_name').autocomplete('wawi_autocomplete.php', - { - minChars:2, - matchSubset:1,matchContains:1, - width:500, - formatItem:formatItem, - extraParams:{'work':'wawi_mitarbeiter_search' } - }).result(function(event, item) { - $('#mitarbeiter_uid').val(item[1]); - }); - - }); + } function conf_del() { @@ -187,27 +195,69 @@ if(isset($_POST['getSearchKonto'])) } $(function() { - $( "#datepicker" ).datepicker($.datepicker.regional['de']); + $( "#datepicker_evon" ).datepicker($.datepicker.regional['de']); }); $(function() { - $( "#datepicker1" ).datepicker($.datepicker.regional['de']); + $( "#datepicker_ebis" ).datepicker($.datepicker.regional['de']); }); $(function() { - $( "#datepicker2" ).datepicker($.datepicker.regional['de']); + $( "#datepicker_bvon" ).datepicker($.datepicker.regional['de']); }); $(function() { - $( "#datepicker3" ).datepicker($.datepicker.regional['de']); + $( "#datepicker_bbis" ).datepicker($.datepicker.regional['de']); + }); + $(function() { + $( "#datepicker_liefertermin" ).datepicker($.datepicker.regional['de']); }); $(document).ready(function() - { - $("#myTable").tablesorter( - { - sortList: [[1,0]], - widgets: ['zebra'] - }); - } - ); + { + $("#myTable").tablesorter( + { + sortList: [[1,0]], + widgets: ['zebra'] + }); + + $('#aufteilung_link').click(function() { + $('#aufteilung').toggle(); + return false; + }); + + $('#mitarbeiter_name').autocomplete('wawi_autocomplete.php', + { + minChars:2, + matchSubset:1,matchContains:1, + width:500, + formatItem:formatItem, + extraParams:{'work':'wawi_mitarbeiter_search' } + }).result(function(event, item) { + $('#mitarbeiter_uid').val(item[1]); + }); + + $('#firmenname').autocomplete('wawi_autocomplete.php', + { + minChars:2, + matchSubset:1,matchContains:1, + width:500, + formatItem:formatItem, + extraParams:{'work':'wawi_firma_search' } + }).result(function(event, item) { + $('#firma_id').val(item[1]); + }); + + }); + function calcLine(id) + { + var zahl = + (eval(document.getElementById("preisprove_"+id).value) + ((document.getElementById("preisprove_"+id).value) * (document.getElementById("mwst_"+id).value) / 100)) + * eval(document.getElementById("menge_"+id).value); + document.getElementById("brutto_"+id).value = zahl.toFixed(2); + } + + function getMwst() + { + + } @@ -265,16 +315,16 @@ if($aktion == 'suche') echo "\n"; echo "\n"; echo "Erstelldatum\n"; - echo "von bis \n"; + echo "von bis \n"; echo "\n"; echo "\n"; echo "Bestelldatum\n"; - echo "von bis \n"; + echo "von bis \n"; echo "\n"; echo "\n"; echo " Organisationseinheit: \n"; echo "\n"; echo "\n"; foreach($konto_all as $ko) { @@ -336,6 +386,7 @@ if($aktion == 'suche') else { // Suchergebnisse anzeigen + //var_dump($_POST); $bestellnummer = $_POST['bestellnr']; $titel = $_POST['titel']; $evon = $_POST['evon']; @@ -345,7 +396,8 @@ if($aktion == 'suche') $firma_id = $_POST['firma_id']; $oe_kurzbz = $_POST['filter_oe_kurzbz']; $filter_konto = $_POST['filter_konto']; - $mitarbeiter_uid = $_POST['mitarbeiter_uid']; + $mitarbeiter_uid = $_POST['mitarbeiter_uid']; + $filter_firma = $_POST['filter_firma']; if (isset ($_POST['rechnung'])) $rechnung = true; else @@ -364,7 +416,8 @@ if($aktion == 'suche') if(($evon || $evon === '') && ($ebis || $ebis === '' ) && ($bvon || $bvon === '') && ($bbis || $bbis === '')) { - if($bestellung->getAllSearch($bestellnummer, $titel, $evon, $ebis, $bvon, $bbis, $firma_id, $oe_kurzbz, $filter_konto, $mitarbeiter_uid, $rechnung)) + // Filter firma oder firma id werden angezeigt + if($bestellung->getAllSearch($bestellnummer, $titel, $evon, $ebis, $bvon, $bbis, $firma_id, $oe_kurzbz, $filter_konto, $mitarbeiter_uid, $rechnung, $filter_firma)) { $firma = new firma(); $date = new datum(); @@ -455,6 +508,7 @@ if($aktion == 'suche') { if(isset($_POST)) { + // Die Bestellung wird gespeichert und die neue id zurückgegeben $newBestellung = new wawi_bestellung(); $newBestellung->titel = $_POST['titel']; $newBestellung->kostenstelle_id = $_POST['filter_kst']; @@ -490,4 +544,111 @@ if($aktion == 'suche') { echo $bestellung->errormsg; } + } + else if($_GET['method']=='update') + { + $id = (isset($_GET['id'])?$_GET['id']:null); + + $bestellung = new wawi_bestellung(); + $bestellung->load($id); + $detail = new wawi_bestelldetail(); + $detail->getAllDetailsFromBestellung($id); + $anz_detail = count($detail->result); + $konto = new wawi_konto(); + $konto->getKontoFromKostenstelle($bestellung->kostenstelle_id); + $kostenstelle = new wawi_kostenstelle(); + $kostenstelle->load($bestellung->kostenstelle_id); + + + $i= 0; + $summe= 0; + + echo "

    Bearbeiten

    "; + echo "
    \n"; + echo "

    Bestellnummer: ".$bestellung->bestell_nr."

    "; + + //tabelle Bestelldetails + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
    Titel: Erstellt am:".$date->formatDatum($bestellung->insertamum, 'd.m.Y')."
    Firma: Liefertermin:
    Kostenstelle: $kostenstelle->bezeichnungLieferadresse:
    Konto: Rechnungsadresse:
    Bemerkungen:
    \n"; + + echo "
    "; + + //tabelle Positonen + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + foreach($detail->result as $det) + { + $i++; + $brutto=($det->menge * ($det->preisprove +($det->preisprove * ($det->mwst/100)))); + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + $summe+=$brutto; + } + echo "
    LöschenPosMengeVEBezeichnungArtikelnr.Preis/VEUStBrutto
    delete
    \n"; + echo "Gesamtpreis/Brutto: ".$summe; + echo "

    \n"; + // div Aufteilung --> kann ein und ausgeblendet werden + echo "Aufteilung\n"; + echo "
    \n"; + echo "test"; + echo "
    "; } \ No newline at end of file