Example #1
0
 public static void AddMsgToCtrlOnClick(ref System.Web.UI.WebControls.Button ctrl, string msg)
 {
     JSUtils.AddMsgToCtrlOnClick(ref ctrl, msg, true);
 }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                this.lblDescripcion.Visible = false;
                String sOnchange;
                this.txtFecha.Text = Utils.Now.ToString("dd/MM/yyyy");
                JSUtils.AddDisableWhenClick(ref this.btnAgregar0, this);
                JSUtils.AddDisableWhenClick(ref this.btnModificar, this);
                sOnchange  = "EnableDisableAbonosCargos('";
                sOnchange += this.ddlConcepto.ClientID + "','";
                sOnchange += this.cmbTipodeMov.ClientID + "');";
                this.ddlConcepto.Attributes.Add("onChange", sOnchange);
                JSUtils.AddMsgToCtrlOnClick(ref this.btnCancelar, "¡¡NO OLVIDE ACTUALIZAR LA LISTA DE MOVIMIENTOS DE BANCO !!", false);
                JSUtils.closeCurrentWindow(ref this.btnCancelar);
                if (Request.QueryString["data"] != null)
                {
                    if (this.loadqueryStrings(Request.QueryString["data"].ToString()))
                    {
                        this.btnAgregar0.Visible  = true;
                        this.btnModificar.Visible = false;
                        if (this.myQueryStrings["movID"] != null && int.TryParse(this.myQueryStrings["movID"].ToString(), out imovID) && imovID > -1) //CHECAMOS SI ES PARA MODIFICAR
                        {
                            this.lblmovID.Text = imovID.ToString();
                            //AQUI VERIFICAMOS SI EL MOVIMIENTO VIENE DE UN CRÉDITO
                            if (this.cargadatostomodify())
                            {
                                Logger.Instance.LogUserSessionRecord(Logger.typeModulo.MOVIMIENTOSDEBANCO, Logger.typeUserActions.SELECT, this.UserID, "ABRIÓ EL MOVIMIENTO DE BANCO NÚMERO." + this.lblmovID.Text);
                                this.btnModificar.Visible = true;
                                this.btnAgregar0.Visible  = false;
                                this.drpdlCuenta.Enabled  = false;
                            }
                            else
                            {
                                Response.Write("<script type=\"text/javascript\">window.close();</script>");
                            }
                        }
//                         else
//                         {
//                            //AQUI PONEMOS EL CODIGO SI RECIBIMOS EL ANTICIPO ID O ALGO
//                             if (this.myQueryStrings["creditoFinID"] != null && int.TryParse(this.myQueryStrings["creditoFinID"].ToString(), out credFinID) && credFinID > -1)
//                             {
//                                 this.lblcredFinID.Text = credFinID.ToString();
//                                 this.lblDescripcion.Text = "ESTE MOVIMIENTO SE AGREGARÁ AL CREDITO FINANCIERO: " + credFinID.ToString();
//                                 this.lblDescripcion.Visible = true;
//                             }
//                         }

                        //here is where if the mov de banco is currently related to anything
                        //load the data for modify it
                        if (this.myQueryStrings["creditoFinID"] != null && int.TryParse(this.myQueryStrings["creditoFinID"].ToString(), out credFinID) && credFinID > -1)
                        {
                            this.lblcredFinID.Text      = credFinID.ToString();
                            this.lblDescripcion.Text    = "ESTE MOVIMIENTO ESTÁ AGREGADO AL CREDITO FINANCIERO: " + credFinID.ToString();
                            this.lblDescripcion.Visible = true;

                            this.chkNotadeCompra.Visible      = false;
                            this.pnlNotaCompra.Visible        = false;
                            this.chkCreditoFinanciero.Enabled = false;
                            this.pnlCreditoFinanciero.Visible = true;
                            this.chkCreditoFinanciero.Checked = true;

                            this.pnlFactura.Visible     = false;
                            this.chkFactura.Visible     = false;
                            this.chkNotadeVenta.Visible = false;
                            this.pnlNotadeVenta.Visible = false;
                            this.LoadCreditoFinancieroData(credFinID);
                        }
                        else
                        if (this.myQueryStrings["FacturaCVID"] != null && int.TryParse(this.myQueryStrings["FacturaCVID"].ToString(), out this.FacturaVentaID) && FacturaVentaID > -1)
                        {
                            this.lblcredFinID.Text            = this.FacturaVentaID.ToString();
                            this.lblDescripcion.Text          = "ESTE MOVIMIENTO ESTÁ LIGADO A LA FACTURA DE VENTA: " + this.FacturaVentaID.ToString();
                            this.lblDescripcion.Visible       = true;
                            this.chkNotadeCompra.Visible      = false;
                            this.pnlNotaCompra.Visible        = false;
                            this.chkCreditoFinanciero.Visible = false;
                            this.pnlCreditoFinanciero.Visible = false;
                            this.chkFactura.Enabled           = false;
                            this.pnlFactura.Visible           = true;
                            this.chkFactura.Checked           = true;
                            this.chkNotadeVenta.Visible       = false;
                            this.pnlNotadeVenta.Visible       = false;

                            this.pnlFactura_CollapsiblePanelExtender.Collapsed = false;
                            SqlConnection connFac = new SqlConnection(myConfig.ConnectionInfo);
                            try
                            {
                                SqlCommand comm = new SqlCommand();
                                connFac.Open();
                                comm.Connection  = connFac;
                                comm.CommandText = "SELECT FacturaCV, cicloID, clienteVentaID FROM FacturasClientesVenta WHERE (FacturaCV = @FacturaCV)";
                                comm.Parameters.Add("@FacturaCV", SqlDbType.Int).Value = FacturaVentaID;
                                SqlDataReader reader = comm.ExecuteReader();
                                reader.Read();
                                this.ddlFacturaCiclo.DataBind();
                                this.ddlFacturaCiclo.SelectedValue = reader["cicloID"].ToString();
                                this.ddlFacturaCiclo.Enabled       = false;
                                this.ddlFacturaClientesVenta.DataBind();
                                this.ddlFacturaClientesVenta.SelectedValue = reader["clienteVentaID"].ToString();
                                this.ddlFacturaClientesVenta.Enabled       = false;
                                this.ddlFacturas.DataBind();
                                this.ddlFacturas.SelectedValue = FacturaVentaID.ToString();
                                this.ddlFacturas.Enabled       = false;
                            }
                            catch (System.Exception ex)
                            {
                                Logger.Instance.LogException(Logger.typeUserActions.SELECT, "getting ciclo y cliente id's", ref ex);
                            }
                            finally
                            {
                                connFac.Close();
                            }
                        }
                        else
                        if (this.myQueryStrings["notaventaID"] != null && int.TryParse(this.myQueryStrings["notaventaID"].ToString(), out notaventaID) && notaventaID > -1)
                        {
                            this.lblNotaVentaID.Text                 = this.notaventaID.ToString();
                            this.lblDescripcion.Text                 = "ESTE MOVIMIENTO ESTÁ LIGADO A LA NOTA DE VENTA: " + this.notaventaID.ToString();
                            this.lblDescripcion.Visible              = true;
                            this.chkNotadeCompra.Visible             = false;
                            this.pnlNotaCompra.Visible               = false;
                            this.chkCreditoFinanciero.Visible        = false;
                            this.pnlCreditoFinanciero.Visible        = false;
                            this.chkFactura.Visible                  = false;
                            this.pnlFactura.Visible                  = false;
                            this.chkNotadeVenta.Enabled              = false;
                            this.pnlNotadeVenta.Visible              = true;
                            this.chkNotadeVenta.Checked              = true;
                            this.CollapsiblePanelExtender3.Collapsed = false;

                            SqlConnection connFac = new SqlConnection(myConfig.ConnectionInfo);
                            try
                            {
                                SqlCommand comm = new SqlCommand();
                                connFac.Open();
                                comm.Connection  = connFac;
                                comm.CommandText = "SELECT  cicloID, productorID,   Folio + ' - ' + CAST(notadeventaID AS VARCHAR(50)) + ' ' + CONVERT(varchar(50), Fecha, 103) AS Nota, notadeventaID FROM Notasdeventa WHERE (notadeventaID = @notadeventaID)";
                                comm.Parameters.Add("@notadeventaID", SqlDbType.Int).Value = notaventaID;
                                SqlDataReader reader = comm.ExecuteReader();
                                reader.Read();
                                this.ddlFacturaCiclo.DataBind();
                                this.drpdlCicloNotaVenta.SelectedValue = reader["cicloID"].ToString();
                                this.drpdlCicloNotaVenta.Enabled       = false;
                                this.drpdlCicloNotaVenta.DataBind();
                                this.drpdlProductoresNotaVenta.SelectedValue = reader["productorID"].ToString();
                                this.drpdlProductoresNotaVenta.Enabled       = false;
                                this.drpdlProductoresNotaVenta.DataBind();
                                this.dprdlNota.SelectedValue = notaventaID.ToString();
                                this.dprdlNota.Enabled       = false;
                            }
                            catch (System.Exception ex)
                            {
                                Logger.Instance.LogException(Logger.typeUserActions.SELECT, "getting ciclo y productor id's", ref ex);
                            }
                            finally
                            {
                                connFac.Close();
                            }
                        }
                        else
                        {
                            if (this.myQueryStrings["notacompraID"] != null && int.TryParse(this.myQueryStrings["notacompraID"].ToString(), out notacompraID) && notacompraID > -1)
                            {
                                this.lblNotaCompraID.Text = this.notacompraID.ToString();
                                this.cargaDatosNCompra();
                            }
                        }
                    }
                    else
                    {
                        Logger.Instance.LogMessage(Logger.typeLogMessage.CRITICAL, Logger.typeUserActions.SELECT, this.UserID, "ERROR AL CARGAR DATOS EN ADDMOVQUICK, LOS PARÄMETROS PASADOS COMO QUERYSTRINGS NO CORRESPONDEN A ALGUN MOVIMIENTO ", this.Request.Url.ToString());
                        Response.Write("<script type=\"text/javascript\">window.close();</script>");
                    }
                }
                else
                {
                    this.txtFecha.Text          = Utils.Now.ToString("dd/MM/yyyy");
                    this.lblDescripcion.Visible = false;
                }
                //this.divConceptosFiscales.Attributes.Add("style", this.chkMostrarFiscales.Checked ? "visibility: visible; display: block" : "visibility: hidden; display: none");
                this.pnlNewMov.Visible = false;
            }
        }