//TODO: Change to work with Credit Notes.
        /// <summary>
        /// Prepares the page for viewing.
        /// </summary>
        private void ConfigureDisplay()
        {
            // Populate master page information
            //this.Master.WizardTitle = "Find Orders to Associate";

            // Bind the order states
            List <string> orderStateNames = new List <string>(Enum.GetNames(typeof(eOrderStatus)));

            orderStateNames.Remove(eOrderStatus.Invoiced.ToString());
            orderStateNames.Remove(eOrderStatus.Cancelled.ToString());
            cblOrderStatus.DataSource = orderStateNames;
            cblOrderStatus.DataBind();

            // Mark approved as being the only item checked.
            cblOrderStatus.Items.FindByValue(eOrderStatus.Approved.ToString()).Selected = true;

            // Default date range.
            dteStartDate.SelectedDate = DateTime.Today;
            dteEndDate.SelectedDate   = DateTime.Today.AddDays(2);

            // Set the client to match that of the orders in the group.
            Facade.IOrderGroup  facOrderGroup = new Facade.Order();
            Entities.OrderGroup orderGroup    = facOrderGroup.Get(_creditNoteID);
            if (orderGroup != null && orderGroup.Orders.Count > 0)
            {
                Facade.IOrganisation facOrganisation = new Facade.Organisation();
                int orderGroupCustomerIdentityID     = orderGroup.Orders[0].CustomerIdentityID;
                cboClient.Enabled       = false;
                cboClient.Text          = facOrganisation.GetNameForIdentityId(orderGroupCustomerIdentityID);
                cboClient.SelectedValue = orderGroupCustomerIdentityID.ToString();
            }
        }
Ejemplo n.º 2
0
 void grdOrganisations_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
 {
     if (this.FilteredData == null)
     {
         DataSet ds = null;
         using (Facade.Organisation facOrganisation = new Facade.Organisation())
         {
             if (Request.QueryString["incomplete"] != null)
             {
                 ds = facOrganisation.GetIncomplete();
             }
             else
             {
                 ds = facOrganisation.GetAllForType((int)eOrganisationType.ClientCustomer);
             }
         }
         this.GridData               = ds.Tables[0];
         this.FilteredData           = ds.Tables[0].DefaultView;
         grdOrganisations.DataSource = this.FilteredData;
     }
     else
     {
         grdOrganisations.DataSource = this.FilteredData;
     }
 }
Ejemplo n.º 3
0
 private void ConfigureClientDbCombo(bool isUpdate)
 {
     Facade.IOrganisation facOrganisation = new Facade.Organisation();
     cboClient.SelectedValue = m_identityId.ToString();
     cboClient.Text          = facOrganisation.GetNameForIdentityId(m_clientIdentityId);
     cboClient.Enabled       = !isUpdate;
 }
Ejemplo n.º 4
0
        private DataSet GetSubContractors()
        {
            Facade.IOrganisation facOrganisation = new Facade.Organisation();
            DataSet dsSubContractors             = facOrganisation.GetAllForType((int)eOrganisationType.SubContractor);

            return(dsSubContractors);
        }
Ejemplo n.º 5
0
        private void UpdateReferences()
        {
            int identityId = int.Parse(cboClient.SelectedValue);
            List <Entities.JobReference> references = new List <Entities.JobReference>();

            Facade.IOrganisationReference facOrganisationReference = new Facade.Organisation();

            foreach (RepeaterItem item in repReferences.Items)
            {
                int    referenceId    = Convert.ToInt32(((HtmlInputHidden)item.FindControl("hidOrganisationReferenceId")).Value);
                string referenceValue = ((TextBox)item.FindControl("txtReferenceValue")).Text;

                // Create a new reference and add it to the reference collection
                Entities.JobReference jobReference = new Entities.JobReference();
                jobReference.JobId = m_jobId;
                jobReference.Value = referenceValue;
                jobReference.OrganisationReference = facOrganisationReference.GetReferenceForOrganisationReferenceId(referenceId);
                references.Add(jobReference);
            }

            Facade.IJob facJob = new Facade.Job();
            facJob.ChangeClient(m_jobId, identityId, references, ((Entities.CustomPrincipal)Page.User).UserName);

            mwhelper.CloseForm     = true;
            mwhelper.CausePostBack = true;
            mwhelper.OutputData    = "<changeClient />";
        }
