コード例 #1
0
        public List <SOLICITANTE> GetSolicitanteList(EMPRESA empresa)
        {
            List <SOLICITANTE> listSolicitantes = new List <SOLICITANTE>();

            using (var entitie = new TAE2Entities())
            {
                EMPRESA emp = (from e in entitie.EMPRESAs
                               where e.UNID_EMPRESA == empresa.UNID_EMPRESA
                               select e).First <EMPRESA>();

                emp.SOLICITANTEs.ToList().ForEach(s =>
                {
                    listSolicitantes.Add(new SOLICITANTE()
                    {
                        UNID_SOLICITANTE = s.UNID_SOLICITANTE,
                        SOLICITANTE_NAME = s.SOLICITANTE_NAME,
                        DEPARTAMENTO     = new DEPARTAMENTO()
                        {
                            UNID_DEPARTAMENTO = s.DEPARTAMENTO.UNID_DEPARTAMENTO,
                            DEPARTAMENTO_NAME = s.DEPARTAMENTO.DEPARTAMENTO_NAME
                        },
                        EMPRESA = new EMPRESA()
                        {
                            UNID_EMPRESA = s.EMPRESA.UNID_EMPRESA,
                            EMPRESA_NAME = s.EMPRESA.EMPRESA_NAME
                        }
                    });
                });
            }

            return(listSolicitantes);
        }
コード例 #2
0
        public async Task <EMPRESA> Update(EMPRESA element)
        {
            var aux = _solutionDBContext.EMPRESAS.Update(element);
            await _solutionDBContext.SaveChangesAsync();

            return(aux.Entity);
        }
コード例 #3
0
        public IHttpActionResult PostEMPRESA(EMPRESA eMPRESA)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.EMPRESAs.Add(eMPRESA);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (EMPRESAExists(eMPRESA.EMPRESA_RUT))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = eMPRESA.EMPRESA_RUT }, eMPRESA));
        }
コード例 #4
0
        public IHttpActionResult PutEMPRESA(decimal id, EMPRESA eMPRESA)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != eMPRESA.EMPRESA_RUT)
            {
                return(BadRequest());
            }

            db.Entry(eMPRESA).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EMPRESAExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #5
0
        public ActionResult CreaEmpresa(EMPRESA _empresa)
        {
            if (ModelState.IsValid)
            {
                using (Entities)
                {
                    var ConsultEmpresa = Entities.EMPRESA.Any(x => x.Telefono.Equals(_empresa.Nombre, StringComparison.CurrentCultureIgnoreCase));
                    if (!ConsultEmpresa)
                    {
                        var empresa = Entities.EMPRESA.Add(new EMPRESA
                        {
                            Nombre        = _empresa.Nombre,
                            Direccion     = _empresa.Direccion,
                            Telefono      = _empresa.Telefono,
                            FechaCreacion = DateTime.Now,
                            Activo        = true
                        });

                        Entities.SaveChanges();
                        return(RedirectToAction("CreaRolesUsuarios", new { id = empresa.Id }));
                    }
                    else
                    {
                        ModelState.AddModelError("Empresa", "La Empresa ya existe.");
                    }
                }
            }
            return(View("Index", _empresa));
        }
コード例 #6
0
        public void Insertar()
        {
            string Mensaje = "";

            System.IO.MemoryStream ms = new MemoryStream();
            this.pb_imagen.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            byte[] ruta_imagen = ms.GetBuffer();
            try
            {
                EMPRESA obj = new EMPRESA();
                obj.CELULAR                = txt_celular.Text == "   -   -" ? "" : txt_celular.Text.Trim();
                obj.DIRECCION              = txt_direccion.Text;
                obj.EMAIL                  = txt_email.Text.Trim();
                obj.ESLOGAN                = txt_eslogan.Text.Trim();
                obj.LOGO                   = ruta_imagen;
                obj.FAX                    = lbl_fax.Text == "   -   -" ? "" : lbl_fax.Text.Trim();
                obj.ID_EMPRESA             = Convert.ToInt32(Txt_ID.Text);
                obj.ID_TIPO_IDENTIFICACION = Convert.ToInt32(cb_tipo_identificacion.SelectedValue);
                obj.IMPRESORA              = txt_impresora.Text.Trim();
                obj.NOMBRE                 = txt_nombre.Text.Trim();
                obj.NUMERO_IDENTIFICACION  = txt_numero_identificacion.Text.Trim();
                obj.PAGINA_WEB             = txt_pagina_web.Text.Trim();
                obj.TELEFONO               = txt_telefono.Text == "   -   -" ? "" : txt_telefono.Text.Trim();

                S_Empresa.Actualizar_Empresa(obj);
                Mensaje = "Registro Actualizado con Éxito";

                S_Utilidades.Mensaje_Informacion(Mensaje);
                this.Close();
            }
            catch (Exception ex)
            {
                S_Utilidades.Mensaje_Error(ex.Message);
            }
        }
コード例 #7
0
 public FormEstablecimiento(EMPRESA empresa)
 {
     //InitializeComponent();
     //this.gridViewEstablecimiento.DataController.AllowIEnumerableDetails = true;
     //listaEstablecimientos = generalServicio.getEstablecimiento(empresa.CODIGOEMPRESA);
     //this.eSTABLECIMIENTOBindingSource.DataSource = listaEstablecimientos;
 }
コード例 #8
0
        public IArchivoReporte CrearArchivoReporteFactoria(int tipoReporte, AufenPortalReportesDataContext db, EMPRESA empresa, vw_Ubicacione departamento, DateTime FechaDesde, DateTime FechaHasta, string path, string rut)
        {
            IArchivoReporte archivoReporte = null;
            string buff = null;
            if (!String.IsNullOrEmpty(rut))
            {
                buff = ("000000000" + rut.Trim()).Substring(("000000000" + rut.Trim()).Length - 9, 9);
            }
            switch (tipoReporte)
            {
                case TipoReporte.LibroAtrasos:
                    archivoReporte =
                        new LibroAtrasos(db, empresa, departamento, FechaDesde, FechaHasta, path, buff);
                    break;
                case TipoReporte.AsistenciaLegal:

                    archivoReporte = new AsistenciaLegal(db, empresa, departamento, FechaDesde, FechaHasta, path, buff);
                    break;
                case TipoReporte.LibroSobreTiempo:
                    archivoReporte = new LibroSobreTiempo(db, empresa, departamento, FechaDesde, FechaHasta, path, buff);
                    break;
                case TipoReporte.AsistenciaPersonal:
                    archivoReporte = new AsistenciaPersonal(db, empresa, departamento, FechaDesde, FechaHasta, path, buff);
                    break;
                case TipoReporte.Ausencia:
                    archivoReporte = new Ausencia(db, empresa, departamento, FechaDesde, FechaHasta, path, buff);
                    break;
            }
            return archivoReporte;
        }
コード例 #9
0
        public void grabarEmpresa(EMPRESA empresa)
        {
            DbContextTransaction dbcxtransaction = null;

            dbcxtransaction = kippaEntities.Database.BeginTransaction();
            EMPRESA _empresa = kippaEntities.EMPRESA.Where(a => a.CODIGOEMPRESA == empresa.CODIGOEMPRESA).FirstOrDefault();

            if (_empresa != null)
            {
                kippaEntities.Entry(_empresa).CurrentValues.SetValues(empresa);
            }
            else
            {
                kippaEntities.EMPRESA.Add(empresa);
            }
            try
            {
                kippaEntities.SaveChanges();
                dbcxtransaction.Commit();
            }
            catch (Exception ex)
            {
                dbcxtransaction.Rollback();
                this.errorNasti = new ErrorNasti(1, "GeneralServicio.cs", ex.ToString());
            }
            dbcxtransaction.Dispose();
        }
コード例 #10
0
        public void loadSync(object element)
        {
            if (element != null)
            {
                EMPRESA poco = (EMPRESA)element;
                using (var entity = new TAE2Entities())
                {
                    var query = (from cust in entity.EMPRESAs
                                 where poco.UNID_EMPRESA == cust.UNID_EMPRESA
                                 select cust).ToList();

                    //Actualización
                    if (query.Count > 0)
                    {
                        var aux = query.First();

                        if (aux.LAST_MODIFIED_DATE < poco.LAST_MODIFIED_DATE)
                        {
                            udpateElementSync((object)poco);
                        }
                    }
                    //Inserción
                    else
                    {
                        insertElementSync((object)poco);
                    }

                    var modifiedCotizacion = entity.EMPRESAs.First(p => p.UNID_EMPRESA == poco.UNID_EMPRESA);
                    modifiedCotizacion.IS_MODIFIED = false;
                    entity.SaveChanges();
                }
            }
        }
