Bugfixes lieferschein

This commit is contained in:
Xenomporio 2022-05-24 21:50:35 +02:00
parent ebc8f31781
commit c1a56db38d
7 changed files with 12334 additions and 12274 deletions

View File

@ -1870,14 +1870,22 @@ class YUI {
if($waehrung=="") if($waehrung=="")
{ {
// schaue ob es gebuchte positionen gibt dann diese waehrung // schaue ob es gebuchte positionen gibt dann diese waehrung
$waehrung = "";
if (!is_null($table)) {
if ($this->app->DB->Select("SHOW COLUMNS FROM `$table` LIKE 'waehrung'")) {
$waehrung = $this->app->DB->Select("SELECT waehrung FROM $table WHERE $module='$id' LIMIT 1"); $waehrung = $this->app->DB->Select("SELECT waehrung FROM $table WHERE $module='$id' LIMIT 1");
}
}
if($waehrung==""){ if($waehrung==""){
$waehrung = $this->app->erp->GetStandardWaehrung($projekt); $waehrung = $this->app->erp->GetStandardWaehrung($projekt);
} }
if ($this->app->DB->Select("SHOW COLUMNS FROM `$module` LIKE 'waehrung'")) {
if($waehrung!="") $this->app->DB->Update("UPDATE $module SET waehrung='$waehrung' WHERE id='$id' AND waehrung='' LIMIT 1"); if($waehrung!="") $this->app->DB->Update("UPDATE $module SET waehrung='$waehrung' WHERE id='$id' AND waehrung='' LIMIT 1");
} }
}
$umsatzsteuer = $articleArr['umsatzsteuer'];//$this->app->DB->Select("SELECT umsatzsteuer FROM artikel WHERE id='$artikel_id' LIMIT 1"); $umsatzsteuer = $articleArr['umsatzsteuer'];//$this->app->DB->Select("SELECT umsatzsteuer FROM artikel WHERE id='$artikel_id' LIMIT 1");
$variante_von = $articleArr['variante_von'];//$this->app->DB->Select("SELECT variante_von FROM artikel WHERE id='$artikel_id' LIMIT 1"); $variante_von = $articleArr['variante_von'];//$this->app->DB->Select("SELECT variante_von FROM artikel WHERE id='$artikel_id' LIMIT 1");
@ -14504,7 +14512,8 @@ source: "index.php?module=ajax&action=filter&filtername=' . $filter . $extendurl
if ($module == "lieferschein" || $module == "retoure") { if ($module == "lieferschein" || $module == "retoure") {
$table->headings[6] = 'ausgeliefert'; $table->headings[6] = 'ausgeliefert';
$zwischensumme = $this->app->DB->Select("SELECT sum(menge*preis) FROM $module"."_position WHERE $module = '$id'"); // $zwischensumme = $this->app->DB->Select("SELECT sum(menge*preis) FROM $module"."_position WHERE $module = '$id'");
// lieferschein has no preis
} else } else
if($module == "anfrage" || $module == "preisanfrage" ) { if($module == "anfrage" || $module == "preisanfrage" ) {
$table->headings[6] = 'Aktion'; $table->headings[6] = 'Aktion';

View File

@ -33069,7 +33069,9 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p
$this->app->DB->Update("UPDATE firmendaten_werte SET wert = '".$this->app->DB->real_escape_string($value)."' WHERE id = '".$check['id']."'"); $this->app->DB->Update("UPDATE firmendaten_werte SET wert = '".$this->app->DB->real_escape_string($value)."' WHERE id = '".$check['id']."'");
} }
} }
else {
$this->app->DB->Update("UPDATE firmendaten SET " . $field . "='$value' WHERE id='" . $firmendatenid . "'"); $this->app->DB->Update("UPDATE firmendaten SET " . $field . "='$value' WHERE id='" . $firmendatenid . "'");
}
$db = $this->app->Conf->WFdbname; $db = $this->app->Conf->WFdbname;
if(!empty($this->firmendaten[$db])) { if(!empty($this->firmendaten[$db])) {
$this->firmendaten[$db][$field] = $value; $this->firmendaten[$db][$field] = $value;
@ -33087,11 +33089,14 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p
if(strpos($field,'next') !== false) if(strpos($field,'next') !== false)
{ {
$firmendatenid = (int)$this->app->DB->Select('SELECT MAX(id) FROM firmendaten LIMIT 1'); $firmendatenid = (int)$this->app->DB->Select('SELECT MAX(id) FROM firmendaten LIMIT 1');
if ($this->app->DB->Select("SHOW COLUMNS FROM firmendaten LIKE '$field'")) {
$firmendaten_value = $this->app->DB->Select( $firmendaten_value = $this->app->DB->Select(
sprintf( sprintf(
'SELECT `%s` FROM firmendaten WHERE id = %d LIMIT 1', 'SELECT `%s` FROM firmendaten WHERE id = %d LIMIT 1',
$field, $firmendatenid) $field, $firmendatenid)
); );
}
if(!$this->app->DB->error()) { if(!$this->app->DB->error()) {
return $firmendaten_value; return $firmendaten_value;
} }
@ -44997,6 +45002,10 @@ function Firmendaten($field,$projekt="")
} }
} }
if(is_null($rabatt)) {
$rabatt = 0;
}
if(!$guenstigste_vk) if(!$guenstigste_vk)
{ {
$vkarr = $this->app->DB->SelectArr("SELECT v.*,if((v.adresse > 0 OR v.gruppe > 0),v.preis,(v.preis*(100-$rabatt))/100.0) as rabattpreis FROM verkaufspreise v WHERE $vkarr = $this->app->DB->SelectArr("SELECT v.*,if((v.adresse > 0 OR v.gruppe > 0),v.preis,(v.preis*(100-$rabatt))/100.0) as rabattpreis FROM verkaufspreise v WHERE

View File

@ -2493,12 +2493,25 @@ class Briefpapier extends SuperFPDF {
$belege_stuecklisteneinrueckenmm = $this->getStyleElement('belege_stuecklisteneinrueckenmm'); $belege_stuecklisteneinrueckenmm = $this->getStyleElement('belege_stuecklisteneinrueckenmm');
$doctype = $this->table?$this->table:$this->doctype; $doctype = $this->table?$this->table:$this->doctype;
$doctypeId = $this->id; $doctypeId = $this->id;
$has_steuer = $this->app->DB->Select("SHOW COLUMNS FROM `$doctype` LIKE 'steuersatz_normal'");
if ($has_steuer) {
$docArr = $this->app->DB->SelectRow( $docArr = $this->app->DB->SelectRow(
sprintf( sprintf(
'SELECT projekt,adresse,steuersatz_normal,steuersatz_ermaessigt FROM `%s` WHERE id = %d', 'SELECT projekt,adresse,steuersatz_normal,steuersatz_ermaessigt FROM `%s` WHERE id = %d',
$doctype, $doctypeId $doctype, $doctypeId
) )
); );
} else {
$docArr = $this->app->DB->SelectRow(
sprintf(
'SELECT projekt,adresse, 0 AS steuersatz_normal, 0 AS steuersatz_ermaessigt FROM `%s` WHERE id = %d',
$doctype, $doctypeId
)
);
}
$query = sprintf("SELECT `sprache` FROM `%s` $query = sprintf("SELECT `sprache` FROM `%s`
WHERE `id` = %d WHERE `id` = %d
LIMIT 1", LIMIT 1",
@ -2514,16 +2527,26 @@ class Briefpapier extends SuperFPDF {
} }
$inventurohnepreis = null; $inventurohnepreis = null;
if(!in_array($this->table ? $this->table : $this->doctype, ['rechnung','auftrag','angebot','bestellung'])) { if(!in_array($this->table ? $this->table : $this->doctype, ['rechnung','auftrag','angebot','bestellung'])) {
$from = $this->table ? $this->table : $this->doctype;
if ($this->app->DB->Select("SHOW COLUMNS FROM `$from` LIKE 'noprice'")) {
$inventurohnepreis = $this->app->DB->Select( $inventurohnepreis = $this->app->DB->Select(
sprintf( sprintf(
'SELECT noprice 'SELECT noprice
FROM `%s` FROM `%s`
WHERE id = %d WHERE id = %d
LIMIT 1', LIMIT 1',
$this->table ? $this->table : $this->doctype, $this->id $from,
$this->id
) )
); );
} }
else {
$inventurohnepreis = false;
}
}
if($inventurohnepreis){ if($inventurohnepreis){
$descWidth += 40; $descWidth += 40;
} }

View File

@ -3073,8 +3073,11 @@ select a.kundennummer, (SELECT name FROM adresse a2 WHERE a2.kundennummer = a.ku
".$artikelnummer_suche_where." ".$artikelnummer_suche_where."
AND ($subwhere) $tmp_where LIMIT 20"); AND ($subwhere) $tmp_where LIMIT 20");
if ($module != "") {
if ($this->app->DB->Select("SHOW COLUMNS FROM `$module` LIKE 'realrabatt'")) {
$rabatt = $this->app->DB->Select("SELECT realrabatt FROM $smodule WHERE id='$sid' LIMIT 1"); $rabatt = $this->app->DB->Select("SELECT realrabatt FROM $smodule WHERE id='$sid' LIMIT 1");
}
}
$sql_erweiterung = ''; $sql_erweiterung = '';
$carr = !empty($arr)?count($arr):0; $carr = !empty($arr)?count($arr):0;
for($i=0;$i<$carr;$i++) { for($i=0;$i<$carr;$i++) {

View File

@ -3678,7 +3678,14 @@ class Artikel extends GenArtikel {
$id = $this->app->DB->Select("SELECT id FROM artikel WHERE nummer='$id' AND intern_gesperrt!=1 LIMIT 1"); $id = $this->app->DB->Select("SELECT id FROM artikel WHERE nummer='$id' AND intern_gesperrt!=1 LIMIT 1");
$warnung = 1-(int)$this->app->DB->Select("SELECT if(rabatt=1,1,vkmeldungunterdruecken) FROM artikel WHERE id = '$id' LIMIT 1"); $warnung = 1-(int)$this->app->DB->Select("SELECT if(rabatt=1,1,vkmeldungunterdruecken) FROM artikel WHERE id = '$id' LIMIT 1");
$adresse = $this->app->DB->Select("SELECT adresse FROM $smodule WHERE id='$sid' LIMIT 1"); $adresse = $this->app->DB->Select("SELECT adresse FROM $smodule WHERE id='$sid' LIMIT 1");
if (!is_null($module)) {
if ($this->app->DB->Select("SHOW COLUMNS FROM `$module` LIKE 'waehrung'")) {
$waehrung = $this->app->DB->Select("SELECT waehrung FROM $smodule WHERE id='$sid' LIMIT 1"); $waehrung = $this->app->DB->Select("SELECT waehrung FROM $smodule WHERE id='$sid' LIMIT 1");
}
}
$posanz = (int)$this->app->DB->Select("SELECT count(id) FROM $smodule"."_position WHERE $smodule = '$sid'"); $posanz = (int)$this->app->DB->Select("SELECT count(id) FROM $smodule"."_position WHERE $smodule = '$sid'");
//if($posanz == 0){ //if($posanz == 0){
// $waehrung = ''; // $waehrung = '';

View File

@ -319,7 +319,7 @@ class Lieferschein extends GenLieferschein
$id = (int)$this->app->Secure->GetGET('id'); $id = (int)$this->app->Secure->GetGET('id');
$table = new EasyTable($this->app); $table = new EasyTable($this->app);
$table->Query("SELECT date_format(datum,'%d.%m.%Y') as Datum,belegnr as Lieferschein FROM lieferschein WHERE kommissionierung = '$id' ORDER BY id"); $table->Query("SELECT date_format(datum,'%d.%m.%Y') as Datum,belegnr as Lieferschein FROM lieferschein WHERE kommissionierung = '$id' ORDER BY id",0,"");
echo $table->DisplayNew('return', 'Lieferschein', 'noAction'); echo $table->DisplayNew('return', 'Lieferschein', 'noAction');
exit; exit;
} }
@ -510,11 +510,11 @@ class Lieferschein extends GenLieferschein
if(a.porto,'-',if((SELECT SUM(l.menge) FROM lager_platz_inhalt l WHERE l.artikel=ap.artikel) > ap.menge,(SELECT SUM(l.menge) FROM lager_platz_inhalt l WHERE l.artikel=ap.artikel), if(a.porto,'-',if((SELECT SUM(l.menge) FROM lager_platz_inhalt l WHERE l.artikel=ap.artikel) > ap.menge,(SELECT SUM(l.menge) FROM lager_platz_inhalt l WHERE l.artikel=ap.artikel),
if((SELECT SUM(l.menge) FROM lager_platz_inhalt l WHERE l.artikel=ap.artikel)>0,CONCAT('<font color=red><b>',(SELECT SUM(l.menge) FROM lager_platz_inhalt l WHERE l.artikel=ap.artikel),'</b></font>'), if((SELECT SUM(l.menge) FROM lager_platz_inhalt l WHERE l.artikel=ap.artikel)>0,CONCAT('<font color=red><b>',(SELECT SUM(l.menge) FROM lager_platz_inhalt l WHERE l.artikel=ap.artikel),'</b></font>'),
if(a.lagerartikel=1,'<font color=red><b>aus</b></font>','kein Lagerartikel' ))) as L if(a.lagerartikel=1,'<font color=red><b>aus</b></font>','kein Lagerartikel' ))) as L
FROM lieferschein_position ap, artikel a WHERE ap.lieferschein='$id' AND a.id=ap.artikel"); FROM lieferschein_position ap, artikel a WHERE ap.lieferschein='$id' AND a.id=ap.artikel",0,"");
$artikel = $table->DisplayNew("return","A","noAction"); $artikel = $table->DisplayNew("return","A","noAction");
} else { } else {
$table->Query("SELECT SUBSTRING(ap.bezeichnung,1,20) as artikel, ap.nummer as Nummer, ap.menge as M $table->Query("SELECT SUBSTRING(ap.bezeichnung,1,20) as artikel, ap.nummer as Nummer, ap.menge as M
FROM lieferschein_position ap, artikel a WHERE ap.lieferschein='$id' AND a.id=ap.artikel"); FROM lieferschein_position ap, artikel a WHERE ap.lieferschein='$id' AND a.id=ap.artikel",0,"");
$artikel = $table->DisplayNew("return","Menge","noAction"); $artikel = $table->DisplayNew("return","Menge","noAction");
} }
echo $artikel; echo $artikel;
@ -931,7 +931,7 @@ class Lieferschein extends GenLieferschein
WHERE ap.id IN (".$positionIdsImplode.") AND ap.lieferschein='$id' WHERE ap.id IN (".$positionIdsImplode.") AND ap.lieferschein='$id'
ORDER BY ap.sort, ap.id"; ORDER BY ap.sort, ap.id";
$table->Query($sql); $table->Query($sql,0,"");
$gewichtanzeigen = false; $gewichtanzeigen = false;
if($table->datasets) { if($table->datasets) {
foreach($table->datasets as $k => $row) { foreach($table->datasets as $k => $row) {
@ -1019,7 +1019,9 @@ class Lieferschein extends GenLieferschein
} }
} }
if (!is_null($tmp)) {
$this->app->Tpl->Set('TRACKING',implode(', ',$tmp)); $this->app->Tpl->Set('TRACKING',implode(', ',$tmp));
}
$returnOrders = (array)$this->app->DB->SelectArr( $returnOrders = (array)$this->app->DB->SelectArr(
@ -1057,7 +1059,7 @@ class Lieferschein extends GenLieferschein
$this->app->Tpl->Set('LIEFERADRESSE',$this->Lieferadresse($auftragArr[0]['id'])); $this->app->Tpl->Set('LIEFERADRESSE',$this->Lieferadresse($auftragArr[0]['id']));
$tmp = new EasyTable($this->app); $tmp = new EasyTable($this->app);
$tmp->Query("SELECT zeit,bearbeiter,grund FROM lieferschein_protokoll WHERE lieferschein='$id' ORDER by zeit DESC"); $tmp->Query("SELECT zeit,bearbeiter,grund FROM lieferschein_protokoll WHERE lieferschein='$id' ORDER by zeit DESC",0,"");
$tmp->DisplayNew('PROTOKOLL',"Protokoll","noAction"); $tmp->DisplayNew('PROTOKOLL',"Protokoll","noAction");
if(class_exists('LieferscheinPDFCustom')) if(class_exists('LieferscheinPDFCustom'))
@ -1145,11 +1147,13 @@ class Lieferschein extends GenLieferschein
} }
$name = $this->app->DB->Select("SELECT a.name FROM lieferschein b LEFT JOIN adresse a ON a.id=b.adresse WHERE b.id='$id' LIMIT 1"); $name = $this->app->DB->Select("SELECT a.name FROM lieferschein b LEFT JOIN adresse a ON a.id=b.adresse WHERE b.id='$id' LIMIT 1");
/*
$summe = $this->app->DB->Select("SELECT FORMAT(SUM(menge*preis),2) FROM lieferschein_position $summe = $this->app->DB->Select("SELECT FORMAT(SUM(menge*preis),2) FROM lieferschein_position
WHERE lieferschein='$id'"); WHERE lieferschein='$id'");
$waehrung = $this->app->DB->Select("SELECT waehrung FROM lieferschein_position $waehrung = $this->app->DB->Select("SELECT waehrung FROM lieferschein_position
WHERE lieferschein='$id' LIMIT 1"); WHERE lieferschein='$id' LIMIT 1");
*/
$extra = $this->app->erp->CheckboxEntwurfsmodus("lieferschein",$id); $extra = $this->app->erp->CheckboxEntwurfsmodus("lieferschein",$id);
@ -1494,7 +1498,7 @@ class Lieferschein extends GenLieferschein
$this->app->Tpl->Set('TABTEXT',"Protokoll"); $this->app->Tpl->Set('TABTEXT',"Protokoll");
$tmp = new EasyTable($this->app); $tmp = new EasyTable($this->app);
$tmp->Query("SELECT zeit,bearbeiter,grund FROM lieferschein_protokoll WHERE lieferschein='$id' ORDER by zeit DESC"); $tmp->Query("SELECT zeit,bearbeiter,grund FROM lieferschein_protokoll WHERE lieferschein='$id' ORDER by zeit DESC",0,"");
$tmp->DisplayNew('TAB1',"Protokoll","noAction"); $tmp->DisplayNew('TAB1',"Protokoll","noAction");
$this->app->Tpl->Parse('PAGE',"tabview.tpl"); $this->app->Tpl->Parse('PAGE',"tabview.tpl");
@ -1910,7 +1914,7 @@ class Lieferschein extends GenLieferschein
$table = new EasyTable($this->app); $table = new EasyTable($this->app);
$table->Query("SELECT nummer as Nummer, bezeichnung, menge,vpe as VPE $table->Query("SELECT nummer as Nummer, bezeichnung, menge,vpe as VPE
FROM lieferschein_position FROM lieferschein_position
WHERE lieferschein='$id'"); WHERE lieferschein='$id'",0,"");
$table->DisplayNew('POSITIONEN',"VPE","noAction"); $table->DisplayNew('POSITIONEN',"VPE","noAction");
$status= $this->app->DB->Select("SELECT status FROM lieferschein WHERE id='$id' LIMIT 1"); $status= $this->app->DB->Select("SELECT status FROM lieferschein WHERE id='$id' LIMIT 1");

View File

@ -301,6 +301,7 @@ function fillArtikelProduktion(id,menge)
strSource = "./index.php"; strSource = "./index.php";
id = $.base64Encode( id); id = $.base64Encode( id);
strData = "module=artikel&action=ajaxwerte&id="+id+"&smodule=[MODULE]&sid=[KID]&menge="+menge; strData = "module=artikel&action=ajaxwerte&id="+id+"&smodule=[MODULE]&sid=[KID]&menge="+menge;
intType= 0; //GET intType= 0; //GET
@ -320,7 +321,11 @@ function fillArtikelLieferschein(id,menge)
if(menge < 1) if(menge < 1)
menge=1; menge=1;
strSource = "./index.php"; strSource = "./index.php";
id = $.base64Encode( id);
// Force string type
id = ""+id;
id = $.base64Encode(id);
strData = "module=artikel&action=ajaxwerte&id="+id+"&smodule=[MODULE]&sid=[KID]&menge="+menge; strData = "module=artikel&action=ajaxwerte&id="+id+"&smodule=[MODULE]&sid=[KID]&menge="+menge;
intType= 0; //GET intType= 0; //GET
intID = 0; intID = 0;