Exemplo n.º 1
0
        private void Viewer_Load(object sender, EventArgs e)
        {
            switch (opcReporte)
            {
            case "Morosos":

                pnlMorosos.Enabled    = true;
                pnlMorosos.Visible    = true;
                cmbYear.Enabled       = false;
                cmbYear.DataSource    = YearDAL.getYears(500);
                cmbYear.ValueMember   = "Id";
                cmbYear.DisplayMember = "Desde";
                cmbYear.Enabled       = true;
                List <Curso> cursos = CursoDAL.getCursosByIdSucursal(Inicio.CurrentSucursal.Id, cmbYear.SelectedItem as Year);

                cmbCurso.Enabled       = false;
                cmbCurso.DataSource    = cursos;
                cmbCurso.ValueMember   = "Id";
                cmbCurso.DisplayMember = "Nombre";
                cmbCurso.Enabled       = true;
                lblTitulo.Text         = TituloReporte;
                ready = true;

                break;

            default:
                MessageBox.Show("El reporte solicitado no existe.", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.Close();
                break;
            }
        }
Exemplo n.º 2
0
        private void FillDgv(List <Matricula> lista)
        {
            dgvMatriculas.Rows.Clear();
            DateTime serverDate = YearDAL.getServerDate();
            int      students   = 1;

            foreach (Matricula obj in lista)
            {
                String       aldia      = "Si";
                string       proxima    = "";
                string       pendientes = "";
                List <Cuota> atrasadas  = obj.Cuotas.Where(a => (Convert.ToDateTime(a.FhRegistro) < serverDate || Convert.ToDateTime(a.FhRegistro) == serverDate) && a.Total < a.Precio).ToList();
                List <Cuota> proximas   = obj.Cuotas.Where(a => Convert.ToDateTime(a.FhRegistro) > serverDate && a.Total < a.Precio).ToList();

                foreach (Cuota objCuota in atrasadas)
                {
                    pendientes += "(" + Convert.ToDateTime(objCuota.FhRegistro).ToString("MMMM", new CultureInfo("ES-es")) + " $" + Decimal.Round((objCuota.Precio - objCuota.Total), 2) + ") ";
                }
                aldia = atrasadas.Count > 0 ? "No" : "Si";
                DateTime dateProx = proximas.Count > 0 ?atrasadas.Where(a => Convert.ToDateTime(a.FhRegistro).Month == serverDate.Month).FirstOrDefault() != null?Convert.ToDateTime(atrasadas.Where(a => Convert.ToDateTime(a.FhRegistro).Month == serverDate.Month).FirstOrDefault().FhRegistro): Convert.ToDateTime((from cuota in proximas orderby Convert.ToDateTime(cuota.FhRegistro) ascending select cuota).FirstOrDefault().FhRegistro) : atrasadas.Count > 0? new DateTime(DateTime.Now.Year, DateTime.Now.Month, Convert.ToInt32(obj.DiaLimite)):new DateTime();

                proxima = proximas.Count > 0 || atrasadas.Count > 0 ? dateProx.ToString("dd \"de\" MMMM \"del\" yyyy", new CultureInfo("ES-es")) : "";

                dgvMatriculas.Rows.Add(
                    obj.Id,
                    students + "-" + obj.Estudiante.Persona.Nombre,
                    obj.Estudiante.Telefono,
                    aldia,
                    pendientes,
                    proxima
                    );
                students++;
            }
        }
Exemplo n.º 3
0
        private void ControlMatriculas_Load(object sender, EventArgs e)
        {
            try
            {
                List <Curso> cursos = CursoDAL.getCursosByIdSucursal(Inicio.CurrentSucursal.Id, cbxYear.SelectedItem as Year);

                cbxYear.Enabled       = false;
                cbxYear.DataSource    = YearDAL.getYears(500);
                cbxYear.ValueMember   = "Id";
                cbxYear.DisplayMember = "Desde";
                cbxYear.Enabled       = true;

                cbxCursos.Enabled       = false;
                cbxCursos.DataSource    = cursos;
                cbxCursos.ValueMember   = "Id";
                cbxCursos.DisplayMember = "Nombre";
                cbxCursos.Enabled       = true;
                foreach (Curso curso in cursos)
                {
                    lblMatriculados.Text = (Convert.ToInt32(lblMatriculados.Text) + MatriculaDAL.countMatriculasByCurso(curso.Id)).ToString();
                }
                foreach (LstPermiso obj in Inicio.CurrentUser.Sucursales.Where(a => a.IdSucursal == Inicio.CurrentSucursal.Id).FirstOrDefault().Permisos)
                {
                    switch (obj.Permiso.Nombre)
                    {
                    case "Matricular Estudiantes":
                        if (obj.Otorgado)
                        {
                            btnNuevaMatricula.Enabled = true;
                        }
                        break;

                    case "Desertar Estudiantes":
                        if (obj.Otorgado)
                        {
                            btnDesertarAlumno.Enabled = true;
                        }
                        break;

                    default:
                        break;
                    }
                }
                tmrTaskDgv.Start();
            }
            catch (Exception ex)
            {
                string folderName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Errores_" + Assembly.GetExecutingAssembly().GetName().Name + "_V_" + Assembly.GetExecutingAssembly().GetName().Version.ToString();
                string fileName   = "Exeptions_" + Name + ".txt";

                Validation.FormManager frmManager = new Validation.FormManager();
                frmManager.writeException(folderName, fileName, ex, "Ha ocurrido un error al intentar cargar la información de este control");
                MessageBox.Show("Ha ocurrido un error al intentar cargar la información de este control, por favor comuniquese con el desarrollador al correo [email protected]", "Error fatal", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 4
0
        private void getLogin()
        {
            try
            {
                Useremp user = UserempDAL.getUseremp(txtLogin.Text, txtPass.Text);
                if (user != null)
                {
                    if (user.Estado == "A")
                    {
                        Inicio inicio = new Inicio();
                        Inicio.CurrentUser     = UserempDAL.getUseremp(txtLogin.Text, txtPass.Text);
                        Inicio.CurrentSucursal = Inicio.CurrentUser.Sucursales.Where(a => a.IdSucursal == Properties.Settings.Default.Sucursal).FirstOrDefault().Sucursal;
                        Inicio.CurrentYear     = YearDAL.getCurrentYear();
                        Inicio.CurrentYear     = YearDAL.getCurrentYear();
                        Properties.Settings.Default.LastUser = txtLogin.Text;
                        Properties.Settings.Default.Save();

                        inicio.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Su cuenta de usuario ha expirado o se encuentra desactivada, si desea acceder al sistema comuniquese con el administrador para reactivar su cuenta de usuario. Sentimos el inconveniente", "Usuario Inhabilitado", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("El usuario o la contraseña es incorrecto", "Datos de usuario incorrectos", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    picLook.Visible = true;
                    picLook.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                string folderName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Errores_" + Assembly.GetExecutingAssembly().GetName().Name + "_V_" + Assembly.GetExecutingAssembly().GetName().Version.ToString();
                string fileName   = "Exeptions_" + Name + ".txt";

                Validation.FormManager frmManager = new Validation.FormManager();
                frmManager.writeException(folderName, fileName, ex, "Ha ocurrido un error al intentar cargar la información de este control");
                MessageBox.Show("Ha ocurrido un error al intentar cargar la información de este control, por favor comuniquese con el desarrollador al correo [email protected]", "Error fatal", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 5
0
        private void ControlCursos_Load(object sender, EventArgs e)
        {
            try
            {
                cbxYear.DataSource    = YearDAL.getYears(500);
                cbxYear.ValueMember   = "Id";
                cbxYear.DisplayMember = "Desde";
                FillDgv(CursoDAL.getCursosByIdSucursal(Inicio.CurrentSucursal.Id, new Year((Int64)cbxYear.SelectedValue, "", "")));
                cbxYear.SelectedIndexChanged += new EventHandler(cbxYear_SelectedIndexChanged);
                foreach (LstPermiso obj in Inicio.CurrentUser.Sucursales.Where(a => a.IdSucursal == Inicio.CurrentSucursal.Id).FirstOrDefault().Permisos)
                {
                    switch (obj.Permiso.Nombre)
                    {
                    case "Crear Cursos":
                        if (obj.Otorgado)
                        {
                            btnNuevoCurso.Enabled = true;
                        }
                        break;

                    case "Anular Cursos":
                        if (obj.Otorgado)
                        {
                            btnAnularCurso.Enabled = true;
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                string folderName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Errores_" + Assembly.GetExecutingAssembly().GetName().Name + "_V_" + Assembly.GetExecutingAssembly().GetName().Version.ToString();
                string fileName   = "Exeptions_" + Name + ".txt";

                Validation.FormManager frmManager = new Validation.FormManager();
                frmManager.writeException(folderName, fileName, ex, "Ha ocurrido un error al intentar cargar la información de este control");
                MessageBox.Show("Ha ocurrido un error al intentar cargar la información de este control, por favor comuniquese con el desarrollador al correo [email protected]", "Error fatal", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 6
0
 public YearBAL()
 {
     Yeardal = new YearDAL();
 }
Exemplo n.º 7
0
        public List <YearEntities> GetYearPageWise(int pageIndex, ref int recordCount, int length)
        {
            YearDAL yearDAL = new YearDAL();

            return(yearDAL.GetYearPageWise(pageIndex, ref recordCount, length));
        }
Exemplo n.º 8
0
        public int SaveYear(YearEntities yearEntities)
        {
            YearDAL yearDAL = new YearDAL();

            return(yearDAL.SaveYear(yearEntities));
        }
Exemplo n.º 9
0
        public void GenerarRepMorosos(AxAcroPDFLib.AxAcroPDF VisorPDF, Int64 IdYear, Int64 IdCurso)
        {
            try
            {
                EliminarTemporal();
                VisorPDF.src = "";
                getDatos();

                Document pdf1 = new Document(PageSize.LETTER, 36.6929f, 36.6929f, 36.6929f, 36.6929f);

                string title = "Reporte de alumnos con mora" + "_" + DateTime.Now.ToString("yyyy_MM_dd_mm_hh_ss") + ".pdf";

                RutaArchivo = Path.GetTempPath() + "/" + title;

                PdfWriter       wri         = PdfWriter.GetInstance(pdf1, new FileStream(RutaArchivo, FileMode.Create));
                PageEventHelper eventHelper = new PageEventHelper();
                eventHelper.Reporte = 1;
                wri.PageEvent       = eventHelper;

                iTextSharp.text.Font fontEncabezado  = FontFactory.GetFont("Calibri", 11, iTextSharp.text.Font.BOLD, BaseColor.BLACK);
                iTextSharp.text.Font fontCuerpoSmall = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.NORMAL, BaseColor.BLACK);

                iTextSharp.text.Font fontHeaderTabla      = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.BOLD, BaseColor.BLACK);
                iTextSharp.text.Font fontHeaderTablaSmall = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, BaseColor.BLACK);
                iTextSharp.text.Font fontMotivo           = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.NORMAL, BaseColor.BLACK);

                pdf1.Open();
                pdf1.AddTitle(title);

                DocActual = pdf1;


                //encabezado
                float[] medCellsEncabezado = new float[] { 150.0394f, 400.0394f, 150.0394f };

                PdfPTable tblEcabezado = new PdfPTable(3);

                tblEcabezado.WidthPercentage = 100;
                tblEcabezado.SetWidths(medCellsEncabezado);
                iTextSharp.text.Image imagenLogo = iTextSharp.text.Image.GetInstance(Properties.Resources.goll_Logo_png, BaseColor.WHITE);
                imagenLogo.BorderWidth = 0;
                imagenLogo.Alignment   = Element.ALIGN_LEFT;
                float percentage = 0.0f;
                percentage = 150 / imagenLogo.Width;
                imagenLogo.ScalePercent(percentage * 40);

                PdfPCell cImagenLogo = new PdfPCell(imagenLogo);
                cImagenLogo.BorderWidth = 0;
                tblEcabezado.AddCell(cImagenLogo);

                Paragraph myheader1 = new Paragraph("\n\nACADEMIA DE INGLES Y COMPUTACIÓN GOLL", fontEncabezado);
                Paragraph myheader2 = new Paragraph("\nREPORTE DE ALUMNOS CON PAGOS PENDIENTES", fontEncabezado);
                Paragraph myheader3 = new Paragraph("\n" + CursoDAL.getCursoById(IdCurso).Nombre.ToUpper() + " " + Convert.ToDateTime(YearDAL.getYearById(IdYear).Desde).ToString("yyyy") + "\n\n", fontEncabezado);

                myheader1.Alignment = Element.ALIGN_CENTER;
                myheader2.Alignment = Element.ALIGN_CENTER;
                myheader3.Alignment = Element.ALIGN_CENTER;

                myheader1.SetLeading(0, 0.8f);
                myheader2.SetLeading(0, 0.8f);
                myheader3.SetLeading(0, 0.8f);

                PdfPCell clEncabezado = new PdfPCell(myheader1);
                clEncabezado.AddElement(myheader1);
                clEncabezado.AddElement(myheader2);
                clEncabezado.AddElement(myheader3);

                clEncabezado.BorderWidth = 0;

                tblEcabezado.AddCell(clEncabezado);

                iTextSharp.text.Image imagenSV = iTextSharp.text.Image.GetInstance(Properties.Resources.Goll_Logo, BaseColor.WHITE);
                imagenSV.BorderWidth = 0;
                imagenSV.Alignment   = Element.ALIGN_TOP;
                float percentageSV = 0.0f;
                percentageSV = 150 / imagenSV.Width;
                imagenSV.ScalePercent(percentageSV * 70);

                PdfPCell cImagenSV = new PdfPCell(imagenSV);
                cImagenSV.BorderWidth = 0;
                tblEcabezado.AddCell(cImagenSV);
                DocActual.Add(tblEcabezado);
                //header de tabla

                PdfPTable tabla = new PdfPTable(3);
                PdfPCell  celda = new PdfPCell();
                celda.HorizontalAlignment = 1;
                celda.VerticalAlignment   = 5;
                tabla.WidthPercentage     = 100;

                celda.BackgroundColor = BaseColor.LIGHT_GRAY;

                List <Matricula> matriculas = MatriculaDAL.searchMatriculasParametro("", IdYear, IdCurso);
                DateTime         serverDate = YearDAL.getServerDate();

                foreach (Matricula matricula in matriculas)
                {
                    float[] medColumnas = new float[] { 180f, 180f, 80f, 140f };

                    tabla = new PdfPTable(4);
                    tabla.WidthPercentage = 100;
                    tabla.SetWidths(medColumnas);

                    tabla.AddCell(GetCellHeaderTable("Alumno", 1, 1, fontHeaderTabla));
                    tabla.AddCell(GetCellHeaderTable("Dirección", 1, 1, fontHeaderTabla));
                    tabla.AddCell(GetCellHeaderTable("Teléfono", 1, 1, fontHeaderTabla));
                    tabla.AddCell(GetCellHeaderTable("Total Pendiente", 1, 1, fontHeaderTablaSmall));
                    List <Cuota> atrasadas = matricula.Cuotas.Where(a => (Convert.ToDateTime(a.FhRegistro) < serverDate.AddDays(Properties.Settings.Default.DaysMora)) && a.Total < a.Precio).ToList();
                    if (atrasadas.Count > 0)
                    {
                        tabla.AddCell(GetCellBodyTable("" + matricula.Estudiante.Persona.Nombre.ToUpper(), fontCuerpoSmall));
                        tabla.AddCell(GetCellBodyTable("" + matricula.Estudiante.Persona.Direccion.ToUpper(), fontCuerpoSmall));
                        tabla.AddCell(GetCellBodyTable("" + matricula.Estudiante.Telefono.ToUpper(), fontCuerpoSmall));
                        string  pendiente    = "";
                        string  totales      = "";
                        decimal mensualiades = 0;
                        foreach (Cuota cuota in atrasadas)
                        {
                            pendiente    += Convert.ToDateTime(cuota.FhRegistro).ToString("MMMM", new CultureInfo("ES-es")) + " $" + Decimal.Round((cuota.Precio - cuota.Total), 2) + "\n";
                            mensualiades += Decimal.Round((cuota.Precio - cuota.Total));
                        }
                        totales += "TOTAL EN CUOTAS $" + mensualiades;
                        totales += "        TOTAL EN MORA $" + Decimal.Round(Properties.Settings.Default.Mora * atrasadas.Count, 2);
                        totales += "        TOTAL A PAGAR $" + Decimal.Round((mensualiades + Properties.Settings.Default.Mora * atrasadas.Count), 2);

                        tabla.AddCell(GetCellBodyTable(pendiente.ToUpper(), fontMotivo));
                        tabla.AddCell(GetCellBodyTable(totales.ToUpper(), 4, 1, fontHeaderTabla));
                        DocActual.Add(tabla);
                        DocActual.Add(new Paragraph("\n", fontEncabezado));
                        //  DocActual.Add(new Chunk("\n"));
                    }
                }
                pdf1.Close();
                DocActual.Close();
                VisorPDF.src = RutaArchivo;
                VisorPDF.setZoom(95);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 10
0
        private void ControlEgresos_Load(object sender, EventArgs e)
        {
            try
            {
                cbxYear.DataSource    = YearDAL.getYears(10000);
                cbxYear.DisplayMember = "Desde";
                cbxYear.ValueMember   = "Id";

                DateTime date = DateTime.Today.AddMonths(-(DateTime.Today.Month - 1));
                for (int i = 0; i < 12; i++)
                {
                    cbxMonth.Items.Add(date.AddMonths(i).ToString("MMMM"));
                }

                cbxMonth.SelectedIndex = DateTime.Now.Month - 1;
                cbxYear.SelectedIndex  = 0;
                tmrTaskDgv.Start();

                cbxMonth.SelectedIndexChanged += cbxMonth_SelectedIndexChanged;
                cbxYear.SelectedIndexChanged  += cbxMonth_SelectedIndexChanged;
                rdbMontYear.CheckedChanged    += cbxMonth_SelectedIndexChanged;
                if (egresoMes == 1)
                {
                    pnlParametro.Enabled = false;
                    pnlParametro.Visible = false;
                    cbxMonth.Enabled     = false;
                    cbxYear.Enabled      = false;
                    this.FormBorderStyle = FormBorderStyle.Sizable;
                    lblTiltulo.Text      = "Egresos del mes de " + DateTime.Now.ToString("MMMM", new CultureInfo("es-ES"));
                }
                foreach (LstPermiso obj in Inicio.CurrentUser.Sucursales.Where(a => a.IdSucursal == Inicio.CurrentSucursal.Id).FirstOrDefault().Permisos)
                {
                    switch (obj.Permiso.Nombre)
                    {
                    case "Registrar Egresos":
                        if (obj.Otorgado)
                        {
                            btnNuevoEgreso.Enabled = true;
                        }
                        break;

                    case "Anular Egresos":
                        if (obj.Otorgado)
                        {
                            btnAnularEgreso.Enabled = true;
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                string folderName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Errores_" + Assembly.GetExecutingAssembly().GetName().Name + "_V_" + Assembly.GetExecutingAssembly().GetName().Version.ToString();
                string fileName   = "Exeptions_" + Name + ".txt";

                Validation.FormManager frmManager = new Validation.FormManager();
                frmManager.writeException(folderName, fileName, ex, "Ha ocurrido un error al intentar cargar la información de este control");
                MessageBox.Show("Ha ocurrido un error al intentar cargar la información de este control, por favor comuniquese con el desarrollador al correo [email protected]", "Error fatal", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 11
0
        private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
        {
            try
            {
                StringFormat formato = new StringFormat();
                formato.Alignment     = StringAlignment.Near;
                formato.LineAlignment = StringAlignment.Near;

                e.Graphics.PageUnit    = GraphicsUnit.Millimeter;
                e.PageSettings.Margins = new Margins(0, 0, 0, 0);

                Pen  blackPen   = new Pen(Color.Black, (float)0.2);
                Font fontNormal = new Font("Arial", 9, FontStyle.Regular);
                Font fontSmall  = new Font("Arial", 8, FontStyle.Regular);

                Font fontBold = new Font("Arial", 9, FontStyle.Bold);

                Brush brocha = Brushes.Black;

                Point point1 = new Point(5, 5);
                Point point2 = new Point(205, 5);
                //  e.Graphics.DrawLine(blackPen, point1, point2);

                point1 = new Point(5, 5);
                point2 = new Point(5, 274);
                // e.Graphics.DrawLine(blackPen, point1, point2);

                point1 = new Point(5, 274);
                point2 = new Point(205, 274);
                //  e.Graphics.DrawLine(blackPen, point1, point2);

                point1 = new Point(205, 274);
                point2 = new Point(205, 5);
                // e.Graphics.DrawLine(blackPen, point1, point2);

                ////////////////////////////////////////////////////////////////
                ////                  row1 pictures, Tel, NFact               //
                ////////////////////////////////////////////////////////////////

                int row1PosY = 12, row1Cell0PosX = 10, row1Cell1PosX = 79, row1Cell2PosX = 167;
                e.Graphics.DrawImage(GOLLSYSTEM.Properties.Resources.Goll_Logo_Black, row1Cell0PosX, row1PosY, 60, 24);
                e.Graphics.DrawImage(GOLLSYSTEM.Properties.Resources.Logo_goll_center, row1Cell1PosX, row1PosY, 60, 18);
                e.Graphics.DrawString("TEL.: " + GOLLSYSTEM.Properties.Settings.Default.Tel, fontSmall, brocha, row1Cell1PosX + 18, row1PosY + 15);
                e.Graphics.DrawImage(GOLLSYSTEM.Properties.Resources.box_bill, row1Cell2PosX, row1PosY - 5, 38, 16);

                //   e.Graphics.DrawRectangle(new Pen(Brushes.Black, 1f), Rectangle.FromLTRB(row1Cell2PosX, row1PosY, 205, 25));
                e.Graphics.DrawString(currentFactura.NFactura, fontBold, brocha, row1Cell2PosX + 10, row1PosY + 1);

                ////////////////////////////////////////////////////////////////
                ////                  row2 total                              //
                ////////////////////////////////////////////////////////////////

                int row2PosY = 36, row2Cell0PosX = 8, row2Cell1PosX = 147;
                e.Graphics.DrawString("RECIBO DE INGRESO", fontNormal, brocha, row2Cell0PosX, row2PosY);
                decimal total = 0;
                foreach (Detfactura det in currentFactura.DetsFactura)
                {
                    total += det.Total - det.Descuento;
                }
                e.Graphics.DrawString("POR$ " + Decimal.Round(total, 2), fontNormal, brocha, row2Cell1PosX, row2PosY);
                point1 = new Point(row2Cell1PosX + 10, row2PosY + 4);
                point2 = new Point(190, row2PosY + 4);
                e.Graphics.DrawLine(blackPen, point1, point2);

                ////////////////////////////////////////////////////////////////
                ////                  row3 cliente                              //
                ////////////////////////////////////////////////////////////////

                int row3PosY = 48, row3Cell0PosX = 10;
                e.Graphics.DrawString("RECIBI DEL SR(ES):  " + PersonaDAL.getPersonaById(currentFactura.IdPersona).Nombre.ToUpper(), fontNormal, brocha, row3Cell0PosX, row3PosY);
                point1 = new Point(row3Cell0PosX + 32, row3PosY + 4);
                point2 = new Point(190, row3PosY + 4);
                e.Graphics.DrawLine(blackPen, point1, point2);

                ////////////////////////////////////////////////////////////////
                ////                  row4 datos del cliente                  //
                ////////////////////////////////////////////////////////////////

                int row4PosY = 56, row4Cell0PosX = 10, row4Cell1PosX = 64, row4Cell2PosX = 121;
                e.Graphics.DrawString("TEL.:", fontNormal, brocha, row4Cell0PosX, row4PosY);

                point1 = new Point(row4Cell0PosX + 9, row4PosY + 4);
                point2 = new Point(60, row4PosY + 4);
                e.Graphics.DrawLine(blackPen, point1, point2);

                e.Graphics.DrawString("CEL.:", fontNormal, brocha, row4Cell1PosX, row4PosY);
                point1 = new Point(row4Cell1PosX + 10, row4PosY + 4);
                point2 = new Point(118, row4PosY + 4);
                e.Graphics.DrawLine(blackPen, point1, point2);

                e.Graphics.DrawString("E-MAIL.:", fontNormal, brocha, row4Cell2PosX, row4PosY);
                point1 = new Point(row4Cell2PosX + 14, row4PosY + 4);
                point2 = new Point(190, row4PosY + 4);
                e.Graphics.DrawLine(blackPen, point1, point2);

                ////////////////////////////////////////////////////////////////
                ////                  row5 cantidad de                        //
                ////////////////////////////////////////////////////////////////

                int    row5PosY = 64, row5Cell0PosX = 10;
                Moneda moneda   = new Moneda();
                string Dolares  = Decimal.Round(total, 2).ToString().Substring(0, Decimal.Round(total, 2).ToString().Length - 3);
                string Centavos = Decimal.Round(total, 2).ToString().Substring(Decimal.Round(total, 2).ToString().Length - 2, 2);

                e.Graphics.DrawString("LA CANTIDAD DE:    " + moneda.Convertir(Dolares, true, "DOLARES").Substring(0, moneda.Convertir(Dolares, true, "DOLARES").Length - 6) + (Centavos == "00" ? "" : " CON " + moneda.Convertir(Centavos, true, "CENTAVOS").Substring(0, moneda.Convertir(Centavos, true, "CENTAVOS").Length - 6)), fontNormal, brocha, row5Cell0PosX, row5PosY);
                point1 = new Point(row5Cell0PosX + 32, row5PosY + 4);
                point2 = new Point(190, row5PosY + 4);
                e.Graphics.DrawLine(blackPen, point1, point2);

                ////////////////////////////////////////////////////////////////
                ////                  row6 concepto de                        //
                ////////////////////////////////////////////////////////////////

                int    row6PosY = 72, row6Cell0PosX = 10;
                string concepto = "";
                foreach (Detfactura det in currentFactura.DetsFactura)
                {
                    concepto = concepto + (det.Producto.Nombre + (det.Tipo == "M" ? " \"" + Convert.ToDateTime(CuotaDAL.getCuotaById(det.Matricdetfac.IdCuota).FhRegistro).ToString("MMMM", new CultureInfo("es-ES")) + "\"" : "") + (currentFactura.DetsFactura.Count > 1 ? currentFactura.DetsFactura.Last().Id == det.Id ? "." : ", " : ".") + "");
                }

                e.Graphics.DrawString("EN CONCEPTO DE:  " + concepto.ToUpper(), fontNormal, brocha, row6Cell0PosX, row6PosY);
                point1 = new Point(row6Cell0PosX + 32, row6PosY + 4);
                point2 = new Point(190, row6PosY + 4);
                e.Graphics.DrawLine(blackPen, point1, point2);

                ////////////////////////////////////////////////////////////////
                ////                  row7 total                              //
                ////////////////////////////////////////////////////////////////

                int row7PosY = 80, row7Cell0PosX = 10, row7Cell1PosX = 64, row7Cell2PosX = 121;

                e.Graphics.DrawString("RESERVACION", fontNormal, brocha, row7Cell0PosX, row7PosY);
                e.Graphics.DrawRectangle(new Pen(Brushes.Black, 0.5f), Rectangle.FromLTRB(row7Cell0PosX + 30, row7PosY, row7Cell0PosX + 40, row7PosY + 5));
                foreach (Detfactura det in currentFactura.DetsFactura)
                {
                    if (det.Tipo == "R")
                    {
                        e.Graphics.DrawImage(GOLLSYSTEM.Properties.Resources.marca_de_verificacion, row7Cell0PosX + 33, row7PosY, 5, 5);
                    }
                }


                e.Graphics.DrawString("MENSUALIDAD", fontNormal, brocha, row7Cell1PosX, row7PosY);
                e.Graphics.DrawRectangle(new Pen(Brushes.Black, 0.5f), Rectangle.FromLTRB(row7Cell1PosX + 30, row7PosY, row7Cell1PosX + 40, row7PosY + 5));
                foreach (Detfactura det in currentFactura.DetsFactura)
                {
                    if (det.Tipo == "M")
                    {
                        e.Graphics.DrawImage(GOLLSYSTEM.Properties.Resources.marca_de_verificacion, row7Cell1PosX + 33, row7PosY, 5, 5);
                    }
                }


                e.Graphics.DrawString("CANCELACION", fontNormal, brocha, row7Cell2PosX, row7PosY);
                e.Graphics.DrawRectangle(new Pen(Brushes.Black, 0.5f), Rectangle.FromLTRB(row7Cell2PosX + 30, row7PosY, row7Cell2PosX + 40, row7PosY + 5));
                foreach (Detfactura det in currentFactura.DetsFactura)
                {
                    if (det.Tipo == "C" || det.Tipo == "F")
                    {
                        e.Graphics.DrawImage(GOLLSYSTEM.Properties.Resources.marca_de_verificacion, row7Cell2PosX + 33, row7PosY, 5, 5);
                    }
                }


                ////////////////////////////////////////////////////////////////
                ////                  row8 Observacion                        //
                ////////////////////////////////////////////////////////////////

                int    row8PosY = 89, row8Cell0PosX = 10;
                string Obs1   = "";
                string Obs2   = "";
                string Obs3   = "";
                char[] letras = currentFactura.Observacion.ToArray();
                foreach (char letra in letras)
                {
                    if (Obs1.Length < 81)
                    {
                        Obs1 += letra;
                    }
                    else
                    if (Obs2.Length < 91)
                    {
                        Obs2 += letra;
                    }
                    else
                    if (Obs3.Length < 91)
                    {
                        Obs3 += letra;
                    }
                }
                e.Graphics.DrawString("OBSERVACION ", fontNormal, brocha, row8Cell0PosX, row8PosY);
                point1 = new Point(row8Cell0PosX + 28, row8PosY + 4);
                point2 = new Point(190, row8PosY + 4);
                e.Graphics.DrawLine(blackPen, point1, point2);
                e.Graphics.DrawString(Obs1.ToUpper(), fontSmall, brocha, row8Cell0PosX + 28, row8PosY);

                point1 = new Point(row8Cell0PosX, row8PosY + 4 + 7);
                point2 = new Point(190, row8PosY + 4 + 7);
                e.Graphics.DrawLine(blackPen, point1, point2);
                e.Graphics.DrawString(Obs2.ToUpper(), fontSmall, brocha, row8Cell0PosX, row8PosY + 7);

                point1 = new Point(row8Cell0PosX, row8PosY + 4 + 7 + 7);
                point2 = new Point(190, row8PosY + 4 + 7 + 7);
                e.Graphics.DrawLine(blackPen, point1, point2);
                e.Graphics.DrawString(Obs3.ToUpper(), fontSmall, brocha, row8Cell0PosX, row8PosY + 7 + 7);

                ////////////////////////////////////////////////////////////////
                ////                  row9 mora                               //
                ////////////////////////////////////////////////////////////////

                int row9PosY = 110, row9Cell0PosX = 57;

                e.Graphics.DrawString("NOTA: DESPUES DE " + Properties.Settings.Default.DaysMora + " DIAS SE COBRARA $" + Properties.Settings.Default.Mora + " POR MORA", fontNormal, brocha, row9Cell0PosX, row9PosY);

                ////////////////////////////////////////////////////////////////
                ////                  row10 recibo, fwcha                     //
                ////////////////////////////////////////////////////////////////

                int row10PosY = 128, row10Cell0PosX = 14, row10Cell1PosX = 149;

                point1 = new Point(row10Cell0PosX, row10PosY);
                point2 = new Point(54, row10PosY);
                e.Graphics.DrawLine(blackPen, point1, point2);

                e.Graphics.DrawString("RECIBO", fontNormal, brocha, row10Cell0PosX + 13, row10PosY + 1);

                point1 = new Point(row10Cell1PosX, row10PosY);
                point2 = new Point(190, row10PosY);
                e.Graphics.DrawLine(blackPen, point1, point2);

                e.Graphics.DrawString(YearDAL.getServerDate().ToString("dd/MM/yyyy"), fontBold, brocha, row10Cell1PosX + 11, row10PosY - 4);
                e.Graphics.DrawString("FECHA", fontNormal, brocha, row10Cell1PosX + 14, row10PosY + 1);

                ////////////////////////////////////////////////////////////////
                ////                  Duplicado                               //
                ////////////////////////////////////////////////////////////////
                point1 = new Point(5, 137);
                point2 = new Point(205, 137);
                e.Graphics.DrawLine(blackPen, point1, point2);
                int duplicatedTop = 137;
                ////////////////////////////////////////////////////////////////
                ////                  row1 pictures, Tel, NFact               //
                ////////////////////////////////////////////////////////////////

                row1PosY = 12 + duplicatedTop;
                e.Graphics.DrawImage(GOLLSYSTEM.Properties.Resources.Goll_Logo_Black, row1Cell0PosX, row1PosY, 60, 24);
                e.Graphics.DrawImage(GOLLSYSTEM.Properties.Resources.Logo_goll_center, row1Cell1PosX, row1PosY, 60, 18);
                e.Graphics.DrawString("TEL.: " + GOLLSYSTEM.Properties.Settings.Default.Tel, fontNormal, brocha, row1Cell1PosX + 18, row1PosY + 15);
                e.Graphics.DrawImage(GOLLSYSTEM.Properties.Resources.box_bill, row1Cell2PosX, row1PosY - 5, 38, 16);

                //   e.Graphics.DrawRectangle(new Pen(Brushes.Black, 1f), Rectangle.FromLTRB(row1Cell2PosX, row1PosY, 205, 25));
                e.Graphics.DrawString(currentFactura.NFactura, fontBold, brocha, row1Cell2PosX + 10, row1PosY + 1);

                ////////////////////////////////////////////////////////////////
                ////                  row2 total                              //
                ////////////////////////////////////////////////////////////////

                row2PosY = 36 + duplicatedTop;
                e.Graphics.DrawString("RECIBO DE INGRESO", fontNormal, brocha, row2Cell0PosX, row2PosY);
                e.Graphics.DrawString("POR$ " + Decimal.Round(total, 2), fontNormal, brocha, row2Cell1PosX, row2PosY);
                point1 = new Point(row2Cell1PosX + 10, row2PosY + 4);
                point2 = new Point(190, row2PosY + 4);
                e.Graphics.DrawLine(blackPen, point1, point2);

                ////////////////////////////////////////////////////////////////
                ////                  row3 cliente                              //
                ////////////////////////////////////////////////////////////////

                row3PosY = 48 + duplicatedTop;
                e.Graphics.DrawString("RECIBI DEL SR(ES):  " + PersonaDAL.getPersonaById(currentFactura.IdPersona).Nombre.ToUpper(), fontNormal, brocha, row3Cell0PosX, row3PosY);
                point1 = new Point(row3Cell0PosX + 32, row3PosY + 4);
                point2 = new Point(190, row3PosY + 4);
                e.Graphics.DrawLine(blackPen, point1, point2);

                ////////////////////////////////////////////////////////////////
                ////                  row4 datos del cliente                  //
                ////////////////////////////////////////////////////////////////

                row4PosY = 56 + duplicatedTop;
                e.Graphics.DrawString("TEL.:", fontNormal, brocha, row4Cell0PosX, row4PosY);

                point1 = new Point(row4Cell0PosX + 9, row4PosY + 4);
                point2 = new Point(60, row4PosY + 4);
                e.Graphics.DrawLine(blackPen, point1, point2);

                e.Graphics.DrawString("CEL.:", fontNormal, brocha, row4Cell1PosX, row4PosY);
                point1 = new Point(row4Cell1PosX + 10, row4PosY + 4);
                point2 = new Point(118, row4PosY + 4);
                e.Graphics.DrawLine(blackPen, point1, point2);

                e.Graphics.DrawString("E-MAIL.:", fontNormal, brocha, row4Cell2PosX, row4PosY);
                point1 = new Point(row4Cell2PosX + 14, row4PosY + 4);
                point2 = new Point(190, row4PosY + 4);
                e.Graphics.DrawLine(blackPen, point1, point2);

                ////////////////////////////////////////////////////////////////
                ////                  row5 cantidad de                        //
                ////////////////////////////////////////////////////////////////

                row5PosY = 64 + duplicatedTop;
                e.Graphics.DrawString("LA CANTIDAD DE:    " + moneda.Convertir(Dolares, true, "DOLARES").Substring(0, moneda.Convertir(Dolares, true, "DOLARES").Length - 6) + (Centavos == "00" ? "" : " CON " + moneda.Convertir(Centavos, true, "CENTAVOS").Substring(0, moneda.Convertir(Centavos, true, "CENTAVOS").Length - 6)), fontNormal, brocha, row5Cell0PosX, row5PosY);
                point1 = new Point(row5Cell0PosX + 32, row5PosY + 4);
                point2 = new Point(190, row5PosY + 4);
                e.Graphics.DrawLine(blackPen, point1, point2);

                ////////////////////////////////////////////////////////////////
                ////                  row6 concepto de                        //
                ////////////////////////////////////////////////////////////////

                row6PosY = 72 + duplicatedTop;
                e.Graphics.DrawString("EN CONCEPTO DE:  " + concepto.ToUpper(), fontNormal, brocha, row6Cell0PosX, row6PosY);
                point1 = new Point(row6Cell0PosX + 32, row6PosY + 4);
                point2 = new Point(190, row6PosY + 4);
                e.Graphics.DrawLine(blackPen, point1, point2);

                ////////////////////////////////////////////////////////////////
                ////                  row7 total                              //
                ////////////////////////////////////////////////////////////////

                row7PosY = 80 + duplicatedTop;

                e.Graphics.DrawString("RESERVACION", fontNormal, brocha, row7Cell0PosX, row7PosY);
                e.Graphics.DrawRectangle(new Pen(Brushes.Black, 0.5f), Rectangle.FromLTRB(row7Cell0PosX + 30, row7PosY, row7Cell0PosX + 40, row7PosY + 5));
                foreach (Detfactura det in currentFactura.DetsFactura)
                {
                    if (det.Tipo == "R")
                    {
                        e.Graphics.DrawImage(GOLLSYSTEM.Properties.Resources.marca_de_verificacion, row7Cell0PosX + 33, row7PosY, 5, 5);
                    }
                }


                e.Graphics.DrawString("MENSUALIDAD", fontNormal, brocha, row7Cell1PosX, row7PosY);
                e.Graphics.DrawRectangle(new Pen(Brushes.Black, 0.5f), Rectangle.FromLTRB(row7Cell1PosX + 30, row7PosY, row7Cell1PosX + 40, row7PosY + 5));
                foreach (Detfactura det in currentFactura.DetsFactura)
                {
                    if (det.Tipo == "M")
                    {
                        e.Graphics.DrawImage(GOLLSYSTEM.Properties.Resources.marca_de_verificacion, row7Cell1PosX + 33, row7PosY, 5, 5);
                    }
                }


                e.Graphics.DrawString("CANCELACION", fontNormal, brocha, row7Cell2PosX, row7PosY);
                e.Graphics.DrawRectangle(new Pen(Brushes.Black, 0.5f), Rectangle.FromLTRB(row7Cell2PosX + 30, row7PosY, row7Cell2PosX + 40, row7PosY + 5));
                foreach (Detfactura det in currentFactura.DetsFactura)
                {
                    if (det.Tipo == "C" || det.Tipo == "F")
                    {
                        e.Graphics.DrawImage(GOLLSYSTEM.Properties.Resources.marca_de_verificacion, row7Cell2PosX + 33, row7PosY, 5, 5);
                    }
                }


                ////////////////////////////////////////////////////////////////
                ////                  row8 Observacion                        //
                ////////////////////////////////////////////////////////////////

                row8PosY = 89 + duplicatedTop;

                e.Graphics.DrawString("OBSERVACION ", fontNormal, brocha, row8Cell0PosX, row8PosY);
                point1 = new Point(row8Cell0PosX + 28, row8PosY + 4);
                point2 = new Point(190, row8PosY + 4);
                e.Graphics.DrawLine(blackPen, point1, point2);
                e.Graphics.DrawString(Obs1.ToUpper(), fontSmall, brocha, row8Cell0PosX + 28, row8PosY);

                point1 = new Point(row8Cell0PosX, row8PosY + 4 + 7);
                point2 = new Point(190, row8PosY + 4 + 7);
                e.Graphics.DrawLine(blackPen, point1, point2);
                e.Graphics.DrawString(Obs2.ToUpper(), fontSmall, brocha, row8Cell0PosX, row8PosY + 7);

                point1 = new Point(row8Cell0PosX, row8PosY + 4 + 7 + 7);
                point2 = new Point(190, row8PosY + 4 + 7 + 7);
                e.Graphics.DrawLine(blackPen, point1, point2);
                e.Graphics.DrawString(Obs3.ToUpper(), fontSmall, brocha, row8Cell0PosX, row8PosY + 7 + 7);

                ////////////////////////////////////////////////////////////////
                ////                  row9 mora                               //
                ////////////////////////////////////////////////////////////////

                row9PosY = 110 + duplicatedTop;

                e.Graphics.DrawString("NOTA: DESPUES DE " + Properties.Settings.Default.DaysMora + " DIAS SE COBRARA $" + Properties.Settings.Default.Mora + " POR MORA", fontNormal, brocha, row9Cell0PosX, row9PosY);

                ////////////////////////////////////////////////////////////////
                ////                  row10 recibo, fwcha                     //
                ////////////////////////////////////////////////////////////////

                row10PosY = 128 + duplicatedTop;

                point1 = new Point(row10Cell0PosX, row10PosY);
                point2 = new Point(54, row10PosY);
                e.Graphics.DrawLine(blackPen, point1, point2);

                e.Graphics.DrawString("RECIBO", fontNormal, brocha, row10Cell0PosX + 13, row10PosY + 1);

                point1 = new Point(row10Cell1PosX, row10PosY);
                point2 = new Point(190, row10PosY);
                e.Graphics.DrawLine(blackPen, point1, point2);

                e.Graphics.DrawString(YearDAL.getServerDate().ToString("dd/MM/yyyy"), fontBold, brocha, row10Cell1PosX + 11, row10PosY - 4);
                e.Graphics.DrawString("FECHA", fontNormal, brocha, row10Cell1PosX + 14, row10PosY + 1);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.ToString());
            }
        }
Exemplo n.º 12
0
 public CompanyBAL()
 {
     compdal = new CompanyDAL();
     yeardal = new YearDAL();
 }