This commit is contained in:
Karl Burkhart
2010-12-17 13:50:30 +00:00
parent eedbc99985
commit 6f5add82f8
2 changed files with 45 additions and 6 deletions
+15 -3
View File
@@ -137,8 +137,9 @@ class wawi_bestellstatus extends basis_db
* @param $bestellung_id
* @param $status_kurzbz
*/
public function isStatiVorhanden($bestellung_id, $status_kurzbz)
public function isStatiVorhanden($bestellung_id, $status_kurzbz='', $oe_kurzbz ='')
{
$status='';
if(!is_numeric($bestellung_id) || $bestellung_id == '')
{
$this->errormsg = "Bestellung ID fehlerhaft.";
@@ -149,15 +150,26 @@ class wawi_bestellstatus extends basis_db
$this->errormsg = "Status Kurzbezeichnung ist fehlerhaft.";
return false;
}
if($oe_kurzbz!='')
{
$status .= " and oe_kurzbz = ".$this->addslashes($oe_kurzbz);
}
if($status_kurzbz!='')
{
$status.=" and bestellstatus_kurzbz = ".$this->addslashes($status_kurzbz);
}
$qry = "select bestellstatus.* from wawi.tbl_bestellung_bestellstatus as bestellstatus
WHERE
bestellung_id = ".$this->addslashes($bestellung_id)." and bestellstatus_kurzbz = ".$this->addslashes($status_kurzbz).";";
bestellung_id = ".$this->addslashes($bestellung_id).$status.";";
if($this->db_query($qry))
{
if($row = $this->db_fetch_object())
{
$this->datum = $row->datum;
$this->insertvon = $row->insertvon;
return true;
}
else
+30 -3
View File
@@ -587,11 +587,38 @@ class wawi_bestellung extends basis_db
{
$oe = new organisationseinheit();
$bestellung = new wawi_bestellung();
$bestellung->load($bestellung_id);
$brutto = $bestellung->getBrutto($bestellung_id);
$brutto = number_format($brutto,2,".","");
$oe_bestellung = $bestellung->getOe();
// oe der bestellung
$oe->load($oe_bestellung);
$oes = array();
$oe->load($bestellung->getOe());
echo $oe->oe_kurzbz;
$qry = "WITH RECURSIVE oes(oe_kurzbz, oe_parent_kurzbz, freigabegrenze) as
(
SELECT oe_kurzbz, oe_parent_kurzbz, freigabegrenze FROM public.tbl_organisationseinheit
WHERE oe_kurzbz='".addslashes($oe_bestellung)."' and aktiv = true
UNION ALL
SELECT o.oe_kurzbz, o.oe_parent_kurzbz, o.freigabegrenze FROM public.tbl_organisationseinheit o, oes
WHERE o.oe_kurzbz=oes.oe_parent_kurzbz and aktiv = true
)
SELECT oe_kurzbz
FROM oes
WHERE freigabegrenze<='$brutto'
GROUP BY oe_kurzbz,freigabegrenze ORDER BY freigabegrenze";
if($this->db_query($qry))
{
while($row = $this->db_fetch_object())
{
$oes[] = $row->oe_kurzbz;
}
return $oes;
}
else
return false;
}