private void BindFormElements()
        {
            //Bind the Region Lookup (Zone and Woredas will be bind after selection Region)
            lkRegion.Properties.DataSource = BLL.Region.GetAllRegions().DefaultView;
            lkRegion.EditValue = regionId;

            //Bind the Receiving units Types Lookup
            InstitutionType institutionsTypes = new InstitutionType();
            institutionsTypes.LoadAll();
            institutionsTypes.Sort = "Name ASC";
            lkType.Properties.DataSource = institutionsTypes.DefaultView;
            lkType.EditValue = ruType;

            //Bind the Ownership Type Lookup
            OwnershipType ownershipTypes = new OwnershipType();
            ownershipTypes.LoadAll();
            ownershipTypes.Sort = "Name ASC";
            lkOwnership.Properties.DataSource = ownershipTypes.DefaultView;
            lkOwnership.EditValue = OwnershipType.Constants.Public;

            //Bind the Active lookup
            lkActive.Properties.ValueMember = lkActive.Properties.DisplayMember = "Column";
            lkActive.Properties.DataSource = new string[3] { "All", "Active", "InActive" };
            lkActive.ItemIndex = 0;

            //Bind the others
            LoadZones();
            lkZone.EditValue = zoneID;

            LoadWoredas();
            lkWoreda.EditValue = woredaID;

            LoadReceivingUnits();
        }
        /// <summary>
        /// Gets the ownership type by region and number RU.
        /// </summary>
        /// <param name="WoredaID">The woreda ID.</param>
        /// <returns></returns>
        public static DataTable GetOwnershipTypeByRegionAndNumberRU(int WoredaID)
        {
            OwnershipType ownershipType = new OwnershipType();
            string query =
                HCMIS.Repository.Queries.OwnershipType.SelectGetOwnershipTypeByRegionAndNumberRU(WoredaID);

            ownershipType.LoadFromRawSql(query);
            return ownershipType.DataTable;
        }
Пример #3
0
        /// <summary>
        /// Gets the ownership type by region and number RU.
        /// </summary>
        /// <param name="WoredaID">The woreda ID.</param>
        /// <returns></returns>
        public static DataTable GetOwnershipTypeByRegionAndNumberRU(int WoredaID)
        {
            OwnershipType ownershipType = new OwnershipType();
            string        query         =
                HCMIS.Repository.Queries.OwnershipType.SelectGetOwnershipTypeByRegionAndNumberRU(WoredaID);

            ownershipType.LoadFromRawSql(query);
            return(ownershipType.DataTable);
        }
        /// <summary>
        /// Gets the ownership type by region and number RU.
        /// </summary>
        /// <param name="receivingUnitTypeID">The receiving unit type ID.</param>
        /// <param name="storeID">The store ID.</param>
        /// <param name="hasBeenIssuedTo">if set to <c>true</c> [has been issued to].</param>
        /// <returns></returns>
        public static DataTable GetOwnershipTypeByRegionAndNumberRU(int receivingUnitTypeID, int storeID, bool hasBeenIssuedTo)
        {
            OwnershipType ownershipType = new OwnershipType();
            string query = "";

            query = HCMIS.Repository.Queries.OwnershipType.SelectGetOwnershipTypeByRegionAndNumberRU(receivingUnitTypeID, storeID);

            ownershipType.LoadFromRawSql(query);
            return ownershipType.DataTable;
        }
