Ejemplo n.º 1
0
        private void LetraDeCambioToolStripMenuItem_Click(object sender, EventArgs e)
        {
            letraDeCambioToolStripMenuItem.Enabled = false;
            ListaLetraCambio Check = new ListaLetraCambio();

            Check.Show();
        }
Ejemplo n.º 2
0
        private void btn_Regresar_Click(object sender, EventArgs e)
        {
            this.Hide();
            ListaLetraCambio.operacionLetra = "Q";
            ListaLetraCambio Check = new ListaLetraCambio();

            Check.Show();
        }
Ejemplo n.º 3
0
        private void btn_SaveData_Click(object sender, EventArgs e)
        {
            btn_SaveData.Enabled = false;
            bool binsertar, bdetalle = true;

            objDocumentoCab = new DocumentoCab();
            objDocumentoCab.DocumentoCabSerie      = txt_Serie.Text;
            objDocumentoCab.DocumentoCabNro        = txt_Numero.Text;
            objDocumentoCab.DocumentoCabClienteCod = txt_codcliente.Text;
            objDocumentoCab.DocumentoCabFecha      = dpick_Fecha.Value;

            objDocumentoCab.DocumentoCabClienteCodAval = txt_AvalCod.Text;
            objDocumentoCab.DocumentoCabUsuAdd         = Ventas.UsuarioSession;
            objDocumentoCab.DocumentoCabTotal          = convertToDouble(txt_Total.Text);
            objDocumentoCab.DocumentoCabTipoDoc        = "LT";
            objDocumentoCab.DocumentoCabTipoPago       = Convert.ToInt32(cmb_Pago.SelectedValue);
            try
            {
                objDocumentoCab.DocumentoCabDividir = Convert.ToInt32(txt_Dividir.Text);
            }
            catch
            {
                objDocumentoCab.DocumentoCabDividir = 0;
            }

            objDocumentoCab.DocumentoCabFecha     = dpick_Fecha.Value;
            objDocumentoCab.DocumentoCabFechaVcto = dpck_Fechavcto.Value;

            objDocumentoCab.DocumentoCabDetraccion           = convertToDouble(txt_TotalDetraccion.Text);
            objDocumentoCab.DocumentoCabDetraccionPorcentaje = convertToDouble(txt_Porcentaje.Text);
            objDocumentoCab.DocumentoCabAbono      = convertToDouble(txt_TotalCanjeado.Text);
            objDocumentoCab.DocumentoCabSaldo      = objDocumentoCab.DocumentoCabTotal - (objDocumentoCab.DocumentoCabAbono + objDocumentoCab.DocumentoCabDetraccion);
            objDocumentoCab.DocumentoCabTipoMoneda = txt_CodMoneda.Text;
            objDocumentoCab.DocumentoCabSerieRef   = txt_SerieDcto.Text;
            objDocumentoCab.DocumentoCabNroRef     = txt_NumeroDcto.Text;

            if (Modificar == "M")
            {
                binsertar = objDocumentoDao.updateLetraCab(objDocumentoCab, Ventas.UNIDADNEGOCIO, Ventas.UsuarioSession);

                string msg = "";
                if (binsertar)
                {
                }
                else
                {
                    msg = "Hubo un problema al guardar";
                    MessageBox.Show(msg);
                    btn_SaveData.Enabled = true;

                    return;
                }
                objDocumentoDao.deleteLetraDet(objDocumentoCab.DocumentoCabSerie, objDocumentoCab.DocumentoCabNro);
                for (int i = 0; i < objListaLetraDet.Count; i++)
                {
                    bdetalle = objDocumentoDao.insertLetraDet(objListaLetraDet[i]);
                    if (bdetalle == false)
                    {
                        MessageBox.Show("Error al guardar");
                        btn_SaveData.Enabled = true;
                        break;
                    }
                }
                if (bdetalle)
                {
                    MessageBox.Show("Letra Guardada exitosamente");
                    nuevoRegistro();
                    btn_SaveData.Enabled = true;
                }
            }
            else
            {
                binsertar = objDocumentoDao.insertarLetraCab(objDocumentoCab, Ventas.UNIDADNEGOCIO);

                string msg = "";
                if (binsertar)
                {
                }
                else
                {
                    msg = "Hubo un problema al guardar";
                    MessageBox.Show(msg);
                    btn_SaveData.Enabled = true;

                    return;
                }
                for (int i = 0; i < objListaLetraDet.Count; i++)
                {
                    bdetalle = objDocumentoDao.insertLetraDet(objListaLetraDet[i]);
                    if (bdetalle == false)
                    {
                        MessageBox.Show("Error al guardar");
                        btn_SaveData.Enabled = true;
                        break;
                    }
                }
                if (bdetalle)
                {
                    MessageBox.Show("Letra Guardada exitosamente");
                    nuevoRegistro();
                    btn_SaveData.Enabled = true;
                }
            }

            this.Hide();
            objListaLetraDet = null;
            ListaLetraCambio.operacionLetra = "Q";
            ListaLetraCambio Check = new ListaLetraCambio();

            Check.Show();
        }