Esempio n. 1
0
        protected void grdVendedor_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                Response.Redirect("~/Security/frmCerrar.aspx");
            }

            try
            {
                if (e.Item is GridFooterItem)
                {
                    GridFooterItem footerItem    = e.Item as GridFooterItem;
                    string         strValorVenta = footerItem["ValorVenta"].Text;
                    strValorVenta = strValorVenta.Replace(",", string.Empty).Replace("$", string.Empty).Trim();

                    string strValorPlanificado = footerItem["ValorPlanificado"].Text;
                    strValorPlanificado = strValorPlanificado.Replace(",", string.Empty).Replace("$", string.Empty).Trim();

                    string strCostoVenta = footerItem["CostoVenta"].Text;
                    strCostoVenta = strCostoVenta.Replace(",", string.Empty).Replace("$", string.Empty).Trim();

                    if (decimal.Parse(strValorPlanificado) > 0)
                    {
                        footerItem["Avance"].Text = Math.Round((decimal.Parse(strValorVenta) / decimal.Parse(strValorPlanificado) * 100), 0).ToString() + "%";
                    }
                    else
                    {
                        footerItem["Avance"].Text = "100%";
                    }

                    if (decimal.Parse(strValorVenta) > 0)
                    {
                        footerItem["Rentabilidad"].Text = Math.Round(((decimal.Parse(strValorVenta) - decimal.Parse(strCostoVenta)) * 100 / decimal.Parse(strValorVenta)), 0).ToString() + "%";
                    }
                    else
                    {
                        footerItem["Rentabilidad"].Text = "100%";
                    }
                }
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
Esempio n. 2
0
        protected void rdgGlobal_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem       item        = (GridDataItem)e.Item;
                int?               vIdEmpleado = int.Parse(item.GetDataKeyValue("ID_EMPLEADO").ToString());
                HtmlGenericControl vCtrlDiv    = (HtmlGenericControl)item.FindControl("dvTabla");
                if (vCtrlDiv != null)
                {
                    vCtrlDiv.Controls.Add(GeneraHtml(vIdEmpleado));
                }
            }

            if (e.Item is GridFooterItem)
            {
                GridFooterItem footer = (GridFooterItem)e.Item;
                footer["PR_CUMPLIMIENTO"].Text = ObtenerFooter();
                footer["NB_PUESTO"].Text       = "Total:";
            }
        }
        //protected void rdComparativo_DetailTableDataBind(object sender, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
        //{
        //    GridDataItem vDataItem = (GridDataItem)e.DetailTableView.ParentItem;

        //    switch (e.DetailTableView.Name)
        //    {
        //        case "gtvComparativo":
        //            int vIdPuestoEvaluadoPeriodo = int.Parse(vDataItem.GetDataKeyValue("ID_PUESTO").ToString());
        //            int vIdEmpleado;
        //            decimal vPrCumplimiento = decimal.Parse(vDataItem.GetDataKeyValue("PR_CUMPLIMIENTO").ToString());
        //            ConsultaGeneralNegocio neg = new ConsultaGeneralNegocio();

        //            vIdEmpleado = int.Parse(vDataItem.GetDataKeyValue("ID_EMPLEADO").ToString());

        //            //List<E_REPORTE_COMPARATIVO_DETALLE> oListaDetalleExterna = vListaDetalle.Select(t => new E_REPORTE_COMPARATIVO_DETALLE{ DS_PERIODO = t.DS_PERIODO, ID_PERIODO = t.ID_PERIODO, NB_PUESTO = t.NB_PUESTO, PR_CUMPLIMIENTO = t.PR_CUMPLIMIENTO, PR_CUMPLIMIENTO_COMPARACION = vPrCumplimiento}).ToList();
        //            e.DetailTableView.DataSource = neg.ObtenerDetalleReporteComparativo(vIdPeriodo, vIdPuestoEvaluadoPeriodo, vXmlPeriodos, vIdEmpleado, vPrCumplimiento);

        //            break;
        //        default:
        //            break;
        //    }
        //}

        protected void rdComparativo_ItemDataBound(object sender, GridItemEventArgs e)
        {
            List <int> lista        = ContextoReportes.oReporteComparativo.Where(t => t.vIdReporteComparativo == vIdReporteComparativo).FirstOrDefault().vListaPeriodos;
            List <int> listPeriodos = new List <int>();

            listPeriodos = lista;
            List <SPE_OBTIENE_FYD_REPORTE_GLOBAL_Result> vLstEvaluadosReporte = new List <SPE_OBTIENE_FYD_REPORTE_GLOBAL_Result>();
            ConsultaGeneralNegocio negGen = new ConsultaGeneralNegocio();

            if (e.Item is GridDataItem)
            {
                GridDataItem item        = (GridDataItem)e.Item;
                int          vIdEmpleado = int.Parse(item.GetDataKeyValue("ID_EMPLEADO").ToString());
                foreach (int oPeriodo in listPeriodos)
                {
                    HtmlGenericControl vCtrlDiv = (HtmlGenericControl)item.FindControl(oPeriodo.ToString());
                    if (vCtrlDiv != null)
                    {
                        vCtrlDiv.Controls.Add(GeneraTablaHtml(oPeriodo, vIdEmpleado));
                    }
                }
            }

            if (e.Item is GridFooterItem)
            {
                GridFooterItem footer = (GridFooterItem)e.Item;
                foreach (int oPeriodo in listPeriodos)
                {
                    var vPeriodoo = negGen.ObtenerPeriodoEvaluacion(vIdPeriodo);
                    vLstEvaluadosReporte = negGen.ObtenerDatosReporteGlobal(oPeriodo, null, false).ToList();
                    if (vLstEvaluadosReporte != null && vLstEvaluadosReporte.Count > 0)
                    {
                        footer[oPeriodo.ToString()].Text = String.Format("{0:0.00}%", vLstEvaluadosReporte.Average(a => a.PR_CUMPLIMIENTO));
                    }
                    else
                    {
                        footer[oPeriodo.ToString()].Text = "0.00%";
                    }
                }
            }
        }
        protected void rGridTeam_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                //GridDataItem dataItem = e.Item as GridDataItem;
                int fieldValue = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "Points").ToString());
                totPointCount += fieldValue;

                RadBinaryImage rPrimPos = (RadBinaryImage)e.Item.FindControl("imgPrimPositon");
                RadBinaryImage rSecPos  = (RadBinaryImage)e.Item.FindControl("imgSecPositon");

                rPrimPos.ImageUrl = "~/Content/images/" + DataBinder.Eval(e.Item.DataItem, "PrimPos").ToString().Trim() + ".jpg";
                if (DataBinder.Eval(e.Item.DataItem, "SecPos") != null)
                {
                    rSecPos.ImageUrl = "~/Content/images/" + DataBinder.Eval(e.Item.DataItem, "SecPos").ToString().Trim() + ".jpg";
                }
                else
                {
                    rSecPos.Visible = false;
                }
            }
            if (e.Item is GridFooterItem)
            {
                GridFooterItem footerItem = e.Item as GridFooterItem;
                footerItem["Points"].Text = "total: " + totPointCount.ToString();
            }
            else if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                GridEditableItem edtItem     = (GridEditableItem)e.Item;
                Label            lblSeasonID = (Label)edtItem.FindControl("lblSeasonID");
                Label            lblTeamID   = (Label)edtItem.FindControl("lblTeamID");

                RadDropDownList rDDSeasonTeam = (RadDropDownList)edtItem.FindControl("rDDSeasonTeam");
                rDDSeasonTeam.DataSource     = SeasonTeamBLL.SeasonTeamOrder(Convert.ToInt32(lblSeasonID.Text));
                rDDSeasonTeam.DataValueField = "TeamID";
                rDDSeasonTeam.DataTextField  = "TeamName";
                rDDSeasonTeam.DataBind();
                rDDSeasonTeam.SelectedValue = lblTeamID.Text.ToString();
            }
        }
    private void LoadSessionDetails(DateTime selectdate)
    {
        try
        {
            DataSet dsSessionDetails = sqlobj.ExecuteSP("SP_GetDinersSessionDetails",
                                                        new SqlParameter()
            {
                ParameterName = "@Date", SqlDbType = SqlDbType.DateTime, Value = selectdate
            }

                                                        );

            if (dsSessionDetails.Tables[0].Rows.Count > 0)
            {
                rgDinersSessionDetails.DataSource = dsSessionDetails;
                rgDinersSessionDetails.DataBind();
            }
            else
            {
                rgDinersSessionDetails.DataSource = string.Empty;
                rgDinersSessionDetails.DataBind();
            }



            dsSessionDetails.Dispose();

            DateTime forday = Convert.ToDateTime(ddlDates.SelectedValue);

            GridFooterItem item = (GridFooterItem)rgDinersSessionDetails.MasterTableView.GetItems(GridItemType.Footer)[0];
            item["SessionName"].Text = forday.ToString("ddd") + ',' + ddlDates.SelectedValue;
        }
        catch (Exception ex)
        {
            WebMsgBox.Show(ex.Message);
        }
    }
