26 $sSelect =
"select count(oxid) from $sArticleTable ";
27 $iSize = (int) $oDb->getOne($sSelect);
29 if ($iStart < $iSize) {
30 $fp = fopen($sFilepath,
"ab");
33 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");
36 $sSelect =
"select * from $sArticleTable ";
37 $rs = $oDb->selectLimit($sSelect, $iLines, $iStart);
38 $oDb->setFetchMode($oldMode);
41 $oArticle =
oxNew(
"oxarticle");
45 $oArticle->load($rs->fields[
'OXID']);
48 $sSelect =
"select oxtitle from " . $oArticle->getViewName() .
" where oxid = " . $oDb->quote($oArticle->oxarticles__oxparentid->value);
49 $oTitle = $oDb->getOne($sSelect);
50 if ($oTitle !=
false && strlen($oTitle)) {
53 $nTitle = $this->
interForm($oArticle->oxarticles__oxtitle->value);
57 $sToFile = $oArticle->oxarticles__oxartnum->value
59 .
";" . $nTitle .
" " . $this->
interForm($oArticle->oxarticles__oxvarselect->value)
61 .
";" . $oArticle->oxarticles__oxweight->value
62 .
";" . $oArticle->oxarticles__oxartnum->value
70 .
";" . number_format($oArticle->oxarticles__oxprice->value, 2,
'.',
'')
86 .
";" . number_format($oArticle->oxarticles__oxbprice->value, 2,
'.',
'')
101 .
";" . $oArticle->oxarticles__oxstock->value
107 .
";" . $this->
interForm($oArticle->oxarticles__oxshortdesc->value . $oArticle->getLongDesc())
111 fwrite($fp, $sToFile);
133 $nValue = str_replace(
"\r",
"", $nValue);
134 $nValue = str_replace(
"\n",
" ", $nValue);
135 $nValue = str_replace(
'"',
'""', $nValue);
153 $aFieldTypesToSkip = array(
"text",
"oxshortdesc",
"oxlongdesc");
154 $blSkipStrpTags =
false;
162 if (in_array($oObj->fldtype, $aFieldTypesToSkip) || in_array($oObj->fldname, $aFieldTypesToSkip)) {
163 $blSkipStripTags =
true;
171 if ($oStr->strpos($nValue,
"&") !==
false && $oStr->strpos($nValue,
";") ==
false) {
172 $nValue = str_replace(
"&",
"&", $nValue);
175 $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);
187 $nValue = str_replace(
"& ",
"& ", $nValue);
189 $nValue = str_replace(
"\"",
"'", $nValue);
190 $nValue = str_replace(
"(",
"'", $nValue);
191 $nValue = str_replace(
")",
"'", $nValue);
192 $nValue = str_replace(
"\r\n",
"", $nValue);
193 $nValue = str_replace(
"\n",
"", $nValue);
195 if (!$blSkipStripTags) {
196 $nValue = strip_tags($nValue);
212 $nPrice = number_format((
double) $nPrice, 2,
'.',
'');
232 $sSelect =
"select * from oxorder where 1 ";
234 if ($iFromOrderNr !==
"") {
235 $iFromOrderNr = (int) $iFromOrderNr;
236 $sSelect .=
"and oxordernr >= $iFromOrderNr ";
239 if ($iToOrderNr !==
"") {
240 $iToOrderNr = (int) $iToOrderNr;
241 $sSelect .=
"and oxordernr <= $iToOrderNr ";
244 $oOrderlist =
oxNew(
"oxlist");
245 $oOrderlist->init(
"oxorder");
246 $oOrderlist->selectString($sSelect);
248 if (!$oOrderlist->count()) {
254 $sExport =
"<?xml version=\"1.0\" encoding=\"{$sCharset}\"?>$sNewLine";
255 $sExport .=
"<Bestellliste>$sNewLine";
258 foreach ($oOrderlist as $oOrder) {
260 $dOrderCurRate = (double) $oOrder->oxorder__oxcurrate->value;
262 $oUser =
oxNew(
"oxuser");
263 $oUser->load($oOrder->oxorder__oxuserid->value);
265 $sExport =
"<Bestellung " . $this->
_convertStr(
"zur�ckgestellt") .
"=\"Nein\" bearbeitet=\"Nein\" " . $this->
_convertStr(
"�bertragen") .
"=\"Nein\">$sNewLine";
266 $sExport .=
"<Bestellnummer>" . $oOrder->oxorder__oxordernr->value .
"</Bestellnummer>$sNewLine";
267 $sExport .=
"<Rechnungsnummer>" . $oOrder->oxorder__oxbillnr->value .
"</Rechnungsnummer>$sNewLine";
268 $sExport .=
"<Standardwaehrung>978</Standardwaehrung>$sNewLine";
269 $sExport .=
"<Bestelldatum>$sNewLine";
270 $sDBDate =
oxRegistry::get(
"oxUtilsDate")->formatDBDate($oOrder->oxorder__oxorderdate->value);
271 $sExport .=
"<Datum>" . substr($sDBDate, 0, 10) .
"</Datum>$sNewLine";
272 $sExport .=
"<Zeit>" . substr($sDBDate, 11, 8) .
"</Zeit>$sNewLine";
273 $sExport .=
"</Bestelldatum>$sNewLine";
274 $sExport .=
"<Kunde>$sNewLine";
276 $sExport .=
"<Kundennummer>" .
277 "</Kundennummer>$sNewLine";
278 $sExport .=
"<Firmenname>" . $this->
interForm($oOrder->oxorder__oxbillcompany->value) .
"</Firmenname>$sNewLine";
279 $sExport .=
"<Anrede>" . $this->
interForm(
oxRegistry::getLang()->translateString($oOrder->oxorder__oxbillsal->value)) .
"</Anrede>$sNewLine";
280 $sExport .=
"<Vorname>" . $this->
interForm($oOrder->oxorder__oxbillfname->value) .
"</Vorname>$sNewLine";
281 $sExport .=
"<Name>" . $this->
interForm($oOrder->oxorder__oxbilllname->value) .
"</Name>$sNewLine";
282 $sExport .=
"<Strasse>" . $this->
interForm($oOrder->oxorder__oxbillstreet->value) .
" " . $this->
interForm($oOrder->oxorder__oxbillstreetnr->value) .
"</Strasse>$sNewLine";
283 $sExport .=
"<PLZ>" . $this->
interForm($oOrder->oxorder__oxbillzip->value) .
"</PLZ>$sNewLine";
284 $sExport .=
"<Ort>" . $this->
interForm($oOrder->oxorder__oxbillcity->value) .
"</Ort>$sNewLine";
285 $sExport .=
"<Bundesland>" .
"" .
"</Bundesland>$sNewLine";
286 $sExport .=
"<Land>" . $this->
interForm($oOrder->oxorder__oxbillcountry->value) .
"</Land>$sNewLine";
287 $sExport .=
"<Email>" . $this->
interForm($oOrder->oxorder__oxbillemail->value) .
"</Email>$sNewLine";
288 $sExport .=
"<Telefon>" . $this->
interForm($oOrder->oxorder__oxbillfon->value) .
"</Telefon>$sNewLine";
289 $sExport .=
"<Telefon2>" . $this->
interForm($oUser->oxuser__oxprivfon->value) .
"</Telefon2>$sNewLine";
290 $sExport .=
"<Fax>" . $this->
interForm($oOrder->oxorder__oxbillfax->value) .
"</Fax>$sNewLine";
301 if ($oOrder->oxorder__oxdellname->value) {
302 $sDelComp = $oOrder->oxorder__oxdelcompany->value;
303 $sDelfName = $oOrder->oxorder__oxdelfname->value;
304 $sDellName = $oOrder->oxorder__oxdellname->value;
305 $sDelStreet = $oOrder->oxorder__oxdelstreet->value .
" " . $oOrder->oxorder__oxdelstreetnr->value;
306 $sDelZip = $oOrder->oxorder__oxdelzip->value;
307 $sDelCity = $oOrder->oxorder__oxdelcity->value;
308 $sDelCountry = $oOrder->oxorder__oxdelcountry->value;
311 $sExport .=
"<Lieferadresse>$sNewLine";
312 $sExport .=
"<Firmenname>" . $this->
interForm($sDelComp) .
"</Firmenname>$sNewLine";
313 $sExport .=
"<Vorname>" . $this->
interForm($sDelfName) .
"</Vorname>$sNewLine";
314 $sExport .=
"<Name>" . $this->
interForm($sDellName) .
"</Name>$sNewLine";
315 $sExport .=
"<Strasse>" . $this->
interForm($sDelStreet) .
"</Strasse>$sNewLine";
316 $sExport .=
"<PLZ>" . $this->
interForm($sDelZip) .
"</PLZ>$sNewLine";
317 $sExport .=
"<Ort>" . $this->
interForm($sDelCity) .
"</Ort>$sNewLine";
318 $sExport .=
"<Bundesland>" .
"" .
"</Bundesland>$sNewLine";
319 $sExport .=
"<Land>" . $this->
interForm($sDelCountry) .
"</Land>$sNewLine";
320 $sExport .=
"</Lieferadresse>$sNewLine";
321 $sExport .=
"<Matchcode>" . $this->
interForm($oOrder->oxorder__oxbilllname->value) .
", " . $this->
interForm($oOrder->oxorder__oxbillfname->value) .
"</Matchcode>$sNewLine";
324 $sCountry = strtolower($oUser->oxuser__oxcountryid->value);
325 $aHomeCountry =
$myConfig->getConfigParam(
'aHomeCountry');
326 $sSteuerbar = (is_array($aHomeCountry) && in_array($sCountry, $aHomeCountry)) ?
"ja" :
"nein";
328 $sExport .=
"<fSteuerbar>" . $this->
interForm($sSteuerbar) .
"</fSteuerbar>$sNewLine";
329 $sExport .=
"</Kunde>$sNewLine";
330 $sExport .=
"<Artikelliste>$sNewLine";
336 $oOrderArticles = $oOrder->getOrderArticles(
true);
337 foreach ($oOrderArticles as $oOrderArt) {
339 $dVATSet = array_search($oOrderArt->oxorderarticles__oxvat->value,
$myConfig->getConfigParam(
'aLexwareVAT'));
340 $sExport =
" <Artikel>$sNewLine";
342 $sExport .=
" <Artikelzusatzinfo><Nettostaffelpreis></Nettostaffelpreis></Artikelzusatzinfo>$sNewLine";
343 $sExport .=
" <SteuersatzID>" . $dVATSet .
"</SteuersatzID>$sNewLine";
344 $sExport .=
" <Steuersatz>" . $this->
internPrice($oOrderArt->oxorderarticles__oxvat->value / 100) .
"</Steuersatz>$sNewLine";
345 $sExport .=
" <Artikelnummer>" . $oOrderArt->oxorderarticles__oxartnum->value .
"</Artikelnummer>$sNewLine";
346 $sExport .=
" <Anzahl>" . $oOrderArt->oxorderarticles__oxamount->value .
"</Anzahl>$sNewLine";
347 $sExport .=
" <Produktname>" . $this->
interForm($oOrderArt->oxorderarticles__oxtitle->value);
348 if ($oOrderArt->oxorderarticles__oxselvariant->value) {
349 $sExport .=
"/" . $oOrderArt->oxorderarticles__oxselvariant->value;
351 $sExport .=
" </Produktname>$sNewLine";
352 $sExport .=
" <Rabatt>0.00</Rabatt>$sNewLine";
354 $dUnitPrice = $oOrderArt->oxorderarticles__oxbrutprice->value / $oOrderArt->oxorderarticles__oxamount->value;
355 if ($dOrderCurRate > 0) {
356 $dUnitPrice /= $dOrderCurRate;
358 $sExport .=
" <Preis>" . $this->
internPrice($dUnitPrice) .
"</Preis>$sNewLine";
359 $sExport .=
" </Artikel>$sNewLine";
362 $dSumNetPrice += $oOrderArt->oxorderarticles__oxnetprice->value;
363 $dSumBrutPrice += $oOrderArt->oxorderarticles__oxbrutprice->value;
366 $dDiscount = $oOrder->oxorder__oxvoucherdiscount->value + $oOrder->oxorder__oxdiscount->value;
367 $dDelCost = $oOrder->oxorder__oxdelcost->value;
368 $dPaymentCost = $oOrder->oxorder__oxpaycost->value;
369 if ($dOrderCurRate > 0) {
370 $dDiscount /= $dOrderCurRate;
371 $dSumNetPrice /= $dOrderCurRate;
372 $dDelCost /= $dOrderCurRate;
373 $dSumBrutPrice /= $dOrderCurRate;
374 $dPaymentCost /= $dOrderCurRate;
376 $sExport =
"<GesamtRabatt>" . $this->
internPrice($dDiscount) .
"</GesamtRabatt>$sNewLine";
377 $sExport .=
"<GesamtNetto>" . $this->
internPrice($dSumNetPrice) .
"</GesamtNetto>$sNewLine";
378 $sExport .=
"<Lieferkosten>" . $this->
internPrice($dDelCost) .
"</Lieferkosten>$sNewLine";
379 $sExport .=
"<Zahlungsartkosten>" . $this->
internPrice($dPaymentCost) .
"</Zahlungsartkosten>$sNewLine";
380 $sExport .=
"<GesamtBrutto>" . $this->
internPrice($dSumBrutPrice) .
"</GesamtBrutto>$sNewLine";
381 $sExport .=
"<Bemerkung>" . strip_tags($oOrder->oxorder__oxremark->value) .
"</Bemerkung>$sNewLine";
384 $sExport =
"</Artikelliste>$sNewLine";
386 $sExport .=
"<Zahlung>$sNewLine";
387 $oPayment =
oxNew(
"oxpayment");
388 $oPayment->load($oOrder->oxorder__oxpaymenttype->value);
390 $sExport .=
"<Art>" . $oPayment->oxpayments__oxdesc->value .
"</Art>$sNewLine";
391 $sExport .=
"</Zahlung>$sNewLine";
393 $sExport .=
"</Bestellung>$sNewLine";
396 $oOrder->oxorder__oxexport->setValue(1);
399 $sExport =
"</Bestellliste>$sNewLine";
426 if ($sCharset ==
'ISO-8859-15') {
430 return $sStr = iconv(
'ISO-8859-15', $sCharset, $sStr);