private void BtnAsentarpago_Click(object sender, EventArgs e) { string respuesta = ""; decimal saldo = 0; int codrecibo = 0; string mensaje = ""; midata = new DataTable(); Negociocaja objcaja = new Negociocaja(); midata.Columns.Add("Idventa", typeof(int)); midata.Columns.Add("saldo", typeof(decimal)); midata.Columns.Add("pagado", typeof(decimal)); midata.Columns.Add("total", typeof(decimal)); midata.Columns.Add("estado", typeof(string)); midata.Columns.Add("grabar", typeof(string)); if (traerpagototal(false) != 0) { Frmasentarpago objpago = new Frmasentarpago(traerpagototal(true)); objpago.Midatatable = midata; objpago.ShowDialog(); if (objpago.Confirmarpago == true) { cargardatatable(objpago.Importe); //objpago.importe en ves de pagototal respuesta = NegocioCliente.agregaromodificarrecibo(midata, objpago.Importe, idcliente, NegocioConfigEmpresa.idusuario, ref codrecibo); } if (respuesta == "ok") { if (objcaja.chequeocaja("FrmClientes", ref mensaje) == true) { respuesta = Negociocaja.insertarmovcaja(1310101, Convert.ToSingle(objpago.Importe), 0, Convert.ToString(DateTime.Now), NegocioConfigEmpresa.usuarioconectado, NegocioConfigEmpresa.idusuario, NegocioConfigEmpresa.turno, "Recibo nro : " + codrecibo.ToString(), codrecibo, true); if (respuesta == "ok") { NegocioCliente.modificarestadocajarecibo(codrecibo); } } FrmReporteRecibo formrecibo = new Formreportes.FrmReporteRecibo(codrecibo); formrecibo.ShowDialog(); UtilityFrm.mensajeConfirm("El pago se guardo con exito"); buscarctacte(Convert.ToInt32(txtCodigo.Text == string.Empty ? "0" : txtCodigo.Text)); } } else { UtilityFrm.mensajeError("No hay saldo"); } }
private void menuconfventa_Click(object sender, EventArgs e) { string mensaje = ""; bool constock = false; try { Negociocaja objcaja = new Negociocaja(); DataGridViewRow row = dataLista.CurrentRow; if (Convert.ToBoolean(row.Cells["caja"].Value) == false) { if (objcaja.chequeocaja(this.Name, ref mensaje) == true) { Negociocaja.insertarmovcaja(4110107, Convert.ToSingle(row.Cells["Total"].Value.ToString()), 0, Convert.ToString(DateTime.Now), NegocioConfigEmpresa.usuarioconectado, NegocioConfigEmpresa.idusuario, NegocioConfigEmpresa.turno, "Venta nro : " + row.Cells["codigo"].Value.ToString(), Convert.ToInt64(row.Cells["codigo"].Value.ToString()), true); if (NegocioConfigEmpresa.confsistema("stock").ToString() == this.Name) { DataTable ventas = cargardetallestock(row.Cells["codigo"].Value.ToString()); mensaje = NegocioMovStock.insertar(0, DateTime.Today, "", row.Cells["codigo"].Value.ToString(), "VENTA", 0, "EMITIDO", "EGRESO", ventas); if (mensaje != "ok") { constock = false; UtilityFrm.mensajeError(mensaje); } else { constock = true; } } NegocioVenta.cambiarestadoventa(Convert.ToInt32(row.Cells["codigo"].Value.ToString()), true, constock); } else { UtilityFrm.mensajeError(mensaje); } } } catch (Exception i) { UtilityFrm.mensajeError(i.Message); } buscarPorFecha(); actualizarTotal(); }