Ejemplo n.º 1
0
        private void btnEliminar_Click_1(object sender, EventArgs e)
        {
            string msj    = "Confirma eliminar la marca ";
            var    result = MessageBox.Show(msj, "Información",
                                            MessageBoxButtons.YesNo,
                                            MessageBoxIcon.Question);

            // If the no button was pressed ...
            if (result == DialogResult.No)
            {
                return;
            }
            Clases.cAuto cauto = new Clases.cAuto();
            if (cauto.PuedeBorrar(Convert.ToInt32(txtCodAuto.Text)))
            {
                Clases.cFunciones fun = new Clases.cFunciones();
                fun.EliminarGenerico("Auto", "CodAuto", txtCodAuto.Text);
                MessageBox.Show("El vehículo se ha eliminado de la base", Clases.cMensaje.Mensaje());
                fun.LimpiarGenerico(this);
                txtCodAuto.Text = "";
                Botonera(1);
            }
            else
            {
                MessageBox.Show("El vehículo no se puede eliminar, se perderían datos historicos.", Clases.cMensaje.Mensaje());
            }
        }
Ejemplo n.º 2
0
        private void Buscar()
        {
            if (txtPatente.Text == "")
            {
                MessageBox.Show("Debe ingresar una patente", Clases.cMensaje.Mensaje());
                return;
            }
            Clases.cAuto objAuto = new Clases.cAuto();
            DataTable    tauto   = objAuto.GetAutoxPatente(txtPatente.Text);

            if (tauto.Rows.Count > 0)
            {
                if (tauto.Rows[0]["CodAuto"].ToString() != "")
                {
                    Int32         CodAuto  = Convert.ToInt32(tauto.Rows[0]["CodAuto"].ToString());
                    Clases.cVenta objVenta = new Clases.cVenta();
                    Int32         CodVenta = objVenta.GetMaximaCodVentaxAuto(CodAuto);
                    txtCodVenta.Text = CodVenta.ToString();
                    if (CodVenta > 0)
                    {
                        DataTable tcli = objVenta.GetVentaxCodigo(CodVenta);
                        if (tcli.Rows.Count > 0)
                        {
                            Int32 CodCliente = Convert.ToInt32(tcli.Rows[0]["CodCliente"].ToString());
                            CargarPatentesxCliente(CodCliente);
                            CargarCLiente(CodCliente);
                        }
                        CargarPlandeCuotas(CodVenta);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void GetAutoPartePago(Int32 CodVenta)
        {
            Clases.cFunciones fun  = new Clases.cFunciones();
            Clases.cVenta     obj  = new Clases.cVenta();
            DataTable         trdo = obj.GetAutosPartePago(CodVenta);

            if (trdo.Rows.Count > 0)
            {
                if (trdo.Rows[0]["CodAuto"].ToString() != "")
                {
                    string sImporte = trdo.Rows[0]["Importe"].ToString();
                    if (sImporte != "" && sImporte != "0")
                    {
                        sImporte = fun.SepararDecimales(sImporte);
                        sImporte = fun.FormatoEnteroMiles(sImporte);
                    }
                    Int32        CodAuto = Convert.ToInt32(trdo.Rows[0]["CodAuto"].ToString());
                    Clases.cAuto auto    = new Clases.cAuto();
                    DataTable    tauto   = auto.GetAutoxCodigo(CodAuto);
                    {
                        if (tauto.Rows.Count > 0)
                        {
                            string Descrip = " Un vehículo" + tauto.Rows[0]["Marca"].ToString() + " " + tauto.Rows[0]["Descripcion"].ToString();
                            Descrip = Descrip + " MOTOR N º" + tauto.Rows[0]["Motor"].ToString();
                            Descrip = Descrip + " CHASIS N º" + tauto.Rows[0]["Chasis"].ToString();
                            Descrip = Descrip + " AÑO " + tauto.Rows[0]["Anio"].ToString();
                            Descrip = Descrip + " DOMINIO " + tauto.Rows[0]["Patente"].ToString();
                            Descrip = Descrip + " valuado en " + sImporte;
                            txtAutoPartePago.Text = Descrip;
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void txtPatente_TextChanged(object sender, EventArgs e)
        {
            foreach (Control c in this.Controls)
            {
                if (c is GroupBox)
                {
                    foreach (Control g in c.Controls)
                    {
                        if (g is TextBox)
                        {
                            ((TextBox)g).CharacterCasing = CharacterCasing.Upper;
                        }
                    }
                    //Empleamos un casteo
                }
            }
            string Patente = txtPatente.Text;
            int    b       = 0;

            if (Patente.Length > 5)
            {
                Clases.cAuto auto = new Clases.cAuto();
                DataTable    trdo = auto.GetAutoxPatente(Patente);
                if (trdo.Rows.Count > 0)
                {
                    b = 1;
                    txtDescripcion.Text = trdo.Rows[0]["Descripcion"].ToString();
                    txtAnio.Text        = trdo.Rows[0]["Anio"].ToString();
                    txtKms.Text         = trdo.Rows[0]["Kilometros"].ToString();
                    txtCodAuto.Text     = trdo.Rows[0]["CodAuto"].ToString();
                    txtImporte.Text     = trdo.Rows[0]["Importe"].ToString();

                    if (trdo.Rows[0]["CodCiudad"].ToString() != "")
                    {
                        cmbCiudad.SelectedValue = trdo.Rows[0]["CodCiudad"].ToString();
                    }

                    if (trdo.Rows[0]["CodMarca"].ToString() != "")
                    {
                        cmbMarca.SelectedValue = trdo.Rows[0]["CodMarca"].ToString();
                    }

                    Clases.cStockAuto stock = new Clases.cStockAuto();
                    DataTable         trdo2 = stock.GetStockAutosVigentes(Convert.ToInt32(txtCodAuto.Text));
                    if (trdo2.Rows.Count > 0)
                    {
                        txtCodStock.Text = trdo2.Rows[0]["CodStock"].ToString();
                        //cargo los gastos x cod stock
                    }
                    CargarGrilla();
                }
            }
            if (b == 0)
            {
                LimpiarAuto();
            }
        }
Ejemplo n.º 5
0
        private void Buscar(string Patente)
        {
            Clases.cAuto objAuto = new Clases.cAuto();
            DataTable    trdo    = objAuto.GetAutos(txtPatente.Text);

            Grilla.DataSource         = trdo;
            Grilla.Columns[0].Visible = false;
            Grilla.Columns[1].Width   = 100;
            Grilla.Columns[2].Width   = 440;
            Grilla.Columns[3].Width   = 150;
        }
Ejemplo n.º 6
0
        private string GetUbicacion(string Patente)
        {
            Clases.cAuto auto      = new Clases.cAuto();
            DataTable    trdo      = auto.GetAutoxPatente(Patente);
            string       Ubicacion = "";

            if (trdo.Rows.Count > 0)
            {
                if (trdo.Rows[0]["CodAuto"].ToString() != "")
                {
                    Ubicacion = trdo.Rows[0]["Ubicacion"].ToString();
                }
            }
            return(Ubicacion);
        }
Ejemplo n.º 7
0
        private string GetNumeroInternoxPatente(string Patente)
        {
            Clases.cAuto auto          = new Clases.cAuto();
            DataTable    trdo          = auto.GetAutoxPatente(Patente);
            string       NumeroInterno = "";

            if (trdo.Rows.Count > 0)
            {
                if (trdo.Rows[0]["CodAuto"].ToString() != "")
                {
                    NumeroInterno = trdo.Rows[0]["NumeroInterno"].ToString();
                }
            }
            return(NumeroInterno);
        }
Ejemplo n.º 8
0
        private void UbicaAuto()
        {
            string Patente = txt_Patente.Text;

            Clases.cAuto auto = new Clases.cAuto();
            DataTable    trdo = auto.GetAutoxPatente(Patente);

            if (trdo.Rows.Count > 0)
            {
                if (trdo.Rows[0]["CodAuto"].ToString() != "")
                {
                    txtCodAuto.Text = trdo.Rows[0]["CodAuto"].ToString();
                }
            }
        }
Ejemplo n.º 9
0
 private void FrmCobroCheque_Load(object sender, EventArgs e)
 {
     if (Principal.CodigoPrincipalAbm != null)
     {
         Int32        CodAuto = Convert.ToInt32(Principal.CodigoPrincipalAbm);
         Clases.cAuto auto    = new Clases.cAuto();
         DataTable    trdo    = auto.GetAutoxCodigo(CodAuto);
         if (trdo.Rows.Count > 0)
         {
             string Patente = trdo.Rows[0]["Patente"].ToString();
             txtPatente.Text = Patente;
             CargarGrilla();
         }
     }
 }
Ejemplo n.º 10
0
        private void txtPatente_TextChanged(object sender, EventArgs e)
        {
            foreach (Control c in this.Controls)
            {
                if (c is GroupBox)
                {
                    foreach (Control g in c.Controls)
                    {
                        if (g is TextBox)
                        {
                            ((TextBox)g).CharacterCasing = CharacterCasing.Upper;
                        }
                    }
                    //Empleamos un casteo
                }
            }
            int    b       = 0;
            string Patente = txtPatente.Text;

            if (Patente.Length > 5)
            {
                Clases.cAuto auto = new Clases.cAuto();
                DataTable    trdo = auto.GetAutoxPatente(Patente);
                if (trdo.Rows.Count > 0)
                {
                    b = 1;
                    txtCodAuto.Text     = trdo.Rows[0]["CodAuto"].ToString();
                    txtDescripcion.Text = trdo.Rows[0]["Descripcion"].ToString();
                    if (ExisteStock(Convert.ToInt32(txtCodAuto.Text)) == true)
                    {
                        MessageBox.Show("El auto ya existe en el stock", Clases.cMensaje.Mensaje());
                        b = 0;
                    }
                }
            }
            if (b == 0)
            {
                txtCodAuto.Text     = "";
                txtDescripcion.Text = "";
                txtCodAuto.Text     = "";
            }
        }
Ejemplo n.º 11
0
 private void CargarImagen(Int32 CodAuto)
 {
     try
     {
         cAuto     auto = new Clases.cAuto();
         DataTable trdo = auto.GetAutoxCodigo(CodAuto);
         if (trdo.Rows.Count > 0)
         {
             if (trdo.Rows[0]["RutaImagen"].ToString() != "")
             {
                 string Ruta = trdo.Rows[0]["RutaImagen"].ToString();
                 Imagen.Image = System.Drawing.Image.FromFile(Ruta);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("No se pudo cargar la imagen");
     }
 }
Ejemplo n.º 12
0
        public DataTable GetPrendaxPatente(string Patente)
        {
            Int32     CodAuto = -1;
            cAuto     auto    = new cAuto();
            DataTable tauto   = auto.GetAutoxPatente(Patente);

            if (tauto.Rows.Count > 0)
            {
                if (tauto.Rows[0]["CodAuto"].ToString() != "")
                {
                    CodAuto = Convert.ToInt32(tauto.Rows[0]["CodAuto"].ToString());
                }
            }
            string sql = "select p.*,a.Descripcion,cli.Nombre,cli.Apellido from Prenda p, Auto a,Venta v,Cliente cli ";

            sql = sql + " where p.CodAuto = a.CodAuto  ";
            sql = sql + " and v.CodVenta = p.CodVenta ";
            sql = sql + " and v.CodCliente = cli.CodCliente";
            sql = sql + " and a.CodAuto =" + CodAuto.ToString();
            return(cDb.ExecuteDataTable(sql));
        }
Ejemplo n.º 13
0
        private void CargarPatentesxCliente(Int32 CodCliente)
        {
            Clases.cAuto auto = new Clases.cAuto();
            DataTable    trdo = auto.GetAutosCompradosxCuotasxCodCliente(CodCliente);

            Clases.cFunciones fun = new Clases.cFunciones();
            trdo = fun.TablaaMiles(trdo, "Capital");
            GrillaPatente.DataSource         = trdo;
            GrillaPatente.Columns[0].Visible = false;
            GrillaPatente.Columns[1].Visible = false;
            GrillaPatente.Columns[3].Width   = 534;
            int b = 0;

            if (trdo.Rows.Count > 0)
            {
                if (trdo.Rows[0]["CodVenta"].ToString() != "")
                {
                    b = 1;
                    Int32 CodVenta = Convert.ToInt32(trdo.Rows[0]["CodVenta"].ToString());
                    CargarPlandeCuotas(CodVenta);
                }
            }
            else
            {
                return;
            }
            if (b == 0)
            {
                GrillaCuotas.DataSource = null;
            }

            GrillaCuotas.Columns[0].Visible    = false;
            GrillaCuotas.Columns[1].Width      = 73;
            GrillaCuotas.Columns[2].HeaderText = "Fecha vto.";
            GrillaCuotas.Columns[2].Width      = 110;
            GrillaCuotas.Columns[4].HeaderText = "Fecha Pago.";
            GrillaCuotas.Columns[4].Width      = 130;
            GrillaCuotas.Columns[5].HeaderText = "Importe Pago.";
            GrillaCuotas.Columns[5].Width      = 140;
        }
Ejemplo n.º 14
0
        public DataTable GetCobranzaxPatente(string Patente)
        {
            Int32     CodAuto = -1;
            cAuto     auto    = new cAuto();
            DataTable tauto   = auto.GetAutoxPatente(Patente);

            if (tauto.Rows.Count > 0)
            {
                if (tauto.Rows[0]["CodAuto"].ToString() != "")
                {
                    CodAuto = Convert.ToInt32(tauto.Rows[0]["CodAuto"].ToString());
                }
            }
            string sql = "select c.CodCobranza,c.CodVenta,c.Importe,c.Fecha,c.FechaPago,Cli.Apellido,Cli.Nombre,A.Descripcion,c.ImportePagado,c.Saldo";

            sql = sql + ",( select isnull(sum(pun.Importe),0)  from PunitorioCobranza pun where pun.CodCobranza =c.CodCobranza) as Punitorio ";
            sql = sql + " from Cobranza c,Venta v,Cliente Cli,Auto a";
            sql = sql + " where c.CodVenta = v.CodVenta ";
            sql = sql + " and v.CodCliente = cli.CodCliente ";
            sql = sql + " and c.CodAuto = a.CodAuto ";
            sql = sql + " and c.CodAuto =" + CodAuto.ToString();
            return(cDb.ExecuteDataTable(sql));
        }
Ejemplo n.º 15
0
        private void UbicarProvincia(Int32 CodAuto)
        {
            cAuto     auto = new Clases.cAuto();
            DataTable trdo = auto.GetAutoxCodigo(CodAuto);

            if (trdo.Rows.Count > 0)
            {
                if (trdo.Rows[0]["CodProvincia"].ToString() != "")
                {
                    Int32 CodProv = Convert.ToInt32(trdo.Rows[0]["CodProvincia"].ToString());
                    cmbProvincia.SelectedValue = CodProv;
                    cCiudad    ciudad = new Clases.cCiudad();
                    DataTable  tr     = ciudad.GetCiudadxCodProvincia(CodProv);
                    cFunciones fun    = new cFunciones();
                    fun.LlenarComboDatatable(cmb_CodCiudad, tr, "Nombre", "CodCiudad");
                    if (trdo.Rows[0]["CodCiudad"].ToString() != "")
                    {
                        string CodCiudad = trdo.Rows[0]["CodCiudad"].ToString();
                        cmb_CodCiudad.SelectedValue = CodCiudad.ToString();
                    }
                }
            }
        }
Ejemplo n.º 16
0
        public DataTable GetChequesxPatente(string Patente)
        {
            Int32     CodAuto = -1;
            cAuto     auto    = new cAuto();
            DataTable tauto   = auto.GetAutoxPatente(Patente);

            if (tauto.Rows.Count > 0)
            {
                if (tauto.Rows[0]["CodAuto"].ToString() != "")
                {
                    CodAuto = Convert.ToInt32(tauto.Rows[0]["CodAuto"].ToString());
                }
            }
            string sql = "select ch.CodVenta,ch.NroCheque,ch.Importe,ch.FechaPago,ch.FechaVencimiento";

            sql = sql + ",a.Descripcion,c.Nombre,c.Apellido";
            sql = sql + " from Cheque ch,Auto a,Cliente c,venta v";
            sql = sql + " where ch.CodVenta = v.CodVenta ";
            sql = sql + " and v.CodAutoVendido = a.CodAuto";
            sql = sql + " and ch.CodCliente = c.CodCliente";
            sql = sql + " and v.CodAutoVendido =" + CodAuto.ToString();

            return(cDb.ExecuteDataTable(sql));
        }
Ejemplo n.º 17
0
        private void txtPatente_TextChanged(object sender, EventArgs e)
        {
            foreach (Control c in this.Controls)
            {
                if (c is GroupBox)
                {
                    foreach (Control g in c.Controls)
                    {
                        if (g is TextBox)
                        {
                            ((TextBox)g).CharacterCasing = CharacterCasing.Upper;
                        }
                    }
                    //Empleamos un casteo
                }
            }
            Clases.cFunciones fun     = new Clases.cFunciones();
            string            Patente = txtPatente.Text;
            int b = 0;

            if (Patente.Length > 5)
            {
                Clases.cAuto auto = new Clases.cAuto();
                DataTable    trdo = auto.GetAutoxPatente(Patente);
                if (trdo.Rows.Count > 0)
                {
                    b = 1;
                    txtDescripcion.Text = trdo.Rows[0]["Descripcion"].ToString();
                    txtAnio.Text        = trdo.Rows[0]["Anio"].ToString();
                    txtKms.Text         = trdo.Rows[0]["Kilometros"].ToString();
                    txtCodAuto.Text     = trdo.Rows[0]["CodAuto"].ToString();
                    txtImporte.Text     = trdo.Rows[0]["Importe"].ToString();
                    if (txtImporte.Text != "")
                    {
                        txtImporte.Text = fun.SepararDecimales(txtImporte.Text);
                    }
                    if (trdo.Rows[0]["CodCiudad"].ToString() != "")
                    {
                        cmbCiudad.SelectedValue = trdo.Rows[0]["CodCiudad"].ToString();
                    }

                    if (trdo.Rows[0]["CodMarca"].ToString() != "")
                    {
                        cmbMarca.SelectedValue = trdo.Rows[0]["CodMarca"].ToString();
                    }

                    if (trdo.Rows[0]["Propio"].ToString() == "1")
                    {
                        radioPropio.Checked    = true;
                        radioConcesion.Checked = false;
                    }

                    if (trdo.Rows[0]["Concesion"].ToString() == "1")
                    {
                        radioPropio.Checked    = false;
                        radioConcesion.Checked = true;
                    }
                    Clases.cStockAuto stock = new Clases.cStockAuto();
                    DataTable         trdo2 = stock.GetStockAutosVigentes(Convert.ToInt32(txtCodAuto.Text));
                    if (trdo2.Rows.Count > 0)
                    {
                        txtCodStock.Text = trdo2.Rows[0]["CodStock"].ToString();
                        CargarCostoxstock(Convert.ToInt32(txtCodStock.Text));
                    }
                }
            }
            if (b == 0)
            {
                LimpiarAuto();
            }
        }
Ejemplo n.º 18
0
        private void CargarDatos(Int32 CodVenta)
        {
            GetAutoPartePago(CodVenta);
            Clases.cCliente cliente = new Clases.cCliente();
            Clases.cVenta   venta   = new Clases.cVenta();
            DataTable       trdo    = venta.GetVentaxCodigo(CodVenta);

            if (trdo.Rows.Count > 0)
            {
                Int32     CodCliente = Convert.ToInt32(trdo.Rows[0]["CodCliente"].ToString());
                DataTable tcli       = cliente.GetClientesxCodigo(CodCliente);
                if (tcli.Rows.Count > 0)
                {
                    string nombre = tcli.Rows[0]["Nombre"].ToString();
                    nombre = nombre + " " + tcli.Rows[0]["Apellido"].ToString();
                    string Direccion = tcli.Rows[0]["Calle"].ToString();
                    Direccion         = Direccion + " " + tcli.Rows[0]["Numero"].ToString();
                    txtDireccion.Text = Direccion;
                    txtTelefono.Text  = tcli.Rows[0]["Telefono"].ToString();
                    txtNombre.Text    = nombre;
                }
            }
            txtEfectivo.Text   = trdo.Rows[0]["ImporteEfectivo"].ToString();
            txtDocumentos.Text = trdo.Rows[0]["ImporteCredito"].ToString();
            Int32 CodAuto = Convert.ToInt32(trdo.Rows[0]["CodAutoVendido"].ToString());

            Clases.cAuto auto  = new Clases.cAuto();
            DataTable    tauto = auto.GetAutoxCodigo(CodAuto);

            {
                if (tauto.Rows.Count > 0)
                {
                    string Descrip = tauto.Rows[0]["Descripcion"].ToString();
                    Descrip      = Descrip + " AÑO " + tauto.Rows[0]["Anio"].ToString();
                    Descrip      = Descrip + " DOMINIO " + tauto.Rows[0]["Patente"].ToString();
                    Descrip      = Descrip + " MOTOR N º" + tauto.Rows[0]["Motor"].ToString();
                    Descrip      = Descrip + " CHASIS N º" + tauto.Rows[0]["Chasis"].ToString();
                    txtAuto.Text = Descrip;
                }
            }
            Clases.cFunciones fun = new Clases.cFunciones();
            if (txtEfectivo.Text != "0" && txtEfectivo.Text != "")
            {
                txtEfectivo.Text = fun.SepararDecimales(txtEfectivo.Text);
                txtEfectivo.Text = fun.FormatoEnteroMiles(txtEfectivo.Text);
            }

            if (txtDocumentos.Text != "0" && txtDocumentos.Text != "")
            {
                txtDocumentos.Text = fun.SepararDecimales(txtDocumentos.Text);
                txtDocumentos.Text = fun.FormatoEnteroMiles(txtDocumentos.Text);
            }
            Clases.cPrenda prenda     = new Clases.cPrenda();
            DataTable      trdoPrenda = prenda.GetPrendaxCodVenta(Convert.ToInt32(Principal.CodigoPrincipalAbm));

            if (trdoPrenda.Rows.Count > 0)
            {
                string Importe = trdoPrenda.Rows[0]["Importe"].ToString();
                Importe = fun.SepararDecimales(Importe);
                Importe = fun.FormatoEnteroMiles(Importe);
                txtImportePrenda.Text = Importe;
            }
        }