Exemple #1
0
        private void dtgComprobantes_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            int ID;

            if (this.dtgComprobantes.DataKeys[(int)e.Item.ItemIndex] == System.DBNull.Value)
            {
                ID = -1;
            }
            else
            {
                ID = Convert.ToInt32(dtgComprobantes.DataKeys[(int)e.Item.ItemIndex]);
            }

            if (ID != -1)
            {
                IGuiaComprobanteWAN guiaComp = GuiaComprobanteWANFactory.GetGuiaComprobanteWAN();
                guiaComp.GuiaComprobanteID = ID;
                guiaComp.Consultar();
                this.txtGuiaComprobanteID.Text        = guiaComp.GuiaComprobanteID.ToString();
                this.txtNroComprobante.Text           = guiaComp.NroComprobante;
                this.txtImporte.Text                  = guiaComp.Importe == 0.0 ? "" : Utiles.Formatos.Importe(guiaComp.Importe);
                this.ddlTipoComprobante.SelectedValue = guiaComp.TipoComprobanteID.ToString();
                this.txtObservaciones.Text            = guiaComp.Observaciones;
            }
        }
Exemple #2
0
        private void dtgComprobantes_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            IGuiaComprobanteWAN guiaComp = GuiaComprobanteWANFactory.GetGuiaComprobanteWAN();

            guiaComp.GuiaComprobanteID = Convert.ToInt32(this.dtgComprobantes.DataKeys[e.Item.ItemIndex]);

            try
            {
                guiaComp.Eliminar();
                //this.dtgCotizacionesClientes.EditItemIndex = -1;
                this.BindGrillaComprobantes();
            }
            catch (Exception ex)
            {
                ((ErrorWeb)this.phErrores.Controls[0]).setMensaje(ex.Message);
            }
        }
Exemple #3
0
        private void BindGrillaComprobantes()
        {
            SisPackController.AdministrarGrillas.Configurar(this.dtgComprobantes, "GuiaComprobanteID", this.CantidadOpciones);
            IGuiaComprobanteWAN guiaComp = GuiaComprobanteWANFactory.GetGuiaComprobanteWAN();

            if (!this.txtFacturaID.Text.Equals(""))
            {
                guiaComp.FacturaID = Convert.ToInt32(this.txtFacturaID.Text);
                this.dtgComprobantes.DataSource = guiaComp.GetGuiaComprobantesByFacturaID();
            }
            else
            {
                guiaComp.GuiaID = this.txtGuiaID.Text.Equals("")?0: Convert.ToInt32(this.txtGuiaID.Text);
                this.dtgComprobantes.DataSource = guiaComp.GetGuiaComprobantesDataSet();
            }

            this.dtgComprobantes.DataBind();
        }
Exemple #4
0
        private void butConfirmar_Click(object sender, System.EventArgs e)
        {
            BaseValidator bv;

            bv         = (BaseValidator)this.phValidTipoComprobante.FindControl("validTipoComprobante");
            bv.Enabled = true;
            bv.Validate();
            if (!bv.IsValid || this.ddlTipoComprobante.SelectedIndex == 0)
            {
                bv.IsValid = false;
                return;
            }

            bv         = (BaseValidator)this.phValidNroComprobante.FindControl("validNroComprobante");
            bv.Enabled = true;
            bv.Validate();
            if (!bv.IsValid)
            {
                return;
            }


            bv         = (BaseValidator)this.phValidImporte.FindControl("validImporte");
            bv.Enabled = true;
            bv.Validate();
            if (!bv.IsValid)
            {
                return;
            }

            bv         = (BaseValidator)this.phValidImporte.FindControl("validImporteDec");
            bv.Enabled = true;
            bv.Validate();
            if (!bv.IsValid)
            {
                return;
            }

            IGuiaComprobanteWAN guiaComp = GuiaComprobanteWANFactory.GetGuiaComprobanteWAN();

            guiaComp.GuiaComprobanteID = this.txtGuiaComprobanteID.Text == ""? 0 :Convert.ToInt32(this.txtGuiaComprobanteID.Text);
            guiaComp.GuiaID            = this.txtFacturaID.Text.Equals("")?Convert.ToInt32(this.txtGuiaID.Text):0;
            guiaComp.FacturaID         = this.txtFacturaID.Text.Equals("")?0:Convert.ToInt32(this.txtFacturaID.Text);
            guiaComp.NroComprobante    = this.txtNroComprobante.Text;
            guiaComp.Importe           = this.txtImporte.Text == "" ? 0 : Utiles.Validaciones.obtieneDouble(this.txtImporte.Text);
            guiaComp.TipoComprobanteID = Convert.ToInt32(this.ddlTipoComprobante.SelectedValue);
            guiaComp.Observaciones     = this.txtObservaciones.Text;

            try
            {
                if (guiaComp.Guardar())
                {
                    this.txtImporte.Text                  = "";
                    this.txtNroComprobante.Text           = "";
                    this.txtObservaciones.Text            = "";
                    this.ddlTipoComprobante.SelectedValue = "0";
                    this.txtGuiaComprobanteID.Text        = "";
                    this.BindGrillaComprobantes();
                    //this.butAsignarGastos.Enabled = true;
                    string mensaje = "Los datos se guardaron correctamente. ";

                    string script = "<script language='javascript'>\n";
                    script += "alert('" + mensaje + "');";
                    //script += "window.location.href = 'GuiaComisiones.aspx';\n";
                    script += "</script>";

                    Page.RegisterStartupScript("scriptOk", script);
                }
                else
                {
                    string script = "<script language='javascript'>\n";
                    script += "alert('Los datos no se guardaron debido a errores.');\n";
                    script += "</script>";

                    Page.RegisterStartupScript("scriptError", script);
                }
            }
            catch (Exception ex)
            {
                ((ErrorWeb)this.phErrores.Controls[0]).setMensaje(ex.Message);
            }
        }