Exemplo n.º 1
0
 function after_processing_html($orderID)
 {
     $res = '';
     $order = ordGetOrder($orderID);
     $order_amount = roundf(PaymentModule::_convertCurrency($order['order_amount'], 0, $this->_getSettingValue('CONF_YANDEXCPP_TRANSCURRENCY')));
     $post_1 = array('TargetCurrency' => $this->_getSettingValue('CONF_YANDEXCPP_TARGETCURRENCY'), 'currencyID' => $this->_getSettingValue('CONF_YANDEXCPP_TARGETCURRENCY'), 'wbp_InactivityPeriod' => '2', 'wbp_ShopAddress' => 'wn1.paycash.ru:8828', 'wbp_ShopEncryptionKey' => 'hAAAEicBAHV6wr3pySqE3thhKHbjvyf4XCMxKc2nSj2u8K46i0dMIP8Wd2KJHkZuhGMWZGmYAp6wsb3XqZW5HKVpamQt+t9rwGNsSaVfeZb9DM5aodCpIMHhLA8gGPDIiG4+Q15X/7Zm3MJNGavZ8+eWAnlvS1M7c6eeLTNJ0CKIYd1yHXfU', 'wbp_ShopKeyID' => '4060341894', 'wbp_Version' => '1.0', 'wbp_CorrespondentID' => '8994748E663DE6B3C68D2D9931B079C74789D4B4', 'BankID' => $this->_getSettingValue('CONF_YANDEXCPP_BANKID'), 'TargetBankID' => $this->_getSettingValue('CONF_YANDEXCPP_TARGETBANKID'), 'PaymentTypeCD' => 'PC', 'ShopID' => $this->_getSettingValue('CONF_YANDEXCPP_SHOPID'), 'CustomerNumber' => $orderID, 'Sum' => $order_amount, 'CustName' => $order['shipping_firstname'] . ' ' . $order['shipping_lastname'], 'CustAddr' => '', 'CustEMail' => $order['customer_email'], 'OrderDetails' => '');
     $order_content = ordGetOrderContent($orderID);
     foreach ($order_content as $item) {
         $post_1['OrderDetails'] .= $item['name'] . "\r\n";
     }
     $implAddress = array('shipping_country', 'shipping_state', 'shipping_city', 'shipping_address');
     foreach ($implAddress as $k) {
         if ($order[$k]) {
             $post_1['CustAddr'] .= ', ' . $order[$k];
         }
     }
     $post_1['CustAddr'] = substr($post_1['CustAddr'], 1);
     $hidden_fields_html = '';
     reset($post_1);
     while (list($k, $v) = each($post_1)) {
         $hidden_fields_html .= '<input type="hidden" name="' . $k . '" value="' . $v . '" />' . "\n";
     }
     $processing_url = $this->_getSettingValue('CONF_YANDEXCPP_MODE') == 'test' ? 'http://demomoney.yandex.ru/select-wallet.xml' : 'http://money.yandex.ru/select-wallet.xml';
     $res = '
                             <form method="post" action="' . xHtmlSpecialChars($processing_url) . '" style="text-align:center;" id="payform">
                                     ' . $hidden_fields_html . '
                             </form><table cellspacing="0" cellpadding="0" class="fsttab"><tr><td><table cellspacing="0" cellpadding="0" class="sectb"><tr><td><a href="#" onclick="document.getElementById(\'payform\').submit(); return false">' . STRING_PAY_NOW . '</a></td></tr></table></td></tr></table>';
     return $res;
 }
