Exemplo n.º 1
0
        private void btn_ver_Click(object sender, EventArgs e)
        {
            index = grd_letra.SelectedCells[0].RowIndex;
            DataGridViewRow dtg = grd_letra.Rows[index];

            objVoucher = new LetraCab();

            if (dtg.Cells[11].Value.ToString() == "ANULADO")
            {
                operacionLetra = "A";
                index          = grd_letra.SelectedCells[0].RowIndex;
                objVoucher     = objListLetra[index];
                CanjeLetraNuevo check = new CanjeLetraNuevo();
                this.Hide();
                check.Show();
            }
            else
            {
                operacionLetra = "V";
                index          = grd_letra.SelectedCells[0].RowIndex;
                objVoucher     = objListLetra[index];
                CanjeLetraNuevo check = new CanjeLetraNuevo();
                this.Hide();
                check.Show();
            }
        }
Exemplo n.º 2
0
        private void btn_Anular_Click(object sender, EventArgs e)
        {
            objVoucher      = new LetraCab();
            objLetraDetalle = new LetraDetalle();
            bool anular = objVoucherDao.anularLetraFC(txt_nroregletra.Text, Ventas.UNIDADNEGOCIO);

            if (!anular)
            {
                MessageBox.Show("Hubo un error al anular la Letra");
                return;
            }
            else
            {
                for (int i = 0; i < objListaLetraDet.Count; i++)
                {
                    index           = grd_facturas.SelectedCells[0].RowIndex;
                    objLetraDetalle = objListaLetraDet[index];
                    bool anulardet = objVoucherDao.anularLetraDetalleFC(objLetraDetalle.NroRegistro, Ventas.UNIDADNEGOCIO, txt_nroregletra.Text.Trim());
                }
                MessageBox.Show("Letra ha sido anulada");
            }
            btn_Anular.Enabled    = false;
            btn_Modificar.Enabled = false;
            btn_SaveData.Enabled  = false;
            btn_Add.Enabled       = false;
            btn_Rest.Enabled      = false;
            objLetra = CanjeLetra.objVoucher;
            llenarCabecera(objLetra);
            objListaLetraDet = objVoucherDao.listarLetraDet(objLetra.NroRegistro, Ventas.UNIDADNEGOCIO);
            llenarDetalle(objListaLetraDet);
            sumatoria();
        }
Exemplo n.º 3
0
 private void btn_Limpiar_Click(object sender, EventArgs e)
 {
     objListaLetraDet = null;
     objListaLetraDet = new List <LetraDetalle>();
     objLetra         = null;
     objLetra         = new LetraCab();
     habilitarBotones(true, false);
 }
Exemplo n.º 4
0
 public CanjeLetraNuevo()
 {
     InitializeComponent();
     this.ControlBox  = false;
     txt_tipodoc.Text = "LT";
     objLetra         = new LetraCab();
     objMonedaDao     = new MonedaDAO();
     objVoucherDao    = new VoucherDAO();
     objDocumentoDAO  = new DocumentoDAO();
     objMonedaDao.tipoCambio();
     comboMoneda();
     this.StartPosition = FormStartPosition.Manual;
     this.Location      = new Point(50, 20);
     canjeletranuevo    = this;
     txt_Tcambio.Text   = objMonedaDao.getTipoCambioVenta(dpick_Fecha.Value.ToString("dd/MM/yyyy")).ToString().PadRight(5, '0');
     if (CanjeLetra.operacionLetra == "V")
     {
         objLetra = CanjeLetra.objVoucher;
         llenarCabecera(objLetra);
         objListaLetraDet = objVoucherDao.listarLetraDet(objLetra.NroRegistro, Ventas.UNIDADNEGOCIO);
         llenarDetalle(objListaLetraDet);
         sumatoria();
         btn_SaveData.Enabled  = false;
         btn_Modificar.Visible = true;
     }
     else if (CanjeLetra.operacionLetra == "A")
     {
         objLetra = CanjeLetra.objVoucher;
         llenarCabecera(objLetra);
         objListaLetraDet = objVoucherDao.listarLetraDet(objLetra.NroRegistro, Ventas.UNIDADNEGOCIO);
         llenarDetalle(objListaLetraDet);
         sumatoria();
         btn_Add.Enabled        = false;
         btn_Anular.Enabled     = false;
         btn_Buscar.Enabled     = false;
         btn_Modificar.Enabled  = false;
         btn_SaveData.Enabled   = false;
         grd_facturas.Enabled   = false;
         dpck_Fechavcto.Enabled = false;
         dpick_Fecha.Enabled    = false;
         dtp_compromiso.Enabled = false;
         cmb_Moneda.Enabled     = false;
         btn_Modificar.Visible  = false;
     }
     else if (CanjeLetra.operacionLetra == "N")
     {
         Modificar = "N";
         if (Ventas.UNIDADNEGOCIO == "01")
         {
             txt_SerieDcto.Text = "0001";
         }
         else
         {
             txt_SerieDcto.Text = "0001";
         }
         habilitarBotones(true, false);
     }
 }
Exemplo n.º 5
0
        private void grd_letra_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            objVoucher     = new LetraCab();
            operacionLetra = "V";
            index          = grd_letra.SelectedCells[0].RowIndex;
            objVoucher     = objListLetra[index];

            index = grd_letra.SelectedCells[0].RowIndex;
            DataGridViewRow dtg = grd_letra.Rows[index];
        }
Exemplo n.º 6
0
 void llenarCabecera(LetraCab objV)
 {
     txt_Cliente.Text         = objV.NomProv;
     txt_Direccion.Text       = objV.direccion;
     txt_Ruc.Text             = objV.Ruc;
     cmb_Moneda.SelectedValue = objV.Moneda;
     txt_SerieDcto.Text       = objV.SerieDoc;
     txt_NumeroDcto.Text      = objV.NroDoc;
     dpick_Fecha.Value        = objV.FecRep;
     txt_NumeroDcto.Enabled   = false;
     txt_nroregletra.Text     = objV.NroRegistro.Trim();
 }
Exemplo n.º 7
0
        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();
        }