private void btn_Regresar_Click(object sender, EventArgs e) { this.Hide(); CanjeLetra.operacionLetra = "Q"; CanjeLetra Check = new CanjeLetra(); Check.Show(); }
private void btn_SaveData_Click(object sender, EventArgs e) { string msg = " "; btn_SaveData.Enabled = false; objLetra = new LetraCab(); objLetra.TipoDoc = txt_tipodoc.Text; objLetra.SerieDoc = txt_SerieDcto.Text; objLetra.NroDoc = txt_NumeroDcto.Text; objLetra.FecRep = dpick_Fecha.Value; objLetra.Ruc = txt_Ruc.Text; objLetra.CodEnt = Ventas.UNIDADNEGOCIO; objLetra.Usuario = Ventas.UsuarioSession; objLetra.EstRep = "P"; objLetra.TipoCambio = objVoucherDao.convertToDouble(txt_Tcambio.Text); objLetra.Fec_Reg = dpick_Fecha.Value; objLetra.ImporteTotal = objVoucherDao.convertToDouble(txt_Total.Text); objLetra.Monto = objVoucherDao.convertToDouble(txt_Abono.Text); objLetra.Saldo = objVoucherDao.convertToDouble(txt_Abono.Text); objLetra.Fec_Ven = dpck_Fechavcto.Value; objLetra.Moneda = cmb_Moneda.SelectedValue.ToString(); objLetra.Fec_Compromiso = dtp_compromiso.Value; objLetra.RazonSocial = txt_Cliente.Text; objLetra.Estado_Doc = "."; objLetra.NroRegistro = ""; bool insert; if (OperacionGuardar == "M") { objLetra.NroRegistro = txt_nroregletra.Text; insert = objVoucherDao.updateLetrarCab(objLetra, Ventas.UsuarioSession); if (insert) { } else { msg = "Hubo un problema al modificar"; MessageBox.Show(msg); btn_SaveData.Enabled = true; return; } objLetra.NroRegistro = txt_nroregletra.Text; objVoucherDao.deleteLetraDet(objLetra.NroRegistro, Ventas.UNIDADNEGOCIO); for (int i = 0; i < objListaLetraDet.Count; i++) { objListaLetraDet[i].NroDoc = txt_NumeroDcto.Text; objListaLetraDet[i].NroRegistroLetra = txt_nroregletra.Text; insert = objVoucherDao.insertarLetraRCDet(objListaLetraDet[i]); if (insert == false) { MessageBox.Show("Error al guardar"); btn_SaveData.Enabled = true; break; } else { Double abonoletra = 0; abonoletra = objListaLetraDet[i].Monto - objListaLetraDet[i].Abono; if (objListaLetraDet[i].AbonoLetra == 0) { if (objListaLetraDet[i].Monto == objListaLetraDet[i].Abono) { objVoucherDao.ActualizarLetraRCDet(objListaLetraDet[i].NroRegistro, objListaLetraDet[i].CodEnt, abonoletra); } else { objVoucherDao.ActualizarAbonoLetraRCDet(objListaLetraDet[i].NroRegistro, objListaLetraDet[i].CodEnt, abonoletra); } } else if (objListaLetraDet[i].AbonoLetra == objListaLetraDet[i].Abono) { objVoucherDao.ActualizarLetraRCDet(objListaLetraDet[i].NroRegistro, objListaLetraDet[i].CodEnt, abonoletra); } } } } else { objLetra.NroRegistro = txt_nroregletra.Text; insert = objVoucherDao.insertarLetraCab(objLetra, Ventas.UsuarioSession); if (insert) { } else { msg = "Hubo un problema al guardar"; MessageBox.Show(msg); btn_SaveData.Enabled = true; return; } for (int i = 0; i < objListaLetraDet.Count; i++) { objListaLetraDet[i].NroDoc = txt_NumeroDcto.Text; objListaLetraDet[i].NroRegistroLetra = objVoucherDao.getCanjeLetra(Ventas.UNIDADNEGOCIO); insert = objVoucherDao.insertarLetraRCDet(objListaLetraDet[i]); if (insert == false) { MessageBox.Show("Error al guardar"); btn_SaveData.Enabled = true; break; } else { Double abonoletra = 0; abonoletra = objListaLetraDet[i].Monto - objListaLetraDet[i].Abono; if (objListaLetraDet[i].AbonoLetra == 0) { if (objListaLetraDet[i].Monto == objListaLetraDet[i].Abono) { objVoucherDao.ActualizarLetraRCDet(objListaLetraDet[i].NroRegistro, objListaLetraDet[i].CodEnt, abonoletra); } else { objVoucherDao.ActualizarAbonoLetraRCDet(objListaLetraDet[i].NroRegistro, objListaLetraDet[i].CodEnt, abonoletra); } } else if (objListaLetraDet[i].AbonoLetra == objListaLetraDet[i].Abono) { objVoucherDao.ActualizarLetraRCDet(objListaLetraDet[i].NroRegistro, objListaLetraDet[i].CodEnt, abonoletra); } } } if (insert) { MessageBox.Show("Letra se Guardado exitosamente"); btn_SaveData.Enabled = true; } } this.Close(); CanjeLetra check = new CanjeLetra(); check.Show(); }
private void CanjearLetrasToolStripMenuItem_Click(object sender, EventArgs e) { canjearLetrasToolStripMenuItem.Enabled = false; Facturacion.CanjeLetra Check = new Facturacion.CanjeLetra(); Check.Show(); }