コード例 #11
0
            public static bool AgregarEmpresa(dbDataContext db, string nombre, string giro,
                                              string direccion, string municipio, string depto, string nit, string nrc,
                                              bool gran_contribuyente, bool credito, int credito_dias, string correo,
                                              string contacto_nombre, string contacto_nit, string contacto_correo,
                                              string contacto_telefono)
            {
                // Se instancia un objeto de la clase EMPRESA
                var reg = new EMPRESA
                {
                    ID_EMPRESA = ((long?)db.EMPRESAs.Select(c => (long?)c.ID_EMPRESA).Max() ?? 0) + 1,
                    // Para asignar un identificador a la empresa
                    NOMBRE             = nombre,
                    GIRO               = giro,
                    DIRECCION          = direccion,
                    MUNICIPIO          = municipio,
                    DEPARTAMENTO       = depto,
                    NIT                = nit,
                    NRC                = nrc,
                    GRAN_CONTRIBUYENTE = gran_contribuyente,
                    CREDITO            = credito,
                    CREDITO_DIAS       = credito_dias,
                    CORREO             = correo,
                    CONTACTO_NOMBRE    = contacto_nombre,
                    CONTACTO_TELEFONO  = contacto_telefono,
                    CONTACTO_NIT       = contacto_nit,
                    CONTACTO_CORREO    = contacto_correo
                };

                db.EMPRESAs.InsertOnSubmit(reg);

                db.SubmitChanges();

                return(true);
            }
コード例 #12
0
        public void insertElement(object element, USUARIO u)
        {
            if (element != null)
            {
                using (var entity = new TAE2Entities())
                {
                    EMPRESA empresa = (EMPRESA)element;

                    var validacion = (from cust in entity.EMPRESAs
                                      where cust.EMPRESA_NAME == empresa.EMPRESA_NAME
                                      select cust).ToList();

                    if (validacion.Count == 0)
                    {
                        empresa.UNID_EMPRESA = UNID.getNewUNID();
                        //Sync
                        empresa.IS_MODIFIED        = true;
                        empresa.LAST_MODIFIED_DATE = UNID.getNewUNID();
                        var modifiedSync = entity.SYNCs.First(p => p.UNID_SYNC == 20120101000000000);
                        modifiedSync.ACTUAL_DATE = UNID.getNewUNID();
                        entity.SaveChanges();
                        //
                        entity.EMPRESAs.AddObject(empresa);
                        entity.SaveChanges();

                        UNID.Master(empresa, u, -1, "Inserción");
                    }
                }
            }
        }
コード例 #13
0
        public void udpateElementSync(object element)
        {
            if (element != null)
            {
                using (var entity = new TAE2Entities())
                {
                    EMPRESA EEmp = (EMPRESA)element;

                    var query = from cust in entity.EMPRESAs
                                where cust.UNID_EMPRESA == EEmp.UNID_EMPRESA
                                select cust;

                    var Emp = query.First();

                    Emp.EMPRESA_NAME = EEmp.EMPRESA_NAME;
                    Emp.DIRECCION    = EEmp.DIRECCION;
                    Emp.RAZON_SOCIAL = EEmp.RAZON_SOCIAL;
                    Emp.RFC          = EEmp.RFC;
                    Emp.IS_ACTIVE    = EEmp.IS_ACTIVE;
                    //Sync
                    Emp.IS_MODIFIED        = true;
                    Emp.LAST_MODIFIED_DATE = UNID.getNewUNID();
                    var modifiedSync = entity.SYNCs.First(p => p.UNID_SYNC == 20120101000000000);
                    modifiedSync.ACTUAL_DATE = UNID.getNewUNID();
                    entity.SaveChanges();
                    //
                    entity.SaveChanges();
                }
            }
        }
コード例 #14
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            BancoDeDadosPadraoDataContext contexto = new BancoDeDadosPadraoDataContext();
            EMPRESA empresa = null;

            if (_idEmpresa == -1)
            {
                empresa = new EMPRESA();
                contexto.EMPRESAs.InsertOnSubmit(empresa);
            }
            else
            {
                empresa = (from emp in contexto.EMPRESAs
                           where emp.ID == _idEmpresa
                           select emp)
                          .FirstOrDefault();
            }

            empresa.NOMEFANTASIA = txtNomeFantasia.Text;
            empresa.RAZAOSOCIAL  = txtRazaoSocial.Text;
            empresa.CNPJ         = txtCNPJ.Text;
            empresa.ENDERECO     = txtEndereco.Text;
            empresa.BAIRRO       = txtBairro.Text;
            empresa.CIDADE       = txtCidade.Text;
            empresa.ESTADO       = txtEstado.Text;
            empresa.CEP          = txtCEP.Text;
            empresa.TELEFONE     = txtTelefone.Text;
            empresa.TELEFONE2    = txtTelefone2.Text;
            empresa.EMAIL        = txtEmail.Text;

            contexto.SubmitChanges();
        }