Ejemplo n.º 6
0
        private void PopulateFilter()
        {
            Facade.Resource facResource = new Facade.Resource();
            Facade.IOrganisationLocation facOrganiastionLocation = new Facade.Organisation();

            //resource types
            var resourceTypes = facResource.GetAllResourceTypes();

            cboResourceTypes.DataSource     = resourceTypes.Tables[0];
            cboResourceTypes.DataTextField  = "Description";
            cboResourceTypes.DataValueField = "ResourceTypeId";
            cboResourceTypes.DataBind();

            string driverTypeName = Enum.GetName(typeof(eResourceType), eResourceType.Driver);

            cboResourceTypes.Items.FindByText(driverTypeName).Selected = true;

            //driver types
            var driverTypes = facResource.GetAllDriverTypes();

            cboDriverTypes.DataSource     = driverTypes.Tables[0];
            cboDriverTypes.DataTextField  = "Description";
            cboDriverTypes.DataValueField = "DriverTypeID";
            cboDriverTypes.DataBind();
            cboDriverTypes.Items.Insert(0, new ListItem("-- all --", "0"));

            //depots
            cboDepots.DataSource     = facOrganiastionLocation.GetAllDepots(Orchestrator.Globals.Configuration.IdentityId);
            cboDepots.DataValueField = "OrganisationLocationId";
            cboDepots.DataTextField  = "OrganisationLocationName";
            cboDepots.DataBind();
            cboDepots.Items.Insert(0, new ListItem("-- all --", "0"));
        }
Ejemplo n.º 7
0
        private void PopulateStaticControls()
        {
            Facade.ExtraType facExtraType = new Orchestrator.Facade.ExtraType();

            //cboExtraType.DataSource = facExtraType.GetForIsEnabled(getActiveExtraTypes); // Enum.GetNames(typeof(eExtraType));

            //Get all Extras that apply to Subbies AND Pallet Networks
            //At present this will only be the Hub Charge and at some point the Network and Subby Extras
            //may need to be dealt with seperately
            cboExtraType.DataSource = facExtraType.GetForAppliesTo(new List <eExtraAppliesTo>
            {
                eExtraAppliesTo.SubContractor, eExtraAppliesTo.Network
            });

            cboExtraType.DataValueField = "ExtraTypeId";
            cboExtraType.DataTextField  = "Description";
            cboExtraType.DataBind();
            cboExtraType.Items.Insert(0, "");

            cboSelectExtraState.DataSource = Enum.GetNames(typeof(eExtraState));
            cboSelectExtraState.DataBind();
            cboSelectExtraState.Items.RemoveAt((int)eExtraState.Invoiced - 1);
            cboSelectExtraState.Items.Insert(0, "");

            if (m_IdentityId != 0)
            {
                //Get the Client name for id.
                Facade.IOrganisation facOrg = new Facade.Organisation();
                string name = facOrg.GetNameForIdentityId(m_IdentityId);

                cboSubContractor.SelectedValue = m_IdentityId.ToString();
                cboSubContractor.Text          = name;
            }
        }
        private void PopulateStaticControls()
        {
            Facade.ExtraType facExtraType        = new Orchestrator.Facade.ExtraType();
            bool?            getActiveExtraTypes = true;

            cboExtraType.DataSource     = facExtraType.GetForIsEnabled(getActiveExtraTypes); // Enum.GetNames(typeof(eExtraType));
            cboExtraType.DataValueField = "ExtraTypeId";
            cboExtraType.DataTextField  = "Description";
            cboExtraType.DataBind();
            cboExtraType.Items.Insert(0, "");

            cboSelectExtraState.DataSource = Enum.GetNames(typeof(eExtraState));
            cboSelectExtraState.DataBind();
            cboSelectExtraState.Items.RemoveAt((int)eExtraState.Invoiced - 1);
            cboSelectExtraState.Items.Insert(0, "");

            if (m_IdentityId != 0)
            {
                //Get the Client name for id.
                Facade.IOrganisation facOrg = new Facade.Organisation();
                string name = facOrg.GetNameForIdentityId(m_IdentityId);

                cboClient.SelectedValue = m_IdentityId.ToString();
                cboClient.Text          = name;
            }
        }
