private void tlbMenu_DeleteClick()
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                if (XtraMessageBox.Show("Esta seguro de eliminar el registro?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (!ValidarIngreso())
                    {
                        DocumentoBE objE_Documento = new DocumentoBE();
                        objE_Documento.IdDocumento = int.Parse(gvDocumento.GetFocusedRowCellValue("IdDocumento").ToString());
                        objE_Documento.Usuario     = Parametros.strUsuarioLogin;
                        objE_Documento.Maquina     = WindowsIdentity.GetCurrent().Name.ToString();
                        objE_Documento.IdEmpresa   = Parametros.intEmpresaId;

                        DocumentoBL objBL_Area = new DocumentoBL();
                        objBL_Area.Elimina(objE_Documento);
                        XtraMessageBox.Show("El registro se eliminó correctamente", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Cargar();
                    }
                }
                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
        private void button4_Click(object sender, EventArgs e)
        {
            //Guardar Documento en la Base de Datos
            DocumentoBE oDocumento = new DocumentoBE();
            //Guardar la cabecera
            CabDocumentoBE oCabecera = new CabDocumentoBE();

            oCabecera.Cliente   = otmpCliente;
            oCabecera.FechaHora = DateTime.Now;
            oCabecera.IGV       = oFacturaBL.IGV;
            oCabecera.SubTotal  = oFacturaBL.SubTotal;
            oCabecera.Total     = oFacturaBL.Total;
            //Agregamos la cabera al documento
            oDocumento.Cabecera = oCabecera;
            //Agregarmos el detalle al documento
            oDocumento.Detalle = oFacturaBL.GetDetalle();
            //Guardar en la Base de Datos
            DocumentoBL documento = new DocumentoBL();

            //if (documento.GuardarDocumento(oDocumento) ==
            //    eEstadoProceso.Correcto)
            //documento.GuardarDocumento(oDocumento);
            //    MessageBox.Show("Documento Guardado");

            ProxyFactura.Service1Client proxy = new ProxyFactura.Service1Client("MSMQ_EndPoint");
            proxy.GuardarDocumento(oDocumento);
            MessageBox.Show("Documento Guardado");
        }
Пример #3
0
        public ActionResult Guardar(Documento doc)
        {
            doc.Fecha     = DateTime.Now;
            doc.Estado    = "P";
            doc.UsuarioId = SessionHelper.GetUser();
            DocumentoBL.Crear(doc);

            return(RedirectToAction("Index"));
        }
Пример #4
0
        public ActionResult Ver(int id)
        {
            var doc = DocumentoBL.Obtener(id);

            ViewBag.TipoDocId = new SelectList(TipoDocBL.Listar(), "TipoDocId", "Nombre");
            ViewBag.OficinaId = new SelectList(OficinaBL.Listar(), "OficinaId", "Nombre");

            return(View(doc));
        }
Пример #5
0
        public ActionResult Index(string id = "")
        {
            if (string.IsNullOrEmpty(id))
            {
                return(View(DocumentoBL.Listar(null, x => x.OrderByDescending(y => y.DocumentoId),
                                               includeProperties: "TipoDoc,Oficina").Take(15).ToList()));
            }

            return(View(DocumentoBL.Listar(x => x.Nombre.Contains(id) || x.NroDoc.Contains(id),
                                           x => x.OrderByDescending(y => y.DocumentoId),
                                           includeProperties: "TipoDoc,Oficina")));
        }
Пример #6
0
        private void frmManDocumentoEdit_Load(object sender, EventArgs e)
        {
            BSUtils.LoaderLook(cboCarpeta, new CarpetaBL().ListaTodosActivo(0), "DescCarpeta", "IdCarpeta", true);
            cboCarpeta.EditValue       = IdCarpeta;
            deFechaAprobacion.DateTime = DateTime.Now;

            if (pOperacion == Operacion.Nuevo)
            {
                this.Text = "Documento - Nuevo";
            }
            else if (pOperacion == Operacion.Modificar)
            {
                this.Text = "Documento - Modificar";
                DocumentoBE objE_Documento = null;
                objE_Documento = new DocumentoBL().Selecciona(IdDocumento);
                if (objE_Documento != null)
                {
                    IdDocumento          = objE_Documento.IdDocumento;
                    cboCarpeta.EditValue = objE_Documento.IdCarpeta;

                    strRuta                          = objE_Documento.Ruta;
                    txtCodigo.Text                   = objE_Documento.Codigo;
                    byteArchivo                      = objE_Documento.Archivo;
                    txtNombreArchivo.Text            = objE_Documento.NombreArchivo;
                    txtRevision.Text                 = objE_Documento.Revision;
                    deFechaAprobacion.EditValue      = objE_Documento.FechaAprobacion;
                    chkFlagContabilidad.Checked      = objE_Documento.FlagContabilidad;
                    chkFlagSistemas.Checked          = objE_Documento.FlagSistemas;
                    chkFlagLegal.Checked             = objE_Documento.FlagContabilidad;
                    chkFlagTesoreria.Checked         = objE_Documento.FlagTesoreria;
                    chkFlagAtraccion.Checked         = objE_Documento.FlagAtraccion;
                    chkFlagAdministracion.Checked    = objE_Documento.FlagAdministracion;
                    chkFlagComercial.Checked         = objE_Documento.FlagComercial;
                    chkFlagDesarrolloNegocio.Checked = objE_Documento.FlagDesarrolloNegocio;
                    chkFlagControlGestion.Checked    = objE_Documento.FlagControlGestion;
                    chkFlagAlmacen.Checked           = objE_Documento.FlagAlmacen;
                    chkFlagDespacho.Checked          = objE_Documento.FlagDespacho;
                    chkFlagGerenciaGeneral.Checked   = objE_Documento.FlagGerenciaGeneral;
                    chkFlagMarketing.Checked         = objE_Documento.FlagMarketing;
                    chkFlagOperacion.Checked         = objE_Documento.FlagOperacion;
                    chkFlagProyecto.Checked          = objE_Documento.FlagProyecto;
                    chkFlagServicioGeneral.Checked   = objE_Documento.FlagServicioGeneral;
                    chkFlagPlaneamiento.Checked      = objE_Documento.FlagPlaneamiento;
                    chkFlagCompensacion.Checked      = objE_Documento.FlagCompensacion;
                    chkFlagBienestar.Checked         = objE_Documento.FlagBienestar;
                    chkFlagAlquileres.Checked        = objE_Documento.FlagAlquiler;
                }
            }

            btnBucarPdf.Select();
        }
Пример #7
0
        public List <DetalleOperacionFamiliaResult> ListarDetalleAfiliadas(int idEmpresa, int codigoUsuario, DateTime fechaCorte, char operacion, string id_agendacompara, decimal idmoneda)
        {
            DocumentoBL objDocumentoBL;

            try
            {
                objDocumentoBL = new DocumentoBL();
                return(objDocumentoBL.ListarDetalleAfiliadas(idEmpresa, codigoUsuario, fechaCorte, operacion, id_agendacompara, idmoneda));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #8
0
        public void EliminarDocumentoFamilia(int idEmpresa, int codigoUsuario, decimal idDocumento)
        {
            DocumentoBL objDocumentoBL;

            try
            {
                objDocumentoBL = new DocumentoBL();
                objDocumentoBL.EliminarDocumentoFamilia(idEmpresa, codigoUsuario, idDocumento);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #9
0
        public List <VBG00716Result> Documento_ListarDocVenta(int idEmpresa, int codigoUsuario)
        {
            DocumentoBL objDocumentoBL;

            try
            {
                objDocumentoBL = new DocumentoBL();
                return(objDocumentoBL.Documento_ListarDocVenta(idEmpresa, codigoUsuario));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #10
0
        public List <ListarDocumentosFamiliaResult> ListarDocumentosFamilia(int idEmpresa, int codigoUsuario, int tipoFamilia)
        {
            DocumentoBL objDocumentoBL;

            try
            {
                objDocumentoBL = new DocumentoBL();
                return(objDocumentoBL.ListarDocumentosFamilia(idEmpresa, codigoUsuario, tipoFamilia));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #11
0
        public List <DetalleOperacionFamiliaAnticuamientoDocumentoResult> DetalleOperacionFamiliaAnticuamientoDocumento(int idEmpresa, int codigoUsuario, DateTime fechaCorte, char operacion, string id_agenda, int tipoFamiliaDoc, int TipoDoc)
        {
            DocumentoBL objDocumentoBL;

            try
            {
                objDocumentoBL = new DocumentoBL();
                return(objDocumentoBL.DetalleOperacionFamiliaAnticuamientoDocumento(idEmpresa, codigoUsuario, fechaCorte, operacion, id_agenda, tipoFamiliaDoc, TipoDoc));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #12
0
        public List <gsDocumento_ListarTipoCompraResult> Documento_ListarDocCompra(int idEmpresa, int codigoUsuario, string descripcion)
        {
            DocumentoBL objDocumentoBL;

            try
            {
                objDocumentoBL = new DocumentoBL();
                return(objDocumentoBL.Documento_ListarDocCompra(idEmpresa, codigoUsuario, descripcion));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #13
0
        public ActionResult Actualizar(Documento doc)
        {
            // DocumentoBL.Actualizar(doc);
            DocumentoBL.ActualizarParcial(new Documento
            {
                DocumentoId = doc.DocumentoId,
                Nombre      = doc.Nombre,
                NroDoc      = doc.NroDoc,
                TipoDocId   = doc.TipoDocId,
                OficinaId   = doc.OficinaId
            }, x => x.Nombre, x => x.TipoDocId, x => x.OficinaId, x => x.NroDoc);


            return(RedirectToAction("Index"));
        }
        public void InicializarModificar()
        {
            if (gvDocumento.RowCount > 0)
            {
                int         intIdDocumento = int.Parse(gvDocumento.GetFocusedRowCellValue("IdDocumento").ToString());
                DocumentoBE objSSOMA       = null;
                objSSOMA = new DocumentoBL().Selecciona(intIdDocumento);
                if (objSSOMA != null)
                {
                    string sFilePath = "";
                    byte[] Buffer;

                    Buffer = objSSOMA.Archivo;

                    sFilePath = Path.GetTempFileName();
                    File.Move(sFilePath, Path.ChangeExtension(sFilePath, ".pdf"));
                    sFilePath = Path.ChangeExtension(sFilePath, ".pdf");
                    File.WriteAllBytes(sFilePath, Buffer);

                    ProcessStartInfo start = new ProcessStartInfo();
                    //start.UseShellExecute = false;
                    // Enter in the command line arguments, everything you would enter after the executable name itself
                    start.Arguments = sFilePath + " 1";
                    // Enter the executable to run, including the complete path
                    start.FileName = Path.Combine(Directory.GetCurrentDirectory(), "Pdf\\PdfiumViewer.Demo.exe");
                    // Do you want to show a console window?
                    start.WindowStyle    = ProcessWindowStyle.Hidden;
                    start.CreateNoWindow = true;
                    int exitCode;

                    // Run the external process & wait for it to finish
                    using (Process proc = Process.Start(start))
                    {
                        proc.WaitForExit();

                        // Retrieve the app's exit code
                        exitCode = proc.ExitCode;
                    }
                }
            }
            else
            {
                MessageBox.Show("No se pudo editar");
            }
        }
        private void btnAsignar_Click(object sender, EventArgs e)
        {
            try
            {
                string strCodigo        = "";
                string strNombreArchivo = "";
                string strRevision      = "";

                var Buscar = mListaDocumentoPersonaOrigen.Where(oB => oB.IdDocumento == Convert.ToInt32(cboDocumento.EditValue)).ToList();
                if (Buscar.Count > 0)
                {
                    XtraMessageBox.Show("No se puede repetir el documento \n Por Favor Verique", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    DocumentoBE objE_Documento = null;
                    objE_Documento = new DocumentoBL().Selecciona(Convert.ToInt32(cboDocumento.EditValue));
                    if (objE_Documento != null)
                    {
                        strCodigo        = objE_Documento.Codigo;
                        strNombreArchivo = objE_Documento.NombreArchivo;
                        strRevision      = objE_Documento.Revision;
                    }
                }

                gvDocumentoPersona.AddNewRow();
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "IdEmpresa", Parametros.intEmpresaId);
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "IdDocumentoPersona", 0);
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "IdPersona", IdPersona);
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "IdDocumento", Convert.ToInt32(cboDocumento.EditValue));
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "Codigo", strCodigo);
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "NombreArchivo", strNombreArchivo);
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "Revision", strRevision);
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "FlagImpresion", 0);
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "Lectura", 0);
                gvDocumentoPersona.SetRowCellValue(gvDocumentoPersona.FocusedRowHandle, "TipoOper", Convert.ToInt32(Operacion.Nuevo));
            }

            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #16
0
        public JsonResult Adjuntar(int DocumentoId, HttpPostedFileBase documento)
        {
            var respuesta = new ResponseModel
            {
                respuesta = true,
                error     = ""
            };

            if (documento != null)
            {
                string adjunto = DateTime.Now.ToString("yyyyMMddHHmmss") + Path.GetExtension(documento.FileName);
                documento.SaveAs(Server.MapPath("~/Documentos/" + adjunto));

                DocumentoDetBL.Crear(new DocumentoDet {
                    DocumentoId = DocumentoId, Archivo = adjunto
                });

                //var doc = DocumentoBL.Obtener(DocumentoId);
                //doc.Estado = "T";
                //DocumentoBL.Actualizar(doc);

                DocumentoBL.ActualizarParcial(
                    new Documento {
                    DocumentoId = DocumentoId, Estado = "T"
                },
                    x => x.Estado
                    );
            }
            else
            {
                respuesta.respuesta = false;
                respuesta.error     = "Debe adjuntar un documento";
            }

            return(Json(respuesta));
        }
Пример #17
0
        public IHttpActionResult GetSeriesDocumento(int IdEstablecimiento, int IdDocumento)
        {
            var result = new DocumentoBL().GetSeriesDocumento(IdEstablecimiento, IdDocumento);

            return(Ok(result));
        }
Пример #18
0
        public void GuardarDocumento(NorthWind.Entity.DocumentoBE oDocumentoDTO)
        {
            DocumentoBL documento = new DocumentoBL();

            documento.GuardarDocumento(oDocumentoDTO);
        }
Пример #19
0
        public IHttpActionResult GetDocumentsForCombo(int UsadoCompras, int UsadoVentas)
        {
            var result = new DocumentoBL().GetDocumentsForCombo(UsadoCompras, UsadoVentas);

            return(Ok(result));
        }
        private void btnImportar_Click(object sender, EventArgs e)
        {
            string srutaArchivo = string.Empty;

            openFileDialog1.InitialDirectory = @"C:\";
            openFileDialog1.Filter           = "Archivos de Excel (*.xls) |*.xlsx";
            openFileDialog1.FilterIndex      = 2;
            openFileDialog1.RestoreDirectory = true;
            openFileDialog1.FileName         = "";

            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                srutaArchivo = openFileDialog1.FileName;

                try
                {
                    msgHelper.Wait("Cargando registros, espere un momento ...");
                    cnExcel = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + srutaArchivo + ";Extended Properties='Excel 12.0 Xml;HDR=YES';");

                    if (cnExcel.State == ConnectionState.Closed)
                    {
                        cnExcel.Open();
                    }

                    if (!System.IO.File.Exists(srutaArchivo))
                    {
                        MessageBox.Show("No se encontró el Libro: " + srutaArchivo, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    //daExcel = new OleDbDataAdapter("Select N_Cartera, CodClasifCar, NomClasifCar, DireccionClasifCar, " + "CodDeudorCar, '0' & TipoIdentidad as TipoIdentidad, NroIdentidad, APELLIDOSYNOMBRES, DIRECCION, DISTRITO, " + _();
                    //"PROVINCIA, DEPARTAMENTO, CODPOSTAL, TELFDOM, TELFMOV, EmpLaboral, EmpDireccion, " + "EmpDistrito, TelfLab, Sexo, Fch_nacimiento, N_Operacion, Fec_Emis, Cap_Orig, Sal_Cap, " + "InteresMor, InteresComp, Honorarios, Gastos, Pagos, Deuda_Total, IIf (Moneda='S','001',IIf (Moneda='D','002',Moneda)) as Moneda , Fec_Venc, " +
                    //"Fec_Jud, Conyugue, ANombre, ADireccion, ADistrito, Atelefono, AEmpLaboral, AEmpDireccion, " + "AEmpDistrito, AEmpTelefono, Fecha_Asig, Tipo_Cart, Producto_Orig_Deuda, LoginGA, Oficina " + "From [Data$A1:AV20000] ", cnExcel);

                    OleDbDataAdapter daExcel = new OleDbDataAdapter("Select * " +
                                                                    "From [Carga$A1:Q20000] ", cnExcel);

                    DataTable dtTable = new DataTable();
                    daExcel.Fill(dtTable);

                    //Valida que no se repita el numero de documento en la carga de datos
                    foreach (DataRow row in dtTable.Rows)
                    {
                        if (!string.IsNullOrEmpty(row["RUCPAGADORA"].ToString().Trim()))
                        {
                            string IdDocumento = row["TIPODOCUMENTO"].ToString();
                            string cNumDoc     = row["NroDOCUMENTO"].ToString();
                            string RucPagadora = row["RUCPAGADORA"].ToString();

                            //Buscar en el datatable
                            DataRow[] drResult = dtTable.Select("TIPODOCUMENTO = '" + IdDocumento + "' and NroDOCUMENTO = '" + cNumDoc + "' and RUCPAGADORA = '" + RucPagadora + "'");

                            if (drResult.Length > 1)
                            {
                                MessageBox.Show("El documento " + cNumDoc + " de la pagadora " + RucPagadora + " se está duplicando en la importación de datos.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                msgHelper.Wait();
                                return;
                            }
                        }
                        else
                        {
                            break;
                        }
                    }

                    int Contador = 0;
                    foreach (DataRow row in dtTable.Rows)
                    {
                        if (!string.IsNullOrEmpty(row["RUCPAGADORA"].ToString().Trim()))
                        {
                            if (Contador == 0)
                            {
                                if (!ObtenerLinea(row["RUCSOCIO"].ToString(), row["TIPOMONEDA"].ToString()))
                                {
                                    IdLinea     = string.Empty;
                                    IdMoneda_tt = string.Empty;
                                    txtIdSocio.Clear();
                                    txtIdSocio_Dsc.Clear();
                                    txtIdLinea_Dsc.Clear();
                                    txtIdMoneda_tt_Dsc.Clear();
                                    txtFecha.Clear();
                                    txtIdTipoLinea_tt_Dsc.Clear();
                                    txtCarpetaXML.Clear();
                                    IdFormaDesembolso = 0;
                                    MessageBox.Show("No se encontro ninguna linea del socio, por favor verifique.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    IsError = true;
                                    return;
                                }
                            }

                            string     IdPagadora     = string.Empty;
                            string     IdPagadora_Dsc = string.Empty;
                            PagadoraBE oEntityPag     = new PagadoraBE()
                            {
                                OPCION = 1,
                                vcRuc  = row["RUCPAGADORA"].ToString().Trim()
                            };
                            DataSet dsPag = new PagadoraBL().ProcesarPagadora(oEntityPag);

                            if (dsPag.Tables[0].Rows.Count > 0)
                            {
                                IdPagadora     = dsPag.Tables[0].Rows[0]["IdPagadora"].ToString();
                                IdPagadora_Dsc = dsPag.Tables[0].Rows[0]["vcPagadora"].ToString();
                            }

                            DocumentoBE oEntityDoc = new DocumentoBE()
                            {
                                OPCION      = 4,
                                IdDocumento = row["TIPODOCUMENTO"].ToString()
                            };
                            DataSet dsDoc = new DocumentoBL().ProcesarDocumento(oEntityDoc);

                            string IdDocumento_Dsc = string.Empty;
                            if (dsDoc.Tables[0].Rows.Count > 0)
                            {
                                IdDocumento_Dsc = dsDoc.Tables[0].Rows[0]["cAbreviatura"].ToString();
                            }

                            SocioLineaPagDocBE oEntityPagDoc = new SocioLineaPagDocBE();
                            oEntityPagDoc.OPCION      = 1;
                            oEntityPagDoc.IdLinea     = IdLinea;
                            oEntityPagDoc.IdPagadora  = IdPagadora;
                            oEntityPagDoc.IdDocumento = row["TIPODOCUMENTO"].ToString();
                            DataSet dsPagDoc = new SocioLineaPagDocBL().ProcesarSocioLineaPagDoc(oEntityPagDoc);

                            string IdTipoConfirmacion_Dsc = string.Empty;
                            if (dsPagDoc.Tables[0].Rows.Count > 0)
                            {
                                IdTipoConfirmacion_Dsc = dsPagDoc.Tables[0].Rows[0]["IdTipoConfirmacion_Dsc"].ToString();
                            }

                            FEXMLBE IEntity = new FEXMLBE()
                            {
                                IdPagadora              = IdPagadora,
                                IdPagadora_Dsc          = IdPagadora_Dsc,
                                RUC                     = row["RUCPAGADORA"].ToString().Trim(),
                                IdDocumento             = row["TIPODOCUMENTO"].ToString(),
                                IdDocumento_Dsc         = IdDocumento_Dsc,
                                cNumDoc                 = row["NroDOCUMENTO"].ToString(),
                                sdVencimiento           = Convert.ToDateTime(row["FECHAPAGO"]),
                                nvNominal               = Convert.ToDecimal(row["IMPORTENETODEPAGO"]),
                                nvNegociable            = Convert.ToDecimal(row["IMPORTENETODEPAGO"]),
                                IdTipoConfirmacion_Dsc  = IdTipoConfirmacion_Dsc,
                                IdSocio_BeneficiarioRuc = _IdSocio_BeneficiarioRuc,
                                Mensaje                 = string.Empty
                            };
                            LstEntityFE.Add(IEntity);
                            Contador++;
                        }
                    }

                    dgvFEDetalle.DataSource = LstEntityFE.ToList();
                    lblnroRegistros.Text    = LstEntityFE.Count() + " registro(s)";
                    OrigenLote = 1;
                    cnExcel.Close();
                    //btnImportar.Enabled = false;
                    msgHelper.Wait();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    cnExcel.Close();
                    msgHelper.Wait();
                }
            }
        }
        private void LectorXML(String file_path, int Contador)
        {
            try
            {
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(file_path);
                XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlDoc.NameTable);
                nsmgr.AddNamespace("tns", "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2");
                nsmgr.AddNamespace("cac", "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2");
                nsmgr.AddNamespace("cbc", "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2");

                XmlNode node    = xmlDoc.SelectSingleNode("/tns:Invoice/cbc:UBLVersionID", nsmgr); //Version
                string  Version = node.InnerText.ToString();

                string strRucSocio     = string.Empty;                                                                                                   //RUC Socio
                string strRucPagadora  = string.Empty;                                                                                                   //RUC Pagadora
                string strFechaEmision = xmlDoc.SelectSingleNode("/tns:Invoice/cbc:IssueDate", nsmgr).InnerText;                                         //Fecha de Emision
                string strNroDoc       = xmlDoc.SelectSingleNode("/tns:Invoice/cac:Signature/cbc:ID", nsmgr).InnerText;                                  //Serie y número
                string strMoneda       = xmlDoc.SelectSingleNode("/tns:Invoice/cac:LegalMonetaryTotal/cbc:PayableAmount//@currencyID", nsmgr).InnerText; //Moneda
                string strImpuesto     = xmlDoc.SelectSingleNode("/tns:Invoice/cac:TaxTotal/cbc:TaxAmount", nsmgr).InnerText;                            //Impuesto
                string strMonto        = xmlDoc.SelectSingleNode("/tns:Invoice/cac:LegalMonetaryTotal/cbc:PayableAmount", nsmgr).InnerText;              //Monto

                if (Version.Equals("2.0"))
                {
                    strRucSocio    = xmlDoc.SelectSingleNode("/tns:Invoice/cac:AccountingSupplierParty//cbc:CustomerAssignedAccountID", nsmgr).InnerText; //RUC Socio
                    strRucPagadora = xmlDoc.SelectSingleNode("/tns:Invoice/cac:AccountingCustomerParty//cbc:CustomerAssignedAccountID", nsmgr).InnerText; //RUC Pagadora
                }
                else if (Version.Equals("2.1"))
                {
                    strRucSocio    = xmlDoc.SelectSingleNode("/tns:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PartyIdentification/cbc:ID", nsmgr).InnerText; //RUC Socio
                    strRucPagadora = xmlDoc.SelectSingleNode("/tns:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyIdentification/cbc:ID", nsmgr).InnerText; //RUC Pagadora
                }
                else
                {
                    MessageBox.Show("Versión del XML no soportada - " + Version, "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (Contador == 0)
                {
                    if (!ObtenerLinea(strRucSocio, strMoneda))
                    {
                        Contador    = 1;
                        IdLinea     = string.Empty;
                        IdMoneda_tt = string.Empty;
                        txtIdSocio.Clear();
                        txtIdSocio_Dsc.Clear();
                        txtIdLinea_Dsc.Clear();
                        txtIdMoneda_tt_Dsc.Clear();
                        txtFecha.Clear();
                        txtIdTipoLinea_tt_Dsc.Clear();
                        txtCarpetaXML.Clear();
                        IdFormaDesembolso = 0;
                        MessageBox.Show("No se encontro ninguna linea del socio, por favor verifique.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        IsError = true;
                        return;
                    }
                }

                string     IdPagadora     = string.Empty;
                string     IdPagadora_Dsc = string.Empty;
                PagadoraBE oEntityPag     = new PagadoraBE()
                {
                    OPCION = 1,
                    vcRuc  = strRucPagadora
                };
                DataSet dsPag = new PagadoraBL().ProcesarPagadora(oEntityPag);

                if (dsPag.Tables[0].Rows.Count > 0)
                {
                    IdPagadora     = dsPag.Tables[0].Rows[0]["IdPagadora"].ToString();
                    IdPagadora_Dsc = dsPag.Tables[0].Rows[0]["vcPagadora"].ToString();
                }

                DocumentoBE oEntityDoc = new DocumentoBE()
                {
                    OPCION      = 4,
                    IdDocumento = "00010"
                };
                DataSet dsDoc = new DocumentoBL().ProcesarDocumento(oEntityDoc);

                string IdDocumento_Dsc = string.Empty;
                if (dsDoc.Tables[0].Rows.Count > 0)
                {
                    IdDocumento_Dsc = dsDoc.Tables[0].Rows[0]["cAbreviatura"].ToString();
                }

                SocioLineaPagDocBE oEntityPagDoc = new SocioLineaPagDocBE();
                oEntityPagDoc.OPCION      = 1;
                oEntityPagDoc.IdLinea     = IdLinea;
                oEntityPagDoc.IdPagadora  = IdPagadora;
                oEntityPagDoc.IdDocumento = "00010"; // Factura Electronica
                DataSet dsPagDoc = new SocioLineaPagDocBL().ProcesarSocioLineaPagDoc(oEntityPagDoc);

                string IdTipoConfirmacion_Dsc = string.Empty;
                if (dsPagDoc.Tables[0].Rows.Count > 0)
                {
                    IdTipoConfirmacion_Dsc = dsPagDoc.Tables[0].Rows[0]["IdTipoConfirmacion_Dsc"].ToString();
                }

                FEXMLBE IEntity = new FEXMLBE()
                {
                    IdPagadora              = IdPagadora,
                    IdPagadora_Dsc          = IdPagadora_Dsc,
                    RUC                     = strRucPagadora,
                    IdDocumento             = "00010", // Factura Electronica
                    IdDocumento_Dsc         = IdDocumento_Dsc,
                    IdTipoConfirmacion_Dsc  = IdTipoConfirmacion_Dsc,
                    cNumDoc                 = strNroDoc,
                    nvNominal               = Convert.ToDecimal(strMonto),
                    nvNegociable            = 0,
                    Mensaje                 = string.Empty,
                    IdSocio_BeneficiarioRuc = _IdSocio_BeneficiarioRuc
                };
                LstEntityFE.Add(IEntity);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #22
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                if (!ValidarIngreso())
                {
                    DocumentoBL objBL_Documento = new DocumentoBL();
                    DocumentoBE objDocumento    = new DocumentoBE();

                    objDocumento.IdDocumento = IdDocumento;
                    objDocumento.IdCarpeta   = Convert.ToInt32(cboCarpeta.EditValue);

                    objDocumento.Ruta                         = strRuta;
                    objDocumento.Codigo                       = txtCodigo.Text;
                    objDocumento.NombreArchivo                = txtNombreArchivo.Text;
                    objDocumento.Revision                     = txtRevision.Text;
                    objDocumento.FechaAprobacion              = Convert.ToDateTime(deFechaAprobacion.DateTime.ToShortDateString());
                    objDocumento.FlagContabilidad             = (chkFlagContabilidad.Checked) ? true : false;
                    objDocumento.FlagSistemas                 = (chkFlagSistemas.Checked) ? true : false;
                    objDocumento.FlagLegal                    = (chkFlagLegal.Checked) ? true : false;
                    objDocumento.FlagTesoreria                = (chkFlagTesoreria.Checked) ? true : false;
                    objDocumento.FlagAtraccion                = (chkFlagAtraccion.Checked) ? true : false;
                    objDocumento.FlagAdministracion           = (chkFlagAdministracion.Checked) ? true : false;
                    objDocumento.FlagComercial                = (chkFlagComercial.Checked) ? true : false;
                    objDocumento.FlagDesarrolloNegocio        = (chkFlagDesarrolloNegocio.Checked) ? true : false;
                    objDocumento.FlagControlGestion           = (chkFlagControlGestion.Checked) ? true : false;
                    objDocumento.FlagAlmacen                  = (chkFlagAlmacen.Checked) ? true : false;
                    objDocumento.FlagDespacho                 = (chkFlagDespacho.Checked) ? true : false;
                    objDocumento.FlagGerenciaGeneral          = (chkFlagGerenciaGeneral.Checked) ? true : false;
                    objDocumento.FlagMarketing                = (chkFlagMarketing.Checked) ? true : false;
                    objDocumento.FlagOperacion                = (chkFlagOperacion.Checked) ? true : false;
                    objDocumento.FlagProyecto                 = (chkFlagProyecto.Checked) ? true : false;
                    objDocumento.FlagServicioGeneral          = (chkFlagServicioGeneral.Checked) ? true : false;
                    objDocumento.FlagPlaneamiento             = (chkFlagPlaneamiento.Checked) ? true : false;
                    objDocumento.FlagCompensacion             = (chkFlagCompensacion.Checked) ? true : false;
                    objDocumento.FlagBienestar                = (chkFlagBienestar.Checked) ? true : false;
                    objDocumento.FlagAlquiler                 = (chkFlagAlquileres.Checked) ? true : false;
                    objDocumento.FlagDesarrolloOrganizacional = false;
                    objDocumento.FlagEstado                   = true;
                    objDocumento.Usuario                      = Parametros.strUsuarioLogin;
                    objDocumento.Maquina                      = WindowsIdentity.GetCurrent().Name.ToString();
                    objDocumento.IdEmpresa                    = Parametros.intEmpresaId;

                    if (pOperacion == Operacion.Nuevo)
                    {
                        FileStream fStream  = File.OpenRead(strRuta);
                        byte[]     contents = new byte[fStream.Length];
                        fStream.Read(contents, 0, (int)fStream.Length);
                        fStream.Close();

                        objDocumento.Archivo = contents;

                        objBL_Documento.Inserta(objDocumento);
                    }
                    else
                    {
                        objDocumento.Archivo = byteArchivo;
                        objBL_Documento.Actualiza(objDocumento);
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #23
0
        void ExportarPlanillaExcel(string filename)
        {
            //if (filename.Trim() == "")
            //    return;

            Excel._Application xlApp;
            Excel._Workbook    xlLibro;
            Excel._Worksheet   xlHoja;
            Excel.Sheets       xlHojas;
            xlApp    = new Excel.Application();
            filename = Path.Combine(Directory.GetCurrentDirectory(), "Listado Maestro Documentos.xlsx");
            xlLibro  = xlApp.Workbooks.Open(filename, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
            xlHojas  = xlLibro.Sheets;
            xlHoja   = (Excel._Worksheet)xlHojas[1];

            Cursor.Current = Cursors.WaitCursor;

            try
            {
                int Row       = 6;
                int Secuencia = 1;

                List <DocumentoBE> lstDocumento = new List <DocumentoBE>();

                List <DocumentoPersonaBE> lstDocumentoPersona = null;
                lstDocumentoPersona = new DocumentoPersonaBL().ListaTodosActivo(0, Parametros.intPersonaId, 0);

                foreach (var item in lstDocumentoPersona)
                {
                    DocumentoBE objE_Documento = new DocumentoBE();
                    objE_Documento = new DocumentoBL().Selecciona(item.IdDocumento);
                    if (objE_Documento != null)
                    {
                        lstDocumento.Add(objE_Documento);
                    }
                }



                if (lstDocumento.Count > 0)
                {
                    foreach (var item in lstDocumento)
                    {
                        xlHoja.Cells[Row, 1] = item.DescCarpeta;
                        xlHoja.Cells[Row, 2] = item.Codigo;
                        xlHoja.Cells[Row, 3] = item.NombreArchivo;
                        xlHoja.Cells[Row, 6] = item.Revision;
                        xlHoja.Cells[Row, 7] = item.FechaAprobacion;
                        if (item.FlagContabilidad)
                        {
                            xlHoja.Cells[Row, 8] = "X";
                        }
                        if (item.FlagSistemas)
                        {
                            xlHoja.Cells[Row, 8] = "X";
                        }
                        if (item.FlagLegal)
                        {
                            xlHoja.Cells[Row, 10] = "X";
                        }
                        if (item.FlagTesoreria)
                        {
                            xlHoja.Cells[Row, 11] = "X";
                        }
                        if (item.FlagAtraccion)
                        {
                            xlHoja.Cells[Row, 12] = "X";
                        }
                        if (item.FlagAdministracion)
                        {
                            xlHoja.Cells[Row, 13] = "X";
                        }
                        if (item.FlagComercial)
                        {
                            xlHoja.Cells[Row, 14] = "X";
                        }
                        if (item.FlagDesarrolloNegocio)
                        {
                            xlHoja.Cells[Row, 15] = "X";
                        }
                        if (item.FlagControlGestion)
                        {
                            xlHoja.Cells[Row, 16] = "X";
                        }
                        if (item.FlagAlmacen)
                        {
                            xlHoja.Cells[Row, 17] = "X";
                        }
                        if (item.FlagDespacho)
                        {
                            xlHoja.Cells[Row, 18] = "X";
                        }
                        if (item.FlagGerenciaGeneral)
                        {
                            xlHoja.Cells[Row, 19] = "X";
                        }
                        if (item.FlagMarketing)
                        {
                            xlHoja.Cells[Row, 20] = "X";
                        }
                        if (item.FlagOperacion)
                        {
                            xlHoja.Cells[Row, 21] = "X";
                        }
                        if (item.FlagProyecto)
                        {
                            xlHoja.Cells[Row, 22] = "X";
                        }
                        if (item.FlagServicioGeneral)
                        {
                            xlHoja.Cells[Row, 23] = "X";
                        }
                        if (item.FlagPlaneamiento)
                        {
                            xlHoja.Cells[Row, 24] = "X";
                        }
                        if (item.FlagCompensacion)
                        {
                            xlHoja.Cells[Row, 25] = "X";
                        }
                        if (item.FlagBienestar)
                        {
                            xlHoja.Cells[Row, 26] = "X";
                        }
                        if (item.FlagAlquiler)
                        {
                            xlHoja.Cells[Row, 27] = "X";
                        }


                        Row       = Row + 1;
                        Secuencia = Secuencia + 1;
                    }
                }

                xlLibro.SaveAs("D:\\Listado Maestro Documentos.xlsx", Excel.XlFileFormat.xlWorkbookDefault, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Excel.XlSaveAsAccessMode.xlExclusive, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);

                xlLibro.Close(true, Missing.Value, Missing.Value);
                xlApp.Quit();

                Cursor.Current = Cursors.Default;
                XtraMessageBox.Show("La Lista Maestra de Documentos se exportó correctamente \n Se generó el archivo D:\\Listado Maestro Documentos.xlsx", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                xlLibro.Close(false, Missing.Value, Missing.Value);
                xlApp.Quit();
                Cursor.Current = Cursors.Default;
                MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Пример #24
0
        private void tvwDatos_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;

                int         intIdDocumento = Convert.ToInt32(e.Node.Tag.ToString().Substring(3, e.Node.Tag.ToString().Length - 3));
                DocumentoBE objSSOMA       = null;
                objSSOMA = new DocumentoBL().Selecciona(intIdDocumento);
                if (objSSOMA != null)
                {
                    string sFilePath = "";
                    byte[] Buffer;

                    Buffer = objSSOMA.Archivo;

                    sFilePath = Path.GetTempFileName();
                    File.Move(sFilePath, Path.ChangeExtension(sFilePath, ".pdf"));
                    sFilePath = Path.ChangeExtension(sFilePath, ".pdf");
                    File.WriteAllBytes(sFilePath, Buffer);

                    ProcessStartInfo start = new ProcessStartInfo();
                    // Enter in the command line arguments, everything you would enter after the executable name itself

                    List <DocumentoPersonaBE> lstDocumentoPersona = null;
                    lstDocumentoPersona = new DocumentoPersonaBL().ListaTodosActivo(0, Parametros.intPersonaId, intIdDocumento);
                    if (lstDocumentoPersona.Count > 0)
                    {
                        if (lstDocumentoPersona[0].FlagImpresion)
                        {
                            start.Arguments = sFilePath + " 1";
                        }
                        else
                        {
                            start.Arguments = sFilePath + " 0";
                        }
                    }

                    // Enter the executable to run, including the complete path
                    start.FileName = Path.Combine(Directory.GetCurrentDirectory(), "Pdf\\PdfiumViewer.Demo.exe");
                    // Do you want to show a console window?
                    start.WindowStyle    = ProcessWindowStyle.Hidden;
                    start.CreateNoWindow = true;
                    int exitCode;

                    // Run the external process & wait for it to finish
                    using (Process proc = Process.Start(start))
                    {
                        proc.WaitForExit();

                        // Retrieve the app's exit code
                        exitCode = proc.ExitCode;
                    }

                    //ACTUALIZA LA LECTURA DE LOS DOCUMENTOS POR PERSONA
                    DocumentoPersonaBL objBL_DocumentoPersona = new DocumentoPersonaBL();
                    objBL_DocumentoPersona.ActualizaLectura(Parametros.intPersonaId, intIdDocumento);
                }

                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }