27 $sSelect =
"select count(oxid) from $sArticleTable ";
28 $iSize = (int) $oDb->getOne($sSelect);
30 if ($iStart < $iSize) {
31 $fp = fopen($sFilepath,
"ab");
34 fwrite($fp,
"\"Artikelnummer\";\"Bezeichnung\";\"Einheit\";\"Gewicht\";\"Matchcode\";\"Preis pro Anzahl\";\"Warengruppe\";\"Warengr.-Kurzbez.\";\"Warengr.-Steuersatz\";\"Warengr.-Konto Inland\";\"Warengr.-Konto Ausland\";\"Warengr.-Konto EG\";\"Preis 1\";\"Preis 2\";\"Preis 3\";\"Preis I/1\";\"Preis I/2\";\"Preis I/3\";\"Preis II/1\";\"Preis II/2\";\"Preis II/3\";\"Preis III/1\";\"Preis III/2\";\"Preis III/3\";\"B/N\";\"Lagerartikel\";\"EK 1\";\"W�hrung EK1\";\"EK 2\";\"W�hrung EK2\";\"Staffelmenge 1\";\"Staffelmenge 2\";\"Staffelmenge 3\";\"Lieferantennummer 1\";\"Lieferantennummer 2\";\"Bestellmenge Lf.1\";\"Bestellmenge Lf.2\";\"Bestellnr. Lf.1\";\"Bestellnr. Lf.2\";\"Lieferzeit Lf.1\";\"Lieferzeit Lf.2\";\"Lagerbestand\";\"Mindestbestand\";\"Lagerort\";\"Bestellte Menge\";\"St�ckliste\";\"Internet\";\"Text\"\r\n");
37 $sSelect =
"select * from $sArticleTable ";
38 $rs = $oDb->selectLimit($sSelect, $iLines, $iStart);
39 $oDb->setFetchMode($oldMode);
42 $oArticle =
oxNew(
"oxarticle");
46 $oArticle->load($rs->fields[
'OXID']);
49 $sSelect =
"select oxtitle from " . $oArticle->getViewName() .
" where oxid = " . $oDb->quote($oArticle->oxarticles__oxparentid->value);
50 $oTitle = $oDb->getOne($sSelect);
51 if ($oTitle !=
false && strlen($oTitle)) {
54 $nTitle = $this->
interForm($oArticle->oxarticles__oxtitle->value);
58 $sToFile = $oArticle->oxarticles__oxartnum->value
60 .
";" . $nTitle .
" " . $this->
interForm($oArticle->oxarticles__oxvarselect->value)
62 .
";" . $oArticle->oxarticles__oxweight->value
63 .
";" . $oArticle->oxarticles__oxartnum->value
71 .
";" . number_format($oArticle->oxarticles__oxprice->value, 2,
'.',
'')
87 .
";" . number_format($oArticle->oxarticles__oxbprice->value, 2,
'.',
'')
102 .
";" . $oArticle->oxarticles__oxstock->value
108 .
";" . $this->
interForm($oArticle->oxarticles__oxshortdesc->value . $oArticle->getLongDesc())
112 fwrite($fp, $sToFile);
134 $nValue = str_replace(
"\r",
"", $nValue);
135 $nValue = str_replace(
"\n",
" ", $nValue);
136 $nValue = str_replace(
'"',
'""', $nValue);
154 $aFieldTypesToSkip = array(
"text",
"oxshortdesc",
"oxlongdesc");
155 $blSkipStrpTags =
false;
163 if (in_array($oObj->fldtype, $aFieldTypesToSkip) || in_array($oObj->fldname, $aFieldTypesToSkip)) {
164 $blSkipStripTags =
true;
172 if ($oStr->strpos($nValue,
"&") !==
false && $oStr->strpos($nValue,
";") ==
false) {
173 $nValue = str_replace(
"&",
"&", $nValue);
176 $nValue = str_replace(
" ",
" ", $nValue);
177 $nValue = str_replace(
"ä",
"�", $nValue);
178 $nValue = str_replace(
"ö",
"�", $nValue);
179 $nValue = str_replace(
"ü",
"�", $nValue);
180 $nValue = str_replace(
"Ä",
"�", $nValue);
181 $nValue = str_replace(
"Ö",
"�", $nValue);
182 $nValue = str_replace(
"Ü",
"�", $nValue);
183 $nValue = str_replace(
"ß",
"�", $nValue);
188 $nValue = str_replace(
"& ",
"& ", $nValue);
190 $nValue = str_replace(
"\"",
"'", $nValue);
191 $nValue = str_replace(
"(",
"'", $nValue);
192 $nValue = str_replace(
")",
"'", $nValue);
193 $nValue = str_replace(
"\r\n",
"", $nValue);
194 $nValue = str_replace(
"\n",
"", $nValue);
196 if (!$blSkipStripTags) {
197 $nValue = strip_tags($nValue);
213 $nPrice = number_format((
double) $nPrice, 2,
'.',
'');
233 $sSelect =
"select * from oxorder where 1 ";
235 if ($iFromOrderNr !==
"") {
236 $iFromOrderNr = (int) $iFromOrderNr;
237 $sSelect .=
"and oxordernr >= $iFromOrderNr ";
240 if ($iToOrderNr !==
"") {
241 $iToOrderNr = (int) $iToOrderNr;
242 $sSelect .=
"and oxordernr <= $iToOrderNr ";
245 $oOrderlist =
oxNew(
"oxlist");
246 $oOrderlist->init(
"oxorder");
247 $oOrderlist->selectString($sSelect);
249 if (!$oOrderlist->count()) {
255 $sExport =
"<?xml version=\"1.0\" encoding=\"{$sCharset}\"?>$sNewLine";
256 $sExport .=
"<Bestellliste>$sNewLine";
259 foreach ($oOrderlist as $oOrder) {
261 $dOrderCurRate = (double) $oOrder->oxorder__oxcurrate->value;
263 $oUser =
oxNew(
"oxuser");
264 $oUser->load($oOrder->oxorder__oxuserid->value);
266 $sExport =
"<Bestellung " . $this->
_convertStr(
"zur�ckgestellt") .
"=\"Nein\" bearbeitet=\"Nein\" " . $this->
_convertStr(
"�bertragen") .
"=\"Nein\">$sNewLine";
267 $sExport .=
"<Bestellnummer>" . $oOrder->oxorder__oxordernr->value .
"</Bestellnummer>$sNewLine";
268 $sExport .=
"<Rechnungsnummer>" . $oOrder->oxorder__oxbillnr->value .
"</Rechnungsnummer>$sNewLine";
269 $sExport .=
"<Standardwaehrung>978</Standardwaehrung>$sNewLine";
270 $sExport .=
"<Bestelldatum>$sNewLine";
271 $sDBDate =
oxRegistry::get(
"oxUtilsDate")->formatDBDate($oOrder->oxorder__oxorderdate->value);
272 $sExport .=
"<Datum>" . substr($sDBDate, 0, 10) .
"</Datum>$sNewLine";
273 $sExport .=
"<Zeit>" . substr($sDBDate, 11, 8) .
"</Zeit>$sNewLine";
274 $sExport .=
"</Bestelldatum>$sNewLine";
275 $sExport .=
"<Kunde>$sNewLine";
277 $sExport .=
"<Kundennummer>" .
278 "</Kundennummer>$sNewLine";
279 $sExport .=
"<Firmenname>" . $this->
interForm($oOrder->oxorder__oxbillcompany->value) .
"</Firmenname>$sNewLine";
280 $sExport .=
"<Anrede>" . $this->
interForm(
oxRegistry::getLang()->translateString($oOrder->oxorder__oxbillsal->value)) .
"</Anrede>$sNewLine";
281 $sExport .=
"<Vorname>" . $this->
interForm($oOrder->oxorder__oxbillfname->value) .
"</Vorname>$sNewLine";
282 $sExport .=
"<Name>" . $this->
interForm($oOrder->oxorder__oxbilllname->value) .
"</Name>$sNewLine";
283 $sExport .=
"<Strasse>" . $this->
interForm($oOrder->oxorder__oxbillstreet->value) .
" " . $this->
interForm($oOrder->oxorder__oxbillstreetnr->value) .
"</Strasse>$sNewLine";
284 $sExport .=
"<PLZ>" . $this->
interForm($oOrder->oxorder__oxbillzip->value) .
"</PLZ>$sNewLine";
285 $sExport .=
"<Ort>" . $this->
interForm($oOrder->oxorder__oxbillcity->value) .
"</Ort>$sNewLine";
286 $sExport .=
"<Bundesland>" .
"" .
"</Bundesland>$sNewLine";
287 $sExport .=
"<Land>" . $this->
interForm($oOrder->oxorder__oxbillcountry->value) .
"</Land>$sNewLine";
288 $sExport .=
"<Email>" . $this->
interForm($oOrder->oxorder__oxbillemail->value) .
"</Email>$sNewLine";
289 $sExport .=
"<Telefon>" . $this->
interForm($oOrder->oxorder__oxbillfon->value) .
"</Telefon>$sNewLine";
290 $sExport .=
"<Telefon2>" . $this->
interForm($oUser->oxuser__oxprivfon->value) .
"</Telefon2>$sNewLine";
291 $sExport .=
"<Fax>" . $this->
interForm($oOrder->oxorder__oxbillfax->value) .
"</Fax>$sNewLine";
302 if ($oOrder->oxorder__oxdellname->value) {
303 $sDelComp = $oOrder->oxorder__oxdelcompany->value;
304 $sDelfName = $oOrder->oxorder__oxdelfname->value;
305 $sDellName = $oOrder->oxorder__oxdellname->value;
306 $sDelStreet = $oOrder->oxorder__oxdelstreet->value .
" " . $oOrder->oxorder__oxdelstreetnr->value;
307 $sDelZip = $oOrder->oxorder__oxdelzip->value;
308 $sDelCity = $oOrder->oxorder__oxdelcity->value;
309 $sDelCountry = $oOrder->oxorder__oxdelcountry->value;
312 $sExport .=
"<Lieferadresse>$sNewLine";
313 $sExport .=
"<Firmenname>" . $this->
interForm($sDelComp) .
"</Firmenname>$sNewLine";
314 $sExport .=
"<Vorname>" . $this->
interForm($sDelfName) .
"</Vorname>$sNewLine";
315 $sExport .=
"<Name>" . $this->
interForm($sDellName) .
"</Name>$sNewLine";
316 $sExport .=
"<Strasse>" . $this->
interForm($sDelStreet) .
"</Strasse>$sNewLine";
317 $sExport .=
"<PLZ>" . $this->
interForm($sDelZip) .
"</PLZ>$sNewLine";
318 $sExport .=
"<Ort>" . $this->
interForm($sDelCity) .
"</Ort>$sNewLine";
319 $sExport .=
"<Bundesland>" .
"" .
"</Bundesland>$sNewLine";
320 $sExport .=
"<Land>" . $this->
interForm($sDelCountry) .
"</Land>$sNewLine";
321 $sExport .=
"</Lieferadresse>$sNewLine";
322 $sExport .=
"<Matchcode>" . $this->
interForm($oOrder->oxorder__oxbilllname->value) .
", " . $this->
interForm($oOrder->oxorder__oxbillfname->value) .
"</Matchcode>$sNewLine";
325 $sCountry = strtolower($oUser->oxuser__oxcountryid->value);
326 $aHomeCountry =
$myConfig->getConfigParam(
'aHomeCountry');
327 $sSteuerbar = (is_array($aHomeCountry) && in_array($sCountry, $aHomeCountry)) ?
"ja" :
"nein";
329 $sExport .=
"<fSteuerbar>" . $this->
interForm($sSteuerbar) .
"</fSteuerbar>$sNewLine";
330 $sExport .=
"</Kunde>$sNewLine";
331 $sExport .=
"<Artikelliste>$sNewLine";
337 $oOrderArticles = $oOrder->getOrderArticles(
true);
338 foreach ($oOrderArticles as $oOrderArt) {
340 $dVATSet = array_search($oOrderArt->oxorderarticles__oxvat->value,
$myConfig->getConfigParam(
'aLexwareVAT'));
341 $sExport =
" <Artikel>$sNewLine";
343 $sExport .=
" <Artikelzusatzinfo><Nettostaffelpreis></Nettostaffelpreis></Artikelzusatzinfo>$sNewLine";
344 $sExport .=
" <SteuersatzID>" . $dVATSet .
"</SteuersatzID>$sNewLine";
345 $sExport .=
" <Steuersatz>" . $this->
internPrice($oOrderArt->oxorderarticles__oxvat->value / 100) .
"</Steuersatz>$sNewLine";
346 $sExport .=
" <Artikelnummer>" . $oOrderArt->oxorderarticles__oxartnum->value .
"</Artikelnummer>$sNewLine";
347 $sExport .=
" <Anzahl>" . $oOrderArt->oxorderarticles__oxamount->value .
"</Anzahl>$sNewLine";
348 $sExport .=
" <Produktname>" . $this->
interForm($oOrderArt->oxorderarticles__oxtitle->value);
349 if ($oOrderArt->oxorderarticles__oxselvariant->value) {
350 $sExport .=
"/" . $oOrderArt->oxorderarticles__oxselvariant->value;
352 $sExport .=
" </Produktname>$sNewLine";
353 $sExport .=
" <Rabatt>0.00</Rabatt>$sNewLine";
355 $dUnitPrice = $oOrderArt->oxorderarticles__oxbrutprice->value / $oOrderArt->oxorderarticles__oxamount->value;
356 if ($dOrderCurRate > 0) {
357 $dUnitPrice /= $dOrderCurRate;
359 $sExport .=
" <Preis>" . $this->
internPrice($dUnitPrice) .
"</Preis>$sNewLine";
360 $sExport .=
" </Artikel>$sNewLine";
363 $dSumNetPrice += $oOrderArt->oxorderarticles__oxnetprice->value;
364 $dSumBrutPrice += $oOrderArt->oxorderarticles__oxbrutprice->value;
367 $dDiscount = $oOrder->oxorder__oxvoucherdiscount->value + $oOrder->oxorder__oxdiscount->value;
368 $dDelCost = $oOrder->oxorder__oxdelcost->value;
369 $dPaymentCost = $oOrder->oxorder__oxpaycost->value;
370 if ($dOrderCurRate > 0) {
371 $dDiscount /= $dOrderCurRate;
372 $dSumNetPrice /= $dOrderCurRate;
373 $dDelCost /= $dOrderCurRate;
374 $dSumBrutPrice /= $dOrderCurRate;
375 $dPaymentCost /= $dOrderCurRate;
377 $sExport =
"<GesamtRabatt>" . $this->
internPrice($dDiscount) .
"</GesamtRabatt>$sNewLine";
378 $sExport .=
"<GesamtNetto>" . $this->
internPrice($dSumNetPrice) .
"</GesamtNetto>$sNewLine";
379 $sExport .=
"<Lieferkosten>" . $this->
internPrice($dDelCost) .
"</Lieferkosten>$sNewLine";
380 $sExport .=
"<Zahlungsartkosten>" . $this->
internPrice($dPaymentCost) .
"</Zahlungsartkosten>$sNewLine";
381 $sExport .=
"<GesamtBrutto>" . $this->
internPrice($dSumBrutPrice) .
"</GesamtBrutto>$sNewLine";
382 $sExport .=
"<Bemerkung>" . strip_tags($oOrder->oxorder__oxremark->value) .
"</Bemerkung>$sNewLine";
385 $sExport =
"</Artikelliste>$sNewLine";
387 $sExport .=
"<Zahlung>$sNewLine";
388 $oPayment =
oxNew(
"oxpayment");
389 $oPayment->load($oOrder->oxorder__oxpaymenttype->value);
391 $sExport .=
"<Art>" . $oPayment->oxpayments__oxdesc->value .
"</Art>$sNewLine";
392 $sExport .=
"</Zahlung>$sNewLine";
394 $sExport .=
"</Bestellung>$sNewLine";
397 $oOrder->oxorder__oxexport->setValue(1);
400 $sExport =
"</Bestellliste>$sNewLine";
427 if ($sCharset ==
'ISO-8859-15') {
431 return $sStr = iconv(
'ISO-8859-15', $sCharset, $sStr);