echo MG::numberFormat($totalsumm) . ' ' . $data['currency']; ?> </strong></td> </tr> </table> <p>Всего наименований <?php echo $i - 1; ?> шт., на сумму <?php echo MG::numberFormat($totalsumm) . ' ' . $data['currency']; ?> </p> <?php include 'int2str.php'; $sumToWord = new int2str($totalsumm, true); $sumToWord->ucfirst($sumToWord->rub); ?> <p><strong style="font-size: 18px;"><?php echo $sumToWord->ucfirst($sumToWord->rub); ?> </strong></p> <div class="clear"> </div> </div> <?php $imgSing = ''; $documentRoot = URL::getDocumentRoot(); if (file_exists($documentRoot . str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $data['propertyOrder']['sing']))) { $imgSing = '<img src="' . SITE . '/' . $data['propertyOrder']['sing'] . '">';
/** * Выводит на экран печатную форму для печати заказа в админке. * @param int $id - id заказа. * @param boolean $sign использовать ли подпись. * @return array */ public function printOrder($id, $sign = true) { $orderInfo = $this->getOrder('id=' . DB::quote($id, true)); $order = $orderInfo[$id]; $perOrders = unserialize(stripslashes($order['order_content'])); $currency = MG::getSetting('currency'); $totSumm = $order['summ'] + $order['cost']; $paymentArray = $this->getPaymentMethod($order['payment_id']); $order['name'] = $paymentArray['name']; $propertyOrder = MG::getOption('propertyOrder'); $propertyOrder = stripslashes($propertyOrder); $propertyOrder = unserialize($propertyOrder); $paramArray = $this->getParamArray(7, $order['id'], $order['summ']); foreach ($paramArray as $k => $field) { $paramArray[$k]['value'] = htmlentities($paramArray[$k]['value'], ENT_QUOTES, "UTF-8"); } $customer = unserialize(stripslashes($order['yur_info'])); $customerInfo = $customer['inn'] . ', ' . $customer['kpp'] . ', ' . $customer['nameyur'] . ', ' . $customer['adress'] . ', ' . $customer['bank'] . ', ' . $customer['bik'] . ', ' . $customer['ks'] . ', ' . $customer['rs'] . ', ' . $customer['nameyur']; $ylico = false; if (empty($order['yur_info'])) { $fizlico = true; $userInfo = USER::getUserInfoByEmail($order['user_email']); $customerInfo = $userInfo->name . ' ' . $userInfo->sname . ',' . $order['address'] . ', тел. ' . $order['phone'] . ', ' . $order['email']; } $html = ' <style type="text/css"> .form-wrapper table{border-collapse: collapse;width:100%;color:#000;} .form-wrapper small-table{border-collapse: separate;} .form-wrapper table tr th{padding: 10px;border: 1px solid #000;background:#FFFFE0;} .form-wrapper .who-pay tr td{padding: 5px;} .form-wrapper .who-pay tr td.name{width: 110px;} .form-wrapper .who-pay{margin: 10px 0 0 0;} .form-wrapper table tr td{padding: 5px;border: 1px solid #000;} .form-wrapper table tr td.bottom{border: none;text-align: right;} .form-wrapper .order-total{margin: 10px 0 0 0;color:#000;} .form-wrapper .title{text-align:center;font-size:24px;color:#000;} .form-wrapper .total-list{list-style:none;} .form-wrapper .no-border, .form-wrapper .who-pay tr td, .form-wrapper .small-table tr td{border:none;} .form-wrapper .colspan4{border:none;text-align:right;} .form-wrapper .rowspan2{vertical-align:bottom;} .form-wrapper .nowrap{white-space:nowrap;} .yur-table td {height:30px;} .form-table td {height:30px; vertical-align: baseline;} .p {height:30px; vertical-align: baseline;} </style> <div class="form-wrapper"> <strong>' . $propertyOrder['nameyur'] . '</strong><br> ' . $propertyOrder['adress'] . ' <br/> <br/> <table class="yur-table"> <tr> <td> ИНН ' . $propertyOrder['inn'] . ' </td> <td>КПП ' . $propertyOrder['kpp'] . '</td> <td rowspan="2" class="rowspan2 nowrap" valign="middle">Сч. №</td> <td rowspan="2" class="rowspan2" valign="bottom">' . $propertyOrder['rs'] . '</td> </tr> <tr> <td colspan="2">Получатель <br>' . $propertyOrder['nameyur'] . '</td> </tr> <tr> <td colspan="2" rowspan="2">Банк получателя <br>' . $propertyOrder['bank'] . '</td> <td>БИК</td> <td>' . $propertyOrder['bik'] . '</td> </tr> <tr> <td class="nowrap">Сч. №</td> <td>' . $propertyOrder['ks'] . '</td> </tr> </table> <h1 class="title"> Счет <strong>№ ' . $propertyOrder['prefix'] . $order['id'] . '</strong> от ' . date('d.m.Y', strtotime($order['add_date'])) . ' </h1> <table class="who-pay"> <tr> <td class="name" width="100">Плательщик:</td> <td width="760">' . $customerInfo . '</td> </tr> </table> <br /> <br /> <table class="form-table"> <tr> <th bgcolor="#FFFFE0" width="40">№</th> <th bgcolor="#FFFFE0" width="327">Товар</th> <th bgcolor="#FFFFE0" >Артикул</th> <th bgcolor="#FFFFE0" >Цена</th> <th bgcolor="#FFFFE0" width="70">Кол-во</th> <th bgcolor="#FFFFE0" width="50">НДС</th> <th bgcolor="#FFFFE0" >Сумма</th> </tr>'; $i = 1; $ndsPercent = is_numeric($propertyOrder['nds']) ? $propertyOrder['nds'] : 0; $totalNds = 0; if ($ndsPercent === 0) { $totalNds = '-'; } if (!empty($perOrders)) { foreach ($perOrders as $perOrder) { if ($totalNds !== '-') { $marginNds = $perOrder['price'] * $ndsPercent / (100 + $ndsPercent); $perOrder['price'] -= $marginNds; $totalNds += $marginNds; } $html .= '<tr> <td style="padding: 5px;">' . $i++ . '</td> <td cellpadding="5"> ' . $perOrder['name'] . ' ' . htmlspecialchars_decode(str_replace('&', '&', $perOrder['property'])) . ' </td> <td >' . $perOrder['code'] . '</td> <td >' . sprintf('%2.2f', $perOrder['price']) . ' ' . $currency . '</td> <td >' . $perOrder['count'] . ' шт.</td> <td >' . ($propertyOrder['nds'] >= 0 && is_numeric($propertyOrder['nds']) ? $propertyOrder['nds'] . '%' : '---') . '</td> <td >' . sprintf('%2.2f', $perOrder['price'] * $perOrder['count']) . ' ' . $currency . '</td> </tr>'; } } $html .= ' <tr> <td colspan="6" class="colspan4"> <strong>Итого без НДС:</strong> </td> <td>' . sprintf('%2.2f', $order['summ'] - $totalNds) . ' ' . $currency . '</td> </tr> <tr> <td colspan="6" class="colspan4"> <strong>Итого НДС:</strong> </td>'; if ($totalNds !== '-') { $html .= '<td>' . sprintf('%2.2f', $totalNds) . ' ' . $currency . '</td>'; } else { $html .= '<td>---</td>'; } $html .= '</tr> <tr> <td colspan="6" class="colspan4"> <strong>Доставка:</strong> </td>'; $html .= '<td><strong>' . $order['delivery_cost'] . ' ' . $currency . '</strong></td>'; $totalsumm = $order['summ'] + $order['delivery_cost']; $html .= '</tr> <tr> <td colspan="6" class="colspan4"> <strong>Всего к оплате:</strong> </td> <td><strong>' . sprintf('%2.2f', $totalsumm) . ' ' . $currency . '</strong></td> </tr> </table> <p>Всего наименований ' . $i . ', на сумму ' . $totalsumm . ' ' . $currency . '</p> '; include 'int2str.php'; $sumToWord = new int2str($totalsumm); $sumToWord->ucfirst($sumToWord->rub); $html .= '<p><strong style="font-size: 18px;">' . $sumToWord->ucfirst($sumToWord->rub) . '</strong></p> <div class="clear"> </div> </div>'; $imgSing = ''; if (file_exists($propertyOrder['sing'])) { $imgSing = '<img src="' . SITE . '/' . $propertyOrder['sing'] . '">'; } else { if (file_exists('uploads/sing.jpg')) { $imgSing = '<img src="' . SITE . '/uploads/sing.jpg">'; } } $imgStamp = ''; if (file_exists($propertyOrder['stamp'])) { $imgStamp = '<img src="' . SITE . '/' . $propertyOrder['stamp'] . '">'; } else { if (file_exists('uploads/stamp.jpg')) { $imgStamp = '<img src="' . SITE . '/uploads/stamp.jpg">'; } } if (empty($propertyOrder['usedsing'])) { $imgSing = ''; $imgStamp = ''; } $html .= ' <br /> <br /> <table> <tr> <td width="240"></td> <td width="10"></td> <td width="140" align="center">' . $imgSing . '</td> <td width="30"></td> <td width="240"></td> </tr> <tr> <td width="240">Генеральный директор</td> <td width="10"></td> <td width="140"></td> <td width="30"></td> <td width="240" align="center">/' . $propertyOrder['general'] . '/</td> </tr> <tr> <td width="240"></td> <td width="10"></td> <td width="140"><hr> подпись</td> <td width="30"></td> <td width="240"><hr><strong style="font-size: 10px;"> расшифровка подписи</strong></td> </tr> <tr> <td width="240"></td> <td width="10"></td> <td width="140"></td> <td width="30"></td> <td width="240"></td> </tr> <tr> <td width="240"></td> <td width="10"></td> <td width="140"></td> <td width="30"></td> <td width="240">М.П.' . $imgStamp . '</td> </tr> <tr> </tr> </table> '; return $html; }