private void btn_Guardar_Click(object sender, EventArgs e) { objAsientoDetalle = new AsientoDetalle(); objAsientoDetalle.Anexo = objDocumentoCab.DocumentoCabClienteDocumento; objAsientoDetalle.Correlativo = txt_Correlativo.Text; objAsientoDetalle.Cuenta = txt_Cuenta.Text; objAsientoDetalle.Documento = txt_Documento.Text; objAsientoDetalle.Fecha = txt_Fecha.Text; objAsientoDetalle.FechaDoc = objDocumentoCab.DocumentoCabFecha.ToString("dd/MM/yyyy"); objAsientoDetalle.FechaVcto = objDocumentoCab.DocumentoCabFechaVcto.ToString("dd/MM/yyyy"); objAsientoDetalle.Importe = objAsientoDao.convertToDouble(txt_Importe.Text); objAsientoDetalle.NumReg = objDocumentoCab.NumeroRegistro; objAsientoDetalle.TipDocCodigo = cmb_Documento.SelectedValue.ToString(); objAsientoDetalle.TipoImporte = cmb_Cuenta.SelectedValue.ToString(); objAsientoDetalle.TipoDoc = cmb_Documento.Text; objAsientoDetalle.CodoOt = txt_ot.Text; if (Operacion == "M") { objListaAsientoDetalle[index] = objAsientoDetalle; } else { objListaAsientoDetalle.Add(objAsientoDetalle); } limpiaCampos(); grd_Facturas.DataSource = null; grd_Facturas.DataSource = objListaAsientoDetalle; grd_Facturas.Refresh(); sumatorias(); habilitaBoton(true, false); habilitarCampos(false); }
public List <AsientoDetalle> getGenerarDetalleCompraServicio2(String numeroRegistro) { List <AsientoDetalle> objList = new List <AsientoDetalle>(); AsientoDetalle obj; Database db = DatabaseFactory.CreateDatabase("Contabilidad"); DbCommand dbCommand = db.GetStoredProcCommand("sp_GenerarCompraAsientoDetalleServicio1", new object[] { numeroRegistro }); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { obj = new AsientoDetalle(); obj.Cuenta = dataReader["Cuenta"].ToString(); obj.TipoImporte = dataReader["TipoImporte"].ToString(); obj.Importe = convertToDouble(dataReader["Importe"].ToString()); obj.TipoDoc = dataReader["TipDoc"].ToString(); obj.Fecha = dataReader["Fecha"].ToString(); obj.Documento = dataReader["Documento"].ToString(); obj.FechaVcto = dataReader["FechaVcto"].ToString(); obj.TipDocCodigo = dataReader["DocCod"].ToString(); obj.TipoAsiento = "11"; obj.CodoOt = dataReader["CodOt"].ToString(); obj.CuentaDescripcion = dataReader["DescripcionCuenta"].ToString(); objList.Add(obj); } } return(objList); }
public List <AsientoDetalle> getGenerarDetalleCentroCosto(String serie, String numero) { List <AsientoDetalle> objList = new List <AsientoDetalle>(); AsientoDetalle obj; Database db = DatabaseFactory.CreateDatabase("Contabilidad"); /*procedimiento almacenado*/ DbCommand dbCommand = db.GetStoredProcCommand("sp_GenerarAsientoVentaCentroCosto", new object[] { serie, numero }); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { obj = new AsientoDetalle(); obj.Cuenta = dataReader["Cuenta"].ToString(); obj.TipoImporte = dataReader["TipoImporte"].ToString(); obj.Importe = convertToDouble(dataReader["Importe"].ToString()); obj.TipoDoc = dataReader["TipDoc"].ToString(); obj.Fecha = dataReader["Fecha"].ToString(); obj.Documento = dataReader["Documento"].ToString(); obj.FechaVcto = dataReader["FechaVcto"].ToString(); obj.TipDocCodigo = dataReader["DocCod"].ToString(); obj.TipoAsiento = "05"; obj.Anexo = ""; objList.Add(obj); } } return(objList); }
public List <AsientoDetalle> getGenerarDetalleVoucherCheque(String nroVoucher) { List <AsientoDetalle> objList = new List <AsientoDetalle>(); AsientoDetalle obj; Database db = DatabaseFactory.CreateDatabase("Contabilidad"); DbCommand dbCommand = db.GetStoredProcCommand("sp_DetalleVoucherAsiento", new object[] { nroVoucher }); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { obj = new AsientoDetalle(); obj.Cuenta = dataReader["Cuenta"].ToString(); obj.TipoImporte = dataReader["TipoImporte"].ToString(); obj.Importe = convertToDouble(dataReader["Importe"].ToString()); obj.TipoDoc = dataReader["TipDoc"].ToString(); obj.Fecha = dataReader["Fecha"].ToString(); obj.Documento = dataReader["Documento"].ToString(); obj.FechaVcto = dataReader["FechaVcto"].ToString(); obj.TipDocCodigo = dataReader["DocCod"].ToString(); obj.TipoAsiento = "01"; obj.Anexo = ""; objList.Add(obj); } } return(objList); }
private void btn_Guardar_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txt_Cuenta.Text)) { MessageBox.Show("Debe ingresar una Cuenta"); return; } if (String.IsNullOrEmpty(txt_Importe.Text)) { MessageBox.Show("Debe ingresar el Importe"); return; } if (String.IsNullOrEmpty(txt_Documento.Text)) { MessageBox.Show("Debe ingresar Documento"); return; } objAsientoDetalle = new AsientoDetalle(); objAsientoDetalle.Correlativo = txt_Correlativo.Text; objAsientoDetalle.Cuenta = txt_Cuenta.Text; objAsientoDetalle.Documento = txt_Documento.Text; objAsientoDetalle.Fecha = txt_Fecha.Text; objAsientoDetalle.TipoImporte = cmb_Cuenta.SelectedValue.ToString(); objAsientoDetalle.TipoAsiento = txt_TipoAsiento.Text; objAsientoDetalle.Importe = objAsientoDao.convertToDouble(txt_Importe.Text); objListaAsientoDetalle.Add(objAsientoDetalle); grd_Facturas.DataSource = null; grd_Facturas.DataSource = objListaAsientoDetalle; grd_Facturas.Refresh(); txt_Importe.Text = ""; txt_Cuenta.Text = ""; txt_Documento.Text = ""; sumatorias(); }
public AbonoBanco() { InitializeComponent(); AbonoForm = this; objBancoDAO = new BancoDAO(); objComboBanco = new CuentaBanco(); objBancoDatos = new CuentaBanco(); objMonedaDao = new MonedaDAO(); objAbonoBancoDet = new AbonoBancoDet(); objAbonoBancoCab = new AbonoBancoCab(); objFacturaAbono = new FacturaAbono(); objAsientoDAO = new AsientoDAO(); objAsiento = new Asiento(); objAsientoDetalle = new AsientoDetalle(); cargarCmbBanco(); cmb_Banco.SelectedIndexChanged += Cmb_Banco_SelectedIndexChanged; txt_Fecha.Text = DateTime.Now.ToString("dd/MM/yyyy"); objComboBanco = (CuentaBanco)cmb_Banco.SelectedItem; objBancoDatos = objBancoDAO.listarBancoDatos(Ventas.UNIDADNEGOCIO, objComboBanco.Codigo, objComboBanco.Descripcion); txt_Cuenta.Text = objBancoDatos.Cuenta; txt_Moneda.Text = objBancoDatos.Moneda; txt_Tcambio.Text = objMonedaDao.getTipoCambioVenta(DateTime.Now.ToShortDateString()).ToString().PadRight(5, '0');; txt_MonedaCod.Text = objBancoDatos.MonedaCod; //gridParams(); grd_Detalle.CellClick += Grd_Detalle_CellClick; }
private void Grd_Facturas_CellClick(object sender, DataGridViewCellEventArgs e) { index = grd_Facturas.SelectedCells[0].RowIndex; objAsientoDetalle = new AsientoDetalle(); objAsientoDetalle = objListaAsientoDetalle[index]; txt_Cuenta.Text = objAsientoDetalle.Cuenta; txt_Documento.Text = objAsientoDetalle.Documento; txt_Importe.Text = objAsientoDetalle.Importe.ToString(); cmb_Cuenta.SelectedValue = objAsientoDetalle.TipoImporte; cmb_Documento.SelectedValue = objAsientoDetalle.TipDocCodigo; }
void generarDetalle() { objAsientoDetalle = new AsientoDetalle(); objAsientoDetalle.Correlativo = txt_Correlativo.Text; objAsientoDetalle.Cuenta = ""; objAsientoDetalle.Documento = ""; objAsientoDetalle.Fecha = ""; objAsientoDetalle.FechaDoc = txt_Fecha.Text; objAsientoDetalle.FechaVcto = ""; objAsientoDetalle.Importe = RegistrarAsientoGeneral.totalComprobante; }
public bool insertarAsientoDet(AsientoDetalle obj) { Database db = DatabaseFactory.CreateDatabase("Conta"); DbCommand dbCommand = db.GetStoredProcCommand("sp_InsertAsientoDet", new object[] { obj.TipoAsiento, obj.Correlativo, obj.Fecha, obj.Cuenta, obj.TipoImporte, obj.Importe, obj.TipDocCodigo, obj.Documento, obj.FechaDoc, obj.FechaVcto }); try { db.ExecuteScalar(dbCommand); return(true); } catch (Exception ex) { return(false); } }
private void Grd_Facturas_CellClick(object sender, DataGridViewCellEventArgs e) { index = grd_Facturas.SelectedCells[0].RowIndex; objAsientoDetalle = new AsientoDetalle(); objAsientoDetalle = objListaAsientoDetalle[index]; txt_Cuenta.Text = objAsientoDetalle.Cuenta; txt_Documento.Text = objAsientoDetalle.Documento; txt_Importe.Text = objAsientoDetalle.Importe.ToString(); txt_TipoDoc.Text = objAsientoDetalle.TipoDoc; txt_desccuenta.Text = objAsientoDetalle.CuentaDescripcion.ToString(); if (objAsientoDetalle.TipoImporte == "D") { txt_Tipo.Text = "Debe"; } else { txt_Tipo.Text = "Haber"; } }
public List <AsientoDetalle> getGenerarDetalleValidar(String serie, String numero) { List <AsientoDetalle> objList = new List <AsientoDetalle>(); AsientoDetalle obj; Database db = DatabaseFactory.CreateDatabase("Contabilidad"); /*procedimiento almacenado*/ DbCommand dbCommand = db.GetStoredProcCommand("sp_GenerarAsientoVentaValidar", new object[] { serie, numero }); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { obj = new AsientoDetalle(); obj.numeroot = Convert.ToInt32(dataReader["suma"].ToString()); obj.CodoOt = dataReader["codot"].ToString(); objList.Add(obj); } } return(objList); }
private void btn_SaveData_Click(object sender, EventArgs e) { String msg = ""; if (objListaAbonoBancoDet.Count == 0) { msg = "Seleccione alguna factura"; MessageBox.Show(msg); return; } bool insert; int identity; objAbonoBancoCab = new AbonoBancoCab(); objAbonoBancoCab.CodEnt = Ventas.UNIDADNEGOCIO; objAbonoBancoCab.BancoCod = objBancoDatos.Codigo; objAbonoBancoCab.Fecha = txt_Fecha.Text; objAbonoBancoCab.MonedaCod = txt_MonedaCod.Text; objAbonoBancoCab.Observacion = txt_Observacion.Text; objAbonoBancoCab.CuentaContable = objBancoDatos.CuentaContable; objAbonoBancoCab.ClienteCod = txt_ClienteCod.Text; identity = objBancoDAO.insertAbonoCab(objAbonoBancoCab); for (int i = 0; i < objListaAbonoBancoDet.Count; i++) { msg = objBancoDAO.insertAbonoDet(objListaAbonoBancoDet[i], identity); if (msg != "true") { MessageBox.Show("Error: " + msg); return; } } String asientoCorrelativo; for (int i = 0; i < objListaAbonoBancoDet.Count; i++) { asientoCorrelativo = objAsientoDAO.getCorrelativoAsientoVenta(txt_Fecha.Text, "21"); objAsiento = new Asiento(); objAsiento.Correlativo = asientoCorrelativo; objAsiento.MonedaCod = txt_MonedaCod.Text; objAsiento.Fecha = txt_Fecha.Text; if (objListaFacturaAbono[i].MonedaCod == txt_MonedaCod.Text) { objAsiento.Haber = objListaFacturaAbono[i].Total; } else { if (objListaFacturaAbono[i].MonedaCod == "USD" && txt_MonedaCod.Text == "PEN") { objAsiento.Haber = Math.Round(objListaFacturaAbono[i].Total * objBancoDAO.convertToDouble(txt_Tcambio.Text), 2); } else if (objListaFacturaAbono[i].MonedaCod == "PEN" && txt_MonedaCod.Text == "USD") { objAsiento.Haber = Math.Round(objListaFacturaAbono[i].Total / objBancoDAO.convertToDouble(txt_Tcambio.Text), 2); } } objAsiento.TipoAsiento = "21"; objAsientoDetalle = new AsientoDetalle(); objAsientoDetalle.Correlativo = asientoCorrelativo; objAsientoDetalle.Fecha = txt_Fecha.Text; objAsientoDetalle.TipDocCodigo = "01"; objAsientoDetalle.TipoAsiento = "21"; objAsientoDetalle.Documento = objListaAbonoBancoDet[i].Serie + "-" + objListaAbonoBancoDet[i].Numero; objAsientoDetalle.Cuenta = objAbonoBancoCab.CuentaContable; objAsientoDetalle.TipoImporte = "D"; if (txt_MonedaCod.Text == "USD") { objAsientoDetalle.Importe = objListaFacturaAbono[i].ImporteDolares; } else { objAsientoDetalle.Importe = objListaFacturaAbono[i].ImporteSoles; } objAsiento.Debe = objAsientoDetalle.Importe; objAsientoDAO.insertarAsientoCab(objAsiento); objAsientoDAO.insertarAsientoDet(objAsientoDetalle); objAsientoDetalle = new AsientoDetalle(); objAsientoDetalle.Correlativo = asientoCorrelativo; objAsientoDetalle.Fecha = txt_Fecha.Text; objAsientoDetalle.TipDocCodigo = "01"; objAsientoDetalle.TipoAsiento = "21"; objAsientoDetalle.Documento = objListaAbonoBancoDet[i].Serie + "-" + objListaAbonoBancoDet[i].Numero; objAsientoDetalle.Cuenta = objListaFacturaAbono[i].CuentaContable; objAsientoDetalle.TipoAsiento = "H"; objAsientoDetalle.Importe = objListaFacturaAbono[i].Total; objAsientoDAO.insertarAsientoDet(objAsientoDetalle); } MessageBox.Show("Abono Guardado Correctamente"); limpiaCampos(); habilitarCampos(false, true); objListaAbonoBancoDet = null; objListaAbonoBancoDet = new List <AbonoBancoDet>(); grd_Detalle.DataSource = null; grd_Detalle.Refresh(); cmb_Banco.Enabled = true; txt_Observacion.Text = ""; }