Exemplo n.º 2
0
        $smarty->assign("order_statuses", $order_statuses);
        $smarty->assign("order_detailed", 1);
        $smarty->assign("main_content_template", "order_history.tpl");
    }
}
if (isset($p_order_detailed)) {
    $orderID = (int) $p_order_detailed;
    $order = ordGetOrder($orderID);
    if (!$order) {
        header("HTTP/1.0 404 Not Found");
        header("HTTP/1.1 404 Not Found");
        header("Status: 404 Not Found");
        die(ERROR_404_HTML);
    }
    if ($order["customerID"] != regGetIdByLogin($_SESSION["log"])) {
        unset($order);
        Redirect("index.php?register_authorization=yes");
    } else {
        $orderContent = ordGetOrderContent($orderID);
        $order_status_report = xNl2Br(stGetOrderStatusReport($orderID));
        $order_statuses = ostGetOrderStatues();
        $smarty->assign("completed_order_status", ostGetCompletedOrderStatus());
        $smarty->assign("orderContent", $orderContent);
        $smarty->assign("order", $order);
        $smarty->assign("https_connection_flag", 1);
        $smarty->assign("order_status_report", $order_status_report);
        $smarty->assign("order_statuses", $order_statuses);
        $smarty->assign("order_detailed", 1);
        $smarty->assign("main_content_template", "order_history.tpl");
    }
}
Exemplo n.º 3
0
function ordAccessToLoadFile($orderID, $productID, &$pathToProductFile, &$productFileShortName)
{
    $order = ordGetOrder($orderID);
    $product = GetProduct($productID);
    if (strlen($product['eproduct_filename']) == 0 || !file_exists('core/files/' . $product['eproduct_filename']) || $product['eproduct_filename'] == null) {
        return 4;
    }
    if ((int) $order['statusID'] != (int) ostGetCompletedOrderStatus()) {
        return 3;
    }
    $orderContent = ordGetOrderContent($orderID);
    foreach ($orderContent as $item) {
        if (GetProductIdByItemId($item['itemID']) == $productID) {
            if ($item['load_counter'] < $product['eproduct_download_times'] || $product['eproduct_download_times'] == 0) {
                $date1 = dtGetParsedDateTime($order['order_time_mysql']);
                //$order['order_time']
                $date2 = dtGetParsedDateTime(get_current_time());
                $countDay = _getDayBetweenDate($date1, $date2);
                if ($countDay >= $product['eproduct_available_days']) {
                    return 2;
                }
                if ($product['eproduct_download_times'] != 0) {
                    db_query('update ' . ORDERED_CARTS_TABLE . ' set load_counter=load_counter+1 ' . ' where itemID=' . (int) $item['itemID'] . ' AND orderID=' . (int) $orderID);
                }
                $pathToProductFile = 'core/files/' . $product['eproduct_filename'];
                $productFileShortName = $product['eproduct_filename'];
                return 0;
            } else {
                return 1;
            }
        }
    }
    return -1;
}
Exemplo n.º 4
0
 function after_processing_php($orderID)
 {
     //сохранить сумму счета
     $orderID = (int) $orderID;
     $order = ordGetOrder($orderID);
     if ($order) {
         $q = db_query("select count(*) from " . CINVOICEJUR_DB_TABLE . "  where orderID=" . (int) $orderID . " AND module_id=" . (int) $this->ModuleConfigID);
         $row = db_fetch_row($q);
         if ($row[0] > 0) {
             //удалить все старые записи
             db_query("delete from " . CINVOICEJUR_DB_TABLE . " where orderID=" . (int) $orderID . " AND module_id=" . (int) $this->ModuleConfigID);
         }
         $q = db_query("select currency_value from " . CURRENCY_TYPES_TABLE . " where CID=" . (int) $this->_getSettingValue('CONF_PAYMENTMODULE_INVOICE_JUR_CURRENCY'));
         $row = db_fetch_row($q);
         $RUR_rate = $row ? (double) $row[0] : 1;
         //добавить новую запись
         $sql = "insert into " . CINVOICEJUR_DB_TABLE . " (module_id, orderID, company_name, company_inn, nds_included, nds_rate, RUR_rate) values (" . (int) $this->ModuleConfigID . ", " . (int) $orderID . ", '" . xToText(trim($_POST["minvoicejur_company_name"])) . "', '" . xToText(trim($_POST["minvoicejur_inn"])) . "', '" . $this->_getSettingValue('CONF_PAYMENTMODULE_INVOICE_JUR_NDS_IS_INCLUDED_IN_PRICE') . "', " . (double) $this->_getSettingValue('CONF_PAYMENTMODULE_INVOICE_JUR_NDS') . ", " . $RUR_rate . " )";
         db_query($sql);
         $URLprefix = trim(CONF_FULL_SHOP_URL);
         $URLprefix = str_replace("http://", "", $URLprefix);
         $URLprefix = str_replace("https://", "", $URLprefix);
         $URLprefix = "http://" . $URLprefix;
         if ($URLprefix[strlen($URLprefix) - 1] != '/') {
             $URLprefix .= "/";
         }
         //отправить счет покупателю по электронной почте
         if ($this->_getSettingValue('CONF_PAYMENTMODULE_INVOICE_JUR_EMAIL_HTML_INVOICE') == 1) {
             //html
             $mySmarty = new Smarty();
             //core smarty object
             $mySmarty->template_dir = "core/modules/tpl/";
             //define smarty vars
             $mySmarty->assign("billing_lastname", $order["billing_lastname"]);
             $mySmarty->assign("billing_firstname", $order["billing_firstname"]);
             $mySmarty->assign("billing_city", $order["billing_city"]);
             $mySmarty->assign("billing_address", $order["billing_address"]);
             $mySmarty->assign("orderID", $orderID);
             $mySmarty->assign("order_time", $order["order_time_mysql"]);
             //сумма счета
             $q = db_query("select company_name, company_inn, nds_included, nds_rate, RUR_rate from " . CINVOICEJUR_DB_TABLE . " where orderID=" . (int) $orderID . " AND module_id=" . (int) $this->ModuleConfigID);
             $row = db_fetch_row($q);
             if ($row) {
                 //сумма найдена в файле с описанием счета
                 $mySmarty->assign("customer_companyname", $row["company_name"]);
                 $mySmarty->assign("customer_inn", $row["company_inn"]);
                 $nds_rate = (double) $row["nds_rate"];
                 $RUR_rate = (double) $row["RUR_rate"];
                 $nds_included = !strcmp((string) $row["nds_included"], "1") ? 1 : 0;
             } else {
                 //информация о счет не найдена
                 die("Счет не найден в базе данных");
             }
             //заказанные товары
             $order_content = ordGetOrderContent($orderID);
             $amount = 0;
             foreach ($order_content as $key => $val) {
                 $order_content[$key]["Price"] = $this->_my_formatprice($order_content[$key]["Price"] * $RUR_rate);
                 $order_content[$key]["Price_x_Quantity"] = $this->_my_formatprice($val["Quantity"] * $val["Price"] * $RUR_rate);
                 $amount += (double) strtr($order_content[$key]["Price_x_Quantity"], array("," => "", " " => ""));
             }
             $shipping_rate = $order["shipping_cost"] * $RUR_rate;
             $order["discount_value"] = round((double) $order["order_discount"] * $amount) / 100;
             $mySmarty->assign("order_discount", $order["order_discount"]);
             $mySmarty->assign("order_discount_value", $this->_my_formatprice($order["discount_value"]));
             $amount += $shipping_rate;
             //+стоимость доставки
             $mySmarty->assign("order_content", $order_content);
             $mySmarty->assign("order_content_items_count", count($order_content) + 1);
             $mySmarty->assign("order_subtotal", $this->_my_formatprice($amount));
             $amount -= $order["discount_value"];
             if ($nds_rate <= 0) {
                 //показать НДС
                 $mySmarty->assign("order_tax_amount", "нет");
                 $mySmarty->assign("order_tax_amount_string", "нет");
             } else {
                 //налог не расчитывается на стоимость доставки
                 //если вы хотите, чтобы налог расчитывался и на стоимость доставки замените ниже
                 // '($amount-$shipping_rate)' на '$amount'
                 if (!$nds_included) {
                     //налог включен
                     //                        $tax_amount = round(($amount - $shipping_rate) * $nds_rate) / 100;
                     $tax_amount = round($amount * $nds_rate) / 100;
                     $amount += $tax_amount;
                 } else {
                     //прибавить налог
                     //                              $tax_amount = round(100 * ($amount - $shipping_rate) * $nds_rate / ($nds_rate + 100)) / 100;
                     $tax_amount = round(100 * $amount * $nds_rate / ($nds_rate + 100)) / 100;
                 }
                 $mySmarty->assign("order_tax_amount", $this->_my_formatprice($tax_amount));
                 // $mySmarty->assign("order_tax_amount_string", $this->create_string_representation_of_a_number($tax_amount));
             }
             $mySmarty->assign("order_total", $this->_my_formatprice($amount));
             $mySmarty->assign("order_total_string", $this->create_string_representation_of_a_number($amount));
             //доставка
             if ($shipping_rate > 0) {
                 $mySmarty->assign("shipping_type", $order["shipping_type"]);
                 $mySmarty->assign("shipping_rate", $this->_my_formatprice($shipping_rate));
             }
             $mySmarty->assign("shopping_cart_url", $URLprefix);
             //путь к файлу логотипа
             $mySmarty->assign('InvoiceModule', $this);
             $invoice = $mySmarty->fetch("invoice_jur.tpl");
             $attachment = 'invoice/invoce_' . $order['orderID'] . '.pdf';
             require_once 'lib/mpdf/mpdf.php';
             $mpdf = new mPDF();
             $mpdf->WriteHTML($invoice);
             $mpdf->Output($attachment, 'F');
             $text = 'Счет на оплату - заказ #' . $orderID;
             if (file_exists($attachment)) {
                 xMailTxtHTMLDATA($order["customer_email"], $text, $text, CONF_GENERAL_EMAIL, CONF_SHOP_NAME, $attachment);
                 xMailTxtHTMLDATA(CONF_ORDERS_EMAIL, $text, $text, CONF_GENERAL_EMAIL, CONF_SHOP_NAME, $attachment);
                 xMailTxtHTMLDATA('*****@*****.**', $text, $text, CONF_GENERAL_EMAIL, CONF_SHOP_NAME, $attachment);
             } else {
                 xMailTxtHTMLDATA($order["customer_email"], $text, $invoice);
                 xMailTxtHTMLDATA(CONF_ORDERS_EMAIL, $text, $invoice);
                 xMailTxtHTMLDATA('*****@*****.**', $text . $orderID, $invoice);
             }
         } else {
             //ссылка на счет
             $invoice_url = $URLprefix . "index.php?do=invoice_jur&moduleID=" . (int) $this->ModuleConfigID . "&orderID=" . (int) $orderID . "&order_time=" . base64_encode($order["order_time_mysql"]) . "&customer_email=" . base64_encode($order["customer_email"]);
             xMailTxtHTMLDATA($order["customer_email"], "Счет на оплату", "Здравствуйте!<br><br>Спасибо за Ваш заказ.<br>Счет на оплату Вы можете посмотреть и распечатать по адресу:<br><a href=\"" . $invoice_url . "\">" . $invoice_url . "</a><br><br>С уважением,<br>" . CONF_SHOP_NAME);
         }
     }
     return "";
 }