コード例 #15
0
 public ActionResult GetOnlyEmpresa(string Id)
 {
     try
     {
         EMPRESA em = new EMPRESA();
         if (!string.IsNullOrEmpty(Id))
         {
             using (UTNIMASEntities db = new UTNIMASEntities())
             {
                 em = db.EMPRESAS.Find(int.Parse(Id));
             }
             Empresaz e3 = new Empresaz
             {
                 DIRECCION_EMPRESA = em.DIRECCION_EMPRESA,
                 EMAIL_EMPRESA     = em.EMAIL_EMPRESA,
                 EMPRESA_ID        = em.EMPRESA_ID,
                 ID_CLIENTE        = em.ID_CLIENTE.ToString(),
                 NOMBRE_CONTACTO   = em.NOMBRE_CONTACTO,
                 NOMBRE_EMPRESA    = em.NOMBRE_EMPRESA,
                 SECTOR_PRODUCCION = em.SECTOR_PRODUCCION,
                 TELEF_CONTACTO    = em.TELEF_CONTACTO
             };
             return(Json(new { Success = true, data = e3, status = 200 }, JsonRequestBehavior.AllowGet));
         }
         return(Json(new { Success = true, data = "Error", status = 200 }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #16
0
        public ActionResult Login(string pass, string user)
        {
            if (user != null && pass != null)
            {
                bool result = USUARIO.isUser(user, pass);

                if (result)
                {
                    USUARIO usuario = USUARIO.getUsuario(user);

                    Session["id"]   = usuario.ID_EMPRESA;
                    Session["tipo"] = EMPRESA.getTipoEmpresa(usuario.ID_EMPRESA);

                    if (EMPRESA.getTipoEmpresa(usuario.ID_EMPRESA) == 0)
                    {
                        return(RedirectToAction("NaturalDetalle/" + Convert.ToString(Session["id"])));
                    }
                    else
                    {
                        return(RedirectToAction("JuridicaDetalle/" + Convert.ToString(Session["id"])));
                    }
                }
                else
                {
                    ViewBag.isValid = "El usuario no se encuentra activo en la base de datos del SIA";
                }
            }

            Session["id"]    = null;
            Session["tipo"]  = null;
            Session["Admon"] = null;

            return(View());
        }
コード例 #17
0
 public CatalogEmpresaModel(IDataMapper dataMapper)
 {
     this._dataMapper      = new EmpresaDataMapper();
     this._empresa         = new FixupCollection <DeleteEmpresa>();
     this._selectedEmpresa = new EMPRESA();
     //this._isChecked = false;
     this.loadEmpresa();
 }
コード例 #18
0
        public async Task <EMPRESA> Add(EMPRESA Elemnet)
        {
            await _solutionDBContext.EMPRESAS.AddAsync(Elemnet);

            await _solutionDBContext.SaveChangesAsync();

            return(Elemnet);
        }
コード例 #19
0
        public ActionResult DeleteConfirmed(int id)
        {
            EMPRESA eMPRESA = db.EMPRESA.Find(id);

            db.EMPRESA.Remove(eMPRESA);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #20
0
 public void AddEmpresa(EMPRESA emp)
 {
     using (EntitiesHostal con = new EntitiesHostal())
     {
         con.EMPRESA.Add(emp);
         con.SaveChanges();
     }
     btnIngresar.Visible = false;
 }
コード例 #21
0
 public static EmpresaModel Map(EMPRESA dto)
 {
     return(new EmpresaModel()
     {
         EmpresaID = dto.EmpresaID,
         EmpresaNombre = dto.EmpresaNombre,
         EmpresaEstado = dto.EmpresaEstado
     });
 }
コード例 #22
0
 public DeleteEmpresa(EMPRESA empresa)
 {
     this.UNID_EMPRESA = empresa.UNID_EMPRESA;
     this.DIRECCION    = empresa.DIRECCION;
     this.EMPRESA_NAME = empresa.EMPRESA_NAME;
     this.RAZON_SOCIAL = empresa.RAZON_SOCIAL;
     this.RFC          = empresa.RFC;
     this.IS_ACTIVE    = empresa.IS_ACTIVE;
     this.IsChecked    = false;
 }
コード例 #23
0
 public ActionResult Edit([Bind(Include = "ID_EMPRESA,ID_RUBRO,NOMBRE,ABOUT")] EMPRESA eMPRESA)
 {
     if (ModelState.IsValid)
     {
         db.Entry(eMPRESA).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ID_RUBRO = new SelectList(db.RUBRO, "ID_RUBRO", "DESCRIPCION", eMPRESA.ID_RUBRO);
     return(View(eMPRESA));
 }
コード例 #24
0
 public DeleteSolicitante(SOLICITANTE solicitante)
 {
     this.UNID_SOLICITANTE = solicitante.UNID_SOLICITANTE;
     this.SOLICITANTE_NAME = solicitante.SOLICITANTE_NAME;
     this.EMAIL            = solicitante.EMAIL;
     this.VALIDADOR        = solicitante.VALIDADOR;
     this._empresa         = solicitante.EMPRESA;
     this._departamento    = solicitante.DEPARTAMENTO;
     this.IS_ACTIVE        = solicitante.IS_ACTIVE;
     this.IsChecked        = false;
 }
コード例 #25
0
        public IHttpActionResult GetEMPRESA(decimal id)
        {
            EMPRESA eMPRESA = db.EMPRESAs.Find(id);

            if (eMPRESA == null)
            {
                return(NotFound());
            }

            return(Ok(eMPRESA));
        }
コード例 #26
0
 public ActionResult Edit([Bind(Include = "DIRECCION_DIR_ID,EMP_ID,EMP_NOMBRE,EMP_RUT")] EMPRESA eMPRESA)
 {
     if (ModelState.IsValid)
     {
         db.Entry(eMPRESA).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DIRECCION_DIR_ID = new SelectList(db.DIRECCION, "DIR_ID", "CALLE", eMPRESA.DIRECCION_DIR_ID);
     return(View(eMPRESA));
 }
コード例 #27
0
        public ActionResult JuridicaDetalle(int id)
        {
            if (EMPRESA.getTipoEmpresa(id) != 1)
            {
                return(RedirectToAction("Login"));
            }

            JURIDICA_DETALLE juridica = JURIDICA_DETALLE.getJuridicaDetalle(id);

            return(View(juridica));
        }
コード例 #28
0
        public async Task <ActionResult> CreateOrEdit(EMPRESA empresa)
        {
            if (string.IsNullOrEmpty(empresa.CNPJ))
            {
                ModelState.AddModelError("", "Informe um cnpj!");
            }

            if (string.IsNullOrEmpty(empresa.NOME))
            {
                ModelState.AddModelError("", "Informe um nome!");
            }

            if (ModelState.IsValid)
            {
                if (empresa.ID != 0)
                {
                    var emp = await _db.EMPRESA.Include(e => e.FAT_SERVICOS_PMSP)
                              .FirstOrDefaultAsync(e => e.ID == empresa.ID);

                    emp.FAT_SERVICOS_PMSP.Clear();

                    foreach (var fsp in empresa.FAT_SERVICOS_PMSP)
                    {
                        emp.FAT_SERVICOS_PMSP.Add(fsp);
                    }

                    await _db.SaveChangesAsync();
                }

                empresa.NOME = empresa
                               .NOME
                               .ToUpper();

                if (empresa.ID == 0)
                {
                    _db.EMPRESA.Add(empresa);
                }
                else
                {
                    _db.Entry(empresa)
                    .State = EntityState.Modified;
                }

                await _db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.SERVICOS = await _db
                               .FAT_SERVICOS_PMSP
                               .ToArrayAsync();

            return(View(empresa));
        }
コード例 #29
0
        public ActionResult NaturalDetalle(int id)
        {
            if (EMPRESA.getTipoEmpresa(id) != 0)
            {
                return(RedirectToAction("Login"));
            }

            NATURAL_DETALLE nd = NATURAL_DETALLE.getNaturalDetalle(id);

            return(View(nd));
        }
コード例 #30
0
        public async Task <EMPRESA> Update(int id, EMPRESA element)
        {
            var entity = await Get(id);

            entity.EmpresaNombre = element.EmpresaNombre;

            _solutionDBContext.EMPRESAS.Update(entity);
            await _solutionDBContext.SaveChangesAsync();

            return(entity);
        }
コード例 #31
0
 public ActionResult Edit([Bind(Include = "RUT_EMPRESA_PROV,ID_PAIS,NOMBRE_EMPRESA,RAZON_SOCIAL_EMPRESA,DIRECCION_EMPRSA")] EMPRESA eMPRESA)
 {
     if (ModelState.IsValid)
     {
         db.Entry(eMPRESA).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ID_PAIS = new SelectList(db.PAISES, "ID_PAIS", "NOM_PAIS", eMPRESA.ID_PAIS);
     return(View(eMPRESA));
 }
コード例 #32
0
ファイル: DataClasses.designer.cs プロジェクト: prasist/wb20
 partial void InsertEMPRESA(EMPRESA instance);
コード例 #33
0
ファイル: Ausencia.cs プロジェクト: LazyAbstract/AReportes
        public Ausencia(AufenPortalReportesDataContext db, EMPRESA empresa, vw_Ubicacione departamento, DateTime FechaDesde, DateTime FechaHasta, string path, string rut)
        {
            //Nombre del archivo y ubiación en el árbol de carpetas
            NombreArchivo = String.Format("{0}/{1}/PersonalAusente.pdf", empresa.Descripcion, departamento.Descripcion);
            // Vamos a buscar los datos que nos permitirtán armar elreporte
            IEnumerable<sp_LibroInasistenciaResult> resultado = db.sp_LibroInasistencia(
                FechaDesde.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture)
                , FechaHasta.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture)
                , int.Parse(empresa.Codigo).ToString()
                , departamento.Codigo
                , rut).OrderBy(x => x.Fecha).ToList();
            IEnumerable<LibroInasistenciaDTO> inasistencias =
                Mapper.Map<IEnumerable<sp_LibroInasistenciaResult>, IEnumerable<LibroInasistenciaDTO>>(resultado);
            if (inasistencias.Any())
            {
                Configuracion();
                Document doc = new Document(iTextSharp.text.PageSize.LETTER, 10, 10, 50, 35);
                using (var ms = new MemoryStream())
                {
                    PdfWriter pdfWriter = PdfWriter.GetInstance(doc, ms);
                    pdfWriter.PageEvent = new Header(empresa, path);
                    doc.Open();
                    foreach (var reporte in inasistencias.Where(x=>x.Rut!=null).GroupBy(x => new { x.Rut, x.IdDepartamento, x.IdEmpresa }).Take(3))
                    {
                        doc.AddAuthor("Aufen");
                        doc.AddCreationDate();
                        doc.AddCreator("Aufen");
                        doc.AddTitle("Informe de Personal Ausente (sin marcas)");

                        Paragraph parrafo = new Paragraph();

                        parrafo.Add(new Paragraph("Informe de Personal Ausente (sin marcas)", Titulo) { Alignment = Element.ALIGN_CENTER });
                        parrafo.Add(new Paragraph(String.Format("Período: {0} a {1}", FechaDesde.ToShortDateString(), FechaHasta.ToShortDateString()), Normal) { Alignment = Element.ALIGN_CENTER });
                        parrafo.Add(new Paragraph("Centro de Costos:", Normal));

                        doc.Add(parrafo);
                        doc.Add(new Phrase());

                        PdfPTable tabla = new PdfPTable(new float[] {2, 2, 2, 2, 1, 1, 4 });
                        // Encabezado
                        tabla.AddCell(new PdfPCell(new Phrase("Empleado", Normal)) { Colspan = 4});
                        tabla.AddCell(new PdfPCell(new Phrase("Horario", Normal)) { Colspan = 2 });
                        tabla.AddCell(new PdfPCell(new Phrase("Autorizaciones", Normal)));

                        // 2 encabezado
                        tabla.AddCell(new PdfPCell(new Phrase("Fecha", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("Rut", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("Apellidos", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("Nombres", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("Ing.", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("Sal.", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("Autorizaciones", Chico)));

                        var empleado = db.vw_Empleados.FirstOrDefault(x => x.IdEmpresa == empresa.Codigo &&
                            x.IdUbicacion == reporte.Key.IdDepartamento &&  x.Codigo == reporte.Key.Rut);
                        foreach(var ausencia in reporte)
                        {
                            //Fecha
                            tabla.AddCell(new PdfPCell(new Phrase(ausencia.Fecha.HasValue ? ausencia.Fecha.Value.ToString("ddd dd/MM") : String.Empty, Chico)));
                            //Código
                            tabla.AddCell(new PdfPCell(new Phrase(empleado.RutAufen, Chico)));
                            //Apellidos
                            tabla.AddCell(new PdfPCell(new Phrase((ausencia.Apellidos ?? string.Empty).Trim(), Chico)));
                            //Nombres
                            tabla.AddCell(new PdfPCell(new Phrase((ausencia.Nombres ?? string.Empty).Trim(), Chico)));
                            //Ing.
                            tabla.AddCell(new PdfPCell(new Phrase(ausencia.EntradaTeorica.HasValue ? ausencia.EntradaTeorica.Value.ToString("HH:mm") : String.Empty, Chico)));
                            //Sal.
                            tabla.AddCell(new PdfPCell(new Phrase(ausencia.SalidaTeorica.HasValue ? ausencia.SalidaTeorica.Value.ToString("HH:mm") : String.Empty, Chico)));
                            //Autorizaciones
                            tabla.AddCell(new PdfPCell(new Phrase(ausencia.Observacion, Chico)));
                        }
                        doc.Add(tabla);
                        doc.NewPage();
                    }
                    doc.Close();
                    _Archivo = ms.ToArray();
                }
            }
        }
コード例 #34
0
        public LibroAtrasos(AufenPortalReportesDataContext db, EMPRESA empresa, vw_Ubicacione departamento, DateTime FechaDesde, DateTime FechaHasta, string path, string rut)
        {
            //Nombre del archivo y ubiación en el árbol de carpetas
            NombreArchivo = String.Format("{0}/{1}/LibroAtrasos.pdf", empresa.Descripcion, departamento.Descripcion);
            // Vamos a buscar los datos que nos permitirtán armar elreporte
            IEnumerable<sp_LibroAsistenciaResult> resultadoLibroAtrasos =
                                           db.sp_LibroAsistencia(
                                           FechaDesde.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture),
                                           FechaHasta.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture),
                                           int.Parse(empresa.Codigo).ToString(),
                                           departamento.Codigo,
                                           rut).ToList();
            IEnumerable<LibroAsistenciaDTO> libroAtrasos = Mapper.Map<IEnumerable<sp_LibroAsistenciaResult>,
                IEnumerable<LibroAsistenciaDTO>>(resultadoLibroAtrasos)
            .Where(x =>x.Entrada.HasValue && x.Salida.HasValue && x.SalidaTeorica.HasValue && x.EntradaTeorica.HasValue &&
                x.Entrada > x.EntradaTeorica);
            // Comenzaremos a crear el reporte
            if (libroAtrasos.Any())
            {
                Configuracion();
                Document doc = new Document(iTextSharp.text.PageSize.LETTER, 10, 10, 50, 35);
                using (var ms = new MemoryStream())
                {
                    PdfWriter pdfWriter = PdfWriter.GetInstance(doc, ms);
                    pdfWriter.PageEvent = new Header(empresa, path);
                    doc.Open();
                    foreach (var reporte in libroAtrasos.GroupBy(x => new { x.Rut, x.IdDepartamento, x.IdEmpresa }))
                    {
                        var empleado = db.vw_Empleados.FirstOrDefault(x => x.IdEmpresa == empresa.Codigo &&
                            x.IdUbicacion == reporte.Key.IdDepartamento &&
                                  x.Codigo == reporte.Key.Rut);
                        if (empleado == null)
                        {
                            empleado = new vw_Empleado();
                        }

                        doc.AddAuthor("Aufen");
                        doc.AddCreationDate();
                        doc.AddCreator("Aufen");
                        doc.AddTitle("Libro de Atrasos");
                        // Texto
                        Paragraph parrafo = new Paragraph();
                        parrafo.Add(new Paragraph(
                            String.Format("Departamento: {1}, Fecha de Reporte: {0}",
                            DateTime.Now.ToShortDateString(),
                            departamento.SucursalPlanta), Normal) { Alignment = Element.ALIGN_CENTER });
                        parrafo.Add(new Paragraph("Informe de Atrasos por Área", Titulo) { Alignment = Element.ALIGN_CENTER });
                        doc.Add(parrafo);
                        doc.Add(new Phrase());
                        doc.Add(new Phrase());

                        PdfPTable informacionPersonal = new PdfPTable(new float[] { 1,5});
                        informacionPersonal.AddCell(new PdfPCell(new Phrase("Rut:", Normal)));
                        informacionPersonal.AddCell(new PdfPCell(new Phrase(empleado.RutAufen, NormalNegrita)));
                        informacionPersonal.AddCell(new PdfPCell(new Phrase("Nombre:", Normal)));
                        informacionPersonal.AddCell(new PdfPCell(new Phrase(empleado.NombreCompleto, NormalNegrita)));
                        informacionPersonal.AddCell(new PdfPCell(new Phrase("Centro de Costos:", Normal)));
                        informacionPersonal.AddCell(new PdfPCell(new Phrase(String.Empty, NormalNegrita)));
                        doc.Add(new Phrase());

                        doc.Add(informacionPersonal);
                        // tabla
                        PdfPTable tabla = new PdfPTable(new float[] {2, 2, 2, 2, 2, 2, 2, 4 });
                        // Primera lìnea cabecera
                        tabla.AddCell(new PdfPCell(new Phrase("Fecha", Chico)) { Rowspan = 2 });
                        //tabla.AddCell(new PdfPCell(new Phrase("Empleado", Chico)) { Colspan = 3 });
                        tabla.AddCell(new PdfPCell(new Phrase("Horario", Chico)) { Colspan = 2 });
                        tabla.AddCell(new PdfPCell(new Phrase("Marcas", Chico)) { Colspan = 2 });
                        tabla.AddCell(new PdfPCell(new Phrase("Horas Trabajadas", Chico)) { Colspan = 2 });
                        tabla.AddCell(new PdfPCell(new Phrase("Autorizaciones", Chico)));
                        // Segunda lìnea cabecera
                        //tabla.AddCell(new PdfPCell(new Phrase("Rut", Chico)));
                        //tabla.AddCell(new PdfPCell(new Phrase("Apellidos", Chico)));
                        //tabla.AddCell(new PdfPCell(new Phrase("Nombres", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("Ing.", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("Sal.", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("Ing.", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("Sal.", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("Atrasos", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("H.T.N.", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("Permisos", Chico)));

                        foreach (var atraso in reporte)
                        {
                            TimeSpan tiempoAtraso =
                                (atraso.Salida.HasValue && atraso.Entrada.HasValue ? atraso.Salida.Value.Subtract(atraso.Entrada.Value) : new TimeSpan(0)) -
                                (atraso.SalidaTeorica.HasValue && atraso.EntradaTeorica.HasValue ? atraso.SalidaTeorica.Value.Subtract(atraso.EntradaTeorica.Value) : new TimeSpan(0));
                            TimeSpan tiempoNormal = atraso.SalidaTeorica.HasValue && atraso.EntradaTeorica.HasValue ? atraso.SalidaTeorica.Value.Subtract(atraso.EntradaTeorica.Value) : new TimeSpan(0);
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.Fecha.Value.ToString("ddd dd/MM"), Chico)) { HorizontalAlignment = Element.ALIGN_LEFT });
                            //tabla.AddCell(new PdfPCell(new Phrase(atraso.Rut.ToStringConGuion(), Chico)));
                            //tabla.AddCell(new PdfPCell(new Phrase(atraso.Apellidos, Chico)));
                            //tabla.AddCell(new PdfPCell(new Phrase(atraso.Nombres, Chico)));
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.Entrada.HasValue ? atraso.Entrada.Value.ToString("HH:mm") : String.Empty, Chico)));
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.Salida.HasValue ? atraso.Salida.Value.ToString("HH:mm") : String.Empty, Chico)));
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.EntradaTeorica.HasValue ? atraso.EntradaTeorica.Value.ToString("HH:mm") : String.Empty, Chico)));
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.SalidaTeorica.HasValue ? atraso.SalidaTeorica.Value.ToString("HH:mm") : String.Empty, Chico)));
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.printAtraso, Chico)));
                            tabla.AddCell(new PdfPCell(new Phrase("", Chico)));
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.Observacion, Chico)));
                        }
                        tabla.AddCell(new PdfPCell(new Phrase("Total", ChicoNegrita)) { Colspan=5 });
                        //TODO: aqí va la suma de astrasos
                        tabla.AddCell(new PdfPCell(new Phrase(reporte.CalculaAtrasoEntrada(), Chico)));
                        //TODO: aqí va la suma de H.T.N.
                        tabla.AddCell(new PdfPCell(new Phrase("", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("", Chico)));
                        doc.Add(tabla);
                        doc.NewPage();
                    }
                    doc.Close();
                    _Archivo = ms.ToArray();
                }
            }
        }
