mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
Merge branch 'amperios'
This commit is contained in:
commit
6caa711f48
@ -1122,6 +1122,15 @@ class YUI {
|
||||
return $newid;
|
||||
}
|
||||
|
||||
/*
|
||||
* Move all special fields by one position after a certain position
|
||||
* Use after inserting a position
|
||||
*/
|
||||
function pushDrawItem($module, $id, $pos) {
|
||||
$sql = "UPDATE `beleg_zwischenpositionen` set `pos` = `pos`+1 WHERE `pos` > $pos AND `doctype` = '$module' AND `doctypeid` = '$id'";
|
||||
$this->app->DB->Update($sql);
|
||||
}
|
||||
|
||||
function ReSortDrawItem($module, $id)
|
||||
{
|
||||
$items = $this->app->DB->SelectArr("SELECT id, pos, sort FROM beleg_zwischenpositionen WHERE doctype = '".$module."' AND doctypeid = '$id' ORDER BY pos, sort");
|
||||
@ -1820,8 +1829,16 @@ class YUI {
|
||||
)
|
||||
);
|
||||
$projekt = $this->app->DB->Select("SELECT id FROM projekt WHERE abkuerzung='$projekt' LIMIT 1");
|
||||
$sort = $this->app->DB->Select("SELECT MAX(sort) FROM $table WHERE $module='$id' LIMIT 1");
|
||||
$sort = $sort + 1;
|
||||
|
||||
$insertbefore = $this->app->Secure->GetPOST("insertbefore");
|
||||
if (is_numeric($insertbefore)) {
|
||||
$sort = $insertbefore - 1;
|
||||
$reload_afterwards = true;
|
||||
} else {
|
||||
$sort = $this->app->DB->Select("SELECT MAX(sort) FROM $table WHERE $module='$id' LIMIT 1");
|
||||
$sort = $sort + 1;
|
||||
}
|
||||
|
||||
$adresse = $docArr['adresse'];// $this->app->DB->Select("SELECT adresse FROM $module WHERE id='$id' LIMIT 1");
|
||||
$sprache = $docArr['sprache'];//$this->app->DB->Select("SELECT sprache FROM $module WHERE id='$id' LIMIT 1");
|
||||
if($sprache=='') {
|
||||
@ -3043,6 +3060,13 @@ class YUI {
|
||||
}
|
||||
$this->app->Tpl->Add('PAGE', "</fieldset>");
|
||||
}
|
||||
|
||||
if ($reload_afterwards) {
|
||||
$this->pushDrawItem($module,$id,$sort);
|
||||
header('Location: index.php?module='.$module.'&action=positionen&id='.$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function FormatPreis($spalte)
|
||||
@ -14792,7 +14816,7 @@ source: "index.php?module=ajax&action=filter&filtername=' . $filter . $extendurl
|
||||
if ($module == "angebot" || $module == "auftrag" || $module == "rechnung" || $module == "gutschrift" || $module == "proformarechnung") {
|
||||
|
||||
if ($schreibschutz != 1) {
|
||||
$addrow = array('<form action="" method="post" id="myform">', '[ARTIKELSTART]<input type="text" size="30" name="artikel" id="artikel" onblur="window.setTimeout(\'selectafterblur()\',200);">[ARTIKELENDE]', '<input type="text" name="projekt" id="projekt" size="10" readonly onclick="checkhere()" >', '<input type="text" name="nummer" id="nummer" size="7">', '<input type="text" size="8" name="lieferdatum" id="lieferdatum">', '<input type="text" name="menge" id="menge" size="5" onblur="window.setTimeout(\'selectafterblurmenge()\',200); document.getElementById(\'preis\').style.background =\'none\';">', '<input type="text" name="preis" id="preis" size="10" onclick="checkhere();">', '<input type="text" name="waehrung" id="waehrung" size="10" onclick="checkhere();">' ,'<input type="text" name="rabatt" id="rabatt" size="7">','','');
|
||||
$addrow = array('<form action="" method="post" id="myform"><input type="number" min="1" size="4" name="insertbefore">', '[ARTIKELSTART]<input type="text" size="30" name="artikel" id="artikel" onblur="window.setTimeout(\'selectafterblur()\',200);">[ARTIKELENDE]', '<input type="text" name="projekt" id="projekt" size="10" readonly onclick="checkhere()" >', '<input type="text" name="nummer" id="nummer" size="7">', '<input type="text" size="8" name="lieferdatum" id="lieferdatum">', '<input type="text" name="menge" id="menge" size="5" onblur="window.setTimeout(\'selectafterblurmenge()\',200); document.getElementById(\'preis\').style.background =\'none\';">', '<input type="text" name="preis" id="preis" size="10" onclick="checkhere();">', '<input type="text" name="waehrung" id="waehrung" size="10" onclick="checkhere();">' ,'<input type="text" name="rabatt" id="rabatt" size="7">','','');
|
||||
$addrow[] = '<input type="submit" value="einfügen" name="ajaxbuchen">
|
||||
<script type="text/javascript">
|
||||
document.onkeydown = function(evt) {
|
||||
|
@ -1185,157 +1185,6 @@ class Angebot extends GenAngebot
|
||||
$id = $this->app->Secure->GetGET("id");
|
||||
$this->app->erp->AngebotNeuberechnen($id);
|
||||
$this->app->YUI->AARLGPositionen(false);
|
||||
|
||||
return;
|
||||
|
||||
|
||||
$this->AngebotMenu();
|
||||
$id = $this->app->Secure->GetGET("id");
|
||||
|
||||
/* neu anlegen formular */
|
||||
$artikelart = $this->app->Secure->GetPOST("artikelart");
|
||||
$bezeichnung = $this->app->Secure->GetPOST("bezeichnung");
|
||||
$vpe = $this->app->Secure->GetPOST("vpe");
|
||||
$umsatzsteuerklasse = $this->app->Secure->GetPOST("umsatzsteuerklasse");
|
||||
$waehrung = $this->app->Secure->GetPOST("waehrung");
|
||||
$projekt= $this->app->Secure->GetPOST("projekt");
|
||||
$preis = $this->app->Secure->GetPOST("preis");
|
||||
$preis = str_replace(',','.',$preis);
|
||||
$menge = $this->app->Secure->GetPOST("menge");
|
||||
$lieferdatum = $this->app->Secure->GetPOST("lieferdatum");
|
||||
|
||||
if($lieferdatum=="") $lieferdatum="00.00.0000";
|
||||
|
||||
|
||||
$angebotsart = $this->app->DB->Select("SELECT angebotsart FROM angebot WHERE id='$id' LIMIT 1");
|
||||
$lieferant = $this->app->DB->Select("SELECT adresse FROM angebot WHERE id='$id' LIMIT 1");
|
||||
|
||||
$anlegen_artikelneu = $this->app->Secure->GetPOST("anlegen_artikelneu");
|
||||
|
||||
if($anlegen_artikelneu!="")
|
||||
{
|
||||
|
||||
if($bezeichnung!="" && $menge!="" && $preis!="")
|
||||
{
|
||||
$sort = $this->app->DB->Select("SELECT MAX(sort) FROM angebot_position WHERE angebot='$id' LIMIT 1");
|
||||
$sort = $sort + 1;
|
||||
|
||||
$neue_nummer = $this->app->erp->NeueArtikelNummer($artikelart,$this->app->User->GetFirma(),$projekt);
|
||||
|
||||
// anlegen als artikel
|
||||
$this->app->DB->InserT("INSERT INTO artikel (id,typ,nummer,projekt,name_de,umsatzsteuer,adresse,firma)
|
||||
VALUES ('','$artikelart','$neue_nummer','$projekt','$bezeichnung','$umsatzsteuerklasse','$lieferant','".$this->app->User->GetFirma()."')");
|
||||
|
||||
$artikel_id = $this->app->DB->GetInsertID();
|
||||
// einkaufspreis anlegen
|
||||
|
||||
$this->app->DB->Insert("INSERT INTO verkaufspreise (id,artikel,adresse,objekt,projekt,preis,ab_menge,angelegt_am,bearbeiter)
|
||||
VALUES ('','$artikel_id','$lieferant','Standard','$projekt','$preis','$menge',NOW(),'".$this->app->User->GetName()."')");
|
||||
|
||||
$lieferdatum = $this->app->String->Convert($lieferdatum,"%1.%2.%3","%3-%2-%1");
|
||||
|
||||
$this->app->DB->Insert("INSERT INTO angebot_position (id,angebot,artikel,bezeichnung,nummer,menge,preis, waehrung, sort,lieferdatum, umsatzsteuer, status,projekt,vpe)
|
||||
VALUES ('','$id','$artikel_id','$bezeichnung','$neue_nummer','$menge','$preis','$waehrung','$sort','$lieferdatum','$umsatzsteuerklasse','angelegt','$projekt','$vpe')");
|
||||
|
||||
header("Location: index.php?module=angebot&action=positionen&id=$id");
|
||||
exit;
|
||||
} else
|
||||
$this->app->Tpl->Set('NEUMESSAGE',"<div class=\"error\">Bestellnummer, bezeichnung, Menge und Preis sind Pflichtfelder!</div>");
|
||||
|
||||
}
|
||||
|
||||
$ajaxbuchen = $this->app->Secure->GetPOST("ajaxbuchen");
|
||||
if($ajaxbuchen!="")
|
||||
{
|
||||
$artikel = $this->app->Secure->GetPOST("artikel");
|
||||
$nummer = $this->app->Secure->GetPOST("nummer");
|
||||
$projekt = $this->app->Secure->GetPOST("projekt");
|
||||
$projekt = $this->app->DB->Select("SELECT id FROM projekt WHERE abkuerzung='$projekt' LIMIT 1");
|
||||
$sort = $this->app->DB->Select("SELECT MAX(sort) FROM angebot_position WHERE auftrag='$id' LIMIT 1");
|
||||
$sort = $sort + 1;
|
||||
$artikel_id = $this->app->DB->Select("SELECT id FROM artikel WHERE nummer='$nummer' LIMIT 1");
|
||||
$bezeichnung = $artikel;
|
||||
$neue_nummer = $nummer;
|
||||
$waehrung = 'EUR';
|
||||
$umsatzsteuerklasse = $this->app->DB->Select("SELECT umsatzsteuerklasse FROM artikel WHERE nummer='$nummer' LIMIT 1");
|
||||
$vpe = 'einzeln';
|
||||
|
||||
$this->app->DB->Insert("INSERT INTO angebot_position (id,angebot,artikel,bezeichnung,nummer,menge,preis, waehrung, sort,lieferdatum, umsatzsteuer, status,projekt,vpe)
|
||||
VALUES ('','$id','$artikel_id','$bezeichnung','$neue_nummer','$menge','$preis','$waehrung','$sort','$lieferdatum','$umsatzsteuerklasse','angelegt','$projekt','$vpe')");
|
||||
}
|
||||
$weiter = $this->app->Secure->GetPOST("weiter");
|
||||
if($weiter!="")
|
||||
{
|
||||
header("Location: index.php?module=angebot&action=freigabe&id=$id");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if(1)
|
||||
{
|
||||
$this->app->Tpl->Set('ARTIKELART',$this->app->erp->GetSelect($this->app->erp->GetArtikelart(),$artikelart));
|
||||
$this->app->Tpl->Set('VPE',$this->app->erp->GetSelect($this->app->erp->GetVPE(),$vpe));
|
||||
$this->app->Tpl->Set('WAEHRUNG',$this->app->erp->GetSelect($this->app->erp->GetWaehrung(),$vpe));
|
||||
$this->app->Tpl->Set('UMSATZSTEUERKLASSE',$this->app->erp->GetSelect($this->app->erp->GetUmsatzsteuerklasse(),$umsatzsteuerklasse));
|
||||
$this->app->Tpl->Set('PROJEKT',$this->app->erp->GetProjektSelect($projekt));
|
||||
$this->app->Tpl->Set('PREIS',$preis);
|
||||
$this->app->Tpl->Set('MENGE',$menge);
|
||||
$this->app->Tpl->Set('LIEFERDATUM',$lieferdatum);
|
||||
$this->app->Tpl->Set('BEZEICHNUNG',$bezeichung);
|
||||
$this->app->Tpl->Set('BESTELLNUMMER',$bestellnummer);
|
||||
|
||||
$this->app->Tpl->Set('SUBSUBHEADING',"Neuen Artikel anlegen");
|
||||
$this->app->Tpl->Parse('INHALT',"angebot_artikelneu.tpl");
|
||||
$this->app->Tpl->Set('EXTEND',"<input type=\"submit\" value=\"Artikel unter Stammdaten anlegen\" name=\"anlegen_artikelneu\">");
|
||||
$this->app->Tpl->Parse('UEBERSICHT',"rahmen70.tpl");
|
||||
$this->app->Tpl->Set('EXTEND',"");
|
||||
$this->app->Tpl->Set('INHALT',"");
|
||||
|
||||
/* ende neu anlegen formular */
|
||||
|
||||
|
||||
$this->app->Tpl->Set('SUBSUBHEADING',"Artikelstamm");
|
||||
|
||||
$lieferant = $this->app->DB->Select("SELECT adresse FROM angebot WHERE id='$id' LIMIT 1");
|
||||
|
||||
$table = new EasyTable($this->app);
|
||||
$table->Query("SELECT CONCAT(LEFT(a.name_de,80),'...') as artikel, a.nummer,
|
||||
v.ab_menge as ab, v.preis, p.abkuerzung as projekt,
|
||||
CONCAT('<input type=\"text\" size=\"8\" value=\"00.00.0000\" id=\"datum',v.id,'\">
|
||||
<img src=\"./themes/new/images/kalender.png\" height=\"12\" onclick=\"displayCalendar(document.forms[1].datum',v.id,',\'dd.mm.yyyy\',this)\" border=0 align=right>') as Lieferdatum,
|
||||
CONCAT('<input type=\"text\" size=\"3\" value=\"\" id=\"menge',v.id,'\">') as menge, v.id as id
|
||||
FROM artikel a LEFT JOIN verkaufspreise v ON a.id=v.artikel LEFT JOIN projekt p ON v.projekt=p.id WHERE v.ab_menge>=1",0,"");
|
||||
$table->DisplayNew('INHALT', "<input type=\"button\"
|
||||
onclick=\"document.location.href='index.php?module=angebot&action=addposition&id=$id&sid=%value%&menge=' + document.getElementById('menge%value%').value + '&datum=' + document.getElementById('datum%value%').value;\" value=\"anlegen\">");
|
||||
$this->app->Tpl->Parse('UEBERSICHT',"rahmen70.tpl");
|
||||
$this->app->Tpl->Set('INHALT',"");
|
||||
|
||||
// child table einfuegen
|
||||
|
||||
$this->app->Tpl->Set('SUBSUBHEADING',"Positionen");
|
||||
$menu = array("up"=>"upangebotposition",
|
||||
"down"=>"downangebotposition",
|
||||
//"add"=>"addstueckliste",
|
||||
"edit"=>"positioneneditpopup",
|
||||
"copy"=>"copyangebotposition",
|
||||
"del"=>"delangebotposition");
|
||||
|
||||
$sql = "SELECT a.name_de as Artikel, p.abkuerzung as projekt, a.nummer as nummer, b.nummer as nummer, DATE_FORMAT(lieferdatum,'%d.%m.%Y') as lieferdatum, b.menge as menge, b.preis as preis, b.id as id
|
||||
FROM angebot_position b
|
||||
LEFT JOIN artikel a ON a.id=b.artikel LEFT JOIN projekt p ON b.projekt=p.id
|
||||
WHERE b.angebot='$id'";
|
||||
|
||||
// $this->app->Tpl->Add(EXTEND,"<input type=\"submit\" value=\"Gleiche Positionen zusammenfügen\">");
|
||||
|
||||
$this->app->YUI->SortListAdd('INHALT',$this,$menu,$sql);
|
||||
$this->app->Tpl->Parse('TAB1',"rahmen70.tpl");
|
||||
|
||||
if($anlegen_artikelneu!="")
|
||||
$this->app->Tpl->Set('AKTIV_TAB2',"selected");
|
||||
else
|
||||
$this->app->Tpl->Set('AKTIV_TAB1',"selected");
|
||||
$this->app->Tpl->Parse('PAGE',"angebot_positionuebersicht.tpl");
|
||||
}
|
||||
}
|
||||
|
||||
function CopyAngebotPosition()
|
||||
|
Loading…
Reference in New Issue
Block a user