예제 #1
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            string msj    = "Confirma eliminar el Cliente ";
            var    result = MessageBox.Show(msj, "Información",
                                            MessageBoxButtons.YesNo,
                                            MessageBoxIcon.Question);

            // If the no button was pressed ...
            if (result == DialogResult.No)
            {
                return;
            }
            Clases.cCliente clie = new Clases.cCliente();
            if (clie.PuedeBorrar(Convert.ToInt32(txtCodCLiente.Text)))
            {
                Clases.cFunciones fun = new Clases.cFunciones();
                fun.EliminarGenerico("Cliente", "CodCliente", txtCodCLiente.Text);
                MessageBox.Show("El cliente se ha eliminado de la base", Clases.cMensaje.Mensaje());
                fun.LimpiarGenerico(this);
                txtCodCLiente.Text = "";
                Botonera(1);
            }
            else
            {
                MessageBox.Show("El cliente no se puede eliminar, se perderían datos historicos.", Clases.cMensaje.Mensaje());
            }
        }
예제 #2
0
        private string GetCliente(Int32 CodCLiente, string Campo)
        {
            string Dato = "";

            Clases.cCliente cliente = new Clases.cCliente();
            DataTable       trdo    = cliente.GetClientesxCodigo(CodCLiente);

            if (trdo.Rows.Count > 0)
            {
                if (Campo == "NOMBRE")
                {
                    Dato = trdo.Rows[0]["Nombre"].ToString();
                    Dato = Dato + " " + trdo.Rows[0]["Apellido"].ToString();
                }
                if (Campo == "TELEFONO")
                {
                    Dato = trdo.Rows[0]["Telefono"].ToString();
                }

                if (Campo == "CELULAR")
                {
                    Dato = trdo.Rows[0]["Celular"].ToString();
                }
            }
            return(Dato);
        }
예제 #3
0
        private void GetTelefonoCliente(Int32 CodStock)
        {
            Clases.cStockAuto stock = new Clases.cStockAuto();
            DataTable         trdo  = stock.GetStockxCodigo(CodStock);

            if (trdo.Rows.Count > 0)
            {
                if (trdo.Rows[0]["CodCliente"].ToString() != "")
                {
                    Int32           CodCliente = Convert.ToInt32(trdo.Rows[0]["CodCliente"].ToString());
                    Clases.cCliente cli        = new Clases.cCliente();
                    DataTable       tbCliente  = cli.GetClientesxCodigo(CodCliente);
                    if (tbCliente.Rows.Count > 0)
                    {
                        string telefono = tbCliente.Rows[0]["Telefono"].ToString();
                        string NroDoc   = tbCliente.Rows[0]["NroDocumento"].ToString();
                        txtTelefono.Text = telefono;
                        string Nombre   = tbCliente.Rows[0]["Nombre"].ToString();
                        string Apellido = tbCliente.Rows[0]["Apellido"].ToString();
                        string NomApe   = Nombre + " " + Apellido;
                        txtCliente.Text = NomApe;
                        string Celular = tbCliente.Rows[0]["Celular"].ToString();
                        txtCelular.Text = Celular;
                        txtNroDoc.Text  = NroDoc;
                    }
                }
            }
        }
예제 #4
0
        private void txtNroDoc_TextChanged(object sender, EventArgs e)
        {
            Int32 CodTipoDoc = 0;

            if (cmbDocumento.SelectedIndex > 0)
            {
                CodTipoDoc = Convert.ToInt32(cmbDocumento.SelectedValue);
            }
            string nroDocumento = txtNroDoc.Text;

            Clases.cCliente cliente = new Clases.cCliente();
            DataTable       trdo    = cliente.GetClientesxNroDoc(CodTipoDoc, nroDocumento);

            if (trdo.Rows.Count > 0)
            {
                txtNombre.Text   = trdo.Rows[0]["Nombre"].ToString();
                txtApellido.Text = trdo.Rows[0]["Apellido"].ToString();
                txtTelefono.Text = trdo.Rows[0]["Telefono"].ToString();
                txtCelular.Text  = trdo.Rows[0]["Celular"].ToString();
                txtCalle.Text    = trdo.Rows[0]["Calle"].ToString();
                txtAltura.Text   = trdo.Rows[0]["Numero"].ToString();
                if (trdo.Rows[0]["CodBarrio"].ToString() != "")
                {
                    CmbBarrio.SelectedValue = trdo.Rows[0]["CodBarrio"].ToString();
                }
                txtCodCLiente.Text = trdo.Rows[0]["CodCliente"].ToString();
                CargarPatentesxCliente(Convert.ToInt32(txtCodCLiente.Text));
            }
            else
            {
                LimpiarCliente();
            }
        }
예제 #5
0
        private void BuscarCliente(string NroDocumento, string Ape, string Nom)
        {
            Clases.cCliente clie = new Clases.cCliente();
            DataTable       trdo = clie.BuscarCliente(NroDocumento, Ape, Nom);

            Grilla.DataSource         = trdo;
            Grilla.Columns[0].Visible = false;
            Grilla.Columns[2].Width   = 240;
            Grilla.Columns[3].Width   = 240;
        }
