Ejemplo n.º 1
0
        protected void ShowCorrectPanels()
        {
            ButtonRevert.Visible              = true;
            ButtonContinue.Visible            = true;
            ButtonPrintAndProcess.Visible     = false;
            ButtonNewOrder.Visible            = false;
            ButtonDestroyOrderAndBack.Visible = false;
            URLPopUpControlRentOut.Visible    = false;
            URLPopUpControlRentSwap.Visible   = false;

            HideAllPanels();

            switch (CurrentPanelLevel)
            {
            case 1:
                ButtonRevert.Visible             = false;
                PanelCustomerInformation.Visible = true;
                PanelCustomerInformation.Enabled = true;
                break;

            case 2:
                // check if required fields are filled
                if ((DropDownListCustomers.Text != "") && (TextBox_Description.Text != ""))
                {
                    if (LabelCustID.Text != DropDownListCustomers.SelectedValue)
                    {
                        LabelCustID.Text = DropDownListCustomers.SelectedValue;

                        DropDownListCustomerLocations.DataBind();
                        DropDownListProjects.DataBind();
                        DropDownListCustomerFreights.DataBind();

                        URLPopUpControlNewCustomerLocation.URLToPopup = "WebFormPopUp.aspx?uc=CustomerRelationLocationOverview&Id=" + LabelCustID.Text;
                        URLPopUpControlNewCustomerProject.URLToPopup  = "WebFormPopUp.aspx?uc=CustomerRelationProjectOverview&Id=" + LabelCustID.Text;
                    }
                    PanelCustomerInformation.Visible = true;
                    PanelCustomerDetails.Visible     = true;
                    PanelCustomerDetails.Enabled     = true;
                    EntityDataSourceMaterialsContractsAndAgreements.CommandParameters["CustID"].DefaultValue = LabelCustID.Text;
                }
                else
                {
                    CurrentPanelLevel = CurrentPanelLevel - 1;
                    ShowCorrectPanels();
                }
                break;

            case 3:
                WebUserControlEditOrderMaterials1.CustomerID  = new System.Guid(DropDownListCustomers.SelectedValue);
                WebUserControlEditOrderMaterials1.LocationID  = new System.Guid(DropDownListLocations.SelectedValue);
                WebUserControlEditAdvancePayments1.CustomerID = new System.Guid(DropDownListCustomers.SelectedValue);

                if (!DriverAndIdCheckOK())
                {
                    Page.RegisterClientScriptBlock("Alert", "<script>alert('Geef een chauffeur of kenteken op. Eén van deze twee velden is verplicht.');</script>");
                    LabelCurrentPanelLevel.Text = "2";
                    ShowCorrectPanels();
                    break;
                }

                // check if there is a freight to be linked
                LabelFreightGuid.Text = DropDownListCustomerFreights.SelectedValue;

                PanelCustomerInformation.Visible = true;
                PanelCustomerDetails.Visible     = true;
                PanelMaterials.Visible           = true;
                PanelMaterials.Enabled           = true;

                WebUserControlEditOrderMaterials1.LoadOrderLines();
                ButtonContinue.Visible = WebUserControlEditOrderMaterials1.OrderLines.Count > 0;
                break;

            case 4:
                PanelCustomerInformation.Visible = true;
                PanelCustomerDetails.Visible     = true;
                PanelMaterials.Visible           = true;
                PanelTotals.Visible = true;
                PanelTotals.Enabled = true;

                WebUserControlEditAdvancePayments1.LoadAPLines();
                ButtonPrintAndProcess.Visible = !WebUserControlEditAdvancePayments1.CustomerHasOpenAdvancePayments();
                ButtonContinue.Visible        = WebUserControlEditAdvancePayments1.CustomerHasOpenAdvancePayments();

                break;

            case 5:
                ButtonPrintAndProcess.Visible = true;
                ButtonContinue.Visible        = false;

                PanelCustomerInformation.Visible = true;
                PanelCustomerDetails.Visible     = true;
                PanelMaterials.Visible           = true;
                PanelTotals.Visible          = true;
                PanelAdvancePayments.Visible = true;
                PanelAdvancePayments.Enabled = true;

                // check if there are advance payments to correct, otherwise cycle to invoice
                if (!WebUserControlEditAdvancePayments1.CustomerHasOpenAdvancePayments())
                {
                    CurrentPanelLevel = CurrentPanelLevel + 1;
                    ShowCorrectPanels();
                }
                break;

            case 6:
                ButtonRevert.Visible              = false;
                ButtonContinue.Visible            = false;
                ButtonPrintAndProcess.Visible     = false;
                ButtonNewOrder.Visible            = true;
                ButtonDestroyOrderAndBack.Visible = true;

                PanelCustomerInformation.Visible = true;
                PanelCustomerDetails.Visible     = true;
                PanelMaterials.Visible           = true;
                PanelAdvancePayments.Visible     = true;
                PanelTotals.Visible = true;

                FrameShowInvoice.Attributes["src"] = "WebFormPopup.aspx?UC=ShowReport&d=DataSetInvoice&r=ReportInvoiceA4&Id=" + LabelGeneratedInvoiceId.Text.ToString();

                URLPopUpControlRentOut.Visible = true;
                string Identification = TextBox_YourDriverName.Text;
                if ((TextBox_YourTruckPlate.Text != "") && (Identification != ""))
                {
                    Identification = Identification + "/" + TextBox_YourTruckPlate.Text;
                }
                else
                {
                    Identification = TextBox_YourTruckPlate.Text;
                }
                URLPopUpControlRentOut.URLToPopup  = "WebFormPopup.aspx?UC=RentOut&LocId=" + DropDownListLocations.SelectedValue + "&CustId=" + DropDownListCustomers.SelectedValue + "&Identification=" + Identification + "&Description=" + TextBox_Description.Text;
                URLPopUpControlRentSwap.Visible    = true;
                URLPopUpControlRentSwap.URLToPopup = "WebFormPopup.aspx?UC=RentReturn&LocId=" + DropDownListLocations.SelectedValue + "&CustId=" + DropDownListCustomers.SelectedValue;

                //PanelPreviewInvoice.Style["display"] = "";
                PanelPreviewInvoice.Visible = true;
                PanelPreviewInvoice.Enabled = true;

                break;
            }
        }
Ejemplo n.º 2
0
 protected void URLPopUpControlNewCustomerLocation_OnPopupClosed(object sender, EventArgs e)
 {
     DropDownListCustomerLocations.DataBind();
 }