private void CargarGasto(Int32 CodGasto) { Clases.cFunciones fun = new Clases.cFunciones(); Clases.cGastosPagar gasto = new Clases.cGastosPagar(); DataTable trdo = gasto.GetGastosPagarxCodGasto(CodGasto); if (trdo.Rows.Count > 0) { txtPatente.Text = trdo.Rows[0]["Patente"].ToString(); txtImporte.Text = trdo.Rows[0]["Importe"].ToString(); txtDescripcion.Text = trdo.Rows[0]["Descripcion"].ToString(); txtCodVenta.Text = trdo.Rows[0]["CodVenta"].ToString(); if (txtImporte.Text != "") { txtImporte.Text = fun.SepararDecimales(txtImporte.Text); txtImporte.Text = fun.FormatoEnteroMiles(txtImporte.Text); txtTope.Text = txtImporte.Text; } txtFechaPago.Text = trdo.Rows[0]["FechaPago"].ToString(); if (fun.ValidarFecha(txtFechaPago.Text) == true) { btnAnular.Enabled = true; btnGrabar.Enabled = false; txtImporte.Enabled = false; } else { btnAnular.Enabled = false; btnGrabar.Enabled = true; txtImporte.Enabled = true; } } }
private void btnGrabar_Click(object sender, EventArgs e) { Clases.cFunciones fun = new Clases.cFunciones(); if (fun.ValidarFecha(txtFechaPago.Text) == false) { MessageBox.Show("Debe ingresar una fecha válida", Clases.cMensaje.Mensaje()); return; } double Importe = fun.ToDouble(txtImporte.Text); double Tope = fun.ToDouble(txtTope.Text); double dif = Tope - Importe; string Descrip2 = ""; if (dif > 0) { Descrip2 = "DIFERENCIA POSITVA DE TRANSFERENCIA, PATENTE " + txtPatente.Text; } if (dif < 0) { Descrip2 = "DIFERENCIA NEGATIVA DE TRANSFERENCIA, PATENTE " + txtPatente.Text; } if (dif < 0) { //paga el tope mas la diferencia negativa Importe = Tope; } if (dif > 0) { //paga el tope mas la diferencia negativa Importe = Tope; } string Descripcion = txtDescripcion.Text + " " + txtPatente.Text; Clases.cMovimiento mov = new Clases.cMovimiento(); DateTime Fecha = Convert.ToDateTime(txtFechaPago.Text); Clases.cGastosPagar gasto = new Clases.cGastosPagar(); gasto.ActualizarPago(Convert.ToInt32(Principal.CodigoPrincipalAbm), Fecha); mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, -1 * Importe, 0, 0, 0, 0, Fecha, Descripcion); if (dif != 0) { Int32?CodVenta = null; if (txtCodVenta.Text.Trim() != "") { CodVenta = Convert.ToInt32(txtCodVenta.Text); } //hubo exedente o menor plata mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, dif, 0, 0, 0, 0, Fecha, Descrip2); Clases.cDiferenciaTransferencia obj = new Clases.cDiferenciaTransferencia(); obj.Insertar(CodVenta, dif, Convert.ToInt32(Principal.CodigoPrincipalAbm)); } MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje()); btnGrabar.Enabled = false; }
private void CargarGastosGeneralesxCodStoxk(Int32 CodStock) { Clases.cFunciones fun = new Clases.cFunciones(); Clases.cGastosPagar gastos = new Clases.cGastosPagar(); DataTable trdo = gastos.GetGastosPagarxCodStock(CodStock); trdo = fun.TablaaMiles(trdo, "Importe"); GrillaGastosRecepcion.DataSource = trdo; GrillaGastosRecepcion.Columns[0].Width = 250; GrillaGastosRecepcion.Columns[3].Width = 120; GrillaGastosRecepcion.Columns[3].HeaderText = "Fecha Pago"; }
private void btnBuscar_Click(object sender, EventArgs e) { Clases.cFunciones fun = new Clases.cFunciones(); if (fun.ValidarFecha(txtFechaDesde.Text) == false) { MessageBox.Show("Fecha desde incorrecta", Clases.cMensaje.Mensaje()); return; } if (fun.ValidarFecha(txtFechaHasta.Text) == false) { MessageBox.Show("Fecha hasta incorrecta", Clases.cMensaje.Mensaje()); return; } if (Convert.ToDateTime(txtFechaDesde.Text) > Convert.ToDateTime(txtFechaHasta.Text)) { MessageBox.Show("La fecha desde debe ser inferior a la fecha hasta", Clases.cMensaje.Mensaje()); return; } DateTime FechaDesde = Convert.ToDateTime(txtFechaDesde.Text); DateTime FechaHasta = Convert.ToDateTime(txtFechaHasta.Text); int Impagos = 0; if (chkImpagos.Checked == true) { Impagos = 1; } //Clases.cFunciones fun = new Clases.cFunciones(); Clases.cGastosPagar gasto = new Clases.cGastosPagar(); DataTable trdo = gasto.GetGastosPagarxFecha(FechaDesde, FechaHasta, txtPatente.Text, Impagos); trdo = fun.TablaaMiles(trdo, "Importe"); txtTotal.Text = fun.TotalizarColumna(trdo, "Importe").ToString(); Grilla.DataSource = trdo; Grilla.Columns[5].HeaderText = "Fecha Pago"; Grilla.Columns[0].Visible = false; Grilla.Columns[1].Width = 160; Grilla.Columns[2].Width = 355; Grilla.Columns[4].Width = 120; Grilla.Columns[5].Width = 110; if (txtTotal.Text != "") { txtTotal.Text = fun.SepararDecimales(txtTotal.Text); txtTotal.Text = fun.FormatoEnteroMiles(txtTotal.Text); } }
private void btnAnular_Click(object sender, EventArgs e) { string msj = "Confirma anular el pago"; var result = MessageBox.Show(msj, "Información", MessageBoxButtons.YesNo, MessageBoxIcon.Question); // If the no button was pressed ... if (result == DialogResult.No) { return; } Clases.cFunciones fun = new Clases.cFunciones(); double Importe = fun.ToDouble(txtImporte.Text); string Descripcion = "PAGO ANULADO " + txtDescripcion.Text + " " + txtPatente.Text; Clases.cMovimiento mov = new Clases.cMovimiento(); DateTime Fecha = Convert.ToDateTime(txtFechaPago.Text); Clases.cGastosPagar gasto = new Clases.cGastosPagar(); Clases.cDiferenciaTransferencia objDif = new Clases.cDiferenciaTransferencia(); double ImporteDiferencia = objDif.GetImporteDiferenciaxCodGasto(Convert.ToInt32(Principal.CodigoPrincipalAbm)); int positivo = 0; if (ImporteDiferencia > 0) { positivo = 1; } ImporteDiferencia = -1 * ImporteDiferencia; if (positivo == 1) { Importe = Importe + ImporteDiferencia; } gasto.ActualizarPago(Convert.ToInt32(Principal.CodigoPrincipalAbm), null); mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, Importe, 0, 0, 0, 0, Fecha, Descripcion); //saco el exedente mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, ImporteDiferencia, 0, 0, 0, 0, Fecha, "AJUSTE DE DIFERENCIA"); MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje()); objDif.Borrar(Convert.ToInt32(Principal.CodigoPrincipalAbm)); btnAnular.Enabled = false; }
private void Actualizar() { //obtengo el importe de documentos a cobrar GetDeudasxPrestamo(); GetEfectivosaPagar(); GetCobranzaGeneral(); GetChequesPagar(); Clases.cFunciones fun = new Clases.cFunciones(); Clases.cCuota cuota = new Clases.cCuota(); Clases.cCuotasAnteriores cuotasAnt = new Clases.cCuotasAnteriores(); Clases.cCheque cheque = new Clases.cCheque(); Double ImporteCheque = cheque.GetTotalChequesaCobrar(); Clases.cChequeCobrar chequeCob = new Clases.cChequeCobrar(); ImporteCheque = ImporteCheque + chequeCob.GetTotalChequesaCobrar(); Double Importe = cuota.GetMontoCuotasImpagas(); Double ImporteCuotasAnteriores = cuotasAnt.GetMontoCuotasImpagas(); Importe = Importe + ImporteCuotasAnteriores; Double ImporteSinInteres = cuota.GetMontoCuotasImpagasSinInteres(); double ImporteSinInteresCuotasAnt = cuotasAnt.GetMontoCuotasImpagasSinInteres(); ImporteSinInteres = ImporteSinInteres + ImporteSinInteresCuotasAnt; txtDocumentos.Text = fun.TransformarEntero(Importe.ToString().Replace(",", ".")); txtDocumentos.Text = fun.FormatoEnteroMiles(txtDocumentos.Text); txtDocumentosSinInteres.Text = ImporteSinInteres.ToString(); txtDocumentosSinInteres.Text = fun.TransformarEntero(ImporteSinInteres.ToString()); txtDocumentosSinInteres.Text = fun.FormatoEnteroMiles(txtDocumentosSinInteres.Text); txtTotalCheque.Text = fun.FormatoEnteroMiles(ImporteCheque.ToString()); Clases.cResumenCuentas res = new Clases.cResumenCuentas(); DataTable trdo = res.GetResumenCuentas(); if (trdo.Rows.Count > 0) { double ImporteEfectivo = Convert.ToDouble(trdo.Rows[0]["ImporteEfectivo"]); txtEfectivo.Text = fun.TransformarEntero(ImporteEfectivo.ToString().Replace(",", ".")); txtEfectivo.Text = fun.FormatoEnteroMiles(txtEfectivo.Text); double ImporteAuto = Convert.ToDouble(trdo.Rows[0]["ImporteAuto"]); txtVehículo.Text = fun.TransformarEntero(ImporteAuto.ToString().Replace(",", ".")); txtVehículo.Text = fun.FormatoEnteroMiles(txtVehículo.Text); double ImportePrenda = Convert.ToDouble(trdo.Rows[0]["ImportePrenda"]); txtPrenda.Text = fun.TransformarEntero(ImportePrenda.ToString().Replace(",", ".")); txtPrenda.Text = fun.FormatoEnteroMiles(txtPrenda.Text); double ImporteCobranza = Convert.ToDouble(trdo.Rows[0]["ImporteCobranza"]); txtCobranzas.Text = fun.TransformarEntero(ImporteCobranza.ToString().Replace(",", ".")); txtCobranzas.Text = fun.FormatoEnteroMiles(txtCobranzas.Text); double ImporteBanco = Convert.ToDouble(trdo.Rows[0]["ImporteBanco"]); txtBanco.Text = fun.TransformarEntero(ImporteBanco.ToString().Replace(",", ".")); txtBanco.Text = fun.FormatoEnteroMiles(txtBanco.Text); Clases.cComisionVendedor com = new Clases.cComisionVendedor(); txtComisiones.Text = com.GetComisionesPendientes().ToString(); if (txtComisiones.Text != "") { txtComisiones.Text = fun.FormatoEnteroMiles(txtComisiones.Text); } Clases.cGastosPagar gasto = new Clases.cGastosPagar(); txtGastosPendientes.Text = gasto.GetGastosaPagar().ToString(); if (txtGastosPendientes.Text != "") { txtGastosPendientes.Text = fun.FormatoEnteroMiles(txtGastosPendientes.Text); } Clases.cCobranza cob = new Clases.cCobranza(); txtCobranzas.Text = cob.GetTotalDeudaCobranzas().ToString(); txtCobranzas.Text = fun.FormatoEnteroMiles(txtCobranzas.Text); GetPrendas(); GetTotalVehiculo(); GetTarjeta(); } }