diff --git a/include/wawi_aufteilung.class.php b/include/wawi_aufteilung.class.php new file mode 100644 index 000000000..e43e11baa --- /dev/null +++ b/include/wawi_aufteilung.class.php @@ -0,0 +1,134 @@ +, + * Andreas Oesterreicher and + * Karl Burkhart . + */ +/** + * Klasse WaWi Aufteilung + */ + +require_once(dirname(__FILE__).'/basis_db.class.php'); + +class wawi_aufteilung extends basis_db +{ + public $new; // bool + public $result = array(); // Aufteilungsobjekt array + + public $aufteilung_id; // integer + public $kostenstelle_id; // integer + public $oe_kurzbz; // char + public $anteil; // float(5,2) + public $insertamum; // timestamp + public $insertvon; // char + public $updateamum; // timestamp + public $upatevon; // char + + /** + * + * Enter description here ... + * @param unknown_type $aufteilung_id + */ + public function __construct($aufteilung_id=null) + { + parent::__construct(); + + if(!is_null($konto_id)) + $this->load($konto_id); + } + + /** + * + * Gibt die Aufteilung der übergebenen id zurück + * @param $aufteilung_id + */ + public function load($aufteilung_id) + { + if(!is_numeric($aufteilung_id)) + { + $this->errormsg = "Ungültige aufteilung_id."; + return false; + } + $qry = "SELECT * FROM wawi.tbl_aufteilung_default WHERE aufteilung_id =".$aufteilung_id.';'; + + if($this->db_query($qry)) + { + if($row = $this->db_fetch_object()) + { + $this->aufteilung_id = $row->aufteilung_id; + $this->kostenstelle_id = $row->kostenstelle_id; + $this->oe_kurzbz = $row->oe_kurzbz; + $this->anteil = $row->anteil; + $this->insertamum = $row->insertamum; + $this->insertvon = $row->insertvon; + $this->updateamum = $row->updateamum; + $this->updatevon = $row->updatevon; + + } + return true; + } + else + { + $this->errormsg = "Fehler bei der Abfrage aufgetreten."; + return false; + } + } + + /** + * + * Gibt alle Aufteilungen zurück + */ + public function getAll() + { + $qry = "SELECT *`FROM wawi.tbl_aufteilung_default;"; + + if($this->db_query($qry)) + { + if($row = $this->db_fetch_object()) + { + $aufteilung = new wawi_aufteilung(); + + $aufteilung->aufteilung_id = $row->aufteilung_id; + $aufteilung->kostenstelle_id = $row->kostenstelle_id; + $aufteilung->oe_kurzbz = $row->oe_kurzbz; + $aufteilung->anteil = $row->anteil; + $aufteilung->insertamum = $row->insertamum; + $aufteilung->insertvon = $row->insertvon; + $aufteilung->updateamum = $row->upateamum; + $aufteilung->updatevon = $row->updatevon; + + $this->result[] = $aufteilung; + + } + return true; + } + else + { + $this->errormsg = "Fehler bei der Abfrage aufgetreten."; + return false; + } + + } + + public function getAufteilungFromKostenstelle($kostenstelle_id) + { + + } + + +} \ No newline at end of file diff --git a/include/wawi_bestelldetails.class.php b/include/wawi_bestelldetails.class.php index be76f3416..0dc217909 100644 --- a/include/wawi_bestelldetails.class.php +++ b/include/wawi_bestelldetails.class.php @@ -288,8 +288,51 @@ class wawi_bestelldetail extends basis_db return false; } return $this->bestelldetail_id; + } + + public function getAllDetailsFromBestellung($bestell_id) + { + if(!is_numeric($bestell_id)) + { + $this->errormsg ='Keine gültige Bestell ID.'; + return false; + } + $qry = "SELECT * from wawi.tbl_bestelldetail as detail + where + detail.bestellung_id = ".$bestell_id.";"; - + if($this->db_query($qry)) + { + while($row = $this->db_fetch_object()) + { + $detail = new wawi_bestelldetail(); + + $detail->bestelldetail_id = $row->bestelldetail_id; + $detail->bestellung_id = $row->bestellung_id; + $detail->positoin = $row->position; + $detail->menge = $row->menge; + $detail->verpackungseinheit = $row->verpackungseinheit; + $detail->beschreibung = $row->beschreibung; + $detail->artikelnummer = $row->artikelnummer; + $detail->preisprove = $row->preisprove; + $detail->mwst = $row->mwst; + $detail->erhalten = $row->erhalten; + $detail->sort = $row->sort; + $detail->text = $row->text; + $detail->insertamum = $row->insertamum; + $detail->insertvon = $row->insertvon; + $detail->updateamum = $row->updateamum; + $detail->updatevon = $row->updatevon; + + $this->result[] = $detail; + } + return true; + } + else + { + $this->errormsg = "Fehler bei der Abfrage."; + return false; + } } } \ No newline at end of file diff --git a/include/wawi_bestellung.class.php b/include/wawi_bestellung.class.php index 3c915ff9e..36a4c7429 100644 --- a/include/wawi_bestellung.class.php +++ b/include/wawi_bestellung.class.php @@ -86,7 +86,7 @@ class wawi_bestellung extends basis_db if($row = $this->db_fetch_object()) { $this->bestellung_id = $row->bestellung_id; - $this->besteller_uid = $row->besteller_id; + $this->besteller_uid = $row->besteller_uid; $this->kostenstelle_id = $row->kostenstelle_id; $this->konto_id = $row->konto_id; $this->firma_id = $row->firma_id; @@ -167,7 +167,7 @@ class wawi_bestellung extends basis_db * @param $mitarbeiter_uid * @param $rechnung */ - public function getAllSearch($bestellnr, $titel, $evon, $ebis, $bvon, $bbis, $firma_id, $oe_kurzbz, $konto_id, $mitarbeiter_uid, $rechnung ) + public function getAllSearch($bestellnr, $titel, $evon, $ebis, $bvon, $bbis, $firma_id, $oe_kurzbz, $konto_id, $mitarbeiter_uid, $rechnung, $filter_firma) { $first = true; $qry = "SELECT distinct on (bestellung.bestellung_id) *, status.updateamum as update, bestellung.updatevon as update_von, bestellung.insertamum as insert, bestellung.insertvon as insert_von @@ -255,6 +255,17 @@ class wawi_bestellung extends basis_db $qry.= ' and '; $qry.= ' bestellung.firma_id = '.$this->addslashes($firma_id); } + if ($filter_firma != '') + { + if($first == true) + { + $qry.= 'where '; + $first = false; + } + else + $qry.= ' or '; + $qry.= ' bestellung.firma_id = '.$this->addslashes($filter_firma); + } if ($oe_kurzbz != '') { if($first == true)