Beispiel #1
0
        private void frmBarCode_Load(object sender, EventArgs e)
        {
            try
            {
                DataTable dt = classSQL.select("SELECT traje_do,popust,aktivnost FROM promocija1", "promocija1").Tables[0];

                double UKpopust = ukupno * Convert.ToDouble(dt.Rows[0]["popust"].ToString()) / 100;

                DateTime RunsUntil;
                DateTime dvo = DateTime.Now;
                RunsUntil = dvo.AddDays(Convert.ToInt16(dt.Rows[0]["traje_do"].ToString()));;

                Image  myimg = Code128Rendering.MakeBarcodeImage("000" + broj_dokumenta, int.Parse("3"), true);
                string path  = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\barcode.png";
                ResizeBarCode(myimg, 100).Save(path);

                string txt = "<html><body style=\"font-family:Verdana, Geneva, sans-serif\"><div>Naša zahvala za Vašu kupovinu:</div><div>" + UKpopust.ToString("#0.00") + " kn popusta.</div><br/><br/>";
                txt += "<img src=\"" + Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\barcode.png\" width=\"300\" height=\"100\" /><br/><br/><br/>";

                txt += "<div>Popust odgovara " + dt.Rows[0]["popust"].ToString() + "% vrijednosti kupovine koju dobivate kod iduće kupovine.</div>" +
                       "<div>Trajanje kupona vrijedi do " + RunsUntil.ToString() + "</div>" +
                       "<div>Gotovinska isplata nije moguća. \r\nIznos sljedeće kupovine mora biti jednak ili veći od vrijednosti bona.</div></html></body>";

                webBrowser1.DocumentText = txt;
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, this.Text);
            }
        }
        private void pdoc_PrintPageBarcode(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Graphics g    = e.Graphics;
            Font     font = new Font("Courier New", 8);

            float fontHeight = font.GetHeight();
            int   startX     = 10;
            int   startY     = 2;
            int   Offset     = 5;


            string sBSN = string.Format("{0}", "Sree Krisna Pharmacy");

            g.DrawString(sBSN, new Font("Arial", 10, FontStyle.Bold), System.Drawing.Brushes.Black, startX + 33, startY);
            Offset = Offset + 15;

            Image myimg = Code128Rendering.MakeBarcodeImage(sBarcode, nBarCodeWeight, true);

            g.DrawImage(myimg, startX + 3, startY + Offset);
            Offset = Offset + 25;

            //pictBarcode.Image = myimg;

            string sBarcodeCaption = string.Format("   {0}", sBarcode + "");

            g.DrawString(sBarcodeCaption, new Font("Arial", 10, FontStyle.Bold), System.Drawing.Brushes.Black, startX + 15, startY + Offset);
            Offset = Offset + myimg.Height + 5;

            string caption = string.Format("  Tk:   {0}", Convert.ToString(sUnitPrice));

            g.DrawString(caption, new Font("Arial", 10, FontStyle.Bold), System.Drawing.Brushes.Black, startX + 10, startY + Offset);
            //Offset = Offset + 20;
        }
Beispiel #3
0
        public void initBarcode(string barcode, string discription, string itemcode)
        {
            this._BarcodeInfo.Barcode     = barcode;
            this._BarcodeInfo.Description = this.DiscriptionSummary;
            Code128Content content = new Code128Content(this._BarcodeInfo.Barcode);

            int[] codes = content.Codes;
            this._BarcodeRenterInfo.Patterns = Code128Rendering.CreatePatterns(codes);
            foreach (int x in this._BarcodeRenterInfo.Patterns)
            {
                Console.WriteLine(x.ToString());
            }
            this._BarcodeRenterInfo.BarColor        = Color.Black;
            this._BarcodeRenterInfo.ShowBarcodeText = true;
            this._BarcodeRenterInfo.ShowDescription = true;
            try
            {
                this._BarcodeRenterInfo.TextFont = new Font(SystemFonts.DefaultFont.FontFamily,
                                                            (float)BarcodePrinter.Properties.Settings.Default.FontSize, FontStyle.Regular);
            }
            catch (Exception)
            { }

            this._BarcodeRenterInfo.SetMarginAll(4);
            this._BarcodeRenterInfo.QuitZone = new System.Drawing.Printing.Margins(2, 2, 2, 2);
        }
Beispiel #4
0
        /// <summary>
        /// Generate barcode
        /// </summary>
        /// <returns></returns>
        public System.Drawing.Image Barcode(string order_numer = "", double scale = 1.1d)
        {
            if (string.IsNullOrEmpty(order_numer))
            {
                order_numer = Order.Order_Number;
            }
            int barcode_width = (int)(Code128Rendering.EstimateWidth(order_numer, 2, false) * scale);

            System.Drawing.Image image = new System.Drawing.Bitmap(barcode_width, 70);

            Graphics g = Graphics.FromImage(image);

            g.Clear(Color.White);
            System.Drawing.Font font         = new System.Drawing.Font("Tahoma", 14, FontStyle.Bold);
            StringFormat        center_align = new StringFormat();

            center_align.Alignment = StringAlignment.Center;

            var y = Code128Rendering.MakeBarcodeImage(order_numer, 2, false, ref g, 1, barcode_width);

            y += 3;
            g.DrawString(Order.Order_Number, font, Brushes.Black, barcode_width / 2, y, center_align);

            font.Dispose();
            g.Dispose();
            return(image);
        }
