if ($ok == TRUE) { ?> <div class="receipt-main-wrap"> <h3><?php echo Yii::t("default", "Thank You"); ?> </h3> <p><?php echo Yii::t("default", "Your order has been placed."); ?> </p> <div class="receipt-wrap order-list-wrap"> <?php echo Widgets::receiptLogo(); ?> <h4><?php echo Yii::t("default", "Order Details"); ?> </h4> <div class="input-block"> <div class="label"><?php echo Yii::t("default", "Customer Name"); ?> :</div> <div class="value"><?php echo $data['full_name']; ?>
public static function salesReceipt($data = '', $item_details = '') { $tr = ""; if (is_array($data) && count($data) >= 1) { foreach ($data as $val) { $tr .= "<tr>"; $tr .= "<td>" . $val['label'] . "</td>"; $tr .= "<td>" . $val['value'] . "</td>"; $tr .= "</tr>"; } } $mid = isset($item_details['total']['mid']) ? $item_details['total']['mid'] : ''; //dump($mid); $tr .= "<tr>"; $tr .= "<td colspan=\"2\"> </td>"; $tr .= "</tr>"; if (isset($item_details['item'])) { if (is_array($item_details['item']) && count($item_details['item']) >= 1) { foreach ($item_details['item'] as $item) { //dump($item); $notes = ''; $item_total = $item['qty'] * $item['discounted_price']; if (!empty($item['order_notes'])) { $notes = "<p>" . $item['order_notes'] . "</p>"; } $cookref = ''; if (!empty($item['cooking_ref'])) { $cookref = "<p>" . $item['cooking_ref'] . "</p>"; } $size = ''; if (!empty($item['size_words'])) { $size = "<p>" . $item['size_words'] . "</p>"; } $tr .= "<tr>"; $tr .= "<td>" . $item['qty'] . " " . $item['item_name'] . $size . $notes . $cookref . "</td>"; $tr .= "<td>" . prettyFormat($item_total, $mid) . "</td>"; $tr .= "</tr>"; if (isset($item['sub_item'])) { foreach ($item['sub_item'] as $itemsub) { $subitem_total = $itemsub['addon_qty'] * $itemsub['addon_price']; $tr .= "<tr>"; $tr .= "<td style=\"text-indent:10px;\">" . $itemsub['addon_name'] . "</td>"; $tr .= "<td>" . prettyFormat($subitem_total, $mid) . "</td>"; $tr .= "</tr>"; } } } } } $tr .= "<tr>"; $tr .= "<td colspan=\"2\"> </td>"; $tr .= "</tr>"; //dump($item_details['total']); if (isset($item_details['total'])) { $tr .= "<tr>"; $tr .= "<td>" . Yii::t("default", "Subtotal") . ":</td>"; $tr .= "<td>" . prettyFormat($item_details['total']['subtotal'], $mid) . "</td>"; $tr .= "</tr>"; if (!empty($item_details['total']['delivery_charges'])) { $tr .= "<tr>"; $tr .= "<td>" . Yii::t("default", "Delivery Fee") . ":</td>"; $tr .= "<td>" . prettyFormat($item_details['total']['delivery_charges'], $mid) . "</td>"; $tr .= "</tr>"; } $tr .= "<tr>"; $tr .= "<td>" . Yii::t("default", "Tax") . " " . $item_details['total']['tax_amt'] . "%</td>"; $tr .= "<td>" . prettyFormat($item_details['total']['taxable_total'], $mid) . "</td>"; $tr .= "</tr>"; $tr .= "<tr>"; $tr .= "<td>" . Yii::t("default", "Total") . ":</td>"; $tr .= "<td>" . $item_details['total']['curr'] . prettyFormat($item_details['total']['total'], $mid) . "</td>"; $tr .= "</tr>"; } ob_start(); ?> <div style="display: block;max-height: 70px;max-width: 200px;"> <?php echo Widgets::receiptLogo(); ?> </div> <h3><?php echo Yii::t("default", "Order Details"); ?> </h3> <table border="0"> <?php echo $tr; ?> </table> <?php $receipt = ob_get_contents(); ob_end_clean(); return $receipt; }