25 $sSelect =
"select count(oxid) from $sArticleTable ";
26 $iSize = (int) $oDb->getOne( $sSelect );
28 if ( $iStart < $iSize) {
29 $fp = fopen( $sFilepath,
"ab");
32 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");
35 $sSelect =
"select * from $sArticleTable ";
36 $rs = $oDb->selectLimit( $sSelect, $iLines, $iStart);
37 $oDb->setFetchMode( $oldMode);
40 $oArticle =
oxNew(
"oxarticle" );
44 $oArticle->load( $rs->fields[
'OXID']);
47 $sSelect =
"select oxtitle from ".$oArticle->getViewName().
" where oxid = " . $oDb->quote( $oArticle->oxarticles__oxparentid->value );
48 $oTitle = $oDb->getOne( $sSelect );
49 if ($oTitle !=
false && strlen ($oTitle)) {
52 $nTitle = $this->
interForm($oArticle->oxarticles__oxtitle->value);
56 $sToFile = $oArticle->oxarticles__oxartnum->value
58 .
";".$nTitle.
" ".$this->
interForm($oArticle->oxarticles__oxvarselect->value)
60 .
";".$oArticle->oxarticles__oxweight->value
61 .
";".$oArticle->oxarticles__oxartnum->value
69 .
";".number_format($oArticle->oxarticles__oxprice->value, 2,
'.',
'')
85 .
";".number_format($oArticle->oxarticles__oxbprice->value, 2,
'.',
'')
100 .
";".$oArticle->oxarticles__oxstock->value
106 .
";".$this->
interForm( $oArticle->oxarticles__oxshortdesc->value.$oArticle->getLongDesc())
110 fwrite( $fp, $sToFile);
131 $nValue = str_replace(
"\r",
"", $nValue );
132 $nValue = str_replace(
"\n",
" ", $nValue );
133 $nValue = str_replace(
'"',
'""', $nValue );
150 $aFieldTypesToSkip = array(
"text",
"oxshortdesc",
"oxlongdesc");
151 $blSkipStrpTags =
false;
152 if ( $oObj != null) {
159 if ( in_array( $oObj->fldtype, $aFieldTypesToSkip ) || in_array( $oObj->fldname, $aFieldTypesToSkip ) ) {
160 $blSkipStripTags =
true;
168 if ( $oStr->strpos( $nValue,
"&" ) !==
false && $oStr->strpos($nValue,
";" ) == false ) {
169 $nValue = str_replace(
"&",
"&", $nValue);
172 $nValue = str_replace(
" ",
" ", $nValue);
173 $nValue = str_replace(
"ä",
"�", $nValue);
174 $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);
184 $nValue = str_replace(
"& ",
"& ", $nValue);
186 $nValue = str_replace(
"\"",
"'", $nValue);
187 $nValue = str_replace(
"(",
"'", $nValue);
188 $nValue = str_replace(
")",
"'", $nValue);
189 $nValue = str_replace(
"\r\n",
"", $nValue);
190 $nValue = str_replace(
"\n",
"", $nValue);
192 if ( !$blSkipStripTags) {
193 $nValue = strip_tags( $nValue );
209 $nPrice = number_format( (
double)$nPrice, 2,
'.',
'');
228 $sSelect =
"select * from oxorder where 1 ";
230 if ( $iFromOrderNr !==
"" ) {
231 $iFromOrderNr = (int)$iFromOrderNr;
232 $sSelect .=
"and oxordernr >= $iFromOrderNr ";
235 if ( $iToOrderNr !==
"" ) {
236 $iToOrderNr = (int)$iToOrderNr;
237 $sSelect .=
"and oxordernr <= $iToOrderNr ";
240 $oOrderlist =
oxNew(
"oxlist" );
241 $oOrderlist->init(
"oxorder" );
242 $oOrderlist->selectString( $sSelect );
244 if ( !$oOrderlist->count() ) {
250 $sExport =
"<?xml version=\"1.0\" encoding=\"{$sCharset}\"?>$sNewLine";
251 $sExport .=
"<Bestellliste>$sNewLine";
254 foreach ( $oOrderlist as $oOrder ) {
256 $dOrderCurRate = (double)$oOrder->oxorder__oxcurrate->value;
258 $oUser =
oxNew(
"oxuser" );
259 $oUser->load( $oOrder->oxorder__oxuserid->value );
261 $sExport =
"<Bestellung " . $this->
_convertStr(
"zur�ckgestellt" ) .
"=\"Nein\" bearbeitet=\"Nein\" " . $this->
_convertStr(
"�bertragen" ) .
"=\"Nein\">$sNewLine";
262 $sExport .=
"<Bestellnummer>".$oOrder->oxorder__oxordernr->value.
"</Bestellnummer>$sNewLine";
263 $sExport .=
"<Rechnungsnummer>".$oOrder->oxorder__oxbillnr->value.
"</Rechnungsnummer>$sNewLine";
264 $sExport .=
"<Standardwaehrung>978</Standardwaehrung>$sNewLine";
265 $sExport .=
"<Bestelldatum>$sNewLine";
266 $sDBDate =
oxRegistry::get(
"oxUtilsDate")->formatDBDate($oOrder->oxorder__oxorderdate->value);
267 $sExport .=
"<Datum>".substr($sDBDate, 0, 10).
"</Datum>$sNewLine";
268 $sExport .=
"<Zeit>".substr($sDBDate, 11, 8).
"</Zeit>$sNewLine";
269 $sExport .=
"</Bestelldatum>$sNewLine";
270 $sExport .=
"<Kunde>$sNewLine";
272 $sExport .=
"<Kundennummer>".
"</Kundennummer>$sNewLine";
273 $sExport .=
"<Firmenname>".$this->interForm($oOrder->oxorder__oxbillcompany->value).
"</Firmenname>$sNewLine";
274 $sExport .=
"<Anrede>".$this->interForm(
oxRegistry::getLang()->translateString($oOrder->oxorder__oxbillsal->value)).
"</Anrede>$sNewLine";
275 $sExport .=
"<Vorname>".$this->interForm($oOrder->oxorder__oxbillfname->value).
"</Vorname>$sNewLine";
276 $sExport .=
"<Name>".$this->interForm($oOrder->oxorder__oxbilllname->value).
"</Name>$sNewLine";
277 $sExport .=
"<Strasse>".$this->interForm($oOrder->oxorder__oxbillstreet->value).
" ".$this->
interForm($oOrder->oxorder__oxbillstreetnr->value).
"</Strasse>$sNewLine";
278 $sExport .=
"<PLZ>".$this->interForm($oOrder->oxorder__oxbillzip->value).
"</PLZ>$sNewLine";
279 $sExport .=
"<Ort>".$this->interForm($oOrder->oxorder__oxbillcity->value).
"</Ort>$sNewLine";
280 $sExport .=
"<Bundesland>".
"".
"</Bundesland>$sNewLine";
281 $sExport .=
"<Land>".$this->interForm($oOrder->oxorder__oxbillcountry->value).
"</Land>$sNewLine";
282 $sExport .=
"<Email>".$this->interForm($oOrder->oxorder__oxbillemail->value).
"</Email>$sNewLine";
283 $sExport .=
"<Telefon>".$this->interForm($oOrder->oxorder__oxbillfon->value).
"</Telefon>$sNewLine";
284 $sExport .=
"<Telefon2>".$this->interForm($oUser->oxuser__oxprivfon->value).
"</Telefon2>$sNewLine";
285 $sExport .=
"<Fax>".$this->interForm($oOrder->oxorder__oxbillfax->value).
"</Fax>$sNewLine";
296 if ( $oOrder->oxorder__oxdellname->value) {
297 $sDelComp = $oOrder->oxorder__oxdelcompany->value;
298 $sDelfName = $oOrder->oxorder__oxdelfname->value;
299 $sDellName = $oOrder->oxorder__oxdellname->value;
300 $sDelStreet = $oOrder->oxorder__oxdelstreet->value.
" ".$oOrder->oxorder__oxdelstreetnr->value;
301 $sDelZip = $oOrder->oxorder__oxdelzip->value;
302 $sDelCity = $oOrder->oxorder__oxdelcity->value;
303 $sDelCountry= $oOrder->oxorder__oxdelcountry->value;
306 $sExport .=
"<Lieferadresse>$sNewLine";
307 $sExport .=
"<Firmenname>".$this->interForm($sDelComp).
"</Firmenname>$sNewLine";
308 $sExport .=
"<Vorname>".$this->interForm($sDelfName).
"</Vorname>$sNewLine";
309 $sExport .=
"<Name>".$this->interForm($sDellName).
"</Name>$sNewLine";
310 $sExport .=
"<Strasse>".$this->interForm($sDelStreet).
"</Strasse>$sNewLine";
311 $sExport .=
"<PLZ>".$this->interForm($sDelZip).
"</PLZ>$sNewLine";
312 $sExport .=
"<Ort>".$this->interForm($sDelCity).
"</Ort>$sNewLine";
313 $sExport .=
"<Bundesland>".
"".
"</Bundesland>$sNewLine";
314 $sExport .=
"<Land>".$this->interForm($sDelCountry).
"</Land>$sNewLine";
315 $sExport .=
"</Lieferadresse>$sNewLine";
316 $sExport .=
"<Matchcode>".$this->interForm($oOrder->oxorder__oxbilllname->value).
", ".$this->
interForm($oOrder->oxorder__oxbillfname->value).
"</Matchcode>$sNewLine";
319 $sCountry = strtolower( $oUser->oxuser__oxcountryid->value );
320 $aHomeCountry =
$myConfig->getConfigParam(
'aHomeCountry' );
321 $sSteuerbar = ( is_array( $aHomeCountry ) && in_array( $sCountry, $aHomeCountry ) ) ?
"ja" :
"nein";
323 $sExport .=
"<fSteuerbar>".$this->interForm( $sSteuerbar ).
"</fSteuerbar>$sNewLine";
324 $sExport .=
"</Kunde>$sNewLine";
325 $sExport .=
"<Artikelliste>$sNewLine";
331 $oOrderArticles = $oOrder->getOrderArticles(
true );
332 foreach ($oOrderArticles as $oOrderArt) {
334 $dVATSet = array_search( $oOrderArt->oxorderarticles__oxvat->value,
$myConfig->getConfigParam(
'aLexwareVAT' ) );
335 $sExport =
" <Artikel>$sNewLine";
337 $sExport .=
" <Artikelzusatzinfo><Nettostaffelpreis></Nettostaffelpreis></Artikelzusatzinfo>$sNewLine";
338 $sExport .=
" <SteuersatzID>".$dVATSet.
"</SteuersatzID>$sNewLine";
339 $sExport .=
" <Steuersatz>".$this->internPrice($oOrderArt->oxorderarticles__oxvat->value/100).
"</Steuersatz>$sNewLine";
340 $sExport .=
" <Artikelnummer>".$oOrderArt->oxorderarticles__oxartnum->value.
"</Artikelnummer>$sNewLine";
341 $sExport .=
" <Anzahl>".$oOrderArt->oxorderarticles__oxamount->value.
"</Anzahl>$sNewLine";
342 $sExport .=
" <Produktname>".$this->interForm( $oOrderArt->oxorderarticles__oxtitle->value);
343 if ( $oOrderArt->oxorderarticles__oxselvariant->value) {
344 $sExport .=
"/".$oOrderArt->oxorderarticles__oxselvariant->value;
346 $sExport .=
" </Produktname>$sNewLine";
347 $sExport .=
" <Rabatt>0.00</Rabatt>$sNewLine";
349 $dUnitPrice = $oOrderArt->oxorderarticles__oxbrutprice->value/$oOrderArt->oxorderarticles__oxamount->value;
350 if ($dOrderCurRate > 0) {
351 $dUnitPrice /= $dOrderCurRate;
353 $sExport .=
" <Preis>".$this->internPrice($dUnitPrice).
"</Preis>$sNewLine";
354 $sExport .=
" </Artikel>$sNewLine";
357 $dSumNetPrice += $oOrderArt->oxorderarticles__oxnetprice->value;
358 $dSumBrutPrice += $oOrderArt->oxorderarticles__oxbrutprice->value;
361 $dDiscount = $oOrder->oxorder__oxvoucherdiscount->value + $oOrder->oxorder__oxdiscount->value;
362 $dDelCost = $oOrder->oxorder__oxdelcost->value;
363 $dPaymentCost = $oOrder->oxorder__oxpaycost->value;
364 if ($dOrderCurRate > 0) {
365 $dDiscount /= $dOrderCurRate;
366 $dSumNetPrice /= $dOrderCurRate;
367 $dDelCost /= $dOrderCurRate;
368 $dSumBrutPrice /= $dOrderCurRate;
369 $dPaymentCost /= $dOrderCurRate;
371 $sExport =
"<GesamtRabatt>".$this->internPrice($dDiscount).
"</GesamtRabatt>$sNewLine";
372 $sExport .=
"<GesamtNetto>".$this->internPrice($dSumNetPrice).
"</GesamtNetto>$sNewLine";
373 $sExport .=
"<Lieferkosten>".$this->internPrice($dDelCost).
"</Lieferkosten>$sNewLine";
374 $sExport .=
"<Zahlungsartkosten>".$this->internPrice($dPaymentCost).
"</Zahlungsartkosten>$sNewLine";
375 $sExport .=
"<GesamtBrutto>".$this->internPrice($dSumBrutPrice).
"</GesamtBrutto>$sNewLine";
376 $sExport .=
"<Bemerkung>".strip_tags( $oOrder->oxorder__oxremark->value).
"</Bemerkung>$sNewLine";
379 $sExport =
"</Artikelliste>$sNewLine";
381 $sExport .=
"<Zahlung>$sNewLine";
382 $oPayment =
oxNew(
"oxpayment" );
383 $oPayment->load( $oOrder->oxorder__oxpaymenttype->value);
385 $sExport .=
"<Art>".$oPayment->oxpayments__oxdesc->value.
"</Art>$sNewLine";
386 $sExport .=
"</Zahlung>$sNewLine";
388 $sExport .=
"</Bestellung>$sNewLine";
391 $oOrder->oxorder__oxexport->setValue(1);
394 $sExport =
"</Bestellliste>$sNewLine";
421 if ( $sCharset ==
'ISO-8859-15' ) {
425 return $sStr = iconv(
'ISO-8859-15', $sCharset, $sStr );