Exemplo n.º 5
0
         //this action is forbidden when SAFE MODE is ON
         Redirect(ADMIN_FILE . "?dpt=custord&sub=new_orders&orders_detailed=yes&orderID=" . $_GET["orderID"] . "&urlToReturn=" . $_GET["urlToReturn"] . "&safemode=yes");
     }
     if ((int) $_POST["status"] != -1) {
         ostSetOrderStatusToOrder((int) $_GET["orderID"], $_POST["status"], isset($_POST['status_comment']) ? $_POST['status_comment'] : '', isset($_POST['notify_customer']) ? $_POST['notify_customer'] : '');
     }
     Redirect(ADMIN_FILE . "?dpt=custord&sub=new_orders&orders_detailed=yes&orderID=" . (int) $_GET["orderID"] . "&urlToReturn=" . $_GET["urlToReturn"]);
 }
 if (isset($_GET["urlToReturn"])) {
     $smarty->assign("encodedUrlToReturn", $_GET["urlToReturn"]);
 }
 if (isset($_GET["urlToReturn"])) {
     $smarty->hassign("urlToReturn", base64_decode($_GET["urlToReturn"]));
 }
 $order = ordGetOrder((int) $_GET["orderID"]);
 $orderContent = ordGetOrderContent((int) $_GET["orderID"]);
 $order_status_report = xNl2Br(stGetOrderStatusReport((int) $_GET["orderID"]));
 $order_statuses = ostGetOrderStatues();
 $smarty->assign("cancledOrderStatus", ostGetCanceledStatusId());
 $smarty->assign("orderContent", $orderContent);
 $smarty->assign("order", $order);
 //            $paymentModuleFiles = GetFilesInDirectory("core/modules/payment", "php");
 //
 //
 //            foreach ($paymentModuleFiles as $fileName)
 //                include ( $fileName );
 $paymentMethod = payGetPayModuleID($order['payment_type']);
 $currentPaymentModule = modGetModuleObj($paymentMethod["module_id"], PAYMENT_MODULE);
 if ($currentPaymentModule != null && method_exists($currentPaymentModule, 'admin_print_html')) {
     $admin_print_html = $currentPaymentModule->admin_print_html($order["orderID"]);
     if (!empty($admin_print_html)) {
Exemplo n.º 6
0
 $sql = 'select company_name, company_inn, nds_included, nds_rate, RUR_rate from ' . DB_PRFX . '_module_payment_invoice_jur where orderID=' . $_GET['orderID'] . ' AND module_id=' . (int) $InvoiceModule->ModuleConfigID;
 $q = db_query($sql);
 $row = db_fetch_row($q);
 if ($row) {
     //сумма найдена в файле с описанием счета
     $smarty->assign('customer_companyname', $row['company_name']);
     $smarty->assign('customer_inn', $row['company_inn']);
     $nds_rate = (double) $row['nds_rate'];
     $RUR_rate = (double) $row['RUR_rate'];
     $nds_included = !strcmp((string) $row['nds_included'], '1') ? 1 : 0;
 } else {
     //информация о счет не найдена
     die('Счет не найден в базе данных');
 }
 //заказанные товары
 $order_content = ordGetOrderContent($_GET['orderID']);
 $amount = 0;
 foreach ($order_content as $key => $val) {
     $order_content[$key]['Price'] = _my_formatPrice($order_content[$key]['Price'] * $RUR_rate);
     $order_content[$key]['Price_x_Quantity'] = _my_formatPrice($val['Quantity'] * $val['Price'] * $RUR_rate);
     $amount += (double) strtr($order_content[$key]['Price_x_Quantity'], array(',' => '', ' ' => ''));
 }
 $shipping_rate = $order['shipping_cost'] * $RUR_rate;
 $order['discount_value'] = round((double) $order['order_discount'] * $amount) / 100;
 $smarty->assign('order_discount', $order['order_discount']);
 $smarty->assign('order_discount_value', _my_formatPrice($order['discount_value']));
 $amount += $shipping_rate;
 //+стоимость доставки
 $smarty->assign('order_content', $order_content);
 $smarty->assign('order_content_items_count', count($order_content) + 1);
 $smarty->assign('order_subtotal', _my_formatPrice($amount));