PageRenderTime 53ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/sale/ru/reports/order_form.php

https://gitlab.com/alexprowars/bitrix
PHP | 273 lines | 247 code | 20 blank | 6 comment | 34 complexity | 65ea1a7ec3d0529628959b841b3f231e MD5 | raw file
  1. <?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  3. <html xmlns:v="urn:schemas-microsoft-com:vml"
  4. xmlns:o="urn:schemas-microsoft-com:office:office"
  5. xmlns:w="urn:schemas-microsoft-com:office:word"
  6. xmlns="http://www.w3.org/TR/REC-html40">
  7. <head>
  8. <meta http-equiv=Content-Type content="text/html; charset=<?=LANG_CHARSET?>">
  9. <title langs="ru">Бланк заказа</title>
  10. <style>
  11. <!--
  12. .header{font-size:17px; font-family:Tahoma;padding-left:8px;}
  13. .sub_header{font-size:13px; font-family:Tahoma;padding-left:8px;}
  14. .date{font-style:italic; font-family:Tahoma;padding-left:8px;}
  15. .number{font-size:24px;font-family:Tahoma;font-style:italic;padding-left:8px;}
  16. .user{font-size:12px;font-family:Tahoma;font-weight:bold;padding-left:8px;}
  17. .summa{font-size:12px;font-family:Tahoma;font-weight:bold;padding-left:15px;}
  18. table.blank {
  19. border-collapse: collapse;
  20. width: 585px;
  21. }
  22. table.blank td {
  23. border:0.5pt solid windowtext;
  24. }
  25. -->
  26. </style>
  27. </head>
  28. <body bgcolor=white lang=RU style='tab-interval:35.4pt'>
  29. <?
  30. $page = intval($page);
  31. if ($page<=0) $page = 1;
  32. ?>
  33. <table height="920" align="center" border="0" cellpadding="0" cellspacing="0">
  34. <tr valign="top">
  35. <td colspan="3">
  36. <!-- Верхний колонтитул height="109" -->
  37. </td>
  38. </tr>
  39. <tr valign="top">
  40. <td colspan="3">
  41. <table cellpadding="0" cellspacing="0" border="0" width="595" align="center">
  42. <tr><td><br><br></td></tr>
  43. <tr>
  44. <td width="180"><font class="header">ТОВАРНЫЙ ЧЕК </font></td>
  45. <td style="border-bottom : 1px solid Black;" nowrap>
  46. <font class="number"><?echo $arOrder["ACCOUNT_NUMBER"];?></font>
  47. <!--- <input size="30" style="border:1px;font-size:24px;font-style:italic;" type="text" value="<?echo $page;?>">-->
  48. </td>
  49. <td>
  50. </td>
  51. </tr>
  52. <tr>
  53. <td width="180"><font class="sub_header">ДАТА:</font></td>
  54. <td style="border-bottom : 1px solid Black;">
  55. <input class="date" size="30" style="border:0px solid #000000;" type="text" value="<?echo $arOrder["DATE_INSERT_FORMAT"];?>">
  56. </td>
  57. <td>
  58. </td>
  59. </tr>
  60. <tr>
  61. <td width="180"><font class="sub_header">КОМУ:</font></td>
  62. <td style="border-bottom : 1px solid Black;">
  63. <?if(empty($arParams))
  64. {
  65. $userName = $arOrderProps["F_NAME"];
  66. }
  67. else
  68. {
  69. if($arParams["BUYER_COMPANY_NAME"] <> '')
  70. $userName = $arParams["BUYER_COMPANY_NAME"];
  71. else
  72. $userName = $arParams["BUYER_LAST_NAME"]." ".$arParams["BUYER_FIRST_NAME"]." ".$arParams["BUYER_SECOND_NAME"];
  73. }?>
  74. <input class="user" size="50" style="border:0px solid #000000;" type="text" value="<?=$userName?> ">
  75. </td>
  76. <td>
  77. </td>
  78. </tr>
  79. <tr><td><br></td></tr>
  80. </table>
  81. <br>
  82. <?
  83. if (count($arBasketIDs)>0)
  84. {
  85. $arCurFormat = CCurrencyLang::GetCurrencyFormat($arOrder["CURRENCY"]);
  86. $currency = preg_replace('/(^|[^&])#/', '${1}', $arCurFormat['FORMAT_STRING']);
  87. ?>
  88. <table class="blank">
  89. <tr>
  90. <td align="center"></td>
  91. <td align="center">Наименование</td>
  92. <td align="center">Количество</td>
  93. <td align="center">Цена,<?=$currency;?></td>
  94. <td align="center">Cумма,<?=$currency;?></td>
  95. </tr>
  96. <?
  97. $priceTotal = 0;
  98. $bUseVat = false;
  99. $arBasketOrder = array();
  100. for ($i = 0, $countBasketIds = count($arBasketIDs); $i < $countBasketIds; $i++)
  101. {
  102. $arBasketTmp = CSaleBasket::GetByID($arBasketIDs[$i]);
  103. if (floatval($arBasketTmp["VAT_RATE"]) > 0 )
  104. $bUseVat = true;
  105. $priceTotal += $arBasketTmp["PRICE"]*$arBasketTmp["QUANTITY"];
  106. $arBasketTmp["PROPS"] = array();
  107. if (isset($_GET["PROPS_ENABLE"]) && $_GET["PROPS_ENABLE"] == "Y")
  108. {
  109. $dbBasketProps = CSaleBasket::GetPropsList(
  110. array("SORT" => "ASC", "NAME" => "ASC"),
  111. array("BASKET_ID" => $arBasketTmp["ID"]),
  112. false,
  113. false,
  114. array("ID", "BASKET_ID", "NAME", "VALUE", "CODE", "SORT")
  115. );
  116. while ($arBasketProps = $dbBasketProps->GetNext())
  117. $arBasketTmp["PROPS"][$arBasketProps["ID"]] = $arBasketProps;
  118. }
  119. $arBasketOrder[] = $arBasketTmp;
  120. }
  121. //разбрасываем скидку на заказ по товарам
  122. if (floatval($arOrder["DISCOUNT_VALUE"]) > 0)
  123. {
  124. $arBasketOrder = GetUniformDestribution($arBasketOrder, $arOrder["DISCOUNT_VALUE"], $priceTotal);
  125. }
  126. //налоги
  127. $arTaxList = array();
  128. $db_tax_list = CSaleOrderTax::GetList(array("APPLY_ORDER"=>"ASC"), Array("ORDER_ID"=>$ORDER_ID));
  129. $iNds = -1;
  130. $i = 0;
  131. while ($ar_tax_list = $db_tax_list->Fetch())
  132. {
  133. $arTaxList[$i] = $ar_tax_list;
  134. // определяем, какой из налогов - НДС
  135. // НДС должен иметь код NDS, либо необходимо перенести этот шаблон
  136. // в каталог пользовательских шаблонов и исправить
  137. if ($arTaxList[$i]["CODE"] == "NDS")
  138. $iNds = $i;
  139. $i++;
  140. }
  141. $i = 0;
  142. $total_sum = 0;
  143. foreach ($arBasketOrder as $arBasket):
  144. $nds_val = 0;
  145. $taxRate = 0;
  146. if (floatval($arQuantities[$i]) <= 0)
  147. $arQuantities[$i] = DoubleVal($arBasket["QUANTITY"]);
  148. $b_AMOUNT = DoubleVal($arBasket["PRICE"]);
  149. //определяем начальную цену
  150. $item_price = $b_AMOUNT;
  151. if(DoubleVal($arBasket["VAT_RATE"]) > 0)
  152. {
  153. $nds_val = ($b_AMOUNT - DoubleVal($b_AMOUNT/(1+$arBasket["VAT_RATE"])));
  154. $item_price = $b_AMOUNT - $nds_val;
  155. $taxRate = $arBasket["VAT_RATE"]*100;
  156. }
  157. elseif(!$bUseVat)
  158. {
  159. $basket_tax = CSaleOrderTax::CountTaxes($b_AMOUNT*$arQuantities[$i], $arTaxList, $arOrder["CURRENCY"]);
  160. for ($mi = 0, $countTaxList = count($arTaxList); $mi < $countTaxList; $mi++)
  161. {
  162. if ($arTaxList[$mi]["IS_IN_PRICE"] == "Y")
  163. {
  164. $item_price -= $arTaxList[$mi]["TAX_VAL"];
  165. }
  166. $nds_val += DoubleVal($arTaxList[$mi]["TAX_VAL"]);
  167. $taxRate += ($arTaxList[$mi]["VALUE"]);
  168. }
  169. }
  170. ?>
  171. <tr>
  172. <td><?echo $i+1;?></td>
  173. <td>
  174. <?echo htmlspecialcharsbx($arBasket["NAME"]);?>
  175. <?
  176. if (is_array($arBasket["PROPS"]) && $_GET["PROPS_ENABLE"] == "Y")
  177. {
  178. foreach($arBasket["PROPS"] as $vv)
  179. {
  180. if($vv["VALUE"] <> '' && $vv["CODE"] != "CATALOG.XML_ID" && $vv["CODE"] != "PRODUCT.XML_ID")
  181. echo "<div style=\"font-size:8pt\">".$vv["NAME"].": ".$vv["VALUE"]."</div>";
  182. }
  183. }
  184. ?>
  185. </td>
  186. <td align="center"><?echo Bitrix\Sale\BasketItem::formatQuantity($arQuantities[$i]) ?></td>
  187. <td align="right" nowrap><?=CCurrencyLang::CurrencyFormat($arBasket["PRICE"], $arOrder["CURRENCY"], false);?></td>
  188. <td align="right" nowrap><?=CCurrencyLang::CurrencyFormat($arBasket["PRICE"]*$arQuantities[$i], $arOrder["CURRENCY"], false);?></td>
  189. </tr>
  190. <?
  191. if (empty($arBasket['SET_PARENT_ID']))
  192. {
  193. $total_sum += $arBasket["PRICE"]*$arQuantities[$i];
  194. $total_nds += $nds_val*$arQuantities[$i];
  195. }
  196. $i++;
  197. endforeach;
  198. ?>
  199. <tr>
  200. <td align="right" colspan="4">
  201. Сумма:
  202. </td>
  203. <td align="right" nowrap>
  204. <?=CCurrencyLang::CurrencyFormat($total_sum, $arOrder["CURRENCY"], false);?>
  205. </td>
  206. </tr>
  207. <?
  208. if ($bUseVat || $arOrder['DELIVERY_VAT_RATE'] <= 0)
  209. {
  210. $db_tax_list = CSaleOrderTax::GetList(array("APPLY_ORDER"=>"ASC"), Array("ORDER_ID"=>$ORDER_ID));
  211. while ($ar_tax_list = $db_tax_list->Fetch())
  212. {
  213. ?>
  214. <tr>
  215. <td align="right" colspan="4">
  216. <?
  217. if ($ar_tax_list["IS_IN_PRICE"]=="Y")
  218. {
  219. echo "В том числе ";
  220. }
  221. echo htmlspecialcharsbx($ar_tax_list["TAX_NAME"]);
  222. if ($ar_tax_list["IS_PERCENT"]=="Y")
  223. {
  224. echo " (".(int)$ar_tax_list["VALUE"]."%)";
  225. }
  226. ?>:
  227. </td>
  228. <td align="right" nowrap>
  229. <?=CCurrencyLang::CurrencyFormat($total_nds, $arOrder["CURRENCY"], false);?>
  230. </td>
  231. </tr>
  232. <?
  233. }
  234. }
  235. ?>
  236. <tr>
  237. <td align="right" colspan="4">
  238. Итого (без стоимости доставки):
  239. </td>
  240. <td align="right" nowrap>
  241. <?=CCurrencyLang::CurrencyFormat($total_sum, $arOrder["CURRENCY"], false);?>
  242. </td>
  243. </tr>
  244. </table>
  245. <?
  246. }
  247. ?>
  248. <br>
  249. </td>
  250. </tr>
  251. </table>
  252. </body>
  253. </html>