mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-25 06:00:28 +01:00
stueckliste import moved to importvorlage
This commit is contained in:
parent
b497d65d81
commit
cd3c0f2113
@ -6090,7 +6090,7 @@ class Artikel extends GenArtikel {
|
|||||||
|
|
||||||
$stueck = $this->app->erp->ArtikelAnzahlLagerStueckliste($id);
|
$stueck = $this->app->erp->ArtikelAnzahlLagerStueckliste($id);
|
||||||
|
|
||||||
$this->ArtikelStuecklisteImport('TAB3');
|
// $this->ArtikelStuecklisteImport('TAB3');
|
||||||
$url = 'index.php?module=artikel&action=stueckliste&cmd=getbaum&id='.$id;
|
$url = 'index.php?module=artikel&action=stueckliste&cmd=getbaum&id='.$id;
|
||||||
$this->app->Tpl->Set('URL',$url);
|
$this->app->Tpl->Set('URL',$url);
|
||||||
$this->app->Tpl->Add('TAB1',"<center>");
|
$this->app->Tpl->Add('TAB1',"<center>");
|
||||||
@ -6255,8 +6255,8 @@ class Artikel extends GenArtikel {
|
|||||||
{
|
{
|
||||||
$id = $this->app->Secure->GetGET('id');
|
$id = $this->app->Secure->GetGET('id');
|
||||||
if($id > 0){
|
if($id > 0){
|
||||||
$result = $this->app->DB->SelectArr("SELECT a.nummer, a.name_de, a.hersteller,a.herstellernummer, REPLACE(TRIM(s.menge)+0,'.',',') as menge, s.referenz, s.place, s.layer, s.wert, s.bauform, s.zachse,s.xpos, s.ypos, s.art FROM stueckliste s
|
$sql = "SELECT avon.nummer as stuecklistevon, a.nummer, a.name_de, a.hersteller,a.herstellernummer, REPLACE(TRIM(s.menge)+0,'.',',') as menge, s.referenz, s.place, s.layer, s.wert, s.bauform, s.zachse,s.xpos, s.ypos, s.art FROM stueckliste s LEFT JOIN artikel a ON a.id=s.artikel LEFT JOIN artikel avon ON avon.id=s.stuecklistevonartikel WHERE s.stuecklistevonartikel='$id'";
|
||||||
LEFT JOIN artikel a ON a.id=s.artikel WHERE s.stuecklistevonartikel='$id'");
|
$result = $this->app->DB->SelectArr($sql);
|
||||||
}
|
}
|
||||||
header('Content-type: text/csv');
|
header('Content-type: text/csv');
|
||||||
header('Content-Disposition: attachment; filename=file.csv');
|
header('Content-Disposition: attachment; filename=file.csv');
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
<li><a href="#tabs-5">{|Notizen|}</a></li>
|
<li><a href="#tabs-5">{|Notizen|}</a></li>
|
||||||
<li><a href="#tabs-6">{|Kontenrahmen|}</a></li>
|
<li><a href="#tabs-6">{|Kontenrahmen|}</a></li>
|
||||||
<li><a href="#tabs-7">{|Kontoauszug|}</a></li>
|
<li><a href="#tabs-7">{|Kontoauszug|}</a></li>
|
||||||
|
<li><a href="#tabs-8">{|Stückliste|}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div id="tabs-1">
|
<div id="tabs-1">
|
||||||
@ -612,6 +613,83 @@
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="tabs-8">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12 col-sm-1 col-sm-height">
|
||||||
|
<div class="inside inside-full-height">
|
||||||
|
<fieldset><legend>{|Stückliste|}</legend>
|
||||||
|
<table class="mkTable">
|
||||||
|
<tr>
|
||||||
|
<th>Variable</th>
|
||||||
|
<th>Beschreibung</th>
|
||||||
|
<th>Kommentar</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>stuecklistevonartikel</td>
|
||||||
|
<td>Hauptartikel (muss eine Stückliste sein)</td>
|
||||||
|
<td>Artikelnummer</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>artikel</td>
|
||||||
|
<td></td>
|
||||||
|
<td>Artikelnummer</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>menge</td>
|
||||||
|
<td>Zahl</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>referenz</td>
|
||||||
|
<td>Text</td>
|
||||||
|
<td>Für Bestückungen</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>place</td>
|
||||||
|
<td>Leer oder 'DNP' = Nicht platzieren</td>
|
||||||
|
<td>Für Bestückungen</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>layer</td>
|
||||||
|
<td>"top" oder "bottom"</td>
|
||||||
|
<td>Für Bestückungen</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>wert</td>
|
||||||
|
<td>Text</td>
|
||||||
|
<td>Für Bestückungen</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bauform</td>
|
||||||
|
<td>Text</td>
|
||||||
|
<td>Für Bestückungen</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>zachse</td>
|
||||||
|
<td>Zahl</td>
|
||||||
|
<td>Für Bestückungen</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>xpos</td>
|
||||||
|
<td>Zahl</td>
|
||||||
|
<td>Für Bestückungen</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>ypos</td>
|
||||||
|
<td>Zahl</td>
|
||||||
|
<td>Für Bestückungen</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>art</td>
|
||||||
|
<td>Einkaufsteil "et",Informationsteil "it" oder Beistellung "bt"</td>
|
||||||
|
<td>Alternativposition?</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,12 +3,6 @@
|
|||||||
|
|
||||||
|
|
||||||
<div id="tabs">
|
<div id="tabs">
|
||||||
<ul>
|
|
||||||
<li><a href="#tabs-1">Übersicht</a></li>
|
|
||||||
<!--<li><a href="#tabs-2">neue Position anlegen</a></li>-->
|
|
||||||
<li><a href="#tabs-3">Stückliste importieren</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<!-- erstes tab -->
|
<!-- erstes tab -->
|
||||||
<div id="tabs-1">
|
<div id="tabs-1">
|
||||||
[MESSAGE]
|
[MESSAGE]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li><a href="#tabs-1">Übersicht</a></li>
|
<li><a href="#tabs-1">Übersicht</a></li>
|
||||||
<li><a href="#tabs-2">neue Position anlegen</a></li>
|
<li><a href="#tabs-2">neue Position anlegen</a></li>
|
||||||
<li><a href="#tabs-3">Stückliste importieren</a></li>
|
<!-- DEPRECATED moved to importvorlage <li><a href="#tabs-3">Stückliste importieren</a></li> -->
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!-- erstes tab -->
|
<!-- erstes tab -->
|
||||||
@ -26,4 +26,4 @@
|
|||||||
|
|
||||||
<!-- tab view schließen -->
|
<!-- tab view schließen -->
|
||||||
</div>
|
</div>
|
||||||
<!-- ende tab view schließen -->
|
<!-- ende tab view schließen -->
|
||||||
|
@ -5084,7 +5084,6 @@ class Importvorlage extends GenImportvorlage {
|
|||||||
$allowed_fields = array('konto','buchung','betrag','betrag2','waehrung','buchungstext','buchungstext2','buchungstext3','buchungstext4');
|
$allowed_fields = array('konto','buchung','betrag','betrag2','waehrung','buchungstext','buchungstext2','buchungstext3','buchungstext4');
|
||||||
|
|
||||||
$error = false;
|
$error = false;
|
||||||
|
|
||||||
// Create a row dataset (without checked and cmd)
|
// Create a row dataset (without checked and cmd)
|
||||||
$update_sql = "";
|
$update_sql = "";
|
||||||
$row = array();
|
$row = array();
|
||||||
@ -5165,6 +5164,60 @@ class Importvorlage extends GenImportvorlage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case 'stueckliste':
|
||||||
|
|
||||||
|
$allowed_fields = array('stuecklistevonartikel','artikel','menge','art','referenz','layer','wert','bauform','xpos','ypos','zachse','place');
|
||||||
|
|
||||||
|
// Create a row dataset (without checked and cmd)
|
||||||
|
$row = array();
|
||||||
|
$error_text = "";
|
||||||
|
|
||||||
|
$error = $this->create_row_set($tmp, $i, $allowed_fields, $row, $error_text);
|
||||||
|
|
||||||
|
if ($error !== false) {
|
||||||
|
$sql = "SELECT id FROM artikel WHERE stueckliste = 1 AND nummer = '".$row['stuecklistevonartikel']."'";
|
||||||
|
$von_id = $this->app->DB->SelectArr($sql);
|
||||||
|
if (empty($von_id)) {
|
||||||
|
$msg .= "Fehlerhafter 'Stueckliste von'-Artikel \"".$row['stuecklistevonartikel']."\"<br>";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$row['stuecklistevonartikel'] = $von_id[0]['id'];
|
||||||
|
|
||||||
|
$sql = "SELECT id FROM artikel WHERE nummer = '".$row['artikel']."'";
|
||||||
|
$artikel_id = $this->app->DB->SelectArr($sql);
|
||||||
|
if (empty($artikel_id)) {
|
||||||
|
$msg .= "Fehlerhafter Artikel \"".$row['artikel']."\"<br>";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$row['artikel'] = $artikel_id[0]['id'];
|
||||||
|
|
||||||
|
if(empty($row['menge'])) {
|
||||||
|
$row['menge'] = 1;
|
||||||
|
}
|
||||||
|
if(empty($row['art'])) {
|
||||||
|
$row['art'] = 'et';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($row['place']) || $row['place'] == 'DNP') {
|
||||||
|
$row['place'] = 'DNP';
|
||||||
|
} else {
|
||||||
|
$row['place'] = 'DP';
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "INSERT INTO stueckliste (".
|
||||||
|
implode(", ",array_keys($row)).
|
||||||
|
") VALUES ('".
|
||||||
|
implode("', '",array_values($row)).
|
||||||
|
"')";
|
||||||
|
|
||||||
|
$result = $this->app->DB->Update($sql);
|
||||||
|
|
||||||
|
} else if(!$first_checked) {
|
||||||
|
$first_checked = true;
|
||||||
|
$msg .= $error_text;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// HERE END OF PROCESSING THE ROWS switch($ziel);
|
// HERE END OF PROCESSING THE ROWS switch($ziel);
|
||||||
@ -6252,5 +6305,28 @@ class Importvorlage extends GenImportvorlage {
|
|||||||
|
|
||||||
return $normalizedDate;
|
return $normalizedDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create a cleaned row set
|
||||||
|
* Return true if ok, else see error_message
|
||||||
|
*/
|
||||||
|
private function create_row_set(array $tmp, $pos, array $allowed_fields, array &$result_row, string &$error_message) : bool {
|
||||||
|
$result_ok = true;
|
||||||
|
$result_row = array();
|
||||||
|
$error_message = "";
|
||||||
|
foreach ($tmp as $key => $value) {
|
||||||
|
if ($key != 'cmd' && $key != 'checked') {
|
||||||
|
if (in_array($key,$allowed_fields)) {
|
||||||
|
$result_row[$key] = $value[$pos];
|
||||||
|
} else {
|
||||||
|
$error_message .= "Feld nicht korrekt: ".$key.".<br>";
|
||||||
|
$result_ok = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return($result_ok);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +80,7 @@ class WidgetGenimportvorlage
|
|||||||
$field->AddOption('Notizen (min. Angabe: datum,kundennummer,mitarbeiternummer,betreff)','notizen');
|
$field->AddOption('Notizen (min. Angabe: datum,kundennummer,mitarbeiternummer,betreff)','notizen');
|
||||||
$field->AddOption('Kontenrahmen (min. Angabe: sachkonto,beschriftung,art)','kontorahmen');
|
$field->AddOption('Kontenrahmen (min. Angabe: sachkonto,beschriftung,art)','kontorahmen');
|
||||||
$field->AddOption('Kontoauszug','kontoauszug');
|
$field->AddOption('Kontoauszug','kontoauszug');
|
||||||
|
$field->AddOption('Stückliste','stueckliste');
|
||||||
$this->form->NewField($field);
|
$this->form->NewField($field);
|
||||||
|
|
||||||
$field = new HTMLInput("importerstezeilenummer","text","","15","","","","","","","","0","","");
|
$field = new HTMLInput("importerstezeilenummer","text","","15","","","","","","","","0","","");
|
||||||
|
Loading…
Reference in New Issue
Block a user