order_overview.php

Go to the documentation of this file.
00001 <?php
00002 
00003     // DTAUS
00004     require_once "dtaus/class.DTAUS.php";
00005 
00012 class Order_Overview extends oxAdminDetails
00013 {
00021     public function render()
00022     {
00023         $myConfig = $this->getConfig();
00024         parent::render();
00025 
00026         $oOrder = oxNew( "oxorder" );
00027 
00028         $soxId = oxConfig::getParameter( "oxid");
00029         if ( $soxId != "-1" && isset( $soxId)) {
00030             // load object
00031             $oOrder->load( $soxId);
00032 
00033             $this->_aViewData["edit"]          = $oOrder;
00034             $this->_aViewData["orderArticles"] = $oOrder->getOrderArticles();
00035             $this->_aViewData["giftCard"]      = $oOrder->getGiftCard();
00036             $this->_aViewData["paymentType"]   = $oOrder->getPaymentType();
00037             $this->_aViewData["deliveryType"]  = $oOrder->getDelSet();
00038         }
00039 
00040         // orders today
00041         $oCur = $myConfig->getActShopCurrencyObject();
00042         $dSum = $oOrder->getOrderSum(true);
00043         $this->_aViewData["ordersum"] = oxLang::getInstance()->formatCurrency($dSum, $oCur);
00044         $this->_aViewData["ordercnt"] = $oOrder->getOrderCnt(true);
00045 
00046         // ALL orders
00047         $dSum = $oOrder->getOrderSum();
00048         $this->_aViewData["ordertotalsum"] = oxLang::getInstance()->formatCurrency( $dSum, $oCur);
00049         $this->_aViewData["ordertotalcnt"] = $oOrder->getOrderCnt();
00050         $this->_aViewData["afolder"] = $myConfig->getConfigParam( 'aOrderfolder' );
00051             $this->_aViewData["alangs"] = oxLang::getInstance()->getLanguageNames();
00052 
00053 
00054         return "order_overview.tpl";
00055     }
00056 
00062     public function exportlex()
00063     {
00064         $sOrderNr   = oxConfig::getParameter( "ordernr");
00065         $sToOrderNr = oxConfig::getParameter( "toordernr");
00066 
00067         $oImex = oxNew( "oximex" );
00068         $sLexware = $oImex->exportLexwareOrders( $sOrderNr, $sToOrderNr);
00069         if ( isset( $sLexware) && $sLexware) {
00070             header("Pragma: public");
00071             header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
00072             header("Expires: 0");
00073             header("Content-type: application/x-download");
00074             header('Content-Length: '.strlen($sLexware));
00075             header("Content-Disposition: attachment; filename=intern.xml");
00076             echo( $sLexware);
00077             exit();
00078         }
00079     }
00085     public function createPDF()
00086     {
00087         $soxId = oxConfig::getParameter( "oxid");
00088         if ( $soxId != "-1" && isset( $soxId)) {
00089             // load object
00090             $oOrder = oxNew( "oxorder" );
00091             $oOrder->load( $soxId);
00092             $sFilename = $oOrder->oxorder__oxordernr->value."_".$oOrder->oxorder__oxbilllname->value.".pdf";
00093 
00094             ob_start();
00095             $oOrder->genPDF( $sFilename, oxConfig::getParameter( "pdflanguage"));
00096             $sPDF = ob_get_contents();
00097             ob_end_clean();
00098 
00099             header("Pragma: public");
00100             header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
00101             header("Expires: 0");
00102             header("Content-type: application/pdf");
00103             header("Content-Disposition: attachment; filename=".$sFilename);
00104             echo( $sPDF);
00105             exit();
00106         }
00107 
00108     }
00109 
00115     public function exportDTAUS()
00116     {
00117         $iFromOrderNr = oxConfig::getParameter( "ordernr");
00118 
00119         $oOrderList = oxNew( "oxlist" );
00120         $oOrderList->init( "oxorder");
00121         $sSelect =  "select * from oxorder where oxpaymenttype = 'oxiddebitnote'";
00122 
00123         if ( isset( $iFromOrderNr) && $iFromOrderNr)
00124             $sSelect .= " and oxordernr >= $iFromOrderNr";
00125 
00126         $oOrderList->selectString( $sSelect);
00127 
00128         if ( !count( $oOrderList))
00129             return;
00130 
00131         $oPayment = oxNew( "oxuserpayment" );
00132         $oShop = oxNew( "oxshop" );
00133         $oShop->load( $this->getConfig()->getShopId());
00134 
00135         $dtaus = new DTAUS("L", $oShop->oxshops__oxcompany->value, str_replace( " ", "", $oShop->oxshops__oxbankcode->value), str_replace( " ", "", $oShop->oxshops__oxbanknumber->value));
00136 
00137         foreach ( $oOrderList as $oOrder) {
00138             $oPayment->load( $oOrder->oxorder__oxpaymentid->value);
00139             $aDynValues = oxUtils::getInstance()->assignValuesFromText( $oPayment->oxuserpayments__oxvalue->value );
00140             // #630
00141             //$dtaus->addTransaktion( $aDynValues[3]->value, str_replace( array(" ", "-"), "", $aDynValues[1]->value), str_replace( array(" ", "-"), "", $aDynValues[2]->value), str_replace( ",", ".",$oOrder->ftotalorder), $oShop->oxshops__oxname->value, oxLang::getInstance()->translateString("order")." ".$oOrder->oxorder__oxordernr->value,"");
00142             $dtaus->addTransaktion( $aDynValues[3]->value, str_replace( " ", "", $aDynValues[1]->value), str_replace( " ", "", $aDynValues[2]->value), str_replace( ",", ".", $oOrder->ftotalorder), $oShop->oxshops__oxname->value, oxLang::getInstance()->translateString("order")." ".$oOrder->oxorder__oxordernr->value, "");
00143 
00144         }
00145 
00146         header("Content-Disposition: attachment; filename=\"dtaus0.txt\"");
00147         header("Content-type: text/plain");
00148         header("Cache-control: public");
00149 
00150         echo(  $dtaus->create());
00151         exit();
00152     }
00153 
00159     public function sendorder()
00160     {
00161         $soxId  = oxConfig::getParameter( "oxid");
00162         $oOrder = oxNew( "oxorder" );
00163         $oOrder->load( $soxId);
00164 
00165         // #632A
00166         $timeout = oxUtilsDate::getInstance()->getTime(); //time();
00167         $now = date("Y-m-d H:i:s", $timeout);
00168         $oOrder->oxorder__oxsenddate->setValue($now);
00169         $oOrder->save();
00170 
00171         // #1071C
00172         $oOrderArticles = $oOrder->getOrderArticles();
00173         foreach ( $oOrderArticles as $oxid=>$oArticle) {
00174             // remove canceled articles from list
00175             if ( $oArticle->oxorderarticles__oxstorno->value == 1 )
00176                 $oOrderArticles->offsetUnset($oxid);
00177         }
00178 
00179         $blMail  = oxConfig::getParameter( "sendmail");
00180         if ( isset( $blMail) && $blMail) {
00181             // send eMail
00182             $oxEMail = oxNew( "oxemail" );
00183             $oxEMail->sendSendedNowMail( $oOrder );
00184         }
00185     }
00186 
00192     public function resetorder()
00193     {
00194         $soxId  = oxConfig::getParameter( "oxid");
00195         $oOrder = oxNew( "oxorder" );
00196         $oOrder->load( $soxId);
00197 
00198         $oOrder->oxorder__oxsenddate->setValue("0000-00-00 00:00:00");
00199         $oOrder->save();
00200     }
00201 }

Generated on Thu Dec 4 12:04:55 2008 for OXID eShop CE by  doxygen 1.5.5