Esempio n. 6
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        SqlProcsNew sqlobj = new SqlProcsNew();
        string      Uname  = Session["UserID"].ToString();

        if (HResult.Value == "true")
        {
            GridFooterItem    footeritem2 = (GridFooterItem)FoodBillingListView.MasterTableView.GetItems(GridItemType.Footer)[0];
            RadNumericTextBox Total2      = (RadNumericTextBox)footeritem2.FindControl("lblTotalAmnt");
            RadNumericTextBox PCount2     = (RadNumericTextBox)footeritem2.FindControl("lblPCount");
            if (Total2.Text != string.Empty)
            {
                foreach (GridItem rw in FoodBillingListView.Items)
                {
                    //DropDownList dlist = (DropDownList)rw.FindControl("ddlBillingCode");
                    //RadNumericTextBox BRate = (RadNumericTextBox)rw.FindControl("TxtBillCodeRate");
                    //var Total = (RadNumericTextBox)footeritem.FindControl("lblTotalAmnt");
                    //Decimal DailyTotal = Decimal.Parse(Total.Text.ToString());

                    int RTRSN = Convert.ToInt32(rw.Cells[3].Text);
                    RadNumericTextBox Bill        = (RadNumericTextBox)rw.FindControl("TxtBillFor");
                    int Billfor                   = Convert.ToInt32(Bill.Text.ToString());
                    RadNumericTextBox Amount      = (RadNumericTextBox)rw.FindControl("TxtAmnt");
                    Decimal           BillingRate = Convert.ToDecimal(lblSessionRate.Text.ToString());
                    GridFooterItem    footeritem  = (GridFooterItem)FoodBillingListView.MasterTableView.GetItems(GridItemType.Footer)[0];
                    Decimal           TAmount     = Decimal.Parse(Amount.Text.ToString());

                    try
                    {
                        CheckBox Check = (CheckBox)rw.FindControl("ChkConfirm");
                        if (Check.Checked == true)
                        {
                            sqlobj.ExecuteSQLNonQuery("[SP_InsertFoodBillPostingDtls]",
                                                      new SqlParameter()
                            {
                                ParameterName = "@IMODE", SqlDbType = SqlDbType.Int, Value = 1
                            },
                                                      new SqlParameter()
                            {
                                ParameterName = "@RTRSN", SqlDbType = SqlDbType.Int, Value = RTRSN
                            },
                                                      new SqlParameter()
                            {
                                ParameterName = "@BCode", SqlDbType = SqlDbType.NVarChar, Value = ddlSession.SelectedValue
                            },
                                                      new SqlParameter()
                            {
                                ParameterName = "@BRate", SqlDbType = SqlDbType.Decimal, Value = BillingRate
                            },
                                                      new SqlParameter()
                            {
                                ParameterName = "@Date", SqlDbType = SqlDbType.DateTime, Direction = ParameterDirection.Input, Value = BillingDate.SelectedDate.ToString()
                            },
                                                      new SqlParameter()
                            {
                                ParameterName = "@Bcount", SqlDbType = SqlDbType.Int, Value = Billfor
                            },
                                                      new SqlParameter()
                            {
                                ParameterName = "@BAmount", SqlDbType = SqlDbType.Decimal, Value = TAmount
                            },
                                                      new SqlParameter()
                            {
                                ParameterName = "@DTotAmount", SqlDbType = SqlDbType.Decimal, Value = Convert.ToDecimal(Total2.Text.ToString())
                            },
                                                      new SqlParameter()
                            {
                                ParameterName = "@EntryBy", SqlDbType = SqlDbType.NVarChar, Value = Uname
                            });
                        }
                        else
                        {
                        }
                    }

                    catch (Exception ex)
                    {
                        WebMsgBox.Show(ex.Message.ToString());
                    }
                }

                sqlobj.ExecuteSQLNonQuery("[SP_InsertGrpFoodBillLog]",
                                          new SqlParameter()
                {
                    ParameterName = "@BDate", SqlDbType = SqlDbType.DateTime, Direction = ParameterDirection.Input, Value = Convert.ToDateTime(BillingDate.SelectedDate.ToString())
                },
                                          new SqlParameter()
                {
                    ParameterName = "@BCode", SqlDbType = SqlDbType.NVarChar, Value = ddlSession.SelectedValue.ToString()
                },
                                          new SqlParameter()
                {
                    ParameterName = "@Dcount", SqlDbType = SqlDbType.Int, Value = Convert.ToInt16(PCount2.Text.ToString())
                },
                                          new SqlParameter()
                {
                    ParameterName = "@DTotAmount", SqlDbType = SqlDbType.Decimal, Value = Convert.ToDecimal(Total2.Text.ToString())
                },
                                          new SqlParameter()
                {
                    ParameterName = "@EntryBy", SqlDbType = SqlDbType.NVarChar, Value = Uname
                });

                WebMsgBox.Show("Bill Detail Saved.");
                LoadSession();
                LoadGrid();
                LoadGrid1();
            }

            else
            {
                WebMsgBox.Show("Please select the session.");
            }
        }



        else
        {
        }
    }
    protected void gvInviceCount_ItemDataBound(object sender, GridItemEventArgs e)
    {
        //foreach (GridDataItem dataItem in gvInviceCount.MasterTableView.Items)
        //{
        //    //TextBox txtLT = (TextBox)(dataItem.FindControl("txtRequest_Qty") as TextBox);
        //    //TextBox txtUNt = (TextBox)(dataItem.FindControl("txtUnitPrice") as TextBox);
        //    //TextBox txtDis = (TextBox)(dataItem.FindControl("txtDiscount") as TextBox);
        //    HiddenField lblID = (HiddenField)(dataItem.FindControl("lblID") as HiddenField);
        //    ImageButton btnDelete = (ImageButton)(dataItem.FindControl("ImgDelete") as ImageButton);


        //}

        if (e.Item is GridDataItem)
        {
            GridDataItem dataItem = e.Item as GridDataItem;
            if ((dataItem["Clean"].FindControl("btnClean") as Button).Text != "")
            {
                totalClean += int.Parse((dataItem["Clean"].FindControl("btnClean") as Button).Text);
            }
            if ((dataItem["Dirty"].FindControl("btnDirty") as Button).Text != "")
            {
                TotalDirty += int.Parse((dataItem["Dirty"].FindControl("btnDirty") as Button).Text);
            }
            if ((dataItem["DIRECTINV"].FindControl("btnDIRECTINV") as Button).Text != "")
            {
                TotalDirectInv += int.Parse((dataItem["DIRECTINV"].FindControl("btnDIRECTINV") as Button).Text);
            }
            if ((dataItem["LATEPO"].FindControl("btnLATEPO") as Button).Text != "")
            {
                TotalLatePO += int.Parse((dataItem["LATEPO"].FindControl("btnLATEPO") as Button).Text);
            }
            if ((dataItem["REWORKIN"].FindControl("btnREWORKIN") as Button).Text != "")
            {
                TotalReworkIN += int.Parse((dataItem["REWORKIN"].FindControl("btnREWORKIN") as Button).Text);
            }
            if ((dataItem["REWORKOUT"].FindControl("btnREWORKOUT") as Button).Text != "")
            {
                TotalReworkOut += int.Parse((dataItem["REWORKOUT"].FindControl("btnREWORKOUT") as Button).Text);
            }
            if ((dataItem["OTHERS"].FindControl("btnOTHERS") as Button).Text != "")
            {
                TotalOthers += int.Parse((dataItem["OTHERS"].FindControl("btnOTHERS") as Button).Text);
            }
            TotalInvoice = totalClean + TotalDirty + TotalDirectInv + TotalLatePO + TotalReworkIN + TotalReworkOut + TotalOthers;
        }
        else if (e.Item is GridFooterItem)
        {
            GridFooterItem footer = (GridFooterItem)e.Item;
            (footer["Clean"].FindControl("lblTotal_Clean") as Label).Text = totalClean.ToString();
            clientID = (footer["Clean"].FindControl("lblTotal_Clean") as Label).ClientID;

            (footer["Dirty"].FindControl("lblTotal_Dirty") as Label).Text = TotalDirty.ToString();
            clientID = (footer["Dirty"].FindControl("lblTotal_Dirty") as Label).ClientID;

            (footer["DIRECTINV"].FindControl("lblTotal_Direct") as Label).Text = TotalDirectInv.ToString();
            clientID = (footer["DIRECTINV"].FindControl("lblTotal_Direct") as Label).ClientID;

            (footer["LATEPO"].FindControl("lblTotal_LatePO") as Label).Text = TotalLatePO.ToString();
            clientID = (footer["LATEPO"].FindControl("lblTotal_LatePO") as Label).ClientID;

            (footer["REWORKIN"].FindControl("lblTotal_ReworkIN") as Label).Text = TotalReworkIN.ToString();
            clientID = (footer["REWORKIN"].FindControl("lblTotal_ReworkIN") as Label).ClientID;

            (footer["REWORKOUT"].FindControl("lblTotal_ReworkOUT") as Label).Text = TotalReworkOut.ToString();
            clientID = (footer["REWORKOUT"].FindControl("lblTotal_ReworkOUT") as Label).ClientID;

            (footer["OTHERS"].FindControl("lblTotal_Others") as Label).Text = TotalOthers.ToString();
            clientID = (footer["OTHERS"].FindControl("lblTotal_Others") as Label).ClientID;

            (footer["Report_Name"].FindControl("lblTotal_Invoice") as Label).Text = "Total" + "  " + TotalInvoice.ToString() + "  " + "Invoices";
            clientID = (footer["OTHERS"].FindControl("lblTotal_Others") as Label).ClientID;
        }
    }
Esempio n. 8
0
        protected void rgLoadOverview_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem item = (GridDataItem)e.Item;
                try
                {
                    _totreadyreleasesingles = Int32.Parse(item["TotReadyReleaseSingles"].Text);
                }
                catch {}
                try
                {
                    _totreadyreleasemultis = Int32.Parse(item["TotReadyReleaseMultis"].Text);
                }
                catch { }
                try
                {
                    _totreleasedsingles = Int32.Parse(item["TotReleasedSingles"].Text);
                }
                catch { }
                try
                {
                    _totreleasedmultis = Int32.Parse(item["TotReleasedMultis"].Text);
                }
                catch { }
                try
                {
                    _totsortedsingles = Int32.Parse(item["TotSortedSingles"].Text);
                }
                catch { }
                try
                {
                    _totsortedmultis = Int32.Parse(item["TotSortedMultis"].Text);
                }
                catch { }
                try
                {
                    _totlocatedsingles = Int32.Parse(item["TotLocatedSingles"].Text);
                }
                catch { }
                try
                {
                    _totlocatedmultis = Int32.Parse(item["TotLocatedMultis"].Text);
                }
                catch { }
                try
                {
                    _totreadypacksingles = Int32.Parse(item["TotReadyPackSingles"].Text);
                }
                catch { }
                try
                {
                    _totreadypackmultis = Int32.Parse(item["TotReadyPackMultis"].Text);
                }
                catch { }
                try
                {
                    _totpackingsingles = Int32.Parse(item["TotPackingSingles"].Text);
                }
                catch { }
                try
                {
                    _totpackingmultis = Int32.Parse(item["TotPackingMultis"].Text);
                }
                catch { }
                try
                {
                    _totpackedsingles = Int32.Parse(item["TotPackedSingles"].Text);
                }
                catch { }
                try
                {
                    _totpackedmultis = Int32.Parse(item["TotPackedMultis"].Text);
                }
                catch { }
                try
                {
                    _totcagedsingles = Int32.Parse(item["TotCagedSingles"].Text);
                }
                catch { }
                try
                {
                    _totcagedmultis = Int32.Parse(item["TotCagedMultis"].Text);
                }
                catch { }
                try
                {
                    _totreadydespatchsingles = Int32.Parse(item["TotReadyDespatchSingles"].Text);
                }
                catch { }
                try
                {
                    _totreadydespatchmultis = Int32.Parse(item["TotReadyDespatchMultis"].Text);
                }
                catch { }
                try
                {
                    _totreadydespatchsingles = Int32.Parse(item["TotReadyDespatchSingles"].Text);
                }
                catch { }
                try
                {
                    _totdespatchedsingles = Int32.Parse(item["TotDespatchedSingles"].Text);
                }
                catch { }
                try
                {
                    _totdespatchedmultis = Int32.Parse(item["TotDespatchedMultis"].Text);
                }
                catch { }


                //Label lbl = (Label)item["totreadyreleasemulti"].FindControl("totreadyreleasemultiLabel");
                //string strtxt = lbl.Text.ToString();
            }

            if (e.Item is GridFooterItem)
            {
                GridFooterItem footerItem = (GridFooterItem)e.Item;
                Label          lbl        = (Label)footerItem["ReadyReleaseItems"].FindControl("totreadyreleasemultislabel");
                lbl.Text = _totreadyreleasemultis.ToString();

                lbl      = (Label)footerItem["ReadyReleaseItems"].FindControl("totreadyreleasesingleslabel");
                lbl.Text = _totreadyreleasesingles.ToString();

                lbl      = (Label)footerItem["ReleasedItems"].FindControl("totreleasedmultislabel");
                lbl.Text = _totreleasedmultis.ToString();

                lbl      = (Label)footerItem["ReleasedItems"].FindControl("totreleasedsingleslabel");
                lbl.Text = _totreleasedsingles.ToString();

                lbl      = (Label)footerItem["SortedItems"].FindControl("totsortedmultislabel");
                lbl.Text = _totsortedmultis.ToString();

                lbl      = (Label)footerItem["SortedItems"].FindControl("totsortedsingleslabel");
                lbl.Text = _totsortedsingles.ToString();

                lbl      = (Label)footerItem["LocatedItems"].FindControl("totlocatedmultislabel");
                lbl.Text = _totlocatedmultis.ToString();

                lbl      = (Label)footerItem["LocatedItems"].FindControl("totlocatedsingleslabel");
                lbl.Text = _totlocatedsingles.ToString();

                lbl      = (Label)footerItem["PackingItems"].FindControl("totpackingsingleslabel");
                lbl.Text = _totpackingsingles.ToString();

                lbl      = (Label)footerItem["PackingItems"].FindControl("totpackingmultislabel");
                lbl.Text = _totpackingmultis.ToString();

                lbl      = (Label)footerItem["PackedItems"].FindControl("totpackedmultislabel");
                lbl.Text = _totpackedmultis.ToString();

                lbl      = (Label)footerItem["PackedItems"].FindControl("totpackedsingleslabel");
                lbl.Text = _totpackedsingles.ToString();

                lbl      = (Label)footerItem["CagedItems"].FindControl("totcagedmultislabel");
                lbl.Text = _totcagedmultis.ToString();

                lbl      = (Label)footerItem["CagedItems"].FindControl("totcagedsingleslabel");
                lbl.Text = _totreadydespatchsingles.ToString();

                lbl      = (Label)footerItem["ReadyDespatchItems"].FindControl("totreadydespatchmultislabel");
                lbl.Text = _totreadydespatchmultis.ToString();

                lbl      = (Label)footerItem["ReadyDespatchItems"].FindControl("totreadydespatchsingleslabel");
                lbl.Text = _totcagedsingles.ToString();

                lbl      = (Label)footerItem["DespatchedItems"].FindControl("totdespatchedmultislabel");
                lbl.Text = _totdespatchedmultis.ToString();

                lbl      = (Label)footerItem["DespatchedItems"].FindControl("totdespatchedsingleslabel");
                lbl.Text = _totdespatchedsingles.ToString();
            }
        }
