22 $oOrder =
oxNew(
"oxOrder" );
23 $oCur =
$myConfig->getActShopCurrencyObject();
27 if ( $soxId !=
"-1" && isset( $soxId)) {
29 $oOrder->load( $soxId);
31 $this->_aViewData[
"edit"] = $oOrder;
32 $this->_aViewData[
"aProductVats"] = $oOrder->getProductVats();
33 $this->_aViewData[
"orderArticles"] = $oOrder->getOrderArticles();
34 $this->_aViewData[
"giftCard"] = $oOrder->getGiftCard();
36 $this->_aViewData[
"deliveryType"] = $oOrder->getDelSet();
37 if ( $oOrder->oxorder__oxtsprotectcosts->value ) {
38 $this->_aViewData[
"tsprotectcosts"] = $oLang->formatCurrency( $oOrder->oxorder__oxtsprotectcosts->value, $oCur);
43 $dSum = $oOrder->getOrderSum(
true);
44 $this->_aViewData[
"ordersum"] = $oLang->formatCurrency($dSum, $oCur);
45 $this->_aViewData[
"ordercnt"] = $oOrder->getOrderCnt(
true);
48 $dSum = $oOrder->getOrderSum();
49 $this->_aViewData[
"ordertotalsum"] = $oLang->formatCurrency( $dSum, $oCur);
50 $this->_aViewData[
"ordertotalcnt"] = $oOrder->getOrderCnt();
51 $this->_aViewData[
"afolder"] =
$myConfig->getConfigParam(
'aOrderfolder' );
52 $this->_aViewData[
"alangs"] = $oLang->getLanguageNames();
54 $this->_aViewData[
"currency"] = $oCur;
56 return "order_overview.tpl";
70 if ( !( $oUserPayment = $oOrder->getPaymentType() ) && $oOrder->oxorder__oxpaymenttype->value ) {
71 $oPayment =
oxNew(
"oxPayment" );
72 if ( $oPayment->load( $oOrder->oxorder__oxpaymenttype->value ) ) {
74 $oUserPayment =
oxNew(
"oxUserPayment" );
75 $oUserPayment->oxpayments__oxdesc =
new oxField( $oPayment->oxpayments__oxdesc->value );
91 $oImex =
oxNew(
"oximex" );
92 if ( ( $sLexware = $oImex->exportLexwareOrders( $sOrderNr, $sToOrderNr ) ) ) {
94 $oUtils->setHeader(
"Pragma: public" );
95 $oUtils->setHeader(
"Cache-Control: must-revalidate, post-check=0, pre-check=0" );
96 $oUtils->setHeader(
"Expires: 0" );
97 $oUtils->setHeader(
"Content-type: application/x-download" );
98 $oUtils->setHeader(
"Content-Length: ".strlen( $sLexware ) );
99 $oUtils->setHeader(
"Content-Disposition: attachment; filename=intern.xml" );
100 $oUtils->showMessageAndExit( $sLexware );
111 if ( $soxId !=
"-1" && isset( $soxId ) ) {
113 $oOrder =
oxNew(
"oxorder" );
114 if ( $oOrder->load( $soxId ) ) {
116 $sTrimmedBillName = trim($oOrder->oxorder__oxbilllname->getRawValue());
117 $sFilename = $oOrder->oxorder__oxordernr->value .
"_" . $sTrimmedBillName .
".pdf";
118 $sFilename = str_replace(
" ",
"_", $sFilename);
121 $sPDF = ob_get_contents();
123 $oUtils->setHeader(
"Pragma: public" );
124 $oUtils->setHeader(
"Cache-Control: must-revalidate, post-check=0, pre-check=0" );
125 $oUtils->setHeader(
"Expires: 0" );
126 $oUtils->setHeader(
"Content-type: application/pdf" );
127 $oUtils->setHeader(
"Content-Disposition: attachment; filename=".$sFilename );
140 $oOrderList =
oxNew(
"oxList" );
141 $oOrderList->init(
"oxOrder" );
142 $sSelect =
"select * from oxorder where oxpaymenttype = 'oxiddebitnote'";
145 $sSelect .=
" and oxordernr >= $iFromOrderNr";
148 $oOrderList->selectString( $sSelect );
149 if ( count( $oOrderList ) ) {
150 $oUserPayment =
oxNew(
"oxUserPayment" );
152 $oShop = $this->
getConfig()->getActiveShop();
154 $sCompany = $oShop->oxshops__oxcompany->value;
155 $sRoutingNr = $this->
_cleanup( $oShop->oxshops__oxbankcode->value ) + 1 - 1;
156 $sAccountNr = $this->
_cleanup( $oShop->oxshops__oxbanknumber->value );
160 $oDtaus =
oxNew(
"oxDtausBuilder", $sCompany, $sRoutingNr, $sAccountNr );
161 foreach ( $oOrderList as $oOrder ) {
162 $oUserPayment->load( $oOrder->oxorder__oxpaymentid->value );
163 $aDynValues = $oUtils->assignValuesFromText( $oUserPayment->oxuserpayments__oxvalue->value );
165 $sCustName = $aDynValues[3]->value;
166 $sRoutingNr = $this->
_cleanup( $aDynValues[1]->value );
167 $sAccountNr = $this->
_cleanup( $aDynValues[2]->value );
169 $oDtaus->add( $sCustName, $sRoutingNr, $sAccountNr, $oOrder->getTotalOrderSum(), array( $oShop->oxshops__oxname->getRawValue(), $sSubject .
" " . $oOrder->oxorder__oxordernr->value ) );
172 $oUtils->setHeader(
"Content-Disposition: attachment; filename=\"dtaus0.txt\"" );
173 $oUtils->setHeader(
"Content-type: text/plain" );
174 $oUtils->setHeader(
"Cache-control: public" );
175 $oUtils->showMessageAndExit( $oDtaus->create() );
188 return str_replace(
" ",
"", $sValue );
198 $oOrder =
oxNew(
"oxorder" );
199 if ( $oOrder->load( $this->getEditObjectId() ) ) {
200 $oOrder->oxorder__oxsenddate =
new oxField( date(
"Y-m-d H:i:s",
oxRegistry::get(
"oxUtilsDate")->getTime() ) );
204 $oOrderArticles = $oOrder->getOrderArticles();
205 foreach ( $oOrderArticles as $sOxid => $oArticle ) {
207 if ( $oArticle->oxorderarticles__oxstorno->value == 1 ) {
208 $oOrderArticles->offsetUnset( $sOxid );
214 $oEmail =
oxNew(
"oxemail" );
215 $oEmail->sendSendedNowMail( $oOrder );
227 $oOrder =
oxNew(
"oxorder" );
228 if ( $oOrder->load( $this->getEditObjectId() ) ) {
229 $oOrder->oxorder__oxsenddate =
new oxField(
"0000-00-00 00:00:00" );
243 $oModule =
oxNew(
'oxmodule');
244 $oModule->load(
'invoicepdf');
245 if ( $oModule->isActive() ) {
248 $sTable = getViewName(
"oxorderarticles" );
249 $sQ =
"select count(oxid) from {$sTable} where oxorderid = ".$oDb->quote( $sOrderId ).
" and oxstorno = 0";
250 $blCan = (bool) $oDb->getOne( $sQ,
false,
false );
262 $oOrder =
oxNew(
"oxorder" );
264 if ( $oOrder->load( $this->getEditObjectId() ) ) {
265 $blCan = $oOrder->oxorder__oxstorno->value ==
"0" &&
266 !( $oOrder->oxorder__oxsenddate->value ==
"0000-00-00 00:00:00" || $oOrder->oxorder__oxsenddate->value ==
"-" );