/// <summary>
        /// Config the specified docket.
        /// </summary>
        /// <param name="docket">Docket.</param>
        public void Config(DeliveryDocket docket)
        {
            using (var accountNameTextView = ItemView.FindViewById <TextView>(Resource.Id.accountNameTextView))
            {
                accountNameTextView.Text = docket.ShortName;
            }

            using (var addressTextView = ItemView.FindViewById <TextView>(Resource.Id.addressTextView))
            {
                addressTextView.Text = docket.FormattedDateModified;
            }

            using (var docketNumberTextView = ItemView.FindViewById <TextView>(Resource.Id.docketNumberTextView))
            {
                docketNumberTextView.Text = docket.DocketID;
            }

            using (var printButton = ItemView.FindViewById <Button>(Resource.Id.printButton))
            {
                printButton.Click += OnPrint;
            }

            using (var statusImageView = ItemView.FindViewById <ImageView>(Resource.Id.statusImageView))
            {
                statusImageView.Visibility = docket.Synced ? ViewStates.Visible : ViewStates.Gone;
            }

            using (var unconfirmedTextView = ItemView.FindViewById <TextView>(Resource.Id.unconfirmedTextView))
            {
                unconfirmedTextView.Visibility = docket.Confirmed ? ViewStates.Gone : ViewStates.Visible;
            }
        }
        /// <summary>
        /// Bind
        /// </summary>
        void RefreshData()
        {
            // get the docket from saved instance state
            var profile = _repository.Profiles.First();

            _deliveryDocket = _repository.Find <DeliveryDocket>(profile.CurrentDocketID);

            if (_deliveryDocket == null)
            {
                throw new ArgumentNullException($"Docket {profile.CurrentDocketID} does not exist.");
            }


            _docketItems.Clear();

            var items = _repository.DeliveryDocketItems
                        .Where(x => x.DeliveryDocketID == _deliveryDocket.DocketID)
                        .OrderByDescending(x => x.OrderQuantity)
                        .ThenBy(x => x.Sequence)
                        .ToList();

            _docketItems.AddRange(items);

            _adapter.NotifyDataSetChanged();

            Activity.ActionBar.Title = _deliveryDocket.CustomerName1;
            _orderRefEditText.Text   = _deliveryDocket.OrderReference;
        }
        /// <summary>
        /// Clone Docket
        /// </summary>
        /// <returns>The docket.</returns>
        /// <param name="docket">Docket.</param>
        static DeliveryDocket CreateNewDocketVersion(Repository repository, DeliveryDocket docket)
        {
            // copy docket through serialization
            var json      = JsonConvert.SerializeObject(docket);
            var newDocket = JsonConvert.DeserializeObject <DeliveryDocket>(json);

            // set the changed properties
            newDocket.DateModified = GetLocalTime();

            // increment the docket version
            int version      = newDocket.DocketVersion + 1;
            int docketNumber = newDocket.DocketNumber;

            var docketId = CreateDocketID(version, docket.DeviceID, newDocket.DocketNumber);

            var docketExists = repository.DeliveryDockets.Any(x => x.DocketID == docketId);

            while (docketExists)
            {
                version      = version + 1;
                docketId     = CreateDocketID(version, docket.DeviceID, newDocket.DocketNumber);
                docketExists = repository.DeliveryDockets.Any(x => x.DocketID == docketId);
            }

            // create new docket id
            newDocket.DocketVersion = version;
            newDocket.DocketID      = docketId;
            newDocket.Memo          = docketId;

            var existingDocketItems = repository.DeliveryDocketItems.Where(x => x.DeliveryDocketID == docket.DocketID);

            // update docket id for delivery items
            foreach (var existingDocketItem in existingDocketItems)
            {
                json = JsonConvert.SerializeObject(existingDocketItem);
                var newDocketItem = JsonConvert.DeserializeObject <DeliveryDocketItem>(json);

                newDocketItem.Id = Guid.NewGuid().ToString();
                newDocketItem.DeliveryDocketID = docketId;

                repository.DeliveryDocketItems.Add(newDocketItem);
            }

            return(newDocket);
        }
 /// <summary>
 /// Sets the docket order reference.
 /// </summary>
 /// <param name="repository">Repository.</param>
 /// <param name="docket">Docket.</param>
 /// <param name="orderReference">Order reference.</param>
 public static void SetDocketOrderReference(Repository repository, DeliveryDocket docket, string orderReference)
 {
     docket.OrderReference = orderReference;
     repository.SaveChanges();
 }
        /// <summary>
        /// Create new docket
        /// </summary>
        /// <param name="realm">Realm.</param>
        /// <param name="runNumber">Run number.</param>
        /// <param name="call">Call.</param>
        /// <param name="subscriber">Subscriber.</param>
        public static void CreateNewDocket(Repository repository, string runNumber, Call call, Subscriber subscriber)
        {
            var device        = repository.MobileDevices.First();
            var profile       = repository.Profiles.First();
            var customer      = repository.Customers.Find(call.CustomerAccountNumber);
            var lendingStatus = customer.LendingStatus.GetValueOrDefault();

            // remove any uncommited dockets or current dockets
            var uncommittedDockets = repository.DeliveryDockets
                                     .Where(x => !x.Committed)
                                     .ToList();

            uncommittedDockets.ForEach((uncommittedDocket) =>
            {
                // remove all docket items
                var uncommittedDocketItems = repository.DeliveryDocketItems
                                             .Where(x => x.DeliveryDocketID == uncommittedDocket.DocketID)
                                             .ToList();

                repository.RemoveRange(uncommittedDocketItems);
                repository.RemoveRange(uncommittedDockets);
            });

            repository.SaveChanges();

            // get the latest docket
            var latestDocket = repository.DeliveryDockets
                               .OrderByDescending(x => x.DateModifiedDate)
                               .FirstOrDefault();

            // get the docket number either from the latest docket or device table
            var latestDeviceDocketNumber = device.DocketNumber + 1;
            var docketNumber             = latestDocket != null ? latestDocket.DocketNumber + 1 : latestDeviceDocketNumber;

            if (latestDeviceDocketNumber > docketNumber)
            {
                docketNumber = latestDeviceDocketNumber;
            }

            var docketId = CreateDocketID(1, device.Id, docketNumber);

            var docketExists = repository.DeliveryDockets.Any(x => x.DocketID == docketId);

            while (docketExists)
            {
                docketNumber = latestDocket.DocketNumber + 1;
                docketId     = CreateDocketID(1, latestDocket.DeviceID, docketNumber);
                docketExists = repository.DeliveryDockets.Any(x => x.DocketID == docketId);
            }

            // we always want the date represented in local danish time for both
            // print and saving agains the docket, as historical dates were not in UTC.
            var localTime = GetLocalTime();

            var docket = new DeliveryDocket
            {
                DateModified          = localTime,
                RunNumber             = runNumber,
                SubscriberID          = subscriber.ParentSubscriberID,
                ChildSubscriberID     = subscriber.ID,
                DriverPrintName       = subscriber.ID,
                ShortName             = call.ShortName,
                DriverID              = profile.DriverID,
                CustomerAccountNumber = call.CustomerAccountNumber,
                CompanyTypeID         = CompanyTypeId,
                DeviceIMEI            = device.DeviceID.Substring(0, 13),
                DeviceID              = device.Id,
                OrderNumber           = call.OrderNumber,
                ShowLendingStatus     = lendingStatus,
                DocketVersion         = 1,
                DocketNumber          = docketNumber,
                DocketID              = docketId,
                Memo      = docketId,
                Committed = false,
                Confirmed = false
            };



            // check that this docket id is unique
            var existing = repository.DeliveryDockets.Find(docket.DocketID);

            // docket exists - throw an exception
            if (existing != null)
            {
                throw new DocketExistsException($"DocketID {docket.DocketID} " +
                                                $"already exists and was created on {docket.FormattedDateModified}");
            }


            docket.SetCall(call);
            docket.SetSubscriber(subscriber);

            // get the products
            var products = repository.Products.ToList();

            // get the history
            var history = repository.History
                          .Where(x => x.CustomerAccountNumber == docket.CustomerAccountNumber).ToList();

            // flag any products previously ordered
            history.ForEach((record) =>
            {
                var product = products.FirstOrDefault(x => x.ProductCode == record.ProductCode);

                if (product != null)
                {
                    product.PreviouslyOrdered = true;
                }
            });

            // order the products by previously ordered & then sequence
            products = products.OrderByDescending(x => x.PreviouslyOrdered).ThenBy(x => x.Sequence).ToList();

            var orderItems = repository.OrderItems.Where(x => x.OrderNumber == call.OrderNumber);

            // add the products
            for (var i = 0; i < products.Count; i++)
            {
                var product  = products[i];
                var sequence = product.Sequence.GetValueOrDefault();

                var docketItem = new DeliveryDocketItem
                {
                    SubscriberID          = subscriber.ParentSubscriberID,
                    Description           = product.ShortDescription,
                    ProductCode           = product.ProductCode,
                    RunNumber             = docket.RunNumber,
                    Sequence              = i,
                    CustomerAccountNumber = docket.CustomerAccountNumber,
                    DeliveryDocketID      = docket.DocketID,
                    Id = Guid.NewGuid().ToString()
                };

                var orderItem = orderItems.FirstOrDefault(x => x.ProductCode == docketItem.ProductCode);

                if (orderItem != null)
                {
                    docketItem.OrderQuantity = orderItem.Quantity;
                    docketItem.OrderNumber   = orderItem.OrderNumber;
                }

                repository.DeliveryDocketItems.Add(docketItem);
            }

            repository.Add(docket);
            profile.CurrentDocketID = docket.DocketID;

            repository.SaveChanges();
        }