Esempio n. 9
0
        protected void btnEditSelectedWPTrans_Click(object sender, EventArgs e)
        {
            //int Id = 0;
            string panNumber          = string.Empty;
            string tradeAccountNumber = string.Empty;
            string scripCode          = string.Empty;
            string newScripCode       = string.Empty;
            string exchange           = string.Empty;
            string price    = string.Empty;
            string newPrice = string.Empty;

            string transactionType    = string.Empty;
            string newTransactionType = string.Empty;
            bool   blResult           = false;

            rejectedRecordsBo = new RejectedRecordsBo();

            // Gets the footer row directly Cool right!
            //  GridViewRow footerRow = gvWERPTrans.FooterRow;
            GridFooterItem footerItem = sender as GridFooterItem;

            string newPanNumber = ((TextBox)footerItem.FindControl("txtPanNumberMultiple")).Text;

            if (((TextBox)footerItem.FindControl("txtScripCodeMultiple")).Text != string.Empty)
            {
                newScripCode = ((TextBox)footerItem.FindControl("txtScripCodeMultiple")).Text;
            }

            string newExchange = ((TextBox)footerItem.FindControl("txtExchangeMultiple")).Text;

            if (((DropDownList)footerItem.FindControl("ddlTransactionType")).SelectedValue != "-1")
            {
                newTransactionType = ((DropDownList)footerItem.FindControl("ddlTransactionType")).SelectedValue;
            }

            if (((TextBox)footerItem.FindControl("txtPriceMultiple")).Text != string.Empty)
            {
                newPrice = ((TextBox)footerItem.FindControl("txtPriceMultiple")).Text;
            }



            foreach (GridDataItem dr in gvWERPTrans.Items)
            {
                CheckBox checkBox = (CheckBox)dr.FindControl("chkBxWPTrans");
                if (checkBox.Checked)
                {
                    if (newPanNumber != "" || newScripCode != "" || newExchange != "" || newPrice != "" || newTransactionType != "") //Change this logic
                    {
                        panNumber       = newPanNumber;
                        scripCode       = newScripCode;
                        exchange        = newExchange;
                        transactionType = newTransactionType;
                        price           = newPrice;
                    }
                    else
                    {
                        panNumber = ((TextBox)dr.FindControl("txtPanNumber")).Text;
                        if (((TextBox)dr.FindControl("txtScripCode")).Text != string.Empty)
                        {
                            scripCode = ((TextBox)dr.FindControl("txtScripCode")).Text;
                        }
                        exchange        = ((TextBox)dr.FindControl("txtExchange")).Text;
                        transactionType = ((DropDownList)dr.FindControl("ddlTransactionType")).SelectedValue;
                        // price = Convert.ToDouble(((TextBox)dr.FindControl("txtPrice")).Text);
                        price = ((TextBox)dr.FindControl("txtPrice")).Text;
                    }
                    int id = Convert.ToInt32(gvWERPTrans.MasterTableView.DataKeyNames[dr.RowIndex].ToString());


                    blResult = rejectedRecordsBo.UpdateRejectedEquityTransactionStaging(id, panNumber, scripCode, exchange, price.ToString(), transactionType);
                }
            }

            if (blResult)
            {
                // Success Message
            }
            else
            {
                // Failure Message
            }

            // BindGrid
            if (Request.QueryString["processId"] != null)
            {
                ProcessId = Int32.Parse(Request.QueryString["processId"].ToString());
            }
            BindEquityTransactionGrid(ProcessId);
        }
Esempio n. 10
0
        protected void btnConfirmOrder_Click(object sender, EventArgs e)
        {
            int issueDetId = 0;
            int catId      = 0;
            //string Custcategory="";
            // if (ViewState["CustCat"] != null)
            // Custcategory = (string)ViewState["CustCat"];
            string confirmValue = Request.Form["confirm_value"];

            if (confirmValue == "Yes")
            {
                // this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('You clicked YES!')", true);
                //}
                //else
                //{
                //    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('You clicked NO!')", true);
                //}
                Button Button = (Button)sender;
                minQty = int.Parse(ViewState["minQty"].ToString());
                maxQty = int.Parse(ViewState["maxQty"].ToString());
                int       MaxAppNo  = Convert.ToInt32(gvCommMgmt.MasterTableView.DataKeyValues[0]["AIM_MaxApplNo"].ToString());
                int       FaceValue = Convert.ToInt32(gvCommMgmt.MasterTableView.DataKeyValues[0]["AIM_FaceValue"].ToString());
                DataTable dt        = new DataTable();
                bool      isValid   = false;
                //Need to be collect from Session...
                dt.Columns.Add("CustomerId");
                dt.Columns.Add("AID_IssueDetailId");
                dt.Columns.Add("AIM_IssueId");
                dt.Columns.Add("Qty");
                dt.Columns.Add("Amount");
                dt.Columns.Add("CatId");
                dt.Columns.Add("AcceptableCatId");
                dt.Columns.Add("userId");
                dt.Columns.Add("NomineeQuantity");
                int rowNo    = 0;
                int tableRow = 0;
                foreach (GridDataItem CBOrder in gvCommMgmt.MasterTableView.Items)
                {
                    TextBox txtQuantity     = (TextBox)gvCommMgmt.MasterTableView.Items[rowNo]["Quantity"].FindControl("txtQuantity");
                    TextBox NomineeQuantity = (TextBox)gvCommMgmt.MasterTableView.Items[rowNo]["NomineeQuantity"].FindControl("txtNomineeQuantity");
                    if (txtQuantity.Text == "0" || txtQuantity.Text == string.Empty)
                    {
                        if (rowNo < gvCommMgmt.MasterTableView.Items.Count)
                        {
                            rowNo = rowNo + 1;
                        }
                        continue;
                    }
                    OnlineBondVo.CustomerId     = customerVo.CustomerId;
                    OnlineBondVo.BankAccid      = 1002321521;
                    OnlineBondVo.PFISD_SeriesId = int.Parse(gvCommMgmt.MasterTableView.DataKeyValues[rowNo]["AID_IssueDetailId"].ToString());
                    OnlineBondVo.IssueId        = Convert.ToInt32(gvCommMgmt.MasterTableView.DataKeyValues[rowNo]["AIM_IssueId"].ToString());
                    CheckBox Check = (CheckBox)gvCommMgmt.MasterTableView.Items[rowNo]["Check"].FindControl("cbOrderCheck");
                    catId = int.Parse(gvCommMgmt.MasterTableView.DataKeyValues[rowNo]["AIDCSR_Id"].ToString());
                    if (Check.Checked == true)
                    {
                        if (!string.IsNullOrEmpty(txtQuantity.Text))
                        {
                            isValid             = true;
                            txtQuantity.Enabled = true;

                            string catName     = string.Empty;
                            string Description = string.Empty;
                            OnlineBondVo.Qty = Convert.ToInt32(txtQuantity.Text);
                            TextBox txtAmount = (TextBox)gvCommMgmt.MasterTableView.Items[rowNo]["Amount"].FindControl("txtAmount");
                            OnlineBondVo.Amount = Convert.ToDouble(txtAmount.Text);
                            dt.Rows.Add();
                            dt.Rows[tableRow]["CustomerId"]        = OnlineBondVo.CustomerId;
                            dt.Rows[tableRow]["AID_IssueDetailId"] = OnlineBondVo.PFISD_SeriesId;
                            dt.Rows[tableRow]["AIM_IssueId"]       = OnlineBondVo.IssueId;
                            dt.Rows[tableRow]["Qty"]    = OnlineBondVo.Qty;
                            dt.Rows[tableRow]["Amount"] = OnlineBondVo.Amount;
                            dt.Rows[tableRow]["userid"] = userVo.UserId;
                            if (lblNomineeTwo.Text != "" && Request.QueryString["BondType"] == "FISSGB")
                            {
                                dt.Rows[tableRow]["NomineeQuantity"] = NomineeQuantity.Text;
                            }
                            else
                            {
                                dt.Rows[tableRow]["NomineeQuantity"] = 0;
                            }
                            GridFooterItem footerItemAmount = (GridFooterItem)gvCommMgmt.MasterTableView.GetItems(GridItemType.Footer)[0];
                            Label          lblSum           = (Label)footerItemAmount.FindControl("lblAmount");


                            OnlineBondBo.GetCustomerCat(OnlineBondVo.IssueId, customerVo.CustomerId, adviserVo.advisorId, Convert.ToDouble(lblSum.Text), ref catName, ref issueDetId, ref EligblecatId, ref Description);

                            dt.Rows[tableRow]["CatId"]           = catId;
                            dt.Rows[tableRow]["AcceptableCatId"] = EligblecatId;
                        }
                    }
                    if (rowNo < gvCommMgmt.MasterTableView.Items.Count)
                    {
                        if (dt.Rows.Count >= 1)
                        {
                            rowNo = rowNo + 1;
                            tableRow++;
                        }
                    }
                    else
                    {
                        break;
                    }
                }

                GridFooterItem ftItemAmount = (GridFooterItem)gvCommMgmt.MasterTableView.GetItems(GridItemType.Footer)[0];
                Label          lbltotAmt    = (Label)ftItemAmount.FindControl("lblAmount");

                if (isValid)
                {
                    Quantity = Convert.ToInt64(ViewState["Qty"].ToString());
                    sum      = Convert.ToInt64(ViewState["Sum"].ToString());



                    if (Convert.ToDouble(lblAvailableLimits.Text) == 0)
                    {
                        trinsufficentmessage.Visible = true;
                        //lblinsufficent.Text = "Order cannot be processed due to insufficient balance";
                        //lblinsufficent.ForeColor = Color.Red;
                        //Color co = new Color();
                        tblMessage.Visible = true;

                        msgRecordStatus.Visible = false;
                        //ShowMessage(lblinsufficent.Text);
                        ////  tdsubmit.Visible = false;
                        //  lnlBack.Visible = true;
                        //  Font testFont = new Font(fontName, 16.0f, FontStyle.Regular,
                        //GraphicsUnit.Pixel);
                    }
                    else if (ViewState["CustCat"] == null)
                    {
                        string category = (string)ViewState["CustCat"];
                        if (category == string.Empty)
                        {
                            ShowMessage("Please enter no of bonds within the range permissible.");
                        }
                    }
                    else if (Convert.ToDouble(lbltotAmt.Text) > Convert.ToDouble(lblAvailableLimits.Text))
                    {
                        ShowMessage("Order cannot be processed. Insufficient balance");
                        //  tdsubmit.Visible = false;
                        // lnlBack.Visible = true;
                    }
                    else if (FaceValue > sum)
                    {
                        ShowMessage("Application amount is less than face value.");
                        //  tdsubmit.Visible = false;
                        // lnlBack.Visible = true;
                    }

                    else if (Quantity < minQty)
                    {
                        foreach (GridDataItem CBOrder in gvCommMgmt.MasterTableView.Items)
                        {
                            TextBox        txtsumQuantity   = (TextBox)gvCommMgmt.MasterTableView.Items[CBOrder.ItemIndex]["Quantity"].FindControl("txtQuantity");
                            TextBox        txtsumAmount     = (TextBox)gvCommMgmt.MasterTableView.Items[CBOrder.ItemIndex]["Amount"].FindControl("txtAmount");
                            GridFooterItem footerItem       = (GridFooterItem)gvCommMgmt.MasterTableView.GetItems(GridItemType.Footer)[0];
                            Label          lblQty           = (Label)footerItem.FindControl("lblQuantity");
                            GridFooterItem footerItemAmount = (GridFooterItem)gvCommMgmt.MasterTableView.GetItems(GridItemType.Footer)[0];
                            Label          lblSum           = (Label)footerItemAmount.FindControl("lblAmount");
                            ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyScript", "alert('Order cannot be processed.Please enter quantity greater than or equal to min quantity required')", true);
                            // ShowMessage(message);
                            txtsumQuantity.Text = "";
                            txtsumAmount.Text   = "";
                            lblQty.Text         = "";
                            lblSum.Text         = "";
                        }
                    }
                    else if (Quantity > maxQty)
                    {
                        foreach (GridDataItem CBOrder in gvCommMgmt.MasterTableView.Items)
                        {
                            TextBox        txtsumQuantity   = (TextBox)gvCommMgmt.MasterTableView.Items[CBOrder.ItemIndex]["Quantity"].FindControl("txtQuantity");
                            TextBox        txtsumAmount     = (TextBox)gvCommMgmt.MasterTableView.Items[CBOrder.ItemIndex]["Amount"].FindControl("txtAmount");
                            GridFooterItem footerItem       = (GridFooterItem)gvCommMgmt.MasterTableView.GetItems(GridItemType.Footer)[0];
                            Label          lblQty           = (Label)footerItem.FindControl("lblQuantity");
                            GridFooterItem footerItemAmount = (GridFooterItem)gvCommMgmt.MasterTableView.GetItems(GridItemType.Footer)[0];
                            Label          lblSum           = (Label)footerItemAmount.FindControl("lblAmount");
                            ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyScript", "alert('Order cannot be processed.Please enter quantity less than or equal to maximum quantity allowed for this issue')", true);
                            // ShowMessage(message);

                            txtsumQuantity.Text = "";
                            txtsumAmount.Text   = "";
                            lblQty.Text         = "";
                            lblSum.Text         = "";
                        }
                    }
                    else
                    {
                        // placing order
                        IDictionary <string, string> orderIds = new Dictionary <string, string>();
                        IssuerId = int.Parse(ViewState["IssueId"].ToString());
                        double availableBalance = Convert.ToDouble(OnlineBondBo.GetUserRMSAccountBalance(customerVo.AccountId));
                        long   totalOrderAmt    = Convert.ToInt64(ViewState["Sum"].ToString());
                        //availableBalance = 40000;
                        string message;
                        string aplicationNoStatus = string.Empty;
                        bool   accountDebitStatus = false;
                        int    Applicationno      = 0;
                        int    orderId            = 0;
                        if (availableBalance >= totalOrderAmt)
                        {
                            orderIds = OnlineBondBo.onlineBOndtransact(dt, adviserVo.advisorId, IssuerId);
                            orderId  = int.Parse(orderIds["Order_Id"].ToString());
                            if (orderId != 0)
                            {
                                accountDebitStatus = OnlineBondBo.DebitRMSUserAccountBalance(customerVo.AccountId, -totalOrderAmt, orderId, out debitStatus);

                                ShowAvailableLimits();
                            }
                            Applicationno      = int.Parse(orderIds["application"].ToString());
                            aplicationNoStatus = orderIds["aplicationNoStatus"].ToString();

                            ViewState["OrderId"]     = orderId;
                            ViewState["application"] = Applicationno;

                            btnConfirmOrder.Enabled = false;
                            Label3.Visible          = false;
                        }

                        tdsubmit.Visible = false;
                        message          = CreateUserMessage(orderId, Applicationno, accountDebitStatus, aplicationNoStatus, debitStatus);
                        ShowMessage(message);
                        lnlBack.Visible = true;
                    }
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyScript", "alert('Please Enter Quantity')", true);
                }
            }
        }
