public static function getView(Order $order, $useCurrentBudget = true)
    {
        $data = self::prepareData($order);
        $result = '<div class="adm-bus-pay">
			<div class="adm-bus-component-content-container">
				<div class="adm-bus-pay-section">
					<div class="adm-bus-pay-section-content posr">
						<input type="hidden" value="' . $data['PRICE'] . '" id="sale-order-financeinfo-price">
						<input type="hidden" value="' . $data['SUM_PAID'] . '" id="sale-order-financeinfo-sum-paid">
						<input type="hidden" value="' . $data['PAYABLE'] . '" id="sale-order-financeinfo-payable">
						<table class="adm-bus-pay-statuspay " ' . (isset($data['OVERPAYMENT']) ? 'style="width: 1000px"' : '') . '>
							<thead>
								<tr>
									<td>' . Loc::getMessage('SALE_ORDER_FINANCEINFO_FOR_PAYMENT') . '</td>
									<td class="separator"></td>
									<td style="color: #749511;">' . Loc::getMessage('SALE_ORDER_FINANCEINFO_SUM_PAID') . '</td>
									<td class="separator"></td>
									<td style="color: #f29129;">' . Loc::getMessage('SALE_ORDER_FINANCEINFO_PAYABLE') . '</td>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td id="sale-order-financeinfo-price-view">' . SaleFormatCurrency(floatval($data['PRICE']), $data['CURRENCY']) . '</td>
									<td class="separator"></td>
									<td id="sale-order-financeinfo-sum-paid-view">' . SaleFormatCurrency(floatval($data['SUM_PAID']), $data['CURRENCY']) . '</td>
									<td class="separator"></td>
									<td id="sale-order-financeinfo-payable-view">' . SaleFormatCurrency(floatval($data['PAYABLE']), $data['CURRENCY']) . '</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
					<div class="adm-bus-pay-section"' . (floatval($data['BUYER_BUDGET']) <= 0 ? ' style="display:none;"' : '') . '>
						<input id="sale-order-financeinfo-user-budget-input" type="hidden" value="' . floatval($data['BUYER_BUDGET']) . '">
						<div class="adm-bus-pay-section-content posr">
							<div class="adm-bus-pay-wallet">
								' . Loc::getMessage('SALE_ORDER_FINANCEINFO_BALANCE_INNER_BUDGET') . ': <strong id="sale-order-financeinfo-user-budget">' . SaleFormatCurrency($data['BUYER_BUDGET'], $data['CURRENCY']) . '</strong>';
        if ($useCurrentBudget) {
            $result .= '<span class="adm-bus-pay-use-current-budget" onclick="BX.Sale.Admin.GeneralPayment.useCurrentBudget(this);">' . Loc::getMessage('SALE_ORDER_FINANCEINFO_USE_INNER_BUDGET') . '</span>';
        }
        $result .= '</div>
					</div>
				</div>
			</div>
		</div>';
        return $result;
    }
