html * { font-family: DejaVu Sans; }"
. "table { text-align: center; font-size: 12px; }";
$html .= "
Чек к заказку $ord_id от $date
";
$html .= "Номер | Артикул | Наименование | Цена | Кол-во | Стоимость |
";
foreach ($ids as $id) {
$count = $_REQUEST["count$id"];
$sql = "SELECT modifyOrder($ord_id, $id, $count) AS 'result';";
$query = mysqli_query($con, $sql);
$r = mysqli_fetch_assoc($query);
if ($r['result'] != 1) {
echo 'Ошибка при создании заказа';
return;
}
$sql = "CALL partInfo($id, 0);";
$query = mysqli_query($con, $sql);
$r = mysqli_fetch_assoc($query);
$price = $r['price'];
$price_dec = number_format($price, 2, '.', ' ');
$upc = $r['upc'];
$name = $r['name'];
$sum_dec = number_format($price * $count, 2, '.', ' ');
$index = $i + 1;
$html .= "$index | $upc | $name | $price_dec | $count | $sum_dec |
";
$i++;
$sum += $price * $count;
while (mysqli_more_results($con))
mysqli_next_result($con);
}
$sum_final = number_format($sum, 2, '.', ' ');
$html .= "
Итого: $sum_final рублей
Заказ готов к выдаче и ждет оплаты в магазине $shop по адресу $address
";
$sql = "SELECT saveCart('$login', '_');";
$query = mysqli_query($con, $sql);
// $sql = "SELECT getEmail('$login') AS 'email';";
// $query = mysqli_query($con, $sql);
// $r = mysqli_fetch_assoc($query);
// $email = $r['email'];
// $headers = "From: nrpc \n";
// $headers .= "Cc: nrpc \n";
// $headers .= "X-Sender: nrpc \n";
// $headers .= 'X-Mailer: PHP/' . phpversion();
// $headers .= "X-Priority: 1\n";
// $headers .= "Return-Path: nrpc@nrpc.ru\n";
// $headers .= "MIME-Version: 1.0\r\n";
// $headers .= "Content-Type: text/plain; charset=iso-8859-1\n";
// $res = mail($email, 'Заказ', 'Заказ успешно оформлен!', $headers);
$dompdf->load_html($html);
$dompdf->render();
$output = $dompdf->output();
file_put_contents("../receipt/$ord_id.pdf", $output);
$link = '"downloadReceipt.php?ord=' . $ord_id . '"';
echo "Ваш заказ успешно офрмлен!";
} else {
header('Location: ../index.php');
exit();
}
}