Esempio n. 11
0
        protected void txtQuantity_TextChanged(object sender, EventArgs e)
        {
            int     rowindex1     = ((GridDataItem)((TextBox)sender).NamingContainer).RowIndex;
            int     rowindex      = (rowindex1 / 2) - 1;
            int     issueId       = Convert.ToInt32(Request.QueryString["IssuerId"]);
            string  catName       = string.Empty;
            string  Description   = string.Empty;
            int     catId         = 0;
            int     issuedetId    = 0;
            double  AIM_FaceValue = 0.0;
            int     nomineeqty    = 0;
            TextBox txtQuantitys  = (TextBox)sender;
            //GridDataItem dr=(GridDataItem)txtQuantitys.NamingContainer;
            //RadGrid gvIssueList = (RadGrid)dr.FindControl("gvIssueList");

            int      minQty  = int.Parse(gvIssueList.MasterTableView.DataKeyValues[0]["AIM_MInQty"].ToString());
            int      maxQty  = int.Parse(gvIssueList.MasterTableView.DataKeyValues[0]["AIM_MaxQty"].ToString());
            DateTime t1      = Convert.ToDateTime(DateTime.Now);
            DateTime cuffOff = DateTime.Parse(gvIssueList.MasterTableView.DataKeyValues[0]["AIM_CutOffTime"].ToString());

            if (cuffOff.TimeOfDay.Ticks < t1.TimeOfDay.Ticks)
            {
                hdIscuttOff.Value = "true";
            }
            TextBox txtQuantity = (TextBox)gvCommMgmt.MasterTableView.Items[rowindex]["Quantity"].FindControl("txtQuantity");

            if (!string.IsNullOrEmpty(txtQuantity.Text))
            {
                string message             = string.Empty;
                int    rowno               = 0;
                int    PFISD_InMultiplesOf = Convert.ToInt32(gvCommMgmt.MasterTableView.DataKeyValues[rowindex]["AIM_TradingInMultipleOf"].ToString());
                // Regex re = new Regex(@"[@\\*+#^\\.\$\-?A-Za-z]+");
                Regex re = new Regex(@"^[1-9]\d*$");
                if (re.IsMatch(txtQuantity.Text))
                {
                    int Qty = Convert.ToInt32(txtQuantity.Text);
                    int Mod = Qty % PFISD_InMultiplesOf;
                    if (Mod != 0)
                    {
                        string messageMultiples = "Please enter quantity greater than or equal to min quantity required and in multiples of   " + PFISD_InMultiplesOf.ToString();
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyScript", "alert('" + messageMultiples + "')", true);
                        txtQuantity.Text = "";
                        return;
                    }
                    AIM_FaceValue = Convert.ToDouble(gvCommMgmt.MasterTableView.DataKeyValues[rowindex]["AID_SeriesFaceValue"].ToString());
                    TextBox txtAmount = (TextBox)gvCommMgmt.MasterTableView.Items[rowindex]["Amount"].FindControl("txtAmount");
                    txtAmount.Text = Convert.ToString(Qty * AIM_FaceValue);
                    CheckBox cbSelectOrder = (CheckBox)gvCommMgmt.MasterTableView.Items[rowindex]["Check"].FindControl("cbOrderCheck");
                    cbSelectOrder.Checked = true;
                    foreach (GridDataItem CBOrder in gvCommMgmt.MasterTableView.Items)
                    {
                        TextBox        txtsumQuantity        = (TextBox)gvCommMgmt.MasterTableView.Items[rowno]["Quantity"].FindControl("txtQuantity");
                        TextBox        txtsumAmount          = (TextBox)gvCommMgmt.MasterTableView.Items[rowno]["Amount"].FindControl("txtAmount");
                        TextBox        txtsumNomineeQuantity = (TextBox)gvCommMgmt.MasterTableView.Items[rowno]["NomineeQuantity"].FindControl("txtNomineeQuantity");
                        GridFooterItem footerItem            = (GridFooterItem)gvCommMgmt.MasterTableView.GetItems(GridItemType.Footer)[0];
                        Label          lblQty           = (Label)footerItem.FindControl("lblQuantity");
                        GridFooterItem footerItemAmount = (GridFooterItem)gvCommMgmt.MasterTableView.GetItems(GridItemType.Footer)[0];
                        Label          lblSum           = (Label)footerItemAmount.FindControl("lblAmount");
                        Label          lblNomineeQty    = (Label)footerItemAmount.FindControl("lblNomineeQty");

                        if (cbSelectOrder.Checked == true)
                        {
                            if (!string.IsNullOrEmpty(txtsumQuantity.Text) && !string.IsNullOrEmpty(txtsumAmount.Text))
                            {
                                Quantity         = Quantity + Convert.ToInt64(txtsumQuantity.Text);
                                ViewState["Qty"] = Quantity;
                                sum = sum + Convert.ToInt64(txtsumAmount.Text);
                                ViewState["Sum"]           = sum;
                                lblQty.Text                = Quantity.ToString();
                                lblSum.Text                = sum.ToString();
                                nomineeqty                 = nomineeqty + Convert.ToInt32(txtsumNomineeQuantity.Text);
                                txtsumNomineeQuantity.Text = txtsumQuantity.Text;
                                //lblNomineeQty.Text = nomineeqty.ToString();
                                ViewState["nomineeQty"] = nomineeqty;
                                //  lb1AvailbleCat.Visible = true;
                                OnlineBondBo.GetCustomerCat(issueId, customerVo.CustomerId, adviserVo.advisorId, Convert.ToDouble(lblSum.Text), ref catName, ref issuedetId, ref catId, ref Description);

                                //OnlineBondBo.GetCustomerCat(issueId, customerVo.CustomerId, adviserVo.advisorId, Convert.ToDouble(lblSum.Text), ref catName, ref issuedetId, ref catId, ref Description);
                                ViewState["CustCat"] = catName;
                                //ViewState["Description"] = Description;
                                if (Request.QueryString["BondType"] != "FISSGB")
                                {
                                    lb1AvailbleCat.Text = " You have applied this issue under category : " + catName + "-" + Description;
                                    ShowMessage(lb1AvailbleCat.Text);
                                }

                                //if (catName == string.Empty)
                                //    ShowMessage("Bid category Not Available");
                                //txtTotAmt_ValueChanged(null, new EventArgs());
                            }
                        }
                        if (rowno < gvCommMgmt.MasterTableView.Items.Count)
                        {
                            rowno++;
                        }
                        else
                        {
                            break;
                        }
                    }
                    if (Request.QueryString["BondType"] == "FISSGB")
                    {
                        if (int.Parse(ViewState["Qty"].ToString()) < minQty || int.Parse(ViewState["Qty"].ToString()) > maxQty)
                        {
                            ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyScript", "alert('Order cannot be processed.Please enter quantity greater than or equal to min quantity required')", true);
                        }
                    }
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyScript", "alert('Please enter only Valid Numbers & in multiples of 1')", true);
                }
            }
            else
            {
                foreach (GridDataItem CBOrder in gvCommMgmt.MasterTableView.Items)
                {
                    TextBox        txtsumQuantity   = (TextBox)gvCommMgmt.MasterTableView.Items[CBOrder.ItemIndex]["Quantity"].FindControl("txtQuantity");
                    TextBox        txtsumAmount     = (TextBox)gvCommMgmt.MasterTableView.Items[CBOrder.ItemIndex]["Amount"].FindControl("txtAmount");
                    GridFooterItem footerItem       = (GridFooterItem)gvCommMgmt.MasterTableView.GetItems(GridItemType.Footer)[0];
                    Label          lblQty           = (Label)footerItem.FindControl("lblQuantity");
                    GridFooterItem footerItemAmount = (GridFooterItem)gvCommMgmt.MasterTableView.GetItems(GridItemType.Footer)[0];
                    Label          lblSum           = (Label)footerItemAmount.FindControl("lblAmount");
                    txtQuantity.Text    = "";
                    txtsumQuantity.Text = "";
                    txtsumAmount.Text   = " ";
                    lblQty.Text         = "";
                    lblSum.Text         = "";
                }
            }
        }
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem dataItem = e.Item as GridDataItem;
            string       payment1 = dataItem["actual_amt"].Text;
            if (payment1 != "&nbsp;")
            {
                decimal fieldValue1 = decimal.Parse(payment1);
                actualTotal += fieldValue1;
            }

            string payment2 = dataItem["amount"].Text;
            if (payment1 != "&nbsp;")
            {
                decimal fieldValue2 = decimal.Parse(payment2);
                balTotal += fieldValue2;
            }

            string payment3 = dataItem["balance_amt"].Text;
            if (payment1 != "&nbsp;")
            {
                decimal fieldValue3 = decimal.Parse(payment3);
                receivedTotal += fieldValue3;
            }

            string strRegFor = dataItem["registration_for"].Text;

            if (strRegFor == "Couple")
            {
                totalMem = totalMem + 2;
            }
            else
            {
                totalMem = totalMem + 1;
            }


            //Label lblSpouse = (Label)e.Item.FindControl("lblSpouse");
            //if (lblSpouse != null)
            //    Session["Spouse"] = lblSpouse.Text;

            //Label lblMember = (Label)e.Item.FindControl("lblMember");
            //if (lblMember != null)
            //    Session["Member"] = lblMember.Text;

            //Label lblTotal = (Label)e.Item.FindControl("lblTotal");
            //if (lblTotal != null)
            //    Session["Total"] = lblTotal.Text;
        }

        if (e.Item is GridFooterItem)
        {
            //Label lblTotalSpouse = e.Item.FindControl("lblTotalSpouse") as Label;
            //Label lblTotalMember = e.Item.FindControl("lblTotalMember") as Label;
            //Label lblTotals = e.Item.FindControl("lblTotals") as Label;
            //lblTotalMember.Text = "Members: " + Session["Member"].ToString();
            //lblTotalSpouse.Text = "Spouses: " + Session["Spouse"].ToString();
            //lblTotals.Text = "Total: " + Session["Total"].ToString();

            GridFooterItem footerItem = e.Item as GridFooterItem;
            footerItem.HorizontalAlign    = HorizontalAlign.Right;
            footerItem.Font.Bold          = true;
            footerItem["actual_amt"].Text = actualTotal.ToString("n0");

            footerItem.HorizontalAlign = HorizontalAlign.Right;
            footerItem.Font.Bold       = true;
            footerItem["amount"].Text  = balTotal.ToString("n0");

            footerItem.HorizontalAlign     = HorizontalAlign.Right;
            footerItem.Font.Bold           = true;
            footerItem["balance_amt"].Text = receivedTotal.ToString("n0");

            footerItem.HorizontalAlign          = HorizontalAlign.Right;
            footerItem.Font.Bold                = true;
            footerItem["registration_for"].Text = totalMem.ToString("n0");
        }

        try
        {
            DropDownList chkStatus = (DropDownList)e.Item.FindControl("chkActive");
            Label        lblStatus = (Label)e.Item.FindControl("lblStatus");

            if (lblStatus != null)
            {
                string strStatus = lblStatus.Text;

                if (strStatus == "Pending")
                {
                    chkStatus.SelectedIndex = 0;
                }
                if (strStatus == "Received Adv")
                {
                    chkStatus.SelectedIndex = 1;
                }
                if (strStatus == "Received Full")
                {
                    chkStatus.SelectedIndex = 2;
                }
            }
        }
        catch { }
    }
        protected void gvOrderRecon_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridFooterItem)
            {
                GridFooterItem FooterItem = (GridFooterItem)e.Item;

                AutoCompleteExtender AutoCompleteExtender2 = (AutoCompleteExtender)e.Item.FindControl("AutoCompleteExtender2");
                //  AutoCompleteExtender2.ContextKey = advisorVo.advisorId.ToString();
                AutoCompleteExtender AutoCompleteExtender2_txtOrderSubbrokerCode = (AutoCompleteExtender)e.Item.FindControl("AutoCompleteExtender2_txtOrderSubbrokerCode");
                //AutoCompleteExtender2_txtOrderSubbrokerCode.ContextKey = advisorVo.advisorId.ToString();
            }
            if (e.Item is GridDataItem)
            {
                //GridDataItem item = e.Item as GridDataItem;

                //TextBox txtApplicationNo = (TextBox)item.FindControl("txtApplicationNo");
                //if (ddlType.SelectedValue == "2")
                //    txtApplicationNo.ReadOnly = false;
                //else
                //    txtApplicationNo.ReadOnly = true;

                //   LinkButton lnkOrderEntry = (LinkButton)item.FindControl("lnkOrderEntry");

                // lnkMatch.Visible = false;
                // lnkOrderEntry.Visible = false;
                //// item["editColumn"].Visible = false;
                // //item["MissmatchType"].Visible = false;
                // gvOrderRecon.MasterTableView.GetColumn("editColumn").Visible = false;
                // gvOrderRecon.MasterTableView.GetColumn("MissmatchType").Visible = false;
                // if (ddlType.SelectedValue == "4")
                // {
                //     lnkMatch.Visible = true;
                //     gvOrderRecon.MasterTableView.GetColumn("editColumn").Visible = true;


                // }
                //else if (ddlType.SelectedValue == "3")
                //{

                //    lnkMatch.Visible = false;
                //    lnkOrderEntry.Visible = true;
                //    item["editColumn"].Visible = false;
                //    item["issueName"].Text = string.Empty;
                //    //item["MissmatchType"].Visible = false;


                //}
                //else if (ddlType.SelectedValue == "2")
                //{

                //    lnkMatch.Visible = false;
                //    lnkOrderEntry.Visible = true;
                //    item["editColumn"].Visible = true;
                //    //item["MissmatchType"].Visible = true;

                //}
                //else
                //{
                //    lnkMatch.Visible = false;
                //    lnkOrderEntry.Visible = false;
                //    item["editColumn"].Visible = false;

                //}
            }
            if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode) && e.Item.ItemIndex != -1)
            {
                GridEditFormItem editform         = (GridEditFormItem)e.Item;
                TextBox          txtApplicationNo = (TextBox)editform.FindControl("txtApplicationNo");
                if (ddlType.SelectedValue == "2")
                {
                    txtApplicationNo.Enabled = false;
                }
                else
                {
                    txtApplicationNo.Enabled = true;
                }
            }
            if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
            {
                GridEditFormItem     item = e.Item as GridEditFormItem;
                AutoCompleteExtender AutoCompleteExtender2 = (AutoCompleteExtender)item.FindControl("AutoCompleteExtender2");
                AutoCompleteExtender2.ContextKey    = advisorVo.advisorId.ToString();
                AutoCompleteExtender2.ServiceMethod = "GetAgentCodeAssociateDetails";
            }
            if (e.Item is GridHeaderItem)
            {
                GridHeaderItem header = (GridHeaderItem)e.Item;

                if (ddlCategory.SelectedValue == "FICDCD")
                {
                    header["COAD_Quantity"].Text  = "Alloted Amt.";
                    header["CFIOD_Quantity"].Text = "Order AMt.";
                }
            }

            if (e.Item is GridFilteringItem && e.Item.ItemIndex == -1)
            {
                GridFilteringItem filterItem = (GridFilteringItem)e.Item;

                RadComboBox RadComboBoxIN = (RadComboBox)filterItem.FindControl("RadComboBoxRR");
                dBindOrderMissMatchDetails = (DataTable)Cache["OrderRecon" + userVo.UserId.ToString()];;
                Session["dt"] = dBindOrderMissMatchDetails;
                DataTable dtcustMIS = new DataTable();
                dtcustMIS.Columns.Add("MissmatchType");
                DataRow drcustMIS;
                foreach (DataRow dr in dBindOrderMissMatchDetails.Rows)
                {
                    drcustMIS = dtcustMIS.NewRow();
                    drcustMIS["MissmatchType"] = dr["MissmatchType"].ToString();
                    dtcustMIS.Rows.Add(drcustMIS);
                }
                DataView  view           = new DataView(dBindOrderMissMatchDetails);
                DataTable distinctValues = view.ToTable(true, "MissmatchType");
                RadComboBoxIN.DataSource     = distinctValues;
                RadComboBoxIN.DataValueField = dtcustMIS.Columns["MissmatchType"].ToString();
                RadComboBoxIN.DataTextField  = dtcustMIS.Columns["MissmatchType"].ToString();
                RadComboBoxIN.DataBind();
            }
        }
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        string strFoodPref  = "";
        string strSFoodPref = "";

        if (e.Item is GridDataItem)
        {
            GridDataItem dataItem = e.Item as GridDataItem;

            string strRegFor = dataItem["registration_for"].Text;

            if (strRegFor == "Couple")
            {
                strSFoodPref = dataItem["spouse_food_pref"].Text;

                if (strSFoodPref == "Veg")
                {
                    Vegetarian++;
                }

                if (strSFoodPref == "Non-Veg")
                {
                    NonVegetarian++;
                }

                if (strSFoodPref == "Jain")
                {
                    Jain++;
                }
            }

            strFoodPref = dataItem["food_pref"].Text;

            if (strFoodPref == "Veg")
            {
                Vegetarian++;
            }

            if (strFoodPref == "Non-Veg")
            {
                NonVegetarian++;
            }

            if (strFoodPref == "Jain")
            {
                Jain++;
            }
        }

        if (e.Item is GridFooterItem)
        {
            GridFooterItem footerItem = e.Item as GridFooterItem;
            footerItem.HorizontalAlign = HorizontalAlign.Right;
            footerItem.Font.Bold       = true;

            //string memType = "";
            //memType = rbtnType.SelectedValue.ToString();

            //if (memType == "0")
            //{

            footerItem["emailId"].Text          = "Veg: " + Vegetarian.ToString();
            footerItem["food_pref"].Text        = "Non-Veg: " + NonVegetarian.ToString();
            footerItem["spouse_food_pref"].Text = "Jain: " + Jain.ToString();

            //}

            //if (memType == "1")
            //{
            //    footerItem["emailId"].Text = "Veg: " + Veg.ToString();
            //}

            //if (memType == "2")
            //{
            //    footerItem["food_pref"].Text = "Non-Veg: " + NonVegetarian.ToString();
            //}
        }
    }
