private void BuscarAutosdeStock(string Patente, Int32?CodMarca) { double Total = 0; Clases.cFunciones fun = new Clases.cFunciones(); Clases.cStockAuto stock = new Clases.cStockAuto(); DataTable trdo = stock.GetStockDetalladosVigente(Patente, CodMarca); trdo = fun.TablaaMiles(trdo, "Costo"); Total = fun.TotalizarColumna(trdo, "Costo"); txtTotalVehiculos.Text = trdo.Rows.Count.ToString(); Grilla.DataSource = trdo; Grilla.Columns[0].Visible = false; Grilla.Columns[2].Width = 195; Grilla.Columns[3].Width = 280; Grilla.Columns[4].Width = 90; Grilla.Columns[5].Width = 200; Grilla.Columns[4].HeaderText = "Fecha"; Grilla.Columns[5].HeaderText = "Ex Titular"; Grilla.Columns[7].HeaderText = "Concesión"; txtMontoTotal.Text = Total.ToString(); if (txtMontoTotal.Text != "") { txtMontoTotal.Text = fun.SepararDecimales(txtMontoTotal.Text); txtMontoTotal.Text = fun.FormatoEnteroMiles(txtMontoTotal.Text); } }
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; } } } }
private void btnBajaStock_Click(object sender, EventArgs e) { if (Grilla.CurrentRow == null) { MessageBox.Show("Debe seleccionar un elemento para continuar", Clases.cMensaje.Mensaje()); return; } string msj = "Confirma quitar el auto del stock "; var result = MessageBox.Show(msj, "Información", MessageBoxButtons.YesNo, MessageBoxIcon.Question); // If the no button was pressed ... if (result == DialogResult.No) { return; } Int32 CodStock = Convert.ToInt32(Grilla.CurrentRow.Cells[0].Value); Int32 Concesion = Convert.ToInt32(Grilla.CurrentRow.Cells[7].Value); if (Concesion == 1) { Clases.cStockAuto stock = new Clases.cStockAuto(); stock.InsertarBajaStock(CodStock, DateTime.Now); MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje()); Buscar(); } else { MessageBox.Show("El auto no esta en concesión", Clases.cMensaje.Mensaje()); } }
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(); } }
private string GetCombustiblexCodStock(Int32 CodStock) { Clases.cStockAuto obj = new Clases.cStockAuto(); DataTable trdo = obj.GetStockxCodigo(CodStock); string Combustible = ""; if (trdo.Rows.Count > 0) { Combustible = trdo.Rows[0]["Combustible"].ToString(); } return(Combustible); }
private string GetKilometrosxCodStock(Int32 CodStock) { Clases.cStockAuto obj = new Clases.cStockAuto(); DataTable trdo = obj.GetStockxCodigo(CodStock); string Kilometros = ""; if (trdo.Rows.Count > 0) { Kilometros = trdo.Rows[0]["Kilometros"].ToString(); } return(Kilometros); }
private string GetPrecioxCodStock(Int32 CodStock) { Clases.cStockAuto obj = new Clases.cStockAuto(); DataTable trdo = obj.GetStockxCodigo(CodStock); string Precio = ""; if (trdo.Rows.Count > 0) { Precio = trdo.Rows[0]["PrecioVenta"].ToString(); } return(Precio); }
private string GetModeloxCodStock(Int32 CodStock) { Clases.cStockAuto obj = new Clases.cStockAuto(); DataTable trdo = obj.GetStockxCodigo(CodStock); string Modelo = ""; if (trdo.Rows.Count > 0) { Modelo = trdo.Rows[0]["Anio"].ToString(); } return(Modelo); }
private void GetTotalVehiculo() { Clases.cFunciones fun = new Clases.cFunciones(); Clases.cStockAuto stock = new Clases.cStockAuto(); DataTable trdo = stock.GetStockDetalladosVigente("", null); double Total = fun.TotalizarColumnaCondicion(trdo, "Costo", "Concesion", "0"); txtVehículo.Text = Total.ToString(); if (txtVehículo.Text != "") { txtVehículo.Text = fun.SepararDecimales(txtVehículo.Text); txtVehículo.Text = fun.FormatoEnteroMiles(txtVehículo.Text); } }
private void BtnAgregarCheque_Click(object sender, EventArgs e) { if (txtPrecioVenta.Text == "") { MessageBox.Show("Debe ingresar un precio para continuar", Clases.cMensaje.Mensaje()); return; } Clases.cFunciones fun = new Clases.cFunciones(); double Importe = fun.ToDouble(txtPrecioVenta.Text); Int32 CodStock = Convert.ToInt32(Principal.CodigoPrincipalAbm); Clases.cStockAuto stock = new Clases.cStockAuto(); stock.ActualizarPrecioVenta(CodStock, Importe); MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje()); }
private void CargarCheques(Int32 CodStock) { Clases.cFunciones fun = new Clases.cFunciones(); Clases.cCompra compra = new Clases.cCompra(); Int32 CodCompra = compra.GetCodCompraxCodStock(CodStock); Clases.cChequesaPagar cheque = new Clases.cChequesaPagar(); DataTable trdo = cheque.GetChequesxCodCompra(CodCompra); trdo = fun.TablaaMiles(trdo, "Importe"); GrillaCheques.DataSource = trdo; GrillaCheques.Columns[3].HeaderText = "Fecha Pago"; GrillaCheques.Columns[3].Width = 100; GrillaCheques.Columns[4].Width = 270; GrillaCheques.Columns[5].Visible = false; GrillaCheques.Columns[6].Visible = false; DataTable tComp = compra.GetCompraxCodigo(CodCompra); GetEfectivoPagar(CodCompra); if (tComp.Rows.Count > 0) { if (tComp.Rows[0]["ImporteEfectivo"].ToString() != "") { txtEfectivo.Text = tComp.Rows[0]["ImporteEfectivo"].ToString(); txtEfectivo.Text = fun.SepararDecimales(txtEfectivo.Text); txtEfectivo.Text = fun.FormatoEnteroMiles(txtEfectivo.Text); } if (tComp.Rows[0]["ImporteAutoPartePago"].ToString() != "") { txtImporteAutoPartePago.Text = tComp.Rows[0]["ImporteAutoPartePago"].ToString(); txtImporteAutoPartePago.Text = fun.SepararDecimales(txtImporteAutoPartePago.Text); txtImporteAutoPartePago.Text = fun.FormatoEnteroMiles(txtImporteAutoPartePago.Text); } if (tComp.Rows[0]["CodStockSalida"].ToString() != "") { Clases.cStockAuto stock = new Clases.cStockAuto(); DataTable tauto = stock.GetStockxCodigo(Convert.ToInt32(tComp.Rows[0]["CodStockSalida"].ToString())); if (tauto.Rows.Count > 0) { txtPatente2.Text = tauto.Rows[0]["Patente"].ToString(); txtDescripcion2.Text = tauto.Rows[0]["Descripcion"].ToString(); } } //GetStockxCodigo } }
private Boolean ExisteStock(Int32 CodAuto) { Boolean Existe = false; Clases.cStockAuto stock = new Clases.cStockAuto(); DataTable trdo = stock.GetStockAutosVigentes(CodAuto); if (trdo.Rows.Count > 0) { if (trdo.Rows[0]["CodAuto"].ToString() != "") { Existe = true; } } return(Existe); }
private void CargarAuto(Int32 CodStock) { Clases.cStockAuto stock = new Clases.cStockAuto(); DataTable trdoAuto = stock.GetStockxCodigo(CodStock); if (trdoAuto.Rows.Count > 0) { if (trdoAuto.Rows[0]["FechaAlta"].ToString() != "") { DateTime FechaIngreso = Convert.ToDateTime(trdoAuto.Rows[0]["FechaAlta"].ToString()); txtFechaIngreso.Text = FechaIngreso.ToShortDateString(); } txtPatente.Text = trdoAuto.Rows[0]["Patente"].ToString(); txtDescripcion.Text = trdoAuto.Rows[0]["Descripcion"].ToString(); txtkms.Text = trdoAuto.Rows[0]["Kilometros"].ToString(); txtanio.Text = trdoAuto.Rows[0]["Anio"].ToString(); txtCiudad.Text = trdoAuto.Rows[0]["Motor"].ToString(); txtChasis.Text = trdoAuto.Rows[0]["Chasis"].ToString(); txtMotor.Text = trdoAuto.Rows[0]["Motor"].ToString(); txtCiudad.Text = trdoAuto.Rows[0]["Ciudad"].ToString(); txtImporte.Text = trdoAuto.Rows[0]["ImporteCompra"].ToString(); txtPrecioVenta.Text = trdoAuto.Rows[0]["PrecioVenta"].ToString(); txtCodCompra.Text = trdoAuto.Rows[0]["CodCompra"].ToString(); if (txtImporte.Text != "") { txtImporte.Text = txtImporte.Text.Replace(",", "."); string[] vec = txtImporte.Text.Split('.'); Clases.cFunciones fun = new Clases.cFunciones(); txtImporte.Text = fun.FormatoEnteroMiles(vec[0]); } if (txtPrecioVenta.Text != "") { txtPrecioVenta.Text = txtPrecioVenta.Text.Replace(",", "."); string[] vec = txtPrecioVenta.Text.Split('.'); Clases.cFunciones fun = new Clases.cFunciones(); txtPrecioVenta.Text = fun.FormatoEnteroMiles(vec[0]); } txtExTitular.Text = trdoAuto.Rows[0]["ApeNom"].ToString(); txtAutoPartePago.Text = trdoAuto.Rows[0]["DescripcionAutoPartePago"].ToString(); } }
private void Buscar() { Clases.cFunciones fun = new Clases.cFunciones(); string Patente = txtPatente.Text; Int32? CodMarca = null; if (cmbMarca.SelectedIndex > 0) { CodMarca = Convert.ToInt32(cmbMarca.SelectedValue); } Clases.cStockAuto stock = new Clases.cStockAuto(); DataTable trdo = stock.GetStockDetalladosVigente(Patente, CodMarca); txtTotalVehiculos.Text = trdo.Rows.Count.ToString(); trdo = fun.TablaaMiles(trdo, "Costo"); Grilla.DataSource = trdo; Grilla.Columns[0].Visible = false; Grilla.Columns[7].HeaderText = "Concesión"; //Grilla.Columns[7].Visible = false; Grilla.Columns[2].Width = 170; Grilla.Columns[3].Width = 200; Grilla.Columns[4].Width = 100; Grilla.Columns[5].Width = 200; //double Total = fun.TotalizarColumna(trdo, "Costo"); double Total = fun.TotalizarColumnaCondicion(trdo, "Costo", "Concesion", "0"); double TotalConcesion = fun.TotalizarColumnaCondicion(trdo, "Costo", "Concesion", "1"); txtMontoTotal.Text = Total.ToString(); txtConcesion.Text = TotalConcesion.ToString(); if (txtMontoTotal.Text != "") { txtMontoTotal.Text = fun.SepararDecimales(txtMontoTotal.Text); txtMontoTotal.Text = fun.FormatoEnteroMiles(txtMontoTotal.Text); } if (txtConcesion.Text != "") { txtConcesion.Text = fun.SepararDecimales(txtConcesion.Text); txtConcesion.Text = fun.FormatoEnteroMiles(txtConcesion.Text); } }
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(); } }