コード例 #1
0
        protected void btnAceptarNuevoDoc_Click(object sender, EventArgs e)
        {
            try
            {
                clsDocumenOperacion colDocumenOpe = new clsDocumenOperacion();

                if (colDocumenOpe.ValidarDocumento(txtNroSerie.Text, txtNroDocu.Text))
                {
                    MessageBox("Este Nro de Documento Ya se Registro");
                    ModalPopupNuevoDocumento.Show();
                    return;
                }

                if (txtNroDocu.Text != "")
                {
                    lblTipoDoc.Value = ddlTipoDocu.SelectedValue;

                    //GUARDA EL TIPO DE DOC EN VARIABLE SESSION
                    this.AgregarVariableSession("lblTipoDoc", lblTipoDoc.Value );

                    lblDescriDocumento.Text = ddlTipoDocu.SelectedItem.Text;
                    lblNroDocumento.Text = txtNroSerie.Text + " - " + txtNroDocu.Text;

                    if (lblProceso.Value == "NEW")
                    {
                        HabilitarCampos(true);
                        g_dtDetOperacion.Rows.Clear();
                        RellenarGrilla(ref dgvDetalleVenta, g_dtDetOperacion, this.nNroDetPed);
                        CargarCombos();
                        CargarClientes();

                        txtDireccion.Enabled = false;
                        txtDocCli.Enabled = false;
                        txtTelefono.Enabled = false;

                        txtSubTotal.Text = "0.00";
                        txtDescuento.Text = "0.00";
                        txtFlete.Text = "0.00";
                        txtIgv.Text = "0.00";
                        txtTotal.Text = "0.00";
                        bDetallesChanged = 0;
                        txtFecha.Text = DateTime.Today.ToString("yyyy-MM-dd");
                        SetBotones(lblProceso.Value);
                        ConfigurarDocumento();

                    }
                    else if (lblProceso.Value == "NEWDOC")
                    {
                        long ndopCod = 0;
                        int OpeCod = int.Parse(lblNroPedido.Text);

                        colDocumenOpe.Guardar(this, ref ndopCod);
                        lbldopCod.Value = ndopCod.ToString();

                        SetPanelDocumento(OpeCod);
                        lblProceso.Value = "EDIT";
                        dgvDocumentos_SelectedIndexChanged(sender, e);
                    }

                }
                else
                {
                    MessageBox("Debe poner un Numero de Documento");
                }
            }
            catch (Exception ex)
            {
                MessageBox("Error Interno: " + ex.Message);
            }
        }