Exemple #6
0
        /// <summary>
        /// Gets the docket label.
        /// </summary>
        /// <returns>The docket label.</returns>
        /// <param name="docket">Docket.</param>
        /// <param name="docketItems">Docket items.</param>
        /// <param name="lendingStatuses">Lending statuses.</param>
        public static string GetDocketLabel(DeliveryDocket docket, List <DeliveryDocketItem> docketItems,
                                            List <LendingStatus> lendingStatuses)
        {
            const decimal dcItemVerticalOffset = 0.4M;
            const decimal dcSmallLineOffset    = 0.1M;
            const decimal dcLargeLineOffset    = 0.3M;
            const decimal dcFooter             = 2.4M;

            // Print Commands
            // <i>{offset}<200><200>{height}{qty}
            // <200>: Horizontal & Vertical resolution (in dots-per-inch)
            var label = new StringBuilder("! 0 200 200 #Length 1\r\n");

            label.Append("JOURNAL\r\n");   // Disable check for correct media alignment
            label.Append("SPEED 5\r\n");   // Set print speed between 0 and 5, 0 being the slowest
            label.Append("BAR-SENSE\r\n"); // Intruct printer as to means of top-of-form detection
            label.Append("ENCODING UTF-8\r\n");
            label.Append("COUNTRY DENMARK\r\n");
            label.Append("IN-CENTIMETERS\r\n");
            label.Append("CENTER\r\n");

            label.AppendFormat(LabelCulture, "T 4 0 0 0.1 {0}\r\n", "Primagaz Sverige AB");
            label.AppendFormat(LabelCulture, "T 4 0 0 0.8 {0}\r\n", "Följesedel");

            label.Append("LEFT\r\n");
            label.AppendFormat(LabelCulture, "L 0.5 1.7 10 1.7 0.05\r\n");

            // Header - Line 1
            label.AppendFormat(LabelCulture, "T 5 0 0.5 2.1 {0}:\r\n", "Dok. nr.");
            label.AppendFormat(LabelCulture, "T 5 0 2.7 2.1 {0}\r\n", docket.DocketID);
            label.AppendFormat(LabelCulture, "T 5 0 5.8 2.1 {0}:\r\n", "Avsändare");

            // Header - Line 2
            label.AppendFormat(LabelCulture, "T 5 0 0.5 2.5 {0}:\r\n", "Datum");
            label.AppendFormat(LabelCulture, "T 5 0 2.7 2.5 {0}\r\n", docket.FormattedDateModified);
            label.AppendFormat(LabelCulture, "T 5 0 5.8 2.5 {0}\r\n", docket.SubscriberDisplayName);

            // Header - Line 3
            label.AppendFormat(LabelCulture, "T 5 0 0.5 2.9 {0}:\r\n", "Tur");
            label.AppendFormat(LabelCulture, "T 5 0 2.7 2.9 {0}\r\n", docket.RunNumber);
            label.AppendFormat(LabelCulture, "T 5 0 5.8 2.9 {0}\r\n", docket.SubscriberAddress);

            // Header - Line 4
            label.AppendFormat(LabelCulture, "T 5 0 0.5 3.3 {0}:\r\n", "Order nr");
            label.AppendFormat(LabelCulture, "T 5 0 2.7 3.3 {0}\r\n", docket.OrderNumber);
            label.AppendFormat(LabelCulture, "T 5 0 5.8 3.3 {0} {1}\r\n", docket.SubscriberPostCode,
                               docket.SubscriberCity);

            // Header - Line 5
            label.AppendFormat(LabelCulture, "T 5 0 0.5 3.7 {0}:\r\n", "Kund ref");
            label.AppendFormat(LabelCulture, "T 5 0 2.7 3.7 {0}\r\n", docket.OrderReference);

            label.AppendFormat(LabelCulture, "L 0.5 4.1 10 4.1 0.05\r\n");

            label.AppendFormat(LabelCulture, "T 5 0 0.5 4.5 {0}:\r\n", "Mottagare");
            label.AppendFormat(LabelCulture, "T 5 0 2.7 4.5 {0}\r\n", docket.CustomerAccountNumber);
            label.AppendFormat(LabelCulture, "T 5 0 2.7 4.9 {0}\r\n", docket.CustomerName1);
            label.AppendFormat(LabelCulture, "T 5 0 2.7 5.3 {0}\r\n", docket.AddressLine1);
            label.AppendFormat(LabelCulture, "T 5 0 2.7 5.7 {0} {1}\r\n", docket.AddressLine2,
                               docket.AddressLine3);

            label.AppendFormat(LabelCulture, "L 0.5 6.3 10 6.3 0.05\r\n");


            // Initialise the Vertical Offset at 7.6cm
            var verticalOffset = 6.2M;


            decimal?emptiesDividerStart = null;

            var hasFullsFaulty    = docketItems.Any(x => x.FaultyFulls > 0);
            var hasFullsCollected = docketItems.Any(x => x.FullsCollected > 0);

            if (docketItems.Any())
            {
                verticalOffset = verticalOffset + dcItemVerticalOffset;
                label.AppendFormat(LabelCulture, "T 4 0 0.5 {0} {1}\r\n", verticalOffset, "Leverans detaljer");
                label.Append("CENTER 2.9\r\n");

                verticalOffset = verticalOffset + dcItemVerticalOffset;

                emptiesDividerStart = verticalOffset;

                verticalOffset = verticalOffset + dcItemVerticalOffset;
                label.Append("CENTER 4\r\n");
                label.AppendFormat(LabelCulture, "T 5 0 2.8 {0} {1}\r\n", verticalOffset, "Fulla");

                if (hasFullsFaulty)
                {
                    label.Append("CENTER 5.55\r\n");
                    label.AppendFormat(LabelCulture, "T 5 0 4.8 {0} {1}\r\n", verticalOffset, "Fulla");
                }

                if (hasFullsCollected)
                {
                    label.Append("CENTER 6.95\r\n");
                    label.AppendFormat(LabelCulture, "T 5 0 6.45 {0} {1}\r\n", verticalOffset, "Fulla");
                }

                label.Append("CENTER 8.55\r\n");
                label.AppendFormat(LabelCulture, "T 5 0 8.3 {0} {1}\r\n", verticalOffset, "Tom");

                label.Append("LEFT\r\n");
                verticalOffset = verticalOffset + dcItemVerticalOffset;
                label.AppendFormat(LabelCulture, "T 5 0 0.5 {0} {1}\r\n", verticalOffset, "Produkt");


                label.Append("CENTER 4\r\n");
                label.AppendFormat(LabelCulture, "T 5 0 2.8 {0} {1}*\r\n", verticalOffset, "lev.");

                if (hasFullsFaulty)
                {
                    label.Append("CENTER 5.5\r\n");
                    label.AppendFormat(LabelCulture, "T 5 0 4.8 {0} {1}*\r\n", verticalOffset, "defekte");
                }

                if (hasFullsCollected)
                {
                    label.Append("CENTER 6.95\r\n");
                    label.AppendFormat(LabelCulture, "T 5 0 6.45 {0} {1}*\r\n", verticalOffset, "afh.");
                }

                label.Append("CENTER 9.5\r\n");
                label.AppendFormat(LabelCulture, "T 5 0 7.8 {0} {1}\r\n", verticalOffset, "afh.");

                verticalOffset = verticalOffset + dcLargeLineOffset;
                label.Append("LEFT\r\n");
                label.AppendFormat("L 0.5 {0} 10 {0} 0.01\r\n", verticalOffset);


                verticalOffset = verticalOffset + dcSmallLineOffset;

                // 13/06/13 - Fixed: Fulls Collected not showing
                foreach (
                    var fill in
                    docketItems.Where(
                        x =>
                        x.FullsDelivered > 0 || x.EmptiesCollected > 0 || x.FullsCollected > 0 ||
                        x.FaultyFulls > 0))
                {
                    label.Append("LEFT\r\n");

                    //if (fill.DeliveryTypeID == 0)
                    //    label.AppendFormat(LabelCulture, "T 5 0 0.5 {0} {1}\r\n", dcVerticalOffset, fill.Description);
                    //else
                    label.AppendFormat(LabelCulture, "T 5 0 0.5 {0} {1} - {2}\r\n", verticalOffset, fill.ProductCode, fill.Description);

                    label.Append("CENTER 4\r\n");
                    label.AppendFormat(LabelCulture, "T 5 0 2.8 {0} {1}\r\n", verticalOffset, fill.FullsDelivered);

                    if (hasFullsFaulty)
                    {
                        label.Append("CENTER 5.5\r\n");
                        label.AppendFormat(LabelCulture, "T 5 0 4.8 {0} {1}\r\n", verticalOffset, fill.FaultyFulls);
                    }

                    if (hasFullsCollected)
                    {
                        label.Append("CENTER 6.95\r\n");
                        label.AppendFormat(LabelCulture, "T 5 0 6.45 {0} {1:G0}\r\n", verticalOffset,
                                           fill.FullsCollected);
                    }

                    label.Append("CENTER 9.5\r\n");
                    label.AppendFormat(LabelCulture, "T 5 0 7.8 {0} {1:G0}\r\n", verticalOffset,
                                       fill.EmptiesCollected);

                    // Increment the Vertical Position by the Vertical Offset
                    verticalOffset = verticalOffset + dcItemVerticalOffset;
                }

                label.AppendFormat(LabelCulture, "L 0.5 {0} 10 {0} 0.03\r\n", verticalOffset);
                verticalOffset = verticalOffset + dcItemVerticalOffset;

                // Totals
                label.Append("LEFT\r\n");
                label.AppendFormat(LabelCulture, "T 5 0 0.5 {0} {1}\r\n", verticalOffset, "Totalt");
                label.Append("CENTER 4\r\n");
                label.AppendFormat(LabelCulture, "T 5 0 2.8 {0} {1}\r\n", verticalOffset,
                                   docketItems.Sum(x => x.FullsDelivered));

                if (hasFullsFaulty)
                {
                    label.Append("CENTER 5.5\r\n");
                    label.AppendFormat(LabelCulture, "T 5 0 4.8 {0} {1}*\r\n", verticalOffset,
                                       docketItems.Sum(x => x.FaultyFulls));
                }

                if (hasFullsCollected)
                {
                    label.Append("CENTER 6.95\r\n");
                    label.AppendFormat(LabelCulture, "T 5 0 6.35 {0} {1:G0}\r\n", verticalOffset,
                                       docketItems.Sum(x => x.FullsCollected));
                }

                label.Append("CENTER 9.5\r\n");
                label.AppendFormat(LabelCulture, "T 5 0 7.8 {0} {1:G0}\r\n", verticalOffset,
                                   docketItems.Sum(x => x.EmptiesCollected));
            }

            label.Append("LEFT\r\n");

            verticalOffset = verticalOffset + dcItemVerticalOffset;
            label.AppendFormat(LabelCulture, "L 0.5 {0} 10 {0} 0.03\r\n", verticalOffset);

            label.AppendFormat(LabelCulture, "L 7.8 {0} 7.8 {1} 0.03\r\n", emptiesDividerStart, verticalOffset);

            verticalOffset = verticalOffset + (dcItemVerticalOffset);

            label.Append("LEFT\r\n");
            label.AppendFormat(LabelCulture, "T 5 0 0.5 {0} {1}\r\n", verticalOffset, "* UN 1965 Kolvätegasblandning, kondenserad N. O. S. (Blandning C), 2.1 (B/D)");
            verticalOffset = verticalOffset + dcItemVerticalOffset;

            label.AppendFormat(LabelCulture, "T 5 0 0.5 {0} {1}\r\n", verticalOffset, "* Gasflasker");

            verticalOffset = verticalOffset + (dcItemVerticalOffset * 2);
            label.Append("LEFT\r\n");

            if (docket.SignaturePath != null)
            {
                label.AppendFormat(LabelCulture, "T 5 0 0.5 {0} {1}\r\n", verticalOffset, "Mottagarens underskrift");
                label.AppendFormat(LabelCulture, "T 5 0 4.8 {0} {1}\r\n", verticalOffset, "Chaufförens ID");

                verticalOffset = verticalOffset + dcItemVerticalOffset;
                label.AppendFormat(LabelCulture, "T 5 0 0.5 {0} {1}\r\n", verticalOffset, docket.CustomerPrintName);
                label.AppendFormat(LabelCulture, "T 5 0 4.8 {0} {1}\r\n", verticalOffset, docket.DriverPrintName);

                //int iY;

                // PCX 100 134 !<nameFile.pcx\r\n
                verticalOffset = verticalOffset + dcItemVerticalOffset;
                label.AppendFormat(LabelCulture, "PCX 2 {0} !<SIG.pcx\r\n", verticalOffset);
                verticalOffset = verticalOffset + 2.0M;
            }

            if (lendingStatuses.Any() && docket.ShowLendingStatus)
            {
                verticalOffset = verticalOffset + 1.0M;
                label.Append("LEFT\r\n");
                label.AppendFormat(LabelCulture, "L 0.5 {0} 10 {0} 0.03\r\n", verticalOffset);

                verticalOffset = verticalOffset + dcItemVerticalOffset;
                label.AppendFormat(LabelCulture, "T 5 0 0.5 {0} {1}\r\n", verticalOffset, "Före denna leverans är lånebalansen:");

                verticalOffset = verticalOffset + 0.2M;
                verticalOffset = verticalOffset + (dcItemVerticalOffset * 2);

                //dcVerticalOffset = dcVerticalOffset + (dcItemVerticalOffset * 2);
                label.AppendFormat(LabelCulture, "T 5 0 0.5 {0} {1}\r\n", verticalOffset, "Flaska");
                label.Append("RIGHT 4\r\n");
                label.AppendFormat(LabelCulture, "T 5 0 2.3 {0} {1}\r\n", verticalOffset, "Stk");

                verticalOffset = verticalOffset + dcLargeLineOffset;
                label.Append("LEFT\r\n");
                label.AppendFormat(LabelCulture, "L 0.5 {0} 5 {0} 0.03\r\n", verticalOffset);
                verticalOffset = verticalOffset + dcSmallLineOffset;

                foreach (var status in lendingStatuses.Where(x => x.Quantity != 0))
                {
                    label.Append("LEFT\r\n");
                    label.AppendFormat(LabelCulture, "T 5 0 0.5 {0} {1}\r\n", verticalOffset,
                                       status.ProductCode);
                    label.Append("RIGHT 4\r\n");
                    label.AppendFormat(LabelCulture, "T 5 0 2.3 {0} {1}\r\n", verticalOffset, status.Quantity);

                    // Increment the Vertical Position by the Vertical Offset
                    verticalOffset = verticalOffset + dcItemVerticalOffset;
                }

                label.Append("LEFT\r\n");
                verticalOffset = verticalOffset + dcSmallLineOffset;
                label.AppendFormat(LabelCulture, "L 0.5 {0} 5 {0} 0.03\r\n", verticalOffset);

                verticalOffset = verticalOffset + dcLargeLineOffset;
                label.AppendFormat(LabelCulture, "T 5 0 0.5 {0} {1}\r\n", verticalOffset, "Totalt");

                label.Append("RIGHT 4\r\n");
                label.AppendFormat(LabelCulture, "T 5 0 2.3 {0} {1}\r\n", verticalOffset,
                                   lendingStatuses.Sum(x => x.Quantity));

                label.Append("LEFT\r\n");
                verticalOffset = verticalOffset + dcLargeLineOffset;
                label.AppendFormat(LabelCulture, "L 0.5 {0} 5 {0} 0.03\r\n", verticalOffset);

                verticalOffset = verticalOffset + dcItemVerticalOffset;
                label.AppendFormat(LabelCulture, "T 5 0.5 0.5 {0} {1}\r\n", verticalOffset,
                                   "Kontakta oss inom 1 vecka [email protected],");

                verticalOffset = verticalOffset + dcItemVerticalOffset;
                label.AppendFormat(LabelCulture, "T 5 0.5 0.5 {0} {1}\r\n", verticalOffset,
                                   "om låneportföljen inte röstar");

                verticalOffset = verticalOffset + dcItemVerticalOffset;
                label.AppendFormat(LabelCulture, "T 5 0.5 0.5 {0} {1}\r\n", verticalOffset,
                                   "I annat fall anses lånebalansen vara tillämplig.");

                verticalOffset = verticalOffset + dcItemVerticalOffset;

                if (docket.Confirmed)
                {
                    label.AppendFormat(LabelCulture, "T 5 0 4.3 {0} *** {1} ***\r\n", verticalOffset,
                                       "Confirmed");
                }

                verticalOffset = verticalOffset + (dcItemVerticalOffset * 4);
            }
            else
            {
                // Print Confirmed Message
                if (docket.Confirmed)
                {
                    // Add the Footer
                    verticalOffset = verticalOffset + dcFooter;
                    label.AppendFormat(LabelCulture, "T 5 0 4.3 {0} *** {1} ***\r\n", verticalOffset,
                                       "Confirmed");

                    // Triple Space
                    verticalOffset = verticalOffset + (dcItemVerticalOffset * 4);
                }
                else
                {
                    // Add the Footer
                    verticalOffset = verticalOffset + dcFooter;
                }
            }

            label.Replace("#Length", (verticalOffset * 80).ToString(CultureInfo.InvariantCulture));
            label.Append("PRINT\r\n");

            return(label.ToString());
        }