예제 #6
0
        private void UbicaCliente()
        {
            Int32 CodTipoDoc = 0;

            if (cmb_CodTipoDoc.SelectedIndex > 0)
            {
                CodTipoDoc = Convert.ToInt32(cmb_CodTipoDoc.SelectedValue);
            }
            string nroDocumento = txt_NroDocumento.Text;

            Clases.cCliente cliente = new Clases.cCliente();
            DataTable       trdo    = cliente.GetClientesxNroDoc(CodTipoDoc, nroDocumento);

            if (trdo.Rows.Count > 0)
            {
                txtCodCLiente.Text = trdo.Rows[0]["CodCliente"].ToString();
            }
        }
예제 #7
0
        private void CargarCLiente(Int32 CodCliente)
        {
            Clases.cCliente cliente = new Clases.cCliente();
            DataTable       trdo    = cliente.GetClientesxCodigo(CodCliente);

            if (trdo.Rows.Count > 0)
            {
                txtNombre.Text   = trdo.Rows[0]["Nombre"].ToString();
                txtApellido.Text = trdo.Rows[0]["Apellido"].ToString();
                txtTelefono.Text = trdo.Rows[0]["Telefono"].ToString();
                txtCelular.Text  = trdo.Rows[0]["Celular"].ToString();
                txtCalle.Text    = trdo.Rows[0]["Calle"].ToString();
                txtAltura.Text   = trdo.Rows[0]["Numero"].ToString();
                if (trdo.Rows[0]["CodBarrio"].ToString() != "")
                {
                    CmbBarrio.SelectedValue = trdo.Rows[0]["CodBarrio"].ToString();
                }
                txtCodCLiente.Text = trdo.Rows[0]["CodCliente"].ToString();
                txtNroDoc.Text     = trdo.Rows[0]["NroDocumento"].ToString();
                CargarPatentesxCliente(Convert.ToInt32(txtCodCLiente.Text));
            }
        }
예제 #8
0
        public DataTable GetCobranzasAdeudadas(string Patente, string Apellido, DateTime Fecha, int ConDeuda)
        {
            int    b            = 0;
            Int32  CodAuto      = 0;
            string ListaCodAuto = "(";
            string sql          = "";

            if (Patente != "")
            {
                b = 1;
                Clases.cAuto auto = new Clases.cAuto();
                DataTable    trdo = auto.GetAutoxContenidoPatente(Patente);
                if (trdo.Rows.Count > 0)
                {
                    if (trdo.Rows[0]["CodAuto"].ToString() != "")
                    {
                        for (int i = 0; i < trdo.Rows.Count; i++)
                        {
                            b       = 1;
                            CodAuto = Convert.ToInt32(trdo.Rows[i]["CodAuto"].ToString());
                            if (ListaCodAuto == "(")
                            {
                                ListaCodAuto = ListaCodAuto + CodAuto.ToString();
                            }
                            else
                            {
                                ListaCodAuto = ListaCodAuto + "," + CodAuto.ToString();
                            }
                        }
                        ListaCodAuto = ListaCodAuto + ")";
                    }
                }
                sql = "select * 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 v.CodAutoVendido = a.CodAuto";
                sql = sql + " and c.Saldo >0 ";
                if (ConDeuda == 1)
                {
                    sql = sql + " and c.FechaCompromiso <" + "'" + Fecha.ToShortDateString() + "'";
                }
                if (ListaCodAuto != "(")
                {
                    sql = sql + " and v.CodAutoVendido in " + ListaCodAuto.ToString();
                }
                else
                {
                    sql = sql + " and v.CodAutoVendido=-1";
                }
            }
            if (b == 0)
            {
                string    ListaCliente = "(";
                cCliente  cli          = new cCliente();
                DataTable trdo         = cli.GetClientexApellido(Apellido);
                for (int i = 0; i < trdo.Rows.Count; i++)
                {
                    if (ListaCliente == "(")
                    {
                        ListaCliente = ListaCliente + trdo.Rows[i]["CodCliente"].ToString();
                    }
                    else
                    {
                        ListaCliente = ListaCliente + "," + trdo.Rows[i]["CodCliente"].ToString();
                    }
                }
                ListaCliente = ListaCliente + ")";
                if (ListaCliente == "()")
                {
                    ListaCliente = "(-1)";
                }
                sql = "select * 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 v.CodAutoVendido = a.CodAuto";
                sql = sql + " and c.Saldo >0 ";
                if (ConDeuda == 1)
                {
                    sql = sql + " and c.FechaCompromiso <" + "'" + Fecha.ToShortDateString() + "'";
                }
                if (ListaCliente != "(")
                {
                    sql = sql + " and v.CodCliente in " + ListaCliente.ToString();
                }
                else
                {
                    sql = sql + " and v.CodAutoVendido=-1";
                }
            }
            return(cDb.ExecuteDataTable(sql));
        }
예제 #9
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;
            }
        }