예제 #1
0
        private void ConfigureDisplay()
        {
            string headerText = "Rate";

            if (this.PreInvoiceID > 0)
            {
                Facade.IPalletForceImportPreInvoice facPreInvoice = new Facade.PreInvoice();
                PFInvoice = facPreInvoice.GetImportedInvoiceForPreInvoiceID(PreInvoiceID, true);
                ItemIDs   = PFInvoice.GetOrdersOnInvoice();

                switch (PFInvoice.InvoiceType)
                {
                case eInvoiceType.PFDepotCharge:
                    headerText = "Sub Contract Rate";
                    break;

                case eInvoiceType.PFHubCharge:
                    headerText = "Hub Charge";
                    break;

                case eInvoiceType.PFSelfBillDeliveryPayment:
                    headerText = "Order Rate";
                    break;
                }

                if (consignmentNo != String.Empty)
                {
                    lblRefCaption.Text = "Consignment No";
                    lblRef.Text        = txtSearch.Text = consignmentNo;
                }
            }
            else
            if (LoadNo != String.Empty)
            {
                lblRefCaption.Text = "Load No";
                lblRef.Text        = txtSearch.Text = LoadNo;
            }

            grdOrders.Columns.FindByUniqueName("CurrentRate").HeaderText = headerText;

            dteStartDate.SelectedDate = new DateTime(DateTime.Today.Year, DateTime.Today.AddMonths(-1).Month, DateTime.Today.Day);
            dteEndDate.SelectedDate   = DateTime.Today;

            Facade.IBusinessType facBT = new Facade.BusinessType();
            cblBusinessType.DataSource = facBT.GetAll();
            cblBusinessType.DataBind();

            foreach (ListItem li in cblBusinessType.Items)
            {
                li.Selected = true;
            }
        }
예제 #2
0
        void grdOrders_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
            {
                const string itemID = "ItemID";
                string       columnName = string.Empty, rateColumn = string.Empty;
                DataRow      dr = e.Item.DataItem as DataRow;

                int     lcid    = OrchestratorCulture.LCID;
                int     orderID = dr.Field <int>("OrderID");
                decimal?rate    = -1m;

                Label             lblRate   = e.Item.FindControl("lblRate") as Label;
                HtmlInputCheckBox chkSelect = e.Item.FindControl("chkSelect") as HtmlInputCheckBox;

                if (PFInvoice != null)
                {
                    switch (PFInvoice.InvoiceType)
                    {
                        #region Column Settings
                    case eInvoiceType.PFDepotCharge:
                        columnName = "SubContractLCID";
                        rateColumn = "SubContractRate";
                        break;

                    case eInvoiceType.PFHubCharge:
                        columnName = "lcid";
                        rateColumn = "HubCharge";
                        break;

                    case eInvoiceType.PFSelfBillDeliveryPayment:
                        columnName = "lcid";
                        rateColumn = "ForeignRate";
                        break;

                    default:
                        columnName = "lcid";
                        rateColumn = "ForeignRate";
                        break;
                        #endregion
                    }
                }
                else
                {
                    columnName = "lcid";
                    rateColumn = "ForeignRate";
                }

                if (chkSelect != null)
                {
                    chkSelect.Disabled = true;

                    if (ImportedInvoiceItemId == -1)
                    {
                        if (!ItemIDs.Exists(li => li == dr.Field <int?>("OrderID").Value)
                            &&
                            (
                                (PFInvoice.InvoiceType != eInvoiceType.PFDepotCharge && dr.Field <int>("OrderStatusID") == (int)eOrderStatus.Delivered)
                                ||
                                (dr.Field <int?>("JobSubContractID").HasValue&& !PFInvoice.GetJobSubContractOnInvoice().Exists(jsc => jsc == dr.Field <int?>("JobSubContractID").Value))
                            )
                            )
                        {
                            chkSelect.Attributes.Add(itemID, dr.Field <int?>("OrderID").Value.ToString());
                            chkSelect.Disabled = false;
                        }
                    }
                    else
                    {
                        // Called From invoicingImport
                        if (!dr.Field <int?>("ImportedInvoiceItemID").HasValue)
                        {
                            chkSelect.Attributes.Add(itemID, dr.Field <int?>("OrderID").Value.ToString());
                            chkSelect.Disabled = false;
                        }
                    }
                }

                if (!string.IsNullOrEmpty(dr.Field <int?>(columnName).ToString()))
                {
                    int.TryParse(dr.Field <int>(columnName).ToString(), out lcid);
                }

                rate = dr.Field <decimal?>(rateColumn);

                if (rate.HasValue && rate >= 0 && lblRate != null)
                {
                    lblRate.Text = rate.Value.ToString("C", new CultureInfo(lcid));
                }
            }
        }