Esempio n. 15
0
        protected void RadGridDrillDownReport_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridGroupHeaderItem)
            {
                GridGroupHeaderItem item = e.Item as GridGroupHeaderItem;
                (item.DataCell).Text = (item.DataCell).Text.Replace("MonthAndYear: ", string.Empty);
                string monthPart = (item.DataCell).Text.Substring(4);
                if (monthPart == "01")
                {
                    (item.DataCell).Text = (item.DataCell).Text.Substring(0, 4) + " - " + "January";
                }
                else if (monthPart == "02")
                {
                    (item.DataCell).Text = (item.DataCell).Text.Substring(0, 4) + " - " + "February";
                }
                else if (monthPart == "03")
                {
                    (item.DataCell).Text = (item.DataCell).Text.Substring(0, 4) + " - " + "March";
                }
                else if (monthPart == "04")
                {
                    (item.DataCell).Text = (item.DataCell).Text.Substring(0, 4) + " - " + "April";
                }
                else if (monthPart == "05")
                {
                    (item.DataCell).Text = (item.DataCell).Text.Substring(0, 4) + " - " + "May";
                }
                else if (monthPart == "06")
                {
                    (item.DataCell).Text = (item.DataCell).Text.Substring(0, 4) + " - " + "June";
                }
                else if (monthPart == "07")
                {
                    (item.DataCell).Text = (item.DataCell).Text.Substring(0, 4) + " - " + "July";
                }
                else if (monthPart == "08")
                {
                    (item.DataCell).Text = (item.DataCell).Text.Substring(0, 4) + " - " + "August";
                }
                else if (monthPart == "09")
                {
                    (item.DataCell).Text = (item.DataCell).Text.Substring(0, 4) + " - " + "September";
                }
                else if (monthPart == "10")
                {
                    (item.DataCell).Text = (item.DataCell).Text.Substring(0, 4) + " - " + "October";
                }
                else if (monthPart == "11")
                {
                    (item.DataCell).Text = (item.DataCell).Text.Substring(0, 4) + " - " + "November";
                }
                else if (monthPart == "12")
                {
                    (item.DataCell).Text = (item.DataCell).Text.Substring(0, 4) + " - " + "December";
                }
            }
            else if (e.Item is GridFooterItem)
            {
                GridFooterItem footeritem = e.Item as GridFooterItem;
                //footeritem.Cells[5].Text = string.Empty;

                try
                {
                    var totalGrossProfit = decimal.Parse(e.Item.Cells[9].Text.Replace("$", string.Empty).Replace(",", string.Empty));
                    var totalSalesPrice  = decimal.Parse(e.Item.Cells[5].Text.Replace("$", string.Empty).Replace(",", string.Empty));
                    e.Item.Cells[10].Text = ((totalGrossProfit / totalSalesPrice) * 100).ToString("0.00") + "%";
                }
                catch (Exception)
                {
                    //ignored
                }


                footeritem.Style.Add("color", "green");
                footeritem.Style.Add("font-weight", "bold");
            }
            else if (e.Item is GridGroupFooterItem)
            {
                var totalGrossProfit = decimal.Parse(e.Item.Cells[10].Text.Replace("$", string.Empty).Replace(",", string.Empty));
                var totalSalesPrice  = decimal.Parse(e.Item.Cells[6].Text.Replace("$", string.Empty).Replace(",", string.Empty));
                e.Item.Cells[11].Text = ((totalGrossProfit / totalSalesPrice) * 100).ToString("0.00") + "%";



                GridGroupFooterItem groupFooter = e.Item as GridGroupFooterItem;

                groupFooter.Cells[2].BackColor = Color.Red;
                groupFooter.Style.Add("color", "blue");
                groupFooter.Style.Add("font-weight", "bold");
            }
            else if (e.Item is GridDataItem)
            {
                var item = (GridDataItem)e.Item;
                if (!(item.ItemIndex > -1 && item.DataItem is ReturnDetailReportByDistributorBO))
                {
                    return;
                }
                var obj = (ReturnDetailReportByDistributorBO)item.DataItem;

                var lnkQuantity = (HyperLink)item.FindControl("lnkQuantity");
                lnkQuantity.NavigateUrl = "DrillDownReportByClient.aspx?Start=" + this.Start.ToShortDateString() + "&End=" + this.End.ToShortDateString() + "&Distributor=" + this.Distributor.ToString() + "&Client=" + obj.ID.ToString() + "&Current=" + this.Current + "&Name=" + this.DistributorName + "&Type=" + this.DistributorType + "&ClientName=" + obj.Client + "&DistributorName=" + CurrentDistributorName;
                lnkQuantity.Text        = Convert.ToString(obj.Quantity);
            }
        }
        protected void btnSave1_Click(object sender, EventArgs e)
        {
            string pan             = string.Empty;
            string transactionType = string.Empty;
            string productCode     = string.Empty;

            bool blResult1 = false;
            int  Id        = 0;
            int  tableNo   = 0;

            uploadCommonBo = new UploadCommonBo();
            GridFooterItem footerRow = (GridFooterItem)gvSIPReject.MasterTableView.GetItems(GridItemType.Footer)[0];

            foreach (GridDataItem dr in gvSIPReject.Items)
            {
                if (((TextBox)footerRow.FindControl("txtPANNOFooter")).Text.Trim() == "")
                {
                    pan = ((TextBox)dr.FindControl("txtPANNO")).Text;
                }
                else
                {
                    pan = ((TextBox)footerRow.FindControl("txtPANNOFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtAUTTRNTYPFooter")).Text.Trim() == "")
                {
                    transactionType = ((TextBox)dr.FindControl("txtAUTTRNTYP")).Text;
                }
                else
                {
                    transactionType = ((TextBox)footerRow.FindControl("txtAUTTRNTYPFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtProductFooter")).Text.Trim() == "")
                {
                    productCode = ((TextBox)dr.FindControl("txtProduct")).Text;
                }
                else
                {
                    productCode = ((TextBox)footerRow.FindControl("txtProductFooter")).Text;
                }

                CheckBox checkBox = (CheckBox)dr.FindControl("chkId");
                if (checkBox.Checked == true)
                {
                    int          selectedRow = 0;
                    GridDataItem gdi;
                    gdi         = (GridDataItem)checkBox.NamingContainer;
                    selectedRow = gdi.ItemIndex + 1;
                    Id          = int.Parse((gvSIPReject.MasterTableView.DataKeyValues[selectedRow - 1]["InputId"].ToString()));
                    tableNo     = int.Parse((gvSIPReject.MasterTableView.DataKeyValues[selectedRow - 1]["TableNo"].ToString()));
                    blResult1   = uploadCommonBo.UpdateSIPRequestRejects(pan, Id, tableNo, transactionType, productCode);
                }
            }

            if (Request.QueryString["ReqId"] != null)
            {
                DataTable dtRequests          = new DataTable();
                DataSet   dtProcessLogDetails = new DataSet();

                reqId = Int32.Parse(Request.QueryString["ReqId"].ToString());
                GetProfileIncreamentRejection(reqId);
                dtRequests = (DataTable)Cache["RequestReject" + userVo.UserId.ToString()];
                gvSIPReject.Rebind();
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string city                   = string.Empty;
            string state                  = string.Empty;
            string pincode                = string.Empty;
            string mobileno               = string.Empty;
            string occupation             = string.Empty;
            string accounttype            = string.Empty;
            string bankname               = string.Empty;
            string personalstatus         = string.Empty;
            bool   blResult               = false;
            int    Id                     = 0;
            int    tableNo                = 0;
            string clientCode             = string.Empty;
            string address1               = string.Empty;
            string address2               = string.Empty;
            string address3               = string.Empty;
            string country                = string.Empty;
            string officePhoneNo          = string.Empty;
            string officeExtensionNo      = string.Empty;
            string officeFaxNo            = string.Empty;
            string homePhoneNo            = string.Empty;
            string homeFaxNo              = string.Empty;
            string annualIncome           = string.Empty;
            string pan1                   = string.Empty;
            string pan2                   = string.Empty;
            string pan3                   = string.Empty;
            string emailId                = string.Empty;
            string transactionType        = string.Empty;
            string transactionNature      = string.Empty;
            string transactionHead        = string.Empty;
            string transactionDescription = string.Empty;
            string productCode            = string.Empty;
            string accountNo              = string.Empty;

            //string guardianDOB = string.Empty;
            uploadCommonBo = new UploadCommonBo();
            GridFooterItem footerRow = (GridFooterItem)gvProfileIncreamenetReject.MasterTableView.GetItems(GridItemType.Footer)[0];

            foreach (GridDataItem dr in gvProfileIncreamenetReject.Items)
            {
                if (((TextBox)footerRow.FindControl("txtClientCodeFooter")).Text.Trim() == "")
                {
                    clientCode = ((TextBox)dr.FindControl("txtClientCode")).Text;
                }
                else
                {
                    clientCode = ((TextBox)footerRow.FindControl("txtClientCodeFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtCityFooter")).Text.Trim() == "")
                {
                    city = ((TextBox)dr.FindControl("txtCity")).Text;
                }
                else
                {
                    city = ((TextBox)footerRow.FindControl("txtCityFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtStateFooter")).Text.Trim() == "")
                {
                    state = ((TextBox)dr.FindControl("txtState")).Text;
                }
                else
                {
                    state = ((TextBox)footerRow.FindControl("txtStateFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtPinCodeFooter")).Text.Trim() == "")
                {
                    pincode = ((TextBox)dr.FindControl("txtPinCode")).Text;
                }
                else
                {
                    pincode = ((TextBox)footerRow.FindControl("txtPinCodeFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtMobileNoFooter")).Text.Trim() == "")
                {
                    mobileno = ((TextBox)dr.FindControl("txtMobileNo")).Text;
                }
                else
                {
                    mobileno = ((TextBox)footerRow.FindControl("txtMobileNoFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtOccupationFooter")).Text.Trim() == "")
                {
                    occupation = ((TextBox)dr.FindControl("txtOccupation")).Text;
                }
                else
                {
                    occupation = ((TextBox)footerRow.FindControl("txtOccupationFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtAccountTypeFooter")).Text.Trim() == "")
                {
                    accounttype = ((TextBox)dr.FindControl("txtAccountType")).Text;
                }
                else
                {
                    accounttype = ((TextBox)footerRow.FindControl("txtAccountTypeFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtBankNameFooter")).Text.Trim() == "")
                {
                    bankname = ((TextBox)dr.FindControl("txtBankName")).Text;
                }
                else
                {
                    bankname = ((TextBox)footerRow.FindControl("txtBankNameFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtPersonalStatusFooter")).Text.Trim() == "")
                {
                    personalstatus = ((TextBox)dr.FindControl("txtPersonalStatus")).Text;
                }
                else
                {
                    personalstatus = ((TextBox)footerRow.FindControl("txtPersonalStatusFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtAddress1Footer")).Text.Trim() == "")
                {
                    address1 = ((TextBox)dr.FindControl("txtAddress1")).Text;
                }
                else
                {
                    address1 = ((TextBox)footerRow.FindControl("txtAddress1Footer")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtAddress2Footer")).Text.Trim() == "")
                {
                    address2 = ((TextBox)dr.FindControl("txtAddress2")).Text;
                }
                else
                {
                    address2 = ((TextBox)footerRow.FindControl("txtAddress2Footer")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtAddress3Footer")).Text.Trim() == "")
                {
                    address3 = ((TextBox)dr.FindControl("txtAddress3")).Text;
                }
                else
                {
                    address3 = ((TextBox)footerRow.FindControl("txtAddress3Footer")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtCountryFooter")).Text.Trim() == "")
                {
                    country = ((TextBox)dr.FindControl("txtCountry")).Text;
                }
                else
                {
                    country = ((TextBox)footerRow.FindControl("txtCountryFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtOfficePhoneNoFooter")).Text.Trim() == "")
                {
                    officePhoneNo = ((TextBox)dr.FindControl("txtOfficePhoneNo")).Text;
                }
                else
                {
                    officePhoneNo = ((TextBox)footerRow.FindControl("txtOfficePhoneNoFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtOfficeExtensionNoFooter")).Text.Trim() == "")
                {
                    officeExtensionNo = ((TextBox)dr.FindControl("txtOfficeExtensionNo")).Text;
                }
                else
                {
                    officeExtensionNo = ((TextBox)footerRow.FindControl("txtOfficeExtensionNoFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtOfficeFaxNoFooter")).Text.Trim() == "")
                {
                    officeFaxNo = ((TextBox)dr.FindControl("txtOfficeFaxNo")).Text;
                }
                else
                {
                    officeFaxNo = ((TextBox)footerRow.FindControl("txtOfficeFaxNoFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtHomePhoneNoFooter")).Text.Trim() == "")
                {
                    homePhoneNo = ((TextBox)dr.FindControl("txtHomePhoneNo")).Text;
                }
                else
                {
                    homePhoneNo = ((TextBox)footerRow.FindControl("txtHomePhoneNoFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtHomeFaxNoFooter")).Text.Trim() == "")
                {
                    homeFaxNo = ((TextBox)dr.FindControl("txtHomeFaxNo")).Text;
                }
                else
                {
                    homeFaxNo = ((TextBox)footerRow.FindControl("txtHomeFaxNoFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtAnnualIncomeFooter")).Text.Trim() == "")
                {
                    annualIncome = ((TextBox)dr.FindControl("txtAnnualIncome")).Text;
                }
                else
                {
                    annualIncome = ((TextBox)footerRow.FindControl("txtAnnualIncomeFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtPANNO1Footer")).Text.Trim() == "")
                {
                    pan1 = ((TextBox)dr.FindControl("txtPANNO1")).Text;
                }
                else
                {
                    pan1 = ((TextBox)footerRow.FindControl("txtPANNO1Footer")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtPANNO2Footer")).Text.Trim() == "")
                {
                    pan2 = ((TextBox)dr.FindControl("txtPANNO2")).Text;
                }
                else
                {
                    pan2 = ((TextBox)footerRow.FindControl("txtPANNO2Footer")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtPANNO3Footer")).Text.Trim() == "")
                {
                    pan3 = ((TextBox)dr.FindControl("txtPANNO3")).Text;
                }
                else
                {
                    pan3 = ((TextBox)footerRow.FindControl("txtPANNO3Footer")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtEmailIdFooter")).Text.Trim() == "")
                {
                    emailId = ((TextBox)dr.FindControl("txtEmailId")).Text;
                }
                else
                {
                    emailId = ((TextBox)footerRow.FindControl("txtEmailIdFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtTransactionTypeFooter")).Text.Trim() == "")
                {
                    transactionType = ((TextBox)dr.FindControl("txtTransactionType")).Text;
                }
                else
                {
                    transactionType = ((TextBox)footerRow.FindControl("txtTransactionTypeFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtTransactionNatureFooter")).Text.Trim() == "")
                {
                    transactionNature = ((TextBox)dr.FindControl("txtTransactionNature")).Text;
                }
                else
                {
                    transactionNature = ((TextBox)footerRow.FindControl("txtTransactionNatureFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtTransactionHeadFooter")).Text.Trim() == "")
                {
                    transactionHead = ((TextBox)dr.FindControl("txtTransactionHead")).Text;
                }
                else
                {
                    transactionHead = ((TextBox)footerRow.FindControl("txtTransactionHeadFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtTransactionDescriptionFooter")).Text.Trim() == "")
                {
                    transactionDescription = ((TextBox)dr.FindControl("txtTransactionDescription")).Text;
                }
                else
                {
                    transactionDescription = ((TextBox)footerRow.FindControl("txtTransactionDescriptionFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtProductCodeFooter")).Text.Trim() == "")
                {
                    productCode = ((TextBox)dr.FindControl("txtProductCode")).Text;
                }
                else
                {
                    productCode = ((TextBox)footerRow.FindControl("txtProductCodeFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtAccountNoFooter")).Text.Trim() == "")
                {
                    accountNo = ((TextBox)dr.FindControl("txtAccountNo")).Text;
                }
                else
                {
                    accountNo = ((TextBox)footerRow.FindControl("txtAccountNoFooter")).Text;
                }
                CheckBox checkBox = (CheckBox)dr.FindControl("chkId");
                if (checkBox.Checked == true)
                {
                    int          selectedRow = 0;
                    GridDataItem gdi;
                    gdi         = (GridDataItem)checkBox.NamingContainer;
                    selectedRow = gdi.ItemIndex + 1;
                    Id          = int.Parse((gvProfileIncreamenetReject.MasterTableView.DataKeyValues[selectedRow - 1]["ID"].ToString()));
                    tableNo     = int.Parse((gvProfileIncreamenetReject.MasterTableView.DataKeyValues[selectedRow - 1]["TableNo"].ToString()));
                    blResult    = uploadCommonBo.UpdateRequestRejects(clientCode, Id, tableNo, city, state, pincode, mobileno, occupation, accounttype, bankname, personalstatus, address1, address2, address3, country, officePhoneNo, officeExtensionNo, officeFaxNo, homePhoneNo, homeFaxNo, annualIncome, pan1, pan2, pan3, emailId, transactionType, transactionNature, transactionHead, transactionDescription, productCode, accountNo);
                }
            }

            if (Request.QueryString["ReqId"] != null)
            {
                DataTable dtRequests          = new DataTable();
                DataSet   dtProcessLogDetails = new DataSet();

                reqId = Int32.Parse(Request.QueryString["ReqId"].ToString());
                GetProfileIncreamentRejection(reqId);
                dtRequests = (DataTable)Cache["RequestReject" + userVo.UserId.ToString()];
                {
                    if (ViewState["RejectReason"] != null)
                    {
                        rcbType = ViewState["RejectReason"].ToString();
                    }
                    if (!string.IsNullOrEmpty(rcbType))
                    {
                        DataView dvStaffList = new DataView(dtRequests, "RejectedReasonDescription = '" + rcbType + "'", "", DataViewRowState.CurrentRows);
                        gvProfileIncreamenetReject.DataSource = dvStaffList.ToTable();
                        GridColumn column = gvProfileIncreamenetReject.MasterTableView.GetColumnSafe("RejectedReasonDescription");
                        column.CurrentFilterFunction = GridKnownFunction.Contains;
                        gvProfileIncreamenetReject.MasterTableView.Rebind();
                    }
                    else
                    {
                        GetProfileIncreamentRejection(reqId);
                    }
                }
            }
        }
    private void GenerateTable(RadGrid grid, xls.Table singleTable)
    {
        if (ExportingType.SelectedValue == "1")
        {
            singleTable       = new xls.Table(grid.ID);
            singleTable.Title = grid.ID;
            row = 2;
            col = 1;
        }
        else
        {
            if (!isFirstItem)
            {
                row++;
            }
            else
            {
                row = 2;
            }
            isFirstItem = false;
        }

        GridHeaderItem headerItem = grid.MasterTableView.GetItems(GridItemType.Header)[0] as GridHeaderItem;

        int[] sizearr = new int[15];
        for (int i = 2; i < headerItem.Cells.Count; i++)
        {
            //singleTable.InsertImage(new Range("A1", "B2"), "../Images/Company_Logo/ADNOC.png");

            singleTable.Cells[2, row - 1].Value           = grid.ID;
            singleTable.Cells[2, row - 1].Style.ForeColor = System.Drawing.Color.GreenYellow;
            singleTable.Cells[2, row - 1].Style.Font.Size = 18;
            singleTable.Cells[2, row - 1].Style.Font.Bold = true;
            singleTable.Rows[row - 1].Height = 30;
            singleTable.Cells[3, 1].Value    = " Date : " + DateTime.Now.ToString("dddd, dd MMMM yyyy h:mm tt");
            singleTable.Cells[3, row - 1].Style.ForeColor = System.Drawing.Color.Red;

            singleTable.Rows[row].Height                          = 25;
            singleTable.Cells[i - 1, row].Value                   = headerItem.Cells[i].Text.Replace("_", " ");
            singleTable.Cells[i - 1, row].Style.BackColor         = System.Drawing.Color.LightGray;
            singleTable.Cells[i - 1, row].Style.Font.Bold         = true;
            singleTable.Cells[i - 1, row].Style.Font.Size         = 10;
            singleTable.Cells[i - 1, row].Style.BorderLeftStyle   = BorderStyle.Outset;
            singleTable.Cells[i - 1, row].Style.BorderRightStyle  = BorderStyle.Outset;
            singleTable.Cells[i - 1, row].Style.BorderBottomStyle = BorderStyle.Outset;
            singleTable.Cells[i - 1, row].Style.BorderTopStyle    = BorderStyle.Outset;
            singleTable.Cells[i - 1, row].Style.BorderRightColor  = System.Drawing.Color.Black;
            singleTable.Cells[i - 1, row].Style.BorderTopColor    = System.Drawing.Color.Black;
            singleTable.Cells[i - 1, row].Style.BorderLeftColor   = System.Drawing.Color.Black;
            singleTable.Cells[i - 1, row].Style.BorderBottomColor = System.Drawing.Color.Black;
        }

        row++;

        foreach (GridDataItem item in grid.MasterTableView.Items)
        {
            foreach (GridColumn column in grid.MasterTableView.AutoGeneratedColumns)
            {
                singleTable.Cells[col, row].Value = item[column.UniqueName].Text.Replace("&nbsp;", "");
                singleTable.Cells[col, row].Style.BorderLeftStyle   = BorderStyle.Outset;
                singleTable.Cells[col, row].Style.BorderRightStyle  = BorderStyle.Outset;
                singleTable.Cells[col, row].Style.BorderBottomStyle = BorderStyle.Outset;
                singleTable.Cells[col, row].Style.BorderTopStyle    = BorderStyle.Outset;
                singleTable.Cells[col, row].Style.BorderRightColor  = System.Drawing.Color.Black;
                singleTable.Cells[col, row].Style.BorderTopColor    = System.Drawing.Color.Black;
                singleTable.Cells[col, row].Style.BorderLeftColor   = System.Drawing.Color.Black;
                singleTable.Cells[col, row].Style.BorderBottomColor = System.Drawing.Color.Black;
                col++;
            }
            col = 1;
            row++;
        }

        GridFooterItem FooterItem = grid.MasterTableView.GetItems(GridItemType.Footer)[0] as GridFooterItem;

        for (int i = 2; i < FooterItem.Cells.Count; i++)
        {
            singleTable.Rows[row].Height                          = 25;
            singleTable.Cells[i - 1, row].Value                   = FooterItem.Cells[i].Text.Replace("_", " ").Replace("&nbsp;", "");
            singleTable.Cells[i - 1, row].Style.BackColor         = System.Drawing.Color.LightBlue;
            singleTable.Cells[i - 1, row].Style.Font.Bold         = true;
            singleTable.Cells[i - 1, row].Style.Font.Size         = 10;
            singleTable.Cells[i - 1, row].Style.BorderLeftStyle   = BorderStyle.Outset;
            singleTable.Cells[i - 1, row].Style.BorderRightStyle  = BorderStyle.Outset;
            singleTable.Cells[i - 1, row].Style.BorderBottomStyle = BorderStyle.Outset;
            singleTable.Cells[i - 1, row].Style.BorderTopStyle    = BorderStyle.Outset;
            singleTable.Cells[i - 1, row].Style.BorderRightColor  = System.Drawing.Color.Black;
            singleTable.Cells[i - 1, row].Style.BorderTopColor    = System.Drawing.Color.Black;
            singleTable.Cells[i - 1, row].Style.BorderLeftColor   = System.Drawing.Color.Black;
            singleTable.Cells[i - 1, row].Style.BorderBottomColor = System.Drawing.Color.Black;
        }
        row++;
        row++;

        if (ExportingType.SelectedValue == "1")
        {
            structure.Tables.Add(singleTable);
        }
    }
Esempio n. 19
0
    protected void TxtBillFor_TextChanged(object sender, EventArgs e)
    {
        if (lblSessionRate.Text.ToString() != string.Empty || lblSessionRate.Text.ToString() != "")
        {
            Decimal GrandTotal2 = 0;
            int     PCount2     = 0;
            foreach (GridDataItem Item in FoodBillingListView.Items)
            {
                RadNumericTextBox TxtBillfor  = (RadNumericTextBox)Item.FindControl("TxtBillFor");
                Decimal           BillingRate = Convert.ToDecimal(lblSessionRate.Text.ToString());
                Decimal           Billfor     = Decimal.Parse(TxtBillfor.Text.ToString());
                RadNumericTextBox Amount      = (RadNumericTextBox)Item.FindControl("TxtAmnt");
                Amount.Text = Convert.ToString(Billfor * BillingRate);
                GrandTotal2 = GrandTotal2 + Convert.ToDecimal(Amount.Text.ToString());
                RadNumericTextBox rtbPCount = (RadNumericTextBox)Item.FindControl("TxtBillFor");
                PCount2 = PCount2 + Convert.ToInt16(rtbPCount.Text.ToString());
            }
            GridFooterItem    footeritem = (GridFooterItem)FoodBillingListView.MasterTableView.GetItems(GridItemType.Footer)[0];
            RadNumericTextBox Total      = (RadNumericTextBox)footeritem.FindControl("lblTotalAmnt");
            Total.Text = GrandTotal2.ToString();
            RadNumericTextBox PCTotal2 = (RadNumericTextBox)footeritem.FindControl("lblPCount");
            PCTotal2.Text = PCount2.ToString();
            LoadGrid1();
        }

        else
        {
            foreach (GridDataItem Item in FoodBillingListView.Items)
            {
                RadNumericTextBox Amount = (RadNumericTextBox)Item.FindControl("TxtAmnt");
                Amount.Text = string.Empty;
            }
            GridFooterItem    footeritem = (GridFooterItem)FoodBillingListView.MasterTableView.GetItems(GridItemType.Footer)[0];
            RadNumericTextBox Total      = (RadNumericTextBox)footeritem.FindControl("lblTotalAmnt");
            Total.Text = string.Empty;
        }



        //Decimal GrandTotal2 = 0;
        //foreach (GridItem Item in FoodBillingListView.Items)

        //{

        //    SqlProcsNew sqlobj = new SqlProcsNew();
        //    DataSet TxtRate = new DataSet();

        //    DropDownList ddlist = (DropDownList)Item.FindControl("ddlBillingCode");


        //    TxtRate = sqlobj.ExecuteSP("[SP_FetchBillingRatetotextbox]",
        //         new SqlParameter() { ParameterName = "@IMODE", SqlDbType = SqlDbType.Int, Value = 1 },
        //         new SqlParameter() { ParameterName = "@BCode", SqlDbType = SqlDbType.NVarChar, Value = ddlist.SelectedValue });
        //    if (TxtRate.Tables[0].Rows.Count > 0)
        //    {

        //        RadNumericTextBox TxtBillfor = (RadNumericTextBox)Item.FindControl("TxtBillFor");
        //        RadNumericTextBox BRate = (RadNumericTextBox)Item.FindControl("TxtBillCodeRate");
        //        BRate.Text = TxtRate.Tables[0].Rows[0]["Rate"].ToString();
        //        Decimal BillingRate = Convert.ToDecimal(TxtRate.Tables[0].Rows[0]["Rate"].ToString());
        //        Decimal Billfor = Decimal.Parse(TxtBillfor.Text.ToString());

        //        RadNumericTextBox Amount = (RadNumericTextBox)Item.FindControl("TxtAmnt");
        //        Amount.Text = Convert.ToString(Billfor * BillingRate);
        //        GrandTotal2 = GrandTotal2 + Convert.ToDecimal(Amount.Text.ToString());
        //    }
        //    else
        //    {
        //        WebMsgBox.Show("Select Billing Code and Billing Date.");
        //        return;
        //    }

        //}

        //GridFooterItem footeritem = (GridFooterItem)FoodBillingListView.MasterTableView.GetItems(GridItemType.Footer)[0];
        //RadNumericTextBox Total = (RadNumericTextBox)footeritem.FindControl("lblTotalAmnt");
        //Total.Text = GrandTotal2.ToString();
    }
        protected void grdFollowUpBudget_ItemCreated(object sender, GridItemEventArgs e)
        {
            try
            {
                string budgetVersion = ReturnBudgetVersionFromCombo();
                if (!IsDeleteButtonEnable())
                {
                    if (e.Item is GridFooterItem)
                    {
                        GridFooterItem commandItem = e.Item as GridFooterItem;
                        IndImageButton button      = commandItem.FindControl("btnDelete") as IndImageButton;
                        button.Enabled = false;

                        button.ImageUrl = ResolveUrl("~/Images/buttons_delete_disabled.png");
                    }
                    if (e.Item is GridItem)
                    {
                        GridItem itm = e.Item as GridItem;
                        CheckBox ck  = itm.FindControl("chkDeleteCol") as CheckBox;
                        if (ck != null)
                        {
                            ck.Enabled = false;
                        }
                    }
                }
                if (e.Item is GridFooterItem)
                {
                    GridFooterItem commandItem = e.Item as GridFooterItem;
                    LinkButton     navigateAll = commandItem.FindControl("btnNavigateAll") as LinkButton;
                    if (IsBATAOrPM(currentUser) || IsFunctionalManager(currentUser))
                    {
                        switch (CmbTypeSelectedValue)
                        {
                        case ApplicationConstants.BUDGET_TYPE_INITIAL:
                            navigateAll.PostBackUrl = "~/Pages/Budget/WPPreselection/WPPreselection.aspx?Code=" + ApplicationConstants.MODULE_INITIAL + "&IdAssociate=" + ApplicationConstants.INT_NULL_VALUE + "&BudgetVersion=" + budgetVersion + "&IsFromFollowUp=1";
                            break;

                        case ApplicationConstants.BUDGET_TYPE_REVISED:
                            navigateAll.PostBackUrl = "~/Pages/Budget/WPPreselection/WPPreselection.aspx?Code=" + ApplicationConstants.MODULE_REVISED + "&IdAssociate=" + ApplicationConstants.INT_NULL_VALUE + "&BudgetVersion=" + budgetVersion + "&IsFromFollowUp=1";
                            break;

                        case ApplicationConstants.BUDGET_TYPE_TOCOMPLETION:
                            navigateAll.PostBackUrl = "~/Pages/Budget/WPPreselection/WPPreselection.aspx?Code=" + ApplicationConstants.MODULE_REFORECAST + "&IdAssociate=" + ApplicationConstants.INT_NULL_VALUE + "&BudgetVersion=" + budgetVersion + "&IsFromFollowUp=1";
                            break;

                        default:
                            navigateAll.PostBackUrl = "~/Pages/Budget/WPPreselection/WPPreselection.aspx?Code=" + ApplicationConstants.MODULE_INITIAL + "&IdAssociate=" + ApplicationConstants.INT_NULL_VALUE;
                            break;
                        }
                        navigateAll.PostBackUrl += "&BudgetType=" + (cmbType.SelectedIndex - 1);
                    }
                    else
                    {
                        navigateAll.Visible = false;
                    }
                }
            }
            catch (IndException ex)
            {
                ShowError(ex);
                return;
            }
            catch (Exception ex)
            {
                ShowError(new IndException(ex));
                return;
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string newScheme         = string.Empty;
            string PanNum            = string.Empty;
            string TransactionType   = string.Empty;
            string FolioNumber       = string.Empty;
            double Price             = 0;
            double Units             = 0;
            double Amount            = 0;
            int    UserTransactionNo = 0;
            int    CMFTSId           = 0;
            bool   blResult          = false;

            rejectedRecordsBo = new RejectedRecordsBo();
            GridFooterItem footerRow = (GridFooterItem)gvWERPTrans.MasterTableView.GetItems(GridItemType.Footer)[0];

            foreach (GridDataItem dr in gvWERPTrans.Items)
            {
                if (((TextBox)footerRow.FindControl("txtSchemeFooter")).Text.Trim() == "")
                {
                    newScheme = ((TextBox)dr.FindControl("txtScheme")).Text;
                }
                else
                {
                    newScheme = ((TextBox)footerRow.FindControl("txtSchemeFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtPanFooter")).Text.Trim() == "")
                {
                    PanNum = ((TextBox)dr.FindControl("txtPanNum")).Text;
                }
                else
                {
                    PanNum = ((TextBox)footerRow.FindControl("txtPanFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtTransactionFooter")).Text.Trim() == "")
                {
                    TransactionType = ((TextBox)dr.FindControl("txtTransaction")).Text;
                }
                else
                {
                    TransactionType = ((TextBox)footerRow.FindControl("txtTransactionFooter")).Text;
                }
                if (((TextBox)footerRow.FindControl("txtFolioNumberFooter")).Text.Trim() == "")
                {
                    FolioNumber = ((TextBox)dr.FindControl("txtFolioNumber")).Text;
                }
                else
                {
                    FolioNumber = ((TextBox)footerRow.FindControl("txtFolioNumberFooter")).Text;
                }

                if (((TextBox)footerRow.FindControl("txtPriceFooter")).Text.Trim() == "")
                {
                    Price = Convert.ToDouble(((TextBox)dr.FindControl("txtPrice")).Text);
                }
                else
                {
                    Price = Convert.ToDouble(((TextBox)footerRow.FindControl("txtPriceFooter")).Text);
                }
                if (((TextBox)footerRow.FindControl("txtUnitsFooter")).Text.Trim() == "")
                {
                    Units = Convert.ToDouble(((TextBox)dr.FindControl("txtUnits")).Text);
                }
                else
                {
                    Units = Convert.ToDouble(((TextBox)footerRow.FindControl("txtUnitsFooter")).Text);
                }
                if (((TextBox)footerRow.FindControl("txtAmountFooter")).Text.Trim() == "")
                {
                    Amount = Convert.ToDouble(((TextBox)dr.FindControl("txtAmount")).Text);
                }
                else
                {
                    Amount = Convert.ToDouble(((TextBox)footerRow.FindControl("txtAmountFooter")).Text);
                }
                if (((TextBox)footerRow.FindControl("txtUsertransactionFooter")).Text.Trim() == "")
                {
                    UserTransactionNo = Convert.ToInt32(((TextBox)dr.FindControl("txtUsertransaction")).Text);
                }
                else
                {
                    UserTransactionNo = Convert.ToInt32(((TextBox)footerRow.FindControl("txtUsertransactionFooter")).Text);
                }


                CheckBox checkBox = (CheckBox)dr.FindControl("chkId");
                if (checkBox.Checked)
                {
                    int          selectedRow = 0;
                    GridDataItem gdi;
                    gdi         = (GridDataItem)checkBox.NamingContainer;
                    selectedRow = gdi.ItemIndex + 1;
                    CMFTSId     = int.Parse((gvWERPTrans.MasterTableView.DataKeyValues[selectedRow - 1]["CMFTSId"].ToString()));
                    blResult    = rejectedRecordsBo.UpdateMFTrasactionStaging(CMFTSId, PanNum, newScheme, TransactionType, FolioNumber, Price, Units, Amount, UserTransactionNo);
                }
            }
            if (blResult)
            {
                // Success Message
            }
            else
            {
                // Failure Message
            }
            // BindGrid
            if (Request.QueryString["processId"] != null)
            {
                ProcessId = Int32.Parse(Request.QueryString["processId"].ToString());
            }
            if (Request.QueryString["filetypeid"] != null)
            {
                filetypeId = Int32.Parse(Request.QueryString["filetypeid"].ToString());
            }
            //BindGrid(ProcessId);
            BindEquityTransactionGrid(ProcessId);
        }
        protected void grdDocVenta_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem item = (GridDataItem)e.Item;
                item["CostoVentaReal"].BackColor = System.Drawing.ColorTranslator.FromHtml("#D6EAF8");
                item["Rentabilidad"].BackColor   = System.Drawing.ColorTranslator.FromHtml("#D6EAF8");

                item["CostoVentaCalculado"].BackColor   = System.Drawing.ColorTranslator.FromHtml("#F7DC6F");
                item["RentabilidadCalculado"].BackColor = System.Drawing.ColorTranslator.FromHtml("#F7DC6F");

                item["CostoVentaEstandar"].BackColor   = System.Drawing.ColorTranslator.FromHtml("#EDBB99");
                item["RentabilidadEstandar"].BackColor = System.Drawing.ColorTranslator.FromHtml("#EDBB99");
            }

            if (e.Item is GridFooterItem)
            {
                GridFooterItem footerItem    = e.Item as GridFooterItem;
                string         strValorVenta = footerItem["ValorVenta"].Text;
                strValorVenta = strValorVenta.Substring(1, strValorVenta.Length - 1);
                strValorVenta = strValorVenta.Replace(",", string.Empty);
                string strValorPlanificado = footerItem["ValorPlanificado"].Text;
                strValorPlanificado = strValorPlanificado.Substring(1, strValorPlanificado.Length - 1);
                strValorPlanificado = strValorPlanificado.Replace(",", string.Empty);

                string strCostoVentaR = footerItem["CostoVentaReal"].Text;
                strCostoVentaR = strCostoVentaR.Substring(1, strCostoVentaR.Length - 1);
                strCostoVentaR = strCostoVentaR.Replace(",", string.Empty);

                string strCostoVentaC = footerItem["CostoVentaCalculado"].Text;
                strCostoVentaC = strCostoVentaC.Substring(1, strCostoVentaC.Length - 1);
                strCostoVentaC = strCostoVentaC.Replace(",", string.Empty);

                string strCostoVentaE = footerItem["CostoVentaEstandar"].Text;
                strCostoVentaE = strCostoVentaE.Substring(1, strCostoVentaC.Length - 1);
                strCostoVentaE = strCostoVentaE.Replace(",", string.Empty);

                if (!string.IsNullOrEmpty(strValorPlanificado))
                {
                    if (decimal.Parse(strValorPlanificado) > 0)
                    {
                        footerItem["Avance"].Text = Math.Round((decimal.Parse(strValorVenta) / decimal.Parse(strValorPlanificado) * 100), 0).ToString() + "%";
                    }
                    else
                    {
                        footerItem["Avance"].Text = "100%";
                    }
                }

                if (!string.IsNullOrEmpty(strValorVenta))
                {
                    if (decimal.Parse(strValorVenta) > 0)
                    {
                        footerItem["Rentabilidad"].Text = Math.Round(((decimal.Parse(strValorVenta) - decimal.Parse(strCostoVentaR)) * 100 / decimal.Parse(strValorVenta)), 0).ToString() + "%";
                    }
                    else
                    {
                        footerItem["Rentabilidad"].Text = "100%";
                    }
                }

                if (!string.IsNullOrEmpty(strValorVenta))
                {
                    if (decimal.Parse(strValorVenta) > 0)
                    {
                        footerItem["RentabilidadCalculado"].Text = Math.Round(((decimal.Parse(strValorVenta) - decimal.Parse(strCostoVentaC)) * 100 / decimal.Parse(strValorVenta)), 0).ToString() + "%";
                    }
                    else
                    {
                        footerItem["RentabilidadCalculado"].Text = "100%";
                    }
                }

                if (!string.IsNullOrEmpty(strValorVenta))
                {
                    if (decimal.Parse(strValorVenta) > 0)
                    {
                        footerItem["RentabilidadEstandar"].Text = Math.Round(((decimal.Parse(strValorVenta) - decimal.Parse(strCostoVentaE)) * 100 / decimal.Parse(strValorVenta)), 0).ToString() + "%";
                    }
                    else
                    {
                        footerItem["RentabilidadEstandar"].Text = "100%";
                    }
                }

                //if (!string.IsNullOrEmpty(strValorVenta))
                //{
                //    if (decimal.Parse(strValorVenta) > 0)
                //        footerItem["RentabilidadCalculado"].Text = Math.Round(((decimal.Parse(strValorVenta) - decimal.Parse(strCostoVenta)) * 100 / decimal.Parse(strValorVenta)), 0).ToString() + "%";
                //    else
                //        footerItem["RentabilidadCalculado"].Text = "100%";
                //}
                //
            }
        }
    protected void rgSearchResults_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (Request.QueryString["cid"] != null)
        {
            if (Request.QueryString["cid"].ToString() != string.Empty)
            {
                _clientid = Convert.ToInt32(Request.QueryString["cid"].ToString());
            }
        }

        if (e.Item is GridHeaderItem)
        {
            GridHeaderItem dataitem  = (GridHeaderItem)e.Item;
            DataSet        dsdisplay = objSearchResultsColVisibleBAL.SRColVisibleSelectByVisible(Convert.ToInt32(_clientid));
            if (dsdisplay.Tables.Count > 0 && dsdisplay.Tables[0].Rows.Count > 0)
            {
                if (dsdisplay.Tables[0].Rows[0]["country"].ToString() == "True")
                {
                    dataitem["country"].Visible = true;
                }
                else
                {
                    dataitem["country"].Visible = false;
                }

                if (dsdisplay.Tables[0].Rows[0]["state"].ToString() == "True")
                {
                    dataitem["state"].Visible = true;
                }
                else
                {
                    dataitem["state"].Visible = false;
                }
                if (dsdisplay.Tables[0].Rows[0]["city"].ToString() == "True")
                {
                    dataitem["city"].Visible = true;
                }
                else
                {
                    dataitem["city"].Visible = false;
                }
                if (dsdisplay.Tables[0].Rows[0]["facility"].ToString() == "True")
                {
                    dataitem["facility"].Visible = true;
                }
                else
                {
                    dataitem["facility"].Visible = false;
                }

                if (dsdisplay.Tables[0].Rows[0]["speciality"].ToString() == "True")
                {
                    dataitem["speciality"].Visible = true;
                }
                else
                {
                    dataitem["speciality"].Visible = false;
                }

                if (dsdisplay.Tables[0].Rows[0]["postdate"].ToString() == "True")
                {
                    dataitem["posteddate"].Visible = true;
                }
                else
                {
                    dataitem["posteddate"].Visible = false;
                }
            }
        }

        if (e.Item is GridDataItem)
        {
            GridDataItem dataitem  = (GridDataItem)e.Item;
            DataSet      dsdisplay = objSearchResultsColVisibleBAL.SRColVisibleSelectByVisible(Convert.ToInt32(_clientid));
            if (dsdisplay.Tables.Count > 0 && dsdisplay.Tables[0].Rows.Count > 0)
            {
                if (dsdisplay.Tables[0].Rows[0]["country"].ToString() == "True")
                {
                    dataitem["country"].Visible = true;
                }
                else
                {
                    dataitem["country"].Visible = false;
                }

                if (dsdisplay.Tables[0].Rows[0]["state"].ToString() == "True")
                {
                    dataitem["state"].Visible = true;
                }
                else
                {
                    dataitem["state"].Visible = false;
                }
                if (dsdisplay.Tables[0].Rows[0]["city"].ToString() == "True")
                {
                    dataitem["city"].Visible = true;
                }
                else
                {
                    dataitem["city"].Visible = false;
                }
                if (dsdisplay.Tables[0].Rows[0]["facility"].ToString() == "True")
                {
                    dataitem["facility"].Visible = true;
                }
                else
                {
                    dataitem["facility"].Visible = false;
                }

                if (dsdisplay.Tables[0].Rows[0]["speciality"].ToString() == "True")
                {
                    dataitem["speciality"].Visible = true;
                }
                else
                {
                    dataitem["speciality"].Visible = false;
                }

                if (dsdisplay.Tables[0].Rows[0]["postdate"].ToString() == "True")
                {
                    dataitem["posteddate"].Visible = true;
                }
                else
                {
                    dataitem["posteddate"].Visible = false;
                }
            }
        }
        if (e.Item is GridFooterItem)
        {
            GridFooterItem dataitem  = (GridFooterItem)e.Item;
            DataSet        dsdisplay = objSearchResultsColVisibleBAL.SRColVisibleSelectByVisible(Convert.ToInt32(_clientid));
            if (dsdisplay.Tables.Count > 0 && dsdisplay.Tables[0].Rows.Count > 0)
            {
                if (dsdisplay.Tables[0].Rows[0]["country"].ToString() == "True")
                {
                    dataitem["country"].Visible = true;
                }
                else
                {
                    dataitem["country"].Visible = false;
                }

                if (dsdisplay.Tables[0].Rows[0]["state"].ToString() == "True")
                {
                    dataitem["state"].Visible = true;
                }
                else
                {
                    dataitem["state"].Visible = false;
                }
                if (dsdisplay.Tables[0].Rows[0]["city"].ToString() == "True")
                {
                    dataitem["city"].Visible = true;
                }
                else
                {
                    dataitem["city"].Visible = false;
                }
                if (dsdisplay.Tables[0].Rows[0]["facility"].ToString() == "True")
                {
                    dataitem["facility"].Visible = true;
                }
                else
                {
                    dataitem["facility"].Visible = false;
                }
                if (dsdisplay.Tables[0].Rows[0]["speciality"].ToString() == "True")
                {
                    dataitem["speciality"].Visible = true;
                }
                else
                {
                    dataitem["speciality"].Visible = false;
                }
                if (dsdisplay.Tables[0].Rows[0]["postdate"].ToString() == "True")
                {
                    dataitem["posteddate"].Visible = true;
                }
                else
                {
                    dataitem["posteddate"].Visible = false;
                }
            }
        }
    }