private void PopulateCartonData()
        {
            List <PackingListBO> lstPackingLists = GetPolyBagData();

            if (lstPackingLists.Any())
            {
                OrderDetailBO objOrderDetail = new OrderDetailBO();
                objOrderDetail.ID = lstPackingLists[0].OrderDetail;
                objOrderDetail.GetObject();

                /* OrderBO objOrder = new OrderBO();
                 * objOrder.ID = objOrderDetail.Order;
                 * objOrder.GetObject();
                 *
                 * DistributorClientAddressBO objAddress = new DistributorClientAddressBO();
                 * objAddress.ID = (int)objOrder.DespatchToExistingClient;
                 * objAddress.GetObject();*/

                InvoiceOrderBO objInvoiceOrder = new InvoiceOrderBO();
                objInvoiceOrder.OrderDetail = objOrderDetail.ID;

                //string state = (string.IsNullOrEmpty(objAddress.State)) ? string.Empty : objAddress.State;

                this.litAddress.Text = objInvoiceOrder.SearchObjects().Select(o => o.objInvoice.InvoiceNo).SingleOrDefault();

                this.dvScanCarton.Attributes.Add("style", "display:block;");
                this.dvScanPolyBag.Attributes.Add("style", "display:none;");

                this.dvDataContent.Attributes.Add("style", "display:block;");
                this.h3Carton.Attributes.Add("class", "text-info");

                rptCarton.DataSource = lstPackingLists;
                rptCarton.DataBind();

                if ((isCompleted == true) && (noRecords == lstPackingLists.Count))
                {
                    // when carton completed
                    this.h3PolyBags.Attributes.Add("class", "text-success");
                    this.litPolyBags.Text = "Filling Carton is completed. There are <span class=\"badge badge-success\">" + noPolybags.ToString() + "</span> polybags in the Carton.";
                }
            }
            else
            {
                this.dvScanCarton.Attributes.Add("style", "display:none;");
                this.dvScanPolyBag.Attributes.Add("style", "display:block;");
                this.h3PolyBags.Attributes.Add("class", "text-error");
                this.litPolyBags.Text = "Scanned polybag details can not find in the System.";
            }
        }
Exemple #2
0
        private void GenerateLabels(List <PackingList> lstPackingList, int shipto, string shipmentmode)
        {
            string imageLocation = IndicoConfiguration.AppConfiguration.PathToDataFolder + "\\Barcode\\" + Guid.NewGuid() + "\\";

            Directory.CreateDirectory(imageLocation);
            string tempPath = imageLocation + "temp.jpg";

            foreach (PackingList obj in lstPackingList)
            {
                Bitmap lblBM = new Bitmap(400, 275);
                using (Graphics gfx = Graphics.FromImage(lblBM))
                    using (SolidBrush brush = new SolidBrush(Color.White))
                    {
                        gfx.FillRectangle(brush, 0, 0, 400, 275);
                    }
                lblBM.Save(tempPath);

                string labelText = string.Empty;
                string qty       = string.Empty;
                List <KeyValuePair <int, string> > listOrderDetails = new List <KeyValuePair <int, string> >();

                foreach (PackingListViewBO objPackingList in obj.ListPackingList)
                {
                    qty = string.Empty;
                    listOrderDetails.Add(new KeyValuePair <int, string>(objPackingList.PackingList.Value, objPackingList.OrderNumber.Value.ToString()));
                    listOrderDetails.Add(new KeyValuePair <int, string>(objPackingList.PackingList.Value, objPackingList.Client));
                    listOrderDetails.Add(new KeyValuePair <int, string>(objPackingList.PackingList.Value, objPackingList.VLName));

                    PackingListSizeQtyBO objSizeQty = new PackingListSizeQtyBO();
                    objSizeQty.PackingList = objPackingList.PackingList.Value;

                    foreach (PackingListSizeQtyBO objPackSize in objSizeQty.SearchObjects())
                    {
                        string delimeter = string.IsNullOrEmpty(qty) ? string.Empty : ", ";
                        qty = qty + delimeter + objPackSize.objSize.SizeName + "/" + objPackSize.Qty;
                    }

                    listOrderDetails.Add(new KeyValuePair <int, string>(objPackingList.PackingList.Value, qty));
                }

                labelText = obj.CartonNo + "-" + obj.ListPackingList[0].WeeklyProductionCapacity.ToString();

                /* DistributorClientAddressBO objDistributorClientAddress = new DistributorClientAddressBO();
                 * objDistributorClientAddress.ID = shipto;
                 * objDistributorClientAddress.GetObject();*/

                InvoiceOrderBO objInvoiceOrder = new InvoiceOrderBO();
                objInvoiceOrder.OrderDetail = (int)obj.ListPackingList[0].OrderDetail;

                string invoiceno = objInvoiceOrder.SearchObjects().Select(o => o.objInvoice.InvoiceNo).SingleOrDefault();


                GenerateBarcode.GenerateCartonLabel(lblBM, obj.CartonNo.ToString(), listOrderDetails, labelText, imageLocation, invoiceno /* objDistributorClientAddress, shipmentmode*/);

                lblBM.Dispose();
                File.Delete(tempPath);
            }

            // string excelFileName = "CartonLabels" + ".xlsx";

            // CreateExcelDocument excell_app = new CreateExcelDocument(imageLocation, excelFileName, 400, 255, 255, true); //(imageLocation, excelFileName, 400, 275, 275, true); NNM
            string pdfpath = GenerateOdsPdf.PrintCartonBarcode(imageLocation);

            foreach (string imagePath in Directory.GetFiles(imageLocation, "*.jpg"))
            {
                File.Delete(imagePath);
            }

            //this.DownloadExcelFile(imageLocation + excelFileName);//NNM
            if (File.Exists(pdfpath))
            {
                this.DownloadPDFFile(pdfpath);
            }
        }