Ejemplo n.º 9
0
        private void PopulateClientsCustomers()
        {
            using (Facade.Organisation facOrganisation = new Facade.Organisation())
                dgClients.DataSource = facOrganisation.GetAllForType((int)eOrganisationType.ClientCustomer);

            dgClients.DataBind();
        }
        private void cboDepot_ItemsRequested(object sender, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
        {
            cboDepot.Items.Clear();

            Facade.IOrganisationLocation facOrgLoc = new Facade.Organisation();
            DataSet ds = facOrgLoc.GetAllDepots(Orchestrator.Globals.Configuration.IdentityId);

            DataTable dt = ds.Tables[0];

            Telerik.Web.UI.RadComboBoxItem rcItem = null;
            rcItem       = new Telerik.Web.UI.RadComboBoxItem();
            rcItem.Text  = "All";
            rcItem.Value = "0";
            cboDepot.Items.Add(rcItem);

            List <Telerik.Web.UI.RadComboBoxItem> comboItems = new List <Telerik.Web.UI.RadComboBoxItem>();

            dt.Rows.Cast <DataRow>().ToList().ForEach(row => comboItems.Add(
                                                          new Telerik.Web.UI.RadComboBoxItem
            {
                Text  = row["OrganisationLocationName"].ToString(),
                Value = row["OrganisationLocationId"].ToString()
            }));
            comboItems.Sort((item1, item2) => item1.Text.CompareTo(item2.Text));
            cboDepot.Items.AddRange(comboItems);
        }
Ejemplo n.º 11
0
        private void BindRepeater()
        {
            Facade.IBusinessType facBusinessType = new Facade.BusinessType();
            Facade.IOrganisation facOrganisation = new Facade.Organisation();

            var selectedDrivers = hidSelectedDriversValues.Value;
            var driverList      = selectedDrivers.Split(',').ToList();

            Facade.IDriver facDriver = new Facade.Resource();

            DataSet ds = facDriver.GetAllDrivers(false);

            var drivers = from driver in ds.Tables[0].AsEnumerable()
                          select driver;

            if (!cbSelectedAllDrivers.Checked)
            {
                drivers = from driver in ds.Tables[0].AsEnumerable()
                          where driverList.Contains(driver.Field <int>("ResourceId").ToString())
                          select driver;
            }

            repDrivers.DataSource = drivers;
            repDrivers.DataBind();

            grdSummary.Rebind();

            AllWorkForDriver = null;
        }
Ejemplo n.º 12
0
        private void PopulateStaticControls()
        {
            // Bind the control areas
            using (Facade.IControlArea facControlArea = new Facade.Traffic())
                cboControlArea.DataSource = facControlArea.GetAll();
            cboControlArea.DataBind();
            cboControlArea.Items.Insert(0, new ListItem("All", "0"));

            // Pre-populate fields if qs elements present
            if (Request.QueryString["prepop"] == "true")
            {
                m_popupJobId = Request.QueryString["jid"];

                cboControlArea.SelectedIndex = Convert.ToInt32(Request.QueryString["ca"]);
                if (Request.QueryString["oi"] != string.Empty)
                {
                    using (Facade.IOrganisation facOrganisation = new Facade.Organisation())
                    {
                        Entities.Organisation client = facOrganisation.GetForIdentityId(Convert.ToInt32(Request.QueryString["oi"]));
                        cboClient.Text          = client.OrganisationName;
                        cboClient.SelectedValue = client.IdentityId.ToString();
                    }
                }
            }
        }
Ejemplo n.º 13
0
        private void PopulateStaticControls()
        {
            cboJobState.DataSource = Enum.GetNames(typeof(eJobState));
            cboJobState.DataBind();
            cboJobState.SelectedValue = eJobState.ReadyToInvoice.ToString();

            // Invoice Sort Type
            rdoSortType.DataSource = Enum.GetNames(typeof(eInvoiceSortType));
            rdoSortType.DataBind();
            rdoSortType.Items[0].Selected = true;

            // Invoice Type
            rdoInvoiceType.Items.Add(new ListItem("Normal Invoice/Self Bill"));
            rdoInvoiceType.Items.Add(new ListItem("Sub Contractor"));
            //rdoInvoiceType.Items[0].Selected = true;

            if (m_IdentityId != 0)
            {
                //Get the Client name for id.
                Facade.IOrganisation facOrg = new Facade.Organisation();
                string name = facOrg.GetNameForIdentityId(m_IdentityId);

                cboClient.SelectedValue = m_IdentityId.ToString();
                cboClient.Text          = name;

                // Add client specific references to sort collection
                Facade.IOrganisationReference            facOrgRef = new Facade.Organisation();
                Entities.OrganisationReferenceCollection eOrf      = facOrgRef.GetReferencesForOrganisationIdentityId(m_IdentityId, true);

                foreach (Entities.OrganisationReference ocr in eOrf)
                {
                    rdoSortType.Items.Add(new ListItem(ocr.Description));
                }
            }
        }
        public List <ClientTurnover> GetClientTurnover(int identityID)
        {
            DataSet ds = new Facade.Organisation().GetClientRevenuePerMonthReport(DateTime.Today.AddMonths(-13), DateTime.Today, false, true, (dateTime) => string.Format("{0} {1}", dateTime.ToString("MMM"), dateTime.Year));

            DataRow[] row = ds.Tables[0].Select("IdentityID = " + identityID.ToString());

            try
            {
                List <ClientTurnover> retVal = new List <ClientTurnover>();
                if (row.Length > 0)
                {
                    foreach (DataColumn col in ds.Tables[0].Columns)
                    {
                        if (col.ColumnName == "IdentityID" || col.ColumnName == "Customer")
                        {
                            continue;
                        }

                        retVal.Add(new ClientTurnover()
                        {
                            Label = col.ColumnName.Replace("20", ""), Value = row[0][col.ColumnName] == DBNull.Value ? 0 : double.Parse(row[0][col.ColumnName].ToString())
                        });
                    }
                }


                return(retVal);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public UninvoiceWork GetAllUninvoicedWork(int identityID)
        {
            Facade.IOrganisation facOrg  = new Facade.Organisation();
            DateTime             endDate = DateTime.Today.AddMonths(-1);

            // this has been amended to look up to the end of the previous month
            System.Globalization.Calendar cal = System.Globalization.CultureInfo.CurrentCulture.Calendar;
            endDate = new DateTime(endDate.Year, endDate.Month, cal.GetDaysInMonth(endDate.Year, endDate.Month));

            DataSet ds = facOrg.GetAllUninvoicedWorkForOrganisation(identityID, DateTime.Today.AddYears(-1), endDate, true, true, true);

            try
            {
                int     orderCount = 0;
                decimal orderValue = 0;
                foreach (DataRow row in ds.Tables[1].Rows)
                {
                    orderCount += (int)row["CountOfJobs"];
                    orderValue += (decimal)row["Total Charge Amount"];
                }

                UninvoiceWork retVal = new UninvoiceWork()
                {
                    NumberOfOrders = orderCount, ValueOfOrders = orderValue
                };
                return(retVal);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 16
0
        private void LoadOrganisation()
        {
            // Retrieve the organisation and place it in viewstate
            Facade.IOrganisation facOrganisation = new Facade.Organisation();
            m_organisation               = facOrganisation.GetForIdentityId(m_identityId);
            m_organisationName           = m_organisation.OrganisationName;
            ViewState[C_ORGANISATION_VS] = m_organisation;

            txtOrganisationName.Text = m_organisation.OrganisationName;

            ddStatuses.SelectedValue          = ((int)m_organisation.IdentityStatus).ToString();
            m_originalStatus                  = m_organisation.IdentityStatus;
            ViewState[C_ORIGINALSTATUS_ID_VS] = m_originalStatus;

            // Set the update buttons and labels
            btnAddLocation.Enabled = true;
            btnAdd.Text            = "Update";

            PopulateLocations();

            Repositories.DTOs.GeofenceNotificationSettings settings = facOrganisation.GetSettings(m_identityId);
            if (settings != null)
            {
                cbNotifyWhen_ItemsRequested(cbNotifyWhen, null);

                chkBoxEnableNotification.Checked = settings.Enabled;
                cbNotificationType.SelectedValue = settings.NotificationType.ToString();
                cbNotifyWhen.SelectedValue       = settings.NotifyWhen.ToString();
                txtContactDetail.Text            = settings.Recipient;
            }
        }
        /// <summary>
        /// Updates the reference
        /// </summary>
        /// <returns>true if the update succeeded, false otherwise</returns>
        private bool UpdateReference()
        {
            Facade.IOrganisationReference facOrganisationReference = new Facade.Organisation();
            string userId = ((Entities.CustomPrincipal)Page.User).UserName;

            return(facOrganisationReference.Update(m_reference, userId));
        }
Ejemplo n.º 18
0
        private string GetAssignedResource(Entities.Job job, Entities.Instruction instruction, Entities.Order order)
        {
            if (instruction.Driver != null)
            {
                return(instruction.Driver.Individual.FullName);
            }
            else
            {
                // May be sub-contracted.
                var jobSubContracts = job.SubContractors.Cast <Entities.JobSubContractor>();
                var facOrganisation = new Facade.Organisation();

                if (jobSubContracts.Any(jsc => jsc.SubContractWholeJob))
                {
                    // Whole job sub-contracted out.
                    return(facOrganisation.GetNameForIdentityId(jobSubContracts.First(jsc => jsc.SubContractWholeJob).ContractorIdentityId));
                }
                else if (jobSubContracts.Any(jsc => jsc.JobSubContractID == instruction.JobSubContractID))
                {
                    // Per-instruction sub-contracted out.
                    return(facOrganisation.GetNameForIdentityId(jobSubContracts.First(jsc => jsc.JobSubContractID == instruction.JobSubContractID).ContractorIdentityId));
                }
                else if (instruction.InstructionTypeId == (int)eInstructionType.Drop && jobSubContracts.Any(jsc => jsc.JobSubContractID == order.JobSubContractID))
                {
                    // Sub-contracted for delivery.
                    return(facOrganisation.GetNameForIdentityId(jobSubContracts.First(jsc => jsc.JobSubContractID == order.JobSubContractID).ContractorIdentityId));
                }
            }

            // No resource assigned.
            return(String.Empty);
        }
Ejemplo n.º 19
0
        private void ConfigureClientReferences()
        {
            if (m_isUpdate)
            {
                // Populate the repeater control with the current reference fields
                Entities.OrganisationReferenceCollection clientReferences = new Entities.OrganisationReferenceCollection();
                foreach (Entities.JobReference reference in m_job.References)
                {
                    clientReferences.Add(reference.OrganisationReference);
                }

                repReferences.DataSource = clientReferences;
                repReferences.DataBind();
            }
            else
            {
                Facade.IOrganisationReference facOrganisationReference = new Facade.Organisation();
                m_clientReferences = facOrganisationReference.GetReferencesForOrganisationIdentityId(m_job.IdentityId, true);

                if (m_clientReferences != null)
                {
                    // Populate the repeater control with the required reference fields
                    repReferences.DataSource = m_clientReferences;
                    repReferences.DataBind();
                }
            }
        }
Ejemplo n.º 20
0
        private void ConfigureOrganisationReferences()
        {
            // Add any custom organisation reference fields
            Facade.IOrganisation facOrganisation = new Facade.Organisation();
            var organisationReferences           = facOrganisation.GetAllOrganisationReferences().Tables[0].AsEnumerable();

            if (organisationReferences.Any())
            {
                var groupedReferences = organisationReferences.GroupBy(or => or.Field <string>("Description"));

                foreach (var gr in groupedReferences)
                {
                    var columnDescription = gr.Key;
                    var uniqueName        = OrganisationReferenceColumnUniqueName(columnDescription);

                    // Add a check box to allow the user to toggle visibility of this column
                    var listItem = new ListItem(columnDescription, uniqueName);
                    listItem.Attributes["title"] = gr.Count() > 10 ? string.Format("{0} clients", gr.Count()) : Entities.Utilities.MergeStrings("\n", gr.Select(or => or.Field <string>("OrganisationName")));
                    this.cblOrganisationReferenceColumns.Items.Add(listItem);

                    // Add the column to the grid
                    var column = new GridTemplateColumn();
                    this.grdOrders.MasterTableView.Columns.Add(column);
                    column.UniqueName = uniqueName;
                    column.HeaderText = columnDescription;
                    column.Visible    = false;
                }
            }
        }
Ejemplo n.º 21
0
        private void PopulateType(bool useClientDefaults)
        {
            eJobType       jobType       = eJobType.Normal;
            eJobChargeType jobChargeType = eJobChargeType.Job;
            decimal        chargeAmount  = 0;

            if (useClientDefaults)
            {
                Facade.IOrganisation  facOrganisation = new Facade.Organisation();
                Entities.Organisation client          = facOrganisation.GetForIdentityId(m_job.IdentityId);

                if (client.Defaults != null && client.Defaults.Count > 0)
                {
                    jobType = (eJobType)client.Defaults[0].JobTypeId;
                }
            }
            else
            {
                // Get the values from the Job object
                jobType       = m_job.JobType;
                jobChargeType = m_job.Charge.JobChargeType;
                chargeAmount  = m_job.Charge.JobChargeAmount;
            }

            cboChargeType.ClearSelection();
            cboChargeType.Items.FindByValue(Utilities.UnCamelCase(Enum.GetName(typeof(eJobChargeType), jobChargeType))).Selected = true;

            ConfigureChargeAmount(jobChargeType);

            txtChargeAmount.Text = chargeAmount.ToString("F2");

            chkIsStockMovement.Checked = m_job.IsStockMovement;
        }
Ejemplo n.º 22
0
        private void PrepareOrders()
        {
            if (!IsPostBack)
            {
                OrdersCSV = PreviousPage.Orders;
            }

            Facade.IOrder facOrder = new Facade.Order();
            DataSet       dsOrders = facOrder.GetOrdersForList(OrdersCSV, true, false);

            Facade.IOrganisation  facOrg   = new Facade.Organisation();
            Entities.Organisation org      = facOrg.GetForIdentityId(Globals.Configuration.IdentityId);
            Facade.IPoint         facPoint = new Facade.Point();
            Entities.Point        deliveryRunCollectionPoint = null;
            if (org.Defaults[0].GroupageDeliveryRunCollectionPoint > 0)
            {
                deliveryRunCollectionPoint = facPoint.GetPointForPointId(org.Defaults[0].GroupageDeliveryRunCollectionPoint);
            }

            dsOrders.Tables[0].Columns.Add("CollectFromPointID", typeof(int));
            dsOrders.Tables[0].Columns.Add("CollectFromPoint", typeof(string));
            dsOrders.Tables[0].Columns.Add("CollectAtDateTime", typeof(DateTime));
            dsOrders.Tables[0].Columns.Add("CollectAtAnyTime", typeof(bool));
            dsOrders.Tables[0].Columns.Add("LoadOrder", typeof(string));
            dsOrders.Tables[0].Columns.Add("DeliveryOrder", typeof(int));

            int loadOrder = 1;

            foreach (DataRow row in dsOrders.Tables[0].Rows)
            {
                row["CollectFromPointID"] = (int)row["DeliveryRunCollectionPointID"];
                row["CollectFromPoint"]   = row["DeliveryRunCollectionPointDescription"].ToString();
                row["CollectAtDateTime"]  = (DateTime)row["DeliveryRunCollectionDateTime"];
                row["CollectAtAnyTime"]   = (bool)row["DeliveryRunCollectionIsAnyTime"];
                if (loadOrder == dsOrders.Tables[0].Rows.Count)
                {
                    row["LoadOrder"] = "L";
                }
                else
                {
                    row["LoadOrder"] = loadOrder.ToString();
                }
                loadOrder++;

                // Set the default collection point to that specified by the organisation settings
                if (row["LastPlannedOrderActionID"] == DBNull.Value)
                {
                    if (deliveryRunCollectionPoint != null)
                    {
                        row["CollectFromPointID"] = deliveryRunCollectionPoint.PointId;
                        row["CollectFromPoint"]   = deliveryRunCollectionPoint.Description;
                    }
                }
            }

            dsOrders.AcceptChanges();
            OrderData = dsOrders;
            grdOrders.Rebind();
        }
Ejemplo n.º 23
0
        private DataSet GetData()
        {
            DateTime startDate = dteStartDate.SelectedDate.Value;
            DateTime endDate   = dteEndDate.SelectedDate.Value;

            Facade.IOrganisation facOrganisation = new Facade.Organisation();
            return(facOrganisation.GetSubcontractorCostsPerMonthReport(startDate, endDate, IncludeTotalsPerClient, IncludeTotalsPerMonth));
        }
Ejemplo n.º 24
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Orchestrator.WebUI.Security.Authorise.EnforceAuthorisation(eSystemPortion.GeneralUsage);

            m_reportType = Convert.ToString(Request.QueryString["reportType"]);
            m_pcvId      = Convert.ToInt32(Request.QueryString["PCVId"]);

            btnGenerateReport.Attributes.Add("onclick", "ClearQueryString()");

            switch (m_reportType)
            {
            case "beingRedeemed":
                h1Text.Text = "PCVs Being Redeemed.";
                h2Text.Text = "A list of PCVs being taken for redemption on runs during the specified period is displayed below.";
                break;

            case "outstanding":
                h1Text.Text = "PCVs Awaiting Redemption";
                h2Text.Text = "A list of PCVs which have not been Redeemed or Posted to B&M For Dehire is displayed below";
                break;
            }

            if (!IsPostBack && m_reportType != null)
            {
                // If a different report type, clear the session variables used for sorting.
                if (Convert.ToString(Session["ReportType"]) != m_reportType)
                {
                    ClearSessionVariables();
                }

                if (Session["ClientId"] != null || (Session["DateFrom"] != null && Session["DateTo"] != null))
                {
                    if (Session["ClientId"] != null)
                    {
                        string clientId = Convert.ToString(Session["ClientId"]);
                        Facade.IOrganisation facOrganisation = new Facade.Organisation();
                        string clientName = facOrganisation.GetNameForIdentityId(int.Parse(clientId));
                        cboClient.SelectedValue = clientId;
                        cboClient.Text          = clientName;
                    }
                    dteDateFrom.SelectedDate = Session["DateFrom"] != null ? (DateTime?)Session["DateFrom"] : (DateTime?)null;
                    dteDateTo.SelectedDate   = Session["DateTo"] != null ? (DateTime?)Session["DateTo"] : (DateTime?)null;
                    LoadReport();
                }
                else
                {
                    // Default period from yesterday to today
                    dteDateFrom.SelectedDate = DateTime.Today - new TimeSpan(1, 0, 0, 0);
                    dteDateTo.SelectedDate   = DateTime.Today;
                }
                if (Session["Sort"] != null)
                {
                    // Load the report without user intervention, since sorting a current
                    // report.
                    LoadReport();
                }
            }
        }
Ejemplo n.º 25
0
        void grdOrganisations_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            DataSet ds = null;

            using (Facade.Organisation facOrganisation = new Facade.Organisation())
                ds = facOrganisation.GetAllForTypeFiltered((int)eOrganisationType.SubContractor, rowFilter, chkShowDeleted.Checked);

            grdOrganisations.DataSource = ds.Tables[0];
        }
Ejemplo n.º 26
0
        private void PopulateJobInformation()
        {
            // Populate the Job fieldset.
            lblJobId.Text = m_jobId.ToString();
            ucJobStateIndicator.JobState = m_job.JobState;
            lblJobType.Text = Utilities.UnCamelCase(m_job.JobType.ToString());
            if (m_job.CurrentTrafficArea == null)
            {
                lblCurrentTrafficArea.Text = "Unknown";
            }
            else
            {
                lblCurrentTrafficArea.Text = m_job.CurrentTrafficArea.TrafficAreaName;
            }

            // Populate the Job Details fieldset.
            Facade.IOrganisation  facOrganisation = new Facade.Organisation();
            Entities.Organisation client          = facOrganisation.GetForIdentityId(m_job.IdentityId);
            lblLoadNumber.Text     = m_job.LoadNumber;
            lblLoadNumberText.Text = client.LoadNumberText;
            if (m_job.JobType == eJobType.Return)
            {
                lblReturnReferenceNumber.Text = m_job.ReturnReceiptNumber;
            }
            else
            {
                lblReturnReferenceNumber.Text = "N/A";
            }
            int numberOfPallets = 0;

            foreach (Entities.Instruction instruction in m_job.Instructions)
            {
                if (instruction.InstructionTypeId == (int)eInstructionType.Load)
                {
                    numberOfPallets = numberOfPallets + instruction.TotalPallets;
                }
            }

            lblNumberOfPallets.Text = numberOfPallets.ToString();
            if (m_job.ForCancellation)
            {
                lblMarkedForCancellation.Text = "Yes - " + m_job.ForCancellationReason;
            }
            else
            {
                lblMarkedForCancellation.Text = "No";
            }

            if (m_job.PCVs.Count > 0)
            {
                lblTakingPCVs.Text = "YES - INFORM DRIVER";
            }
            else
            {
                lblTakingPCVs.Text = "No";
            }
        }
Ejemplo n.º 27
0
        private DataSet GetData()
        {
            DateTime startDate = dteStartDate.SelectedDate.Value;
            DateTime endDate   = dteEndDate.SelectedDate.Value;

            Facade.IOrganisation    facOrganisation = new Facade.Organisation();
            Func <DateTime, string> dateFormatter   = (dateTime) => string.Format("{0} {1}", dateTime.ToString("MMM"), dateTime.Year);

            return(facOrganisation.GetClientRevenuePerMonthReport(startDate, endDate, IncludeTotalsPerClient, IncludeTotalsPerMonth, dateFormatter));
        }
Ejemplo n.º 28
0
        private void ConfigureDisplay()
        {
            if (!string.IsNullOrEmpty(Request.QueryString[c_customerID_QS]))
            {
                int id = int.Parse(Request.QueryString[c_customerID_QS]);
                Facade.IOrganisation facOrganisation = new Facade.Organisation();

                organisation = facOrganisation.GetForIdentityId(id);

                RadComboBoxItem listItem = new RadComboBoxItem(organisation.OrganisationDisplayName, organisation.IdentityId.ToString());
                cboClient.Items.Add(listItem);
                cboClient.SelectedValue = organisation.IdentityId.ToString();

                hidSelectedClientsValues.Value = organisation.IdentityId.ToString() + ",";
                hidSelectedClientsText.Value   = organisation.OrganisationDisplayName + ",";
            }

            DateTime startDate = DateTime.Today.AddMonths(-1);

            System.Globalization.GregorianCalendar cal = new System.Globalization.GregorianCalendar();


            if (!string.IsNullOrEmpty(Request.QueryString[c_startDate_QS]))
            {
                this.rdiStartDate.SelectedDate = DateTime.Parse(Request.QueryString[c_startDate_QS], null, System.Globalization.DateTimeStyles.RoundtripKind);
            }
            else
            {
                this.rdiStartDate.SelectedDate = new DateTime(startDate.Year, startDate.Month, 01);
            }

            if (!string.IsNullOrEmpty(Request.QueryString[c_endDate_QS]))
            {
                this.rdiEndDate.SelectedDate = DateTime.Parse(Request.QueryString[c_endDate_QS], null, System.Globalization.DateTimeStyles.RoundtripKind);
            }
            else
            {
                this.rdiEndDate.SelectedDate = new DateTime(startDate.Year, startDate.Month, cal.GetDaysInMonth(startDate.Year, startDate.Month));
            }


            lblMode.Text = IsClient ? "Client" : "Sub-Contractor";

            if (!string.IsNullOrEmpty(cboClient.SelectedValue) &&
                !string.IsNullOrEmpty(Request.QueryString[c_startDate_QS]) &&
                !string.IsNullOrEmpty(Request.QueryString[c_endDate_QS]))
            {
                Refresh();
            }

            this.rfvCboClient.Enabled = !IsClient;

            seSelectedClients.Visible = lblSelectedClients.Visible = btnRemoveSelectedClients.Visible = btnAddCboClient.Visible = IsClient;
        }
Ejemplo n.º 29
0
        protected void LoadInvoicePreparationProgress()
        {
            Facade.IInvoice facProgress = new Facade.Invoice();

            string userName = ((Entities.CustomPrincipal)Page.User).UserName;

            ClearFields();

            m_InvoicePreparation = facProgress.LoadInvoicePreparationProgress(userName);

            // Load Params If Entity Is Populated
            if (m_InvoicePreparation != null)
            {
                lblSaveProgressNotification.Visible   = true;
                lblSaveProgressNotification.ForeColor = Color.SeaGreen;
                lblSaveProgressNotification.Text      = "The progress of your last search has been loaded.  You can turn this off using the 'Clear Filter' button.";

                cboClient.SelectedValue = m_InvoicePreparation.ClientId.ToString();
                m_IdentityId            = Convert.ToInt32(m_InvoicePreparation.ClientId.ToString());
                Facade.IOrganisation facOrganisation = new Facade.Organisation();
                cboClient.Text = facOrganisation.GetForIdentityId(m_InvoicePreparation.ClientId).OrganisationName;

                dteStartDate.SelectedDate = m_InvoicePreparation.StartDate;
                dteEndDate.SelectedDate   = m_InvoicePreparation.EndDate;

                // Load Array List To Grid After Loaded
                jobIdCSV = m_InvoicePreparation.JobIdCSV; // ie: '234,234,233'

                hidSelectedJobs.Value = "," + jobIdCSV;

                if (jobIdCSV != null && jobIdCSV.Length > 0)
                {
                    m_selectedJobs.Clear();

                    string[] jobIds = jobIdCSV.Split(',');

                    foreach (string jobId in jobIds)
                    {
                        m_selectedJobs.Add(jobId);
                    }

                    LoadGrid();

                    btnSaveFilter.Visible = true;
                }
            }
            else
            {
                lblSaveProgressNotification.Visible   = true;
                lblSaveProgressNotification.ForeColor = Color.Red;
                lblSaveProgressNotification.Text      = "No filter progress found.";
                btnLoadFilter.Visible = false;
            }
        }
Ejemplo n.º 30
0
 void cfvOwner_ServerValidate(object source, ServerValidateEventArgs args)
 {
     args.IsValid = true;
     if (cboOwner.SelectedValue == string.Empty)
     {
         // A new organisation is being created.
         Facade.IOrganisation  facOrganisation      = new Facade.Organisation();
         Entities.Organisation existingOrganisation = facOrganisation.GetForName(cboOwner.Text);
         args.IsValid = existingOrganisation == null;
     }
 }