コード例 #35
0
ファイル: DataClasses.designer.cs プロジェクト: prasist/wb20
 partial void UpdateEMPRESA(EMPRESA instance);
コード例 #36
0
        public AsistenciaLegal(AufenPortalReportesDataContext db, EMPRESA empresa, vw_Ubicacione departamento, DateTime FechaDesde, DateTime FechaHasta, string path, string rut)
        {
            // Vamos a buscar los datos que nos permitirtán armar elreporte
            NombreArchivo = String.Format("{0}/{1}/LibroAtrasos.pdf", empresa.Descripcion, departamento.Descripcion);
            //Resultado de marcas
             IEnumerable<sp_LibroAsistenciaResult> resultadoLibroAtrasos =
                                           db.sp_LibroAsistencia(
                                           FechaDesde.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture),
                                           FechaHasta.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture),
                                           int.Parse(empresa.Codigo).ToString(),
                                           departamento.Codigo,
                                           rut).ToList();
             IEnumerable<LibroAsistenciaDTO> resultado = Mapper.Map<IEnumerable<sp_LibroAsistenciaResult>,
             IEnumerable<LibroAsistenciaDTO>>(resultadoLibroAtrasos);
            // Resumen de inasistencias
             IEnumerable<sp_LibroInasistenciaResult> resultadoLibroInasistencias =
                 db.sp_LibroInasistencia(FechaDesde.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture)
                    , FechaHasta.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture)
                    , int.Parse(empresa.Codigo).ToString()
                    , departamento.Codigo
                    , rut);

            IEnumerable<LibroInasistenciaDTO> resultadoInasistencia = Mapper.Map<IEnumerable<sp_LibroInasistenciaResult>,
                 IEnumerable<LibroInasistenciaDTO>>(resultadoLibroInasistencias);
             if (resultadoLibroAtrasos.Any())
             {
                 string[] diasSemana = new[] { "dom", "lun", "mar", "mie", "ju", "vie", "sab" };
                 using (MemoryStream finalStream = new MemoryStream())
                 {
                     PdfCopyFields copy = new PdfCopyFields(finalStream);
                     foreach (var reporte in resultado.Where(x => x.Rut != null).GroupBy(x => new
                     {
                         x.Rut,
                         x.IdEmpresa,
                         x.IdDepartamento,
                         Mes = x.Fecha.Value.Month,
                         Anio = x.Fecha.Value.Year
                     }))
                     {
                         var inasistencias = resultadoInasistencia.Where(x => x.Rut!= null &&
                             x.Rut == reporte.Key.Rut &&
                             x.IdEmpresa == reporte.Key.IdEmpresa &&
                             x.IdDepartamento == reporte.Key.IdDepartamento &&
                            reporte.Key.Mes == x.Fecha.Value.Month &&
                            reporte.Key.Anio == x.Fecha.Value.Year);
                         var empleado = db.vw_Empleados.FirstOrDefault(x => x.IdEmpresa == empresa.Codigo &&
                             x.IdUbicacion == reporte.Key.IdDepartamento &&
                                  x.Codigo == reporte.Key.Rut);
                         int numeroSemanas = reporte.Max(x => x.NumSemana) == 6 ? 6 : 5;
                         using (MemoryStream ms = new MemoryStream())
                         {
                             using (PdfReader pdfReader = new PdfReader(path + String.Format(@"\ReporteAsistenciaLegal{0}.pdf",  numeroSemanas)))
                             {
                                 DateTime fechaReferencia = reporte.First().Fecha.Value;
                                 DateTime primerDiaMes = new DateTime(fechaReferencia.Year, fechaReferencia.Month, 1);
                                 DateTime ultimoDiaMes = primerDiaMes.AddMonths(1).AddSeconds(-1);
                                 PdfStamper pdfStamper = new PdfStamper(pdfReader, ms);

                                 int PageCount = pdfReader.NumberOfPages;
                                 for (int x = 1; x <= PageCount; x++)
                                 {
                                     PdfContentByte cb = pdfStamper.GetOverContent(x);
                                     Image imagen = Image.GetInstance(String.Format(@"{0}\imagenes\LogosEmpresas\logo{1}.jpg", path, empresa.Codigo.Trim()));
                                     imagen.ScaleToFit(100, 200);
                                     imagen.SetAbsolutePosition(450, 750);
                                     cb.AddImage(imagen);
                                 }

                                 pdfStamper.AcroFields.SetField("Mes", new DateTime(reporte.Key.Anio, reporte.Key.Mes, 1).ToString("yyyy MMM"));
                                 pdfStamper.AcroFields.SetField("Nombre", empleado != null ? empleado.NombreCompleto : String.Empty);
                                 pdfStamper.AcroFields.SetField("Rut", empleado.RutAufen);
                                 pdfStamper.AcroFields.SetField("Departamento", String.Format("{0} ({1})", departamento!= null ? departamento.SucursalPlanta : String.Empty, empresa!=null ? empresa.Descripcion.Trim() : String.Empty));
                                 pdfStamper.AcroFields.SetField("Fecha", String.Format("{0} - {1}", primerDiaMes.ToShortDateString(), ultimoDiaMes.ToShortDateString()));
                                 pdfStamper.AcroFields.SetField("ImpresoPagina1", DateTime.Now.ToShortDateString());
                                 pdfStamper.AcroFields.SetField("ImpresoPagina2", DateTime.Now.ToShortDateString());
                                 pdfStamper.AcroFields.SetField("UsuarioPagina1", "");
                                 pdfStamper.AcroFields.SetField("UsuarioPagina2", "");
                                 //Para todas las semanas
                                 for (int i = 1; i <=  numeroSemanas; i++)
                                 {
                                     //Para todos los días de la semana
                                     var semana = reporte.Where(x => x.NumSemana == i);
                                     for (int j = 0; j <= 6; j++)
                                     {
                                        // Si se elimina esto el domingo va aquedar al final
                                        int correccionDia = j;//j == 6 ? 0 : j + 1;
                                         var dia = reporte.FirstOrDefault(x => x.NumSemana == i && (int)x.Fecha.Value.DayOfWeek == j);
                                         //
                                         pdfStamper.AcroFields.SetField(String.Format("Semana{0}Tipo{1}", i, correccionDia),
                                             String.Format("{0}\n{1}",
                                                String.Format("{0}-{1}", dia!= null && dia.Entrada.HasValue ? dia.Entrada.Value.ToString("HH:mm") : String.Empty
                                                    , dia!=null && dia.Salida.HasValue ? dia.Salida.Value.ToString("HH:mm") : String.Empty),
                                                dia != null ? dia.Observacion : String.Empty));
                                        pdfStamper.AcroFields.SetField(String.Format("Semana{0}Dia{1}", i, correccionDia), String.Format("{0} {1}", dia != null ? dia.Fecha.Value.ToString("dd/MM") : string.Empty, diasSemana[j]));
                                     }
                                     // Semana a semana
                                     pdfStamper.AcroFields.SetField(String.Format("Semana{0}Jornada", i), semana.CalculaJornada());
                                     pdfStamper.AcroFields.SetField(String.Format("Semana{0}Asistencia", i), semana.CalculaAsistencia());

                                     //  T. de Salida = inasistencia justifica
                                     pdfStamper.AcroFields.SetField(String.Format("Semana{0}Salidas", i), semana.CalculaInasistenciaJustificadaLegal());

                                     //  T. de Ausencia = inasistencia INjustificada
                                     //var inasistenciaSemanal = inasistencias.Where(x => x.Fecha.HasValue && x.Fecha.Value.Day >= (i - 1) * 7 && x.Fecha.Value.Day <= i * 7);
                                     pdfStamper.AcroFields.SetField(String.Format("Semana{0}Ausencias", i), semana.CalculaInasistenciaInjustificadaLegal());
                                     pdfStamper.AcroFields.SetField(String.Format("Semana{0}AtrasosSalidas", i), semana.CalculaAtrasoSalida());
                                     pdfStamper.AcroFields.SetField(String.Format("Semana{0}NumeroAtrasos", i), semana.CalculaDiasAtraso());
                                     pdfStamper.AcroFields.SetField(String.Format("Semana{0}NumeroSalidas", i), semana.CalculaDiasSalidaAdelantada());
                                     pdfStamper.AcroFields.SetField(String.Format("Semana{0}ExtraConTurno", i), semana.CalculaHorasExtra());
                                     //pdfStamper.AcroFields.SetField(String.Format("Semana{0}ExtraSinTurno", i), "");
                                 }
                                 // Resumen de todas las semanas
                                 pdfStamper.AcroFields.SetField("ResumenJornada", reporte.CalculaJornada());
                                 pdfStamper.AcroFields.SetField("ResumenAsistencia", reporte.CalculaAsistencia());
                                 pdfStamper.AcroFields.SetField("ResumenSalidas", reporte.CalculaInasistenciaJustificadaLegal());
                                 pdfStamper.AcroFields.SetField("ResumenAusencias", reporte.CalculaInasistenciaInjustificadaLegal());
                                 pdfStamper.AcroFields.SetField("ResumenAtrasosSalidas", reporte.CalculaAtrasoEntrada());
                                 pdfStamper.AcroFields.SetField("ResumenNumeroAtrasos", reporte.CalculaDiasAtraso());
                                 pdfStamper.AcroFields.SetField("ResumenNumeroSalidas", reporte.CalculaDiasSalidaAdelantada());
                                 pdfStamper.AcroFields.SetField("ResumenExtraConTurno", reporte.CalculaHorasExtra());
                                 //pdfStamper.AcroFields.SetField("ResumenExtraSinTurno", "");
                                 pdfStamper.Writer.CloseStream = false;
                                 pdfStamper.FormFlattening = true;
                                 pdfStamper.Close();
                                 ms.Position = 0;
                                 copy.AddDocument(new PdfReader(ms));
                                 ms.Dispose();
                             }
                         }
                     }
                     copy.Close();
                     _Archivo = finalStream.ToArray();
                 }
             }
        }