Пример #5
0
        /// <summary>
        /// Gets the ownership type by region and number RU.
        /// </summary>
        /// <param name="receivingUnitTypeID">The receiving unit type ID.</param>
        /// <param name="storeID">The store ID.</param>
        /// <param name="hasBeenIssuedTo">if set to <c>true</c> [has been issued to].</param>
        /// <returns></returns>
        public static DataTable GetOwnershipTypeByRegionAndNumberRU(int receivingUnitTypeID, int storeID, bool hasBeenIssuedTo)
        {
            OwnershipType ownershipType = new OwnershipType();
            string        query         = "";


            query = HCMIS.Repository.Queries.OwnershipType.SelectGetOwnershipTypeByRegionAndNumberRU(receivingUnitTypeID, storeID);

            ownershipType.LoadFromRawSql(query);
            return(ownershipType.DataTable);
        }
        private void gridItemsView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            DataRow dr = gridItemsView.GetFocusedDataRow();

            lblIssueType.Text = dr["OrderType"]!=DBNull.Value ? (string) dr["OrderType"] : "-";

            if ((dr["ReceivingUnitID"]) != DBNull.Value)
            {
                var ins = new Institution();
                ins.LoadByPrimaryKey(Convert.ToInt32(dr["ReceivingUnitID"]));

                lblRegion.Text = ins.RegionName ?? "-";
                lblWoreda.Text = ins.WoredaName ?? "-";
                lblZone.Text = ins.ZoneName ?? "-";

                var own = new OwnershipType();
                own.LoadByPrimaryKey(ins.Ownership);
                lblOwnership.Text = own.Name ?? "-";

                var iss = new Issue();
                iss.LoadByPrimaryKey(Convert.ToInt32(dr["STVID"]));

                if (!iss.IsColumnNull("PaymentTypeID"))
                {
                    var pType = new PaymentType();

                     pType.LoadByPrimaryKey(iss.PaymentTypeID);
                    lblPaymentType.Text = pType.Name;

                }
                lblPaymentType.Text = "-";

                if (!iss.IsColumnNull("VoidRequestDateTime"))
                    lblVoidRequestedDate.Text = iss.VoidRequestDateTime.ToShortDateString();
                else
                {
                    lblVoidRequestedDate.Text = "-";
                }
               if(!iss.IsColumnNull("VoidApprovalDateTime"))
                lblVoidConfirmedDate.Text= iss.VoidApprovalDateTime.ToShortDateString();
               else
               {
                   lblVoidConfirmedDate.Text = "-";

               }
               var user = new User();
                if (!iss.IsColumnNull("VoidRequestUserID"))
                {

                    user.LoadByPrimaryKey(iss.VoidRequestUserID);
                    lblVoidRequestedBy.Text = user.FullName;
                }
                else lblVoidRequestedBy.Text = "-";
                if (!iss.IsColumnNull("VoidApprovedByUserID"))
                {
                    user.LoadByPrimaryKey(iss.VoidApprovedByUserID);
                    lblVoidConfirmedBy.Text = user.FullName;
                }
                else lblVoidConfirmedBy.Text = "-";

                lblInstitutionType.Text = ins.InstitutionTypeName;

                if (!iss.IsColumnNull("DocumentTypeID"))
                {
                    lblDocumentType.Text = DocumentType.GetDocumentType(iss.DocumentTypeID).Name;
                }
                else
                    lblDocumentType.Text = "";

            }
            else
            {
                lblRegion.Text = lblWoreda.Text = lblZone.Text = "-";
            }

            lblPrintedDate.Text = string.IsNullOrEmpty((Convert.ToDateTime(dr["PrintedDate"].ToString())).ToShortDateString()) ? "-" : (Convert.ToDateTime(dr["PrintedDate"].ToString())).ToShortDateString();
            lblAccount.Text = string.IsNullOrEmpty(dr["AccountName"].ToString()) ? "-" : dr["AccountName"].ToString();
            lblSubAccount.Text = string.IsNullOrEmpty(dr["SubAccountName"].ToString()) ? "-" : dr["SubAccountName"].ToString();
            lblActivity.Text = string.IsNullOrEmpty(dr["ActivityName"].ToString()) ? "-" : dr["ActivityName"].ToString();
            lblPrintedBy.Text = string.IsNullOrEmpty(dr["IssuedBy"].ToString()) ? "-" : dr["IssuedBy"].ToString();

            lblIssueStatus.Text = string.IsNullOrEmpty(dr["Status"].ToString()) ? "-" : dr["Status"].ToString();
               int accountid =  Convert.ToInt32(dr["AccountID"]);
               Account account = new Account();
               account.LoadByPrimaryKey(accountid);
               Mode mode = new Mode();
               mode.LoadByPrimaryKey(account.ModeID);
               lblMode.Text = mode.TypeName;
        }
        /// <summary>
        /// Handles the FocusedRowChanged event of the gridViewReferences control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs" /> instance containing the event data.</param>
        private void gridViewReferences_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            if (e != null && e.PrevFocusedRowHandle < -1)
                return;

            dtDate.Value = DateTimeHelper.ServerDateTime;
            _reprintId = null;
            DataRow dr = gridViewReferences.GetFocusedDataRow();
            if (dr == null)
            {
                return;
            }

            string[] referenceNo = new string[2];
            referenceNo[0] = dr["RefNo"].ToString();

            if (Convert.ToBoolean(dr["isConvertedDN"]))
            {
                _isConvertedDn = true;
                _stvLogIdChosen = (int?)dr["IsReprintOf"];
            }
            else if (dr != null && dr["ID"] != DBNull.Value)
            {
                _isConvertedDn = false;
                _stvLogIdChosen = (int?)dr["ID"];
            }

            UpdateReprintedNumbers(dr);

            // Enable and disable STV reprint
            // STV SHouldn't be reprinted off a reprint.
            if (dr["IsReprintOf"] != DBNull.Value && !Convert.ToBoolean(dr["isConvertedDN"]))
            {
                btnExport.Enabled = btnReprint.Enabled = false;
                var permission = (BLL.Settings.UseNewUserManagement) ? this.HasPermission("Print") : true;
                btnPrint.Enabled = permission;
                _reprintId = _stvLogIdChosen;
                _stvLogIdChosen = Convert.ToInt32(dr["IsReprintOf"]);
            }
            else if (dr["IsDeliveryNote"] != DBNull.Value && Convert.ToBoolean(dr["IsDeliveryNote"]))
            {
                btnExport.Enabled = false;
                btnReprint.Enabled = (BLL.Settings.UseNewUserManagement) ? this.HasPermission("Re-Print") : true;
                btnPrint.Enabled = false;
            }
            else
            {
                btnPrint.Enabled = this.HasPermission("Print");
                btnReprint.Enabled = this.HasPermission("Re-Print");
                btnExport.Enabled = this.HasPermission("Export");
            }

            if (_stvLogIdChosen != null)
            {
                Issue log = new Issue();
                log.LoadByPrimaryKey(_stvLogIdChosen.Value);

                Institution rus = new Institution();
                IssueDoc iss = new IssueDoc();
                if (!log.IsColumnNull("ReceivingUnitID"))
                {
                    rus.LoadByPrimaryKey(log.ReceivingUnitID);
                    //FacilityName.Text = rus.Name;

                    HeaderSection.Text = rus.Name;

                    var activity = new Activity();
                    activity.LoadByPrimaryKey(log.StoreID);
                    lblActivity.Text = activity.Name;
                    lblSubAccount.Text = activity.SubAccountName;
                    lblMode.Text = activity.ModeName;
                    lblAccount.Text = activity.AccountName;

                    lblRegion.Text = rus.RegionName;
                    lblWoreda.Text = rus.WoredaName;
                    lblZone.Text = rus.ZoneName;
                    lblInstType.Text = rus.InstitutionTypeName;

                    var ownership = new OwnershipType();
                    ownership.LoadByPrimaryKey(rus.Ownership);
                    lblOwnership.Text = ownership.Name;

                    lblVoidConDate.Text = (dr["approvalDate"]) != DBNull.Value ? Convert.ToDateTime(dr["approvalDate"]).ToShortDateString(): "-";
                    lblIssueType.Text = (string)dr["OrderType"];
                    User user = new User();

                    if (dr["approvedBy"] != DBNull.Value)
                    {
                        user.LoadByPrimaryKey(Convert.ToInt32(dr["approvedBy"]));
                        lblConfirmedBy.Text = user.FullName;
                    }
                    else
                    {
                        lblConfirmedBy.Text = "-";
                    }

                    var doc = new DocumentType();
                    doc.LoadByPrimaryKey(log.DocumentTypeID);
                    lblDocType.Text = doc.Name;

                    lblPrintedDate.Text = log.PrintedDate.ToShortDateString();

                    var pt = new PaymentType();

                    if (!rus.IsColumnNull("PaymentTypeID"))
                    {
                        pt.LoadByPrimaryKey(rus.PaymentTypeID);
                        lblPaymentType.Text = pt.Name;
                    }

                    else
                    {
                        lblPaymentType.Text = "-";
                    }

                    // Show user name

                    user.LoadByPrimaryKey(log.UserID);
                    lblPrintedBy.Text = (user.FullName == "") ? user.UserName : user.FullName;

                    // show contact person
                    PickList pl = new PickList();
                    pl.LoadByPrimaryKey(log.PickListID);
                    Order order = new Order();
                    order.LoadByPrimaryKey(pl.OrderID);

                    var os = new OrderStatus();
                    os.LoadByPrimaryKey(order.OrderStatusID);
                    lblIssueStatus.Text = os.OrderStatus;

                    if (!order.IsColumnNull("ContactPerson"))
                    {
                        lblRecivedBy.Text = order.ContactPerson;
                    }
                    else
                    {
                        lblRecivedBy.Text = @"-";
                    }

                    lblReceivedDate.Text = order.EurDate.ToShortDateString();

                }

                dtDate.Value = log.PrintedDate;
                //PrintedDate.Text = dtDate.Text;
                lblPrintedDate.Text = dtDate.Text;

                gridTransactions.DataSource = iss.GetIssueBySTV(_stvLogIdChosen.Value);

                layoutUnconfirmedSTVs.Visibility = LayoutVisibility.Never;
                if (BLL.Settings.ShowMissingSTVsOnIssueLog)
                {
                    DataView view = iss.GetPossibleUnconfirmedIssues(_stvLogIdChosen.Value);
                    if (view.Count > 0)
                    {
                        gridUnconfirmed.DataSource = view;
                        layoutUnconfirmedSTVs.Visibility = LayoutVisibility.Always;
                    }
                    else
                    {
                        layoutUnconfirmedSTVs.Visibility = LayoutVisibility.Never;
                    }
                }

            }
        }
        private void LoadReceivingUnits()
        {
            BLL.Region reg = new BLL.Region();
            reg.LoadAll();
            lkRegion.Properties.DataSource = reg.DefaultView;

            BLL.InstitutionType ruType = new InstitutionType();
            ruType.Where.IsActive.Value = 1;
            ruType.Query.Load();
            lkRUType.Properties.DataSource = ruType.DefaultView;

            BLL.OwnershipType ownershipType = new OwnershipType();
            ownershipType.LoadAll();
            lkOwnership.Properties.DataSource = ownershipType.DefaultView;

            Route r = new Route();
            r.LoadAll();
            lkRoute.Properties.DataSource = r.DefaultView;
        }
        /// <summary>
        /// Called when [outstanding picklist selected].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Grid.RowClickEventArgs" /> instance containing the event data.</param>
        private void OnOutstandingPicklistSelected(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            var dr = gridOutstandingPickListView.GetFocusedDataRow();

            _orderID = Convert.ToInt32(dr["ID"]);

            var order = new BLL.Order();

            order.LoadByPrimaryKey(_orderID);


            // load payment type options
            int?requestedBy = null;

            var usr = new User();

            lblIssueStatus.Text = (string)dr["OrderStatus"];
            lblIssueTypes.Text  = (string)dr["Description"];

            if (!order.IsColumnNull("RequestedBy"))
            {
                var ins = new Institution();
                requestedBy = order.RequestedBy;
                lkPaymentType.Properties.DataSource = PaymentType.GetAllowedTypes(order.FromStore, requestedBy);
                ins.LoadByPrimaryKey(order.RequestedBy);

                try
                {
                    lblWoreda.Text          = ins.WoredaName ?? "-";
                    lblRegion.Text          = ins.RegionName ?? "-";
                    lblZone.Text            = ins.ZoneName ?? "-";
                    lblInstitutionType.Text = ins.InstitutionTypeName ?? "-";

                    var ownership = new BLL.OwnershipType();
                    if (!ins.IsColumnNull("Ownership"))
                    {
                        ownership.LoadByPrimaryKey(ins.Ownership);
                        lblOwnership.Text = ownership.Name;
                    }
                }
                catch (NullReferenceException ex)
                {
                    //when transfer, institution has no woreda, zone or region, ignore the error
                }
            }
            else
            {
                lblWoreda.Text = lblRegion.Text = lblZone.Text = lblInstitutionType.Text = lblOwnership.Text = "NA";
            }


            //usr.LoadByPrimaryKey(NewMainWindow.UserId);
            usr = CurrentContext.LoggedInUser;
            txtIssuedBy.Text = usr.FullName ?? "-";


            PickList pl = new PickList();

            _dvOutstandingPickList = pl.GetPickListDetailsForOrder(_orderID, CurrentContext.LoggedInUserName);
            gridOutstandingPicklistDetail.DataSource = _dvOutstandingPickList;



            if (order.FromStore != Mode.Constants.HEALTH_PROGRAM)
            {
                colSKUPicked.Visible = false;
            }
            else
            {
                colSKUPicked.Visible = true;
            }


            txtConfirmFromStore.Text   = order.GetFromStore();
            txtConfirmRequestedBy.Text = order.GetRequestedBy();

            int length = order.GetRequestedBy().Length;


            string s = "";

            HeaderSection.Text = order.GetRequestedBy() + s.PadRight(150 - length) + "Order Number: " + order.RefNo;

            txtConfirmOrderNumber.Text = order.RefNo;
            //txtConfirmApprovedBy.Text = order.GetApprovedBy() ?? "-";
            lblApprovedBy.Text = order.GetApprovedBy() ?? "-";

            lkPaymentType.EditValue = order.PaymentTypeID;
            // Temporarily copy the STV
            txtIssueRefNo.Text = order.RefNo; //"";
            lblRefNo.Text      = order.RefNo ?? "-";

            var paymentType = new BLL.PaymentType();

            paymentType.LoadByPrimaryKey(order.PaymentTypeID);
            lblPaymentType.Text = paymentType.Name ?? "-";

            lblMode.Text                = order.GetFromStore() ?? "-";
            lblissuedDate.Text          = order.Date.ToShortDateString();
            lblIssuedBy.Text            = order.GetFilledBy();
            lblPicklistPrintedDate.Text = pl.PickedDate.ToShortDateString() != "" ? pl.PickedDate.ToShortDateString() : "-";

            var us = new User();

            pl.LoadByOrderID(_orderID);
            if (!pl.IsColumnNull("PickedBy"))
            {
                us.LoadByPrimaryKey(pl.PickedBy);
                lblPicklistConfirmedBy.Text = us.FullName;
            }
            else
            {
                lblPicklistConfirmedBy.Text = "-";
            }
        }
        private void OnUndispatchedIssueClicked(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            var dr = gridUndispatchedIssuesView.GetFocusedDataRow();
            _activeSTVID = Convert.ToInt32(dr["STVID"]);
            gridUndispatchedIssueDetails.DataSource = BLL.Issue.GetIssueDetails(_activeSTVID);

            User usr = new User();
            //usr.LoadByPrimaryKey(NewMainWindow.UserId);
            usr = CurrentContext.LoggedInUser;
            BLL.Issue stv = new BLL.Issue();
            stv.LoadByPrimaryKey(_activeSTVID);

            var activity = new Activity();
            activity.LoadByPrimaryKey(stv.StoreID);
            lblMode.Text = activity.ModeName ??"-" ;

            lblAccount.Text = activity.AccountName ?? "-";

            lblActivity.Text = activity.FullActivityName ?? "-";
            lblSubAccount.Text = activity.SubAccountName ?? "-";

            lblIssueStatus.Text = (string)dr["OrderStatus"] ?? "-";
            lblIssueType.Text = (string) dr["OrderType"] ?? "-";

            if (!stv.IsColumnNull("ReceivingUnitID"))
            {
                var institution = new Institution();
                institution.LoadByPrimaryKey(stv.ReceivingUnitID);

                var ownership = new BLL.OwnershipType();
                ownership.LoadByPrimaryKey(institution.Ownership);

                lblRegion.Text = institution.RegionName ?? "-";
                lblZone.Text = institution.ZoneName ?? "-";
                lblWoreda.Text = institution.WoredaName ?? "-";
                var space = "";
                int length =  (institution.Name).Length;
                if(stv.IsColumnNull("IsReprintOf"))
                    FacilityGroup.Text = institution.Name ?? "" +space.PadRight(180 - length) + "Invoice No: " + stv.IDPrinted.ToString("00000");

                lblInstitutionType.Text = institution.InstitutionTypeName;
                lblOwnership.Text = ownership.Name;
            }
            else
            {
                lblRegion.Text =
                    lblZone.Text = lblWoreda.Text  = "NA";
                lblInstitutionType.Text = lblOwnership.Text = "-";
                FacilityGroup.Text = "";
            }

            if (!stv.IsColumnNull("PaymentTypeID"))
            {
                var paymentType = new BLL.PaymentType();
                paymentType.LoadByPrimaryKey(stv.PaymentTypeID);
                lblPaymentType.Text = paymentType.Name;
            }
            else
            {
                lblPaymentType.Text = "-";
            }

            if (!stv.IsColumnNull("DocumentTypeID"))
            {
                lblDocumentedType.Text = DocumentType.GetDocumentType(stv.DocumentTypeID).Name;
            }
            else
                lblDocumentedType.Text = "-";

            lblRequistedDate.Text = dr["VoidRequestDateTime"] == DBNull.Value
                ? "NA"
                : DateTime.Parse(dr["VoidRequestDateTime"].ToString()).ToShortDateString();

            lblVoidRequestedBy.Text = dr["VoidRequestedBy"] == DBNull.Value ? "NA" : (string) dr["VoidRequestedBy"];

            var user = new BLL.User();
            if (dr["VoidApprovedByUserID"] != DBNull.Value)
            {
                user.LoadByPrimaryKey(Convert.ToInt32(dr["VoidApprovedByUserID"]));
                lblVoidConfirmedBy.Text = user.FullName;
            }
            else
            {
                lblVoidConfirmedBy.Text = "NA";
            }

            lblVoidConfirmedDate.Text = dr["VoidApprovalDateTime"] == DBNull.Value
                ? "NA"
                : DateTime.Parse(dr["VoidApprovalDateTime"].ToString()).ToShortDateString();

            stv.LoadLatestReprint();
            txtIssuedBy.Text = usr.FullName ?? "-";
            lblDispatchConfirmedBy.Text = usr.FullName ?? "-";

               // txtSTVInvoiceNo.Text = stv.IDPrinted.ToString("00000");
            lblSTVNo.Text = stv.IDPrinted.ToString("00000") ?? "-";
            lblSTVDate.Text = stv.PrintedDate.ToShortDateString() ?? "-";

            user.LoadByPrimaryKey(stv.UserID);
            lblSTVPrintedBy.Text = user.FullName ?? "-";

            txtPreprintedInvoiceNo.Text = stv.IsColumnNull("PrePrintedInvoiceNo") ? "" : stv.PrePrintedInvoiceNo.ToString();
        }
        private void gridRequisitionListView_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e)
        {
            if (e != null && e.PrevFocusedRowHandle < -1)
                return;

            try
            {
                DataRow dr = gridRequisitionListView.GetFocusedDataRow();
                if (dr == null)
                    return;
                int orderID = Convert.ToInt32(dr["ID"]);
                gridRequisitionDetails.DataSource = Order.GetRequisitionDetails(orderID);
                //lblOrderStatus.Text = Order.GetOrderStatus(orderID);

                BLL.Order order = new BLL.Order();
                order.LoadByPrimaryKey(orderID);

                Institution ins = new Institution();

                ins.LoadByPrimaryKey(order.RequestedBy);

                lblWoreda.Text = ins.WoredaName;
                lblZone.Text = ins.ZoneName;
                lblRegion.Text = ins.RegionName;
                lblRequestedDate.Text = order.EurDate.ToShortDateString();
                lblRequestedBy.Text = order.GetFilledBy();

                OrderStatus os = new OrderStatus();
                os.LoadByPrimaryKey(order.OrderStatusID);

                lblStatus.Text = os.OrderStatus;

                int length = order.GetRequestedBy().Length;

                string s = "";

                headerSection.Text = order.GetRequestedBy() + s.PadRight(200 - length) + "Order Number: " + order.RefNo;

                var ownership = new BLL.OwnershipType();
                ownership.LoadByPrimaryKey(ins.Ownership);
                lblOwnership.Text = ownership.Name;

                var paymentType = new BLL.PaymentType();
                paymentType.LoadByPrimaryKey(order.PaymentTypeID);
                lblPaymentType.Text = paymentType.Name;
                lblMode.Text = order.GetFromStore();
                DataRow facilityHis = BLL.Issue.GetVisitHistoryForFacility(Convert.ToInt32(dr["InstitutionID"]));

                if (facilityHis != null)
                {
                    lblLastVisit.Text = Convert.ToDateTime(facilityHis["LastVisit"]).TimeAgo() ?? "-";
                    lblNoOfReq.Text = Convert.ToString(facilityHis["VisitCount"]) ?? "-";
                    lblIssueType.Text = Convert.ToString(facilityHis["Description"]) ?? "-";
                }

                else
                {
                    lblLastVisit.Text = lblNoOfReq.Text = lblIssueType.Text = "-";

                }
            }
            catch (NullReferenceException ex)
            {
                MessageBox.Show(ex.Message);

            }
        }
