Example ซีคอน สแควร์

===================================================================================
Prefix = |
Seller TAX ID (13) = 0107545000012 >> ซีคอน ศรีนครินทร์
Suffix (2) = 00
Reference No.1 = 2320339993
Reference No.2 = 01
Total Amount = 60000 >> รวมตัวเลขหลังจุดทศนิยม = 600.00

Example ซีคอน บางแค

===================================================================================
Prefix = |
Seller TAX ID (13) = 0105533053882 >> ซีคอน บางแค
Suffix (2) = 00
Reference No.1 = C0000001
Reference No.2 = BI-SDC-2200001
Total Amount = 75000 >> รวมตัวเลขหลังจุดทศนิยม = 750.00 bath
===================================================================================

Example ซีคอน บางแค - เติบโต


Prefix = |
Seller TAX ID (13) = 0105533053882 >> ซีคอน บางแค
Suffix (2) = 00
Reference No.1 = 000000000000000173
Reference No.2 = 000000000000009502
Total Amount = 0000982700 >> รวมตัวเลขหลังจุดทศนิยม = 00009827.00 bath

Gen Qr Code

Tag HTML <div class="genQrPng"> <div> นี้ไปว่างตรงส่วนที่จะให้ QR Code แสดง

barcode



HTML


   <%@ Page Language="C#" AutoEventWireup="true" CodeFile="genQr.aspx.cs" Inherits="genQr" %>

   <script>
        var qr = "|010754500001200\r2320339993\r01\r1025";   // ตาม format
        genQr(qr);  //เรียกใช้ function genQr();
   </script>

   <body>
     

Tag HTML <div class="genQrPng"> <div> นี้ไปว่างตรงส่วนที่จะให้ QR Code แสดง

</body>

Javascript

    function genQr(genQr) {    
        var data_post = JSON.stringify({
            'genQr': genQr   
        });
        alert(genQr)

        $.ajax({
            type: "POST",
            url: "genQr.aspx/genQrcode",
            data: data_post,
            cache: false,
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {

                img = '<img style="width: 110px;height: 110px;position: relative;top: -10px; left: -10px;" src="' + data.d + '">';
                img2 = '<img style="width: 200px;height: 200px;position: relative;" src="' + data.d + '"">';

                $('.genQrPng').html(img)
                $('.genQrPng2').html(img2)



            },
            error: function (data) {  //console.log }
        });
    }

C#.NET

using System;
using System.Collections.Generic;
using System.Linq; 
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Drawing;
using System.Web.Services;
using System.Web.Script.Services;
using System.Web.Script.Serialization;
using System.Collections.Specialized;

using QRCoder; 



public partial class genQr : System.Web.UI.Page
{
    
   
    [WebMethod]
    public static string genQrcode(string genQr)
    {       
        string Empty = genQr;

        string code = genQr;
        QRCodeGenerator qrGenerator = new QRCodeGenerator();
        QRCodeGenerator.QRCode qrCode = qrGenerator.CreateQrCode(code, QRCodeGenerator.ECCLevel.Q);
        System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WaebControls.Image();
        imgBarCode.Height = 95;
        imgBarCode.Width = 95;
        using (Bitmap bitMap = qrCode.GetGraphic(20))
        {
            using (MemoryStream ms = new MemoryStream())
            {
                bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                byte[] byteImage = ms.ToArray();
                imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
            }
          

            return imgBarCode.ImageUrl;
        }

    }


}