Beispiel #5
0
        private void btnBarcode_Click(object sender, EventArgs e)
        {
            Set_Variable(index);

            if (Convert.ToInt16(parentForm.dataGridView1.SelectedCells[7].Value) == 7 & Convert.ToInt16(parentForm.dataGridView1.SelectedCells[8].Value) == 1)
            {
            }
            else
            {
                if (ItmUpc.Length == 4)
                {
                    myimg             = Code128Rendering.MakeBarcodeImage(ItmUpc, 2, true);
                    pictureBox1.Image = myimg;
                }
                else if (ItmUpc.Length == 7)
                {
                    myimg             = Code128Rendering.MakeBarcodeImage(ItmUpc, 2, true);
                    pictureBox1.Image = myimg;
                }
                else
                {
                    myimg             = Code128Rendering.MakeBarcodeImage(ItmUpc, 1, true);
                    pictureBox1.Image = myimg;
                }
            }
        }
Beispiel #6
0
        private Byte[] CrearImagenCB(string nroSucursal, string nroGuia)
        {
            // Creo la imagen del código de barras para luego utilizarla en el control de impresión
            // TODO: Configurar la ruta en el web.config
            string nroGuiaCB = nroSucursal + Utiles.Formatos.CerosIzq(Convert.ToInt32(nroGuia), 5);

            System.Drawing.Image myimg = Code128Rendering.MakeBarcodeImage(nroGuiaCB, 2, true, 12);
            string nombreArchivo       = nroGuiaCB + ".jpg";
            //string ruta = "C:\\Andesmar\\SisPackTest\\SISPACK\\CB\\";
            string ruta = Server.MapPath("CB") + "\\";

            // Reviso si existe el archivo a crear
            if (new System.IO.FileInfo(ruta + nombreArchivo).Exists == false)
            {
                // El archivo no existe, lo creo
                myimg.Save(ruta + nombreArchivo, System.Drawing.Imaging.ImageFormat.Jpeg);
            }

            FileStream   Archivo = new FileStream(ruta + nombreArchivo, FileMode.Open);//Creo el archivo
            BinaryReader binRead = new BinaryReader(Archivo);

            Byte[] imagenEnBytes = new Byte[(Int64)Archivo.Length]; //Creo un Array de Bytes donde guardare la imagen
            binRead.Read(imagenEnBytes, 0, (int)Archivo.Length);    //Cargo la imagen en el array de Bytes
            binRead.Close();

            Archivo.Close();

            return(imagenEnBytes);//Devuelvo la imagen convertida en un array de bytes
        }
Beispiel #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string codigo = Request.QueryString["codigo"];

        // create the actual thumbnail image
        System.Drawing.Image thumbnailImage = Code128Rendering.MakeBarcodeImage(codigo, 1, false);

        // make a memory stream to work with the image bytes
        MemoryStream imageStream = new MemoryStream();

        // put the image into the memory stream
        thumbnailImage.Save(imageStream, System.Drawing.Imaging.ImageFormat.Jpeg);

        // make byte array the same size as the image
        byte[] imageContent = new Byte[imageStream.Length];

        // rewind the memory stream
        imageStream.Position = 0;

        // load the byte array with the image
        imageStream.Read(imageContent, 0, (int)imageStream.Length);

        // return byte array to caller with image type
        Response.ContentType = "image/jpeg";
        Response.BinaryWrite(imageContent);
    }