Пример #12
0
        private void OnApprovedOrderRowClicked(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            if (e != null && e.RowHandle < -1)
            {
                return;
            }

            var gv = (GridView)sender;
            var dr = gv.GetFocusedDataRow();

            _orderID = Convert.ToInt32(dr["ID"].ToString());

            order.LoadByPrimaryKey(_orderID);
            // populate the general order variables
            txtPickListFromStore.Text = order.GetFromStore();
            lblMode.Text = order.GetFromStore() ?? "-";

            txtPickListRequestedBy.Text = order.GetRequestedBy();
            labelControl9.Text          = order.GetRequestedBy() ?? "-";

            var us = new BLL.User();

            us.LoadByPrimaryKey(order.FilledBy);
            lblFilledBy.Text = us.FullName ?? "-";
            string s = "";

            lblLetterNum.Text = String.IsNullOrEmpty(order.LetterNo) ? "-" : order.LetterNo;

            var orderDetail = new OrderDetail();

            orderDetail.LoadAllByOrderID(order.ID);

            var paymentType = new BLL.PaymentType();

            paymentType.LoadByPrimaryKey(order.PaymentTypeID);

            if (!orderDetail.IsColumnNull("StoreID"))
            {
                var activity = new Activity();
                activity.LoadByPrimaryKey(orderDetail.StoreID);
                lblMode.Text = activity.ModeName ?? "-";
            }

            lblIssueStatus.Text = (string)dr["OrderStatus"] ?? "-";
            lblIssueType.Text   = (string)dr["Description"] ?? "-";

            if (!order.IsColumnNull("RequestedBy"))
            {
                var ins = new Institution();
                ins.LoadByPrimaryKey(order.RequestedBy);

                var ownership = new BLL.OwnershipType();
                ownership.LoadByPrimaryKey(ins.Ownership);

                int length = ins.Name.Length;
                HeaderSection.Text      = ins.Name + s.PadRight(150 - length) + "Order Number: " + order.RefNo;
                lblOwnership.Text       = ownership.Name ?? "-";
                lblZone.Text            = ins.ZoneName ?? "-";
                lblWoreda.Text          = ins.WoredaName ?? "-";
                lblRegion.Text          = ins.RegionName ?? "-";
                lblInstitutionType.Text = ins.InstitutionTypeName ?? "-";
            }
            else
            {
                HeaderSection.Text = lblOwnership.Text = lblZone.Text = lblWoreda.Text = lblRegion.Text = lblInstitutionType.Text = "-";
            }


            lblPaymentType.Text = paymentType.Name;
            lblOrderDate.Text   = order.Date.ToShortDateString();

            txtPickListOrderNumber.Text = order.RefNo;
            labelControl12.Text         = order.RefNo;

            txtPickListApprovedBy.Text = order.GetApprovedBy();
            labelControl13.Text        = order.GetApprovedBy();

            if (order.OrderStatusID == OrderStatus.Constant.PICK_LIST_GENERATED)
            {
                PickList pl = new PickList();
                gridPickListDetail.DataSource = pl.GetPickListDetailsForOrder(_orderID);

                btnPrintAndSavePickList.Text = @"Confirm";
                colPrice.FieldName           = "Cost";
                colSKU.FieldName             = "Packs";
                btnCancelPickList.Enabled    = (BLL.Settings.UseNewUserManagement)? this.HasPermission("Cancel-Pick-List"):true;

                pl.LoadByOrderID(_orderID);
                if (!pl.IsColumnNull("PickedBy"))
                {
                    us.LoadByPrimaryKey(pl.PickedBy);
                    lblPicklistPrintedBy.Text = us.FullName;
                }
                else
                {
                    lblPicklistPrintedBy.Text = "-";
                }

                lblPicklistPrintedDate.Text = !pl.IsColumnNull("SavedDate") ? pl.SavedDate.ToShortDateString() : "-";
                lblPicklistNo.Text          = !pl.IsColumnNull("PrintedID") ? pl.PrintedID.ToString() : "-";
            }
            //gridPickListView.EndSummaryUpdate();
        }
        private void OnApprovedOrderRowClicked(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            var gv = (GridView)sender;
            var dr = gv.GetFocusedDataRow();
            var or = new BLL.Order();
            _orderID = Convert.ToInt32(gv.GetFocusedDataRow()["ID"].ToString());

            order.LoadByPrimaryKey(_orderID);
            // populate the general order variables
            txtPickListFromStore.Text = order.GetFromStore();
            lblMode.Text = order.GetFromStore();

            txtPickListRequestedBy.Text = order.GetFilledBy();

            if (!order.IsColumnNull("RequestedBy"))
            {
                var ins = new Institution();
                ins.LoadByPrimaryKey(order.RequestedBy);

                var ownership = new BLL.OwnershipType();
                ownership.LoadByPrimaryKey(ins.Ownership);

                lblOwnership.Text = ownership.Name;
                lblInstitutionType.Text = ins.InstitutionTypeName;
                lblFacility.Text = ins.Name;
                lblWoreda.Text = ins.WoredaName;
                lblZone.Text = ins.ZoneName;
                lblRegion.Text = ins.RegionName;
                lblLetterNum.Text = String.IsNullOrEmpty(order.LetterNo) ? "-" : order.LetterNo;

            }
            else
            {
                lblFacility.Text = lblWoreda.Text = lblZone.Text = lblRegion.Text = lblOwnership.Text = "";// lblType.Text = "";
            }

            int length = order.GetRequestedBy().Length;

            string s = "";

            HeaderLayoutGroup.Text = order.GetRequestedBy() + s.PadRight(150 - length) + "Order Number:" + order.RefNo;

            txtPickListOrderNumber.Text = order.RefNo;
            lblOrderNum.Text = order.RefNo;

            txtPickListApprovedBy.Text = order.GetApprovedBy();
            lblApprovedBy.Text = order.GetApprovedBy();

            var orderDetail = new OrderDetail();
            orderDetail.LoadAllByOrderID(order.ID);

            if (!orderDetail.IsColumnNull("StoreID"))
            {
                var activity = new Activity();
                activity.LoadByPrimaryKey(orderDetail.StoreID);
                lblMode.Text = activity.ModeName;
            }

            lblOrderDate.Text = order.Date.ToShortDateString();

            var us = new BLL.User();
            us.LoadByPrimaryKey(order.FilledBy);
            lblFilledBy.Text = us.FirstName;

            lblIssueStatus.Text = (string)dr["OrderStatus"] ?? "-";
            lblIssueType.Text = (string)dr["Description"] ?? "-";

            var paymentType = new BLL.PaymentType();
            paymentType.LoadByPrimaryKey(order.PaymentTypeID);
            lblPaymentType.Text = paymentType.Name;

            if (order.OrderStatusID == OrderStatus.Constant.ORDER_APPROVED)
            {
                progressBarControl.Properties.Maximum = order.CountOfDetailItems();
                progressBarControl.Properties.DisplayFormat.FormatString = "{0: #,##0}" + string.Format(" of {0}", progressBarControl.Properties.Maximum);
                progressBarControl.Properties.DisplayFormat.FormatType = FormatType.Custom;
                progressBarControl.EditValue = 0;
                this.Enabled = false;
                progressBarControl.Visible = true;
                bgWorker.RunWorkerAsync(_orderID);
            }
        }
