X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=lxo-import%2Fparts_import.php;h=94f2b6f15fc9db8ef8a77bf68808154b32a3f998;hb=39294de3fcf40d987865ff17ddab1de070c29f63;hp=0db931230016d76c2a41bb932b50a11e7cad2c28;hpb=0a1bea675b76367bf2fb15ffb3213fee858c9803;p=kivitendo-erp.git
diff --git a/lxo-import/parts_import.php b/lxo-import/parts_import.php
index 0db931230..94f2b6f15 100644
--- a/lxo-import/parts_import.php
+++ b/lxo-import/parts_import.php
@@ -128,11 +128,13 @@ function updParts($db,$insert,$show,$partnumber,$lastcost,$sellprice,$listprice,
return $rc;
}
-function getMakemodel($db,$check,$hersteller,$model,$partsid,$add=true) {
+function getMakemodel($db,$check,$hersteller,$model,$partsid,$lastcost,$add=true) {
$sql="select * from makemodel where make = $hersteller and model = '$model' and parts_id = $partsid";
$rs=$db->getAll($sql);
if (empty($rs[0]["id"]) && $add) {
- $sql="insert into makemodel (parts_id,make,model) values ($partsid,'$hersteller','$model')";
+ if (!$lastcost) $lastcost=0.00;
+ $sql="insert into makemodel (parts_id,make,model,lastcost,lastupdate,sortorder) ";
+ $sql.="values ($partsid,'$hersteller','$model',$lastcost,now(),1)";
$rc=$db->query($sql);
}
}
@@ -251,6 +253,8 @@ function import_parts($db, $file, $fields, $check, $maske) {
$wgtrenner=$maske["wgtrenner"];
$Update=($maske["update"]=="U")?true:false;
$UpdText=($maske["TextUpd"]=="1")?true:false;
+ $vendnr=($maske["vendnr"]=="t")?true:false;
+ $modnr=($maske["modnr"]=="t")?true:false;
//$stdunitW=getStdUnit($db,"dimension");
//$stdunitD=getStdUnit($db,"service");
@@ -293,12 +297,12 @@ function import_parts($db, $file, $fields, $check, $maske) {
*/
if ($show) {
show('
',false);
- show("partnumber"); show("lastcost"); show("sellprice"); show("listprice");
- show("description");show("notes"); show("ean");
- show("weight"); show("image"); show("partsgroup_id");
- show("bg"); show("income_accno"); show("expense_accno");
- show("inventory_accno"); show("microfiche");show("drawing");show("rop");
- show("assembly");show("makemodel"); show("shop"); show("");
+ show("partnumber"); show("lastcost"); show("sellprice"); show("listprice");
+ show("description"); show("notes"); show("ean");
+ show("weight"); show("image"); show("partsgroup_id");
+ show("bg"); show("income_accno"); show("expense_accno");
+ show("inventory_accno"); show("microfiche"); show("drawing");
+ show("rop"); show("assembly"); show("makemodel"); show("shop"); show("");
show("
\n",false);
}
@@ -342,8 +346,8 @@ function import_parts($db, $file, $fields, $check, $maske) {
foreach ($prices as $pkey=>$val) {
if (array_key_exists($pkey,$fldpos))
$pricegroup[$val] = str_replace(",", ".", $zeile[$fldpos[$pkey]]);
- }
- }
+ }
+ }
if ($quotation<>0) {
if ($quottype=="A") { $sellprice += $quotation; }
else { $sellprice = $sellprice * $quotation; }
@@ -383,32 +387,39 @@ function import_parts($db, $file, $fields, $check, $maske) {
$partsgroup_id = getPartsgroupId($db, $pgname, $insert);
}
+ /* Ware oder Dienstleistung */
+ if (($maske["ware"]=="G" and strtoupper($zeile[$fldpos["art"]])=="D") or $maske["ware"]=="D") {
+ $artikel = false;
+ } else if (($maske["ware"]=="G" and strtoupper($zeile[$fldpos["art"]])=="W") or $maske["ware"]=="W") {
+ $artikel = true;
+ }
+
/* sind Hersteller und Modelnummer hinterlegt
wenn ja, erfolgt er insert später */
$makemodel = 'f';
- if (!empty($zeile[$fldpos["makemodel"]]) and !$artikel) {
+ if (!empty($zeile[$fldpos["makemodel"]]) and $artikel) {
$mm = $zeile[$fldpos["makemodel"]];
if (Translate) translate($mm);
- $hersteller=suchFirma("vendor",$mm);
- $hersteller=$hersteller["cp_cv_id"];
- if (!empty($zeile[$fldpos["model"]])) {
+ if ($vendnr) {
+ $hersteller=getFirma($mm,"vendor");
+ } else {
+ $hersteller=suchFirma("vendor",$mm);
+ $hersteller=$hersteller["cp_cv_id"];
+ }
+ if (!empty($zeile[$fldpos["model"]]) and $hersteller>0) {
$mo = $zeile[$fldpos["model"]];
if (Translate) translate($mo);
$model = $mo;
$makemodel = 't';
- } else {
+ } else if ($modnr and $hersteller>0) {
+ $model = '';
+ $makemodel = 't';
+ } else {
unset($hersteller);
$makemodel = 'f';
}
}
- /* Ware oder Dienstleistung */
- if (($maske["ware"]=="G" and strtoupper($zeile[$fldpos["art"]])=="D") or $maske["ware"]=="D") {
- $artikel = false;
- } else if (($maske["ware"]=="G" and strtoupper($zeile[$fldpos["art"]])=="W") or $maske["ware"]=="W") {
- $artikel = true;
- }
-
/* Einheit ermitteln */
if ($zeile[$fldpos["unit"]]=="") {
//Keine Einheit mitgegeben
@@ -523,10 +534,10 @@ function import_parts($db, $file, $fields, $check, $maske) {
"rop"=>$rop,"assembly"=>$assembly,
"shop"=>$shop,"makemodel"=>$makemodel),$pricegroup
);
- if ($hersteller>0 && $model) {
+ if ($hersteller>0 ) { // && $model) {
$partsid=getPartsid($db,$zeile[$fldpos["partnumber"]]);
- if ($partsid) {
- getMakemodel($db,$check,$hersteller,$model,$partsid,true);
+ if ($partsid) {
+ getMakemodel($db,$check,$hersteller,$model,$partsid,$lastcost,true);
}
}
unset($zeile);