Exemple #3
0
        protected void rptPackingList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            RepeaterItem item = e.Item;

            if (item.ItemIndex > -1 && item.DataItem is PackingList)
            {
                PackingList objPacking = (PackingList)item.DataItem;

                Literal     litCartonNo           = (Literal)item.FindControl("litCartonNo");
                HiddenField hdnPackingListID      = (HiddenField)item.FindControl("hdnPackingListID");
                LinkButton  btnStartPackingCarton = (LinkButton)item.FindControl("btnStartPackingCarton");
                LinkButton  btnAutoFill           = (LinkButton)item.FindControl("btnAutoFill");
                Literal     litTotal        = (Literal)item.FindControl("litTotal");
                HiddenField hdnCartonNo     = (HiddenField)item.FindControl("hdnCartonNo");
                HiddenField hdnShipTo       = (HiddenField)item.FindControl("hdnShipTo");
                HiddenField hdnShipmentMode = (HiddenField)item.FindControl("hdnShipmentMode");
                HiddenField hdnWeeklyID     = (HiddenField)item.FindControl("hdnWeeklyID");
                LinkButton  btnPrintLabel   = (LinkButton)item.FindControl("btnPrintLabel");


                litCartonNo.Text  = "Carton #" + objPacking.CartonNo.ToString();
                hdnCartonNo.Value = objPacking.CartonNo.ToString();

                hdnShipTo.Value       = objPacking.ListPackingList[0].ShipTo.ToString();
                hdnShipmentMode.Value = objPacking.ListPackingList[0].ShipmentMode.ToString();
                hdnWeeklyID.Value     = objPacking.ListPackingList[0].WeeklyProductionCapacity.ToString();

                InvoiceOrderBO objInvoiceOrder = new InvoiceOrderBO();
                objInvoiceOrder.OrderDetail = (int)objPacking.ListPackingList[0].OrderDetail;



                btnPrintLabel.Visible = (objInvoiceOrder.SearchObjects().Count > 0) ? true : false;

                int cartonTotal       = 0;
                int cartonFilledTotal = 0;

                foreach (var s in objPacking.ListPackingList)
                {
                    //List<PackingListSizeQtyBO> lstPackListQtys = s.PackingListSizeQtysWhereThisIsPackingList.Where(m => m.Qty > 0).ToList();
                    //cartonTotal += lstPackListQtys.Select(m => m.Qty).Sum();

                    //List<PackingListCartonItemBO> lstPackListCartonItems = s.PackingListCartonItemsWhereThisIsPackingList.Where(m => m.Count > 0).ToList();
                    //cartonFilledTotal += lstPackListCartonItems.Select(m => m.Count).Sum();

                    cartonTotal       += s.PackingTotal.Value;
                    cartonFilledTotal += s.ScannedTotal.Value;

                    hdnPackingListID.Value = s.PackingList.ToString();
                }

                grandTotal += cartonTotal;

                if (cartonFilledTotal == 0)
                {
                    //start packing
                    btnStartPackingCarton.Text = "Start Packing";
                }
                else if (cartonTotal > cartonFilledTotal)
                {
                    //resume
                    btnStartPackingCarton.Text = "Resume Packing";
                }
                else if (cartonTotal == cartonFilledTotal)
                {
                    //finished
                    btnStartPackingCarton.Visible = false;
                    btnAutoFill.Visible           = false;
                }

                litTotal.Text = "Total " + cartonTotal.ToString();

                DataGrid dgPackingList = (DataGrid)item.FindControl("dgPackingList");
                dgPackingList.DataSource = objPacking.ListPackingList;
                dgPackingList.DataBind();
            }
        }