Beispiel #8
0
        private void btBuscar_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(tbCodProduto.Text))
                {
                    MessageBox.Show("Preencha o Cód do Produto", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    tbCodProduto.Focus();
                }
                else if (string.IsNullOrEmpty(tbNumEtiquetas.Text))
                {
                    MessageBox.Show("Preencha o número de Etiquetas", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    tbNumEtiquetas.Focus();
                }

                else
                {
                    DataTable dtRes = new DataTable();
                    dtRes = classbd.BuscaInfoEtiqueta(tbCodProduto.Text);
                    if (dtRes.Rows.Count == 0)
                    {
                        MessageBox.Show("Não foi encontrado nenhuma Produto com o número: " + tbCodProduto.Text, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        tbCodProduto.Clear();
                        tbCodProduto.Focus();
                        LimpaCampos();
                    }
                    else
                    {
                        if (VerificaGtin(dtRes.Rows[0]["pro_barra"].ToString()))
                        {
                            lbCodigo.Text    = dtRes.Rows[0]["pro_codigo"].ToString();
                            lbDescricao.Text = dtRes.Rows[0]["pro_resumo"].ToString().ToString();
                            lbGtin.Text      = dtRes.Rows[0]["pro_barra"].ToString();

                            Image codbarrasCod = Code128Rendering.MakeBarcodeImage(dtRes.Rows[0]["pro_codigo"].ToString(), 2, false);
                            pbCodProd.Image = codbarrasCod;
                            pbCodProd.Image.Save(@"C:\Windows\Temp\CodProd.jpg");



                            string barCode = lbGtin.Text;
                            Zen.Barcode.Code128BarcodeDraw brCode = Zen.Barcode.BarcodeDrawFactory.Code128WithChecksum;
                            pbGtin.Image = brCode.Draw(barCode, 60);
                            pbGtin.Image.Save(@"C:\Windows\Temp\CodGtin.jpg");
                        }
                        else
                        {
                            MessageBox.Show("Este Produto não tem o código GTIN-13 válido", "Atenção!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Atenção: ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    { // gjenero imagjin per UNIREF.
        public byte[] GjeneroImageUNIREF(string UNIREF)
        {
            System.Drawing.Image imgUNIREF = null;
            byte[] bUNIREF = null;

            imgUNIREF = Code128Rendering.MakeBarcodeImage(UNIREF, 2, true);
            bUNIREF   = KonvertoImazhin.KonvertoImageNeByteArray(imgUNIREF, ImageFormat.Jpeg);

            return(bUNIREF);
        }
        private void btnMakeBarcode_Click(object sender, RoutedEventArgs e)
        {
            /*I had to make a bitmap image in memory so that i could create a graphics object to work with.  for some reason I had to scale the image up from the width specified in pixels for the
             * label length and width.  Even though label width and legth are given in pixels.  I'm thinking it has something to do with screen resolutions...*/
            System.Drawing.Image objImage = new Bitmap((int)(BARCODELABELWIDTH * 5), (int)(BARCODELABELLENGTH * 5));


            txtError.Text = "";

            try
            {
                using (Graphics objGraphics = Graphics.FromImage(objImage))
                {
                    //I needed to paint the background of the label white, else the background default is black.
                    objGraphics.FillRectangle(new SolidBrush(System.Drawing.Color.White), 0, 0, (int)(BARCODELABELWIDTH * 5), (int)(BARCODELABELLENGTH * 5));

                    using (Font fnt = new Font("Arial", 8))
                    {
                        StringBuilder objStringBuilder = new StringBuilder();


                        using (Font fntHeader = new Font(FONTNAME, 8))
                        {
                            objGraphics.DrawString(BARCODEHEADER, fntHeader, System.Drawing.Brushes.Black, 120, 0);
                        }

                        objStringBuilder.Append(string.Format("Item:{0}", txtItem.Text));
                        objGraphics.DrawString(objStringBuilder.ToString(), fnt, System.Drawing.Brushes.Black, LEFTMARGIN, 10);
                        objStringBuilder.Clear();

                        objGraphics.DrawImage(Code128Rendering.MakeBarcodeImage(txtItem.Text, BARCODEWEIGHT, true), new System.Drawing.Rectangle(LEFTMARGIN, 35, (int)(BARCODELABELLENGTH), MAXBARCODEHIEGHT));
                        //objGraphics.DrawImage(Code128Rendering.MakeBarcodeImage(txtItem.Text, BARCODEWEIGHT, true), LEFTMARGIN, 35);

                        objStringBuilder.Append(string.Format("Job:{0}", txtJob.Text));
                        objGraphics.DrawString(objStringBuilder.ToString(), fnt, System.Drawing.Brushes.Black, LEFTMARGIN, 55);
                        objStringBuilder.Clear();

                        objGraphics.DrawImage(Code128Rendering.MakeBarcodeImage(txtJob.Text, BARCODEWEIGHT, true), new System.Drawing.Rectangle(LEFTMARGIN, 80, (int)(BARCODELABELLENGTH), MAXBARCODEHIEGHT));
                        //objGraphics.DrawImage(Code128Rendering.MakeBarcodeImage(txtJob.Text, BARCODEWEIGHT, true), LEFTMARGIN, 80);

                        objGraphics.DrawString("Emp#'s:________________________________", fnt, System.Drawing.Brushes.Black, LEFTMARGIN, 120);

                        objGraphics.DrawString("Qty:___________", fnt, System.Drawing.Brushes.Black, LEFTMARGIN, 145);

                        objGraphics.DrawString("NextOper:_______________", fnt, System.Drawing.Brushes.Black, 95, 145);
                    }
                }
                chkActualSize.IsChecked = true;
                imgBarcode.Source       = objImage.ToBitmapImage();
            }
            catch (Exception ex)
            {
                txtError.Text = ex.ToString();
            }
        }
Beispiel #11
0
        private void PrintData(object sender, PrintPageEventArgs e)
        {
            try
            {
                Image myimg = Code128Rendering.MakeBarcodeImage(nationalid, int.Parse("2"), true);
                //Image newImage = Image.FromFile(@"\\100.43.0.38\e$\ALL PROJECT\BloodBank(Angular)\publish\Images\logo.png");

                //// Create rectangle for displaying image.
                Rectangle LogoImage = new Rectangle(20, 50, 150, 70);
                Rectangle barcode   = new Rectangle(200, 50, 150, 70);

                //// Draw image to screen.
                e.Graphics.DrawImage(myimg, barcode);
                CalcuateMargin(e);

                e.Graphics.DrawString(" * " + patno + " * ", arial_Narrow9B, Brushes.Black, 230, 121,
                                      new StringFormat());
                CalcuateMargin(e);

                // e.Graphics.DrawImage(newImage, LogoImage);
                //CalcuateMargin(e);

                e.Graphics.DrawString(arabicname, arial_Narrow9B, Brushes.Black, 230, 132, new StringFormat());
                CalcuateMargin(e);

                e.Graphics.DrawString(patname, arial_Narrow9B, Brushes.Black, 200, 142, new StringFormat());
                CalcuateMargin(e);

                e.Graphics.DrawString(gender, arial_Narrow9B, Brushes.Black, 220, 154, new StringFormat());
                CalcuateMargin(e);

                e.Graphics.DrawString(age + "Y", arial_Narrow9B, Brushes.Black, 263, 154, new StringFormat());
                CalcuateMargin(e);

                e.Graphics.DrawString(nationality, arial_Narrow9B, Brushes.Black, 295, 154, new StringFormat());
                CalcuateMargin(e);

                e.Graphics.DrawString(nationalid, arial_Narrow9B, Brushes.Black, 370, 70, new StringFormat());
                CalcuateMarginRegular(e);

                e.Graphics.DrawString("BB EPS# " + episodeno, arial_Narrow9B, Brushes.Black, 375, 85,
                                      new StringFormat());
                CalcuateMarginRegular(e);

                e.Graphics.DrawString(arrivaldate, arial_Narrow9B, Brushes.Black, 375, 105, new StringFormat());
                CalcuateMarginRegular(e);
            }
            catch (Exception ex)
            {
                err.SetServerErrorLog(ControllerContext.RouteData.Values["controller"].ToString(),
                                      ControllerContext.RouteData.Values["action"].ToString(),
                                      Session["T_ENTRY_USER"] == null ? "" : Session["T_ENTRY_USER"].ToString(), ex.Message);
            }
        }
Beispiel #12
0
 public Image Barcode128(string txtEncodeData, int tamaño)
 {
     try
     {
         return(Code128Rendering.MakeBarcodeImage(txtEncodeData, tamaño, true));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #13
0
        private void btnPrintPreview_Click(object sender, EventArgs e)
        {
            try
            {
                if (rdoBtnOpt1.Checked == true)
                {
                    //index = parentForm.dataGridView1.SelectedRows[0].Index;
                    index = parentForm.dataGridView1.SelectedCells[0].RowIndex;

                    Set_Variable(index);

                    if (ItmUpc.Length <= 7)
                    {
                        myimg = Code128Rendering.MakeBarcodeImage(ItmUpc, 2, true);
                    }
                    else
                    {
                        myimg = Code128Rendering.MakeBarcodeImage(ItmUpc, 1, true);
                    }

                    pdPrint                     = new PrintDocument();
                    printPreviewDialog          = new PrintPreviewDialog();
                    printPreviewDialog.Document = pdPrint;
                    pdPrint.PrintPage          += new PrintPageEventHandler(pdPrint_PrintPage1);

                    DialogResult result = new DialogResult();
                    result = printPreviewDialog.ShowDialog();

                    this.Close();
                }
                else
                {
                    //index = parentForm.dataGridView1.SelectedRows[0].Index;
                    index = parentForm.dataGridView1.SelectedCells[0].RowIndex;

                    Set_Variable(index);
                    barcode1.DataToEncode = ItmUpc;

                    pdPrint                     = new PrintDocument();
                    printPreviewDialog          = new PrintPreviewDialog();
                    printPreviewDialog.Document = pdPrint;
                    pdPrint.PrintPage          += new PrintPageEventHandler(pdPrint_PrintPage2);

                    DialogResult result = new DialogResult();
                    result = printPreviewDialog.ShowDialog();

                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, this.Text);
            }
        }
Beispiel #14
0
        /// <summary>
        /// 绘制一张标签
        /// </summary>
        /// <param name="topx"></param>
        /// <param name="topy"></param>
        /// <param name="grap"></param>
        /// <param name="detail"></param>
        private void Tag_Draw(int topx, int topy, Graphics grap, OrderLabelDetail detail)
        {
            OrderLabelInfo currLable = DictLabel[detail.Sphh];
            //Form1.log.InfoFormat("货号:{0} 品名:{1} QRCOE:{2} Spid:{3}",
            //    detail.Sphh, currLable.Pm, detail.Qrcode, detail.Spid);
            string        tm     = "http://tm.lilanz.com/tm.aspx?id=" + detail.Qrcode;
            QRCodeEncoder qrcode = new QRCodeEncoder();

            qrcode.QRCodeScale   = 1;
            qrcode.QRCodeVersion = 4;
            Bitmap bitQR = qrcode.Encode(tm);

            Image ImgCode128 = Code128Rendering.MakeBarcodeImage(detail.Spid, 1, false);

            Bitmap bitCode128 = new Bitmap(ImgCode128);
            /*ean 13*/
            Ean13 _ean13 = new Ean13(detail.Tm);

            _ean13.Scale = 1f;

            /*
             * grap.DrawEllipse(pen, topx + 22, topy +  6, 1, 1);
             * grap.DrawEllipse(penWhite, topx + 22, topy - 8, 1, 1);
             */


            grap.DrawString("合 格 证", FontTitle, brush, new Point(topx + 18, topy + 10));
            DrawItem(grap, "品名:", currLable.Pm, topx + 5, topy + 15);
            DrawItem2(grap, "货号:", detail.Sphh, topx + 5, topy + 18);
            DrawItem2(grap, "号型:", detail.Hx, topx + 5, topy + 21);

            DrawMaterial(grap, currLable.Material, topx + 5, topy + 24);//纤维含量

            currY += 3;
            DrawLevel(grap, currLable.Dj, detail.Sn, topx + 5, currY); //等级

            currY += 3;
            DrawStandard(grap, currLable.Zxbz, topx + 5, currY);
            currY += 3;
            DrawSecurity(grap, currLable.Aqlb, topx + 5, currY);

            DrawItemPrice(grap, String.Format("¥{0}", currLable.Lsdj), topx, topy + 63);

            _ean13.DrawEan13Barcode(grap, new Point(topx + 5, topy + 70));//ean 13

            grap.DrawImage(bitCode128, new Rectangle(topx + 4, topy + 80, 38, 6), 0, 0,
                           bitCode128.Width, bitCode128.Height, GraphicsUnit.Pixel);

            grap.DrawString(detail.Spid, FontCode128, brush, new Point(topx + 8, topy + 86));

            grap.DrawString("(仅供内部使用)", font5, brush, new Point(topx + 16, topy + 89));

            grap.DrawImage(bitQR, new Rectangle(topx + 16, topy + 92, 13, 13), 0, 0, bitQR.Width, bitQR.Height, GraphicsUnit.Pixel);
        }
Beispiel #15
0
        public SetPrint_Form(ModuleSettings settings)
        {
            InitializeComponent();
            this.settings = settings;

            pf = new Print_form(Convert.ToInt16(210 * 4), Convert.ToInt16(297 * 4));

            ksddtxt           = new CTextPrintObjSet();
            ksddtxt.Printtext = "¿¼ÊԵصã";
            ksddtxt.mmX       = settings.Ksdd_x;
            ksddtxt.mmY       = settings.Ksdd_y;
            ksdd_x.Text       = settings.Ksdd_x.ToString();
            ksdd_y.Text       = settings.Ksdd_y.ToString();
            pf.PrintRegister(ksddtxt);

            ksxmtxt           = new CTextPrintObjSet();
            ksxmtxt.Printtext = "¿¼ÉúÐÕÃû";
            ksxmtxt.mmX       = settings.Ksxm_x;
            ksxmtxt.mmY       = settings.Ksxm_y;
            ksxm_x.Text       = settings.Ksxm_x.ToString();
            ksxm_y.Text       = settings.Ksxm_y.ToString();
            pf.PrintRegister(ksxmtxt);

            kscjtxt           = new CTextPrintObjSet();
            kscjtxt.Printtext = "¿¼ÊԳɼ¨";
            kscjtxt.mmX       = settings.Kscj_x;
            kscjtxt.mmY       = settings.Kscj_y;
            kscj_x.Text       = settings.Kscj_x.ToString();
            kscj_y.Text       = settings.Kscj_y.ToString();
            pf.PrintRegister(kscjtxt);

            ksrqtxt           = new CTextPrintObjSet();
            ksrqtxt.Printtext = "¿¼ÊÔÈÕÆÚ";
            ksrqtxt.mmX       = settings.Ksrq_x;
            ksrqtxt.mmY       = settings.Ksrq_y;
            ksrq_x.Text       = settings.Ksrq_x.ToString();
            ksrq_y.Text       = settings.Ksrq_y.ToString();
            pf.PrintRegister(ksrqtxt);

            ksyxmtxt           = new CTextPrintObjSet();
            ksyxmtxt.Printtext = "¿¼ÊÔÔ±ÐÕÃû";
            ksyxmtxt.mmX       = settings.Ksyxm_x;
            ksyxmtxt.mmY       = settings.Ksyxm_y;
            ksyxm_x.Text       = settings.Ksyxm_x.ToString();
            ksyxm_y.Text       = settings.Ksyxm_y.ToString();
            pf.PrintRegister(ksyxmtxt);

            tiaomaimg         = new CImagePrintObjSet();
            tiaomaimg.InImage = Code128Rendering.MakeBarcodeImage("²âÊÔÔ±100", 1, true);
            tiaomaimg.mmX     = settings.Tiaomaimg_x;
            tiaomaimg.mmY     = settings.Tiaomaimg_y;
            pf.PrintRegister(tiaomaimg);
        }
        public ActionResult getR12065_Report(string patno)
        {
            // string siteCode = Session["T_SITE_CODE"].ToString();
            DataTable dt = repository.getR12065_Report(patno);


            dt.TableName = "R12065";
            //dt_1.TableName = "R12302_xmatchHistory";
            //T12302_Site_.TableName = "R12302_Site";

            // DataSet ds = new DataSet();
            // ds.Tables.Add(dt);
            // ds.Tables.Add(dt_1);
            //ds.Tables.Add(T12302_Site_);
            //foreach (DataTable V in dt.Rows)
            //{

            //}
            //----------- for barcode start-----------------
            dt.Columns.Add("Pat_BarCode", typeof(Bitmap));
            Image myimg = Code128Rendering.MakeBarcodeImage(dt.Rows[0]["T_UNIT_NO"].ToString(), int.Parse("2"), true);

            dt.Rows[0]["Pat_BarCode"] = myimg;
            //----------- for barcode end-----------------


            //dt.WriteXmlSchema(Server.MapPath("~/Report/xml/R12065.xml"));
            // return View();
            using (var Report = new FastReport.Report())
            {
                Report.Report.Load(Server.MapPath("~/Report/Report/R12065.frx"));
                System.Data.DataSet dataSet = new System.Data.DataSet();
                Report.Report.RegisterData(dt, "R12065");

                //Report.Report.RegisterData(dt_1, "R12302_xmatchHistory");
                // Report.Report.RegisterData(T12302_Site_, "R12302_Site");
                Report.Report.Prepare();
                using (var strm = new MemoryStream())
                {
                    var pdfExport = new PDFExport();
                    Report.Export(pdfExport, strm);
                    Response.ClearContent();
                    Response.ClearHeaders();
                    Response.Buffer      = true;
                    Response.ContentType = "Application/PDF";
                    Response.BinaryWrite(strm.ToArray());
                    Response.End();
                }
                ViewBag.WebReport = Report;
            }

            return(View());
        }
Beispiel #17
0
 private void kietnm()
 {
     try
     {
         Image myimg = Code128Rendering.MakeBarcodeImage("kietm", 2, true);
         pictBarcode.Image = myimg;
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message, this.Text);
     }
 }
Beispiel #18
0
        private void InitializePrintFormComponent(PrintSettings settings)
        {
            pf = new Print_form(Convert.ToInt16(210 * 4), Convert.ToInt16(297 * 4));

            ksddtxt           = new CTextPrintObjSet();
            ksddtxt.Printtext = "¿¼ÊԵصã";
            ksddtxt.mmX       = settings.Ksdd_x;
            ksddtxt.mmY       = settings.Ksdd_y;
            pf.PrintRegister(ksddtxt);

            ksxmtxt           = new CTextPrintObjSet();
            ksxmtxt.Printtext = "¿¼ÉúÐÕÃû";
            ksxmtxt.mmX       = settings.Ksxm_x;
            ksxmtxt.mmY       = settings.Ksxm_y;
            pf.PrintRegister(ksxmtxt);

            kscjtxt           = new CTextPrintObjSet();
            kscjtxt.Printtext = "¿¼ÊԳɼ¨";
            kscjtxt.mmX       = settings.Kscj_x;
            kscjtxt.mmY       = settings.Kscj_y;
            pf.PrintRegister(kscjtxt);

            kscxtxt           = new CTextPrintObjSet();
            kscxtxt.Printtext = "¿¼ÊÔ³µÐÍ";
            kscxtxt.mmX       = settings.Kscx_x;
            kscxtxt.mmY       = settings.Kscx_y;
            pf.PrintRegister(kscxtxt);


            ksrqtxt           = new CTextPrintObjSet();
            ksrqtxt.Printtext = "¿¼ÊÔÈÕÆÚ";
            ksrqtxt.mmX       = settings.Ksrq_x;
            ksrqtxt.mmY       = settings.Ksrq_y;
            pf.PrintRegister(ksrqtxt);

            ksyxmtxt           = new CTextPrintObjSet();
            ksyxmtxt.Printtext = "¿¼ÊÔÔ±ÐÕÃû";
            ksyxmtxt.mmX       = settings.Ksyxm_x;
            ksyxmtxt.mmY       = settings.Ksyxm_y;
            pf.PrintRegister(ksyxmtxt);

            tiaomaimg         = new CImagePrintObjSet();
            tiaomaimg.InImage = Code128Rendering.MakeBarcodeImage("²âÊÔÔ±100", 1, true);
            tiaomaimg.mmX     = settings.Tiaomaimg_x;
            tiaomaimg.mmY     = settings.Tiaomaimg_y;
            pf.PrintRegister(tiaomaimg);

            traceimg         = new CImagePrintObjSet();
            traceimg.InImage = new Bitmap("Imgs\\SampleTrace.bmp");
            traceimg.mmX     = settings.TraceImg_X;
            traceimg.mmY     = settings.TraceImg_Y;
            pf.PrintRegister(traceimg);
        }
Beispiel #19
0
		public ActionResult Code128 (string id)
		{
			var ms = new MemoryStream (4 * 1024);
			var img = Code128Rendering.MakeBarcodeImage (id, 2, false);

			img.Save (ms, ImageFormat.Png);
			ms.Seek (0, SeekOrigin.Begin);
			var result = new FileStreamResult (ms, "image/png");
			result.FileDownloadName = string.Format ("{0}.png", id);

			return result;
		}
 private void cmdMakeBarcode_Click(object sender, System.EventArgs e)
 {
     try
     {
         Image myimg = Code128Rendering.MakeBarcodeImage(txtInput.Text, int.Parse(txtWeight.Text), true);
         pictBarcode.Image = myimg;
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message, this.Text);
     }
 }
        private string CrearImagenCB(string secuencia)
        {
            // Creo la imagen del código de barras para luego utilizarla en el control de impresión
            // TODO: Configurar la ruta en el web.config
            System.Drawing.Image myimg = Code128Rendering.MakeBarcodeImage(secuencia, 2, true, 12);
            string nombreArchivo       = secuencia + ".jpg";
            //string ruta = "C:\\Andesmar\\SisPackTest\\SISPACK\\CB\\";
            string ruta = Server.MapPath("CB") + "\\";

            myimg.Save(ruta + nombreArchivo, System.Drawing.Imaging.ImageFormat.Jpeg);
            nombreArchivo = "~/CB/" + nombreArchivo;
            return(nombreArchivo);
        }
Beispiel #22
0
        private string CrearImagenCB(int NroBulto)
        {
            // Creo las imagenes del código de barras para luego utilizarla en el control de impresión
            string nroGuiaCB = Utiles.Formatos.Tipo2Numero(tipoGuia) + nroSucursal + nroGuia.ToString("000000") + NroBulto.ToString("000");

            System.Drawing.Image myimg  = Code128Rendering.MakeBarcodeImage(nroGuiaCB, 1, true, 14);
            System.Drawing.Image myimg2 = Code128Rendering.MakeBarcodeImageHoriz(nroGuiaCB, 1, true);
            string nombreArchivo        = nroGuiaCB + ".jpg";
            string ruta = Server.MapPath("CB") + "\\";

            myimg.Save(ruta + nombreArchivo, System.Drawing.Imaging.ImageFormat.Jpeg);
            myimg2.Save(ruta + "NAC" + nombreArchivo, System.Drawing.Imaging.ImageFormat.Jpeg);
            return(nombreArchivo);
        }
        private string CrearImagenCB(string tipoGuia, string nroSucursal, string nroGuia)
        {
            // Creo la imagen del código de barras para luego utilizarla en el control de impresión
            // TODO: Configurar la ruta en el web.config
            string nroGuiaCB = Utiles.Formatos.Tipo2Numero(tipoGuia) + Utiles.Formatos.CerosIzq(Utiles.Validaciones.obtieneEntero(nroSucursal), 4) + Utiles.Formatos.CerosIzq(Convert.ToInt32(nroGuia), 5);

            System.Drawing.Image myimg = Code128Rendering.MakeBarcodeImage(nroGuiaCB, 2, true, 14);
            string nombreArchivo       = nroGuiaCB + ".jpg";
            //string ruta = "C:\\Andesmar\\SisPackTest\\SISPACK\\CB\\";
            string ruta = Server.MapPath("CB") + "\\";

            myimg.Save(ruta + nombreArchivo, System.Drawing.Imaging.ImageFormat.Jpeg);

            return(nombreArchivo);
        }
Beispiel #24
0
        public void PrintSale(Sale sale, string invoice_number)
        {
            try
            {
                Image myimg = Code128Rendering.MakeBarcodeImage(invoice_number, 2, true);
                myimg.Save(mAccountant.GetFullPath("Images/barcode_sale.png"));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            Accounting.Report.Sales.SalePrintPresenter report_presenter = new Accounting.Report.Sales.SalePrintPresenter(mAccountant, sale);
            mSalePresenter.PrintSale(report_presenter);
        }
Beispiel #25
0
        internal void PrintPurchase(Purchase purchase, string purchase_number)
        {
            try
            {
                Image myimg = Code128Rendering.MakeBarcodeImage(purchase_number, 2, true);
                myimg.Save(mAccountant.GetFullPath("Images/barcode_purchase.png"));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            Accounting.Report.Purchases.PurchasePrintPresenter report_presenter = new Accounting.Report.Purchases.PurchasePrintPresenter(mAccountant, purchase);
            mPurchasePresenter.PrintPurchase(report_presenter);
        }
Beispiel #26
0
        private string CrearImagenCB(string nroGuiaCB)
        {
            // Creo la imagen del código de barras para luego utilizarla en el control de impresión
            System.Drawing.Image myimg = Code128Rendering.MakeBarcodeImage(nroGuiaCB, 2, true, 12);
            string nombreArchivo       = nroGuiaCB + ".jpg";
            string ruta = Server.MapPath("CB") + "\\";

            // Reviso si existe el archivo a crear
            if (new System.IO.FileInfo(ruta + nombreArchivo).Exists == false)
            {
                // El archivo no existe, lo creo
                myimg.Save(ruta + nombreArchivo, System.Drawing.Imaging.ImageFormat.Jpeg);
            }
            return("~/CB/" + nombreArchivo);
        }
        public ActionResult GetReport(string patid, string epsort)
        {
            var dtT12204 = repository.GetReport(patid, epsort);

            dtT12204.TableName = "T12204";

            dtT12204.Columns.Add("Pat_BarCode", typeof(Bitmap));
            Image myimg = Code128Rendering.MakeBarcodeImage(dtT12204.Rows[0]["T_BAG_BARCODE"].ToString(), int.Parse("2"), true);

            dtT12204.Rows[0]["Pat_BarCode"] = myimg;
            // dtT12204.Columns.Add("Time", typeof(string));
            //dtT12204.Rows[0]["Time"] = Session["Hou_Min"].ToString();
            // dtT12204.WriteXmlSchema(Server.MapPath("~/Report/xml/T12204.xml"));
            // return View();
            using (var webReport = new FastReport.Report())
            {
                webReport.Report.Load(Server.MapPath("~/Report/Report/R12204.frx"));
                System.Data.DataSet dataSet = new System.Data.DataSet();
                webReport.Report.RegisterData(dtT12204, "T12204");
                webReport.Report.Prepare();
                using (var Report = new MemoryStream())
                {
                    // var excelExport = new Excel2007Export();
                    // webReport.Report.Export(excelExport, strm);
                    // var pdfExport = new PDFExport();
                    // webReport.Report.Export(pdfExport, strm);
                    // Response.ClearContent();
                    // Response.ClearHeaders();
                    // Response.Buffer = true;
                    //// Response.ContentType = "Application/vnd.ms-excel";
                    //  Response.ContentType = "Application/PDF";
                    // Response.BinaryWrite(strm.ToArray());
                    // Response.End();
                    var pdfExport = new PDFExport();
                    webReport.Export(pdfExport, Report);
                    Response.ClearContent();
                    Response.ClearHeaders();
                    Response.Buffer      = true;
                    Response.ContentType = "Application/PDF";
                    Response.BinaryWrite(Report.ToArray());
                    Response.End();
                }
                ViewBag.WebReport = webReport;
            }

            return(View());
        }
        private string CrearImagenCB(string nroGuiaCB)
        {
            // Creo la imagen del código de barras para luego utilizarla en el control de impresión
            // TODO: Configurar la ruta en el web.config
            //string nroGuiaCB = "1" + Utiles.Formatos.CerosIzq(Convert.ToInt32(nroObservacion), 5);
            System.Drawing.Image myimg = Code128Rendering.MakeBarcodeImage(nroGuiaCB, 2, true, 12);
            string nombreArchivo       = nroGuiaCB + ".jpg";
            string ruta = Server.MapPath("CB") + "\\";

            // Reviso si existe el archivo a crear
            if (new System.IO.FileInfo(ruta + nombreArchivo).Exists == false)
            {
                // El archivo no existe, lo creo
                myimg.Save(ruta + nombreArchivo, System.Drawing.Imaging.ImageFormat.Jpeg);
            }
            return("~/CB/" + nombreArchivo);
        }
Beispiel #29
0
    void fillform()
    {
        try
        {
            gv.conn.Open();
            gv.ds  = new DataSet();
            gv.sql = "select item.itemname as [Item Name],item.barcode as [Bar Code], " +
                     "item.saleac, item.purchaseac, " +
                     "item.purchaseprice, item.saleprice, " +
                     "item.mrp, spacc.taxrate, " +
                     "spacc.surchargerate, spacc.head as [Sale AC], " +
                     "spacc_1.head as [Purchase AC] " +
                     "FROM spacc INNER JOIN (spacc AS spacc_1 INNER JOIN item ON spacc_1.id = item.purchaseac) ON spacc.id = item.saleac " +
                     "where item.id =" + num;
            Debug.WriteLine(gv.sql);
            gv.adap = new OleDbDataAdapter(gv.sql, gv.conn);
            gv.adap.Fill(gv.ds, "item");

            tb1.Text = "";
            tb2.Text = "";
            if (gv.ds.Tables[0].Rows.Count > 0)
            {
                tb1.Text = gv.ds.Tables[0].Rows[0]["Item Name"].ToString();
                tb2.Text = gv.ds.Tables[0].Rows[0]["Bar Code"].ToString();
                //pcb.Image = Code128Rendering.MakeBarcodeImage(lbl2.Text, int.Parse("2"), false);
                pcb.Image     = Code128Rendering.MakeBarcodeImage(gv.ds.Tables[0].Rows[0]["Bar Code"].ToString(), 1, false);
                saleacnum     = Convert.ToInt32(gv.ds.Tables[0].Rows[0]["saleac"]);
                lbl5.Text     = gv.ds.Tables[0].Rows[0]["Sale AC"].ToString();
                purchaseacnum = Convert.ToInt32(gv.ds.Tables[0].Rows[0]["purchaseac"]);
                lbl7.Text     = gv.ds.Tables[0].Rows[0]["Purchase AC"].ToString();
                tb3.Text      = gv.ds.Tables[0].Rows[0]["purchaseprice"].ToString();
                tb4.Text      = gv.ds.Tables[0].Rows[0]["saleprice"].ToString();
                tb5.Text      = gv.ds.Tables[0].Rows[0]["mrp"].ToString();
            }
        }
        catch (Exception ex)
        {
            Debug.WriteLine(ex.Message);
        }
        finally
        {
            gv.conn.Close();
        }
    }