if (!CModule::IncludeModule("sale")) {
    ShowError(GetMessage("SALE_MODULE_NOT_INSTALL"));
    return;
}
$arParams["PATH_TO_BASKET"] = Trim($arParams["PATH_TO_BASKET"]);
$arParams["PATH_TO_ORDER"] = Trim($arParams["PATH_TO_ORDER"]);
$dbBaket = CSaleBasket::GetList(array("NAME" => "ASC"), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "LID" => SITE_ID, "ORDER_ID" => "NULL"));
$bReady = False;
$bDelay = False;
$bNotAvail = False;
$bSubscribe = False;
$arItems = array();
while ($arBasket = $dbBaket->GetNext()) {
    if ($arBasket["DELAY"] == "N" && $arBasket["CAN_BUY"] == "Y") {
        $bReady = True;
    } elseif ($arBasket["DELAY"] == "Y" && $arBasket["CAN_BUY"] == "Y") {
        $bDelay = True;
    } elseif ($arBasket["CAN_BUY"] == "N" && $arBasket["SUBSCRIBE"] == "N") {
        $bNotAvail = True;
    } elseif ($arBasket["CAN_BUY"] == "N" && $arBasket["SUBSCRIBE"] == "Y") {
        $bSubscribe = True;
    }
    $arBasket["PRICE_FORMATED"] = SaleFormatCurrency($arBasket["PRICE"], $arBasket["CURRENCY"]);
    $arItems[] = $arBasket;
}
$arResult["READY"] = $bReady ? "Y" : "N";
$arResult["DELAY"] = $bDelay ? "Y" : "N";
$arResult["NOTAVAIL"] = $bNotAvail ? "Y" : "N";
$arResult["SUBSCRIBE"] = $bSubscribe ? "Y" : "N";
$arResult["ITEMS"] = $arItems;
$this->IncludeComponentTemplate();
Exemple #3
0
                }
            }
        } else {
            $strErrorTmp .= "Response error. ";
        }
    }
}
//***************************************************
//***  END ACTION  **********************************
//***************************************************
if (!$bNonePay) {
    ?>
			<font class="text" color="#009900"><b>
			Thank you for purchasing!<br>
			You have been billed <?php 
    echo SaleFormatCurrency($AMT, "USD");
    ?>
</b>
			</font>
			<?php 
} else {
    if (strlen($strErrorTmp) > 0) {
        echo "<font color=\"#FF0000\"><b>" . $strErrorTmp . "</b></font><br>";
    }
    $noc_def = htmlspecialcharsbx(CSalePaySystemAction::GetParamValue("NOC"));
    $address1_def = htmlspecialcharsbx(CSalePaySystemAction::GetParamValue("ADDRESS"));
    $zipcode_def = htmlspecialcharsbx(CSalePaySystemAction::GetParamValue("ZIP"));
    ?>
			<script type="text/javascript">
			function checkFields(frm)
			{
Exemple #4
0
 /**
  * Function formats taxes info in arResult
  * @return void
  */
 protected function formatResultTaxes()
 {
     $arResult =& $this->arResult;
     if (self::isNonemptyArray($arResult['TAX_LIST'])) {
         foreach ($arResult["TAX_LIST"] as $k => $tax) {
             $tax =& $arResult["TAX_LIST"][$k];
             if ($tax["IS_IN_PRICE"] == "Y") {
                 $tax["VALUE_FORMATED"] = " (" . ($tax["IS_PERCENT"] == "Y" ? "" . doubleval($tax["VALUE"]) . "%, " : "") . Localization\Loc::getMessage("SPOD_SALE_TAX_INPRICE") . ")";
             } else {
                 $tax["VALUE_FORMATED"] = " (" . ($tax["IS_PERCENT"] == "Y" ? "" . doubleval($tax["VALUE"]) . "%" : "") . ")";
             }
             if (doubleval($tax["VALUE_MONEY"])) {
                 $tax["VALUE_MONEY_FORMATED"] = SaleFormatCurrency($tax["VALUE_MONEY"], $arResult["CURRENCY"]);
             }
         }
     } else {
         $arResult["TAX_LIST"] = array();
     }
     $arResult["TAX_VALUE_FORMATED"] = SaleFormatCurrency($arResult["TAX_VALUE"], $arResult["CURRENCY"]);
 }
Exemple #5
0
} else {
    echo GetMessage("BASKET");
}
?>
					</a>
				<!--/noindex-->
			</div>
			<div>
				<?php 
if ($itemsCount) {
    ?>
					<?php 
    echo GetMessage('SUMM');
    ?>
 <?php 
    echo SaleFormatCurrency($summ, $currency);
    ?>
				<?php 
} else {
    ?>
					<?php 
    echo GetMessage("BASKET_EMPTY");
    ?>
				<?php 
}
?>
			</div>
		</div>
		<div class="counter_mini"><a href="<?php 
echo $arParams["PATH_TO_BASKET"];
?>
    public static function getView(Order $order, OrderBasket $orderBasket, $selectPayment = null, $selectId = null)
    {
        // prepare data
        $orderId = $order->getId();
        $data = $orderBasket->prepareData();
        $items = $data['ITEMS'];
        $documents = array();
        $itemNo = 0;
        /** @var \Bitrix\Sale\Payment $payment */
        foreach ($order->getPaymentCollection() as $payment) {
            $documents[] = $payment;
        }
        /** @var \Bitrix\Sale\Shipment $shipment */
        foreach ($order->getShipmentCollection() as $shipment) {
            if (!$shipment->isSystem()) {
                if (!$shipment->isCanceled() && $shipment->isShipped()) {
                    /** @var \Bitrix\Sale\ShipmentItem $shipmentItem */
                    foreach ($shipment->getShipmentItemCollection() as $shipmentItem) {
                        $basketItem = $shipmentItem->getBasketItem();
                        if (isset($items[$basketItem->getBasketCode()])) {
                            $item =& $items[$basketItem->getBasketCode()];
                            if ($shippedQuantity =& $item['SHIPPED_QUANTITY']) {
                                $shippedQuantity += (double) $shipmentItem->getField('QUANTITY');
                            } else {
                                $shippedQuantity = (double) $shipmentItem->getField('QUANTITY');
                            }
                        }
                    }
                }
                $documents[] = $shipment;
            }
        }
        unset($item, $shippedQuantity);
        usort($documents, array(__CLASS__, 'sortDocumentsByDate'));
        // render view
        ob_start();
        ?>
		<div class="adm-s-order-table-ddi">
			<table class="adm-s-order-table-ddi-table adm-s-bus-ordertable-option" style="width: 100%;">
				<thead>
				<tr>
					<td class="tac"><?php 
        echo Loc::getMessage('SALE_OANALYSIS_ITEM_NUMBER');
        ?>
</td>
					<td><?php 
        echo Loc::getMessage('SALE_OANALYSIS_ITEM_NAME');
        ?>
</td>
					<td class="tac"><?php 
        echo Loc::getMessage('SALE_OANALYSIS_ITEM_PROPERTIES');
        ?>
</td>
					<td class="tac"><?php 
        echo Loc::getMessage('SALE_OANALYSIS_ITEM_PLANNED');
        ?>
</td>
					<td class="tac"><?php 
        echo Loc::getMessage('SALE_OANALYSIS_ITEM_SHIPPED');
        ?>
</td>
					<td class="tac"><?php 
        echo Loc::getMessage('SALE_OANALYSIS_ITEM_TO_SHIP');
        ?>
</td>
				</tr>
				</thead>
				<tbody>
					<?php 
        foreach ($items as $item) {
            $properties = '<table style="margin: auto; width: 50%;">';
            if (is_array($item['SKU_PROPS'])) {
                foreach ($item['SKU_PROPS'] as $skuProp) {
                    $properties .= '<tr>';
                    $properties .= '<td style="text-align: left;">' . htmlspecialcharsbx($skuProp['NAME']) . ' : ' . '</td>';
                    if (isset($skuProp['VALUE']['PICT']) && $skuProp['VALUE']['PICT']) {
                        $properties .= '<td><span class="color"><img src="' . $skuProp['VALUE']['PICT'] . '" alt=""></span></td>';
                    } else {
                        $properties .= '<td><span>' . htmlspecialcharsbx($skuProp['VALUE']['NAME']) . '</span></td>';
                    }
                    $properties .= '</tr>';
                }
            }
            $properties .= '</table>';
            if (!($quantity = (double) $item['QUANTITY'])) {
                $quantity = 0;
            }
            if (!($shippedQuantity = $item['SHIPPED_QUANTITY'])) {
                $shippedQuantity = 0;
            }
            ?>
						<tr class="bdb-line">
							<td class="tac"><?php 
            echo ++$itemNo;
            ?>
</td>
							<td style="text-align: left;"><a class="fwb" href="<?php 
            echo $item['EDIT_PAGE_URL'];
            ?>
"><?php 
            echo htmlspecialcharsbx($item['NAME']);
            ?>
</a></td>
							<td class="tac"><?php 
            echo $properties;
            ?>
</td>
							<td class="tac"><?php 
            echo $quantity . ' ' . $item['MEASURE_TEXT'];
            ?>
</td>
							<td class="tac"><?php 
            echo $shippedQuantity . ' ' . $item['MEASURE_TEXT'];
            ?>
</td>
							<td class="tac"><?php 
            echo $quantity - $shippedQuantity . ' ' . $item['MEASURE_TEXT'];
            ?>
</td>
						</tr>
					<?php 
        }
        ?>
					<tr><td colspan="8" style="padding: 16px; background: #f7fafa; text-align: left;" class="fwb"><?php 
        echo Loc::getMessage('SALE_OANALYSIS_ITEMS_QUANTITY') . ': ' . count($items);
        ?>
</td></tr>
				</tbody>
			</table>
			<div class="adm-bus-table-contaier-white caption border" style="margin-top: 25px;">
				<div class="adm-bus-table-caption-white-title"><?php 
        echo Loc::getMessage('SALE_OANALYSIS_DOCUMENTS');
        ?>
:</div>
				<div class="adm-bus-orderdocs-threelist-container">
					<div class="adm-bus-orderdocs-threelist-block-top<?php 
        echo $selectPayment === null ? ' adm-bus-orderdocs-threelist-block-children-open' : '';
        ?>
">
						<div class="adm-bus-orderdocs-threelist-block-img adm-bus-orderdocs-threelist-block-img-order"></div>
						<div class="adm-bus-orderdocs-threelist-block-content">
							<div class="adm-bus-orderdocs-threelist-block-title">
								<a class="adm-bus-orderdocs-threelist-block-title-link fwb" href="/bitrix/admin/sale_order_edit.php?lang=ru&ID=<?php 
        echo $orderId;
        ?>
">
									<?php 
        echo Loc::getMessage('SALE_OANALYSIS_ORDER_TITLE', array('#USER_ID#' => $order->getField('USER_ID'), '#ORDER_ID#' => $orderId));
        ?>
								</a>
							</div>
							<?php 
        self::renderBottomBlocks($order->getField('DATE_INSERT'), $order->getField('RESPONSIBLE_ID'));
        ?>
						</div>
						<div class="clb"></div>
					</div>
					<?php 
        foreach ($documents as $document) {
            $isPayment = $document instanceof Payment;
            $documentId = $document->getId();
            ?>
						<div class="adm-bus-orderdocs-threelist-block-children<?php 
            echo $selectPayment === $isPayment && $selectId == $documentId ? ' adm-bus-orderdocs-threelist-block-children-open' : '';
            ?>
">
							<div class="adm-bus-orderdocs-threelist-block-img adm-bus-orderdocs-threelist-block-img-doc_<?php 
            echo $isPayment ? 'payment' : 'shipping';
            ?>
"></div>
							<div class="adm-bus-orderdocs-threelist-block-content">
								<div class="adm-bus-orderdocs-threelist-block-title">
									<?php 
            if ($isPayment) {
                ?>
										<?php 
                if ($document->isPaid()) {
                    ?>
											<span class="adm-bus-orderdocs-docstatus adm-bus-orderdocs-docstatus-paid"><?php 
                    echo Loc::getMessage('SALE_OANALYSIS_PAYMENT_PAID');
                    ?>
</span>
										<?php 
                } elseif ($document->isReturn()) {
                    ?>
											<span class="adm-bus-orderdocs-docstatus"><?php 
                    echo Loc::getMessage('SALE_OANALYSIS_PAYMENT_RETURN');
                    ?>
</span>
										<?php 
                }
                ?>
										<a href="/bitrix/admin/sale_order_payment_edit.php?order_id=<?php 
                echo $orderId;
                ?>
&payment_id=<?php 
                echo $documentId;
                ?>
" class="adm-bus-orderdocs-threelist-block-title-link">
											<?php 
                echo Loc::getMessage('SALE_OANALYSIS_PAYMENT_TITLE', array('#SYSTEM_NAME#' => htmlspecialcharsbx($document->getField('PAY_SYSTEM_NAME')), '#PAYMENT_ID#' => $documentId, '#SUM#' => SaleFormatCurrency($document->getField('SUM'), $document->getField('CURRENCY'))));
                ?>
										</a>
									<?php 
            } else {
                /* shipment*/
                ?>
										<?php 
                if ($document->isShipped()) {
                    ?>
											<span class="adm-bus-orderdocs-docstatus adm-bus-orderdocs-docstatus-shippingallowed"><?php 
                    echo Loc::getMessage('SALE_OANALYSIS_SHIPMENT_SHIPPED');
                    ?>
</span>
										<?php 
                } elseif ($document->isCanceled()) {
                    ?>
											<span class="adm-bus-orderdocs-docstatus adm-bus-orderdocs-docstatus-canceled"><?php 
                    echo Loc::getMessage('SALE_OANALYSIS_SHIPMENT_CANCELED');
                    ?>
</span>
										<?php 
                } elseif ($document->isAllowDelivery()) {
                    ?>
											<span class="adm-bus-orderdocs-docstatus adm-bus-orderdocs-docstatus-shippingallowed"><?php 
                    echo Loc::getMessage('SALE_OANALYSIS_SHIPMENT_ALLOWED');
                    ?>
</span>
										<?php 
                }
                ?>
										<a href="/bitrix/admin/sale_order_shipment_edit.php?order_id=<?php 
                echo $orderId;
                ?>
&shipment_id=<?php 
                echo $documentId;
                ?>
"
										   class="adm-bus-orderdocs-threelist-block-title-link<?php 
                echo $document->isCanceled() ? 'adm-bus-orderdocs-threelist-block-title-link-canceled' : '';
                ?>
">
											<?php 
                echo Loc::getMessage('SALE_OANALYSIS_SHIPMENT_TITLE', array('#SHIPMENT_ID#' => $documentId, '#ORDER_ID#' => $orderId));
                ?>
										</a>
									<?php 
            }
            ?>
								</div>
								<?php 
            self::renderBottomBlocks($document->getField($isPayment ? 'DATE_BILL' : 'DATE_INSERT'), $document->getField('RESPONSIBLE_ID'));
            ?>
							</div>
							<div class="clb"></div>
						</div>
					<?php 
        }
        ?>
				</div>
			</div>
		</div>
		<?php 
        $result = ob_get_contents();
        ob_end_clean();
        return $result;
    }
Exemple #7
0
 /**
  * @return array
  */
 protected function loadAvailableList()
 {
     $order = $this->getOrder();
     $basket = $order->getBasket();
     if (!$basket) {
         return null;
     }
     if (!$order->isUsedVat()) {
         $taxExemptList = static::loadExemptList($order->getUserId());
         $taxRateRes = \CSaleTaxRate::GetList(array("APPLY_ORDER" => "ASC"), array("LID" => $order->getSiteId(), "PERSON_TYPE_ID" => $order->getPersonTypeId(), "ACTIVE" => "Y", "LOCATION" => $order->getTaxLocation()));
         while ($taxRate = $taxRateRes->GetNext()) {
             if (!in_array(intval($taxRate["TAX_ID"]), $taxExemptList)) {
                 if ($taxRate["IS_PERCENT"] != "Y") {
                     $taxRate["VALUE"] = RoundEx(\CCurrencyRates::convertCurrency($taxRate["VALUE"], $taxRate["CURRENCY"], $order->getCurrency()), SALE_VALUE_PRECISION);
                     $taxRate["CURRENCY"] = $order->getCurrency();
                 }
                 $this->availableList[] = $taxRate;
             }
         }
     } else {
         $this->availableList[] = array("NAME" => Loc::getMessage("SOA_VAT"), "IS_PERCENT" => "Y", "VALUE" => $order->getVatRate() * 100, "VALUE_FORMATED" => "(" . $order->getVatRate() * 100 . "%, " . GetMessage("SOA_VAT_INCLUDED") . ")", "VALUE_MONEY" => $order->getVatSum(), "VALUE_MONEY_FORMATED" => SaleFormatCurrency($order->getVatSum(), $order->getCurrency()), "APPLY_ORDER" => 100, "IS_IN_PRICE" => "Y", "CODE" => "VAT");
     }
     return $this->availableList;
 }
Exemple #8
0
        foreach ($vats as $vatRate => $vatSum) {
            $arCells[++$n] = array(1 => null, null, null, null, null, sprintf("Impuesto (%s%%):", roundEx($vatRate * 100, SALE_VALUE_PRECISION)), SaleFormatCurrency($vatSum, $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"], false));
        }
    } else {
        $dbTaxList = CSaleOrderTax::GetList(array("APPLY_ORDER" => "ASC"), array("ORDER_ID" => $ORDER_ID));
        while ($arTaxList = $dbTaxList->Fetch()) {
            $arCells[++$n] = array(1 => null, null, null, null, null, htmlspecialcharsbx(sprintf("%s%s%s:", $arTaxList["IS_IN_PRICE"] == "Y" ? "Incluido " : "", $arTaxList["TAX_NAME"], sprintf(' (%s%%)', roundEx($arTaxList["VALUE"], SALE_VALUE_PRECISION)))), SaleFormatCurrency($arTaxList["VALUE_MONEY"], $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"], false));
        }
    }
    if (DoubleVal($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["SUM_PAID"]) > 0) {
        $arCells[++$n] = array(1 => null, null, null, null, null, "Pago hecho:", SaleFormatCurrency($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["SUM_PAID"], $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"], false));
    }
    if (DoubleVal($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["DISCOUNT_VALUE"]) > 0) {
        $arCells[++$n] = array(1 => null, null, null, null, null, "Descuento:", SaleFormatCurrency($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["DISCOUNT_VALUE"], $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"], false));
    }
    $arCells[++$n] = array(1 => null, null, null, null, null, "Total:", SaleFormatCurrency($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["SHOULD_PAY"], $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"], false));
}
?>
<table class="it" width="100%">
	<tr>
		<td><nobr>#</nobr></td>
		<td><nobr>Artículo / Descripción</nobr></td>
		<td><nobr>Cant</nobr></td>
		<td><nobr>Unidades</nobr></td>
		<td><nobr>Precio unitario</nobr></td>
		<?php 
if ($vat > 0) {
    ?>
		<td><nobr>Tasa impositiva</nobr></td>
		<?php 
}
Exemple #9
0
">
Вы хотите оплатить через систему <b>www.kreditpilot.ru</b>.<br>
Cчет № <?php 
echo $ORDER_ID . " от " . CSalePaySystemAction::GetParamValue("DATE_INSERT");
?>
<br>
<input type=hidden name=BillDescription value="Order &nbsp;<?php 
echo $ORDER_ID;
?>
&nbsp">
<input type=hidden name=BillSum value="<?php 
echo CSalePaySystemAction::GetParamValue("SHOULD_PAY");
?>
">
Сумма к оплате по счету: <?php 
echo SaleFormatCurrency(CSalePaySystemAction::GetParamValue("SHOULD_PAY"), CSalePaySystemAction::GetParamValue("CURRENCY"));
?>
<br>
<input type=hidden name=BillShopId value="<?php 
echo CSalePaySystemAction::GetParamValue("SHOP_ID");
?>
">
<input type=hidden name=BillDate value="<?php 
echo CSalePaySystemAction::GetParamValue("DATE_INSERT");
?>
">
<input type=hidden name=BillCurrency value="<?php 
echo CSalePaySystemAction::GetParamValue("CURRENCY") == "RUR" ? "руб." : "";
?>
">
<br>
Exemple #10
0
         $basketName .= "<nobr><a href=\"" . $url . "\">";
         $basket .= "<nobr><a href=\"" . $url . "\">";
     }
     $basket .= htmlspecialcharsBx($arB["NAME"]);
     $basketName .= htmlspecialcharsBx($arB["NAME"]);
     if (strlen($arB["DETAIL_PAGE_URL"]) > 0) {
         $basketName .= "</a></nobr>";
         $basket .= "</a></nobr>";
     }
     $measure = isset($arB["MEASURE_TEXT"]) ? $arB["MEASURE_TEXT"] : GetMessage("SB_SHT");
     $basket .= " (" . $arB["QUANTITY"] . " " . $measure . ") - " . "<nobr>" . SaleFormatCurrency($arB["PRICE"], $arB["CURRENCY"]) . "</nobr><br>";
     $dbProp = CSaleBasket::GetPropsList(array("SORT" => "ASC", "ID" => "ASC"), array("BASKET_ID" => $arB["ID"], "!CODE" => array("CATALOG.XML_ID", "PRODUCT.XML_ID")));
     while ($arProp = $dbProp->GetNext()) {
         $basket .= "<div><small>" . $arProp["NAME"] . ": " . $arProp["VALUE"] . "</small></div>";
     }
     $basketPrice .= "<nobr>" . SaleFormatCurrency($arB["PRICE"], $arB["CURRENCY"]) . "</nobr>";
     $basketQuantity .= $arB["QUANTITY"];
     if ($arB["SUBCRIBE"] == "Y") {
         $basketAvaible .= GetMessage("SB_TYPE_SUB");
     } elseif ($arB["DELAY"] == "Y") {
         $basketAvaible .= GetMessage("SB_TYPE_DEL");
     } elseif ($arB["CAN_BUY"] == "Y") {
         $basketAvaible .= GetMessage("SB_TYPE_AV");
     } else {
         $basketAvaible .= GetMessage("SB_TYPE_NA");
     }
 }
 $row->AddField("BASKET", $basket);
 $row->AddField("BASKET_NAME", $basketName);
 $row->AddField("BASKET_PRICE", $basketPrice);
 $row->AddField("BASKET_QUANTITY", $basketQuantity);
Exemple #11
0
/**
 * событие вызывается перед отправкой письма о новом заказе
 * @param $orderID
 * @param $eventName
 * @param $arFields
 */
function bxModifySaleMails($order_id, &$eventName, &$arFieldsEmail)
{
                                             
    //unset($_SESSION['OnBeforeOrderAddHandler']);
    //$_SESSION['OnBeforeOrderAddHandler']['bxModifySaleMails']='bxModifySaleMails';
    //$_SESSION['OnBeforeOrderAddHandler']['id']=$order_id;
    //$_SESSION['OnBeforeOrderAddHandler']['arFields']=$arFieldsorder_old;
    $basket_props="";
    $post['INFO']="";
    $id_product=array();
    if(
        (CModule::IncludeModule("main"))
        &&
        (CModule::IncludeModule("iblock"))
        &&
        (CModule::IncludeModule("catalog"))
        &&
        (CModule::IncludeModule("sale"))
    ){


        /**
         * получаем параметры сформировавшегося старого заказа
         */
        $arFieldsorder_old = CSaleOrder::GetByID($order_id);
        /*
        echo "<pre>";
        var_dump($arFieldsorder_old);die();
        echo "</pre>";*/
        /**
         * выборка свойства сформировавшегося заказа по id заказа
         */
        $db_props = CSaleOrderPropsValue::GetOrderProps($order_id);
        $arFields_props = array();

        while ($arProps = $db_props->Fetch())
        {
            $arFields_props_old[$arProps['CODE']]=$arProps;

        }
        //_debug($arFields_props_old);

        /**
         * выборка из корзины по id заказа
         * получаем масси id продукта
         */
         
         $rsUser = CUser::GetByID(CUser::GetID());
         $arUser = $rsUser->Fetch();
         /*if (!$ORDER_ID = CSaleOrder::Add(array(
                                        "LID"              => SITE_ID,
                                        "PERSON_TYPE_ID"   => 1,
                                        "PAYED"            => "N",
                                        "CANCELED"         => "N",
                                        "STATUS_ID"        => "N",
                                        "PRICE"            => 0,
                                        "CURRENCY"         => CSaleLang::GetLangCurrency(SITE_ID),
                                        "USER_ID"          => $arUser['ID'],
                                        "PAY_SYSTEM_ID"    => $arFieldsorder_old['PAY_SYSTEM_ID'],
                                        "PRICE_DELIVERY"   => 0,
                                        "DELIVERY_ID"      => $arFieldsorder_old['DELIVERY_ID'],
                                        "DISCOUNT_VALUE"   => $arFieldsorder_old['DISCOUNT_VALUE'],
                                        "TAX_VALUE"        => $arFieldsorder_old['TAX_VALUE'],
                                        "USER_DESCRIPTION" => $post['INFO']
         ))){

                                        $rows['msg'] = 'Ошибка создания заказа';
                                        $fail          = true;
        }else{
                                        $rows['msg']=$ORDER_ID;
                                        //continue;
        }*/

        $dbBasketItems = CSaleBasket::GetList(
            array("ID" => "ASC"),
            array(
                "LID" => SITE_ID,
                "ORDER_ID" => $order_id
            ),
            false,
            false,
            array()
        );
        while ($arItem = $dbBasketItems->Fetch()){
            $id_product[] = $arItem['PRODUCT_ID'];
            $products_basket[$arItem['PRODUCT_ID']]=$arItem;
        }
        
        foreach($products_basket as $product){
            $price_product+=$product['PRICE']*$product['QUANTITY'];
            $products_descriptions.=$product['NAME']." - ".$product['QUANTITY']." шт: ".intval($product['PRICE'])." руб <br/>";
        
        }
        $price_product+=$arFieldsorder_old["PRICE_DELIVERY"];
        //$_SESSION['OnBeforeOrderAddHandler']['products_basket']=$products_basket;

        /**
         * получаем массив id партнеров из продукта
         */
        //var_dump($id_product);die();         

        if($id_product){
            $id_partner=array();
            $partner_product=array();
            $arSelect = Array("ID", "NAME","IBLOCK_ID","PROPERTY_PARTNER");
            $arFilter = Array("ID"=>$id_product, "ACTIVE"=>"Y");
            $res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
            
            while($ob = $res->GetNextElement())
            {
                $arFields = $ob->GetFields();
                $partner_product[$arFields['PROPERTY_PARTNER_VALUE']][]=$products_basket[$arFields['ID']];
                if($arFields['PROPERTY_PARTNER_VALUE']){
                    $id_partner[]=$arFields['PROPERTY_PARTNER_VALUE'];
                }
            }
            //$_SESSION['OnBeforeOrderAddHandler']['id_partner']=$id_partner;

            /**
             * получаем массив данных партнера
             */
         
            if($id_partner){
                            
                            
                $delivery_sum = null;
                $arSelect2 = Array("ID", "IBLOCK_ID", "NAME","PROPERTY_*");
                $arFilter2 = Array("IBLOCK_ID"=>9, "ACTIVE"=>"Y","ID"=>$id_partner,);
                $res2 = CIBlockElement::GetList(Array(), $arFilter2, false, false, $arSelect2);
                /**
                 * eсли в выборке корзине в продуктах больше чем один партнер
                 * то разбиваем заказ по количеству партнеров
                 */
                if (intval($res2->SelectedRowsCount())>0){
                    while($ob2 = $res2->GetNextElement()){
                        $arFields_partners = $ob2->GetFields();
                        $arProperties_partners = $ob2->GetProperties();
                        //_debug($arProperties_partners);
                        //$price_product=0;
                        //$products_descriptions="";
                        $arEventFields=array();
                        //echo $arFields_partners['ID'];
                        
                        
                        if($partner_product[$arFields_partners['ID']]){

                            $i=0;
                            $size_of_productpartner=sizeof($partner_product[$arFields_partners['ID']]);
                            foreach($partner_product[$arFields_partners['ID']] as $key_price=>$item_price){
                                //_debug($item_price);
                                $quantity=1;
                                /**
                                 * формируем новый пустой заказ
                                 */
                                if(!$i){


                                    if (!$ORDER_ID = CSaleOrder::Add(array(
                                        "LID"              => SITE_ID,
                                        "PERSON_TYPE_ID"   => 1,
                                        "PAYED"            => "N",
                                        "CANCELED"         => "N",
                                        "STATUS_ID"        => "N",
                                        "PRICE"            => 0,
                                        "CURRENCY"         => CSaleLang::GetLangCurrency(SITE_ID),
                                        "USER_ID"          => $arUser['ID'],
                                        "PAY_SYSTEM_ID"    => $arFieldsorder_old['PAY_SYSTEM_ID'],
                                        "PRICE_DELIVERY"   => 0,
                                        "DELIVERY_ID"      => $arFieldsorder_old['DELIVERY_ID'],
                                        "DISCOUNT_VALUE"   => $arFieldsorder_old['DISCOUNT_VALUE'],
                                        "TAX_VALUE"        => $arFieldsorder_old['TAX_VALUE'],
                                        "USER_DESCRIPTION" => $post['INFO']
                                    ))){

                                        $rows['msg'] = 'Ошибка создания заказа';
                                        $fail          = true;
                                    }else{
                                        $rows['msg']=$ORDER_ID;
                                        //continue;
                                    }
                                }

                                /**
                                 * добавляем по id заказа в корзину товары партнера
                                 */
                                if (!Add2BasketByProductID($item_price['PRODUCT_ID'], $item_price['QUANTITY'], array(
                                    'ORDER_ID' => $ORDER_ID,
                                ), $basket_props)) {
                                    $rows['err'] = 'Ошибка добавления товара в заказ';
                                    $fail          = true;
                                }

                                /*$price_product+=$item_price['PRICE']*$item_price['QUANTITY'];
                                $products_descriptions.=$item_price['NAME']." - ".$item_price['QUANTITY']." шт: ".intval($item_price['PRICE'])." руб <br/>";
                                */


                                $i++;
                                /**
                                 * обновляем параметры нового заказа на актуальные
                                 */
                                if($size_of_productpartner==$i){
                                    if (!$fail) {
                                        $dbBasketItems = CSaleBasket::GetList(
                                            array("NAME" => "ASC", "ID" => "ASC"), array(
                                                "LID"      => SITE_ID,
                                                "ORDER_ID" => $ORDER_ID
                                            ), false, false, array(
                                                "ID", "NAME", "QUANTITY", "CURRENCY", "CAN_BUY", "PRICE", "WEIGHT", "DISCOUNT_PRICE"
                                            )
                                        );

                                        $summ          = $weight        = 0;
                                        $strOrderList  = "";


                                        $arBasket      = array();
                                        while ($arBasketItems = $dbBasketItems->GetNext()) {
                                            $strOrderList .= $arBasketItems["NAME"] . " - " . $arBasketItems["QUANTITY"] . " шт на " . SaleFormatCurrency($arBasketItems["PRICE"] * $arBasketItems["QUANTITY"], $arBasketItems["CURRENCY"]);
                                            $strOrderList .= "\n";
                                            $rows['summ']=$summ += roundEx($arBasketItems["PRICE"], SALE_VALUE_PRECISION) * DoubleVal($arBasketItems["QUANTITY"]);
                                            $weight += doubleval($arBasketItems['WEIGHT']);
                                            $arBasket[] = $arBasketItems;
                                        }
                                        $arOrderForDiscount = array(
                                            'SITE_ID'      => SITE_ID,
                                            'USER_ID'      => $arUser['ID'],
                                            'ORDER_PRICE'  => $summ,
                                            'ORDER_WEIGHT' => $weight,
                                            'BASKET_ITEMS' => $arBasket,
                                        );
                                        $arDiscountOptions  = array();
                                        $arDiscountErrors   = array();
                                        CSaleDiscount::DoProcessOrder($arOrderForDiscount, $arDiscountOptions, $arDiscountErrors);
                                        if($_REQUEST['comment'])
                                            $arOrderForDiscount['COMMENTS'] = $_REQUEST['comment'];
                                        if($arProperties_partners['DOSTAVKA']['VALUE']){
                                            $arOrderForDiscount["PRICE_DELIVERY"] = $arProperties_partners['DOSTAVKA']['VALUE'];
                                            $arOrderForDiscount["DELIVERY_ID"] = 3;
                                            $summ += intval($arProperties_partners['DOSTAVKA']['VALUE']);
                                            $arOrderForDiscount['ORDER_PRICE']=$summ;
                                        }
                                        $arOrderForDiscount['PRICE_BEFORE'] = $summ;
                                        $arOrderForDiscount['PRICE']        = $summ;
                                        $arOrderForDiscount['WEIGHT']       = $arOrderForDiscount['ORDER_WEIGHT'];
                                        /**
                                         * обновляем заказ
                                         */
                                        if (!CSaleOrder::Update($ORDER_ID, $arOrderForDiscount)) {
                                            $rows['err'] = 'Ошибка расчета цены заказа.';
                                            $fail          = true;
                                        }else{

                                            /**
                                             * перезагружаем свойства заказ из старого
                                             */
                                            $db_props_new = CSaleOrderPropsValue::GetOrderProps($ORDER_ID);
                                            $arFields_props_new = array();
                                            while ($arProps_new = $db_props_new->Fetch())
                                            {
                                                //_debug($arProps_new);
                                                foreach($arFields_props_old as $key_props_old=>$item_props_old){
                                                    if($arProps_new['CODE']==$key_props_old){
                                                        CSaleOrderPropsValue::Update($arProps_new['ID'], array("VALUE"=>$item_props_old['VALUE']));
                                                        unset($arFields_props_old[$key_props_old]);
                                                    }
                                                }

                                            }
                                            if(sizeof($arFields_props_old)>0){
                                                foreach($arFields_props_old as $key_props_old2=>$item_props_old2){
                                                    CSaleOrderPropsValue::Add(array(
                                                        'NAME'           => $item_props_old2['NAME'],
                                                        'CODE'           => $item_props_old2['CODE'],
                                                        'ORDER_PROPS_ID' => $item_props_old2['ORDER_PROPS_ID'],
                                                        'ORDER_ID'       => $ORDER_ID,
                                                        'VALUE'          => $item_props_old2['VALUE']
                                                    ));
                                                }
                                            }
                                            /**
                                             * добавляем в свойство заказа id партнера для дальнейшей фильтрации по партнерским заказам
                                             */
                                            CSaleOrderPropsValue::Add(array(
                                                'NAME'           => "Привязка по партнеру",
                                                'CODE'           => "PATNERID",
                                                'ORDER_PROPS_ID' => 21,
                                                'ORDER_ID'       => $ORDER_ID,
                                                'VALUE'          => $arFields_partners['ID']
                                            ));


                                            //$price_product+=$arProperties_partners['DOSTAVKA']['VALUE'];
                                            //$price_product+=$arFieldsorder_old["PRICE_DELIVERY"];
                                            /**
                                             * отправляем данные о товаре Партнерам
                                             */
           
                                            if($arFields_partners['NAME']){  //если есть партнер у товара                              
                                                $arEventFields = Array(
                                                    "ORDER_ID"=> $ORDER_ID,
                                                    "ORDER_DATE"=> date("d.m.Y H:i:s"),
                                                    "ORDER_USER"=> $arFields_partners['NAME'],
                                                    "PRICE"=> $price_product,
                                                    "EMAIL"=> $arProperties_partners['EMAIL']['VALUE'],
                                                    "ORDER_LIST"=> $products_descriptions,
                                                    //"DELIVERY_PRICE"=>$arProperties_partners['DOSTAVKA']['VALUE']
                                                    "DELIVERY_PRICE"=>$arFieldsorder_old["PRICE_DELIVERY"]
                                                );
                                                $event = new CEvent;
                                                $event->SendImmediate("SALE_NEW_ORDERPARTNER", SITE_ID, $arEventFields);
                                            }
                                            
                                            
                                        }
                                    }
                                    //                        if(!$fail){
                                    //                            $ar_res_product=CCatalogProduct::GetByID($PRODUCT['ID']);
                                    //                            $arFields_quant = array(
                                    //                                'QUANTITY' => $ar_res_product['QUANTITY']-1
                                    //                            );
                                    //                            CCatalogProduct::Update($PRODUCT['ID'], $arFields_quant);
                                    //                        }

                                }

                            }
                        }
                    }
                    /**
                     * удаляем старый заказ после разбивки на новые
                     */
                    if($ORDER_ID ){
                        CSaleOrder::Delete($order_id);
                    }
                }
            }
            
            
            $arEventFields = Array(
                "ORDER_ID" =>$order_id,
                "ORDER_DATE" =>date("d.m.Y H:i:s"),
                "ORDER_USER" =>$arUser['NAME'],
                "PRICE" =>$price_product,
                "EMAIL" => $arUser['EMAIL'],
                "ORDER_LIST" =>$products_descriptions,
                "DELIVERY_PRICE"=>$arFieldsorder_old["PRICE_DELIVERY"]
            );
            $event = new CEvent;
            $event->SendImmediate("SALE_NEW_BILET", SITE_ID, $arEventFields); 
            
            
        }
    }
    //$_SESSION['OnBeforeOrderAddHandler']['rows']=$rows;
    return false;

}
Exemple #12
0
 function getOrderInfoDetail($orderId)
 {
     if (!$orderId) {
         return false;
     }
     if (!$GLOBALS["USER"]->IsAuthorized()) {
         return false;
     }
     $arFilter["ID"] = $orderId;
     $saleModulePermissions = $GLOBALS["APPLICATION"]->GetGroupRight("sale");
     if ($saleModulePermissions == "D") {
         $arFilter["USER_ID"] = IntVal($GLOBALS["USER"]->GetID());
     } elseif ($saleModulePermissions != "W") {
         $arFilter["STATUS_PERMS_GROUP_ID"] = $GLOBALS["USER"]->GetUserGroupArray();
         $arFilter[">=STATUS_PERMS_PERM_VIEW"] = "Y";
     }
     $arOrder = array();
     $dbOrder = CSaleOrder::GetList(array(), $arFilter);
     $arOrder = $dbOrder->GetNext();
     if (!$arOrder) {
         return false;
     }
     $arOrder["STATUS"] = CSaleStatus::GetLangByID($arOrder["STATUS_ID"]);
     $arOrder["STATUS_NAME"] = $arOrder["STATUS"]["NAME"];
     $arOrder["PRICE_IN_ALL_NUM"] = floatval($arOrder["~PRICE"] + floatval($arOrder["~PRICE_DELIVERY"]));
     $arOrder["PRICE_IN_ALL"] = SaleFormatCurrency($arOrder["PRICE_IN_ALL_NUM"], $arOrder["CURRENCY"]);
     $arOrder["PRICE_STR"] = SaleFormatCurrency($arOrder["PRICE"], $arOrder["CURRENCY"]);
     $arOrder["PERSON_TYPE"] = CSalePersonType::GetByID($arOrder["PERSON_TYPE_ID"]);
     $arOrder["PERSON_TYPE_NAME"] = htmlspecialcharsbx($arOrder["PERSON_TYPE"]["NAME"]);
     $arOrder = self::getOrderProps($arOrder);
     $arOrder["DELIVERY_NAME"] = self::getDeliveriesInfo(array($arOrder["DELIVERY_ID"]));
     $arOrder["DELIVERY_NAME"] = $arOrder["DELIVERY_NAME"][$arOrder["DELIVERY_ID"]];
     $arPaySys = CSalePaySystem::GetByID($arOrder["PAY_SYSTEM_ID"], $arOrder["PERSON_TYPE_ID"]);
     $arOrder["PAY_SYSTEM_NAME"] = $arPaySys["NAME"];
     $dbUserAccount = CSaleUserAccount::GetList(array(), array("USER_ID" => $arOrder["USER_ID"], "CURRENCY" => $arOrder["CURRENCY"], "LOCKED" => "N"));
     $arUserAccount = $dbUserAccount->GetNext();
     $arOrder["CURRENT_BUDGET"] = $arUserAccount["CURRENT_BUDGET"] ? $arUserAccount["CURRENT_BUDGET"] : 0;
     $arOrder["CURRENT_BUDGET_STRING"] = SaleFormatCurrency($arOrder["CURRENT_BUDGET"], $arOrder["CURRENCY"]);
     return $arOrder;
 }
Exemple #13
0
                }
            }
            ?>
							</td>
						<?php 
        } elseif ($arColumn["id"] == "PRICE_FORMATED") {
            ?>
							<td class="price right">
								<div class="current_price"><?php 
            echo $arItem["PRICE_FORMATED"];
            ?>
</div>
								<div class="old_price right">
									<?php 
            if (doubleval($arItem["DISCOUNT_PRICE"]) > 0) {
                echo SaleFormatCurrency($arItem["PRICE"] + $arItem["DISCOUNT_PRICE"], $arItem["CURRENCY"]);
                $bUseDiscount = true;
            }
            ?>
								</div>

								<?php 
            if ($bPriceType && strlen($arItem["NOTES"]) > 0) {
                ?>
									<div style="text-align: left">
										<div class="type_price"><?php 
                echo GetMessage("SALE_TYPE");
                ?>
</div>
										<div class="type_price_value"><?php 
                echo $arItem["NOTES"];
                   </a>
               </td>
               <td>
                 <font face="Arial, Helvetica, sans-serif" color="#4f4f4f" size="3">' . $arItem["QUANTITY"] . '</font>
               </td>
               <td>
                 <font face="Arial, Helvetica, sans-serif" color="#4f4f4f" size="3">' . number_format($arItem["PRICE"], 0, ' ', ' ') . '</font>
                 <font face="Arial, Helvetica, sans-serif" color="#4f4f4f" size="2">' . GetMessage('SOA_CURRENCY_NS') . '</font> 
               </td>
           </tr>';
     }
     $strOrderList .= '</table>';
     $find = array('#SERVER_NAME#', '#SITE_TEMPLATE_PATH#');
     $repl = array($_SERVER['SERVER_NAME'], SITE_TEMPLATE_PATH);
     $social = str_replace($find, $repl, file_get_contents($_SERVER["DOCUMENT_ROOT"] . SITE_TEMPLATE_PATH . '/include_areas/newsletter_social.php'));
     $arFields = array("ORDER_ID" => $arOrder["ACCOUNT_NUMBER"], "ORDER_DATE" => Date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT", SITE_ID))), "ORDER_USER" => strlen($arUserResult["PAYER_NAME"]) > 0 ? $arUserResult["PAYER_NAME"] : $USER->GetFormattedName(false), "PRICE" => SaleFormatCurrency($orderTotalSum, $arResult["BASE_LANG_CURRENCY"]), "BCC" => COption::GetOptionString("sale", "order_email", "order@" . $SERVER_NAME), "EMAIL" => strlen($arUserResult["USER_EMAIL"]) > 0 ? $arUserResult["USER_EMAIL"] : $USER->GetEmail(), "ORDER_LIST" => $strOrderList, "SALE_EMAIL" => COption::GetOptionString("sale", "order_email", "order@" . $SERVER_NAME), "DELIVERY_PRICE" => $arResult["DELIVERY_PRICE"], "SITE_TEMPLATE_PATH" => SITE_TEMPLATE_PATH, "SHOP_ADDRESS" => file_get_contents($_SERVER["DOCUMENT_ROOT"] . SITE_TEMPLATE_PATH . '/include_areas/address.php'), "SHOP_EMAIL" => file_get_contents($_SERVER["DOCUMENT_ROOT"] . SITE_TEMPLATE_PATH . '/include_areas/email.php'), "SHOP_SKYPE" => file_get_contents($_SERVER["DOCUMENT_ROOT"] . SITE_TEMPLATE_PATH . '/include_areas/skype.php'), "SHOP_PHONE" => file_get_contents($_SERVER["DOCUMENT_ROOT"] . SITE_TEMPLATE_PATH . '/include_areas/phone.php'), "SHOP_SOCIAL" => $social);
     $eventName = "SALE_NEW_ORDER";
     $bSend = true;
     foreach (GetModuleEvents("sale", "OnOrderNewSendEmail", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array($arResult["ORDER_ID"], &$eventName, &$arFields)) === false) {
             $bSend = false;
         }
     }
     if ($bSend) {
         $event = new CEvent();
         $event->Send($eventName, SITE_ID, $arFields, "N");
     }
     CSaleMobileOrderPush::send("ORDER_CREATED", array("ORDER_ID" => $arFields["ORDER_ID"]));
 }
 if (empty($arResult["ERROR"])) {
     if (CModule::IncludeModule("statistic")) {
Exemple #15
0
    } else {
        $dbTaxList = CSaleOrderTax::GetList(array("APPLY_ORDER" => "ASC"), array("ORDER_ID" => $ORDER_ID));
        while ($arTaxList = $dbTaxList->Fetch()) {
            $arCells[++$n] = array(1 => null, null, null, null, null, CSalePdf::prepareToPdf(sprintf("%s%s%s:", $arTaxList["IS_IN_PRICE"] == "Y" ? "inkl." : "zzgl.", sprintf(' %s%% ', roundEx($arTaxList["VALUE"], SALE_VALUE_PRECISION)), $arTaxList["TAX_NAME"])), CSalePdf::prepareToPdf(SaleFormatCurrency($arTaxList["VALUE_MONEY"], $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"], false)));
            $arRowsWidth[7] = max($arRowsWidth[7], $pdf->GetStringWidth($arCells[$n][7]));
        }
    }
    if (DoubleVal($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["SUM_PAID"]) > 0) {
        $arCells[++$n] = array(1 => null, null, null, null, null, CSalePdf::prepareToPdf("Payment made:"), CSalePdf::prepareToPdf(SaleFormatCurrency($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["SUM_PAID"], $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"], false)));
        $arRowsWidth[7] = max($arRowsWidth[7], $pdf->GetStringWidth($arCells[$n][7]));
    }
    if (DoubleVal($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["DISCOUNT_VALUE"]) > 0) {
        $arCells[++$n] = array(1 => null, null, null, null, null, CSalePdf::prepareToPdf("Rabatt:"), CSalePdf::prepareToPdf(SaleFormatCurrency($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["DISCOUNT_VALUE"], $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"], false)));
        $arRowsWidth[7] = max($arRowsWidth[7], $pdf->GetStringWidth($arCells[$n][7]));
    }
    $arCells[++$n] = array(1 => null, null, null, null, null, CSalePdf::prepareToPdf("Gesamtbetrag:"), CSalePdf::prepareToPdf(SaleFormatCurrency($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["SHOULD_PAY"], $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["CURRENCY"], false)));
    $arRowsWidth[7] = max($arRowsWidth[7], $pdf->GetStringWidth($arCells[$n][7]));
    for ($i = 1; $i <= 7; $i++) {
        $arRowsWidth[$i] += 10;
    }
    if ($vat <= 0) {
        $arRowsWidth[6] = 0;
    }
    $arRowsWidth[2] = $width - (array_sum($arRowsWidth) - $arRowsWidth[2]);
}
$pdf->Ln();
$x0 = $pdf->GetX();
$y0 = $pdf->GetY();
for ($i = 1; $i <= 7; $i++) {
    if ($vat > 0 || $i != 6) {
        $pdf->Cell($arRowsWidth[$i], 20, $arColsCaption[$i], 0, 0, 'C');
Exemple #16
0
echo SaleFormatCurrency($str_DISCOUNT_VALUE, $str_CURRENCY);
?>
								</div>
							</td>
						</tr>
							<tr class="itog">
								<td class='ileft'>
									<div><?php 
echo GetMessage("NEWO_TOTAL_TOTAL");
?>
</div>
								</td>
								<td class='iright' nowrap>
									<div id="ORDER_PRICE_ALL" style="white-space:nowrap;">
										<?php 
echo SaleFormatCurrency($str_PRICE, $str_CURRENCY);
?>
									</div>
								</td>
							</tr>
						</table>
					</div>
				</td>
			</tr>
		</table>
	</td>
</tr>
<?
$tabControl->EndCustomField("BASKET_CONTAINER");

if (!defined('BX_PUBLIC_MODE') || BX_PUBLIC_MODE != 1)
Exemple #17
0
<?php 
echo GetMessage("SASP_PROMT");
?>
<br>
<?php 
echo GetMessage("SASP_ACCOUNT_NO");
?>
 <?php 
echo $orderID . GetMessage("SASP_ORDER_FROM") . $dateInsert;
?>
<br>
<?php 
echo GetMessage("SASP_ORDER_SUM");
?>
 <b><?php 
echo SaleFormatCurrency($shouldPay, $currency);
?>
</b><br>
<br>
<INPUT TYPE="HIDDEN" NAME="Merchant_ID" VALUE="<?php 
echo CSalePaySystemAction::GetParamValue("SHOP_IDP");
?>
">
<INPUT TYPE="HIDDEN" NAME="OrderNumber" VALUE="<?php 
echo $orderID;
?>
">
<INPUT TYPE="HIDDEN" NAME="OrderAmount" VALUE="<?php 
echo str_replace(",", ".", $shouldPay);
?>
">
Exemple #18
0
    private static function getViewTemplate($data, $index, $form)
    {
        $psData = self::getPaySystemParams($data['PAY_SYSTEM_ID'], $data['PERSON_TYPE_ID']);
        if (isset($psData["LOGOTIP_PATH"])) {
            $data['PAY_SYSTEM_LOGOTIP'] = $psData["LOGOTIP_PATH"];
        }
        $psResult = '';
        if ($psData['HAVE_RESULT'] == 'Y' && $form != 'edit') {
            $psResult .= '&nbsp;&nbsp;&nbsp;<span style="border-bottom: 1px dashed #658d0f; color: #658d0f; cursor: pointer" id="ps_update">Получить</span>';
        }
        $lang = Main\Application::getInstance()->getContext()->getLanguage();
        $paidString = $data['PAID'] == 'Y' ? 'YES' : 'NO';
        $isActive = $form != 'edit';
        $triangle = $isActive ? '<span class="triangle"> &#9662;</span>' : '';
        if ($data['PAID'] == 'Y') {
            $class = !$isActive ? 'class="not_active"' : '';
        } else {
            $class = !$isActive ? 'class="notpay not_active"' : 'class="notpay"';
        }
        $paymentStatus = '<span><span id="BUTTON_PAID_' . $index . '" ' . $class . '>' . Loc::getMessage('SALE_ORDER_PAYMENT_STATUS_' . $paidString) . '</span>' . $triangle . '</span>';
        $res = CompanyTable::getList(array('select' => array('NAME'), 'filter' => array('ID' => $data['COMPANY_ID'])));
        $company = $res->fetch();
        $paymentStatusBlockVoucherNum = '';
        if (strlen($data['PAY_VOUCHER_NUM']) > 0) {
            $paymentStatusBlockVoucherNum = '<tr>
										<td class="adm-detail-content-cell-l" width="40%"><br>' . Loc::getMessage('SALE_ORDER_PAYMENT_PAY_VOUCHER_NUM') . ':</td>
										<td class="adm-detail-content-cell-r tal">
											<br>
											' . htmlspecialcharsbx($data['PAY_VOUCHER_NUM']) . '
										</td>
									</tr>';
        }
        $paymentStatusBlockVoucherDate = '';
        if (strlen($data['PAY_VOUCHER_DATE']) > 0) {
            $paymentStatusBlockVoucherDate = '<tr>
												<td class="adm-detail-content-cell-l" width="40%">' . Loc::getMessage('SALE_ORDER_PAYMENT_PAY_VOUCHER_DATE') . ':</td>
												<td class="adm-detail-content-cell-r tal">
													<div class="adm-input-wrap adm-calendar-second" style="display: inline-block;">' . htmlspecialcharsbx($data['PAY_VOUCHER_DATE']) . '</div>
												</td>
											</tr>';
        }
        $paymentStatusBlockReturnNum = '';
        if (strlen($data['PAY_RETURN_NUM']) > 0) {
            $paymentStatusBlockReturnNum = '<tr>
			<td class="adm-detail-content-cell-l" width="40%"><br>' . Loc::getMessage('SALE_ORDER_PAYMENT_PAY_RETURN_NUM') . ':</td>
			<td class="adm-detail-content-cell-r tal">
				<br>' . htmlspecialcharsbx($data['PAY_RETURN_NUM']) . '</td>
			</tr>';
        }
        $paymentStatusBlockReturnDate = '';
        if (strlen($data['PAY_RETURN_DATE']) > 0) {
            $paymentStatusBlockReturnDate = '<tr>
				<td class="adm-detail-content-cell-l" width="40%">' . Loc::getMessage('SALE_ORDER_PAYMENT_PAY_RETURN_DATE') . ':</td>
				<td class="adm-detail-content-cell-r tal">
					<div class="adm-input-wrap adm-calendar-second" style="display: inline-block;">' . htmlspecialcharsbx($data['PAY_RETURN_DATE']) . '</div>
				</td>
			</tr>';
        }
        $result = '
		<div>
			<div class="adm-bus-pay" id="payment_container_' . $index . '">
				<input type="hidden" name="PAYMENT[' . $index . '][PAYMENT_ID]" id="PAYMENT_ID_' . $index . '" value="' . $data['ID'] . '">
				<div class="adm-bus-component-content-container">
					<div class="adm-bus-pay-section">
						<div class="adm-bus-pay-section-title-container">
							<div class="adm-bus-pay-section-title">' . Loc::getMessage('SALE_ORDER_PAYMENT_BLOCK_EDIT_PAYMENT_TITLE') . ' <span id="payment_' . $data['ID'] . '">#' . $data['ID'] . '</span>' . ($data['PAY_VOUCHER_DATE'] ? ' ' . Loc::getMessage('SALE_ORDER_PAYMENT_FROM') . ' ' . $data['PAY_VOUCHER_DATE'] : '') . '</div>
							<div class="adm-bus-pay-section-action-block">
								<div class="adm-bus-pay-section-action" id="SECTION_' . $index . '_DELETE">' . Loc::getMessage('SALE_ORDER_PAYMENT_DELETE') . '</div>
								<div class="adm-bus-pay-section-action" id="SECTION_' . $index . '_EDIT"><a href="/bitrix/admin/sale_order_payment_edit.php?order_id=' . $data['ORDER_ID'] . '&payment_id=' . $data['ID'] . '&backurl=' . urlencode($_SERVER['REQUEST_URI']) . '">' . Loc::getMessage('SALE_ORDER_PAYMENT_EDIT') . '</a></div>
								<div class="adm-bus-pay-section-action" id="SECTION_' . $index . '_TOGGLE">' . Loc::getMessage('SALE_ORDER_PAYMENT_TOGGLE_UP') . '</div>
							</div>
						</div>
						<div class="adm-bus-pay-section-content" id="SECTION_' . $index . '">
							<div class="adm-bus-pay-section-sidebar">
								<div class="adm-bus-pay-section-sidebar-service-logo">
									<img id="LOGOTIP_' . $index . '" src="' . $data['PAY_SYSTEM_LOGOTIP'] . '" alt="">
								</div>
							</div>
							<div class="adm-bus-pay-section-right">
								<div class="adm-bus-table-container caption border">
									<div class="adm-bus-table-caption-title" style="background: #eef5f5;">' . Loc::getMessage('SALE_ORDER_PAYMENT_METHOD') . '</div>
									<table border="0" cellspacing="0" cellpadding="0" width="100%" class="adm-detail-content-table edit-table ">
										<tbody>
											<tr>
												<td class="adm-detail-content-cell-l" width="40%">' . Loc::getMessage('SALE_ORDER_PAYMENT_PAY_SYSTEM') . ':</td>
												<td class="adm-detail-content-cell-r">' . htmlspecialcharsbx($data['PAY_SYSTEM_NAME']) . ' ' . $psResult . '</td>
											</tr>
										</tbody>
									</table>
								</div>
								<div class="adm-bus-table-container caption border">
									<div class="adm-bus-table-caption-title" style="background: #eef5f5;">' . Loc::getMessage('SALE_ORDER_PAYMENT_SUM') . '</div>
									<table border="0" cellspacing="0" cellpadding="0" width="100%" class="adm-detail-content-table edit-table ">
										<tbody>
											<tr>
												<td class="adm-detail-content-cell-l" width="40%">' . Loc::getMessage('SALE_ORDER_PAYMENT_PAYABLE_SUM') . ':</td>
												<td class="adm-detail-content-cell-r tal">' . SaleFormatCurrency($data['SUM'], $data['CURRENCY']) . '<br></td>
											</tr>
										</tbody>
									</table>
								</div>
								<div class="adm-bus-table-container caption border" style="padding-top:10px;">
									<div class="adm-bus-table-caption-title" style="background: #eef5f5;">' . Loc::getMessage('SALE_ORDER_PAYMENT_STATUS') . '</div>
									<table border="0" cellspacing="0" cellpadding="0" width="100%" class="adm-detail-content-table alternation edit-table" id="PAYMENT_BLOCK_STATUS_' . $index . '">
										<tbody>
											<tr>
												<td class="adm-detail-content-cell-l vat payment-status" width="40%">
													' . $paymentStatus . '
												</td>
												<td class="adm-detail-content-cell-r tal" id="PAYMENT_CHANGE_USER_INFO_' . $index . '">
													' . $data['DATE_PAID'] . '
													<a href="/bitrix/admin/user_edit.php?lang=' . $lang . '&ID=' . $data['EMP_PAID_ID'] . '">' . htmlspecialcharsbx($data['EMP_PAID_ID_NAME']) . ' ' . htmlspecialcharsbx($data['EMP_PAID_ID_LAST_NAME']) . '</a>
												</td>
											</tr>
										</tbody>
									</table>
									<table border="0" cellspacing="0" cellpadding="0" width="100%" class="adm-detail-content-table edit-table">
										<tbody>
										' . $paymentStatusBlockVoucherNum . $paymentStatusBlockVoucherDate . $paymentStatusBlockReturnNum . $paymentStatusBlockReturnDate . '
										</tbody>
									</table>
								</div>';
        if (isset($data['PS_STATUS']) && !empty($data['PS_STATUS'])) {
            $result .= '<div class="adm-bus-table-container caption border">
									<div class="adm-bus-table-caption-title" style="background: #eef5f5;">' . Loc::getMessage('SALE_ORDER_PAYMENT_PS_STATUS_TITLE') . '</div>
									<a href="javascript:void(0);" id="PS_INFO_' . $index . '">' . Loc::getMessage('SALE_ORDER_PAYMENT_TOGGLE_DOWN') . '</a>
									<table border="0" cellspacing="0" cellpadding="0" width="100%" class="adm-detail-content-table edit-table" style="display: none">
										<tbody>
										<tr>
											<td class="adm-detail-content-cell-l vat" width="40%">' . Loc::getMessage('SALE_ORDER_PAYMENT_PS_STATUS') . ':</td>
											<td class="adm-detail-content-cell-r tal">' . htmlspecialcharsbx($data['PS_STATUS']) . '</td>
										</tr>
										<tr>
											<td class="adm-detail-content-cell-l vat" width="40%">' . Loc::getMessage('SALE_ORDER_PAYMENT_PS_STATUS_CODE') . ':</td>
											<td class="adm-detail-content-cell-r tal">' . htmlspecialcharsbx($data['PS_STATUS_CODE']) . '</td>
										</tr>
										<tr>
											<td class="adm-detail-content-cell-l vat" width="40%">' . Loc::getMessage('SALE_ORDER_PAYMENT_PS_STATUS_DESCRIPTION') . ':</td>
											<td class="adm-detail-content-cell-r tal">' . htmlspecialcharsbx($data['PS_STATUS_DESCRIPTION']) . '</td>
										</tr>
										<tr>
											<td class="adm-detail-content-cell-l vat" width="40%">' . Loc::getMessage('SALE_ORDER_PAYMENT_PS_CURRENCY') . ':</td>
											<td class="adm-detail-content-cell-r tal">' . htmlspecialcharsbx($data['PS_CURRENCY']) . '</td>
										</tr>
										<tr>
											<td class="adm-detail-content-cell-l vat" width="40%">' . Loc::getMessage('SALE_ORDER_PAYMENT_PS_SUM') . ':</td>
											<td class="adm-detail-content-cell-r tal">' . htmlspecialcharsbx($data['PS_SUM']) . '</td>
										</tr>
										<tr>
											<td class="adm-detail-content-cell-l vat" width="40%">' . Loc::getMessage('SALE_ORDER_PAYMENT_PS_DATE') . ':</td>
											<td class="adm-detail-content-cell-r tal">' . htmlspecialcharsbx($data['PS_RESPONSE_DATE']) . '</td>
										</tr>
										</tbody>
									</table>
								</div>';
        }
        $result .= '<div class="adm-bus-table-container caption border">
									<div class="adm-bus-table-caption-title" style="background: #eef5f5;">' . Loc::getMessage('SALE_ORDER_PAYMENT_BLOCK_COMPANY') . '</div>
									<table border="0" cellspacing="0" cellpadding="0" width="100%" class="adm-detail-content-table edit-table ">
										<tbody>
											<tr>
												<td class="adm-detail-content-cell-l" width="40%">' . Loc::getMessage('SALE_ORDER_PAYMENT_COMPANY_BY') . ':</td>
												<td class="adm-detail-content-cell-r">' . (isset($company['NAME']) && !empty($company['NAME']) ? htmlspecialcharsbx($company['NAME']) : Loc::getMessage('SALE_ORDER_PAYMENT_NO_COMPANY')) . '</td>
											</tr>
										</tbody>
									</table>
								</div>
							</div>
							<div class="clb"></div>
						</div>
						' . self::getShortViewTemplate($data, $index, $form) . '
					</div>
				</div>
			</div>
		</div>';
        $params = array('index' => $index, 'functionOnSave' => 'sendAjax', 'viewForm' => true, 'isPaid' => $data['PAID'] == 'Y', 'isAvailableChangeStatus' => $isActive);
        $result .= self::initJsPayment($params);
        return $result;
    }
Exemple #19
0
 function RemindPayment()
 {
     $reminder = COption::GetOptionString("sale", "pay_reminder", "");
     $arReminder = unserialize($reminder);
     if (!empty($arReminder)) {
         $arSites = array();
         $minDay = mktime();
         foreach ($arReminder as $key => $val) {
             if ($val["use"] == "Y") {
                 $arSites[] = $key;
                 $days = array();
                 for ($i = 0; $i <= floor($val["period"] / $val["frequency"]); $i++) {
                     $day = AddToTimeStamp(array("DD" => -($val["after"] + $val["period"] - $val["frequency"] * $i)));
                     if ($day < mktime()) {
                         if ($minDay > $day) {
                             $minDay = $day;
                         }
                         $day = ConvertTimeStamp($day);
                         $days[] = $day;
                     }
                 }
                 $arReminder[$key]["days"] = $days;
             }
         }
         if (!empty($arSites)) {
             $bTmpUser = False;
             if (!isset($GLOBALS["USER"]) || !is_object($GLOBALS["USER"])) {
                 $bTmpUser = True;
                 $GLOBALS["USER"] = new CUser();
             }
             $arFilter = array("LID" => $arSites, "PAYED" => "N", "CANCELED" => "N", "ALLOW_DELIVERY" => "N", ">=DATE_INSERT" => ConvertTimeStamp($minDay));
             $dbOrder = CSaleOrder::GetList(array("ID" => "DESC"), $arFilter, false, false, array("ID", "DATE_INSERT", "PAYED", "USER_ID", "LID", "PRICE", "CURRENCY"));
             while ($arOrder = $dbOrder->GetNext()) {
                 $date_insert = ConvertDateTime($arOrder["DATE_INSERT"], CSite::GetDateFormat("SHORT"));
                 if (in_array($date_insert, $arReminder[$arOrder["LID"]]["days"])) {
                     $strOrderList = "";
                     $dbBasketTmp = CSaleBasket::GetList(array("NAME" => "ASC"), array("ORDER_ID" => $arOrder["ID"]), false, false, array("ID", "NAME", "QUANTITY"));
                     while ($arBasketTmp = $dbBasketTmp->Fetch()) {
                         $strOrderList .= $arBasketTmp["NAME"] . " (" . $arBasketTmp["QUANTITY"] . ")";
                         $strOrderList .= "\n";
                     }
                     $payerEMail = "";
                     $dbOrderProp = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $arOrder["ID"], "PROP_IS_EMAIL" => "Y"));
                     if ($arOrderProp = $dbOrderProp->Fetch()) {
                         $payerEMail = $arOrderProp["VALUE"];
                     }
                     $payerName = "";
                     $dbUser = CUser::GetByID($arOrder["USER_ID"]);
                     if ($arUser = $dbUser->Fetch()) {
                         if (strlen($payerName) <= 0) {
                             $payerName = $arUser["NAME"] . (strlen($arUser["NAME"]) <= 0 || strlen($arUser["LAST_NAME"]) <= 0 ? "" : " ") . $arUser["LAST_NAME"];
                         }
                         if (strlen($payerEMail) <= 0) {
                             $payerEMail = $arUser["EMAIL"];
                         }
                     }
                     $arFields = array("ORDER_ID" => $arOrder["ID"], "ORDER_DATE" => $date_insert, "ORDER_USER" => $payerName, "PRICE" => SaleFormatCurrency($arOrder["PRICE"], $arOrder["CURRENCY"]), "BCC" => COption::GetOptionString("sale", "order_email", "order@" . $_SERVER["SERVER_NAME"]), "EMAIL" => $payerEMail, "ORDER_LIST" => $strOrderList, "SALE_EMAIL" => COption::GetOptionString("sale", "order_email", "order@" . $SERVER_NAME));
                     $eventName = "SALE_ORDER_REMIND_PAYMENT";
                     $bSend = true;
                     foreach (GetModuleEvents("sale", "OnOrderRemindSendEmail", true) as $arEvent) {
                         if (ExecuteModuleEventEx($arEvent, array($arOrder["ID"], &$eventName, &$arFields)) === false) {
                             $bSend = false;
                         }
                     }
                     if ($bSend) {
                         $event = new CEvent();
                         $event->Send($eventName, $arOrder["LID"], $arFields, "N");
                     }
                 }
             }
             if ($bTmpUser) {
                 unset($GLOBALS["USER"]);
             }
         }
     }
     return "CSaleOrder::RemindPayment();";
 }
Exemple #20
0
						while ($arTransact = $dbTransact->Fetch())
						{
							$bNoTransact = False;
							?>
							<tr class="adm-list-table-row">
								<td class="adm-list-table-cell"><?php 
echo $arTransact["TRANSACT_DATE"];
?>
</td>
								<td class="adm-list-table-cell">
									<?echo GetFormatedUserName($arTransact["USER_ID"]);?>
								</td>
								<td class="adm-list-table-cell">
									<?
									echo (($arTransact["DEBIT"] == "Y") ? "+" : "-");
									echo SaleFormatCurrency($arTransact["AMOUNT"], $arTransact["CURRENCY"]);
									?>
								</td>
								<td class="adm-list-table-cell">
									<?
									if (array_key_exists($arTransact["DESCRIPTION"], $arTransactTypes))
										echo htmlspecialcharsEx($arTransactTypes[$arTransact["DESCRIPTION"]]);
									else
										echo htmlspecialcharsEx($arTransact["DESCRIPTION"]);
									?>
								</td>
								<td class="adm-list-table-cell" align="right">
									<?echo htmlspecialcharsEx($arTransact["NOTES"]) ?>
								</td>
							</tr>
							<?
Exemple #21
0
            }
            $bNotAvail = true;
        } elseif ($arItem["CAN_BUY"] == "N" && $arItem["SUBSCRIBE"] == "Y") {
            if ('N' == $arParams['SHOW_SUBSCRIBE']) {
                continue;
            }
            $bSubscribe = true;
        }
        if (!$boolOneReady) {
            $arItem["PRICE_FORMATED"] = SaleFormatCurrency($arItem["PRICE"], $arItem["CURRENCY"]);
            $arItems[] = $arItem;
        } else {
            $arReadyItems[] = $arItem;
        }
    }
}
if (!empty($arReadyItems)) {
    $arOrder = array('SITE_ID' => SITE_ID, 'USER_ID' => $USER->GetID(), 'ORDER_PRICE' => $allSum, 'ORDER_WEIGHT' => $allWeight, 'BASKET_ITEMS' => $arReadyItems);
    $arOptions = array();
    $arErrors = array();
    CSaleDiscount::DoProcessOrder($arOrder, $arOptions, $arErrors);
    foreach ($arOrder['BASKET_ITEMS'] as &$arOneItem) {
        $arOneItem["PRICE_FORMATED"] = SaleFormatCurrency($arOneItem["PRICE"], $arOneItem["CURRENCY"]);
    }
    if (isset($arOneItem)) {
        unset($arOneItem);
    }
    $arItems = array_merge($arOrder['BASKET_ITEMS'], $arItems);
}
$arResult = array('READY' => $bReady ? "Y" : "N", 'DELAY' => $bDelay ? "Y" : "N", 'NOTAVAIL' => $bNotAvail ? "Y" : "N", 'SUBSCRIBE' => $bSubscribe ? "Y" : "N", 'ITEMS' => $arItems);
$this->IncludeComponentTemplate();
Exemple #22
0
                        } elseif (isset($arResult['PROPERTY_DESCRIPTION'][$parentIblock][$prop])) {
                            $realProp = $arResult['PROPERTY_DESCRIPTION'][$parentIblock][$prop];
                        }
                        if (!empty($realProp)) {
                            $prod['PROPS'][] = array('NAME' => $realProp['NAME'], 'VALUE' => htmlspecialcharsEx($prod[$key]));
                        }
                    }
                }
            }
            // if we have props, show "properties" column
            if (!empty($prod['PROPS'])) {
                $hasProps = true;
            }
            $productSum += $prod['PRICE'] * $prod['QUANTITY'];
            $basketRefs[$prod['PRODUCT_ID']][] =& $arResult["BASKET"][$k];
            if (!isset($prod['PICTURE'])) {
                $prod['PICTURE'] = $noPict;
            }
        }
        $arResult['HAS_DISCOUNT'] = $hasDiscount;
        $arResult['HAS_PROPS'] = $hasProps;
        $arResult['PRODUCT_SUM_FORMATTED'] = SaleFormatCurrency($productSum, $arResult['CURRENCY']);
        if ($img = intval($arResult["DELIVERY"]["STORE_LIST"][$arResult['STORE_ID']]['IMAGE_ID'])) {
            $pict = CFile::ResizeImageGet($img, array('width' => 150, 'height' => 90), BX_RESIZE_IMAGE_PROPORTIONAL_ALT, true);
            if (strlen($pict['src'])) {
                $pict = array_change_key_case($pict, CASE_UPPER);
            }
            $arResult["DELIVERY"]["STORE_LIST"][$arResult['STORE_ID']]['IMAGE'] = $pict;
        }
    }
}
 $deliveryObj = \Bitrix\Sale\Delivery\Services\Manager::getObjectById($arParams["DELIVERY_ID"]);
 if (!$deliveryObj) {
     ShowError(GetMessage("SALE_DELIVERY_HANDLER_NOT_INSTALL"));
     return;
 }
 $calcResult = $deliveryObj->calculate($shipment);
 $result = array("VALUE" => $calcResult->getPrice(), "TRANSIT" => $calcResult->getPeriodDescription(), "RESULT" => $calcResult->isSuccess() ? "OK" : "ERROR");
 if (!empty($arParams["ORDER_DATA"]) && is_array($arParams["ORDER_DATA"])) {
     $orderDeliveryPriceData = $arParams["ORDER_DATA"];
     $orderDeliveryPriceData['BASKET_ITEMS'] = !empty($arParams['ITEMS']) && is_array($arParams['ITEMS']) ? $arParams['ITEMS'] : array();
     $orderDeliveryPriceData['PRICE_DELIVERY'] = $orderDeliveryPriceData['DELIVERY_PRICE'] = $calcResult->getPrice();
     $orderDeliveryPriceData['DELIVERY_ID'] = $arParams["DELIVERY_ID"];
     CSaleDiscount::DoProcessOrder($orderDeliveryPriceData, array(), $arErrors);
     if (floatval($orderDeliveryPriceData['DELIVERY_PRICE']) >= 0 && $orderDeliveryPriceData['PRICE_DELIVERY'] != $calcResult->getPrice()) {
         $result['DELIVERY_DISCOUNT_PRICE'] = $orderDeliveryPriceData['DELIVERY_PRICE'];
         $result["DELIVERY_DISCOUNT_PRICE_FORMATED"] = SaleFormatCurrency($orderDeliveryPriceData['DELIVERY_PRICE'], $arParams["CURRENCY"]);
     }
 }
 $result["TEXT"] = $calcResult->isSuccess() ? $calcResult->getDescription() : implode("<br>\n", $calcResult->getErrorMessages());
 if ($calcResult->isNextStep()) {
     $result["RESULT"] = "NEXT_STEP";
 }
 if ($calcResult->isSuccess() && strlen($calcResult->getDescription()) > 0) {
     $result["RESULT"] = "NOTE";
 }
 if (intval($calcResult->getPacksCount()) > 0) {
     $result["PACKS_COUNT"] = $calcResult->getPacksCount();
 }
 if ($calcResult->isSuccess() && CModule::IncludeModule('currency')) {
     $result["VALUE_FORMATTED"] = CurrencyFormat($calcResult->getPrice(), $arParams["CURRENCY"]);
 } elseif ($calcResult->isNextStep() && strlen($calcResult->getTmpData()) > 0) {
Exemple #24
0
 static function DoProcessOrderDelivery(&$arOrder, $arOptions, &$arErrors)
 {
     if ((!array_key_exists("TAX_LOCATION", $arOrder) || intval($arOrder["TAX_LOCATION"]) <= 0) && (!$arOrder["USE_VAT"] || $arOrder["USE_VAT"] != "Y")) {
         return;
     }
     if (!array_key_exists("COUNT_DELIVERY_TAX", $arOptions)) {
         $arOptions["COUNT_DELIVERY_TAX"] = COption::GetOptionString("sale", "COUNT_DELIVERY_TAX", "N");
     }
     if (doubleval($arOrder["DELIVERY_PRICE"]) <= 0 || $arOptions["COUNT_DELIVERY_TAX"] != "Y") {
         return;
     }
     if (!$arOrder["USE_VAT"] || $arOrder["USE_VAT"] != "Y") {
         if (!array_key_exists("TAX_EXEMPT", $arOrder)) {
             $arUserGroups = CUser::GetUserGroup($arOrder["USER_ID"]);
             $dbTaxExemptList = CSaleTax::GetExemptList(array("GROUP_ID" => $arUserGroups));
             while ($TaxExemptList = $dbTaxExemptList->Fetch()) {
                 if (!in_array(intval($TaxExemptList["TAX_ID"]), $arOrder["TAX_EXEMPT"])) {
                     $arOrder["TAX_EXEMPT"][] = intval($TaxExemptList["TAX_ID"]);
                 }
             }
         }
         if (!array_key_exists("TAX_LIST", $arOrder)) {
             $arOrder["TAX_LIST"] = array();
             $dbTaxRate = CSaleTaxRate::GetList(array("APPLY_ORDER" => "ASC"), array("LID" => $arOrder["SITE_ID"], "PERSON_TYPE_ID" => $arOrder["PERSON_TYPE_ID"], "ACTIVE" => "Y", "LOCATION" => $arOrder["TAX_LOCATION"]));
             while ($arTaxRate = $dbTaxRate->GetNext()) {
                 if (!in_array(intval($arTaxRate["TAX_ID"]), $arOrder["TAX_EXEMPT"])) {
                     if ($arTaxRate["IS_PERCENT"] != "Y") {
                         $arTaxRate["VALUE"] = RoundEx(CCurrencyRates::ConvertCurrency($arTaxRate["VALUE"], $arTaxRate["CURRENCY"], $arOrder["CURRENCY"]), SALE_VALUE_PRECISION);
                         $arTaxRate["CURRENCY"] = $arOrder["CURRENCY"];
                     }
                     $arOrder["TAX_LIST"][] = $arTaxRate;
                 }
             }
         }
         if (count($arOrder["TAX_LIST"]) > 0) {
             CSaleOrderTax::CountTaxes($arOrder["DELIVERY_PRICE"], $arOrder["TAX_LIST"], $arOrder["CURRENCY"]);
             $arOrder["TAX_PRICE"] = 0;
             foreach ($arOrder["TAX_LIST"] as &$arTax) {
                 $arTax["VALUE_MONEY"] += roundEx($arTax["TAX_VAL"], SALE_VALUE_PRECISION);
                 $arTax['VALUE_MONEY_FORMATED'] = SaleFormatCurrency($arTax["VALUE_MONEY"], $arOrder["CURRENCY"]);
                 if ($arTax["IS_IN_PRICE"] != "Y") {
                     $arOrder["TAX_PRICE"] += $arTax["VALUE_MONEY"];
                 }
             }
             unset($arTax);
         }
     } else {
         $deliveryVat = $arOrder["DELIVERY_PRICE"] * $arOrder["VAT_RATE"] / (1 + $arOrder["VAT_RATE"]);
         $arOrder["VAT_SUM"] += $deliveryVat;
         $arOrder["VAT_DELIVERY"] += $deliveryVat;
         //if (!array_key_exists("TAX_LIST", $arOrder))
         //{
         $arOrder["TAX_LIST"][0] = array("NAME" => GetMessage("SOA_VAT"), "IS_PERCENT" => "Y", "VALUE" => $arOrder["VAT_RATE"] * 100, "VALUE_FORMATED" => "(" . $arOrder["VAT_RATE"] * 100 . "%, " . GetMessage("SOA_VAT_INCLUDED") . ")", "VALUE_MONEY" => $arOrder["VAT_SUM"], "VALUE_MONEY_FORMATED" => SaleFormatCurrency($arOrder["VAT_SUM"], $arOrder["CURRENCY"]), "APPLY_ORDER" => 100, "IS_IN_PRICE" => "Y", "CODE" => "VAT");
         //}
     }
     $arOrder["TAX_PRICE"] = roundEx($arOrder["TAX_PRICE"], SALE_VALUE_PRECISION);
     $arOrder["VAT_SUM"] = roundEx($arOrder["VAT_SUM"], SALE_VALUE_PRECISION);
     $arOrder["VAT_DELIVERY"] = roundEx($arOrder["VAT_DELIVERY"], SALE_VALUE_PRECISION);
 }
Exemple #25
0
}
if (!CBXFeatures::IsFeatureEnabled('SaleAffiliate')) {
    return;
}
if (CModule::IncludeModule("sale")) {
    if (strlen($arParams["SET_TITLE"]) <= 0) {
        $arParams["SET_TITLE"] = "Y";
    }
    if ($arParams["SET_TITLE"] == "Y") {
        $APPLICATION->SetTitle(GetMessage("SPCAT1_TARIF_PLANS"));
    }
    $affiliatePlanType = COption::GetOptionString("sale", "affiliate_plan_type", "N");
    $affiliateCurrency = CSaleLang::GetLangCurrency(SITE_ID);
    $arResult = array();
    $dbPlan = CSaleAffiliatePlan::GetList(array("NAME" => "ASC"), array("SITE_ID" => SITE_ID, "ACTIVE" => "Y"), false, false, array("ID", "NAME", "DESCRIPTION", "BASE_RATE", "BASE_RATE_TYPE", "BASE_RATE_CURRENCY", "MIN_PLAN_VALUE"));
    while ($arPlan = $dbPlan->Fetch()) {
        $arPlan["BASE_RATE_FORMAT"] = $arPlan["BASE_RATE_TYPE"] == "P" ? round($arPlan["BASE_RATE"], SALE_VALUE_PRECISION) . "%" : SaleFormatCurrency($arPlan["BASE_RATE"], $arPlan["BASE_RATE_CURRENCY"]);
        $arPlan["MIN_PLAN_VALUE_FORMAT"] = $affiliatePlanType == "N" ? str_replace("#NUM#", IntVal($arPlan["MIN_PLAN_VALUE"]), GetMessage("SPCAT1_LIMIT1")) : str_replace("#SUM#", SaleFormatCurrency($arPlan["MIN_PLAN_VALUE"], $affiliateCurrency), GetMessage("SPCAT1_LIMIT2"));
        $arPlan["DESCRIPTION"] = htmlspecialcharsex($arPlan["DESCRIPTION"]);
        $arPlan["NAME"] = htmlspecialcharsex($arPlan["NAME"]);
        $arResult[] = $arPlan;
    }
    $this->IncludeComponentTemplate();
} else {
    ?>
	<b><?php 
    echo ShowError(GetMessage("SPCAT1_NO_SHOP"));
    ?>
</b>
	<?php 
}
Exemple #26
0
function fGetFormatedProduct($USER_ID, $LID, $arData, $currency, $type = '')
{
	global $crmMode;
	$result = "";
	$arSet = array();

	if (!is_array($arData["ITEMS"]) || count($arData["ITEMS"]) <= 0)
		return $result;

	$result = "<table width=\"100%\">";
	if (CModule::IncludeModule('catalog') && CModule::IncludeModule('iblock'))
	{
		$arProductId = array();
		$arDataTab = array();

		$arSkuParentChildren = array();
		$arSkuParentId = array();
		$arSkuParent = array();

		foreach ($arData["ITEMS"] as $item)
		{
			if (!empty($item["CURRENCY"]) && $item["CURRENCY"] != $currency)
			{
				if (floatval($item["PRICE"]) > 0)
					$item["PRICE"] = CCurrencyRates::ConvertCurrency($item["PRICE"], $item["CURRENCY"], $currency);

				if (floatval($item["DISCOUNT_PRICE"]) > 0)
					$item["DISCOUNT_PRICE"] = CCurrencyRates::ConvertCurrency($item["DISCOUNT_PRICE"], $item["CURRENCY"], $currency);

				$item["CURRENCY"] = $currency;
			}

			/** @var $productProvider IBXSaleProductProvider */
			if ($productProvider = CSaleBasket::GetProductProvider($item))
			{
				if (method_exists($productProvider, "GetSetItems"))
				{
					$itemInfo = (isset($item['ID']) ? array('BASKET_ID' => $item['ID']) : array());
					$arSets = $productProvider::GetSetItems($item["PRODUCT_ID"], CSaleBasket::TYPE_SET, $itemInfo);
					unset($itemInfo);

					if (is_array($arSets))
					{
						foreach ($arSets as $arSetData)
						{
							foreach ($arSetData["ITEMS"] as $setItem)
							{
								$setItem["FUSER_ID"] = $item["FUSER_ID"];
								$setItem["LID"] = $item["LID"];
								$setItem["MODULE"] = $item["MODULE"];
								$setItem["PRODUCT_PROVIDER_CLASS"] = $productProvider;
								$setItem["SET_PARENT_ID"] = $item["ID"];

								$arSet[$item["PRODUCT_ID"]][] = $setItem;
							}
						}
					}
				}
			}

			if ($item["MODULE"] == "catalog")
			{
				$arProductId[$item["PRODUCT_ID"]] = $item["PRODUCT_ID"];
				$arDataTab[$item["PRODUCT_ID"]] = $item;

				$arParent = CCatalogSku::GetProductInfo($item["PRODUCT_ID"]);
				if ($arParent)
				{
					$arSkuParentChildren[$item["PRODUCT_ID"]] = $arParent["ID"];
					$arSkuParentId[$arParent["ID"]] = $arParent["ID"];
				}
			}
		}

		if(!empty($arSkuParentId))
		{
			$res = CIBlockElement::GetList(array(), array("ID" => $arSkuParentId), false, false, array("ID", "IBLOCK_ID", "IBLOCK_SECTION_ID", "PREVIEW_PICTURE", "DETAIL_PICTURE", "NAME", "DETAIL_PAGE_URL"));
			while ($arItems = $res->GetNext())
				$arSkuParent[$arItems["ID"]] = $arItems;
		}

		if(!empty($arProductId))
		{
			$dbProduct = CIBlockElement::GetList(array(), array("ID" => $arProductId), false, false, array('ID', 'IBLOCK_ID', 'IBLOCK_SECTION_ID', 'DETAIL_PICTURE', 'PREVIEW_PICTURE', 'IBLOCK_TYPE_ID'));
			while($arProduct = $dbProduct->Fetch())
			{
				$imgCode = 0;
				$arImgProduct = false;
				$arFile = false;
				$imgUrl = '';
				$imgProduct = '';
				$arDataTab[$arProduct['ID']]['IBLOCK_ID'] = $arProduct['IBLOCK_ID'];
				$arDataTab[$arProduct['ID']]['IBLOCK_SECTION_ID'] = $arProduct['IBLOCK_SECTION_ID'];
				$arDataTab[$arProduct['ID']]['DETAIL_PICTURE'] = $arProduct['DETAIL_PICTURE'];
				$arDataTab[$arProduct['ID']]['PREVIEW_PICTURE'] = $arProduct['PREVIEW_PICTURE'];
				$arDataTab[$arProduct['ID']]['IBLOCK_TYPE_ID'] = $arProduct['IBLOCK_TYPE_ID'];
				$item = $arDataTab[$arProduct['ID']];

				if ($item["PREVIEW_PICTURE"] == "" && $item["DETAIL_PICTURE"] == "" && is_set($arSkuParentChildren[$item["PRODUCT_ID"]]))
				{
					$idTmp = $arSkuParentChildren[$item["PRODUCT_ID"]];
					$item["DETAIL_PICTURE"] = $arSkuParent[$idTmp]["DETAIL_PICTURE"];
					$item["PREVIEW_PICTURE"] = $arSkuParent[$idTmp]["PREVIEW_PICTURE"];
				}

				if ($item["DETAIL_PICTURE"] > 0)
					$imgCode = $item["DETAIL_PICTURE"];
				elseif ($item["PREVIEW_PICTURE"] > 0)
					$imgCode = $item["PREVIEW_PICTURE"];

				$arSkuProperty = CSaleProduct::GetProductSkuProps($item["PRODUCT_ID"], $item["IBLOCK_ID"]);

				$item["NAME"] = htmlspecialcharsex($item["NAME"]);
				$item["EDIT_PAGE_URL"] = htmlspecialcharsex($item["EDIT_PAGE_URL"]);
				$item["CURRENCY"] = htmlspecialcharsex($item["CURRENCY"]);

				if ($imgCode > 0)
				{
					$arFile = CFile::GetFileArray($imgCode);
					$arImgProduct = CFile::ResizeImageGet($arFile, array('width'=>80, 'height'=>80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false);
				}

				if (is_array($arImgProduct))
				{
					$imgUrl = $arImgProduct["src"];
					$imgProduct = "<a href=\"".$item["EDIT_PAGE_URL"]."\" target=\"_blank\"><img src=\"".$imgUrl."\" alt=\"\" title=\"".$item["NAME"]."\" ></a>";
				}
				else
					$imgProduct = "<div class='no_foto'>".GetMessage('NO_FOTO')."</div>";

				$arCurFormat = CCurrencyLang::GetCurrencyFormat($item["CURRENCY"]);
				$priceValutaFormat = str_replace("#", '', $arCurFormat["FORMAT_STRING"]);

				$currentTotalPrice = ($item["PRICE"] + $item["DISCOUNT_PRICE"]);

				$discountPercent = 0;
				if ($item["DISCOUNT_PRICE"] > 0)
					$discountPercent = intval(($item["DISCOUNT_PRICE"] * 100) / $currentTotalPrice);

				$arProduct = CCatalogProduct::GetByID($item["PRODUCT_ID"]);
				$balance = floatval($arProduct["QUANTITY"]);

				$result .= "<tr id='more_".$type."_".$item["ID"]."'>
								<td class=\"tab_img\" >".$imgProduct."</td>
								<td class=\"tab_text\">
									<div class=\"order_name\"><a href=\"".$item["EDIT_PAGE_URL"]."\" target=\"_blank\" title=\"".$item["NAME"]."\">".$item["NAME"]."</a></div>
									<div class=\"order_price\">
										".GetMessage('NEWO_SUBTAB_PRICE').": <b>".SaleFormatCurrency($item["PRICE"], $currency)."</b>";

				if (!empty($arSet) && array_key_exists($arProduct["ID"], $arSet)) // show/hide set item link
				{
					$result .= '<br/>
						<div>
							<a id="set_toggle_link_b'.$arProduct["ID"].'"
								href="javascript:void(0);"
								class="dashed-link show-set-link"
								title="'.GetMessage("SOE_SHOW_SET").'"
								onclick="fToggleSetItems(\'b'.$arProduct["ID"].'\');">'.GetMessage("SOE_SHOW_SET").'</a>
						</div>';
				}

				$result .= "</div>";

				$arResult = CSaleProduct::GetProductSku($USER_ID, $LID, $item["PRODUCT_ID"], $item["NAME"], $currency, $arProduct);

				if (count($arResult["SKU_ELEMENTS"]) > 0)
				{
					foreach ($arResult["SKU_ELEMENTS"] as $key => $val)
					{
						$arTmp = array();
						foreach ($val as $k => $v)
						{
							if (is_numeric($k))
							{
								$arTmp[$arResult["SKU_PROPERTIES"][$k]["NAME"]] = $v;
							}
						}
						$arResult["SKU_ELEMENTS"][$key]["SKU_PROPS"] = CUtil::PhpToJSObject($arTmp);
					}
				}

				$arResult["POPUP_MESSAGE"] = array(
					"PRODUCT_ADD" => GetMessage('NEWO_POPUP_TO_BASKET'),
					"PRODUCT_ORDER" => GetMessage('NEWO_POPUP_TO_ORDER'),
					"PRODUCT_NOT_ADD" => GetMessage('NEWO_POPUP_DONT_CAN_BUY'),
					"PRODUCT_PRICE_FROM" => GetMessage('NEWO_POPUP_FROM')
				);

				if (count($arResult["SKU_ELEMENTS"]) <= 0)
					$result .= "<a href=\"javascript:void(0);\" class=\"get_new_order\" onClick=\"fAddToBasketMoreProduct('".$type."', ".$item["PRODUCT_ID"].");return false;\"><span></span>".GetMessage('NEWO_SUBTAB_ADD_BASKET')."</a><br>";
				else
					$result .= "<a href=\"javascript:void(0);\" class=\"get_new_order\" onClick=\"fAddToBasketMoreProductSku(".CUtil::PhpToJsObject($arResult['SKU_ELEMENTS']).", ".CUtil::PhpToJsObject($arResult['SKU_PROPERTIES']).", 'basket', ".CUtil::PhpToJsObject($arResult["POPUP_MESSAGE"]).");\"><span></span>".GetMessage('NEWO_SUBTAB_ADD_BASKET')."</a><br>";

				if (!$crmMode)
				{
					if (count($arResult["SKU_ELEMENTS"]) > 0)
					{
						$result .= "<a href=\"javascript:void(0);\" class=\"get_new_order\" onClick=\"fAddToBasketMoreProductSku(".CUtil::PhpToJsObject($arResult['SKU_ELEMENTS']).", ".CUtil::PhpToJsObject($arResult['SKU_PROPERTIES']).", 'neworder', ".CUtil::PhpToJsObject($arResult["POPUP_MESSAGE"]).");\"><span></span>".GetMessage('NEWO_SUBTAB_ADD_ORDER')."</a>";
					}
					else
					{
						$cntProd = (floatval($item["QUANTITY"]) > 0) ? floatval($item["QUANTITY"]) : 1;
						$url = "/bitrix/admin/sale_order_new.php?lang=".LANGUAGE_ID."&user_id=".$USER_ID."&LID=".$LID."&product[".$item["PRODUCT_ID"]."]=".$cntProd;
						$result .= "<a href=\"".$url."\" target=\"_blank\" class=\"get_new_order\"><span></span>".GetMessage('NEWO_SUBTAB_ADD_ORDER')."</a>";
					}
				}

				$result .= "</td></tr>";

				// show set items
				if (!empty($arSet) && array_key_exists($arProduct["ID"], $arSet))
				{
					foreach ($arSet[$arProduct["ID"]] as $set)
					{
						$editUrl = CIBlock::GetAdminElementEditLink($set["IBLOCK_ID"], $set["ITEM_ID"], array(
							"find_section_section" => $set["IBLOCK_SECTION_ID"],
							'WF' => 'Y',
						));

						if ($set["PREVIEW_PICTURE"] > 0)
							$imgCode = $set["PREVIEW_PICTURE"];
						elseif ($set["DETAIL_PICTURE"] > 0)
							$imgCode = $set["DETAIL_PICTURE"];

						if ($imgCode > 0)
						{
							$arFile = CFile::GetFileArray($imgCode);
							$arImgProduct = CFile::ResizeImageGet($arFile, array('width'=>80, 'height'=>80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false);
							if (is_array($arImgProduct))
							{
								$imgUrl = $arImgProduct["src"];
								$img = '<a href="'.$editUrl.'" target="_blank"><img src="'.$arImgProduct["src"].'" alt="" title="'.$set["NAME"].'" ></a>';
							}
						}
						else
							$img = '<div class="no_foto">'.GetMessage('SOD_NO_FOTO')."</div>";

						$result .= '
							<tr style="display:none" class="set_item_b'.$arProduct["ID"].'">
								<td class="tab_img">'.$img.'</td>
								<td class="tab_text">
									<div class="order_name">
										<a href="'.$editUrl.'" style="font-style:italic" target="_blank" title="'.$set["NAME"].'">'.$set["NAME"].'</a>
									</div>
									<div class="order_price">'.GetMessage('NEWO_SUBTAB_PRICE').': <b>'.SaleFormatCurrency($set["PRICE"], $currency).'</b></div>
								</td>
							</tr>';
					}
				}

			}//end foreach
		}
	}//end if

	if ($arData["CNT"] > 2 && $arData["CNT"] != count($arData["ITEMS"]))
	{
		$result .= "<tr><td colspan='2' align='right' class=\"more_product\">";
		if ($type == "basket")
			$result .= "<a href='javascript:void(0);' onClick='fGetMoreBasket(\"Y\");' class=\"get_more\">".GetMessage('NEWO_SUBTAB_MORE')."<span></span></a>";
		elseif ($type == "viewed")
			$result .= "<a href='javascript:void(0);' onClick='fGetMoreViewed(\"Y\");' class=\"get_more\">".GetMessage('NEWO_SUBTAB_MORE')."<span></span></a>";
		else
			$result .= "<a href='javascript:void(0);' onClick='fGetMoreRecom();' class=\"get_more\">".GetMessage('NEWO_SUBTAB_MORE')."<span></span></a>";
		$result .= "</td></tr>";
	}

	$result .= "</table>";

	return $result;
}
     $arSection["ROWS"][] = array("TITLE" => GetMessage("SMOH_STATUS_ID") . ":", "VALUE" => $arResult["STATUSES"][$arItemHistory['STATUS_ID']]);
     continue 2;
 case "PRICE":
     $arSection["ROWS"][] = array("TITLE" => GetMessage("SMOH_PRICE") . ":", "VALUE" => SaleFormatCurrency($arItemHistory["PRICE"], $arItemHistory["H_CURRENCY"]));
     continue 2;
 case "PRICE_DELIVERY":
     $arSection["ROWS"][] = array("TITLE" => GetMessage("SMOH_PRICE_DELIVERY") . ":", "VALUE" => SaleFormatCurrency($arItemHistory["PRICE_DELIVERY"], $arItemHistory["H_CURRENCY"]));
     continue 2;
 case "DISCOUNT_VALUE":
     $arSection["ROWS"][] = array("TITLE" => GetMessage("SMOH_DISCOUNT_VALUE") . ":", "VALUE" => SaleFormatCurrency($arItemHistory["DISCOUNT_VALUE"], $arItemHistory["H_CURRENCY"]));
     continue 2;
 case "TAX_VALUE":
     $arSection["ROWS"][] = array("TITLE" => GetMessage("SMOH_TAX_VALUE") . ":", "VALUE" => SaleFormatCurrency($arItemHistory["TAX_VALUE"], $arItemHistory["H_CURRENCY"]));
     continue 2;
 case "SUM_PAID":
     $arSection["ROWS"][] = array("TITLE" => GetMessage("SMOH_SUM_PAID") . ":", "VALUE" => SaleFormatCurrency($arItemHistory["SUM_PAID"], $arItemHistory["H_CURRENCY"]));
     continue 2;
 case "EMP_PAYED_ID":
     $arSection["ROWS"][] = array("TITLE" => GetMessage("SMOH_FN_EMP_PAYED_ID") . ":", "VALUE" => CSaleMobileOrderUtils::GetFormatedUserName($arItemHistory["EMP_PAYED_ID"]));
     continue 2;
 case "DELIVERY":
     $arSection["ROWS"][] = array("TITLE" => GetMessage("SMOH_DELIVERY_ID") . ":", "VALUE" => $arItemHistory['DELIVERY']);
     continue 2;
 case "PAY_SYSTEM_ID":
     $arSection["ROWS"][] = array("TITLE" => GetMessage("SMOH_PAY_SYSTEM_ID") . ":", "VALUE" => $arResult["PAY_SYSTEMS"][$arItemHistory['PAY_SYSTEM_ID']]);
     continue 2;
 case "MARKED":
     $arSection["ROWS"][] = array("TITLE" => GetMessage("SMOH_FN_MARKED") . ":", "VALUE" => $arItemHistory['MARKED'] == 'Y' ? GetMessage("SMOH_YES") : GetMessage("SMOH_NO"));
     continue 2;
 case "DEDUCTED":
     $arSection["ROWS"][] = array("TITLE" => GetMessage("SMOH_FN_DEDUCTED") . ":", "VALUE" => $arItemHistory['DEDUCTED'] == 'Y' ? GetMessage("SMOH_YES") : GetMessage("SMOH_NO"));
Exemple #28
0
                    $allVatRate = $arOneItem["VAT_RATE"];
                }
                $arOneItem["VAT_VALUE"] = $arOneItem["PRICE"] / ($arOneItem["VAT_RATE"] + 1) * $arOneItem["VAT_RATE"];
                $allVatSumm += roundEx($arOneItem["VAT_VALUE"] * $arOneItem["QUANTITY"], SALE_VALUE_PRECISION);
            }
        }
        if (isset($arOneItem)) {
            unset($arOneItem);
        }
        $arResult["ORDER_PRICE"] = $allSum;
        $arResult["ORDER_PRICE_FORMATED"] = SaleFormatCurrency($arResult["ORDER_PRICE"], $arResult["BASE_LANG_CURRENCY"]);
        $arResult["VAT_RATE"] = $allVatRate;
        $arResult["VAT_SUM"] = $allVatSumm;
        $arResult["VAT_SUM_FORMATED"] = SaleFormatCurrency($arResult["VAT_SUM"], $arResult["BASE_LANG_CURRENCY"]);
        $arResult['DELIVERY_PRICE'] = $arOrderForDiscount['PRICE_DELIVERY'];
        $arResult['DELIVERY_PRICE_FORMATED'] = SaleFormatCurrency($arResult["DELIVERY_PRICE"], $arResult["BASE_LANG_CURRENCY"]);
        $arResult["ITEMS"]["AnDelCanBuy"] = $arOrderForDiscount['BASKET_ITEMS'];
    }
    //end if array basket
    if (empty($arBasketItems)) {
        $arResult["ERROR_MESSAGE"] = GetMessage("SALE_EMPTY_BASKET");
    }
    if (!isset($_POST["BasketOrder"])) {
        $errorMessage = "";
    }
    $errorMessage .= $productLimit;
    $arResult["ERROR_MESSAGE"] = $errorMessage;
} else {
    $arResult["ORDER_BASKET"]["CONFIRM_ORDER"] = "Y";
    $arResult["ORDER_BASKET"]["ORDER_ID"] = intval($ORDER_ID);
    $arResult["ORDER_ID"] = intval($ORDER_ID);
                            $currentQuantity = 0;
                            $currentSum = 0;
                        }
                        $currentQuantity += $arItemsList["BASKET_QUANTITY"];
                        if ($affiliateCurrency != $arItemsList["BASKET_CURRENCY"]) {
                            //$currentSum += CCurrencyRates::ConvertCurrency(($arItemsList["BASKET_PRICE"] - $arItemsList["BASKET_DISCOUNT_PRICE"]) * $arItemsList["BASKET_QUANTITY"], $arItemsList["BASKET_CURRENCY"], $affiliateCurrency);
                            $currentSum += CCurrencyRates::ConvertCurrency($arItemsList["BASKET_PRICE"] * $arItemsList["BASKET_QUANTITY"], $arItemsList["BASKET_CURRENCY"], $affiliateCurrency);
                        } else {
                            //$currentSum += ($arItemsList["BASKET_PRICE"] - $arItemsList["BASKET_DISCOUNT_PRICE"]) * $arItemsList["BASKET_QUANTITY"];
                            $currentSum += $arItemsList["BASKET_PRICE"] * $arItemsList["BASKET_QUANTITY"];
                        }
                    } while ($arItemsList = $dbItemsList->Fetch());
                    $arResult["ROWS"][] = array("NAME" => $currentBasketName, "QUANTITY" => $currentQuantity, "SUM" => $currentSum, "CURRENCY" => $affiliateCurrency, "SUM_FORMAT" => SaleFormatCurrency($currentSum, $affiliateCurrency));
                    $totalQuantity += $currentQuantity;
                    $totalSum += $currentSum;
                    $arResult["TOTAL"] = array("QUANTITY" => $totalQuantity, "SUM" => $totalSum, "CURRENCY" => $affiliateCurrency, "SUM_FORMAT" => SaleFormatCurrency($totalSum, $affiliateCurrency));
                }
                $arResult["FILTER_ID"] = rand(0, 10000);
            } else {
                $arResult = false;
            }
            $this->IncludeComponentTemplate();
        } else {
            LocalRedirect($arParams["REGISTER_PAGE"] . "?REDIRECT_PAGE=" . UrlEncode($APPLICATION->GetCurPage()));
            die;
        }
    } else {
        LocalRedirect($arParams["REGISTER_PAGE"] . "?REDIRECT_PAGE=" . UrlEncode($APPLICATION->GetCurPage()));
        die;
    }
} else {
Exemple #30
0
<?php

if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule('sale')) {
    ShowError(GetMessage("SMOT_SALE_NOT_INSTALLED"));
    return;
}
if (!CModule::IncludeModule('mobileapp')) {
    ShowError("SMOT_MOBILEAPP_NOT_INSTALLED");
    return;
}
if (isset($_REQUEST['id'])) {
    $orderId = $_REQUEST['id'];
} else {
    return;
}
$bUserCanViewOrder = CSaleOrder::CanUserViewOrder($orderId, $GLOBALS["USER"]->GetUserGroupArray(), $GLOBALS["USER"]->GetID());
if (!$bUserCanViewOrder) {
    echo ShowError(GetMessage("SMOT_NO_PERMS2VIEW"));
    return;
}
$arResult["ORDER"] = CSaleMobileOrderUtils::getOrderInfoDetail($orderId);
$arResult["TYPES"] = array("ORDER_PAY" => GetMessage("SMOT_TR_TYPE_PAYMENT"), "CC_CHARGE_OFF" => GetMessage("SMOT_TR_TYPE_FROM_CARD"), "OUT_CHARGE_OFF" => GetMessage("SMOT_TR_TYPE_INPUT"), "ORDER_UNPAY" => GetMessage("SMOT_TR_TYPE_CANCEL_PAYMENT"), "ORDER_CANCEL_PART" => GetMessage("SMOT_TR_TYPE_CANCEL_SEMIPAYMENT"), "MANUAL" => GetMessage("SMOT_TR_TYPE_HAND"), "DEL_ACCOUNT" => GetMessage("SMOT_TR_TYPE_DELETE"), "AFFILIATE" => GetMessage("SMOT_MOBILEAPP_NOT_INSTALLED"));
$dbTransact = CSaleUserTransact::GetList(array("TRANSACT_DATE" => "DESC"), array("ORDER_ID" => $orderId), false, false, array("ID", "USER_ID", "AMOUNT", "CURRENCY", "DEBIT", "ORDER_ID", "DESCRIPTION", "NOTES", "TIMESTAMP_X", "TRANSACT_DATE"));
while ($arTransact = $dbTransact->Fetch()) {
    $arTransact["AMOUNT_PREPARED"] = ($arTransact["DEBIT"] == "Y" ? "+" : "-") . SaleFormatCurrency($arTransact["AMOUNT"], $arTransact["CURRENCY"]);
    $arResult["TRANSACTS"][] = $arTransact;
}
$this->IncludeComponentTemplate();