コード例 #37
0
ファイル: DataClasses.designer.cs プロジェクト: prasist/wb20
 partial void DeleteEMPRESA(EMPRESA instance);
コード例 #38
0
        public LibroSobreTiempo(AufenPortalReportesDataContext db, EMPRESA empresa, vw_Ubicacione departamento, DateTime FechaDesde, DateTime FechaHasta, string path, string rut)
        {
            // Nombre del archivo y ubiación en el árbol de carpetas
            NombreArchivo = String.Format("{0}/{1}/SobreTiempos.pdf", empresa.Descripcion, departamento.Descripcion);
            // Vamos a buscar los datos que nos permitirtán armar elreporte
            IEnumerable<sp_LibroAsistenciaResult> resultadolibroSobretiempo =
                                           db.sp_LibroAsistencia(
                                           FechaDesde.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture),
                                           FechaHasta.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture),
                                           int.Parse(empresa.Codigo).ToString(),
                                           departamento.Codigo,
                                           rut).ToList();
            IEnumerable<LibroAsistenciaDTO> libroSobretiempo = Mapper.Map<IEnumerable<sp_LibroAsistenciaResult>,
                IEnumerable<LibroAsistenciaDTO>>(resultadolibroSobretiempo);
            // Filtramos los casos que nos interesan
            libroSobretiempo = libroSobretiempo
                .Where(x => (x.Entrada.HasValue && x.EntradaTeorica.HasValue && x.Entrada < x.EntradaTeorica) ||
                    (x.Salida.HasValue && x.SalidaTeorica.HasValue && x.Salida > x.SalidaTeorica));

            if (libroSobretiempo.Any())
            {
                Configuracion();
                Document doc = new Document(iTextSharp.text.PageSize.LETTER, 10, 10, 50, 35);
                using (var ms = new MemoryStream())
                {
                    PdfWriter pdfWriter = PdfWriter.GetInstance(doc, ms);
                    pdfWriter.PageEvent = new Header(empresa, path);
                    doc.Open();
                    foreach (var reporte in libroSobretiempo.Where(x => x.Rut != null)
                        .GroupBy(x => new { x.Rut, x.IdDepartamento, x.IdEmpresa }))
                    {
                        var empleado = db.vw_Empleados.FirstOrDefault(x => x.IdEmpresa == empresa.Codigo &&
                            x.IdUbicacion == reporte.Key.IdDepartamento && x.Codigo == reporte.Key.Rut);
                        if (empleado == null)
                        {
                            empleado = new vw_Empleado();
                        }
                        doc.AddAuthor("Aufen");
                        doc.AddCreationDate();
                        doc.AddCreator("Aufen");
                        doc.AddTitle("Libro de Asistencia Personal - Sobretiempos");

                        // Agregamos el título y la bajada del reporte
                        Paragraph parrafo = new Paragraph();
                        parrafo.Add(new Paragraph("Libro de Asistencia Personal", Titulo) { Alignment = Element.ALIGN_CENTER });
                        parrafo.Add(new Paragraph("Sobretiempos", Titulo) { Alignment = Element.ALIGN_CENTER });
                        doc.Add(parrafo);
                        doc.Add(new Phrase());

                        PdfPTable tablaEncabezado = new PdfPTable(new float[] { 1, 5, 1, 5 });

                        tablaEncabezado.AddCell(new PdfPCell(new Phrase("Nombre:", Chico)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase(empleado.NombreCompleto, Normal)) { Border = Rectangle.NO_BORDER, Colspan = 3 });
                        //tablaEncabezado.AddCell(new PdfPCell(new Phrase("Código:", Chico)) { Border = Rectangle.NO_BORDER });
                        //tablaEncabezado.AddCell(new PdfPCell(new Phrase(empleado.Codigo, Normal)) { Border = Rectangle.NO_BORDER });

                        tablaEncabezado.AddCell(new PdfPCell(new Phrase("Empresa:", Chico)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase((empresa.Descripcion ?? String.Empty).Trim(), Normal)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase("Rut:", Chico)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase(empleado.RutAufen, Normal)) { Border = Rectangle.NO_BORDER });

                        tablaEncabezado.AddCell(new PdfPCell(new Phrase("Sucursal o Planta:", Chico)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase(empleado.SucursalPlanta, Normal)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase("Cargo:", Chico)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase(String.Empty, Normal)) { Border = Rectangle.NO_BORDER });

                        tablaEncabezado.AddCell(new PdfPCell(new Phrase("Centro de Costo:", Chico)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase(String.Empty, Normal)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase(String.Empty, Normal)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase(String.Empty, Normal)) { Border = Rectangle.NO_BORDER });

                        tablaEncabezado.AddCell(new PdfPCell(new Phrase(String.Format("PERIODO: {0} a {1}", FechaDesde.ToShortDateString(), FechaHasta.ToShortDateString()), Normal)) { Colspan = 4, Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(GetNomenclatura()) { Colspan = 4 });
                        doc.Add(tablaEncabezado);
                        doc.Add(new Phrase());
                        // tabla
                        PdfPTable tabla = new PdfPTable(new float[] { 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4 });
                        tabla.AddCell(new PdfPCell(new Phrase("Fecha", Chico)) { BorderWidthRight = 0.7f });
                        tabla.AddCell(new PdfPCell(new Phrase("HI", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("HS", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("HCol", Chico)) { BorderWidthRight = 0.7f});
                        tabla.AddCell(new PdfPCell(new Phrase("MI", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("MS", Chico)) { BorderWidthRight = 0.7f });
                        tabla.AddCell(new PdfPCell(new Phrase("HTH", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("HTN", Chico)) { BorderWidthRight = 0.7f });
                        tabla.AddCell(new PdfPCell(new Phrase("SIn", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("SSa", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("PT", Chico)) { BorderWidthRight = 0.7f });
                        tabla.AddCell(new PdfPCell(new Phrase("Cantidad", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("Motivo", Chico)) { BorderWidthRight = 0.7f });
                        // Filas con datos
                        foreach (var sobretiempo in reporte)
                        {
                            //Fecha
                            tabla.AddCell(new PdfPCell(new Phrase(sobretiempo.Fecha.Value.ToString("ddd dd/MM"), Chico)) { BorderWidthRight = 0.7f });
                            //Hora Ingreso
                            tabla.AddCell(new PdfPCell(new Phrase(sobretiempo.EntradaTeorica.GetValueOrDefault(new DateTime()).ToString("HH:mm"), Chico)));
                            //Hora Salida
                            tabla.AddCell(new PdfPCell(new Phrase(sobretiempo.SalidaTeorica.GetValueOrDefault(new DateTime()).ToString("HH:mm"), Chico)));
                            //Hora C0lación
                            tabla.AddCell(new PdfPCell(new Phrase(new DateTime(sobretiempo.TiempoColacion.GetValueOrDefault(new TimeSpan()).Ticks).ToString("HH:mm"), Chico)) { BorderWidthRight = 0.7f });
                            //Marca Ingreso
                            tabla.AddCell(new PdfPCell(new Phrase(sobretiempo.Entrada.GetValueOrDefault(new DateTime()).ToString("HH:mm"), Chico)));
                            //Marca Salida
                            tabla.AddCell(new PdfPCell(new Phrase(sobretiempo.Salida.GetValueOrDefault(new DateTime()).ToString("HH:mm"), Chico)) { BorderWidthRight = 0.7f });
                            //Hora pactada por horario
                            tabla.AddCell(new PdfPCell(new Phrase(sobretiempo.printHorasPactadas, Chico)));
                            //horas realizadas
                            tabla.AddCell(new PdfPCell(new Phrase(sobretiempo.printHorasReales, Chico)) { BorderWidthRight = 0.7f });
                            //Sobrante Ingreso
                            tabla.AddCell(new PdfPCell(new Phrase(sobretiempo.printSobreEntrada, Chico)));
                            //Sobrante Salida
                            tabla.AddCell(new PdfPCell(new Phrase(sobretiempo.printSobreSalida, Chico)));
                            //P.Todo
                            tabla.AddCell(new PdfPCell(new Phrase(sobretiempo.printSobreTiempo, Chico)) { BorderWidthRight = 0.7f });
                            //Cantidad
                            tabla.AddCell(new PdfPCell(new Phrase("", Chico)));
                            //Motivo
                            tabla.AddCell(new PdfPCell(new Phrase(sobretiempo.Observacion, Chico)) { BorderWidthRight = 0.7f });
                        }

                        tabla.AddCell(new PdfPCell(new Phrase(" ", Chico)) { Colspan = 1 , Border = Rectangle.NO_BORDER});
                        tabla.AddCell(new PdfPCell(new Phrase(" ", Chico)) { Colspan = 7, Border = Rectangle.TOP_BORDER, BorderWidthRight = 0.1f });
                        // Total SobreSalida
                        tabla.AddCell(new PdfPCell(new Phrase(reporte.CalculaSobreEntrada(), Chico)) { Colspan = 1, BorderWidthRight = 0.1f });
                        // Total Sobre Entrada
                        tabla.AddCell(new PdfPCell(new Phrase(reporte.CalculaSobreSalida(), Chico)) { Colspan = 1 });
                        // Total Horas Extra
                        tabla.AddCell(new PdfPCell(new Phrase(reporte.CalculaSobreTiempo(), Chico)) { Colspan = 1, BorderWidthRight = 0.7f });

                        tabla.AddCell(new PdfPCell(new Phrase(" ", Normal)) { Colspan = 2, Border = Rectangle.TOP_BORDER, BorderWidthRight = 0.7f });
                        tabla.AddCell(new PdfPCell(new Phrase(" ", Normal)) { Colspan = 13, Border = Rectangle.NO_BORDER});
                        tabla.AddCell(new PdfPCell(GetFirma()) { Colspan = 13 });
                        doc.Add(tabla);

                        doc.NewPage();
                    }
                    doc.Close();
                    _Archivo = ms.ToArray();
                }
            }
        }
コード例 #39
0
        public AsistenciaPersonal(AufenPortalReportesDataContext db, EMPRESA empresa, vw_Ubicacione departamento, DateTime FechaDesde, DateTime FechaHasta, string path, string rut)
        {
            //Nombre del archivo y ubiación en el árbol de carpetas
            NombreArchivo = String.Format("{0}/{1}/AsistenciaPersonal.pdf", empresa.Descripcion, departamento.Descripcion);
            // Vamos a buscar los datos que nos permitirtán armar elreporte
            IEnumerable<sp_LibroAsistenciaResult> resultado =
                                           db.sp_LibroAsistencia(
                                           FechaDesde.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture),
                                           FechaHasta.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture),
                                           int.Parse(empresa.Codigo).ToString(),
                                           departamento.Codigo,
                                           rut).ToList();
            IEnumerable<LibroAsistenciaDTO> libroAsistencia = Mapper.Map<IEnumerable<sp_LibroAsistenciaResult>,
                IEnumerable<LibroAsistenciaDTO>>(resultado);
            if (libroAsistencia.Any())
            {
                Configuracion();
                Document doc = new Document(iTextSharp.text.PageSize.LETTER, 10, 10, 50, 35);
                using (var ms = new MemoryStream())
                {
                    PdfWriter pdfWriter = PdfWriter.GetInstance(doc, ms);
                    pdfWriter.PageEvent = new Header(empresa, path);
                    doc.Open();
                    foreach (var reporte in libroAsistencia.Where(x => x.Rut != null).GroupBy(x => new { x.Rut, x.IdDepartamento, x.IdEmpresa }))
                    {

                        var empleado = db.vw_Empleados.FirstOrDefault(x => x.IdEmpresa == empresa.Codigo &&
                            x.IdUbicacion == reporte.Key.IdDepartamento && x.Codigo == reporte.Key.Rut);
                        if (empleado == null)
                        {
                            empleado = new vw_Empleado();
                        }
                        doc.AddAuthor("Aufen");
                        doc.AddCreationDate();
                        doc.AddCreator("Aufen");
                        doc.AddTitle("Libro de Asistencia Personal");

                        Paragraph parrafo = new Paragraph();
                        parrafo.Add(new Paragraph("Asistencia Personal", Titulo) { Alignment = Element.ALIGN_CENTER });
                        doc.Add(parrafo);
                        // Texto
                        PdfPTable tablaEncabezado = new PdfPTable(new float[] { 1, 5, 1, 5 });

                        tablaEncabezado.AddCell(new PdfPCell(new Phrase("Nombre:", Chico)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase(empleado.NombreCompleto, Normal)) { Border = Rectangle.NO_BORDER, Colspan=3 });

                        tablaEncabezado.AddCell(new PdfPCell(new Phrase("Empresa:", Chico)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase(empresa != null ? empresa.Descripcion.Trim() : String.Empty, Normal)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase("Rut:", Chico)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase(empleado.RutAufen, Normal)) { Border = Rectangle.NO_BORDER });

                        tablaEncabezado.AddCell(new PdfPCell(new Phrase("Sucursal o Planta:", Chico)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase(empleado.SucursalPlanta, Normal)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase("Cargo:", Chico)) { Border = Rectangle.NO_BORDER });
                        //tablaEncabezado.AddCell(new PdfPCell(new Phrase(empleado.Cargo, Normal)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase(String.Empty, Normal)) { Border = Rectangle.NO_BORDER });

                        tablaEncabezado.AddCell(new PdfPCell(new Phrase("Centro de Costo:", Chico)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase(String.Empty, Normal)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase(String.Empty, Normal)) { Border = Rectangle.NO_BORDER });
                        tablaEncabezado.AddCell(new PdfPCell(new Phrase(String.Empty, Normal)) { Border = Rectangle.NO_BORDER });

                        tablaEncabezado.AddCell(new PdfPCell(new Phrase(String.Format("PERIODO: {0} a {1}", FechaDesde.ToShortDateString(), FechaHasta.ToShortDateString()), Normal)) { Colspan = 4, Border = Rectangle.NO_BORDER });
                        doc.Add(new Paragraph(" "));
                        tablaEncabezado.AddCell(new PdfPCell(GetNomenclatura()) { Colspan = 4 });
                        doc.Add(tablaEncabezado);
                        doc.Add(new Phrase());
                        doc.Add(new Phrase());
                        // tabla
                        PdfPTable tabla = new PdfPTable(new float[] { 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4 });

                        // Primera lìnea cabecera
                        tabla.AddCell(new PdfPCell(new Phrase("Fecha", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("HI", Chico)) { });
                        tabla.AddCell(new PdfPCell(new Phrase("HS", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("HCol", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("MI", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("MS", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("HTH", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("HTN", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("HE", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("ATR", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("ADL", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("Col.", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("S.Ent", Chico)));
                        tabla.AddCell(new PdfPCell(new Phrase("Permisos", Chico)));

                        foreach (var atraso in reporte)
                        {
                            //Fecha
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.Fecha.Value.ToString("ddd dd/MM"), Chico)));
                            //Hora Ingreso
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.EntradaTeorica.HasValue ? atraso.EntradaTeorica.Value.ToShortTimeString() : null, Chico)));
                            // Hora Salida
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.SalidaTeorica.HasValue ? atraso.SalidaTeorica.Value.ToShortTimeString() : null, Chico)));
                            // Colaciòn por turno
                            tabla.AddCell(new PdfPCell(new Phrase((int)atraso.TiempoColacion.Value.TotalHours + atraso.TiempoColacion.Value.ToString(@"\:mm"), Chico)));
                            // Marca de entrada
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.Entrada.HasValue ? atraso.Entrada.Value.ToShortTimeString() : null, Chico)));
                            // Marca de salida
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.Salida.HasValue ? atraso.Salida.Value.ToShortTimeString() : null, Chico)));
                            //Horas pactadas po hombre
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.printHorasPactadas, Chico)));
                            //Horas realizadas
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.printHorasReales.ToString(), Chico)));
                            //Horas extra
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.printHorasExtra, Chico)));
                            // Atraso
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.printAtraso, Chico)));
                            // Salida adelantada
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.printSalidaAdelantada, Chico)));
                            // Colación
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.printTiempoColacionReal, Chico)));
                            // S.Ent
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.printSobreEntrada, Chico)));
                            // Permisos
                            tabla.AddCell(new PdfPCell(new Phrase(atraso.Observacion, Chico)));
                        }
                        //Subtotal
                        tabla.AddCell(new PdfPCell(new Phrase("Sub Total", Chico)) { Colspan = 6 });
                        //Horas pactadas po hombre
                        tabla.AddCell(new PdfPCell(new Phrase(LibroAsistenciaDTOHelpers.CalculaJornada(reporte), Chico)));
                        //Horas realizadas
                        tabla.AddCell(new PdfPCell(new Phrase(LibroAsistenciaDTOHelpers.CalculaAsistencia(reporte), Chico)));
                        //Horas extra
                        tabla.AddCell(new PdfPCell(new Phrase(LibroAsistenciaDTOHelpers.CalculaHorasExtra(reporte), Chico)));
                        // Atraso
                        tabla.AddCell(new PdfPCell(new Phrase(LibroAsistenciaDTOHelpers.CalculaAtrasoEntrada(reporte), Chico)));
                        // Salida adelantada
                        tabla.AddCell(new PdfPCell(new Phrase(LibroAsistenciaDTOHelpers.CalculaSalidaAdelantada(reporte), Chico)));
                        // Colacón
                        tabla.AddCell(new PdfPCell(new Phrase(LibroAsistenciaDTOHelpers.CalculaColacion(reporte), Chico)));
                        // S.Ent
                        tabla.AddCell(new PdfPCell(new Phrase(LibroAsistenciaDTOHelpers.CalculaSobreEntrada(reporte), Chico)));
                        // Permisos
                        tabla.AddCell(new PdfPCell(new Phrase("", Chico)));
                        doc.Add(tabla);
                        doc.Add(new Phrase());

                        // Resumen
                        PdfPTable resumen = new PdfPTable(new float[] { 2, 1, 2, 1, 2, 1, 2, 1 });
                        //Días Trabajados
                        resumen.AddCell(new PdfPCell(new Phrase("Días Trabajados", Chico)) { Border = Rectangle.NO_BORDER });
                        resumen.AddCell(new PdfPCell(new Phrase(LibroAsistenciaDTOHelpers.CalculaDiasTrabajdos(reporte), Chico)) { Border = Rectangle.NO_BORDER });
                        //
                        resumen.AddCell(new PdfPCell(new Phrase("Horas Pactadas", Chico)) { Border = Rectangle.NO_BORDER });
                        resumen.AddCell(new PdfPCell(new Phrase(LibroAsistenciaDTOHelpers.CalculaAsistencia(reporte), Chico)) { Border = Rectangle.NO_BORDER });
                        //
                        resumen.AddCell(new PdfPCell(new Phrase("Horas extras", Chico)) { Border = Rectangle.NO_BORDER });
                        resumen.AddCell(new PdfPCell(new Phrase(LibroAsistenciaDTOHelpers.CalculaHorasExtra(reporte), Chico)) { Border = Rectangle.NO_BORDER });
                        //
                        resumen.AddCell(new PdfPCell(new Phrase("Errores de marca", Chico)) { Border = Rectangle.NO_BORDER });
                        resumen.AddCell(new PdfPCell(new Phrase(LibroAsistenciaDTOHelpers.CalculaErroresMarcaje(reporte), Chico)) { Border = Rectangle.NO_BORDER });
                        //
                        resumen.AddCell(new PdfPCell(new Phrase("Días ausentes", Chico)) { Border = Rectangle.NO_BORDER });
                        resumen.AddCell(new PdfPCell(new Phrase(LibroAsistenciaDTOHelpers.CalculaDiasInasistencias(reporte), Chico)) { Border = Rectangle.NO_BORDER });
                        //
                        resumen.AddCell(new PdfPCell(new Phrase("Horas Trabajadas", Chico)) { Border = Rectangle.NO_BORDER });
                        resumen.AddCell(new PdfPCell(new Phrase(LibroAsistenciaDTOHelpers.CalculaAsistencia(reporte), Chico)) { Border = Rectangle.NO_BORDER });
                        //
                        resumen.AddCell(new PdfPCell(new Phrase("Vacaciones", Chico)) { Border = Rectangle.NO_BORDER });
                        resumen.AddCell(new PdfPCell(new Phrase("", Chico)) { Border = Rectangle.NO_BORDER });

                        // Aquí va una tabla con el espacio para la firma
                        resumen.AddCell(new PdfPCell(new Phrase("", Chico)) { VerticalAlignment = Rectangle.ALIGN_BOTTOM, HorizontalAlignment = Rectangle.ALIGN_CENTER, Colspan = 2, Rowspan = 3, Border = Rectangle.NO_BORDER });
                        //
                        resumen.AddCell(new PdfPCell(new Phrase("Días Atraso", Chico)) { Border = Rectangle.NO_BORDER });
                        resumen.AddCell(new PdfPCell(new Phrase(LibroAsistenciaDTOHelpers.CalculaDiasAtraso(reporte), Chico)) { Border = Rectangle.NO_BORDER });
                        //
                        resumen.AddCell(new PdfPCell(new Phrase("Total Atraso", Chico)) { Border = Rectangle.NO_BORDER });
                        resumen.AddCell(new PdfPCell(new Phrase(LibroAsistenciaDTOHelpers.CalculaAtrasoEntrada(reporte), Chico)) { Border = Rectangle.NO_BORDER });
                        //
                        resumen.AddCell(new PdfPCell(new Phrase("Licencias Médicas", Chico)) { Border = Rectangle.NO_BORDER });
                        resumen.AddCell(new PdfPCell(new Phrase("", Chico)) { Border = Rectangle.NO_BORDER });
                        //
                        resumen.AddCell(new PdfPCell(new Phrase("Salidas", Chico)) { Border = Rectangle.NO_BORDER });
                        resumen.AddCell(new PdfPCell(new Phrase(LibroAsistenciaDTOHelpers.CalculaDiasSalidaAdelantada(reporte), Chico)) { Border = Rectangle.NO_BORDER });
                        //
                        resumen.AddCell(new PdfPCell(new Phrase("Total Salidas", Chico)) { Border = Rectangle.NO_BORDER });
                        resumen.AddCell(new PdfPCell(new Phrase(LibroAsistenciaDTOHelpers.CalculaSalidaAdelantada(reporte), Chico)) { Border = Rectangle.NO_BORDER });

                        resumen.AddCell(new PdfPCell(new Phrase("", Chico)) { Border = Rectangle.NO_BORDER });
                        resumen.AddCell(new PdfPCell(new Phrase("", Chico)) { Border = Rectangle.NO_BORDER });

                        resumen.AddCell(new PdfPCell(new Phrase(" ", Chico)) { Border = Rectangle.NO_BORDER, Colspan = 8, Rowspan = 5 });
                        resumen.AddCell(new PdfPCell(new Phrase(" ", Chico)) { Border = Rectangle.NO_BORDER, Colspan = 8 });

                        resumen.AddCell(new PdfPCell(new Phrase("", Chico)) { Border = Rectangle.NO_BORDER, Colspan = 6 });
                        resumen.AddCell(new PdfPCell(new Phrase("______________________ Firma Empleado", Chico)) { VerticalAlignment = Rectangle.ALIGN_BOTTOM, HorizontalAlignment = Rectangle.ALIGN_CENTER, Colspan = 2, Border = Rectangle.NO_BORDER });

                        doc.Add(resumen);

                        //PdfPTable firma = new PdfPTable(new float[] { 2, 1, 2, 1, 2, 1, 2, 1 });

                        //firma.AddCell(new PdfPCell(new Phrase(" ", Chico)) { Border = Rectangle.NO_BORDER, Colspan = 8, Rowspan = 2 });
                        ////firma.AddCell(new PdfPCell(new Phrase(" ", Chico)) { Border = Rectangle.NO_BORDER, Colspan = 8 });

                        //firma.AddCell(new PdfPCell(new Phrase("", Chico)) { Border = Rectangle.NO_BORDER, Colspan = 6 });
                        //firma.AddCell(new PdfPCell(new Phrase("______________________ Firma Empleado", Chico)) { VerticalAlignment = Rectangle.ALIGN_BOTTOM, HorizontalAlignment = Rectangle.ALIGN_CENTER, Colspan = 2, Border = Rectangle.NO_BORDER, FixedHeight = 1.7f });
                        //doc.Add(new Phrase());
                        //doc.Add(new Phrase());
                        //doc.Add(new Phrase());
                        //doc.Add(new Phrase());
                        //doc.Add(firma);

                        doc.NewPage();
                    }
                    doc.Close();
                    _Archivo = ms.ToArray();
                }
            }
        }
コード例 #40
0
ファイル: Header.cs プロジェクト: LazyAbstract/AReportes
 public Header(EMPRESA empresa, string path)
 {
     _Empresa = empresa;
     _path = path;
 }