Пример #14
0
        private void OnUndispatchedIssueClicked(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            var dr = gridUndispatchedIssuesView.GetFocusedDataRow();

            _activeSTVID = Convert.ToInt32(dr["STVID"]);
            gridUndispatchedIssueDetails.DataSource = BLL.Issue.GetIssueDetails(_activeSTVID);


            User usr = new User();

            //usr.LoadByPrimaryKey(NewMainWindow.UserId);
            usr = CurrentContext.LoggedInUser;
            BLL.Issue stv = new BLL.Issue();
            stv.LoadByPrimaryKey(_activeSTVID);

            var activity = new Activity();

            activity.LoadByPrimaryKey(stv.StoreID);
            lblMode.Text = activity.ModeName ?? "-";

            lblAccount.Text = activity.AccountName ?? "-";

            lblActivity.Text   = activity.FullActivityName ?? "-";
            lblSubAccount.Text = activity.SubAccountName ?? "-";

            lblIssueStatus.Text = (string)dr["OrderStatus"] ?? "-";
            lblIssueType.Text   = (string)dr["OrderType"] ?? "-";


            if (!stv.IsColumnNull("ReceivingUnitID"))
            {
                var institution = new Institution();
                institution.LoadByPrimaryKey(stv.ReceivingUnitID);

                var ownership = new BLL.OwnershipType();
                ownership.LoadByPrimaryKey(institution.Ownership);

                lblRegion.Text = institution.RegionName ?? "-";
                lblZone.Text   = institution.ZoneName ?? "-";
                lblWoreda.Text = institution.WoredaName ?? "-";
                var space  = "";
                int length = (institution.Name).Length;
                if (stv.IsColumnNull("IsReprintOf"))
                {
                    FacilityGroup.Text = institution.Name ?? "" + space.PadRight(180 - length) + "Invoice No: " + stv.IDPrinted.ToString("00000");
                }

                lblInstitutionType.Text = institution.InstitutionTypeName;
                lblOwnership.Text       = ownership.Name;
            }
            else
            {
                lblRegion.Text          =
                    lblZone.Text        = lblWoreda.Text = "NA";
                lblInstitutionType.Text = lblOwnership.Text = "-";
                FacilityGroup.Text      = "";
            }

            if (!stv.IsColumnNull("PaymentTypeID"))
            {
                var paymentType = new BLL.PaymentType();
                paymentType.LoadByPrimaryKey(stv.PaymentTypeID);
                lblPaymentType.Text = paymentType.Name;
            }
            else
            {
                lblPaymentType.Text = "-";
            }

            if (!stv.IsColumnNull("DocumentTypeID"))
            {
                lblDocumentedType.Text = DocumentType.GetDocumentType(stv.DocumentTypeID).Name;
            }
            else
            {
                lblDocumentedType.Text = "-";
            }

            lblRequistedDate.Text = dr["VoidRequestDateTime"] == DBNull.Value
                ? "NA"
                : DateTime.Parse(dr["VoidRequestDateTime"].ToString()).ToShortDateString();

            lblVoidRequestedBy.Text = dr["VoidRequestedBy"] == DBNull.Value ? "NA" : (string)dr["VoidRequestedBy"];



            var user = new BLL.User();

            if (dr["VoidApprovedByUserID"] != DBNull.Value)
            {
                user.LoadByPrimaryKey(Convert.ToInt32(dr["VoidApprovedByUserID"]));
                lblVoidConfirmedBy.Text = user.FullName;
            }
            else
            {
                lblVoidConfirmedBy.Text = "NA";
            }


            lblVoidConfirmedDate.Text = dr["VoidApprovalDateTime"] == DBNull.Value
                ? "NA"
                : DateTime.Parse(dr["VoidApprovalDateTime"].ToString()).ToShortDateString();



            stv.LoadLatestReprint();
            txtIssuedBy.Text            = usr.FullName ?? "-";
            lblDispatchConfirmedBy.Text = usr.FullName ?? "-";

            // txtSTVInvoiceNo.Text = stv.IDPrinted.ToString("00000");
            lblSTVNo.Text   = stv.IDPrinted.ToString("00000") ?? "-";
            lblSTVDate.Text = stv.PrintedDate.ToShortDateString() ?? "-";


            user.LoadByPrimaryKey(stv.UserID);
            lblSTVPrintedBy.Text = user.FullName ?? "-";

            txtPreprintedInvoiceNo.Text = stv.IsColumnNull("PrePrintedInvoiceNo") ? "" : stv.PrePrintedInvoiceNo.ToString();
        }
        private void gridRequisitionListView_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e)
        {
            if (e != null && e.PrevFocusedRowHandle < -1)
            {
                return;
            }


            try
            {
                DataRow dr = gridRequisitionListView.GetFocusedDataRow();
                if (dr == null)
                {
                    return;
                }
                int orderID = Convert.ToInt32(dr["ID"]);
                gridRequisitionDetails.DataSource = Order.GetRequisitionDetails(orderID);
                //lblOrderStatus.Text = Order.GetOrderStatus(orderID);

                BLL.Order order = new BLL.Order();
                order.LoadByPrimaryKey(orderID);


                Institution ins = new Institution();

                ins.LoadByPrimaryKey(order.RequestedBy);

                lblWoreda.Text        = ins.WoredaName;
                lblZone.Text          = ins.ZoneName;
                lblRegion.Text        = ins.RegionName;
                lblRequestedDate.Text = order.EurDate.ToShortDateString();
                lblRequestedBy.Text   = order.GetFilledBy();


                OrderStatus os = new OrderStatus();
                os.LoadByPrimaryKey(order.OrderStatusID);

                lblStatus.Text = os.OrderStatus;

                int length = order.GetRequestedBy().Length;

                string s = "";

                headerSection.Text = order.GetRequestedBy() + s.PadRight(200 - length) + "Order Number: " + order.RefNo;

                var ownership = new BLL.OwnershipType();
                ownership.LoadByPrimaryKey(ins.Ownership);
                lblOwnership.Text = ownership.Name;

                var paymentType = new BLL.PaymentType();
                paymentType.LoadByPrimaryKey(order.PaymentTypeID);
                lblPaymentType.Text = paymentType.Name;
                lblMode.Text        = order.GetFromStore();
                DataRow facilityHis = BLL.Issue.GetVisitHistoryForFacility(Convert.ToInt32(dr["InstitutionID"]));

                if (facilityHis != null)
                {
                    lblLastVisit.Text = Convert.ToDateTime(facilityHis["LastVisit"]).TimeAgo() ?? "-";
                    lblNoOfReq.Text   = Convert.ToString(facilityHis["VisitCount"]) ?? "-";
                    lblIssueType.Text = Convert.ToString(facilityHis["Description"]) ?? "-";
                }

                else
                {
                    lblLastVisit.Text = lblNoOfReq.Text = lblIssueType.Text = "-";
                }
            }
            catch (NullReferenceException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void OnApprovedOrderRowClicked(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            if (e != null && e.RowHandle < -1)
                return;

            var gv = (GridView)sender;
            var dr = gv.GetFocusedDataRow();
            _orderID = Convert.ToInt32(dr["ID"].ToString());

            order.LoadByPrimaryKey(_orderID);
            // populate the general order variables
            txtPickListFromStore.Text = order.GetFromStore();
            lblMode.Text = order.GetFromStore() ?? "-";

            txtPickListRequestedBy.Text = order.GetRequestedBy();
            labelControl9.Text = order.GetRequestedBy() ?? "-";

            var us = new BLL.User();

            us.LoadByPrimaryKey(order.FilledBy);
            lblFilledBy.Text = us.FullName ?? "-";
            string s = "";

            lblLetterNum.Text = String.IsNullOrEmpty(order.LetterNo) ? "-" : order.LetterNo;

            var orderDetail = new OrderDetail();
            orderDetail.LoadAllByOrderID(order.ID);

            var paymentType = new BLL.PaymentType();
            paymentType.LoadByPrimaryKey(order.PaymentTypeID);

            if (!orderDetail.IsColumnNull("StoreID"))
            {
                var activity = new Activity();
                activity.LoadByPrimaryKey(orderDetail.StoreID);
                lblMode.Text = activity.ModeName ?? "-";
            }

            lblIssueStatus.Text = (string)dr["OrderStatus"] ?? "-";
            lblIssueType.Text = (string)dr["Description"] ?? "-";

            if (!order.IsColumnNull("RequestedBy"))
            {
                var ins = new Institution();
                ins.LoadByPrimaryKey(order.RequestedBy);

                var ownership = new BLL.OwnershipType();
                ownership.LoadByPrimaryKey(ins.Ownership);

                int length = ins.Name.Length;
                HeaderSection.Text = ins.Name + s.PadRight(150 - length) + "Order Number: " + order.RefNo;
                lblOwnership.Text = ownership.Name ?? "-";
                lblZone.Text = ins.ZoneName ?? "-";
                lblWoreda.Text = ins.WoredaName ?? "-";
                lblRegion.Text = ins.RegionName ?? "-";
                lblInstitutionType.Text = ins.InstitutionTypeName ?? "-";
            }
            else
            {
                HeaderSection.Text =lblOwnership.Text = lblZone.Text =lblWoreda.Text =lblRegion.Text = lblInstitutionType.Text = "-";
            }

            lblPaymentType.Text = paymentType.Name;
            lblOrderDate.Text = order.Date.ToShortDateString();

            txtPickListOrderNumber.Text = order.RefNo;
            labelControl12.Text = order.RefNo;

            txtPickListApprovedBy.Text = order.GetApprovedBy();
            labelControl13.Text = order.GetApprovedBy();

            if (order.OrderStatusID == OrderStatus.Constant.PICK_LIST_GENERATED)
            {
                PickList pl = new PickList();
                gridPickListDetail.DataSource = pl.GetPickListDetailsForOrder(_orderID);

                btnPrintAndSavePickList.Text = @"Confirm";
                colPrice.FieldName = "Cost";
                colSKU.FieldName = "Packs";
                btnCancelPickList.Enabled = (BLL.Settings.UseNewUserManagement)? this.HasPermission("Cancel-Pick-List"):true;

                pl.LoadByOrderID(_orderID);
                if (!pl.IsColumnNull("PickedBy"))
                {
                    us.LoadByPrimaryKey(pl.PickedBy);
                    lblPicklistPrintedBy.Text = us.FullName;
                }
                else lblPicklistPrintedBy.Text = "-";

                lblPicklistPrintedDate.Text = !pl.IsColumnNull("SavedDate") ? pl.SavedDate.ToShortDateString() : "-";
                lblPicklistNo.Text = !pl.IsColumnNull("PrintedID") ? pl.PrintedID.ToString() : "-";

            }
            //gridPickListView.EndSummaryUpdate();
        }
        /// <summary>
        /// Called when [outstanding picklist selected].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Grid.RowClickEventArgs" /> instance containing the event data.</param>
        private void OnOutstandingPicklistSelected(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            var dr = gridOutstandingPickListView.GetFocusedDataRow();
            _orderID = Convert.ToInt32(dr["ID"]);

            var order = new BLL.Order();
            order.LoadByPrimaryKey(_orderID);

            // load payment type options
            int? requestedBy = null;

            var usr = new User();

            lblIssueStatus.Text = (string)dr["OrderStatus"];
            lblIssueTypes.Text = (string) dr["Description"];

            if (!order.IsColumnNull("RequestedBy"))
            {
                var ins = new Institution();
                requestedBy = order.RequestedBy;
                lkPaymentType.Properties.DataSource = PaymentType.GetAllowedTypes(order.FromStore, requestedBy);
                ins.LoadByPrimaryKey(order.RequestedBy);

                try
                {
                    lblWoreda.Text = ins.WoredaName ?? "-";
                    lblRegion.Text = ins.RegionName ?? "-";
                    lblZone.Text = ins.ZoneName ?? "-";
                    lblInstitutionType.Text = ins.InstitutionTypeName ?? "-";

                    var ownership = new BLL.OwnershipType();
                    if (!ins.IsColumnNull("Ownership"))
                    {
                        ownership.LoadByPrimaryKey(ins.Ownership);
                        lblOwnership.Text = ownership.Name;
                    }

                }
                catch (NullReferenceException ex)
                {
                    //when transfer, institution has no woreda, zone or region, ignore the error
                }
            }
            else
                lblWoreda.Text = lblRegion.Text = lblZone.Text = lblInstitutionType.Text = lblOwnership.Text = "NA";

            //usr.LoadByPrimaryKey(NewMainWindow.UserId);
            usr = CurrentContext.LoggedInUser;
            txtIssuedBy.Text = usr.FullName ?? "-";

            PickList pl = new PickList();
            _dvOutstandingPickList = pl.GetPickListDetailsForOrder(_orderID, CurrentContext.LoggedInUserName);
            gridOutstandingPicklistDetail.DataSource = _dvOutstandingPickList;

            if (order.FromStore != Mode.Constants.HEALTH_PROGRAM)
            {
                colSKUPicked.Visible = false;
            }
            else
            {
                colSKUPicked.Visible = true;
            }

            txtConfirmFromStore.Text = order.GetFromStore();
            txtConfirmRequestedBy.Text = order.GetRequestedBy();

            int length = order.GetRequestedBy().Length;

            string s = "";

            HeaderSection.Text = order.GetRequestedBy() + s.PadRight(150-length)+"Order Number: " + order.RefNo;

            txtConfirmOrderNumber.Text = order.RefNo;
            //txtConfirmApprovedBy.Text = order.GetApprovedBy() ?? "-";
            lblApprovedBy.Text = order.GetApprovedBy() ?? "-";

            lkPaymentType.EditValue = order.PaymentTypeID;
            // Temporarily copy the STV
            txtIssueRefNo.Text = order.RefNo; //"";
            lblRefNo.Text = order.RefNo ?? "-";

            var paymentType = new BLL.PaymentType();
            paymentType.LoadByPrimaryKey(order.PaymentTypeID);
            lblPaymentType.Text = paymentType.Name ?? "-";

            lblMode.Text = order.GetFromStore() ?? "-";
            lblissuedDate.Text = order.Date.ToShortDateString();
            lblIssuedBy.Text = order.GetFilledBy();
            lblPicklistPrintedDate.Text = pl.PickedDate.ToShortDateString()!="" ? pl.PickedDate.ToShortDateString() : "-";

            var us = new User();
            pl.LoadByOrderID(_orderID);
            if (!pl.IsColumnNull("PickedBy"))
            {
                us.LoadByPrimaryKey(pl.PickedBy);
                lblPicklistConfirmedBy.Text = us.FullName;
            }
            else lblPicklistConfirmedBy.Text = "-";
        }
Пример #18
0
        private void OnApprovedOrderRowClicked(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            var gv = (GridView)sender;
            var dr = gv.GetFocusedDataRow();
            var or = new BLL.Order();

            _orderID = Convert.ToInt32(gv.GetFocusedDataRow()["ID"].ToString());

            order.LoadByPrimaryKey(_orderID);
            // populate the general order variables
            txtPickListFromStore.Text = order.GetFromStore();
            lblMode.Text = order.GetFromStore();

            txtPickListRequestedBy.Text = order.GetFilledBy();

            if (!order.IsColumnNull("RequestedBy"))
            {
                var ins = new Institution();
                ins.LoadByPrimaryKey(order.RequestedBy);

                var ownership = new BLL.OwnershipType();
                ownership.LoadByPrimaryKey(ins.Ownership);

                lblOwnership.Text       = ownership.Name;
                lblInstitutionType.Text = ins.InstitutionTypeName;
                lblFacility.Text        = ins.Name;
                lblWoreda.Text          = ins.WoredaName;
                lblZone.Text            = ins.ZoneName;
                lblRegion.Text          = ins.RegionName;
                lblLetterNum.Text       = String.IsNullOrEmpty(order.LetterNo) ? "-" : order.LetterNo;
            }
            else
            {
                lblFacility.Text = lblWoreda.Text = lblZone.Text = lblRegion.Text = lblOwnership.Text = "";// lblType.Text = "";
            }

            int length = order.GetRequestedBy().Length;


            string s = "";

            HeaderLayoutGroup.Text = order.GetRequestedBy() + s.PadRight(150 - length) + "Order Number:" + order.RefNo;

            txtPickListOrderNumber.Text = order.RefNo;
            lblOrderNum.Text            = order.RefNo;

            txtPickListApprovedBy.Text = order.GetApprovedBy();
            lblApprovedBy.Text         = order.GetApprovedBy();

            var orderDetail = new OrderDetail();

            orderDetail.LoadAllByOrderID(order.ID);

            if (!orderDetail.IsColumnNull("StoreID"))
            {
                var activity = new Activity();
                activity.LoadByPrimaryKey(orderDetail.StoreID);
                lblMode.Text = activity.ModeName;
            }

            lblOrderDate.Text = order.Date.ToShortDateString();

            var us = new BLL.User();

            us.LoadByPrimaryKey(order.FilledBy);
            lblFilledBy.Text = us.FirstName;


            lblIssueStatus.Text = (string)dr["OrderStatus"] ?? "-";
            lblIssueType.Text   = (string)dr["Description"] ?? "-";

            var paymentType = new BLL.PaymentType();

            paymentType.LoadByPrimaryKey(order.PaymentTypeID);
            lblPaymentType.Text = paymentType.Name;

            if (order.OrderStatusID == OrderStatus.Constant.ORDER_APPROVED)
            {
                progressBarControl.Properties.Maximum = order.CountOfDetailItems();
                progressBarControl.Properties.DisplayFormat.FormatString = "{0: #,##0}" + string.Format(" of {0}", progressBarControl.Properties.Maximum);
                progressBarControl.Properties.DisplayFormat.FormatType   = FormatType.Custom;
                progressBarControl.EditValue = 0;
                this.Enabled = false;
                progressBarControl.Visible = true;
                bgWorker.RunWorkerAsync(_orderID);
            }
        }