private void btnAnular_Click(object sender, EventArgs e) { if (Grilla.CurrentRow == null) { MessageBox.Show("Debe seleccionar un registro", Clases.cMensaje.Mensaje()); return; } cGastosNegocio obj = new cGastosNegocio(); Int32 CodGasto = Convert.ToInt32(Grilla.CurrentRow.Cells[0].Value.ToString()); obj.BorrarGasto(CodGasto); DateTime Fecha = DateTime.Now; double Importe = fun.ToDouble(Grilla.CurrentRow.Cells[4].Value.ToString()); string Descripcion = "ANULACION " + Grilla.CurrentRow.Cells[2].Value.ToString(); //Int32 CodGasto = Convert.ToInt32 (Grilla.CurrentRow.Cells[0].Value.ToString ()); Clases.cMovimiento mov = new Clases.cMovimiento(); mov.GrabarMovimiento(Importe, Descripcion, Fecha, 1, null); MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje()); Buscar(); }
private void GetRentabilidad() { cCobroTarjeta objCobro = new cCobroTarjeta(); Clases.cFunciones fun = new Clases.cFunciones(); DateTime FechaDesde = Convert.ToDateTime(txtFechaDesde.Text); DateTime FechaHasta = Convert.ToDateTime(txtFechaHasta.Text); cOrden orden = new cOrden(); txtCantidad.Text = orden.CantidadOrdenes(FechaDesde, FechaHasta).ToString(); double Efectivo = orden.GetTotalEfectivo(FechaDesde, FechaHasta); txtEfectivo.Text = Efectivo.ToString(); if (txtEfectivo.Text != "") { txtEfectivo.Text = fun.FormatoEnteroMiles(txtEfectivo.Text); } double TotalTarjeta = 0; cCobroTarjeta cobro = new cCobroTarjeta(); TotalTarjeta = cobro.GetTotalTarjeta(FechaDesde, FechaHasta); // Double Saldo = cobro.GetSaldoxFecha(FechaDesde, FechaHasta); txtDiferenciaTarjeta.Text = Saldo.ToString(); TotalTarjeta = TotalTarjeta - Saldo; txtTarjeta.Text = TotalTarjeta.ToString(); if (txtTarjeta.Text != "") { txtTarjeta.Text = fun.FormatoEnteroMiles(txtTarjeta.Text); } if (txtDiferenciaTarjeta.Text != "") { txtDiferenciaTarjeta.Text = fun.FormatoEnteroMiles(txtDiferenciaTarjeta.Text); } cDocumento doc = new cDocumento(); double ImporteDocu = doc.GetTotalDocumento(FechaDesde, FechaHasta); txtImporteDocumento.Text = ImporteDocu.ToString(); if (txtImporteDocumento.Text != "") { txtImporteDocumento.Text = fun.FormatoEnteroMiles(txtImporteDocumento.Text); } cCheque cheque = new cCheque(); double ImporteCheque = cheque.GetTotalChequexFecha(FechaDesde, FechaHasta); txtcheque.Text = ImporteCheque.ToString(); if (txtcheque.Text != "") { txtcheque.Text = fun.FormatoEnteroMiles(txtcheque.Text); } cGarantia garantia = new cGarantia(); double ImporteGarantia = garantia.GetTotalGarantiaxFecha(FechaDesde, FechaHasta); txtGarantia.Text = ImporteGarantia.ToString(); if (txtGarantia.Text != "") { txtGarantia.Text = fun.FormatoEnteroMiles(txtGarantia.Text); } cCuentaCorriente cc = new cCuentaCorriente(); Double ImporteCuentaCorriene = 0; ImporteCuentaCorriene = cc.GetTotalCuentaxFecha(FechaDesde, FechaHasta); txtTotalCuentaCorriente.Text = ImporteCuentaCorriene.ToString(); if (txtTotalCuentaCorriente.Text != "") { txtTotalCuentaCorriente.Text = fun.FormatoEnteroMiles(txtTotalCuentaCorriente.Text); } cTransferencia tranfer = new cTransferencia(); Double ImporteTransferencia = tranfer.GetTotalTransferencia(FechaDesde, FechaHasta); txtTotalTransferencia.Text = ImporteTransferencia.ToString(); if (txtTotalTransferencia.Text != "") { txtTotalTransferencia.Text = fun.FormatoEnteroMiles(txtTotalTransferencia.Text); } double TotalFacturado = Efectivo + TotalTarjeta + ImporteDocu + ImporteCheque + ImporteGarantia + ImporteCuentaCorriene + ImporteTransferencia; txtTotalFacturado.Text = TotalFacturado.ToString(); if (txtTotalFacturado.Text != "") { txtTotalFacturado.Text = fun.FormatoEnteroMiles(txtTotalFacturado.Text); } double GananciaInsumos = orden.GetGananciaInsumo(FechaDesde, FechaHasta); double RecargoTarjeta = objCobro.GetTotalRecargoTarjeta(FechaDesde, FechaHasta); double VentaInsumo = orden.GetVentaInsumo(FechaDesde, FechaHasta); double CostoInsumo = orden.GetCostoInsumo(FechaDesde, FechaHasta); txtVentaInsumos.Text = VentaInsumo.ToString(); txtCostoInsumo.Text = CostoInsumo.ToString(); double GananciaInsuloMostrador = 0; cVenta objVenta = new cVenta(); double CostoMostrador = 0; CostoMostrador = objVenta.GetCostoInsumoVenta(FechaDesde, FechaHasta); txtCostoInsumoMostrador.Text = CostoMostrador.ToString(); //GetVentaInsumoVenta double VentaMostrador = 0; VentaMostrador = objVenta.GetVentaInsumoVenta(FechaDesde, FechaHasta); txtVentaMostrador.Text = VentaMostrador.ToString(); if (txtCostoInsumoMostrador.Text != "") { txtCostoInsumoMostrador.Text = fun.FormatoEnteroMiles(txtCostoInsumoMostrador.Text); } if (txtVentaMostrador.Text != "") { txtVentaMostrador.Text = fun.FormatoEnteroMiles(txtVentaMostrador.Text); } if (txtVentaInsumos.Text != "") { txtVentaInsumos.Text = fun.FormatoEnteroMiles(txtVentaInsumos.Text); } if (txtCostoInsumo.Text != "") { txtCostoInsumo.Text = fun.FormatoEnteroMiles(txtCostoInsumo.Text); } txtGananciaInsumos.Text = GananciaInsumos.ToString(); if (txtGananciaInsumos.Text != "") { txtGananciaInsumos.Text = fun.FormatoEnteroMiles(txtGananciaInsumos.Text); } GananciaInsuloMostrador = VentaMostrador - CostoMostrador; txtGananciaMostrador.Text = GananciaInsuloMostrador.ToString(); if (txtGananciaMostrador.Text != "") { txtGananciaMostrador.Text = fun.FormatoEnteroMiles(txtGananciaMostrador.Text); } double GananciaMo = orden.GetGananciaManoObra(FechaDesde, FechaHasta); txtManoObra.Text = GananciaMo.ToString(); if (txtManoObra.Text != "") { txtManoObra.Text = fun.FormatoEnteroMiles(txtManoObra.Text); } double TotalGanancia = GananciaInsumos + GananciaMo + RecargoTarjeta + GananciaInsuloMostrador - Saldo; txtTotalGanancia.Text = TotalGanancia.ToString(); if (txtTotalGanancia.Text != "") { txtTotalGanancia.Text = fun.FormatoEnteroMiles(txtTotalGanancia.Text); } double GastoAlquiler = 0; cGastosNegocio gasto = new cGastosNegocio(); Int32? CodEntidad = 11; GastoAlquiler = gasto.GetGastosNegocio(FechaDesde, FechaHasta, CodEntidad); txtGastoAlquiler.Text = GastoAlquiler.ToString(); if (txtGastoAlquiler.Text != "") { txtGastoAlquiler.Text = fun.FormatoEnteroMiles(txtGastoAlquiler.Text); } double Sueldos = 0; CodEntidad = 6; Sueldos = gasto.GetGastosNegocio(FechaDesde, FechaHasta, CodEntidad); txtSueldo.Text = Sueldos.ToString(); if (txtSueldo.Text != "") { txtSueldo.Text = fun.FormatoEnteroMiles(txtSueldo.Text); } double Combustible = 0; CodEntidad = 13; Combustible = gasto.GetGastosNegocio(FechaDesde, FechaHasta, CodEntidad); txtCombustible.Text = Combustible.ToString(); if (txtCombustible.Text != "") { txtCombustible.Text = fun.FormatoEnteroMiles(txtCombustible.Text); } double Impuestos = 0; CodEntidad = 2; Impuestos = gasto.GetGastosNegocio(FechaDesde, FechaHasta, CodEntidad); txtImpuesto.Text = Impuestos.ToString(); if (txtImpuesto.Text != "") { txtImpuesto.Text = fun.FormatoEnteroMiles(txtImpuesto.Text); } double Varios = 0; CodEntidad = null; Varios = gasto.GetGastosNegocio(FechaDesde, FechaHasta, CodEntidad); Varios = Varios - Sueldos - Impuestos - Combustible - GastoAlquiler; txtOtrosGastos.Text = Varios.ToString(); if (txtOtrosGastos.Text != "") { txtOtrosGastos.Text = fun.FormatoEnteroMiles(txtOtrosGastos.Text); } double TotalGastos = 0; TotalGastos = Varios + Sueldos + Impuestos + Combustible + GastoAlquiler; //+Saldo; txtTotalGastos.Text = TotalGastos.ToString(); if (txtTotalGastos.Text != "") { txtTotalGastos.Text = fun.FormatoEnteroMiles(txtTotalGastos.Text); } double Rentabilidad = TotalGanancia - TotalGastos; txtRentabilidad.Text = Rentabilidad.ToString(); if (txtRentabilidad.Text != "") { txtRentabilidad.Text = fun.FormatoEnteroMiles(txtRentabilidad.Text); } double SaldoGarantia = garantia.GetTotalSaldoGarantiaxFecha(FechaDesde, FechaHasta); txtSaldoGarantia.Text = SaldoGarantia.ToString(); if (txtSaldoGarantia.Text != "") { txtSaldoGarantia.Text = fun.FormatoEnteroMiles(txtSaldoGarantia.Text); } double TotalSaldoTarjeta = cobro.GetTotalSaldoTarjeta(FechaDesde, FechaHasta); txtSaldoTarjeta.Text = TotalSaldoTarjeta.ToString(); if (txtSaldoTarjeta.Text != "") { txtSaldoTarjeta.Text = fun.FormatoEnteroMiles(txtSaldoTarjeta.Text); } double ImporteSaldoDoc = doc.GetTotalSaldoDocumento(FechaDesde, FechaHasta); txtSaldoDocumento.Text = ImporteSaldoDoc.ToString(); if (txtSaldoDocumento.Text != "") { txtSaldoDocumento.Text = fun.FormatoEnteroMiles(txtSaldoDocumento.Text); } double ImporteSaldoCheque = cheque.GetTotalSaldoChequexFecha(FechaDesde, FechaHasta); txtSaldoCheque.Text = ImporteSaldoCheque.ToString(); if (txtSaldoCheque.Text != "") { txtSaldoCheque.Text = fun.FormatoEnteroMiles(txtSaldoCheque.Text); } }