Exemplo n.º 1
0
        private void _Mtd_ImprimirComprobante(string _P_Str_Comprobante)
        {
            try
            {
                PrintDialog _Print = new PrintDialog();
_PrintComprob:
                if (_Print.ShowDialog() == DialogResult.OK)
                {
                    Cursor = Cursors.WaitCursor;
                    REPORTESS _Frm = new REPORTESS(new string[] { "vst_reportecomprobante" }, "", "T3.Report.rcomprobante", "Section1", "cabecera", "rif", "nit", "ccompany='" + Frm_Padre._Str_Comp + "' and cidcomprob='" + _P_Str_Comprobante + "'", _Print, true);
                    Cursor = Cursors.Default;
                    if (MessageBox.Show("¿El comprobante se imprimió correctamente?", "Requerimiento", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        _Frm.Close();
                        _Frm.Dispose();
                        string _Str_Cadena = "UPDATE TCOMPROBANC SET cstatus='1',clvalidado='1',cvalidate='" + _Cls_Formato._Mtd_fecha(CLASES._Cls_Varios_Metodos._Mtd_SQLGetDate()) + "',cdateupd='" + _Cls_Formato._Mtd_fecha(CLASES._Cls_Varios_Metodos._Mtd_SQLGetDateServ()) + "',cuserupd='" + Frm_Padre._Str_Use + "' WHERE ccompany='" + Frm_Padre._Str_Comp + "' AND cidcomprob='" + _P_Str_Comprobante + "'";
                        Program._MyClsCnn._mtd_conexion._Mtd_EjecutarSentencia(_Str_Cadena);
                        MessageBox.Show("El comprobante ha sido actualizado.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        _Frm.Close();
                        _Frm.Dispose();
                        goto _PrintComprob;
                    }
                }
                else
                {
                    MessageBox.Show("Debe actualizar el comprobante desde el notificador 'COMPROBANTES DE ANTICIPO POR IMPRIMIR'", "Requerimiento", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch { Cursor = Cursors.Default; MessageBox.Show("Error al intentar imprimir.\nDebe actualizar el comprobante desde el notificador 'COMPROBANTES DE ANTICIPO POR IMPRIMIR'.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
        }
Exemplo n.º 2
0
        private bool _Mtd_PrintComprob(string _Pr_Str_Comprob)
        {
            bool _Bol_R = false;

A:
            PrintDialog _Print = new PrintDialog();

            if (_Print.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    //IMPRIMO COMPROB CONTABLE
                    REPORTESS _Frm_A = new REPORTESS(new string[] { "vst_reportecomprobante" }, "", "T3.Report.rcomprobante", "Section1", "cabecera", "rif", "nit", "ccompany='" + Frm_Padre._Str_Comp + "' and cidcomprob='" + _Pr_Str_Comprob + "'", _Print, true);
                    //_Frm_A.MdiParent = this.MdiParent;
                    //_Frm_A.Show();
                    this.Cursor = Cursors.Default;
                    if (MessageBox.Show("Se imprimió correctamente el comprobante", "Importante", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        _Bol_R = true;
                        Program._MyClsCnn._mtd_conexion._Mtd_modificar("TCOMPROBANC", "clvalidado='1',cvalidate='" + _My_Formato._Mtd_fecha(CLASES._Cls_Varios_Metodos._Mtd_SQLGetDate()) + "'", "ccompany='" + Frm_Padre._Str_Comp + "' and cidcomprob='" + _Pr_Str_Comprob + "'");
                    }
                    else
                    {
                        _Bol_R = false;
                        //_Frm_A.Close();
                        _Frm_A.Dispose();
                        goto A;
                    }
                }
                catch
                {
                    _Bol_R = false;
                    MessageBox.Show("Problemas al contactar la impresora.", "Validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            return(_Bol_R);
        }
Exemplo n.º 3
0
        private void _Mtd_ImprimirNDyComprobante(string _P_Str_ND, string _P_Str_Comprobante)
        {
            try
            {
                int         _Int_Sw = 0;
                REPORTESS   _Frm;
                PrintDialog _Print = new PrintDialog();
_PrintComprob:
                if (_Print.ShowDialog() == DialogResult.OK)
                {
                    if (_Int_Sw == 0 | _Int_Sw == 1)
                    {
                        Cursor = Cursors.WaitCursor;
                        _Frm   = new REPORTESS(new string[] { "VST_NOTADEBITO_SINDET" }, "", "T3.Report.rNotaDebitoSDet", "Section1", "cabecera", "rif", "nit", "ccompany='" + Frm_Padre._Str_Comp + "' and cgroupcomp='" + Frm_Padre._Str_GroupComp + "' and cidnotadebitocxp='" + _P_Str_ND + "'", _Print, true);
                        Cursor = Cursors.Default;
                        //_Frm.ShowDialog();
                        if (MessageBox.Show("¿La ND se imprimió correctamente?", "Requerimiento", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                        {
                            _Frm.Close();
                            _Frm.Dispose();
                            _Int_Sw = 1;
                            goto _PrintComprob;
                        }
                        else
                        {
A:
                            string _Str_Numero = InputBox.Show("Introduzca el número de control").Text;
                            if (_Str_Numero.Trim().Length > 0)
                            {
                                string _Str_Cadena = "Select cnumcontrolnd from TNOTADEBITOCP where cgroupcomp='" + Frm_Padre._Str_GroupComp + "' and ccompany='" + Frm_Padre._Str_Comp + "' and cnumcontrolnd='" + _Str_Numero + "'";
                                if (Program._MyClsCnn._mtd_conexion._Mtd_RetornarDataset(_Str_Cadena).Tables[0].Rows.Count > 0)
                                {
                                    MessageBox.Show("El número de control del documento ya fue registrado. Debe intentarlo nuevamente.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Question);
                                    goto A;
                                }
                                else
                                {
                                    _Int_Sw = 0;
                                    Program._MyClsCnn._mtd_conexion._Mtd_modificar("TNOTADEBITOCP", "cnumcontrolnd='" + _Str_Numero + "',cestatusfirma='2',cimpresa='1',cactivo='1',cdateupd='" + _Cls_Formato._Mtd_fecha(CLASES._Cls_Varios_Metodos._Mtd_SQLGetDateServ()) + "',cuserupd='" + Frm_Padre._Str_Use + "'", "cgroupcomp='" + Frm_Padre._Str_GroupComp + "' and ccompany='" + Frm_Padre._Str_Comp + "' and cidnotadebitocxp='" + _P_Str_ND + "'");
                                }
                            }
                            else
                            {
                                MessageBox.Show("Debe ingresar el número de control", "Información", MessageBoxButtons.OK, MessageBoxIcon.Question);
                                goto A;
                            }
                        }
                    }
                    if (_Int_Sw == 0 | _Int_Sw == 2)
                    {
                        if (_Int_Sw == 0)
                        {
                            MessageBox.Show("Se va a proceder a imprimir el comprobante contable.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); _Int_Sw = 2; goto _PrintComprob;
                        }
                        Cursor = Cursors.WaitCursor;
                        _Frm   = new REPORTESS(new string[] { "vst_reportecomprobante" }, "", "T3.Report.rcomprobante", "Section1", "cabecera", "rif", "nit", "ccompany='" + Frm_Padre._Str_Comp + "' and cidcomprob='" + _P_Str_Comprobante + "'", _Print, true);
                        Cursor = Cursors.Default;
                        if (MessageBox.Show("¿El comprobante se imprimió correctamente?", "Requerimiento", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                        {
                            _Frm.Close();
                            _Frm.Dispose();
                            goto _PrintComprob;
                        }
                        else
                        {
                            _Frm.Close();
                            _Frm.Dispose();
                            string _Str_Cadena = "UPDATE TCOMPROBANC SET cstatus='1',clvalidado='1',cvalidate='" + _Cls_Formato._Mtd_fecha(CLASES._Cls_Varios_Metodos._Mtd_SQLGetDate()) + "',cdateupd='" + _Cls_Formato._Mtd_fecha(CLASES._Cls_Varios_Metodos._Mtd_SQLGetDateServ()) + "',cuserupd='" + Frm_Padre._Str_Use + "' WHERE ccompany='" + Frm_Padre._Str_Comp + "' AND cidcomprob='" + _P_Str_Comprobante + "'";
                            Program._MyClsCnn._mtd_conexion._Mtd_EjecutarSentencia(_Str_Cadena);
                            System.Threading.ThreadPool.QueueUserWorkItem(((Frm_Padre)Application.OpenForms["Frm_Padre"])._Frm_Contenedor._async_Default);
                            MessageBox.Show("El comprobante ha sido actualizado.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Debe imprimir la ND y actualizar el comprobante desde el notificador 'COMPROBANTES DE ANTICIPO POR IMPRIMIR'", "Requerimiento", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch { Cursor = Cursors.Default; MessageBox.Show("Error al intentar imprimir.\nDebe imprimir la ND y  actualizar el comprobante desde el notificador 'COMPROBANTES DE ANTICIPO POR IMPRIMIR'.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
        }
Exemplo n.º 4
0
        private void _Mtd_Generar(string _P_Str_cidnotrecepc, string _P_Str_cidrecepcion, string _P_Str_Proveedor, string _P_Str_Factuta)
        {
            string  _Str_Cadena = "SELECT ISNULL(cidcomprob,0) FROM TNOTARECEPC WHERE cgroupcomp='" + Frm_Padre._Str_GroupComp + "' AND ccompany='" + Frm_Padre._Str_Comp + "' AND cidnotrecepc='" + _P_Str_cidnotrecepc + "'";
            DataSet _Ds         = Program._MyClsCnn._mtd_conexion._Mtd_RetornarDataset(_Str_Cadena);

            if (_Ds.Tables[0].Rows.Count > 0)
            {
                int _Int_ID_Comprobante = new int();
                if (_Ds.Tables[0].Rows[0][0].ToString().Trim() == "0")
                {
                    double _Dbl_MontoInvend = 0;
                    if (_Txt_Invendible.Text.Trim().Length > 0)
                    {
                        _Dbl_MontoInvend = Convert.ToDouble(_Txt_Invendible.Text);
                    }
                    CLASES._Cls_Varios_Metodos _Cls_Procesos = new T3.CLASES._Cls_Varios_Metodos(true);
                    if (_Dbl_MontoInvend == 0)
                    {
                        _Int_ID_Comprobante = _Cls_Procesos._Mtd_Proceso_P_COMPRA(_Txt_NR.Text.Trim(), _P_Str_cidrecepcion, _P_Str_Proveedor, _P_Str_Factuta);
                    }
                    else
                    {
                        _Dbl_MontoInvend    = _Mtd_RetornarInvendible(_P_Str_cidrecepcion, _P_Str_Proveedor, _P_Str_Factuta);
                        _Int_ID_Comprobante = _Cls_Procesos._Mtd_Proceso_P_COMPRA_INVEND(_Txt_NR.Text.Trim(), _P_Str_cidrecepcion, _Dbl_MontoInvend, _P_Str_Proveedor, _P_Str_Factuta);
                    }
                    Program._MyClsCnn._mtd_conexion._Mtd_modificar("TNOTARECEPC", "cidcomprob='" + _Int_ID_Comprobante.ToString() + "',cdateupd='" + _Cls_Formato._Mtd_fecha(CLASES._Cls_Varios_Metodos._Mtd_SQLGetDateServ()) + "',cuserupd='" + Frm_Padre._Str_Use + "'", "cgroupcomp='" + Frm_Padre._Str_GroupComp + "' AND ccompany='" + Frm_Padre._Str_Comp + "' AND cidnotrecepc='" + _P_Str_cidnotrecepc + "'");
                }
                else
                {
                    _Int_ID_Comprobante = Convert.ToInt32(_Ds.Tables[0].Rows[0][0].ToString().Trim());
                }
                try
                {
                    Cursor = Cursors.WaitCursor;
                    PrintDialog _Print = new PrintDialog();
                    Cursor = Cursors.Default;
_PrintComprob:
                    if (_Print.ShowDialog() == DialogResult.OK)
                    {
                        Cursor = Cursors.WaitCursor;
                        REPORTESS _Frm = new REPORTESS(new string[] { "vst_reportecomprobante" }, "", "T3.Report.rcomprobante", "Section1", "cabecera", "rif", "nit", "ccompany='" + Frm_Padre._Str_Comp + "' and cidcomprob='" + _Int_ID_Comprobante + "'", _Print, true);
                        Cursor = Cursors.Default;
                        if (MessageBox.Show("¿El comprobante se imprimió correctamente?", "Requerimiento", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            _Frm.Close();
                            _Frm.Dispose();
                            double _Dbl_Reten    = _Mtd_PorcRetencion(_P_Str_Proveedor);
                            string _Str_Impuesto = _Txt_Impuesto.Text;
                            if (_Str_Impuesto.Trim().Length == 0)
                            {
                                _Str_Impuesto = "0";
                            }
                            bool _Bol_Verificar = true;
                            if (_Dbl_Reten > 1 & Convert.ToDouble(_Str_Impuesto) > 0 & _Cls_VariosMetodos._Mtd_CompaniaRetieneImp(Frm_Padre._Str_Comp))
                            {
                                Cursor = Cursors.WaitCursor;
                                if (CLASES._Cls_Varios_Metodos._Mtd_VerificarConexionExterna())
                                {
                                    if (!_Mtd_ExisteComprobanteRetencion(_Str_Proveedor, _Str_TpoDocGian, _P_Str_Factuta))
                                    {
                                        _Cls_VariosMetodos._Mtd_Proceso_GenerarComprobRetencion(_Str_Proveedor, _Str_TpoDocGian, _Txt_Document.Text, _Str_Recepcion);
                                    }
                                }
                                else
                                {
                                    _Bol_Verificar = false;
                                }
                                Cursor = Cursors.Default;
                            }
                            if (_Bol_Verificar)
                            {
                                _Str_Cadena = "UPDATE TCOMPROBANC SET cstatus='1',clvalidado='1',cvalidate='" + _Cls_Formato._Mtd_fecha(CLASES._Cls_Varios_Metodos._Mtd_SQLGetDate()) + "',cdateupd='" + _Cls_Formato._Mtd_fecha(CLASES._Cls_Varios_Metodos._Mtd_SQLGetDateServ()) + "',cuserupd='" + Frm_Padre._Str_Use + "' WHERE ccompany='" + Frm_Padre._Str_Comp + "' AND cidcomprob='" + _Int_ID_Comprobante + "'";
                                Program._MyClsCnn._mtd_conexion._Mtd_EjecutarSentencia(_Str_Cadena);
                                System.Threading.ThreadPool.QueueUserWorkItem(((Frm_Padre)this.MdiParent)._Frm_Contenedor._async_Default);
                                MessageBox.Show("La operación ha sido realizada correctamente", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("Problemas de conexión para crear la retención. Por favor espere un minuto e intente nuevamente.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            this.Close();
                        }
                        else
                        {
                            _Frm.Close();
                            _Frm.Dispose();
                            goto _PrintComprob;
                        }
                    }
                    else
                    {
                        _Pnl_Clave.Visible = false;
                        _Txt_Clave.Text    = "";
                    }
                }
                catch (Exception _Ex) { Cursor = Cursors.Default; MessageBox.Show("Error al intentar imprimir.\n" + _Ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
            }
            else
            {
                MessageBox.Show("No se encontró la nota de recepción", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }