private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            //Box Information
            String BoxNumber = Global.BoxNumberScanned;

            EBoxNumber = Global.BoxNumberScanned;

            //Package Information
            String ShippingNumber = Global.ShippingNumber;

            //Shipping information
            cstShippingTbl           shippingTbl     = Global.controller.GetShippingTbl(ShippingNumber);
            List <cstPackageDetails> _packingDetails = Global.controller.GetPackingDetailTbl(BoxNumber);

            model_Shipment _shipment = Global.controller.getModelShipment(ShippingNumber);

            string upccode = Global.controller.SKUnameToUPCCode(_packingDetails[Global.counter].SKUNumber);

            //String UPC_Code = _shipment.ShipmentDetailSage.SingleOrDefault(i => i.SKU == item.UPCCode).UPCCode;
            txtaddress.Text  = shippingTbl.ToAddressLine1 + shippingTbl.ToAddressLine2 + shippingTbl.ToAddressLine3 + shippingTbl.ToAddressCity + shippingTbl.ToAddressState + shippingTbl.ToAddressCountry + shippingTbl.ToAddressZipCode;
            txtponumber.Text = shippingTbl.CustomerPO;
            //  txtvendorname.Text = shippingTbl.VendorName;
            txtWH.Text         = Global.WH;
            txtupc.Text        = upccode;
            txtQty.Text        = _packingDetails[Global.counter].SKUQuantity.ToString();
            txtPartNumber.Text = _packingDetails[Global.counter].SKUNumber.ToString();
            txtCarton.Text     = GetCarton(BoxNumber);
            txtBoxNumber.Text  = GetBox(BoxNumber);
            UPCA upca = new UPCA();

            if (this.txtupc.Text.Length == 12)
            {
                this.txtupc.Text = this.txtupc.Text.Substring(0, 11) + upca.GetCheckSum(this.txtupc.Text).ToString();
                System.Drawing.Image img;
                img = upca.CreateBarCode(this.txtupc.Text, 3);

                var imges = new System.Drawing.Bitmap(img);

                var newimag = Imaging.CreateBitmapSourceFromHBitmap(imges.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());


                image.Source = newimag;
            }
            else
            {
                this.image.Source = null;
            }
        }
        private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            BarcodeLib.Barcode b = new BarcodeLib.Barcode();

            _lsInfoSlip = clGlobal.lsSlipInfo;

            string   SRnumber      = _lsInfoSlip[0].SRNumber;
            string   SKUName       = _lsInfoSlip[0].ProductName;
            string   productname   = _lsInfoSlip[0].EANCode;
            DateTime ReceivedDate  = _lsInfoSlip[0].ReceivedDate;
            DateTime Expiration    = _lsInfoSlip[0].Expiration;
            string   UserName      = _lsInfoSlip[0].ReceivedBY;
            string   RMAStatusReal = "N/A";
            String   RMAStatus     = _lsInfoSlip[0].RMAStatus;

            //if (Views.clGlobal.ScenarioType == "HomeDepot")
            //{
            if (RMAStatus == "0")
            {
                RMAStatusReal = "Incomplete";
            }
            else if (RMAStatus == "1")
            {
                RMAStatusReal = "Complete";     //"Rejected";
            }
            else if (RMAStatus == "2")
            {
                RMAStatusReal = "Wrong RMA";    //"Rejected";
            }
            //}
            //if (Views.clGlobal.ScenarioType == "Lowes")
            //{
            //    RMAStatusReal = "Accepted";
            //}
            //if (Views.clGlobal.ScenarioType == "Others")
            //{
            //    if (Views.clGlobal.Warranty == "1")
            //    {
            //        RMAStatusReal = "Accepted";
            //    }
            //    else if (Views.clGlobal.Warranty == "0")
            //    {
            //        RMAStatusReal = "N/A"; //"Rejected";
            //    }
            //}


            string ItemStatus = _lsInfoSlip[0].ItemStatus;

            string Reason = "N/A";

            if (_lsInfoSlip[0].Reason != "")
            {
                Reason = _lsInfoSlip[0].Reason;
            }

            var sBoxNumber = b.Encode(BarcodeLib.TYPE.CODE128, SRnumber, System.Drawing.Color.Black, System.Drawing.Color.Transparent, 1500, 550);

            // var sproductname = b.Encode(BarcodeLib.TYPE.UPCA, productname, System.Drawing.Color.Black, System.Drawing.Color.Transparent, 2000, 500);
            txtTextToAdd.Text = _lsInfoSlip[0].EANCode;
            if (_lsInfoSlip[0].EANCode == "" || _lsInfoSlip[0].EANCode == "N/A")
            {
                txtTextToAdd.Text = "000000000000";
                SKUName           = "*[UPC Code Not Found] " + SKUName;
            }



            UPCA upca = new UPCA();

            if (this.txtTextToAdd.Text.Length == 12)
            {
                this.txtTextToAdd.Text = this.txtTextToAdd.Text.Substring(0, 11) + upca.GetCheckSum(this.txtTextToAdd.Text).ToString();
                System.Drawing.Image img;
                img = upca.CreateBarCode(this.txtTextToAdd.Text, 3);

                //this.image.Left = System.Convert.ToInt32((this.image.Width / 2) - (img.Width / 2));

                var imges = new System.Drawing.Bitmap(img);

                var newimag = Imaging.CreateBitmapSourceFromHBitmap(imges.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());


                image.Source = newimag;

                //this.pctBarCode.Image = img;
                this.txtTextToAdd.SelectAll();
            }
            else
            {
                this.image.Source = null;
            }

            var bitmapBox = new System.Drawing.Bitmap(sBoxNumber);
            //   var pbitmapBox = new System.Drawing.Bitmap(sproductname);

            var bBoxSource = Imaging.CreateBitmapSourceFromHBitmap(bitmapBox.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());

            // var pproduct = Imaging.CreateBitmapSourceFromHBitmap(pbitmapBox.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());

            bitmapBox.Dispose();

            imageBarcode.Source = bBoxSource;
            //  image.Source = pproduct;

            txtExpiration.Text   = Expiration.ToString("MMM dd, yyyy");
            txtReceivedDate.Text = ReceivedDate.ToString("MMM dd, yyyy");
            txtReceived.Text     = UserName;
            txtReason.Text       = Reason;
            txtSRNumber.Text     = SRnumber;
            txtproductName.Text  = SKUName;
            txtRMAStatus.Text    = RMAStatusReal;
            txtItemStatus.Text   = ItemStatus;

            // txtEANcode.Text = _lsInfoSlip[0].EANCode;
        }